@xzzpig/pi-subagents 0.24.2 → 0.25.1
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 +37 -0
- package/bundle/agent-management.js +4 -4
- package/bundle/agents.js +3 -3
- package/bundle/child-tool-plan.js +2 -2
- package/bundle/chunk-34TUUBRN.js +1107 -0
- package/bundle/{chunk-SW2VMNIU.js → chunk-5OD3OWTE.js} +2 -2
- package/bundle/{chunk-EUPJB4S7.js → chunk-5Z7JAORM.js} +196 -1219
- package/bundle/{chunk-LCDJWBVM.js → chunk-66JNFRFS.js} +1 -1
- package/bundle/{chunk-ED55MIC2.js → chunk-CGFF4WA3.js} +42 -19
- package/bundle/{chunk-TMHVDPYW.js → chunk-DLVPMML3.js} +263 -154
- package/bundle/{chunk-RU522D5W.js → chunk-FQPV4O6C.js} +183 -28
- package/bundle/chunk-HXRB42AF.js +108 -0
- package/bundle/{chunk-355ECEP2.js → chunk-IH7LQVEE.js} +29 -14
- package/bundle/{chunk-Z6TFJ6BR.js → chunk-INWSUNI6.js} +1 -1
- package/bundle/{chunk-CYY5UMJU.js → chunk-IXCEOEJT.js} +411 -249
- package/bundle/{chunk-WW76JRIX.js → chunk-JAXVBXGF.js} +1 -1
- package/bundle/{chunk-ICNYIALB.js → chunk-JH5H4CYJ.js} +784 -474
- package/bundle/{chunk-224WMDIV.js → chunk-JUYNN63E.js} +350 -123
- package/bundle/{chunk-35GII5EF.js → chunk-JWFLPSTP.js} +41 -117
- package/bundle/{chunk-XWWUDWUW.js → chunk-KRNBJPZ2.js} +670 -400
- package/bundle/{chunk-RB4GELQA.js → chunk-LPJEKHOY.js} +1 -1
- package/bundle/chunk-LYKG4FKH.js +523 -0
- package/bundle/{chunk-X6LOM3Z4.js → chunk-LZ3HBDTR.js} +161 -78
- package/bundle/{chunk-JEA2ZKUA.js → chunk-MMJQMPOK.js} +37 -165
- package/bundle/{chunk-FG6SQJAR.js → chunk-OGPOCGWX.js} +24 -6
- package/bundle/{chunk-FJWI64H7.js → chunk-RMSABUN3.js} +27 -13
- package/bundle/{chunk-H36HBZB2.js → chunk-SJPABBZG.js} +2 -2
- package/bundle/{chunk-4UH4WS4G.js → chunk-SNDCIJMK.js} +23 -12
- package/bundle/{chunk-O4D5PBVI.js → chunk-TM2K53NX.js} +3 -2
- package/bundle/{chunk-3U633XDZ.js → chunk-U3ZDUUTM.js} +11 -3
- package/bundle/{chunk-LVWU2HOO.js → chunk-ULGMXABL.js} +16 -7
- package/bundle/{chunk-WPW4V6HM.js → chunk-W7ZA6TYD.js} +2 -2
- package/bundle/{chunk-BQ2OAB4Q.js → chunk-WWDUNXSE.js} +67 -30
- package/bundle/{chunk-V2KFIGFH.js → chunk-XAC2XNAP.js} +503 -304
- package/bundle/control-channel.js +2 -2
- package/bundle/index.js +1 -1
- package/bundle/intercom-bridge.js +2 -2
- package/bundle/preflight.js +12 -10
- package/bundle/project-panes.js +3 -3
- package/bundle/workflow-resources.js +1 -1
- package/docs/agents.md +27 -6
- package/docs/configuration.md +20 -8
- package/docs/extension-api.md +18 -1
- package/docs/models.md +6 -2
- package/docs/observability.md +2 -0
- package/docs/tool-reference.md +7 -1
- package/docs/workflows.md +30 -2
- package/package.json +2 -2
- package/skills/pi-subagents/SKILL.md +15 -6
- package/skills/pi-subagents/references/prompting-and-roles.md +1 -0
- package/src/agents/agent-management.d.ts +1 -0
- package/src/agents/agent-management.js +46 -18
- package/src/agents/agent-memory.d.ts +1 -4
- package/src/agents/agent-memory.js +1 -4
- package/src/agents/agent-serializer.d.ts +2 -0
- package/src/agents/agent-serializer.js +1 -1
- package/src/agents/agents.d.ts +2 -3
- package/src/agents/agents.js +46 -20
- package/src/agents/frontmatter.js +1 -8
- package/src/agents/global-npm-root.d.ts +1 -0
- package/src/agents/global-npm-root.js +11 -3
- package/src/agents/skills.d.ts +0 -3
- package/src/agents/skills.js +0 -3
- package/src/api/preflight.d.ts +3 -1
- package/src/api/preflight.js +2 -0
- package/src/extension/config.d.ts +1 -0
- package/src/extension/config.js +13 -1
- package/src/extension/herdr-pi-bridge.js +10 -2
- package/src/extension/index.d.ts +0 -13
- package/src/extension/index.js +51 -37
- package/src/extension/public-execution.d.ts +1 -0
- package/src/extension/public-execution.js +4 -0
- package/src/extension/reply-workflow-script.js +24 -4
- package/src/extension/schemas.d.ts +12 -3
- package/src/extension/schemas.js +7 -3
- package/src/extension/session-switch.d.ts +25 -0
- package/src/extension/session-switch.js +138 -0
- package/src/extension/subagent-guide.d.ts +1 -1
- package/src/extension/subagent-guide.js +1 -1
- package/src/extension/subagent-launch-tool.d.ts +25 -0
- package/src/extension/subagent-launch-tool.js +48 -0
- package/src/extension/tool-activation.js +55 -15
- package/src/extension/tool-description.d.ts +1 -1
- package/src/extension/tool-description.js +14 -8
- package/src/inspectors/herdr/actions.d.ts +0 -1
- package/src/inspectors/herdr/actions.js +0 -1
- package/src/inspectors/session-roots-codec.d.ts +0 -1
- package/src/inspectors/session-roots-codec.js +0 -1
- package/src/inspectors/tmux/actions.d.ts +0 -1
- package/src/inspectors/tmux/actions.js +0 -1
- package/src/integrations/herdr-status.js +3 -8
- package/src/intercom/native-supervisor-channel.js +65 -9
- package/src/runs/background/async-execution.d.ts +7 -10
- package/src/runs/background/async-execution.js +66 -29
- package/src/runs/background/async-job-tracker.js +12 -0
- package/src/runs/background/async-resume.d.ts +2 -1
- package/src/runs/background/async-resume.js +114 -40
- package/src/runs/background/async-retention.d.ts +0 -2
- package/src/runs/background/async-retention.js +17 -6
- package/src/runs/background/async-status.d.ts +2 -0
- package/src/runs/background/async-status.js +4 -0
- package/src/runs/background/auto-drain.js +2 -1
- package/src/runs/background/boot-id.d.ts +1 -3
- package/src/runs/background/boot-id.js +1 -3
- package/src/runs/background/completion-batcher.d.ts +3 -4
- package/src/runs/background/completion-batcher.js +2 -3
- package/src/runs/background/control-channel.d.ts +0 -6
- package/src/runs/background/control-channel.js +0 -6
- package/src/runs/background/fleet-view.js +2 -3
- package/src/runs/background/notify.d.ts +0 -2
- package/src/runs/background/notify.js +0 -2
- package/src/runs/background/result-watcher.d.ts +1 -0
- package/src/runs/background/result-watcher.js +59 -29
- package/src/runs/background/resume-guidance.js +4 -2
- package/src/runs/background/retained-children.js +2 -1
- package/src/runs/background/run-child-session.d.ts +2 -3
- package/src/runs/background/run-child-session.js +5 -8
- package/src/runs/background/run-status.js +9 -7
- package/src/runs/background/runner-aliases.js +15 -0
- package/src/runs/background/scheduled-runs.d.ts +3 -1
- package/src/runs/background/scheduled-runs.js +13 -16
- package/src/runs/background/steering.d.ts +2 -11
- package/src/runs/background/steering.js +11 -6
- package/src/runs/background/subagent-runner.d.ts +2 -6
- package/src/runs/background/subagent-runner.js +88 -70
- package/src/runs/background/subagent-wait.js +12 -15
- package/src/runs/background/wait-config.d.ts +2 -0
- package/src/runs/background/wait-config.js +17 -3
- package/src/runs/background/wait-subscriptions.js +124 -12
- package/src/runs/background/wait-tool.js +4 -2
- package/src/runs/background/workflow-terminal-proof.d.ts +0 -1
- package/src/runs/background/workflow-terminal-proof.js +0 -1
- package/src/runs/foreground/async-steering-action.js +24 -9
- package/src/runs/foreground/async-stop-action.d.ts +1 -1
- package/src/runs/foreground/async-stop-action.js +9 -1
- package/src/runs/foreground/execution.d.ts +0 -3
- package/src/runs/foreground/execution.js +68 -84
- package/src/runs/foreground/fork-tool-result-handler.d.ts +60 -0
- package/src/runs/foreground/fork-tool-result-handler.js +83 -0
- package/src/runs/foreground/prompt-audit.js +1 -0
- package/src/runs/foreground/subagent-executor.d.ts +5 -10
- package/src/runs/foreground/subagent-executor.js +164 -49
- package/src/runs/shared/acceptance.js +69 -26
- package/src/runs/shared/async-status-projection.d.ts +2 -0
- package/src/runs/shared/async-status-projection.js +10 -0
- package/src/runs/shared/child-commands.js +15 -2
- package/src/runs/shared/child-hooks.d.ts +1 -7
- package/src/runs/shared/child-hooks.js +13 -5
- package/src/runs/shared/child-launch.js +6 -2
- package/src/runs/shared/child-runtime-config.d.ts +0 -1
- package/src/runs/shared/child-session.d.ts +6 -5
- package/src/runs/shared/child-session.js +85 -38
- package/src/runs/shared/child-tool-plan.d.ts +0 -1
- package/src/runs/shared/child-tool-plan.js +0 -1
- package/src/runs/shared/claude-code-adapter.js +11 -0
- package/src/runs/shared/external-cli-contract.d.ts +49 -0
- package/src/runs/shared/external-cli-contract.js +18 -13
- package/src/runs/shared/external-cli-runner.js +26 -6
- package/src/runs/shared/herdr-connection.js +2 -1
- package/src/runs/shared/herdr-pane-host.d.ts +2 -2
- package/src/runs/shared/herdr-pane-host.js +17 -1
- package/src/runs/shared/herdr-placed-run.js +51 -24
- package/src/runs/shared/lane-metadata.d.ts +0 -1
- package/src/runs/shared/lane-metadata.js +0 -1
- package/src/runs/shared/mcp-config-sources.d.ts +4 -1
- package/src/runs/shared/mcp-config-sources.js +1 -1
- package/src/runs/shared/mcp-direct-tool-allowlist.d.ts +0 -3
- package/src/runs/shared/mcp-direct-tool-allowlist.js +26 -17
- package/src/runs/shared/mcp-direct-tool-grant.js +8 -1
- package/src/runs/shared/model-resolution-diagnostic.d.ts +0 -1
- package/src/runs/shared/model-resolution.d.ts +20 -5
- package/src/runs/shared/model-resolution.js +55 -50
- package/src/runs/shared/model-scope.d.ts +1 -5
- package/src/runs/shared/model-scope.js +1 -5
- package/src/runs/shared/mutation-evidence.d.ts +1 -1
- package/src/runs/shared/mutation-evidence.js +52 -7
- package/src/runs/shared/nested-events.d.ts +1 -0
- package/src/runs/shared/nested-events.js +1 -1
- package/src/runs/shared/parallel-utils.d.ts +0 -1
- package/src/runs/shared/permissions.js +5 -3
- package/src/runs/shared/placement-host.d.ts +5 -1
- package/src/runs/shared/rex-pane-host.d.ts +0 -1
- package/src/runs/shared/rex-pane-host.js +0 -2
- package/src/runs/shared/run-launch-folder.d.ts +12 -0
- package/src/runs/shared/run-launch-folder.js +21 -0
- package/src/runs/shared/runner-launcher.d.ts +12 -1
- package/src/runs/shared/runner-launcher.js +16 -0
- package/src/runs/shared/single-output.d.ts +3 -3
- package/src/runs/shared/single-output.js +5 -3
- package/src/runs/shared/structured-output.d.ts +8 -0
- package/src/runs/shared/structured-output.js +40 -5
- package/src/runs/shared/subagent-prompt-runtime.d.ts +0 -1
- package/src/runs/shared/subagent-prompt-runtime.js +18 -4
- package/src/runs/shared/supervisor-wait-timer.d.ts +16 -0
- package/src/runs/shared/supervisor-wait-timer.js +61 -0
- package/src/runs/shared/tool-timeout.js +2 -1
- package/src/runs/shared/worktree-cleanup-plan.d.ts +0 -1
- package/src/runs/shared/worktree-cleanup-plan.js +0 -1
- package/src/runs/shared/worktree.d.ts +3 -0
- package/src/runs/shared/worktree.js +20 -0
- package/src/shared/artifacts.d.ts +1 -0
- package/src/shared/artifacts.js +132 -22
- package/src/shared/capacity-resilient-json.d.ts +1 -1
- package/src/shared/child-cache-retention.d.ts +1 -2
- package/src/shared/child-cache-retention.js +1 -2
- package/src/shared/fleet-transcript-reader.d.ts +64 -0
- package/src/shared/fleet-transcript-reader.js +376 -0
- package/src/shared/formatters.d.ts +0 -18
- package/src/shared/formatters.js +0 -18
- package/src/shared/pruned-fork.js +2 -2
- package/src/shared/reported-progress.d.ts +1 -0
- package/src/shared/reported-progress.js +12 -0
- package/src/shared/session-succession.d.ts +16 -1
- package/src/shared/session-succession.js +41 -2
- package/src/shared/session-warnings.d.ts +7 -0
- package/src/shared/session-warnings.js +26 -0
- package/src/shared/settings.d.ts +0 -23
- package/src/shared/settings.js +3 -35
- package/src/shared/status-format.d.ts +1 -0
- package/src/shared/status-format.js +1 -1
- package/src/shared/types.d.ts +108 -59
- package/src/shared/types.js +0 -12
- package/src/shared/utils.d.ts +3 -15
- package/src/shared/utils.js +4 -22
- package/src/shared/wait-tool-name.d.ts +8 -0
- package/src/shared/wait-tool-name.js +13 -0
- package/src/slash/slash-commands.js +2 -1
- package/src/slash/subagent-cost.d.ts +3 -2
- package/src/slash/subagent-cost.js +22 -3
- package/src/slash/subagents-admin.js +0 -1
- package/src/tui/fleet-native-transcript.js +1 -1
- package/src/tui/fleet-status.d.ts +0 -5
- package/src/tui/fleet-status.js +4 -24
- package/src/tui/fleet-transcript.d.ts +1 -57
- package/src/tui/fleet-transcript.js +4 -370
- package/src/tui/fleet.js +6 -4
- package/src/tui/render.d.ts +0 -9
- package/src/tui/render.js +194 -68
- package/src/tui/subagent-messages.js +3 -2
- package/src/watchdog/model-selection.js +2 -2
- package/src/watchdog/permission-arbiter.js +1 -0
- package/src/watchdog/register-child.d.ts +2 -3
- package/src/watchdog/register-child.js +2 -3
- package/src/watchdog/review.d.ts +0 -5
- package/src/watchdog/review.js +4 -3
- package/src/watchdog/turn-delta.js +2 -1
- package/src/workflows/scripted-workflow.d.ts +2 -0
- package/src/workflows/scripted-workflow.js +344 -59
- package/src/workflows/structured-workflow-scripts.d.ts +4 -3
- package/src/workflows/structured-workflow-scripts.js +32 -11
- package/src/workflows/workflow-launch-record.d.ts +15 -6
- package/src/workflows/workflow-launch-record.js +30 -12
- package/src/workflows/workflow-receipt.js +36 -53
- package/src/workflows/workflow-resources.js +4 -4
- package/src/workflows/workflow-resume-claim.d.ts +2 -0
- package/src/workflows/workflow-resume-claim.js +3 -3
- package/src/workflows/workflow-resume.d.ts +1 -1
- package/src/workflows/workflow-resume.js +13 -8
- package/src/workflows/workflow-script-worker.d.ts +13 -0
- package/src/workflows/workflow-script-worker.js +81 -0
- package/workflow-script-process.cjs +36 -0
- package/workflow-script-worker.cjs +4 -1
- package/bundle/chunk-U4ODUYAG.js +0 -235
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolvePiLaunchToolPlan
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IH7LQVEE.js";
|
|
4
4
|
import {
|
|
5
5
|
listExternalJobProviders
|
|
6
6
|
} from "./chunk-YYREO77V.js";
|
|
7
7
|
import {
|
|
8
8
|
mergeRuntimeAgents
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-INWSUNI6.js";
|
|
10
10
|
import {
|
|
11
11
|
CODE_OWNED_EXTERNAL_CLI_ADAPTER_LABEL,
|
|
12
|
+
MAX_LISTED_AGENTS,
|
|
12
13
|
THINKING_LEVELS,
|
|
13
14
|
buildRuntimeName,
|
|
14
15
|
defaultInheritProjectContext,
|
|
@@ -22,6 +23,8 @@ import {
|
|
|
22
23
|
frontmatterNameForConfig,
|
|
23
24
|
getProjectConfigDir,
|
|
24
25
|
isCodeOwnedExternalCliAdapterId,
|
|
26
|
+
isUnavailableSubagentModel,
|
|
27
|
+
knownModelProviders,
|
|
25
28
|
mergeAgentsForScope,
|
|
26
29
|
mergeBuiltinAgentOverride,
|
|
27
30
|
parseFrontmatter,
|
|
@@ -43,7 +46,7 @@ import {
|
|
|
43
46
|
validatePermissionProfileName,
|
|
44
47
|
validateSandboxProfileName,
|
|
45
48
|
validateToolBudgetConfig
|
|
46
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-XAC2XNAP.js";
|
|
47
50
|
import {
|
|
48
51
|
capabilityCeilingAgentRestrictionSources,
|
|
49
52
|
isAgentAllowedByCapabilityCeiling,
|
|
@@ -360,6 +363,7 @@ function editableAgentConfig(agent) {
|
|
|
360
363
|
const next = { ...config };
|
|
361
364
|
if (!hasDeclaredField("model")) delete next.model;
|
|
362
365
|
if (!hasDeclaredField("thinking")) delete next.thinking;
|
|
366
|
+
if (!hasDeclaredField("inheritGlobalContext")) next.inheritGlobalContext = false;
|
|
363
367
|
return next;
|
|
364
368
|
};
|
|
365
369
|
const {
|
|
@@ -408,7 +412,7 @@ function editableAgentConfig(agent) {
|
|
|
408
412
|
...base.thinking !== void 0 && hasDeclaredField("thinking") ? { thinking: base.thinking } : {},
|
|
409
413
|
systemPromptMode: base.systemPromptMode,
|
|
410
414
|
inheritProjectContext: base.inheritProjectContext,
|
|
411
|
-
inheritGlobalContext: base.inheritGlobalContext,
|
|
415
|
+
inheritGlobalContext: hasDeclaredField("inheritGlobalContext") && base.inheritGlobalContext,
|
|
412
416
|
inheritSkills: base.inheritSkills,
|
|
413
417
|
...base.defaultContext !== void 0 ? { defaultContext: base.defaultContext } : {},
|
|
414
418
|
...base.acceptanceRole !== void 0 ? { acceptanceRole: base.acceptanceRole } : {},
|
|
@@ -816,7 +820,8 @@ function agentListMetadata(agent, providerNames2, externalCliAvailability) {
|
|
|
816
820
|
function formatAgentListLine(agent, providerNames2) {
|
|
817
821
|
return `- ${agent.name} (${agentListMetadata(agent, providerNames2)}): ${agent.description}`;
|
|
818
822
|
}
|
|
819
|
-
|
|
823
|
+
var UNAVAILABLE_MODEL_MARKER = "(unavailable in the active model registry)";
|
|
824
|
+
function formatAgentCapabilitiesLine(agent, providerNames2, externalCliAvailability, unavailableModels) {
|
|
820
825
|
const declaredTools = [
|
|
821
826
|
...agent.tools ?? [],
|
|
822
827
|
...(agent.mcpDirectTools ?? []).map((tool) => `mcp:${tool}`)
|
|
@@ -832,6 +837,7 @@ function formatAgentCapabilitiesLine(agent, providerNames2, externalCliAvailabil
|
|
|
832
837
|
if (agent.model !== void 0) {
|
|
833
838
|
model = agent.model;
|
|
834
839
|
if (agent.modelProvider && !agent.model.includes("/")) model = `${agent.modelProvider}/${agent.model}`;
|
|
840
|
+
if (unavailableModels.has(agent)) model = `${model} ${UNAVAILABLE_MODEL_MARKER}`;
|
|
835
841
|
}
|
|
836
842
|
const thinking = agent.thinking === false ? "off" : agent.thinking ?? "default";
|
|
837
843
|
const machine = agent.machine ? `; Machine: ${agent.machine} (saved Herdr placement)` : "";
|
|
@@ -904,7 +910,7 @@ function agentCapabilityRow(agent, options) {
|
|
|
904
910
|
aliases: agent.aliases ? [...agent.aliases] : void 0,
|
|
905
911
|
runner: agentCapabilityRunner(agent, options.providerNames, options.externalCliAvailability),
|
|
906
912
|
tools: agentCapabilityTools(agent),
|
|
907
|
-
model: presentDetails({ value: agent.model, thinking: agent.thinking }),
|
|
913
|
+
model: presentDetails({ value: agent.model, thinking: agent.thinking, unavailable: options.unavailableModels.has(agent) || void 0 }),
|
|
908
914
|
execution: presentDetails({ defaultAsync: agent.defaultAsync, timeoutMs: agent.defaultTimeoutMs }),
|
|
909
915
|
acceptance: presentDetails({ policy: agent.defaultAcceptance, role: agent.acceptanceRole }),
|
|
910
916
|
output: presentDetails({ path: agent.output, mode: agent.outputMode }),
|
|
@@ -914,8 +920,8 @@ function agentCapabilityRow(agent, options) {
|
|
|
914
920
|
function agentCapabilitiesSnapshot(input) {
|
|
915
921
|
return {
|
|
916
922
|
agents: [
|
|
917
|
-
...input.agents.map((agent) => agentCapabilityRow(agent, { executable: true, providerNames: input.providerNames, externalCliAvailability: input.externalCliAvailability })),
|
|
918
|
-
...input.restrictedAgents.map((agent) => agentCapabilityRow(agent, { executable: false, providerNames: input.providerNames, externalCliAvailability: input.externalCliAvailability, restrictionSources: input.restrictedSources }))
|
|
923
|
+
...input.agents.map((agent) => agentCapabilityRow(agent, { executable: true, providerNames: input.providerNames, externalCliAvailability: input.externalCliAvailability, unavailableModels: input.unavailableModels })),
|
|
924
|
+
...input.restrictedAgents.map((agent) => agentCapabilityRow(agent, { executable: false, providerNames: input.providerNames, externalCliAvailability: input.externalCliAvailability, unavailableModels: input.unavailableModels, restrictionSources: input.restrictedSources }))
|
|
919
925
|
],
|
|
920
926
|
restrictedCount: input.restrictedAgents.length,
|
|
921
927
|
...input.restrictedSources?.length ? { capabilityCeilingSources: [...input.restrictedSources] } : {}
|
|
@@ -952,6 +958,7 @@ function agentCapabilityDetails(input) {
|
|
|
952
958
|
restrictedAgents: input.restrictedAgents,
|
|
953
959
|
providerNames: input.providerNames,
|
|
954
960
|
externalCliAvailability: input.externalCliAvailability,
|
|
961
|
+
unavailableModels: input.unavailableModels,
|
|
955
962
|
restrictedSources: input.restrictedSources
|
|
956
963
|
}))
|
|
957
964
|
};
|
|
@@ -1036,7 +1043,8 @@ function handleList(params, ctx) {
|
|
|
1036
1043
|
let scopedAgents = effectiveAgentsForScope(scope, d, ctx.runtimeAgentOwner, ctx.model?.provider);
|
|
1037
1044
|
scopedAgents = scopedAgents.sort((a, b) => a.name.localeCompare(b.name));
|
|
1038
1045
|
const capabilityCeiling = resolveCurrentSubagentCapabilityCeiling(ctx.piSessionId);
|
|
1039
|
-
const
|
|
1046
|
+
const search = typeof params.search === "string" ? params.search.trim().toLowerCase() : "";
|
|
1047
|
+
const visibleAgents = scopedAgents.filter((a) => !a.disabled && (!search || [a.name, a.description, ...a.aliases ?? []].some((text) => text.toLowerCase().includes(search))));
|
|
1040
1048
|
const agents = visibleAgents.filter((a) => isAgentAllowedByCapabilityCeiling(a.name, capabilityCeiling));
|
|
1041
1049
|
const restrictedAgents = visibleAgents.filter((a) => !isAgentAllowedByCapabilityCeiling(a.name, capabilityCeiling));
|
|
1042
1050
|
const restrictedSources = capabilityCeilingAgentRestrictionSources(capabilityCeiling);
|
|
@@ -1049,12 +1057,19 @@ function handleList(params, ctx) {
|
|
|
1049
1057
|
const providerNameSet = providerNames(providerStatus);
|
|
1050
1058
|
const capabilityMode = params.capabilities === true;
|
|
1051
1059
|
const externalCliAvailability = capabilityMode ? externalCliAvailabilityForAgents([...agents, ...restrictedAgents]) : void 0;
|
|
1052
|
-
const
|
|
1060
|
+
const availableModels = capabilityMode ? ctx.modelRegistry.getAvailable().map(toModelInfo) : [];
|
|
1061
|
+
const knownProviders = knownModelProviders(ctx.modelRegistry);
|
|
1062
|
+
const unavailableModels = new Set([...agents, ...restrictedAgents].filter((agent) => (agent.runner?.type ?? "pi") === "pi" && isUnavailableSubagentModel(agent.model, availableModels, agent.modelProvider ?? ctx.model?.provider, knownProviders)));
|
|
1063
|
+
const formatLine = capabilityMode ? (agent, names) => formatAgentCapabilitiesLine(agent, names, externalCliAvailability, unavailableModels) : formatAgentListLine;
|
|
1064
|
+
const shownAgents = agents.slice(0, MAX_LISTED_AGENTS);
|
|
1065
|
+
const shownRestrictedAgents = restrictedAgents.slice(0, MAX_LISTED_AGENTS - shownAgents.length);
|
|
1066
|
+
const omittedCount = Math.max(0, agents.length + restrictedAgents.length - MAX_LISTED_AGENTS);
|
|
1053
1067
|
const lines = [
|
|
1054
1068
|
capabilityMode ? "Executable agents (capabilities):" : "Executable agents:",
|
|
1055
|
-
...formatAgentListSections(
|
|
1069
|
+
...formatAgentListSections(shownAgents, providerNameSet, formatLine)
|
|
1056
1070
|
];
|
|
1057
|
-
appendRestrictedAgentLines({ lines, agents:
|
|
1071
|
+
appendRestrictedAgentLines({ lines, agents: shownRestrictedAgents, sources: restrictedSources, providerNames: providerNameSet, formatLine });
|
|
1072
|
+
if (omittedCount > 0) lines.push("", `+${omittedCount} more; narrow with {action:"list", options:{search:"<term>"}}`);
|
|
1058
1073
|
appendExternalJobRegistryLine(lines, [...agents, ...restrictedAgents], providerStatus);
|
|
1059
1074
|
appendAgentDiagnosticLines(lines, d.agentDiagnostics);
|
|
1060
1075
|
if (proactiveSuggestions.length) lines.push("", ...proactiveSuggestions);
|
|
@@ -1064,12 +1079,18 @@ function handleList(params, ctx) {
|
|
|
1064
1079
|
restrictedAgents,
|
|
1065
1080
|
providerNames: providerNameSet,
|
|
1066
1081
|
externalCliAvailability: externalCliAvailability ?? /* @__PURE__ */ new Map(),
|
|
1082
|
+
unavailableModels,
|
|
1067
1083
|
restrictedSources
|
|
1068
1084
|
}));
|
|
1069
1085
|
}
|
|
1086
|
+
function modelOverrideFile(override) {
|
|
1087
|
+
const scopes = override.fieldScopes?.model;
|
|
1088
|
+
const scope = scopes?.includes("project") ? "project" : scopes?.includes("user") ? "user" : override.scope;
|
|
1089
|
+
return { scope, path: override.paths?.[scope] ?? override.path };
|
|
1090
|
+
}
|
|
1070
1091
|
function formatModelSource(agent, currentModel) {
|
|
1071
1092
|
if (agent.override && agent.model !== agent.override.base.model) {
|
|
1072
|
-
return `${agent.override.scope} override`;
|
|
1093
|
+
return `${modelOverrideFile(agent.override).scope} override`;
|
|
1073
1094
|
}
|
|
1074
1095
|
if (agent.modelSource?.type === "subagents.defaultModel" && agent.model === agent.modelSource.model) {
|
|
1075
1096
|
return `${agent.modelSource.scope} defaultModel`;
|
|
@@ -1085,6 +1106,7 @@ function handleModels(params, ctx) {
|
|
|
1085
1106
|
const discovered = discoverCatalog(ctx, ctx.cwd, ctx.model?.provider);
|
|
1086
1107
|
const effectiveAgents = effectiveAgentsForScope(scope, discovered, ctx.runtimeAgentOwner, ctx.model?.provider).sort((a, b) => a.name.localeCompare(b.name));
|
|
1087
1108
|
const availableModels = ctx.modelRegistry.getAvailable().map(toModelInfo);
|
|
1109
|
+
const knownProviders = knownModelProviders(ctx.modelRegistry);
|
|
1088
1110
|
const currentModel = ctx.model ? { provider: ctx.model.provider, id: ctx.model.id } : void 0;
|
|
1089
1111
|
const preferredProvider = ctx.model?.provider;
|
|
1090
1112
|
const capabilityCeiling = resolveCurrentSubagentCapabilityCeiling(ctx.piSessionId);
|
|
@@ -1113,18 +1135,19 @@ function handleModels(params, ctx) {
|
|
|
1113
1135
|
];
|
|
1114
1136
|
const modelEntries = selectedAgents.flatMap((agent) => requestedAgent ? [{ agent, name: requestedAgent }] : [{ agent, name: agent.name }, ...(agent.aliases ?? []).map((name) => ({ agent, name }))]);
|
|
1115
1137
|
for (const { agent, name } of modelEntries) {
|
|
1116
|
-
const resolvedModel = resolveSubagentModelOverride(agent.model, currentModel, availableModels, agent.modelProvider ?? preferredProvider);
|
|
1138
|
+
const resolvedModel = resolveSubagentModelOverride(agent.model, currentModel, availableModels, agent.modelProvider ?? preferredProvider, { knownProviders });
|
|
1139
|
+
const shownModel = resolvedModel === void 0 ? "(unresolved)" : (agent.runner?.type ?? "pi") === "pi" && isUnavailableSubagentModel(agent.model, availableModels, agent.modelProvider ?? preferredProvider, knownProviders) ? `${resolvedModel} ${UNAVAILABLE_MODEL_MARKER}` : resolvedModel;
|
|
1117
1140
|
const effectiveThinking = resolveEffectiveThinking(resolvedModel, agent.thinking) ?? (agent.thinking === false ? "off" : void 0);
|
|
1118
1141
|
const source = `${formatModelSource(agent, currentModel)}${agent.disabled ? "; disabled" : ""}${isAgentAllowedByCapabilityCeiling(agent.name, capabilityCeiling) ? "" : "; restricted"}`;
|
|
1119
1142
|
if (requestedAgent) {
|
|
1120
1143
|
lines.push(`Agent: ${requestedAgent}`);
|
|
1121
1144
|
lines.push("Effective model:");
|
|
1122
|
-
lines.push(` ${
|
|
1145
|
+
lines.push(` ${shownModel}`);
|
|
1123
1146
|
lines.push(`Source: ${source}`);
|
|
1124
1147
|
lines.push(`Thinking: ${effectiveThinking ?? "default"}`);
|
|
1125
1148
|
if (agent.override) {
|
|
1126
1149
|
lines.push("Override file:");
|
|
1127
|
-
lines.push(` ${agent.override.path}`);
|
|
1150
|
+
lines.push(` ${modelOverrideFile(agent.override).path}`);
|
|
1128
1151
|
}
|
|
1129
1152
|
if (agent.model && resolvedModel && agent.model !== resolvedModel) {
|
|
1130
1153
|
lines.push("Requested model setting:");
|
|
@@ -1138,12 +1161,12 @@ function handleModels(params, ctx) {
|
|
|
1138
1161
|
}
|
|
1139
1162
|
lines.push(name);
|
|
1140
1163
|
lines.push(" model:");
|
|
1141
|
-
lines.push(` ${
|
|
1164
|
+
lines.push(` ${shownModel}`);
|
|
1142
1165
|
lines.push(` source: ${source}`);
|
|
1143
1166
|
lines.push(` thinking: ${effectiveThinking ?? "default"}`);
|
|
1144
1167
|
if (agent.override) {
|
|
1145
1168
|
lines.push(" override file:");
|
|
1146
|
-
lines.push(` ${agent.override.path}`);
|
|
1169
|
+
lines.push(` ${modelOverrideFile(agent.override).path}`);
|
|
1147
1170
|
}
|
|
1148
1171
|
if (agent.model && resolvedModel && agent.model !== resolvedModel) {
|
|
1149
1172
|
lines.push(" requested model setting:");
|
|
@@ -1228,7 +1251,7 @@ function handleCreate(params, ctx) {
|
|
|
1228
1251
|
if (mw) warnings.push(mw);
|
|
1229
1252
|
const sw = skillsWarning(ctx.cwd, agent);
|
|
1230
1253
|
if (sw) warnings.push(sw);
|
|
1231
|
-
fs.writeFileSync(targetPath, serializeAgent(agent), "utf-8");
|
|
1254
|
+
fs.writeFileSync(targetPath, serializeAgent(agent, { explicitInheritGlobalContext: hasKey(cfg, "inheritGlobalContext") }), "utf-8");
|
|
1232
1255
|
ctx.onAgentsChanged?.();
|
|
1233
1256
|
return result([`Created agent '${runtimeName}' at ${targetPath}.`, ...warnings].join("\n"));
|
|
1234
1257
|
}
|