@bastani/atomic 0.9.38-alpha.4 → 0.9.38-alpha.5

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.
@@ -4,6 +4,12 @@ All notable changes to the `pi-intercom` extension will be documented in this fi
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.9.38-alpha.5] - 2026-10-16
8
+
9
+ ### Fixed
10
+
11
+ - Fixed queued workflow instructions being blocked by broker warm-up during model fallback. Stored instructions are admitted before connecting, including sticky messages for replacement sessions ([#3628](https://github.com/bastani-inc/atomic/issues/3628)).
12
+
7
13
  ## [0.9.28] - 2026-10-08
8
14
 
9
15
  ### Fixed
@@ -7334,14 +7334,18 @@ function piIntercomExtension(pi, testOverrides = {}) {
7334
7334
  await ensureConnected("startup");
7335
7335
  return;
7336
7336
  }
7337
+ const deliverPending = async () => {
7338
+ const receivedMessageIds = ctx.sessionManager.getBranch().flatMap((entry) => {
7339
+ if (entry.type !== "custom_message" || entry.customType !== "intercom_message")
7340
+ return [];
7341
+ const id = entry.details?.message?.id;
7342
+ return typeof id === "string" ? [id] : [];
7343
+ });
7344
+ await pendingStageDelivery.deliverPending((from, message) => handleIncomingMessage(ctx, from, message, undefined, true), { sessionId: ctx.sessionManager.getSessionId(), receivedMessageIds });
7345
+ };
7346
+ await deliverPending();
7337
7347
  await ensureConnected("startup");
7338
- const receivedMessageIds = ctx.sessionManager.getBranch().flatMap((entry) => {
7339
- if (entry.type !== "custom_message" || entry.customType !== "intercom_message")
7340
- return [];
7341
- const id = entry.details?.message?.id;
7342
- return typeof id === "string" ? [id] : [];
7343
- });
7344
- await pendingStageDelivery.deliverPending((from, message) => handleIncomingMessage(ctx, from, message, undefined, true), { sessionId: ctx.sessionManager.getSessionId(), receivedMessageIds });
7348
+ await deliverPending();
7345
7349
  });
7346
7350
  pi.registerMessageRenderer("intercom_message", (message, _options, theme) => {
7347
7351
  const details = message.details;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/intercom",
3
- "version": "0.9.38-alpha.4",
3
+ "version": "0.9.38-alpha.5",
4
4
  "private": true,
5
5
  "description": "Atomic extension providing a private coordination channel between parent and child agent sessions. Fork of: https://github.com/nicobailon/pi-intercom",
6
6
  "contributors": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/mcp",
3
- "version": "0.9.38-alpha.4",
3
+ "version": "0.9.38-alpha.5",
4
4
  "private": true,
5
5
  "description": "Atomic's pi-compatible MCP integration for server connections, OAuth, tools, resources, and terminal management.",
6
6
  "contributors": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/subagents",
3
- "version": "0.9.38-alpha.4",
3
+ "version": "0.9.38-alpha.5",
4
4
  "private": true,
5
5
  "description": "Atomic extension for delegating tasks to subagents with parallel execution. Fork of: https://github.com/nicobailon/pi-subagents",
6
6
  "contributors": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/web-access",
3
- "version": "0.9.38-alpha.4",
3
+ "version": "0.9.38-alpha.5",
4
4
  "private": true,
5
5
  "description": "Atomic extension for web search, URL fetching, GitHub repo cloning, PDF/video extraction. Fork of: https://github.com/nicobailon/pi-web-access",
6
6
  "contributors": [
@@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.9.38-alpha.5] - 2026-10-16
10
+
11
+ ### Fixed
12
+
13
+ - Fixed standalone SDK `run()` resolving string stage models, including thinking suffixes and fallback models, instead of crashing during session creation ([#3629](https://github.com/bastani-inc/atomic/issues/3629)).
14
+ - Fixed queued Intercom instructions preventing stage model fallback. Delivery failures now block resumably and preserve sticky instructions for resumed runs and later stages ([#3628](https://github.com/bastani-inc/atomic/issues/3628)).
15
+
9
16
  ## [0.9.38-alpha.4] - 2026-10-16
10
17
 
11
18
  ### Breaking Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/workflows",
3
- "version": "0.9.38-alpha.4",
3
+ "version": "0.9.38-alpha.5",
4
4
  "private": true,
5
5
  "description": "Atomic extension for multi-stage workflow authoring and execution.",
6
6
  "contributors": [
@@ -40292,7 +40292,7 @@ function structuredRecoverableFailureFromSnapshot(snapshot, failedStageId) {
40292
40292
  return;
40293
40293
  if (snapshot.failureRecoverability !== "recoverable")
40294
40294
  return;
40295
- if (!isRecoverableProviderFailureKind(snapshot.failureKind))
40295
+ if (!isRecoverableProviderFailureKind(snapshot.failureKind) && snapshot.failureCode !== "pending_stage_delivery_failed")
40296
40296
  return;
40297
40297
  const error = snapshot.error ?? snapshot.failureMessage ?? "Workflow is blocked by a recoverable provider failure.";
40298
40298
  return {
@@ -53616,6 +53616,14 @@ function strongDecisionFromNormalizedCode(normalized, retryAfterMs) {
53616
53616
  if (normalized === "atomic_durable_admission_rejected") {
53617
53617
  return { ...unknownDecision(), resumable: false, recoverability: "non_recoverable" };
53618
53618
  }
53619
+ if (normalized === "pending_stage_delivery_failed") {
53620
+ return {
53621
+ ...unknownDecision(),
53622
+ code: "pending_stage_delivery_failed",
53623
+ recoverability: "recoverable",
53624
+ disposition: "active_blocked"
53625
+ };
53626
+ }
53619
53627
  if (CANCELLED_CODES.has(normalized))
53620
53628
  return cancelledDecision();
53621
53629
  if (INVALID_API_KEY_CODES.has(normalized))
@@ -67911,6 +67919,8 @@ function createWorkflowPendingStageDelivery(activeStore, runId, stageId, stageNa
67911
67919
  let drainError;
67912
67920
  let terminalError;
67913
67921
  let drainPromise;
67922
+ let currentRecipient;
67923
+ const hasUndelivered = (sessionId) => activeStore.pendingStageMessagesFor(runId, stageId).length > 0 || stageId !== stageName && activeStore.pendingStageMessagesFor(runId, stageName).length > 0 || stickyPendingStageEntriesForStage(activeStore, runId, stageId, stageName, sessionId === undefined ? undefined : { sessionId }).length > 0;
67914
67924
  const pendingReady = () => {
67915
67925
  if (readyPromise === undefined) {
67916
67926
  readyPromise = new Promise((resolve, reject) => {
@@ -67923,6 +67933,7 @@ function createWorkflowPendingStageDelivery(activeStore, runId, stageId, stageNa
67923
67933
  return {
67924
67934
  routeCapability: workflowPendingStageRouteCapability(activeStore, runId),
67925
67935
  deliverPending(deliver, recipient) {
67936
+ currentRecipient = recipient;
67926
67937
  if (drainPromise !== undefined)
67927
67938
  return drainPromise;
67928
67939
  if (terminalError !== undefined)
@@ -67950,7 +67961,7 @@ function createWorkflowPendingStageDelivery(activeStore, runId, stageId, stageNa
67950
67961
  return drainPromise;
67951
67962
  },
67952
67963
  ready(sessionId) {
67953
- if (activeStore.pendingStageMessagesFor(runId, stageId).length === 0 && (stageId === stageName || activeStore.pendingStageMessagesFor(runId, stageName).length === 0) && stickyPendingStageEntriesForStage(activeStore, runId, stageId, stageName, sessionId === undefined ? undefined : { sessionId }).length === 0) {
67964
+ if (!hasUndelivered(sessionId)) {
67954
67965
  return;
67955
67966
  }
67956
67967
  if (terminalError !== undefined)
@@ -67983,7 +67994,7 @@ function createWorkflowPendingStageDelivery(activeStore, runId, stageId, stageNa
67983
67994
  return ready;
67984
67995
  },
67985
67996
  fail(reason) {
67986
- if (terminalError !== undefined)
67997
+ if (terminalError !== undefined || !hasUndelivered(currentRecipient?.sessionId))
67987
67998
  return;
67988
67999
  terminalError = new WorkflowPendingStageDeliveryFailedError(runId, stageId, stageName, reason);
67989
68000
  if (readyPromise === undefined)
@@ -75091,7 +75102,7 @@ init_factory();
75091
75102
  import { registerExtensionContextRetirementEffect as registerExtensionContextRetirementEffect2 } from "@bastani/atomic";
75092
75103
 
75093
75104
  // dist/builtin/workflows/src/extension/discovery.ts
75094
- import { join as join29 } from "node:path";
75105
+ import { join as join30 } from "node:path";
75095
75106
  import { CONFIG_DIR_NAME as CONFIG_DIR_NAME3, getAgentDir as getAgentDir5 } from "@bastani/atomic";
75096
75107
 
75097
75108
  // dist/builtin/workflows/builtin/index.ts
@@ -81069,7 +81080,7 @@ function createRegistry(initial = []) {
81069
81080
 
81070
81081
  // dist/builtin/workflows/src/extension/discovery-loaders.ts
81071
81082
  import { readdir as readdir2, stat as stat2 } from "node:fs/promises";
81072
- import { extname, isAbsolute as isAbsolute12, join as join28, resolve as resolve14 } from "node:path";
81083
+ import { extname, isAbsolute as isAbsolute12, join as join29, resolve as resolve14 } from "node:path";
81073
81084
 
81074
81085
  // ../../node_modules/jiti/lib/jiti-static.mjs
81075
81086
  var import_jiti = __toESM(require_jiti(), 1);
@@ -81495,8 +81506,10 @@ init_sqlite_run_journal();
81495
81506
  init_types();
81496
81507
 
81497
81508
  // dist/builtin/workflows/src/extension/wiring.ts
81509
+ import { join as join28 } from "node:path";
81498
81510
  import {
81499
81511
  isStaleExtensionContextError as isStaleExtensionContextError5,
81512
+ ModelRuntime,
81500
81513
  resolveRestoredModelReference,
81501
81514
  SessionManager as SessionManager4
81502
81515
  } from "@bastani/atomic";
@@ -82118,7 +82131,18 @@ function createAgentSessionAdapter(baseOptions = {}) {
82118
82131
  options.sessionManager ??= SessionManager4.inMemory(options.cwd ?? process.cwd());
82119
82132
  return options;
82120
82133
  }
82121
- }, { createAgentSession: (options, prepareOptions) => createPiSdkAgentSession(options, prepareOptions) });
82134
+ }, {
82135
+ async createAgentSession(options, prepareOptions) {
82136
+ if (options && !options.modelRuntime && typeof options.model === "string") {
82137
+ options.modelRuntime = await ModelRuntime.create({
82138
+ authPath: options.agentDir ? join28(options.agentDir, "auth.json") : undefined,
82139
+ modelsPath: options.agentDir ? join28(options.agentDir, "models.json") : undefined
82140
+ });
82141
+ await resolveStageModel(options, false);
82142
+ }
82143
+ return createPiSdkAgentSession(options, prepareOptions);
82144
+ }
82145
+ });
82122
82146
  if (baseOptions.cwd !== undefined)
82123
82147
  setAgentSessionAdapterDefaultCwd(agentSession, baseOptions.cwd);
82124
82148
  return agentSession;
@@ -82293,7 +82317,7 @@ async function scanWorkflowDir(dir) {
82293
82317
  try {
82294
82318
  const entries = await readdir2(dir, { withFileTypes: true });
82295
82319
  const WORKFLOW_EXTS = new Set([".ts", ".js", ".mjs", ".cjs"]);
82296
- return entries.filter((e) => e.isFile() && WORKFLOW_EXTS.has(extname(e.name))).map((e) => join28(dir, e.name)).sort();
82320
+ return entries.filter((e) => e.isFile() && WORKFLOW_EXTS.has(extname(e.name))).map((e) => join29(dir, e.name)).sort();
82297
82321
  } catch {
82298
82322
  return null;
82299
82323
  }
@@ -82362,7 +82386,7 @@ function workflowAgentDirs2(options) {
82362
82386
  return options.agentDirs;
82363
82387
  if (options?.homeDir !== undefined) {
82364
82388
  const homeDir = options.homeDir;
82365
- return [join29(homeDir, CONFIG_DIR_NAME3, "agent")];
82389
+ return [join30(homeDir, CONFIG_DIR_NAME3, "agent")];
82366
82390
  }
82367
82391
  return [getAgentDir5()];
82368
82392
  }
@@ -82518,7 +82542,7 @@ async function discoverWorkflows(options) {
82518
82542
  registry = await applyBatch(candidates, registry, sources, diagnostics);
82519
82543
  }
82520
82544
  }
82521
- for (const dir of [join29(cwd, CONFIG_DIR_NAME3, "workflows")]) {
82545
+ for (const dir of [join30(cwd, CONFIG_DIR_NAME3, "workflows")]) {
82522
82546
  const candidates = await loadFromDir(dir, "project-local", diagnostics, getWorkflowHostModules);
82523
82547
  registry = await applyBatch(candidates, registry, sources, diagnostics);
82524
82548
  }
@@ -82530,7 +82554,7 @@ async function discoverWorkflows(options) {
82530
82554
  registry = await applyBatch(candidates, registry, sources, diagnostics);
82531
82555
  }
82532
82556
  }
82533
- for (const dir of agentDirs.map((agentDir) => join29(agentDir, "workflows")).reverse()) {
82557
+ for (const dir of agentDirs.map((agentDir) => join30(agentDir, "workflows")).reverse()) {
82534
82558
  const candidates = await loadFromDir(dir, "user-global", diagnostics, getWorkflowHostModules);
82535
82559
  registry = await applyBatch(candidates, registry, sources, diagnostics);
82536
82560
  }
@@ -83322,14 +83346,14 @@ function createExtensionRuntime(opts = {}) {
83322
83346
 
83323
83347
  // dist/builtin/workflows/src/extension/status-writer.ts
83324
83348
  import { mkdir as mkdir7, rename as rename2, writeFile as writeFile11 } from "node:fs/promises";
83325
- import { dirname as dirname14, join as join30 } from "node:path";
83349
+ import { dirname as dirname14, join as join31 } from "node:path";
83326
83350
  import { CONFIG_DIR_NAME as CONFIG_DIR_NAME4 } from "@bastani/atomic";
83327
- var DEFAULT_STATUS_SUBPATH = join30(CONFIG_DIR_NAME4, "workflows", "status.json");
83351
+ var DEFAULT_STATUS_SUBPATH = join31(CONFIG_DIR_NAME4, "workflows", "status.json");
83328
83352
  function resolveStatusFilePath(config, opts = {}) {
83329
83353
  if (config.statusFilePath)
83330
83354
  return config.statusFilePath;
83331
83355
  const root = opts.projectRoot ?? process.cwd();
83332
- return join30(root, DEFAULT_STATUS_SUBPATH);
83356
+ return join31(root, DEFAULT_STATUS_SUBPATH);
83333
83357
  }
83334
83358
  async function atomicWriteJson(path, content) {
83335
83359
  const dir = dirname14(path);
@@ -2513,8 +2513,10 @@ class GraphFrontierTracker {
2513
2513
  }
2514
2514
  }
2515
2515
  // dist/builtin/workflows/src/extension/wiring.ts
2516
+ import { join as join3 } from "node:path";
2516
2517
  import {
2517
2518
  isStaleExtensionContextError,
2519
+ ModelRuntime,
2518
2520
  resolveRestoredModelReference,
2519
2521
  SessionManager as SessionManager2
2520
2522
  } from "@bastani/atomic";
@@ -6009,7 +6011,18 @@ function createAgentSessionAdapter(baseOptions = {}) {
6009
6011
  options.sessionManager ??= SessionManager2.inMemory(options.cwd ?? process.cwd());
6010
6012
  return options;
6011
6013
  }
6012
- }, { createAgentSession: (options, prepareOptions) => createPiSdkAgentSession(options, prepareOptions) });
6014
+ }, {
6015
+ async createAgentSession(options, prepareOptions) {
6016
+ if (options && !options.modelRuntime && typeof options.model === "string") {
6017
+ options.modelRuntime = await ModelRuntime.create({
6018
+ authPath: options.agentDir ? join3(options.agentDir, "auth.json") : undefined,
6019
+ modelsPath: options.agentDir ? join3(options.agentDir, "models.json") : undefined
6020
+ });
6021
+ await resolveStageModel(options, false);
6022
+ }
6023
+ return createPiSdkAgentSession(options, prepareOptions);
6024
+ }
6025
+ });
6013
6026
  if (baseOptions.cwd !== undefined)
6014
6027
  setAgentSessionAdapterDefaultCwd(agentSession, baseOptions.cwd);
6015
6028
  return agentSession;
@@ -9714,6 +9727,14 @@ function strongDecisionFromNormalizedCode(normalized, retryAfterMs) {
9714
9727
  if (normalized === "atomic_durable_admission_rejected") {
9715
9728
  return { ...unknownDecision(), resumable: false, recoverability: "non_recoverable" };
9716
9729
  }
9730
+ if (normalized === "pending_stage_delivery_failed") {
9731
+ return {
9732
+ ...unknownDecision(),
9733
+ code: "pending_stage_delivery_failed",
9734
+ recoverability: "recoverable",
9735
+ disposition: "active_blocked"
9736
+ };
9737
+ }
9717
9738
  if (CANCELLED_CODES.has(normalized))
9718
9739
  return cancelledDecision();
9719
9740
  if (INVALID_API_KEY_CODES.has(normalized))
@@ -10174,13 +10195,13 @@ async function transitionDurableWorkflowStatus(backend, workflowId, expectedStat
10174
10195
  }
10175
10196
 
10176
10197
  // dist/builtin/workflows/src/runs/foreground/executor-direct-helpers.ts
10177
- import { isAbsolute as isAbsolute8, join as join10, resolve as resolve8 } from "node:path";
10198
+ import { isAbsolute as isAbsolute8, join as join11, resolve as resolve8 } from "node:path";
10178
10199
  import { CONFIG_DIR_NAME } from "@bastani/atomic";
10179
10200
 
10180
10201
  // dist/builtin/workflows/src/shared/workflow-artifacts.ts
10181
10202
  init_factory();
10182
10203
  import { mkdir, readdir, rm, stat } from "node:fs/promises";
10183
- import { dirname as dirname4, join as join3 } from "node:path";
10204
+ import { dirname as dirname4, join as join4 } from "node:path";
10184
10205
  import { getAgentDir as getAgentDir3, getEnvValue } from "@bastani/atomic";
10185
10206
  // dist/builtin/workflows/src/shared/workflow-artifact-env.ts
10186
10207
  var WORKFLOW_ARTIFACT_RETENTION_MS = 30 * 24 * 60 * 60 * 1000;
@@ -10194,17 +10215,17 @@ function workflowArtifactRoot() {
10194
10215
  const override = getEnvValue(ENV_WORKFLOW_ARTIFACT_DIR);
10195
10216
  if (override !== undefined && override.length > 0)
10196
10217
  return override;
10197
- return join3(dirname4(getAgentDir3()), "workflows");
10218
+ return join4(dirname4(getAgentDir3()), "workflows");
10198
10219
  }
10199
10220
  function workflowArtifactRunsRoot() {
10200
- return join3(workflowArtifactRoot(), "runs");
10221
+ return join4(workflowArtifactRoot(), "runs");
10201
10222
  }
10202
10223
  function safeRunId(runId) {
10203
10224
  const safe = runId.replace(/[^A-Za-z0-9._-]/g, "_");
10204
10225
  return safe.length > 0 ? safe : "run";
10205
10226
  }
10206
10227
  function workflowArtifactRunPath(runId) {
10207
- return join3(workflowArtifactRunsRoot(), safeRunId(runId));
10228
+ return join4(workflowArtifactRunsRoot(), safeRunId(runId));
10208
10229
  }
10209
10230
  function storeRunState(run) {
10210
10231
  const hasPendingInput = run.pendingPrompt !== undefined || run.stages.some((stage) => stage.status === "awaiting_input" || stage.status === "paused" || stage.status === "blocked");
@@ -10292,7 +10313,7 @@ async function pruneWorkflowArtifactRuns(root = workflowArtifactRunsRoot(), now
10292
10313
  for (const entry of entries) {
10293
10314
  if (!entry.isDirectory())
10294
10315
  continue;
10295
- const entryPath = join3(root, entry.name);
10316
+ const entryPath = join4(root, entry.name);
10296
10317
  let metadata;
10297
10318
  try {
10298
10319
  metadata = await stat(entryPath);
@@ -11861,7 +11882,7 @@ function resolvedTaskCwd(cwd, workflowInvocationCwd) {
11861
11882
  return isAbsolute8(cwd) ? cwd : resolve8(workflowInvocationCwd, cwd);
11862
11883
  }
11863
11884
  function taskWorktreeOutputsRoot(runId) {
11864
- return join10(workflowArtifactRunPath(runId), "task-outputs");
11885
+ return join11(workflowArtifactRunPath(runId), "task-outputs");
11865
11886
  }
11866
11887
  function prepareTaskWorktrees(tasks, options, runId, scope, workflowInvocationCwd = process.cwd(), symlinkDirectories) {
11867
11888
  if (options.worktree !== true && !tasks.some((task) => task.worktree === true)) {
@@ -11886,9 +11907,9 @@ function prepareTaskWorktrees(tasks, options, runId, scope, workflowInvocationCw
11886
11907
  tasks: tasks.map((task, index) => ({ ...task, cwd: setup.worktrees[index].agentCwd })),
11887
11908
  setup,
11888
11909
  agents,
11889
- diffsDir: join10(setup.cwd, CONFIG_DIR_NAME, "workflows", "worktree-diffs", runId, scope),
11910
+ diffsDir: join11(setup.cwd, CONFIG_DIR_NAME, "workflows", "worktree-diffs", runId, scope),
11890
11911
  outputIsolations: tasks.map((_, index) => ({
11891
- baseDir: join10(trustedRoot, runId, scope, String(index)),
11912
+ baseDir: join11(trustedRoot, runId, scope, String(index)),
11892
11913
  trustedRoot
11893
11914
  }))
11894
11915
  };
@@ -14566,7 +14587,7 @@ function structuredRecoverableFailureFromSnapshot(snapshot, failedStageId) {
14566
14587
  return;
14567
14588
  if (snapshot.failureRecoverability !== "recoverable")
14568
14589
  return;
14569
- if (!isRecoverableProviderFailureKind(snapshot.failureKind))
14590
+ if (!isRecoverableProviderFailureKind(snapshot.failureKind) && snapshot.failureCode !== "pending_stage_delivery_failed")
14570
14591
  return;
14571
14592
  const error = snapshot.error ?? snapshot.failureMessage ?? "Workflow is blocked by a recoverable provider failure.";
14572
14593
  return {
@@ -17520,6 +17541,8 @@ function createWorkflowPendingStageDelivery(activeStore, runId, stageId, stageNa
17520
17541
  let drainError;
17521
17542
  let terminalError;
17522
17543
  let drainPromise;
17544
+ let currentRecipient;
17545
+ const hasUndelivered = (sessionId) => activeStore.pendingStageMessagesFor(runId, stageId).length > 0 || stageId !== stageName && activeStore.pendingStageMessagesFor(runId, stageName).length > 0 || stickyPendingStageEntriesForStage(activeStore, runId, stageId, stageName, sessionId === undefined ? undefined : { sessionId }).length > 0;
17523
17546
  const pendingReady = () => {
17524
17547
  if (readyPromise === undefined) {
17525
17548
  readyPromise = new Promise((resolve, reject) => {
@@ -17532,6 +17555,7 @@ function createWorkflowPendingStageDelivery(activeStore, runId, stageId, stageNa
17532
17555
  return {
17533
17556
  routeCapability: workflowPendingStageRouteCapability(activeStore, runId),
17534
17557
  deliverPending(deliver, recipient) {
17558
+ currentRecipient = recipient;
17535
17559
  if (drainPromise !== undefined)
17536
17560
  return drainPromise;
17537
17561
  if (terminalError !== undefined)
@@ -17559,7 +17583,7 @@ function createWorkflowPendingStageDelivery(activeStore, runId, stageId, stageNa
17559
17583
  return drainPromise;
17560
17584
  },
17561
17585
  ready(sessionId) {
17562
- if (activeStore.pendingStageMessagesFor(runId, stageId).length === 0 && (stageId === stageName || activeStore.pendingStageMessagesFor(runId, stageName).length === 0) && stickyPendingStageEntriesForStage(activeStore, runId, stageId, stageName, sessionId === undefined ? undefined : { sessionId }).length === 0) {
17586
+ if (!hasUndelivered(sessionId)) {
17563
17587
  return;
17564
17588
  }
17565
17589
  if (terminalError !== undefined)
@@ -17592,7 +17616,7 @@ function createWorkflowPendingStageDelivery(activeStore, runId, stageId, stageNa
17592
17616
  return ready;
17593
17617
  },
17594
17618
  fail(reason) {
17595
- if (terminalError !== undefined)
17619
+ if (terminalError !== undefined || !hasUndelivered(currentRecipient?.sessionId))
17596
17620
  return;
17597
17621
  terminalError = new WorkflowPendingStageDeliveryFailedError(runId, stageId, stageName, reason);
17598
17622
  if (readyPromise === undefined)
@@ -20466,7 +20490,7 @@ class StageSessionController {
20466
20490
  // dist/builtin/workflows/src/runs/foreground/stage-runner-output.ts
20467
20491
  import { createHash as createHash3 } from "node:crypto";
20468
20492
  import { mkdir as mkdir2, writeFile } from "node:fs/promises";
20469
- import { basename as basename5, dirname as dirname10, isAbsolute as isAbsolute9, join as join11, resolve as resolve9 } from "node:path";
20493
+ import { basename as basename5, dirname as dirname10, isAbsolute as isAbsolute9, join as join12, resolve as resolve9 } from "node:path";
20470
20494
  var DEFAULT_MAX_OUTPUT_BYTES = 200 * 1024;
20471
20495
  var DEFAULT_MAX_OUTPUT_LINES = 5000;
20472
20496
  function normalizeMaxOutput2(maxOutput) {
@@ -20531,7 +20555,7 @@ function formatByteSize(bytes) {
20531
20555
  }
20532
20556
  function transcriptPath(runId, outputPath) {
20533
20557
  const digest = createHash3("sha256").update(outputPath).digest("hex").slice(0, 16);
20534
- return join11(workflowArtifactRunPath(runId), "transcripts", `${digest}-${basename5(outputPath)}.transcript.md`);
20558
+ return join12(workflowArtifactRunPath(runId), "transcripts", `${digest}-${basename5(outputPath)}.transcript.md`);
20535
20559
  }
20536
20560
  function appendContent(lines, content) {
20537
20561
  if (typeof content === "string") {
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@bastani/atomic",
3
- "version": "0.9.38-alpha.4",
3
+ "version": "0.9.38-alpha.5",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@bastani/atomic",
9
- "version": "0.9.38-alpha.4",
9
+ "version": "0.9.38-alpha.5",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
- "@bastani/atomic-natives": "0.9.38-alpha.4",
13
- "@bastani/pi-ai": "0.9.38-alpha.4",
12
+ "@bastani/atomic-natives": "0.9.38-alpha.5",
13
+ "@bastani/pi-ai": "0.9.38-alpha.5",
14
14
  "@earendil-works/pi-agent-core": "1.2.0",
15
15
  "@earendil-works/pi-codemode": "1.2.0",
16
16
  "@earendil-works/pi-tui": "1.2.0",
@@ -427,18 +427,18 @@
427
427
  }
428
428
  },
429
429
  "node_modules/@bastani/atomic-natives": {
430
- "version": "0.9.38-alpha.4",
431
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives/-/atomic-natives-0.9.38-alpha.4.tgz",
430
+ "version": "0.9.38-alpha.5",
431
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives/-/atomic-natives-0.9.38-alpha.5.tgz",
432
432
  "license": "MIT",
433
433
  "optionalDependencies": {
434
- "@bastani/atomic-natives-darwin-arm64": "0.9.38-alpha.4",
435
- "@bastani/atomic-natives-darwin-x64": "0.9.38-alpha.4",
436
- "@bastani/atomic-natives-linux-arm64-gnu": "0.9.38-alpha.4",
437
- "@bastani/atomic-natives-linux-arm64-musl": "0.9.38-alpha.4",
438
- "@bastani/atomic-natives-linux-x64-gnu": "0.9.38-alpha.4",
439
- "@bastani/atomic-natives-linux-x64-musl": "0.9.38-alpha.4",
440
- "@bastani/atomic-natives-win32-arm64-msvc": "0.9.38-alpha.4",
441
- "@bastani/atomic-natives-win32-x64-msvc": "0.9.38-alpha.4"
434
+ "@bastani/atomic-natives-darwin-arm64": "0.9.38-alpha.5",
435
+ "@bastani/atomic-natives-darwin-x64": "0.9.38-alpha.5",
436
+ "@bastani/atomic-natives-linux-arm64-gnu": "0.9.38-alpha.5",
437
+ "@bastani/atomic-natives-linux-arm64-musl": "0.9.38-alpha.5",
438
+ "@bastani/atomic-natives-linux-x64-gnu": "0.9.38-alpha.5",
439
+ "@bastani/atomic-natives-linux-x64-musl": "0.9.38-alpha.5",
440
+ "@bastani/atomic-natives-win32-arm64-msvc": "0.9.38-alpha.5",
441
+ "@bastani/atomic-natives-win32-x64-msvc": "0.9.38-alpha.5"
442
442
  },
443
443
  "engines": {
444
444
  "bun": ">=1.4.2",
@@ -446,8 +446,8 @@
446
446
  }
447
447
  },
448
448
  "node_modules/@bastani/atomic-natives-darwin-arm64": {
449
- "version": "0.9.38-alpha.4",
450
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-arm64/-/atomic-natives-darwin-arm64-0.9.38-alpha.4.tgz",
449
+ "version": "0.9.38-alpha.5",
450
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-arm64/-/atomic-natives-darwin-arm64-0.9.38-alpha.5.tgz",
451
451
  "license": "MIT",
452
452
  "os": [
453
453
  "darwin"
@@ -458,8 +458,8 @@
458
458
  "optional": true
459
459
  },
460
460
  "node_modules/@bastani/atomic-natives-darwin-x64": {
461
- "version": "0.9.38-alpha.4",
462
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-x64/-/atomic-natives-darwin-x64-0.9.38-alpha.4.tgz",
461
+ "version": "0.9.38-alpha.5",
462
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-x64/-/atomic-natives-darwin-x64-0.9.38-alpha.5.tgz",
463
463
  "license": "MIT",
464
464
  "os": [
465
465
  "darwin"
@@ -470,8 +470,8 @@
470
470
  "optional": true
471
471
  },
472
472
  "node_modules/@bastani/atomic-natives-linux-arm64-gnu": {
473
- "version": "0.9.38-alpha.4",
474
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-gnu/-/atomic-natives-linux-arm64-gnu-0.9.38-alpha.4.tgz",
473
+ "version": "0.9.38-alpha.5",
474
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-gnu/-/atomic-natives-linux-arm64-gnu-0.9.38-alpha.5.tgz",
475
475
  "license": "MIT",
476
476
  "os": [
477
477
  "linux"
@@ -485,8 +485,8 @@
485
485
  "optional": true
486
486
  },
487
487
  "node_modules/@bastani/atomic-natives-linux-arm64-musl": {
488
- "version": "0.9.38-alpha.4",
489
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-musl/-/atomic-natives-linux-arm64-musl-0.9.38-alpha.4.tgz",
488
+ "version": "0.9.38-alpha.5",
489
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-musl/-/atomic-natives-linux-arm64-musl-0.9.38-alpha.5.tgz",
490
490
  "license": "MIT",
491
491
  "os": [
492
492
  "linux"
@@ -500,8 +500,8 @@
500
500
  "optional": true
501
501
  },
502
502
  "node_modules/@bastani/atomic-natives-linux-x64-gnu": {
503
- "version": "0.9.38-alpha.4",
504
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-gnu/-/atomic-natives-linux-x64-gnu-0.9.38-alpha.4.tgz",
503
+ "version": "0.9.38-alpha.5",
504
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-gnu/-/atomic-natives-linux-x64-gnu-0.9.38-alpha.5.tgz",
505
505
  "license": "MIT",
506
506
  "os": [
507
507
  "linux"
@@ -515,8 +515,8 @@
515
515
  "optional": true
516
516
  },
517
517
  "node_modules/@bastani/atomic-natives-linux-x64-musl": {
518
- "version": "0.9.38-alpha.4",
519
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-musl/-/atomic-natives-linux-x64-musl-0.9.38-alpha.4.tgz",
518
+ "version": "0.9.38-alpha.5",
519
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-musl/-/atomic-natives-linux-x64-musl-0.9.38-alpha.5.tgz",
520
520
  "license": "MIT",
521
521
  "os": [
522
522
  "linux"
@@ -530,8 +530,8 @@
530
530
  "optional": true
531
531
  },
532
532
  "node_modules/@bastani/atomic-natives-win32-arm64-msvc": {
533
- "version": "0.9.38-alpha.4",
534
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-arm64-msvc/-/atomic-natives-win32-arm64-msvc-0.9.38-alpha.4.tgz",
533
+ "version": "0.9.38-alpha.5",
534
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-arm64-msvc/-/atomic-natives-win32-arm64-msvc-0.9.38-alpha.5.tgz",
535
535
  "license": "MIT",
536
536
  "os": [
537
537
  "win32"
@@ -542,8 +542,8 @@
542
542
  "optional": true
543
543
  },
544
544
  "node_modules/@bastani/atomic-natives-win32-x64-msvc": {
545
- "version": "0.9.38-alpha.4",
546
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-x64-msvc/-/atomic-natives-win32-x64-msvc-0.9.38-alpha.4.tgz",
545
+ "version": "0.9.38-alpha.5",
546
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-x64-msvc/-/atomic-natives-win32-x64-msvc-0.9.38-alpha.5.tgz",
547
547
  "license": "MIT",
548
548
  "os": [
549
549
  "win32"
@@ -554,8 +554,8 @@
554
554
  "optional": true
555
555
  },
556
556
  "node_modules/@bastani/pi-ai": {
557
- "version": "0.9.38-alpha.4",
558
- "resolved": "https://registry.npmjs.org/@bastani/pi-ai/-/pi-ai-0.9.38-alpha.4.tgz",
557
+ "version": "0.9.38-alpha.5",
558
+ "resolved": "https://registry.npmjs.org/@bastani/pi-ai/-/pi-ai-0.9.38-alpha.5.tgz",
559
559
  "license": "MIT",
560
560
  "dependencies": {
561
561
  "@anthropic-ai/sdk": "0.129.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/atomic",
3
- "version": "0.9.38-alpha.4",
3
+ "version": "0.9.38-alpha.5",
4
4
  "description": "Atomic coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "atomicConfig": {
@@ -88,8 +88,8 @@
88
88
  "prepublishOnly": "bun run clean && bun run build && bun run shrinkwrap"
89
89
  },
90
90
  "dependencies": {
91
- "@bastani/atomic-natives": "0.9.38-alpha.4",
92
- "@bastani/pi-ai": "0.9.38-alpha.4",
91
+ "@bastani/atomic-natives": "0.9.38-alpha.5",
92
+ "@bastani/pi-ai": "0.9.38-alpha.5",
93
93
  "@earendil-works/pi-agent-core": "1.2.0",
94
94
  "@earendil-works/pi-codemode": "1.2.0",
95
95
  "@earendil-works/pi-tui": "1.2.0",