@narumitw/pi-subagents 2.1.3 → 3.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/README.md +181 -1250
- package/dist/child-communication-bridge.ts +136 -0
- package/dist/child-communication-bridge.ts.map +7 -0
- package/dist/chunks/chunk-UKTWUQRM.js +667 -0
- package/dist/chunks/chunk-UKTWUQRM.js.map +7 -0
- package/dist/index.ts +1448 -1598
- package/dist/index.ts.map +4 -4
- package/docs/design-principles.md +31 -0
- package/docs/ipc-transport-idea.md +103 -0
- package/docs/tools.md +109 -0
- package/package.json +11 -19
- package/src/broker-credentials.ts +71 -0
- package/src/child-communication-bridge.ts +153 -0
- package/src/child-communication-tools.ts +147 -0
- package/src/completion-renderer.ts +60 -0
- package/src/index.ts +1 -1
- package/src/message-broker.ts +628 -0
- package/src/model-output.ts +42 -0
- package/src/process.ts +688 -0
- package/src/runtime.ts +538 -0
- package/src/subagents.ts +33 -34
- package/src/tools.ts +416 -0
- package/src/types.ts +85 -0
- package/src/widget.ts +130 -0
- package/dist/chunks/auto-transport-FUUKFDIG.ts +0 -109
- package/dist/chunks/auto-transport-FUUKFDIG.ts.map +0 -7
- package/dist/chunks/capability-grant-PR72SWWS.ts +0 -19
- package/dist/chunks/capability-grant-PR72SWWS.ts.map +0 -7
- package/dist/chunks/child-peer-bridge.ts +0 -108
- package/dist/chunks/child-peer-bridge.ts.map +0 -7
- package/dist/chunks/chunk-2LMJU25E.ts +0 -1641
- package/dist/chunks/chunk-2LMJU25E.ts.map +0 -7
- package/dist/chunks/chunk-47SK2QYC.ts +0 -56
- package/dist/chunks/chunk-47SK2QYC.ts.map +0 -7
- package/dist/chunks/chunk-4AQSF7AS.ts +0 -29
- package/dist/chunks/chunk-4AQSF7AS.ts.map +0 -7
- package/dist/chunks/chunk-5DGRMKNV.ts +0 -126
- package/dist/chunks/chunk-5DGRMKNV.ts.map +0 -7
- package/dist/chunks/chunk-6H6TBBED.ts +0 -108
- package/dist/chunks/chunk-6H6TBBED.ts.map +0 -7
- package/dist/chunks/chunk-6KJ34M6S.ts +0 -159
- package/dist/chunks/chunk-6KJ34M6S.ts.map +0 -7
- package/dist/chunks/chunk-6NSJVPXX.ts +0 -480
- package/dist/chunks/chunk-6NSJVPXX.ts.map +0 -7
- package/dist/chunks/chunk-7AAJEUSL.ts +0 -238
- package/dist/chunks/chunk-7AAJEUSL.ts.map +0 -7
- package/dist/chunks/chunk-BFK2Z4ZF.ts +0 -189
- package/dist/chunks/chunk-BFK2Z4ZF.ts.map +0 -7
- package/dist/chunks/chunk-BOAXY55Y.ts +0 -153
- package/dist/chunks/chunk-BOAXY55Y.ts.map +0 -7
- package/dist/chunks/chunk-D4CR7T73.ts +0 -353
- package/dist/chunks/chunk-D4CR7T73.ts.map +0 -7
- package/dist/chunks/chunk-FEVPWRMU.ts +0 -300
- package/dist/chunks/chunk-FEVPWRMU.ts.map +0 -7
- package/dist/chunks/chunk-G6VZTCFH.ts +0 -70
- package/dist/chunks/chunk-G6VZTCFH.ts.map +0 -7
- package/dist/chunks/chunk-H3FP6DLR.ts +0 -160
- package/dist/chunks/chunk-H3FP6DLR.ts.map +0 -7
- package/dist/chunks/chunk-HA36LPCO.ts +0 -130
- package/dist/chunks/chunk-HA36LPCO.ts.map +0 -7
- package/dist/chunks/chunk-HOP5FXDT.ts +0 -27
- package/dist/chunks/chunk-HOP5FXDT.ts.map +0 -7
- package/dist/chunks/chunk-IGAMVWFN.ts +0 -139
- package/dist/chunks/chunk-IGAMVWFN.ts.map +0 -7
- package/dist/chunks/chunk-ILEQ27AL.ts +0 -45
- package/dist/chunks/chunk-ILEQ27AL.ts.map +0 -7
- package/dist/chunks/chunk-ITVWPNU4.ts +0 -819
- package/dist/chunks/chunk-ITVWPNU4.ts.map +0 -7
- package/dist/chunks/chunk-IWC32VPY.ts +0 -172
- package/dist/chunks/chunk-IWC32VPY.ts.map +0 -7
- package/dist/chunks/chunk-JSZIP73U.ts +0 -362
- package/dist/chunks/chunk-JSZIP73U.ts.map +0 -7
- package/dist/chunks/chunk-JU6LUNLP.ts +0 -380
- package/dist/chunks/chunk-JU6LUNLP.ts.map +0 -7
- package/dist/chunks/chunk-KMGKCEO4.ts +0 -38
- package/dist/chunks/chunk-KMGKCEO4.ts.map +0 -7
- package/dist/chunks/chunk-LASD73CM.ts +0 -339
- package/dist/chunks/chunk-LASD73CM.ts.map +0 -7
- package/dist/chunks/chunk-LEOYDZI3.ts +0 -22
- package/dist/chunks/chunk-LEOYDZI3.ts.map +0 -7
- package/dist/chunks/chunk-LL4LP2T7.ts +0 -737
- package/dist/chunks/chunk-LL4LP2T7.ts.map +0 -7
- package/dist/chunks/chunk-N2T5IN4X.ts +0 -18
- package/dist/chunks/chunk-N2T5IN4X.ts.map +0 -7
- package/dist/chunks/chunk-N7BLVXKK.ts +0 -73
- package/dist/chunks/chunk-N7BLVXKK.ts.map +0 -7
- package/dist/chunks/chunk-NLT67IZS.ts +0 -322
- package/dist/chunks/chunk-NLT67IZS.ts.map +0 -7
- package/dist/chunks/chunk-NTRPLF46.ts +0 -63
- package/dist/chunks/chunk-NTRPLF46.ts.map +0 -7
- package/dist/chunks/chunk-ONDTY4EL.ts +0 -91
- package/dist/chunks/chunk-ONDTY4EL.ts.map +0 -7
- package/dist/chunks/chunk-OVPHFGKO.ts +0 -1769
- package/dist/chunks/chunk-OVPHFGKO.ts.map +0 -7
- package/dist/chunks/chunk-P7OH4XMF.ts +0 -60
- package/dist/chunks/chunk-P7OH4XMF.ts.map +0 -7
- package/dist/chunks/chunk-PBZMBTNJ.ts +0 -422
- package/dist/chunks/chunk-PBZMBTNJ.ts.map +0 -7
- package/dist/chunks/chunk-PGLSFLYW.ts +0 -52
- package/dist/chunks/chunk-PGLSFLYW.ts.map +0 -7
- package/dist/chunks/chunk-RRR66UWR.ts +0 -28
- package/dist/chunks/chunk-RRR66UWR.ts.map +0 -7
- package/dist/chunks/chunk-RSUXZD6S.ts +0 -275
- package/dist/chunks/chunk-RSUXZD6S.ts.map +0 -7
- package/dist/chunks/chunk-RTCVYIZA.ts +0 -221
- package/dist/chunks/chunk-RTCVYIZA.ts.map +0 -7
- package/dist/chunks/chunk-RY2AEGMZ.ts +0 -34
- package/dist/chunks/chunk-RY2AEGMZ.ts.map +0 -7
- package/dist/chunks/chunk-SWGQLFSD.ts +0 -60
- package/dist/chunks/chunk-SWGQLFSD.ts.map +0 -7
- package/dist/chunks/chunk-TM2R67J3.ts +0 -52
- package/dist/chunks/chunk-TM2R67J3.ts.map +0 -7
- package/dist/chunks/chunk-TMZRHIIK.ts +0 -497
- package/dist/chunks/chunk-TMZRHIIK.ts.map +0 -7
- package/dist/chunks/chunk-TZ34IQ3M.ts +0 -59
- package/dist/chunks/chunk-TZ34IQ3M.ts.map +0 -7
- package/dist/chunks/chunk-UMBPMVJW.ts +0 -22
- package/dist/chunks/chunk-UMBPMVJW.ts.map +0 -7
- package/dist/chunks/chunk-VDG7LTYE.ts +0 -80
- package/dist/chunks/chunk-VDG7LTYE.ts.map +0 -7
- package/dist/chunks/chunk-X4NMONPE.ts +0 -73
- package/dist/chunks/chunk-X4NMONPE.ts.map +0 -7
- package/dist/chunks/chunk-YPJEN6NU.ts +0 -65
- package/dist/chunks/chunk-YPJEN6NU.ts.map +0 -7
- package/dist/chunks/chunk-YU53SHA7.ts +0 -328
- package/dist/chunks/chunk-YU53SHA7.ts.map +0 -7
- package/dist/chunks/completion-delivery-RSJU6BXL.ts +0 -17
- package/dist/chunks/completion-delivery-RSJU6BXL.ts.map +0 -7
- package/dist/chunks/config-status-FKGDECZ3.ts +0 -35
- package/dist/chunks/config-status-FKGDECZ3.ts.map +0 -7
- package/dist/chunks/config-ui-ABHYNGQ7.ts +0 -1212
- package/dist/chunks/config-ui-ABHYNGQ7.ts.map +0 -7
- package/dist/chunks/consult-LJU3IQY5.ts +0 -519
- package/dist/chunks/consult-LJU3IQY5.ts.map +0 -7
- package/dist/chunks/context-QDKLVQXE.ts +0 -11
- package/dist/chunks/context-QDKLVQXE.ts.map +0 -7
- package/dist/chunks/create-stateful-transport-JWC2EFYL.ts +0 -130
- package/dist/chunks/create-stateful-transport-JWC2EFYL.ts.map +0 -7
- package/dist/chunks/cwd-policy-NB6XZ5GF.ts +0 -17
- package/dist/chunks/cwd-policy-NB6XZ5GF.ts.map +0 -7
- package/dist/chunks/delegation-contract-LA56I5DT.ts +0 -24
- package/dist/chunks/delegation-contract-LA56I5DT.ts.map +0 -7
- package/dist/chunks/discovery-MIFB2U4Y.ts +0 -12
- package/dist/chunks/discovery-MIFB2U4Y.ts.map +0 -7
- package/dist/chunks/execution-Q2JZLKJA.ts +0 -4037
- package/dist/chunks/execution-Q2JZLKJA.ts.map +0 -7
- package/dist/chunks/in-process-transport-HJ6TZXC3.ts +0 -39
- package/dist/chunks/in-process-transport-HJ6TZXC3.ts.map +0 -7
- package/dist/chunks/inspect-UH2TKH6E.ts +0 -634
- package/dist/chunks/inspect-UH2TKH6E.ts.map +0 -7
- package/dist/chunks/peer-communication-KL36Z6CO.ts +0 -294
- package/dist/chunks/peer-communication-KL36Z6CO.ts.map +0 -7
- package/dist/chunks/persistence-UY3PY6E5.ts +0 -348
- package/dist/chunks/persistence-UY3PY6E5.ts.map +0 -7
- package/dist/chunks/registry-BT54L6CY.ts +0 -1445
- package/dist/chunks/registry-BT54L6CY.ts.map +0 -7
- package/dist/chunks/retained-semantic-state-GM75FZGE.ts +0 -81
- package/dist/chunks/retained-semantic-state-GM75FZGE.ts.map +0 -7
- package/dist/chunks/rpc-transport-7R7DVCEB.ts +0 -1222
- package/dist/chunks/rpc-transport-7R7DVCEB.ts.map +0 -7
- package/dist/chunks/runtime-policy-5YELCOVC.ts +0 -15
- package/dist/chunks/runtime-policy-5YELCOVC.ts.map +0 -7
- package/dist/chunks/semantic-snapshot-WPJ3UAFW.ts +0 -19
- package/dist/chunks/semantic-snapshot-WPJ3UAFW.ts.map +0 -7
- package/dist/chunks/spawn-idempotency-BNHOSMZW.ts +0 -13
- package/dist/chunks/spawn-idempotency-BNHOSMZW.ts.map +0 -7
- package/dist/chunks/stateful-lifecycle-JAR6K55H.ts +0 -15
- package/dist/chunks/stateful-lifecycle-JAR6K55H.ts.map +0 -7
- package/dist/chunks/subprocess-transport-VHZJRBTW.ts +0 -160
- package/dist/chunks/subprocess-transport-VHZJRBTW.ts.map +0 -7
- package/dist/chunks/usage-recording-store-CW3EH2SZ.ts +0 -164
- package/dist/chunks/usage-recording-store-CW3EH2SZ.ts.map +0 -7
- package/dist/chunks/workspace-WDKLN72J.ts +0 -11
- package/dist/chunks/workspace-WDKLN72J.ts.map +0 -7
- package/docs/async-runtime-protocol.md +0 -84
- package/docs/implementation-notes/pi-subagents-capability-matrix.md +0 -62
- package/docs/implementation-notes/pi-subagents-current-direction.md +0 -99
- package/docs/implementation-notes/pi-subagents-rpc-v1.md +0 -153
- package/docs/pi-subagents-diagrams.md +0 -183
- package/src/adaptive-scheduler.ts +0 -224
- package/src/admission-benchmark.ts +0 -95
- package/src/admission-policy.ts +0 -78
- package/src/agent-projection.ts +0 -53
- package/src/agents/built-ins.ts +0 -71
- package/src/agents/catalog.ts +0 -241
- package/src/agents/discovery.ts +0 -265
- package/src/agents/types.ts +0 -100
- package/src/agents.ts +0 -51
- package/src/async-subagent-benchmark.ts +0 -532
- package/src/auto-transport.ts +0 -121
- package/src/blocking-status.ts +0 -63
- package/src/cached-module-loader.ts +0 -18
- package/src/capabilities.ts +0 -145
- package/src/capability-grant.ts +0 -115
- package/src/capability-router.ts +0 -107
- package/src/child-peer-bridge.ts +0 -124
- package/src/child-peer-tools.ts +0 -132
- package/src/completion-delivery.ts +0 -409
- package/src/completion-render.ts +0 -190
- package/src/completion-requirement.ts +0 -479
- package/src/completion-routing.ts +0 -24
- package/src/config-registration.ts +0 -114
- package/src/config-status.ts +0 -217
- package/src/config-ui.ts +0 -983
- package/src/consult-policy.ts +0 -15
- package/src/consult-registration.ts +0 -125
- package/src/consult-render.ts +0 -194
- package/src/consult-resources.ts +0 -51
- package/src/consult-tool.ts +0 -95
- package/src/consult.ts +0 -566
- package/src/context.ts +0 -126
- package/src/create-stateful-transport.ts +0 -157
- package/src/cwd-policy.ts +0 -183
- package/src/delegation-contract.ts +0 -463
- package/src/execution/budget.ts +0 -56
- package/src/execution/runtime-policy.ts +0 -19
- package/src/execution-plan.ts +0 -322
- package/src/execution-ui.ts +0 -259
- package/src/execution.ts +0 -1679
- package/src/in-process-transport.ts +0 -941
- package/src/inspect-registration.ts +0 -64
- package/src/inspect-render.ts +0 -334
- package/src/inspect-tool.ts +0 -45
- package/src/inspect.ts +0 -769
- package/src/integration-controller.ts +0 -98
- package/src/limits.ts +0 -75
- package/src/orchestration-metrics.ts +0 -116
- package/src/outcome.ts +0 -61
- package/src/panel-child-group.ts +0 -35
- package/src/panel-contract.ts +0 -343
- package/src/panel-evidence.ts +0 -59
- package/src/panel-execution.ts +0 -769
- package/src/panel-failure.ts +0 -56
- package/src/panel-planning.ts +0 -175
- package/src/panel-presets.ts +0 -3
- package/src/panel-prompts.ts +0 -132
- package/src/panel-reconciliation.ts +0 -57
- package/src/panel-render.ts +0 -103
- package/src/parallel-limit-ui.ts +0 -113
- package/src/params.ts +0 -278
- package/src/peer-communication.ts +0 -352
- package/src/peer-transport.ts +0 -49
- package/src/persistence.ts +0 -522
- package/src/pi-args.ts +0 -43
- package/src/pi-invocation.ts +0 -168
- package/src/process-control.ts +0 -43
- package/src/prompt-resources.ts +0 -38
- package/src/prompt-source-safety.ts +0 -48
- package/src/protocol.ts +0 -76
- package/src/registry-types.ts +0 -204
- package/src/registry.ts +0 -1698
- package/src/render-common.ts +0 -252
- package/src/render.ts +0 -704
- package/src/result-contract.ts +0 -431
- package/src/retained-semantic-state.ts +0 -100
- package/src/rpc-timeout-finalization.ts +0 -207
- package/src/rpc-transport-metadata.ts +0 -65
- package/src/rpc-transport.ts +0 -1035
- package/src/rpc-turn-capture.ts +0 -217
- package/src/runner-outcome.ts +0 -31
- package/src/runner-result.ts +0 -55
- package/src/runner-types.ts +0 -102
- package/src/runner-usage.ts +0 -48
- package/src/runner.ts +0 -866
- package/src/safe-text.ts +0 -67
- package/src/semantic-snapshot.ts +0 -214
- package/src/session-guidance-contract.ts +0 -399
- package/src/settings/inspection.ts +0 -302
- package/src/settings/schema.ts +0 -195
- package/src/settings-reader.ts +0 -215
- package/src/settings.ts +0 -452
- package/src/spawn-idempotency.ts +0 -68
- package/src/stateful-agent-view.ts +0 -85
- package/src/stateful-config.ts +0 -13
- package/src/stateful-guidance.ts +0 -29
- package/src/stateful-lifecycle.ts +0 -74
- package/src/stateful-limit-ui.ts +0 -249
- package/src/stateful-limits.ts +0 -96
- package/src/stateful-prompt.ts +0 -49
- package/src/stateful-registration.ts +0 -1320
- package/src/stateful-render.ts +0 -318
- package/src/stateful-safety.ts +0 -47
- package/src/stateful-tool-params.ts +0 -215
- package/src/stateful.ts +0 -12
- package/src/subagent-details.ts +0 -43
- package/src/subagents-extension.ts +0 -355
- package/src/subprocess-transport.ts +0 -145
- package/src/supervision.ts +0 -104
- package/src/task-path.ts +0 -65
- package/src/timeout-checkpoint.ts +0 -305
- package/src/timeout-finalization.ts +0 -75
- package/src/tool-schema-compatibility.ts +0 -73
- package/src/transport-types.ts +0 -74
- package/src/transport-ui.ts +0 -135
- package/src/transport.ts +0 -43
- package/src/turn-budget.ts +0 -109
- package/src/usage-format.ts +0 -42
- package/src/usage-recording-config.ts +0 -13
- package/src/usage-recording-store.ts +0 -183
- package/src/usage-recording.ts +0 -478
- package/src/verification-harness.ts +0 -516
- package/src/verification-policy.ts +0 -67
- package/src/verification-receipt.ts +0 -275
- package/src/verified-execution-benchmark.ts +0 -86
- package/src/verified-execution-contract.ts +0 -191
- package/src/verified-execution-schema.ts +0 -32
- package/src/work-item-ledger.ts +0 -1404
- package/src/work-item-persistence.ts +0 -254
- package/src/workflow-completion-controller.ts +0 -397
- package/src/workflow-planning.ts +0 -172
- package/src/workflow-tree-identity.ts +0 -289
- package/src/workflow-ui.ts +0 -69
- package/src/workflow-verification.ts +0 -296
- package/src/workspace.ts +0 -174
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { cachedModuleLoader } from "./cached-module-loader.js";
|
|
3
|
-
import type { SubagentMenuOwner, SubagentSettingsRuntime } from "./config-ui.js";
|
|
4
|
-
|
|
5
|
-
const SUBCOMMANDS = [
|
|
6
|
-
{ value: "settings", label: "settings", description: "Open grouped subagent settings" },
|
|
7
|
-
{ value: "status", label: "status", description: "Show detailed subagent diagnostics" },
|
|
8
|
-
{ value: "help", label: "help", description: "Show subagent first steps and safety help" },
|
|
9
|
-
];
|
|
10
|
-
|
|
11
|
-
type ConfigUiModule = Pick<
|
|
12
|
-
typeof import("./config-ui.js"),
|
|
13
|
-
"showSubagentManager" | "showSubagentSettings"
|
|
14
|
-
>;
|
|
15
|
-
|
|
16
|
-
type ConfigStatusModule = Pick<
|
|
17
|
-
typeof import("./config-status.js"),
|
|
18
|
-
"showSubagentHelp" | "showSubagentStatus"
|
|
19
|
-
>;
|
|
20
|
-
|
|
21
|
-
export interface ConfigRegistrationDependencies {
|
|
22
|
-
loadConfigUi?: () => Promise<ConfigUiModule>;
|
|
23
|
-
loadConfigStatus?: () => Promise<ConfigStatusModule>;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function registerSubagentConfigLifecycle(pi: ExtensionAPI): SubagentMenuOwner {
|
|
27
|
-
const owner: SubagentMenuOwner = { generation: 0, controller: new AbortController() };
|
|
28
|
-
pi.on("session_start", () => {
|
|
29
|
-
owner.generation += 1;
|
|
30
|
-
owner.controller.abort(new DOMException("Subagent session replaced", "AbortError"));
|
|
31
|
-
owner.controller = new AbortController();
|
|
32
|
-
});
|
|
33
|
-
pi.on("session_shutdown", () => {
|
|
34
|
-
owner.generation += 1;
|
|
35
|
-
owner.controller.abort(new DOMException("Subagent session shut down", "AbortError"));
|
|
36
|
-
});
|
|
37
|
-
return owner;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function registerSubagentConfigCommand(
|
|
41
|
-
pi: ExtensionAPI,
|
|
42
|
-
runtime: SubagentSettingsRuntime,
|
|
43
|
-
owner = registerSubagentConfigLifecycle(pi),
|
|
44
|
-
dependencies: ConfigRegistrationDependencies = {},
|
|
45
|
-
): void {
|
|
46
|
-
const loadConfigUi = cachedModuleLoader(
|
|
47
|
-
dependencies.loadConfigUi ?? (() => import("./config-ui.js")),
|
|
48
|
-
);
|
|
49
|
-
const loadConfigStatus = cachedModuleLoader<ConfigStatusModule>(
|
|
50
|
-
dependencies.loadConfigStatus ?? (() => import("./config-status.js")),
|
|
51
|
-
);
|
|
52
|
-
pi.registerCommand("subagents", {
|
|
53
|
-
description: "Manage subagents, settings, diagnostics, and help",
|
|
54
|
-
getArgumentCompletions(prefix: string) {
|
|
55
|
-
const normalized = prefix.trim().toLowerCase();
|
|
56
|
-
const matches = SUBCOMMANDS.filter((item) => item.value.startsWith(normalized));
|
|
57
|
-
return matches.length > 0 ? matches : null;
|
|
58
|
-
},
|
|
59
|
-
async handler(args, ctx) {
|
|
60
|
-
const subcommand = args.trim().toLowerCase();
|
|
61
|
-
const runStatusCommand = async (show: (status: ConfigStatusModule) => void) => {
|
|
62
|
-
const generation = owner.generation;
|
|
63
|
-
const controller = owner.controller;
|
|
64
|
-
const isCurrent = () =>
|
|
65
|
-
generation === owner.generation &&
|
|
66
|
-
controller === owner.controller &&
|
|
67
|
-
!controller.signal.aborted;
|
|
68
|
-
let status: ConfigStatusModule;
|
|
69
|
-
try {
|
|
70
|
-
status = await loadConfigStatus();
|
|
71
|
-
} catch (error) {
|
|
72
|
-
if (!isCurrent()) return;
|
|
73
|
-
throw error;
|
|
74
|
-
}
|
|
75
|
-
if (!isCurrent()) return;
|
|
76
|
-
show(status);
|
|
77
|
-
};
|
|
78
|
-
if (!subcommand && ctx.mode !== "tui") {
|
|
79
|
-
await runStatusCommand((status) => status.showSubagentStatus(ctx, runtime));
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
if (subcommand === "status") {
|
|
83
|
-
await runStatusCommand((status) => status.showSubagentStatus(ctx, runtime));
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (subcommand === "help") {
|
|
87
|
-
await runStatusCommand((status) => status.showSubagentHelp(ctx, runtime));
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
if (!subcommand || subcommand === "settings") {
|
|
91
|
-
const generation = owner.generation;
|
|
92
|
-
const controller = owner.controller;
|
|
93
|
-
const isCurrent = () =>
|
|
94
|
-
generation === owner.generation &&
|
|
95
|
-
controller === owner.controller &&
|
|
96
|
-
!controller.signal.aborted;
|
|
97
|
-
let configUi: ConfigUiModule;
|
|
98
|
-
try {
|
|
99
|
-
configUi = await loadConfigUi();
|
|
100
|
-
} catch (error) {
|
|
101
|
-
if (!isCurrent()) return;
|
|
102
|
-
throw error;
|
|
103
|
-
}
|
|
104
|
-
if (!isCurrent()) return;
|
|
105
|
-
if (!subcommand) await configUi.showSubagentManager(pi, ctx, runtime, owner);
|
|
106
|
-
else await configUi.showSubagentSettings(pi, ctx, runtime, owner);
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
if (ctx.mode === "tui" || ctx.hasUI) {
|
|
110
|
-
ctx.ui.notify(`Unknown /subagents subcommand: ${subcommand}`, "warning");
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
});
|
|
114
|
-
}
|
package/src/config-status.ts
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
import type { ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import type {
|
|
3
|
-
CompletionDelivery,
|
|
4
|
-
ConsultationCwdPolicy,
|
|
5
|
-
ConsultResourcePolicy,
|
|
6
|
-
DelegationCwdPolicy,
|
|
7
|
-
} from "./agents/types.js";
|
|
8
|
-
import type { SubagentSettingsRuntime } from "./config-ui.js";
|
|
9
|
-
import { safeTerminalLine as safeTerminalText } from "./safe-text.js";
|
|
10
|
-
import type { DelegationWorkflow } from "./settings/inspection.js";
|
|
11
|
-
import {
|
|
12
|
-
inspectBlockingParallelLimitSettings,
|
|
13
|
-
inspectCompletionDeliverySettings,
|
|
14
|
-
inspectConsultResourceSettings,
|
|
15
|
-
inspectCwdPolicySettings,
|
|
16
|
-
inspectDelegationWorkflowSettings,
|
|
17
|
-
inspectStatefulLimitSettings,
|
|
18
|
-
inspectStatefulTransportSettings,
|
|
19
|
-
inspectUsageRecordingSettings,
|
|
20
|
-
} from "./settings.js";
|
|
21
|
-
import type { StatefulSubagentRuntimeStatus } from "./stateful.js";
|
|
22
|
-
import {
|
|
23
|
-
formatConfiguredDetachedLimitDivergence,
|
|
24
|
-
formatDetachedLimitSummary,
|
|
25
|
-
} from "./stateful-limit-ui.js";
|
|
26
|
-
import { STATEFUL_LIMIT_DEFINITIONS } from "./stateful-limits.js";
|
|
27
|
-
import { USAGE_RECORDING_RETENTION_DAYS } from "./usage-recording-config.js";
|
|
28
|
-
import { workflowLabel } from "./workflow-ui.js";
|
|
29
|
-
|
|
30
|
-
export function showSubagentStatus(
|
|
31
|
-
ctx: ExtensionCommandContext,
|
|
32
|
-
runtime: SubagentSettingsRuntime,
|
|
33
|
-
): void {
|
|
34
|
-
if (ctx.mode !== "tui" && !ctx.hasUI) return;
|
|
35
|
-
const snapshot = inspectCompletionDeliverySettings();
|
|
36
|
-
ctx.ui.notify(
|
|
37
|
-
formatStatus(runtime.getRuntimeStatus(), snapshot, runtime),
|
|
38
|
-
snapshot.error ? "warning" : "info",
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function showSubagentHelp(
|
|
43
|
-
ctx: ExtensionCommandContext,
|
|
44
|
-
runtime: SubagentSettingsRuntime,
|
|
45
|
-
): void {
|
|
46
|
-
if (ctx.mode !== "tui" && !ctx.hasUI) return;
|
|
47
|
-
ctx.ui.notify(helpLines(runtime).join("\n"), "info");
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function statusLines(runtime: SubagentSettingsRuntime): string[] {
|
|
51
|
-
const snapshot = inspectCompletionDeliverySettings();
|
|
52
|
-
return formatStatus(runtime.getRuntimeStatus(), snapshot, runtime).split("\n");
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export function helpLines(_runtime: SubagentSettingsRuntime): string[] {
|
|
56
|
-
return [
|
|
57
|
-
"Start here",
|
|
58
|
-
" 1. Open How subagents run.",
|
|
59
|
-
" 2. Choose the workflow that matches the tools and blocking behavior you need.",
|
|
60
|
-
" 3. Open Completion and privacy if Pi must use background results in the current answer.",
|
|
61
|
-
"The blocking subagent tool is deprecated and remains available only in compatibility workflows.",
|
|
62
|
-
"subagent_consult and subagent_await remain supported.",
|
|
63
|
-
"Current subagents shows work in progress and subagents saved for follow-up.",
|
|
64
|
-
"Settings",
|
|
65
|
-
" Folders and trusted resources — choose where subagents start and what consultations load.",
|
|
66
|
-
" Completion and privacy — choose what Pi does when work finishes and whether usage is recorded.",
|
|
67
|
-
" Agent defaults — choose tools, model, thinking effort, and time limit for each subagent.",
|
|
68
|
-
" Advanced runtime settings — optional transport and capacity controls.",
|
|
69
|
-
"Changes are saved immediately.",
|
|
70
|
-
"Transport and background-agent limits apply after /reload.",
|
|
71
|
-
"Commands",
|
|
72
|
-
" /subagents — open the manager",
|
|
73
|
-
" /subagents settings — open Settings",
|
|
74
|
-
" /subagents status — show detailed diagnostics",
|
|
75
|
-
" /subagents help — show this help",
|
|
76
|
-
"Safety",
|
|
77
|
-
"Folder choices control starting locations and loaded resources; they do not sandbox files, commands, or network access.",
|
|
78
|
-
"Manage saved folder trust with Pi /trust, then restart Pi.",
|
|
79
|
-
];
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export function formatManagerSummary(
|
|
83
|
-
runtime: SubagentSettingsRuntime,
|
|
84
|
-
status: StatefulSubagentRuntimeStatus,
|
|
85
|
-
configured: ReturnType<typeof inspectDelegationWorkflowSettings>,
|
|
86
|
-
): string {
|
|
87
|
-
const current = currentWorkflow(runtime, status);
|
|
88
|
-
const detachedLimits = inspectStatefulLimitSettings();
|
|
89
|
-
const detachedDivergence = detachedLimits.values
|
|
90
|
-
? formatConfiguredDetachedLimitDivergence(status, detachedLimits.values)
|
|
91
|
-
: undefined;
|
|
92
|
-
return [
|
|
93
|
-
`How subagents run: ${workflowLabel(current)}`,
|
|
94
|
-
`Subagents: ${status.activeAgents} working · ${status.retainedAgents} saved for follow-up`,
|
|
95
|
-
`When work finishes: ${completionLabel(status.completionDelivery)}`,
|
|
96
|
-
...(configured.value !== current
|
|
97
|
-
? [`Configured after reload: ${workflowLabel(configured.value)}`]
|
|
98
|
-
: []),
|
|
99
|
-
...(detachedDivergence ? [detachedDivergence] : []),
|
|
100
|
-
...(configured.error || detachedLimits.error
|
|
101
|
-
? ["Action needed: Repair user settings. Open Diagnostics for details."]
|
|
102
|
-
: []),
|
|
103
|
-
].join("\n");
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function formatStatus(
|
|
107
|
-
status: StatefulSubagentRuntimeStatus,
|
|
108
|
-
snapshot: ReturnType<typeof inspectCompletionDeliverySettings>,
|
|
109
|
-
runtime?: SubagentSettingsRuntime,
|
|
110
|
-
): string {
|
|
111
|
-
const configuredWorkflow = inspectDelegationWorkflowSettings();
|
|
112
|
-
const consult = inspectConsultResourceSettings();
|
|
113
|
-
const cwdPolicy = inspectCwdPolicySettings();
|
|
114
|
-
const parallelLimit = inspectBlockingParallelLimitSettings();
|
|
115
|
-
const detachedLimits = inspectStatefulLimitSettings();
|
|
116
|
-
const transport = inspectStatefulTransportSettings();
|
|
117
|
-
const usageRecording = inspectUsageRecordingSettings();
|
|
118
|
-
const current = runtime ? currentWorkflow(runtime, status) : configuredWorkflow.value;
|
|
119
|
-
const usageStatus = runtime?.getUsageRecordingStatus?.();
|
|
120
|
-
return [
|
|
121
|
-
"Current Session",
|
|
122
|
-
` How subagents run: ${workflowLabel(current)}`,
|
|
123
|
-
` Background runtime: ${status.initialized ? "initialized" : status.enabled ? "not initialized" : "disabled"}`,
|
|
124
|
-
` Transport: ${status.transport}`,
|
|
125
|
-
` Configured transport: ${transport.value} (${transport.source})`,
|
|
126
|
-
` When work finishes: ${completionLabel(status.completionDelivery)}`,
|
|
127
|
-
` Read-only consultation folders: ${consultationCwdLabel(runtime?.getConsultationCwdPolicy() ?? cwdPolicy.consultation.value)}`,
|
|
128
|
-
` Subagent folders: ${delegationCwdLabel(runtime?.getDelegationCwdPolicy() ?? cwdPolicy.delegation.value)}`,
|
|
129
|
-
` Read-only consultation resources: ${consultResourceLabel(runtime?.getConsultResourcePolicy() ?? consult.value)}`,
|
|
130
|
-
` Blocking worker limit: ${runtime?.getMaxParallelTasks() ?? parallelLimit.value} per request`,
|
|
131
|
-
` Background-agent limits: ${formatDetachedLimitSummary(status)}`,
|
|
132
|
-
` Subagents: ${status.activeAgents} working, ${status.retainedAgents} saved for follow-up`,
|
|
133
|
-
` Local usage recording: ${usageStatus?.enabled ? "enabled" : "disabled"}`,
|
|
134
|
-
` Recorded events this session: ${usageStatus?.recordedEvents ?? 0}`,
|
|
135
|
-
` Usage retention: ${usageStatus?.retentionDays ?? USAGE_RECORDING_RETENTION_DAYS} days`,
|
|
136
|
-
` Usage path: ${safeTerminalText(usageStatus?.path ?? "unavailable")}`,
|
|
137
|
-
"User Settings",
|
|
138
|
-
` Workflow source: ${configuredWorkflow.source}`,
|
|
139
|
-
` Configured workflow: ${workflowLabel(configuredWorkflow.value)}`,
|
|
140
|
-
` Completion source: ${snapshot.source}`,
|
|
141
|
-
` Configured completion: ${completionLabel(snapshot.value)}`,
|
|
142
|
-
` Configured blocking worker limit: ${parallelLimit.value}`,
|
|
143
|
-
` Blocking worker limit source: ${parallelLimit.source}`,
|
|
144
|
-
...(detachedLimits.values
|
|
145
|
-
? STATEFUL_LIMIT_DEFINITIONS.map((definition) => {
|
|
146
|
-
const configured = detachedLimits.values?.[definition.field];
|
|
147
|
-
return ` Configured ${definition.label.toLowerCase()}: ${configured?.value} (${configured?.source})`;
|
|
148
|
-
})
|
|
149
|
-
: [" Configured detached limits: unavailable"]),
|
|
150
|
-
` Configured consultation target: ${consultationCwdLabel(cwdPolicy.consultation.value)}`,
|
|
151
|
-
` Consultation target source: ${cwdPolicy.consultation.source}`,
|
|
152
|
-
` Configured delegation target: ${delegationCwdLabel(cwdPolicy.delegation.value)}`,
|
|
153
|
-
` Delegation target source: ${cwdPolicy.delegation.source}`,
|
|
154
|
-
` Configured consultation resources: ${consultResourceLabel(consult.value)}`,
|
|
155
|
-
` Consultation resource source: ${consult.source}`,
|
|
156
|
-
` Configured usage recording: ${usageRecording.enabled ? "enabled" : "disabled"}`,
|
|
157
|
-
` Usage recording source: ${usageRecording.source}`,
|
|
158
|
-
` Path: ${safeTerminalText(snapshot.path)}`,
|
|
159
|
-
configuredWorkflow.error ||
|
|
160
|
-
snapshot.error ||
|
|
161
|
-
cwdPolicy.error ||
|
|
162
|
-
parallelLimit.error ||
|
|
163
|
-
detachedLimits.error ||
|
|
164
|
-
transport.error ||
|
|
165
|
-
usageRecording.error
|
|
166
|
-
? ` Warning: ${safeTerminalText(configuredWorkflow.error ?? snapshot.error ?? cwdPolicy.error ?? parallelLimit.error ?? detachedLimits.error ?? transport.error ?? usageRecording.error ?? "invalid settings")}`
|
|
167
|
-
: " Warning: none",
|
|
168
|
-
configuredWorkflow.value !== current
|
|
169
|
-
? "The configured workflow differs from this session. Run /reload to apply it."
|
|
170
|
-
: "Manual file changes require /reload.",
|
|
171
|
-
].join("\n");
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export function currentWorkflow(
|
|
175
|
-
runtime: SubagentSettingsRuntime,
|
|
176
|
-
status: StatefulSubagentRuntimeStatus,
|
|
177
|
-
): DelegationWorkflow {
|
|
178
|
-
const blocking = runtime.getBlockingEnabled();
|
|
179
|
-
if (blocking && status.enabled) return "all";
|
|
180
|
-
if (status.enabled) return "async-only";
|
|
181
|
-
if (blocking) return "blocking-only";
|
|
182
|
-
return "disabled";
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export function completionLabel(value: CompletionDelivery): string {
|
|
186
|
-
return value === "auto-resume"
|
|
187
|
-
? "Continue automatically when work finishes"
|
|
188
|
-
: "Wait for my next message";
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
export function consultationCwdLabel(value: ConsultationCwdPolicy): string {
|
|
192
|
-
return value === "current-workspace"
|
|
193
|
-
? "This workspace only"
|
|
194
|
-
: "Any folder · no project resources when untrusted";
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
export function delegationCwdLabel(value: DelegationCwdPolicy): string {
|
|
198
|
-
switch (value) {
|
|
199
|
-
case "trusted-targets":
|
|
200
|
-
return "This workspace or saved-trusted folders";
|
|
201
|
-
case "current-workspace":
|
|
202
|
-
return "This workspace only";
|
|
203
|
-
case "anywhere":
|
|
204
|
-
return "Any folder Pi can access";
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
export function consultResourceLabel(value: ConsultResourcePolicy): string {
|
|
209
|
-
switch (value) {
|
|
210
|
-
case "project-context":
|
|
211
|
-
return "Project context only";
|
|
212
|
-
case "none":
|
|
213
|
-
return "No project resources";
|
|
214
|
-
case "all":
|
|
215
|
-
return "All trusted resources";
|
|
216
|
-
}
|
|
217
|
-
}
|