@vertesia/common 1.5.0 → 1.6.0-dev.20260918.061604Z

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 (179) hide show
  1. package/lib/access-control-values.d.ts +13 -0
  2. package/lib/access-control-values.d.ts.map +1 -1
  3. package/lib/access-control-values.js +24 -0
  4. package/lib/access-control-values.js.map +1 -1
  5. package/lib/api-contract/components.generated.json +4446 -2194
  6. package/lib/api-schemas/account.d.ts +3 -10
  7. package/lib/api-schemas/account.d.ts.map +1 -1
  8. package/lib/api-schemas/account.js +5 -9
  9. package/lib/api-schemas/account.js.map +1 -1
  10. package/lib/api-schemas/adapter.d.ts.map +1 -1
  11. package/lib/api-schemas/adapter.js +8 -1
  12. package/lib/api-schemas/adapter.js.map +1 -1
  13. package/lib/api-schemas/agent-communication.d.ts +1 -0
  14. package/lib/api-schemas/agent-communication.d.ts.map +1 -1
  15. package/lib/api-schemas/agent-communication.js +6 -0
  16. package/lib/api-schemas/agent-communication.js.map +1 -1
  17. package/lib/api-schemas/agent-runs.d.ts +5286 -903
  18. package/lib/api-schemas/agent-runs.d.ts.map +1 -1
  19. package/lib/api-schemas/agent-runs.js +366 -1
  20. package/lib/api-schemas/agent-runs.js.map +1 -1
  21. package/lib/api-schemas/apikey.d.ts +55 -0
  22. package/lib/api-schemas/apikey.d.ts.map +1 -1
  23. package/lib/api-schemas/apikey.js +30 -0
  24. package/lib/api-schemas/apikey.js.map +1 -1
  25. package/lib/api-schemas/app-runtime.d.ts +1240 -22
  26. package/lib/api-schemas/app-runtime.d.ts.map +1 -1
  27. package/lib/api-schemas/content.d.ts +435 -0
  28. package/lib/api-schemas/content.d.ts.map +1 -1
  29. package/lib/api-schemas/delegation.d.ts +35 -0
  30. package/lib/api-schemas/delegation.d.ts.map +1 -0
  31. package/lib/api-schemas/delegation.js +21 -0
  32. package/lib/api-schemas/delegation.js.map +1 -0
  33. package/lib/api-schemas/document-processing.d.ts +261 -0
  34. package/lib/api-schemas/document-processing.d.ts.map +1 -1
  35. package/lib/api-schemas/emit-json-schema.d.ts +5 -0
  36. package/lib/api-schemas/emit-json-schema.d.ts.map +1 -0
  37. package/lib/api-schemas/emit-json-schema.js +37 -0
  38. package/lib/api-schemas/emit-json-schema.js.map +1 -0
  39. package/lib/api-schemas/environment.d.ts +18 -0
  40. package/lib/api-schemas/environment.d.ts.map +1 -1
  41. package/lib/api-schemas/events.d.ts +783 -0
  42. package/lib/api-schemas/events.d.ts.map +1 -1
  43. package/lib/api-schemas/index.d.ts +1 -0
  44. package/lib/api-schemas/index.d.ts.map +1 -1
  45. package/lib/api-schemas/index.js +1 -0
  46. package/lib/api-schemas/index.js.map +1 -1
  47. package/lib/api-schemas/interaction.d.ts +3939 -91
  48. package/lib/api-schemas/interaction.d.ts.map +1 -1
  49. package/lib/api-schemas/interaction.js +14 -3
  50. package/lib/api-schemas/interaction.js.map +1 -1
  51. package/lib/api-schemas/oauth-server.d.ts +1 -0
  52. package/lib/api-schemas/oauth-server.d.ts.map +1 -1
  53. package/lib/api-schemas/oauth-server.js +3 -0
  54. package/lib/api-schemas/oauth-server.js.map +1 -1
  55. package/lib/api-schemas/process-agent-policy.d.ts +69 -0
  56. package/lib/api-schemas/process-agent-policy.d.ts.map +1 -0
  57. package/lib/api-schemas/process-agent-policy.js +154 -0
  58. package/lib/api-schemas/process-agent-policy.js.map +1 -0
  59. package/lib/api-schemas/process.d.ts +1260 -0
  60. package/lib/api-schemas/process.d.ts.map +1 -1
  61. package/lib/api-schemas/process.js +29 -1
  62. package/lib/api-schemas/process.js.map +1 -1
  63. package/lib/api-schemas/project-configuration.d.ts +883 -8
  64. package/lib/api-schemas/project-configuration.d.ts.map +1 -1
  65. package/lib/api-schemas/project-configuration.js +3 -2
  66. package/lib/api-schemas/project-configuration.js.map +1 -1
  67. package/lib/api-schemas/project.d.ts +1330 -22
  68. package/lib/api-schemas/project.d.ts.map +1 -1
  69. package/lib/api-schemas/registry.d.ts +24347 -5694
  70. package/lib/api-schemas/registry.d.ts.map +1 -1
  71. package/lib/api-schemas/registry.js +50 -8
  72. package/lib/api-schemas/registry.js.map +1 -1
  73. package/lib/api-schemas/store.d.ts +4427 -77
  74. package/lib/api-schemas/store.d.ts.map +1 -1
  75. package/lib/api-schemas/sts.d.ts +6 -0
  76. package/lib/api-schemas/sts.d.ts.map +1 -1
  77. package/lib/api-schemas/sts.js +3 -0
  78. package/lib/api-schemas/sts.js.map +1 -1
  79. package/lib/api-schemas/workflow-runs.d.ts +189 -0
  80. package/lib/api-schemas/workflow-runs.d.ts.map +1 -1
  81. package/lib/api-schemas/workflow-runs.js +14 -0
  82. package/lib/api-schemas/workflow-runs.js.map +1 -1
  83. package/lib/apikey.d.ts +8 -0
  84. package/lib/apikey.d.ts.map +1 -1
  85. package/lib/apikey.js.map +1 -1
  86. package/lib/delegation.d.ts +13 -0
  87. package/lib/delegation.d.ts.map +1 -0
  88. package/lib/delegation.js +2 -0
  89. package/lib/delegation.js.map +1 -0
  90. package/lib/environment.d.ts +1 -0
  91. package/lib/environment.d.ts.map +1 -1
  92. package/lib/index.d.ts +1 -0
  93. package/lib/index.d.ts.map +1 -1
  94. package/lib/index.js.map +1 -1
  95. package/lib/oauth-scopes.d.ts.map +1 -1
  96. package/lib/oauth-scopes.js +3 -1
  97. package/lib/oauth-scopes.js.map +1 -1
  98. package/lib/project-values.d.ts +1 -0
  99. package/lib/project-values.d.ts.map +1 -1
  100. package/lib/project-values.js +1 -0
  101. package/lib/project-values.js.map +1 -1
  102. package/lib/store/agent-run-values.d.ts +25 -0
  103. package/lib/store/agent-run-values.d.ts.map +1 -0
  104. package/lib/store/agent-run-values.js +25 -0
  105. package/lib/store/agent-run-values.js.map +1 -0
  106. package/lib/store/agent-run.d.ts +22 -2
  107. package/lib/store/agent-run.d.ts.map +1 -1
  108. package/lib/store/agent-run.js +1 -1
  109. package/lib/store/agent-run.js.map +1 -1
  110. package/lib/store/conversation-state.d.ts +1 -1
  111. package/lib/store/conversation-state.d.ts.map +1 -1
  112. package/lib/store/intake-policy-schema.generated.d.ts.map +1 -1
  113. package/lib/store/intake-policy-schema.generated.js +124 -0
  114. package/lib/store/intake-policy-schema.generated.js.map +1 -1
  115. package/lib/store/process.d.ts +17 -0
  116. package/lib/store/process.d.ts.map +1 -1
  117. package/lib/store/process.js.map +1 -1
  118. package/lib/store/schedule.d.ts +62 -25
  119. package/lib/store/schedule.d.ts.map +1 -1
  120. package/lib/store/schedule.js +2 -2
  121. package/lib/store/schedule.js.map +1 -1
  122. package/lib/store/workflow.d.ts +2 -0
  123. package/lib/store/workflow.d.ts.map +1 -1
  124. package/lib/store/workflow.js.map +1 -1
  125. package/lib/vertesia-common.js +2 -2
  126. package/lib/vertesia-common.js.map +1 -1
  127. package/lib/workflow-analytics.d.ts +230 -2
  128. package/lib/workflow-analytics.d.ts.map +1 -1
  129. package/lib/workflow-analytics.js +8 -0
  130. package/lib/workflow-analytics.js.map +1 -1
  131. package/package.json +8 -8
  132. package/src/access-control-values.ts +26 -0
  133. package/src/api-contract/components.contract.test.ts +2 -2
  134. package/src/api-contract/components.generated.json +4446 -2194
  135. package/src/api-schemas/account-apikey.test.ts +60 -0
  136. package/src/api-schemas/account.contract.test.ts +2 -1
  137. package/src/api-schemas/account.ts +5 -9
  138. package/src/api-schemas/adapter-edge-cases.test.ts +19 -0
  139. package/src/api-schemas/adapter.ts +8 -1
  140. package/src/api-schemas/agent-communication.ts +6 -0
  141. package/src/api-schemas/agent-history.contract.test.ts +42 -0
  142. package/src/api-schemas/agent-runs.contract.test.ts +240 -0
  143. package/src/api-schemas/agent-runs.ts +399 -0
  144. package/src/api-schemas/apikey.ts +31 -0
  145. package/src/api-schemas/bundle-isolation.test.ts +5 -41
  146. package/src/api-schemas/delegation.ts +21 -0
  147. package/src/api-schemas/emit-json-schema.test.ts +36 -0
  148. package/src/api-schemas/emit-json-schema.ts +40 -0
  149. package/src/api-schemas/environment.contract.test.ts +3 -0
  150. package/src/api-schemas/index.ts +1 -0
  151. package/src/api-schemas/interaction.contract.test.ts +23 -0
  152. package/src/api-schemas/interaction.ts +15 -3
  153. package/src/api-schemas/llumiverse.contract.test.ts +3 -9
  154. package/src/api-schemas/oauth-server.ts +4 -0
  155. package/src/api-schemas/process-agent-policy.ts +167 -0
  156. package/src/api-schemas/process.contract.test.ts +115 -0
  157. package/src/api-schemas/process.ts +31 -1
  158. package/src/api-schemas/project-configuration.ts +3 -2
  159. package/src/api-schemas/project.contract.test.ts +15 -0
  160. package/src/api-schemas/registry.ts +59 -10
  161. package/src/api-schemas/store.contract.test.ts +4 -126
  162. package/src/api-schemas/sts.ts +3 -0
  163. package/src/api-schemas/workflow-runs.ts +16 -0
  164. package/src/api-schemas/zeno-response-contracts.test.ts +36 -0
  165. package/src/apikey.ts +13 -0
  166. package/src/delegation.ts +18 -0
  167. package/src/index.ts +6 -0
  168. package/src/oauth-scopes.ts +3 -1
  169. package/src/project-values.ts +1 -0
  170. package/src/roles.test.ts +1 -0
  171. package/src/store/agent-run-values.ts +27 -0
  172. package/src/store/agent-run.ts +36 -0
  173. package/src/store/conversation-state.ts +1 -1
  174. package/src/store/intake-policy-schema.generated.ts +125 -0
  175. package/src/store/process.ts +22 -0
  176. package/src/store/schedule.test.ts +59 -0
  177. package/src/store/schedule.ts +91 -27
  178. package/src/store/workflow.ts +2 -0
  179. package/src/workflow-analytics.ts +274 -1
@@ -32,6 +32,9 @@ describe('the provider vocabulary', () => {
32
32
  expect(validateApiRequest('ExecutionEnvironmentCreatePayload', { name: 'e', provider: 'openai' }).valid).toBe(
33
33
  true,
34
34
  );
35
+ expect(
36
+ validateApiRequest('ExecutionEnvironmentCreatePayload', { name: 'router', provider: 'openrouter' }).valid,
37
+ ).toBe(true);
35
38
  expect(validateApiRequest('ExecutionEnvironmentCreatePayload', { name: 'e', provider: 'gpt' }).valid).toBe(
36
39
  false,
37
40
  );
@@ -31,6 +31,7 @@ export * from './integrations.js';
31
31
  export * from './oauth-server.js';
32
32
  export * from './parameters.js';
33
33
  export * from './process.js';
34
+ export * from './process-agent-policy.js';
34
35
  export * from './quota.js';
35
36
  export * from './registry.js';
36
37
  export * from './secrets.js';
@@ -93,6 +93,29 @@ describe('AsyncConversationExecutionPayload contract', () => {
93
93
  });
94
94
  });
95
95
 
96
+ it('accepts Process-authored agent execution policy', () => {
97
+ const payload: AsyncConversationExecutionPayload = {
98
+ type: 'conversation',
99
+ interaction: 'sys:AppDeveloper',
100
+ agent_policy: {
101
+ phases: [
102
+ {
103
+ id: 'saved',
104
+ tools: ['app_workspace_save'],
105
+ tool_input_contains: [{ field: 'mode', contains: 'commit' }],
106
+ recovery_prompt: 'Save before finishing.',
107
+ },
108
+ ],
109
+ phase_resets: [{ tools: ['app_workspace_edit'], to_phase: 'saved' }],
110
+ action_phase_count: 1,
111
+ action_phase_max_tokens: 4_096,
112
+ completion_prompt: 'Return the structured result now.',
113
+ },
114
+ };
115
+
116
+ expect(AsyncConversationExecutionPayloadSchema.parse(payload)).toMatchObject(payload);
117
+ });
118
+
96
119
  it('rejects a non-string app-version target', () => {
97
120
  expect(() =>
98
121
  AsyncConversationExecutionPayloadSchema.parse({
@@ -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(),
@@ -67,11 +67,12 @@ export const ProjectSearchTierSchema = z.enum(['standard', 'performance']).meta(
67
67
  export const ElasticsearchBackendSchema = z.enum(['serverless', 'hosted']).meta({ id: 'ElasticsearchBackend' });
68
68
 
69
69
  export const ProjectSearchPropertyTypeSchema = z
70
- .enum(['keyword', 'text', 'boolean', 'long', 'double', 'date', 'geo_point'])
70
+ .enum(['keyword', 'text', 'boolean', 'long', 'double', 'date', 'geo_point', 'nested'])
71
71
  .meta({
72
72
  id: 'ProjectSearchPropertyType',
73
73
  description:
74
- 'Elasticsearch field types that may be explicitly assigned to content-object properties. Paths are ' +
74
+ 'Elasticsearch field types that may be explicitly assigned to content-object properties. ' +
75
+ 'Declare nested object-array paths with type `nested` and their children as separate dotted paths. Paths are ' +
75
76
  "relative to the object's `properties` field.",
76
77
  });
77
78
 
@@ -253,6 +253,21 @@ describe('gate 2 — the closure is closed, bottom-up', () => {
253
253
  });
254
254
  });
255
255
 
256
+ it('accepts explicit nested paths through the project configuration contract', () => {
257
+ expect(ApiSchemaComponents.ProjectSearchPropertyType.enum).toContain('nested');
258
+ expect(
259
+ validateApiRequest('UpdateProjectConfigurationPayload', {
260
+ indexing: {
261
+ property_mappings: {
262
+ line_items: { type: 'nested' },
263
+ 'line_items.sku': { type: 'keyword' },
264
+ 'line_items.quantity': { type: 'long' },
265
+ },
266
+ },
267
+ }).valid,
268
+ ).toBe(true);
269
+ });
270
+
256
271
  it('publishes geo_point as an explicit project property mapping type', () => {
257
272
  expect(ApiSchemaComponents.ProjectSearchPropertyType.enum).toContain('geo_point');
258
273
  });