@marcoscale98/pi-extensible-workflows 5.19.1-fork.1 → 6.2.1-fork.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.
Files changed (123) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/README.md +2 -2
  3. package/dist/src/agent-execution.d.ts +43 -10
  4. package/dist/src/agent-execution.js +365 -127
  5. package/dist/src/background-widget.d.ts +0 -1
  6. package/dist/src/background-widget.js +4 -9
  7. package/dist/src/decoders.d.ts +2 -3
  8. package/dist/src/decoders.js +33 -37
  9. package/dist/src/execution.d.ts +2 -0
  10. package/dist/src/execution.js +5 -5
  11. package/dist/src/host-delivery.js +4 -8
  12. package/dist/src/host-navigator.js +5 -2
  13. package/dist/src/host-phases.d.ts +1 -0
  14. package/dist/src/host-recovery.d.ts +6 -6
  15. package/dist/src/host-recovery.js +14 -22
  16. package/dist/src/host-runtime.js +56 -5
  17. package/dist/src/host-view.d.ts +1 -1
  18. package/dist/src/host-view.js +17 -15
  19. package/dist/src/host.js +62 -87
  20. package/dist/src/index.d.ts +1 -2
  21. package/dist/src/index.js +1523 -1630
  22. package/dist/src/index.js.map +3 -3
  23. package/dist/src/paths.d.ts +7 -6
  24. package/dist/src/paths.js +24 -15
  25. package/dist/src/persistence.d.ts +1 -0
  26. package/dist/src/persistence.js +1 -0
  27. package/dist/src/pi-runtime-runner.js +4 -1
  28. package/dist/src/registry.d.ts +9 -7
  29. package/dist/src/registry.js +28 -70
  30. package/dist/src/runtime/agent-runner.d.ts +2 -0
  31. package/dist/src/session-lease.d.ts +1 -1
  32. package/dist/src/session-lease.js +45 -11
  33. package/dist/src/settings.d.ts +6 -3
  34. package/dist/src/settings.js +36 -47
  35. package/dist/src/store.d.ts +3 -1
  36. package/dist/src/store.js +17 -1
  37. package/dist/src/trajectory.d.ts +0 -1
  38. package/dist/src/trajectory.js +2 -3
  39. package/dist/src/types.d.ts +100 -44
  40. package/dist/src/types.js +4 -7
  41. package/dist/src/utils.d.ts +3 -2
  42. package/dist/src/utils.js +20 -10
  43. package/dist/src/validation.d.ts +8 -2
  44. package/dist/src/validation.js +122 -86
  45. package/dist/starter/index.js +8 -9
  46. package/dist/starter/index.js.map +1 -1
  47. package/dist/starter/review-loop.js +8 -7
  48. package/dist/subagents/index.js +654 -814
  49. package/dist/subagents/index.js.map +3 -3
  50. package/dist/subagents/src/contracts.d.ts +4 -3
  51. package/dist/subagents/src/contracts.js +2 -2
  52. package/dist/subagents/src/index.d.ts +1 -1
  53. package/dist/subagents/src/index.js +1 -2
  54. package/dist/subagents/src/manager.js +49 -70
  55. package/dist/subagents/src/navigator.js +3 -14
  56. package/dist/subagents/src/view.d.ts +0 -1
  57. package/dist/subagents/src/view.js +2 -16
  58. package/dist/subagents/src/worktree.js +1 -1
  59. package/dist/trajectory/assets/index.html +8 -8
  60. package/dist/trajectory/index.js +487 -891
  61. package/dist/trajectory/index.js.map +3 -3
  62. package/dist/trajectory/src/assets/index.html +8 -8
  63. package/dist/trajectory/src/index.js +126 -86
  64. package/dist/trajectory/src/server.js +264 -25
  65. package/dist/trajectory/src/server.js.map +3 -3
  66. package/dist/trajectory/src/startup-mutex.d.ts +17 -0
  67. package/dist/trajectory/src/startup-mutex.js +172 -0
  68. package/examples/workflow-extension-template/README.md +4 -7
  69. package/examples/workflow-extension-template/extension.test.mjs +4 -8
  70. package/examples/workflow-extension-template/index.js +0 -3
  71. package/package.json +5 -5
  72. package/skills/pi-extensible-workflows/SKILL.md +10 -8
  73. package/src/agent-execution.ts +339 -127
  74. package/src/background-widget.ts +4 -10
  75. package/src/decoders.ts +31 -37
  76. package/src/execution.ts +5 -5
  77. package/src/host-delivery.ts +4 -8
  78. package/src/host-navigator.ts +4 -2
  79. package/src/host-phases.ts +1 -1
  80. package/src/host-recovery.ts +20 -26
  81. package/src/host-runtime.ts +44 -6
  82. package/src/host-view.ts +18 -11
  83. package/src/host.ts +62 -113
  84. package/src/index.ts +1 -2
  85. package/src/paths.ts +18 -12
  86. package/src/persistence.ts +1 -0
  87. package/src/pi-runtime-runner.ts +3 -1
  88. package/src/registry.ts +27 -63
  89. package/src/runtime/agent-runner.ts +2 -0
  90. package/src/session-lease.ts +34 -6
  91. package/src/settings.ts +35 -47
  92. package/src/store.ts +18 -2
  93. package/src/trajectory.ts +2 -4
  94. package/src/types.ts +71 -30
  95. package/src/utils.ts +18 -9
  96. package/src/validation.ts +102 -79
  97. package/starter/index.ts +0 -1
  98. package/starter/review-loop.ts +8 -7
  99. package/starter/roles/developer.md +0 -1
  100. package/starter/roles/oracle.md +0 -1
  101. package/starter/roles/researcher.md +0 -1
  102. package/starter/roles/reviewer.md +0 -1
  103. package/starter/roles/scout.md +0 -1
  104. package/subagents/README.md +8 -14
  105. package/subagents/src/contracts.ts +3 -4
  106. package/subagents/src/index.ts +2 -3
  107. package/subagents/src/manager.ts +45 -125
  108. package/subagents/src/navigator.ts +4 -13
  109. package/subagents/src/view.ts +4 -14
  110. package/subagents/src/worktree.ts +1 -1
  111. package/trajectory/src/assets/index.html +8 -8
  112. package/trajectory/src/index.ts +106 -82
  113. package/trajectory/src/server.ts +44 -8
  114. package/trajectory/src/startup-mutex.ts +127 -0
  115. package/dist/src/roles.d.ts +0 -70
  116. package/dist/src/roles.js +0 -326
  117. package/dist/starter/roles/developer.md +0 -6
  118. package/dist/starter/roles/oracle.md +0 -18
  119. package/dist/starter/roles/researcher.md +0 -20
  120. package/dist/starter/roles/reviewer.md +0 -19
  121. package/dist/starter/roles/scout.md +0 -18
  122. package/examples/workflow-extension-template/roles/reviewer.md +0 -4
  123. package/src/roles.ts +0 -327
package/CHANGELOG.md CHANGED
@@ -1,6 +1,83 @@
1
1
  # Changelog
2
2
  ## Unreleased
3
3
 
4
+ ## [6.2.1] - 2026-10-13
5
+
6
+ ### New capabilities
7
+
8
+ - Registered functions can create persistent agent handles with `context.agent.create({ name, ... })` and `handle.send(...)`, with the same rules as scripts. Handle journal identity is scoped by function invocation, branch, worktree, and name. The bundled `reviewLoop` now uses one persistent developer and a fresh reviewer each iteration.
9
+
10
+ ### Fixes
11
+
12
+ - Trajectory displays agent and system prompts as complete escaped plain text, so XML-style sections such as `<addendum>`, `<skills>`, and `<project_context>` remain visible instead of being interpreted as HTML inside Markdown. Browser regressions verify line breaks and safe rendering.
13
+ - `agent(...)` and `handle.send(...)` now deliver the supplied text as the whole user message, on first and later turns. The repeated Workflow/Agent/Phase/Parent header, ownership paragraph, and `Task:` wrapper are gone. The `workflow_result` once-per-turn contract moved into that tool's description, child ownership into the `agent` tool description, and retry or soft-budget notes into separate control text after the task (a steered message on local sessions, appended to the pane launch prompt on Herdr; custom transports that do not set `turnControlDelivered` get the steered message). The system prompt is unchanged, so prompt caching is unaffected.
14
+
15
+ ### Documentation and metadata
16
+
17
+ - Clarified that the workflow `model` option is optional; omitting it uses the configured defaults.
18
+ - Updated the core package description and keywords to include codemode scripts.
19
+
20
+ ## [6.2.0] - 2026-10-10
21
+
22
+ ### New capabilities
23
+
24
+ - Selecting a phase or registered function in the workflow navigator now shows total tokens, cost, and elapsed time across all its agents, including nested agents (#318).
25
+
26
+ ### Fixes
27
+
28
+ - Launch now checks static agent calls inside registered functions that the script calls by name, so an unknown model for a later agent fails before the workflow starts. A computed `outputSchema` no longer makes a call dynamic (#309).
29
+ - On Linux, session lease liveness uses the process start time from `/proc/<pid>/stat` instead of the `/proc/<pid>` entry time, so a live session owner is no longer reported dead (#307).
30
+ - In the wide workflow navigator, the details column follows the scrolled tree, so details for a selected node further down a long workflow stay visible (#317).
31
+ - Model references keep colon-bearing and namespaced model IDs, such as `openrouter/deepseek/deepseek-v4.1-flash:nitro:high`. The final `:` segment is read as a thinking level only when it names one, so `provider/model:turbo` now fails as `INVALID_METADATA` instead of `UNKNOWN_MODEL` (#314).
32
+ - Concurrent Trajectory starts in one agent directory now share one server whose lock always names the process answering `/health`. A lock whose owner is alive but does not answer within the startup budget, or a lock that cannot be read, is kept and the attach fails with a clear error, instead of a second server being started beside it. Process liveness is checked against the kernel start time, not the `/proc` entry time, and Trajectory sends SIGKILL only to a process whose recorded start time still matches; a stale server that cannot be confirmed stopped keeps its lock and fails the attach (#315).
33
+
34
+ ## [6.1.0] - 2026-10-08
35
+
36
+ **This minor version contains breaking changes.** Shipping them as 6.1.0 shortly after 6.0.0 is an explicit operator choice, not a SemVer-compliant version. Read the migration notes before upgrading.
37
+
38
+ ### Breaking changes
39
+
40
+ - Roles are now interpreted only by the explicitly enabled optional `@piewf/pi-ext-roles` extension. Core and CLI have no roles dependency, discovery, typed role fields, `/roles` export, `pi-role` bridge or legacy role paths. Without the plugin, unknown agent options are opaque JSON and ignored. The five fallback roles belong to the independent package.
41
+ - Generic `agentPreparationHooks` optionally validate original options with a schema, then prepare concrete configuration before model/resource validation. Workflow agents, handles, nested agents, standalone subagents and doctor share preparation and root/parent capability enforcement. Consumer selectors remain ordered defaults, not extra authorization ceilings.
42
+ - New runs freeze generic prepared configurations before dispatch. Workflow identity version 6 and standalone configuration version 1 reject previous formats without migration. Retry/resume reuse configuration; new identities resolve current settings. Extension code and skill/AGENTS/SYSTEM/APPEND bytes are reread, not frozen.
43
+ - Doctor uses `--agent-options <json>` and `agentInspection`, not role targets or `--role`. Bundles require explicit plugin resources/dependencies instead of role inference. Obsolete compatibility upgrade/warning checks are removed; generic and extension-owned regressions plus the local paired SDK/CLI harness replace their still-relevant coverage.
44
+ - Role descriptions append to Pi's structured prompt channel, preserving existing append instructions and dynamic provider/tool prefixes (#311); they never force the entire system prompt.
45
+
46
+ ### Migration
47
+
48
+ - To keep using `role` options, install `@piewf/pi-ext-roles` 0.2.0 or newer and enable it explicitly as a Pi extension next to workflows. Core and CLI no longer install or load it.
49
+ - Roles and shared settings are read only from the roles package paths: `~/.pi/agent/pi-ext-roles/{settings.json,roles/}` and authorized project `.pi/pi-ext-roles/{settings.json,roles/}`. Legacy workflow role paths are ignored; move files manually, nothing is rewritten.
50
+ - Runs persisted before 6.1.0 cannot be resumed or retried. Finish them before upgrading, then relaunch them as new runs.
51
+ - Role text is appended through Pi's structured system-prompt append channel. Only roles with `overrideSystemPrompt: true` replace the base prompt.
52
+ - `pi-role` is owned only by the independent `@piewf/pi-ext-roles` package, which works without workflows. Upgrade an old global `@piewf/cli` first; never overwrite the binary with `--force`.
53
+ - Prepared options stay bounded by root and parent tool ceilings, project trust and `excludeTools`; setup hooks cannot change the agent cwd.
54
+
55
+ ### Fixes
56
+
57
+ - Restored pre-6 behavior: `excludeTools` for workflow, nested and standalone agents, also in the `agent` and `subagents_run` tool schemas (exact names as in Pi, applied after preparation, bounded by parent ceilings and frozen with each logical agent's configuration; patterns and `workflow_result` are rejected, unknown names warn); `resources_discover` skills for root, nested and standalone agents, attributed per resource generation with Pi's path normalization; static preparation failures, including unavailable models and unknown roles, fail before shell, tool or run effects; nested children keep core error codes and their parent's structural scope under their own identity; unrelated extension load failures are CLI warnings; bundled factories run without a Pi API again and keep their module source.
58
+ - Launch inspection covers only completely static agent options (handles only when no send adds options) and stops on cancellation, also after the session lease. Nested children are new spawns of their parent's attempt, with identities per parent spawn: after retry or cold resume they prepare against current configuration.
59
+ - After a CLI extension load failure, every workflow registration must declare a `source` that is a loaded extension entry or a portable bundle module, or the CLI stops before running anything (a factory may register and then fail). Agent options that no such preparation hook declares in its `optionsSchema` fail with `INVALID_METADATA` instead of being ignored, also after paused resume, cold resume or retry. Setup hooks cannot reintroduce an excluded or outside-ceiling root tool as a same-named custom tool, and `excludeTools` names, own or inherited, also remove custom tools of those names.
60
+ - Preparation context adds `projectCwd` and `defaults.dynamicModelAliasNames`, so plugins can read launch-project configuration inside worktrees and order dynamic aliases below their own static aliases. A paused run resumed after an alias change prepares new agents with the refreshed aliases. A hook passing on a virtual `workflow/<alias>` root model gets its physical target.
61
+ - Setup hooks still cannot change the agent cwd, including to a project subdirectory; `SessionInput.cwd` is now read-only. This deliberate deviation from pre-6 prevents loading another directory's trust, settings and `.pi` resources.
62
+
63
+ ## [6.0.0] - 2026-10-07
64
+
65
+ ### Breaking changes
66
+
67
+ - Roles are owned by `@piewf/pi-ext-roles`, now a registry dependency of core and CLI. `registerWorkflowExtension({ roleDirectories })` is removed and fails with migration guidance. Register packaged roles separately with `registerRoleContribution(pi, { owner: import.meta.url, roleDirectories: ["./roles"] })`; keep workflow `source` for provenance and re-export portable bundles that used the removed field.
68
+ - The `pi-role` binary moves from `@piewf/cli` to `@piewf/pi-ext-roles`. Upgrade the old global CLI first, then install the roles package without forced binary overwrites. The retained `@piewf/cli/pi-role` import is a compatibility adapter, not the binary owner.
69
+ - Fallback roles no longer select models or supply workflow-specific model aliases. Configure a per-call model or an overriding role/shared alias explicitly when preserving an old fallback model choice.
70
+
71
+ ### Migration
72
+
73
+ - Workflow/subagent users receive the roles library automatically; a separately enabled roles plugin is not required. Move shared roles and settings to `~/.pi/agent/pi-ext-roles/` and `.pi/pi-ext-roles/` when ready. Workflow aliases/selectors remain consumer overrides. No user files are rewritten.
74
+ - Legacy workflow role paths and parser/resolver imports remain temporarily supported, with one TUI migration warning per session when applicable. No compatibility removal date is scheduled. Native `pi-role` does not read legacy workflow paths; migrate its files before using it.
75
+ - Native `pi-role` starts one Pi process from PATH. Role tool selectors control declared loadout, not a sandbox. Native tool flags remain ceilings; partial context scopes are unsupported unless suppressed with `--no-context-files`, and role/shared `extensionSettings` are ignored by the launcher. Workflow/subagent consumers retain settings delivery, partial context filtering, captured configuration, recovery and runtime ownership. See the [migration guide](https://vekexasia.github.io/pi-extensible-workflows/roles.html#migration).
76
+
77
+ ### Verification
78
+
79
+ - Package verification uses the published roles artifact, without a sibling checkout or local dependency staging. `scripts/verify-role-upgrade.py` exercises registry installation in an isolated Pi, the `5.19.1` to major-candidate upgrade, TUI/reload, legacy settings and role precedence, binary handover, migrated contributors and re-exported bundles against a local provider.
80
+
4
81
  ## [5.19.1] - 2026-10-05
5
82
 
6
83
  ### New capabilities
package/README.md CHANGED
@@ -11,7 +11,7 @@ The repository [README](https://github.com/vekexasia/pi-extensible-workflows#rea
11
11
  ## Install
12
12
 
13
13
  Requires Node.js 22.19 or newer. This is trusted Pi host code with the same filesystem and process access as Pi.
14
- The core installation includes workflow orchestration, the `reviewLoop` starter for implementation-and-review cycles, packaged `developer`/`reviewer`/`scout`/`oracle`/`researcher` roles with ready-made slash commands (`/scout`, `/oracle`, `/review`, `/parallel-review`, `/review-loop`, `/deep-research`, and more), and durable standalone subagent tools. See the [Subagents guide](https://vekexasia.github.io/pi-extensible-workflows/subagents.html) for the bundled tools.
14
+ The core installation includes workflow orchestration, the `reviewLoop` starter for implementation-and-review cycles, ready-made slash commands (`/scout`, `/oracle`, `/review`, `/parallel-review`, `/review-loop`, `/deep-research`, and more), and durable standalone subagent tools. Role options in starters and slash commands require the separately enabled `@piewf/pi-ext-roles` Pi extension; core does not ship or interpret roles. See the [Subagents guide](https://vekexasia.github.io/pi-extensible-workflows/subagents.html) for the bundled tools.
15
15
  Trajectory live monitoring is included in the package. Restart existing Pi processes after upgrading the package so their publisher protocol matches the detached Trajectory server.
16
16
 
17
17
  ```sh
@@ -35,7 +35,7 @@ Launch with a non-empty `name` and exactly one of `script` or `scriptPath`. Regi
35
35
 
36
36
  ## Programmatic integration
37
37
 
38
- The package exports the workflow registry, runtime, persistence, validation, settings, role, lifecycle, and local Pi session APIs used by trusted hosts and extensions.
38
+ The package exports the workflow registry, runtime, persistence, validation, settings, generic agent preparation, lifecycle, and local Pi session APIs used by trusted hosts and extensions.
39
39
 
40
40
  Direct consumers of `createLocalPiSession()` receive a session with extensions already bound. Always `await session.dispose()` so `session_shutdown` runs before the native session is released; disposal is idempotent.
41
41
 
@@ -85,18 +85,17 @@ export interface PiResourceInspection {
85
85
  }[];
86
86
  readonly systemPromptSource?: string;
87
87
  }
88
- import type { AgentAccounting, AgentActivity, AgentContinuity, AgentIdentity, AgentResourcePolicy, AgentResourceSelectors, AgentSetup, AgentSetupSummary, AgentTransport, AgentTransportContext, ContextFileScope, JsonSchema, JsonValue, LiveSessionHandoff, ModelSpec, PreparedAgentSession, RegisteredAgentSetupHook, SessionInput, WorkflowAgentSession, WorkflowAgentSessionReference, WorkflowAgentSessionState, WorkflowExtensionSettings, WorkflowExtensionSettingsValidatorContext, WorkflowRunContext } from "./types.js";
89
- import { type AgentDefinition, type AgentState } from "./types.js";
88
+ import type { AgentPreparationContext, PreparedAgentConfiguration, RegisteredAgentPreparationHook, AgentAccounting, AgentActivity, AgentContinuity, AgentIdentity, AgentResourcePolicy, AgentResourceSelectors, AgentSetup, AgentSetupSummary, AgentTransport, AgentTransportContext, ContextFileScope, JsonSchema, JsonValue, LiveSessionHandoff, ModelSpec, PreparedAgentSession, RegisteredAgentSetupHook, SessionInput, WorkflowAgentSession, WorkflowAgentSessionReference, WorkflowAgentSessionState, WorkflowExtensionSettings, WorkflowExtensionSettingsValidatorContext, WorkflowRunContext } from "./types.js";
89
+ import { type AgentState } from "./types.js";
90
90
  import type { RunStore } from "./persistence.js";
91
- type AgentExecutionRunStore = Pick<RunStore, "recordSystemPrompt" | "validateWorktree" | "worktree" | "snapshotWorktree">;
92
- export type { AgentAccounting, AgentActivity, AgentInspectionMode, AgentSetup, AgentSetupContext, AgentSetupHook, AgentTransport, AgentTransportContext, PiRuntimeLaunchInfo, PreparedAgentSession, RegisteredAgentSetupHook, SessionInput, WorkflowAgentMessage, WorkflowAgentSession, WorkflowAgentSessionEvent, WorkflowAgentSessionReference, WorkflowAgentSessionState, WorkflowAgentSessionStats, WorkflowAgentTurnResult } from "./types.js";
91
+ type AgentExecutionRunStore = Pick<RunStore, "recordSystemPrompt" | "validateWorktree" | "worktree" | "snapshotWorktree"> & Partial<Pick<RunStore, "load" | "saveAgentConfiguration">>;
92
+ export type { AgentPreparation, AgentPreparationContext, PreparedAgentConfiguration, RegisteredAgentPreparationHook, AgentAccounting, AgentActivity, AgentInspectionMode, AgentSetup, AgentSetupContext, AgentSetupHook, AgentTransport, AgentTransportContext, PiRuntimeLaunchInfo, PreparedAgentSession, RegisteredAgentSetupHook, SessionInput, WorkflowAgentMessage, WorkflowAgentSession, WorkflowAgentSessionEvent, WorkflowAgentSessionReference, WorkflowAgentSessionState, WorkflowAgentSessionStats, WorkflowAgentTurnResult } from "./types.js";
93
93
  export interface AgentBudgetHooks {
94
94
  beforeAttempt(): void;
95
95
  beforeTurn(): void;
96
96
  afterTurn(accounting: AgentAccounting, final: boolean): void;
97
97
  instruction(): string | undefined;
98
98
  }
99
- export type { AgentDefinition } from "./types.js";
100
99
  export interface AgentProviderFailure {
101
100
  label: string;
102
101
  provider: string;
@@ -122,7 +121,6 @@ export interface AgentExecutionOptions {
122
121
  skills?: readonly string[];
123
122
  extensions?: readonly string[];
124
123
  effectiveTools?: readonly string[];
125
- role?: string;
126
124
  contextFiles?: readonly ContextFileScope[];
127
125
  schema?: JsonSchema;
128
126
  retries?: number;
@@ -136,31 +134,53 @@ export interface AgentExecutionOptions {
136
134
  agentIdentity?: AgentIdentity;
137
135
  inheritedExtensionSettings?: Readonly<WorkflowExtensionSettings>;
138
136
  agentNodeId?: string;
137
+ capabilities?: Readonly<{
138
+ tools: readonly string[];
139
+ skills: readonly string[];
140
+ extensions: readonly string[];
141
+ }>;
142
+ parentSkills?: readonly string[];
143
+ /** Tool names that ancestors excluded; with this agent's own `excludeTools`, they are removed from root and custom tools alike. */
144
+ inheritedExcludeTools?: readonly string[];
145
+ projectTrusted?: boolean;
146
+ configuration?: PreparedAgentConfiguration;
147
+ onConfiguration?: (configuration: PreparedAgentConfiguration) => void | Promise<void>;
139
148
  }
140
149
  export interface AgentExecutionRoot {
150
+ projectTrusted?: boolean;
141
151
  cwd: string;
142
152
  model: ModelSpec;
143
153
  tools: ReadonlySet<string>;
144
154
  extensionSettings?: Readonly<WorkflowExtensionSettings> | undefined;
145
155
  validateExtensionSettings?: (settings: Readonly<WorkflowExtensionSettings> | undefined, context: WorkflowExtensionSettingsValidatorContext) => void;
146
156
  onAgentSettings?: (agentNodeId: string, settings: Readonly<WorkflowExtensionSettings>) => void;
157
+ onAgentCapabilities?: (agentNodeId: string, capabilities: AgentPreparationContext["capabilities"], projectTrusted: boolean) => void;
147
158
  resourceSelectors?: AgentResourceSelectors;
148
- agentDefinitions?: Readonly<Record<string, AgentDefinition>>;
149
159
  agentDir?: string;
150
160
  additionalSkillPaths?: readonly string[];
151
161
  availableModels?: ReadonlySet<string>;
152
162
  knownModels?: ReadonlySet<string>;
153
163
  modelAliases?: Readonly<Record<string, string>>;
164
+ dynamicModelAliasNames?: readonly string[];
154
165
  blockedAliases?: ReadonlySet<string>;
155
166
  blockedAliasTargets?: Readonly<Record<string, string>>;
156
167
  settingsPath?: string;
157
168
  extensionSettingsPath?: string;
158
169
  runStore?: AgentExecutionRunStore;
159
170
  providerPause?: () => Promise<void>;
171
+ agentPreparationHooks?: readonly RegisteredAgentPreparationHook[];
160
172
  agentSetupHooks?: readonly RegisteredAgentSetupHook[];
161
173
  agentResourcePolicy?: () => AgentResourcePolicy | Promise<AgentResourcePolicy>;
162
174
  runContext?: Readonly<WorkflowRunContext>;
163
175
  onResourceWarning?: (message: string) => void;
176
+ /**
177
+ * Load failures this host tolerated and the identities of the extensions it did load. With failures, a non-core option
178
+ * counts as owned only by the schema of a preparation hook whose `source` is a loaded extension; others fail closed.
179
+ */
180
+ extensionLoad?: Readonly<{
181
+ errors: readonly string[];
182
+ loaded: readonly string[];
183
+ }>;
164
184
  }
165
185
  export interface AgentToolCallProgress {
166
186
  id: string;
@@ -222,7 +242,6 @@ export declare function getAgentAttempts(error: unknown): readonly AgentAttempt[
222
242
  export declare class WorkflowAgentExecutor {
223
243
  private readonly root;
224
244
  private readonly transport;
225
- private readonly warnedRoleTools;
226
245
  constructor(root: AgentExecutionRoot, transport?: AgentTransport);
227
246
  setRunContext(runContext: Readonly<WorkflowRunContext>): void;
228
247
  resolve(options: AgentExecutionOptions, inheritedTools?: readonly string[]): {
@@ -233,6 +252,7 @@ export declare class WorkflowAgentExecutor {
233
252
  systemPromptAppend: string;
234
253
  contextFiles?: readonly ContextFileScope[];
235
254
  };
255
+ prepare(options: AgentExecutionOptions, cwd?: string, signal?: AbortSignal, mode?: "execution" | "inspection"): Promise<PreparedAgentConfiguration>;
236
256
  execute(task: string, options: AgentExecutionOptions, signal?: AbortSignal, customTools?: readonly ToolDefinition[], setSteer?: (handler: (message: string) => void | Promise<void>) => void, beforeRetry?: () => void): Promise<AgentExecutionResult>;
237
257
  }
238
258
  export interface ScheduledAgentOptions {
@@ -245,7 +265,6 @@ export interface ScheduledAgentOptions {
245
265
  extensions?: readonly string[];
246
266
  worktreeOwner?: string;
247
267
  model?: string;
248
- role?: string;
249
268
  contextFiles?: readonly ContextFileScope[];
250
269
  schema?: JsonSchema;
251
270
  retries?: number;
@@ -255,6 +274,14 @@ export interface ScheduledAgentOptions {
255
274
  agentOptions?: Readonly<Record<string, JsonValue>>;
256
275
  agentIdentity?: AgentIdentity;
257
276
  extensionSettings?: Readonly<WorkflowExtensionSettings>;
277
+ capabilities?: Readonly<{
278
+ tools: readonly string[];
279
+ skills: readonly string[];
280
+ extensions: readonly string[];
281
+ }>;
282
+ projectTrusted?: boolean;
283
+ configuration?: PreparedAgentConfiguration;
284
+ inheritedExcludeTools?: readonly string[];
258
285
  }
259
286
  export type ScheduledAgentResult = {
260
287
  id: string;
@@ -297,7 +324,11 @@ type ScheduledNode = {
297
324
  resolveCompletion: () => void;
298
325
  task: () => Promise<void>;
299
326
  restored: boolean;
327
+ attemptCapabilities?: AgentPreparationContext["capabilities"];
328
+ attemptProjectTrusted?: boolean;
300
329
  steer?: (message: string) => void | Promise<void>;
330
+ /** Children spawned so far per label; numbers the occurrence of each child's own identity. */
331
+ childOccurrences?: Map<string, number>;
301
332
  };
302
333
  export type OwnershipRecord = {
303
334
  id: string;
@@ -317,6 +348,8 @@ export declare class FairAgentScheduler {
317
348
  addRun(runId: string, limit?: number, beforeLaunch?: () => void, extensionSettings?: Readonly<WorkflowExtensionSettings>): void;
318
349
  updateRunLimit(runId: string, limit: number): void;
319
350
  setRunExtensionSettings(runId: string, settings: Readonly<WorkflowExtensionSettings> | undefined): void;
351
+ setConfiguration(agentId: string, configuration: PreparedAgentConfiguration): Promise<void>;
352
+ setAttemptCapabilities(agentId: string, capabilities: AgentPreparationContext["capabilities"], projectTrusted: boolean): void;
320
353
  setExtensionSettings(agentId: string, settings: Readonly<WorkflowExtensionSettings>): void;
321
354
  spawn(runId: string, prompt: string, options: ScheduledAgentOptions, parentId?: string): {
322
355
  id: string;
@@ -331,7 +364,7 @@ export declare class FairAgentScheduler {
331
364
  attemptStarted(id: string): void;
332
365
  cancelRun(runId: string): Promise<void>;
333
366
  removeRun(runId: string): void;
334
- toolsFor(parentId: string, resolveTools?: (role: string | undefined, tools: readonly string[] | undefined, model: string | undefined, inheritedTools: readonly string[], skills: readonly string[] | undefined, extensions: readonly string[] | undefined) => readonly string[]): ToolDefinition[];
367
+ toolsFor(parentId: string): ToolDefinition[];
335
368
  snapshot(): readonly OwnershipRecord[];
336
369
  restoreRun(runId: string, limit: number, ownership: readonly OwnershipRecord[], beforeLaunch?: () => void, extensionSettings?: Readonly<WorkflowExtensionSettings>): void;
337
370
  flush(runId?: string): Promise<void>;