@almadar/agent 2.0.0 → 2.0.1

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 (100) hide show
  1. package/dist/agent/event-budget.d.ts +28 -0
  2. package/dist/agent/experimental/hitl-v2.d.ts +161 -0
  3. package/dist/agent/experimental/hitl-workflow-integration.d.ts +182 -0
  4. package/dist/agent/index.d.ts +14 -0
  5. package/dist/agent/index.js.map +1 -1
  6. package/dist/agent/interrupt-config.d.ts +51 -0
  7. package/dist/agent/session-manager.d.ts +204 -0
  8. package/dist/agent/skill-agent.d.ts +182 -0
  9. package/dist/agent/workflow-middleware.d.ts +63 -0
  10. package/dist/agent/workflow-tool-wrapper.d.ts +87 -0
  11. package/dist/api-types.d.ts +595 -0
  12. package/dist/context/compaction.d.ts +191 -0
  13. package/dist/context-compaction.d.ts +55 -0
  14. package/dist/evals/online-sampling.d.ts +114 -0
  15. package/dist/evals/utils/compact-orbital.d.ts +100 -0
  16. package/dist/event-transformer/event-transformer.d.ts +120 -0
  17. package/dist/event-transformer/index.d.ts +7 -0
  18. package/dist/events.d.ts +85 -0
  19. package/dist/index.d.ts +59 -0
  20. package/dist/index.js.map +1 -1
  21. package/dist/memory/MemoryManager.d.ts +243 -0
  22. package/dist/memory/PreferenceLearner.d.ts +59 -0
  23. package/dist/memory/agentic-search.d.ts +116 -0
  24. package/dist/memory/index.d.ts +14 -0
  25. package/dist/memory/memory-orbital.d.ts +66 -0
  26. package/dist/memory/types.d.ts +143 -0
  27. package/dist/metrics.d.ts +77 -0
  28. package/dist/multi-user.d.ts +155 -0
  29. package/dist/observability/index.d.ts +14 -0
  30. package/dist/observability/langsmith-integration.d.ts +203 -0
  31. package/dist/observability.d.ts +196 -0
  32. package/dist/orbitals/archive/sanitize.d.ts +24 -0
  33. package/dist/orbitals/batch/batch-generator.d.ts +41 -0
  34. package/dist/orbitals/batch/concurrency.d.ts +54 -0
  35. package/dist/orbitals/batch/index.d.ts +14 -0
  36. package/dist/orbitals/batch/prompt-assembler.d.ts +92 -0
  37. package/dist/orbitals/batch/types.d.ts +103 -0
  38. package/dist/orbitals/cache/index.d.ts +11 -0
  39. package/dist/orbitals/cache/orbital-fingerprint.d.ts +37 -0
  40. package/dist/orbitals/cache/prompt-assembler.d.ts +65 -0
  41. package/dist/orbitals/cache/structural-templates.d.ts +33 -0
  42. package/dist/orbitals/combiner/index.d.ts +102 -0
  43. package/dist/orbitals/domain-language/index.d.ts +9 -0
  44. package/dist/orbitals/domain-language/prompts/index.d.ts +11 -0
  45. package/dist/orbitals/domain-language/prompts/odl-examples.d.ts +8 -0
  46. package/dist/orbitals/domain-language/prompts/odl-patterns.d.ts +8 -0
  47. package/dist/orbitals/domain-language/prompts/odl-syntax.d.ts +8 -0
  48. package/dist/orbitals/domain-language/prompts/odl-to-schema.d.ts +8 -0
  49. package/dist/orbitals/generation/index.d.ts +10 -0
  50. package/dist/orbitals/generation/orbital-generator.d.ts +120 -0
  51. package/dist/orbitals/shared/constants.d.ts +65 -0
  52. package/dist/orbitals/shared/index.d.ts +11 -0
  53. package/dist/orbitals/shared/types.d.ts +187 -0
  54. package/dist/orbitals/shared/utils.d.ts +97 -0
  55. package/dist/orchestration/complexity-classifier.d.ts +38 -0
  56. package/dist/orchestration/fixing-orchestrator.d.ts +53 -0
  57. package/dist/orchestration/index.d.ts +31 -0
  58. package/dist/orchestration/provider-router.d.ts +45 -0
  59. package/dist/persistence/firestore-checkpointer.d.ts +139 -0
  60. package/dist/persistence/firestore-session-store.d.ts +75 -0
  61. package/dist/persistence/firestore-store.d.ts +86 -0
  62. package/dist/persistence/index.d.ts +10 -0
  63. package/dist/persistence/memory-backend.d.ts +33 -0
  64. package/dist/persistence/types.d.ts +40 -0
  65. package/dist/security/audit-log.d.ts +44 -0
  66. package/dist/state-sync.d.ts +171 -0
  67. package/dist/subagents.d.ts +38 -0
  68. package/dist/tools/combine-schemas.d.ts +154 -0
  69. package/dist/tools/composition.d.ts +119 -0
  70. package/dist/tools/domain-orbital.d.ts +997 -0
  71. package/dist/tools/execute.d.ts +38 -0
  72. package/dist/tools/finish-task.d.ts +56 -0
  73. package/dist/tools/generate-schema.d.ts +53 -0
  74. package/dist/tools/github.d.ts +297 -0
  75. package/dist/tools/index.d.ts +1318 -0
  76. package/dist/tools/orbital-batch-subagent.d.ts +85 -0
  77. package/dist/tools/orbital-subagent.d.ts +454 -0
  78. package/dist/tools/orchestrated-fixing.d.ts +74 -0
  79. package/dist/tools/orchestrated-generation.d.ts +75 -0
  80. package/dist/tools/sandbox-executor.d.ts +31 -0
  81. package/dist/tools/schema-chunking.d.ts +117 -0
  82. package/dist/tools/trait-subagent.d.ts +179 -0
  83. package/dist/tools/validate-schema.d.ts +17 -0
  84. package/dist/types.d.ts +167 -0
  85. package/dist/utils/safety/capability-token.d.ts +50 -0
  86. package/dist/utils/safety/circuit-breaker.d.ts +71 -0
  87. package/dist/utils/safety/index.d.ts +19 -0
  88. package/dist/utils/safety/rate-limiter.d.ts +39 -0
  89. package/dist/utils/safety/threshold-auth.d.ts +70 -0
  90. package/dist/workspace/git-client.d.ts +51 -0
  91. package/dist/workspace/index.d.ts +38 -0
  92. package/dist/workspace/memory-files.d.ts +31 -0
  93. package/dist/workspace/sink-manager.d.ts +26 -0
  94. package/dist/workspace/sinks/firestore-sink.d.ts +41 -0
  95. package/dist/workspace/sinks/git-sink.d.ts +47 -0
  96. package/dist/workspace/sinks/index.d.ts +9 -0
  97. package/dist/workspace/templates.d.ts +32 -0
  98. package/dist/workspace/types.d.ts +86 -0
  99. package/dist/workspace/workspace-manager.d.ts +57 -0
  100. package/package.json +7 -6
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Orbital Batch Subagent Tool
3
+ *
4
+ * Tool for generating multiple orbitals in optimized batches.
5
+ * Provides significant speedup (2x-3x) for multi-orbital generation.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ import { z } from 'zod';
10
+ import type { OrbitalDefinition } from '@almadar/core/types';
11
+ import { type LLMProvider } from '@almadar/llm';
12
+ import type { SSEEventType } from '../api-types.js';
13
+ import { type ExtractedRequirements } from '../orbitals/shared/index.js';
14
+ export type SubagentEventCallback = (orbitalName: string, orbitalIndex: number, totalOrbitals: number, event: {
15
+ type: Exclude<SSEEventType, 'subagent_event'>;
16
+ data: Record<string, unknown>;
17
+ timestamp: number;
18
+ }) => void;
19
+ export type BatchCompleteCallback = (orbitals: OrbitalDefinition[], batchIndex: number, totalBatches: number) => Promise<void> | void;
20
+ export interface OrbitalBatchSubagentToolOptions {
21
+ onSubagentEvent?: SubagentEventCallback;
22
+ onBatchComplete?: BatchCompleteCallback;
23
+ requirements?: Partial<ExtractedRequirements>;
24
+ provider?: LLMProvider;
25
+ model?: string;
26
+ workDir?: string;
27
+ }
28
+ /**
29
+ * Create a tool for batch orbital generation with event streaming.
30
+ */
31
+ export declare function createOrbitalBatchSubagentTool(options?: OrbitalBatchSubagentToolOptions): {
32
+ tool: import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
33
+ orbitals: z.ZodArray<z.ZodAny, "many">;
34
+ options: z.ZodOptional<z.ZodObject<{
35
+ mode: z.ZodDefault<z.ZodOptional<z.ZodEnum<["single-call", "parallel-individual", "adaptive"]>>>;
36
+ batchSize: z.ZodOptional<z.ZodNumber>;
37
+ maxConcurrency: z.ZodOptional<z.ZodNumber>;
38
+ preserveRelationships: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
39
+ }, "strip", z.ZodTypeAny, {
40
+ mode: "single-call" | "parallel-individual" | "adaptive";
41
+ preserveRelationships: boolean;
42
+ batchSize?: number | undefined;
43
+ maxConcurrency?: number | undefined;
44
+ }, {
45
+ batchSize?: number | undefined;
46
+ mode?: "single-call" | "parallel-individual" | "adaptive" | undefined;
47
+ preserveRelationships?: boolean | undefined;
48
+ maxConcurrency?: number | undefined;
49
+ }>>;
50
+ }, "strip", z.ZodTypeAny, {
51
+ orbitals: any[];
52
+ options?: {
53
+ mode: "single-call" | "parallel-individual" | "adaptive";
54
+ preserveRelationships: boolean;
55
+ batchSize?: number | undefined;
56
+ maxConcurrency?: number | undefined;
57
+ } | undefined;
58
+ }, {
59
+ orbitals: any[];
60
+ options?: {
61
+ batchSize?: number | undefined;
62
+ mode?: "single-call" | "parallel-individual" | "adaptive" | undefined;
63
+ preserveRelationships?: boolean | undefined;
64
+ maxConcurrency?: number | undefined;
65
+ } | undefined;
66
+ }>, {
67
+ orbitals: any[];
68
+ options?: {
69
+ mode: "single-call" | "parallel-individual" | "adaptive";
70
+ preserveRelationships: boolean;
71
+ batchSize?: number | undefined;
72
+ maxConcurrency?: number | undefined;
73
+ } | undefined;
74
+ }, {
75
+ orbitals: any[];
76
+ options?: {
77
+ batchSize?: number | undefined;
78
+ mode?: "single-call" | "parallel-individual" | "adaptive" | undefined;
79
+ preserveRelationships?: boolean | undefined;
80
+ maxConcurrency?: number | undefined;
81
+ } | undefined;
82
+ }, string, "generate_orbitals_batch">;
83
+ setEventCallback: (callback: SubagentEventCallback) => void;
84
+ setBatchCompleteCallback: (callback: BatchCompleteCallback) => void;
85
+ };
@@ -0,0 +1,454 @@
1
+ /**
2
+ * Orbital Subagent Tool
3
+ *
4
+ * Spawns nested DeepAgents for orbital generation and forwards
5
+ * their events to the parent stream.
6
+ * Uses @almadar/llm LLMClient directly.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ import { z } from 'zod';
11
+ import { type LLMProvider } from '@almadar/llm';
12
+ import type { SSEEvent, SSEEventType } from '../api-types.js';
13
+ export type SubagentEventCallback = (orbitalName: string, orbitalIndex: number, totalOrbitals: number, event: {
14
+ type: Exclude<SSEEventType, 'subagent_event'>;
15
+ data: Record<string, unknown>;
16
+ timestamp: number;
17
+ }) => void;
18
+ export type OrbitalCompleteCallback = (orbital: unknown, orbitalName: string, orbitalIndex: number, totalOrbitals: number) => void | Promise<void>;
19
+ export interface OrbitalRequirements {
20
+ entities?: string[];
21
+ states?: string[];
22
+ events?: string[];
23
+ guards?: string[];
24
+ pages?: string[];
25
+ effects?: string[];
26
+ rawRequirements?: string[];
27
+ }
28
+ export interface OrbitalSubagentToolOptions {
29
+ onSubagentEvent?: SubagentEventCallback;
30
+ onOrbitalComplete?: OrbitalCompleteCallback;
31
+ requirements?: OrbitalRequirements;
32
+ /** LLM provider for orbital generation subagent. Defaults to 'anthropic' */
33
+ provider?: LLMProvider;
34
+ /** Model name for orbital generation subagent. Defaults to 'claude-sonnet-4-20250514' */
35
+ model?: string;
36
+ /** Working directory for persisting orbital files. When set, orbitals are written to .orbitals/ */
37
+ workDir?: string;
38
+ }
39
+ /**
40
+ * Create a tool for generating orbitals with subagent event streaming.
41
+ * Uses @almadar/llm LLMClient directly.
42
+ */
43
+ export declare function createOrbitalSubagentTool(options?: OrbitalSubagentToolOptions): {
44
+ tool: import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
45
+ orbital: z.ZodObject<{
46
+ name: z.ZodString;
47
+ entity: z.ZodObject<{
48
+ name: z.ZodString;
49
+ persistence: z.ZodEnum<["persistent", "runtime", "singleton", "instance"]>;
50
+ fields: z.ZodArray<z.ZodObject<{
51
+ name: z.ZodString;
52
+ type: z.ZodString;
53
+ required: z.ZodOptional<z.ZodBoolean>;
54
+ }, "strip", z.ZodTypeAny, {
55
+ type: string;
56
+ name: string;
57
+ required?: boolean | undefined;
58
+ }, {
59
+ type: string;
60
+ name: string;
61
+ required?: boolean | undefined;
62
+ }>, "many">;
63
+ }, "strip", z.ZodTypeAny, {
64
+ name: string;
65
+ fields: {
66
+ type: string;
67
+ name: string;
68
+ required?: boolean | undefined;
69
+ }[];
70
+ persistence: "persistent" | "runtime" | "singleton" | "instance";
71
+ }, {
72
+ name: string;
73
+ fields: {
74
+ type: string;
75
+ name: string;
76
+ required?: boolean | undefined;
77
+ }[];
78
+ persistence: "persistent" | "runtime" | "singleton" | "instance";
79
+ }>;
80
+ traits: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
81
+ patterns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
82
+ pages: z.ZodOptional<z.ZodArray<z.ZodObject<{
83
+ name: z.ZodString;
84
+ path: z.ZodString;
85
+ viewType: z.ZodString;
86
+ }, "strip", z.ZodTypeAny, {
87
+ path: string;
88
+ name: string;
89
+ viewType: string;
90
+ }, {
91
+ path: string;
92
+ name: string;
93
+ viewType: string;
94
+ }>, "many">>;
95
+ domainContext: z.ZodOptional<z.ZodObject<{
96
+ request: z.ZodString;
97
+ requestFragment: z.ZodOptional<z.ZodString>;
98
+ category: z.ZodEnum<["game", "business", "dashboard", "form", "content", "social", "ecommerce", "workflow"]>;
99
+ vocabulary: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
100
+ }, "strip", z.ZodTypeAny, {
101
+ request: string;
102
+ category: "game" | "business" | "dashboard" | "form" | "content" | "social" | "ecommerce" | "workflow";
103
+ requestFragment?: string | undefined;
104
+ vocabulary?: Record<string, string> | undefined;
105
+ }, {
106
+ request: string;
107
+ category: "game" | "business" | "dashboard" | "form" | "content" | "social" | "ecommerce" | "workflow";
108
+ requestFragment?: string | undefined;
109
+ vocabulary?: Record<string, string> | undefined;
110
+ }>>;
111
+ design: z.ZodOptional<z.ZodObject<{
112
+ style: z.ZodOptional<z.ZodEnum<["minimal", "modern", "playful", "data-driven", "immersive"]>>;
113
+ uxHints: z.ZodOptional<z.ZodObject<{
114
+ flowPattern: z.ZodOptional<z.ZodString>;
115
+ listPattern: z.ZodOptional<z.ZodString>;
116
+ formPattern: z.ZodOptional<z.ZodString>;
117
+ detailPattern: z.ZodOptional<z.ZodString>;
118
+ }, "strip", z.ZodTypeAny, {
119
+ flowPattern?: string | undefined;
120
+ listPattern?: string | undefined;
121
+ formPattern?: string | undefined;
122
+ detailPattern?: string | undefined;
123
+ }, {
124
+ flowPattern?: string | undefined;
125
+ listPattern?: string | undefined;
126
+ formPattern?: string | undefined;
127
+ detailPattern?: string | undefined;
128
+ }>>;
129
+ }, "strip", z.ZodTypeAny, {
130
+ style?: "minimal" | "modern" | "playful" | "data-driven" | "immersive" | undefined;
131
+ uxHints?: {
132
+ flowPattern?: string | undefined;
133
+ listPattern?: string | undefined;
134
+ formPattern?: string | undefined;
135
+ detailPattern?: string | undefined;
136
+ } | undefined;
137
+ }, {
138
+ style?: "minimal" | "modern" | "playful" | "data-driven" | "immersive" | undefined;
139
+ uxHints?: {
140
+ flowPattern?: string | undefined;
141
+ listPattern?: string | undefined;
142
+ formPattern?: string | undefined;
143
+ detailPattern?: string | undefined;
144
+ } | undefined;
145
+ }>>;
146
+ emits: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
147
+ listens: z.ZodOptional<z.ZodArray<z.ZodObject<{
148
+ event: z.ZodString;
149
+ triggers: z.ZodString;
150
+ }, "strip", z.ZodTypeAny, {
151
+ event: string;
152
+ triggers: string;
153
+ }, {
154
+ event: string;
155
+ triggers: string;
156
+ }>, "many">>;
157
+ relations: z.ZodOptional<z.ZodArray<z.ZodObject<{
158
+ entity: z.ZodString;
159
+ alias: z.ZodOptional<z.ZodString>;
160
+ cardinality: z.ZodEnum<["one", "many"]>;
161
+ }, "strip", z.ZodTypeAny, {
162
+ entity: string;
163
+ cardinality: "many" | "one";
164
+ alias?: string | undefined;
165
+ }, {
166
+ entity: string;
167
+ cardinality: "many" | "one";
168
+ alias?: string | undefined;
169
+ }>, "many">>;
170
+ }, "strip", z.ZodTypeAny, {
171
+ traits: string[];
172
+ name: string;
173
+ entity: {
174
+ name: string;
175
+ fields: {
176
+ type: string;
177
+ name: string;
178
+ required?: boolean | undefined;
179
+ }[];
180
+ persistence: "persistent" | "runtime" | "singleton" | "instance";
181
+ };
182
+ pages?: {
183
+ path: string;
184
+ name: string;
185
+ viewType: string;
186
+ }[] | undefined;
187
+ relations?: {
188
+ entity: string;
189
+ cardinality: "many" | "one";
190
+ alias?: string | undefined;
191
+ }[] | undefined;
192
+ patterns?: string[] | undefined;
193
+ domainContext?: {
194
+ request: string;
195
+ category: "game" | "business" | "dashboard" | "form" | "content" | "social" | "ecommerce" | "workflow";
196
+ requestFragment?: string | undefined;
197
+ vocabulary?: Record<string, string> | undefined;
198
+ } | undefined;
199
+ design?: {
200
+ style?: "minimal" | "modern" | "playful" | "data-driven" | "immersive" | undefined;
201
+ uxHints?: {
202
+ flowPattern?: string | undefined;
203
+ listPattern?: string | undefined;
204
+ formPattern?: string | undefined;
205
+ detailPattern?: string | undefined;
206
+ } | undefined;
207
+ } | undefined;
208
+ emits?: string[] | undefined;
209
+ listens?: {
210
+ event: string;
211
+ triggers: string;
212
+ }[] | undefined;
213
+ }, {
214
+ name: string;
215
+ entity: {
216
+ name: string;
217
+ fields: {
218
+ type: string;
219
+ name: string;
220
+ required?: boolean | undefined;
221
+ }[];
222
+ persistence: "persistent" | "runtime" | "singleton" | "instance";
223
+ };
224
+ pages?: {
225
+ path: string;
226
+ name: string;
227
+ viewType: string;
228
+ }[] | undefined;
229
+ traits?: string[] | undefined;
230
+ relations?: {
231
+ entity: string;
232
+ cardinality: "many" | "one";
233
+ alias?: string | undefined;
234
+ }[] | undefined;
235
+ patterns?: string[] | undefined;
236
+ domainContext?: {
237
+ request: string;
238
+ category: "game" | "business" | "dashboard" | "form" | "content" | "social" | "ecommerce" | "workflow";
239
+ requestFragment?: string | undefined;
240
+ vocabulary?: Record<string, string> | undefined;
241
+ } | undefined;
242
+ design?: {
243
+ style?: "minimal" | "modern" | "playful" | "data-driven" | "immersive" | undefined;
244
+ uxHints?: {
245
+ flowPattern?: string | undefined;
246
+ listPattern?: string | undefined;
247
+ formPattern?: string | undefined;
248
+ detailPattern?: string | undefined;
249
+ } | undefined;
250
+ } | undefined;
251
+ emits?: string[] | undefined;
252
+ listens?: {
253
+ event: string;
254
+ triggers: string;
255
+ }[] | undefined;
256
+ }>;
257
+ orbitalIndex: z.ZodOptional<z.ZodNumber>;
258
+ totalOrbitals: z.ZodOptional<z.ZodNumber>;
259
+ }, "strip", z.ZodTypeAny, {
260
+ orbital: {
261
+ traits: string[];
262
+ name: string;
263
+ entity: {
264
+ name: string;
265
+ fields: {
266
+ type: string;
267
+ name: string;
268
+ required?: boolean | undefined;
269
+ }[];
270
+ persistence: "persistent" | "runtime" | "singleton" | "instance";
271
+ };
272
+ pages?: {
273
+ path: string;
274
+ name: string;
275
+ viewType: string;
276
+ }[] | undefined;
277
+ relations?: {
278
+ entity: string;
279
+ cardinality: "many" | "one";
280
+ alias?: string | undefined;
281
+ }[] | undefined;
282
+ patterns?: string[] | undefined;
283
+ domainContext?: {
284
+ request: string;
285
+ category: "game" | "business" | "dashboard" | "form" | "content" | "social" | "ecommerce" | "workflow";
286
+ requestFragment?: string | undefined;
287
+ vocabulary?: Record<string, string> | undefined;
288
+ } | undefined;
289
+ design?: {
290
+ style?: "minimal" | "modern" | "playful" | "data-driven" | "immersive" | undefined;
291
+ uxHints?: {
292
+ flowPattern?: string | undefined;
293
+ listPattern?: string | undefined;
294
+ formPattern?: string | undefined;
295
+ detailPattern?: string | undefined;
296
+ } | undefined;
297
+ } | undefined;
298
+ emits?: string[] | undefined;
299
+ listens?: {
300
+ event: string;
301
+ triggers: string;
302
+ }[] | undefined;
303
+ };
304
+ orbitalIndex?: number | undefined;
305
+ totalOrbitals?: number | undefined;
306
+ }, {
307
+ orbital: {
308
+ name: string;
309
+ entity: {
310
+ name: string;
311
+ fields: {
312
+ type: string;
313
+ name: string;
314
+ required?: boolean | undefined;
315
+ }[];
316
+ persistence: "persistent" | "runtime" | "singleton" | "instance";
317
+ };
318
+ pages?: {
319
+ path: string;
320
+ name: string;
321
+ viewType: string;
322
+ }[] | undefined;
323
+ traits?: string[] | undefined;
324
+ relations?: {
325
+ entity: string;
326
+ cardinality: "many" | "one";
327
+ alias?: string | undefined;
328
+ }[] | undefined;
329
+ patterns?: string[] | undefined;
330
+ domainContext?: {
331
+ request: string;
332
+ category: "game" | "business" | "dashboard" | "form" | "content" | "social" | "ecommerce" | "workflow";
333
+ requestFragment?: string | undefined;
334
+ vocabulary?: Record<string, string> | undefined;
335
+ } | undefined;
336
+ design?: {
337
+ style?: "minimal" | "modern" | "playful" | "data-driven" | "immersive" | undefined;
338
+ uxHints?: {
339
+ flowPattern?: string | undefined;
340
+ listPattern?: string | undefined;
341
+ formPattern?: string | undefined;
342
+ detailPattern?: string | undefined;
343
+ } | undefined;
344
+ } | undefined;
345
+ emits?: string[] | undefined;
346
+ listens?: {
347
+ event: string;
348
+ triggers: string;
349
+ }[] | undefined;
350
+ };
351
+ orbitalIndex?: number | undefined;
352
+ totalOrbitals?: number | undefined;
353
+ }>, {
354
+ orbital: {
355
+ traits: string[];
356
+ name: string;
357
+ entity: {
358
+ name: string;
359
+ fields: {
360
+ type: string;
361
+ name: string;
362
+ required?: boolean | undefined;
363
+ }[];
364
+ persistence: "persistent" | "runtime" | "singleton" | "instance";
365
+ };
366
+ pages?: {
367
+ path: string;
368
+ name: string;
369
+ viewType: string;
370
+ }[] | undefined;
371
+ relations?: {
372
+ entity: string;
373
+ cardinality: "many" | "one";
374
+ alias?: string | undefined;
375
+ }[] | undefined;
376
+ patterns?: string[] | undefined;
377
+ domainContext?: {
378
+ request: string;
379
+ category: "game" | "business" | "dashboard" | "form" | "content" | "social" | "ecommerce" | "workflow";
380
+ requestFragment?: string | undefined;
381
+ vocabulary?: Record<string, string> | undefined;
382
+ } | undefined;
383
+ design?: {
384
+ style?: "minimal" | "modern" | "playful" | "data-driven" | "immersive" | undefined;
385
+ uxHints?: {
386
+ flowPattern?: string | undefined;
387
+ listPattern?: string | undefined;
388
+ formPattern?: string | undefined;
389
+ detailPattern?: string | undefined;
390
+ } | undefined;
391
+ } | undefined;
392
+ emits?: string[] | undefined;
393
+ listens?: {
394
+ event: string;
395
+ triggers: string;
396
+ }[] | undefined;
397
+ };
398
+ orbitalIndex?: number | undefined;
399
+ totalOrbitals?: number | undefined;
400
+ }, {
401
+ orbital: {
402
+ name: string;
403
+ entity: {
404
+ name: string;
405
+ fields: {
406
+ type: string;
407
+ name: string;
408
+ required?: boolean | undefined;
409
+ }[];
410
+ persistence: "persistent" | "runtime" | "singleton" | "instance";
411
+ };
412
+ pages?: {
413
+ path: string;
414
+ name: string;
415
+ viewType: string;
416
+ }[] | undefined;
417
+ traits?: string[] | undefined;
418
+ relations?: {
419
+ entity: string;
420
+ cardinality: "many" | "one";
421
+ alias?: string | undefined;
422
+ }[] | undefined;
423
+ patterns?: string[] | undefined;
424
+ domainContext?: {
425
+ request: string;
426
+ category: "game" | "business" | "dashboard" | "form" | "content" | "social" | "ecommerce" | "workflow";
427
+ requestFragment?: string | undefined;
428
+ vocabulary?: Record<string, string> | undefined;
429
+ } | undefined;
430
+ design?: {
431
+ style?: "minimal" | "modern" | "playful" | "data-driven" | "immersive" | undefined;
432
+ uxHints?: {
433
+ flowPattern?: string | undefined;
434
+ listPattern?: string | undefined;
435
+ formPattern?: string | undefined;
436
+ detailPattern?: string | undefined;
437
+ } | undefined;
438
+ } | undefined;
439
+ emits?: string[] | undefined;
440
+ listens?: {
441
+ event: string;
442
+ triggers: string;
443
+ }[] | undefined;
444
+ };
445
+ orbitalIndex?: number | undefined;
446
+ totalOrbitals?: number | undefined;
447
+ }, string, "generate_orbital">;
448
+ setEventCallback: (callback: SubagentEventCallback) => void;
449
+ setOrbitalCompleteCallback: (callback: OrbitalCompleteCallback) => void;
450
+ };
451
+ /**
452
+ * Create a helper to wrap subagent events into SSE format.
453
+ */
454
+ export declare function createSubagentEventWrapper(writeEvent: (event: SSEEvent) => void): SubagentEventCallback;
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Orchestrated Fixing Tool
3
+ *
4
+ * Uses Plan-Then-Execute with Multi-Provider strategy for fixing:
5
+ * - Plan: Analyze errors and create fix plan
6
+ * - Execute: Apply fixes with skill context
7
+ * - Verify: Validate the fixed schema
8
+ */
9
+ import { z } from 'zod';
10
+ import type { OrbitalSchema } from '@almadar/core';
11
+ export interface OrchestratedFixingOptions {
12
+ /** Skill content for fixing guidance (e.g., kflow-orbital-fixing SKILL.md) */
13
+ skillContent: string;
14
+ /** Optional: Max retries for fixing */
15
+ maxRetries?: number;
16
+ /** Optional: Override verbosity */
17
+ verbose?: boolean;
18
+ }
19
+ export interface OrchestratedFixingResult {
20
+ success: boolean;
21
+ schema?: OrbitalSchema;
22
+ fixSummary?: {
23
+ totalErrors: number;
24
+ errorsFixed: number;
25
+ errorsRemaining: number;
26
+ strategy: string;
27
+ stepsExecuted: number;
28
+ };
29
+ timing?: {
30
+ planMs: number;
31
+ executeMs: number;
32
+ verifyMs: number;
33
+ totalMs: number;
34
+ };
35
+ error?: string;
36
+ }
37
+ /**
38
+ * Create an orchestrated fixing tool.
39
+ *
40
+ * This tool uses Plan-Then-Execute strategy:
41
+ * 1. Analyze errors and create fix plan
42
+ * 2. Execute fixes with skill context (multi-provider for complex cases)
43
+ * 3. Verify and retry if needed
44
+ */
45
+ export declare function createOrchestratedFixingTool(options: OrchestratedFixingOptions): import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
46
+ schema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
47
+ }, "strip", z.ZodTypeAny, {
48
+ schema: {};
49
+ }, {
50
+ schema: {};
51
+ }>, {
52
+ schema: {};
53
+ }, {
54
+ schema: {};
55
+ }, OrchestratedFixingResult, "fix_schema_orchestrated">;
56
+ /**
57
+ * Create a validation-only tool (no fixing).
58
+ * Useful for checking schema validity before/after other operations.
59
+ */
60
+ export declare function createValidateTool(): import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
61
+ schema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
62
+ }, "strip", z.ZodTypeAny, {
63
+ schema: {};
64
+ }, {
65
+ schema: {};
66
+ }>, {
67
+ schema: {};
68
+ }, {
69
+ schema: {};
70
+ }, {
71
+ valid: boolean;
72
+ errorCount: number;
73
+ errors: unknown[];
74
+ }, "validate_schema">;
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Orchestrated Generation Tool
3
+ *
4
+ * Uses the complexity-based provider router for generation:
5
+ * - Simple/Medium (1-3 orbitals) → Qwen
6
+ * - Complex (4+ orbitals) → Multi-provider parallel
7
+ *
8
+ * This tool can be used by skill agents to generate schemas
9
+ * with automatic provider selection based on complexity.
10
+ */
11
+ import { z } from 'zod';
12
+ export interface OrchestratedGenerationOptions {
13
+ /** Skill content for generation guidance */
14
+ skillContent: string;
15
+ /** Optional: Override verbosity */
16
+ verbose?: boolean;
17
+ /** Working directory for persisting schema and orbital files */
18
+ workDir?: string;
19
+ }
20
+ export interface OrchestratedGenerationResult {
21
+ success: boolean;
22
+ summary?: string;
23
+ orbitalCount?: number;
24
+ schemaPath?: string;
25
+ complexity?: {
26
+ level: 'simple' | 'medium' | 'complex';
27
+ orbitalCount: number;
28
+ };
29
+ provider?: string;
30
+ timing?: {
31
+ decomposeMs: number;
32
+ generateMs: number;
33
+ totalMs: number;
34
+ };
35
+ error?: string;
36
+ }
37
+ /**
38
+ * Create an orchestrated generation tool.
39
+ *
40
+ * This tool uses complexity-based routing:
41
+ * - Decomposes the request with Anthropic
42
+ * - Routes to appropriate provider(s) based on complexity
43
+ * - Returns the generated schema
44
+ */
45
+ export declare function createOrchestratedGenerationTool(options: OrchestratedGenerationOptions): import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
46
+ prompt: z.ZodString;
47
+ }, "strip", z.ZodTypeAny, {
48
+ prompt: string;
49
+ }, {
50
+ prompt: string;
51
+ }>, {
52
+ prompt: string;
53
+ }, {
54
+ prompt: string;
55
+ }, OrchestratedGenerationResult, "generate_schema_orchestrated">;
56
+ /**
57
+ * Create a tool that provides complexity estimation without full generation.
58
+ * Useful for UI feedback before starting generation.
59
+ */
60
+ export declare function createComplexityCheckTool(): import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
61
+ prompt: z.ZodString;
62
+ }, "strip", z.ZodTypeAny, {
63
+ prompt: string;
64
+ }, {
65
+ prompt: string;
66
+ }>, {
67
+ prompt: string;
68
+ }, {
69
+ prompt: string;
70
+ }, {
71
+ estimatedOrbitals: number;
72
+ confidence: "medium" | "high" | "low";
73
+ likelyComplex: boolean;
74
+ recommendedStrategy: string;
75
+ }, "check_complexity">;