@sema-agent/core 7.72.0 → 7.74.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 +565 -0
- package/dist/agents/inherited-tool-pool.d.ts +26 -1
- package/dist/agents/inherited-tool-pool.js +46 -2
- package/dist/agents/list-agents-tool.js +1 -1
- package/dist/agents/parked-resume-drive.d.ts +10 -0
- package/dist/agents/parked-resume-drive.js +9 -0
- package/dist/agents/retain-ledger.d.ts +3 -0
- package/dist/agents/retain-ledger.js +3 -3
- package/dist/agents/send-message-tool.js +5 -4
- package/dist/agents/send-user-message-tool.d.ts +12 -0
- package/dist/agents/send-user-message-tool.js +67 -0
- package/dist/agents/subagent-steps.d.ts +9 -0
- package/dist/agents/subagent-steps.js +38 -0
- package/dist/agents/subagent.d.ts +2 -0
- package/dist/agents/subagent.js +43 -12
- package/dist/agents/verify.js +23 -8
- package/dist/agents/yield-adoption.js +3 -1
- package/dist/brain/anthropic.d.ts +42 -1
- package/dist/brain/anthropic.js +68 -13
- package/dist/brain/failover.d.ts +5 -0
- package/dist/brain/failover.js +51 -22
- package/dist/brain/model-lane.d.ts +12 -3
- package/dist/brain/model-lane.js +5 -5
- package/dist/brain/open-responses.js +7 -8
- package/dist/brain/openai.js +31 -24
- package/dist/brain/route-adjudicator.d.ts +33 -4
- package/dist/brain/route-adjudicator.js +49 -12
- package/dist/brain/stream-engine.js +166 -156
- package/dist/brain/stream-shared.d.ts +4 -3
- package/dist/brain/stream-shared.js +2 -2
- package/dist/core/actions-digest.d.ts +43 -0
- package/dist/core/actions-digest.js +22 -0
- package/dist/core/allow-entry.js +4 -4
- package/dist/core/ask-class.d.ts +2 -2
- package/dist/core/ask-headline.d.ts +1 -1
- package/dist/core/ask-origin.d.ts +44 -4
- package/dist/core/ask-origin.js +29 -10
- package/dist/core/auto-mode.d.ts +7 -9
- package/dist/core/auto-mode.js +114 -8
- package/dist/core/background-agent-store.d.ts +1 -0
- package/dist/core/background-agent-store.js +49 -8
- package/dist/core/checkpoint-features.d.ts +3 -2
- package/dist/core/checkpoint-features.js +1 -1
- package/dist/core/checkpoint-rekey.d.ts +1 -1
- package/dist/core/checkpoint-rekey.js +6 -1
- package/dist/core/checkpoint-requirements.d.ts +23 -3
- package/dist/core/checkpoint-requirements.js +5 -1
- package/dist/core/checkpoint-row-verdict.d.ts +1 -1
- package/dist/core/checkpoint-row-verdict.js +9 -3
- package/dist/core/checkpoint-store.d.ts +26 -2
- package/dist/core/checkpoint-store.js +9 -2
- package/dist/core/child-clamp-seats.d.ts +15 -0
- package/dist/core/child-clamp-seats.js +15 -0
- package/dist/core/config-refusal-codes.d.ts +1 -1
- package/dist/core/config-refusal-codes.js +1 -0
- package/dist/core/cron.js +9 -1
- package/dist/core/delegation-frames.d.ts +1 -0
- package/dist/core/delegation-frames.js +1 -1
- package/dist/core/deployment-shape.d.ts +7 -0
- package/dist/core/deployment-shape.js +19 -0
- package/dist/core/engine-capabilities.d.ts +13 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +41 -28
- package/dist/core/engine-version.js +1 -1
- package/dist/core/entries-not-applied.d.ts +19 -7
- package/dist/core/entries-not-applied.js +33 -1
- package/dist/core/gate-fold.js +5 -4
- package/dist/core/gate-lanes.js +8 -12
- package/dist/core/gate-outcome.d.ts +8 -2
- package/dist/core/gate-outcome.js +10 -3
- package/dist/core/governance-codes.d.ts +14 -2
- package/dist/core/governance-codes.js +22 -6
- package/dist/core/hook-condition.d.ts +37 -0
- package/dist/core/hook-condition.js +567 -0
- package/dist/core/hooks.d.ts +5 -0
- package/dist/core/hooks.js +1 -0
- package/dist/core/host-instance.d.ts +23 -0
- package/dist/core/host-instance.js +69 -0
- package/dist/core/instruction-preview.d.ts +63 -0
- package/dist/core/instruction-preview.js +406 -0
- package/dist/core/leg-budget.d.ts +26 -0
- package/dist/core/leg-budget.js +9 -0
- package/dist/core/leg-identity.d.ts +51 -1
- package/dist/core/leg-identity.js +45 -2
- package/dist/core/manager-launch-check.d.ts +48 -0
- package/dist/core/manager-launch-check.js +64 -0
- package/dist/core/mcp-call-meta.d.ts +2 -2
- package/dist/core/mcp-injection-drop.d.ts +20 -10
- package/dist/core/mcp-injection-drop.js +9 -3
- package/dist/core/mcp-server-spec.d.ts +2 -1
- package/dist/core/member-outcome.d.ts +3 -2
- package/dist/core/member-outcome.js +1 -1
- package/dist/core/memory-engine/deletion-record.d.ts +46 -0
- package/dist/core/memory-engine/deletion-record.js +96 -0
- package/dist/core/memory-engine/engine.js +24 -16
- package/dist/core/memory-engine/file-backend.js +7 -5
- package/dist/core/memory-engine/projection-ledger.d.ts +1 -1
- package/dist/core/memory-engine/projection-ledger.js +1 -1
- package/dist/core/memory-engine/scope-contract.d.ts +18 -13
- package/dist/core/memory-engine/scope-contract.js +18 -18
- package/dist/core/memory-engine/sync-client.js +26 -6
- package/dist/core/memory-engine/sync.d.ts +20 -2
- package/dist/core/memory-engine/sync.js +18 -17
- package/dist/core/mode-policy.d.ts +25 -6
- package/dist/core/mode-policy.js +33 -8
- package/dist/core/model-seat.d.ts +8 -5
- package/dist/core/model-shell.d.ts +129 -0
- package/dist/core/model-shell.js +249 -0
- package/dist/core/mods/kernel/digest.d.ts +4 -0
- package/dist/core/mods/kernel/digest.js +5 -0
- package/dist/core/mods/kernel/dispatch.d.ts +3 -0
- package/dist/core/mods/kernel/dispatch.js +15 -6
- package/dist/core/mods/kernel/events.d.ts +21 -5
- package/dist/core/mods/kernel/events.js +19 -10
- package/dist/core/mods/kernel/hash-mirror.d.ts +1 -0
- package/dist/core/mods/kernel/hash-mirror.js +55 -0
- package/dist/core/mods/kernel/index.d.ts +1 -0
- package/dist/core/mods/kernel/index.js +1 -0
- package/dist/core/mods/kernel/package-reader.d.ts +48 -0
- package/dist/core/mods/kernel/package-reader.js +149 -0
- package/dist/core/mods/kernel/site-rules.d.ts +4 -0
- package/dist/core/mods/kernel/site-rules.js +13 -0
- package/dist/core/mods/package.d.ts +7 -3
- package/dist/core/mods/package.js +47 -80
- package/dist/core/own-property-receipt.js +11 -4
- package/dist/core/parent-spec-seat.d.ts +13 -11
- package/dist/core/parent-spec-seat.js +13 -9
- package/dist/core/peer-seat.js +3 -3
- package/dist/core/peer-task-store.d.ts +365 -0
- package/dist/core/peer-task-store.js +682 -0
- package/dist/core/permission-rule-consent.js +6 -11
- package/dist/core/permission-rule-model.d.ts +27 -0
- package/dist/core/permission-rule-model.js +33 -5
- package/dist/core/permission-rule-org.js +13 -3
- package/dist/core/permission-rule-provider.d.ts +35 -33
- package/dist/core/permission-rule-provider.js +38 -295
- package/dist/core/permission-rule-store.d.ts +181 -8
- package/dist/core/permission-rule-store.js +420 -17
- package/dist/core/permission-rule-sync.js +15 -1
- package/dist/core/permission-rules.js +4 -1
- package/dist/core/project-seat.d.ts +55 -0
- package/dist/core/project-seat.js +96 -0
- package/dist/core/protocol-http-auth.d.ts +3 -2
- package/dist/core/protocol-http-auth.js +26 -18
- package/dist/core/remote-env.d.ts +4 -4
- package/dist/core/retain-seat.d.ts +42 -0
- package/dist/core/retain-seat.js +76 -0
- package/dist/core/retired-keys.js +1 -0
- package/dist/core/rewind-refusal-codes.d.ts +8 -0
- package/dist/core/rewind-refusal-codes.js +12 -0
- package/dist/core/roles.d.ts +2 -2
- package/dist/core/roles.js +15 -1
- package/dist/core/rule-offer-read.d.ts +1 -1
- package/dist/core/rule-offer-read.js +32 -4
- package/dist/core/rule-store-fault.d.ts +9 -7
- package/dist/core/rule-store-fault.js +8 -3
- package/dist/core/run-ledger-seat.d.ts +66 -0
- package/dist/core/run-ledger-seat.js +70 -0
- package/dist/core/run-ledger.d.ts +332 -0
- package/dist/core/run-ledger.js +550 -0
- package/dist/core/runner/checkpoint-scope.d.ts +14 -3
- package/dist/core/runner/checkpoint-scope.js +16 -6
- package/dist/core/runner/compact-session.js +1 -1
- package/dist/core/runner/construction-doors.js +8 -0
- package/dist/core/runner/contracts.d.ts +21 -5
- package/dist/core/runner/cross-boundary-lane.d.ts +8 -1
- package/dist/core/runner/cross-boundary-lane.js +4 -0
- package/dist/core/runner/delegation-owner.d.ts +30 -0
- package/dist/core/runner/delegation-owner.js +20 -4
- package/dist/core/runner/finish-reason-seat.js +4 -2
- package/dist/core/runner/gate-exit.d.ts +7 -0
- package/dist/core/runner/gate-exit.js +2 -1
- package/dist/core/runner/leg-frame.js +3 -0
- package/dist/core/runner/model-lane-seat.d.ts +3 -0
- package/dist/core/runner/model-lane-seat.js +4 -0
- package/dist/core/runner/nested-memory-lane.d.ts +22 -5
- package/dist/core/runner/nested-memory-lane.js +91 -30
- package/dist/core/runner/person-path-rows.d.ts +27 -16
- package/dist/core/runner/person-path-rows.js +93 -15
- package/dist/core/runner/prepare-caps-and-workflow.js +98 -88
- package/dist/core/runner/prepare-config-doors.d.ts +1 -0
- package/dist/core/runner/prepare-config-doors.js +13 -7
- package/dist/core/runner/prepare-context-lane.js +1 -0
- package/dist/core/runner/prepare-delegation-surface.d.ts +3 -0
- package/dist/core/runner/prepare-delegation-surface.js +6 -0
- package/dist/core/runner/prepare-execution-env.d.ts +3 -3
- package/dist/core/runner/prepare-gate-stations.d.ts +6 -0
- package/dist/core/runner/prepare-gate-stations.js +3 -1
- package/dist/core/runner/prepare-hands-readface.d.ts +5 -2
- package/dist/core/runner/prepare-hands-readface.js +15 -3
- package/dist/core/runner/prepare-inherited-gate.d.ts +6 -3
- package/dist/core/runner/prepare-inherited-gate.js +13 -5
- package/dist/core/runner/prepare-offload-wrappers.js +1 -1
- package/dist/core/runner/prepare-run-refs.d.ts +1 -1
- package/dist/core/runner/prepare-run-refs.js +3 -2
- package/dist/core/runner/prepare-suspend-saga.d.ts +6 -2
- package/dist/core/runner/prepare-suspend-saga.js +4 -2
- package/dist/core/runner/prepare-task.js +42 -30
- package/dist/core/runner/prepare-turn-wiring.d.ts +4 -3
- package/dist/core/runner/prepare-turn-wiring.js +2 -1
- package/dist/core/runner/prepare-wiring-manifest.d.ts +3 -1
- package/dist/core/runner/prepare-wiring-manifest.js +8 -6
- package/dist/core/runner/resume-apply.js +11 -5
- package/dist/core/runner/resume-policy-outcome.js +5 -2
- package/dist/core/runner/resume-review-outcome.d.ts +3 -0
- package/dist/core/runner/resume-review-outcome.js +24 -1
- package/dist/core/runner/role-seat-defaulted.d.ts +3 -3
- package/dist/core/runner/role-seat-defaulted.js +1 -1
- package/dist/core/runner/rule-store-unreadable-notice.d.ts +1 -1
- package/dist/core/runner/rule-store-unreadable-notice.js +3 -3
- package/dist/core/runner/run-harness-handlers.js +4 -1
- package/dist/core/runner/run-identity-wiring.js +3 -2
- package/dist/core/runner/run-leg.js +5 -2
- package/dist/core/runner/run-notification-lane.js +20 -1
- package/dist/core/runner/run-settle-and-teardown.js +21 -12
- package/dist/core/runner/run-stop-and-final-verify.js +6 -0
- package/dist/core/runner/run-telemetry-and-budget-seats.js +1 -1
- package/dist/core/runner/runtask.d.ts +6 -2
- package/dist/core/runner/runtask.js +21 -9
- package/dist/core/runner/shell-env-withheld.d.ts +6 -4
- package/dist/core/runner/shell-env-withheld.js +25 -3
- package/dist/core/runner/stop-tail-notice.d.ts +10 -2
- package/dist/core/runner/stop-tail-notice.js +9 -2
- package/dist/core/runner/stream-settle-backstop.d.ts +1 -0
- package/dist/core/runner/stream-settle-backstop.js +1 -0
- package/dist/core/runner/sub-agent-deny-lists.js +9 -5
- package/dist/core/runner/task-start-doors.js +6 -3
- package/dist/core/runner/terminal-account.d.ts +6 -1
- package/dist/core/runner/terminal-account.js +16 -1
- package/dist/core/runner/tool-end-body.d.ts +1 -1
- package/dist/core/runner/tool-not-executed.d.ts +27 -8
- package/dist/core/runner/tool-not-executed.js +22 -11
- package/dist/core/runner/unreadable-person-rows.d.ts +2 -1
- package/dist/core/runner/write-protection-station.d.ts +1 -1
- package/dist/core/runner/write-protection-station.js +1 -1
- package/dist/core/runner-deps.d.ts +17 -10
- package/dist/core/secret-env.d.ts +61 -37
- package/dist/core/secret-env.js +49 -49
- package/dist/core/session-checkout.d.ts +3 -0
- package/dist/core/session-checkout.js +1 -0
- package/dist/core/session-store.d.ts +12 -6
- package/dist/core/session-store.js +26 -6
- package/dist/core/session.d.ts +31 -8
- package/dist/core/shell-read-silence.d.ts +40 -2
- package/dist/core/shell-read-silence.js +23 -4
- package/dist/core/store-contracts/checkpoint-store-contract.js +10 -0
- package/dist/core/store-contracts/peer-task-store-contract.d.ts +21 -0
- package/dist/core/store-contracts/peer-task-store-contract.js +516 -0
- package/dist/core/store-contracts/session-store-contract.d.ts +15 -2
- package/dist/core/store-contracts/session-store-contract.js +87 -3
- package/dist/core/store-contracts/workflow-journal-store-contract.d.ts +19 -1
- package/dist/core/store-contracts/workflow-journal-store-contract.js +89 -1
- package/dist/core/task-event.d.ts +14 -7
- package/dist/core/task-notification.d.ts +96 -10
- package/dist/core/task-notification.js +135 -6
- package/dist/core/task-registry-agent.d.ts +1 -0
- package/dist/core/task-registry-agent.js +1 -1
- package/dist/core/task-registry-shared.d.ts +12 -1
- package/dist/core/task-registry-shared.js +3 -1
- package/dist/core/task-registry-workflow.d.ts +1 -1
- package/dist/core/task-registry-workflow.js +9 -1
- package/dist/core/task-registry.d.ts +40 -2
- package/dist/core/task-registry.js +80 -15
- package/dist/core/task-result.d.ts +18 -3
- package/dist/core/task-spec-members.d.ts +3 -1
- package/dist/core/task-spec-members.js +19 -3
- package/dist/core/task-spec.d.ts +48 -22
- package/dist/core/tool-catalog-entries.js +2 -0
- package/dist/core/tool-gate-phase.d.ts +6 -3
- package/dist/core/tool-gate-phase.js +1 -0
- package/dist/core/tool-mount-facts.d.ts +8 -4
- package/dist/core/tool-mount-facts.js +7 -2
- package/dist/core/tool-mount-plan.d.ts +3 -1
- package/dist/core/tool-mount-plan.js +10 -3
- package/dist/core/tool-mount-static.d.ts +1 -1
- package/dist/core/tool-mount-static.js +4 -2
- package/dist/core/tool-result-store.d.ts +56 -3
- package/dist/core/tool-result-store.js +219 -25
- package/dist/core/tool-spec.d.ts +9 -2
- package/dist/core/trace.d.ts +3 -3
- package/dist/core/user-attachment.d.ts +5 -1
- package/dist/core/user-attachment.js +14 -7
- package/dist/core/wiring-manifest.d.ts +26 -20
- package/dist/core/wiring-manifest.js +7 -3
- package/dist/core/workflow-journal-store.d.ts +53 -10
- package/dist/core/workflow-journal-store.js +27 -4
- package/dist/core/workflow-run-store-contract.js +16 -0
- package/dist/core/workflow-run-store.d.ts +9 -7
- package/dist/core/workflow-run-store.js +4 -1
- package/dist/engine/execution-env/node-execution-env.d.ts +75 -1
- package/dist/engine/execution-env/node-execution-env.js +227 -13
- package/dist/engine/harness/types.d.ts +49 -1
- package/dist/engine/harness/types.js +10 -0
- package/dist/engine/llm/types.d.ts +13 -7
- package/dist/engine/llm/validation.d.ts +8 -1
- package/dist/engine/llm/validation.js +31 -2
- package/dist/engine/lsp/node-lsp-manager.js +2 -1
- package/dist/engine/session/import-validate.js +6 -1
- package/dist/engine/session/session.d.ts +15 -2
- package/dist/engine/session/session.js +34 -4
- package/dist/host-env.d.ts +10 -0
- package/dist/host-env.js +1 -0
- package/dist/index.d.ts +28 -9
- package/dist/index.js +22 -6
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/orchestration/goal.js +1 -1
- package/dist/orchestration/run-workflow-tool.js +40 -32
- package/dist/orchestration/workflow-park-adoption.d.ts +51 -12
- package/dist/orchestration/workflow-park-adoption.js +47 -12
- package/dist/orchestration/workflow-primitives.js +10 -1
- package/dist/orchestration/workflow-script-runner.d.ts +2 -2
- package/dist/orchestration/workflow-stop.d.ts +128 -0
- package/dist/orchestration/workflow-stop.js +156 -0
- package/dist/orchestration/workflow.d.ts +31 -7
- package/dist/orchestration/workflow.js +119 -57
- package/dist/prompts/manager-recipe.d.ts +18 -0
- package/dist/prompts/manager-recipe.js +24 -0
- package/dist/shell/lex.d.ts +2 -2
- package/dist/shell/lex.js +1 -1
- package/dist/stores/file/permission-rule-store.d.ts +3 -1
- package/dist/stores/file/permission-rule-store.js +0 -1
- package/dist/stores/file/workflow-journal-store.d.ts +16 -3
- package/dist/stores/file/workflow-journal-store.js +93 -5
- package/dist/stores/file/workflow-run-store.d.ts +1 -1
- package/dist/tools/fs/bash-model-shell.d.ts +23 -0
- package/dist/tools/fs/bash-model-shell.js +25 -0
- package/dist/tools/fs/bash-readonly-classifier.d.ts +6 -0
- package/dist/tools/fs/bash-readonly-classifier.js +3 -0
- package/dist/tools/fs/file-write-check.js +9 -3
- package/dist/tools/fs/fs-bash.js +13 -11
- package/dist/tools/fs/index.d.ts +8 -7
- package/dist/tools/fs/index.js +4 -4
- package/dist/tools/fs/read-deny-home.d.ts +1 -1
- package/dist/tools/fs/read-deny-home.js +5 -5
- package/dist/tools/fs/read-deny.d.ts +33 -8
- package/dist/tools/fs/read-deny.js +114 -25
- package/dist/tools/fs/safety.d.ts +4 -1
- package/dist/tools/fs/safety.js +4 -2
- package/dist/tools/fs/shell-read-argv.js +1 -0
- package/dist/tools/fs/shell-read-check.d.ts +9 -2
- package/dist/tools/fs/shell-read-check.js +134 -22
- package/dist/tools/fs/shell-read-establish.d.ts +9 -0
- package/dist/tools/fs/shell-read-establish.js +21 -11
- package/dist/tools/fs/shell-read-judge.d.ts +13 -1
- package/dist/tools/fs/shell-read-judge.js +26 -7
- package/dist/tools/fs/shell-read-plan.d.ts +7 -3
- package/dist/tools/fs/shell-read-plan.js +8 -5
- package/dist/tools/fs/shell-read-word.d.ts +8 -0
- package/dist/tools/fs/shell-read-word.js +13 -4
- package/dist/tools/fs/shell-read-write-targets.js +17 -9
- package/dist/tools/monitor.js +12 -8
- package/dist/tools/scheduler-tools.d.ts +1 -0
- package/dist/tools/scheduler-tools.js +5 -2
- package/package.json +3 -2
- package/test/export-surface.snapshot.json +192 -3
- package/wire-changes/answers/core-stores-sql@7.73.0.json +28 -0
- package/wire-changes/answers/core-stores-sql@7.74.0.json +7 -0
- package/wire-changes/answers/core@7.73.0.json +216 -0
- package/wire-changes/answers/core@7.74.0.json +68 -0
- package/wire-changes/answers/mods-kernel@7.73.0.json +7 -0
- package/wire-changes/answers/mods-kernel@7.74.0.json +21 -0
- package/wire-changes/answers/primitives@7.73.0.json +12 -0
- package/wire-changes/answers/primitives@7.74.0.json +7 -0
- package/wire-changes/answers/wiki-gate@7.73.0.json +7 -0
- package/wire-changes/answers/wiki-gate@7.74.0.json +8 -0
- package/wire-changes/core-stores-sql@7.73.0.json +326 -0
- package/wire-changes/core-stores-sql@7.74.0.json +143 -0
- package/wire-changes/core@7.73.0.json +6480 -0
- package/wire-changes/core@7.74.0.json +2210 -0
- package/wire-changes/mods-kernel@7.73.0.json +147 -0
- package/wire-changes/mods-kernel@7.74.0.json +421 -0
- package/wire-changes/primitives@7.73.0.json +227 -0
- package/wire-changes/primitives@7.74.0.json +174 -0
- package/wire-changes/wiki-gate@7.73.0.json +145 -0
- package/wire-changes/wiki-gate@7.74.0.json +145 -0
|
@@ -64,19 +64,32 @@ export function judgeRead(read, boundary) {
|
|
|
64
64
|
if (pattern !== null)
|
|
65
65
|
return { read, kind: "deny_hit", deny: { pattern, matchedView: folded, ...(writeTarget ? { face: "write", ...(boundary.writeDenyGuardsReads?.(pattern) === true ? { readRow: true } : {}) } : {}) }, containment: writeTarget ? writeContainmentOf(read, boundary) : containmentOf(read, boundary) };
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
const checksUnder = writeTarget ? read.candidate.subtree !== undefined && read.written !== undefined : read.candidate.provenance === "traversal_root";
|
|
68
|
+
const denyUnder = writeTarget ? boundary.writeDenyUnder : boundary.denyUnder;
|
|
69
|
+
if (checksUnder && denyUnder !== undefined) {
|
|
68
70
|
let unplaced;
|
|
69
71
|
for (const view of [...(read.target !== undefined ? [read.target] : []), ...read.spellings, ...(read.hops ?? [])]) {
|
|
70
72
|
const folded = normalizeAbsPathLexically(view);
|
|
71
|
-
const under =
|
|
72
|
-
if (typeof under === "string")
|
|
73
|
-
return {
|
|
73
|
+
const under = denyUnder(folded);
|
|
74
|
+
if (typeof under === "string") {
|
|
75
|
+
return {
|
|
76
|
+
read,
|
|
77
|
+
kind: "deny_hit",
|
|
78
|
+
deny: {
|
|
79
|
+
pattern: under,
|
|
80
|
+
matchedView: folded,
|
|
81
|
+
under: true,
|
|
82
|
+
...(writeTarget ? { face: "write", ...(boundary.writeDenyGuardsReads?.(under) === true ? { readRow: true } : {}) } : {}),
|
|
83
|
+
},
|
|
84
|
+
containment: writeTarget ? writeContainmentOf(read, boundary) : containmentOf(read, boundary),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
74
87
|
if (under !== null && typeof under === "object")
|
|
75
88
|
unplaced ??= under.unplaced;
|
|
76
89
|
}
|
|
77
90
|
if (unplaced !== undefined) {
|
|
78
91
|
const cause = `the home-anchored deny row "${unplaced}" cannot be placed (no home directory is known for this environment), so "${read.target ?? read.candidate.spelled}" may hold it`;
|
|
79
|
-
return { read: { ...read, cause }, kind: "unanswered", denyRowUnasked: true, containment: containmentOf(read, boundary) };
|
|
92
|
+
return { read: { ...read, cause }, kind: "unanswered", denyRowUnasked: true, containment: writeTarget ? writeContainmentOf(read, boundary) : containmentOf(read, boundary) };
|
|
80
93
|
}
|
|
81
94
|
}
|
|
82
95
|
}
|
|
@@ -138,14 +151,20 @@ function personAllowAdmits(read, boundary) {
|
|
|
138
151
|
return hit !== undefined && hit.unreadable === undefined;
|
|
139
152
|
}
|
|
140
153
|
export function denyRowAtOrBelow(read, boundary, carriesContent) {
|
|
141
|
-
|
|
154
|
+
const views = [...(read.target !== undefined ? [read.target] : []), ...read.spellings];
|
|
155
|
+
if (boundary.writeDenyAtOrBelow !== undefined) {
|
|
156
|
+
if (views.some((view) => boundary.writeDenyAtOrBelow(normalizeAbsPathLexically(view)) !== null))
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
else if (boundary.writeDenyMatch !== undefined) {
|
|
142
160
|
return true;
|
|
161
|
+
}
|
|
143
162
|
if (!carriesContent)
|
|
144
163
|
return false;
|
|
145
164
|
const atOrBelow = boundary.denyAtOrBelow;
|
|
146
165
|
if (atOrBelow === undefined)
|
|
147
166
|
return false;
|
|
148
|
-
return
|
|
167
|
+
return views.some((view) => atOrBelow(normalizeAbsPathLexically(view)) !== null);
|
|
149
168
|
}
|
|
150
169
|
export function denyFloorShadowsOf(candidates) {
|
|
151
170
|
return candidates.flatMap((c) => (c.floorSpelled === undefined ? [] : [{ spelled: c.floorSpelled, raw: c.raw, provenance: c.provenance, expands: globInWord(readOfText(c.raw).word) ? "glob" : false, bases: [], denyOnly: true, ...(c.face !== undefined ? { face: c.face } : {}), ...(c.face === "write" && c.expands === "unresolvable" && !/[$`]/.test(c.floorSpelled) ? { twin: true } : {}) }]));
|
|
@@ -63,9 +63,8 @@ export interface ReadCandidate {
|
|
|
63
63
|
/** The raw spelling, quotes retained — where "is this metacharacter quoted" is still answerable. */
|
|
64
64
|
readonly raw: string;
|
|
65
65
|
readonly provenance: ReadCandidateProvenance;
|
|
66
|
-
/** `"glob"` = an unquoted pathname-expansion character; `"unresolvable"` = the shell rewrites the word
|
|
67
|
-
|
|
68
|
-
readonly expands: false | "glob" | "unresolvable";
|
|
66
|
+
/** `"glob"` = an unquoted pathname-expansion character; `"unresolvable"` = the shell rewrites the word (brace/variable/command substitution) so its text is not the path. */ readonly expands: false | "glob" | "unresolvable";
|
|
67
|
+
/** The shell matches this word as a pathname pattern holding a BRACKET expression — an unquoted `[` with an unquoted `]` after it, written in the word itself or in the pattern a value hands over (an unquoted expansion's value; a name a `for` list, `set --` or an array bound to a pattern's matches); never beside `expands: false`, and only on a word of the shell's own text (a name inside a program's script, an assignment's value and a field a split value hands over carry none). Absent ⇒ no such bracket. */ readonly bracket?: true;
|
|
69
68
|
/** The working directories this word may be relative to (a candidate SET where a `cd` could not be proven);
|
|
70
69
|
* EMPTY for an absolute or home-rooted spelling; `"unmodelled"` for a relative word in a segment whose base the
|
|
71
70
|
* text does not settle (an unfollowable move before it, a loop this parser cannot count) — it cannot be placed. */
|
|
@@ -101,6 +100,11 @@ export interface ReadCandidate {
|
|
|
101
100
|
/** A WRITE target (a `>`-family redirection, a `sed` `w` file, a file-writing command's operand): established like a
|
|
102
101
|
* read, judged on the WRITE face — the write deny rows, then the write roots where written — never as a read. */
|
|
103
102
|
readonly face?: "write";
|
|
103
|
+
/** On a write target: the command takes the entire subtree at this path with it — `removed` (`rm -r`, `find -delete`'s
|
|
104
|
+
* starting points) or `moved` (an `mv` source) — so a write-facing deny row whose location lies beneath it refuses the
|
|
105
|
+
* operation ({@link ShellReadBoundary.writeDenyUnder}); below a `removed` one an unanchored row is also searched for by
|
|
106
|
+
* name ({@link ShellReadBoundary.writeDenyNamed}). A moved subtree keeps its names, so an unanchored row still meets them. */
|
|
107
|
+
readonly subtree?: "removed" | "moved";
|
|
104
108
|
/** A reading the station takes where no row says the program opens the word — a word of a program with no row, a
|
|
105
109
|
* role only another implementation reads — so the filesystem decides it: `containment` = the spelling always meets
|
|
106
110
|
* the deny rows and is a containment candidate only where it exists; `whole` = a whole word (`NAME=value`, an option
|
|
@@ -889,14 +889,17 @@ function segmentFactsRead(segment, p, decl, table, nestedPlan, fed, toks, inheri
|
|
|
889
889
|
});
|
|
890
890
|
}
|
|
891
891
|
function dedupe(reads) {
|
|
892
|
-
const
|
|
892
|
+
const at = new Map();
|
|
893
893
|
const out = [];
|
|
894
894
|
for (const c of reads) {
|
|
895
895
|
const key = `${c.provenance}\u0000${c.spelled}\u0000${c.expands}\u0000${c.raw}\u0000${c.denyOnly === true}`;
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
896
|
+
const i = at.get(key);
|
|
897
|
+
if (i === undefined) {
|
|
898
|
+
at.set(key, out.length);
|
|
899
|
+
out.push(c);
|
|
900
|
+
}
|
|
901
|
+
else if (c.bracket === true && out[i].bracket !== true)
|
|
902
|
+
out[i] = { ...out[i], bracket: true };
|
|
900
903
|
}
|
|
901
904
|
return out;
|
|
902
905
|
}
|
|
@@ -21,6 +21,10 @@ export interface Read {
|
|
|
21
21
|
* any one character — {@link LexedWord.judged}, {@link judgedSpellingOf}); `folded` stays the name opened where none match. */
|
|
22
22
|
readonly pattern?: string;
|
|
23
23
|
readonly expands: WordExpands;
|
|
24
|
+
/** The shell matches the word as a pattern holding a bracket expression ({@link import("./shell-read-plan.js").ReadCandidate.bracket}):
|
|
25
|
+
* read off the word's own pieces ({@link bracketInWord}) and off the pattern runs of the values its names hand over
|
|
26
|
+
* ({@link bracketInValue}). Absent ⇒ none, or not a word of the shell's own text ({@link readOfText}). */
|
|
27
|
+
readonly bracket?: true;
|
|
24
28
|
/** The names the word refers to were read through the table: its expansion IS the spelling above (and, where the
|
|
25
29
|
* names may hold several values, {@link values}). */
|
|
26
30
|
readonly settled?: true;
|
|
@@ -123,6 +127,10 @@ export declare function spelledWithHome(spelled: string, raw: string, home: stri
|
|
|
123
127
|
* arithmetic expression (`$((2*(3+4)))`), which bash evaluates and never globs. An assignment word is read as the words it
|
|
124
128
|
* stores ({@link assignedWords}): a compound value's elements each as the scalar assignment of the same text. */
|
|
125
129
|
export declare function unreadableSentenceOf(lexed: LexedCommand, text: string, globs?: boolean): string | undefined;
|
|
130
|
+
/** Does a value hand the shell a pattern holding a bracket expression — a run the shell matches as a pattern (a part marked
|
|
131
|
+
* `pattern`: an unquoted expansion's text, a pattern piece as written, a `for` list's or an array's pattern) with a `[` and a
|
|
132
|
+
* `]` after it? A quoted run is literal text and holds none. */
|
|
133
|
+
export declare function bracketInValue(v: BoundValue): boolean;
|
|
126
134
|
/** The mark a settled value carries: `"glob"` when an unquoted pathname-expansion character survives in it. */
|
|
127
135
|
export declare function globMark(glob: boolean): WordExpands;
|
|
128
136
|
/** What the shell does to a word (or an assignment's value) before the program sees it, read off its pieces: the
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import { argvOf, assignedWords, lexShell, literalTildeSpelling, UNRESOLVED_SENTENCE } from "../../shell/lex.js";
|
|
2
|
-
import { expansionInWord, extglobOpenerIn, globInWord, homeExpansionOf } from "./bash-readonly-classifier.js";
|
|
2
|
+
import { bracketInWord, expansionInWord, extglobOpenerIn, globInWord, homeExpansionOf } from "./bash-readonly-classifier.js";
|
|
3
3
|
import { floorOf, isEmptyFloor, joinFloors, judgedSpellingOf, NO_FLOOR, namesIn, wordFloorValues, wordValues } from "./shell-read-bindings.js";
|
|
4
4
|
import { READINGS_MAX } from "./shell-read-brace.js";
|
|
5
5
|
export function readsOf(words, table, homeDir, split = false) {
|
|
6
6
|
return words.map((word) => {
|
|
7
7
|
const refersToName = word.pieces.some((p) => p.expansion?.kind === "parameter") || namesIn(word).length > 0;
|
|
8
8
|
const asWritten = { word, raw: word.raw, folded: word.folded, ...(word.judged !== undefined ? { pattern: word.judged } : {}) };
|
|
9
|
+
const written = () => {
|
|
10
|
+
const expands = expandsOf(word);
|
|
11
|
+
return { expands, ...(expands !== "unresolvable" && bracketInWord(word) ? { bracket: true } : {}) };
|
|
12
|
+
};
|
|
9
13
|
if (!refersToName && table?.homeTouched !== true)
|
|
10
|
-
return { ...asWritten,
|
|
14
|
+
return { ...asWritten, ...written() };
|
|
11
15
|
const values = wordValues(word, table, false, undefined, split);
|
|
12
16
|
if (values === undefined)
|
|
13
|
-
return { ...asWritten,
|
|
17
|
+
return { ...asWritten, ...written() };
|
|
14
18
|
if (values === "unknown") {
|
|
15
19
|
const floor = refersToName ? wordFloorValues(word, table) : NO_FLOOR;
|
|
16
|
-
return { ...asWritten,
|
|
20
|
+
return { ...asWritten, ...(refersToName ? { expands: "unresolvable" } : written()), ...(floor.values.length > 0 ? { floorValues: floor.values } : {}), ...(floor.pastBound ? { floorPastBound: true } : {}) };
|
|
17
21
|
}
|
|
18
22
|
const glob = values.some((v) => v.glob === true) || globInWord(word);
|
|
23
|
+
const bracket = glob && (bracketInWord(word) || values.some(bracketInValue));
|
|
19
24
|
const refersToHome = word.pieces.some((p) => p.expansion?.kind === "tilde" || (p.expansion?.kind === "parameter" && p.expansion.name === "HOME"));
|
|
20
25
|
const declared = refersToHome && homeDir !== undefined && table?.homeTouched === true ? wordValues(word, table, false, new Map([["HOME", [{ spelled: homeDir }]]])) : undefined;
|
|
21
26
|
const floor = declared !== undefined && declared !== "unknown" && declared[0] !== undefined ? spellingOf(declared[0]) : undefined;
|
|
@@ -26,6 +31,7 @@ export function readsOf(words, table, homeDir, split = false) {
|
|
|
26
31
|
folded: spellingOf(values[0]),
|
|
27
32
|
...(pattern !== undefined ? { pattern } : {}),
|
|
28
33
|
expands: globMark(glob),
|
|
34
|
+
...(bracket ? { bracket: true } : {}),
|
|
29
35
|
settled: true,
|
|
30
36
|
values,
|
|
31
37
|
...(floor !== undefined && !values.every((v) => spellingOf(v) === floor) ? { homeFloor: floor } : {}),
|
|
@@ -160,6 +166,9 @@ export function unreadableSentenceOf(lexed, text, globs = true) {
|
|
|
160
166
|
}
|
|
161
167
|
return globs && extglobOpenerIn(lexed, text) ? "an extended pattern (`?(…)` `*(…)` `+(…)` `@(…)` `!(…)`) is one this reader does not expand" : undefined;
|
|
162
168
|
}
|
|
169
|
+
export function bracketInValue(v) {
|
|
170
|
+
return v.glob === true && v.parts.some((p) => p.pattern && /\[[\s\S]*\]/.test(p.text));
|
|
171
|
+
}
|
|
163
172
|
export function globMark(glob) {
|
|
164
173
|
return glob ? "glob" : false;
|
|
165
174
|
}
|
|
@@ -51,7 +51,7 @@ function writeOwnersOf(segment) {
|
|
|
51
51
|
function writeTargetsOf(segment) {
|
|
52
52
|
const out = [];
|
|
53
53
|
const writeOnly = new Set();
|
|
54
|
-
const write = (c, seats, written, child, onlyIf, through) => void out.push({ candidate: { ...c, face: "write", ...(through === true ? { through } : {}) }, ...(seats !== undefined ? { seats } : {}), ...(written !== undefined ? { written } : {}), ...(child === true ? { child } : {}), ...(onlyIf !== undefined ? { onlyIf } : {}) });
|
|
54
|
+
const write = (c, seats, written, child, onlyIf, through, subtree) => void out.push({ candidate: { ...c, face: "write", ...(through === true ? { through } : {}), ...(subtree !== undefined ? { subtree } : {}) }, ...(seats !== undefined ? { seats } : {}), ...(written !== undefined ? { written } : {}), ...(child === true ? { child } : {}), ...(onlyIf !== undefined ? { onlyIf } : {}) });
|
|
55
55
|
for (const r of segment.redirects)
|
|
56
56
|
if (r.direction === "out" && r.target !== undefined)
|
|
57
57
|
write(r.target, undefined, undefined, undefined, undefined, true);
|
|
@@ -63,7 +63,8 @@ function writeTargetsOf(segment) {
|
|
|
63
63
|
const all = writeReadings(row, args);
|
|
64
64
|
const selected = implementationsOf(row).flatMap((view) => selectedOptions(view, args, "one-implementation"));
|
|
65
65
|
const moved = [...new Set(selected.flatMap((o) => o.writesAt ?? []))];
|
|
66
|
-
|
|
66
|
+
const recursiveRemove = row.key === "rm" && selected.some((o) => o.selects === "traversal");
|
|
67
|
+
return { row, words, program, all, readings: all.filter((r) => r.written.length > 0 || (r.unexplained && r.operandRole !== undefined)), override: moved.length > 0 ? moved : undefined, beyondOperands: selected.some((o) => o.effect === "writes" || o.effect === "executes"), recursiveRemove };
|
|
67
68
|
});
|
|
68
69
|
const edited = new Map();
|
|
69
70
|
for (const c of segment.reads) {
|
|
@@ -99,7 +100,8 @@ function writeTargetsOf(segment) {
|
|
|
99
100
|
const seats = stated ? [...new Set(roles.flatMap((role) => o.override ?? role.seats ?? ["landing"]))] : undefined;
|
|
100
101
|
const written = unexplained || roles.some((role) => role.writtenAt === undefined) ? undefined : [...new Set(roles.flatMap((role) => role.writtenAt ?? []))];
|
|
101
102
|
const speculative = readings < o.all.length && roles.every((role) => role.effect === "edit-in-place") ? { candidate: c, holds: "present" } : undefined;
|
|
102
|
-
|
|
103
|
+
const subtree = o.recursiveRemove ? "removed" : o.row.key === "mv" && (unexplained || o.all.some((r) => r.copy !== undefined && r.copy.sources.some((idx) => at.has(idx)))) ? "moved" : undefined;
|
|
104
|
+
write(c, seats, written, undefined, speculative, !unexplained && writesThrough(roles, o.row, o.words) ? true : undefined, subtree);
|
|
103
105
|
if (roles.some((role) => role.effect === "edit-in-place") && c.expands === false)
|
|
104
106
|
edited.set(o, [...(edited.get(o) ?? []), { candidate: c, ...(speculative !== undefined ? { onlyIf: speculative } : {}) }]);
|
|
105
107
|
}
|
|
@@ -107,12 +109,12 @@ function writeTargetsOf(segment) {
|
|
|
107
109
|
writeOnly.add(c);
|
|
108
110
|
}
|
|
109
111
|
for (const o of owners) {
|
|
110
|
-
for (const
|
|
111
|
-
write(
|
|
112
|
+
for (const { candidate, onlyIf } of copyDestinationChildren(segment, o.row, o.words, o.all))
|
|
113
|
+
write(candidate, ["landing", "entry"], undefined, true, onlyIf);
|
|
112
114
|
out.push(...backupTargetsOf(edited.get(o) ?? [], o.readings, o.override));
|
|
113
115
|
}
|
|
114
116
|
for (const c of walkRemovalTargetsOf(segment))
|
|
115
|
-
write(c, ["landing", "entry"]);
|
|
117
|
+
write(c, ["landing", "entry"], undefined, undefined, undefined, undefined, "removed");
|
|
116
118
|
const readWords = new Set();
|
|
117
119
|
for (const o of owners) {
|
|
118
120
|
if (!o.program)
|
|
@@ -140,6 +142,11 @@ function copyDestinationChildren(segment, row, words, readings) {
|
|
|
140
142
|
const candidateOf = (raw) => segment.reads.find((c) => c.raw === raw && WORD_PROVENANCES.has(c.provenance));
|
|
141
143
|
const start = segment.programStart;
|
|
142
144
|
const children = new Map();
|
|
145
|
+
const keep = (key, candidate, onlyIf) => {
|
|
146
|
+
const prev = children.get(key);
|
|
147
|
+
if (prev === undefined || (prev.onlyIf !== undefined && onlyIf === undefined))
|
|
148
|
+
children.set(key, onlyIf !== undefined ? { candidate, onlyIf } : { candidate });
|
|
149
|
+
};
|
|
143
150
|
for (const r of readings) {
|
|
144
151
|
if (r.copy === undefined)
|
|
145
152
|
continue;
|
|
@@ -152,18 +159,19 @@ function copyDestinationChildren(segment, row, words, readings) {
|
|
|
152
159
|
const destRole = r.written.find((w) => w.at === destination?.at)?.role;
|
|
153
160
|
if (destCandidate !== undefined && destRole !== undefined && passesUnasked({ ...destCandidate, face: "write", ...(writesThrough([destRole], row, words) ? { through: true } : {}) }))
|
|
154
161
|
continue;
|
|
162
|
+
const destDirFact = destination !== undefined && destCandidate !== undefined ? { candidate: destCandidate, holds: "directory" } : undefined;
|
|
155
163
|
for (const at of sources) {
|
|
156
164
|
const src = words[at];
|
|
157
165
|
const source = candidateOf(src.raw);
|
|
158
166
|
if (source !== undefined && source.expands !== false) {
|
|
159
167
|
if (destination !== undefined)
|
|
160
168
|
continue;
|
|
161
|
-
|
|
169
|
+
keep(`\0${source.raw}`, source);
|
|
162
170
|
}
|
|
163
171
|
const child = `${dest.spelled.replace(/\/+$/, "")}/${src.spelled.replace(/\/+$/, "").split("/").pop() ?? ""}`;
|
|
164
|
-
if (child.endsWith("/")
|
|
172
|
+
if (child.endsWith("/"))
|
|
165
173
|
continue;
|
|
166
|
-
|
|
174
|
+
keep(child, destCandidate !== undefined && source !== undefined ? renamed(destCandidate, child) : { spelled: child, raw: src.raw, provenance: "unlisted_word", expands: "unresolvable", bases: [] }, destDirFact);
|
|
167
175
|
}
|
|
168
176
|
}
|
|
169
177
|
return [...children.values()];
|
package/dist/tools/monitor.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
import { defineTool, errorResult } from "../core/tools.js";
|
|
3
|
-
import { createBackgroundOutputFile, envDeclaresRetain, hasBackgroundShell, retainsBackgroundProcesses } from "../core/background-shell.js";
|
|
3
|
+
import { BackgroundShellError, createBackgroundOutputFile, envDeclaresRetain, hasBackgroundShell, retainsBackgroundProcesses } from "../core/background-shell.js";
|
|
4
|
+
import { MODEL_SHELL_UNDECLARED_REFUSAL, modelShellOf, startsInBackground } from "../core/model-shell.js";
|
|
4
5
|
import { MONITOR_DEFAULT_TIMEOUT_MS, MONITOR_MAX_TIMEOUT_MS, } from "../core/task-registry.js";
|
|
5
6
|
import { admitsBackgroundLaunch, resolveCompletionSink } from "../core/task-notification.js";
|
|
6
7
|
import { toolFace } from "../core/tool-catalog-entries.js";
|
|
@@ -70,7 +71,8 @@ export function createMonitorTool(env, opts) {
|
|
|
70
71
|
}),
|
|
71
72
|
execute: async (args, ctx) => {
|
|
72
73
|
const { command, description, timeout_ms, persistent } = args;
|
|
73
|
-
|
|
74
|
+
const start = modelShellOf(env);
|
|
75
|
+
if (!hasBackgroundShell(env) || (start !== undefined && !startsInBackground(start))) {
|
|
74
76
|
return errorResult("Error (Monitor): this environment does not support background processes.");
|
|
75
77
|
}
|
|
76
78
|
const onNotify = resolveCompletionSink(ctx.onTaskNotification, opts.onTaskNotification);
|
|
@@ -93,12 +95,14 @@ export function createMonitorTool(env, opts) {
|
|
|
93
95
|
const sandbox = opts.commandSandbox?.start();
|
|
94
96
|
if (sandbox !== undefined && !sandbox.ok)
|
|
95
97
|
return errorResult(sandboxRefusalText("Monitor", { by: "plan", reason: sandbox.reason }), { type: "monitor-start", sandboxUnavailable: true });
|
|
96
|
-
const spawn =
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
const spawn = startsInBackground(start)
|
|
99
|
+
? await start.spawnBackground(command, {
|
|
100
|
+
...(opts.cwdRef !== undefined ? { cwd: opts.cwdRef.current } : {}),
|
|
101
|
+
...(spawnTimeoutSec !== undefined ? { timeout: spawnTimeoutSec } : {}),
|
|
102
|
+
...(readFloor !== undefined ? { readFloor } : {}),
|
|
103
|
+
...(sandbox?.sandbox !== undefined ? { sandbox: sandbox.sandbox } : {}),
|
|
104
|
+
})
|
|
105
|
+
: { ok: false, error: new BackgroundShellError("spawn_failed", MODEL_SHELL_UNDECLARED_REFUSAL) };
|
|
102
106
|
if (!spawn.ok) {
|
|
103
107
|
if (spawn.error.code === "sandbox_unavailable") {
|
|
104
108
|
const detail = envErrorDetail(spawn.error.message);
|
|
@@ -96,6 +96,7 @@ export declare function cutToUnits(text: string, limit: number): string;
|
|
|
96
96
|
* cron → 人话(CC utils/cron.ts cronToHuman:218-308 类比,收窄到常见形态):"star/N * * * *"→"every N minutes"、
|
|
97
97
|
* "M star/N * * *"→"every N hours"、`M H * * *`→"daily at H:MM"、`M H * * D`→"weekly on <day> at H:MM"、
|
|
98
98
|
* `M H * * 1-5`→"weekdays at H:MM";其余原样返回(调用方以 `human !== expr` 判断是否可译);收 backend 的 `cron <expr>` 显示串(见 {@link cronExprFromSummary})。
|
|
99
|
+
* 只译引擎文法收的表达式({@link isValidCronExpr}):文法拒的串(分钟 61、小时 25、星期 8)原样返回,不给假人话。
|
|
99
100
|
*/
|
|
100
101
|
export declare function cronToHuman(expr: string): string;
|
|
101
102
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
import { defineTool, errorResult } from "../core/tools.js";
|
|
3
|
-
import { CRON_FIELD_SEPARATOR, cronIntakeRefusal } from "../core/cron.js";
|
|
3
|
+
import { CRON_FIELD_SEPARATOR, cronIntakeRefusal, isValidCronExpr } from "../core/cron.js";
|
|
4
4
|
import { declaresLaneKeys, describeScopeKeys, readSchedulerDeclaration, SchedulerError, } from "../core/scheduler.js";
|
|
5
5
|
import { mountRuleFace, toolFace } from "../core/tool-catalog-entries.js";
|
|
6
6
|
import { legIdentityOf, scopeKeyOf } from "../core/isolation-scope.js";
|
|
@@ -206,7 +206,10 @@ function promptGlimpse(text) {
|
|
|
206
206
|
return end === -1 ? cutToUnits(text, PROMPT_GLIMPSE_UNITS) : cutToUnits(`${text.slice(0, end)}…`, PROMPT_GLIMPSE_UNITS);
|
|
207
207
|
}
|
|
208
208
|
export function cronToHuman(expr) {
|
|
209
|
-
const
|
|
209
|
+
const bare = cronExprFromSummary(expr);
|
|
210
|
+
if (!isValidCronExpr(bare))
|
|
211
|
+
return expr;
|
|
212
|
+
const std = bare.split(CRON_FIELD_SEPARATOR);
|
|
210
213
|
if (std.length !== 5)
|
|
211
214
|
return expr;
|
|
212
215
|
const [minute = "", hour = "", dom = "", month = "", dow = ""] = std;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/core",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.74.0",
|
|
4
4
|
"description": "Stateless, task-oriented AI agent core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BUSL-1.1",
|
|
@@ -110,6 +110,7 @@
|
|
|
110
110
|
"gate:tool-names": "node scripts/verify-tool-name-tables.mjs",
|
|
111
111
|
"gate:name-readings": "node scripts/verify-name-readings.mjs",
|
|
112
112
|
"gate:tool-docs": "node scripts/gen-tool-spec-fields.mjs --check",
|
|
113
|
+
"gate:kernel-digest": "node scripts/gen-kernel-digest.mjs --check",
|
|
113
114
|
"gate:prompt-docs": "node scripts/gen-prompt-docs.mjs --check",
|
|
114
115
|
"gen:prompt-docs": "node scripts/gen-prompt-docs.mjs",
|
|
115
116
|
"gate:backlog-ledger": "node scripts/verify-backlog-ledger.mjs",
|
|
@@ -141,7 +142,7 @@
|
|
|
141
142
|
"dependencies": {
|
|
142
143
|
"@modelcontextprotocol/client": "2.4.0",
|
|
143
144
|
"@modelcontextprotocol/core": "2.4.0",
|
|
144
|
-
"@sema-agent/primitives": "7.
|
|
145
|
+
"@sema-agent/primitives": "7.74.0",
|
|
145
146
|
"typebox": "1.1.39",
|
|
146
147
|
"undici": "7.30.2"
|
|
147
148
|
},
|