@vertesia/common 1.5.0-dev.20260910.051115Z → 1.6.0-dev.20260912.110338Z

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.
Files changed (160) hide show
  1. package/lib/access-control-values.d.ts +1 -0
  2. package/lib/access-control-values.d.ts.map +1 -1
  3. package/lib/access-control-values.js +1 -0
  4. package/lib/access-control-values.js.map +1 -1
  5. package/lib/api-contract/components.generated.json +4188 -2267
  6. package/lib/api-schemas/adapter.d.ts.map +1 -1
  7. package/lib/api-schemas/adapter.js +8 -1
  8. package/lib/api-schemas/adapter.js.map +1 -1
  9. package/lib/api-schemas/agent-communication.d.ts +1 -0
  10. package/lib/api-schemas/agent-communication.d.ts.map +1 -1
  11. package/lib/api-schemas/agent-communication.js +6 -0
  12. package/lib/api-schemas/agent-communication.js.map +1 -1
  13. package/lib/api-schemas/agent-runs.d.ts +5271 -903
  14. package/lib/api-schemas/agent-runs.d.ts.map +1 -1
  15. package/lib/api-schemas/agent-runs.js +343 -1
  16. package/lib/api-schemas/agent-runs.js.map +1 -1
  17. package/lib/api-schemas/app-runtime.d.ts +1240 -22
  18. package/lib/api-schemas/app-runtime.d.ts.map +1 -1
  19. package/lib/api-schemas/content.d.ts +435 -0
  20. package/lib/api-schemas/content.d.ts.map +1 -1
  21. package/lib/api-schemas/data-store.d.ts +1 -0
  22. package/lib/api-schemas/data-store.d.ts.map +1 -1
  23. package/lib/api-schemas/data-store.js +7 -0
  24. package/lib/api-schemas/data-store.js.map +1 -1
  25. package/lib/api-schemas/delegation.d.ts +35 -0
  26. package/lib/api-schemas/delegation.d.ts.map +1 -0
  27. package/lib/api-schemas/delegation.js +21 -0
  28. package/lib/api-schemas/delegation.js.map +1 -0
  29. package/lib/api-schemas/document-processing.d.ts +261 -0
  30. package/lib/api-schemas/document-processing.d.ts.map +1 -1
  31. package/lib/api-schemas/emit-json-schema.d.ts +5 -0
  32. package/lib/api-schemas/emit-json-schema.d.ts.map +1 -0
  33. package/lib/api-schemas/emit-json-schema.js +37 -0
  34. package/lib/api-schemas/emit-json-schema.js.map +1 -0
  35. package/lib/api-schemas/environment.d.ts +18 -0
  36. package/lib/api-schemas/environment.d.ts.map +1 -1
  37. package/lib/api-schemas/events.d.ts +783 -0
  38. package/lib/api-schemas/events.d.ts.map +1 -1
  39. package/lib/api-schemas/index.d.ts +1 -0
  40. package/lib/api-schemas/index.d.ts.map +1 -1
  41. package/lib/api-schemas/index.js +1 -0
  42. package/lib/api-schemas/index.js.map +1 -1
  43. package/lib/api-schemas/interaction.d.ts +3939 -91
  44. package/lib/api-schemas/interaction.d.ts.map +1 -1
  45. package/lib/api-schemas/interaction.js +14 -3
  46. package/lib/api-schemas/interaction.js.map +1 -1
  47. package/lib/api-schemas/oauth-server.d.ts +1 -0
  48. package/lib/api-schemas/oauth-server.d.ts.map +1 -1
  49. package/lib/api-schemas/oauth-server.js +3 -0
  50. package/lib/api-schemas/oauth-server.js.map +1 -1
  51. package/lib/api-schemas/process-agent-policy.d.ts +69 -0
  52. package/lib/api-schemas/process-agent-policy.d.ts.map +1 -0
  53. package/lib/api-schemas/process-agent-policy.js +154 -0
  54. package/lib/api-schemas/process-agent-policy.js.map +1 -0
  55. package/lib/api-schemas/process.d.ts +1260 -0
  56. package/lib/api-schemas/process.d.ts.map +1 -1
  57. package/lib/api-schemas/process.js +29 -1
  58. package/lib/api-schemas/process.js.map +1 -1
  59. package/lib/api-schemas/project-configuration.d.ts +878 -8
  60. package/lib/api-schemas/project-configuration.d.ts.map +1 -1
  61. package/lib/api-schemas/project.d.ts +1327 -22
  62. package/lib/api-schemas/project.d.ts.map +1 -1
  63. package/lib/api-schemas/registry.d.ts +21836 -3256
  64. package/lib/api-schemas/registry.d.ts.map +1 -1
  65. package/lib/api-schemas/registry.js +40 -7
  66. package/lib/api-schemas/registry.js.map +1 -1
  67. package/lib/api-schemas/store.d.ts +4427 -77
  68. package/lib/api-schemas/store.d.ts.map +1 -1
  69. package/lib/api-schemas/sts.d.ts +6 -0
  70. package/lib/api-schemas/sts.d.ts.map +1 -1
  71. package/lib/api-schemas/sts.js +3 -0
  72. package/lib/api-schemas/sts.js.map +1 -1
  73. package/lib/api-schemas/workflow-runs.d.ts +189 -0
  74. package/lib/api-schemas/workflow-runs.d.ts.map +1 -1
  75. package/lib/api-schemas/workflow-runs.js +14 -0
  76. package/lib/api-schemas/workflow-runs.js.map +1 -1
  77. package/lib/apikey.d.ts +1 -0
  78. package/lib/apikey.d.ts.map +1 -1
  79. package/lib/apikey.js.map +1 -1
  80. package/lib/delegation.d.ts +13 -0
  81. package/lib/delegation.d.ts.map +1 -0
  82. package/lib/delegation.js +2 -0
  83. package/lib/delegation.js.map +1 -0
  84. package/lib/environment.d.ts +1 -0
  85. package/lib/environment.d.ts.map +1 -1
  86. package/lib/index.d.ts +1 -0
  87. package/lib/index.d.ts.map +1 -1
  88. package/lib/index.js.map +1 -1
  89. package/lib/oauth-scopes.d.ts.map +1 -1
  90. package/lib/oauth-scopes.js +1 -0
  91. package/lib/oauth-scopes.js.map +1 -1
  92. package/lib/store/agent-run-values.d.ts +25 -0
  93. package/lib/store/agent-run-values.d.ts.map +1 -0
  94. package/lib/store/agent-run-values.js +25 -0
  95. package/lib/store/agent-run-values.js.map +1 -0
  96. package/lib/store/agent-run.d.ts +22 -2
  97. package/lib/store/agent-run.d.ts.map +1 -1
  98. package/lib/store/agent-run.js +1 -1
  99. package/lib/store/agent-run.js.map +1 -1
  100. package/lib/store/conversation-state.d.ts +1 -1
  101. package/lib/store/conversation-state.d.ts.map +1 -1
  102. package/lib/store/intake-policy-schema.generated.d.ts.map +1 -1
  103. package/lib/store/intake-policy-schema.generated.js +124 -0
  104. package/lib/store/intake-policy-schema.generated.js.map +1 -1
  105. package/lib/store/process.d.ts +17 -0
  106. package/lib/store/process.d.ts.map +1 -1
  107. package/lib/store/process.js.map +1 -1
  108. package/lib/store/schedule.d.ts +62 -25
  109. package/lib/store/schedule.d.ts.map +1 -1
  110. package/lib/store/schedule.js +2 -2
  111. package/lib/store/schedule.js.map +1 -1
  112. package/lib/store/workflow.d.ts +2 -0
  113. package/lib/store/workflow.d.ts.map +1 -1
  114. package/lib/store/workflow.js.map +1 -1
  115. package/lib/vertesia-common.js +2 -2
  116. package/lib/vertesia-common.js.map +1 -1
  117. package/lib/workflow-analytics.d.ts +198 -2
  118. package/lib/workflow-analytics.d.ts.map +1 -1
  119. package/lib/workflow-analytics.js +6 -0
  120. package/lib/workflow-analytics.js.map +1 -1
  121. package/package.json +8 -8
  122. package/src/access-control-values.ts +1 -0
  123. package/src/api-contract/components.generated.json +4188 -2267
  124. package/src/api-schemas/adapter-edge-cases.test.ts +19 -0
  125. package/src/api-schemas/adapter.ts +8 -1
  126. package/src/api-schemas/agent-communication.ts +6 -0
  127. package/src/api-schemas/agent-history.contract.test.ts +42 -0
  128. package/src/api-schemas/agent-runs.contract.test.ts +203 -0
  129. package/src/api-schemas/agent-runs.ts +374 -0
  130. package/src/api-schemas/data-store.contract.test.ts +6 -0
  131. package/src/api-schemas/data-store.ts +8 -0
  132. package/src/api-schemas/delegation.ts +21 -0
  133. package/src/api-schemas/emit-json-schema.test.ts +36 -0
  134. package/src/api-schemas/emit-json-schema.ts +40 -0
  135. package/src/api-schemas/environment.contract.test.ts +3 -0
  136. package/src/api-schemas/index.ts +1 -0
  137. package/src/api-schemas/interaction.contract.test.ts +23 -0
  138. package/src/api-schemas/interaction.ts +15 -3
  139. package/src/api-schemas/llumiverse.contract.test.ts +3 -9
  140. package/src/api-schemas/oauth-server.ts +4 -0
  141. package/src/api-schemas/process-agent-policy.ts +167 -0
  142. package/src/api-schemas/process.contract.test.ts +115 -0
  143. package/src/api-schemas/process.ts +31 -1
  144. package/src/api-schemas/registry.ts +43 -10
  145. package/src/api-schemas/sts.ts +3 -0
  146. package/src/api-schemas/workflow-runs.ts +16 -0
  147. package/src/api-schemas/zeno-response-contracts.test.ts +36 -0
  148. package/src/apikey.ts +1 -0
  149. package/src/delegation.ts +18 -0
  150. package/src/index.ts +6 -0
  151. package/src/oauth-scopes.ts +1 -0
  152. package/src/store/agent-run-values.ts +27 -0
  153. package/src/store/agent-run.ts +36 -0
  154. package/src/store/conversation-state.ts +1 -1
  155. package/src/store/intake-policy-schema.generated.ts +125 -0
  156. package/src/store/process.ts +22 -0
  157. package/src/store/schedule.test.ts +59 -0
  158. package/src/store/schedule.ts +91 -27
  159. package/src/store/workflow.ts +2 -0
  160. package/src/workflow-analytics.ts +238 -1
package/src/apikey.ts CHANGED
@@ -80,6 +80,7 @@ export type ApiKeyListQuery = z.infer<typeof ApiKeyListQuerySchema>;
80
80
  export type ApiKeyReadQuery = z.infer<typeof ApiKeyReadQuerySchema>;
81
81
 
82
82
  export interface AuthTokenPayload {
83
+ delegation?: import('./delegation.js').DelegationTokenClaim;
83
84
  sub: string;
84
85
  name: string;
85
86
  email?: string;
@@ -0,0 +1,18 @@
1
+ import type { z } from 'zod';
2
+ import type {
3
+ CreateDelegationGrantPayloadSchema,
4
+ DelegationGrantArraySchema,
5
+ DelegationGrantSchema,
6
+ } from './api-schemas/delegation.js';
7
+
8
+ export type CreateDelegationGrantPayload = z.infer<typeof CreateDelegationGrantPayloadSchema>;
9
+ export type DelegationGrant = z.infer<typeof DelegationGrantSchema>;
10
+ export type DelegationGrantArray = z.infer<typeof DelegationGrantArraySchema>;
11
+
12
+ export interface DelegationTokenClaim {
13
+ grant_id: string;
14
+ subject: string;
15
+ schedule_id: string;
16
+ output_collection_id: string;
17
+ policy_hash: string;
18
+ }
package/src/index.ts CHANGED
@@ -22,6 +22,12 @@ export * from './common.js';
22
22
  export * from './content-query.js';
23
23
  export * from './cost-analytics.js';
24
24
  export * from './data-platform.js';
25
+ export type {
26
+ CreateDelegationGrantPayload,
27
+ DelegationGrant,
28
+ DelegationGrantArray,
29
+ DelegationTokenClaim,
30
+ } from './delegation.js';
25
31
  export * from './email.js';
26
32
  export * from './embeddings.js';
27
33
  export * from './environment.js';
@@ -12,6 +12,7 @@ export const OAUTH_STANDARD_SCOPES = [OAUTH_SCOPE_OPENID, OAUTH_SCOPE_PROFILE, O
12
12
  * hand out secret material, or are internal to the platform's own consoles.
13
13
  */
14
14
  const NON_OAUTH_PERMISSION_SCOPES = new Set<Permission>([
15
+ Permission.schedule_delegate,
15
16
  Permission.api_key_create,
16
17
  Permission.api_key_update,
17
18
  Permission.api_key_delete,
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Runtime values the agent-run API schemas build on.
3
+ *
4
+ * Split out of `agent-run.ts` for the reason `account-values.ts` was split out of `user.ts`: the
5
+ * schema module in `api-schemas/` needs these at runtime, while `agent-run.ts` must stay a
6
+ * type-only module so importing it never pulls Zod into a consumer's bundle. Both sides import
7
+ * from here, and `agent-run.ts` re-exports it so the constants are nameable from the package root.
8
+ */
9
+
10
+ /**
11
+ * Bound on `AgentRunFeedbackPayload.comment`, in characters.
12
+ *
13
+ * Published so a client can stop the user at the limit instead of letting the server reject the
14
+ * whole rating over the tail of a comment.
15
+ */
16
+ export const AGENT_RUN_FEEDBACK_COMMENT_MAX_LENGTH = 2000;
17
+
18
+ /**
19
+ * Bound on `AgentRunFeedbackPayload.feedback_id`, in characters. A UUID fits comfortably.
20
+ */
21
+ export const AGENT_RUN_FEEDBACK_ID_MAX_LENGTH = 64;
22
+
23
+ /**
24
+ * How many feedback entries a run retains. Counters are computed over the retained entries;
25
+ * replaced entries are evicted first, then the oldest.
26
+ */
27
+ export const AGENT_RUN_FEEDBACK_MAX_ENTRIES = 50;
@@ -21,7 +21,18 @@ import type {
21
21
  AgentRunArtifactQuerySchema,
22
22
  AgentRunArtifactsQuerySchema,
23
23
  AgentRunArtifactUploadHeadersSchema,
24
+ AgentRunContradictionReasonSchema,
24
25
  AgentRunDetailsQuerySchema,
26
+ AgentRunEvaluationRollupSchema,
27
+ AgentRunEvaluationSchema,
28
+ AgentRunFeedbackCountsSchema,
29
+ AgentRunFeedbackEntrySchema,
30
+ AgentRunFeedbackPayloadSchema,
31
+ AgentRunFeedbackRatingSchema,
32
+ AgentRunFeedbackReasonCodeSchema,
33
+ AgentRunFeedbackResponseSchema,
34
+ AgentRunFeedbackStatusSchema,
35
+ AgentRunJudgeResultSchema,
25
36
  AgentRunSchema,
26
37
  AgentRunUpdatesQuerySchema,
27
38
  AgentRunUpdatesResponseSchema,
@@ -31,6 +42,7 @@ import type {
31
42
  CreateRunPayloadSchema,
32
43
  IngestAgentEventsPayloadSchema,
33
44
  IngestAgentEventsResponseSchema,
45
+ ListAgentRunsEvaluationSeveritySchema,
34
46
  ListAgentRunsQuerySchema,
35
47
  PostAgentRunUpdatePayloadSchema,
36
48
  PostAgentRunUpdateResponseSchema,
@@ -64,6 +76,8 @@ import type {
64
76
  WorkflowRunEvent,
65
77
  } from './workflow.js';
66
78
 
79
+ export * from './agent-run-values.js';
80
+
67
81
  export type AgentRunStatus = z.infer<typeof AgentRunStatusSchema>;
68
82
 
69
83
  export type AgentRunArchiveState = z.infer<typeof AgentRunArchiveStateSchema>;
@@ -263,6 +277,8 @@ export interface RecordProcessRunPayload<TData = Record<string, unknown>, TSourc
263
277
  RecordRunWorkflowPayload {
264
278
  run_kind: 'process';
265
279
  run_type?: ProcessRunType;
280
+ schedule_id?: string;
281
+ type?: AgentRunType;
266
282
  }
267
283
 
268
284
  export type RecordRunPayload<TData = Record<string, unknown>, TSource = RunSource> =
@@ -277,6 +293,18 @@ export type BindRunWorkflowPayload = z.infer<typeof BindRunWorkflowPayloadSchema
277
293
 
278
294
  export type TerminateAgentRunResponse = z.infer<typeof TerminateAgentRunResponseSchema>;
279
295
 
296
+ export type AgentRunFeedbackRating = z.infer<typeof AgentRunFeedbackRatingSchema>;
297
+ export type AgentRunFeedbackReasonCode = z.infer<typeof AgentRunFeedbackReasonCodeSchema>;
298
+ export type AgentRunFeedbackPayload = z.infer<typeof AgentRunFeedbackPayloadSchema>;
299
+ export type AgentRunFeedbackStatus = z.infer<typeof AgentRunFeedbackStatusSchema>;
300
+ export type AgentRunFeedbackCounts = z.infer<typeof AgentRunFeedbackCountsSchema>;
301
+ export type AgentRunFeedbackResponse = z.infer<typeof AgentRunFeedbackResponseSchema>;
302
+ export type AgentRunFeedbackEntry = z.infer<typeof AgentRunFeedbackEntrySchema>;
303
+ export type AgentRunEvaluationRollup = z.infer<typeof AgentRunEvaluationRollupSchema>;
304
+ export type AgentRunJudgeResult = z.infer<typeof AgentRunJudgeResultSchema>;
305
+ export type AgentRunContradictionReason = z.infer<typeof AgentRunContradictionReasonSchema>;
306
+ export type AgentRunEvaluation = z.infer<typeof AgentRunEvaluationSchema>;
307
+
280
308
  /**
281
309
  * Payload for updating an AgentRun's lifecycle and derived metadata.
282
310
  */
@@ -308,6 +336,11 @@ export interface UpdateAgentRunStatusPayload {
308
336
  last_archive_error?: string;
309
337
  sequence?: number;
310
338
  process_state?: ProcessState;
339
+ /**
340
+ * Fold of the run's turn evaluations, written by the conversation workflow. The server applies
341
+ * it atomically and ignores a rollup whose `seq` is not newer than the one it holds.
342
+ */
343
+ evaluation_rollup?: AgentRunEvaluationRollup;
311
344
  }
312
345
 
313
346
  // The wire contract is deliberately open because signal payloads are selected by `signalName`.
@@ -388,6 +421,9 @@ export type AgentRunDetailsStreamEvent =
388
421
  | { type: 'control'; data: AgentRunDetailsControlStreamEvent }
389
422
  | { type: 'error'; data: AgentRunDetailsErrorStreamEvent };
390
423
 
424
+ /** Evaluation severity filter values; `unrated` selects runs without an evaluation. */
425
+ export type ListAgentRunsEvaluationSeverity = z.infer<typeof ListAgentRunsEvaluationSeveritySchema>;
426
+
391
427
  /**
392
428
  * Filters for listing agent runs.
393
429
  */
@@ -66,7 +66,7 @@ export interface ConversationState {
66
66
  /** Run-scoped, exact-target grants created by "allow this action for this run". */
67
67
  tool_approval_grants?: Record<string, ToolApprovalGrant>;
68
68
 
69
- /** Buffered tool results held while approval denial pauses until the next user message. */
69
+ /** Buffered tool results held across an interactive pause until the next user message. */
70
70
  pending_tool_approval_results?: PendingToolApprovalResults;
71
71
 
72
72
  /** Compact, redacted latest user intent for reviewer-style system interactions. */
@@ -1224,6 +1224,9 @@ export const ContentTypeIntakePolicySchema: JSONObject = {
1224
1224
  {
1225
1225
  $ref: '#/$defs/OpenAiTextOptions',
1226
1226
  },
1227
+ {
1228
+ $ref: '#/$defs/OpenRouterTextOptions',
1229
+ },
1227
1230
  {
1228
1231
  $ref: '#/$defs/OpenAiDalleOptions',
1229
1232
  },
@@ -1370,6 +1373,10 @@ export const ContentTypeIntakePolicySchema: JSONObject = {
1370
1373
  max_tokens: {
1371
1374
  type: 'number',
1372
1375
  },
1376
+ tool_choice: {
1377
+ type: 'string',
1378
+ enum: ['auto', 'none', 'any', 'required'],
1379
+ },
1373
1380
  effort: {
1374
1381
  $ref: '#/$defs/ReasoningEffort',
1375
1382
  },
@@ -1426,6 +1433,10 @@ export const ContentTypeIntakePolicySchema: JSONObject = {
1426
1433
  max_tokens: {
1427
1434
  type: 'number',
1428
1435
  },
1436
+ tool_choice: {
1437
+ type: 'string',
1438
+ enum: ['auto', 'none', 'any', 'required'],
1439
+ },
1429
1440
  stop_sequence: {
1430
1441
  type: 'array',
1431
1442
  items: {
@@ -1460,6 +1471,116 @@ export const ContentTypeIntakePolicySchema: JSONObject = {
1460
1471
  required: ['_option_id'],
1461
1472
  additionalProperties: false,
1462
1473
  },
1474
+ OpenRouterTextOptions: {
1475
+ type: 'object',
1476
+ properties: {
1477
+ max_tokens: {
1478
+ type: 'number',
1479
+ },
1480
+ tool_choice: {
1481
+ type: 'string',
1482
+ enum: ['auto', 'none', 'any', 'required'],
1483
+ },
1484
+ effort: {
1485
+ $ref: '#/$defs/ReasoningEffort',
1486
+ },
1487
+ reasoning_effort: {
1488
+ $ref: '#/$defs/ReasoningEffort',
1489
+ },
1490
+ temperature: {
1491
+ type: 'number',
1492
+ },
1493
+ top_p: {
1494
+ type: 'number',
1495
+ },
1496
+ presence_penalty: {
1497
+ type: 'number',
1498
+ },
1499
+ frequency_penalty: {
1500
+ type: 'number',
1501
+ },
1502
+ stop_sequence: {
1503
+ type: 'array',
1504
+ items: {
1505
+ type: 'string',
1506
+ },
1507
+ },
1508
+ image_detail: {
1509
+ type: 'string',
1510
+ enum: ['low', 'high', 'auto'],
1511
+ },
1512
+ include_thoughts: {
1513
+ type: 'boolean',
1514
+ },
1515
+ service_tier: {
1516
+ type: 'string',
1517
+ minLength: 1,
1518
+ description:
1519
+ 'Provider-defined processing tier. Unknown non-empty values are preserved for forward compatibility.',
1520
+ },
1521
+ _option_id: {
1522
+ type: 'string',
1523
+ const: 'openrouter-text',
1524
+ },
1525
+ provider_sort: {
1526
+ type: 'string',
1527
+ enum: ['price', 'throughput', 'latency', 'exacto'],
1528
+ },
1529
+ provider_order: {
1530
+ type: 'array',
1531
+ items: {
1532
+ type: 'string',
1533
+ },
1534
+ },
1535
+ provider_only: {
1536
+ type: 'array',
1537
+ items: {
1538
+ type: 'string',
1539
+ },
1540
+ },
1541
+ provider_ignore: {
1542
+ type: 'array',
1543
+ items: {
1544
+ type: 'string',
1545
+ },
1546
+ },
1547
+ provider_allow_fallbacks: {
1548
+ type: 'boolean',
1549
+ },
1550
+ provider_require_parameters: {
1551
+ type: 'boolean',
1552
+ },
1553
+ provider_data_collection: {
1554
+ type: 'string',
1555
+ enum: ['allow', 'deny'],
1556
+ },
1557
+ provider_zdr: {
1558
+ type: 'boolean',
1559
+ },
1560
+ provider_quantizations: {
1561
+ type: 'array',
1562
+ items: {
1563
+ type: 'string',
1564
+ enum: [
1565
+ 'int4',
1566
+ 'int8',
1567
+ 'fp4',
1568
+ 'mxfp4',
1569
+ 'nvfp4',
1570
+ 'fp6',
1571
+ 'fp8',
1572
+ 'mxfp8',
1573
+ 'fp16',
1574
+ 'bf16',
1575
+ 'fp32',
1576
+ 'unknown',
1577
+ ],
1578
+ },
1579
+ },
1580
+ },
1581
+ required: ['_option_id'],
1582
+ additionalProperties: false,
1583
+ },
1463
1584
  PromptCacheMode: {
1464
1585
  type: 'string',
1465
1586
  enum: ['auto', 'off', 'required'],
@@ -1482,6 +1603,10 @@ export const ContentTypeIntakePolicySchema: JSONObject = {
1482
1603
  max_tokens: {
1483
1604
  type: 'number',
1484
1605
  },
1606
+ tool_choice: {
1607
+ type: 'string',
1608
+ enum: ['auto', 'none', 'any', 'required'],
1609
+ },
1485
1610
  temperature: {
1486
1611
  type: 'number',
1487
1612
  },
@@ -63,6 +63,12 @@ import type {
63
63
  UpdateProcessTestScenarioPayloadSchema,
64
64
  UpdateProcessTestSuitePayloadSchema,
65
65
  } from '../api-schemas/process.js';
66
+ import type {
67
+ ProcessAgentExecutionPolicySchema,
68
+ ProcessAgentPhaseResetSchema,
69
+ ProcessAgentToolInputContainsSchema,
70
+ ProcessAgentToolPhaseSchema,
71
+ } from '../api-schemas/process-agent-policy.js';
66
72
  import type { JSONSchema } from '../json-schema.js';
67
73
 
68
74
  export type JsonLogicRule = z.infer<typeof JsonLogicRuleSchema>;
@@ -81,6 +87,10 @@ export type ProcessNodeRunType = z.infer<typeof ProcessNodeRunTypeSchema>;
81
87
  export type ParallelCollectMode = z.infer<typeof ParallelCollectModeSchema>;
82
88
  export type BranchJoinPolicy = z.infer<typeof BranchJoinPolicySchema>;
83
89
  export type ProcessDefinitionMetadata = z.infer<typeof ProcessDefinitionMetadataSchema>;
90
+ export type ProcessAgentToolPhase = z.infer<typeof ProcessAgentToolPhaseSchema>;
91
+ export type ProcessAgentToolInputContains = z.infer<typeof ProcessAgentToolInputContainsSchema>;
92
+ export type ProcessAgentPhaseReset = z.infer<typeof ProcessAgentPhaseResetSchema>;
93
+ export type ProcessAgentExecutionPolicy = z.infer<typeof ProcessAgentExecutionPolicySchema>;
84
94
  export type ProcessScriptLanguage = z.infer<typeof ProcessScriptLanguageSchema>;
85
95
 
86
96
  export type ProcessScriptInlineSource = z.infer<typeof ProcessScriptInlineSourceSchema>;
@@ -131,6 +141,12 @@ export interface NodeDefinition {
131
141
  result_schema?: JSONSchema;
132
142
  prompt?: string;
133
143
  input?: Record<string, unknown>;
144
+ /**
145
+ * Whether interaction and custom-agent nodes receive the complete process
146
+ * context in addition to resolved `input`. Defaults to true for backward
147
+ * compatibility. Set false to keep specialist prompts input-only.
148
+ */
149
+ inherit_context?: boolean;
134
150
  config?: Record<string, unknown>;
135
151
  title?: string;
136
152
  description?: string;
@@ -147,6 +163,12 @@ export interface NodeDefinition {
147
163
  max_retries?: number;
148
164
  transitions?: TransitionDefinition[];
149
165
  tools?: string[];
166
+ /** Builtin system skills activated before the agent node's first model turn. */
167
+ initial_skills?: string[];
168
+ /** Execution-time tool denylist for the agent node's child conversation. */
169
+ excluded_tools?: string[];
170
+ /** Process-owned successful-tool phases and completion behavior for this agent node. */
171
+ agent_policy?: ProcessAgentExecutionPolicy;
150
172
  /**
151
173
  * Model id override for this node. If unset, falls back to the process
152
174
  * run's `config.model`, then to the project's default. Useful when a
@@ -0,0 +1,59 @@
1
+ import { describe, expectTypeOf, it } from 'vitest';
2
+ import type { AgentSchedule, CreateSchedulePayload, ScheduleListItem, UpdateSchedulePayload } from './schedule.js';
3
+
4
+ describe('CreateSchedulePayload', () => {
5
+ it('accepts agent schedules without an explicit target', () => {
6
+ expectTypeOf({
7
+ run_as: { mode: 'creator' as const },
8
+ name: 'Weekly report',
9
+ interaction: 'WeeklyReportAgent',
10
+ cron_expression: '0 9 * * MON',
11
+ }).toMatchTypeOf<CreateSchedulePayload>();
12
+ });
13
+
14
+ it('accepts process schedules with context', () => {
15
+ expectTypeOf({
16
+ run_as: { mode: 'creator' as const },
17
+ name: 'Nightly refresh',
18
+ target: 'process' as const,
19
+ process: '68c01a23456789abcdef0123',
20
+ cron_expression: '0 2 * * *',
21
+ context: { collection: 'reports' },
22
+ }).toMatchTypeOf<CreateSchedulePayload>();
23
+ });
24
+
25
+ it('rejects a process schedule without a process definition', () => {
26
+ expectTypeOf({
27
+ run_as: { mode: 'creator' as const },
28
+ name: 'Nightly refresh',
29
+ target: 'process' as const,
30
+ cron_expression: '0 2 * * *',
31
+ }).not.toMatchTypeOf<CreateSchedulePayload>();
32
+ });
33
+ });
34
+
35
+ describe('schedule read models', () => {
36
+ it('report the configuration a process schedule fires with', () => {
37
+ // The gap this closes: execution worked, but nothing read back said what a process schedule
38
+ // ran with, so it could not be inspected or recreated from the API.
39
+ expectTypeOf<AgentSchedule['context']>().toEqualTypeOf<Record<string, unknown> | undefined>();
40
+ expectTypeOf<AgentSchedule['run_type']>().toEqualTypeOf<'programmatic' | 'supervised' | undefined>();
41
+ });
42
+
43
+ it('summarize run_type in a listing but not context', () => {
44
+ // `run_type` is a scalar, like `target`. `context` is caller-sized payload, so it stays out
45
+ // of the summary for the same reason `vars` does.
46
+ expectTypeOf<ScheduleListItem['run_type']>().toEqualTypeOf<'programmatic' | 'supervised' | undefined>();
47
+ expectTypeOf<ScheduleListItem>().not.toHaveProperty('context');
48
+ expectTypeOf<ScheduleListItem>().not.toHaveProperty('vars');
49
+ });
50
+
51
+ it('do not accept execution inputs on update', () => {
52
+ // These are fixed in the scheduler at creation and update does not re-publish the job
53
+ // specification, so accepting them would record a change that never takes effect.
54
+ expectTypeOf<UpdateSchedulePayload>().not.toHaveProperty('context');
55
+ expectTypeOf<UpdateSchedulePayload>().not.toHaveProperty('run_type');
56
+ expectTypeOf<UpdateSchedulePayload>().not.toHaveProperty('process');
57
+ expectTypeOf<UpdateSchedulePayload>().not.toHaveProperty('interaction');
58
+ });
59
+ });
@@ -1,14 +1,24 @@
1
1
  /**
2
- * Agent Schedule Types
2
+ * Schedule Types
3
3
  *
4
- * Defines types for scheduling agents to run on a recurring basis using cron expressions.
4
+ * Defines types for scheduling agents or processes to run on a recurring basis using cron expressions.
5
5
  * Schedules are stored in MongoDB with execution handled by Temporal.
6
6
  */
7
7
 
8
+ import type { ProcessRunType } from './agent-run.js';
9
+
8
10
  /**
9
11
  * Represents a scheduled agent execution configuration.
10
12
  */
13
+ export type ScheduleRunAs = { mode: 'creator' } | { mode: 'user'; user_id: string };
14
+
11
15
  export interface AgentSchedule {
16
+ owner?: string;
17
+ run_as?: ScheduleRunAs;
18
+ visibility?: 'project' | 'private';
19
+ delegation_grant_id?: string;
20
+ delegation_expires_at?: string | null;
21
+ output_collection_id?: string;
12
22
  /** Unique identifier for the schedule */
13
23
  id: string;
14
24
 
@@ -24,12 +34,30 @@ export interface AgentSchedule {
24
34
  /** Account ID this schedule belongs to */
25
35
  account: string;
26
36
 
37
+ /** The kind of workflow started by the schedule. Older agent schedules may omit this field. */
38
+ target?: 'agent' | 'process';
39
+
27
40
  /** Interaction ID or endpoint name to execute (e.g., "MyAgent" or ObjectId) */
28
- interaction: string;
41
+ interaction?: string;
29
42
 
30
43
  /** Cached interaction name for display purposes */
31
44
  interaction_name?: string;
32
45
 
46
+ /** Process definition ID to execute */
47
+ process?: string;
48
+
49
+ /**
50
+ * Initial process context the schedule fires with, as supplied at creation. Process schedules
51
+ * only; the agent equivalent is `vars`.
52
+ */
53
+ context?: Record<string, unknown>;
54
+
55
+ /**
56
+ * Process execution mode the schedule fires with. Process schedules only. Absent on schedules
57
+ * created before this field was reported, which run as "programmatic".
58
+ */
59
+ run_type?: ProcessRunType;
60
+
33
61
  /**
34
62
  * Cron expression defining when to run.
35
63
  * Standard 5-field format: minute hour day-of-month month day-of-week
@@ -74,19 +102,16 @@ export interface AgentSchedule {
74
102
  next_run_at?: Date;
75
103
  }
76
104
 
77
- /**
78
- * Payload for creating a new schedule.
79
- */
80
- export interface CreateSchedulePayload {
105
+ interface CreateSchedulePayloadBase {
106
+ run_as: ScheduleRunAs;
107
+ delegation_expires_at?: string | null;
108
+ request_id?: string;
81
109
  /** Human-readable name for the schedule */
82
110
  name: string;
83
111
 
84
112
  /** Optional description of what the schedule does */
85
113
  description?: string;
86
114
 
87
- /** Interaction ID or endpoint name to execute */
88
- interaction: string;
89
-
90
115
  /**
91
116
  * Cron expression defining when to run.
92
117
  * Standard 5-field format: minute hour day-of-month month day-of-week
@@ -96,23 +121,54 @@ export interface CreateSchedulePayload {
96
121
  /** Timezone for the cron expression (defaults to "UTC") */
97
122
  timezone?: string;
98
123
 
99
- /** Variables to pass to the agent workflow */
100
- vars?: Record<string, unknown>;
101
-
102
124
  /** Optional task queue override */
103
125
  task_queue?: string;
104
126
 
105
127
  /** Whether the schedule should be enabled immediately (defaults to true) */
106
128
  enabled?: boolean;
129
+ }
130
+
131
+ /** Payload for creating an agent schedule. */
132
+ export interface CreateAgentSchedulePayload extends CreateSchedulePayloadBase {
133
+ /** Agent schedules are the default for backwards compatibility. */
134
+ target?: 'agent';
135
+
136
+ /** Interaction ID or endpoint name to execute */
137
+ interaction: string;
138
+
139
+ /** Variables to pass to the agent workflow */
140
+ vars?: Record<string, unknown>;
107
141
 
108
142
  /** Visibility of the conversation (defaults to "project") */
109
143
  visibility?: 'project' | 'private';
110
144
  }
111
145
 
146
+ /** Payload for creating a process schedule. */
147
+ export interface CreateProcessSchedulePayload extends CreateSchedulePayloadBase {
148
+ target: 'process';
149
+
150
+ /** Process definition ID to execute */
151
+ process: string;
152
+
153
+ /** Initial process context merged with the definition's initial context */
154
+ context?: Record<string, unknown>;
155
+
156
+ /** Process execution mode (defaults to "programmatic") */
157
+ run_type?: ProcessRunType;
158
+ }
159
+
160
+ /** Payload for creating a new schedule. */
161
+ export type CreateSchedulePayload = CreateAgentSchedulePayload | CreateProcessSchedulePayload;
162
+
112
163
  /**
113
164
  * Payload for updating an existing schedule.
165
+ *
166
+ * Agent vars and delegation changes re-publish the execution specification. Process context,
167
+ * run_type, and task queues remain fixed at creation.
114
168
  */
115
169
  export interface UpdateSchedulePayload {
170
+ run_as?: ScheduleRunAs;
171
+ delegation_expires_at?: string | null;
116
172
  /** Updated name */
117
173
  name?: string;
118
174
 
@@ -138,20 +194,28 @@ export interface UpdateSchedulePayload {
138
194
  /**
139
195
  * Summary information for listing schedules.
140
196
  */
141
- export interface ScheduleListItem {
142
- id: string;
143
- name: string;
144
- description?: string;
145
- interaction: string;
146
- interaction_name?: string;
147
- cron_expression: string;
148
- timezone?: string;
149
- enabled: boolean;
150
- last_run_at?: Date;
151
- next_run_at?: Date;
152
- created_by: string;
153
- updated_at: Date;
154
- }
197
+ export type ScheduleListItem = Pick<
198
+ AgentSchedule,
199
+ | 'owner'
200
+ | 'run_as'
201
+ | 'delegation_grant_id'
202
+ | 'delegation_expires_at'
203
+ | 'id'
204
+ | 'name'
205
+ | 'description'
206
+ | 'target'
207
+ | 'process'
208
+ | 'run_type'
209
+ | 'interaction'
210
+ | 'interaction_name'
211
+ | 'cron_expression'
212
+ | 'timezone'
213
+ | 'enabled'
214
+ | 'last_run_at'
215
+ | 'next_run_at'
216
+ | 'created_by'
217
+ | 'updated_at'
218
+ >;
155
219
 
156
220
  /**
157
221
  * Extended schedule information including Temporal execution details.
@@ -62,6 +62,8 @@ export interface Queue {
62
62
  export type WorkflowAncestor = z.infer<typeof WorkflowAncestorSchema>;
63
63
 
64
64
  export interface WorkflowExecutionBaseParams<T = Record<string, unknown>> {
65
+ /** Effective principal for private scheduled runs; server supplied. */
66
+ subject?: string;
65
67
  /**
66
68
  * The ref of the user who initiated the workflow.
67
69
  */