@xenosystem/agent-sdk 0.9.21 → 0.9.24

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 (60) hide show
  1. package/README.md +18 -8
  2. package/dist/artifacts/index.cjs +1 -1
  3. package/dist/artifacts/index.js +1 -1
  4. package/dist/automation/index.cjs +16 -3
  5. package/dist/automation/index.d.cts +367 -1
  6. package/dist/automation/index.d.ts +367 -1
  7. package/dist/automation/index.js +16 -3
  8. package/dist/automation/metafile-cjs.json +1 -1
  9. package/dist/automation/metafile-esm.json +1 -1
  10. package/dist/control-plane/index.cjs +1 -1
  11. package/dist/control-plane/index.js +1 -1
  12. package/dist/control-room/index.d.cts +1 -1
  13. package/dist/control-room/index.d.ts +1 -1
  14. package/dist/control-room/metafile-cjs.json +1 -1
  15. package/dist/control-room/metafile-esm.json +1 -1
  16. package/dist/coordination/index.cjs +2 -0
  17. package/dist/coordination/index.d.cts +395 -0
  18. package/dist/coordination/index.d.ts +395 -0
  19. package/dist/coordination/index.js +2 -0
  20. package/dist/coordination/metafile-cjs.json +1 -0
  21. package/dist/coordination/metafile-esm.json +1 -0
  22. package/dist/electron/index.cjs +123 -119
  23. package/dist/electron/index.d.cts +61 -0
  24. package/dist/electron/index.d.ts +61 -0
  25. package/dist/electron/index.js +118 -114
  26. package/dist/electron/metafile-cjs.json +1 -1
  27. package/dist/electron/metafile-esm.json +1 -1
  28. package/dist/governance/index.d.cts +29 -0
  29. package/dist/governance/index.d.ts +29 -0
  30. package/dist/hosted/index.cjs +1 -1
  31. package/dist/hosted/index.js +1 -1
  32. package/dist/hosted/metafile-cjs.json +1 -1
  33. package/dist/hosted/metafile-esm.json +1 -1
  34. package/dist/index.cjs +359 -351
  35. package/dist/index.d.cts +1964 -1254
  36. package/dist/index.d.ts +1964 -1254
  37. package/dist/index.js +359 -351
  38. package/dist/mcp/index.d.cts +28 -0
  39. package/dist/mcp/index.d.ts +28 -0
  40. package/dist/metafile-cjs.json +1 -1
  41. package/dist/metafile-esm.json +1 -1
  42. package/dist/providers/metafile-cjs.json +1 -1
  43. package/dist/providers/metafile-esm.json +1 -1
  44. package/dist/session/index.cjs +56 -54
  45. package/dist/session/index.d.cts +69 -1
  46. package/dist/session/index.d.ts +69 -1
  47. package/dist/session/index.js +56 -54
  48. package/dist/session/metafile-cjs.json +1 -1
  49. package/dist/session/metafile-esm.json +1 -1
  50. package/dist/skills/index.d.cts +28 -0
  51. package/dist/skills/index.d.ts +28 -0
  52. package/dist/ui/index.d.cts +28 -0
  53. package/dist/ui/index.d.ts +28 -0
  54. package/dist/utils/index.cjs +17 -16
  55. package/dist/utils/index.d.cts +31 -1
  56. package/dist/utils/index.d.ts +31 -1
  57. package/dist/utils/index.js +14 -13
  58. package/dist/utils/metafile-cjs.json +1 -1
  59. package/dist/utils/metafile-esm.json +1 -1
  60. package/package.json +6 -1
@@ -0,0 +1,395 @@
1
+ declare const XENO_COORDINATION_SCHEMA_VERSION: 1;
2
+ type XenoGoalStatus = "active" | "paused" | "waiting" | "blocked" | "completed" | "failed" | "cancelled";
3
+ type XenoGoalTaskStatus = "pending" | "ready" | "running" | "blocked" | "failed" | "completed" | "cancelled" | "interrupted";
4
+ interface XenoGoalCriterion {
5
+ id: string;
6
+ description: string;
7
+ required: boolean;
8
+ }
9
+ interface XenoGoalCriterionResult {
10
+ criterionId: string;
11
+ satisfied: boolean;
12
+ evidence: string[];
13
+ reason: string;
14
+ evaluatedAt: string;
15
+ }
16
+ interface XenoGoalVerification {
17
+ status: "pending" | "running" | "passed" | "failed";
18
+ criteria: XenoGoalCriterionResult[];
19
+ evidence: string[];
20
+ summary?: string;
21
+ verifiedAt?: string;
22
+ verifiedBy?: string;
23
+ }
24
+ interface XenoGoalTask {
25
+ id: string;
26
+ milestoneId: string;
27
+ parentTaskId?: string;
28
+ title: string;
29
+ description?: string;
30
+ status: XenoGoalTaskStatus;
31
+ assignedAgentId?: string;
32
+ dependsOn?: string[];
33
+ progress?: string;
34
+ resultEventId?: string;
35
+ createdAt: string;
36
+ updatedAt: string;
37
+ completedAt?: string;
38
+ }
39
+ interface XenoGoalMilestone {
40
+ id: string;
41
+ title: string;
42
+ description?: string;
43
+ status: "pending" | "active" | "blocked" | "completed" | "cancelled";
44
+ taskIds: string[];
45
+ createdAt: string;
46
+ updatedAt: string;
47
+ completedAt?: string;
48
+ }
49
+ interface XenoGoalProgress {
50
+ summary: string;
51
+ currentMilestoneId?: string;
52
+ currentTaskId?: string;
53
+ completedTaskCount: number;
54
+ totalTaskCount: number;
55
+ percent?: number;
56
+ outstanding: string[];
57
+ decisions: string[];
58
+ updatedAt: string;
59
+ }
60
+ interface XenoGoalRecord {
61
+ schemaVersion: typeof XENO_COORDINATION_SCHEMA_VERSION;
62
+ id: string;
63
+ version: number;
64
+ sessionId: string;
65
+ objective: string;
66
+ why?: string;
67
+ successCriteria: XenoGoalCriterion[];
68
+ constraints: string[];
69
+ limits?: {
70
+ maxIterations?: number;
71
+ maxTokens?: number;
72
+ maxWallClockMs?: number;
73
+ };
74
+ metadata: Record<string, string | number | boolean>;
75
+ status: XenoGoalStatus;
76
+ milestones: XenoGoalMilestone[];
77
+ tasks: XenoGoalTask[];
78
+ progress: XenoGoalProgress;
79
+ verification: XenoGoalVerification;
80
+ steering: Array<{
81
+ id: string;
82
+ instruction: string;
83
+ createdAt: string;
84
+ consumedAt?: string;
85
+ }>;
86
+ createdAt: string;
87
+ updatedAt: string;
88
+ completedAt?: string;
89
+ }
90
+ type XenoLoopKind = "agentic-development" | "goal-continuation" | "scheduled";
91
+ type XenoLoopStatus = "running" | "paused" | "waiting" | "stopped" | "completed" | "failed";
92
+ interface XenoLoopSchedule {
93
+ kind: "fixed-interval" | "dynamic";
94
+ intervalMs?: number;
95
+ nextRunAt?: string;
96
+ expiresAt?: string;
97
+ }
98
+ interface XenoLoopIteration {
99
+ number: number;
100
+ startedAt: string;
101
+ completedAt?: string;
102
+ status: "running" | "completed" | "failed" | "interrupted";
103
+ activity: string;
104
+ taskId?: string;
105
+ verificationEventId?: string;
106
+ error?: string;
107
+ }
108
+ interface XenoLoopRecord {
109
+ schemaVersion: typeof XENO_COORDINATION_SCHEMA_VERSION;
110
+ id: string;
111
+ version: number;
112
+ sessionId: string;
113
+ goalId?: string;
114
+ kind: XenoLoopKind;
115
+ status: XenoLoopStatus;
116
+ currentActivity?: string;
117
+ iterations: XenoLoopIteration[];
118
+ schedule?: XenoLoopSchedule;
119
+ stopReason?: string;
120
+ createdAt: string;
121
+ updatedAt: string;
122
+ stoppedAt?: string;
123
+ }
124
+ type XenoHandoffStatus = "prepared" | "available" | "claimed" | "completed" | "failed" | "cancelled";
125
+ interface XenoHandoffOperation {
126
+ operationId: string;
127
+ kind: "tool" | "command" | "build" | "subagent" | "other";
128
+ status: "running" | "completed" | "interrupted";
129
+ sideEffecting: boolean;
130
+ recovery: "waited" | "resume" | "retry" | "manual";
131
+ }
132
+ interface XenoHandoffRecord {
133
+ schemaVersion: typeof XENO_COORDINATION_SCHEMA_VERSION;
134
+ id: string;
135
+ version: number;
136
+ sessionId: string;
137
+ goalId?: string;
138
+ loopId?: string;
139
+ status: XenoHandoffStatus;
140
+ sourceOwnerId: string;
141
+ targetOwnerId?: string;
142
+ claimedBy?: string;
143
+ sourceLeaseEpoch: number;
144
+ targetLeaseEpoch?: number;
145
+ workspace?: string;
146
+ branch?: string;
147
+ currentMilestoneId?: string;
148
+ currentTaskId?: string;
149
+ agentIds: string[];
150
+ operations: XenoHandoffOperation[];
151
+ contextDigest?: string;
152
+ createdAt: string;
153
+ updatedAt: string;
154
+ claimedAt?: string;
155
+ completedAt?: string;
156
+ failedAt?: string;
157
+ failureReason?: string;
158
+ }
159
+ interface XenoExecutionOwner {
160
+ ownerId: string;
161
+ leaseId: string;
162
+ epoch: number;
163
+ acquiredAt: string;
164
+ heartbeatAt: string;
165
+ expiresAt: string;
166
+ processId?: number;
167
+ host?: string;
168
+ }
169
+ type XenoCoordinationEventType = "goal.created" | "goal.updated" | "goal.steered" | "goal.completed" | "goal.cancelled" | "loop.started" | "loop.iteration" | "loop.paused" | "loop.waiting" | "loop.resumed" | "loop.stopped" | "loop.completed" | "loop.failed" | "handoff.created" | "handoff.claimed" | "handoff.completed" | "handoff.failed" | "ownership.acquired" | "ownership.renewed" | "ownership.released";
170
+ interface XenoCoordinationEvent {
171
+ schemaVersion: typeof XENO_COORDINATION_SCHEMA_VERSION;
172
+ id: string;
173
+ sequence: number;
174
+ type: XenoCoordinationEventType;
175
+ sessionId: string;
176
+ goalId?: string;
177
+ loopId?: string;
178
+ handoffId?: string;
179
+ ownerId?: string;
180
+ timestamp: string;
181
+ data: Record<string, unknown>;
182
+ }
183
+ interface XenoCoordinationSessionState {
184
+ schemaVersion: typeof XENO_COORDINATION_SCHEMA_VERSION;
185
+ sessionId: string;
186
+ version: number;
187
+ ownershipEpoch: number;
188
+ owner?: XenoExecutionOwner;
189
+ goals: XenoGoalRecord[];
190
+ loops: XenoLoopRecord[];
191
+ handoffs: XenoHandoffRecord[];
192
+ events: XenoCoordinationEvent[];
193
+ createdAt: string;
194
+ updatedAt: string;
195
+ }
196
+ interface XenoCoordinationStoreOptions {
197
+ rootDirectory?: string;
198
+ now?: () => string;
199
+ idFactory?: (prefix: string) => string;
200
+ ownerLeaseMs?: number;
201
+ lockTimeoutMs?: number;
202
+ lockStaleMs?: number;
203
+ maximumEventsPerSession?: number;
204
+ }
205
+ interface CreateXenoGoalInput {
206
+ sessionId: string;
207
+ objective: string;
208
+ why?: string;
209
+ successCriteria?: Array<string | Omit<XenoGoalCriterion, "id"> & {
210
+ id?: string;
211
+ }>;
212
+ constraints?: string[];
213
+ limits?: XenoGoalRecord["limits"];
214
+ metadata?: Record<string, string | number | boolean>;
215
+ }
216
+ interface CreateXenoHandoffInput {
217
+ sessionId: string;
218
+ sourceOwnerId: string;
219
+ sourceLeaseId: string;
220
+ goalId?: string;
221
+ loopId?: string;
222
+ targetOwnerId?: string;
223
+ workspace?: string;
224
+ branch?: string;
225
+ currentMilestoneId?: string;
226
+ currentTaskId?: string;
227
+ agentIds?: string[];
228
+ operations?: XenoHandoffOperation[];
229
+ contextDigest?: string;
230
+ }
231
+ declare class XenoCoordinationError extends Error {
232
+ readonly code: "INVALID" | "NOT_FOUND" | "CONFLICT" | "NOT_OWNER" | "LEASE_EXPIRED" | "UNSAFE_HANDOFF" | "VERIFICATION_REQUIRED";
233
+ readonly details: Record<string, unknown>;
234
+ constructor(code: "INVALID" | "NOT_FOUND" | "CONFLICT" | "NOT_OWNER" | "LEASE_EXPIRED" | "UNSAFE_HANDOFF" | "VERIFICATION_REQUIRED", message: string, details?: Record<string, unknown>);
235
+ }
236
+ interface UpdateXenoGoalInput {
237
+ objective?: string;
238
+ why?: string;
239
+ constraints?: string[];
240
+ successCriteria?: XenoGoalCriterion[];
241
+ status?: Exclude<XenoGoalStatus, "completed">;
242
+ progress?: Partial<Omit<XenoGoalProgress, "updatedAt">>;
243
+ verification?: XenoGoalVerification;
244
+ metadata?: Record<string, string | number | boolean>;
245
+ }
246
+ interface StartXenoLoopInput {
247
+ sessionId: string;
248
+ goalId?: string;
249
+ kind: XenoLoopKind;
250
+ activity?: string;
251
+ schedule?: XenoLoopSchedule;
252
+ }
253
+ interface ClaimXenoHandoffInput {
254
+ sessionId: string;
255
+ handoffId: string;
256
+ targetOwnerId: string;
257
+ processId?: number;
258
+ host?: string;
259
+ }
260
+ declare class DurableXenoCoordinationStore {
261
+ private readonly rootDirectory;
262
+ private readonly now;
263
+ private readonly idFactory;
264
+ private readonly ownerLeaseMs;
265
+ private readonly lockTimeoutMs;
266
+ private readonly lockStaleMs;
267
+ private readonly maximumEventsPerSession;
268
+ constructor(options?: XenoCoordinationStoreOptions);
269
+ getSessionState(sessionId: string): Promise<XenoCoordinationSessionState>;
270
+ listSessionStates(): Promise<XenoCoordinationSessionState[]>;
271
+ createGoal(input: CreateXenoGoalInput): Promise<XenoGoalRecord>;
272
+ getGoal(sessionId: string, goalId?: string): Promise<XenoGoalRecord | undefined>;
273
+ updateGoal(sessionId: string, goalId: string, expectedVersion: number, update: UpdateXenoGoalInput): Promise<XenoGoalRecord>;
274
+ addMilestone(sessionId: string, goalId: string, expectedVersion: number, input: {
275
+ title: string;
276
+ description?: string;
277
+ }): Promise<XenoGoalRecord>;
278
+ addTask(sessionId: string, goalId: string, expectedVersion: number, input: {
279
+ milestoneId: string;
280
+ parentTaskId?: string;
281
+ title: string;
282
+ description?: string;
283
+ assignedAgentId?: string;
284
+ dependsOn?: string[];
285
+ }): Promise<XenoGoalRecord>;
286
+ updateTask(sessionId: string, goalId: string, taskId: string, expectedVersion: number, update: Pick<XenoGoalTask, "status"> & Partial<Pick<XenoGoalTask, "progress" | "resultEventId" | "assignedAgentId">>): Promise<XenoGoalRecord>;
287
+ steerGoal(sessionId: string, goalId: string, expectedVersion: number, instruction: string): Promise<XenoGoalRecord>;
288
+ consumeGoalSteering(sessionId: string, goalId: string, expectedVersion: number): Promise<{
289
+ goal: XenoGoalRecord;
290
+ instructions: Array<{
291
+ id: string;
292
+ instruction: string;
293
+ createdAt: string;
294
+ }>;
295
+ }>;
296
+ completeGoal(sessionId: string, goalId: string, expectedVersion: number, verification: XenoGoalVerification): Promise<XenoGoalRecord>;
297
+ cancelGoal(sessionId: string, goalId: string, expectedVersion: number, reason: string): Promise<XenoGoalRecord>;
298
+ startLoop(input: StartXenoLoopInput): Promise<XenoLoopRecord>;
299
+ getLoop(sessionId: string, loopId?: string): Promise<XenoLoopRecord | undefined>;
300
+ beginLoopIteration(sessionId: string, loopId: string, expectedVersion: number, activity: string, taskId?: string): Promise<XenoLoopRecord>;
301
+ finishLoopIteration(sessionId: string, loopId: string, expectedVersion: number, result: {
302
+ status: "completed" | "failed" | "interrupted";
303
+ verificationEventId?: string;
304
+ error?: string;
305
+ nextStatus?: Extract<XenoLoopStatus, "running" | "waiting" | "failed">;
306
+ }): Promise<XenoLoopRecord>;
307
+ setLoopStatus(sessionId: string, loopId: string, expectedVersion: number, status: Extract<XenoLoopStatus, "paused" | "running" | "waiting" | "stopped" | "completed" | "failed">, reason?: string): Promise<XenoLoopRecord>;
308
+ acquireOwnership(sessionId: string, ownerId: string, options?: {
309
+ processId?: number;
310
+ host?: string;
311
+ leaseMs?: number;
312
+ }): Promise<XenoExecutionOwner>;
313
+ renewOwnership(sessionId: string, ownerId: string, leaseId: string, leaseMs?: number): Promise<XenoExecutionOwner>;
314
+ releaseOwnership(sessionId: string, ownerId: string, leaseId: string): Promise<XenoExecutionOwner>;
315
+ createHandoff(input: CreateXenoHandoffInput): Promise<XenoHandoffRecord>;
316
+ claimHandoff(input: ClaimXenoHandoffInput): Promise<{
317
+ handoff: XenoHandoffRecord;
318
+ owner: XenoExecutionOwner;
319
+ }>;
320
+ completeHandoff(sessionId: string, handoffId: string, ownerId: string, leaseId: string): Promise<XenoHandoffRecord>;
321
+ failHandoff(sessionId: string, handoffId: string, reason: string): Promise<XenoHandoffRecord>;
322
+ private mutateGoal;
323
+ private mutateLoop;
324
+ private recalculateProgress;
325
+ private requireGoal;
326
+ private requireOwner;
327
+ private assertVersion;
328
+ private newOwner;
329
+ private ownerExpired;
330
+ private appendEvent;
331
+ private mutate;
332
+ private statePath;
333
+ private lockPath;
334
+ private readState;
335
+ private writeState;
336
+ private renameReplacing;
337
+ private withSessionLock;
338
+ private staleLockOwner;
339
+ private quarantineLock;
340
+ }
341
+ type XenoCoordinationAction = "state.get" | "goal.create" | "goal.update" | "goal.complete" | "goal.cancel" | "goal.steer" | "loop.start" | "loop.get" | "loop.begin" | "loop.finish" | "loop.set_status" | "ownership.acquire" | "ownership.renew" | "ownership.release" | "handoff.create" | "handoff.claim" | "handoff.complete" | "handoff.fail";
342
+ interface ExecuteXenoCoordinationActionInput {
343
+ action: XenoCoordinationAction;
344
+ sessionId: string;
345
+ payload?: Record<string, unknown>;
346
+ }
347
+ interface ExecuteXenoCoordinationActionResult {
348
+ action: XenoCoordinationAction;
349
+ sessionId: string;
350
+ result: unknown;
351
+ state: XenoCoordinationSessionState;
352
+ event?: XenoCoordinationEvent;
353
+ }
354
+ declare function executeXenoCoordinationAction(store: DurableXenoCoordinationStore, input: ExecuteXenoCoordinationActionInput): Promise<ExecuteXenoCoordinationActionResult>;
355
+ interface XenoExecutionLeaseSessionOptions {
356
+ store?: DurableXenoCoordinationStore;
357
+ sessionId: string;
358
+ ownerId?: string;
359
+ processId?: number;
360
+ host?: string;
361
+ leaseMs?: number;
362
+ heartbeatMs?: number;
363
+ claimHandoffId?: string;
364
+ onOwnershipLost?: (error: unknown) => void;
365
+ }
366
+ declare class XenoExecutionLeaseSession {
367
+ readonly sessionId: string;
368
+ readonly ownerId: string;
369
+ private readonly store;
370
+ private readonly processId;
371
+ private readonly host;
372
+ private readonly leaseMs;
373
+ private readonly heartbeatMs;
374
+ private readonly claimHandoffId?;
375
+ private readonly onOwnershipLost?;
376
+ private timer?;
377
+ private heartbeatInFlight;
378
+ private owner?;
379
+ private stopped;
380
+ private lostError?;
381
+ private preparedHandoffId?;
382
+ constructor(options: XenoExecutionLeaseSessionOptions);
383
+ get currentOwner(): XenoExecutionOwner | undefined;
384
+ get active(): boolean;
385
+ start(): Promise<XenoExecutionOwner>;
386
+ assertOwned(): Promise<XenoExecutionOwner>;
387
+ private renewHeldLease;
388
+ prepareHandoff(input?: Omit<CreateXenoHandoffInput, "sessionId" | "sourceOwnerId" | "sourceLeaseId">): Promise<XenoHandoffRecord>;
389
+ stop(options?: {
390
+ release?: boolean;
391
+ }): Promise<void>;
392
+ private heartbeat;
393
+ private markLost;
394
+ }
395
+ export { type ClaimXenoHandoffInput, type CreateXenoGoalInput, type CreateXenoHandoffInput, DurableXenoCoordinationStore, type ExecuteXenoCoordinationActionInput, type ExecuteXenoCoordinationActionResult, type StartXenoLoopInput, type UpdateXenoGoalInput, XENO_COORDINATION_SCHEMA_VERSION, type XenoCoordinationAction, XenoCoordinationError, type XenoCoordinationEvent, type XenoCoordinationEventType, type XenoCoordinationSessionState, type XenoCoordinationStoreOptions, XenoExecutionLeaseSession, type XenoExecutionLeaseSessionOptions, type XenoExecutionOwner, type XenoGoalCriterion, type XenoGoalCriterionResult, type XenoGoalMilestone, type XenoGoalProgress, type XenoGoalRecord, type XenoGoalStatus, type XenoGoalTask, type XenoGoalTaskStatus, type XenoGoalVerification, type XenoHandoffOperation, type XenoHandoffRecord, type XenoHandoffStatus, type XenoLoopIteration, type XenoLoopKind, type XenoLoopRecord, type XenoLoopSchedule, type XenoLoopStatus, executeXenoCoordinationAction };