@sema-agent/core 7.69.0 → 7.69.1
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 +583 -0
- package/dist/agents/repair-loop.js +6 -14
- package/dist/agents/subagent.js +2 -1
- package/dist/agents/verify.d.ts +1 -1
- package/dist/agents/verify.js +7 -1
- package/dist/brain/reasoning-request.d.ts +7 -0
- package/dist/brain/reasoning-request.js +6 -0
- package/dist/core/agent-config-dir.d.ts +39 -3
- package/dist/core/agent-config-dir.js +67 -11
- package/dist/core/allow-entry.d.ts +5 -5
- package/dist/core/allow-entry.js +12 -6
- package/dist/core/ask-headline.d.ts +2 -2
- package/dist/core/ask-origin.d.ts +31 -31
- package/dist/core/ask-origin.js +20 -13
- package/dist/core/attachment-source.d.ts +1 -1
- package/dist/core/attachment-source.js +1 -0
- package/dist/core/auto-compaction.d.ts +44 -62
- package/dist/core/auto-compaction.js +44 -103
- package/dist/core/cache-break-detector.d.ts +23 -11
- package/dist/core/cache-break-detector.js +11 -5
- package/dist/core/checkpoint-features.d.ts +1 -1
- package/dist/core/checkpoint-features.js +1 -1
- package/dist/core/checkpoint-requirements.d.ts +19 -1
- package/dist/core/checkpoint-requirements.js +6 -0
- package/dist/core/checkpoint-row-verdict.js +3 -0
- package/dist/core/checkpoint-store.d.ts +13 -2
- package/dist/core/child-clamp-seats.d.ts +30 -3
- package/dist/core/child-clamp-seats.js +24 -0
- package/dist/core/compaction-retired-members.d.ts +12 -0
- package/dist/core/compaction-retired-members.js +22 -0
- package/dist/core/config-refusal-codes.d.ts +1 -1
- package/dist/core/config-refusal-codes.js +2 -0
- package/dist/core/context-edit.d.ts +32 -17
- package/dist/core/context-edit.js +28 -0
- package/dist/core/cron.d.ts +68 -0
- package/dist/core/cron.js +259 -0
- package/dist/core/engine-attestation.d.ts +16 -0
- package/dist/core/engine-attestation.js +2 -0
- package/dist/core/engine-capabilities.d.ts +14 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +18 -7
- package/dist/core/engine-version.js +1 -1
- package/dist/core/gate-outcome.d.ts +29 -2
- package/dist/core/gate-outcome.js +6 -0
- package/dist/core/git-read-only.d.ts +10 -0
- package/dist/core/git-read-only.js +1 -0
- package/dist/core/git-worktree-env.js +9 -8
- package/dist/core/governance-codes.d.ts +9 -2
- package/dist/core/governance-codes.js +9 -0
- package/dist/core/locked-config.js +7 -3
- package/dist/core/lsp.d.ts +3 -0
- package/dist/core/lsp.js +3 -2
- package/dist/core/memory-engine/engine.d.ts +48 -12
- package/dist/core/memory-engine/engine.js +108 -46
- package/dist/core/memory-engine/file-backend.d.ts +2 -1
- package/dist/core/memory-engine/index-copies.d.ts +47 -0
- package/dist/core/memory-engine/index-copies.js +88 -0
- package/dist/core/memory-engine/layout.d.ts +20 -3
- package/dist/core/memory-engine/layout.js +39 -3
- package/dist/core/memory-engine/origin-clearance.d.ts +9 -7
- package/dist/core/memory-engine/origin-clearance.js +2 -4
- package/dist/core/memory-engine/types.d.ts +16 -3
- package/dist/core/mode-policy.d.ts +7 -1
- package/dist/core/mode-policy.js +9 -0
- package/dist/core/mods/session-compact.js +3 -3
- package/dist/core/mods/stations.d.ts +2 -0
- package/dist/core/mods/stations.js +2 -1
- package/dist/core/path-guard-rows.d.ts +8 -3
- package/dist/core/path-guard-rows.js +18 -5
- package/dist/core/peer-seat.d.ts +3 -0
- package/dist/core/peer-seat.js +3 -0
- package/dist/core/permission-rule-model.js +3 -2
- package/dist/core/process-identity.d.ts +11 -3
- package/dist/core/process-identity.js +26 -16
- package/dist/core/runner/assemble-result.d.ts +5 -0
- package/dist/core/runner/assemble-result.js +1 -1
- package/dist/core/runner/cleared-results-record.d.ts +33 -0
- package/dist/core/runner/cleared-results-record.js +56 -0
- package/dist/core/runner/compact-session.js +14 -9
- package/dist/core/runner/compaction-knobs.d.ts +1 -1
- package/dist/core/runner/continuation-gate.js +2 -1
- package/dist/core/runner/continues-from.d.ts +1 -1
- package/dist/core/runner/continues-from.js +1 -1
- package/dist/core/runner/contracts.d.ts +83 -31
- package/dist/core/runner/conversation-segment.d.ts +19 -12
- package/dist/core/runner/conversation-segment.js +27 -7
- package/dist/core/runner/derived-route-fallback.d.ts +2 -12
- package/dist/core/runner/derived-route-fallback.js +0 -6
- package/dist/core/runner/gate-exit.d.ts +2 -1
- package/dist/core/runner/gate-exit.js +4 -2
- package/dist/core/runner/git-status-frame.d.ts +2 -2
- package/dist/core/runner/git-status-frame.js +2 -1
- package/dist/core/runner/initial-run-state.js +1 -1
- package/dist/core/runner/leg-caller-places.d.ts +39 -0
- package/dist/core/runner/leg-caller-places.js +23 -0
- package/dist/core/runner/leg-frame.d.ts +8 -2
- package/dist/core/runner/leg-receipt.d.ts +29 -2
- package/dist/core/runner/leg-receipt.js +37 -6
- package/dist/core/runner/media-removed-seat.d.ts +10 -6
- package/dist/core/runner/media-removed-seat.js +6 -3
- package/dist/core/runner/messages-omitted-seat.d.ts +2 -1
- package/dist/core/runner/messages-omitted-seat.js +15 -5
- package/dist/core/runner/person-path-rows.d.ts +25 -7
- package/dist/core/runner/person-path-rows.js +16 -2
- package/dist/core/runner/prefix-ledger.d.ts +120 -0
- package/dist/core/runner/prefix-ledger.js +176 -0
- package/dist/core/runner/prepare-advisor.d.ts +2 -0
- package/dist/core/runner/prepare-advisor.js +2 -1
- package/dist/core/runner/prepare-artifact.d.ts +3 -0
- package/dist/core/runner/prepare-artifact.js +2 -2
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +2 -0
- package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
- package/dist/core/runner/prepare-config-doors.d.ts +9 -8
- package/dist/core/runner/prepare-config-doors.js +15 -12
- package/dist/core/runner/prepare-context-lane.d.ts +25 -6
- package/dist/core/runner/prepare-context-lane.js +82 -27
- package/dist/core/runner/prepare-gate-stations.d.ts +1 -2
- package/dist/core/runner/prepare-gate-stations.js +2 -4
- package/dist/core/runner/prepare-hands-readface.d.ts +18 -5
- package/dist/core/runner/prepare-hands-readface.js +41 -22
- package/dist/core/runner/prepare-inherited-gate.d.ts +5 -0
- package/dist/core/runner/prepare-inherited-gate.js +2 -0
- package/dist/core/runner/prepare-memory.d.ts +10 -2
- package/dist/core/runner/prepare-memory.js +51 -5
- package/dist/core/runner/prepare-policy-chain.d.ts +3 -0
- package/dist/core/runner/prepare-policy-chain.js +13 -2
- package/dist/core/runner/prepare-prompt-assembly.d.ts +12 -4
- package/dist/core/runner/prepare-prompt-assembly.js +10 -4
- package/dist/core/runner/prepare-prompt-inputs.d.ts +3 -7
- package/dist/core/runner/prepare-prompt-inputs.js +6 -7
- package/dist/core/runner/prepare-safety-scan.js +7 -0
- package/dist/core/runner/prepare-suspend-saga.d.ts +4 -0
- package/dist/core/runner/prepare-suspend-saga.js +3 -2
- package/dist/core/runner/prepare-task.js +59 -53
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +5 -11
- package/dist/core/runner/prepare-tool-disclosure-mount.js +7 -8
- package/dist/core/runner/prepare-turn-wiring.d.ts +16 -25
- package/dist/core/runner/prepare-turn-wiring.js +8 -18
- package/dist/core/runner/prepare-wiring-manifest.d.ts +1 -0
- package/dist/core/runner/prepare-wiring-manifest.js +3 -2
- package/dist/core/runner/prompt-suggestions.d.ts +3 -1
- package/dist/core/runner/prompt-suggestions.js +1 -1
- package/dist/core/runner/read-block-judge.d.ts +47 -0
- package/dist/core/runner/read-block-judge.js +33 -0
- package/dist/core/runner/role-resolution-table.d.ts +15 -10
- package/dist/core/runner/role-resolution-table.js +4 -5
- package/dist/core/runner/rule-store-unreadable-notice.d.ts +7 -4
- package/dist/core/runner/rule-store-unreadable-notice.js +4 -3
- package/dist/core/runner/run-compaction-machinery.d.ts +0 -10
- package/dist/core/runner/run-compaction-machinery.js +3 -39
- package/dist/core/runner/run-harness-handlers.js +4 -17
- package/dist/core/runner/run-identity-wiring.js +4 -1
- package/dist/core/runner/run-leg.js +11 -1
- package/dist/core/runner/run-recovery-lanes.d.ts +0 -4
- package/dist/core/runner/run-recovery-lanes.js +34 -18
- package/dist/core/runner/run-settle-and-teardown.d.ts +1 -3
- package/dist/core/runner/run-settle-and-teardown.js +14 -22
- package/dist/core/runner/run-telemetry-and-budget-seats.js +0 -1
- package/dist/core/runner/run-terminal-adoption.d.ts +11 -30
- package/dist/core/runner/run-terminal-adoption.js +5 -88
- package/dist/core/runner/run-tool-mount-facts.js +1 -5
- package/dist/core/runner/run-turn-boundary.js +56 -26
- package/dist/core/runner/runtask.js +7 -7
- package/dist/core/runner/session-hash-salt.d.ts +18 -0
- package/dist/core/runner/session-hash-salt.js +36 -0
- package/dist/core/runner/shell-env-withheld.d.ts +8 -5
- package/dist/core/runner/shell-env-withheld.js +3 -3
- package/dist/core/runner/side-call-account.d.ts +9 -1
- package/dist/core/runner/side-call-account.js +15 -4
- package/dist/core/runner/skill-mention.d.ts +12 -0
- package/dist/core/runner/skill-mention.js +50 -0
- package/dist/core/runner/stream-settle-backstop.js +1 -0
- package/dist/core/runner/synthetic-tools.js +2 -2
- package/dist/core/runner/tool-table-view.d.ts +5 -9
- package/dist/core/runner/tool-table-view.js +23 -21
- package/dist/core/runner/write-protection-station.d.ts +5 -2
- package/dist/core/runner/write-protection-station.js +1 -1
- package/dist/core/runner-deps.d.ts +25 -27
- package/dist/core/scheduler.d.ts +13 -3
- package/dist/core/scheduler.js +0 -12
- package/dist/core/secret-env.d.ts +47 -11
- package/dist/core/secret-env.js +65 -4
- package/dist/core/sensitive-path-policy.js +4 -0
- package/dist/core/session-checkout.js +10 -9
- package/dist/core/shell-read-silence.d.ts +2 -1
- package/dist/core/shell-run-candidates.d.ts +1 -1
- package/dist/core/shell-run-candidates.js +11 -3
- package/dist/core/task-event.d.ts +32 -10
- package/dist/core/task-intake.d.ts +5 -3
- package/dist/core/task-intake.js +6 -2
- package/dist/core/task-result.d.ts +39 -0
- package/dist/core/task-spec-members.d.ts +3 -0
- package/dist/core/task-spec-members.js +2 -2
- package/dist/core/task-spec.d.ts +37 -20
- package/dist/core/tool-policy.d.ts +30 -18
- package/dist/core/tool-policy.js +44 -32
- package/dist/core/tool-roster.d.ts +21 -7
- package/dist/core/tool-roster.js +34 -6
- package/dist/core/tool-spec-members.js +1 -1
- package/dist/core/tool-spec.d.ts +27 -0
- package/dist/core/tools.js +1 -0
- package/dist/core/trace.d.ts +42 -19
- package/dist/core/unc-spelling.d.ts +31 -0
- package/dist/core/unc-spelling.js +51 -0
- package/dist/core/wiring-manifest.d.ts +30 -3
- package/dist/core/wiring-manifest.js +10 -0
- package/dist/core/workflow-run-store-contract.js +22 -0
- package/dist/core/workflow-run-store.d.ts +17 -13
- package/dist/core/workflow-run-store.js +1 -1
- package/dist/core/write-protect.d.ts +4 -0
- package/dist/core/write-protect.js +17 -15
- package/dist/engine/compaction/compaction.d.ts +48 -98
- package/dist/engine/compaction/compaction.js +136 -216
- package/dist/engine/compaction/utils.d.ts +2 -11
- package/dist/engine/compaction/utils.js +4 -13
- package/dist/engine/execution-env/node-execution-env.js +17 -6
- package/dist/engine/harness/agent-harness.d.ts +19 -5
- package/dist/engine/harness/agent-harness.js +18 -7
- package/dist/engine/harness/types.d.ts +5 -7
- package/dist/engine/loop/agent-loop.d.ts +14 -1
- package/dist/engine/loop/agent-loop.js +31 -11
- package/dist/engine/loop/types.d.ts +8 -2
- package/dist/index.d.ts +9 -6
- package/dist/index.js +8 -6
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +1 -1
- package/dist/internal/harness.js +1 -1
- package/dist/orchestration/run-spec.js +7 -2
- package/dist/orchestration/run-workflow-tool.js +5 -3
- package/dist/orchestration/workflow-park-adoption.d.ts +66 -8
- package/dist/orchestration/workflow-park-adoption.js +195 -45
- package/dist/orchestration/workflow-types.d.ts +20 -0
- package/dist/orchestration/workflow-types.js +1 -0
- package/dist/orchestration/workflow.d.ts +3 -2
- package/dist/orchestration/workflow.js +10 -4
- package/dist/prompt-assembly/catalog/core-behavior.js +6 -0
- package/dist/prompt-assembly/catalog/events.d.ts +8 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/core-behavior.js +6 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/mechanism.js +1 -0
- package/dist/prompt-assembly/catalog/mechanism.d.ts +8 -0
- package/dist/prompt-assembly/catalog/mechanism.js +1 -0
- package/dist/prompt-assembly/catalog/schema.d.ts +1 -1
- package/dist/prompt-assembly/catalog/schema.js +1 -0
- package/dist/prompt-assembly/catalog/sections.js +8 -0
- package/dist/prompt-assembly/event-registry.js +1 -0
- package/dist/prompt-assembly/select.js +1 -0
- package/dist/prompt-assembly/turn-snapshot.d.ts +14 -27
- package/dist/prompt-assembly/turn-snapshot.js +6 -18
- package/dist/prompt-assembly/types.d.ts +3 -0
- package/dist/prompts/default.d.ts +9 -0
- package/dist/prompts/default.js +4 -0
- package/dist/shell/lex.d.ts +75 -11
- package/dist/shell/lex.js +340 -76
- package/dist/tools/fs/bash-program-position.js +2 -6
- package/dist/tools/fs/bash-readonly-classifier.d.ts +18 -3
- package/dist/tools/fs/bash-readonly-classifier.js +19 -9
- package/dist/tools/fs/containment-face.d.ts +12 -3
- package/dist/tools/fs/containment-face.js +16 -7
- package/dist/tools/fs/file-read-check.d.ts +26 -1
- package/dist/tools/fs/file-read-check.js +20 -2
- package/dist/tools/fs/fs-bash.js +4 -4
- package/dist/tools/fs/fs-read.d.ts +3 -0
- package/dist/tools/fs/fs-read.js +2 -2
- package/dist/tools/fs/fs-search-tools.d.ts +2 -2
- package/dist/tools/fs/fs-search-tools.js +4 -4
- package/dist/tools/fs/index.js +5 -3
- package/dist/tools/fs/pdf.js +12 -4
- package/dist/tools/fs/read-deny-home.d.ts +13 -2
- package/dist/tools/fs/read-deny-home.js +26 -22
- package/dist/tools/fs/read-deny.js +15 -6
- package/dist/tools/fs/removal-targets.d.ts +33 -17
- package/dist/tools/fs/removal-targets.js +160 -61
- package/dist/tools/fs/repo-map.d.ts +1 -1
- package/dist/tools/fs/repo-map.js +2 -2
- package/dist/tools/fs/safety.d.ts +28 -5
- package/dist/tools/fs/safety.js +72 -8
- package/dist/tools/fs/shell-read-bindings.d.ts +8 -2
- package/dist/tools/fs/shell-read-bindings.js +25 -6
- package/dist/tools/fs/shell-read-check.d.ts +3 -0
- package/dist/tools/fs/shell-read-check.js +22 -4
- package/dist/tools/fs/shell-read-establish.js +73 -43
- package/dist/tools/fs/shell-read-judge.d.ts +32 -14
- package/dist/tools/fs/shell-read-judge.js +13 -5
- package/dist/tools/fs/shell-read-object-path.d.ts +5 -1
- package/dist/tools/fs/shell-read-object-path.js +17 -4
- package/dist/tools/fs/shell-read-plan.d.ts +8 -2
- package/dist/tools/fs/shell-read-plan.js +36 -22
- package/dist/tools/fs/shell-read-sourced.js +12 -4
- package/dist/tools/fs/shell-read-start.d.ts +4 -2
- package/dist/tools/fs/shell-read-start.js +3 -3
- package/dist/tools/fs/shell-read-workdir.d.ts +14 -6
- package/dist/tools/fs/shell-read-workdir.js +35 -17
- package/dist/tools/scheduler-tools.d.ts +7 -17
- package/dist/tools/scheduler-tools.js +9 -85
- package/dist/tools/worktree.js +5 -4
- package/package.json +3 -2
- package/test/export-surface.snapshot.json +47 -1
- package/wire-changes/core-stores-sql@7.68.6.json +39 -0
- package/wire-changes/core-stores-sql@7.69.1.json +39 -0
- package/wire-changes/core@7.68.6.json +125 -0
- package/wire-changes/core@7.69.1.json +2561 -0
- package/wire-changes/mods-kernel@7.68.6.json +39 -0
- package/wire-changes/mods-kernel@7.69.1.json +39 -0
- package/wire-changes/primitives@7.68.6.json +39 -0
- package/wire-changes/primitives@7.69.1.json +39 -0
- package/wire-changes/wiki-gate@7.68.6.json +39 -0
- package/wire-changes/wiki-gate@7.69.1.json +39 -0
- package/dist/core/runner/prompt-hash-salt.d.ts +0 -1
- package/dist/core/runner/prompt-hash-salt.js +0 -2
|
@@ -206,8 +206,8 @@ export interface RunnerDeps {
|
|
|
206
206
|
* and the external tools' files are not part of the directory and stay anchored at the home. A symlink the root is
|
|
207
207
|
* reached through is followed (the target is guarded too). ABSENT = today's behaviour, the literal `~/.sema` under
|
|
208
208
|
* the declared and account homes. A value that is not a string, is empty or relative, or names no existing directory
|
|
209
|
-
* refuses `new Runner` with `config.agent_config_dir_invalid` — never read as absent.
|
|
210
|
-
*
|
|
209
|
+
* refuses `new Runner` with `config.agent_config_dir_invalid` — never read as absent. Fixed at construction (`swapDeps` does
|
|
210
|
+
* not carry it); the task layer only adds roots beside it ({@link TaskSpec.agentConfigDirs}).
|
|
211
211
|
*/
|
|
212
212
|
agentConfigDir?: string;
|
|
213
213
|
/**
|
|
@@ -1204,8 +1204,8 @@ export interface RunnerDeps {
|
|
|
1204
1204
|
* Optional sink for best-effort background errors/warnings that are otherwise swallowed:
|
|
1205
1205
|
* - `"compaction"` — a compaction failure (F8); a persistently failing one (flaky gateway, empty
|
|
1206
1206
|
* summaries) is invisible without this and lets a session grow until it tops the window.
|
|
1207
|
-
* - `"prompt-cache"` —
|
|
1208
|
-
*
|
|
1207
|
+
* - `"prompt-cache"` — the task-end low hit-rate summary (numbers only), or a mis-declared `promptCacheFamily` (two config
|
|
1208
|
+
* sentences). A located prefix change is the `prefix_changed` task event since 7.69.1, never this phase.
|
|
1209
1209
|
* - `"prompt-constitution"` — a prompt overlay did not take effect as written: a later source (or a later declaration in the same source) superseded
|
|
1210
1210
|
* it on the same target, its target was not in this run's prompt, or a mods handler's `prompt.compose` answer was skipped (it rewrote another's
|
|
1211
1211
|
* overlay, or wrote what the band table does not grant its seat); each overlay is named once per run. The center prompt too: a pinned session's
|
|
@@ -1243,16 +1243,14 @@ export interface RunnerDeps {
|
|
|
1243
1243
|
sessionId: string;
|
|
1244
1244
|
/**
|
|
1245
1245
|
* Machine-readable sub-classification when the site has one (a kebab-case word naming the arm) —
|
|
1246
|
-
* e.g.
|
|
1247
|
-
*
|
|
1248
|
-
*
|
|
1249
|
-
* caches — service[64] flag②); a located change with `expected` was declared (a lawful opening); one without it is an
|
|
1250
|
-
* undeclared prefix change, reported whether or not the cache dropped, and warrants attention.
|
|
1246
|
+
* e.g. the file-history liveness arms (`"file-history-no-store"` / `"file-history-no-env"`, once per Runner: a deployment shape; `"file-history-outside-checkout"`, once per leg: a `TaskSpec.workspace: null` leg outside its session's checkout records no file history; `"file-history-fork-checkout"`, once per session: a fork that works in a tree of its own records and restores no file history). Lets the host
|
|
1247
|
+
* pick its own log level. No `"prompt-cache"` sentence carries one since 7.69.1 (the located-change finding it
|
|
1248
|
+
* classified is the `prefix_changed` task event now).
|
|
1251
1249
|
*/
|
|
1252
1250
|
classification?: string;
|
|
1253
|
-
/**
|
|
1254
|
-
* changed position (a tool index, a rewritten message index). */
|
|
1251
|
+
/** @deprecated Never set since 7.69.1 (its finding is the `prefix_changed` task event); removed in 7.70.0. */
|
|
1255
1252
|
expected?: true;
|
|
1253
|
+
/** @deprecated Never set since 7.69.1 (see `expected`); removed in 7.70.0. */
|
|
1256
1254
|
firstChangedIndex?: number;
|
|
1257
1255
|
}) => void;
|
|
1258
1256
|
/**
|
|
@@ -1331,12 +1329,16 @@ export interface RunnerDeps {
|
|
|
1331
1329
|
*/
|
|
1332
1330
|
toolResultThresholdChars?: number;
|
|
1333
1331
|
/**
|
|
1334
|
-
* design/374 — the microCompact knobs.
|
|
1332
|
+
* design/374 — the microCompact knobs. Defaults: `machine: "off"`, `clearOnRejection: true`.
|
|
1335
1333
|
*
|
|
1336
|
-
* - `machine`: `"
|
|
1337
|
-
*
|
|
1338
|
-
*
|
|
1339
|
-
*
|
|
1334
|
+
* - `machine`: `"off"` (default since 7.69.1: no proactive frontier clearing — the machine gets its
|
|
1335
|
+
* ONE shot at the blocking point instead, the slice-3 arm A, trace trigger `"blocking"`) or `"cc"`
|
|
1336
|
+
* (opt-in: the frontier pass — keep 5, ≥20k minimum-savings gate, one deep clear beyond the keep
|
|
1337
|
+
* window, CC marker bytes — on every request whose estimate reaches the clearing frontier). A
|
|
1338
|
+
* frontier clear rewrites the earliest cleared result's position, so the provider re-reads the
|
|
1339
|
+
* request from there; each clear lands in the session (a later run, a reloaded engine and a fork
|
|
1340
|
+
* replay the same markers) and the next main request declares it (`prefix_changed`, cause
|
|
1341
|
+
* `tool_result_clear`). The vocabulary is
|
|
1340
1342
|
* {@link import("./context-edit.js").MICRO_COMPACT_MACHINES}; the guard chain behind either
|
|
1341
1343
|
* value is the same (blocking-point run → in-turn forced compaction behind the adopt seam →
|
|
1342
1344
|
* trim demoted to the disaster-only last resort), so an under-20k refusal never falls straight
|
|
@@ -1363,9 +1365,10 @@ export interface RunnerDeps {
|
|
|
1363
1365
|
clearOnRejection?: boolean;
|
|
1364
1366
|
};
|
|
1365
1367
|
/**
|
|
1366
|
-
*
|
|
1367
|
-
*
|
|
1368
|
-
*
|
|
1368
|
+
* The session's prefix ledger: each request sent through the Brain seat is read before it leaves (one canonical rendering,
|
|
1369
|
+
* against the session's previous main request of the same model); a main request that does not extend it is the
|
|
1370
|
+
* `prefix_changed` task event, and every `brain.call` row carries the reading (`request`). From the bytes only, never a
|
|
1371
|
+
* cache-read count; linear in the request. Default **on**; `false` turns both off.
|
|
1369
1372
|
*/
|
|
1370
1373
|
cacheBreakDetection?: boolean;
|
|
1371
1374
|
/**
|
|
@@ -1415,19 +1418,14 @@ export interface RunnerDeps {
|
|
|
1415
1418
|
* neither serialized nor durably checkpointed, and the sandbox/env-class injections deliberately sit on
|
|
1416
1419
|
* `RunnerDeps` for the same trust reason). Same placement as `mods` / `executionEnvFactory`.
|
|
1417
1420
|
*
|
|
1418
|
-
* When `summaryProvider` is set,
|
|
1419
|
-
* at task end) consult it: a NON-EMPTY string is reused verbatim (the real `generateSummary` LLM call is
|
|
1421
|
+
* When `summaryProvider` is set, every automatic compaction pass (the run start's and a turn boundary's) consults it: a NON-EMPTY string is reused verbatim (the real `generateSummary` LLM call is
|
|
1420
1422
|
* skipped); `null`/`undefined`/blank falls back to the existing LLM path (byte-identical to today).
|
|
1421
1423
|
* `onCompaction` is a pure post-compaction observer. `maxConsecutiveProviderReuse` (default 3, CC parity)
|
|
1422
1424
|
* forces a real summary after N consecutive reuses to bound drift; the Runner OWNS the consecutive-reuse
|
|
1423
1425
|
* counter across both call sites for the task (reset on a real summary, incremented on a reused one), so
|
|
1424
1426
|
* the caller does not have to thread it back. **Absent (default) ⇒ no behavior change whatsoever.**
|
|
1425
|
-
*
|
|
1426
|
-
*
|
|
1427
|
-
* SPLIT-TURN cut point (mid-turn prefix summarization — the common shape inside a long single-user-
|
|
1428
|
-
* message tool loop) bypasses the provider by design (A2 algorithm sovereignty): the turn-prefix
|
|
1429
|
-
* summary is engine-owned. Deployments needing a clean provider-visible boundary should shape work
|
|
1430
|
-
* as separate tasks sharing `sessionId`.
|
|
1427
|
+
* Every pass's floor opens a group (an answer and what follows it), so the provider is asked at every floor, inside a
|
|
1428
|
+
* long tool loop too, and is handed everything before it.
|
|
1431
1429
|
*/
|
|
1432
1430
|
summaryProvider?: import("./auto-compaction.js").MaybeCompactOptions["summaryProvider"];
|
|
1433
1431
|
/** design/84 Seam C — pure post-compaction observer (fires only on a real compaction, never a no-op).
|
package/dist/core/scheduler.d.ts
CHANGED
|
@@ -101,6 +101,16 @@ export interface SchedulerContext {
|
|
|
101
101
|
* principal 已足);未来精细化时由 daemon 解释。core 不定其 schema(最薄)。**不可由模型提供**(Runner-held)。
|
|
102
102
|
*/
|
|
103
103
|
taskConfig?: unknown;
|
|
104
|
+
/**
|
|
105
|
+
* The user's time zone as the engine judged it (a name `Intl` accepts: an IANA name such as `"Asia/Tokyo"`, or a fixed
|
|
106
|
+
* offset such as `"+05:30"` where the runtime reads one): the zone a `cron` intent's fields
|
|
107
|
+
* are read in. Present exactly when the run's `TaskSpec.clientContext.timeZone` passed the engine's zone check — the same
|
|
108
|
+
* zone the run's environment block dates "today" in, so the model's "9am" and the backend's 9am are one clock. Absent
|
|
109
|
+
* when the run named no zone or one the runtime does not know: the engine then knows no user zone (the environment block
|
|
110
|
+
* says its date is UTC), and a backend reads the fields in a zone of its own choosing, which it names when it calls
|
|
111
|
+
* `nextCronFireTime` — never one that function guesses. Runner-held, like every member here; the model cannot set it.
|
|
112
|
+
*/
|
|
113
|
+
timeZone?: string;
|
|
104
114
|
}
|
|
105
115
|
/** {@link SchedulerCapability.list} 的条目:足够 self-discovery + 防重复排,不含完整意图。 */
|
|
106
116
|
export interface ScheduledTaskSummary {
|
|
@@ -165,8 +175,9 @@ export interface SchedulerCapability {
|
|
|
165
175
|
};
|
|
166
176
|
/**
|
|
167
177
|
* 持久化一个未来意图。`intent` = 模型可控(无身份);`ctx` = Runner-held 可信上下文(principal/scope/...)。返回不透明
|
|
168
|
-
* 句柄。🔴 实现 MUST 把 `ctx.principal` 钉死进持久化 intent(daemon 触发原样传 runTask
|
|
169
|
-
*
|
|
178
|
+
* 句柄。🔴 实现 MUST 把 `ctx.principal` 钉死进持久化 intent(daemon 触发原样传 runTask,不升权);`when.expr` 的
|
|
179
|
+
* 下一次触发时刻 MUST 用引擎的 `nextCronFireTime` 算(工具壳收单用的就是它,收单认的即到点算得出的;`timeZone`
|
|
180
|
+
* 取 `ctx.timeZone`,缺席时由 backend 显式给自己的时区)——**禁 shell-exec**(RCE 红线);MUST 持久化(durable,daemon 重启存活)。upsert:同
|
|
170
181
|
* `(scope, when, label, lifetime)` 覆盖(幂等)——**lifetime 是身份的一部分**(RB-12/server 1.215 F1 案:
|
|
171
182
|
* session 级与 durable 级、或不同会话的 session 级 job 撞 (when,label) 是正常用法,MUST NOT 互相覆盖;
|
|
172
183
|
* session 级的身份还含 sessionId)。
|
|
@@ -183,4 +194,3 @@ export interface SchedulerCapability {
|
|
|
183
194
|
* 结构 + 语义检测:`env` 是否暴露 scheduler 能力且声明 `supported:true`。挂载门控用此(对齐 `hasBackgroundShell`)。
|
|
184
195
|
*/
|
|
185
196
|
export declare function hasScheduler(env: ExecutionEnv): env is ExecutionEnv & SchedulerCapability;
|
|
186
|
-
export declare function isValidCronExpr(expr: string): boolean;
|
package/dist/core/scheduler.js
CHANGED
|
@@ -17,15 +17,3 @@ export function hasScheduler(env) {
|
|
|
17
17
|
e.schedulerCapabilities !== null &&
|
|
18
18
|
e.schedulerCapabilities.supported === true);
|
|
19
19
|
}
|
|
20
|
-
const CRON_EXPR_RE = /^[0-9*/,\-\s]+$/;
|
|
21
|
-
export function isValidCronExpr(expr) {
|
|
22
|
-
if (typeof expr !== "string")
|
|
23
|
-
return false;
|
|
24
|
-
const trimmed = expr.trim();
|
|
25
|
-
if (trimmed.length === 0 || trimmed.length > 100)
|
|
26
|
-
return false;
|
|
27
|
-
if (!CRON_EXPR_RE.test(trimmed))
|
|
28
|
-
return false;
|
|
29
|
-
const fields = trimmed.split(/\s+/);
|
|
30
|
-
return fields.length === 5 || fields.length === 6;
|
|
31
|
-
}
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* The environment a spawned child inherits: which of this process's variables it must not see.
|
|
3
3
|
*
|
|
4
4
|
* A child the engine spawns may run what the MODEL chose (a tool shell, a gate over model-written code, a language
|
|
5
|
-
* server). Under the `"scrub"` policy (the default) it inherits every variable but those the judgment below names
|
|
6
|
-
* deleted whole, never rewritten; `"all"` and a `string[]`
|
|
5
|
+
* server). Under the `"scrub"` policy (the default) it inherits every variable but those the judgment below names and those a
|
|
6
|
+
* protocol peer's credential reference names ({@link holdPeerHeldNames}) — deleted whole, never rewritten; `"all"` and a `string[]`
|
|
7
|
+
* allow list are the caller's explicit alternatives
|
|
7
8
|
* ({@link inheritedHostEnv}): `"all"` is the whole environment less the engine's own namespace's credential names (rule 4 alone,
|
|
8
9
|
* {@link isNamespaceCredentialName} — the engine's own slots are no one else's to hand on), a list is exactly the names it
|
|
9
10
|
* lists. Whatever the policy, an entry that is one of the engine's own credentials is never inherited:
|
|
@@ -29,10 +30,11 @@ import { type EngineNotice } from "./engine-notice.js";
|
|
|
29
30
|
* value forms are the vocabulary's rows, {@link ENV_VALUES}). Reads the first {@link VALUE_SCAN_LIMIT} code units. The value half of the judgment, exported apart from the env
|
|
30
31
|
* entry's exemptions ({@link isExemptEnvName}): a caller holding a value that is no environment variable asks this. */
|
|
31
32
|
export declare function looksLikeCredentialValue(value: string): boolean;
|
|
32
|
-
/** Which rule withheld an entry: one of the scrub's rules (the `"all"` policy withholds under `namespace-rule` alone)
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
|
|
33
|
+
/** Which rule withheld an entry: one of the scrub's rules (the `"all"` policy withholds under `namespace-rule` alone); `peer-held` — a
|
|
34
|
+
* variable a protocol peer's credential reference names, a token the engine holds for that peer ({@link holdPeerHeldNames}), which the
|
|
35
|
+
* `"scrub"` policy withholds by name; or `own-credential` — the entry is one of the engine's own credentials (its name is declared, or
|
|
36
|
+
* its value equals a declared or engine-held credential value: {@link declareWithheldEnv}), which every policy withholds. */
|
|
37
|
+
export type SecretEnvFindingKind = "exact-name" | "name-rule" | "namespace-rule" | "prefix-rule" | "value-rule" | "peer-held" | "own-credential";
|
|
36
38
|
/** One env entry withheld (deleted) from a child's environment: its name — never its value, so the record is
|
|
37
39
|
* loggable —, the rule that withheld it, how strong that claim is, and the minting module. */
|
|
38
40
|
export interface SecretEnvFinding {
|
|
@@ -114,6 +116,38 @@ export declare function namesASecret(value: string): boolean;
|
|
|
114
116
|
* spells each withheld name as this process's environment spells it, not as the declaration spelled it.
|
|
115
117
|
*/
|
|
116
118
|
export declare function declareWithheldEnv(table: WithheldEnvDeclaration): void;
|
|
119
|
+
/**
|
|
120
|
+
* The engine takes in the variables a protocol peer's credential reference names — where the engine receives a declaration: the one
|
|
121
|
+
* receipt of an MCP server or an A2A peer (`snapshotDeclaredEntry`, locked-config.ts), whose reference of kind `env` points, by its
|
|
122
|
+
* `headers` and `env` maps, at variables of the resolver's environment. Such a variable is a token the engine holds FOR that peer, never
|
|
123
|
+
* one a command needs: from then on, for the life of the process, the `"scrub"` policy withholds it BY NAME from every child spawned on
|
|
124
|
+
* this host (a finding of kind `peer-held`) — whatever header carries it, whatever shape the seat's answer gives its value, before the
|
|
125
|
+
* peer is ever dialled. `"all"` and an allow list hand it on as they hand on any variable (the value arm still withholds an entry whose
|
|
126
|
+
* value the engine took in from the seat's answer, {@link holdOwnCredentialValues}). A name the environment does not hold withholds
|
|
127
|
+
* nothing and is not said; a re-declaration ({@link declareWithheldEnv}) does not remove one. A variable the peer's own child needs reaches
|
|
128
|
+
* it through the seat's answer (a stdio server's `env`), which no inheritance reads. A name some layer of this host hands every child
|
|
129
|
+
* whatever the spawn passes ({@link runtimeSuppliedEnv}) is not taken in — the table's one entry rule for a name, the one the declaration
|
|
130
|
+
* refuses such a name by: no reading can withhold it, so no finding may say it was withheld. The receipt does not refuse the declaration
|
|
131
|
+
* for it (a refusal there would change which declarations are accepted); a seat that answers its value as a credential meets the value
|
|
132
|
+
* intake's refusal at the dial ({@link holdOwnCredentialValues}). `entry` is how a sentence names the entry whose reference this is
|
|
133
|
+
* (`MCP server "acme"`): kept beside each name, it is what the person's notice gives as the reason the name is held back
|
|
134
|
+
* ({@link withheldEnvUserNotice}) to the person of a leg whose receipt took it in ({@link peerEntriesTakenIn}). The names are the
|
|
135
|
+
* process's (kept in their own slot, {@link PeerHeldNames}): a shell of another session or another Runner in this process is held back
|
|
136
|
+
* from them too, and its notice says another entry in this process names the variable, without naming that entry.
|
|
137
|
+
*/
|
|
138
|
+
export declare function holdPeerHeldNames(names: Iterable<string>, entry: string): void;
|
|
139
|
+
/** The entries a receipt took in, per variable: the process's table's own shape ({@link PeerHeldNames}), but only the (variable, entry) pairs
|
|
140
|
+
* one receipt took in. */
|
|
141
|
+
export type PeerEntriesTaken = ReadonlyMap<string, ReadonlySet<string>>;
|
|
142
|
+
/**
|
|
143
|
+
* Run a leg's receipt (`receive`, synchronous; runner/leg-receipt.ts) and collect the (variable, entry) pairs {@link holdPeerHeldNames} takes
|
|
144
|
+
* in meanwhile: what that leg holds, the only pairs its person's notice names an entry for. An intake outside such a call (a host's own
|
|
145
|
+
* materialization, another leg's receipt) is no leg's.
|
|
146
|
+
*/
|
|
147
|
+
export declare function peerEntriesTakenIn<T>(receive: () => T): {
|
|
148
|
+
readonly value: T;
|
|
149
|
+
readonly entries: PeerEntriesTaken;
|
|
150
|
+
};
|
|
117
151
|
/**
|
|
118
152
|
* The engine takes credential values in — each where the engine receives it: a first-party brain's construction
|
|
119
153
|
* credential (`brainConfigSnapshot`), a model entry's own credential headers (`resolveRouteCredential`), the credential
|
|
@@ -171,11 +205,11 @@ export declare function __resetWithheldEnv(): void;
|
|
|
171
205
|
* THE environment a child spawned ON THIS HOST inherits: the policy's arm, less the engine's own credentials — a
|
|
172
206
|
* declared name, or a value equal to a declared or engine-held credential value ({@link declareWithheldEnv},
|
|
173
207
|
* {@link holdOwnCredentialValues}). The arms: `"scrub"` (and absent) is this process's environment through
|
|
174
|
-
* {@link scrubSecretEnv}; `"all"` is this process's environment as written, less the credential names of the engine's own
|
|
208
|
+
* {@link scrubSecretEnv}, less the variables the engine holds for a protocol peer ({@link holdPeerHeldNames}, by name); `"all"` is this process's environment as written, less the credential names of the engine's own
|
|
175
209
|
* namespace (the namespace rule, {@link isNamespaceCredentialName}, and none of the scrub's other rules); a `string[]` is exactly the
|
|
176
210
|
* named variables that are set, as written — a strict allow list, so a name it leaves out (`PATH` included) is not
|
|
177
|
-
* inherited, and one it names is handed on whatever its shape. `findings` collects every entry withheld: the scrub's
|
|
178
|
-
* namespace rule's under `"all"`, and each own credential the arm held.
|
|
211
|
+
* inherited, and one it names is handed on whatever its shape. `findings` collects every entry withheld: the scrub's and each
|
|
212
|
+
* peer-held name under `"scrub"`, the namespace rule's under `"all"`, and each own credential the arm held.
|
|
179
213
|
*
|
|
180
214
|
* A policy {@link inheritEnvPolicyProblem} refuses throws that reason HERE, at every spawn, read against the
|
|
181
215
|
* declaration as it stands: a value that is no policy at all (never read as the scrub), and an allow list naming a
|
|
@@ -261,11 +295,13 @@ export interface WithheldEnvRemedy {
|
|
|
261
295
|
* no names: an empty list never stands for unknown). `undefined` when nothing is withheld. Minted by the Runner
|
|
262
296
|
* (`runner/shell-env-withheld.ts`). The sentence says what happened, that it is a protection asking nothing of the person,
|
|
263
297
|
* and the one thing to do if a command needs a withheld variable (the engine's own credentials: nothing hands them on; a name
|
|
264
|
-
* the namespace rule caught: a list naming it, or the host's explicit grant, does, and the sentence says `"all"` does not
|
|
298
|
+
* the namespace rule caught: a list naming it, or the host's explicit grant, does, and the sentence says `"all"` does not; a name a
|
|
299
|
+
* protocol peer's credential reference named: the entry that names it is the reason, named when the leg whose shell this is took in that
|
|
300
|
+
* variable and entry at its receipt — `mine` — {@link peerHeldHalf}).
|
|
265
301
|
*/
|
|
266
302
|
export declare function withheldEnvUserNotice(withheld: readonly SecretEnvFinding[] | "unknown", at: {
|
|
267
303
|
sessionId: string;
|
|
268
304
|
runId?: string | undefined;
|
|
269
305
|
sourceSessionId?: string | undefined;
|
|
270
306
|
agentId?: string | undefined;
|
|
271
|
-
}): EngineNotice | undefined;
|
|
307
|
+
}, mine?: PeerEntriesTaken): EngineNotice | undefined;
|
package/dist/core/secret-env.js
CHANGED
|
@@ -95,6 +95,7 @@ const SECRET_ENV_KIND_CONFIDENCE = {
|
|
|
95
95
|
"exact-name": "high",
|
|
96
96
|
"prefix-rule": "high",
|
|
97
97
|
"value-rule": "high",
|
|
98
|
+
"peer-held": "high",
|
|
98
99
|
"own-credential": "high",
|
|
99
100
|
"name-rule": "medium",
|
|
100
101
|
"namespace-rule": "medium",
|
|
@@ -176,6 +177,15 @@ const withheldEnvOf = () => {
|
|
|
176
177
|
Reflect.set(globalThis, WITHHELD_ENV, fresh);
|
|
177
178
|
return fresh;
|
|
178
179
|
};
|
|
180
|
+
const PEER_HELD_ENV = Symbol.for("sema.core.peerHeldEnvNames");
|
|
181
|
+
const peerHeldOf = () => {
|
|
182
|
+
const slot = Reflect.get(globalThis, PEER_HELD_ENV);
|
|
183
|
+
if (slot instanceof Map)
|
|
184
|
+
return slot;
|
|
185
|
+
const fresh = new Map();
|
|
186
|
+
Reflect.set(globalThis, PEER_HELD_ENV, fresh);
|
|
187
|
+
return fresh;
|
|
188
|
+
};
|
|
179
189
|
const WITHHELD_ENV_TABLE_KEYS = optionKeys()({ names: 0, values: 0 });
|
|
180
190
|
const kindOf = (v) => (v === null ? "null" : Array.isArray(v) ? "an array" : typeof v);
|
|
181
191
|
function listCopy(label, list) {
|
|
@@ -282,6 +292,36 @@ export function declareWithheldEnv(table) {
|
|
|
282
292
|
indexAdd(declared, v);
|
|
283
293
|
Reflect.set(globalThis, WITHHELD_ENV, { names: names, declared, held: withheldEnvOf().held });
|
|
284
294
|
}
|
|
295
|
+
export function holdPeerHeldNames(names, entry) {
|
|
296
|
+
const peerHeld = peerHeldOf();
|
|
297
|
+
const supplied = new Set(runtimeSuppliedEnv().map(envNameKey));
|
|
298
|
+
for (const name of names) {
|
|
299
|
+
const key = envNameKey(name);
|
|
300
|
+
if (supplied.has(key))
|
|
301
|
+
continue;
|
|
302
|
+
addEntry(peerHeld, key, entry);
|
|
303
|
+
if (takingIn !== undefined)
|
|
304
|
+
addEntry(takingIn, key, entry);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
function addEntry(table, key, entry) {
|
|
308
|
+
const entries = table.get(key);
|
|
309
|
+
if (entries === undefined)
|
|
310
|
+
table.set(key, new Set([entry]));
|
|
311
|
+
else
|
|
312
|
+
entries.add(entry);
|
|
313
|
+
}
|
|
314
|
+
let takingIn;
|
|
315
|
+
export function peerEntriesTakenIn(receive) {
|
|
316
|
+
const outer = takingIn;
|
|
317
|
+
const entries = (takingIn = new Map());
|
|
318
|
+
try {
|
|
319
|
+
return { value: receive(), entries };
|
|
320
|
+
}
|
|
321
|
+
finally {
|
|
322
|
+
takingIn = outer;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
285
325
|
export function holdOwnCredentialValues(values, onNotice) {
|
|
286
326
|
const given = [...values].filter((v) => typeof v === "string" && !isBlankCredential(v));
|
|
287
327
|
const notTaken = new Map();
|
|
@@ -348,6 +388,7 @@ function sayNotTaken(value, why, onNotice) {
|
|
|
348
388
|
}
|
|
349
389
|
export function __resetWithheldEnv() {
|
|
350
390
|
Reflect.set(globalThis, WITHHELD_ENV, { names: NOTHING_NAMED, declared: new Map(), held: new Map() });
|
|
391
|
+
Reflect.set(globalThis, PEER_HELD_ENV, new Map());
|
|
351
392
|
intakeSaid.clear();
|
|
352
393
|
}
|
|
353
394
|
function ownCredentialJudge() {
|
|
@@ -446,8 +487,11 @@ export function hostChildEnv(policy, ...grants) {
|
|
|
446
487
|
function policyArm(policy, findings) {
|
|
447
488
|
if (policy === "all")
|
|
448
489
|
return withholdEntries(process.env, (name) => (isNamespaceCredentialName(name) ? "namespace-rule" : undefined), findings);
|
|
449
|
-
if (!Array.isArray(policy))
|
|
450
|
-
|
|
490
|
+
if (!Array.isArray(policy)) {
|
|
491
|
+
const scrubbed = scrubSecretEnv(process.env, findings);
|
|
492
|
+
const peerHeld = peerHeldOf();
|
|
493
|
+
return peerHeld.size === 0 ? scrubbed : withholdEntries(scrubbed, (name) => (peerHeld.has(envNameKey(name)) ? "peer-held" : undefined), findings);
|
|
494
|
+
}
|
|
451
495
|
const arm = {};
|
|
452
496
|
for (const k of policy)
|
|
453
497
|
if (process.env[k] !== undefined)
|
|
@@ -492,7 +536,21 @@ export function announceSecretEnvScrub(onNotice, findings) {
|
|
|
492
536
|
});
|
|
493
537
|
}
|
|
494
538
|
export const WITHHELD_ENV_REMEDY_KINDS = Object.freeze(["inherit_env", "execution_environment"]);
|
|
495
|
-
|
|
539
|
+
function peerHeldHalf(peers, mine) {
|
|
540
|
+
const held = peerHeldOf();
|
|
541
|
+
const entriesOf = (name) => {
|
|
542
|
+
const key = envNameKey(name);
|
|
543
|
+
const own = [...(mine?.get(key) ?? [])];
|
|
544
|
+
return own.length > 0 ? own.join(", ") : held.has(key) ? "another entry in this process" : undefined;
|
|
545
|
+
};
|
|
546
|
+
const one = peers.length === 1;
|
|
547
|
+
const named = one ? entriesOf(peers[0]) : peers.flatMap((k) => (entriesOf(k) === undefined ? [] : [`${k}: ${entriesOf(k)}`])).join("; ");
|
|
548
|
+
return (`${peers.join(", ")} — held back because the credential reference of an MCP server or A2A peer names ${one ? "it" : "each of them"}${named ? ` (${named})` : ""}: ` +
|
|
549
|
+
`the engine holds ${one ? "it" : "them"} for that peer (if a command needs ${one ? "it" : "one of them"}, name it among the variables the run inherits, or have the host hand it to the shell explicitly, ` +
|
|
550
|
+
`through the shell's own environment or the environment of a single execution; letting the run inherit all of them hands it on as well, but once the engine has started connecting to that peer ` +
|
|
551
|
+
`neither that nor a list is sure to, since a credential value the engine took in for it is held back whatever the run inherits)`);
|
|
552
|
+
}
|
|
553
|
+
export function withheldEnvUserNotice(withheld, at, mine) {
|
|
496
554
|
const route = { sessionId: at.sessionId, ...(at.sourceSessionId !== undefined ? { sourceSessionId: at.sourceSessionId } : {}), ...(at.agentId !== undefined ? { agentId: at.agentId } : {}), ...(at.runId !== undefined ? { runId: at.runId } : {}) };
|
|
497
555
|
const delegated = at.sourceSessionId !== undefined;
|
|
498
556
|
const shell = delegated ? "the tool shell of a delegated agent in this session" : "the tool shell in this session";
|
|
@@ -509,11 +567,14 @@ export function withheldEnvUserNotice(withheld, at) {
|
|
|
509
567
|
return undefined;
|
|
510
568
|
const scrubbed = names.filter((k) => !ownCredentials.includes(k));
|
|
511
569
|
const slotNames = new Set(withheld.filter((f) => f.kind === "namespace-rule").map((f) => f.key));
|
|
570
|
+
const peerNames = new Set(withheld.filter((f) => f.kind === "peer-held").map((f) => f.key));
|
|
512
571
|
const slots = scrubbed.filter((k) => slotNames.has(k));
|
|
513
|
-
const
|
|
572
|
+
const peers = scrubbed.filter((k) => peerNames.has(k) && !slotNames.has(k));
|
|
573
|
+
const others = scrubbed.filter((k) => !slotNames.has(k) && !peerNames.has(k));
|
|
514
574
|
const needs = (list) => (list.length === 1 ? "it" : "one of them");
|
|
515
575
|
const halves = [
|
|
516
576
|
...(others.length > 0 ? [`${others.join(", ")} — held back because ${others.length === 1 ? "it looks like a credential" : "they look like credentials"} (if a command needs ${needs(others)}, name it among the variables the run inherits, or let the run inherit all of them)`] : []),
|
|
577
|
+
...(peers.length > 0 ? [peerHeldHalf(peers, mine)] : []),
|
|
517
578
|
...(slots.length > 0 ? [`${slots.join(", ")} — held back because ${slots.length === 1 ? "it is named" : "they are named"} like the engine's own credential slots (if a command needs ${needs(slots)}, name it among the variables the run inherits, or have the host hand it to the shell explicitly, through the shell's own environment or the environment of a single execution — letting the run inherit everything does not hand ${slots.length === 1 ? "it" : "them"} on)`] : []),
|
|
518
579
|
...(ownCredentials.length > 0 ? [`${ownCredentials.join(", ")} — ${OWN_CREDENTIAL}(s), never handed on, whatever the run's environment inheritance says`] : []),
|
|
519
580
|
];
|
|
@@ -39,6 +39,10 @@ export const RECOMMENDED_SENSITIVE_PATTERNS = [
|
|
|
39
39
|
".ai-agent/.env",
|
|
40
40
|
".sema/engine-data/.env",
|
|
41
41
|
".sema/config-lkg-*.json",
|
|
42
|
+
".sema/settings.json.*",
|
|
43
|
+
".sema/settings.local.json.*",
|
|
44
|
+
".sema/.sema.*",
|
|
45
|
+
".sema/.config.json*",
|
|
42
46
|
".codex/config.toml",
|
|
43
47
|
".cursor/mcp.json",
|
|
44
48
|
".continue/config.json",
|
|
@@ -9,6 +9,7 @@ import { strayMembersOf } from "./own-property-receipt.js";
|
|
|
9
9
|
import { readMember, thrownText } from "./thrown-value.js";
|
|
10
10
|
import { redactThenCut } from "./untrusted-egress.js";
|
|
11
11
|
import { isAbsence } from "../tools/fs/shell-read-environment.js";
|
|
12
|
+
import { GIT_READ_ONLY as G } from "./git-read-only.js";
|
|
12
13
|
export const WORKTREE_INCAPABLE_REASONS = Object.freeze([
|
|
13
14
|
"name_invalid",
|
|
14
15
|
"git_unavailable",
|
|
@@ -199,18 +200,18 @@ export async function probeWorktreeCapability(env, cwd, opts) {
|
|
|
199
200
|
if (problem !== undefined)
|
|
200
201
|
return no("name_invalid", problem);
|
|
201
202
|
}
|
|
202
|
-
const version = await run(env,
|
|
203
|
+
const version = await run(env, `${G} --version`, cwd);
|
|
203
204
|
if (version === undefined || version.exitCode !== 0)
|
|
204
205
|
return no("git_unavailable", "git cannot be run in this environment");
|
|
205
|
-
const bare = await run(env,
|
|
206
|
+
const bare = await run(env, `${G} rev-parse --is-bare-repository`, cwd);
|
|
206
207
|
if (bare === undefined || bare.exitCode !== 0)
|
|
207
208
|
return no("not_a_repository", `${cwd} is not inside a git repository`);
|
|
208
209
|
if (bare.stdout.trim() === "true")
|
|
209
210
|
return no("bare_repository", `${cwd} is a bare repository (it has no working tree to branch from)`);
|
|
210
|
-
const inside = await run(env,
|
|
211
|
+
const inside = await run(env, `${G} rev-parse --is-inside-work-tree`, cwd);
|
|
211
212
|
if (inside === undefined || inside.exitCode !== 0 || inside.stdout.trim() !== "true")
|
|
212
213
|
return no("not_a_repository", `${cwd} is not inside a git work tree`);
|
|
213
|
-
const head = await run(env,
|
|
214
|
+
const head = await run(env, `${G} rev-parse --verify --quiet 'HEAD^{commit}'`, cwd);
|
|
214
215
|
if (head === undefined || head.exitCode !== 0)
|
|
215
216
|
return no("no_commit", `the repository at ${cwd} has no commit yet`);
|
|
216
217
|
const gitRoot = await managedAnchorOf(env, cwd);
|
|
@@ -235,14 +236,14 @@ export async function probeWorktreeCapability(env, cwd, opts) {
|
|
|
235
236
|
if (at.ok || at.error.code !== "not_found")
|
|
236
237
|
return no("name_in_use", `a tree named "${opts.name}" already exists at ${dir}`, gitRoot);
|
|
237
238
|
const branch = managedWorktreeBranchOf(dir);
|
|
238
|
-
const ref = branch === undefined ? undefined : await run(env,
|
|
239
|
+
const ref = branch === undefined ? undefined : await run(env, `${G} rev-parse --verify --quiet ${shq(`refs/heads/${branch}`)}`, gitRoot);
|
|
239
240
|
if (ref !== undefined && ref.exitCode === 0)
|
|
240
241
|
return no("name_in_use", `the branch ${branch} already exists`, gitRoot);
|
|
241
242
|
}
|
|
242
243
|
return { worktreeCapable: true, gitRoot };
|
|
243
244
|
}
|
|
244
245
|
async function birthRecordPath(env, dir) {
|
|
245
|
-
const gitDir = await run(env,
|
|
246
|
+
const gitDir = await run(env, `${G} rev-parse --absolute-git-dir`, dir);
|
|
246
247
|
return gitDir !== undefined && gitDir.exitCode === 0 && gitDir.stdout.trim().startsWith("/") ? `${gitDir.stdout.trim()}/sema-allocation` : undefined;
|
|
247
248
|
}
|
|
248
249
|
async function readBirthMark(env, dir) {
|
|
@@ -287,7 +288,7 @@ const canonicalOf = async (env, path) => {
|
|
|
287
288
|
return r.ok ? r.value : path;
|
|
288
289
|
};
|
|
289
290
|
async function checkoutTopOf(env, dir) {
|
|
290
|
-
const top = await run(env,
|
|
291
|
+
const top = await run(env, `${G} rev-parse --show-toplevel`, dir);
|
|
291
292
|
return top !== undefined && top.exitCode === 0 && top.stdout.trim().startsWith("/") ? canonicalOf(env, top.stdout.trim()) : undefined;
|
|
292
293
|
}
|
|
293
294
|
async function rootPlaceRead(env, root) {
|
|
@@ -295,7 +296,7 @@ async function rootPlaceRead(env, root) {
|
|
|
295
296
|
const own = await env.canonicalPath(root);
|
|
296
297
|
if (!own.ok)
|
|
297
298
|
return isAbsence(own.error.code) ? { none: true } : { unread: `${root} cannot be resolved (${own.error.code})` };
|
|
298
|
-
const answer = await run(env,
|
|
299
|
+
const answer = await run(env, `${G} rev-parse --show-toplevel --git-common-dir`, own.value);
|
|
299
300
|
if (answer === undefined)
|
|
300
301
|
return { unread: `git could not be run at ${own.value}` };
|
|
301
302
|
if (answer.exitCode !== 0)
|
|
@@ -651,7 +652,7 @@ async function allocate(input, declared, observedLeaf) {
|
|
|
651
652
|
tree.source = source;
|
|
652
653
|
continue;
|
|
653
654
|
}
|
|
654
|
-
const head = await run(env,
|
|
655
|
+
const head = await run(env, `${G} rev-parse --verify --quiet 'HEAD^{commit}'`, place.top);
|
|
655
656
|
if (head === undefined || head.exitCode !== 0 || head.stdout.trim() !== source.sha) {
|
|
656
657
|
throw refusal("workspace.source_mismatch", `The checkout at ${place.top} is not at the declared commit ${source.sha} (it is at ${head?.exitCode === 0 ? head.stdout.trim() : "an unreadable HEAD"}); the leg was not started.`);
|
|
657
658
|
}
|
|
@@ -38,7 +38,8 @@ export declare function readStationAnswer(answer: ShellReadVerdict, call: Statio
|
|
|
38
38
|
/** The ask `d` with the silence a station's answer carries, each its own class on the question it keeps or mints: unread rows are a
|
|
39
39
|
* rule that could not be read (the rule lane's class); the finding `unanswered` is, unless rows are unread, the environment's silence —
|
|
40
40
|
* shell text the engine cannot read (a guard, attested on the ask's record for `call` beside the guards it already carries) — and the
|
|
41
|
-
* marks only pick whose. Either is a question only a person answers
|
|
41
|
+
* marks only pick whose. Either is a question only a person answers (the real-approval bit; beside the environment's guard alone no
|
|
42
|
+
* class explains it, and the class fold reads that pair as a check that did not finish); `probe` follows the finding. No silence ⇒ `d` itself. */
|
|
42
43
|
export declare function silencedBy<D extends Extract<PermissionResult, {
|
|
43
44
|
action: "ask";
|
|
44
45
|
}>>(d: D, verdict: ShellReadVerdict, call: {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* command as one string or an option of unknown arity). The reader above turns "unreadable" into a fail-closed ask
|
|
19
19
|
* rather than into silence — reading it as "no match" is how a deny went blind on `rm -r x; echo "$HOME"`. Where the
|
|
20
20
|
* lexer cannot delimit the text, the segments it read before it stopped stay candidates (bash runs every complete line
|
|
21
|
-
* before the one it cannot parse) and the segment it stopped in is
|
|
21
|
+
* before the one it cannot parse) and so do the statements past the stop (`segmentsPastStop`); the segment it stopped in is unreadable.
|
|
22
22
|
*
|
|
23
23
|
* The ALLOW direction's rule lane never reads this module: a standing yes covers the exact spelling a person read
|
|
24
24
|
* (`ruleAdmitsCommand`), and its whole-string refusal of every shell construct stays where it is.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { arithmeticTextIsPlain, arithmeticTextRunsOf, heredocRunsOf, lexShell, namesRedirectDescriptor, PARSE_FAILURE_SENTENCE, wordRunsOf, } from "../shell/lex.js";
|
|
1
|
+
import { arithmeticTextIsPlain, arithmeticTextRunsOf, heredocRunsOf, lexShell, namesRedirectDescriptor, PARSE_FAILURE_SENTENCE, segmentsPastStop, wordRunsOf, } from "../shell/lex.js";
|
|
2
2
|
import { shellWordsOf } from "../shell/shell-words.js";
|
|
3
3
|
import { isLauncherAssignmentOperand } from "../tools/fs/bash-program-position.js";
|
|
4
4
|
import { extglobOpenerIn } from "../tools/fs/bash-readonly-classifier.js";
|
|
@@ -63,7 +63,7 @@ function readShellCommandAt(source, depth) {
|
|
|
63
63
|
return { segments: [{ argv: [], redirections: [], peeled: [], unreadable: `the command is longer than ${MAX_SHELL_READ_CHARS} characters — not read` }], connectors: [], grouped: false, backgrounded: false, strayRedirection: false };
|
|
64
64
|
const lexed = lexShell(source);
|
|
65
65
|
const failed = "parseFailure" in lexed ? lexed : undefined;
|
|
66
|
-
const read = "parseFailure" in lexed ? lexed.readBefore : lexed.segments;
|
|
66
|
+
const read = "parseFailure" in lexed ? [...lexed.readBefore, ...segmentsPastStop(source, lexed)] : lexed.segments;
|
|
67
67
|
const segments = [];
|
|
68
68
|
const connectors = [];
|
|
69
69
|
let grouped = false;
|
|
@@ -165,6 +165,13 @@ function readShellCommandAt(source, depth) {
|
|
|
165
165
|
};
|
|
166
166
|
for (let k = 0; k < read.length; k++) {
|
|
167
167
|
const s = read[k];
|
|
168
|
+
if (k > 0 && k === failed?.readBefore.length) {
|
|
169
|
+
seg.unreadable ??= PARSE_FAILURE_SENTENCE[failed.parseFailure.reason];
|
|
170
|
+
arithmetic = undefined;
|
|
171
|
+
finishSegment("\n");
|
|
172
|
+
readTokens(s);
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
168
175
|
if (k > 0) {
|
|
169
176
|
const armEnd = caseArmEnd(read, k);
|
|
170
177
|
if (armEnd !== undefined) {
|
|
@@ -187,7 +194,8 @@ function readShellCommandAt(source, depth) {
|
|
|
187
194
|
readTokens(s);
|
|
188
195
|
}
|
|
189
196
|
if (failed !== undefined) {
|
|
190
|
-
|
|
197
|
+
if (read.length === failed.readBefore.length)
|
|
198
|
+
seg.unreadable ??= PARSE_FAILURE_SENTENCE[failed.parseFailure.reason];
|
|
191
199
|
}
|
|
192
200
|
else if (arithmetic !== undefined) {
|
|
193
201
|
seg.unreadable ??= "an unterminated arithmetic command";
|
|
@@ -956,18 +956,14 @@ export type TaskEvent = ({
|
|
|
956
956
|
* no frame and no record. Absent when the
|
|
957
957
|
* restore is off, minted no frame, or failed outright (an operator line, `onError` phase `degraded`, says why). */
|
|
958
958
|
restoreOutcomes?: HumanInputAttachment[];
|
|
959
|
-
/**
|
|
960
|
-
*
|
|
961
|
-
* `compaction.clampTolerance` of the conversation. Mirror of `compaction.model_fallback`. */
|
|
959
|
+
/** @deprecated Never present: the summary always runs on the main model, so there is no fallback to report.
|
|
960
|
+
* Removed in 7.70.0. */
|
|
962
961
|
modelFallback?: true;
|
|
963
|
-
/**
|
|
962
|
+
/** @deprecated Never present (see `modelFallback`). Removed in 7.70.0. */
|
|
964
963
|
fallbackReason?: "window";
|
|
965
|
-
/**
|
|
966
|
-
* this ratio (0..1) — set when the budget gate denied the fallback, or when the
|
|
967
|
-
* truncation stayed within tolerance (bounded loss, disclosed either way). */
|
|
964
|
+
/** @deprecated Never present: the summary input is never clipped to a separate summary model's window. Removed in 7.70.0. */
|
|
968
965
|
clampedRatio?: number;
|
|
969
|
-
/**
|
|
970
|
-
* "tolerance" = within-`clampTolerance` ordinary truncation. */
|
|
966
|
+
/** @deprecated Never present (see `clampedRatio`). Removed in 7.70.0. */
|
|
971
967
|
clampReason?: "budget" | "tolerance";
|
|
972
968
|
/** 压缩子阶段遥测 (1.283 批 G / design/145 §6 正交后续批, additive): sub-phase wall-time split
|
|
973
969
|
* of THIS pass, mirrored 1:1 from `maybeCompact().phaseDurations` (single source: the
|
|
@@ -1093,7 +1089,8 @@ export type TaskEvent = ({
|
|
|
1093
1089
|
* additional working directory's under the family's opt-in (the session's instructions, read by the same lane). Either word, a frame that WITHDREW a file delivered earlier (removed since, or
|
|
1094
1090
|
* holding nothing now) echoes with its path and the words `(withdrawn: it no longer applies)`. The retired
|
|
1095
1091
|
* `instructions_change` member was the echo of a deployment-probed hash notice about the session's instruction file;
|
|
1096
|
-
* the lane now sends the whole changed file, or its withdrawal.
|
|
1092
|
+
* the lane now sends the whole changed file, or its withdrawal. `skill_mention` (additive member): a fresh leg's first request carried, for each
|
|
1093
|
+
* listed skill the person's opening words named as `/<name>`, the sentence saying it is a skill to run through the Skill tool; `preview` is those sentences.
|
|
1097
1094
|
*/
|
|
1098
1095
|
type: "steering_injected";
|
|
1099
1096
|
source: AttachmentSource | "limit_approach" | "final_verification" | "git_status" | "nested_memory" | "project_instructions";
|
|
@@ -1594,6 +1591,31 @@ export type TaskEvent = ({
|
|
|
1594
1591
|
*/
|
|
1595
1592
|
type: "tool_roster_delta";
|
|
1596
1593
|
delta: import("./tool-roster.js").ToolRosterDelta;
|
|
1594
|
+
} & TaskEventIdentity) | ({
|
|
1595
|
+
/**
|
|
1596
|
+
* A main-line request that does NOT extend the session's previous main request of the same serving model is about to go
|
|
1597
|
+
* out (the provider must re-read everything after `at`: on a long session, minutes before the first token). Minted BEFORE
|
|
1598
|
+
* the request is handed to the Brain seat, judged from the request bytes by the session's prefix ledger
|
|
1599
|
+
* (`core/runner/prefix-ledger.ts`: thinking controls, system text, tool block, messages, in one canonical rendering) —
|
|
1600
|
+
* never from a cache-read count (zero cached tokens does not mean the head changed). Not a prefix change: a side request, an append,
|
|
1601
|
+
* or a request on a model this process holds no earlier main request of (`no-baseline`) — unless it opens a leg whose anchor moved.
|
|
1602
|
+
*/
|
|
1603
|
+
type: "prefix_changed";
|
|
1604
|
+
/** Where the first difference falls: the thinking controls, the system text, the tool block, or the messages. */
|
|
1605
|
+
region: "params" | "system" | "tools" | "messages";
|
|
1606
|
+
/** Where the request stops repeating the previous one (canonical rendering, UTF-16 units): in params / system / tools the first differing unit, in `messages` the first changed message's start.
|
|
1607
|
+
* Absent — with `of` — exactly when this process holds no earlier main request of this model for the session (a restart, a switch to a model not served here, a rewrite-voided baseline): `segments` found it. */
|
|
1608
|
+
at?: number;
|
|
1609
|
+
/** The previous main request's length in the same rendering (absent with `at`). */
|
|
1610
|
+
of?: number;
|
|
1611
|
+
/** Present with `region: "messages"`: which message, by index, first differs from the previous request's or is gone. */
|
|
1612
|
+
message?: number;
|
|
1613
|
+
/** The head segments the leg start found moved against the session's anchor (prompt block ids, `tools`); only then. */
|
|
1614
|
+
segments?: string[];
|
|
1615
|
+
/** Every word declared since the previous main request (`PrefixChangeCause`), in declaration order; empty when none was. */
|
|
1616
|
+
causes: import("./cache-break-detector.js").PrefixChangeCause[];
|
|
1617
|
+
/** A declared word covers the region that changed (`REGION_CAUSES` in the ledger); `false` = no seat declared the move. */
|
|
1618
|
+
declared: boolean;
|
|
1597
1619
|
} & TaskEventIdentity) | ({
|
|
1598
1620
|
/**
|
|
1599
1621
|
* This leg's DEFERRAL CENSUS: which mounted tools ship as name-only placeholders, which the model has activated, and the policy
|