zidane 8.2.1 → 8.2.2

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 (182) hide show
  1. package/dist/acp-cli.js +8 -8
  2. package/dist/{acp-D7Pr8NGt.js → acp-oYRjlh71.js} +6 -6
  3. package/dist/{acp-D7Pr8NGt.js.map → acp-oYRjlh71.js.map} +1 -1
  4. package/dist/acp.d.ts +2 -2
  5. package/dist/acp.js +1 -1
  6. package/dist/{agent-DecDtKA_.js → agent-CBQglXtH.js} +9 -379
  7. package/dist/agent-CBQglXtH.js.map +1 -0
  8. package/dist/agent.d.ts +1 -1
  9. package/dist/agent.js +1 -1
  10. package/dist/{builtin-artifact-kinds-B_OEgf8b.js → builtin-artifact-kinds-BmorPkgz.js} +36 -9
  11. package/dist/builtin-artifact-kinds-BmorPkgz.js.map +1 -0
  12. package/dist/chat/pure.d.ts +3 -3
  13. package/dist/chat/pure.js +4 -4
  14. package/dist/chat.d.ts +4 -4
  15. package/dist/chat.js +14 -14
  16. package/dist/{cli-shared-Dx4vmif6.js → cli-shared-E5m_pI8A.js} +2 -2
  17. package/dist/{cli-shared-Dx4vmif6.js.map → cli-shared-E5m_pI8A.js.map} +1 -1
  18. package/dist/{client-core-imHuBWV3.d.ts → client-core-BdD20sOv.d.ts} +24 -5
  19. package/dist/{client-core-imHuBWV3.d.ts.map → client-core-BdD20sOv.d.ts.map} +1 -1
  20. package/dist/{connection-loop-CdHt3iQi.d.ts → connection-loop-DTk82YVl.d.ts} +3 -3
  21. package/dist/{connection-loop-CdHt3iQi.d.ts.map → connection-loop-DTk82YVl.d.ts.map} +1 -1
  22. package/dist/contexts/daytona.d.ts +1 -1
  23. package/dist/contexts/e2b.d.ts +1 -1
  24. package/dist/{credentials-Dti61yoi.js → credentials-B9DfBJP9.js} +11 -7
  25. package/dist/credentials-B9DfBJP9.js.map +1 -0
  26. package/dist/daemon-cli.js +2 -2
  27. package/dist/{dispatcher-vy3J6JMA.js → dispatcher-BICXFGiJ.js} +27 -13
  28. package/dist/dispatcher-BICXFGiJ.js.map +1 -0
  29. package/dist/{engine-BN6PjWAW.js → engine-QCX3GV-i.js} +5 -5
  30. package/dist/{engine-BN6PjWAW.js.map → engine-QCX3GV-i.js.map} +1 -1
  31. package/dist/{eval-BaJtxLCW.js → eval-CfQlBR81.js} +2 -2
  32. package/dist/{eval-BaJtxLCW.js.map → eval-CfQlBR81.js.map} +1 -1
  33. package/dist/eval.d.ts +1 -1
  34. package/dist/eval.js +1 -1
  35. package/dist/{executor-CT4oUkg6.js → executor-B8GoXaaE.js} +2 -2
  36. package/dist/{executor-CT4oUkg6.js.map → executor-B8GoXaaE.js.map} +1 -1
  37. package/dist/{extensions-BKt7lxxv.js → extensions-BeH3D-bq.js} +114 -113
  38. package/dist/extensions-BeH3D-bq.js.map +1 -0
  39. package/dist/extensions.d.ts +1 -1
  40. package/dist/extensions.js +2 -2
  41. package/dist/{fold-rules-BYedvsH7.d.ts → fold-rules-DSypi36k.d.ts} +2 -2
  42. package/dist/{fold-rules-BYedvsH7.d.ts.map → fold-rules-DSypi36k.d.ts.map} +1 -1
  43. package/dist/google-O6pRnddf.js +881 -0
  44. package/dist/google-O6pRnddf.js.map +1 -0
  45. package/dist/{headless-Ebd1ZEzC.js → headless-R4pbpTkm.js} +3 -3
  46. package/dist/{headless-Ebd1ZEzC.js.map → headless-R4pbpTkm.js.map} +1 -1
  47. package/dist/headless.d.ts +1 -1
  48. package/dist/headless.js +1 -1
  49. package/dist/{host-scoped-settings-Cy_zbmB_.js → host-scoped-settings-CCnaBkCV.js} +2 -2
  50. package/dist/{host-scoped-settings-Cy_zbmB_.js.map → host-scoped-settings-CCnaBkCV.js.map} +1 -1
  51. package/dist/{host-signals-Cx2IAbHh.js → host-signals-DI9JQvR9.js} +5 -5
  52. package/dist/{host-signals-Cx2IAbHh.js.map → host-signals-DI9JQvR9.js.map} +1 -1
  53. package/dist/{index-pc71ADi6.d.ts → index-BkNeiJYI.d.ts} +71 -4
  54. package/dist/index-BkNeiJYI.d.ts.map +1 -0
  55. package/dist/{index-CidMTcxS.d.ts → index-DyQyDLX1.d.ts} +167 -10
  56. package/dist/index-DyQyDLX1.d.ts.map +1 -0
  57. package/dist/{index-Bt_G2Z_2.d.ts → index-lcuvhQfF.d.ts} +5 -5
  58. package/dist/{index-Bt_G2Z_2.d.ts.map → index-lcuvhQfF.d.ts.map} +1 -1
  59. package/dist/index.d.ts +3 -3
  60. package/dist/index.js +15 -15
  61. package/dist/ipc/remote.d.ts +5 -5
  62. package/dist/ipc/remote.js +3 -3
  63. package/dist/ipc.d.ts +5 -5
  64. package/dist/ipc.js +6 -6
  65. package/dist/{links-DSZ4uQ5w.js → links-CN5JFFde.js} +9 -9
  66. package/dist/{links-DSZ4uQ5w.js.map → links-CN5JFFde.js.map} +1 -1
  67. package/dist/mcp.d.ts +1 -1
  68. package/dist/{oauth-BSqXgads.js → oauth-TVPPye84.js} +155 -25
  69. package/dist/oauth-TVPPye84.js.map +1 -0
  70. package/dist/{openai-dTmPxM6T.js → openai-Rh6u5NXF.js} +121 -2
  71. package/dist/openai-Rh6u5NXF.js.map +1 -0
  72. package/dist/{openrouter-CtZbQDa0.js → openrouter-Dg0yaI-o.js} +91 -2
  73. package/dist/openrouter-Dg0yaI-o.js.map +1 -0
  74. package/dist/output/stream-json.d.ts +1 -1
  75. package/dist/output/terminal.d.ts +1 -1
  76. package/dist/plugins.d.ts +1 -1
  77. package/dist/{presets-EzlHyFSi.js → presets-DXeHsd24.js} +3 -3
  78. package/dist/{presets-EzlHyFSi.js.map → presets-DXeHsd24.js.map} +1 -1
  79. package/dist/presets.d.ts +1 -1
  80. package/dist/presets.js +1 -1
  81. package/dist/{prompts-D2lPHLOV.d.ts → prompts-DmY13jvF.d.ts} +2 -1
  82. package/dist/prompts-DmY13jvF.d.ts.map +1 -0
  83. package/dist/protocol-BIv1Yuvl.js.map +1 -1
  84. package/dist/providers/anthropic.d.ts +1 -1
  85. package/dist/providers/arcee.d.ts +1 -1
  86. package/dist/providers/baseten.d.ts +1 -1
  87. package/dist/providers/cerebras.d.ts +1 -1
  88. package/dist/providers/google.d.ts +1 -1
  89. package/dist/providers/google.js +1 -784
  90. package/dist/providers/local.d.ts +1 -1
  91. package/dist/providers/neuralwatt.d.ts +1 -1
  92. package/dist/providers/openai-compat.d.ts +1 -1
  93. package/dist/providers/openai.d.ts +1 -1
  94. package/dist/providers/openai.js +1 -1
  95. package/dist/providers/openrouter.d.ts +1 -1
  96. package/dist/providers/openrouter.js +1 -1
  97. package/dist/providers/xai.d.ts +1 -1
  98. package/dist/providers/xai.js +1 -101
  99. package/dist/providers.d.ts +2 -2
  100. package/dist/providers.js +6 -5
  101. package/dist/{registry-BBaEgTsX.js → registry-PNi9rsGi.js} +3 -3
  102. package/dist/{registry-BBaEgTsX.js.map → registry-PNi9rsGi.js.map} +1 -1
  103. package/dist/{remote-hosts-bO7wOt44.js → remote-hosts-b6Luwdhu.js} +4 -4
  104. package/dist/{remote-hosts-bO7wOt44.js.map → remote-hosts-b6Luwdhu.js.map} +1 -1
  105. package/dist/restate.d.ts +1 -1
  106. package/dist/{secret-shapes-Cda65uDH.js → secret-shapes-CEoGmfEE.js} +10 -1
  107. package/dist/secret-shapes-CEoGmfEE.js.map +1 -0
  108. package/dist/session/sqlite.d.ts +1 -1
  109. package/dist/{session-factory-BazyVdzj.js → session-factory-CMwIXE-7.js} +5 -5
  110. package/dist/{session-factory-BazyVdzj.js.map → session-factory-CMwIXE-7.js.map} +1 -1
  111. package/dist/session.d.ts +1 -1
  112. package/dist/{settings-keys-zYaer8DY.js → settings-keys-DssjmqAV.js} +3 -3
  113. package/dist/{settings-keys-zYaer8DY.js.map → settings-keys-DssjmqAV.js.map} +1 -1
  114. package/dist/{shell-path-od9XHRPt.js → shell-path-BUFwqU_A.js} +3 -3
  115. package/dist/{shell-path-od9XHRPt.js.map → shell-path-BUFwqU_A.js.map} +1 -1
  116. package/dist/{skills-use-D68a1gyZ.js → skills-use-CssTEaIj.js} +375 -2
  117. package/dist/skills-use-CssTEaIj.js.map +1 -0
  118. package/dist/skills.d.ts +1 -1
  119. package/dist/{system-freeze-DXvJpveP.js → system-freeze-Um9ZJiPo.js} +24 -9
  120. package/dist/system-freeze-Um9ZJiPo.js.map +1 -0
  121. package/dist/{todo-edits-CmqNFvLJ.js → todo-edits-H77ROt6X.js} +2 -2
  122. package/dist/{todo-edits-CmqNFvLJ.js.map → todo-edits-H77ROt6X.js.map} +1 -1
  123. package/dist/tools/fetch-url.d.ts +1 -1
  124. package/dist/tools/prompts.d.ts +1 -1
  125. package/dist/tools/prompts.js +7 -0
  126. package/dist/tools/prompts.js.map +1 -1
  127. package/dist/tools/web-search.d.ts +1 -1
  128. package/dist/{tools-9Dpm8F-f.js → tools-pZVFIJ_K.js} +273 -2
  129. package/dist/tools-pZVFIJ_K.js.map +1 -0
  130. package/dist/tools.d.ts +3 -3
  131. package/dist/tools.js +4 -4
  132. package/dist/{transcript-anchors-B3TFJqr_.js → transcript-anchors-s-yxh0jt.js} +10 -10
  133. package/dist/{transcript-anchors-B3TFJqr_.js.map → transcript-anchors-s-yxh0jt.js.map} +1 -1
  134. package/dist/{transcript-reconcile-BC2DbTmp.js → transcript-reconcile-DeFLIQ14.js} +19 -2
  135. package/dist/{transcript-reconcile-BC2DbTmp.js.map → transcript-reconcile-DeFLIQ14.js.map} +1 -1
  136. package/dist/tui.d.ts +7 -7
  137. package/dist/tui.js +24 -22
  138. package/dist/tui.js.map +1 -1
  139. package/dist/{turn-operations-CIFoOebZ.d.ts → turn-operations-BbGJ-KSt.d.ts} +2 -2
  140. package/dist/{turn-operations-CIFoOebZ.d.ts.map → turn-operations-BbGJ-KSt.d.ts.map} +1 -1
  141. package/dist/{types-iFLlZKd0.d.ts → types-C0PJmBaO.d.ts} +2 -2
  142. package/dist/{types-iFLlZKd0.d.ts.map → types-C0PJmBaO.d.ts.map} +1 -1
  143. package/dist/types-JzccL5GE.js +24 -0
  144. package/dist/types-JzccL5GE.js.map +1 -0
  145. package/dist/types.d.ts +2 -2
  146. package/dist/{url-BTH-HE9Y.js → url-CLl0u4Z8.js} +2 -2
  147. package/dist/{url-BTH-HE9Y.js.map → url-CLl0u4Z8.js.map} +1 -1
  148. package/dist/{version-4T82xRxQ.js → version-v77Y4A3C.js} +2 -2
  149. package/dist/{version-4T82xRxQ.js.map → version-v77Y4A3C.js.map} +1 -1
  150. package/dist/wire-DH77Z-rr.js +80 -0
  151. package/dist/wire-DH77Z-rr.js.map +1 -0
  152. package/dist/{workspace-exec-stream-By8na6vz.js → workspace-exec-stream-kqARO8iC.js} +4 -4
  153. package/dist/{workspace-exec-stream-By8na6vz.js.map → workspace-exec-stream-kqARO8iC.js.map} +1 -1
  154. package/dist/{write-file-B4vi3SvQ.js → write-file-QYrcDdl3.js} +3 -3
  155. package/dist/{write-file-B4vi3SvQ.js.map → write-file-QYrcDdl3.js.map} +1 -1
  156. package/dist/{ws-CS312Jpx.js → ws-BD9FN98u.js} +5 -5
  157. package/dist/{ws-CS312Jpx.js.map → ws-BD9FN98u.js.map} +1 -1
  158. package/dist/{ws-client-wWka-Jku.js → ws-client-D7eb2UbH.js} +3 -3
  159. package/dist/{ws-client-wWka-Jku.js.map → ws-client-D7eb2UbH.js.map} +1 -1
  160. package/dist/xai-CStTwCV2.js +182 -0
  161. package/dist/xai-CStTwCV2.js.map +1 -0
  162. package/docs/ARCHITECTURE.md +1 -0
  163. package/docs/ARTIFACTS.md +1 -1
  164. package/docs/EXTENSIONS.md +9 -5
  165. package/package.json +2 -2
  166. package/dist/agent-DecDtKA_.js.map +0 -1
  167. package/dist/builtin-artifact-kinds-B_OEgf8b.js.map +0 -1
  168. package/dist/credentials-Dti61yoi.js.map +0 -1
  169. package/dist/dispatcher-vy3J6JMA.js.map +0 -1
  170. package/dist/extensions-BKt7lxxv.js.map +0 -1
  171. package/dist/index-CidMTcxS.d.ts.map +0 -1
  172. package/dist/index-pc71ADi6.d.ts.map +0 -1
  173. package/dist/oauth-BSqXgads.js.map +0 -1
  174. package/dist/openai-dTmPxM6T.js.map +0 -1
  175. package/dist/openrouter-CtZbQDa0.js.map +0 -1
  176. package/dist/prompts-D2lPHLOV.d.ts.map +0 -1
  177. package/dist/providers/google.js.map +0 -1
  178. package/dist/providers/xai.js.map +0 -1
  179. package/dist/secret-shapes-Cda65uDH.js.map +0 -1
  180. package/dist/skills-use-D68a1gyZ.js.map +0 -1
  181. package/dist/system-freeze-DXvJpveP.js.map +0 -1
  182. package/dist/tools-9Dpm8F-f.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import { OS as LocalParams, kS as local } from "../index-CidMTcxS.js";
1
+ import { MS as LocalParams, NS as local } from "../index-DyQyDLX1.js";
2
2
  export { LocalParams, local };
@@ -1,2 +1,2 @@
1
- import { CS as neuralwatt, SS as NeuralwattParams, wS as planNeuralwattReasoning, xS as NEURALWATT_DEFAULT_MODEL } from "../index-CidMTcxS.js";
1
+ import { DS as neuralwatt, ES as NeuralwattParams, OS as planNeuralwattReasoning, TS as NEURALWATT_DEFAULT_MODEL } from "../index-DyQyDLX1.js";
2
2
  export { NEURALWATT_DEFAULT_MODEL, NeuralwattParams, neuralwatt, planNeuralwattReasoning };
@@ -1,2 +1,2 @@
1
- import { $x as OpenAICompatHttpError, Qx as OpenAICompatAuthHeader, Xx as OAIMessage, Yx as ASSISTANT_TOOL_CALLS_TAG, Zx as OAITool, aS as buildAssistantContent, cS as mapOAIFinishReason, dS as toOAIMessages, eS as OpenAICompatParams, fS as toolResultsMessage, hS as consumeSSE, iS as assistantMessage, lS as openAICompatPromptMessage, mS as OpenAICompatStreamError, nS as applyOAICacheBreakpoints, oS as classifyOpenAICompatError, pS as userMessage, rS as applyOAIToolCacheBreakpoint, sS as formatTools, tS as TOOL_RESULTS_TAG, uS as openaiCompat } from "../index-CidMTcxS.js";
1
+ import { $x as ASSISTANT_TOOL_CALLS_TAG, _S as userMessage, aS as TOOL_RESULTS_TAG, cS as assistantMessage, dS as formatTools, eS as OAIMessage, fS as mapOAIFinishReason, gS as toolResultsMessage, hS as toOAIMessages, iS as OpenAICompatParams, lS as buildAssistantContent, mS as openaiCompat, nS as OpenAICompatAuthHeader, oS as applyOAICacheBreakpoints, pS as openAICompatPromptMessage, rS as OpenAICompatHttpError, sS as applyOAIToolCacheBreakpoint, tS as OAITool, uS as classifyOpenAICompatError, vS as OpenAICompatStreamError, yS as consumeSSE } from "../index-DyQyDLX1.js";
2
2
  export { ASSISTANT_TOOL_CALLS_TAG, OAIMessage, OAITool, OpenAICompatAuthHeader, OpenAICompatHttpError, OpenAICompatParams, OpenAICompatStreamError, TOOL_RESULTS_TAG, applyOAICacheBreakpoints, applyOAIToolCacheBreakpoint, assistantMessage, buildAssistantContent, classifyOpenAICompatError, consumeSSE, formatTools, mapOAIFinishReason, openAICompatPromptMessage, openaiCompat, toOAIMessages, toolResultsMessage, userMessage };
@@ -1,2 +1,2 @@
1
- import { _S as classifyOpenAIError, bS as toPiMessages, gS as OpenAIParams, vS as mapCodexStopReason, yS as openai } from "../index-CidMTcxS.js";
1
+ import { CS as openai, SS as mapCodexStopReason, bS as OpenAIParams, wS as toPiMessages, xS as classifyOpenAIError } from "../index-DyQyDLX1.js";
2
2
  export { OpenAIParams, classifyOpenAIError, mapCodexStopReason, openai, toPiMessages };
@@ -1 +1 @@
1
- export { t as classifyOpenAIError, n as mapCodexStopReason, r as openai, i as toPiMessages } from "../openai-dTmPxM6T.js";
1
+ export { t as classifyOpenAIError, n as mapCodexStopReason, r as openai, i as toPiMessages } from "../openai-Rh6u5NXF.js";
@@ -1,2 +1,2 @@
1
- import { Gx as OPENROUTER_DEFAULT_MODEL, Jx as openrouter, Kx as OpenRouterParams, qx as normalizeOpenRouterModelId } from "../index-CidMTcxS.js";
1
+ import { Qx as openrouter, Xx as OpenRouterParams, Yx as OPENROUTER_DEFAULT_MODEL, Zx as normalizeOpenRouterModelId } from "../index-DyQyDLX1.js";
2
2
  export { OPENROUTER_DEFAULT_MODEL, OpenRouterParams, normalizeOpenRouterModelId, openrouter };
@@ -1 +1 @@
1
- export { t as OPENROUTER_DEFAULT_MODEL, n as normalizeOpenRouterModelId, r as openrouter } from "../openrouter-CtZbQDa0.js";
1
+ export { t as OPENROUTER_DEFAULT_MODEL, n as normalizeOpenRouterModelId, r as openrouter } from "../openrouter-Dg0yaI-o.js";
@@ -1,2 +1,2 @@
1
- import { Rx as XaiParams, zx as xai } from "../index-CidMTcxS.js";
1
+ import { Hx as XaiParams, Ux as xai } from "../index-DyQyDLX1.js";
2
2
  export { XaiParams, xai };
@@ -1,101 +1 @@
1
- import { f as openaiCompat } from "../openai-compat-5HkREis_.js";
2
- import { i as isOAuthAccessToken, l as resolveOAuthApiKey, r as extractRuntimeCredentials } from "../oauth-DRrs-65k.js";
3
- import { r as xaiBaseUrl, t as XAI_OAUTH_PROVIDER_ID } from "../xai-6tBTk6CU.js";
4
- //#region src/providers/xai.ts
5
- const DEFAULT_MODEL = "grok-4.6";
6
- /**
7
- * xAI Grok provider — supports both a static API key (`XAI_API_KEY`) and the
8
- * SuperGrok / X Premium+ OAuth subscription.
9
- *
10
- * Both auth modes hit the same OpenAI-compatible endpoint (`https://api.x.ai/v1`
11
- * unless `XAI_BASE_URL` or `PI_XAI_BASE_URL` overrides it),
12
- * so the wire handling is entirely {@link openaiCompat}. The only difference is
13
- * the bearer:
14
- *
15
- * - **API key**: `XAI_API_KEY` (or `params.apiKey`) → used verbatim.
16
- * - **OAuth**: no static key → {@link resolveOAuthApiKey} resolves + lazily
17
- * refreshes the stored `xai-oauth` token on every turn.
18
- *
19
- * `resolveOAuthApiKey` unifies the two: a real API key in `XAI_API_KEY` is
20
- * returned as-is, while an OAuth access token (or no env value at all) falls
21
- * through to the refreshable stored credentials. So this single factory serves
22
- * both paths without branching at construction time.
23
- *
24
- * @param params - API key or OAuth credentials, default model, capabilities and extra headers.
25
- *
26
- * @example
27
- * ```ts
28
- * import { createAgent } from 'zidane'
29
- * import { xai } from 'zidane/providers/xai'
30
- *
31
- * const agent = createAgent({
32
- * provider: xai({ apiKey: process.env.XAI_API_KEY }),
33
- * })
34
- * await agent.run({ prompt: 'Say hello.' })
35
- * ```
36
- */
37
- function xai(params) {
38
- const defaultModel = params?.defaultModel || DEFAULT_MODEL;
39
- const baseURL = xaiBaseUrl();
40
- const capabilities = params?.capabilities ?? {
41
- vision: true,
42
- imageInToolResult: false
43
- };
44
- const baseCredentials = extractRuntimeCredentials(params);
45
- let runtimeCredentials = baseCredentials;
46
- const staticKey = params?.apiKey ?? (params?.account ? void 0 : process.env.XAI_API_KEY);
47
- const isOAuth = baseCredentials !== void 0 || !staticKey || isOAuthAccessToken(staticKey);
48
- /**
49
- * Build the openai-compat delegate for a resolved bearer. Cheap — the factory
50
- * only wires closures — so we re-create it per turn with the freshly resolved
51
- * (possibly refreshed) OAuth token rather than baking a stale key in once.
52
- */
53
- function delegateFor(apiKey) {
54
- return openaiCompat({
55
- name: "xai",
56
- label: "xAI",
57
- apiKey,
58
- baseURL,
59
- defaultModel,
60
- capabilities,
61
- extraHeaders: params?.extraHeaders
62
- });
63
- }
64
- const skeleton = delegateFor("placeholder-resolved-at-stream");
65
- return {
66
- ...skeleton,
67
- name: "xai",
68
- meta: {
69
- ...skeleton.meta,
70
- defaultModel,
71
- isOAuth
72
- },
73
- async stream(options, callbacks) {
74
- return delegateFor(await resolveOAuthApiKey({
75
- provider: "xai",
76
- providerId: XAI_OAUTH_PROVIDER_ID,
77
- params: runtimeCredentials ? {
78
- ...params,
79
- ...runtimeCredentials
80
- } : params,
81
- envKey: "XAI_API_KEY",
82
- missingError: "No xAI credentials found. Set XAI_API_KEY or run `bun run auth --xai` first.",
83
- refreshError: (reason) => `xAI OAuth token refresh failed. Run \`bun run auth --xai\` again. ${reason}`
84
- }, {
85
- ...callbacks,
86
- async onOAuthRefresh(ctx) {
87
- if (ctx.source === "params") runtimeCredentials = {
88
- access: ctx.credentials.access,
89
- refresh: ctx.credentials.refresh,
90
- expires: ctx.credentials.expires
91
- };
92
- await callbacks.onOAuthRefresh?.(ctx);
93
- }
94
- })).stream(options, callbacks);
95
- }
96
- };
97
- }
98
- //#endregion
99
- export { xai };
100
-
101
- //# sourceMappingURL=xai.js.map
1
+ export { t as xai } from "../xai-CStTwCV2.js";
@@ -1,3 +1,3 @@
1
- import { $S as CursorParams, $x as OpenAICompatHttpError, AC as extractRuntimeCredentials, Ax as TokenCountPayload, BS as GoogleStreams, Bx as SchemaSanitizeOptions, CC as PromptCacheKeyOption, CS as neuralwatt, Cx as ProviderDecisionAvailability, DC as ResolveOAuthApiKeyOptions, DS as planMistralReasoning, Dx as ProviderMeta, EC as OAuthParams, ES as mistral, Ex as ProviderDecisions, FC as registerCustomOAuthProvider, FS as GoogleRequestAuth, Fx as ZaiParams, GD as ModelTier, HD as ModelCatalog, HS as GoogleWireKit, Hx as SchemaSanitizeResult, IC as resolveOAuthApiKey, Ix as planZaiReasoning, JS as googleVertex, Jx as openrouter, KD as getModelCatalog, KS as google, Kx as OpenRouterParams, LC as writeOAuthCredentials, LS as GoogleSharedParams, Lx as zai, MC as pinnedAccountMissingError, MS as GoogleCompatibleRoute, Mx as ToolResult, NC as readAccountOAuthCredential, Nx as ToolSpec, OC as credentialsFilePath, OS as LocalParams, Ox as StreamCallbacks, PC as readOAuthCredentials, PS as GoogleParams, Px as TurnResult, Qx as OpenAICompatAuthHeader, RS as GoogleStreamFn, Rx as XaiParams, SC as PromptCacheKeyContext, SS as NeuralwattParams, Sx as ProviderCapabilities, TC as resolvePromptCacheKey, TS as MistralParams, Tx as ProviderDecisionResponse, UD as ModelCatalogEntry, US as GoogleWireModel, Ux as sanitizeToolSchema, VS as GoogleVertexParams, Vx as SchemaSanitizeProfile, WD as ModelCatalogSource, WS as classifyGoogleError, Wx as sanitizeToolSpecs, YS as loadGoogleWireKit, aC as planBasetenReasoning, bx as InputTransformation, cC as anthropic, cS as mapOAIFinishReason, eC as cursor, eS as OpenAICompatParams, gS as OpenAIParams, iC as baseten, jC as isOAuthAccessToken, jx as ToolCall, kC as credentialsFromParams, kS as local, kx as StreamOptions, nC as cerebras, oC as ArceeParams, oS as classifyOpenAICompatError, qD as setModelCatalog, qS as googleCompatible, rC as BasetenParams, sC as arcee, tC as CerebrasParams, uS as openaiCompat, vC as applyAnthropicCacheBreakpoints, wC as derivePromptCacheKey, wS as planNeuralwattReasoning, wx as ProviderDecisionRequest, xC as AnthropicParams, xS as NEURALWATT_DEFAULT_MODEL, xx as Provider, yS as openai, yx as HistoryRepair, zS as GoogleStreamOptions, zx as xai } from "./index-CidMTcxS.js";
1
+ import { $C as ImageData, $S as loadGoogleWireKit, AC as OAuthParams, AS as mistral, Ax as ProviderDecisions, BC as resolveOAuthApiKey, Bx as planZaiReasoning, CS as openai, Cx as HistoryRepair, DC as PromptCacheKeyOption, DS as neuralwatt, Dx as ProviderDecisionAvailability, EC as PromptCacheKeyContext, ES as NeuralwattParams, Ex as ProviderCapabilities, FC as isOAuthAccessToken, Fx as ToolCall, GS as GoogleVertexParams, Gx as SchemaSanitizeProfile, HS as GoogleStreamFn, Hx as XaiParams, IC as pinnedAccountMissingError, IS as GoogleCompatibleRoute, Ix as ToolResult, JC as openrouterImageModels, JS as classifyGoogleError, Jx as sanitizeToolSpecs, KS as GoogleWireKit, Kx as SchemaSanitizeResult, LC as readAccountOAuthCredential, Lx as ToolSpec, MC as credentialsFilePath, MS as LocalParams, Mx as StreamCallbacks, NC as credentialsFromParams, NS as local, Nx as StreamOptions, OC as derivePromptCacheKey, OS as planNeuralwattReasoning, Ox as ProviderDecisionRequest, PC as extractRuntimeCredentials, Px as TokenCountPayload, QC as ImageAspectRatio, QS as googleVertex, Qx as openrouter, RC as readOAuthCredentials, RS as GoogleParams, Rx as TurnResult, SC as applyAnthropicCacheBreakpoints, TC as AnthropicParams, TS as NEURALWATT_DEFAULT_MODEL, Tx as Provider, US as GoogleStreamOptions, Ux as xai, VC as writeOAuthCredentials, VS as GoogleSharedParams, Vx as zai, WS as GoogleStreams, Wx as SchemaSanitizeOptions, XC as GOOGLE_IMAGE_MODELS, XS as google, Xx as OpenRouterParams, YC as OPENAI_IMAGE_MODELS, ZC as IMAGE_ASPECT_RATIOS, ZS as googleCompatible, aC as CerebrasParams, aO as ModelCatalog, aw as ProviderImages, bS as OpenAIParams, cC as baseten, cO as ModelTier, dC as arcee, ew as ImageModelInfo, fC as anthropic, fS as mapOAIFinishReason, iC as cursor, iS as OpenAICompatParams, iw as ProviderImageResponse, jC as ResolveOAuthApiKeyOptions, jS as planMistralReasoning, jx as ProviderMeta, kC as resolvePromptCacheKey, kS as MistralParams, kx as ProviderDecisionResponse, lC as planBasetenReasoning, lO as getModelCatalog, mS as openaiCompat, nS as OpenAICompatAuthHeader, nw as ProviderImageAvailability, oC as cerebras, oO as ModelCatalogEntry, qC as XAI_IMAGE_MODELS, qS as GoogleWireModel, qx as sanitizeToolSchema, rC as CursorParams, rS as OpenAICompatHttpError, rw as ProviderImageRequest, sC as BasetenParams, sO as ModelCatalogSource, tw as MAX_IMAGES_PER_REQUEST, uC as ArceeParams, uO as setModelCatalog, uS as classifyOpenAICompatError, wx as InputTransformation, zC as registerCustomOAuthProvider, zS as GoogleRequestAuth, zx as ZaiParams } from "./index-DyQyDLX1.js";
2
2
  import { a as getOAuthApiKey, c as refreshOpenAICodexToken, i as ensureBundledOAuthFlows, l as registerOAuthProvider, o as getOAuthProvider, r as OAuthProviderInterface, s as refreshAnthropicToken } from "./oauth-callback-page-B3Xo3X2J.js";
3
- export { type AnthropicParams, type ArceeParams, type BasetenParams, type CerebrasParams, type CursorParams, type GoogleCompatibleRoute, type GoogleParams, type GoogleRequestAuth, type GoogleSharedParams, type GoogleStreamFn, type GoogleStreamOptions, type GoogleStreams, type GoogleVertexParams, type GoogleWireKit, type GoogleWireModel, HistoryRepair, InputTransformation, type LocalParams, type MistralParams, type ModelCatalog, type ModelCatalogEntry, type ModelCatalogSource, type ModelTier, NEURALWATT_DEFAULT_MODEL, type NeuralwattParams, type OAuthParams, type OAuthProviderInterface, type OpenAICompatAuthHeader, OpenAICompatHttpError, type OpenAICompatParams, type OpenAIParams, type OpenRouterParams, type PromptCacheKeyContext, type PromptCacheKeyOption, Provider, ProviderCapabilities, ProviderDecisionAvailability, ProviderDecisionRequest, ProviderDecisionResponse, ProviderDecisions, ProviderMeta, type ResolveOAuthApiKeyOptions, type SchemaSanitizeOptions, type SchemaSanitizeProfile, type SchemaSanitizeResult, StreamCallbacks, StreamOptions, TokenCountPayload, ToolCall, ToolResult, ToolSpec, TurnResult, type XaiParams, type ZaiParams, anthropic, applyAnthropicCacheBreakpoints, arcee, baseten, cerebras, classifyGoogleError, classifyOpenAICompatError, credentialsFilePath, credentialsFromParams, cursor, derivePromptCacheKey, ensureBundledOAuthFlows, extractRuntimeCredentials, getModelCatalog, getOAuthApiKey, getOAuthProvider, google, googleCompatible, googleVertex, isOAuthAccessToken, loadGoogleWireKit, local, mapOAIFinishReason, mistral, neuralwatt, openai, openaiCompat, openrouter, pinnedAccountMissingError, planBasetenReasoning, planMistralReasoning, planNeuralwattReasoning, planZaiReasoning, readAccountOAuthCredential, readOAuthCredentials, refreshAnthropicToken, refreshOpenAICodexToken, registerCustomOAuthProvider, registerOAuthProvider, resolveOAuthApiKey, resolvePromptCacheKey, sanitizeToolSchema, sanitizeToolSpecs, setModelCatalog, writeOAuthCredentials, xai, zai };
3
+ export { type AnthropicParams, type ArceeParams, type BasetenParams, type CerebrasParams, type CursorParams, GOOGLE_IMAGE_MODELS, type GoogleCompatibleRoute, type GoogleParams, type GoogleRequestAuth, type GoogleSharedParams, type GoogleStreamFn, type GoogleStreamOptions, type GoogleStreams, type GoogleVertexParams, type GoogleWireKit, type GoogleWireModel, HistoryRepair, IMAGE_ASPECT_RATIOS, type ImageAspectRatio, type ImageData, type ImageModelInfo, InputTransformation, type LocalParams, MAX_IMAGES_PER_REQUEST, type MistralParams, type ModelCatalog, type ModelCatalogEntry, type ModelCatalogSource, type ModelTier, NEURALWATT_DEFAULT_MODEL, type NeuralwattParams, type OAuthParams, type OAuthProviderInterface, OPENAI_IMAGE_MODELS, type OpenAICompatAuthHeader, OpenAICompatHttpError, type OpenAICompatParams, type OpenAIParams, type OpenRouterParams, type PromptCacheKeyContext, type PromptCacheKeyOption, Provider, ProviderCapabilities, ProviderDecisionAvailability, ProviderDecisionRequest, ProviderDecisionResponse, ProviderDecisions, type ProviderImageAvailability, type ProviderImageRequest, type ProviderImageResponse, type ProviderImages, ProviderMeta, type ResolveOAuthApiKeyOptions, type SchemaSanitizeOptions, type SchemaSanitizeProfile, type SchemaSanitizeResult, StreamCallbacks, StreamOptions, TokenCountPayload, ToolCall, ToolResult, ToolSpec, TurnResult, XAI_IMAGE_MODELS, type XaiParams, type ZaiParams, anthropic, applyAnthropicCacheBreakpoints, arcee, baseten, cerebras, classifyGoogleError, classifyOpenAICompatError, credentialsFilePath, credentialsFromParams, cursor, derivePromptCacheKey, ensureBundledOAuthFlows, extractRuntimeCredentials, getModelCatalog, getOAuthApiKey, getOAuthProvider, google, googleCompatible, googleVertex, isOAuthAccessToken, loadGoogleWireKit, local, mapOAIFinishReason, mistral, neuralwatt, openai, openaiCompat, openrouter, openrouterImageModels, pinnedAccountMissingError, planBasetenReasoning, planMistralReasoning, planNeuralwattReasoning, planZaiReasoning, readAccountOAuthCredential, readOAuthCredentials, refreshAnthropicToken, refreshOpenAICodexToken, registerCustomOAuthProvider, registerOAuthProvider, resolveOAuthApiKey, resolvePromptCacheKey, sanitizeToolSchema, sanitizeToolSpecs, setModelCatalog, writeOAuthCredentials, xai, zai };
package/dist/providers.js CHANGED
@@ -6,10 +6,11 @@ import { arcee } from "./providers/arcee.js";
6
6
  import { baseten, planBasetenReasoning } from "./providers/baseten.js";
7
7
  import { cerebras } from "./providers/cerebras.js";
8
8
  import { a as cursor, i as planMistralReasoning, n as zai, r as mistral, t as planZaiReasoning } from "./providers-CYuhNshA.js";
9
- import { classifyGoogleError, google, googleCompatible, googleVertex, loadGoogleWireKit } from "./providers/google.js";
9
+ import { n as MAX_IMAGES_PER_REQUEST, t as IMAGE_ASPECT_RATIOS } from "./types-JzccL5GE.js";
10
+ import { a as google, c as loadGoogleWireKit, f as GOOGLE_IMAGE_MODELS, o as googleCompatible, r as classifyGoogleError, s as googleVertex } from "./google-O6pRnddf.js";
11
+ import { o as OPENAI_IMAGE_MODELS, r as openai } from "./openai-Rh6u5NXF.js";
12
+ import { a as openrouterImageModels, r as openrouter } from "./openrouter-Dg0yaI-o.js";
13
+ import { n as XAI_IMAGE_MODELS, t as xai } from "./xai-CStTwCV2.js";
10
14
  import { local } from "./providers/local.js";
11
15
  import { NEURALWATT_DEFAULT_MODEL, neuralwatt, planNeuralwattReasoning } from "./providers/neuralwatt.js";
12
- import { r as openai } from "./openai-dTmPxM6T.js";
13
- import { r as openrouter } from "./openrouter-CtZbQDa0.js";
14
- import { xai } from "./providers/xai.js";
15
- export { NEURALWATT_DEFAULT_MODEL, OpenAICompatHttpError, anthropic, applyAnthropicCacheBreakpoints, arcee, baseten, cerebras, classifyGoogleError, classifyOpenAICompatError, credentialsFilePath, credentialsFromParams, cursor, derivePromptCacheKey, ensureBundledOAuthFlows, extractRuntimeCredentials, getModelCatalog, getOAuthApiKey, getOAuthProvider, google, googleCompatible, googleVertex, isOAuthAccessToken, loadGoogleWireKit, local, mapOAIFinishReason, mistral, neuralwatt, openai, openaiCompat, openrouter, pinnedAccountMissingError, planBasetenReasoning, planMistralReasoning, planNeuralwattReasoning, planZaiReasoning, readAccountOAuthCredential, readOAuthCredentials, refreshAnthropicToken, refreshOpenAICodexToken, registerCustomOAuthProvider, registerOAuthProvider, resolveOAuthApiKey, resolvePromptCacheKey, sanitizeToolSchema, sanitizeToolSpecs, setModelCatalog, writeOAuthCredentials, xai, zai };
16
+ export { GOOGLE_IMAGE_MODELS, IMAGE_ASPECT_RATIOS, MAX_IMAGES_PER_REQUEST, NEURALWATT_DEFAULT_MODEL, OPENAI_IMAGE_MODELS, OpenAICompatHttpError, XAI_IMAGE_MODELS, anthropic, applyAnthropicCacheBreakpoints, arcee, baseten, cerebras, classifyGoogleError, classifyOpenAICompatError, credentialsFilePath, credentialsFromParams, cursor, derivePromptCacheKey, ensureBundledOAuthFlows, extractRuntimeCredentials, getModelCatalog, getOAuthApiKey, getOAuthProvider, google, googleCompatible, googleVertex, isOAuthAccessToken, loadGoogleWireKit, local, mapOAIFinishReason, mistral, neuralwatt, openai, openaiCompat, openrouter, openrouterImageModels, pinnedAccountMissingError, planBasetenReasoning, planMistralReasoning, planNeuralwattReasoning, planZaiReasoning, readAccountOAuthCredential, readOAuthCredentials, refreshAnthropicToken, refreshOpenAICodexToken, registerCustomOAuthProvider, registerOAuthProvider, resolveOAuthApiKey, resolvePromptCacheKey, sanitizeToolSchema, sanitizeToolSpecs, setModelCatalog, writeOAuthCredentials, xai, zai };
@@ -1,7 +1,7 @@
1
1
  import { i as writeJsonFileAtomic, t as OWNER_ONLY } from "./atomic-write-Ijgf2Mhc.js";
2
- import { _ as writeCredentialEntry, a as readCredentialEntry } from "./credentials-Dti61yoi.js";
2
+ import { _ as writeCredentialEntry, a as readCredentialEntry } from "./credentials-B9DfBJP9.js";
3
3
  import { t as HostRegistryError } from "./types-CiUp8oom.js";
4
- import { i as urlCarriesSecrets, n as displayHostUrl, r as parseRemoteHostUrl, t as RemoteHostError } from "./url-BTH-HE9Y.js";
4
+ import { i as urlCarriesSecrets, n as displayHostUrl, r as parseRemoteHostUrl, t as RemoteHostError } from "./url-CLl0u4Z8.js";
5
5
  import { existsSync, readFileSync } from "node:fs";
6
6
  import { resolve } from "node:path";
7
7
  //#region src/chat/hosts/registry.ts
@@ -218,4 +218,4 @@ function createHostRegistry(options) {
218
218
  //#endregion
219
219
  export { probeUnsavedHost as i, hostCredentialKey as n, hostsFilePath as r, createHostRegistry as t };
220
220
 
221
- //# sourceMappingURL=registry-BBaEgTsX.js.map
221
+ //# sourceMappingURL=registry-PNi9rsGi.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"registry-BBaEgTsX.js","names":[],"sources":["../src/chat/hosts/registry.ts"],"sourcesContent":["/**\n * The client's saved hosts: `<dataDir>/hosts.json` (0600, atomic writes) for\n * the entries, the credentials store (`credentials.json`, entry\n * `hosts:<id>`) for their tokens, so tokens sit with every other secret and\n * never in the listable file.\n *\n * Every call reads the files fresh: TUI and GUI windows on one machine share\n * them. Connecting is injected (`probe`): `src/chat` cannot reach the\n * WebSocket client, `createWsHostRegistry` (`zidane/ipc`) wires it.\n */\nimport type { HostEntry, HostProbe, HostProbeResult, HostTestResult } from './types'\nimport { existsSync, readFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport { OWNER_ONLY, writeJsonFileAtomic } from '../../atomic-write'\nimport { readCredentialEntry, writeCredentialEntry } from '../credentials'\nimport { HostRegistryError } from './types'\nimport { displayHostUrl, parseRemoteHostUrl, RemoteHostError, urlCarriesSecrets } from './url'\n\nconst FILE_VERSION = 1\n\ninterface HostsFile {\n version: typeof FILE_VERSION\n hosts: HostEntry[]\n}\n\n/**\n * Returns the path of the file that stores the saved hosts.\n *\n * @param dataDir - Application data directory.\n */\nexport function hostsFilePath(dataDir: string): string {\n return resolve(dataDir, 'hosts.json')\n}\n\n/**\n * Where a host's token lives in the credentials store.\n *\n * @param id - Host id.\n */\nexport function hostCredentialKey(id: string): string {\n return `hosts:${id}`\n}\n\n/** Saved remote hosts and their tokens, persisted under the data directory. */\nexport interface HostRegistry {\n /** Returns every saved host. */\n list: () => HostEntry[]\n /** Returns the saved host with this id, or `undefined`. */\n get: (id: string) => HostEntry | undefined\n /**\n * Verify the host (it must answer as a zidane-server with this token),\n * then save it and its token. Adding a host already saved (same server\n * id) updates its URL and token in place, keeping its name unless one is\n * given. Throws {@link HostRegistryError}.\n */\n add: (input: { url: string, token: string, name?: string }) => Promise<HostEntry>\n /** Forget the entry and its token; `false` when it wasn't saved. */\n remove: (id: string) => boolean\n /** Renames a saved host. Throws {@link HostRegistryError} for an empty name, or when no saved host has this id. */\n rename: (id: string, name: string) => HostEntry\n /** Connect with the saved token and say who answered; refreshes `lastConnectedAt` on success. */\n test: (id: string) => Promise<HostTestResult>\n /** The saved token, for transports. Never display it. */\n token: (id: string) => string | undefined\n}\n\nfunction isEntry(value: unknown): value is HostEntry {\n const e = value as Partial<HostEntry> | null\n return !!e && typeof e === 'object' && typeof e.id === 'string' && typeof e.name === 'string' && typeof e.url === 'string' && typeof e.addedAt === 'number'\n}\n\n/** An entry saved before URLs were checked for credentials: read without them (it fails auth, the user re-adds it). */\nfunction withoutUrlSecrets(entry: HostEntry): HostEntry {\n const raw = entry.url\n return urlCarriesSecrets(raw) ? { ...entry, url: displayHostUrl(raw) } : entry\n}\n\nfunction readHosts(dataDir: string): HostEntry[] {\n const path = hostsFilePath(dataDir)\n if (!existsSync(path))\n return []\n try {\n const parsed = JSON.parse(readFileSync(path, 'utf8')) as Partial<HostsFile>\n return Array.isArray(parsed.hosts) ? parsed.hosts.filter(isEntry).map(withoutUrlSecrets) : []\n }\n catch {\n return []\n }\n}\n\nfunction writeHosts(dataDir: string, hosts: HostEntry[]): void {\n const file: HostsFile = { version: FILE_VERSION, hosts }\n writeJsonFileAtomic(hostsFilePath(dataDir), file, OWNER_ONLY)\n}\n\nfunction cleanName(name: string): string {\n const trimmed = name.trim()\n if (!trimmed)\n throw new HostRegistryError('invalid-name', 'A host needs a name.')\n return trimmed\n}\n\nfunction checkedUrl(raw: string): string {\n try {\n return parseRemoteHostUrl(raw)\n }\n catch (err) {\n throw new HostRegistryError('invalid-url', err instanceof RemoteHostError ? err.message : String(err))\n }\n}\n\n/** The URL and token an `add` (or an unsaved test) takes, checked; throws {@link HostRegistryError}. */\nexport function checkHostInput(input: { url: string, token: string }): { url: string, token: string } {\n const url = checkedUrl(input.url)\n const token = input.token.trim()\n if (!token)\n throw new HostRegistryError('invalid-token', 'A host needs a token (zidane server token create --name <device>).')\n return { url, token }\n}\n\n/** A probe's answer, refused unless a zidane-server answered. */\nfunction asServer(url: string, probed: HostProbeResult): HostProbeResult {\n if (probed.ok && probed.hostRef.kind !== 'server')\n return { ok: false, error: 'protocol', message: `${url} is a ${probed.hostRef.kind} host, not a zidane-server.` }\n return probed\n}\n\n/** The add form's \"test\": `add`'s checks and probe, saving nothing. A refused input or a failed probe comes back as an error result, not a throw. */\nexport async function probeUnsavedHost(probe: HostProbe, input: { url: string, token: string }): Promise<HostProbeResult> {\n let checked: { url: string, token: string }\n try {\n checked = checkHostInput(input)\n }\n catch (err) {\n if (err instanceof HostRegistryError)\n return { ok: false, error: err.code, message: err.message }\n throw err\n }\n return asServer(checked.url, await probe(checked))\n}\n\n/**\n * Creates a host registry backed by `hosts.json` and the credentials store in `options.dataDir`.\n *\n * @param options - Where to store hosts (`dataDir`), how to reach a host (`probe`), and an optional clock (`now`, default `Date.now`).\n * @example\n * ```ts\n * import { createHostRegistry } from 'zidane/chat'\n *\n * const hosts = createHostRegistry({\n * dataDir: '/home/me/.zidane',\n * probe: async () => ({ ok: false, error: 'unreachable', message: 'No transport wired.' }),\n * })\n * console.log(hosts.list())\n * ```\n */\nexport function createHostRegistry(options: { dataDir: string, probe: HostProbe, now?: () => number }): HostRegistry {\n const { dataDir, probe } = options\n const now = options.now ?? Date.now\n const list = (): HostEntry[] => readHosts(dataDir)\n const get = (id: string): HostEntry | undefined => list().find(h => h.id === id)\n const token = (id: string): string | undefined => {\n const cred = readCredentialEntry(dataDir, hostCredentialKey(id))\n return cred?.kind === 'apikey' && cred.value ? cred.value : undefined\n }\n const update = (id: string, patch: (entry: HostEntry) => HostEntry): HostEntry | undefined => {\n const hosts = list()\n const i = hosts.findIndex(h => h.id === id)\n if (i < 0)\n return undefined\n hosts[i] = patch(hosts[i]!)\n writeHosts(dataDir, hosts)\n return hosts[i]\n }\n\n return {\n list,\n get,\n token,\n async add(input) {\n const { url, token: secret } = checkHostInput(input)\n const name = input.name === undefined ? undefined : cleanName(input.name)\n const probed = asServer(url, await probe({ url, token: secret }))\n if (!probed.ok)\n throw new HostRegistryError(probed.error, probed.message)\n const at = now()\n const fresh: Pick<HostEntry, 'url' | 'lastConnectedAt' | 'hostKind' | 'serverName' | 'serverVersion'> = {\n url,\n lastConnectedAt: at,\n hostKind: 'server',\n serverName: probed.hostRef.name,\n ...(probed.serverVersion !== undefined ? { serverVersion: probed.serverVersion } : {}),\n }\n const id = probed.hostRef.id\n // Token first: an entry is never saved without its token.\n writeCredentialEntry(dataDir, hostCredentialKey(id), { kind: 'apikey', value: secret })\n const hosts = list()\n const existing = hosts.find(h => h.id === id)\n const entry: HostEntry = existing\n ? { ...existing, ...fresh, ...(name !== undefined ? { name } : {}) }\n : { id, name: name ?? probed.hostRef.name, addedAt: at, ...fresh }\n writeHosts(dataDir, existing ? hosts.map(h => (h.id === id ? entry : h)) : [...hosts, entry])\n return entry\n },\n remove(id) {\n const hosts = list()\n const kept = hosts.filter(h => h.id !== id)\n const had = kept.length !== hosts.length\n if (had)\n writeHosts(dataDir, kept)\n const hadToken = token(id) !== undefined\n writeCredentialEntry(dataDir, hostCredentialKey(id), undefined)\n return had || hadToken\n },\n rename(id, name) {\n const clean = cleanName(name)\n const entry = update(id, e => ({ ...e, name: clean }))\n if (!entry)\n throw new HostRegistryError('unknown-host', `No host \"${id}\".`)\n return entry\n },\n async test(id) {\n const entry = get(id)\n const secret = entry ? token(id) : undefined\n if (!entry || secret === undefined)\n return { ok: false, error: 'unknown-host', message: entry ? `No token saved for \"${entry.name}\": add it again.` : `No host \"${id}\".` }\n const probed = await probe({ url: entry.url, token: secret })\n if (!probed.ok)\n return probed\n if (probed.hostRef.id !== entry.id)\n return { ok: false, error: 'identity', message: `A different host (\"${probed.hostRef.name}\") answers at ${entry.url}. Remove \"${entry.name}\" and add it again if it was reinstalled.` }\n update(id, e => ({\n ...e,\n lastConnectedAt: now(),\n serverName: probed.hostRef.name,\n ...(probed.serverVersion !== undefined ? { serverVersion: probed.serverVersion } : {}),\n }))\n return probed\n },\n }\n}\n"],"mappings":";;;;;;;AAkBA,MAAM,eAAe;;;;;;AAYrB,SAAgB,cAAc,S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AC9D,OAAO,OAAO;EAChB;EACA,OAAO,IAAI,MAAM;GACf,MAAM,QAAQ,UAAU,IAAI;GAC5B,MAAM,QAAQ,OAAO,KAAI,OAAM;IAAE,GAAG;IAAG,MAAM;GAAM,EAAE;GACrD,IAAI,CAAC,OACH,MAAM,IAAI,kBAAkB,gBAAgB,YAAY,GAAG,GAAG;GAChE,OAAO;EACT;EACA,MAAM,KAAK,IAAI;GACb,MAAM,QAAQ,IAAI,EAAE;GACpB,MAAM,SAAS,QAAQ,MAAM,EAAE,IAAI,KAAA;GACnC,IAAI,CAAC,SAAS,WAAW,KAAA,GACvB,OAAO;IAAE,IAAI;IAAO,OAAO;IAAgB,SAAS,QAAQ,uBAAuB,MAAM,KAAK,oBAAoB,YAAY,GAAG;GAAI;GACvI,MAAM,SAAS,MAAM,MAAM;IAAE,KAAK,MAAM;IAAK,OAAO;GAAO,CAAC;GAC5D,IAAI,CAAC,OAAO,IACV,OAAO;GACT,IAAI,OAAO,QAAQ,OAAO,MAAM,IAC9B,OAAO;IAAE,IAAI;IAAO,OAAO;IAAY,SAAS,sBAAsB,OAAO,QAAQ,KAAK,gBAAgB,MAAM,IAAI,YAAY,MAAM,KAAK;GAA2C;GACxL,OAAO,KAAI,OAAM;IACf,GAAG;IACH,iBAAiB,IAAI;IACrB,YAAY,OAAO,QAAQ;IAC3B,GAAI,OAAO,kBAAkB,KAAA,IAAY,EAAE,eAAe,OAAO,cAAc,IAAI,CAAC;GACtF,EAAE;GACF,OAAO;EACT;CACF;AACF"}
1
+ {"version":3,"file":"registry-PNi9rsGi.js","names":[],"sources":["../src/chat/hosts/registry.ts"],"sourcesContent":["/**\n * The client's saved hosts: `<dataDir>/hosts.json` (0600, atomic writes) for\n * the entries, the credentials store (`credentials.json`, entry\n * `hosts:<id>`) for their tokens, so tokens sit with every other secret and\n * never in the listable file.\n *\n * Every call reads the files fresh: TUI and GUI windows on one machine share\n * them. Connecting is injected (`probe`): `src/chat` cannot reach the\n * WebSocket client, `createWsHostRegistry` (`zidane/ipc`) wires it.\n */\nimport type { HostEntry, HostProbe, HostProbeResult, HostTestResult } from './types'\nimport { existsSync, readFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport { OWNER_ONLY, writeJsonFileAtomic } from '../../atomic-write'\nimport { readCredentialEntry, writeCredentialEntry } from '../credentials'\nimport { HostRegistryError } from './types'\nimport { displayHostUrl, parseRemoteHostUrl, RemoteHostError, urlCarriesSecrets } from './url'\n\nconst FILE_VERSION = 1\n\ninterface HostsFile {\n version: typeof FILE_VERSION\n hosts: HostEntry[]\n}\n\n/**\n * Returns the path of the file that stores the saved hosts.\n *\n * @param dataDir - Application data directory.\n */\nexport function hostsFilePath(dataDir: string): string {\n return resolve(dataDir, 'hosts.json')\n}\n\n/**\n * Where a host's token lives in the credentials store.\n *\n * @param id - Host id.\n */\nexport function hostCredentialKey(id: string): string {\n return `hosts:${id}`\n}\n\n/** Saved remote hosts and their tokens, persisted under the data directory. */\nexport interface HostRegistry {\n /** Returns every saved host. */\n list: () => HostEntry[]\n /** Returns the saved host with this id, or `undefined`. */\n get: (id: string) => HostEntry | undefined\n /**\n * Verify the host (it must answer as a zidane-server with this token),\n * then save it and its token. Adding a host already saved (same server\n * id) updates its URL and token in place, keeping its name unless one is\n * given. Throws {@link HostRegistryError}.\n */\n add: (input: { url: string, token: string, name?: string }) => Promise<HostEntry>\n /** Forget the entry and its token; `false` when it wasn't saved. */\n remove: (id: string) => boolean\n /** Renames a saved host. Throws {@link HostRegistryError} for an empty name, or when no saved host has this id. */\n rename: (id: string, name: string) => HostEntry\n /** Connect with the saved token and say who answered; refreshes `lastConnectedAt` on success. */\n test: (id: string) => Promise<HostTestResult>\n /** The saved token, for transports. Never display it. */\n token: (id: string) => string | undefined\n}\n\nfunction isEntry(value: unknown): value is HostEntry {\n const e = value as Partial<HostEntry> | null\n return !!e && typeof e === 'object' && typeof e.id === 'string' && typeof e.name === 'string' && typeof e.url === 'string' && typeof e.addedAt === 'number'\n}\n\n/** An entry saved before URLs were checked for credentials: read without them (it fails auth, the user re-adds it). */\nfunction withoutUrlSecrets(entry: HostEntry): HostEntry {\n const raw = entry.url\n return urlCarriesSecrets(raw) ? { ...entry, url: displayHostUrl(raw) } : entry\n}\n\nfunction readHosts(dataDir: string): HostEntry[] {\n const path = hostsFilePath(dataDir)\n if (!existsSync(path))\n return []\n try {\n const parsed = JSON.parse(readFileSync(path, 'utf8')) as Partial<HostsFile>\n return Array.isArray(parsed.hosts) ? parsed.hosts.filter(isEntry).map(withoutUrlSecrets) : []\n }\n catch {\n return []\n }\n}\n\nfunction writeHosts(dataDir: string, hosts: HostEntry[]): void {\n const file: HostsFile = { version: FILE_VERSION, hosts }\n writeJsonFileAtomic(hostsFilePath(dataDir), file, OWNER_ONLY)\n}\n\nfunction cleanName(name: string): string {\n const trimmed = name.trim()\n if (!trimmed)\n throw new HostRegistryError('invalid-name', 'A host needs a name.')\n return trimmed\n}\n\nfunction checkedUrl(raw: string): string {\n try {\n return parseRemoteHostUrl(raw)\n }\n catch (err) {\n throw new HostRegistryError('invalid-url', err instanceof RemoteHostError ? err.message : String(err))\n }\n}\n\n/** The URL and token an `add` (or an unsaved test) takes, checked; throws {@link HostRegistryError}. */\nexport function checkHostInput(input: { url: string, token: string }): { url: string, token: string } {\n const url = checkedUrl(input.url)\n const token = input.token.trim()\n if (!token)\n throw new HostRegistryError('invalid-token', 'A host needs a token (zidane server token create --name <device>).')\n return { url, token }\n}\n\n/** A probe's answer, refused unless a zidane-server answered. */\nfunction asServer(url: string, probed: HostProbeResult): HostProbeResult {\n if (probed.ok && probed.hostRef.kind !== 'server')\n return { ok: false, error: 'protocol', message: `${url} is a ${probed.hostRef.kind} host, not a zidane-server.` }\n return probed\n}\n\n/** The add form's \"test\": `add`'s checks and probe, saving nothing. A refused input or a failed probe comes back as an error result, not a throw. */\nexport async function probeUnsavedHost(probe: HostProbe, input: { url: string, token: string }): Promise<HostProbeResult> {\n let checked: { url: string, token: string }\n try {\n checked = checkHostInput(input)\n }\n catch (err) {\n if (err instanceof HostRegistryError)\n return { ok: false, error: err.code, message: err.message }\n throw err\n }\n return asServer(checked.url, await probe(checked))\n}\n\n/**\n * Creates a host registry backed by `hosts.json` and the credentials store in `options.dataDir`.\n *\n * @param options - Where to store hosts (`dataDir`), how to reach a host (`probe`), and an optional clock (`now`, default `Date.now`).\n * @example\n * ```ts\n * import { createHostRegistry } from 'zidane/chat'\n *\n * const hosts = createHostRegistry({\n * dataDir: '/home/me/.zidane',\n * probe: async () => ({ ok: false, error: 'unreachable', message: 'No transport wired.' }),\n * })\n * console.log(hosts.list())\n * ```\n */\nexport function createHostRegistry(options: { dataDir: string, probe: HostProbe, now?: () => number }): HostRegistry {\n const { dataDir, probe } = options\n const now = options.now ?? Date.now\n const list = (): HostEntry[] => readHosts(dataDir)\n const get = (id: string): HostEntry | undefined => list().find(h => h.id === id)\n const token = (id: string): string | undefined => {\n const cred = readCredentialEntry(dataDir, hostCredentialKey(id))\n return cred?.kind === 'apikey' && cred.value ? cred.value : undefined\n }\n const update = (id: string, patch: (entry: HostEntry) => HostEntry): HostEntry | undefined => {\n const hosts = list()\n const i = hosts.findIndex(h => h.id === id)\n if (i < 0)\n return undefined\n hosts[i] = patch(hosts[i]!)\n writeHosts(dataDir, hosts)\n return hosts[i]\n }\n\n return {\n list,\n get,\n token,\n async add(input) {\n const { url, token: secret } = checkHostInput(input)\n const name = input.name === undefined ? undefined : cleanName(input.name)\n const probed = asServer(url, await probe({ url, token: secret }))\n if (!probed.ok)\n throw new HostRegistryError(probed.error, probed.message)\n const at = now()\n const fresh: Pick<HostEntry, 'url' | 'lastConnectedAt' | 'hostKind' | 'serverName' | 'serverVersion'> = {\n url,\n lastConnectedAt: at,\n hostKind: 'server',\n serverName: probed.hostRef.name,\n ...(probed.serverVersion !== undefined ? { serverVersion: probed.serverVersion } : {}),\n }\n const id = probed.hostRef.id\n // Token first: an entry is never saved without its token.\n writeCredentialEntry(dataDir, hostCredentialKey(id), { kind: 'apikey', value: secret })\n const hosts = list()\n const existing = hosts.find(h => h.id === id)\n const entry: HostEntry = existing\n ? { ...existing, ...fresh, ...(name !== undefined ? { name } : {}) }\n : { id, name: name ?? probed.hostRef.name, addedAt: at, ...fresh }\n writeHosts(dataDir, existing ? hosts.map(h => (h.id === id ? entry : h)) : [...hosts, entry])\n return entry\n },\n remove(id) {\n const hosts = list()\n const kept = hosts.filter(h => h.id !== id)\n const had = kept.length !== hosts.length\n if (had)\n writeHosts(dataDir, kept)\n const hadToken = token(id) !== undefined\n writeCredentialEntry(dataDir, hostCredentialKey(id), undefined)\n return had || hadToken\n },\n rename(id, name) {\n const clean = cleanName(name)\n const entry = update(id, e => ({ ...e, name: clean }))\n if (!entry)\n throw new HostRegistryError('unknown-host', `No host \"${id}\".`)\n return entry\n },\n async test(id) {\n const entry = get(id)\n const secret = entry ? token(id) : undefined\n if (!entry || secret === undefined)\n return { ok: false, error: 'unknown-host', message: entry ? `No token saved for \"${entry.name}\": add it again.` : `No host \"${id}\".` }\n const probed = await probe({ url: entry.url, token: secret })\n if (!probed.ok)\n return probed\n if (probed.hostRef.id !== entry.id)\n return { ok: false, error: 'identity', message: `A different host (\"${probed.hostRef.name}\") answers at ${entry.url}. Remove \"${entry.name}\" and add it again if it was reinstalled.` }\n update(id, e => ({\n ...e,\n lastConnectedAt: now(),\n serverName: probed.hostRef.name,\n ...(probed.serverVersion !== undefined ? { serverVersion: probed.serverVersion } : {}),\n }))\n return probed\n },\n }\n}\n"],"mappings":";;;;;;;AAkBA,MAAM,eAAe;;;;;;AAYrB,SAAgB,cAAc,SAAyB;CACrD,OAAO,QAAQ,SAAS,YAAY;AACtC;;;;;;AAOA,SAAgB,kBAAkB,IAAoB;CACpD,OAAO,SAAS;AAClB;AAyBA,SAAS,QAAQ,OAAoC;CACnD,MAAM,IAAI;CACV,OAAO,CAAC,CAAC,KAAK,OAAO,MAAM,YAAY,OAAO,EAAE,OAAO,YAAY,OAAO,EAAE,SAAS,YAAY,OAAO,E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AAK,IAAI;GACb,MAAM,QAAQ,IAAI,EAAE;GACpB,MAAM,SAAS,QAAQ,MAAM,EAAE,IAAI,KAAA;GACnC,IAAI,CAAC,SAAS,WAAW,KAAA,GACvB,OAAO;IAAE,IAAI;IAAO,OAAO;IAAgB,SAAS,QAAQ,uBAAuB,MAAM,KAAK,oBAAoB,YAAY,GAAG;GAAI;GACvI,MAAM,SAAS,MAAM,MAAM;IAAE,KAAK,MAAM;IAAK,OAAO;GAAO,CAAC;GAC5D,IAAI,CAAC,OAAO,IACV,OAAO;GACT,IAAI,OAAO,QAAQ,OAAO,MAAM,IAC9B,OAAO;IAAE,IAAI;IAAO,OAAO;IAAY,SAAS,sBAAsB,OAAO,QAAQ,KAAK,gBAAgB,MAAM,IAAI,YAAY,MAAM,KAAK;GAA2C;GACxL,OAAO,KAAI,OAAM;IACf,GAAG;IACH,iBAAiB,IAAI;IACrB,YAAY,OAAO,QAAQ;IAC3B,GAAI,OAAO,kBAAkB,KAAA,IAAY,EAAE,eAAe,OAAO,cAAc,IAAI,CAAC;GACtF,EAAE;GACF,OAAO;EACT;CACF;AACF"}
@@ -1,6 +1,6 @@
1
- import { t as createSyncEngine } from "./engine-BN6PjWAW.js";
2
- import { r as startWsSavedHosts } from "./ws-CS312Jpx.js";
3
- import { i as wsTransport, t as hostSignalHandlers } from "./host-signals-Cx2IAbHh.js";
1
+ import { t as createSyncEngine } from "./engine-QCX3GV-i.js";
2
+ import { r as startWsSavedHosts } from "./ws-BD9FN98u.js";
3
+ import { i as wsTransport, t as hostSignalHandlers } from "./host-signals-DI9JQvR9.js";
4
4
  //#region src/tui/host/remote-hosts.ts
5
5
  /** The TUI's directory, as the shared saved-hosts sync sees it. */
6
6
  function savedHostsDirectory(directory) {
@@ -95,4 +95,4 @@ function startRemoteHosts(options, registry) {
95
95
  //#endregion
96
96
  export { startRemoteHosts };
97
97
 
98
- //# sourceMappingURL=remote-hosts-bO7wOt44.js.map
98
+ //# sourceMappingURL=remote-hosts-b6Luwdhu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"remote-hosts-bO7wOt44.js","names":[],"sources":["../src/tui/host/remote-hosts.ts"],"sourcesContent":["/**\n * Saved servers in the window's host directory: loaded only when the\n * `remoteHosts` setting is on (`use-remote-hosts` imports this module\n * dynamically), so a window with it off never reads `hosts.json`, never\n * loads the WebSocket client and never dials anything.\n *\n * The registry ↔ directory sync and the connection loops are the shared\n * ones (`startWsSavedHosts`, `src/ipc/hosts`, the GUI's too); this module is\n * the TUI's glue: a directory entry per server carries a WebSocket\n * transport (the session controllers and session data dial through it),\n * and the server's presence and session changes feed the window.\n */\nimport type { HostEntry, HostRegistry } from '../../chat/hosts'\nimport type { SyncEngine, SyncEngineOptions } from '../../chat/sync/engine'\nimport type { SavedHostsController, SavedHostsDirectory } from '../../ipc/hosts'\nimport type { SessionPresence } from '../../ipc/index'\nimport type { HostDirectory } from './host-directory'\nimport { createSyncEngine } from '../../chat/sync/engine'\nimport { startWsSavedHosts } from '../../ipc/hosts'\nimport { wsTransport } from '../runtime/transport'\nimport { hostSignalHandlers } from './host-signals'\n\nexport interface RemoteHostsOptions {\n dataDir: string\n directory: HostDirectory\n onPresence?: (key: string, rows: readonly SessionPresence[]) => void\n /** A server (re)connected: its sessions can be listed. */\n onConnected?: (key: string) => void\n /** A server's sessions changed (another window created, renamed or deleted one). */\n onSessionsChanged?: (key: string) => void\n /** Settings sync to the saved servers (`src/chat/sync`): this computer's files. Absent: no sync. */\n sync?: Omit<SyncEngineOptions, 'dataDir'>\n}\n\nexport type RemoteHostsController = SavedHostsController & {\n /** Settings sync to each saved server (Settings → Hosts → a server → Sync). */\n sync?: SyncEngine | null\n}\n\n/** The TUI's directory, as the shared saved-hosts sync sees it. */\nfunction savedHostsDirectory(directory: HostDirectory): SavedHostsDirectory {\n return {\n saved: () => directory.servers().filter(host => !host.adHoc).map(host => ({ key: host.key, url: host.url ?? '' })),\n upsert: (entry: HostEntry, token) => {\n // Every dial through it (the connection loop, session data, controllers) checks it is still this server.\n const transport = wsTransport({ url: entry.url, expectHostId: entry.id, ...(token ? { token } : {}) })\n const known = directory.get(entry.id)\n if (known) {\n // In place: the entry (and the sessions routed to it) stays.\n directory.update(entry.id, { name: entry.name, url: entry.url, transport, client: null, status: 'connecting', error: undefined })\n return\n }\n directory.put({\n key: entry.id,\n kind: 'server',\n name: entry.name,\n url: entry.url,\n transport,\n client: null,\n status: 'connecting',\n ...(entry.serverName ? { serverName: entry.serverName } : {}),\n ...(entry.serverVersion ? { serverVersion: entry.serverVersion } : {}),\n })\n },\n update: (key, patch) => directory.update(key, patch),\n remove: key => directory.remove(key),\n }\n}\n\nexport function startRemoteHosts(options: RemoteHostsOptions, registry?: HostRegistry): RemoteHostsController {\n const { directory } = options\n /** `--host` already names this server: its saved entry would be a second connection to it. */\n const adHocUrl = directory.servers().find(host => host.adHoc)?.url\n const sync = options.sync ? createSyncEngine({ dataDir: options.dataDir, ...options.sync }) : null\n const handlers = hostSignalHandlers(options)\n const controller = startWsSavedHosts({\n dataDir: options.dataDir,\n ...(registry ? { registry } : {}),\n directory: savedHostsDirectory(directory),\n skip: entry => entry.url === adHocUrl,\n connect: (entry, _token, attempt) => {\n const host = directory.get(entry.id)\n if (!host)\n return Promise.reject(new Error(`${entry.name} is no longer in this window's hosts.`))\n return host.transport.connect({ appVersion: 'tui-hosts', passive: true, ...attempt })\n },\n onSignal: (key, signal) => {\n handlers.onSignal(key, signal)\n if (signal.kind === 'sync:changed')\n sync?.serverChanged(key)\n },\n onConnected: (key, client) => {\n handlers.onConnected(key, client)\n sync?.connected(key, client)\n },\n onDisconnected: (key) => {\n handlers.onDisconnected(key)\n sync?.disconnected(key)\n },\n })\n return {\n ...controller,\n // Removing a server keeps what it has; this computer stops syncing to it.\n remove: (id) => {\n const removed = controller.remove(id)\n if (removed)\n sync?.removed(id)\n return removed\n },\n stop: () => {\n sync?.stop()\n controller.stop()\n },\n sync,\n }\n}\n"],"mappings":";;;;;AAwCA,SAAS,oBAAoB,W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AM,UAAS,MAAM,QAAQ;EAC7B,UAAU,OAAO,QAAQ,YAAY;GACnC,MAAM,OAAO,UAAU,IAAI,MAAM,EAAE;GACnC,IAAI,CAAC,MACH,OAAO,QAAQ,uBAAO,IAAI,MAAM,GAAG,MAAM,KAAK,sCAAsC,CAAC;GACvF,OAAO,KAAK,UAAU,QAAQ;IAAE,YAAY;IAAa,SAAS;IAAM,GAAG;GAAQ,CAAC;EACtF;EACA,WAAW,KAAK,WAAW;GACzB,SAAS,SAAS,KAAK,MAAM;GAC7B,IAAI,OAAO,SAAS,gBAClB,MAAM,cAAc,GAAG;EAC3B;EACA,cAAc,KAAK,WAAW;GAC5B,SAAS,YAAY,KAAK,MAAM;GAChC,MAAM,UAAU,KAAK,MAAM;EAC7B;EACA,iBAAiB,QAAQ;GACvB,SAAS,eAAe,GAAG;GAC3B,MAAM,aAAa,GAAG;EACxB;CACF,CAAC;CACD,OAAO;EACL,GAAG;EAEH,SAAS,OAAO;GACd,MAAM,UAAU,WAAW,OAAO,EAAE;GACpC,IAAI,SACF,MAAM,QAAQ,EAAE;GAClB,OAAO;EACT;EACA,YAAY;GACV,MAAM,KAAK;GACX,WAAW,KAAK;EAClB;EACA;CACF;AACF"}
1
+ {"version":3,"file":"remote-hosts-b6Luwdhu.js","names":[],"sources":["../src/tui/host/remote-hosts.ts"],"sourcesContent":["/**\n * Saved servers in the window's host directory: loaded only when the\n * `remoteHosts` setting is on (`use-remote-hosts` imports this module\n * dynamically), so a window with it off never reads `hosts.json`, never\n * loads the WebSocket client and never dials anything.\n *\n * The registry ↔ directory sync and the connection loops are the shared\n * ones (`startWsSavedHosts`, `src/ipc/hosts`, the GUI's too); this module is\n * the TUI's glue: a directory entry per server carries a WebSocket\n * transport (the session controllers and session data dial through it),\n * and the server's presence and session changes feed the window.\n */\nimport type { HostEntry, HostRegistry } from '../../chat/hosts'\nimport type { SyncEngine, SyncEngineOptions } from '../../chat/sync/engine'\nimport type { SavedHostsController, SavedHostsDirectory } from '../../ipc/hosts'\nimport type { SessionPresence } from '../../ipc/index'\nimport type { HostDirectory } from './host-directory'\nimport { createSyncEngine } from '../../chat/sync/engine'\nimport { startWsSavedHosts } from '../../ipc/hosts'\nimport { wsTransport } from '../runtime/transport'\nimport { hostSignalHandlers } from './host-signals'\n\nexport interface RemoteHostsOptions {\n dataDir: string\n directory: HostDirectory\n onPresence?: (key: string, rows: readonly SessionPresence[]) => void\n /** A server (re)connected: its sessions can be listed. */\n onConnected?: (key: string) => void\n /** A server's sessions changed (another window created, renamed or deleted one). */\n onSessionsChanged?: (key: string) => void\n /** Settings sync to the saved servers (`src/chat/sync`): this computer's files. Absent: no sync. */\n sync?: Omit<SyncEngineOptions, 'dataDir'>\n}\n\nexport type RemoteHostsController = SavedHostsController & {\n /** Settings sync to each saved server (Settings → Hosts → a server → Sync). */\n sync?: SyncEngine | null\n}\n\n/** The TUI's directory, as the shared saved-hosts sync sees it. */\nfunction savedHostsDirectory(directory: HostDirectory): SavedHostsDirectory {\n return {\n saved: () => directory.servers().filter(host => !host.adHoc).map(host => ({ key: host.key, url: host.url ?? '' })),\n upsert: (entry: HostEntry, token) => {\n // Every dial through it (the connection loop, session data, controllers) checks it is still this server.\n const transport = wsTransport({ url: entry.url, expectHostId: entry.id, ...(token ? { token } : {}) })\n const known = directory.get(entry.id)\n if (known) {\n // In place: the entry (and the sessions routed to it) stays.\n directory.update(entry.id, { name: entry.name, url: entry.url, transport, client: null, status: 'connecting', error: undefined })\n return\n }\n directory.put({\n key: entry.id,\n kind: 'server',\n name: entry.name,\n url: entry.url,\n transport,\n client: null,\n status: 'connecting',\n ...(entry.serverName ? { serverName: entry.serverName } : {}),\n ...(entry.serverVersion ? { serverVersion: entry.serverVersion } : {}),\n })\n },\n update: (key, patch) => directory.update(key, patch),\n remove: key => directory.remove(key),\n }\n}\n\nexport function startRemoteHosts(options: RemoteHostsOptions, registry?: HostRegistry): RemoteHostsController {\n const { directory } = options\n /** `--host` already names this server: its saved entry would be a second connection to it. */\n const adHocUrl = directory.servers().find(host => host.adHoc)?.url\n const sync = options.sync ? createSyncEngine({ dataDir: options.dataDir, ...options.sync }) : null\n const handlers = hostSignalHandlers(options)\n const controller = startWsSavedHosts({\n dataDir: options.dataDir,\n ...(registry ? { registry } : {}),\n directory: savedHostsDirectory(directory),\n skip: entry => entry.url === adHocUrl,\n connect: (entry, _token, attempt) => {\n const host = directory.get(entry.id)\n if (!host)\n return Promise.reject(new Error(`${entry.name} is no longer in this window's hosts.`))\n return host.transport.connect({ appVersion: 'tui-hosts', passive: true, ...attempt })\n },\n onSignal: (key, signal) => {\n handlers.onSignal(key, signal)\n if (signal.kind === 'sync:changed')\n sync?.serverChanged(key)\n },\n onConnected: (key, client) => {\n handlers.onConnected(key, client)\n sync?.connected(key, client)\n },\n onDisconnected: (key) => {\n handlers.onDisconnected(key)\n sync?.disconnected(key)\n },\n })\n return {\n ...controller,\n // Removing a server keeps what it has; this computer stops syncing to it.\n remove: (id) => {\n const removed = controller.remove(id)\n if (removed)\n sync?.removed(id)\n return removed\n },\n stop: () => {\n sync?.stop()\n controller.stop()\n },\n sync,\n }\n}\n"],"mappings":";;;;;AAwCA,SAAS,oBAAoB,WAA+C;CAC1E,OAAO;EACL,aAAa,UAAU,QAAQ,CAAC,CAAC,QAAO,SAAQ,CAAC,KAAK,KAAK,CAAC,CAAC,KAAI,UAAS;GAAE,KAAK,KAAK;GAAK,KAAK,KAAK,OAAO;EAAG,EAAE;EACjH,SAAS,OAAkB,UAAU;GAEnC,MAAM,YAAY,YAAY;IAAE,KAAK,MAAM;IAAK,cAAc,MAAM;IAAI,GAAI,QAAQ,EAAE,MAAM,IAAI,CAAC;GAAG,CAAC;GAErG,IADc,UAAU,IAAI,MAAM,EAC1B,GAAG;IAET,UAAU,OAAO,MAAM,IAAI;KAAE,MAAM,MAAM;KAAM,KAAK,MAAM;KAAK;KAAW,QAAQ;KAAM,QAAQ;KAAc,OAAO,KAAA;IAAU,CAAC;IAChI;GACF;GACA,UAAU,I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,SAAS,eAAe,GAAG;GAC3B,MAAM,aAAa,GAAG;EACxB;CACF,CAAC;CACD,OAAO;EACL,GAAG;EAEH,SAAS,OAAO;GACd,MAAM,UAAU,WAAW,OAAO,EAAE;GACpC,IAAI,SACF,MAAM,QAAQ,EAAE;GAClB,OAAO;EACT;EACA,YAAY;GACV,MAAM,KAAK;GACX,WAAW,KAAK;EAClB;EACA;CACF;AACF"}
package/dist/restate.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $T as ToolStateStore, Ba as McpToolWrap, FT as ToolDef, PT as ToolContext, _E as SessionStore, _T as ToolBatchExecutor, _w as AgentStats, hw as AgentClock, kx as StreamOptions, mw as AgentBehavior, oT as SessionTurn, xT as ToolResultContent, xx as Provider, za as McpToolMeta } from "./index-CidMTcxS.js";
1
+ import { CT as SessionTurn, Mw as AgentClock, Nx as StreamOptions, PE as SessionStore, PT as ToolBatchExecutor, Pw as AgentStats, QT as ToolDef, RT as ToolResultContent, Tx as Provider, Ua as McpToolMeta, Wa as McpToolWrap, ZT as ToolContext, gE as ToolStateStore, jw as AgentBehavior } from "./index-DyQyDLX1.js";
2
2
  import { C as TaskExitInfo, S as TaskEntry, g as ExecutionHandle, p as DetachedTasksCapability } from "./isolation-CbGNAEhQ.js";
3
3
  //#region src/restate/types.d.ts
4
4
  /**
@@ -80,6 +80,8 @@ const DEFAULT_SETTINGS = {
80
80
  importRulerConfigs: true,
81
81
  hideSubagentOutput: true,
82
82
  subagentModels: true,
83
+ imageGeneration: true,
84
+ imageModel: "",
83
85
  maxParallelSubagents: 3,
84
86
  queueMessages: true,
85
87
  theme: "default",
@@ -1598,6 +1600,7 @@ const SETTINGS_SECTIONS = [
1598
1600
  title: "Models",
1599
1601
  keys: [
1600
1602
  "subagentModels",
1603
+ "imageGeneration",
1601
1604
  "resumeOnMaxTokens",
1602
1605
  "maxOutputTokens",
1603
1606
  "retryMaxAttempts",
@@ -2023,6 +2026,12 @@ const SETTINGS_TOGGLES = [
2023
2026
  label: "Allow subagents to use different models",
2024
2027
  description: "Let the agent hand work to cheaper models."
2025
2028
  },
2029
+ {
2030
+ category: "agent",
2031
+ key: "imageGeneration",
2032
+ label: "Image generation",
2033
+ description: "Let the agent generate images with your providers' image models. Each image is billed by the provider."
2034
+ },
2026
2035
  {
2027
2036
  category: "agent",
2028
2037
  key: "decisions",
@@ -2891,4 +2900,4 @@ function isSecretPathSegment(segment) {
2891
2900
  //#endregion
2892
2901
  export { SETTINGS_DEFAULTS_VERSION_KEY as A, GRUVBOX_LIGHT as C, CATPPUCCIN_MOCHA as D, CATPPUCCIN_MACCHIATO as E, sparseSettingsUpdate as F, isAllowedBrowserUrl as I, isLocalBrowserUrl as L, decisionsEnabled as M, migrateStoredSettings as N, DEFAULT_SETTINGS as O, settingsFromStored as P, normalizeBrowserUrl as R, GRUVBOX_DARK as S, CATPPUCCIN_LATTE as T, BUILTIN_THEMES as _, APPROVAL_MODE_OPTIONS as a, resolveTheme as b, SETTINGS_INPUTS as c, clampFps as d, enforceSettingsInvariants as f, toggleHeldOn as g, settingsSectionOf as h, looksLikeSecret as i, approvalModeFromSafeMode as j, SETTINGS_DEFAULTS_VERSION as k, SETTINGS_SECTIONS as l, settingKeywords as m, isSecretName as n, SETTINGS_CATEGORIES as o, requirementMet as p, isSecretPathSegment as r, SETTINGS_CHOICES as s, KNOWN_TOKEN as t, SETTINGS_TOGGLES as u, DEFAULT_THEME as v, CATPPUCCIN_FRAPPE as w, VAPORWAVE_THEME as x, resolveChipColor as y };
2893
2902
 
2894
- //# sourceMappingURL=secret-shapes-Cda65uDH.js.map
2903
+ //# sourceMappingURL=secret-shapes-CEoGmfEE.js.map