@bastani/atomic 0.8.30-alpha.1 → 0.8.30-alpha.3

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 (34) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/builtin/cursor/package.json +2 -2
  3. package/dist/builtin/intercom/package.json +1 -1
  4. package/dist/builtin/mcp/package.json +1 -1
  5. package/dist/builtin/subagents/package.json +1 -1
  6. package/dist/builtin/web-access/package.json +1 -1
  7. package/dist/builtin/workflows/CHANGELOG.md +1 -0
  8. package/dist/builtin/workflows/README.md +1 -1
  9. package/dist/builtin/workflows/package.json +1 -1
  10. package/dist/builtin/workflows/src/runs/foreground/executor.ts +19 -10
  11. package/dist/core/anthropic-thinking-guard.d.ts +15 -0
  12. package/dist/core/anthropic-thinking-guard.d.ts.map +1 -0
  13. package/dist/core/anthropic-thinking-guard.js +205 -0
  14. package/dist/core/anthropic-thinking-guard.js.map +1 -0
  15. package/dist/core/compaction/compaction.d.ts +8 -2
  16. package/dist/core/compaction/compaction.d.ts.map +1 -1
  17. package/dist/core/compaction/compaction.js +19 -3
  18. package/dist/core/compaction/compaction.js.map +1 -1
  19. package/dist/core/compaction/context-compaction.d.ts.map +1 -1
  20. package/dist/core/compaction/context-compaction.js +84 -14
  21. package/dist/core/compaction/context-compaction.js.map +1 -1
  22. package/dist/core/sdk.d.ts.map +1 -1
  23. package/dist/core/sdk.js +15 -3
  24. package/dist/core/sdk.js.map +1 -1
  25. package/dist/core/session-manager.d.ts.map +1 -1
  26. package/dist/core/session-manager.js +22 -28
  27. package/dist/core/session-manager.js.map +1 -1
  28. package/dist/modes/interactive/components/context-compaction-summary-message.d.ts.map +1 -1
  29. package/dist/modes/interactive/components/context-compaction-summary-message.js +2 -2
  30. package/dist/modes/interactive/components/context-compaction-summary-message.js.map +1 -1
  31. package/docs/compaction.md +8 -5
  32. package/docs/session-format.md +1 -1
  33. package/docs/workflows.md +2 -0
  34. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"context-compaction-summary-message.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/context-compaction-summary-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAsB,MAAM,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAEzF,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD;;;GAGG;AACH,MAAM,OAAO,wCAAyC,SAAQ,GAAG;IAKhE,YAAY,MAA+B,EAAE,aAAa,GAAkB,gBAAgB,EAAE;QAC7F,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,CAAC;QAL5C,aAAQ,GAAG,KAAK,CAAC;QAMxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,aAAa,EAAE,CAAC;IACtB,CAAC;IAED,WAAW,CAAC,QAAiB;QAC5B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,aAAa,EAAE,CAAC;IACtB,CAAC;IAEQ,UAAU;QAClB,KAAK,CAAC,UAAU,EAAE,CAAC;QACnB,IAAI,CAAC,aAAa,EAAE,CAAC;IACtB,CAAC;IAEO,aAAa;QACpB,IAAI,CAAC,KAAK,EAAE,CAAC;QAEb,MAAM,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC,oBAAoB,EAAE,6BAA6B,CAAC,CAAC;QAC5E,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACrC,IAAI,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,CAAC,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AAC;IAC5C,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AAClF,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAa;IACvC,OAAO,GAAG,KAAK,CAAC,cAAc,EAAE,UAAU,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AACpE,CAAC;AAED,SAAS,YAAY,CAAC,MAAyD;IAC9E,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC7B,OAAO,WAAW,MAAM,CAAC,OAAO,IAAI,CAAC;IACtC,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;IAC/F,OAAO,iBAAiB,KAAK,SAAS,MAAM,CAAC,OAAO,IAAI,CAAC;AAC1D,CAAC","sourcesContent":["import { Box, Markdown, type MarkdownTheme, Spacer, Text } from \"@earendil-works/pi-tui\";\nimport type { ContextCompactionResult } from \"../../../core/compaction/index.ts\";\nimport { getMarkdownTheme, theme } from \"../theme/theme.ts\";\nimport { keyText } from \"./keybinding-hints.ts\";\n\n/**\n * Component that renders deletion-only context compaction results with the same\n * compact/expanded card treatment as summary compaction messages.\n */\nexport class ContextCompactionSummaryMessageComponent extends Box {\n\tprivate expanded = false;\n\tprivate result: ContextCompactionResult;\n\tprivate markdownTheme: MarkdownTheme;\n\n\tconstructor(result: ContextCompactionResult, markdownTheme: MarkdownTheme = getMarkdownTheme()) {\n\t\tsuper(1, 1, (t) => theme.bg(\"customMessageBg\", t));\n\t\tthis.result = result;\n\t\tthis.markdownTheme = markdownTheme;\n\t\tthis.updateDisplay();\n\t}\n\n\tsetExpanded(expanded: boolean): void {\n\t\tthis.expanded = expanded;\n\t\tthis.updateDisplay();\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\tthis.updateDisplay();\n\t}\n\n\tprivate updateDisplay(): void {\n\t\tthis.clear();\n\n\t\tconst label = theme.fg(\"customMessageLabel\", `\\x1b[1m[compaction]\\x1b[22m`);\n\t\tthis.addChild(new Text(label, 0, 0));\n\t\tthis.addChild(new Spacer(1));\n\n\t\tif (this.expanded) {\n\t\t\tthis.addChild(\n\t\t\t\tnew Markdown(this.expandedMarkdown(), 0, 0, this.markdownTheme, {\n\t\t\t\t\tcolor: (text: string) => theme.fg(\"customMessageText\", text),\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst stats = this.result.stats;\n\t\tconst deleted = formatObjectCount(stats.objectsDeleted);\n\t\tthis.addChild(\n\t\t\tnew Text(\n\t\t\t\ttheme.fg(\n\t\t\t\t\t\"customMessageText\",\n\t\t\t\t\t`Compacted ${deleted}; ${formatInteger(stats.tokensBefore)} → ${formatInteger(stats.tokensAfter)} tokens (${formatPercent(stats.percentReduction)} reduction, `,\n\t\t\t\t) +\n\t\t\t\t\ttheme.fg(\"dim\", keyText(\"app.tools.expand\")) +\n\t\t\t\t\ttheme.fg(\"customMessageText\", \" Expand)\"),\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t),\n\t\t);\n\t}\n\n\tprivate expandedMarkdown(): string {\n\t\tconst stats = this.result.stats;\n\t\tconst deletedTargets = this.result.deletedTargets.slice(0, 8).map((target) => ` - ${formatTarget(target)}`);\n\t\tconst remainingTargets = this.result.deletedTargets.length - deletedTargets.length;\n\t\tif (remainingTargets > 0) {\n\t\t\tdeletedTargets.push(` - … ${remainingTargets} more`);\n\t\t}\n\n\t\tconst lines = [\n\t\t\t\"**Context compacted**\",\n\t\t\t\"\",\n\t\t\t\"Retained transcript content stayed verbatim.\",\n\t\t\t\"\",\n\t\t\t`- Tokens: ${formatInteger(stats.tokensBefore)} → ${formatInteger(stats.tokensAfter)} (${formatPercent(stats.percentReduction)} reduction)`,\n\t\t\t`- Deleted: ${formatObjectCount(stats.objectsDeleted)}`,\n\t\t\t`- Protected: ${this.result.protectedEntryIds.length.toLocaleString()} entr${this.result.protectedEntryIds.length === 1 ? \"y\" : \"ies\"}`,\n\t\t];\n\n\t\tif (this.result.backupPath) {\n\t\t\tlines.push(`- Backup: \\`${this.result.backupPath}\\``);\n\t\t}\n\n\t\tif (deletedTargets.length > 0) {\n\t\t\tlines.push(\"\", \"Deleted targets:\", ...deletedTargets);\n\t\t}\n\n\t\treturn `${lines.join(\"\\n\")}\\n`;\n\t}\n}\n\nfunction formatInteger(value: number): string {\n\treturn Math.round(value).toLocaleString();\n}\n\nfunction formatPercent(value: number): string {\n\tconst rounded = Math.round(value * 10) / 10;\n\treturn `${Number.isInteger(rounded) ? rounded.toFixed(0) : rounded.toFixed(1)}%`;\n}\n\nfunction formatObjectCount(count: number): string {\n\treturn `${count.toLocaleString()} object${count === 1 ? \"\" : \"s\"}`;\n}\n\nfunction formatTarget(target: ContextCompactionResult[\"deletedTargets\"][number]): string {\n\tif (target.kind === \"entry\") {\n\t\treturn `entry \\`${target.entryId}\\``;\n\t}\n\n\tconst block = target.blockIndex === undefined ? \"unknown\" : target.blockIndex.toLocaleString();\n\treturn `content block ${block} in \\`${target.entryId}\\``;\n}\n"]}
1
+ {"version":3,"file":"context-compaction-summary-message.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/context-compaction-summary-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAsB,MAAM,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAEzF,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD;;;GAGG;AACH,MAAM,OAAO,wCAAyC,SAAQ,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,SAAS,YAAY,CAAC,MAAyD;IAC9E,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC7B,OAAO,WAAW,MAAM,CAAC,OAAO,IAAI,CAAC;IACtC,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;IAC/F,OAAO,iBAAiB,KAAK,SAAS,MAAM,CAAC,OAAO,IAAI,CAAC;AAC1D,CAAC","sourcesContent":["import { Box, Markdown, type MarkdownTheme, Spacer, Text } from \"@earendil-works/pi-tui\";\nimport type { ContextCompactionResult } from \"../../../core/compaction/index.ts\";\nimport { getMarkdownTheme, theme } from \"../theme/theme.ts\";\nimport { keyText } from \"./keybinding-hints.ts\";\n\n/**\n * Component that renders deletion-only context compaction results with the same\n * compact/expanded card treatment as summary compaction messages.\n */\nexport class ContextCompactionSummaryMessageComponent extends Box {\n\tprivate expanded = false;\n\tprivate result: ContextCompactionResult;\n\tprivate markdownTheme: MarkdownTheme;\n\n\tconstructor(result: ContextCompactionResult, markdownTheme: MarkdownTheme = getMarkdownTheme()) {\n\t\tsuper(1, 1, (t) => theme.bg(\"customMessageBg\", t));\n\t\tthis.result = result;\n\t\tthis.markdownTheme = markdownTheme;\n\t\tthis.updateDisplay();\n\t}\n\n\tsetExpanded(expanded: boolean): void {\n\t\tthis.expanded = expanded;\n\t\tthis.updateDisplay();\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\tthis.updateDisplay();\n\t}\n\n\tprivate updateDisplay(): void {\n\t\tthis.clear();\n\n\t\tconst label = theme.fg(\"customMessageLabel\", `\\x1b[1m[compaction]\\x1b[22m`);\n\t\tthis.addChild(new Text(label, 0, 0));\n\t\tthis.addChild(new Spacer(1));\n\n\t\tif (this.expanded) {\n\t\t\tthis.addChild(\n\t\t\t\tnew Markdown(this.expandedMarkdown(), 0, 0, this.markdownTheme, {\n\t\t\t\t\tcolor: (text: string) => theme.fg(\"customMessageText\", text),\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst stats = this.result.stats;\n\t\tconst deleted = formatObjectCount(stats.objectsDeleted);\n\t\tthis.addChild(\n\t\t\tnew Text(\n\t\t\t\ttheme.fg(\n\t\t\t\t\t\"customMessageText\",\n\t\t\t\t\t`Compacted ${deleted}; est. transcript ${formatInteger(stats.tokensBefore)} → ${formatInteger(stats.tokensAfter)} tokens (${formatPercent(stats.percentReduction)} reduction, `,\n\t\t\t\t) +\n\t\t\t\t\ttheme.fg(\"dim\", keyText(\"app.tools.expand\")) +\n\t\t\t\t\ttheme.fg(\"customMessageText\", \" Expand)\"),\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t),\n\t\t);\n\t}\n\n\tprivate expandedMarkdown(): string {\n\t\tconst stats = this.result.stats;\n\t\tconst deletedTargets = this.result.deletedTargets.slice(0, 8).map((target) => ` - ${formatTarget(target)}`);\n\t\tconst remainingTargets = this.result.deletedTargets.length - deletedTargets.length;\n\t\tif (remainingTargets > 0) {\n\t\t\tdeletedTargets.push(` - … ${remainingTargets} more`);\n\t\t}\n\n\t\tconst lines = [\n\t\t\t\"**Context compacted**\",\n\t\t\t\"\",\n\t\t\t\"Retained transcript content stayed verbatim.\",\n\t\t\t\"\",\n\t\t\t`- Estimated transcript tokens: ${formatInteger(stats.tokensBefore)} → ${formatInteger(stats.tokensAfter)} (${formatPercent(stats.percentReduction)} reduction)`,\n\t\t\t`- Deleted: ${formatObjectCount(stats.objectsDeleted)}`,\n\t\t\t`- Protected: ${this.result.protectedEntryIds.length.toLocaleString()} entr${this.result.protectedEntryIds.length === 1 ? \"y\" : \"ies\"}`,\n\t\t];\n\n\t\tif (this.result.backupPath) {\n\t\t\tlines.push(`- Backup: \\`${this.result.backupPath}\\``);\n\t\t}\n\n\t\tif (deletedTargets.length > 0) {\n\t\t\tlines.push(\"\", \"Deleted targets:\", ...deletedTargets);\n\t\t}\n\n\t\treturn `${lines.join(\"\\n\")}\\n`;\n\t}\n}\n\nfunction formatInteger(value: number): string {\n\treturn Math.round(value).toLocaleString();\n}\n\nfunction formatPercent(value: number): string {\n\tconst rounded = Math.round(value * 10) / 10;\n\treturn `${Number.isInteger(rounded) ? rounded.toFixed(0) : rounded.toFixed(1)}%`;\n}\n\nfunction formatObjectCount(count: number): string {\n\treturn `${count.toLocaleString()} object${count === 1 ? \"\" : \"s\"}`;\n}\n\nfunction formatTarget(target: ContextCompactionResult[\"deletedTargets\"][number]): string {\n\tif (target.kind === \"entry\") {\n\t\treturn `entry \\`${target.entryId}\\``;\n\t}\n\n\tconst block = target.blockIndex === undefined ? \"unknown\" : target.blockIndex.toLocaleString();\n\treturn `content block ${block} in \\`${target.entryId}\\``;\n}\n"]}
@@ -58,6 +58,8 @@ Verbatim Compaction never asks a model to rewrite the conversation for the main
58
58
  - **Whole entries** such as an old assistant message or obsolete tool result.
59
59
  - **Individual content blocks** inside a multi-block message, such as one stale tool call block while keeping other blocks.
60
60
 
61
+ Replay-sensitive assistant messages that contain `thinking` or `redacted_thinking` blocks are all-or-nothing: Atomic may delete an old thinking-bearing assistant entry when dependency validation allows it, but it will not delete individual sibling blocks from a retained thinking-bearing assistant message. This keeps Anthropic/GitHub Copilot extended-thinking replay byte-for-byte compatible with provider requirements.
62
+
61
63
  Atomic records those targets in an append-only `context_compaction` entry. When the active branch is rebuilt, Atomic filters the targeted objects out and reuses every retained entry/content block unchanged. There is no generated summary, no paraphrasing, and no replacement message inserted.
62
64
 
63
65
  The raw session JSONL remains append-only. Deleted objects stay available in the stored session file and backup snapshot; they are only omitted from future active LLM context on that branch.
@@ -370,9 +372,9 @@ Candidate cumulative deletion request
370
372
 
371
373
 
372
374
  ┌─────────────────────────────────────────────────────────────────────┐
373
- │ Gate 2: thinking-content guard
374
- │ assistant entries containing thinking/redacted_thinking cannot be
375
- │ deleted or partially block-deleted
375
+ │ Gate 2: latest thinking-content guard
376
+ the latest retained assistant with thinking/redacted_thinking
377
+ cannot be entry-deleted or partially content-block-deleted
376
378
  └─────────────────────────────────────────────────────────────────────┘
377
379
 
378
380
 
@@ -405,7 +407,8 @@ Candidate cumulative deletion request
405
407
 
406
408
  ┌─────────────────────────────────────────────────────────────────────┐
407
409
  │ Gate 7: post-reconcile guards │
408
- │ no recent targets, no thinking-bearing assistant targets
410
+ │ no recent targets, no content-block deletion from the latest
411
+ │ retained assistant when it has thinking/redacted_thinking │
409
412
  └─────────────────────────────────────────────────────────────────────┘
410
413
 
411
414
 
@@ -544,7 +547,7 @@ The compaction assistant can only compact by using these internal tools. Exact d
544
547
 
545
548
  The planner is prompted to call `context_compaction_budget` before deleting and after deletion batches. The tool reports the current transcript token estimate as a percentage of the selected model's context window, the configured `compression_ratio`, the projected percentage after selected deletions, current reduction percentage, and how many more estimated tokens must be removed to reach the strict target. With the default `compression_ratio: 0.5`, the strict target is a 50% token reduction.
546
549
 
547
- `context_grep_delete` supports literal or regex matching, skips already-deleted or disallowed context, enforces a per-call `maxMatches` safety cap, can require `expectedMatchCount` when the planner wants an exact-match safety check, and routes every accepted match through the same validation pipeline as exact deletions. Disallowed matches are ignored before `matches`, `expectedMatchCount`, deletion stats, and selected targets are calculated, so a broad regex can still remove safe blocks without counting rejected candidates as removed. `maxMatches` limits only one tool call; there is no cumulative deletion cap across repeated `context_delete` or `context_grep_delete` calls. Exact deletion attempts that target disallowed entries/blocks return an explicit non-terminating tool error with correction guidance. Exact deletion payloads that include unsupported fields such as transcript `text`, block `content`, summaries, or replacement data are rejected as non-id-only requests.
550
+ `context_grep_delete` supports literal or regex matching, skips already-deleted or disallowed context, enforces a per-call `maxMatches` safety cap, can require `expectedMatchCount` when the planner wants an exact-match safety check, and routes every accepted match through the same validation pipeline as exact deletions. Disallowed matches are ignored before `matches`, `expectedMatchCount`, deletion stats, and selected targets are calculated, so a broad regex can still remove safe blocks without counting rejected candidates as removed. This includes the universal latest-retained assistant guard: if the latest retained assistant message contains `thinking` or `redacted_thinking`, neither `context_delete` nor `context_grep_delete` may remove any content block from that assistant message, even a visible text sibling block. `maxMatches` limits only one tool call; there is no cumulative deletion cap across repeated `context_delete` or `context_grep_delete` calls. Exact deletion attempts that target disallowed entries/blocks return an explicit non-terminating tool error with correction guidance. Exact deletion payloads that include unsupported fields such as transcript `text`, block `content`, summaries, or replacement data are rejected as non-id-only requests.
548
551
 
549
552
  Tool calls are cumulative during one compaction run. The assistant can apply several small deletion batches, inspect the updated state, and stop only after the validated stats meet the strict reduction target. Atomic uses the validated tool state as the compaction result; ordinary assistant text is ignored for deletion targets.
550
553
 
@@ -236,7 +236,7 @@ Created by `/compact`, RPC compaction commands, and auto-compaction. Stores Atom
236
236
  {"type":"context_compaction","id":"ctx12345","parentId":"f6g7h8i9","timestamp":"2024-12-03T14:12:00.000Z","promptVersion":1,"deletedTargets":[{"kind":"entry","entryId":"b2c3d4e5"}],"protectedEntryIds":["a1b2c3d4"],"stats":{"objectsBefore":20,"objectsAfter":19,"objectsDeleted":1,"tokensBefore":50000,"tokensAfter":43000,"percentReduction":14},"backupPath":"/path/session.jsonl.2024-12-03T14-12-00-000Z.compact.bak"}
237
237
  ```
238
238
 
239
- `deletedTargets` entries are either whole entries (`{ kind: "entry", entryId }`) or content blocks (`{ kind: "content_block", entryId, blockIndex }`). The JSONL file remains append-only; this is logical deletion for active context rebuild.
239
+ `deletedTargets` entries are either whole entries (`{ kind: "entry", entryId }`) or content blocks (`{ kind: "content_block", entryId, blockIndex }`). Content-block targets are not applied to retained assistant messages that contain `thinking` or `redacted_thinking`; those assistant messages are replay-sensitive for Anthropic-compatible extended-thinking providers and are restored as full content arrays during active context rebuild. The JSONL file remains append-only; this is logical deletion for active context rebuild.
240
240
 
241
241
  ### BranchSummaryEntry
242
242
 
package/docs/workflows.md CHANGED
@@ -1456,6 +1456,8 @@ Use `previous` and `{previous}` for compact handoffs only. If no placeholder is
1456
1456
 
1457
1457
  For large handoffs, write artifacts to files, pass their paths with `reads`, and tell downstream stages to read those files incrementally. Put the instruction in the downstream prompt explicitly, e.g. `Read the file at ${artifactPath} and use only the sections needed for this stage.` Prefer `outputMode: "file-only"` when the parent only needs the artifact path.
1458
1458
 
1459
+ `ctx.parallel` snapshots the current graph frontier when the fan-out starts. Every branch in that call uses the same parent set, including branches dequeued later because of a limited `concurrency` value and branches that continue after an earlier sibling fails with `failFast: false`. Downstream stages then depend on all settled parallel branches instead of accidentally chaining queued siblings behind one another.
1460
+
1459
1461
  ### Fine-Grained Stages
1460
1462
 
1461
1463
  Use `ctx.stage(name, options?)` when `ctx.task` is too coarse and you need direct control over the underlying stage session. `StageContext` supports:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/atomic",
3
- "version": "0.8.30-alpha.1",
3
+ "version": "0.8.30-alpha.3",
4
4
  "description": "Atomic coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "atomicConfig": {
@@ -68,7 +68,7 @@
68
68
  "prepublishOnly": "bun run clean && bun run build"
69
69
  },
70
70
  "dependencies": {
71
- "@bastani/atomic-natives": "0.8.30-alpha.1",
71
+ "@bastani/atomic-natives": "0.8.30-alpha.3",
72
72
  "@bufbuild/protobuf": "^2.0.0",
73
73
  "@earendil-works/pi-agent-core": "^0.79.4",
74
74
  "@earendil-works/pi-ai": "^0.79.4",