@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
@@ -25,6 +25,7 @@ import { LlmCallType } from '../workflow-analytics.js';
25
25
  import { ProjectRefSchema } from './apikey.js';
26
26
  import { ExecutionEnvironmentRefSchema } from './environment.js';
27
27
  import { AccountRefSchema } from './invites.js';
28
+ import { ProcessAgentExecutionPolicySchema } from './process-agent-policy.js';
28
29
  import { AgentCheckpointConfigurationSchema } from './project-configuration.js';
29
30
  import { EditRevisionSchema, ExpectedEditRevisionSchema } from './schema-primitives.js';
30
31
  import { InteractionExecutionConfigurationSchema, RunDataStorageLevelSchema } from './store.js';
@@ -1392,7 +1393,14 @@ export const GeneratedInteractionDefinitionArraySchema = z
1392
1393
  export const PendingToolApprovalResultsSchema = z
1393
1394
  .strictObject({
1394
1395
  results: z.array(ToolResultSchema),
1395
- reason: z.enum(['denied', 'denied_with_feedback', 'timeout', 'reviewer_denied']),
1396
+ reason: z.enum([
1397
+ 'denied',
1398
+ 'denied_with_feedback',
1399
+ 'timeout',
1400
+ 'reviewer_denied',
1401
+ 'user_interrupted_after_tool_execution',
1402
+ 'user_stopped_after_tool_execution',
1403
+ ]),
1396
1404
  message: z.string(),
1397
1405
  created_at: z.string(),
1398
1406
  })
@@ -1670,7 +1678,7 @@ export const ConversationStateSchema = z
1670
1678
  description: 'Run-scoped, exact-target grants created by "allow this action for this run".',
1671
1679
  }).optional(),
1672
1680
  pending_tool_approval_results: PendingToolApprovalResultsSchema.meta({
1673
- description: 'Buffered tool results held while approval denial pauses until the next user message.',
1681
+ description: 'Buffered tool results held across an interactive pause until the next user message.',
1674
1682
  }).optional(),
1675
1683
  latest_user_message: z
1676
1684
  .string()
@@ -2207,6 +2215,10 @@ export const AsyncConversationExecutionPayloadSchema = z
2207
2215
  'Hard denylist of tool names for this conversation. Excluded tools are never exposed to the model and are refused at execution time, even when a skill or tool refresh would otherwise unlock them. Takes precedence over tool_names, initial_skills, and skill-based tool activation.',
2208
2216
  })
2209
2217
  .optional(),
2218
+ agent_policy: ProcessAgentExecutionPolicySchema.meta({
2219
+ description:
2220
+ 'Process-authored successful-tool phases enforced by this child conversation. Ordinary conversation callers should leave this unset.',
2221
+ }).optional(),
2210
2222
  max_iterations: z
2211
2223
  .number()
2212
2224
  .meta({
@@ -2479,8 +2491,8 @@ export const ExecutionResponseSchema = z
2479
2491
  .strictObject({
2480
2492
  result: z.array(CompletionResultSchema),
2481
2493
  token_usage: ExecutionTokenUsageSchema.optional(),
2482
- prompt_cache_diagnostic: PromptCacheDiagnosticSchema.optional(),
2483
2494
  service_tier: z.string().meta({ description: 'Processing tier actually used by the provider' }).optional(),
2495
+ prompt_cache_diagnostic: PromptCacheDiagnosticSchema.optional(),
2484
2496
  tool_use: z.array(ToolUseSchema).optional(),
2485
2497
  finish_reason: z.string().optional(),
2486
2498
  error: z
@@ -42,6 +42,7 @@ const UNION_MEMBERS = [
42
42
  'BedrockMantleClaudeOptions',
43
43
  'OpenAiThinkingOptions',
44
44
  'OpenAiTextOptions',
45
+ 'OpenRouterTextOptions',
45
46
  'OpenAiDalleOptions',
46
47
  'OpenAiGptImageOptions',
47
48
  'XAIGrokImageOptions',
@@ -95,21 +96,14 @@ describe('the ModelOptions closure is published whole and enforced closed', () =
95
96
  JSON.stringify(validate.errors),
96
97
  ).toBe(true);
97
98
  expect(validate({ _option_id: 'not-a-driver' })).toBe(false);
98
- });
99
-
100
- it('allows provider-specific objects only inside OpenAI-compatible extra_body', () => {
101
- const validate = compile('ModelOptions');
102
99
  expect(
103
100
  validate({
104
101
  _option_id: 'openai-text',
105
- extra_body: {
106
- provider: { sort: 'throughput', allow_fallbacks: false },
107
- baseten: { performance: 'max' },
108
- },
102
+ extra_body: { provider: { sort: 'throughput' }, baseten: { performance: 'max' } },
109
103
  }),
110
104
  JSON.stringify(validate.errors),
111
105
  ).toBe(true);
112
- expect(validate({ _option_id: 'openai-text', extra_body: ['invalid'] })).toBe(false);
106
+ expect(validate({ _option_id: 'openai-text', extra_body: ['not-an-object'] })).toBe(false);
113
107
  });
114
108
 
115
109
  it('accepts Gemini Omni task and resolution options through the run request contract', () => {
@@ -115,6 +115,10 @@ export const OAuthAuthorizationRequestSchema = z
115
115
  .string()
116
116
  .optional()
117
117
  .meta({ description: 'Owning account enforced when restrict_to_owner_account is true.' }),
118
+ consent_required: z.boolean().optional().meta({
119
+ description:
120
+ 'False when the authorization server has determined this client may be approved without showing a consent screen. Absent or true means consent must be collected from the user. Granted scopes are clamped to the user permissions by the server in either case, so this controls only whether the user is prompted.',
121
+ }),
118
122
  status: OAuthAuthorizationRequestStatusSchema,
119
123
  created_at: z.string(),
120
124
  expires_at: z.string(),
@@ -0,0 +1,167 @@
1
+ import { z } from 'zod';
2
+
3
+ export const ProcessAgentToolInputContainsSchema = z
4
+ .strictObject({
5
+ field: z.string().min(1).meta({ description: 'Top-level tool-input field to inspect.' }),
6
+ contains: z.string().min(1).meta({ description: 'Case-sensitive substring required in the string field.' }),
7
+ not_contains: z
8
+ .array(z.string().min(1))
9
+ .min(1)
10
+ .meta({ description: 'Case-sensitive substrings forbidden in the same string field.' })
11
+ .optional(),
12
+ min_length: z
13
+ .number()
14
+ .int()
15
+ .nonnegative()
16
+ .meta({ description: 'Minimum string length required for the same field.' })
17
+ .optional(),
18
+ })
19
+ .meta({ id: 'ProcessAgentToolInputContains' });
20
+
21
+ export const ProcessAgentToolPhaseSchema = z
22
+ .strictObject({
23
+ id: z.string().min(1),
24
+ tools: z
25
+ .array(z.string().min(1))
26
+ .min(1)
27
+ .meta({ description: 'Any successful tool in this list advances the phase.' }),
28
+ continuation_tools: z
29
+ .array(z.string().min(1))
30
+ .min(1)
31
+ .meta({
32
+ description:
33
+ 'Additional tools authorized while the phase is active. Successful calls do not advance the phase.',
34
+ })
35
+ .optional(),
36
+ recovery_tools: z
37
+ .array(z.string().min(1))
38
+ .min(1)
39
+ .meta({
40
+ description:
41
+ 'Additional tools authorized only after a matching phase tool fails. Successful calls do not advance the phase.',
42
+ })
43
+ .optional(),
44
+ tool_input_contains: z
45
+ .array(ProcessAgentToolInputContainsSchema)
46
+ .min(1)
47
+ .meta({
48
+ description:
49
+ 'All declared top-level string-field presence, absence, and minimum-length checks must match before a tool call is authorized or advances the phase.',
50
+ })
51
+ .optional(),
52
+ min_successes: z
53
+ .number()
54
+ .int()
55
+ .positive()
56
+ .meta({ description: 'Successful matching calls required to advance. Defaults to one.' })
57
+ .optional(),
58
+ max_tokens: z
59
+ .number()
60
+ .int()
61
+ .positive()
62
+ .meta({ description: 'Optional output-token ceiling for model turns while this action phase is active.' })
63
+ .optional(),
64
+ recovery_prompt: z.string().min(1).meta({
65
+ description: 'Process-authored instruction used when the agent tries to finish during this phase.',
66
+ }),
67
+ })
68
+ .meta({ id: 'ProcessAgentToolPhase' });
69
+
70
+ export const ProcessAgentPhaseResetSchema = z
71
+ .strictObject({
72
+ tools: z
73
+ .array(z.string().min(1))
74
+ .min(1)
75
+ .meta({ description: 'Successful tools that invalidate later phase progress.' }),
76
+ tool_input_contains: z
77
+ .array(ProcessAgentToolInputContainsSchema)
78
+ .min(1)
79
+ .meta({ description: 'Optional input checks applied to the invalidating tool call.' })
80
+ .optional(),
81
+ to_phase: z.string().min(1).meta({ description: 'Phase id that must be completed next after invalidation.' }),
82
+ })
83
+ .meta({ id: 'ProcessAgentPhaseReset' });
84
+
85
+ export const ProcessAgentExecutionPolicySchema = z
86
+ .strictObject({
87
+ phases: z
88
+ .array(ProcessAgentToolPhaseSchema)
89
+ .min(1)
90
+ .meta({ description: 'Ordered successful-tool phases the agent node must complete.' }),
91
+ phase_resets: z
92
+ .array(ProcessAgentPhaseResetSchema)
93
+ .min(1)
94
+ .meta({
95
+ description:
96
+ 'Successful tool calls that invalidate prior progress and reset execution to a declared phase.',
97
+ })
98
+ .optional(),
99
+ defer_result_schema_until_complete: z
100
+ .boolean()
101
+ .meta({ description: 'Hide the node result schema from model calls until every declared phase completes.' })
102
+ .optional(),
103
+ restrict_to_phase_tools: z
104
+ .boolean()
105
+ .meta({
106
+ description:
107
+ 'Expose one stable union of declared phase tools to the model, and reject tool calls that do not satisfy the current phase. This preserves prompt-cache stability while enforcing ordered execution.',
108
+ })
109
+ .optional(),
110
+ action_phase_count: z
111
+ .number()
112
+ .int()
113
+ .nonnegative()
114
+ .meta({
115
+ description:
116
+ 'Number of leading phases whose model turns require a tool call. Defaults to zero and cannot exceed phases.length.',
117
+ })
118
+ .optional(),
119
+ action_phase_max_tokens: z
120
+ .number()
121
+ .int()
122
+ .positive()
123
+ .meta({ description: 'Maximum output tokens while an action phase is active.' })
124
+ .optional(),
125
+ max_recovery_attempts_per_phase: z
126
+ .number()
127
+ .int()
128
+ .nonnegative()
129
+ .meta({ description: 'Bounded recovery turns allowed per incomplete phase. Defaults to one.' })
130
+ .optional(),
131
+ max_failed_tool_iterations: z
132
+ .number()
133
+ .int()
134
+ .positive()
135
+ .meta({
136
+ description:
137
+ 'Run-wide budget of repeated model iterations containing failed tool results before the agent node stops. The first failing iteration establishes model-visible recovery evidence and is not charged; phase transitions do not reset the budget. Defaults to eight.',
138
+ })
139
+ .optional(),
140
+ max_failed_tool_iterations_per_phase: z
141
+ .number()
142
+ .int()
143
+ .positive()
144
+ .meta({
145
+ description:
146
+ 'Optional per-phase budget of corrective model iterations that still contain failed tool results. The first failure in each phase establishes recovery evidence and is not charged.',
147
+ })
148
+ .optional(),
149
+ max_repeated_tool_failure_iterations: z
150
+ .number()
151
+ .int()
152
+ .positive()
153
+ .meta({
154
+ description:
155
+ 'Optional number of repeated normalized failure fingerprints allowed in one phase before the agent node stops. A value of one stops after the first corrective iteration repeats an already observed cause.',
156
+ })
157
+ .optional(),
158
+ completion_prompt: z
159
+ .string()
160
+ .min(1)
161
+ .meta({
162
+ description:
163
+ 'Process-authored instruction appended to the final successful tool result. That turn restores the result schema and requires the agent to return its result without another tool call.',
164
+ })
165
+ .optional(),
166
+ })
167
+ .meta({ id: 'ProcessAgentExecutionPolicy' });
@@ -0,0 +1,115 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { ProcessRunConfigSchema, RecordProcessRunPayloadSchema } from './process.js';
3
+ import { ProcessAgentExecutionPolicySchema } from './process-agent-policy.js';
4
+
5
+ describe('ProcessRunConfigSchema', () => {
6
+ it('accepts validated LLM execution configuration and retains a strict Process boundary', () => {
7
+ expect(
8
+ ProcessRunConfigSchema.parse({
9
+ environment: 'openrouter-environment',
10
+ model: 'openai/gpt-5.6-sol',
11
+ model_options: { _option_id: 'openrouter-text', service_tier: 'flex' },
12
+ }),
13
+ ).toEqual({
14
+ environment: 'openrouter-environment',
15
+ model: 'openai/gpt-5.6-sol',
16
+ model_options: { _option_id: 'openrouter-text', service_tier: 'flex' },
17
+ });
18
+ expect(() =>
19
+ ProcessRunConfigSchema.parse({ environment: 'openrouter-environment', unexpected: true }),
20
+ ).toThrow();
21
+ });
22
+ });
23
+
24
+ describe('RecordProcessRunPayloadSchema', () => {
25
+ it('accepts schedule metadata for workflow-owned process runs', () => {
26
+ expect(
27
+ RecordProcessRunPayloadSchema.parse({
28
+ workflow_id: 'ProcessRun:scheduled',
29
+ first_workflow_run_id: 'temporal-run',
30
+ run_kind: 'process',
31
+ process_id: '68c01a23456789abcdef0123',
32
+ schedule_id: 'schedule-1',
33
+ type: 'schedule',
34
+ }),
35
+ ).toMatchObject({ schedule_id: 'schedule-1', type: 'schedule' });
36
+ });
37
+ });
38
+
39
+ describe('ProcessAgentExecutionPolicySchema', () => {
40
+ it('accepts cache-stable phase tool enforcement and retains a strict boundary', () => {
41
+ expect(
42
+ ProcessAgentExecutionPolicySchema.parse({
43
+ phases: [
44
+ {
45
+ id: 'inspect',
46
+ tools: ['app_workspace_typecheck'],
47
+ continuation_tools: ['app_workspace_read'],
48
+ recovery_tools: ['app_workspace_read', 'app_workspace_edit'],
49
+ tool_input_contains: [
50
+ {
51
+ field: 'command',
52
+ contains: 'pnpm run test:unit',
53
+ not_contains: ['|'],
54
+ min_length: 18,
55
+ },
56
+ ],
57
+ max_tokens: 12_288,
58
+ recovery_prompt: 'Inspect source.',
59
+ },
60
+ ],
61
+ restrict_to_phase_tools: true,
62
+ max_failed_tool_iterations: 3,
63
+ max_failed_tool_iterations_per_phase: 2,
64
+ max_repeated_tool_failure_iterations: 1,
65
+ }),
66
+ ).toMatchObject({
67
+ phases: [
68
+ {
69
+ tools: ['app_workspace_typecheck'],
70
+ continuation_tools: ['app_workspace_read'],
71
+ recovery_tools: ['app_workspace_read', 'app_workspace_edit'],
72
+ tool_input_contains: [
73
+ {
74
+ field: 'command',
75
+ contains: 'pnpm run test:unit',
76
+ not_contains: ['|'],
77
+ min_length: 18,
78
+ },
79
+ ],
80
+ max_tokens: 12_288,
81
+ },
82
+ ],
83
+ restrict_to_phase_tools: true,
84
+ max_failed_tool_iterations: 3,
85
+ max_failed_tool_iterations_per_phase: 2,
86
+ max_repeated_tool_failure_iterations: 1,
87
+ });
88
+ expect(() =>
89
+ ProcessAgentExecutionPolicySchema.parse({
90
+ phases: [{ id: 'inspect', tools: ['app_workspace_read'], recovery_prompt: 'Inspect source.' }],
91
+ restrict_to_phase_tools: true,
92
+ unexpected: true,
93
+ }),
94
+ ).toThrow();
95
+ expect(() =>
96
+ ProcessAgentExecutionPolicySchema.parse({
97
+ phases: [
98
+ {
99
+ id: 'inspect',
100
+ tools: ['app_workspace_read'],
101
+ tool_input_contains: [{ field: 'path', contains: 'src/', not_contains: [], min_length: -1 }],
102
+ recovery_prompt: 'Inspect source.',
103
+ },
104
+ ],
105
+ }),
106
+ ).toThrow();
107
+ expect(() =>
108
+ ProcessAgentExecutionPolicySchema.parse({
109
+ phases: [{ id: 'inspect', tools: ['app_workspace_read'], recovery_prompt: 'Inspect source.' }],
110
+ max_failed_tool_iterations_per_phase: 0,
111
+ max_repeated_tool_failure_iterations: 0,
112
+ }),
113
+ ).toThrow();
114
+ });
115
+ });
@@ -1,11 +1,13 @@
1
1
  // Runtime schemas for the process API domain.
2
2
 
3
- import { JSONObjectSchema, JSONSchemaSchema } from '@llumiverse/common/schemas';
3
+ import { JSONObjectSchema, JSONSchemaSchema, ModelOptionsSchema } from '@llumiverse/common/schemas';
4
4
  import type { StringValue } from 'ms';
5
5
  import { z } from 'zod';
6
6
  import { PermissionSchema } from './access-control.js';
7
+ import { AgentRunTypeSchema } from './app-lifecycle.js';
7
8
  import { StringValueMapSchema } from './files.js';
8
9
  import { ConversationVisibilitySchema, RunSourceSchema } from './interaction.js';
10
+ import { ProcessAgentExecutionPolicySchema } from './process-agent-policy.js';
9
11
  import { EditRevisionSchema, ExpectedEditRevisionSchema } from './schema-primitives.js';
10
12
  import { TaskFieldSchema } from './task.js';
11
13
 
@@ -176,7 +178,14 @@ export const ProcessDefinitionRevisionInfoSchema = z
176
178
 
177
179
  export const ProcessRunConfigSchema = z
178
180
  .strictObject({
181
+ environment: z
182
+ .string()
183
+ .meta({ description: 'Execution environment id used by Process LLM nodes and the supervisor.' })
184
+ .optional(),
179
185
  model: z.string().optional(),
186
+ model_options: ModelOptionsSchema.meta({
187
+ description: 'Validated model options applied to Process LLM nodes and the supervisor.',
188
+ }).optional(),
180
189
  user_message: z
181
190
  .string()
182
191
  .meta({
@@ -827,6 +836,13 @@ export const NodeDefinitionSchema: z.ZodType = z
827
836
  }).optional(),
828
837
  prompt: z.string().optional(),
829
838
  input: z.looseObject({}).optional(),
839
+ inherit_context: z
840
+ .boolean()
841
+ .meta({
842
+ description:
843
+ 'Whether interaction and custom-agent nodes receive the complete process context in addition to resolved input. Defaults to true; set false for input-only specialist prompts.',
844
+ })
845
+ .optional(),
830
846
  config: z.looseObject({}).optional(),
831
847
  title: z.string().optional(),
832
848
  description: z.string().optional(),
@@ -842,6 +858,18 @@ export const NodeDefinitionSchema: z.ZodType = z
842
858
  max_retries: z.number().optional(),
843
859
  transitions: z.array(TransitionDefinitionSchema).optional(),
844
860
  tools: z.array(z.string()).optional(),
861
+ initial_skills: z
862
+ .array(z.string())
863
+ .meta({ description: "Builtin system skills activated before the agent node's first model turn." })
864
+ .optional(),
865
+ excluded_tools: z
866
+ .array(z.string())
867
+ .meta({ description: "Execution-time tool denylist for the agent node's child conversation." })
868
+ .optional(),
869
+ agent_policy: ProcessAgentExecutionPolicySchema.meta({
870
+ description:
871
+ 'Declarative successful-tool phases and completion behavior for this agent node. The Process owns this policy; the child conversation enforces it generically.',
872
+ }).optional(),
845
873
  model: z
846
874
  .string()
847
875
  .meta({
@@ -958,6 +986,8 @@ export const RecordProcessRunPayloadSchema = z
958
986
  first_workflow_run_id: z.string().optional(),
959
987
  run_kind: z.literal('process'),
960
988
  run_type: ProcessRunTypeSchema.optional(),
989
+ schedule_id: z.string().optional(),
990
+ type: AgentRunTypeSchema.optional(),
961
991
  process_id: z.string().optional(),
962
992
  process_version: z.number().optional(),
963
993
  process_definition: ProcessDefinitionBodySchema.optional(),
@@ -31,7 +31,7 @@ import {
31
31
  ToolUseSchema,
32
32
  VideoResultSchema,
33
33
  } from '@llumiverse/common/schemas';
34
- import { z } from 'zod';
34
+ import type { z } from 'zod';
35
35
  import type {
36
36
  CreateEventSubscriptionPayload,
37
37
  EventDeliveryTarget,
@@ -343,6 +343,7 @@ import {
343
343
  SemanticColumnTypeSchema,
344
344
  UpdateSchemaPayloadSchema,
345
345
  } from './data-store.js';
346
+ import { CreateDelegationGrantPayloadSchema, DelegationGrantArraySchema, DelegationGrantSchema } from './delegation.js';
346
347
  import {
347
348
  DocAnalyzeRunStatusResponseSchema,
348
349
  DocAnalyzerProgressSchema,
@@ -374,6 +375,7 @@ import {
374
375
  EmbeddingsStatusResponseSchema,
375
376
  ProjectConfigurationEmbeddingEnablePayloadSchema,
376
377
  } from './embeddings.js';
378
+ import { emitJsonSchema } from './emit-json-schema.js';
377
379
  import {
378
380
  EnableEnvironmentModelPayloadSchema,
379
381
  ExecutionEnvironmentArraySchema,
@@ -875,8 +877,8 @@ const PROJECT_AND_APP_SCHEMAS = {
875
877
  ProjectConfigurationEmbedding: ProjectConfigurationEmbeddingSchema,
876
878
  BrowserUseProjectConfiguration: BrowserUseProjectConfigurationSchema,
877
879
  ProjectIntakeSniffConfiguration: ProjectIntakeSniffConfigurationSchema,
878
- // Leaves of the Project closure. `ModelOptions` hoists its
879
- // twenty-five driver option sets and four enums; `JSONSchema` hoists `JSONSchemaProperties`.
880
+ // Leaves of the Project closure. `ModelOptions` hoists its driver option sets and shared enums;
881
+ // `JSONSchema` hoists `JSONSchemaProperties`.
880
882
  JSONSchema: JSONSchemaSchema,
881
883
  ModelOptions: ModelOptionsSchema,
882
884
  HttpTimeoutOptions: HttpTimeoutOptionsSchema,
@@ -1786,6 +1788,25 @@ const AGENT_RUN_SCHEMAS = {
1786
1788
  SearchAgentRunsQuery: AgentRunSchemas.SearchAgentRunsQuerySchema,
1787
1789
  StreamAgentRunQuery: AgentRunSchemas.StreamAgentRunQuerySchema,
1788
1790
  UpdateAgentRunStatusPayload: AgentRunSchemas.UpdateAgentRunStatusPayloadSchema,
1791
+ AgentRunFeedbackRating: AgentRunSchemas.AgentRunFeedbackRatingSchema,
1792
+ AgentRunFeedbackReasonCode: AgentRunSchemas.AgentRunFeedbackReasonCodeSchema,
1793
+ AgentRunFeedbackPayload: AgentRunSchemas.AgentRunFeedbackPayloadSchema,
1794
+ AgentRunFeedbackStatus: AgentRunSchemas.AgentRunFeedbackStatusSchema,
1795
+ AgentRunFeedbackCounts: AgentRunSchemas.AgentRunFeedbackCountsSchema,
1796
+ AgentRunFeedbackResponse: AgentRunSchemas.AgentRunFeedbackResponseSchema,
1797
+ AgentRunFeedbackEntry: AgentRunSchemas.AgentRunFeedbackEntrySchema,
1798
+ AgentRunEvaluationRollup: AgentRunSchemas.AgentRunEvaluationRollupSchema,
1799
+ AgentRunJudgeResult: AgentRunSchemas.AgentRunJudgeResultSchema,
1800
+ AgentRunContradictionReason: AgentRunSchemas.AgentRunContradictionReasonSchema,
1801
+ AgentRunEvaluation: AgentRunSchemas.AgentRunEvaluationSchema,
1802
+ TurnTerminalType: AgentRunSchemas.TurnTerminalTypeSchema,
1803
+ EvaluationSeverity: AgentRunSchemas.EvaluationSeveritySchema,
1804
+ TurnEvaluationFlag: AgentRunSchemas.TurnEvaluationFlagSchema,
1805
+ ToolErrorClass: AgentRunSchemas.ToolErrorClassSchema,
1806
+ JudgeGateReason: AgentRunSchemas.JudgeGateReasonSchema,
1807
+ JudgeOutcome: AgentRunSchemas.JudgeOutcomeSchema,
1808
+ JudgeVerdict: AgentRunSchemas.JudgeVerdictSchema,
1809
+ ListAgentRunsEvaluationSeverity: AgentRunSchemas.ListAgentRunsEvaluationSeveritySchema,
1789
1810
  AgentEvent: AgentRunSchemas.AgentEventSchema,
1790
1811
  IngestAgentEventsPayload: AgentRunSchemas.IngestAgentEventsPayloadSchema,
1791
1812
  IngestAgentEventsResponse: AgentRunSchemas.IngestAgentEventsResponseSchema,
@@ -2246,7 +2267,13 @@ const CONTENT_QUERY_SCHEMAS = {
2246
2267
  ContentQueryResult: ContentQuerySchemas.ContentQueryResultSchema,
2247
2268
  } as const satisfies Record<string, z.ZodType>;
2248
2269
 
2270
+ const DELEGATION_SCHEMAS = {
2271
+ CreateDelegationGrantPayload: CreateDelegationGrantPayloadSchema,
2272
+ DelegationGrant: DelegationGrantSchema,
2273
+ DelegationGrantArray: DelegationGrantArraySchema,
2274
+ };
2249
2275
  const API_SCHEMA_GROUPS = [
2276
+ DELEGATION_SCHEMAS,
2250
2277
  IAM_AND_ACCOUNT_SCHEMAS,
2251
2278
  PROJECT_AND_APP_SCHEMAS,
2252
2279
  OAUTH_SCHEMAS,
@@ -2309,7 +2336,8 @@ const API_SCHEMA_GROUPS = [
2309
2336
  * have inferred to. `mergeComponentGroups` rejects a name declared by two groups, so no key is ever
2310
2337
  * intersected with a second schema.
2311
2338
  */
2312
- type ApiSchemaMap = typeof IAM_AND_ACCOUNT_SCHEMAS &
2339
+ type ApiSchemaMap = typeof DELEGATION_SCHEMAS &
2340
+ typeof IAM_AND_ACCOUNT_SCHEMAS &
2313
2341
  typeof PROJECT_AND_APP_SCHEMAS &
2314
2342
  typeof OAUTH_SCHEMAS &
2315
2343
  typeof ENVIRONMENT_SCHEMAS &
@@ -2380,6 +2408,8 @@ const API_SCHEMAS: Readonly<Record<ApiComponentName, z.ZodType>> = mergeComponen
2380
2408
  * objects, so a body carrying an undeclared property is rejected rather than quietly accepted.
2381
2409
  */
2382
2410
  const STRICT_COMPONENTS: ReadonlySet<string> = new Set<string>([
2411
+ 'CreateDelegationGrantPayload',
2412
+ 'DelegationGrant',
2383
2413
  // Process Test Lab request, fixture, and result contracts.
2384
2414
  'ProcessTestVirtualActor',
2385
2415
  'ProcessTestFixtureResult',
@@ -2580,6 +2610,7 @@ const STRICT_COMPONENTS: ReadonlySet<string> = new Set<string>([
2580
2610
  'BedrockMantleClaudeOptions',
2581
2611
  'OpenAiThinkingOptions',
2582
2612
  'OpenAiTextOptions',
2613
+ 'OpenRouterTextOptions',
2583
2614
  'OpenAiDalleOptions',
2584
2615
  'OpenAiGptImageOptions',
2585
2616
  'XAIGrokImageOptions',
@@ -2778,6 +2809,13 @@ const STRICT_COMPONENTS: ReadonlySet<string> = new Set<string>([
2778
2809
  'UpdateAgentArtifactContentResponse',
2779
2810
  'UpdateAgentArtifactContentPayload',
2780
2811
  'TerminateAgentRunResponse',
2812
+ 'AgentRunFeedbackPayload',
2813
+ 'AgentRunFeedbackResponse',
2814
+ 'AgentRunFeedbackCounts',
2815
+ 'AgentRunFeedbackEntry',
2816
+ 'AgentRunEvaluationRollup',
2817
+ 'AgentRunJudgeResult',
2818
+ 'AgentRunEvaluation',
2781
2819
  'StartContentObjectExportResponse',
2782
2820
  'ExportContentObjectsIncludeOptions',
2783
2821
  'ExportContentObjectsFilter',
@@ -3385,12 +3423,7 @@ const STRICT_COMPONENTS: ReadonlySet<string> = new Set<string>([
3385
3423
  * not be used to express contract rules — they would be invisible to both the spec and AJV.
3386
3424
  */
3387
3425
  function emitRawSchemas(): Record<string, unknown> {
3388
- return Object.fromEntries(
3389
- Object.entries(API_SCHEMAS).map(([name, schema]) => [
3390
- name,
3391
- z.toJSONSchema(schema, { target: 'draft-2020-12', io: 'input' }),
3392
- ]),
3393
- );
3426
+ return Object.fromEntries(Object.entries(API_SCHEMAS).map(([name, schema]) => [name, emitJsonSchema(schema)]));
3394
3427
  }
3395
3428
 
3396
3429
  /**
@@ -59,6 +59,9 @@ export const EnvironmentTokenRequestSchema = z
59
59
  export const AgentTokenRequestSchema = z
60
60
  .strictObject({
61
61
  type: z.literal('agent'),
62
+ delegation_grant_id: z.string().optional(),
63
+ delegation_policy_hash: z.string().optional(),
64
+ continuation_token: z.string().optional(),
62
65
  ...baseTokenRequestShape,
63
66
  account_id: z.string(),
64
67
  project_id: z.string(),
@@ -223,11 +223,13 @@ export const PendingActivitySchema = z
223
223
  maximumAttempts: z.number(),
224
224
  lastFailure: z.string().optional(),
225
225
  lastStartedTime: nullableStringSchema,
226
+ lastHeartbeatTime: nullableStringSchema.optional(),
226
227
  })
227
228
  .meta({ id: 'PendingActivity' });
228
229
 
229
230
  export const AgentTaskSchema = z
230
231
  .strictObject({
232
+ history_id: z.string().meta({ description: 'Stable observability row identity across refreshes.' }).optional(),
231
233
  taskType: z
232
234
  .enum(['tool_call', 'llm_call', 'input', 'timer', 'subagent', 'processing', 'signal'])
233
235
  .meta({ description: 'Type discriminator for future task types' }),
@@ -575,6 +577,20 @@ export const WorkflowHistorySchema = z
575
577
  }),
576
578
  z.strictObject({
577
579
  type: z.literal('agent'),
580
+ mode: z
581
+ .enum(['snapshot', 'delta'])
582
+ .meta({
583
+ description:
584
+ 'Snapshot replaces all history; delta replaces returned rows by history_id and retains other rows.',
585
+ })
586
+ .optional(),
587
+ next_from: z
588
+ .string()
589
+ .meta({
590
+ description:
591
+ 'Pass as from on the next refresh with the same options. Absence disables incremental refresh.',
592
+ })
593
+ .optional(),
578
594
  agentTasks: z.array(AgentTaskSchema),
579
595
  }),
580
596
  ])
@@ -341,4 +341,40 @@ describe('Zeno read-side response contracts', () => {
341
341
  ]).valid,
342
342
  ).toBe(true);
343
343
  });
344
+
345
+ it('publishes agent-node launch and execution policy', () => {
346
+ expect(
347
+ validateApiRequest('CreateProcessDefinitionPayload', {
348
+ name: 'App development process',
349
+ definition: {
350
+ format_version: 1,
351
+ process: 'app_development',
352
+ initial: 'implement',
353
+ context: { schema: {}, initial: {} },
354
+ nodes: {
355
+ implement: {
356
+ type: 'agent',
357
+ interaction: 'sys:AppDeveloper',
358
+ inherit_context: false,
359
+ initial_skills: ['app_quick_fix'],
360
+ excluded_tools: ['learn_app_development'],
361
+ agent_policy: {
362
+ phases: [
363
+ {
364
+ id: 'saved',
365
+ tools: ['app_workspace_save'],
366
+ tool_input_contains: [{ field: 'mode', contains: 'commit' }],
367
+ recovery_prompt: 'Save before finishing.',
368
+ },
369
+ ],
370
+ phase_resets: [{ tools: ['app_workspace_edit'], to_phase: 'saved' }],
371
+ defer_result_schema_until_complete: true,
372
+ completion_prompt: 'Return the structured result now.',
373
+ },
374
+ },
375
+ },
376
+ },
377
+ }).valid,
378
+ ).toBe(true);
379
+ });
344
380
  });