pi-crew 0.9.60 → 0.9.61

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 CHANGED
@@ -3,10 +3,17 @@
3
3
  > **Note:** `atomic-write-v2.ts` / `AtomicWriter` mentioned in historical entries below was consolidated into `atomic-write.ts` as of v0.9.42. This changelog is preserved as historical record — the migration was completed (the v2 class was never adopted; v1 won on simplicity + symlink-safety + link+unlink atomicity). See `docs/migration/atomic-write-v2-migration.md` for the decision rationale.
4
4
 
5
5
 
6
+ ## [0.9.61] — bundle republish: bug-44 fix shipped in dist (2026-08-05)
7
+
8
+ ### Bug fixes
9
+
10
+ - **Bug-44 fix was missing from the v0.9.60 npm bundle (hot-fix republish).** The source-level fix for GitHub #44 (chain run fails fast when `workflow:"chain"` is forwarded to steps) landed in commit `5b43d556`, but the published `dist/index.mjs` was built from a stale source tree *before* the fix, so users installing `pi-crew@0.9.60` got the old buggy bundle (the chain runner still forwarded `workflow` to steps). v0.9.61 rebuilds the bundle with the fix included and verified (`grep` for the reject message + fallback logic now matches in `dist/index.mjs`). No source changes — purely a corrected bundle republish.
11
+
6
12
  ## [0.9.60] — subagent model routing: live-session model tracking, fallback policy, quota-aware ordering + iterative-audit hardening (2026-08-05)
7
13
 
8
14
  ### Bug fixes
9
15
 
16
+ - **Chain run fails fast (~58 ms) with no error when `workflow:"chain"` is forwarded to steps (GitHub #44).** `chain-dispatch.ts` forwarded `params.workflow` (="chain") into every step's executor overrides; `chain-executor.ts` passed it through to each step's `handleRun`, which then executed the dispatcher-only `chain` workflow via the normal `executeTeamRun` path. Since `chain.workflow.md` is a documentation file (not a runnable workflow — it parses to 10 doc-heading steps with unknown roles), validation failed fast with a confusing empty error. Fix: (1) `chain-dispatch.ts` no longer forwards `workflow` (a chain has no per-step workflow; steps use the team's defaultWorkflow); (2) `chain-executor.ts` defensively drops a `"chain"` workflow override; (3) `run.ts` falls back to the team's default workflow when `workflow="chain"` is requested without a `chain` param; (4) `handleChainRun` rejects `workflow:"chain"` with a clear message. Regression tests added in `chain-executor.test.ts`.
10
17
  - **Subagent model "jumped" to whatever a previous session had saved.** `ctx.model` is the session's *saved* model, not the live one. A session that restored stale state could report `anthropic/claude-sonnet-4-5` while actually running `minimax/MiniMax-M3`. Subagents inheriting the parent model (`model: false`, which every builtin agent uses) therefore landed on the wrong model. Fix: track the live model via pi's `model_select` event (`src/runtime/model/session-model.ts`) and use it as the parent model for all spawn paths.
11
18
  - **Live-session path silently discarded `ctx.model`.** `resolveParentModelFromRegistry` only accepted strings; `ctx.model` is a pi `Model` object. Every live-session subagent that inherited the parent model fell through to `getAvailable()[0]` instead. Fix: accept both objects and strings via `modelRefToString`.
12
19
  - **Background/async runs lost the caller's model context.** A detached background run has no `ExtensionContext`, so it lost the `model=` override, the inherited session model, and the auth-filtered model catalogue — silently routing to whatever `models.json` listed first. Fix: persist `modelContext` (override / parent model / available models) on the manifest at dispatch time and re-hydrate it in `background-runner`.
package/dist/index.mjs CHANGED
@@ -59883,7 +59883,8 @@ var init_chain_executor = __esm({
59883
59883
  # Current Chain Step
59884
59884
  ${packet.goal}` : packet.goal;
59885
59885
  const stepTeam = context.__chainStepTeam ?? this.overrides.team ?? "default";
59886
- const stepWorkflow = context.__chainStepWorkflow ?? this.overrides.workflow;
59886
+ const rawWorkflow = context.__chainStepWorkflow ?? this.overrides.workflow;
59887
+ const stepWorkflow = rawWorkflow === "chain" ? void 0 : rawWorkflow;
59887
59888
  const stepModel = context.__chainStepModel ?? this.overrides.model;
59888
59889
  const runParams = {
59889
59890
  action: "run",
@@ -59928,6 +59929,13 @@ async function handleChainRun(params, ctx, handleRun3) {
59928
59929
  if (!chainString || chainString.trim().length === 0) {
59929
59930
  return result("Chain expression is empty.", { action: "run", status: "error" }, true);
59930
59931
  }
59932
+ if (params.workflow === "chain") {
59933
+ return result(
59934
+ "Workflow 'chain' cannot be combined with a chain run: the chain runner owns step execution and has no per-step workflow. Omit `workflow` (steps use the team's defaultWorkflow) or use @team references in the chain expression.",
59935
+ { action: "run", status: "error" },
59936
+ true
59937
+ );
59938
+ }
59931
59939
  const spec = parseChainString(chainString);
59932
59940
  if (spec.steps.length === 0) {
59933
59941
  return result(
@@ -59941,8 +59949,8 @@ async function handleChainRun(params, ctx, handleRun3) {
59941
59949
  ctx,
59942
59950
  overrides: {
59943
59951
  team: params.team,
59944
- workflow: params.workflow,
59945
- model: params.model
59952
+ // workflow intentionally omitted — chain runner owns step execution (bug-44)
59953
+ ...params.model ? { model: params.model } : {}
59946
59954
  }
59947
59955
  });
59948
59956
  const runner = new ChainRunner(executor, new HandoffManager());
@@ -61499,7 +61507,7 @@ Commit or stash changes before using worktree mode, or use workspaceMode: 'singl
61499
61507
  workspaceMode: params.workspaceMode
61500
61508
  } : teams.find((item) => item.name === teamName);
61501
61509
  if (!team) return result(`Team '${teamName}' not found.`, { action: "run", status: "error" }, true);
61502
- const workflowName = directAgent ? "direct-agent" : params.workflow ?? team.defaultWorkflow ?? "default";
61510
+ const workflowName = directAgent ? "direct-agent" : params.workflow === "chain" && !params.chain ? team.defaultWorkflow ?? "default" : params.workflow ?? team.defaultWorkflow ?? "default";
61503
61511
  const baseWorkflow = directAgent ? {
61504
61512
  name: "direct-agent",
61505
61513
  description: `Direct task for ${directAgent.name}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-crew",
3
- "version": "0.9.60",
3
+ "version": "0.9.61",
4
4
  "description": "Pi extension for coordinated AI teams, workflows, worktrees, and async task orchestration",
5
5
  "author": "baphuongna",
6
6
  "license": "MIT",