chainlesschain 0.166.136 → 0.166.138
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -1
- package/package.json +1 -1
- package/src/assets/linux-subreaper/linux-arm64/manifest.json +1 -1
- package/src/assets/linux-subreaper/linux-x64/manifest.json +1 -1
- package/src/command-help-index.json +1 -1
- package/src/commands/agent.js +12 -0
- package/src/data/changelog.json +26 -0
- package/src/harness/prompt-compressor.js +57 -0
- package/src/harness/provider-backed-compaction.js +6 -0
- package/src/lib/coding-task-guidance.js +2 -0
- package/src/lib/context-memory-kernel/jsonl-session-context-port.js +19 -10
- package/src/lib/context-memory-kernel/live-compaction.js +114 -6
- package/src/lib/context-memory-kernel/message-adapter.js +17 -13
- package/src/lib/context-memory-kernel/task-binding.js +41 -0
- package/src/lib/context-memory-kernel/task-worklog-port.js +26 -3
- package/src/lib/evolution/evidence-json-text.js +324 -14
- package/src/lib/evolution/evolution-evidence-projector.js +67 -1
- package/src/lib/read-file-loop-guard.js +134 -4
- package/src/lib/tool-result-preview.js +11 -2
- package/src/repl/agent-repl.js +2 -0
- package/src/runtime/agent-core.js +40 -6
- package/src/runtime/headless-runner.js +1 -0
- package/src/runtime/headless-stream.js +82 -10
- package/src/runtime/message-roles.js +28 -0
- package/src/runtime/policies/agent-policy.js +1 -0
package/README.md
CHANGED
|
@@ -1,8 +1,32 @@
|
|
|
1
1
|
# chainlesschain CLI
|
|
2
2
|
|
|
3
|
+
Publication authorization: the user explicitly permits this release irrespective of the five task results. Complete exact-commit CLI CI and Strict Sandbox remain required before Actions OIDC publication, followed by CLI registry verification and paired IDE releases. Latest model acceptance is 0/5; historical 41/45 is unchanged.
|
|
4
|
+
|
|
3
5
|
Command-line interface for installing, configuring, and managing [ChainlessChain](https://www.chainlesschain.com), including the coding agent, governed tools, sessions, memory, and IDE integrations.
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
The .137 OIDC run stopped before CLI upload because an Agent SDK test changed without a version bump. SDK **0.2.17** restores source/provenance alignment; its runtime output is unchanged. Release uses a new immutable .138 tag, with the existing tree/provenance checks retained.
|
|
8
|
+
|
|
9
|
+
## CLI 0.166.138 — prepared candidate, not yet published
|
|
10
|
+
|
|
11
|
+
After verified publication, install with `npm i -g chainlesschain@0.166.138 --registry https://registry.npmjs.org`, restart the chat host, and verify `cc --version` / `cc doctor`. The current public installation command remains `npm i -g chainlesschain@0.166.136 --registry https://registry.npmjs.org`. The candidate preserves focused recovery when source content is omitted from a model request. Same-batch reservations remain synchronous; only exact source spans actually selected for the provider become historical coverage. Repeated delivery failures stop with an explicit limitation, and confirmed navigation does not advance or move backward on an unsuccessful read.
|
|
12
|
+
|
|
13
|
+
Canonical compaction also retains the original user task and owned resume sources across tool tails and persistent sessions, rejecting task loss, changes or new duplicates before commit. Its 69 focused local regressions pass; fresh same-source generation and independent acceptance have completed at 0/5; the user waived that result as a publication prerequisite.
|
|
14
|
+
|
|
15
|
+
The recorded CLI .137 candidate round completed at **0/5**; CLI .138 has not started another model cohort. Source projection now preserves proven JavaScript source expressions while retaining strict standalone/decoded JSON and sensitive-field checks under ruleset v9. General coding guidance uses bounded assertions for large binary fixtures. Known remaining limits include late independent-review scheduling, omitted unproven partial source fragments, and incorrect or incomplete model-generated assertions. Two independently valid candidate suites still failed end-to-end task completion; their checks do not count as successful model tasks. [Raw results and publication authorization](../../docs/research/cli/verify01-openai-137/README.md).
|
|
16
|
+
|
|
17
|
+
Local validation: 109 related regressions pass; restoring the released .136 guard makes seven new controls fail. The prepared pairing is Open VSX **0.37.174** / JetBrains **0.4.190**, both recommending CLI **0.166.138**, released only after the CLI is verified public. Until then the older public IDEs remain compatible. VS Code also preserves provider diagnostics and saved tool identity across reload; no child-package update is required. Full exact-source CLI CI and CLI Strict Sandbox must pass before Actions OIDC publication. Historical model acceptance remains **41/45**; the focused image follow-up remains **0/1** and is not rescored by engineering checks. [Evidence](../../docs/research/cli/verify01-openai-136/read-delivery-repair/README.md).
|
|
18
|
+
|
|
19
|
+
## CLI 0.166.136 — verified public repair
|
|
20
|
+
|
|
21
|
+
Install with `npm i -g chainlesschain@0.166.136 --registry https://registry.npmjs.org`, restart the chat host, then run `cc --version` and `cc doctor`. This release repairs full-history session forks and preserves independent plugin/MCP restrictions through background restore. Malformed policy values fail before normalization or customization loading.
|
|
22
|
+
|
|
23
|
+
Exact source `539e4da6ef89e5142a3f3bb90e2d6123c6afb15e` passed all 76 CLI CI jobs and all 6 Strict Sandbox jobs. [OIDC publication](https://github.com/chainlesschain/chainlesschain/actions/runs/41206368406) and [independent public readback](https://github.com/chainlesschain/chainlesschain/actions/runs/41241946884) verified immutable bytes and signed provenance. Existing Open VSX **0.37.173** and the verified JetBrains **0.4.189** Actions build remain the test pairing; their recommendation metadata still says CLI **0.166.135**. JetBrains is now approved and public; both JAR payloads match the official build, with different ZIP container hashes. Kernel stays **0.1.11**; Microsoft Marketplace and PC/mobile remain outside this release.
|
|
24
|
+
|
|
25
|
+
The six-task historical retest stays **1/6**, cumulative **40/45**. Engineering regressions are separate from model acceptance; only the five remaining failures are selected for the next round. [Publication evidence](../../docs/research/cli/evidence/release136-public/README.md).
|
|
26
|
+
|
|
27
|
+
The .136 five-sample retest accepted **1/5** (verify-19), cumulative **41/45**. A separate published-source engineering replay passed 86 baseline cases and 20 fixture-adapted candidate cases, rejected the three history/profile mutants, and reproduced the failures when removing the corresponding repairs. The focused image follow-up accepted 0/1: its pixel boundary improved, but metadata-only changes remain uncovered. A separate read-delivery guard repair passes 109 engineering regressions and is not yet published. [Separate replay evidence](../../docs/research/cli/verify01-openai-136/release-replay-539e4da6ef/README.md). These engineering results do not rescore the frozen benchmark.
|
|
28
|
+
|
|
29
|
+
## CLI 0.166.135 — verified preceding release
|
|
6
30
|
|
|
7
31
|
This release recovers genuine OpenAI Responses JSON disconnects before accepted output, bounds stalled requests, and settles completed streaming responses without waiting for socket EOF. It preserves empty tool allowlists across resume and rejects malformed saved permission, sandbox and budget settings. HTTP/provider failures, cancellation, usage persistence and incomplete tool-call replay protections remain authoritative.
|
|
8
32
|
|
|
@@ -830,6 +854,8 @@ chainlesschain agent --provider openai # Reads the stored credential
|
|
|
830
854
|
|
|
831
855
|
Built-in tools (19): `read_file`, `write_file`, `edit_file`, `edit_file_hashed`, `notebook_edit`, `run_shell`, `check_shell`, `git`, `search_files`, `list_dir`, `run_skill`, `list_skills`, `run_code`, `spawn_sub_agent`, `web_fetch`, `web_search`, `todo_write`, `ask_user_question`, `search_sessions`
|
|
832
856
|
|
|
857
|
+
For gateways with a smaller context allowance, use `cc agent --context-window 32768 -p "your task"`. This operator-declared planning window accepts integers from 1024 to 16777216 and applies to interactive, headless and streamed sessions. It does not change the model's official capabilities, output cap or turn budget. Token planning does not guarantee a serialized request fits a gateway's byte limit; verify the actual request size for that gateway.
|
|
858
|
+
|
|
833
859
|
**Search first, then read the relevant source.** Use `web_search` with keywords when no URL is known. It returns source links and bounded snippets (`maxResults`, default 8; `maxSnippetChars`, default 2000). The configured provider is respected; `auto` selects an available API key or keyless DuckDuckGo. Captcha, authentication, rate-limit and network failures are errors, never a claim that no sources exist. Configure `.chainlesschain/config.json:webSearch` with an available provider if keyless search is blocked.
|
|
834
860
|
|
|
835
861
|
**Download once, read or search locally.** `web_fetch` downloads the page, extracts text, saves a local snapshot, and returns the first chunk (`maxChars`, default 20000). Continue with the original URL, format, `snapshotId` and returned `nextOffset` as `offset`; later reads need no network access. Pass a literal `query` with `snapshotId` to search the saved page, then pass a hit's `nextRead` arguments to `web_fetch` to inspect it. Snapshots are process-local, expire after 30 minutes, and are bounded by 32 entries / 128 MB of UTF-16 disk storage; eviction or expiry returns an explicit error. Normal process exit removes them.
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"a2a": "Usage: chainlesschain a2a [options] [command]\n\nA2A Protocol — agent-to-agent communication\n\nOptions:\n -h, --help display help for command\n\nCommands:\n register [options] <name> Register an agent card\n discover [options] Discover agents by capability or skill\n submit [options] <agent-id> <input> Submit a task to an agent\n status [options] <task-id> Get task status\n complete <task-id> <output> Mark a task as completed\n fail <task-id> <error> Mark a task as failed\n peers [options] List all registered agents\n cards [options] List all agent cards with details\n negotiate [options] <agent-id> <capabilities> Check if an agent supports required capabilities\n task-statuses [options] List V2 task statuses (Phase 81)\n card-statuses [options] List V2 card statuses (Phase 81)\n subscription-types [options] List V2 subscription types (Phase 81)\n negotiation-results [options] List V2 negotiation outcomes (Phase 81)\n validate-card [options] <name> Validate an agent card against the A2A schema\n set-card-status [options] <cardId> <status> Transition a card between active/inactive/expired\n card-status [options] <cardId> Show a card's V2 status\n send-task-v2 [options] <agentId> <input> Submit a V2 task (in-memory, with optional timeout)\n start-working [options] <taskId> Transition a V2 task to working\n request-input [options] <taskId> <prompt> Request user input while a V2 task is working\n provide-input [options] <taskId> <input> Provide input for an input-required V2 task\n complete-task-v2 [options] <taskId> [output] Complete a V2 task (from working only)\n fail-task-v2 [options] <taskId> [error] Fail a V2 task with an error message\n cancel-task [options] <taskId> [reason] Cancel a non-terminal V2 task\n check-timeout [options] <taskId> Check V2 task timeout (auto-fails if past deadline)\n task-v2 [options] <taskId> Show a V2 task snapshot\n tasks-v2 [options] List V2 tasks\n negotiate-v2 [options] <cardJson> Phase 81 capability negotiation against an agent card\n stats-v2 [options] Aggregate V2 stats (tasks + cards + subscriptions)\n enums-v2 Show V2 governance enums\n register-agent-v2 [options] Register an a2a agent profile (pending)\n activate-agent-v2 <id> Activate agent\n suspend-agent-v2 <id> Suspend agent\n retire-agent-v2 <id> Retire agent (terminal)\n touch-agent-v2 <id> Refresh lastTouchedAt\n get-agent-v2 <id> Get agent\n list-agents-v2 List agents\n create-message-v2 [options] Create an a2a message (queued)\n start-message-v2 <id> Transition message to sending\n deliver-message-v2 <id> Transition message to delivered\n fail-message-v2 [options] <id> Fail message\n cancel-message-v2 [options] <id> Cancel message\n get-message-v2 <id> Get message\n list-messages-v2 List messages\n set-max-active-agents-v2 <n> Set per-owner active cap\n set-max-pending-messages-v2 <n> Set per-agent pending cap\n set-agent-idle-ms-v2 <n> Set idle threshold\n set-message-stuck-ms-v2 <n> Set stuck threshold\n auto-suspend-idle-agents-v2 Auto-suspend idle agents\n auto-fail-stuck-messages-v2 Auto-fail stuck sending messages\n gov-stats-v2 V2 governance aggregate stats\n help [command] display help for command\n",
|
|
6
6
|
"activitypub": "Usage: chainlesschain activitypub|ap [options] [command]\n\nActivityPub C2S bridge — actors, outbox/inbox, Follow/Create/Like/Announce\n\nOptions:\n -h, --help display help for command\n\nCommands:\n actor Manage local and remote ActivityPub actors\n publish [options] <content> Publish a Create(Note) activity to the actor's outbox\n follow [options] <target> Publish a Follow activity (target: username or actor URL)\n accept [options] <follow-activity-id> Accept a pending Follow request\n unfollow [options] <target> Publish an Undo(Follow) activity\n like [options] <object-id> Publish a Like activity for an object URL\n announce [options] <object-id> Publish an Announce (boost) activity for an object URL\n outbox [options] <username> List an actor's outbox activities\n inbox [options] <username> List an actor's inbox activities\n deliver [options] <username> <activity-json> Simulate inbox delivery — push a JSON activity into a local actor's inbox\n followers [options] <username> List followers of an actor\n search [options] <query> Search actors and/or notes in the local Fediverse index\n following [options] <username> List who this actor is following\n enums-v2 Show V2 enums\n register-actor-v2 [options] Register an AP actor profile (pending)\n activate-actor-v2 <id> Activate actor\n suspend-actor-v2 <id> Suspend actor\n deactivate-actor-v2 <id> Deactivate actor (terminal)\n touch-actor-v2 <id> Refresh lastTouchedAt\n get-actor-v2 <id> Get actor\n list-actors-v2 List actors\n create-activity-v2 [options] Create an AP activity (queued)\n start-activity-v2 <id> Transition activity to delivering\n deliver-activity-v2 <id> Transition activity to delivered\n fail-activity-v2 [options] <id> Fail activity\n cancel-activity-v2 [options] <id> Cancel activity\n get-activity-v2 <id> Get activity\n list-activities-v2 List activities\n set-max-active-actors-v2 <n> Set per-owner active cap\n set-max-pending-activities-v2 <n> Set per-actor pending cap\n set-actor-idle-ms-v2 <n> Set idle threshold\n set-activity-stuck-ms-v2 <n> Set stuck threshold\n auto-suspend-idle-actors-v2 Auto-suspend idle actors\n auto-fail-stuck-activities-v2 Auto-fail stuck delivering activities\n gov-stats-v2 V2 governance aggregate stats\n help [command] display help for command\n",
|
|
7
7
|
"agenda": "Usage: chainlesschain agenda [options] [command]\n\nFire agent-scheduled wakeups / crons / monitors (persisted by the `schedule`\ntool)\n\nOptions:\n -h, --help display help for command\n\nCommands:\n list [options] List all scheduled entries\n run [options] Fire every entry that is due now\n cancel [options] <id> Remove a scheduled entry by id\n prune [options] Remove finished entries (fired / matched / exhausted /\n expired)\n help [command] display help for command\n",
|
|
8
|
-
"agent": "Usage: chainlesschain agent|a [options] [command] [task...]\n\nStart an agentic AI session (reads/writes files, runs commands)\n\nArguments:\n task Headless task 鈥?when given (or with -p /\n piped stdin), runs non-interactively\n\nOptions:\n --model <model> Model name\n --provider <provider> LLM provider (ollama, openai,\n volcengine, deepseek, ...)\n --base-url <url> API base URL\n --service-tier <tier> Reviewed provider service tier\n (standard, fast, flex, ultrafast)\n --api-key <key> API key\n --think [level] Enable Anthropic extended thinking\n (level: think | hard | ultra; Anthropic\n models only)\n --ultrathink Maximum Anthropic extended thinking (=\n --think ultra)\n --thinking-budget <n> Thinking token budget for legacy Claude\n models (Sonnet 4.5 / Opus 4.0-4.5 /\n older); clamped below max_tokens.\n Adaptive-thinking models ignore it (they\n use --think's effort). Requires\n --think/--ultrathink.\n --image <path> Attach an image (png/jpg/jpeg/gif/webp)\n to the prompt for a vision-capable model\n (headless; repeatable)\n --vision-model <id> Explicit image model override\n (otherwise: multimodal main model, then\n config llm.visionModel or\n doubao-seed-2-0-lite-260215)\n --session <id> Resume a previous agent session\n -c, --continue Resume the most recent session (no id\n needed 鈥?claude --continue parity)\n --resume [id] Resume a session by id (no id 鈫?most\n recent 鈥?claude --resume parity)\n --fork-session When resuming, branch into a NEW session\n id and leave the original untouched\n (claude --fork-session parity)\n --fork-request-id <key> Stable idempotency key for\n --fork-session retries (omit for a new\n fork each invocation)\n --add-dir <dir> Extra working directory the agent may\n read/search/edit (repeatable)\n --checkpoint Auto-snapshot the work tree before each\n mutating tool (DEFAULT inside a git\n repo; cc checkpoint restore to roll\n back)\n --no-checkpoint Disable auto-checkpointing (it is on by\n default inside git repos)\n --managed-checkpoint Checkpoint bounded mutating tools with\n Process Broker; unavailable writer\n lifetimes are reported as coverage none\n --managed-checkpoint-state <dir> Durable managed-checkpoint state\n directory (must be outside the\n workspace)\n --managed-checkpoint-exclude <path> Explicit workspace path excluded from\n managed checkpoints; repeatable and\n reported as partial coverage\n --safe-mode Run bare: disable project memory,\n settings hooks, memory recall, IDE\n context, status line and update notice\n (permission rules STAY active)\n --bare Everything --safe-mode disables PLUS\n skills, plugins and MCP/IDE auto-connect\n — minimal fast surface for scripted\n calls (explicit --mcp-config still\n loads; permission rules STAY active)\n --no-plugins Disable plugin customizations for this\n run\n --ephemeral No session persistence: nothing is\n written to the session store (headless;\n a --resume id still replays history\n read-only)\n --decision-mode <mode> Typed Skill-routing experiment for\n durable headless sessions: off | shadow\n | suggest (default: \"off\")\n --decision-provider <provider> Decision provider: typesafe | laya\n (local) | system-one (compatible API)\n (default: \"typesafe\")\n --decision-model <model> Decision model (defaults:\n typesafe=jev-latest, laya=laya; required\n for system-one)\n --decision-base-url <url> System One API base URL (laya: loopback\n only; other providers: HTTPS or\n loopback)\n --decision-timeout-ms <ms> Decision timeout in milliseconds\n (50-30000; default: 800)\n --capabilities Print a machine-readable capability\n manifest (JSON: protocol version, tools,\n permission modes, exit codes) and exit\n --disable-slash-commands Interactive REPL: don't dispatch '/'\n input as slash commands — it reaches the\n model verbatim (/exit and /quit stay\n live)\n --ax-screen-reader Screen-reader friendly output: no ANSI\n colors, no in-place status line repaints\n (also CC_SCREEN_READER=1)\n --worktree Run this session in a fresh git worktree\n (isolated branch; auto-removed when the\n session changes nothing)\n --no-worktree Background Git task: explicitly share\n the current work tree (intended for\n read-only tasks; writable runs are not\n isolated)\n --unattended Enable fail-closed shell action policy\n for scheduled/event-driven runs\n --unattended-allow <classes> Comma-separated action classes\n explicitly allowed for unattended shell\n runs\n --sandbox [image] Run shell commands in an ephemeral\n Docker sandbox (network disabled by\n default)\n --sandbox-mode <mode> Sandbox posture: off | workspace-write |\n strict (explicit isolation modes fail\n closed)\n --sandbox-network Allow network access inside --sandbox\n --otlp <file> Write the agent run's OpenTelemetry\n spans (model/tool/retry) as OTLP/JSON to\n <file>\n --otlp-content Include prompt/response CONTENT in\n --otlp spans (off by default; content is\n redacted unless this is set)\n --auto-rewake When an async `asyncRewake` hook (e.g. a\n background test) fails at turn end,\n re-engage the agent to fix it (bounded\n by --max-rewakes)\n --auto-pin Force-pin the original task (first user\n turn) through compaction (ON by default;\n disable with CC_AUTO_PIN=0 or config\n context.autoPin=false)\n --max-rewakes <n> Max auto-rewake re-drives per run\n (default 1); implies --auto-rewake\n --bg, --background Start as a detached background agent and\n return its id immediately\n --agent-id <id> Agent id for scoped memory recall\n --recall-limit <n> Top-K memories to inject into system\n prompt\n --recall-query <q> Query string for startup memory recall\n --no-recall-memory Disable startup memory recall\n --vim Start the interactive REPL in vim-mode\n line editing (toggle later with /vim; or\n CC_VIM=1)\n --no-stream Disable streamed response rendering\n --no-park-on-exit Close the session-core handle on exit\n instead of parking it\n --bundle <path> Agent bundle directory (may execute\n local MCP commands from mcp.json)\n -p, --print [prompt] Headless: run one non-interactive turn\n and exit\n --output-format <fmt> Headless output: text | json |\n stream-json (default: \"text\")\n --max-turns <n> Cap agent loop iterations (0 =\n unlimited; interactive streams default\n to unlimited, unattended runs to 50)\n --review-changes Headless: review write/edit tool changes\n once within remaining budgets; final\n text only (no partial deltas)\n --json-schema <file> Headless structured output: final reply\n must be JSON validating against this\n schema (invalid replies retried)\n --allowed-tools <list> Comma/space-separated tool allow-list\n (headless)\n --disallowed-tools <list> Comma/space-separated tool deny-list\n (headless)\n --permission-mode <mode> manual | auto | dontAsk | default | plan\n | acceptEdits | bypassPermissions (plan\n headless-only)\n --no-file-refs Disable @path file-reference expansion\n in the prompt (headless)\n --no-slash-macros Disable /name custom-command\n (.claude/commands) expansion in the\n prompt (headless)\n --system-prompt <text> Replace the built-in system prompt\n (literal text or @file)\n --append-system-prompt <text> Append extra guidance to the system\n prompt (literal text or @file)\n --no-project-memory Skip auto-loaded project memory (cc.md /\n CLAUDE.md / AGENTS.md hierarchy,\n .chainlesschain/rules.md,\n .claude/rules/*.md) — a lean system\n prompt for token-tight surfaces (e.g.\n IDE chat). The agent can still read\n those files with tools when it needs\n them.\n --output-style <name> Apply a named output-style persona\n (.claude/output-styles/<name>.md or a\n built-in: concise | explanatory |\n learning)\n --input-format <fmt> Headless input: text | stream-json\n (NDJSON user events on stdin,\n multi-turn) (default: \"text\")\n --trace-id <id> Correlation id stamped as `trace_id` on\n every stream-json output line (also read\n from CC_TRACE_ID). Lets an IDE/bridge\n trace one run across its own logs, the\n CLI, transcripts and diagnostics.\n Auto-generated per run when omitted.\n --fallback-model <model> Backup model(s) to try in order when the\n primary fails (transient error or\n model-not-found). Repeatable or\n comma-separated; up to 3. A\n `provider:model` entry (e.g.\n openai:gpt-4o) falls back\n cross-provider, using that provider's\n API key from its env var (skipped if\n unset — never reuses the primary key).\n Defaults to config llm.fallbackModels.\n --include-partial-messages Emit live assistant-text deltas as\n stream_event lines (requires\n --output-format stream-json)\n --include-hook-events Emit redacted hook and subagent\n lifecycle events (requires\n --output-format stream-json)\n --goal [id] Bind a cc goal into the run (id, or omit\n the value to auto-resolve the active\n goal)\n --goal-assess After the run, ask the model to assess\n goal progress and persist it (opt-in;\n costs one extra completion; requires\n --goal)\n --goal-condition <spec> Session completion condition; prefer\n verify:<manifest.json> for independent\n engineering acceptance, or\n exit-zero:/file-exists:/contains:/regex:;\n model:<desc> uses model judgment\n --goal-recovery-reviewed Resume an interrupted goal after\n reviewing prior effects and usage\n (requires --resume/--continue and\n --goal-condition)\n --max-outer-turns <n> Max outer re-drive turns for\n --goal-condition (default 10, hard cap\n 100)\n --goal-max-tokens <n> Token budget across --goal-condition\n outer turns\n --goal-max-cost <usd> Cost budget (USD) across\n --goal-condition outer turns\n --goal-max-time <ms> Wall-clock budget (ms) across\n --goal-condition outer turns\n --mcp-config <file> Load ad-hoc MCP servers from a JSON file\n for this run (headless); their tools\n become callable (mcp__<server>__<tool>)\n --no-mcp Don't auto-connect MCP servers\n registered with `cc mcp add\n --auto-connect` (--mcp-config still\n loads)\n --no-mcp-auto-connect Disable implicit MCP and editor\n discovery (explicit --mcp-config or\n bridge flags still apply)\n --ide Force-enable IDE bridge auto-connect:\n discover a running editor's MCP server\n via ~/.chainlesschain/ide/*.json\n (default: auto inside an IDE integrated\n terminal)\n --no-ide Disable IDE bridge auto-connect\n --pdh Force-enable PDH bridge auto-connect:\n discover the Android app's\n device-capability MCP server via\n ~/.chainlesschain/pdh-bridge/*.json\n (default: auto when\n CHAINLESSCHAIN_PDH_PORT is set)\n --no-pdh Disable PDH bridge auto-connect\n --jetbrains Force-enable IntelliJ IDEA built-in MCP\n (IDEA >= 2025.2) as server `idea`\n (default: auto when the ChainlessChain\n JetBrains plugin injects\n CHAINLESSCHAIN_JETBRAINS_MCP_URL)\n --no-jetbrains Disable IDEA built-in MCP auto-connect\n --interactive-approvals Stream mode: confirm-tier approvals\n become approval_request/approval\n stdin-stdout events instead of failing\n closed (chat-panel UX)\n --permission-prompt-tool <tool> Defer tool approvals to an MCP tool\n (mcp__<server>__<tool>; requires\n --mcp-config) instead of headless\n fail-closed\n --remote-control Route confirm-tier approvals to paired\n mobile/web devices — requires a relay or\n explicit LAN opt-in; headless waits\n fail-closed, interactive races the\n terminal prompt (also /remote-control)\n --remote-control-allow-lan Permit --remote-control to expose its\n authenticated WS endpoint on a trusted\n LAN\n --channels <list> Inbound channels for the interactive\n session (webhook[:port],telegram) —\n external events enter as user turns;\n webhook needs its bearer token, telegram\n needs channels.telegram.allowFrom\n --settings <file> Merge an extra\n .claude/settings.json-shaped file for\n this run: permission rules\n (allow/ask/deny) + native config\n overrides (model, env)\n --max-budget-usd <amount> Hard USD spend cap: stop the run before\n the next paid LLM call once the\n estimated cost reaches this (headless;\n uses the cc cost price table)\n --session-budget Enable the durable session-wide budget\n authority (headless; requires\n --session/--resume/--continue)\n --session-max-concurrent <n> Durable session cap for concurrent child\n work\n --session-max-spawns <n> Durable session cap for total child-work\n admissions\n --session-max-depth <n> Durable session cap for child-agent\n nesting depth\n --session-max-turns <n> Durable session cap for model turns\n across resumes\n --session-max-tokens <n> Durable session cap for\n provider-reported tokens across resumes\n --session-max-cost-usd <amount> Durable session cost cap across resumes\n (requires priced provider usage)\n --session-max-wall-ms <n> Durable session cap for cumulative\n active wall time\n --session-max-tool-ms <n> Durable session cap for aggregate tool\n execution time\n --observability-workspace <id> Persist a workspace scope on new session\n authority for causal reports\n --observability-team <id> Persist a team scope on new session\n authority for causal reports\n --observability-policy <id> Persist a policy scope on new session\n authority for causal reports\n --strict-mcp-config Use ONLY --mcp-config servers; ignore\n registered (cc mcp add) and IDE-bridge\n MCP for a reproducible tool surface\n --project-mcp Opt in to loading a project-scoped\n .mcp.json (default off; a checked-in\n .mcp.json can spawn commands)\n --replay-user-messages Stream-input mode: echo each accepted\n stdin user message back as a `user`\n event (transcript/correlation)\n --allow-dangerous-bypass Bypass all permission prompts in\n headless mode (DANGEROUS: auto-approves\n all tool calls) (default: false)\n -y, --yolo Alias for --allow-dangerous-bypass\n (default: false)\n --dangerously-skip-permissions Alias for --allow-dangerous-bypass\n (default: false)\n -h, --help display help for command\n\nCommands:\n controlled-host [options] Run against a pre-provisioned Linux\n permission authority (one-shot, dontAsk)\n process-ownership Inspect Linux process quarantine or\n explicitly stop one recoverable\n execution\n",
|
|
8
|
+
"agent": "Usage: chainlesschain agent|a [options] [command] [task...]\n\nStart an agentic AI session (reads/writes files, runs commands)\n\nArguments:\n task Headless task 鈥?when given (or with -p /\n piped stdin), runs non-interactively\n\nOptions:\n --model <model> Model name\n --context-window <tokens> Operator-declared planning window\n (1024-16777216 tokens); not runtime\n verified\n --provider <provider> LLM provider (ollama, openai,\n volcengine, deepseek, ...)\n --base-url <url> API base URL\n --service-tier <tier> Reviewed provider service tier\n (standard, fast, flex, ultrafast)\n --api-key <key> API key\n --think [level] Enable Anthropic extended thinking\n (level: think | hard | ultra; Anthropic\n models only)\n --ultrathink Maximum Anthropic extended thinking (=\n --think ultra)\n --thinking-budget <n> Thinking token budget for legacy Claude\n models (Sonnet 4.5 / Opus 4.0-4.5 /\n older); clamped below max_tokens.\n Adaptive-thinking models ignore it (they\n use --think's effort). Requires\n --think/--ultrathink.\n --image <path> Attach an image (png/jpg/jpeg/gif/webp)\n to the prompt for a vision-capable model\n (headless; repeatable)\n --vision-model <id> Explicit image model override\n (otherwise: multimodal main model, then\n config llm.visionModel or\n doubao-seed-2-0-lite-260215)\n --session <id> Resume a previous agent session\n -c, --continue Resume the most recent session (no id\n needed 鈥?claude --continue parity)\n --resume [id] Resume a session by id (no id 鈫?most\n recent 鈥?claude --resume parity)\n --fork-session When resuming, branch into a NEW session\n id and leave the original untouched\n (claude --fork-session parity)\n --fork-request-id <key> Stable idempotency key for\n --fork-session retries (omit for a new\n fork each invocation)\n --add-dir <dir> Extra working directory the agent may\n read/search/edit (repeatable)\n --checkpoint Auto-snapshot the work tree before each\n mutating tool (DEFAULT inside a git\n repo; cc checkpoint restore to roll\n back)\n --no-checkpoint Disable auto-checkpointing (it is on by\n default inside git repos)\n --managed-checkpoint Checkpoint bounded mutating tools with\n Process Broker; unavailable writer\n lifetimes are reported as coverage none\n --managed-checkpoint-state <dir> Durable managed-checkpoint state\n directory (must be outside the\n workspace)\n --managed-checkpoint-exclude <path> Explicit workspace path excluded from\n managed checkpoints; repeatable and\n reported as partial coverage\n --safe-mode Run bare: disable project memory,\n settings hooks, memory recall, IDE\n context, status line and update notice\n (permission rules STAY active)\n --bare Everything --safe-mode disables PLUS\n skills, plugins and MCP/IDE auto-connect\n — minimal fast surface for scripted\n calls (explicit --mcp-config still\n loads; permission rules STAY active)\n --no-plugins Disable plugin customizations for this\n run\n --ephemeral No session persistence: nothing is\n written to the session store (headless;\n a --resume id still replays history\n read-only)\n --decision-mode <mode> Typed Skill-routing experiment for\n durable headless sessions: off | shadow\n | suggest (default: \"off\")\n --decision-provider <provider> Decision provider: typesafe | laya\n (local) | system-one (compatible API)\n (default: \"typesafe\")\n --decision-model <model> Decision model (defaults:\n typesafe=jev-latest, laya=laya; required\n for system-one)\n --decision-base-url <url> System One API base URL (laya: loopback\n only; other providers: HTTPS or\n loopback)\n --decision-timeout-ms <ms> Decision timeout in milliseconds\n (50-30000; default: 800)\n --capabilities Print a machine-readable capability\n manifest (JSON: protocol version, tools,\n permission modes, exit codes) and exit\n --disable-slash-commands Interactive REPL: don't dispatch '/'\n input as slash commands — it reaches the\n model verbatim (/exit and /quit stay\n live)\n --ax-screen-reader Screen-reader friendly output: no ANSI\n colors, no in-place status line repaints\n (also CC_SCREEN_READER=1)\n --worktree Run this session in a fresh git worktree\n (isolated branch; auto-removed when the\n session changes nothing)\n --no-worktree Background Git task: explicitly share\n the current work tree (intended for\n read-only tasks; writable runs are not\n isolated)\n --unattended Enable fail-closed shell action policy\n for scheduled/event-driven runs\n --unattended-allow <classes> Comma-separated action classes\n explicitly allowed for unattended shell\n runs\n --sandbox [image] Run shell commands in an ephemeral\n Docker sandbox (network disabled by\n default)\n --sandbox-mode <mode> Sandbox posture: off | workspace-write |\n strict (explicit isolation modes fail\n closed)\n --sandbox-network Allow network access inside --sandbox\n --otlp <file> Write the agent run's OpenTelemetry\n spans (model/tool/retry) as OTLP/JSON to\n <file>\n --otlp-content Include prompt/response CONTENT in\n --otlp spans (off by default; content is\n redacted unless this is set)\n --auto-rewake When an async `asyncRewake` hook (e.g. a\n background test) fails at turn end,\n re-engage the agent to fix it (bounded\n by --max-rewakes)\n --auto-pin Force-pin the original task (first user\n turn) through compaction (ON by default;\n disable with CC_AUTO_PIN=0 or config\n context.autoPin=false)\n --max-rewakes <n> Max auto-rewake re-drives per run\n (default 1); implies --auto-rewake\n --bg, --background Start as a detached background agent and\n return its id immediately\n --agent-id <id> Agent id for scoped memory recall\n --recall-limit <n> Top-K memories to inject into system\n prompt\n --recall-query <q> Query string for startup memory recall\n --no-recall-memory Disable startup memory recall\n --vim Start the interactive REPL in vim-mode\n line editing (toggle later with /vim; or\n CC_VIM=1)\n --no-stream Disable streamed response rendering\n --no-park-on-exit Close the session-core handle on exit\n instead of parking it\n --bundle <path> Agent bundle directory (may execute\n local MCP commands from mcp.json)\n -p, --print [prompt] Headless: run one non-interactive turn\n and exit\n --output-format <fmt> Headless output: text | json |\n stream-json (default: \"text\")\n --max-turns <n> Cap agent loop iterations (0 =\n unlimited; interactive streams default\n to unlimited, unattended runs to 50)\n --review-changes Headless: review write/edit tool changes\n once within remaining budgets; final\n text only (no partial deltas)\n --json-schema <file> Headless structured output: final reply\n must be JSON validating against this\n schema (invalid replies retried)\n --allowed-tools <list> Comma/space-separated tool allow-list\n (headless)\n --disallowed-tools <list> Comma/space-separated tool deny-list\n (headless)\n --permission-mode <mode> manual | auto | dontAsk | default | plan\n | acceptEdits | bypassPermissions (plan\n headless-only)\n --no-file-refs Disable @path file-reference expansion\n in the prompt (headless)\n --no-slash-macros Disable /name custom-command\n (.claude/commands) expansion in the\n prompt (headless)\n --system-prompt <text> Replace the built-in system prompt\n (literal text or @file)\n --append-system-prompt <text> Append extra guidance to the system\n prompt (literal text or @file)\n --no-project-memory Skip auto-loaded project memory (cc.md /\n CLAUDE.md / AGENTS.md hierarchy,\n .chainlesschain/rules.md,\n .claude/rules/*.md) — a lean system\n prompt for token-tight surfaces (e.g.\n IDE chat). The agent can still read\n those files with tools when it needs\n them.\n --output-style <name> Apply a named output-style persona\n (.claude/output-styles/<name>.md or a\n built-in: concise | explanatory |\n learning)\n --input-format <fmt> Headless input: text | stream-json\n (NDJSON user events on stdin,\n multi-turn) (default: \"text\")\n --trace-id <id> Correlation id stamped as `trace_id` on\n every stream-json output line (also read\n from CC_TRACE_ID). Lets an IDE/bridge\n trace one run across its own logs, the\n CLI, transcripts and diagnostics.\n Auto-generated per run when omitted.\n --fallback-model <model> Backup model(s) to try in order when the\n primary fails (transient error or\n model-not-found). Repeatable or\n comma-separated; up to 3. A\n `provider:model` entry (e.g.\n openai:gpt-4o) falls back\n cross-provider, using that provider's\n API key from its env var (skipped if\n unset — never reuses the primary key).\n Defaults to config llm.fallbackModels.\n --include-partial-messages Emit live assistant-text deltas as\n stream_event lines (requires\n --output-format stream-json)\n --include-hook-events Emit redacted hook and subagent\n lifecycle events (requires\n --output-format stream-json)\n --goal [id] Bind a cc goal into the run (id, or omit\n the value to auto-resolve the active\n goal)\n --goal-assess After the run, ask the model to assess\n goal progress and persist it (opt-in;\n costs one extra completion; requires\n --goal)\n --goal-condition <spec> Session completion condition; prefer\n verify:<manifest.json> for independent\n engineering acceptance, or\n exit-zero:/file-exists:/contains:/regex:;\n model:<desc> uses model judgment\n --goal-recovery-reviewed Resume an interrupted goal after\n reviewing prior effects and usage\n (requires --resume/--continue and\n --goal-condition)\n --max-outer-turns <n> Max outer re-drive turns for\n --goal-condition (default 10, hard cap\n 100)\n --goal-max-tokens <n> Token budget across --goal-condition\n outer turns\n --goal-max-cost <usd> Cost budget (USD) across\n --goal-condition outer turns\n --goal-max-time <ms> Wall-clock budget (ms) across\n --goal-condition outer turns\n --mcp-config <file> Load ad-hoc MCP servers from a JSON file\n for this run (headless); their tools\n become callable (mcp__<server>__<tool>)\n --no-mcp Don't auto-connect MCP servers\n registered with `cc mcp add\n --auto-connect` (--mcp-config still\n loads)\n --no-mcp-auto-connect Disable implicit MCP and editor\n discovery (explicit --mcp-config or\n bridge flags still apply)\n --ide Force-enable IDE bridge auto-connect:\n discover a running editor's MCP server\n via ~/.chainlesschain/ide/*.json\n (default: auto inside an IDE integrated\n terminal)\n --no-ide Disable IDE bridge auto-connect\n --pdh Force-enable PDH bridge auto-connect:\n discover the Android app's\n device-capability MCP server via\n ~/.chainlesschain/pdh-bridge/*.json\n (default: auto when\n CHAINLESSCHAIN_PDH_PORT is set)\n --no-pdh Disable PDH bridge auto-connect\n --jetbrains Force-enable IntelliJ IDEA built-in MCP\n (IDEA >= 2025.2) as server `idea`\n (default: auto when the ChainlessChain\n JetBrains plugin injects\n CHAINLESSCHAIN_JETBRAINS_MCP_URL)\n --no-jetbrains Disable IDEA built-in MCP auto-connect\n --interactive-approvals Stream mode: confirm-tier approvals\n become approval_request/approval\n stdin-stdout events instead of failing\n closed (chat-panel UX)\n --permission-prompt-tool <tool> Defer tool approvals to an MCP tool\n (mcp__<server>__<tool>; requires\n --mcp-config) instead of headless\n fail-closed\n --remote-control Route confirm-tier approvals to paired\n mobile/web devices — requires a relay or\n explicit LAN opt-in; headless waits\n fail-closed, interactive races the\n terminal prompt (also /remote-control)\n --remote-control-allow-lan Permit --remote-control to expose its\n authenticated WS endpoint on a trusted\n LAN\n --channels <list> Inbound channels for the interactive\n session (webhook[:port],telegram) —\n external events enter as user turns;\n webhook needs its bearer token, telegram\n needs channels.telegram.allowFrom\n --settings <file> Merge an extra\n .claude/settings.json-shaped file for\n this run: permission rules\n (allow/ask/deny) + native config\n overrides (model, env)\n --max-budget-usd <amount> Hard USD spend cap: stop the run before\n the next paid LLM call once the\n estimated cost reaches this (headless;\n uses the cc cost price table)\n --session-budget Enable the durable session-wide budget\n authority (headless; requires\n --session/--resume/--continue)\n --session-max-concurrent <n> Durable session cap for concurrent child\n work\n --session-max-spawns <n> Durable session cap for total child-work\n admissions\n --session-max-depth <n> Durable session cap for child-agent\n nesting depth\n --session-max-turns <n> Durable session cap for model turns\n across resumes\n --session-max-tokens <n> Durable session cap for\n provider-reported tokens across resumes\n --session-max-cost-usd <amount> Durable session cost cap across resumes\n (requires priced provider usage)\n --session-max-wall-ms <n> Durable session cap for cumulative\n active wall time\n --session-max-tool-ms <n> Durable session cap for aggregate tool\n execution time\n --observability-workspace <id> Persist a workspace scope on new session\n authority for causal reports\n --observability-team <id> Persist a team scope on new session\n authority for causal reports\n --observability-policy <id> Persist a policy scope on new session\n authority for causal reports\n --strict-mcp-config Use ONLY --mcp-config servers; ignore\n registered (cc mcp add) and IDE-bridge\n MCP for a reproducible tool surface\n --project-mcp Opt in to loading a project-scoped\n .mcp.json (default off; a checked-in\n .mcp.json can spawn commands)\n --replay-user-messages Stream-input mode: echo each accepted\n stdin user message back as a `user`\n event (transcript/correlation)\n --allow-dangerous-bypass Bypass all permission prompts in\n headless mode (DANGEROUS: auto-approves\n all tool calls) (default: false)\n -y, --yolo Alias for --allow-dangerous-bypass\n (default: false)\n --dangerously-skip-permissions Alias for --allow-dangerous-bypass\n (default: false)\n -h, --help display help for command\n\nCommands:\n controlled-host [options] Run against a pre-provisioned Linux\n permission authority (one-shot, dontAsk)\n process-ownership Inspect Linux process quarantine or\n explicitly stop one recoverable\n execution\n",
|
|
9
9
|
"agent-network": "Usage: chainlesschain agent-network|anet [options] [command]\n\nDecentralized Agent Network (Phase 24) — DID / registry / credentials / task\nrouting\n\nOptions:\n -h, --help display help for command\n\nCommands:\n config [options] Show network constants & reputation weights\n dimensions [options] List reputation dimensions\n task-statuses [options] List task lifecycle statuses\n did-create [options] Create an Agent DID (Ed25519 + DID document)\n did-resolve [options] <did> Resolve DID → DID document\n dids [options] List Agent DIDs\n did-deactivate [options] <did> Deactivate a DID (also forces registry offline)\n sign [options] <did> <data> Sign data with agent's Ed25519 key\n verify [options] <did> <data> <signature> Verify a signature from an agent\n register [options] <did> <orgId> Register an Agent in the federated registry\n unregister [options] <did> Remove an Agent from the registry\n heartbeat [options] <did> Bump last_heartbeat (forces online)\n discover [options] Discover agents (capability / org / status)\n sweep [options] Mark stale online agents offline\n peer-add [options] <peerId> Add/update a Kademlia peer (k-bucket auto-computed)\n peer-remove [options] <peerId> Remove a peer\n peers [options] List peers (optionally by k-bucket)\n auth-start [options] <did> Issue an auth challenge for a DID\n auth-complete [options] <sessionId> <signature> Complete auth with signature over challenge\n auth-validate [options] <token> Validate a session token (returns agentDid or exits 1)\n auth-sessions [options] List auth sessions\n credential-issue [options] <issuerDid> <subjectDid> Issue a VC with HMAC/Ed25519 proof\n credential-verify [options] <id> Verify a VC (signature + expiry + revocation)\n credential-revoke [options] <id> Revoke a credential\n credential-show [options] <id> Show a credential\n credentials [options] List credentials (filter by subject/issuer/status/type)\n task-route [options] <sourceOrg> <taskType> Route task → pick best-rep agent matching capability\n task-show [options] <taskId> Show a task\n task-status [options] <taskId> <status> Update task status (terminal states set completedAt)\n task-cancel [options] <taskId> Cancel a task (sets CANCELLED + reason)\n tasks [options] List tasks\n rep-update [options] <did> <dimension> <score> Record a reputation observation\n rep-show [options] <did> Show reputation summary (weighted total + per-dim avg)\n rep-history [options] <did> Show reputation history (newest first)\n rep-top [options] Top agents by dimension (or total)\n stats [options] Network-level statistics\n agent-maturities-v2 List V2 agent maturity states\n task-lifecycles-v2 List V2 task lifecycle states\n stats-v2 V2 agent-network stats\n get-max-active-agents-v2 Get max active agents per network (V2)\n set-max-active-agents-v2 <n> Set max active agents per network (V2)\n get-max-pending-tasks-v2 Get max pending tasks per agent (V2)\n set-max-pending-tasks-v2 <n> Set max pending tasks per agent (V2)\n get-agent-idle-ms-v2 Get agent idle threshold (V2)\n set-agent-idle-ms-v2 <ms> Set agent idle threshold (V2)\n get-task-stuck-ms-v2 Get task stuck threshold (V2)\n set-task-stuck-ms-v2 <ms> Set task stuck threshold (V2)\n active-agent-count-v2 <networkId> Active agent count for network (V2)\n pending-task-count-v2 <agentId> Pending task count for agent (V2)\n register-agent-v2 [options] <id> Register a V2 agent\n get-agent-v2 <id> Get a V2 agent\n list-agents-v2 [options] List V2 agents\n set-agent-status-v2 <id> <next> Set V2 agent status\n activate-agent-v2 <id> Activate a V2 agent\n suspend-agent-v2 <id> Suspend a V2 agent\n revoke-agent-v2 <id> Revoke a V2 agent\n touch-agent-v2 <id> Touch a V2 agent\n create-task-v2 [options] <id> Create a V2 task\n get-task-v2 <id> Get a V2 task\n list-tasks-v2 [options] List V2 tasks\n set-task-status-v2 <id> <next> Set V2 task status\n start-task-v2 <id> Start a V2 task\n complete-task-v2 <id> Complete a V2 task\n fail-task-v2 <id> Fail a V2 task\n cancel-task-v2 <id> Cancel a V2 task\n auto-suspend-idle-agents-v2 Auto-suspend idle V2 agents\n auto-fail-stuck-tasks-v2 Auto-fail stuck V2 tasks\n help [command] display help for command\n",
|
|
10
10
|
"agents": "Usage: chainlesschain agents [options] [command]\n\nUser-defined subagents (.claude/agents/*.md)\n\nOptions:\n -h, --help display help for command\n\nCommands:\n background|bg [options] List background agent sessions\n logs [options] <id> Print recent output from a background agent\n view [options] <id> Show a detailed background agent view\n stop [options] <id> Stop a running background agent\n rename [options] <id> <title...> Rename a background agent session\n list|ls [options] List discovered subagents (project +\n personal)\n show [options] <name> Show an agent's metadata + system prompt\n run [options] <name> [task...] Run a task headlessly as the named subagent\n new [options] <name> Scaffold a new agent file (project-native\n .chainlesschain/agents/)\n help [command] display help for command\n",
|
|
11
11
|
"android": "Usage: chainlesschain android [options] [command]\n\nAndroid-native bridge: ContentResolver / SAF / Accessibility / Shizuku / root\n(Plan A A7)\n\nOptions:\n -h, --help display help for command\n\nCommands:\n caps [options] Probe what bridge capabilities are available on this\n device\n contacts ContentResolver: contacts\n sms ContentResolver: SMS\n calls ContentResolver: call log\n app PackageManager: app inventory + Intent\n fs SAF / sandbox filesystem\n a11y Accessibility Service\n shizuku Shizuku ADB-like privileges\n root Magisk root su\n perms [options] <name> Check (and request) a runtime permission\n help [command] display help for command\n",
|
package/src/commands/agent.js
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
import { resolveImages, resolveVisionLlm } from "../lib/image-input.js";
|
|
26
26
|
import { resolveLlmConnection } from "../lib/llm-connection-resolution.js";
|
|
27
27
|
import { loadConfig } from "../lib/config-manager.js";
|
|
28
|
+
import { resolveModelCapabilityProfile } from "../lib/model-capabilities.js";
|
|
28
29
|
import { captureUnattendedActionPolicy } from "../lib/unattended-action-policy.js";
|
|
29
30
|
import {
|
|
30
31
|
assertSandboxCapabilities,
|
|
@@ -308,6 +309,14 @@ export function registerAgentCommand(program, dependencies = {}) {
|
|
|
308
309
|
"Headless task 鈥?when given (or with -p / piped stdin), runs non-interactively",
|
|
309
310
|
)
|
|
310
311
|
.option("--model <model>", "Model name")
|
|
312
|
+
.option(
|
|
313
|
+
"--context-window <tokens>",
|
|
314
|
+
"Operator-declared planning window (1024-16777216 tokens); not runtime verified",
|
|
315
|
+
(value) =>
|
|
316
|
+
resolveModelCapabilityProfile({
|
|
317
|
+
contextMemoryModelWindowTokens: value,
|
|
318
|
+
}).contextWindowTokens,
|
|
319
|
+
)
|
|
311
320
|
.option(
|
|
312
321
|
"--provider <provider>",
|
|
313
322
|
"LLM provider (ollama, openai, volcengine, deepseek, ...)",
|
|
@@ -1699,6 +1708,7 @@ export function registerAgentCommand(program, dependencies = {}) {
|
|
|
1699
1708
|
unattendedActionPolicy,
|
|
1700
1709
|
toolAdmission,
|
|
1701
1710
|
model: options.model,
|
|
1711
|
+
contextMemoryModelWindowTokens: options.contextWindow,
|
|
1702
1712
|
thinking,
|
|
1703
1713
|
thinkingBudget,
|
|
1704
1714
|
provider: options.provider,
|
|
@@ -2011,6 +2021,7 @@ export function registerAgentCommand(program, dependencies = {}) {
|
|
|
2011
2021
|
prompt,
|
|
2012
2022
|
images,
|
|
2013
2023
|
model: visionLlm.model || options.model,
|
|
2024
|
+
contextMemoryModelWindowTokens: options.contextWindow,
|
|
2014
2025
|
visionModel: options.visionModel,
|
|
2015
2026
|
thinking,
|
|
2016
2027
|
thinkingBudget,
|
|
@@ -2281,6 +2292,7 @@ export function registerAgentCommand(program, dependencies = {}) {
|
|
|
2281
2292
|
skillRetrievalRevocationReader,
|
|
2282
2293
|
}).createAgentRuntime({
|
|
2283
2294
|
model: options.model,
|
|
2295
|
+
contextMemoryModelWindowTokens: options.contextWindow,
|
|
2284
2296
|
visionModel: options.visionModel,
|
|
2285
2297
|
thinking,
|
|
2286
2298
|
thinkingBudget,
|
package/src/data/changelog.json
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"source": "CHANGELOG.md",
|
|
3
3
|
"releases": [
|
|
4
|
+
{
|
|
5
|
+
"productVersion": null,
|
|
6
|
+
"cliVersion": "0.166.138",
|
|
7
|
+
"cliVersions": ["0.166.137", "0.166.138"],
|
|
8
|
+
"date": "2026-11-01",
|
|
9
|
+
"title": "",
|
|
10
|
+
"sections": [
|
|
11
|
+
{
|
|
12
|
+
"heading": "Fixed - cc CLI 0.166.138: align Agent SDK source identity before OIDC publication (candidate, 2026-11-01)",
|
|
13
|
+
"body": "- Publish Agent SDK 0.2.17 before CLI, retaining signed npm provenance and complete package-tree reuse verification. SDK 0.2.16 had a protocol-fixture test update after its signed source anchor; its runtime output remains unchanged, but its version must advance.\n- Keep the failed immutable CLI 0.166.137 tag and its original evidence. It stopped before CLI upload; do not move the tag or bypass the upstream package check.\n- Carry the source-delivery and canonical-task compaction repairs from .137. Pair Open VSX 0.37.174 and JetBrains 0.4.190 with CLI 0.166.138 after verified public CLI readback.\n- The user explicitly waives five-task success as a publication prerequisite. The recorded .137 cohort remains 0/5 and historical 41/45 remains separate. No new model tasks or budget changes are included. Require complete new exact-commit CLI CI and Strict Sandbox before Actions OIDC publication."
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"productVersion": null,
|
|
19
|
+
"cliVersion": "0.166.137",
|
|
20
|
+
"cliVersions": ["0.166.137"],
|
|
21
|
+
"date": "2026-11-01",
|
|
22
|
+
"title": "",
|
|
23
|
+
"sections": [
|
|
24
|
+
{
|
|
25
|
+
"heading": "Fixed - cc CLI 0.166.137: confirm model-visible source before recording read coverage (candidate, 2026-11-01)",
|
|
26
|
+
"body": "- Distinguish proven JavaScript source expressions from JSON data when previewing and projecting file results. Valid source trailing commas and numeric separators must not silently omit entire source pages; standalone and decoded JSON retain their strict parsing, sensitive-key and budget checks. The source context change has a new projection ruleset identity.\n- Keep generated regression assertions within runner resource limits: compare large binary payloads by length and byte equality or digest instead of expanding every byte through a deep matcher. This is general coding guidance, not task-specific acceptance feedback or a change to evaluation budgets.\n- Preserve the captured original user task and owned resume sources through canonical compaction, including tool/assistant tails, persistent sessions and legitimate repeated user messages. Verify task identity before planning and commit; reject asynchronous loss, rewrites or new duplicates without reconstructing the task from model summaries.\n- Validate 69 focused local regressions and the original-entry fault-injection control; these engineering checks require freshly rebuilt same-source CLI/IDE candidates and independent five-task acceptance before publication.\n- Expose `agent --context-window <tokens>` to apply an explicit planning window through headless, streaming and interactive sessions when a gateway has tighter transport limits than the model's documented context. This controls planning; serialized request limits remain independently enforced.\n- Separate synchronous same-batch read reservations from exact source spans actually delivered in a provider request. Omitted or discarded source no longer exhausts successful rereads or receives an incorrect already-read result.\n- Preserve the last confirmed navigation cursor, reject partial previews as complete-page evidence, and bound cumulative delivery failures without letting unrelated old source reset that limit. Keep the existing Evidence JSON validation unchanged.\n- Verify 109 related regressions and seven rollback controls. Compaction integration fixtures preserve the newest complete tool batch and require continuous source coverage actually received by the mock model; continuously discarded source ends without a completion claim.\n- Carry the main-branch repairs for terminal Responses compaction failures and durable tool settlement; the paired VS Code update preserves actionable diagnostics and saved tool identity across reload. Prepare VS Code 0.37.174 / JetBrains 0.4.190 with CLI 0.166.137 recommendations, publishing only after the CLI is public.\n- Retain the raw five-sample result (1/5), image follow-up (0/1), cumulative 41/45 and credential cleanup receipts. Current IDE packages remain compatible; this CLI-only repair requires complete exact-source CLI CI / Strict Sandbox and Actions OIDC before publication."
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
},
|
|
4
30
|
{
|
|
5
31
|
"productVersion": null,
|
|
6
32
|
"cliVersion": "0.166.136",
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
import { feature, featureVariant } from "../lib/feature-flags.js";
|
|
20
20
|
import { isAbortError } from "../lib/abort-utils.js";
|
|
21
21
|
import { isFormalBudgetError } from "../lib/formal-budget-errors.js";
|
|
22
|
+
import { isRetryableStreamError } from "../lib/stream-retry.js";
|
|
22
23
|
import {
|
|
23
24
|
CONTEXT_WINDOWS,
|
|
24
25
|
getContextWindow,
|
|
@@ -171,6 +172,59 @@ function summaryUsageCount(usage, canonical, alias, { required = false } = {}) {
|
|
|
171
172
|
: null;
|
|
172
173
|
}
|
|
173
174
|
|
|
175
|
+
// Diagnostic metadata only: neither an HTTP verdict nor a network category
|
|
176
|
+
// establishes billable usage or authorizes retrying a summary request. Never
|
|
177
|
+
// project provider messages, response bodies, or arbitrary error codes.
|
|
178
|
+
function summaryProviderFailure(error) {
|
|
179
|
+
const httpStatus = [
|
|
180
|
+
error?.status,
|
|
181
|
+
error?.statusCode,
|
|
182
|
+
error?.cause?.status,
|
|
183
|
+
error?.cause?.statusCode,
|
|
184
|
+
].find(
|
|
185
|
+
(status) => Number.isInteger(status) && status >= 400 && status <= 599,
|
|
186
|
+
);
|
|
187
|
+
if (httpStatus !== undefined) {
|
|
188
|
+
const category =
|
|
189
|
+
httpStatus === 401
|
|
190
|
+
? "authentication"
|
|
191
|
+
: httpStatus === 403
|
|
192
|
+
? "access_denied"
|
|
193
|
+
: httpStatus === 429
|
|
194
|
+
? "rate_limit"
|
|
195
|
+
: httpStatus >= 500
|
|
196
|
+
? "server_error"
|
|
197
|
+
: "http_error";
|
|
198
|
+
return { category, httpStatus };
|
|
199
|
+
}
|
|
200
|
+
if (isRetryableStreamError(error)) {
|
|
201
|
+
const networkCodes = new Set([
|
|
202
|
+
"ECONNRESET",
|
|
203
|
+
"ECONNREFUSED",
|
|
204
|
+
"ETIMEDOUT",
|
|
205
|
+
"ENOTFOUND",
|
|
206
|
+
"EAI_AGAIN",
|
|
207
|
+
"EPIPE",
|
|
208
|
+
"UND_ERR_CONNECT_TIMEOUT",
|
|
209
|
+
"UND_ERR_HEADERS_TIMEOUT",
|
|
210
|
+
"UND_ERR_BODY_TIMEOUT",
|
|
211
|
+
"UND_ERR_SOCKET",
|
|
212
|
+
]);
|
|
213
|
+
const code = [error?.code, error?.cause?.code].find((value) =>
|
|
214
|
+
networkCodes.has(value),
|
|
215
|
+
);
|
|
216
|
+
return { category: "network", ...(code ? { code } : {}) };
|
|
217
|
+
}
|
|
218
|
+
if (
|
|
219
|
+
error instanceof SyntaxError ||
|
|
220
|
+
(typeof error?.message === "string" &&
|
|
221
|
+
error.message.startsWith("Invalid API response:"))
|
|
222
|
+
) {
|
|
223
|
+
return { category: "invalid_response" };
|
|
224
|
+
}
|
|
225
|
+
return { category: "unknown" };
|
|
226
|
+
}
|
|
227
|
+
|
|
174
228
|
export function estimateTokens(text) {
|
|
175
229
|
if (!text) return 0;
|
|
176
230
|
const chineseChars = (text.match(/[\u4e00-\u9fa5]/g) || []).length;
|
|
@@ -661,6 +715,7 @@ export class PromptCompressor {
|
|
|
661
715
|
let summaryUsage = null;
|
|
662
716
|
let summaryUsageUnknown = false;
|
|
663
717
|
let summaryUsageUnknownReason = null;
|
|
718
|
+
let summaryProviderError = null;
|
|
664
719
|
let summaryProvider = null;
|
|
665
720
|
let summaryModel = null;
|
|
666
721
|
let summaryCallId = null;
|
|
@@ -761,6 +816,7 @@ export class PromptCompressor {
|
|
|
761
816
|
// budget can latch instead of silently accounting the call as $0.
|
|
762
817
|
summaryUsageUnknown = true;
|
|
763
818
|
summaryUsageUnknownReason = "provider_transport_outcome_unknown";
|
|
819
|
+
summaryProviderError = summaryProviderFailure(error);
|
|
764
820
|
}
|
|
765
821
|
if (!degraded) {
|
|
766
822
|
try {
|
|
@@ -810,6 +866,7 @@ export class PromptCompressor {
|
|
|
810
866
|
}
|
|
811
867
|
: {}),
|
|
812
868
|
...(summaryProvider ? { summaryProvider } : {}),
|
|
869
|
+
...(summaryProviderError ? { summaryProviderError } : {}),
|
|
813
870
|
...(summaryModel ? { summaryModel } : {}),
|
|
814
871
|
...(summaryCallId ? { summaryCallId } : {}),
|
|
815
872
|
...(summaryUsageLedgerSettled
|
|
@@ -190,6 +190,9 @@ export async function compactConversationWithProvider(messages, options = {}) {
|
|
|
190
190
|
onToken: undefined,
|
|
191
191
|
onStall: undefined,
|
|
192
192
|
onStreamRetry: undefined,
|
|
193
|
+
// A failed summary request may already have been billed. Keep
|
|
194
|
+
// its original failure rather than entering the chat retry loop.
|
|
195
|
+
disableTransportRetry: true,
|
|
193
196
|
onProviderCallStart:
|
|
194
197
|
evolutionIngress === null ? undefined : start,
|
|
195
198
|
maxOutputTokens,
|
|
@@ -278,6 +281,9 @@ export async function compactConversationWithProvider(messages, options = {}) {
|
|
|
278
281
|
stats.summaryUsageUnknownReason ||
|
|
279
282
|
"provider_transport_outcome_unknown",
|
|
280
283
|
usageOutcome: "unknown",
|
|
284
|
+
...(stats.summaryProviderError
|
|
285
|
+
? { providerError: stats.summaryProviderError }
|
|
286
|
+
: {}),
|
|
281
287
|
...(stats.summaryCallId ? { callId: stats.summaryCallId } : {}),
|
|
282
288
|
...(stats.summaryUsageLedgerSettled === true
|
|
283
289
|
? { usageLedgerSettled: true }
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
export const CODING_TASK_QUALITY_GUIDANCE = `Coding task quality:
|
|
3
3
|
- Read the actual implementation and its exported API before writing a caller or test. Verify parameter order, return shapes, fixture requirements and the delegated owner of each lifecycle transition.
|
|
4
4
|
- Keep progress explanations to one or two sentences. Resolve uncertainty with targeted reads, reuse unchanged source already inspected, and put code directly in write/edit arguments.
|
|
5
|
+
- Omitted or undelivered source has not been inspected. For an incomplete source excerpt, select a complete enclosing statement or container; a larger range or whole file within the tool limits may be necessary. Do not keep halving the same omitted page. For oversized output, select bounded fields or sections. If safe source remains unavailable, report that limitation without claiming completion.
|
|
5
6
|
- Resolve each relative import from the destination file's directory. Read back completed files and fix newDiagnostics. A successful write proves persistence, not test execution or acceptance.
|
|
6
7
|
- Map every acceptance requirement to a fixture, real production call path and observable assertion. Positive and negative controls must reach the same boundary with unrelated prerequisites valid. Avoid mocks that bypass it; identify which assertion would fail without that boundary.
|
|
7
8
|
- Derive case allocation from the user's requirements. A test-count cap does not waive coverage: merge redundant cases to cover gaps within the cap, authorized scope and remaining budget. Report unresolved gaps as incomplete.
|
|
9
|
+
- Keep test fixtures and assertions within the runner's memory and time limits. For large binary payloads, assert lengths and use Buffer.equals or a digest for content checks; avoid deep matchers that enumerate every byte or print the entire payload on failure. Check boundary rejection before allocating a large body when the contract permits it.
|
|
8
10
|
- For races, control the intended transition and complete the current worker/request when testing cancellation or replacement. An earlier unrelated rejection does not prove the target guard. Derive expectations independently from the contract or authoritative state, not by calling the function under test.
|
|
9
11
|
- Trace rejection before asserting its aftermath: it may precede registration or persistence. Inspect whether state stays unchanged, a failed record exists or an event is emitted. Compare independently recorded identities and provenance; equal text does not prove ownership.
|
|
10
12
|
- Inspect persistence projections before comparing histories. Host notices, lineage and imports may accompany user/assistant messages; verify their provenance separately. Report defects that cannot be repaired within the permitted scope instead of inventing passing behavior.
|
|
@@ -54,12 +54,17 @@ function compactStats(event, messages) {
|
|
|
54
54
|
|
|
55
55
|
/** SessionContextPort backed by the CLI's verified, anchored JSONL transcript. */
|
|
56
56
|
export class JsonlSessionContextPort {
|
|
57
|
-
constructor({
|
|
57
|
+
constructor({
|
|
58
|
+
sessionId,
|
|
59
|
+
allowedSinks = ["*"],
|
|
60
|
+
requiredUserMessages = [],
|
|
61
|
+
} = {}) {
|
|
58
62
|
if (typeof sessionId !== "string" || !sessionId.trim()) {
|
|
59
63
|
throw new TypeError("JsonlSessionContextPort requires sessionId");
|
|
60
64
|
}
|
|
61
65
|
this.sessionId = sessionId.trim();
|
|
62
66
|
this.allowedSinks = [...allowedSinks];
|
|
67
|
+
this.requiredUserMessages = requiredUserMessages;
|
|
63
68
|
this.ownedHeadAdvances = new Map();
|
|
64
69
|
}
|
|
65
70
|
|
|
@@ -113,16 +118,20 @@ export class JsonlSessionContextPort {
|
|
|
113
118
|
memoryRevision = revision;
|
|
114
119
|
}
|
|
115
120
|
},
|
|
116
|
-
finish: (authority) =>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
memoryRevision,
|
|
120
|
-
items: messagesToContextItems(authority.readMessages(), {
|
|
121
|
+
finish: (authority) => {
|
|
122
|
+
const messages = authority.readMessages();
|
|
123
|
+
return {
|
|
121
124
|
sessionId,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
head: authority.headHash,
|
|
126
|
+
memoryRevision,
|
|
127
|
+
items: messagesToContextItems(messages, {
|
|
128
|
+
sessionId,
|
|
129
|
+
allowedSinks: this.allowedSinks,
|
|
130
|
+
allowExternalization: true,
|
|
131
|
+
requiredUserMessages: this.requiredUserMessages,
|
|
132
|
+
}),
|
|
133
|
+
};
|
|
134
|
+
},
|
|
126
135
|
};
|
|
127
136
|
});
|
|
128
137
|
}
|