@ai-dev-orchestrator/schemas 0.1.2 → 0.1.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.
@@ -2,6 +2,18 @@ import { z } from 'zod/v4';
2
2
  import { artifactRefSchema } from '../artifacts/artifact-system';
3
3
  import { runIdSchema } from '../shared/shared';
4
4
  import { liveRequestKindSchema, sessionTransportSchema } from '../shared/string-enums';
5
+ export const entryActionContinuationSchema = z.object({
6
+ stateId: z.string(),
7
+ completedResults: z.array(z.custom()).readonly(),
8
+ nextActionIndex: z.number().int().nonnegative(),
9
+ waitRequestingState: z.string().optional(),
10
+ completedExitResults: z.array(z.custom()).readonly().optional(),
11
+ humanFeedback: z.string().optional(),
12
+ previousReviewContent: z.string().optional(),
13
+ iterationCount: z.number().optional(),
14
+ resumeInput: z.custom().optional(),
15
+ resumeWaitingContext: z.custom().optional(),
16
+ });
5
17
  export const budgetExhaustionContextSchema = z.object({
6
18
  limitType: z.literal('token'),
7
19
  current: z.number(),
@@ -44,6 +56,10 @@ export const persistedStateSchema = z.object({
44
56
  cumulativeInputTokens: z.number().optional(),
45
57
  cumulativeOutputTokens: z.number().optional(),
46
58
  hasReceivedUsage: z.boolean().optional(),
59
+ budgetApproved: z.boolean().optional(),
60
+ executionPaused: z.boolean().optional(),
61
+ pendingTerminalState: z.string().optional(),
62
+ terminalRecoveryState: z.string().optional(),
47
63
  governanceDecisionCount: z.number().optional(),
48
64
  escalationCount: z.number().optional(),
49
65
  workerMetricsByRole: z
@@ -58,6 +74,14 @@ export const persistedStateSchema = z.object({
58
74
  dispatchCounter: z.number().optional(),
59
75
  firedThresholdIndex: z.number().optional(),
60
76
  lastHumanFeedback: z.string().optional(),
77
+ lastHumanAnswer: z
78
+ .object({
79
+ stateId: z.string(),
80
+ requestingState: z.string(),
81
+ waitingSince: z.string(),
82
+ content: z.string(),
83
+ })
84
+ .optional(),
61
85
  lastReviewContent: z.string().optional(),
62
86
  lastTrigger: z.string().optional(),
63
87
  stateTimestamps: z
@@ -68,6 +92,9 @@ export const persistedStateSchema = z.object({
68
92
  }))
69
93
  .readonly()
70
94
  .optional(),
95
+ /** Action results completed before a post-action budget pause. */
96
+ interruptedActionResults: z.array(z.custom()).readonly().optional(),
97
+ entryActionContinuation: entryActionContinuationSchema.optional(),
71
98
  });
72
99
  export const stateValidationResultSchema = z.object({
73
100
  valid: z.boolean(),
@@ -80,4 +107,5 @@ export const lockHandleSchema = z.object({
80
107
  acquiredAt: z.string(),
81
108
  lockPath: z.string(),
82
109
  hostname: z.string(),
110
+ ownershipToken: z.uuid().optional(),
83
111
  });
@@ -1,13 +1,13 @@
1
1
  import { z } from 'zod/v4';
2
2
  import { type AgentStreamEventType } from '../shared/string-enums';
3
3
  export declare const agentSessionStateSchema: z.ZodEnum<{
4
- running: "running";
4
+ completed: "completed";
5
5
  awaiting_human: "awaiting_human";
6
+ aborted: "aborted";
7
+ running: "running";
6
8
  paused: "paused";
7
9
  reconnecting: "reconnecting";
8
- completed: "completed";
9
10
  failed: "failed";
10
- aborted: "aborted";
11
11
  orphaned: "orphaned";
12
12
  }>;
13
13
  export type AgentSessionState = z.infer<typeof agentSessionStateSchema>;
@@ -134,6 +134,11 @@ export declare const reconnectMetaSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
134
134
  authHeader: z.ZodOptional<z.ZodString>;
135
135
  }, z.core.$strip>], "type">;
136
136
  export type ReconnectMeta = z.infer<typeof reconnectMetaSchema>;
137
+ export declare const agentTokenUsageSchema: z.ZodObject<{
138
+ inputTokens: z.ZodNumber;
139
+ outputTokens: z.ZodNumber;
140
+ }, z.core.$strip>;
141
+ export type AgentTokenUsage = z.infer<typeof agentTokenUsageSchema>;
137
142
  export declare const agentSessionSnapshotSchema: z.ZodObject<{
138
143
  ref: z.ZodObject<{
139
144
  sessionId: z.ZodString;
@@ -172,13 +177,13 @@ export declare const agentSessionSnapshotSchema: z.ZodObject<{
172
177
  }>;
173
178
  }, z.core.$strip>;
174
179
  state: z.ZodEnum<{
175
- running: "running";
180
+ completed: "completed";
176
181
  awaiting_human: "awaiting_human";
182
+ aborted: "aborted";
183
+ running: "running";
177
184
  paused: "paused";
178
185
  reconnecting: "reconnecting";
179
- completed: "completed";
180
186
  failed: "failed";
181
- aborted: "aborted";
182
187
  orphaned: "orphaned";
183
188
  }>;
184
189
  pendingRequests: z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -231,6 +236,14 @@ export declare const agentSessionSnapshotSchema: z.ZodObject<{
231
236
  expiresAt: z.ZodOptional<z.ZodString>;
232
237
  workerId: z.ZodOptional<z.ZodString>;
233
238
  error: z.ZodOptional<z.ZodString>;
239
+ completion: z.ZodOptional<z.ZodObject<{
240
+ artifactContent: z.ZodString;
241
+ durationMs: z.ZodNumber;
242
+ tokenUsage: z.ZodOptional<z.ZodObject<{
243
+ inputTokens: z.ZodNumber;
244
+ outputTokens: z.ZodNumber;
245
+ }, z.core.$strip>>;
246
+ }, z.core.$strip>>;
234
247
  }, z.core.$strip>;
235
248
  export type AgentSessionSnapshot = z.infer<typeof agentSessionSnapshotSchema>;
236
249
  export declare const agentSessionHandleSchema: z.ZodObject<{
@@ -271,13 +284,13 @@ export declare const agentSessionHandleSchema: z.ZodObject<{
271
284
  }>;
272
285
  }, z.core.$strip>;
273
286
  state: z.ZodEnum<{
274
- running: "running";
287
+ completed: "completed";
275
288
  awaiting_human: "awaiting_human";
289
+ aborted: "aborted";
290
+ running: "running";
276
291
  paused: "paused";
277
292
  reconnecting: "reconnecting";
278
- completed: "completed";
279
293
  failed: "failed";
280
- aborted: "aborted";
281
294
  orphaned: "orphaned";
282
295
  }>;
283
296
  pendingRequests: z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -314,8 +327,8 @@ export declare const agentSessionHandleSchema: z.ZodObject<{
314
327
  }, z.core.$strip>;
315
328
  export type AgentSessionHandle = z.infer<typeof agentSessionHandleSchema>;
316
329
  export declare const sessionDispatchOutcomeSchema: z.ZodEnum<{
317
- awaiting_human: "awaiting_human";
318
330
  completed: "completed";
331
+ awaiting_human: "awaiting_human";
319
332
  session_active: "session_active";
320
333
  }>;
321
334
  export type SessionDispatchOutcome = z.infer<typeof sessionDispatchOutcomeSchema>;
@@ -848,8 +861,8 @@ export declare const dispatchResultSchema: z.ZodObject<{
848
861
  modelUsed: z.ZodString;
849
862
  }, z.core.$strip>;
850
863
  sessionOutcome: z.ZodOptional<z.ZodEnum<{
851
- awaiting_human: "awaiting_human";
852
864
  completed: "completed";
865
+ awaiting_human: "awaiting_human";
853
866
  session_active: "session_active";
854
867
  }>>;
855
868
  sessionRef: z.ZodOptional<z.ZodObject<{
@@ -951,8 +964,8 @@ export declare const workerStatusSchema: z.ZodObject<{
951
964
  task_spec_writer: "task_spec_writer";
952
965
  }>;
953
966
  state: z.ZodEnum<{
954
- running: "running";
955
967
  completed: "completed";
968
+ running: "running";
956
969
  failed: "failed";
957
970
  pending: "pending";
958
971
  "timed-out": "timed-out";
@@ -1661,11 +1674,6 @@ export declare const agentTaskSchema: z.ZodObject<{
1661
1674
  iterationCount: z.ZodOptional<z.ZodNumber>;
1662
1675
  }, z.core.$strip>;
1663
1676
  export type AgentTask = z.infer<typeof agentTaskSchema>;
1664
- export declare const agentTokenUsageSchema: z.ZodObject<{
1665
- inputTokens: z.ZodNumber;
1666
- outputTokens: z.ZodNumber;
1667
- }, z.core.$strip>;
1668
- export type AgentTokenUsage = z.infer<typeof agentTokenUsageSchema>;
1669
1677
  export declare const agentResultSchema: z.ZodObject<{
1670
1678
  taskId: z.ZodString;
1671
1679
  status: z.ZodEnum<{
@@ -1675,6 +1683,7 @@ export declare const agentResultSchema: z.ZodObject<{
1675
1683
  }>;
1676
1684
  artifactContent: z.ZodOptional<z.ZodString>;
1677
1685
  error: z.ZodOptional<z.ZodString>;
1686
+ recoverable: z.ZodOptional<z.ZodBoolean>;
1678
1687
  durationMs: z.ZodNumber;
1679
1688
  tokenUsage: z.ZodOptional<z.ZodObject<{
1680
1689
  inputTokens: z.ZodNumber;
@@ -1697,8 +1706,8 @@ export declare const submitResponseSchema: z.ZodObject<{
1697
1706
  export type SubmitResponse = z.infer<typeof submitResponseSchema>;
1698
1707
  export declare const pollResponseSchema: z.ZodObject<{
1699
1708
  status: z.ZodEnum<{
1700
- running: "running";
1701
1709
  completed: "completed";
1710
+ running: "running";
1702
1711
  failed: "failed";
1703
1712
  }>;
1704
1713
  result: z.ZodOptional<z.ZodObject<{
@@ -1710,6 +1719,7 @@ export declare const pollResponseSchema: z.ZodObject<{
1710
1719
  }>;
1711
1720
  artifactContent: z.ZodOptional<z.ZodString>;
1712
1721
  error: z.ZodOptional<z.ZodString>;
1722
+ recoverable: z.ZodOptional<z.ZodBoolean>;
1713
1723
  durationMs: z.ZodNumber;
1714
1724
  tokenUsage: z.ZodOptional<z.ZodObject<{
1715
1725
  inputTokens: z.ZodNumber;
@@ -78,6 +78,10 @@ export const reconnectMetaSchema = z.discriminatedUnion('type', [
78
78
  stdioReconnectMetaSchema,
79
79
  remoteReconnectMetaSchema,
80
80
  ]);
81
+ export const agentTokenUsageSchema = z.object({
82
+ inputTokens: z.number(),
83
+ outputTokens: z.number(),
84
+ });
81
85
  export const agentSessionSnapshotSchema = z.object({
82
86
  ref: agentSessionRefSchema,
83
87
  state: agentSessionStateSchema,
@@ -89,6 +93,13 @@ export const agentSessionSnapshotSchema = z.object({
89
93
  expiresAt: z.string().optional(),
90
94
  workerId: z.string().optional(),
91
95
  error: z.string().optional(),
96
+ completion: z
97
+ .object({
98
+ artifactContent: z.string(),
99
+ durationMs: z.number().nonnegative(),
100
+ tokenUsage: agentTokenUsageSchema.optional(),
101
+ })
102
+ .optional(),
92
103
  });
93
104
  export const agentSessionHandleSchema = z.object({
94
105
  ref: agentSessionRefSchema,
@@ -229,15 +240,12 @@ export const agentTaskSchema = z.object({
229
240
  previousFindings: z.string().optional(),
230
241
  iterationCount: z.number().optional(),
231
242
  });
232
- export const agentTokenUsageSchema = z.object({
233
- inputTokens: z.number(),
234
- outputTokens: z.number(),
235
- });
236
243
  export const agentResultSchema = z.object({
237
244
  taskId: z.string(),
238
245
  status: z.enum(['success', 'failure', 'timeout']),
239
246
  artifactContent: z.string().optional(),
240
247
  error: z.string().optional(),
248
+ recoverable: z.boolean().optional(),
241
249
  durationMs: z.number(),
242
250
  tokenUsage: agentTokenUsageSchema.optional(),
243
251
  });