zidane 6.5.7 → 6.5.8
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-Dm95NwNM.js → acp-EFzMJPxa.js} +3 -3
- package/dist/{acp-Dm95NwNM.js.map → acp-EFzMJPxa.js.map} +1 -1
- package/dist/acp-cli.js +4 -4
- package/dist/acp.d.ts +2 -2
- package/dist/acp.js +1 -1
- package/dist/{agent-CcTWL-Z6.js → agent-ut6nQRnI.js} +2 -2
- package/dist/{agent-CcTWL-Z6.js.map → agent-ut6nQRnI.js.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +1 -1
- package/dist/{auth-C-Zx5zBo.js → auth-yAckG81N.js} +2 -2
- package/dist/{auth-C-Zx5zBo.js.map → auth-yAckG81N.js.map} +1 -1
- package/dist/chat/pure.d.ts +3 -3
- package/dist/chat.d.ts +4 -4
- package/dist/chat.js +3 -3
- package/dist/contexts/daytona.d.ts +14 -6
- package/dist/contexts/daytona.d.ts.map +1 -1
- package/dist/contexts/daytona.js +4 -9
- package/dist/contexts/daytona.js.map +1 -1
- package/dist/contexts/docker.d.ts +10 -2
- package/dist/contexts/docker.d.ts.map +1 -1
- package/dist/contexts/docker.js +44 -6
- package/dist/contexts/docker.js.map +1 -1
- package/dist/contexts/e2b.d.ts +10 -3
- package/dist/contexts/e2b.d.ts.map +1 -1
- package/dist/contexts/e2b.js +4 -2
- package/dist/contexts/e2b.js.map +1 -1
- package/dist/contexts/sandbox.d.ts +1 -1
- package/dist/contexts/sandbox.js +2 -2
- package/dist/contexts/sandbox.js.map +1 -1
- package/dist/{contexts-DWVt7MvF.js → contexts-BSFQVclW.js} +4 -3
- package/dist/contexts-BSFQVclW.js.map +1 -0
- package/dist/contexts.d.ts +3 -3
- package/dist/contexts.js +1 -1
- package/dist/eval.d.ts +1 -1
- package/dist/eval.js +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 +2 -2
- package/dist/{index-ZWibV230.d.ts → index-A1qz0l55.d.ts} +2 -2
- package/dist/{index-ZWibV230.d.ts.map → index-A1qz0l55.d.ts.map} +1 -1
- package/dist/{index-C8TwH34B.d.ts → index-B6FkK6ZN.d.ts} +2 -2
- package/dist/index-B6FkK6ZN.d.ts.map +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/mcp.d.ts +1 -1
- package/dist/output/stream-json.d.ts +1 -1
- package/dist/output/terminal.d.ts +1 -1
- 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/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/openrouter.d.ts +1 -1
- package/dist/providers/xai.d.ts +1 -1
- package/dist/providers.d.ts +1 -1
- package/dist/restate.d.ts +2 -2
- package/dist/restate.js +1 -1
- package/dist/{sandbox-DLY6uah7.d.ts → sandbox-CDl9tfTo.d.ts} +4 -3
- package/dist/sandbox-CDl9tfTo.d.ts.map +1 -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/{tool-formatters-D3wSS2zz.d.ts → tool-formatters-OobhXAK1.d.ts} +2 -2
- package/dist/{tool-formatters-D3wSS2zz.d.ts.map → tool-formatters-OobhXAK1.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-llwMrLRG.d.ts → transcript-anchors-0midxNxf.d.ts} +2 -2
- package/dist/{transcript-anchors-llwMrLRG.d.ts.map → transcript-anchors-0midxNxf.d.ts.map} +1 -1
- package/dist/{transcript-anchors-DGUqw92H.js → transcript-anchors-BYmStvQP.js} +3 -3
- package/dist/{transcript-anchors-DGUqw92H.js.map → transcript-anchors-BYmStvQP.js.map} +1 -1
- package/dist/tui.d.ts +3 -3
- package/dist/tui.js +4 -4
- package/dist/{turn-operations-C_XvfBU3.d.ts → turn-operations-JtKQfSFC.d.ts} +3 -3
- package/dist/{turn-operations-C_XvfBU3.d.ts.map → turn-operations-JtKQfSFC.d.ts.map} +1 -1
- package/dist/{types-M2DauK2D.d.ts → types-U-rIVUDw.d.ts} +11 -11
- package/dist/types-U-rIVUDw.d.ts.map +1 -0
- package/dist/types.d.ts +3 -3
- package/docs/EXECUTION_CONTEXT.md +5 -2
- package/package.json +7 -1
- package/dist/contexts-DWVt7MvF.js.map +0 -1
- package/dist/index-C8TwH34B.d.ts.map +0 -1
- package/dist/sandbox-DLY6uah7.d.ts.map +0 -1
- package/dist/types-M2DauK2D.d.ts.map +0 -1
package/dist/chat/pure.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Af as buildContextBreakdown, Al as CompletionReference, Bl as CommandArgSuggestion, Cf as ContextExactCounts, Df as ContextMcpGroup, Dl as CompletionContext, Ef as ContextItem, El as ActiveTrigger, Fl as mergeReferences, Il as mergeSuggestions, Ml as applyInsert, Nl as collectReferences, Of as ContextSnapshot, Ol as CompletionItem, Pl as findActiveTrigger, Rl as Command, Sf as ContextCategoryId, Tf as ContextExtensionSection, _f as ContextBreakdown, bf as ContextBreakdownOptions, ff as ContextSegment, gf as buildContextSegments, hf as ContextSegmentsInput, kf as ContextUsageSplit, kl as CompletionProvider, mf as ContextSegmentOrigin, pf as ContextSegmentFile, vf as ContextBreakdownContributionContext, wf as ContextExtensionRow, xf as ContextCategory, yf as ContextBreakdownContributor } from "../index-
|
|
2
|
-
import { $ as uniqueFilesFromReferences, A as buildUnifiedDiff, C as EditSummary, D as PreviewResult, E as InlineSegment, F as previewEditPayload, I as splitLines, J as SKILLS_TRIGGER, L as summarizeEditPayload, M as computeLineDiff, N as extractEditPayload, O as applyEditPayload, P as filetypeFromPath, Q as createFilesCompletionProvider, R as tokenize, S as EditHunkSummary, T as InlineDiff, X as uniqueSkillNamesFromReferences, Y as createSkillsCompletionProvider, Z as FILES_TRIGGER, _ as formatTaskSummary, a as MAX_TRANSCRIPT_EVENTS, at as CHATS_TRIGGER, b as DiffLine, c as finalizeStreamingMarkdown, ct as ChatReferenceScope, d as ageString, dt as uniqueChatIdsFromReferences, f as compactPath, ft as blendHsl, g as formatTaskStatus, h as formatDuration, i as turnAsText, it as createCommandsCompletionProvider, j as computeInlineDiff, k as buildContextualDiff, l as finalizeStreamingMarkdownForOwner, lt as chatReferenceTokensFromText, m as fmtTokens, n as deleteTurnSafely, o as TRANSCRIPT_TRIM_TO_EVENTS, ot as ChatReferenceData, p as fmtCost, pt as buildLinearRamp, q as summarizeOutcomes, r as truncateTurnsAt, rt as COMMANDS_TRIGGER, s as capTranscriptEvents, st as ChatReferenceEntry, t as countNeighbors, u as turnContextSize, ut as createChatsCompletionProvider, v as previewLine, w as HunkResolution, x as DiffOp, y as shortId } from "../turn-operations-
|
|
3
|
-
import { $ as retagUserPromptEvents, A as highlightSegments, C as SearchTurnResult, D as buildSessionSearchIndex, E as SessionSearchIndex, F as searchSessionIndex, I as searchSessionIndexAsync, J as EDIT_TOOL_NAMES, L as searchSessionTurns, M as searchSessionHistory, N as searchSessionHistoryIndex, O as buildSessionSearchIndexAsync, P as searchSessionHistoryIndexAsync, Q as isVisible, R as searchTurns, S as SearchSessionResult, T as SessionSearchExcerpt, X as isTurnHighlighted, Y as isEditErrorResult, Z as isUserBashEvent, _ as splitMarkdownCodeBlocks, a as formatToolCall, b as IndexedSearchTurn, c as splitPromptSegments, d as filterModelCatalog, et as selectableTurnIds, f as indexOfEntry, g as normalizeMarkdownCodeFences, h as chunkMarkdownForRender, i as displayNameFor, j as searchHighlightRanges, k as filterSessionSearchCatalog, l as CatalogEntry, m as MarkdownSegment, n as ToolDisplayMeta, nt as turnSelectionOwnership, o as PromptSegment, p as MARKDOWN_RENDER_CHUNK_TARGET_BYTES, q as BASH_CALL_ID_PREFIX, r as ToolFormatLine, s as PromptSegmentRef, t as TOOL_DISPLAY, u as buildModelCatalog, v as HighlightRange, w as SessionHistoryMatch, x as SearchExcerpt, y as HighlightSegment, z as searchableTurnText } from "../tool-formatters-
|
|
1
|
+
import { Af as buildContextBreakdown, Al as CompletionReference, Bl as CommandArgSuggestion, Cf as ContextExactCounts, Df as ContextMcpGroup, Dl as CompletionContext, Ef as ContextItem, El as ActiveTrigger, Fl as mergeReferences, Il as mergeSuggestions, Ml as applyInsert, Nl as collectReferences, Of as ContextSnapshot, Ol as CompletionItem, Pl as findActiveTrigger, Rl as Command, Sf as ContextCategoryId, Tf as ContextExtensionSection, _f as ContextBreakdown, bf as ContextBreakdownOptions, ff as ContextSegment, gf as buildContextSegments, hf as ContextSegmentsInput, kf as ContextUsageSplit, kl as CompletionProvider, mf as ContextSegmentOrigin, pf as ContextSegmentFile, vf as ContextBreakdownContributionContext, wf as ContextExtensionRow, xf as ContextCategory, yf as ContextBreakdownContributor } from "../index-A1qz0l55.js";
|
|
2
|
+
import { $ as uniqueFilesFromReferences, A as buildUnifiedDiff, C as EditSummary, D as PreviewResult, E as InlineSegment, F as previewEditPayload, I as splitLines, J as SKILLS_TRIGGER, L as summarizeEditPayload, M as computeLineDiff, N as extractEditPayload, O as applyEditPayload, P as filetypeFromPath, Q as createFilesCompletionProvider, R as tokenize, S as EditHunkSummary, T as InlineDiff, X as uniqueSkillNamesFromReferences, Y as createSkillsCompletionProvider, Z as FILES_TRIGGER, _ as formatTaskSummary, a as MAX_TRANSCRIPT_EVENTS, at as CHATS_TRIGGER, b as DiffLine, c as finalizeStreamingMarkdown, ct as ChatReferenceScope, d as ageString, dt as uniqueChatIdsFromReferences, f as compactPath, ft as blendHsl, g as formatTaskStatus, h as formatDuration, i as turnAsText, it as createCommandsCompletionProvider, j as computeInlineDiff, k as buildContextualDiff, l as finalizeStreamingMarkdownForOwner, lt as chatReferenceTokensFromText, m as fmtTokens, n as deleteTurnSafely, o as TRANSCRIPT_TRIM_TO_EVENTS, ot as ChatReferenceData, p as fmtCost, pt as buildLinearRamp, q as summarizeOutcomes, r as truncateTurnsAt, rt as COMMANDS_TRIGGER, s as capTranscriptEvents, st as ChatReferenceEntry, t as countNeighbors, u as turnContextSize, ut as createChatsCompletionProvider, v as previewLine, w as HunkResolution, x as DiffOp, y as shortId } from "../turn-operations-JtKQfSFC.js";
|
|
3
|
+
import { $ as retagUserPromptEvents, A as highlightSegments, C as SearchTurnResult, D as buildSessionSearchIndex, E as SessionSearchIndex, F as searchSessionIndex, I as searchSessionIndexAsync, J as EDIT_TOOL_NAMES, L as searchSessionTurns, M as searchSessionHistory, N as searchSessionHistoryIndex, O as buildSessionSearchIndexAsync, P as searchSessionHistoryIndexAsync, Q as isVisible, R as searchTurns, S as SearchSessionResult, T as SessionSearchExcerpt, X as isTurnHighlighted, Y as isEditErrorResult, Z as isUserBashEvent, _ as splitMarkdownCodeBlocks, a as formatToolCall, b as IndexedSearchTurn, c as splitPromptSegments, d as filterModelCatalog, et as selectableTurnIds, f as indexOfEntry, g as normalizeMarkdownCodeFences, h as chunkMarkdownForRender, i as displayNameFor, j as searchHighlightRanges, k as filterSessionSearchCatalog, l as CatalogEntry, m as MarkdownSegment, n as ToolDisplayMeta, nt as turnSelectionOwnership, o as PromptSegment, p as MARKDOWN_RENDER_CHUNK_TARGET_BYTES, q as BASH_CALL_ID_PREFIX, r as ToolFormatLine, s as PromptSegmentRef, t as TOOL_DISPLAY, u as buildModelCatalog, v as HighlightRange, w as SessionHistoryMatch, x as SearchExcerpt, y as HighlightSegment, z as searchableTurnText } from "../tool-formatters-OobhXAK1.js";
|
|
4
4
|
export { type ActiveTrigger, BASH_CALL_ID_PREFIX, CHATS_TRIGGER, COMMANDS_TRIGGER, type CatalogEntry, type ChatReferenceData, type ChatReferenceEntry, type ChatReferenceScope, type Command, type CommandArgSuggestion, type CompletionContext, type CompletionItem, type CompletionProvider, type CompletionReference, type ContextBreakdown, type ContextBreakdownContributionContext, type ContextBreakdownContributor, type ContextBreakdownOptions, type ContextCategory, type ContextCategoryId, type ContextExactCounts, type ContextExtensionRow, type ContextExtensionSection, type ContextItem, type ContextMcpGroup, type ContextSegment, type ContextSegmentFile, type ContextSegmentOrigin, type ContextSegmentsInput, type ContextSnapshot, type ContextUsageSplit, type DiffLine, type DiffOp, EDIT_TOOL_NAMES, type EditHunkSummary, type EditSummary, FILES_TRIGGER, type HighlightRange, type HighlightSegment, type HunkResolution, type IndexedSearchTurn, type InlineDiff, type InlineSegment, MARKDOWN_RENDER_CHUNK_TARGET_BYTES, MAX_TRANSCRIPT_EVENTS, type MarkdownSegment, type PreviewResult, type PromptSegment, type PromptSegmentRef, SKILLS_TRIGGER, type SearchExcerpt, type SearchSessionResult, type SearchTurnResult, type SessionHistoryMatch, type SessionSearchExcerpt, type SessionSearchIndex, TOOL_DISPLAY, TRANSCRIPT_TRIM_TO_EVENTS, type ToolDisplayMeta, type ToolFormatLine, ageString, applyEditPayload, applyInsert, blendHsl, buildContextBreakdown, buildContextSegments, buildContextualDiff, buildLinearRamp, buildModelCatalog, buildSessionSearchIndex, buildSessionSearchIndexAsync, buildUnifiedDiff, capTranscriptEvents, chatReferenceTokensFromText, chunkMarkdownForRender, collectReferences, compactPath, computeInlineDiff, computeLineDiff, countNeighbors, createChatsCompletionProvider, createCommandsCompletionProvider, createFilesCompletionProvider, createSkillsCompletionProvider, deleteTurnSafely, displayNameFor, extractEditPayload, filetypeFromPath, filterModelCatalog, filterSessionSearchCatalog, finalizeStreamingMarkdown, finalizeStreamingMarkdownForOwner, findActiveTrigger, fmtCost, fmtTokens, formatDuration, formatTaskStatus, formatTaskSummary, formatToolCall, highlightSegments, indexOfEntry, isEditErrorResult, isTurnHighlighted, isUserBashEvent, isVisible, mergeReferences, mergeSuggestions, normalizeMarkdownCodeFences, previewEditPayload, previewLine, retagUserPromptEvents, searchHighlightRanges, searchSessionHistory, searchSessionHistoryIndex, searchSessionHistoryIndexAsync, searchSessionIndex, searchSessionIndexAsync, searchSessionTurns, searchTurns, searchableTurnText, selectableTurnIds, shortId, splitLines, splitMarkdownCodeBlocks, splitPromptSegments, summarizeEditPayload, summarizeOutcomes, tokenize, truncateTurnsAt, turnAsText, turnContextSize, turnSelectionOwnership, uniqueChatIdsFromReferences, uniqueFilesFromReferences, uniqueSkillNamesFromReferences };
|
package/dist/chat.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { $d as modelOptionsFor, $o as ExtensionToolResultMetadataRegistration, Aa as discoverExtensions, Ad as chainPositionOf, Af as buildContextBreakdown, Al as CompletionReference, Ao as ExtensionManifest, Au as createAutomaticInteractionResponse, B as McpCredentialStore, Ba as defineExtension, Bd as detectAuth, Bo as ExtensionRunTransform, Cd as Screen, Cf as ContextExactCounts, Cg as SessionStore, Cl as tokenEndingAtCursor, Cu as QuestionPayload, Dd as ToolCallDisplay, Df as ContextMcpGroup, Dl as CompletionContext, Du as SelectQuestion, Ed as StreamEvent, Ef as ContextItem, El as ActiveTrigger, Eo as ExtensionGuiPanel, Eu as QuestionType, Fd as sanitizeModelChain, Fl as mergeReferences, Fo as ExtensionPaths, Fu as pendingInteractionsFromTurns, Gd as ProviderDescriptor, Gh as ToolDef, Gi as AgentHookMap, Gl as CommandInvocation, Go as ExtensionStorageScope, Hd as CustomField, Hl as CommandExecution, Ho as ExtensionSessionStateSurface, Id as toggleChainEntry, Il as mergeSuggestions, Io as ExtensionPermission, Iu as serializeInteractionResponse, Jd as credKeyOf, Kd as anthropicDescriptor, Ki as AgentHooks, Kl as CommandOutputBlock, Ko as ExtensionStorageSurface, Ld as AuthMethod, Li as GenerateStructuredDataOptions, Lm as AutoCompact, Lu as useInteractionsActions, Md as filterChainFallbacks, Ml as applyInsert, Mo as ExtensionModal, Mu as isInteractionTool, Nd as providerKeySetChanged, Nl as collectReferences, Nu as isModelInteraction, Od as ModelChainEntry, Of as ContextSnapshot, Ol as CompletionItem, Oo as ExtensionKeybinding, Ou as TextQuestion, Pa as scanExtensionDirectories, Pd as restoreChainFallbacks, Pl as findActiveTrigger, Po as ExtensionOrderedContribution, Pu as makeRequestInteraction, Qd as localDescriptor, Qi as BuildExtensionRegistryOptions, Qm as McpToolSchema, Rd as ProviderAuth, Ri as generateStructuredData, Rl as Command, Ro as ExtensionProviderMiddleware, Ru as useInteractionsQueue, Sd as Picked, Sf as ContextCategoryId, Sl as resolveInlineSuggestion, Su as QuestionChoice, Td as Settings, Tf as ContextExtensionSection, Tl as useCompletion, To as ExtensionFooterHint, Tu as QuestionResponse, Ud as ModelInfo, Uf as Provider, Uo as ExtensionSkillPolicy, Vd as BUILTIN_PROVIDERS, Vo as ExtensionRuntimeEnv, Wd as ModelOption, Wo as ExtensionSource, Xd as getContextWindow, Xl as CommandStepContext, Xm as McpServerConfig, Yd as enabledModelOptions, Yl as CommandStep, Zd as getModelInfo, Zl as CommandStepFn, _d as EditOutcome, _f as ContextBreakdown, _l as InlineAutocompleteContext, _o as ExtensionBehaviorTransform, _u as PlanPayload, ad as AgentRegistry, af as restoreModelOptions, al as BUILTIN_THEMES, as as LoadedExtension, au as AnswerValue, bd as InteractionMode, bf as ContextBreakdownOptions, bh as SessionTurn, bl as createPathAutocompleteProvider, bu as PlanStep, cd as DEFAULT_AGENT_ID, cf as AutoCompactInput, cl as DEFAULT_THEME, cu as HOST_INTERACTION_ID_PREFIX, dd as PLAN_AGENT, df as shouldAutoCompact, dl as Theme, du as InteractionResponse, ea as buildExtensionPreset, ef as modelSupportsReasoning, el as ResolveStorageDirsOptions, eu as commandSteps, fd as accentColor, ff as ContextSegment, fg as SkillConfig, fl as ThemeColors, fu as InteractionsActions, gd as EditHunk, gf as buildContextSegments, gg as SkillsConfig, gl as resolveTheme, go as ExtensionApiVersion, gu as PlanDecision, hd as EditDiffDisplay, hf as ContextSegmentsInput, hl as resolveChipColor, hu as PendingInteractionEntry, ia as filterExtensionRegistry, id as AgentProfile, if as piIdOf, il as resolveStorageDirs, is as GuiContributions, iu as AUTOMATIC_INTERACTION_INSTRUCTION, ja as inlineLoadedExtension, jd as chainsEqual, jo as ExtensionMcpConfigTransform, ju as createInteractionTools, ka as defaultExtensionScanPaths, kd as buildRunModel, kf as ContextUsageSplit, kl as CompletionProvider, ko as ExtensionKeybindingDispatchContext, ku as buildResumedToolResultsTurn, ld as DEFAULT_BUDGET_EXCLUDE_TOOLS, lf as OUTPUT_RESERVE_TOKENS, ll as SyntaxStyles, lu as InteractionOrigin, md as singleAgentRegistry, mf as ContextSegmentOrigin, ml as ThemeSurfaces, mo as EMPTY_EXTENSION_REGISTRY, mu as PRESENT_PLAN_TOOL, na as composeExtensionPreset, nf as openaiDescriptor, nl as StorageMode, nu as parseCommandInvocation, oa as mergeContributions, od as BUILD_AGENT, of as AUTO_COMPACT_MIN_GROWTH_FRACTION, ol as ChipColor, ou as ConfirmQuestion, pd as resolveAgentId, pf as ContextSegmentFile, pl as ThemeSelect, pu as InteractionsProvider, qd as cerebrasDescriptor, qo as ExtensionToolCatalogTransform, ra as disposeExtensionRegistry, rd as AgentAccent, rf as openrouterDescriptor, rl as StorageSlot, ru as ASK_USER_TOOL, sa as partitionExtensionCatalog, sd as BUILTIN_AGENTS, sf as AutoCompactDecision, sl as ChipColorMap, ss as TuiContributions, su as CreateInteractionToolsOptions, t as Preset, ta as buildExtensionRegistry, tf as modelsForDescriptor, tl as StorageDirs, tu as executeCommand, ud as DEFAULT_PERSIST_EXCLUDE_TOOLS, uf as effectiveContextWindow, ul as SyntaxTokenStyle, uu as InteractionRequest, vd as EditOutcomeKind, vf as ContextBreakdownContributionContext, vl as InlineAutocompleteProvider, vo as ExtensionCapability, vu as PlanRequest, wd as SessionMeta, wf as ContextExtensionRow, wl as CompletionState, wo as ExtensionDefinition, wu as QuestionRequest, xd as Owner, xf as ContextCategory, xl as patchInlineGhost, xo as ExtensionContributions, xu as Question, yd as EditPayload, yf as ContextBreakdownContributor, yg as Session, yl as InlineGhost, yo as ExtensionContext, yu as PlanResponse, z as McpCredentialEntry, zc as SourcedScanPath, zd as ProviderKey, zl as CommandAgentResult, zo as ExtensionRegistry } from "./index-
|
|
2
|
-
import { $ as KeyAction, A as ModelUsageSummary, B as marginTopFor, C as AutoUpdateConfig, D as ResolvedPaths, E as ResolvedConfig, F as deriveSessionTitle, G as toolCallPreview, H as stripSpawnTokensLine, I as eventsFromTurns, J as usageByModel, K as toolResultText, L as lastContextSizeFromTurns, M as TuiState, N as compactSummaryEvent, O as resolveConfig, P as createStateStore, Q as KEYBINDING_KEY_COL_WIDTH, R as listSessionMeta, S as parseMcpsFile, T as ProviderRegistry, U as sumRunCosts, V as saveState, W as titleFromTurns, X as KEYBINDING_DEFS, Y as DEFAULT_KEYBINDINGS, Z as KEYBINDING_DEF_BY_ACTION, _ as DiscoveryResult, _t as Hint, a as SessionExportTarget, at as ensureKeybindingsFile, b as defaultMcpsConfigPaths, bt as truncateTrailing, c as writeSessionExport, ct as keybindingsPath, d as useEnabledToggleSet, dt as parseBindingSpec, et as KeyBindingDef, f as DiscoveredPlugin, ft as readKeybindings, g as DiscoveryError, gt as EMPTY_HINTS, h as DiscoveredMcp, ht as stripJsonComments, i as SessionExportFormat, it as ResolvedExtensionKeybinding, j as StateStoreApi, k as resolveStoragePaths, l as EnabledAllowlistKey, lt as matchesBinding, m as projectUserPaths, mt as resolveExtensionKeybindings, n as computeTurnAnchors, nt as KeyBindings, o as renderSession, ot as formatBindingForDisplay, p as ProjectUserPath, pt as readKeybindingsRaw, q as updateToolEventOutcomes, r as SessionExportAnchor, rt as ParsedBinding, s as resolveSessionExportTarget, st as groupBindings, t as TranscriptItem, tt as KeyBindingSection, u as EnabledToggleSet, ut as mergeKeybindings, v as buildMcpServers, vt as clipHintsToWidth, w as ChatOptions, x as discoverProjectMcps, y as dedupMcpServersByName, yt as hintsLength, z as loadState } from "./transcript-anchors-
|
|
3
|
-
import { $ as uniqueFilesFromReferences, A as buildUnifiedDiff, B as buildEditOutcomesAnnotation, C as EditSummary, D as PreviewResult, E as InlineSegment, F as previewEditPayload, G as rewriteMultiEditHeader, H as mergeApprovalAndBodyOutcomes, I as splitLines, J as SKILLS_TRIGGER, K as stripEditOutcomesAnnotation, L as summarizeEditPayload, M as computeLineDiff, N as extractEditPayload, O as applyEditPayload, P as filetypeFromPath, Q as createFilesCompletionProvider, R as tokenize, S as EditHunkSummary, T as InlineDiff, U as parseEditOutcomesFromResult, V as maskToOutcomeKinds, W as resolveApprovalForPayload, X as uniqueSkillNamesFromReferences, Y as createSkillsCompletionProvider, Z as FILES_TRIGGER, _ as formatTaskSummary, a as MAX_TRANSCRIPT_EVENTS, at as CHATS_TRIGGER, b as DiffLine, c as finalizeStreamingMarkdown, ct as ChatReferenceScope, d as ageString, dt as uniqueChatIdsFromReferences, et as FileEntry, f as compactPath, ft as blendHsl, g as formatTaskStatus, h as formatDuration, i as turnAsText, it as createCommandsCompletionProvider, j as computeInlineDiff, k as buildContextualDiff, l as finalizeStreamingMarkdownForOwner, lt as chatReferenceTokensFromText, m as fmtTokens, n as deleteTurnSafely, nt as listProjectFiles, o as TRANSCRIPT_TRIM_TO_EVENTS, ot as ChatReferenceData, p as fmtCost, pt as buildLinearRamp, q as summarizeOutcomes, r as truncateTurnsAt, rt as COMMANDS_TRIGGER, s as capTranscriptEvents, st as ChatReferenceEntry, t as countNeighbors, tt as ListProjectFilesOptions, u as turnContextSize, ut as createChatsCompletionProvider, v as previewLine, w as HunkResolution, x as DiffOp, y as shortId, z as ResolvedApproval } from "./turn-operations-
|
|
4
|
-
import { A as highlightSegments, B as ApprovalDecision, C as SearchTurnResult, D as buildSessionSearchIndex, E as SessionSearchIndex, F as searchSessionIndex, G as useSafeModeActions, H as RequestApproval, I as searchSessionIndexAsync, K as useSafeModeQueue, L as searchSessionTurns, M as searchSessionHistory, N as searchSessionHistoryIndex, O as buildSessionSearchIndexAsync, P as searchSessionHistoryIndexAsync, Q as isVisible, R as searchTurns, S as SearchSessionResult, T as SessionSearchExcerpt, U as SafeModeActions, V as ApprovalRequest, W as SafeModeProvider, X as isTurnHighlighted, Y as isEditErrorResult, _ as splitMarkdownCodeBlocks, a as formatToolCall, b as IndexedSearchTurn, c as splitPromptSegments, d as filterModelCatalog, et as selectableTurnIds, f as indexOfEntry, g as normalizeMarkdownCodeFences, h as chunkMarkdownForRender, i as displayNameFor, j as searchHighlightRanges, k as filterSessionSearchCatalog, l as CatalogEntry, m as MarkdownSegment, n as ToolDisplayMeta, nt as turnSelectionOwnership, o as PromptSegment, p as MARKDOWN_RENDER_CHUNK_TARGET_BYTES, r as ToolFormatLine, s as PromptSegmentRef, t as TOOL_DISPLAY, tt as selectionAfterTurnRemoval, u as buildModelCatalog, v as HighlightRange, w as SessionHistoryMatch, x as SearchExcerpt, y as HighlightSegment, z as searchableTurnText } from "./tool-formatters-
|
|
1
|
+
import { $d as modelOptionsFor, $o as ExtensionToolResultMetadataRegistration, Aa as discoverExtensions, Ad as chainPositionOf, Af as buildContextBreakdown, Al as CompletionReference, Ao as ExtensionManifest, Au as createAutomaticInteractionResponse, B as McpCredentialStore, Ba as defineExtension, Bd as detectAuth, Bo as ExtensionRunTransform, Cd as Screen, Cf as ContextExactCounts, Cg as SessionStore, Cl as tokenEndingAtCursor, Cu as QuestionPayload, Dd as ToolCallDisplay, Df as ContextMcpGroup, Dl as CompletionContext, Du as SelectQuestion, Ed as StreamEvent, Ef as ContextItem, El as ActiveTrigger, Eo as ExtensionGuiPanel, Eu as QuestionType, Fd as sanitizeModelChain, Fl as mergeReferences, Fo as ExtensionPaths, Fu as pendingInteractionsFromTurns, Gd as ProviderDescriptor, Gh as ToolDef, Gi as AgentHookMap, Gl as CommandInvocation, Go as ExtensionStorageScope, Hd as CustomField, Hl as CommandExecution, Ho as ExtensionSessionStateSurface, Id as toggleChainEntry, Il as mergeSuggestions, Io as ExtensionPermission, Iu as serializeInteractionResponse, Jd as credKeyOf, Kd as anthropicDescriptor, Ki as AgentHooks, Kl as CommandOutputBlock, Ko as ExtensionStorageSurface, Ld as AuthMethod, Li as GenerateStructuredDataOptions, Lm as AutoCompact, Lu as useInteractionsActions, Md as filterChainFallbacks, Ml as applyInsert, Mo as ExtensionModal, Mu as isInteractionTool, Nd as providerKeySetChanged, Nl as collectReferences, Nu as isModelInteraction, Od as ModelChainEntry, Of as ContextSnapshot, Ol as CompletionItem, Oo as ExtensionKeybinding, Ou as TextQuestion, Pa as scanExtensionDirectories, Pd as restoreChainFallbacks, Pl as findActiveTrigger, Po as ExtensionOrderedContribution, Pu as makeRequestInteraction, Qd as localDescriptor, Qi as BuildExtensionRegistryOptions, Qm as McpToolSchema, Rd as ProviderAuth, Ri as generateStructuredData, Rl as Command, Ro as ExtensionProviderMiddleware, Ru as useInteractionsQueue, Sd as Picked, Sf as ContextCategoryId, Sl as resolveInlineSuggestion, Su as QuestionChoice, Td as Settings, Tf as ContextExtensionSection, Tl as useCompletion, To as ExtensionFooterHint, Tu as QuestionResponse, Ud as ModelInfo, Uf as Provider, Uo as ExtensionSkillPolicy, Vd as BUILTIN_PROVIDERS, Vo as ExtensionRuntimeEnv, Wd as ModelOption, Wo as ExtensionSource, Xd as getContextWindow, Xl as CommandStepContext, Xm as McpServerConfig, Yd as enabledModelOptions, Yl as CommandStep, Zd as getModelInfo, Zl as CommandStepFn, _d as EditOutcome, _f as ContextBreakdown, _l as InlineAutocompleteContext, _o as ExtensionBehaviorTransform, _u as PlanPayload, ad as AgentRegistry, af as restoreModelOptions, al as BUILTIN_THEMES, as as LoadedExtension, au as AnswerValue, bd as InteractionMode, bf as ContextBreakdownOptions, bh as SessionTurn, bl as createPathAutocompleteProvider, bu as PlanStep, cd as DEFAULT_AGENT_ID, cf as AutoCompactInput, cl as DEFAULT_THEME, cu as HOST_INTERACTION_ID_PREFIX, dd as PLAN_AGENT, df as shouldAutoCompact, dl as Theme, du as InteractionResponse, ea as buildExtensionPreset, ef as modelSupportsReasoning, el as ResolveStorageDirsOptions, eu as commandSteps, fd as accentColor, ff as ContextSegment, fg as SkillConfig, fl as ThemeColors, fu as InteractionsActions, gd as EditHunk, gf as buildContextSegments, gg as SkillsConfig, gl as resolveTheme, go as ExtensionApiVersion, gu as PlanDecision, hd as EditDiffDisplay, hf as ContextSegmentsInput, hl as resolveChipColor, hu as PendingInteractionEntry, ia as filterExtensionRegistry, id as AgentProfile, if as piIdOf, il as resolveStorageDirs, is as GuiContributions, iu as AUTOMATIC_INTERACTION_INSTRUCTION, ja as inlineLoadedExtension, jd as chainsEqual, jo as ExtensionMcpConfigTransform, ju as createInteractionTools, ka as defaultExtensionScanPaths, kd as buildRunModel, kf as ContextUsageSplit, kl as CompletionProvider, ko as ExtensionKeybindingDispatchContext, ku as buildResumedToolResultsTurn, ld as DEFAULT_BUDGET_EXCLUDE_TOOLS, lf as OUTPUT_RESERVE_TOKENS, ll as SyntaxStyles, lu as InteractionOrigin, md as singleAgentRegistry, mf as ContextSegmentOrigin, ml as ThemeSurfaces, mo as EMPTY_EXTENSION_REGISTRY, mu as PRESENT_PLAN_TOOL, na as composeExtensionPreset, nf as openaiDescriptor, nl as StorageMode, nu as parseCommandInvocation, oa as mergeContributions, od as BUILD_AGENT, of as AUTO_COMPACT_MIN_GROWTH_FRACTION, ol as ChipColor, ou as ConfirmQuestion, pd as resolveAgentId, pf as ContextSegmentFile, pl as ThemeSelect, pu as InteractionsProvider, qd as cerebrasDescriptor, qo as ExtensionToolCatalogTransform, ra as disposeExtensionRegistry, rd as AgentAccent, rf as openrouterDescriptor, rl as StorageSlot, ru as ASK_USER_TOOL, sa as partitionExtensionCatalog, sd as BUILTIN_AGENTS, sf as AutoCompactDecision, sl as ChipColorMap, ss as TuiContributions, su as CreateInteractionToolsOptions, t as Preset, ta as buildExtensionRegistry, tf as modelsForDescriptor, tl as StorageDirs, tu as executeCommand, ud as DEFAULT_PERSIST_EXCLUDE_TOOLS, uf as effectiveContextWindow, ul as SyntaxTokenStyle, uu as InteractionRequest, vd as EditOutcomeKind, vf as ContextBreakdownContributionContext, vl as InlineAutocompleteProvider, vo as ExtensionCapability, vu as PlanRequest, wd as SessionMeta, wf as ContextExtensionRow, wl as CompletionState, wo as ExtensionDefinition, wu as QuestionRequest, xd as Owner, xf as ContextCategory, xl as patchInlineGhost, xo as ExtensionContributions, xu as Question, yd as EditPayload, yf as ContextBreakdownContributor, yg as Session, yl as InlineGhost, yo as ExtensionContext, yu as PlanResponse, z as McpCredentialEntry, zc as SourcedScanPath, zd as ProviderKey, zl as CommandAgentResult, zo as ExtensionRegistry } from "./index-A1qz0l55.js";
|
|
2
|
+
import { $ as KeyAction, A as ModelUsageSummary, B as marginTopFor, C as AutoUpdateConfig, D as ResolvedPaths, E as ResolvedConfig, F as deriveSessionTitle, G as toolCallPreview, H as stripSpawnTokensLine, I as eventsFromTurns, J as usageByModel, K as toolResultText, L as lastContextSizeFromTurns, M as TuiState, N as compactSummaryEvent, O as resolveConfig, P as createStateStore, Q as KEYBINDING_KEY_COL_WIDTH, R as listSessionMeta, S as parseMcpsFile, T as ProviderRegistry, U as sumRunCosts, V as saveState, W as titleFromTurns, X as KEYBINDING_DEFS, Y as DEFAULT_KEYBINDINGS, Z as KEYBINDING_DEF_BY_ACTION, _ as DiscoveryResult, _t as Hint, a as SessionExportTarget, at as ensureKeybindingsFile, b as defaultMcpsConfigPaths, bt as truncateTrailing, c as writeSessionExport, ct as keybindingsPath, d as useEnabledToggleSet, dt as parseBindingSpec, et as KeyBindingDef, f as DiscoveredPlugin, ft as readKeybindings, g as DiscoveryError, gt as EMPTY_HINTS, h as DiscoveredMcp, ht as stripJsonComments, i as SessionExportFormat, it as ResolvedExtensionKeybinding, j as StateStoreApi, k as resolveStoragePaths, l as EnabledAllowlistKey, lt as matchesBinding, m as projectUserPaths, mt as resolveExtensionKeybindings, n as computeTurnAnchors, nt as KeyBindings, o as renderSession, ot as formatBindingForDisplay, p as ProjectUserPath, pt as readKeybindingsRaw, q as updateToolEventOutcomes, r as SessionExportAnchor, rt as ParsedBinding, s as resolveSessionExportTarget, st as groupBindings, t as TranscriptItem, tt as KeyBindingSection, u as EnabledToggleSet, ut as mergeKeybindings, v as buildMcpServers, vt as clipHintsToWidth, w as ChatOptions, x as discoverProjectMcps, y as dedupMcpServersByName, yt as hintsLength, z as loadState } from "./transcript-anchors-0midxNxf.js";
|
|
3
|
+
import { $ as uniqueFilesFromReferences, A as buildUnifiedDiff, B as buildEditOutcomesAnnotation, C as EditSummary, D as PreviewResult, E as InlineSegment, F as previewEditPayload, G as rewriteMultiEditHeader, H as mergeApprovalAndBodyOutcomes, I as splitLines, J as SKILLS_TRIGGER, K as stripEditOutcomesAnnotation, L as summarizeEditPayload, M as computeLineDiff, N as extractEditPayload, O as applyEditPayload, P as filetypeFromPath, Q as createFilesCompletionProvider, R as tokenize, S as EditHunkSummary, T as InlineDiff, U as parseEditOutcomesFromResult, V as maskToOutcomeKinds, W as resolveApprovalForPayload, X as uniqueSkillNamesFromReferences, Y as createSkillsCompletionProvider, Z as FILES_TRIGGER, _ as formatTaskSummary, a as MAX_TRANSCRIPT_EVENTS, at as CHATS_TRIGGER, b as DiffLine, c as finalizeStreamingMarkdown, ct as ChatReferenceScope, d as ageString, dt as uniqueChatIdsFromReferences, et as FileEntry, f as compactPath, ft as blendHsl, g as formatTaskStatus, h as formatDuration, i as turnAsText, it as createCommandsCompletionProvider, j as computeInlineDiff, k as buildContextualDiff, l as finalizeStreamingMarkdownForOwner, lt as chatReferenceTokensFromText, m as fmtTokens, n as deleteTurnSafely, nt as listProjectFiles, o as TRANSCRIPT_TRIM_TO_EVENTS, ot as ChatReferenceData, p as fmtCost, pt as buildLinearRamp, q as summarizeOutcomes, r as truncateTurnsAt, rt as COMMANDS_TRIGGER, s as capTranscriptEvents, st as ChatReferenceEntry, t as countNeighbors, tt as ListProjectFilesOptions, u as turnContextSize, ut as createChatsCompletionProvider, v as previewLine, w as HunkResolution, x as DiffOp, y as shortId, z as ResolvedApproval } from "./turn-operations-JtKQfSFC.js";
|
|
4
|
+
import { A as highlightSegments, B as ApprovalDecision, C as SearchTurnResult, D as buildSessionSearchIndex, E as SessionSearchIndex, F as searchSessionIndex, G as useSafeModeActions, H as RequestApproval, I as searchSessionIndexAsync, K as useSafeModeQueue, L as searchSessionTurns, M as searchSessionHistory, N as searchSessionHistoryIndex, O as buildSessionSearchIndexAsync, P as searchSessionHistoryIndexAsync, Q as isVisible, R as searchTurns, S as SearchSessionResult, T as SessionSearchExcerpt, U as SafeModeActions, V as ApprovalRequest, W as SafeModeProvider, X as isTurnHighlighted, Y as isEditErrorResult, _ as splitMarkdownCodeBlocks, a as formatToolCall, b as IndexedSearchTurn, c as splitPromptSegments, d as filterModelCatalog, et as selectableTurnIds, f as indexOfEntry, g as normalizeMarkdownCodeFences, h as chunkMarkdownForRender, i as displayNameFor, j as searchHighlightRanges, k as filterSessionSearchCatalog, l as CatalogEntry, m as MarkdownSegment, n as ToolDisplayMeta, nt as turnSelectionOwnership, o as PromptSegment, p as MARKDOWN_RENDER_CHUNK_TARGET_BYTES, r as ToolFormatLine, s as PromptSegmentRef, t as TOOL_DISPLAY, tt as selectionAfterTurnRemoval, u as buildModelCatalog, v as HighlightRange, w as SessionHistoryMatch, x as SearchExcerpt, y as HighlightSegment, z as searchableTurnText } from "./tool-formatters-OobhXAK1.js";
|
|
5
5
|
import { Hookable } from "hookable";
|
|
6
6
|
import { spawn } from "node:child_process";
|
|
7
7
|
import { Dispatch, ReactNode, SetStateAction } from "react";
|
package/dist/chat.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { n as buildContextBreakdown, t as buildContextSegments } from "./context-segments-CJCtJ9sU.js";
|
|
2
|
-
import { $t as groupBindings, An as OUTPUT_RESERVE_TOKENS, Jt as KEYBINDING_DEFS, Mn as shouldAutoCompact, Qt as formatBindingForDisplay, Xt as KEYBINDING_KEY_COL_WIDTH, Y as EMPTY_EXTENSION_REGISTRY, Yt as KEYBINDING_DEF_BY_ACTION, Zt as ensureKeybindingsFile, an as readKeybindingsRaw, bn as defineExtension, cn as ALTERNATE_CRED_KEY_SUFFIX, ct as buildExtensionRegistry, dt as filterExtensionRegistry, en as keybindingsPath, hn as inlineLoadedExtension, in as readKeybindings, jn as effectiveContextWindow, kn as AUTO_COMPACT_MIN_GROWTH_FRACTION, ln as alternateCredKey, lt as composeExtensionPreset, mn as discoverExtensions, mt as partitionExtensionCatalog, nn as mergeKeybindings, on as resolveExtensionKeybindings, pn as defaultExtensionScanPaths, pt as mergeContributions, qt as DEFAULT_KEYBINDINGS, rn as parseBindingSpec, sn as stripJsonComments, st as buildExtensionPreset, tn as matchesBinding, un as isReservedCredKey, ut as disposeExtensionRegistry, vn as scanExtensionDirectories } from "./agent-
|
|
2
|
+
import { $t as groupBindings, An as OUTPUT_RESERVE_TOKENS, Jt as KEYBINDING_DEFS, Mn as shouldAutoCompact, Qt as formatBindingForDisplay, Xt as KEYBINDING_KEY_COL_WIDTH, Y as EMPTY_EXTENSION_REGISTRY, Yt as KEYBINDING_DEF_BY_ACTION, Zt as ensureKeybindingsFile, an as readKeybindingsRaw, bn as defineExtension, cn as ALTERNATE_CRED_KEY_SUFFIX, ct as buildExtensionRegistry, dt as filterExtensionRegistry, en as keybindingsPath, hn as inlineLoadedExtension, in as readKeybindings, jn as effectiveContextWindow, kn as AUTO_COMPACT_MIN_GROWTH_FRACTION, ln as alternateCredKey, lt as composeExtensionPreset, mn as discoverExtensions, mt as partitionExtensionCatalog, nn as mergeKeybindings, on as resolveExtensionKeybindings, pn as defaultExtensionScanPaths, pt as mergeContributions, qt as DEFAULT_KEYBINDINGS, rn as parseBindingSpec, sn as stripJsonComments, st as buildExtensionPreset, tn as matchesBinding, un as isReservedCredKey, ut as disposeExtensionRegistry, vn as scanExtensionDirectories } from "./agent-ut6nQRnI.js";
|
|
3
3
|
import { a as formatDuration, c as previewLine, i as fmtTokens, l as shortId, n as compactPath, o as formatTaskStatus, r as fmtCost, s as formatTaskSummary, t as ageString } from "./format-BF745pLL.js";
|
|
4
4
|
import { R as projectUserPaths, z as findGitRoot } from "./skills-BMGH_KK1.js";
|
|
5
5
|
import { p as resolveStorageDirs } from "./plugins-onDvTHEm.js";
|
|
6
6
|
import { appendDynamicSection } from "./prompt.js";
|
|
7
7
|
import { a as generateStructuredData, c as shouldAutoGenerateTitle, g as parseCommandInvocation, h as executeCommand, i as tokenEndingAtCursor, m as commandSteps, n as patchInlineGhost, o as cleanTitle, r as resolveInlineSuggestion, s as generateSessionTitle, t as createPathAutocompleteProvider } from "./inline-autocomplete-D0MPvBaS.js";
|
|
8
8
|
import { a as mergeReferences, n as collectReferences, o as mergeSuggestions, r as findActiveTrigger, t as applyInsert } from "./completion-core-BRo86R_L.js";
|
|
9
|
-
import { C as openrouterDescriptor, S as openaiDescriptor, T as restoreModelOptions, _ as getModelInfo, a as readProviderCredential, b as modelSupportsReasoning, c as setPreferredCredential, d as BUILTIN_PROVIDERS, f as anthropicDescriptor, g as getContextWindow, h as enabledModelOptions, i as readCredentials, l as setProviderCredential, m as credKeyOf, n as applyApiKeyEnv, o as readProviderCredentialPair, p as cerebrasDescriptor, r as credentialsPath, s as removeProviderCredential, t as detectAuth, u as writeCredentials, v as localDescriptor, w as piIdOf, x as modelsForDescriptor, y as modelOptionsFor } from "./auth-
|
|
9
|
+
import { C as openrouterDescriptor, S as openaiDescriptor, T as restoreModelOptions, _ as getModelInfo, a as readProviderCredential, b as modelSupportsReasoning, c as setPreferredCredential, d as BUILTIN_PROVIDERS, f as anthropicDescriptor, g as getContextWindow, h as enabledModelOptions, i as readCredentials, l as setProviderCredential, m as credKeyOf, n as applyApiKeyEnv, o as readProviderCredentialPair, p as cerebrasDescriptor, r as credentialsPath, s as removeProviderCredential, t as detectAuth, u as writeCredentials, v as localDescriptor, w as piIdOf, x as modelsForDescriptor, y as modelOptionsFor } from "./auth-yAckG81N.js";
|
|
10
10
|
import { $ as buildContextualDiff, A as createSkillsCompletionProvider, C as chunkMarkdownForRender, D as splitMarkdownCodeBlocks, E as normalizeMarkdownCodeFences, F as COMMANDS_TRIGGER, H as isTurnHighlighted, I as createCommandsCompletionProvider, J as selectableTurnIds, L as blendHsl, M as FILES_TRIGGER, N as createFilesCompletionProvider, P as uniqueFilesFromReferences, Q as applyEditPayload, R as buildLinearRamp, S as MARKDOWN_RENDER_CHUNK_TARGET_BYTES, V as isEditErrorResult, W as isVisible, Y as selectionAfterTurnRemoval, Z as turnSelectionOwnership, _ as turnContextSize, _t as summarizeOutcomes, a as TOOL_DISPLAY, at as filetypeFromPath, b as filterModelCatalog, bt as createChatsCompletionProvider, c as MAX_TRANSCRIPT_EVENTS, ct as summarizeEditPayload, d as finalizeStreamingMarkdown, dt as maskToOutcomeKinds, et as buildUnifiedDiff, f as finalizeStreamingMarkdownForOwner, ft as mergeApprovalAndBodyOutcomes, gt as stripEditOutcomesAnnotation, ht as rewriteMultiEditHeader, i as turnAsText, it as extractEditPayload, j as uniqueSkillNamesFromReferences, k as SKILLS_TRIGGER, l as TRANSCRIPT_TRIM_TO_EVENTS, lt as tokenize, mt as resolveApprovalForPayload, n as deleteTurnSafely, nt as computeInlineDiff, o as displayNameFor, ot as previewEditPayload, pt as parseEditOutcomesFromResult, r as truncateTurnsAt, rt as computeLineDiff, s as formatToolCall, st as splitLines, t as countNeighbors, u as capTranscriptEvents, ut as buildEditOutcomesAnnotation, v as splitPromptSegments, vt as CHATS_TRIGGER, x as indexOfEntry, xt as uniqueChatIdsFromReferences, y as buildModelCatalog, yt as chatReferenceTokensFromText } from "./turn-operations-7_Ff7INF.js";
|
|
11
11
|
import { a as searchHighlightRanges, c as searchSessionHistoryIndexAsync, d as searchSessionTurns, f as searchTurns, i as highlightSegments, l as searchSessionIndex, n as buildSessionSearchIndexAsync, o as searchSessionHistory, p as searchableTurnText, r as filterSessionSearchCatalog, s as searchSessionHistoryIndex, t as buildSessionSearchIndex, u as searchSessionIndexAsync } from "./history-search-C4bk1Wz_.js";
|
|
12
|
-
import { $ as McpAuthProvider, $n as isTodoTool, $t as resolveStoragePaths, A as writeProjects, An as performInPlaceSelfUpdate, Ar as saveState, At as SETTINGS_INPUTS, B as mcpToolsCachePath, Bn as DEFAULT_PERSIST_EXCLUDE_TOOLS, Bt as GRUVBOX_DARK, C as addToSafelist, Cn as buildUpdateHint, Cr as createStateStore, Ct as buildHints, D as projectsFilePath, Dn as detectLibc, Dr as listSessionMeta, Dt as DEFAULT_SETTINGS, E as matchesSafelistEntry, En as compareSemver, Er as lastContextSizeFromTurns, Et as useEnabledToggleSet, F as oauthUsesManualCodePaste, Fn as renderAgentsMdBlock, Fr as toolCallPreview, Ft as BUILTIN_THEMES, G as useMcpToolToggleMap, Gn as TODOREAD_TOOL, Gt as CATPPUCCIN_MOCHA, H as saveMcpToolsCache, Hn as accentColor, Ht as CATPPUCCIN_FRAPPE, I as runOAuthLogin, In as BUILD_AGENT, Ir as toolResultText, It as DEFAULT_THEME, J as indexOfServerRow, Jn as TODO_STATUS_GLYPHS, Jt as useDiscovery, K as useMcpToolToggleSet, Kn as TODOS_METADATA_KEY, Kt as createDiscoverySlot, L as supportsOAuth, Ln as BUILTIN_AGENTS, Lr as updateToolEventOutcomes, Lt as resolveChipColor, M as fetchOAuthRedirect, Mn as resolvePlatformPackage, Mr as stripSpawnTokensLine, Mt as SettingsProvider, N as normalizeRedirectPaste, Nn as chatAutoCompactBehavior, Nr as sumRunCosts, O as readProjects, On as detectPackageManager, Or as loadState, Ot as SETTINGS_CATEGORIES, P as redirectUriFromAuthUrl, Pn as discoverAgentsMd, Pr as titleFromTurns, Pt as useSettings, Q as patchMcpCredential, Qn as getTodosForRun, Qt as resolveConfig, R as clearMcpToolsCache, Rn as DEFAULT_AGENT_ID, Rr as usageByModel, Rt as resolveTheme, S as IMPLICITLY_SAFE_TOOLS, Sn as bootTick, Sr as compactSummaryEvent, St as truncateTrailing, T as isOnSafelist, Tn as checkForUpdate, Tr as eventsFromTurns, Tt as listProjectFiles, U as subscribeMcpToolsCache, Un as resolveAgentId, Ut as CATPPUCCIN_LATTE, V as refreshMcpToolsCatalog, Vn as PLAN_AGENT, Vt as GRUVBOX_LIGHT, W as buildToolToggle, Wn as singleAgentRegistry, Wt as CATPPUCCIN_MACCHIATO, X as createFileMcpCredentialStore, Xn as createTodoTools, Xt as ConfigProvider, Y as parentServerName, Yn as TODO_WRITE_COUNTS_METADATA_KEY, Yt as useDiscoveryOptional, Z as mcpCredentialsPath, Zn as getArchivedTodosForRun, Zt as useConfig, _ as resolveSessionExportTarget, _n as defaultMcpsConfigPaths, _r as buildPlanSystem, _t as useInteractionsActions, a as useSurfaces, an as restoreChainFallbacks, ar as useActiveTodos, at as AUTOMATIC_INTERACTION_INSTRUCTION, b as useSafeModeActions, bn as tryOpenBrowser, br as createChatTurnsReadTool, bt as clipHintsToWidth, c as discoverSystemMd, cn as useCompletion, cr as DOING_TASKS_DOCTRINE, ct as PRESENT_PLAN_TOOL, d as userSystemMdPath, dn as importFromClaudeCode, dr as INTERACTION_GUIDANCE_NO_PROMPTS, dt as createInteractionTools, en as buildRunModel, er as pickActiveRunId, et as useMcpAuthDispatch, f as useStreamBuffer, fn as mcpsWritePath, fr as PLAN_MODE_DOCTRINE, ft as isInteractionTool, g as renderSession, gn as dedupMcpServersByName, gr as buildBuildSystem, gt as serializeInteractionResponse, h as discoverProjectSkills, hn as buildMcpServers, hr as TOKEN_DISCIPLINE_DOCTRINE, ht as pendingInteractionsFromTurns, i as useSelectStyle, in as providerKeySetChanged, it as ASK_USER_TOOL, j as formatPathForCwd, jn as performSelfUpdate, jt as SETTINGS_TOGGLES, k as suggestSafelistEntries, kn as parseSemver, kr as marginTopFor, kt as SETTINGS_CHOICES, l as renderSystemMdSeed, ln as countClaudeSessionFiles, lr as IDENTITY_PREFIX, lt as buildResumedToolResultsTurn, m as defaultSkillScanPaths, mn as upsertMcpServer, mr as SUBAGENT_GUIDANCE, mt as makeRequestInteraction, n as ThemeProvider, nn as chainsEqual, nr as selectActiveTodos, nt as getMcpAuthStatus, o as useSyntaxStyles, on as sanitizeModelChain, or as ACTIONS_WITH_CARE_DOCTRINE, ot as HOST_INTERACTION_ID_PREFIX, p as buildSkillsConfig, pn as removeMcpServer, pr as PLAN_MODE_DOCTRINE_NO_PROMPTS, pt as isModelInteraction, q as buildVisibleMcpRows, qn as TODOWRITE_TOOL, qt as DiscoveryProvider, r as useColors, rn as filterChainFallbacks, rr as setTodosForRun, rt as reduceMcpAuth, s as useTheme, sn as toggleChainEntry, sr as COMMUNICATION_DOCTRINE, st as InteractionsProvider, t as computeTurnAnchors, tn as chainPositionOf, tr as pruneTodosByRun, tt as useMcpAuthState, un as hasClaudeCodeSetup, ur as INTERACTION_GUIDANCE, ut as createAutomaticInteractionResponse, v as writeSessionExport, vn as discoverProjectMcps, vr as envSection, vt as useInteractionsQueue, w as getSafelist, wn as useUpdateCheck, wr as deriveSessionTitle, wt as shortChord, x as useSafeModeQueue, xn as bootProfileEnabled, xt as hintsLength, y as SafeModeProvider, yn as parseMcpsFile, yr as chatReferenceTokensForPrompt, yt as EMPTY_HINTS, z as loadMcpToolsCache, zn as DEFAULT_BUDGET_EXCLUDE_TOOLS, zt as VAPORWAVE_THEME } from "./transcript-anchors-
|
|
12
|
+
import { $ as McpAuthProvider, $n as isTodoTool, $t as resolveStoragePaths, A as writeProjects, An as performInPlaceSelfUpdate, Ar as saveState, At as SETTINGS_INPUTS, B as mcpToolsCachePath, Bn as DEFAULT_PERSIST_EXCLUDE_TOOLS, Bt as GRUVBOX_DARK, C as addToSafelist, Cn as buildUpdateHint, Cr as createStateStore, Ct as buildHints, D as projectsFilePath, Dn as detectLibc, Dr as listSessionMeta, Dt as DEFAULT_SETTINGS, E as matchesSafelistEntry, En as compareSemver, Er as lastContextSizeFromTurns, Et as useEnabledToggleSet, F as oauthUsesManualCodePaste, Fn as renderAgentsMdBlock, Fr as toolCallPreview, Ft as BUILTIN_THEMES, G as useMcpToolToggleMap, Gn as TODOREAD_TOOL, Gt as CATPPUCCIN_MOCHA, H as saveMcpToolsCache, Hn as accentColor, Ht as CATPPUCCIN_FRAPPE, I as runOAuthLogin, In as BUILD_AGENT, Ir as toolResultText, It as DEFAULT_THEME, J as indexOfServerRow, Jn as TODO_STATUS_GLYPHS, Jt as useDiscovery, K as useMcpToolToggleSet, Kn as TODOS_METADATA_KEY, Kt as createDiscoverySlot, L as supportsOAuth, Ln as BUILTIN_AGENTS, Lr as updateToolEventOutcomes, Lt as resolveChipColor, M as fetchOAuthRedirect, Mn as resolvePlatformPackage, Mr as stripSpawnTokensLine, Mt as SettingsProvider, N as normalizeRedirectPaste, Nn as chatAutoCompactBehavior, Nr as sumRunCosts, O as readProjects, On as detectPackageManager, Or as loadState, Ot as SETTINGS_CATEGORIES, P as redirectUriFromAuthUrl, Pn as discoverAgentsMd, Pr as titleFromTurns, Pt as useSettings, Q as patchMcpCredential, Qn as getTodosForRun, Qt as resolveConfig, R as clearMcpToolsCache, Rn as DEFAULT_AGENT_ID, Rr as usageByModel, Rt as resolveTheme, S as IMPLICITLY_SAFE_TOOLS, Sn as bootTick, Sr as compactSummaryEvent, St as truncateTrailing, T as isOnSafelist, Tn as checkForUpdate, Tr as eventsFromTurns, Tt as listProjectFiles, U as subscribeMcpToolsCache, Un as resolveAgentId, Ut as CATPPUCCIN_LATTE, V as refreshMcpToolsCatalog, Vn as PLAN_AGENT, Vt as GRUVBOX_LIGHT, W as buildToolToggle, Wn as singleAgentRegistry, Wt as CATPPUCCIN_MACCHIATO, X as createFileMcpCredentialStore, Xn as createTodoTools, Xt as ConfigProvider, Y as parentServerName, Yn as TODO_WRITE_COUNTS_METADATA_KEY, Yt as useDiscoveryOptional, Z as mcpCredentialsPath, Zn as getArchivedTodosForRun, Zt as useConfig, _ as resolveSessionExportTarget, _n as defaultMcpsConfigPaths, _r as buildPlanSystem, _t as useInteractionsActions, a as useSurfaces, an as restoreChainFallbacks, ar as useActiveTodos, at as AUTOMATIC_INTERACTION_INSTRUCTION, b as useSafeModeActions, bn as tryOpenBrowser, br as createChatTurnsReadTool, bt as clipHintsToWidth, c as discoverSystemMd, cn as useCompletion, cr as DOING_TASKS_DOCTRINE, ct as PRESENT_PLAN_TOOL, d as userSystemMdPath, dn as importFromClaudeCode, dr as INTERACTION_GUIDANCE_NO_PROMPTS, dt as createInteractionTools, en as buildRunModel, er as pickActiveRunId, et as useMcpAuthDispatch, f as useStreamBuffer, fn as mcpsWritePath, fr as PLAN_MODE_DOCTRINE, ft as isInteractionTool, g as renderSession, gn as dedupMcpServersByName, gr as buildBuildSystem, gt as serializeInteractionResponse, h as discoverProjectSkills, hn as buildMcpServers, hr as TOKEN_DISCIPLINE_DOCTRINE, ht as pendingInteractionsFromTurns, i as useSelectStyle, in as providerKeySetChanged, it as ASK_USER_TOOL, j as formatPathForCwd, jn as performSelfUpdate, jt as SETTINGS_TOGGLES, k as suggestSafelistEntries, kn as parseSemver, kr as marginTopFor, kt as SETTINGS_CHOICES, l as renderSystemMdSeed, ln as countClaudeSessionFiles, lr as IDENTITY_PREFIX, lt as buildResumedToolResultsTurn, m as defaultSkillScanPaths, mn as upsertMcpServer, mr as SUBAGENT_GUIDANCE, mt as makeRequestInteraction, n as ThemeProvider, nn as chainsEqual, nr as selectActiveTodos, nt as getMcpAuthStatus, o as useSyntaxStyles, on as sanitizeModelChain, or as ACTIONS_WITH_CARE_DOCTRINE, ot as HOST_INTERACTION_ID_PREFIX, p as buildSkillsConfig, pn as removeMcpServer, pr as PLAN_MODE_DOCTRINE_NO_PROMPTS, pt as isModelInteraction, q as buildVisibleMcpRows, qn as TODOWRITE_TOOL, qt as DiscoveryProvider, r as useColors, rn as filterChainFallbacks, rr as setTodosForRun, rt as reduceMcpAuth, s as useTheme, sn as toggleChainEntry, sr as COMMUNICATION_DOCTRINE, st as InteractionsProvider, t as computeTurnAnchors, tn as chainPositionOf, tr as pruneTodosByRun, tt as useMcpAuthState, un as hasClaudeCodeSetup, ur as INTERACTION_GUIDANCE, ut as createAutomaticInteractionResponse, v as writeSessionExport, vn as discoverProjectMcps, vr as envSection, vt as useInteractionsQueue, w as getSafelist, wn as useUpdateCheck, wr as deriveSessionTitle, wt as shortChord, x as useSafeModeQueue, xn as bootProfileEnabled, xt as hintsLength, y as SafeModeProvider, yn as parseMcpsFile, yr as chatReferenceTokensForPrompt, yt as EMPTY_HINTS, z as loadMcpToolsCache, zn as DEFAULT_BUDGET_EXCLUDE_TOOLS, zt as VAPORWAVE_THEME } from "./transcript-anchors-BYmStvQP.js";
|
|
13
13
|
//#region src/chat/auto-update-cli.ts
|
|
14
14
|
const UPGRADE_HELP = `Usage: zidane upgrade [options]
|
|
15
15
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Yu as Logger } from "../index-
|
|
2
|
-
import { s as ExecResult } from "../types-
|
|
3
|
-
import { t as SandboxProvider } from "../sandbox-
|
|
1
|
+
import { Yu as Logger } from "../index-A1qz0l55.js";
|
|
2
|
+
import { s as ExecResult } from "../types-U-rIVUDw.js";
|
|
3
|
+
import { t as SandboxProvider } from "../sandbox-CDl9tfTo.js";
|
|
4
4
|
import { Buffer } from "node:buffer";
|
|
5
5
|
|
|
6
6
|
//#region src/contexts/daytona.d.ts
|
|
@@ -55,9 +55,17 @@ interface DaytonaSandbox {
|
|
|
55
55
|
}) => Promise<DaytonaPtyHandle>;
|
|
56
56
|
};
|
|
57
57
|
fs: {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
/**
|
|
59
|
+
* A Node Buffer, not a bare Uint8Array — that is what the SDK declares and
|
|
60
|
+
* what its download path actually materializes (`Buffer.concat` over the
|
|
61
|
+
* response parts), so `readFile` decodes with `.toString('utf8')` instead
|
|
62
|
+
* of guarding a union. Leaning on that is only safe because the
|
|
63
|
+
* `@daytona/sdk` peer range pins `^0.187.0`: this interface is a
|
|
64
|
+
* hand-rolled structural type over a lazily-imported SDK, so a wider
|
|
65
|
+
* install returning a plain Uint8Array would decode to "104,101,…"
|
|
66
|
+
* at runtime with nothing failing at compile time.
|
|
67
|
+
*/
|
|
68
|
+
downloadFile: (path: string) => Promise<Buffer>;
|
|
61
69
|
uploadFile: (content: Uint8Array | Buffer, path: string) => Promise<unknown>;
|
|
62
70
|
listFiles: (path: string) => Promise<DaytonaFileEntry[]>;
|
|
63
71
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daytona.d.ts","names":[],"sources":["../../src/contexts/daytona.ts"],"mappings":";;;;;;UAgCU,sBAAA;EACR,QAAA;EACA,MAAA;EACA,MAAA;EACA,MAAA;EACA,MAAA;EACA,SAAA;IAAc,MAAA;EAAA;AAAA;AAAA,UAGN,gBAAA;EACR,IAAA;EAmByB;EAjBzB,KAAK;AAAA;;;;;;;;;UAWG,gBAAA;EACR,GAAA;EACA,iBAAA,QAAyB,OAAA;EACzB,SAAA,GAAY,IAAA,WAAe,UAAA,KAAe,OAAA;EAC1C,IAAA,QAAY,OAAA;IAAU,QAAA;EAAA;EACtB,IAAA,SAAa,OAAA;EACb,UAAA,QAAkB,OAAA;AAAA;AAAA,UAGV,cAAA;EACR,EAAA;EACA,KAAA;EACA,OAAA;IACE,cAAA,GAAiB,OAAA,UAAiB,GAAA,WAAc,GAAA,GAAM,MAAA,kBAAwB,OAAA,cAAqB,OAAA,CAAQ,sBAAA,GAY7F;IAVd,SAAA,IAAa,OAAA;
|
|
1
|
+
{"version":3,"file":"daytona.d.ts","names":[],"sources":["../../src/contexts/daytona.ts"],"mappings":";;;;;;UAgCU,sBAAA;EACR,QAAA;EACA,MAAA;EACA,MAAA;EACA,MAAA;EACA,MAAA;EACA,SAAA;IAAc,MAAA;EAAA;AAAA;AAAA,UAGN,gBAAA;EACR,IAAA;EAmByB;EAjBzB,KAAK;AAAA;;;;;;;;;UAWG,gBAAA;EACR,GAAA;EACA,iBAAA,QAAyB,OAAA;EACzB,SAAA,GAAY,IAAA,WAAe,UAAA,KAAe,OAAA;EAC1C,IAAA,QAAY,OAAA;IAAU,QAAA;EA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,SAAA,GAAY,gBAAA;EAvDF;EAyDV,GAAA;EAxDY;EA0DZ,GAAA,GAAM,MAAA;EA5CI;EA8CV,MAAA,GAAS,MAAA;;EAET,uBAAA;EAhD0B;EAkD1B,OAAA;IAAY,IAAA;IAAc,OAAA;EAAA;EANpB;;;;;;;;;EAgBN,SAAA,GAAY,gBAAA;AAAA;AAAA,UAUG,uBAAA;EAhCf;EAkCA,cAAA;EAhCY;EAkCZ,gBAAA,SAAyB,OAAA;EA9BzB;EAgCA,GAAA;EA9BA;EAgCA,KAAA,IAAS,EAAA,aAAe,OAAO;AAAA;AAAA,iBAGjB,iBAAA,CACd,SAAA,EAAW,MAAA,8BACX,WAAA,EAAa,MAAA,+BACZ,MAAA;AAAA,iBAKa,0BAAA,CAA2B,QAAA,EAAU,sBAAA,GAAyB,UAAU;AAAA,iBA6CxE,0BAAA,CACd,aAAA,EAAe,MAAA,mBACf,OAAA,EAAS,sBAAA,EACT,OAAA,EAAS,MAAA,+BACR,mBAAA;AAAA,iBA8BmB,mBAAA,CACpB,OAAA,EAAS,cAAA,EACT,MAAA,EAAQ,MAAA,EACR,IAAA,EAAM,uBAAA,GACL,OAAA;AAAA,iBA2BmB,iBAAA,CACpB,OAAA,EAAS,cAAA,EACT,MAAA,EAAQ,MAAA,EACR,IAAA;EAAQ,IAAA;EAAc,OAAA;EAAiB,GAAA;EAAc,OAAA,GAAU,MAAA;AAAA,IAC9D,OAAA;AAAA,iBA4Ba,qBAAA,CAAsB,OAAA,GAAS,sBAAA,GAA8B,eAAe"}
|
package/dist/contexts/daytona.js
CHANGED
|
@@ -43,12 +43,6 @@ function normalizeDaytonaExecError(error) {
|
|
|
43
43
|
exitCode: 124
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
function bufferToString(value) {
|
|
47
|
-
if (Buffer.isBuffer(value)) return value.toString("utf8");
|
|
48
|
-
if (value instanceof ArrayBuffer) return new TextDecoder().decode(new Uint8Array(value));
|
|
49
|
-
if (value instanceof Uint8Array) return new TextDecoder().decode(value);
|
|
50
|
-
return value.toString("utf8");
|
|
51
|
-
}
|
|
52
46
|
function toClientConfig(apiKey, apiUrl, target) {
|
|
53
47
|
const config = {};
|
|
54
48
|
if (apiKey !== void 0) config.apiKey = apiKey;
|
|
@@ -407,10 +401,11 @@ function createDaytonaProvider(options = {}) {
|
|
|
407
401
|
};
|
|
408
402
|
},
|
|
409
403
|
async readFile(sandboxId, path) {
|
|
410
|
-
return
|
|
404
|
+
return (await get(sandboxId).sandbox.fs.downloadFile(path)).toString("utf8");
|
|
411
405
|
},
|
|
412
|
-
async writeFile(sandboxId, path, content) {
|
|
413
|
-
|
|
406
|
+
async writeFile(sandboxId, path, content, encoding = "utf-8") {
|
|
407
|
+
const data = typeof content === "string" ? Buffer.from(content, encoding) : content;
|
|
408
|
+
await get(sandboxId).sandbox.fs.uploadFile(data, path);
|
|
414
409
|
},
|
|
415
410
|
async listFiles(sandboxId, path) {
|
|
416
411
|
return (await get(sandboxId).sandbox.fs.listFiles(path)).map((e) => e.isDir ? `${e.name}/` : e.name);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daytona.js","names":[],"sources":["../../src/contexts/daytona.ts"],"sourcesContent":["/**\n * Daytona sandbox provider.\n *\n * Implements {@link SandboxProvider} on top of Daytona sandboxes. Pair it with\n * {@link createSandboxContext} to run an agent's shell + filesystem tools\n * inside a Daytona sandbox:\n *\n * ```ts\n * import { createSandboxContext } from 'zidane/contexts'\n * import { createDaytonaProvider } from 'zidane/contexts/daytona'\n *\n * const execution = createSandboxContext(createDaytonaProvider())\n * ```\n *\n * Requires `@daytona/sdk` as an optional peer dependency:\n * `bun add @daytona/sdk`.\n */\n\nimport type { Logger } from '../logger'\nimport type { SandboxProvider } from './sandbox'\nimport type { ExecResult, SpawnConfig, StreamHandle } from './types'\nimport { Buffer } from 'node:buffer'\nimport { errorMessage } from '../errors'\nimport { consoleSink, createLogger } from '../logger'\nimport { capBufferedExecOutput } from './output-cap'\nimport { StreamQueue } from './stream-queue'\n\n// ---------------------------------------------------------------------------\n// Minimal structural views of the `@daytona/sdk` surface we touch. Declared\n// locally so zidane typechecks without the optional peer dependency installed.\n// ---------------------------------------------------------------------------\n\ninterface DaytonaExecuteResponse {\n exitCode?: number | null\n result?: string | null\n output?: string | null\n stdout?: string | null\n stderr?: string | null\n artifacts?: { stdout?: string | null }\n}\n\ninterface DaytonaFileEntry {\n name: string\n /** Present in the Daytona SDK's FileInfo; used for the `/` dir suffix. */\n isDir?: boolean\n}\n\n/**\n * Structural subset of Daytona's `PtyHandle`.\n *\n * Daytona's process/session API has NO stdin channel at all — sessions are\n * fire-and-forget with log streaming — so a PTY is the only way to reach a\n * long-lived process interactively. See the `execStream` implementation for\n * what that costs.\n */\ninterface DaytonaPtyHandle {\n pid?: number\n waitForConnection: () => Promise<unknown>\n sendInput: (data: string | Uint8Array) => Promise<unknown>\n wait: () => Promise<{ exitCode?: number }>\n kill?: () => Promise<unknown>\n disconnect: () => Promise<unknown>\n}\n\ninterface DaytonaSandbox {\n id: string\n state?: string\n process: {\n executeCommand: (command: string, cwd?: string, env?: Record<string, string>, timeout?: number) => Promise<DaytonaExecuteResponse>\n /** Present in recent SDKs; only `execStream` uses it. */\n createPty?: (options: {\n /**\n * REQUIRED by the API despite reading like a convenience handle: the\n * SDK forwards it as the session id and the control plane rejects the\n * create with 400 `session ID is required` when it is absent.\n */\n id: string\n cwd?: string\n envs?: Record<string, string>\n onData?: (data: Uint8Array) => void\n }) => Promise<DaytonaPtyHandle>\n }\n fs: {\n downloadFile: (path: string) => Promise<Uint8Array | ArrayBuffer | { toString: (encoding?: BufferEncoding) => string }>\n uploadFile: (content: Uint8Array | Buffer, path: string) => Promise<unknown>\n listFiles: (path: string) => Promise<DaytonaFileEntry[]>\n }\n getWorkDir?: () => Promise<string>\n start?: (timeout?: number) => Promise<unknown>\n delete: (timeout?: number) => Promise<unknown>\n stop?: (timeout?: number) => Promise<unknown>\n archive?: () => Promise<unknown>\n}\n\ninterface DaytonaClientConfig {\n apiKey?: string\n apiUrl?: string\n target?: string\n}\n\ninterface DaytonaResources {\n cpu?: number\n memory?: number\n disk?: number\n gpu?: number\n [key: string]: unknown\n}\n\ninterface DaytonaCreateParams {\n language?: string\n snapshot?: string\n image?: unknown\n resources?: DaytonaResources\n envVars?: Record<string, string>\n [key: string]: unknown\n}\n\ninterface DaytonaClient {\n create: (params?: DaytonaCreateParams) => Promise<DaytonaSandbox>\n get: (sandboxIdOrName: string) => Promise<DaytonaSandbox>\n}\n\ntype DaytonaConstructor = new (config?: DaytonaClientConfig) => DaytonaClient\n\n// ---------------------------------------------------------------------------\n// Provider options\n// ---------------------------------------------------------------------------\n\nexport type DaytonaOnDestroy = 'delete' | 'kill' | 'stop' | 'pause' | 'archive' | 'leave'\n\nexport interface DaytonaProviderOptions {\n /** Daytona API key. Falls back to the `DAYTONA_API_KEY` env var when omitted. */\n apiKey?: string\n /** Daytona API URL. Falls back to `DAYTONA_API_URL`, then Daytona's hosted default. */\n apiUrl?: string\n /** Daytona target / region. Falls back to `DAYTONA_TARGET`, then the org default. */\n target?: string\n /**\n * Attach to a pre-existing sandbox by id or name instead of creating a fresh\n * one. By default the provider treats attached sandboxes as externally owned\n * and leaves them running on destroy/failure (set {@link ownAttached} to take\n * over the lifecycle).\n */\n sandboxId?: string\n /**\n * Take ownership of an attached ({@link sandboxId}) sandbox's lifecycle, so\n * `destroy()` applies {@link onDestroy} to it (stop / archive / delete)\n * instead of leaving it running.\n *\n * The intended caller is a durable host that *owns* the sandbox across\n * invocations: mint it once, journal its id, re-attach via `sandboxId` on\n * every replay/resume, and clean it up at the end of the logical run. Without\n * this an attached sandbox can never be stopped/deleted through the provider —\n * a leak for host-owned sandboxes. No effect when creating a fresh sandbox\n * (those are always owned). Spawn-time failures (readiness timeout, pregame\n * error) still never delete a pre-existing attached sandbox — only sandboxes\n * this provider *created* are auto-cleaned on spawn failure.\n *\n * Default: `false`.\n */\n ownAttached?: boolean\n /** Daytona snapshot used when creating a fresh sandbox. */\n snapshot?: string\n /** Runtime used for Daytona's code tooling. Shell execution works either way. */\n language?: string\n /** Daytona image/declarative builder input used when creating a fresh sandbox. */\n image?: unknown\n /** Daytona sandbox resources. */\n resources?: DaytonaResources\n /** Default working directory, applied when a spawn doesn't set `SpawnConfig.cwd`. */\n cwd?: string\n /** Environment variables baked into the sandbox and re-sent on every command. */\n env?: Record<string, string>\n /** Logger for provider-level lifecycle lines. */\n logger?: Logger\n /** Total deadline, in seconds, for the post-create readiness probe. Defaults to `60`. */\n readinessTimeoutSeconds?: number\n /** Setup script to upload and run once the sandbox is ready. */\n pregame?: { name: string, content: string }\n /**\n * What to do with an owned sandbox on destroy:\n *\n * - `'delete'` / `'kill'` (default) — call `sandbox.delete()`.\n * - `'stop'` / `'pause'` — call `sandbox.stop()` so Daytona preserves state\n * according to the runner's stop semantics.\n * - `'archive'` — stop, then archive for longer-term persistence.\n * - `'leave'` — make no API call.\n */\n onDestroy?: DaytonaOnDestroy\n}\n\n/** Per-probe timeout for the readiness `true` command. */\nconst READINESS_PROBE_TIMEOUT_SECONDS = 5\n/** Pause between readiness probes while the sandbox is still warming up. */\nconst READINESS_BACKOFF_MS = 250\n/** Setup scripts commonly install dependencies, so give them a generous cap. */\nconst PREGAME_TIMEOUT_SECONDS = 30 * 60\n\nexport interface DaytonaReadinessOptions {\n /** Total deadline in seconds. `<= 0` disables the probe entirely. */\n timeoutSeconds: number\n /** Optional cleanup for owned sandboxes that never become ready. */\n cleanupOnTimeout?: () => Promise<void>\n /** Clock source — injectable for deterministic tests. */\n now?: () => number\n /** Sleep between probes — injectable for deterministic tests. */\n sleep?: (ms: number) => Promise<void>\n}\n\nexport function resolveDaytonaEnv(\n optionEnv: Record<string, string> | undefined,\n perSpawnEnv: Record<string, string> | undefined,\n): Record<string, string> | undefined {\n const merged = { ...optionEnv, ...perSpawnEnv }\n return Object.keys(merged).length > 0 ? merged : undefined\n}\n\nexport function normalizeDaytonaExecResult(response: DaytonaExecuteResponse): ExecResult {\n return {\n stdout: response.stdout ?? response.artifacts?.stdout ?? response.result ?? response.output ?? '',\n stderr: response.stderr ?? '',\n exitCode: typeof response.exitCode === 'number' ? response.exitCode : 0,\n }\n}\n\nfunction capExecResult(result: ExecResult): ExecResult {\n return { ...capBufferedExecOutput(result.stdout, result.stderr), exitCode: result.exitCode }\n}\n\nfunction normalizeDaytonaExecError(error: unknown): ExecResult {\n const err = error as { exitCode?: unknown, stdout?: unknown, stderr?: unknown, result?: unknown, output?: unknown, message?: unknown }\n if (typeof err.exitCode === 'number') {\n return {\n stdout: typeof err.stdout === 'string'\n ? err.stdout\n : typeof err.result === 'string'\n ? err.result\n : typeof err.output === 'string'\n ? err.output\n : '',\n stderr: typeof err.stderr === 'string' ? err.stderr : typeof err.message === 'string' ? err.message : '',\n exitCode: err.exitCode,\n }\n }\n return { stdout: '', stderr: error instanceof Error ? error.message : String(error), exitCode: 124 }\n}\n\nfunction bufferToString(value: Uint8Array | ArrayBuffer | { toString: (encoding?: BufferEncoding) => string }): string {\n if (Buffer.isBuffer(value))\n return value.toString('utf8')\n if (value instanceof ArrayBuffer)\n return new TextDecoder().decode(new Uint8Array(value))\n if (value instanceof Uint8Array)\n return new TextDecoder().decode(value)\n return value.toString('utf8')\n}\n\nfunction toClientConfig(apiKey?: string, apiUrl?: string, target?: string): DaytonaClientConfig | undefined {\n const config: DaytonaClientConfig = {}\n if (apiKey !== undefined)\n config.apiKey = apiKey\n if (apiUrl !== undefined)\n config.apiUrl = apiUrl\n if (target !== undefined)\n config.target = target\n return Object.keys(config).length > 0 ? config : undefined\n}\n\nfunction takeString(value: unknown): string | undefined {\n return typeof value === 'string' && value.length > 0 ? value : undefined\n}\n\nexport function resolveDaytonaCreateParams(\n sandboxConfig: Record<string, unknown>,\n options: DaytonaProviderOptions,\n envVars: Record<string, string> | undefined,\n): DaytonaCreateParams | undefined {\n const reserved = new Set(['provider', 'apiKey', 'apiUrl', 'target', 'sandboxId'])\n const params: DaytonaCreateParams = {}\n\n for (const [key, value] of Object.entries(sandboxConfig)) {\n if (!reserved.has(key) && value !== undefined)\n params[key] = value\n }\n\n const language = takeString(sandboxConfig.language) ?? options.language\n const snapshot = takeString(sandboxConfig.snapshot) ?? options.snapshot\n const image = sandboxConfig.image ?? options.image\n const resources = (sandboxConfig.resources as DaytonaResources | undefined) ?? options.resources\n const configEnvVars = sandboxConfig.envVars as Record<string, string> | undefined\n const mergedEnvVars = resolveDaytonaEnv(envVars, configEnvVars)\n\n if (language !== undefined)\n params.language = language\n if (snapshot !== undefined)\n params.snapshot = snapshot\n if (image !== undefined)\n params.image = image\n if (resources !== undefined)\n params.resources = resources\n if (mergedEnvVars !== undefined)\n params.envVars = mergedEnvVars\n\n return Object.keys(params).length > 0 ? params : undefined\n}\n\nexport async function waitForDaytonaReady(\n sandbox: DaytonaSandbox,\n logger: Logger,\n opts: DaytonaReadinessOptions,\n): Promise<void> {\n if (opts.timeoutSeconds <= 0)\n return\n\n const now = opts.now ?? Date.now\n const sleep = opts.sleep ?? (ms => new Promise<void>(resolve => setTimeout(resolve, ms)))\n const start = now()\n const deadline = start + opts.timeoutSeconds * 1000\n\n logger.info('waiting for Daytona sandbox to initialize', { sandboxId: sandbox.id })\n\n while (true) {\n try {\n await sandbox.process.executeCommand('true', undefined, undefined, READINESS_PROBE_TIMEOUT_SECONDS)\n logger.info('Daytona sandbox ready', { sandboxId: sandbox.id, elapsedMs: now() - start })\n return\n }\n catch {\n if (now() >= deadline) {\n await opts.cleanupOnTimeout?.().catch(() => {})\n throw new Error(`Daytona sandbox ${sandbox.id} did not become ready within ${opts.timeoutSeconds}s`)\n }\n await sleep(READINESS_BACKOFF_MS)\n }\n }\n}\n\nexport async function runDaytonaPregame(\n sandbox: DaytonaSandbox,\n logger: Logger,\n opts: { name: string, content: string, cwd?: string, envVars?: Record<string, string> },\n): Promise<void> {\n const path = `/tmp/${opts.name}`\n logger.info('running Daytona pregame script', { sandboxId: sandbox.id, path })\n await sandbox.fs.uploadFile(Buffer.from(opts.content), path)\n\n const quoted = JSON.stringify(path)\n let result: ExecResult\n try {\n result = normalizeDaytonaExecResult(\n await sandbox.process.executeCommand(`chmod +x ${quoted} && ${quoted}`, opts.cwd, opts.envVars, PREGAME_TIMEOUT_SECONDS),\n )\n }\n catch (err) {\n result = normalizeDaytonaExecError(err)\n }\n\n if (result.exitCode !== 0) {\n logger.error('Daytona pregame script failed', { sandboxId: sandbox.id, exitCode: result.exitCode, stdout: result.stdout, stderr: result.stderr })\n throw new Error(`Daytona pregame script ${opts.name} failed with exit code ${result.exitCode}`)\n }\n\n logger.info('Daytona pregame ready', { sandboxId: sandbox.id, stdout: result.stdout, stderr: result.stderr })\n}\n\n// ---------------------------------------------------------------------------\n// Provider\n// ---------------------------------------------------------------------------\n\nexport function createDaytonaProvider(options: DaytonaProviderOptions = {}): SandboxProvider {\n const live = new Map<string, { sandbox: DaytonaSandbox, env?: Record<string, string>, owned: boolean }>()\n const logger = options.logger ?? createLogger(consoleSink())\n const readinessTimeoutSeconds = options.readinessTimeoutSeconds ?? 60\n\n async function loadSdk(): Promise<DaytonaConstructor> {\n try {\n const mod = await import('@daytona/sdk') as { Daytona: DaytonaConstructor }\n return mod.Daytona\n }\n catch (err) {\n // Distinguish \"not installed\" from \"installed but failed to load\". This\n // used to be a bare `catch` that reported the install hint either way,\n // which sent people to `bun add` a package that was already present. The\n // realistic load failure is a `tslib` hoist: `@daytona/sdk` declares no\n // tslib dependency of its own and reaches AWS SDK v3 through\n // `@aws-sdk/client-s3`, so a stale `@aws-crypto` v3/v4 floor\n // (`tslib: ^1.11.1`) can win the hoist and the SDK's initializer helpers\n // resolve against tslib 1.x, which lacks them. Fix with a root\n // `overrides: { \"tslib\": \"^2.8.1\" }` — see `docs/RESTATE.md`.\n const message = errorMessage(err)\n const notInstalled = /cannot find (?:module|package)|module not found|failed to resolve/i.test(message)\n throw new Error(\n notInstalled\n ? '@daytona/sdk is required for the Daytona sandbox provider. Install it with: bun add @daytona/sdk'\n : `@daytona/sdk is installed but failed to load: ${message}. If this mentions tslib, pin it with a root override: \"overrides\": { \"tslib\": \"^2.8.1\" } — see docs/RESTATE.md.`,\n { cause: err },\n )\n }\n }\n\n function get(sandboxId: string): { sandbox: DaytonaSandbox, env?: Record<string, string>, owned: boolean } {\n const entry = live.get(sandboxId)\n if (!entry)\n throw new Error(`Daytona sandbox ${sandboxId} is not tracked by this provider`)\n return entry\n }\n\n async function deleteOwnedSandbox(sandbox: DaytonaSandbox): Promise<void> {\n try {\n await sandbox.delete()\n }\n catch {\n // Already gone — nothing to clean up.\n }\n }\n\n async function stopOwnedSandbox(sandbox: DaytonaSandbox): Promise<void> {\n if (!sandbox.stop) {\n logger.error('cannot stop Daytona sandbox: this @daytona/sdk install exposes no stop() method; leaving it running', { sandboxId: sandbox.id })\n return\n }\n try {\n await sandbox.stop()\n logger.info('stopped Daytona sandbox; reconnect later via the sandboxId option (CLI: --sandbox)', { sandboxId: sandbox.id })\n }\n catch (err) {\n logger.error('failed to stop Daytona sandbox; it will run until Daytona lifecycle policy stops it', { sandboxId: sandbox.id, error: err instanceof Error ? err.message : String(err) })\n }\n }\n\n async function archiveOwnedSandbox(sandbox: DaytonaSandbox): Promise<void> {\n if (!sandbox.stop || !sandbox.archive) {\n logger.error('cannot archive Daytona sandbox: this @daytona/sdk install exposes no stop() and archive() pair; leaving it running', { sandboxId: sandbox.id })\n return\n }\n try {\n await sandbox.stop()\n await sandbox.archive()\n logger.info('archived Daytona sandbox; reconnect later via the sandboxId option (CLI: --sandbox)', { sandboxId: sandbox.id })\n }\n catch (err) {\n logger.error('failed to archive Daytona sandbox; it will run until Daytona lifecycle policy stops it', { sandboxId: sandbox.id, error: err instanceof Error ? err.message : String(err) })\n }\n }\n\n async function startAttachedSandboxIfNeeded(sandbox: DaytonaSandbox): Promise<void> {\n if (sandbox.state !== 'stopped' && sandbox.state !== 'archived')\n return\n if (!sandbox.start) {\n logger.error('cannot start Daytona sandbox before attach readiness probe: this @daytona/sdk install exposes no start() method', { sandboxId: sandbox.id, state: sandbox.state })\n return\n }\n logger.info('starting Daytona sandbox before attach readiness probe', { sandboxId: sandbox.id, state: sandbox.state })\n await sandbox.start(readinessTimeoutSeconds > 0 ? readinessTimeoutSeconds : undefined)\n }\n\n return {\n name: 'daytona',\n\n async spawn(config: SpawnConfig = {}): Promise<{ id: string, cwd: string }> {\n const Daytona = await loadSdk()\n const sb: Record<string, unknown> = config.sandbox ?? {}\n\n const apiKey = takeString(sb.apiKey) ?? options.apiKey\n const apiUrl = takeString(sb.apiUrl) ?? options.apiUrl\n const target = takeString(sb.target) ?? options.target\n const connectId = takeString(sb.sandboxId) ?? options.sandboxId\n const envVars = resolveDaytonaEnv(options.env, config.env)\n\n const daytona = new Daytona(toClientConfig(apiKey, apiUrl, target))\n const attached = connectId !== undefined\n // Lifecycle ownership drives `destroy()` (onDestroy). A created sandbox is\n // always owned; an attached one is owned only when the host opts in via\n // `ownAttached`. Spawn-FAILURE cleanup is separate (see below) and keyed\n // on `!attached` so a pre-existing sandbox is never auto-deleted.\n const owned = !attached || options.ownAttached === true\n const sandbox = attached\n ? await daytona.get(connectId)\n : await daytona.create(resolveDaytonaCreateParams(sb, options, envVars))\n\n if (attached)\n await startAttachedSandboxIfNeeded(sandbox)\n\n live.set(sandbox.id, { sandbox, env: envVars, owned })\n\n try {\n await waitForDaytonaReady(sandbox, logger, {\n timeoutSeconds: readinessTimeoutSeconds,\n // Only auto-delete a sandbox we CREATED on readiness failure — never a\n // pre-existing attached one, even when we own its lifecycle.\n ...(!attached ? { cleanupOnTimeout: () => deleteOwnedSandbox(sandbox) } : {}),\n })\n }\n catch (err) {\n live.delete(sandbox.id)\n throw err\n }\n\n const requestedCwd = config.cwd ?? options.cwd\n let cwd: string\n if (requestedCwd) {\n cwd = requestedCwd\n await sandbox.process.executeCommand(`mkdir -p ${JSON.stringify(cwd)}`).catch(() => {})\n }\n else if (sandbox.getWorkDir) {\n cwd = await sandbox.getWorkDir().catch(() => '')\n if (!cwd)\n cwd = await sandbox.process.executeCommand('pwd').then(r => normalizeDaytonaExecResult(r).stdout.trim()).catch(() => '') || '/home/daytona'\n }\n else {\n cwd = await sandbox.process.executeCommand('pwd').then(r => normalizeDaytonaExecResult(r).stdout.trim()).catch(() => '') || '/home/daytona'\n }\n\n if (options.pregame) {\n try {\n await runDaytonaPregame(sandbox, logger, { name: options.pregame.name, content: options.pregame.content, cwd, envVars })\n }\n catch (err) {\n // Spawn-failure cleanup: only delete a sandbox we created, never a\n // pre-existing attached one (the host owns its prior state).\n if (!attached)\n await deleteOwnedSandbox(sandbox)\n live.delete(sandbox.id)\n throw err\n }\n }\n\n return { id: sandbox.id, cwd }\n },\n\n async exec(sandboxId, command, opts): Promise<ExecResult> {\n const { sandbox, env } = get(sandboxId)\n const timeoutSeconds = opts?.timeout ?? 30\n try {\n // The SDK buffers the streams uncapped (see the KNOWN RESIDUAL note\n // on `ExecutionContext.fileSize`) — cap host-side before the strings\n // propagate into tool results and session history.\n return capExecResult(normalizeDaytonaExecResult(\n await sandbox.process.executeCommand(\n command,\n opts?.cwd,\n resolveDaytonaEnv(env, opts?.env),\n timeoutSeconds > 0 ? timeoutSeconds : undefined,\n ),\n ))\n }\n catch (err) {\n return capExecResult(normalizeDaytonaExecError(err))\n }\n },\n\n /**\n * Live bidirectional stream — see `ExecutionContext.execStream`.\n *\n * PTY-backed, and not by preference: Daytona's process + session API\n * exposes no stdin at all (sessions are fire-and-forget with log\n * streaming), so a pseudo-terminal is the only interactive channel the\n * platform offers. That forces three mitigations, all in the launch\n * wrapper below, because a PTY is a terminal and a protocol stream is\n * not:\n *\n * 1. `stty -echo` — a terminal echoes everything written to stdin back\n * onto stdout. Without this the caller reads its own requests back\n * as if they were responses.\n * 2. `stty raw` — canonical mode rewrites `\\n`→`\\r\\n` and caps a line\n * at ~4096 bytes. Protocol frames routinely exceed that and would\n * be silently truncated mid-message.\n * 3. `2><file>` — a PTY has ONE stream, so the child's stderr would\n * otherwise interleave into the protocol data and corrupt framing.\n * It is redirected to a file inside the sandbox and surfaced on the\n * returned handle by polling that file through the exec API.\n *\n * The mitigations must run before the child's first byte — but the\n * launch line ITSELF is typed into a canonical-mode terminal, so it is\n * echoed once (a short non-JSON line the transport's tolerant framing\n * discards) and subject to the ~4096-byte line cap. That is why the\n * real command lives in an uploaded script and the typed line stays\n * short and constant: a long command line would be truncated before\n * `stty` ever ran. The script also restores `sh` compound-command\n * semantics that a bare `exec <command>` would break.\n */\n async execStream(sandboxId, command, opts): Promise<StreamHandle> {\n const { sandbox, env } = get(sandboxId)\n\n if (!sandbox.process.createPty) {\n throw new Error(\n 'Daytona SDK is too old: `process.createPty` is required for execStream '\n + '(used to run stdio MCP servers inside the sandbox).',\n )\n }\n\n opts?.signal?.throwIfAborted()\n\n const token = Math.random().toString(36).slice(2, 10)\n const stderrPath = `/tmp/.zidane-stream-${token}.err`\n const scriptPath = `/tmp/.zidane-stream-${token}.sh`\n\n // `exec 2>` rebinds the shell's stderr before the command runs, so\n // the command text needs no rewriting and stays compound-safe.\n await sandbox.fs.uploadFile(\n Buffer.from(`exec 2>${stderrPath}\\n${command}\\n`),\n scriptPath,\n )\n\n // See the E2B counterpart: the PTY's `onData` is a sync `void`\n // callback, so a stalled consumer can only be reported, never slowed.\n const warnBacklog = (which: string) => (bytes: number) =>\n logger.warn('execStream consumer is not draining output', { sandboxId, stream: which, bufferedBytes: bytes })\n const stdout = new StreamQueue(warnBacklog('stdout'))\n const stderr = new StreamQueue(warnBacklog('stderr'))\n\n // Everything the shell emits before the child is actually running is\n // NOISE that must never reach the caller: the echo of our own launch\n // line (typed before `-echo` takes effect), the login shell's prompt,\n // and its line-editor redraw escapes. `createPty` is `lazyStart`, so\n // the shell frequently does not exist yet when we type — it boots\n // afterwards and REPLAYS the buffered input through its line editor.\n // Observed on a stock sandbox: the stream opened with the echoed\n // launch line, the echoed first request, `\\u001b[?2004h` bracketed\n // paste, and a `%` prompt. An MCP client parses that echoed request\n // as a message and the handshake collapses.\n //\n // So: gate the stream on a sentinel the CHILD side prints, and drop\n // every byte before it. The sentinel is assembled by `printf` at\n // runtime (`Z-%s-READY` + token) so the echoed *source* line, which\n // contains the format string rather than the result, cannot match it.\n const sentinel = `Z-${token}-READY`\n let gateOpen = false\n let gateBuffer = ''\n let openGate: () => void = () => {}\n const gateReady = new Promise<void>((r) => { openGate = r })\n\n const pty = await sandbox.process.createPty({\n id: `zidane-stream-${token}`,\n ...(opts?.cwd ? { cwd: opts.cwd } : {}),\n envs: resolveDaytonaEnv(env, opts?.env) ?? {},\n onData: (data: Uint8Array) => {\n if (gateOpen) {\n stdout.push(data)\n return\n }\n gateBuffer += Buffer.from(data).toString('utf8')\n const at = gateBuffer.indexOf(sentinel)\n if (at === -1) {\n // Bounded: never let pre-gate noise grow without limit, but keep\n // a tail longer than the sentinel so it can't be split away.\n if (gateBuffer.length > 64 * 1024)\n gateBuffer = gateBuffer.slice(-1024)\n return\n }\n gateOpen = true\n openGate()\n // Everything after the sentinel's trailing newline is real output.\n const rest = gateBuffer.slice(at + sentinel.length).replace(/^\\r?\\n/, '')\n gateBuffer = ''\n if (rest.length > 0)\n stdout.push(new TextEncoder().encode(rest))\n },\n })\n await pty.waitForConnection()\n\n // Short, constant, and under any canonical line cap. `exec` replaces\n // the login shell so the PTY's lifetime is the script's lifetime and\n // no shell prompt can reach stdout.\n await pty.sendInput(`stty raw -echo; printf 'Z-%s-READY\\\\n' ${token}; exec sh ${scriptPath}\\n`)\n\n // Block until the child is genuinely live. Without this the caller can\n // write its first frame into a shell that hasn't started, where it is\n // echoed back and misread as a response.\n let gateTimer: ReturnType<typeof setTimeout> | undefined\n await Promise.race([\n gateReady,\n new Promise<void>((r) => { gateTimer = setTimeout(r, 30_000) }),\n ])\n clearTimeout(gateTimer)\n if (!gateOpen) {\n // Full teardown, not just a disconnect: Daytona PTY sessions persist\n // server-side after the websocket drops, so a bare disconnect leaks\n // one login shell plus two /tmp files per attempt — a bootstrap\n // retry loop against a broken image would stack them until the\n // sandbox dies.\n await (pty.kill?.() ?? Promise.resolve()).catch(() => {})\n await pty.disconnect().catch(() => {})\n await sandbox.process.executeCommand(`rm -f ${scriptPath} ${stderrPath}`).catch(() => {})\n throw new Error(\n `Daytona execStream: PTY did not reach the ready sentinel within 30s `\n + `(sandbox ${sandboxId}). The login shell may not have started.`,\n )\n }\n\n // stderr file → handle.stderr. Poll rather than stream: the exec API\n // is the only other channel into the sandbox, and diagnostics don't\n // need latency. Byte offsets keep re-reads incremental.\n //\n // The offset comes from the FILE (`wc -c`), never from measuring the\n // returned content: an exec API that trims a trailing newline from\n // command output would make a content-derived offset under-advance by\n // one byte per poll, re-emitting the tail byte forever. The size rides\n // back on the same round trip as a `ZEOF-<token>:` suffix; content is\n // whatever precedes it, so content-side transforms can't drift the\n // cursor either.\n let stderrOffset = 0\n let torndown = false\n const eofMark = `ZEOF-${token}:`\n const drainStderr = async (): Promise<void> => {\n try {\n const res = normalizeDaytonaExecResult(await sandbox.process.executeCommand(\n `tail -c +${stderrOffset + 1} ${stderrPath} 2>/dev/null; printf '${eofMark}%s' \"$(wc -c < ${stderrPath} 2>/dev/null || echo 0)\"`,\n ))\n const at = res.stdout.lastIndexOf(eofMark)\n if (at === -1)\n return\n const content = res.stdout.slice(0, at)\n const size = Number.parseInt(res.stdout.slice(at + eofMark.length).trim(), 10)\n if (content.length > 0)\n stderr.push(new TextEncoder().encode(content))\n if (Number.isFinite(size) && size > stderrOffset)\n stderrOffset = size\n }\n catch {\n // Diagnostic channel — polling failures must never surface as\n // protocol errors.\n }\n }\n const stderrTimer = setInterval(() => { void drainStderr() }, 2000)\n // Guarded: Bun/Node timers support unref, test fakes may not.\n ;(stderrTimer as { unref?: () => void }).unref?.()\n\n // Shared teardown for both exit paths (natural exit and kill): one\n // final stderr drain so a crash message isn't lost, then remove the\n // script + stderr files that would otherwise accumulate in /tmp for\n // the sandbox's lifetime.\n const teardown = async (): Promise<void> => {\n if (torndown)\n return\n torndown = true\n clearInterval(stderrTimer)\n await drainStderr()\n await sandbox.process.executeCommand(`rm -f ${scriptPath} ${stderrPath}`).catch(() => {})\n stdout.close()\n stderr.close()\n }\n\n const exited = pty.wait()\n .then(result => result?.exitCode ?? 0)\n .catch(() => 137)\n .finally(teardown)\n\n const kill = async (): Promise<void> => {\n // A PTY login shell never exits on its own — killing it IS the\n // normal termination path here, not an error path.\n await (pty.kill?.() ?? Promise.resolve()).catch(() => {})\n await pty.disconnect().catch(() => {})\n await teardown()\n }\n\n if (opts?.signal) {\n if (opts.signal.aborted) {\n void kill()\n }\n else {\n // Detach on exit — the (typically run-long) signal otherwise\n // retains the `kill` closure and the PTY handle for the rest of\n // the run, one dead closure per exec.\n const onAbort = () => { void kill() }\n const detach = () => opts.signal!.removeEventListener('abort', onAbort)\n opts.signal.addEventListener('abort', onAbort, { once: true })\n exited.then(detach, detach)\n }\n }\n\n return {\n pid: pty.pid ?? -1,\n stdout,\n stderr,\n write: async (data: Uint8Array): Promise<void> => {\n await pty.sendInput(data)\n },\n kill,\n exited,\n }\n },\n\n async readFile(sandboxId, path): Promise<string> {\n return bufferToString(await get(sandboxId).sandbox.fs.downloadFile(path))\n },\n\n async writeFile(sandboxId, path, content): Promise<void> {\n await get(sandboxId).sandbox.fs.uploadFile(Buffer.from(content), path)\n },\n\n async listFiles(sandboxId, path): Promise<string[]> {\n const entries = await get(sandboxId).sandbox.fs.listFiles(path)\n // Trailing `/` on directories — parity with process/docker contexts.\n return entries.map(e => (e.isDir ? `${e.name}/` : e.name))\n },\n\n async destroy(sandboxId): Promise<void> {\n const entry = live.get(sandboxId)\n if (!entry)\n return\n if (entry.owned) {\n const action = options.onDestroy ?? 'delete'\n if (action === 'stop' || action === 'pause')\n await stopOwnedSandbox(entry.sandbox)\n else if (action === 'archive')\n await archiveOwnedSandbox(entry.sandbox)\n else if (action === 'delete' || action === 'kill')\n await deleteOwnedSandbox(entry.sandbox)\n }\n live.delete(sandboxId)\n },\n }\n}\n"],"mappings":";;;;;;;AAgMA,MAAM,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AM;GAC5B;GAGF,OAAO;IACL,KAAK,IAAI,OAAO;IAChB;IACA;IACA,OAAO,OAAO,SAAoC;KAChD,MAAM,IAAI,UAAU,IAAI;IAC1B;IACA;IACA;GACF;EACF;EAEA,MAAM,SAAS,WAAW,MAAuB;GAC/C,OAAO,eAAe,MAAM,IAAI,SAAS,CAAC,CAAC,QAAQ,GAAG,aAAa,IAAI,CAAC;EAC1E;EAEA,MAAM,UAAU,WAAW,MAAM,SAAwB;GACvD,MAAM,IAAI,SAAS,CAAC,CAAC,QAAQ,GAAG,WAAW,OAAO,KAAK,OAAO,GAAG,IAAI;EACvE;EAEA,MAAM,UAAU,WAAW,MAAyB;GAGlD,QAAO,MAFe,IAAI,SAAS,CAAC,CAAC,QAAQ,GAAG,UAAU,IAAI,EAAA,CAE/C,KAAI,MAAM,EAAE,QAAQ,GAAG,EAAE,KAAK,KAAK,EAAE,IAAK;EAC3D;EAEA,MAAM,QAAQ,WAA0B;GACtC,MAAM,QAAQ,KAAK,IAAI,SAAS;GAChC,IAAI,CAAC,OACH;GACF,IAAI,MAAM,OAAO;IACf,MAAM,SAAS,QAAQ,aAAa;IACpC,IAAI,WAAW,UAAU,WAAW,SAClC,MAAM,iBAAiB,MAAM,OAAO;SACjC,IAAI,WAAW,WAClB,MAAM,oBAAoB,MAAM,OAAO;SACpC,IAAI,WAAW,YAAY,WAAW,QACzC,MAAM,mBAAmB,MAAM,OAAO;GAC1C;GACA,KAAK,OAAO,SAAS;EACvB;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"daytona.js","names":[],"sources":["../../src/contexts/daytona.ts"],"sourcesContent":["/**\n * Daytona sandbox provider.\n *\n * Implements {@link SandboxProvider} on top of Daytona sandboxes. Pair it with\n * {@link createSandboxContext} to run an agent's shell + filesystem tools\n * inside a Daytona sandbox:\n *\n * ```ts\n * import { createSandboxContext } from 'zidane/contexts'\n * import { createDaytonaProvider } from 'zidane/contexts/daytona'\n *\n * const execution = createSandboxContext(createDaytonaProvider())\n * ```\n *\n * Requires `@daytona/sdk` as an optional peer dependency:\n * `bun add @daytona/sdk`.\n */\n\nimport type { Logger } from '../logger'\nimport type { SandboxProvider } from './sandbox'\nimport type { ExecResult, SpawnConfig, StreamHandle } from './types'\nimport { Buffer } from 'node:buffer'\nimport { errorMessage } from '../errors'\nimport { consoleSink, createLogger } from '../logger'\nimport { capBufferedExecOutput } from './output-cap'\nimport { StreamQueue } from './stream-queue'\n\n// ---------------------------------------------------------------------------\n// Minimal structural views of the `@daytona/sdk` surface we touch. Declared\n// locally so zidane typechecks without the optional peer dependency installed.\n// ---------------------------------------------------------------------------\n\ninterface DaytonaExecuteResponse {\n exitCode?: number | null\n result?: string | null\n output?: string | null\n stdout?: string | null\n stderr?: string | null\n artifacts?: { stdout?: string | null }\n}\n\ninterface DaytonaFileEntry {\n name: string\n /** Present in the Daytona SDK's FileInfo; used for the `/` dir suffix. */\n isDir?: boolean\n}\n\n/**\n * Structural subset of Daytona's `PtyHandle`.\n *\n * Daytona's process/session API has NO stdin channel at all — sessions are\n * fire-and-forget with log streaming — so a PTY is the only way to reach a\n * long-lived process interactively. See the `execStream` implementation for\n * what that costs.\n */\ninterface DaytonaPtyHandle {\n pid?: number\n waitForConnection: () => Promise<unknown>\n sendInput: (data: string | Uint8Array) => Promise<unknown>\n wait: () => Promise<{ exitCode?: number }>\n kill?: () => Promise<unknown>\n disconnect: () => Promise<unknown>\n}\n\ninterface DaytonaSandbox {\n id: string\n state?: string\n process: {\n executeCommand: (command: string, cwd?: string, env?: Record<string, string>, timeout?: number) => Promise<DaytonaExecuteResponse>\n /** Present in recent SDKs; only `execStream` uses it. */\n createPty?: (options: {\n /**\n * REQUIRED by the API despite reading like a convenience handle: the\n * SDK forwards it as the session id and the control plane rejects the\n * create with 400 `session ID is required` when it is absent.\n */\n id: string\n cwd?: string\n envs?: Record<string, string>\n onData?: (data: Uint8Array) => void\n }) => Promise<DaytonaPtyHandle>\n }\n fs: {\n /**\n * A Node Buffer, not a bare Uint8Array — that is what the SDK declares and\n * what its download path actually materializes (`Buffer.concat` over the\n * response parts), so `readFile` decodes with `.toString('utf8')` instead\n * of guarding a union. Leaning on that is only safe because the\n * `@daytona/sdk` peer range pins `^0.187.0`: this interface is a\n * hand-rolled structural type over a lazily-imported SDK, so a wider\n * install returning a plain Uint8Array would decode to \"104,101,…\"\n * at runtime with nothing failing at compile time.\n */\n downloadFile: (path: string) => Promise<Buffer>\n uploadFile: (content: Uint8Array | Buffer, path: string) => Promise<unknown>\n listFiles: (path: string) => Promise<DaytonaFileEntry[]>\n }\n getWorkDir?: () => Promise<string>\n start?: (timeout?: number) => Promise<unknown>\n delete: (timeout?: number) => Promise<unknown>\n stop?: (timeout?: number) => Promise<unknown>\n archive?: () => Promise<unknown>\n}\n\ninterface DaytonaClientConfig {\n apiKey?: string\n apiUrl?: string\n target?: string\n}\n\ninterface DaytonaResources {\n cpu?: number\n memory?: number\n disk?: number\n gpu?: number\n [key: string]: unknown\n}\n\ninterface DaytonaCreateParams {\n language?: string\n snapshot?: string\n image?: unknown\n resources?: DaytonaResources\n envVars?: Record<string, string>\n [key: string]: unknown\n}\n\ninterface DaytonaClient {\n create: (params?: DaytonaCreateParams) => Promise<DaytonaSandbox>\n get: (sandboxIdOrName: string) => Promise<DaytonaSandbox>\n}\n\ntype DaytonaConstructor = new (config?: DaytonaClientConfig) => DaytonaClient\n\n// ---------------------------------------------------------------------------\n// Provider options\n// ---------------------------------------------------------------------------\n\nexport type DaytonaOnDestroy = 'delete' | 'kill' | 'stop' | 'pause' | 'archive' | 'leave'\n\nexport interface DaytonaProviderOptions {\n /** Daytona API key. Falls back to the `DAYTONA_API_KEY` env var when omitted. */\n apiKey?: string\n /** Daytona API URL. Falls back to `DAYTONA_API_URL`, then Daytona's hosted default. */\n apiUrl?: string\n /** Daytona target / region. Falls back to `DAYTONA_TARGET`, then the org default. */\n target?: string\n /**\n * Attach to a pre-existing sandbox by id or name instead of creating a fresh\n * one. By default the provider treats attached sandboxes as externally owned\n * and leaves them running on destroy/failure (set {@link ownAttached} to take\n * over the lifecycle).\n */\n sandboxId?: string\n /**\n * Take ownership of an attached ({@link sandboxId}) sandbox's lifecycle, so\n * `destroy()` applies {@link onDestroy} to it (stop / archive / delete)\n * instead of leaving it running.\n *\n * The intended caller is a durable host that *owns* the sandbox across\n * invocations: mint it once, journal its id, re-attach via `sandboxId` on\n * every replay/resume, and clean it up at the end of the logical run. Without\n * this an attached sandbox can never be stopped/deleted through the provider —\n * a leak for host-owned sandboxes. No effect when creating a fresh sandbox\n * (those are always owned). Spawn-time failures (readiness timeout, pregame\n * error) still never delete a pre-existing attached sandbox — only sandboxes\n * this provider *created* are auto-cleaned on spawn failure.\n *\n * Default: `false`.\n */\n ownAttached?: boolean\n /** Daytona snapshot used when creating a fresh sandbox. */\n snapshot?: string\n /** Runtime used for Daytona's code tooling. Shell execution works either way. */\n language?: string\n /** Daytona image/declarative builder input used when creating a fresh sandbox. */\n image?: unknown\n /** Daytona sandbox resources. */\n resources?: DaytonaResources\n /** Default working directory, applied when a spawn doesn't set `SpawnConfig.cwd`. */\n cwd?: string\n /** Environment variables baked into the sandbox and re-sent on every command. */\n env?: Record<string, string>\n /** Logger for provider-level lifecycle lines. */\n logger?: Logger\n /** Total deadline, in seconds, for the post-create readiness probe. Defaults to `60`. */\n readinessTimeoutSeconds?: number\n /** Setup script to upload and run once the sandbox is ready. */\n pregame?: { name: string, content: string }\n /**\n * What to do with an owned sandbox on destroy:\n *\n * - `'delete'` / `'kill'` (default) — call `sandbox.delete()`.\n * - `'stop'` / `'pause'` — call `sandbox.stop()` so Daytona preserves state\n * according to the runner's stop semantics.\n * - `'archive'` — stop, then archive for longer-term persistence.\n * - `'leave'` — make no API call.\n */\n onDestroy?: DaytonaOnDestroy\n}\n\n/** Per-probe timeout for the readiness `true` command. */\nconst READINESS_PROBE_TIMEOUT_SECONDS = 5\n/** Pause between readiness probes while the sandbox is still warming up. */\nconst READINESS_BACKOFF_MS = 250\n/** Setup scripts commonly install dependencies, so give them a generous cap. */\nconst PREGAME_TIMEOUT_SECONDS = 30 * 60\n\nexport interface DaytonaReadinessOptions {\n /** Total deadline in seconds. `<= 0` disables the probe entirely. */\n timeoutSeconds: number\n /** Optional cleanup for owned sandboxes that never become ready. */\n cleanupOnTimeout?: () => Promise<void>\n /** Clock source — injectable for deterministic tests. */\n now?: () => number\n /** Sleep between probes — injectable for deterministic tests. */\n sleep?: (ms: number) => Promise<void>\n}\n\nexport function resolveDaytonaEnv(\n optionEnv: Record<string, string> | undefined,\n perSpawnEnv: Record<string, string> | undefined,\n): Record<string, string> | undefined {\n const merged = { ...optionEnv, ...perSpawnEnv }\n return Object.keys(merged).length > 0 ? merged : undefined\n}\n\nexport function normalizeDaytonaExecResult(response: DaytonaExecuteResponse): ExecResult {\n return {\n stdout: response.stdout ?? response.artifacts?.stdout ?? response.result ?? response.output ?? '',\n stderr: response.stderr ?? '',\n exitCode: typeof response.exitCode === 'number' ? response.exitCode : 0,\n }\n}\n\nfunction capExecResult(result: ExecResult): ExecResult {\n return { ...capBufferedExecOutput(result.stdout, result.stderr), exitCode: result.exitCode }\n}\n\nfunction normalizeDaytonaExecError(error: unknown): ExecResult {\n const err = error as { exitCode?: unknown, stdout?: unknown, stderr?: unknown, result?: unknown, output?: unknown, message?: unknown }\n if (typeof err.exitCode === 'number') {\n return {\n stdout: typeof err.stdout === 'string'\n ? err.stdout\n : typeof err.result === 'string'\n ? err.result\n : typeof err.output === 'string'\n ? err.output\n : '',\n stderr: typeof err.stderr === 'string' ? err.stderr : typeof err.message === 'string' ? err.message : '',\n exitCode: err.exitCode,\n }\n }\n return { stdout: '', stderr: error instanceof Error ? error.message : String(error), exitCode: 124 }\n}\n\nfunction toClientConfig(apiKey?: string, apiUrl?: string, target?: string): DaytonaClientConfig | undefined {\n const config: DaytonaClientConfig = {}\n if (apiKey !== undefined)\n config.apiKey = apiKey\n if (apiUrl !== undefined)\n config.apiUrl = apiUrl\n if (target !== undefined)\n config.target = target\n return Object.keys(config).length > 0 ? config : undefined\n}\n\nfunction takeString(value: unknown): string | undefined {\n return typeof value === 'string' && value.length > 0 ? value : undefined\n}\n\nexport function resolveDaytonaCreateParams(\n sandboxConfig: Record<string, unknown>,\n options: DaytonaProviderOptions,\n envVars: Record<string, string> | undefined,\n): DaytonaCreateParams | undefined {\n const reserved = new Set(['provider', 'apiKey', 'apiUrl', 'target', 'sandboxId'])\n const params: DaytonaCreateParams = {}\n\n for (const [key, value] of Object.entries(sandboxConfig)) {\n if (!reserved.has(key) && value !== undefined)\n params[key] = value\n }\n\n const language = takeString(sandboxConfig.language) ?? options.language\n const snapshot = takeString(sandboxConfig.snapshot) ?? options.snapshot\n const image = sandboxConfig.image ?? options.image\n const resources = (sandboxConfig.resources as DaytonaResources | undefined) ?? options.resources\n const configEnvVars = sandboxConfig.envVars as Record<string, string> | undefined\n const mergedEnvVars = resolveDaytonaEnv(envVars, configEnvVars)\n\n if (language !== undefined)\n params.language = language\n if (snapshot !== undefined)\n params.snapshot = snapshot\n if (image !== undefined)\n params.image = image\n if (resources !== undefined)\n params.resources = resources\n if (mergedEnvVars !== undefined)\n params.envVars = mergedEnvVars\n\n return Object.keys(params).length > 0 ? params : undefined\n}\n\nexport async function waitForDaytonaReady(\n sandbox: DaytonaSandbox,\n logger: Logger,\n opts: DaytonaReadinessOptions,\n): Promise<void> {\n if (opts.timeoutSeconds <= 0)\n return\n\n const now = opts.now ?? Date.now\n const sleep = opts.sleep ?? (ms => new Promise<void>(resolve => setTimeout(resolve, ms)))\n const start = now()\n const deadline = start + opts.timeoutSeconds * 1000\n\n logger.info('waiting for Daytona sandbox to initialize', { sandboxId: sandbox.id })\n\n while (true) {\n try {\n await sandbox.process.executeCommand('true', undefined, undefined, READINESS_PROBE_TIMEOUT_SECONDS)\n logger.info('Daytona sandbox ready', { sandboxId: sandbox.id, elapsedMs: now() - start })\n return\n }\n catch {\n if (now() >= deadline) {\n await opts.cleanupOnTimeout?.().catch(() => {})\n throw new Error(`Daytona sandbox ${sandbox.id} did not become ready within ${opts.timeoutSeconds}s`)\n }\n await sleep(READINESS_BACKOFF_MS)\n }\n }\n}\n\nexport async function runDaytonaPregame(\n sandbox: DaytonaSandbox,\n logger: Logger,\n opts: { name: string, content: string, cwd?: string, envVars?: Record<string, string> },\n): Promise<void> {\n const path = `/tmp/${opts.name}`\n logger.info('running Daytona pregame script', { sandboxId: sandbox.id, path })\n await sandbox.fs.uploadFile(Buffer.from(opts.content), path)\n\n const quoted = JSON.stringify(path)\n let result: ExecResult\n try {\n result = normalizeDaytonaExecResult(\n await sandbox.process.executeCommand(`chmod +x ${quoted} && ${quoted}`, opts.cwd, opts.envVars, PREGAME_TIMEOUT_SECONDS),\n )\n }\n catch (err) {\n result = normalizeDaytonaExecError(err)\n }\n\n if (result.exitCode !== 0) {\n logger.error('Daytona pregame script failed', { sandboxId: sandbox.id, exitCode: result.exitCode, stdout: result.stdout, stderr: result.stderr })\n throw new Error(`Daytona pregame script ${opts.name} failed with exit code ${result.exitCode}`)\n }\n\n logger.info('Daytona pregame ready', { sandboxId: sandbox.id, stdout: result.stdout, stderr: result.stderr })\n}\n\n// ---------------------------------------------------------------------------\n// Provider\n// ---------------------------------------------------------------------------\n\nexport function createDaytonaProvider(options: DaytonaProviderOptions = {}): SandboxProvider {\n const live = new Map<string, { sandbox: DaytonaSandbox, env?: Record<string, string>, owned: boolean }>()\n const logger = options.logger ?? createLogger(consoleSink())\n const readinessTimeoutSeconds = options.readinessTimeoutSeconds ?? 60\n\n async function loadSdk(): Promise<DaytonaConstructor> {\n try {\n const mod = await import('@daytona/sdk') as { Daytona: DaytonaConstructor }\n return mod.Daytona\n }\n catch (err) {\n // Distinguish \"not installed\" from \"installed but failed to load\". This\n // used to be a bare `catch` that reported the install hint either way,\n // which sent people to `bun add` a package that was already present. The\n // realistic load failure is a `tslib` hoist: `@daytona/sdk` declares no\n // tslib dependency of its own and reaches AWS SDK v3 through\n // `@aws-sdk/client-s3`, so a stale `@aws-crypto` v3/v4 floor\n // (`tslib: ^1.11.1`) can win the hoist and the SDK's initializer helpers\n // resolve against tslib 1.x, which lacks them. Fix with a root\n // `overrides: { \"tslib\": \"^2.8.1\" }` — see `docs/RESTATE.md`.\n const message = errorMessage(err)\n const notInstalled = /cannot find (?:module|package)|module not found|failed to resolve/i.test(message)\n throw new Error(\n notInstalled\n ? '@daytona/sdk is required for the Daytona sandbox provider. Install it with: bun add @daytona/sdk'\n : `@daytona/sdk is installed but failed to load: ${message}. If this mentions tslib, pin it with a root override: \"overrides\": { \"tslib\": \"^2.8.1\" } — see docs/RESTATE.md.`,\n { cause: err },\n )\n }\n }\n\n function get(sandboxId: string): { sandbox: DaytonaSandbox, env?: Record<string, string>, owned: boolean } {\n const entry = live.get(sandboxId)\n if (!entry)\n throw new Error(`Daytona sandbox ${sandboxId} is not tracked by this provider`)\n return entry\n }\n\n async function deleteOwnedSandbox(sandbox: DaytonaSandbox): Promise<void> {\n try {\n await sandbox.delete()\n }\n catch {\n // Already gone — nothing to clean up.\n }\n }\n\n async function stopOwnedSandbox(sandbox: DaytonaSandbox): Promise<void> {\n if (!sandbox.stop) {\n logger.error('cannot stop Daytona sandbox: this @daytona/sdk install exposes no stop() method; leaving it running', { sandboxId: sandbox.id })\n return\n }\n try {\n await sandbox.stop()\n logger.info('stopped Daytona sandbox; reconnect later via the sandboxId option (CLI: --sandbox)', { sandboxId: sandbox.id })\n }\n catch (err) {\n logger.error('failed to stop Daytona sandbox; it will run until Daytona lifecycle policy stops it', { sandboxId: sandbox.id, error: err instanceof Error ? err.message : String(err) })\n }\n }\n\n async function archiveOwnedSandbox(sandbox: DaytonaSandbox): Promise<void> {\n if (!sandbox.stop || !sandbox.archive) {\n logger.error('cannot archive Daytona sandbox: this @daytona/sdk install exposes no stop() and archive() pair; leaving it running', { sandboxId: sandbox.id })\n return\n }\n try {\n await sandbox.stop()\n await sandbox.archive()\n logger.info('archived Daytona sandbox; reconnect later via the sandboxId option (CLI: --sandbox)', { sandboxId: sandbox.id })\n }\n catch (err) {\n logger.error('failed to archive Daytona sandbox; it will run until Daytona lifecycle policy stops it', { sandboxId: sandbox.id, error: err instanceof Error ? err.message : String(err) })\n }\n }\n\n async function startAttachedSandboxIfNeeded(sandbox: DaytonaSandbox): Promise<void> {\n if (sandbox.state !== 'stopped' && sandbox.state !== 'archived')\n return\n if (!sandbox.start) {\n logger.error('cannot start Daytona sandbox before attach readiness probe: this @daytona/sdk install exposes no start() method', { sandboxId: sandbox.id, state: sandbox.state })\n return\n }\n logger.info('starting Daytona sandbox before attach readiness probe', { sandboxId: sandbox.id, state: sandbox.state })\n await sandbox.start(readinessTimeoutSeconds > 0 ? readinessTimeoutSeconds : undefined)\n }\n\n return {\n name: 'daytona',\n\n async spawn(config: SpawnConfig = {}): Promise<{ id: string, cwd: string }> {\n const Daytona = await loadSdk()\n const sb: Record<string, unknown> = config.sandbox ?? {}\n\n const apiKey = takeString(sb.apiKey) ?? options.apiKey\n const apiUrl = takeString(sb.apiUrl) ?? options.apiUrl\n const target = takeString(sb.target) ?? options.target\n const connectId = takeString(sb.sandboxId) ?? options.sandboxId\n const envVars = resolveDaytonaEnv(options.env, config.env)\n\n const daytona = new Daytona(toClientConfig(apiKey, apiUrl, target))\n const attached = connectId !== undefined\n // Lifecycle ownership drives `destroy()` (onDestroy). A created sandbox is\n // always owned; an attached one is owned only when the host opts in via\n // `ownAttached`. Spawn-FAILURE cleanup is separate (see below) and keyed\n // on `!attached` so a pre-existing sandbox is never auto-deleted.\n const owned = !attached || options.ownAttached === true\n const sandbox = attached\n ? await daytona.get(connectId)\n : await daytona.create(resolveDaytonaCreateParams(sb, options, envVars))\n\n if (attached)\n await startAttachedSandboxIfNeeded(sandbox)\n\n live.set(sandbox.id, { sandbox, env: envVars, owned })\n\n try {\n await waitForDaytonaReady(sandbox, logger, {\n timeoutSeconds: readinessTimeoutSeconds,\n // Only auto-delete a sandbox we CREATED on readiness failure — never a\n // pre-existing attached one, even when we own its lifecycle.\n ...(!attached ? { cleanupOnTimeout: () => deleteOwnedSandbox(sandbox) } : {}),\n })\n }\n catch (err) {\n live.delete(sandbox.id)\n throw err\n }\n\n const requestedCwd = config.cwd ?? options.cwd\n let cwd: string\n if (requestedCwd) {\n cwd = requestedCwd\n await sandbox.process.executeCommand(`mkdir -p ${JSON.stringify(cwd)}`).catch(() => {})\n }\n else if (sandbox.getWorkDir) {\n cwd = await sandbox.getWorkDir().catch(() => '')\n if (!cwd)\n cwd = await sandbox.process.executeCommand('pwd').then(r => normalizeDaytonaExecResult(r).stdout.trim()).catch(() => '') || '/home/daytona'\n }\n else {\n cwd = await sandbox.process.executeCommand('pwd').then(r => normalizeDaytonaExecResult(r).stdout.trim()).catch(() => '') || '/home/daytona'\n }\n\n if (options.pregame) {\n try {\n await runDaytonaPregame(sandbox, logger, { name: options.pregame.name, content: options.pregame.content, cwd, envVars })\n }\n catch (err) {\n // Spawn-failure cleanup: only delete a sandbox we created, never a\n // pre-existing attached one (the host owns its prior state).\n if (!attached)\n await deleteOwnedSandbox(sandbox)\n live.delete(sandbox.id)\n throw err\n }\n }\n\n return { id: sandbox.id, cwd }\n },\n\n async exec(sandboxId, command, opts): Promise<ExecResult> {\n const { sandbox, env } = get(sandboxId)\n const timeoutSeconds = opts?.timeout ?? 30\n try {\n // The SDK buffers the streams uncapped (see the KNOWN RESIDUAL note\n // on `ExecutionContext.fileSize`) — cap host-side before the strings\n // propagate into tool results and session history.\n return capExecResult(normalizeDaytonaExecResult(\n await sandbox.process.executeCommand(\n command,\n opts?.cwd,\n resolveDaytonaEnv(env, opts?.env),\n timeoutSeconds > 0 ? timeoutSeconds : undefined,\n ),\n ))\n }\n catch (err) {\n return capExecResult(normalizeDaytonaExecError(err))\n }\n },\n\n /**\n * Live bidirectional stream — see `ExecutionContext.execStream`.\n *\n * PTY-backed, and not by preference: Daytona's process + session API\n * exposes no stdin at all (sessions are fire-and-forget with log\n * streaming), so a pseudo-terminal is the only interactive channel the\n * platform offers. That forces three mitigations, all in the launch\n * wrapper below, because a PTY is a terminal and a protocol stream is\n * not:\n *\n * 1. `stty -echo` — a terminal echoes everything written to stdin back\n * onto stdout. Without this the caller reads its own requests back\n * as if they were responses.\n * 2. `stty raw` — canonical mode rewrites `\\n`→`\\r\\n` and caps a line\n * at ~4096 bytes. Protocol frames routinely exceed that and would\n * be silently truncated mid-message.\n * 3. `2><file>` — a PTY has ONE stream, so the child's stderr would\n * otherwise interleave into the protocol data and corrupt framing.\n * It is redirected to a file inside the sandbox and surfaced on the\n * returned handle by polling that file through the exec API.\n *\n * The mitigations must run before the child's first byte — but the\n * launch line ITSELF is typed into a canonical-mode terminal, so it is\n * echoed once (a short non-JSON line the transport's tolerant framing\n * discards) and subject to the ~4096-byte line cap. That is why the\n * real command lives in an uploaded script and the typed line stays\n * short and constant: a long command line would be truncated before\n * `stty` ever ran. The script also restores `sh` compound-command\n * semantics that a bare `exec <command>` would break.\n */\n async execStream(sandboxId, command, opts): Promise<StreamHandle> {\n const { sandbox, env } = get(sandboxId)\n\n if (!sandbox.process.createPty) {\n throw new Error(\n 'Daytona SDK is too old: `process.createPty` is required for execStream '\n + '(used to run stdio MCP servers inside the sandbox).',\n )\n }\n\n opts?.signal?.throwIfAborted()\n\n const token = Math.random().toString(36).slice(2, 10)\n const stderrPath = `/tmp/.zidane-stream-${token}.err`\n const scriptPath = `/tmp/.zidane-stream-${token}.sh`\n\n // `exec 2>` rebinds the shell's stderr before the command runs, so\n // the command text needs no rewriting and stays compound-safe.\n await sandbox.fs.uploadFile(\n Buffer.from(`exec 2>${stderrPath}\\n${command}\\n`),\n scriptPath,\n )\n\n // See the E2B counterpart: the PTY's `onData` is a sync `void`\n // callback, so a stalled consumer can only be reported, never slowed.\n const warnBacklog = (which: string) => (bytes: number) =>\n logger.warn('execStream consumer is not draining output', { sandboxId, stream: which, bufferedBytes: bytes })\n const stdout = new StreamQueue(warnBacklog('stdout'))\n const stderr = new StreamQueue(warnBacklog('stderr'))\n\n // Everything the shell emits before the child is actually running is\n // NOISE that must never reach the caller: the echo of our own launch\n // line (typed before `-echo` takes effect), the login shell's prompt,\n // and its line-editor redraw escapes. `createPty` is `lazyStart`, so\n // the shell frequently does not exist yet when we type — it boots\n // afterwards and REPLAYS the buffered input through its line editor.\n // Observed on a stock sandbox: the stream opened with the echoed\n // launch line, the echoed first request, `\\u001b[?2004h` bracketed\n // paste, and a `%` prompt. An MCP client parses that echoed request\n // as a message and the handshake collapses.\n //\n // So: gate the stream on a sentinel the CHILD side prints, and drop\n // every byte before it. The sentinel is assembled by `printf` at\n // runtime (`Z-%s-READY` + token) so the echoed *source* line, which\n // contains the format string rather than the result, cannot match it.\n const sentinel = `Z-${token}-READY`\n let gateOpen = false\n let gateBuffer = ''\n let openGate: () => void = () => {}\n const gateReady = new Promise<void>((r) => { openGate = r })\n\n const pty = await sandbox.process.createPty({\n id: `zidane-stream-${token}`,\n ...(opts?.cwd ? { cwd: opts.cwd } : {}),\n envs: resolveDaytonaEnv(env, opts?.env) ?? {},\n onData: (data: Uint8Array) => {\n if (gateOpen) {\n stdout.push(data)\n return\n }\n gateBuffer += Buffer.from(data).toString('utf8')\n const at = gateBuffer.indexOf(sentinel)\n if (at === -1) {\n // Bounded: never let pre-gate noise grow without limit, but keep\n // a tail longer than the sentinel so it can't be split away.\n if (gateBuffer.length > 64 * 1024)\n gateBuffer = gateBuffer.slice(-1024)\n return\n }\n gateOpen = true\n openGate()\n // Everything after the sentinel's trailing newline is real output.\n const rest = gateBuffer.slice(at + sentinel.length).replace(/^\\r?\\n/, '')\n gateBuffer = ''\n if (rest.length > 0)\n stdout.push(new TextEncoder().encode(rest))\n },\n })\n await pty.waitForConnection()\n\n // Short, constant, and under any canonical line cap. `exec` replaces\n // the login shell so the PTY's lifetime is the script's lifetime and\n // no shell prompt can reach stdout.\n await pty.sendInput(`stty raw -echo; printf 'Z-%s-READY\\\\n' ${token}; exec sh ${scriptPath}\\n`)\n\n // Block until the child is genuinely live. Without this the caller can\n // write its first frame into a shell that hasn't started, where it is\n // echoed back and misread as a response.\n let gateTimer: ReturnType<typeof setTimeout> | undefined\n await Promise.race([\n gateReady,\n new Promise<void>((r) => { gateTimer = setTimeout(r, 30_000) }),\n ])\n clearTimeout(gateTimer)\n if (!gateOpen) {\n // Full teardown, not just a disconnect: Daytona PTY sessions persist\n // server-side after the websocket drops, so a bare disconnect leaks\n // one login shell plus two /tmp files per attempt — a bootstrap\n // retry loop against a broken image would stack them until the\n // sandbox dies.\n await (pty.kill?.() ?? Promise.resolve()).catch(() => {})\n await pty.disconnect().catch(() => {})\n await sandbox.process.executeCommand(`rm -f ${scriptPath} ${stderrPath}`).catch(() => {})\n throw new Error(\n `Daytona execStream: PTY did not reach the ready sentinel within 30s `\n + `(sandbox ${sandboxId}). The login shell may not have started.`,\n )\n }\n\n // stderr file → handle.stderr. Poll rather than stream: the exec API\n // is the only other channel into the sandbox, and diagnostics don't\n // need latency. Byte offsets keep re-reads incremental.\n //\n // The offset comes from the FILE (`wc -c`), never from measuring the\n // returned content: an exec API that trims a trailing newline from\n // command output would make a content-derived offset under-advance by\n // one byte per poll, re-emitting the tail byte forever. The size rides\n // back on the same round trip as a `ZEOF-<token>:` suffix; content is\n // whatever precedes it, so content-side transforms can't drift the\n // cursor either.\n let stderrOffset = 0\n let torndown = false\n const eofMark = `ZEOF-${token}:`\n const drainStderr = async (): Promise<void> => {\n try {\n const res = normalizeDaytonaExecResult(await sandbox.process.executeCommand(\n `tail -c +${stderrOffset + 1} ${stderrPath} 2>/dev/null; printf '${eofMark}%s' \"$(wc -c < ${stderrPath} 2>/dev/null || echo 0)\"`,\n ))\n const at = res.stdout.lastIndexOf(eofMark)\n if (at === -1)\n return\n const content = res.stdout.slice(0, at)\n const size = Number.parseInt(res.stdout.slice(at + eofMark.length).trim(), 10)\n if (content.length > 0)\n stderr.push(new TextEncoder().encode(content))\n if (Number.isFinite(size) && size > stderrOffset)\n stderrOffset = size\n }\n catch {\n // Diagnostic channel — polling failures must never surface as\n // protocol errors.\n }\n }\n const stderrTimer = setInterval(() => { void drainStderr() }, 2000)\n // Guarded: Bun/Node timers support unref, test fakes may not.\n ;(stderrTimer as { unref?: () => void }).unref?.()\n\n // Shared teardown for both exit paths (natural exit and kill): one\n // final stderr drain so a crash message isn't lost, then remove the\n // script + stderr files that would otherwise accumulate in /tmp for\n // the sandbox's lifetime.\n const teardown = async (): Promise<void> => {\n if (torndown)\n return\n torndown = true\n clearInterval(stderrTimer)\n await drainStderr()\n await sandbox.process.executeCommand(`rm -f ${scriptPath} ${stderrPath}`).catch(() => {})\n stdout.close()\n stderr.close()\n }\n\n const exited = pty.wait()\n .then(result => result?.exitCode ?? 0)\n .catch(() => 137)\n .finally(teardown)\n\n const kill = async (): Promise<void> => {\n // A PTY login shell never exits on its own — killing it IS the\n // normal termination path here, not an error path.\n await (pty.kill?.() ?? Promise.resolve()).catch(() => {})\n await pty.disconnect().catch(() => {})\n await teardown()\n }\n\n if (opts?.signal) {\n if (opts.signal.aborted) {\n void kill()\n }\n else {\n // Detach on exit — the (typically run-long) signal otherwise\n // retains the `kill` closure and the PTY handle for the rest of\n // the run, one dead closure per exec.\n const onAbort = () => { void kill() }\n const detach = () => opts.signal!.removeEventListener('abort', onAbort)\n opts.signal.addEventListener('abort', onAbort, { once: true })\n exited.then(detach, detach)\n }\n }\n\n return {\n pid: pty.pid ?? -1,\n stdout,\n stderr,\n write: async (data: Uint8Array): Promise<void> => {\n await pty.sendInput(data)\n },\n kill,\n exited,\n }\n },\n\n async readFile(sandboxId, path): Promise<string> {\n const data = await get(sandboxId).sandbox.fs.downloadFile(path)\n return data.toString('utf8')\n },\n\n async writeFile(sandboxId, path, content, encoding: BufferEncoding = 'utf-8'): Promise<void> {\n const data = typeof content === 'string' ? Buffer.from(content, encoding) : content\n await get(sandboxId).sandbox.fs.uploadFile(data, path)\n },\n\n async listFiles(sandboxId, path): Promise<string[]> {\n const entries = await get(sandboxId).sandbox.fs.listFiles(path)\n // Trailing `/` on directories — parity with process/docker contexts.\n return entries.map(e => (e.isDir ? `${e.name}/` : e.name))\n },\n\n async destroy(sandboxId): Promise<void> {\n const entry = live.get(sandboxId)\n if (!entry)\n return\n if (entry.owned) {\n const action = options.onDestroy ?? 'delete'\n if (action === 'stop' || action === 'pause')\n await stopOwnedSandbox(entry.sandbox)\n else if (action === 'archive')\n await archiveOwnedSandbox(entry.sandbox)\n else if (action === 'delete' || action === 'kill')\n await deleteOwnedSandbox(entry.sandbox)\n }\n live.delete(sandboxId)\n },\n }\n}\n"],"mappings":";;;;;;;AA0MA,MAAM,kCAAkC;;AAExC,MAAM,uBAAuB;;AAE7B,MAAM,0BAA0B;AAahC,SAAgB,kBACd,WACA,aACoC;CACpC,MAAM,SAAS;EAAE,GAAG;EAAW,GAAG;CAAY;CAC9C,OAAO,OAAO,KAAK,MAAM,CAAC,CAAC,SAAS,IAAI,SAAS,KAAA;AACnD;AAEA,SAAgB,2BAA2B,UAA8C;CACvF,OAAO;EACL,QAAQ,SAAS,UAAU,SAAS,WAAW,UAAU,SAAS,UAAU,SAAS,UAAU;EAC/F,QAAQ,SAAS,UAAU;EAC3B,UAAU,OAAO,SAAS,aAAa,WAAW,SAAS,WAAW;CACxE;AACF;AAEA,SAAS,cAAc,QAAgC;CACrD,OAAO;EAAE,GAAG,sBAAsB,OAAO,QAAQ,OAAO,MAAM;EAAG,UAAU,OAAO;CAAS;AAC7F;AAEA,SAAS,0BAA0B,OAA4B;CAC7D,MAAM,MAAM;CACZ,IAAI,OAAO,IAAI,aAAa,UAC1B,OAAO;EACL,QAAQ,OAAO,IAAI,WAAW,WAC1B,IAAI,SACJ,OAAO,IAAI,WAAW,WACpB,IAAI,SACJ,OAAO,IAAI,WAAW,WACpB,IAAI,SACJ;EACR,QAAQ,OAAO,IAAI,WAAW,WAAW,IAAI,SAAS,OAAO,IAAI,YAAY,WAAW,IAAI,UAAU;EACtG,UAAU,IAAI;CAChB;CAEF,OAAO;EAAE,QAAQ;EAAI,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,OAAO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E,MAAM,KAAK,CAAC;IAC7D,OAAO,KAAK,QAAQ,MAAM;GAC5B;GAGF,OAAO;IACL,KAAK,IAAI,OAAO;IAChB;IACA;IACA,OAAO,OAAO,SAAoC;KAChD,MAAM,IAAI,UAAU,IAAI;IAC1B;IACA;IACA;GACF;EACF;EAEA,MAAM,SAAS,WAAW,MAAuB;GAE/C,QAAO,MADY,IAAI,SAAS,CAAC,CAAC,QAAQ,GAAG,aAAa,IAAI,EAAA,CAClD,SAAS,MAAM;EAC7B;EAEA,MAAM,UAAU,WAAW,MAAM,SAAS,WAA2B,SAAwB;GAC3F,MAAM,OAAO,OAAO,YAAY,WAAW,OAAO,KAAK,SAAS,QAAQ,IAAI;GAC5E,MAAM,IAAI,SAAS,CAAC,CAAC,QAAQ,GAAG,WAAW,MAAM,IAAI;EACvD;EAEA,MAAM,UAAU,WAAW,MAAyB;GAGlD,QAAO,MAFe,IAAI,SAAS,CAAC,CAAC,QAAQ,GAAG,UAAU,IAAI,EAAA,CAE/C,KAAI,MAAM,EAAE,QAAQ,GAAG,EAAE,KAAK,KAAK,EAAE,IAAK;EAC3D;EAEA,MAAM,QAAQ,WAA0B;GACtC,MAAM,QAAQ,KAAK,IAAI,SAAS;GAChC,IAAI,CAAC,OACH;GACF,IAAI,MAAM,OAAO;IACf,MAAM,SAAS,QAAQ,aAAa;IACpC,IAAI,WAAW,UAAU,WAAW,SAClC,MAAM,iBAAiB,MAAM,OAAO;SACjC,IAAI,WAAW,WAClB,MAAM,oBAAoB,MAAM,OAAO;SACpC,IAAI,WAAW,YAAY,WAAW,QACzC,MAAM,mBAAmB,MAAM,OAAO;GAC1C;GACA,KAAK,OAAO,SAAS;EACvB;CACF;AACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { c as ExecutionContext, p as SpawnConfig } from "../types-
|
|
1
|
+
import { c as ExecutionContext, p as SpawnConfig } from "../types-U-rIVUDw.js";
|
|
2
|
+
import { Buffer } from "node:buffer";
|
|
2
3
|
|
|
3
4
|
//#region src/contexts/docker.d.ts
|
|
4
5
|
/**
|
|
@@ -12,6 +13,13 @@ declare const READ_FILE_MAX_BUFFER: number;
|
|
|
12
13
|
declare function createDockerContext(config?: SpawnConfig): ExecutionContext;
|
|
13
14
|
/** Assemble dockerode `HostConfig.Binds` from the context's `mounts`. */
|
|
14
15
|
declare function buildBindSpecs(mounts: NonNullable<SpawnConfig['mounts']>): string[];
|
|
16
|
+
/**
|
|
17
|
+
* Pack a single file into an in-memory tar archive for `putArchive`, via
|
|
18
|
+
* `tar-stream` (the same battle-tested packer the dockerode ecosystem uses
|
|
19
|
+
* for build contexts). Optional peer dependency, loaded lazily like
|
|
20
|
+
* dockerode itself so the module graph stays lean for non-docker users.
|
|
21
|
+
*/
|
|
22
|
+
declare function packTarFile(name: string, data: Buffer): Promise<Buffer>;
|
|
15
23
|
//#endregion
|
|
16
|
-
export { READ_FILE_MAX_BUFFER, buildBindSpecs, createDockerContext };
|
|
24
|
+
export { READ_FILE_MAX_BUFFER, buildBindSpecs, createDockerContext, packTarFile };
|
|
17
25
|
//# sourceMappingURL=docker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docker.d.ts","names":[],"sources":["../../src/contexts/docker.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"docker.d.ts","names":[],"sources":["../../src/contexts/docker.ts"],"mappings":";;;;;;;;;;;cAyBa,oBAAA;AAAA,iBAiBG,mBAAA,CAAoB,MAAA,GAAS,WAAA,GAAc,gBAAgB;;iBAknB3D,cAAA,CAAe,MAAA,EAAQ,WAAW,CAAC,WAAA;;;;;;AAAsB;iBAUnD,WAAA,CAAY,IAAA,UAAc,IAAA,EAAM,MAAA,GAAS,OAAA,CAAQ,MAAA"}
|
package/dist/contexts/docker.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { n as globFilesViaShell, t as fileSizeViaExec } from "../exec-file-size-BRpoB6Io.js";
|
|
2
2
|
import { a as outputExceededMessage, n as appendCapped, t as DEFAULT_MAX_OUTPUT_BUFFER } from "../output-cap-C9zukcCj.js";
|
|
3
3
|
import { t as alwaysQuote } from "../shell-quote-BmnhZmdM.js";
|
|
4
|
+
import { posix } from "node:path";
|
|
4
5
|
import { Buffer } from "node:buffer";
|
|
5
6
|
//#region src/contexts/docker.ts
|
|
6
7
|
/**
|
|
@@ -11,7 +12,6 @@ import { Buffer } from "node:buffer";
|
|
|
11
12
|
* more than this into host memory.
|
|
12
13
|
*/
|
|
13
14
|
const READ_FILE_MAX_BUFFER = 512 * 1024 * 1024;
|
|
14
|
-
const SINGLE_QUOTE_RE = /'/g;
|
|
15
15
|
/**
|
|
16
16
|
* dockerode surfaces HTTP errors with a `statusCode`. 304 = container
|
|
17
17
|
* already stopped, 404 = already gone — both are fine during teardown.
|
|
@@ -356,10 +356,28 @@ function createDockerContext(config) {
|
|
|
356
356
|
if (result.exitCode !== 0) throw new Error(`Failed to read file: ${result.stderr}`);
|
|
357
357
|
return result.stdout;
|
|
358
358
|
},
|
|
359
|
-
async writeFile(handle, path, content) {
|
|
360
|
-
const
|
|
361
|
-
const
|
|
362
|
-
if (
|
|
359
|
+
async writeFile(handle, path, content, encoding = "utf-8") {
|
|
360
|
+
const bytes = typeof content === "string" ? Buffer.from(content, encoding) : content;
|
|
361
|
+
const ref = containers.get(handle.id);
|
|
362
|
+
if (!ref) throw new Error(`Container ${handle.id} not found`);
|
|
363
|
+
const dest = posix.isAbsolute(path) ? path : posix.join(handle.cwd, path);
|
|
364
|
+
const dir = posix.dirname(dest);
|
|
365
|
+
const name = posix.basename(dest);
|
|
366
|
+
if (!name || name === "." || name === ".." || path.endsWith("/")) throw new Error(`Failed to write file: invalid path ${path}`);
|
|
367
|
+
const mkdir = await ctx.exec(handle, `mkdir -p ${alwaysQuote(dir)}`);
|
|
368
|
+
if (mkdir.exitCode !== 0) throw new Error(`Failed to write file: ${mkdir.stderr}`);
|
|
369
|
+
const stagedName = `.zidane-write-${Math.random().toString(36).slice(2, 10)}.tmp`;
|
|
370
|
+
const staged = posix.join(dir, stagedName);
|
|
371
|
+
try {
|
|
372
|
+
await ref.container.putArchive(await packTarFile(stagedName, bytes), { path: dir });
|
|
373
|
+
} catch (err) {
|
|
374
|
+
throw new Error(`Failed to write file: ${err instanceof Error ? err.message : String(err)}`);
|
|
375
|
+
}
|
|
376
|
+
const write = await ctx.exec(handle, `cat ${alwaysQuote(staged)} > ${alwaysQuote(dest)}; rc=$?; rm -f ${alwaysQuote(staged)}; exit $rc`);
|
|
377
|
+
if (write.exitCode !== 0) {
|
|
378
|
+
await ctx.exec(handle, `rm -f ${alwaysQuote(staged)}`).catch(() => {});
|
|
379
|
+
throw new Error(`Failed to write file: ${write.stderr}`);
|
|
380
|
+
}
|
|
363
381
|
},
|
|
364
382
|
async listFiles(handle, path, options) {
|
|
365
383
|
if (options?.glob) return globFilesViaShell(path, (command) => ctx.exec(handle, command), options?.limit ?? 1e3);
|
|
@@ -412,7 +430,27 @@ function formatBindMount(mount) {
|
|
|
412
430
|
function buildBindSpecs(mounts) {
|
|
413
431
|
return mounts.map(formatBindMount);
|
|
414
432
|
}
|
|
433
|
+
/**
|
|
434
|
+
* Pack a single file into an in-memory tar archive for `putArchive`, via
|
|
435
|
+
* `tar-stream` (the same battle-tested packer the dockerode ecosystem uses
|
|
436
|
+
* for build contexts). Optional peer dependency, loaded lazily like
|
|
437
|
+
* dockerode itself so the module graph stays lean for non-docker users.
|
|
438
|
+
*/
|
|
439
|
+
async function packTarFile(name, data) {
|
|
440
|
+
let pack;
|
|
441
|
+
try {
|
|
442
|
+
pack = (await import("tar-stream")).pack;
|
|
443
|
+
} catch {
|
|
444
|
+
throw new Error("tar-stream is required for Docker writeFile. Install it with: bun add tar-stream");
|
|
445
|
+
}
|
|
446
|
+
const tar = pack();
|
|
447
|
+
tar.entry({ name }, data);
|
|
448
|
+
tar.finalize();
|
|
449
|
+
const chunks = [];
|
|
450
|
+
for await (const chunk of tar) chunks.push(chunk);
|
|
451
|
+
return Buffer.concat(chunks);
|
|
452
|
+
}
|
|
415
453
|
//#endregion
|
|
416
|
-
export { READ_FILE_MAX_BUFFER, buildBindSpecs, createDockerContext };
|
|
454
|
+
export { READ_FILE_MAX_BUFFER, buildBindSpecs, createDockerContext, packTarFile };
|
|
417
455
|
|
|
418
456
|
//# sourceMappingURL=docker.js.map
|