@timmyjl12/pi-subagents 0.0.0-stage → 0.21.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 +862 -0
- package/CONTRIBUTING.md +72 -0
- package/LICENSE +21 -0
- package/README.md +1125 -3
- package/SECURITY.md +97 -0
- package/dist/abortable.d.ts +12 -0
- package/dist/abortable.js +42 -0
- package/dist/active-agents-prompt.d.ts +40 -0
- package/dist/active-agents-prompt.js +98 -0
- package/dist/advisor-status.d.ts +16 -0
- package/dist/advisor-status.js +74 -0
- package/dist/agent-color.d.ts +35 -0
- package/dist/agent-color.js +131 -0
- package/dist/agent-file-toggle.d.ts +125 -0
- package/dist/agent-file-toggle.js +264 -0
- package/dist/agent-manager.d.ts +872 -0
- package/dist/agent-manager.js +2910 -0
- package/dist/agent-runner.d.ts +358 -0
- package/dist/agent-runner.js +1219 -0
- package/dist/agent-types.d.ts +142 -0
- package/dist/agent-types.js +315 -0
- package/dist/awaited-result.d.ts +37 -0
- package/dist/awaited-result.js +150 -0
- package/dist/child-context.d.ts +15 -0
- package/dist/child-context.js +181 -0
- package/dist/child-session-shutdown.d.ts +21 -0
- package/dist/child-session-shutdown.js +97 -0
- package/dist/cleanup-plans.d.ts +10 -0
- package/dist/cleanup-plans.js +112 -0
- package/dist/context.d.ts +12 -0
- package/dist/context.js +56 -0
- package/dist/cross-extension-rpc.d.ts +73 -0
- package/dist/cross-extension-rpc.js +192 -0
- package/dist/custom-agents.d.ts +79 -0
- package/dist/custom-agents.js +583 -0
- package/dist/default-agents.d.ts +7 -0
- package/dist/default-agents.js +125 -0
- package/dist/enabled-models.d.ts +49 -0
- package/dist/enabled-models.js +145 -0
- package/dist/env.d.ts +6 -0
- package/dist/env.js +28 -0
- package/dist/error-log.d.ts +64 -0
- package/dist/error-log.js +176 -0
- package/dist/force-main-model.d.ts +21 -0
- package/dist/force-main-model.js +28 -0
- package/dist/goal-bridge.d.ts +155 -0
- package/dist/goal-bridge.js +305 -0
- package/dist/group-join.d.ts +36 -0
- package/dist/group-join.js +161 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.js +6390 -0
- package/dist/invocation-config.d.ts +164 -0
- package/dist/invocation-config.js +158 -0
- package/dist/memory.d.ts +53 -0
- package/dist/memory.js +165 -0
- package/dist/mention-clone.d.ts +87 -0
- package/dist/mention-clone.js +178 -0
- package/dist/mention.d.ts +81 -0
- package/dist/mention.js +131 -0
- package/dist/model-resolver.d.ts +36 -0
- package/dist/model-resolver.js +95 -0
- package/dist/model-scope.d.ts +49 -0
- package/dist/model-scope.js +48 -0
- package/dist/nested-tools.d.ts +76 -0
- package/dist/nested-tools.js +393 -0
- package/dist/output-diagnostics.d.ts +11 -0
- package/dist/output-diagnostics.js +64 -0
- package/dist/output-file.d.ts +64 -0
- package/dist/output-file.js +351 -0
- package/dist/prompts.d.ts +61 -0
- package/dist/prompts.js +94 -0
- package/dist/recovery.d.ts +56 -0
- package/dist/recovery.js +341 -0
- package/dist/report-cleanup.d.ts +204 -0
- package/dist/report-cleanup.js +1632 -0
- package/dist/report-store.d.ts +738 -0
- package/dist/report-store.js +3612 -0
- package/dist/schedule-store.d.ts +52 -0
- package/dist/schedule-store.js +240 -0
- package/dist/schedule.d.ts +121 -0
- package/dist/schedule.js +420 -0
- package/dist/settings.d.ts +388 -0
- package/dist/settings.js +268 -0
- package/dist/skill-loader.d.ts +24 -0
- package/dist/skill-loader.js +93 -0
- package/dist/standalone-fallback.d.ts +30 -0
- package/dist/standalone-fallback.js +239 -0
- package/dist/status-note.d.ts +61 -0
- package/dist/status-note.js +85 -0
- package/dist/structured-output.d.ts +61 -0
- package/dist/structured-output.js +112 -0
- package/dist/terminal-progress.d.ts +115 -0
- package/dist/terminal-progress.js +206 -0
- package/dist/types.d.ts +411 -0
- package/dist/types.js +5 -0
- package/dist/ui/agent-mention.d.ts +82 -0
- package/dist/ui/agent-mention.js +187 -0
- package/dist/ui/agent-widget.d.ts +304 -0
- package/dist/ui/agent-widget.js +770 -0
- package/dist/ui/cleanup-preview.d.ts +59 -0
- package/dist/ui/cleanup-preview.js +466 -0
- package/dist/ui/conversation-viewer.d.ts +105 -0
- package/dist/ui/conversation-viewer.js +544 -0
- package/dist/ui/fleet-list.d.ts +183 -0
- package/dist/ui/fleet-list.js +494 -0
- package/dist/ui/fleet-overlay.d.ts +203 -0
- package/dist/ui/fleet-overlay.js +887 -0
- package/dist/ui/hub-feed.d.ts +52 -0
- package/dist/ui/hub-feed.js +148 -0
- package/dist/ui/native-transcript.d.ts +33 -0
- package/dist/ui/native-transcript.js +234 -0
- package/dist/ui/schedule-menu.d.ts +16 -0
- package/dist/ui/schedule-menu.js +94 -0
- package/dist/ui/select-item.d.ts +27 -0
- package/dist/ui/select-item.js +34 -0
- package/dist/ui/tool-progress.d.ts +22 -0
- package/dist/ui/tool-progress.js +56 -0
- package/dist/ui/viewer-keys.d.ts +20 -0
- package/dist/ui/viewer-keys.js +17 -0
- package/dist/ui/workflow-card.d.ts +175 -0
- package/dist/ui/workflow-card.js +332 -0
- package/dist/ui/workflow-dialog.d.ts +305 -0
- package/dist/ui/workflow-dialog.js +848 -0
- package/dist/ui/workflow-menu.d.ts +60 -0
- package/dist/ui/workflow-menu.js +147 -0
- package/dist/usage.d.ts +147 -0
- package/dist/usage.js +147 -0
- package/dist/workflow/collisions.d.ts +95 -0
- package/dist/workflow/collisions.js +88 -0
- package/dist/workflow/entry.d.ts +32 -0
- package/dist/workflow/entry.js +29 -0
- package/dist/workflow/host.d.ts +65 -0
- package/dist/workflow/host.js +477 -0
- package/dist/workflow/journal.d.ts +113 -0
- package/dist/workflow/journal.js +177 -0
- package/dist/workflow/json-schema.d.ts +51 -0
- package/dist/workflow/json-schema.js +111 -0
- package/dist/workflow/meta.d.ts +67 -0
- package/dist/workflow/meta.js +317 -0
- package/dist/workflow/progress.d.ts +224 -0
- package/dist/workflow/progress.js +361 -0
- package/dist/workflow/runtime.d.ts +373 -0
- package/dist/workflow/runtime.js +919 -0
- package/dist/workflow/saved.d.ts +90 -0
- package/dist/workflow/saved.js +203 -0
- package/dist/workflow/task.d.ts +145 -0
- package/dist/workflow/task.js +213 -0
- package/dist/workflow/tool-description.d.ts +43 -0
- package/dist/workflow/tool-description.js +204 -0
- package/dist/workflow/worker-source.d.ts +47 -0
- package/dist/workflow/worker-source.js +778 -0
- package/dist/worktree.d.ts +52 -0
- package/dist/worktree.js +164 -0
- package/dist/xml.d.ts +10 -0
- package/dist/xml.js +12 -0
- package/docs/DEVELOPMENT.md +40 -0
- package/docs/artifacts.md +93 -0
- package/docs/recovery.md +62 -0
- package/docs/rpc.md +252 -0
- package/docs/runtime-performance.md +53 -0
- package/docs/workflows.md +467 -0
- package/examples/agent-tool-description.md +43 -0
- package/examples/workflows/compose.js +51 -0
- package/examples/workflows/fan-out-audit.js +47 -0
- package/examples/workflows/gated-fix.js +60 -0
- package/examples/workflows/lib/count-child.js +27 -0
- package/examples/workflows/review-panel.js +66 -0
- package/examples/workflows/structured-findings.js +78 -0
- package/package.json +75 -6
- package/src/abortable.ts +43 -0
- package/src/active-agents-prompt.ts +115 -0
- package/src/advisor-status.ts +74 -0
- package/src/agent-color.ts +169 -0
- package/src/agent-file-toggle.ts +273 -0
- package/src/agent-manager.ts +3312 -0
- package/src/agent-runner.ts +1500 -0
- package/src/agent-types.ts +390 -0
- package/src/awaited-result.ts +187 -0
- package/src/child-context.ts +173 -0
- package/src/child-session-shutdown.ts +114 -0
- package/src/cleanup-plans.ts +112 -0
- package/src/context.ts +58 -0
- package/src/cross-extension-rpc.ts +257 -0
- package/src/custom-agents.ts +689 -0
- package/src/default-agents.ts +129 -0
- package/src/enabled-models.ts +180 -0
- package/src/env.ts +33 -0
- package/src/error-log.ts +202 -0
- package/src/force-main-model.ts +29 -0
- package/src/goal-bridge.ts +468 -0
- package/src/group-join.ts +188 -0
- package/src/index.ts +6856 -0
- package/src/invocation-config.ts +276 -0
- package/src/memory.ts +179 -0
- package/src/mention-clone.ts +221 -0
- package/src/mention.ts +141 -0
- package/src/model-resolver.ts +118 -0
- package/src/model-scope.ts +70 -0
- package/src/nested-tools.ts +553 -0
- package/src/output-diagnostics.ts +68 -0
- package/src/output-file.ts +380 -0
- package/src/prompts.ts +151 -0
- package/src/recovery.ts +320 -0
- package/src/report-cleanup.ts +2044 -0
- package/src/report-store.ts +4130 -0
- package/src/schedule-store.ts +244 -0
- package/src/schedule.ts +450 -0
- package/src/settings.ts +632 -0
- package/src/skill-loader.ts +102 -0
- package/src/standalone-fallback.ts +195 -0
- package/src/status-note.ts +90 -0
- package/src/structured-output.ts +130 -0
- package/src/terminal-progress.ts +215 -0
- package/src/types.ts +424 -0
- package/src/ui/agent-mention.ts +216 -0
- package/src/ui/agent-widget.ts +866 -0
- package/src/ui/cleanup-preview.ts +518 -0
- package/src/ui/conversation-viewer.ts +527 -0
- package/src/ui/fleet-list.ts +563 -0
- package/src/ui/fleet-overlay.ts +1048 -0
- package/src/ui/hub-feed.ts +179 -0
- package/src/ui/native-transcript.ts +224 -0
- package/src/ui/schedule-menu.ts +105 -0
- package/src/ui/select-item.ts +45 -0
- package/src/ui/tool-progress.ts +67 -0
- package/src/ui/viewer-keys.ts +39 -0
- package/src/ui/workflow-card.ts +470 -0
- package/src/ui/workflow-dialog.ts +1119 -0
- package/src/ui/workflow-menu.ts +193 -0
- package/src/usage.ts +217 -0
- package/src/workflow/collisions.ts +123 -0
- package/src/workflow/entry.ts +47 -0
- package/src/workflow/host.ts +524 -0
- package/src/workflow/journal.ts +221 -0
- package/src/workflow/json-schema.ts +128 -0
- package/src/workflow/meta.ts +325 -0
- package/src/workflow/progress.ts +550 -0
- package/src/workflow/runtime.ts +1342 -0
- package/src/workflow/saved.ts +217 -0
- package/src/workflow/task.ts +313 -0
- package/src/workflow/tool-description.ts +205 -0
- package/src/workflow/worker-source.ts +781 -0
- package/src/worktree.ts +205 -0
- package/src/xml.ts +13 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* collisions.ts — deciding what to do when another extension already offers a
|
|
3
|
+
* workflow tool.
|
|
4
|
+
*
|
|
5
|
+
* Workflows are on by default, so this extension can be the *second*
|
|
6
|
+
* orchestrator in a session rather than the only one. Two workflow tools in one
|
|
7
|
+
* spec is worse than either alone: the model has to guess which to call, and
|
|
8
|
+
* pays for both descriptions to find out. The other extension was installed
|
|
9
|
+
* deliberately; a default of ours should not compete with it.
|
|
10
|
+
*
|
|
11
|
+
* ## What counts as a conflict
|
|
12
|
+
*
|
|
13
|
+
* An exact name match against {@link FOREIGN_WORKFLOW_TOOL_NAMES}, from a tool
|
|
14
|
+
* that is not ours. Exact and not a substring on purpose: `Workflow` is a
|
|
15
|
+
* common word in tool names that have nothing to do with orchestration
|
|
16
|
+
* (`github_workflow_run`, `list_workflows`), and silently disabling the feature
|
|
17
|
+
* against one of those would be a bug nobody could see.
|
|
18
|
+
*
|
|
19
|
+
* Two shapes, both decided here:
|
|
20
|
+
*
|
|
21
|
+
* 1. **A foreign tool took our name.** Registration is first-wins across
|
|
22
|
+
* extensions (`getAllRegisteredTools` skips a name it already has), and the
|
|
23
|
+
* winner also overwrites a built-in of the same name. Nothing throws, and
|
|
24
|
+
* there is no tool-conflict diagnostic the way there is for shortcuts. Ours
|
|
25
|
+
* never reached the registry, so there is nothing to withdraw — but the rest
|
|
26
|
+
* of the feature (the menu, the CLI flag) is still live and would drive a
|
|
27
|
+
* tool the model cannot call. It comes down with it.
|
|
28
|
+
* 2. **A foreign tool sits beside ours** under a different name, typically
|
|
29
|
+
* Claude Code's bare `Workflow`. Both are registered and both are offered.
|
|
30
|
+
* That one the caller can actually withdraw — `withdraw` says so.
|
|
31
|
+
*
|
|
32
|
+
* Only one direction of case 1 is detectable. If ours registered first, the
|
|
33
|
+
* other extension's tool is the one dropped, and pi exposes no way to see a
|
|
34
|
+
* tool that lost — the registry keeps winners only.
|
|
35
|
+
*
|
|
36
|
+
* Split from the acting half deliberately: everything here is a pure function
|
|
37
|
+
* of the tool list, so the policy can be tested without a host that can be made
|
|
38
|
+
* to register a competing extension. The caller owns `getAllTools`, the notify
|
|
39
|
+
* and the `setActiveTools` — see `resolveWorkflowCollisions` in index.ts.
|
|
40
|
+
*/
|
|
41
|
+
import { SUBAGENT_TOOL_NAMES } from "../agent-runner.js";
|
|
42
|
+
/**
|
|
43
|
+
* Tool names that mean "another extension already orchestrates subagents".
|
|
44
|
+
*
|
|
45
|
+
* Our own name, because pi resolves a duplicate registration silently, and
|
|
46
|
+
* Claude Code's bare `Workflow`, because a port of that tool is what a second
|
|
47
|
+
* workflow extension most likely calls itself. Lowercase `workflow` is the same
|
|
48
|
+
* tool by pi convention: it is what `@quintinshaw/pi-dynamic-workflows`
|
|
49
|
+
* registers, and the match here is exact, so the case has to be listed by hand.
|
|
50
|
+
*/
|
|
51
|
+
export const FOREIGN_WORKFLOW_TOOL_NAMES = new Set([
|
|
52
|
+
SUBAGENT_TOOL_NAMES.WORKFLOW,
|
|
53
|
+
"Workflow",
|
|
54
|
+
"workflow",
|
|
55
|
+
]);
|
|
56
|
+
/**
|
|
57
|
+
* Decide, from the registered tools alone.
|
|
58
|
+
*
|
|
59
|
+
* `ownDescription` identifies our own registration: this extension does not
|
|
60
|
+
* know its install path, and the description is the one field that is certainly
|
|
61
|
+
* ours. `pinned` is an explicit `workflowsEnabled` — a default yields to
|
|
62
|
+
* evidence, a choice does not.
|
|
63
|
+
*/
|
|
64
|
+
export function decideWorkflowCollision(input) {
|
|
65
|
+
const foreign = input.tools.find(tool => FOREIGN_WORKFLOW_TOOL_NAMES.has(tool.name) && tool.description !== input.ownDescription);
|
|
66
|
+
if (foreign === undefined)
|
|
67
|
+
return { kind: "none" };
|
|
68
|
+
const source = foreign.sourceInfo?.source ?? "unknown source";
|
|
69
|
+
const tookOurName = foreign.name === SUBAGENT_TOOL_NAMES.WORKFLOW;
|
|
70
|
+
if (input.pinned) {
|
|
71
|
+
if (!tookOurName)
|
|
72
|
+
return { kind: "none" };
|
|
73
|
+
return {
|
|
74
|
+
kind: "report",
|
|
75
|
+
message: `Another extension (${source}) already registers a "${SUBAGENT_TOOL_NAMES.WORKFLOW}" tool. ` +
|
|
76
|
+
"Pi keeps the first registration, so this extension's workflow tool is not offered to the " +
|
|
77
|
+
"model. Disable one of the two.",
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
kind: "standDown",
|
|
82
|
+
message: `Another extension (${source}) already provides a "${foreign.name}" tool, so this extension's ` +
|
|
83
|
+
"workflows are disabled for this session to avoid offering the model two orchestrators. " +
|
|
84
|
+
'Set `"workflowsEnabled": true` in .pi/subagents.json to keep both.',
|
|
85
|
+
// Case 1: ours never reached the registry, so there is nothing to withdraw.
|
|
86
|
+
withdraw: !tookOurName,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* entry.ts — what a finished workflow leaves behind in the session transcript.
|
|
3
|
+
*
|
|
4
|
+
* A workflow started from `--subagents-workflow-file` has no tool call to hang
|
|
5
|
+
* its result card on, so it appends a custom session entry instead. That entry
|
|
6
|
+
* has to survive a reload, which is why this is a plain-JSON snapshot rather
|
|
7
|
+
* than the live {@link WorkflowTask}: the task holds an `AbortController`, the
|
|
8
|
+
* script source and the run's control handle, none of which belongs in a
|
|
9
|
+
* session file.
|
|
10
|
+
*
|
|
11
|
+
* Deliberately free of any renderer import. The card this data renders through
|
|
12
|
+
* lives in `ui/workflow-card.ts` (`renderWorkflowEntryCard`), so the shape a
|
|
13
|
+
* session file stores does not depend on the code that draws it.
|
|
14
|
+
*/
|
|
15
|
+
import type { WorkflowMeta } from "./meta.ts";
|
|
16
|
+
import type { WorkflowEntry, WorkflowRunStatus } from "./progress.ts";
|
|
17
|
+
import type { WorkflowTask } from "./task.ts";
|
|
18
|
+
/** `customType` of the session entry a flag-launched workflow renders through. */
|
|
19
|
+
export declare const WORKFLOW_ENTRY_TYPE = "subagents:workflow";
|
|
20
|
+
/** The persisted snapshot of a settled run. */
|
|
21
|
+
export interface WorkflowEntryData {
|
|
22
|
+
name: string;
|
|
23
|
+
status: WorkflowRunStatus;
|
|
24
|
+
startTime: number;
|
|
25
|
+
endTime?: number;
|
|
26
|
+
progress: WorkflowEntry[];
|
|
27
|
+
agentCount: number;
|
|
28
|
+
totalTokens: number;
|
|
29
|
+
meta?: WorkflowMeta;
|
|
30
|
+
}
|
|
31
|
+
/** Snapshot a settled task for {@link WORKFLOW_ENTRY_TYPE}. */
|
|
32
|
+
export declare function workflowEntryData(task: WorkflowTask): WorkflowEntryData;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* entry.ts — what a finished workflow leaves behind in the session transcript.
|
|
3
|
+
*
|
|
4
|
+
* A workflow started from `--subagents-workflow-file` has no tool call to hang
|
|
5
|
+
* its result card on, so it appends a custom session entry instead. That entry
|
|
6
|
+
* has to survive a reload, which is why this is a plain-JSON snapshot rather
|
|
7
|
+
* than the live {@link WorkflowTask}: the task holds an `AbortController`, the
|
|
8
|
+
* script source and the run's control handle, none of which belongs in a
|
|
9
|
+
* session file.
|
|
10
|
+
*
|
|
11
|
+
* Deliberately free of any renderer import. The card this data renders through
|
|
12
|
+
* lives in `ui/workflow-card.ts` (`renderWorkflowEntryCard`), so the shape a
|
|
13
|
+
* session file stores does not depend on the code that draws it.
|
|
14
|
+
*/
|
|
15
|
+
/** `customType` of the session entry a flag-launched workflow renders through. */
|
|
16
|
+
export const WORKFLOW_ENTRY_TYPE = "subagents:workflow";
|
|
17
|
+
/** Snapshot a settled task for {@link WORKFLOW_ENTRY_TYPE}. */
|
|
18
|
+
export function workflowEntryData(task) {
|
|
19
|
+
return {
|
|
20
|
+
name: task.workflowName ?? task.id,
|
|
21
|
+
status: task.status,
|
|
22
|
+
startTime: task.startTime,
|
|
23
|
+
endTime: task.endTime,
|
|
24
|
+
progress: task.workflowProgress,
|
|
25
|
+
agentCount: task.agentCount,
|
|
26
|
+
totalTokens: task.totalTokens,
|
|
27
|
+
...(task.meta !== undefined ? { meta: task.meta } : {}),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* host.ts — binds a workflow run to the real `AgentManager`.
|
|
3
|
+
*
|
|
4
|
+
* `runtime.ts` deliberately knows nothing about this extension: its only seam is
|
|
5
|
+
* the injected {@link WorkflowHost}, which is what keeps the runtime's tests
|
|
6
|
+
* free of sessions, models and git. This file is the other half of that seam —
|
|
7
|
+
* everything the script can reach through `agent()`, `resume` and `gate` ends up
|
|
8
|
+
* here, and nowhere else.
|
|
9
|
+
*
|
|
10
|
+
* Four mappings carry most of the weight:
|
|
11
|
+
*
|
|
12
|
+
* - **ids.** The runtime hands out its own `wf-agent-N` handles before
|
|
13
|
+
* anything spawns, because it needs a stable progress-entry identity. The
|
|
14
|
+
* manager issues a different id when the child actually starts. `records`
|
|
15
|
+
* is the translation, and it is kept for the whole run rather than cleared
|
|
16
|
+
* on completion: `resume` reaches back to a child that has already
|
|
17
|
+
* finished.
|
|
18
|
+
* - **agent type and model.** Resolved through `resolveSpawnType` and
|
|
19
|
+
* `resolveAgentInvocationConfig` — the same dispatch and the same
|
|
20
|
+
* pin-outranks-call precedence the `Agent` tool uses — so a workflow and a
|
|
21
|
+
* tool call use the same pin precedence. Unresolved pins and unconfigured
|
|
22
|
+
* economical defaults fail rather than inherit the parent's model;
|
|
23
|
+
* deliberately selected twins/custom roles remain supported.
|
|
24
|
+
* - **failure.** A strict worktree-isolation failure throws out of
|
|
25
|
+
* `spawnAndWait`; the script must see that as an agent that failed
|
|
26
|
+
* (`{ok: false}` → `null`), not as an unhandled rejection that takes the
|
|
27
|
+
* run down.
|
|
28
|
+
* - **when a `gate` runs.** For an isolated child it cannot wait until the
|
|
29
|
+
* spawn resolves: the manager commits the worktree to a branch and deletes
|
|
30
|
+
* the copy inside the child's own settle, so by then the only tree left to
|
|
31
|
+
* run `npm test` in is the main one — which would report on code the child
|
|
32
|
+
* never wrote. So the gate runs from `onBeforeWorktreeCleanup`, inside that
|
|
33
|
+
* settle, and the verdict travels back on the spawn result. `runGate` still
|
|
34
|
+
* exists for a child that had no worktree; the runtime uses whichever of
|
|
35
|
+
* the two happened, never both.
|
|
36
|
+
*/
|
|
37
|
+
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
38
|
+
import type { AgentManager } from "../agent-manager.ts";
|
|
39
|
+
import type { WorkflowHost } from "./runtime.ts";
|
|
40
|
+
/**
|
|
41
|
+
* Wall-clock bound on a `gate` command. Generous — a gate is routinely a test
|
|
42
|
+
* suite — but not unbounded: `pi.exec` reports a timeout as `killed`, and a
|
|
43
|
+
* gate that hangs forever would wedge the agent slot it is holding.
|
|
44
|
+
*/
|
|
45
|
+
export declare const DEFAULT_GATE_TIMEOUT_MS: number;
|
|
46
|
+
export interface WorkflowHostOptions {
|
|
47
|
+
pi: ExtensionAPI;
|
|
48
|
+
ctx: ExtensionContext;
|
|
49
|
+
manager: AgentManager;
|
|
50
|
+
/** The run's abort signal, so killing the workflow kills its children. */
|
|
51
|
+
signal?: AbortSignal;
|
|
52
|
+
/** Groups child transcripts under the parent session. */
|
|
53
|
+
rootSessionId?: string;
|
|
54
|
+
/**
|
|
55
|
+
* The run id every child is stamped with.
|
|
56
|
+
*
|
|
57
|
+
* What makes them the workflow's rather than the session's: stamped children
|
|
58
|
+
* are filtered out of the fleet list, the widget, the `/agents` menus and
|
|
59
|
+
* `@handle` resolution, and they take no `maxConcurrent` slot. The run
|
|
60
|
+
* reports for them, and it has its own concurrency cap.
|
|
61
|
+
*/
|
|
62
|
+
workflowId?: string;
|
|
63
|
+
gateTimeoutMs?: number;
|
|
64
|
+
}
|
|
65
|
+
export declare function createWorkflowHost(deps: WorkflowHostOptions): WorkflowHost;
|