@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
|
@@ -45,13 +45,13 @@ function useInputOrchestrator({
|
|
|
45
45
|
approval,
|
|
46
46
|
input,
|
|
47
47
|
session,
|
|
48
|
-
|
|
48
|
+
steerMessages,
|
|
49
49
|
buffer,
|
|
50
50
|
setUi,
|
|
51
51
|
setInput,
|
|
52
52
|
setMessages,
|
|
53
53
|
setPendingMessages,
|
|
54
|
-
|
|
54
|
+
setSteerMessages,
|
|
55
55
|
agent,
|
|
56
56
|
handlers
|
|
57
57
|
}) {
|
|
@@ -60,7 +60,7 @@ function useInputOrchestrator({
|
|
|
60
60
|
const approvalRef = useRef(approval);
|
|
61
61
|
const inputRef = useRef(input);
|
|
62
62
|
const sessionRef = useRef(session);
|
|
63
|
-
const
|
|
63
|
+
const steerMessagesRef = useRef(steerMessages);
|
|
64
64
|
const bufferRef = useRef(buffer);
|
|
65
65
|
const handlersRef = useRef(handlers);
|
|
66
66
|
useEffect(() => {
|
|
@@ -68,10 +68,10 @@ function useInputOrchestrator({
|
|
|
68
68
|
approvalRef.current = approval;
|
|
69
69
|
inputRef.current = input;
|
|
70
70
|
sessionRef.current = session;
|
|
71
|
-
|
|
71
|
+
steerMessagesRef.current = steerMessages;
|
|
72
72
|
bufferRef.current = buffer;
|
|
73
73
|
handlersRef.current = handlers;
|
|
74
|
-
}, [ui, approval, input, session,
|
|
74
|
+
}, [ui, approval, input, session, steerMessages, buffer, handlers]);
|
|
75
75
|
useEffect(() => {
|
|
76
76
|
if (!ui.exitWarningShown || !ui.exitWarningTimestamp) return;
|
|
77
77
|
const elapsed = Date.now() - ui.exitWarningTimestamp;
|
|
@@ -111,7 +111,7 @@ function useInputOrchestrator({
|
|
|
111
111
|
const currentUi = uiRef.current;
|
|
112
112
|
const currentApproval = approvalRef.current;
|
|
113
113
|
const currentSession = sessionRef.current;
|
|
114
|
-
const
|
|
114
|
+
const currentSteerMessages = steerMessagesRef.current;
|
|
115
115
|
const currentBuffer = bufferRef.current;
|
|
116
116
|
if (currentApproval !== null) {
|
|
117
117
|
return false;
|
|
@@ -140,8 +140,9 @@ function useInputOrchestrator({
|
|
|
140
140
|
if (currentSession.id) {
|
|
141
141
|
void agent.cancel(currentSession.id).catch(() => {
|
|
142
142
|
});
|
|
143
|
-
void agent.
|
|
143
|
+
void agent.clearSteerQueue(currentSession.id).catch(() => {
|
|
144
144
|
});
|
|
145
|
+
setSteerMessages([]);
|
|
145
146
|
}
|
|
146
147
|
setPendingMessages((pending) => {
|
|
147
148
|
if (pending.length > 0) {
|
|
@@ -175,8 +176,8 @@ function useInputOrchestrator({
|
|
|
175
176
|
timestamp: /* @__PURE__ */ new Date()
|
|
176
177
|
}
|
|
177
178
|
]);
|
|
178
|
-
if (
|
|
179
|
-
const coalescedText =
|
|
179
|
+
if (currentSteerMessages.length > 0) {
|
|
180
|
+
const coalescedText = currentSteerMessages.map(
|
|
180
181
|
(msg) => msg.content.filter(
|
|
181
182
|
(part) => part.type === "text"
|
|
182
183
|
).map((part) => part.text).join("\n")
|
|
@@ -185,7 +186,7 @@ function useInputOrchestrator({
|
|
|
185
186
|
currentBuffer.setText(coalescedText);
|
|
186
187
|
setInput((prev) => ({ ...prev, value: coalescedText }));
|
|
187
188
|
}
|
|
188
|
-
|
|
189
|
+
setSteerMessages([]);
|
|
189
190
|
}
|
|
190
191
|
return true;
|
|
191
192
|
}
|
|
@@ -193,7 +194,7 @@ function useInputOrchestrator({
|
|
|
193
194
|
return false;
|
|
194
195
|
}
|
|
195
196
|
return false;
|
|
196
|
-
}, [agent, setUi, setMessages, setPendingMessages,
|
|
197
|
+
}, [agent, setUi, setMessages, setPendingMessages, setSteerMessages, setInput]);
|
|
197
198
|
const handleKeypress = useCallback(
|
|
198
199
|
(rawKey) => {
|
|
199
200
|
const currentUi = uiRef.current;
|
|
@@ -404,7 +405,7 @@ function createApprovalInputHandler({
|
|
|
404
405
|
onCancel,
|
|
405
406
|
selectedOption,
|
|
406
407
|
setSelectedOption,
|
|
407
|
-
|
|
408
|
+
isCommandApproval
|
|
408
409
|
}) {
|
|
409
410
|
return (_input, key) => {
|
|
410
411
|
if (key.upArrow) {
|
|
@@ -413,13 +414,13 @@ function createApprovalInputHandler({
|
|
|
413
414
|
} else if (selectedOption === "yes-session") {
|
|
414
415
|
setSelectedOption("yes");
|
|
415
416
|
} else {
|
|
416
|
-
setSelectedOption(
|
|
417
|
+
setSelectedOption(isCommandApproval ? "yes" : "yes-session");
|
|
417
418
|
}
|
|
418
419
|
return true;
|
|
419
420
|
}
|
|
420
421
|
if (key.downArrow) {
|
|
421
422
|
if (selectedOption === "yes") {
|
|
422
|
-
setSelectedOption(
|
|
423
|
+
setSelectedOption(isCommandApproval ? "no" : "yes-session");
|
|
423
424
|
} else if (selectedOption === "yes-session") {
|
|
424
425
|
setSelectedOption("no");
|
|
425
426
|
} else {
|
package/dist/host/index.cjs
CHANGED
|
@@ -31,7 +31,7 @@ __export(host_exports, {
|
|
|
31
31
|
loadAuth: () => loadAuth,
|
|
32
32
|
openDextoBillingPage: () => openDextoBillingPage,
|
|
33
33
|
performDeviceCodeLogin: () => performDeviceCodeLogin,
|
|
34
|
-
|
|
34
|
+
persistDeviceApiKeyLoginResult: () => persistDeviceApiKeyLoginResult,
|
|
35
35
|
registerGracefulShutdown: () => registerGracefulShutdown,
|
|
36
36
|
removeAuth: () => removeAuth,
|
|
37
37
|
removeDextoApiKeyFromEnv: () => removeDextoApiKeyFromEnv,
|
|
@@ -75,11 +75,11 @@ async function performDeviceCodeLogin(options) {
|
|
|
75
75
|
}
|
|
76
76
|
return runtimeServices.performDeviceCodeLogin(options);
|
|
77
77
|
}
|
|
78
|
-
async function
|
|
79
|
-
if (!runtimeServices.
|
|
80
|
-
throw missingHostMethod("
|
|
78
|
+
async function persistDeviceApiKeyLoginResult(result) {
|
|
79
|
+
if (!runtimeServices.persistDeviceApiKeyLoginResult) {
|
|
80
|
+
throw missingHostMethod("persistDeviceApiKeyLoginResult");
|
|
81
81
|
}
|
|
82
|
-
return runtimeServices.
|
|
82
|
+
return runtimeServices.persistDeviceApiKeyLoginResult(result);
|
|
83
83
|
}
|
|
84
84
|
async function ensureDextoApiKeyForAuthToken(authToken, options) {
|
|
85
85
|
if (!runtimeServices.ensureDextoApiKeyForAuthToken) {
|
|
@@ -150,7 +150,7 @@ async function openDextoBillingPage(options) {
|
|
|
150
150
|
loadAuth,
|
|
151
151
|
openDextoBillingPage,
|
|
152
152
|
performDeviceCodeLogin,
|
|
153
|
-
|
|
153
|
+
persistDeviceApiKeyLoginResult,
|
|
154
154
|
registerGracefulShutdown,
|
|
155
155
|
removeAuth,
|
|
156
156
|
removeDextoApiKeyFromEnv,
|
package/dist/host/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LLMProvider } from '@dexto/
|
|
1
|
+
import type { LLMProvider } from '@dexto/llm';
|
|
2
2
|
import type { TuiAgentBackend } from '../agent-backend.js';
|
|
3
3
|
export interface TuiShutdownHandle {
|
|
4
4
|
stop?: (() => Promise<void>) | undefined;
|
|
@@ -14,15 +14,10 @@ export interface TuiAuthConfig {
|
|
|
14
14
|
dextoKeyId?: string | undefined;
|
|
15
15
|
dextoApiKeySource?: 'provisioned' | 'user-supplied' | undefined;
|
|
16
16
|
}
|
|
17
|
-
export interface
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
user?: {
|
|
22
|
-
id: string;
|
|
23
|
-
email: string;
|
|
24
|
-
name?: string | undefined;
|
|
25
|
-
} | undefined;
|
|
17
|
+
export interface TuiDeviceApiKeyLoginResult {
|
|
18
|
+
dextoApiKey: string;
|
|
19
|
+
dextoKeyId: string;
|
|
20
|
+
dextoKeyDisplay: string;
|
|
26
21
|
}
|
|
27
22
|
export interface TuiDeviceLoginPrompt {
|
|
28
23
|
userCode: string;
|
|
@@ -57,10 +52,8 @@ export interface TuiRuntimeServices {
|
|
|
57
52
|
performDeviceCodeLogin?: (options?: {
|
|
58
53
|
signal?: AbortSignal | undefined;
|
|
59
54
|
onPrompt?: ((prompt: TuiDeviceLoginPrompt) => void) | undefined;
|
|
60
|
-
}) => Promise<
|
|
61
|
-
|
|
62
|
-
onProvisionStatus?: ((status: TuiDextoApiKeyProvisionStatus) => void) | undefined;
|
|
63
|
-
}) => Promise<TuiPersistedLoginResult>;
|
|
55
|
+
}) => Promise<TuiDeviceApiKeyLoginResult>;
|
|
56
|
+
persistDeviceApiKeyLoginResult?: (result: TuiDeviceApiKeyLoginResult) => Promise<TuiPersistedLoginResult>;
|
|
64
57
|
ensureDextoApiKeyForAuthToken?: (authToken: string, options?: {
|
|
65
58
|
onStatus?: ((status: TuiDextoApiKeyProvisionStatus) => void) | undefined;
|
|
66
59
|
}) => Promise<{
|
|
@@ -102,10 +95,8 @@ export declare function getProviderInstructions(provider: LLMProvider): {
|
|
|
102
95
|
export declare function performDeviceCodeLogin(options?: {
|
|
103
96
|
signal?: AbortSignal | undefined;
|
|
104
97
|
onPrompt?: ((prompt: TuiDeviceLoginPrompt) => void) | undefined;
|
|
105
|
-
}): Promise<
|
|
106
|
-
export declare function
|
|
107
|
-
onProvisionStatus?: ((status: TuiDextoApiKeyProvisionStatus) => void) | undefined;
|
|
108
|
-
}): Promise<TuiPersistedLoginResult>;
|
|
98
|
+
}): Promise<TuiDeviceApiKeyLoginResult>;
|
|
99
|
+
export declare function persistDeviceApiKeyLoginResult(result: TuiDeviceApiKeyLoginResult): Promise<TuiPersistedLoginResult>;
|
|
109
100
|
export declare function ensureDextoApiKeyForAuthToken(authToken: string, options?: {
|
|
110
101
|
onStatus?: ((status: TuiDextoApiKeyProvisionStatus) => void) | undefined;
|
|
111
102
|
}): Promise<{
|
package/dist/host/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/host/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/host/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAAM,WAAW,iBAAiB;IAC9B,IAAI,CAAC,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC;CAC5C;AAED,MAAM,WAAW,aAAa;IAC1B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,iBAAiB,CAAC,EAAE,aAAa,GAAG,eAAe,GAAG,SAAS,CAAC;CACnE;AAED,MAAM,WAAW,0BAA0B;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,oBAAoB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,uBAAuB,EAAE,MAAM,GAAG,IAAI,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B,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,6BAA6B,KAAK,IAAI,CAAC,GAAG,SAAS,CAAA;CAAE,GACvF,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,CAAC,CAK/D;AAED,wBAAsB,QAAQ,IAAI,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAK9D;AAED,wBAAsB,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAKpE;AAED,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAKhD;AAED,wBAAsB,wBAAwB,CAAC,OAAO,CAAC,EAAE;IACrD,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC,CAKvD;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC,CAK5D;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC,CAK5D;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAK5E;AAED,wBAAsB,oBAAoB,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAK/F"}
|
package/dist/host/index.js
CHANGED
|
@@ -34,11 +34,11 @@ async function performDeviceCodeLogin(options) {
|
|
|
34
34
|
}
|
|
35
35
|
return runtimeServices.performDeviceCodeLogin(options);
|
|
36
36
|
}
|
|
37
|
-
async function
|
|
38
|
-
if (!runtimeServices.
|
|
39
|
-
throw missingHostMethod("
|
|
37
|
+
async function persistDeviceApiKeyLoginResult(result) {
|
|
38
|
+
if (!runtimeServices.persistDeviceApiKeyLoginResult) {
|
|
39
|
+
throw missingHostMethod("persistDeviceApiKeyLoginResult");
|
|
40
40
|
}
|
|
41
|
-
return runtimeServices.
|
|
41
|
+
return runtimeServices.persistDeviceApiKeyLoginResult(result);
|
|
42
42
|
}
|
|
43
43
|
async function ensureDextoApiKeyForAuthToken(authToken, options) {
|
|
44
44
|
if (!runtimeServices.ensureDextoApiKeyForAuthToken) {
|
|
@@ -108,7 +108,7 @@ export {
|
|
|
108
108
|
loadAuth,
|
|
109
109
|
openDextoBillingPage,
|
|
110
110
|
performDeviceCodeLogin,
|
|
111
|
-
|
|
111
|
+
persistDeviceApiKeyLoginResult,
|
|
112
112
|
registerGracefulShutdown,
|
|
113
113
|
removeAuth,
|
|
114
114
|
removeDextoApiKeyFromEnv,
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var import_vitest = require("vitest");
|
|
3
|
+
var import_index = require("./index.js");
|
|
4
|
+
(0, import_vitest.describe)("TUI auth runtime services", () => {
|
|
5
|
+
(0, import_vitest.afterEach)(() => {
|
|
6
|
+
(0, import_index.setTuiRuntimeServices)({});
|
|
7
|
+
});
|
|
8
|
+
(0, import_vitest.it)("uses host-provided API-key device login and persistence services", async () => {
|
|
9
|
+
const prompt = import_vitest.vi.fn();
|
|
10
|
+
const perform = import_vitest.vi.fn().mockResolvedValue({
|
|
11
|
+
dextoApiKey: "dxt_full_key",
|
|
12
|
+
dextoKeyDisplay: "dxt_abc...",
|
|
13
|
+
dextoKeyId: "key-id"
|
|
14
|
+
});
|
|
15
|
+
const persist = import_vitest.vi.fn().mockResolvedValue({
|
|
16
|
+
keyId: "key-id",
|
|
17
|
+
hasDextoApiKey: true
|
|
18
|
+
});
|
|
19
|
+
(0, import_index.setTuiRuntimeServices)({
|
|
20
|
+
performDeviceCodeLogin: perform,
|
|
21
|
+
persistDeviceApiKeyLoginResult: persist
|
|
22
|
+
});
|
|
23
|
+
const loginResult = await (0, import_index.performDeviceCodeLogin)({
|
|
24
|
+
onPrompt: prompt
|
|
25
|
+
});
|
|
26
|
+
const persisted = await (0, import_index.persistDeviceApiKeyLoginResult)(loginResult);
|
|
27
|
+
(0, import_vitest.expect)(perform).toHaveBeenCalledWith({ onPrompt: prompt });
|
|
28
|
+
(0, import_vitest.expect)(persist).toHaveBeenCalledWith({
|
|
29
|
+
dextoApiKey: "dxt_full_key",
|
|
30
|
+
dextoKeyDisplay: "dxt_abc...",
|
|
31
|
+
dextoKeyId: "key-id"
|
|
32
|
+
});
|
|
33
|
+
(0, import_vitest.expect)(persisted).toEqual({
|
|
34
|
+
keyId: "key-id",
|
|
35
|
+
hasDextoApiKey: true
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
(0, import_vitest.it)("fails fast when API-key device login persistence is not provided by the host", async () => {
|
|
39
|
+
await (0, import_vitest.expect)(
|
|
40
|
+
(0, import_index.persistDeviceApiKeyLoginResult)({
|
|
41
|
+
dextoApiKey: "dxt_full_key",
|
|
42
|
+
dextoKeyDisplay: "dxt_abc...",
|
|
43
|
+
dextoKeyId: "key-id"
|
|
44
|
+
})
|
|
45
|
+
).rejects.toThrow("TUI runtime services missing required method");
|
|
46
|
+
});
|
|
47
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/host/index.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import {
|
|
3
|
+
performDeviceCodeLogin,
|
|
4
|
+
persistDeviceApiKeyLoginResult,
|
|
5
|
+
setTuiRuntimeServices
|
|
6
|
+
} from "./index.js";
|
|
7
|
+
describe("TUI auth runtime services", () => {
|
|
8
|
+
afterEach(() => {
|
|
9
|
+
setTuiRuntimeServices({});
|
|
10
|
+
});
|
|
11
|
+
it("uses host-provided API-key device login and persistence services", async () => {
|
|
12
|
+
const prompt = vi.fn();
|
|
13
|
+
const perform = vi.fn().mockResolvedValue({
|
|
14
|
+
dextoApiKey: "dxt_full_key",
|
|
15
|
+
dextoKeyDisplay: "dxt_abc...",
|
|
16
|
+
dextoKeyId: "key-id"
|
|
17
|
+
});
|
|
18
|
+
const persist = vi.fn().mockResolvedValue({
|
|
19
|
+
keyId: "key-id",
|
|
20
|
+
hasDextoApiKey: true
|
|
21
|
+
});
|
|
22
|
+
setTuiRuntimeServices({
|
|
23
|
+
performDeviceCodeLogin: perform,
|
|
24
|
+
persistDeviceApiKeyLoginResult: persist
|
|
25
|
+
});
|
|
26
|
+
const loginResult = await performDeviceCodeLogin({
|
|
27
|
+
onPrompt: prompt
|
|
28
|
+
});
|
|
29
|
+
const persisted = await persistDeviceApiKeyLoginResult(loginResult);
|
|
30
|
+
expect(perform).toHaveBeenCalledWith({ onPrompt: prompt });
|
|
31
|
+
expect(persist).toHaveBeenCalledWith({
|
|
32
|
+
dextoApiKey: "dxt_full_key",
|
|
33
|
+
dextoKeyDisplay: "dxt_abc...",
|
|
34
|
+
dextoKeyId: "key-id"
|
|
35
|
+
});
|
|
36
|
+
expect(persisted).toEqual({
|
|
37
|
+
keyId: "key-id",
|
|
38
|
+
hasDextoApiKey: true
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
it("fails fast when API-key device login persistence is not provided by the host", async () => {
|
|
42
|
+
await expect(
|
|
43
|
+
persistDeviceApiKeyLoginResult({
|
|
44
|
+
dextoApiKey: "dxt_full_key",
|
|
45
|
+
dextoKeyDisplay: "dxt_abc...",
|
|
46
|
+
dextoKeyId: "key-id"
|
|
47
|
+
})
|
|
48
|
+
).rejects.toThrow("TUI runtime services missing required method");
|
|
49
|
+
});
|
|
50
|
+
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { DextoAgent, AgentEventMap, EventListener, SessionMetadata,
|
|
2
|
+
import { DextoAgent, AgentEventMap, EventListener, SessionMetadata, SkillManager } from '@dexto/core';
|
|
3
|
+
import { LLMProvider } from '@dexto/llm';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Core state types for Ink CLI
|
|
@@ -196,6 +197,7 @@ interface CommandDefinition {
|
|
|
196
197
|
interface TuiAgentCapabilities {
|
|
197
198
|
supportedCommands?: readonly string[];
|
|
198
199
|
prompts?: boolean;
|
|
200
|
+
skills?: boolean;
|
|
199
201
|
resources?: boolean;
|
|
200
202
|
attachments?: boolean;
|
|
201
203
|
reasoningCycle?: boolean;
|
|
@@ -226,7 +228,7 @@ interface TuiEffectiveConfig {
|
|
|
226
228
|
prompts?: unknown[] | undefined;
|
|
227
229
|
[key: string]: unknown;
|
|
228
230
|
}
|
|
229
|
-
interface TuiAgentBackend extends Pick<DextoAgent, 'stream' | 'stop' | 'run' | 'listSessions' | 'getSessionMetadata' | 'getSessionHistory' | 'getSessionTitle' | 'setSessionTitle' | 'generateSessionTitle' | 'forkSession' | 'getCurrentLLMConfig' | 'hasSessionLLMOverride' | 'switchLLM' | 'getSupportedProviders' | 'getSupportedModels' | 'getContextStats' | 'clearContext' | 'compactContext' | '
|
|
231
|
+
interface TuiAgentBackend extends Pick<DextoAgent, 'stream' | 'stop' | 'run' | 'listSessions' | 'getSessionMetadata' | 'getSessionHistory' | 'getSessionTitle' | 'setSessionTitle' | 'generateSessionTitle' | 'forkSession' | 'getCurrentLLMConfig' | 'hasSessionLLMOverride' | 'switchLLM' | 'getSupportedProviders' | 'getSupportedModels' | 'getContextStats' | 'clearContext' | 'compactContext' | 'steer' | 'followUp' | 'getSteerMessages' | 'getFollowUpMessages' | 'removeSteerMessage' | 'removeFollowUpMessage' | 'clearSteerQueue' | 'clearFollowUpQueue' | 'cancel' | 'searchMessages' | 'listPrompts' | 'refreshPrompts' | 'resolvePrompt' | 'getSystemPrompt' | 'loadToolkits' | 'listResources' | 'setLogLevel' | 'getAllTools' | 'getEnabledTools' | 'getAllMcpTools' | 'setGlobalDisabledTools' | 'setSessionDisabledTools' | 'setSessionAutoApproveTools' | 'getSessionAutoApproveTools' | 'getMcpServersWithStatus' | 'addMcpServer' | 'enableMcpServer' | 'disableMcpServer' | 'removeMcpServer' | 'restartMcpServer' | 'getMcpClients' | 'getMcpFailedConnections'> {
|
|
230
232
|
createSession: (sessionId?: string) => Promise<{
|
|
231
233
|
id: string;
|
|
232
234
|
logger: Pick<RootLogger, 'getLevel' | 'getLogFilePath'>;
|
|
@@ -260,6 +262,7 @@ interface TuiAgentBackend extends Pick<DextoAgent, 'stream' | 'stop' | 'run' | '
|
|
|
260
262
|
getHookNames: () => string[];
|
|
261
263
|
};
|
|
262
264
|
};
|
|
265
|
+
skillManager?: SkillManager | undefined;
|
|
263
266
|
capabilities?: TuiAgentCapabilities;
|
|
264
267
|
}
|
|
265
268
|
declare function getTuiCapabilities(agent: TuiAgentBackend): TuiAgentCapabilities;
|
|
@@ -368,15 +371,10 @@ interface TuiAuthConfig {
|
|
|
368
371
|
dextoKeyId?: string | undefined;
|
|
369
372
|
dextoApiKeySource?: 'provisioned' | 'user-supplied' | undefined;
|
|
370
373
|
}
|
|
371
|
-
interface
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
user?: {
|
|
376
|
-
id: string;
|
|
377
|
-
email: string;
|
|
378
|
-
name?: string | undefined;
|
|
379
|
-
} | undefined;
|
|
374
|
+
interface TuiDeviceApiKeyLoginResult {
|
|
375
|
+
dextoApiKey: string;
|
|
376
|
+
dextoKeyId: string;
|
|
377
|
+
dextoKeyDisplay: string;
|
|
380
378
|
}
|
|
381
379
|
interface TuiDeviceLoginPrompt {
|
|
382
380
|
userCode: string;
|
|
@@ -411,10 +409,8 @@ interface TuiRuntimeServices {
|
|
|
411
409
|
performDeviceCodeLogin?: (options?: {
|
|
412
410
|
signal?: AbortSignal | undefined;
|
|
413
411
|
onPrompt?: ((prompt: TuiDeviceLoginPrompt) => void) | undefined;
|
|
414
|
-
}) => Promise<
|
|
415
|
-
|
|
416
|
-
onProvisionStatus?: ((status: TuiDextoApiKeyProvisionStatus) => void) | undefined;
|
|
417
|
-
}) => Promise<TuiPersistedLoginResult>;
|
|
412
|
+
}) => Promise<TuiDeviceApiKeyLoginResult>;
|
|
413
|
+
persistDeviceApiKeyLoginResult?: (result: TuiDeviceApiKeyLoginResult) => Promise<TuiPersistedLoginResult>;
|
|
418
414
|
ensureDextoApiKeyForAuthToken?: (authToken: string, options?: {
|
|
419
415
|
onStatus?: ((status: TuiDextoApiKeyProvisionStatus) => void) | undefined;
|
|
420
416
|
}) => Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-parser.d.ts","sourceRoot":"","sources":["../../src/interactive-commands/command-parser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,MAAM,GAAG,YAAY,GAAG,iBAAiB,CAAC;AAEvF;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,uDAAuD;IACvD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,yEAAyE;IACzE,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CA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AAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,yEAAyE;IACzE,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAClC,OAAO,EAAE,CACL,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,eAAe,EACtB,GAAG,EAAE,cAAc,KAClB,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACtC;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAAa,OAAO,CAAC,oBAAoB,CAAS,CAAC;AA4ClF;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAiCvD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,GAAG,MAAM,EAAE,CAoB9F;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,iBAAiB,EAAE,QAAQ,GAAE,OAAe,GAAG,MAAM,CAmB3F;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAyDtE"}
|
|
@@ -45,6 +45,7 @@ var import_plugin = require("./plugin/index.js");
|
|
|
45
45
|
var import_system = require("./system/index.js");
|
|
46
46
|
var import_tool_commands = require("./tool-commands.js");
|
|
47
47
|
var import_prompt_commands = require("./prompt-commands.js");
|
|
48
|
+
var import_skill_commands = require("./skill-commands.js");
|
|
48
49
|
var import_documentation_commands = require("./documentation-commands.js");
|
|
49
50
|
var import_auth = require("./auth/index.js");
|
|
50
51
|
const CLI_COMMANDS = [];
|
|
@@ -75,6 +76,8 @@ const baseCommands = [
|
|
|
75
76
|
...import_tool_commands.toolCommands,
|
|
76
77
|
// Prompt management commands
|
|
77
78
|
...import_prompt_commands.promptCommands,
|
|
79
|
+
// Skill management commands
|
|
80
|
+
...import_skill_commands.skillCommands,
|
|
78
81
|
// System commands
|
|
79
82
|
...import_system.systemCommands,
|
|
80
83
|
// Documentation commands
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/interactive-commands/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEnF,OAAO,EAIH,KAAK,eAAe,EACvB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/interactive-commands/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEnF,OAAO,EAIH,KAAK,eAAe,EACvB,MAAM,qBAAqB,CAAC;AAgB7B;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,YAAY,EAAE,iBAAiB,EAAO,CAAC;AAiDpD;;;;;GAKG;AACH,wBAAsB,cAAc,CAChC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,eAAe,EACtB,SAAS,CAAC,EAAE,MAAM,EAClB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,GAC/B,OAAO,CAAC,oBAAoB,CAAC,CA+D/B;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,iBAAiB,EAAE,CAEpD;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,eAAe,GAAG,iBAAiB,EAAE,CAEhF"}
|
|
@@ -13,6 +13,7 @@ import { pluginCommands } from "./plugin/index.js";
|
|
|
13
13
|
import { systemCommands } from "./system/index.js";
|
|
14
14
|
import { toolCommands } from "./tool-commands.js";
|
|
15
15
|
import { promptCommands } from "./prompt-commands.js";
|
|
16
|
+
import { skillCommands } from "./skill-commands.js";
|
|
16
17
|
import { documentationCommands } from "./documentation-commands.js";
|
|
17
18
|
import { loginCommand, logoutCommand } from "./auth/index.js";
|
|
18
19
|
const CLI_COMMANDS = [];
|
|
@@ -43,6 +44,8 @@ const baseCommands = [
|
|
|
43
44
|
...toolCommands,
|
|
44
45
|
// Prompt management commands
|
|
45
46
|
...promptCommands,
|
|
47
|
+
// Skill management commands
|
|
48
|
+
...skillCommands,
|
|
46
49
|
// System commands
|
|
47
50
|
...systemCommands,
|
|
48
51
|
// Documentation commands
|
|
@@ -2,8 +2,17 @@
|
|
|
2
2
|
var import_vitest = require("vitest");
|
|
3
3
|
var import_commands = require("./commands.js");
|
|
4
4
|
function createAgent(capabilities) {
|
|
5
|
+
const skillManager = {
|
|
6
|
+
list: import_vitest.vi.fn().mockResolvedValue([]),
|
|
7
|
+
get: import_vitest.vi.fn().mockResolvedValue(null),
|
|
8
|
+
readFile: import_vitest.vi.fn(),
|
|
9
|
+
invoke: import_vitest.vi.fn(),
|
|
10
|
+
refresh: import_vitest.vi.fn()
|
|
11
|
+
};
|
|
5
12
|
return {
|
|
6
13
|
capabilities,
|
|
14
|
+
listPrompts: import_vitest.vi.fn(),
|
|
15
|
+
skillManager,
|
|
7
16
|
logger: {
|
|
8
17
|
debug: import_vitest.vi.fn(),
|
|
9
18
|
info: import_vitest.vi.fn(),
|
|
@@ -25,4 +34,37 @@ function createAgent(capabilities) {
|
|
|
25
34
|
const result = await (0, import_commands.executeCommand)("prompts", [], agent);
|
|
26
35
|
(0, import_vitest.expect)(result).toBe("\u26A0\uFE0F Command /prompts is not available for this chat target.");
|
|
27
36
|
});
|
|
37
|
+
(0, import_vitest.it)("lists skills through SkillManager when prompt commands are disabled", async () => {
|
|
38
|
+
const agent = createAgent({ prompts: false });
|
|
39
|
+
const skillManager = agent.skillManager;
|
|
40
|
+
if (!skillManager) throw new Error("Expected test agent to have skills");
|
|
41
|
+
import_vitest.vi.mocked(skillManager.list).mockResolvedValue([
|
|
42
|
+
{
|
|
43
|
+
id: "review",
|
|
44
|
+
displayName: "Code Review",
|
|
45
|
+
description: "Review code changes"
|
|
46
|
+
}
|
|
47
|
+
]);
|
|
48
|
+
const result = await (0, import_commands.executeCommand)("skills", [], agent);
|
|
49
|
+
(0, import_vitest.expect)(skillManager.list).toHaveBeenCalled();
|
|
50
|
+
(0, import_vitest.expect)(agent.listPrompts).not.toHaveBeenCalled();
|
|
51
|
+
(0, import_vitest.expect)(result).toContain("Available Skills");
|
|
52
|
+
(0, import_vitest.expect)(result).toContain("Code Review");
|
|
53
|
+
});
|
|
54
|
+
(0, import_vitest.it)("reads one skill through SkillManager", async () => {
|
|
55
|
+
const agent = createAgent();
|
|
56
|
+
const skillManager = agent.skillManager;
|
|
57
|
+
if (!skillManager) throw new Error("Expected test agent to have skills");
|
|
58
|
+
import_vitest.vi.mocked(skillManager.get).mockResolvedValue({
|
|
59
|
+
id: "review",
|
|
60
|
+
displayName: "Code Review",
|
|
61
|
+
description: "Review code changes",
|
|
62
|
+
instructions: "Check tests and edge cases."
|
|
63
|
+
});
|
|
64
|
+
const result = await (0, import_commands.executeCommand)("skills", ["review"], agent);
|
|
65
|
+
(0, import_vitest.expect)(skillManager.get).toHaveBeenCalledWith("review");
|
|
66
|
+
(0, import_vitest.expect)(agent.listPrompts).not.toHaveBeenCalled();
|
|
67
|
+
(0, import_vitest.expect)(result).toContain("Code Review");
|
|
68
|
+
(0, import_vitest.expect)(result).toContain("Check tests and edge cases.");
|
|
69
|
+
});
|
|
28
70
|
});
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { describe, expect, it, vi } from "vitest";
|
|
2
2
|
import { executeCommand } from "./commands.js";
|
|
3
3
|
function createAgent(capabilities) {
|
|
4
|
+
const skillManager = {
|
|
5
|
+
list: vi.fn().mockResolvedValue([]),
|
|
6
|
+
get: vi.fn().mockResolvedValue(null),
|
|
7
|
+
readFile: vi.fn(),
|
|
8
|
+
invoke: vi.fn(),
|
|
9
|
+
refresh: vi.fn()
|
|
10
|
+
};
|
|
4
11
|
return {
|
|
5
12
|
capabilities,
|
|
13
|
+
listPrompts: vi.fn(),
|
|
14
|
+
skillManager,
|
|
6
15
|
logger: {
|
|
7
16
|
debug: vi.fn(),
|
|
8
17
|
info: vi.fn(),
|
|
@@ -24,4 +33,37 @@ describe("executeCommand", () => {
|
|
|
24
33
|
const result = await executeCommand("prompts", [], agent);
|
|
25
34
|
expect(result).toBe("\u26A0\uFE0F Command /prompts is not available for this chat target.");
|
|
26
35
|
});
|
|
36
|
+
it("lists skills through SkillManager when prompt commands are disabled", async () => {
|
|
37
|
+
const agent = createAgent({ prompts: false });
|
|
38
|
+
const skillManager = agent.skillManager;
|
|
39
|
+
if (!skillManager) throw new Error("Expected test agent to have skills");
|
|
40
|
+
vi.mocked(skillManager.list).mockResolvedValue([
|
|
41
|
+
{
|
|
42
|
+
id: "review",
|
|
43
|
+
displayName: "Code Review",
|
|
44
|
+
description: "Review code changes"
|
|
45
|
+
}
|
|
46
|
+
]);
|
|
47
|
+
const result = await executeCommand("skills", [], agent);
|
|
48
|
+
expect(skillManager.list).toHaveBeenCalled();
|
|
49
|
+
expect(agent.listPrompts).not.toHaveBeenCalled();
|
|
50
|
+
expect(result).toContain("Available Skills");
|
|
51
|
+
expect(result).toContain("Code Review");
|
|
52
|
+
});
|
|
53
|
+
it("reads one skill through SkillManager", async () => {
|
|
54
|
+
const agent = createAgent();
|
|
55
|
+
const skillManager = agent.skillManager;
|
|
56
|
+
if (!skillManager) throw new Error("Expected test agent to have skills");
|
|
57
|
+
vi.mocked(skillManager.get).mockResolvedValue({
|
|
58
|
+
id: "review",
|
|
59
|
+
displayName: "Code Review",
|
|
60
|
+
description: "Review code changes",
|
|
61
|
+
instructions: "Check tests and edge cases."
|
|
62
|
+
});
|
|
63
|
+
const result = await executeCommand("skills", ["review"], agent);
|
|
64
|
+
expect(skillManager.get).toHaveBeenCalledWith("review");
|
|
65
|
+
expect(agent.listPrompts).not.toHaveBeenCalled();
|
|
66
|
+
expect(result).toContain("Code Review");
|
|
67
|
+
expect(result).toContain("Check tests and edge cases.");
|
|
68
|
+
});
|
|
27
69
|
});
|