zidane 6.5.2 → 6.5.4
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/{acp-565X8nVP.js → acp-CIpD8UIw.js} +2 -2
- package/dist/{acp-565X8nVP.js.map → acp-CIpD8UIw.js.map} +1 -1
- package/dist/acp-cli.js +5 -5
- package/dist/acp.d.ts +1 -1
- package/dist/acp.js +1 -1
- package/dist/{agent-CvO7UOxv.js → agent-8kfGIDb_.js} +2 -2
- package/dist/{agent-CvO7UOxv.js.map → agent-8kfGIDb_.js.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +1 -1
- package/dist/{anthropic-Dov2mC5e.js → anthropic-qaw8XAc9.js} +2 -2
- package/dist/{anthropic-Dov2mC5e.js.map → anthropic-qaw8XAc9.js.map} +1 -1
- package/dist/{auth-B8ZuBcKC.js → auth-BLy7X1SY.js} +8 -5
- package/dist/{auth-B8ZuBcKC.js.map → auth-BLy7X1SY.js.map} +1 -1
- package/dist/chat/pure.d.ts +3 -3
- package/dist/chat.d.ts +20 -15
- package/dist/chat.d.ts.map +1 -1
- package/dist/chat.js +3 -3
- package/dist/{context-transport-ClvadrlH.js → context-transport-Bco9Wo0b.js} +3 -3
- package/dist/{context-transport-ClvadrlH.js.map → context-transport-Bco9Wo0b.js.map} +1 -1
- package/dist/contexts/daytona.d.ts +1 -1
- package/dist/contexts/daytona.d.ts.map +1 -1
- package/dist/contexts/daytona.js +5 -2
- package/dist/contexts/daytona.js.map +1 -1
- package/dist/contexts/e2b.d.ts +1 -1
- package/dist/cursor-iojRXHF9.js +139 -0
- package/dist/cursor-iojRXHF9.js.map +1 -0
- package/dist/eval.d.ts +1 -1
- package/dist/extensions.d.ts +1 -1
- package/dist/extensions.js +1 -1
- package/dist/headless.d.ts +1 -1
- package/dist/headless.js +1 -1
- package/dist/{index-DfERTrql.d.ts → index-BSNr0OQn.d.ts} +20 -3
- package/dist/index-BSNr0OQn.d.ts.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -8
- package/dist/{login-Cl6ML2XN.js → login-D3CKhgbI.js} +2 -2
- package/dist/{login-Cl6ML2XN.js.map → login-D3CKhgbI.js.map} +1 -1
- package/dist/{mcp-DdntU47g.js → mcp-D9fqOQo5.js} +3 -3
- package/dist/{mcp-DdntU47g.js.map → mcp-D9fqOQo5.js.map} +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +1 -1
- package/dist/{oauth-bkEOybqm.js → oauth-ZebH9NHb.js} +70 -11
- package/dist/oauth-ZebH9NHb.js.map +1 -0
- package/dist/output/stream-json.d.ts +1 -1
- package/dist/output/terminal.d.ts +1 -1
- package/dist/pkce-t8BcPyEi.js +30 -0
- package/dist/pkce-t8BcPyEi.js.map +1 -0
- package/dist/plugins.d.ts +1 -1
- package/dist/presets.d.ts +1 -1
- package/dist/presets.js +1 -1
- package/dist/providers/anthropic.d.ts +1 -1
- package/dist/providers/anthropic.js +1 -1
- package/dist/providers/arcee.d.ts +1 -1
- package/dist/providers/baseten.d.ts +1 -1
- package/dist/providers/cerebras.d.ts +1 -1
- package/dist/providers/local.d.ts +1 -1
- package/dist/providers/openai-compat.d.ts +1 -1
- package/dist/providers/openai.d.ts +1 -1
- package/dist/providers/openai.js +1 -1
- package/dist/providers/openrouter.d.ts +1 -1
- package/dist/providers/xai.d.ts +1 -1
- package/dist/providers/xai.js +68 -1
- package/dist/providers/xai.js.map +1 -0
- package/dist/providers-Bxs-XHir.js +137 -0
- package/dist/providers-Bxs-XHir.js.map +1 -0
- package/dist/providers.d.ts +2 -2
- package/dist/providers.js +5 -5
- package/dist/restate.d.ts +1 -1
- package/dist/restate.js +1 -1
- package/dist/rolldown-runtime-BhDjJH2R.js +15 -0
- package/dist/session/sqlite.d.ts +1 -1
- package/dist/session.d.ts +1 -1
- package/dist/skills.d.ts +1 -1
- package/dist/{stdio-BQeCMmuK.js → stdio-DPpBDPx5.js} +13 -4
- package/dist/{stdio-BQeCMmuK.js.map → stdio-DPpBDPx5.js.map} +1 -1
- package/dist/{stdio-loader-BN1l1ZAG.js → stdio-loader-CI4sPFve.js} +11 -6
- package/dist/stdio-loader-CI4sPFve.js.map +1 -0
- package/dist/{tool-formatters-B2gBbKaS.d.ts → tool-formatters-BfKqWm5N.d.ts} +3 -3
- package/dist/{tool-formatters-B2gBbKaS.d.ts.map → tool-formatters-BfKqWm5N.d.ts.map} +1 -1
- package/dist/tools/fetch-url.d.ts +1 -1
- package/dist/tools/web-search.d.ts +1 -1
- package/dist/tools.d.ts +1 -1
- package/dist/tools.js +1 -1
- package/dist/{transcript-anchors-CmFKUw8M.js → transcript-anchors-Bv8HQ3S2.js} +36 -31
- package/dist/transcript-anchors-Bv8HQ3S2.js.map +1 -0
- package/dist/{transcript-anchors-CeIxhKP7.d.ts → transcript-anchors-CNqDbrc9.d.ts} +2 -2
- package/dist/{transcript-anchors-CeIxhKP7.d.ts.map → transcript-anchors-CNqDbrc9.d.ts.map} +1 -1
- package/dist/tui.d.ts +3 -3
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +19 -13
- package/dist/tui.js.map +1 -1
- package/dist/{turn-operations-Dyv3Z-Ff.d.ts → turn-operations-CnIpcenJ.d.ts} +3 -3
- package/dist/{turn-operations-Dyv3Z-Ff.d.ts.map → turn-operations-CnIpcenJ.d.ts.map} +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/{xai-Du6Wfnlb.js → xai-DILdFGzN.js} +11 -94
- package/dist/xai-DILdFGzN.js.map +1 -0
- package/docs/RESTATE.md +7 -0
- package/package.json +18 -17
- package/dist/index-DfERTrql.d.ts.map +0 -1
- package/dist/oauth-bkEOybqm.js.map +0 -1
- package/dist/providers-B6mFe7OD.js +0 -264
- package/dist/providers-B6mFe7OD.js.map +0 -1
- package/dist/stdio-loader-BN1l1ZAG.js.map +0 -1
- package/dist/transcript-anchors-CmFKUw8M.js.map +0 -1
- package/dist/xai-Du6Wfnlb.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Al as CompletionReference, Rl as Command,
|
|
2
|
-
import { B as ApprovalDecision } from "./tool-formatters-
|
|
1
|
+
import { Al as CompletionReference, Ph as TurnUsage, Rl as Command, Th as ToolResultContent, bd as StreamEvent, fd as EditOutcome, hd as Owner, kl as CompletionProvider, md as EditPayload, mh as SessionTurn, og as SkillConfig } from "./index-BSNr0OQn.js";
|
|
2
|
+
import { B as ApprovalDecision } from "./tool-formatters-BfKqWm5N.js";
|
|
3
3
|
|
|
4
4
|
//#region src/chat/color-gradient.d.ts
|
|
5
5
|
/**
|
|
@@ -684,4 +684,4 @@ declare function countNeighbors(turnIds: readonly string[], turnId: string): {
|
|
|
684
684
|
} | null;
|
|
685
685
|
//#endregion
|
|
686
686
|
export { uniqueFilesFromReferences as $, buildUnifiedDiff as A, buildEditOutcomesAnnotation as B, EditSummary as C, PreviewResult as D, InlineSegment as E, previewEditPayload as F, rewriteMultiEditHeader as G, mergeApprovalAndBodyOutcomes as H, splitLines as I, SKILLS_TRIGGER as J, stripEditOutcomesAnnotation as K, summarizeEditPayload as L, computeLineDiff as M, extractEditPayload as N, applyEditPayload as O, filetypeFromPath as P, createFilesCompletionProvider as Q, tokenize as R, EditHunkSummary as S, InlineDiff as T, parseEditOutcomesFromResult as U, maskToOutcomeKinds as V, resolveApprovalForPayload as W, uniqueSkillNamesFromReferences as X, createSkillsCompletionProvider as Y, FILES_TRIGGER as Z, formatTaskSummary as _, MAX_TRANSCRIPT_EVENTS as a, CHATS_TRIGGER as at, DiffLine as b, finalizeStreamingMarkdown as c, ChatReferenceScope as ct, ageString as d, uniqueChatIdsFromReferences as dt, FileEntry as et, compactPath as f, blendHsl as ft, formatTaskStatus as g, formatDuration as h, turnAsText as i, createCommandsCompletionProvider as it, computeInlineDiff as j, buildContextualDiff as k, finalizeStreamingMarkdownForOwner as l, chatReferenceTokensFromText as lt, fmtTokens as m, deleteTurnSafely as n, listProjectFiles as nt, TRANSCRIPT_TRIM_TO_EVENTS as o, ChatReferenceData as ot, fmtCost as p, buildLinearRamp as pt, summarizeOutcomes as q, truncateTurnsAt as r, COMMANDS_TRIGGER as rt, capTranscriptEvents as s, ChatReferenceEntry as st, countNeighbors as t, ListProjectFilesOptions as tt, turnContextSize as u, createChatsCompletionProvider as ut, previewLine as v, HunkResolution as w, DiffOp as x, shortId as y, ResolvedApproval as z };
|
|
687
|
-
//# sourceMappingURL=turn-operations-
|
|
687
|
+
//# sourceMappingURL=turn-operations-CnIpcenJ.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"turn-operations-
|
|
1
|
+
{"version":3,"file":"turn-operations-CnIpcenJ.d.ts","names":[],"sources":["../src/chat/color-gradient.ts","../src/chat/completion-chats.ts","../src/chat/completion-commands.ts","../src/chat/files-discovery.ts","../src/chat/completion-files.ts","../src/chat/completion-skills.ts","../src/chat/edit-approval.ts","../src/tools/edit-utils.ts","../src/chat/edit-diff.ts","../src/chat/format.ts","../src/chat/streaming-pure.ts","../src/chat/turn-operations.ts"],"mappings":";;;;;;;;iBAmFgB,QAAA,CAAS,IAAA,UAAc,EAAA,UAAY,CAAA;;;;;;iBAuBnC,eAAA,CAAgB,IAAA,UAAc,EAAA,UAAY,CAAA;;;cCxF7C,aAAA;AAAA,KAKD,kBAAA;AAAA,UAEK,kBAAA;EACf,EAAA;EACA,KAAA;EACA,SAAA;EACA,gBAAA;EACA,QAAA;EACA,WAAA;EACA,SAAA;AAAA;AAAA,UAGe,iBAAA;EACf,KAAA,EAAO,kBAAkB;EACzB,KAAA;AAAA;AAAA,iBAmIc,6BAAA,CAA8B,IAAA;EAC5C,UAAA,iBAA2B,kBAAA;EAC3B,mBAAA,kBAAqC,kBAAA;EACrC,QAAA,SAAiB,kBAAA;EACjB,aAAA,SAAsB,OAAA,UAAiB,kBAAA;EACvC,KAAA;AAAA,IACE,kBAAA,CAAmB,iBAAA;AAAA,iBAoDP,2BAAA,CACd,UAAmD,WAA9B,mBA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AiB,KAAA,WAAgB,WAAA,IAAe,MAAA,WAAiB,WAAW;;;;;;;AVrBrF;AAmIP;iBUtDgB,UAAA,CAAW,IAAiB,EAAX,WAAW;;;;;;iBA+B5B,cAAA,CACd,OAAA,qBACA,MAAA;EACG,MAAA;EAAgB,KAAA;AAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { d as ClassifiedErrorKind, i as AgentContextExceededError, l as CONTEXT_EXCEEDED_MESSAGE_PATTERNS, n as AgentAbortedError, o as AgentProviderError, p as matchesContextExceeded, r as AgentBudgetExceededError, s as AgentToolNotAllowedError, u as ClassifiedError } from "./timeout-DEaqslLO.js";
|
|
2
|
-
import { $m as
|
|
2
|
+
import { $h as ToolStateOp, $m as PromptDocumentPart, Ah as ToolResultMetadata, Am as AgentStats, Bf as StreamCallbacks, Bh as ToolMap, C as SuccessfulMutationOutcome, Ch as ToolOutcome, Dg as RemoteStoreOptions, Dh as ToolResultDocumentRefContent, Dm as AgentBehavior, Dp as OpenAIParams, Eh as ToolResultDocumentContent, Fh as toolOutputBudgetByteLength, Gf as ToolSpec, Gi as AgentHookMap, Gm as McpToolHookContext, Hh as ReadStateEntry, Ih as toolOutputByteLength, Jp as AnthropicParams, Kf as TurnResult, Ki as AgentHooks, Lf as Provider, Lh as toolResultToText, Mh as ToolResultVideoContent, Nh as TurnFinishReason, Ns as SpawnToolOptions, Oh as ToolResultImageContent, Om as AgentClock, Os as ChildAgent, Ph as TurnUsage, Pm as ChildRunStats, Ps as SpawnToolState, Qh as ToolStateController, Qm as PromptAudioPart, Rf as ProviderCapabilities, Rh as ToolContext, Rr as InteractionToolOptions, S as MutationValidationResult, Sh as ToolHookContext, Th as ToolResultContent, Uf as ToolCall, Uh as ReadStateMap, Vf as StreamOptions, Wf as ToolResult, Wi as Agent, Wm as McpServerConfig, Xm as ProgressNudgeKind, Ym as OAuthRefreshHookContext, Zh as StagedToolState, Zm as ProgressNudgeMessage, _ as statsByModel, _g as SessionStore, ah as RepeatGuardToolMatcher, b as MutationValidationHooksOptions, bh as ThinkingLevel, cg as SkillResource, ch as RetryConfig, dg as CreateSessionOptions, dh as SessionEndStatus, eg as ToolStateStore, eh as PromptImagePart, fh as SessionHookContext, gg as SessionRun, h as flattenTurns, hh as SpawnHookContext, ih as RepeatGuardConfig, jh as ToolResultTextContent, kh as ToolResultImageRefContent, km as AgentRunOptions, lh as RunHookMap, mg as SessionData, mh as SessionTurn, nh as PromptTextPart, o_ as McpConnection, og as SkillConfig, oh as ResolveContentRef, p as ModelUsage, pg as Session, ph as SessionMessage, qi as AgentOptions, rh as PromptVideoPart, rp as OpenRouterParams, sh as ResolveContentRefBlock, t as Preset, tg as ToolStateView, th as PromptPart, ug as SkillsConfig, uh as SessionContentBlock, v as MutationValidationBatch, vh as StreamHookContext, vr as ValidationResult, wh as ToolResultAudioContent, x as MutationValidationMutation, y as MutationValidationFailure, zh as ToolDef, zm as DEFAULT_AGENT_CLOCK, zp as CerebrasParams } from "./index-BSNr0OQn.js";
|
|
3
3
|
import { _ as TaskHandle, a as ContextType, c as ExecutionContext, g as TaskExitInfo, h as TaskEntry, l as ExecutionHandle, n as ContextCapabilities, o as DetachedTasksCapability, p as SpawnConfig, r as ContextHardening, s as ExecResult, t as BackgroundTaskStatus, v as TaskStallInfo } from "./types-M2DauK2D.js";
|
|
4
4
|
import { t as SandboxProvider } from "./sandbox-DLY6uah7.js";
|
|
5
5
|
export { type Agent, AgentAbortedError, type AgentBehavior, AgentBudgetExceededError, type AgentClock, AgentContextExceededError, type AgentHookMap, type AgentHooks, type AgentOptions, AgentProviderError, type AgentRunOptions, type AgentStats, AgentToolNotAllowedError, type AnthropicParams, type BackgroundTaskStatus, CONTEXT_EXCEEDED_MESSAGE_PATTERNS, type CerebrasParams, type ChildAgent, type ChildRunStats, type ClassifiedError, type ClassifiedErrorKind, type ContextCapabilities, type ContextHardening, type ContextType, type CreateSessionOptions, DEFAULT_AGENT_CLOCK, type DetachedTasksCapability, type ExecResult, type ExecutionContext, type ExecutionHandle, type InteractionToolOptions, type McpConnection, type McpServerConfig, type McpToolHookContext, type ModelUsage, type MutationValidationBatch, type MutationValidationFailure, type MutationValidationHooksOptions, type MutationValidationMutation, type MutationValidationResult, type OAuthRefreshHookContext, type OpenAIParams, type OpenRouterParams, type Preset, type ProgressNudgeKind, type ProgressNudgeMessage, type PromptAudioPart, type PromptDocumentPart, type PromptImagePart, type PromptPart, type PromptTextPart, type PromptVideoPart, type Provider, type ProviderCapabilities, type ReadStateEntry, type ReadStateMap, type RemoteStoreOptions, type RepeatGuardConfig, type RepeatGuardToolMatcher, type ResolveContentRef, type ResolveContentRefBlock, type RetryConfig, type RunHookMap, type SandboxProvider, type Session, type SessionContentBlock, type SessionData, type SessionEndStatus, type SessionHookContext, type SessionMessage, type SessionRun, type SessionStore, type SessionTurn, type SkillConfig, type SkillResource, type SkillsConfig, type SpawnConfig, type SpawnHookContext, type SpawnToolOptions, type SpawnToolState, type StagedToolState, type StreamCallbacks, type StreamHookContext, type StreamOptions, type SuccessfulMutationOutcome, type TaskEntry, type TaskExitInfo, type TaskHandle, type TaskStallInfo, type ThinkingLevel, type ToolCall, type ToolContext, type ToolDef, type ToolHookContext, type ToolMap, type ToolOutcome, type ToolResult, type ToolResultAudioContent, type ToolResultContent, type ToolResultDocumentContent, type ToolResultDocumentRefContent, type ToolResultImageContent, type ToolResultImageRefContent, type ToolResultMetadata, type ToolResultTextContent, type ToolResultVideoContent, type ToolSpec, type ToolStateController, type ToolStateOp, type ToolStateStore, type ToolStateView, type TurnFinishReason, type TurnResult, type TurnUsage, type ValidationResult, flattenTurns, matchesContextExceeded, statsByModel, toolOutputBudgetByteLength, toolOutputByteLength, toolResultToText };
|
|
@@ -1,34 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.js";
|
|
2
|
+
import { t as generatePkce } from "./pkce-t8BcPyEi.js";
|
|
3
3
|
import { createServer } from "node:http";
|
|
4
|
-
//#region src/chat/oauth-page/pkce.ts
|
|
5
|
-
/**
|
|
6
|
-
* PKCE helper. Inlined here (rather than imported from pi-ai) because
|
|
7
|
-
* `@earendil-works/pi-ai/oauth` does not re-export it, and we don't want
|
|
8
|
-
* to reach into `node_modules/.../utils/oauth/pkce.js` — that's an
|
|
9
|
-
* implementation-detail path that breaks on minor upstream rearrangements.
|
|
10
|
-
*
|
|
11
|
-
* Web Crypto API only. Works under Bun + Node 22+ without any node:crypto
|
|
12
|
-
* import (matches pi-ai's own behavior). Output is base64url per RFC 7636.
|
|
13
|
-
*/
|
|
14
|
-
function base64UrlEncode(bytes) {
|
|
15
|
-
let binary = "";
|
|
16
|
-
for (const byte of bytes) binary += String.fromCharCode(byte);
|
|
17
|
-
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
18
|
-
}
|
|
19
|
-
async function generatePkce() {
|
|
20
|
-
const verifierBytes = /* @__PURE__ */ new Uint8Array(32);
|
|
21
|
-
crypto.getRandomValues(verifierBytes);
|
|
22
|
-
const verifier = base64UrlEncode(verifierBytes);
|
|
23
|
-
const data = new TextEncoder().encode(verifier);
|
|
24
|
-
const hashBuffer = await crypto.subtle.digest("SHA-256", data);
|
|
25
|
-
return {
|
|
26
|
-
verifier,
|
|
27
|
-
challenge: base64UrlEncode(new Uint8Array(hashBuffer))
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
//#endregion
|
|
31
4
|
//#region src/chat/oauth-page/xai.ts
|
|
5
|
+
var xai_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
+
XAI_OAUTH_PROVIDER_ID: () => XAI_OAUTH_PROVIDER_ID,
|
|
7
|
+
createXaiOAuthProvider: () => createXaiOAuthProvider,
|
|
8
|
+
loginXai: () => loginXai,
|
|
9
|
+
refreshXaiToken: () => refreshXaiToken,
|
|
10
|
+
xaiBaseUrl: () => xaiBaseUrl
|
|
11
|
+
});
|
|
32
12
|
/** pi-ai / zidane OAuth provider id. Also the credentials-file key. */
|
|
33
13
|
const XAI_OAUTH_PROVIDER_ID = "xai-oauth";
|
|
34
14
|
const DEFAULT_BASE_URL = "https://api.x.ai/v1";
|
|
@@ -311,69 +291,6 @@ function createXaiOAuthProvider(renderPage) {
|
|
|
311
291
|
};
|
|
312
292
|
}
|
|
313
293
|
//#endregion
|
|
314
|
-
|
|
315
|
-
const DEFAULT_MODEL = "grok-4.3";
|
|
316
|
-
function xai(params) {
|
|
317
|
-
const defaultModel = params?.defaultModel || DEFAULT_MODEL;
|
|
318
|
-
const baseURL = xaiBaseUrl();
|
|
319
|
-
const capabilities = params?.capabilities ?? {
|
|
320
|
-
vision: true,
|
|
321
|
-
imageInToolResult: false
|
|
322
|
-
};
|
|
323
|
-
const baseCredentials = extractRuntimeCredentials(params);
|
|
324
|
-
let runtimeCredentials = baseCredentials;
|
|
325
|
-
const staticKey = params?.apiKey ?? process.env.XAI_API_KEY;
|
|
326
|
-
const isOAuth = baseCredentials !== void 0 || !staticKey || isOAuthAccessToken(staticKey);
|
|
327
|
-
/**
|
|
328
|
-
* Build the openai-compat delegate for a resolved bearer. Cheap — the factory
|
|
329
|
-
* only wires closures — so we re-create it per turn with the freshly resolved
|
|
330
|
-
* (possibly refreshed) OAuth token rather than baking a stale key in once.
|
|
331
|
-
*/
|
|
332
|
-
function delegateFor(apiKey) {
|
|
333
|
-
return openaiCompat({
|
|
334
|
-
name: "xai",
|
|
335
|
-
apiKey,
|
|
336
|
-
baseURL,
|
|
337
|
-
defaultModel,
|
|
338
|
-
capabilities,
|
|
339
|
-
extraHeaders: params?.extraHeaders
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
const skeleton = delegateFor("placeholder-resolved-at-stream");
|
|
343
|
-
return {
|
|
344
|
-
...skeleton,
|
|
345
|
-
name: "xai",
|
|
346
|
-
meta: {
|
|
347
|
-
...skeleton.meta,
|
|
348
|
-
defaultModel,
|
|
349
|
-
isOAuth
|
|
350
|
-
},
|
|
351
|
-
async stream(options, callbacks) {
|
|
352
|
-
return delegateFor(await resolveOAuthApiKey({
|
|
353
|
-
provider: "xai",
|
|
354
|
-
providerId: XAI_OAUTH_PROVIDER_ID,
|
|
355
|
-
params: runtimeCredentials ? {
|
|
356
|
-
...params,
|
|
357
|
-
...runtimeCredentials
|
|
358
|
-
} : params,
|
|
359
|
-
envKey: "XAI_API_KEY",
|
|
360
|
-
missingError: "No xAI credentials found. Set XAI_API_KEY or run `bun run auth --xai` first.",
|
|
361
|
-
refreshError: (reason) => `xAI OAuth token refresh failed. Run \`bun run auth --xai\` again. ${reason}`
|
|
362
|
-
}, {
|
|
363
|
-
...callbacks,
|
|
364
|
-
async onOAuthRefresh(ctx) {
|
|
365
|
-
if (ctx.source === "params") runtimeCredentials = {
|
|
366
|
-
access: ctx.credentials.access,
|
|
367
|
-
refresh: ctx.credentials.refresh,
|
|
368
|
-
expires: ctx.credentials.expires
|
|
369
|
-
};
|
|
370
|
-
await callbacks.onOAuthRefresh?.(ctx);
|
|
371
|
-
}
|
|
372
|
-
})).stream(options, callbacks);
|
|
373
|
-
}
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
//#endregion
|
|
377
|
-
export { createXaiOAuthProvider as n, generatePkce as r, xai as t };
|
|
294
|
+
export { xai_exports as i, createXaiOAuthProvider as n, xaiBaseUrl as r, XAI_OAUTH_PROVIDER_ID as t };
|
|
378
295
|
|
|
379
|
-
//# sourceMappingURL=xai-
|
|
296
|
+
//# sourceMappingURL=xai-DILdFGzN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xai-DILdFGzN.js","names":[],"sources":["../src/chat/oauth-page/xai.ts"],"sourcesContent":["/**\n * xAI Grok OAuth flow (SuperGrok / X Premium+).\n *\n * xAI is **not** built into pi-ai, so — like Cursor — we implement the flow\n * here and register it with pi-ai's OAuth registry (`registerXaiOAuthProvider`)\n * so `getOAuthApiKey('xai-oauth', …)` resolves to it during lazy token refresh.\n *\n * Auth shape: OAuth 2.0 + PKCE with a loopback callback server, against xAI's\n * OIDC issuer (`https://auth.x.ai`). Differs from the Anthropic / Codex flows\n * (which use the shared `startCallbackServer`) on three points, so it gets its\n * own login impl rather than reusing that primitive:\n *\n * 1. The `redirect_uri` must be `http://127.0.0.1:56121/callback` verbatim\n * (xAI matches the registered loopback IP, not `localhost`).\n * 2. Endpoints come from OIDC discovery, not hard-coded constants.\n * 3. Token exchange + refresh are `application/x-www-form-urlencoded`\n * (the Anthropic flow posts JSON).\n *\n * The callback page still routes through {@link OAuthCallbackPageRenderer} so\n * the post-redirect HTML matches the rest of zidane's themed flows.\n *\n * Flow + constants adapted from the public reference implementations\n * (`stnly/pi-grok`, `BlockedPath/pi-xai-oauth`) and the Hermes Agent docs.\n * xAI's OAuth surface is unofficial/undocumented — re-verify the client id,\n * scopes, and callback port if login starts failing.\n */\n\nimport type {\n OAuthCredentials,\n OAuthLoginCallbacks,\n} from '@earendil-works/pi-ai/oauth'\nimport type { IncomingMessage, ServerResponse } from 'node:http'\nimport type { OAuthProviderInterface } from '../../providers/oauth-registry'\nimport type { OAuthCallbackPageRenderer } from './render'\nimport { createServer } from 'node:http'\nimport { generatePkce } from './pkce'\n\n/** pi-ai / zidane OAuth provider id. Also the credentials-file key. */\nexport const XAI_OAUTH_PROVIDER_ID = 'xai-oauth'\n\nconst DEFAULT_BASE_URL = 'https://api.x.ai/v1'\nconst ISSUER = 'https://auth.x.ai'\nconst DISCOVERY_URL = `${ISSUER}/.well-known/openid-configuration`\n/** Public client id used by the Grok CLI OAuth surface. */\nconst DEFAULT_CLIENT_ID = 'b1a00492-073a-47ea-816f-4c329264a828'\nconst DEFAULT_SCOPE = 'openid profile email offline_access grok-cli:access api:access'\n/** xAI matches the registered loopback IP exactly — `localhost` is rejected. */\nconst DEFAULT_CALLBACK_HOST = '127.0.0.1'\nconst DEFAULT_CALLBACK_PORT = 56121\nconst CALLBACK_PATH = '/callback'\nconst PROVIDER_NAME = 'xAI Grok'\n/** Refresh slightly early so requests don't race expiry. */\nconst REFRESH_SKEW_MS = 120_000\nconst CALLBACK_TIMEOUT_MS = 180_000\n\nfunction xaiOAuthClientId(): string {\n return process.env.PI_XAI_OAUTH_CLIENT_ID || DEFAULT_CLIENT_ID\n}\n\nfunction xaiOAuthScope(): string {\n return process.env.PI_XAI_OAUTH_SCOPE || DEFAULT_SCOPE\n}\n\nfunction xaiOAuthCallbackHost(): string {\n return process.env.PI_XAI_OAUTH_CALLBACK_HOST || DEFAULT_CALLBACK_HOST\n}\n\nfunction xaiOAuthCallbackPort(): number {\n const parsed = Number.parseInt(process.env.PI_XAI_OAUTH_CALLBACK_PORT || String(DEFAULT_CALLBACK_PORT), 10)\n return Number.isFinite(parsed) && parsed > 0 ? parsed : DEFAULT_CALLBACK_PORT\n}\n\n/** Resolve the xAI API base URL (env override → default). */\nexport function xaiBaseUrl(): string {\n return (process.env.PI_XAI_BASE_URL || process.env.XAI_BASE_URL || DEFAULT_BASE_URL)\n .replace(/\\/+$/, '')\n}\n\ninterface XaiDiscovery {\n authorization_endpoint: string\n token_endpoint: string\n}\n\n/**\n * xAI OAuth credentials. Extends the base `{ access, refresh, expires }` with\n * the resolved `token_endpoint` so refresh doesn't need a second discovery\n * round-trip, plus the cached discovery doc for validation.\n */\nexport interface XaiOAuthCredentials extends OAuthCredentials {\n tokenEndpoint?: string\n discovery?: XaiDiscovery\n}\n\nfunction base64Url(bytes: Uint8Array): string {\n let binary = ''\n for (const b of bytes)\n binary += String.fromCharCode(b)\n return btoa(binary).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/, '')\n}\n\nfunction randomToken(byteLength = 16): string {\n return base64Url(crypto.getRandomValues(new Uint8Array(byteLength)))\n}\n\n/**\n * Refuse any OIDC endpoint that isn't HTTPS on an xAI origin.\n *\n * The discovery doc is cached long-term in `credentials.json`. A single MITM\n * during initial login could otherwise pin a malicious `token_endpoint` that\n * receives every subsequent refresh token. Validating scheme + host keeps the\n * endpoint on `x.ai` / `*.x.ai`.\n */\nfunction validateEndpoint(value: string, field: string): string {\n let url: URL\n try {\n url = new URL(value)\n }\n catch {\n throw new Error(`xAI OAuth discovery returned an invalid ${field}: ${value}`)\n }\n if (url.protocol !== 'https:')\n throw new Error(`xAI OAuth ${field} must use HTTPS: ${value}`)\n const host = url.hostname.toLowerCase()\n if (host !== 'x.ai' && !host.endsWith('.x.ai'))\n throw new Error(`Refusing non-xAI OAuth ${field}: ${value}`)\n return url.toString()\n}\n\nasync function discover(): Promise<XaiDiscovery> {\n let response: Response\n try {\n response = await fetch(DISCOVERY_URL, {\n headers: { Accept: 'application/json' },\n signal: AbortSignal.timeout(15_000),\n })\n }\n catch (cause) {\n throw new Error(`xAI OIDC discovery failed: ${cause instanceof Error ? cause.message : String(cause)}`)\n }\n if (!response.ok)\n throw new Error(`xAI OIDC discovery returned ${response.status}`)\n\n const payload = await response.json() as Record<string, unknown>\n return {\n authorization_endpoint: validateEndpoint(String(payload.authorization_endpoint ?? ''), 'authorization_endpoint'),\n token_endpoint: validateEndpoint(String(payload.token_endpoint ?? ''), 'token_endpoint'),\n }\n}\n\ninterface CallbackResult {\n code?: string\n state?: string\n error?: string\n errorDescription?: string\n}\n\ninterface XaiCallbackServer {\n redirectUri: string\n waitForCallback: (timeoutMs: number) => Promise<CallbackResult>\n close: () => void\n}\n\n/**\n * Start the loopback callback server on `127.0.0.1:56121`. Falls back to an\n * OS-assigned port if 56121 is taken — xAI accepts any loopback port as long\n * as the `redirect_uri` we send on the authorize URL matches the listener.\n */\nasync function startXaiCallbackServer(renderPage: OAuthCallbackPageRenderer): Promise<XaiCallbackServer> {\n const callbackHost = xaiOAuthCallbackHost()\n const callbackPort = xaiOAuthCallbackPort()\n let settle: ((value: CallbackResult) => void) | undefined\n let settled = false\n const callbackPromise = new Promise<CallbackResult>((resolve) => {\n settle = (value) => {\n if (settled)\n return\n settled = true\n resolve(value)\n }\n })\n\n const server = createServer((req: IncomingMessage, res: ServerResponse) => {\n try {\n // accounts.x.ai may issue a CORS preflight against the loopback listener.\n const origin = req.headers.origin\n if (origin === 'https://accounts.x.ai' || origin === 'https://auth.x.ai') {\n res.setHeader('Access-Control-Allow-Origin', origin)\n res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS')\n res.setHeader('Access-Control-Allow-Headers', 'Content-Type')\n res.setHeader('Access-Control-Allow-Private-Network', 'true')\n res.setHeader('Vary', 'Origin')\n }\n if (req.method === 'OPTIONS') {\n res.statusCode = 204\n res.end()\n return\n }\n\n const url = new URL(req.url ?? '/', `http://${callbackHost}`)\n if (url.pathname !== CALLBACK_PATH) {\n res.statusCode = 404\n res.end('Not found')\n return\n }\n\n const result: CallbackResult = {\n code: url.searchParams.get('code') ?? undefined,\n state: url.searchParams.get('state') ?? undefined,\n error: url.searchParams.get('error') ?? undefined,\n errorDescription: url.searchParams.get('error_description') ?? undefined,\n }\n\n res.statusCode = result.error ? 400 : 200\n res.setHeader('Content-Type', 'text/html; charset=utf-8')\n res.end(renderPage(result.error\n ? {\n kind: 'error',\n provider: PROVIDER_NAME,\n message: `${PROVIDER_NAME} authentication did not complete.`,\n details: result.errorDescription ?? result.error,\n }\n : {\n kind: 'success',\n provider: PROVIDER_NAME,\n message: 'xAI authentication completed. You can close this window.',\n }))\n settle?.(result)\n }\n catch {\n res.statusCode = 500\n res.end('Internal error')\n }\n })\n\n const listen = (port: number) => new Promise<number>((resolve, reject) => {\n server.once('error', reject)\n server.listen(port, callbackHost, () => {\n server.removeListener('error', reject)\n const addr = server.address()\n resolve(typeof addr === 'object' && addr ? addr.port : port)\n })\n })\n\n let actualPort: number\n try {\n actualPort = await listen(callbackPort)\n }\n catch {\n actualPort = await listen(0)\n }\n\n return {\n redirectUri: `http://${callbackHost}:${actualPort}${CALLBACK_PATH}`,\n waitForCallback: timeoutMs => Promise.race([\n callbackPromise,\n new Promise<CallbackResult>(resolve =>\n setTimeout(\n resolve,\n timeoutMs,\n { error: 'timeout', errorDescription: 'Timed out waiting for the xAI OAuth callback.' },\n )),\n ]),\n close: () => {\n try { server.close() }\n catch { /* already closed */ }\n },\n }\n}\n\nfunction expiryFromPayload(payload: Record<string, unknown>): number {\n const expiresIn = typeof payload.expires_in === 'number'\n ? payload.expires_in\n : Number(payload.expires_in ?? 3600)\n return Date.now() + expiresIn * 1000 - REFRESH_SKEW_MS\n}\n\nasync function exchangeCode(\n tokenEndpoint: string,\n code: string,\n redirectUri: string,\n verifier: string,\n discovery: XaiDiscovery,\n): Promise<XaiOAuthCredentials> {\n const clientId = xaiOAuthClientId()\n const response = await fetch(tokenEndpoint, {\n method: 'POST',\n headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'Accept': 'application/json' },\n body: new URLSearchParams({\n grant_type: 'authorization_code',\n client_id: clientId,\n code,\n redirect_uri: redirectUri,\n code_verifier: verifier,\n }),\n signal: AbortSignal.timeout(30_000),\n })\n if (!response.ok)\n throw new Error(`xAI token exchange failed: ${response.status} ${await response.text().catch(() => '')}`)\n\n const payload = await response.json() as Record<string, unknown>\n const access = String(payload.access_token ?? '')\n const refresh = String(payload.refresh_token ?? '')\n if (!access)\n throw new Error('xAI token exchange did not return an access_token.')\n if (!refresh)\n throw new Error('xAI token exchange did not return a refresh_token.')\n\n return { access, refresh, expires: expiryFromPayload(payload), tokenEndpoint, discovery }\n}\n\nexport async function loginXai(\n renderPage: OAuthCallbackPageRenderer,\n callbacks: OAuthLoginCallbacks,\n): Promise<XaiOAuthCredentials> {\n const discovery = await discover()\n const { verifier, challenge } = await generatePkce()\n const state = randomToken()\n const nonce = randomToken()\n const server = await startXaiCallbackServer(renderPage)\n\n try {\n const authUrl = new URL(discovery.authorization_endpoint)\n authUrl.searchParams.set('response_type', 'code')\n authUrl.searchParams.set('client_id', xaiOAuthClientId())\n authUrl.searchParams.set('redirect_uri', server.redirectUri)\n authUrl.searchParams.set('scope', xaiOAuthScope())\n authUrl.searchParams.set('code_challenge', challenge)\n authUrl.searchParams.set('code_challenge_method', 'S256')\n authUrl.searchParams.set('state', state)\n authUrl.searchParams.set('nonce', nonce)\n // Opt into xAI's generic OAuth plan tier (SuperGrok / X Premium+).\n authUrl.searchParams.set('plan', 'generic')\n authUrl.searchParams.set('referrer', 'zidane')\n\n callbacks.onAuth({\n url: authUrl.toString(),\n instructions: `Sign in to xAI and approve access. If the browser is on another machine, the callback listener is ${server.redirectUri}.`,\n })\n\n const result = await server.waitForCallback(CALLBACK_TIMEOUT_MS)\n if (result.error)\n throw new Error(result.errorDescription ?? result.error)\n if (result.state !== state)\n throw new Error('xAI OAuth state mismatch — possible CSRF. Please retry.')\n if (!result.code)\n throw new Error('xAI OAuth callback did not include an authorization code.')\n\n callbacks.onProgress?.('Exchanging authorization code for tokens...')\n return await exchangeCode(discovery.token_endpoint, result.code, server.redirectUri, verifier, discovery)\n }\n finally {\n server.close()\n }\n}\n\nexport async function refreshXaiToken(credentials: OAuthCredentials): Promise<XaiOAuthCredentials> {\n const xai = credentials as XaiOAuthCredentials\n const clientId = xaiOAuthClientId()\n if (!credentials.refresh)\n throw new Error('xAI credentials are missing a refresh token — re-login required.')\n\n const tokenEndpoint = xai.tokenEndpoint\n ?? xai.discovery?.token_endpoint\n ?? (await discover()).token_endpoint\n validateEndpoint(tokenEndpoint, 'token_endpoint')\n\n const response = await fetch(tokenEndpoint, {\n method: 'POST',\n headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'Accept': 'application/json' },\n body: new URLSearchParams({\n grant_type: 'refresh_token',\n client_id: clientId,\n refresh_token: credentials.refresh,\n }),\n signal: AbortSignal.timeout(30_000),\n })\n if (!response.ok)\n throw new Error(`xAI token refresh failed: ${response.status} ${await response.text().catch(() => '')}`)\n\n const payload = await response.json() as Record<string, unknown>\n const access = String(payload.access_token ?? '')\n if (!access)\n throw new Error('xAI token refresh did not return an access_token.')\n\n return {\n ...xai,\n access,\n // xAI may omit a rotated refresh token — keep the existing one.\n refresh: String(payload.refresh_token ?? credentials.refresh),\n expires: expiryFromPayload(payload),\n tokenEndpoint,\n }\n}\n\n/**\n * Build an xAI `OAuthProviderInterface`. Shape matches Anthropic / Codex /\n * Cursor so it drops into `BUILTIN_PROVIDERS` and `src/auth.ts` unchanged.\n *\n * `usesCallbackServer: true` — the loopback flow has a real callback server,\n * so the TUI doesn't need to prompt for a manual code paste.\n */\nexport function createXaiOAuthProvider(renderPage: OAuthCallbackPageRenderer): OAuthProviderInterface {\n return {\n id: XAI_OAUTH_PROVIDER_ID,\n name: 'xAI Grok (SuperGrok / X Premium+)',\n usesCallbackServer: true,\n login: callbacks => loginXai(renderPage, callbacks),\n refreshToken: refreshXaiToken,\n getApiKey: credentials => credentials.access,\n }\n}\n"],"mappings":";;;;;;;;;;;;AAsCA,MAAa,wBAAwB;AAErC,MAAM,mBAAmB;AAEzB,MAAM,gBAAgB;;AAEtB,MAAM,oBAAoB;AAC1B,MAAM,gBAAgB;;AAEtB,MAAM,wBAAwB;AAC9B,MAAM,wBAAwB;AAC9B,MAAM,gBAAgB;AACtB,MAAM,gBAAgB;;AAEtB,MAAM,kBAAkB;AACxB,MAAM,sBAAsB;AAE5B,SAAS,mBAA2B;CAClC,OAAO,QAAQ,IAAI,0BAA0B;AAC/C;AAEA,SAAS,gBAAwB;CAC/B,OAAO,QAAQ,IAAI,sBAAsB;AAC3C;AAEA,SAAS,uBAA+B;CACtC,OAAO,QAAQ,IAAI,8BAA8B;AACnD;AAEA,SAAS,uBAA+B;CACtC,MAAM,SAAS,OAAO,SAAS,QAAQ,IAAI,8BAA8B,OAAO,qBAAqB,GAAG,EAAE;CAC1G,OAAO,OAAO,SAAS,MAAM,KAAK,SAAS,IAAI,SAAS;AAC1D;;AAGA,SAAgB,aAAqB;CACnC,QAAQ,QAAQ,IAAI,mBAAmB,QAAQ,IAAI,gBAAgB,iBAAA,CAChE,QAAQ,QAAQ,EAAE;AACvB;AAiBA,SAAS,UAAU,OAA2B;CAC5C,IAAI,SAAS;CACb,KAAK,MAAM,KAAK,OACd,UAAU,OAAO,aAAa,CAAC;C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re-attaches by handle id: its handle id IS the sandbox id, so a handle from a prior invocation routes operations to the same sandbox even though this instance never ran `spawn()`. Pair with the provider's reconnect option (`createDaytonaProvider({ sandboxId })`).
|
|
700
700
|
- **`createDaytonaProvider({ ownAttached: true })`** — by default an attached (`sandboxId`) sandbox is treated as externally owned and left running on `destroy()`. Set `ownAttached` when the *host* owns it across invocations so `destroy()` applies `onDestroy` (stop / archive / delete). Spawn-time failures still never delete a pre-existing attached sandbox.
|
|
701
701
|
- **`zidane/contexts/sandbox` subpath** — import `createSandboxContext` from here (not the `zidane/contexts` barrel) on workerd/edge: this entry's graph is node-free, so it doesn't drag `createProcessContext` → `node:child_process` into the bundle.
|
|
702
|
+
- **`@daytona/sdk` needs a root `tslib` override.** It is a peer dependency, so *you* install it — and it declares no `tslib` dependency of its own while reaching AWS SDK v3 through `@aws-sdk/client-s3`. A stale `@aws-crypto` v3/v4 floor (`tslib: ^1.11.1`) can win the hoist, and the AWS SDK's initializer helpers then resolve against tslib 1.x, which lacks them — `import('@daytona/sdk')` fails with `Export named '__runInitializers' not found`. npm/bun overrides are **root-only** and are not inherited from zidane, so add this to your own `package.json`:
|
|
703
|
+
|
|
704
|
+
```json
|
|
705
|
+
{ "overrides": { "tslib": "^2.8.1" } }
|
|
706
|
+
```
|
|
707
|
+
|
|
708
|
+
Safe because tslib 2 is a superset of the v1 helper set; the `^1.11.1` requirements are stale floors from packages AWS has since moved off. `createDaytonaProvider` reports the underlying load error (and names tslib) rather than claiming the package is missing.
|
|
702
709
|
|
|
703
710
|
### Streaming on fresh vs resumed invocations
|
|
704
711
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zidane",
|
|
3
|
-
"version": "6.5.
|
|
3
|
+
"version": "6.5.4",
|
|
4
4
|
"description": "an agent that goes straight to the goal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -267,15 +267,16 @@
|
|
|
267
267
|
"typecheck": "tsc --noEmit"
|
|
268
268
|
},
|
|
269
269
|
"dependencies": {
|
|
270
|
-
"@earendil-works/pi-ai": "0.
|
|
270
|
+
"@earendil-works/pi-ai": "0.84.2",
|
|
271
271
|
"chalk": "^5.6.2",
|
|
272
272
|
"fzf": "^0.5.2",
|
|
273
273
|
"hookable": "^6.1.1",
|
|
274
|
-
"marked": "18.0.
|
|
274
|
+
"marked": "18.0.9"
|
|
275
275
|
},
|
|
276
276
|
"overrides": {
|
|
277
|
-
"@types/react": "19.2.
|
|
278
|
-
"@types/react-dom": "19.2.3"
|
|
277
|
+
"@types/react": "19.2.18",
|
|
278
|
+
"@types/react-dom": "19.2.3",
|
|
279
|
+
"tslib": "^2.8.1"
|
|
279
280
|
},
|
|
280
281
|
"peerDependencies": {
|
|
281
282
|
"@anthropic-ai/bedrock-sdk": ">=0.32.0",
|
|
@@ -327,25 +328,25 @@
|
|
|
327
328
|
},
|
|
328
329
|
"devDependencies": {
|
|
329
330
|
"@antfu/eslint-config": "^8.2.0",
|
|
330
|
-
"@anthropic-ai/bedrock-sdk": "^0.32.
|
|
331
|
+
"@anthropic-ai/bedrock-sdk": "^0.32.4",
|
|
331
332
|
"@anthropic-ai/sdk": "^0.104.2",
|
|
332
333
|
"@daytona/sdk": "^0.187.0",
|
|
333
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
334
|
-
"@opentui/core": "^0.5.
|
|
335
|
-
"@opentui/core-darwin-x64": "^0.5.
|
|
336
|
-
"@opentui/core-linux-arm64": "^0.5.
|
|
337
|
-
"@opentui/core-linux-x64": "^0.5.
|
|
338
|
-
"@opentui/react": "^0.5.
|
|
339
|
-
"@restatedev/restate-sdk": "^1.
|
|
334
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
335
|
+
"@opentui/core": "^0.5.3",
|
|
336
|
+
"@opentui/core-darwin-x64": "^0.5.3",
|
|
337
|
+
"@opentui/core-linux-arm64": "^0.5.3",
|
|
338
|
+
"@opentui/core-linux-x64": "^0.5.3",
|
|
339
|
+
"@opentui/react": "^0.5.3",
|
|
340
|
+
"@restatedev/restate-sdk": "^1.16.5",
|
|
340
341
|
"@types/bun": "^1.3.13",
|
|
341
342
|
"@types/dockerode": "^4.0.1",
|
|
342
|
-
"@types/react": "19.2.
|
|
343
|
+
"@types/react": "19.2.18",
|
|
343
344
|
"bumpp": "^11.0.1",
|
|
344
345
|
"dockerode": "^5.0.0",
|
|
345
|
-
"e2b": "^2.
|
|
346
|
-
"eslint": "^10.
|
|
346
|
+
"e2b": "^2.39.0",
|
|
347
|
+
"eslint": "^10.8.1",
|
|
347
348
|
"jiti": "^2.6.1",
|
|
348
|
-
"react": "^19.2.
|
|
349
|
+
"react": "^19.2.8",
|
|
349
350
|
"tsdown": "^0.22.0",
|
|
350
351
|
"typescript": "~6.0.3",
|
|
351
352
|
"unrun": "^0.3.1"
|