zidane 5.4.3 → 5.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +30 -1
  2. package/dist/{agent-Yu8uhpy-.d.ts → agent-CvImMxMQ.d.ts} +183 -3
  3. package/dist/agent-CvImMxMQ.d.ts.map +1 -0
  4. package/dist/chat.d.ts +93 -15
  5. package/dist/chat.d.ts.map +1 -1
  6. package/dist/chat.js +3 -2
  7. package/dist/contexts/docker.d.ts +1 -1
  8. package/dist/contexts-DhmMlT2W.js +472 -0
  9. package/dist/contexts-DhmMlT2W.js.map +1 -0
  10. package/dist/contexts.d.ts +3 -3
  11. package/dist/contexts.js +1 -1
  12. package/dist/{index-DklfxeYy.d.ts → index-B0uc2C5x.d.ts} +3 -3
  13. package/dist/{index-DklfxeYy.d.ts.map → index-B0uc2C5x.d.ts.map} +1 -1
  14. package/dist/{index-BiO_5Hm4.d.ts → index-CbS75MD3.d.ts} +2 -2
  15. package/dist/index-CbS75MD3.d.ts.map +1 -0
  16. package/dist/{index-j9tY28ah.d.ts → index-CtXksgqb.d.ts} +60 -4
  17. package/dist/index-CtXksgqb.d.ts.map +1 -0
  18. package/dist/index.d.ts +6 -6
  19. package/dist/index.js +8 -8
  20. package/dist/{interpolate-CmtjEyRJ.js → interpolate-BaaKaKzN.js} +2 -2
  21. package/dist/{interpolate-CmtjEyRJ.js.map → interpolate-BaaKaKzN.js.map} +1 -1
  22. package/dist/{login-DxyAERe1.js → login-iTy-0wYz.js} +2 -2
  23. package/dist/{login-DxyAERe1.js.map → login-iTy-0wYz.js.map} +1 -1
  24. package/dist/mcp.d.ts +1 -1
  25. package/dist/{presets-D9IbaI40.js → presets-h6UWhghO.js} +3 -2
  26. package/dist/presets-h6UWhghO.js.map +1 -0
  27. package/dist/presets.d.ts +2 -2
  28. package/dist/presets.js +1 -1
  29. package/dist/{providers-CEzRFYtS.js → providers-G0VBZK9j.js} +2 -2
  30. package/dist/{providers-CEzRFYtS.js.map → providers-G0VBZK9j.js.map} +1 -1
  31. package/dist/providers.d.ts +1 -1
  32. package/dist/providers.js +1 -1
  33. package/dist/session/sqlite.d.ts +1 -1
  34. package/dist/session/sqlite.d.ts.map +1 -1
  35. package/dist/session/sqlite.js +1 -0
  36. package/dist/session/sqlite.js.map +1 -1
  37. package/dist/{session-kwsNnOmt.js → session-CbkiJDlH.js} +2 -1
  38. package/dist/session-CbkiJDlH.js.map +1 -0
  39. package/dist/session.d.ts +1 -1
  40. package/dist/session.js +1 -1
  41. package/dist/skills.d.ts +2 -2
  42. package/dist/skills.js +1 -1
  43. package/dist/{tools-BK2vG9UX.js → tools-D_icxa-V.js} +668 -256
  44. package/dist/tools-D_icxa-V.js.map +1 -0
  45. package/dist/tools.d.ts +3 -3
  46. package/dist/tools.js +2 -2
  47. package/dist/{transcript-anchors-DnaBcJej.d.ts → transcript-anchors-3FFw2xuk.d.ts} +49 -10
  48. package/dist/transcript-anchors-3FFw2xuk.d.ts.map +1 -0
  49. package/dist/tui.d.ts +27 -5
  50. package/dist/tui.d.ts.map +1 -1
  51. package/dist/tui.js +239 -39
  52. package/dist/tui.js.map +1 -1
  53. package/dist/{turn-operations-OzKEOXul.js → turn-operations-CtgBlBHn.js} +178 -79
  54. package/dist/turn-operations-CtgBlBHn.js.map +1 -0
  55. package/dist/types-IcokUOyC.js.map +1 -1
  56. package/dist/types-KukEp-mi.d.ts +253 -0
  57. package/dist/types-KukEp-mi.d.ts.map +1 -0
  58. package/dist/types.d.ts +4 -4
  59. package/docs/ARCHITECTURE.md +21 -0
  60. package/docs/CHAT.md +3 -1
  61. package/docs/RUN_IN_BACKGROUND.md +612 -0
  62. package/docs/SKILL.md +59 -0
  63. package/docs/TUI.md +16 -2
  64. package/package.json +2 -2
  65. package/dist/agent-Yu8uhpy-.d.ts.map +0 -1
  66. package/dist/contexts-BwiHIr2w.js +0 -129
  67. package/dist/contexts-BwiHIr2w.js.map +0 -1
  68. package/dist/index-BiO_5Hm4.d.ts.map +0 -1
  69. package/dist/index-j9tY28ah.d.ts.map +0 -1
  70. package/dist/presets-D9IbaI40.js.map +0 -1
  71. package/dist/session-kwsNnOmt.js.map +0 -1
  72. package/dist/tools-BK2vG9UX.js.map +0 -1
  73. package/dist/transcript-anchors-DnaBcJej.d.ts.map +0 -1
  74. package/dist/turn-operations-OzKEOXul.js.map +0 -1
  75. package/dist/types-Ce78ds4h.d.ts +0 -88
  76. package/dist/types-Ce78ds4h.d.ts.map +0 -1
package/dist/chat.js CHANGED
@@ -1,2 +1,3 @@
1
- import { $ as useMcpAuthDispatch, $n as mergeReferences, $r as IDENTITY_PREFIX, $t as isTurnHighlighted, A as getSafelist, An as rewriteMultiEditHeader, Ar as DEFAULT_AGENT_ID, B as supportsOAuth, Bn as mergeKeybindings, Br as TODO_WRITE_COUNTS_METADATA_KEY, Bt as CATPPUCCIN_MOCHA, C as resolveSessionExportTarget, Cn as summarizeEditPayload, Cr as modelSupportsReasoning, Ct as shortId, D as useSafeModeQueue, Dn as mergeApprovalAndBodyOutcomes, Dr as piIdOf, Dt as SETTINGS_CHOICES, E as useSafeModeActions, En as maskToOutcomeKinds, Er as openrouterDescriptor, Et as DEFAULT_SETTINGS, F as suggestSafelistEntry, Fn as KEYBINDING_DEFS, Fr as singleAgentRegistry, Ft as resolveTheme, G as defaultMcpsConfigPaths, Gn as createSkillsCompletionProvider, Gr as pickActiveRunId, Gt as ConfigProvider, H as filterModelCatalog, Hn as readKeybindings, Hr as getArchivedTodosForRun, Ht as DiscoveryProvider, I as writeProjects, In as KEYBINDING_DEF_BY_ACTION, Ir as TODOREAD_TOOL, It as VAPORWAVE_THEME, J as projectUserPaths, Jn as createFilesCompletionProvider, Jr as setTodosForRun, K as discoverProjectMcps, Kn as uniqueSkillNamesFromReferences, Kr as pruneTodosByRun, Kt as useConfig, L as splitPromptSegments, Ln as ensureKeybindingsFile, Lr as TODOS_METADATA_KEY, Lt as CATPPUCCIN_FRAPPE, M as matchesSafelistEntry, Mn as summarizeOutcomes, Mr as PLAN_AGENT, Mt as BUILTIN_THEMES, N as projectsFilePath, Nn as findGitRoot, Nr as accentColor, Nt as DEFAULT_THEME, O as IMPLICITLY_SAFE_TOOLS, On as parseEditOutcomesFromResult, Or as BUILD_AGENT, Ot as SETTINGS_TOGGLES, P as readProjects, Pn as DEFAULT_KEYBINDINGS, Pr as resolveAgentId, Pt as resolveChipColor, Q as McpAuthProvider, Qn as findActiveTrigger, Qr as DOING_TASKS_DOCTRINE, Qt as isEditErrorResult, R as formatPathForCwd, Rn as keybindingsPath, Rr as TODOWRITE_TOOL, Rt as CATPPUCCIN_LATTE, S as renderSession, Sn as splitLines, Sr as getModelInfo, St as fmtTokens, T as SafeModeProvider, Tn as buildEditOutcomesAnnotation, Tr as openaiDescriptor, Tt as useEnabledToggleSet, U as indexOfEntry, Un as stripJsonComments, Ur as getTodosForRun, Ut as useDiscovery, V as buildModelCatalog, Vn as parseBindingSpec, Vr as createTodoTools, Vt as createDiscoverySlot, W as buildMcpServers, Wn as SKILLS_TRIGGER, Wr as isTodoTool, Wt as useDiscoveryOptional, X as mcpCredentialsPath, Xn as applyInsert, Xr as ACTIONS_WITH_CARE_DOCTRINE, Xt as deriveSessionTitle, Y as createFileMcpCredentialStore, Yn as uniqueFilesFromReferences, Yr as useActiveTodos, Yt as createStateStore, Z as patchMcpCredential, Zn as collectReferences, Zr as COMMUNICATION_DOCTRINE, Zt as eventsFromTurns, _ as turnContextSize, _n as computeInlineDiff, _r as anthropicDescriptor, _t as truncateTrailing, a as computeTurnAnchors, ai as TOKEN_DISCIPLINE_DOCTRINE, an as saveState, ar as bootTick, at as InteractionsProvider, b as defaultSkillScanPaths, bn as filetypeFromPath, br as effectiveContextWindow, bt as ageString, c as formatToolCall, ci as envSection, cn as sumRunCosts, cr as applyApiKeyEnv, ct as createInteractionTools, d as useSelectStyle, dn as toolResultText, dr as readProviderCredential, dt as pendingInteractionsFromTurns, ei as INTERACTION_GUIDANCE, en as isVisible, er as useCompletion, et as useMcpAuthState, f as useSurfaces, fn as turnSelectionOwnership, fr as removeProviderCredential, ft as serializeInteractionResponse, g as finalizeStreamingMarkdownForOwner, gn as buildUnifiedDiff, gr as OUTPUT_RESERVE_TOKENS, gt as hintsLength, h as finalizeStreamingMarkdown, hn as buildContextualDiff, hr as BUILTIN_PROVIDERS, ht as clipHintsToWidth, i as turnAsText, ii as SUBAGENT_GUIDANCE, in as marginTopFor, ir as bootProfileEnabled, it as ASK_USER_TOOL, j as isOnSafelist, jn as stripEditOutcomesAnnotation, jr as DEFAULT_PERSIST_EXCLUDE_TOOLS, jt as useSettings, k as addToSafelist, kn as resolveApprovalForPayload, kr as BUILTIN_AGENTS, kt as SettingsProvider, l as ThemeProvider, ln as titleFromTurns, lr as credentialsPath, lt as isInteractionTool, m as useTheme, mn as applyEditPayload, mr as writeCredentials, mt as useInteractionsQueue, n as deleteTurnSafely, ni as PLAN_MODE_DOCTRINE, nn as listSessionMeta, nr as buildLinearRamp, nt as reduceMcpAuth, o as TOOL_DISPLAY, oi as buildBuildSystem, on as selectableTurnIds, or as shouldAutoCompact, ot as PRESENT_PLAN_TOOL, p as useSyntaxStyles, pn as updateToolEventOutcomes, pr as setProviderCredential, pt as useInteractionsActions, q as parseMcpsFile, qn as FILES_TRIGGER, qr as selectActiveTodos, qt as resolveConfig, r as truncateTurnsAt, ri as PLAN_MODE_DOCTRINE_NO_PROMPTS, rn as loadState, rr as tryOpenBrowser, rt as splitMarkdownCodeBlocks, s as displayNameFor, si as buildPlanSystem, sn as stripSpawnTokensLine, sr as detectAuth, st as buildResumedToolResultsTurn, t as countNeighbors, ti as INTERACTION_GUIDANCE_NO_PROMPTS, tn as lastContextSizeFromTurns, tr as blendHsl, tt as getMcpAuthStatus, u as useColors, un as toolCallPreview, ur as readCredentials, ut as makeRequestInteraction, v as useStreamBuffer, vn as computeLineDiff, vr as cerebrasDescriptor, vt as cleanTitle, w as writeSessionExport, wn as tokenize, wr as modelsForDescriptor, wt as listProjectFiles, x as discoverProjectSkills, xn as previewEditPayload, xr as getContextWindow, xt as compactPath, y as buildSkillsConfig, yn as extractEditPayload, yr as credKeyOf, yt as generateSessionTitle, z as runOAuthLogin, zn as matchesBinding, zr as TODO_STATUS_GLYPHS, zt as CATPPUCCIN_MACCHIATO } from "./turn-operations-OzKEOXul.js";
2
- export { ACTIONS_WITH_CARE_DOCTRINE, ASK_USER_TOOL, BUILD_AGENT, BUILTIN_AGENTS, BUILTIN_PROVIDERS, BUILTIN_THEMES, CATPPUCCIN_FRAPPE, CATPPUCCIN_LATTE, CATPPUCCIN_MACCHIATO, CATPPUCCIN_MOCHA, COMMUNICATION_DOCTRINE, ConfigProvider, DEFAULT_AGENT_ID, DEFAULT_KEYBINDINGS, DEFAULT_PERSIST_EXCLUDE_TOOLS, DEFAULT_SETTINGS, DEFAULT_THEME, DOING_TASKS_DOCTRINE, DiscoveryProvider, FILES_TRIGGER, IDENTITY_PREFIX, IMPLICITLY_SAFE_TOOLS, INTERACTION_GUIDANCE, INTERACTION_GUIDANCE_NO_PROMPTS, InteractionsProvider, KEYBINDING_DEFS, KEYBINDING_DEF_BY_ACTION, McpAuthProvider, OUTPUT_RESERVE_TOKENS, PLAN_AGENT, PLAN_MODE_DOCTRINE, PLAN_MODE_DOCTRINE_NO_PROMPTS, PRESENT_PLAN_TOOL, SETTINGS_CHOICES, SETTINGS_TOGGLES, SKILLS_TRIGGER, SUBAGENT_GUIDANCE, SafeModeProvider, SettingsProvider, TODOREAD_TOOL, TODOS_METADATA_KEY, TODOWRITE_TOOL, TODO_STATUS_GLYPHS, TODO_WRITE_COUNTS_METADATA_KEY, TOKEN_DISCIPLINE_DOCTRINE, TOOL_DISPLAY, ThemeProvider, VAPORWAVE_THEME, accentColor, addToSafelist, ageString, anthropicDescriptor, applyApiKeyEnv, applyEditPayload, applyInsert, blendHsl, bootProfileEnabled, bootTick, buildBuildSystem, buildContextualDiff, buildEditOutcomesAnnotation, buildLinearRamp, buildMcpServers, buildModelCatalog, buildPlanSystem, buildResumedToolResultsTurn, buildSkillsConfig, buildUnifiedDiff, cerebrasDescriptor, cleanTitle, clipHintsToWidth, collectReferences, compactPath, computeInlineDiff, computeLineDiff, computeTurnAnchors, countNeighbors, createDiscoverySlot, createFileMcpCredentialStore, createFilesCompletionProvider, createInteractionTools, createSkillsCompletionProvider, createStateStore, createTodoTools, credKeyOf, credentialsPath, defaultMcpsConfigPaths, defaultSkillScanPaths, deleteTurnSafely, deriveSessionTitle, detectAuth, discoverProjectMcps, discoverProjectSkills, displayNameFor, effectiveContextWindow, ensureKeybindingsFile, envSection, eventsFromTurns, extractEditPayload, filetypeFromPath, filterModelCatalog, finalizeStreamingMarkdown, finalizeStreamingMarkdownForOwner, findActiveTrigger, findGitRoot, fmtTokens, formatPathForCwd, formatToolCall, generateSessionTitle, getArchivedTodosForRun, getContextWindow, getMcpAuthStatus, getModelInfo, getSafelist, getTodosForRun, hintsLength, indexOfEntry, isEditErrorResult, isInteractionTool, isOnSafelist, isTodoTool, isTurnHighlighted, isVisible, keybindingsPath, lastContextSizeFromTurns, listProjectFiles, listSessionMeta, loadState, makeRequestInteraction, marginTopFor, maskToOutcomeKinds, matchesBinding, matchesSafelistEntry, mcpCredentialsPath, mergeApprovalAndBodyOutcomes, mergeKeybindings, mergeReferences, modelSupportsReasoning, modelsForDescriptor, openaiDescriptor, openrouterDescriptor, parseBindingSpec, parseEditOutcomesFromResult, parseMcpsFile, patchMcpCredential, pendingInteractionsFromTurns, piIdOf, pickActiveRunId, previewEditPayload, projectUserPaths, projectsFilePath, pruneTodosByRun, readCredentials, readKeybindings, readProjects, readProviderCredential, reduceMcpAuth, removeProviderCredential, renderSession, resolveAgentId, resolveApprovalForPayload, resolveChipColor, resolveConfig, resolveSessionExportTarget, resolveTheme, rewriteMultiEditHeader, runOAuthLogin, saveState, selectActiveTodos, selectableTurnIds, serializeInteractionResponse, setProviderCredential, setTodosForRun, shortId, shouldAutoCompact, singleAgentRegistry, splitLines, splitMarkdownCodeBlocks, splitPromptSegments, stripEditOutcomesAnnotation, stripJsonComments, stripSpawnTokensLine, suggestSafelistEntry, sumRunCosts, summarizeEditPayload, summarizeOutcomes, supportsOAuth, titleFromTurns, tokenize, toolCallPreview, toolResultText, truncateTrailing, truncateTurnsAt, tryOpenBrowser, turnAsText, turnContextSize, turnSelectionOwnership, uniqueFilesFromReferences, uniqueSkillNamesFromReferences, updateToolEventOutcomes, useActiveTodos, useColors, useCompletion, useConfig, useDiscovery, useDiscoveryOptional, useEnabledToggleSet, useInteractionsActions, useInteractionsQueue, useMcpAuthDispatch, useMcpAuthState, useSafeModeActions, useSafeModeQueue, useSelectStyle, useSettings, useStreamBuffer, useSurfaces, useSyntaxStyles, useTheme, writeCredentials, writeProjects, writeSessionExport };
1
+ import { B as formatTaskStatus, H as previewLine, I as ageString, L as compactPath, R as fmtTokens, U as shortId, V as formatTaskSummary, z as formatDuration } from "./tools-D_icxa-V.js";
2
+ import { $ as useMcpAuthDispatch, $n as tryOpenBrowser, $r as PLAN_MODE_DOCTRINE_NO_PROMPTS, $t as loadState, A as getSafelist, An as DEFAULT_KEYBINDINGS, Ar as resolveAgentId, At as resolveChipColor, B as supportsOAuth, Bn as SKILLS_TRIGGER, Br as isTodoTool, Bt as useDiscoveryOptional, C as resolveSessionExportTarget, Cn as mergeApprovalAndBodyOutcomes, Cr as piIdOf, Ct as SETTINGS_CHOICES, D as useSafeModeQueue, Dn as stripEditOutcomesAnnotation, Dr as DEFAULT_PERSIST_EXCLUDE_TOOLS, Dt as useSettings, E as useSafeModeActions, En as rewriteMultiEditHeader, Er as DEFAULT_AGENT_ID, F as suggestSafelistEntry, Fn as matchesBinding, Fr as TODO_STATUS_GLYPHS, Ft as CATPPUCCIN_MACCHIATO, G as defaultMcpsConfigPaths, Gn as uniqueFilesFromReferences, Gr as useActiveTodos, Gt as createStateStore, H as filterModelCatalog, Hn as uniqueSkillNamesFromReferences, Hr as pruneTodosByRun, Ht as useConfig, I as writeProjects, In as mergeKeybindings, Ir as TODO_WRITE_COUNTS_METADATA_KEY, It as CATPPUCCIN_MOCHA, J as projectUserPaths, Jn as findActiveTrigger, Jr as DOING_TASKS_DOCTRINE, Jt as isEditErrorResult, K as discoverProjectMcps, Kn as applyInsert, Kr as ACTIONS_WITH_CARE_DOCTRINE, Kt as deriveSessionTitle, L as splitPromptSegments, Ln as parseBindingSpec, Lr as createTodoTools, Lt as createDiscoverySlot, M as matchesSafelistEntry, Mn as KEYBINDING_DEF_BY_ACTION, Mr as TODOREAD_TOOL, Mt as VAPORWAVE_THEME, N as projectsFilePath, Nn as ensureKeybindingsFile, Nr as TODOS_METADATA_KEY, Nt as CATPPUCCIN_FRAPPE, O as IMPLICITLY_SAFE_TOOLS, On as summarizeOutcomes, Or as PLAN_AGENT, Ot as BUILTIN_THEMES, P as readProjects, Pn as keybindingsPath, Pr as TODOWRITE_TOOL, Pt as CATPPUCCIN_LATTE, Q as McpAuthProvider, Qn as buildLinearRamp, Qr as PLAN_MODE_DOCTRINE, Qt as listSessionMeta, R as formatPathForCwd, Rn as readKeybindings, Rr as getArchivedTodosForRun, Rt as DiscoveryProvider, S as renderSession, Sn as maskToOutcomeKinds, Sr as openrouterDescriptor, St as DEFAULT_SETTINGS, T as SafeModeProvider, Tn as resolveApprovalForPayload, Tr as BUILTIN_AGENTS, Tt as SettingsProvider, U as indexOfEntry, Un as FILES_TRIGGER, Ur as selectActiveTodos, Ut as resolveConfig, V as buildModelCatalog, Vn as createSkillsCompletionProvider, Vr as pickActiveRunId, Vt as ConfigProvider, W as buildMcpServers, Wn as createFilesCompletionProvider, Wr as setTodosForRun, X as mcpCredentialsPath, Xn as useCompletion, Xr as INTERACTION_GUIDANCE, Xt as isVisible, Y as createFileMcpCredentialStore, Yn as mergeReferences, Yr as IDENTITY_PREFIX, Yt as isTurnHighlighted, Z as patchMcpCredential, Zn as blendHsl, Zr as INTERACTION_GUIDANCE_NO_PROMPTS, Zt as lastContextSizeFromTurns, _ as turnContextSize, _n as previewEditPayload, _r as getContextWindow, _t as truncateTrailing, a as computeTurnAnchors, an as titleFromTurns, ar as credentialsPath, at as InteractionsProvider, b as defaultSkillScanPaths, bn as tokenize, br as modelsForDescriptor, bt as listProjectFiles, c as formatToolCall, cn as turnSelectionOwnership, cr as removeProviderCredential, ct as createInteractionTools, d as useSelectStyle, dn as buildContextualDiff, dr as BUILTIN_PROVIDERS, dt as pendingInteractionsFromTurns, ei as SUBAGENT_GUIDANCE, en as marginTopFor, er as bootProfileEnabled, et as useMcpAuthState, f as useSurfaces, fn as buildUnifiedDiff, fr as OUTPUT_RESERVE_TOKENS, ft as serializeInteractionResponse, g as finalizeStreamingMarkdownForOwner, gn as filetypeFromPath, gr as effectiveContextWindow, gt as hintsLength, h as finalizeStreamingMarkdown, hn as extractEditPayload, hr as credKeyOf, ht as clipHintsToWidth, i as turnAsText, ii as envSection, in as sumRunCosts, ir as applyApiKeyEnv, it as ASK_USER_TOOL, j as isOnSafelist, jn as KEYBINDING_DEFS, jr as singleAgentRegistry, jt as resolveTheme, k as addToSafelist, kn as findGitRoot, kr as accentColor, kt as DEFAULT_THEME, l as ThemeProvider, ln as updateToolEventOutcomes, lr as setProviderCredential, lt as isInteractionTool, m as useTheme, mn as computeLineDiff, mr as cerebrasDescriptor, mt as useInteractionsQueue, n as deleteTurnSafely, ni as buildBuildSystem, nn as selectableTurnIds, nr as shouldAutoCompact, nt as reduceMcpAuth, o as TOOL_DISPLAY, on as toolCallPreview, or as readCredentials, ot as PRESENT_PLAN_TOOL, p as useSyntaxStyles, pn as computeInlineDiff, pr as anthropicDescriptor, pt as useInteractionsActions, q as parseMcpsFile, qn as collectReferences, qr as COMMUNICATION_DOCTRINE, qt as eventsFromTurns, r as truncateTurnsAt, ri as buildPlanSystem, rn as stripSpawnTokensLine, rr as detectAuth, rt as splitMarkdownCodeBlocks, s as displayNameFor, sn as toolResultText, sr as readProviderCredential, st as buildResumedToolResultsTurn, t as countNeighbors, ti as TOKEN_DISCIPLINE_DOCTRINE, tn as saveState, tr as bootTick, tt as getMcpAuthStatus, u as useColors, un as applyEditPayload, ur as writeCredentials, ut as makeRequestInteraction, v as useStreamBuffer, vn as splitLines, vr as getModelInfo, vt as cleanTitle, w as writeSessionExport, wn as parseEditOutcomesFromResult, wr as BUILD_AGENT, wt as SETTINGS_TOGGLES, x as discoverProjectSkills, xn as buildEditOutcomesAnnotation, xr as openaiDescriptor, xt as useEnabledToggleSet, y as buildSkillsConfig, yn as summarizeEditPayload, yr as modelSupportsReasoning, yt as generateSessionTitle, z as runOAuthLogin, zn as stripJsonComments, zr as getTodosForRun, zt as useDiscovery } from "./turn-operations-CtgBlBHn.js";
3
+ export { ACTIONS_WITH_CARE_DOCTRINE, ASK_USER_TOOL, BUILD_AGENT, BUILTIN_AGENTS, BUILTIN_PROVIDERS, BUILTIN_THEMES, CATPPUCCIN_FRAPPE, CATPPUCCIN_LATTE, CATPPUCCIN_MACCHIATO, CATPPUCCIN_MOCHA, COMMUNICATION_DOCTRINE, ConfigProvider, DEFAULT_AGENT_ID, DEFAULT_KEYBINDINGS, DEFAULT_PERSIST_EXCLUDE_TOOLS, DEFAULT_SETTINGS, DEFAULT_THEME, DOING_TASKS_DOCTRINE, DiscoveryProvider, FILES_TRIGGER, IDENTITY_PREFIX, IMPLICITLY_SAFE_TOOLS, INTERACTION_GUIDANCE, INTERACTION_GUIDANCE_NO_PROMPTS, InteractionsProvider, KEYBINDING_DEFS, KEYBINDING_DEF_BY_ACTION, McpAuthProvider, OUTPUT_RESERVE_TOKENS, PLAN_AGENT, PLAN_MODE_DOCTRINE, PLAN_MODE_DOCTRINE_NO_PROMPTS, PRESENT_PLAN_TOOL, SETTINGS_CHOICES, SETTINGS_TOGGLES, SKILLS_TRIGGER, SUBAGENT_GUIDANCE, SafeModeProvider, SettingsProvider, TODOREAD_TOOL, TODOS_METADATA_KEY, TODOWRITE_TOOL, TODO_STATUS_GLYPHS, TODO_WRITE_COUNTS_METADATA_KEY, TOKEN_DISCIPLINE_DOCTRINE, TOOL_DISPLAY, ThemeProvider, VAPORWAVE_THEME, accentColor, addToSafelist, ageString, anthropicDescriptor, applyApiKeyEnv, applyEditPayload, applyInsert, blendHsl, bootProfileEnabled, bootTick, buildBuildSystem, buildContextualDiff, buildEditOutcomesAnnotation, buildLinearRamp, buildMcpServers, buildModelCatalog, buildPlanSystem, buildResumedToolResultsTurn, buildSkillsConfig, buildUnifiedDiff, cerebrasDescriptor, cleanTitle, clipHintsToWidth, collectReferences, compactPath, computeInlineDiff, computeLineDiff, computeTurnAnchors, countNeighbors, createDiscoverySlot, createFileMcpCredentialStore, createFilesCompletionProvider, createInteractionTools, createSkillsCompletionProvider, createStateStore, createTodoTools, credKeyOf, credentialsPath, defaultMcpsConfigPaths, defaultSkillScanPaths, deleteTurnSafely, deriveSessionTitle, detectAuth, discoverProjectMcps, discoverProjectSkills, displayNameFor, effectiveContextWindow, ensureKeybindingsFile, envSection, eventsFromTurns, extractEditPayload, filetypeFromPath, filterModelCatalog, finalizeStreamingMarkdown, finalizeStreamingMarkdownForOwner, findActiveTrigger, findGitRoot, fmtTokens, formatDuration, formatPathForCwd, formatTaskStatus, formatTaskSummary, formatToolCall, generateSessionTitle, getArchivedTodosForRun, getContextWindow, getMcpAuthStatus, getModelInfo, getSafelist, getTodosForRun, hintsLength, indexOfEntry, isEditErrorResult, isInteractionTool, isOnSafelist, isTodoTool, isTurnHighlighted, isVisible, keybindingsPath, lastContextSizeFromTurns, listProjectFiles, listSessionMeta, loadState, makeRequestInteraction, marginTopFor, maskToOutcomeKinds, matchesBinding, matchesSafelistEntry, mcpCredentialsPath, mergeApprovalAndBodyOutcomes, mergeKeybindings, mergeReferences, modelSupportsReasoning, modelsForDescriptor, openaiDescriptor, openrouterDescriptor, parseBindingSpec, parseEditOutcomesFromResult, parseMcpsFile, patchMcpCredential, pendingInteractionsFromTurns, piIdOf, pickActiveRunId, previewEditPayload, previewLine, projectUserPaths, projectsFilePath, pruneTodosByRun, readCredentials, readKeybindings, readProjects, readProviderCredential, reduceMcpAuth, removeProviderCredential, renderSession, resolveAgentId, resolveApprovalForPayload, resolveChipColor, resolveConfig, resolveSessionExportTarget, resolveTheme, rewriteMultiEditHeader, runOAuthLogin, saveState, selectActiveTodos, selectableTurnIds, serializeInteractionResponse, setProviderCredential, setTodosForRun, shortId, shouldAutoCompact, singleAgentRegistry, splitLines, splitMarkdownCodeBlocks, splitPromptSegments, stripEditOutcomesAnnotation, stripJsonComments, stripSpawnTokensLine, suggestSafelistEntry, sumRunCosts, summarizeEditPayload, summarizeOutcomes, supportsOAuth, titleFromTurns, tokenize, toolCallPreview, toolResultText, truncateTrailing, truncateTurnsAt, tryOpenBrowser, turnAsText, turnContextSize, turnSelectionOwnership, uniqueFilesFromReferences, uniqueSkillNamesFromReferences, updateToolEventOutcomes, useActiveTodos, useColors, useCompletion, useConfig, useDiscovery, useDiscoveryOptional, useEnabledToggleSet, useInteractionsActions, useInteractionsQueue, useMcpAuthDispatch, useMcpAuthState, useSafeModeActions, useSafeModeQueue, useSelectStyle, useSettings, useStreamBuffer, useSurfaces, useSyntaxStyles, useTheme, writeCredentials, writeProjects, writeSessionExport };
@@ -1,4 +1,4 @@
1
- import { i as ExecutionContext, o as SpawnConfig } from "../types-Ce78ds4h.js";
1
+ import { a as ExecutionContext, s as SpawnConfig } from "../types-KukEp-mi.js";
2
2
 
3
3
  //#region src/contexts/docker.d.ts
4
4
  declare function createDockerContext(config?: SpawnConfig): ExecutionContext;
@@ -0,0 +1,472 @@
1
+ import { dirname, resolve } from "node:path";
2
+ import { spawn } from "node:child_process";
3
+ import { createWriteStream } from "node:fs";
4
+ import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
5
+ //#region src/contexts/process.ts
6
+ /**
7
+ * Whether the host supports POSIX process groups (the `detached: true` +
8
+ * `process.kill(-pid)` combination). Windows doesn't — its job-object
9
+ * model is shaped differently — so on win32 we fall back to killing the
10
+ * shell wrapper alone (matches pre-fix behavior; better than nothing).
11
+ */
12
+ const SUPPORTS_PROCESS_GROUPS = process.platform !== "win32";
13
+ /**
14
+ * Default cap on captured stdout / stderr per child. Matches the
15
+ * pre-fix `child_process.exec` setting so existing callers see the
16
+ * same buffer envelope. Output beyond this is truncated and a
17
+ * marker is appended to stderr.
18
+ */
19
+ const DEFAULT_MAX_BUFFER = 10 * 1024 * 1024;
20
+ /**
21
+ * Sanitize a task id before it's joined into a filesystem path.
22
+ *
23
+ * We mint `bash_<n>` ids ourselves (no user input flows into the path
24
+ * for `ProcessContext`), so this is defensive — but third-party contexts
25
+ * MAY accept caller-provided ids, so the helper exists for them too.
26
+ * Anything that doesn't match the expected shape is rejected — never
27
+ * coerced — so the call site sees a clear error rather than a
28
+ * traversal-shaped path.
29
+ */
30
+ const TASK_ID_RE = /^[a-z][\w-]*$/i;
31
+ function assertSafeTaskId(taskId) {
32
+ if (!TASK_ID_RE.test(taskId)) throw new Error(`Invalid task id "${taskId}" — must match ${TASK_ID_RE}.`);
33
+ }
34
+ /**
35
+ * Format `date` as `YYYYMMDD-HHMMSS-mmm` in UTC.
36
+ *
37
+ * Pinned to UTC so the lexical sort of two timestamps always matches
38
+ * their chronological order (local time + DST does not). Used as the
39
+ * per-context suffix on background-task log filenames; see the field
40
+ * doc on `contextTimestamp` for the why.
41
+ */
42
+ function formatContextTimestamp(date) {
43
+ const pad2 = (n) => n.toString().padStart(2, "0");
44
+ const pad3 = (n) => n.toString().padStart(3, "0");
45
+ return `${date.getUTCFullYear()}${pad2(date.getUTCMonth() + 1)}${pad2(date.getUTCDate())}-${pad2(date.getUTCHours())}${pad2(date.getUTCMinutes())}${pad2(date.getUTCSeconds())}-${pad3(date.getUTCMilliseconds())}`;
46
+ }
47
+ function createProcessContext(config) {
48
+ let counter = 0;
49
+ const handles = /* @__PURE__ */ new Map();
50
+ const defaultCwd = config?.cwd ?? process.cwd();
51
+ const defaultEnv = config?.env;
52
+ /**
53
+ * Per-context background-task registry. Entries live for the context's
54
+ * lifetime — even after the child exits — so the model can read output
55
+ * of completed tasks until `destroy()` tears everything down. Kept as
56
+ * a plain Map (not a class) per code-quality checklist #7: no premature
57
+ * abstraction. The state and the operations on it live inline.
58
+ */
59
+ const tasks = /* @__PURE__ */ new Map();
60
+ let taskCounter = 0;
61
+ /**
62
+ * Per-context UTC timestamp segment baked into every background task's
63
+ * log filename. Same `taskCounter` value across two contexts (e.g. a
64
+ * TUI restart) would otherwise re-open the SAME `bash_<n>.log` file —
65
+ * we open with `flags: 'a'` so the new task would APPEND into the old
66
+ * log, producing scrambled output. The timestamp guarantees each
67
+ * context owns a distinct log filename without forcing the
68
+ * model-facing task id (`bash_<n>`) to grow longer.
69
+ *
70
+ * Format: `YYYYMMDD-HHMMSS-mmm` in UTC.
71
+ * - Sortable (lexical sort = chronological sort).
72
+ * - Unambiguous (UTC sidesteps DST / locale shifts).
73
+ * - Filesystem-safe (digits + hyphens only).
74
+ * - Millisecond precision avoids same-second-restart collisions.
75
+ *
76
+ * The timestamp is computed once per context, NOT per task — all of a
77
+ * context's tasks share the same suffix so a directory listing groups
78
+ * cleanly by "which run produced these".
79
+ */
80
+ const contextTimestamp = formatContextTimestamp(/* @__PURE__ */ new Date());
81
+ /**
82
+ * Last-resort orphan reaper. With `detached: true`, background tasks
83
+ * are in their OWN process group — when the parent (zidane TUI) dies,
84
+ * the OS does NOT send them SIGHUP and they keep running indefinitely.
85
+ * The user's "Ctrl+C the TUI" intent is "stop everything I started",
86
+ * not "leak a `sleep 60` into the background".
87
+ *
88
+ * `process.on('exit')` fires SYNCHRONOUSLY on `process.exit()` AND on
89
+ * natural shutdown — exactly the seam we need. The handler can only
90
+ * do synchronous work (Node ignores async), but `process.kill` IS
91
+ * synchronous, so a SIGTERM-the-group sweep lands cleanly. The kill
92
+ * is best-effort: already-dead children throw ESRCH (swallowed).
93
+ *
94
+ * Registered lazily on first `execBackground` so contexts that never
95
+ * background a task don't pay the listener cost. Deregistered in
96
+ * `destroy()` so reconstructed contexts don't accumulate listeners
97
+ * (Node warns past 10 — a long-running session that switches sessions
98
+ * frequently would otherwise hit that).
99
+ */
100
+ let exitHandlerRegistered = false;
101
+ const exitHandler = () => {
102
+ for (const task of tasks.values()) {
103
+ if (task.status !== "running") continue;
104
+ const pid = task.child.pid;
105
+ if (pid === void 0) continue;
106
+ try {
107
+ if (SUPPORTS_PROCESS_GROUPS) process.kill(-pid, "SIGTERM");
108
+ else process.kill(pid, "SIGTERM");
109
+ } catch {}
110
+ }
111
+ };
112
+ return {
113
+ type: "process",
114
+ capabilities: {
115
+ shell: true,
116
+ filesystem: true,
117
+ network: true,
118
+ gpu: false
119
+ },
120
+ async spawn(overrides) {
121
+ const id = `process-${++counter}`;
122
+ const cwd = overrides?.cwd ?? defaultCwd;
123
+ await mkdir(cwd, { recursive: true });
124
+ const handle = {
125
+ id,
126
+ type: "process",
127
+ cwd
128
+ };
129
+ handles.set(id, handle);
130
+ return handle;
131
+ },
132
+ async exec(handle, command, options) {
133
+ const cwd = options?.cwd ? resolve(handle.cwd, options.cwd) : handle.cwd;
134
+ if (options?.signal?.aborted) return {
135
+ stdout: "",
136
+ stderr: "aborted by signal before spawn",
137
+ exitCode: 143
138
+ };
139
+ const timeoutMs = (options?.timeout ?? config?.limits?.timeout ?? 30) * 1e3;
140
+ const maxBuffer = DEFAULT_MAX_BUFFER;
141
+ return new Promise((resolveP) => {
142
+ const child = spawn("/bin/sh", ["-c", command], {
143
+ cwd,
144
+ env: {
145
+ ...process.env,
146
+ ...defaultEnv,
147
+ ...options?.env
148
+ },
149
+ stdio: [
150
+ "ignore",
151
+ "pipe",
152
+ "pipe"
153
+ ],
154
+ detached: SUPPORTS_PROCESS_GROUPS
155
+ });
156
+ let stdout = "";
157
+ let stderr = "";
158
+ let bufferTruncated = false;
159
+ let timedOut = false;
160
+ let killedByAbort = false;
161
+ let settled = false;
162
+ const appendCapped = (slot, chunk) => {
163
+ const current = slot === "stdout" ? stdout : stderr;
164
+ if (current.length >= maxBuffer) return;
165
+ const room = maxBuffer - current.length;
166
+ const piece = chunk.length <= room ? chunk.toString("utf8") : chunk.subarray(0, room).toString("utf8");
167
+ if (slot === "stdout") stdout += piece;
168
+ else stderr += piece;
169
+ if (chunk.length > room) {
170
+ bufferTruncated = true;
171
+ killProcessGroup(child, "SIGTERM");
172
+ }
173
+ };
174
+ child.stdout?.on("data", (chunk) => appendCapped("stdout", chunk));
175
+ child.stderr?.on("data", (chunk) => appendCapped("stderr", chunk));
176
+ const timeoutTimer = timeoutMs > 0 ? setTimeout(() => {
177
+ timedOut = true;
178
+ killProcessGroup(child, "SIGTERM");
179
+ }, timeoutMs) : void 0;
180
+ const onAbort = () => {
181
+ killedByAbort = true;
182
+ killProcessGroup(child, "SIGTERM");
183
+ };
184
+ const userSignal = options?.signal;
185
+ if (userSignal) userSignal.addEventListener("abort", onAbort, { once: true });
186
+ const settle = (exitCode, extraStderr) => {
187
+ if (settled) return;
188
+ settled = true;
189
+ if (timeoutTimer) clearTimeout(timeoutTimer);
190
+ if (userSignal) userSignal.removeEventListener("abort", onAbort);
191
+ const finalStderr = extraStderr ? stderr ? `${stderr}\n${extraStderr}` : extraStderr : stderr;
192
+ resolveP({
193
+ stdout,
194
+ stderr: finalStderr,
195
+ exitCode
196
+ });
197
+ };
198
+ child.on("error", (err) => {
199
+ settle(1, err.message);
200
+ });
201
+ child.on("close", (code, signal) => {
202
+ if (killedByAbort) {
203
+ settle(143, "aborted by signal");
204
+ return;
205
+ }
206
+ if (timedOut) {
207
+ settle(124, `command timed out after ${timeoutMs}ms`);
208
+ return;
209
+ }
210
+ if (bufferTruncated) {
211
+ settle(143, `output exceeded ${maxBuffer}-byte buffer; process killed`);
212
+ return;
213
+ }
214
+ if (signal) {
215
+ settle(143, `terminated by signal ${signal}`);
216
+ return;
217
+ }
218
+ settle(typeof code === "number" ? code : 1);
219
+ });
220
+ });
221
+ },
222
+ async readFile(handle, path) {
223
+ return readFile(resolve(handle.cwd, path), "utf-8");
224
+ },
225
+ async readFileBinary(handle, path) {
226
+ const buf = await readFile(resolve(handle.cwd, path));
227
+ return new Uint8Array(buf);
228
+ },
229
+ async writeFile(handle, path, content) {
230
+ const fullPath = resolve(handle.cwd, path);
231
+ await mkdir(dirname(fullPath), { recursive: true });
232
+ await writeFile(fullPath, content, "utf-8");
233
+ },
234
+ async listFiles(handle, path) {
235
+ return readdir(resolve(handle.cwd, path));
236
+ },
237
+ async execBackground(handle, command, options) {
238
+ const cwd = options.cwd ? resolve(handle.cwd, options.cwd) : handle.cwd;
239
+ await mkdir(options.outputDir, { recursive: true });
240
+ const taskId = `bash_${++taskCounter}`;
241
+ assertSafeTaskId(taskId);
242
+ const outputPath = resolve(options.outputDir, `${taskId}.${contextTimestamp}.log`);
243
+ if (!exitHandlerRegistered) {
244
+ process.on("exit", exitHandler);
245
+ exitHandlerRegistered = true;
246
+ }
247
+ const outputStream = createWriteStream(outputPath, { flags: "a" });
248
+ outputStream.on("error", (err) => {
249
+ if (process.env.ZIDANE_DEBUG) process.stderr.write(`[zidane/contexts] task ${taskId} log stream error: ${err.message}\n`);
250
+ });
251
+ const child = spawn("/bin/sh", ["-c", command], {
252
+ cwd,
253
+ env: {
254
+ ...process.env,
255
+ ...defaultEnv,
256
+ ...options.env
257
+ },
258
+ stdio: [
259
+ "ignore",
260
+ "pipe",
261
+ "pipe"
262
+ ],
263
+ detached: SUPPORTS_PROCESS_GROUPS
264
+ });
265
+ const state = {
266
+ taskId,
267
+ handleId: handle.id,
268
+ pid: child.pid ?? -1,
269
+ command,
270
+ cwd,
271
+ startedAt: Date.now(),
272
+ outputPath,
273
+ outputStream,
274
+ child,
275
+ status: "running",
276
+ bytesWritten: 0,
277
+ settled: false,
278
+ onExit: options.onExit
279
+ };
280
+ tasks.set(taskId, state);
281
+ const appendChunk = (chunk) => {
282
+ state.bytesWritten += chunk.length;
283
+ outputStream.write(chunk);
284
+ };
285
+ child.stdout?.on("data", (chunk) => appendChunk(chunk));
286
+ child.stderr?.on("data", (chunk) => appendChunk(chunk));
287
+ const settle = (cause, code, signal, errMessage) => {
288
+ if (state.settled) return;
289
+ state.settled = true;
290
+ const status = signal === "SIGTERM" || state.killRequested ? "killed" : "exited";
291
+ const exitCode = code !== null ? code : signal === "SIGTERM" ? 143 : signal ? 128 : 1;
292
+ state.status = status;
293
+ state.exitCode = exitCode;
294
+ if (signal) state.signal = signal;
295
+ if (errMessage) try {
296
+ outputStream.write(`\n${errMessage}\n`);
297
+ } catch {}
298
+ outputStream.end(() => {
299
+ try {
300
+ state.onExit(stateToTaskExitInfo(state));
301
+ } catch (err) {
302
+ if (process.env.ZIDANE_DEBUG) process.stderr.write(`[zidane/contexts] task ${taskId} onExit threw: ${err instanceof Error ? err.message : String(err)}\n`);
303
+ }
304
+ });
305
+ };
306
+ child.on("close", (code, signal) => settle("close", code, signal));
307
+ child.on("error", (err) => settle("error", null, null, `[spawn error] ${err.message}`));
308
+ return {
309
+ taskId,
310
+ pid: state.pid,
311
+ outputPath
312
+ };
313
+ },
314
+ async killBackground(handle, taskId) {
315
+ const state = tasks.get(taskId);
316
+ if (!state || state.handleId !== handle.id) return null;
317
+ if (state.status !== "running") return stateToTaskExitInfo(state);
318
+ state.killRequested = true;
319
+ const closed = new Promise((resolveP) => {
320
+ if (state.settled) {
321
+ resolveP();
322
+ return;
323
+ }
324
+ const originalOnExit = state.onExit;
325
+ state.onExit = (info) => {
326
+ originalOnExit(info);
327
+ resolveP();
328
+ };
329
+ });
330
+ killProcessGroup(state.child, "SIGTERM");
331
+ await closed;
332
+ return stateToTaskExitInfo(state);
333
+ },
334
+ async reassignBackgroundTasks(fromHandle, toHandle, newOnExit) {
335
+ if (fromHandle.id === toHandle.id) return [];
336
+ const promoted = [];
337
+ for (const state of tasks.values()) {
338
+ if (state.handleId !== fromHandle.id || state.status !== "running") continue;
339
+ state.handleId = toHandle.id;
340
+ if (newOnExit) state.onExit = newOnExit;
341
+ promoted.push(stateToTaskEntry(state));
342
+ }
343
+ return promoted;
344
+ },
345
+ async listBackground(handle) {
346
+ return [...tasks.values()].filter((s) => s.handleId === handle.id).sort((a, b) => a.startedAt - b.startedAt).map(stateToTaskEntry);
347
+ },
348
+ async destroy(handle) {
349
+ const survivors = [...tasks.values()].filter((s) => s.handleId === handle.id && !s.settled);
350
+ await Promise.all(survivors.map(async (state) => {
351
+ state.killRequested = true;
352
+ await new Promise((resolveP) => {
353
+ const originalOnExit = state.onExit;
354
+ state.onExit = (info) => {
355
+ originalOnExit(info);
356
+ resolveP();
357
+ };
358
+ killProcessGroup(state.child, "SIGTERM");
359
+ });
360
+ }));
361
+ for (const [taskId, state] of tasks) if (state.handleId === handle.id) tasks.delete(taskId);
362
+ handles.delete(handle.id);
363
+ if (exitHandlerRegistered && handles.size === 0) {
364
+ process.off("exit", exitHandler);
365
+ exitHandlerRegistered = false;
366
+ }
367
+ }
368
+ };
369
+ }
370
+ /**
371
+ * Send `signal` to the child's whole process group. Falls back to a
372
+ * single-process kill on Windows (no POSIX process groups). Shared
373
+ * across the foreground `exec` path, the background spawn / kill
374
+ * paths, and the shutdown-time orphan reaper — keeping one definition
375
+ * so the kill semantics can't drift between them.
376
+ */
377
+ function killProcessGroup(child, signal) {
378
+ const pid = child.pid;
379
+ if (pid === void 0) return;
380
+ try {
381
+ if (SUPPORTS_PROCESS_GROUPS) process.kill(-pid, signal);
382
+ else process.kill(pid, signal);
383
+ } catch {}
384
+ }
385
+ /**
386
+ * Project a `TaskState` to the `TaskEntry` shape `listBackground` and
387
+ * `reassignBackgroundTasks` return. Single helper keeps the shape
388
+ * consistent across both call sites (and a future addition of fields
389
+ * to `TaskEntry` only needs to land here).
390
+ */
391
+ function stateToTaskEntry(state) {
392
+ return {
393
+ taskId: state.taskId,
394
+ pid: state.pid,
395
+ command: state.command,
396
+ cwd: state.cwd,
397
+ startedAt: state.startedAt,
398
+ outputPath: state.outputPath,
399
+ status: state.status,
400
+ ...state.exitCode !== void 0 ? { exitCode: state.exitCode } : {},
401
+ ...state.signal ? { signal: state.signal } : {},
402
+ bytesWritten: state.bytesWritten
403
+ };
404
+ }
405
+ /**
406
+ * Project a settled `TaskState` to the `TaskExitInfo` shape `settle()`
407
+ * fires from `onExit` and `killBackground` returns on the
408
+ * cached-exit path. Pre-condition: `state.status !== 'running'`
409
+ * (callers gate on this).
410
+ */
411
+ function stateToTaskExitInfo(state) {
412
+ return {
413
+ taskId: state.taskId,
414
+ status: state.status,
415
+ exitCode: state.exitCode ?? 0,
416
+ ...state.signal ? { signal: state.signal } : {},
417
+ outputPath: state.outputPath,
418
+ durationMs: Date.now() - state.startedAt,
419
+ command: state.command
420
+ };
421
+ }
422
+ //#endregion
423
+ //#region src/contexts/sandbox.ts
424
+ function createSandboxContext(provider) {
425
+ const sandboxes = /* @__PURE__ */ new Map();
426
+ function getSandboxId(handle) {
427
+ const id = sandboxes.get(handle.id);
428
+ if (!id) throw new Error(`Sandbox ${handle.id} not found`);
429
+ return id;
430
+ }
431
+ return {
432
+ type: "sandbox",
433
+ capabilities: {
434
+ shell: true,
435
+ filesystem: true,
436
+ network: true,
437
+ gpu: false
438
+ },
439
+ async spawn(config) {
440
+ const result = await provider.spawn(config ?? {});
441
+ const handle = {
442
+ id: result.id,
443
+ type: "sandbox",
444
+ cwd: result.cwd
445
+ };
446
+ sandboxes.set(handle.id, result.id);
447
+ return handle;
448
+ },
449
+ async exec(handle, command, options) {
450
+ return provider.exec(getSandboxId(handle), command, options);
451
+ },
452
+ async readFile(handle, path) {
453
+ return provider.readFile(getSandboxId(handle), path);
454
+ },
455
+ async writeFile(handle, path, content) {
456
+ return provider.writeFile(getSandboxId(handle), path, content);
457
+ },
458
+ async listFiles(handle, path) {
459
+ return provider.listFiles(getSandboxId(handle), path);
460
+ },
461
+ async destroy(handle) {
462
+ const id = sandboxes.get(handle.id);
463
+ if (!id) return;
464
+ await provider.destroy(id);
465
+ sandboxes.delete(handle.id);
466
+ }
467
+ };
468
+ }
469
+ //#endregion
470
+ export { createProcessContext as n, createSandboxContext as t };
471
+
472
+ //# sourceMappingURL=contexts-DhmMlT2W.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contexts-DhmMlT2W.js","names":["spawnChild"],"sources":["../src/contexts/process.ts","../src/contexts/sandbox.ts"],"sourcesContent":["/**\n * In-process execution context.\n *\n * Runs everything in the current Node/Bun process.\n * No isolation — fastest, used as the default.\n */\n\nimport type { Buffer } from 'node:buffer'\nimport type { ChildProcess } from 'node:child_process'\nimport type { WriteStream } from 'node:fs'\nimport type { ContextCapabilities, ExecResult, ExecutionContext, ExecutionHandle, SpawnConfig, TaskEntry, TaskExitInfo, TaskHandle } from './types'\nimport { spawn as spawnChild } from 'node:child_process'\nimport { createWriteStream } from 'node:fs'\nimport { mkdir, readdir, readFile, writeFile } from 'node:fs/promises'\nimport { dirname, resolve } from 'node:path'\n\n/**\n * Whether the host supports POSIX process groups (the `detached: true` +\n * `process.kill(-pid)` combination). Windows doesn't — its job-object\n * model is shaped differently — so on win32 we fall back to killing the\n * shell wrapper alone (matches pre-fix behavior; better than nothing).\n */\nconst SUPPORTS_PROCESS_GROUPS = process.platform !== 'win32'\n\n/**\n * Default cap on captured stdout / stderr per child. Matches the\n * pre-fix `child_process.exec` setting so existing callers see the\n * same buffer envelope. Output beyond this is truncated and a\n * marker is appended to stderr.\n */\nconst DEFAULT_MAX_BUFFER = 10 * 1024 * 1024\n\n/**\n * Sanitize a task id before it's joined into a filesystem path.\n *\n * We mint `bash_<n>` ids ourselves (no user input flows into the path\n * for `ProcessContext`), so this is defensive — but third-party contexts\n * MAY accept caller-provided ids, so the helper exists for them too.\n * Anything that doesn't match the expected shape is rejected — never\n * coerced — so the call site sees a clear error rather than a\n * traversal-shaped path.\n */\nconst TASK_ID_RE = /^[a-z][\\w-]*$/i\n\nfunction assertSafeTaskId(taskId: string): void {\n if (!TASK_ID_RE.test(taskId))\n throw new Error(`Invalid task id \"${taskId}\" — must match ${TASK_ID_RE}.`)\n}\n\n/**\n * Format `date` as `YYYYMMDD-HHMMSS-mmm` in UTC.\n *\n * Pinned to UTC so the lexical sort of two timestamps always matches\n * their chronological order (local time + DST does not). Used as the\n * per-context suffix on background-task log filenames; see the field\n * doc on `contextTimestamp` for the why.\n */\nexport function formatContextTimestamp(date: Date): string {\n const pad2 = (n: number): string => n.toString().padStart(2, '0')\n const pad3 = (n: number): string => n.toString().padStart(3, '0')\n const y = date.getUTCFullYear()\n const M = pad2(date.getUTCMonth() + 1)\n const d = pad2(date.getUTCDate())\n const h = pad2(date.getUTCHours())\n const m = pad2(date.getUTCMinutes())\n const s = pad2(date.getUTCSeconds())\n const ms = pad3(date.getUTCMilliseconds())\n return `${y}${M}${d}-${h}${m}${s}-${ms}`\n}\n\n/** Pattern of a background-task log filename. Used by tests + tooling. */\nexport const TASK_LOG_FILENAME_RE = /^(bash_\\d+)\\.(\\d{8}-\\d{6}-\\d{3})\\.log$/\n\nexport function createProcessContext(config?: SpawnConfig): ExecutionContext {\n let counter = 0\n const handles = new Map<string, ExecutionHandle>()\n const defaultCwd = config?.cwd ?? process.cwd()\n const defaultEnv = config?.env\n\n /**\n * Per-context background-task registry. Entries live for the context's\n * lifetime — even after the child exits — so the model can read output\n * of completed tasks until `destroy()` tears everything down. Kept as\n * a plain Map (not a class) per code-quality checklist #7: no premature\n * abstraction. The state and the operations on it live inline.\n */\n const tasks = new Map<string, TaskState>()\n let taskCounter = 0\n\n /**\n * Per-context UTC timestamp segment baked into every background task's\n * log filename. Same `taskCounter` value across two contexts (e.g. a\n * TUI restart) would otherwise re-open the SAME `bash_<n>.log` file —\n * we open with `flags: 'a'` so the new task would APPEND into the old\n * log, producing scrambled output. The timestamp guarantees each\n * context owns a distinct log filename without forcing the\n * model-facing task id (`bash_<n>`) to grow longer.\n *\n * Format: `YYYYMMDD-HHMMSS-mmm` in UTC.\n * - Sortable (lexical sort = chronological sort).\n * - Unambiguous (UTC sidesteps DST / locale shifts).\n * - Filesystem-safe (digits + hyphens only).\n * - Millisecond precision avoids same-second-restart collisions.\n *\n * The timestamp is computed once per context, NOT per task — all of a\n * context's tasks share the same suffix so a directory listing groups\n * cleanly by \"which run produced these\".\n */\n const contextTimestamp = formatContextTimestamp(new Date())\n\n /**\n * Last-resort orphan reaper. With `detached: true`, background tasks\n * are in their OWN process group — when the parent (zidane TUI) dies,\n * the OS does NOT send them SIGHUP and they keep running indefinitely.\n * The user's \"Ctrl+C the TUI\" intent is \"stop everything I started\",\n * not \"leak a `sleep 60` into the background\".\n *\n * `process.on('exit')` fires SYNCHRONOUSLY on `process.exit()` AND on\n * natural shutdown — exactly the seam we need. The handler can only\n * do synchronous work (Node ignores async), but `process.kill` IS\n * synchronous, so a SIGTERM-the-group sweep lands cleanly. The kill\n * is best-effort: already-dead children throw ESRCH (swallowed).\n *\n * Registered lazily on first `execBackground` so contexts that never\n * background a task don't pay the listener cost. Deregistered in\n * `destroy()` so reconstructed contexts don't accumulate listeners\n * (Node warns past 10 — a long-running session that switches sessions\n * frequently would otherwise hit that).\n */\n let exitHandlerRegistered = false\n const exitHandler = (): void => {\n for (const task of tasks.values()) {\n if (task.status !== 'running')\n continue\n const pid = task.child.pid\n if (pid === undefined)\n continue\n try {\n if (SUPPORTS_PROCESS_GROUPS)\n process.kill(-pid, 'SIGTERM')\n else\n process.kill(pid, 'SIGTERM')\n }\n catch {\n // ESRCH (already dead) / EPERM (lost ownership). Swallow —\n // the process either won't kill cleanly OR is already gone,\n // both acceptable at shutdown.\n }\n }\n }\n\n return {\n type: 'process',\n\n capabilities: {\n shell: true,\n filesystem: true,\n network: true,\n gpu: false,\n } satisfies ContextCapabilities,\n\n async spawn(overrides?: SpawnConfig): Promise<ExecutionHandle> {\n const id = `process-${++counter}`\n const cwd = overrides?.cwd ?? defaultCwd\n\n await mkdir(cwd, { recursive: true })\n\n const handle: ExecutionHandle = { id, type: 'process', cwd }\n handles.set(id, handle)\n return handle\n },\n\n async exec(\n handle: ExecutionHandle,\n command: string,\n options?: { cwd?: string, env?: Record<string, string>, timeout?: number, signal?: AbortSignal },\n ): Promise<ExecResult> {\n const cwd = options?.cwd ? resolve(handle.cwd, options.cwd) : handle.cwd\n\n // Pre-aborted fast path: skip the spawn entirely and synthesize a\n // killed-by-signal result. Saves a spawn round-trip + dodges Node\n // emitting an immediate `AbortError`.\n if (options?.signal?.aborted) {\n return { stdout: '', stderr: 'aborted by signal before spawn', exitCode: 143 }\n }\n\n const timeoutMs = (options?.timeout ?? config?.limits?.timeout ?? 30) * 1000\n const maxBuffer = DEFAULT_MAX_BUFFER\n\n return new Promise<ExecResult>((resolveP) => {\n // Spawn as a NEW process group leader so we can kill the whole\n // subtree on abort. Without `detached: true`, sending SIGTERM to\n // the shell's pid only kills the shell wrapper — its child\n // processes (the actual `sleep`, `npm`, `python`, …) get\n // reparented to init and keep running. `process.kill(-pid, …)`\n // with a NEGATIVE pid targets the whole process group; that's\n // the POSIX idiom for \"shut down everything I started\".\n //\n // On Windows there are no process groups in the POSIX sense, so\n // we leave `detached` off and accept the shell-only kill — the\n // platform's job-object machinery is the path forward there if\n // we ever need it, but it's not the bug zidane's users are\n // hitting today.\n const child = spawnChild('/bin/sh', ['-c', command], {\n cwd,\n env: { ...process.env, ...defaultEnv, ...options?.env },\n stdio: ['ignore', 'pipe', 'pipe'],\n detached: SUPPORTS_PROCESS_GROUPS,\n })\n\n let stdout = ''\n let stderr = ''\n let bufferTruncated = false\n let timedOut = false\n let killedByAbort = false\n let settled = false\n\n const appendCapped = (slot: 'stdout' | 'stderr', chunk: Buffer): void => {\n const current = slot === 'stdout' ? stdout : stderr\n if (current.length >= maxBuffer)\n return\n const room = maxBuffer - current.length\n const piece = chunk.length <= room ? chunk.toString('utf8') : chunk.subarray(0, room).toString('utf8')\n if (slot === 'stdout')\n stdout += piece\n else\n stderr += piece\n if (chunk.length > room) {\n bufferTruncated = true\n // Kill on overflow — matches `execAsync`'s `maxBuffer`\n // behavior (which kills the child and surfaces an error).\n killProcessGroup(child, 'SIGTERM')\n }\n }\n\n child.stdout?.on('data', chunk => appendCapped('stdout', chunk as Buffer))\n child.stderr?.on('data', chunk => appendCapped('stderr', chunk as Buffer))\n\n const timeoutTimer = timeoutMs > 0\n ? setTimeout(() => {\n timedOut = true\n killProcessGroup(child, 'SIGTERM')\n }, timeoutMs)\n : undefined\n\n const onAbort = (): void => {\n killedByAbort = true\n killProcessGroup(child, 'SIGTERM')\n }\n const userSignal = options?.signal\n if (userSignal)\n userSignal.addEventListener('abort', onAbort, { once: true })\n\n const settle = (exitCode: number, extraStderr?: string): void => {\n if (settled)\n return\n settled = true\n if (timeoutTimer)\n clearTimeout(timeoutTimer)\n if (userSignal)\n userSignal.removeEventListener('abort', onAbort)\n const finalStderr = extraStderr\n ? (stderr ? `${stderr}\\n${extraStderr}` : extraStderr)\n : stderr\n resolveP({ stdout, stderr: finalStderr, exitCode })\n }\n\n child.on('error', (err) => {\n // Spawn failure (ENOENT on `/bin/sh`, EACCES, …). Mirror\n // `execAsync`'s \"rejects with an Error\" shape by surfacing\n // the message on stderr and a non-zero exit.\n settle(1, err.message)\n })\n\n child.on('close', (code, signal) => {\n // Order matters: killed-by-our-abort wins over timeout wins\n // over natural exit, because the abort listener fires first\n // when the user cancels mid-timeout-window. All three land\n // here through `close`, but we tag the stderr suffix /\n // exit-code differently so callers can tell the cause.\n if (killedByAbort) {\n settle(143, 'aborted by signal')\n return\n }\n if (timedOut) {\n settle(124, `command timed out after ${timeoutMs}ms`)\n return\n }\n if (bufferTruncated) {\n settle(143, `output exceeded ${maxBuffer}-byte buffer; process killed`)\n return\n }\n if (signal) {\n // Killed by some other signal we didn't issue. Treat as\n // signal-killed for consumer compat.\n settle(128 + 15, `terminated by signal ${signal}`)\n return\n }\n settle(typeof code === 'number' ? code : 1)\n })\n })\n },\n\n async readFile(handle: ExecutionHandle, path: string): Promise<string> {\n return readFile(resolve(handle.cwd, path), 'utf-8')\n },\n\n async readFileBinary(handle: ExecutionHandle, path: string): Promise<Uint8Array> {\n // No encoding → returns a Buffer (which is a Uint8Array). Used by\n // read_file to ferry image / binary content into the multimodal route.\n const buf = await readFile(resolve(handle.cwd, path))\n return new Uint8Array(buf)\n },\n\n async writeFile(handle: ExecutionHandle, path: string, content: string): Promise<void> {\n const fullPath = resolve(handle.cwd, path)\n await mkdir(dirname(fullPath), { recursive: true })\n await writeFile(fullPath, content, 'utf-8')\n },\n\n async listFiles(handle: ExecutionHandle, path: string): Promise<string[]> {\n return readdir(resolve(handle.cwd, path))\n },\n\n async execBackground(\n handle: ExecutionHandle,\n command: string,\n options: {\n cwd?: string\n env?: Record<string, string>\n outputDir: string\n onExit: (info: TaskExitInfo) => void\n },\n ): Promise<TaskHandle> {\n const cwd = options.cwd ? resolve(handle.cwd, options.cwd) : handle.cwd\n\n await mkdir(options.outputDir, { recursive: true })\n\n // Mint id + path. The id is sequential per context (model-facing,\n // short, ergonomic for `shell_kill`). The log FILENAME embeds the\n // context's start timestamp so two contexts sharing an `outputDir`\n // (TUI restart on the same session, concurrent zidane instances,\n // …) never resolve to the same file — we open with `flags: 'a'`\n // and a name collision would interleave their output. Path\n // validation is defensive — we mint our own ids so it never trips\n // today, but it pins the invariant for forks / third parties.\n const taskId = `bash_${++taskCounter}`\n assertSafeTaskId(taskId)\n const outputPath = resolve(options.outputDir, `${taskId}.${contextTimestamp}.log`)\n\n // Install the orphan reaper on first task. See `exitHandler`'s\n // JSDoc for the kill-on-shutdown rationale.\n if (!exitHandlerRegistered) {\n process.on('exit', exitHandler)\n exitHandlerRegistered = true\n }\n\n // Open the output file. The timestamped path is unique per context\n // so a brand-new file is the expected outcome; `flags: 'a'` is kept\n // as the safe default (preserves bytes if the path collides for any\n // reason — same-millisecond context creation, manual pre-population,\n // etc.) rather than blindly truncating. Streams are opened BEFORE\n // the spawn to avoid a race where the child writes before the stream\n // is ready — `child_process` buffers stdio until the consumer\n // attaches, but the FS handle has to exist either way for our pipe.\n const outputStream: WriteStream = createWriteStream(outputPath, { flags: 'a' })\n // Surface FS errors (ENOSPC, EACCES on a remounted FS, etc.)\n // under ZIDANE_DEBUG instead of crashing the host via an\n // unhandled 'error' event. Without a listener Node escalates\n // any stream-level error to an uncaughtException and the whole\n // process exits — the model and the user would lose every\n // unrelated in-flight piece of work to one bad task's disk\n // hiccup. Swallow + log is the safer default for a fire-and-\n // forget log writer; the task's exit code still reports.\n outputStream.on('error', (err) => {\n if (process.env.ZIDANE_DEBUG)\n process.stderr.write(`[zidane/contexts] task ${taskId} log stream error: ${err.message}\\n`)\n })\n\n // Spawn as a NEW process group leader so we can kill the whole\n // subtree on demand. Same primitive `exec` uses for foreground\n // shells — see the long comment in that method for the\n // process-group rationale.\n const child = spawnChild('/bin/sh', ['-c', command], {\n cwd,\n env: { ...process.env, ...defaultEnv, ...options.env },\n stdio: ['ignore', 'pipe', 'pipe'],\n detached: SUPPORTS_PROCESS_GROUPS,\n })\n\n const state: TaskState = {\n taskId,\n handleId: handle.id,\n pid: child.pid ?? -1,\n command,\n cwd,\n startedAt: Date.now(),\n outputPath,\n outputStream,\n child,\n status: 'running',\n bytesWritten: 0,\n settled: false,\n onExit: options.onExit,\n }\n tasks.set(taskId, state)\n\n // Pipe both streams into the same file. Order between stdout and\n // stderr is preserved per-stream; cross-stream ordering depends on\n // Node's event loop — acceptable interleaving for log-shaped\n // output. Tracked-bytes is updated on every chunk for the\n // listBackground UX.\n const appendChunk = (chunk: Buffer): void => {\n state.bytesWritten += chunk.length\n outputStream.write(chunk)\n }\n child.stdout?.on('data', chunk => appendChunk(chunk as Buffer))\n child.stderr?.on('data', chunk => appendChunk(chunk as Buffer))\n\n // Settle path — at-most-once via `settled` flag (checklist #14).\n // Three trigger sources: `close` (natural OR signal-killed),\n // `error` (spawn failure), explicit `killBackground` (which\n // routes through `close` itself after the SIGTERM lands).\n const settle = (cause: 'close' | 'error', code: number | null, signal: NodeJS.Signals | null, errMessage?: string): void => {\n if (state.settled)\n return\n state.settled = true\n\n // Determine final status from cause + signal.\n const status: TaskExitInfo['status']\n = signal === 'SIGTERM' || state.killRequested\n ? 'killed'\n : 'exited'\n // Signal-killed children report null `code` from Node; map back\n // to the POSIX `128 + signum` convention so consumers can read\n // an integer either way.\n const exitCode = code !== null\n ? code\n : signal === 'SIGTERM'\n ? 143\n : signal\n ? 128\n : 1\n state.status = status\n state.exitCode = exitCode\n if (signal)\n state.signal = signal\n\n // Flush + close the WriteStream BEFORE firing onExit — model\n // may read the file in the same turn it receives the\n // notification, and a still-open stream can hold tail bytes\n // back from disk. `stream.end(callback)` is the documented\n // \"all queued writes are flushed when this fires\" idiom.\n //\n // ORDER MATTERS: any error preamble we want in the log file\n // (spawn failures with no stdout, buffer overflows) MUST be\n // written BEFORE `end()` — once `end()` is called the stream\n // is closed for writing and subsequent `.write()` calls are\n // dropped. Earlier revisions had this reversed and silently\n // lost ENOENT-on-`/bin/sh` messages.\n if (errMessage) {\n try {\n outputStream.write(`\\n${errMessage}\\n`)\n }\n catch {\n // Stream may have errored before this — best-effort only.\n }\n }\n outputStream.end(() => {\n // `stateToTaskExitInfo` reads the same fields we just set\n // on `state`, so the snapshot the consumer gets matches the\n // post-settle state exactly.\n try {\n state.onExit(stateToTaskExitInfo(state))\n }\n catch (err) {\n // Defensive — a buggy onExit callback shouldn't crash the\n // host. Surface via stderr under ZIDANE_DEBUG; otherwise\n // swallow. Matches the spawn-tool's bubbleError pattern.\n if (process.env.ZIDANE_DEBUG)\n process.stderr.write(`[zidane/contexts] task ${taskId} onExit threw: ${err instanceof Error ? err.message : String(err)}\\n`)\n }\n })\n }\n\n child.on('close', (code, signal) => settle('close', code, signal))\n child.on('error', err => settle('error', null, null, `[spawn error] ${err.message}`))\n\n return { taskId, pid: state.pid, outputPath }\n },\n\n async killBackground(handle: ExecutionHandle, taskId: string): Promise<TaskExitInfo | null> {\n const state = tasks.get(taskId)\n // Two miss cases collapse into one `null` return: unknown id, AND\n // known-id-but-not-owned-by-this-handle. The second case is the\n // subagent-can't-kill-parent-tasks defense; surfacing it as a\n // distinct error would leak the existence of the parent's task\n // to the subagent's model, which violates the per-handle\n // isolation contract.\n if (!state || state.handleId !== handle.id)\n return null\n // Already exited — return the cached info. We don't keep a\n // separate cached exit; the state itself carries every field\n // `TaskExitInfo` needs and `stateToTaskExitInfo` projects it.\n if (state.status !== 'running')\n return stateToTaskExitInfo(state)\n\n // Mark the intent BEFORE issuing the kill so the close handler\n // classifies the exit as `'killed'` even on platforms where the\n // SIGTERM-via-group lands faster than the close event drains.\n // (Checklist #14: at-most-once settle, plus correct status\n // classification regardless of event ordering.)\n state.killRequested = true\n\n // Wait for the existing close listener to fire — `settle()` does\n // all the flushing + onExit work. We just sit on a one-shot\n // promise tied to the `child.on('close')` we already registered\n // at spawn time.\n const closed = new Promise<void>((resolveP) => {\n if (state.settled) {\n resolveP()\n return\n }\n const originalOnExit = state.onExit\n state.onExit = (info) => {\n originalOnExit(info)\n resolveP()\n }\n })\n\n killProcessGroup(state.child, 'SIGTERM')\n await closed\n return stateToTaskExitInfo(state)\n },\n\n async reassignBackgroundTasks(\n fromHandle: ExecutionHandle,\n toHandle: ExecutionHandle,\n newOnExit?: (info: TaskExitInfo) => void,\n ): Promise<readonly TaskEntry[]> {\n // No-op when source = destination — keeps the spawn.ts call site\n // unconditional without forcing it to dedupe.\n if (fromHandle.id === toHandle.id)\n return []\n const promoted: TaskEntry[] = []\n for (const state of tasks.values()) {\n if (state.handleId !== fromHandle.id || state.status !== 'running')\n continue\n state.handleId = toHandle.id\n // Replace the natural-exit callback. The original closed over\n // the spawning agent's hook bus, which is about to be destroyed\n // — without rewiring, the task's eventual `background:exit`\n // fires into a torn-down hookable and the parent never learns.\n if (newOnExit)\n state.onExit = newOnExit\n promoted.push(stateToTaskEntry(state))\n }\n return promoted\n },\n\n async listBackground(handle: ExecutionHandle): Promise<readonly TaskEntry[]> {\n // Snapshot — callers must not assume the returned array stays\n // in sync with the live registry. Sorted by startedAt so the\n // model / UI sees consistent ordering across calls. Scoped to\n // the calling handle so subagents don't see the parent's tasks\n // (and vice versa) in their listing.\n return [...tasks.values()]\n .filter(s => s.handleId === handle.id)\n .sort((a, b) => a.startedAt - b.startedAt)\n .map(stateToTaskEntry)\n },\n\n async destroy(handle: ExecutionHandle): Promise<void> {\n // Kill every still-running background task SPAWNED THROUGH THIS\n // HANDLE before tearing the handle down. SIGTERM the groups,\n // await the close + flush, THEN drop the registry entries.\n // Sequential — destroy is one-shot teardown, the few ms of extra\n // latency aren't worth the synchronization complexity.\n //\n // The handle scope matters when the same `ExecutionContext` is\n // shared across a parent agent and its `spawn`-ed subagents (the\n // default — `spawn.ts` passes `execution: ctx.execution`). Each\n // agent mints its own `ExecutionHandle` and registers its\n // background tasks under that handle's id. Without the filter,\n // a child agent's `destroy()` (fired by `spawn.ts`'s `finally`\n // when the subagent finishes / is cancelled) would walk the\n // shared registry and SIGTERM the parent's tasks too. So\n // cancelling a subagent that has its own background shells now\n // correctly kills JUST those subagent shells, leaving the\n // parent's intact.\n const survivors = [...tasks.values()].filter(s => s.handleId === handle.id && !s.settled)\n await Promise.all(survivors.map(async (state) => {\n state.killRequested = true\n await new Promise<void>((resolveP) => {\n const originalOnExit = state.onExit\n state.onExit = (info) => {\n originalOnExit(info)\n resolveP()\n }\n killProcessGroup(state.child, 'SIGTERM')\n })\n }))\n // Drop only this handle's tasks from the registry. Other handles\n // (siblings, parent) keep their entries.\n for (const [taskId, state] of tasks) {\n if (state.handleId === handle.id)\n tasks.delete(taskId)\n }\n handles.delete(handle.id)\n // Drop the orphan reaper ONLY when no handles remain — otherwise\n // a child's `destroy()` would strip the parent's safety net. The\n // reaper protects every still-tracked task in the context, so it\n // sticks around until the LAST handle is gone.\n //\n // Without this guard, the spawn-tool sequence\n // parent.spawn(child) → child.run() → child.destroy() (auto)\n // would deregister the handler mid-parent-lifetime. The parent's\n // own subsequent Ctrl+C orphan-kill safety would silently degrade.\n if (exitHandlerRegistered && handles.size === 0) {\n process.off('exit', exitHandler)\n exitHandlerRegistered = false\n }\n },\n }\n}\n\n/**\n * Per-task state. Lives in the context's `tasks` registry. Fields are\n * mutated in place by the spawn / close / kill / destroy code paths —\n * the registry isn't immutable. Treat the type as a record-of-cells,\n * not a value.\n */\ninterface TaskState {\n taskId: string\n /**\n * `ExecutionHandle.id` of the spawning agent. The registry is\n * context-scoped (one Map shared across all handles a context minted),\n * so a per-task owner tag is what scopes `listBackground` /\n * `killBackground` / `destroy` to the calling handle's slice.\n *\n * Without this, a subagent spawned via `spawn` tool — which inherits\n * the parent's `ExecutionContext` but mints its OWN handle — would\n * see (and accidentally kill on `destroy()`) every task the parent\n * had running. Came up the first time the model spawned a subagent\n * that ran a background task: the subagent's run-end `destroy()`\n * SIGTERMed the parent's `npm run dev` mid-flight.\n */\n handleId: string\n pid: number\n command: string\n cwd: string\n startedAt: number\n outputPath: string\n outputStream: WriteStream\n child: ChildProcess\n status: 'running' | 'exited' | 'killed'\n exitCode?: number\n signal?: NodeJS.Signals\n bytesWritten: number\n /**\n * `at-most-once` settle latch. Multiple trigger sources (`close`,\n * `error`, `kill`) can race; the flag dedupes so `onExit` fires\n * exactly once per task (checklist #14).\n */\n settled: boolean\n /**\n * Set by `killBackground` / `destroy` before issuing SIGTERM so the\n * close handler classifies the exit as `'killed'` even when the\n * platform delivers the close event ahead of our intent record.\n */\n killRequested?: boolean\n onExit: (info: TaskExitInfo) => void\n}\n\n/**\n * Send `signal` to the child's whole process group. Falls back to a\n * single-process kill on Windows (no POSIX process groups). Shared\n * across the foreground `exec` path, the background spawn / kill\n * paths, and the shutdown-time orphan reaper — keeping one definition\n * so the kill semantics can't drift between them.\n */\nfunction killProcessGroup(child: ChildProcess, signal: NodeJS.Signals): void {\n const pid = child.pid\n if (pid === undefined)\n return\n try {\n if (SUPPORTS_PROCESS_GROUPS)\n process.kill(-pid, signal)\n else\n process.kill(pid, signal)\n }\n catch {\n // ESRCH / EPERM — process is already gone (race with natural exit)\n // or we lost the right to kill it. Both are safe to swallow.\n }\n}\n\n/**\n * Project a `TaskState` to the `TaskEntry` shape `listBackground` and\n * `reassignBackgroundTasks` return. Single helper keeps the shape\n * consistent across both call sites (and a future addition of fields\n * to `TaskEntry` only needs to land here).\n */\nfunction stateToTaskEntry(state: TaskState): TaskEntry {\n return {\n taskId: state.taskId,\n pid: state.pid,\n command: state.command,\n cwd: state.cwd,\n startedAt: state.startedAt,\n outputPath: state.outputPath,\n status: state.status,\n ...(state.exitCode !== undefined ? { exitCode: state.exitCode } : {}),\n ...(state.signal ? { signal: state.signal } : {}),\n bytesWritten: state.bytesWritten,\n }\n}\n\n/**\n * Project a settled `TaskState` to the `TaskExitInfo` shape `settle()`\n * fires from `onExit` and `killBackground` returns on the\n * cached-exit path. Pre-condition: `state.status !== 'running'`\n * (callers gate on this).\n */\nfunction stateToTaskExitInfo(state: TaskState): TaskExitInfo {\n return {\n taskId: state.taskId,\n status: state.status as Exclude<TaskState['status'], 'running'>,\n exitCode: state.exitCode ?? 0,\n ...(state.signal ? { signal: state.signal } : {}),\n outputPath: state.outputPath,\n durationMs: Date.now() - state.startedAt,\n command: state.command,\n }\n}\n","/**\n * Remote sandbox execution context.\n *\n * Offloads execution to a remote sandbox API (e.g. Rivet, E2B).\n * Specific providers implement the SandboxProvider interface.\n */\n\nimport type { ContextCapabilities, ExecResult, ExecutionContext, ExecutionHandle, SpawnConfig } from './types'\n\n// ---------------------------------------------------------------------------\n// Sandbox provider interface\n// ---------------------------------------------------------------------------\n\nexport interface SandboxProvider {\n name: string\n spawn: (config: SpawnConfig) => Promise<{ id: string, cwd: string }>\n exec: (sandboxId: string, command: string, options?: { cwd?: string, env?: Record<string, string>, timeout?: number }) => Promise<ExecResult>\n readFile: (sandboxId: string, path: string) => Promise<string>\n writeFile: (sandboxId: string, path: string, content: string) => Promise<void>\n listFiles: (sandboxId: string, path: string) => Promise<string[]>\n destroy: (sandboxId: string) => Promise<void>\n}\n\n// ---------------------------------------------------------------------------\n// Sandbox execution context\n// ---------------------------------------------------------------------------\n\nexport function createSandboxContext(provider: SandboxProvider): ExecutionContext {\n const sandboxes = new Map<string, string>()\n\n function getSandboxId(handle: ExecutionHandle): string {\n const id = sandboxes.get(handle.id)\n if (!id)\n throw new Error(`Sandbox ${handle.id} not found`)\n return id\n }\n\n return {\n type: 'sandbox',\n\n capabilities: {\n shell: true,\n filesystem: true,\n network: true,\n gpu: false,\n } satisfies ContextCapabilities,\n\n async spawn(config?: SpawnConfig): Promise<ExecutionHandle> {\n const result = await provider.spawn(config ?? {})\n const handle: ExecutionHandle = { id: result.id, type: 'sandbox', cwd: result.cwd }\n sandboxes.set(handle.id, result.id)\n return handle\n },\n\n async exec(handle: ExecutionHandle, command: string, options?): Promise<ExecResult> {\n return provider.exec(getSandboxId(handle), command, options)\n },\n\n async readFile(handle: ExecutionHandle, path: string): Promise<string> {\n return provider.readFile(getSandboxId(handle), path)\n },\n\n async writeFile(handle: ExecutionHandle, path: string, content: string): Promise<void> {\n return provider.writeFile(getSandboxId(handle), path, content)\n },\n\n async listFiles(handle: ExecutionHandle, path: string): Promise<string[]> {\n return provider.listFiles(getSandboxId(handle), path)\n },\n\n async destroy(handle: ExecutionHandle): Promise<void> {\n const id = sandboxes.get(handle.id)\n if (!id)\n return\n await provider.destroy(id)\n sandboxes.delete(handle.id)\n },\n }\n}\n"],"mappings":";;;;;;;;;;;AAsBA,MAAM,0BAA0B,QAAQ,aAAa;;;;;;;AAQrD,MAAM,qBAAqB,KAAK,OAAO;;;;;;;;;;;AAYvC,MAAM,aAAa;AAEnB,SAAS,iBAAiB,QAAsB;CAC9C,IAAI,CAAC,WAAW,KAAK,OAAO,EAC1B,MAAM,IAAI,MAAM,oBAAoB,OAAO,iBAAiB,WAAW,GAAG;;;;;;;;;;AAW9E,SAAgB,uBAAuB,MAAoB;CACzD,MAAM,QAAQ,MAAsB,EAAE,UAAU,CAAC,SAAS,GAAG,IAAI;CACjE,MAAM,QAAQ,MAAsB,EAAE,UAAU,CAAC,SAAS,GAAG,IAAI;CAQjE,OAAO,GAPG,KAAK,gBAOJ,GAND,KAAK,KAAK,aAAa,GAAG,EAMrB,GALL,KAAK,KAAK,YAAY,CAKb,CAAC,GAJV,KAAK,KAAK,aAAa,CAIT,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O,GAAG;GACnC,IAAI,CAAC,IACH;GACF,MAAM,SAAS,QAAQ,GAAG;GAC1B,UAAU,OAAO,OAAO,GAAG;;EAE9B"}
@@ -1,3 +1,3 @@
1
- import { a as ExecutionHandle, i as ExecutionContext, n as ContextType, o as SpawnConfig, r as ExecResult, t as ContextCapabilities } from "./types-Ce78ds4h.js";
2
- import { n as createSandboxContext, r as createProcessContext, t as SandboxProvider } from "./index-BiO_5Hm4.js";
3
- export { ContextCapabilities, ContextType, ExecResult, ExecutionContext, ExecutionHandle, SandboxProvider, SpawnConfig, createProcessContext, createSandboxContext };
1
+ import { a as ExecutionContext, c as TaskEntry, i as ExecResult, l as TaskExitInfo, n as ContextCapabilities, o as ExecutionHandle, r as ContextType, s as SpawnConfig, t as BackgroundTaskStatus, u as TaskHandle } from "./types-KukEp-mi.js";
2
+ import { n as createSandboxContext, r as createProcessContext, t as SandboxProvider } from "./index-CbS75MD3.js";
3
+ export { BackgroundTaskStatus, ContextCapabilities, ContextType, ExecResult, ExecutionContext, ExecutionHandle, SandboxProvider, SpawnConfig, TaskEntry, TaskExitInfo, TaskHandle, createProcessContext, createSandboxContext };
package/dist/contexts.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as createProcessContext, t as createSandboxContext } from "./contexts-BwiHIr2w.js";
1
+ import { n as createProcessContext, t as createSandboxContext } from "./contexts-DhmMlT2W.js";
2
2
  export { createProcessContext, createSandboxContext };