stitchkit 0.127.0 → 0.128.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 +137 -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 +7 -4
- package/dist/agent-executor/claude/transcript.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/driver.d.ts +4 -0
- package/dist/agent-executor/claude-sdk/driver.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/session.d.ts.map +1 -1
- package/dist/agent-executor/codex/driver.d.ts +4 -0
- package/dist/agent-executor/codex/driver.d.ts.map +1 -1
- package/dist/agent-executor/codex/protocol.d.ts +26 -2
- package/dist/agent-executor/codex/protocol.d.ts.map +1 -1
- package/dist/agent-executor/codex/session.d.ts +3 -1
- package/dist/agent-executor/codex/session.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 +45 -32
- package/dist/agent-runtime/branch-observations.d.ts.map +1 -1
- package/dist/agent-runtime/branch-provider.d.ts +12 -6
- 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-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/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 +23 -12
- package/dist/entrypoints/agent-executor/claude-sdk.js +26 -10
- package/dist/entrypoints/agent-executor/claude.js +35 -16
- package/dist/entrypoints/agent-executor/codex.js +81 -21
- package/dist/entrypoints/agent-executor.js +1 -1
- package/dist/entrypoints/agent-runtime/harness.js +5 -6
- package/dist/entrypoints/agent-runtime/openrouter.js +2 -2
- package/dist/entrypoints/agent-runtime/postgres.js +8 -3
- package/dist/entrypoints/agent-runtime/sandbox.js +3 -3
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +4 -4
- package/dist/entrypoints/agent-runtime/sqlite/node.js +4 -4
- package/dist/entrypoints/agent-runtime/testing.js +6 -6
- 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 +246 -199
- package/dist/entrypoints/application/diagnostic-journal.js +4 -4
- package/dist/entrypoints/application/directory-inbox.js +8 -8
- package/dist/entrypoints/cli/publish.js +8 -8
- package/dist/entrypoints/cli.js +10 -9
- package/dist/entrypoints/declaration.js +0 -1
- package/dist/entrypoints/files.js +40 -17
- package/dist/entrypoints/node.js +4 -4
- package/dist/entrypoints/observability.js +1 -1
- package/dist/entrypoints/process.js +1 -1
- package/dist/entrypoints/server.js +7 -7
- package/dist/entrypoints/service-host/macos.js +4 -4
- 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 +831 -220
- package/dist/entrypoints/spend.js +1 -1
- package/dist/entrypoints/telegram.js +4 -4
- package/dist/entrypoints/tools/agent.js +4 -3
- package/dist/entrypoints/tools/invoker.js +3 -2
- package/dist/entrypoints/tools/mcp.js +4 -3
- package/dist/entrypoints/tools/toolkit.js +6 -5
- package/dist/entrypoints/tools.d.ts +1 -1
- package/dist/entrypoints/tools.d.ts.map +1 -1
- package/dist/entrypoints/tools.js +10 -8
- 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-z4k0hqp9.js → index-0gqs8ght.js} +106 -24
- package/dist/{index-caywx1c0.js → index-13dnv6d0.js} +107 -10
- package/dist/{index-a725ayvz.js → index-1qwrczr1.js} +1 -1
- package/dist/{index-xtkw9866.js → index-2c5w2d1d.js} +1 -1
- package/dist/{index-g1q7fwn9.js → index-2nwvn7m2.js} +1 -1
- package/dist/{index-4s2w4g37.js → index-3tnwtz38.js} +80 -2
- package/dist/{index-5e0zsbf7.js → index-4j8efqr3.js} +1 -1
- package/dist/{index-p1m9djt6.js → index-5v5vg85s.js} +1 -1
- package/dist/{index-x90w78yz.js → index-673drwkn.js} +23 -8
- package/dist/{index-7xp05h20.js → index-6wp4dn9d.js} +6 -6
- package/dist/{index-0hdm5sx6.js → index-8x22nprv.js} +6 -2
- package/dist/{index-j13gzgdv.js → index-bz3gn6cs.js} +8 -4
- package/dist/{index-d96c1n1q.js → index-c5gp2gh6.js} +20 -19
- package/dist/{index-wbnpa8z6.js → index-d54npte7.js} +4 -4
- package/dist/{index-kmbpej2y.js → index-emgrmavr.js} +102 -61
- package/dist/{index-bbzvrq66.js → index-g3e57qj6.js} +455 -202
- package/dist/index-gf92hc87.js +100 -0
- package/dist/{index-3djgv3ch.js → index-gzny6zsw.js} +25 -10
- package/dist/{index-3b31z0pc.js → index-hj1zq7mh.js} +12 -6
- package/dist/{index-8xr2eq99.js → index-jfecdk1e.js} +3 -3
- package/dist/{index-dvd1qdwa.js → index-ke02kxsr.js} +3 -3
- package/dist/{index-83n766x4.js → index-m18xm96h.js} +15 -9
- package/dist/{index-qnzhmk2s.js → index-n7f89hjw.js} +90 -47
- package/dist/{index-3agqmmrg.js → index-pn5b11ce.js} +7 -9
- package/dist/{index-3gwp8ez6.js → index-pwskmywy.js} +12 -17
- package/dist/{index-9wh98cpa.js → index-rxnyygke.js} +130 -90
- package/dist/{index-0djnptn8.js → index-rzeezh79.js} +10 -3
- package/dist/{index-nbv44x0x.js → index-s2e3h616.js} +137 -36
- package/dist/{index-5zwac8ft.js → index-t7wa7k12.js} +2 -2
- package/dist/{index-xypxnzhp.js → index-v1mxss62.js} +2 -2
- package/dist/index-vgzhw2zk.js +304 -0
- package/dist/{index-jrka9029.js → index-vmbxj75t.js} +2 -2
- package/dist/{index-j516jaaz.js → index-waa6t4zx.js} +49 -2
- package/dist/{index-fcw255hd.js → index-xv9jb84s.js} +2 -2
- package/dist/{index-dwa6pskj.js → index-y065r8g5.js} +82 -43
- 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/process-instance.d.ts +8 -0
- package/dist/internal/process-instance.d.ts.map +1 -1
- package/dist/internal/unix-socket.d.ts +3 -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 +1 -1
- package/llms/agent-executor-claude.txt +1 -1
- package/llms/agent-executor-codex.txt +1 -1
- 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.txt +147 -0
- package/llms/upgrading.txt +1 -0
- package/llms-full.txt +272 -113
- package/llms.txt +14 -13
- package/package.json +1 -1
- package/dist/index-ajmtxsky.js +0 -193
- package/dist/index-ax3wns1a.js +0 -93
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AgentTimestampSchema2,
|
|
3
|
+
AgentUsageSchema2
|
|
4
|
+
} from "./index-bn2baakz.js";
|
|
5
|
+
|
|
6
|
+
// src/agent-runtime/invocation-schema.ts
|
|
7
|
+
import { z as z2 } from "zod";
|
|
8
|
+
|
|
9
|
+
// src/agent-runtime/schemas-invocation-payload.ts
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
var Id = z.string().min(1).max(512);
|
|
12
|
+
var Hash = z.string().regex(/^[a-f0-9]{64}$/);
|
|
13
|
+
var PayloadBase = z.object({
|
|
14
|
+
conversationId: Id,
|
|
15
|
+
invocationId: Id,
|
|
16
|
+
operationId: Id,
|
|
17
|
+
runId: Id.optional()
|
|
18
|
+
});
|
|
19
|
+
var InvocationPayloadSchema = PayloadBase.extend({
|
|
20
|
+
artifactId: Id,
|
|
21
|
+
sha256: Hash,
|
|
22
|
+
bytes: z.int().nonnegative(),
|
|
23
|
+
iv: z.string(),
|
|
24
|
+
tag: z.string(),
|
|
25
|
+
ciphertext: z.string()
|
|
26
|
+
}).strict();
|
|
27
|
+
var InvocationExpiredPayloadSchema = PayloadBase.extend({
|
|
28
|
+
artifactId: Id,
|
|
29
|
+
sha256: Hash,
|
|
30
|
+
bytes: z.int().nonnegative(),
|
|
31
|
+
expiredAt: AgentTimestampSchema2
|
|
32
|
+
}).strict();
|
|
33
|
+
var PurgeInvocationPayloadsInputSchema2 = z.object({
|
|
34
|
+
before: AgentTimestampSchema2,
|
|
35
|
+
conversationId: Id.optional(),
|
|
36
|
+
limit: z.int().positive().max(1e4).optional()
|
|
37
|
+
}).strict();
|
|
38
|
+
var PurgeInvocationPayloadsResultSchema2 = z.object({
|
|
39
|
+
purged: z.int().nonnegative(),
|
|
40
|
+
freedBytes: z.int().nonnegative(),
|
|
41
|
+
hasMore: z.boolean()
|
|
42
|
+
}).strict();
|
|
43
|
+
function parsePayloadPurgeCutoff(before) {
|
|
44
|
+
const cutoffEpoch = Date.parse(before);
|
|
45
|
+
if (Number.isNaN(cutoffEpoch)) {
|
|
46
|
+
throw new TypeError(`Invalid payload expiry cutoff timestamp: ${JSON.stringify(before)}`);
|
|
47
|
+
}
|
|
48
|
+
return cutoffEpoch;
|
|
49
|
+
}
|
|
50
|
+
function redactLiveInvocationPayload(rawPayload, expiredAt) {
|
|
51
|
+
if (InvocationExpiredPayloadSchema.safeParse(rawPayload).success)
|
|
52
|
+
return;
|
|
53
|
+
const live = InvocationPayloadSchema.parse(rawPayload);
|
|
54
|
+
return InvocationExpiredPayloadSchema.parse({
|
|
55
|
+
conversationId: live.conversationId,
|
|
56
|
+
invocationId: live.invocationId,
|
|
57
|
+
operationId: live.operationId,
|
|
58
|
+
...live.runId !== undefined && { runId: live.runId },
|
|
59
|
+
artifactId: live.artifactId,
|
|
60
|
+
sha256: live.sha256,
|
|
61
|
+
bytes: live.bytes,
|
|
62
|
+
expiredAt
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// src/agent-runtime/invocation-schema.ts
|
|
67
|
+
var Id2 = z2.string().min(1).max(512);
|
|
68
|
+
var Hash2 = z2.string().regex(/^[a-f0-9]{64}$/);
|
|
69
|
+
var ModelInvocationTraceSchema2 = z2.object({
|
|
70
|
+
operationId: Id2,
|
|
71
|
+
purpose: Id2,
|
|
72
|
+
project: Id2,
|
|
73
|
+
parent: z2.object({ traceId: Id2, invocationId: Id2.optional() }).strict().optional(),
|
|
74
|
+
experiment: Id2.optional(),
|
|
75
|
+
case: Id2.optional(),
|
|
76
|
+
profile: Id2.optional()
|
|
77
|
+
}).strict();
|
|
78
|
+
var CompletionInvocationInputSchema2 = z2.object({
|
|
79
|
+
conversationId: Id2,
|
|
80
|
+
idempotencyKey: Id2,
|
|
81
|
+
trace: ModelInvocationTraceSchema2,
|
|
82
|
+
prompt: z2.string().min(1),
|
|
83
|
+
models: z2.array(Id2).min(1).max(8),
|
|
84
|
+
settings: z2.object({
|
|
85
|
+
maxOutputTokens: z2.int().positive().optional(),
|
|
86
|
+
temperature: z2.number().finite().optional(),
|
|
87
|
+
topP: z2.number().min(0).max(1).optional(),
|
|
88
|
+
seed: z2.int().optional()
|
|
89
|
+
}).strict().optional(),
|
|
90
|
+
timeoutMs: z2.int().positive().max(3600000)
|
|
91
|
+
}).strict();
|
|
92
|
+
var Identity = z2.object({
|
|
93
|
+
provider: Id2.nullable(),
|
|
94
|
+
modelId: Id2.nullable(),
|
|
95
|
+
responseId: Id2.nullable()
|
|
96
|
+
}).strict();
|
|
97
|
+
var InvocationCallerSchema = z2.object({ subject: Id2 }).strict();
|
|
98
|
+
var InvocationProcessSchema = z2.object({
|
|
99
|
+
instanceId: Id2,
|
|
100
|
+
pid: z2.int().positive(),
|
|
101
|
+
hostname: Id2
|
|
102
|
+
}).strict();
|
|
103
|
+
var Base = z2.object({
|
|
104
|
+
conversationId: Id2,
|
|
105
|
+
invocationId: Id2,
|
|
106
|
+
operationId: Id2,
|
|
107
|
+
runId: Id2.optional()
|
|
108
|
+
});
|
|
109
|
+
var InvocationStartedSchema = Base.extend({
|
|
110
|
+
type: z2.literal("invocation/started"),
|
|
111
|
+
mode: z2.enum(["completion", "agent"]),
|
|
112
|
+
trace: ModelInvocationTraceSchema2,
|
|
113
|
+
caller: InvocationCallerSchema,
|
|
114
|
+
executingProcess: InvocationProcessSchema,
|
|
115
|
+
fingerprint: Hash2,
|
|
116
|
+
requested: z2.object({ models: z2.array(Id2), payloadSha256: Hash2 }).strict()
|
|
117
|
+
}).strict();
|
|
118
|
+
var InvocationAttemptContextSchema = Base.extend({
|
|
119
|
+
attemptId: Id2,
|
|
120
|
+
step: z2.int().nonnegative()
|
|
121
|
+
}).strict();
|
|
122
|
+
var InvocationPayloadOmissionReasonSchema2 = z2.enum(["max-payload-bytes"]);
|
|
123
|
+
var Attempt = Base.extend({ attemptId: Id2, step: z2.int().nonnegative() });
|
|
124
|
+
var InvocationRequestSchema = Attempt.extend({
|
|
125
|
+
type: z2.literal("provider/request"),
|
|
126
|
+
requested: z2.object({ modelId: Id2, provider: Id2 }).strict(),
|
|
127
|
+
executingProcess: InvocationProcessSchema,
|
|
128
|
+
sent: z2.object({
|
|
129
|
+
modelId: Id2,
|
|
130
|
+
provider: Id2,
|
|
131
|
+
payloadSha256: Hash2,
|
|
132
|
+
artifactId: Id2.optional(),
|
|
133
|
+
payloadOmitted: InvocationPayloadOmissionReasonSchema2.optional(),
|
|
134
|
+
tools: z2.int().nonnegative()
|
|
135
|
+
}).strict().superRefine((sent, ctx) => {
|
|
136
|
+
const hasArtifact = sent.artifactId !== undefined;
|
|
137
|
+
const hasOmitted = sent.payloadOmitted !== undefined;
|
|
138
|
+
if (hasArtifact === hasOmitted) {
|
|
139
|
+
ctx.addIssue({
|
|
140
|
+
code: "custom",
|
|
141
|
+
message: "provider/request sent requires exactly one of artifactId or payloadOmitted"
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
}).strict();
|
|
146
|
+
var InvocationResponseSchema = Attempt.extend({
|
|
147
|
+
type: z2.literal("provider/response"),
|
|
148
|
+
status: z2.enum(["succeeded", "failed", "cancelled"]),
|
|
149
|
+
effective: Identity,
|
|
150
|
+
usage: AgentUsageSchema2,
|
|
151
|
+
artifactId: Id2.optional(),
|
|
152
|
+
payloadOmitted: InvocationPayloadOmissionReasonSchema2.optional(),
|
|
153
|
+
payloadSha256: Hash2
|
|
154
|
+
}).strict().superRefine((response, ctx) => {
|
|
155
|
+
const hasArtifact = response.artifactId !== undefined;
|
|
156
|
+
const hasOmitted = response.payloadOmitted !== undefined;
|
|
157
|
+
if (hasArtifact === hasOmitted) {
|
|
158
|
+
ctx.addIssue({
|
|
159
|
+
code: "custom",
|
|
160
|
+
message: "provider/response requires exactly one of artifactId or payloadOmitted"
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
var InvocationFinishedSchema = Base.extend({
|
|
165
|
+
type: z2.literal("invocation/finished"),
|
|
166
|
+
failure: z2.object({ artifactId: Id2, payloadSha256: Hash2 }).strict().optional(),
|
|
167
|
+
status: z2.enum(["succeeded", "failed", "cancelled"])
|
|
168
|
+
}).strict();
|
|
169
|
+
var ModelInvocationRecordSchema2 = z2.discriminatedUnion("type", [
|
|
170
|
+
InvocationStartedSchema,
|
|
171
|
+
InvocationRequestSchema,
|
|
172
|
+
InvocationResponseSchema,
|
|
173
|
+
InvocationFinishedSchema
|
|
174
|
+
]);
|
|
175
|
+
var InvocationStoredPayloadSchema = z2.union([
|
|
176
|
+
InvocationPayloadSchema,
|
|
177
|
+
InvocationExpiredPayloadSchema
|
|
178
|
+
]);
|
|
179
|
+
var InvocationPayloadReceiptSchema = Base.extend({
|
|
180
|
+
artifactId: Id2,
|
|
181
|
+
sha256: Hash2,
|
|
182
|
+
bytes: z2.int().nonnegative(),
|
|
183
|
+
iv: z2.string().optional(),
|
|
184
|
+
tag: z2.string().optional(),
|
|
185
|
+
ciphertext: z2.string().optional(),
|
|
186
|
+
expiredAt: AgentTimestampSchema2.optional()
|
|
187
|
+
}).strict().superRefine((value, ctx) => {
|
|
188
|
+
const cipherParts = [value.iv, value.tag, value.ciphertext].filter((p) => p !== undefined).length;
|
|
189
|
+
if (cipherParts > 0 && cipherParts < 3) {
|
|
190
|
+
ctx.addIssue({
|
|
191
|
+
code: "custom",
|
|
192
|
+
message: "Invocation payload receipt has incomplete encryption fields"
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
if (cipherParts > 0 && value.expiredAt !== undefined) {
|
|
196
|
+
ctx.addIssue({
|
|
197
|
+
code: "custom",
|
|
198
|
+
message: "Invocation payload receipt cannot carry both ciphertext and expiredAt"
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
var ModelInvocationPayloadReadSchema2 = z2.discriminatedUnion("status", [
|
|
203
|
+
z2.object({
|
|
204
|
+
status: z2.literal("available"),
|
|
205
|
+
artifactId: Id2,
|
|
206
|
+
sha256: Hash2,
|
|
207
|
+
bytes: z2.int().nonnegative(),
|
|
208
|
+
payload: z2.json()
|
|
209
|
+
}).strict(),
|
|
210
|
+
z2.object({
|
|
211
|
+
status: z2.literal("expired"),
|
|
212
|
+
artifactId: Id2,
|
|
213
|
+
sha256: Hash2,
|
|
214
|
+
bytes: z2.int().nonnegative(),
|
|
215
|
+
expiredAt: AgentTimestampSchema2
|
|
216
|
+
}).strict()
|
|
217
|
+
]);
|
|
218
|
+
function isModelInvocationRecord(payload) {
|
|
219
|
+
return payload !== null && typeof payload === "object" && "invocationId" in payload;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// src/agent-runtime/history-chronology.ts
|
|
223
|
+
function createToolChronology() {
|
|
224
|
+
return { calls: new Map, approvals: new Map, pending: 0, resultsStarted: false };
|
|
225
|
+
}
|
|
226
|
+
function advanceToolChronology(previous, parts) {
|
|
227
|
+
const calls = new Map(previous.calls);
|
|
228
|
+
const approvals = new Map(previous.approvals);
|
|
229
|
+
let { pending, resultsStarted } = previous;
|
|
230
|
+
for (const part of parts) {
|
|
231
|
+
if (part.type === "tool-call") {
|
|
232
|
+
if (calls.has(part.callId) || resultsStarted && pending > 0)
|
|
233
|
+
return;
|
|
234
|
+
if (pending === 0)
|
|
235
|
+
resultsStarted = false;
|
|
236
|
+
calls.set(part.callId, { toolName: part.toolName, phase: "called" });
|
|
237
|
+
pending += 1;
|
|
238
|
+
} else if (part.type === "tool-approval-request") {
|
|
239
|
+
const call = calls.get(part.callId);
|
|
240
|
+
if (call?.phase !== "called" || approvals.has(part.approvalId))
|
|
241
|
+
return;
|
|
242
|
+
approvals.set(part.approvalId, part.callId);
|
|
243
|
+
calls.set(part.callId, { ...call, phase: "requested" });
|
|
244
|
+
} else if (part.type === "tool-approval-response") {
|
|
245
|
+
const callId = approvals.get(part.approvalId);
|
|
246
|
+
const call = callId === undefined ? undefined : calls.get(callId);
|
|
247
|
+
if (callId === undefined || !call || call.phase !== "requested")
|
|
248
|
+
return;
|
|
249
|
+
calls.set(callId, { ...call, phase: part.approved ? "approved" : "denied" });
|
|
250
|
+
} else if (part.type === "tool-result") {
|
|
251
|
+
const call = calls.get(part.callId);
|
|
252
|
+
if (!call || call.toolName !== part.toolName || call.phase === "result" || call.phase === "requested" || call.phase === "denied" && part.outcome === "success")
|
|
253
|
+
return;
|
|
254
|
+
calls.set(part.callId, { ...call, phase: "result" });
|
|
255
|
+
pending -= 1;
|
|
256
|
+
resultsStarted = true;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return { calls, approvals, pending, resultsStarted };
|
|
260
|
+
}
|
|
261
|
+
function canProjectToolChronology(state) {
|
|
262
|
+
return [...state.calls.values()].every(({ phase }) => phase !== "called");
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// src/agent-runtime/terminal-status.ts
|
|
266
|
+
function isSpeakableAssistantStatus(status) {
|
|
267
|
+
return status === "completed" || status === "interrupted" || status === "committed";
|
|
268
|
+
}
|
|
269
|
+
function isAssistantHistoryEvidence2(status, policy) {
|
|
270
|
+
return isSpeakableAssistantStatus(status) || status === "failed" && policy?.failedAssistant === "assistant-marked";
|
|
271
|
+
}
|
|
272
|
+
function isCompleteAgentHistoryTurn(messages, policy) {
|
|
273
|
+
if (messages[0]?.role !== "user")
|
|
274
|
+
return false;
|
|
275
|
+
let chronology = createToolChronology();
|
|
276
|
+
let assistantCount = 0;
|
|
277
|
+
for (const message of messages) {
|
|
278
|
+
if (message.role === "assistant") {
|
|
279
|
+
if (!isAssistantHistoryEvidence2(message.status, policy))
|
|
280
|
+
return false;
|
|
281
|
+
assistantCount += 1;
|
|
282
|
+
}
|
|
283
|
+
const next = advanceToolChronology(chronology, message.parts);
|
|
284
|
+
if (!next)
|
|
285
|
+
return false;
|
|
286
|
+
chronology = next;
|
|
287
|
+
}
|
|
288
|
+
return assistantCount > 0 && chronology.pending === 0;
|
|
289
|
+
}
|
|
290
|
+
function assistantStatus(reason) {
|
|
291
|
+
if (reason === "success" || reason === "policy_stop" || reason === "provider_stop") {
|
|
292
|
+
return "completed";
|
|
293
|
+
}
|
|
294
|
+
if (reason === "superseded")
|
|
295
|
+
return "superseded";
|
|
296
|
+
if (reason === "absorbed")
|
|
297
|
+
return "superseded";
|
|
298
|
+
if (reason === "interrupted" || reason === "cancelled" || reason === "shutdown") {
|
|
299
|
+
return "interrupted";
|
|
300
|
+
}
|
|
301
|
+
return "failed";
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export { InvocationPayloadSchema, InvocationExpiredPayloadSchema, PurgeInvocationPayloadsInputSchema2, PurgeInvocationPayloadsResultSchema2, parsePayloadPurgeCutoff, redactLiveInvocationPayload, ModelInvocationTraceSchema2, CompletionInvocationInputSchema2, InvocationCallerSchema, InvocationStartedSchema, InvocationPayloadOmissionReasonSchema2, InvocationRequestSchema, InvocationResponseSchema, InvocationFinishedSchema, ModelInvocationRecordSchema2, InvocationStoredPayloadSchema, InvocationPayloadReceiptSchema, ModelInvocationPayloadReadSchema2, isModelInvocationRecord, createToolChronology, advanceToolChronology, canProjectToolChronology, isAssistantHistoryEvidence2, isCompleteAgentHistoryTurn, assistantStatus };
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
ProcessInstanceSchema2,
|
|
5
5
|
probeProcessOwner2,
|
|
6
6
|
probeProcessOwnerSync
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-673drwkn.js";
|
|
8
8
|
import {
|
|
9
9
|
BoundedFileReadError,
|
|
10
10
|
readBoundedFile
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-s2e3h616.js";
|
|
12
12
|
import {
|
|
13
13
|
isRecord
|
|
14
14
|
} from "./index-ps3djm8d.js";
|
|
@@ -11,15 +11,21 @@ import {
|
|
|
11
11
|
AgentSeedReceiptSchema2,
|
|
12
12
|
AgentHistoryMutationSchema2,
|
|
13
13
|
isActiveRunState,
|
|
14
|
-
AgentRecoverablePageSchema2
|
|
14
|
+
AgentRecoverablePageSchema2,
|
|
15
|
+
canonicalAgentJson2
|
|
15
16
|
} from "./index-9xr44d2g.js";
|
|
17
|
+
import {
|
|
18
|
+
InvocationExpiredPayloadSchema,
|
|
19
|
+
parsePayloadPurgeCutoff,
|
|
20
|
+
redactLiveInvocationPayload
|
|
21
|
+
} from "./index-vgzhw2zk.js";
|
|
16
22
|
import {
|
|
17
23
|
ArchiveProjectionSchema,
|
|
18
24
|
isRuntimeSnapshotEntry,
|
|
19
25
|
replaceMessage,
|
|
20
26
|
ArchiveSpillSchema,
|
|
21
27
|
createAgentRuntimeStore2
|
|
22
|
-
} from "./index-
|
|
28
|
+
} from "./index-g3e57qj6.js";
|
|
23
29
|
|
|
24
30
|
// src/agent-runtime/store-memory.ts
|
|
25
31
|
import { z as z2 } from "zod";
|
|
@@ -75,6 +81,47 @@ var memoryEvents = {
|
|
|
75
81
|
},
|
|
76
82
|
async find(transaction, input) {
|
|
77
83
|
return (transaction.events.get(input.conversationId) ?? []).find((event) => event.eventId === input.eventId);
|
|
84
|
+
},
|
|
85
|
+
async redactExpiredPayloads(transaction, input) {
|
|
86
|
+
const cutoffEpoch = parsePayloadPurgeCutoff(input.before);
|
|
87
|
+
const conversationIds = input.conversationId !== undefined ? [input.conversationId] : [...transaction.events.keys()].sort();
|
|
88
|
+
const eligible = [];
|
|
89
|
+
for (const conversationId of conversationIds) {
|
|
90
|
+
const list = transaction.events.get(conversationId);
|
|
91
|
+
if (!list)
|
|
92
|
+
continue;
|
|
93
|
+
for (const [index, event] of list.entries()) {
|
|
94
|
+
if (event.kind !== "provider/payload")
|
|
95
|
+
continue;
|
|
96
|
+
if (InvocationExpiredPayloadSchema.safeParse(event.payload).success)
|
|
97
|
+
continue;
|
|
98
|
+
if (Date.parse(event.occurredAt) < cutoffEpoch) {
|
|
99
|
+
eligible.push({ conversationId, index, event });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
eligible.sort((a, b) => a.event.occurredAt.localeCompare(b.event.occurredAt) || a.conversationId.localeCompare(b.conversationId) || a.event.seq - b.event.seq);
|
|
104
|
+
const hasMore = eligible.length > input.limit;
|
|
105
|
+
const toPurge = eligible.slice(0, input.limit);
|
|
106
|
+
let freedBytes = 0;
|
|
107
|
+
const updatedLists = new Map;
|
|
108
|
+
for (const entry of toPurge) {
|
|
109
|
+
const expired = redactLiveInvocationPayload(entry.event.payload, input.expiredAt);
|
|
110
|
+
if (expired === undefined)
|
|
111
|
+
continue;
|
|
112
|
+
const beforeBytes = Buffer.byteLength(canonicalAgentJson2(entry.event.payload));
|
|
113
|
+
const afterBytes = Buffer.byteLength(canonicalAgentJson2(expired));
|
|
114
|
+
freedBytes += Math.max(0, beforeBytes - afterBytes);
|
|
115
|
+
const list = updatedLists.get(entry.conversationId) ?? [
|
|
116
|
+
...transaction.events.get(entry.conversationId) ?? []
|
|
117
|
+
];
|
|
118
|
+
list[entry.index] = { ...entry.event, payload: expired };
|
|
119
|
+
updatedLists.set(entry.conversationId, list);
|
|
120
|
+
}
|
|
121
|
+
for (const [conversationId, list] of updatedLists) {
|
|
122
|
+
transaction.events.set(conversationId, list);
|
|
123
|
+
}
|
|
124
|
+
return { purged: toPurge.length, freedBytes, hasMore };
|
|
78
125
|
}
|
|
79
126
|
};
|
|
80
127
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RegularFileError2,
|
|
3
3
|
readRegularFile2
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-pwskmywy.js";
|
|
5
5
|
import {
|
|
6
6
|
runNativeCommand2
|
|
7
7
|
} from "./index-5ptwb6ka.js";
|
|
8
8
|
import {
|
|
9
9
|
writeFileAtomic2
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-t7wa7k12.js";
|
|
11
11
|
import {
|
|
12
12
|
errnoOf
|
|
13
13
|
} from "./index-jj9228tt.js";
|
|
@@ -28,12 +28,17 @@ import {
|
|
|
28
28
|
coerceJsonArgs2
|
|
29
29
|
} from "./index-j903yhp4.js";
|
|
30
30
|
import {
|
|
31
|
+
isInspectOnlyLifecycle,
|
|
32
|
+
inspectOnlyError,
|
|
33
|
+
resolveOptionalCliToolAccess,
|
|
31
34
|
toolResultFromError,
|
|
32
35
|
toolErrorFromResult,
|
|
33
|
-
toolCauseFromResult
|
|
36
|
+
toolCauseFromResult
|
|
37
|
+
} from "./index-rxnyygke.js";
|
|
38
|
+
import {
|
|
34
39
|
createToolRunner,
|
|
35
40
|
formatToolError
|
|
36
|
-
} from "./index-
|
|
41
|
+
} from "./index-gf92hc87.js";
|
|
37
42
|
import {
|
|
38
43
|
isRepeatableRead
|
|
39
44
|
} from "./index-0x4mnwg5.js";
|
|
@@ -69,10 +74,7 @@ import {
|
|
|
69
74
|
} from "./index-n20tybgk.js";
|
|
70
75
|
import {
|
|
71
76
|
collectToolSurface
|
|
72
|
-
} from "./index-
|
|
73
|
-
import {
|
|
74
|
-
resolveOptionalCliToolAccess
|
|
75
|
-
} from "./index-ax3wns1a.js";
|
|
77
|
+
} from "./index-4j8efqr3.js";
|
|
76
78
|
import {
|
|
77
79
|
assertNoLegacyTransports
|
|
78
80
|
} from "./index-akfgymyr.js";
|
|
@@ -1758,7 +1760,8 @@ async function createCliInvoker2(config, globals) {
|
|
|
1758
1760
|
assertNoLegacyCliPolicyKeys(config);
|
|
1759
1761
|
assertCliAuthConfig(config);
|
|
1760
1762
|
const typedGlobals = parseCliGlobalValues(config.globalOptions, globals);
|
|
1761
|
-
const
|
|
1763
|
+
const hasManagedFactory = typeof config.services === "function" || typeof config.runtimeTools === "function";
|
|
1764
|
+
const auth = hasManagedFactory || !isInspectOnlyLifecycle(lifecycle) ? await resolveCliIdentity(config, typedGlobals)() : undefined;
|
|
1762
1765
|
const natives = new Map;
|
|
1763
1766
|
const allNativeHelp = new Map;
|
|
1764
1767
|
for (const definition of config.commands ?? []) {
|
|
@@ -1769,7 +1772,7 @@ async function createCliInvoker2(config, globals) {
|
|
|
1769
1772
|
natives.set(definition.name, definition);
|
|
1770
1773
|
}
|
|
1771
1774
|
const { tools, help } = buildCliSurface(config, auth, typedGlobals, allNativeHelp, new Set, invokerCommandShapeIssue);
|
|
1772
|
-
const runTool = createCliToolRunner(config, lifecycle, auth, typedGlobals);
|
|
1775
|
+
const runTool = isInspectOnlyLifecycle(lifecycle) ? undefined : createCliToolRunner(config, lifecycle, auth, typedGlobals);
|
|
1773
1776
|
return {
|
|
1774
1777
|
commands: [
|
|
1775
1778
|
...[...natives].map(([name, definition]) => ({
|
|
@@ -1794,6 +1797,10 @@ async function createCliInvoker2(config, globals) {
|
|
|
1794
1797
|
if (!tool) {
|
|
1795
1798
|
return cliInvocationResult2(unknownCliCommand(command), command, config);
|
|
1796
1799
|
}
|
|
1800
|
+
const inspectErr = inspectOnlyError(lifecycle);
|
|
1801
|
+
if (inspectErr || !runTool) {
|
|
1802
|
+
return shapeCliInvocationResult(toolResultFromError(inspectErr ?? new Error("Inspect-only surface refuses execution")), command, config, cliResultPolicy(config, command));
|
|
1803
|
+
}
|
|
1797
1804
|
let result;
|
|
1798
1805
|
try {
|
|
1799
1806
|
result = await runTool(tool, args);
|
|
@@ -2185,9 +2192,42 @@ function answersBeforeArguments(scan) {
|
|
|
2185
2192
|
return scan.topLevelHelp || scan.version || scan.framework.help || scan.framework.schema;
|
|
2186
2193
|
}
|
|
2187
2194
|
function scanCliInvocation2(argv, options) {
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2195
|
+
let res;
|
|
2196
|
+
try {
|
|
2197
|
+
res = scanCliArgv(argv, options);
|
|
2198
|
+
} catch (error) {
|
|
2199
|
+
if (error instanceof CliArgumentError2) {
|
|
2200
|
+
return {
|
|
2201
|
+
framework: {
|
|
2202
|
+
json: false,
|
|
2203
|
+
wait: false,
|
|
2204
|
+
quiet: false,
|
|
2205
|
+
dryRun: false,
|
|
2206
|
+
help: false,
|
|
2207
|
+
schema: false
|
|
2208
|
+
},
|
|
2209
|
+
globals: parseCliGlobalValues(undefined, {}),
|
|
2210
|
+
commandTokens: [],
|
|
2211
|
+
separatedBefore: new Set,
|
|
2212
|
+
topLevelHelp: false,
|
|
2213
|
+
version: false,
|
|
2214
|
+
error
|
|
2215
|
+
};
|
|
2216
|
+
}
|
|
2217
|
+
throw error;
|
|
2218
|
+
}
|
|
2219
|
+
const error = answersBeforeArguments(res) ? undefined : res.deferredError;
|
|
2220
|
+
if (error !== undefined) {
|
|
2221
|
+
return {
|
|
2222
|
+
framework: res.framework,
|
|
2223
|
+
globals: res.globals,
|
|
2224
|
+
commandTokens: [],
|
|
2225
|
+
separatedBefore: new Set,
|
|
2226
|
+
topLevelHelp: false,
|
|
2227
|
+
version: false,
|
|
2228
|
+
error
|
|
2229
|
+
};
|
|
2230
|
+
}
|
|
2191
2231
|
return {
|
|
2192
2232
|
framework: res.framework,
|
|
2193
2233
|
globals: res.globals,
|
|
@@ -2212,16 +2252,10 @@ function writeCliNotice(text) {
|
|
|
2212
2252
|
invocation.stderr(text);
|
|
2213
2253
|
return;
|
|
2214
2254
|
}
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
if (error instanceof CliArgumentError2)
|
|
2220
|
-
return;
|
|
2221
|
-
throw error;
|
|
2222
|
-
}
|
|
2223
|
-
if (!quiet)
|
|
2224
|
-
process.stderr.write(text);
|
|
2255
|
+
const scan = scanCliInvocation2(process.argv.slice(2));
|
|
2256
|
+
if (scan.error !== undefined || scan.framework.quiet)
|
|
2257
|
+
return;
|
|
2258
|
+
process.stderr.write(text);
|
|
2225
2259
|
}
|
|
2226
2260
|
|
|
2227
2261
|
// src/tools/cli/download.ts
|
|
@@ -2918,24 +2952,29 @@ function parseCommandArgv(argv, schema, config) {
|
|
|
2918
2952
|
function extractCliGlobalOptions2(argv, schema) {
|
|
2919
2953
|
if (schema === undefined)
|
|
2920
2954
|
return { argv: [...argv], globals: {} };
|
|
2921
|
-
|
|
2955
|
+
let result;
|
|
2956
|
+
try {
|
|
2957
|
+
result = scanCliArgv(argv, { appGlobals: schema });
|
|
2958
|
+
} catch (error) {
|
|
2959
|
+
if (error instanceof CliArgumentError2) {
|
|
2960
|
+
return { argv: [], globals: {}, error };
|
|
2961
|
+
}
|
|
2962
|
+
throw error;
|
|
2963
|
+
}
|
|
2922
2964
|
const early = answersBeforeArguments(result);
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
const refusal = early ? undefined : result.liftedBoundaryError;
|
|
2926
|
-
if (refusal === undefined) {
|
|
2965
|
+
const error = early ? undefined : result.appGlobalError ?? result.liftedBoundaryError;
|
|
2966
|
+
if (error !== undefined) {
|
|
2927
2967
|
return {
|
|
2928
|
-
argv:
|
|
2968
|
+
argv: [],
|
|
2929
2969
|
globals: result.globals,
|
|
2930
|
-
|
|
2931
|
-
separatedBefore: result.separatedBeforeGlobals
|
|
2932
|
-
}
|
|
2970
|
+
error
|
|
2933
2971
|
};
|
|
2934
2972
|
}
|
|
2935
2973
|
return {
|
|
2974
|
+
argv: result.withoutGlobals,
|
|
2936
2975
|
globals: result.globals,
|
|
2937
|
-
|
|
2938
|
-
|
|
2976
|
+
...result.separatedBeforeGlobals.size > 0 && {
|
|
2977
|
+
separatedBefore: result.separatedBeforeGlobals
|
|
2939
2978
|
}
|
|
2940
2979
|
};
|
|
2941
2980
|
}
|
|
@@ -3061,16 +3100,12 @@ function createCliSession(config, io) {
|
|
|
3061
3100
|
function resolveCliRoute(session, argv) {
|
|
3062
3101
|
const { config } = session;
|
|
3063
3102
|
const { stdout, stderr, exit } = session.io;
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
}
|
|
3070
|
-
} catch (error) {
|
|
3071
|
-
if (!(error instanceof CliArgumentError2))
|
|
3072
|
-
throw error;
|
|
3073
|
-
stderr(`${error.message}
|
|
3103
|
+
const scan = scanCliInvocation2(argv, {
|
|
3104
|
+
appGlobals: config.globalOptions,
|
|
3105
|
+
defaultCommand: config.defaultCommand
|
|
3106
|
+
});
|
|
3107
|
+
if (scan.error !== undefined) {
|
|
3108
|
+
stderr(`${scan.error.message}
|
|
3074
3109
|
`);
|
|
3075
3110
|
exit(2);
|
|
3076
3111
|
return;
|
|
@@ -3268,7 +3303,7 @@ async function runManagedInvocation(session, route) {
|
|
|
3268
3303
|
const { config } = session;
|
|
3269
3304
|
const { stdout, stderr, exit } = session.io;
|
|
3270
3305
|
const { command, topLevelHelp, helpRequested, schemaRequested } = route;
|
|
3271
|
-
const managed = await buildManagedSurface(session, route.typedGlobals, !topLevelHelp && !helpRequested && !schemaRequested);
|
|
3306
|
+
const managed = await buildManagedSurface(session, route.typedGlobals, !topLevelHelp && !helpRequested && !schemaRequested && !isInspectOnlyLifecycle(session.lifecycle));
|
|
3272
3307
|
if (topLevelHelp || command === undefined)
|
|
3273
3308
|
return respondTopLevelHelp(session, route, managed);
|
|
3274
3309
|
if (!managed.resolved) {
|
|
@@ -3316,6 +3351,10 @@ async function runManagedCommand(session, route, command, managed) {
|
|
|
3316
3351
|
stdout(renderCommandSchema(command, descriptor));
|
|
3317
3352
|
return exit(0);
|
|
3318
3353
|
}
|
|
3354
|
+
const inspectErr = inspectOnlyError(session.lifecycle);
|
|
3355
|
+
if (inspectErr) {
|
|
3356
|
+
return exit(emitResult2(toolResultFromError(inspectErr), { stdout, stderr }, emitOptionsFor(config, route.framework.json, command)));
|
|
3357
|
+
}
|
|
3319
3358
|
if (descriptor.unavailableReason !== undefined) {
|
|
3320
3359
|
return exit(emitResult2(unavailableCommand(descriptor.unavailableReason), { stdout, stderr }, emitOptionsFor(config, route.framework.json, command)));
|
|
3321
3360
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { FileObservation, FileReadStat, FileStatsView, NanosecondFileStats } from './file-observation.js';
|
|
2
|
+
/** Minimal stat of the current target path used to confirm a read still matches its name. */
|
|
3
|
+
export interface FilePathStat {
|
|
4
|
+
dev: number | bigint;
|
|
5
|
+
ino: number | bigint;
|
|
6
|
+
isFile(): boolean;
|
|
7
|
+
}
|
|
8
|
+
/** Injectable path-stat hook for deterministic async snapshot tests. */
|
|
9
|
+
export interface BoundedFileSnapshotHooks {
|
|
10
|
+
namedStat?: (path: string) => Promise<FilePathStat>;
|
|
11
|
+
}
|
|
12
|
+
/** Injectable path-stat hook for deterministic sync snapshot tests. */
|
|
13
|
+
export interface BoundedFileSnapshotSyncHooks {
|
|
14
|
+
namedStatSync?: (path: string) => FilePathStat;
|
|
15
|
+
}
|
|
16
|
+
export declare function sameDeviceOrInode(a: number | bigint, b: number | bigint): boolean;
|
|
17
|
+
export declare function sameSize(statSize: number | bigint, byteLength: number): boolean;
|
|
18
|
+
export declare function isPathSwapErrno(code: string | undefined, rejectSymlinks: boolean | undefined): boolean;
|
|
19
|
+
export declare function matchesNamedPath(after: {
|
|
20
|
+
dev: number | bigint;
|
|
21
|
+
ino: number | bigint;
|
|
22
|
+
}, named: FilePathStat): boolean;
|
|
23
|
+
export declare function defaultNamedStat(path: string, rejectSymlinks: boolean | undefined): Promise<FilePathStat>;
|
|
24
|
+
export declare function defaultNamedStatSync(path: string, rejectSymlinks: boolean | undefined): FilePathStat;
|
|
25
|
+
export declare function isNanosecondStats(info: FileReadStat | NanosecondFileStats): info is NanosecondFileStats;
|
|
26
|
+
export declare const observationOf: (info: FileObservation) => FileObservation;
|
|
27
|
+
export declare const bigObservation: (info: NanosecondFileStats) => FileObservation;
|
|
28
|
+
export declare function toObservation(info: FileReadStat | NanosecondFileStats): FileObservation;
|
|
29
|
+
export declare function statsViewOf(info: NanosecondFileStats): FileStatsView;
|
|
30
|
+
export declare function sameBigStat(before: NanosecondFileStats, after: NanosecondFileStats, length: number): boolean;
|
|
31
|
+
export declare function sameReadStat(before: FileReadStat | NanosecondFileStats, after: FileReadStat | NanosecondFileStats, length: number): boolean;
|
|
32
|
+
//# sourceMappingURL=bounded-file-confirm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bounded-file-confirm.d.ts","sourceRoot":"","sources":["../../src/internal/bounded-file-confirm.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,aAAa,EACb,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAE5B,6FAA6F;AAC7F,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,MAAM,IAAI,OAAO,CAAC;CACnB;AAED,wEAAwE;AACxE,MAAM,WAAW,wBAAwB;IACvC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;CACrD;AAED,uEAAuE;AACvE,MAAM,WAAW,4BAA4B;IAC3C,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,YAAY,CAAC;CAChD;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAEjF;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAI/E;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,cAAc,EAAE,OAAO,GAAG,SAAS,GAClC,OAAO,CAIT;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE;IAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EACrD,KAAK,EAAE,YAAY,GAClB,OAAO,CAMT;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,OAAO,GAAG,SAAS,GAClC,OAAO,CAAC,YAAY,CAAC,CAEvB;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,OAAO,GAAG,SAAS,GAClC,YAAY,CAEd;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,YAAY,GAAG,mBAAmB,GACvC,IAAI,IAAI,mBAAmB,CAE7B;AAED,eAAO,MAAM,aAAa,SAAU,eAAe,KAAG,eAOpD,CAAC;AAWH,eAAO,MAAM,cAAc,SAAU,mBAAmB,KAAG,eAOzD,CAAC;AAEH,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,GAAG,mBAAmB,GAAG,eAAe,CAEvF;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,mBAAmB,GAAG,aAAa,CAepE;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,mBAAmB,EAC1B,MAAM,EAAE,MAAM,GACb,OAAO,CAcT;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,YAAY,GAAG,mBAAmB,EAC1C,KAAK,EAAE,YAAY,GAAG,mBAAmB,EACzC,MAAM,EAAE,MAAM,GACb,OAAO,CAsBT"}
|