@dexto/tui 1.7.2 → 1.8.1
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/agent-backend.cjs +16 -2
- package/dist/agent-backend.d.ts +5 -2
- package/dist/agent-backend.d.ts.map +1 -1
- package/dist/agent-backend.js +15 -2
- package/dist/agent-backend.test.cjs +28 -2
- package/dist/agent-backend.test.js +28 -2
- package/dist/components/ApprovalPrompt.cjs +6 -5
- package/dist/components/ApprovalPrompt.d.ts +1 -1
- package/dist/components/ApprovalPrompt.d.ts.map +1 -1
- package/dist/components/ApprovalPrompt.js +6 -5
- package/dist/components/Footer.cjs +3 -2
- package/dist/components/Footer.d.ts.map +1 -1
- package/dist/components/Footer.js +2 -5
- package/dist/components/TextBufferInput.cjs +14 -1
- package/dist/components/TextBufferInput.d.ts +5 -1
- package/dist/components/TextBufferInput.d.ts.map +1 -1
- package/dist/components/TextBufferInput.js +14 -1
- package/dist/components/chat/QueuedMessagesDisplay.cjs +17 -8
- package/dist/components/chat/QueuedMessagesDisplay.d.ts +7 -1
- package/dist/components/chat/QueuedMessagesDisplay.d.ts.map +1 -1
- package/dist/components/chat/QueuedMessagesDisplay.js +16 -8
- package/dist/components/input/InputArea.cjs +4 -0
- package/dist/components/input/InputArea.d.ts +5 -1
- package/dist/components/input/InputArea.d.ts.map +1 -1
- package/dist/components/input/InputArea.js +4 -0
- package/dist/components/modes/AlternateBufferCLI.cjs +20 -1
- package/dist/components/modes/AlternateBufferCLI.d.ts.map +1 -1
- package/dist/components/modes/AlternateBufferCLI.js +21 -2
- package/dist/components/modes/StaticCLI.cjs +20 -1
- package/dist/components/modes/StaticCLI.d.ts.map +1 -1
- package/dist/components/modes/StaticCLI.js +21 -2
- package/dist/components/overlays/ApiKeyInput.d.ts +1 -1
- package/dist/components/overlays/ApiKeyInput.d.ts.map +1 -1
- package/dist/components/overlays/CustomModelWizard.d.ts.map +1 -1
- package/dist/components/overlays/LoginOverlay.cjs +2 -10
- package/dist/components/overlays/LoginOverlay.d.ts.map +1 -1
- package/dist/components/overlays/LoginOverlay.js +3 -11
- package/dist/components/overlays/ModelSelectorRefactored.cjs +4 -3
- package/dist/components/overlays/ModelSelectorRefactored.d.ts +1 -1
- package/dist/components/overlays/ModelSelectorRefactored.d.ts.map +1 -1
- package/dist/components/overlays/ModelSelectorRefactored.js +1 -2
- package/dist/components/overlays/ReasoningOverlay.cjs +3 -3
- package/dist/components/overlays/ReasoningOverlay.js +1 -1
- package/dist/components/overlays/custom-model-wizard/provider-config.cjs +4 -3
- package/dist/components/overlays/custom-model-wizard/provider-config.d.ts.map +1 -1
- package/dist/components/overlays/custom-model-wizard/provider-config.js +2 -4
- package/dist/containers/InputContainer.cjs +121 -20
- package/dist/containers/InputContainer.d.ts +6 -2
- package/dist/containers/InputContainer.d.ts.map +1 -1
- package/dist/containers/InputContainer.js +120 -19
- package/dist/containers/OverlayContainer.cjs +6 -5
- package/dist/containers/OverlayContainer.d.ts.map +1 -1
- package/dist/containers/OverlayContainer.js +2 -7
- package/dist/hooks/useAgentEvents.cjs +29 -6
- package/dist/hooks/useAgentEvents.d.ts +3 -2
- package/dist/hooks/useAgentEvents.d.ts.map +1 -1
- package/dist/hooks/useAgentEvents.js +29 -9
- package/dist/hooks/useCLIState.cjs +12 -5
- package/dist/hooks/useCLIState.d.ts +2 -0
- package/dist/hooks/useCLIState.d.ts.map +1 -1
- package/dist/hooks/useCLIState.js +12 -5
- package/dist/hooks/useInputOrchestrator.cjs +15 -14
- package/dist/hooks/useInputOrchestrator.d.ts +6 -6
- package/dist/hooks/useInputOrchestrator.d.ts.map +1 -1
- package/dist/hooks/useInputOrchestrator.js +15 -14
- package/dist/host/index.cjs +6 -6
- package/dist/host/index.d.ts +9 -18
- package/dist/host/index.d.ts.map +1 -1
- package/dist/host/index.js +5 -5
- package/dist/host/index.test.cjs +47 -0
- package/dist/host/index.test.d.ts +2 -0
- package/dist/host/index.test.d.ts.map +1 -0
- package/dist/host/index.test.js +50 -0
- package/dist/index.d.cts +11 -15
- package/dist/interactive-commands/command-parser.cjs +1 -0
- package/dist/interactive-commands/command-parser.d.ts.map +1 -1
- package/dist/interactive-commands/command-parser.js +1 -0
- package/dist/interactive-commands/commands.cjs +3 -0
- package/dist/interactive-commands/commands.d.ts.map +1 -1
- package/dist/interactive-commands/commands.js +3 -0
- package/dist/interactive-commands/commands.test.cjs +42 -0
- package/dist/interactive-commands/commands.test.js +42 -0
- package/dist/interactive-commands/prompt-commands.cjs +4 -66
- package/dist/interactive-commands/prompt-commands.d.ts +1 -2
- package/dist/interactive-commands/prompt-commands.d.ts.map +1 -1
- package/dist/interactive-commands/prompt-commands.js +4 -66
- package/dist/interactive-commands/skill-commands.cjs +73 -0
- package/dist/interactive-commands/skill-commands.d.ts +9 -0
- package/dist/interactive-commands/skill-commands.d.ts.map +1 -0
- package/dist/interactive-commands/skill-commands.js +49 -0
- package/dist/services/processStream.cjs +23 -4
- package/dist/services/processStream.d.ts +3 -1
- package/dist/services/processStream.d.ts.map +1 -1
- package/dist/services/processStream.js +23 -4
- package/dist/services/processStream.test.cjs +52 -2
- package/dist/services/processStream.test.js +52 -2
- package/dist/state/initialState.cjs +2 -1
- package/dist/state/initialState.d.ts.map +1 -1
- package/dist/state/initialState.js +2 -1
- package/dist/state/reducer.cjs +10 -5
- package/dist/state/reducer.d.ts.map +1 -1
- package/dist/state/reducer.js +10 -5
- package/dist/state/types.d.ts +4 -1
- package/dist/state/types.d.ts.map +1 -1
- package/dist/utils/chatgpt-rate-limit.cjs +4 -4
- package/dist/utils/chatgpt-rate-limit.d.ts.map +1 -1
- package/dist/utils/chatgpt-rate-limit.js +1 -1
- package/dist/utils/llm-provider-display.d.ts +1 -1
- package/dist/utils/llm-provider-display.d.ts.map +1 -1
- package/dist/utils/messageFormatting.cjs +0 -23
- package/dist/utils/messageFormatting.d.ts +0 -13
- package/dist/utils/messageFormatting.d.ts.map +1 -1
- package/dist/utils/messageFormatting.js +0 -21
- package/dist/utils/queuedComposerContent.cjs +148 -0
- package/dist/utils/queuedComposerContent.d.ts +17 -0
- package/dist/utils/queuedComposerContent.d.ts.map +1 -0
- package/dist/utils/queuedComposerContent.js +123 -0
- package/dist/utils/queuedComposerContent.test.cjs +176 -0
- package/dist/utils/queuedComposerContent.test.d.ts +2 -0
- package/dist/utils/queuedComposerContent.test.d.ts.map +1 -0
- package/dist/utils/queuedComposerContent.test.js +175 -0
- package/package.json +5 -4
|
@@ -24,10 +24,15 @@ async function* eventStream(events) {
|
|
|
24
24
|
yield event;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
function createSetters(
|
|
27
|
+
function createSetters({
|
|
28
|
+
steerMessages: initialSteerMessages = [],
|
|
29
|
+
queuedMessages: initialQueuedMessages = []
|
|
30
|
+
} = {}) {
|
|
28
31
|
const messages = createState([]);
|
|
29
32
|
const pendingMessages = createState([]);
|
|
30
33
|
const dequeuedBuffer = createState([]);
|
|
34
|
+
const steerMessages = createState(initialSteerMessages);
|
|
35
|
+
const queuedMessages = createState(initialQueuedMessages);
|
|
31
36
|
const ui = createState({
|
|
32
37
|
isProcessing: false,
|
|
33
38
|
isCancelling: false,
|
|
@@ -70,6 +75,8 @@ function createSetters() {
|
|
|
70
75
|
return {
|
|
71
76
|
getMessages: messages.get,
|
|
72
77
|
getPendingMessages: pendingMessages.get,
|
|
78
|
+
getSteerMessages: steerMessages.get,
|
|
79
|
+
getQueuedMessages: queuedMessages.get,
|
|
73
80
|
getUi: ui.get,
|
|
74
81
|
setters: {
|
|
75
82
|
setMessages: messages.set,
|
|
@@ -77,7 +84,8 @@ function createSetters() {
|
|
|
77
84
|
setDequeuedBuffer: dequeuedBuffer.set,
|
|
78
85
|
setUi: ui.set,
|
|
79
86
|
setSession: session.set,
|
|
80
|
-
|
|
87
|
+
setSteerMessages: steerMessages.set,
|
|
88
|
+
setQueuedMessages: queuedMessages.set,
|
|
81
89
|
setApproval: createNoopDispatch(),
|
|
82
90
|
setApprovalQueue: createNoopDispatch()
|
|
83
91
|
}
|
|
@@ -87,6 +95,47 @@ describe("processStream (reasoning)", () => {
|
|
|
87
95
|
beforeEach(() => {
|
|
88
96
|
captureAnalyticsMock.mockClear();
|
|
89
97
|
});
|
|
98
|
+
it("removes only dequeued queue ids from steer and follow-up state", async () => {
|
|
99
|
+
const steer = {
|
|
100
|
+
id: "steer-1",
|
|
101
|
+
content: [{ type: "text", text: "active steer" }],
|
|
102
|
+
queuedAt: Date.now(),
|
|
103
|
+
kind: "default"
|
|
104
|
+
};
|
|
105
|
+
const followUp = {
|
|
106
|
+
id: "follow-up-1",
|
|
107
|
+
content: [{ type: "text", text: "later" }],
|
|
108
|
+
queuedAt: Date.now(),
|
|
109
|
+
kind: "default"
|
|
110
|
+
};
|
|
111
|
+
const { getSteerMessages, getQueuedMessages, setters } = createSetters({
|
|
112
|
+
steerMessages: [steer],
|
|
113
|
+
queuedMessages: [followUp]
|
|
114
|
+
});
|
|
115
|
+
await processStream(
|
|
116
|
+
eventStream([
|
|
117
|
+
{
|
|
118
|
+
name: "message:dequeued",
|
|
119
|
+
sessionId: "test-session",
|
|
120
|
+
count: 1,
|
|
121
|
+
ids: [steer.id],
|
|
122
|
+
queue: "steer",
|
|
123
|
+
coalesced: false,
|
|
124
|
+
content: steer.content,
|
|
125
|
+
messages: [steer]
|
|
126
|
+
}
|
|
127
|
+
]),
|
|
128
|
+
setters,
|
|
129
|
+
{
|
|
130
|
+
useStreaming: true,
|
|
131
|
+
autoApproveEditsRef: { current: false },
|
|
132
|
+
bypassPermissionsRef: { current: false },
|
|
133
|
+
eventBus: { emit: vi.fn() }
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
expect(getSteerMessages()).toEqual([]);
|
|
137
|
+
expect(getQueuedMessages()).toEqual([followUp]);
|
|
138
|
+
});
|
|
90
139
|
it("attaches streamed reasoning chunks to the assistant message", async () => {
|
|
91
140
|
const { getMessages, getPendingMessages, setters } = createSetters();
|
|
92
141
|
const events = [
|
|
@@ -233,6 +282,7 @@ describe("processStream (reasoning)", () => {
|
|
|
233
282
|
name: "llm:tool-call",
|
|
234
283
|
sessionId: "test-session",
|
|
235
284
|
toolName: "test-tool",
|
|
285
|
+
callId: "call-1",
|
|
236
286
|
args: {}
|
|
237
287
|
},
|
|
238
288
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialState.d.ts","sourceRoot":"","sources":["../../src/state/initialState.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,gBAAgB,GAAE,MAAW,GAAG,QAAQ,
|
|
1
|
+
{"version":3,"file":"initialState.d.ts","sourceRoot":"","sources":["../../src/state/initialState.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,gBAAgB,GAAE,MAAW,GAAG,QAAQ,CAqD1E"}
|
package/dist/state/reducer.cjs
CHANGED
|
@@ -44,7 +44,8 @@ function cliReducer(state, action) {
|
|
|
44
44
|
input: {
|
|
45
45
|
...state.input,
|
|
46
46
|
value: "",
|
|
47
|
-
historyIndex: -1
|
|
47
|
+
historyIndex: -1,
|
|
48
|
+
editingQueuedFollowUp: false
|
|
48
49
|
}
|
|
49
50
|
};
|
|
50
51
|
case "INPUT_HISTORY_NAVIGATE": {
|
|
@@ -66,7 +67,8 @@ function cliReducer(state, action) {
|
|
|
66
67
|
input: {
|
|
67
68
|
...state.input,
|
|
68
69
|
value: "",
|
|
69
|
-
historyIndex: -1
|
|
70
|
+
historyIndex: -1,
|
|
71
|
+
editingQueuedFollowUp: false
|
|
70
72
|
}
|
|
71
73
|
};
|
|
72
74
|
}
|
|
@@ -78,7 +80,8 @@ function cliReducer(state, action) {
|
|
|
78
80
|
input: {
|
|
79
81
|
...state.input,
|
|
80
82
|
value: historyItem || "",
|
|
81
|
-
historyIndex: newIndex
|
|
83
|
+
historyIndex: newIndex,
|
|
84
|
+
editingQueuedFollowUp: false
|
|
82
85
|
}
|
|
83
86
|
};
|
|
84
87
|
}
|
|
@@ -87,7 +90,8 @@ function cliReducer(state, action) {
|
|
|
87
90
|
...state,
|
|
88
91
|
input: {
|
|
89
92
|
...state.input,
|
|
90
|
-
historyIndex: -1
|
|
93
|
+
historyIndex: -1,
|
|
94
|
+
editingQueuedFollowUp: false
|
|
91
95
|
}
|
|
92
96
|
};
|
|
93
97
|
case "INPUT_HISTORY_ADD": {
|
|
@@ -101,7 +105,8 @@ function cliReducer(state, action) {
|
|
|
101
105
|
...state.input,
|
|
102
106
|
history: [...history, action.value].slice(-100),
|
|
103
107
|
// Keep last 100
|
|
104
|
-
historyIndex: -1
|
|
108
|
+
historyIndex: -1,
|
|
109
|
+
editingQueuedFollowUp: false
|
|
105
110
|
}
|
|
106
111
|
};
|
|
107
112
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../src/state/reducer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,GAAG,QAAQ,
|
|
1
|
+
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../src/state/reducer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,GAAG,QAAQ,CAuWvE"}
|
package/dist/state/reducer.js
CHANGED
|
@@ -21,7 +21,8 @@ function cliReducer(state, action) {
|
|
|
21
21
|
input: {
|
|
22
22
|
...state.input,
|
|
23
23
|
value: "",
|
|
24
|
-
historyIndex: -1
|
|
24
|
+
historyIndex: -1,
|
|
25
|
+
editingQueuedFollowUp: false
|
|
25
26
|
}
|
|
26
27
|
};
|
|
27
28
|
case "INPUT_HISTORY_NAVIGATE": {
|
|
@@ -43,7 +44,8 @@ function cliReducer(state, action) {
|
|
|
43
44
|
input: {
|
|
44
45
|
...state.input,
|
|
45
46
|
value: "",
|
|
46
|
-
historyIndex: -1
|
|
47
|
+
historyIndex: -1,
|
|
48
|
+
editingQueuedFollowUp: false
|
|
47
49
|
}
|
|
48
50
|
};
|
|
49
51
|
}
|
|
@@ -55,7 +57,8 @@ function cliReducer(state, action) {
|
|
|
55
57
|
input: {
|
|
56
58
|
...state.input,
|
|
57
59
|
value: historyItem || "",
|
|
58
|
-
historyIndex: newIndex
|
|
60
|
+
historyIndex: newIndex,
|
|
61
|
+
editingQueuedFollowUp: false
|
|
59
62
|
}
|
|
60
63
|
};
|
|
61
64
|
}
|
|
@@ -64,7 +67,8 @@ function cliReducer(state, action) {
|
|
|
64
67
|
...state,
|
|
65
68
|
input: {
|
|
66
69
|
...state.input,
|
|
67
|
-
historyIndex: -1
|
|
70
|
+
historyIndex: -1,
|
|
71
|
+
editingQueuedFollowUp: false
|
|
68
72
|
}
|
|
69
73
|
};
|
|
70
74
|
case "INPUT_HISTORY_ADD": {
|
|
@@ -78,7 +82,8 @@ function cliReducer(state, action) {
|
|
|
78
82
|
...state.input,
|
|
79
83
|
history: [...history, action.value].slice(-100),
|
|
80
84
|
// Keep last 100
|
|
81
|
-
historyIndex: -1
|
|
85
|
+
historyIndex: -1,
|
|
86
|
+
editingQueuedFollowUp: false
|
|
82
87
|
}
|
|
83
88
|
};
|
|
84
89
|
}
|
package/dist/state/types.d.ts
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Central type definitions for the CLI state machine
|
|
4
4
|
*/
|
|
5
5
|
import type { ApprovalRequest } from '../components/ApprovalPrompt.js';
|
|
6
|
-
import type { CodexRateLimitSnapshot, ToolDisplayData, ContentPart, McpConnectionStatus, McpServerType
|
|
6
|
+
import type { CodexRateLimitSnapshot, ToolDisplayData, ContentPart, McpConnectionStatus, McpServerType } from '@dexto/core';
|
|
7
|
+
import type { LLMProvider, ReasoningVariant } from '@dexto/llm';
|
|
7
8
|
/**
|
|
8
9
|
* Update information for version check
|
|
9
10
|
*/
|
|
@@ -277,6 +278,8 @@ export interface InputState {
|
|
|
277
278
|
pastedBlocks: PastedBlock[];
|
|
278
279
|
/** Counter for generating sequential paste numbers */
|
|
279
280
|
pasteCounter: number;
|
|
281
|
+
/** True while editing a queued follow-up pulled back into the input */
|
|
282
|
+
editingQueuedFollowUp: boolean;
|
|
280
283
|
}
|
|
281
284
|
export interface InsufficientCreditsState {
|
|
282
285
|
balanceUsd: number | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/state/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,EACR,sBAAsB,EACtB,eAAe,EACf,WAAW,EACX,mBAAmB,EACnB,aAAa,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/state/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,EACR,sBAAsB,EACtB,eAAe,EACf,WAAW,EACX,mBAAmB,EACnB,aAAa,EAChB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEhE;;GAEG;A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rate_limit_exports);
|
|
27
|
-
var
|
|
27
|
+
var import_llm = require("@dexto/llm");
|
|
28
28
|
const CHATGPT_RATE_LIMIT_WARNING_THRESHOLD = 80;
|
|
29
29
|
function shouldShowChatGPTRateLimitHint(status) {
|
|
30
30
|
if (!status) {
|
|
@@ -54,12 +54,12 @@ function getChatGPTRateLimitHint(status) {
|
|
|
54
54
|
return resetTime ? `ChatGPT cap ${usedPercent}% used \xB7 resets ${resetTime}` : `ChatGPT cap ${usedPercent}% used`;
|
|
55
55
|
}
|
|
56
56
|
function resolveChatGPTFallbackModel(currentModel) {
|
|
57
|
-
const currentModelIsValid = (0,
|
|
58
|
-
const fallbackModel = currentModelIsValid ? currentModel : (0,
|
|
57
|
+
const currentModelIsValid = (0, import_llm.isModelValidForProvider)("openai", currentModel);
|
|
58
|
+
const fallbackModel = currentModelIsValid ? currentModel : (0, import_llm.getDefaultModelForProvider)("openai") ?? currentModel;
|
|
59
59
|
return {
|
|
60
60
|
provider: "openai",
|
|
61
61
|
model: fallbackModel,
|
|
62
|
-
displayName: (0,
|
|
62
|
+
displayName: (0, import_llm.getModelDisplayName)(fallbackModel, "openai"),
|
|
63
63
|
usedDefaultFallback: !currentModelIsValid && fallbackModel !== currentModel
|
|
64
64
|
};
|
|
65
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatgpt-rate-limit.d.ts","sourceRoot":"","sources":["../../src/utils/chatgpt-rate-limit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chatgpt-rate-limit.d.ts","sourceRoot":"","sources":["../../src/utils/chatgpt-rate-limit.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE1D,eAAO,MAAM,oCAAoC,KAAK,CAAC;AAEvD,wBAAgB,8BAA8B,CAC1C,MAAM,EAAE,sBAAsB,GAAG,IAAI,GAAG,SAAS,GAClD,OAAO,CAMT;AAkBD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,CAW9E;AAED,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,MAAM,GAAG;IAC/D,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,OAAO,CAAC;CAChC,CAYA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llm-provider-display.d.ts","sourceRoot":"","sources":["../../src/utils/llm-provider-display.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"llm-provider-display.d.ts","sourceRoot":"","sources":["../../src/utils/llm-provider-display.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAsB9C,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAYzF"}
|
|
@@ -38,13 +38,11 @@ __export(messageFormatting_exports, {
|
|
|
38
38
|
createUserMessage: () => createUserMessage,
|
|
39
39
|
extractAutomationTriggerInfo: () => extractAutomationTriggerInfo,
|
|
40
40
|
formatPathForDisplay: () => formatPathForDisplay,
|
|
41
|
-
formatSkillInvocationMessage: () => formatSkillInvocationMessage,
|
|
42
41
|
formatToolHeader: () => formatToolHeader,
|
|
43
42
|
formatToolResultPreview: () => formatToolResultPreview,
|
|
44
43
|
getStartupInfo: () => getStartupInfo,
|
|
45
44
|
getToolDisplayName: () => getToolDisplayName,
|
|
46
45
|
getToolTypeBadge: () => getToolTypeBadge,
|
|
47
|
-
isSkillInvocationMessage: () => isSkillInvocationMessage,
|
|
48
46
|
makeRelativePath: () => makeRelativePath,
|
|
49
47
|
normalizeToolName: () => normalizeToolName,
|
|
50
48
|
shouldHideTool: () => shouldHideTool,
|
|
@@ -73,23 +71,7 @@ function shouldHideTool(toolName) {
|
|
|
73
71
|
}
|
|
74
72
|
const backgroundCompletionRegex = /<background-task-completion>[\s\S]*?<\/background-task-completion>/g;
|
|
75
73
|
const stripBackgroundCompletion = (text) => text.replace(backgroundCompletionRegex, "").replace("<background-task-completion>", "").trim();
|
|
76
|
-
const SKILL_INVOCATION_REGEX = /<skill-invocation>[\s\S]*?skill:\s*"(?:config:)?([^"]+)"[\s\S]*?<\/skill-invocation>/;
|
|
77
74
|
const AUTOMATION_TRIGGER_REGEX = /<scheduled_automation_trigger>[\s\S]*?<\/scheduled_automation_trigger>/;
|
|
78
|
-
function formatSkillInvocationMessage(content) {
|
|
79
|
-
const match = content.match(SKILL_INVOCATION_REGEX);
|
|
80
|
-
if (match) {
|
|
81
|
-
const skillName = match[1];
|
|
82
|
-
const contextMatch = content.match(/Task context:\s*(.+?)(?:\n|$)/);
|
|
83
|
-
if (contextMatch) {
|
|
84
|
-
return `/${skillName} ${contextMatch[1]}`;
|
|
85
|
-
}
|
|
86
|
-
return `/${skillName}`;
|
|
87
|
-
}
|
|
88
|
-
return content;
|
|
89
|
-
}
|
|
90
|
-
function isSkillInvocationMessage(content) {
|
|
91
|
-
return SKILL_INVOCATION_REGEX.test(content);
|
|
92
|
-
}
|
|
93
75
|
function extractAutomationTriggerInfo(content) {
|
|
94
76
|
const match = content.match(AUTOMATION_TRIGGER_REGEX);
|
|
95
77
|
if (!match) {
|
|
@@ -394,9 +376,6 @@ function convertHistoryToUIMessages(history, sessionId) {
|
|
|
394
376
|
});
|
|
395
377
|
textContent = stripAutomationTriggerTags(textContent);
|
|
396
378
|
}
|
|
397
|
-
if (msg.role === "user") {
|
|
398
|
-
textContent = formatSkillInvocationMessage(textContent);
|
|
399
|
-
}
|
|
400
379
|
uiMessages.push({
|
|
401
380
|
id: `session-${sessionId}-${index}`,
|
|
402
381
|
role: msg.role,
|
|
@@ -445,13 +424,11 @@ async function getStartupInfo(agent, sessionId) {
|
|
|
445
424
|
createUserMessage,
|
|
446
425
|
extractAutomationTriggerInfo,
|
|
447
426
|
formatPathForDisplay,
|
|
448
|
-
formatSkillInvocationMessage,
|
|
449
427
|
formatToolHeader,
|
|
450
428
|
formatToolResultPreview,
|
|
451
429
|
getStartupInfo,
|
|
452
430
|
getToolDisplayName,
|
|
453
431
|
getToolTypeBadge,
|
|
454
|
-
isSkillInvocationMessage,
|
|
455
432
|
makeRelativePath,
|
|
456
433
|
normalizeToolName,
|
|
457
434
|
shouldHideTool,
|
|
@@ -7,19 +7,6 @@ import type { Message, ExternalTriggerStyledData } from '../state/types.js';
|
|
|
7
7
|
import { type TuiAgentBackend } from '../agent-backend.js';
|
|
8
8
|
export declare function normalizeToolName(toolName: string): string;
|
|
9
9
|
export declare function shouldHideTool(toolName: string | undefined): boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Formats a skill invocation message for clean display.
|
|
12
|
-
* Converts verbose <skill-invocation> blocks to clean /skill-name format.
|
|
13
|
-
* Works for both fork skills (just the tag) and inline skills (tag + content).
|
|
14
|
-
*
|
|
15
|
-
* @param content - The message content to check and format
|
|
16
|
-
* @returns Formatted content if it's a skill invocation, original content otherwise
|
|
17
|
-
*/
|
|
18
|
-
export declare function formatSkillInvocationMessage(content: string): string;
|
|
19
|
-
/**
|
|
20
|
-
* Checks if a message content is a skill invocation.
|
|
21
|
-
*/
|
|
22
|
-
export declare function isSkillInvocationMessage(content: string): boolean;
|
|
23
10
|
export declare function extractAutomationTriggerInfo(content: string): {
|
|
24
11
|
label: string;
|
|
25
12
|
timestamp: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageFormatting.d.ts","sourceRoot":"","sources":["../../src/utils/messageFormatting.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EACR,eAAe,EAGf,0BAA0B,EAC7B,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAIhF,wBAAgB,i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;;GAEG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;;;;;;;;GA+BpF"}
|
|
@@ -20,23 +20,7 @@ function shouldHideTool(toolName) {
|
|
|
20
20
|
const backgroundCompletionRegex = /<background-task-completion>[\s\S]*?<\/background-task-completion>/g;
|
|
21
21
|
const stripBackgroundCompletion = (text) => text.replace(backgroundCompletionRegex, "").replace("<background-task-completion>", "").trim();
|
|
22
22
|
import { generateMessageId } from "./idGenerator.js";
|
|
23
|
-
const SKILL_INVOCATION_REGEX = /<skill-invocation>[\s\S]*?skill:\s*"(?:config:)?([^"]+)"[\s\S]*?<\/skill-invocation>/;
|
|
24
23
|
const AUTOMATION_TRIGGER_REGEX = /<scheduled_automation_trigger>[\s\S]*?<\/scheduled_automation_trigger>/;
|
|
25
|
-
function formatSkillInvocationMessage(content) {
|
|
26
|
-
const match = content.match(SKILL_INVOCATION_REGEX);
|
|
27
|
-
if (match) {
|
|
28
|
-
const skillName = match[1];
|
|
29
|
-
const contextMatch = content.match(/Task context:\s*(.+?)(?:\n|$)/);
|
|
30
|
-
if (contextMatch) {
|
|
31
|
-
return `/${skillName} ${contextMatch[1]}`;
|
|
32
|
-
}
|
|
33
|
-
return `/${skillName}`;
|
|
34
|
-
}
|
|
35
|
-
return content;
|
|
36
|
-
}
|
|
37
|
-
function isSkillInvocationMessage(content) {
|
|
38
|
-
return SKILL_INVOCATION_REGEX.test(content);
|
|
39
|
-
}
|
|
40
24
|
function extractAutomationTriggerInfo(content) {
|
|
41
25
|
const match = content.match(AUTOMATION_TRIGGER_REGEX);
|
|
42
26
|
if (!match) {
|
|
@@ -341,9 +325,6 @@ function convertHistoryToUIMessages(history, sessionId) {
|
|
|
341
325
|
});
|
|
342
326
|
textContent = stripAutomationTriggerTags(textContent);
|
|
343
327
|
}
|
|
344
|
-
if (msg.role === "user") {
|
|
345
|
-
textContent = formatSkillInvocationMessage(textContent);
|
|
346
|
-
}
|
|
347
328
|
uiMessages.push({
|
|
348
329
|
id: `session-${sessionId}-${index}`,
|
|
349
330
|
role: msg.role,
|
|
@@ -391,13 +372,11 @@ export {
|
|
|
391
372
|
createUserMessage,
|
|
392
373
|
extractAutomationTriggerInfo,
|
|
393
374
|
formatPathForDisplay,
|
|
394
|
-
formatSkillInvocationMessage,
|
|
395
375
|
formatToolHeader,
|
|
396
376
|
formatToolResultPreview,
|
|
397
377
|
getStartupInfo,
|
|
398
378
|
getToolDisplayName,
|
|
399
379
|
getToolTypeBadge,
|
|
400
|
-
isSkillInvocationMessage,
|
|
401
380
|
makeRelativePath,
|
|
402
381
|
normalizeToolName,
|
|
403
382
|
shouldHideTool,
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var queuedComposerContent_exports = {};
|
|
20
|
+
__export(queuedComposerContent_exports, {
|
|
21
|
+
previewQueuedContent: () => previewQueuedContent,
|
|
22
|
+
restoreQueuedContentForComposer: () => restoreQueuedContentForComposer
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(queuedComposerContent_exports);
|
|
25
|
+
function imagePlaceholder(index) {
|
|
26
|
+
return `[Image ${index}]`;
|
|
27
|
+
}
|
|
28
|
+
function imagePlaceholdersIn(text) {
|
|
29
|
+
const seen = /* @__PURE__ */ new Set();
|
|
30
|
+
const placeholders = [];
|
|
31
|
+
for (const match of text.matchAll(/\[Image \d+\]/g)) {
|
|
32
|
+
const placeholder = match[0];
|
|
33
|
+
if (!seen.has(placeholder)) {
|
|
34
|
+
seen.add(placeholder);
|
|
35
|
+
placeholders.push(placeholder);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return placeholders;
|
|
39
|
+
}
|
|
40
|
+
function nextImagePlaceholder(usedPlaceholders) {
|
|
41
|
+
let index = 1;
|
|
42
|
+
while (usedPlaceholders.has(imagePlaceholder(index))) {
|
|
43
|
+
index += 1;
|
|
44
|
+
}
|
|
45
|
+
const placeholder = imagePlaceholder(index);
|
|
46
|
+
usedPlaceholders.add(placeholder);
|
|
47
|
+
return placeholder;
|
|
48
|
+
}
|
|
49
|
+
function imageDataForComposer(part) {
|
|
50
|
+
if (typeof part.image === "string") {
|
|
51
|
+
return part.image;
|
|
52
|
+
}
|
|
53
|
+
if (part.image instanceof URL) {
|
|
54
|
+
return part.image.toString();
|
|
55
|
+
}
|
|
56
|
+
if (part.image instanceof ArrayBuffer) {
|
|
57
|
+
return Buffer.from(new Uint8Array(part.image)).toString("base64");
|
|
58
|
+
}
|
|
59
|
+
return Buffer.from(part.image).toString("base64");
|
|
60
|
+
}
|
|
61
|
+
function textParts(content) {
|
|
62
|
+
return content.filter((part) => part.type === "text");
|
|
63
|
+
}
|
|
64
|
+
function imageParts(content) {
|
|
65
|
+
return content.filter((part) => part.type === "image");
|
|
66
|
+
}
|
|
67
|
+
function unsupportedParts(content) {
|
|
68
|
+
return content.filter((part) => part.type !== "text" && part.type !== "image");
|
|
69
|
+
}
|
|
70
|
+
function appendPlaceholderSegment(segments, placeholder) {
|
|
71
|
+
const previousSegment = segments[segments.length - 1];
|
|
72
|
+
if (previousSegment?.match(/^\[Image \d+\]( \[Image \d+\])*$/)) {
|
|
73
|
+
segments[segments.length - 1] = `${previousSegment} ${placeholder}`;
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
segments.push(placeholder);
|
|
77
|
+
}
|
|
78
|
+
function composerTextAndPlaceholders(content) {
|
|
79
|
+
const text = textParts(content).map((part) => part.text).join("\n");
|
|
80
|
+
const existingPlaceholders = imagePlaceholdersIn(text);
|
|
81
|
+
const usedPlaceholders = new Set(existingPlaceholders);
|
|
82
|
+
const placeholders = [];
|
|
83
|
+
const segments = [];
|
|
84
|
+
let existingPlaceholderIndex = 0;
|
|
85
|
+
for (const part of content) {
|
|
86
|
+
if (part.type === "text") {
|
|
87
|
+
if (part.text.length > 0) {
|
|
88
|
+
segments.push(part.text);
|
|
89
|
+
}
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (part.type !== "image") {
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
const existingPlaceholder = existingPlaceholders[existingPlaceholderIndex];
|
|
96
|
+
if (existingPlaceholder) {
|
|
97
|
+
placeholders.push(existingPlaceholder);
|
|
98
|
+
existingPlaceholderIndex += 1;
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
const placeholder = nextImagePlaceholder(usedPlaceholders);
|
|
102
|
+
placeholders.push(placeholder);
|
|
103
|
+
appendPlaceholderSegment(segments, placeholder);
|
|
104
|
+
}
|
|
105
|
+
return { text: segments.join("\n"), placeholders };
|
|
106
|
+
}
|
|
107
|
+
function restoreQueuedContentForComposer(message) {
|
|
108
|
+
const unsupported = unsupportedParts(message.content);
|
|
109
|
+
if (unsupported.length > 0) {
|
|
110
|
+
return {
|
|
111
|
+
ok: false,
|
|
112
|
+
reason: "Queued input with non-image attachments cannot be edited in the terminal yet."
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
const images = imageParts(message.content);
|
|
116
|
+
const composer = composerTextAndPlaceholders(message.content);
|
|
117
|
+
return {
|
|
118
|
+
ok: true,
|
|
119
|
+
composer: {
|
|
120
|
+
text: composer.text,
|
|
121
|
+
images: images.map((part, index) => ({
|
|
122
|
+
id: `${message.id}-image-${index + 1}`,
|
|
123
|
+
data: imageDataForComposer(part),
|
|
124
|
+
mimeType: part.mimeType ?? "image/png",
|
|
125
|
+
placeholder: composer.placeholders[index] ?? imagePlaceholder(index + 1)
|
|
126
|
+
}))
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function previewQueuedContent(content) {
|
|
131
|
+
const textWithImages = composerTextAndPlaceholders(content).text.replace(/\n/g, " ");
|
|
132
|
+
const markers = content.filter((part) => part.type !== "text" && part.type !== "image").map((part) => {
|
|
133
|
+
switch (part.type) {
|
|
134
|
+
case "file":
|
|
135
|
+
return part.filename ? `[file: ${part.filename}]` : "[file]";
|
|
136
|
+
case "resource":
|
|
137
|
+
return `[resource: ${part.name}]`;
|
|
138
|
+
case "ui-resource":
|
|
139
|
+
return "[ui resource]";
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
return [textWithImages, ...markers].filter(Boolean).join(" ") || "[attachment]";
|
|
143
|
+
}
|
|
144
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
145
|
+
0 && (module.exports = {
|
|
146
|
+
previewQueuedContent,
|
|
147
|
+
restoreQueuedContentForComposer
|
|
148
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { QueuedMessage, ContentPart } from '@dexto/core';
|
|
2
|
+
import type { PendingImage } from '../state/types.js';
|
|
3
|
+
interface ComposerQueuedContent {
|
|
4
|
+
text: string;
|
|
5
|
+
images: PendingImage[];
|
|
6
|
+
}
|
|
7
|
+
type RestoreQueuedContentResult = {
|
|
8
|
+
ok: true;
|
|
9
|
+
composer: ComposerQueuedContent;
|
|
10
|
+
} | {
|
|
11
|
+
ok: false;
|
|
12
|
+
reason: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function restoreQueuedContentForComposer(message: QueuedMessage): RestoreQueuedContentResult;
|
|
15
|
+
export declare function previewQueuedContent(content: ContentPart[]): string;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=queuedComposerContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queuedComposerContent.d.ts","sourceRoot":"","sources":["../../src/utils/queuedComposerContent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAuB,MAAM,aAAa,CAAC;AACnF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,UAAU,qBAAqB;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,YAAY,EAAE,CAAC;CAC1B;AAED,KAAK,0BAA0B,GACzB;IACI,EAAE,EAAE,IAAI,CAAC;IACT,QAAQ,EAAE,qBAAqB,CAAC;CACnC,GACD;IACI,EAAE,EAAE,KAAK,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;CAClB,CAAC;AA0GR,wBAAgB,+BAA+B,CAC3C,OAAO,EAAE,aAAa,GACvB,0BAA0B,CAyB5B;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,MAAM,CAiBnE"}
|