zidane-gui 9.1.4 → 9.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/main/index.js +525 -142
- package/out/preload/index.mjs +28 -9
- package/out/renderer/assets/{43YPWK3Q-BLwohgFu.js → 43YPWK3Q-BVJpf1u1.js} +6 -6
- package/out/renderer/assets/{45MVAN6X-DCPmrh2y.js → 45MVAN6X-BWuIeWOc.js} +5 -5
- package/out/renderer/assets/{46GJKBLZ-n_NiMQEY.js → 46GJKBLZ-41BAHmt4.js} +10 -10
- package/out/renderer/assets/{63WH7YNF-B0-gnOSz.js → 63WH7YNF-DuatnhlB.js} +8 -8
- package/out/renderer/assets/{6DDU7VKX-BKAF5gyQ.js → 6DDU7VKX-BAI-vKC1.js} +6 -6
- package/out/renderer/assets/{CLQLV5VT-BIZsXon4.js → CLQLV5VT-CmHu2HE3.js} +6 -6
- package/out/renderer/assets/{CUSPXG5M-Donlp74Y.js → CUSPXG5M-DE3uzfbs.js} +6 -6
- package/out/renderer/assets/{CodeEditor-80QT2Pyq.js → CodeEditor-CIwCP1F_.js} +3 -3
- package/out/renderer/assets/{ComposerEditor-CXpNHoo1.js → ComposerEditor-leA8S_Yk.js} +2 -2
- package/out/renderer/assets/{D3L7O4X2-BCbmkNpB.js → D3L7O4X2-BZ4caDcX.js} +4 -4
- package/out/renderer/assets/{D5TW5CPZ-Bp-wetYa.js → D5TW5CPZ-BXdKc68h.js} +1 -1
- package/out/renderer/assets/{DiffsTab-Dy8a_hwG.js → DiffsTab-CyRIVfQk.js} +5 -5
- package/out/renderer/assets/{EGADTWYV-CqSrkc7g.js → EGADTWYV-Bf6Kicdv.js} +5 -5
- package/out/renderer/assets/{EOJSJZXM-BTI84tys.js → EOJSJZXM-NAa-K4U0.js} +8 -8
- package/out/renderer/assets/{EditorWorkers-Durn1REy.js → EditorWorkers-CY0St-9O.js} +4 -4
- package/out/renderer/assets/{FilesTab-h32FFVsw.js → FilesTab-CnRw0KCN.js} +111 -17
- package/out/renderer/assets/{G2OEIG6X-CS8YUqSL.js → G2OEIG6X-BarwxCkp.js} +5 -5
- package/out/renderer/assets/{GXJ2T77W-BHaQFzB4.js → GXJ2T77W-CyQVHlsG.js} +6 -6
- package/out/renderer/assets/{HX3UMAK7-DOOY2pSg.js → HX3UMAK7-BcoG4mYG.js} +5 -5
- package/out/renderer/assets/{IU7WZTP6-D7pwhQLH.js → IU7WZTP6-kOLrUSwF.js} +1 -1
- package/out/renderer/assets/{J5J2NR2G-SPjkbJgo.js → J5J2NR2G-DE-SGCIz.js} +4 -4
- package/out/renderer/assets/{JRCWTJEL-DT7JLR7k.js → JRCWTJEL-DZY5HKk0.js} +3 -3
- package/out/renderer/assets/{KHUP5TOH-BX0A2YHC.js → KHUP5TOH-DevvG2jY.js} +1 -1
- package/out/renderer/assets/{L74FQTH5-MbDLfIZo.js → L74FQTH5-CnOj-zIY.js} +4 -4
- package/out/renderer/assets/{LAV4ZXOS-ClHlsIHg.js → LAV4ZXOS-BATWssHi.js} +6 -6
- package/out/renderer/assets/{LBIZYCRR-DmofT7Vk.js → LBIZYCRR-BXTsyX1O.js} +7 -7
- package/out/renderer/assets/{LFFXNLRS-yLLLefJM.js → LFFXNLRS-BpnXEoXM.js} +3 -3
- package/out/renderer/assets/{LLLWOAQD-DNhT1-qV.js → LLLWOAQD-BjLHR3Pk.js} +1 -1
- package/out/renderer/assets/{LTYQZ5U5-BxUtiilS.js → LTYQZ5U5-CDOIyknV.js} +8 -8
- package/out/renderer/assets/{NDSCUZ25-DltJ5xGa.js → NDSCUZ25-Bl1idg0d.js} +2 -2
- package/out/renderer/assets/{NMN3IKWL-BXUYzi9o.js → NMN3IKWL-BYE2yrn3.js} +9 -9
- package/out/renderer/assets/{NMUA3R2D-CAVxt8OJ.js → NMUA3R2D-Xl410xeQ.js} +7 -7
- package/out/renderer/assets/{NY5A6PPW-B3P5KUoQ.js → NY5A6PPW-CkzCXBsB.js} +3 -3
- package/out/renderer/assets/{OHJ2EJXK-CKyEtj37.js → OHJ2EJXK-DCVoLmOH.js} +1 -1
- package/out/renderer/assets/{OU2GIT2H-i9HfUuBk.js → OU2GIT2H-DG4LbVmY.js} +4 -4
- package/out/renderer/assets/{PDMLSE6I-BnbSSXbG.js → PDMLSE6I-Cr8MjczD.js} +2 -2
- package/out/renderer/assets/{PJ7X32S5-Do_rplzd.js → PJ7X32S5-DFZu5Xsj.js} +5 -5
- package/out/renderer/assets/{RLLQ44NJ-SEvjKAya.js → RLLQ44NJ-D-LvBssh.js} +7 -7
- package/out/renderer/assets/{S6DWMCK5-CK9P5x9H.js → S6DWMCK5-BQEAXG2z.js} +8 -8
- package/out/renderer/assets/{STIOTUT7-KYZS5tvF.js → STIOTUT7-jszPNHGr.js} +6 -6
- package/out/renderer/assets/{SXSLPWUD-ylCpsia5.js → SXSLPWUD-CEMEDuKR.js} +2 -2
- package/out/renderer/assets/{TR4WJQGX-DXlqK6NQ.js → TR4WJQGX-8wGWCKKm.js} +1 -1
- package/out/renderer/assets/{UWRPUF3N-7_KSfEv0.js → UWRPUF3N-ONJaPLUk.js} +1 -1
- package/out/renderer/assets/{VSWIZJ7B-qmPn48eQ.js → VSWIZJ7B-DbkRTlJD.js} +1 -1
- package/out/renderer/assets/{WM7NR6YK-D4oWq6L3.js → WM7NR6YK-CFy2rge0.js} +4 -4
- package/out/renderer/assets/{WXKV2YEK-DsK-bqP8.js → WXKV2YEK-BFHYSpQF.js} +3 -3
- package/out/renderer/assets/{XLHPVVFU-4_9lhZe2.js → XLHPVVFU-BJFPh1Rn.js} +1 -1
- package/out/renderer/assets/{YNX532HU-C1DPijVc.js → YNX532HU-3QqofRh5.js} +5 -5
- package/out/renderer/assets/{YUPSMAUO-0pM5w-ie.js → YUPSMAUO-COLbQro8.js} +1 -1
- package/out/renderer/assets/{ZFRCZTLK-4EIJek0V.js → ZFRCZTLK-BuPbgRNC.js} +6 -6
- package/out/renderer/assets/{ZZDR4CN3-B_T2R-Zh.js → ZZDR4CN3-Do4onAxu.js} +4 -4
- package/out/renderer/assets/{core-2jWUG3m-.js → core-T80gwwf3.js} +2251 -1661
- package/out/renderer/assets/{file-tabs-DwqRIh1X.js → file-tabs-DWQZlQfx.js} +5 -5
- package/out/renderer/assets/{ghostty-web-DnI2p8KS.js → ghostty-web-DXNGAB4P.js} +1 -1
- package/out/renderer/assets/{highlights-6LT5DvBO.js → highlights-B0vcJ7-n.js} +2 -2
- package/out/renderer/assets/{highlights-DmxOEap0.js → highlights-Yvd7kpJw.js} +3 -3
- package/out/renderer/assets/{index-BnnCv70H.js → index-BbyDWT39.js} +465 -284
- package/out/renderer/assets/{index-C-Dal-Bp.css → index-CsOxRbAw.css} +186 -20
- package/out/renderer/assets/{kit-CdRTRA2T.js → kit-DgkO1_s6.js} +5641 -1986
- package/out/renderer/assets/{langs-D9nZatrh.js → langs-7bXaMxtL.js} +1 -1
- package/out/renderer/assets/{lazy-C1DShJVi.js → lazy-DE7xn_YD.js} +3 -3
- package/out/renderer/assets/{loader-BlmA-DDi.js → loader-CdKsI-e2.js} +1 -1
- package/out/renderer/assets/{pierre-theme-DpuLJ_93.js → pierre-theme-BouAfjrk.js} +7 -7
- package/out/renderer/assets/{shiki-RupN-xqP.js → shiki-CIKuDsHH.js} +3 -3
- package/out/renderer/assets/{stream-tokenizer-DLDzyMrK.js → stream-tokenizer-JLLsdqkH.js} +1 -1
- package/out/renderer/assets/{themes-B1aebwax.js → themes-mM7Qtyxf.js} +2 -2
- package/out/renderer/assets/{useDetachCleanup-BXvhEVk-.js → useDetachCleanup-1PVBQ1U4.js} +2 -2
- package/out/renderer/assets/{useFolderChanges-BHQktE6l.js → useFolderChanges-_vflCTEj.js} +144 -73
- package/out/renderer/index.html +4 -4
- package/package.json +2 -2
- package/scripts/app-installer.mjs +10 -1
package/out/main/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { readFileSync, mkdirSync, writeFileSync, renameSync, existsSync, accessSync, constants, statSync, readdirSync, rmSync, mkdtempSync, realpathSync, createReadStream } from "node:fs";
|
|
2
2
|
import { resolve, join, dirname, delimiter, basename, isAbsolute, extname, relative } from "node:path";
|
|
3
|
-
import { resolveStorageDirs, shellPath, mergePath, shellPathAsync, createWorkerRpcClient, WorkerUnavailableError, watchFileChanges, readTurnsAt, readTranscript, createMachineLinkHandlers, createMachineHandlers, IPC_BUILD_ID, IPC_PROTOCOL_VERSION, defaultSocketPath, probeSocket, ensureDaemonRunning, connectIpcClient, IpcVersionMismatchError, runWorkspaceExecStream, loadSessionDocument, IpcErrorCode, WorkerRequestError, loadEventsPage, runRemoteOAuth, extensionInstallErrorData, runBlockOnHost, createExtensionsClient, createHostImagePort, decisionsPort } from "zidane/ipc";
|
|
3
|
+
import { resolveStorageDirs, shellPath, mergePath, shellPathAsync, createWorkerRpcClient, WorkerUnavailableError, watchFileChanges, readTurnsAt, readTranscript, createMachineLinkHandlers, createMachineHandlers, IPC_BUILD_ID, IPC_PROTOCOL_VERSION, defaultSocketPath, probeSocket, ensureDaemonRunning, connectIpcClient, IpcVersionMismatchError, runWorkspaceExecStream, loadSessionDocument, IpcErrorCode, WorkerRequestError, loadEventsPage, runRemoteOAuth, extensionInstallErrorData, runBlockOnHost, createExtensionsClient, createHostImagePort, decisionsPort, mcpStatusOf } from "zidane/ipc";
|
|
4
4
|
import { homedir, tmpdir, userInfo, hostname, availableParallelism } from "node:os";
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
6
|
import { config } from "dotenv";
|
|
7
7
|
import * as electron from "electron";
|
|
8
8
|
import { shell, app, BrowserWindow, ipcMain, nativeImage, Notification, session, webContents, utilityProcess, protocol, Tray, Menu, powerMonitor, dialog, net, nativeTheme } from "electron";
|
|
9
|
-
import { createSharedWatches, migrateSessionArtifactDirs, createRingBufferSink, fanoutSink, consoleSink, createLogger, installExtensionFromSpec, ExtensionInstallError, updateInstalledExtension, removeInstalledExtension, createExtensionHostRuntimeBridge, registerExtensionApiHostModules, inlineLoadedExtension, loadableExtensionDirs, discoverAndBuildExtensionRegistry, disposeExtensionRegistry, toWireConfigSchema, defaultExtensionScanPaths, createSqliteDriver, createSqliteWriteQueue, createSqliteSessionStore, loginMcpServer, saveMcpClientSecret, resolveInlineSuggestion, createPathAutocompleteProvider, refreshArtifact as refreshArtifact$1, BUILTIN_ARTIFACT_KINDS, renderArtifactRow, sessionsBadges, isThinkingLevel, panelHostRuntime, panelSummaries, loadExtensionPanel, runExtensionPanelAction, subscribeExtensionPanel, normalizeBadgeTarget, extensionBadgeActions, runBadgeAction, createCompletionRunner, completionProviderSummaries, listExtensionPaletteItems, runExtensionPaletteItem, subscribeExtensionPalette, createExtension, listActionSummaries, probeActionStatuses, runExtensionAction, parseGithubRefKey, githubPullUrl, pullFromMeta, githubPullConfirmedAt, isPullFresh, viewForRead, queueGithubPull, pullMeta, referenceProviderWires, createReferenceResolver, GITHUB_PULL_PROVIDER_ID, GITHUB_ISSUE_PROVIDER_ID, registerSessionProcess,
|
|
9
|
+
import { createSharedWatches, migrateSessionArtifactDirs, createRingBufferSink, fanoutSink, consoleSink, createLogger, installExtensionFromSpec, ExtensionInstallError, updateInstalledExtension, removeInstalledExtension, createExtensionHostRuntimeBridge, registerExtensionApiHostModules, inlineLoadedExtension, loadableExtensionDirs, discoverAndBuildExtensionRegistry, disposeExtensionRegistry, toWireConfigSchema, defaultExtensionScanPaths, createSqliteDriver, createSqliteWriteQueue, createSqliteSessionStore, loginMcpServer, saveMcpClientSecret, resolveInlineSuggestion, createPathAutocompleteProvider, refreshArtifact as refreshArtifact$1, BUILTIN_ARTIFACT_KINDS, renderArtifactRow, sessionsBadges, isThinkingLevel, panelHostRuntime, panelSummaries, loadExtensionPanel, runExtensionPanelAction, subscribeExtensionPanel, normalizeBadgeTarget, extensionBadgeActions, runBadgeAction, createCompletionRunner, completionProviderSummaries, listExtensionPaletteItems, runExtensionPaletteItem, subscribeExtensionPalette, createExtension, listActionSummaries, probeActionStatuses, runExtensionAction, parseGithubRefKey, githubPullUrl, pullFromMeta, githubPullConfirmedAt, isPullFresh, viewForRead, queueGithubPull, pullMeta, referenceProviderWires, createReferenceResolver, GITHUB_PULL_PROVIDER_ID, GITHUB_ISSUE_PROVIDER_ID, registerSessionProcess, treeProcesses, createGpuReader, createOwnedProcesses, listSessionProcesses, listOwnedProcesses, ownCommands, readProcessTree, labelSessions, originTotals, createMainThreadMeter, createSampler, readOsThreads, configureGithubClient, createFileGithubStateStore } from "zidane";
|
|
10
10
|
import { randomUUID, createHash, randomBytes } from "node:crypto";
|
|
11
|
-
import { parseEditorCommand, keybindingsPath, stripJsonComments, normalizeBindingValue, ensureKeybindingsFile, credentialsPath, applyApiKeyEnv, BUILTIN_PROVIDERS, readCredentials, detectAuth, supportsOAuth, signsInWithIntegration, runIntegrationSignIn, runOAuthLogin, DEFAULT_OAUTH_ACCOUNT_LABEL, setProviderCredential, mcpsWritePath, upsertMcpServer, discoverProjectMcps, removeMcpServer, compactPath as compactPath$1, createExtensionMcpHost, createFileMcpCredentialStore, projectRootOf, runningEstimateViews, resolveConfig, scopeCwd, settingsFromStored, DEFAULT_SETTINGS, SETTINGS_DEFAULTS_VERSION_KEY, SETTINGS_DEFAULTS_VERSION, enforceSettingsInvariants, sparseSettingsUpdate, createMcpStatusTracker, describeForkFailure, DEFAULT_SPACE_ID, SPACE_METADATA_KEY, TITLE_SOURCE_KEY,
|
|
11
|
+
import { parseEditorCommand, keybindingsPath, stripJsonComments, normalizeBindingValue, ensureKeybindingsFile, credentialsPath, applyApiKeyEnv, BUILTIN_PROVIDERS, readCredentials, detectAuth, supportsOAuth, signsInWithIntegration, runIntegrationSignIn, runOAuthLogin, DEFAULT_OAUTH_ACCOUNT_LABEL, setProviderCredential, mcpsWritePath, upsertMcpServer, discoverProjectMcps, removeMcpServer, compactPath as compactPath$1, createExtensionMcpHost, createFileMcpCredentialStore, projectRootOf, runningEstimateViews, resolveConfig, scopeCwd, settingsFromStored, DEFAULT_SETTINGS, SETTINGS_DEFAULTS_VERSION_KEY, SETTINGS_DEFAULTS_VERSION, enforceSettingsInvariants, sparseSettingsUpdate, createMcpStatusTracker, describeForkFailure, DEFAULT_SPACE_ID, SPACE_METADATA_KEY, TITLE_SOURCE_KEY, createCapabilityProbe, createPromptSubmissions, localDayString, summarizeUsage, createChatHost, findGitRoot, fileEntriesFromPaths, WORKSPACE_MAX_ENTRIES, WORKSPACE_MAX_FILE_BYTES, gitStatusOf, assembleDiff, importEntries, hostImportItems, toolResultText, sumRunCosts, lastContextSizeFromTurns, availableAgents, liveAgentProfiles, groupArtifacts, defaultModelOf, restoreModelOptions, enabledModelOptions, modelOptionsFor, backfillAccountEmails, readProviderCredential, isSecretCustomField, removeProviderCredential, setPreferredCredential, removeStoredCredential, setCredentialLabel, providerFieldViews, configuredProviderFields, sessionEnvironmentSummary, sessionModelFallbacks, readSessionSpaceId, isMainSession, readSessionAccount, deriveSessionTitle, isStaleRunMarker, cachedRepoKeyOf, spaceIdForNewSession, newSessionModel, defaultSessionModel, defaultSessionKnobs, defaultSessionAgent, modelSupportsReasoning, deleteSessionData, writeSessionExport, hasClaudeCodeSetup, countClaudeSessionFiles, previewClaudeImport, importFromClaudeCode, runInProgress, runProgress, resolveSessionCwd, effectiveContextWindow, fmtTokens, getContextWindow, listProjectFiles, discoverProjectPlugins, applyEnvironmentSettingsChange, folderLocation, connectorGithubToken, listExtensionSource, hasUntimedOpenCalls, withRunningCallStarts, listSafelists, removeFromSafelist, buildModelCatalog, modelsForDescriptor, listDecisionModels, listImageModels, testDecisionModel, testModel, providerFactoryOptions, describeTitleStatus, overlayHostSettings, splitHostSettingsPatch, settingsToWire, storeHasDurability, onboardingInstallSignals, needsOnboarding, mergeOnboardingState, migratedOnboardingRecords, detectOnboardingEnvironment, onboardingProviders, BUILTIN_THEMES, toolCallPreview, readSessionEnvironment, assertEnvironmentReady, discoverProjectSkills, fetchAllProviderUsage, fetchProviderUsage, redeemProviderReset, fetchGithubUsage, forgetGitCaches, createGitWatches, watchGitRepository, listWorkspace, resolvePaths, readWorkspaceFile, writeWorkspaceFile, invalidateDiagnostics, listDiagnosticsTools, supersededTools, runDiagnostics, gitStatus, gitDiff, gitShowHead, searchWorkspace, gitInfo, gitOriginUrl, gitPr, gitCommit, gitBranches, gitPrList, gitSwitch, gitCreateBranch, gitSync, workspaceEntryOps, changedCatalogItems, writeCredentialEntry, readCredentialEntry, createProviderBuilder, createArtifactKindsHost, createCatalogPorts, resolveSessionModel, linkCatalogs, readKeybindingsRaw, cloneRepository, fetchRepoInfo, compareSemver, checkForUpdate, watchInstalledVersion, isAutoInstallCandidate, findInstalledCompanion, followRunningUpdate, describeUpdateLockHolder, upgradeError, startUpdateWorker, autoInstallViaWorker, serveWorkspaceMedia } from "zidane/chat";
|
|
12
12
|
import { execFile, spawn } from "node:child_process";
|
|
13
13
|
import { MEDIA_BY_EXTENSION, createPresenceMerge, createHostIndex, LOCAL_HOST_NAME, LOCAL_HOST_KEY, isMethodNotFound, HostRemovedError, sideSessionParent, orchestratedBy, BrowserOpError, normalizeBrowserUrl, isAllowedBrowserUrl, BROWSER_OUTLINE_MAX_ELEMENTS, BROWSER_TEXT_MAX_CHARS, BROWSER_EVALUATE_MAX_BYTES, BROWSER_MAX_WAIT_MS, BROWSER_ACTION_TIMEOUT_MS, BROWSER_WAIT_TIMEOUT_MS, BROWSER_OPEN_MOUNT_MS, TERMINAL_VIEW_MAX_LINES, daemonGate, remoteHostsGate, ARTIFACT_BADGES_MAX, readSessionFacets, isExtensionSpaceId, spacesEnabled, extensionSpace, usageHomeBlock, recentSessionsHomeBlock, HostRegistryError, SYNC_MODES, SYNC_CATEGORIES, isValidMachineName, toMachineName, engagedKillSwitches, isPaletteContext, BASH_CALL_ID_PREFIX, parseMachineKind, mediaTypeOfPath } from "zidane/chat/pure";
|
|
14
14
|
import { createRequire } from "node:module";
|
|
15
15
|
import { DatabaseSync } from "node:sqlite";
|
|
16
|
-
import { changeExtensionOrigin, configuredExtensions, createExtensionsConfigSync, reloadChangedExtensions, readExtensionInstallOrigin, applyExtensionsConfigReport, mergeWireSettings, runtimeSettingsWire, normalizeBadgeTarget as normalizeBadgeTarget$1, isJson, isUiHostModule, resolveUiEntries, UI_TOKEN_NAMES, MAX_LINK_URL_LENGTH, LINK_SOURCES, classifyUiImport, NoUiError, createFileStoragePort, createCredentialsAuthStore, extensionRuntimeOf, loadExtensionsConfig, createConfigSettingsLayer, builtinKeymapEntries } from "zidane/extensions";
|
|
16
|
+
import { changeExtensionOrigin, configuredExtensions, createExtensionsConfigSync, reloadChangedExtensions, readExtensionInstallOrigin, applyExtensionsConfigReport, mergeWireSettings, runtimeSettingsWire, normalizeBadgeTarget as normalizeBadgeTarget$1, isJson, isUiHostModule, resolveUiEntries, UI_TOKEN_NAMES, MAX_LINK_URL_LENGTH, LINK_SOURCES, classifyUiImport, NoUiError, createFileStoragePort, projectStorageFolder, createCredentialsAuthStore, extensionRuntimeOf, loadExtensionsConfig, createConfigSettingsLayer, builtinKeymapEntries } from "zidane/extensions";
|
|
17
17
|
import { installSkillFromSpec, SkillInstallError, browseSkillSource } from "zidane/skills";
|
|
18
18
|
import { Worker } from "node:worker_threads";
|
|
19
19
|
import { w as watchInThread, c as createExtensionDirWatcher } from "./chunks/extension-watch-Bk_X4gTf.js";
|
|
@@ -269,7 +269,7 @@ function saveKeybindings(map) {
|
|
|
269
269
|
function keybindingsFilePath() {
|
|
270
270
|
return keybindingsPath(userDataDir());
|
|
271
271
|
}
|
|
272
|
-
async function openFileInEditor(path) {
|
|
272
|
+
async function openFileInEditor(path, at) {
|
|
273
273
|
const spec = (process.env.VISUAL ?? "").trim() || (process.env.EDITOR ?? "").trim();
|
|
274
274
|
const tokens = spec ? parseEditorCommand(spec) : [];
|
|
275
275
|
if (tokens.length === 0) {
|
|
@@ -281,7 +281,34 @@ async function openFileInEditor(path) {
|
|
|
281
281
|
if (/(?:^|[/\\])(?:vi|vim|nvim|nano|pico)(?:\.exe)?$/i.test(cmd) && !args.includes("-g") || /(?:^|[/\\])emacs(?:client)?(?:\.exe)?$/i.test(cmd) && (args.includes("-nw") || args.includes("-t"))) {
|
|
282
282
|
throw new Error("Set $VISUAL to a graphical editor for the GUI, or open this artifact in the TUI.");
|
|
283
283
|
}
|
|
284
|
-
return spawnDetached(cmd, [...args, path]);
|
|
284
|
+
return spawnDetached(cmd, [...args, ...editorFileArgs(cmd, path, at)]);
|
|
285
|
+
}
|
|
286
|
+
const VSCODE_LIKE = /* @__PURE__ */ new Set(["code", "code-insiders", "codium", "vscodium", "cursor", "windsurf"]);
|
|
287
|
+
const PATH_LINE_COL = /* @__PURE__ */ new Set(["zed", "subl", "sublime_text"]);
|
|
288
|
+
const JETBRAINS = /* @__PURE__ */ new Set([
|
|
289
|
+
"idea",
|
|
290
|
+
"idea64",
|
|
291
|
+
"webstorm",
|
|
292
|
+
"pycharm",
|
|
293
|
+
"phpstorm",
|
|
294
|
+
"goland",
|
|
295
|
+
"rubymine",
|
|
296
|
+
"clion",
|
|
297
|
+
"rider",
|
|
298
|
+
"datagrip",
|
|
299
|
+
"rustrover",
|
|
300
|
+
"studio"
|
|
301
|
+
]);
|
|
302
|
+
function editorFileArgs(cmd, path, at) {
|
|
303
|
+
if (!at) return [path];
|
|
304
|
+
const name = (cmd.split(/[/\\]/).pop() ?? cmd).replace(/\.(?:exe|cmd|bat|sh)$/i, "").toLowerCase();
|
|
305
|
+
const lineCol = at.column ? `${path}:${at.line}:${at.column}` : `${path}:${at.line}`;
|
|
306
|
+
if (VSCODE_LIKE.has(name)) return ["-g", lineCol];
|
|
307
|
+
if (PATH_LINE_COL.has(name)) return [lineCol];
|
|
308
|
+
if (JETBRAINS.has(name)) {
|
|
309
|
+
return ["--line", String(at.line), ...at.column ? ["--column", String(at.column)] : [], path];
|
|
310
|
+
}
|
|
311
|
+
return [path];
|
|
285
312
|
}
|
|
286
313
|
function hasConfiguredEditor() {
|
|
287
314
|
const spec = (process.env.VISUAL ?? "").trim() || (process.env.EDITOR ?? "").trim();
|
|
@@ -341,6 +368,8 @@ let factory = null;
|
|
|
341
368
|
let main = null;
|
|
342
369
|
let pendingShow = null;
|
|
343
370
|
let mainListening = false;
|
|
371
|
+
let pendingDraft = null;
|
|
372
|
+
let draftListening = false;
|
|
344
373
|
const standalone = /* @__PURE__ */ new Map();
|
|
345
374
|
function setWindowFactory(make) {
|
|
346
375
|
factory = make;
|
|
@@ -355,13 +384,17 @@ function openMainWindow() {
|
|
|
355
384
|
const win = factory();
|
|
356
385
|
main = win;
|
|
357
386
|
mainListening = false;
|
|
387
|
+
draftListening = false;
|
|
358
388
|
win.webContents.on("did-start-navigation", (details) => {
|
|
359
|
-
if (main
|
|
389
|
+
if (main !== win || !details.isMainFrame || details.isSameDocument) return;
|
|
390
|
+
mainListening = false;
|
|
391
|
+
draftListening = false;
|
|
360
392
|
});
|
|
361
393
|
win.on("closed", () => {
|
|
362
394
|
if (main !== win) return;
|
|
363
395
|
main = null;
|
|
364
396
|
pendingShow = null;
|
|
397
|
+
pendingDraft = null;
|
|
365
398
|
});
|
|
366
399
|
return win;
|
|
367
400
|
}
|
|
@@ -456,6 +489,11 @@ function showInMain(sessionKey2) {
|
|
|
456
489
|
if (mainListening) win.webContents.send("windows:show", { sessionKey: sessionKey2 });
|
|
457
490
|
else pendingShow = sessionKey2;
|
|
458
491
|
}
|
|
492
|
+
function openNewDraft(request2) {
|
|
493
|
+
const win = openMainWindow();
|
|
494
|
+
if (draftListening) win.webContents.send("windows:newDraft", request2);
|
|
495
|
+
else pendingDraft = request2;
|
|
496
|
+
}
|
|
459
497
|
function panelsWindowFor(sessionKey2) {
|
|
460
498
|
const entry = entryFor(sessionKey2);
|
|
461
499
|
return entry && entry.parts !== "chat" ? entry.win : null;
|
|
@@ -501,6 +539,13 @@ function registerWindowIpc() {
|
|
|
501
539
|
pendingShow = null;
|
|
502
540
|
return sessionKey2;
|
|
503
541
|
});
|
|
542
|
+
ipcMain.handle("windows:takePendingDraft", (e) => {
|
|
543
|
+
if (!main || e.sender !== main.webContents) return null;
|
|
544
|
+
draftListening = true;
|
|
545
|
+
const request2 = pendingDraft;
|
|
546
|
+
pendingDraft = null;
|
|
547
|
+
return request2;
|
|
548
|
+
});
|
|
504
549
|
ipcMain.handle(
|
|
505
550
|
"windows:panelAction",
|
|
506
551
|
(e, sessionKey2, action) => typeof sessionKey2 === "string" ? relayPanelAction(e.sender, sessionKey2, action) : false
|
|
@@ -1534,10 +1579,12 @@ const SIDEBAR_COUNTS_SQL = `
|
|
|
1534
1579
|
'label', json_extract(r.data, '$.label'),
|
|
1535
1580
|
'parentCallId', json_extract(r.data, '$.parentCallId'),
|
|
1536
1581
|
'estimate', json(json_extract(r.data, '$.estimate')),
|
|
1537
|
-
'userWait', json(json_extract(r.data, '$.userWait'))
|
|
1582
|
+
'userWait', json(json_extract(r.data, '$.userWait')),
|
|
1583
|
+
'estimateFailure', json(json_extract(r.data, '$.estimateFailure'))))
|
|
1538
1584
|
FROM runs r WHERE r.session_id = s.id AND json_valid(r.data)
|
|
1539
1585
|
AND json_extract(r.data, '$.status') = 'running'
|
|
1540
|
-
AND json_extract(r.data, '$.estimate') IS NOT NULL
|
|
1586
|
+
AND (json_extract(r.data, '$.estimate') IS NOT NULL
|
|
1587
|
+
OR json_extract(r.data, '$.estimateFailure') IS NOT NULL))
|
|
1541
1588
|
END AS run_estimates
|
|
1542
1589
|
FROM sessions s WHERE s.id IN (SELECT value FROM json_each(?))`;
|
|
1543
1590
|
const sidebarCounts = /* @__PURE__ */ new Map();
|
|
@@ -2566,24 +2613,18 @@ function daemonHostClient(client2) {
|
|
|
2566
2613
|
createSession: async (params) => (await client2.request("sessions.create", params)).id
|
|
2567
2614
|
};
|
|
2568
2615
|
}
|
|
2616
|
+
const SCHEDULE_USER = { kind: "user" };
|
|
2569
2617
|
const submissions = (host2) => createPromptSubmissions(host2(), host2().transformPrompt);
|
|
2570
2618
|
const EMBEDDED = {
|
|
2571
2619
|
"chat.send": (host2, p) => submissions(host2).send(p),
|
|
2572
2620
|
"chat.interrupt": (host2, p) => host2().interrupt(p.sessionId),
|
|
2573
|
-
"chat.steer": (host2, p) => submissions(host2).steer(p.sessionId, p.message),
|
|
2574
|
-
"chat.followUp": (host2, p) => submissions(host2).followUp(p.sessionId, p.message),
|
|
2575
2621
|
"chat.pushQueued": (host2, p) => submissions(host2).pushQueued(p.sessionId, p.message, p.activatedSkills),
|
|
2576
2622
|
"chat.isRunning": (host2, p) => host2().isSessionRunning(p.sessionId),
|
|
2577
2623
|
"chat.listWork": (host2, p) => host2().listRunningWork(p.sessionId, p.children ? { children: true } : void 0),
|
|
2578
2624
|
"chat.cancelWork": (host2, p) => host2().cancelRunningWork(p.sessionId, p.id, p.reason),
|
|
2579
|
-
"
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
},
|
|
2583
|
-
"todos.set": async (host2, p) => {
|
|
2584
|
-
const state2 = await host2().setTodos(p.sessionId, p.items);
|
|
2585
|
-
return state2 ? toTodosSnapshot(state2) : null;
|
|
2586
|
-
},
|
|
2625
|
+
"plans.get": (host2, p) => host2().getPlansSnapshot(p.sessionId),
|
|
2626
|
+
"plans.edit": (host2, p) => host2().editPlan(p.sessionId, p.planId, p.op),
|
|
2627
|
+
"plans.control": (host2, p) => host2().controlPlan(p.sessionId, p.planId, p.action),
|
|
2587
2628
|
// Artifacts: the in-process host has no artifact surface; the local store is the source.
|
|
2588
2629
|
"sessions.artifacts": async (_host, p) => await getSessionStore().listArtifacts?.({ sessionId: p.sessionId }) ?? [],
|
|
2589
2630
|
"artifacts.list": async (_host, p) => await getSessionStore().listArtifacts?.({
|
|
@@ -2629,8 +2670,8 @@ const EMBEDDED = {
|
|
|
2629
2670
|
{ [SPACE_METADATA_KEY]: p.spaceId || DEFAULT_SPACE_ID },
|
|
2630
2671
|
{ bumpUpdatedAt: false }
|
|
2631
2672
|
),
|
|
2632
|
-
// The in-process host runs no terminals: nothing to end with it.
|
|
2633
|
-
"sessions.setArchived": (host2, p) => host2().
|
|
2673
|
+
// The in-process host runs no terminals: nothing to end with it. The host releases a clean worktree.
|
|
2674
|
+
"sessions.setArchived": (host2, p) => host2().setSessionArchived(p.sessionId, p.archived),
|
|
2634
2675
|
// Not activity either: a favorite keeps its place by recency.
|
|
2635
2676
|
"sessions.setFavorite": (host2, p) => host2().patchSessionMeta(p.sessionId, { favorite: p.favorite }, { bumpUpdatedAt: false }),
|
|
2636
2677
|
"sessions.setAgentId": async (host2, p) => {
|
|
@@ -2680,6 +2721,18 @@ const EMBEDDED = {
|
|
|
2680
2721
|
"queue.update": (host2, p) => host2().queueUpdate(p.sessionId, p.id, p.text, p.attachments),
|
|
2681
2722
|
"queue.attachments": (host2, p) => host2().queueAttachments(p.sessionId, p.id),
|
|
2682
2723
|
"queue.pushNow": (host2, p) => host2().queuePushNow(p.sessionId, p.id),
|
|
2724
|
+
// A session project's saved secrets: values go in, never out (names and expiry times only).
|
|
2725
|
+
"secrets.list": (host2, p) => host2().secrets.list(p.sessionId),
|
|
2726
|
+
"secrets.save": (host2, p) => host2().secrets.save(p.sessionId, { name: p.name, value: p.value, ttl: p.ttl }),
|
|
2727
|
+
"secrets.revoke": async (host2, p) => ({ removed: await host2().secrets.revoke(p.sessionId, p.name) }),
|
|
2728
|
+
// Reminders (docs/SCHEDULES.md): this window acts as the person, as a wire caller does on the daemon.
|
|
2729
|
+
"schedules.status": (host2) => ({ enabled: host2().schedules.enabled(), supported: host2().schedules.supported() }),
|
|
2730
|
+
"schedules.list": (host2, p) => host2().schedules.list(p ?? {}),
|
|
2731
|
+
"schedules.create": (host2, p) => host2().schedules.create(p, SCHEDULE_USER),
|
|
2732
|
+
"schedules.update": (host2, p) => host2().schedules.update(p.id, p.patch, SCHEDULE_USER),
|
|
2733
|
+
"schedules.delete": (host2, p) => host2().schedules.remove(p.id, SCHEDULE_USER),
|
|
2734
|
+
"schedules.runNow": (host2, p) => host2().schedules.runNow(p.id, SCHEDULE_USER),
|
|
2735
|
+
"schedules.fires": (host2, p) => host2().schedules.fires(p.id, p.limit),
|
|
2683
2736
|
// Multi-window state exists only in the daemon; in-process these answer inert defaults.
|
|
2684
2737
|
"drafts.get": () => ({ text: "" }),
|
|
2685
2738
|
"presence.list": () => [],
|
|
@@ -2788,7 +2841,7 @@ class HostOfflineError extends Error {
|
|
|
2788
2841
|
hostId;
|
|
2789
2842
|
}
|
|
2790
2843
|
const isUnsupportedMethod = isMethodNotFound;
|
|
2791
|
-
const localHost = {
|
|
2844
|
+
const localHost$1 = {
|
|
2792
2845
|
id: LOCAL_HOST_ID,
|
|
2793
2846
|
name: LOCAL_HOST_NAME,
|
|
2794
2847
|
remote: false,
|
|
@@ -2855,7 +2908,7 @@ function createHostDirectory(options = {}) {
|
|
|
2855
2908
|
const directory2 = {
|
|
2856
2909
|
hostFor: (ref) => {
|
|
2857
2910
|
const hostId2 = "key" in ref ? sessionHostId(ref.key) : ref.hostId;
|
|
2858
|
-
if (!hostId2 || hostId2 === LOCAL_HOST_ID) return localHost;
|
|
2911
|
+
if (!hostId2 || hostId2 === LOCAL_HOST_ID) return localHost$1;
|
|
2859
2912
|
const server = servers.get(hostId2);
|
|
2860
2913
|
if (server) return remoteHost(server);
|
|
2861
2914
|
throw new Error(`No host "${hostId2}".`);
|
|
@@ -5626,7 +5679,7 @@ function releaseDrafts(senderId) {
|
|
|
5626
5679
|
for (const draftId of ids) void client2.request("terminal.releaseDraft", { draftId }).catch(() => {
|
|
5627
5680
|
});
|
|
5628
5681
|
}
|
|
5629
|
-
function handle(channel2, fn) {
|
|
5682
|
+
function handle$1(channel2, fn) {
|
|
5630
5683
|
ipcMain.removeHandler(channel2);
|
|
5631
5684
|
ipcMain.handle(channel2, (event, ...args) => {
|
|
5632
5685
|
if (!fromAppWindow(event)) throw new Error(`${channel2} is only available to the app window`);
|
|
@@ -5646,7 +5699,7 @@ function registerTerminalIpc() {
|
|
|
5646
5699
|
});
|
|
5647
5700
|
app.on("browser-window-focus", () => syncViewer());
|
|
5648
5701
|
syncViewer();
|
|
5649
|
-
handle("terminal:state", async (_e, sessionId) => {
|
|
5702
|
+
handle$1("terminal:state", async (_e, sessionId) => {
|
|
5650
5703
|
const key = asSessionKey(str(sessionId, "sessionId"));
|
|
5651
5704
|
const { host: host2, sessionId: id } = sessionHost(key);
|
|
5652
5705
|
if (host2.remote) {
|
|
@@ -5665,7 +5718,7 @@ function registerTerminalIpc() {
|
|
|
5665
5718
|
}
|
|
5666
5719
|
return client2.request("terminal.state", { sessionId: id });
|
|
5667
5720
|
});
|
|
5668
|
-
handle("terminal:open", async (_e, sessionId, target, cols, rows) => {
|
|
5721
|
+
handle$1("terminal:open", async (_e, sessionId, target, cols, rows) => {
|
|
5669
5722
|
const key = asSessionKey(str(sessionId, "sessionId"));
|
|
5670
5723
|
const { client: client2, sessionId: id } = clientForSession(key);
|
|
5671
5724
|
const opened = await client2.request("terminal.open", {
|
|
@@ -5677,7 +5730,7 @@ function registerTerminalIpc() {
|
|
|
5677
5730
|
noteTerminals(key, [opened]);
|
|
5678
5731
|
return opened;
|
|
5679
5732
|
});
|
|
5680
|
-
handle("terminal:projectState", async (_e, cwd, draftId) => {
|
|
5733
|
+
handle$1("terminal:projectState", async (_e, cwd, draftId) => {
|
|
5681
5734
|
const params = { cwd: str(cwd, "cwd"), ...withDraft(optionalStr(draftId, "draftId")) };
|
|
5682
5735
|
const unavailable = (reason) => ({
|
|
5683
5736
|
available: false,
|
|
@@ -5695,7 +5748,7 @@ function registerTerminalIpc() {
|
|
|
5695
5748
|
throw err;
|
|
5696
5749
|
}
|
|
5697
5750
|
});
|
|
5698
|
-
handle("terminal:openInProject", async (event, cwd, draftId, cols, rows) => {
|
|
5751
|
+
handle$1("terminal:openInProject", async (event, cwd, draftId, cols, rows) => {
|
|
5699
5752
|
const params = {
|
|
5700
5753
|
cwd: str(cwd, "cwd"),
|
|
5701
5754
|
...withDraft(optionalStr(draftId, "draftId")),
|
|
@@ -5716,7 +5769,7 @@ function registerTerminalIpc() {
|
|
|
5716
5769
|
}
|
|
5717
5770
|
return opened;
|
|
5718
5771
|
});
|
|
5719
|
-
handle("terminal:adopt", async (event, draftId, sessionId) => {
|
|
5772
|
+
handle$1("terminal:adopt", async (event, draftId, sessionId) => {
|
|
5720
5773
|
const id = str(draftId, "draftId");
|
|
5721
5774
|
forgetDraft(event.sender.id, id);
|
|
5722
5775
|
const { host: host2, sessionId: raw } = sessionHost(asSessionKey(str(sessionId, "sessionId")));
|
|
@@ -5731,7 +5784,7 @@ function registerTerminalIpc() {
|
|
|
5731
5784
|
throw err;
|
|
5732
5785
|
}
|
|
5733
5786
|
});
|
|
5734
|
-
handle("terminal:releaseDraft", async (event, draftId) => {
|
|
5787
|
+
handle$1("terminal:releaseDraft", async (event, draftId) => {
|
|
5735
5788
|
const id = str(draftId, "draftId");
|
|
5736
5789
|
forgetDraft(event.sender.id, id);
|
|
5737
5790
|
const client2 = projectDaemon();
|
|
@@ -5742,7 +5795,7 @@ function registerTerminalIpc() {
|
|
|
5742
5795
|
if (!isUnsupportedMethod(err)) throw err;
|
|
5743
5796
|
}
|
|
5744
5797
|
});
|
|
5745
|
-
handle("terminal:attach", async (event, terminalId, clientId) => {
|
|
5798
|
+
handle$1("terminal:attach", async (event, terminalId, clientId) => {
|
|
5746
5799
|
const params = { terminalId: str(terminalId, "terminalId"), clientId: str(clientId, "clientId") };
|
|
5747
5800
|
const sender = event.sender;
|
|
5748
5801
|
const generation = watch(sender);
|
|
@@ -5758,12 +5811,12 @@ function registerTerminalIpc() {
|
|
|
5758
5811
|
}
|
|
5759
5812
|
return result;
|
|
5760
5813
|
});
|
|
5761
|
-
handle("terminal:detach", async (event, terminalId, clientId) => {
|
|
5814
|
+
handle$1("terminal:detach", async (event, terminalId, clientId) => {
|
|
5762
5815
|
const params = { terminalId: str(terminalId, "terminalId"), clientId: str(clientId, "clientId") };
|
|
5763
5816
|
untrack(event.sender.id, params.terminalId, params.clientId);
|
|
5764
5817
|
await optionalClientForTerminal(params.terminalId)?.request("terminal.detach", params);
|
|
5765
5818
|
});
|
|
5766
|
-
handle("terminal:write", (_e, terminalId, data, from) => {
|
|
5819
|
+
handle$1("terminal:write", (_e, terminalId, data, from) => {
|
|
5767
5820
|
if (typeof data !== "string") throw new Error("terminal: data must be a string");
|
|
5768
5821
|
const who = from && typeof from === "object" && typeof from.clientId === "string" ? {
|
|
5769
5822
|
clientId: from.clientId,
|
|
@@ -5772,7 +5825,7 @@ function registerTerminalIpc() {
|
|
|
5772
5825
|
const id = str(terminalId, "terminalId");
|
|
5773
5826
|
return clientForTerminal(id).request("terminal.write", { terminalId: id, data, ...who });
|
|
5774
5827
|
});
|
|
5775
|
-
handle(
|
|
5828
|
+
handle$1(
|
|
5776
5829
|
"terminal:resize",
|
|
5777
5830
|
(_e, terminalId, clientId, cols, rows, claim) => clientForTerminal(str(terminalId, "terminalId")).request("terminal.resize", {
|
|
5778
5831
|
terminalId: str(terminalId, "terminalId"),
|
|
@@ -5782,7 +5835,7 @@ function registerTerminalIpc() {
|
|
|
5782
5835
|
claim: claim === true
|
|
5783
5836
|
})
|
|
5784
5837
|
);
|
|
5785
|
-
handle(
|
|
5838
|
+
handle$1(
|
|
5786
5839
|
"terminal:ack",
|
|
5787
5840
|
(_e, terminalId, clientId, offset) => optionalClientForTerminal(str(terminalId, "terminalId"))?.request("terminal.ack", {
|
|
5788
5841
|
terminalId: str(terminalId, "terminalId"),
|
|
@@ -5790,18 +5843,18 @@ function registerTerminalIpc() {
|
|
|
5790
5843
|
offset: int(offset, "offset")
|
|
5791
5844
|
})
|
|
5792
5845
|
);
|
|
5793
|
-
handle("terminal:restart", (_e, terminalId) => {
|
|
5846
|
+
handle$1("terminal:restart", (_e, terminalId) => {
|
|
5794
5847
|
const id = str(terminalId, "terminalId");
|
|
5795
5848
|
return clientForTerminal(id).request("terminal.restart", { terminalId: id });
|
|
5796
5849
|
});
|
|
5797
|
-
handle("terminal:close", (_e, terminalId) => {
|
|
5850
|
+
handle$1("terminal:close", (_e, terminalId) => {
|
|
5798
5851
|
const id = str(terminalId, "terminalId");
|
|
5799
5852
|
return clientForTerminal(id).request("terminal.close", { terminalId: id }).then((result) => {
|
|
5800
5853
|
getHostDirectory().forgetOwner(id);
|
|
5801
5854
|
return result;
|
|
5802
5855
|
});
|
|
5803
5856
|
});
|
|
5804
|
-
handle("terminal:setHidden", (_e, terminalId, hidden) => {
|
|
5857
|
+
handle$1("terminal:setHidden", (_e, terminalId, hidden) => {
|
|
5805
5858
|
const id = str(terminalId, "terminalId");
|
|
5806
5859
|
return clientForTerminal(id).request("terminal.setHidden", { terminalId: id, hidden: hidden === true });
|
|
5807
5860
|
});
|
|
@@ -6144,6 +6197,9 @@ function routeToRenderer(signal, raw, hostId2) {
|
|
|
6144
6197
|
// consumes are forwarded. The protocol grows kinds faster than the GUI
|
|
6145
6198
|
// adopts them; a default-forward would leak every future addition into
|
|
6146
6199
|
// the renderer as an unknown payload (queue:changed already did).
|
|
6200
|
+
case "schedules:changed":
|
|
6201
|
+
if (hostId2 === LOCAL_SESSION_HOST) sendChatStream(signal);
|
|
6202
|
+
return;
|
|
6147
6203
|
case "run:end":
|
|
6148
6204
|
forgetLiveResults(signal.sessionId);
|
|
6149
6205
|
sendChatStream(signal);
|
|
@@ -6155,9 +6211,11 @@ function routeToRenderer(signal, raw, hostId2) {
|
|
|
6155
6211
|
case "compacting:end":
|
|
6156
6212
|
case "model:fallback":
|
|
6157
6213
|
case "work:snapshot":
|
|
6158
|
-
case "
|
|
6214
|
+
case "plans:snapshot":
|
|
6159
6215
|
case "artifact:recorded":
|
|
6160
6216
|
case "artifact:changed":
|
|
6217
|
+
// A project's secret store changed: the session hosts list again (no name, no value).
|
|
6218
|
+
case "secrets:changed":
|
|
6161
6219
|
/*
|
|
6162
6220
|
* Forwarded so the renderer HAS the data. The stream reducer ignores
|
|
6163
6221
|
* `cache:break` (its transcript row arrives as a persisted notice event)
|
|
@@ -6526,14 +6584,6 @@ function sendPrompt(opts) {
|
|
|
6526
6584
|
async function interruptChat(key) {
|
|
6527
6585
|
await sessionRequest("chat.interrupt", key, {});
|
|
6528
6586
|
}
|
|
6529
|
-
function steerSession(key, message2) {
|
|
6530
|
-
void sessionRequest("chat.steer", key, { message: message2 }).catch(() => {
|
|
6531
|
-
});
|
|
6532
|
-
}
|
|
6533
|
-
function followUpSession(key, message2) {
|
|
6534
|
-
void sessionRequest("chat.followUp", key, { message: message2 }).catch(() => {
|
|
6535
|
-
});
|
|
6536
|
-
}
|
|
6537
6587
|
function isRuntimeSessionRunning(key) {
|
|
6538
6588
|
return sessionRequest("chat.isRunning", key, {});
|
|
6539
6589
|
}
|
|
@@ -6597,8 +6647,8 @@ function listRunningWork(key, options) {
|
|
|
6597
6647
|
function cancelRunningWork(key, id, reason) {
|
|
6598
6648
|
return sessionRequest("chat.cancelWork", key, { id, ...reason ? { reason } : {} });
|
|
6599
6649
|
}
|
|
6600
|
-
function
|
|
6601
|
-
return sessionRequest("
|
|
6650
|
+
function getPlansSnapshot(key) {
|
|
6651
|
+
return sessionRequest("plans.get", key, {});
|
|
6602
6652
|
}
|
|
6603
6653
|
async function listArtifacts(query) {
|
|
6604
6654
|
try {
|
|
@@ -6627,9 +6677,11 @@ async function refreshSessionArtifact(key, artifact, opts, registry) {
|
|
|
6627
6677
|
return null;
|
|
6628
6678
|
}
|
|
6629
6679
|
}
|
|
6630
|
-
function
|
|
6631
|
-
|
|
6632
|
-
|
|
6680
|
+
function editSessionPlan(key, planId, op) {
|
|
6681
|
+
return sessionRequest("plans.edit", key, { planId, op });
|
|
6682
|
+
}
|
|
6683
|
+
function controlSessionPlan(key, planId, action) {
|
|
6684
|
+
return sessionRequest("plans.control", key, { planId, action });
|
|
6633
6685
|
}
|
|
6634
6686
|
function getContextBreakdown(key) {
|
|
6635
6687
|
return sessionRequest("sessions.contextBreakdown", key, {});
|
|
@@ -6897,6 +6949,7 @@ function serverSessionRow(hostId2, row, meta) {
|
|
|
6897
6949
|
...row.modelFallbacks && row.modelFallbacks.length > 0 ? { modelFallbacks: row.modelFallbacks } : {},
|
|
6898
6950
|
archived: row.archived,
|
|
6899
6951
|
...row.favorite ? { favorite: true } : {},
|
|
6952
|
+
...meta?.scheduleId ?? row.scheduleId ? { scheduleId: meta?.scheduleId ?? row.scheduleId } : {},
|
|
6900
6953
|
...row.isMain ? { isMain: true } : {},
|
|
6901
6954
|
...row.spaceId ? { spaceId: row.spaceId } : {},
|
|
6902
6955
|
...row.environment ? { environment: row.environment } : {},
|
|
@@ -7422,7 +7475,7 @@ function createArtifactFreshness(deps2) {
|
|
|
7422
7475
|
const shown2 = /* @__PURE__ */ new Map();
|
|
7423
7476
|
const checkedAt = /* @__PURE__ */ new Map();
|
|
7424
7477
|
const queue = [];
|
|
7425
|
-
const
|
|
7478
|
+
const queued2 = /* @__PURE__ */ new Set();
|
|
7426
7479
|
let running2 = null;
|
|
7427
7480
|
let timer = null;
|
|
7428
7481
|
const union = () => new Set([...shown2.values()].flatMap((keys) => [...keys]));
|
|
@@ -7444,7 +7497,7 @@ function createArtifactFreshness(deps2) {
|
|
|
7444
7497
|
running2 = (async () => {
|
|
7445
7498
|
while (queue.length > 0) {
|
|
7446
7499
|
const batch = queue.splice(0, BATCH_SESSIONS);
|
|
7447
|
-
for (const key of batch)
|
|
7500
|
+
for (const key of batch) queued2.delete(key);
|
|
7448
7501
|
const shownNow = union();
|
|
7449
7502
|
const due = batch.filter((key) => shownNow.has(key) && stale(key));
|
|
7450
7503
|
if (due.length > 0) await check(due);
|
|
@@ -7456,8 +7509,8 @@ function createArtifactFreshness(deps2) {
|
|
|
7456
7509
|
function enqueue(keys) {
|
|
7457
7510
|
if (!deps2.attended()) return;
|
|
7458
7511
|
for (const key of keys) {
|
|
7459
|
-
if (
|
|
7460
|
-
|
|
7512
|
+
if (queued2.has(key) || !stale(key)) continue;
|
|
7513
|
+
queued2.add(key);
|
|
7461
7514
|
queue.push(key);
|
|
7462
7515
|
}
|
|
7463
7516
|
drain();
|
|
@@ -7694,6 +7747,7 @@ function registerAuthChannels({ ipc }) {
|
|
|
7694
7747
|
);
|
|
7695
7748
|
ipc.handle("auth:detect", async (_e, cwd) => {
|
|
7696
7749
|
const providers = await providersFor$1(cwd);
|
|
7750
|
+
await backfillAccountEmails(userDataDir(), providers);
|
|
7697
7751
|
return detectAuth(userDataDir(), providers).map((r) => toAuthStatus(r, providers));
|
|
7698
7752
|
});
|
|
7699
7753
|
ipc.handle("auth:setApiKey", async (_e, provider, key, cwd) => {
|
|
@@ -8075,6 +8129,8 @@ function sidebarRowFromMeta(meta, settings) {
|
|
|
8075
8129
|
...modelFallbacks.length > 0 ? { modelFallbacks } : {},
|
|
8076
8130
|
archived: meta.metadata.archived === true,
|
|
8077
8131
|
...meta.metadata.favorite === true ? { favorite: true } : {},
|
|
8132
|
+
// A reminder started it (`metadata.scheduleId`): the sidebar's clock mark and Origin filter.
|
|
8133
|
+
...typeof meta.metadata.scheduleId === "string" && meta.metadata.scheduleId ? { scheduleId: meta.metadata.scheduleId } : {},
|
|
8078
8134
|
...isMainSession(meta.metadata) ? { isMain: true } : {},
|
|
8079
8135
|
...readSessionSpaceId(meta.metadata) ? { spaceId: readSessionSpaceId(meta.metadata) } : {},
|
|
8080
8136
|
...environment ? { environment } : {},
|
|
@@ -9268,6 +9324,8 @@ function registerExtensionChannels({ ipc }) {
|
|
|
9268
9324
|
});
|
|
9269
9325
|
ipc.handle("extensions:remove", async (_e, cwd, dir, name) => {
|
|
9270
9326
|
const message2 = removeExtension({ cwd, dir, name });
|
|
9327
|
+
const daemon2 = daemonReads();
|
|
9328
|
+
await (daemon2 ? daemon2.request("schedules.extensionRemoved", { extensionId: name }) : getChatHost().schedules.extensionRemoved(name)).catch(() => void 0);
|
|
9271
9329
|
invalidateExtensionsAndNotify();
|
|
9272
9330
|
invalidateConfig();
|
|
9273
9331
|
await shutdownChat();
|
|
@@ -9723,7 +9781,9 @@ function summarize(server, entry) {
|
|
|
9723
9781
|
...server.serverName ? { serverName: server.serverName } : {},
|
|
9724
9782
|
...server.serverVersion ? { serverVersion: server.serverVersion } : {},
|
|
9725
9783
|
...server.client?.hello.machineServe ? { machineServe: true } : {},
|
|
9726
|
-
|
|
9784
|
+
// An older server's `approve` scope reads as chat: it can't change the server's settings either.
|
|
9785
|
+
...server.client?.hello.scope ? { scope: server.client.hello.scope === "admin" ? "admin" : "chat" } : {},
|
|
9786
|
+
...server.client?.hello.adminCommands ? { adminCommands: server.client.hello.adminCommands } : {},
|
|
9727
9787
|
...server.client?.hello.homeDir ? { home: server.client.hello.homeDir } : {},
|
|
9728
9788
|
...entry?.addedAt ? { addedAt: entry.addedAt } : {},
|
|
9729
9789
|
...entry?.lastConnectedAt ? { lastConnectedAt: entry.lastConnectedAt } : {}
|
|
@@ -10077,6 +10137,10 @@ function registerHostChannels({ ipc }) {
|
|
|
10077
10137
|
};
|
|
10078
10138
|
}
|
|
10079
10139
|
});
|
|
10140
|
+
ipc.handle("hosts:installTool", async (_e, hostId2, name) => {
|
|
10141
|
+
if (typeof name !== "string" || !name || name.length > 64) throw new Error("A tool name is required.");
|
|
10142
|
+
return remoteOnly(hostId2).call("host.installTool", { name });
|
|
10143
|
+
});
|
|
10080
10144
|
ipc.handle(
|
|
10081
10145
|
"hosts:selfUpdate",
|
|
10082
10146
|
async (_e, hostId2, action, enabled) => {
|
|
@@ -11001,11 +11065,12 @@ function registerQueueChannels({ ipc }) {
|
|
|
11001
11065
|
ipc.handle("queue:list", (_e, sessionId) => sessionRequest("queue.list", sessionId, {}));
|
|
11002
11066
|
ipc.handle(
|
|
11003
11067
|
"queue:add",
|
|
11004
|
-
(_e, sessionId, text2, activatedSkills, attachments) => sessionRequest("queue.add", sessionId, {
|
|
11068
|
+
(_e, sessionId, text2, activatedSkills, attachments, delivery) => sessionRequest("queue.add", sessionId, {
|
|
11005
11069
|
text: text2,
|
|
11006
11070
|
requestId: randomUUID(),
|
|
11007
11071
|
...activatedSkills ? { activatedSkills } : {},
|
|
11008
|
-
...attachments ? { attachments } : {}
|
|
11072
|
+
...attachments ? { attachments } : {},
|
|
11073
|
+
...delivery ? { delivery } : {}
|
|
11009
11074
|
})
|
|
11010
11075
|
);
|
|
11011
11076
|
ipc.handle(
|
|
@@ -11025,6 +11090,32 @@ function registerQueueChannels({ ipc }) {
|
|
|
11025
11090
|
(_e, sessionId, id) => sessionRequest("queue.pushNow", sessionId, { id })
|
|
11026
11091
|
);
|
|
11027
11092
|
}
|
|
11093
|
+
function registerSecretChannels({ ipc }) {
|
|
11094
|
+
ipc.handle("secrets:list", (_e, sessionId) => sessionRequest("secrets.list", sessionId, {}));
|
|
11095
|
+
ipc.handle(
|
|
11096
|
+
"secrets:save",
|
|
11097
|
+
(_e, sessionId, input) => sessionRequest("secrets.save", sessionId, { name: input.name, value: input.value, ttl: input.ttl })
|
|
11098
|
+
);
|
|
11099
|
+
ipc.handle(
|
|
11100
|
+
"secrets:revoke",
|
|
11101
|
+
(_e, sessionId, name) => sessionRequest("secrets.revoke", sessionId, { name })
|
|
11102
|
+
);
|
|
11103
|
+
}
|
|
11104
|
+
function registerScheduleChannels({ ipc }) {
|
|
11105
|
+
ipc.handle("schedules:status", () => hostRequest("schedules.status", {}));
|
|
11106
|
+
ipc.handle("schedules:list", () => hostRequest("schedules.list", {}));
|
|
11107
|
+
ipc.handle("schedules:create", (_e, input) => hostRequest("schedules.create", input));
|
|
11108
|
+
ipc.handle(
|
|
11109
|
+
"schedules:update",
|
|
11110
|
+
(_e, id, patch) => hostRequest("schedules.update", { id, patch })
|
|
11111
|
+
);
|
|
11112
|
+
ipc.handle("schedules:delete", (_e, id) => hostRequest("schedules.delete", { id }));
|
|
11113
|
+
ipc.handle("schedules:runNow", (_e, id) => hostRequest("schedules.runNow", { id }));
|
|
11114
|
+
ipc.handle(
|
|
11115
|
+
"schedules:fires",
|
|
11116
|
+
(_e, id, limit) => hostRequest("schedules.fires", { id, ...limit !== void 0 ? { limit } : {} })
|
|
11117
|
+
);
|
|
11118
|
+
}
|
|
11028
11119
|
const REFERENCE_RESOLVE_MAX = 50;
|
|
11029
11120
|
async function storedArtifacts(uri) {
|
|
11030
11121
|
try {
|
|
@@ -11202,8 +11293,6 @@ function registerRunChannels({ ipc }) {
|
|
|
11202
11293
|
"chat:cancelWork",
|
|
11203
11294
|
(_e, sessionId, id, reason) => cancelRunningWork(sessionId, id, reason)
|
|
11204
11295
|
);
|
|
11205
|
-
ipc.handle("chat:steer", (_e, sessionId, message2) => steerSession(sessionId, message2));
|
|
11206
|
-
ipc.handle("chat:followUp", (_e, sessionId, message2) => followUpSession(sessionId, message2));
|
|
11207
11296
|
ipc.handle("chat:pushQueued", (_e, sessionId, message2, activatedSkills) => {
|
|
11208
11297
|
return sessionRequest("chat.pushQueued", sessionId, {
|
|
11209
11298
|
message: message2,
|
|
@@ -11269,7 +11358,7 @@ function runBashStreaming(opts) {
|
|
|
11269
11358
|
return new Promise((resolve2) => {
|
|
11270
11359
|
const slot = { text: "", bytes: 0 };
|
|
11271
11360
|
let overflowed = false;
|
|
11272
|
-
let
|
|
11361
|
+
let settled2 = false;
|
|
11273
11362
|
const shell2 = resolveUserShell();
|
|
11274
11363
|
const child = spawn(shell2.bin, [...shell2.args, command], {
|
|
11275
11364
|
cwd,
|
|
@@ -11281,10 +11370,10 @@ function runBashStreaming(opts) {
|
|
|
11281
11370
|
};
|
|
11282
11371
|
let graceTimer = null;
|
|
11283
11372
|
const settle = (exitCode) => {
|
|
11284
|
-
if (
|
|
11373
|
+
if (settled2) {
|
|
11285
11374
|
return;
|
|
11286
11375
|
}
|
|
11287
|
-
|
|
11376
|
+
settled2 = true;
|
|
11288
11377
|
untrack2();
|
|
11289
11378
|
signal.removeEventListener("abort", onAbort);
|
|
11290
11379
|
if (graceTimer) {
|
|
@@ -11316,7 +11405,7 @@ function runBashStreaming(opts) {
|
|
|
11316
11405
|
onAbort();
|
|
11317
11406
|
}
|
|
11318
11407
|
const onData = (chunk) => {
|
|
11319
|
-
if (overflowed ||
|
|
11408
|
+
if (overflowed || settled2) {
|
|
11320
11409
|
return;
|
|
11321
11410
|
}
|
|
11322
11411
|
if (appendCapped(slot, chunk, ceiling) !== "ok") {
|
|
@@ -11591,6 +11680,9 @@ function registerBlockRunChannels({ ipc }) {
|
|
|
11591
11680
|
}
|
|
11592
11681
|
const VIEW_PREFIX = "sidebar_view:";
|
|
11593
11682
|
const SPACE_KEY = "sidebar_space";
|
|
11683
|
+
const HISTORY_KEY = "sidebar_history";
|
|
11684
|
+
const MAX_HISTORY_ENTRIES = 200;
|
|
11685
|
+
const MAX_PAGE = 512;
|
|
11594
11686
|
const MAX_SPACE_ID = 200;
|
|
11595
11687
|
const MAX_VIEW_JSON = 4096;
|
|
11596
11688
|
function assertSpaceId(spaceId) {
|
|
@@ -11598,6 +11690,16 @@ function assertSpaceId(spaceId) {
|
|
|
11598
11690
|
throw new Error(`Invalid space id: ${String(spaceId)}`);
|
|
11599
11691
|
}
|
|
11600
11692
|
}
|
|
11693
|
+
function assertHistory(history) {
|
|
11694
|
+
if (!history || typeof history !== "object" || Array.isArray(history)) throw new Error("Invalid page history");
|
|
11695
|
+
const { entries, index } = history;
|
|
11696
|
+
if (!Array.isArray(entries) || entries.length > MAX_HISTORY_ENTRIES || !entries.every((page) => page === null || typeof page === "string" && page.length > 0 && page.length <= MAX_PAGE)) {
|
|
11697
|
+
throw new Error("Invalid page history entries");
|
|
11698
|
+
}
|
|
11699
|
+
if (typeof index !== "number" || !Number.isInteger(index) || index < -1 || index >= entries.length) {
|
|
11700
|
+
throw new Error("Invalid page history cursor");
|
|
11701
|
+
}
|
|
11702
|
+
}
|
|
11601
11703
|
function registerSidebarChannels({ ipc }) {
|
|
11602
11704
|
ipc.handle("sidebar:getViews", () => {
|
|
11603
11705
|
const views2 = {};
|
|
@@ -11617,6 +11719,19 @@ function registerSidebarChannels({ ipc }) {
|
|
|
11617
11719
|
settingsRepo.set(VIEW_PREFIX + spaceId, json);
|
|
11618
11720
|
});
|
|
11619
11721
|
ipc.handle("sidebar:getSpace", () => settingsRepo.get(SPACE_KEY));
|
|
11722
|
+
ipc.handle("sidebar:getHistory", () => {
|
|
11723
|
+
const raw = settingsRepo.get(HISTORY_KEY);
|
|
11724
|
+
if (raw === null) return null;
|
|
11725
|
+
try {
|
|
11726
|
+
return JSON.parse(raw);
|
|
11727
|
+
} catch {
|
|
11728
|
+
return null;
|
|
11729
|
+
}
|
|
11730
|
+
});
|
|
11731
|
+
ipc.handle("sidebar:setHistory", (_e, history) => {
|
|
11732
|
+
assertHistory(history);
|
|
11733
|
+
settingsRepo.set(HISTORY_KEY, JSON.stringify({ entries: history.entries, index: history.index }));
|
|
11734
|
+
});
|
|
11620
11735
|
ipc.handle("sidebar:setSpace", (_e, spaceId) => {
|
|
11621
11736
|
assertSpaceId(spaceId);
|
|
11622
11737
|
settingsRepo.set(SPACE_KEY, spaceId);
|
|
@@ -11702,8 +11817,15 @@ function registerSkillChannels({ ipc }) {
|
|
|
11702
11817
|
return message2;
|
|
11703
11818
|
});
|
|
11704
11819
|
}
|
|
11820
|
+
const positive = (n) => typeof n === "number" && Number.isInteger(n) && n >= 1;
|
|
11821
|
+
function editorPosition(at) {
|
|
11822
|
+
if (!at || typeof at !== "object") return void 0;
|
|
11823
|
+
const { line, column } = at;
|
|
11824
|
+
if (!positive(line)) return void 0;
|
|
11825
|
+
return positive(column) ? { line, column } : { line };
|
|
11826
|
+
}
|
|
11705
11827
|
function registerSystemChannels({ ipc }) {
|
|
11706
|
-
ipc.handle("system:openPath", async (_e, path) => {
|
|
11828
|
+
ipc.handle("system:openPath", async (_e, path, at) => {
|
|
11707
11829
|
if (typeof path !== "string" || !isAbsolute(path)) return false;
|
|
11708
11830
|
const stat$1 = await stat(path).catch(() => null);
|
|
11709
11831
|
if (!stat$1) return false;
|
|
@@ -11715,7 +11837,7 @@ function registerSystemChannels({ ipc }) {
|
|
|
11715
11837
|
return await shell.openPath(path) === "";
|
|
11716
11838
|
}
|
|
11717
11839
|
if (!stat$1.isFile()) return false;
|
|
11718
|
-
await openFileInEditor(path);
|
|
11840
|
+
await openFileInEditor(path, editorPosition(at));
|
|
11719
11841
|
return true;
|
|
11720
11842
|
});
|
|
11721
11843
|
ipc.handle("system:repoWebBase", async (_e, cwd) => {
|
|
@@ -11739,6 +11861,13 @@ function registerSystemChannels({ ipc }) {
|
|
|
11739
11861
|
await mkdir(dir, { recursive: true });
|
|
11740
11862
|
return await shell.openPath(dir) === "";
|
|
11741
11863
|
});
|
|
11864
|
+
ipc.handle("system:defaultBrowser", () => {
|
|
11865
|
+
try {
|
|
11866
|
+
return app.getApplicationNameForProtocol("https://example.com").replace(/\.app$/i, "").trim() || null;
|
|
11867
|
+
} catch {
|
|
11868
|
+
return null;
|
|
11869
|
+
}
|
|
11870
|
+
});
|
|
11742
11871
|
ipc.handle("system:revealPath", async (_e, raw) => {
|
|
11743
11872
|
const path = typeof raw === "string" ? raw.replace(/^file:\/\//, "") : "";
|
|
11744
11873
|
if (!isAbsolute(path)) return false;
|
|
@@ -11756,51 +11885,16 @@ function registerSystemChannels({ ipc }) {
|
|
|
11756
11885
|
return true;
|
|
11757
11886
|
});
|
|
11758
11887
|
}
|
|
11759
|
-
function
|
|
11760
|
-
|
|
11761
|
-
|
|
11762
|
-
|
|
11763
|
-
|
|
11764
|
-
|
|
11765
|
-
|
|
11888
|
+
function registerPlanChannels({ ipc }) {
|
|
11889
|
+
ipc.handle("plans:get", (_e, sessionId) => getPlansSnapshot(sessionId));
|
|
11890
|
+
ipc.handle(
|
|
11891
|
+
"plans:edit",
|
|
11892
|
+
(_e, sessionId, planId, op) => editSessionPlan(sessionId, planId, op)
|
|
11893
|
+
);
|
|
11894
|
+
ipc.handle(
|
|
11895
|
+
"plans:control",
|
|
11896
|
+
(_e, sessionId, planId, action) => controlSessionPlan(sessionId, planId, action)
|
|
11766
11897
|
);
|
|
11767
|
-
return selectActiveTodos({ metadata, runs });
|
|
11768
|
-
}
|
|
11769
|
-
function registerTodoChannels({ ipc }) {
|
|
11770
|
-
ipc.handle("todos:get", async (_e, sessionId) => {
|
|
11771
|
-
const live = await getTodosSnapshot(sessionId);
|
|
11772
|
-
const cold = live || serverIdOf(sessionId) !== null ? null : coldActiveTodos(sessionIdOf(sessionId));
|
|
11773
|
-
const state2 = live ?? (cold && (cold.runId || cold.todos.length > 0 || cold.archive.length > 0) ? cold : null);
|
|
11774
|
-
if (!state2) {
|
|
11775
|
-
return null;
|
|
11776
|
-
}
|
|
11777
|
-
return {
|
|
11778
|
-
runId: state2.runId,
|
|
11779
|
-
todos: [...state2.todos],
|
|
11780
|
-
archive: [...state2.archive],
|
|
11781
|
-
inProgress: state2.inProgress,
|
|
11782
|
-
tally: state2.tally
|
|
11783
|
-
};
|
|
11784
|
-
});
|
|
11785
|
-
ipc.handle("todos:set", async (_e, sessionId, items) => {
|
|
11786
|
-
const applied = await setSessionTodos(sessionId, items);
|
|
11787
|
-
if (applied) {
|
|
11788
|
-
return applied;
|
|
11789
|
-
}
|
|
11790
|
-
if (serverIdOf(sessionId) !== null) {
|
|
11791
|
-
return null;
|
|
11792
|
-
}
|
|
11793
|
-
const session2 = await loadSession(getSessionStore(), sessionIdOf(sessionId));
|
|
11794
|
-
if (!session2) {
|
|
11795
|
-
return null;
|
|
11796
|
-
}
|
|
11797
|
-
const runId = selectActiveTodos(session2).runId;
|
|
11798
|
-
setTodosForRun(session2, runId, sanitizeTodoItems(items, DEFAULT_MAX_TODO_ITEMS), { clearArchive: true });
|
|
11799
|
-
await session2.save();
|
|
11800
|
-
const snapshot = toTodosSnapshot(selectActiveTodos(session2));
|
|
11801
|
-
broadcastLocal({ kind: "todos:snapshot", sessionId, snapshot });
|
|
11802
|
-
return snapshot;
|
|
11803
|
-
});
|
|
11804
11898
|
}
|
|
11805
11899
|
const GITHUB_PROBE_MS = 2 * 6e4;
|
|
11806
11900
|
function createGithubUsageRead(fetch = fetchGithubUsage, now = Date.now) {
|
|
@@ -12096,10 +12190,16 @@ function unwatchGit(owner, cwd) {
|
|
|
12096
12190
|
}
|
|
12097
12191
|
function registerWorkspaceChannels({ ipc }) {
|
|
12098
12192
|
const inSandbox = environmentWorkspaceSession;
|
|
12099
|
-
ipc.handle(
|
|
12100
|
-
|
|
12101
|
-
|
|
12102
|
-
|
|
12193
|
+
ipc.handle(
|
|
12194
|
+
"workspace:list",
|
|
12195
|
+
async (_e, cwd, options) => {
|
|
12196
|
+
const sessionId = inSandbox(cwd);
|
|
12197
|
+
if (!sessionId) return listWorkspace(cwd, options);
|
|
12198
|
+
const entries = await listEnvironmentWorkspace(sessionId);
|
|
12199
|
+
const dir = options?.dir?.replace(/\/+$/, "");
|
|
12200
|
+
return { entries: dir ? entries.filter((e) => e.path.startsWith(`${dir}/`)) : entries };
|
|
12201
|
+
}
|
|
12202
|
+
);
|
|
12103
12203
|
ipc.handle("workspace:projectRoot", (_e, cwd) => {
|
|
12104
12204
|
if (typeof cwd !== "string" || !cwd || inSandbox(cwd)) return null;
|
|
12105
12205
|
try {
|
|
@@ -13656,7 +13756,14 @@ function createStorageHub(options) {
|
|
|
13656
13756
|
if (memo) return memo;
|
|
13657
13757
|
const file = createFileStoragePort({
|
|
13658
13758
|
root: join(options.dataDir, "extension-storage"),
|
|
13659
|
-
...projectRoot ? {
|
|
13759
|
+
...projectRoot ? {
|
|
13760
|
+
projectRoot: projectStorageFolder({
|
|
13761
|
+
dataDir: options.dataDir,
|
|
13762
|
+
projectRoot,
|
|
13763
|
+
prefix: options.prefix,
|
|
13764
|
+
...options.warn ? { warn: options.warn } : {}
|
|
13765
|
+
})
|
|
13766
|
+
} : {},
|
|
13660
13767
|
watch: false
|
|
13661
13768
|
});
|
|
13662
13769
|
const apply = async (loc, area, key, value) => {
|
|
@@ -13883,7 +13990,12 @@ function createDesktopExtensionsHost(options) {
|
|
|
13883
13990
|
if (!daemon2) options.broadcast(signal, exceptWindowId);
|
|
13884
13991
|
};
|
|
13885
13992
|
const clients = createWindowClientDirectory();
|
|
13886
|
-
const storage = createStorageHub({
|
|
13993
|
+
const storage = createStorageHub({
|
|
13994
|
+
dataDir: options.dataDir(),
|
|
13995
|
+
prefix: options.prefix,
|
|
13996
|
+
publish: publish2,
|
|
13997
|
+
warn: (message2) => console.warn(`[extensions] ${message2}`)
|
|
13998
|
+
});
|
|
13887
13999
|
const flows = createFlowRegistry({ openExternal: options.openExternal });
|
|
13888
14000
|
const authStore = createCredentialsAuthStore(options.dataDir());
|
|
13889
14001
|
const buildProvider = createProviderBuilder({
|
|
@@ -13936,6 +14048,7 @@ function createDesktopExtensionsHost(options) {
|
|
|
13936
14048
|
// Core builds these from the bridge only when a host passes no `host` port: this one does.
|
|
13937
14049
|
...bridge ? {
|
|
13938
14050
|
sessions: { sessionControl: bridge.sessionControl },
|
|
14051
|
+
schedules: { sessionControl: bridge.sessionControl, scheduleHandlers: bridge.scheduleHandlers },
|
|
13939
14052
|
workspace: { current: bridge.current },
|
|
13940
14053
|
artifacts: { current: bridge.current, registerKind }
|
|
13941
14054
|
} : { artifacts: { current: () => null, registerKind } },
|
|
@@ -13990,7 +14103,7 @@ function createDesktopExtensionsHost(options) {
|
|
|
13990
14103
|
return auth?.methods.find((method) => method.active === true && method.id)?.id;
|
|
13991
14104
|
},
|
|
13992
14105
|
discovery: () => ({ cwd, prefix: options.prefix, home: homedir() }),
|
|
13993
|
-
mcp: { call: mcpCall(cwd) }
|
|
14106
|
+
mcp: { call: mcpCall(cwd), status: () => options.mcpStatus?.(cwd, runtime) ?? [] }
|
|
13994
14107
|
});
|
|
13995
14108
|
const runtimeOptions = {
|
|
13996
14109
|
host: "desktop",
|
|
@@ -14220,11 +14333,10 @@ function isInside(file, root) {
|
|
|
14220
14333
|
const inside = relative(root, file);
|
|
14221
14334
|
return inside !== "" && !inside.startsWith("..") && !isAbsolute(inside);
|
|
14222
14335
|
}
|
|
14223
|
-
|
|
14224
|
-
|
|
14225
|
-
|
|
14226
|
-
|
|
14227
|
-
}
|
|
14336
|
+
const EXTENSION_WEBVIEW_SCHEME_PRIVILEGES = {
|
|
14337
|
+
scheme: EXTENSION_WEBVIEW_SCHEME,
|
|
14338
|
+
privileges: { standard: true, secure: true, supportFetchAPI: true }
|
|
14339
|
+
};
|
|
14228
14340
|
let daemonBackend;
|
|
14229
14341
|
function handleExtensionWebviewProtocol() {
|
|
14230
14342
|
protocol.handle(
|
|
@@ -14272,6 +14384,15 @@ function installExtensions({
|
|
|
14272
14384
|
}),
|
|
14273
14385
|
hostRuntime: extensionHostRuntime,
|
|
14274
14386
|
mcp: () => extensionMcpHost,
|
|
14387
|
+
// `ctx.mcp.list()` by the daemon's rule: enabled servers (`idle` until a call connects them), disabled ones.
|
|
14388
|
+
mcpStatus: (cwd, runtime) => mcpStatusOf({
|
|
14389
|
+
cwd,
|
|
14390
|
+
runtime,
|
|
14391
|
+
prefix: process.env.ZIDANE_PREFIX ?? ".zidane",
|
|
14392
|
+
settings: readSettings(),
|
|
14393
|
+
dataDir: userDataDir(),
|
|
14394
|
+
host: void 0
|
|
14395
|
+
}),
|
|
14275
14396
|
providers: (cwd) => cachedRuntimeConfig(cwd)?.providers ?? getResolvedConfig().providers,
|
|
14276
14397
|
readSettings: () => readSettings(),
|
|
14277
14398
|
applyAuthEnv,
|
|
@@ -14448,9 +14569,11 @@ function registerChatIpc() {
|
|
|
14448
14569
|
registerArtifactChannels({ ipc });
|
|
14449
14570
|
registerReferenceChannels({ ipc });
|
|
14450
14571
|
registerBadgeChannels({ ipc });
|
|
14451
|
-
|
|
14572
|
+
registerPlanChannels({ ipc });
|
|
14452
14573
|
registerDraftChannels({ ipc });
|
|
14453
14574
|
registerQueueChannels({ ipc });
|
|
14575
|
+
registerSecretChannels({ ipc });
|
|
14576
|
+
registerScheduleChannels({ ipc });
|
|
14454
14577
|
registerPresenceChannels({ ipc });
|
|
14455
14578
|
registerSafeModeChannels({ ipc });
|
|
14456
14579
|
registerDiscoveryChannels({ ipc });
|
|
@@ -15298,15 +15421,11 @@ function attachmentBlockText(block) {
|
|
|
15298
15421
|
}
|
|
15299
15422
|
return null;
|
|
15300
15423
|
}
|
|
15301
|
-
|
|
15302
|
-
|
|
15303
|
-
|
|
15304
|
-
|
|
15305
|
-
|
|
15306
|
-
privileges: { standard: true, secure: true, stream: true, supportFetchAPI: true, corsEnabled: true }
|
|
15307
|
-
}
|
|
15308
|
-
]);
|
|
15309
|
-
}
|
|
15424
|
+
const MEDIA_SCHEME_PRIVILEGES = {
|
|
15425
|
+
scheme: MEDIA_SCHEME,
|
|
15426
|
+
// `corsEnabled`: the page reads an image or a text attachment with `fetch`, a cross-origin request.
|
|
15427
|
+
privileges: { standard: true, secure: true, stream: true, supportFetchAPI: true, corsEnabled: true }
|
|
15428
|
+
};
|
|
15310
15429
|
function handleMediaProtocol() {
|
|
15311
15430
|
protocol.handle(MEDIA_SCHEME, (request2) => serveMedia(request2).catch(() => notFound()));
|
|
15312
15431
|
app.on("will-quit", closeStoredToolResults);
|
|
@@ -15316,6 +15435,7 @@ const IMMUTABLE = "private, max-age=31536000, immutable";
|
|
|
15316
15435
|
const NO_ACTIVE_CONTENT = "default-src 'none'; img-src 'self' data:; media-src 'self'; style-src 'unsafe-inline'; sandbox";
|
|
15317
15436
|
async function serveMedia(request2) {
|
|
15318
15437
|
const res = await routeMedia(request2);
|
|
15438
|
+
res.headers.set("access-control-allow-origin", "*");
|
|
15319
15439
|
if (res.headers.get("content-type") !== "application/pdf")
|
|
15320
15440
|
res.headers.set("content-security-policy", NO_ACTIVE_CONTENT);
|
|
15321
15441
|
return res;
|
|
@@ -15366,13 +15486,7 @@ function promptText(url) {
|
|
|
15366
15486
|
const block = turn?.role === "user" ? promptAttachmentBlocks(turn)[at.index] : void 0;
|
|
15367
15487
|
const text2 = block ? attachmentBlockText(block) : null;
|
|
15368
15488
|
if (text2 === null) return notFound();
|
|
15369
|
-
return new Response(text2, {
|
|
15370
|
-
headers: {
|
|
15371
|
-
"content-type": "text/plain; charset=utf-8",
|
|
15372
|
-
"cache-control": IMMUTABLE,
|
|
15373
|
-
"access-control-allow-origin": "*"
|
|
15374
|
-
}
|
|
15375
|
-
});
|
|
15489
|
+
return new Response(text2, { headers: { "content-type": "text/plain; charset=utf-8", "cache-control": IMMUTABLE } });
|
|
15376
15490
|
}
|
|
15377
15491
|
async function toolMedia(url) {
|
|
15378
15492
|
const at = storedAddress(url);
|
|
@@ -16072,6 +16186,271 @@ function registerPerfIpc() {
|
|
|
16072
16186
|
return { path, report };
|
|
16073
16187
|
});
|
|
16074
16188
|
}
|
|
16189
|
+
const DEEP_LINK_SCHEME = "zidane";
|
|
16190
|
+
const DEV_DEEP_LINK_SCHEME = "zidane-dev";
|
|
16191
|
+
const MAX_ID_LENGTH = 128;
|
|
16192
|
+
const MAX_PATH_LENGTH = 4096;
|
|
16193
|
+
const MAX_PROMPT_LENGTH = 16e3;
|
|
16194
|
+
const MAX_URL_LENGTH = 256 * 1024;
|
|
16195
|
+
const ID = /^[\w.:@-]+$/;
|
|
16196
|
+
function validId(value) {
|
|
16197
|
+
return value.length > 0 && value.length <= MAX_ID_LENGTH && ID.test(value);
|
|
16198
|
+
}
|
|
16199
|
+
function validPath(value) {
|
|
16200
|
+
if (value.length === 0 || value.length > MAX_PATH_LENGTH || value.includes("\0")) return false;
|
|
16201
|
+
return value.startsWith("/") || /^[A-Za-z]:[\\/]/.test(value);
|
|
16202
|
+
}
|
|
16203
|
+
function hostOf(value) {
|
|
16204
|
+
if (value === null || value === "") return LOCAL_HOST_KEY;
|
|
16205
|
+
return validId(value) ? value : null;
|
|
16206
|
+
}
|
|
16207
|
+
function parseDeepLink(url, scheme = DEEP_LINK_SCHEME) {
|
|
16208
|
+
if (typeof url !== "string" || url.length > MAX_URL_LENGTH) return null;
|
|
16209
|
+
let parsed;
|
|
16210
|
+
try {
|
|
16211
|
+
parsed = new URL(url);
|
|
16212
|
+
} catch {
|
|
16213
|
+
return null;
|
|
16214
|
+
}
|
|
16215
|
+
if (parsed.protocol !== `${scheme}:`) return null;
|
|
16216
|
+
if (parsed.username || parsed.password || parsed.port) return null;
|
|
16217
|
+
const action = parsed.hostname.toLowerCase();
|
|
16218
|
+
const segments = parsed.pathname.split("/").filter(Boolean);
|
|
16219
|
+
const params = parsed.searchParams;
|
|
16220
|
+
if (action === "session") {
|
|
16221
|
+
if (segments.length !== 1) return null;
|
|
16222
|
+
let sessionId;
|
|
16223
|
+
try {
|
|
16224
|
+
sessionId = decodeURIComponent(segments[0]);
|
|
16225
|
+
} catch {
|
|
16226
|
+
return null;
|
|
16227
|
+
}
|
|
16228
|
+
const hostId2 = hostOf(params.get("host"));
|
|
16229
|
+
if (!validId(sessionId) || hostId2 === null) return null;
|
|
16230
|
+
return { kind: "session", sessionId, hostId: hostId2 };
|
|
16231
|
+
}
|
|
16232
|
+
if (action === "new") {
|
|
16233
|
+
if (segments.length !== 0) return null;
|
|
16234
|
+
const hostId2 = hostOf(params.get("host"));
|
|
16235
|
+
if (hostId2 === null) return null;
|
|
16236
|
+
const ignored = [];
|
|
16237
|
+
const read = (name, valid) => {
|
|
16238
|
+
const value = params.get(name);
|
|
16239
|
+
if (value === null || value === "") return void 0;
|
|
16240
|
+
if (valid(value)) return value;
|
|
16241
|
+
ignored.push(name);
|
|
16242
|
+
return void 0;
|
|
16243
|
+
};
|
|
16244
|
+
const cwd = read("cwd", validPath);
|
|
16245
|
+
const prompt = read("prompt", (value) => value.length <= MAX_PROMPT_LENGTH && !value.includes("\0"));
|
|
16246
|
+
const agentId = read("agent", validId);
|
|
16247
|
+
const machineId = read("machine", validId);
|
|
16248
|
+
return {
|
|
16249
|
+
kind: "new",
|
|
16250
|
+
hostId: hostId2,
|
|
16251
|
+
...cwd ? { cwd } : {},
|
|
16252
|
+
...prompt ? { prompt } : {},
|
|
16253
|
+
...agentId ? { agentId } : {},
|
|
16254
|
+
...machineId ? { machineId } : {},
|
|
16255
|
+
ignored
|
|
16256
|
+
};
|
|
16257
|
+
}
|
|
16258
|
+
return null;
|
|
16259
|
+
}
|
|
16260
|
+
function deepLinkFromArgv(argv, scheme = DEEP_LINK_SCHEME) {
|
|
16261
|
+
const prefix = `${scheme}:`;
|
|
16262
|
+
return argv.find((arg) => typeof arg === "string" && arg.toLowerCase().startsWith(prefix)) ?? null;
|
|
16263
|
+
}
|
|
16264
|
+
const PARAM_NAMES = {
|
|
16265
|
+
cwd: "folder",
|
|
16266
|
+
prompt: "prompt",
|
|
16267
|
+
agent: "agent",
|
|
16268
|
+
machine: "machine",
|
|
16269
|
+
host: "host"
|
|
16270
|
+
};
|
|
16271
|
+
function within(root, path) {
|
|
16272
|
+
const base = root.endsWith("/") ? root.slice(0, -1) : root;
|
|
16273
|
+
return path === base || path.startsWith(`${base}/`);
|
|
16274
|
+
}
|
|
16275
|
+
async function settled(check, fallback) {
|
|
16276
|
+
try {
|
|
16277
|
+
return await check;
|
|
16278
|
+
} catch {
|
|
16279
|
+
return fallback;
|
|
16280
|
+
}
|
|
16281
|
+
}
|
|
16282
|
+
async function openSession(link, deps2) {
|
|
16283
|
+
const found = await deps2.host(link.hostId);
|
|
16284
|
+
if ("error" in found) {
|
|
16285
|
+
deps2.notice("Could not open the session.", found.error);
|
|
16286
|
+
return;
|
|
16287
|
+
}
|
|
16288
|
+
const exists = await settled(found.host.sessionExists(link.sessionId), false);
|
|
16289
|
+
if (!exists) {
|
|
16290
|
+
deps2.notice("Session not found.", `${found.host.name} has no session "${link.sessionId}".`);
|
|
16291
|
+
return;
|
|
16292
|
+
}
|
|
16293
|
+
deps2.reveal(sessionKey(link.hostId, link.sessionId));
|
|
16294
|
+
}
|
|
16295
|
+
async function openDraft(link, deps2) {
|
|
16296
|
+
const found = await deps2.host(link.hostId);
|
|
16297
|
+
if ("error" in found) {
|
|
16298
|
+
deps2.notice("Could not start a new chat.", found.error);
|
|
16299
|
+
return;
|
|
16300
|
+
}
|
|
16301
|
+
const { host: host2 } = found;
|
|
16302
|
+
const problems = link.ignored.map((param) => `The ${PARAM_NAMES[param]} in the link is not valid.`);
|
|
16303
|
+
const request2 = { hostId: link.hostId };
|
|
16304
|
+
let machine;
|
|
16305
|
+
if (link.machineId) {
|
|
16306
|
+
const machines = await settled(host2.machines(), []);
|
|
16307
|
+
machine = machines.find((m) => m.id === link.machineId);
|
|
16308
|
+
if (machine) request2.machine = { id: machine.id, name: machine.name };
|
|
16309
|
+
else problems.push(`${host2.name} has no machine "${link.machineId}".`);
|
|
16310
|
+
}
|
|
16311
|
+
if (link.cwd) {
|
|
16312
|
+
const ok = machine ? machine.roots.some((root) => within(root.path, link.cwd)) : await settled(host2.folderExists(link.cwd), false);
|
|
16313
|
+
if (ok) request2.cwd = link.cwd;
|
|
16314
|
+
else problems.push(`${machine ? `Machine ${machine.name}` : host2.name} has no folder "${link.cwd}".`);
|
|
16315
|
+
}
|
|
16316
|
+
if (link.agentId) {
|
|
16317
|
+
const agents = await settled(host2.agentIds(machine ? "" : request2.cwd ?? ""), []);
|
|
16318
|
+
if (agents.includes(link.agentId)) request2.agentId = link.agentId;
|
|
16319
|
+
else problems.push(`There is no agent "${link.agentId}".`);
|
|
16320
|
+
}
|
|
16321
|
+
if (link.prompt) request2.prompt = link.prompt;
|
|
16322
|
+
deps2.openDraft(request2);
|
|
16323
|
+
if (problems.length > 0) deps2.notice("Some of the link was ignored.", problems.join("\n"));
|
|
16324
|
+
}
|
|
16325
|
+
async function handleDeepLink(url, scheme, deps2) {
|
|
16326
|
+
const link = parseDeepLink(url, scheme);
|
|
16327
|
+
if (!link) {
|
|
16328
|
+
deps2.notice("Zidane cannot open this link.", url.length > 200 ? `${url.slice(0, 200)}…` : url);
|
|
16329
|
+
return;
|
|
16330
|
+
}
|
|
16331
|
+
try {
|
|
16332
|
+
if (link.kind === "session") await openSession(link, deps2);
|
|
16333
|
+
else await openDraft(link, deps2);
|
|
16334
|
+
} catch (err) {
|
|
16335
|
+
deps2.notice("Zidane could not open this link.", err instanceof Error ? err.message : String(err));
|
|
16336
|
+
}
|
|
16337
|
+
}
|
|
16338
|
+
const CONNECT_WAIT_MS = 1e4;
|
|
16339
|
+
const MAX_QUEUED = 16;
|
|
16340
|
+
function deepLinkScheme() {
|
|
16341
|
+
return app.isPackaged ? DEEP_LINK_SCHEME : DEV_DEEP_LINK_SCHEME;
|
|
16342
|
+
}
|
|
16343
|
+
const queued = [];
|
|
16344
|
+
let handle = null;
|
|
16345
|
+
function receive(url) {
|
|
16346
|
+
if (handle) handle(url);
|
|
16347
|
+
else if (queued.length < MAX_QUEUED) queued.push(url);
|
|
16348
|
+
}
|
|
16349
|
+
function installDeepLinks() {
|
|
16350
|
+
const scheme = deepLinkScheme();
|
|
16351
|
+
if (app.isPackaged && !app.requestSingleInstanceLock()) return false;
|
|
16352
|
+
app.on("second-instance", (_event, argv) => {
|
|
16353
|
+
const url = deepLinkFromArgv(argv, scheme);
|
|
16354
|
+
if (url) receive(url);
|
|
16355
|
+
else if (handle) openMainWindow();
|
|
16356
|
+
});
|
|
16357
|
+
app.on("will-finish-launching", () => {
|
|
16358
|
+
app.on("open-url", (event, url) => {
|
|
16359
|
+
event.preventDefault();
|
|
16360
|
+
receive(url);
|
|
16361
|
+
});
|
|
16362
|
+
});
|
|
16363
|
+
const launchedWith = deepLinkFromArgv(process.argv, scheme);
|
|
16364
|
+
if (launchedWith) receive(launchedWith);
|
|
16365
|
+
if (app.isPackaged && !app.isDefaultProtocolClient(scheme)) app.setAsDefaultProtocolClient(scheme);
|
|
16366
|
+
return true;
|
|
16367
|
+
}
|
|
16368
|
+
function startDeepLinks(deps2 = appDeepLinkDeps()) {
|
|
16369
|
+
const scheme = deepLinkScheme();
|
|
16370
|
+
handle = (url) => {
|
|
16371
|
+
void handleDeepLink(url, scheme, deps2).catch(
|
|
16372
|
+
(err) => guiLog.warn("deep link failed", { scope: "deep-link", error: String(err) })
|
|
16373
|
+
);
|
|
16374
|
+
};
|
|
16375
|
+
for (const url of queued.splice(0)) handle(url);
|
|
16376
|
+
}
|
|
16377
|
+
const localHost = {
|
|
16378
|
+
name: LOCAL_HOST_NAME,
|
|
16379
|
+
sessionExists: async (sessionId) => sessionExists(sessionId),
|
|
16380
|
+
folderExists: async (path) => (await stat(path)).isDirectory(),
|
|
16381
|
+
agentIds: async (cwd) => {
|
|
16382
|
+
const daemon2 = daemonReads();
|
|
16383
|
+
if (daemon2) return (await daemon2.request("agents.list", { cwd: scopeCwd(cwd) })).map((agent) => agent.id);
|
|
16384
|
+
const config2 = await getRuntimeConfig(scopeCwd(cwd));
|
|
16385
|
+
return Object.values(availableAgents(liveAgentProfiles(config2), readSettings())).map((agent) => agent.id);
|
|
16386
|
+
},
|
|
16387
|
+
machines: () => hostFor({ hostId: LOCAL_HOST_ID }).request("machines.list", {})
|
|
16388
|
+
};
|
|
16389
|
+
function settledConnection(hostId2, ms) {
|
|
16390
|
+
const directory2 = getHostDirectory();
|
|
16391
|
+
return new Promise((resolve2) => {
|
|
16392
|
+
const done = () => {
|
|
16393
|
+
clearTimeout(timer);
|
|
16394
|
+
off();
|
|
16395
|
+
resolve2();
|
|
16396
|
+
};
|
|
16397
|
+
const timer = setTimeout(done, ms);
|
|
16398
|
+
const off = directory2.onChange(() => {
|
|
16399
|
+
const server = directory2.server(hostId2);
|
|
16400
|
+
if (!server || server.client || server.status !== "connecting" && server.status !== "reconnecting") done();
|
|
16401
|
+
});
|
|
16402
|
+
});
|
|
16403
|
+
}
|
|
16404
|
+
async function serverLookup(hostId2) {
|
|
16405
|
+
const running2 = await syncRemoteHosts().catch(() => null);
|
|
16406
|
+
if (!running2) {
|
|
16407
|
+
return {
|
|
16408
|
+
error: "Remote hosts are off. Turn them on in Settings › Advanced › Experimental to open links to a server."
|
|
16409
|
+
};
|
|
16410
|
+
}
|
|
16411
|
+
const directory2 = getHostDirectory();
|
|
16412
|
+
const known = directory2.server(hostId2);
|
|
16413
|
+
if (!known) return { error: `This app has no saved server "${hostId2}".` };
|
|
16414
|
+
if (!known.client && (known.status === "connecting" || known.status === "reconnecting")) {
|
|
16415
|
+
await settledConnection(hostId2, CONNECT_WAIT_MS);
|
|
16416
|
+
}
|
|
16417
|
+
const server = directory2.server(hostId2);
|
|
16418
|
+
if (!server) return { error: `This app has no saved server "${hostId2}".` };
|
|
16419
|
+
if (!server.client) return { error: `${server.name} is not connected right now.` };
|
|
16420
|
+
const host2 = serverHost(hostId2);
|
|
16421
|
+
if (!host2) return { error: `This app has no saved server "${hostId2}".` };
|
|
16422
|
+
return {
|
|
16423
|
+
host: {
|
|
16424
|
+
name: host2.name,
|
|
16425
|
+
sessionExists: async (sessionId) => {
|
|
16426
|
+
try {
|
|
16427
|
+
return await host2.call("sessions.getMeta", { sessionId }) !== null;
|
|
16428
|
+
} catch (err) {
|
|
16429
|
+
if (isUnsupportedMethod(err)) return true;
|
|
16430
|
+
throw err;
|
|
16431
|
+
}
|
|
16432
|
+
},
|
|
16433
|
+
folderExists: async (path) => {
|
|
16434
|
+
await host2.call("fs.listDirs", { path });
|
|
16435
|
+
return true;
|
|
16436
|
+
},
|
|
16437
|
+
agentIds: async (cwd) => (await host2.call("agents.list", { cwd })).map((agent) => agent.id),
|
|
16438
|
+
machines: () => host2.call("machines.list", {})
|
|
16439
|
+
}
|
|
16440
|
+
};
|
|
16441
|
+
}
|
|
16442
|
+
function appDeepLinkDeps() {
|
|
16443
|
+
return {
|
|
16444
|
+
host: async (hostId2) => hostId2 === LOCAL_HOST_ID ? { host: localHost } : serverLookup(hostId2),
|
|
16445
|
+
reveal: revealSession,
|
|
16446
|
+
openDraft: openNewDraft,
|
|
16447
|
+
notice: (message2, detail) => {
|
|
16448
|
+
guiLog.info(`deep link: ${message2}`, { scope: "deep-link", ...detail ? { detail } : {} });
|
|
16449
|
+
if (process.env.ZIDANE_GUI_HEADLESS === "true") return;
|
|
16450
|
+
void dialog.showMessageBox({ type: "info", message: message2, ...detail ? { detail } : {} }).catch(() => void 0);
|
|
16451
|
+
}
|
|
16452
|
+
};
|
|
16453
|
+
}
|
|
16075
16454
|
const CRASH_LOOP_MS = 3e4;
|
|
16076
16455
|
const defaultDeps = {
|
|
16077
16456
|
now: Date.now,
|
|
@@ -16172,8 +16551,7 @@ config({ path: join(import.meta.dirname, "../../.env"), quiet: true });
|
|
|
16172
16551
|
setBuiltEntriesDir(import.meta.dirname);
|
|
16173
16552
|
installIpcTiming(ipcMain);
|
|
16174
16553
|
app.on("web-contents-created", (_event, contents) => timePushes(contents));
|
|
16175
|
-
|
|
16176
|
-
registerExtensionWebviewScheme();
|
|
16554
|
+
protocol.registerSchemesAsPrivileged([MEDIA_SCHEME_PRIVILEGES, EXTENSION_WEBVIEW_SCHEME_PRIVILEGES]);
|
|
16177
16555
|
installProcessErrorLogging();
|
|
16178
16556
|
ignoreStdioWriteErrors();
|
|
16179
16557
|
const RENDERER_INDEX = join(import.meta.dirname, "../renderer/index.html");
|
|
@@ -16197,6 +16575,8 @@ keepDevToolsBindable();
|
|
|
16197
16575
|
app.setPath("userData", override);
|
|
16198
16576
|
}
|
|
16199
16577
|
}
|
|
16578
|
+
const primaryInstance = installDeepLinks();
|
|
16579
|
+
if (!primaryInstance) app.quit();
|
|
16200
16580
|
function createWindow(query) {
|
|
16201
16581
|
const icon = windowIcon();
|
|
16202
16582
|
const titleSuffix = app.isPackaged ? "" : " (dev)";
|
|
@@ -16286,6 +16666,7 @@ function registerAppHandlers() {
|
|
|
16286
16666
|
registerAppIconIpc();
|
|
16287
16667
|
}
|
|
16288
16668
|
app.whenReady().then(() => {
|
|
16669
|
+
if (!primaryInstance) return;
|
|
16289
16670
|
applyAppIcon();
|
|
16290
16671
|
syncBundleIcon();
|
|
16291
16672
|
applyAuthEnv();
|
|
@@ -16313,11 +16694,13 @@ app.whenReady().then(() => {
|
|
|
16313
16694
|
registerPerfIpc();
|
|
16314
16695
|
setWindowFactory(createWindow);
|
|
16315
16696
|
openMainWindow();
|
|
16697
|
+
startDeepLinks();
|
|
16316
16698
|
app.on("activate", () => {
|
|
16317
16699
|
if (!mainWindow()) openMainWindow();
|
|
16318
16700
|
});
|
|
16319
16701
|
});
|
|
16320
16702
|
app.on("before-quit", () => {
|
|
16703
|
+
if (!primaryInstance) return;
|
|
16321
16704
|
void lspManager.stopAll();
|
|
16322
16705
|
shutdownChat();
|
|
16323
16706
|
cancelAllOAuth();
|