@fevex/core 0.1.0-alpha.1 → 0.1.0-alpha.10

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 (56) hide show
  1. package/README.md +771 -13
  2. package/dist/agents/index.d.mts +2 -2
  3. package/dist/agents/index.mjs +1 -1
  4. package/dist/artifacts/index.d.mts +2 -0
  5. package/dist/artifacts/index.mjs +2 -0
  6. package/dist/artifacts-gUzemET7.mjs +440 -0
  7. package/dist/channels/index.d.mts +2 -0
  8. package/dist/channels/index.mjs +192 -0
  9. package/dist/evals/index.d.mts +19 -11
  10. package/dist/evals/index.mjs +125 -122
  11. package/dist/fevex-_KOsOsB8.d.mts +129 -0
  12. package/dist/http/index.d.mts +150 -0
  13. package/dist/http/index.mjs +692 -0
  14. package/dist/index-26ilbzAs.d.mts +50 -0
  15. package/dist/index-B8EcvWeN.d.mts +103 -0
  16. package/dist/index-BEqYWean.d.mts +118 -0
  17. package/dist/index-Btth7rdL.d.mts +58 -0
  18. package/dist/{index-QTkd6a7C.d.mts → index-CFzrvDQ0.d.mts} +4 -3
  19. package/dist/index-CIHWc5V1.d.mts +116 -0
  20. package/dist/index-D7r0puBi.d.mts +64 -0
  21. package/dist/index-DHcfIfh-.d.mts +224 -0
  22. package/dist/index-DUhNa7IR.d.mts +73 -0
  23. package/dist/index-lCCFokc6.d.mts +617 -0
  24. package/dist/index.d.mts +22 -10
  25. package/dist/index.mjs +4178 -671
  26. package/dist/knowledge/index.d.mts +2 -0
  27. package/dist/knowledge/index.mjs +289 -0
  28. package/dist/model-stream-JQdHDDcj.mjs +131 -0
  29. package/dist/models/index.d.mts +2 -46
  30. package/dist/observability/index.d.mts +2 -2
  31. package/dist/policies/index.d.mts +1 -1
  32. package/dist/policies/index.mjs +1 -1
  33. package/dist/run-error-Cr17wPGH.mjs +23 -0
  34. package/dist/{model-stream-u2xMsEaf.mjs → run-support-CmZ6Xo6H.mjs} +41 -130
  35. package/dist/runtime/index.d.mts +2 -2
  36. package/dist/runtime/index.mjs +271 -9
  37. package/dist/sandbox/index.d.mts +2 -0
  38. package/dist/sandbox/index.mjs +147 -0
  39. package/dist/teams/index.d.mts +2 -0
  40. package/dist/teams/index.mjs +2 -0
  41. package/dist/teams-Ctz676G4.mjs +82 -0
  42. package/dist/testing/index.d.mts +39 -9
  43. package/dist/testing/index.mjs +512 -28
  44. package/dist/tools/index.d.mts +3 -3
  45. package/dist/tools/index.mjs +442 -2
  46. package/dist/types-CckDlhYo.d.mts +575 -0
  47. package/dist/workflows/index.d.mts +2 -0
  48. package/dist/workflows/index.mjs +6 -0
  49. package/package.json +31 -3
  50. package/dist/exact-definition-NHBBFlFR.d.mts +0 -4
  51. package/dist/fevex-Dz6GBz9o.d.mts +0 -32
  52. package/dist/index-BzxHfyYV.d.mts +0 -23
  53. package/dist/index-CZGyhNIQ.d.mts +0 -47
  54. package/dist/index-C_Zpr13f.d.mts +0 -124
  55. package/dist/index-DGWOGXzc.d.mts +0 -181
  56. package/dist/index-ojCY3lwm.d.mts +0 -79
@@ -0,0 +1,575 @@
1
+ //#region src/artifacts/artifacts.d.ts
2
+ /** Stable identifier for a stored artifact. */
3
+ type ArtifactId = string;
4
+ /**
5
+ * Small, JSON-serializable reference to a stored artifact.
6
+ *
7
+ * The bytes live in an `ArtifactStore`; runs, events and prompts only carry
8
+ * this descriptor.
9
+ */
10
+ interface ArtifactDescriptor {
11
+ artifactId: ArtifactId;
12
+ /** Stable URI for host and protocol hand-offs, for example `artifact://<id>`. */
13
+ uri: string;
14
+ filename: string;
15
+ mimeType: string;
16
+ size: number;
17
+ sha256: string;
18
+ createdAt: string;
19
+ expiresAt?: string;
20
+ metadata?: JsonObject;
21
+ }
22
+ interface ArtifactWrite {
23
+ filename: string;
24
+ mimeType: string;
25
+ bytes: Uint8Array;
26
+ metadata?: JsonObject;
27
+ expiresAt?: string;
28
+ }
29
+ interface ArtifactContent {
30
+ descriptor: ArtifactDescriptor;
31
+ bytes: Uint8Array;
32
+ }
33
+ /** Scope supplied by the host when reading or writing an artifact. */
34
+ interface ArtifactStoreContext {
35
+ tenantId?: string;
36
+ runId?: string;
37
+ sessionId?: string;
38
+ actor?: ExecutionContext['actor'];
39
+ signal?: AbortSignal;
40
+ }
41
+ /**
42
+ * Durable storage for large or binary outputs.
43
+ *
44
+ * Implementations must never return mutable internal state; callers may mutate
45
+ * the returned descriptor or bytes.
46
+ */
47
+ interface ArtifactStore {
48
+ put(input: ArtifactWrite, context?: ArtifactStoreContext): Promise<ArtifactDescriptor>;
49
+ get(artifactId: ArtifactId, context?: ArtifactStoreContext): Promise<ArtifactContent | null>;
50
+ head?(artifactId: ArtifactId, context?: ArtifactStoreContext): Promise<ArtifactDescriptor | null>;
51
+ delete?(artifactId: ArtifactId, context?: ArtifactStoreContext): Promise<boolean>;
52
+ }
53
+ type ArtifactErrorCode = 'ARTIFACT_INVALID_INPUT' | 'ARTIFACT_TOO_LARGE' | 'ARTIFACT_MIME_UNSUPPORTED' | 'ARTIFACT_INVALID_ID' | 'ARTIFACT_INVALID_CONTEXT' | 'ARTIFACT_CONFLICT' | 'ARTIFACT_CORRUPT';
54
+ declare class ArtifactError extends Error {
55
+ readonly code: ArtifactErrorCode;
56
+ constructor(code: ArtifactErrorCode, message: string);
57
+ }
58
+ /** Metadata record indexed by an `ArtifactCatalog`. */
59
+ interface ArtifactRecord {
60
+ descriptor: ArtifactDescriptor;
61
+ tenantId: string;
62
+ runId?: string;
63
+ sessionId?: string;
64
+ actorId?: string;
65
+ }
66
+ interface ArtifactQuery {
67
+ runId?: string;
68
+ sessionId?: string;
69
+ actorId?: string;
70
+ mimeType?: string;
71
+ /** Include expired artifacts. Defaults to false. */
72
+ includeExpired?: boolean;
73
+ /** Maximum records to return. Defaults to 100 and is capped at 1000. */
74
+ limit?: number;
75
+ }
76
+ /**
77
+ * Queryable metadata index for artifacts.
78
+ *
79
+ * The bytes stay in an `ArtifactStore`; the catalog lets hosts list, authorize
80
+ * and delete by tenant, run, session or actor without scanning object storage.
81
+ */
82
+ interface ArtifactCatalog {
83
+ save(record: ArtifactRecord, context?: ArtifactStoreContext): Promise<void>;
84
+ get(artifactId: ArtifactId, context?: ArtifactStoreContext): Promise<ArtifactRecord | null>;
85
+ list(query?: ArtifactQuery, context?: ArtifactStoreContext): Promise<ArtifactRecord[]>;
86
+ delete(artifactId: ArtifactId, context?: ArtifactStoreContext): Promise<boolean>;
87
+ deleteByRun(runId: string, context?: ArtifactStoreContext): Promise<number>;
88
+ }
89
+ /** Resolves and validates the tenant scope used by stores and catalogs. */
90
+ declare function artifactTenantId(context?: ArtifactStoreContext): string;
91
+ /** Validates an artifact id before using it in a query or storage key. */
92
+ declare function assertArtifactId(artifactId: string): void;
93
+ //#endregion
94
+ //#region src/artifacts/cataloged-artifact-store.d.ts
95
+ interface CatalogedArtifactStoreOptions {
96
+ /** Byte store, for example `FileSystemArtifactStore` or `S3ArtifactStore`. */
97
+ store: ArtifactStore;
98
+ /** Metadata index, for example `SQLiteArtifactCatalog` or `PostgresArtifactCatalog`. */
99
+ catalog: ArtifactCatalog;
100
+ }
101
+ /**
102
+ * Composes a byte store with a queryable metadata catalog.
103
+ *
104
+ * `put` writes bytes first and then indexes metadata. If indexing fails, the
105
+ * bytes are deleted so the catalog never points at a half-written artifact.
106
+ */
107
+ declare class CatalogedArtifactStore implements ArtifactStore {
108
+ #private;
109
+ constructor(options: CatalogedArtifactStoreOptions);
110
+ put(input: ArtifactWrite, context?: ArtifactStoreContext): Promise<ArtifactDescriptor>;
111
+ get(artifactId: ArtifactId, context?: ArtifactStoreContext): Promise<ArtifactContent | null>;
112
+ head(artifactId: ArtifactId, context?: ArtifactStoreContext): Promise<ArtifactDescriptor | null>;
113
+ delete(artifactId: ArtifactId, context?: ArtifactStoreContext): Promise<boolean>;
114
+ list(query?: ArtifactQuery, context?: ArtifactStoreContext): Promise<ArtifactRecord[]>;
115
+ deleteByRun(runId: string, context?: ArtifactStoreContext): Promise<number>;
116
+ }
117
+ //#endregion
118
+ //#region src/artifacts/internal.d.ts
119
+ interface ArtifactStoreLimits {
120
+ maxBytes?: number;
121
+ allowedMimeTypes?: readonly string[];
122
+ retentionMs?: number;
123
+ }
124
+ //#endregion
125
+ //#region src/artifacts/file-system-artifact-store.d.ts
126
+ interface FileSystemArtifactStoreOptions extends ArtifactStoreLimits {
127
+ /** Directory that owns artifact bytes and metadata. */
128
+ rootDir: string;
129
+ }
130
+ /**
131
+ * Local filesystem artifact store.
132
+ *
133
+ * Layout:
134
+ * <rootDir>/tenants/<tenantId>/artifacts/<artifactId>
135
+ * <rootDir>/tenants/<tenantId>/artifacts/<artifactId>.json
136
+ *
137
+ * Bytes are written before metadata, and both use an atomic rename. This is
138
+ * intended for local development and single-node deployments; use
139
+ * `S3ArtifactStore` for multi-instance production.
140
+ */
141
+ declare class FileSystemArtifactStore implements ArtifactStore {
142
+ #private;
143
+ constructor(options: FileSystemArtifactStoreOptions);
144
+ put(input: ArtifactWrite, context?: ArtifactStoreContext): Promise<ArtifactDescriptor>;
145
+ get(artifactId: ArtifactId, context?: ArtifactStoreContext): Promise<ArtifactContent | null>;
146
+ head(artifactId: ArtifactId, context?: ArtifactStoreContext): Promise<ArtifactDescriptor | null>;
147
+ delete(artifactId: ArtifactId, context?: ArtifactStoreContext): Promise<boolean>;
148
+ }
149
+ //#endregion
150
+ //#region src/artifacts/in-memory-artifact-catalog.d.ts
151
+ /** Volatile artifact metadata catalog for tests and local development. */
152
+ declare class InMemoryArtifactCatalog implements ArtifactCatalog {
153
+ #private;
154
+ save(record: ArtifactRecord, context?: ArtifactStoreContext): Promise<void>;
155
+ get(artifactId: ArtifactId, context?: ArtifactStoreContext): Promise<ArtifactRecord | null>;
156
+ list(query?: ArtifactQuery, context?: ArtifactStoreContext): Promise<ArtifactRecord[]>;
157
+ delete(artifactId: ArtifactId, context?: ArtifactStoreContext): Promise<boolean>;
158
+ deleteByRun(runId: string, context?: ArtifactStoreContext): Promise<number>;
159
+ }
160
+ //#endregion
161
+ //#region src/artifacts/in-memory-artifact-store.d.ts
162
+ interface InMemoryArtifactStoreOptions extends ArtifactStoreLimits {}
163
+ /** Volatile artifact store for tests and local development. */
164
+ declare class InMemoryArtifactStore implements ArtifactStore {
165
+ #private;
166
+ constructor(options?: InMemoryArtifactStoreOptions);
167
+ put(input: ArtifactWrite, context?: ArtifactStoreContext): Promise<ArtifactDescriptor>;
168
+ get(artifactId: ArtifactId, context?: ArtifactStoreContext): Promise<ArtifactContent | null>;
169
+ head(artifactId: ArtifactId, context?: ArtifactStoreContext): Promise<ArtifactDescriptor | null>;
170
+ delete(artifactId: ArtifactId, context?: ArtifactStoreContext): Promise<boolean>;
171
+ }
172
+ //#endregion
173
+ //#region src/artifacts/s3-artifact-store.d.ts
174
+ /**
175
+ * Minimal S3-compatible object client.
176
+ *
177
+ * Wrap `@aws-sdk/client-s3`, a Cloudflare R2 client, MinIO or any other
178
+ * S3-compatible SDK with this interface. Fevex does not depend on an object
179
+ * storage SDK.
180
+ */
181
+ interface S3ObjectClient {
182
+ putObject(input: {
183
+ key: string;
184
+ body: Uint8Array;
185
+ contentType: string;
186
+ metadata?: Record<string, string>;
187
+ }): Promise<void>;
188
+ getObject(input: {
189
+ key: string;
190
+ }): Promise<Uint8Array | null>;
191
+ deleteObject(input: {
192
+ key: string;
193
+ }): Promise<void>;
194
+ }
195
+ interface S3ArtifactStoreOptions extends ArtifactStoreLimits {
196
+ client: S3ObjectClient;
197
+ /** Key prefix. Defaults to `fevex`. */
198
+ prefix?: string;
199
+ }
200
+ /**
201
+ * Artifact store for S3-compatible object storage (S3, R2, MinIO, GCS via an
202
+ * S3 gateway, and similar).
203
+ *
204
+ * Bytes are stored at `<prefix>/<tenant>/artifacts/<artifactId>` and metadata
205
+ * in a `.json` sidecar next to them. The bucket should stay private; the host
206
+ * serves downloads through its authenticated API or short-lived signed URLs.
207
+ */
208
+ declare class S3ArtifactStore implements ArtifactStore {
209
+ #private;
210
+ constructor(options: S3ArtifactStoreOptions);
211
+ put(input: ArtifactWrite, context?: ArtifactStoreContext): Promise<ArtifactDescriptor>;
212
+ get(artifactId: ArtifactId, context?: ArtifactStoreContext): Promise<ArtifactContent | null>;
213
+ head(artifactId: ArtifactId, context?: ArtifactStoreContext): Promise<ArtifactDescriptor | null>;
214
+ delete(artifactId: ArtifactId, context?: ArtifactStoreContext): Promise<boolean>;
215
+ }
216
+ //#endregion
217
+ //#region src/core/types.d.ts
218
+ /** A value that can cross provider and persistence boundaries without conversion. */
219
+ type JsonPrimitive = string | number | boolean | null;
220
+ type JsonObject = {
221
+ [key: string]: JsonValue;
222
+ };
223
+ type JsonValue = JsonPrimitive | JsonValue[] | JsonObject;
224
+ type RunId = string;
225
+ declare const SCHEMA_NOT_TRANSPORTABLE = "SCHEMA_NOT_TRANSPORTABLE";
226
+ declare const PROVIDER_SCHEMA_UNSUPPORTED = "PROVIDER_SCHEMA_UNSUPPORTED";
227
+ declare const PROVIDER_REASONING_UNSUPPORTED = "PROVIDER_REASONING_UNSUPPORTED";
228
+ interface ExecutionContext {
229
+ namespace?: string;
230
+ actor?: {
231
+ id: string;
232
+ type?: string;
233
+ };
234
+ attributes?: JsonObject;
235
+ prompt?: JsonObject;
236
+ }
237
+ type AgentMessageRole = 'system' | 'user' | 'assistant' | 'tool';
238
+ interface AgentMessage {
239
+ role: AgentMessageRole;
240
+ content: string;
241
+ name?: string;
242
+ toolCallId?: string;
243
+ toolCalls?: ToolCall[];
244
+ }
245
+ interface ToolSpec {
246
+ name: string;
247
+ description?: string;
248
+ inputSchema?: JsonObject;
249
+ }
250
+ interface ToolCall {
251
+ id: string;
252
+ name: string;
253
+ input: JsonValue;
254
+ }
255
+ interface ToolEventSource {
256
+ kind: 'connection';
257
+ provider: string;
258
+ connectionName: string;
259
+ remoteToolName: string;
260
+ }
261
+ type AgentEventType = 'run.started' | 'run.recovered' | 'run.paused' | 'run.resumed' | 'model.started' | 'model.output.delta' | 'model.completed' | 'context.compacted' | 'tool.started' | 'tool.completed' | 'tool.failed' | 'tool.retrying' | 'tool.execution_unknown' | 'artifact.created' | 'elicitation.requested' | 'elicitation.resolved' | 'approval.requested' | 'approval.resolved' | 'run.completed' | 'run.failed' | 'run.cancelled' | 'workflow.run.started' | 'workflow.run.recovered' | 'workflow.step.started' | 'workflow.step.completed' | 'workflow.step.failed' | 'workflow.compensation.started' | 'workflow.compensation.completed' | 'workflow.compensation.failed' | 'workflow.wait.started' | 'workflow.wait.completed' | 'workflow.run.paused' | 'workflow.run.resumed' | 'workflow.run.completed' | 'workflow.run.failed' | 'workflow.run.cancelled' | 'team.run.started' | 'team.run.recovered' | 'team.agent.assigned' | 'team.handoff.created' | 'team.task.completed' | 'team.task.failed' | 'team.merge.started' | 'team.merge.completed' | 'team.merge.failed' | 'team.run.paused' | 'team.run.resumed' | 'team.run.completed' | 'team.run.failed' | 'team.run.cancelled';
262
+ interface AgentEventPayloads {
263
+ 'run.started': undefined;
264
+ 'run.recovered': {
265
+ actorId: string;
266
+ };
267
+ 'run.paused': {
268
+ reason: 'elicitation' | 'approval' | 'tool_execution_unknown';
269
+ toolCallId: string;
270
+ };
271
+ 'run.resumed': undefined;
272
+ 'model.started': {
273
+ step: number;
274
+ workflowStepId?: string;
275
+ workflowAgentName?: string;
276
+ teamDelegationId?: string;
277
+ teamAgentName?: string;
278
+ };
279
+ 'model.output.delta': {
280
+ step: number;
281
+ delta: string;
282
+ workflowStepId?: string;
283
+ workflowAgentName?: string;
284
+ teamDelegationId?: string;
285
+ teamAgentName?: string;
286
+ };
287
+ 'model.completed': {
288
+ step: number;
289
+ usage?: JsonObject;
290
+ workflowStepId?: string;
291
+ workflowAgentName?: string;
292
+ teamDelegationId?: string;
293
+ teamAgentName?: string;
294
+ };
295
+ 'context.compacted': {
296
+ step: number;
297
+ removedMessages: number;
298
+ estimatedTokens: number;
299
+ compactedTokens: number;
300
+ targetTokens: number;
301
+ contextWindow: number;
302
+ summary: string;
303
+ summaryTruncated?: boolean;
304
+ workflowStepId?: string;
305
+ workflowAgentName?: string;
306
+ teamDelegationId?: string;
307
+ teamAgentName?: string;
308
+ };
309
+ 'tool.started': {
310
+ step: number;
311
+ toolCallId: string;
312
+ toolName: string;
313
+ attempt?: number;
314
+ source?: ToolEventSource;
315
+ workflowStepId?: string;
316
+ workflowAgentName?: string;
317
+ teamDelegationId?: string;
318
+ teamAgentName?: string;
319
+ };
320
+ 'tool.completed': {
321
+ step: number;
322
+ toolCallId: string;
323
+ toolName: string;
324
+ attempt?: number;
325
+ source?: ToolEventSource;
326
+ workflowStepId?: string;
327
+ workflowAgentName?: string;
328
+ teamDelegationId?: string;
329
+ teamAgentName?: string;
330
+ };
331
+ 'tool.failed': {
332
+ step: number;
333
+ toolCallId: string;
334
+ toolName: string;
335
+ error: string;
336
+ errorCode?: string;
337
+ retryable?: boolean;
338
+ source?: ToolEventSource;
339
+ workflowStepId?: string;
340
+ workflowAgentName?: string;
341
+ teamDelegationId?: string;
342
+ teamAgentName?: string;
343
+ };
344
+ 'tool.retrying': {
345
+ step: number;
346
+ toolCallId: string;
347
+ toolName: string;
348
+ attempt: number;
349
+ delayMs: number;
350
+ error: string;
351
+ errorCode?: string;
352
+ retryable?: boolean;
353
+ source?: ToolEventSource;
354
+ workflowStepId?: string;
355
+ workflowAgentName?: string;
356
+ teamDelegationId?: string;
357
+ teamAgentName?: string;
358
+ };
359
+ 'tool.execution_unknown': {
360
+ step: number;
361
+ toolCallId: string;
362
+ toolName: string;
363
+ source?: ToolEventSource;
364
+ workflowStepId?: string;
365
+ workflowAgentName?: string;
366
+ teamDelegationId?: string;
367
+ teamAgentName?: string;
368
+ };
369
+ 'artifact.created': {
370
+ descriptor: ArtifactDescriptor;
371
+ toolCallId?: string;
372
+ toolName?: string;
373
+ source?: ToolEventSource;
374
+ workflowStepId?: string;
375
+ workflowAgentName?: string;
376
+ teamDelegationId?: string;
377
+ teamAgentName?: string;
378
+ };
379
+ 'elicitation.requested': {
380
+ request: {
381
+ id: string;
382
+ toolCallId: string;
383
+ prompt: string;
384
+ responseSchema: JsonObject;
385
+ requestedAt: string;
386
+ expiresAt?: string;
387
+ };
388
+ workflowStepId?: string;
389
+ workflowAgentName?: string;
390
+ teamDelegationId?: string;
391
+ teamAgentName?: string;
392
+ };
393
+ 'elicitation.resolved': {
394
+ requestId: string;
395
+ toolCallId: string;
396
+ actorId: string;
397
+ workflowStepId?: string;
398
+ workflowAgentName?: string;
399
+ teamDelegationId?: string;
400
+ teamAgentName?: string;
401
+ };
402
+ 'approval.requested': {
403
+ approvalId: string;
404
+ toolCallId: string;
405
+ toolName: string;
406
+ toolLabel?: string;
407
+ source?: ToolEventSource;
408
+ workflowStepId?: string;
409
+ workflowAgentName?: string;
410
+ teamDelegationId?: string;
411
+ teamAgentName?: string;
412
+ };
413
+ 'approval.resolved': {
414
+ approvalId: string;
415
+ toolCallId: string;
416
+ decision: 'approve' | 'reject';
417
+ actorId: string;
418
+ toolLabel?: string;
419
+ source?: ToolEventSource;
420
+ workflowStepId?: string;
421
+ workflowAgentName?: string;
422
+ teamDelegationId?: string;
423
+ teamAgentName?: string;
424
+ };
425
+ 'run.completed': {
426
+ output: JsonValue;
427
+ usage?: JsonObject;
428
+ };
429
+ 'run.failed': {
430
+ error: string;
431
+ errorCode?: string;
432
+ retryable?: boolean;
433
+ source?: ToolEventSource;
434
+ };
435
+ 'run.cancelled': {
436
+ reason: 'aborted' | 'timeout' | 'approval_rejected';
437
+ };
438
+ 'workflow.run.started': undefined;
439
+ 'workflow.run.recovered': {
440
+ actorId: string;
441
+ };
442
+ 'workflow.step.started': {
443
+ stepId: string;
444
+ kind: 'agent' | 'parallel';
445
+ agentName?: string;
446
+ childRunId?: string;
447
+ };
448
+ 'workflow.step.completed': {
449
+ stepId: string;
450
+ kind: 'agent' | 'parallel';
451
+ };
452
+ 'workflow.step.failed': {
453
+ stepId: string;
454
+ kind: 'agent' | 'parallel';
455
+ error: string;
456
+ };
457
+ 'workflow.compensation.started': {
458
+ stepId: string;
459
+ kind: 'agent' | 'parallel';
460
+ };
461
+ 'workflow.compensation.completed': {
462
+ stepId: string;
463
+ kind: 'agent' | 'parallel';
464
+ };
465
+ 'workflow.compensation.failed': {
466
+ stepId: string;
467
+ kind: 'agent' | 'parallel';
468
+ error: string;
469
+ };
470
+ 'workflow.wait.started': {
471
+ stepId: string;
472
+ kind: 'timer' | 'event';
473
+ resumeAt?: string;
474
+ eventName?: string;
475
+ };
476
+ 'workflow.wait.completed': {
477
+ stepId: string;
478
+ kind: 'timer' | 'event';
479
+ payload?: JsonValue;
480
+ actorId?: string;
481
+ receivedAt?: string;
482
+ };
483
+ 'workflow.run.paused': {
484
+ stepId: string;
485
+ reason: 'child' | 'timer' | 'event';
486
+ childRunId?: string;
487
+ };
488
+ 'workflow.run.resumed': undefined;
489
+ 'workflow.run.completed': {
490
+ output: JsonValue;
491
+ usage?: JsonObject;
492
+ };
493
+ 'workflow.run.failed': {
494
+ error: string;
495
+ errorCode?: string;
496
+ retryable?: boolean;
497
+ source?: ToolEventSource;
498
+ };
499
+ 'workflow.run.cancelled': {
500
+ reason: 'aborted' | 'timeout' | 'approval_rejected';
501
+ };
502
+ 'team.run.started': undefined;
503
+ 'team.run.recovered': {
504
+ actorId: string;
505
+ };
506
+ 'team.agent.assigned': {
507
+ delegationId: string;
508
+ agentName: string;
509
+ action: 'delegate' | 'handoff';
510
+ expectedOutput?: string;
511
+ constraints?: string[];
512
+ childRunId?: string;
513
+ };
514
+ 'team.handoff.created': {
515
+ delegationId: string;
516
+ from: string;
517
+ to: string;
518
+ reason: string;
519
+ };
520
+ 'team.task.completed': {
521
+ delegationId: string;
522
+ agentName: string;
523
+ usage?: JsonObject;
524
+ };
525
+ 'team.task.failed': {
526
+ delegationId: string;
527
+ agentName?: string;
528
+ error: string;
529
+ };
530
+ 'team.merge.started': {
531
+ stepId: string;
532
+ width: number;
533
+ };
534
+ 'team.merge.completed': {
535
+ stepId: string;
536
+ };
537
+ 'team.merge.failed': {
538
+ stepId: string;
539
+ error: string;
540
+ };
541
+ 'team.run.paused': {
542
+ delegationId: string;
543
+ reason: 'child' | 'timer' | 'event';
544
+ childRunId?: string;
545
+ };
546
+ 'team.run.resumed': undefined;
547
+ 'team.run.completed': {
548
+ output: JsonValue;
549
+ usage?: JsonObject;
550
+ };
551
+ 'team.run.failed': {
552
+ error: string;
553
+ errorCode?: string;
554
+ retryable?: boolean;
555
+ source?: ToolEventSource;
556
+ };
557
+ 'team.run.cancelled': {
558
+ reason: 'aborted' | 'timeout' | 'approval_rejected';
559
+ };
560
+ }
561
+ interface AgentEventBase {
562
+ id: string;
563
+ sequence: number;
564
+ runId: RunId;
565
+ timestamp: string;
566
+ }
567
+ type AgentEvent<TType extends AgentEventType = AgentEventType> = { [TCurrent in TType]: AgentEventBase & {
568
+ type: TCurrent;
569
+ } & (AgentEventPayloads[TCurrent] extends undefined ? {
570
+ payload?: never;
571
+ } : {
572
+ payload: AgentEventPayloads[TCurrent];
573
+ }); }[TType];
574
+ //#endregion
575
+ export { ArtifactError as A, FileSystemArtifactStore as C, ArtifactCatalog as D, CatalogedArtifactStoreOptions as E, ArtifactStore as F, ArtifactStoreContext as I, ArtifactWrite as L, ArtifactId as M, ArtifactQuery as N, ArtifactContent as O, ArtifactRecord as P, artifactTenantId as R, InMemoryArtifactCatalog as S, CatalogedArtifactStore as T, S3ArtifactStore as _, AgentMessageRole as a, InMemoryArtifactStore as b, JsonPrimitive as c, PROVIDER_SCHEMA_UNSUPPORTED as d, RunId as f, ToolSpec as g, ToolEventSource as h, AgentMessage as i, ArtifactErrorCode as j, ArtifactDescriptor as k, JsonValue as l, ToolCall as m, AgentEventPayloads as n, ExecutionContext as o, SCHEMA_NOT_TRANSPORTABLE as p, AgentEventType as r, JsonObject as s, AgentEvent as t, PROVIDER_REASONING_UNSUPPORTED as u, S3ArtifactStoreOptions as v, FileSystemArtifactStoreOptions as w, InMemoryArtifactStoreOptions as x, S3ObjectClient as y, assertArtifactId as z };
@@ -0,0 +1,2 @@
1
+ import { a as WorkflowStep, c as defineWorkflow, i as WorkflowEventResult, n as WorkflowDefinition, o as WorkflowStepContext, r as WorkflowEventDefinition, s as WorkflowStepOptions, t as WorkflowAgentResult } from "../index-Btth7rdL.mjs";
2
+ export { WorkflowAgentResult, WorkflowDefinition, WorkflowEventDefinition, WorkflowEventResult, WorkflowStep, WorkflowStepContext, WorkflowStepOptions, defineWorkflow };
@@ -0,0 +1,6 @@
1
+ //#region src/workflows/workflow.ts
2
+ function defineWorkflow(workflow) {
3
+ return workflow;
4
+ }
5
+ //#endregion
6
+ export { defineWorkflow };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fevex/core",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.10",
4
4
  "description": "Agent Engineering Framework for code-first, provider-neutral AI agents.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -31,6 +31,22 @@
31
31
  "types": "./dist/agents/index.d.mts",
32
32
  "import": "./dist/agents/index.mjs"
33
33
  },
34
+ "./artifacts": {
35
+ "types": "./dist/artifacts/index.d.mts",
36
+ "import": "./dist/artifacts/index.mjs"
37
+ },
38
+ "./channels": {
39
+ "types": "./dist/channels/index.d.mts",
40
+ "import": "./dist/channels/index.mjs"
41
+ },
42
+ "./http": {
43
+ "types": "./dist/http/index.d.mts",
44
+ "import": "./dist/http/index.mjs"
45
+ },
46
+ "./knowledge": {
47
+ "types": "./dist/knowledge/index.d.mts",
48
+ "import": "./dist/knowledge/index.mjs"
49
+ },
34
50
  "./models": {
35
51
  "types": "./dist/models/index.d.mts",
36
52
  "import": "./dist/models/index.mjs"
@@ -39,10 +55,22 @@
39
55
  "types": "./dist/tools/index.d.mts",
40
56
  "import": "./dist/tools/index.mjs"
41
57
  },
58
+ "./workflows": {
59
+ "types": "./dist/workflows/index.d.mts",
60
+ "import": "./dist/workflows/index.mjs"
61
+ },
62
+ "./teams": {
63
+ "types": "./dist/teams/index.d.mts",
64
+ "import": "./dist/teams/index.mjs"
65
+ },
42
66
  "./runtime": {
43
67
  "types": "./dist/runtime/index.d.mts",
44
68
  "import": "./dist/runtime/index.mjs"
45
69
  },
70
+ "./sandbox": {
71
+ "types": "./dist/sandbox/index.d.mts",
72
+ "import": "./dist/sandbox/index.mjs"
73
+ },
46
74
  "./policies": {
47
75
  "types": "./dist/policies/index.d.mts",
48
76
  "import": "./dist/policies/index.mjs"
@@ -61,9 +89,9 @@
61
89
  }
62
90
  },
63
91
  "scripts": {
64
- "build": "tsdown src/index.ts src/agents/index.ts src/models/index.ts src/tools/index.ts src/runtime/index.ts src/policies/index.ts src/observability/index.ts src/evals/index.ts src/testing/index.ts --format esm --dts --clean",
92
+ "build": "tsdown src/index.ts src/agents/index.ts src/artifacts/index.ts src/channels/index.ts src/http/index.ts src/knowledge/index.ts src/models/index.ts src/tools/index.ts src/workflows/index.ts src/teams/index.ts src/runtime/index.ts src/sandbox/index.ts src/policies/index.ts src/observability/index.ts src/evals/index.ts src/testing/index.ts --format esm --dts --clean",
65
93
  "prepack": "bun run build",
66
- "test": "bun test src/index.test.ts src/internal/json.test.ts src/internal/model-stream.test.ts src/observability/index.test.ts src/evals/index.test.ts src/testing/index.test.ts",
94
+ "test": "bun test --cwd src",
67
95
  "typecheck": "tsc -p tsconfig.json --noEmit"
68
96
  },
69
97
  "publishConfig": {
@@ -1,4 +0,0 @@
1
- //#region src/internal/exact-definition.d.ts
2
- type ExactDefinition<TInput, TShape> = TInput & { readonly [TKey in Exclude<keyof TInput, keyof TShape>]: never; };
3
- //#endregion
4
- export { ExactDefinition as t };
@@ -1,32 +0,0 @@
1
- import { f as RunId, t as AgentEvent } from "./index-C_Zpr13f.mjs";
2
- import { ModelGateway } from "./models/index.mjs";
3
- import { t as AgentDefinition } from "./index-BzxHfyYV.mjs";
4
- import { _ as RunStore, c as ListEventsOptions, h as RunResult, i as CredentialStore, m as RunRequest, t as AgentRun, u as ResumeRunResolution, v as Session, y as SessionId } from "./index-DGWOGXzc.mjs";
5
- import { r as ObservabilityOptions } from "./index-ojCY3lwm.mjs";
6
- import { n as ToolDefinition } from "./index-CZGyhNIQ.mjs";
7
- import { r as PolicyDefinition } from "./index-QTkd6a7C.mjs";
8
- //#region src/fevex.d.ts
9
- interface FevexConfig {
10
- models: Record<string, ModelGateway>;
11
- agents: AgentDefinition[];
12
- tools?: ToolDefinition[];
13
- runStore?: RunStore;
14
- credentialStore?: CredentialStore;
15
- policies?: PolicyDefinition[];
16
- onEvent?: (event: AgentEvent) => void;
17
- observability?: ObservabilityOptions;
18
- }
19
- interface Fevex {
20
- startAgent<TInput = unknown, TOutput = unknown>(name: string, request: RunRequest<TInput, TOutput>): Promise<AgentRun<TOutput>>;
21
- runAgent<TInput = unknown, TOutput = unknown>(name: string, request: RunRequest<TInput, TOutput>): Promise<RunResult<TOutput>>;
22
- streamAgent<TInput = unknown, TOutput = unknown>(name: string, request: RunRequest<TInput, TOutput>): AsyncIterable<AgentEvent>;
23
- getRun<TOutput = unknown>(runId: RunId): Promise<AgentRun<TOutput> | undefined>;
24
- listEvents(runId: RunId, options?: ListEventsOptions): Promise<AgentEvent[]>;
25
- cancelRun(runId: RunId): Promise<boolean>;
26
- resumeRun<TOutput = unknown>(runId: RunId, resolution: ResumeRunResolution): Promise<AgentRun<TOutput>>;
27
- compactSession(sessionId: SessionId, summary: string): Promise<Session>;
28
- flushObservability(): Promise<void>;
29
- }
30
- declare function createFevex(config: FevexConfig): Fevex;
31
- //#endregion
32
- export { FevexConfig as n, createFevex as r, Fevex as t };