@bastani/atomic 0.9.5-alpha.4 → 0.9.5-alpha.6

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 (115) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/builtin/cursor/package.json +2 -2
  3. package/dist/builtin/intercom/package.json +1 -1
  4. package/dist/builtin/mcp/package.json +1 -1
  5. package/dist/builtin/subagents/CHANGELOG.md +7 -0
  6. package/dist/builtin/subagents/agents/debugger.md +2 -2
  7. package/dist/builtin/subagents/package.json +1 -1
  8. package/dist/builtin/web-access/package.json +1 -1
  9. package/dist/builtin/workflows/CHANGELOG.md +17 -0
  10. package/dist/builtin/workflows/builtin/deep-research-codebase-utils.ts +5 -5
  11. package/dist/builtin/workflows/builtin/goal-runner.ts +5 -5
  12. package/dist/builtin/workflows/builtin/goal-types.ts +1 -0
  13. package/dist/builtin/workflows/builtin/goal.d.ts +2 -0
  14. package/dist/builtin/workflows/builtin/goal.ts +9 -0
  15. package/dist/builtin/workflows/builtin/index.d.ts +2 -0
  16. package/dist/builtin/workflows/builtin/open-claude-design-runner.ts +5 -5
  17. package/dist/builtin/workflows/builtin/ralph-models.ts +25 -25
  18. package/dist/builtin/workflows/package.json +1 -1
  19. package/dist/builtin/workflows/src/runs/foreground/executor-stage-control.ts +8 -0
  20. package/dist/builtin/workflows/src/runs/foreground/stage-control-registry.ts +2 -0
  21. package/dist/builtin/workflows/src/runs/foreground/stage-tool-execution-buffer.ts +47 -0
  22. package/dist/builtin/workflows/src/tui/stage-chat-view-pending-tools.ts +9 -0
  23. package/dist/builtin/workflows/src/tui/stage-chat-view-render-settings.ts +27 -0
  24. package/dist/builtin/workflows/src/tui/stage-chat-view-state.ts +5 -6
  25. package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
  26. package/dist/core/agent-session-auto-compaction.js +3 -2
  27. package/dist/core/agent-session-auto-compaction.js.map +1 -1
  28. package/dist/core/agent-session-compaction.d.ts.map +1 -1
  29. package/dist/core/agent-session-compaction.js +25 -4
  30. package/dist/core/agent-session-compaction.js.map +1 -1
  31. package/dist/core/compaction/context-compaction-critical.d.ts +15 -0
  32. package/dist/core/compaction/context-compaction-critical.d.ts.map +1 -0
  33. package/dist/core/compaction/context-compaction-critical.js +57 -0
  34. package/dist/core/compaction/context-compaction-critical.js.map +1 -0
  35. package/dist/core/compaction/context-compaction-eviction.d.ts +4 -0
  36. package/dist/core/compaction/context-compaction-eviction.d.ts.map +1 -0
  37. package/dist/core/compaction/context-compaction-eviction.js +172 -0
  38. package/dist/core/compaction/context-compaction-eviction.js.map +1 -0
  39. package/dist/core/compaction/context-compaction-runner.d.ts +7 -1
  40. package/dist/core/compaction/context-compaction-runner.d.ts.map +1 -1
  41. package/dist/core/compaction/context-compaction-runner.js +97 -21
  42. package/dist/core/compaction/context-compaction-runner.js.map +1 -1
  43. package/dist/core/compaction/context-transcript-analysis.d.ts +3 -0
  44. package/dist/core/compaction/context-transcript-analysis.d.ts.map +1 -1
  45. package/dist/core/compaction/context-transcript-analysis.js +3 -3
  46. package/dist/core/compaction/context-transcript-analysis.js.map +1 -1
  47. package/dist/core/extensions/loader-core.d.ts.map +1 -1
  48. package/dist/core/extensions/loader-core.js +6 -0
  49. package/dist/core/extensions/loader-core.js.map +1 -1
  50. package/dist/core/model-resolver-scope.d.ts +9 -0
  51. package/dist/core/model-resolver-scope.d.ts.map +1 -1
  52. package/dist/core/model-resolver-scope.js +12 -4
  53. package/dist/core/model-resolver-scope.js.map +1 -1
  54. package/dist/core/model-resolver.d.ts +3 -2
  55. package/dist/core/model-resolver.d.ts.map +1 -1
  56. package/dist/core/model-resolver.js +1 -1
  57. package/dist/core/model-resolver.js.map +1 -1
  58. package/dist/core/resource-loader-extensions.d.ts.map +1 -1
  59. package/dist/core/resource-loader-extensions.js +4 -0
  60. package/dist/core/resource-loader-extensions.js.map +1 -1
  61. package/dist/core/resource-loader-reload.d.ts.map +1 -1
  62. package/dist/core/resource-loader-reload.js +11 -0
  63. package/dist/core/resource-loader-reload.js.map +1 -1
  64. package/dist/core/settings-manager-core.d.ts.map +1 -1
  65. package/dist/core/settings-manager-core.js +3 -2
  66. package/dist/core/settings-manager-core.js.map +1 -1
  67. package/dist/core/settings-storage.d.ts.map +1 -1
  68. package/dist/core/settings-storage.js +2 -1
  69. package/dist/core/settings-storage.js.map +1 -1
  70. package/dist/core/trust-manager.d.ts +9 -0
  71. package/dist/core/trust-manager.d.ts.map +1 -1
  72. package/dist/core/trust-manager.js +44 -2
  73. package/dist/core/trust-manager.js.map +1 -1
  74. package/dist/index.d.ts +1 -1
  75. package/dist/index.d.ts.map +1 -1
  76. package/dist/index.js +1 -1
  77. package/dist/index.js.map +1 -1
  78. package/dist/main-deferred-startup.d.ts +19 -0
  79. package/dist/main-deferred-startup.d.ts.map +1 -0
  80. package/dist/main-deferred-startup.js +21 -0
  81. package/dist/main-deferred-startup.js.map +1 -0
  82. package/dist/main.d.ts.map +1 -1
  83. package/dist/main.js +24 -22
  84. package/dist/main.js.map +1 -1
  85. package/dist/modes/interactive/interactive-deferred-startup.d.ts +2 -1
  86. package/dist/modes/interactive/interactive-deferred-startup.d.ts.map +1 -1
  87. package/dist/modes/interactive/interactive-deferred-startup.js +34 -1
  88. package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
  89. package/dist/modes/interactive/interactive-mode-deps.d.ts +2 -2
  90. package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
  91. package/dist/modes/interactive/interactive-mode-deps.js +2 -2
  92. package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
  93. package/dist/modes/interactive/interactive-mode-types.d.ts +5 -1
  94. package/dist/modes/interactive/interactive-mode-types.d.ts.map +1 -1
  95. package/dist/modes/interactive/interactive-mode-types.js.map +1 -1
  96. package/dist/modes/interactive/interactive-session-routing.d.ts.map +1 -1
  97. package/dist/modes/interactive/interactive-session-routing.js +2 -2
  98. package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
  99. package/dist/utils/child-process.d.ts +8 -1
  100. package/dist/utils/child-process.d.ts.map +1 -1
  101. package/dist/utils/child-process.js +39 -6
  102. package/dist/utils/child-process.js.map +1 -1
  103. package/dist/utils/event-loop.d.ts +7 -0
  104. package/dist/utils/event-loop.d.ts.map +1 -0
  105. package/dist/utils/event-loop.js +14 -0
  106. package/dist/utils/event-loop.js.map +1 -0
  107. package/dist/utils/json.d.ts +4 -0
  108. package/dist/utils/json.d.ts.map +1 -1
  109. package/dist/utils/json.js +8 -0
  110. package/dist/utils/json.js.map +1 -1
  111. package/docs/compaction.md +45 -27
  112. package/docs/settings.md +5 -1
  113. package/docs/workflows.md +6 -2
  114. package/npm-shrinkwrap.json +23 -23
  115. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-mode-deps.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-mode-deps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACxB,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,OAAO,CAAC;AACzC,YAAY,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,KAAK,GAAG,EAAE,KAAK,gBAAgB,EAAE,KAAK,YAAY,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,eAAe,EAAE,KAAK,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACxL,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,eAAe,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC9M,OAAO,EAAE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port * as os from \"node:os\";\nimport * as path from \"node:path\";\n\nexport { fs, os, path };\nexport { default as chalk } from \"chalk\";\nexport type { AgentMessage } from \"@earendil-works/pi-agent-core\";\nexport { getProviders, type Api, type AssistantMessage, type ImageContent, type Message, type Model, type OAuthProviderId, type OAuthSelectPrompt } from \"@earendil-works/pi-ai/compat\";\nexport type { AutocompleteItem, AutocompleteProvider, AutocompleteSuggestions, EditorComponent, Keybinding, KeyId, MarkdownTheme, OverlayHandle, OverlayOptions, SlashCommand } from \"@earendil-works/pi-tui\";\nexport { CombinedAutocompleteProvider, type Component, Container, fuzzyFilter, getCapabilities, hyperlink, Loader, type LoaderIndicatorOptions, Markdown, matchesKey, ProcessTerminal, Spacer, setKeybindings, Text, TruncatedText, TUI, visibleWidth } from \"@earendil-works/pi-tui\";\nexport { spawn, spawnSync } from \"child_process\";\nexport { APP_NAME, APP_TITLE, CHANGELOG_URL, ENV_OFFLINE, getEnvValue, setCodexFastModeEnvironmentSettings, getAgentDir, getAuthPath, getDebugLogPath, getDocsPath, getShareViewerUrl, VERSION } from \"../../config.ts\";\nexport { type AgentSession, type AgentSessionEvent, parseSkillBlock } from \"../../core/agent-session.ts\";\nexport { type AgentSessionRuntime, SessionImportFileNotFoundError } from \"../../core/agent-session-runtime.ts\";\nexport type { AutocompleteProviderFactory, EditorFactory, ExtensionCommandContext, ExtensionContext, ExtensionRunner, ExtensionUIContext, ExtensionUIDialogOptions, HostCustomUiState, HostCustomUiStateListener, ProjectTrustContext, ExtensionWidgetOptions } from \"../../core/extensions/index.ts\";\nexport { FooterDataProvider, type ReadonlyFooterDataProvider } from \"../../core/footer-data-provider.ts\";\nexport { type AppKeybinding, KeybindingsManager } from \"../../core/keybindings.ts\";\nexport type { ContextCompactionResult } from \"../../core/compaction/index.ts\";\nexport { defaultModelPerProvider, findExactModelReferenceMatch, resolveModelScope, resolveSavedModelReference } from \"../../core/model-resolver.ts\";\nexport { formatCodexFastModeModelLabel, hasSupportedCodexFastModeModel, shouldApplyCodexFastMode } from \"../../core/codex-fast-mode.ts\";\nexport { configureHttpDispatcher } from \"../../core/http-dispatcher.ts\";\nexport { DefaultPackageManager } from \"../../core/package-manager.ts\";\nexport { BUILT_IN_PROVIDER_DISPLAY_NAMES } from \"../../core/provider-display-names.ts\";\nexport type { ResourceDiagnostic } from \"../../core/resource-loader.ts\";\nexport { formatMissingSessionCwdPrompt, MissingSessionCwdError } from \"../../core/session-cwd.ts\";\nexport { type SessionContext, SessionManager } from \"../../core/session-manager.ts\";\nexport { BUILTIN_SLASH_COMMANDS } from \"../../core/slash-commands.ts\";\nexport type { SourceInfo } from \"../../core/source-info.ts\";\nexport { isInstallTelemetryEnabled } from \"../../core/telemetry.ts\";\nexport type { TruncationResult } from \"../../core/tools/truncate.ts\";\nexport { getChangelogPath, getEntriesForVersion, getNewEntries, normalizeChangelogLinks, parseChangelog } from \"../../utils/changelog.ts\";\nexport { copyToClipboard } from \"../../utils/clipboard.ts\";\nexport { combineQueuedMessagesForEditor, openExternalEditorForText, pasteClipboardImageToEditor } from \"./chat-input-actions.ts\";\nexport { parseGitUrl } from \"../../utils/git.ts\";\nexport { getCwdRelativePath } from \"../../utils/paths.ts\";\nexport { getPiUserAgent } from \"../../utils/pi-user-agent.ts\";\nexport { killTrackedDetachedChildren } from \"../../utils/shell.ts\";\nexport { recordTimeSinceReset } from \"../../core/timings.ts\";\nexport { ensureTool } from \"../../utils/tools-manager.ts\";\nexport { checkForNewPiVersion } from \"../../utils/version-check.ts\";\nexport { pickWhimsicalWorkingMessage } from \"./whimsical-messages.ts\";\nexport { ArminComponent } from \"./components/armin.ts\";\nexport { AssistantMessageComponent } from \"./components/assistant-message.ts\";\nexport { BashExecutionComponent } from \"./components/bash-execution.ts\";\nexport { BorderedLoader } from \"./components/bordered-loader.ts\";\nexport { BranchSummaryMessageComponent } from \"./components/branch-summary-message.ts\";\nexport { chatEntriesFromAgentMessages, renderChatMessageEntry, type ChatMessageEntry, type ChatMessageRenderOptions } from \"./components/chat-message-renderer.ts\";\nexport { addChatTranscriptEntry } from \"./components/chat-transcript.ts\";\nexport { ContextCompactionSummaryMessageComponent } from \"./components/context-compaction-summary-message.ts\";\nexport { CountdownTimer } from \"./components/countdown-timer.ts\";\nexport { CustomEditor } from \"./components/custom-editor.ts\";\nexport { CustomMessageComponent } from \"./components/custom-message.ts\";\nexport { DaxnutsComponent } from \"./components/daxnuts.ts\";\nexport { renderAtomicAnsiBanner } from \"./components/atomic-banner.ts\";\nexport { DynamicBorder } from \"./components/dynamic-border.ts\";\nexport { ContextWindowSelectorComponent } from \"./components/context-window-selector.ts\";\nexport { formatContextWindow } from \"../../core/context-window.ts\";\nexport { copilotApiBaseUrlFromToken, copilotCatalogCacheHost, copilotCatalogCachePath, fetchCopilotModelCatalog, readCopilotCatalogCache, setActiveCopilotModelCatalog, writeCopilotCatalogCache } from \"../../core/copilot-model-catalog.ts\";\nexport { EarendilAnnouncementComponent } from \"./components/earendil-announcement.ts\";\nexport { ExtensionEditorComponent } from \"./components/extension-editor.ts\";\nexport { ExtensionInputComponent } from \"./components/extension-input.ts\";\nexport { ExtensionSelectorComponent } from \"./components/extension-selector.ts\";\nexport { FastModeSelectorComponent } from \"./components/fast-mode-selector.ts\";\nexport { FooterComponent, UsageMeterComponent } from \"./components/footer.ts\";\nexport { formatKeyText, keyDisplayText, keyText } from \"./components/keybinding-hints.ts\";\nexport { LoginDialogComponent } from \"./components/login-dialog.ts\";\nexport { ModelSelectorComponent } from \"./components/model-selector.ts\";\nexport { type AuthSelectorProvider, OAuthSelectorComponent } from \"./components/oauth-selector.ts\";\nexport { ScopedModelsSelectorComponent } from \"./components/scoped-models-selector.ts\";\nexport { SessionSelectorComponent } from \"./components/session-selector.ts\";\nexport { SettingsSelectorComponent } from \"./components/settings-selector.ts\";\nexport { SkillInvocationMessageComponent } from \"./components/skill-invocation-message.ts\";\nexport { ToolExecutionComponent } from \"./components/tool-execution.ts\";\nexport { TreeSelectorComponent } from \"./components/tree-selector.ts\";\nexport { TrustSelectorComponent } from \"./components/trust-selector.ts\";\nexport { hasProjectConfigDir, ProjectTrustStore } from \"../../core/trust-manager.ts\";\nexport { UserMessageComponent } from \"./components/user-message.ts\";\nexport { UserMessageSelectorComponent } from \"./components/user-message-selector.ts\";\nexport { getModelSearchText } from \"./model-search.ts\";\nexport { getAvailableThemes, getAvailableThemesWithPaths, getEditorTheme, getMarkdownTheme, getThemeByName, onThemeChange, setRegisteredThemes, stopThemeWatcher, Theme, theme } from \"./theme/theme.ts\";\nexport { InteractiveThemeController } from \"./theme/theme-controller.ts\";\n"]}
1
+ {"version":3,"file":"interactive-mode-deps.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-mode-deps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACxB,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,OAAO,CAAC;AACzC,YAAY,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,KAAK,GAAG,EAAE,KAAK,gBAAgB,EAAE,KAAK,YAAY,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,eAAe,EAAE,KAAK,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACxL,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,eAAe,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC9M,OAAO,EAAE,4BAA4B,EAAE,KAAK,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,sBAAsB,EAAE,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MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,KAAK,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACnG,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,+BAA+B,EAAE,MAAM,0CAA0C,CAAC;AAC3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,iCAAiC,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC/I,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,cAAc,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzM,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC","sourcesContent":["import * as fs from \"node:fs\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\n\nexport { fs, os, path };\nexport { default as chalk } from \"chalk\";\nexport type { AgentMessage } from \"@earendil-works/pi-agent-core\";\nexport { getProviders, type Api, type AssistantMessage, type ImageContent, type Message, type Model, type OAuthProviderId, type OAuthSelectPrompt } from \"@earendil-works/pi-ai/compat\";\nexport type { AutocompleteItem, AutocompleteProvider, AutocompleteSuggestions, EditorComponent, Keybinding, KeyId, MarkdownTheme, OverlayHandle, OverlayOptions, SlashCommand } from \"@earendil-works/pi-tui\";\nexport { CombinedAutocompleteProvider, type Component, Container, fuzzyFilter, getCapabilities, hyperlink, Loader, type LoaderIndicatorOptions, Markdown, matchesKey, ProcessTerminal, Spacer, setKeybindings, Text, TruncatedText, TUI, visibleWidth } from \"@earendil-works/pi-tui\";\nexport { spawn, spawnSync } from \"child_process\";\nexport { APP_NAME, APP_TITLE, CHANGELOG_URL, ENV_OFFLINE, getEnvValue, setCodexFastModeEnvironmentSettings, getAgentDir, getAuthPath, getDebugLogPath, getDocsPath, getShareViewerUrl, VERSION } from \"../../config.ts\";\nexport { type AgentSession, type AgentSessionEvent, parseSkillBlock } from \"../../core/agent-session.ts\";\nexport { type AgentSessionRuntime, SessionImportFileNotFoundError } from \"../../core/agent-session-runtime.ts\";\nexport type { AutocompleteProviderFactory, EditorFactory, ExtensionCommandContext, ExtensionContext, ExtensionRunner, ExtensionUIContext, ExtensionUIDialogOptions, HostCustomUiState, HostCustomUiStateListener, ProjectTrustContext, ExtensionWidgetOptions } from \"../../core/extensions/index.ts\";\nexport { FooterDataProvider, type ReadonlyFooterDataProvider } from \"../../core/footer-data-provider.ts\";\nexport { type AppKeybinding, KeybindingsManager } from \"../../core/keybindings.ts\";\nexport type { ContextCompactionResult } from \"../../core/compaction/index.ts\";\nexport { defaultModelPerProvider, findExactModelReferenceMatch, resolveModelScope, resolveModelScopeWithDiagnostics, resolveSavedModelReference } from \"../../core/model-resolver.ts\";\nexport { formatCodexFastModeModelLabel, hasSupportedCodexFastModeModel, shouldApplyCodexFastMode } from \"../../core/codex-fast-mode.ts\";\nexport { configureHttpDispatcher } from \"../../core/http-dispatcher.ts\";\nexport { DefaultPackageManager } from \"../../core/package-manager.ts\";\nexport { BUILT_IN_PROVIDER_DISPLAY_NAMES } from \"../../core/provider-display-names.ts\";\nexport type { ResourceDiagnostic } from \"../../core/resource-loader.ts\";\nexport { formatMissingSessionCwdPrompt, MissingSessionCwdError } from \"../../core/session-cwd.ts\";\nexport { type SessionContext, SessionManager } from \"../../core/session-manager.ts\";\nexport { BUILTIN_SLASH_COMMANDS } from \"../../core/slash-commands.ts\";\nexport type { SourceInfo } from \"../../core/source-info.ts\";\nexport { isInstallTelemetryEnabled } from \"../../core/telemetry.ts\";\nexport type { TruncationResult } from \"../../core/tools/truncate.ts\";\nexport { getChangelogPath, getEntriesForVersion, getNewEntries, normalizeChangelogLinks, parseChangelog } from \"../../utils/changelog.ts\";\nexport { copyToClipboard } from \"../../utils/clipboard.ts\";\nexport { combineQueuedMessagesForEditor, openExternalEditorForText, pasteClipboardImageToEditor } from \"./chat-input-actions.ts\";\nexport { parseGitUrl } from \"../../utils/git.ts\";\nexport { getCwdRelativePath } from \"../../utils/paths.ts\";\nexport { getPiUserAgent } from \"../../utils/pi-user-agent.ts\";\nexport { killTrackedDetachedChildren } from \"../../utils/shell.ts\";\nexport { recordTimeSinceReset } from \"../../core/timings.ts\";\nexport { ensureTool } from \"../../utils/tools-manager.ts\";\nexport { checkForNewPiVersion } from \"../../utils/version-check.ts\";\nexport { pickWhimsicalWorkingMessage } from \"./whimsical-messages.ts\";\nexport { ArminComponent } from \"./components/armin.ts\";\nexport { AssistantMessageComponent } from \"./components/assistant-message.ts\";\nexport { BashExecutionComponent } from \"./components/bash-execution.ts\";\nexport { BorderedLoader } from \"./components/bordered-loader.ts\";\nexport { BranchSummaryMessageComponent } from \"./components/branch-summary-message.ts\";\nexport { chatEntriesFromAgentMessages, renderChatMessageEntry, type ChatMessageEntry, type ChatMessageRenderOptions } from \"./components/chat-message-renderer.ts\";\nexport { addChatTranscriptEntry } from \"./components/chat-transcript.ts\";\nexport { ContextCompactionSummaryMessageComponent } from \"./components/context-compaction-summary-message.ts\";\nexport { CountdownTimer } from \"./components/countdown-timer.ts\";\nexport { CustomEditor } from \"./components/custom-editor.ts\";\nexport { CustomMessageComponent } from \"./components/custom-message.ts\";\nexport { DaxnutsComponent } from \"./components/daxnuts.ts\";\nexport { renderAtomicAnsiBanner } from \"./components/atomic-banner.ts\";\nexport { DynamicBorder } from \"./components/dynamic-border.ts\";\nexport { ContextWindowSelectorComponent } from \"./components/context-window-selector.ts\";\nexport { formatContextWindow } from \"../../core/context-window.ts\";\nexport { copilotApiBaseUrlFromToken, copilotCatalogCacheHost, copilotCatalogCachePath, fetchCopilotModelCatalog, readCopilotCatalogCache, setActiveCopilotModelCatalog, writeCopilotCatalogCache } from \"../../core/copilot-model-catalog.ts\";\nexport { EarendilAnnouncementComponent } from \"./components/earendil-announcement.ts\";\nexport { ExtensionEditorComponent } from \"./components/extension-editor.ts\";\nexport { ExtensionInputComponent } from \"./components/extension-input.ts\";\nexport { ExtensionSelectorComponent } from \"./components/extension-selector.ts\";\nexport { FastModeSelectorComponent } from \"./components/fast-mode-selector.ts\";\nexport { FooterComponent, UsageMeterComponent } from \"./components/footer.ts\";\nexport { formatKeyText, keyDisplayText, keyText } from \"./components/keybinding-hints.ts\";\nexport { LoginDialogComponent } from \"./components/login-dialog.ts\";\nexport { ModelSelectorComponent } from \"./components/model-selector.ts\";\nexport { type AuthSelectorProvider, OAuthSelectorComponent } from \"./components/oauth-selector.ts\";\nexport { ScopedModelsSelectorComponent } from \"./components/scoped-models-selector.ts\";\nexport { SessionSelectorComponent } from \"./components/session-selector.ts\";\nexport { SettingsSelectorComponent } from \"./components/settings-selector.ts\";\nexport { SkillInvocationMessageComponent } from \"./components/skill-invocation-message.ts\";\nexport { ToolExecutionComponent } from \"./components/tool-execution.ts\";\nexport { TreeSelectorComponent } from \"./components/tree-selector.ts\";\nexport { TrustSelectorComponent } from \"./components/trust-selector.ts\";\nexport { hasProjectConfigDir, hasProjectTrustInputs, hasTrustRequiringProjectResources, ProjectTrustStore } from \"../../core/trust-manager.ts\";\nexport { UserMessageComponent } from \"./components/user-message.ts\";\nexport { UserMessageSelectorComponent } from \"./components/user-message-selector.ts\";\nexport { getModelSearchText } from \"./model-search.ts\";\nexport { getAvailableThemes, getAvailableThemesWithPaths, getEditorTheme, getMarkdownTheme, getThemeByName, onThemeChange, setRegisteredThemes, stopThemeWatcher, Theme, theme } from \"./theme/theme.ts\";\nexport { InteractiveThemeController } from \"./theme/theme-controller.ts\";\n"]}
@@ -11,7 +11,7 @@ export { parseSkillBlock } from "../../core/agent-session.js";
11
11
  export { SessionImportFileNotFoundError } from "../../core/agent-session-runtime.js";
12
12
  export { FooterDataProvider } from "../../core/footer-data-provider.js";
13
13
  export { KeybindingsManager } from "../../core/keybindings.js";
14
- export { defaultModelPerProvider, findExactModelReferenceMatch, resolveModelScope, resolveSavedModelReference } from "../../core/model-resolver.js";
14
+ export { defaultModelPerProvider, findExactModelReferenceMatch, resolveModelScope, resolveModelScopeWithDiagnostics, resolveSavedModelReference } from "../../core/model-resolver.js";
15
15
  export { formatCodexFastModeModelLabel, hasSupportedCodexFastModeModel, shouldApplyCodexFastMode } from "../../core/codex-fast-mode.js";
16
16
  export { configureHttpDispatcher } from "../../core/http-dispatcher.js";
17
17
  export { DefaultPackageManager } from "../../core/package-manager.js";
@@ -65,7 +65,7 @@ export { SkillInvocationMessageComponent } from "./components/skill-invocation-m
65
65
  export { ToolExecutionComponent } from "./components/tool-execution.js";
66
66
  export { TreeSelectorComponent } from "./components/tree-selector.js";
67
67
  export { TrustSelectorComponent } from "./components/trust-selector.js";
68
- export { hasProjectConfigDir, ProjectTrustStore } from "../../core/trust-manager.js";
68
+ export { hasProjectConfigDir, hasProjectTrustInputs, hasTrustRequiringProjectResources, ProjectTrustStore } from "../../core/trust-manager.js";
69
69
  export { UserMessageComponent } from "./components/user-message.js";
70
70
  export { UserMessageSelectorComponent } from "./components/user-message-selector.js";
71
71
  export { getModelSearchText } from "./model-search.js";
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-mode-deps.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-mode-deps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACxB,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,YAAY,EAA8H,MAAM,8BAA8B,CAAC;AAExL,OAAO,EAAE,4BAA4B,EAAkB,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAA+B,QAAQ,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtR,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,mCAAmC,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACxN,OAAO,EAA6C,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACzG,OAAO,EAA4B,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAE/G,OAAO,EAAE,kBAAkB,EAAmC,MAAM,oCAAoC,CAAC;AACzG,OAAO,EAAsB,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEnF,OAAO,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACpJ,OAAO,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AAE,aAAa,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAA6B,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACnG,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,+BAA+B,EAAE,MAAM,0CAA0C,CAAC;AAC3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,cAAc,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzM,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC","sourcesContent":["import * as fs from \"node:fs\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\n\nexport { fs, os, path };\nexport { default as chalk } from \"chalk\";\nexport type { AgentMessage } from \"@earendil-works/pi-agent-core\";\nexport { getProviders, type Api, type AssistantMessage, type ImageContent, type Message, type Model, type OAuthProviderId, type OAuthSelectPrompt } from \"@earendil-works/pi-ai/compat\";\nexport type { AutocompleteItem, AutocompleteProvider, AutocompleteSuggestions, EditorComponent, Keybinding, KeyId, MarkdownTheme, OverlayHandle, OverlayOptions, SlashCommand } from \"@earendil-works/pi-tui\";\nexport { CombinedAutocompleteProvider, type Component, Container, fuzzyFilter, getCapabilities, hyperlink, Loader, type LoaderIndicatorOptions, Markdown, matchesKey, ProcessTerminal, Spacer, setKeybindings, Text, TruncatedText, TUI, visibleWidth } from \"@earendil-works/pi-tui\";\nexport { spawn, spawnSync } from \"child_process\";\nexport { APP_NAME, APP_TITLE, CHANGELOG_URL, ENV_OFFLINE, getEnvValue, setCodexFastModeEnvironmentSettings, getAgentDir, getAuthPath, getDebugLogPath, getDocsPath, getShareViewerUrl, VERSION } from \"../../config.ts\";\nexport { type AgentSession, type AgentSessionEvent, parseSkillBlock } from \"../../core/agent-session.ts\";\nexport { type AgentSessionRuntime, SessionImportFileNotFoundError } from \"../../core/agent-session-runtime.ts\";\nexport type { AutocompleteProviderFactory, EditorFactory, ExtensionCommandContext, ExtensionContext, ExtensionRunner, ExtensionUIContext, ExtensionUIDialogOptions, HostCustomUiState, HostCustomUiStateListener, ProjectTrustContext, ExtensionWidgetOptions } from \"../../core/extensions/index.ts\";\nexport { FooterDataProvider, type ReadonlyFooterDataProvider } from \"../../core/footer-data-provider.ts\";\nexport { type AppKeybinding, KeybindingsManager } from \"../../core/keybindings.ts\";\nexport type { ContextCompactionResult } from \"../../core/compaction/index.ts\";\nexport { defaultModelPerProvider, findExactModelReferenceMatch, resolveModelScope, resolveSavedModelReference } from \"../../core/model-resolver.ts\";\nexport { formatCodexFastModeModelLabel, hasSupportedCodexFastModeModel, shouldApplyCodexFastMode } from \"../../core/codex-fast-mode.ts\";\nexport { configureHttpDispatcher } from \"../../core/http-dispatcher.ts\";\nexport { DefaultPackageManager } from \"../../core/package-manager.ts\";\nexport { BUILT_IN_PROVIDER_DISPLAY_NAMES } from \"../../core/provider-display-names.ts\";\nexport type { ResourceDiagnostic } from \"../../core/resource-loader.ts\";\nexport { formatMissingSessionCwdPrompt, MissingSessionCwdError } from \"../../core/session-cwd.ts\";\nexport { type SessionContext, SessionManager } from \"../../core/session-manager.ts\";\nexport { BUILTIN_SLASH_COMMANDS } from \"../../core/slash-commands.ts\";\nexport type { SourceInfo } from \"../../core/source-info.ts\";\nexport { isInstallTelemetryEnabled } from \"../../core/telemetry.ts\";\nexport type { TruncationResult } from \"../../core/tools/truncate.ts\";\nexport { getChangelogPath, getEntriesForVersion, getNewEntries, normalizeChangelogLinks, parseChangelog } from \"../../utils/changelog.ts\";\nexport { copyToClipboard } from \"../../utils/clipboard.ts\";\nexport { combineQueuedMessagesForEditor, openExternalEditorForText, pasteClipboardImageToEditor } from \"./chat-input-actions.ts\";\nexport { parseGitUrl } from \"../../utils/git.ts\";\nexport { getCwdRelativePath } from \"../../utils/paths.ts\";\nexport { getPiUserAgent } from \"../../utils/pi-user-agent.ts\";\nexport { killTrackedDetachedChildren } from \"../../utils/shell.ts\";\nexport { recordTimeSinceReset } from \"../../core/timings.ts\";\nexport { ensureTool } from \"../../utils/tools-manager.ts\";\nexport { checkForNewPiVersion } from \"../../utils/version-check.ts\";\nexport { pickWhimsicalWorkingMessage } from \"./whimsical-messages.ts\";\nexport { ArminComponent } from \"./components/armin.ts\";\nexport { AssistantMessageComponent } from \"./components/assistant-message.ts\";\nexport { BashExecutionComponent } from \"./components/bash-execution.ts\";\nexport { BorderedLoader } from \"./components/bordered-loader.ts\";\nexport { BranchSummaryMessageComponent } from \"./components/branch-summary-message.ts\";\nexport { chatEntriesFromAgentMessages, renderChatMessageEntry, type ChatMessageEntry, type ChatMessageRenderOptions } from \"./components/chat-message-renderer.ts\";\nexport { addChatTranscriptEntry } from \"./components/chat-transcript.ts\";\nexport { ContextCompactionSummaryMessageComponent } from \"./components/context-compaction-summary-message.ts\";\nexport { CountdownTimer } from \"./components/countdown-timer.ts\";\nexport { CustomEditor } from \"./components/custom-editor.ts\";\nexport { CustomMessageComponent } from \"./components/custom-message.ts\";\nexport { DaxnutsComponent } from \"./components/daxnuts.ts\";\nexport { renderAtomicAnsiBanner } from \"./components/atomic-banner.ts\";\nexport { DynamicBorder } from \"./components/dynamic-border.ts\";\nexport { ContextWindowSelectorComponent } from \"./components/context-window-selector.ts\";\nexport { formatContextWindow } from \"../../core/context-window.ts\";\nexport { copilotApiBaseUrlFromToken, copilotCatalogCacheHost, copilotCatalogCachePath, fetchCopilotModelCatalog, readCopilotCatalogCache, setActiveCopilotModelCatalog, writeCopilotCatalogCache } from \"../../core/copilot-model-catalog.ts\";\nexport { EarendilAnnouncementComponent } from \"./components/earendil-announcement.ts\";\nexport { ExtensionEditorComponent } from \"./components/extension-editor.ts\";\nexport { ExtensionInputComponent } from \"./components/extension-input.ts\";\nexport { ExtensionSelectorComponent } from \"./components/extension-selector.ts\";\nexport { FastModeSelectorComponent } from \"./components/fast-mode-selector.ts\";\nexport { FooterComponent, UsageMeterComponent } from \"./components/footer.ts\";\nexport { formatKeyText, keyDisplayText, keyText } from \"./components/keybinding-hints.ts\";\nexport { LoginDialogComponent } from \"./components/login-dialog.ts\";\nexport { ModelSelectorComponent } from \"./components/model-selector.ts\";\nexport { type AuthSelectorProvider, OAuthSelectorComponent } from \"./components/oauth-selector.ts\";\nexport { ScopedModelsSelectorComponent } from \"./components/scoped-models-selector.ts\";\nexport { SessionSelectorComponent } from \"./components/session-selector.ts\";\nexport { SettingsSelectorComponent } from \"./components/settings-selector.ts\";\nexport { SkillInvocationMessageComponent } from \"./components/skill-invocation-message.ts\";\nexport { ToolExecutionComponent } from \"./components/tool-execution.ts\";\nexport { TreeSelectorComponent } from \"./components/tree-selector.ts\";\nexport { TrustSelectorComponent } from \"./components/trust-selector.ts\";\nexport { hasProjectConfigDir, ProjectTrustStore } from \"../../core/trust-manager.ts\";\nexport { UserMessageComponent } from \"./components/user-message.ts\";\nexport { UserMessageSelectorComponent } from \"./components/user-message-selector.ts\";\nexport { getModelSearchText } from \"./model-search.ts\";\nexport { getAvailableThemes, getAvailableThemesWithPaths, getEditorTheme, getMarkdownTheme, getThemeByName, onThemeChange, setRegisteredThemes, stopThemeWatcher, Theme, theme } from \"./theme/theme.ts\";\nexport { InteractiveThemeController } from \"./theme/theme-controller.ts\";\n"]}
1
+ {"version":3,"file":"interactive-mode-deps.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-mode-deps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACxB,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,YAAY,EAA8H,MAAM,8BAA8B,CAAC;AAExL,OAAO,EAAE,4BAA4B,EAAkB,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAA+B,QAAQ,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtR,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,mCAAmC,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACxN,OAAO,EAA6C,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACzG,OAAO,EAA4B,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAE/G,OAAO,EAAE,kBAAkB,EAAmC,MAAM,oCAAoC,CAAC;A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,MAAM,6BAA6B,CAAC","sourcesContent":["import * as fs from \"node:fs\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\n\nexport { fs, os, path };\nexport { default as chalk } from \"chalk\";\nexport type { AgentMessage } from \"@earendil-works/pi-agent-core\";\nexport { getProviders, type Api, type AssistantMessage, type ImageContent, type Message, type Model, type OAuthProviderId, type OAuthSelectPrompt } from \"@earendil-works/pi-ai/compat\";\nexport type { AutocompleteItem, AutocompleteProvider, AutocompleteSuggestions, EditorComponent, Keybinding, KeyId, MarkdownTheme, OverlayHandle, OverlayOptions, SlashCommand } from \"@earendil-works/pi-tui\";\nexport { CombinedAutocompleteProvider, type Component, Container, fuzzyFilter, getCapabilities, hyperlink, Loader, type LoaderIndicatorOptions, Markdown, matchesKey, ProcessTerminal, Spacer, setKeybindings, Text, TruncatedText, TUI, visibleWidth } from \"@earendil-works/pi-tui\";\nexport { spawn, spawnSync } from \"child_process\";\nexport { APP_NAME, APP_TITLE, CHANGELOG_URL, ENV_OFFLINE, getEnvValue, setCodexFastModeEnvironmentSettings, getAgentDir, getAuthPath, getDebugLogPath, getDocsPath, getShareViewerUrl, VERSION } from \"../../config.ts\";\nexport { type AgentSession, type AgentSessionEvent, parseSkillBlock } from \"../../core/agent-session.ts\";\nexport { type AgentSessionRuntime, SessionImportFileNotFoundError } from \"../../core/agent-session-runtime.ts\";\nexport type { AutocompleteProviderFactory, EditorFactory, ExtensionCommandContext, ExtensionContext, ExtensionRunner, ExtensionUIContext, ExtensionUIDialogOptions, HostCustomUiState, HostCustomUiStateListener, ProjectTrustContext, ExtensionWidgetOptions } from \"../../core/extensions/index.ts\";\nexport { FooterDataProvider, type ReadonlyFooterDataProvider } from \"../../core/footer-data-provider.ts\";\nexport { type AppKeybinding, KeybindingsManager } from \"../../core/keybindings.ts\";\nexport type { ContextCompactionResult } from \"../../core/compaction/index.ts\";\nexport { defaultModelPerProvider, findExactModelReferenceMatch, resolveModelScope, resolveModelScopeWithDiagnostics, resolveSavedModelReference } from \"../../core/model-resolver.ts\";\nexport { formatCodexFastModeModelLabel, hasSupportedCodexFastModeModel, shouldApplyCodexFastMode } from \"../../core/codex-fast-mode.ts\";\nexport { configureHttpDispatcher } from \"../../core/http-dispatcher.ts\";\nexport { DefaultPackageManager } from \"../../core/package-manager.ts\";\nexport { BUILT_IN_PROVIDER_DISPLAY_NAMES } from \"../../core/provider-display-names.ts\";\nexport type { ResourceDiagnostic } from \"../../core/resource-loader.ts\";\nexport { formatMissingSessionCwdPrompt, MissingSessionCwdError } from \"../../core/session-cwd.ts\";\nexport { type SessionContext, SessionManager } from \"../../core/session-manager.ts\";\nexport { BUILTIN_SLASH_COMMANDS } from \"../../core/slash-commands.ts\";\nexport type { SourceInfo } from \"../../core/source-info.ts\";\nexport { isInstallTelemetryEnabled } from \"../../core/telemetry.ts\";\nexport type { TruncationResult } from \"../../core/tools/truncate.ts\";\nexport { getChangelogPath, getEntriesForVersion, getNewEntries, normalizeChangelogLinks, parseChangelog } from \"../../utils/changelog.ts\";\nexport { copyToClipboard } from \"../../utils/clipboard.ts\";\nexport { combineQueuedMessagesForEditor, openExternalEditorForText, pasteClipboardImageToEditor } from \"./chat-input-actions.ts\";\nexport { parseGitUrl } from \"../../utils/git.ts\";\nexport { getCwdRelativePath } from \"../../utils/paths.ts\";\nexport { getPiUserAgent } from \"../../utils/pi-user-agent.ts\";\nexport { killTrackedDetachedChildren } from \"../../utils/shell.ts\";\nexport { recordTimeSinceReset } from \"../../core/timings.ts\";\nexport { ensureTool } from \"../../utils/tools-manager.ts\";\nexport { checkForNewPiVersion } from \"../../utils/version-check.ts\";\nexport { pickWhimsicalWorkingMessage } from \"./whimsical-messages.ts\";\nexport { ArminComponent } from \"./components/armin.ts\";\nexport { AssistantMessageComponent } from \"./components/assistant-message.ts\";\nexport { BashExecutionComponent } from \"./components/bash-execution.ts\";\nexport { BorderedLoader } from \"./components/bordered-loader.ts\";\nexport { BranchSummaryMessageComponent } from \"./components/branch-summary-message.ts\";\nexport { chatEntriesFromAgentMessages, renderChatMessageEntry, type ChatMessageEntry, type ChatMessageRenderOptions } from \"./components/chat-message-renderer.ts\";\nexport { addChatTranscriptEntry } from \"./components/chat-transcript.ts\";\nexport { ContextCompactionSummaryMessageComponent } from \"./components/context-compaction-summary-message.ts\";\nexport { CountdownTimer } from \"./components/countdown-timer.ts\";\nexport { CustomEditor } from \"./components/custom-editor.ts\";\nexport { CustomMessageComponent } from \"./components/custom-message.ts\";\nexport { DaxnutsComponent } from \"./components/daxnuts.ts\";\nexport { renderAtomicAnsiBanner } from \"./components/atomic-banner.ts\";\nexport { DynamicBorder } from \"./components/dynamic-border.ts\";\nexport { ContextWindowSelectorComponent } from \"./components/context-window-selector.ts\";\nexport { formatContextWindow } from \"../../core/context-window.ts\";\nexport { copilotApiBaseUrlFromToken, copilotCatalogCacheHost, copilotCatalogCachePath, fetchCopilotModelCatalog, readCopilotCatalogCache, setActiveCopilotModelCatalog, writeCopilotCatalogCache } from \"../../core/copilot-model-catalog.ts\";\nexport { EarendilAnnouncementComponent } from \"./components/earendil-announcement.ts\";\nexport { ExtensionEditorComponent } from \"./components/extension-editor.ts\";\nexport { ExtensionInputComponent } from \"./components/extension-input.ts\";\nexport { ExtensionSelectorComponent } from \"./components/extension-selector.ts\";\nexport { FastModeSelectorComponent } from \"./components/fast-mode-selector.ts\";\nexport { FooterComponent, UsageMeterComponent } from \"./components/footer.ts\";\nexport { formatKeyText, keyDisplayText, keyText } from \"./components/keybinding-hints.ts\";\nexport { LoginDialogComponent } from \"./components/login-dialog.ts\";\nexport { ModelSelectorComponent } from \"./components/model-selector.ts\";\nexport { type AuthSelectorProvider, OAuthSelectorComponent } from \"./components/oauth-selector.ts\";\nexport { ScopedModelsSelectorComponent } from \"./components/scoped-models-selector.ts\";\nexport { SessionSelectorComponent } from \"./components/session-selector.ts\";\nexport { SettingsSelectorComponent } from \"./components/settings-selector.ts\";\nexport { SkillInvocationMessageComponent } from \"./components/skill-invocation-message.ts\";\nexport { ToolExecutionComponent } from \"./components/tool-execution.ts\";\nexport { TreeSelectorComponent } from \"./components/tree-selector.ts\";\nexport { TrustSelectorComponent } from \"./components/trust-selector.ts\";\nexport { hasProjectConfigDir, hasProjectTrustInputs, hasTrustRequiringProjectResources, ProjectTrustStore } from \"../../core/trust-manager.ts\";\nexport { UserMessageComponent } from \"./components/user-message.ts\";\nexport { UserMessageSelectorComponent } from \"./components/user-message-selector.ts\";\nexport { getModelSearchText } from \"./model-search.ts\";\nexport { getAvailableThemes, getAvailableThemesWithPaths, getEditorTheme, getMarkdownTheme, getThemeByName, onThemeChange, setRegisteredThemes, stopThemeWatcher, Theme, theme } from \"./theme/theme.ts\";\nexport { InteractiveThemeController } from \"./theme/theme-controller.ts\";\n"]}
@@ -15,7 +15,7 @@ export interface InteractiveModeOptions {
15
15
  migratedProviders?: string[];
16
16
  /** Warning message if session model couldn't be restored */
17
17
  modelFallbackMessage?: string;
18
- /** Cwd to persist as trusted after reload if it gains project config during an implicitly trusted session. */
18
+ /** Cwd to persist as trusted after reload/shutdown if it gains trust inputs during an implicitly trusted session. */
19
19
  autoTrustOnReloadCwd?: string;
20
20
  /** Initial message to send on startup (can include @file content) */
21
21
  initialMessage?: string;
@@ -27,5 +27,9 @@ export interface InteractiveModeOptions {
27
27
  verbose?: boolean;
28
28
  /** Runtime was created without extension code; finish loading in the background after first paint. */
29
29
  deferredExtensionLoad?: boolean;
30
+ /** Model scope patterns resolved again after deferred extension load registers providers. */
31
+ deferredModelScopePatterns?: string[];
32
+ /** Preserve an explicit CLI thinking level when applying deferred model-scope suffixes. */
33
+ deferredModelScopePreserveThinking?: boolean;
30
34
  }
31
35
  //# sourceMappingURL=interactive-mode-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-mode-types.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-mode-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,+DAA+D;AAC/D,MAAM,WAAW,UAAU;IACzB,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;CACtC;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,GAAG,UAAU,CAAC;CAC5B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,gEAAgE;IAChE,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,4DAA4D;IAC5D,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,8GAA8G;IAC9G,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,qEAAqE;IACrE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,8CAA8C;IAC9C,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,4DAA4D;IAC5D,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,6DAA6D;IAC7D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sGAAsG;IACtG,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC","sourcesContent":["import type { ImageContent } from \"./interactive-mode-deps.ts\";\n\n/** Interface for components that can be expanded/collapsed. */\nexport interface Expandable {\n setExpanded(expanded: boolean): void;\n}\n\nexport type CompactionQueuedMessage = {\n text: string;\n mode: \"steer\" | \"followUp\";\n};\n\n/**\n * Options for InteractiveMode initialization.\n */\nexport interface InteractiveModeOptions {\n /** Providers that were migrated to auth.json (shows warning) */\n migratedProviders?: string[];\n /** Warning message if session model couldn't be restored */\n modelFallbackMessage?: string;\n /** Cwd to persist as trusted after reload if it gains project config during an implicitly trusted session. */\n autoTrustOnReloadCwd?: string;\n /** Initial message to send on startup (can include @file content) */\n initialMessage?: string;\n /** Images to attach to the initial message */\n initialImages?: ImageContent[];\n /** Additional messages to send after the initial message */\n initialMessages?: string[];\n /** Force verbose startup (overrides quietStartup setting) */\n verbose?: boolean;\n /** Runtime was created without extension code; finish loading in the background after first paint. */\n deferredExtensionLoad?: boolean;\n}\n"]}
1
+ {"version":3,"file":"interactive-mode-types.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-mode-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,+DAA+D;AAC/D,MAAM,WAAW,UAAU;IACzB,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;CACtC;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,GAAG,UAAU,CAAC;CAC5B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,gEAAgE;IAChE,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,4DAA4D;IAC5D,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,qHAAqH;IACrH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,qEAAqE;IACrE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,8CAA8C;IAC9C,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,4DAA4D;IAC5D,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,6DAA6D;IAC7D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sGAAsG;IACtG,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,6FAA6F;IAC7F,0BAA0B,CAAC,EAAE,MAAM,EAAE,CAAC;IACtC,2FAA2F;IAC3F,kCAAkC,CAAC,EAAE,OAAO,CAAC;CAC9C","sourcesContent":["import type { ImageContent } from \"./interactive-mode-deps.ts\";\n\n/** Interface for components that can be expanded/collapsed. */\nexport interface Expandable {\n setExpanded(expanded: boolean): void;\n}\n\nexport type CompactionQueuedMessage = {\n text: string;\n mode: \"steer\" | \"followUp\";\n};\n\n/**\n * Options for InteractiveMode initialization.\n */\nexport interface InteractiveModeOptions {\n /** Providers that were migrated to auth.json (shows warning) */\n migratedProviders?: string[];\n /** Warning message if session model couldn't be restored */\n modelFallbackMessage?: string;\n /** Cwd to persist as trusted after reload/shutdown if it gains trust inputs during an implicitly trusted session. */\n autoTrustOnReloadCwd?: string;\n /** Initial message to send on startup (can include @file content) */\n initialMessage?: string;\n /** Images to attach to the initial message */\n initialImages?: ImageContent[];\n /** Additional messages to send after the initial message */\n initialMessages?: string[];\n /** Force verbose startup (overrides quietStartup setting) */\n verbose?: boolean;\n /** Runtime was created without extension code; finish loading in the background after first paint. */\n deferredExtensionLoad?: boolean;\n /** Model scope patterns resolved again after deferred extension load registers providers. */\n deferredModelScopePatterns?: string[];\n /** Preserve an explicit CLI thinking level when applying deferred model-scope suffixes. */\n deferredModelScopePreserveThinking?: boolean;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-mode-types.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-mode-types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ImageContent } from \"./interactive-mode-deps.ts\";\n\n/** Interface for components that can be expanded/collapsed. */\nexport interface Expandable {\n setExpanded(expanded: boolean): void;\n}\n\nexport type CompactionQueuedMessage = {\n text: string;\n mode: \"steer\" | \"followUp\";\n};\n\n/**\n * Options for InteractiveMode initialization.\n */\nexport interface InteractiveModeOptions {\n /** Providers that were migrated to auth.json (shows warning) */\n migratedProviders?: string[];\n /** Warning message if session model couldn't be restored */\n modelFallbackMessage?: string;\n /** Cwd to persist as trusted after reload if it gains project config during an implicitly trusted session. */\n autoTrustOnReloadCwd?: string;\n /** Initial message to send on startup (can include @file content) */\n initialMessage?: string;\n /** Images to attach to the initial message */\n initialImages?: ImageContent[];\n /** Additional messages to send after the initial message */\n initialMessages?: string[];\n /** Force verbose startup (overrides quietStartup setting) */\n verbose?: boolean;\n /** Runtime was created without extension code; finish loading in the background after first paint. */\n deferredExtensionLoad?: boolean;\n}\n"]}
1
+ {"version":3,"file":"interactive-mode-types.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-mode-types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ImageContent } from \"./interactive-mode-deps.ts\";\n\n/** Interface for components that can be expanded/collapsed. */\nexport interface Expandable {\n setExpanded(expanded: boolean): void;\n}\n\nexport type CompactionQueuedMessage = {\n text: string;\n mode: \"steer\" | \"followUp\";\n};\n\n/**\n * Options for InteractiveMode initialization.\n */\nexport interface InteractiveModeOptions {\n /** Providers that were migrated to auth.json (shows warning) */\n migratedProviders?: string[];\n /** Warning message if session model couldn't be restored */\n modelFallbackMessage?: string;\n /** Cwd to persist as trusted after reload/shutdown if it gains trust inputs during an implicitly trusted session. */\n autoTrustOnReloadCwd?: string;\n /** Initial message to send on startup (can include @file content) */\n initialMessage?: string;\n /** Images to attach to the initial message */\n initialImages?: ImageContent[];\n /** Additional messages to send after the initial message */\n initialMessages?: string[];\n /** Force verbose startup (overrides quietStartup setting) */\n verbose?: boolean;\n /** Runtime was created without extension code; finish loading in the background after first paint. */\n deferredExtensionLoad?: boolean;\n /** Model scope patterns resolved again after deferred extension load registers providers. */\n deferredModelScopePatterns?: string[];\n /** Preserve an explicit CLI thinking level when applying deferred model-scope suffixes. */\n deferredModelScopePreserveThinking?: boolean;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-session-routing.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-session-routing.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type ExtensionCommandContext, Loader, Spacer, APP_NAME, MissingSessionCwdError, SessionManager, keyText, SessionSelectorComponent, TreeSelectorComponent, TrustSelectorComponent, hasProjectConfigDir, ProjectTrustStore, theme } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.handleCloneCommand = async function(this: InteractiveModeBase): Promise<void> {\n const leafId = this.sessionManager.getLeafId();\n if (!leafId) {\n this.showStatus(\"Nothing to clone yet\");\n return;\n }\n\n try {\n const result = await this.runtimeHost.fork(leafId, { position: \"at\" });\n if (result.cancelled) {\n this.ui.requestRender();\n return;\n }\n\n this.renderCurrentSessionState();\n this.editor.setText(\"\");\n this.showStatus(\"Cloned to new session\");\n } catch (error: unknown) {\n this.showError(error instanceof Error ? error.message : String(error));\n }\n };\n\nInteractiveModeBase.prototype.maybeSaveImplicitProjectTrustAfterReload = function(this: InteractiveModeBase): boolean {\n const cwd = this.sessionManager.getCwd();\n if (this.autoTrustOnReloadCwd !== cwd) {\n return false;\n }\n if (!this.settingsManager.isProjectTrusted() || !hasProjectConfigDir(cwd)) {\n return false;\n }\n\n const trustStore = new ProjectTrustStore(this.runtimeHost.services.agentDir);\n try {\n if (trustStore.get(cwd) !== null) {\n this.autoTrustOnReloadCwd = undefined;\n return false;\n }\n trustStore.set(cwd, true);\n this.autoTrustOnReloadCwd = undefined;\n return true;\n } catch (error) {\n this.showWarning(\n `Could not save project trust after reload: ${error instanceof Error ? error.message : String(error)}`,\n );\n return false;\n }\n };\n\nInteractiveModeBase.prototype.showTrustSelector = function(this: InteractiveModeBase): void {\n const cwd = this.sessionManager.getCwd();\n const trustStore = new ProjectTrustStore(this.runtimeHost.services.agentDir);\n const savedDecision = trustStore.getEntry(cwd);\n this.showSelector((done) => {\n const selector = new TrustSelectorComponent({\n cwd,\n savedDecision,\n projectTrusted: this.settingsManager.isProjectTrusted(),\n onSelect: (selection) => {\n trustStore.setMany(selection.updates);\n done();\n this.showStatus(\n `Saved trust decision: ${selection.trusted ? \"trusted\" : \"untrusted\"}. Restart ${APP_NAME} for this to take effect.`,\n );\n },\n onCancel: () => {\n done();\n this.ui.requestRender();\n },\n });\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showTreeSelector = function(this: InteractiveModeBase, initialSelectedId?: string): void {\n const tree = this.sessionManager.getTree();\n const realLeafId = this.sessionManager.getLeafId();\n const initialFilterMode = this.settingsManager.getTreeFilterMode();\n\n if (tree.length === 0) {\n this.showStatus(\"No entries in session\");\n return;\n }\n\n this.showSelector((done) => {\n const selector = new TreeSelectorComponent(\n tree,\n realLeafId,\n this.ui.terminal.rows,\n async (entryId) => {\n // Selecting the current leaf is a no-op (already there)\n if (entryId === realLeafId) {\n done();\n this.showStatus(\"Already at this point\");\n return;\n }\n\n // Ask about summarization\n done(); // Close selector first\n\n // Loop until user makes a complete choice or cancels to tree\n let wantsSummary = false;\n let customInstructions: string | undefined;\n\n // Check if we should skip the prompt (user preference to always default to no summary)\n if (!this.settingsManager.getBranchSummarySkipPrompt()) {\n while (true) {\n const summaryChoice = await this.showExtensionSelector(\n \"Summarize branch?\",\n [\"No summary\", \"Summarize\", \"Summarize with custom prompt\"],\n );\n\n if (summaryChoice === undefined) {\n // User pressed escape - re-show tree selector with same selection\n this.showTreeSelector(entryId);\n return;\n }\n\n wantsSummary = summaryChoice !== \"No summary\";\n\n if (summaryChoice === \"Summarize with custom prompt\") {\n customInstructions = await this.showExtensionEditor(\n \"Custom summarization instructions\",\n );\n if (customInstructions === undefined) {\n // User cancelled - loop back to summary selector\n continue;\n }\n }\n\n // User made a complete choice\n break;\n }\n }\n\n // Set up escape handler and loader if summarizing\n let summaryLoader: Loader | undefined;\n const originalOnEscape = this.defaultEditor.onEscape;\n\n if (wantsSummary) {\n this.defaultEditor.onEscape = () => {\n this.session.abortBranchSummary();\n };\n this.chatContainer.addChild(new Spacer(1));\n summaryLoader = new Loader(\n this.ui,\n (spinner) => theme.fg(\"accent\", spinner),\n (text) => theme.fg(\"muted\", text),\n `Summarizing branch... (${keyText(\"app.interrupt\")} Cancel)`,\n );\n this.statusContainer.addChild(summaryLoader);\n this.ui.requestRender();\n }\n\n try {\n const result = await this.session.navigateTree(entryId, {\n summarize: wantsSummary,\n customInstructions,\n });\n\n if (result.aborted) {\n // Summarization aborted - re-show tree selector with same selection\n this.showStatus(\"Branch summarization cancelled\");\n this.showTreeSelector(entryId);\n return;\n }\n if (result.cancelled) {\n this.showStatus(\"Navigation cancelled\");\n return;\n }\n\n // Update UI\n this.chatContainer.clear();\n this.renderInitialMessages();\n if (result.editorText && !this.editor.getText().trim()) {\n this.editor.setText(result.editorText);\n }\n this.showStatus(\"Navigated to selected point\");\n void this.flushCompactionQueue({ willRetry: false });\n } catch (error) {\n this.showError(\n error instanceof Error ? error.message : String(error),\n );\n } finally {\n if (summaryLoader) {\n summaryLoader.stop();\n this.statusContainer.clear();\n }\n this.defaultEditor.onEscape = originalOnEscape;\n }\n },\n () => {\n done();\n this.ui.requestRender();\n },\n (entryId, label) => {\n this.sessionManager.appendLabelChange(entryId, label);\n this.ui.requestRender();\n },\n initialSelectedId,\n initialFilterMode,\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showSessionSelector = function(this: InteractiveModeBase): void {\n this.showSelector((done) => {\n const selector = new SessionSelectorComponent(\n (onProgress) =>\n SessionManager.list(\n this.sessionManager.getCwd(),\n this.sessionManager.getSessionDir(),\n onProgress,\n ),\n (onProgress) =>\n this.sessionManager.usesDefaultSessionDir()\n ? SessionManager.listAll(onProgress)\n : SessionManager.listAll(\n this.sessionManager.getSessionDir(),\n onProgress,\n ),\n async (sessionPath) => {\n done();\n await this.handleResumeSession(sessionPath);\n },\n () => {\n done();\n this.ui.requestRender();\n },\n () => {\n void this.shutdown();\n },\n () => this.ui.requestRender(),\n {\n renameSession: async (\n sessionFilePath: string,\n nextName: string | undefined,\n ) => {\n const next = (nextName ?? \"\").trim();\n if (!next) return;\n const mgr = SessionManager.open(sessionFilePath);\n mgr.appendSessionInfo(next);\n },\n showRenameHint: true,\n keybindings: this.keybindings,\n },\n\n this.sessionManager.getSessionFile(),\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.handleResumeSession = async function(this: InteractiveModeBase, sessionPath: string, options?: Parameters<ExtensionCommandContext[\"switchSession\"]>[1]): Promise<{ cancelled: boolean }> {\n if (this.loadingAnimation) {\n this.loadingAnimation.stop();\n this.loadingAnimation = undefined;\n }\n this.statusContainer.clear();\n try {\n const result = await this.runtimeHost.switchSession(sessionPath, {\n withSession: options?.withSession,\n projectTrustContextFactory: (cwd) => this.createProjectTrustContext(cwd),\n });\n if (result.cancelled) {\n return result;\n }\n this.renderCurrentSessionState();\n if (this.firstRunNoticeVisible) {\n this.clearFirstRunOnboardingUi();\n }\n this.showStatus(\"Resumed session\");\n return result;\n } catch (error: unknown) {\n if (error instanceof MissingSessionCwdError) {\n const selectedCwd = await this.promptForMissingSessionCwd(error);\n if (!selectedCwd) {\n this.showStatus(\"Resume cancelled\");\n return { cancelled: true };\n }\n const result = await this.runtimeHost.switchSession(sessionPath, {\n cwdOverride: selectedCwd,\n withSession: options?.withSession,\n projectTrustContextFactory: (cwd) => this.createProjectTrustContext(cwd),\n });\n if (result.cancelled) {\n return result;\n }\n this.renderCurrentSessionState();\n if (this.firstRunNoticeVisible) {\n this.clearFirstRunOnboardingUi();\n }\n this.showStatus(\"Resumed session in current cwd\");\n return result;\n }\n return this.handleFatalRuntimeError(\"Failed to resume session\", error);\n }\n };\n"]}
1
+ {"version":3,"file":"interactive-session-routing.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-session-routing.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type ExtensionCommandContext, Loader, Spacer, APP_NAME, MissingSessionCwdError, SessionManager, keyText, SessionSelectorComponent, TreeSelectorComponent, TrustSelectorComponent, hasTrustRequiringProjectResources, ProjectTrustStore, theme } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.handleCloneCommand = async function(this: InteractiveModeBase): Promise<void> {\n const leafId = this.sessionManager.getLeafId();\n if (!leafId) {\n this.showStatus(\"Nothing to clone yet\");\n return;\n }\n\n try {\n const result = await this.runtimeHost.fork(leafId, { position: \"at\" });\n if (result.cancelled) {\n this.ui.requestRender();\n return;\n }\n\n this.renderCurrentSessionState();\n this.editor.setText(\"\");\n this.showStatus(\"Cloned to new session\");\n } catch (error: unknown) {\n this.showError(error instanceof Error ? error.message : String(error));\n }\n };\n\nInteractiveModeBase.prototype.maybeSaveImplicitProjectTrustAfterReload = function(this: InteractiveModeBase): boolean {\n const cwd = this.sessionManager.getCwd();\n if (this.autoTrustOnReloadCwd !== cwd) {\n return false;\n }\n if (!this.settingsManager.isProjectTrusted() || !hasTrustRequiringProjectResources(cwd)) {\n return false;\n }\n\n const trustStore = new ProjectTrustStore(this.runtimeHost.services.agentDir);\n try {\n if (trustStore.get(cwd) !== null) {\n this.autoTrustOnReloadCwd = undefined;\n return false;\n }\n trustStore.set(cwd, true);\n this.autoTrustOnReloadCwd = undefined;\n return true;\n } catch (error) {\n this.showWarning(\n `Could not save project trust after reload: ${error instanceof Error ? error.message : String(error)}`,\n );\n return false;\n }\n };\n\nInteractiveModeBase.prototype.showTrustSelector = function(this: InteractiveModeBase): void {\n const cwd = this.sessionManager.getCwd();\n const trustStore = new ProjectTrustStore(this.runtimeHost.services.agentDir);\n const savedDecision = trustStore.getEntry(cwd);\n this.showSelector((done) => {\n const selector = new TrustSelectorComponent({\n cwd,\n savedDecision,\n projectTrusted: this.settingsManager.isProjectTrusted(),\n onSelect: (selection) => {\n trustStore.setMany(selection.updates);\n done();\n this.showStatus(\n `Saved trust decision: ${selection.trusted ? \"trusted\" : \"untrusted\"}. Restart ${APP_NAME} for this to take effect.`,\n );\n },\n onCancel: () => {\n done();\n this.ui.requestRender();\n },\n });\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showTreeSelector = function(this: InteractiveModeBase, initialSelectedId?: string): void {\n const tree = this.sessionManager.getTree();\n const realLeafId = this.sessionManager.getLeafId();\n const initialFilterMode = this.settingsManager.getTreeFilterMode();\n\n if (tree.length === 0) {\n this.showStatus(\"No entries in session\");\n return;\n }\n\n this.showSelector((done) => {\n const selector = new TreeSelectorComponent(\n tree,\n realLeafId,\n this.ui.terminal.rows,\n async (entryId) => {\n // Selecting the current leaf is a no-op (already there)\n if (entryId === realLeafId) {\n done();\n this.showStatus(\"Already at this point\");\n return;\n }\n\n // Ask about summarization\n done(); // Close selector first\n\n // Loop until user makes a complete choice or cancels to tree\n let wantsSummary = false;\n let customInstructions: string | undefined;\n\n // Check if we should skip the prompt (user preference to always default to no summary)\n if (!this.settingsManager.getBranchSummarySkipPrompt()) {\n while (true) {\n const summaryChoice = await this.showExtensionSelector(\n \"Summarize branch?\",\n [\"No summary\", \"Summarize\", \"Summarize with custom prompt\"],\n );\n\n if (summaryChoice === undefined) {\n // User pressed escape - re-show tree selector with same selection\n this.showTreeSelector(entryId);\n return;\n }\n\n wantsSummary = summaryChoice !== \"No summary\";\n\n if (summaryChoice === \"Summarize with custom prompt\") {\n customInstructions = await this.showExtensionEditor(\n \"Custom summarization instructions\",\n );\n if (customInstructions === undefined) {\n // User cancelled - loop back to summary selector\n continue;\n }\n }\n\n // User made a complete choice\n break;\n }\n }\n\n // Set up escape handler and loader if summarizing\n let summaryLoader: Loader | undefined;\n const originalOnEscape = this.defaultEditor.onEscape;\n\n if (wantsSummary) {\n this.defaultEditor.onEscape = () => {\n this.session.abortBranchSummary();\n };\n this.chatContainer.addChild(new Spacer(1));\n summaryLoader = new Loader(\n this.ui,\n (spinner) => theme.fg(\"accent\", spinner),\n (text) => theme.fg(\"muted\", text),\n `Summarizing branch... (${keyText(\"app.interrupt\")} Cancel)`,\n );\n this.statusContainer.addChild(summaryLoader);\n this.ui.requestRender();\n }\n\n try {\n const result = await this.session.navigateTree(entryId, {\n summarize: wantsSummary,\n customInstructions,\n });\n\n if (result.aborted) {\n // Summarization aborted - re-show tree selector with same selection\n this.showStatus(\"Branch summarization cancelled\");\n this.showTreeSelector(entryId);\n return;\n }\n if (result.cancelled) {\n this.showStatus(\"Navigation cancelled\");\n return;\n }\n\n // Update UI\n this.chatContainer.clear();\n this.renderInitialMessages();\n if (result.editorText && !this.editor.getText().trim()) {\n this.editor.setText(result.editorText);\n }\n this.showStatus(\"Navigated to selected point\");\n void this.flushCompactionQueue({ willRetry: false });\n } catch (error) {\n this.showError(\n error instanceof Error ? error.message : String(error),\n );\n } finally {\n if (summaryLoader) {\n summaryLoader.stop();\n this.statusContainer.clear();\n }\n this.defaultEditor.onEscape = originalOnEscape;\n }\n },\n () => {\n done();\n this.ui.requestRender();\n },\n (entryId, label) => {\n this.sessionManager.appendLabelChange(entryId, label);\n this.ui.requestRender();\n },\n initialSelectedId,\n initialFilterMode,\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showSessionSelector = function(this: InteractiveModeBase): void {\n this.showSelector((done) => {\n const selector = new SessionSelectorComponent(\n (onProgress) =>\n SessionManager.list(\n this.sessionManager.getCwd(),\n this.sessionManager.getSessionDir(),\n onProgress,\n ),\n (onProgress) =>\n this.sessionManager.usesDefaultSessionDir()\n ? SessionManager.listAll(onProgress)\n : SessionManager.listAll(\n this.sessionManager.getSessionDir(),\n onProgress,\n ),\n async (sessionPath) => {\n done();\n await this.handleResumeSession(sessionPath);\n },\n () => {\n done();\n this.ui.requestRender();\n },\n () => {\n void this.shutdown();\n },\n () => this.ui.requestRender(),\n {\n renameSession: async (\n sessionFilePath: string,\n nextName: string | undefined,\n ) => {\n const next = (nextName ?? \"\").trim();\n if (!next) return;\n const mgr = SessionManager.open(sessionFilePath);\n mgr.appendSessionInfo(next);\n },\n showRenameHint: true,\n keybindings: this.keybindings,\n },\n\n this.sessionManager.getSessionFile(),\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.handleResumeSession = async function(this: InteractiveModeBase, sessionPath: string, options?: Parameters<ExtensionCommandContext[\"switchSession\"]>[1]): Promise<{ cancelled: boolean }> {\n if (this.loadingAnimation) {\n this.loadingAnimation.stop();\n this.loadingAnimation = undefined;\n }\n this.statusContainer.clear();\n try {\n const result = await this.runtimeHost.switchSession(sessionPath, {\n withSession: options?.withSession,\n projectTrustContextFactory: (cwd) => this.createProjectTrustContext(cwd),\n });\n if (result.cancelled) {\n return result;\n }\n this.renderCurrentSessionState();\n if (this.firstRunNoticeVisible) {\n this.clearFirstRunOnboardingUi();\n }\n this.showStatus(\"Resumed session\");\n return result;\n } catch (error: unknown) {\n if (error instanceof MissingSessionCwdError) {\n const selectedCwd = await this.promptForMissingSessionCwd(error);\n if (!selectedCwd) {\n this.showStatus(\"Resume cancelled\");\n return { cancelled: true };\n }\n const result = await this.runtimeHost.switchSession(sessionPath, {\n cwdOverride: selectedCwd,\n withSession: options?.withSession,\n projectTrustContextFactory: (cwd) => this.createProjectTrustContext(cwd),\n });\n if (result.cancelled) {\n return result;\n }\n this.renderCurrentSessionState();\n if (this.firstRunNoticeVisible) {\n this.clearFirstRunOnboardingUi();\n }\n this.showStatus(\"Resumed session in current cwd\");\n return result;\n }\n return this.handleFatalRuntimeError(\"Failed to resume session\", error);\n }\n };\n"]}
@@ -1,5 +1,5 @@
1
1
  import { InteractiveModeBase } from "./interactive-mode-base.js";
2
- import { Loader, Spacer, APP_NAME, MissingSessionCwdError, SessionManager, keyText, SessionSelectorComponent, TreeSelectorComponent, TrustSelectorComponent, hasProjectConfigDir, ProjectTrustStore, theme } from "./interactive-mode-deps.js";
2
+ import { Loader, Spacer, APP_NAME, MissingSessionCwdError, SessionManager, keyText, SessionSelectorComponent, TreeSelectorComponent, TrustSelectorComponent, hasTrustRequiringProjectResources, ProjectTrustStore, theme } from "./interactive-mode-deps.js";
3
3
  InteractiveModeBase.prototype.handleCloneCommand = async function () {
4
4
  const leafId = this.sessionManager.getLeafId();
5
5
  if (!leafId) {
@@ -25,7 +25,7 @@ InteractiveModeBase.prototype.maybeSaveImplicitProjectTrustAfterReload = functio
25
25
  if (this.autoTrustOnReloadCwd !== cwd) {
26
26
  return false;
27
27
  }
28
- if (!this.settingsManager.isProjectTrusted() || !hasProjectConfigDir(cwd)) {
28
+ if (!this.settingsManager.isProjectTrusted() || !hasTrustRequiringProjectResources(cwd)) {
29
29
  return false;
30
30
  }
31
31
  const trustStore = new ProjectTrustStore(this.runtimeHost.services.agentDir);
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-session-routing.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-session-routing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAgC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,sBAAsB,EAAE,cAAc,EAAE,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAE7Q,mBAAmB,CAAC,SAAS,CAAC,kBAAkB,GAAG,KAAK;IACpD,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC;IAC/C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,IAAI,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC;QACxC,OAAO;IACT,CAAC;IAED,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QACvE,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;YACrB,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;YACxB,OAAO;QACT,CAAC;QAED,IAAI,CAAC,yBAAyB,EAAE,CAAC;QACjC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACxB,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,IAAI,CAAC,SAAS,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACzE,CAAC;AACH,CAAC,CAAC;AAEJ,mBAAmB,CAAC,SAAS,CAAC,wCAAwC,GAAG;IACrE,MAAM,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AAE;gBAC/D,WAAW,EAAE,WAAW;gBACxB,WAAW,EAAE,OAAO,EAAE,WAAW;gBACjC,0BAA0B,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC;aACzE,CAAC,CAAC;YACH,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;gBACrB,OAAO,MAAM,CAAC;YAChB,CAAC;YACD,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACjC,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC;gBAC/B,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACnC,CAAC;YACD,IAAI,CAAC,UAAU,CAAC,gCAAgC,CAAC,CAAC;YAClD,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,OAAO,IAAI,CAAC,uBAAuB,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;IACzE,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type ExtensionCommandContext, Loader, Spacer, APP_NAME, MissingSessionCwdError, SessionManager, keyText, SessionSelectorComponent, TreeSelectorComponent, TrustSelectorComponent, hasProjectConfigDir, ProjectTrustStore, theme } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.handleCloneCommand = async function(this: InteractiveModeBase): Promise<void> {\n const leafId = this.sessionManager.getLeafId();\n if (!leafId) {\n this.showStatus(\"Nothing to clone yet\");\n return;\n }\n\n try {\n const result = await this.runtimeHost.fork(leafId, { position: \"at\" });\n if (result.cancelled) {\n this.ui.requestRender();\n return;\n }\n\n this.renderCurrentSessionState();\n this.editor.setText(\"\");\n this.showStatus(\"Cloned to new session\");\n } catch (error: unknown) {\n this.showError(error instanceof Error ? error.message : String(error));\n }\n };\n\nInteractiveModeBase.prototype.maybeSaveImplicitProjectTrustAfterReload = function(this: InteractiveModeBase): boolean {\n const cwd = this.sessionManager.getCwd();\n if (this.autoTrustOnReloadCwd !== cwd) {\n return false;\n }\n if (!this.settingsManager.isProjectTrusted() || !hasProjectConfigDir(cwd)) {\n return false;\n }\n\n const trustStore = new ProjectTrustStore(this.runtimeHost.services.agentDir);\n try {\n if (trustStore.get(cwd) !== null) {\n this.autoTrustOnReloadCwd = undefined;\n return false;\n }\n trustStore.set(cwd, true);\n this.autoTrustOnReloadCwd = undefined;\n return true;\n } catch (error) {\n this.showWarning(\n `Could not save project trust after reload: ${error instanceof Error ? error.message : String(error)}`,\n );\n return false;\n }\n };\n\nInteractiveModeBase.prototype.showTrustSelector = function(this: InteractiveModeBase): void {\n const cwd = this.sessionManager.getCwd();\n const trustStore = new ProjectTrustStore(this.runtimeHost.services.agentDir);\n const savedDecision = trustStore.getEntry(cwd);\n this.showSelector((done) => {\n const selector = new TrustSelectorComponent({\n cwd,\n savedDecision,\n projectTrusted: this.settingsManager.isProjectTrusted(),\n onSelect: (selection) => {\n trustStore.setMany(selection.updates);\n done();\n this.showStatus(\n `Saved trust decision: ${selection.trusted ? \"trusted\" : \"untrusted\"}. Restart ${APP_NAME} for this to take effect.`,\n );\n },\n onCancel: () => {\n done();\n this.ui.requestRender();\n },\n });\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showTreeSelector = function(this: InteractiveModeBase, initialSelectedId?: string): void {\n const tree = this.sessionManager.getTree();\n const realLeafId = this.sessionManager.getLeafId();\n const initialFilterMode = this.settingsManager.getTreeFilterMode();\n\n if (tree.length === 0) {\n this.showStatus(\"No entries in session\");\n return;\n }\n\n this.showSelector((done) => {\n const selector = new TreeSelectorComponent(\n tree,\n realLeafId,\n this.ui.terminal.rows,\n async (entryId) => {\n // Selecting the current leaf is a no-op (already there)\n if (entryId === realLeafId) {\n done();\n this.showStatus(\"Already at this point\");\n return;\n }\n\n // Ask about summarization\n done(); // Close selector first\n\n // Loop until user makes a complete choice or cancels to tree\n let wantsSummary = false;\n let customInstructions: string | undefined;\n\n // Check if we should skip the prompt (user preference to always default to no summary)\n if (!this.settingsManager.getBranchSummarySkipPrompt()) {\n while (true) {\n const summaryChoice = await this.showExtensionSelector(\n \"Summarize branch?\",\n [\"No summary\", \"Summarize\", \"Summarize with custom prompt\"],\n );\n\n if (summaryChoice === undefined) {\n // User pressed escape - re-show tree selector with same selection\n this.showTreeSelector(entryId);\n return;\n }\n\n wantsSummary = summaryChoice !== \"No summary\";\n\n if (summaryChoice === \"Summarize with custom prompt\") {\n customInstructions = await this.showExtensionEditor(\n \"Custom summarization instructions\",\n );\n if (customInstructions === undefined) {\n // User cancelled - loop back to summary selector\n continue;\n }\n }\n\n // User made a complete choice\n break;\n }\n }\n\n // Set up escape handler and loader if summarizing\n let summaryLoader: Loader | undefined;\n const originalOnEscape = this.defaultEditor.onEscape;\n\n if (wantsSummary) {\n this.defaultEditor.onEscape = () => {\n this.session.abortBranchSummary();\n };\n this.chatContainer.addChild(new Spacer(1));\n summaryLoader = new Loader(\n this.ui,\n (spinner) => theme.fg(\"accent\", spinner),\n (text) => theme.fg(\"muted\", text),\n `Summarizing branch... (${keyText(\"app.interrupt\")} Cancel)`,\n );\n this.statusContainer.addChild(summaryLoader);\n this.ui.requestRender();\n }\n\n try {\n const result = await this.session.navigateTree(entryId, {\n summarize: wantsSummary,\n customInstructions,\n });\n\n if (result.aborted) {\n // Summarization aborted - re-show tree selector with same selection\n this.showStatus(\"Branch summarization cancelled\");\n this.showTreeSelector(entryId);\n return;\n }\n if (result.cancelled) {\n this.showStatus(\"Navigation cancelled\");\n return;\n }\n\n // Update UI\n this.chatContainer.clear();\n this.renderInitialMessages();\n if (result.editorText && !this.editor.getText().trim()) {\n this.editor.setText(result.editorText);\n }\n this.showStatus(\"Navigated to selected point\");\n void this.flushCompactionQueue({ willRetry: false });\n } catch (error) {\n this.showError(\n error instanceof Error ? error.message : String(error),\n );\n } finally {\n if (summaryLoader) {\n summaryLoader.stop();\n this.statusContainer.clear();\n }\n this.defaultEditor.onEscape = originalOnEscape;\n }\n },\n () => {\n done();\n this.ui.requestRender();\n },\n (entryId, label) => {\n this.sessionManager.appendLabelChange(entryId, label);\n this.ui.requestRender();\n },\n initialSelectedId,\n initialFilterMode,\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showSessionSelector = function(this: InteractiveModeBase): void {\n this.showSelector((done) => {\n const selector = new SessionSelectorComponent(\n (onProgress) =>\n SessionManager.list(\n this.sessionManager.getCwd(),\n this.sessionManager.getSessionDir(),\n onProgress,\n ),\n (onProgress) =>\n this.sessionManager.usesDefaultSessionDir()\n ? SessionManager.listAll(onProgress)\n : SessionManager.listAll(\n this.sessionManager.getSessionDir(),\n onProgress,\n ),\n async (sessionPath) => {\n done();\n await this.handleResumeSession(sessionPath);\n },\n () => {\n done();\n this.ui.requestRender();\n },\n () => {\n void this.shutdown();\n },\n () => this.ui.requestRender(),\n {\n renameSession: async (\n sessionFilePath: string,\n nextName: string | undefined,\n ) => {\n const next = (nextName ?? \"\").trim();\n if (!next) return;\n const mgr = SessionManager.open(sessionFilePath);\n mgr.appendSessionInfo(next);\n },\n showRenameHint: true,\n keybindings: this.keybindings,\n },\n\n this.sessionManager.getSessionFile(),\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.handleResumeSession = async function(this: InteractiveModeBase, sessionPath: string, options?: Parameters<ExtensionCommandContext[\"switchSession\"]>[1]): Promise<{ cancelled: boolean }> {\n if (this.loadingAnimation) {\n this.loadingAnimation.stop();\n this.loadingAnimation = undefined;\n }\n this.statusContainer.clear();\n try {\n const result = await this.runtimeHost.switchSession(sessionPath, {\n withSession: options?.withSession,\n projectTrustContextFactory: (cwd) => this.createProjectTrustContext(cwd),\n });\n if (result.cancelled) {\n return result;\n }\n this.renderCurrentSessionState();\n if (this.firstRunNoticeVisible) {\n this.clearFirstRunOnboardingUi();\n }\n this.showStatus(\"Resumed session\");\n return result;\n } catch (error: unknown) {\n if (error instanceof MissingSessionCwdError) {\n const selectedCwd = await this.promptForMissingSessionCwd(error);\n if (!selectedCwd) {\n this.showStatus(\"Resume cancelled\");\n return { cancelled: true };\n }\n const result = await this.runtimeHost.switchSession(sessionPath, {\n cwdOverride: selectedCwd,\n withSession: options?.withSession,\n projectTrustContextFactory: (cwd) => this.createProjectTrustContext(cwd),\n });\n if (result.cancelled) {\n return result;\n }\n this.renderCurrentSessionState();\n if (this.firstRunNoticeVisible) {\n this.clearFirstRunOnboardingUi();\n }\n this.showStatus(\"Resumed session in current cwd\");\n return result;\n }\n return this.handleFatalRuntimeError(\"Failed to resume session\", error);\n }\n };\n"]}
1
+ {"version":3,"file":"interactive-session-routing.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-session-routing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAgC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,sBAAsB,EAAE,cAAc,EAAE,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,iCAAiC,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAE3R,mBAAmB,CAAC,SAAS,CAAC,kBAAkB,GAAG,KAAK;IACpD,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC;IAC/C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,IAAI,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC;QACxC,OAAO;IACT,CAAC;IAED,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QACvE,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;YACrB,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;YACxB,OAAO;QACT,CAAC;QAED,IAAI,CAAC,yBAAyB,EAAE,CAAC;QACjC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CA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AAK,YAAY,sBAAsB,EAAE,CAAC;YAC5C,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC;YACjE,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjB,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;gBACpC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;YAC7B,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,WAAW,EAAE;gBAC/D,WAAW,EAAE,WAAW;gBACxB,WAAW,EAAE,OAAO,EAAE,WAAW;gBACjC,0BAA0B,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC;aACzE,CAAC,CAAC;YACH,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;gBACrB,OAAO,MAAM,CAAC;YAChB,CAAC;YACD,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACjC,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC;gBAC/B,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACnC,CAAC;YACD,IAAI,CAAC,UAAU,CAAC,gCAAgC,CAAC,CAAC;YAClD,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,OAAO,IAAI,CAAC,uBAAuB,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;IACzE,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type ExtensionCommandContext, Loader, Spacer, APP_NAME, MissingSessionCwdError, SessionManager, keyText, SessionSelectorComponent, TreeSelectorComponent, TrustSelectorComponent, hasTrustRequiringProjectResources, ProjectTrustStore, theme } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.handleCloneCommand = async function(this: InteractiveModeBase): Promise<void> {\n const leafId = this.sessionManager.getLeafId();\n if (!leafId) {\n this.showStatus(\"Nothing to clone yet\");\n return;\n }\n\n try {\n const result = await this.runtimeHost.fork(leafId, { position: \"at\" });\n if (result.cancelled) {\n this.ui.requestRender();\n return;\n }\n\n this.renderCurrentSessionState();\n this.editor.setText(\"\");\n this.showStatus(\"Cloned to new session\");\n } catch (error: unknown) {\n this.showError(error instanceof Error ? error.message : String(error));\n }\n };\n\nInteractiveModeBase.prototype.maybeSaveImplicitProjectTrustAfterReload = function(this: InteractiveModeBase): boolean {\n const cwd = this.sessionManager.getCwd();\n if (this.autoTrustOnReloadCwd !== cwd) {\n return false;\n }\n if (!this.settingsManager.isProjectTrusted() || !hasTrustRequiringProjectResources(cwd)) {\n return false;\n }\n\n const trustStore = new ProjectTrustStore(this.runtimeHost.services.agentDir);\n try {\n if (trustStore.get(cwd) !== null) {\n this.autoTrustOnReloadCwd = undefined;\n return false;\n }\n trustStore.set(cwd, true);\n this.autoTrustOnReloadCwd = undefined;\n return true;\n } catch (error) {\n this.showWarning(\n `Could not save project trust after reload: ${error instanceof Error ? error.message : String(error)}`,\n );\n return false;\n }\n };\n\nInteractiveModeBase.prototype.showTrustSelector = function(this: InteractiveModeBase): void {\n const cwd = this.sessionManager.getCwd();\n const trustStore = new ProjectTrustStore(this.runtimeHost.services.agentDir);\n const savedDecision = trustStore.getEntry(cwd);\n this.showSelector((done) => {\n const selector = new TrustSelectorComponent({\n cwd,\n savedDecision,\n projectTrusted: this.settingsManager.isProjectTrusted(),\n onSelect: (selection) => {\n trustStore.setMany(selection.updates);\n done();\n this.showStatus(\n `Saved trust decision: ${selection.trusted ? \"trusted\" : \"untrusted\"}. Restart ${APP_NAME} for this to take effect.`,\n );\n },\n onCancel: () => {\n done();\n this.ui.requestRender();\n },\n });\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showTreeSelector = function(this: InteractiveModeBase, initialSelectedId?: string): void {\n const tree = this.sessionManager.getTree();\n const realLeafId = this.sessionManager.getLeafId();\n const initialFilterMode = this.settingsManager.getTreeFilterMode();\n\n if (tree.length === 0) {\n this.showStatus(\"No entries in session\");\n return;\n }\n\n this.showSelector((done) => {\n const selector = new TreeSelectorComponent(\n tree,\n realLeafId,\n this.ui.terminal.rows,\n async (entryId) => {\n // Selecting the current leaf is a no-op (already there)\n if (entryId === realLeafId) {\n done();\n this.showStatus(\"Already at this point\");\n return;\n }\n\n // Ask about summarization\n done(); // Close selector first\n\n // Loop until user makes a complete choice or cancels to tree\n let wantsSummary = false;\n let customInstructions: string | undefined;\n\n // Check if we should skip the prompt (user preference to always default to no summary)\n if (!this.settingsManager.getBranchSummarySkipPrompt()) {\n while (true) {\n const summaryChoice = await this.showExtensionSelector(\n \"Summarize branch?\",\n [\"No summary\", \"Summarize\", \"Summarize with custom prompt\"],\n );\n\n if (summaryChoice === undefined) {\n // User pressed escape - re-show tree selector with same selection\n this.showTreeSelector(entryId);\n return;\n }\n\n wantsSummary = summaryChoice !== \"No summary\";\n\n if (summaryChoice === \"Summarize with custom prompt\") {\n customInstructions = await this.showExtensionEditor(\n \"Custom summarization instructions\",\n );\n if (customInstructions === undefined) {\n // User cancelled - loop back to summary selector\n continue;\n }\n }\n\n // User made a complete choice\n break;\n }\n }\n\n // Set up escape handler and loader if summarizing\n let summaryLoader: Loader | undefined;\n const originalOnEscape = this.defaultEditor.onEscape;\n\n if (wantsSummary) {\n this.defaultEditor.onEscape = () => {\n this.session.abortBranchSummary();\n };\n this.chatContainer.addChild(new Spacer(1));\n summaryLoader = new Loader(\n this.ui,\n (spinner) => theme.fg(\"accent\", spinner),\n (text) => theme.fg(\"muted\", text),\n `Summarizing branch... (${keyText(\"app.interrupt\")} Cancel)`,\n );\n this.statusContainer.addChild(summaryLoader);\n this.ui.requestRender();\n }\n\n try {\n const result = await this.session.navigateTree(entryId, {\n summarize: wantsSummary,\n customInstructions,\n });\n\n if (result.aborted) {\n // Summarization aborted - re-show tree selector with same selection\n this.showStatus(\"Branch summarization cancelled\");\n this.showTreeSelector(entryId);\n return;\n }\n if (result.cancelled) {\n this.showStatus(\"Navigation cancelled\");\n return;\n }\n\n // Update UI\n this.chatContainer.clear();\n this.renderInitialMessages();\n if (result.editorText && !this.editor.getText().trim()) {\n this.editor.setText(result.editorText);\n }\n this.showStatus(\"Navigated to selected point\");\n void this.flushCompactionQueue({ willRetry: false });\n } catch (error) {\n this.showError(\n error instanceof Error ? error.message : String(error),\n );\n } finally {\n if (summaryLoader) {\n summaryLoader.stop();\n this.statusContainer.clear();\n }\n this.defaultEditor.onEscape = originalOnEscape;\n }\n },\n () => {\n done();\n this.ui.requestRender();\n },\n (entryId, label) => {\n this.sessionManager.appendLabelChange(entryId, label);\n this.ui.requestRender();\n },\n initialSelectedId,\n initialFilterMode,\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showSessionSelector = function(this: InteractiveModeBase): void {\n this.showSelector((done) => {\n const selector = new SessionSelectorComponent(\n (onProgress) =>\n SessionManager.list(\n this.sessionManager.getCwd(),\n this.sessionManager.getSessionDir(),\n onProgress,\n ),\n (onProgress) =>\n this.sessionManager.usesDefaultSessionDir()\n ? SessionManager.listAll(onProgress)\n : SessionManager.listAll(\n this.sessionManager.getSessionDir(),\n onProgress,\n ),\n async (sessionPath) => {\n done();\n await this.handleResumeSession(sessionPath);\n },\n () => {\n done();\n this.ui.requestRender();\n },\n () => {\n void this.shutdown();\n },\n () => this.ui.requestRender(),\n {\n renameSession: async (\n sessionFilePath: string,\n nextName: string | undefined,\n ) => {\n const next = (nextName ?? \"\").trim();\n if (!next) return;\n const mgr = SessionManager.open(sessionFilePath);\n mgr.appendSessionInfo(next);\n },\n showRenameHint: true,\n keybindings: this.keybindings,\n },\n\n this.sessionManager.getSessionFile(),\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.handleResumeSession = async function(this: InteractiveModeBase, sessionPath: string, options?: Parameters<ExtensionCommandContext[\"switchSession\"]>[1]): Promise<{ cancelled: boolean }> {\n if (this.loadingAnimation) {\n this.loadingAnimation.stop();\n this.loadingAnimation = undefined;\n }\n this.statusContainer.clear();\n try {\n const result = await this.runtimeHost.switchSession(sessionPath, {\n withSession: options?.withSession,\n projectTrustContextFactory: (cwd) => this.createProjectTrustContext(cwd),\n });\n if (result.cancelled) {\n return result;\n }\n this.renderCurrentSessionState();\n if (this.firstRunNoticeVisible) {\n this.clearFirstRunOnboardingUi();\n }\n this.showStatus(\"Resumed session\");\n return result;\n } catch (error: unknown) {\n if (error instanceof MissingSessionCwdError) {\n const selectedCwd = await this.promptForMissingSessionCwd(error);\n if (!selectedCwd) {\n this.showStatus(\"Resume cancelled\");\n return { cancelled: true };\n }\n const result = await this.runtimeHost.switchSession(sessionPath, {\n cwdOverride: selectedCwd,\n withSession: options?.withSession,\n projectTrustContextFactory: (cwd) => this.createProjectTrustContext(cwd),\n });\n if (result.cancelled) {\n return result;\n }\n this.renderCurrentSessionState();\n if (this.firstRunNoticeVisible) {\n this.clearFirstRunOnboardingUi();\n }\n this.showStatus(\"Resumed session in current cwd\");\n return result;\n }\n return this.handleFatalRuntimeError(\"Failed to resume session\", error);\n }\n };\n"]}
@@ -1,5 +1,11 @@
1
1
  import { type ChildProcess, type ChildProcessByStdio, type SpawnOptions, type SpawnOptionsWithStdioTuple, type SpawnSyncOptionsWithStringEncoding, type SpawnSyncReturns, type StdioNull, type StdioPipe } from "node:child_process";
2
2
  import type { Readable } from "node:stream";
3
+ type WaitForChildProcessOptions = {
4
+ platform?: NodeJS.Platform;
5
+ isWindowsProcessAlive?: (pid: number) => boolean;
6
+ windowsExitPollIntervalMs?: number;
7
+ windowsExitCodeGraceMs?: number;
8
+ };
3
9
  export declare function shouldUseWindowsShell(command: string): boolean;
4
10
  export declare function spawnProcess(command: string, args: string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): ChildProcessByStdio<null, Readable, Readable>;
5
11
  export declare function spawnProcess(command: string, args: string[], options: SpawnOptions): ChildProcess;
@@ -17,5 +23,6 @@ export declare function spawnProcessSync(command: string, args: string[], option
17
23
  * after the grace elapses. A longer active-drain hard cap is armed once on `exit`
18
24
  * so an endlessly noisy descendant cannot keep the wait pending forever.
19
25
  */
20
- export declare function waitForChildProcess(child: ChildProcess): Promise<number | null>;
26
+ export declare function waitForChildProcess(child: ChildProcess, options?: WaitForChildProcessOptions): Promise<number | null>;
27
+ export {};
21
28
  //# sourceMappingURL=child-process.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"child-process.d.ts","sourceRoot":"","sources":["../../src/utils/child-process.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,mBAAmB,EAGxB,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAC/B,KAAK,kCAAkC,EACvC,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAO5C,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAI9D;AAED,wBAAgB,YAAY,CAC3B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,0BAA0B,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,GAClE,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACjD,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,YAAY,GAAG,YAAY,CAAC;AAKnG,wBAAgB,gBAAgB,CAC/B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,kCAAkC,GACzC,gBAAgB,CAAC,MAAM,CAAC,CAI1B;AAQD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAmH/E","sourcesContent":["import {\n\ttype ChildProcess,\n\ttype ChildProcessByStdio,\n\tspawn as nodeSpawn,\n\tspawnSync as nodeSpawnSync,\n\ttype SpawnOptions,\n\ttype SpawnOptionsWithStdioTuple,\n\ttype SpawnSyncOptionsWithStringEncoding,\n\ttype SpawnSyncReturns,\n\ttype StdioNull,\n\ttype StdioPipe,\n} from \"node:child_process\";\nimport { basename } from \"node:path\";\nimport type { Readable } from \"node:stream\";\nimport crossSpawn from \"cross-spawn\";\n\nconst EXIT_STDIO_IDLE_GRACE_MS = 100;\nconst EXIT_STDIO_ACTIVE_DRAIN_HARD_CAP_MS = 5_000;\nconst WINDOWS_SHELL_COMMANDS = new Set([\"bun\", \"npm\", \"npx\", \"pnpm\", \"yarn\", \"yarnpkg\", \"corepack\"]);\n\nexport function shouldUseWindowsShell(command: string): boolean {\n\tif (process.platform !== \"win32\") return false;\n\tconst commandName = basename(command).toLowerCase();\n\treturn commandName.endsWith(\".cmd\") || commandName.endsWith(\".bat\") || WINDOWS_SHELL_COMMANDS.has(commandName);\n}\n\nexport function spawnProcess(\n\tcommand: string,\n\targs: string[],\n\toptions: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,\n): ChildProcessByStdio<null, Readable, Readable>;\nexport function spawnProcess(command: string, args: string[], options: SpawnOptions): ChildProcess;\nexport function spawnProcess(command: string, args: string[], options: SpawnOptions): ChildProcess {\n\treturn process.platform === \"win32\" ? crossSpawn(command, args, options) : nodeSpawn(command, args, options);\n}\n\nexport function spawnProcessSync(\n\tcommand: string,\n\targs: string[],\n\toptions: SpawnSyncOptionsWithStringEncoding,\n): SpawnSyncReturns<string> {\n\treturn process.platform === \"win32\"\n\t\t? crossSpawn.sync(command, args, options)\n\t\t: nodeSpawnSync(command, args, options);\n}\n\nfunction isWindowsProcessAlive(pid: number): boolean {\n\tconst result = nodeSpawnSync(\"tasklist\", [\"/FI\", `PID eq ${pid}`, \"/NH\"], { encoding: \"utf-8\", windowsHide: true });\n\tif (result.status !== 0) return true;\n\treturn new RegExp(`\\\\b${pid}\\\\b`).test(result.stdout);\n}\n\n/**\n * Wait for a child process to terminate without hanging on inherited stdio handles.\n *\n * A short-lived child can `exit` while a detached descendant keeps its stdout/stderr\n * pipe open. We must not resolve and destroy the streams on a short fixed deadline\n * measured from `exit`, or finite post-exit output still being written past that\n * deadline is silently lost (earendil-works/pi#5303). Instead, after `exit` we wait\n * for the pipes to fall idle: the grace timer is re-armed on every chunk, so finite\n * post-exit writers drain while active, while a quiet inherited handle (e.g. a\n * Windows daemonized descendant that never lets `close` fire) releases promptly\n * after the grace elapses. A longer active-drain hard cap is armed once on `exit`\n * so an endlessly noisy descendant cannot keep the wait pending forever.\n */\nexport function waitForChildProcess(child: ChildProcess): Promise<number | null> {\n\treturn new Promise((resolve, reject) => {\n\t\tlet settled = false;\n\t\tlet exited = false;\n\t\tlet exitCode: number | null = null;\n\t\tlet postExitIdleTimer: NodeJS.Timeout | undefined;\n\t\tlet postExitActiveDrainHardCapTimer: NodeJS.Timeout | undefined;\n\t\tlet stdoutEnded = child.stdout === null;\n\t\tlet stderrEnded = child.stderr === null;\n\t\tlet windowsExitPoll: NodeJS.Timeout | undefined;\n\n\t\tconst cleanup = () => {\n\t\t\tif (windowsExitPoll) {\n\t\t\t\tclearInterval(windowsExitPoll);\n\t\t\t\twindowsExitPoll = undefined;\n\t\t\t}\n\t\t\tif (postExitIdleTimer) {\n\t\t\t\tclearTimeout(postExitIdleTimer);\n\t\t\t\tpostExitIdleTimer = undefined;\n\t\t\t}\n\t\t\tif (postExitActiveDrainHardCapTimer) {\n\t\t\t\tclearTimeout(postExitActiveDrainHardCapTimer);\n\t\t\t\tpostExitActiveDrainHardCapTimer = undefined;\n\t\t\t}\n\t\t\tchild.removeListener(\"error\", onError);\n\t\t\tchild.removeListener(\"exit\", onExit);\n\t\t\tchild.removeListener(\"close\", onClose);\n\t\t\tchild.stdout?.removeListener(\"end\", onStdoutEnd);\n\t\t\tchild.stderr?.removeListener(\"end\", onStderrEnd);\n\t\t\tchild.stdout?.removeListener(\"data\", onData);\n\t\t\tchild.stderr?.removeListener(\"data\", onData);\n\t\t};\n\n\t\tconst finalize = (code: number | null) => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\tchild.stdout?.destroy();\n\t\t\tchild.stderr?.destroy();\n\t\t\tresolve(code);\n\t\t};\n\n\t\tconst maybeFinalizeAfterExit = () => {\n\t\t\tif (!exited || settled) return;\n\t\t\tif (stdoutEnded && stderrEnded) {\n\t\t\t\tfinalize(exitCode);\n\t\t\t}\n\t\t};\n\n\t\tconst armIdleTimer = () => {\n\t\t\tif (postExitIdleTimer) clearTimeout(postExitIdleTimer);\n\t\t\tpostExitIdleTimer = setTimeout(() => finalize(exitCode), EXIT_STDIO_IDLE_GRACE_MS);\n\t\t};\n\n\t\tconst armActiveDrainHardCapTimer = () => {\n\t\t\tif (postExitActiveDrainHardCapTimer) return;\n\t\t\tpostExitActiveDrainHardCapTimer = setTimeout(\n\t\t\t\t() => finalize(exitCode),\n\t\t\t\tEXIT_STDIO_ACTIVE_DRAIN_HARD_CAP_MS,\n\t\t\t);\n\t\t};\n\n\t\tconst onData = () => {\n\t\t\t// Output is still arriving after exit; keep extending the idle grace\n\t\t\t// so active finite writers can drain without truncating the tail.\n\t\t\tif (exited && !settled) armIdleTimer();\n\t\t};\n\n\t\tconst onStdoutEnd = () => {\n\t\t\tstdoutEnded = true;\n\t\t\tmaybeFinalizeAfterExit();\n\t\t};\n\n\t\tconst onStderrEnd = () => {\n\t\t\tstderrEnded = true;\n\t\t\tmaybeFinalizeAfterExit();\n\t\t};\n\n\t\tconst onError = (err: Error) => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\treject(err);\n\t\t};\n\n\t\tconst onExit = (code: number | null) => {\n\t\t\texited = true;\n\t\t\texitCode = code;\n\t\t\tmaybeFinalizeAfterExit();\n\t\t\tif (!settled) {\n\t\t\t\tarmActiveDrainHardCapTimer();\n\t\t\t\tarmIdleTimer();\n\t\t\t}\n\t\t};\n\n\t\tconst pollWindowsExit = () => {\n\t\t\tif (process.platform !== \"win32\" || !child.pid || exited || settled) return;\n\t\t\tif (!isWindowsProcessAlive(child.pid)) {\n\t\t\t\tonExit(child.exitCode ?? 0);\n\t\t\t}\n\t\t};\n\n\t\tconst onClose = (code: number | null) => {\n\t\t\tfinalize(code);\n\t\t};\n\n\t\tif (process.platform === \"win32\" && child.pid) windowsExitPoll = setInterval(pollWindowsExit, 50);\n\t\tchild.stdout?.once(\"end\", onStdoutEnd);\n\t\tchild.stderr?.once(\"end\", onStderrEnd);\n\t\tchild.stdout?.on(\"data\", onData);\n\t\tchild.stderr?.on(\"data\", onData);\n\t\tchild.once(\"error\", onError);\n\t\tchild.once(\"exit\", onExit);\n\t\tchild.once(\"close\", onClose);\n\t});\n}\n"]}
1
+ {"version":3,"file":"child-process.d.ts","sourceRoot":"","sources":["../../src/utils/child-process.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,mBAAmB,EAGxB,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAC/B,KAAK,kCAAkC,EACvC,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAQ5C,KAAK,0BAA0B,GAAG;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B,qBAAqB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IACjD,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,sBAAsB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAIF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAI9D;AAED,wBAAgB,YAAY,CAC3B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,0BAA0B,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,GAClE,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACjD,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,YAAY,GAAG,YAAY,CAAC;AAKnG,wBAAgB,gBAAgB,CAC/B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,kCAAkC,GACzC,gBAAgB,CAAC,MAAM,CAAC,CAI1B;AAQD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,GAAE,0BAA+B,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAkJzH","sourcesContent":["import {\n\ttype ChildProcess,\n\ttype ChildProcessByStdio,\n\tspawn as nodeSpawn,\n\tspawnSync as nodeSpawnSync,\n\ttype SpawnOptions,\n\ttype SpawnOptionsWithStdioTuple,\n\ttype SpawnSyncOptionsWithStringEncoding,\n\ttype SpawnSyncReturns,\n\ttype StdioNull,\n\ttype StdioPipe,\n} from \"node:child_process\";\nimport { basename } from \"node:path\";\nimport type { Readable } from \"node:stream\";\nimport crossSpawn from \"cross-spawn\";\n\nconst EXIT_STDIO_IDLE_GRACE_MS = 100;\nconst EXIT_STDIO_ACTIVE_DRAIN_HARD_CAP_MS = 5_000;\nconst WINDOWS_EXIT_POLL_INTERVAL_MS = 50;\nconst WINDOWS_EXIT_CODE_GRACE_MS = 1_000;\n\ntype WaitForChildProcessOptions = {\n\tplatform?: NodeJS.Platform;\n\tisWindowsProcessAlive?: (pid: number) => boolean;\n\twindowsExitPollIntervalMs?: number;\n\twindowsExitCodeGraceMs?: number;\n};\n\nconst WINDOWS_SHELL_COMMANDS = new Set([\"bun\", \"npm\", \"npx\", \"pnpm\", \"yarn\", \"yarnpkg\", \"corepack\"]);\n\nexport function shouldUseWindowsShell(command: string): boolean {\n\tif (process.platform !== \"win32\") return false;\n\tconst commandName = basename(command).toLowerCase();\n\treturn commandName.endsWith(\".cmd\") || commandName.endsWith(\".bat\") || WINDOWS_SHELL_COMMANDS.has(commandName);\n}\n\nexport function spawnProcess(\n\tcommand: string,\n\targs: string[],\n\toptions: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,\n): ChildProcessByStdio<null, Readable, Readable>;\nexport function spawnProcess(command: string, args: string[], options: SpawnOptions): ChildProcess;\nexport function spawnProcess(command: string, args: string[], options: SpawnOptions): ChildProcess {\n\treturn process.platform === \"win32\" ? crossSpawn(command, args, options) : nodeSpawn(command, args, options);\n}\n\nexport function spawnProcessSync(\n\tcommand: string,\n\targs: string[],\n\toptions: SpawnSyncOptionsWithStringEncoding,\n): SpawnSyncReturns<string> {\n\treturn process.platform === \"win32\"\n\t\t? crossSpawn.sync(command, args, options)\n\t\t: nodeSpawnSync(command, args, options);\n}\n\nfunction isWindowsProcessAlive(pid: number): boolean {\n\tconst result = nodeSpawnSync(\"tasklist\", [\"/FI\", `PID eq ${pid}`, \"/NH\"], { encoding: \"utf-8\", windowsHide: true });\n\tif (result.status !== 0) return true;\n\treturn new RegExp(`\\\\b${pid}\\\\b`).test(result.stdout);\n}\n\n/**\n * Wait for a child process to terminate without hanging on inherited stdio handles.\n *\n * A short-lived child can `exit` while a detached descendant keeps its stdout/stderr\n * pipe open. We must not resolve and destroy the streams on a short fixed deadline\n * measured from `exit`, or finite post-exit output still being written past that\n * deadline is silently lost (earendil-works/pi#5303). Instead, after `exit` we wait\n * for the pipes to fall idle: the grace timer is re-armed on every chunk, so finite\n * post-exit writers drain while active, while a quiet inherited handle (e.g. a\n * Windows daemonized descendant that never lets `close` fire) releases promptly\n * after the grace elapses. A longer active-drain hard cap is armed once on `exit`\n * so an endlessly noisy descendant cannot keep the wait pending forever.\n */\nexport function waitForChildProcess(child: ChildProcess, options: WaitForChildProcessOptions = {}): Promise<number | null> {\n\treturn new Promise((resolve, reject) => {\n\t\tlet settled = false;\n\t\tlet exited = false;\n\t\tlet exitCode: number | null = null;\n\t\tlet postExitIdleTimer: NodeJS.Timeout | undefined;\n\t\tlet postExitActiveDrainHardCapTimer: NodeJS.Timeout | undefined;\n\t\tlet stdoutEnded = child.stdout === null;\n\t\tlet stderrEnded = child.stderr === null;\n\t\tlet windowsExitPoll: NodeJS.Timeout | undefined;\n\t\tlet windowsExitCodeGraceTimer: NodeJS.Timeout | undefined;\n\t\tconst platform = options.platform ?? process.platform;\n\t\tconst processAlive = options.isWindowsProcessAlive ?? isWindowsProcessAlive;\n\t\tconst windowsExitPollIntervalMs = options.windowsExitPollIntervalMs ?? WINDOWS_EXIT_POLL_INTERVAL_MS;\n\t\tconst windowsExitCodeGraceMs = options.windowsExitCodeGraceMs ?? WINDOWS_EXIT_CODE_GRACE_MS;\n\n\t\tconst cleanup = () => {\n\t\t\tif (windowsExitPoll) {\n\t\t\t\tclearInterval(windowsExitPoll);\n\t\t\t\twindowsExitPoll = undefined;\n\t\t\t}\n\t\t\tif (postExitIdleTimer) {\n\t\t\t\tclearTimeout(postExitIdleTimer);\n\t\t\t\tpostExitIdleTimer = undefined;\n\t\t\t}\n\t\t\tif (postExitActiveDrainHardCapTimer) {\n\t\t\t\tclearTimeout(postExitActiveDrainHardCapTimer);\n\t\t\t\tpostExitActiveDrainHardCapTimer = undefined;\n\t\t\t}\n\t\t\tif (windowsExitCodeGraceTimer) {\n\t\t\t\tclearTimeout(windowsExitCodeGraceTimer);\n\t\t\t\twindowsExitCodeGraceTimer = undefined;\n\t\t\t}\n\t\t\tchild.removeListener(\"error\", onError);\n\t\t\tchild.removeListener(\"exit\", onExit);\n\t\t\tchild.removeListener(\"close\", onClose);\n\t\t\tchild.stdout?.removeListener(\"end\", onStdoutEnd);\n\t\t\tchild.stderr?.removeListener(\"end\", onStderrEnd);\n\t\t\tchild.stdout?.removeListener(\"data\", onData);\n\t\t\tchild.stderr?.removeListener(\"data\", onData);\n\t\t};\n\n\t\tconst finalize = (code: number | null) => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\tchild.stdout?.destroy();\n\t\t\tchild.stderr?.destroy();\n\t\t\tresolve(code);\n\t\t};\n\n\t\tconst maybeFinalizeAfterExit = () => {\n\t\t\tif (!exited || settled) return;\n\t\t\tif (stdoutEnded && stderrEnded) {\n\t\t\t\tfinalize(exitCode);\n\t\t\t}\n\t\t};\n\n\t\tconst armIdleTimer = () => {\n\t\t\tif (postExitIdleTimer) clearTimeout(postExitIdleTimer);\n\t\t\tpostExitIdleTimer = setTimeout(() => finalize(exitCode), EXIT_STDIO_IDLE_GRACE_MS);\n\t\t};\n\n\t\tconst armActiveDrainHardCapTimer = () => {\n\t\t\tif (postExitActiveDrainHardCapTimer) return;\n\t\t\tpostExitActiveDrainHardCapTimer = setTimeout(\n\t\t\t\t() => finalize(exitCode),\n\t\t\t\tEXIT_STDIO_ACTIVE_DRAIN_HARD_CAP_MS,\n\t\t\t);\n\t\t};\n\n\t\tconst onData = () => {\n\t\t\t// Output is still arriving after exit; keep extending the idle grace\n\t\t\t// so active finite writers can drain without truncating the tail.\n\t\t\tif (exited && !settled) armIdleTimer();\n\t\t};\n\n\t\tconst onStdoutEnd = () => {\n\t\t\tstdoutEnded = true;\n\t\t\tmaybeFinalizeAfterExit();\n\t\t};\n\n\t\tconst onStderrEnd = () => {\n\t\t\tstderrEnded = true;\n\t\t\tmaybeFinalizeAfterExit();\n\t\t};\n\n\t\tconst onError = (err: Error) => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\treject(err);\n\t\t};\n\n\t\tconst onExit = (code: number | null) => {\n\t\t\tif (windowsExitCodeGraceTimer) {\n\t\t\t\tclearTimeout(windowsExitCodeGraceTimer);\n\t\t\t\twindowsExitCodeGraceTimer = undefined;\n\t\t\t}\n\t\t\texited = true;\n\t\t\texitCode = code;\n\t\t\tmaybeFinalizeAfterExit();\n\t\t\tif (!settled) {\n\t\t\t\tarmActiveDrainHardCapTimer();\n\t\t\t\tarmIdleTimer();\n\t\t\t}\n\t\t};\n\n\t\tconst armWindowsExitCodeGraceTimer = () => {\n\t\t\tif (windowsExitCodeGraceTimer) return;\n\t\t\tif (windowsExitPoll) {\n\t\t\t\tclearInterval(windowsExitPoll);\n\t\t\t\twindowsExitPoll = undefined;\n\t\t\t}\n\t\t\twindowsExitCodeGraceTimer = setTimeout(() => {\n\t\t\t\twindowsExitCodeGraceTimer = undefined;\n\t\t\t\tonExit(child.exitCode ?? 0);\n\t\t\t}, windowsExitCodeGraceMs);\n\t\t};\n\n\t\tconst pollWindowsExit = () => {\n\t\t\tif (platform !== \"win32\" || !child.pid || exited || settled) return;\n\t\t\tif (!processAlive(child.pid)) {\n\t\t\t\tif (child.exitCode !== null) {\n\t\t\t\t\tonExit(child.exitCode);\n\t\t\t\t} else {\n\t\t\t\t\tarmWindowsExitCodeGraceTimer();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tconst onClose = (code: number | null) => {\n\t\t\tfinalize(code);\n\t\t};\n\n\t\tif (platform === \"win32\" && child.pid) {\n\t\t\twindowsExitPoll = setInterval(pollWindowsExit, windowsExitPollIntervalMs);\n\t\t}\n\t\tchild.stdout?.once(\"end\", onStdoutEnd);\n\t\tchild.stderr?.once(\"end\", onStderrEnd);\n\t\tchild.stdout?.on(\"data\", onData);\n\t\tchild.stderr?.on(\"data\", onData);\n\t\tchild.once(\"error\", onError);\n\t\tchild.once(\"exit\", onExit);\n\t\tchild.once(\"close\", onClose);\n\t});\n}\n"]}
@@ -3,6 +3,8 @@ import { basename } from "node:path";
3
3
  import crossSpawn from "cross-spawn";
4
4
  const EXIT_STDIO_IDLE_GRACE_MS = 100;
5
5
  const EXIT_STDIO_ACTIVE_DRAIN_HARD_CAP_MS = 5_000;
6
+ const WINDOWS_EXIT_POLL_INTERVAL_MS = 50;
7
+ const WINDOWS_EXIT_CODE_GRACE_MS = 1_000;
6
8
  const WINDOWS_SHELL_COMMANDS = new Set(["bun", "npm", "npx", "pnpm", "yarn", "yarnpkg", "corepack"]);
7
9
  export function shouldUseWindowsShell(command) {
8
10
  if (process.platform !== "win32")
@@ -37,7 +39,7 @@ function isWindowsProcessAlive(pid) {
37
39
  * after the grace elapses. A longer active-drain hard cap is armed once on `exit`
38
40
  * so an endlessly noisy descendant cannot keep the wait pending forever.
39
41
  */
40
- export function waitForChildProcess(child) {
42
+ export function waitForChildProcess(child, options = {}) {
41
43
  return new Promise((resolve, reject) => {
42
44
  let settled = false;
43
45
  let exited = false;
@@ -47,6 +49,11 @@ export function waitForChildProcess(child) {
47
49
  let stdoutEnded = child.stdout === null;
48
50
  let stderrEnded = child.stderr === null;
49
51
  let windowsExitPoll;
52
+ let windowsExitCodeGraceTimer;
53
+ const platform = options.platform ?? process.platform;
54
+ const processAlive = options.isWindowsProcessAlive ?? isWindowsProcessAlive;
55
+ const windowsExitPollIntervalMs = options.windowsExitPollIntervalMs ?? WINDOWS_EXIT_POLL_INTERVAL_MS;
56
+ const windowsExitCodeGraceMs = options.windowsExitCodeGraceMs ?? WINDOWS_EXIT_CODE_GRACE_MS;
50
57
  const cleanup = () => {
51
58
  if (windowsExitPoll) {
52
59
  clearInterval(windowsExitPoll);
@@ -60,6 +67,10 @@ export function waitForChildProcess(child) {
60
67
  clearTimeout(postExitActiveDrainHardCapTimer);
61
68
  postExitActiveDrainHardCapTimer = undefined;
62
69
  }
70
+ if (windowsExitCodeGraceTimer) {
71
+ clearTimeout(windowsExitCodeGraceTimer);
72
+ windowsExitCodeGraceTimer = undefined;
73
+ }
63
74
  child.removeListener("error", onError);
64
75
  child.removeListener("exit", onExit);
65
76
  child.removeListener("close", onClose);
@@ -116,6 +127,10 @@ export function waitForChildProcess(child) {
116
127
  reject(err);
117
128
  };
118
129
  const onExit = (code) => {
130
+ if (windowsExitCodeGraceTimer) {
131
+ clearTimeout(windowsExitCodeGraceTimer);
132
+ windowsExitCodeGraceTimer = undefined;
133
+ }
119
134
  exited = true;
120
135
  exitCode = code;
121
136
  maybeFinalizeAfterExit();
@@ -124,18 +139,36 @@ export function waitForChildProcess(child) {
124
139
  armIdleTimer();
125
140
  }
126
141
  };
127
- const pollWindowsExit = () => {
128
- if (process.platform !== "win32" || !child.pid || exited || settled)
142
+ const armWindowsExitCodeGraceTimer = () => {
143
+ if (windowsExitCodeGraceTimer)
129
144
  return;
130
- if (!isWindowsProcessAlive(child.pid)) {
145
+ if (windowsExitPoll) {
146
+ clearInterval(windowsExitPoll);
147
+ windowsExitPoll = undefined;
148
+ }
149
+ windowsExitCodeGraceTimer = setTimeout(() => {
150
+ windowsExitCodeGraceTimer = undefined;
131
151
  onExit(child.exitCode ?? 0);
152
+ }, windowsExitCodeGraceMs);
153
+ };
154
+ const pollWindowsExit = () => {
155
+ if (platform !== "win32" || !child.pid || exited || settled)
156
+ return;
157
+ if (!processAlive(child.pid)) {
158
+ if (child.exitCode !== null) {
159
+ onExit(child.exitCode);
160
+ }
161
+ else {
162
+ armWindowsExitCodeGraceTimer();
163
+ }
132
164
  }
133
165
  };
134
166
  const onClose = (code) => {
135
167
  finalize(code);
136
168
  };
137
- if (process.platform === "win32" && child.pid)
138
- windowsExitPoll = setInterval(pollWindowsExit, 50);
169
+ if (platform === "win32" && child.pid) {
170
+ windowsExitPoll = setInterval(pollWindowsExit, windowsExitPollIntervalMs);
171
+ }
139
172
  child.stdout?.once("end", onStdoutEnd);
140
173
  child.stderr?.once("end", onStderrEnd);
141
174
  child.stdout?.on("data", onData);
@@ -1 +1 @@
1
- {"version":3,"file":"child-process.js","sourceRoot":"","sources":["../../src/utils/child-process.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,IAAI,SAAS,EAClB,SAAS,IAAI,aAAa,GAO1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,UAAU,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IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,IAAI,KAAK,CAAC,GAAG;YAAE,eAAe,GAAG,WAAW,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;QAClG,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QACvC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QACvC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC7B,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {\n\ttype ChildProcess,\n\ttype ChildProcessByStdio,\n\tspawn as nodeSpawn,\n\tspawnSync as nodeSpawnSync,\n\ttype SpawnOptions,\n\ttype SpawnOptionsWithStdioTuple,\n\ttype SpawnSyncOptionsWithStringEncoding,\n\ttype SpawnSyncReturns,\n\ttype StdioNull,\n\ttype StdioPipe,\n} from \"node:child_process\";\nimport { basename } from \"node:path\";\nimport type { Readable } from \"node:stream\";\nimport crossSpawn from \"cross-spawn\";\n\nconst EXIT_STDIO_IDLE_GRACE_MS = 100;\nconst EXIT_STDIO_ACTIVE_DRAIN_HARD_CAP_MS = 5_000;\nconst WINDOWS_SHELL_COMMANDS = new Set([\"bun\", \"npm\", \"npx\", \"pnpm\", \"yarn\", \"yarnpkg\", \"corepack\"]);\n\nexport function shouldUseWindowsShell(command: string): boolean {\n\tif (process.platform !== \"win32\") return false;\n\tconst commandName = basename(command).toLowerCase();\n\treturn commandName.endsWith(\".cmd\") || commandName.endsWith(\".bat\") || WINDOWS_SHELL_COMMANDS.has(commandName);\n}\n\nexport function spawnProcess(\n\tcommand: string,\n\targs: string[],\n\toptions: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,\n): ChildProcessByStdio<null, Readable, Readable>;\nexport function spawnProcess(command: string, args: string[], options: SpawnOptions): ChildProcess;\nexport function spawnProcess(command: string, args: string[], options: SpawnOptions): ChildProcess {\n\treturn process.platform === \"win32\" ? crossSpawn(command, args, options) : nodeSpawn(command, args, options);\n}\n\nexport function spawnProcessSync(\n\tcommand: string,\n\targs: string[],\n\toptions: SpawnSyncOptionsWithStringEncoding,\n): SpawnSyncReturns<string> {\n\treturn process.platform === \"win32\"\n\t\t? crossSpawn.sync(command, args, options)\n\t\t: nodeSpawnSync(command, args, options);\n}\n\nfunction isWindowsProcessAlive(pid: number): boolean {\n\tconst result = nodeSpawnSync(\"tasklist\", [\"/FI\", `PID eq ${pid}`, \"/NH\"], { encoding: \"utf-8\", windowsHide: true });\n\tif (result.status !== 0) return true;\n\treturn new RegExp(`\\\\b${pid}\\\\b`).test(result.stdout);\n}\n\n/**\n * Wait for a child process to terminate without hanging on inherited stdio handles.\n *\n * A short-lived child can `exit` while a detached descendant keeps its stdout/stderr\n * pipe open. We must not resolve and destroy the streams on a short fixed deadline\n * measured from `exit`, or finite post-exit output still being written past that\n * deadline is silently lost (earendil-works/pi#5303). Instead, after `exit` we wait\n * for the pipes to fall idle: the grace timer is re-armed on every chunk, so finite\n * post-exit writers drain while active, while a quiet inherited handle (e.g. a\n * Windows daemonized descendant that never lets `close` fire) releases promptly\n * after the grace elapses. A longer active-drain hard cap is armed once on `exit`\n * so an endlessly noisy descendant cannot keep the wait pending forever.\n */\nexport function waitForChildProcess(child: ChildProcess): Promise<number | null> {\n\treturn new Promise((resolve, reject) => {\n\t\tlet settled = false;\n\t\tlet exited = false;\n\t\tlet exitCode: number | null = null;\n\t\tlet postExitIdleTimer: NodeJS.Timeout | undefined;\n\t\tlet postExitActiveDrainHardCapTimer: NodeJS.Timeout | undefined;\n\t\tlet stdoutEnded = child.stdout === null;\n\t\tlet stderrEnded = child.stderr === null;\n\t\tlet windowsExitPoll: NodeJS.Timeout | undefined;\n\n\t\tconst cleanup = () => {\n\t\t\tif (windowsExitPoll) {\n\t\t\t\tclearInterval(windowsExitPoll);\n\t\t\t\twindowsExitPoll = undefined;\n\t\t\t}\n\t\t\tif (postExitIdleTimer) {\n\t\t\t\tclearTimeout(postExitIdleTimer);\n\t\t\t\tpostExitIdleTimer = undefined;\n\t\t\t}\n\t\t\tif (postExitActiveDrainHardCapTimer) {\n\t\t\t\tclearTimeout(postExitActiveDrainHardCapTimer);\n\t\t\t\tpostExitActiveDrainHardCapTimer = undefined;\n\t\t\t}\n\t\t\tchild.removeListener(\"error\", onError);\n\t\t\tchild.removeListener(\"exit\", onExit);\n\t\t\tchild.removeListener(\"close\", onClose);\n\t\t\tchild.stdout?.removeListener(\"end\", onStdoutEnd);\n\t\t\tchild.stderr?.removeListener(\"end\", onStderrEnd);\n\t\t\tchild.stdout?.removeListener(\"data\", onData);\n\t\t\tchild.stderr?.removeListener(\"data\", onData);\n\t\t};\n\n\t\tconst finalize = (code: number | null) => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\tchild.stdout?.destroy();\n\t\t\tchild.stderr?.destroy();\n\t\t\tresolve(code);\n\t\t};\n\n\t\tconst maybeFinalizeAfterExit = () => {\n\t\t\tif (!exited || settled) return;\n\t\t\tif (stdoutEnded && stderrEnded) {\n\t\t\t\tfinalize(exitCode);\n\t\t\t}\n\t\t};\n\n\t\tconst armIdleTimer = () => {\n\t\t\tif (postExitIdleTimer) clearTimeout(postExitIdleTimer);\n\t\t\tpostExitIdleTimer = setTimeout(() => finalize(exitCode), EXIT_STDIO_IDLE_GRACE_MS);\n\t\t};\n\n\t\tconst armActiveDrainHardCapTimer = () => {\n\t\t\tif (postExitActiveDrainHardCapTimer) return;\n\t\t\tpostExitActiveDrainHardCapTimer = setTimeout(\n\t\t\t\t() => finalize(exitCode),\n\t\t\t\tEXIT_STDIO_ACTIVE_DRAIN_HARD_CAP_MS,\n\t\t\t);\n\t\t};\n\n\t\tconst onData = () => {\n\t\t\t// Output is still arriving after exit; keep extending the idle grace\n\t\t\t// so active finite writers can drain without truncating the tail.\n\t\t\tif (exited && !settled) armIdleTimer();\n\t\t};\n\n\t\tconst onStdoutEnd = () => {\n\t\t\tstdoutEnded = true;\n\t\t\tmaybeFinalizeAfterExit();\n\t\t};\n\n\t\tconst onStderrEnd = () => {\n\t\t\tstderrEnded = true;\n\t\t\tmaybeFinalizeAfterExit();\n\t\t};\n\n\t\tconst onError = (err: Error) => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\treject(err);\n\t\t};\n\n\t\tconst onExit = (code: number | null) => {\n\t\t\texited = true;\n\t\t\texitCode = code;\n\t\t\tmaybeFinalizeAfterExit();\n\t\t\tif (!settled) {\n\t\t\t\tarmActiveDrainHardCapTimer();\n\t\t\t\tarmIdleTimer();\n\t\t\t}\n\t\t};\n\n\t\tconst pollWindowsExit = () => {\n\t\t\tif (process.platform !== \"win32\" || !child.pid || exited || settled) return;\n\t\t\tif (!isWindowsProcessAlive(child.pid)) {\n\t\t\t\tonExit(child.exitCode ?? 0);\n\t\t\t}\n\t\t};\n\n\t\tconst onClose = (code: number | null) => {\n\t\t\tfinalize(code);\n\t\t};\n\n\t\tif (process.platform === \"win32\" && child.pid) windowsExitPoll = setInterval(pollWindowsExit, 50);\n\t\tchild.stdout?.once(\"end\", onStdoutEnd);\n\t\tchild.stderr?.once(\"end\", onStderrEnd);\n\t\tchild.stdout?.on(\"data\", onData);\n\t\tchild.stderr?.on(\"data\", onData);\n\t\tchild.once(\"error\", onError);\n\t\tchild.once(\"exit\", onExit);\n\t\tchild.once(\"close\", onClose);\n\t});\n}\n"]}
1
+ {"version":3,"file":"child-process.js","sourceRoot":"","sources":["../../src/ut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AAE,EAAE;YACvC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC,CAAC;QAEF,IAAI,QAAQ,KAAK,OAAO,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC;YACvC,eAAe,GAAG,WAAW,CAAC,eAAe,EAAE,yBAAyB,CAAC,CAAC;QAC3E,CAAC;QACD,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QACvC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QACvC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC7B,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {\n\ttype ChildProcess,\n\ttype ChildProcessByStdio,\n\tspawn as nodeSpawn,\n\tspawnSync as nodeSpawnSync,\n\ttype SpawnOptions,\n\ttype SpawnOptionsWithStdioTuple,\n\ttype SpawnSyncOptionsWithStringEncoding,\n\ttype SpawnSyncReturns,\n\ttype StdioNull,\n\ttype StdioPipe,\n} from \"node:child_process\";\nimport { basename } from \"node:path\";\nimport type { Readable } from \"node:stream\";\nimport crossSpawn from \"cross-spawn\";\n\nconst EXIT_STDIO_IDLE_GRACE_MS = 100;\nconst EXIT_STDIO_ACTIVE_DRAIN_HARD_CAP_MS = 5_000;\nconst WINDOWS_EXIT_POLL_INTERVAL_MS = 50;\nconst WINDOWS_EXIT_CODE_GRACE_MS = 1_000;\n\ntype WaitForChildProcessOptions = {\n\tplatform?: NodeJS.Platform;\n\tisWindowsProcessAlive?: (pid: number) => boolean;\n\twindowsExitPollIntervalMs?: number;\n\twindowsExitCodeGraceMs?: number;\n};\n\nconst WINDOWS_SHELL_COMMANDS = new Set([\"bun\", \"npm\", \"npx\", \"pnpm\", \"yarn\", \"yarnpkg\", \"corepack\"]);\n\nexport function shouldUseWindowsShell(command: string): boolean {\n\tif (process.platform !== \"win32\") return false;\n\tconst commandName = basename(command).toLowerCase();\n\treturn commandName.endsWith(\".cmd\") || commandName.endsWith(\".bat\") || WINDOWS_SHELL_COMMANDS.has(commandName);\n}\n\nexport function spawnProcess(\n\tcommand: string,\n\targs: string[],\n\toptions: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,\n): ChildProcessByStdio<null, Readable, Readable>;\nexport function spawnProcess(command: string, args: string[], options: SpawnOptions): ChildProcess;\nexport function spawnProcess(command: string, args: string[], options: SpawnOptions): ChildProcess {\n\treturn process.platform === \"win32\" ? crossSpawn(command, args, options) : nodeSpawn(command, args, options);\n}\n\nexport function spawnProcessSync(\n\tcommand: string,\n\targs: string[],\n\toptions: SpawnSyncOptionsWithStringEncoding,\n): SpawnSyncReturns<string> {\n\treturn process.platform === \"win32\"\n\t\t? crossSpawn.sync(command, args, options)\n\t\t: nodeSpawnSync(command, args, options);\n}\n\nfunction isWindowsProcessAlive(pid: number): boolean {\n\tconst result = nodeSpawnSync(\"tasklist\", [\"/FI\", `PID eq ${pid}`, \"/NH\"], { encoding: \"utf-8\", windowsHide: true });\n\tif (result.status !== 0) return true;\n\treturn new RegExp(`\\\\b${pid}\\\\b`).test(result.stdout);\n}\n\n/**\n * Wait for a child process to terminate without hanging on inherited stdio handles.\n *\n * A short-lived child can `exit` while a detached descendant keeps its stdout/stderr\n * pipe open. We must not resolve and destroy the streams on a short fixed deadline\n * measured from `exit`, or finite post-exit output still being written past that\n * deadline is silently lost (earendil-works/pi#5303). Instead, after `exit` we wait\n * for the pipes to fall idle: the grace timer is re-armed on every chunk, so finite\n * post-exit writers drain while active, while a quiet inherited handle (e.g. a\n * Windows daemonized descendant that never lets `close` fire) releases promptly\n * after the grace elapses. A longer active-drain hard cap is armed once on `exit`\n * so an endlessly noisy descendant cannot keep the wait pending forever.\n */\nexport function waitForChildProcess(child: ChildProcess, options: WaitForChildProcessOptions = {}): Promise<number | null> {\n\treturn new Promise((resolve, reject) => {\n\t\tlet settled = false;\n\t\tlet exited = false;\n\t\tlet exitCode: number | null = null;\n\t\tlet postExitIdleTimer: NodeJS.Timeout | undefined;\n\t\tlet postExitActiveDrainHardCapTimer: NodeJS.Timeout | undefined;\n\t\tlet stdoutEnded = child.stdout === null;\n\t\tlet stderrEnded = child.stderr === null;\n\t\tlet windowsExitPoll: NodeJS.Timeout | undefined;\n\t\tlet windowsExitCodeGraceTimer: NodeJS.Timeout | undefined;\n\t\tconst platform = options.platform ?? process.platform;\n\t\tconst processAlive = options.isWindowsProcessAlive ?? isWindowsProcessAlive;\n\t\tconst windowsExitPollIntervalMs = options.windowsExitPollIntervalMs ?? WINDOWS_EXIT_POLL_INTERVAL_MS;\n\t\tconst windowsExitCodeGraceMs = options.windowsExitCodeGraceMs ?? WINDOWS_EXIT_CODE_GRACE_MS;\n\n\t\tconst cleanup = () => {\n\t\t\tif (windowsExitPoll) {\n\t\t\t\tclearInterval(windowsExitPoll);\n\t\t\t\twindowsExitPoll = undefined;\n\t\t\t}\n\t\t\tif (postExitIdleTimer) {\n\t\t\t\tclearTimeout(postExitIdleTimer);\n\t\t\t\tpostExitIdleTimer = undefined;\n\t\t\t}\n\t\t\tif (postExitActiveDrainHardCapTimer) {\n\t\t\t\tclearTimeout(postExitActiveDrainHardCapTimer);\n\t\t\t\tpostExitActiveDrainHardCapTimer = undefined;\n\t\t\t}\n\t\t\tif (windowsExitCodeGraceTimer) {\n\t\t\t\tclearTimeout(windowsExitCodeGraceTimer);\n\t\t\t\twindowsExitCodeGraceTimer = undefined;\n\t\t\t}\n\t\t\tchild.removeListener(\"error\", onError);\n\t\t\tchild.removeListener(\"exit\", onExit);\n\t\t\tchild.removeListener(\"close\", onClose);\n\t\t\tchild.stdout?.removeListener(\"end\", onStdoutEnd);\n\t\t\tchild.stderr?.removeListener(\"end\", onStderrEnd);\n\t\t\tchild.stdout?.removeListener(\"data\", onData);\n\t\t\tchild.stderr?.removeListener(\"data\", onData);\n\t\t};\n\n\t\tconst finalize = (code: number | null) => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\tchild.stdout?.destroy();\n\t\t\tchild.stderr?.destroy();\n\t\t\tresolve(code);\n\t\t};\n\n\t\tconst maybeFinalizeAfterExit = () => {\n\t\t\tif (!exited || settled) return;\n\t\t\tif (stdoutEnded && stderrEnded) {\n\t\t\t\tfinalize(exitCode);\n\t\t\t}\n\t\t};\n\n\t\tconst armIdleTimer = () => {\n\t\t\tif (postExitIdleTimer) clearTimeout(postExitIdleTimer);\n\t\t\tpostExitIdleTimer = setTimeout(() => finalize(exitCode), EXIT_STDIO_IDLE_GRACE_MS);\n\t\t};\n\n\t\tconst armActiveDrainHardCapTimer = () => {\n\t\t\tif (postExitActiveDrainHardCapTimer) return;\n\t\t\tpostExitActiveDrainHardCapTimer = setTimeout(\n\t\t\t\t() => finalize(exitCode),\n\t\t\t\tEXIT_STDIO_ACTIVE_DRAIN_HARD_CAP_MS,\n\t\t\t);\n\t\t};\n\n\t\tconst onData = () => {\n\t\t\t// Output is still arriving after exit; keep extending the idle grace\n\t\t\t// so active finite writers can drain without truncating the tail.\n\t\t\tif (exited && !settled) armIdleTimer();\n\t\t};\n\n\t\tconst onStdoutEnd = () => {\n\t\t\tstdoutEnded = true;\n\t\t\tmaybeFinalizeAfterExit();\n\t\t};\n\n\t\tconst onStderrEnd = () => {\n\t\t\tstderrEnded = true;\n\t\t\tmaybeFinalizeAfterExit();\n\t\t};\n\n\t\tconst onError = (err: Error) => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\treject(err);\n\t\t};\n\n\t\tconst onExit = (code: number | null) => {\n\t\t\tif (windowsExitCodeGraceTimer) {\n\t\t\t\tclearTimeout(windowsExitCodeGraceTimer);\n\t\t\t\twindowsExitCodeGraceTimer = undefined;\n\t\t\t}\n\t\t\texited = true;\n\t\t\texitCode = code;\n\t\t\tmaybeFinalizeAfterExit();\n\t\t\tif (!settled) {\n\t\t\t\tarmActiveDrainHardCapTimer();\n\t\t\t\tarmIdleTimer();\n\t\t\t}\n\t\t};\n\n\t\tconst armWindowsExitCodeGraceTimer = () => {\n\t\t\tif (windowsExitCodeGraceTimer) return;\n\t\t\tif (windowsExitPoll) {\n\t\t\t\tclearInterval(windowsExitPoll);\n\t\t\t\twindowsExitPoll = undefined;\n\t\t\t}\n\t\t\twindowsExitCodeGraceTimer = setTimeout(() => {\n\t\t\t\twindowsExitCodeGraceTimer = undefined;\n\t\t\t\tonExit(child.exitCode ?? 0);\n\t\t\t}, windowsExitCodeGraceMs);\n\t\t};\n\n\t\tconst pollWindowsExit = () => {\n\t\t\tif (platform !== \"win32\" || !child.pid || exited || settled) return;\n\t\t\tif (!processAlive(child.pid)) {\n\t\t\t\tif (child.exitCode !== null) {\n\t\t\t\t\tonExit(child.exitCode);\n\t\t\t\t} else {\n\t\t\t\t\tarmWindowsExitCodeGraceTimer();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tconst onClose = (code: number | null) => {\n\t\t\tfinalize(code);\n\t\t};\n\n\t\tif (platform === \"win32\" && child.pid) {\n\t\t\twindowsExitPoll = setInterval(pollWindowsExit, windowsExitPollIntervalMs);\n\t\t}\n\t\tchild.stdout?.once(\"end\", onStdoutEnd);\n\t\tchild.stderr?.once(\"end\", onStderrEnd);\n\t\tchild.stdout?.on(\"data\", onData);\n\t\tchild.stderr?.on(\"data\", onData);\n\t\tchild.once(\"error\", onError);\n\t\tchild.once(\"exit\", onExit);\n\t\tchild.once(\"close\", onClose);\n\t});\n}\n"]}