@bobannomi/app-host 0.8.0 → 0.8.1

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.
@@ -235,7 +235,7 @@ declare class AppHostError extends Error {
235
235
  });
236
236
  }
237
237
 
238
- declare const APP_HOST_FEATURES: readonly ["fetch-v1", "fetch-inline-body-v1", "fetch-target-close-v1", "service-v1", "extended-errors-v1", "workspace-v1", "session-resources-v1", "session-controls-v1", "conversation-creation-session-v1", "trusted-desktop-v1", "attachments-v1", "auxiliary-sessions-v1", "system-ui-v1", "lifecycle-v1", "commands-v1", "resource-catalog-v1", "file-content-v1", "window-chrome-v1", "window-updates-v1", "window-update-check-v1", "embedded-browser-v1", "browser-binding-invalidation-v1", "browser-capture-preview-v1", "workbench-computer-v1"];
238
+ declare const APP_HOST_FEATURES: readonly ["fetch-v1", "fetch-inline-body-v1", "fetch-target-close-v1", "service-v1", "extended-errors-v1", "workspace-v1", "session-controls-v1", "conversation-creation-session-v1", "trusted-desktop-v1", "attachments-v1", "auxiliary-sessions-v1", "system-ui-v1", "lifecycle-v1", "commands-v1", "resource-catalog-v1", "file-content-v1", "window-chrome-v1", "window-updates-v1", "window-update-check-v1", "embedded-browser-v1", "browser-binding-invalidation-v1", "browser-capture-preview-v1", "workbench-computer-v1"];
239
239
  type AppHostFeature = (typeof APP_HOST_FEATURES)[number];
240
240
  declare const FETCH_CHUNK_BYTES: number;
241
241
  declare const FETCH_INLINE_BODY_BYTES: number;
@@ -305,7 +305,6 @@ declare function pageFetchPath(baseUrl: string, input: string): string;
305
305
 
306
306
  interface AgentApiRoute {
307
307
  readonly id: string;
308
- readonly builtinWorkbench?: true;
309
308
  }
310
309
  declare function matchAgentApiRoute(method: string, path: string): AgentApiRoute | undefined;
311
310
  /** Read the original Node request target, before WHATWG URL removes dot segments. */
@@ -691,7 +690,7 @@ interface ConnectionStreams {
691
690
  fetchFor(id: string, base: string): typeof fetch;
692
691
  isClosed?(id: string): boolean;
693
692
  }
694
- /** A host-managed connection. Pass an AbortSignal to cancel an individual request. */
693
+ /** A Client transport. Pass an AbortSignal to cancel an individual request. */
695
694
  interface AgentConnection {
696
695
  /** Optional location hint. Execution always uses the Session/Run's persisted root. */
697
696
  readonly cwd?: string;
@@ -700,7 +699,7 @@ interface AgentConnection {
700
699
  readonly baseUrl: string;
701
700
  readonly fetch: typeof fetch;
702
701
  };
703
- /** True once the host has closed this target or its document transport. */
702
+ /** True once this connection can no longer accept requests. */
704
703
  isClosed?(): boolean;
705
704
  }
706
705
 
@@ -1573,16 +1572,9 @@ type Project = Scope & {
1573
1572
  projectId: string;
1574
1573
  workspaceId: string;
1575
1574
  };
1576
- type ProjectRequest = {
1577
- action: "list";
1578
- } | Scope & {
1575
+ type ProjectRequest = Scope & {
1579
1576
  action: "register";
1580
1577
  workspaceId: string;
1581
- } | Project & {
1582
- action: "setDefaultShell";
1583
- shell: string | null;
1584
- } | Project & {
1585
- action: "archive";
1586
1578
  } | Project & {
1587
1579
  action: "rebind";
1588
1580
  previousWorkspaceId: string;
@@ -1638,6 +1630,7 @@ type Entry<Input, Result> = {
1638
1630
  input: Input;
1639
1631
  result: Result;
1640
1632
  };
1633
+ type GitRead<M extends "desktop.git.changes" | "desktop.git.diff"> = Entry<Root & Omit<DesktopMethodMap[M]["params"], "targetId">, DesktopMethodMap[M]["result"]>;
1641
1634
  type LocalWorkspaceActions = {
1642
1635
  pick: Entry<{}, Required<Root> & {
1643
1636
  workspaceId: string;
@@ -1665,6 +1658,8 @@ type LocalWorkspaceActions = {
1665
1658
  webPreview: Entry<File, {
1666
1659
  url: string;
1667
1660
  }>;
1661
+ gitChanges: GitRead<"desktop.git.changes">;
1662
+ gitDiff: GitRead<"desktop.git.diff">;
1668
1663
  };
1669
1664
  type Action = keyof LocalWorkspaceActions;
1670
1665
  type LocalWorkspaceRequest = {
@@ -1794,7 +1789,7 @@ type SystemEvent = {
1794
1789
  type: "git-preferences-changed";
1795
1790
  defaultTaskLocation: "current" | "worktree";
1796
1791
  };
1797
- declare const SYSTEM_METHODS: readonly ["system.projects", "system.workspace", "system.pickFile", "system.open", "system.getPresentationPreferences", "system.setTheme", "system.setWindowMaterial", "system.copyText", "system.openExternal", "system.navigationReady", "system.completeNavigation"];
1792
+ declare const SYSTEM_METHODS: readonly ["system.projects", "system.workspace", "system.open", "system.getPresentationPreferences", "system.setTheme", "system.setWindowMaterial", "system.copyText", "system.openExternal", "system.navigationReady", "system.completeNavigation"];
1798
1793
  interface SystemMethodMap {
1799
1794
  "system.projects": {
1800
1795
  params: ProjectRequest;
@@ -1804,15 +1799,6 @@ interface SystemMethodMap {
1804
1799
  params: LocalWorkspaceRequest;
1805
1800
  result: LocalWorkspaceResult;
1806
1801
  };
1807
- "system.pickFile": {
1808
- params: {
1809
- filters?: {
1810
- name: string;
1811
- extensions: string[];
1812
- }[];
1813
- };
1814
- result: string | null;
1815
- };
1816
1802
  "system.open": {
1817
1803
  params: SystemOpenWireInput;
1818
1804
  result: {
@@ -1875,8 +1861,6 @@ interface AppHostSystem {
1875
1861
  workspace<A extends LocalWorkspaceRequest["action"]>(input: Extract<LocalWorkspaceRequest, {
1876
1862
  action: A;
1877
1863
  }>): Promise<LocalWorkspaceResult<A>>;
1878
- /** Opens the file picker for the built-in workbench and returns the selected local path. */
1879
- pickFile(input?: SystemMethodMap["system.pickFile"]["params"]): Promise<string | null>;
1880
1864
  open(input: SystemOpenInput): Promise<{
1881
1865
  opened: true;
1882
1866
  }>;
@@ -1903,18 +1887,6 @@ interface SystemRequester {
1903
1887
  }
1904
1888
  declare function createAppSystemApi(requester: SystemRequester, connectionOwner: object): AppHostSystem;
1905
1889
 
1906
- interface AppHostSessions {
1907
- preparation: ConversationPreparationGroup;
1908
- auxiliary: AuxiliarySessionsGroup;
1909
- }
1910
- type SessionResourceMethod = "getAuthorizedAgentConnection";
1911
- declare function validSessionResourceInput(method: SessionResourceMethod, v: unknown): boolean;
1912
- declare function validSessionResourceResult(_method: SessionResourceMethod, v: unknown): v is {
1913
- connectionId: string;
1914
- baseUrl: string;
1915
- defaultTaskLocation?: "current" | "worktree";
1916
- };
1917
-
1918
1890
  interface ServiceConnection {
1919
1891
  readonly baseUrl: string;
1920
1892
  readonly apiVersion: string;
@@ -1934,6 +1906,11 @@ interface AppHostService {
1934
1906
  }>;
1935
1907
  }
1936
1908
 
1909
+ interface AppHostSessions {
1910
+ preparation: ConversationPreparationGroup;
1911
+ auxiliary: AuxiliarySessionsGroup;
1912
+ }
1913
+
1937
1914
  type AppUnloadReason = "switch" | "reload" | "disable" | "quit";
1938
1915
  type AppLifecycleFrame = {
1939
1916
  protocol: 1;
@@ -1977,8 +1954,6 @@ interface AppHost {
1977
1954
  lifecycle: AppHostLifecycle;
1978
1955
  system: AppHostSystem;
1979
1956
  window: AppHostWindow;
1980
- /** Get the host-managed Agent connection authorized for the current page. */
1981
- getAuthorizedAgentConnection(): Promise<AgentConnection>;
1982
1957
  sessions: AppHostSessions;
1983
1958
  desktop: AppHostDesktop;
1984
1959
  attachments: AppHostAttachments;
@@ -2138,7 +2113,7 @@ declare const APP_HOST_REQUEST_TIMEOUT_MS = 30000;
2138
2113
  declare const APP_HOST_PORT_TIMEOUT_MS = 10000;
2139
2114
  declare const APP_HOST_LOGIN_TIMEOUT_MS = 300000;
2140
2115
  declare const APP_HOST_LOGIN_TRANSPORT_TIMEOUT_MS: number;
2141
- declare const APP_HOST_METHODS: readonly ["connect", "negotiate", "getContext", "storage.get", "storage.set", "storage.delete", "getAuthorizedAgentConnection", "service.getStatus", "service.getConnection", "service.listWork", "service.getWork", "service.interruptWork", "storage.putFile", "storage.readFile", "storage.deleteFile", "auth.openLogin", "workspace.select", "workspace.getSelection", "workspace.get", "workspace.listFiles", "workspace.readText", "commands.register", "commands.update", "commands.dispose", "workspace.list", "sessions.createConversation", "sessions.getConversationCreationResult", ...(keyof DesktopMethodMap)[], "attachments.getConnection", "sessions.getAuxiliaryOptions", "sessions.openAuxiliary", "sessions.getAuxiliary", "sessions.closeAuxiliary", "system.projects", "system.workspace", "system.pickFile", "system.open", "system.getPresentationPreferences", "system.setTheme", "system.setWindowMaterial", "system.copyText", "system.openExternal", "system.navigationReady", "system.completeNavigation", "window.getState", "window.checkForUpdates", "window.minimize", "window.toggleMaximize", "window.requestClose", "window.openHost", "window.reportStartup", "workbench.computer.availability", "workbench.computer.setConversation", "workbench.computer.preparePrompt", "workbench.computer.getActivity", "workbench.computer.reply", "workbench.computer.control", "workbench.computer.shareWindow", "workbench.computer.stopLocal"];
2116
+ declare const APP_HOST_METHODS: readonly ["connect", "negotiate", "getContext", "storage.get", "storage.set", "storage.delete", "service.getStatus", "service.getConnection", "service.listWork", "service.getWork", "service.interruptWork", "storage.putFile", "storage.readFile", "storage.deleteFile", "auth.openLogin", "workspace.select", "workspace.getSelection", "workspace.get", "workspace.listFiles", "workspace.readText", "commands.register", "commands.update", "commands.dispose", "workspace.list", "sessions.createConversation", "sessions.getConversationCreationResult", ...(keyof DesktopMethodMap)[], "attachments.getConnection", "sessions.getAuxiliaryOptions", "sessions.openAuxiliary", "sessions.getAuxiliary", "sessions.closeAuxiliary", "system.projects", "system.workspace", "system.open", "system.getPresentationPreferences", "system.setTheme", "system.setWindowMaterial", "system.copyText", "system.openExternal", "system.navigationReady", "system.completeNavigation", "window.getState", "window.checkForUpdates", "window.minimize", "window.toggleMaximize", "window.requestClose", "window.openHost", "window.reportStartup", "workbench.computer.availability", "workbench.computer.setConversation", "workbench.computer.preparePrompt", "workbench.computer.getActivity", "workbench.computer.reply", "workbench.computer.control", "workbench.computer.shareWindow", "workbench.computer.stopLocal"];
2142
2117
 
2143
2118
  interface AppContext {
2144
2119
  readonly appId: string;
@@ -2192,13 +2167,6 @@ interface ConnectParams {
2192
2167
  hostApi: string;
2193
2168
  }
2194
2169
  interface AppHostMethodMap extends CommandsMethodMap, ResourceCatalogMethodMap, ConversationPreparationMethodMap, DesktopMethodMap, AttachmentsMethodMap, AuxiliaryMethodMap, SystemMethodMap, WindowMethodMap, WorkbenchComputerMethodMap {
2195
- "getAuthorizedAgentConnection": {
2196
- params: Record<string, never>;
2197
- result: {
2198
- connectionId: string;
2199
- baseUrl: string;
2200
- };
2201
- };
2202
2170
  "workspace.select": {
2203
2171
  params: {
2204
2172
  requestId: string;
@@ -2359,5 +2327,5 @@ interface AppHostPortMessage {
2359
2327
  protocol: 1;
2360
2328
  }
2361
2329
 
2362
- export { APP_HOST_ERROR_RETRY, APP_HOST_FEATURES, APP_HOST_LOGIN_TIMEOUT_MS, APP_HOST_LOGIN_TRANSPORT_TIMEOUT_MS, APP_HOST_MAX_PAYLOAD_BYTES, APP_HOST_MAX_PENDING, APP_HOST_METHODS, APP_HOST_PORT, APP_HOST_PORT_TIMEOUT_MS, APP_HOST_PROTOCOL, APP_HOST_READY, APP_HOST_REQUEST_TIMEOUT_MS, ATTACHMENTS_METHODS, AUXILIARY_METHODS, AppHostError, BROWSER_CAPTURE_PREVIEW_MAX_BYTES, COMMANDS_METHODS, DESKTOP_METHODS, FETCH_CHUNK_BYTES, FETCH_HEADERS_TIMEOUT_MS, FETCH_IDLE_TIMEOUT_MS, FETCH_INLINE_BODY_BYTES, FETCH_MAX_STREAMS, FETCH_METADATA_BYTES, FETCH_WINDOW_CHUNKS, HOST_REQUEST_ID, RESOURCE_CATALOG_METHODS, SYSTEM_METHODS, SYSTEM_SETTINGS_SECTIONS, SYSTEM_SHORTCUT_IDS, WINDOW_METHODS, WORKBENCH_COMPUTER_FEATURE, WORKBENCH_COMPUTER_METHODS, appHostErrorMessage, canonicalDesktopRequest, createAppAttachmentsApi, createAppAuxiliarySessionsApi, createAppCommandsApi, createAppDesktopApi, createAppSystemApi, createAppWindowApi, createResourceCatalogApi, isAppHostErrorInfo, isAppLifecycleFrame, isAuxiliaryMethod, isCommandsMethod, isConversationPreparationMethod, isDesktopMethod, isPageFetchFrame, isResourceCatalogMethod, isSafeErrorDetails, isSystemMethod, isWindowMethod, isWorkbenchComputerMethod, matchAgentApiRoute, normalizeAgentApiPath, pageFetchHeadersTimeout, pageFetchPath, validAppCommandSnapshot, validAppWindowState, validAttachmentsInput, validAttachmentsResult, validAuxiliaryInput, validAuxiliaryResult, validBrowserSnapshot, validCommandInvocation, validCommandReceipt, validCommandsInput, validConversationPreparationInput, validConversationPreparationResult, validDesktopEvent, validDesktopInput, validDesktopNavigationTarget, validDesktopResult, validDesktopResultForInput, validDesktopTarget, validPresentationSnapshot, validProjectRequest, validProjectSnapshot, validResourceCatalogInput, validResourceCatalogResult, validResourceChanged, validSessionResourceInput, validSessionResourceResult, validSessionSettingsTarget, validSystemEvent, validSystemInput, validSystemResult, validWindowEvent, validWindowInput, validWindowResult, validWorkbenchComputerEvent, validWorkbenchComputerInput, validWorkbenchComputerResult, validWorkspaceInput, validWorkspaceOperation, validWorkspaceResult, workbenchComputer, workbenchComputerKey };
2363
- export type { AgentApiRoute, AnnotationMode, AnnotationRect, AnnotationTarget, AppCommandRegistration, AppCommandSnapshot, AppContext, AppHostAttachments, AppHostCommands, AppHostDesktop, AppHostErrorCode, AppHostErrorInfo, AppHostEvent, AppHostEventMessage, AppHostFeature, AppHostFileOperations, AppHostGitOperations, AppHostMethod, AppHostMethodMap, AppHostPortMessage, AppHostReadyMessage, AppHostRequest, AppHostResponse, AppHostRetry, AppHostSystem, AppHostTerminalOperations, AppHostWindow, AppLifecycleFrame, AppUnloadReason, AppWindowMaterialState, AppWindowOpenHostInput, AppWindowStartupResult, AppWindowState, AppWindowUpdateCheckResult, AppWindowUpdateState, AppearancePreferences, AttachmentsMethod, AttachmentsMethodMap, AuxiliaryMethod, AuxiliaryMethodMap, AuxiliaryOptions, AuxiliaryReceipt, AuxiliaryRequest, AuxiliarySelection, AuxiliarySessionsGroup, AuxiliaryWireRequest, BindDesktopTarget, BrowserAnnotationRecord, BrowserAnnotationSnapshot, BrowserPage, CommandInvocation, CommandReceipt, CommandsMethod, CommandsMethodMap, ConnectParams, ConversationPreparationMethod, ConversationPreparationMethodMap, DesktopComputerActivity, DesktopComputerActivityUpdate, DesktopComputerAvailability, DesktopComputerCandidate, DesktopComputerControl, DesktopComputerInteractionEvent, DesktopComputerInteractionReply, DesktopComputerPrompt, DesktopGitChange, DesktopMethod, DesktopMethodMap, DesktopNavigationTarget, DesktopOpener, DesktopRoot, DesktopSearch, DesktopTarget, DesktopTerminal, DesktopTerminalInfo, DesktopTerminalRequestOriginal, DesktopTerminalRequestReceipt, DesktopTerminalSnapshot, DesktopText, DesktopToolEvent, DesktopWindow, FetchDirection, FileOperationOriginal, GitOperationOriginal, JsonValue, LocalWorkspaceRequest, LocalWorkspaceResult, LoginResult, NavigationCompletionStatus, PageFetchFrame, PluginAppActionReceipt, PluginAppActionResponse, PluginAppCatalog, PluginAppComposerContext, PluginAppHostState, PluginAppModelContext, PluginAppMount, PluginAppPreparedMessage, PluginAppPreparedTool, PluginAppRecord, PluginAppSource, PluginAppSubmissionReceipt, PluginAppToolPolicy, PresentationSnapshot, ProjectRequest, ProjectSnapshot, ResourceCatalogMethod, ResourceCatalogMethodMap, ResourceChanged, ServiceConnectionDescriptor, ServiceStatus, ServiceWork, ServiceWorkState, SessionResourceMethod, SessionSettingsTarget, SessionSettingsWireTarget, StorageGetResult, StoredFile, SystemEvent, SystemMethod, SystemMethodMap, SystemOpenInput, SystemOpenWireInput, SystemProject, SystemRequester, SystemShortcutId, WindowMethod, WindowMethodMap, WindowRequester, WindowStateChanged, WorkbenchComputer, WorkbenchComputerEvent, WorkbenchComputerMethod, WorkbenchComputerMethodMap, WorkspaceDirectoryPage, WorkspaceFilePage, WorkspaceMethod, WorkspaceOperation, WorkspaceOperationKind, WorkspaceOperationOriginal, WorkspaceRef, WorkspaceSelection, WorkspaceText };
2330
+ export { APP_HOST_ERROR_RETRY, APP_HOST_FEATURES, APP_HOST_LOGIN_TIMEOUT_MS, APP_HOST_LOGIN_TRANSPORT_TIMEOUT_MS, APP_HOST_MAX_PAYLOAD_BYTES, APP_HOST_MAX_PENDING, APP_HOST_METHODS, APP_HOST_PORT, APP_HOST_PORT_TIMEOUT_MS, APP_HOST_PROTOCOL, APP_HOST_READY, APP_HOST_REQUEST_TIMEOUT_MS, ATTACHMENTS_METHODS, AUXILIARY_METHODS, AppHostError, BROWSER_CAPTURE_PREVIEW_MAX_BYTES, COMMANDS_METHODS, DESKTOP_METHODS, FETCH_CHUNK_BYTES, FETCH_HEADERS_TIMEOUT_MS, FETCH_IDLE_TIMEOUT_MS, FETCH_INLINE_BODY_BYTES, FETCH_MAX_STREAMS, FETCH_METADATA_BYTES, FETCH_WINDOW_CHUNKS, HOST_REQUEST_ID, RESOURCE_CATALOG_METHODS, SYSTEM_METHODS, SYSTEM_SETTINGS_SECTIONS, SYSTEM_SHORTCUT_IDS, WINDOW_METHODS, WORKBENCH_COMPUTER_FEATURE, WORKBENCH_COMPUTER_METHODS, appHostErrorMessage, canonicalDesktopRequest, createAppAttachmentsApi, createAppAuxiliarySessionsApi, createAppCommandsApi, createAppDesktopApi, createAppSystemApi, createAppWindowApi, createResourceCatalogApi, isAppHostErrorInfo, isAppLifecycleFrame, isAuxiliaryMethod, isCommandsMethod, isConversationPreparationMethod, isDesktopMethod, isPageFetchFrame, isResourceCatalogMethod, isSafeErrorDetails, isSystemMethod, isWindowMethod, isWorkbenchComputerMethod, matchAgentApiRoute, normalizeAgentApiPath, pageFetchHeadersTimeout, pageFetchPath, validAppCommandSnapshot, validAppWindowState, validAttachmentsInput, validAttachmentsResult, validAuxiliaryInput, validAuxiliaryResult, validBrowserSnapshot, validCommandInvocation, validCommandReceipt, validCommandsInput, validConversationPreparationInput, validConversationPreparationResult, validDesktopEvent, validDesktopInput, validDesktopNavigationTarget, validDesktopResult, validDesktopResultForInput, validDesktopTarget, validPresentationSnapshot, validProjectRequest, validProjectSnapshot, validResourceCatalogInput, validResourceCatalogResult, validResourceChanged, validSessionSettingsTarget, validSystemEvent, validSystemInput, validSystemResult, validWindowEvent, validWindowInput, validWindowResult, validWorkbenchComputerEvent, validWorkbenchComputerInput, validWorkbenchComputerResult, validWorkspaceInput, validWorkspaceOperation, validWorkspaceResult, workbenchComputer, workbenchComputerKey };
2331
+ export type { AgentApiRoute, AnnotationMode, AnnotationRect, AnnotationTarget, AppCommandRegistration, AppCommandSnapshot, AppContext, AppHostAttachments, AppHostCommands, AppHostDesktop, AppHostErrorCode, AppHostErrorInfo, AppHostEvent, AppHostEventMessage, AppHostFeature, AppHostFileOperations, AppHostGitOperations, AppHostMethod, AppHostMethodMap, AppHostPortMessage, AppHostReadyMessage, AppHostRequest, AppHostResponse, AppHostRetry, AppHostSystem, AppHostTerminalOperations, AppHostWindow, AppLifecycleFrame, AppUnloadReason, AppWindowMaterialState, AppWindowOpenHostInput, AppWindowStartupResult, AppWindowState, AppWindowUpdateCheckResult, AppWindowUpdateState, AppearancePreferences, AttachmentsMethod, AttachmentsMethodMap, AuxiliaryMethod, AuxiliaryMethodMap, AuxiliaryOptions, AuxiliaryReceipt, AuxiliaryRequest, AuxiliarySelection, AuxiliarySessionsGroup, AuxiliaryWireRequest, BindDesktopTarget, BrowserAnnotationRecord, BrowserAnnotationSnapshot, BrowserPage, CommandInvocation, CommandReceipt, CommandsMethod, CommandsMethodMap, ConnectParams, ConversationPreparationMethod, ConversationPreparationMethodMap, DesktopComputerActivity, DesktopComputerActivityUpdate, DesktopComputerAvailability, DesktopComputerCandidate, DesktopComputerControl, DesktopComputerInteractionEvent, DesktopComputerInteractionReply, DesktopComputerPrompt, DesktopGitChange, DesktopMethod, DesktopMethodMap, DesktopNavigationTarget, DesktopOpener, DesktopRoot, DesktopSearch, DesktopTarget, DesktopTerminal, DesktopTerminalInfo, DesktopTerminalRequestOriginal, DesktopTerminalRequestReceipt, DesktopTerminalSnapshot, DesktopText, DesktopToolEvent, DesktopWindow, FetchDirection, FileOperationOriginal, GitOperationOriginal, JsonValue, LocalWorkspaceRequest, LocalWorkspaceResult, LoginResult, NavigationCompletionStatus, PageFetchFrame, PluginAppActionReceipt, PluginAppActionResponse, PluginAppCatalog, PluginAppComposerContext, PluginAppHostState, PluginAppModelContext, PluginAppMount, PluginAppPreparedMessage, PluginAppPreparedTool, PluginAppRecord, PluginAppSource, PluginAppSubmissionReceipt, PluginAppToolPolicy, PresentationSnapshot, ProjectRequest, ProjectSnapshot, ResourceCatalogMethod, ResourceCatalogMethodMap, ResourceChanged, ServiceConnectionDescriptor, ServiceStatus, ServiceWork, ServiceWorkState, SessionSettingsTarget, SessionSettingsWireTarget, StorageGetResult, StoredFile, SystemEvent, SystemMethod, SystemMethodMap, SystemOpenInput, SystemOpenWireInput, SystemProject, SystemRequester, SystemShortcutId, WindowMethod, WindowMethodMap, WindowRequester, WindowStateChanged, WorkbenchComputer, WorkbenchComputerEvent, WorkbenchComputerMethod, WorkbenchComputerMethodMap, WorkspaceDirectoryPage, WorkspaceFilePage, WorkspaceMethod, WorkspaceOperation, WorkspaceOperationKind, WorkspaceOperationOriginal, WorkspaceRef, WorkspaceSelection, WorkspaceText };
package/dist/protocol.js CHANGED
@@ -233,7 +233,6 @@ var APP_HOST_FEATURES = [
233
233
  "service-v1",
234
234
  "extended-errors-v1",
235
235
  "workspace-v1",
236
- "session-resources-v1",
237
236
  "session-controls-v1",
238
237
  "conversation-creation-session-v1",
239
238
  "trusted-desktop-v1",
@@ -261,7 +260,7 @@ var FETCH_HEADERS_TIMEOUT_MS = 3e4;
261
260
  var FETCH_IDLE_TIMEOUT_MS = 12e4;
262
261
  function pageFetchHeadersTimeout(method, target2) {
263
262
  const path = target2.split("?", 1)[0];
264
- const preparesExtension = method === "GET" ? path === "/skills/marketplace" || path === "/plugins/marketplace/catalog" : method === "POST" && /^\/(?:skills\/marketplace\/install|plugins\/(?:archive|git|marketplace)\/(?:preview|install))$/.test(path ?? "");
263
+ const preparesExtension = method === "GET" ? path === "/skills/marketplace" || path === "/plugins/marketplace/catalog" : method === "POST" && /^\/(?:skills\/marketplace\/install|plugins\/(?:archive|git|marketplace)\/(?:preview|install)|plugins\/archive\/uploads(?:\/install)?)$/.test(path ?? "");
265
264
  return preparesExtension ? 33e4 : FETCH_HEADERS_TIMEOUT_MS;
266
265
  }
267
266
  function isPageFetchFrame(value) {
@@ -285,17 +284,17 @@ function isPageFetchFrame(value) {
285
284
  return size <= FETCH_METADATA_BYTES;
286
285
  }
287
286
  if (!entry || typeof entry !== "object") return false;
288
- const array2 = Array.isArray(entry);
289
- if (array2 ? Object.getPrototypeOf(entry) !== Array.prototype : ![Object.prototype, null].includes(Object.getPrototypeOf(entry)))
287
+ const array3 = Array.isArray(entry);
288
+ if (array3 ? Object.getPrototypeOf(entry) !== Array.prototype : ![Object.prototype, null].includes(Object.getPrototypeOf(entry)))
290
289
  return false;
291
290
  const keys2 = Reflect.ownKeys(entry);
292
- if (keys2.length > FETCH_METADATA_BYTES || array2 && keys2.length !== entry.length + 1)
291
+ if (keys2.length > FETCH_METADATA_BYTES || array3 && keys2.length !== entry.length + 1)
293
292
  return false;
294
293
  return keys2.every((key) => {
295
- if (array2 && key === "length") return true;
294
+ if (array3 && key === "length") return true;
296
295
  const d = Object.getOwnPropertyDescriptor(entry, key);
297
296
  size += typeof key === "string" ? key.length + 3 : 0;
298
- return typeof key === "string" && d.enumerable && Object.hasOwn(d, "value") && (!array2 || /^(0|[1-9][0-9]*)$/.test(key) && Number(key) < entry.length) && visit(d.value, depth + 1, depth === 0 && key === "bytes") && size <= FETCH_METADATA_BYTES;
297
+ return typeof key === "string" && d.enumerable && Object.hasOwn(d, "value") && (!array3 || /^(0|[1-9][0-9]*)$/.test(key) && Number(key) < entry.length) && visit(d.value, depth + 1, depth === 0 && key === "bytes") && size <= FETCH_METADATA_BYTES;
299
298
  });
300
299
  };
301
300
  if (!visit(value, 0) || !value || typeof value !== "object" || Array.isArray(value))
@@ -354,11 +353,14 @@ function pageFetchPath(baseUrl, input) {
354
353
 
355
354
  // ../domain-contracts/src/app-host/agent-api-policy.ts
356
355
  var routes = [
357
- { method: "POST", pattern: /^\/providers\/(manage|defaults)$/, id: "providers.manage", builtinWorkbench: true },
358
- { method: "GET", pattern: /^\/channels\/(runtime\/status|feishu(?:\/registration)?)$/, id: "channels.manage", builtinWorkbench: true },
359
- { method: "POST", pattern: /^\/channels\/(runtime\/(start|stop)|feishu\/(connect|allow|registration))$/, id: "channels.manage", builtinWorkbench: true },
360
- { method: "PATCH", pattern: /^\/channels\/feishu$/, id: "channels.manage", builtinWorkbench: true },
361
- { method: "DELETE", pattern: /^\/channels\/feishu(?:\/(allow|registration))?$/, id: "channels.manage", builtinWorkbench: true },
356
+ { method: "POST", pattern: /^\/git\/workspace\/(read|branch|branch-result)$/, id: "git.workspace" },
357
+ { method: "GET", pattern: /^\/projects\/directories$/, id: "projects.directories" },
358
+ { method: "PATCH", pattern: /^\/projects\/directories\/default-shell$/, id: "projects.directories" },
359
+ { method: "POST", pattern: /^\/providers\/(manage|defaults)$/, id: "providers.manage" },
360
+ { method: "GET", pattern: /^\/channels\/(runtime\/status|feishu(?:\/registration)?)$/, id: "channels.manage" },
361
+ { method: "POST", pattern: /^\/channels\/(runtime\/(start|stop)|feishu\/(connect|allow|registration))$/, id: "channels.manage" },
362
+ { method: "PATCH", pattern: /^\/channels\/feishu$/, id: "channels.manage" },
363
+ { method: "DELETE", pattern: /^\/channels\/feishu(?:\/(allow|registration))?$/, id: "channels.manage" },
362
364
  { method: "GET", pattern: /^\/schedules\/(status|tasks(?:\/[^/]+(?:\/run|\/runs\/[^/]+)?)?|runs)$/, id: "schedules.read" },
363
365
  { method: "POST", pattern: /^\/schedules\/tasks(?:\/[^/]+\/run)?$/, id: "schedules.create" },
364
366
  { method: "PATCH", pattern: /^\/schedules\/(tasks\/[^/]+|runs\/[^/]+\/read)$/, id: "schedules.update" },
@@ -369,10 +371,10 @@ var routes = [
369
371
  { method: "GET", pattern: /^\/skills\/marketplace$/, id: "skills.marketplace" },
370
372
  { method: "POST", pattern: /^\/skills\/marketplace\/install$/, id: "skills.marketplace" },
371
373
  { method: "DELETE", pattern: /^\/skills\/[^/]+$/, id: "skills.remove" },
372
- { method: "GET", pattern: /^\/plugins(?:\/icon|\/marketplace\/(?:catalog|sources|operations\/[^/]+))?$/, id: "plugins.manage" },
373
- { method: "POST", pattern: /^\/plugins\/(?:reload|(?:archive|git)\/(?:preview|install)|[^/]+\/(?:enable|disable)|marketplace\/(?:sources|preview|install|cancel))$/, id: "plugins.manage" },
374
+ { method: "GET", pattern: /^\/plugins(?:\/icon|\/archive\/uploads\/operations\/[^/]+|\/marketplace\/(?:catalog|sources|operations\/[^/]+))?$/, id: "plugins.manage" },
375
+ { method: "POST", pattern: /^\/plugins\/(?:reload|archive\/uploads(?:\/install)?|git\/(?:preview|install)|[^/]+\/(?:enable|disable)|marketplace\/(?:sources|preview|install|cancel))$/, id: "plugins.manage" },
374
376
  { method: "PATCH", pattern: /^\/plugins\/marketplace\/sources\/[^/]+$/, id: "plugins.manage" },
375
- { method: "DELETE", pattern: /^\/plugins\/(?:[^/]+|marketplace\/sources\/[^/]+)$/, id: "plugins.manage" },
377
+ { method: "DELETE", pattern: /^\/plugins\/(?:[^/]+|archive\/uploads\/[^/]+|marketplace\/sources\/[^/]+)$/, id: "plugins.manage" },
376
378
  { method: "GET", pattern: /^\/mcp\/config\/servers(?:\/config\/(?:entry|export|inventory))?$/, id: "mcp.config" },
377
379
  { method: "POST", pattern: /^\/mcp\/config\/servers$/, id: "mcp.config" },
378
380
  { method: "PUT", pattern: /^\/mcp\/config\/servers\/config\/entry(?:\/enabled)?$/, id: "mcp.config" },
@@ -957,7 +959,8 @@ function createClientConnection(wire, streams) {
957
959
  }
958
960
  function resolveClientConnection(connection, owner) {
959
961
  const record2 = connections.get(connection);
960
- if (!record2 || record2.owner !== owner || record2.owner.isClosed?.(record2.id)) throw new AppHostError("connection_revoked");
962
+ if (!record2 || record2.owner !== owner && record2.owner !== globalThis.window || connection.isClosed?.())
963
+ throw new AppHostError("connection_revoked");
961
964
  return record2.id;
962
965
  }
963
966
 
@@ -1252,14 +1255,8 @@ var project = { ...scope, projectId: id2, workspaceId: id2 };
1252
1255
  function validProjectRequest(value) {
1253
1256
  const action2 = value && typeof value === "object" ? Object.getOwnPropertyDescriptor(value, "action")?.value : void 0;
1254
1257
  switch (action2) {
1255
- case "list":
1256
- return object({ action: (v) => v === "list" })(value);
1257
1258
  case "register":
1258
1259
  return object({ action: (v) => v === "register", ...scope, workspaceId: id2 })(value);
1259
- case "setDefaultShell":
1260
- return object({ action: (v) => v === "setDefaultShell", ...project, shell: (v) => v === null || text(4096)(v) })(value);
1261
- case "archive":
1262
- return object({ action: (v) => v === "archive", ...project })(value);
1263
1260
  case "rebind":
1264
1261
  return object({ action: (v) => v === "rebind", ...project, previousWorkspaceId: id2, expectedPath: text(32768) })(value);
1265
1262
  default:
@@ -1279,6 +1276,7 @@ var root2 = { rootPath: text(32768) };
1279
1276
  var identity = { identity: object({ dev: text(32), ino: text(32) }) };
1280
1277
  var file = { ...root2, path: text(32768) };
1281
1278
  var write = { ...file, requestId: id, content: text(125e4, true), originalContent: text(125e4, true) };
1279
+ var gitRead = { ...identity, range: enumeration("uncommitted", "working", "staged"), ignoreWhitespace: bool };
1282
1280
  var actionOf = (value) => value && typeof value === "object" ? Object.getOwnPropertyDescriptor(value, "action")?.value : void 0;
1283
1281
  function validLocalWorkspaceRequest(value) {
1284
1282
  const action2 = actionOf(value);
@@ -1291,6 +1289,10 @@ function validLocalWorkspaceRequest(value) {
1291
1289
  return object({ ...field, ...root2 }, { ...identity, path: text(32768, true) })(value);
1292
1290
  case "find":
1293
1291
  return object({ ...field, ...root2, query: text(1024) }, identity)(value);
1292
+ case "gitChanges":
1293
+ return object({ ...field, ...root2 }, gitRead)(value);
1294
+ case "gitDiff":
1295
+ return object({ ...field, ...root2 }, { ...gitRead, path: text(32768), base: text(512), head: text(512) })(value);
1294
1296
  case "write":
1295
1297
  case "getWrite":
1296
1298
  return object({ ...field, ...write }, identity)(value);
@@ -1344,7 +1346,9 @@ var checks = {
1344
1346
  openWith: empty,
1345
1347
  copyPath: empty,
1346
1348
  listOpeners: openers,
1347
- webPreview: url
1349
+ webPreview: url,
1350
+ gitChanges: (value) => validDesktopResult("desktop.git.changes", value),
1351
+ gitDiff: (value) => validDesktopResult("desktop.git.diff", value)
1348
1352
  };
1349
1353
  function validLocalWorkspaceResult(value, action2) {
1350
1354
  return action2 ? checks[action2](value) : Object.values(checks).some((check) => check(value));
@@ -1390,7 +1394,6 @@ var SYSTEM_SHORTCUT_IDS = [
1390
1394
  var SYSTEM_METHODS = [
1391
1395
  "system.projects",
1392
1396
  "system.workspace",
1393
- "system.pickFile",
1394
1397
  "system.open",
1395
1398
  "system.getPresentationPreferences",
1396
1399
  "system.setTheme",
@@ -1491,13 +1494,6 @@ function validSystemInput(method, value) {
1491
1494
  return validProjectRequest(value);
1492
1495
  case "system.workspace":
1493
1496
  return validLocalWorkspaceRequest(value);
1494
- case "system.pickFile":
1495
- return object({}, {
1496
- filters: array(object({
1497
- name: text(100),
1498
- extensions: array((extension) => typeof extension === "string" && /^[a-z0-9][a-z0-9.-]{0,15}$/i.test(extension), 16)
1499
- }), 16)
1500
- })(value);
1501
1497
  case "system.setTheme":
1502
1498
  return object({ theme: themeMode })(value);
1503
1499
  case "system.setWindowMaterial":
@@ -1540,8 +1536,6 @@ function validSystemResult(method, value) {
1540
1536
  return validProjectSnapshot(value);
1541
1537
  case "system.workspace":
1542
1538
  return validLocalWorkspaceResult(value);
1543
- case "system.pickFile":
1544
- return nullable(text(4096))(value);
1545
1539
  case "system.open":
1546
1540
  return object({ opened: enumeration(true) })(value);
1547
1541
  case "system.getPresentationPreferences":
@@ -1581,7 +1575,6 @@ function createAppSystemApi(requester, connectionOwner) {
1581
1575
  if (!validLocalWorkspaceResult(result, input.action)) throw new AppHostError("host_unavailable");
1582
1576
  return result;
1583
1577
  }),
1584
- pickFile: (input = {}) => send("system.pickFile", input),
1585
1578
  open: (input) => {
1586
1579
  if (input.page !== "session-settings") return send("system.open", input);
1587
1580
  const { target: target2 } = input;
@@ -1608,22 +1601,6 @@ function createAppSystemApi(requester, connectionOwner) {
1608
1601
  return system;
1609
1602
  }
1610
1603
 
1611
- // src/session-resources.ts
1612
- function resourceFields(v, required, optional = []) {
1613
- if (!v || typeof v !== "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(v))) return false;
1614
- return required.every((k) => Object.hasOwn(v, k)) && Reflect.ownKeys(v).every((k) => {
1615
- const d = Object.getOwnPropertyDescriptor(v, k);
1616
- return typeof k === "string" && [...required, ...optional].includes(k) && d.enumerable && Object.hasOwn(d, "value");
1617
- });
1618
- }
1619
- var str2 = (v, max = 256) => typeof v === "string" && v.length > 0 && v.length <= max;
1620
- function validSessionResourceInput(method, v) {
1621
- return method === "getAuthorizedAgentConnection" && resourceFields(v, []);
1622
- }
1623
- function validSessionResourceResult(_method, v) {
1624
- return resourceFields(v, ["connectionId", "baseUrl"], ["defaultTaskLocation"]) && (!Object.hasOwn(v, "defaultTaskLocation") || v.defaultTaskLocation === "current" || v.defaultTaskLocation === "worktree") && str2(v.connectionId) && /^[A-Za-z0-9-]+$/.test(v.connectionId) && v.baseUrl === `https://app-host.invalid/connections/${v.connectionId}`;
1625
- }
1626
-
1627
1604
  // src/workbench-computer.ts
1628
1605
  var WORKBENCH_COMPUTER_FEATURE = "workbench-computer-v1";
1629
1606
  var workbenchComputerKey = /* @__PURE__ */ Symbol.for("nomi.workbench-computer");
@@ -1738,7 +1715,6 @@ var APP_HOST_METHODS = [
1738
1715
  "storage.get",
1739
1716
  "storage.set",
1740
1717
  "storage.delete",
1741
- "getAuthorizedAgentConnection",
1742
1718
  "service.getStatus",
1743
1719
  "service.getConnection",
1744
1720
  "service.listWork",
@@ -1846,8 +1822,6 @@ export {
1846
1822
  validResourceCatalogInput,
1847
1823
  validResourceCatalogResult,
1848
1824
  validResourceChanged,
1849
- validSessionResourceInput,
1850
- validSessionResourceResult,
1851
1825
  validSessionSettingsTarget,
1852
1826
  validSystemEvent,
1853
1827
  validSystemInput,