@dexto/tui 1.6.22 → 1.6.25

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