@bastani/atomic 0.9.38-alpha.7 → 0.9.38-alpha.9

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 (48) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/builtin/intercom/package.json +1 -1
  3. package/dist/builtin/mcp/package.json +1 -1
  4. package/dist/builtin/subagents/CHANGELOG.md +6 -0
  5. package/dist/builtin/subagents/README.md +9 -4
  6. package/dist/builtin/subagents/package.json +1 -1
  7. package/dist/builtin/subagents/src/extension/index.bundle.mjs +23 -13
  8. package/dist/builtin/web-access/package.json +1 -1
  9. package/dist/builtin/workflows/CHANGELOG.md +6 -0
  10. package/dist/builtin/workflows/package.json +1 -1
  11. package/dist/builtin/workflows/src/durable/journal/legacy-journal-tables.d.ts +42 -0
  12. package/dist/builtin/workflows/src/durable/journal/sql-run-journal.d.ts +3 -0
  13. package/dist/builtin/workflows/src/extension/index.bundle.mjs +204 -51
  14. package/dist/builtin/workflows/src/index.js +170 -17
  15. package/dist/core/session-manager-storage.d.ts +1 -1
  16. package/dist/core/session-manager-storage.d.ts.map +1 -1
  17. package/dist/core/session-manager-storage.js +2 -3
  18. package/dist/core/session-manager-storage.js.map +1 -1
  19. package/dist/core/session-storage.d.ts.map +1 -1
  20. package/dist/core/session-storage.js +20 -4
  21. package/dist/core/session-storage.js.map +1 -1
  22. package/dist/core/storage/session/jsonl-session-store.d.ts +7 -1
  23. package/dist/core/storage/session/jsonl-session-store.d.ts.map +1 -1
  24. package/dist/core/storage/session/jsonl-session-store.js +29 -20
  25. package/dist/core/storage/session/jsonl-session-store.js.map +1 -1
  26. package/dist/core/storage/session/legacy-format.d.ts +2 -0
  27. package/dist/core/storage/session/legacy-format.d.ts.map +1 -1
  28. package/dist/core/storage/session/legacy-format.js +55 -29
  29. package/dist/core/storage/session/legacy-format.js.map +1 -1
  30. package/dist/core/storage/session/legacy-session-store.d.ts +63 -0
  31. package/dist/core/storage/session/legacy-session-store.d.ts.map +1 -0
  32. package/dist/core/storage/session/legacy-session-store.js +239 -0
  33. package/dist/core/storage/session/legacy-session-store.js.map +1 -0
  34. package/dist/core/storage/session/legacy-session-summary.d.ts +11 -0
  35. package/dist/core/storage/session/legacy-session-summary.d.ts.map +1 -0
  36. package/dist/core/storage/session/legacy-session-summary.js +103 -0
  37. package/dist/core/storage/session/legacy-session-summary.js.map +1 -0
  38. package/dist/main-session.d.ts.map +1 -1
  39. package/dist/main-session.js +4 -1
  40. package/dist/main-session.js.map +1 -1
  41. package/docs/docs.json +5 -2
  42. package/docs/llama-cpp.md +94 -1
  43. package/docs/session-format.md +1 -1
  44. package/docs/sessions.md +4 -2
  45. package/docs/subagents.md +19 -6
  46. package/npm-shrinkwrap.json +32 -32
  47. package/package.json +3 -3
  48. package/docs/nvidia-rtx-llama-cpp.md +0 -101
package/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.9.38-alpha.9] - 2026-10-17
6
+
7
+ ### Fixed
8
+
9
+ - Fixed slow interactive startup on machines with many sessions saved before the SQLite default, a follow-up to [#3721](https://github.com/bastani-inc/atomic/pull/3721). Opening a session by its exact ID, which the interactive engine does at launch, now looks up only that session instead of scanning `~/.atomic/agent/sessions`. `/resume`, `--resume`, and `--continue` list unconverted sessions larger than 32 KiB from their first message and most recent entries rather than parsing every file, so their message count is a lower bound and `/resume` search sees only that text until you open one, which still converts it in full.
10
+
11
+ ## [0.9.38-alpha.8] - 2026-10-17
12
+
13
+ ### Changed
14
+
15
+ - Subagent parallel task limits can now be raised above 50 with `parallel.maxTasks`. Configure `parallel.concurrency` and the new `parallel.runningCapacity` together to run more than four child turns per parent; defaults remain 50 tasks, concurrency 3, and running capacity 4.
16
+
17
+ ### Fixed
18
+
19
+ - Fixed sessions saved before the SQLite default disappearing from `/resume` and failing to open with `--continue`, `--session`, or `--fork`. With the default store, sessions in `~/.atomic/agent/sessions`, including workflow stage sessions and early 0.9.38 alpha sessions that use a `timestamp` header, are listed alongside newer ones and copied into the database only when you open one, so startup does no extra work. Original files are left untouched, deleted sessions stay deleted, and explicitly selected stores do not show them.
20
+
5
21
  ## [0.9.38-alpha.7] - 2026-10-17
6
22
 
7
23
  ### Breaking Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/intercom",
3
- "version": "0.9.38-alpha.7",
3
+ "version": "0.9.38-alpha.9",
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.7",
3
+ "version": "0.9.38-alpha.9",
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": [
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.9.38-alpha.8] - 2026-10-17
6
+
7
+ ### Changed
8
+
9
+ - Subagent parallel task limits can now be raised above 50 with `parallel.maxTasks`. Configure `parallel.concurrency` and the new `parallel.runningCapacity` together to run more than four child turns per parent; defaults remain 50 tasks, concurrency 3, and running capacity 4.
10
+
5
11
  ## [0.9.38-alpha.7] - 2026-10-17
6
12
 
7
13
  ### Breaking Changes
@@ -479,7 +479,7 @@ These are the parameters the LLM passes when it calls the `subagent` tool. Most
479
479
 
480
480
  If one assistant response emits several sibling execution-mode `subagent` calls, Atomic collects the synchronous burst before any child starts and runs it through one indexed parallel set. Each original tool call receives only its own children in source order, and its live result, progress, control, and artifact updates are projected to that same route without sibling data. The TUI redraws the shared run as one aggregate parallel widget rather than retaining one widget per original call. A solitary call keeps its original mode, sequential awaited calls stay independent, and management actions bypass collection. A call that arrives after a child has started still gets the existing in-progress rejection. Prefer one explicit `{ tasks: [...] }` call when you intend parallel work; burst collection handles model-emitted sibling calls.
481
481
 
482
- In a collected burst, a call's top-level `agent` task comes first, followed by its `tasks` array. Duplicates and array order are preserved, and `count` expands in place. The task cap applies after all calls are flattened and counts are expanded, with the same hard maximum of 50. Each call-level `cwd` selects that call's agent-discovery scope and child base directory. A task-level `cwd` stays relative to that base and affects child execution, not agent discovery. This per-origin rule applies only to collected sibling calls; an ordinary explicit `{ tasks: [...] }` call keeps one discovery scope from its top-level `cwd`. Per-call and per-task `group` values also remain attached to their children, and a task-level group wins.
482
+ In a collected burst, a call's top-level `agent` task comes first, followed by its `tasks` array. Duplicates and array order are preserved, and `count` expands in place. The configured `parallel.maxTasks` cap applies after all calls are flattened and counts are expanded. Each call-level `cwd` selects that call's agent-discovery scope and child base directory. A task-level `cwd` stays relative to that base and affects child execution, not agent discovery. This per-origin rule applies only to collected sibling calls; an ordinary explicit `{ tasks: [...] }` call keeps one discovery scope from its top-level `cwd`. Per-call and per-task `group` values also remain attached to their children, and a task-level group wins.
483
483
 
484
484
  For a collected `worktree: true` burst, every call-level `cwd` must resolve to the same path. That common path becomes the shared worktree root; differing origins reject the burst before launch, and any task-level `cwd` must still resolve to that root. Each projected caller result keeps shared worktree diff text and terminal control guidance while its child results and standard child-output sections remain route-local.
485
485
 
@@ -601,13 +601,18 @@ Subagent configuration controls discovery, parallel limits, session storage, con
601
601
  ```json
602
602
  {
603
603
  "parallel": {
604
- "maxTasks": 12,
605
- "concurrency": 6
604
+ "maxTasks": 100,
605
+ "concurrency": 100,
606
+ "runningCapacity": 100
606
607
  }
607
608
  }
608
609
  ```
609
610
 
610
- `maxTasks` defaults to `50`; `concurrency` defaults to `3`. `maxTasks` can set a lower per-call task limit but cannot exceed the hard maximum of `50`. Per-call `concurrency` takes precedence.
611
+ - `maxTasks` defaults to `50` and limits tasks per parallel set after `count` expansion. There is no hard upper cap.
612
+ - `concurrency` defaults to `3` and limits how many children are dispatched at once. Per-call `concurrency` takes precedence.
613
+ - `runningCapacity` defaults to `4` and limits simultaneously running child turns per parent. To run N children at once, raise both `concurrency` and `runningCapacity` to N, and set `maxTasks` to at least N.
614
+
615
+ Running capacity is selected when a parent's first child is created. Restart Atomic after changing this setting to apply the new capacity.
611
616
 
612
617
  ### `defaultSessionDir`
613
618
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/subagents",
3
- "version": "0.9.38-alpha.7",
3
+ "version": "0.9.38-alpha.9",
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": [
@@ -8539,6 +8539,7 @@ function resolveTempScopeId(options) {
8539
8539
  }
8540
8540
  var MAX_PARALLEL_TASKS = 50;
8541
8541
  var MAX_CONCURRENCY = 3;
8542
+ var DEFAULT_RUNNING_CAPACITY = 4;
8542
8543
  var TEMP_ROOT_DIR = path6.join(os4.tmpdir(), `${APP_NAME2}-subagents-${resolveTempScopeId()}`);
8543
8544
  var TEMP_ARTIFACTS_DIR = path6.join(TEMP_ROOT_DIR, "artifacts");
8544
8545
  var SLASH_RESULT_TYPE = "subagent-slash-result";
@@ -8556,12 +8557,14 @@ function normalizeTopLevelParallelValue(value) {
8556
8557
  return parsed;
8557
8558
  }
8558
8559
  function resolveTopLevelParallelMaxTasks(value) {
8559
- const configuredMax = normalizeTopLevelParallelValue(value);
8560
- return configuredMax === undefined ? MAX_PARALLEL_TASKS : Math.min(configuredMax, MAX_PARALLEL_TASKS);
8560
+ return normalizeTopLevelParallelValue(value) ?? MAX_PARALLEL_TASKS;
8561
8561
  }
8562
8562
  function resolveTopLevelParallelConcurrency(override, configValue) {
8563
8563
  return normalizeTopLevelParallelValue(override) ?? normalizeTopLevelParallelValue(configValue) ?? MAX_CONCURRENCY;
8564
8564
  }
8565
+ function resolveTopLevelParallelRunningCapacity(value) {
8566
+ return normalizeTopLevelParallelValue(value) ?? DEFAULT_RUNNING_CAPACITY;
8567
+ }
8565
8568
  function wrapForkTask(task, preamble) {
8566
8569
  if (preamble === false)
8567
8570
  return task;
@@ -10903,10 +10906,10 @@ class SubagentControlRuntime {
10903
10906
  deliveredEnvelopes = new Map;
10904
10907
  killedChildren = new Set;
10905
10908
  nextAttemptId = 1;
10906
- constructor(parent, sessionRoot) {
10909
+ constructor(parent, sessionRoot, runningCapacity) {
10907
10910
  this.parent = { ...parent };
10908
10911
  this.sessionRoot = trustedSessionRoot(this.parent, sessionRoot);
10909
- this.native = new SubagentControl(this.parent.path);
10912
+ this.native = new SubagentControl(this.parent.path, runningCapacity);
10910
10913
  }
10911
10914
  registerAgents(agents) {
10912
10915
  for (const agent of agents)
@@ -11494,17 +11497,17 @@ class SubagentControlRuntime {
11494
11497
  } catch {}
11495
11498
  }
11496
11499
  }
11497
- function createSubagentControl(parent, sessionRoot) {
11498
- return new SubagentControlRuntime(parent, sessionRoot);
11500
+ function createSubagentControl(parent, sessionRoot, runningCapacity) {
11501
+ return new SubagentControlRuntime(parent, sessionRoot, runningCapacity);
11499
11502
  }
11500
11503
 
11501
11504
  // dist/builtin/subagents/src/runs/inprocess/control-registry.ts
11502
11505
  var controls = new Map;
11503
- function getOrCreateSubagentControl(parent, sessionRoot) {
11506
+ function getOrCreateSubagentControl(parent, sessionRoot, runningCapacity) {
11504
11507
  const existing = controls.get(parent.path);
11505
11508
  if (existing)
11506
11509
  return existing;
11507
- const control = createSubagentControl(parent, sessionRoot);
11510
+ const control = createSubagentControl(parent, sessionRoot, runningCapacity);
11508
11511
  controls.set(parent.path, control);
11509
11512
  return control;
11510
11513
  }
@@ -13924,6 +13927,7 @@ async function runForegroundParallelTasks(input) {
13924
13927
  const taskAgents = input.agentConfigs && agentConfig ? [agentConfig] : input.agents;
13925
13928
  const sharedProgress = index === input.behaviors.findIndex((candidate) => candidate.progress) ? join19(input.paramsCwd, "progress.md") : undefined;
13926
13929
  const runOptions = {
13930
+ runningCapacity: input.runningCapacity,
13927
13931
  getChildSessionOptions: input.ctx.getChildSessionOptions,
13928
13932
  resourceLoaderInheritanceSnapshot: input.resourceLoaderInheritanceSnapshot,
13929
13933
  cwd: taskCwd,
@@ -14524,7 +14528,12 @@ async function runParallelPath(data, deps) {
14524
14528
  const parallelConcurrency = resolveTopLevelParallelConcurrency(params.concurrency, deps.config.parallel?.concurrency);
14525
14529
  if (tasks.length > maxParallelTasks)
14526
14530
  return {
14527
- content: [{ type: "text", text: `Max ${maxParallelTasks} tasks` }],
14531
+ content: [
14532
+ {
14533
+ type: "text",
14534
+ text: `Too many parallel tasks (${tasks.length} after count expansion). Maximum is ${maxParallelTasks} (configure parallel.maxTasks in ~/.atomic/agent/extensions/subagent/config.json).`
14535
+ }
14536
+ ],
14528
14537
  isError: true,
14529
14538
  details: { mode: "parallel", results: [] }
14530
14539
  };
@@ -14682,6 +14691,7 @@ async function runParallelPath(data, deps) {
14682
14691
  sharedAutoIntercomGroup: sharedAutoGroupForSet(params.group, tasks),
14683
14692
  foregroundControl,
14684
14693
  concurrencyLimit: parallelConcurrency,
14694
+ runningCapacity: deps.config.parallel?.runningCapacity,
14685
14695
  parentDepth: data.parentDepth,
14686
14696
  liveResults,
14687
14697
  liveProgress,
@@ -15134,7 +15144,7 @@ async function runSingleInProcess(runtimeCwd, agent, task, options) {
15134
15144
  ...orchestrationContext ? { orchestrationContext } : {}
15135
15145
  };
15136
15146
  const sessionRoot = options.sessionDir ?? join20(options.artifactsDir ?? cwd, ".atomic", "subagents");
15137
- const control = getOrCreateSubagentControl(parent, sessionRoot);
15147
+ const control = getOrCreateSubagentControl(parent, sessionRoot, resolveTopLevelParallelRunningCapacity(options.runningCapacity));
15138
15148
  control.registerAgents([agent]);
15139
15149
  const artifactsDir = options.artifactsDir && options.artifactConfig?.enabled !== false ? options.artifactsDir : undefined;
15140
15150
  const artifactPaths = artifactsDir ? getArtifactPaths(artifactsDir, options.runId, agent.name, options.index) : undefined;
@@ -15536,6 +15546,7 @@ async function runSinglePath(data, deps) {
15536
15546
  try {
15537
15547
  const supervisorAuthorization = await requestSupervisorAuthorization(deps.pi.events, childIntercomTarget, ctx.getChildSessionOptions?.({ tools: agentConfig.tools }));
15538
15548
  const runOptions = {
15549
+ runningCapacity: deps.config.parallel?.runningCapacity,
15539
15550
  getChildSessionOptions: ctx.getChildSessionOptions,
15540
15551
  resourceLoaderInheritanceSnapshot: deps.pi.getResourceLoaderInheritanceSnapshot?.(),
15541
15552
  cwd: effectiveCwd,
@@ -17736,8 +17747,7 @@ var SubagentParams = Type.Object({
17736
17747
  description: `Agent config for create/update. Agent: name, package (optional namespace; runtime name becomes package.name), description, scope ('user'|'project', default 'user'), systemPrompt, systemPromptMode, inheritProjectContext, inheritSkills, defaultContext ('fresh'|'fork'), model, tools (comma-separated), extensions (comma-separated), skills (comma-separated), thinking, output, reads, progress. String values must be valid JSON.`
17737
17748
  })),
17738
17749
  tasks: Type.Optional(Type.Array(TaskItem, {
17739
- maxItems: MAX_PARALLEL_TASKS,
17740
- description: `PARALLEL mode: [{agent, task, count?, output?, outputMode?, reads?, progress?}, ...]. Maximum ${MAX_PARALLEL_TASKS} tasks after count expansion.`
17750
+ description: `PARALLEL mode: [{agent, task, count?, output?, outputMode?, reads?, progress?}, ...]. Maximum tasks after count expansion is configured by parallel.maxTasks (default ${MAX_PARALLEL_TASKS}).`
17741
17751
  })),
17742
17752
  concurrency: Type.Optional(Type.Integer({
17743
17753
  minimum: 1,
@@ -17858,7 +17868,7 @@ function renderSubagentToolResult(result, options, theme, context) {
17858
17868
  const outcomes = response.kind === "parallel" ? response.slots.map((slot) => slot.outcome) : [response];
17859
17869
  const labels = request && !burst ? [
17860
17870
  ...request.agent ? [{ agent: request.agent, task: request.task ?? "" }] : [],
17861
- ...(request.tasks ?? []).flatMap((task) => Array.from({ length: Math.min(50, Math.max(1, task.count ?? 1)) }, () => task))
17871
+ ...(request.tasks ?? []).flatMap((task) => Array.from({ length: Math.max(1, task.count ?? 1) }, () => task))
17862
17872
  ] : [];
17863
17873
  const lines = outcomes.map((outcome, index) => {
17864
17874
  if (outcome.kind === "unstarted")
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/web-access",
3
- "version": "0.9.38-alpha.7",
3
+ "version": "0.9.38-alpha.9",
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,12 @@ 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.8] - 2026-10-17
10
+
11
+ ### Fixed
12
+
13
+ - Fixed `/workflow resume` no longer listing or resuming runs recorded before 0.9.38-alpha.6. The default journal now lists runs from its earlier tables and converts a run only when you resume or inspect it, so opening the journal does no extra work. The earlier tables are left in place, and deleted runs stay deleted. Stage checkpoints that identified their session only by transcript path now resume by that transcript's session ID, so their conversations reopen after sessions are imported into the default store.
14
+
9
15
  ## [0.9.38-alpha.7] - 2026-10-17
10
16
 
11
17
  ### Breaking Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/workflows",
3
- "version": "0.9.38-alpha.7",
3
+ "version": "0.9.38-alpha.9",
4
4
  "private": true,
5
5
  "description": "Atomic extension for multi-stage workflow authoring and execution.",
6
6
  "contributors": [
@@ -0,0 +1,42 @@
1
+ import { type SqliteDatabase, type SqliteExecutor, type SqliteRow } from "@bastani/atomic/storage";
2
+ import { JOURNAL_COLUMNS as c } from "./types.js";
3
+ type LegacyRunRow = SqliteRow & {
4
+ [c.runId]: string;
5
+ [c.headerJson]: string;
6
+ [c.status]: string;
7
+ };
8
+ type LegacyEventRow = SqliteRow & {
9
+ [c.runId]: string;
10
+ [c.seq]: number;
11
+ [c.epoch]: number;
12
+ [c.key]: string | null;
13
+ [c.type]: string;
14
+ [c.payload]: string;
15
+ [c.at]: number;
16
+ };
17
+ /**
18
+ * Runs recorded before #3682, kept in the unprefixed `meta`/`runs`/`events`/`leases` tables.
19
+ *
20
+ * #3682 renamed the journal tables to `wf_*` without reading the old ones, so
21
+ * `/workflow resume` lost every run recorded before 0.9.38-alpha.6. Those runs are
22
+ * listed from the old tables as they are, and a run is converted into `wf_*` only
23
+ * when it is resumed (its lease is claimed), following pi's migrate-on-load pattern.
24
+ * Until then its events are read from the old tables as they are. The schema version and
25
+ * columns are unchanged, so its rows copy verbatim. The old tables are never
26
+ * modified; deleting a legacy run records its ID so it is not listed again.
27
+ */
28
+ export declare class LegacyJournalRuns {
29
+ /** Present only for the unprefixed journal in a database that still has version-1 legacy tables. */
30
+ static open(database: SqliteDatabase): Promise<LegacyJournalRuns | undefined>;
31
+ pending(executor: SqliteExecutor, filter?: {
32
+ cwd?: string;
33
+ }): Promise<LegacyRunRow[]>;
34
+ find(executor: SqliteExecutor, runId: string): Promise<LegacyRunRow | undefined>;
35
+ /** Events of an unconverted legacy run, read in place. */
36
+ events(executor: SqliteExecutor, runId: string, fromSeq: number, limit: number): Promise<LegacyEventRow[]>;
37
+ eventByKey(executor: SqliteExecutor, runId: string, key: string): Promise<LegacyEventRow | undefined>;
38
+ /** Convert one legacy run into `wf_*` inside the caller's transaction; returns whether it did. */
39
+ convert(tx: SqliteExecutor, runId: string): Promise<boolean>;
40
+ markDeleted(tx: SqliteExecutor, runId: string): Promise<void>;
41
+ }
42
+ export {};
@@ -7,6 +7,7 @@ export declare class SqlRunJournal implements RunJournal {
7
7
  private closePromise?;
8
8
  private readonly database;
9
9
  private readonly tables;
10
+ private readonly legacy;
10
11
  private constructor();
11
12
  static open(database: SqliteDatabase, options?: {
12
13
  readonly prefix?: string;
@@ -22,6 +23,8 @@ export declare class SqlRunJournal implements RunJournal {
22
23
  cwd?: string;
23
24
  }): Promise<readonly RunSummary[]>;
24
25
  private requireRun;
26
+ /** Whether this run exists only in the legacy tables, whose events are then read in place. */
27
+ private isUnconvertedLegacyRun;
25
28
  private leaseRow;
26
29
  private grant;
27
30
  acquire(runId: string, holderId: string): Promise<LeaseOutcome>;