@limo-labs/deity 0.1.0-alpha.0

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 (138) hide show
  1. package/README.md +519 -0
  2. package/dist/src/component.d.ts +19 -0
  3. package/dist/src/component.d.ts.map +1 -0
  4. package/dist/src/component.js +2 -0
  5. package/dist/src/component.js.map +1 -0
  6. package/dist/src/context/context-scope.d.ts +24 -0
  7. package/dist/src/context/context-scope.d.ts.map +1 -0
  8. package/dist/src/context/context-scope.js +19 -0
  9. package/dist/src/context/context-scope.js.map +1 -0
  10. package/dist/src/context/memory-view.d.ts +62 -0
  11. package/dist/src/context/memory-view.d.ts.map +1 -0
  12. package/dist/src/context/memory-view.js +104 -0
  13. package/dist/src/context/memory-view.js.map +1 -0
  14. package/dist/src/context/scoped-context.d.ts +51 -0
  15. package/dist/src/context/scoped-context.d.ts.map +1 -0
  16. package/dist/src/context/scoped-context.js +74 -0
  17. package/dist/src/context/scoped-context.js.map +1 -0
  18. package/dist/src/context/scoped-execution-context.d.ts +55 -0
  19. package/dist/src/context/scoped-execution-context.d.ts.map +1 -0
  20. package/dist/src/context/scoped-execution-context.js +78 -0
  21. package/dist/src/context/scoped-execution-context.js.map +1 -0
  22. package/dist/src/conversation/conversation-manager.d.ts +272 -0
  23. package/dist/src/conversation/conversation-manager.d.ts.map +1 -0
  24. package/dist/src/conversation/conversation-manager.js +11 -0
  25. package/dist/src/conversation/conversation-manager.js.map +1 -0
  26. package/dist/src/conversation/conversation-pruner.d.ts +190 -0
  27. package/dist/src/conversation/conversation-pruner.d.ts.map +1 -0
  28. package/dist/src/conversation/conversation-pruner.js +274 -0
  29. package/dist/src/conversation/conversation-pruner.js.map +1 -0
  30. package/dist/src/conversation/conversation-tree.d.ts +185 -0
  31. package/dist/src/conversation/conversation-tree.d.ts.map +1 -0
  32. package/dist/src/conversation/conversation-tree.js +288 -0
  33. package/dist/src/conversation/conversation-tree.js.map +1 -0
  34. package/dist/src/conversation/file-conversation-store.d.ts +93 -0
  35. package/dist/src/conversation/file-conversation-store.d.ts.map +1 -0
  36. package/dist/src/conversation/file-conversation-store.js +284 -0
  37. package/dist/src/conversation/file-conversation-store.js.map +1 -0
  38. package/dist/src/conversation/in-memory-conversation-store.d.ts +36 -0
  39. package/dist/src/conversation/in-memory-conversation-store.d.ts.map +1 -0
  40. package/dist/src/conversation/in-memory-conversation-store.js +146 -0
  41. package/dist/src/conversation/in-memory-conversation-store.js.map +1 -0
  42. package/dist/src/copilot-adapter.d.ts +33 -0
  43. package/dist/src/copilot-adapter.d.ts.map +1 -0
  44. package/dist/src/copilot-adapter.js +119 -0
  45. package/dist/src/copilot-adapter.js.map +1 -0
  46. package/dist/src/file-trace-enhanced.d.ts +123 -0
  47. package/dist/src/file-trace-enhanced.d.ts.map +1 -0
  48. package/dist/src/file-trace-enhanced.js +177 -0
  49. package/dist/src/file-trace-enhanced.js.map +1 -0
  50. package/dist/src/file-trace.d.ts +24 -0
  51. package/dist/src/file-trace.d.ts.map +1 -0
  52. package/dist/src/file-trace.js +60 -0
  53. package/dist/src/file-trace.js.map +1 -0
  54. package/dist/src/index.d.ts +63 -0
  55. package/dist/src/index.d.ts.map +1 -0
  56. package/dist/src/index.js +40 -0
  57. package/dist/src/index.js.map +1 -0
  58. package/dist/src/json-store.d.ts +27 -0
  59. package/dist/src/json-store.d.ts.map +1 -0
  60. package/dist/src/json-store.js +93 -0
  61. package/dist/src/json-store.js.map +1 -0
  62. package/dist/src/llm.d.ts +35 -0
  63. package/dist/src/llm.d.ts.map +1 -0
  64. package/dist/src/llm.js +2 -0
  65. package/dist/src/llm.js.map +1 -0
  66. package/dist/src/memory/cold-storage.d.ts +60 -0
  67. package/dist/src/memory/cold-storage.d.ts.map +1 -0
  68. package/dist/src/memory/cold-storage.js +132 -0
  69. package/dist/src/memory/cold-storage.js.map +1 -0
  70. package/dist/src/memory/compression.d.ts +161 -0
  71. package/dist/src/memory/compression.d.ts.map +1 -0
  72. package/dist/src/memory/compression.js +193 -0
  73. package/dist/src/memory/compression.js.map +1 -0
  74. package/dist/src/memory/hot-memory.d.ts +69 -0
  75. package/dist/src/memory/hot-memory.d.ts.map +1 -0
  76. package/dist/src/memory/hot-memory.js +116 -0
  77. package/dist/src/memory/hot-memory.js.map +1 -0
  78. package/dist/src/memory/memory-budget.d.ts +162 -0
  79. package/dist/src/memory/memory-budget.d.ts.map +1 -0
  80. package/dist/src/memory/memory-budget.js +241 -0
  81. package/dist/src/memory/memory-budget.js.map +1 -0
  82. package/dist/src/memory/memory-config.d.ts +419 -0
  83. package/dist/src/memory/memory-config.d.ts.map +1 -0
  84. package/dist/src/memory/memory-config.js +297 -0
  85. package/dist/src/memory/memory-config.js.map +1 -0
  86. package/dist/src/memory/prefetcher.d.ts +137 -0
  87. package/dist/src/memory/prefetcher.d.ts.map +1 -0
  88. package/dist/src/memory/prefetcher.js +186 -0
  89. package/dist/src/memory/prefetcher.js.map +1 -0
  90. package/dist/src/memory/tiered-memory.d.ts +116 -0
  91. package/dist/src/memory/tiered-memory.d.ts.map +1 -0
  92. package/dist/src/memory/tiered-memory.js +215 -0
  93. package/dist/src/memory/tiered-memory.js.map +1 -0
  94. package/dist/src/memory/warm-storage.d.ts +74 -0
  95. package/dist/src/memory/warm-storage.d.ts.map +1 -0
  96. package/dist/src/memory/warm-storage.js +207 -0
  97. package/dist/src/memory/warm-storage.js.map +1 -0
  98. package/dist/src/openai-adapter.d.ts +20 -0
  99. package/dist/src/openai-adapter.d.ts.map +1 -0
  100. package/dist/src/openai-adapter.js +73 -0
  101. package/dist/src/openai-adapter.js.map +1 -0
  102. package/dist/src/parser.d.ts +27 -0
  103. package/dist/src/parser.d.ts.map +1 -0
  104. package/dist/src/parser.js +76 -0
  105. package/dist/src/parser.js.map +1 -0
  106. package/dist/src/runtime.d.ts +172 -0
  107. package/dist/src/runtime.d.ts.map +1 -0
  108. package/dist/src/runtime.js +436 -0
  109. package/dist/src/runtime.js.map +1 -0
  110. package/dist/src/schema-utils.d.ts +7 -0
  111. package/dist/src/schema-utils.d.ts.map +1 -0
  112. package/dist/src/schema-utils.js +71 -0
  113. package/dist/src/schema-utils.js.map +1 -0
  114. package/dist/src/stage.d.ts +139 -0
  115. package/dist/src/stage.d.ts.map +1 -0
  116. package/dist/src/stage.js +2 -0
  117. package/dist/src/stage.js.map +1 -0
  118. package/dist/src/store.d.ts +51 -0
  119. package/dist/src/store.d.ts.map +1 -0
  120. package/dist/src/store.js +2 -0
  121. package/dist/src/store.js.map +1 -0
  122. package/dist/src/tool.d.ts +12 -0
  123. package/dist/src/tool.d.ts.map +1 -0
  124. package/dist/src/tool.js +2 -0
  125. package/dist/src/tool.js.map +1 -0
  126. package/dist/src/trace.d.ts +60 -0
  127. package/dist/src/trace.d.ts.map +1 -0
  128. package/dist/src/trace.js +2 -0
  129. package/dist/src/trace.js.map +1 -0
  130. package/dist/src/validator.d.ts +17 -0
  131. package/dist/src/validator.d.ts.map +1 -0
  132. package/dist/src/validator.js +21 -0
  133. package/dist/src/validator.js.map +1 -0
  134. package/dist/src/workflow.d.ts +192 -0
  135. package/dist/src/workflow.d.ts.map +1 -0
  136. package/dist/src/workflow.js +50 -0
  137. package/dist/src/workflow.js.map +1 -0
  138. package/package.json +62 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stage.d.ts","sourceRoot":"","sources":["../../src/stage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAElF;;;;;;GAM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G,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC;QAE9C;;;;;WAKG;QACH,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,CAAC;CACH"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=stage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stage.js","sourceRoot":"","sources":["../../src/stage.ts"],"names":[],"mappings":""}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Record of a single stage checkpoint in the state store.
3
+ */
4
+ export interface StageRecord {
5
+ stageId: string;
6
+ status: "completed" | "failed";
7
+ output?: unknown;
8
+ promptHash: string;
9
+ modelName?: string;
10
+ generationConfig?: Record<string, unknown>;
11
+ toolCalls?: Array<{
12
+ toolName: string;
13
+ arguments: Record<string, unknown>;
14
+ result: unknown;
15
+ }>;
16
+ validationErrors?: string[];
17
+ timestamp: string;
18
+ }
19
+ /**
20
+ * State store interface for persisting stage checkpoints.
21
+ * Implementations must be crash-safe (write then rename).
22
+ */
23
+ export interface StateStore {
24
+ /**
25
+ * Check if a valid checkpoint exists for a stage.
26
+ * Returns false if no checkpoint, if stage failed, or if prompt hash changed.
27
+ */
28
+ hasValidCheckpoint(stageId: string, currentPromptHash: string): Promise<boolean>;
29
+ /**
30
+ * Load a completed stage's output.
31
+ * Returns undefined if no valid checkpoint.
32
+ */
33
+ load(stageId: string): Promise<unknown | undefined>;
34
+ /**
35
+ * Save a completed stage's output with metadata.
36
+ */
37
+ save(stageId: string, output: unknown, metadata: Omit<StageRecord, "stageId" | "status" | "output" | "timestamp">): Promise<void>;
38
+ /**
39
+ * Mark a stage as permanently failed.
40
+ */
41
+ markFailed(stageId: string, errors: string[], metadata: Omit<StageRecord, "stageId" | "status" | "validationErrors" | "timestamp">): Promise<void>;
42
+ /**
43
+ * Load all stage records (for building ExecutionContext).
44
+ */
45
+ loadAll(): Promise<Record<string, StageRecord>>;
46
+ /**
47
+ * Clear a specific stage's checkpoint (for cache invalidation).
48
+ */
49
+ clear(stageId: string): Promise<void>;
50
+ }
51
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,WAAW,GAAG,QAAQ,CAAC;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,SAAS,CAAC,EAAE,KAAK,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACnC,MAAM,EAAE,OAAO,CAAC;KACjB,CAAC,CAAC;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEjF;;;OAGG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC;IAEpD;;OAEG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElI;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,QAAQ,GAAG,kBAAkB,GAAG,WAAW,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnJ;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IAEhD;;OAEG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import { type ZodSchema } from "zod";
2
+ /**
3
+ * Tool definition for LLM function calling.
4
+ * Tools are executed by the runtime, never directly by the model.
5
+ */
6
+ export interface Tool {
7
+ name: string;
8
+ description: string;
9
+ inputSchema: ZodSchema<any>;
10
+ execute(input: any): Promise<any>;
11
+ }
12
+ //# sourceMappingURL=tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../src/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,KAAK,CAAC;AAErC;;;GAGG;AACH,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;IAC5B,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CACnC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool.js","sourceRoot":"","sources":["../../src/tool.ts"],"names":[],"mappings":""}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Memory statistics snapshot for trace logging.
3
+ * @since 2.0.0
4
+ */
5
+ export interface TraceMemoryStats {
6
+ /** Hot memory tier statistics */
7
+ hot?: {
8
+ itemCount: number;
9
+ estimatedSize: number;
10
+ hitCount: number;
11
+ missCount: number;
12
+ };
13
+ /** Warm storage tier statistics */
14
+ warm?: {
15
+ fileCount: number;
16
+ totalSize: number;
17
+ };
18
+ /** Cold storage tier statistics */
19
+ cold?: {
20
+ fileCount: number;
21
+ totalSize: number;
22
+ };
23
+ }
24
+ /**
25
+ * Performance metrics for trace logging.
26
+ * @since 2.0.0
27
+ */
28
+ export interface TracePerformanceMetrics {
29
+ /** Execution duration in milliseconds */
30
+ duration?: number;
31
+ /** LLM call duration in milliseconds */
32
+ llmDuration?: number;
33
+ /** Tool execution duration in milliseconds */
34
+ toolDuration?: number;
35
+ /** Memory operation duration in milliseconds */
36
+ memoryDuration?: number;
37
+ }
38
+ /**
39
+ * A single trace entry recorded during pipeline execution.
40
+ */
41
+ export interface TraceEntry {
42
+ timestamp: string;
43
+ stageId: string;
44
+ event: "stage_start" | "stage_complete" | "stage_failed" | "llm_request" | "llm_response" | "tool_call" | "tool_result" | "validation_pass" | "validation_fail" | "parse_error" | "retry";
45
+ data?: Record<string, unknown>;
46
+ /** Memory statistics at time of event (Phase 5.4) */
47
+ memory?: TraceMemoryStats;
48
+ /** Performance metrics (Phase 5.4) */
49
+ performance?: TracePerformanceMetrics;
50
+ }
51
+ /**
52
+ * Append-only trace logger interface.
53
+ * Records all execution steps for debugging and inspection.
54
+ */
55
+ export interface TraceLogger {
56
+ log(entry: Omit<TraceEntry, "timestamp">): void;
57
+ getEntries(): TraceEntry[];
58
+ flush(): Promise<void>;
59
+ }
60
+ //# sourceMappingURL=trace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../src/trace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,iCAAiC;IACjC,GAAG,CAAC,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C,CAAC;CACxB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=trace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace.js","sourceRoot":"","sources":["../../src/trace.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import type { ValidationResult } from "./component.js";
2
+ import type { ZodSchema } from "zod";
3
+ /**
4
+ * Validate an output against a Zod schema.
5
+ * Returns a ValidationResult with detailed error messages.
6
+ */
7
+ export declare function validateSchema<T>(output: unknown, schema: ZodSchema<T>): ValidationResult;
8
+ /**
9
+ * Format a Zod error into a human-readable string.
10
+ */
11
+ export declare function formatZodError(error: {
12
+ issues: Array<{
13
+ path: Array<string | number>;
14
+ message: string;
15
+ }>;
16
+ }): string;
17
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAErC;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAUzF;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,GAAG,MAAM,CAIlH"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Validate an output against a Zod schema.
3
+ * Returns a ValidationResult with detailed error messages.
4
+ */
5
+ export function validateSchema(output, schema) {
6
+ const result = schema.safeParse(output);
7
+ if (result.success) {
8
+ return { valid: true };
9
+ }
10
+ const errors = result.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`);
11
+ return { valid: false, errors };
12
+ }
13
+ /**
14
+ * Format a Zod error into a human-readable string.
15
+ */
16
+ export function formatZodError(error) {
17
+ return error.issues
18
+ .map((issue) => `${issue.path.join(".")}: ${issue.message}`)
19
+ .join("; ");
20
+ }
21
+ //# sourceMappingURL=validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/validator.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAI,MAAe,EAAE,MAAoB;IACrE,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACxC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CACpC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,CACvD,CAAC;IACF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,KAA2E;IACxG,OAAO,KAAK,CAAC,MAAM;SAChB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;SAC3D,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
@@ -0,0 +1,192 @@
1
+ /**
2
+ * Workflow types and configuration (Deity 2.0 terminology).
3
+ *
4
+ * This module defines the core workflow types using the new v2.0 terminology.
5
+ * The old "Pipeline" terminology is deprecated but still available for backward compatibility.
6
+ *
7
+ * **Terminology Change:**
8
+ * - `Pipeline` → `Workflow` (single agent's sequential execution)
9
+ * - `PipelineConfig` → `WorkflowConfig`
10
+ * - `definePipeline()` → `defineWorkflow()`
11
+ * - `runPipeline()` → `runWorkflow()`
12
+ *
13
+ * See TERMINOLOGY.md for migration guide.
14
+ *
15
+ * @module workflow
16
+ * @since 2.0.0
17
+ */
18
+ import type { AgentComponent } from "./stage.js";
19
+ import type { LLMAdapter, GenerationConfig } from "./llm.js";
20
+ import type { MemoryConfig } from "./memory/memory-config.js";
21
+ import { MemoryPresets } from "./memory/memory-config.js";
22
+ /**
23
+ * Workflow configuration.
24
+ *
25
+ * Defines the settings for a single agent's workflow execution.
26
+ * A workflow is a deterministic sequence of steps (AgentComponents) that the agent executes.
27
+ *
28
+ * **Key Concept:** Deity manages a single agent's workflow, not a multi-agent pipeline.
29
+ * This terminology clarifies Deity's scope and purpose.
30
+ *
31
+ * @since 2.0.0
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * const workflowConfig: WorkflowConfig = {
36
+ * name: "research-workflow",
37
+ * description: "Researches a topic and generates a report",
38
+ * defaultModel: {
39
+ * adapter: new OpenAIAdapter({ apiKey: "..." }),
40
+ * config: { temperature: 0.7, maxTokens: 2000 }
41
+ * },
42
+ * onStageFailure: "abort",
43
+ * maxToolRounds: 10,
44
+ * memoryConfig: "production"
45
+ * };
46
+ * ```
47
+ */
48
+ export interface WorkflowConfig {
49
+ /** Unique name for this workflow */
50
+ name: string;
51
+ /** Optional description of what this workflow does */
52
+ description?: string;
53
+ /**
54
+ * Default LLM adapter and generation config for all steps.
55
+ *
56
+ * Individual steps can override this with their own model configuration.
57
+ */
58
+ defaultModel?: {
59
+ adapter: LLMAdapter;
60
+ config?: GenerationConfig;
61
+ };
62
+ /**
63
+ * Behavior when a step fails after exhausting retries.
64
+ *
65
+ * - `"abort"` (default): Stop workflow execution and throw error
66
+ * - `"skip"`: Continue to next step, marking this step as failed
67
+ */
68
+ onStageFailure?: "abort" | "skip";
69
+ /**
70
+ * Maximum tool calling rounds per step.
71
+ *
72
+ * Prevents infinite tool calling loops.
73
+ * @default 10
74
+ */
75
+ maxToolRounds?: number;
76
+ /**
77
+ * Maximum number of tool calls to execute concurrently.
78
+ *
79
+ * When the LLM returns multiple independent tool calls, they can be executed
80
+ * in parallel. This setting limits how many tools run simultaneously to prevent
81
+ * resource exhaustion.
82
+ *
83
+ * Set to 1 to disable parallel execution (sequential only).
84
+ * Set to Infinity for unlimited concurrency.
85
+ *
86
+ * @default Infinity
87
+ * @since 2.0.0
88
+ */
89
+ parallelToolConcurrency?: number;
90
+ /**
91
+ * Memory configuration for tiered storage system.
92
+ *
93
+ * Defines how the workflow manages its memory across hot/warm/cold tiers:
94
+ * - **Hot memory**: In-memory LRU cache for frequently accessed data
95
+ * - **Warm storage**: Compressed disk cache for less frequently accessed data
96
+ * - **Cold storage**: Uncompressed disk archive for long-term storage
97
+ *
98
+ * You can use preset names ("development", "production", "minimal") or provide
99
+ * a full MemoryConfig object.
100
+ *
101
+ * **Note:** This configuration will be integrated with TieredStateStore in future tasks.
102
+ * For now, you still need to pass a StateStore directly to runWorkflow().
103
+ *
104
+ * @since 2.0.0
105
+ * @example
106
+ * ```typescript
107
+ * // Use a preset
108
+ * const workflow = defineWorkflow({
109
+ * name: "my-workflow",
110
+ * memoryConfig: "production",
111
+ * steps: [Step1, Step2],
112
+ * });
113
+ *
114
+ * // Use custom config
115
+ * const workflow = defineWorkflow({
116
+ * name: "my-workflow",
117
+ * memoryConfig: {
118
+ * hot: { maxItems: 2000 },
119
+ * warm: { enabled: true, maxSize: 1024 * 1024 * 1024 },
120
+ * cold: { enabled: true, directory: ".archive" },
121
+ * },
122
+ * steps: [Step1, Step2],
123
+ * });
124
+ * ```
125
+ */
126
+ memoryConfig?: MemoryConfig | keyof typeof MemoryPresets;
127
+ }
128
+ /**
129
+ * Workflow definition combining config and steps.
130
+ *
131
+ * A workflow represents a single agent's complete execution path through
132
+ * a sequence of steps (AgentComponents).
133
+ *
134
+ * **Design Philosophy:**
135
+ * Deity is a framework for building **single AI agents**, not multi-agent systems.
136
+ * A workflow is one agent's deterministic execution flow.
137
+ *
138
+ * @since 2.0.0
139
+ *
140
+ * @example
141
+ * ```typescript
142
+ * const workflow: Workflow = {
143
+ * config: {
144
+ * name: "research-workflow",
145
+ * defaultModel: { adapter: llm }
146
+ * },
147
+ * steps: [
148
+ * ResearchComponent,
149
+ * AnalysisComponent,
150
+ * ReportComponent
151
+ * ]
152
+ * };
153
+ * ```
154
+ */
155
+ export interface Workflow {
156
+ /** Workflow configuration */
157
+ config: WorkflowConfig;
158
+ /** Sequence of steps to execute (AgentComponents) */
159
+ steps: AgentComponent<any, any>[];
160
+ }
161
+ /**
162
+ * Define a workflow with configuration and steps.
163
+ *
164
+ * This is the primary way to create a workflow definition in Deity 2.0.
165
+ *
166
+ * **Terminology Note:** Replaces `definePipeline()` from v1.x. The old function
167
+ * still works but is deprecated.
168
+ *
169
+ * @param options - Workflow configuration with steps
170
+ * @returns Workflow definition ready for execution
171
+ *
172
+ * @since 2.0.0
173
+ *
174
+ * @example
175
+ * ```typescript
176
+ * import { defineWorkflow } from '@limo-labs/deity';
177
+ *
178
+ * const workflow = defineWorkflow({
179
+ * name: "my-workflow",
180
+ * description: "Processes data through multiple steps",
181
+ * defaultModel: { adapter: llm },
182
+ * steps: [Step1, Step2, Step3]
183
+ * });
184
+ *
185
+ * // Execute the workflow
186
+ * const result = await runWorkflow(workflow, inputs, store, trace);
187
+ * ```
188
+ */
189
+ export declare function defineWorkflow(options: WorkflowConfig & {
190
+ steps: AgentComponent<any, any>[];
191
+ }): Workflow;
192
+ //# sourceMappingURL=workflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,cAAc;IAC7B,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IAEb,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,YAAY,CAAC,EAAE;QACb,OAAO,EAAE,UAAU,CAAC;QACpB,MAAM,CAAC,EAAE,gBAAgB,CAAC;KAC3B,CAAC;IAEF;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAElC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;;;;;;;;;OAYG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,YAAY,CAAC,EAAE,YAAY,GAAG,MAAM,OAAO,aAAa,CAAC;CAC1D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,QAAQ;IACvB,6BAA6B;IAC7B,MAAM,EAAE,cAAc,CAAC;IAEvB,qDAAqD;IACrD,KAAK,EAAE,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,cAAc,GAAG;IAAE,KAAK,EAAE,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAA;CAAE,GAC9D,QAAQ,CAGV"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Workflow types and configuration (Deity 2.0 terminology).
3
+ *
4
+ * This module defines the core workflow types using the new v2.0 terminology.
5
+ * The old "Pipeline" terminology is deprecated but still available for backward compatibility.
6
+ *
7
+ * **Terminology Change:**
8
+ * - `Pipeline` → `Workflow` (single agent's sequential execution)
9
+ * - `PipelineConfig` → `WorkflowConfig`
10
+ * - `definePipeline()` → `defineWorkflow()`
11
+ * - `runPipeline()` → `runWorkflow()`
12
+ *
13
+ * See TERMINOLOGY.md for migration guide.
14
+ *
15
+ * @module workflow
16
+ * @since 2.0.0
17
+ */
18
+ /**
19
+ * Define a workflow with configuration and steps.
20
+ *
21
+ * This is the primary way to create a workflow definition in Deity 2.0.
22
+ *
23
+ * **Terminology Note:** Replaces `definePipeline()` from v1.x. The old function
24
+ * still works but is deprecated.
25
+ *
26
+ * @param options - Workflow configuration with steps
27
+ * @returns Workflow definition ready for execution
28
+ *
29
+ * @since 2.0.0
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * import { defineWorkflow } from '@limo-labs/deity';
34
+ *
35
+ * const workflow = defineWorkflow({
36
+ * name: "my-workflow",
37
+ * description: "Processes data through multiple steps",
38
+ * defaultModel: { adapter: llm },
39
+ * steps: [Step1, Step2, Step3]
40
+ * });
41
+ *
42
+ * // Execute the workflow
43
+ * const result = await runWorkflow(workflow, inputs, store, trace);
44
+ * ```
45
+ */
46
+ export function defineWorkflow(options) {
47
+ const { steps, ...config } = options;
48
+ return { config, steps };
49
+ }
50
+ //# sourceMappingURL=workflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.js","sourceRoot":"","sources":["../../src/workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AA2JH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,cAAc,CAC5B,OAA+D;IAE/D,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC;IACrC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAC3B,CAAC"}
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@limo-labs/deity",
3
+ "version": "0.1.0-alpha.0",
4
+ "description": "Deterministic orchestration runtime for AI agents with checkpoint & resume",
5
+ "keywords": [
6
+ "ai",
7
+ "agents",
8
+ "llm",
9
+ "orchestration",
10
+ "workflow",
11
+ "deterministic",
12
+ "checkpoint",
13
+ "typescript",
14
+ "zod",
15
+ "validation"
16
+ ],
17
+ "homepage": "https://github.com/Limo-Deity/Limo-Deity#readme",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/Limo-Deity/Limo-Deity.git",
21
+ "directory": "packages/core"
22
+ },
23
+ "bugs": {
24
+ "url": "https://github.com/Limo-Deity/Limo-Deity/issues"
25
+ },
26
+ "license": "MIT",
27
+ "author": "Limo-Deity Contributors",
28
+ "type": "module",
29
+ "main": "./dist/src/index.js",
30
+ "types": "./dist/src/index.d.ts",
31
+ "files": [
32
+ "dist/src/**/*.js",
33
+ "dist/src/**/*.d.ts",
34
+ "dist/src/**/*.js.map",
35
+ "dist/src/**/*.d.ts.map",
36
+ "!dist/src/__tests__",
37
+ "!dist/src/**/*.test.*",
38
+ "!dist/src/poc",
39
+ "!dist/src/examples",
40
+ "README.md",
41
+ "LICENSE"
42
+ ],
43
+ "scripts": {
44
+ "build": "tsc",
45
+ "test": "vitest run",
46
+ "test:watch": "vitest",
47
+ "clean": "rm -rf dist"
48
+ },
49
+ "dependencies": {
50
+ "lru-cache": "^11.2.6",
51
+ "zod": "^3.24.0"
52
+ },
53
+ "devDependencies": {
54
+ "@types/node": "^25.2.3",
55
+ "typescript": "^5.7.0",
56
+ "vitest": "^3.0.0"
57
+ },
58
+ "engines": {
59
+ "node": ">=20.0.0",
60
+ "npm": ">=9.0.0"
61
+ }
62
+ }