@signalridge/pi-workflows 0.2.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 ADDED
@@ -0,0 +1,23 @@
1
+ # Changelog
2
+
3
+ ## Unreleased
4
+ - **Semantic workflow tiers:** tasks, synthesis, and an optional run default can request only `small`, `medium`, or `large`; model and thinking policy stays inside pi-subagents. The release requires `@signalridge/pi-subagents >=0.16.0-signalridge.1` and the v3 `workflowTiers` capability.
5
+
6
+ - Persist restore recovery as one validated run-level atomic event, with bounded task/synthesis rotations, terminal-record reconciliation, and legacy-prefix migration.
7
+ - Add deterministic bounded recovery IDs and per-run duplicate replay quarantine; legacy schema-v2 atomic records without an ID are normalized once without weakening generation checks, and durable-append retries remain exactly-once.
8
+ - Require the protocol's owner-scoped quiescence capability and keep terminal cleanup in `stopping` until managed sessions and dispatches have actually settled; retry transient recovery and lifecycle journal appends.
9
+ - Quiesce managed agents that answer a spawn request after stop or branch replacement, preventing a late dispatch from being published as a false terminal workflow.
10
+ - Preserve exact terminal cleanup targets across retries and fail closed when legacy peers cannot prove dispatch quiescence.
11
+ - Keep observed terminal lifecycle facts ahead of synthetic stop/failure facts while journal retries or durable prefixes remain unresolved; a permanently blocked journal stays nonterminal.
12
+ - Owner-quiesce late spawn responses during branch replacement and report any late target that cannot settle instead of treating dispatch completion as proof.
13
+
14
+ - Require and verify pi-subagents protocol v3 before managed workflow dispatch, including the owner-scoped `ownedStop` capability; workflow cleanup fails closed instead of falling back to unowned stop.
15
+ - Recover unreconciled dispatches, settle stop/failure cleanup, and expose bounded run details.
16
+ - Bound synthesis instructions and aggregate input to 48,000 characters.
17
+ - Replay current-attempt interrupted records as one journaled attempt generation without creating failed task facts; stale records are ignored after replay.
18
+ - Fail stopped-task workflows conservatively and report/quarantine incomplete branch quiescence instead of accepting late lifecycle events.
19
+ - Keep protocol discovery nonblocking and defer the missing-companion diagnostic until a workflow tool call.
20
+ - Bound interrupted-attempt recovery to three generations per node, including synthesis, and fail safely beyond the limit instead of retrying an outer workflow indefinitely.
21
+ - Supersede every unreconciled task and synthesis dispatch during restore, including dispatches without agent IDs, before resuming lifecycle listeners.
22
+ - Require attempt-scoped owners for managed stop/quiescence, track dispatches without agent IDs during branch changes, and quarantine stale responses before they can mutate the restored run.
23
+ - Keep foreground wait cancellation separate from managed child cancellation; session shutdown only aborts the caller's outstanding RPC wait.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 signalridge
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # @signalridge/pi-workflows
2
+
3
+ Declarative DAG orchestration for Pi. The `workflow` tool validates phases, task dependencies, cycles, bounded synthesis input, and optional `small`/`medium`/`large` semantic tiers, then submits ready tasks through the additive `subagents:rpc:spawn-managed` event-bus protocol. `pi-subagents` remains the only owner of model, thinking, queue, concurrency, tools, skills, cwd, isolation, retry, and session policy.
4
+
5
+ ## Install
6
+
7
+ `@signalridge/pi-workflows` requires `@signalridge/pi-subagents` `>=0.16.0-signalridge.1` with protocol v3 managed-spawn support. They are separate Pi packages: the peer dependency documents the requirement but intentionally does not auto-load or duplicate the subagent extension.
8
+
9
+ ```bash
10
+ pi install npm:@signalridge/pi-subagents
11
+ pi install npm:@signalridge/pi-workflows
12
+ ```
13
+
14
+ ## Use from this checkout
15
+
16
+ From the repository root, load both local package directories once:
17
+
18
+ ```bash
19
+ pi -e ./packages/pi-subagents
20
+ pi -e ./packages/pi-workflows
21
+ ```
22
+
23
+ Pi activates each package from its own `pi.extensions` manifest. The dotfiles migration configures these two local paths together; do not add a second source for either package.
24
+
25
+ At `session_start`, this extension sends `subagents:rpc:ping` and verifies protocol version 3 plus the `managedSpawn`, `lifecycleOwner`, owner-scoped `ownedStop`, `ownedQuiescence`, and `workflowTiers` capabilities. The package floor and capability check prevent older v3 peers from receiving tiered requests they cannot validate. If the fork is missing, old, or duplicated incorrectly, workflow execution returns a diagnostic naming the required packages instead of dispatching agents. The legacy unowned stop RPC remains available to older external callers, but workflow cleanup never falls back to it.
26
+
27
+ ## Tools and command
28
+
29
+ - `workflow`: run a foreground or background workflow.
30
+ - `workflow_control`: `list`, `get`, `pause`, `resume`, or `stop` a run. `get` returns bounded task and synthesis details including status, agent ID, compactions, and result/error previews.
31
+ - `/workflows`: TUI run list/detail navigator. Live agent conversation navigation remains in pi-subagents FleetView.
32
+
33
+ State is persisted as `pi.appendEntry("pi-workflows:journal", ...)` custom entries, which do not enter model context. Results and synthesis instructions are capped before journaling or dispatch. Interrupted runs reset unreconciled dispatches to a recoverable state and reuse their managed spawn keys; completed task facts are not dispatched again. A task failure stops remaining owned agents, journals their terminal callbacks, blocks dependents, and settles the workflow as failed.
34
+ Restore rotation is journaled atomically per run (`run_recovery`) so a failed append leaves no partial generation; older multi-entry recovery prefixes remain replayable and are migrated with independent `attempt_recovery` entries.
35
+ Each atomic recovery also carries a deterministic bounded `recoveryId` derived from its branch/run and attempt rotations. Replay treats an exact normalized duplicate as a no-op, quarantines same-ID conflicts, and accepts older schema-v2 atomic entries without an ID only through deterministic legacy normalization.
36
+ Managed lifecycle calls are owner-scoped to the exact `{ runId, nodeId, attemptId }` generation. Branch replacement stops/quiesces owned agents and tracks in-flight dispatch RPCs; if a peer cannot settle, the run is quarantined conservatively and late lifecycle or spawn replies are ignored. Foreground `AbortSignal`s cancel only the caller's wait. The session signal may cancel an outstanding RPC wait during shutdown, but neither signal is used to cancel a managed child; explicit stop/quiescence owns child cancellation.
37
+
38
+
39
+ Interrupted-attempt recovery is intentionally bounded to three generations per task, including synthesis. Normal interruptions retry with a fresh managed attempt; if the same node is interrupted repeatedly beyond that bound, the workflow fails safely instead of creating an unbounded outer retry loop.
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@signalridge/pi-workflows",
3
+ "version": "0.2.0",
4
+ "description": "Declarative DAG workflows backed by pi-subagents managed spawning.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "private": false,
8
+ "keywords": [
9
+ "pi-package",
10
+ "pi-extension",
11
+ "workflow",
12
+ "dag"
13
+ ],
14
+ "piExtension": {
15
+ "lifecycle": "stable"
16
+ },
17
+ "peerDependencies": {
18
+ "@earendil-works/pi-coding-agent": "*",
19
+ "@earendil-works/pi-tui": "*",
20
+ "@signalridge/pi-subagents": ">=0.16.0-signalridge.1"
21
+ },
22
+ "dependencies": {
23
+ "@sinclair/typebox": "^0.34.49",
24
+ "@signalridge/pi-subagents-protocol": "^0.1.0"
25
+ },
26
+ "pi": {
27
+ "extensions": [
28
+ "./src/index.ts"
29
+ ]
30
+ },
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/signalridge/pi-extensions",
34
+ "directory": "packages/pi-workflows"
35
+ },
36
+ "homepage": "https://github.com/signalridge/pi-extensions/tree/main/packages/pi-workflows",
37
+ "bugs": {
38
+ "url": "https://github.com/signalridge/pi-extensions/issues"
39
+ },
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "files": [
44
+ "README.md",
45
+ "LICENSE",
46
+ "CHANGELOG.md",
47
+ "src"
48
+ ],
49
+ "scripts": {
50
+ "test": "vitest run test --config vitest.config.ts",
51
+ "typecheck": "tsc --noEmit",
52
+ "lint": "biome check .",
53
+ "check": "bun run lint && bun run typecheck && bun run test",
54
+ "format": "biome check --write ."
55
+ }
56
+ }