@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.
- package/dist/agent/event-budget.d.ts +28 -0
- package/dist/agent/experimental/hitl-v2.d.ts +161 -0
- package/dist/agent/experimental/hitl-workflow-integration.d.ts +182 -0
- package/dist/agent/index.d.ts +14 -0
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/interrupt-config.d.ts +51 -0
- package/dist/agent/session-manager.d.ts +204 -0
- package/dist/agent/skill-agent.d.ts +182 -0
- package/dist/agent/workflow-middleware.d.ts +63 -0
- package/dist/agent/workflow-tool-wrapper.d.ts +87 -0
- package/dist/api-types.d.ts +595 -0
- package/dist/context/compaction.d.ts +191 -0
- package/dist/context-compaction.d.ts +55 -0
- package/dist/evals/online-sampling.d.ts +114 -0
- package/dist/evals/utils/compact-orbital.d.ts +100 -0
- package/dist/event-transformer/event-transformer.d.ts +120 -0
- package/dist/event-transformer/index.d.ts +7 -0
- package/dist/events.d.ts +85 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.js.map +1 -1
- package/dist/memory/MemoryManager.d.ts +243 -0
- package/dist/memory/PreferenceLearner.d.ts +59 -0
- package/dist/memory/agentic-search.d.ts +116 -0
- package/dist/memory/index.d.ts +14 -0
- package/dist/memory/memory-orbital.d.ts +66 -0
- package/dist/memory/types.d.ts +143 -0
- package/dist/metrics.d.ts +77 -0
- package/dist/multi-user.d.ts +155 -0
- package/dist/observability/index.d.ts +14 -0
- package/dist/observability/langsmith-integration.d.ts +203 -0
- package/dist/observability.d.ts +196 -0
- package/dist/orbitals/archive/sanitize.d.ts +24 -0
- package/dist/orbitals/batch/batch-generator.d.ts +41 -0
- package/dist/orbitals/batch/concurrency.d.ts +54 -0
- package/dist/orbitals/batch/index.d.ts +14 -0
- package/dist/orbitals/batch/prompt-assembler.d.ts +92 -0
- package/dist/orbitals/batch/types.d.ts +103 -0
- package/dist/orbitals/cache/index.d.ts +11 -0
- package/dist/orbitals/cache/orbital-fingerprint.d.ts +37 -0
- package/dist/orbitals/cache/prompt-assembler.d.ts +65 -0
- package/dist/orbitals/cache/structural-templates.d.ts +33 -0
- package/dist/orbitals/combiner/index.d.ts +102 -0
- package/dist/orbitals/domain-language/index.d.ts +9 -0
- package/dist/orbitals/domain-language/prompts/index.d.ts +11 -0
- package/dist/orbitals/domain-language/prompts/odl-examples.d.ts +8 -0
- package/dist/orbitals/domain-language/prompts/odl-patterns.d.ts +8 -0
- package/dist/orbitals/domain-language/prompts/odl-syntax.d.ts +8 -0
- package/dist/orbitals/domain-language/prompts/odl-to-schema.d.ts +8 -0
- package/dist/orbitals/generation/index.d.ts +10 -0
- package/dist/orbitals/generation/orbital-generator.d.ts +120 -0
- package/dist/orbitals/shared/constants.d.ts +65 -0
- package/dist/orbitals/shared/index.d.ts +11 -0
- package/dist/orbitals/shared/types.d.ts +187 -0
- package/dist/orbitals/shared/utils.d.ts +97 -0
- package/dist/orchestration/complexity-classifier.d.ts +38 -0
- package/dist/orchestration/fixing-orchestrator.d.ts +53 -0
- package/dist/orchestration/index.d.ts +31 -0
- package/dist/orchestration/provider-router.d.ts +45 -0
- package/dist/persistence/firestore-checkpointer.d.ts +139 -0
- package/dist/persistence/firestore-session-store.d.ts +75 -0
- package/dist/persistence/firestore-store.d.ts +86 -0
- package/dist/persistence/index.d.ts +10 -0
- package/dist/persistence/memory-backend.d.ts +33 -0
- package/dist/persistence/types.d.ts +40 -0
- package/dist/security/audit-log.d.ts +44 -0
- package/dist/state-sync.d.ts +171 -0
- package/dist/subagents.d.ts +38 -0
- package/dist/tools/combine-schemas.d.ts +154 -0
- package/dist/tools/composition.d.ts +119 -0
- package/dist/tools/domain-orbital.d.ts +997 -0
- package/dist/tools/execute.d.ts +38 -0
- package/dist/tools/finish-task.d.ts +56 -0
- package/dist/tools/generate-schema.d.ts +53 -0
- package/dist/tools/github.d.ts +297 -0
- package/dist/tools/index.d.ts +1318 -0
- package/dist/tools/orbital-batch-subagent.d.ts +85 -0
- package/dist/tools/orbital-subagent.d.ts +454 -0
- package/dist/tools/orchestrated-fixing.d.ts +74 -0
- package/dist/tools/orchestrated-generation.d.ts +75 -0
- package/dist/tools/sandbox-executor.d.ts +31 -0
- package/dist/tools/schema-chunking.d.ts +117 -0
- package/dist/tools/trait-subagent.d.ts +179 -0
- package/dist/tools/validate-schema.d.ts +17 -0
- package/dist/types.d.ts +167 -0
- package/dist/utils/safety/capability-token.d.ts +50 -0
- package/dist/utils/safety/circuit-breaker.d.ts +71 -0
- package/dist/utils/safety/index.d.ts +19 -0
- package/dist/utils/safety/rate-limiter.d.ts +39 -0
- package/dist/utils/safety/threshold-auth.d.ts +70 -0
- package/dist/workspace/git-client.d.ts +51 -0
- package/dist/workspace/index.d.ts +38 -0
- package/dist/workspace/memory-files.d.ts +31 -0
- package/dist/workspace/sink-manager.d.ts +26 -0
- package/dist/workspace/sinks/firestore-sink.d.ts +41 -0
- package/dist/workspace/sinks/git-sink.d.ts +47 -0
- package/dist/workspace/sinks/index.d.ts +9 -0
- package/dist/workspace/templates.d.ts +32 -0
- package/dist/workspace/types.d.ts +86 -0
- package/dist/workspace/workspace-manager.d.ts +57 -0
- package/package.json +7 -6
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DeepAgent API Types
|
|
3
|
+
*
|
|
4
|
+
* Request/response types for the skills-only DeepAgent API.
|
|
5
|
+
* All agent behavior is defined through skills - no custom prompts allowed.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
/**
|
|
11
|
+
* Extracted requirements schema - from analysis phase.
|
|
12
|
+
* Used to provide more precise generation guidance.
|
|
13
|
+
*/
|
|
14
|
+
export declare const ExtractedRequirementsSchema: z.ZodObject<{
|
|
15
|
+
/** Entity names to create */
|
|
16
|
+
entities: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
17
|
+
/** State names that should exist */
|
|
18
|
+
states: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
19
|
+
/** Event/action names */
|
|
20
|
+
events: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
21
|
+
/** Business rules (become guards) */
|
|
22
|
+
guards: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
23
|
+
/** Page types needed */
|
|
24
|
+
pages: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
25
|
+
/** Notifications/side-effects */
|
|
26
|
+
effects: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
27
|
+
/** Raw requirement statements */
|
|
28
|
+
rawRequirements: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
entities: string[];
|
|
31
|
+
states: string[];
|
|
32
|
+
events: string[];
|
|
33
|
+
guards: string[];
|
|
34
|
+
pages: string[];
|
|
35
|
+
effects: string[];
|
|
36
|
+
rawRequirements: string[];
|
|
37
|
+
}, {
|
|
38
|
+
entities?: string[] | undefined;
|
|
39
|
+
states?: string[] | undefined;
|
|
40
|
+
events?: string[] | undefined;
|
|
41
|
+
guards?: string[] | undefined;
|
|
42
|
+
pages?: string[] | undefined;
|
|
43
|
+
effects?: string[] | undefined;
|
|
44
|
+
rawRequirements?: string[] | undefined;
|
|
45
|
+
}>;
|
|
46
|
+
export type ExtractedRequirementsInput = z.infer<typeof ExtractedRequirementsSchema>;
|
|
47
|
+
/**
|
|
48
|
+
* Generate request schema - skills only, no custom prompts.
|
|
49
|
+
*/
|
|
50
|
+
export declare const GenerateRequestSchema: z.ZodObject<{
|
|
51
|
+
/** Required: The skill(s) to use for this generation */
|
|
52
|
+
skill: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
|
|
53
|
+
/** The user's task/message */
|
|
54
|
+
message: z.ZodString;
|
|
55
|
+
/** Optional: Thread ID for session continuity */
|
|
56
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
57
|
+
/** Optional: Workspace directory (defaults to temp dir) */
|
|
58
|
+
workspace: z.ZodOptional<z.ZodString>;
|
|
59
|
+
/** Optional: LLM provider */
|
|
60
|
+
provider: z.ZodOptional<z.ZodEnum<["anthropic", "openai", "deepseek", "kimi", "openrouter"]>>;
|
|
61
|
+
/** Optional: Model name */
|
|
62
|
+
model: z.ZodOptional<z.ZodString>;
|
|
63
|
+
/** Optional: Disable human-in-the-loop interrupts (for eval/testing) */
|
|
64
|
+
noInterrupt: z.ZodOptional<z.ZodBoolean>;
|
|
65
|
+
/** Optional: App ID for persisting schema to Firestore */
|
|
66
|
+
appId: z.ZodOptional<z.ZodString>;
|
|
67
|
+
/** Optional: Extracted requirements from analysis phase (for orbital skill) */
|
|
68
|
+
requirements: z.ZodOptional<z.ZodObject<{
|
|
69
|
+
/** Entity names to create */
|
|
70
|
+
entities: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
71
|
+
/** State names that should exist */
|
|
72
|
+
states: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
73
|
+
/** Event/action names */
|
|
74
|
+
events: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
75
|
+
/** Business rules (become guards) */
|
|
76
|
+
guards: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
77
|
+
/** Page types needed */
|
|
78
|
+
pages: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
79
|
+
/** Notifications/side-effects */
|
|
80
|
+
effects: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
81
|
+
/** Raw requirement statements */
|
|
82
|
+
rawRequirements: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
83
|
+
}, "strip", z.ZodTypeAny, {
|
|
84
|
+
entities: string[];
|
|
85
|
+
states: string[];
|
|
86
|
+
events: string[];
|
|
87
|
+
guards: string[];
|
|
88
|
+
pages: string[];
|
|
89
|
+
effects: string[];
|
|
90
|
+
rawRequirements: string[];
|
|
91
|
+
}, {
|
|
92
|
+
entities?: string[] | undefined;
|
|
93
|
+
states?: string[] | undefined;
|
|
94
|
+
events?: string[] | undefined;
|
|
95
|
+
guards?: string[] | undefined;
|
|
96
|
+
pages?: string[] | undefined;
|
|
97
|
+
effects?: string[] | undefined;
|
|
98
|
+
rawRequirements?: string[] | undefined;
|
|
99
|
+
}>>;
|
|
100
|
+
/** Optional: GitHub integration configuration */
|
|
101
|
+
github: z.ZodOptional<z.ZodObject<{
|
|
102
|
+
/** GitHub personal access token */
|
|
103
|
+
token: z.ZodString;
|
|
104
|
+
/** Repository owner (e.g., 'octocat') */
|
|
105
|
+
owner: z.ZodOptional<z.ZodString>;
|
|
106
|
+
/** Repository name (e.g., 'hello-world') */
|
|
107
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
108
|
+
}, "strip", z.ZodTypeAny, {
|
|
109
|
+
token: string;
|
|
110
|
+
owner?: string | undefined;
|
|
111
|
+
repo?: string | undefined;
|
|
112
|
+
}, {
|
|
113
|
+
token: string;
|
|
114
|
+
owner?: string | undefined;
|
|
115
|
+
repo?: string | undefined;
|
|
116
|
+
}>>;
|
|
117
|
+
/** Optional: Use orchestrated generation with complexity-based provider routing (default: false) */
|
|
118
|
+
useOrchestration: z.ZodOptional<z.ZodBoolean>;
|
|
119
|
+
}, "strict", z.ZodTypeAny, {
|
|
120
|
+
message: string;
|
|
121
|
+
skill: string | string[];
|
|
122
|
+
threadId?: string | undefined;
|
|
123
|
+
workspace?: string | undefined;
|
|
124
|
+
provider?: "anthropic" | "openai" | "deepseek" | "kimi" | "openrouter" | undefined;
|
|
125
|
+
model?: string | undefined;
|
|
126
|
+
noInterrupt?: boolean | undefined;
|
|
127
|
+
appId?: string | undefined;
|
|
128
|
+
requirements?: {
|
|
129
|
+
entities: string[];
|
|
130
|
+
states: string[];
|
|
131
|
+
events: string[];
|
|
132
|
+
guards: string[];
|
|
133
|
+
pages: string[];
|
|
134
|
+
effects: string[];
|
|
135
|
+
rawRequirements: string[];
|
|
136
|
+
} | undefined;
|
|
137
|
+
github?: {
|
|
138
|
+
token: string;
|
|
139
|
+
owner?: string | undefined;
|
|
140
|
+
repo?: string | undefined;
|
|
141
|
+
} | undefined;
|
|
142
|
+
useOrchestration?: boolean | undefined;
|
|
143
|
+
}, {
|
|
144
|
+
message: string;
|
|
145
|
+
skill: string | string[];
|
|
146
|
+
threadId?: string | undefined;
|
|
147
|
+
workspace?: string | undefined;
|
|
148
|
+
provider?: "anthropic" | "openai" | "deepseek" | "kimi" | "openrouter" | undefined;
|
|
149
|
+
model?: string | undefined;
|
|
150
|
+
noInterrupt?: boolean | undefined;
|
|
151
|
+
appId?: string | undefined;
|
|
152
|
+
requirements?: {
|
|
153
|
+
entities?: string[] | undefined;
|
|
154
|
+
states?: string[] | undefined;
|
|
155
|
+
events?: string[] | undefined;
|
|
156
|
+
guards?: string[] | undefined;
|
|
157
|
+
pages?: string[] | undefined;
|
|
158
|
+
effects?: string[] | undefined;
|
|
159
|
+
rawRequirements?: string[] | undefined;
|
|
160
|
+
} | undefined;
|
|
161
|
+
github?: {
|
|
162
|
+
token: string;
|
|
163
|
+
owner?: string | undefined;
|
|
164
|
+
repo?: string | undefined;
|
|
165
|
+
} | undefined;
|
|
166
|
+
useOrchestration?: boolean | undefined;
|
|
167
|
+
}>;
|
|
168
|
+
export type GenerateRequest = z.infer<typeof GenerateRequestSchema>;
|
|
169
|
+
/**
|
|
170
|
+
* Resume request schema - for resuming after interrupt.
|
|
171
|
+
*/
|
|
172
|
+
export declare const ResumeRequestSchema: z.ZodObject<{
|
|
173
|
+
/** Required: Thread ID to resume */
|
|
174
|
+
threadId: z.ZodString;
|
|
175
|
+
/** Required: Decisions for pending interrupts */
|
|
176
|
+
decisions: z.ZodArray<z.ZodObject<{
|
|
177
|
+
type: z.ZodEnum<["approve", "edit", "reject"]>;
|
|
178
|
+
args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
179
|
+
}, "strip", z.ZodTypeAny, {
|
|
180
|
+
type: "approve" | "edit" | "reject";
|
|
181
|
+
args?: Record<string, unknown> | undefined;
|
|
182
|
+
}, {
|
|
183
|
+
type: "approve" | "edit" | "reject";
|
|
184
|
+
args?: Record<string, unknown> | undefined;
|
|
185
|
+
}>, "many">;
|
|
186
|
+
/** Optional: Approve all future actions */
|
|
187
|
+
approveAll: z.ZodOptional<z.ZodBoolean>;
|
|
188
|
+
}, "strip", z.ZodTypeAny, {
|
|
189
|
+
threadId: string;
|
|
190
|
+
decisions: {
|
|
191
|
+
type: "approve" | "edit" | "reject";
|
|
192
|
+
args?: Record<string, unknown> | undefined;
|
|
193
|
+
}[];
|
|
194
|
+
approveAll?: boolean | undefined;
|
|
195
|
+
}, {
|
|
196
|
+
threadId: string;
|
|
197
|
+
decisions: {
|
|
198
|
+
type: "approve" | "edit" | "reject";
|
|
199
|
+
args?: Record<string, unknown> | undefined;
|
|
200
|
+
}[];
|
|
201
|
+
approveAll?: boolean | undefined;
|
|
202
|
+
}>;
|
|
203
|
+
export type ResumeRequest = z.infer<typeof ResumeRequestSchema>;
|
|
204
|
+
/**
|
|
205
|
+
* Decision type for interrupt responses.
|
|
206
|
+
*/
|
|
207
|
+
export interface Decision {
|
|
208
|
+
type: 'approve' | 'edit' | 'reject';
|
|
209
|
+
args?: Record<string, unknown>;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Continue request schema - for multi-turn conversation.
|
|
213
|
+
*/
|
|
214
|
+
export declare const ContinueRequestSchema: z.ZodObject<{
|
|
215
|
+
/** Required: Thread ID to continue */
|
|
216
|
+
threadId: z.ZodString;
|
|
217
|
+
/** Required: Follow-up message */
|
|
218
|
+
message: z.ZodString;
|
|
219
|
+
}, "strip", z.ZodTypeAny, {
|
|
220
|
+
message: string;
|
|
221
|
+
threadId: string;
|
|
222
|
+
}, {
|
|
223
|
+
message: string;
|
|
224
|
+
threadId: string;
|
|
225
|
+
}>;
|
|
226
|
+
export type ContinueRequest = z.infer<typeof ContinueRequestSchema>;
|
|
227
|
+
/**
|
|
228
|
+
* All possible SSE event types.
|
|
229
|
+
*/
|
|
230
|
+
export type SSEEventType = 'start' | 'message' | 'tool_call' | 'tool_result' | 'todo_update' | 'todo_detail' | 'file_operation' | 'schema_update' | 'generation_log' | 'subagent_event' | 'interrupt' | 'error' | 'complete' | 'cancelled' | 'app_created' | 'schema_phase_validated' | 'schema_phase_update' | 'orbital_added' | 'orbital_schema_complete' | 'changeset_recorded' | 'snapshot_created';
|
|
231
|
+
/**
|
|
232
|
+
* Base SSE event structure.
|
|
233
|
+
*/
|
|
234
|
+
export interface SSEEventBase {
|
|
235
|
+
type: SSEEventType;
|
|
236
|
+
timestamp: number;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Start event - sent when streaming begins.
|
|
240
|
+
*/
|
|
241
|
+
export interface StartEvent extends SSEEventBase {
|
|
242
|
+
type: 'start';
|
|
243
|
+
data: {
|
|
244
|
+
threadId: string;
|
|
245
|
+
skill: string;
|
|
246
|
+
workDir: string;
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Message event - agent text output.
|
|
251
|
+
*/
|
|
252
|
+
export interface MessageEvent extends SSEEventBase {
|
|
253
|
+
type: 'message';
|
|
254
|
+
data: {
|
|
255
|
+
content: string;
|
|
256
|
+
role: 'assistant' | 'user' | 'system';
|
|
257
|
+
isComplete: boolean;
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Tool call event - when agent invokes a tool.
|
|
262
|
+
*/
|
|
263
|
+
export interface ToolCallEvent extends SSEEventBase {
|
|
264
|
+
type: 'tool_call';
|
|
265
|
+
data: {
|
|
266
|
+
tool: string;
|
|
267
|
+
args: Record<string, unknown>;
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Tool result event - tool execution result.
|
|
272
|
+
*/
|
|
273
|
+
export interface ToolResultEvent extends SSEEventBase {
|
|
274
|
+
type: 'tool_result';
|
|
275
|
+
data: {
|
|
276
|
+
tool: string;
|
|
277
|
+
result: unknown;
|
|
278
|
+
success: boolean;
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Todo update event - task progress.
|
|
283
|
+
*/
|
|
284
|
+
export interface TodoUpdateEvent extends SSEEventBase {
|
|
285
|
+
type: 'todo_update';
|
|
286
|
+
data: {
|
|
287
|
+
todos: Array<{
|
|
288
|
+
id: string;
|
|
289
|
+
task: string;
|
|
290
|
+
status: 'pending' | 'in_progress' | 'completed';
|
|
291
|
+
}>;
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Activity type for todo details.
|
|
296
|
+
*/
|
|
297
|
+
export type TodoActivityType = 'thinking' | 'tool_call' | 'tool_result' | 'code_change';
|
|
298
|
+
/**
|
|
299
|
+
* Todo detail event - shows LLM activity for a specific todo.
|
|
300
|
+
*/
|
|
301
|
+
export interface TodoDetailEvent extends SSEEventBase {
|
|
302
|
+
type: 'todo_detail';
|
|
303
|
+
data: {
|
|
304
|
+
todoId: string;
|
|
305
|
+
activityType: TodoActivityType;
|
|
306
|
+
content: string;
|
|
307
|
+
tool?: string;
|
|
308
|
+
args?: Record<string, unknown>;
|
|
309
|
+
success?: boolean;
|
|
310
|
+
filePath?: string;
|
|
311
|
+
diff?: string;
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* File operation event.
|
|
316
|
+
*/
|
|
317
|
+
export interface FileOperationEvent extends SSEEventBase {
|
|
318
|
+
type: 'file_operation';
|
|
319
|
+
data: {
|
|
320
|
+
operation: 'ls' | 'read_file' | 'write_file' | 'edit_file';
|
|
321
|
+
path: string;
|
|
322
|
+
success: boolean;
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Schema update event.
|
|
327
|
+
*/
|
|
328
|
+
export interface SchemaUpdateEvent extends SSEEventBase {
|
|
329
|
+
type: 'schema_update';
|
|
330
|
+
data: {
|
|
331
|
+
appId: string;
|
|
332
|
+
version: number;
|
|
333
|
+
schema: Record<string, unknown>;
|
|
334
|
+
isNew: boolean;
|
|
335
|
+
snapshotId?: string;
|
|
336
|
+
changesetId?: string;
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Generation log event.
|
|
341
|
+
*/
|
|
342
|
+
export interface GenerationLogEvent extends SSEEventBase {
|
|
343
|
+
type: 'generation_log';
|
|
344
|
+
data: {
|
|
345
|
+
level: 'info' | 'warn' | 'error' | 'debug';
|
|
346
|
+
message: string;
|
|
347
|
+
data?: Record<string, unknown>;
|
|
348
|
+
orbitalName?: string;
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Interrupt event - awaiting human decision.
|
|
353
|
+
*/
|
|
354
|
+
export interface InterruptEvent extends SSEEventBase {
|
|
355
|
+
type: 'interrupt';
|
|
356
|
+
data: {
|
|
357
|
+
threadId: string;
|
|
358
|
+
actionRequests: Array<{
|
|
359
|
+
tool: string;
|
|
360
|
+
args: Record<string, unknown>;
|
|
361
|
+
allowedDecisions: ('approve' | 'edit' | 'reject')[];
|
|
362
|
+
description?: string;
|
|
363
|
+
}>;
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Error event.
|
|
368
|
+
*/
|
|
369
|
+
export interface ErrorEvent extends SSEEventBase {
|
|
370
|
+
type: 'error';
|
|
371
|
+
data: {
|
|
372
|
+
error: string;
|
|
373
|
+
code?: string;
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Cancelled event.
|
|
378
|
+
*/
|
|
379
|
+
export interface CancelledEvent extends SSEEventBase {
|
|
380
|
+
type: 'cancelled';
|
|
381
|
+
data: {
|
|
382
|
+
threadId: string;
|
|
383
|
+
message: string;
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Complete event - when generation finishes.
|
|
388
|
+
*/
|
|
389
|
+
export interface CompleteEvent extends SSEEventBase {
|
|
390
|
+
type: 'complete';
|
|
391
|
+
data: {
|
|
392
|
+
threadId: string;
|
|
393
|
+
skill: string;
|
|
394
|
+
workDir: string;
|
|
395
|
+
schemaGenerated: boolean;
|
|
396
|
+
appCompiled: boolean;
|
|
397
|
+
schema?: Record<string, unknown>;
|
|
398
|
+
appId?: string;
|
|
399
|
+
schemaPersisted?: boolean;
|
|
400
|
+
snapshotId?: string;
|
|
401
|
+
changesetId?: string;
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Subagent event - forwards events from nested agent.
|
|
406
|
+
*/
|
|
407
|
+
export interface SubagentEvent extends SSEEventBase {
|
|
408
|
+
type: 'subagent_event';
|
|
409
|
+
data: {
|
|
410
|
+
orbitalName: string;
|
|
411
|
+
orbitalIndex: number;
|
|
412
|
+
totalOrbitals: number;
|
|
413
|
+
event: {
|
|
414
|
+
type: Exclude<SSEEventType, 'subagent_event'>;
|
|
415
|
+
data: Record<string, unknown>;
|
|
416
|
+
timestamp: number;
|
|
417
|
+
};
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* App created event.
|
|
422
|
+
*/
|
|
423
|
+
export interface AppCreatedEvent extends SSEEventBase {
|
|
424
|
+
type: 'app_created';
|
|
425
|
+
data: {
|
|
426
|
+
appId: string;
|
|
427
|
+
name?: string;
|
|
428
|
+
orbitalCount?: number;
|
|
429
|
+
fromOrbitalPersistence?: boolean;
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Schema phase validated event.
|
|
434
|
+
*/
|
|
435
|
+
export interface SchemaPhaseValidatedEvent extends SSEEventBase {
|
|
436
|
+
type: 'schema_phase_validated';
|
|
437
|
+
data: {
|
|
438
|
+
appId: string;
|
|
439
|
+
success: boolean;
|
|
440
|
+
errors?: unknown[];
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Schema phase update event.
|
|
445
|
+
*/
|
|
446
|
+
export interface SchemaPhaseUpdateEvent extends SSEEventBase {
|
|
447
|
+
type: 'schema_phase_update';
|
|
448
|
+
data: Record<string, unknown>;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Orbital added event.
|
|
452
|
+
*/
|
|
453
|
+
export interface OrbitalAddedEvent extends SSEEventBase {
|
|
454
|
+
type: 'orbital_added';
|
|
455
|
+
data: {
|
|
456
|
+
appId: string;
|
|
457
|
+
orbitalName: string;
|
|
458
|
+
orbitalIndex: number;
|
|
459
|
+
totalOrbitals: number;
|
|
460
|
+
isNew?: boolean;
|
|
461
|
+
orbitalSchema?: Record<string, unknown>;
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Orbital schema complete event.
|
|
466
|
+
*/
|
|
467
|
+
export interface OrbitalSchemaCompleteEvent extends SSEEventBase {
|
|
468
|
+
type: 'orbital_schema_complete';
|
|
469
|
+
data: {
|
|
470
|
+
appId: string;
|
|
471
|
+
totalOrbitals: number;
|
|
472
|
+
orbitalNames: string[];
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Changeset recorded event.
|
|
477
|
+
*/
|
|
478
|
+
export interface ChangesetRecordedEvent extends SSEEventBase {
|
|
479
|
+
type: 'changeset_recorded';
|
|
480
|
+
data: {
|
|
481
|
+
appId: string;
|
|
482
|
+
changesetId: string;
|
|
483
|
+
version: number;
|
|
484
|
+
trackingMode: 'initial' | 'update';
|
|
485
|
+
summary: {
|
|
486
|
+
added: number;
|
|
487
|
+
modified: number;
|
|
488
|
+
removed: number;
|
|
489
|
+
};
|
|
490
|
+
source?: string;
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Snapshot created event.
|
|
495
|
+
*/
|
|
496
|
+
export interface SnapshotCreatedEvent extends SSEEventBase {
|
|
497
|
+
type: 'snapshot_created';
|
|
498
|
+
data: {
|
|
499
|
+
appId: string;
|
|
500
|
+
snapshotId: string;
|
|
501
|
+
version: number;
|
|
502
|
+
reason: string;
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Union of all SSE event types.
|
|
507
|
+
*/
|
|
508
|
+
export type SSEEvent = StartEvent | MessageEvent | ToolCallEvent | ToolResultEvent | TodoUpdateEvent | TodoDetailEvent | FileOperationEvent | SchemaUpdateEvent | GenerationLogEvent | SubagentEvent | InterruptEvent | ErrorEvent | CancelledEvent | CompleteEvent | AppCreatedEvent | SchemaPhaseValidatedEvent | SchemaPhaseUpdateEvent | OrbitalAddedEvent | OrbitalSchemaCompleteEvent | ChangesetRecordedEvent | SnapshotCreatedEvent;
|
|
509
|
+
/**
|
|
510
|
+
* List skills response.
|
|
511
|
+
*/
|
|
512
|
+
export interface ListSkillsResponse {
|
|
513
|
+
available: Array<{
|
|
514
|
+
name: string;
|
|
515
|
+
description: string;
|
|
516
|
+
allowedTools?: string[];
|
|
517
|
+
}>;
|
|
518
|
+
installed: Array<{
|
|
519
|
+
name: string;
|
|
520
|
+
description: string;
|
|
521
|
+
allowedTools?: string[];
|
|
522
|
+
}>;
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Session info response.
|
|
526
|
+
*/
|
|
527
|
+
export interface SessionInfo {
|
|
528
|
+
threadId: string;
|
|
529
|
+
skill: string;
|
|
530
|
+
workDir: string;
|
|
531
|
+
createdAt: number;
|
|
532
|
+
lastActivityAt: number;
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* List sessions response.
|
|
536
|
+
*/
|
|
537
|
+
export interface ListSessionsResponse {
|
|
538
|
+
sessions: SessionInfo[];
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Create an SSE event with timestamp.
|
|
542
|
+
*/
|
|
543
|
+
export declare function createSSEEvent<T extends SSEEventType>(type: T, data: Extract<SSEEvent, {
|
|
544
|
+
type: T;
|
|
545
|
+
}>['data']): Extract<SSEEvent, {
|
|
546
|
+
type: T;
|
|
547
|
+
}>;
|
|
548
|
+
/**
|
|
549
|
+
* Format an SSE event for transmission.
|
|
550
|
+
*/
|
|
551
|
+
export declare function formatSSEEvent(event: SSEEvent): string;
|
|
552
|
+
/**
|
|
553
|
+
* Parse an SSE event from a data string.
|
|
554
|
+
*/
|
|
555
|
+
export declare function parseSSEEvent(data: string): SSEEvent;
|
|
556
|
+
/**
|
|
557
|
+
* Type guard for SSE start events.
|
|
558
|
+
*/
|
|
559
|
+
export declare function isSSEStartEvent(event: SSEEvent): event is StartEvent;
|
|
560
|
+
/**
|
|
561
|
+
* Type guard for SSE message events.
|
|
562
|
+
*/
|
|
563
|
+
export declare function isSSEMessageEvent(event: SSEEvent): event is MessageEvent;
|
|
564
|
+
/**
|
|
565
|
+
* Type guard for SSE interrupt events.
|
|
566
|
+
*/
|
|
567
|
+
export declare function isSSEInterruptEvent(event: SSEEvent): event is InterruptEvent;
|
|
568
|
+
/**
|
|
569
|
+
* Type guard for SSE complete events.
|
|
570
|
+
*/
|
|
571
|
+
export declare function isSSECompleteEvent(event: SSEEvent): event is CompleteEvent;
|
|
572
|
+
/**
|
|
573
|
+
* Type guard for SSE error events.
|
|
574
|
+
*/
|
|
575
|
+
export declare function isSSEErrorEvent(event: SSEEvent): event is ErrorEvent;
|
|
576
|
+
/**
|
|
577
|
+
* Type guard for SSE tool call events.
|
|
578
|
+
*/
|
|
579
|
+
export declare function isSSEToolCallEvent(event: SSEEvent): event is ToolCallEvent;
|
|
580
|
+
/**
|
|
581
|
+
* Type guard for SSE todo update events.
|
|
582
|
+
*/
|
|
583
|
+
export declare function isSSETodoUpdateEvent(event: SSEEvent): event is TodoUpdateEvent;
|
|
584
|
+
/**
|
|
585
|
+
* Type guard for SSE todo detail events.
|
|
586
|
+
*/
|
|
587
|
+
export declare function isSSETodoDetailEvent(event: SSEEvent): event is TodoDetailEvent;
|
|
588
|
+
/**
|
|
589
|
+
* Type guard for SSE subagent events.
|
|
590
|
+
*/
|
|
591
|
+
export declare function isSSESubagentEvent(event: SSEEvent): event is SubagentEvent;
|
|
592
|
+
/**
|
|
593
|
+
* Type guard for SSE generation log events.
|
|
594
|
+
*/
|
|
595
|
+
export declare function isSSEGenerationLogEvent(event: SSEEvent): event is GenerationLogEvent;
|