@markusylisiurunen/tau 0.3.20 → 0.3.22
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/dist/core/auth/auth_storage.js +249 -23
- package/dist/core/auth/auth_storage.js.map +1 -1
- package/dist/core/auth/cli.js +66 -0
- package/dist/core/auth/cli.js.map +1 -1
- package/dist/core/auth/credential_store.js +42 -10
- package/dist/core/auth/credential_store.js.map +1 -1
- package/dist/core/auth/index.js +1 -1
- package/dist/core/auth/index.js.map +1 -1
- package/dist/core/auth/providers/openai_codex.js +46 -22
- package/dist/core/auth/providers/openai_codex.js.map +1 -1
- package/dist/core/events/types.js +1 -7
- package/dist/core/events/types.js.map +1 -1
- package/dist/core/index.js +1 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/models/catalog.js +20 -24
- package/dist/core/models/catalog.js.map +1 -1
- package/dist/core/session/compaction.js +0 -4
- package/dist/core/session/compaction.js.map +1 -1
- package/dist/core/session/core_session.js +3 -0
- package/dist/core/session/core_session.js.map +1 -1
- package/dist/core/session/pruning.js +8 -17
- package/dist/core/session/pruning.js.map +1 -1
- package/dist/core/session/runner.js +114 -122
- package/dist/core/session/runner.js.map +1 -1
- package/dist/core/session/session_engine.js +67 -35
- package/dist/core/session/session_engine.js.map +1 -1
- package/dist/core/subagents/control_plane.js +8 -9
- package/dist/core/subagents/control_plane.js.map +1 -1
- package/dist/core/tools/bash.js +5 -6
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.js +88 -81
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/emit_output.js +19 -17
- package/dist/core/tools/emit_output.js.map +1 -1
- package/dist/core/tools/grep.js +5 -5
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/list.js +60 -57
- package/dist/core/tools/list.js.map +1 -1
- package/dist/core/tools/nook.js +114 -114
- package/dist/core/tools/nook.js.map +1 -1
- package/dist/core/tools/read.js +82 -79
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/registry.js +6 -0
- package/dist/core/tools/registry.js.map +1 -1
- package/dist/core/tools/send_input_to_agent.js +9 -10
- package/dist/core/tools/send_input_to_agent.js.map +1 -1
- package/dist/core/tools/spawn_agent.js +23 -24
- package/dist/core/tools/spawn_agent.js.map +1 -1
- package/dist/core/tools/terminate_agent.js +7 -8
- package/dist/core/tools/terminate_agent.js.map +1 -1
- package/dist/core/tools/view_image.js +60 -57
- package/dist/core/tools/view_image.js.map +1 -1
- package/dist/core/tools/wait_for_agents.js +6 -7
- package/dist/core/tools/wait_for_agents.js.map +1 -1
- package/dist/core/tools/web_fetch.js +6 -6
- package/dist/core/tools/web_fetch.js.map +1 -1
- package/dist/core/tools/web_search.js +6 -6
- package/dist/core/tools/web_search.js.map +1 -1
- package/dist/core/tools/write.js +41 -38
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/version.js +1 -1
- package/dist/execution/cloudflare_sandbox_execution_environment.js +54 -6
- package/dist/execution/cloudflare_sandbox_execution_environment.js.map +1 -1
- package/dist/host/client_tool_broker.js +5 -2
- package/dist/host/client_tool_broker.js.map +1 -1
- package/dist/host/hosted_ephemeral_agent_session.js +19 -14
- package/dist/host/hosted_ephemeral_agent_session.js.map +1 -1
- package/dist/host/local_session_host.js +269 -97
- package/dist/host/local_session_host.js.map +1 -1
- package/dist/host/session_host.js +2 -1
- package/dist/host/session_host.js.map +1 -1
- package/dist/host/session_protocol_handler.js +34 -5
- package/dist/host/session_protocol_handler.js.map +1 -1
- package/dist/main.js +17 -15
- package/dist/main.js.map +1 -1
- package/dist/protocol/session_protocol.d.ts +0 -1
- package/dist/protocol/session_protocol.js +103 -5
- package/dist/protocol/session_protocol.js.map +1 -1
- package/dist/store/file_session_store.js +223 -41
- package/dist/store/file_session_store.js.map +1 -1
- package/dist/transport/stdio_session_transport.d.ts +2 -0
- package/dist/transport/stdio_session_transport.js +30 -3
- package/dist/transport/stdio_session_transport.js.map +1 -1
- package/dist/tui/chat_controller/diff_review_service.js +8 -5
- package/dist/tui/chat_controller/diff_review_service.js.map +1 -1
- package/dist/tui/session_chat_controller.js +126 -46
- package/dist/tui/session_chat_controller.js.map +1 -1
- package/package.json +3 -3
- package/dist/core/events/index.js +0 -3
- package/dist/core/events/index.js.map +0 -1
- package/dist/core/events/parser.js +0 -334
- package/dist/core/events/parser.js.map +0 -1
|
@@ -54,9 +54,13 @@ export class SessionChatController {
|
|
|
54
54
|
pendingUserMessagesUnsubscribe;
|
|
55
55
|
snapshotRecovery;
|
|
56
56
|
snapshotRecoveryDeltas = [];
|
|
57
|
+
hasPendingUserMessages = false;
|
|
58
|
+
pendingIdleNotification = false;
|
|
57
59
|
isStreaming = false;
|
|
58
60
|
submittedTurnInProgress = false;
|
|
59
61
|
manualCompactionInProgress = false;
|
|
62
|
+
localDiffReviewInProgress = false;
|
|
63
|
+
sessionReplacementInProgress = false;
|
|
60
64
|
isBashMode = false;
|
|
61
65
|
isBashIncognito = false;
|
|
62
66
|
isMemoryMode = false;
|
|
@@ -118,8 +122,8 @@ export class SessionChatController {
|
|
|
118
122
|
startTurnTimer: () => this.startTurnTimer(),
|
|
119
123
|
stopTurnTimer: () => this.stopTurnTimer(),
|
|
120
124
|
getDiffToolConfig: () => this.resolveDiffToolConfig(),
|
|
121
|
-
startSession: (args) => this.startDiffReviewBridge(args),
|
|
122
|
-
onReviewReturned: (review) =>
|
|
125
|
+
startSession: (args) => this.startDiffReviewBridge(args, this.session, this.snapshot),
|
|
126
|
+
onReviewReturned: (review) => this.handleReturnedDiffReview(review, this.session),
|
|
123
127
|
});
|
|
124
128
|
}
|
|
125
129
|
start() {
|
|
@@ -181,7 +185,7 @@ export class SessionChatController {
|
|
|
181
185
|
if (!this.isSessionOperationActive()) {
|
|
182
186
|
return true;
|
|
183
187
|
}
|
|
184
|
-
if (this.
|
|
188
|
+
if (this.isBlockingSessionOperationActive()) {
|
|
185
189
|
return false;
|
|
186
190
|
}
|
|
187
191
|
const trimmed = text.trimStart();
|
|
@@ -219,6 +223,10 @@ export class SessionChatController {
|
|
|
219
223
|
}
|
|
220
224
|
this.lastEmptySubmitAt = undefined;
|
|
221
225
|
if (this.isSessionOperationActive()) {
|
|
226
|
+
if (this.isBlockingSessionOperationActive()) {
|
|
227
|
+
this.view.addSystemMessage("wait for tau to become idle before submitting input", "warn");
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
222
230
|
if (trimmed.startsWith("/") && this.isSingleLineInput(text)) {
|
|
223
231
|
const parsed = this.commandRegistry.parse(trimmed);
|
|
224
232
|
if (parsed.type !== "unknown") {
|
|
@@ -469,6 +477,10 @@ export class SessionChatController {
|
|
|
469
477
|
await this.submitUserText(trimmed);
|
|
470
478
|
return;
|
|
471
479
|
}
|
|
480
|
+
if (this.isBlockingSessionOperationActive()) {
|
|
481
|
+
this.view.addSystemMessage("wait for tau to become idle before submitting input", "warn");
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
472
484
|
this.submitSteeringText(trimmed);
|
|
473
485
|
}
|
|
474
486
|
submitQueuedText(text) {
|
|
@@ -793,49 +805,88 @@ export class SessionChatController {
|
|
|
793
805
|
}
|
|
794
806
|
async createNewSession() {
|
|
795
807
|
if (this.isSessionOperationActive()) {
|
|
796
|
-
this.view.addSystemMessage("cannot create a new session while
|
|
808
|
+
this.view.addSystemMessage("cannot create a new session while another session operation is running", "warn");
|
|
797
809
|
return;
|
|
798
810
|
}
|
|
799
811
|
if (!this.createSession) {
|
|
800
812
|
this.view.addSystemMessage("new session creation is unavailable", "error");
|
|
801
813
|
return;
|
|
802
814
|
}
|
|
815
|
+
const createInput = {
|
|
816
|
+
executionEnvironment: this.createExecutionEnvironmentInputFromSnapshot(),
|
|
817
|
+
personaId: this.snapshot.settings.personaId,
|
|
818
|
+
...(this.snapshot.settings.reasoning !== undefined
|
|
819
|
+
? { reasoning: this.snapshot.settings.reasoning }
|
|
820
|
+
: {}),
|
|
821
|
+
};
|
|
822
|
+
this.sessionReplacementInProgress = true;
|
|
823
|
+
this.refreshStatus();
|
|
824
|
+
let nextSession;
|
|
825
|
+
let nextEventUnsubscribe;
|
|
826
|
+
let nextPendingUserMessagesUnsubscribe;
|
|
827
|
+
let installed = false;
|
|
803
828
|
try {
|
|
804
|
-
|
|
805
|
-
const
|
|
806
|
-
const
|
|
807
|
-
const
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
829
|
+
nextSession = await this.createSession(createInput);
|
|
830
|
+
const nextSnapshot = await nextSession.snapshot();
|
|
831
|
+
const pendingDeltas = [];
|
|
832
|
+
const pendingUserMessages = [];
|
|
833
|
+
let forwardEvents = false;
|
|
834
|
+
nextEventUnsubscribe = nextSession.onDelta((delta) => {
|
|
835
|
+
if (forwardEvents) {
|
|
836
|
+
this.onSdkDelta(delta);
|
|
837
|
+
}
|
|
838
|
+
else {
|
|
839
|
+
pendingDeltas.push(delta);
|
|
840
|
+
}
|
|
813
841
|
});
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
842
|
+
nextPendingUserMessagesUnsubscribe = nextSession.onPendingUserMessages((message) => {
|
|
843
|
+
if (forwardEvents) {
|
|
844
|
+
this.onSdkPendingUserMessages(message);
|
|
845
|
+
}
|
|
846
|
+
else {
|
|
847
|
+
pendingUserMessages.push(message);
|
|
848
|
+
}
|
|
849
|
+
});
|
|
850
|
+
const previousSession = this.session;
|
|
851
|
+
this.eventUnsubscribe?.();
|
|
852
|
+
this.pendingUserMessagesUnsubscribe?.();
|
|
824
853
|
this.session = nextSession;
|
|
825
|
-
this.snapshot =
|
|
826
|
-
this.observedSessionRevision =
|
|
827
|
-
this.eventUnsubscribe =
|
|
828
|
-
this.pendingUserMessagesUnsubscribe =
|
|
854
|
+
this.snapshot = nextSnapshot;
|
|
855
|
+
this.observedSessionRevision = nextSnapshot.revision;
|
|
856
|
+
this.eventUnsubscribe = nextEventUnsubscribe;
|
|
857
|
+
this.pendingUserMessagesUnsubscribe = nextPendingUserMessagesUnsubscribe;
|
|
858
|
+
installed = true;
|
|
829
859
|
this.view.resetToolUiSession();
|
|
830
860
|
this.assistantMessages = [];
|
|
831
861
|
this.startLocalUiSession();
|
|
832
862
|
this.addSessionIdentityMessage();
|
|
833
863
|
this.renderSnapshot(this.snapshot);
|
|
834
|
-
|
|
864
|
+
for (const delta of pendingDeltas) {
|
|
865
|
+
this.onSdkDelta(delta);
|
|
866
|
+
}
|
|
867
|
+
for (const message of pendingUserMessages) {
|
|
868
|
+
this.onSdkPendingUserMessages(message);
|
|
869
|
+
}
|
|
870
|
+
forwardEvents = true;
|
|
871
|
+
try {
|
|
872
|
+
await previousSession.unobserve();
|
|
873
|
+
}
|
|
874
|
+
catch (detachError) {
|
|
875
|
+
this.view.addSystemMessage(`old session unobserve failed: ${detachError.message}`, "warn");
|
|
876
|
+
}
|
|
835
877
|
}
|
|
836
878
|
catch (error) {
|
|
879
|
+
if (!installed && nextSession) {
|
|
880
|
+
nextEventUnsubscribe?.();
|
|
881
|
+
nextPendingUserMessagesUnsubscribe?.();
|
|
882
|
+
await nextSession.unobserve().catch(() => undefined);
|
|
883
|
+
}
|
|
837
884
|
this.view.addSystemMessage(`new session failed: ${error.message}`, "error");
|
|
838
885
|
}
|
|
886
|
+
finally {
|
|
887
|
+
this.sessionReplacementInProgress = false;
|
|
888
|
+
this.refreshStatus();
|
|
889
|
+
}
|
|
839
890
|
}
|
|
840
891
|
createExecutionEnvironmentInputFromSnapshot() {
|
|
841
892
|
const snapshot = this.snapshot.executionEnvironment;
|
|
@@ -859,7 +910,9 @@ export class SessionChatController {
|
|
|
859
910
|
}
|
|
860
911
|
}
|
|
861
912
|
onSdkPendingUserMessages(message) {
|
|
913
|
+
this.hasPendingUserMessages = message.state.messages.length > 0;
|
|
862
914
|
this.view.setPendingUserMessages(message.state.messages);
|
|
915
|
+
this.sendPendingIdleNotification();
|
|
863
916
|
}
|
|
864
917
|
onSdkDelta(delta) {
|
|
865
918
|
if (this.snapshotRecovery) {
|
|
@@ -1123,6 +1176,15 @@ export class SessionChatController {
|
|
|
1123
1176
|
return;
|
|
1124
1177
|
}
|
|
1125
1178
|
void this.stopTurnCaffeinate();
|
|
1179
|
+
this.pendingIdleNotification = true;
|
|
1180
|
+
this.sendPendingIdleNotification();
|
|
1181
|
+
}
|
|
1182
|
+
sendPendingIdleNotification() {
|
|
1183
|
+
if (!this.pendingIdleNotification || this.isStreaming || this.hasPendingUserMessages) {
|
|
1184
|
+
return;
|
|
1185
|
+
}
|
|
1186
|
+
this.pendingIdleNotification = false;
|
|
1187
|
+
this.view.sendTerminalNotification("tau is waiting for your input");
|
|
1126
1188
|
}
|
|
1127
1189
|
stopVisibleSessionTurn() {
|
|
1128
1190
|
if (!this.isStreaming) {
|
|
@@ -1145,7 +1207,12 @@ export class SessionChatController {
|
|
|
1145
1207
|
this.refreshStatus();
|
|
1146
1208
|
}
|
|
1147
1209
|
isSessionOperationActive() {
|
|
1148
|
-
return this.isStreaming || this.submittedTurnInProgress || this.
|
|
1210
|
+
return (this.isStreaming || this.submittedTurnInProgress || this.isBlockingSessionOperationActive());
|
|
1211
|
+
}
|
|
1212
|
+
isBlockingSessionOperationActive() {
|
|
1213
|
+
return (this.manualCompactionInProgress ||
|
|
1214
|
+
this.localDiffReviewInProgress ||
|
|
1215
|
+
this.sessionReplacementInProgress);
|
|
1149
1216
|
}
|
|
1150
1217
|
async recoverFromRevisionGap() {
|
|
1151
1218
|
if (this.snapshotRecovery) {
|
|
@@ -1639,35 +1706,46 @@ export class SessionChatController {
|
|
|
1639
1706
|
this.view.addSystemMessage("wait for tau to become idle before starting /diff.", "warn");
|
|
1640
1707
|
return;
|
|
1641
1708
|
}
|
|
1642
|
-
|
|
1709
|
+
const session = this.session;
|
|
1710
|
+
const snapshot = this.snapshot;
|
|
1711
|
+
this.localDiffReviewInProgress = true;
|
|
1712
|
+
this.refreshStatus();
|
|
1713
|
+
try {
|
|
1714
|
+
await this.diffReviewService.start(argsText, {
|
|
1715
|
+
startSession: (args) => this.startDiffReviewBridge(args, session, snapshot),
|
|
1716
|
+
onReviewReturned: (review) => this.handleReturnedDiffReview(review, session),
|
|
1717
|
+
});
|
|
1718
|
+
}
|
|
1719
|
+
finally {
|
|
1720
|
+
this.localDiffReviewInProgress = false;
|
|
1721
|
+
this.refreshStatus();
|
|
1722
|
+
}
|
|
1643
1723
|
}
|
|
1644
1724
|
isDiffReviewIdle() {
|
|
1645
|
-
return (!this.
|
|
1646
|
-
!this.submittedTurnInProgress &&
|
|
1725
|
+
return (!this.isSessionOperationActive() &&
|
|
1647
1726
|
!this.listenRecording &&
|
|
1648
1727
|
!this.listenTransition &&
|
|
1649
1728
|
!this.isTranscribingListen &&
|
|
1650
|
-
!this.speakTask
|
|
1651
|
-
!this.diffReviewService.isActive());
|
|
1729
|
+
!this.speakTask);
|
|
1652
1730
|
}
|
|
1653
1731
|
resolveDiffToolConfig() {
|
|
1654
1732
|
return this.config.diffTool ?? this.defaultDiffTool;
|
|
1655
1733
|
}
|
|
1656
|
-
async startDiffReviewBridge(args) {
|
|
1734
|
+
async startDiffReviewBridge(args, session, sessionSnapshot) {
|
|
1657
1735
|
const snapshot = await captureDiffReviewSnapshot({
|
|
1658
|
-
cwd:
|
|
1736
|
+
cwd: sessionSnapshot.executionEnvironment.cwd,
|
|
1659
1737
|
source: args.source,
|
|
1660
1738
|
signal: args.signal,
|
|
1661
|
-
deps: createSessionDiffReviewSnapshotDeps(
|
|
1739
|
+
deps: createSessionDiffReviewSnapshotDeps(session),
|
|
1662
1740
|
});
|
|
1663
|
-
const ephemeral = await
|
|
1741
|
+
const ephemeral = await session.createEphemeralContext({
|
|
1664
1742
|
instructions: buildDiffReviewInstructions(snapshot),
|
|
1665
1743
|
tools: ["bash", "view_image"],
|
|
1666
1744
|
});
|
|
1667
1745
|
const bridge = new DiffReviewBridge({
|
|
1668
1746
|
snapshot,
|
|
1669
|
-
contextWindow:
|
|
1670
|
-
submitThreadMessage: (options) =>
|
|
1747
|
+
contextWindow: sessionSnapshot.bootstrap.model.contextWindow,
|
|
1748
|
+
submitThreadMessage: (options) => session.submitEphemeralThread({
|
|
1671
1749
|
contextId: ephemeral.contextId,
|
|
1672
1750
|
threadId: options.threadId,
|
|
1673
1751
|
...(options.forkFromThreadId ? { forkFromThreadId: options.forkFromThreadId } : {}),
|
|
@@ -1676,7 +1754,7 @@ export class SessionChatController {
|
|
|
1676
1754
|
deps: this.deps,
|
|
1677
1755
|
...(this.diffToolLauncher ? { toolLauncher: this.diffToolLauncher } : {}),
|
|
1678
1756
|
});
|
|
1679
|
-
const unsubscribeEphemeral =
|
|
1757
|
+
const unsubscribeEphemeral = session.onEphemeral((message) => {
|
|
1680
1758
|
const event = message.event;
|
|
1681
1759
|
if (event.type !== "ephemeral-agent.thread-update" ||
|
|
1682
1760
|
event.contextId !== ephemeral.contextId) {
|
|
@@ -1699,18 +1777,18 @@ export class SessionChatController {
|
|
|
1699
1777
|
}
|
|
1700
1778
|
catch (error) {
|
|
1701
1779
|
unsubscribeEphemeral();
|
|
1702
|
-
await
|
|
1780
|
+
await session.closeEphemeralContext(ephemeral.contextId).catch(() => undefined);
|
|
1703
1781
|
await bridge.cancel("launch_failed").catch(() => undefined);
|
|
1704
1782
|
await bridge.close().catch(() => undefined);
|
|
1705
1783
|
throw error;
|
|
1706
1784
|
}
|
|
1707
1785
|
const result = bridge.result.finally(async () => {
|
|
1708
1786
|
unsubscribeEphemeral();
|
|
1709
|
-
await
|
|
1787
|
+
await session.closeEphemeralContext(ephemeral.contextId).catch(() => undefined);
|
|
1710
1788
|
});
|
|
1711
1789
|
return { bridge, result };
|
|
1712
1790
|
}
|
|
1713
|
-
async handleReturnedDiffReview(review) {
|
|
1791
|
+
async handleReturnedDiffReview(review, session) {
|
|
1714
1792
|
const model = {
|
|
1715
1793
|
type: "user",
|
|
1716
1794
|
text: review.review,
|
|
@@ -1721,10 +1799,12 @@ export class SessionChatController {
|
|
|
1721
1799
|
this.renderedMessageIds.push(review.historyEntryId);
|
|
1722
1800
|
}
|
|
1723
1801
|
try {
|
|
1724
|
-
const result = await
|
|
1802
|
+
const result = await session.record(formatDiffReviewUserMessage(review), {
|
|
1725
1803
|
historyEntryId: review.historyEntryId,
|
|
1726
1804
|
});
|
|
1727
|
-
this.
|
|
1805
|
+
if (this.session === session) {
|
|
1806
|
+
this.syncRenderedHistory(result.snapshot);
|
|
1807
|
+
}
|
|
1728
1808
|
}
|
|
1729
1809
|
catch (error) {
|
|
1730
1810
|
this.view.addSystemMessage(`failed to add diff review to session: ${error.message}`, "error");
|