stitchkit 0.110.3 → 0.110.4

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.
@@ -1,10 +1,10 @@
1
- import"../../../index-4fgg1507.js";
2
- import"../../../index-j1cwtyk1.js";
1
+ import"../../../index-jna0ejsa.js";
2
+ import"../../../index-mpg1t7nv.js";
3
3
  import"../../../index-8kzct1d6.js";
4
4
  import {
5
5
  initializeAgentRuntimeSqlite2,
6
6
  createSqliteAgentRuntimeStore2
7
- } from "../../../index-dgfah0g8.js";
7
+ } from "../../../index-5pbtbce0.js";
8
8
  import"../../../index-kqnd6a85.js";
9
9
  import"../../../index-5w6t91ze.js";
10
10
  import"../../../index-bm180f2d.js";
@@ -8,10 +8,10 @@ import {
8
8
  decodeAgentConversationArchive2,
9
9
  createToolChronology,
10
10
  advanceToolChronology
11
- } from "../../index-4fgg1507.js";
11
+ } from "../../index-jna0ejsa.js";
12
12
  import"../../index-5w6t91ze.js";
13
13
  import"../../index-bm180f2d.js";
14
- import"../../index-j1cwtyk1.js";
14
+ import"../../index-mpg1t7nv.js";
15
15
  import"../../index-ct75c3at.js";
16
16
  import"../../index-q6crhe1n.js";
17
17
  import"../../index-fynr93w4.js";
@@ -20,7 +20,7 @@ import"../../index-84bf5spd.js";
20
20
  import"../../index-snef22zr.js";
21
21
  import {
22
22
  createMemoryAgentRuntimeStore2
23
- } from "../../index-w619fqvv.js";
23
+ } from "../../index-9ket8wzx.js";
24
24
  import"../../index-e1sjcjfy.js";
25
25
  import"../../index-zrtrjkbf.js";
26
26
  import {
@@ -58,7 +58,7 @@ import {
58
58
  AgentHistoryMutationSchema2,
59
59
  ACTIVE_AGENT_RUN_STATES2,
60
60
  createAgentRuntimeStore2
61
- } from "../index-j1cwtyk1.js";
61
+ } from "../index-mpg1t7nv.js";
62
62
  import {
63
63
  AgentStoreEventKindSchema2,
64
64
  AgentStoreEventEnvelopeSchema2,
@@ -91,7 +91,7 @@ import {
91
91
  decodeAgentConversationArchive2,
92
92
  isAssistantHistoryEvidence2,
93
93
  isCompleteAgentHistoryTurn
94
- } from "../index-4fgg1507.js";
94
+ } from "../index-jna0ejsa.js";
95
95
  import"../index-5w6t91ze.js";
96
96
  import {
97
97
  AgentRuntimeConflictError2,
@@ -123,7 +123,7 @@ import {
123
123
  agentGoalStateSlot2,
124
124
  agentTodoStateSlot2,
125
125
  createAgentRuntime2
126
- } from "../index-ddkwkcvn.js";
126
+ } from "../index-8jv0trhg.js";
127
127
  import {
128
128
  AgentConversationSummarySchema2,
129
129
  AgentConversationPageSchema2,
@@ -190,7 +190,7 @@ import"../index-2kbysk9s.js";
190
190
  import"../index-84bf5spd.js";
191
191
  import {
192
192
  createMemoryAgentRuntimeStore2
193
- } from "../index-w619fqvv.js";
193
+ } from "../index-9ket8wzx.js";
194
194
  import {
195
195
  createAgentRuntimeEventSink2
196
196
  } from "../index-616xh7f2.js";
@@ -5,7 +5,7 @@ import {
5
5
  AgentRecoverableDescriptorSchema2,
6
6
  AgentRecoverablePageSchema2,
7
7
  canonicalAgentJson2
8
- } from "./index-4fgg1507.js";
8
+ } from "./index-jna0ejsa.js";
9
9
  import {
10
10
  AgentMessageSchema2,
11
11
  AgentRunSchema2
@@ -19,7 +19,7 @@ import {
19
19
  appendEventIn,
20
20
  ArchiveProjectionSchema,
21
21
  createAgentRuntimeStore2
22
- } from "./index-j1cwtyk1.js";
22
+ } from "./index-mpg1t7nv.js";
23
23
  import {
24
24
  AgentConversationPageSchema2,
25
25
  AgentConversationMessagePageSchema2
@@ -30,8 +30,11 @@ import {
30
30
  canProjectToolChronology,
31
31
  isAssistantHistoryEvidence2,
32
32
  isCompleteAgentHistoryTurn,
33
- assistantStatus
34
- } from "./index-4fgg1507.js";
33
+ assistantStatus,
34
+ ProviderJournalMessageSchema,
35
+ ProviderJournalRequestSchema,
36
+ ProviderJournalResponseSchema
37
+ } from "./index-jna0ejsa.js";
35
38
  import {
36
39
  messageOf
37
40
  } from "./index-g149e9pk.js";
@@ -2866,7 +2869,7 @@ async function createRunProviderLedger(input) {
2866
2869
  await store.appendEvent({
2867
2870
  conversationId: state.run.conversationId,
2868
2871
  kind: "provider/message",
2869
- payload: { sha256, message: JSON.parse(body) }
2872
+ payload: ProviderJournalMessageSchema.parse({ sha256, message: JSON.parse(body) })
2870
2873
  });
2871
2874
  knownMessageShas.add(sha256);
2872
2875
  }
@@ -2875,7 +2878,7 @@ async function createRunProviderLedger(input) {
2875
2878
  await store.appendEvent({
2876
2879
  conversationId: state.run.conversationId,
2877
2880
  kind: "provider/request",
2878
- payload: {
2881
+ payload: ProviderJournalRequestSchema.parse({
2879
2882
  runId: state.run.id,
2880
2883
  attempt: request.attempt,
2881
2884
  stepNumber: request.stepNumber,
@@ -2883,7 +2886,7 @@ async function createRunProviderLedger(input) {
2883
2886
  instructionsSha256,
2884
2887
  messageShas,
2885
2888
  bodySha256
2886
- }
2889
+ })
2887
2890
  });
2888
2891
  },
2889
2892
  async recordResponse(response) {
@@ -2893,12 +2896,12 @@ async function createRunProviderLedger(input) {
2893
2896
  await store.appendEvent({
2894
2897
  conversationId: state.run.conversationId,
2895
2898
  kind: "provider/response",
2896
- payload: {
2899
+ payload: ProviderJournalResponseSchema.parse({
2897
2900
  runId: state.run.id,
2898
2901
  attempt: response.attempt,
2899
2902
  stepNumber: response.stepNumber,
2900
2903
  response: identity
2901
- }
2904
+ })
2902
2905
  });
2903
2906
  return identity;
2904
2907
  }
@@ -2,7 +2,7 @@ import {
2
2
  AgentStoreEventEnvelopeSchema2,
3
3
  AgentStoreEventPageSchema2,
4
4
  AgentRecoverablePageSchema2
5
- } from "./index-4fgg1507.js";
5
+ } from "./index-jna0ejsa.js";
6
6
  import {
7
7
  AgentRecordIdSchema2,
8
8
  AgentMessageSchema2
@@ -17,7 +17,7 @@ import {
17
17
  replaceMessage,
18
18
  ArchiveSpillSchema,
19
19
  createAgentRuntimeStore2
20
- } from "./index-j1cwtyk1.js";
20
+ } from "./index-mpg1t7nv.js";
21
21
 
22
22
  // src/agent-runtime/store-memory.ts
23
23
  import { z as z2 } from "zod";
@@ -373,4 +373,158 @@ function assistantStatus(reason) {
373
373
  return "failed";
374
374
  }
375
375
 
376
- export { AgentStoreEventKindSchema2, AgentStoreEventEnvelopeSchema2, AppendAgentStoreEventSchema2, ReadAgentStoreEventsSchema2, AgentStoreEventPageSchema2, AgentStoreConflictSchema2, AgentStoreNotFoundSchema2, AgentStoreAppliedSchema2, AgentStoreDuplicateSchema2, AgentStoreMutationResultSchema2, AgentRunViewSchema2, AcceptInputAndAssignRunSchema2, AcquireAgentRunSchema2, CheckpointRunAssistantSchema2, RecordRunOperationSchema2, CommitRunTerminalSchema2, RequestRunInterruptSchema2, RecoverAgentRunSchema2, ReplaceCompactedRangeSchema2, SeedConversationInputSchema2, AgentRecoverableDescriptorSchema2, AgentRecoverablePageSchema2, AgentStoreTransitionSchema2, AgentStoreCheckpointRecordSchema, AgentStoreTransitionRecordSchema2, decodeAgentStoreEvent2, agentStoreEventDraft, canonicalAgentJson2, AgentConversationArchiveSchema2, encodeAgentConversationArchive2, decodeAgentConversationArchive2, createToolChronology, advanceToolChronology, canProjectToolChronology, isAssistantHistoryEvidence2, isCompleteAgentHistoryTurn, assistantStatus };
376
+ // src/agent-runtime/provider-journal.ts
377
+ import { z as z5 } from "zod";
378
+
379
+ // src/agent-runtime/provider-content.ts
380
+ import { z as z4 } from "zod";
381
+ var ProviderJournalOptions = {
382
+ providerOptions: z4.record(z4.string(), z4.record(z4.string(), z4.json())).optional()
383
+ };
384
+ var Options = ProviderJournalOptions;
385
+ var Reference = z4.record(z4.string(), z4.string()).refine((value) => !("type" in value), "Provider reference cannot contain a file discriminator");
386
+ var Binary = z4.object({
387
+ binary: z4.literal(true),
388
+ sha256: z4.string().regex(/^[a-f0-9]{64}$/),
389
+ bytes: z4.int().nonnegative()
390
+ }).strict();
391
+ var Inline = z4.union([z4.string(), Binary]);
392
+ var TaggedBinary = z4.object({ type: z4.literal("data"), data: Inline }).strict();
393
+ var TaggedUrl = z4.object({ type: z4.literal("url"), url: z4.string() }).strict();
394
+ var FileData = z4.union([
395
+ TaggedBinary,
396
+ TaggedUrl,
397
+ z4.object({ type: z4.literal("reference"), reference: Reference }).strict(),
398
+ z4.object({ type: z4.literal("text"), text: z4.string() }).strict()
399
+ ]);
400
+ var File = z4.object({
401
+ type: z4.literal("file"),
402
+ data: z4.union([FileData, Inline, Reference]),
403
+ mediaType: z4.string(),
404
+ filename: z4.string().optional(),
405
+ ...Options
406
+ }).strict();
407
+ var Text = z4.object({ type: z4.literal("text"), text: z4.string(), ...Options }).strict();
408
+ var Output = z4.discriminatedUnion("type", [
409
+ z4.object({ type: z4.enum(["text", "error-text"]), value: z4.string(), ...Options }).strict(),
410
+ z4.object({ type: z4.enum(["json", "error-json"]), value: z4.json(), ...Options }).strict(),
411
+ z4.object({ type: z4.literal("execution-denied"), reason: z4.string().optional(), ...Options }).strict(),
412
+ z4.object({
413
+ type: z4.literal("content"),
414
+ value: z4.array(z4.union([
415
+ Text,
416
+ z4.object({
417
+ type: z4.literal("file"),
418
+ data: FileData,
419
+ mediaType: z4.string(),
420
+ filename: z4.string().optional(),
421
+ ...Options
422
+ }).strict(),
423
+ z4.object({
424
+ type: z4.literal("file-data"),
425
+ data: z4.string(),
426
+ mediaType: z4.string(),
427
+ filename: z4.string().optional(),
428
+ ...Options
429
+ }).strict(),
430
+ z4.object({
431
+ type: z4.literal("image-data"),
432
+ data: z4.string(),
433
+ mediaType: z4.string(),
434
+ ...Options
435
+ }).strict(),
436
+ z4.object({
437
+ type: z4.literal("file-url"),
438
+ url: z4.string(),
439
+ mediaType: z4.string().optional(),
440
+ ...Options
441
+ }).strict(),
442
+ z4.object({ type: z4.literal("image-url"), url: z4.string(), ...Options }).strict(),
443
+ z4.object({
444
+ type: z4.enum(["file-id", "image-file-id"]),
445
+ fileId: z4.union([z4.string(), Reference]),
446
+ ...Options
447
+ }).strict(),
448
+ z4.object({
449
+ type: z4.enum(["file-reference", "image-file-reference"]),
450
+ providerReference: Reference,
451
+ ...Options
452
+ }).strict(),
453
+ z4.object({ type: z4.literal("custom"), ...Options }).strict()
454
+ ]))
455
+ }).strict()
456
+ ]);
457
+ var ProviderJournalContentSchema = z4.union([
458
+ Text,
459
+ File,
460
+ z4.object({ type: z4.literal("reasoning"), text: z4.string(), ...Options }).strict(),
461
+ z4.object({ type: z4.literal("custom"), kind: z4.string(), ...Options }).strict(),
462
+ z4.object({
463
+ type: z4.literal("reasoning-file"),
464
+ data: z4.union([TaggedBinary, TaggedUrl, Inline]),
465
+ mediaType: z4.string(),
466
+ ...Options
467
+ }).strict(),
468
+ z4.object({
469
+ type: z4.literal("image"),
470
+ image: z4.union([Inline, Reference]),
471
+ mediaType: z4.string().optional(),
472
+ ...Options
473
+ }).strict(),
474
+ z4.object({
475
+ type: z4.literal("tool-call"),
476
+ toolCallId: z4.string(),
477
+ toolName: z4.string(),
478
+ input: z4.json(),
479
+ providerExecuted: z4.boolean().optional(),
480
+ ...Options
481
+ }).strict(),
482
+ z4.object({
483
+ type: z4.literal("tool-result"),
484
+ toolCallId: z4.string(),
485
+ toolName: z4.string(),
486
+ output: Output,
487
+ ...Options
488
+ }).strict(),
489
+ z4.object({
490
+ type: z4.literal("tool-approval-request"),
491
+ approvalId: z4.string(),
492
+ toolCallId: z4.string(),
493
+ signature: z4.string().optional(),
494
+ isAutomatic: z4.boolean().optional(),
495
+ reason: z4.string().optional()
496
+ }).strict(),
497
+ z4.object({
498
+ type: z4.literal("tool-approval-response"),
499
+ approvalId: z4.string(),
500
+ approved: z4.boolean(),
501
+ reason: z4.string().optional(),
502
+ providerExecuted: z4.boolean().optional()
503
+ }).strict()
504
+ ]);
505
+
506
+ // src/agent-runtime/provider-journal.ts
507
+ var Hash = z5.string().regex(/^[a-f0-9]{64}$/);
508
+ var Message = z5.object({
509
+ ...ProviderJournalOptions,
510
+ role: z5.enum(["system", "user", "assistant", "tool"]),
511
+ content: z5.union([z5.string(), z5.array(ProviderJournalContentSchema)])
512
+ }).strict();
513
+ var ProviderJournalMessageSchema = z5.object({ sha256: Hash, message: Message }).strict();
514
+ var ProviderJournalRequestSchema = z5.object({
515
+ runId: z5.string(),
516
+ attempt: z5.int().nonnegative(),
517
+ stepNumber: z5.int().nonnegative(),
518
+ modelId: z5.string(),
519
+ instructionsSha256: Hash,
520
+ messageShas: z5.array(Hash),
521
+ bodySha256: Hash
522
+ }).strict();
523
+ var ProviderJournalResponseSchema = z5.object({
524
+ runId: z5.string(),
525
+ attempt: z5.int().nonnegative(),
526
+ stepNumber: z5.int().nonnegative(),
527
+ response: z5.object({ id: z5.string(), provider: z5.string().optional() }).strict()
528
+ }).strict();
529
+
530
+ export { AgentStoreEventKindSchema2, AgentStoreEventEnvelopeSchema2, AppendAgentStoreEventSchema2, ReadAgentStoreEventsSchema2, AgentStoreEventPageSchema2, AgentStoreConflictSchema2, AgentStoreNotFoundSchema2, AgentStoreAppliedSchema2, AgentStoreDuplicateSchema2, AgentStoreMutationResultSchema2, AgentRunViewSchema2, AcceptInputAndAssignRunSchema2, AcquireAgentRunSchema2, CheckpointRunAssistantSchema2, RecordRunOperationSchema2, CommitRunTerminalSchema2, RequestRunInterruptSchema2, RecoverAgentRunSchema2, ReplaceCompactedRangeSchema2, SeedConversationInputSchema2, AgentRecoverableDescriptorSchema2, AgentRecoverablePageSchema2, AgentStoreTransitionSchema2, AgentStoreCheckpointRecordSchema, AgentStoreTransitionRecordSchema2, decodeAgentStoreEvent2, agentStoreEventDraft, canonicalAgentJson2, AgentConversationArchiveSchema2, encodeAgentConversationArchive2, decodeAgentConversationArchive2, createToolChronology, advanceToolChronology, canProjectToolChronology, isAssistantHistoryEvidence2, isCompleteAgentHistoryTurn, assistantStatus, ProviderJournalMessageSchema, ProviderJournalRequestSchema, ProviderJournalResponseSchema };