stitchkit 0.94.0 → 0.94.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 +64 -0
- package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-listing.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-search-patch.d.ts.map +1 -1
- package/dist/agent-runtime/contained-darwin.d.ts +38 -0
- package/dist/agent-runtime/contained-darwin.d.ts.map +1 -0
- package/dist/agent-runtime/contained-files.d.ts +11 -26
- package/dist/agent-runtime/contained-files.d.ts.map +1 -1
- package/dist/agent-runtime/contained-scan.d.ts +21 -0
- package/dist/agent-runtime/contained-scan.d.ts.map +1 -0
- package/dist/agent-runtime/contained-write.d.ts +9 -0
- package/dist/agent-runtime/contained-write.d.ts.map +1 -0
- package/dist/agent-runtime/deferred-tool-types.d.ts +3 -2
- package/dist/agent-runtime/deferred-tool-types.d.ts.map +1 -1
- package/dist/agent-runtime/harness-control.d.ts +0 -1
- package/dist/agent-runtime/harness-control.d.ts.map +1 -1
- package/dist/agent-runtime/harness.d.ts +0 -5
- package/dist/agent-runtime/harness.d.ts.map +1 -1
- package/dist/agent-runtime/managed-tools.d.ts +3 -2
- package/dist/agent-runtime/managed-tools.d.ts.map +1 -1
- package/dist/agent-runtime/runtime.d.ts +1 -1
- package/dist/agent-runtime/runtime.d.ts.map +1 -1
- package/dist/agent-runtime/schedule-records.d.ts +34 -0
- package/dist/agent-runtime/schedule-records.d.ts.map +1 -0
- package/dist/agent-runtime/schedules.d.ts +34 -0
- package/dist/agent-runtime/schedules.d.ts.map +1 -1
- package/dist/agent-runtime/store-conformance-lifecycle.d.ts +434 -0
- package/dist/agent-runtime/store-conformance-lifecycle.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance-ordering.d.ts +18 -0
- package/dist/agent-runtime/store-conformance-ordering.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance-support.d.ts +130 -0
- package/dist/agent-runtime/store-conformance-support.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance-terminal.d.ts +12 -0
- package/dist/agent-runtime/store-conformance-terminal.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance.d.ts.map +1 -1
- package/dist/application/admission-rate.d.ts +21 -0
- package/dist/application/admission-rate.d.ts.map +1 -0
- package/dist/application/admission-run.d.ts +8 -0
- package/dist/application/admission-run.d.ts.map +1 -0
- package/dist/application/admission.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-lock.d.ts +9 -34
- package/dist/application/diagnostic-journal-lock.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-manager.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-storage.d.ts.map +1 -1
- package/dist/application/kernel-resource-context.d.ts.map +1 -1
- package/dist/application/notification-outbox.d.ts.map +1 -1
- package/dist/application/schedule.d.ts +0 -1
- package/dist/application/schedule.d.ts.map +1 -1
- package/dist/application/watch-hub-core.d.ts +122 -0
- package/dist/application/watch-hub-core.d.ts.map +1 -0
- package/dist/application/watch-hub.d.ts +2 -2
- package/dist/application/watch-hub.d.ts.map +1 -1
- package/dist/browser/client-executors.d.ts +14 -0
- package/dist/browser/client-executors.d.ts.map +1 -0
- package/dist/browser/client-multipart.d.ts +1 -1
- package/dist/browser/client-multipart.d.ts.map +1 -1
- package/dist/browser/client.d.ts +3 -2
- package/dist/browser/client.d.ts.map +1 -1
- package/dist/browser/http-fetch.d.ts +22 -0
- package/dist/browser/http-fetch.d.ts.map +1 -0
- package/dist/browser/http.d.ts +1 -3
- package/dist/browser/http.d.ts.map +1 -1
- package/dist/browser/live-state-core.d.ts +63 -0
- package/dist/browser/live-state-core.d.ts.map +1 -0
- package/dist/browser/live-state.d.ts.map +1 -1
- package/dist/browser/realtime-client.d.ts +26 -0
- package/dist/browser/realtime-client.d.ts.map +1 -0
- package/dist/browser/socket-io-connection.d.ts +82 -0
- package/dist/browser/socket-io-connection.d.ts.map +1 -0
- package/dist/browser/socket-io-peer.d.ts +20 -0
- package/dist/browser/socket-io-peer.d.ts.map +1 -0
- package/dist/browser/socket-io-trace.d.ts +31 -0
- package/dist/browser/socket-io-trace.d.ts.map +1 -0
- package/dist/browser/socket-io.d.ts +2 -18
- package/dist/browser/socket-io.d.ts.map +1 -1
- package/dist/contract/client-types.d.ts +134 -0
- package/dist/contract/client-types.d.ts.map +1 -0
- package/dist/contract/define-validation.d.ts +30 -0
- package/dist/contract/define-validation.d.ts.map +1 -0
- package/dist/contract/define.d.ts +3 -357
- package/dist/contract/define.d.ts.map +1 -1
- package/dist/contract/runtime-context.d.ts +131 -0
- package/dist/contract/runtime-context.d.ts.map +1 -0
- package/dist/contract/tool-options.d.ts +105 -0
- package/dist/contract/tool-options.d.ts.map +1 -0
- package/dist/contract/tool-view.d.ts +15 -2
- package/dist/contract/tool-view.d.ts.map +1 -1
- package/dist/durability/contract.d.ts +83 -0
- package/dist/durability/contract.d.ts.map +1 -1
- package/dist/durability/effect.d.ts +24 -0
- package/dist/durability/effect.d.ts.map +1 -0
- package/dist/durability/engine.d.ts +2 -2
- package/dist/durability/engine.d.ts.map +1 -1
- package/dist/durability/events.d.ts +2 -0
- package/dist/durability/events.d.ts.map +1 -1
- package/dist/durability/ledger.d.ts +11 -0
- package/dist/durability/ledger.d.ts.map +1 -1
- package/dist/durability/parks.d.ts +22 -0
- package/dist/durability/parks.d.ts.map +1 -0
- package/dist/durability/scheduler.d.ts +1 -0
- package/dist/durability/scheduler.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/coding-tools.js +4 -4
- package/dist/entrypoints/agent-runtime/harness.js +127 -116
- package/dist/entrypoints/agent-runtime/sandbox.js +4 -4
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +3 -3
- package/dist/entrypoints/agent-runtime/sqlite/node.js +3 -3
- package/dist/entrypoints/agent-runtime/testing.js +246 -214
- package/dist/entrypoints/agent-runtime.js +224 -203
- package/dist/entrypoints/application/diagnostic-journal.js +63 -203
- package/dist/entrypoints/application/opentelemetry.js +1 -1
- package/dist/entrypoints/application.js +361 -324
- package/dist/entrypoints/cli.d.ts +4 -1
- package/dist/entrypoints/cli.d.ts.map +1 -1
- package/dist/entrypoints/cli.js +57 -35
- package/dist/entrypoints/contract.d.ts +5 -2
- package/dist/entrypoints/contract.d.ts.map +1 -1
- package/dist/entrypoints/contract.js +3 -2
- package/dist/entrypoints/files.d.ts +2 -0
- package/dist/entrypoints/files.d.ts.map +1 -1
- package/dist/entrypoints/files.js +98 -2
- package/dist/entrypoints/index.d.ts +4 -2
- package/dist/entrypoints/index.d.ts.map +1 -1
- package/dist/entrypoints/index.js +348 -282
- package/dist/entrypoints/live.js +89 -71
- package/dist/entrypoints/node.d.ts +2 -1
- package/dist/entrypoints/node.d.ts.map +1 -1
- package/dist/entrypoints/node.js +13 -12
- package/dist/entrypoints/react.js +1 -1
- package/dist/entrypoints/remote.js +4 -4
- package/dist/entrypoints/server.d.ts +4 -2
- package/dist/entrypoints/server.d.ts.map +1 -1
- package/dist/entrypoints/server.js +293 -79
- package/dist/entrypoints/testing.d.ts +2 -1
- package/dist/entrypoints/testing.d.ts.map +1 -1
- package/dist/entrypoints/testing.js +288 -281
- package/dist/entrypoints/tools/connections.js +2 -2
- package/dist/entrypoints/tools/invoker.js +4 -4
- package/dist/entrypoints/tools.d.ts +6 -3
- package/dist/entrypoints/tools.d.ts.map +1 -1
- package/dist/entrypoints/tools.js +245 -202
- package/dist/entrypoints/tracking.js +325 -274
- package/dist/files/boundary.d.ts.map +1 -1
- package/dist/files/file-io.d.ts +14 -0
- package/dist/files/file-io.d.ts.map +1 -0
- package/dist/index-1j8pm5t0.js +412 -0
- package/dist/{index-kvj7f4hq.js → index-2bxbyab0.js} +10 -2
- package/dist/{index-xnj9bgxe.js → index-2gxzjvyr.js} +2 -162
- package/dist/index-4gcnakhx.js +82 -0
- package/dist/{index-j05z5gn4.js → index-55hkhm67.js} +136 -119
- package/dist/{index-cq4qfycf.js → index-79z7m7dt.js} +227 -59
- package/dist/{index-97ac4gph.js → index-7f68ghdn.js} +3 -3
- package/dist/{index-r7nmqpsg.js → index-7p1f0vp2.js} +1 -1
- package/dist/{index-dcpdvjsc.js → index-863ea9jb.js} +4 -4
- package/dist/index-8p52kd5p.js +242 -0
- package/dist/{index-2qzskm8h.js → index-dce5wxcq.js} +1 -1
- package/dist/index-e01r054k.js +105 -0
- package/dist/{index-sees8yf8.js → index-ensd0r74.js} +118 -111
- package/dist/{index-1nd48tm9.js → index-gxrt5h6v.js} +2 -1
- package/dist/{index-e87kakm4.js → index-ham5sz8m.js} +112 -110
- package/dist/{index-kj2wbeta.js → index-het2he5g.js} +280 -196
- package/dist/{index-vcvkq30w.js → index-hmp4800j.js} +3 -3
- package/dist/{index-gyr48nzg.js → index-k30h66yd.js} +71 -151
- package/dist/{index-2cr1cqhn.js → index-khtgb21r.js} +2 -2
- package/dist/{index-x4799c19.js → index-ndddxtyx.js} +11 -11
- package/dist/{index-dydjcp8z.js → index-np4m8hd3.js} +38 -36
- package/dist/{index-p81267c2.js → index-p3vsv1fb.js} +621 -357
- package/dist/{index-mp5sn43f.js → index-p9e0w8hs.js} +2 -2
- package/dist/{index-rewkc2hj.js → index-p9sh0xx4.js} +3 -3
- package/dist/{index-70yj2ebz.js → index-paz6sgdp.js} +107 -103
- package/dist/{index-bn2cjajt.js → index-px2gm2jp.js} +26 -102
- package/dist/index-s812ycat.js +65 -0
- package/dist/{index-xsqjkha9.js → index-sp1tzwnb.js} +2 -2
- package/dist/{index-n6hxg8as.js → index-t9rhjr9f.js} +615 -566
- package/dist/{index-zeemqhqx.js → index-v260df89.js} +88 -80
- package/dist/{index-fdp6hdxn.js → index-w906953s.js} +5 -1
- package/dist/{index-mdzh02yc.js → index-wdkt63w3.js} +1 -1
- package/dist/{index-58k4fp34.js → index-wsm5w4ee.js} +1 -1
- package/dist/{index-v38qyerb.js → index-xw3s75nj.js} +1 -1
- package/dist/internal/atomic-file.d.ts +23 -2
- package/dist/internal/atomic-file.d.ts.map +1 -1
- package/dist/internal/exclusive-lock.d.ts +51 -0
- package/dist/internal/exclusive-lock.d.ts.map +1 -0
- package/dist/internal/process-identity.d.ts +47 -0
- package/dist/internal/process-identity.d.ts.map +1 -0
- package/dist/internal/with-exclusive-lock.d.ts +67 -0
- package/dist/internal/with-exclusive-lock.d.ts.map +1 -0
- package/dist/live/watch-client.d.ts.map +1 -1
- package/dist/observability/audit.d.ts +2 -2
- package/dist/observability/audit.d.ts.map +1 -1
- package/dist/observability/event.d.ts +2 -1
- package/dist/observability/event.d.ts.map +1 -1
- package/dist/primitives/export-operation.d.ts +1 -1
- package/dist/primitives/export-operation.d.ts.map +1 -1
- package/dist/realtime/registry.d.ts +0 -5
- package/dist/realtime/registry.d.ts.map +1 -1
- package/dist/server/bun.d.ts +0 -1
- package/dist/server/bun.d.ts.map +1 -1
- package/dist/server/context-contribution.d.ts +1 -1
- package/dist/server/context-contribution.d.ts.map +1 -1
- package/dist/server/context.d.ts +1 -1
- package/dist/server/context.d.ts.map +1 -1
- package/dist/server/endpoint-response.d.ts +2 -1
- package/dist/server/endpoint-response.d.ts.map +1 -1
- package/dist/server/error-dispatch.d.ts +1 -1
- package/dist/server/error-dispatch.d.ts.map +1 -1
- package/dist/server/error-hook.d.ts +1 -1
- package/dist/server/error-hook.d.ts.map +1 -1
- package/dist/server/handler-state.d.ts +1 -1
- package/dist/server/handler-state.d.ts.map +1 -1
- package/dist/server/implement-registry.d.ts +54 -0
- package/dist/server/implement-registry.d.ts.map +1 -0
- package/dist/server/implement.d.ts +9 -55
- package/dist/server/implement.d.ts.map +1 -1
- package/dist/server/middleware/auth.d.ts +1 -31
- package/dist/server/middleware/auth.d.ts.map +1 -1
- package/dist/server/middleware/jwt.d.ts +31 -0
- package/dist/server/middleware/jwt.d.ts.map +1 -0
- package/dist/server/multipart-reader.d.ts +22 -0
- package/dist/server/multipart-reader.d.ts.map +1 -0
- package/dist/server/multipart.d.ts +1 -1
- package/dist/server/multipart.d.ts.map +1 -1
- package/dist/server/oauth/cimd.d.ts +88 -0
- package/dist/server/oauth/cimd.d.ts.map +1 -0
- package/dist/server/oauth/endpoints.d.ts +39 -0
- package/dist/server/oauth/endpoints.d.ts.map +1 -0
- package/dist/server/oauth/provider.d.ts +1 -68
- package/dist/server/oauth/provider.d.ts.map +1 -1
- package/dist/server/streaming-pump.d.ts +66 -0
- package/dist/server/streaming-pump.d.ts.map +1 -0
- package/dist/server/streaming-route.d.ts +12 -5
- package/dist/server/streaming-route.d.ts.map +1 -1
- package/dist/server/types.d.ts +4 -1
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/unix-client-bun.d.ts.map +1 -1
- package/dist/server/unix-client-http1.d.ts +76 -0
- package/dist/server/unix-client-http1.d.ts.map +1 -0
- package/dist/server/unix-client.d.ts.map +1 -1
- package/dist/testing/handler-clients.d.ts +2 -1
- package/dist/testing/handler-clients.d.ts.map +1 -1
- package/dist/testing/realtime-probe.d.ts +33 -0
- package/dist/testing/realtime-probe.d.ts.map +1 -0
- package/dist/testing/surface-conformance.d.ts +0 -31
- package/dist/testing/surface-conformance.d.ts.map +1 -1
- package/dist/testing/surface-manifest-digest.d.ts +44 -0
- package/dist/testing/surface-manifest-digest.d.ts.map +1 -0
- package/dist/testing/surface-manifest.d.ts.map +1 -1
- package/dist/tools/agent.d.ts +1 -1
- package/dist/tools/agent.d.ts.map +1 -1
- package/dist/tools/cli/args-fields.d.ts +31 -0
- package/dist/tools/cli/args-fields.d.ts.map +1 -0
- package/dist/tools/cli/args-route.d.ts +42 -0
- package/dist/tools/cli/args-route.d.ts.map +1 -0
- package/dist/tools/cli/args-view.d.ts +32 -0
- package/dist/tools/cli/args-view.d.ts.map +1 -0
- package/dist/tools/cli/args.d.ts +2 -65
- package/dist/tools/cli/args.d.ts.map +1 -1
- package/dist/tools/cli/argument-error.d.ts +5 -0
- package/dist/tools/cli/argument-error.d.ts.map +1 -0
- package/dist/tools/cli/checkpoint.d.ts.map +1 -1
- package/dist/tools/cli/command.d.ts +1 -1
- package/dist/tools/cli/command.d.ts.map +1 -1
- package/dist/tools/cli/config.d.ts +1 -1
- package/dist/tools/cli/config.d.ts.map +1 -1
- package/dist/tools/cli/format.d.ts +2 -1
- package/dist/tools/cli/format.d.ts.map +1 -1
- package/dist/tools/cli/invoke.d.ts +2 -1
- package/dist/tools/cli/invoke.d.ts.map +1 -1
- package/dist/tools/cli/managed-surface.d.ts +1 -1
- package/dist/tools/cli/managed-surface.d.ts.map +1 -1
- package/dist/tools/cli/policy.d.ts +1 -1
- package/dist/tools/cli/policy.d.ts.map +1 -1
- package/dist/tools/cli/prepare.d.ts.map +1 -1
- package/dist/tools/cli/run-managed.d.ts.map +1 -1
- package/dist/tools/cli/session.d.ts +1 -1
- package/dist/tools/cli/session.d.ts.map +1 -1
- package/dist/tools/cli/update.d.ts +19 -0
- package/dist/tools/cli/update.d.ts.map +1 -1
- package/dist/tools/cli/view.d.ts +1 -1
- package/dist/tools/cli/view.d.ts.map +1 -1
- package/dist/tools/cli/wait.d.ts +1 -1
- package/dist/tools/cli/wait.d.ts.map +1 -1
- package/dist/tools/connections/runtime.d.ts +1 -1
- package/dist/tools/connections/runtime.d.ts.map +1 -1
- package/dist/tools/execute-args.d.ts +23 -0
- package/dist/tools/execute-args.d.ts.map +1 -0
- package/dist/tools/execute-hooks.d.ts +146 -0
- package/dist/tools/execute-hooks.d.ts.map +1 -0
- package/dist/tools/execute-result.d.ts +40 -0
- package/dist/tools/execute-result.d.ts.map +1 -0
- package/dist/tools/execute.d.ts +4 -193
- package/dist/tools/execute.d.ts.map +1 -1
- package/dist/tools/internal/surface-projector.d.ts +2 -1
- package/dist/tools/internal/surface-projector.d.ts.map +1 -1
- package/dist/tools/invoker.d.ts +2 -1
- package/dist/tools/invoker.d.ts.map +1 -1
- package/dist/tools/lifecycle.d.ts +1 -1
- package/dist/tools/lifecycle.d.ts.map +1 -1
- package/dist/tools/mcp/mount.d.ts +1 -1
- package/dist/tools/mcp/mount.d.ts.map +1 -1
- package/dist/tools/mcp/prepare.d.ts +2 -1
- package/dist/tools/mcp/prepare.d.ts.map +1 -1
- package/dist/tools/mcp/progress.d.ts +1 -1
- package/dist/tools/mcp/progress.d.ts.map +1 -1
- package/dist/tools/mcp/register.d.ts +3 -2
- package/dist/tools/mcp/register.d.ts.map +1 -1
- package/dist/tools/mcp/round-context.d.ts +38 -0
- package/dist/tools/mcp/round-context.d.ts.map +1 -0
- package/dist/tools/mcp/round-policy.d.ts +1 -1
- package/dist/tools/mcp/round-policy.d.ts.map +1 -1
- package/dist/tools/mcp/round.d.ts +3 -11
- package/dist/tools/mcp/round.d.ts.map +1 -1
- package/dist/tools/mcp/runtime-tools.d.ts +2 -1
- package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
- package/dist/tools/mount.d.ts +3 -1
- package/dist/tools/mount.d.ts.map +1 -1
- package/dist/tools/native-definition.d.ts +2 -1
- package/dist/tools/native-definition.d.ts.map +1 -1
- package/dist/tools/operations/async-operation-runtime-tools.d.ts +2 -1
- package/dist/tools/operations/async-operation-runtime-tools.d.ts.map +1 -1
- package/dist/tools/operations/async-operation-runtime-types.d.ts +2 -1
- package/dist/tools/operations/async-operation-runtime-types.d.ts.map +1 -1
- package/dist/tools/remote.d.ts.map +1 -1
- package/dist/tools/runtime-tool.d.ts +3 -1
- package/dist/tools/runtime-tool.d.ts.map +1 -1
- package/dist/tools/tool-logger.d.ts +1 -1
- package/dist/tools/tool-logger.d.ts.map +1 -1
- package/dist/tracking/client-listeners.d.ts +30 -0
- package/dist/tracking/client-listeners.d.ts.map +1 -0
- package/dist/tracking/client-visit.d.ts +61 -0
- package/dist/tracking/client-visit.d.ts.map +1 -0
- package/dist/tracking/client.d.ts +3 -2
- package/dist/tracking/client.d.ts.map +1 -1
- package/llms/application.2.txt +266 -2
- package/llms/application.txt +8 -266
- package/llms/cli.2.txt +80 -0
- package/llms/cli.txt +45 -74
- package/llms/contract.txt +3 -3
- package/llms/files.txt +3 -0
- package/llms/tools.2.txt +88 -279
- package/llms/tools.3.txt +288 -0
- package/llms/tools.txt +27 -65
- package/llms-full.txt +108 -12
- package/llms.txt +5 -5
- package/package.json +1 -1
- package/dist/index-e2z3ahw9.js +0 -325
- package/dist/index-mkm15s49.js +0 -394
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
renderAgentStateSlots,
|
|
25
25
|
repairedSearchCall,
|
|
26
26
|
selectAgentHistory
|
|
27
|
-
} from "../index-
|
|
27
|
+
} from "../index-7f68ghdn.js";
|
|
28
28
|
import"../index-83bdg97s.js";
|
|
29
29
|
import {
|
|
30
30
|
AgentAdmissionEventSchema,
|
|
@@ -78,7 +78,7 @@ import {
|
|
|
78
78
|
} from "../index-qmy6zq75.js";
|
|
79
79
|
import {
|
|
80
80
|
createMemoryAgentRuntimeStore
|
|
81
|
-
} from "../index-
|
|
81
|
+
} from "../index-sp1tzwnb.js";
|
|
82
82
|
import {
|
|
83
83
|
ACTIVE_AGENT_RUN_STATES,
|
|
84
84
|
AgentAdmissionReceiptSchema,
|
|
@@ -91,7 +91,7 @@ import {
|
|
|
91
91
|
AgentStoredRunSchema,
|
|
92
92
|
createAgentRuntimeStore,
|
|
93
93
|
purgeAgentConversation
|
|
94
|
-
} from "../index-
|
|
94
|
+
} from "../index-wsm5w4ee.js";
|
|
95
95
|
import {
|
|
96
96
|
AcceptInputAndAssignRunSchema,
|
|
97
97
|
AcquireAgentRunSchema,
|
|
@@ -123,7 +123,7 @@ import {
|
|
|
123
123
|
encodeAgentConversationArchive,
|
|
124
124
|
isAssistantHistoryEvidence,
|
|
125
125
|
isCompleteAgentHistoryTurn
|
|
126
|
-
} from "../index-
|
|
126
|
+
} from "../index-gxrt5h6v.js";
|
|
127
127
|
import {
|
|
128
128
|
AgentAssistantPlaceholderSchema,
|
|
129
129
|
AgentControlPartSchema,
|
|
@@ -164,7 +164,7 @@ import {
|
|
|
164
164
|
import {
|
|
165
165
|
buildToolManifest,
|
|
166
166
|
mountAgent
|
|
167
|
-
} from "../index-
|
|
167
|
+
} from "../index-863ea9jb.js";
|
|
168
168
|
import {
|
|
169
169
|
DURABILITY_STEP_EVENT_KIND,
|
|
170
170
|
ParkAbortedError,
|
|
@@ -172,10 +172,10 @@ import {
|
|
|
172
172
|
StepAbortedError,
|
|
173
173
|
StepResultDecodeError,
|
|
174
174
|
StepResultNotSerializableError
|
|
175
|
-
} from "../index-
|
|
176
|
-
import"../index-
|
|
177
|
-
import"../index-
|
|
178
|
-
import"../index-
|
|
175
|
+
} from "../index-79z7m7dt.js";
|
|
176
|
+
import"../index-hmp4800j.js";
|
|
177
|
+
import"../index-khtgb21r.js";
|
|
178
|
+
import"../index-55hkhm67.js";
|
|
179
179
|
import"../index-zfrhfn82.js";
|
|
180
180
|
import"../index-35mh5bhj.js";
|
|
181
181
|
import {
|
|
@@ -186,8 +186,8 @@ import"../index-1zbbzgfh.js";
|
|
|
186
186
|
import {
|
|
187
187
|
defineRuntimeTool,
|
|
188
188
|
executableAgentRuntimeTools
|
|
189
|
-
} from "../index-
|
|
190
|
-
import"../index-
|
|
189
|
+
} from "../index-xw3s75nj.js";
|
|
190
|
+
import"../index-np4m8hd3.js";
|
|
191
191
|
import"../index-eqqvgdb3.js";
|
|
192
192
|
import"../index-znfs20ss.js";
|
|
193
193
|
import"../index-p5r7qpdd.js";
|
|
@@ -1973,44 +1973,192 @@ function createAgentScheduleTools(service) {
|
|
|
1973
1973
|
];
|
|
1974
1974
|
}
|
|
1975
1975
|
// src/agent-runtime/schedules.ts
|
|
1976
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
1977
|
+
import { z as z10 } from "zod";
|
|
1978
|
+
|
|
1979
|
+
// src/agent-runtime/schedule-records.ts
|
|
1976
1980
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
1977
1981
|
import { z as z9 } from "zod";
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1982
|
+
function newSchedule(request, observedAt) {
|
|
1983
|
+
const modes = [
|
|
1984
|
+
request.at !== undefined,
|
|
1985
|
+
request.afterMs !== undefined,
|
|
1986
|
+
request.everyMs !== undefined
|
|
1987
|
+
];
|
|
1988
|
+
if (modes.filter(Boolean).length !== 1)
|
|
1989
|
+
throw new TypeError("Declare exactly one schedule mode");
|
|
1990
|
+
if (request.everyMs !== undefined && !request.timeZone) {
|
|
1991
|
+
throw new TypeError("Repeating schedules require an explicit timeZone");
|
|
1992
|
+
}
|
|
1993
|
+
if (request.timeZone) {
|
|
1994
|
+
try {
|
|
1995
|
+
new Intl.DateTimeFormat("en", { timeZone: request.timeZone }).format(new Date(0));
|
|
1996
|
+
} catch {
|
|
1997
|
+
throw new TypeError(`Unknown schedule timeZone: ${request.timeZone}`);
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
const kind = request.at !== undefined ? "at" : request.afterMs !== undefined ? "after" : "every";
|
|
2001
|
+
const intervalMs = request.everyMs;
|
|
2002
|
+
const delay = request.afterMs ?? request.everyMs;
|
|
2003
|
+
if (delay !== undefined && (!Number.isSafeInteger(delay) || delay < 1)) {
|
|
2004
|
+
throw new TypeError("Schedule delay must be a positive safe integer");
|
|
2005
|
+
}
|
|
2006
|
+
const nextAt = request.at ? new Date(z9.iso.datetime({ offset: true }).parse(request.at)).toISOString() : new Date(observedAt.getTime() + (delay ?? 0)).toISOString();
|
|
2007
|
+
const schedule = AgentScheduleSchema.parse({
|
|
2008
|
+
id: randomUUID2(),
|
|
2009
|
+
conversationId: request.conversationId,
|
|
2010
|
+
kind,
|
|
2011
|
+
nextAt,
|
|
2012
|
+
...intervalMs !== undefined && { intervalMs },
|
|
2013
|
+
...request.timeZone && { timeZone: request.timeZone },
|
|
2014
|
+
input: z9.json().parse(request.input),
|
|
2015
|
+
state: "scheduled",
|
|
2016
|
+
occurrence: 0,
|
|
2017
|
+
createdAt: observedAt.toISOString(),
|
|
2018
|
+
updatedAt: observedAt.toISOString()
|
|
2019
|
+
});
|
|
2020
|
+
return schedule;
|
|
2021
|
+
}
|
|
2022
|
+
async function insertSchedule(sqlite, schedule) {
|
|
2023
|
+
await sqlite.transaction(async (scope) => {
|
|
2024
|
+
scope.database.prepare(`
|
|
2025
|
+
INSERT INTO stitchkit_agent_runtime_schedules (
|
|
2026
|
+
id, conversation_id, kind, next_at, interval_ms, time_zone,
|
|
2027
|
+
input_payload, state, occurrence, created_at, updated_at
|
|
2028
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, 'scheduled', 0, ?, ?)
|
|
2029
|
+
`).run(schedule.id, schedule.conversationId, schedule.kind, schedule.nextAt, schedule.intervalMs ?? null, schedule.timeZone ?? null, JSON.stringify(schedule.input), schedule.createdAt, schedule.updatedAt);
|
|
2030
|
+
await scope.appendEvent({
|
|
2031
|
+
conversationId: schedule.conversationId,
|
|
2032
|
+
kind: "schedule/set",
|
|
2033
|
+
occurredAt: schedule.createdAt,
|
|
2034
|
+
payload: { id: schedule.id, kind: schedule.kind, nextAt: schedule.nextAt }
|
|
2035
|
+
});
|
|
2036
|
+
});
|
|
2037
|
+
}
|
|
2038
|
+
async function recordDispatchFailure(sqlite, { schedule, occurrence, at, owner }, error) {
|
|
2039
|
+
await sqlite.transaction(async (scope) => {
|
|
2040
|
+
scope.database.prepare(`
|
|
2041
|
+
UPDATE stitchkit_agent_runtime_schedules
|
|
2042
|
+
SET claim_owner = NULL, claim_until = NULL, updated_at = ?
|
|
2043
|
+
WHERE id = ? AND claim_owner = ?
|
|
2044
|
+
`).run(at, schedule.id, owner);
|
|
2045
|
+
await scope.appendEvent({
|
|
2046
|
+
conversationId: schedule.conversationId,
|
|
2047
|
+
kind: "schedule/failed",
|
|
2048
|
+
occurredAt: at,
|
|
2049
|
+
payload: {
|
|
2050
|
+
id: schedule.id,
|
|
2051
|
+
occurrence,
|
|
2052
|
+
message: error instanceof Error ? error.message : String(error)
|
|
2053
|
+
}
|
|
2054
|
+
});
|
|
2055
|
+
});
|
|
2056
|
+
}
|
|
2057
|
+
async function settleFiring(sqlite, { schedule, occurrence, at, owner }, observedAt, lateByMs) {
|
|
2058
|
+
let nextAt = schedule.nextAt;
|
|
2059
|
+
if (schedule.kind === "every" && schedule.intervalMs) {
|
|
2060
|
+
let next = new Date(schedule.nextAt).getTime() + schedule.intervalMs;
|
|
2061
|
+
while (next <= observedAt.getTime())
|
|
2062
|
+
next += schedule.intervalMs;
|
|
2063
|
+
nextAt = new Date(next).toISOString();
|
|
2064
|
+
}
|
|
2065
|
+
const state = schedule.kind === "every" ? "scheduled" : "completed";
|
|
2066
|
+
await sqlite.transaction(async (scope) => {
|
|
2067
|
+
const held = scope.database.prepare(`
|
|
2068
|
+
SELECT state, claim_owner FROM stitchkit_agent_runtime_schedules WHERE id = ?
|
|
2069
|
+
`).get(schedule.id);
|
|
2070
|
+
const settled = held !== null && held !== undefined && (() => {
|
|
2071
|
+
const row = FinalizeRowSchema.parse(held);
|
|
2072
|
+
return row.state === "scheduled" && row.claim_owner === owner;
|
|
2073
|
+
})();
|
|
2074
|
+
if (settled) {
|
|
2075
|
+
scope.database.prepare(`
|
|
2076
|
+
UPDATE stitchkit_agent_runtime_schedules
|
|
2077
|
+
SET state = ?, occurrence = ?, next_at = ?, updated_at = ?,
|
|
2078
|
+
claim_owner = NULL, claim_until = NULL
|
|
2079
|
+
WHERE id = ?
|
|
2080
|
+
`).run(state, occurrence, nextAt, at, schedule.id);
|
|
2081
|
+
}
|
|
2082
|
+
if (lateByMs > 0) {
|
|
2083
|
+
await scope.appendEvent({
|
|
2084
|
+
conversationId: schedule.conversationId,
|
|
2085
|
+
kind: "schedule/late",
|
|
2086
|
+
occurredAt: at,
|
|
2087
|
+
payload: { id: schedule.id, occurrence, lateByMs }
|
|
2088
|
+
});
|
|
2089
|
+
}
|
|
2090
|
+
await scope.appendEvent({
|
|
2091
|
+
conversationId: schedule.conversationId,
|
|
2092
|
+
kind: "schedule/fired",
|
|
2093
|
+
occurredAt: at,
|
|
2094
|
+
payload: {
|
|
2095
|
+
id: schedule.id,
|
|
2096
|
+
occurrence,
|
|
2097
|
+
lateByMs,
|
|
2098
|
+
nextAt,
|
|
2099
|
+
state: settled ? state : "cancelled"
|
|
2100
|
+
}
|
|
2101
|
+
});
|
|
2102
|
+
});
|
|
2103
|
+
}
|
|
2104
|
+
function claimSchedule(sqlite, owner, id, until, at) {
|
|
2105
|
+
return sqlite.transaction(async (scope) => {
|
|
2106
|
+
const raw = scope.database.prepare(`
|
|
2107
|
+
SELECT state, claim_until FROM stitchkit_agent_runtime_schedules WHERE id = ?
|
|
2108
|
+
`).get(id);
|
|
2109
|
+
if (raw === null || raw === undefined)
|
|
2110
|
+
return false;
|
|
2111
|
+
const row = ClaimRowSchema.parse(raw);
|
|
2112
|
+
if (row.state !== "scheduled")
|
|
2113
|
+
return false;
|
|
2114
|
+
if (row.claim_until !== null && row.claim_until >= at)
|
|
2115
|
+
return false;
|
|
2116
|
+
scope.database.prepare(`
|
|
2117
|
+
UPDATE stitchkit_agent_runtime_schedules
|
|
2118
|
+
SET claim_owner = ?, claim_until = ?, updated_at = ?
|
|
2119
|
+
WHERE id = ?
|
|
2120
|
+
`).run(owner, until, at, id);
|
|
2121
|
+
return true;
|
|
2122
|
+
});
|
|
2123
|
+
}
|
|
2124
|
+
|
|
2125
|
+
// src/agent-runtime/schedules.ts
|
|
2126
|
+
var AgentScheduleSchema = z10.object({
|
|
2127
|
+
id: z10.string().min(1),
|
|
2128
|
+
conversationId: z10.string().min(1),
|
|
2129
|
+
kind: z10.enum(["at", "after", "every"]),
|
|
2130
|
+
nextAt: z10.iso.datetime({ offset: true }),
|
|
2131
|
+
intervalMs: z10.int().positive().optional(),
|
|
2132
|
+
timeZone: z10.string().min(1).optional(),
|
|
2133
|
+
input: z10.json(),
|
|
2134
|
+
state: z10.enum(["scheduled", "cancelled", "completed"]),
|
|
2135
|
+
occurrence: z10.int().nonnegative(),
|
|
2136
|
+
createdAt: z10.iso.datetime({ offset: true }),
|
|
2137
|
+
updatedAt: z10.iso.datetime({ offset: true })
|
|
1990
2138
|
}).strict();
|
|
1991
|
-
var ScheduleRowSchema =
|
|
1992
|
-
id:
|
|
1993
|
-
conversation_id:
|
|
1994
|
-
kind:
|
|
1995
|
-
next_at:
|
|
1996
|
-
interval_ms:
|
|
1997
|
-
time_zone:
|
|
1998
|
-
input_payload:
|
|
1999
|
-
state:
|
|
2000
|
-
occurrence:
|
|
2001
|
-
created_at:
|
|
2002
|
-
updated_at:
|
|
2139
|
+
var ScheduleRowSchema = z10.object({
|
|
2140
|
+
id: z10.string(),
|
|
2141
|
+
conversation_id: z10.string(),
|
|
2142
|
+
kind: z10.enum(["at", "after", "every"]),
|
|
2143
|
+
next_at: z10.string(),
|
|
2144
|
+
interval_ms: z10.number().int().positive().nullable(),
|
|
2145
|
+
time_zone: z10.string().nullable(),
|
|
2146
|
+
input_payload: z10.string(),
|
|
2147
|
+
state: z10.enum(["scheduled", "cancelled", "completed"]),
|
|
2148
|
+
occurrence: z10.int().nonnegative(),
|
|
2149
|
+
created_at: z10.string(),
|
|
2150
|
+
updated_at: z10.string()
|
|
2003
2151
|
});
|
|
2004
|
-
var ClaimRowSchema =
|
|
2005
|
-
state:
|
|
2006
|
-
claim_until:
|
|
2152
|
+
var ClaimRowSchema = z10.object({
|
|
2153
|
+
state: z10.enum(["scheduled", "cancelled", "completed"]),
|
|
2154
|
+
claim_until: z10.string().nullable()
|
|
2007
2155
|
});
|
|
2008
|
-
var FinalizeRowSchema =
|
|
2009
|
-
state:
|
|
2010
|
-
claim_owner:
|
|
2156
|
+
var FinalizeRowSchema = z10.object({
|
|
2157
|
+
state: z10.enum(["scheduled", "cancelled", "completed"]),
|
|
2158
|
+
claim_owner: z10.string().nullable()
|
|
2011
2159
|
});
|
|
2012
|
-
var StateRowSchema =
|
|
2013
|
-
state:
|
|
2160
|
+
var StateRowSchema = z10.object({
|
|
2161
|
+
state: z10.enum(["scheduled", "cancelled", "completed"])
|
|
2014
2162
|
});
|
|
2015
2163
|
function parseSchedule(raw) {
|
|
2016
2164
|
const row = ScheduleRowSchema.parse(raw);
|
|
@@ -2066,27 +2214,10 @@ function createAgentScheduleService(input) {
|
|
|
2066
2214
|
const delay = Math.max(0, new Date(raw.due_at).getTime() - now().getTime());
|
|
2067
2215
|
timer = setTimer(() => void tick(), Math.min(delay, 2147483647));
|
|
2068
2216
|
};
|
|
2069
|
-
const owner =
|
|
2217
|
+
const owner = randomUUID3();
|
|
2070
2218
|
const CLAIM_MS = 60000;
|
|
2071
2219
|
let ticking;
|
|
2072
|
-
const claim = (id, until, at) => input.sqlite
|
|
2073
|
-
const raw = scope.database.prepare(`
|
|
2074
|
-
SELECT state, claim_until FROM stitchkit_agent_runtime_schedules WHERE id = ?
|
|
2075
|
-
`).get(id);
|
|
2076
|
-
if (raw === null || raw === undefined)
|
|
2077
|
-
return false;
|
|
2078
|
-
const row = ClaimRowSchema.parse(raw);
|
|
2079
|
-
if (row.state !== "scheduled")
|
|
2080
|
-
return false;
|
|
2081
|
-
if (row.claim_until !== null && row.claim_until >= at)
|
|
2082
|
-
return false;
|
|
2083
|
-
scope.database.prepare(`
|
|
2084
|
-
UPDATE stitchkit_agent_runtime_schedules
|
|
2085
|
-
SET claim_owner = ?, claim_until = ?, updated_at = ?
|
|
2086
|
-
WHERE id = ?
|
|
2087
|
-
`).run(owner, until, at, id);
|
|
2088
|
-
return true;
|
|
2089
|
-
});
|
|
2220
|
+
const claim = (id, until, at) => claimSchedule(input.sqlite, owner, id, until, at);
|
|
2090
2221
|
const runTick = async () => {
|
|
2091
2222
|
if (closed)
|
|
2092
2223
|
return;
|
|
@@ -2112,70 +2243,10 @@ function createAgentScheduleService(input) {
|
|
|
2112
2243
|
schedule: { id: schedule.id, occurrence, lateByMs }
|
|
2113
2244
|
});
|
|
2114
2245
|
} catch (error) {
|
|
2115
|
-
await input.sqlite
|
|
2116
|
-
scope.database.prepare(`
|
|
2117
|
-
UPDATE stitchkit_agent_runtime_schedules
|
|
2118
|
-
SET claim_owner = NULL, claim_until = NULL, updated_at = ?
|
|
2119
|
-
WHERE id = ? AND claim_owner = ?
|
|
2120
|
-
`).run(at, schedule.id, owner);
|
|
2121
|
-
await scope.appendEvent({
|
|
2122
|
-
conversationId: schedule.conversationId,
|
|
2123
|
-
kind: "schedule/failed",
|
|
2124
|
-
occurredAt: at,
|
|
2125
|
-
payload: {
|
|
2126
|
-
id: schedule.id,
|
|
2127
|
-
occurrence,
|
|
2128
|
-
message: error instanceof Error ? error.message : String(error)
|
|
2129
|
-
}
|
|
2130
|
-
});
|
|
2131
|
-
});
|
|
2246
|
+
await recordDispatchFailure(input.sqlite, { schedule, occurrence, at, owner }, error);
|
|
2132
2247
|
continue;
|
|
2133
2248
|
}
|
|
2134
|
-
|
|
2135
|
-
if (schedule.kind === "every" && schedule.intervalMs) {
|
|
2136
|
-
let next = new Date(schedule.nextAt).getTime() + schedule.intervalMs;
|
|
2137
|
-
while (next <= observedAt.getTime())
|
|
2138
|
-
next += schedule.intervalMs;
|
|
2139
|
-
nextAt = new Date(next).toISOString();
|
|
2140
|
-
}
|
|
2141
|
-
const state = schedule.kind === "every" ? "scheduled" : "completed";
|
|
2142
|
-
await input.sqlite.transaction(async (scope) => {
|
|
2143
|
-
const held = scope.database.prepare(`
|
|
2144
|
-
SELECT state, claim_owner FROM stitchkit_agent_runtime_schedules WHERE id = ?
|
|
2145
|
-
`).get(schedule.id);
|
|
2146
|
-
const settled = held !== null && held !== undefined && (() => {
|
|
2147
|
-
const row = FinalizeRowSchema.parse(held);
|
|
2148
|
-
return row.state === "scheduled" && row.claim_owner === owner;
|
|
2149
|
-
})();
|
|
2150
|
-
if (settled) {
|
|
2151
|
-
scope.database.prepare(`
|
|
2152
|
-
UPDATE stitchkit_agent_runtime_schedules
|
|
2153
|
-
SET state = ?, occurrence = ?, next_at = ?, updated_at = ?,
|
|
2154
|
-
claim_owner = NULL, claim_until = NULL
|
|
2155
|
-
WHERE id = ?
|
|
2156
|
-
`).run(state, occurrence, nextAt, at, schedule.id);
|
|
2157
|
-
}
|
|
2158
|
-
if (lateByMs > 0) {
|
|
2159
|
-
await scope.appendEvent({
|
|
2160
|
-
conversationId: schedule.conversationId,
|
|
2161
|
-
kind: "schedule/late",
|
|
2162
|
-
occurredAt: at,
|
|
2163
|
-
payload: { id: schedule.id, occurrence, lateByMs }
|
|
2164
|
-
});
|
|
2165
|
-
}
|
|
2166
|
-
await scope.appendEvent({
|
|
2167
|
-
conversationId: schedule.conversationId,
|
|
2168
|
-
kind: "schedule/fired",
|
|
2169
|
-
occurredAt: at,
|
|
2170
|
-
payload: {
|
|
2171
|
-
id: schedule.id,
|
|
2172
|
-
occurrence,
|
|
2173
|
-
lateByMs,
|
|
2174
|
-
nextAt,
|
|
2175
|
-
state: settled ? state : "cancelled"
|
|
2176
|
-
}
|
|
2177
|
-
});
|
|
2178
|
-
});
|
|
2249
|
+
await settleFiring(input.sqlite, { schedule, occurrence, at, owner }, observedAt, lateByMs);
|
|
2179
2250
|
}
|
|
2180
2251
|
};
|
|
2181
2252
|
const tick = () => {
|
|
@@ -2188,58 +2259,8 @@ function createAgentScheduleService(input) {
|
|
|
2188
2259
|
return ticking;
|
|
2189
2260
|
};
|
|
2190
2261
|
const scheduleInput = async (request) => {
|
|
2191
|
-
const
|
|
2192
|
-
|
|
2193
|
-
request.afterMs !== undefined,
|
|
2194
|
-
request.everyMs !== undefined
|
|
2195
|
-
];
|
|
2196
|
-
if (modes.filter(Boolean).length !== 1)
|
|
2197
|
-
throw new TypeError("Declare exactly one schedule mode");
|
|
2198
|
-
if (request.everyMs !== undefined && !request.timeZone) {
|
|
2199
|
-
throw new TypeError("Repeating schedules require an explicit timeZone");
|
|
2200
|
-
}
|
|
2201
|
-
if (request.timeZone) {
|
|
2202
|
-
try {
|
|
2203
|
-
new Intl.DateTimeFormat("en", { timeZone: request.timeZone }).format(new Date(0));
|
|
2204
|
-
} catch {
|
|
2205
|
-
throw new TypeError(`Unknown schedule timeZone: ${request.timeZone}`);
|
|
2206
|
-
}
|
|
2207
|
-
}
|
|
2208
|
-
const observedAt = now();
|
|
2209
|
-
const kind = request.at !== undefined ? "at" : request.afterMs !== undefined ? "after" : "every";
|
|
2210
|
-
const intervalMs = request.everyMs;
|
|
2211
|
-
const delay = request.afterMs ?? request.everyMs;
|
|
2212
|
-
if (delay !== undefined && (!Number.isSafeInteger(delay) || delay < 1)) {
|
|
2213
|
-
throw new TypeError("Schedule delay must be a positive safe integer");
|
|
2214
|
-
}
|
|
2215
|
-
const nextAt = request.at ? new Date(z9.iso.datetime({ offset: true }).parse(request.at)).toISOString() : new Date(observedAt.getTime() + (delay ?? 0)).toISOString();
|
|
2216
|
-
const schedule = AgentScheduleSchema.parse({
|
|
2217
|
-
id: randomUUID2(),
|
|
2218
|
-
conversationId: request.conversationId,
|
|
2219
|
-
kind,
|
|
2220
|
-
nextAt,
|
|
2221
|
-
...intervalMs !== undefined && { intervalMs },
|
|
2222
|
-
...request.timeZone && { timeZone: request.timeZone },
|
|
2223
|
-
input: z9.json().parse(request.input),
|
|
2224
|
-
state: "scheduled",
|
|
2225
|
-
occurrence: 0,
|
|
2226
|
-
createdAt: observedAt.toISOString(),
|
|
2227
|
-
updatedAt: observedAt.toISOString()
|
|
2228
|
-
});
|
|
2229
|
-
await input.sqlite.transaction(async (scope) => {
|
|
2230
|
-
scope.database.prepare(`
|
|
2231
|
-
INSERT INTO stitchkit_agent_runtime_schedules (
|
|
2232
|
-
id, conversation_id, kind, next_at, interval_ms, time_zone,
|
|
2233
|
-
input_payload, state, occurrence, created_at, updated_at
|
|
2234
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, 'scheduled', 0, ?, ?)
|
|
2235
|
-
`).run(schedule.id, schedule.conversationId, schedule.kind, schedule.nextAt, schedule.intervalMs ?? null, schedule.timeZone ?? null, JSON.stringify(schedule.input), schedule.createdAt, schedule.updatedAt);
|
|
2236
|
-
await scope.appendEvent({
|
|
2237
|
-
conversationId: schedule.conversationId,
|
|
2238
|
-
kind: "schedule/set",
|
|
2239
|
-
occurredAt: schedule.createdAt,
|
|
2240
|
-
payload: { id: schedule.id, kind: schedule.kind, nextAt: schedule.nextAt }
|
|
2241
|
-
});
|
|
2242
|
-
});
|
|
2262
|
+
const schedule = newSchedule(request, now());
|
|
2263
|
+
await insertSchedule(input.sqlite, schedule);
|
|
2243
2264
|
arm();
|
|
2244
2265
|
return schedule;
|
|
2245
2266
|
};
|
|
@@ -2284,17 +2305,17 @@ function createAgentScheduleService(input) {
|
|
|
2284
2305
|
};
|
|
2285
2306
|
}
|
|
2286
2307
|
// src/agent-runtime/spill.ts
|
|
2287
|
-
import { createHash, randomUUID as
|
|
2288
|
-
import { z as
|
|
2289
|
-
var SpillRowSchema =
|
|
2290
|
-
payload:
|
|
2291
|
-
bytes:
|
|
2292
|
-
authorization_payload:
|
|
2308
|
+
import { createHash, randomUUID as randomUUID4 } from "node:crypto";
|
|
2309
|
+
import { z as z11 } from "zod";
|
|
2310
|
+
var SpillRowSchema = z11.object({
|
|
2311
|
+
payload: z11.instanceof(Uint8Array),
|
|
2312
|
+
bytes: z11.int().nonnegative(),
|
|
2313
|
+
authorization_payload: z11.string().nullable()
|
|
2293
2314
|
});
|
|
2294
|
-
var SpillMetadataRowSchema =
|
|
2295
|
-
reference_id:
|
|
2296
|
-
bytes:
|
|
2297
|
-
created_at:
|
|
2315
|
+
var SpillMetadataRowSchema = z11.object({
|
|
2316
|
+
reference_id: z11.string(),
|
|
2317
|
+
bytes: z11.int().nonnegative(),
|
|
2318
|
+
created_at: z11.string()
|
|
2298
2319
|
});
|
|
2299
2320
|
function decodeAuthorization(value) {
|
|
2300
2321
|
if (value === null)
|
|
@@ -2316,7 +2337,7 @@ function createSqliteAgentSpillStore(input) {
|
|
|
2316
2337
|
};
|
|
2317
2338
|
const authorization = (reference) => decodeAuthorization(rowFor(reference).authorization_payload);
|
|
2318
2339
|
const write = async (request) => {
|
|
2319
|
-
const reference =
|
|
2340
|
+
const reference = randomUUID4();
|
|
2320
2341
|
const createdAt = now();
|
|
2321
2342
|
const expiresAt = input.retentionMs ? new Date(createdAt.getTime() + input.retentionMs).toISOString() : null;
|
|
2322
2343
|
const sha256 = createHash("sha256").update(request.data).digest("hex");
|
|
@@ -2381,14 +2402,14 @@ function createSqliteAgentSpillStore(input) {
|
|
|
2381
2402
|
return { authorization, write, read, search, cleanup };
|
|
2382
2403
|
}
|
|
2383
2404
|
// src/agent-runtime/state-tools.ts
|
|
2384
|
-
import { z as
|
|
2385
|
-
var GoalSchema =
|
|
2386
|
-
objective:
|
|
2387
|
-
status:
|
|
2405
|
+
import { z as z12 } from "zod";
|
|
2406
|
+
var GoalSchema = z12.object({
|
|
2407
|
+
objective: z12.string().min(1),
|
|
2408
|
+
status: z12.enum(["active", "complete", "blocked"])
|
|
2388
2409
|
}).strict();
|
|
2389
|
-
var TodoItemSchema =
|
|
2390
|
-
step:
|
|
2391
|
-
status:
|
|
2410
|
+
var TodoItemSchema = z12.object({
|
|
2411
|
+
step: z12.string().min(1),
|
|
2412
|
+
status: z12.enum(["pending", "in_progress", "completed"])
|
|
2392
2413
|
}).strict();
|
|
2393
2414
|
function createAgentStateTools(input) {
|
|
2394
2415
|
const writeGoal = async (value) => {
|
|
@@ -2405,7 +2426,7 @@ function createAgentStateTools(input) {
|
|
|
2405
2426
|
name: "create_goal",
|
|
2406
2427
|
description: "Create the durable objective for this conversation.",
|
|
2407
2428
|
identity: { serviceName: "agent-state", action: "create-goal", method: "POST" },
|
|
2408
|
-
input:
|
|
2429
|
+
input: z12.object({ objective: z12.string().min(1) }).strict(),
|
|
2409
2430
|
output: GoalSchema,
|
|
2410
2431
|
transports: ["AGENT"],
|
|
2411
2432
|
handler: async ({ input: request }) => {
|
|
@@ -2419,9 +2440,9 @@ function createAgentStateTools(input) {
|
|
|
2419
2440
|
name: "update_goal",
|
|
2420
2441
|
description: "Update the durable objective or lifecycle status.",
|
|
2421
2442
|
identity: { serviceName: "agent-state", action: "update-goal", method: "POST" },
|
|
2422
|
-
input:
|
|
2423
|
-
objective:
|
|
2424
|
-
status:
|
|
2443
|
+
input: z12.object({
|
|
2444
|
+
objective: z12.string().min(1).optional(),
|
|
2445
|
+
status: z12.enum(["active", "complete", "blocked"]).optional()
|
|
2425
2446
|
}).strict().refine((request) => request.objective !== undefined || request.status !== undefined, {
|
|
2426
2447
|
message: "At least one goal field must be supplied"
|
|
2427
2448
|
}),
|
|
@@ -2439,8 +2460,8 @@ function createAgentStateTools(input) {
|
|
|
2439
2460
|
name: "get_goal",
|
|
2440
2461
|
description: "Read the durable objective for this conversation.",
|
|
2441
2462
|
identity: { serviceName: "agent-state", action: "get-goal", method: "GET" },
|
|
2442
|
-
input:
|
|
2443
|
-
output:
|
|
2463
|
+
input: z12.object({}).strict(),
|
|
2464
|
+
output: z12.object({ goal: GoalSchema.optional() }).strict(),
|
|
2444
2465
|
transports: ["AGENT"],
|
|
2445
2466
|
handler: async () => {
|
|
2446
2467
|
const current = await input.state.get(input.conversationId, "goal");
|
|
@@ -2451,8 +2472,8 @@ function createAgentStateTools(input) {
|
|
|
2451
2472
|
name: "todo_write",
|
|
2452
2473
|
description: "Replace the durable ordered work plan for this conversation.",
|
|
2453
2474
|
identity: { serviceName: "agent-state", action: "write-todo", method: "POST" },
|
|
2454
|
-
input:
|
|
2455
|
-
output:
|
|
2475
|
+
input: z12.object({ items: z12.array(TodoItemSchema) }).strict(),
|
|
2476
|
+
output: z12.object({ items: z12.array(TodoItemSchema) }).strict(),
|
|
2456
2477
|
transports: ["AGENT"],
|
|
2457
2478
|
handler: async ({ input: request }) => {
|
|
2458
2479
|
const stored = await input.state.set({
|
|
@@ -2461,7 +2482,7 @@ function createAgentStateTools(input) {
|
|
|
2461
2482
|
value: request,
|
|
2462
2483
|
actor: "agent"
|
|
2463
2484
|
});
|
|
2464
|
-
return
|
|
2485
|
+
return z12.object({ items: z12.array(TodoItemSchema) }).strict().parse(stored.value);
|
|
2465
2486
|
}
|
|
2466
2487
|
})
|
|
2467
2488
|
];
|