@howarewoo/pi-subagents 0.0.0-stage → 0.2.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 +63 -0
- package/LICENSE +21 -0
- package/README.md +499 -2
- package/THIRD_PARTY_NOTICES.md +25 -0
- package/docs/advanced-policies.md +78 -0
- package/docs/delegation-contract.md +297 -0
- package/docs/images/subagent-hub.svg +1 -0
- package/docs/images/subagent-profiles.svg +1 -0
- package/docs/images/subagent-widget.svg +1 -0
- package/docs/parity-inventory.md +330 -0
- package/docs/provenance.md +13 -0
- package/docs/releases.md +236 -0
- package/docs/verification.md +430 -0
- package/package.json +64 -4
- package/src/capabilities.ts +39 -0
- package/src/child-execution.ts +459 -0
- package/src/coordinator.ts +1376 -0
- package/src/delegation-types.ts +111 -0
- package/src/hub.ts +612 -0
- package/src/model-adapter.ts +77 -0
- package/src/model-policy.ts +100 -0
- package/src/outcomes.ts +110 -0
- package/src/pi-extended-subagents.ts +673 -0
- package/src/profile-viewer.ts +246 -0
- package/src/profiles.ts +225 -0
- package/src/scheduling.ts +73 -0
- package/src/subagent-widget.ts +115 -0
- package/src/supported-host.ts +26 -0
- package/src/task-input.ts +74 -0
- package/src/task-presentation.ts +165 -0
- package/src/thread.ts +268 -0
- package/src/tool-schemas.ts +165 -0
- package/src/workspace.ts +46 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AgentSession,
|
|
3
|
+
AgentSessionEvent,
|
|
4
|
+
ExtensionToolContext,
|
|
5
|
+
Skill,
|
|
6
|
+
ToolDefinition,
|
|
7
|
+
} from "@earendil-works/pi-coding-agent";
|
|
8
|
+
import type { CapabilityDenial, ToolMetadata } from "./capabilities.ts";
|
|
9
|
+
import type { StructuredOutcome } from "./outcomes.ts";
|
|
10
|
+
import type { ModelSelection } from "./model-policy.ts";
|
|
11
|
+
import type { ExecutionLimits } from "./scheduling.ts";
|
|
12
|
+
import type { BuiltinTool, Profile } from "./profiles.ts";
|
|
13
|
+
|
|
14
|
+
export type DelegationMessage = {
|
|
15
|
+
id: string;
|
|
16
|
+
sender: ChildRef | "root";
|
|
17
|
+
recipient: ChildRef | "root";
|
|
18
|
+
text: string;
|
|
19
|
+
mode: "inbox" | "steer" | "followUp";
|
|
20
|
+
status: "accepted" | "queued" | "handled" | "delivered" | "not-running" | "error";
|
|
21
|
+
error?: string;
|
|
22
|
+
};
|
|
23
|
+
export type CoordinationWait =
|
|
24
|
+
| { status: "timeout" | "cancelled" | "shutdown" }
|
|
25
|
+
| { status: "messages"; messages: DelegationMessage[] }
|
|
26
|
+
| { status: "message"; message: DelegationMessage }
|
|
27
|
+
| {
|
|
28
|
+
status: "outcome";
|
|
29
|
+
outcome: Pick<ChildSnapshot, "id" | "generation" | "status" | "limitReason" | "pauseReason">;
|
|
30
|
+
};
|
|
31
|
+
export type ChildRef = Readonly<{ id: string; generation: number }>;
|
|
32
|
+
export type ChildSnapshot = Readonly<
|
|
33
|
+
ChildRef & {
|
|
34
|
+
parentId: string;
|
|
35
|
+
parentGeneration?: number;
|
|
36
|
+
depth: number;
|
|
37
|
+
writerLease: boolean;
|
|
38
|
+
limits: ExecutionLimits;
|
|
39
|
+
limitReason?: string;
|
|
40
|
+
toolCalls: number;
|
|
41
|
+
spawned?: number;
|
|
42
|
+
pauseReason?: string;
|
|
43
|
+
retainedContext?: boolean;
|
|
44
|
+
window?: number;
|
|
45
|
+
status:
|
|
46
|
+
| "queued"
|
|
47
|
+
| "setup"
|
|
48
|
+
| "running"
|
|
49
|
+
| "pausing"
|
|
50
|
+
| "paused"
|
|
51
|
+
| "draining"
|
|
52
|
+
| "settled"
|
|
53
|
+
| "failed"
|
|
54
|
+
| "cancelled";
|
|
55
|
+
profile: string;
|
|
56
|
+
tools: readonly BuiltinTool[];
|
|
57
|
+
leafTools?: readonly string[];
|
|
58
|
+
skills?: readonly string[];
|
|
59
|
+
capabilityDenials?: readonly CapabilityDenial[];
|
|
60
|
+
cwd?: string;
|
|
61
|
+
assignment: string;
|
|
62
|
+
activity: string;
|
|
63
|
+
progress: string;
|
|
64
|
+
result: string;
|
|
65
|
+
model: { provider: string; id: string };
|
|
66
|
+
effort: string | null;
|
|
67
|
+
prewalk?: {
|
|
68
|
+
target: ModelSelection;
|
|
69
|
+
status: "armed" | "handed-off" | "suppressed-exact" | "no-op";
|
|
70
|
+
};
|
|
71
|
+
telemetry: {
|
|
72
|
+
requests: number | null;
|
|
73
|
+
tokens: ReturnType<AgentSession["getSessionStats"]>["tokens"] | null;
|
|
74
|
+
cost: number | null;
|
|
75
|
+
context: ReturnType<AgentSession["getContextUsage"]> | null;
|
|
76
|
+
};
|
|
77
|
+
outcome?: StructuredOutcome;
|
|
78
|
+
artifacts?: { text?: string; structured?: string; error?: string };
|
|
79
|
+
error?: string;
|
|
80
|
+
transcript?: string;
|
|
81
|
+
disposed: boolean;
|
|
82
|
+
createdAt: number;
|
|
83
|
+
endedAt: number | null;
|
|
84
|
+
}
|
|
85
|
+
>;
|
|
86
|
+
export type RegistryEvent = Readonly<{
|
|
87
|
+
type: "changed" | "sdk";
|
|
88
|
+
child: ChildSnapshot;
|
|
89
|
+
event?: AgentSessionEvent;
|
|
90
|
+
}>;
|
|
91
|
+
export type StartTask = {
|
|
92
|
+
cwd?: string;
|
|
93
|
+
model?: ModelSelection;
|
|
94
|
+
resultSchema?: unknown;
|
|
95
|
+
assignment: string;
|
|
96
|
+
profile: Profile;
|
|
97
|
+
skills: Skill[];
|
|
98
|
+
context: ExtensionToolContext;
|
|
99
|
+
assertTools: (names: readonly string[]) => void;
|
|
100
|
+
toolMetadata?: () => readonly ToolMetadata[];
|
|
101
|
+
/** Live parent codemode availability; never a grant to forward its dispatcher. */
|
|
102
|
+
codemodeEnabled?: () => boolean;
|
|
103
|
+
availableSkills?: () => readonly Skill[];
|
|
104
|
+
capabilityDenials?: CapabilityDenial[];
|
|
105
|
+
leafProvenance?: Readonly<Record<string, string>>;
|
|
106
|
+
callerId: string;
|
|
107
|
+
parent?: ChildRef;
|
|
108
|
+
limits?: Partial<ExecutionLimits>;
|
|
109
|
+
coordinationTools?: (actor: ChildRef) => ToolDefinition[];
|
|
110
|
+
nestedTool?: (parent: ChildRef) => ToolDefinition;
|
|
111
|
+
};
|