@bastani/atomic 0.9.19-alpha.4 → 0.9.19-alpha.6

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 (119) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/builtin/intercom/CHANGELOG.md +6 -0
  3. package/dist/builtin/intercom/broker/client.ts +19 -1
  4. package/dist/builtin/intercom/index.bundle.mjs +8 -1
  5. package/dist/builtin/intercom/package.json +1 -1
  6. package/dist/builtin/mcp/package.json +1 -1
  7. package/dist/builtin/subagents/CHANGELOG.md +12 -0
  8. package/dist/builtin/subagents/README.md +6 -4
  9. package/dist/builtin/subagents/agents/codebase-online-researcher.md +7 -7
  10. package/dist/builtin/subagents/agents/debugger.md +2 -2
  11. package/dist/builtin/subagents/package.json +1 -1
  12. package/dist/builtin/subagents/skills/subagent/SKILL.md +16 -14
  13. package/dist/builtin/subagents/src/extension/index.bundle.mjs +2 -1
  14. package/dist/builtin/web-access/CHANGELOG.md +7 -0
  15. package/dist/builtin/web-access/README.md +31 -24
  16. package/dist/builtin/web-access/index.bundle.mjs +16099 -77
  17. package/dist/builtin/web-access/package.json +2 -1
  18. package/dist/builtin/workflows/CHANGELOG.md +13 -0
  19. package/dist/builtin/workflows/builtin/{chunk-9k3ywfgd.js → chunk-1nbq96fh.js} +18 -18
  20. package/dist/builtin/workflows/builtin/{chunk-ahbntmx2.js → chunk-vhmnzdj9.js} +36 -36
  21. package/dist/builtin/workflows/builtin/{chunk-62v3gg9f.js → chunk-yeee2jrc.js} +11 -11
  22. package/dist/builtin/workflows/builtin/goal.js +1 -1
  23. package/dist/builtin/workflows/builtin/index.js +3 -3
  24. package/dist/builtin/workflows/builtin/open-claude-design.js +1 -1
  25. package/dist/builtin/workflows/builtin/ralph.js +1 -1
  26. package/dist/builtin/workflows/package.json +1 -1
  27. package/dist/builtin/workflows/src/extension/index.bundle.mjs +96 -67
  28. package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
  29. package/dist/core/agent-session-tool-registry.js +10 -0
  30. package/dist/core/agent-session-tool-registry.js.map +1 -1
  31. package/dist/core/bash-executor.js.map +1 -1
  32. package/dist/core/tools/bash.d.ts +1 -1
  33. package/dist/core/tools/bash.d.ts.map +1 -1
  34. package/dist/core/tools/bash.js +3 -2
  35. package/dist/core/tools/bash.js.map +1 -1
  36. package/dist/core/tools/edit.d.ts +3 -0
  37. package/dist/core/tools/edit.d.ts.map +1 -1
  38. package/dist/core/tools/edit.js +91 -12
  39. package/dist/core/tools/edit.js.map +1 -1
  40. package/dist/core/tools/file-mutation-coordinator.d.ts +255 -0
  41. package/dist/core/tools/file-mutation-coordinator.d.ts.map +1 -0
  42. package/dist/core/tools/file-mutation-coordinator.js +300 -0
  43. package/dist/core/tools/file-mutation-coordinator.js.map +1 -0
  44. package/dist/core/tools/file-mutation-queue.d.ts +14 -1
  45. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
  46. package/dist/core/tools/file-mutation-queue.js +15 -3
  47. package/dist/core/tools/file-mutation-queue.js.map +1 -1
  48. package/dist/core/tools/hashline.d.ts +9 -0
  49. package/dist/core/tools/hashline.d.ts.map +1 -1
  50. package/dist/core/tools/hashline.js +12 -1
  51. package/dist/core/tools/hashline.js.map +1 -1
  52. package/dist/core/tools/index.d.ts +9 -1
  53. package/dist/core/tools/index.d.ts.map +1 -1
  54. package/dist/core/tools/index.js +67 -12
  55. package/dist/core/tools/index.js.map +1 -1
  56. package/dist/core/tools/non-minting-snapshot-store.d.ts +49 -0
  57. package/dist/core/tools/non-minting-snapshot-store.d.ts.map +1 -0
  58. package/dist/core/tools/non-minting-snapshot-store.js +64 -0
  59. package/dist/core/tools/non-minting-snapshot-store.js.map +1 -0
  60. package/dist/core/tools/powershell.d.ts +2 -2
  61. package/dist/core/tools/powershell.d.ts.map +1 -1
  62. package/dist/core/tools/powershell.js +2 -5
  63. package/dist/core/tools/powershell.js.map +1 -1
  64. package/dist/core/tools/read-document-extract.js.map +1 -1
  65. package/dist/core/tools/render-utils.js.map +1 -1
  66. package/dist/core/tools/write.d.ts +30 -1
  67. package/dist/core/tools/write.d.ts.map +1 -1
  68. package/dist/core/tools/write.js +97 -8
  69. package/dist/core/tools/write.js.map +1 -1
  70. package/dist/index.d.ts +1 -1
  71. package/dist/index.d.ts.map +1 -1
  72. package/dist/index.js.map +1 -1
  73. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  74. package/dist/modes/interactive/interactive-mode-base.d.ts +1 -0
  75. package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
  76. package/dist/modes/interactive/interactive-mode-base.js +3 -1
  77. package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
  78. package/dist/modes/interactive/interactive-mode-surface.d.ts +1 -1
  79. package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
  80. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
  81. package/dist/modes/interactive/interactive-render-chat.js +28 -4
  82. package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
  83. package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
  84. package/dist/modes/interactive/interactive-startup.js +3 -0
  85. package/dist/modes/interactive/interactive-startup.js.map +1 -1
  86. package/dist/modes/interactive-engine/activity-watchdog.d.ts +2 -2
  87. package/dist/modes/interactive-engine/activity-watchdog.d.ts.map +1 -1
  88. package/dist/modes/interactive-engine/activity-watchdog.js.map +1 -1
  89. package/dist/modes/interactive-engine/engine-diagnostic-view.d.ts +3 -1
  90. package/dist/modes/interactive-engine/engine-diagnostic-view.d.ts.map +1 -1
  91. package/dist/modes/interactive-engine/engine-diagnostic-view.js +11 -0
  92. package/dist/modes/interactive-engine/engine-diagnostic-view.js.map +1 -1
  93. package/dist/modes/interactive-engine/isolated-runtime.js +2 -1
  94. package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
  95. package/dist/modes/rpc/rpc-client-process.d.ts +2 -0
  96. package/dist/modes/rpc/rpc-client-process.d.ts.map +1 -1
  97. package/dist/modes/rpc/rpc-client-process.js +23 -1
  98. package/dist/modes/rpc/rpc-client-process.js.map +1 -1
  99. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  100. package/dist/modes/rpc/rpc-client.js +20 -3
  101. package/dist/modes/rpc/rpc-client.js.map +1 -1
  102. package/dist/utils/markit.d.ts +2 -0
  103. package/dist/utils/markit.d.ts.map +1 -1
  104. package/dist/utils/markit.js +65 -5
  105. package/dist/utils/markit.js.map +1 -1
  106. package/docs/background-tasks.md +14 -10
  107. package/docs/containerization.md +7 -5
  108. package/docs/development.md +11 -0
  109. package/docs/docs.json +1 -0
  110. package/docs/providers.md +1 -1
  111. package/docs/subagents.md +4 -2
  112. package/docs/tools.md +26 -0
  113. package/docs/web-access.md +38 -0
  114. package/docs/workflows/builtins.md +9 -6
  115. package/examples/extensions/gondolin/index.ts +116 -148
  116. package/examples/extensions/gondolin/package.json +1 -1
  117. package/examples/extensions/ssh.ts +56 -34
  118. package/npm-shrinkwrap.json +33 -33
  119. package/package.json +4 -4
@@ -92266,15 +92266,15 @@ var orchestratorModelConfig = {
92266
92266
  fallbackModels: [
92267
92267
  "github-copilot/gpt-6-astra:medium",
92268
92268
  "openai/gpt-6-astra:medium",
92269
- "anthropic/claude-fable-5-1:high",
92270
- "github-copilot/claude-fable-5-1:high",
92269
+ "anthropic/claude-fable-5-1:medium",
92270
+ "github-copilot/claude-fable-5-1:medium",
92271
92271
  "anthropic/claude-opus-5:high",
92272
92272
  "github-copilot/claude-opus-5:high",
92273
- "openai-codex/gpt-5.6-sol:xhigh",
92274
- "github-copilot/gpt-5.6-sol:xhigh",
92275
- "openai/gpt-5.6-sol:xhigh",
92276
- "anthropic/claude-fable-5:high",
92277
- "github-copilot/claude-fable-5:high",
92273
+ "openai-codex/gpt-5.6-sol:high",
92274
+ "github-copilot/gpt-5.6-sol:high",
92275
+ "openai/gpt-5.6-sol:high",
92276
+ "anthropic/claude-fable-5:medium",
92277
+ "github-copilot/claude-fable-5:medium",
92278
92278
  "kimi-coding/k3:max",
92279
92279
  "moonshotai/kimi-k3:max",
92280
92280
  "moonshotai-cn/kimi-k3:max",
@@ -92292,10 +92292,10 @@ var orchestratorModelConfig = {
92292
92292
  "baseten/zai-org/GLM-5.3:high",
92293
92293
  "baseten/zai-org/GLM-5.3-Flash:high",
92294
92294
  "openrouter/openai/gpt-6-astra:medium",
92295
- "openrouter/anthropic/claude-fable-5-1:high",
92295
+ "openrouter/anthropic/claude-fable-5-1:medium",
92296
92296
  "openrouter/anthropic/claude-opus-5:high",
92297
- "openrouter/openai/gpt-5.6-sol:xhigh",
92298
- "openrouter/anthropic/claude-fable-5:high",
92297
+ "openrouter/openai/gpt-5.6-sol:high",
92298
+ "openrouter/anthropic/claude-fable-5:medium",
92299
92299
  "openrouter/moonshotai/kimi-k3:max",
92300
92300
  "openrouter/sakana/fugu-ultra:high",
92301
92301
  "openrouter/openai/gpt-5.5:xhigh",
@@ -92307,19 +92307,19 @@ var orchestratorModelConfig = {
92307
92307
  excludedTools: ["ask_user_question"]
92308
92308
  };
92309
92309
  var reviewerModelConfig = {
92310
- model: "openai-codex/gpt-6-astra:xhigh",
92310
+ model: "openai-codex/gpt-6-astra:high",
92311
92311
  fallbackModels: [
92312
- "github-copilot/gpt-6-astra:xhigh",
92313
- "openai/gpt-6-astra:xhigh",
92312
+ "github-copilot/gpt-6-astra:high",
92313
+ "openai/gpt-6-astra:high",
92314
92314
  "anthropic/claude-fable-5-1:high",
92315
92315
  "github-copilot/claude-fable-5-1:high",
92316
92316
  "anthropic/claude-opus-5:high",
92317
92317
  "github-copilot/claude-opus-5:high",
92318
92318
  "anthropic/claude-fable-5:high",
92319
92319
  "github-copilot/claude-fable-5:high",
92320
- "openai-codex/gpt-5.6-sol:xhigh",
92321
- "github-copilot/gpt-5.6-sol:xhigh",
92322
- "openai/gpt-5.6-sol:xhigh",
92320
+ "openai-codex/gpt-5.6-sol:high",
92321
+ "github-copilot/gpt-5.6-sol:high",
92322
+ "openai/gpt-5.6-sol:high",
92323
92323
  "kimi-coding/k3:max",
92324
92324
  "moonshotai/kimi-k3:max",
92325
92325
  "moonshotai-cn/kimi-k3:max",
@@ -92336,11 +92336,11 @@ var reviewerModelConfig = {
92336
92336
  "zai-coding-cn/glm-5.3-flash:high",
92337
92337
  "baseten/zai-org/GLM-5.3:high",
92338
92338
  "baseten/zai-org/GLM-5.3-Flash:high",
92339
- "openrouter/openai/gpt-6-astra:xhigh",
92339
+ "openrouter/openai/gpt-6-astra:high",
92340
92340
  "openrouter/anthropic/claude-fable-5-1:high",
92341
92341
  "openrouter/anthropic/claude-opus-5:high",
92342
92342
  "openrouter/anthropic/claude-fable-5:high",
92343
- "openrouter/openai/gpt-5.6-sol:xhigh",
92343
+ "openrouter/openai/gpt-5.6-sol:high",
92344
92344
  "openrouter/moonshotai/kimi-k3:max",
92345
92345
  "openrouter/sakana/fugu-ultra:high",
92346
92346
  "openrouter/openai/gpt-5.5:xhigh",
@@ -94429,24 +94429,24 @@ async function runOpenClaudeDesignWorkflow(ctx) {
94429
94429
  }
94430
94430
  };
94431
94431
  const designModelConfig = {
94432
- model: "openai-codex/gpt-6-astra:medium",
94432
+ model: "anthropic/claude-fable-5-1:medium",
94433
94433
  fallbackModels: [
94434
+ "github-copilot/claude-fable-5-1:medium",
94435
+ "openai-codex/gpt-6-astra:medium",
94434
94436
  "github-copilot/gpt-6-astra:medium",
94435
94437
  "openai/gpt-6-astra:medium",
94436
- "anthropic/claude-fable-5-1:high",
94437
- "github-copilot/claude-fable-5-1:high",
94438
94438
  "anthropic/claude-opus-5:high",
94439
94439
  "github-copilot/claude-opus-5:high",
94440
- "anthropic/claude-fable-5:high",
94441
- "github-copilot/claude-fable-5:high",
94440
+ "anthropic/claude-fable-5:medium",
94441
+ "github-copilot/claude-fable-5:medium",
94442
94442
  "kimi-coding/k3:max",
94443
94443
  "moonshotai/kimi-k3:max",
94444
94444
  "moonshotai-cn/kimi-k3:max",
94445
94445
  "anthropic/claude-opus-4-8:high",
94446
94446
  "github-copilot/claude-opus-4.8:high",
94447
- "openai-codex/gpt-5.6-sol:xhigh",
94448
- "github-copilot/gpt-5.6-sol:xhigh",
94449
- "openai/gpt-5.6-sol:xhigh",
94447
+ "openai-codex/gpt-5.6-sol:high",
94448
+ "github-copilot/gpt-5.6-sol:high",
94449
+ "openai/gpt-5.6-sol:high",
94450
94450
  "xai/grok-4.6:xhigh",
94451
94451
  "github-copilot/grok-4.6:xhigh",
94452
94452
  "zai/glm-5.3:high",
@@ -94455,13 +94455,13 @@ async function runOpenClaudeDesignWorkflow(ctx) {
94455
94455
  "zai-coding-cn/glm-5.3-flash:high",
94456
94456
  "baseten/zai-org/GLM-5.3:high",
94457
94457
  "baseten/zai-org/GLM-5.3-Flash:high",
94458
+ "openrouter/anthropic/claude-fable-5-1:medium",
94458
94459
  "openrouter/openai/gpt-6-astra:medium",
94459
- "openrouter/anthropic/claude-fable-5-1:high",
94460
94460
  "openrouter/anthropic/claude-opus-5:high",
94461
- "openrouter/anthropic/claude-fable-5:high",
94461
+ "openrouter/anthropic/claude-fable-5:medium",
94462
94462
  "openrouter/anthropic/claude-opus-4-8:high",
94463
94463
  "openrouter/moonshotai/kimi-k3:max",
94464
- "openrouter/openai/gpt-5.6-sol:xhigh",
94464
+ "openrouter/openai/gpt-5.6-sol:high",
94465
94465
  "openrouter/sakana/fugu-ultra:high",
94466
94466
  "openrouter/x-ai/grok-4.6:xhigh",
94467
94467
  "openrouter/z-ai/glm-5.3:high",
@@ -95515,15 +95515,15 @@ var researchModelConfig = {
95515
95515
  fallbackModels: [
95516
95516
  "github-copilot/gpt-6-astra:medium",
95517
95517
  "openai/gpt-6-astra:medium",
95518
- "anthropic/claude-fable-5-1:high",
95519
- "github-copilot/claude-fable-5-1:high",
95518
+ "anthropic/claude-fable-5-1:medium",
95519
+ "github-copilot/claude-fable-5-1:medium",
95520
95520
  "anthropic/claude-opus-5:high",
95521
95521
  "github-copilot/claude-opus-5:high",
95522
- "anthropic/claude-fable-5:high",
95523
- "github-copilot/claude-fable-5:high",
95524
- "openai-codex/gpt-5.6-sol:xhigh",
95525
- "github-copilot/gpt-5.6-sol:xhigh",
95526
- "openai/gpt-5.6-sol:xhigh",
95522
+ "anthropic/claude-fable-5:medium",
95523
+ "github-copilot/claude-fable-5:medium",
95524
+ "openai-codex/gpt-5.6-sol:high",
95525
+ "github-copilot/gpt-5.6-sol:high",
95526
+ "openai/gpt-5.6-sol:high",
95527
95527
  "kimi-coding/k3:max",
95528
95528
  "moonshotai/kimi-k3:max",
95529
95529
  "moonshotai-cn/kimi-k3:max",
@@ -95541,10 +95541,10 @@ var researchModelConfig = {
95541
95541
  "baseten/zai-org/GLM-5.3:high",
95542
95542
  "baseten/zai-org/GLM-5.3-Flash:high",
95543
95543
  "openrouter/openai/gpt-6-astra:medium",
95544
- "openrouter/anthropic/claude-fable-5-1:high",
95544
+ "openrouter/anthropic/claude-fable-5-1:medium",
95545
95545
  "openrouter/anthropic/claude-opus-5:high",
95546
- "openrouter/anthropic/claude-fable-5:high",
95547
- "openrouter/openai/gpt-5.6-sol:xhigh",
95546
+ "openrouter/anthropic/claude-fable-5:medium",
95547
+ "openrouter/openai/gpt-5.6-sol:high",
95548
95548
  "openrouter/moonshotai/kimi-k3:max",
95549
95549
  "openrouter/sakana/fugu-ultra:high",
95550
95550
  "openrouter/openai/gpt-5.5:xhigh",
@@ -95560,15 +95560,15 @@ var orchestratorModelConfig2 = {
95560
95560
  fallbackModels: [
95561
95561
  "github-copilot/gpt-6-astra:medium",
95562
95562
  "openai/gpt-6-astra:medium",
95563
- "anthropic/claude-fable-5-1:high",
95564
- "github-copilot/claude-fable-5-1:high",
95563
+ "anthropic/claude-fable-5-1:medium",
95564
+ "github-copilot/claude-fable-5-1:medium",
95565
95565
  "anthropic/claude-opus-5:high",
95566
95566
  "github-copilot/claude-opus-5:high",
95567
- "openai-codex/gpt-5.6-sol:xhigh",
95568
- "github-copilot/gpt-5.6-sol:xhigh",
95569
- "openai/gpt-5.6-sol:xhigh",
95570
- "anthropic/claude-fable-5:high",
95571
- "github-copilot/claude-fable-5:high",
95567
+ "openai-codex/gpt-5.6-sol:high",
95568
+ "github-copilot/gpt-5.6-sol:high",
95569
+ "openai/gpt-5.6-sol:high",
95570
+ "anthropic/claude-fable-5:medium",
95571
+ "github-copilot/claude-fable-5:medium",
95572
95572
  "kimi-coding/k3:max",
95573
95573
  "moonshotai/kimi-k3:max",
95574
95574
  "moonshotai-cn/kimi-k3:max",
@@ -95586,10 +95586,10 @@ var orchestratorModelConfig2 = {
95586
95586
  "baseten/zai-org/GLM-5.3:high",
95587
95587
  "baseten/zai-org/GLM-5.3-Flash:high",
95588
95588
  "openrouter/openai/gpt-6-astra:medium",
95589
- "openrouter/anthropic/claude-fable-5-1:high",
95589
+ "openrouter/anthropic/claude-fable-5-1:medium",
95590
95590
  "openrouter/anthropic/claude-opus-5:high",
95591
- "openrouter/openai/gpt-5.6-sol:xhigh",
95592
- "openrouter/anthropic/claude-fable-5:high",
95591
+ "openrouter/openai/gpt-5.6-sol:high",
95592
+ "openrouter/anthropic/claude-fable-5:medium",
95593
95593
  "openrouter/moonshotai/kimi-k3:max",
95594
95594
  "openrouter/sakana/fugu-ultra:high",
95595
95595
  "openrouter/openai/gpt-5.5:xhigh",
@@ -95604,9 +95604,9 @@ var reviewerAModelConfig = {
95604
95604
  model: "anthropic/claude-fable-5-1:high",
95605
95605
  fallbackModels: [
95606
95606
  "github-copilot/claude-fable-5-1:high",
95607
- "openai-codex/gpt-6-astra:xhigh",
95608
- "github-copilot/gpt-6-astra:xhigh",
95609
- "openai/gpt-6-astra:xhigh",
95607
+ "openai-codex/gpt-6-astra:high",
95608
+ "github-copilot/gpt-6-astra:high",
95609
+ "openai/gpt-6-astra:high",
95610
95610
  "anthropic/claude-opus-5:high",
95611
95611
  "github-copilot/claude-opus-5:high",
95612
95612
  "anthropic/claude-fable-5:high",
@@ -95614,9 +95614,9 @@ var reviewerAModelConfig = {
95614
95614
  "kimi-coding/k3:max",
95615
95615
  "moonshotai/kimi-k3:max",
95616
95616
  "moonshotai-cn/kimi-k3:max",
95617
- "openai-codex/gpt-5.6-sol:xhigh",
95618
- "github-copilot/gpt-5.6-sol:xhigh",
95619
- "openai/gpt-5.6-sol:xhigh",
95617
+ "openai-codex/gpt-5.6-sol:high",
95618
+ "github-copilot/gpt-5.6-sol:high",
95619
+ "openai/gpt-5.6-sol:high",
95620
95620
  "openai-codex/gpt-5.5:xhigh",
95621
95621
  "github-copilot/gpt-5.5:xhigh",
95622
95622
  "openai/gpt-5.5:xhigh",
@@ -95631,11 +95631,11 @@ var reviewerAModelConfig = {
95631
95631
  "baseten/zai-org/GLM-5.3:high",
95632
95632
  "baseten/zai-org/GLM-5.3-Flash:high",
95633
95633
  "openrouter/anthropic/claude-fable-5-1:high",
95634
- "openrouter/openai/gpt-6-astra:xhigh",
95634
+ "openrouter/openai/gpt-6-astra:high",
95635
95635
  "openrouter/anthropic/claude-opus-5:high",
95636
95636
  "openrouter/anthropic/claude-fable-5:high",
95637
95637
  "openrouter/moonshotai/kimi-k3:max",
95638
- "openrouter/openai/gpt-5.6-sol:xhigh",
95638
+ "openrouter/openai/gpt-5.6-sol:high",
95639
95639
  "openrouter/sakana/fugu-ultra:high",
95640
95640
  "openrouter/openai/gpt-5.5:xhigh",
95641
95641
  "openrouter/anthropic/claude-opus-4-8:high",
@@ -95647,19 +95647,19 @@ var reviewerAModelConfig = {
95647
95647
  schema: reviewDecisionSchema2
95648
95648
  };
95649
95649
  var reviewerBModelConfig = {
95650
- model: "openai-codex/gpt-6-astra:xhigh",
95650
+ model: "openai-codex/gpt-6-astra:high",
95651
95651
  fallbackModels: [
95652
- "github-copilot/gpt-6-astra:xhigh",
95653
- "openai/gpt-6-astra:xhigh",
95652
+ "github-copilot/gpt-6-astra:high",
95653
+ "openai/gpt-6-astra:high",
95654
95654
  "anthropic/claude-fable-5-1:high",
95655
95655
  "github-copilot/claude-fable-5-1:high",
95656
95656
  "anthropic/claude-opus-5:high",
95657
95657
  "github-copilot/claude-opus-5:high",
95658
95658
  "anthropic/claude-fable-5:high",
95659
95659
  "github-copilot/claude-fable-5:high",
95660
- "openai-codex/gpt-5.6-sol:xhigh",
95661
- "github-copilot/gpt-5.6-sol:xhigh",
95662
- "openai/gpt-5.6-sol:xhigh",
95660
+ "openai-codex/gpt-5.6-sol:high",
95661
+ "github-copilot/gpt-5.6-sol:high",
95662
+ "openai/gpt-5.6-sol:high",
95663
95663
  "kimi-coding/k3:max",
95664
95664
  "moonshotai/kimi-k3:max",
95665
95665
  "moonshotai-cn/kimi-k3:max",
@@ -95676,11 +95676,11 @@ var reviewerBModelConfig = {
95676
95676
  "zai-coding-cn/glm-5.3-flash:high",
95677
95677
  "baseten/zai-org/GLM-5.3:high",
95678
95678
  "baseten/zai-org/GLM-5.3-Flash:high",
95679
- "openrouter/openai/gpt-6-astra:xhigh",
95679
+ "openrouter/openai/gpt-6-astra:high",
95680
95680
  "openrouter/anthropic/claude-fable-5-1:high",
95681
95681
  "openrouter/anthropic/claude-opus-5:high",
95682
95682
  "openrouter/anthropic/claude-fable-5:high",
95683
- "openrouter/openai/gpt-5.6-sol:xhigh",
95683
+ "openrouter/openai/gpt-5.6-sol:high",
95684
95684
  "openrouter/moonshotai/kimi-k3:max",
95685
95685
  "openrouter/sakana/fugu-ultra:high",
95686
95686
  "openrouter/openai/gpt-5.5:xhigh",
@@ -112462,21 +112462,24 @@ function registerPendingStageIntercomBridge(pi, activeStore) {
112462
112462
  pi.events?.emit?.(PENDING_STAGE_UNDELIVERABLE_EVENT, payload);
112463
112463
  return payload.handled && await payload.completion === true;
112464
112464
  };
112465
+ const announcedRoutes = new Map;
112465
112466
  const announceRoutes = () => {
112466
112467
  if (disposed)
112467
112468
  return;
112469
+ const ownedRunIds = new Set;
112468
112470
  const runs = activeStore.runs();
112469
112471
  for (const run of runs) {
112470
112472
  const rootRunId = durableRootRunIdForRun(runs, run.id);
112471
112473
  if (rootRunId === undefined)
112472
112474
  continue;
112475
+ ownedRunIds.add(run.id);
112473
112476
  const parentRun = runs.find((candidate) => candidate.id === run.parentRunId);
112474
112477
  const boundary = parentRun?.stages.find((stage) => stage.id === run.parentStageId);
112475
112478
  const parent = parentRun === undefined || boundary === undefined ? undefined : {
112476
112479
  runId: parentRun.id,
112477
112480
  stageKeys: [boundary.id, boundary.name].filter((key) => resolveChildRun(runs, parentRun, key)?.id === run.id)
112478
112481
  };
112479
- pi.events?.emit?.(PENDING_STAGE_ROUTE_EVENT, {
112482
+ const announcement = {
112480
112483
  runId: run.id,
112481
112484
  group: workflowInvocationIntercomGroup(rootRunId),
112482
112485
  capability: workflowPendingStageRouteCapability(activeStore, run.id),
@@ -112501,7 +112504,32 @@ function registerPendingStageIntercomBridge(pi, activeStore) {
112501
112504
  }))
112502
112505
  ],
112503
112506
  ...run.id === rootRunId ? { possibleStages: possibleStageRows(runs, rootRunId, run) } : {}
112504
- });
112507
+ };
112508
+ const signature = JSON.stringify(announcement);
112509
+ if (announcedRoutes.get(run.id)?.signature === signature)
112510
+ continue;
112511
+ const entry = { signature };
112512
+ announcedRoutes.set(run.id, entry);
112513
+ try {
112514
+ pi.events?.emit?.(PENDING_STAGE_ROUTE_EVENT, announcement);
112515
+ } catch (error) {
112516
+ if (announcedRoutes.get(run.id) === entry)
112517
+ announcedRoutes.delete(run.id);
112518
+ throw error;
112519
+ }
112520
+ const completion = announcement.completion;
112521
+ if (completion === undefined) {
112522
+ announcedRoutes.delete(run.id);
112523
+ } else {
112524
+ completion.catch(() => {
112525
+ if (announcedRoutes.get(run.id) === entry)
112526
+ announcedRoutes.delete(run.id);
112527
+ });
112528
+ }
112529
+ }
112530
+ for (const runId of announcedRoutes.keys()) {
112531
+ if (!ownedRunIds.has(runId))
112532
+ announcedRoutes.delete(runId);
112505
112533
  }
112506
112534
  sweepPromise = sweepPromise.then(() => settleUndeliverablePendingStageMessages(activeStore, notifyUndeliverable)).then(() => {
112507
112535
  return;
@@ -112586,6 +112614,7 @@ function registerPendingStageIntercomBridge(pi, activeStore) {
112586
112614
  subscription();
112587
112615
  if (typeof stickySubscription === "function")
112588
112616
  stickySubscription();
112617
+ announcedRoutes.clear();
112589
112618
  };
112590
112619
  pi.on?.("session_shutdown", dispose);
112591
112620
  return dispose;
@@ -1 +1 @@
1
- {"version":3,"file":"agent-session-tool-registry.d.ts","sourceRoot":"","sources":["../../src/core/agent-session-tool-registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,IAAI,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAY9F,wBAAgB,oBAAoB,CACnC,IAAI,EAAE,YAAY,EAClB,OAAO,CAAC,EAAE;IAAE,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,wBAAwB,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1E,IAAI,CAuGN;AAED,wBAAgB,aAAa,CAC5B,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE;IACR,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,CAAC;IAC3C,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB,GACC,IAAI,CAqHN;AAED,eAAO,MAAM,+BAA+B;;;CAG3C,CAAC"}
1
+ {"version":3,"file":"agent-session-tool-registry.d.ts","sourceRoot":"","sources":["../../src/core/agent-session-tool-registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,IAAI,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAa9F,wBAAgB,oBAAoB,CACnC,IAAI,EAAE,YAAY,EAClB,OAAO,CAAC,EAAE;IAAE,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,wBAAwB,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1E,IAAI,CAuGN;AAED,wBAAgB,aAAa,CAC5B,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE;IACR,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,CAAC;IAC3C,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB,GACC,IAAI,CA+HN;AAED,eAAO,MAAM,+BAA+B;;;CAG3C,CAAC"}
@@ -3,6 +3,7 @@ import { isMandatoryRuntimeTool, isTrustedMandatoryRuntimeTool } from "./mandato
3
3
  import { ModelRegistry } from "./model-registry.js";
4
4
  import { createSyntheticSourceInfo } from "./source-info.js";
5
5
  import { createLocalBashOperations } from "./tools/bash.js";
6
+ import { buildMutationRequester } from "./tools/file-mutation-coordinator.js";
6
7
  import { createAllToolDefinitions, getDefaultToolNames } from "./tools/index.js";
7
8
  import { createLocalPowerShellOperations } from "./tools/powershell.js";
8
9
  import { resolveSessionTempDirPath } from "./tools/session-temp-dir.js";
@@ -119,6 +120,15 @@ export function _buildRuntime(options) {
119
120
  createToolDefinitionFromAgentTool(tool),
120
121
  ]))
121
122
  : createAllToolDefinitions(this._cwd, {
123
+ // Resolved per execution for the same reason as `sessionTempDir` below: a
124
+ // requester captured at construction would keep a stale session id across
125
+ // fork/branch/resume, which is exactly the relaunch this makes legible.
126
+ resolveMutationRequester: (toolCallId) => buildMutationRequester({
127
+ sessionId: this.sessionManager.getSessionId(),
128
+ ...(this._orchestrationContext ? { orchestration: this._orchestrationContext } : {}),
129
+ ...(this._subagentPolicy?.intercom ? { intercom: this._subagentPolicy.intercom } : {}),
130
+ toolCallId,
131
+ }),
122
132
  read: { autoResizeImages },
123
133
  bash: {
124
134
  commandPrefix: shellCommandPrefix,
@@ -1 +1 @@
1
- {"version":3,"file":"agent-session-tool-registry.js","sourceRoot":"","sources":["../../src/core/agent-session-tool-registry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAuB,mBAAmB,EAAE,MAAM,uBAAuB,C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AC;QACtC,CAAC,CAAC,CAAC,GAAG,mBAAmB,EAAE,CAAC,CAAC;IAC9B,MAAM,mBAAmB,GAAG,OAAO,CAAC,eAAe,IAAI,sBAAsB,CAAC;IAC9E,IAAI,CAAC,oBAAoB,CAAC;QACzB,eAAe,EAAE,mBAAmB;QACpC,wBAAwB,EAAE,OAAO,CAAC,wBAAwB;KAC1D,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC9C,oBAAoB;IACpB,aAAa;CACb,CAAC","sourcesContent":["import type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport type { AgentSessionInternalSurface as AgentSession } from \"./agent-session-methods.ts\";\nimport type { ToolDefinitionEntry } from \"./agent-session-types.ts\";\nimport { ExtensionRunner, type ToolDefinition, wrapRegisteredTools } from \"./extensions/index.js\";\nimport { isMandatoryRuntimeTool, isTrustedMandatoryRuntimeTool } from \"./mandatory-runtime-tools.ts\";\nimport { ModelRegistry } from \"./model-registry.ts\";\nimport { createSyntheticSourceInfo } from \"./source-info.ts\";\nimport { createLocalBashOperations } from \"./tools/bash.js\";\nimport { createAllToolDefinitions, getDefaultToolNames } from \"./tools/index.ts\";\nimport { createLocalPowerShellOperations } from \"./tools/powershell.ts\";\nimport { resolveSessionTempDirPath } from \"./tools/session-temp-dir.ts\";\nimport { createToolDefinitionFromAgentTool } from \"./tools/tool-definition-wrapper.ts\";\n\nexport function _refreshToolRegistry(\n\tthis: AgentSession,\n\toptions?: { activeToolNames?: string[]; includeAllExtensionTools?: boolean },\n): void {\n\tconst previousRegistryNames = new Set(this._toolRegistry.keys());\n\tconst previousActiveToolNames = this.getActiveToolNames();\n\tconst allowedToolNames = this._allowedToolNames;\n\tconst excludedToolNames = this._excludedToolNames;\n\tconst isExposedTool = (name: string): boolean => {\n\t\tif (isMandatoryRuntimeTool(name)) return true;\n\t\tif (allowedToolNames && !allowedToolNames.has(name)) {\n\t\t\treturn false;\n\t\t}\n\t\tif (excludedToolNames?.has(name)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t};\n\n\tconst registeredTools = this._extensionRunner\n\t\t.getAllRegisteredTools()\n\t\t.filter((tool) => !isMandatoryRuntimeTool(tool.definition.name) || isTrustedMandatoryRuntimeTool(tool));\n\tconst allCustomTools = [\n\t\t...registeredTools,\n\t\t...this._customTools\n\t\t\t.filter((definition) => !isMandatoryRuntimeTool(definition.name))\n\t\t\t.map((definition) => ({\n\t\t\t\tdefinition,\n\t\t\t\tsourceInfo: createSyntheticSourceInfo(`<sdk:${definition.name}>`, { source: \"sdk\" }),\n\t\t\t})),\n\t].filter((tool) => isExposedTool(tool.definition.name));\n\tconst definitionRegistry = new Map<string, ToolDefinitionEntry>(\n\t\tArray.from(this._baseToolDefinitions.entries())\n\t\t\t.filter(([name]) => isExposedTool(name))\n\t\t\t.map(([name, definition]) => [\n\t\t\t\tname,\n\t\t\t\t{\n\t\t\t\t\tdefinition,\n\t\t\t\t\tsourceInfo: createSyntheticSourceInfo(`<builtin:${name}>`, { source: \"builtin\" }),\n\t\t\t\t},\n\t\t\t]),\n\t);\n\tfor (const tool of allCustomTools) {\n\t\tdefinitionRegistry.set(tool.definition.name, {\n\t\t\tdefinition: tool.definition,\n\t\t\tsourceInfo: tool.sourceInfo,\n\t\t});\n\t}\n\tthis._toolDefinitions = definitionRegistry;\n\tthis._toolPromptSnippets = new Map(\n\t\tArray.from(definitionRegistry.values())\n\t\t\t.map(({ definition }) => {\n\t\t\t\tconst snippet = this._normalizePromptSnippet(definition.promptSnippet);\n\t\t\t\treturn snippet ? ([definition.name, snippet] as const) : undefined;\n\t\t\t})\n\t\t\t.filter((entry): entry is readonly [string, string] => entry !== undefined),\n\t);\n\tthis._toolPromptGuidelines = new Map(\n\t\tArray.from(definitionRegistry.values())\n\t\t\t.map(({ definition }) => {\n\t\t\t\tconst guidelines = this._normalizePromptGuidelines(definition.promptGuidelines);\n\t\t\t\treturn guidelines.length > 0 ? ([definition.name, guidelines] as const) : undefined;\n\t\t\t})\n\t\t\t.filter((entry): entry is readonly [string, string[]] => entry !== undefined),\n\t);\n\tconst runner = this._extensionRunner;\n\tconst wrappedExtensionTools = wrapRegisteredTools(allCustomTools, runner);\n\tconst wrappedBuiltInTools = wrapRegisteredTools(\n\t\tArray.from(this._baseToolDefinitions.values())\n\t\t\t.filter((definition) => isExposedTool(definition.name))\n\t\t\t.map((definition) => ({\n\t\t\t\tdefinition,\n\t\t\t\tsourceInfo: createSyntheticSourceInfo(`<builtin:${definition.name}>`, { source: \"builtin\" }),\n\t\t\t})),\n\t\trunner,\n\t);\n\n\tconst toolRegistry = new Map(wrappedBuiltInTools.map((tool) => [tool.name, tool]));\n\tfor (const tool of wrappedExtensionTools as AgentTool[]) {\n\t\ttoolRegistry.set(tool.name, tool);\n\t}\n\tthis._toolRegistry = toolRegistry;\n\n\tconst nextActiveToolNames = (\n\t\toptions?.activeToolNames ? [...options.activeToolNames] : [...previousActiveToolNames]\n\t).filter((name) => isExposedTool(name));\n\n\tif (allowedToolNames) {\n\t\tfor (const toolName of this._toolRegistry.keys()) {\n\t\t\tif (allowedToolNames.has(toolName)) {\n\t\t\t\tnextActiveToolNames.push(toolName);\n\t\t\t}\n\t\t}\n\t} else if (options?.includeAllExtensionTools) {\n\t\tfor (const tool of wrappedExtensionTools) {\n\t\t\tnextActiveToolNames.push(tool.name);\n\t\t}\n\t} else if (!options?.activeToolNames) {\n\t\tfor (const toolName of this._toolRegistry.keys()) {\n\t\t\tif (!previousRegistryNames.has(toolName)) {\n\t\t\t\tnextActiveToolNames.push(toolName);\n\t\t\t}\n\t\t}\n\t}\n\n\tthis.setActiveToolsByName([...new Set(nextActiveToolNames)]);\n}\n\nexport function _buildRuntime(\n\tthis: AgentSession,\n\toptions: {\n\t\tactiveToolNames?: string[];\n\t\tflagValues?: Map<string, boolean | string>;\n\t\tincludeAllExtensionTools?: boolean;\n\t\tpreserveRunner?: boolean;\n\t},\n): void {\n\tconst autoResizeImages = this.settingsManager.getImageAutoResize();\n\tconst shellCommandPrefix = this.settingsManager.getShellCommandPrefix();\n\tconst shellPath = this.settingsManager.getShellPath();\n\tconst isAllowedBuiltinTool = (name: string): boolean => {\n\t\tif (this._allowedToolNames && !this._allowedToolNames.has(name)) return false;\n\t\tif (this._excludedToolNames?.has(name)) return false;\n\t\treturn true;\n\t};\n\tconst activeBuiltinTools = (options.activeToolNames ?? [...getDefaultToolNames()]).filter(isAllowedBuiltinTool);\n\t// Resolve ownership per call, just like command execution. Each wait receives\n\t// a stable binding so observation cleanup can finish after session disposal.\n\tconst getTaskOwner = () =>\n\t\tthis._subagentPolicy?.depth && this._subagentPolicy.depth >= 1 ? undefined : this.getAgentTaskHost().ownerBinding;\n\tconst baseToolDefinitions = this._baseToolsOverride\n\t\t? Object.fromEntries(\n\t\t\t\tObject.entries(this._baseToolsOverride).map(([name, tool]) => [\n\t\t\t\t\tname,\n\t\t\t\t\tcreateToolDefinitionFromAgentTool(tool),\n\t\t\t\t]),\n\t\t\t)\n\t\t: createAllToolDefinitions(this._cwd, {\n\t\t\t\tread: { autoResizeImages },\n\t\t\t\tbash: {\n\t\t\t\t\tcommandPrefix: shellCommandPrefix,\n\t\t\t\t\tshellPath,\n\t\t\t\t\tget taskOwner() {\n\t\t\t\t\t\treturn getTaskOwner();\n\t\t\t\t\t},\n\t\t\t\t\t...(!(this._subagentPolicy?.depth && this._subagentPolicy.depth >= 1)\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\toperations: {\n\t\t\t\t\t\t\t\t\texec: (command, cwd, options) =>\n\t\t\t\t\t\t\t\t\t\tcreateLocalBashOperations({\n\t\t\t\t\t\t\t\t\t\t\tshellPath,\n\t\t\t\t\t\t\t\t\t\t\ttaskOwner: this.getAgentTaskHost().ownerBinding,\n\t\t\t\t\t\t\t\t\t\t}).exec(command, cwd, options),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {}),\n\t\t\t\t\tinterceptorEnabled: () => this.settingsManager.getBashInterceptorEnabled(),\n\t\t\t\t\tavailableTools: activeBuiltinTools,\n\t\t\t\t\t// Resolved per execution so bash spill files follow the live\n\t\t\t\t\t// transcript session across fork/branch/resume.\n\t\t\t\t\tsessionTempDir: () => resolveSessionTempDirPath(this.sessionManager.getSessionId()),\n\t\t\t\t\tinterceptor: async (context) => {\n\t\t\t\t\t\tconst result = await this._extensionRunner.emitUserBash({\n\t\t\t\t\t\t\ttype: \"user_bash\",\n\t\t\t\t\t\t\tcommand: context.command,\n\t\t\t\t\t\t\texcludeFromContext: false,\n\t\t\t\t\t\t\tcwd: context.cwd,\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tpowershell: {\n\t\t\t\t\tget taskOwner() {\n\t\t\t\t\t\treturn getTaskOwner();\n\t\t\t\t\t},\n\t\t\t\t\t...(!(this._subagentPolicy?.depth && this._subagentPolicy.depth >= 1)\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\toperations: {\n\t\t\t\t\t\t\t\t\texec: (command, cwd, options) =>\n\t\t\t\t\t\t\t\t\t\tcreateLocalPowerShellOperations({\n\t\t\t\t\t\t\t\t\t\t\ttaskOwner: this.getAgentTaskHost().ownerBinding,\n\t\t\t\t\t\t\t\t\t\t}).exec(command, cwd, options),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {}),\n\t\t\t\t},\n\t\t\t\tkill: {\n\t\t\t\t\ttaskOwner: () => this.getAgentTaskHost().ownerBinding,\n\t\t\t\t},\n\t\t\t\tsearch: {\n\t\t\t\t\tcontextBefore: this.settingsManager.getSearchContextBefore(),\n\t\t\t\t\tcontextAfter: this.settingsManager.getSearchContextAfter(),\n\t\t\t\t},\n\t\t\t});\n\n\tthis._baseToolDefinitions = new Map(\n\t\tObject.entries(baseToolDefinitions).map(([name, tool]) => [name, tool as ToolDefinition]),\n\t);\n\n\tconst extensionsResult = this._resourceLoader.getExtensions();\n\tif (options.flagValues) {\n\t\tfor (const [name, value] of options.flagValues) {\n\t\t\textensionsResult.runtime.flagValues.set(name, value);\n\t\t\textensionsResult.runtime.explicitFlagNames ??= new Set();\n\t\t\textensionsResult.runtime.explicitFlagNames.add(name);\n\t\t}\n\t}\n\n\tif (!options.preserveRunner) {\n\t\tthis._extensionRunner = new ExtensionRunner(\n\t\t\textensionsResult.extensions,\n\t\t\textensionsResult.runtime,\n\t\t\tthis._cwd,\n\t\t\tthis.sessionManager,\n\t\t\tnew ModelRegistry(this._modelRuntime),\n\t\t\tthis._orchestrationContext,\n\t\t\tthis._subagentPolicy,\n\t\t);\n\t\tif (this._extensionRunnerRef) {\n\t\t\tthis._extensionRunnerRef.current = this._extensionRunner;\n\t\t}\n\t\tthis._bindExtensionCore(this._extensionRunner);\n\t\tthis._applyExtensionBindings(this._extensionRunner);\n\t}\n\n\tconst defaultActiveToolNames = this._baseToolsOverride\n\t\t? Object.keys(this._baseToolsOverride)\n\t\t: [...getDefaultToolNames()];\n\tconst baseActiveToolNames = options.activeToolNames ?? defaultActiveToolNames;\n\tthis._refreshToolRegistry({\n\t\tactiveToolNames: baseActiveToolNames,\n\t\tincludeAllExtensionTools: options.includeAllExtensionTools,\n\t});\n}\n\nexport const agentSessionToolRegistryMethods = {\n\t_refreshToolRegistry,\n\t_buildRuntime,\n};\n"]}
1
+ {"version":3,"file":"agent-session-tool-registry.js","sourceRoot":"","sources":["../../src/core/agent-session-tool-registry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAuB,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAClG,OAAO,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AACrG,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D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AG,IAAI,CAAC,gBAAgB,CAAC;QAC1D,CAAC;QACD,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC/C,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,sBAAsB,GAAG,IAAI,CAAC,kBAAkB;QACrD,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC;QACtC,CAAC,CAAC,CAAC,GAAG,mBAAmB,EAAE,CAAC,CAAC;IAC9B,MAAM,mBAAmB,GAAG,OAAO,CAAC,eAAe,IAAI,sBAAsB,CAAC;IAC9E,IAAI,CAAC,oBAAoB,CAAC;QACzB,eAAe,EAAE,mBAAmB;QACpC,wBAAwB,EAAE,OAAO,CAAC,wBAAwB;KAC1D,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC9C,oBAAoB;IACpB,aAAa;CACb,CAAC","sourcesContent":["import type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport type { AgentSessionInternalSurface as AgentSession } from \"./agent-session-methods.ts\";\nimport type { ToolDefinitionEntry } from \"./agent-session-types.ts\";\nimport { ExtensionRunner, type ToolDefinition, wrapRegisteredTools } from \"./extensions/index.js\";\nimport { isMandatoryRuntimeTool, isTrustedMandatoryRuntimeTool } from \"./mandatory-runtime-tools.ts\";\nimport { ModelRegistry } from \"./model-registry.ts\";\nimport { createSyntheticSourceInfo } from \"./source-info.ts\";\nimport { createLocalBashOperations } from \"./tools/bash.js\";\nimport { buildMutationRequester } from \"./tools/file-mutation-coordinator.ts\";\nimport { createAllToolDefinitions, getDefaultToolNames } from \"./tools/index.ts\";\nimport { createLocalPowerShellOperations } from \"./tools/powershell.ts\";\nimport { resolveSessionTempDirPath } from \"./tools/session-temp-dir.ts\";\nimport { createToolDefinitionFromAgentTool } from \"./tools/tool-definition-wrapper.ts\";\n\nexport function _refreshToolRegistry(\n\tthis: AgentSession,\n\toptions?: { activeToolNames?: string[]; includeAllExtensionTools?: boolean },\n): void {\n\tconst previousRegistryNames = new Set(this._toolRegistry.keys());\n\tconst previousActiveToolNames = this.getActiveToolNames();\n\tconst allowedToolNames = this._allowedToolNames;\n\tconst excludedToolNames = this._excludedToolNames;\n\tconst isExposedTool = (name: string): boolean => {\n\t\tif (isMandatoryRuntimeTool(name)) return true;\n\t\tif (allowedToolNames && !allowedToolNames.has(name)) {\n\t\t\treturn false;\n\t\t}\n\t\tif (excludedToolNames?.has(name)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t};\n\n\tconst registeredTools = this._extensionRunner\n\t\t.getAllRegisteredTools()\n\t\t.filter((tool) => !isMandatoryRuntimeTool(tool.definition.name) || isTrustedMandatoryRuntimeTool(tool));\n\tconst allCustomTools = [\n\t\t...registeredTools,\n\t\t...this._customTools\n\t\t\t.filter((definition) => !isMandatoryRuntimeTool(definition.name))\n\t\t\t.map((definition) => ({\n\t\t\t\tdefinition,\n\t\t\t\tsourceInfo: createSyntheticSourceInfo(`<sdk:${definition.name}>`, { source: \"sdk\" }),\n\t\t\t})),\n\t].filter((tool) => isExposedTool(tool.definition.name));\n\tconst definitionRegistry = new Map<string, ToolDefinitionEntry>(\n\t\tArray.from(this._baseToolDefinitions.entries())\n\t\t\t.filter(([name]) => isExposedTool(name))\n\t\t\t.map(([name, definition]) => [\n\t\t\t\tname,\n\t\t\t\t{\n\t\t\t\t\tdefinition,\n\t\t\t\t\tsourceInfo: createSyntheticSourceInfo(`<builtin:${name}>`, { source: \"builtin\" }),\n\t\t\t\t},\n\t\t\t]),\n\t);\n\tfor (const tool of allCustomTools) {\n\t\tdefinitionRegistry.set(tool.definition.name, {\n\t\t\tdefinition: tool.definition,\n\t\t\tsourceInfo: tool.sourceInfo,\n\t\t});\n\t}\n\tthis._toolDefinitions = definitionRegistry;\n\tthis._toolPromptSnippets = new Map(\n\t\tArray.from(definitionRegistry.values())\n\t\t\t.map(({ definition }) => {\n\t\t\t\tconst snippet = this._normalizePromptSnippet(definition.promptSnippet);\n\t\t\t\treturn snippet ? ([definition.name, snippet] as const) : undefined;\n\t\t\t})\n\t\t\t.filter((entry): entry is readonly [string, string] => entry !== undefined),\n\t);\n\tthis._toolPromptGuidelines = new Map(\n\t\tArray.from(definitionRegistry.values())\n\t\t\t.map(({ definition }) => {\n\t\t\t\tconst guidelines = this._normalizePromptGuidelines(definition.promptGuidelines);\n\t\t\t\treturn guidelines.length > 0 ? ([definition.name, guidelines] as const) : undefined;\n\t\t\t})\n\t\t\t.filter((entry): entry is readonly [string, string[]] => entry !== undefined),\n\t);\n\tconst runner = this._extensionRunner;\n\tconst wrappedExtensionTools = wrapRegisteredTools(allCustomTools, runner);\n\tconst wrappedBuiltInTools = wrapRegisteredTools(\n\t\tArray.from(this._baseToolDefinitions.values())\n\t\t\t.filter((definition) => isExposedTool(definition.name))\n\t\t\t.map((definition) => ({\n\t\t\t\tdefinition,\n\t\t\t\tsourceInfo: createSyntheticSourceInfo(`<builtin:${definition.name}>`, { source: \"builtin\" }),\n\t\t\t})),\n\t\trunner,\n\t);\n\n\tconst toolRegistry = new Map(wrappedBuiltInTools.map((tool) => [tool.name, tool]));\n\tfor (const tool of wrappedExtensionTools as AgentTool[]) {\n\t\ttoolRegistry.set(tool.name, tool);\n\t}\n\tthis._toolRegistry = toolRegistry;\n\n\tconst nextActiveToolNames = (\n\t\toptions?.activeToolNames ? [...options.activeToolNames] : [...previousActiveToolNames]\n\t).filter((name) => isExposedTool(name));\n\n\tif (allowedToolNames) {\n\t\tfor (const toolName of this._toolRegistry.keys()) {\n\t\t\tif (allowedToolNames.has(toolName)) {\n\t\t\t\tnextActiveToolNames.push(toolName);\n\t\t\t}\n\t\t}\n\t} else if (options?.includeAllExtensionTools) {\n\t\tfor (const tool of wrappedExtensionTools) {\n\t\t\tnextActiveToolNames.push(tool.name);\n\t\t}\n\t} else if (!options?.activeToolNames) {\n\t\tfor (const toolName of this._toolRegistry.keys()) {\n\t\t\tif (!previousRegistryNames.has(toolName)) {\n\t\t\t\tnextActiveToolNames.push(toolName);\n\t\t\t}\n\t\t}\n\t}\n\n\tthis.setActiveToolsByName([...new Set(nextActiveToolNames)]);\n}\n\nexport function _buildRuntime(\n\tthis: AgentSession,\n\toptions: {\n\t\tactiveToolNames?: string[];\n\t\tflagValues?: Map<string, boolean | string>;\n\t\tincludeAllExtensionTools?: boolean;\n\t\tpreserveRunner?: boolean;\n\t},\n): void {\n\tconst autoResizeImages = this.settingsManager.getImageAutoResize();\n\tconst shellCommandPrefix = this.settingsManager.getShellCommandPrefix();\n\tconst shellPath = this.settingsManager.getShellPath();\n\tconst isAllowedBuiltinTool = (name: string): boolean => {\n\t\tif (this._allowedToolNames && !this._allowedToolNames.has(name)) return false;\n\t\tif (this._excludedToolNames?.has(name)) return false;\n\t\treturn true;\n\t};\n\tconst activeBuiltinTools = (options.activeToolNames ?? [...getDefaultToolNames()]).filter(isAllowedBuiltinTool);\n\t// Resolve ownership per call, just like command execution. Each wait receives\n\t// a stable binding so observation cleanup can finish after session disposal.\n\tconst getTaskOwner = () =>\n\t\tthis._subagentPolicy?.depth && this._subagentPolicy.depth >= 1 ? undefined : this.getAgentTaskHost().ownerBinding;\n\tconst baseToolDefinitions = this._baseToolsOverride\n\t\t? Object.fromEntries(\n\t\t\t\tObject.entries(this._baseToolsOverride).map(([name, tool]) => [\n\t\t\t\t\tname,\n\t\t\t\t\tcreateToolDefinitionFromAgentTool(tool),\n\t\t\t\t]),\n\t\t\t)\n\t\t: createAllToolDefinitions(this._cwd, {\n\t\t\t\t// Resolved per execution for the same reason as `sessionTempDir` below: a\n\t\t\t\t// requester captured at construction would keep a stale session id across\n\t\t\t\t// fork/branch/resume, which is exactly the relaunch this makes legible.\n\t\t\t\tresolveMutationRequester: (toolCallId) =>\n\t\t\t\t\tbuildMutationRequester({\n\t\t\t\t\t\tsessionId: this.sessionManager.getSessionId(),\n\t\t\t\t\t\t...(this._orchestrationContext ? { orchestration: this._orchestrationContext } : {}),\n\t\t\t\t\t\t...(this._subagentPolicy?.intercom ? { intercom: this._subagentPolicy.intercom } : {}),\n\t\t\t\t\t\ttoolCallId,\n\t\t\t\t\t}),\n\t\t\t\tread: { autoResizeImages },\n\t\t\t\tbash: {\n\t\t\t\t\tcommandPrefix: shellCommandPrefix,\n\t\t\t\t\tshellPath,\n\t\t\t\t\tget taskOwner() {\n\t\t\t\t\t\treturn getTaskOwner();\n\t\t\t\t\t},\n\t\t\t\t\t...(!(this._subagentPolicy?.depth && this._subagentPolicy.depth >= 1)\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\toperations: {\n\t\t\t\t\t\t\t\t\texec: (command, cwd, options) =>\n\t\t\t\t\t\t\t\t\t\tcreateLocalBashOperations({\n\t\t\t\t\t\t\t\t\t\t\tshellPath,\n\t\t\t\t\t\t\t\t\t\t\ttaskOwner: this.getAgentTaskHost().ownerBinding,\n\t\t\t\t\t\t\t\t\t\t}).exec(command, cwd, options),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {}),\n\t\t\t\t\tinterceptorEnabled: () => this.settingsManager.getBashInterceptorEnabled(),\n\t\t\t\t\tavailableTools: activeBuiltinTools,\n\t\t\t\t\t// Resolved per execution so bash spill files follow the live\n\t\t\t\t\t// transcript session across fork/branch/resume.\n\t\t\t\t\tsessionTempDir: () => resolveSessionTempDirPath(this.sessionManager.getSessionId()),\n\t\t\t\t\tinterceptor: async (context) => {\n\t\t\t\t\t\tconst result = await this._extensionRunner.emitUserBash({\n\t\t\t\t\t\t\ttype: \"user_bash\",\n\t\t\t\t\t\t\tcommand: context.command,\n\t\t\t\t\t\t\texcludeFromContext: false,\n\t\t\t\t\t\t\tcwd: context.cwd,\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tpowershell: {\n\t\t\t\t\tget taskOwner() {\n\t\t\t\t\t\treturn getTaskOwner();\n\t\t\t\t\t},\n\t\t\t\t\t...(!(this._subagentPolicy?.depth && this._subagentPolicy.depth >= 1)\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\toperations: {\n\t\t\t\t\t\t\t\t\texec: (command, cwd, options) =>\n\t\t\t\t\t\t\t\t\t\tcreateLocalPowerShellOperations({\n\t\t\t\t\t\t\t\t\t\t\ttaskOwner: this.getAgentTaskHost().ownerBinding,\n\t\t\t\t\t\t\t\t\t\t}).exec(command, cwd, options),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {}),\n\t\t\t\t},\n\t\t\t\tkill: {\n\t\t\t\t\ttaskOwner: () => this.getAgentTaskHost().ownerBinding,\n\t\t\t\t},\n\t\t\t\tsearch: {\n\t\t\t\t\tcontextBefore: this.settingsManager.getSearchContextBefore(),\n\t\t\t\t\tcontextAfter: this.settingsManager.getSearchContextAfter(),\n\t\t\t\t},\n\t\t\t});\n\n\tthis._baseToolDefinitions = new Map(\n\t\tObject.entries(baseToolDefinitions).map(([name, tool]) => [name, tool as ToolDefinition]),\n\t);\n\n\tconst extensionsResult = this._resourceLoader.getExtensions();\n\tif (options.flagValues) {\n\t\tfor (const [name, value] of options.flagValues) {\n\t\t\textensionsResult.runtime.flagValues.set(name, value);\n\t\t\textensionsResult.runtime.explicitFlagNames ??= new Set();\n\t\t\textensionsResult.runtime.explicitFlagNames.add(name);\n\t\t}\n\t}\n\n\tif (!options.preserveRunner) {\n\t\tthis._extensionRunner = new ExtensionRunner(\n\t\t\textensionsResult.extensions,\n\t\t\textensionsResult.runtime,\n\t\t\tthis._cwd,\n\t\t\tthis.sessionManager,\n\t\t\tnew ModelRegistry(this._modelRuntime),\n\t\t\tthis._orchestrationContext,\n\t\t\tthis._subagentPolicy,\n\t\t);\n\t\tif (this._extensionRunnerRef) {\n\t\t\tthis._extensionRunnerRef.current = this._extensionRunner;\n\t\t}\n\t\tthis._bindExtensionCore(this._extensionRunner);\n\t\tthis._applyExtensionBindings(this._extensionRunner);\n\t}\n\n\tconst defaultActiveToolNames = this._baseToolsOverride\n\t\t? Object.keys(this._baseToolsOverride)\n\t\t: [...getDefaultToolNames()];\n\tconst baseActiveToolNames = options.activeToolNames ?? defaultActiveToolNames;\n\tthis._refreshToolRegistry({\n\t\tactiveToolNames: baseActiveToolNames,\n\t\tincludeAllExtensionTools: options.includeAllExtensionTools,\n\t});\n}\n\nexport const agentSessionToolRegistryMethods = {\n\t_refreshToolRegistry,\n\t_buildRuntime,\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"bash-executor.js","sourceRoot":"","sources":["../../src/core/bash-executor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAmCtE,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC9C,OAAe,EACf,GAAW,EACX,UAA0B,EAC1B,OAA6B;IAE7B,MAAM,YAAY,GAAa,EAAE,CAAC;IAClC,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,MAAM,cAAc,GAAG,iBAAiB,GAAG,CAAC,CAAC;IAE7C,IAAI,YAAgC,CAAC;IACrC,IAAI,QAAyC,CAAC;IAC9C,IAAI,UAAU,GAAG,CAAC,CAA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["/**\n * Bash command execution with streaming support and cancellation.\n *\n * This module provides a unified bash execution implementation used by:\n * - AgentSession.executeBash() for interactive and RPC modes\n * - Direct calls from modes that need bash execution\n */\n\nimport { randomBytes } from \"node:crypto\";\nimport { join } from \"node:path\";\nimport { APP_NAME } from \"../config.js\";\nimport { stripAnsi } from \"../utils/ansi.ts\";\nimport { sanitizeBinaryOutput } from \"../utils/shell.ts\";\nimport type { BashOperations, BashOutputChannel } from \"./tools/bash.js\";\nimport { PersistedOutputFile } from \"./tools/persisted-output-file.ts\";\nimport { ensureSessionTempDir } from \"./tools/session-temp-dir.ts\";\nimport { DEFAULT_MAX_BYTES, truncateTail } from \"./tools/truncate.ts\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface BashExecutorOptions {\n\t/** Callback for streaming output chunks (already sanitized), preserving the source channel. */\n\tonChunk?: (chunk: string, channel: BashOutputChannel) => void;\n\t/** AbortSignal for cancellation */\n\tsignal?: AbortSignal;\n\t/** Complete environment for the execution backend. */\n\tenv?: NodeJS.ProcessEnv;\n\t/** Run with PTY handling when supported by the operations backend */\n\tpty?: boolean;\n\t/**\n\t * Session-scoped directory for the overflow log. Defaults to the active\n\t * session's temp directory so the log is reaped with that session.\n\t */\n\tsessionTempDir?: string;\n}\n\nexport interface BashResult {\n\t/** Combined stdout + stderr output (sanitized, possibly truncated) */\n\toutput: string;\n\t/** Process exit code (undefined if killed/cancelled) */\n\texitCode: number | undefined;\n\t/** Whether the command was cancelled via signal */\n\tcancelled: boolean;\n\t/** Whether the output was truncated */\n\ttruncated: boolean;\n\t/** Path to temp file containing full output (if output exceeded truncation threshold) */\n\tfullOutputPath?: string;\n}\n\n// ============================================================================\n// Implementation\n// ============================================================================\n\n/**\n * Execute a bash command using custom BashOperations.\n * Used for remote execution (SSH, containers, etc.).\n */\nexport async function executeBashWithOperations(\n\tcommand: string,\n\tcwd: string,\n\toperations: BashOperations,\n\toptions?: BashExecutorOptions,\n): Promise<BashResult> {\n\tconst outputChunks: string[] = [];\n\tlet outputBytes = 0;\n\tconst maxOutputBytes = DEFAULT_MAX_BYTES * 2;\n\n\tlet tempFilePath: string | undefined;\n\tlet tempFile: PersistedOutputFile | undefined;\n\tlet totalBytes = 0;\n\n\tlet tempFileUnavailable = false;\n\n\tconst ensureTempFile = () => {\n\t\tif (tempFilePath || tempFileUnavailable) {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tconst dir = ensureSessionTempDir(options?.sessionTempDir);\n\t\t\tconst id = randomBytes(8).toString(\"hex\");\n\t\t\ttempFilePath = join(dir, `${APP_NAME}-bash-${id}.log`);\n\t\t\ttempFile = new PersistedOutputFile(tempFilePath);\n\t\t} catch {\n\t\t\t// The session temp directory was refused (see ensureTempDir). Run without\n\t\t\t// an overflow log rather than advertising a path outside the owned tree.\n\t\t\ttempFileUnavailable = true;\n\t\t\ttempFilePath = undefined;\n\t\t\ttempFile = undefined;\n\t\t\treturn;\n\t\t}\n\t\tfor (const chunk of outputChunks) {\n\t\t\ttempFile.write(chunk);\n\t\t}\n\t};\n\n\t/**\n\t * Close the overflow log and confirm it landed. A spill file that failed to\n\t * write must not be advertised: `fullOutputPath` is dropped instead, so the\n\t * `Full output:` contract never points at a file that is not there.\n\t */\n\tconst finishTempFile = async () => {\n\t\tconst file = tempFile;\n\t\tif (!file) {\n\t\t\treturn;\n\t\t}\n\t\ttempFile = undefined;\n\t\ttry {\n\t\t\tawait file.close();\n\t\t} catch {\n\t\t\ttempFilePath = undefined;\n\t\t}\n\t};\n\n\tconst decoders: Record<BashOutputChannel, TextDecoder> = { stdout: new TextDecoder(), stderr: new TextDecoder() };\n\tconst onData = (data: Buffer, channel: BashOutputChannel = \"stdout\") => {\n\t\ttotalBytes += data.length;\n\n\t\t// Sanitize: strip ANSI, replace binary garbage, normalize newlines\n\t\tconst text = sanitizeBinaryOutput(stripAnsi(decoders[channel].decode(data, { stream: true }))).replace(/\\r/g, \"\");\n\n\t\t// Start writing to temp file if exceeds threshold\n\t\tif (totalBytes > DEFAULT_MAX_BYTES) {\n\t\t\tensureTempFile();\n\t\t}\n\n\t\tif (tempFile) {\n\t\t\ttempFile.write(text);\n\t\t}\n\n\t\t// Keep rolling buffer\n\t\toutputChunks.push(text);\n\t\toutputBytes += text.length;\n\t\twhile (outputBytes > maxOutputBytes && outputChunks.length > 1) {\n\t\t\tconst removed = outputChunks.shift()!;\n\t\t\toutputBytes -= removed.length;\n\t\t}\n\n\t\t// Stream to callback\n\t\tif (options?.onChunk) {\n\t\t\toptions.onChunk(text, channel);\n\t\t}\n\t};\n\n\ttry {\n\t\tconst result = await operations.exec(command, cwd, {\n\t\t\tonData,\n\t\t\tsignal: options?.signal,\n\t\t\tenv: options?.env,\n\t\t\tpty: options?.pty,\n\t\t});\n\n\t\tconst fullOutput = outputChunks.join(\"\");\n\t\tconst truncationResult = truncateTail(fullOutput);\n\t\tif (truncationResult.truncated) {\n\t\t\tensureTempFile();\n\t\t}\n\t\tawait finishTempFile();\n\t\tconst cancelled = options?.signal?.aborted ?? false;\n\n\t\treturn {\n\t\t\toutput: truncationResult.truncated ? truncationResult.content : fullOutput,\n\t\t\texitCode: cancelled ? undefined : (result.exitCode ?? undefined),\n\t\t\tcancelled,\n\t\t\ttruncated: truncationResult.truncated,\n\t\t\tfullOutputPath: tempFilePath,\n\t\t};\n\t} catch (err) {\n\t\t// Check if it was an abort\n\t\tif (options?.signal?.aborted) {\n\t\t\tconst fullOutput = outputChunks.join(\"\");\n\t\t\tconst truncationResult = truncateTail(fullOutput);\n\t\t\tif (truncationResult.truncated) {\n\t\t\t\tensureTempFile();\n\t\t\t}\n\t\t\tawait finishTempFile();\n\t\t\treturn {\n\t\t\t\toutput: truncationResult.truncated ? truncationResult.content : fullOutput,\n\t\t\t\texitCode: undefined,\n\t\t\t\tcancelled: true,\n\t\t\t\ttruncated: truncationResult.truncated,\n\t\t\t\tfullOutputPath: tempFilePath,\n\t\t\t};\n\t\t}\n\n\t\tawait finishTempFile();\n\n\t\tthrow err;\n\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AC,UAAU;YAC1E,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,IAAI,SAAS,CAAC;YAChE,SAAS;YACT,SAAS,EAAE,gBAAgB,CAAC,SAAS;YACrC,cAAc,EAAE,YAAY;SAC5B,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,2BAA2B;QAC3B,IAAI,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;YAC9B,MAAM,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACzC,MAAM,gBAAgB,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;YAClD,IAAI,gBAAgB,CAAC,SAAS,EAAE,CAAC;gBAChC,cAAc,EAAE,CAAC;YAClB,CAAC;YACD,MAAM,cAAc,EAAE,CAAC;YACvB,OAAO;gBACN,MAAM,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU;gBAC1E,QAAQ,EAAE,SAAS;gBACnB,SAAS,EAAE,IAAI;gBACf,SAAS,EAAE,gBAAgB,CAAC,SAAS;gBACrC,cAAc,EAAE,YAAY;aAC5B,CAAC;QACH,CAAC;QAED,MAAM,cAAc,EAAE,CAAC;QAEvB,MAAM,GAAG,CAAC;IACX,CAAC;AACF,CAAC","sourcesContent":["/**\n * Bash command execution with streaming support and cancellation.\n *\n * This module provides a unified bash execution implementation used by:\n * - AgentSession.executeBash() for interactive and RPC modes\n * - Direct calls from modes that need bash execution\n */\n\nimport { randomBytes } from \"node:crypto\";\nimport { join } from \"node:path\";\nimport { APP_NAME } from \"../config.js\";\nimport { stripAnsi } from \"../utils/ansi.js\";\nimport { sanitizeBinaryOutput } from \"../utils/shell.ts\";\nimport type { BashOperations, BashOutputChannel } from \"./tools/bash.js\";\nimport { PersistedOutputFile } from \"./tools/persisted-output-file.ts\";\nimport { ensureSessionTempDir } from \"./tools/session-temp-dir.ts\";\nimport { DEFAULT_MAX_BYTES, truncateTail } from \"./tools/truncate.ts\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface BashExecutorOptions {\n\t/** Callback for streaming output chunks (already sanitized), preserving the source channel. */\n\tonChunk?: (chunk: string, channel: BashOutputChannel) => void;\n\t/** AbortSignal for cancellation */\n\tsignal?: AbortSignal;\n\t/** Complete environment for the execution backend. */\n\tenv?: NodeJS.ProcessEnv;\n\t/** Run with PTY handling when supported by the operations backend */\n\tpty?: boolean;\n\t/**\n\t * Session-scoped directory for the overflow log. Defaults to the active\n\t * session's temp directory so the log is reaped with that session.\n\t */\n\tsessionTempDir?: string;\n}\n\nexport interface BashResult {\n\t/** Combined stdout + stderr output (sanitized, possibly truncated) */\n\toutput: string;\n\t/** Process exit code (undefined if killed/cancelled) */\n\texitCode: number | undefined;\n\t/** Whether the command was cancelled via signal */\n\tcancelled: boolean;\n\t/** Whether the output was truncated */\n\ttruncated: boolean;\n\t/** Path to temp file containing full output (if output exceeded truncation threshold) */\n\tfullOutputPath?: string;\n}\n\n// ============================================================================\n// Implementation\n// ============================================================================\n\n/**\n * Execute a bash command using custom BashOperations.\n * Used for remote execution (SSH, containers, etc.).\n */\nexport async function executeBashWithOperations(\n\tcommand: string,\n\tcwd: string,\n\toperations: BashOperations,\n\toptions?: BashExecutorOptions,\n): Promise<BashResult> {\n\tconst outputChunks: string[] = [];\n\tlet outputBytes = 0;\n\tconst maxOutputBytes = DEFAULT_MAX_BYTES * 2;\n\n\tlet tempFilePath: string | undefined;\n\tlet tempFile: PersistedOutputFile | undefined;\n\tlet totalBytes = 0;\n\n\tlet tempFileUnavailable = false;\n\n\tconst ensureTempFile = () => {\n\t\tif (tempFilePath || tempFileUnavailable) {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tconst dir = ensureSessionTempDir(options?.sessionTempDir);\n\t\t\tconst id = randomBytes(8).toString(\"hex\");\n\t\t\ttempFilePath = join(dir, `${APP_NAME}-bash-${id}.log`);\n\t\t\ttempFile = new PersistedOutputFile(tempFilePath);\n\t\t} catch {\n\t\t\t// The session temp directory was refused (see ensureTempDir). Run without\n\t\t\t// an overflow log rather than advertising a path outside the owned tree.\n\t\t\ttempFileUnavailable = true;\n\t\t\ttempFilePath = undefined;\n\t\t\ttempFile = undefined;\n\t\t\treturn;\n\t\t}\n\t\tfor (const chunk of outputChunks) {\n\t\t\ttempFile.write(chunk);\n\t\t}\n\t};\n\n\t/**\n\t * Close the overflow log and confirm it landed. A spill file that failed to\n\t * write must not be advertised: `fullOutputPath` is dropped instead, so the\n\t * `Full output:` contract never points at a file that is not there.\n\t */\n\tconst finishTempFile = async () => {\n\t\tconst file = tempFile;\n\t\tif (!file) {\n\t\t\treturn;\n\t\t}\n\t\ttempFile = undefined;\n\t\ttry {\n\t\t\tawait file.close();\n\t\t} catch {\n\t\t\ttempFilePath = undefined;\n\t\t}\n\t};\n\n\tconst decoders: Record<BashOutputChannel, TextDecoder> = { stdout: new TextDecoder(), stderr: new TextDecoder() };\n\tconst onData = (data: Buffer, channel: BashOutputChannel = \"stdout\") => {\n\t\ttotalBytes += data.length;\n\n\t\t// Sanitize: strip ANSI, replace binary garbage, normalize newlines\n\t\tconst text = sanitizeBinaryOutput(stripAnsi(decoders[channel].decode(data, { stream: true }))).replace(/\\r/g, \"\");\n\n\t\t// Start writing to temp file if exceeds threshold\n\t\tif (totalBytes > DEFAULT_MAX_BYTES) {\n\t\t\tensureTempFile();\n\t\t}\n\n\t\tif (tempFile) {\n\t\t\ttempFile.write(text);\n\t\t}\n\n\t\t// Keep rolling buffer\n\t\toutputChunks.push(text);\n\t\toutputBytes += text.length;\n\t\twhile (outputBytes > maxOutputBytes && outputChunks.length > 1) {\n\t\t\tconst removed = outputChunks.shift()!;\n\t\t\toutputBytes -= removed.length;\n\t\t}\n\n\t\t// Stream to callback\n\t\tif (options?.onChunk) {\n\t\t\toptions.onChunk(text, channel);\n\t\t}\n\t};\n\n\ttry {\n\t\tconst result = await operations.exec(command, cwd, {\n\t\t\tonData,\n\t\t\tsignal: options?.signal,\n\t\t\tenv: options?.env,\n\t\t\tpty: options?.pty,\n\t\t});\n\n\t\tconst fullOutput = outputChunks.join(\"\");\n\t\tconst truncationResult = truncateTail(fullOutput);\n\t\tif (truncationResult.truncated) {\n\t\t\tensureTempFile();\n\t\t}\n\t\tawait finishTempFile();\n\t\tconst cancelled = options?.signal?.aborted ?? false;\n\n\t\treturn {\n\t\t\toutput: truncationResult.truncated ? truncationResult.content : fullOutput,\n\t\t\texitCode: cancelled ? undefined : (result.exitCode ?? undefined),\n\t\t\tcancelled,\n\t\t\ttruncated: truncationResult.truncated,\n\t\t\tfullOutputPath: tempFilePath,\n\t\t};\n\t} catch (err) {\n\t\t// Check if it was an abort\n\t\tif (options?.signal?.aborted) {\n\t\t\tconst fullOutput = outputChunks.join(\"\");\n\t\t\tconst truncationResult = truncateTail(fullOutput);\n\t\t\tif (truncationResult.truncated) {\n\t\t\t\tensureTempFile();\n\t\t\t}\n\t\t\tawait finishTempFile();\n\t\t\treturn {\n\t\t\t\toutput: truncationResult.truncated ? truncationResult.content : fullOutput,\n\t\t\t\texitCode: undefined,\n\t\t\t\tcancelled: true,\n\t\t\t\ttruncated: truncationResult.truncated,\n\t\t\t\tfullOutputPath: tempFilePath,\n\t\t\t};\n\t\t}\n\n\t\tawait finishTempFile();\n\n\t\tthrow err;\n\t}\n}\n"]}
@@ -27,7 +27,7 @@ type ShellWaitInput = {
27
27
  declare const bashSchema: Type.TUnsafe<ShellCommandInput | ShellWaitInput>;
28
28
  export declare const bashToolSystemPromptContribution: Readonly<{
29
29
  readonly snippet: "Execute a shell command.";
30
- readonly guidelines: readonly ["You can inspect ATOMIC_* or PI_* environment variables for current model and session details.", "Use { action: \"wait\", id: taskId, budgetMs: 1000 } to observe an existing shell task. Omit budgetMs for owner policy; zero polls. Never relaunch a yielded command. Waiting does not extend execution timeout or owner lifetime.", "Choose foreground or background bash observation as needed without asking the user each time. Background yields after admission; foreground waits for its optional budget then the same command continues in background. Omitted wait uses owner-configured automatic background yield (default 10s). Observation never changes the execution timeout, which stops the command. Background requires a supported task owner; unbound foreground waits until completion regardless of budget."];
30
+ readonly guidelines: readonly ["You can inspect ATOMIC_* or PI_* environment variables for current model and session details.", "Use { action: \"wait\", id: taskId } to observe an existing shell task with the owner policy. Avoid repeated short polls; await completion notifications when no dependent work is blocked. Never relaunch a yielded command. Waiting does not extend execution timeout or owner lifetime.", "For ordinary commands, omit wait to use the owner's observation policy (normally 10s). Do not routinely request one-second waits: premature yields add tool calls without making the command faster. Use a short budget only for a concrete responsiveness need, or explicit background observation when you have independent work to do. Explicit budgets, including zero for polling, remain available.", "Choose foreground or background shell observation as needed without asking the user each time. Background yields after admission; foreground waits for its optional budget then the same command continues in background. Omitted wait uses owner-configured automatic background yield (default 10s). Observation never changes the execution timeout, which stops the command. Background requires a supported task owner; unbound foreground waits until completion regardless of budget."];
31
31
  }>;
32
32
  export type BashToolInput = Static<typeof bashSchema>;
33
33
  export interface BashToolDetails {
@@ -1 +1 @@
1
- {"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../../src/core/tools/bash.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAG/D,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAa5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAoB,cAAc,EAA2B,MAAM,wBAAwB,CAAC;AACxG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EACN,KAAK,mBAAmB,EAGxB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAGN,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAG5B,MAAM,sBAAsB,CAAC;AAO9B,OAAO,EAAiC,KAAK,gBAAgB,EA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AACD,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC,OAAO,UAAU,CAAC,CAEnG"}
@@ -76,8 +76,9 @@ export const bashToolSystemPromptContribution = Object.freeze({
76
76
  snippet: "Execute a shell command.",
77
77
  guidelines: Object.freeze([
78
78
  "You can inspect ATOMIC_* or PI_* environment variables for current model and session details.",
79
- 'Use { action: "wait", id: taskId, budgetMs: 1000 } to observe an existing shell task. Omit budgetMs for owner policy; zero polls. Never relaunch a yielded command. Waiting does not extend execution timeout or owner lifetime.',
80
- "Choose foreground or background bash observation as needed without asking the user each time. Background yields after admission; foreground waits for its optional budget then the same command continues in background. Omitted wait uses owner-configured automatic background yield (default 10s). Observation never changes the execution timeout, which stops the command. Background requires a supported task owner; unbound foreground waits until completion regardless of budget.",
79
+ 'Use { action: "wait", id: taskId } to observe an existing shell task with the owner policy. Avoid repeated short polls; await completion notifications when no dependent work is blocked. Never relaunch a yielded command. Waiting does not extend execution timeout or owner lifetime.',
80
+ "For ordinary commands, omit wait to use the owner's observation policy (normally 10s). Do not routinely request one-second waits: premature yields add tool calls without making the command faster. Use a short budget only for a concrete responsiveness need, or explicit background observation when you have independent work to do. Explicit budgets, including zero for polling, remain available.",
81
+ "Choose foreground or background shell observation as needed without asking the user each time. Background yields after admission; foreground waits for its optional budget then the same command continues in background. Omitted wait uses owner-configured automatic background yield (default 10s). Observation never changes the execution timeout, which stops the command. Background requires a supported task owner; unbound foreground waits until completion regardless of budget.",
81
82
  ]),
82
83
  });
83
84
  const DEFAULT_TIMEOUT_SECONDS = 300, MAX_TIMEOUT_SECONDS = 3600;