@pi-ohm/subagents 0.6.4-dev.27882043826.1.f8cd4e4 → 0.6.4-dev.27886562528.1.753a5fd
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 +19 -2
- package/dist/agent-controller.js +133 -9
- package/dist/config.js +2 -2
- package/dist/extension.d.ts +2 -2
- package/dist/extension.js +2 -2
- package/dist/schema.d.ts +3 -3
- package/dist/schema.js +2 -2
- package/package.json +3 -3
|
@@ -56,7 +56,7 @@ declare function resolveAvailableAgents(input: {
|
|
|
56
56
|
readonly currentModel?: Model<Api>;
|
|
57
57
|
}): Promise<Result<readonly AvailableAgent[], Error>>;
|
|
58
58
|
interface SubagentToolRuntime {
|
|
59
|
-
spawn(params: SpawnAgentArgs, ctx: ToolContext): Promise<AgentToolResult<unknown>>;
|
|
59
|
+
spawn(params: SpawnAgentArgs, ctx: ToolContext, signal: AbortSignal | undefined): Promise<AgentToolResult<unknown>>;
|
|
60
60
|
sendMessage(params: SendMessageArgs, ctx: ToolContext): Promise<AgentToolResult<unknown>>;
|
|
61
61
|
followupTask(params: FollowupTaskArgs, ctx: ToolContext): Promise<AgentToolResult<unknown>>;
|
|
62
62
|
wait(params: WaitAgentArgs, ctx: ToolContext): Promise<AgentToolResult<unknown>>;
|
|
@@ -67,6 +67,23 @@ interface SubagentToolRuntime {
|
|
|
67
67
|
type ToolContext = Parameters<ToolDefinition["execute"]>[4];
|
|
68
68
|
declare function createSubagentTools(runtime: SubagentToolRuntime): readonly ToolDefinition[];
|
|
69
69
|
declare function resolveForkMode(forkTurns: string | undefined): Result<SpawnForkMode, Error>;
|
|
70
|
+
declare function createBranchSummaryForkEntries(input: {
|
|
71
|
+
readonly entries: readonly SessionEntry[];
|
|
72
|
+
readonly summary: string;
|
|
73
|
+
readonly readFiles: readonly string[];
|
|
74
|
+
readonly modifiedFiles: readonly string[];
|
|
75
|
+
readonly id: string;
|
|
76
|
+
readonly timestamp: string;
|
|
77
|
+
}): readonly SessionEntry[];
|
|
78
|
+
declare function createCompactionForkEntries(input: {
|
|
79
|
+
readonly entries: readonly SessionEntry[];
|
|
80
|
+
readonly summary: string;
|
|
81
|
+
readonly firstKeptEntryId: string;
|
|
82
|
+
readonly tokensBefore: number;
|
|
83
|
+
readonly details?: unknown;
|
|
84
|
+
readonly id: string;
|
|
85
|
+
readonly timestamp: string;
|
|
86
|
+
}): readonly SessionEntry[];
|
|
70
87
|
declare function sliceForkEntries(entries: readonly SessionEntry[], turns: number): readonly SessionEntry[];
|
|
71
88
|
//#endregion
|
|
72
|
-
export { type ResolvedSpawnConfig, SubagentToolRuntime, createSubagentToolRuntime, createSubagentTools, registerAgentControllerTool, resolveAvailableAgents, resolveForkMode, resolveSpawnConfig, sliceForkEntries };
|
|
89
|
+
export { type ResolvedSpawnConfig, SubagentToolRuntime, createBranchSummaryForkEntries, createCompactionForkEntries, createSubagentToolRuntime, createSubagentTools, registerAgentControllerTool, resolveAvailableAgents, resolveForkMode, resolveSpawnConfig, sliceForkEntries };
|
package/dist/agent-controller.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isSubagentRuntimeConfig, resolveSubagentAgentRuntimeConfig, subagentsConfigModule } from "./config.js";
|
|
1
|
+
import { getSummarizeHistoryConfig, isSubagentRuntimeConfig, resolveSubagentAgentRuntimeConfig, subagentsConfigModule } from "./config.js";
|
|
2
2
|
import { INTEGRATED_SUBAGENTS } from "./catalog.js";
|
|
3
3
|
import { DEFAULT_AGENT_TYPE, resolveSpawnConfig } from "./spawn-config.js";
|
|
4
4
|
import { Result } from "better-result";
|
|
@@ -6,7 +6,7 @@ import { loadConfig, pickConfig } from "@pi-ohm/core/config";
|
|
|
6
6
|
import { randomUUID } from "node:crypto";
|
|
7
7
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
8
8
|
import { join } from "node:path";
|
|
9
|
-
import { CURRENT_SESSION_VERSION, defineTool } from "@earendil-works/pi-coding-agent";
|
|
9
|
+
import { CURRENT_SESSION_VERSION, DEFAULT_COMPACTION_SETTINGS, buildSessionContext, defineTool, estimateTokens, findCutPoint, generateBranchSummary, generateSummary } from "@earendil-works/pi-coding-agent";
|
|
10
10
|
import { Type } from "@earendil-works/pi-ai";
|
|
11
11
|
import { PipController, createSdkPipRunner } from "@pi-ohm/core/pip";
|
|
12
12
|
import { resolveOhmAgentDataHome } from "@pi-ohm/core/paths";
|
|
@@ -62,7 +62,7 @@ function registerAgentControllerTool(pi) {
|
|
|
62
62
|
function createSubagentToolRuntime(pi) {
|
|
63
63
|
const ownedPipIds = new Set();
|
|
64
64
|
return {
|
|
65
|
-
async spawn(params, ctx) {
|
|
65
|
+
async spawn(params, ctx, signal) {
|
|
66
66
|
const taskName = normalizeTaskName(params.task_name);
|
|
67
67
|
if (Result.isError(taskName)) return toolError(taskName.error.message);
|
|
68
68
|
const fork = resolveForkMode(params.fork_turns);
|
|
@@ -90,6 +90,8 @@ function createSubagentToolRuntime(pi) {
|
|
|
90
90
|
currentThinking: pi.getThinkingLevel()
|
|
91
91
|
});
|
|
92
92
|
if (Result.isError(config)) return toolError(config.error.message);
|
|
93
|
+
const summarize = await resolveSummarizeHistoryConfig(ctx.cwd);
|
|
94
|
+
if (Result.isError(summarize)) return toolError(summarize.error.message);
|
|
93
95
|
const key = controllerKey(config.value);
|
|
94
96
|
const currentController = record.controllers.get(key);
|
|
95
97
|
const created = currentController ? Result.ok(currentController) : createPipController({
|
|
@@ -103,7 +105,12 @@ function createSubagentToolRuntime(pi) {
|
|
|
103
105
|
const parentSessionFile = await resolveForkSourceFile({
|
|
104
106
|
fork: fork.value,
|
|
105
107
|
sessionManager: ctx.sessionManager,
|
|
106
|
-
cwd: ctx.cwd
|
|
108
|
+
cwd: ctx.cwd,
|
|
109
|
+
summarize: summarize.value,
|
|
110
|
+
model: ctx.model,
|
|
111
|
+
modelRegistry: ctx.modelRegistry,
|
|
112
|
+
thinking: pi.getThinkingLevel(),
|
|
113
|
+
signal
|
|
107
114
|
});
|
|
108
115
|
if (Result.isError(parentSessionFile)) return toolError(parentSessionFile.error.message);
|
|
109
116
|
const spawned = await controller.spawn({
|
|
@@ -307,7 +314,7 @@ function createSubagentTools(runtime) {
|
|
|
307
314
|
label: "Spawn Agent",
|
|
308
315
|
description: "Spawns an agent to work on a concrete bounded task. The spawned agent inherits the parent model unless explicit overrides are supplied.",
|
|
309
316
|
parameters: SpawnAgentArgsSchema,
|
|
310
|
-
execute: async (_toolCallId, params,
|
|
317
|
+
execute: async (_toolCallId, params, signal, _onUpdate, ctx) => runtime.spawn(params, ctx, signal)
|
|
311
318
|
}),
|
|
312
319
|
defineTool({
|
|
313
320
|
name: "send_message",
|
|
@@ -409,15 +416,102 @@ function resolveForkMode(forkTurns) {
|
|
|
409
416
|
}
|
|
410
417
|
return Result.err(new Error("fork_turns must be \"none\", \"all\", or a positive integer string"));
|
|
411
418
|
}
|
|
419
|
+
async function resolveSummarizeHistoryConfig(cwd) {
|
|
420
|
+
const loaded = await loadConfig({
|
|
421
|
+
cwd,
|
|
422
|
+
modules: [subagentsConfigModule]
|
|
423
|
+
});
|
|
424
|
+
if (Result.isError(loaded)) return Result.err(loaded.error);
|
|
425
|
+
const subagents = pickConfig({
|
|
426
|
+
loaded: loaded.value,
|
|
427
|
+
module: subagentsConfigModule,
|
|
428
|
+
is: isSubagentRuntimeConfig
|
|
429
|
+
});
|
|
430
|
+
if (Result.isError(subagents)) return Result.err(subagents.error);
|
|
431
|
+
return Result.ok(getSummarizeHistoryConfig({ subagents: subagents.value }));
|
|
432
|
+
}
|
|
412
433
|
async function resolveForkSourceFile(input) {
|
|
413
434
|
if (input.fork.kind === "none") return Result.ok(undefined);
|
|
414
435
|
const source = input.fork.kind === "all" ? reparentEntries(input.sessionManager.getBranch()) : sliceForkEntries(input.sessionManager.getBranch(), input.fork.turns);
|
|
436
|
+
const entries = input.summarize.enabled ? await summarizeForkEntries({
|
|
437
|
+
entries: source,
|
|
438
|
+
summarize: input.summarize,
|
|
439
|
+
model: input.model,
|
|
440
|
+
modelRegistry: input.modelRegistry,
|
|
441
|
+
thinking: input.thinking,
|
|
442
|
+
signal: input.signal
|
|
443
|
+
}) : Result.ok(source);
|
|
444
|
+
if (Result.isError(entries)) return Result.err(entries.error);
|
|
415
445
|
return writeForkSourceFile({
|
|
416
446
|
header: forkSourceHeader({
|
|
417
447
|
sessionManager: input.sessionManager,
|
|
418
448
|
cwd: input.cwd
|
|
419
449
|
}),
|
|
420
|
-
entries:
|
|
450
|
+
entries: entries.value
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
async function summarizeForkEntries(input) {
|
|
454
|
+
if (input.entries.length === 0) return Result.ok([]);
|
|
455
|
+
const model = input.model;
|
|
456
|
+
if (!model) return Result.err(new Error("No active model available to summarize fork history"));
|
|
457
|
+
const auth = await resolveSummaryAuth({
|
|
458
|
+
model,
|
|
459
|
+
modelRegistry: input.modelRegistry
|
|
460
|
+
});
|
|
461
|
+
if (Result.isError(auth)) return Result.err(auth.error);
|
|
462
|
+
if (input.summarize.type === "branch") {
|
|
463
|
+
const summarized = await Result.tryPromise({
|
|
464
|
+
try: () => generateBranchSummary([...input.entries], {
|
|
465
|
+
model,
|
|
466
|
+
apiKey: auth.value.apiKey,
|
|
467
|
+
headers: auth.value.headers,
|
|
468
|
+
signal: input.signal ?? new AbortController().signal
|
|
469
|
+
}),
|
|
470
|
+
catch: (cause) => new Error(`Failed to summarize fork history: ${messageFromCause(cause)}`)
|
|
471
|
+
});
|
|
472
|
+
if (Result.isError(summarized)) return Result.err(summarized.error);
|
|
473
|
+
if (summarized.value.aborted) return Result.err(new Error("Fork history summarization aborted"));
|
|
474
|
+
if (summarized.value.error) {
|
|
475
|
+
return Result.err(new Error(`Failed to summarize fork history: ${summarized.value.error}`));
|
|
476
|
+
}
|
|
477
|
+
const summary = summarized.value.summary ?? "No summary generated";
|
|
478
|
+
return Result.ok(createBranchSummaryForkEntries({
|
|
479
|
+
entries: input.entries,
|
|
480
|
+
summary,
|
|
481
|
+
readFiles: summarized.value.readFiles ?? [],
|
|
482
|
+
modifiedFiles: summarized.value.modifiedFiles ?? [],
|
|
483
|
+
id: randomUUID(),
|
|
484
|
+
timestamp: new Date().toISOString()
|
|
485
|
+
}));
|
|
486
|
+
}
|
|
487
|
+
const cut = findCutPoint([...input.entries], 0, input.entries.length, DEFAULT_COMPACTION_SETTINGS.keepRecentTokens);
|
|
488
|
+
const firstKeptEntry = input.entries[cut.firstKeptEntryIndex];
|
|
489
|
+
if (!firstKeptEntry) return Result.ok(input.entries);
|
|
490
|
+
const historyEnd = cut.isSplitTurn && cut.turnStartIndex >= 0 ? cut.turnStartIndex : cut.firstKeptEntryIndex;
|
|
491
|
+
const messages = buildSessionContext(input.entries.slice(0, historyEnd)).messages;
|
|
492
|
+
if (messages.length === 0) return Result.ok(input.entries);
|
|
493
|
+
const tokensBefore = buildSessionContext([...input.entries]).messages.reduce((total, message) => total + estimateTokens(message), 0);
|
|
494
|
+
const compacted = await Result.tryPromise({
|
|
495
|
+
try: () => generateSummary(messages, model, DEFAULT_COMPACTION_SETTINGS.reserveTokens, auth.value.apiKey, auth.value.headers, input.signal, undefined, undefined, input.thinking),
|
|
496
|
+
catch: (cause) => new Error(`Failed to compact fork history: ${messageFromCause(cause)}`)
|
|
497
|
+
});
|
|
498
|
+
if (Result.isError(compacted)) return Result.err(compacted.error);
|
|
499
|
+
return Result.ok(createCompactionForkEntries({
|
|
500
|
+
entries: input.entries,
|
|
501
|
+
summary: compacted.value,
|
|
502
|
+
firstKeptEntryId: firstKeptEntry.id,
|
|
503
|
+
tokensBefore,
|
|
504
|
+
id: randomUUID(),
|
|
505
|
+
timestamp: new Date().toISOString()
|
|
506
|
+
}));
|
|
507
|
+
}
|
|
508
|
+
async function resolveSummaryAuth(input) {
|
|
509
|
+
const auth = await input.modelRegistry.getApiKeyAndHeaders(input.model);
|
|
510
|
+
if (!auth.ok) return Result.err(new Error(auth.error));
|
|
511
|
+
if (!auth.apiKey) return Result.err(new Error(`No API key found for "${input.model.provider}"`));
|
|
512
|
+
return Result.ok({
|
|
513
|
+
apiKey: auth.apiKey,
|
|
514
|
+
...auth.headers ? { headers: auth.headers } : {}
|
|
421
515
|
});
|
|
422
516
|
}
|
|
423
517
|
function forkSourceHeader(input) {
|
|
@@ -452,6 +546,36 @@ async function writeForkSourceFile(input) {
|
|
|
452
546
|
if (Result.isError(written)) return Result.err(written.error);
|
|
453
547
|
return Result.ok(written.value);
|
|
454
548
|
}
|
|
549
|
+
function createBranchSummaryForkEntries(input) {
|
|
550
|
+
const fromId = input.entries[input.entries.length - 1]?.id ?? "root";
|
|
551
|
+
return [{
|
|
552
|
+
type: "branch_summary",
|
|
553
|
+
id: input.id,
|
|
554
|
+
parentId: null,
|
|
555
|
+
timestamp: input.timestamp,
|
|
556
|
+
fromId,
|
|
557
|
+
summary: input.summary,
|
|
558
|
+
details: {
|
|
559
|
+
readFiles: [...input.readFiles],
|
|
560
|
+
modifiedFiles: [...input.modifiedFiles]
|
|
561
|
+
}
|
|
562
|
+
}];
|
|
563
|
+
}
|
|
564
|
+
function createCompactionForkEntries(input) {
|
|
565
|
+
const compaction = {
|
|
566
|
+
type: "compaction",
|
|
567
|
+
id: input.id,
|
|
568
|
+
parentId: null,
|
|
569
|
+
timestamp: input.timestamp,
|
|
570
|
+
summary: input.summary,
|
|
571
|
+
firstKeptEntryId: input.firstKeptEntryId,
|
|
572
|
+
tokensBefore: input.tokensBefore,
|
|
573
|
+
details: input.details
|
|
574
|
+
};
|
|
575
|
+
const firstKeptIndex = input.entries.findIndex((entry) => entry.id === input.firstKeptEntryId);
|
|
576
|
+
const suffix = firstKeptIndex >= 0 ? input.entries.slice(firstKeptIndex) : [];
|
|
577
|
+
return [compaction, ...reparentEntries(suffix, compaction.id)];
|
|
578
|
+
}
|
|
455
579
|
function sliceForkEntries(entries, turns) {
|
|
456
580
|
const positions = entries.flatMap((entry, index) => isForkTurnBoundary(entry) ? [index] : []);
|
|
457
581
|
const start = positions.length > turns ? positions[positions.length - turns] : positions[0] ?? entries.length;
|
|
@@ -460,10 +584,10 @@ function sliceForkEntries(entries, turns) {
|
|
|
460
584
|
function isForkTurnBoundary(entry) {
|
|
461
585
|
return entry.type === "message" && entry.message.role === "user";
|
|
462
586
|
}
|
|
463
|
-
function reparentEntries(entries) {
|
|
587
|
+
function reparentEntries(entries, parentId = null) {
|
|
464
588
|
const initial = {
|
|
465
589
|
entries: [],
|
|
466
|
-
parentId
|
|
590
|
+
parentId
|
|
467
591
|
};
|
|
468
592
|
return entries.reduce((state, entry) => {
|
|
469
593
|
state.entries.push(reparentEntry(entry, state.parentId));
|
|
@@ -742,4 +866,4 @@ function toolError(message) {
|
|
|
742
866
|
}
|
|
743
867
|
|
|
744
868
|
//#endregion
|
|
745
|
-
export { createSubagentToolRuntime, createSubagentTools, registerAgentControllerTool, resolveAvailableAgents, resolveForkMode, resolveSpawnConfig, sliceForkEntries };
|
|
869
|
+
export { createBranchSummaryForkEntries, createCompactionForkEntries, createSubagentToolRuntime, createSubagentTools, registerAgentControllerTool, resolveAvailableAgents, resolveForkMode, resolveSpawnConfig, sliceForkEntries };
|
package/dist/config.js
CHANGED
|
@@ -8,7 +8,7 @@ import { Value } from "typebox/value";
|
|
|
8
8
|
const SubagentRuntimeAgentsSchema = Type.Record(Type.String({ minLength: 1 }), SubagentAgentPatchSchema);
|
|
9
9
|
const SummarizeHistoryRuntimeConfigSchema = Type.Object({
|
|
10
10
|
enabled: Type.Boolean(),
|
|
11
|
-
type: Type.Union([Type.Literal("
|
|
11
|
+
type: Type.Union([Type.Literal("branch"), Type.Literal("compact")])
|
|
12
12
|
}, { additionalProperties: false });
|
|
13
13
|
const SubagentsExperimentalRuntimeConfigSchema = Type.Object({ summarize_history: SummarizeHistoryRuntimeConfigSchema }, { additionalProperties: false });
|
|
14
14
|
const SubagentRuntimeConfigSchema = Type.Object({
|
|
@@ -19,7 +19,7 @@ const DEFAULT_SUBAGENT_RUNTIME_CONFIG = {
|
|
|
19
19
|
agents: {},
|
|
20
20
|
experimental: { summarize_history: {
|
|
21
21
|
enabled: false,
|
|
22
|
-
type: "
|
|
22
|
+
type: "branch"
|
|
23
23
|
} }
|
|
24
24
|
};
|
|
25
25
|
const subagentsConfigModule = registerConfig({
|
package/dist/extension.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ResolvedSpawnConfig, resolveSpawnConfig } from "./spawn-config.js";
|
|
2
|
-
import { SubagentToolRuntime, createSubagentToolRuntime, createSubagentTools, registerAgentControllerTool, resolveAvailableAgents, resolveForkMode, sliceForkEntries } from "./agent-controller.js";
|
|
2
|
+
import { SubagentToolRuntime, createBranchSummaryForkEntries, createCompactionForkEntries, createSubagentToolRuntime, createSubagentTools, registerAgentControllerTool, resolveAvailableAgents, resolveForkMode, sliceForkEntries } from "./agent-controller.js";
|
|
3
3
|
import { SubagentAgentPatch, SubagentAgentPatchSchema, SubagentToolPermissionDecisionSchema, SubagentToolPermissionMapSchema, SubagentsConfigPatch, SubagentsConfigSchema, SubagentsExperimentalConfigPatch, SubagentsExperimentalConfigPatchSchema, SummarizeHistoryConfigPatch, SummarizeHistoryConfigPatchSchema, SummarizeHistoryType, SummarizeHistoryTypeSchema, parseSubagentAgentPatch, parseSubagentsExperimentalConfigPatch } from "./schema.js";
|
|
4
4
|
import { DEFAULT_SUBAGENT_RUNTIME_CONFIG, ResolvedSubagentAgentRuntimeConfig, SubagentAgentRuntimeConfig, SubagentRuntimeConfig, SubagentToolPermissionDecision, SubagentsConfig, SubagentsExperimentalRuntimeConfig, SummarizeHistoryRuntimeConfig, getSubagentAgentRuntimeConfig, getSubagentConfiguredModel, getSummarizeHistoryConfig, isSubagentRuntimeConfig, mergeSubagentRuntimeConfig, normalizeSubagentModelOverride, resolveSubagentAgentRuntimeConfig, subagentsConfigModule } from "./config.js";
|
|
5
5
|
import { INTEGRATED_SUBAGENTS, IntegratedSubagent } from "./catalog.js";
|
|
@@ -25,4 +25,4 @@ interface SubagentsCommandContext {
|
|
|
25
25
|
declare function runSubagentsCommand(ctx: SubagentsCommandContext, pi: Pick<ExtensionAPI, "getThinkingLevel">): Promise<boolean>;
|
|
26
26
|
declare function registerSubagentsExtension(pi: Pick<ExtensionAPI, "appendEntry" | "getThinkingLevel" | "on" | "registerCommand" | "registerTool" | "sendMessage">): void;
|
|
27
27
|
//#endregion
|
|
28
|
-
export { BuildSubagentOverviewInput, DEFAULT_SUBAGENT_RUNTIME_CONFIG, INTEGRATED_SUBAGENTS, IntegratedSubagent, type ResolvedSpawnConfig, ResolvedSubagentAgentRuntimeConfig, type SubagentAgentPatch, SubagentAgentPatchSchema, SubagentAgentRuntimeConfig, SubagentOverview, SubagentOverviewEntry, SubagentRuntimeConfig, SubagentSource, SubagentToolPermissionDecision, SubagentToolPermissionDecisionSchema, SubagentToolPermissionMapSchema, SubagentToolRuntime, SubagentsCommandContext, SubagentsConfig, type SubagentsConfigPatch, SubagentsConfigSchema, type SubagentsExperimentalConfigPatch, SubagentsExperimentalConfigPatchSchema, SubagentsExperimentalRuntimeConfig, type SummarizeHistoryConfigPatch, SummarizeHistoryConfigPatchSchema, SummarizeHistoryRuntimeConfig, type SummarizeHistoryType, SummarizeHistoryTypeSchema, buildSubagentOverview, createSubagentToolRuntime, createSubagentTools, createSubagentsOverviewComponent, registerSubagentsExtension as default, getSubagentAgentRuntimeConfig, getSubagentConfiguredModel, getSummarizeHistoryConfig, isSubagentRuntimeConfig, mergeSubagentRuntimeConfig, normalizeSubagentModelOverride, parseSubagentAgentPatch, parseSubagentsExperimentalConfigPatch, registerAgentControllerTool, renderSubagentOverview, resolveAvailableAgents, resolveForkMode, resolveSpawnConfig, resolveSubagentAgentRuntimeConfig, runSubagentsCommand, sliceForkEntries, subagentsConfigModule };
|
|
28
|
+
export { BuildSubagentOverviewInput, DEFAULT_SUBAGENT_RUNTIME_CONFIG, INTEGRATED_SUBAGENTS, IntegratedSubagent, type ResolvedSpawnConfig, ResolvedSubagentAgentRuntimeConfig, type SubagentAgentPatch, SubagentAgentPatchSchema, SubagentAgentRuntimeConfig, SubagentOverview, SubagentOverviewEntry, SubagentRuntimeConfig, SubagentSource, SubagentToolPermissionDecision, SubagentToolPermissionDecisionSchema, SubagentToolPermissionMapSchema, SubagentToolRuntime, SubagentsCommandContext, SubagentsConfig, type SubagentsConfigPatch, SubagentsConfigSchema, type SubagentsExperimentalConfigPatch, SubagentsExperimentalConfigPatchSchema, SubagentsExperimentalRuntimeConfig, type SummarizeHistoryConfigPatch, SummarizeHistoryConfigPatchSchema, SummarizeHistoryRuntimeConfig, type SummarizeHistoryType, SummarizeHistoryTypeSchema, buildSubagentOverview, createBranchSummaryForkEntries, createCompactionForkEntries, createSubagentToolRuntime, createSubagentTools, createSubagentsOverviewComponent, registerSubagentsExtension as default, getSubagentAgentRuntimeConfig, getSubagentConfiguredModel, getSummarizeHistoryConfig, isSubagentRuntimeConfig, mergeSubagentRuntimeConfig, normalizeSubagentModelOverride, parseSubagentAgentPatch, parseSubagentsExperimentalConfigPatch, registerAgentControllerTool, renderSubagentOverview, resolveAvailableAgents, resolveForkMode, resolveSpawnConfig, resolveSubagentAgentRuntimeConfig, runSubagentsCommand, sliceForkEntries, subagentsConfigModule };
|
package/dist/extension.js
CHANGED
|
@@ -2,7 +2,7 @@ import { SubagentAgentPatchSchema, SubagentToolPermissionDecisionSchema, Subagen
|
|
|
2
2
|
import { DEFAULT_SUBAGENT_RUNTIME_CONFIG, getSubagentAgentRuntimeConfig, getSubagentConfiguredModel, getSummarizeHistoryConfig, isSubagentRuntimeConfig, mergeSubagentRuntimeConfig, normalizeSubagentModelOverride, resolveSubagentAgentRuntimeConfig, subagentsConfigModule } from "./config.js";
|
|
3
3
|
import { INTEGRATED_SUBAGENTS } from "./catalog.js";
|
|
4
4
|
import { resolveSpawnConfig } from "./spawn-config.js";
|
|
5
|
-
import { createSubagentToolRuntime, createSubagentTools, registerAgentControllerTool, resolveAvailableAgents, resolveForkMode, sliceForkEntries } from "./agent-controller.js";
|
|
5
|
+
import { createBranchSummaryForkEntries, createCompactionForkEntries, createSubagentToolRuntime, createSubagentTools, registerAgentControllerTool, resolveAvailableAgents, resolveForkMode, sliceForkEntries } from "./agent-controller.js";
|
|
6
6
|
import { buildSubagentOverview, createSubagentsOverviewComponent, renderSubagentOverview } from "./overview.js";
|
|
7
7
|
import { Result } from "better-result";
|
|
8
8
|
import { loadConfig, pickConfig, registerGlobalConfigModule, watchConfig } from "@pi-ohm/core/config";
|
|
@@ -109,4 +109,4 @@ function registerSubagentsExtension(pi) {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
//#endregion
|
|
112
|
-
export { DEFAULT_SUBAGENT_RUNTIME_CONFIG, INTEGRATED_SUBAGENTS, SubagentAgentPatchSchema, SubagentToolPermissionDecisionSchema, SubagentToolPermissionMapSchema, SubagentsConfigSchema, SubagentsExperimentalConfigPatchSchema, SummarizeHistoryConfigPatchSchema, SummarizeHistoryTypeSchema, buildSubagentOverview, createSubagentToolRuntime, createSubagentTools, createSubagentsOverviewComponent, registerSubagentsExtension as default, getSubagentAgentRuntimeConfig, getSubagentConfiguredModel, getSummarizeHistoryConfig, isSubagentRuntimeConfig, mergeSubagentRuntimeConfig, normalizeSubagentModelOverride, parseSubagentAgentPatch, parseSubagentsExperimentalConfigPatch, registerAgentControllerTool, renderSubagentOverview, resolveAvailableAgents, resolveForkMode, resolveSpawnConfig, resolveSubagentAgentRuntimeConfig, runSubagentsCommand, sliceForkEntries, subagentsConfigModule };
|
|
112
|
+
export { DEFAULT_SUBAGENT_RUNTIME_CONFIG, INTEGRATED_SUBAGENTS, SubagentAgentPatchSchema, SubagentToolPermissionDecisionSchema, SubagentToolPermissionMapSchema, SubagentsConfigSchema, SubagentsExperimentalConfigPatchSchema, SummarizeHistoryConfigPatchSchema, SummarizeHistoryTypeSchema, buildSubagentOverview, createBranchSummaryForkEntries, createCompactionForkEntries, createSubagentToolRuntime, createSubagentTools, createSubagentsOverviewComponent, registerSubagentsExtension as default, getSubagentAgentRuntimeConfig, getSubagentConfiguredModel, getSummarizeHistoryConfig, isSubagentRuntimeConfig, mergeSubagentRuntimeConfig, normalizeSubagentModelOverride, parseSubagentAgentPatch, parseSubagentsExperimentalConfigPatch, registerAgentControllerTool, renderSubagentOverview, resolveAvailableAgents, resolveForkMode, resolveSpawnConfig, resolveSubagentAgentRuntimeConfig, runSubagentsCommand, sliceForkEntries, subagentsConfigModule };
|
package/dist/schema.d.ts
CHANGED
|
@@ -12,16 +12,16 @@ declare const SubagentAgentPatchSchema: Type.TObject<{
|
|
|
12
12
|
description: Type.TOptional<Type.TString>;
|
|
13
13
|
permissions: Type.TOptional<Type.TRecord<"^.*$", Type.TUnion<[Type.TLiteral<"allow">, Type.TLiteral<"deny">]>>>;
|
|
14
14
|
}>;
|
|
15
|
-
declare const SummarizeHistoryTypeSchema: Type.TUnion<[Type.TLiteral<"
|
|
15
|
+
declare const SummarizeHistoryTypeSchema: Type.TUnion<[Type.TLiteral<"branch">, Type.TLiteral<"compact">]>;
|
|
16
16
|
declare const SummarizeHistoryConfigPatchSchema: Type.TObject<{
|
|
17
17
|
enabled: Type.TOptional<Type.TBoolean>;
|
|
18
|
-
type: Type.TOptional<Type.TUnion<[Type.TLiteral<"
|
|
18
|
+
type: Type.TOptional<Type.TUnion<[Type.TLiteral<"branch">, Type.TLiteral<"compact">]>>;
|
|
19
19
|
model: Type.TOptional<Type.TString>;
|
|
20
20
|
}>;
|
|
21
21
|
declare const SubagentsExperimentalConfigPatchSchema: Type.TObject<{
|
|
22
22
|
summarize_history: Type.TOptional<Type.TObject<{
|
|
23
23
|
enabled: Type.TOptional<Type.TBoolean>;
|
|
24
|
-
type: Type.TOptional<Type.TUnion<[Type.TLiteral<"
|
|
24
|
+
type: Type.TOptional<Type.TUnion<[Type.TLiteral<"branch">, Type.TLiteral<"compact">]>>;
|
|
25
25
|
model: Type.TOptional<Type.TString>;
|
|
26
26
|
}>>;
|
|
27
27
|
}>;
|
package/dist/schema.js
CHANGED
|
@@ -16,7 +16,7 @@ const SubagentAgentPatchSchema = Type.Object({
|
|
|
16
16
|
description: Type.Optional(NonEmptyStringSchema),
|
|
17
17
|
permissions: Type.Optional(SubagentToolPermissionMapSchema)
|
|
18
18
|
}, { additionalProperties: false });
|
|
19
|
-
const SummarizeHistoryTypeSchema = Type.Union([Type.Literal("
|
|
19
|
+
const SummarizeHistoryTypeSchema = Type.Union([Type.Literal("branch"), Type.Literal("compact")]);
|
|
20
20
|
const SummarizeHistoryConfigPatchSchema = Type.Object({
|
|
21
21
|
enabled: Type.Optional(Type.Boolean()),
|
|
22
22
|
type: Type.Optional(SummarizeHistoryTypeSchema),
|
|
@@ -51,7 +51,7 @@ function toBoolean(value) {
|
|
|
51
51
|
}
|
|
52
52
|
function toSummarizeHistoryType(value) {
|
|
53
53
|
const type = toTrimmedString(value)?.toLowerCase();
|
|
54
|
-
if (type === "
|
|
54
|
+
if (type === "branch" || type === "compact") return type;
|
|
55
55
|
return undefined;
|
|
56
56
|
}
|
|
57
57
|
function normalizeSubagentPermissionMapInput(value) {
|
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.27886562528.1.753a5fd",
|
|
4
4
|
"homepage": "https://github.com/pi-ohm/pi-ohm/tree/dev/packages/subagents#readme",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"@earendil-works/pi-agent-core": "0.79.4",
|
|
37
37
|
"@earendil-works/pi-ai": "0.79.4",
|
|
38
38
|
"@earendil-works/pi-coding-agent": "0.79.4",
|
|
39
|
-
"@pi-ohm/core": "0.6.4-dev.
|
|
40
|
-
"@pi-ohm/tui": "0.6.4-dev.
|
|
39
|
+
"@pi-ohm/core": "0.6.4-dev.27886562528.1.753a5fd",
|
|
40
|
+
"@pi-ohm/tui": "0.6.4-dev.27886562528.1.753a5fd",
|
|
41
41
|
"better-result": "2.9.2",
|
|
42
42
|
"typebox": "^1.0.68",
|
|
43
43
|
"zod": "^4"
|