@holoscript/engine 6.0.3 → 6.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AutoMesher-CK47F6AV.js +17 -0
- package/dist/GPUBuffers-2LHBCD7X.js +9 -0
- package/dist/WebGPUContext-TNEUYU2Y.js +11 -0
- package/dist/animation/index.cjs +38 -38
- package/dist/animation/index.d.cts +1 -1
- package/dist/animation/index.d.ts +1 -1
- package/dist/animation/index.js +1 -1
- package/dist/audio/index.cjs +16 -6
- package/dist/audio/index.d.cts +1 -1
- package/dist/audio/index.d.ts +1 -1
- package/dist/audio/index.js +1 -1
- package/dist/camera/index.cjs +23 -23
- package/dist/camera/index.d.cts +1 -1
- package/dist/camera/index.d.ts +1 -1
- package/dist/camera/index.js +1 -1
- package/dist/character/index.cjs +6 -4
- package/dist/character/index.js +1 -1
- package/dist/choreography/index.cjs +1194 -0
- package/dist/choreography/index.d.cts +687 -0
- package/dist/choreography/index.d.ts +687 -0
- package/dist/choreography/index.js +1156 -0
- package/dist/chunk-2CSNRI2N.js +217 -0
- package/dist/chunk-33T2WINR.js +266 -0
- package/dist/chunk-35R73OFM.js +1257 -0
- package/dist/chunk-4MMDSUNP.js +1256 -0
- package/dist/chunk-5V6HOU72.js +319 -0
- package/dist/chunk-6QOP6PYF.js +1038 -0
- package/dist/chunk-7KMJVHIL.js +8944 -0
- package/dist/chunk-7VPUC62U.js +1106 -0
- package/dist/chunk-A2Y6RCAT.js +1878 -0
- package/dist/chunk-AHM42MK6.js +8944 -0
- package/dist/chunk-BL7IDTHE.js +218 -0
- package/dist/chunk-CITOMSWL.js +10462 -0
- package/dist/chunk-CXDPKW2K.js +8944 -0
- package/dist/chunk-CXZPLD4S.js +223 -0
- package/dist/chunk-CZYJE7IH.js +5169 -0
- package/dist/chunk-D2OP7YC7.js +6325 -0
- package/dist/chunk-EDRVQHUU.js +1544 -0
- package/dist/chunk-EJSLOOW2.js +3589 -0
- package/dist/chunk-F53SFGW5.js +1878 -0
- package/dist/chunk-HCFPELPY.js +919 -0
- package/dist/chunk-HNEE36PY.js +93 -0
- package/dist/chunk-HYXNV36F.js +1256 -0
- package/dist/chunk-IB7KHVFY.js +821 -0
- package/dist/chunk-IBBO7YYG.js +690 -0
- package/dist/chunk-ILIBGINU.js +5470 -0
- package/dist/chunk-IS4MHLKN.js +5479 -0
- package/dist/chunk-JT2PFKWD.js +5479 -0
- package/dist/chunk-K4CUB4NY.js +1038 -0
- package/dist/chunk-KATDQXRJ.js +10462 -0
- package/dist/chunk-KBQE6ZFJ.js +8944 -0
- package/dist/chunk-KBVD5K7E.js +560 -0
- package/dist/chunk-KCDPVQRY.js +4088 -0
- package/dist/chunk-KN4QJPKN.js +8944 -0
- package/dist/chunk-KWJ3ROSI.js +8944 -0
- package/dist/chunk-L45VF6DD.js +919 -0
- package/dist/chunk-LY4T37YK.js +307 -0
- package/dist/chunk-MDN5WZXA.js +1544 -0
- package/dist/chunk-MGCDP6VU.js +928 -0
- package/dist/chunk-NCX7X6G2.js +8681 -0
- package/dist/chunk-OF54BPVD.js +913 -0
- package/dist/chunk-OWSN2Q3Q.js +690 -0
- package/dist/chunk-PRRB5TTA.js +406 -0
- package/dist/chunk-PXWVQF76.js +4086 -0
- package/dist/chunk-PYCOIDT2.js +812 -0
- package/dist/chunk-PZCSADOV.js +928 -0
- package/dist/chunk-Q2XBVS2K.js +1038 -0
- package/dist/chunk-QDZRXWN5.js +1776 -0
- package/dist/chunk-RNWOZ6WQ.js +913 -0
- package/dist/chunk-ROLFT4CJ.js +1693 -0
- package/dist/chunk-SLTJRZ2N.js +266 -0
- package/dist/chunk-SRUS5XSU.js +4088 -0
- package/dist/chunk-TKCA3WZ5.js +5409 -0
- package/dist/chunk-TNRMXYI2.js +1650 -0
- package/dist/chunk-TQB3GJGM.js +9763 -0
- package/dist/chunk-TUFGXG6K.js +510 -0
- package/dist/chunk-U6KMTGQJ.js +632 -0
- package/dist/chunk-VMGJQST6.js +8681 -0
- package/dist/chunk-X4F4TCG4.js +5470 -0
- package/dist/chunk-ZIFROE75.js +1544 -0
- package/dist/chunk-ZIJQYHSQ.js +1204 -0
- package/dist/combat/index.cjs +4 -4
- package/dist/combat/index.d.cts +1 -1
- package/dist/combat/index.d.ts +1 -1
- package/dist/combat/index.js +1 -1
- package/dist/ecs/index.cjs +1 -1
- package/dist/ecs/index.js +1 -1
- package/dist/environment/index.cjs +14 -14
- package/dist/environment/index.d.cts +1 -1
- package/dist/environment/index.d.ts +1 -1
- package/dist/environment/index.js +1 -1
- package/dist/gpu/index.cjs +4810 -0
- package/dist/gpu/index.js +3714 -0
- package/dist/hologram/index.cjs +27 -1
- package/dist/hologram/index.js +1 -1
- package/dist/index-B2PIsAmR.d.cts +2180 -0
- package/dist/index-B2PIsAmR.d.ts +2180 -0
- package/dist/index-BHySEPX7.d.cts +2921 -0
- package/dist/index-BJV21zuy.d.cts +341 -0
- package/dist/index-BJV21zuy.d.ts +341 -0
- package/dist/index-BQutTphC.d.cts +790 -0
- package/dist/index-ByIq2XrS.d.cts +3910 -0
- package/dist/index-BysHjDSO.d.cts +224 -0
- package/dist/index-BysHjDSO.d.ts +224 -0
- package/dist/index-CKwAJGck.d.ts +455 -0
- package/dist/index-CUl3QstQ.d.cts +3006 -0
- package/dist/index-CUl3QstQ.d.ts +3006 -0
- package/dist/index-CmYtNiI-.d.cts +953 -0
- package/dist/index-CmYtNiI-.d.ts +953 -0
- package/dist/index-CnRzWxi_.d.cts +522 -0
- package/dist/index-CnRzWxi_.d.ts +522 -0
- package/dist/index-CwRWbSC7.d.ts +2921 -0
- package/dist/index-CxKIBstO.d.ts +790 -0
- package/dist/index-DJ6-R8vh.d.cts +455 -0
- package/dist/index-DQKisbcI.d.cts +4968 -0
- package/dist/index-DQKisbcI.d.ts +4968 -0
- package/dist/index-DRT2zJez.d.ts +3910 -0
- package/dist/index-DfNLiAka.d.cts +192 -0
- package/dist/index-DfNLiAka.d.ts +192 -0
- package/dist/index-nMvkoRm8.d.cts +405 -0
- package/dist/index-nMvkoRm8.d.ts +405 -0
- package/dist/index-s9yOFU37.d.cts +604 -0
- package/dist/index-s9yOFU37.d.ts +604 -0
- package/dist/index.cjs +22966 -6960
- package/dist/index.d.cts +864 -20
- package/dist/index.d.ts +864 -20
- package/dist/index.js +3062 -48
- package/dist/input/index.cjs +1 -1
- package/dist/input/index.js +1 -1
- package/dist/orbital/index.cjs +3 -3
- package/dist/orbital/index.d.cts +1 -1
- package/dist/orbital/index.d.ts +1 -1
- package/dist/orbital/index.js +1 -1
- package/dist/particles/index.cjs +16 -16
- package/dist/particles/index.d.cts +1 -1
- package/dist/particles/index.d.ts +1 -1
- package/dist/particles/index.js +1 -1
- package/dist/physics/index.cjs +2377 -21
- package/dist/physics/index.d.cts +1 -1
- package/dist/physics/index.d.ts +1 -1
- package/dist/physics/index.js +35 -1
- package/dist/postfx/index.cjs +3491 -0
- package/dist/postfx/index.js +93 -0
- package/dist/procedural/index.cjs +1 -1
- package/dist/procedural/index.js +1 -1
- package/dist/puppeteer-5VF6KDVO.js +52197 -0
- package/dist/puppeteer-IZVZ3SG4.js +52197 -0
- package/dist/rendering/index.cjs +33 -32
- package/dist/rendering/index.d.cts +1 -1
- package/dist/rendering/index.d.ts +1 -1
- package/dist/rendering/index.js +8 -6
- package/dist/runtime/index.cjs +23 -13
- package/dist/runtime/index.d.cts +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +8 -6
- package/dist/runtime/protocols/index.cjs +349 -0
- package/dist/runtime/protocols/index.js +15 -0
- package/dist/scene/index.cjs +8 -8
- package/dist/scene/index.d.cts +1 -1
- package/dist/scene/index.d.ts +1 -1
- package/dist/scene/index.js +1 -1
- package/dist/shader/index.cjs +3087 -0
- package/dist/shader/index.js +3044 -0
- package/dist/simulation/index.cjs +10680 -0
- package/dist/simulation/index.d.cts +3 -0
- package/dist/simulation/index.d.ts +3 -0
- package/dist/simulation/index.js +307 -0
- package/dist/spatial/index.cjs +2443 -0
- package/dist/spatial/index.d.cts +1545 -0
- package/dist/spatial/index.d.ts +1545 -0
- package/dist/spatial/index.js +2400 -0
- package/dist/terrain/index.cjs +1 -1
- package/dist/terrain/index.d.cts +1 -1
- package/dist/terrain/index.d.ts +1 -1
- package/dist/terrain/index.js +1 -1
- package/dist/transformers.node-4NKAPD5U.js +45620 -0
- package/dist/vm/index.cjs +7 -8
- package/dist/vm/index.d.cts +1 -1
- package/dist/vm/index.d.ts +1 -1
- package/dist/vm/index.js +1 -1
- package/dist/vm-bridge/index.cjs +2 -2
- package/dist/vm-bridge/index.d.cts +2 -2
- package/dist/vm-bridge/index.d.ts +2 -2
- package/dist/vm-bridge/index.js +1 -1
- package/dist/vr/index.cjs +6 -6
- package/dist/vr/index.js +1 -1
- package/dist/world/index.cjs +3 -3
- package/dist/world/index.d.cts +1 -1
- package/dist/world/index.d.ts +1 -1
- package/dist/world/index.js +1 -1
- package/package.json +53 -21
- package/LICENSE +0 -21
|
@@ -0,0 +1,687 @@
|
|
|
1
|
+
import { AgentManifest, CapabilityQuery, AgentRegistry } from '@holoscript/framework/agents';
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @holoscript/core - Choreography Type Definitions
|
|
6
|
+
*
|
|
7
|
+
* Types for multi-agent choreography and orchestration.
|
|
8
|
+
* Part of HoloScript v3.1 Agentic Choreography.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Status of a choreography step
|
|
13
|
+
*/
|
|
14
|
+
type StepStatus = 'pending' | 'waiting' | 'ready' | 'running' | 'paused' | 'completed' | 'failed' | 'skipped' | 'cancelled';
|
|
15
|
+
/**
|
|
16
|
+
* Status of a choreography plan
|
|
17
|
+
*/
|
|
18
|
+
type ChoreographyStatus = 'draft' | 'ready' | 'running' | 'paused' | 'completed' | 'failed' | 'cancelled';
|
|
19
|
+
/**
|
|
20
|
+
* Step retry strategy
|
|
21
|
+
*/
|
|
22
|
+
type RetryStrategy = 'none' | 'immediate' | 'exponential' | 'fixed';
|
|
23
|
+
/**
|
|
24
|
+
* Execution constraint types
|
|
25
|
+
*/
|
|
26
|
+
type ConstraintType = 'timeout' | 'order' | 'concurrency' | 'resource' | 'spatial' | 'trust' | 'custom';
|
|
27
|
+
/**
|
|
28
|
+
* Retry configuration for a step
|
|
29
|
+
*/
|
|
30
|
+
interface RetryConfig {
|
|
31
|
+
/** Retry strategy */
|
|
32
|
+
strategy: RetryStrategy;
|
|
33
|
+
/** Maximum number of retries */
|
|
34
|
+
maxRetries: number;
|
|
35
|
+
/** Delay between retries (ms) */
|
|
36
|
+
delay: number;
|
|
37
|
+
/** Backoff multiplier for exponential strategy */
|
|
38
|
+
backoffMultiplier?: number;
|
|
39
|
+
/** Maximum delay cap */
|
|
40
|
+
maxDelay?: number;
|
|
41
|
+
/** Retry condition (if false, don't retry) */
|
|
42
|
+
condition?: (error: Error, attempt: number) => boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Default retry configuration
|
|
46
|
+
*/
|
|
47
|
+
declare const DEFAULT_RETRY_CONFIG: RetryConfig;
|
|
48
|
+
/**
|
|
49
|
+
* Step input/output definition
|
|
50
|
+
*/
|
|
51
|
+
interface StepIO {
|
|
52
|
+
/** Key name */
|
|
53
|
+
key: string;
|
|
54
|
+
/** Value type */
|
|
55
|
+
type?: string;
|
|
56
|
+
/** Actual value */
|
|
57
|
+
value?: unknown;
|
|
58
|
+
/** Whether required */
|
|
59
|
+
required?: boolean;
|
|
60
|
+
/** Default value */
|
|
61
|
+
default?: unknown;
|
|
62
|
+
/** Source reference (e.g., 'step#generate.outputs.scene') */
|
|
63
|
+
source?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Single step in a choreography
|
|
67
|
+
*/
|
|
68
|
+
interface ChoreographyStep {
|
|
69
|
+
/** Unique step ID */
|
|
70
|
+
id: string;
|
|
71
|
+
/** Human-readable name */
|
|
72
|
+
name?: string;
|
|
73
|
+
/** Description of what this step does */
|
|
74
|
+
description?: string;
|
|
75
|
+
/** Agent ID to execute this step */
|
|
76
|
+
agentId: string;
|
|
77
|
+
/** Action to invoke on the agent */
|
|
78
|
+
action: string;
|
|
79
|
+
/** Input parameters */
|
|
80
|
+
inputs: Record<string, unknown>;
|
|
81
|
+
/** Output definitions */
|
|
82
|
+
outputs: Record<string, StepIO>;
|
|
83
|
+
/** Step IDs this step depends on */
|
|
84
|
+
dependencies: string[];
|
|
85
|
+
/** Current status */
|
|
86
|
+
status: StepStatus;
|
|
87
|
+
/** Timeout in milliseconds */
|
|
88
|
+
timeout?: number;
|
|
89
|
+
/** Retry configuration */
|
|
90
|
+
retry?: Partial<RetryConfig>;
|
|
91
|
+
/** Condition for execution (if false, skip) */
|
|
92
|
+
condition?: string | ((context: StepContext) => boolean);
|
|
93
|
+
/** Whether this is a HITL gate step */
|
|
94
|
+
hitlGate?: boolean;
|
|
95
|
+
/** Started timestamp */
|
|
96
|
+
startedAt?: number;
|
|
97
|
+
/** Completed timestamp */
|
|
98
|
+
completedAt?: number;
|
|
99
|
+
/** Execution duration (ms) */
|
|
100
|
+
duration?: number;
|
|
101
|
+
/** Error if failed */
|
|
102
|
+
error?: string;
|
|
103
|
+
/** Current retry attempt */
|
|
104
|
+
retryAttempt?: number;
|
|
105
|
+
/** ID of step to execute if this step fails */
|
|
106
|
+
fallbackStepId?: string;
|
|
107
|
+
/** Parallel execution group */
|
|
108
|
+
parallelGroup?: string;
|
|
109
|
+
/** Custom metadata */
|
|
110
|
+
metadata?: Record<string, unknown>;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Context available during step execution
|
|
114
|
+
*/
|
|
115
|
+
interface StepContext {
|
|
116
|
+
/** The choreography plan */
|
|
117
|
+
plan: ChoreographyPlan;
|
|
118
|
+
/** Current step */
|
|
119
|
+
currentStep: ChoreographyStep;
|
|
120
|
+
/** Available agents */
|
|
121
|
+
agents: Map<string, AgentManifest>;
|
|
122
|
+
/** Outputs from completed steps */
|
|
123
|
+
stepOutputs: Map<string, Record<string, unknown>>;
|
|
124
|
+
/** Global variables */
|
|
125
|
+
variables: Record<string, unknown>;
|
|
126
|
+
/** Start time */
|
|
127
|
+
startTime: number;
|
|
128
|
+
/** Elapsed time (ms) */
|
|
129
|
+
elapsedTime: number;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Execution constraint
|
|
133
|
+
*/
|
|
134
|
+
interface ExecutionConstraint {
|
|
135
|
+
/** Constraint type */
|
|
136
|
+
type: ConstraintType;
|
|
137
|
+
/** Constraint value */
|
|
138
|
+
value: unknown;
|
|
139
|
+
/** Human-readable description */
|
|
140
|
+
description?: string;
|
|
141
|
+
/** Whether this is a hard constraint (failure on violation) */
|
|
142
|
+
hard?: boolean;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Common constraint factories
|
|
146
|
+
*/
|
|
147
|
+
declare const Constraints: {
|
|
148
|
+
timeout(ms: number, hard?: boolean): ExecutionConstraint;
|
|
149
|
+
concurrency(max: number): ExecutionConstraint;
|
|
150
|
+
trust(minLevel: string): ExecutionConstraint;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Complete choreography plan
|
|
154
|
+
*/
|
|
155
|
+
interface ChoreographyPlan {
|
|
156
|
+
/** Unique plan ID */
|
|
157
|
+
id: string;
|
|
158
|
+
/** Human-readable name */
|
|
159
|
+
name?: string;
|
|
160
|
+
/** Goal description */
|
|
161
|
+
goal: string;
|
|
162
|
+
/** Choreography steps */
|
|
163
|
+
steps: ChoreographyStep[];
|
|
164
|
+
/** Participating agents */
|
|
165
|
+
participants: AgentManifest[];
|
|
166
|
+
/** Execution constraints */
|
|
167
|
+
constraints: ExecutionConstraint[];
|
|
168
|
+
/** Fallback plan on failure */
|
|
169
|
+
fallback?: ChoreographyPlan;
|
|
170
|
+
/** Current status */
|
|
171
|
+
status: ChoreographyStatus;
|
|
172
|
+
/** Creation timestamp */
|
|
173
|
+
createdAt: number;
|
|
174
|
+
/** Started timestamp */
|
|
175
|
+
startedAt?: number;
|
|
176
|
+
/** Completed timestamp */
|
|
177
|
+
completedAt?: number;
|
|
178
|
+
/** Total duration (ms) */
|
|
179
|
+
duration?: number;
|
|
180
|
+
/** Initiating agent or user */
|
|
181
|
+
initiator?: string;
|
|
182
|
+
/** Priority (higher = more important) */
|
|
183
|
+
priority?: number;
|
|
184
|
+
/** Tags for categorization */
|
|
185
|
+
tags?: string[];
|
|
186
|
+
/** Custom metadata */
|
|
187
|
+
metadata?: Record<string, unknown>;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Result of step execution
|
|
191
|
+
*/
|
|
192
|
+
interface StepResult {
|
|
193
|
+
/** Step ID */
|
|
194
|
+
stepId: string;
|
|
195
|
+
/** Success status */
|
|
196
|
+
success: boolean;
|
|
197
|
+
/** Outputs produced */
|
|
198
|
+
outputs: Record<string, unknown>;
|
|
199
|
+
/** Duration (ms) */
|
|
200
|
+
duration: number;
|
|
201
|
+
/** Error message if failed */
|
|
202
|
+
error?: string;
|
|
203
|
+
/** Number of retries attempted */
|
|
204
|
+
retries?: number;
|
|
205
|
+
/** Whether a fallback step was used */
|
|
206
|
+
usedFallback?: boolean;
|
|
207
|
+
/** Metrics */
|
|
208
|
+
metrics?: {
|
|
209
|
+
tokenUsage?: number;
|
|
210
|
+
computeTime?: number;
|
|
211
|
+
networkLatency?: number;
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Result of complete choreography execution
|
|
216
|
+
*/
|
|
217
|
+
interface ChoreographyResult {
|
|
218
|
+
/** Plan ID */
|
|
219
|
+
planId: string;
|
|
220
|
+
/** Overall success */
|
|
221
|
+
success: boolean;
|
|
222
|
+
/** Final status */
|
|
223
|
+
status: ChoreographyStatus;
|
|
224
|
+
/** Individual step results */
|
|
225
|
+
stepResults: StepResult[];
|
|
226
|
+
/** Total duration (ms) */
|
|
227
|
+
duration: number;
|
|
228
|
+
/** Steps completed count */
|
|
229
|
+
stepsCompleted: number;
|
|
230
|
+
/** Steps failed count */
|
|
231
|
+
stepsFailed: number;
|
|
232
|
+
/** Steps skipped count */
|
|
233
|
+
stepsSkipped: number;
|
|
234
|
+
/** Array of completed steps */
|
|
235
|
+
completedSteps?: ChoreographyStep[];
|
|
236
|
+
/** Array of failed steps */
|
|
237
|
+
failedSteps?: ChoreographyStep[];
|
|
238
|
+
/** Error message if failed */
|
|
239
|
+
error?: string;
|
|
240
|
+
/** Final outputs (from terminal steps) */
|
|
241
|
+
finalOutputs: Record<string, unknown>;
|
|
242
|
+
/** Whether fallback was used */
|
|
243
|
+
usedFallback?: boolean;
|
|
244
|
+
/** Aggregate metrics */
|
|
245
|
+
metrics?: {
|
|
246
|
+
totalTokens?: number;
|
|
247
|
+
totalComputeTime?: number;
|
|
248
|
+
peakConcurrency?: number;
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Events emitted by ChoreographyEngine
|
|
253
|
+
*/
|
|
254
|
+
interface ChoreographyEvents {
|
|
255
|
+
'plan:created': (plan: ChoreographyPlan) => void;
|
|
256
|
+
'plan:started': (plan: ChoreographyPlan) => void;
|
|
257
|
+
'plan:completed': (result: ChoreographyResult) => void;
|
|
258
|
+
'plan:failed': (plan: ChoreographyPlan, error: Error) => void;
|
|
259
|
+
'plan:paused': (plan: ChoreographyPlan) => void;
|
|
260
|
+
'plan:resumed': (plan: ChoreographyPlan) => void;
|
|
261
|
+
'plan:cancelled': (plan: ChoreographyPlan) => void;
|
|
262
|
+
'step:started': (step: ChoreographyStep, plan: ChoreographyPlan) => void;
|
|
263
|
+
'step:completed': (result: StepResult, plan: ChoreographyPlan) => void;
|
|
264
|
+
'step:failed': (step: ChoreographyStep, error: Error, plan: ChoreographyPlan) => void;
|
|
265
|
+
'step:retrying': (step: ChoreographyStep, attempt: number, plan: ChoreographyPlan) => void;
|
|
266
|
+
'step:skipped': (step: ChoreographyStep, reason: string, plan: ChoreographyPlan) => void;
|
|
267
|
+
'hitl:required': (step: ChoreographyStep, plan: ChoreographyPlan) => void;
|
|
268
|
+
'hitl:approved': (step: ChoreographyStep, plan: ChoreographyPlan) => void;
|
|
269
|
+
'hitl:rejected': (step: ChoreographyStep, reason: string, plan: ChoreographyPlan) => void;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* @holoscript/core - Step Executor
|
|
274
|
+
*
|
|
275
|
+
* Executes individual choreography steps with retry logic.
|
|
276
|
+
* Part of HoloScript v3.1 Agentic Choreography.
|
|
277
|
+
*/
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Agent action handler signature
|
|
281
|
+
*/
|
|
282
|
+
type ActionHandler = (agent: AgentManifest, action: string, inputs: Record<string, unknown>, context: StepContext) => Promise<Record<string, unknown>>;
|
|
283
|
+
/**
|
|
284
|
+
* Step executor configuration
|
|
285
|
+
*/
|
|
286
|
+
interface StepExecutorConfig {
|
|
287
|
+
/** Default timeout (ms) */
|
|
288
|
+
defaultTimeout: number;
|
|
289
|
+
/** Default retry configuration */
|
|
290
|
+
defaultRetry: RetryConfig;
|
|
291
|
+
/** Whether to emit verbose events */
|
|
292
|
+
verbose: boolean;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Default executor configuration
|
|
296
|
+
*/
|
|
297
|
+
declare const DEFAULT_EXECUTOR_CONFIG: StepExecutorConfig;
|
|
298
|
+
/**
|
|
299
|
+
* Step executor events
|
|
300
|
+
*/
|
|
301
|
+
interface StepExecutorEvents {
|
|
302
|
+
'step:starting': (step: ChoreographyStep) => void;
|
|
303
|
+
'step:inputs:resolved': (step: ChoreographyStep, inputs: Record<string, unknown>) => void;
|
|
304
|
+
'step:executing': (step: ChoreographyStep, agent: AgentManifest) => void;
|
|
305
|
+
'step:completed': (step: ChoreographyStep, result: StepResult) => void;
|
|
306
|
+
'step:failed': (step: ChoreographyStep, error: Error) => void;
|
|
307
|
+
'step:retrying': (step: ChoreographyStep, attempt: number, delay: number) => void;
|
|
308
|
+
'step:timeout': (step: ChoreographyStep, timeout: number) => void;
|
|
309
|
+
'step:skipped': (step: ChoreographyStep, reason: string) => void;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Executes individual choreography steps
|
|
313
|
+
*/
|
|
314
|
+
declare class StepExecutor extends EventEmitter {
|
|
315
|
+
private config;
|
|
316
|
+
private actionHandler;
|
|
317
|
+
private runningSteps;
|
|
318
|
+
constructor(config?: Partial<StepExecutorConfig>);
|
|
319
|
+
/**
|
|
320
|
+
* Register the action handler for executing agent actions
|
|
321
|
+
*/
|
|
322
|
+
setActionHandler(handler: ActionHandler): void;
|
|
323
|
+
/**
|
|
324
|
+
* Execute a single step
|
|
325
|
+
*/
|
|
326
|
+
execute(step: ChoreographyStep, context: StepContext): Promise<StepResult>;
|
|
327
|
+
/**
|
|
328
|
+
* Cancel a running step
|
|
329
|
+
*/
|
|
330
|
+
cancel(stepId: string): boolean;
|
|
331
|
+
/**
|
|
332
|
+
* Check if any steps are running
|
|
333
|
+
*/
|
|
334
|
+
isRunning(stepId?: string): boolean;
|
|
335
|
+
/**
|
|
336
|
+
* Check if step should be skipped
|
|
337
|
+
*/
|
|
338
|
+
private shouldSkip;
|
|
339
|
+
/**
|
|
340
|
+
* Evaluate a string condition
|
|
341
|
+
*/
|
|
342
|
+
private evaluateCondition;
|
|
343
|
+
/**
|
|
344
|
+
* Parse a string value
|
|
345
|
+
*/
|
|
346
|
+
private parseValue;
|
|
347
|
+
/**
|
|
348
|
+
* Resolve input references
|
|
349
|
+
*/
|
|
350
|
+
private resolveInputs;
|
|
351
|
+
/**
|
|
352
|
+
* Execute with timeout
|
|
353
|
+
*/
|
|
354
|
+
private executeWithTimeout;
|
|
355
|
+
/**
|
|
356
|
+
* Calculate retry delay
|
|
357
|
+
*/
|
|
358
|
+
private calculateDelay;
|
|
359
|
+
/**
|
|
360
|
+
* Sleep helper
|
|
361
|
+
*/
|
|
362
|
+
private sleep;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Get default executor
|
|
366
|
+
*/
|
|
367
|
+
declare function getDefaultExecutor(): StepExecutor;
|
|
368
|
+
/**
|
|
369
|
+
* Reset default executor (for testing)
|
|
370
|
+
*/
|
|
371
|
+
declare function resetDefaultExecutor(): void;
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* @holoscript/core - Choreography Planner
|
|
375
|
+
*
|
|
376
|
+
* Creates and validates choreography execution plans.
|
|
377
|
+
* Part of HoloScript v3.1 Agentic Choreography.
|
|
378
|
+
*/
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Step definition for plan builder
|
|
382
|
+
*/
|
|
383
|
+
interface StepDefinition {
|
|
384
|
+
/** Step ID (auto-generated if not provided) */
|
|
385
|
+
id?: string;
|
|
386
|
+
/** Step name */
|
|
387
|
+
name?: string;
|
|
388
|
+
/** Description */
|
|
389
|
+
description?: string;
|
|
390
|
+
/** Agent ID or capability query */
|
|
391
|
+
agent: string | CapabilityQuery;
|
|
392
|
+
/** Action to execute */
|
|
393
|
+
action: string;
|
|
394
|
+
/** Input parameters */
|
|
395
|
+
inputs?: Record<string, unknown>;
|
|
396
|
+
/** Output definitions */
|
|
397
|
+
outputs?: Record<string, StepIO | string>;
|
|
398
|
+
/** Dependencies (step IDs) */
|
|
399
|
+
dependencies?: string[];
|
|
400
|
+
/** Alias for dependencies (step names or IDs) */
|
|
401
|
+
dependsOn?: string[];
|
|
402
|
+
/** Parallel execution group */
|
|
403
|
+
parallelGroup?: string;
|
|
404
|
+
/** Timeout (ms) */
|
|
405
|
+
timeout?: number;
|
|
406
|
+
/** Max retries */
|
|
407
|
+
retries?: number;
|
|
408
|
+
/** Condition expression */
|
|
409
|
+
condition?: string;
|
|
410
|
+
/** Whether this is a HITL gate */
|
|
411
|
+
hitlGate?: boolean;
|
|
412
|
+
/** ID of step to execute if this step fails */
|
|
413
|
+
fallbackStepId?: string;
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Plan definition for planner
|
|
417
|
+
*/
|
|
418
|
+
interface PlanDefinition {
|
|
419
|
+
/** Plan name */
|
|
420
|
+
name?: string;
|
|
421
|
+
/** Goal description */
|
|
422
|
+
goal: string;
|
|
423
|
+
/** Available agents */
|
|
424
|
+
agents: AgentManifest[];
|
|
425
|
+
/** Step definitions */
|
|
426
|
+
steps: StepDefinition[];
|
|
427
|
+
/** Constraints */
|
|
428
|
+
constraints?: ExecutionConstraint[];
|
|
429
|
+
/** Fallback plan */
|
|
430
|
+
fallback?: PlanDefinition;
|
|
431
|
+
/** Priority */
|
|
432
|
+
priority?: number;
|
|
433
|
+
/** Tags */
|
|
434
|
+
tags?: string[];
|
|
435
|
+
/** Custom metadata */
|
|
436
|
+
metadata?: Record<string, unknown>;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Validation result
|
|
440
|
+
*/
|
|
441
|
+
interface PlanValidationResult {
|
|
442
|
+
valid: boolean;
|
|
443
|
+
errors: string[];
|
|
444
|
+
warnings: string[];
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Execution order result
|
|
448
|
+
*/
|
|
449
|
+
interface ExecutionOrder {
|
|
450
|
+
/** Groups of steps that can run in parallel */
|
|
451
|
+
parallelGroups: string[][];
|
|
452
|
+
/** Flat ordered list (topological sort) */
|
|
453
|
+
flatOrder: string[];
|
|
454
|
+
/** Dependency graph */
|
|
455
|
+
graph: Map<string, string[]>;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Creates and validates choreography plans
|
|
459
|
+
*/
|
|
460
|
+
declare class ChoreographyPlanner {
|
|
461
|
+
private matcher;
|
|
462
|
+
/**
|
|
463
|
+
* Create a choreography plan from definition
|
|
464
|
+
*/
|
|
465
|
+
createPlan(definition: PlanDefinition): ChoreographyPlan;
|
|
466
|
+
/**
|
|
467
|
+
* Validate a choreography plan
|
|
468
|
+
*/
|
|
469
|
+
validate(plan: ChoreographyPlan): PlanValidationResult;
|
|
470
|
+
/**
|
|
471
|
+
* Calculate execution order
|
|
472
|
+
*/
|
|
473
|
+
calculateExecutionOrder(plan: ChoreographyPlan): ExecutionOrder;
|
|
474
|
+
/**
|
|
475
|
+
* Clone and reset a plan for re-execution
|
|
476
|
+
*/
|
|
477
|
+
resetPlan(plan: ChoreographyPlan): ChoreographyPlan;
|
|
478
|
+
/**
|
|
479
|
+
* Resolve agent from ID or capability query
|
|
480
|
+
*/
|
|
481
|
+
private resolveAgent;
|
|
482
|
+
/**
|
|
483
|
+
* Detect circular dependencies
|
|
484
|
+
*/
|
|
485
|
+
private detectCycles;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Fluent builder for choreography plans
|
|
489
|
+
*/
|
|
490
|
+
declare class PlanBuilder {
|
|
491
|
+
private definition;
|
|
492
|
+
private planner;
|
|
493
|
+
constructor(goal: string);
|
|
494
|
+
/**
|
|
495
|
+
* Set plan name
|
|
496
|
+
*/
|
|
497
|
+
name(name: string): this;
|
|
498
|
+
/**
|
|
499
|
+
* Add an agent to the plan
|
|
500
|
+
*/
|
|
501
|
+
agent(manifest: AgentManifest): this;
|
|
502
|
+
/**
|
|
503
|
+
* Add multiple agents
|
|
504
|
+
*/
|
|
505
|
+
agents(manifests: AgentManifest[]): this;
|
|
506
|
+
/**
|
|
507
|
+
* Add a step to the plan
|
|
508
|
+
*/
|
|
509
|
+
step(definition: StepDefinition): this;
|
|
510
|
+
/**
|
|
511
|
+
* Add a constraint
|
|
512
|
+
*/
|
|
513
|
+
constraint(constraint: ExecutionConstraint): this;
|
|
514
|
+
/**
|
|
515
|
+
* Set timeout constraint
|
|
516
|
+
*/
|
|
517
|
+
timeout(ms: number): this;
|
|
518
|
+
/**
|
|
519
|
+
* Set concurrency constraint
|
|
520
|
+
*/
|
|
521
|
+
concurrency(max: number): this;
|
|
522
|
+
/**
|
|
523
|
+
* Set fallback plan
|
|
524
|
+
*/
|
|
525
|
+
fallback(fallbackPlan: PlanDefinition): this;
|
|
526
|
+
/**
|
|
527
|
+
* Set priority
|
|
528
|
+
*/
|
|
529
|
+
priority(priority: number): this;
|
|
530
|
+
/**
|
|
531
|
+
* Add tags
|
|
532
|
+
*/
|
|
533
|
+
tags(...tags: string[]): this;
|
|
534
|
+
/**
|
|
535
|
+
* Set metadata
|
|
536
|
+
*/
|
|
537
|
+
metadata(meta: Record<string, unknown>): this;
|
|
538
|
+
/**
|
|
539
|
+
* Build and validate the plan
|
|
540
|
+
*/
|
|
541
|
+
build(): ChoreographyPlan;
|
|
542
|
+
/**
|
|
543
|
+
* Build without validation (for testing)
|
|
544
|
+
*/
|
|
545
|
+
buildUnsafe(): ChoreographyPlan;
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* Create a new plan builder
|
|
549
|
+
*/
|
|
550
|
+
declare function plan(goal: string): PlanBuilder;
|
|
551
|
+
/**
|
|
552
|
+
* Get default planner
|
|
553
|
+
*/
|
|
554
|
+
declare function getDefaultPlanner(): ChoreographyPlanner;
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* @holoscript/core - Choreography Engine
|
|
558
|
+
*
|
|
559
|
+
* Orchestrates multi-agent choreography execution.
|
|
560
|
+
* Part of HoloScript v3.1 Agentic Choreography.
|
|
561
|
+
*/
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Engine configuration
|
|
565
|
+
*/
|
|
566
|
+
interface ChoreographyEngineConfig {
|
|
567
|
+
/** Maximum concurrent step execution */
|
|
568
|
+
maxConcurrency: number;
|
|
569
|
+
/** Default step timeout (ms) */
|
|
570
|
+
defaultTimeout: number;
|
|
571
|
+
/** Whether to execute fallback on failure */
|
|
572
|
+
executeFallback: boolean;
|
|
573
|
+
/** Whether to pause on HITL gates automatically */
|
|
574
|
+
autoHitlPause: boolean;
|
|
575
|
+
/** Verbose logging */
|
|
576
|
+
verbose: boolean;
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* Default engine configuration
|
|
580
|
+
*/
|
|
581
|
+
declare const DEFAULT_ENGINE_CONFIG: ChoreographyEngineConfig;
|
|
582
|
+
/**
|
|
583
|
+
* Main engine for executing choreography plans
|
|
584
|
+
*/
|
|
585
|
+
declare class ChoreographyEngine extends EventEmitter {
|
|
586
|
+
private config;
|
|
587
|
+
private planner;
|
|
588
|
+
private executor;
|
|
589
|
+
private registry;
|
|
590
|
+
private activePlans;
|
|
591
|
+
private actionHandler;
|
|
592
|
+
constructor(config?: Partial<ChoreographyEngineConfig>);
|
|
593
|
+
/**
|
|
594
|
+
* Set the agent registry
|
|
595
|
+
*/
|
|
596
|
+
setRegistry(registry: AgentRegistry): void;
|
|
597
|
+
/**
|
|
598
|
+
* Set the action handler for executing agent actions
|
|
599
|
+
*/
|
|
600
|
+
setActionHandler(handler: ActionHandler): void;
|
|
601
|
+
/**
|
|
602
|
+
* Create a new choreography plan
|
|
603
|
+
*/
|
|
604
|
+
createPlan(goal: string, agents: AgentManifest[], steps: ChoreographyStep[]): ChoreographyPlan;
|
|
605
|
+
/**
|
|
606
|
+
* Execute a choreography plan
|
|
607
|
+
*/
|
|
608
|
+
execute(plan: ChoreographyPlan, variables?: Record<string, unknown>): Promise<ChoreographyResult>;
|
|
609
|
+
/**
|
|
610
|
+
* Pause a running plan
|
|
611
|
+
*/
|
|
612
|
+
pause(planId: string): Promise<void>;
|
|
613
|
+
/**
|
|
614
|
+
* Resume a paused plan
|
|
615
|
+
*/
|
|
616
|
+
resume(planId: string): Promise<void>;
|
|
617
|
+
/**
|
|
618
|
+
* Cancel a running plan
|
|
619
|
+
*/
|
|
620
|
+
cancel(planId: string): Promise<void>;
|
|
621
|
+
/**
|
|
622
|
+
* Approve a HITL gate
|
|
623
|
+
*/
|
|
624
|
+
approveHitl(planId: string, stepId: string): void;
|
|
625
|
+
/**
|
|
626
|
+
* Reject a HITL gate
|
|
627
|
+
*/
|
|
628
|
+
rejectHitl(planId: string, stepId: string, reason: string): void;
|
|
629
|
+
/**
|
|
630
|
+
* Get active plan IDs
|
|
631
|
+
*/
|
|
632
|
+
getActivePlans(): string[];
|
|
633
|
+
/**
|
|
634
|
+
* Get plan status
|
|
635
|
+
*/
|
|
636
|
+
getPlanStatus(planId: string): ChoreographyStatus | null;
|
|
637
|
+
/**
|
|
638
|
+
* Execute the plan
|
|
639
|
+
*/
|
|
640
|
+
private executePlan;
|
|
641
|
+
/**
|
|
642
|
+
* Execute a group of steps (potentially in parallel)
|
|
643
|
+
*/
|
|
644
|
+
private executeGroup;
|
|
645
|
+
/**
|
|
646
|
+
* Execute a single step
|
|
647
|
+
*/
|
|
648
|
+
private executeStep;
|
|
649
|
+
/**
|
|
650
|
+
* Build step context
|
|
651
|
+
*/
|
|
652
|
+
private buildStepContext;
|
|
653
|
+
/**
|
|
654
|
+
* Build final result
|
|
655
|
+
*/
|
|
656
|
+
private buildResult;
|
|
657
|
+
/**
|
|
658
|
+
* Get concurrency limit from constraints
|
|
659
|
+
*/
|
|
660
|
+
private getConcurrencyLimit;
|
|
661
|
+
/**
|
|
662
|
+
* Find plan containing a step
|
|
663
|
+
*/
|
|
664
|
+
private findPlanWithStep;
|
|
665
|
+
/**
|
|
666
|
+
* Generate unique ID
|
|
667
|
+
*/
|
|
668
|
+
private generateId;
|
|
669
|
+
/**
|
|
670
|
+
* Chunk array into batches
|
|
671
|
+
*/
|
|
672
|
+
private chunk;
|
|
673
|
+
/**
|
|
674
|
+
* Sleep helper
|
|
675
|
+
*/
|
|
676
|
+
private sleep;
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Get default choreography engine
|
|
680
|
+
*/
|
|
681
|
+
declare function getDefaultEngine(): ChoreographyEngine;
|
|
682
|
+
/**
|
|
683
|
+
* Reset default engine (for testing)
|
|
684
|
+
*/
|
|
685
|
+
declare function resetDefaultEngine(): void;
|
|
686
|
+
|
|
687
|
+
export { type ActionHandler, ChoreographyEngine, type ChoreographyEngineConfig, type ChoreographyEvents, type ChoreographyPlan, ChoreographyPlanner, type ChoreographyResult, type ChoreographyStatus, type ChoreographyStep, type ConstraintType, Constraints, DEFAULT_ENGINE_CONFIG, DEFAULT_EXECUTOR_CONFIG, DEFAULT_RETRY_CONFIG, type ExecutionConstraint, type ExecutionOrder, PlanBuilder, type PlanDefinition, type PlanValidationResult, type RetryConfig, type RetryStrategy, type StepContext, type StepDefinition, StepExecutor, type StepExecutorConfig, type StepExecutorEvents, type StepIO, type StepResult, type StepStatus, getDefaultEngine, getDefaultExecutor, getDefaultPlanner, plan, resetDefaultEngine, resetDefaultExecutor };
|