@bastani/atomic 0.8.26-alpha.7 → 0.8.26-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/README.md +5 -8
- package/dist/builtin/intercom/CHANGELOG.md +6 -0
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/CHANGELOG.md +6 -0
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +6 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/web-access/CHANGELOG.md +6 -0
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +6 -0
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/extension/wiring.ts +13 -1
- package/dist/builtin/workflows/src/runs/foreground/executor.ts +12 -6
- package/dist/builtin/workflows/src/runs/foreground/stage-runner.ts +2 -2
- package/dist/builtin/workflows/src/shared/authoring-contract.d.ts +2 -2
- package/dist/builtin/workflows/src/shared/types.ts +3 -3
- package/dist/builtin/workflows/src/tui/stage-chat-view.ts +1 -9
- package/dist/core/agent-session.d.ts +5 -5
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +64 -173
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/atomic-guide-command.d.ts.map +1 -1
- package/dist/core/atomic-guide-command.js +1 -1
- package/dist/core/atomic-guide-command.js.map +1 -1
- package/dist/core/extensions/types.d.ts +3 -2
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +1 -1
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -2
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +1 -1
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/context-compaction-summary-message.d.ts +17 -0
- package/dist/modes/interactive/components/context-compaction-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/context-compaction-summary-message.js +83 -0
- package/dist/modes/interactive/components/context-compaction-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/index.d.ts +1 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +1 -0
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +28 -38
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +3 -3
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +1 -1
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +2 -2
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/docs/compaction.md +71 -38
- package/docs/extensions.md +9 -5
- package/docs/index.md +1 -1
- package/docs/json.md +2 -2
- package/docs/rpc.md +19 -40
- package/docs/sdk.md +2 -2
- package/docs/session-format.md +3 -3
- package/docs/sessions.md +2 -3
- package/docs/settings.md +2 -2
- package/docs/usage.md +2 -4
- package/package.json +1 -1
|
@@ -42,6 +42,7 @@ import { BranchSummaryMessageComponent } from "./components/branch-summary-messa
|
|
|
42
42
|
import { chatEntriesFromAgentMessages, renderChatMessageEntry, } from "./components/chat-message-renderer.js";
|
|
43
43
|
import { addChatTranscriptEntry } from "./components/chat-transcript.js";
|
|
44
44
|
import { CompactionSummaryMessageComponent } from "./components/compaction-summary-message.js";
|
|
45
|
+
import { ContextCompactionSummaryMessageComponent } from "./components/context-compaction-summary-message.js";
|
|
45
46
|
import { CountdownTimer } from "./components/countdown-timer.js";
|
|
46
47
|
import { CustomEditor } from "./components/custom-editor.js";
|
|
47
48
|
import { CustomMessageComponent } from "./components/custom-message.js";
|
|
@@ -88,6 +89,13 @@ class ExpandableText extends Text {
|
|
|
88
89
|
this.setText(this.expanded ? this.getExpandedText() : this.getCollapsedText());
|
|
89
90
|
}
|
|
90
91
|
}
|
|
92
|
+
function isContextCompactionResult(result) {
|
|
93
|
+
return (typeof result === "object" &&
|
|
94
|
+
result !== null &&
|
|
95
|
+
"stats" in result &&
|
|
96
|
+
"deletedTargets" in result &&
|
|
97
|
+
"protectedEntryIds" in result);
|
|
98
|
+
}
|
|
91
99
|
const DEAD_TERMINAL_ERROR_CODES = new Set(["EIO", "EPIPE", "ENOTCONN"]);
|
|
92
100
|
function isDeadTerminalError(error) {
|
|
93
101
|
if (!error || typeof error !== "object" || !("code" in error)) {
|
|
@@ -2249,21 +2257,13 @@ export class InteractiveMode {
|
|
|
2249
2257
|
await this.handleClearCommand();
|
|
2250
2258
|
return;
|
|
2251
2259
|
}
|
|
2252
|
-
if (/^\/
|
|
2260
|
+
if (/^\/compact(?:\s|$)/.test(text)) {
|
|
2253
2261
|
this.editor.setText("");
|
|
2254
|
-
if (text !== "/
|
|
2255
|
-
this.showWarning("Usage: /
|
|
2262
|
+
if (text !== "/compact") {
|
|
2263
|
+
this.showWarning("Usage: /compact");
|
|
2256
2264
|
return;
|
|
2257
2265
|
}
|
|
2258
|
-
await this.
|
|
2259
|
-
return;
|
|
2260
|
-
}
|
|
2261
|
-
if (text === "/compact" || text.startsWith("/compact ")) {
|
|
2262
|
-
const customInstructions = text.startsWith("/compact ")
|
|
2263
|
-
? text.slice(9).trim()
|
|
2264
|
-
: undefined;
|
|
2265
|
-
this.editor.setText("");
|
|
2266
|
-
await this.handleCompactCommand(customInstructions);
|
|
2266
|
+
await this.handleCompactCommand();
|
|
2267
2267
|
return;
|
|
2268
2268
|
}
|
|
2269
2269
|
if (text === "/reload") {
|
|
@@ -2595,7 +2595,12 @@ export class InteractiveMode {
|
|
|
2595
2595
|
else if (event.result) {
|
|
2596
2596
|
this.chatContainer.clear();
|
|
2597
2597
|
this.rebuildChatFromMessages();
|
|
2598
|
-
|
|
2598
|
+
if (isContextCompactionResult(event.result)) {
|
|
2599
|
+
this.addContextCompactionSummaryToChat(event.result);
|
|
2600
|
+
}
|
|
2601
|
+
else {
|
|
2602
|
+
this.addMessageToChat(createCompactionSummaryMessage(event.result.summary, event.result.tokensBefore, new Date().toISOString()));
|
|
2603
|
+
}
|
|
2599
2604
|
this.footer.invalidate();
|
|
2600
2605
|
}
|
|
2601
2606
|
else if (event.errorMessage) {
|
|
@@ -2621,7 +2626,7 @@ export class InteractiveMode {
|
|
|
2621
2626
|
};
|
|
2622
2627
|
this.statusContainer.clear();
|
|
2623
2628
|
const cancelHint = `(${keyText("app.interrupt")} Cancel)`;
|
|
2624
|
-
this.autoCompactionLoader = new Loader(this.ui, (spinner) => theme.fg("accent", spinner), (text) => theme.fg("muted", text), `
|
|
2629
|
+
this.autoCompactionLoader = new Loader(this.ui, (spinner) => theme.fg("accent", spinner), (text) => theme.fg("muted", text), `Compacting context... ${cancelHint}`);
|
|
2625
2630
|
this.statusContainer.addChild(this.autoCompactionLoader);
|
|
2626
2631
|
this.ui.requestRender();
|
|
2627
2632
|
break;
|
|
@@ -2645,9 +2650,7 @@ export class InteractiveMode {
|
|
|
2645
2650
|
else if (event.result) {
|
|
2646
2651
|
this.chatContainer.clear();
|
|
2647
2652
|
this.rebuildChatFromMessages();
|
|
2648
|
-
|
|
2649
|
-
const backup = event.result.backupPath ? ` Backup: ${event.result.backupPath}` : "";
|
|
2650
|
-
this.showStatus(`Context-compacted ${stats.objectsDeleted} object${stats.objectsDeleted === 1 ? "" : "s"} (${stats.tokensBefore} → ${stats.tokensAfter} tokens, ${stats.percentReduction}% reduction).${backup}`);
|
|
2653
|
+
this.addContextCompactionSummaryToChat(event.result);
|
|
2651
2654
|
this.footer.invalidate();
|
|
2652
2655
|
}
|
|
2653
2656
|
else if (event.errorMessage) {
|
|
@@ -2756,6 +2759,12 @@ export class InteractiveMode {
|
|
|
2756
2759
|
addChatTranscriptEntry(this.chatContainer, component, entry.role);
|
|
2757
2760
|
return component;
|
|
2758
2761
|
}
|
|
2762
|
+
addContextCompactionSummaryToChat(result) {
|
|
2763
|
+
this.chatContainer.addChild(new Spacer(1));
|
|
2764
|
+
const component = new ContextCompactionSummaryMessageComponent(result, this.getMarkdownThemeWithSettings());
|
|
2765
|
+
component.setExpanded(this.toolOutputExpanded);
|
|
2766
|
+
this.chatContainer.addChild(component);
|
|
2767
|
+
}
|
|
2759
2768
|
addMessageToChat(message, options) {
|
|
2760
2769
|
switch (message.role) {
|
|
2761
2770
|
case "bashExecution": {
|
|
@@ -4889,7 +4898,7 @@ export class InteractiveMode {
|
|
|
4889
4898
|
this.bashComponent = undefined;
|
|
4890
4899
|
this.ui.requestRender();
|
|
4891
4900
|
}
|
|
4892
|
-
async handleCompactCommand(
|
|
4901
|
+
async handleCompactCommand() {
|
|
4893
4902
|
const entries = this.sessionManager.getEntries();
|
|
4894
4903
|
const messageCount = entries.filter((e) => e.type === "message").length;
|
|
4895
4904
|
if (messageCount < 2) {
|
|
@@ -4902,26 +4911,7 @@ export class InteractiveMode {
|
|
|
4902
4911
|
}
|
|
4903
4912
|
this.statusContainer.clear();
|
|
4904
4913
|
try {
|
|
4905
|
-
await this.session.compact(
|
|
4906
|
-
}
|
|
4907
|
-
catch {
|
|
4908
|
-
// Ignore, will be emitted as an event
|
|
4909
|
-
}
|
|
4910
|
-
}
|
|
4911
|
-
async handleContextCompactCommand() {
|
|
4912
|
-
const entries = this.sessionManager.getEntries();
|
|
4913
|
-
const messageCount = entries.filter((e) => e.type === "message").length;
|
|
4914
|
-
if (messageCount < 2) {
|
|
4915
|
-
this.showWarning("Nothing to context-compact (no messages yet)");
|
|
4916
|
-
return;
|
|
4917
|
-
}
|
|
4918
|
-
if (this.loadingAnimation) {
|
|
4919
|
-
this.loadingAnimation.stop();
|
|
4920
|
-
this.loadingAnimation = undefined;
|
|
4921
|
-
}
|
|
4922
|
-
this.statusContainer.clear();
|
|
4923
|
-
try {
|
|
4924
|
-
await this.session.contextCompact();
|
|
4914
|
+
await this.session.compact();
|
|
4925
4915
|
}
|
|
4926
4916
|
catch {
|
|
4927
4917
|
// Ignore, will be emitted as an event
|