@dexto/tui 1.6.24 → 1.6.26
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.d.ts +1 -1
- package/dist/agent-backend.d.ts.map +1 -1
- package/dist/components/overlays/InsufficientCreditsOverlay.cjs +264 -0
- package/dist/components/overlays/InsufficientCreditsOverlay.d.ts +14 -0
- package/dist/components/overlays/InsufficientCreditsOverlay.d.ts.map +1 -0
- package/dist/components/overlays/InsufficientCreditsOverlay.js +252 -0
- package/dist/components/overlays/ToolBrowser.cjs +15 -6
- package/dist/components/overlays/ToolBrowser.d.ts.map +1 -1
- package/dist/components/overlays/ToolBrowser.js +15 -6
- package/dist/components/overlays/custom-model-wizard/provider-config.cjs +1 -1
- package/dist/components/overlays/custom-model-wizard/provider-config.js +1 -1
- package/dist/containers/OverlayContainer.cjs +75 -22
- package/dist/containers/OverlayContainer.d.ts.map +1 -1
- package/dist/containers/OverlayContainer.js +75 -22
- package/dist/hooks/useAgentEvents.cjs +5 -2
- package/dist/hooks/useAgentEvents.d.ts.map +1 -1
- package/dist/hooks/useAgentEvents.js +5 -2
- package/dist/hooks/useCLIState.cjs +1 -0
- package/dist/hooks/useCLIState.d.ts.map +1 -1
- package/dist/hooks/useCLIState.js +1 -0
- package/dist/host/index.cjs +16 -0
- package/dist/host/index.d.ts +12 -0
- package/dist/host/index.d.ts.map +1 -1
- package/dist/host/index.js +14 -0
- package/dist/index.d.cts +7 -1
- package/dist/services/processStream.cjs +48 -2
- package/dist/services/processStream.d.ts.map +1 -1
- package/dist/services/processStream.js +49 -3
- package/dist/services/processStream.test.cjs +32 -0
- package/dist/services/processStream.test.js +32 -0
- package/dist/state/initialState.cjs +1 -0
- package/dist/state/initialState.d.ts.map +1 -1
- package/dist/state/initialState.js +1 -0
- package/dist/state/types.d.ts +5 -1
- package/dist/state/types.d.ts.map +1 -1
- package/dist/utils/dexto-auth-refresh.cjs +55 -0
- package/dist/utils/dexto-auth-refresh.d.ts +3 -0
- package/dist/utils/dexto-auth-refresh.d.ts.map +1 -0
- package/dist/utils/dexto-auth-refresh.js +31 -0
- package/dist/utils/dexto-auth-refresh.test.cjs +122 -0
- package/dist/utils/dexto-auth-refresh.test.d.ts +2 -0
- package/dist/utils/dexto-auth-refresh.test.d.ts.map +1 -0
- package/dist/utils/dexto-auth-refresh.test.js +121 -0
- package/package.json +4 -4
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { refreshDextoNovaAuthAfterLogin } from "./dexto-auth-refresh.js";
|
|
3
|
+
function createConfig(provider) {
|
|
4
|
+
return {
|
|
5
|
+
provider,
|
|
6
|
+
model: provider === "dexto-nova" ? "openai/gpt-5" : "gpt-5",
|
|
7
|
+
apiKey: "existing-key",
|
|
8
|
+
maxIterations: 50,
|
|
9
|
+
maxInputTokens: 128e3
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
describe("refreshDextoNovaAuthAfterLogin", () => {
|
|
13
|
+
it("does nothing when neither the global nor session config uses dexto-nova", async () => {
|
|
14
|
+
const getCurrentLLMConfig = vi.fn().mockImplementation(
|
|
15
|
+
(sessionId) => sessionId ? createConfig("openai") : createConfig("openai")
|
|
16
|
+
);
|
|
17
|
+
const hasSessionLLMOverride = vi.fn().mockReturnValue(false);
|
|
18
|
+
const switchLLM = vi.fn().mockResolvedValue(
|
|
19
|
+
createConfig("openai")
|
|
20
|
+
);
|
|
21
|
+
const refreshed = await refreshDextoNovaAuthAfterLogin(
|
|
22
|
+
{ getCurrentLLMConfig, hasSessionLLMOverride, switchLLM },
|
|
23
|
+
"session-1"
|
|
24
|
+
);
|
|
25
|
+
expect(refreshed).toBe(false);
|
|
26
|
+
expect(switchLLM).not.toHaveBeenCalled();
|
|
27
|
+
});
|
|
28
|
+
it("refreshes the global and active session config when both use dexto-nova", async () => {
|
|
29
|
+
const getCurrentLLMConfig = vi.fn().mockImplementation(
|
|
30
|
+
(sessionId) => sessionId ? createConfig("dexto-nova") : createConfig("dexto-nova")
|
|
31
|
+
);
|
|
32
|
+
const hasSessionLLMOverride = vi.fn().mockReturnValue(true);
|
|
33
|
+
const switchLLM = vi.fn().mockResolvedValue(
|
|
34
|
+
createConfig("dexto-nova")
|
|
35
|
+
);
|
|
36
|
+
const refreshed = await refreshDextoNovaAuthAfterLogin(
|
|
37
|
+
{ getCurrentLLMConfig, hasSessionLLMOverride, switchLLM },
|
|
38
|
+
"session-1"
|
|
39
|
+
);
|
|
40
|
+
expect(refreshed).toBe(true);
|
|
41
|
+
expect(switchLLM).toHaveBeenCalledTimes(2);
|
|
42
|
+
expect(switchLLM).toHaveBeenNthCalledWith(1, {
|
|
43
|
+
provider: "dexto-nova",
|
|
44
|
+
model: "openai/gpt-5",
|
|
45
|
+
apiKey: "$DEXTO_API_KEY"
|
|
46
|
+
});
|
|
47
|
+
expect(switchLLM).toHaveBeenNthCalledWith(
|
|
48
|
+
2,
|
|
49
|
+
{
|
|
50
|
+
provider: "dexto-nova",
|
|
51
|
+
model: "openai/gpt-5",
|
|
52
|
+
apiKey: "$DEXTO_API_KEY"
|
|
53
|
+
},
|
|
54
|
+
"session-1"
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
it("refreshes only the global config when the session inherits dexto-nova without an override", async () => {
|
|
58
|
+
const getCurrentLLMConfig = vi.fn().mockImplementation(
|
|
59
|
+
(sessionId) => sessionId ? createConfig("dexto-nova") : createConfig("dexto-nova")
|
|
60
|
+
);
|
|
61
|
+
const hasSessionLLMOverride = vi.fn().mockReturnValue(false);
|
|
62
|
+
const switchLLM = vi.fn().mockResolvedValue(
|
|
63
|
+
createConfig("dexto-nova")
|
|
64
|
+
);
|
|
65
|
+
const refreshed = await refreshDextoNovaAuthAfterLogin(
|
|
66
|
+
{ getCurrentLLMConfig, hasSessionLLMOverride, switchLLM },
|
|
67
|
+
"session-1"
|
|
68
|
+
);
|
|
69
|
+
expect(refreshed).toBe(true);
|
|
70
|
+
expect(hasSessionLLMOverride).toHaveBeenCalledWith("session-1");
|
|
71
|
+
expect(switchLLM).toHaveBeenCalledTimes(1);
|
|
72
|
+
expect(switchLLM).toHaveBeenCalledWith({
|
|
73
|
+
provider: "dexto-nova",
|
|
74
|
+
model: "openai/gpt-5",
|
|
75
|
+
apiKey: "$DEXTO_API_KEY"
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
it("refreshes only the active session when the global config uses another provider", async () => {
|
|
79
|
+
const getCurrentLLMConfig = vi.fn().mockImplementation(
|
|
80
|
+
(sessionId) => sessionId ? createConfig("dexto-nova") : createConfig("openai")
|
|
81
|
+
);
|
|
82
|
+
const hasSessionLLMOverride = vi.fn().mockReturnValue(true);
|
|
83
|
+
const switchLLM = vi.fn().mockResolvedValue(
|
|
84
|
+
createConfig("dexto-nova")
|
|
85
|
+
);
|
|
86
|
+
const refreshed = await refreshDextoNovaAuthAfterLogin(
|
|
87
|
+
{ getCurrentLLMConfig, hasSessionLLMOverride, switchLLM },
|
|
88
|
+
"session-1"
|
|
89
|
+
);
|
|
90
|
+
expect(refreshed).toBe(true);
|
|
91
|
+
expect(switchLLM).toHaveBeenCalledTimes(1);
|
|
92
|
+
expect(switchLLM).toHaveBeenCalledWith(
|
|
93
|
+
{
|
|
94
|
+
provider: "dexto-nova",
|
|
95
|
+
model: "openai/gpt-5",
|
|
96
|
+
apiKey: "$DEXTO_API_KEY"
|
|
97
|
+
},
|
|
98
|
+
"session-1"
|
|
99
|
+
);
|
|
100
|
+
});
|
|
101
|
+
it("refreshes only the global config when there is no active session id", async () => {
|
|
102
|
+
const getCurrentLLMConfig = vi.fn().mockImplementation(() => createConfig("dexto-nova"));
|
|
103
|
+
const hasSessionLLMOverride = vi.fn();
|
|
104
|
+
const switchLLM = vi.fn().mockResolvedValue(
|
|
105
|
+
createConfig("dexto-nova")
|
|
106
|
+
);
|
|
107
|
+
const refreshed = await refreshDextoNovaAuthAfterLogin({
|
|
108
|
+
getCurrentLLMConfig,
|
|
109
|
+
hasSessionLLMOverride,
|
|
110
|
+
switchLLM
|
|
111
|
+
});
|
|
112
|
+
expect(refreshed).toBe(true);
|
|
113
|
+
expect(switchLLM).toHaveBeenCalledTimes(1);
|
|
114
|
+
expect(switchLLM).toHaveBeenCalledWith({
|
|
115
|
+
provider: "dexto-nova",
|
|
116
|
+
model: "openai/gpt-5",
|
|
117
|
+
apiKey: "$DEXTO_API_KEY"
|
|
118
|
+
});
|
|
119
|
+
expect(hasSessionLLMOverride).not.toHaveBeenCalled();
|
|
120
|
+
});
|
|
121
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dexto/tui",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.26",
|
|
4
4
|
"description": "Interactive terminal UI for Dexto CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"string-width": "^8.1.0",
|
|
29
29
|
"strip-ansi": "^7.1.2",
|
|
30
30
|
"wrap-ansi": "^9.0.2",
|
|
31
|
-
"@dexto/agent-management": "1.6.
|
|
32
|
-
"@dexto/registry": "1.6.
|
|
33
|
-
"@dexto/core": "1.6.
|
|
31
|
+
"@dexto/agent-management": "1.6.26",
|
|
32
|
+
"@dexto/registry": "1.6.26",
|
|
33
|
+
"@dexto/core": "1.6.26"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/react": "^19.0.0",
|