@pi-ohm/subagents 0.6.4-dev.25614589665.1.cd7b959 → 0.6.4-dev.25620170147.1.0b6891f
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-controller.d.ts +59 -0
- package/dist/agent-controller.js +330 -0
- package/dist/extension.d.ts +3 -2
- package/dist/extension.js +5 -2
- package/package.json +6 -5
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { AgentToolResult, ExtensionAPI, ToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { Static, Type } from "@earendil-works/pi-ai";
|
|
3
|
+
|
|
4
|
+
//#region src/agent-controller.d.ts
|
|
5
|
+
declare const SpawnAgentArgsSchema: Type.TObject<{
|
|
6
|
+
task_name: Type.TString;
|
|
7
|
+
prompt: Type.TString;
|
|
8
|
+
summary: Type.TString;
|
|
9
|
+
agent_type: Type.TOptional<Type.TString>;
|
|
10
|
+
model: Type.TOptional<Type.TString>;
|
|
11
|
+
thinking: Type.TOptional<Type.TUnion<[Type.TLiteral<"off">, Type.TLiteral<"minimal">, Type.TLiteral<"low">, Type.TLiteral<"medium">, Type.TLiteral<"high">, Type.TLiteral<"xhigh">]>>;
|
|
12
|
+
max_turns: Type.TOptional<Type.TNumber>;
|
|
13
|
+
run_in_background: Type.TOptional<Type.TBoolean>;
|
|
14
|
+
fork_context: Type.TOptional<Type.TBoolean>;
|
|
15
|
+
}>;
|
|
16
|
+
declare const SendAgentInputArgsSchema: Type.TObject<{
|
|
17
|
+
target: Type.TString;
|
|
18
|
+
prompt: Type.TString;
|
|
19
|
+
mode: Type.TOptional<Type.TUnion<[Type.TLiteral<"prompt">, Type.TLiteral<"steer">, Type.TLiteral<"follow_up">]>>;
|
|
20
|
+
}>;
|
|
21
|
+
declare const WaitAgentArgsSchema: Type.TObject<{
|
|
22
|
+
targets: Type.TArray<Type.TString>;
|
|
23
|
+
timeout_ms: Type.TOptional<Type.TNumber>;
|
|
24
|
+
}>;
|
|
25
|
+
declare const CloseAgentArgsSchema: Type.TObject<{
|
|
26
|
+
target: Type.TString;
|
|
27
|
+
}>;
|
|
28
|
+
declare const ResumeAgentArgsSchema: Type.TObject<{
|
|
29
|
+
id: Type.TString;
|
|
30
|
+
}>;
|
|
31
|
+
declare const GetAgentResultArgsSchema: Type.TObject<{
|
|
32
|
+
target: Type.TString;
|
|
33
|
+
}>;
|
|
34
|
+
declare const ListAgentsArgsSchema: Type.TObject<{
|
|
35
|
+
path_prefix: Type.TOptional<Type.TString>;
|
|
36
|
+
}>;
|
|
37
|
+
type SpawnAgentArgs = Static<typeof SpawnAgentArgsSchema>;
|
|
38
|
+
type SendAgentInputArgs = Static<typeof SendAgentInputArgsSchema>;
|
|
39
|
+
type WaitAgentArgs = Static<typeof WaitAgentArgsSchema>;
|
|
40
|
+
type CloseAgentArgs = Static<typeof CloseAgentArgsSchema>;
|
|
41
|
+
type ResumeAgentArgs = Static<typeof ResumeAgentArgsSchema>;
|
|
42
|
+
type GetAgentResultArgs = Static<typeof GetAgentResultArgsSchema>;
|
|
43
|
+
type ListAgentsArgs = Static<typeof ListAgentsArgsSchema>;
|
|
44
|
+
declare function registerAgentControllerTool(pi: Pick<ExtensionAPI, "registerTool" | "appendEntry" | "on">): void;
|
|
45
|
+
declare function createSubagentToolRuntime(pi: Pick<ExtensionAPI, "appendEntry">): SubagentToolRuntime;
|
|
46
|
+
interface SubagentToolRuntime {
|
|
47
|
+
spawn(params: SpawnAgentArgs, ctx: ToolContext): Promise<AgentToolResult<unknown>>;
|
|
48
|
+
send(params: SendAgentInputArgs, ctx: ToolContext): Promise<AgentToolResult<unknown>>;
|
|
49
|
+
wait(params: WaitAgentArgs, ctx: ToolContext): Promise<AgentToolResult<unknown>>;
|
|
50
|
+
close(params: CloseAgentArgs, ctx: ToolContext): Promise<AgentToolResult<unknown>>;
|
|
51
|
+
resume(params: ResumeAgentArgs, ctx: ToolContext): Promise<AgentToolResult<unknown>>;
|
|
52
|
+
get(params: GetAgentResultArgs, ctx: ToolContext): Promise<AgentToolResult<unknown>>;
|
|
53
|
+
list(params: ListAgentsArgs, ctx: ToolContext): Promise<AgentToolResult<unknown>>;
|
|
54
|
+
dispose(): Promise<void>;
|
|
55
|
+
}
|
|
56
|
+
type ToolContext = Parameters<ToolDefinition["execute"]>[4];
|
|
57
|
+
declare function createSubagentTools(runtime: SubagentToolRuntime): readonly ToolDefinition[];
|
|
58
|
+
//#endregion
|
|
59
|
+
export { SubagentToolRuntime, createSubagentToolRuntime, createSubagentTools, registerAgentControllerTool };
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { defineTool } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { Type, getModels, getProviders } from "@earendil-works/pi-ai";
|
|
3
|
+
import { Result } from "better-result";
|
|
4
|
+
import { PipController, createSdkPipRunner } from "@pi-ohm/core/pip";
|
|
5
|
+
|
|
6
|
+
//#region src/agent-controller.ts
|
|
7
|
+
const defaultModel = "openai-codex/gpt-5.4-mini:medium";
|
|
8
|
+
const ThinkingLevelSchema = Type.Union([
|
|
9
|
+
Type.Literal("off"),
|
|
10
|
+
Type.Literal("minimal"),
|
|
11
|
+
Type.Literal("low"),
|
|
12
|
+
Type.Literal("medium"),
|
|
13
|
+
Type.Literal("high"),
|
|
14
|
+
Type.Literal("xhigh")
|
|
15
|
+
]);
|
|
16
|
+
const SpawnAgentArgsSchema = Type.Object({
|
|
17
|
+
task_name: Type.String({ minLength: 1 }),
|
|
18
|
+
prompt: Type.String({ minLength: 1 }),
|
|
19
|
+
summary: Type.String({ minLength: 1 }),
|
|
20
|
+
agent_type: Type.Optional(Type.String({ minLength: 1 })),
|
|
21
|
+
model: Type.Optional(Type.String({ minLength: 1 })),
|
|
22
|
+
thinking: Type.Optional(ThinkingLevelSchema),
|
|
23
|
+
max_turns: Type.Optional(Type.Number()),
|
|
24
|
+
run_in_background: Type.Optional(Type.Boolean()),
|
|
25
|
+
fork_context: Type.Optional(Type.Boolean())
|
|
26
|
+
});
|
|
27
|
+
const SendAgentInputArgsSchema = Type.Object({
|
|
28
|
+
target: Type.String({ minLength: 1 }),
|
|
29
|
+
prompt: Type.String({ minLength: 1 }),
|
|
30
|
+
mode: Type.Optional(Type.Union([
|
|
31
|
+
Type.Literal("prompt"),
|
|
32
|
+
Type.Literal("steer"),
|
|
33
|
+
Type.Literal("follow_up")
|
|
34
|
+
]))
|
|
35
|
+
});
|
|
36
|
+
const WaitAgentArgsSchema = Type.Object({
|
|
37
|
+
targets: Type.Array(Type.String({ minLength: 1 })),
|
|
38
|
+
timeout_ms: Type.Optional(Type.Number())
|
|
39
|
+
});
|
|
40
|
+
const CloseAgentArgsSchema = Type.Object({ target: Type.String({ minLength: 1 }) });
|
|
41
|
+
const ResumeAgentArgsSchema = Type.Object({ id: Type.String({ minLength: 1 }) });
|
|
42
|
+
const GetAgentResultArgsSchema = Type.Object({ target: Type.String({ minLength: 1 }) });
|
|
43
|
+
const ListAgentsArgsSchema = Type.Object({ path_prefix: Type.Optional(Type.String()) });
|
|
44
|
+
function registerAgentControllerTool(pi) {
|
|
45
|
+
const runtime = createSubagentToolRuntime(pi);
|
|
46
|
+
for (const tool of createSubagentTools(runtime)) pi.registerTool(tool);
|
|
47
|
+
pi.on("session_shutdown", async () => {
|
|
48
|
+
await runtime.dispose();
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function createSubagentToolRuntime(pi) {
|
|
52
|
+
const controllers = new Map();
|
|
53
|
+
return {
|
|
54
|
+
async spawn(params, ctx) {
|
|
55
|
+
const parentSessionId = ctx.sessionManager.getSessionId();
|
|
56
|
+
const record = getRecord(controllers, parentSessionId);
|
|
57
|
+
const key = controllerKey(params);
|
|
58
|
+
const currentController = record.controllers.get(key);
|
|
59
|
+
const created = currentController ? Result.ok(currentController) : createPipController({
|
|
60
|
+
pi,
|
|
61
|
+
params
|
|
62
|
+
});
|
|
63
|
+
if (Result.isError(created)) return toolError(created.error.message);
|
|
64
|
+
const controller = created.value;
|
|
65
|
+
if (!currentController) record.controllers.set(key, controller);
|
|
66
|
+
if (ctx.hasUI) ctx.ui.notify(`subagent spawned: ${params.task_name}`, "info");
|
|
67
|
+
const spawned = await controller.spawn({
|
|
68
|
+
ownerPackage: "@pi-ohm/subagents",
|
|
69
|
+
role: params.agent_type ?? "default",
|
|
70
|
+
parentSessionId,
|
|
71
|
+
cwd: ctx.cwd,
|
|
72
|
+
prompt: params.prompt,
|
|
73
|
+
runInBackground: params.run_in_background ?? true,
|
|
74
|
+
parentSessionFile: params.fork_context ? ctx.sessionManager.getSessionFile() : undefined
|
|
75
|
+
});
|
|
76
|
+
if (Result.isError(spawned)) return toolError(spawned.error.message);
|
|
77
|
+
record.taskIds.set(params.task_name, spawned.value.pipId);
|
|
78
|
+
record.taskControllers.set(spawned.value.pipId, controller);
|
|
79
|
+
if (ctx.hasUI && spawned.value.status.state !== "running") {
|
|
80
|
+
ctx.ui.notify(`subagent finished: ${params.task_name} (${spawned.value.status.state})`, "info");
|
|
81
|
+
}
|
|
82
|
+
return toolOk({
|
|
83
|
+
task_name: params.task_name,
|
|
84
|
+
task_id: spawned.value.pipId,
|
|
85
|
+
nickname: null,
|
|
86
|
+
child_session_path: spawned.value.childSessionPath,
|
|
87
|
+
status: spawned.value.status
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
async send(params, ctx) {
|
|
91
|
+
const record = getRecord(controllers, ctx.sessionManager.getSessionId());
|
|
92
|
+
const pipId = resolveTarget(record, params.target);
|
|
93
|
+
const controller = resolveController(record, pipId);
|
|
94
|
+
if (!controller) return toolError(`Subagent '${params.target}' was not found`);
|
|
95
|
+
const sent = await controller.send({
|
|
96
|
+
pipId,
|
|
97
|
+
prompt: params.prompt,
|
|
98
|
+
mode: params.mode
|
|
99
|
+
});
|
|
100
|
+
if (Result.isError(sent)) return toolError(sent.error.message);
|
|
101
|
+
return toolOk(sent.value);
|
|
102
|
+
},
|
|
103
|
+
async wait(params, ctx) {
|
|
104
|
+
const record = getRecord(controllers, ctx.sessionManager.getSessionId());
|
|
105
|
+
const statuses = {};
|
|
106
|
+
for (const target of params.targets) {
|
|
107
|
+
const pipId = resolveTarget(record, target);
|
|
108
|
+
const controller = resolveController(record, pipId);
|
|
109
|
+
if (!controller) {
|
|
110
|
+
statuses[target] = { state: "not_found" };
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
const waited = await controller.wait({
|
|
114
|
+
pipIds: [pipId],
|
|
115
|
+
timeoutMs: params.timeout_ms
|
|
116
|
+
});
|
|
117
|
+
if (Result.isError(waited)) return toolError(waited.error.message);
|
|
118
|
+
statuses[target] = waited.value.statuses[pipId] ?? { state: "not_found" };
|
|
119
|
+
}
|
|
120
|
+
return toolOk({
|
|
121
|
+
statuses,
|
|
122
|
+
timedOut: false
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
async close(params, ctx) {
|
|
126
|
+
const record = getRecord(controllers, ctx.sessionManager.getSessionId());
|
|
127
|
+
const pipId = resolveTarget(record, params.target);
|
|
128
|
+
const controller = resolveController(record, pipId);
|
|
129
|
+
if (!controller) return toolError(`Subagent '${params.target}' was not found`);
|
|
130
|
+
const closed = await controller.close({ pipId });
|
|
131
|
+
if (Result.isError(closed)) return toolError(closed.error.message);
|
|
132
|
+
if (ctx.hasUI) ctx.ui.notify(`subagent closed: ${params.target}`, "info");
|
|
133
|
+
return toolOk(closed.value);
|
|
134
|
+
},
|
|
135
|
+
async resume(params, ctx) {
|
|
136
|
+
const record = getRecord(controllers, ctx.sessionManager.getSessionId());
|
|
137
|
+
const pipId = resolveTarget(record, params.id);
|
|
138
|
+
const controller = resolveController(record, pipId);
|
|
139
|
+
if (!controller) return toolError(`Subagent '${params.id}' was not found`);
|
|
140
|
+
const resumed = await controller.resume({ pipId });
|
|
141
|
+
if (Result.isError(resumed)) return toolError(resumed.error.message);
|
|
142
|
+
return toolOk(resumed.value);
|
|
143
|
+
},
|
|
144
|
+
async get(params, ctx) {
|
|
145
|
+
const record = getRecord(controllers, ctx.sessionManager.getSessionId());
|
|
146
|
+
const pipId = resolveTarget(record, params.target);
|
|
147
|
+
const controller = resolveController(record, pipId);
|
|
148
|
+
if (!controller) return toolError(`Subagent '${params.target}' was not found`);
|
|
149
|
+
const found = await controller.get({ pipId });
|
|
150
|
+
if (Result.isError(found)) return toolError(found.error.message);
|
|
151
|
+
return toolOk({
|
|
152
|
+
target: params.target,
|
|
153
|
+
status: found.value.status,
|
|
154
|
+
result: statusResult(found.value.status),
|
|
155
|
+
session_path: found.value.childSessionPath
|
|
156
|
+
});
|
|
157
|
+
},
|
|
158
|
+
async list(params, ctx) {
|
|
159
|
+
const record = getRecord(controllers, ctx.sessionManager.getSessionId());
|
|
160
|
+
const agents = [];
|
|
161
|
+
for (const [agentName, pipId] of record.taskIds.entries()) {
|
|
162
|
+
if (params.path_prefix && !agentName.startsWith(params.path_prefix)) continue;
|
|
163
|
+
const controller = resolveController(record, pipId);
|
|
164
|
+
const found = controller ? await controller.get({ pipId }) : Result.ok(undefined);
|
|
165
|
+
const status = Result.isOk(found) && found.value ? found.value.status : { state: "not_found" };
|
|
166
|
+
agents.push({
|
|
167
|
+
agent_name: agentName,
|
|
168
|
+
agent_status: status,
|
|
169
|
+
task_id: pipId,
|
|
170
|
+
last_task_message: null
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
return toolOk({ agents });
|
|
174
|
+
},
|
|
175
|
+
async dispose() {
|
|
176
|
+
for (const record of controllers.values()) {
|
|
177
|
+
for (const [pipId, controller] of record.taskControllers.entries()) {
|
|
178
|
+
await controller.close({ pipId });
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
controllers.clear();
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function createSubagentTools(runtime) {
|
|
186
|
+
return [
|
|
187
|
+
defineTool({
|
|
188
|
+
name: "spawn_agent",
|
|
189
|
+
label: "Spawn Agent",
|
|
190
|
+
description: "Spawn a Pi-backed subagent session and submit the initial prompt.",
|
|
191
|
+
parameters: SpawnAgentArgsSchema,
|
|
192
|
+
execute: async (_toolCallId, params, _signal, _onUpdate, ctx) => runtime.spawn(params, ctx)
|
|
193
|
+
}),
|
|
194
|
+
defineTool({
|
|
195
|
+
name: "send_agent_input",
|
|
196
|
+
label: "Send Agent Input",
|
|
197
|
+
description: "Send follow-up input to an existing subagent session.",
|
|
198
|
+
parameters: SendAgentInputArgsSchema,
|
|
199
|
+
execute: async (_toolCallId, params, _signal, _onUpdate, ctx) => runtime.send(params, ctx)
|
|
200
|
+
}),
|
|
201
|
+
defineTool({
|
|
202
|
+
name: "wait_agent",
|
|
203
|
+
label: "Wait Agent",
|
|
204
|
+
description: "Wait for one or more subagents and return their current statuses.",
|
|
205
|
+
parameters: WaitAgentArgsSchema,
|
|
206
|
+
execute: async (_toolCallId, params, _signal, _onUpdate, ctx) => runtime.wait(params, ctx)
|
|
207
|
+
}),
|
|
208
|
+
defineTool({
|
|
209
|
+
name: "close_agent",
|
|
210
|
+
label: "Close Agent",
|
|
211
|
+
description: "Close a subagent session.",
|
|
212
|
+
parameters: CloseAgentArgsSchema,
|
|
213
|
+
execute: async (_toolCallId, params, _signal, _onUpdate, ctx) => runtime.close(params, ctx)
|
|
214
|
+
}),
|
|
215
|
+
defineTool({
|
|
216
|
+
name: "resume_agent",
|
|
217
|
+
label: "Resume Agent",
|
|
218
|
+
description: "Resume a known subagent session in the current parent session runtime.",
|
|
219
|
+
parameters: ResumeAgentArgsSchema,
|
|
220
|
+
execute: async (_toolCallId, params, _signal, _onUpdate, ctx) => runtime.resume(params, ctx)
|
|
221
|
+
}),
|
|
222
|
+
defineTool({
|
|
223
|
+
name: "get_agent_result",
|
|
224
|
+
label: "Get Agent Result",
|
|
225
|
+
description: "Get status and result text for a subagent session.",
|
|
226
|
+
parameters: GetAgentResultArgsSchema,
|
|
227
|
+
execute: async (_toolCallId, params, _signal, _onUpdate, ctx) => runtime.get(params, ctx)
|
|
228
|
+
}),
|
|
229
|
+
defineTool({
|
|
230
|
+
name: "list_agents",
|
|
231
|
+
label: "List Agents",
|
|
232
|
+
description: "List subagents known to the current parent session runtime.",
|
|
233
|
+
parameters: ListAgentsArgsSchema,
|
|
234
|
+
execute: async (_toolCallId, params, _signal, _onUpdate, ctx) => runtime.list(params, ctx)
|
|
235
|
+
})
|
|
236
|
+
];
|
|
237
|
+
}
|
|
238
|
+
function getRecord(map, parentSessionId) {
|
|
239
|
+
const current = map.get(parentSessionId);
|
|
240
|
+
if (current) return current;
|
|
241
|
+
const record = createControllerRecord();
|
|
242
|
+
map.set(parentSessionId, record);
|
|
243
|
+
return record;
|
|
244
|
+
}
|
|
245
|
+
function createControllerRecord() {
|
|
246
|
+
return {
|
|
247
|
+
taskIds: new Map(),
|
|
248
|
+
taskControllers: new Map(),
|
|
249
|
+
controllers: new Map()
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
function createPipController(input) {
|
|
253
|
+
const modelSpec = Result.try({
|
|
254
|
+
try: () => parseModelSpec(input.params.model),
|
|
255
|
+
catch: (cause) => cause instanceof Error ? cause : new Error(String(cause))
|
|
256
|
+
});
|
|
257
|
+
if (Result.isError(modelSpec)) return Result.err(modelSpec.error);
|
|
258
|
+
const thinkingLevel = input.params.thinking ?? modelSpec.value.thinkingLevel;
|
|
259
|
+
return Result.ok(new PipController({
|
|
260
|
+
runner: createSdkPipRunner({
|
|
261
|
+
model: modelSpec.value.model,
|
|
262
|
+
thinkingLevel
|
|
263
|
+
}),
|
|
264
|
+
entries: { write(entry) {
|
|
265
|
+
input.pi.appendEntry("pi-ohm.pip", entry);
|
|
266
|
+
return Result.ok(entry.pipId);
|
|
267
|
+
} }
|
|
268
|
+
}));
|
|
269
|
+
}
|
|
270
|
+
function controllerKey(params) {
|
|
271
|
+
return `${params.model ?? defaultModel}:${params.thinking ?? "default"}`;
|
|
272
|
+
}
|
|
273
|
+
function resolveTarget(record, target) {
|
|
274
|
+
return record.taskIds.get(target) ?? target;
|
|
275
|
+
}
|
|
276
|
+
function resolveController(record, pipId) {
|
|
277
|
+
return record.taskControllers.get(pipId);
|
|
278
|
+
}
|
|
279
|
+
function parseModelSpec(input) {
|
|
280
|
+
const spec = input ?? defaultModel;
|
|
281
|
+
const slash = spec.indexOf("/");
|
|
282
|
+
const colon = spec.lastIndexOf(":");
|
|
283
|
+
const provider = spec.slice(0, slash).trim();
|
|
284
|
+
const modelId = spec.slice(slash + 1, colon > slash ? colon : undefined).trim();
|
|
285
|
+
const thinkingLevel = parseThinkingLevel(colon > slash ? spec.slice(colon + 1) : "medium");
|
|
286
|
+
const knownProvider = getProviders().find((candidate) => candidate === provider);
|
|
287
|
+
if (!knownProvider) throw new Error(`Unknown subagent model provider '${provider}'`);
|
|
288
|
+
const model = getModels(knownProvider).find((candidate) => candidate.id === modelId);
|
|
289
|
+
if (!model) throw new Error(`Unknown subagent model '${provider}/${modelId}'`);
|
|
290
|
+
return {
|
|
291
|
+
model,
|
|
292
|
+
thinkingLevel
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
function parseThinkingLevel(input) {
|
|
296
|
+
const level = input.trim().toLowerCase();
|
|
297
|
+
if (level === "off") return "off";
|
|
298
|
+
if (level === "minimal") return "minimal";
|
|
299
|
+
if (level === "low") return "low";
|
|
300
|
+
if (level === "medium") return "medium";
|
|
301
|
+
if (level === "high") return "high";
|
|
302
|
+
if (level === "xhigh") return "xhigh";
|
|
303
|
+
throw new Error(`Unknown subagent thinking level '${input}'`);
|
|
304
|
+
}
|
|
305
|
+
function statusResult(status) {
|
|
306
|
+
if (status.state === "completed") return status.result;
|
|
307
|
+
if (status.state === "errored") return status.error;
|
|
308
|
+
return null;
|
|
309
|
+
}
|
|
310
|
+
function toolOk(value) {
|
|
311
|
+
return {
|
|
312
|
+
content: [{
|
|
313
|
+
type: "text",
|
|
314
|
+
text: JSON.stringify(value, null, 2)
|
|
315
|
+
}],
|
|
316
|
+
details: value
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
function toolError(message) {
|
|
320
|
+
return {
|
|
321
|
+
content: [{
|
|
322
|
+
type: "text",
|
|
323
|
+
text: JSON.stringify({ error: message }, null, 2)
|
|
324
|
+
}],
|
|
325
|
+
details: { error: message }
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
//#endregion
|
|
330
|
+
export { createSubagentToolRuntime, createSubagentTools, registerAgentControllerTool };
|
package/dist/extension.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { SubagentToolRuntime, createSubagentToolRuntime, createSubagentTools, registerAgentControllerTool } from "./agent-controller.js";
|
|
1
2
|
import { SubagentProfilePatch, SubagentProfilePatchSchema, SubagentProfileVariantMapPatchSchema, SubagentProfileVariantPatch, SubagentProfileVariantPatchSchema, SubagentToolPermissionDecisionPatch, SubagentToolPermissionDecisionSchema, SubagentToolPermissionMapSchema, parseSubagentProfilePatch, parseSubagentProfileVariantPatch } from "./schema.js";
|
|
2
3
|
import { DEFAULT_SUBAGENT_RUNTIME_CONFIG, ResolvedSubagentProfileRuntimeConfig, SubagentBackend, SubagentProfileRuntimeConfig, SubagentProfileVariantRuntimeConfig, SubagentRuntimeConfig, SubagentToolPermissionDecision, SubagentsConfig, SubagentsConfigSchema, getSubagentConfiguredModel, getSubagentProfileRuntimeConfig, isSubagentRuntimeConfig, mergeSubagentRuntimeConfig, normalizeSubagentModelOverride, resolveSubagentProfileRuntimeConfig, resolveSubagentVariantPattern, subagentsConfigModule } from "./config.js";
|
|
3
4
|
import { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
4
5
|
|
|
5
6
|
//#region src/extension.d.ts
|
|
6
|
-
declare function registerSubagentsExtension(
|
|
7
|
+
declare function registerSubagentsExtension(pi: ExtensionAPI): void;
|
|
7
8
|
//#endregion
|
|
8
|
-
export { DEFAULT_SUBAGENT_RUNTIME_CONFIG, ResolvedSubagentProfileRuntimeConfig, SubagentBackend, SubagentProfilePatch, SubagentProfilePatchSchema, SubagentProfileRuntimeConfig, SubagentProfileVariantMapPatchSchema, SubagentProfileVariantPatch, SubagentProfileVariantPatchSchema, SubagentProfileVariantRuntimeConfig, SubagentRuntimeConfig, SubagentToolPermissionDecision, SubagentToolPermissionDecisionPatch, SubagentToolPermissionDecisionSchema, SubagentToolPermissionMapSchema, SubagentsConfig, SubagentsConfigSchema, registerSubagentsExtension as default, getSubagentConfiguredModel, getSubagentProfileRuntimeConfig, isSubagentRuntimeConfig, mergeSubagentRuntimeConfig, normalizeSubagentModelOverride, parseSubagentProfilePatch, parseSubagentProfileVariantPatch, resolveSubagentProfileRuntimeConfig, resolveSubagentVariantPattern, subagentsConfigModule };
|
|
9
|
+
export { DEFAULT_SUBAGENT_RUNTIME_CONFIG, ResolvedSubagentProfileRuntimeConfig, SubagentBackend, SubagentProfilePatch, SubagentProfilePatchSchema, SubagentProfileRuntimeConfig, SubagentProfileVariantMapPatchSchema, SubagentProfileVariantPatch, SubagentProfileVariantPatchSchema, SubagentProfileVariantRuntimeConfig, SubagentRuntimeConfig, SubagentToolPermissionDecision, SubagentToolPermissionDecisionPatch, SubagentToolPermissionDecisionSchema, SubagentToolPermissionMapSchema, SubagentToolRuntime, SubagentsConfig, SubagentsConfigSchema, createSubagentToolRuntime, createSubagentTools, registerSubagentsExtension as default, getSubagentConfiguredModel, getSubagentProfileRuntimeConfig, isSubagentRuntimeConfig, mergeSubagentRuntimeConfig, normalizeSubagentModelOverride, parseSubagentProfilePatch, parseSubagentProfileVariantPatch, registerAgentControllerTool, resolveSubagentProfileRuntimeConfig, resolveSubagentVariantPattern, subagentsConfigModule };
|
package/dist/extension.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { createSubagentToolRuntime, createSubagentTools, registerAgentControllerTool } from "./agent-controller.js";
|
|
1
2
|
import { SubagentProfilePatchSchema, SubagentProfileVariantMapPatchSchema, SubagentProfileVariantPatchSchema, SubagentToolPermissionDecisionSchema, SubagentToolPermissionMapSchema, parseSubagentProfilePatch, parseSubagentProfileVariantPatch } from "./schema.js";
|
|
2
3
|
import { DEFAULT_SUBAGENT_RUNTIME_CONFIG, SubagentsConfigSchema, getSubagentConfiguredModel, getSubagentProfileRuntimeConfig, isSubagentRuntimeConfig, mergeSubagentRuntimeConfig, normalizeSubagentModelOverride, resolveSubagentProfileRuntimeConfig, resolveSubagentVariantPattern, subagentsConfigModule } from "./config.js";
|
|
3
4
|
|
|
4
5
|
//#region src/extension.ts
|
|
5
|
-
function registerSubagentsExtension(
|
|
6
|
+
function registerSubagentsExtension(pi) {
|
|
7
|
+
registerAgentControllerTool(pi);
|
|
8
|
+
}
|
|
6
9
|
|
|
7
10
|
//#endregion
|
|
8
|
-
export { DEFAULT_SUBAGENT_RUNTIME_CONFIG, SubagentProfilePatchSchema, SubagentProfileVariantMapPatchSchema, SubagentProfileVariantPatchSchema, SubagentToolPermissionDecisionSchema, SubagentToolPermissionMapSchema, SubagentsConfigSchema, registerSubagentsExtension as default, getSubagentConfiguredModel, getSubagentProfileRuntimeConfig, isSubagentRuntimeConfig, mergeSubagentRuntimeConfig, normalizeSubagentModelOverride, parseSubagentProfilePatch, parseSubagentProfileVariantPatch, resolveSubagentProfileRuntimeConfig, resolveSubagentVariantPattern, subagentsConfigModule };
|
|
11
|
+
export { DEFAULT_SUBAGENT_RUNTIME_CONFIG, SubagentProfilePatchSchema, SubagentProfileVariantMapPatchSchema, SubagentProfileVariantPatchSchema, SubagentToolPermissionDecisionSchema, SubagentToolPermissionMapSchema, SubagentsConfigSchema, createSubagentToolRuntime, createSubagentTools, registerSubagentsExtension as default, getSubagentConfiguredModel, getSubagentProfileRuntimeConfig, isSubagentRuntimeConfig, mergeSubagentRuntimeConfig, normalizeSubagentModelOverride, parseSubagentProfilePatch, parseSubagentProfileVariantPatch, registerAgentControllerTool, resolveSubagentProfileRuntimeConfig, resolveSubagentVariantPattern, subagentsConfigModule };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-ohm/subagents",
|
|
3
|
-
"version": "0.6.4-dev.
|
|
3
|
+
"version": "0.6.4-dev.25620170147.1.0b6891f",
|
|
4
4
|
"homepage": "https://github.com/pi-ohm/pi-ohm/tree/dev/packages/subagents#readme",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,14 +30,15 @@
|
|
|
30
30
|
"provenance": true
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
|
-
"build": "vp pack src/extension.ts src/config.ts"
|
|
33
|
+
"build": "vp pack src/extension.ts src/config.ts src/agent-controller.ts"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@earendil-works/pi-agent-core": "0.74.0",
|
|
37
|
+
"@earendil-works/pi-ai": "0.74.0",
|
|
37
38
|
"@earendil-works/pi-coding-agent": "0.74.0",
|
|
38
|
-
"@pi-ohm/core": "0.6.4-dev.
|
|
39
|
-
"@pi-ohm/tui": "0.6.4-dev.
|
|
40
|
-
"better-result": "
|
|
39
|
+
"@pi-ohm/core": "0.6.4-dev.25620170147.1.0b6891f",
|
|
40
|
+
"@pi-ohm/tui": "0.6.4-dev.25620170147.1.0b6891f",
|
|
41
|
+
"better-result": "2.9.2",
|
|
41
42
|
"typebox": "^1.0.68",
|
|
42
43
|
"zod": "^4"
|
|
43
44
|
},
|