@gotgenes/pi-subagents 13.2.1 → 14.0.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 +18 -0
- package/README.md +3 -1
- package/dist/public.d.ts +34 -35
- package/docs/architecture/architecture.md +50 -49
- package/docs/architecture/history/phase-16-invert-dependencies.md +2 -1
- package/docs/decisions/0003-publish-bundled-type-declarations.md +3 -1
- package/docs/plans/0051-update-adr-0001-hard-fork.md +8 -6
- package/docs/plans/0257-extract-child-session-factory.md +3 -1
- package/docs/plans/0262-add-workspace-provider-seam.md +41 -39
- package/docs/plans/0264-remove-extension-lifecycle-control.md +100 -98
- package/docs/plans/0265-born-complete-subagent-session.md +5 -2
- package/docs/plans/0270-type-consumable-public-surface.md +3 -1
- package/docs/plans/0280-rename-agent-to-subagent.md +197 -0
- package/docs/retro/0051-update-adr-0001-hard-fork.md +4 -2
- package/docs/retro/0257-extract-child-session-factory.md +3 -1
- package/docs/retro/0262-add-workspace-provider-seam.md +3 -1
- package/docs/retro/0264-remove-extension-lifecycle-control.md +3 -1
- package/docs/retro/0270-type-consumable-public-surface.md +4 -2
- package/docs/retro/0280-rename-agent-to-subagent.md +96 -0
- package/package.json +1 -1
- package/src/index.ts +9 -9
- package/src/lifecycle/child-lifecycle.ts +9 -8
- package/src/lifecycle/create-subagent-session.ts +5 -2
- package/src/lifecycle/{agent-manager.ts → subagent-manager.ts} +27 -27
- package/src/lifecycle/subagent-session.ts +6 -4
- package/src/lifecycle/{agent.ts → subagent.ts} +28 -28
- package/src/lifecycle/turn-limits.ts +1 -1
- package/src/lifecycle/workspace.ts +2 -2
- package/src/observation/notification.ts +9 -9
- package/src/observation/record-observer.ts +9 -9
- package/src/runtime.ts +1 -1
- package/src/service/service-adapter.ts +10 -10
- package/src/service/service.ts +5 -9
- package/src/tools/agent-tool.ts +5 -5
- package/src/tools/background-spawner.ts +3 -3
- package/src/tools/foreground-runner.ts +5 -5
- package/src/tools/get-result-tool.ts +2 -2
- package/src/tools/steer-tool.ts +2 -2
- package/src/types.ts +1 -1
- package/src/ui/agent-creation-wizard.ts +2 -2
- package/src/ui/agent-menu.ts +5 -5
- package/src/ui/agent-widget.ts +2 -2
- package/src/ui/conversation-viewer.ts +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AgentToolResult } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import type { AgentSpawnConfig } from "#src/lifecycle/agent-manager";
|
|
3
2
|
import type { ParentSnapshot } from "#src/lifecycle/parent-snapshot";
|
|
3
|
+
import type { AgentSpawnConfig } from "#src/lifecycle/subagent-manager";
|
|
4
4
|
import type { AgentActivityAccess } from "#src/tools/agent-tool";
|
|
5
5
|
import {
|
|
6
6
|
buildDetails,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
textResult,
|
|
10
10
|
} from "#src/tools/helpers";
|
|
11
11
|
import type { ResolvedSpawnConfig } from "#src/tools/spawn-config";
|
|
12
|
-
import type {
|
|
12
|
+
import type { ParentSessionInfo, Subagent } from "#src/types";
|
|
13
13
|
import { AgentActivityTracker } from "#src/ui/agent-activity-tracker";
|
|
14
14
|
import {
|
|
15
15
|
type AgentDetails,
|
|
@@ -26,7 +26,7 @@ export interface ForegroundManagerDeps {
|
|
|
26
26
|
type: string,
|
|
27
27
|
prompt: string,
|
|
28
28
|
opts: Omit<AgentSpawnConfig, "isBackground">,
|
|
29
|
-
): Promise<
|
|
29
|
+
): Promise<Subagent>;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/** Narrow widget interface for the foreground runner. */
|
|
@@ -62,7 +62,7 @@ export async function runForeground(
|
|
|
62
62
|
|
|
63
63
|
const fgState = new AgentActivityTracker(execution.effectiveMaxTurns);
|
|
64
64
|
let unsubUI: (() => void) | undefined;
|
|
65
|
-
let recordRef:
|
|
65
|
+
let recordRef: Subagent | undefined;
|
|
66
66
|
|
|
67
67
|
const streamUpdate = () => {
|
|
68
68
|
const toolUses = recordRef?.toolUses ?? 0;
|
|
@@ -92,7 +92,7 @@ export async function runForeground(
|
|
|
92
92
|
|
|
93
93
|
streamUpdate();
|
|
94
94
|
|
|
95
|
-
let record:
|
|
95
|
+
let record: Subagent;
|
|
96
96
|
try {
|
|
97
97
|
record = await manager.spawnAndWait(
|
|
98
98
|
params.snapshot,
|
|
@@ -2,13 +2,13 @@ import { defineTool } from "@earendil-works/pi-coding-agent";
|
|
|
2
2
|
import { Type } from "@sinclair/typebox";
|
|
3
3
|
import type { AgentConfigLookup } from "#src/config/agent-types";
|
|
4
4
|
import { formatLifetimeTokens, textResult } from "#src/tools/helpers";
|
|
5
|
-
import type {
|
|
5
|
+
import type { Subagent } from "#src/types";
|
|
6
6
|
import { formatDuration, getDisplayName } from "#src/ui/display";
|
|
7
7
|
|
|
8
8
|
// ---- Deps interfaces ----
|
|
9
9
|
|
|
10
10
|
export interface GetResultToolManager {
|
|
11
|
-
getRecord(id: string):
|
|
11
|
+
getRecord(id: string): Subagent | undefined;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export interface GetResultToolNotifications {
|
package/src/tools/steer-tool.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { defineTool } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { Type } from "@sinclair/typebox";
|
|
3
3
|
import { formatLifetimeTokens, textResult } from "#src/tools/helpers";
|
|
4
|
-
import type {
|
|
4
|
+
import type { Subagent } from "#src/types";
|
|
5
5
|
|
|
6
6
|
// ---- Deps interfaces ----
|
|
7
7
|
|
|
8
8
|
export interface SteerToolManager {
|
|
9
|
-
getRecord(id: string):
|
|
9
|
+
getRecord(id: string): Subagent | undefined;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export interface SteerToolEvents {
|
package/src/types.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { AgentSessionEvent } from "@earendil-works/pi-coding-agent";
|
|
|
7
7
|
import type { ModelRegistry } from "#src/session/model-resolver";
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
export {
|
|
10
|
+
export { Subagent } from "#src/lifecycle/subagent";
|
|
11
11
|
export type { AgentSessionEvent, ThinkingLevel };
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -9,7 +9,7 @@ import { join } from "node:path";
|
|
|
9
9
|
|
|
10
10
|
import { BUILTIN_TOOL_NAMES } from "#src/config/agent-types";
|
|
11
11
|
import type { ParentSnapshot } from "#src/lifecycle/parent-snapshot";
|
|
12
|
-
import type {
|
|
12
|
+
import type { Subagent } from "#src/types";
|
|
13
13
|
import type { AgentFileOps } from "#src/ui/agent-file-ops";
|
|
14
14
|
import { writeAgentFile } from "#src/ui/agent-file-writer";
|
|
15
15
|
import type { MenuUI } from "#src/ui/agent-menu";
|
|
@@ -23,7 +23,7 @@ export interface WizardManager {
|
|
|
23
23
|
type: string,
|
|
24
24
|
prompt: string,
|
|
25
25
|
opts: { description: string; maxTurns: number },
|
|
26
|
-
) => Promise<
|
|
26
|
+
) => Promise<Subagent>;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/** Narrow registry interface for reloading after creation. */
|
package/src/ui/agent-menu.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { AgentTypeRegistry } from "#src/config/agent-types";
|
|
|
4
4
|
import type { ParentSnapshot } from "#src/lifecycle/parent-snapshot";
|
|
5
5
|
import { type ModelRegistry, resolveModel } from "#src/session/model-resolver";
|
|
6
6
|
import { getModelLabelFromConfig } from "#src/tools/helpers";
|
|
7
|
-
import type {
|
|
7
|
+
import type { AgentConfig, Subagent } from "#src/types";
|
|
8
8
|
import type { AgentActivityTracker } from "#src/ui/agent-activity-tracker";
|
|
9
9
|
import { AgentConfigEditor } from "#src/ui/agent-config-editor";
|
|
10
10
|
import { AgentCreationWizard } from "#src/ui/agent-creation-wizard";
|
|
@@ -15,15 +15,15 @@ import { formatDuration, getDisplayName } from "#src/ui/display";
|
|
|
15
15
|
|
|
16
16
|
/** Narrow manager interface for menu operations. */
|
|
17
17
|
export interface AgentMenuManager {
|
|
18
|
-
listAgents: () =>
|
|
19
|
-
getRecord: (id: string) =>
|
|
18
|
+
listAgents: () => Subagent[];
|
|
19
|
+
getRecord: (id: string) => Subagent | undefined;
|
|
20
20
|
/** Used by generate wizard to spawn an agent that writes the .md file. */
|
|
21
21
|
spawnAndWait: (
|
|
22
22
|
parentSnapshot: ParentSnapshot,
|
|
23
23
|
type: string,
|
|
24
24
|
prompt: string,
|
|
25
25
|
opts: { description: string; maxTurns: number },
|
|
26
|
-
) => Promise<
|
|
26
|
+
) => Promise<Subagent>;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/** Narrow settings interface required by the agent menu. */
|
|
@@ -251,7 +251,7 @@ export class AgentsMenuHandler {
|
|
|
251
251
|
await this.showRunningAgents(ui);
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
private async viewAgentConversation(ui: MenuUI, record:
|
|
254
|
+
private async viewAgentConversation(ui: MenuUI, record: Subagent): Promise<void> {
|
|
255
255
|
if (!record.isSessionReady()) {
|
|
256
256
|
ui.notify(
|
|
257
257
|
`Agent is ${record.status === "queued" ? "queued" : "expired"} — no session available.`,
|
package/src/ui/agent-widget.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { AgentTypeRegistry } from "#src/config/agent-types";
|
|
10
|
-
import type {
|
|
10
|
+
import type { SubagentManager } from "#src/lifecycle/subagent-manager";
|
|
11
11
|
import type { AgentActivityTracker } from "#src/ui/agent-activity-tracker";
|
|
12
12
|
import { ERROR_STATUSES, type Theme } from "#src/ui/display";
|
|
13
13
|
import { renderWidgetLines } from "#src/ui/widget-renderer";
|
|
@@ -78,7 +78,7 @@ export class AgentWidget {
|
|
|
78
78
|
private lastStatusText: string | undefined;
|
|
79
79
|
|
|
80
80
|
constructor(
|
|
81
|
-
private manager:
|
|
81
|
+
private manager: SubagentManager,
|
|
82
82
|
private agentActivity: Map<string, AgentActivityTracker>,
|
|
83
83
|
private registry: AgentTypeRegistry,
|
|
84
84
|
) {}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { type Component, matchesKey, type TUI, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
9
9
|
import type { AgentConfigLookup } from "#src/config/agent-types";
|
|
10
10
|
import { getLifetimeTotal } from "#src/lifecycle/usage";
|
|
11
|
-
import type {
|
|
11
|
+
import type { Subagent } from "#src/types";
|
|
12
12
|
import type { AgentActivityTracker } from "#src/ui/agent-activity-tracker";
|
|
13
13
|
import { buildInvocationTags, formatDuration, formatSessionTokens, getDisplayName, getPromptModeLabel, type Theme } from "#src/ui/display";
|
|
14
14
|
import { formatMessage, formatStreamingIndicator } from "#src/ui/message-formatters";
|
|
@@ -23,7 +23,7 @@ export const VIEWPORT_HEIGHT_PCT = 70;
|
|
|
23
23
|
|
|
24
24
|
export interface ConversationViewerOptions {
|
|
25
25
|
tui: TUI;
|
|
26
|
-
record:
|
|
26
|
+
record: Subagent;
|
|
27
27
|
activity: AgentActivityTracker | undefined;
|
|
28
28
|
theme: Theme;
|
|
29
29
|
done: (result: undefined) => void;
|
|
@@ -39,7 +39,7 @@ export class ConversationViewer implements Component {
|
|
|
39
39
|
private closed = false;
|
|
40
40
|
|
|
41
41
|
private tui: TUI;
|
|
42
|
-
private record:
|
|
42
|
+
private record: Subagent;
|
|
43
43
|
private activity: AgentActivityTracker | undefined;
|
|
44
44
|
private theme: Theme;
|
|
45
45
|
private done: (result: undefined) => void;
|