Skip to content

D3.16 The Free plan in the CLI: free model, plan marks, wallet lines, granted credit (merge after the server) - #55

Merged
ahokik merged 15 commits into
mainfrom
free-plan
Oct 22, 2026
Merged

ahokik merged 15 commits into
mainfrom
free-plan

Conversation

@ahokik

@ahokik ahokik commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

The CLI part of D3.16 "The Free plan" (orca-design designs/free-plan.md, merged as 5023abd; values in designs/limits.md): F16, F21, F32, F44, F47, "Errors" and "What a person sees" (API, CLI), with amendment A2 (orca-design #133, proposed; the build follows it).

Merge condition

Merge after orca-design #133 (A2) is approved and the server's D3.16 build is merged and deployed (orca-agent-server: plan on GET /api/models, the wallet's new fields including free_model_today, the new refusal codes and params, and the four session events). Every new field is optional here, so against today's server the CLI behaves as before (no plan column, no new wallet lines, no words). No version bump in this PR: the repo cuts a separate "CLI vX.Y.Z" PR after a feature lands (#43 then #44, #41 then #42).

Changes by file

  • src/lib/types.ts: ModelPlan and PickModel.plan; the wallet's granted_credit_micro_usd, paid_credit_micro_usd, granted_credit[] (GrantedCredit), expired_micro_usd, free_model_today (WalletFreeModel, A2: the wallet's free_model stays the plan facts' model list), included_hours_withheld, network, credit_request.
  • src/lib/plan.ts (new): planWord ("free model", "Pro and Max"), planColumn, and planActions/planWords: each refusal's ways forward, the dashboard's buttons as words with the command for each, read from code and param, never the message.
  • src/lib/api.ts: mapApiError prints a Free plan refusal (model_not_in_plan, free_plan, free_model_daily, free_model_capacity, included_hours, free_model_unavailable, and A2's rate_limit_exceeded params free_model_busy (try again in a minute, or add your own OpenRouter key), turns_per_day (more at 00:00 UTC, or upgrade) and free_sandboxes_busy (try again in a few minutes, or upgrade)) as the server's message, then its ways forward, exit 1. Other rate limits are unchanged. A 403 model_not_in_plan is the plan's answer, so it no longer reads as the key's role (exit 3), and a 503 free_model_unavailable no longer says "try again in a moment".
  • src/lib/models.ts: picker rows carry the plan mark; freeModels (the Orca credit models the server marks free, which it does only on Free) and freeFirst; modelRows keeps plan for MCP; creditOut offers the switch for model_not_in_plan and none for included_hours (machine time, which no switch of model pays for); refusedAtAdmission covers model_not_in_plan; offersFreeModel.
  • src/commands/models.tsx: a plan column on Orca credit models where the server marks one (none on Pro and Max); plain rows gain the mark as a fourth column (- when none).
  • src/commands/agents.tsx: agents create with no model, at a terminal: on Free the free model is listed first and preselected.
  • src/commands/chat.tsx, src/ui/Chat.tsx, src/ui/SwitchPrompt.tsx: refusals and Free stops print the server's message and the ways forward as words (single turn: on stderr under the error; REPL: a note). Where "switch this session to the free model" is one (model_not_in_plan, free_plan), the existing switch lists the free model first, preselected, labelled "Switch this session to the free model or your own key". Session notices print on stderr (single turn) or in the transcript (REPL).
  • src/lib/sessions.ts: noticeText and a notice chat event for orca.compute.warning, orca.free_model.turn_limit, orca.turn.time_limit, orca.network.off (the network one as network off. <message>); --json passes them through as raw events.
  • src/lib/format.ts: formatDayMonth ("1 November"), formatDayShort ("4 Dec 2026"), formatHours (to a tenth, rounded down).
  • src/lib/wallet.ts (new), src/ui/WalletView.tsx, src/commands/billing.tsx: orca billing wallet prints the design's lines: granted credit $12.40 left of $20.00, expires 4 Dec 2026 per grant (its last day: expires_at is 00:00 UTC the day after), paid credit $18.20 (never expires), machine time 1 h included: 0.4 h used, resets 1 November (or used), free model 40 of 100 calls today (from free_model_today, A2), network off. <message>, and on Free more credit <message>, both messages the server's. With included_hours_withheld (A2): machine time not included for this organization and the line "Free's included hour and free model are not available for this organization. Add credit, or bring your own provider key." Plain mode adds granted_credit, paid_credit, one grant row each (left, granted, last day), expired, free_model_calls_today, free_model_calls_per_day, network_off, included_hours_withheld, with the messages on stderr. --json passes every field through.
  • src/mcp/server.ts: the list_models description names plan and its values; get_wallet names every new field.
  • README.md, plugins/orca/skills/use-orca/SKILL.md, references/cli-cheatsheet.md: the plan marks, the Free refusals and notices, granted and paid credit.
  • Tests: test/lib/plan.test.ts (new), test/lib/models.test.ts, test/lib/sessions.test.ts, test/api.test.ts, test/format.test.ts, test/commands/{models,agents,chat,billing}.test.ts, test/ui/{Chat,WalletView}.test.tsx, test/mcp/server.test.ts.

For the server build to check

  • The wallet's free-model count is free_model_today (A2, #133), so it no longer collides with the plan facts' free_model the wallet carries (src/api/billing.rs:74-95).
  • The free model for agents create comes from GET /api/models (plan: "free", the server's per-tier mark from its free-model list), not from GET /api/public/plans, which does not know the caller's tier; no extra request.
  • The session events are read as top-level stream events {type, message, at} and shown whatever turn they belong to.

D6.7 (A1, F37): left for #54

orca-cli #54 (sandbox-sleep) is not merged, so its files are untouched. When it is, the change is:

  • src/lib/types.ts SandboxSleep.outcome: add 'discarded' (at a money or hours stop on Free the snapshot failed and the compute was deleted anyway; state reads none).
  • src/lib/sessions.ts sleepFailure: already returns last_sleep.message for any outcome other than asleep or null, so discarded prints the server's message ("The workspace was larger than the 100 MiB Free keeps, so it was not saved." or "The workspace could not be saved, so it was not kept."); its comment names discarded.
  • orca sessions get: orca sessions sleep: put a session's sandbox to sleep now (D6.7) #54 keeps only state; keep last_sleep too and, when its outcome is discarded, print its message on the sandbox line, so the person is told the workspace was not saved.
  • MCP get_session and the sleep tool's description name discarded; a discarded fixture in test/lib/sessions.test.ts and test/commands/sessions.test.ts.

Checks (local; CI minutes are used up)

  • npm run typecheck: pass
  • npm run lint: pass
  • npm test: 42 files, 556 tests passed (512 before)
  • npm run build: build success
  • The first commit alone: typecheck pass, 540 tests passed.

A6 and A7 (approved by the user 2026-10-21; head a81fdbe)

All amendments A1 to A7 are approved and merged in orca-design (A6 #139 at bf2f489, A7 #140 at 4e33b84).

  • A6 (6), (32): capacity and daily refusals offer "Add your own OpenRouter key" and "Add credit", no Upgrade; the three daily texts print as sent.
  • F26: 403 organization_suspended prints the server's message, exit 1 (was "not allowed" with the auth exit code), also in orca chat.
  • A6 (1), (2), (26): orca chat prints both workspace events on stderr like the other notices.
  • A6 (4), (28): orca sessions sleep shows the suspended and network_on reasons; F37's discarded outcome is typed and not treated as a failure.
  • A6 (13), (28): orca billing wallet prints network on. <message> while running sandboxes lack the network, plus a sandboxes_without_network row; a null free_model_today prints no line.
  • README and use-orca: no "or upgrade"; the suspension, the two workspace notices and the network line.
  • A7 (3): no Free-terms dates anywhere.

Checks: npm run typecheck clean; npm run lint clean; npm test 596 passed (42 files); npm run build success; bun scripts/build-binary.ts bun-darwin-arm64 built, prints 1.5.0.

Review round 1 (orca-2-prod), head f46aa9e:

  • 96c3ecd:
    • model_not_in_plan is no longer a credit refusal. On Pro or Max models it asks "Upgrade, or switch this session?", never "Top up".
    • free_model_unavailable offers the switch to the next free model only while /api/models lists one. Under A5's empty list it prints the server's message.
    • included_hours has no client "Add credit" action: the server's message offers credit exactly when Free has a rate.
  • c7c9c89: orca sessions get prints last_sleep's words (discarded, near limit, suspended, network on), and --json and MCP get_session carry last_sleep.
  • f46aa9e:
    • No plan-term numbers in the README or comments.
    • object_limit_exceeded prints the server's message with exit 1, not "not allowed:" with the auth exit code.
    • The withheld text stays a client copy because the wallet sends only included_hours_withheld. It is commented.
  • Stream: the SDK subscribes before it posts the input, so orca.sandbox.discarded from the restart inside that post reaches orca chat. A discard written at a drain after the stream closed shows on orca sessions get.

Checks at f46aa9e:

  • tsc --noEmit: exit 0.
  • eslint .: exit 0.
  • vitest run: 610 passed (42 files).
  • npm run build: success.

Landing on 2026-10-22 (server #93 live as 8bec828), head ac33318

This section supersedes the ceiling lines above: Free's price ceiling is gone (D3.16 A9, orca-design #153), live since 2026-10-22T13:55:24Z.

Merge of main: none needed; the branch already contained main (cadc2dd).

Live fields:

  • orca billing wallet and orca models --payer orca, run from this head against production with the test key (read-only GETs), print the wallet lines, the grant row, the free-model calls and the "free model" mark as sent.
  • Every field and value the CLI reads matches the server: plan marks; refusal codes and params, including usage_limit_exceeded with orca_credit, free_model_capacity, included_hours and orca_suspended; the six session event types.
  • No mismatch.

Free price ceiling removed (A9), 81fdef7, ac33318:

  • Plan marks: only "free model". within_ceiling and pro_and_max stay as wire values and print nothing. The plan column shows only when a free model is listed.
  • README, the use-orca skill and the MCP list_models description no longer mention a ceiling, "needs Pro or Max" or pro_and_max. model_not_in_plan is described as the A5 case only (a tier with no free-model share).
  • The generic model_not_in_plan path keeps the server's message, Upgrade and the switch to the free model. The server sends it only if Free's terms set a ceiling again.
  • Test fixtures use a neutral message and mark Fable within_ceiling, as the server now sends it.

Checks at ac33318 (local):

  • npm ci: ok.
  • npm run lint: exit 0.
  • npm run typecheck: exit 0.
  • npm test: 610 pass in 42 files.
  • Copy on every added line: no em or en dashes, "sandbox" for the product name, Discord only at https://discord.gg/btTYzdzvqq, no signup credit offered.

Release: merging does not release. release-cli.yml runs only on a pushed cli-v* tag (or by hand), and the version stays 1.5.0.

🤖 Generated with Claude Code

ahokik and others added 5 commits October 21, 2026 03:02
…el first, refusals with their ways forward, session notices (D3.16)

- types: PickModel.plan (free, within_ceiling, pro_and_max) and the
  wallet's new fields (granted and paid credit, free_model, network,
  credit_request, included_hours_withheld).
- orca models: a plan column ("free model", "Pro and Max") where the
  server marks a model; plain rows gain the mark as a fourth column.
- agents create with no model: on Free the picker lists the free model
  the server marks first and preselects it; picker rows carry the mark.
- Refusals (model_not_in_plan, free_plan, free_model_daily,
  free_model_capacity, included_hours, free_model_unavailable): the
  server's message as it is, then the dashboard's ways forward as words
  with the command for each, exit 1 (a 403 there is the plan's answer,
  not the key's role). Where the free model is one, the chat switch in a
  terminal lists it first; included_hours offers no switch of model.
- chat: orca.compute.warning, orca.free_model.turn_limit,
  orca.turn.time_limit and orca.network.off print on stderr (network as
  "network  off. <message>"), in the REPL transcript, and pass through
  --json as raw events.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, the network and more credit lines; MCP descriptions (D3.16)

- orca billing wallet at a terminal prints the design's lines: one
  "granted credit  $12.40 left of $20.00, expires 4 Dec 2026" per grant
  (its last day, the day before expires_at), "paid credit  $18.20 (never
  expires)", "machine time  1 h included: 0.4 h used, resets 1 November"
  (or "used"), "free model  40 of 100 calls today", "network  off. ..."
  and on Free "more credit  ..." in the server's words.
- Plain mode adds granted_credit, paid_credit, one grant row each (left,
  granted, last day), expired, free_model_calls_today and _per_day and
  network_off; the network and more credit messages go to stderr.
  --json passes every field through.
- MCP list_models names plan, get_wallet names the new fields.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd paid credit (D3.16)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… params, the withheld lines (D3.16, orca-design #133)

- The wallet's free-model count is read from free_model_today; the
  wallet's free_model stays the plan facts' model list.
- rate_limit_exceeded with param free_model_busy (try again in a minute,
  or add your own OpenRouter key), turns_per_day (more at 00:00 UTC, or
  upgrade) or free_sandboxes_busy (try again in a few minutes, or
  upgrade): the server's message plus those ways forward. Other rate
  limits are unchanged.
- With included_hours_withheld, orca billing wallet prints "machine time
  not included for this organization" and "Free's included hour and
  free model are not available for this organization. Add credit, or
  bring your own provider key." (plain: a row and the line on stderr).
- MCP get_wallet, README and use-orca name the new field and params.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… switch

A4: orca models and the pickers mark the free models on every plan; agents
create puts the free model first and preselects it on Free only; the wallet
prints the free model's calls today on every plan with a share; the MCP
list_models and get_wallet descriptions, the README and use-orca say so.

A5: a 403 model_not_in_plan on one of Orca's free models is a plan with no
share, told from Free's ceiling by the session's model, and prints the
server's message with the OpenRouter key way; the 503 free_model_unavailable
off message prints as the server wrote it; the calls today line is left out
while the free models are off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ahokik and others added 10 commits October 21, 2026 03:14
…page for each plan's free-model share

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fer your own OpenRouter key or credit, and a suspension's 403 is the server's message

Upgrading gives no more of the capacity every tier shares, so neither
refusal offers it. free_model_daily's three messages are printed as
sent. A 403 organization_suspended on a start or an upload is no
longer read as the key's role: it is the server's message, exit 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hy a sandbox slept

orca chat prints orca.sandbox.discarded and
orca.sandbox.workspace_near_limit on stderr as it prints the other
notices. orca sessions sleep prints the last sleep's note under its
line: the server's message (a workspace near Free's size, a discarded
one), else the words for suspended and network_on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… it is on with sandboxes still without it, and no free model line on a null share

The network line is "on." and the server's message while running
sandboxes started without the network, with a sandboxes_without_network
row in plain output; get_wallet's description names the field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ade, the suspension, the workspace notices and the network once on

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t their own switch, never a top-up

1: model_not_in_plan is no longer an Orca credit refusal. A model that
needs Pro or Max asks "Upgrade, or switch this session?" with the free
model first; declining says to upgrade. A free model on a tier with no
share offers no switch: the server's message and its ways.

4: free_model_unavailable offers the switch to the next free model only
when GET /api/models lists one (amendment A3 (3)); with none listed (A5,
the free models off) it prints the server's message with the OpenRouter
key and credit ways. The message is sent again after the switch.

5: included_hours offers no "Add credit" of its own: credit buys machine
time only while Free has a rate (A6 (15)), and the server's message says
so exactly when it does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…last slept

sessions get already reads GET /api/sessions/{id}/sandbox for its state;
the view now keeps last_sleep too. The plain and panel output add the
sleepNote line (a discarded or near-limit workspace with the server's
message, a suspension, the network turned on), and --json carries
last_sleep as the server sent it, in the object it already prints.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… in copy, a kept-objects limit is exit 1

3: the README's notices no longer say "5 minutes" or "Free's 30
minutes", and no copy or comment says "included hour" or "30 minutes";
the numbers are the server's.

5: a 403 object_limit_exceeded (sessions stored, F33, and the other
object caps) prints the server's message as it is, exit 1, as a
suspension does, not "not allowed:" with the auth exit code. Exit 1 is
the README's "API error"; the exit-code table is unchanged. WITHHELD stays
a copy of the server's text, with a comment: the wallet sends only the
included_hours_withheld boolean.

The README and the MCP get_session description say what items 1, 2 and 4
changed: the upgrade-or-switch prompt, the next free model, last_sleep.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… user, 2026-10-22, via orca-2-prod)

- Plan marks: only "free model". within_ceiling and pro_and_max stay in
  ModelPlan as wire values (the server sends pro_and_max only with a
  ceiling in Free's terms) and print nothing; the plan column appears only
  where a free model is listed.
- model_not_in_plan: the A5 path (a :free model on a tier with no share)
  is unchanged; any other model the plan refuses prints the server's
  message with upgrade and the free model, framed as "not in the plan",
  never price.
- README, use-orca SKILL.md and the MCP list_models description: no
  ceiling, no "needs Pro or Max"; other Orca credit models run on credit
  on every plan, Free included.
- Tests: neutral server-message fixtures; Fable marked within_ceiling as
  the server now sends it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ahokik
ahokik marked this pull request as ready for review October 22, 2026 14:40
@ahokik
ahokik merged commit 2bbde71 into main Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant