stitchkit 0.116.0 → 0.118.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 +56 -0
- package/dist/agent-runtime/run-acquisition.d.ts +9 -2
- package/dist/agent-runtime/run-acquisition.d.ts.map +1 -1
- package/dist/agent-runtime/run-execution.d.ts +3 -0
- package/dist/agent-runtime/run-execution.d.ts.map +1 -1
- package/dist/agent-runtime/run-failure.d.ts +4 -1
- package/dist/agent-runtime/run-failure.d.ts.map +1 -1
- package/dist/agent-runtime/run-store-retry.d.ts +8 -0
- package/dist/agent-runtime/run-store-retry.d.ts.map +1 -0
- package/dist/agent-runtime/run-terminal.d.ts.map +1 -1
- package/dist/agent-runtime/run-unacquired.d.ts +19 -0
- package/dist/agent-runtime/run-unacquired.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance.d.ts +8 -0
- package/dist/agent-runtime/store-conformance.d.ts.map +1 -1
- package/dist/agent-runtime/store-driver-contract.d.ts +5 -0
- package/dist/agent-runtime/store-driver-contract.d.ts.map +1 -1
- package/dist/agent-runtime/terminal-commit.d.ts +34 -4
- package/dist/agent-runtime/terminal-commit.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/harness.js +2 -2
- 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 +22 -4
- package/dist/entrypoints/agent-runtime.d.ts +1 -1
- package/dist/entrypoints/agent-runtime.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime.js +13 -11
- package/dist/entrypoints/application/diagnostic-journal.js +1 -1
- package/dist/entrypoints/application/directory-inbox.js +3 -3
- package/dist/entrypoints/cli/publish.js +2 -2
- package/dist/entrypoints/files.js +2 -2
- package/dist/entrypoints/primitives.js +51 -154
- package/dist/entrypoints/server.js +6 -6
- package/dist/entrypoints/telegram.d.ts +1 -1
- package/dist/entrypoints/telegram.d.ts.map +1 -1
- package/dist/entrypoints/telegram.js +352 -137
- package/dist/entrypoints/tracking/contract.d.ts +11 -0
- package/dist/entrypoints/tracking/contract.d.ts.map +1 -0
- package/dist/entrypoints/tracking/contract.js +162 -0
- package/dist/entrypoints/tracking/performance.d.ts +8 -0
- package/dist/entrypoints/tracking/performance.d.ts.map +1 -0
- package/dist/entrypoints/tracking/performance.js +181 -0
- package/dist/entrypoints/tracking/server.d.ts +1 -0
- package/dist/entrypoints/tracking/server.d.ts.map +1 -1
- package/dist/entrypoints/tracking/server.js +40 -12
- package/dist/entrypoints/tracking.d.ts +4 -3
- package/dist/entrypoints/tracking.d.ts.map +1 -1
- package/dist/entrypoints/tracking.js +43 -143
- package/dist/entrypoints/xlsx.d.ts +4 -0
- package/dist/entrypoints/xlsx.d.ts.map +1 -0
- package/dist/entrypoints/xlsx.js +406 -0
- package/dist/{index-fa435yq2.js → index-073nw9qr.js} +8 -8
- package/dist/index-1f40z584.js +7 -0
- package/dist/{index-fdk4r4r6.js → index-75ns2ybj.js} +1 -1
- package/dist/{index-jq2ky8fw.js → index-cycp3r3e.js} +124 -181
- package/dist/{index-4g6qmgdx.js → index-ghtpfz4z.js} +9 -9
- package/dist/{index-n3v695sb.js → index-hdjmdwsj.js} +277 -96
- package/dist/{index-zqkz4af9.js → index-nqxrm176.js} +1 -1
- package/dist/index-qezhmp51.js +242 -0
- package/dist/index-vv1sch8a.js +94 -0
- package/dist/{index-fggxgbrk.js → index-xx1j310k.js} +165 -102
- package/dist/internal/exclusive-lock.d.ts.map +1 -1
- package/dist/primitives/decimal.d.ts +10 -0
- package/dist/primitives/decimal.d.ts.map +1 -1
- package/dist/primitives/index.d.ts +3 -1
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/money.d.ts +20 -0
- package/dist/primitives/money.d.ts.map +1 -1
- package/dist/primitives/quantity.d.ts.map +1 -1
- package/dist/primitives/rounding.d.ts +40 -0
- package/dist/primitives/rounding.d.ts.map +1 -0
- package/dist/telegram/budget-transformer.d.ts +2 -2
- package/dist/telegram/not-dispatched.d.ts +2 -2
- package/dist/telegram/not-dispatched.d.ts.map +1 -1
- package/dist/telegram/outbound-budget.d.ts +53 -16
- package/dist/telegram/outbound-budget.d.ts.map +1 -1
- package/dist/telegram/outbound-cost.d.ts +5 -0
- package/dist/telegram/outbound-cost.d.ts.map +1 -0
- package/dist/telegram/outbound-pauses.d.ts +17 -0
- package/dist/telegram/outbound-pauses.d.ts.map +1 -0
- package/dist/telegram/outbound-queue.d.ts +17 -0
- package/dist/telegram/outbound-queue.d.ts.map +1 -0
- package/dist/telegram/update-intake-work.d.ts +20 -1
- package/dist/telegram/update-intake-work.d.ts.map +1 -1
- package/dist/telegram/update-intake.d.ts +12 -3
- package/dist/telegram/update-intake.d.ts.map +1 -1
- package/dist/telegram/update-store-check.d.ts +1 -1
- package/dist/telegram/update-store-check.d.ts.map +1 -1
- package/dist/telegram/update-store-postgres.d.ts.map +1 -1
- package/dist/telegram/update-store-sqlite.d.ts.map +1 -1
- package/dist/telegram/update-store.d.ts +5 -1
- package/dist/telegram/update-store.d.ts.map +1 -1
- package/dist/tracking/attribution.d.ts +1 -1
- package/dist/tracking/attribution.d.ts.map +1 -1
- package/dist/tracking/client-visit.d.ts +3 -1
- package/dist/tracking/client-visit.d.ts.map +1 -1
- package/dist/tracking/client.d.ts.map +1 -1
- package/dist/tracking/performance/collector.d.ts +61 -0
- package/dist/tracking/performance/collector.d.ts.map +1 -0
- package/dist/tracking/performance/schema.d.ts +45 -0
- package/dist/tracking/performance/schema.d.ts.map +1 -0
- package/dist/tracking/performance/summary.d.ts +12 -0
- package/dist/tracking/performance/summary.d.ts.map +1 -0
- package/dist/tracking/privacy.d.ts +5 -0
- package/dist/tracking/privacy.d.ts.map +1 -0
- package/dist/tracking/server/telemetry-health.d.ts +31 -0
- package/dist/tracking/server/telemetry-health.d.ts.map +1 -0
- package/dist/xlsx/cells.d.ts +17 -0
- package/dist/xlsx/cells.d.ts.map +1 -0
- package/dist/xlsx/render.d.ts +11 -0
- package/dist/xlsx/render.d.ts.map +1 -0
- package/dist/xlsx/schema.d.ts +119 -0
- package/dist/xlsx/schema.d.ts.map +1 -0
- package/dist/xlsx/zip.d.ts +13 -0
- package/dist/xlsx/zip.d.ts.map +1 -0
- package/llms/agent-runtime.2.txt +40 -16
- package/llms/agent-runtime.3.txt +17 -0
- package/llms/agent-runtime.txt +4 -1
- package/llms/primitives.txt +21 -0
- package/llms/stitchkit.txt +9 -6
- package/llms/telegram.txt +46 -15
- package/llms/tracking-contract.txt +32 -0
- package/llms/tracking-performance.txt +21 -0
- package/llms/tracking-server.txt +1 -0
- package/llms/tracking.txt +75 -12
- package/llms/{upgrading-0.105.0-0.116.0.txt → upgrading-0.105.0-0.118.0.txt} +73 -3
- package/llms/upgrading.txt +1 -1
- package/llms/xlsx.txt +107 -0
- package/llms-full.txt +392 -34
- package/llms.txt +11 -7
- package/package.json +27 -9
- package/dist/{index-z3d6smer.js → index-tdpmfks8.js} +5 -5
|
@@ -38,8 +38,14 @@ import {
|
|
|
38
38
|
assistantStatus,
|
|
39
39
|
ProviderJournalMessageSchema,
|
|
40
40
|
ProviderJournalRequestSchema,
|
|
41
|
-
ProviderJournalResponseSchema
|
|
42
|
-
|
|
41
|
+
ProviderJournalResponseSchema,
|
|
42
|
+
AgentRuntimeHeadSchema2,
|
|
43
|
+
AgentStoredRunSchema2,
|
|
44
|
+
AgentAdmissionReceiptSchema2,
|
|
45
|
+
AgentSeedReceiptSchema2,
|
|
46
|
+
isActiveRunState,
|
|
47
|
+
emptyHead
|
|
48
|
+
} from "./index-xx1j310k.js";
|
|
43
49
|
import {
|
|
44
50
|
StepEventPayloadSchema,
|
|
45
51
|
ParkEventPayloadSchema,
|
|
@@ -114,78 +120,15 @@ async function purgeAgentConversation2(store, input) {
|
|
|
114
120
|
return AgentConversationPurgeResultSchema2.parse(await store.purgeConversation(parsed));
|
|
115
121
|
}
|
|
116
122
|
|
|
117
|
-
// src/agent-runtime/store-driver-contract.ts
|
|
118
|
-
import { z as z3 } from "zod";
|
|
119
|
-
var AgentRuntimeHeadSchema2 = z3.object({
|
|
120
|
-
schemaVersion: z3.literal(1),
|
|
121
|
-
conversationId: AgentRecordIdSchema2,
|
|
122
|
-
version: AgentRecordVersionSchema2
|
|
123
|
-
});
|
|
124
|
-
var AgentStoredRunSchema2 = z3.object({
|
|
125
|
-
schemaVersion: z3.literal(1),
|
|
126
|
-
run: AgentRunSchema2,
|
|
127
|
-
terminalAssistant: AgentMessageSchema2.optional()
|
|
128
|
-
});
|
|
129
|
-
var AgentAdmissionReceiptSchema2 = z3.object({
|
|
130
|
-
schemaVersion: z3.literal(1),
|
|
131
|
-
conversationId: AgentRecordIdSchema2,
|
|
132
|
-
idempotencyKey: z3.string().min(1),
|
|
133
|
-
input: AgentMessageSchema2,
|
|
134
|
-
runId: AgentRecordIdSchema2,
|
|
135
|
-
assistantMessageId: AgentRecordIdSchema2
|
|
136
|
-
});
|
|
137
|
-
var AgentSeedReceiptSchema2 = z3.object({
|
|
138
|
-
schemaVersion: z3.literal(1),
|
|
139
|
-
conversationId: AgentRecordIdSchema2,
|
|
140
|
-
seedKey: z3.string().min(1),
|
|
141
|
-
messageIds: z3.array(AgentRecordIdSchema2).min(1)
|
|
142
|
-
});
|
|
143
|
-
var AgentHistoryMutationSchema2 = z3.discriminatedUnion("type", [
|
|
144
|
-
z3.object({ type: z3.literal("admit"), input: AgentMessageSchema2 }),
|
|
145
|
-
z3.object({
|
|
146
|
-
type: z3.literal("upsert-assistant"),
|
|
147
|
-
message: AgentMessageSchema2
|
|
148
|
-
}),
|
|
149
|
-
z3.object({
|
|
150
|
-
type: z3.literal("replace-compacted-range"),
|
|
151
|
-
replacedMessageIds: z3.array(AgentRecordIdSchema2).min(1),
|
|
152
|
-
summary: AgentMessageSchema2
|
|
153
|
-
}),
|
|
154
|
-
z3.object({
|
|
155
|
-
type: z3.literal("seed"),
|
|
156
|
-
message: AgentMessageSchema2
|
|
157
|
-
}),
|
|
158
|
-
z3.object({
|
|
159
|
-
type: z3.literal("insert"),
|
|
160
|
-
message: AgentMessageSchema2,
|
|
161
|
-
beforeMessageId: AgentRecordIdSchema2.optional()
|
|
162
|
-
})
|
|
163
|
-
]);
|
|
164
|
-
var ACTIVE_AGENT_RUN_STATES2 = [
|
|
165
|
-
"queued",
|
|
166
|
-
"running",
|
|
167
|
-
"interrupt_requested"
|
|
168
|
-
];
|
|
169
|
-
function isActiveRunState(state) {
|
|
170
|
-
return ACTIVE_AGENT_RUN_STATES2.includes(state);
|
|
171
|
-
}
|
|
172
|
-
function emptyHead(conversationId) {
|
|
173
|
-
return AgentRuntimeHeadSchema2.parse({
|
|
174
|
-
schemaVersion: 1,
|
|
175
|
-
conversationId,
|
|
176
|
-
version: 0
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
|
|
180
123
|
// src/agent-runtime/store-create.ts
|
|
181
|
-
import { z as
|
|
124
|
+
import { z as z14 } from "zod";
|
|
182
125
|
|
|
183
126
|
// src/agent-runtime/store-archive.ts
|
|
184
|
-
import { z as
|
|
127
|
+
import { z as z4 } from "zod";
|
|
185
128
|
|
|
186
129
|
// src/agent-runtime/branch-replay.ts
|
|
187
130
|
import { createHash as createHash2 } from "node:crypto";
|
|
188
|
-
import { z as
|
|
131
|
+
import { z as z3 } from "zod";
|
|
189
132
|
|
|
190
133
|
// src/agent-runtime/store-reducer.ts
|
|
191
134
|
import { createHash } from "node:crypto";
|
|
@@ -687,14 +630,14 @@ function operationConversationId(operation) {
|
|
|
687
630
|
}
|
|
688
631
|
|
|
689
632
|
// src/agent-runtime/branch-replay.ts
|
|
690
|
-
var BranchBaselineSchema =
|
|
691
|
-
migratedAt:
|
|
692
|
-
asOf:
|
|
633
|
+
var BranchBaselineSchema = z3.object({
|
|
634
|
+
migratedAt: z3.iso.datetime({ offset: true }),
|
|
635
|
+
asOf: z3.iso.datetime({ offset: true }).optional(),
|
|
693
636
|
head: AgentRuntimeHeadSchema2,
|
|
694
|
-
messages:
|
|
695
|
-
compacted:
|
|
696
|
-
runs:
|
|
697
|
-
admissions:
|
|
637
|
+
messages: z3.array(AgentMessageSchema2),
|
|
638
|
+
compacted: z3.array(z3.string().min(1)).optional(),
|
|
639
|
+
runs: z3.array(AgentStoredRunSchema2),
|
|
640
|
+
admissions: z3.array(AgentAdmissionReceiptSchema2)
|
|
698
641
|
}).strict();
|
|
699
642
|
function branchTransition(event) {
|
|
700
643
|
const checkpoint = AgentStoreCheckpointRecordSchema.safeParse(event.payload);
|
|
@@ -1020,7 +963,7 @@ async function exportConversationIn(driver, transaction, conversationId) {
|
|
|
1020
963
|
conversationId,
|
|
1021
964
|
events,
|
|
1022
965
|
projections: [
|
|
1023
|
-
{ archiveType: "runtime-snapshot", snapshot:
|
|
966
|
+
{ archiveType: "runtime-snapshot", snapshot: z4.json().parse(snapshot) },
|
|
1024
967
|
...durable.projections
|
|
1025
968
|
],
|
|
1026
969
|
spills: durable.spills
|
|
@@ -1029,13 +972,13 @@ async function exportConversationIn(driver, transaction, conversationId) {
|
|
|
1029
972
|
|
|
1030
973
|
// src/agent-runtime/store-branch.ts
|
|
1031
974
|
import { createHash as createHash7 } from "node:crypto";
|
|
1032
|
-
import { z as
|
|
975
|
+
import { z as z12 } from "zod";
|
|
1033
976
|
|
|
1034
977
|
// src/agent-runtime/branch-events.ts
|
|
1035
|
-
import { z as
|
|
978
|
+
import { z as z8 } from "zod";
|
|
1036
979
|
|
|
1037
980
|
// src/agent-runtime/branch-messages.ts
|
|
1038
|
-
import { z as
|
|
981
|
+
import { z as z5 } from "zod";
|
|
1039
982
|
function branchOpaqueJson(value) {
|
|
1040
983
|
if (Array.isArray(value))
|
|
1041
984
|
return value.map(branchOpaqueJson);
|
|
@@ -1059,26 +1002,26 @@ function branchOpaqueJson(value) {
|
|
|
1059
1002
|
}
|
|
1060
1003
|
return value;
|
|
1061
1004
|
}
|
|
1062
|
-
var ArtifactReadSchema =
|
|
1063
|
-
reference:
|
|
1064
|
-
offset:
|
|
1065
|
-
maxBytes:
|
|
1005
|
+
var ArtifactReadSchema = z5.object({
|
|
1006
|
+
reference: z5.string(),
|
|
1007
|
+
offset: z5.int().nonnegative(),
|
|
1008
|
+
maxBytes: z5.int().positive().optional()
|
|
1066
1009
|
}).strict();
|
|
1067
|
-
var ArtifactSearchSchema =
|
|
1068
|
-
reference:
|
|
1069
|
-
query:
|
|
1070
|
-
maxMatches:
|
|
1010
|
+
var ArtifactSearchSchema = z5.object({
|
|
1011
|
+
reference: z5.string(),
|
|
1012
|
+
query: z5.string(),
|
|
1013
|
+
maxMatches: z5.int().positive().optional()
|
|
1071
1014
|
}).strict();
|
|
1072
|
-
var ArtifactReadResultSchema =
|
|
1073
|
-
reference:
|
|
1074
|
-
offset:
|
|
1075
|
-
text:
|
|
1076
|
-
bytes:
|
|
1077
|
-
totalBytes:
|
|
1015
|
+
var ArtifactReadResultSchema = z5.object({
|
|
1016
|
+
reference: z5.string(),
|
|
1017
|
+
offset: z5.int().nonnegative(),
|
|
1018
|
+
text: z5.string(),
|
|
1019
|
+
bytes: z5.int().nonnegative(),
|
|
1020
|
+
totalBytes: z5.int().nonnegative().optional()
|
|
1078
1021
|
}).strict();
|
|
1079
|
-
var ArtifactSearchResultSchema =
|
|
1080
|
-
reference:
|
|
1081
|
-
matches:
|
|
1022
|
+
var ArtifactSearchResultSchema = z5.object({
|
|
1023
|
+
reference: z5.string(),
|
|
1024
|
+
matches: z5.array(z5.object({ line: z5.int().positive(), text: z5.string() }).strict())
|
|
1082
1025
|
}).strict();
|
|
1083
1026
|
function branchToolJson(ids, name, value, output) {
|
|
1084
1027
|
if (name === AGENT_CODING_TOOL_NAMES.readOutput || name === AGENT_CODING_TOOL_NAMES.searchOutput) {
|
|
@@ -1148,7 +1091,7 @@ function branchMessage(ids, sourceConversationId, message) {
|
|
|
1148
1091
|
...message.runId && { runId: ids.reference("run", message.runId) },
|
|
1149
1092
|
parts: message.parts.map((part) => branchPart(ids, part)),
|
|
1150
1093
|
...message.metadata && {
|
|
1151
|
-
metadata:
|
|
1094
|
+
metadata: z5.record(z5.string(), z5.json()).parse(branchOpaqueJson(message.metadata))
|
|
1152
1095
|
}
|
|
1153
1096
|
};
|
|
1154
1097
|
}
|
|
@@ -1177,61 +1120,61 @@ function branchRun(ids, sourceConversationId, run, settled) {
|
|
|
1177
1120
|
}
|
|
1178
1121
|
|
|
1179
1122
|
// src/agent-runtime/branch-observations.ts
|
|
1180
|
-
import { z as
|
|
1181
|
-
var Id =
|
|
1182
|
-
var Hash2 =
|
|
1183
|
-
var State =
|
|
1123
|
+
import { z as z6 } from "zod";
|
|
1124
|
+
var Id = z6.string().min(1);
|
|
1125
|
+
var Hash2 = z6.string().regex(/^[a-f0-9]{64}$/);
|
|
1126
|
+
var State = z6.object({
|
|
1184
1127
|
name: Id,
|
|
1185
|
-
version:
|
|
1186
|
-
value:
|
|
1187
|
-
actor:
|
|
1128
|
+
version: z6.int().positive(),
|
|
1129
|
+
value: z6.json(),
|
|
1130
|
+
actor: z6.enum(["agent", "human", "system"])
|
|
1188
1131
|
}).strict();
|
|
1189
|
-
var Retry =
|
|
1190
|
-
attempt:
|
|
1191
|
-
delayMs:
|
|
1192
|
-
reason:
|
|
1132
|
+
var Retry = z6.object({
|
|
1133
|
+
attempt: z6.int().positive(),
|
|
1134
|
+
delayMs: z6.number().nonnegative().optional(),
|
|
1135
|
+
reason: z6.string().optional()
|
|
1193
1136
|
}).strict();
|
|
1194
|
-
var Spill =
|
|
1195
|
-
var Schedule =
|
|
1137
|
+
var Spill = z6.object({ reference: Id, bytes: z6.int().nonnegative(), sha256: Hash2.optional() }).strict();
|
|
1138
|
+
var Schedule = z6.object({
|
|
1196
1139
|
id: Id,
|
|
1197
|
-
kind:
|
|
1198
|
-
nextAt:
|
|
1199
|
-
occurrence:
|
|
1200
|
-
lateByMs:
|
|
1201
|
-
state:
|
|
1202
|
-
message:
|
|
1203
|
-
attempts:
|
|
1204
|
-
retryAt:
|
|
1205
|
-
terminal:
|
|
1206
|
-
skipped:
|
|
1140
|
+
kind: z6.enum(["at", "after", "every"]).optional(),
|
|
1141
|
+
nextAt: z6.string().nullable().optional(),
|
|
1142
|
+
occurrence: z6.int().nonnegative().optional(),
|
|
1143
|
+
lateByMs: z6.number().nonnegative().optional(),
|
|
1144
|
+
state: z6.string().optional(),
|
|
1145
|
+
message: z6.string().optional(),
|
|
1146
|
+
attempts: z6.int().nonnegative().optional(),
|
|
1147
|
+
retryAt: z6.string().nullable().optional(),
|
|
1148
|
+
terminal: z6.boolean().optional(),
|
|
1149
|
+
skipped: z6.boolean().optional()
|
|
1207
1150
|
}).strict();
|
|
1208
|
-
var Child =
|
|
1151
|
+
var Child = z6.object({
|
|
1209
1152
|
childConversationId: Id.optional(),
|
|
1210
1153
|
parentConversationId: Id.optional(),
|
|
1211
|
-
seedUptoSeq:
|
|
1212
|
-
budget:
|
|
1213
|
-
state:
|
|
1154
|
+
seedUptoSeq: z6.int().nonnegative().optional(),
|
|
1155
|
+
budget: z6.json().optional(),
|
|
1156
|
+
state: z6.string().optional(),
|
|
1214
1157
|
resultReference: Id.optional(),
|
|
1215
|
-
reason:
|
|
1216
|
-
action:
|
|
1158
|
+
reason: z6.string().optional(),
|
|
1159
|
+
action: z6.enum(["message-sent", "blocking-presented", "blocking-resolved"]).optional(),
|
|
1217
1160
|
approvalId: Id.optional(),
|
|
1218
1161
|
childApprovalId: Id.optional(),
|
|
1219
1162
|
callId: Id.optional(),
|
|
1220
1163
|
toolName: Id.optional(),
|
|
1221
|
-
input:
|
|
1164
|
+
input: z6.json().optional(),
|
|
1222
1165
|
batchId: Id.optional(),
|
|
1223
|
-
kind:
|
|
1224
|
-
presentedAt:
|
|
1225
|
-
approved:
|
|
1166
|
+
kind: z6.string().optional(),
|
|
1167
|
+
presentedAt: z6.string().optional(),
|
|
1168
|
+
approved: z6.boolean().optional()
|
|
1226
1169
|
}).strict();
|
|
1227
|
-
var Rejection =
|
|
1170
|
+
var Rejection = z6.object({ approvalId: Id, callId: Id, toolName: Id, reason: z6.string() }).strict();
|
|
1228
1171
|
function branchObservation(ids, kind, raw) {
|
|
1229
1172
|
if (kind.startsWith("durability/")) {
|
|
1230
1173
|
const value = kind === "durability/step" ? StepEventPayloadSchema.parse(raw) : kind === "durability/park" ? ParkEventPayloadSchema.parse(raw) : kind === "durability/event" ? DeliveredEventPayloadSchema.parse(raw) : kind === "durability/effect" ? EffectEventPayloadSchema.parse(raw) : undefined;
|
|
1231
1174
|
if (!value || canonicalAgentJson2(value) !== canonicalAgentJson2(raw))
|
|
1232
1175
|
throw new TypeError("Branch cannot rekey opaque durability payload");
|
|
1233
1176
|
if ("encoded" in value)
|
|
1234
|
-
branchOpaqueJson(
|
|
1177
|
+
branchOpaqueJson(z6.json().parse(JSON.parse(value.encoded)));
|
|
1235
1178
|
return {
|
|
1236
1179
|
...value,
|
|
1237
1180
|
runId: ids.reference("run", value.runId),
|
|
@@ -1239,10 +1182,10 @@ function branchObservation(ids, kind, raw) {
|
|
|
1239
1182
|
};
|
|
1240
1183
|
}
|
|
1241
1184
|
if (kind === "sandbox/probed")
|
|
1242
|
-
return
|
|
1185
|
+
return z6.object({
|
|
1243
1186
|
result: AgentSandboxGradeSchema2,
|
|
1244
|
-
required:
|
|
1245
|
-
missing:
|
|
1187
|
+
required: z6.array(AgentSandboxRestrictionSchema2),
|
|
1188
|
+
missing: z6.array(AgentSandboxRestrictionSchema2)
|
|
1246
1189
|
}).strict().parse(raw);
|
|
1247
1190
|
if (kind === "state/set") {
|
|
1248
1191
|
const value = State.parse(raw);
|
|
@@ -1294,7 +1237,7 @@ function branchObservation(ids, kind, raw) {
|
|
|
1294
1237
|
}
|
|
1295
1238
|
throw new TypeError(`Branch cannot rekey opaque event kind ${kind}`);
|
|
1296
1239
|
}
|
|
1297
|
-
var BranchObservationSchema =
|
|
1240
|
+
var BranchObservationSchema = z6.object({ sourceKind: Id, payload: z6.json() }).strict();
|
|
1298
1241
|
|
|
1299
1242
|
// src/agent-runtime/branch-provider.ts
|
|
1300
1243
|
import { createHash as createHash3 } from "node:crypto";
|
|
@@ -1406,7 +1349,7 @@ class BranchProvider {
|
|
|
1406
1349
|
}
|
|
1407
1350
|
|
|
1408
1351
|
// src/agent-runtime/branch-transitions.ts
|
|
1409
|
-
import { z as
|
|
1352
|
+
import { z as z7 } from "zod";
|
|
1410
1353
|
function rekeyBranchTransition(ids, source, operation) {
|
|
1411
1354
|
const message = (value) => branchMessage(ids, source, value);
|
|
1412
1355
|
const input = operation.input;
|
|
@@ -1477,11 +1420,11 @@ function rekeyBranchTransition(ids, source, operation) {
|
|
|
1477
1420
|
}
|
|
1478
1421
|
}
|
|
1479
1422
|
function branchJson(value) {
|
|
1480
|
-
return
|
|
1423
|
+
return z7.json().parse(value);
|
|
1481
1424
|
}
|
|
1482
1425
|
|
|
1483
1426
|
// src/agent-runtime/branch-events.ts
|
|
1484
|
-
var Hash3 =
|
|
1427
|
+
var Hash3 = z8.string().regex(/^[a-f0-9]{64}$/);
|
|
1485
1428
|
function rekeyBranchEvents(ids, source, events, retainedMessages = new Map) {
|
|
1486
1429
|
const hydrated = events.map((event) => {
|
|
1487
1430
|
const assistant = retainedMessages.get(event.eventId);
|
|
@@ -1528,14 +1471,14 @@ function rekeyBranchEvent(ids, source, event, provider) {
|
|
|
1528
1471
|
if (event.kind === "runtime/transition") {
|
|
1529
1472
|
const operation = branchTransition(event);
|
|
1530
1473
|
const rekeyed = rekeyBranchTransition(ids, source, operation);
|
|
1531
|
-
const raw =
|
|
1532
|
-
type:
|
|
1533
|
-
input:
|
|
1534
|
-
assistant:
|
|
1474
|
+
const raw = z8.object({
|
|
1475
|
+
type: z8.string(),
|
|
1476
|
+
input: z8.object({
|
|
1477
|
+
assistant: z8.object({
|
|
1535
1478
|
sha256: Hash3.optional(),
|
|
1536
1479
|
sourceSha256: Hash3.optional(),
|
|
1537
|
-
bytes:
|
|
1538
|
-
parts:
|
|
1480
|
+
bytes: z8.int(),
|
|
1481
|
+
parts: z8.int()
|
|
1539
1482
|
}).passthrough()
|
|
1540
1483
|
}).passthrough()
|
|
1541
1484
|
}).passthrough().safeParse(event.payload);
|
|
@@ -1693,32 +1636,32 @@ class BranchIdentities {
|
|
|
1693
1636
|
|
|
1694
1637
|
// src/agent-runtime/branch-source.ts
|
|
1695
1638
|
import { createHash as createHash6 } from "node:crypto";
|
|
1696
|
-
import { z as
|
|
1639
|
+
import { z as z11 } from "zod";
|
|
1697
1640
|
|
|
1698
1641
|
// src/agent-runtime/archive-projection.ts
|
|
1699
|
-
import { z as
|
|
1700
|
-
var ArchiveProjectionSchema =
|
|
1701
|
-
name:
|
|
1702
|
-
version:
|
|
1703
|
-
uptoSeq:
|
|
1704
|
-
value:
|
|
1705
|
-
updatedAt:
|
|
1642
|
+
import { z as z9 } from "zod";
|
|
1643
|
+
var ArchiveProjectionSchema = z9.object({
|
|
1644
|
+
name: z9.string(),
|
|
1645
|
+
version: z9.int().positive(),
|
|
1646
|
+
uptoSeq: z9.int().nonnegative(),
|
|
1647
|
+
value: z9.json(),
|
|
1648
|
+
updatedAt: z9.string()
|
|
1706
1649
|
}).strict();
|
|
1707
1650
|
|
|
1708
1651
|
// src/agent-runtime/archive-spill.ts
|
|
1709
1652
|
import { createHash as createHash5 } from "node:crypto";
|
|
1710
|
-
import { z as
|
|
1711
|
-
var ArchiveSpillSchema =
|
|
1712
|
-
reference:
|
|
1713
|
-
runId:
|
|
1714
|
-
toolCallId:
|
|
1715
|
-
mediaType:
|
|
1716
|
-
bytes:
|
|
1717
|
-
sha256:
|
|
1718
|
-
createdAt:
|
|
1719
|
-
expiresAt:
|
|
1653
|
+
import { z as z10 } from "zod";
|
|
1654
|
+
var ArchiveSpillSchema = z10.object({
|
|
1655
|
+
reference: z10.string().min(1),
|
|
1656
|
+
runId: z10.string().min(1).optional(),
|
|
1657
|
+
toolCallId: z10.string().min(1).optional(),
|
|
1658
|
+
mediaType: z10.string().min(1),
|
|
1659
|
+
bytes: z10.int().nonnegative(),
|
|
1660
|
+
sha256: z10.string().regex(/^[a-f0-9]{64}$/),
|
|
1661
|
+
createdAt: z10.iso.datetime({ offset: true }),
|
|
1662
|
+
expiresAt: z10.iso.datetime({ offset: true }).optional(),
|
|
1720
1663
|
authorization: AgentCodingToolAuthorizationSchema2.optional(),
|
|
1721
|
-
base64:
|
|
1664
|
+
base64: z10.string()
|
|
1722
1665
|
}).strict().superRefine((spill, ctx) => {
|
|
1723
1666
|
const bytes = Buffer.from(spill.base64, "base64");
|
|
1724
1667
|
if (bytes.toString("base64") !== spill.base64 || bytes.byteLength !== spill.bytes || createHash5("sha256").update(bytes).digest("hex") !== spill.sha256) {
|
|
@@ -1730,7 +1673,7 @@ var ArchiveSpillSchema = z11.object({
|
|
|
1730
1673
|
});
|
|
1731
1674
|
|
|
1732
1675
|
// src/agent-runtime/branch-source.ts
|
|
1733
|
-
var SnapshotProjection =
|
|
1676
|
+
var SnapshotProjection = z11.object({ archiveType: z11.literal("runtime-snapshot"), snapshot: AgentSnapshotSchema2 }).strict();
|
|
1734
1677
|
function branchHash(value) {
|
|
1735
1678
|
return createHash6("sha256").update(canonicalAgentJson2(value)).digest("hex");
|
|
1736
1679
|
}
|
|
@@ -1747,13 +1690,13 @@ function boundary(events, throughRunId) {
|
|
|
1747
1690
|
for (const event of events) {
|
|
1748
1691
|
if (event.kind !== "runtime/transition")
|
|
1749
1692
|
continue;
|
|
1750
|
-
const candidate =
|
|
1751
|
-
type:
|
|
1752
|
-
input:
|
|
1753
|
-
runId:
|
|
1754
|
-
reason:
|
|
1755
|
-
action:
|
|
1756
|
-
absorb:
|
|
1693
|
+
const candidate = z11.object({
|
|
1694
|
+
type: z11.string(),
|
|
1695
|
+
input: z11.object({
|
|
1696
|
+
runId: z11.string().optional(),
|
|
1697
|
+
reason: z11.string().optional(),
|
|
1698
|
+
action: z11.string().optional(),
|
|
1699
|
+
absorb: z11.array(z11.object({ runId: z11.string() })).optional()
|
|
1757
1700
|
})
|
|
1758
1701
|
}).safeParse(event.payload);
|
|
1759
1702
|
if (!candidate.success)
|
|
@@ -1772,7 +1715,7 @@ function prepareBranchSource(bytes, source) {
|
|
|
1772
1715
|
if (event.seq !== index + 1)
|
|
1773
1716
|
throw new TypeError("Branch source event sequence is incomplete");
|
|
1774
1717
|
}
|
|
1775
|
-
const projections = archive.projections.map((value) =>
|
|
1718
|
+
const projections = archive.projections.map((value) => z11.union([SnapshotProjection, ArchiveProjectionSchema]).parse(value));
|
|
1776
1719
|
if (projections.some((value, index) => canonicalAgentJson2(value) !== canonicalAgentJson2(archive.projections[index])))
|
|
1777
1720
|
throw new TypeError("Branch archive snapshot contains an unknown opaque field");
|
|
1778
1721
|
const snapshots = projections.filter((value) => ("archiveType" in value));
|
|
@@ -1942,12 +1885,12 @@ async function branchConversation(driver, raw) {
|
|
|
1942
1885
|
conversationId: input.destinationConversationId,
|
|
1943
1886
|
events: [],
|
|
1944
1887
|
projections: [],
|
|
1945
|
-
spills:
|
|
1888
|
+
spills: z12.array(z12.json()).parse(spills)
|
|
1946
1889
|
});
|
|
1947
1890
|
await driver.events.append(tx, agentStoreEventDraft({
|
|
1948
1891
|
conversationId: input.destinationConversationId,
|
|
1949
1892
|
kind: "runtime/branched",
|
|
1950
|
-
payload:
|
|
1893
|
+
payload: z12.json().parse(receipt)
|
|
1951
1894
|
}));
|
|
1952
1895
|
return { outcome: "created", receipt };
|
|
1953
1896
|
});
|
|
@@ -2000,7 +1943,7 @@ function findEventOnce(driver, input) {
|
|
|
2000
1943
|
}
|
|
2001
1944
|
|
|
2002
1945
|
// src/agent-runtime/store-mutate.ts
|
|
2003
|
-
import { z as
|
|
1946
|
+
import { z as z13 } from "zod";
|
|
2004
1947
|
function validateAdmissionReceipt(receipt, record, conversationId) {
|
|
2005
1948
|
const input = receipt.input;
|
|
2006
1949
|
const run = record.run;
|
|
@@ -2147,7 +2090,7 @@ async function persistApplied(driver, transaction, read, operation, reduced) {
|
|
|
2147
2090
|
await driver.events.append(transaction, agentStoreEventDraft({
|
|
2148
2091
|
conversationId,
|
|
2149
2092
|
kind: "runtime/transition",
|
|
2150
|
-
payload:
|
|
2093
|
+
payload: z13.json().parse(transitionRecord(operation, reduced))
|
|
2151
2094
|
}));
|
|
2152
2095
|
return { outcome: "applied", snapshot: reduced.snapshot };
|
|
2153
2096
|
}
|
|
@@ -2196,9 +2139,9 @@ function createStoreConversationPurge(driver, conversations) {
|
|
|
2196
2139
|
}
|
|
2197
2140
|
|
|
2198
2141
|
// src/agent-runtime/store-create.ts
|
|
2199
|
-
var AgentRecoverableScanInputSchema =
|
|
2200
|
-
cursor:
|
|
2201
|
-
limit:
|
|
2142
|
+
var AgentRecoverableScanInputSchema = z14.object({
|
|
2143
|
+
cursor: z14.string().min(1).optional(),
|
|
2144
|
+
limit: z14.number().int().min(1).max(1000)
|
|
2202
2145
|
});
|
|
2203
2146
|
function createAgentRuntimeStore2(driver) {
|
|
2204
2147
|
const mutate = (operation) => mutateStore(driver, operation);
|
|
@@ -2250,4 +2193,4 @@ function createAgentRuntimeStore2(driver) {
|
|
|
2250
2193
|
};
|
|
2251
2194
|
}
|
|
2252
2195
|
|
|
2253
|
-
export { BranchAgentConversationInputSchema2, AgentConversationBranchReceiptSchema2, AgentConversationBranchResultSchema2, AgentConversationPurgeInputSchema2, AgentConversationPurgeResultSchema2, AgentConversationPurgedError2, purgeAgentConversation2,
|
|
2196
|
+
export { BranchAgentConversationInputSchema2, AgentConversationBranchReceiptSchema2, AgentConversationBranchResultSchema2, AgentConversationPurgeInputSchema2, AgentConversationPurgeResultSchema2, AgentConversationPurgedError2, purgeAgentConversation2, replaceMessage, appendEventIn, ArchiveProjectionSchema, ArchiveSpillSchema, createAgentRuntimeStore2 };
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentStoreEventEnvelopeSchema2,
|
|
3
3
|
AgentStoreEventPageSchema2,
|
|
4
|
-
AgentRecoverablePageSchema2
|
|
5
|
-
} from "./index-fggxgbrk.js";
|
|
6
|
-
import {
|
|
7
|
-
AgentRecordIdSchema2,
|
|
8
|
-
AgentMessageSchema2
|
|
9
|
-
} from "./index-8kzct1d6.js";
|
|
10
|
-
import {
|
|
4
|
+
AgentRecoverablePageSchema2,
|
|
11
5
|
AgentRuntimeHeadSchema2,
|
|
12
6
|
AgentStoredRunSchema2,
|
|
13
7
|
AgentAdmissionReceiptSchema2,
|
|
14
8
|
AgentSeedReceiptSchema2,
|
|
15
9
|
AgentHistoryMutationSchema2,
|
|
16
|
-
isActiveRunState
|
|
10
|
+
isActiveRunState
|
|
11
|
+
} from "./index-xx1j310k.js";
|
|
12
|
+
import {
|
|
13
|
+
AgentRecordIdSchema2,
|
|
14
|
+
AgentMessageSchema2
|
|
15
|
+
} from "./index-8kzct1d6.js";
|
|
16
|
+
import {
|
|
17
17
|
replaceMessage,
|
|
18
18
|
ArchiveSpillSchema,
|
|
19
19
|
createAgentRuntimeStore2
|
|
20
|
-
} from "./index-
|
|
20
|
+
} from "./index-cycp3r3e.js";
|
|
21
21
|
|
|
22
22
|
// src/agent-runtime/store-memory.ts
|
|
23
23
|
import { z as z2 } from "zod";
|