@sema-agent/core 7.71.1 → 7.73.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 +500 -0
- package/dist/agents/cross-session-ref.d.ts +2 -2
- package/dist/agents/cross-session-ref.js +7 -2
- package/dist/agents/inherited-tool-pool.d.ts +30 -2
- package/dist/agents/inherited-tool-pool.js +53 -7
- 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/send-message-tool.js +7 -2
- 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 +47 -12
- package/dist/agents/verify.js +23 -7
- package/dist/agents/yield-adoption.js +3 -1
- package/dist/brain/anthropic.js +14 -9
- package/dist/brain/open-responses.js +4 -5
- package/dist/brain/openai.js +30 -23
- package/dist/brain/stream-engine.js +159 -151
- package/dist/core/a2a.d.ts +24 -3
- package/dist/core/a2a.js +27 -8
- package/dist/core/actions-digest.d.ts +43 -0
- package/dist/core/actions-digest.js +22 -0
- package/dist/core/agent-state.d.ts +28 -7
- package/dist/core/agent-state.js +19 -6
- package/dist/core/allow-entry.js +3 -3
- package/dist/core/approval-object.d.ts +7 -3
- package/dist/core/approval-object.js +30 -9
- package/dist/core/auto-mode.d.ts +7 -9
- package/dist/core/auto-mode.js +114 -8
- package/dist/core/checkpoint-features.d.ts +16 -5
- package/dist/core/checkpoint-features.js +35 -6
- 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 +10 -4
- package/dist/core/checkpoint-store.d.ts +24 -2
- package/dist/core/checkpoint-store.js +1 -0
- package/dist/core/child-clamp-seats.d.ts +15 -0
- package/dist/core/child-clamp-seats.js +15 -0
- package/dist/core/delegation-frames.d.ts +1 -0
- package/dist/core/delegation-frames.js +1 -1
- package/dist/core/effective-path-target.d.ts +19 -0
- package/dist/core/effective-path-target.js +95 -38
- package/dist/core/engine-capabilities.d.ts +5 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +34 -23
- 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/file-history-store.d.ts +15 -4
- package/dist/core/file-history-store.js +53 -23
- package/dist/core/gate-fold.js +3 -1
- package/dist/core/governance-codes.d.ts +10 -1
- package/dist/core/governance-codes.js +17 -5
- package/dist/core/hooks.d.ts +3 -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/judged-read.d.ts +57 -0
- package/dist/core/judged-read.js +1 -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-host-seat.d.ts +5 -0
- package/dist/core/mcp-host-seat.js +7 -1
- 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/mcp.js +3 -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/index.d.ts +1 -1
- package/dist/core/memory-engine/index.js +1 -1
- package/dist/core/memory-engine/layout.js +6 -4
- 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 +69 -11
- package/dist/core/memory-engine/scope-contract.js +99 -34
- 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 +21 -6
- package/dist/core/mode-policy.js +15 -6
- package/dist/core/mounted-mcp.d.ts +7 -2
- package/dist/core/mounted-mcp.js +10 -1
- package/dist/core/own-property-receipt.js +11 -4
- package/dist/core/param-rule-reach.d.ts +8 -3
- package/dist/core/param-rule-reach.js +9 -1
- package/dist/core/parent-spec-seat.d.ts +13 -1
- package/dist/core/parent-spec-seat.js +18 -0
- package/dist/core/peer-registration.d.ts +52 -0
- package/dist/core/peer-registration.js +37 -0
- package/dist/core/peer-seat.d.ts +3 -1
- 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 +34 -6
- 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/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/retired-keys.js +1 -0
- package/dist/core/rule-offer-read.d.ts +1 -1
- package/dist/core/rule-offer-read.js +32 -4
- 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/chain-mismatch.d.ts +32 -0
- package/dist/core/runner/chain-mismatch.js +29 -0
- package/dist/core/runner/changes-history.d.ts +1 -0
- package/dist/core/runner/changes-history.js +2 -2
- package/dist/core/runner/checkpoint-scope.d.ts +13 -3
- package/dist/core/runner/checkpoint-scope.js +12 -4
- package/dist/core/runner/construction-doors.js +6 -0
- package/dist/core/runner/contracts.d.ts +22 -3
- package/dist/core/runner/delegation-owner.d.ts +30 -0
- package/dist/core/runner/delegation-owner.js +20 -4
- package/dist/core/runner/file-history-restore.d.ts +3 -1
- package/dist/core/runner/file-history-restore.js +9 -6
- package/dist/core/runner/finish-reason-seat.js +4 -2
- package/dist/core/runner/leg-frame.js +3 -0
- package/dist/core/runner/loaded-skills.d.ts +2 -0
- package/dist/core/runner/loaded-skills.js +10 -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 +23 -20
- package/dist/core/runner/person-path-rows.js +82 -18
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -0
- package/dist/core/runner/prepare-caps-and-workflow.js +105 -90
- package/dist/core/runner/prepare-config-doors.d.ts +1 -0
- package/dist/core/runner/prepare-config-doors.js +5 -3
- 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-file-history.js +1 -1
- package/dist/core/runner/prepare-hands-readface.d.ts +10 -2
- package/dist/core/runner/prepare-hands-readface.js +36 -22
- package/dist/core/runner/prepare-inherited-gate.d.ts +8 -5
- package/dist/core/runner/prepare-inherited-gate.js +14 -6
- package/dist/core/runner/prepare-memory-engine-session.d.ts +2 -2
- package/dist/core/runner/prepare-memory-engine-session.js +2 -2
- package/dist/core/runner/prepare-memory.js +3 -15
- package/dist/core/runner/prepare-project-context.d.ts +1 -1
- package/dist/core/runner/prepare-project-context.js +3 -7
- package/dist/core/runner/prepare-protocol-tools.d.ts +5 -0
- package/dist/core/runner/prepare-protocol-tools.js +2 -2
- 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 +50 -37
- 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 +5 -1
- package/dist/core/runner/prepare-wiring-manifest.js +8 -4
- package/dist/core/runner/read-session-changes.js +1 -1
- package/dist/core/runner/resume-apply.js +11 -5
- package/dist/core/runner/resume-checkpoint-screen.d.ts +8 -7
- package/dist/core/runner/resume-checkpoint-screen.js +7 -6
- 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/rewind-files.js +3 -2
- package/dist/core/runner/run-harness-handlers.js +3 -0
- package/dist/core/runner/run-identity-wiring.js +3 -2
- package/dist/core/runner/run-leg.js +9 -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 +3 -2
- package/dist/core/runner/shell-env-withheld.js +1 -2
- 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/task-start-doors.js +6 -3
- package/dist/core/runner/terminal-account.d.ts +10 -1
- package/dist/core/runner/terminal-account.js +23 -3
- package/dist/core/runner/tool-face-overlay.d.ts +2 -11
- package/dist/core/runner/tool-face-overlay.js +39 -0
- package/dist/core/runner/trim-stretch.js +7 -2
- package/dist/core/runner/unreadable-person-rows.d.ts +2 -1
- package/dist/core/runner-deps.d.ts +13 -10
- package/dist/core/scheduler.d.ts +47 -7
- package/dist/core/scheduler.js +19 -7
- package/dist/core/secret-env.d.ts +60 -37
- package/dist/core/secret-env.js +45 -48
- package/dist/core/sensitive-path-policy.js +14 -7
- 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.js +1 -0
- package/dist/core/store-contracts/checkpoint-store-contract.js +17 -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 +11 -3
- package/dist/core/task-notification.d.ts +97 -10
- package/dist/core/task-notification.js +129 -5
- 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 +39 -2
- package/dist/core/task-registry.js +76 -12
- package/dist/core/task-result.d.ts +13 -0
- package/dist/core/task-spec-members.d.ts +3 -1
- package/dist/core/task-spec-members.js +11 -3
- package/dist/core/task-spec.d.ts +57 -23
- package/dist/core/tool-catalog-entries.js +4 -0
- package/dist/core/tool-face-reader.js +1 -1
- package/dist/core/tool-face.d.ts +7 -0
- package/dist/core/tool-face.js +1 -0
- package/dist/core/tool-mount-facts.d.ts +5 -3
- package/dist/core/tool-mount-facts.js +4 -3
- package/dist/core/tool-mount-plan.d.ts +7 -3
- package/dist/core/tool-mount-plan.js +11 -5
- package/dist/core/tool-mount-static.d.ts +2 -2
- package/dist/core/tool-mount-static.js +28 -14
- package/dist/core/tool-registry.d.ts +33 -1
- package/dist/core/tool-registry.js +33 -0
- package/dist/core/tool-result-store.d.ts +19 -2
- package/dist/core/tool-result-store.js +51 -2
- package/dist/core/tool-roster.d.ts +16 -0
- package/dist/core/tool-roster.js +6 -0
- package/dist/core/tool-spec.d.ts +13 -4
- package/dist/core/tools.d.ts +6 -0
- package/dist/core/tools.js +1 -1
- package/dist/core/user-attachment.d.ts +5 -1
- package/dist/core/user-attachment.js +14 -7
- package/dist/core/wiring-manifest.d.ts +89 -29
- package/dist/core/wiring-manifest.js +44 -4
- 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.js +3 -1
- package/dist/engine/harness/messages.d.ts +1 -1
- package/dist/engine/harness/messages.js +2 -1
- package/dist/engine/harness/types.d.ts +24 -1
- package/dist/engine/harness/types.js +10 -0
- package/dist/engine/llm/types.d.ts +5 -7
- package/dist/engine/loop/types.d.ts +2 -0
- 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 +35 -5
- package/dist/index.d.ts +27 -12
- package/dist/index.js +20 -8
- 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-stop.d.ts +128 -0
- package/dist/orchestration/workflow-stop.js +156 -0
- package/dist/orchestration/workflow.d.ts +30 -6
- package/dist/orchestration/workflow.js +117 -54
- package/dist/prompts/manager-recipe.d.ts +18 -0
- package/dist/prompts/manager-recipe.js +24 -0
- package/dist/stores/file/adoption/marker.d.ts +2 -27
- package/dist/stores/file/adoption/marker.js +12 -0
- package/dist/stores/file/index.d.ts +1 -1
- package/dist/stores/file/index.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/artifact/artifact-tool.js +11 -6
- package/dist/tools/fs/file-read-check.d.ts +45 -11
- package/dist/tools/fs/file-read-check.js +200 -57
- package/dist/tools/fs/file-write-check.js +9 -3
- package/dist/tools/fs/index.d.ts +8 -7
- package/dist/tools/fs/index.js +4 -4
- package/dist/tools/fs/judged-reads.d.ts +51 -0
- package/dist/tools/fs/judged-reads.js +68 -0
- 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 +12 -1
- package/dist/tools/fs/safety.js +16 -3
- package/dist/tools/fs/shell-read-check.d.ts +25 -5
- package/dist/tools/fs/shell-read-check.js +100 -15
- package/dist/tools/fs/shell-read-establish.d.ts +9 -0
- package/dist/tools/fs/shell-read-establish.js +34 -14
- 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 +5 -0
- package/dist/tools/fs/shell-read-write-targets.js +17 -9
- package/dist/tools/scheduler-store-move.d.ts +74 -0
- package/dist/tools/scheduler-store-move.js +103 -0
- package/dist/tools/scheduler-tools.d.ts +43 -29
- package/dist/tools/scheduler-tools.js +161 -118
- package/package.json +2 -2
- package/test/export-surface.snapshot.json +173 -3
- package/wire-changes/answers/core-stores-sql@7.72.0.json +12 -0
- package/wire-changes/answers/core-stores-sql@7.73.0.json +28 -0
- package/wire-changes/answers/core@7.72.0.json +84 -0
- package/wire-changes/answers/core@7.73.0.json +216 -0
- package/wire-changes/answers/mods-kernel@7.72.0.json +7 -0
- package/wire-changes/answers/mods-kernel@7.73.0.json +7 -0
- package/wire-changes/answers/primitives@7.72.0.json +6 -0
- package/wire-changes/answers/primitives@7.73.0.json +12 -0
- package/wire-changes/answers/wiki-gate@7.72.0.json +7 -0
- package/wire-changes/answers/wiki-gate@7.73.0.json +7 -0
- package/wire-changes/core-stores-sql@7.72.0.json +215 -0
- package/wire-changes/core-stores-sql@7.73.0.json +326 -0
- package/wire-changes/core@7.72.0.json +2426 -0
- package/wire-changes/core@7.73.0.json +6480 -0
- package/wire-changes/mods-kernel@7.72.0.json +147 -0
- package/wire-changes/mods-kernel@7.73.0.json +147 -0
- package/wire-changes/primitives@7.72.0.json +143 -0
- package/wire-changes/primitives@7.73.0.json +227 -0
- package/wire-changes/wiki-gate@7.72.0.json +145 -0
- package/wire-changes/wiki-gate@7.73.0.json +145 -0
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
import { defineTool, errorResult } from "../core/tools.js";
|
|
3
3
|
import { CRON_FIELD_SEPARATOR, cronIntakeRefusal } from "../core/cron.js";
|
|
4
|
-
import {
|
|
4
|
+
import { declaresLaneKeys, describeScopeKeys, readSchedulerDeclaration, SchedulerError, } from "../core/scheduler.js";
|
|
5
5
|
import { mountRuleFace, toolFace } from "../core/tool-catalog-entries.js";
|
|
6
|
-
import {
|
|
6
|
+
import { legIdentityOf, scopeKeyOf } from "../core/isolation-scope.js";
|
|
7
7
|
import { envErrorDetail } from "./fs/env-error-detail.js";
|
|
8
8
|
import { codedRefusal } from "../core/thrown-value.js";
|
|
9
9
|
import { describeRejectedValue } from "../core/tool-search-setting.js";
|
|
10
10
|
import { isValidTimeZone } from "../prompts/default.js";
|
|
11
|
+
import { deliverEngineNotice } from "../core/engine-notice.js";
|
|
11
12
|
export const SCHEDULE_WAKEUP_TOOL_NAME = "ScheduleWakeup";
|
|
12
13
|
export const AUTONOMOUS_LOOP_SENTINEL = "<<autonomous-loop>>";
|
|
13
14
|
export const AUTONOMOUS_LOOP_DYNAMIC_SENTINEL = "<<autonomous-loop-dynamic>>";
|
|
14
|
-
const WAKEUP_LABEL = "loop-wakeup";
|
|
15
|
+
export const WAKEUP_LABEL = "loop-wakeup";
|
|
15
16
|
const SCHEDULE_WAKEUP_PROMPT = `Schedule when to resume work in /loop dynamic mode — the user invoked /loop without an interval, asking you to self-pace iterations of a specific task.
|
|
16
17
|
|
|
17
18
|
A wakeup only fires while THIS session is alive — it does not survive the session's end (a single-shot headless run ends when your final answer lands, taking pending wakeups with it). Do not park deliverable-producing work behind a wakeup near the end of a task; finish it, or start it in a self-detaching form.
|
|
@@ -36,55 +37,71 @@ The runtime clamps to [60, 3600], so you don't need to clamp yourself.
|
|
|
36
37
|
|
|
37
38
|
One short sentence on what you chose and why. Goes to telemetry and is shown back to the user. "watching CI run" beats "waiting." The user reads this to understand what you're doing without having to predict your cadence in advance — make it specific.
|
|
38
39
|
`;
|
|
39
|
-
function
|
|
40
|
-
return scopeKeyOf(c);
|
|
41
|
-
}
|
|
42
|
-
function toSchedulerContext(c, scope) {
|
|
40
|
+
function toSchedulerContext(c, scope, sessionId) {
|
|
43
41
|
const person = legIdentityOf(c).principal;
|
|
44
42
|
return {
|
|
45
43
|
scope,
|
|
46
44
|
...(person !== undefined ? { principal: person } : {}),
|
|
47
|
-
...(
|
|
45
|
+
...(sessionId !== undefined ? { sessionId: sessionId } : {}),
|
|
48
46
|
...(c.taskConfig !== undefined ? { taskConfig: c.taskConfig } : {}),
|
|
49
47
|
...(c.timeZone !== undefined ? { timeZone: c.timeZone } : {}),
|
|
50
48
|
};
|
|
51
49
|
}
|
|
52
|
-
function
|
|
53
|
-
return
|
|
50
|
+
export function laneKeyOf(lane, owner) {
|
|
51
|
+
return `${lane}:${owner}`;
|
|
52
|
+
}
|
|
53
|
+
function laneScopeOf(lane, owner) {
|
|
54
|
+
return typeof owner === "string" ? laneKeyOf(lane, owner) : owner;
|
|
55
|
+
}
|
|
56
|
+
export function isLaneKey(lane, scope) {
|
|
57
|
+
return typeof scope === "string" && scope.length > lane.length + 1 && scope.startsWith(`${lane}:`);
|
|
58
|
+
}
|
|
59
|
+
function laneKeyRefusal(lane, value) {
|
|
60
|
+
return codedRefusal("config.invalid_argument", `the ${lane} lane's scope is ${describeRejectedValue(value)}, not \`${lane}:\` followed by a non-empty owner — a scheduler lane needs a key that names whose entries it reads. Derive the lanes with schedulerLanesOf from the session or run the host has verified.`);
|
|
54
61
|
}
|
|
55
62
|
function checkedLanes(lanes) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
const held = lanes;
|
|
64
|
+
const session = held?.session;
|
|
65
|
+
if (session !== undefined && !isLaneKey("session", session?.scope))
|
|
66
|
+
throw laneKeyRefusal("session", session?.scope);
|
|
67
|
+
if (!isLaneKey("durable", held?.durable?.scope))
|
|
68
|
+
throw laneKeyRefusal("durable", held?.durable?.scope);
|
|
61
69
|
return lanes;
|
|
62
70
|
}
|
|
63
|
-
export function sessionLaneScopeOf(c) {
|
|
64
|
-
const scope = c.sessionId ?? isolationScopeOf(c) ?? c.taskId ?? ANONYMOUS_SCOPE;
|
|
65
|
-
if (typeof scope !== "string" || scope === "")
|
|
66
|
-
throw laneKeyRefusal("the session lane's key", scope);
|
|
67
|
-
return scope;
|
|
68
|
-
}
|
|
69
71
|
export function schedulerLanesOf(ctx) {
|
|
70
|
-
|
|
72
|
+
const sessionId = ctx.sessionId;
|
|
73
|
+
return checkedLanes({
|
|
74
|
+
...(sessionId !== undefined ? { session: toSchedulerContext(ctx, laneScopeOf("session", sessionId), sessionId) } : {}),
|
|
75
|
+
durable: toSchedulerContext(ctx, laneScopeOf("durable", scopeKeyOf(ctx)), sessionId),
|
|
76
|
+
});
|
|
71
77
|
}
|
|
72
|
-
function
|
|
73
|
-
return lanes.session
|
|
78
|
+
function lanesToRead(lanes) {
|
|
79
|
+
return lanes.session !== undefined ? [lanes.session, lanes.durable] : [lanes.durable];
|
|
80
|
+
}
|
|
81
|
+
export function laneOfIntent(intent) {
|
|
82
|
+
return intent.lifetime === "session" || intent.mode === "session-wakeup" ? "session" : "durable";
|
|
74
83
|
}
|
|
75
84
|
const UNSUPPORTED = () => ({ ok: false, error: new SchedulerError("unsupported", "this execution environment carries no scheduler seam") });
|
|
85
|
+
const UNMOVED = (capabilities) => ({
|
|
86
|
+
ok: false,
|
|
87
|
+
error: new SchedulerError("unsupported", `this scheduler seam does not declare that its store holds lane keys (schedulerCapabilities.scopeKeys is ${describeScopeKeys(capabilities?.scopeKeys)}, not "lane"): a seam with no store, or a store still filed under bare keys, is read by no lane key. Move such a store once with migrateSchedulerStore and declare scopeKeys: "lane" in the same write.`),
|
|
88
|
+
});
|
|
76
89
|
function schedulerSeamOf(env) {
|
|
77
90
|
const e = env;
|
|
78
|
-
|
|
91
|
+
if (typeof e.list !== "function" || typeof e.cancel !== "function")
|
|
92
|
+
return { answer: UNSUPPORTED() };
|
|
93
|
+
const capabilities = e.schedulerCapabilities;
|
|
94
|
+
return declaresLaneKeys(capabilities) ? { seam: env } : { answer: UNMOVED(capabilities) };
|
|
79
95
|
}
|
|
80
96
|
export async function listScheduled(env, lanes) {
|
|
81
|
-
checkedLanes(lanes);
|
|
82
|
-
const
|
|
83
|
-
if (
|
|
84
|
-
return
|
|
97
|
+
const judged = checkedLanes(lanes);
|
|
98
|
+
const held = schedulerSeamOf(env);
|
|
99
|
+
if ("answer" in held)
|
|
100
|
+
return held.answer;
|
|
101
|
+
const { seam } = held;
|
|
85
102
|
const rows = [];
|
|
86
103
|
const seen = new Set();
|
|
87
|
-
for (const lane of
|
|
104
|
+
for (const lane of lanesToRead(judged)) {
|
|
88
105
|
const listed = await seam.list(lane);
|
|
89
106
|
if (!listed.ok)
|
|
90
107
|
return { ok: false, error: listed.error };
|
|
@@ -98,11 +115,12 @@ export async function listScheduled(env, lanes) {
|
|
|
98
115
|
return { ok: true, value: rows };
|
|
99
116
|
}
|
|
100
117
|
export async function cancelScheduled(env, lanes, id) {
|
|
101
|
-
checkedLanes(lanes);
|
|
102
|
-
const
|
|
103
|
-
if (
|
|
104
|
-
return
|
|
105
|
-
const
|
|
118
|
+
const judged = checkedLanes(lanes);
|
|
119
|
+
const held = schedulerSeamOf(env);
|
|
120
|
+
if ("answer" in held)
|
|
121
|
+
return held.answer;
|
|
122
|
+
const { seam } = held;
|
|
123
|
+
const [first, ...others] = await cancelLanesFor(seam, judged, id);
|
|
106
124
|
let r = await seam.cancel(id, first);
|
|
107
125
|
for (const lane of others) {
|
|
108
126
|
if (r.ok || r.error.code !== "not_found")
|
|
@@ -112,15 +130,15 @@ export async function cancelScheduled(env, lanes, id) {
|
|
|
112
130
|
return r;
|
|
113
131
|
}
|
|
114
132
|
async function cancelLanesFor(env, lanes, id) {
|
|
115
|
-
const
|
|
116
|
-
if (
|
|
117
|
-
return
|
|
118
|
-
for (const lane of
|
|
133
|
+
const read = lanesToRead(lanes);
|
|
134
|
+
if (read.length === 1)
|
|
135
|
+
return read;
|
|
136
|
+
for (const lane of read) {
|
|
119
137
|
const listed = await env.list(lane);
|
|
120
138
|
if (listed.ok && listed.value.some((s) => s.id === id))
|
|
121
139
|
return [lane];
|
|
122
140
|
}
|
|
123
|
-
return
|
|
141
|
+
return read;
|
|
124
142
|
}
|
|
125
143
|
export function cronScheduleError(expr, timeZone = "UTC") {
|
|
126
144
|
return cronIntakeRefusal(expr, { after: Date.now(), timeZone });
|
|
@@ -222,24 +240,110 @@ export function cronToHuman(expr) {
|
|
|
222
240
|
return `weekdays at ${time}`;
|
|
223
241
|
return expr;
|
|
224
242
|
}
|
|
225
|
-
|
|
226
|
-
|
|
243
|
+
const toldUnmoved = new WeakMap();
|
|
244
|
+
const CONSOLE_SINK = {};
|
|
245
|
+
export function announceSchedulerStoreUnmoved(scheduler, onNotice) {
|
|
246
|
+
if (scheduler.kind !== "unmoved")
|
|
247
|
+
return;
|
|
248
|
+
const declared = describeScopeKeys(scheduler.capabilities.scopeKeys);
|
|
249
|
+
const sink = typeof onNotice === "function" ? onNotice : CONSOLE_SINK;
|
|
250
|
+
let told = toldUnmoved.get(sink);
|
|
251
|
+
if (told === undefined)
|
|
252
|
+
toldUnmoved.set(sink, (told = new Set()));
|
|
253
|
+
const line = JSON.stringify([scheduler.capabilities.supported, declared]);
|
|
254
|
+
if (told.has(line))
|
|
255
|
+
return;
|
|
256
|
+
told.add(line);
|
|
257
|
+
deliverEngineNotice(onNotice, {
|
|
258
|
+
code: "config.scheduler_store_unmoved",
|
|
259
|
+
message: `The scheduler backend does not declare that its store holds lane keys (schedulerCapabilities.scopeKeys is ${declared}, not "lane"), so CronCreate, CronDelete, CronList and ScheduleWakeup are not mounted, and the host readers answer "unsupported" — while the jobs already in the store still fire on schedule, nobody can list or stop them through the engine. Move the store once with migrateSchedulerStore, then declare scopeKeys: "lane" in the same write.`,
|
|
260
|
+
detail: { declared },
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
export function createSchedulerTools(env, ctx, scheduler = readSchedulerDeclaration(env)) {
|
|
264
|
+
if (scheduler.kind !== "mounted")
|
|
227
265
|
return [];
|
|
228
|
-
const sched =
|
|
266
|
+
const sched = scheduler.seam;
|
|
267
|
+
const caps = scheduler.capabilities;
|
|
229
268
|
const lanes = schedulerLanesOf(ctx);
|
|
230
269
|
const sessionCtx = lanes.session;
|
|
231
270
|
const durableCtx = lanes.durable;
|
|
271
|
+
const schedulerZone = caps.timeZone;
|
|
272
|
+
if (schedulerZone !== undefined && (typeof schedulerZone !== "string" || !isValidTimeZone(schedulerZone))) {
|
|
273
|
+
throw Object.assign(codedRefusal("config.invalid_argument", `SchedulerCapability.schedulerCapabilities.timeZone: ${describeRejectedValue(schedulerZone)} is not a time zone the runtime knows — declare a name \`Intl\` accepts (an IANA name such as "UTC" or "Europe/Berlin"), or leave it out.`), { detail: { field: "SchedulerCapability.schedulerCapabilities.timeZone" } });
|
|
274
|
+
}
|
|
232
275
|
let cronCreateChain = Promise.resolve();
|
|
233
276
|
const serializedCronCreateOp = (fn) => {
|
|
234
277
|
const next = cronCreateChain.then(fn, fn);
|
|
235
278
|
cronCreateChain = next.then(() => undefined, () => undefined);
|
|
236
279
|
return next;
|
|
237
280
|
};
|
|
281
|
+
const cronCancel = defineTool({
|
|
282
|
+
name: "CronDelete",
|
|
283
|
+
...toolFace("cron-delete"),
|
|
284
|
+
ruleFace: mountRuleFace("cron-delete"),
|
|
285
|
+
description: "Cancel a cron job previously scheduled with CronCreate. Idempotent; ids also appear in CronList.",
|
|
286
|
+
parameters: Type.Object({ id: Type.String({ description: "Job ID returned by CronCreate." }) }),
|
|
287
|
+
execute: async (args) => {
|
|
288
|
+
const { id } = args;
|
|
289
|
+
const r = await cancelScheduled(sched, lanes, id);
|
|
290
|
+
if (!r.ok) {
|
|
291
|
+
if (r.error.code === "not_found")
|
|
292
|
+
return `CronDelete: no scheduled task "${id}" (already gone or not yours).`;
|
|
293
|
+
return errorResult(`Error (CronDelete): ${envErrorDetail(r.error.message)}`);
|
|
294
|
+
}
|
|
295
|
+
return { content: `Cancelled scheduled task ${id}.`, details: { type: "cron-delete", id } };
|
|
296
|
+
},
|
|
297
|
+
});
|
|
298
|
+
const cronList = defineTool({
|
|
299
|
+
name: "CronList",
|
|
300
|
+
...toolFace("cron-list"),
|
|
301
|
+
ruleFace: mountRuleFace("cron-list"),
|
|
302
|
+
description: "List all cron jobs scheduled via CronCreate (id, when, label, and the first line of the task text when the scheduler has it).",
|
|
303
|
+
parameters: Type.Object({}),
|
|
304
|
+
execute: async () => {
|
|
305
|
+
const listed = await listScheduled(sched, lanes);
|
|
306
|
+
if (!listed.ok)
|
|
307
|
+
return errorResult(`Error (CronList): ${envErrorDetail(listed.error.message)}`);
|
|
308
|
+
const rows = listed.value;
|
|
309
|
+
if (rows.length === 0) {
|
|
310
|
+
return { content: "No scheduled tasks.", details: { type: "cron-list", jobs: [] } };
|
|
311
|
+
}
|
|
312
|
+
const now = Date.now();
|
|
313
|
+
const read = rows.map((s) => ({ s, prompt: promptOf(s) }));
|
|
314
|
+
const content = read
|
|
315
|
+
.map(({ s, prompt }) => {
|
|
316
|
+
const shown = cronExprFromSummary(s.when);
|
|
317
|
+
const human = cronToHuman(s.when);
|
|
318
|
+
const tier = s.lifetime === "session" ? " [session]" : "";
|
|
319
|
+
const once = s.recurring === false ? " [once]" : "";
|
|
320
|
+
const at = nextFireAtOf(s, now);
|
|
321
|
+
const next = at === undefined ? "" : `, next run ${new Date(at).toISOString()}`;
|
|
322
|
+
const text = prompt === undefined ? "" : `: ${promptGlimpse(prompt)}`;
|
|
323
|
+
return `- ${s.id}: ${shown}${human !== s.when ? ` — ${human}` : ""}${s.label ? ` (${s.label})` : ""}${tier}${once}${next}${text}`;
|
|
324
|
+
})
|
|
325
|
+
.join("\n");
|
|
326
|
+
const jobs = read.map(({ s, prompt }) => {
|
|
327
|
+
const human = cronToHuman(s.when);
|
|
328
|
+
const nextFireAt = nextFireAtOf(s, now);
|
|
329
|
+
return {
|
|
330
|
+
id: s.id,
|
|
331
|
+
cron: cronExprFromSummary(s.when),
|
|
332
|
+
humanSchedule: human !== s.when ? human : s.when,
|
|
333
|
+
...(prompt !== undefined ? { prompt } : {}),
|
|
334
|
+
...(s.label !== undefined ? { label: s.label } : {}),
|
|
335
|
+
...(s.recurring !== undefined ? { recurring: s.recurring } : {}),
|
|
336
|
+
...(s.lifetime !== undefined ? { durable: s.lifetime === "durable" } : {}),
|
|
337
|
+
...(nextFireAt !== undefined ? { nextFireAt } : {}),
|
|
338
|
+
};
|
|
339
|
+
});
|
|
340
|
+
return { content, details: { type: "cron-list", jobs } };
|
|
341
|
+
},
|
|
342
|
+
});
|
|
343
|
+
if (sessionCtx === undefined)
|
|
344
|
+
return [cronCancel, cronList];
|
|
345
|
+
const laneFor = (intent) => (laneOfIntent(intent) === "session" ? sessionCtx : durableCtx);
|
|
238
346
|
const userZone = sessionCtx.timeZone !== undefined;
|
|
239
|
-
const schedulerZone = sched.schedulerCapabilities.timeZone;
|
|
240
|
-
if (schedulerZone !== undefined && (typeof schedulerZone !== "string" || !isValidTimeZone(schedulerZone))) {
|
|
241
|
-
throw Object.assign(codedRefusal("config.invalid_argument", `SchedulerCapability.schedulerCapabilities.timeZone: ${describeRejectedValue(schedulerZone)} is not a time zone the runtime knows — declare a name \`Intl\` accepts (an IANA name such as "UTC" or "Europe/Berlin"), or leave it out.`), { detail: { field: "SchedulerCapability.schedulerCapabilities.timeZone" } });
|
|
242
|
-
}
|
|
243
347
|
const cronCreateDescription = `Schedule a prompt to be enqueued at a future time. Use for both recurring schedules and one-shot reminders. When a job fires, its \`prompt\` is enqueued into this session as its next input, once the session is idle (not mid-turn). Use CronList to see what you've scheduled, CronDelete to remove one.
|
|
244
348
|
|
|
245
349
|
## One-shot tasks (schedule kind "delay" or "at")
|
|
@@ -318,7 +422,7 @@ Only use minute 0 or 30 when the user names that exact time and clearly means it
|
|
|
318
422
|
}
|
|
319
423
|
const durable = a.durable ?? a.schedule !== undefined;
|
|
320
424
|
if (!durable) {
|
|
321
|
-
if (
|
|
425
|
+
if (caps.supportsSessionLifetime !== true) {
|
|
322
426
|
return errorResult("Error (CronCreate): this scheduler backend does not support session-scoped jobs (they could not be cleaned up when the session ends). Pass `durable: true` to schedule a persistent job instead.");
|
|
323
427
|
}
|
|
324
428
|
}
|
|
@@ -329,7 +433,7 @@ Only use minute 0 or 30 when the user names that exact time and clearly means it
|
|
|
329
433
|
...(!durable ? { lifetime: "session" } : {}),
|
|
330
434
|
...(a.recurring !== undefined ? { recurring: a.recurring } : {}),
|
|
331
435
|
};
|
|
332
|
-
const opCtx =
|
|
436
|
+
const opCtx = laneFor(intent);
|
|
333
437
|
const before = await sched.list(opCtx);
|
|
334
438
|
const knownIds = before.ok ? new Set(before.value.map((s) => s.id)) : undefined;
|
|
335
439
|
const r = await sched.schedule(intent, opCtx);
|
|
@@ -365,68 +469,6 @@ Only use minute 0 or 30 when the user names that exact time and clearly means it
|
|
|
365
469
|
};
|
|
366
470
|
}),
|
|
367
471
|
});
|
|
368
|
-
const cronCancel = defineTool({
|
|
369
|
-
name: "CronDelete",
|
|
370
|
-
...toolFace("cron-delete"),
|
|
371
|
-
ruleFace: mountRuleFace("cron-delete"),
|
|
372
|
-
description: "Cancel a cron job previously scheduled with CronCreate. Idempotent; ids also appear in CronList.",
|
|
373
|
-
parameters: Type.Object({ id: Type.String({ description: "Job ID returned by CronCreate." }) }),
|
|
374
|
-
execute: async (args) => {
|
|
375
|
-
const { id } = args;
|
|
376
|
-
const r = await cancelScheduled(sched, lanes, id);
|
|
377
|
-
if (!r.ok) {
|
|
378
|
-
if (r.error.code === "not_found")
|
|
379
|
-
return `CronDelete: no scheduled task "${id}" (already gone or not yours).`;
|
|
380
|
-
return errorResult(`Error (CronDelete): ${envErrorDetail(r.error.message)}`);
|
|
381
|
-
}
|
|
382
|
-
return { content: `Cancelled scheduled task ${id}.`, details: { type: "cron-delete", id } };
|
|
383
|
-
},
|
|
384
|
-
});
|
|
385
|
-
const cronList = defineTool({
|
|
386
|
-
name: "CronList",
|
|
387
|
-
...toolFace("cron-list"),
|
|
388
|
-
ruleFace: mountRuleFace("cron-list"),
|
|
389
|
-
description: "List all cron jobs scheduled via CronCreate (id, when, label, and the first line of the task text when the scheduler has it).",
|
|
390
|
-
parameters: Type.Object({}),
|
|
391
|
-
execute: async () => {
|
|
392
|
-
const listed = await listScheduled(sched, lanes);
|
|
393
|
-
if (!listed.ok)
|
|
394
|
-
return errorResult(`Error (CronList): ${envErrorDetail(listed.error.message)}`);
|
|
395
|
-
const rows = listed.value;
|
|
396
|
-
if (rows.length === 0) {
|
|
397
|
-
return { content: "No scheduled tasks.", details: { type: "cron-list", jobs: [] } };
|
|
398
|
-
}
|
|
399
|
-
const now = Date.now();
|
|
400
|
-
const read = rows.map((s) => ({ s, prompt: promptOf(s) }));
|
|
401
|
-
const content = read
|
|
402
|
-
.map(({ s, prompt }) => {
|
|
403
|
-
const shown = cronExprFromSummary(s.when);
|
|
404
|
-
const human = cronToHuman(s.when);
|
|
405
|
-
const tier = s.lifetime === "session" ? " [session]" : "";
|
|
406
|
-
const once = s.recurring === false ? " [once]" : "";
|
|
407
|
-
const at = nextFireAtOf(s, now);
|
|
408
|
-
const next = at === undefined ? "" : `, next run ${new Date(at).toISOString()}`;
|
|
409
|
-
const text = prompt === undefined ? "" : `: ${promptGlimpse(prompt)}`;
|
|
410
|
-
return `- ${s.id}: ${shown}${human !== s.when ? ` — ${human}` : ""}${s.label ? ` (${s.label})` : ""}${tier}${once}${next}${text}`;
|
|
411
|
-
})
|
|
412
|
-
.join("\n");
|
|
413
|
-
const jobs = read.map(({ s, prompt }) => {
|
|
414
|
-
const human = cronToHuman(s.when);
|
|
415
|
-
const nextFireAt = nextFireAtOf(s, now);
|
|
416
|
-
return {
|
|
417
|
-
id: s.id,
|
|
418
|
-
cron: cronExprFromSummary(s.when),
|
|
419
|
-
humanSchedule: human !== s.when ? human : s.when,
|
|
420
|
-
...(prompt !== undefined ? { prompt } : {}),
|
|
421
|
-
...(s.label !== undefined ? { label: s.label } : {}),
|
|
422
|
-
...(s.recurring !== undefined ? { recurring: s.recurring } : {}),
|
|
423
|
-
...(s.lifetime !== undefined ? { durable: s.lifetime === "durable" } : {}),
|
|
424
|
-
...(nextFireAt !== undefined ? { nextFireAt } : {}),
|
|
425
|
-
};
|
|
426
|
-
});
|
|
427
|
-
return { content, details: { type: "cron-list", jobs } };
|
|
428
|
-
},
|
|
429
|
-
});
|
|
430
472
|
const listPendingWakeups = async () => {
|
|
431
473
|
const r = await sched.list(sessionCtx);
|
|
432
474
|
if (!r.ok)
|
|
@@ -452,11 +494,11 @@ Only use minute 0 or 30 when the user names that exact time and clearly means it
|
|
|
452
494
|
wakeupChain = next.then(() => undefined, () => undefined);
|
|
453
495
|
return next;
|
|
454
496
|
};
|
|
455
|
-
const wakeupMountNote =
|
|
497
|
+
const wakeupMountNote = caps.supportsSessionWakeup === false
|
|
456
498
|
? `
|
|
457
499
|
|
|
458
500
|
MOUNT NOTE: this host has no resident wakeup leg, so ${SCHEDULE_WAKEUP_TOOL_NAME} refuses every scheduling call here — do not plan a self-paced loop around it (\`stop: true\` still works).`
|
|
459
|
-
:
|
|
501
|
+
: caps.supportsSessionLifetime === true
|
|
460
502
|
? ""
|
|
461
503
|
: `
|
|
462
504
|
|
|
@@ -501,22 +543,23 @@ MOUNT NOTE: this host does not vouch for session-scoped scheduling, so a wakeup
|
|
|
501
543
|
if (a.noop === undefined) {
|
|
502
544
|
return errorResult(`Error (${SCHEDULE_WAKEUP_TOOL_NAME}): \`noop\` is required unless \`stop\` is true — pass \`noop: true\` if this tick changed nothing, \`noop: false\` if something happened worth keeping.`);
|
|
503
545
|
}
|
|
504
|
-
if (
|
|
546
|
+
if (caps.supportsSessionWakeup === false) {
|
|
505
547
|
return errorResult(`Error (${SCHEDULE_WAKEUP_TOOL_NAME}): this environment has no resident scheduler that can honor a session wakeup — the wakeup would never fire. Wait in the foreground instead, or start the work in a self-detaching form.`);
|
|
506
548
|
}
|
|
507
|
-
const sessionReapVouched =
|
|
549
|
+
const sessionReapVouched = caps.supportsSessionLifetime === true;
|
|
508
550
|
const clampedDelaySeconds = Math.min(3600, Math.max(60, Math.round(a.delaySeconds)));
|
|
509
551
|
const wasClamped = clampedDelaySeconds !== a.delaySeconds;
|
|
510
552
|
const pending = await listPendingWakeups();
|
|
511
553
|
const cancelledCount = "err" in pending ? 0 : await cancelWakeups(pending.ids);
|
|
512
554
|
const cleanupIncomplete = "err" in pending || cancelledCount < pending.ids.length;
|
|
513
|
-
const
|
|
555
|
+
const wakeup = {
|
|
514
556
|
prompt: a.prompt,
|
|
515
557
|
when: { kind: "delay", delaySec: clampedDelaySeconds },
|
|
516
558
|
label: WAKEUP_LABEL,
|
|
517
559
|
mode: "session-wakeup",
|
|
518
560
|
...(sessionReapVouched ? { lifetime: "session" } : {}),
|
|
519
|
-
}
|
|
561
|
+
};
|
|
562
|
+
const r = await sched.schedule(wakeup, laneFor(wakeup));
|
|
520
563
|
if (!r.ok)
|
|
521
564
|
return errorResult(`Error (${SCHEDULE_WAKEUP_TOOL_NAME}): ${envErrorDetail(r.error.message)}`);
|
|
522
565
|
const scheduledFor = Date.now() + clampedDelaySeconds * 1000;
|
|
@@ -534,5 +577,5 @@ MOUNT NOTE: this host does not vouch for session-scoped scheduling, so a wakeup
|
|
|
534
577
|
};
|
|
535
578
|
}),
|
|
536
579
|
});
|
|
537
|
-
return
|
|
580
|
+
return [cronCreate, cronCancel, cronList, scheduleWakeup];
|
|
538
581
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/core",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.73.0",
|
|
4
4
|
"description": "Stateless, task-oriented AI agent core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BUSL-1.1",
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"dependencies": {
|
|
142
142
|
"@modelcontextprotocol/client": "2.4.0",
|
|
143
143
|
"@modelcontextprotocol/core": "2.4.0",
|
|
144
|
-
"@sema-agent/primitives": "7.
|
|
144
|
+
"@sema-agent/primitives": "7.73.0",
|
|
145
145
|
"typebox": "1.1.39",
|
|
146
146
|
"undici": "7.30.2"
|
|
147
147
|
},
|