@xzzpig/pi-subagents 0.13.0 → 0.15.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 +243 -0
- package/README.md +6 -5
- package/agents/evidence-auditor.md +34 -0
- package/agents/researcher.md +23 -13
- package/agents/reviewer.md +3 -2
- package/docs/agents.md +56 -15
- package/docs/configuration.md +93 -15
- package/docs/extension-api.md +132 -19
- package/docs/missions.md +10 -2
- package/docs/models.md +11 -22
- package/docs/observability.md +67 -11
- package/docs/standalone-background.md +59 -0
- package/docs/tool-reference.md +42 -23
- package/docs/watchdog.md +39 -10
- package/docs/workflows.md +58 -19
- package/index.ts +5 -2
- package/inspector-runner.mjs +2 -2
- package/node_modules/@xzzpig/pi-components/CHANGELOG.md +19 -0
- package/node_modules/@xzzpig/pi-components/README.md +28 -0
- package/node_modules/@xzzpig/pi-components/dist/src/transcript.d.ts +46 -4
- package/node_modules/@xzzpig/pi-components/dist/src/transcript.js +65 -17
- package/node_modules/@xzzpig/pi-components/package.json +1 -1
- package/node_modules/@xzzpig/pi-components/src/transcript.ts +107 -14
- package/package.json +10 -5
- package/prompts/parallel-review.md +1 -1
- package/runner-peer-loader.mjs +24 -0
- package/runner-peer-preload.mjs +36 -0
- package/skills/pi-subagents/SKILL.md +34 -22
- package/skills/pi-subagents/references/constraints-and-recipes.md +3 -2
- package/skills/pi-subagents/references/execution-controls.md +27 -8
- package/skills/pi-subagents/references/management-authoring-rpc.md +2 -2
- package/skills/pi-subagents/references/multi-lane-orchestration.md +3 -1
- package/skills/pi-subagents/references/prompting-and-roles.md +17 -13
- package/skills/pi-subagents/references/review-and-validation.md +3 -3
- package/src/agents/advertised-agent-prompt.ts +94 -0
- package/src/agents/agent-management.ts +71 -59
- package/src/agents/agent-serializer.ts +6 -3
- package/src/agents/agents.ts +198 -72
- package/src/agents/builtin-names.ts +1 -0
- package/src/agents/chain-serializer.ts +5 -0
- package/src/agents/runtime-agent-registry.ts +7 -6
- package/src/api/delegation.ts +4 -0
- package/src/api/preflight.ts +110 -71
- package/src/api/required-child-extensions.ts +6 -0
- package/src/api/shared-types.ts +3 -1
- package/src/api/workflow-resources.ts +6 -0
- package/src/extension/config.ts +14 -37
- package/src/extension/fanout-child.ts +68 -5
- package/src/extension/herdr-pi-bridge.ts +164 -0
- package/src/extension/index.ts +141 -51
- package/src/extension/public-execution.ts +7 -6
- package/src/extension/rpc.ts +8 -21
- package/src/extension/schemas.ts +86 -84
- package/src/extension/tool-description.ts +32 -79
- package/src/inspectors/actions.ts +148 -0
- package/src/inspectors/ghostty/actions.ts +74 -0
- package/src/inspectors/ghostty/plugin.ts +17 -0
- package/src/inspectors/herdr/actions.ts +99 -179
- package/src/inspectors/herdr/plugin.ts +20 -0
- package/src/inspectors/herdr/project-panes.ts +4 -1
- package/src/inspectors/{herdr/inspector-runner.ts → inspector-runner.ts} +12 -12
- package/src/inspectors/plugins.ts +8 -0
- package/src/inspectors/{herdr/session-roots-codec.ts → session-roots-codec.ts} +3 -14
- package/src/inspectors/types.ts +51 -0
- package/src/integrations/pi-web-session-liveness.ts +73 -0
- package/src/intercom/intercom-bridge.ts +50 -8
- package/src/intercom/native-supervisor-channel.ts +142 -115
- package/src/intercom/supervisor-ui.ts +3 -2
- package/src/missions/workflow-state.ts +37 -16
- package/src/policy/authority.ts +4 -0
- package/src/profiles/profiles.ts +12 -6
- package/src/runs/background/active-async-capacity.ts +22 -18
- package/src/runs/background/active-run-index.ts +17 -1
- package/src/runs/background/async-execution.ts +359 -176
- package/src/runs/background/async-job-tracker.ts +41 -7
- package/src/runs/background/async-resume.ts +19 -12
- package/src/runs/background/async-retention.ts +20 -0
- package/src/runs/background/async-status-snapshot.ts +10 -12
- package/src/runs/background/async-status.ts +32 -13
- package/src/runs/background/auto-drain.ts +59 -35
- package/src/runs/background/binary-bootstrap.ts +38 -0
- package/src/runs/background/chain-append.ts +1 -1
- package/src/runs/background/chain-root-attachment.ts +22 -33
- package/src/runs/background/control-channel.ts +78 -44
- package/src/runs/background/fleet-view.ts +30 -2
- package/src/runs/background/notify.ts +193 -19
- package/src/runs/background/owned-process-tree.ts +35 -8
- package/src/runs/background/process-terminal.ts +23 -23
- package/src/runs/background/result-files.ts +8 -4
- package/src/runs/background/result-watcher.ts +19 -2
- package/src/runs/background/retained-nested-route-tracker.ts +96 -0
- package/src/runs/background/run-child-session.ts +118 -41
- package/src/runs/background/run-status.ts +78 -5
- package/src/runs/background/runner-aliases.ts +22 -5
- package/src/runs/background/runner-child-launch.ts +93 -0
- package/src/runs/background/runner-child-sessions.ts +5 -4
- package/src/runs/background/runner-http-dispatcher.ts +119 -0
- package/src/runs/background/scheduled-runs.ts +51 -18
- package/src/runs/background/stale-run-reconciler.ts +38 -12
- package/src/runs/background/steering.ts +20 -2
- package/src/runs/background/subagent-runner.ts +766 -432
- package/src/runs/background/subagent-wait.ts +179 -28
- package/src/runs/background/wait-completions.ts +79 -27
- package/src/runs/background/wait-subscriptions.ts +9 -3
- package/src/runs/background/wait-tool.ts +5 -3
- package/src/runs/foreground/async-steering-action.ts +37 -7
- package/src/runs/foreground/async-stop-action.ts +93 -3
- package/src/runs/foreground/execution.ts +174 -194
- package/src/runs/foreground/foreground-history.ts +5 -2
- package/src/runs/foreground/prompt-audit.ts +12 -6
- package/src/runs/foreground/subagent-executor.ts +896 -397
- package/src/runs/foreground/workflow-detach-reconcile.ts +10 -5
- package/src/runs/foreground/workflow-foreground-steering.ts +57 -2
- package/src/runs/shared/acceptance.ts +54 -14
- package/src/runs/shared/agent-contract.ts +1 -1
- package/src/runs/shared/async-status-projection.ts +172 -78
- package/src/runs/shared/capability-ceiling.ts +2 -0
- package/src/runs/shared/child-hooks.ts +167 -3
- package/src/runs/shared/child-launch-plan.ts +15 -3
- package/src/runs/shared/child-launch.ts +44 -16
- package/src/runs/shared/child-lifecycle.ts +6 -3
- package/src/runs/shared/child-runtime-config.ts +8 -1
- package/src/runs/shared/child-session.ts +130 -24
- package/src/runs/shared/child-tool-plan.ts +145 -14
- package/src/runs/shared/completion-evidence.ts +2 -2
- package/src/runs/shared/completion-guard.ts +6 -3
- package/src/runs/shared/dynamic-fanout.ts +2 -2
- package/src/runs/shared/effective-system-prompt.ts +33 -0
- package/src/runs/shared/external-cli-contract.ts +11 -1
- package/src/runs/shared/external-cli-preflight.ts +6 -2
- package/src/runs/shared/external-cli-runner.ts +9 -7
- package/src/runs/shared/herdr-connection.ts +134 -0
- package/src/runs/shared/herdr-external-adapters.ts +169 -0
- package/src/runs/shared/herdr-machine.ts +279 -0
- package/src/runs/shared/herdr-pi-protocol.ts +59 -0
- package/src/runs/shared/herdr-placed-run.ts +263 -0
- package/src/runs/shared/host-step-status.ts +11 -11
- package/src/runs/shared/llm-intent-arbiter.ts +40 -21
- package/src/runs/shared/model-resolution-diagnostic.ts +76 -0
- package/src/runs/shared/{model-fallback.ts → model-resolution.ts} +34 -218
- package/src/runs/shared/model-scope.ts +1 -1
- package/src/runs/shared/nested-events.ts +19 -10
- package/src/runs/shared/orca-progress-tabs.ts +7 -1
- package/src/runs/shared/parallel-handoff.ts +57 -12
- package/src/runs/shared/parallel-utils.ts +10 -4
- package/src/runs/shared/pi-spawn.ts +10 -0
- package/src/runs/shared/readonly-drain-observation.ts +42 -0
- package/src/runs/shared/run-fanout-budget.ts +8 -8
- package/src/runs/shared/runtime-acknowledged-extensions.ts +3 -3
- package/src/runs/shared/subagent-prompt-runtime.ts +23 -5
- package/src/runs/shared/task-intent.ts +46 -13
- package/src/runs/shared/workflow-async-child-guidance.ts +18 -0
- package/src/runs/shared/worktree-cleanup-plan.ts +6 -3
- package/src/runs/shared/worktree-setup-command.ts +213 -0
- package/src/runs/shared/worktree.ts +437 -214
- package/src/shared/child-cache-retention.ts +43 -0
- package/src/shared/fork-context.ts +15 -72
- package/src/shared/launch-contract.ts +70 -8
- package/src/shared/model-response-aliases.ts +13 -0
- package/src/shared/opencode-session-headers.ts +30 -0
- package/src/shared/pruned-fork.ts +1 -1
- package/src/shared/required-child-extensions.ts +81 -0
- package/src/shared/settings.ts +5 -2
- package/src/shared/shortcuts.ts +0 -4
- package/src/shared/types.ts +164 -90
- package/src/shared/utils.ts +10 -2
- package/src/shared/watch-strategy.ts +2 -0
- package/src/shared/workflow-child-permit.ts +18 -13
- package/src/slash/delegation-adapters.ts +3 -1
- package/src/slash/delegation-request.ts +14 -0
- package/src/slash/slash-commands.ts +2 -7
- package/src/slash/subagents-admin.ts +31 -14
- package/src/tui/fleet-native-transcript.ts +50 -6
- package/src/tui/fleet-status.ts +165 -20
- package/src/tui/fleet.ts +52 -21
- package/src/tui/render.ts +210 -50
- package/src/watchdog/child-status.ts +28 -28
- package/src/watchdog/lsp-diagnostics.ts +1 -1
- package/src/watchdog/model-selection.ts +21 -1
- package/src/watchdog/permission-arbiter.ts +5 -2
- package/src/watchdog/register-child.ts +10 -2
- package/src/watchdog/register-main.ts +39 -35
- package/src/watchdog/render.ts +1 -1
- package/src/watchdog/review.ts +122 -74
- package/src/watchdog/rules.ts +1 -1
- package/src/watchdog/runtime.ts +100 -27
- package/src/watchdog/scope.ts +1 -1
- package/src/watchdog/settings.ts +3 -0
- package/src/watchdog/tool-actions.ts +13 -12
- package/src/watchdog/turn-delta.ts +23 -0
- package/src/watchdog/types.ts +5 -3
- package/src/watchdog/warning-format.ts +1 -1
- package/src/workflows/chat-progress.ts +3 -3
- package/src/workflows/scripted-workflow.ts +349 -26
- package/src/workflows/workflow-checklist.ts +17 -20
- package/src/workflows/workflow-child-summary.ts +57 -8
- package/src/workflows/workflow-preflight.ts +19 -19
- package/src/workflows/workflow-receipt.ts +24 -6
- package/src/workflows/workflow-resources.ts +108 -22
- package/src/workflows/workflow-settlement.ts +3 -0
- package/src/runs/shared/model-exclusions.ts +0 -373
- /package/src/inspectors/{herdr/shell-command.ts → shell-command.ts} +0 -0
|
@@ -30,9 +30,9 @@ import {
|
|
|
30
30
|
import { parseFrontmatter, parseFrontmatterList } from "./frontmatter.ts";
|
|
31
31
|
import { resolvePiLaunchToolPlan } from "../runs/shared/child-tool-plan.ts";
|
|
32
32
|
import { resolveEffectiveThinking, toModelInfo } from "../shared/model-info.ts";
|
|
33
|
-
import { resolveSubagentModelOverride, type ParentModel } from "../runs/shared/model-
|
|
33
|
+
import { resolveSubagentModelOverride, type ParentModel } from "../runs/shared/model-resolution.ts";
|
|
34
34
|
import { validateToolBudgetConfig } from "../runs/shared/tool-budget.ts";
|
|
35
|
-
import { validateAcceptanceInput } from "../runs/shared/acceptance.ts";
|
|
35
|
+
import { formatReviewGateLabel, validateAcceptanceInput } from "../runs/shared/acceptance.ts";
|
|
36
36
|
import { CODE_OWNED_EXTERNAL_CLI_ADAPTER_LABEL, isCodeOwnedExternalCliAdapterId, resolveExternalCliRunnerStatus, validateCodeOwnedProfileRunner } from "../runs/shared/external-cli-contract.ts";
|
|
37
37
|
import { resolveExternalCliBinaryAvailability, type ExternalCliBinaryAvailability } from "../runs/shared/external-cli-preflight.ts";
|
|
38
38
|
import type { AcceptanceInput, AgentCapabilitiesSnapshot, AgentCapabilityRow, Details, ExtensionConfig, ToolBudgetConfig } from "../shared/types.ts";
|
|
@@ -100,7 +100,7 @@ export type EjectAgentDefinitionResult =
|
|
|
100
100
|
|
|
101
101
|
type ManagementAction = "list" | "get" | "models" | "create" | "update" | "delete" | "eject" | "disable" | "enable" | "reset";
|
|
102
102
|
type ManagementScope = "user" | "project";
|
|
103
|
-
type ManagementContext = Pick<ExtensionContext, "cwd" | "modelRegistry"> & { isProjectTrusted?: ExtensionContext["isProjectTrusted"]; model?: ExtensionContext["model"]; config?: ExtensionConfig; currentSessionId?: string; runtimeAgentOwner?: RuntimeAgentOwner };
|
|
103
|
+
type ManagementContext = Pick<ExtensionContext, "cwd" | "modelRegistry"> & { isProjectTrusted?: ExtensionContext["isProjectTrusted"]; model?: ExtensionContext["model"]; config?: ExtensionConfig; currentSessionId?: string; runtimeAgentOwner?: RuntimeAgentOwner; onAgentsChanged?: () => void };
|
|
104
104
|
|
|
105
105
|
interface ManagementParams {
|
|
106
106
|
action?: string;
|
|
@@ -280,13 +280,6 @@ function modelWarning(ctx: ManagementContext, model: string | undefined): string
|
|
|
280
280
|
return `Warning: model '${model}' is not in the current model registry. Run subagent({ action: "models" }) to list valid provider/id selectors, then use the exact provider/id form (bare ids resolve only when unique).`;
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
function fallbackModelsWarning(ctx: ManagementContext, fallbackModels: string[] | undefined): string | undefined {
|
|
284
|
-
if (!fallbackModels || fallbackModels.length === 0) return undefined;
|
|
285
|
-
const available = new Set(ctx.modelRegistry.getAvailable().flatMap((m) => [`${m.provider}/${m.id}`, m.id]));
|
|
286
|
-
const missing = fallbackModels.filter((model) => !available.has(model));
|
|
287
|
-
return missing.length ? `Warning: fallback models not in the current model registry: ${missing.join(", ")}.` : undefined;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
283
|
function skillsWarning(cwd: string, agent: Pick<AgentConfig, "skills" | "skillPath" | "filePath">): string | undefined {
|
|
291
284
|
if (!agent.skills?.length) return undefined;
|
|
292
285
|
const { missing } = resolveSkills(
|
|
@@ -330,7 +323,6 @@ export function editableAgentConfig(agent: AgentConfig): AgentConfig {
|
|
|
330
323
|
outputMode: _outputMode,
|
|
331
324
|
defaultReads: _defaultReads,
|
|
332
325
|
model: _model,
|
|
333
|
-
fallbackModels: _fallbackModels,
|
|
334
326
|
fast: _fast,
|
|
335
327
|
thinking: _thinking,
|
|
336
328
|
systemPromptMode: _systemPromptMode,
|
|
@@ -367,7 +359,6 @@ export function editableAgentConfig(agent: AgentConfig): AgentConfig {
|
|
|
367
359
|
...(base.outputMode !== undefined ? { outputMode: base.outputMode } : {}),
|
|
368
360
|
...(base.defaultReads !== undefined ? { defaultReads: [...base.defaultReads] } : {}),
|
|
369
361
|
...(base.model !== undefined && hasDeclaredField("model") ? { model: base.model } : {}),
|
|
370
|
-
...(base.fallbackModels !== undefined ? { fallbackModels: [...base.fallbackModels] } : {}),
|
|
371
362
|
...(base.fast !== undefined ? { fast: base.fast } : {}),
|
|
372
363
|
...(base.thinking !== undefined && hasDeclaredField("thinking") ? { thinking: base.thinking } : {}),
|
|
373
364
|
systemPromptMode: base.systemPromptMode,
|
|
@@ -410,11 +401,11 @@ export function preservedAgentFrontmatterFields(agent: AgentConfig, cfg: Record<
|
|
|
410
401
|
if (hasKey(cfg, "name")) changed("name");
|
|
411
402
|
if (hasKey(cfg, "package")) changed("package");
|
|
412
403
|
if (hasKey(cfg, "description")) changed("description");
|
|
404
|
+
if (hasKey(cfg, "advertise")) changed("advertise");
|
|
413
405
|
if (hasKey(cfg, "aliases")) changed("alias", "aliases");
|
|
414
406
|
if (hasKey(cfg, "systemPrompt")) changed("systemPrompt");
|
|
415
407
|
if (hasKey(cfg, "runner")) changed("runner");
|
|
416
408
|
if (hasKey(cfg, "model")) changed("model");
|
|
417
|
-
if (hasKey(cfg, "fallbackModels")) changed("fallbackModels");
|
|
418
409
|
if (hasKey(cfg, "tools")) changed("tools");
|
|
419
410
|
if (hasKey(cfg, "excludeTools")) changed("excludeTools");
|
|
420
411
|
if (hasKey(cfg, "skills")) changed("skill", "skills");
|
|
@@ -479,6 +470,11 @@ function parseTools(raw: string): { tools?: string[]; mcpDirectTools?: string[]
|
|
|
479
470
|
}
|
|
480
471
|
|
|
481
472
|
function applyAgentConfig(target: AgentConfig, cfg: Record<string, unknown>): string | undefined {
|
|
473
|
+
if (hasKey(cfg, "advertise")) {
|
|
474
|
+
if (cfg.advertise === "") delete target.advertise;
|
|
475
|
+
else if (typeof cfg.advertise === "boolean") target.advertise = cfg.advertise;
|
|
476
|
+
else return "config.advertise must be a boolean or empty string when provided.";
|
|
477
|
+
}
|
|
482
478
|
if (hasKey(cfg, "aliases")) {
|
|
483
479
|
if (cfg.aliases === false || cfg.aliases === "") delete target.aliases;
|
|
484
480
|
else if (typeof cfg.aliases === "string") {
|
|
@@ -524,21 +520,7 @@ function applyAgentConfig(target: AgentConfig, cfg: Record<string, unknown>): st
|
|
|
524
520
|
else delete target.model;
|
|
525
521
|
} else return "config.model must be a string or false when provided.";
|
|
526
522
|
}
|
|
527
|
-
if (hasKey(cfg, "fallbackModels"))
|
|
528
|
-
if (cfg.fallbackModels === false || cfg.fallbackModels === "") delete target.fallbackModels;
|
|
529
|
-
else if (typeof cfg.fallbackModels === "string") {
|
|
530
|
-
const models = parseCsv(cfg.fallbackModels);
|
|
531
|
-
if (models.length) target.fallbackModels = models;
|
|
532
|
-
else delete target.fallbackModels;
|
|
533
|
-
} else if (Array.isArray(cfg.fallbackModels)) {
|
|
534
|
-
const models = cfg.fallbackModels
|
|
535
|
-
.filter((value): value is string => typeof value === "string")
|
|
536
|
-
.map((value) => value.trim())
|
|
537
|
-
.filter(Boolean);
|
|
538
|
-
if (models.length) target.fallbackModels = [...new Set(models)];
|
|
539
|
-
else delete target.fallbackModels;
|
|
540
|
-
} else return "config.fallbackModels must be a comma-separated string, string array, or false when provided.";
|
|
541
|
-
}
|
|
523
|
+
if (hasKey(cfg, "fallbackModels")) return "config.fallbackModels was removed; configure one model instead.";
|
|
542
524
|
if (hasKey(cfg, "tools")) {
|
|
543
525
|
if (cfg.tools === false || cfg.tools === "") { delete target.tools; delete target.mcpDirectTools; }
|
|
544
526
|
else if (typeof cfg.tools === "string") {
|
|
@@ -711,7 +693,6 @@ function applyAgentConfig(target: AgentConfig, cfg: Record<string, unknown>): st
|
|
|
711
693
|
target.tools?.length || target.mcpDirectTools?.length ? "tools" : undefined,
|
|
712
694
|
target.excludeTools?.length ? "excludeTools" : undefined,
|
|
713
695
|
target.model ? "model" : undefined,
|
|
714
|
-
target.fallbackModels?.length ? "fallbackModels" : undefined,
|
|
715
696
|
target.thinking ? "thinking" : undefined,
|
|
716
697
|
target.extensions?.length ? "extensions" : undefined,
|
|
717
698
|
target.subagentOnlyExtensions?.length ? "subagentOnlyExtensions" : undefined,
|
|
@@ -789,13 +770,19 @@ function externalJobProviderSuffix(provider: string, names: Set<string> | undefi
|
|
|
789
770
|
|
|
790
771
|
type ExternalCliAvailabilityByCommand = ReadonlyMap<string, ExternalCliBinaryAvailability>;
|
|
791
772
|
|
|
773
|
+
/** A placed agent checks only local ssh; machine catalog and remote CLI validation happen at launch. */
|
|
774
|
+
function externalCliAvailabilityKey(command: string, machine: string | undefined): string {
|
|
775
|
+
return machine ? `ssh@${machine}` : command;
|
|
776
|
+
}
|
|
777
|
+
|
|
792
778
|
function externalCliAvailabilityForAgents(agents: readonly AgentConfig[]): ExternalCliAvailabilityByCommand {
|
|
793
779
|
const availability = new Map<string, ExternalCliBinaryAvailability>();
|
|
794
780
|
for (const agent of agents) {
|
|
795
781
|
const runner = agent.runner;
|
|
796
|
-
if (runner?.type
|
|
797
|
-
|
|
798
|
-
|
|
782
|
+
if (runner?.type !== "external-cli") continue;
|
|
783
|
+
const key = externalCliAvailabilityKey(runner.command, agent.machine);
|
|
784
|
+
if (availability.has(key)) continue;
|
|
785
|
+
availability.set(key, resolveExternalCliBinaryAvailability(agent.machine ? "ssh" : runner.command, process.env));
|
|
799
786
|
}
|
|
800
787
|
return availability;
|
|
801
788
|
}
|
|
@@ -803,10 +790,13 @@ function externalCliAvailabilityForAgents(agents: readonly AgentConfig[]): Exter
|
|
|
803
790
|
function runnerListBadge(agent: AgentConfig, providerNames: Set<string> | undefined, externalCliAvailability?: ExternalCliAvailabilityByCommand): string | undefined {
|
|
804
791
|
if (agent.runner?.type === "external-job") return `external-job:${agent.runner.provider} ${externalJobProviderSuffix(agent.runner.provider, providerNames)}`;
|
|
805
792
|
if (agent.runner?.type === "external-cli") {
|
|
806
|
-
const
|
|
807
|
-
|
|
808
|
-
return `external-cli:${
|
|
793
|
+
const placed = agent.machine ? `${agent.runner.command} @ ${agent.machine}` : agent.runner.command;
|
|
794
|
+
const availability = externalCliAvailability?.get(externalCliAvailabilityKey(agent.runner.command, agent.machine));
|
|
795
|
+
if (!availability) return `external-cli:${placed}`;
|
|
796
|
+
if (agent.machine) return `external-cli:${placed} saved Herdr placement; transport ${availability.available ? "✓" : "missing"}; machine not preflighted`;
|
|
797
|
+
return `external-cli:${placed} ${availability.available ? "✓" : "missing"}`;
|
|
809
798
|
}
|
|
799
|
+
if (agent.machine) return `machine: ${agent.machine} (saved Herdr placement)`;
|
|
810
800
|
return undefined;
|
|
811
801
|
}
|
|
812
802
|
|
|
@@ -842,7 +832,39 @@ function formatAgentCapabilitiesLine(agent: AgentConfig, providerNames: Set<stri
|
|
|
842
832
|
if (agent.modelProvider && !agent.model.includes("/")) model = `${agent.modelProvider}/${agent.model}`;
|
|
843
833
|
}
|
|
844
834
|
const thinking = agent.thinking === false ? "off" : agent.thinking ?? "default";
|
|
845
|
-
|
|
835
|
+
const machine = agent.machine ? `; Machine: ${agent.machine} (saved Herdr placement)` : "";
|
|
836
|
+
const acceptance = formatAcceptanceSummary(agent);
|
|
837
|
+
return `- ${agent.name} (${agentListMetadata(agent, providerNames, externalCliAvailability)}): Description: ${previewDisplayText(agent.description, 240)}; Tools: ${tools}; Model: ${model}; Thinking: ${thinking}${machine}${acceptance ? `; ${acceptance}` : ""}`;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
function formatAcceptanceSummary(agent: AgentConfig): string | undefined {
|
|
841
|
+
const policy = agent.defaultAcceptance;
|
|
842
|
+
const summary: string[] = [];
|
|
843
|
+
if (policy === false) summary.push("Acceptance: disabled");
|
|
844
|
+
else if (typeof policy === "string") summary.push(`Acceptance: ${policy}`);
|
|
845
|
+
else if (policy) {
|
|
846
|
+
const modifiers = [
|
|
847
|
+
...(policy.evidence ?? []),
|
|
848
|
+
...(policy.verify ?? []).map((command) => `verify: ${formatAcceptanceDisplayLabel(command.id)}`),
|
|
849
|
+
...(policy.criteria?.length ? [`criteria: ${policy.criteria.length}`] : []),
|
|
850
|
+
...(policy.stopRules?.length ? [`stopRules: ${policy.stopRules.length}`] : []),
|
|
851
|
+
];
|
|
852
|
+
if (policy.review === false) modifiers.push("review: off");
|
|
853
|
+
else if (policy.review) {
|
|
854
|
+
const displayReview = policy.review.agent
|
|
855
|
+
? { ...policy.review, agent: formatAcceptanceDisplayLabel(policy.review.agent) }
|
|
856
|
+
: policy.review;
|
|
857
|
+
modifiers.push(`review: ${formatReviewGateLabel(displayReview)}`);
|
|
858
|
+
}
|
|
859
|
+
if (policy.report) modifiers.push(`report: ${policy.report}`);
|
|
860
|
+
summary.push(`Acceptance: ${policy.level ?? "auto"}${modifiers.length > 0 ? ` (${modifiers.join(", ")})` : ""}`);
|
|
861
|
+
}
|
|
862
|
+
if (agent.acceptanceRole) summary.push(`Acceptance role: ${agent.acceptanceRole}`);
|
|
863
|
+
return summary.length > 0 ? summary.join("; ") : undefined;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
function formatAcceptanceDisplayLabel(value: string): string {
|
|
867
|
+
return JSON.stringify(previewDisplayText(value, 80));
|
|
846
868
|
}
|
|
847
869
|
|
|
848
870
|
const EXTERNAL_JOB_CAPABILITIES = { stop: false, steer: false, resume: false, structuredOutput: false, toolEvents: false } as const;
|
|
@@ -856,11 +878,12 @@ function agentCapabilityRunner(agent: AgentConfig, providerNames: Set<string> |
|
|
|
856
878
|
const runner = agent.runner;
|
|
857
879
|
if (!runner || runner.type === "pi") return PI_AGENT_RUNNER;
|
|
858
880
|
if (runner.type === "external-cli") {
|
|
859
|
-
const availability = externalCliAvailability.get(runner.command)!;
|
|
881
|
+
const availability = externalCliAvailability.get(externalCliAvailabilityKey(runner.command, agent.machine))!;
|
|
860
882
|
return {
|
|
861
883
|
type: "external-cli",
|
|
862
884
|
adapter: runner.adapter,
|
|
863
885
|
command: runner.command,
|
|
886
|
+
...(agent.machine ? { machine: agent.machine } : {}),
|
|
864
887
|
...availability,
|
|
865
888
|
capabilities: resolveExternalCliRunnerStatus(runner).capabilities,
|
|
866
889
|
};
|
|
@@ -888,8 +911,9 @@ function agentCapabilityRow(agent: AgentConfig, options: { executable: boolean;
|
|
|
888
911
|
aliases: agent.aliases ? [...agent.aliases] : undefined,
|
|
889
912
|
runner: agentCapabilityRunner(agent, options.providerNames, options.externalCliAvailability),
|
|
890
913
|
tools: agentCapabilityTools(agent),
|
|
891
|
-
model: presentDetails({ value: agent.model,
|
|
914
|
+
model: presentDetails({ value: agent.model, thinking: agent.thinking }),
|
|
892
915
|
execution: presentDetails({ defaultAsync: agent.defaultAsync, timeoutMs: agent.defaultTimeoutMs }),
|
|
916
|
+
acceptance: presentDetails({ policy: agent.defaultAcceptance, role: agent.acceptanceRole }),
|
|
893
917
|
output: presentDetails({ path: agent.output, mode: agent.outputMode }),
|
|
894
918
|
extensions: presentDetails({ names: agent.extensions, subagentOnly: agent.subagentOnlyExtensions, skills: agent.skills }),
|
|
895
919
|
};
|
|
@@ -990,7 +1014,6 @@ function formatAgentDetail(agent: AgentConfig): string {
|
|
|
990
1014
|
}
|
|
991
1015
|
if (agent.aliases?.length) lines.push(`Aliases: ${agent.aliases.join(", ")}`);
|
|
992
1016
|
if (agent.model) lines.push(`Model: ${agent.model}`);
|
|
993
|
-
if (agent.fallbackModels?.length) lines.push(`Fallback models: ${agent.fallbackModels.join(", ")}`);
|
|
994
1017
|
if (tools.length) lines.push(`Tools: ${tools.join(", ")}`);
|
|
995
1018
|
if (agent.excludeTools?.length) lines.push(`Excluded tools: ${agent.excludeTools.join(", ")}`);
|
|
996
1019
|
if (agent.skills?.length) lines.push(`Skills: ${agent.skills.join(", ")}`);
|
|
@@ -1135,12 +1158,6 @@ function handleModels(params: ManagementParams, ctx: ManagementContext): AgentTo
|
|
|
1135
1158
|
lines.push(` ${resolvedModel ?? "(unresolved)"}`);
|
|
1136
1159
|
lines.push(`Source: ${source}`);
|
|
1137
1160
|
lines.push(`Thinking: ${effectiveThinking ?? "default"}`);
|
|
1138
|
-
if (agent.fallbackModels?.length) {
|
|
1139
|
-
lines.push("Fallback models:");
|
|
1140
|
-
for (const fallback of agent.fallbackModels) {
|
|
1141
|
-
lines.push(` ${resolveSubagentModelOverride(fallback, currentModel, availableModels, agent.modelProvider ?? preferredProvider) ?? fallback}`);
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
1161
|
if (agent.override) {
|
|
1145
1162
|
lines.push("Override file:");
|
|
1146
1163
|
lines.push(` ${agent.override.path}`);
|
|
@@ -1160,12 +1177,6 @@ function handleModels(params: ManagementParams, ctx: ManagementContext): AgentTo
|
|
|
1160
1177
|
lines.push(` ${resolvedModel ?? "(unresolved)"}`);
|
|
1161
1178
|
lines.push(` source: ${source}`);
|
|
1162
1179
|
lines.push(` thinking: ${effectiveThinking ?? "default"}`);
|
|
1163
|
-
if (agent.fallbackModels?.length) {
|
|
1164
|
-
lines.push(" fallback models:");
|
|
1165
|
-
for (const fallback of agent.fallbackModels) {
|
|
1166
|
-
lines.push(` ${resolveSubagentModelOverride(fallback, currentModel, availableModels, agent.modelProvider ?? preferredProvider) ?? fallback}`);
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
1180
|
if (agent.override) {
|
|
1170
1181
|
lines.push(" override file:");
|
|
1171
1182
|
lines.push(` ${agent.override.path}`);
|
|
@@ -1255,11 +1266,10 @@ export function handleCreate(params: ManagementParams, ctx: ManagementContext):
|
|
|
1255
1266
|
if (profileError) return result(profileError, true);
|
|
1256
1267
|
const mw = modelWarning(ctx, agent.model);
|
|
1257
1268
|
if (mw) warnings.push(mw);
|
|
1258
|
-
const fmw = fallbackModelsWarning(ctx, agent.fallbackModels);
|
|
1259
|
-
if (fmw) warnings.push(fmw);
|
|
1260
1269
|
const sw = skillsWarning(ctx.cwd, agent);
|
|
1261
1270
|
if (sw) warnings.push(sw);
|
|
1262
1271
|
fs.writeFileSync(targetPath, serializeAgent(agent), "utf-8");
|
|
1272
|
+
ctx.onAgentsChanged?.();
|
|
1263
1273
|
return result([`Created agent '${runtimeName}' at ${targetPath}.`, ...warnings].join("\n"));
|
|
1264
1274
|
}
|
|
1265
1275
|
|
|
@@ -1311,10 +1321,6 @@ export function handleUpdate(params: ManagementParams, ctx: ManagementContext):
|
|
|
1311
1321
|
const mw = modelWarning(ctx, updated.model);
|
|
1312
1322
|
if (mw) warnings.push(mw);
|
|
1313
1323
|
}
|
|
1314
|
-
if (hasKey(cfg, "fallbackModels")) {
|
|
1315
|
-
const fmw = fallbackModelsWarning(ctx, updated.fallbackModels);
|
|
1316
|
-
if (fmw) warnings.push(fmw);
|
|
1317
|
-
}
|
|
1318
1324
|
if (hasKey(cfg, "skills") || hasKey(cfg, "skillPath")) {
|
|
1319
1325
|
const sw = skillsWarning(ctx.cwd, updated);
|
|
1320
1326
|
if (sw) warnings.push(sw);
|
|
@@ -1325,6 +1331,7 @@ export function handleUpdate(params: ManagementParams, ctx: ManagementContext):
|
|
|
1325
1331
|
updated.filePath = renamed.filePath!;
|
|
1326
1332
|
}
|
|
1327
1333
|
fs.writeFileSync(updated.filePath, serializeAgent(updated, { preserveFrontmatterFields }), "utf-8");
|
|
1334
|
+
ctx.onAgentsChanged?.();
|
|
1328
1335
|
const headline = updated.name === oldName
|
|
1329
1336
|
? `Updated agent '${updated.name}' at ${updated.filePath}.`
|
|
1330
1337
|
: `Updated agent '${oldName}' to '${updated.name}' at ${updated.filePath}.`;
|
|
@@ -1338,6 +1345,7 @@ function handleDelete(params: ManagementParams, ctx: ManagementContext): AgentTo
|
|
|
1338
1345
|
if ("content" in targetOrError) return targetOrError;
|
|
1339
1346
|
const target = targetOrError;
|
|
1340
1347
|
fs.unlinkSync(target.filePath);
|
|
1348
|
+
ctx.onAgentsChanged?.();
|
|
1341
1349
|
return result(`Deleted agent '${target.name}' at ${target.filePath}.`);
|
|
1342
1350
|
}
|
|
1343
1351
|
|
|
@@ -1624,6 +1632,7 @@ function handleEject(params: ManagementParams, ctx: ManagementContext): AgentToo
|
|
|
1624
1632
|
// must supply affirmative project trust themselves.
|
|
1625
1633
|
...(scope === "project" ? { projectTrusted: true } : {}),
|
|
1626
1634
|
});
|
|
1635
|
+
if (ejected.ok) ctx.onAgentsChanged?.();
|
|
1627
1636
|
return result(ejected.message, !ejected.ok);
|
|
1628
1637
|
}
|
|
1629
1638
|
|
|
@@ -1646,6 +1655,7 @@ function handleDisable(params: ManagementParams, ctx: ManagementContext): AgentT
|
|
|
1646
1655
|
const settingsPath = mergeBuiltinAgentOverride(ctx.cwd, runtimeName, scope, { disabled: true });
|
|
1647
1656
|
const after = resolveEffectiveAgent(discoverAgentsAll(ctx.cwd), raw).agent;
|
|
1648
1657
|
if (after?.disabled === true) {
|
|
1658
|
+
ctx.onAgentsChanged?.();
|
|
1649
1659
|
return result(`Disabled agent '${runtimeName}' via ${scope} settings override at ${settingsPath}. It is now hidden from runtime discovery and { action: "list" }.`);
|
|
1650
1660
|
}
|
|
1651
1661
|
return result(`Wrote a disabled override for '${runtimeName}' at ${settingsPath}, but the agent is still enabled. A higher-precedence ${after?.override?.scope ?? "project"} override is likely winning. Try agentScope: '${after?.override?.scope ?? "project"}'.`, true);
|
|
@@ -1670,6 +1680,7 @@ function handleEnable(params: ManagementParams, ctx: ManagementContext): AgentTo
|
|
|
1670
1680
|
const { path: settingsPath, removed } = removeBuiltinAgentOverrideFields(ctx.cwd, runtimeName, scope, ["disabled"]);
|
|
1671
1681
|
const after = resolveEffectiveAgent(discoverAgentsAll(ctx.cwd), raw).agent;
|
|
1672
1682
|
if (after && after.disabled !== true) {
|
|
1683
|
+
if (removed) ctx.onAgentsChanged?.();
|
|
1673
1684
|
if (removed) return result(`Enabled agent '${runtimeName}' (removed disabled override at ${settingsPath}).`);
|
|
1674
1685
|
return result(`Agent '${runtimeName}' is already enabled.`);
|
|
1675
1686
|
}
|
|
@@ -1705,8 +1716,8 @@ function handleReset(params: ManagementParams, ctx: ManagementContext): AgentToo
|
|
|
1705
1716
|
fs.unlinkSync(custom.filePath);
|
|
1706
1717
|
lines.push(`Deleted custom ${scope} agent file at ${custom.filePath}.`);
|
|
1707
1718
|
}
|
|
1708
|
-
const overrideRemoval = removeBuiltinAgentOverride(ctx.cwd, runtimeName, scope);
|
|
1709
|
-
if (overrideRemoval.removed) lines.push(
|
|
1719
|
+
const overrideRemoval = removeBuiltinAgentOverride(ctx.cwd, runtimeName, scope, { preserveMachine: true });
|
|
1720
|
+
if (overrideRemoval.removed) lines.push(`${overrideRemoval.machinePreserved ? "Cleared customization in" : "Removed"} ${scope} settings override at ${overrideRemoval.path}.${overrideRemoval.machinePreserved ? " Retained machine placement." : ""}`);
|
|
1710
1721
|
if (lines.length === 0) {
|
|
1711
1722
|
const otherScope = scope === "user" ? "project" : "user";
|
|
1712
1723
|
const otherCustom = (otherScope === "user" ? d.user : d.project).find((a) => a.name === raw || a.name === sanitized);
|
|
@@ -1717,6 +1728,7 @@ function handleReset(params: ManagementParams, ctx: ManagementContext): AgentToo
|
|
|
1717
1728
|
return result(`Agent '${runtimeName}' has no ${scope} customization to reset.${note} It is at its bundled ${bundled.source} default.`);
|
|
1718
1729
|
}
|
|
1719
1730
|
lines.push(`Reset agent '${runtimeName}' to its bundled ${bundled.source} default.`);
|
|
1731
|
+
ctx.onAgentsChanged?.();
|
|
1720
1732
|
return result(lines.join("\n"));
|
|
1721
1733
|
}
|
|
1722
1734
|
|
|
@@ -6,13 +6,13 @@ export const KNOWN_FIELDS = new Set([
|
|
|
6
6
|
"name",
|
|
7
7
|
"package",
|
|
8
8
|
"description",
|
|
9
|
+
"advertise",
|
|
9
10
|
"alias",
|
|
10
11
|
"aliases",
|
|
11
12
|
"tools",
|
|
12
13
|
"excludeTools",
|
|
13
14
|
"allowNestedSubagents",
|
|
14
15
|
"model",
|
|
15
|
-
"fallbackModels",
|
|
16
16
|
"fast",
|
|
17
17
|
"thinking",
|
|
18
18
|
"systemPromptMode",
|
|
@@ -31,8 +31,10 @@ export const KNOWN_FIELDS = new Set([
|
|
|
31
31
|
"extensions",
|
|
32
32
|
"subagentOnlyExtensions",
|
|
33
33
|
"mutationTools",
|
|
34
|
+
"machine",
|
|
34
35
|
"output",
|
|
35
36
|
"outputMode",
|
|
37
|
+
"outputSchema",
|
|
36
38
|
"defaultReads",
|
|
37
39
|
"defaultProgress",
|
|
38
40
|
"injectToContext",
|
|
@@ -65,6 +67,7 @@ export function serializeAgent(config: AgentConfig, options: SerializeAgentOptio
|
|
|
65
67
|
lines.push(`name: ${frontmatterNameForConfig(config)}`);
|
|
66
68
|
if (config.packageName) lines.push(`package: ${config.packageName}`);
|
|
67
69
|
lines.push(`description: ${config.description}`);
|
|
70
|
+
if (config.advertise === true || preserve("advertise")) lines.push(`advertise: ${config.advertise === true ? "true" : "false"}`);
|
|
68
71
|
const aliasesValue = joinComma(config.aliases);
|
|
69
72
|
if (aliasesValue || preserve("alias", "aliases")) lines.push(`aliases: ${aliasesValue ?? ""}`);
|
|
70
73
|
|
|
@@ -81,8 +84,6 @@ export function serializeAgent(config: AgentConfig, options: SerializeAgentOptio
|
|
|
81
84
|
}
|
|
82
85
|
|
|
83
86
|
if (config.model || preserve("model")) lines.push(`model: ${config.model ?? ""}`);
|
|
84
|
-
const fallbackModelsValue = joinComma(config.fallbackModels);
|
|
85
|
-
if (fallbackModelsValue || preserve("fallbackModels")) lines.push(`fallbackModels: ${fallbackModelsValue ?? ""}`);
|
|
86
87
|
if (config.fast === true || preserve("fast")) lines.push(`fast: ${config.fast === undefined ? "" : config.fast ? "true" : "false"}`);
|
|
87
88
|
if ((config.thinking && (config.thinking !== "off" || preserve("thinking"))) || (!config.thinking && preserve("thinking"))) {
|
|
88
89
|
lines.push(`thinking: ${config.thinking ?? ""}`);
|
|
@@ -128,8 +129,10 @@ export function serializeAgent(config: AgentConfig, options: SerializeAgentOptio
|
|
|
128
129
|
const mutationToolsValue = joinComma(config.mutationTools);
|
|
129
130
|
if (mutationToolsValue || preserve("mutationTools")) lines.push(`mutationTools: ${mutationToolsValue ?? ""}`);
|
|
130
131
|
|
|
132
|
+
if (config.machine || preserve("machine")) lines.push(`machine: ${config.machine ?? ""}`);
|
|
131
133
|
if (config.output || preserve("output")) lines.push(`output: ${config.output ?? ""}`);
|
|
132
134
|
if (config.outputMode || preserve("outputMode")) lines.push(`outputMode: ${config.outputMode ?? ""}`);
|
|
135
|
+
if (config.outputSchema || preserve("outputSchema")) lines.push(`outputSchema: ${config.outputSchema ? JSON.stringify(config.outputSchema) : ""}`);
|
|
133
136
|
|
|
134
137
|
const readsValue = joinComma(config.defaultReads);
|
|
135
138
|
if (readsValue || preserve("defaultReads")) lines.push(`defaultReads: ${readsValue ?? ""}`);
|