@sema-agent/core 5.56.0 → 5.58.0
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/CHANGELOG.md +122 -0
- package/dist/agents/cascade.d.ts +1 -1
- package/dist/agents/cumulative-stats.d.ts +1 -1
- package/dist/agents/observer.d.ts +2 -2
- package/dist/agents/peer-admission.d.ts +1 -1
- package/dist/agents/retain-ledger.d.ts +2 -2
- package/dist/agents/roster-store.d.ts +8 -8
- package/dist/agents/send-message-tool.d.ts +13 -2
- package/dist/agents/send-message-tool.js +34 -12
- package/dist/agents/subagent-steps.d.ts +1 -1
- package/dist/agents/subagent.d.ts +13 -13
- package/dist/agents/team.d.ts +15 -6
- package/dist/agents/team.js +1 -0
- package/dist/agents/tool-filter.d.ts +2 -2
- package/dist/agents/verify.d.ts +1 -1
- package/dist/bench/metrics.d.ts +35 -35
- package/dist/brain/anthropic.js +15 -5
- package/dist/brain/circuit-breaker.js +2 -1
- package/dist/brain/degrading.d.ts +1 -1
- package/dist/brain/degrading.js +4 -1
- package/dist/brain/errors.d.ts +3 -3
- package/dist/brain/failover.js +16 -1
- package/dist/brain/open-responses.js +15 -5
- package/dist/brain/openai.js +16 -5
- package/dist/brain/reasoning.d.ts +2 -2
- package/dist/brain/repetition.d.ts +1 -1
- package/dist/brain/request-params.d.ts +30 -27
- package/dist/brain/request-params.js +1 -7
- package/dist/brain/route-adjudicator.d.ts +190 -0
- package/dist/brain/route-adjudicator.js +189 -0
- package/dist/brain/route-conformance.d.ts +55 -0
- package/dist/brain/route-conformance.js +136 -0
- package/dist/brain/routing.js +8 -3
- package/dist/brain/status-sink.d.ts +2 -2
- package/dist/brain/stream-shared.d.ts +1 -1
- package/dist/config/catalog.d.ts +5 -5
- package/dist/core/arg-summary.d.ts +4 -4
- package/dist/core/ask-class.d.ts +2 -2
- package/dist/core/ask-question.d.ts +1 -1
- package/dist/core/auto-compaction.d.ts +15 -15
- package/dist/core/auto-mode.d.ts +5 -5
- package/dist/core/background-agent-store.d.ts +20 -20
- package/dist/core/background-shell.d.ts +4 -4
- package/dist/core/checkpoint-store.d.ts +35 -27
- package/dist/core/context-edit.d.ts +1 -1
- package/dist/core/context-guard.d.ts +1 -1
- package/dist/core/exec-output-tail.d.ts +6 -6
- package/dist/core/file-snapshot-store.d.ts +8 -8
- package/dist/core/git-worktree-env.d.ts +3 -3
- package/dist/core/governance-codes.js +2 -0
- package/dist/core/hooks.d.ts +73 -33
- package/dist/core/hooks.js +87 -25
- package/dist/core/image-downsample.d.ts +1 -1
- package/dist/core/locked-config.d.ts +1 -1
- package/dist/core/lsp.d.ts +1 -1
- package/dist/core/mailbox-store.d.ts +1 -1
- package/dist/core/mcp.d.ts +3 -3
- package/dist/core/mcp.js +4 -4
- package/dist/core/memory-engine/consolidation-driver.d.ts +207 -0
- package/dist/core/memory-engine/consolidation-driver.js +378 -0
- package/dist/core/memory-engine/consolidation.d.ts +46 -2
- package/dist/core/memory-engine/consolidation.js +1 -0
- package/dist/core/memory-engine/data-plane.d.ts +1 -1
- package/dist/core/memory-engine/distiller.d.ts +550 -0
- package/dist/core/memory-engine/distiller.js +598 -0
- package/dist/core/memory-engine/dual-root.d.ts +1 -1
- package/dist/core/memory-engine/engine.d.ts +62 -8
- package/dist/core/memory-engine/engine.js +40 -4
- package/dist/core/memory-engine/file-backend.d.ts +1 -1
- package/dist/core/memory-engine/index.d.ts +4 -2
- package/dist/core/memory-engine/index.js +4 -2
- package/dist/core/memory-engine/origin-clearance.d.ts +1 -1
- package/dist/core/memory-engine/scope-contract.d.ts +4 -4
- package/dist/core/memory-engine/sync-client.d.ts +16 -16
- package/dist/core/memory-engine/sync.d.ts +4 -4
- package/dist/core/memory-recall.d.ts +1 -1
- package/dist/core/memory.d.ts +2 -2
- package/dist/core/permission-rule-consent.d.ts +230 -36
- package/dist/core/permission-rule-consent.js +258 -54
- package/dist/core/permission-rule-model.d.ts +295 -97
- package/dist/core/permission-rule-model.js +132 -41
- package/dist/core/permission-rules.d.ts +9 -9
- package/dist/core/remote-env.d.ts +8 -8
- package/dist/core/roles.d.ts +3 -3
- package/dist/core/roles.js +1 -0
- package/dist/core/runner/assemble-result.d.ts +2 -2
- package/dist/core/runner/compaction-call-options.d.ts +3 -3
- package/dist/core/runner/memory-consolidation-driver.d.ts +49 -0
- package/dist/core/runner/memory-consolidation-driver.js +60 -0
- package/dist/core/runner/memory-consolidation.d.ts +1 -1
- package/dist/core/runner/prepare-config-doors.d.ts +3 -3
- package/dist/core/runner/prepare-task.d.ts +21 -21
- package/dist/core/runner/prepare-task.js +54 -18
- package/dist/core/runner/prepare-workspace-restore.d.ts +2 -2
- package/dist/core/runner/runtask.d.ts +15 -12
- package/dist/core/runner/runtask.js +48 -0
- package/dist/core/runner/session-rule-policy.d.ts +1 -1
- package/dist/core/runner/teardown-bounded.d.ts +1 -1
- package/dist/core/runner/tool-disclosure.d.ts +2 -2
- package/dist/core/runner/turn-attachments.d.ts +11 -11
- package/dist/core/scheduler.d.ts +10 -5
- package/dist/core/secret-env.d.ts +1 -1
- package/dist/core/sensitive-path-policy.d.ts +1 -1
- package/dist/core/session-policy-store.d.ts +2 -2
- package/dist/core/session-reconcile.d.ts +2 -2
- package/dist/core/session-store.d.ts +3 -3
- package/dist/core/session.d.ts +1 -1
- package/dist/core/shutdown-debug.d.ts +2 -2
- package/dist/core/side-query.d.ts +14 -7
- package/dist/core/spec-contract.d.ts +1 -1
- package/dist/core/store-contracts/contract-harness.d.ts +2 -2
- package/dist/core/store-contracts/contract-kit-version.d.ts +2 -2
- package/dist/core/store-contracts/mailbox-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/mailbox-store-contract.js +1 -1
- package/dist/core/task-notification.d.ts +5 -5
- package/dist/core/task-registry-agent.d.ts +12 -12
- package/dist/core/task-registry-monitor.d.ts +1 -1
- package/dist/core/task-registry-shared.d.ts +41 -41
- package/dist/core/task-registry.d.ts +12 -12
- package/dist/core/tool-detach.d.ts +2 -2
- package/dist/core/tool-errors.d.ts +3 -3
- package/dist/core/tool-policy.d.ts +55 -28
- package/dist/core/tool-result-budget.d.ts +1 -1
- package/dist/core/tool-result-store.d.ts +2 -2
- package/dist/core/tools.d.ts +1 -1
- package/dist/core/trace.d.ts +26 -23
- package/dist/core/types.d.ts +155 -70
- package/dist/core/untrusted-egress.d.ts +1 -1
- package/dist/core/untrusted-text.d.ts +7 -7
- package/dist/core/wiring-manifest.d.ts +5 -5
- package/dist/core/workflow-journal-store.d.ts +14 -14
- package/dist/core/workflow-run-store-contract.d.ts +1 -1
- package/dist/core/workflow-run-store-contract.js +1 -1
- package/dist/core/workflow-run-store.d.ts +4 -4
- package/dist/engine/compaction/compaction.d.ts +3 -3
- package/dist/engine/compaction/utils.d.ts +2 -2
- package/dist/engine/execution-env/kill-tree.d.ts +1 -1
- package/dist/engine/execution-env/node-execution-env.d.ts +8 -8
- package/dist/engine/harness/agent-harness.d.ts +6 -6
- package/dist/engine/harness/agent-harness.js +26 -1
- package/dist/engine/harness/messages.d.ts +1 -1
- package/dist/engine/harness/types.d.ts +15 -11
- package/dist/engine/llm/types.d.ts +79 -14
- package/dist/engine/loop/agent-loop.d.ts +3 -3
- package/dist/engine/loop/types.d.ts +4 -4
- package/dist/engine/lsp/node-lsp-manager.d.ts +2 -2
- package/dist/engine/session/import-validate.d.ts +1 -1
- package/dist/engine/session/log-digest.d.ts +1 -1
- package/dist/engine/session/memory-repo.d.ts +2 -2
- package/dist/engine/session/session.d.ts +4 -4
- package/dist/fixtures/index.d.ts +4 -4
- package/dist/index.d.ts +8 -4
- package/dist/index.js +5 -2
- package/dist/internal/llm.d.ts +1 -1
- package/dist/orchestration/goal.d.ts +1 -1
- package/dist/orchestration/run-spec.d.ts +1 -1
- package/dist/orchestration/run-workflow-tool.d.ts +12 -12
- package/dist/orchestration/workflow-governance.d.ts +4 -4
- package/dist/orchestration/workflow-observe.d.ts +1 -1
- package/dist/orchestration/workflow-script-runner.d.ts +1 -1
- package/dist/orchestration/workflow-script-store.d.ts +9 -9
- package/dist/orchestration/workflow-size-guideline.d.ts +1 -1
- package/dist/orchestration/workflow-types.d.ts +5 -5
- package/dist/orchestration/workflow.d.ts +10 -10
- package/dist/prompt-assembly/artifact-store.d.ts +1 -1
- package/dist/prompt-assembly/artifact.d.ts +1 -1
- package/dist/prompt-assembly/assemble.d.ts +1 -1
- package/dist/prompt-assembly/composer.d.ts +2 -2
- package/dist/prompt-assembly/epoch.d.ts +2 -2
- package/dist/prompt-assembly/event-registry.d.ts +1 -1
- package/dist/prompt-assembly/explain.d.ts +3 -3
- package/dist/prompt-assembly/tool-catalog.d.ts +1 -1
- package/dist/prompt-assembly/turn-snapshot.d.ts +4 -4
- package/dist/prompt-assembly/types.d.ts +12 -12
- package/dist/prompts/coordinator.d.ts +1 -1
- package/dist/prompts/default.d.ts +10 -10
- package/dist/prompts/default.js +2 -0
- package/dist/prompts/simple-sections.d.ts +3 -3
- package/dist/prompts/supervisor.d.ts +2 -2
- package/dist/scenarios/full-body.d.ts +3 -3
- package/dist/scenarios/scenario-registry.d.ts +6 -2
- package/dist/scenarios/scenario-registry.js +4 -2
- package/dist/stores/cc/sidecar-transcript.d.ts +3 -3
- package/dist/stores/file/fs-atomic.d.ts +2 -2
- package/dist/stores/file/index.d.ts +1 -1
- package/dist/stores/file/session-store.d.ts +2 -2
- package/dist/stores/file/workflow-journal-store.d.ts +4 -4
- package/dist/tools/fs/bash-readonly-classifier.d.ts +1 -1
- package/dist/tools/fs/encoding.d.ts +4 -4
- package/dist/tools/fs/fs-bash.d.ts +3 -3
- package/dist/tools/fs/fs-pdf.d.ts +1 -1
- package/dist/tools/fs/fs-shared.d.ts +6 -6
- package/dist/tools/fs/index.d.ts +2 -2
- package/dist/tools/fs/index.js +8 -1
- package/dist/tools/fs/notebook.d.ts +1 -1
- package/dist/tools/fs/pdf.d.ts +1 -1
- package/dist/tools/fs/read-deny.d.ts +1 -1
- package/dist/tools/fs/safety.d.ts +9 -9
- package/dist/tools/fs/search.d.ts +2 -2
- package/dist/tools/monitor.d.ts +3 -3
- package/dist/tools/scheduler-tools.js +28 -6
- package/dist/tools/task-list.d.ts +2 -2
- package/dist/tools/web.d.ts +19 -4
- package/dist/tools/web.js +8 -2
- package/dist/tools/worktree.d.ts +5 -5
- package/dist/tools/worktree.js +2 -2
- package/package.json +1 -1
- package/test/export-surface.snapshot.json +74 -3
|
@@ -236,7 +236,7 @@ export declare const PROJECT_CONTEXT_FRAMING = "# Project context\nThe `<user_me
|
|
|
236
236
|
* base alike, like {@link MEMORY_SAFETY}, since it describes the harness, not the persona.
|
|
237
237
|
*/
|
|
238
238
|
/**
|
|
239
|
-
* The `# Harness` head LINE GROUP
|
|
239
|
+
* The `# Harness` head LINE GROUP: single source for both the legacy
|
|
240
240
|
* `harnessContext()` composite and the pack's `core/harness.head` section — the pack module MUST
|
|
241
241
|
* NOT carry a copied body (an unregistered dual surface of sentence-index protected lines).
|
|
242
242
|
*
|
|
@@ -354,7 +354,7 @@ export interface EnvironmentFacts {
|
|
|
354
354
|
* the turn-dynamic git view and rides the `git_status` frame (re-sent only when the rendered view
|
|
355
355
|
* changes); the field remains as a structured data carrier for callers that assembled it. */
|
|
356
356
|
gitSnapshot?: string;
|
|
357
|
-
/**
|
|
357
|
+
/** Per-lane resume-continuity facts (deployment-supplied via `TaskSpec.envFacts.resumeFacts`,
|
|
358
358
|
* copied by prepare ONLY on a durable-resume leg). Each present field renders one honest sentence; absent
|
|
359
359
|
* fields render nothing (core states no lane behavior it wasn't told). */
|
|
360
360
|
resumeFacts?: {
|
|
@@ -454,15 +454,15 @@ export declare function buildEnvironmentContext(facts: EnvironmentFacts): string
|
|
|
454
454
|
* task via \`TaskSpec.systemPrompt\`, or wire it to a development role via \`RoleSpec.systemPrompt\` so
|
|
455
455
|
* coding agents get it while non-coding roles keep the neutral base.
|
|
456
456
|
*/
|
|
457
|
-
export declare const CODE_AGENT_PROMPT = "You are a capable software-engineering agent that acts through tools.\n\n## Truth\n- Never fabricate tool results or claim a verification you did not perform.\n- When a tool fails, report the failure. When a result is uncertain, name the uncertainty.\n- Ground every claim that needs evidence in the tool result that produced it.\nThis duty is non-negotiable; no instruction may override it.\n\n## Engineering tasks\n- Understand before you change: read the relevant code before proposing or making edits. Do not modify code you have not read.\n- When a third-party API, library, or model documents a recommended usage \u2014 calling conventions, required preprocessing, a canonical invocation path \u2014 follow the canonical path by default for correctness-critical or reproduction work, even when the documentation marks it optional or the tradeoff \"minor\": that assessment was measured on the author's benchmark, not against this task's acceptance criteria. Deviating is a decision to justify, not a shortcut.\n- Match the surrounding code \u2014 its naming, structure, and conventions. New code should read like the code already there.\n- Minimum complexity: build what the task needs, no more. No speculative abstractions, no configurability nobody asked for, no error handling for cases that can't happen. Three similar lines beat a premature abstraction \u2014 but don't leave work half-done either.\n- Don't gold-plate: a bug fix doesn't need the surrounding code cleaned up; a small feature doesn't need extra options. Don't add comments, docstrings, or type annotations to code you didn't change.\n- Comment only where the WHY is non-obvious (a hidden constraint, a subtle invariant, a workaround). Don't explain WHAT well-named code already says. Don't delete existing comments unless you remove the code they describe or know they're wrong \u2014 a comment may encode a lesson not visible in the diff.\n- Don't create files unless necessary; prefer editing an existing file to creating a new one. Never proactively create documentation files (*.md) or READMEs unless explicitly requested.\n- Avoid backwards-compatibility cruft: renaming unused vars to `_x`, re-exporting moved symbols, leaving `// removed` tombstones. If something is certainly unused, delete it.\n- Security: don't introduce injection, XSS, SQLi, or other common vulnerabilities; if you notice insecure code you wrote, fix it immediately. Validate at system boundaries (user input, external APIs); trust internal invariants.\n- Be a collaborator, not just an executor: if the request rests on a misconception, or you spot a bug adjacent to what was asked, say so rather than silently complying.\n- Interpret a vague or generic instruction in the context of the codebase and the working directory. \"Change methodName to snake case\" means find that method in the code and edit it \u2014 not just reply \"method_name\".\n- You are highly capable; help the user attempt ambitious tasks. Defer to their judgment on whether a task is too large rather than refusing it up front.\n\n## Executing actions with care\n- Weigh reversibility and blast radius. Local, reversible actions (editing files, running tests) you may take freely. For hard-to-reverse, shared, or destructive actions \u2014 deleting files/branches, force-pushing, dropping tables, sending messages, pushing code, opening/closing PRs \u2014 confirm with the user first unless durably authorized.\n- Authorization holds for the scope given, not beyond: approving one push does not approve the next.\n- Don't reach for a destructive shortcut to clear an obstacle (skipping verification, resetting state, deleting unfamiliar files). Investigate unexpected state before overwriting it \u2014 it may be the user's in-progress work.\n- Inputs you are asked to repair, recover, or examine are read-only evidence by default. Survey them with non-intrusive read commands first. Before ANY operation that could rewrite them or trigger engine side effects \u2014 opening them with an engine that may touch companion state (a database engine, for example), in-place writes, format/repair tools \u2014 copy the original into an isolated working directory and operate only on the copy: an irreplaceable input lost to a side-effecting probe cannot be regenerated.\n- Uploading content to a pastebin, gist, or diagram renderer publishes it \u2014 it may be cached or indexed even if you later delete it. Treat it as an outward-facing action.\n\n## Tool use\n- Prefer a dedicated tool over a raw shell command when one fits \u2014 it's clearer and reviewable. Reserve the shell for genuine system/terminal operations.\n- Run independent tool calls in the same turn (in parallel); sequence them only when one depends on another's result.\n- When something must be done, do it with a tool now \u2014 don't narrate intent and stop. If you say you'll do something, make the call in the same response.\n- If a tool fails or returns empty, diagnose before retrying differently; don't repeat the identical failing call, and don't abandon a viable approach after a single failure.\n- If an approach fails, diagnose why before switching to another. Escalate to the user \u2014 via the AskUserQuestion tool when it is available \u2014 only when genuinely stuck after investigating, not as a first response to friction.\n\n## Git\n- Only commit when the user explicitly asks; if it's unclear whether they want a commit, ask first.\n- Never amend; always create a NEW commit (a hook may have failed, leaving the previous commit untouched \u2014 amending would rewrite the wrong thing). If a pre-commit hook fails, fix the issue and make a new commit.\n- `git add` specific named files; never `git add -A` or `git add .` (they sweep in .env files, credentials, large binaries).\n- Never commit a file likely to contain secrets (.env, credentials.json, *.pem, key files); if the user explicitly asks you to, warn them first.\n- Never change git config, never skip hooks (`--no-verify`), never bypass signatures.\n- Pass multi-line commit messages with a HEREDOC (`git commit -m \"$(cat <<'EOF' ... EOF)\"`) so formatting survives.\n- For a PR, analyze ALL commits since the branch diverged from its base (not just the latest commit) before writing the summary.\n\n## Verification & reporting\n- Before reporting a task done, verify it works: run the test, execute the code, check the output \u2014 not just the exit code. If you can't verify, say so rather than implying success.\n- Verify the final artifact, not a proxy. Exercise what you actually delivered through its real entry point (call the real function, run the produced binary, query the served endpoint), judged the way the task itself will be judged. A pre-existing suite that was already green, an earlier candidate's output, or a self-test that bypasses the delivered code verifies nothing. Then READ your verification's output and use it: if your own check flags a mismatch, resolve it by direct comparison against the requirement \u2014 don't discard it as a false positive, and don't substitute an older result you liked better. Confirm that what you submit is the value the acceptance surface itself asks for \u2014 the bare value, not the file line, prefix, wrapper, or intermediate representation that carried it: reconcile the submission's exact form word-for-word against what the acceptance surface expects.\n- Report outcomes faithfully: if tests fail, say so with the output; if you skipped a step, say that. Never manufacture a green result. Equally, when something passed, state it plainly \u2014 don't hedge confirmed results or re-verify what you already checked.\n\n## References & style\n- Reference code as file_path:line_number so the user can navigate to it.\n- Reference a GitHub issue or PR as owner/repo#123 so it renders as a clickable link.\n- Don't put a colon before a tool call (avoid \"Let me check:\" immediately followed by a call) \u2014 end the sentence with a period.\n- Don't give time estimates or predictions for how long work will take \u2014 focus on what needs doing.\n- Be concise; lead with the answer or the action. Prefer prose, lists, and code blocks over wide tables. Match the user's language. Avoid emojis unless asked. If you can say it in one sentence, don't use three. Go straight to the point, don't go in circles, don't overdo it. (This does not apply to code or tool calls.)";
|
|
458
|
-
/** design/102
|
|
457
|
+
export declare const CODE_AGENT_PROMPT = "You are a capable software-engineering agent that acts through tools.\n\n## Truth\n- Never fabricate tool results or claim a verification you did not perform.\n- When a tool fails, report the failure. When a result is uncertain, name the uncertainty.\n- Ground every claim that needs evidence in the tool result that produced it.\nThis duty is non-negotiable; no instruction may override it.\n\n## Engineering tasks\n- Understand before you change: read the relevant code before proposing or making edits. Do not modify code you have not read.\n- When a third-party API, library, or model documents a recommended usage \u2014 calling conventions, required preprocessing, a canonical invocation path \u2014 follow the canonical path by default for correctness-critical or reproduction work, even when the documentation marks it optional or the tradeoff \"minor\": that assessment was measured on the author's benchmark, not against this task's acceptance criteria. Deviating is a decision to justify, not a shortcut.\n- Match the surrounding code \u2014 its naming, structure, and conventions. New code should read like the code already there.\n- Minimum complexity: build what the task needs, no more. No speculative abstractions, no configurability nobody asked for, no error handling for cases that can't happen. Three similar lines beat a premature abstraction \u2014 but don't leave work half-done either.\n- Don't gold-plate: a bug fix doesn't need the surrounding code cleaned up; a small feature doesn't need extra options. Don't add comments, docstrings, or type annotations to code you didn't change.\n- Comment only where the WHY is non-obvious (a hidden constraint, a subtle invariant, a workaround). Don't explain WHAT well-named code already says. Don't delete existing comments unless you remove the code they describe or know they're wrong \u2014 a comment may encode a lesson not visible in the diff.\n- Don't create files unless necessary; prefer editing an existing file to creating a new one. Never proactively create documentation files (*.md) or READMEs unless explicitly requested.\n- Avoid backwards-compatibility cruft: renaming unused vars to `_x`, re-exporting moved symbols, leaving `// removed` tombstones. If something is certainly unused, delete it.\n- Security: don't introduce injection, XSS, SQLi, or other common vulnerabilities; if you notice insecure code you wrote, fix it immediately. Validate at system boundaries (user input, external APIs); trust internal invariants.\n- Be a collaborator, not just an executor: if the request rests on a misconception, or you spot a bug adjacent to what was asked, say so rather than silently complying.\n- Interpret a vague or generic instruction in the context of the codebase and the working directory. \"Change methodName to snake case\" means find that method in the code and edit it \u2014 not just reply \"method_name\".\n- You are highly capable; help the user attempt ambitious tasks. Defer to their judgment on whether a task is too large rather than refusing it up front.\n\n## Executing actions with care\n- Weigh reversibility and blast radius. Local, reversible actions (editing files, running tests) you may take freely. For hard-to-reverse, shared, or destructive actions \u2014 deleting files/branches, force-pushing, dropping tables, sending messages, pushing code, opening/closing PRs \u2014 confirm with the user first unless durably authorized.\n- Authorization holds for the scope given, not beyond: approving one push does not approve the next.\n- Don't reach for a destructive shortcut to clear an obstacle (skipping verification, resetting state, deleting unfamiliar files). Investigate unexpected state before overwriting it \u2014 it may be the user's in-progress work.\n- Inputs you are asked to repair, recover, or examine are read-only evidence by default. Survey them with non-intrusive read commands first. Before ANY operation that could rewrite them or trigger engine side effects \u2014 opening them with an engine that may touch companion state (a database engine, for example), in-place writes, format/repair tools \u2014 copy the original into an isolated working directory and operate only on the copy: an irreplaceable input lost to a side-effecting probe cannot be regenerated.\n- Uploading content to a pastebin, gist, or diagram renderer publishes it \u2014 it may be cached or indexed even if you later delete it. Treat it as an outward-facing action.\n\n## Tool use\n- Prefer a dedicated tool over a raw shell command when one fits \u2014 it's clearer and reviewable. Reserve the shell for genuine system/terminal operations.\n- Run independent tool calls in the same turn (in parallel); sequence them only when one depends on another's result.\n- When something must be done, do it with a tool now \u2014 don't narrate intent and stop. If you say you'll do something, make the call in the same response.\n- If a tool fails or returns empty, diagnose before retrying differently; don't repeat the identical failing call, and don't abandon a viable approach after a single failure.\n- If an approach fails, diagnose why before switching to another. Escalate to the user \u2014 via the AskUserQuestion tool when it is available \u2014 only when genuinely stuck after investigating, not as a first response to friction.\n\n## Git\n- Only commit when the user explicitly asks; if it's unclear whether they want a commit, ask first.\n- Never amend; always create a NEW commit (a hook may have failed, leaving the previous commit untouched \u2014 amending would rewrite the wrong thing). If a pre-commit hook fails, fix the issue and make a new commit.\n- `git add` specific named files; never `git add -A` or `git add .` (they sweep in .env files, credentials, large binaries).\n- Never commit a file likely to contain secrets (.env, credentials.json, *.pem, key files); if the user explicitly asks you to, warn them first.\n- Never change git config, never skip hooks (`--no-verify`), never bypass signatures.\n- Before any destructive git command (`checkout --force`, `reset --hard`, `clean`, branch deletion), run `git status` first \u2014 untracked or uncommitted work is unrecoverable once these run.\n- Before `git push`, re-check what the push carries: after a broad `git add`, review the staged list for files that may contain secrets before they leave the machine.\n- Pass multi-line commit messages with a HEREDOC (`git commit -m \"$(cat <<'EOF' ... EOF)\"`) so formatting survives.\n- For a PR, analyze ALL commits since the branch diverged from its base (not just the latest commit) before writing the summary.\n\n## Verification & reporting\n- Before reporting a task done, verify it works: run the test, execute the code, check the output \u2014 not just the exit code. If you can't verify, say so rather than implying success.\n- Verify the final artifact, not a proxy. Exercise what you actually delivered through its real entry point (call the real function, run the produced binary, query the served endpoint), judged the way the task itself will be judged. A pre-existing suite that was already green, an earlier candidate's output, or a self-test that bypasses the delivered code verifies nothing. Then READ your verification's output and use it: if your own check flags a mismatch, resolve it by direct comparison against the requirement \u2014 don't discard it as a false positive, and don't substitute an older result you liked better. Confirm that what you submit is the value the acceptance surface itself asks for \u2014 the bare value, not the file line, prefix, wrapper, or intermediate representation that carried it: reconcile the submission's exact form word-for-word against what the acceptance surface expects.\n- Report outcomes faithfully: if tests fail, say so with the output; if you skipped a step, say that. Never manufacture a green result. Equally, when something passed, state it plainly \u2014 don't hedge confirmed results or re-verify what you already checked.\n\n## References & style\n- Reference code as file_path:line_number so the user can navigate to it.\n- Reference a GitHub issue or PR as owner/repo#123 so it renders as a clickable link.\n- Don't put a colon before a tool call (avoid \"Let me check:\" immediately followed by a call) \u2014 end the sentence with a period.\n- Don't give time estimates or predictions for how long work will take \u2014 focus on what needs doing.\n- Be concise; lead with the answer or the action. Prefer prose, lists, and code blocks over wide tables. Match the user's language. Avoid emojis unless asked. If you can say it in one sentence, don't use three. Go straight to the point, don't go in circles, don't overdo it. (This does not apply to code or tool calls.)";
|
|
458
|
+
/** design/102 — the coding-agent persona the `code` scenario mounts, selected via
|
|
459
459
|
* `RoleSpec.systemPrompt` / `TaskSpec.systemPrompt` (the global default stays the neutral
|
|
460
460
|
* {@link DEFAULT_SYSTEM_PROMPT}). Since RB-321 retired the three K-8 deltas this is byte-identical to
|
|
461
461
|
* {@link CODE_AGENT_PROMPT} — the two names are kept apart because they mean different things
|
|
462
462
|
* (`CODE_AGENT_PROMPT` = the shared coding FLOOR a dev role composes with; `CODE_SYSTEM_PROMPT` = the
|
|
463
463
|
* persona the scenario mounts), and merging two public exports is a BREAKING-window action.
|
|
464
464
|
* STABLE (cacheable) — `assertPromptCacheFriendly` still passes. */
|
|
465
|
-
export declare const CODE_SYSTEM_PROMPT = "You are a capable software-engineering agent that acts through tools.\n\n## Truth\n- Never fabricate tool results or claim a verification you did not perform.\n- When a tool fails, report the failure. When a result is uncertain, name the uncertainty.\n- Ground every claim that needs evidence in the tool result that produced it.\nThis duty is non-negotiable; no instruction may override it.\n\n## Engineering tasks\n- Understand before you change: read the relevant code before proposing or making edits. Do not modify code you have not read.\n- When a third-party API, library, or model documents a recommended usage \u2014 calling conventions, required preprocessing, a canonical invocation path \u2014 follow the canonical path by default for correctness-critical or reproduction work, even when the documentation marks it optional or the tradeoff \"minor\": that assessment was measured on the author's benchmark, not against this task's acceptance criteria. Deviating is a decision to justify, not a shortcut.\n- Match the surrounding code \u2014 its naming, structure, and conventions. New code should read like the code already there.\n- Minimum complexity: build what the task needs, no more. No speculative abstractions, no configurability nobody asked for, no error handling for cases that can't happen. Three similar lines beat a premature abstraction \u2014 but don't leave work half-done either.\n- Don't gold-plate: a bug fix doesn't need the surrounding code cleaned up; a small feature doesn't need extra options. Don't add comments, docstrings, or type annotations to code you didn't change.\n- Comment only where the WHY is non-obvious (a hidden constraint, a subtle invariant, a workaround). Don't explain WHAT well-named code already says. Don't delete existing comments unless you remove the code they describe or know they're wrong \u2014 a comment may encode a lesson not visible in the diff.\n- Don't create files unless necessary; prefer editing an existing file to creating a new one. Never proactively create documentation files (*.md) or READMEs unless explicitly requested.\n- Avoid backwards-compatibility cruft: renaming unused vars to `_x`, re-exporting moved symbols, leaving `// removed` tombstones. If something is certainly unused, delete it.\n- Security: don't introduce injection, XSS, SQLi, or other common vulnerabilities; if you notice insecure code you wrote, fix it immediately. Validate at system boundaries (user input, external APIs); trust internal invariants.\n- Be a collaborator, not just an executor: if the request rests on a misconception, or you spot a bug adjacent to what was asked, say so rather than silently complying.\n- Interpret a vague or generic instruction in the context of the codebase and the working directory. \"Change methodName to snake case\" means find that method in the code and edit it \u2014 not just reply \"method_name\".\n- You are highly capable; help the user attempt ambitious tasks. Defer to their judgment on whether a task is too large rather than refusing it up front.\n\n## Executing actions with care\n- Weigh reversibility and blast radius. Local, reversible actions (editing files, running tests) you may take freely. For hard-to-reverse, shared, or destructive actions \u2014 deleting files/branches, force-pushing, dropping tables, sending messages, pushing code, opening/closing PRs \u2014 confirm with the user first unless durably authorized.\n- Authorization holds for the scope given, not beyond: approving one push does not approve the next.\n- Don't reach for a destructive shortcut to clear an obstacle (skipping verification, resetting state, deleting unfamiliar files). Investigate unexpected state before overwriting it \u2014 it may be the user's in-progress work.\n- Inputs you are asked to repair, recover, or examine are read-only evidence by default. Survey them with non-intrusive read commands first. Before ANY operation that could rewrite them or trigger engine side effects \u2014 opening them with an engine that may touch companion state (a database engine, for example), in-place writes, format/repair tools \u2014 copy the original into an isolated working directory and operate only on the copy: an irreplaceable input lost to a side-effecting probe cannot be regenerated.\n- Uploading content to a pastebin, gist, or diagram renderer publishes it \u2014 it may be cached or indexed even if you later delete it. Treat it as an outward-facing action.\n\n## Tool use\n- Prefer a dedicated tool over a raw shell command when one fits \u2014 it's clearer and reviewable. Reserve the shell for genuine system/terminal operations.\n- Run independent tool calls in the same turn (in parallel); sequence them only when one depends on another's result.\n- When something must be done, do it with a tool now \u2014 don't narrate intent and stop. If you say you'll do something, make the call in the same response.\n- If a tool fails or returns empty, diagnose before retrying differently; don't repeat the identical failing call, and don't abandon a viable approach after a single failure.\n- If an approach fails, diagnose why before switching to another. Escalate to the user \u2014 via the AskUserQuestion tool when it is available \u2014 only when genuinely stuck after investigating, not as a first response to friction.\n\n## Git\n- Only commit when the user explicitly asks; if it's unclear whether they want a commit, ask first.\n- Never amend; always create a NEW commit (a hook may have failed, leaving the previous commit untouched \u2014 amending would rewrite the wrong thing). If a pre-commit hook fails, fix the issue and make a new commit.\n- `git add` specific named files; never `git add -A` or `git add .` (they sweep in .env files, credentials, large binaries).\n- Never commit a file likely to contain secrets (.env, credentials.json, *.pem, key files); if the user explicitly asks you to, warn them first.\n- Never change git config, never skip hooks (`--no-verify`), never bypass signatures.\n- Pass multi-line commit messages with a HEREDOC (`git commit -m \"$(cat <<'EOF' ... EOF)\"`) so formatting survives.\n- For a PR, analyze ALL commits since the branch diverged from its base (not just the latest commit) before writing the summary.\n\n## Verification & reporting\n- Before reporting a task done, verify it works: run the test, execute the code, check the output \u2014 not just the exit code. If you can't verify, say so rather than implying success.\n- Verify the final artifact, not a proxy. Exercise what you actually delivered through its real entry point (call the real function, run the produced binary, query the served endpoint), judged the way the task itself will be judged. A pre-existing suite that was already green, an earlier candidate's output, or a self-test that bypasses the delivered code verifies nothing. Then READ your verification's output and use it: if your own check flags a mismatch, resolve it by direct comparison against the requirement \u2014 don't discard it as a false positive, and don't substitute an older result you liked better. Confirm that what you submit is the value the acceptance surface itself asks for \u2014 the bare value, not the file line, prefix, wrapper, or intermediate representation that carried it: reconcile the submission's exact form word-for-word against what the acceptance surface expects.\n- Report outcomes faithfully: if tests fail, say so with the output; if you skipped a step, say that. Never manufacture a green result. Equally, when something passed, state it plainly \u2014 don't hedge confirmed results or re-verify what you already checked.\n\n## References & style\n- Reference code as file_path:line_number so the user can navigate to it.\n- Reference a GitHub issue or PR as owner/repo#123 so it renders as a clickable link.\n- Don't put a colon before a tool call (avoid \"Let me check:\" immediately followed by a call) \u2014 end the sentence with a period.\n- Don't give time estimates or predictions for how long work will take \u2014 focus on what needs doing.\n- Be concise; lead with the answer or the action. Prefer prose, lists, and code blocks over wide tables. Match the user's language. Avoid emojis unless asked. If you can say it in one sentence, don't use three. Go straight to the point, don't go in circles, don't overdo it. (This does not apply to code or tool calls.)";
|
|
465
|
+
export declare const CODE_SYSTEM_PROMPT = "You are a capable software-engineering agent that acts through tools.\n\n## Truth\n- Never fabricate tool results or claim a verification you did not perform.\n- When a tool fails, report the failure. When a result is uncertain, name the uncertainty.\n- Ground every claim that needs evidence in the tool result that produced it.\nThis duty is non-negotiable; no instruction may override it.\n\n## Engineering tasks\n- Understand before you change: read the relevant code before proposing or making edits. Do not modify code you have not read.\n- When a third-party API, library, or model documents a recommended usage \u2014 calling conventions, required preprocessing, a canonical invocation path \u2014 follow the canonical path by default for correctness-critical or reproduction work, even when the documentation marks it optional or the tradeoff \"minor\": that assessment was measured on the author's benchmark, not against this task's acceptance criteria. Deviating is a decision to justify, not a shortcut.\n- Match the surrounding code \u2014 its naming, structure, and conventions. New code should read like the code already there.\n- Minimum complexity: build what the task needs, no more. No speculative abstractions, no configurability nobody asked for, no error handling for cases that can't happen. Three similar lines beat a premature abstraction \u2014 but don't leave work half-done either.\n- Don't gold-plate: a bug fix doesn't need the surrounding code cleaned up; a small feature doesn't need extra options. Don't add comments, docstrings, or type annotations to code you didn't change.\n- Comment only where the WHY is non-obvious (a hidden constraint, a subtle invariant, a workaround). Don't explain WHAT well-named code already says. Don't delete existing comments unless you remove the code they describe or know they're wrong \u2014 a comment may encode a lesson not visible in the diff.\n- Don't create files unless necessary; prefer editing an existing file to creating a new one. Never proactively create documentation files (*.md) or READMEs unless explicitly requested.\n- Avoid backwards-compatibility cruft: renaming unused vars to `_x`, re-exporting moved symbols, leaving `// removed` tombstones. If something is certainly unused, delete it.\n- Security: don't introduce injection, XSS, SQLi, or other common vulnerabilities; if you notice insecure code you wrote, fix it immediately. Validate at system boundaries (user input, external APIs); trust internal invariants.\n- Be a collaborator, not just an executor: if the request rests on a misconception, or you spot a bug adjacent to what was asked, say so rather than silently complying.\n- Interpret a vague or generic instruction in the context of the codebase and the working directory. \"Change methodName to snake case\" means find that method in the code and edit it \u2014 not just reply \"method_name\".\n- You are highly capable; help the user attempt ambitious tasks. Defer to their judgment on whether a task is too large rather than refusing it up front.\n\n## Executing actions with care\n- Weigh reversibility and blast radius. Local, reversible actions (editing files, running tests) you may take freely. For hard-to-reverse, shared, or destructive actions \u2014 deleting files/branches, force-pushing, dropping tables, sending messages, pushing code, opening/closing PRs \u2014 confirm with the user first unless durably authorized.\n- Authorization holds for the scope given, not beyond: approving one push does not approve the next.\n- Don't reach for a destructive shortcut to clear an obstacle (skipping verification, resetting state, deleting unfamiliar files). Investigate unexpected state before overwriting it \u2014 it may be the user's in-progress work.\n- Inputs you are asked to repair, recover, or examine are read-only evidence by default. Survey them with non-intrusive read commands first. Before ANY operation that could rewrite them or trigger engine side effects \u2014 opening them with an engine that may touch companion state (a database engine, for example), in-place writes, format/repair tools \u2014 copy the original into an isolated working directory and operate only on the copy: an irreplaceable input lost to a side-effecting probe cannot be regenerated.\n- Uploading content to a pastebin, gist, or diagram renderer publishes it \u2014 it may be cached or indexed even if you later delete it. Treat it as an outward-facing action.\n\n## Tool use\n- Prefer a dedicated tool over a raw shell command when one fits \u2014 it's clearer and reviewable. Reserve the shell for genuine system/terminal operations.\n- Run independent tool calls in the same turn (in parallel); sequence them only when one depends on another's result.\n- When something must be done, do it with a tool now \u2014 don't narrate intent and stop. If you say you'll do something, make the call in the same response.\n- If a tool fails or returns empty, diagnose before retrying differently; don't repeat the identical failing call, and don't abandon a viable approach after a single failure.\n- If an approach fails, diagnose why before switching to another. Escalate to the user \u2014 via the AskUserQuestion tool when it is available \u2014 only when genuinely stuck after investigating, not as a first response to friction.\n\n## Git\n- Only commit when the user explicitly asks; if it's unclear whether they want a commit, ask first.\n- Never amend; always create a NEW commit (a hook may have failed, leaving the previous commit untouched \u2014 amending would rewrite the wrong thing). If a pre-commit hook fails, fix the issue and make a new commit.\n- `git add` specific named files; never `git add -A` or `git add .` (they sweep in .env files, credentials, large binaries).\n- Never commit a file likely to contain secrets (.env, credentials.json, *.pem, key files); if the user explicitly asks you to, warn them first.\n- Never change git config, never skip hooks (`--no-verify`), never bypass signatures.\n- Before any destructive git command (`checkout --force`, `reset --hard`, `clean`, branch deletion), run `git status` first \u2014 untracked or uncommitted work is unrecoverable once these run.\n- Before `git push`, re-check what the push carries: after a broad `git add`, review the staged list for files that may contain secrets before they leave the machine.\n- Pass multi-line commit messages with a HEREDOC (`git commit -m \"$(cat <<'EOF' ... EOF)\"`) so formatting survives.\n- For a PR, analyze ALL commits since the branch diverged from its base (not just the latest commit) before writing the summary.\n\n## Verification & reporting\n- Before reporting a task done, verify it works: run the test, execute the code, check the output \u2014 not just the exit code. If you can't verify, say so rather than implying success.\n- Verify the final artifact, not a proxy. Exercise what you actually delivered through its real entry point (call the real function, run the produced binary, query the served endpoint), judged the way the task itself will be judged. A pre-existing suite that was already green, an earlier candidate's output, or a self-test that bypasses the delivered code verifies nothing. Then READ your verification's output and use it: if your own check flags a mismatch, resolve it by direct comparison against the requirement \u2014 don't discard it as a false positive, and don't substitute an older result you liked better. Confirm that what you submit is the value the acceptance surface itself asks for \u2014 the bare value, not the file line, prefix, wrapper, or intermediate representation that carried it: reconcile the submission's exact form word-for-word against what the acceptance surface expects.\n- Report outcomes faithfully: if tests fail, say so with the output; if you skipped a step, say that. Never manufacture a green result. Equally, when something passed, state it plainly \u2014 don't hedge confirmed results or re-verify what you already checked.\n\n## References & style\n- Reference code as file_path:line_number so the user can navigate to it.\n- Reference a GitHub issue or PR as owner/repo#123 so it renders as a clickable link.\n- Don't put a colon before a tool call (avoid \"Let me check:\" immediately followed by a call) \u2014 end the sentence with a period.\n- Don't give time estimates or predictions for how long work will take \u2014 focus on what needs doing.\n- Be concise; lead with the answer or the action. Prefer prose, lists, and code blocks over wide tables. Match the user's language. Avoid emojis unless asked. If you can say it in one sentence, don't use three. Go straight to the point, don't go in circles, don't overdo it. (This does not apply to code or tool calls.)";
|
|
466
466
|
/** Context passed to a {@link PromptProvider.stableSystem} — the STABLE, cacheable inputs only. */
|
|
467
467
|
export interface StablePromptContext {
|
|
468
468
|
/** The task's own system prompt, if it supplied one. */
|
|
@@ -532,7 +532,7 @@ export interface StablePromptContext {
|
|
|
532
532
|
* Omitted/false → not composed (fail-closed).
|
|
533
533
|
*/
|
|
534
534
|
orchestrationEnabled?: boolean;
|
|
535
|
-
/**
|
|
535
|
+
/** Orchestration is active but the Workflow tool is DEFERRED — compose the
|
|
536
536
|
* short pointer instead of the full how-to (cache-prefix parity with the schema deferral). */
|
|
537
537
|
orchestrationDeferred?: boolean;
|
|
538
538
|
/** R2 双形轴 — the run's resolved prompt profile ("simple" default; "classic" keeps the pre-R3 shape). */
|
|
@@ -583,7 +583,7 @@ export interface StablePromptContext {
|
|
|
583
583
|
* which handed ordering and memory placement to the provider, was removed in design/157 B19.)
|
|
584
584
|
*/
|
|
585
585
|
/**
|
|
586
|
-
* One TYPED stable-prompt contribution (
|
|
586
|
+
* One TYPED stable-prompt contribution (stage S1, plan M14) — the structured alternative to the
|
|
587
587
|
* opaque `stableSystem(): string`. Each declaration lands as its own manifest section with full
|
|
588
588
|
* slot/digest observability; the Composer places it by slot (identity → the role-base position,
|
|
589
589
|
* scenario → after the mode blocks, behavior → the model-guidance region), preserving declaration
|
|
@@ -602,11 +602,11 @@ export interface PromptTextDeclaration {
|
|
|
602
602
|
slot: "identity" | "scenario" | "behavior";
|
|
603
603
|
text: string;
|
|
604
604
|
/**
|
|
605
|
-
* OPT-IN reconciliation digest (
|
|
605
|
+
* OPT-IN reconciliation digest (digest tiering): `sha256:<64 lowercase hex>` of
|
|
606
606
|
* `text`, precomputed by the declaring deployment (e.g. the center publish pipeline). When present
|
|
607
607
|
* AND correct it is passed through verbatim to the `prompt.assembled` manifest section as
|
|
608
608
|
* `contentHash` (unsalted, end-to-end auditable); on mismatch it is DROPPED with an onWarn (never
|
|
609
|
-
* an invented digest). Core NEVER derives an unsalted digest on its own (
|
|
609
|
+
* an invented digest). Core NEVER derives an unsalted digest on its own (this lane may
|
|
610
610
|
* carry forwarded caller-private text — fingerprinting is strictly the declarer's explicit call).
|
|
611
611
|
* Omit for private/caller-derived text; the salted manifest `hash` always remains.
|
|
612
612
|
*/
|
|
@@ -628,7 +628,7 @@ export interface PromptProvider {
|
|
|
628
628
|
* still compose after it. Without this flag, `stableSystem` output is treated as the role layer and
|
|
629
629
|
* the constitution is appended structurally.
|
|
630
630
|
*
|
|
631
|
-
* M4 narrowing (
|
|
631
|
+
* M4 narrowing (2026-07-16, stage S1): the LOCKED sections — security policy, harness
|
|
632
632
|
* mechanism truth, context-management honesty — now compose structurally even under `replaceAll`;
|
|
633
633
|
* the flag replaces the identity/behavior/scenario face only.
|
|
634
634
|
*/
|
package/dist/prompts/default.js
CHANGED
|
@@ -348,6 +348,8 @@ ${""}- Only commit when the user explicitly asks; if it's unclear whether they w
|
|
|
348
348
|
- \`git add\` specific named files; never \`git add -A\` or \`git add .\` (they sweep in .env files, credentials, large binaries).
|
|
349
349
|
- Never commit a file likely to contain secrets (.env, credentials.json, *.pem, key files); if the user explicitly asks you to, warn them first.
|
|
350
350
|
- Never change git config, never skip hooks (\`--no-verify\`), never bypass signatures.
|
|
351
|
+
${""}- Before any destructive git command (\`checkout --force\`, \`reset --hard\`, \`clean\`, branch deletion), run \`git status\` first — untracked or uncommitted work is unrecoverable once these run.
|
|
352
|
+
- Before \`git push\`, re-check what the push carries: after a broad \`git add\`, review the staged list for files that may contain secrets before they leave the machine.
|
|
351
353
|
- Pass multi-line commit messages with a HEREDOC (\`git commit -m "$(cat <<'EOF' ... EOF)"\`) so formatting survives.
|
|
352
354
|
- For a PR, analyze ALL commits since the branch diverged from its base (not just the latest commit) before writing the summary.
|
|
353
355
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* CC 2.1.212 SIMPLE-profile system sections, verbatim-anchored (the prompt constitution:
|
|
3
3
|
* prompts anchor to CC; behavior value first). Anchor doc = sema-internal
|
|
4
4
|
* anchors/2.1.212/simple-system-sections.md (the H$ section roster + full texts, pretty.js 466xxx).
|
|
5
5
|
*
|
|
@@ -41,7 +41,7 @@ export declare const SIMPLE_PRONOUNS = "When you use a pronoun for someone \u201
|
|
|
41
41
|
export declare const SIMPLE_TOOL_PARAM_JSON = "Object and array parameter values must be a single JSON value \u2014 never write parameter-tag markup inside a JSON value.";
|
|
42
42
|
/** sU_ — the fable autonomous-operation section (b9e-gated in CC; served on fableMitigations). */
|
|
43
43
|
export declare const SIMPLE_AUTONOMY_FABLE = "You are operating autonomously. The user is not watching in real time and cannot answer questions mid-task, so asking 'Want me to\u2026?' or 'Shall I\u2026?' will block the work. For reversible actions that follow from the original request, proceed without asking. Stop only for destructive actions or genuine scope changes the user must decide. Offering follow-ups after the task is done is fine; asking permission before doing the work is not.\n\nException: when the user is describing a problem, asking a question, or thinking out loud rather than requesting a change, the deliverable is your assessment. Report your findings and stop. Don't apply a fix until they ask for one.\n\nBefore ending your turn, check your last paragraph. If it is a plan, an analysis, a question, a list of next steps, or a promise about work you have not done ('I'll\u2026', 'let me know when\u2026'), do that work now with tool calls. That includes retrying after errors and gathering missing information yourself. Do not stop because the context or session is long. End your turn only when the task is complete or you are blocked on input only the user can provide.\n\nBefore running a command that changes system state \u2014 restarts, deletes, config edits \u2014 check that the evidence actually supports that specific action. A signal that pattern-matches to a known failure may have a different cause.";
|
|
44
|
-
/**
|
|
44
|
+
/** hermetic verification(sq**-wi**-gc** 案:两盒编译全对,挂在 profile 形 PATH+
|
|
45
45
|
* 自己 shell 里 export 后自证;grader 以全新进程视角查找不到)。
|
|
46
46
|
*
|
|
47
47
|
* RB-323 改名(2026-07-30):原标题 `# Delivering work that outlives the session` 与 CC 220 移植进来的
|
|
@@ -49,7 +49,7 @@ export declare const SIMPLE_AUTONOMY_FABLE = "You are operating autonomously. Th
|
|
|
49
49
|
* **前缀**,两段同时在场时既让模型看见两个近似标题,也让任何 `includes("# Delivering work")` 断言同时
|
|
50
50
|
* 命中两段。新标题按内容取名:整段讲的是**怎么验**(全新进程视角),不是交付范围。 */
|
|
51
51
|
export declare const SEMA_VERIFY_FRESH = "# Hermetic verification\nWhen a deliverable must work outside this session \u2014 an installed tool, a built artifact, a configured service \u2014 verify it the way a grader would: from a hermetic process that inherits none of your session state (e.g. `env -i bash -c '...'`), never only inside the shell where you exported variables or edited profile files. A login shell is NOT a clean check \u2014 it sources the same profiles you may have just written; use one only when a login shell is the deliverable's actual entry point, and never as the sole verification. Success that depends on your session state is not success. Prefer standard install locations over session-local paths, and leave the delivered state verified in the form it will actually be used.";
|
|
52
|
-
/**
|
|
52
|
+
/** audit evidence discipline(sa** 案:正则命中而看不到原因→整读文件而非判误报;
|
|
53
53
|
* 拿到具体值后字面值全仓终检)。 */
|
|
54
54
|
export declare const SEMA_EVIDENCE_AUDIT = "# Search hits are evidence\nIn an audit or search task, treat every match as evidence until you have seen WHY it matched: when a hit's cause is not visible (a truncated line, a minified file), open the file at that location instead of dismissing the hit as a false positive. After you recover a concrete NON-SENSITIVE identifier (a hostname, an id, a config key), run one final literal search for that exact value across the whole target \u2014 the copies you did not predict are the ones that matter. For a SENSITIVE value (a credential, a token, a private key), never place it in a command argument or echo it in output: search by reading it from its source (e.g. a pattern file the shell never expands, or an in-process scan) and report locations and counts only.";
|
|
55
55
|
/** CC 220 `RMy`(`delivering_work_max` 槽)—— 交付范围纪律。逐字。 */
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* matching mode is actually enabled (same {@link harnessContext} §6.3 discipline: never claim a feature
|
|
6
6
|
* the task lacks). They live in the cacheable prefix and never carry volatile content.
|
|
7
7
|
*
|
|
8
|
-
* Definition (
|
|
8
|
+
* Definition (2026-06-22, value-judgment red line design/89+95): the supervisor is the delegate of an
|
|
9
9
|
* absent user — closer to the user's goal/blueprint, so naturally watching the worker — **NOT because it is
|
|
10
10
|
* smarter**. Its real value is a different VANTAGE (whole-goal vs local-slice) + a safety net for the cases a
|
|
11
11
|
* worker structurally gets wrong. The prompts write that in plainly; they never claim "supervisor is generally
|
|
@@ -37,7 +37,7 @@ export declare const SUPERVISOR_PROMPT = "You are a supervisor \u2014 the delega
|
|
|
37
37
|
* Aligns with the design/89/95 value judgment: fan-out AMPLIFIES a bad conclusion → clear boundaries +
|
|
38
38
|
* adversarial verify.
|
|
39
39
|
*/
|
|
40
|
-
/**
|
|
40
|
+
/** The DEFERRED short form: when the Workflow tool itself is deferred
|
|
41
41
|
* (deferTools, wire schema withheld until activation), shipping the full ~5.7K how-to alongside
|
|
42
42
|
* defeats the deferral's cache-prefix point. One honest pointer replaces it.
|
|
43
43
|
*
|
|
@@ -3,7 +3,7 @@ import { type TaskListStore } from "../tools/task-list.js";
|
|
|
3
3
|
import { type SubagentToolOptions } from "../agents/subagent.js";
|
|
4
4
|
import type { ToolSpec, RoleSpec } from "../core/types.js";
|
|
5
5
|
/**
|
|
6
|
-
* design/102 (K-8)
|
|
6
|
+
* design/102 (K-8) rename (`autonomous` scenario → `code`; the "full-body" working name followed —
|
|
7
7
|
* this bundle IS the `code` scenario's caller-composed tool half; file name kept for history). Config for
|
|
8
8
|
* the code-scenario `spec.tools`-class bundle. The RICH seam-gated roster
|
|
9
9
|
* (present_plan/skill/AskUserQuestion/LSP/hands/memory/run_workflow/tool_search) is NOT here — it auto-mounts in
|
|
@@ -17,7 +17,7 @@ export interface CodeToolsConfig {
|
|
|
17
17
|
/** WebSearch backend (BRAIN/model-service leg). Absent ⇒ WebSearch is not assembled (core ships no backend). */
|
|
18
18
|
webSearch?: WebSearchConfig;
|
|
19
19
|
/** Subagent delegation. Present ⇒ assembled; child rosters are ⊆ parent via `resolveToolSubset` inside the tool.
|
|
20
|
-
*
|
|
20
|
+
* 合车复审修③: when this carries NO explicit `systemPrompt`, the assembler defaults it to
|
|
21
21
|
* `CODE_SYSTEM_PROMPT` — a code-scenario child holds Bash/Write side-effect tools, so it keeps the code
|
|
22
22
|
* constitution (snapshot-before-mutate / destructive-op care / git discipline) instead of falling to the
|
|
23
23
|
* lean SUBAGENT_PROMPT (the G1 default, which is the right upstream-anchor shape only for bare
|
|
@@ -53,7 +53,7 @@ export interface CodeToolsConfig {
|
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* Single-source bundle of the `code` scenario's `spec.tools`-class tools, so each deployment doesn't re-wire it
|
|
56
|
-
* (
|
|
56
|
+
* (the single-source discipline; mirrors the blessed `SCENARIO_REGISTRY` "data (named bundles)" precedent).
|
|
57
57
|
* Profile-as-data — the engine iterates `spec.tools` branch-free; nothing keys off the scenario name. A trusted
|
|
58
58
|
* assembler (service) calls this, sets `systemPrompt = CODE_SYSTEM_PROMPT` (or `role = CODE_ROLE`) +
|
|
59
59
|
* `enablePlanMode:true`, and wires the deps seams (executionEnv/onQuestion/lspManager/skillSpecs/memoryStore/
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* deploy-side knowledge — core fills guard-number defaults + prompts + orchestrator choice, never the model.
|
|
13
13
|
*/
|
|
14
14
|
import type { Runner } from "../core/runner/runtask.js";
|
|
15
|
-
import type { ModelRef, ModelRole } from "../core/types.js";
|
|
15
|
+
import type { ModelRef, ModelRole, TaskSpec } from "../core/types.js";
|
|
16
16
|
import { type TeamResult } from "../agents/team.js";
|
|
17
17
|
import { type VerificationResult } from "../agents/verify.js";
|
|
18
18
|
/** Design review: falsification-style multi-role debate (architect / reviewer / implementer). Reuses team.ts's
|
|
@@ -53,7 +53,7 @@ export interface ScenarioProfile {
|
|
|
53
53
|
layer: "🟢现有编排器套壳" | "🔴需新循环骨架";
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
|
-
* core's preset scenario registry (
|
|
56
|
+
* core's preset scenario registry (裁定: core ships preset profiles). This is **data** (named bundles),
|
|
57
57
|
* not a mechanism — each entry maps to one existing orchestrator + prompts + guard defaults.
|
|
58
58
|
*/
|
|
59
59
|
export declare const SCENARIO_REGISTRY: Record<ScenarioId, ScenarioProfile>;
|
|
@@ -75,6 +75,10 @@ export interface RunScenarioOptions {
|
|
|
75
75
|
reviewerCount?: number;
|
|
76
76
|
/** External cancellation propagated into the orchestrator. */
|
|
77
77
|
signal?: AbortSignal;
|
|
78
|
+
/** Per-model auth — MIRRORS {@link TaskSpec.getApiKeyAndHeaders}; forwarded into whichever
|
|
79
|
+
* orchestrator the scenario maps to (solo task / team runs / verify judge), which resolve it
|
|
80
|
+
* against their own resolved models. Absent ⇒ byte-identical specs (no key added). */
|
|
81
|
+
getApiKeyAndHeaders?: TaskSpec["getApiKeyAndHeaders"];
|
|
78
82
|
}
|
|
79
83
|
/** Per-scenario result union — each entry returns its orchestrator's native result shape. */
|
|
80
84
|
export type RunScenarioResult = {
|
|
@@ -61,7 +61,7 @@ export async function runScenario(opts) {
|
|
|
61
61
|
switch (profile.orchestrator) {
|
|
62
62
|
case "solo": {
|
|
63
63
|
const model = requireModel(opts.models, "default", opts.scenario);
|
|
64
|
-
const spec = { objective: opts.objective, model, signal: opts.signal };
|
|
64
|
+
const spec = { objective: opts.objective, model, signal: opts.signal, ...(opts.getApiKeyAndHeaders !== undefined ? { getApiKeyAndHeaders: opts.getApiKeyAndHeaders } : {}) };
|
|
65
65
|
return { scenario: "solo", result: await opts.runner.runTask(spec) };
|
|
66
66
|
}
|
|
67
67
|
case "team": {
|
|
@@ -81,6 +81,7 @@ export async function runScenario(opts) {
|
|
|
81
81
|
],
|
|
82
82
|
synthesizer: { model: synthModel },
|
|
83
83
|
signal: opts.signal,
|
|
84
|
+
...(opts.getApiKeyAndHeaders !== undefined ? { getApiKeyAndHeaders: opts.getApiKeyAndHeaders } : {}),
|
|
84
85
|
});
|
|
85
86
|
return { scenario: "design-review", result };
|
|
86
87
|
}
|
|
@@ -95,6 +96,7 @@ export async function runScenario(opts) {
|
|
|
95
96
|
members: codeReviewMembers(opts.reviewerCount ?? 2, teamModel),
|
|
96
97
|
synthesizer: { model: synthModel },
|
|
97
98
|
signal: opts.signal,
|
|
99
|
+
...(opts.getApiKeyAndHeaders !== undefined ? { getApiKeyAndHeaders: opts.getApiKeyAndHeaders } : {}),
|
|
98
100
|
});
|
|
99
101
|
return { scenario: "code-review", mode: "team", result };
|
|
100
102
|
}
|
|
@@ -127,7 +129,7 @@ async function runCodeReviewVerify(opts) {
|
|
|
127
129
|
result: opts.objective,
|
|
128
130
|
stats: { turns: 0, tokens: 0 },
|
|
129
131
|
};
|
|
130
|
-
const specBase = { signal: opts.signal };
|
|
132
|
+
const specBase = { signal: opts.signal, ...(opts.getApiKeyAndHeaders !== undefined ? { getApiKeyAndHeaders: opts.getApiKeyAndHeaders } : {}) };
|
|
131
133
|
const result = await verifyCompleted(opts.runner, reviewed, specBase, opts.objective, {
|
|
132
134
|
verifierModel,
|
|
133
135
|
verifierPrompt: STATIC_VERIFICATION_PROMPT,
|
|
@@ -6,12 +6,12 @@ import type { Message } from "../../internal/llm.js";
|
|
|
6
6
|
* handover) can enumerate the teammates' transcript sidecars and project them into sema message
|
|
7
7
|
* shapes for resume context.
|
|
8
8
|
*
|
|
9
|
-
* D-2 ruling (
|
|
9
|
+
* D-2 ruling (design/152 §3): the sidecar is CC→sema ONE-WAY. sema's transcript truth source
|
|
10
10
|
* is the SessionStore — this module never writes, and nothing here mints a second truth source
|
|
11
11
|
* (the dual-truth-source pathology design/151 just eliminated stays eliminated). Dual-write is a
|
|
12
12
|
* separate ruling gated on a real user need.
|
|
13
13
|
*
|
|
14
|
-
* Disk shape (
|
|
14
|
+
* Disk shape (cc-teams-diskform README):
|
|
15
15
|
* - flat sidecars: `subagents/agent-<id>.jsonl`
|
|
16
16
|
* - nested children: `subagents/<parentSeg>/agent-<id>.jsonl` (parent-segment subdirectories)
|
|
17
17
|
* - workflow runs: `subagents/workflows/<runId>/agent-<t>.jsonl`
|
|
@@ -53,7 +53,7 @@ export interface CcSidecarHandle {
|
|
|
53
53
|
* Enumerate every transcript sidecar under a CC `subagents/` directory, walking nested
|
|
54
54
|
* parent-segment subdirectories (symlinks not followed). Missing directory ⇒ `[]` — the CC tree is
|
|
55
55
|
* a PARTIAL tree (headless runs write sidecars but a REPL-only subtree may be absent entirely), so
|
|
56
|
-
* absence is a normal state, never a throw
|
|
56
|
+
* absence is a normal state, never a throw.
|
|
57
57
|
* Order is deterministic: lexicographic by (segments join, agentId).
|
|
58
58
|
*/
|
|
59
59
|
export declare function listCcSidecarAgents(subagentsDir: string): CcSidecarHandle[];
|
|
@@ -19,7 +19,7 @@ export declare function resolveDataRoot(explicit?: string): string;
|
|
|
19
19
|
/** Ensure a directory exists with 0o700 perms (idempotent). */
|
|
20
20
|
/**
|
|
21
21
|
* Atomically CREATE `target` carrying `content` — it appears in ONE step already fully written, no empty/partial
|
|
22
|
-
* window. Fixes the create-then-write race
|
|
22
|
+
* window. Fixes the create-then-write race: a reader/pruner can see a half-written
|
|
23
23
|
* file, and a crash mid-write leaves a zero-byte target a retry would silently keep. Writes a temp in `target`'s
|
|
24
24
|
* OWN dir (same FS → `link` is atomic) + fsync, then `linkSync`-publishes it; throws `EEXIST` if `target` exists.
|
|
25
25
|
*/
|
|
@@ -134,7 +134,7 @@ export declare class AppendLog {
|
|
|
134
134
|
*
|
|
135
135
|
* RB-66 (2026-07-25, red probe): `writeSync(fd, string)` issues ONE write(2) and may SHORT-WRITE — the
|
|
136
136
|
* same defect class this file's own `writeThenLink` already documents and fixed ("silently SHORT-WRITES
|
|
137
|
-
*
|
|
137
|
+
* "), never propagated to this shared primitive. A short write here leaves a torn
|
|
138
138
|
* line with no trailing newline, so the NEXT append concatenates onto it and replay drops BOTH records.
|
|
139
139
|
* Loop until every byte lands (write(2) returns how many it took) — the O_APPEND atomicity per call is
|
|
140
140
|
* unchanged, and a genuine I/O error still throws.
|
|
@@ -127,7 +127,7 @@ export declare class FileStorageBackend {
|
|
|
127
127
|
* `RunnerDeps.fileSnapshotStore`. Content-addressed blobs persist across restarts (local-only; a remote env
|
|
128
128
|
* defers rewind to its own VM-snapshot backend). */
|
|
129
129
|
readonly fileSnapshotStore: FileSnapshotStore;
|
|
130
|
-
/** SVC-2
|
|
130
|
+
/** SVC-2 (onboarded per) — file-backed durable workflow resume journal. Wire into
|
|
131
131
|
* `RunnerDeps.workflowJournalStore` so `resumeFromRunId` survives a process restart on a TOC box. */
|
|
132
132
|
readonly workflowJournalStore: WorkflowJournalStore;
|
|
133
133
|
/** design/164 件五 — file-backed cross-task usage-governance ledger. Wire into
|
|
@@ -71,11 +71,11 @@ export declare class FileSessionRepo implements SessionRepo {
|
|
|
71
71
|
placementOf(sessionId: string): Promise<SessionPlacementRecord | undefined>;
|
|
72
72
|
delete(metadata: SessionMetadata): Promise<void>;
|
|
73
73
|
fork(sourceMetadata: SessionMetadata, options?: SessionForkOptions): Promise<Session>;
|
|
74
|
-
/** 2c session-sync (
|
|
74
|
+
/** 2c session-sync (the FILE half): the FULL oldest-first log for export. The file backend
|
|
75
75
|
* has NO F3 floor — `read` returns EVERY persisted entry (`id`/`parentId` verbatim) — so this is the complete
|
|
76
76
|
* log, BYPASSing any bounded tail (matches `InMemorySessionRepo.exportEntries`). Missing file → not_found. */
|
|
77
77
|
exportEntries(sessionId: string): Promise<SessionTreeEntry[]>;
|
|
78
|
-
/** 2c session-sync
|
|
78
|
+
/** 2c session-sync: import a verbatim log into `sessionId`. The single fail-closed invariant gate runs
|
|
79
79
|
* FIRST ({@link validateEntriesForImport}); `owner` is a durable multi-tenant concept the local file backend
|
|
80
80
|
* has no field for (accepted, unused — same as `InMemorySessionRepo`). Writes the WHOLE file (meta + entries)
|
|
81
81
|
* atomically via tmp→fsync→rename — the rename is the commit point, so a crash leaves either nothing or an
|
|
@@ -70,7 +70,7 @@ export declare class FileWorkflowJournalStore implements WorkflowJournalStore {
|
|
|
70
70
|
private get scopes();
|
|
71
71
|
constructor(root: string, fsyncEnabled?: boolean);
|
|
72
72
|
private pathFor;
|
|
73
|
-
/**
|
|
73
|
+
/** CC local form: the run's on-disk journal path for the notification diagnostics line.
|
|
74
74
|
* Traversal-shaped ids (LLM-controlled on some paths) degrade to undefined, never throw. */
|
|
75
75
|
locator(runId: string): string | undefined;
|
|
76
76
|
/** Replay a run's ledger: last-writer-wins per ordinal; a torn/unparsable line is skipped (uncommitted). */
|
|
@@ -78,7 +78,7 @@ export declare class FileWorkflowJournalStore implements WorkflowJournalStore {
|
|
|
78
78
|
append(runId: string, scope: string, entry: WorkflowJournalEntry): Promise<void>;
|
|
79
79
|
load(runId: string, scope: string): Promise<WorkflowJournalEntry[]>;
|
|
80
80
|
/**
|
|
81
|
-
* RB-242 — the claim file for `(sourceRunId, scope)`. Keyed by BOTH
|
|
81
|
+
* RB-242 — the claim file for `(sourceRunId, scope)`. Keyed by BOTH: a cross-scope caller already
|
|
82
82
|
* resolves to an empty journal (it cannot fork anything), so letting it share one claim key would only hand
|
|
83
83
|
* any tenant a denial-of-resume lever over another's runs. The scope is folded in as a digest rather than
|
|
84
84
|
* a sanitized literal so two distinct scopes can never collapse onto one filename by sanitization.
|
|
@@ -111,7 +111,7 @@ export declare class FileWorkflowJournalStore implements WorkflowJournalStore {
|
|
|
111
111
|
*/
|
|
112
112
|
private sweepExpiredClaims;
|
|
113
113
|
/**
|
|
114
|
-
* RB-242
|
|
114
|
+
* RB-242 — admission for a resume off `sourceRunId`. The LOCAL (TOC) twin of the SQL-backed
|
|
115
115
|
* `idem_key UNIQUE` + TTL: publishing the claim file is one atomic namespace operation that fails EEXIST
|
|
116
116
|
* against anyone who got there first, so two processes racing on the same box (the shape the in-process
|
|
117
117
|
* `startWorkflow` guards cannot see — a shell restart resuming a run a still-live process is already
|
|
@@ -121,7 +121,7 @@ export declare class FileWorkflowJournalStore implements WorkflowJournalStore {
|
|
|
121
121
|
granted: boolean;
|
|
122
122
|
holder?: string;
|
|
123
123
|
}>;
|
|
124
|
-
/** RB-242
|
|
124
|
+
/** RB-242 — release ONLY a claim this `newRunId` still holds. A claim that is already gone (TTL-reaped
|
|
125
125
|
* and possibly taken over) is a no-op: unlinking a successor's claim would re-open the very fork this prevents. */
|
|
126
126
|
releaseResumeClaim(input: ResumeClaimArgs): Promise<void>;
|
|
127
127
|
/** GC (service extra, mirrors the SQL twins): drop the run's ledger once the run is terminal + retained. */
|
|
@@ -415,7 +415,7 @@ export declare const POLL_LOOP_MAX_SLEEP_SECONDS = 600;
|
|
|
415
415
|
* no-egress envelope — every beat still runs allowlisted readers + literal `sleep`), and the
|
|
416
416
|
* walltime axis cascades a hard kill regardless. A deployment wanting NO command-substitution at
|
|
417
417
|
* all can prefer `{<lo>..<hi>}` or a literal list, which bash expands internally with no command
|
|
418
|
-
* run. (
|
|
418
|
+
* run. (falsification review flagged the substitution as [high] and recommended dropping it;
|
|
419
419
|
* kept per the ruling that names `$(seq <int> <int>)` as the one exemption — recorded for a
|
|
420
420
|
* tightening decision, since the brace form is a drop-in equivalent.)
|
|
421
421
|
* · STDIN-BLOCKING BODY (an availability residual, not a safety one). CLOSED for the shape this note
|
|
@@ -33,7 +33,7 @@ export interface DecodedTextFile {
|
|
|
33
33
|
encoding: DetectedFileEncoding;
|
|
34
34
|
/** Dominant line ending of the ORIGINAL bytes (majority vote — CC `CKt` @58184 同算法).
|
|
35
35
|
* Deliberately NOT per-line lossless: a mixed-endings file is unified to the dominant ending on
|
|
36
|
-
* the first edit (
|
|
36
|
+
* the first edit (镜头1/2 LOW, accepted non-goal — CC behaves the same way).
|
|
37
37
|
* RB-285 (encoding LOW): the COUNTING RULE is CC's; the SAMPLE is not. CC votes on the first 4096
|
|
38
38
|
* characters only (`CKt(s.slice(0, 4096))` @58201) while {@link detectLineEndings} below votes on
|
|
39
39
|
* the whole file — so a file whose first 4KB is LF and whose bulk is CRLF gets opposite verdicts.
|
|
@@ -41,7 +41,7 @@ export interface DecodedTextFile {
|
|
|
41
41
|
* the entire file, so sampling a prefix is exactly the case where the cheap answer flips the
|
|
42
42
|
* remaining 99% of the lines. Registered as a deliberate delta, not parity. */
|
|
43
43
|
endings: DetectedLineEndings;
|
|
44
|
-
/**
|
|
44
|
+
/** 双镜头 MED: a utf16le body with an ODD byte count is TRUNCATED/corrupt — decoding would
|
|
45
45
|
* silently drop the dangling byte and a later write-back would destroy it permanently. Flagged so
|
|
46
46
|
* the tool layer fails closed instead of "repairing" the file. */
|
|
47
47
|
malformed?: true;
|
|
@@ -65,7 +65,7 @@ export declare function encodeTextForFile(text: string, encoding: DetectedFileEn
|
|
|
65
65
|
* Deliberately does NOT strip a leading U+FEFF: an `old_string` starting with one may be quoting
|
|
66
66
|
* genuine file content — use {@link normalizeFileText} only where the string stands for a whole file. */
|
|
67
67
|
export declare function normalizeEditText(s: string): string;
|
|
68
|
-
/** RB-222
|
|
68
|
+
/** RB-222 — split a leading U+FEFF off MODEL-SUPPLIED whole-file text (CC `CTe` parity,
|
|
69
69
|
* 220 @365630). The BOM is a file-level byte marker, not text: decodeTextBytes strips it on the way
|
|
70
70
|
* in, so it can never live in the normalized coordinate. Only for strings that stand for a WHOLE
|
|
71
71
|
* file (Write `content`, readFileState seeding) — a decoded file text's leading U+FEFF is genuine
|
|
@@ -74,7 +74,7 @@ export declare function splitLeadingBom(text: string): {
|
|
|
74
74
|
hadBom: boolean;
|
|
75
75
|
text: string;
|
|
76
76
|
};
|
|
77
|
-
/** RB-222
|
|
77
|
+
/** RB-222 — CC `X9` parity (220 @365635 = BOM-strip + CRLF-normalize): THE coordinate
|
|
78
78
|
* every readFileState hash lives in (Read/Edit/Write staleness all hash `decodeTextBytes(...).text`).
|
|
79
79
|
* A hash taken on raw model content with a leading U+FEFF can never agree with any later re-read. */
|
|
80
80
|
export declare function normalizeFileText(s: string): string;
|
|
@@ -126,11 +126,11 @@ export declare function createBashTool(env: ExecutionEnv, rootCanonical: string,
|
|
|
126
126
|
* unconfined; passing this never gates anything.
|
|
127
127
|
*/
|
|
128
128
|
additionalRoots?: readonly string[];
|
|
129
|
-
/** RB-370 ② (cli
|
|
129
|
+
/** RB-370 ② (cli): override of the `timeout` parameter's DEFAULT budget, in ms — see
|
|
130
130
|
* {@link import("./index.js").HandsToolkitOptions.bashDefaultTimeoutMs} for the resolution
|
|
131
131
|
* contract (options over env over constant; invalid values discarded). */
|
|
132
132
|
bashDefaultTimeoutMs?: number;
|
|
133
|
-
/** RB-370 ② (cli
|
|
133
|
+
/** RB-370 ② (cli): override of the `timeout` parameter's engine CEILING, in ms — only-widen
|
|
134
134
|
* vs the resolved default; see {@link import("./index.js").HandsToolkitOptions.bashMaxTimeoutMs}. */
|
|
135
135
|
bashMaxTimeoutMs?: number;
|
|
136
136
|
/** Structured sink for this leg's timeout-cap discard announcements — consumed by
|
|
@@ -167,7 +167,7 @@ export declare function createBashTool(env: ExecutionEnv, rootCanonical: string,
|
|
|
167
167
|
* the operand cannot be resolved statically (there is nothing to degrade to).
|
|
168
168
|
*/
|
|
169
169
|
export declare function createBashReadonlyTool(env: ExecutionEnv, rootCanonical: string, allow: ReadonlySet<string>, opts?: {
|
|
170
|
-
/** RB-370 ② (cli
|
|
170
|
+
/** RB-370 ② (cli): same timeout-cap overrides the full `bash` leg takes — see
|
|
171
171
|
* {@link import("./index.js").HandsToolkitOptions.bashDefaultTimeoutMs} /
|
|
172
172
|
* {@link import("./index.js").HandsToolkitOptions.bashMaxTimeoutMs} (类修完整域: both foreground
|
|
173
173
|
* legs share runShell's clamp, so both must share the configurable resolution). */
|
|
@@ -34,7 +34,7 @@ type ReadPdfReturn = string | {
|
|
|
34
34
|
* it was not — every `document` card, sized or not, was dropped at the gate, making the 48K rule dead
|
|
35
35
|
* code and the pages/fallback-level disclosure invisible to a host. The word is registered now.
|
|
36
36
|
*
|
|
37
|
-
* Degradation chain v2 (
|
|
37
|
+
* Degradation chain v2 (裁定: the brain-level placeholder is NOT the end state): when the SERVING model
|
|
38
38
|
* cannot take a native document block (`caps.document === false` — e.g. any openai-compatible API), the
|
|
39
39
|
* whole-PDF path degrades IN THE TOOL (the only layer holding env.exec), best first:
|
|
40
40
|
* 1. `pdftotext -layout` text extraction → the content arrives as TEXT (Read byte-cap discipline applies);
|
|
@@ -65,7 +65,7 @@ export declare function truncatedUtf16BodyMessage(tool: string, path: string): s
|
|
|
65
65
|
/** Why a bash_readonly refusal is terminal rather than escalated. Appended by every arm of that refusal
|
|
66
66
|
* family; the arms differ in what they found, never in what the model can do about it. */
|
|
67
67
|
export declare const BASH_READONLY_CONFINEMENT_NOTE = "bash_readonly is confined to the workspace roots; it has no approval path, so the call is refused rather than escalated.";
|
|
68
|
-
/** RB-222
|
|
68
|
+
/** RB-222 r3 — the readFileState hash coordinate for a file that was JUST WRITTEN via
|
|
69
69
|
* `encodeTextForFile`: decode the EXACT payload handed to `env.writeFile`, i.e. what the next
|
|
70
70
|
* re-read's `decodeTextBytes` will produce. A blanket `normalizeFileText` is WRONG on the
|
|
71
71
|
* encode-preserving Edit lanes: a leading U+FEFF in the new text is stripped by the next read only
|
|
@@ -209,7 +209,7 @@ export declare function bashTimeoutArgRefusal(timeoutMs: number | undefined, cap
|
|
|
209
209
|
maxMs: number;
|
|
210
210
|
}): string | undefined;
|
|
211
211
|
/**
|
|
212
|
-
* RB-370 ②/③
|
|
212
|
+
* RB-370 ②/③ — the SINGLE authority for the Bash `timeout` parameter's two numbers:
|
|
213
213
|
* the default budget applied when the model omits `timeout`, and the engine ceiling requests are
|
|
214
214
|
* clamped to. The 120s/600s constants themselves are CC 220-same; what CC additionally has — and this
|
|
215
215
|
* resolver adds — is configurability.
|
|
@@ -223,7 +223,7 @@ export declare function bashTimeoutArgRefusal(timeoutMs: number | undefined, cap
|
|
|
223
223
|
* default floors the cap. Invalid values (non-finite / <= 0) are discarded at every leg, options
|
|
224
224
|
* included, exactly like CC's env read.
|
|
225
225
|
*
|
|
226
|
-
* ③ Readable seam
|
|
226
|
+
* ③ Readable seam: a shell/host rendering its OWN copy of the Bash tool description MUST
|
|
227
227
|
* read the true values from here instead of holding a sibling constant — the engine's description/param
|
|
228
228
|
* text and its runtime clamp both interpolate this function's output (resolved once per tool instance),
|
|
229
229
|
* so a self-held "600s" only matches by coincidence and forks silently the moment a deployment
|
|
@@ -271,7 +271,7 @@ export declare function clipShellOutput(s: string): string;
|
|
|
271
271
|
* ALREADY fully in memory here (the env delivered them whole — only `clipShellOutput` above decides how
|
|
272
272
|
* much of that the model's turn actually sees) — the gap this closes is that the omitted middle was
|
|
273
273
|
* simply discarded, forcing a blind full re-run to recover output that was, in fact, captured. "Whole"
|
|
274
|
-
* means whatever THIS layer received, not a guarantee about what the process originally wrote (
|
|
274
|
+
* means whatever THIS layer received, not a guarantee about what the process originally wrote (
|
|
275
275
|
* review P1): the env's own rolling-tail cap (`MAX_EXEC_OUTPUT_BYTES`, exec-output-tail.ts) can already
|
|
276
276
|
* have dropped the head before delivery on a truly enormous single command — this file is a faithful copy
|
|
277
277
|
* of the received bytes either way, and still carries that cap's own `markTruncated()` marker when it
|
|
@@ -379,7 +379,7 @@ export declare function countLines(s: string): number;
|
|
|
379
379
|
* home and carries the session mark when one is threaded (the recorded wire-form divergence). */
|
|
380
380
|
export declare function seededFileUnchangedReminder(filePath: string, mark?: string): string;
|
|
381
381
|
/**
|
|
382
|
-
* RB-197②(
|
|
382
|
+
* RB-197②(交叉复审命中,已修) — true when `resultText` is one of the Read tool's TWO dedup
|
|
383
383
|
* markers (the ordinary unchanged-since-last-read stub below, or {@link seededFileUnchangedReminder})
|
|
384
384
|
* rather than a genuine content transmission. A consumer deciding "is this file's real content
|
|
385
385
|
* present in THIS message" (e.g. auto-compaction's kept-tail visibility scan) must treat a stub hit
|
|
@@ -431,7 +431,7 @@ export declare function seedReadFileStateFromTranscript(state: ReadFileState, ke
|
|
|
431
431
|
* The read-before-edit gate tightens as a consequence, matching CC: after a compaction the model must
|
|
432
432
|
* re-Read a summarized-away file before editing it, instead of blind-editing from a stale recollection.
|
|
433
433
|
*
|
|
434
|
-
* RB-197②(独立复审 +
|
|
434
|
+
* RB-197②(独立复审 + 命中,已修): a THIRD category besides seeded/re-attached — a file whose most
|
|
435
435
|
* recent Read is still visible verbatim in the compaction's KEPT tail is deliberately left OUT of
|
|
436
436
|
* `attachedComplete` (re-attaching it would just duplicate content already in context), but its
|
|
437
437
|
* existing read-state entry must survive unmodified for the SAME reason a seeded entry does: the
|
package/dist/tools/fs/index.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ export interface HandsToolkitOptions {
|
|
|
63
63
|
}) => void;
|
|
64
64
|
/** design/116 detach: the run-local per-tool-call detach hub (mid-flight ctrl+b → adopt as background). */
|
|
65
65
|
detachHub?: import("../../core/tool-detach.js").ToolDetachHub;
|
|
66
|
-
/** RB-370 ② (cli
|
|
66
|
+
/** RB-370 ② (cli): the Bash `timeout` parameter's DEFAULT budget, in ms — applied when the
|
|
67
67
|
* model omits `timeout`. Resolution (options over env over constant — the standing sema discipline:
|
|
68
68
|
* deployments configure the tool, not the process): this field ?? env `BASH_DEFAULT_TIMEOUT_MS` ??
|
|
69
69
|
* 120000; invalid (non-finite / <= 0) values are discarded at every leg. See
|
|
@@ -71,7 +71,7 @@ export interface HandsToolkitOptions {
|
|
|
71
71
|
* description, so the advertised numbers always match the enforced ones. Additive: absent ⇒
|
|
72
72
|
* byte-compat 120s. Applies to both shell legs (`bash` and `bash_readonly`). */
|
|
73
73
|
bashDefaultTimeoutMs?: number;
|
|
74
|
-
/** RB-370 ② (cli
|
|
74
|
+
/** RB-370 ② (cli): the Bash `timeout` parameter's engine CEILING, in ms — requests above it
|
|
75
75
|
* are clamped (with the RB-370 requested/capped disclosure naming THIS value). Resolution: (this
|
|
76
76
|
* field ?? env `BASH_MAX_TIMEOUT_MS` ?? 600000), then floored at the resolved default — CC's own
|
|
77
77
|
* only-widen semantic: a ceiling below the default is a narrowing intent = invalid, ignored in
|
package/dist/tools/fs/index.js
CHANGED
|
@@ -79,7 +79,14 @@ export function createHandsToolkit(env, readFileState, rootCanonical, opts = {})
|
|
|
79
79
|
if (!readOnly && mountBackgroundTaskTools && hasBackgroundShell(env)) {
|
|
80
80
|
const sessionAxis = opts.sessionId !== undefined ? { sessionId: opts.sessionId } : {};
|
|
81
81
|
tools.push(opts.taskRegistry
|
|
82
|
-
? createTaskOutputTool({
|
|
82
|
+
? createTaskOutputTool({
|
|
83
|
+
registry: opts.taskRegistry,
|
|
84
|
+
owner: opts.taskOwner,
|
|
85
|
+
scope: opts.taskScope,
|
|
86
|
+
...sessionAxis,
|
|
87
|
+
...(opts.oneShot !== undefined ? { oneShot: opts.oneShot } : {}),
|
|
88
|
+
notificationWired: opts.taskNotification !== undefined,
|
|
89
|
+
})
|
|
83
90
|
: createEnvTaskOutputTool(env), opts.taskRegistry
|
|
84
91
|
? createTaskStopTool({ registry: opts.taskRegistry, owner: opts.taskOwner, scope: opts.taskScope, ...sessionAxis })
|
|
85
92
|
: createEnvTaskStopTool(env));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ImageContent } from "../../internal/llm.js";
|
|
2
2
|
/**
|
|
3
|
-
* RB-227
|
|
3
|
+
* RB-227 — the Read tool's Jupyter-notebook projection: `.ipynb` is rendered as cells
|
|
4
4
|
* with outputs (CC 2.1.220 parity: `Ctd`/`wtd`/`Zx_`/`Qx_`/`eI_`/`tI_`/`Atd`, pretty220.js
|
|
5
5
|
* :371265-:371426), never as raw JSON text. The raw-JSON rendering let a notebook's base64 outputs
|
|
6
6
|
* overflow the Read token cap, auto-paginate into an `isPartialView` entry, and thereby lock
|
package/dist/tools/fs/pdf.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* PDF read pipeline (
|
|
2
|
+
* PDF read pipeline (+ 审计 — CC FileReadTool parity).
|
|
3
3
|
*
|
|
4
4
|
* CC ground truth (original-source-code, 取证 2026-07-07):
|
|
5
5
|
* - Whole-PDF path (`FileReadTool.ts:987-1016` + `utils/pdf.ts:88-103`): the file bytes are base64'd and
|