@appsforgood/agent-kit-runtime 0.1.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.
- package/CHANGELOG.md +5 -0
- package/LICENSE +21 -0
- package/README.md +120 -0
- package/dist/index.d.ts +585 -0
- package/dist/index.js +2433 -0
- package/dist/index.js.map +1 -0
- package/package.json +60 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,585 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import * as _langchain_langgraph from '@langchain/langgraph';
|
|
3
|
+
import { SqliteSaver } from '@langchain/langgraph-checkpoint-sqlite';
|
|
4
|
+
|
|
5
|
+
type ModelCapability = "text" | "tools" | "parallel-tools" | "structured-output" | "streaming" | "vision" | "reasoning" | "usage";
|
|
6
|
+
interface ModelMessage {
|
|
7
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
8
|
+
content: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
toolCallId?: string;
|
|
11
|
+
}
|
|
12
|
+
interface ModelToolDefinition {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
inputSchema: Record<string, unknown>;
|
|
16
|
+
risk: "read" | "write" | "network" | "secret" | "destructive";
|
|
17
|
+
}
|
|
18
|
+
interface ModelToolCall {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
arguments: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
interface ModelUsage {
|
|
24
|
+
inputTokens?: number;
|
|
25
|
+
outputTokens?: number;
|
|
26
|
+
totalTokens?: number;
|
|
27
|
+
}
|
|
28
|
+
interface ModelRequest {
|
|
29
|
+
model: string;
|
|
30
|
+
messages: ModelMessage[];
|
|
31
|
+
tools?: ModelToolDefinition[];
|
|
32
|
+
temperature?: number;
|
|
33
|
+
maxOutputTokens?: number;
|
|
34
|
+
signal?: AbortSignal;
|
|
35
|
+
}
|
|
36
|
+
interface ModelResponse {
|
|
37
|
+
text: string;
|
|
38
|
+
toolCalls: ModelToolCall[];
|
|
39
|
+
finishReason?: string;
|
|
40
|
+
usage?: ModelUsage;
|
|
41
|
+
providerResponseId?: string;
|
|
42
|
+
}
|
|
43
|
+
interface ProviderProbeResult {
|
|
44
|
+
providerId: string;
|
|
45
|
+
available: boolean;
|
|
46
|
+
capabilities: ModelCapability[];
|
|
47
|
+
models?: string[];
|
|
48
|
+
latencyMs: number;
|
|
49
|
+
error?: string;
|
|
50
|
+
}
|
|
51
|
+
interface ModelProviderAdapter {
|
|
52
|
+
readonly id: string;
|
|
53
|
+
readonly capabilities: ReadonlySet<ModelCapability>;
|
|
54
|
+
probe(signal?: AbortSignal): Promise<ProviderProbeResult>;
|
|
55
|
+
invoke(request: ModelRequest): Promise<ModelResponse>;
|
|
56
|
+
}
|
|
57
|
+
interface RoutedModelResult {
|
|
58
|
+
providerId: string;
|
|
59
|
+
model: string;
|
|
60
|
+
response: ModelResponse;
|
|
61
|
+
attempts: Array<{
|
|
62
|
+
providerId: string;
|
|
63
|
+
model: string;
|
|
64
|
+
outcome: "selected" | "capability-mismatch" | "error";
|
|
65
|
+
detail?: string;
|
|
66
|
+
}>;
|
|
67
|
+
}
|
|
68
|
+
interface AgentNodeInput {
|
|
69
|
+
runId: string;
|
|
70
|
+
workflowId: string;
|
|
71
|
+
agentId: string;
|
|
72
|
+
goal: string;
|
|
73
|
+
instructions: string;
|
|
74
|
+
requiredOutputs: string[];
|
|
75
|
+
allowedHandoffs: string[];
|
|
76
|
+
mutationAllowed: boolean;
|
|
77
|
+
priorResults: AgentNodeResult[];
|
|
78
|
+
worktreePath?: string;
|
|
79
|
+
}
|
|
80
|
+
interface AgentNodeResult {
|
|
81
|
+
agentId: string;
|
|
82
|
+
summary: string;
|
|
83
|
+
decision: string;
|
|
84
|
+
risk: string;
|
|
85
|
+
artifacts: string[];
|
|
86
|
+
verification: string[];
|
|
87
|
+
requestedHandoff?: string;
|
|
88
|
+
}
|
|
89
|
+
interface AgentNodeExecutor {
|
|
90
|
+
execute(input: AgentNodeInput, signal?: AbortSignal): Promise<AgentNodeResult>;
|
|
91
|
+
}
|
|
92
|
+
interface RuntimeApprovalHandler {
|
|
93
|
+
(request: Omit<ApprovalRequest, "approvalId" | "requestedAt">): Promise<boolean>;
|
|
94
|
+
}
|
|
95
|
+
type ApprovalRisk = "plan" | "write" | "network" | "secret" | "destructive" | "host-mutation" | "final-commit";
|
|
96
|
+
interface ApprovalRequest {
|
|
97
|
+
approvalId: string;
|
|
98
|
+
runId: string;
|
|
99
|
+
risk: ApprovalRisk;
|
|
100
|
+
title: string;
|
|
101
|
+
detail: string;
|
|
102
|
+
requestedAt: string;
|
|
103
|
+
}
|
|
104
|
+
interface ApprovalDecision {
|
|
105
|
+
approvalId: string;
|
|
106
|
+
decision: "approve" | "reject";
|
|
107
|
+
decidedAt: string;
|
|
108
|
+
actor?: string;
|
|
109
|
+
note?: string;
|
|
110
|
+
}
|
|
111
|
+
type RunStatus = "planned" | "running" | "awaiting-approval" | "blocked" | "cancelled" | "failed" | "complete";
|
|
112
|
+
interface RunEvent {
|
|
113
|
+
schemaVersion: 1;
|
|
114
|
+
eventId: string;
|
|
115
|
+
sequence: number;
|
|
116
|
+
runId: string;
|
|
117
|
+
createdAt: string;
|
|
118
|
+
type: "run_started" | "run_status_changed" | "agent_started" | "agent_completed" | "handoff" | "approval_requested" | "approval_decided" | "tool_started" | "tool_completed" | "provider_selected" | "artifact" | "verification" | "run_error" | "run_completed";
|
|
119
|
+
agentId?: string;
|
|
120
|
+
text?: string;
|
|
121
|
+
status?: RunStatus;
|
|
122
|
+
approval?: ApprovalRequest | ApprovalDecision;
|
|
123
|
+
data?: Record<string, unknown>;
|
|
124
|
+
}
|
|
125
|
+
interface RunRecord {
|
|
126
|
+
schemaVersion: 1;
|
|
127
|
+
runId: string;
|
|
128
|
+
workflowId: string;
|
|
129
|
+
goal: string;
|
|
130
|
+
status: RunStatus;
|
|
131
|
+
createdAt: string;
|
|
132
|
+
updatedAt: string;
|
|
133
|
+
sourceRoot: string;
|
|
134
|
+
baseCommit: string;
|
|
135
|
+
worktreePath?: string;
|
|
136
|
+
branchName?: string;
|
|
137
|
+
activeAgentId?: string | undefined;
|
|
138
|
+
pendingApproval?: ApprovalRequest | undefined;
|
|
139
|
+
commit?: string;
|
|
140
|
+
changed?: string;
|
|
141
|
+
results: AgentNodeResult[];
|
|
142
|
+
error?: string;
|
|
143
|
+
}
|
|
144
|
+
interface RuntimeCommandResult {
|
|
145
|
+
ok: boolean;
|
|
146
|
+
command: string;
|
|
147
|
+
run?: RunRecord;
|
|
148
|
+
runs?: RunRecord[];
|
|
149
|
+
data?: unknown;
|
|
150
|
+
message?: string;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
declare const LocalMcpContract: z.ZodObject<{
|
|
154
|
+
transport: z.ZodLiteral<"stdio">;
|
|
155
|
+
command: z.ZodString;
|
|
156
|
+
args: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
157
|
+
envRefs: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
158
|
+
allowHostExecution: z.ZodDefault<z.ZodBoolean>;
|
|
159
|
+
allowedTools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
160
|
+
}, z.core.$strict>;
|
|
161
|
+
declare const RemoteMcpContract: z.ZodObject<{
|
|
162
|
+
transport: z.ZodLiteral<"streamable-http">;
|
|
163
|
+
url: z.ZodString;
|
|
164
|
+
authRef: z.ZodOptional<z.ZodString>;
|
|
165
|
+
allowedHosts: z.ZodArray<z.ZodString>;
|
|
166
|
+
allowPrivateNetwork: z.ZodDefault<z.ZodBoolean>;
|
|
167
|
+
allowedTools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
168
|
+
}, z.core.$strict>;
|
|
169
|
+
declare const RuntimeConfigContract: z.ZodObject<{
|
|
170
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
171
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
172
|
+
defaultWorkflow: z.ZodDefault<z.ZodString>;
|
|
173
|
+
defaultAlias: z.ZodDefault<z.ZodString>;
|
|
174
|
+
databasePath: z.ZodDefault<z.ZodString>;
|
|
175
|
+
providers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
176
|
+
kind: z.ZodEnum<{
|
|
177
|
+
openai: "openai";
|
|
178
|
+
anthropic: "anthropic";
|
|
179
|
+
gemini: "gemini";
|
|
180
|
+
xai: "xai";
|
|
181
|
+
deepseek: "deepseek";
|
|
182
|
+
kimi: "kimi";
|
|
183
|
+
glm: "glm";
|
|
184
|
+
openrouter: "openrouter";
|
|
185
|
+
ollama: "ollama";
|
|
186
|
+
"lm-studio": "lm-studio";
|
|
187
|
+
vllm: "vllm";
|
|
188
|
+
"openai-compatible": "openai-compatible";
|
|
189
|
+
}>;
|
|
190
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
191
|
+
credentialRef: z.ZodOptional<z.ZodString>;
|
|
192
|
+
allowPrivateNetwork: z.ZodDefault<z.ZodBoolean>;
|
|
193
|
+
capabilities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
194
|
+
reasoning: "reasoning";
|
|
195
|
+
tools: "tools";
|
|
196
|
+
text: "text";
|
|
197
|
+
"parallel-tools": "parallel-tools";
|
|
198
|
+
"structured-output": "structured-output";
|
|
199
|
+
streaming: "streaming";
|
|
200
|
+
vision: "vision";
|
|
201
|
+
usage: "usage";
|
|
202
|
+
}>>>;
|
|
203
|
+
timeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
204
|
+
}, z.core.$strict>>>;
|
|
205
|
+
modelAliases: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
206
|
+
candidates: z.ZodArray<z.ZodObject<{
|
|
207
|
+
provider: z.ZodString;
|
|
208
|
+
model: z.ZodString;
|
|
209
|
+
}, z.core.$strict>>;
|
|
210
|
+
requiredCapabilities: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
211
|
+
reasoning: "reasoning";
|
|
212
|
+
tools: "tools";
|
|
213
|
+
text: "text";
|
|
214
|
+
"parallel-tools": "parallel-tools";
|
|
215
|
+
"structured-output": "structured-output";
|
|
216
|
+
streaming: "streaming";
|
|
217
|
+
vision: "vision";
|
|
218
|
+
usage: "usage";
|
|
219
|
+
}>>>;
|
|
220
|
+
maxAttempts: z.ZodDefault<z.ZodNumber>;
|
|
221
|
+
}, z.core.$strict>>>;
|
|
222
|
+
agentRoutes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
223
|
+
agentExecutors: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
224
|
+
model: "model";
|
|
225
|
+
cursor: "cursor";
|
|
226
|
+
}>>>;
|
|
227
|
+
mutationAgents: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
228
|
+
cursor: z.ZodDefault<z.ZodObject<{
|
|
229
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
230
|
+
command: z.ZodDefault<z.ZodString>;
|
|
231
|
+
args: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
232
|
+
timeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
233
|
+
}, z.core.$strict>>;
|
|
234
|
+
mcpServers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
235
|
+
transport: z.ZodLiteral<"stdio">;
|
|
236
|
+
command: z.ZodString;
|
|
237
|
+
args: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
238
|
+
envRefs: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
239
|
+
allowHostExecution: z.ZodDefault<z.ZodBoolean>;
|
|
240
|
+
allowedTools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
241
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
242
|
+
transport: z.ZodLiteral<"streamable-http">;
|
|
243
|
+
url: z.ZodString;
|
|
244
|
+
authRef: z.ZodOptional<z.ZodString>;
|
|
245
|
+
allowedHosts: z.ZodArray<z.ZodString>;
|
|
246
|
+
allowPrivateNetwork: z.ZodDefault<z.ZodBoolean>;
|
|
247
|
+
allowedTools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
248
|
+
}, z.core.$strict>], "transport">>>;
|
|
249
|
+
sandbox: z.ZodDefault<z.ZodObject<{
|
|
250
|
+
provider: z.ZodDefault<z.ZodEnum<{
|
|
251
|
+
docker: "docker";
|
|
252
|
+
"host-readonly": "host-readonly";
|
|
253
|
+
}>>;
|
|
254
|
+
image: z.ZodDefault<z.ZodString>;
|
|
255
|
+
network: z.ZodDefault<z.ZodEnum<{
|
|
256
|
+
none: "none";
|
|
257
|
+
approved: "approved";
|
|
258
|
+
}>>;
|
|
259
|
+
allowHostMutations: z.ZodDefault<z.ZodBoolean>;
|
|
260
|
+
timeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
261
|
+
memoryMb: z.ZodDefault<z.ZodNumber>;
|
|
262
|
+
cpus: z.ZodDefault<z.ZodNumber>;
|
|
263
|
+
}, z.core.$strict>>;
|
|
264
|
+
approvals: z.ZodDefault<z.ZodObject<{
|
|
265
|
+
mode: z.ZodDefault<z.ZodLiteral<"risk-tiered">>;
|
|
266
|
+
requirePlan: z.ZodDefault<z.ZodBoolean>;
|
|
267
|
+
requireFinalCommit: z.ZodDefault<z.ZodBoolean>;
|
|
268
|
+
}, z.core.$strict>>;
|
|
269
|
+
limits: z.ZodDefault<z.ZodObject<{
|
|
270
|
+
maxSteps: z.ZodDefault<z.ZodNumber>;
|
|
271
|
+
maxAgentVisits: z.ZodDefault<z.ZodNumber>;
|
|
272
|
+
maxRetriesPerNode: z.ZodDefault<z.ZodNumber>;
|
|
273
|
+
maxToolCallsPerAgent: z.ZodDefault<z.ZodNumber>;
|
|
274
|
+
runTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
275
|
+
}, z.core.$strict>>;
|
|
276
|
+
}, z.core.$strict>;
|
|
277
|
+
type RuntimeConfig = z.infer<typeof RuntimeConfigContract>;
|
|
278
|
+
type McpServerConfig = z.infer<typeof LocalMcpContract> | z.infer<typeof RemoteMcpContract>;
|
|
279
|
+
declare function loadRuntimeConfig(cwd: string): RuntimeConfig;
|
|
280
|
+
|
|
281
|
+
interface CredentialStore {
|
|
282
|
+
resolve(reference: string): Promise<string>;
|
|
283
|
+
set(reference: string, value: string): Promise<void>;
|
|
284
|
+
delete(reference: string): Promise<boolean>;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
interface RunEventStore {
|
|
288
|
+
create(record: RunRecord): RunRecord;
|
|
289
|
+
read(runId: string): RunRecord;
|
|
290
|
+
list(): RunRecord[];
|
|
291
|
+
update(runId: string, patch: Partial<RunRecord>): RunRecord;
|
|
292
|
+
append(runId: string, event: Omit<RunEvent, "schemaVersion" | "eventId" | "sequence" | "runId" | "createdAt">): RunEvent;
|
|
293
|
+
events(runId: string): RunEvent[];
|
|
294
|
+
}
|
|
295
|
+
declare class FileRunEventStore implements RunEventStore {
|
|
296
|
+
readonly root: string;
|
|
297
|
+
constructor(cwd: string);
|
|
298
|
+
create(record: RunRecord): RunRecord;
|
|
299
|
+
read(runId: string): RunRecord;
|
|
300
|
+
list(): RunRecord[];
|
|
301
|
+
update(runId: string, patch: Partial<RunRecord>): RunRecord;
|
|
302
|
+
append(runId: string, event: Omit<RunEvent, "schemaVersion" | "eventId" | "sequence" | "runId" | "createdAt">): RunEvent;
|
|
303
|
+
events(runId: string): RunEvent[];
|
|
304
|
+
setStatus(runId: string, status: RunStatus, text?: string): RunRecord;
|
|
305
|
+
private recordPath;
|
|
306
|
+
private eventsPath;
|
|
307
|
+
private runDir;
|
|
308
|
+
private lockPath;
|
|
309
|
+
private writeRecord;
|
|
310
|
+
private ensureRoot;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
declare class ProviderRegistry {
|
|
314
|
+
private readonly providers;
|
|
315
|
+
constructor(config: RuntimeConfig, credentials: CredentialStore);
|
|
316
|
+
register(adapter: ModelProviderAdapter): void;
|
|
317
|
+
get(id: string): ModelProviderAdapter;
|
|
318
|
+
list(): ModelProviderAdapter[];
|
|
319
|
+
}
|
|
320
|
+
declare class ModelRouter {
|
|
321
|
+
private readonly config;
|
|
322
|
+
private readonly registry;
|
|
323
|
+
constructor(config: RuntimeConfig, registry: ProviderRegistry);
|
|
324
|
+
invoke(alias: string, request: Omit<ModelRequest, "model">): Promise<RoutedModelResult>;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
declare const AgentContract: z.ZodObject<{
|
|
328
|
+
id: z.ZodString;
|
|
329
|
+
name: z.ZodOptional<z.ZodString>;
|
|
330
|
+
file: z.ZodOptional<z.ZodString>;
|
|
331
|
+
defaultFor: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
332
|
+
skills: z.ZodArray<z.ZodString>;
|
|
333
|
+
handsOffTo: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
334
|
+
}, z.core.$strict>;
|
|
335
|
+
declare const WorkflowContract: z.ZodObject<{
|
|
336
|
+
id: z.ZodString;
|
|
337
|
+
triggers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
338
|
+
sequence: z.ZodArray<z.ZodString>;
|
|
339
|
+
council: z.ZodArray<z.ZodString>;
|
|
340
|
+
requiredOutputs: z.ZodArray<z.ZodString>;
|
|
341
|
+
}, z.core.$strict>;
|
|
342
|
+
declare const RosterContract: z.ZodObject<{
|
|
343
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
344
|
+
id: z.ZodString;
|
|
345
|
+
stack: z.ZodString;
|
|
346
|
+
required: z.ZodBoolean;
|
|
347
|
+
defaultWorkflow: z.ZodString;
|
|
348
|
+
principle: z.ZodOptional<z.ZodString>;
|
|
349
|
+
agents: z.ZodArray<z.ZodObject<{
|
|
350
|
+
id: z.ZodString;
|
|
351
|
+
name: z.ZodOptional<z.ZodString>;
|
|
352
|
+
file: z.ZodOptional<z.ZodString>;
|
|
353
|
+
defaultFor: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
354
|
+
skills: z.ZodArray<z.ZodString>;
|
|
355
|
+
handsOffTo: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
356
|
+
}, z.core.$strict>>;
|
|
357
|
+
workflows: z.ZodArray<z.ZodObject<{
|
|
358
|
+
id: z.ZodString;
|
|
359
|
+
triggers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
360
|
+
sequence: z.ZodArray<z.ZodString>;
|
|
361
|
+
council: z.ZodArray<z.ZodString>;
|
|
362
|
+
requiredOutputs: z.ZodArray<z.ZodString>;
|
|
363
|
+
}, z.core.$strict>>;
|
|
364
|
+
handoffRules: z.ZodArray<z.ZodString>;
|
|
365
|
+
}, z.core.$strict>;
|
|
366
|
+
type AgentRoster = z.infer<typeof RosterContract>;
|
|
367
|
+
type RosterAgent = z.infer<typeof AgentContract>;
|
|
368
|
+
type RosterWorkflow = z.infer<typeof WorkflowContract>;
|
|
369
|
+
|
|
370
|
+
interface WorktreeRecord {
|
|
371
|
+
sourceRoot: string;
|
|
372
|
+
path: string;
|
|
373
|
+
branchName: string;
|
|
374
|
+
baseCommit: string;
|
|
375
|
+
excludedDirtyChanges: boolean;
|
|
376
|
+
}
|
|
377
|
+
declare class WorktreeManager {
|
|
378
|
+
readonly sourceRoot: string;
|
|
379
|
+
constructor(sourceRoot: string);
|
|
380
|
+
inspect(): Promise<{
|
|
381
|
+
baseCommit: string;
|
|
382
|
+
dirty: boolean;
|
|
383
|
+
status: string;
|
|
384
|
+
sensitivePaths: string[];
|
|
385
|
+
}>;
|
|
386
|
+
create(runId: string, options?: {
|
|
387
|
+
acknowledgeDirtyBase?: boolean;
|
|
388
|
+
}): Promise<WorktreeRecord>;
|
|
389
|
+
changes(path: string): Promise<string>;
|
|
390
|
+
head(path: string): Promise<string>;
|
|
391
|
+
commit(path: string, runId: string, title: string): Promise<{
|
|
392
|
+
commit: string;
|
|
393
|
+
changed: string;
|
|
394
|
+
}>;
|
|
395
|
+
remove(path: string, options?: {
|
|
396
|
+
deleteBranch?: boolean;
|
|
397
|
+
force?: boolean;
|
|
398
|
+
}): Promise<void>;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
interface RuntimePlan {
|
|
402
|
+
rosterId: string;
|
|
403
|
+
workflowId: string;
|
|
404
|
+
sequence: string[];
|
|
405
|
+
council: string[];
|
|
406
|
+
requiredOutputs: string[];
|
|
407
|
+
mutationAgents: string[];
|
|
408
|
+
cursorAgents: string[];
|
|
409
|
+
modelAliases: string[];
|
|
410
|
+
mcpServers: string[];
|
|
411
|
+
approvals: Array<"plan" | "network" | "write" | "host-mutation" | "final-commit">;
|
|
412
|
+
}
|
|
413
|
+
interface RuntimeValidation {
|
|
414
|
+
valid: boolean;
|
|
415
|
+
enabled: boolean;
|
|
416
|
+
rosterId: string;
|
|
417
|
+
workflows: string[];
|
|
418
|
+
providers: string[];
|
|
419
|
+
aliases: string[];
|
|
420
|
+
warnings: string[];
|
|
421
|
+
}
|
|
422
|
+
interface RuntimeServiceOptions {
|
|
423
|
+
credentials?: CredentialStore;
|
|
424
|
+
providerRegistry?: ProviderRegistry;
|
|
425
|
+
}
|
|
426
|
+
declare class AgentKitRuntimeService {
|
|
427
|
+
readonly cwd: string;
|
|
428
|
+
readonly config: RuntimeConfig;
|
|
429
|
+
readonly roster: AgentRoster;
|
|
430
|
+
readonly events: FileRunEventStore;
|
|
431
|
+
readonly credentials: CredentialStore;
|
|
432
|
+
readonly providers: ProviderRegistry;
|
|
433
|
+
readonly router: ModelRouter;
|
|
434
|
+
readonly worktrees: WorktreeManager;
|
|
435
|
+
constructor(cwd: string, options?: RuntimeServiceOptions);
|
|
436
|
+
validate(): RuntimeValidation;
|
|
437
|
+
plan(goal: string, requestedWorkflow?: string): RuntimePlan;
|
|
438
|
+
run(goal: string, options?: {
|
|
439
|
+
workflowId?: string;
|
|
440
|
+
acknowledgeDirtyBase?: boolean;
|
|
441
|
+
signal?: AbortSignal;
|
|
442
|
+
}): Promise<RunRecord>;
|
|
443
|
+
resume(runId: string, input: Omit<ApprovalDecision, "decidedAt">, options?: {
|
|
444
|
+
signal?: AbortSignal;
|
|
445
|
+
}): Promise<RunRecord>;
|
|
446
|
+
status(runId?: string): RunRecord | RunRecord[];
|
|
447
|
+
cancel(runId: string): RunRecord;
|
|
448
|
+
probeProvider(providerId?: string): Promise<ProviderProbeResult[]>;
|
|
449
|
+
probeMcp(server: string): Promise<unknown>;
|
|
450
|
+
setCredential(reference: string, value: string): Promise<void>;
|
|
451
|
+
deleteCredential(reference: string): Promise<boolean>;
|
|
452
|
+
exportEvidence(runId: string): string;
|
|
453
|
+
private invoke;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
interface McpToolResult {
|
|
457
|
+
output: string;
|
|
458
|
+
data?: Record<string, unknown>;
|
|
459
|
+
isError: boolean;
|
|
460
|
+
}
|
|
461
|
+
declare function assertSafeMcpUrl(url: URL, config: Extract<McpServerConfig, {
|
|
462
|
+
transport: "streamable-http";
|
|
463
|
+
}>): Promise<void>;
|
|
464
|
+
declare class McpClientBroker {
|
|
465
|
+
private readonly servers;
|
|
466
|
+
private readonly credentials;
|
|
467
|
+
private readonly cwd;
|
|
468
|
+
private readonly connections;
|
|
469
|
+
private readonly toolNames;
|
|
470
|
+
constructor(servers: Record<string, McpServerConfig>, credentials: CredentialStore, cwd: string);
|
|
471
|
+
definitions(): Promise<ModelToolDefinition[]>;
|
|
472
|
+
call(name: string, args: Record<string, unknown>, signal?: AbortSignal): Promise<McpToolResult>;
|
|
473
|
+
probe(server: string): Promise<{
|
|
474
|
+
server: string;
|
|
475
|
+
tools: string[];
|
|
476
|
+
transport: McpServerConfig["transport"];
|
|
477
|
+
}>;
|
|
478
|
+
close(): Promise<void>;
|
|
479
|
+
private connect;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
declare const CouncilState: _langchain_langgraph.AnnotationRoot<{
|
|
483
|
+
runId: _langchain_langgraph.LastValue<string>;
|
|
484
|
+
workflowId: _langchain_langgraph.LastValue<string>;
|
|
485
|
+
goal: _langchain_langgraph.LastValue<string>;
|
|
486
|
+
sourceRoot: _langchain_langgraph.LastValue<string>;
|
|
487
|
+
baseCommit: _langchain_langgraph.LastValue<string>;
|
|
488
|
+
worktreePath: _langchain_langgraph.LastValue<string>;
|
|
489
|
+
results: _langchain_langgraph.LastValue<AgentNodeResult[]>;
|
|
490
|
+
visits: _langchain_langgraph.LastValue<Record<string, number>>;
|
|
491
|
+
steps: _langchain_langgraph.LastValue<number>;
|
|
492
|
+
planApproved: _langchain_langgraph.LastValue<boolean>;
|
|
493
|
+
externalApproved: _langchain_langgraph.LastValue<boolean>;
|
|
494
|
+
mutationApproved: _langchain_langgraph.LastValue<boolean>;
|
|
495
|
+
hostMutationApproved: _langchain_langgraph.LastValue<boolean>;
|
|
496
|
+
finalCommitApproved: _langchain_langgraph.LastValue<boolean>;
|
|
497
|
+
commit: _langchain_langgraph.LastValue<string | null>;
|
|
498
|
+
}>;
|
|
499
|
+
type CouncilGraphState = typeof CouncilState.State;
|
|
500
|
+
interface CouncilGraphDependencies {
|
|
501
|
+
cwd: string;
|
|
502
|
+
config: RuntimeConfig;
|
|
503
|
+
roster: AgentRoster;
|
|
504
|
+
workflow: RosterWorkflow;
|
|
505
|
+
events: FileRunEventStore;
|
|
506
|
+
worktrees: WorktreeManager;
|
|
507
|
+
checkpointer: SqliteSaver;
|
|
508
|
+
executorFor(agent: RosterAgent, state: CouncilGraphState): AgentNodeExecutor;
|
|
509
|
+
signal?: AbortSignal;
|
|
510
|
+
}
|
|
511
|
+
declare function initialCouncilState(input: {
|
|
512
|
+
runId: string;
|
|
513
|
+
workflowId: string;
|
|
514
|
+
goal: string;
|
|
515
|
+
sourceRoot: string;
|
|
516
|
+
baseCommit: string;
|
|
517
|
+
worktreePath: string;
|
|
518
|
+
}): CouncilGraphState;
|
|
519
|
+
declare function compileCouncilGraph(dependencies: CouncilGraphDependencies): _langchain_langgraph.CompiledStateGraph<{
|
|
520
|
+
runId: string;
|
|
521
|
+
workflowId: string;
|
|
522
|
+
goal: string;
|
|
523
|
+
sourceRoot: string;
|
|
524
|
+
baseCommit: string;
|
|
525
|
+
worktreePath: string;
|
|
526
|
+
results: AgentNodeResult[];
|
|
527
|
+
visits: Record<string, number>;
|
|
528
|
+
steps: number;
|
|
529
|
+
planApproved: boolean;
|
|
530
|
+
externalApproved: boolean;
|
|
531
|
+
mutationApproved: boolean;
|
|
532
|
+
hostMutationApproved: boolean;
|
|
533
|
+
finalCommitApproved: boolean;
|
|
534
|
+
commit: string | null;
|
|
535
|
+
}, {
|
|
536
|
+
runId?: string;
|
|
537
|
+
workflowId?: string;
|
|
538
|
+
goal?: string;
|
|
539
|
+
sourceRoot?: string;
|
|
540
|
+
baseCommit?: string;
|
|
541
|
+
worktreePath?: string;
|
|
542
|
+
results?: AgentNodeResult[];
|
|
543
|
+
visits?: Record<string, number>;
|
|
544
|
+
steps?: number;
|
|
545
|
+
planApproved?: boolean;
|
|
546
|
+
externalApproved?: boolean;
|
|
547
|
+
mutationApproved?: boolean;
|
|
548
|
+
hostMutationApproved?: boolean;
|
|
549
|
+
finalCommitApproved?: boolean;
|
|
550
|
+
commit?: string | null;
|
|
551
|
+
}, string, {
|
|
552
|
+
runId: _langchain_langgraph.LastValue<string>;
|
|
553
|
+
workflowId: _langchain_langgraph.LastValue<string>;
|
|
554
|
+
goal: _langchain_langgraph.LastValue<string>;
|
|
555
|
+
sourceRoot: _langchain_langgraph.LastValue<string>;
|
|
556
|
+
baseCommit: _langchain_langgraph.LastValue<string>;
|
|
557
|
+
worktreePath: _langchain_langgraph.LastValue<string>;
|
|
558
|
+
results: _langchain_langgraph.LastValue<AgentNodeResult[]>;
|
|
559
|
+
visits: _langchain_langgraph.LastValue<Record<string, number>>;
|
|
560
|
+
steps: _langchain_langgraph.LastValue<number>;
|
|
561
|
+
planApproved: _langchain_langgraph.LastValue<boolean>;
|
|
562
|
+
externalApproved: _langchain_langgraph.LastValue<boolean>;
|
|
563
|
+
mutationApproved: _langchain_langgraph.LastValue<boolean>;
|
|
564
|
+
hostMutationApproved: _langchain_langgraph.LastValue<boolean>;
|
|
565
|
+
finalCommitApproved: _langchain_langgraph.LastValue<boolean>;
|
|
566
|
+
commit: _langchain_langgraph.LastValue<string | null>;
|
|
567
|
+
}, {
|
|
568
|
+
runId: _langchain_langgraph.LastValue<string>;
|
|
569
|
+
workflowId: _langchain_langgraph.LastValue<string>;
|
|
570
|
+
goal: _langchain_langgraph.LastValue<string>;
|
|
571
|
+
sourceRoot: _langchain_langgraph.LastValue<string>;
|
|
572
|
+
baseCommit: _langchain_langgraph.LastValue<string>;
|
|
573
|
+
worktreePath: _langchain_langgraph.LastValue<string>;
|
|
574
|
+
results: _langchain_langgraph.LastValue<AgentNodeResult[]>;
|
|
575
|
+
visits: _langchain_langgraph.LastValue<Record<string, number>>;
|
|
576
|
+
steps: _langchain_langgraph.LastValue<number>;
|
|
577
|
+
planApproved: _langchain_langgraph.LastValue<boolean>;
|
|
578
|
+
externalApproved: _langchain_langgraph.LastValue<boolean>;
|
|
579
|
+
mutationApproved: _langchain_langgraph.LastValue<boolean>;
|
|
580
|
+
hostMutationApproved: _langchain_langgraph.LastValue<boolean>;
|
|
581
|
+
finalCommitApproved: _langchain_langgraph.LastValue<boolean>;
|
|
582
|
+
commit: _langchain_langgraph.LastValue<string | null>;
|
|
583
|
+
}, _langchain_langgraph.StateDefinition, unknown, unknown, unknown, []>;
|
|
584
|
+
|
|
585
|
+
export { AgentKitRuntimeService, type AgentNodeExecutor, type AgentNodeInput, type AgentNodeResult, type ApprovalDecision, type ApprovalRequest, type ApprovalRisk, FileRunEventStore, McpClientBroker, type ModelCapability, type ModelMessage, type ModelProviderAdapter, type ModelRequest, type ModelResponse, ModelRouter, type ModelToolCall, type ModelToolDefinition, type ModelUsage, type ProviderProbeResult, ProviderRegistry, type RoutedModelResult, type RunEvent, type RunRecord, type RunStatus, type RuntimeApprovalHandler, type RuntimeCommandResult, type RuntimeConfig, RuntimeConfigContract, type RuntimePlan, type RuntimeServiceOptions, type RuntimeValidation, WorktreeManager, assertSafeMcpUrl, compileCouncilGraph, initialCouncilState, loadRuntimeConfig };
|