stitchkit 0.127.0 → 0.129.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 +194 -6
- package/dist/agent-executor/acp/v1-connect.d.ts +9 -1
- package/dist/agent-executor/acp/v1-connect.d.ts.map +1 -1
- package/dist/agent-executor/acp/v1-driver.d.ts +8 -2
- package/dist/agent-executor/acp/v1-driver.d.ts.map +1 -1
- package/dist/agent-executor/acp/v1-map.d.ts.map +1 -1
- package/dist/agent-executor/acp/v1-session.d.ts +8 -0
- package/dist/agent-executor/acp/v1-session.d.ts.map +1 -1
- package/dist/agent-executor/claude/cli-driver.d.ts +4 -0
- package/dist/agent-executor/claude/cli-driver.d.ts.map +1 -1
- package/dist/agent-executor/claude/protocol.d.ts +20 -2
- package/dist/agent-executor/claude/protocol.d.ts.map +1 -1
- package/dist/agent-executor/claude/session.d.ts +2 -1
- package/dist/agent-executor/claude/session.d.ts.map +1 -1
- package/dist/agent-executor/claude/transcript.d.ts +9 -6
- package/dist/agent-executor/claude/transcript.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/controls.d.ts +19 -0
- package/dist/agent-executor/claude-sdk/controls.d.ts.map +1 -0
- package/dist/agent-executor/claude-sdk/driver.d.ts +118 -4
- package/dist/agent-executor/claude-sdk/driver.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/query-loop.d.ts +46 -0
- package/dist/agent-executor/claude-sdk/query-loop.d.ts.map +1 -0
- package/dist/agent-executor/claude-sdk/query-options.d.ts +27 -0
- package/dist/agent-executor/claude-sdk/query-options.d.ts.map +1 -0
- package/dist/agent-executor/claude-sdk/session.d.ts +6 -5
- package/dist/agent-executor/claude-sdk/session.d.ts.map +1 -1
- package/dist/agent-executor/codex/classify.d.ts.map +1 -1
- package/dist/agent-executor/codex/connect.d.ts +45 -0
- package/dist/agent-executor/codex/connect.d.ts.map +1 -0
- package/dist/agent-executor/codex/driver.d.ts +55 -10
- package/dist/agent-executor/codex/driver.d.ts.map +1 -1
- package/dist/agent-executor/codex/limits.d.ts +11 -2
- package/dist/agent-executor/codex/limits.d.ts.map +1 -1
- package/dist/agent-executor/codex/protocol.d.ts +75 -6
- package/dist/agent-executor/codex/protocol.d.ts.map +1 -1
- package/dist/agent-executor/codex/session-controls.d.ts +155 -0
- package/dist/agent-executor/codex/session-controls.d.ts.map +1 -0
- package/dist/agent-executor/codex/session.d.ts +28 -30
- package/dist/agent-executor/codex/session.d.ts.map +1 -1
- package/dist/agent-executor/codex/unix-socket-target.d.ts +26 -0
- package/dist/agent-executor/codex/unix-socket-target.d.ts.map +1 -0
- package/dist/agent-executor/codex/unix-socket.d.ts +26 -0
- package/dist/agent-executor/codex/unix-socket.d.ts.map +1 -0
- package/dist/agent-executor/codex/ws-frame.d.ts +15 -0
- package/dist/agent-executor/codex/ws-frame.d.ts.map +1 -0
- package/dist/agent-executor/contract.d.ts +2 -0
- package/dist/agent-executor/contract.d.ts.map +1 -1
- package/dist/agent-executor/engine-process.d.ts +9 -0
- package/dist/agent-executor/engine-process.d.ts.map +1 -1
- package/dist/agent-executor/hello.d.ts +8 -0
- package/dist/agent-executor/hello.d.ts.map +1 -1
- package/dist/agent-executor/image-input.d.ts +71 -0
- package/dist/agent-executor/image-input.d.ts.map +1 -0
- package/dist/agent-executor/session-primitives.d.ts +0 -3
- package/dist/agent-executor/session-primitives.d.ts.map +1 -1
- package/dist/agent-runtime/agent-tool.d.ts +21 -7
- package/dist/agent-runtime/agent-tool.d.ts.map +1 -1
- package/dist/agent-runtime/branch-contract.d.ts +1 -0
- package/dist/agent-runtime/branch-contract.d.ts.map +1 -1
- package/dist/agent-runtime/branch-identities.d.ts +5 -2
- package/dist/agent-runtime/branch-identities.d.ts.map +1 -1
- package/dist/agent-runtime/branch-messages.d.ts +9 -9
- package/dist/agent-runtime/branch-messages.d.ts.map +1 -1
- package/dist/agent-runtime/branch-observations.d.ts +49 -36
- package/dist/agent-runtime/branch-observations.d.ts.map +1 -1
- package/dist/agent-runtime/branch-provider.d.ts +14 -8
- package/dist/agent-runtime/branch-provider.d.ts.map +1 -1
- package/dist/agent-runtime/branch-source.d.ts +13 -1
- package/dist/agent-runtime/branch-source.d.ts.map +1 -1
- package/dist/agent-runtime/child-tools.d.ts +64 -0
- package/dist/agent-runtime/child-tools.d.ts.map +1 -1
- package/dist/agent-runtime/event-search-tools.d.ts +82 -5
- package/dist/agent-runtime/event-search-tools.d.ts.map +1 -1
- package/dist/agent-runtime/invocation-attempt.d.ts +1 -1
- package/dist/agent-runtime/invocation-attempt.d.ts.map +1 -1
- package/dist/agent-runtime/invocation-payload.d.ts +12 -0
- package/dist/agent-runtime/invocation-payload.d.ts.map +1 -1
- package/dist/agent-runtime/invocation-read.d.ts +6 -3
- package/dist/agent-runtime/invocation-read.d.ts.map +1 -1
- package/dist/agent-runtime/invocation-schema.d.ts +50 -8
- package/dist/agent-runtime/invocation-schema.d.ts.map +1 -1
- package/dist/agent-runtime/invocations.d.ts +20 -9
- package/dist/agent-runtime/invocations.d.ts.map +1 -1
- package/dist/agent-runtime/postgres.d.ts.map +1 -1
- package/dist/agent-runtime/schedule-tools.d.ts +30 -0
- package/dist/agent-runtime/schedule-tools.d.ts.map +1 -1
- package/dist/agent-runtime/schemas-invocation-payload.d.ts +48 -0
- package/dist/agent-runtime/schemas-invocation-payload.d.ts.map +1 -0
- package/dist/agent-runtime/sql-events.d.ts.map +1 -1
- package/dist/agent-runtime/sql-rows.d.ts +10 -10
- package/dist/agent-runtime/sql-session.d.ts +11 -0
- package/dist/agent-runtime/sql-session.d.ts.map +1 -1
- package/dist/agent-runtime/sqlite-transactions.d.ts.map +1 -1
- package/dist/agent-runtime/state-tools.d.ts +55 -0
- package/dist/agent-runtime/state-tools.d.ts.map +1 -1
- package/dist/agent-runtime/store-branch.d.ts.map +1 -1
- package/dist/agent-runtime/store-conformance-lifecycle.d.ts +20 -20
- package/dist/agent-runtime/store-conformance-support.d.ts +10 -10
- package/dist/agent-runtime/store-create.d.ts.map +1 -1
- package/dist/agent-runtime/store-driver-contract.d.ts +12 -0
- package/dist/agent-runtime/store-driver-contract.d.ts.map +1 -1
- package/dist/agent-runtime/store-memory-events.d.ts.map +1 -1
- package/dist/agent-runtime/store.d.ts +7 -0
- package/dist/agent-runtime/store.d.ts.map +1 -1
- package/dist/agent-runtime/terminal-commit.d.ts +10 -10
- package/dist/declaration/declaration.d.ts +6 -3
- package/dist/declaration/declaration.d.ts.map +1 -1
- package/dist/entrypoints/agent-executor/acp.d.ts +1 -1
- package/dist/entrypoints/agent-executor/acp.d.ts.map +1 -1
- package/dist/entrypoints/agent-executor/acp.js +28 -17
- package/dist/entrypoints/agent-executor/claude-sdk.d.ts +1 -1
- package/dist/entrypoints/agent-executor/claude-sdk.d.ts.map +1 -1
- package/dist/entrypoints/agent-executor/claude-sdk.js +543 -96
- package/dist/entrypoints/agent-executor/claude.js +40 -21
- package/dist/entrypoints/agent-executor/codex.d.ts +4 -0
- package/dist/entrypoints/agent-executor/codex.d.ts.map +1 -1
- package/dist/entrypoints/agent-executor/codex.js +1530 -207
- package/dist/entrypoints/agent-executor.js +7 -7
- package/dist/entrypoints/agent-runtime/browser.js +1 -1
- package/dist/entrypoints/agent-runtime/coding-tools.js +3 -3
- package/dist/entrypoints/agent-runtime/harness.js +10 -11
- package/dist/entrypoints/agent-runtime/openrouter.js +4 -4
- package/dist/entrypoints/agent-runtime/postgres.js +12 -7
- package/dist/entrypoints/agent-runtime/realtime.js +4 -4
- package/dist/entrypoints/agent-runtime/sandbox.js +7 -7
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +7 -7
- package/dist/entrypoints/agent-runtime/sqlite/node.js +7 -7
- package/dist/entrypoints/agent-runtime/testing.js +9 -9
- package/dist/entrypoints/agent-runtime.d.ts +9 -7
- package/dist/entrypoints/agent-runtime.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime.js +254 -207
- package/dist/entrypoints/application/diagnostic-journal.js +4 -4
- package/dist/entrypoints/application/directory-inbox.js +8 -8
- package/dist/entrypoints/application/opentelemetry.js +2 -2
- package/dist/entrypoints/application.js +2 -2
- package/dist/entrypoints/cli/publish.js +8 -8
- package/dist/entrypoints/cli.js +12 -11
- package/dist/entrypoints/contract.js +2 -2
- package/dist/entrypoints/declaration.js +0 -1
- package/dist/entrypoints/files/packaging.js +2 -2
- package/dist/entrypoints/files.js +42 -19
- package/dist/entrypoints/handler.js +4 -4
- package/dist/entrypoints/http.js +5 -5
- package/dist/entrypoints/index.js +7 -7
- package/dist/entrypoints/node.js +7 -7
- package/dist/entrypoints/observability.js +4 -4
- package/dist/entrypoints/primitives.js +2 -2
- package/dist/entrypoints/process.js +6 -6
- package/dist/entrypoints/react.js +1 -1
- package/dist/entrypoints/remote.js +2 -2
- package/dist/entrypoints/server.js +10 -10
- package/dist/entrypoints/service-host/macos.js +6 -6
- package/dist/entrypoints/service-host.d.ts +4 -1
- package/dist/entrypoints/service-host.d.ts.map +1 -1
- package/dist/entrypoints/service-host.js +835 -224
- package/dist/entrypoints/spend.js +1 -1
- package/dist/entrypoints/sync/postgres.js +1 -1
- package/dist/entrypoints/sync.js +2 -2
- package/dist/entrypoints/telegram.js +5 -5
- package/dist/entrypoints/testing.js +5 -5
- package/dist/entrypoints/tools/agent.js +5 -4
- package/dist/entrypoints/tools/connections.js +2 -2
- package/dist/entrypoints/tools/invoker.js +4 -3
- package/dist/entrypoints/tools/mcp.js +5 -4
- package/dist/entrypoints/tools/toolkit.js +8 -7
- package/dist/entrypoints/tools.d.ts +1 -1
- package/dist/entrypoints/tools.d.ts.map +1 -1
- package/dist/entrypoints/tools.js +15 -13
- package/dist/entrypoints/tracking/contract.js +1 -1
- package/dist/entrypoints/xlsx.js +1 -1
- package/dist/files/directory-appearance.d.ts +20 -9
- package/dist/files/directory-appearance.d.ts.map +1 -1
- package/dist/files/polled-json.d.ts.map +1 -1
- package/dist/files/regular-file.d.ts +15 -5
- package/dist/files/regular-file.d.ts.map +1 -1
- package/dist/{index-prf6ayhf.js → index-13wmzpa6.js} +1 -1
- package/dist/{index-qnzhmk2s.js → index-17qgm6xe.js} +91 -48
- package/dist/{index-wv8dqy7q.js → index-205456mf.js} +1 -1
- package/dist/{index-3gwp8ez6.js → index-21cfxc4z.js} +13 -18
- package/dist/{index-xtkw9866.js → index-2c5w2d1d.js} +1 -1
- package/dist/{index-g1q7fwn9.js → index-2nwvn7m2.js} +1 -1
- package/dist/{index-d4svrknj.js → index-39c2hj6h.js} +2 -2
- package/dist/{index-sfzfd2m2.js → index-39rmc00v.js} +1 -1
- package/dist/{index-ky3ardqn.js → index-3fym4j8n.js} +1 -1
- package/dist/{index-d96c1n1q.js → index-5tdc0q43.js} +20 -19
- package/dist/{index-3ypvpkwr.js → index-669374qc.js} +1 -1
- package/dist/{index-x90w78yz.js → index-673drwkn.js} +23 -8
- package/dist/{index-83n766x4.js → index-7jqn3b3g.js} +16 -10
- package/dist/{index-5jyjb4s0.js → index-80acsm27.js} +1 -1
- package/dist/{index-xmr47znh.js → index-827bgv33.js} +1 -1
- package/dist/{index-xypxnzhp.js → index-93n6jwy0.js} +4 -4
- package/dist/{index-wbnpa8z6.js → index-9kpxz49v.js} +5 -5
- package/dist/{index-fcw255hd.js → index-9sfhje6y.js} +3 -3
- package/dist/{index-bh4pmtr9.js → index-afb6z77w.js} +3 -1
- package/dist/{index-9y0afd5f.js → index-apf5g7y9.js} +1 -1
- package/dist/{index-4qvyhn23.js → index-bjmj2q1z.js} +1 -1
- package/dist/{index-bbzvrq66.js → index-dcsxj68j.js} +457 -204
- package/dist/{index-j516jaaz.js → index-dnzxxf8a.js} +49 -2
- package/dist/{index-kmbpej2y.js → index-emgrmavr.js} +102 -61
- package/dist/index-fgahdc7s.js +100 -0
- package/dist/{index-kzavdze2.js → index-gr0kxymw.js} +5 -1
- package/dist/{index-e06z0tkb.js → index-gya4hwh3.js} +2 -2
- package/dist/{index-3djgv3ch.js → index-hab790s6.js} +26 -11
- package/dist/{index-j13gzgdv.js → index-j0ef04jw.js} +9 -5
- package/dist/{index-rhb33thr.js → index-jcge9tx3.js} +1 -1
- package/dist/{index-dvd1qdwa.js → index-ke02kxsr.js} +3 -3
- package/dist/{index-3agqmmrg.js → index-mkfhpk11.js} +7 -9
- package/dist/{index-a725ayvz.js → index-mttkdm5a.js} +1 -1
- package/dist/{index-9wh98cpa.js → index-n3bm7zqq.js} +131 -91
- package/dist/{index-7xp05h20.js → index-p06z7g7w.js} +7 -7
- package/dist/{index-kt6dh1n6.js → index-p16q492v.js} +1 -1
- package/dist/{index-5zwac8ft.js → index-pp97q86a.js} +3 -3
- package/dist/{index-39n02e0q.js → index-psye60qn.js} +1 -1
- package/dist/{index-5ptwb6ka.js → index-pzhqydxb.js} +1 -1
- package/dist/{index-7kfcb576.js → index-qa2jjb65.js} +1 -1
- package/dist/{index-0djnptn8.js → index-qhjmmsm2.js} +10 -3
- package/dist/{index-7grgs8cx.js → index-qpzyahe3.js} +2 -2
- package/dist/{index-8xr2eq99.js → index-r97ppg0g.js} +4 -4
- package/dist/{index-bmaz3jzy.js → index-rjs94dny.js} +1 -1
- package/dist/{index-p1m9djt6.js → index-rxh3qy4x.js} +33 -6
- package/dist/{index-en8e5zsj.js → index-ryxb427v.js} +1 -1
- package/dist/{index-nbv44x0x.js → index-s2e3h616.js} +137 -36
- package/dist/{index-dwa6pskj.js → index-sd4e5x5j.js} +86 -47
- package/dist/{index-g56ht6qf.js → index-t3qcac2a.js} +1 -1
- package/dist/index-vgzhw2zk.js +304 -0
- package/dist/{index-jrka9029.js → index-vmbxj75t.js} +2 -2
- package/dist/{index-caywx1c0.js → index-wv2amqm4.js} +109 -12
- package/dist/{index-5e0zsbf7.js → index-x2fb37t0.js} +2 -2
- package/dist/{index-z4k0hqp9.js → index-y71zn1gw.js} +137 -27
- package/dist/{index-wavv538x.js → index-ybdq8kk2.js} +3 -3
- package/dist/{index-4gk6k3zc.js → index-ycr4pk0z.js} +1 -1
- package/dist/{index-0tyt97nk.js → index-yrr3n391.js} +1 -1
- package/dist/{index-v37b2cd6.js → index-z20pdxeb.js} +2 -2
- package/dist/{index-0hdm5sx6.js → index-z9d74jmb.js} +8 -4
- package/dist/{index-4s2w4g37.js → index-zhshhxew.js} +80 -2
- package/dist/{index-3b31z0pc.js → index-znd1b57f.js} +12 -6
- package/dist/internal/bounded-file-confirm.d.ts +32 -0
- package/dist/internal/bounded-file-confirm.d.ts.map +1 -0
- package/dist/internal/bounded-file-read.d.ts +10 -7
- package/dist/internal/bounded-file-read.d.ts.map +1 -1
- package/dist/internal/file-observation.d.ts +5 -1
- package/dist/internal/file-observation.d.ts.map +1 -1
- package/dist/internal/positive-integer.d.ts +2 -0
- package/dist/internal/positive-integer.d.ts.map +1 -1
- package/dist/internal/process-instance.d.ts +8 -0
- package/dist/internal/process-instance.d.ts.map +1 -1
- package/dist/internal/unix-socket.d.ts +10 -1
- package/dist/internal/unix-socket.d.ts.map +1 -1
- package/dist/server/unix-client.d.ts +7 -0
- package/dist/server/unix-client.d.ts.map +1 -1
- package/dist/service-host/systemd-inspect.d.ts +3 -1
- package/dist/service-host/systemd-inspect.d.ts.map +1 -1
- package/dist/service-host/systemd-render-shared.d.ts +64 -0
- package/dist/service-host/systemd-render-shared.d.ts.map +1 -0
- package/dist/service-host/systemd-render.d.ts +31 -26
- package/dist/service-host/systemd-render.d.ts.map +1 -1
- package/dist/service-host/systemd-timer-render.d.ts +31 -0
- package/dist/service-host/systemd-timer-render.d.ts.map +1 -0
- package/dist/service-host/systemd-timer-rollback.d.ts +26 -0
- package/dist/service-host/systemd-timer-rollback.d.ts.map +1 -0
- package/dist/service-host/systemd-timer.d.ts +82 -0
- package/dist/service-host/systemd-timer.d.ts.map +1 -0
- package/dist/service-host/systemd-unit-ops.d.ts +26 -0
- package/dist/service-host/systemd-unit-ops.d.ts.map +1 -0
- package/dist/service-host/systemd.d.ts +1 -1
- package/dist/service-host/systemd.d.ts.map +1 -1
- package/dist/tools/access.d.ts +30 -1
- package/dist/tools/access.d.ts.map +1 -1
- package/dist/tools/agent.d.ts +2 -2
- package/dist/tools/agent.d.ts.map +1 -1
- package/dist/tools/cli/args-scan.d.ts +5 -0
- package/dist/tools/cli/args-scan.d.ts.map +1 -1
- package/dist/tools/cli/args.d.ts +11 -5
- package/dist/tools/cli/args.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/notices.d.ts.map +1 -1
- package/dist/tools/cli/run-managed.d.ts.map +1 -1
- package/dist/tools/cli/session.d.ts.map +1 -1
- package/dist/tools/execute.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/list-names.d.ts +2 -3
- package/dist/tools/list-names.d.ts.map +1 -1
- package/dist/tools/manifest.d.ts +2 -3
- package/dist/tools/manifest.d.ts.map +1 -1
- package/dist/tools/mcp/mount.d.ts +5 -5
- package/dist/tools/mcp/mount.d.ts.map +1 -1
- package/dist/tools/mcp/register.d.ts +2 -1
- package/dist/tools/mcp/register.d.ts.map +1 -1
- package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
- package/llms/agent-executor-acp.txt +10 -6
- package/llms/agent-executor-claude-sdk.txt +13 -10
- package/llms/agent-executor-claude.txt +2 -2
- package/llms/agent-executor-codex.txt +9 -3
- package/llms/agent-executor.txt +2 -2
- package/llms/agent-runtime.4.txt +21 -9
- package/llms/cli.3.txt +4 -4
- package/llms/cli.txt +1 -0
- package/llms/declaration.txt +2 -2
- package/llms/files.txt +1 -1
- package/llms/node.txt +2 -2
- package/llms/server.5.txt +2 -2
- package/llms/service-host.txt +5 -5
- package/llms/stitchkit.txt +81 -77
- package/llms/tools.3.txt +3 -2
- package/llms/upgrading-0.128.0-0.129.0.txt +175 -0
- package/llms/upgrading.txt +1 -0
- package/llms-full.txt +323 -127
- package/llms.txt +15 -14
- package/package.json +1 -1
- package/dist/index-ajmtxsky.js +0 -193
- package/dist/index-ax3wns1a.js +0 -93
|
@@ -6,19 +6,15 @@ import {
|
|
|
6
6
|
localVerdict
|
|
7
7
|
} from "./index-dsa676h8.js";
|
|
8
8
|
import {
|
|
9
|
-
objectShapeKeys
|
|
10
|
-
rebuildObject,
|
|
11
|
-
mergeSchemas
|
|
9
|
+
objectShapeKeys
|
|
12
10
|
} from "./index-360j58vb.js";
|
|
13
11
|
import {
|
|
14
12
|
coerceJsonArgs2
|
|
15
13
|
} from "./index-j903yhp4.js";
|
|
16
14
|
import {
|
|
17
15
|
applyToolViewDefaults,
|
|
18
|
-
projectToolView
|
|
19
|
-
|
|
20
|
-
projectToolSurface
|
|
21
|
-
} from "./index-3ypvpkwr.js";
|
|
16
|
+
projectToolView
|
|
17
|
+
} from "./index-669374qc.js";
|
|
22
18
|
import {
|
|
23
19
|
runWithRequestContext2,
|
|
24
20
|
getRequestContext2
|
|
@@ -42,6 +38,130 @@ import {
|
|
|
42
38
|
isRecord
|
|
43
39
|
} from "./index-ps3djm8d.js";
|
|
44
40
|
|
|
41
|
+
// src/tools/access.ts
|
|
42
|
+
var TOOL_OPEN_REASONS = ["public", "local-operator", "remote"];
|
|
43
|
+
var TOOL_OPEN_REASON_SET = new Set(TOOL_OPEN_REASONS);
|
|
44
|
+
var inspectOnlyLifecycles = new WeakMap;
|
|
45
|
+
function accessRequiredMessage(entryName) {
|
|
46
|
+
return `${entryName}: access is required — pass { gate } with the auth hook, { open }, or { inspect: true }`;
|
|
47
|
+
}
|
|
48
|
+
function legacyLifecycleMessage(entryName) {
|
|
49
|
+
return `${entryName}: access is required — pass { gate } with the auth hook, { open }, or { inspect: true } ("lifecycle" was replaced by "access")`;
|
|
50
|
+
}
|
|
51
|
+
function inspectForbiddenError(entryName) {
|
|
52
|
+
return new AppError2("FORBIDDEN", {
|
|
53
|
+
message: `${entryName}: mounted with access: { inspect: true } (read-only surface inspection); tool execution is forbidden`,
|
|
54
|
+
status: 403
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function isInspectOnlyLifecycle(lifecycle) {
|
|
58
|
+
return lifecycle !== undefined && inspectOnlyLifecycles.has(lifecycle);
|
|
59
|
+
}
|
|
60
|
+
function inspectOnlyError(lifecycle) {
|
|
61
|
+
if (lifecycle === undefined)
|
|
62
|
+
return;
|
|
63
|
+
const entryName = inspectOnlyLifecycles.get(lifecycle);
|
|
64
|
+
return entryName !== undefined ? inspectForbiddenError(entryName) : undefined;
|
|
65
|
+
}
|
|
66
|
+
function isBeforeHandleHook(value) {
|
|
67
|
+
return typeof value === "function";
|
|
68
|
+
}
|
|
69
|
+
function isAfterHandleHook(value) {
|
|
70
|
+
return typeof value === "function";
|
|
71
|
+
}
|
|
72
|
+
function isToolOpenReason(value) {
|
|
73
|
+
return typeof value === "string" && TOOL_OPEN_REASON_SET.has(value);
|
|
74
|
+
}
|
|
75
|
+
function resolveToolAccess(entryName, config) {
|
|
76
|
+
if (!isRecord(config)) {
|
|
77
|
+
throw new TypeError(accessRequiredMessage(entryName));
|
|
78
|
+
}
|
|
79
|
+
if (Object.hasOwn(config, "lifecycle")) {
|
|
80
|
+
throw new TypeError(legacyLifecycleMessage(entryName));
|
|
81
|
+
}
|
|
82
|
+
if (!Object.hasOwn(config, "access")) {
|
|
83
|
+
throw new TypeError(accessRequiredMessage(entryName));
|
|
84
|
+
}
|
|
85
|
+
const { access } = config;
|
|
86
|
+
if (!isRecord(access)) {
|
|
87
|
+
throw new TypeError(accessRequiredMessage(entryName));
|
|
88
|
+
}
|
|
89
|
+
const hasGate = Object.hasOwn(access, "gate") && access.gate !== undefined;
|
|
90
|
+
const hasOpen = Object.hasOwn(access, "open") && access.open !== undefined;
|
|
91
|
+
const hasInspect = Object.hasOwn(access, "inspect") && access.inspect !== undefined;
|
|
92
|
+
if (Number(hasGate) + Number(hasOpen) + Number(hasInspect) !== 1) {
|
|
93
|
+
throw new TypeError(accessRequiredMessage(entryName));
|
|
94
|
+
}
|
|
95
|
+
if (hasGate) {
|
|
96
|
+
for (const key of Object.keys(access)) {
|
|
97
|
+
if (key === "gate")
|
|
98
|
+
continue;
|
|
99
|
+
if ((key === "open" || key === "inspect" || key === "afterHandle") && access[key] === undefined)
|
|
100
|
+
continue;
|
|
101
|
+
throw new TypeError(accessRequiredMessage(entryName));
|
|
102
|
+
}
|
|
103
|
+
const { gate } = access;
|
|
104
|
+
if (!isRecord(gate)) {
|
|
105
|
+
throw new TypeError(accessRequiredMessage(entryName));
|
|
106
|
+
}
|
|
107
|
+
const { beforeHandle, afterHandle } = gate;
|
|
108
|
+
if (!isBeforeHandleHook(beforeHandle)) {
|
|
109
|
+
throw new TypeError(accessRequiredMessage(entryName));
|
|
110
|
+
}
|
|
111
|
+
if (afterHandle !== undefined && !isAfterHandleHook(afterHandle)) {
|
|
112
|
+
throw new TypeError(accessRequiredMessage(entryName));
|
|
113
|
+
}
|
|
114
|
+
return afterHandle !== undefined ? { beforeHandle, afterHandle } : { beforeHandle };
|
|
115
|
+
}
|
|
116
|
+
if (hasInspect) {
|
|
117
|
+
for (const key of Object.keys(access)) {
|
|
118
|
+
if (key === "inspect")
|
|
119
|
+
continue;
|
|
120
|
+
if ((key === "gate" || key === "open" || key === "afterHandle") && access[key] === undefined)
|
|
121
|
+
continue;
|
|
122
|
+
throw new TypeError(accessRequiredMessage(entryName));
|
|
123
|
+
}
|
|
124
|
+
if (access.inspect !== true) {
|
|
125
|
+
throw new TypeError(accessRequiredMessage(entryName));
|
|
126
|
+
}
|
|
127
|
+
const lifecycle = {
|
|
128
|
+
beforeHandle() {
|
|
129
|
+
throw inspectForbiddenError(entryName);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
inspectOnlyLifecycles.set(lifecycle, entryName);
|
|
133
|
+
return lifecycle;
|
|
134
|
+
}
|
|
135
|
+
for (const key of Object.keys(access)) {
|
|
136
|
+
if (key === "open" || key === "afterHandle")
|
|
137
|
+
continue;
|
|
138
|
+
if ((key === "gate" || key === "inspect") && access[key] === undefined)
|
|
139
|
+
continue;
|
|
140
|
+
throw new TypeError(accessRequiredMessage(entryName));
|
|
141
|
+
}
|
|
142
|
+
const { open, afterHandle } = access;
|
|
143
|
+
if (!isToolOpenReason(open)) {
|
|
144
|
+
throw new TypeError(accessRequiredMessage(entryName));
|
|
145
|
+
}
|
|
146
|
+
if (afterHandle !== undefined && !isAfterHandleHook(afterHandle)) {
|
|
147
|
+
throw new TypeError(accessRequiredMessage(entryName));
|
|
148
|
+
}
|
|
149
|
+
return afterHandle !== undefined ? { afterHandle } : {};
|
|
150
|
+
}
|
|
151
|
+
function resolveOptionalCliToolAccess(entryName, config) {
|
|
152
|
+
if (!isRecord(config)) {
|
|
153
|
+
throw new TypeError(accessRequiredMessage(entryName));
|
|
154
|
+
}
|
|
155
|
+
if (Object.hasOwn(config, "lifecycle")) {
|
|
156
|
+
throw new TypeError(legacyLifecycleMessage(entryName));
|
|
157
|
+
}
|
|
158
|
+
const hasManagedSurface = config.services !== undefined || config.runtimeTools !== undefined;
|
|
159
|
+
if (hasManagedSurface || Object.hasOwn(config, "access") && config.access !== undefined) {
|
|
160
|
+
return resolveToolAccess(entryName, config);
|
|
161
|
+
}
|
|
162
|
+
return {};
|
|
163
|
+
}
|
|
164
|
+
|
|
45
165
|
// src/tools/execute-args.ts
|
|
46
166
|
import { z } from "zod";
|
|
47
167
|
function parseToolCallArguments(method, callArgs, {
|
|
@@ -178,6 +298,9 @@ var noProgress = async () => {
|
|
|
178
298
|
return;
|
|
179
299
|
};
|
|
180
300
|
async function executeToolMethod(method, call, options = {}) {
|
|
301
|
+
const inspectErr = inspectOnlyError(options.lifecycle);
|
|
302
|
+
if (inspectErr)
|
|
303
|
+
return toolResultFromError(inspectErr);
|
|
181
304
|
const { toolName, context } = call;
|
|
182
305
|
return inToolCallContext({ source: context.source, toolName, method }, () => runToolMethod(method, call, options));
|
|
183
306
|
}
|
|
@@ -386,87 +509,4 @@ async function runToolMethod(method, { toolName, rawArgs, context }, {
|
|
|
386
509
|
}
|
|
387
510
|
}
|
|
388
511
|
|
|
389
|
-
|
|
390
|
-
import { z as z2 } from "zod";
|
|
391
|
-
function applyExtend(base, extra) {
|
|
392
|
-
if (base instanceof z2.ZodObject) {
|
|
393
|
-
assertToolExtensionCompatible(base, extra);
|
|
394
|
-
return rebuildObject(base, { ...extra, ...base.shape });
|
|
395
|
-
}
|
|
396
|
-
return z2.intersection(z2.object(extra), base);
|
|
397
|
-
}
|
|
398
|
-
function contractToolMountable(projected, extend) {
|
|
399
|
-
const method = projected.source;
|
|
400
|
-
const baseArgumentSchema = mergeSchemas(method.paramsSchema, method.inputSchema);
|
|
401
|
-
const argumentSchema = projected.shouldExtend && extend ? applyExtend(baseArgumentSchema, extend.schema) : baseArgumentSchema;
|
|
402
|
-
return {
|
|
403
|
-
method,
|
|
404
|
-
name: projected.name,
|
|
405
|
-
argumentSchema,
|
|
406
|
-
presentationSchema: projected.presentationSchema,
|
|
407
|
-
shouldExtend: projected.shouldExtend
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
function collectTools2(service, transport, config = {}) {
|
|
411
|
-
const {
|
|
412
|
-
extend,
|
|
413
|
-
flattenUnionInput = false,
|
|
414
|
-
inputRecursionDepth,
|
|
415
|
-
assertNames = true
|
|
416
|
-
} = config;
|
|
417
|
-
const tools = [];
|
|
418
|
-
for (const projected of projectToolSurface({ services: [service] }, transport === "HTTP" ? "AGENT" : transport, {
|
|
419
|
-
extend,
|
|
420
|
-
flattenUnionInput,
|
|
421
|
-
inputRecursionDepth,
|
|
422
|
-
assertNames,
|
|
423
|
-
assertUniqueNames: false
|
|
424
|
-
})) {
|
|
425
|
-
if (projected.kind !== "contract")
|
|
426
|
-
continue;
|
|
427
|
-
tools.push(contractToolMountable(projected, extend));
|
|
428
|
-
}
|
|
429
|
-
return tools;
|
|
430
|
-
}
|
|
431
|
-
function createToolRunner(config) {
|
|
432
|
-
const extension = config.extend ? {
|
|
433
|
-
schema: z2.object(config.extend.schema),
|
|
434
|
-
resolve: config.extend.resolve
|
|
435
|
-
} : undefined;
|
|
436
|
-
return async function runOneToolCall(tool, rawArgs, context, call) {
|
|
437
|
-
return executeToolMethod(tool.method, {
|
|
438
|
-
toolName: tool.name,
|
|
439
|
-
rawArgs,
|
|
440
|
-
context: { ...config.context, ...context, source: config.source }
|
|
441
|
-
}, {
|
|
442
|
-
hooks: config.hooks,
|
|
443
|
-
lifecycle: config.lifecycle,
|
|
444
|
-
coerceJson: config.coerceJsonArgs ?? true,
|
|
445
|
-
onOutputStrip: config.onOutputStrip ? (paths) => config.onOutputStrip?.(tool.name, paths) : undefined,
|
|
446
|
-
extension: tool.shouldExtend ? extension : undefined,
|
|
447
|
-
toolSurface: config.toolSurface ?? false,
|
|
448
|
-
finalizeOutput: call?.finalizeOutput
|
|
449
|
-
});
|
|
450
|
-
};
|
|
451
|
-
}
|
|
452
|
-
function formatToolError(result, toolName, errorHint) {
|
|
453
|
-
const err = {
|
|
454
|
-
error: result.code,
|
|
455
|
-
retryable: result.retryable ?? isRetryableStatus2(toolErrorFromResult(result).status)
|
|
456
|
-
};
|
|
457
|
-
if (result.details)
|
|
458
|
-
err.details = result.details;
|
|
459
|
-
const hints = [];
|
|
460
|
-
if (result.hint)
|
|
461
|
-
hints.push(result.hint);
|
|
462
|
-
if (errorHint && toolName) {
|
|
463
|
-
const global = errorHint(toolName, result.code);
|
|
464
|
-
if (global)
|
|
465
|
-
hints.push(global);
|
|
466
|
-
}
|
|
467
|
-
if (hints.length > 0)
|
|
468
|
-
err._hint = hints.join(" ");
|
|
469
|
-
return err;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
export { parseToolCallArguments, toolResultFromError, toolErrorFromResult, toolCauseFromResult, observed, ToolExecutionControlError2, isToolExecutionControlError2, contractToolMountable, collectTools2, createToolRunner, formatToolError };
|
|
512
|
+
export { isInspectOnlyLifecycle, inspectOnlyError, resolveToolAccess, resolveOptionalCliToolAccess, parseToolCallArguments, toolResultFromError, toolErrorFromResult, toolCauseFromResult, observed, ToolExecutionControlError2, isToolExecutionControlError2, executeToolMethod };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "./index-9wh98cpa.js";
|
|
2
|
+
resolveToolAccess,
|
|
3
|
+
toolErrorFromResult
|
|
4
|
+
} from "./index-n3bm7zqq.js";
|
|
6
5
|
import {
|
|
7
6
|
assertUniqueToolName
|
|
8
|
-
} from "./index-
|
|
7
|
+
} from "./index-669374qc.js";
|
|
9
8
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
collectTools2,
|
|
10
|
+
createToolRunner
|
|
11
|
+
} from "./index-fgahdc7s.js";
|
|
12
12
|
import {
|
|
13
13
|
AppError2
|
|
14
14
|
} from "./index-9pv126eh.js";
|
|
@@ -4,16 +4,16 @@ import {
|
|
|
4
4
|
syncDirectory,
|
|
5
5
|
publishAtomicFile,
|
|
6
6
|
publishAtomicFileSync
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-2c5w2d1d.js";
|
|
8
8
|
import {
|
|
9
9
|
closeAfter,
|
|
10
10
|
closeAfterSync,
|
|
11
11
|
readBoundedFile,
|
|
12
12
|
readBoundedFileSync
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-s2e3h616.js";
|
|
14
14
|
import {
|
|
15
15
|
stagingPath
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-psye60qn.js";
|
|
17
17
|
import {
|
|
18
18
|
errnoOf
|
|
19
19
|
} from "./index-jj9228tt.js";
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
nextEventSeqByMaximum,
|
|
8
8
|
agentSqlTables,
|
|
9
9
|
createAgentRuntimeStore2
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-dcsxj68j.js";
|
|
11
11
|
import {
|
|
12
12
|
canonicalAgentJson2
|
|
13
13
|
} from "./index-9xr44d2g.js";
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
scanSqlRecoverable,
|
|
23
23
|
listSqlConversations,
|
|
24
24
|
pageSqlConversationMessages
|
|
25
|
-
} from "./index-
|
|
25
|
+
} from "./index-zhshhxew.js";
|
|
26
26
|
import {
|
|
27
27
|
rollbackSqliteFailure
|
|
28
28
|
} from "./index-ttexdtjj.js";
|
|
@@ -398,7 +398,14 @@ var sqliteDialect = {
|
|
|
398
398
|
conversationTables: conversationTables(TABLES3),
|
|
399
399
|
messageRowId: "rowid",
|
|
400
400
|
contains: (column) => `instr(${column}, ?) > 0`,
|
|
401
|
-
nextEventSeq: (session, conversationId) => nextEventSeqByMaximum(sqliteDialect, session, conversationId)
|
|
401
|
+
nextEventSeq: (session, conversationId) => nextEventSeqByMaximum(sqliteDialect, session, conversationId),
|
|
402
|
+
async syncUpdatedEventSearch(session, event) {
|
|
403
|
+
if (event.rowId === undefined)
|
|
404
|
+
return;
|
|
405
|
+
await session.run(`DELETE FROM ${TABLES3.events}_fts WHERE rowid = ?`, [event.rowId]);
|
|
406
|
+
await session.run(`INSERT INTO ${TABLES3.events}_fts (rowid, conversation_id, event_seq, occurred_at, body)
|
|
407
|
+
VALUES (?, ?, ?, ?, ?)`, [event.rowId, event.conversationId, event.seq, event.occurredAt, event.payload]);
|
|
408
|
+
}
|
|
402
409
|
};
|
|
403
410
|
function sqliteSession(database) {
|
|
404
411
|
return {
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
} from "./index-0p0s5hrj.js";
|
|
5
5
|
import {
|
|
6
6
|
createAgentRuntimeEventSink2
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-205456mf.js";
|
|
8
8
|
import {
|
|
9
9
|
assertPositiveSafeInteger
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-gr0kxymw.js";
|
|
11
11
|
|
|
12
12
|
// src/agent-runtime/harness-control.ts
|
|
13
13
|
function reportAgentControlError(config, error, context) {
|
|
@@ -8,20 +8,20 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
writeAllBytes,
|
|
10
10
|
writeAtomicFileStaged
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-pp97q86a.js";
|
|
12
12
|
import {
|
|
13
13
|
AtomicFilePublicationError2
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-2c5w2d1d.js";
|
|
15
15
|
import {
|
|
16
16
|
BoundedFileReadError,
|
|
17
17
|
readBoundedFile
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-s2e3h616.js";
|
|
19
19
|
import {
|
|
20
20
|
errnoOf
|
|
21
21
|
} from "./index-jj9228tt.js";
|
|
22
22
|
import {
|
|
23
23
|
assertPositiveSafeInteger
|
|
24
|
-
} from "./index-
|
|
24
|
+
} from "./index-gr0kxymw.js";
|
|
25
25
|
import {
|
|
26
26
|
assertTimerMs
|
|
27
27
|
} from "./index-agy5fqgf.js";
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "./index-xrgn784x.js";
|
|
8
8
|
import {
|
|
9
9
|
stagingName
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-psye60qn.js";
|
|
11
11
|
|
|
12
12
|
// src/internal/contained-write.ts
|
|
13
13
|
import { constants, fchmod, open as openDescriptor, write as writeDescriptor } from "node:fs";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
streamNativeCommand2
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-3fym4j8n.js";
|
|
4
4
|
import {
|
|
5
5
|
createBoundedLineDecoder
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-39rmc00v.js";
|
|
7
7
|
import {
|
|
8
8
|
assertPositiveSafeInteger
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-gr0kxymw.js";
|
|
10
10
|
|
|
11
11
|
// src/agent-executor/engine-process.ts
|
|
12
12
|
var ENGINE_LINE_BYTES = 8 * 1024 * 1024;
|
|
@@ -20,7 +20,13 @@ function spawnEngineProcess2(input) {
|
|
|
20
20
|
const maxLineBytes = input.maxLineBytes ?? ENGINE_LINE_BYTES;
|
|
21
21
|
const maxPendingStdinBytes = input.maxPendingStdinBytes ?? ENGINE_PENDING_STDIN_BYTES;
|
|
22
22
|
const maxStdinBytes = input.maxStdinBytes ?? ENGINE_STDIN_BYTES;
|
|
23
|
+
const stdoutMode = input.stdoutMode ?? "lines";
|
|
24
|
+
if (stdoutMode !== "lines" && stdoutMode !== "drain") {
|
|
25
|
+
throw new TypeError(`stdoutMode must be "lines" or "drain", received ${String(stdoutMode)}`);
|
|
26
|
+
}
|
|
23
27
|
let written = 0;
|
|
28
|
+
let pid;
|
|
29
|
+
const pidReady = Promise.withResolvers();
|
|
24
30
|
const encoder = new TextEncoder;
|
|
25
31
|
let writer;
|
|
26
32
|
let open = true;
|
|
@@ -41,7 +47,11 @@ function spawnEngineProcess2(input) {
|
|
|
41
47
|
ownerLoss: "terminate",
|
|
42
48
|
stdin,
|
|
43
49
|
maxStdinBytes,
|
|
44
|
-
signal: input.signal
|
|
50
|
+
signal: input.signal,
|
|
51
|
+
onLeaderStarted: ({ pid: startedPid }) => {
|
|
52
|
+
pid = startedPid;
|
|
53
|
+
pidReady.resolve(startedPid);
|
|
54
|
+
}
|
|
45
55
|
});
|
|
46
56
|
let tail = "";
|
|
47
57
|
(async () => {
|
|
@@ -52,6 +62,13 @@ function spawnEngineProcess2(input) {
|
|
|
52
62
|
}
|
|
53
63
|
} catch {}
|
|
54
64
|
})();
|
|
65
|
+
if (stdoutMode === "drain") {
|
|
66
|
+
(async () => {
|
|
67
|
+
try {
|
|
68
|
+
for await (const _chunk of command.stdout) {}
|
|
69
|
+
} catch {}
|
|
70
|
+
})();
|
|
71
|
+
}
|
|
55
72
|
const closeInput = () => {
|
|
56
73
|
if (!open)
|
|
57
74
|
return;
|
|
@@ -60,9 +77,15 @@ function spawnEngineProcess2(input) {
|
|
|
60
77
|
writer.close();
|
|
61
78
|
} catch {}
|
|
62
79
|
};
|
|
63
|
-
|
|
80
|
+
const onCommandSettled = () => {
|
|
81
|
+
closeInput();
|
|
82
|
+
pidReady.resolve(pid);
|
|
83
|
+
};
|
|
84
|
+
command.result.then(onCommandSettled, onCommandSettled);
|
|
64
85
|
const cleanLine = (line) => line.endsWith("\r") ? line.slice(0, -1) : line;
|
|
65
86
|
async function* lines() {
|
|
87
|
+
if (stdoutMode === "drain")
|
|
88
|
+
return;
|
|
66
89
|
const decoder = createBoundedLineDecoder(maxLineBytes);
|
|
67
90
|
for await (const chunk of command.stdout) {
|
|
68
91
|
for (const line of decoder.push(chunk)) {
|
|
@@ -78,6 +101,10 @@ function spawnEngineProcess2(input) {
|
|
|
78
101
|
}
|
|
79
102
|
}
|
|
80
103
|
return {
|
|
104
|
+
get pid() {
|
|
105
|
+
return pid;
|
|
106
|
+
},
|
|
107
|
+
pidReady: pidReady.promise,
|
|
81
108
|
send(line) {
|
|
82
109
|
if (!open)
|
|
83
110
|
throw new Error("The engine process has closed its input");
|
|
@@ -105,4 +132,4 @@ function spawnEngineProcess2(input) {
|
|
|
105
132
|
};
|
|
106
133
|
}
|
|
107
134
|
|
|
108
|
-
export { spawnEngineProcess2 };
|
|
135
|
+
export { ENGINE_LINE_BYTES, spawnEngineProcess2 };
|