@bobannomi/app-host 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -115,18 +115,6 @@ function appHostErrorMessage(code, details) {
115
115
  return "The desktop host could not read the response stream.";
116
116
  case "response_delivery_failed":
117
117
  return "The desktop host could not deliver the response.";
118
- case "skill_marketplace_unavailable":
119
- return "\u6682\u65F6\u65E0\u6CD5\u8BFB\u53D6\u5B98\u65B9\u6280\u80FD\u5E02\u573A\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002";
120
- case "skill_marketplace_install_failed":
121
- return "\u6280\u80FD\u5B89\u88C5\u6216\u66F4\u65B0\u672A\u5B8C\u6210\uFF0C\u8BF7\u5237\u65B0\u5DF2\u5B89\u88C5\u6280\u80FD\u540E\u91CD\u8BD5\u3002";
122
- case "skill_marketplace_busy":
123
- return "\u540E\u53F0\u6B63\u5728\u8FD0\u884C\u4EFB\u52A1\u6216\u5904\u7406\u6280\u80FD\u53D8\u66F4\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002";
124
- case "skill_marketplace_local_conflict":
125
- return "\u6240\u9009\u8303\u56F4\u5185\u5DF2\u6709\u540C\u540D\u6280\u80FD\u6216\u672C\u5730\u6539\u52A8\uFF0C\u8BF7\u68C0\u67E5\u5DF2\u5B89\u88C5\u7684\u6280\u80FD\u3002";
126
- case "skill_marketplace_selection_changed":
127
- return "\u6240\u9009\u6280\u80FD\u6216\u7248\u672C\u5DF2\u53D8\u5316\uFF0C\u8BF7\u5237\u65B0\u6280\u80FD\u5E02\u573A\u540E\u91CD\u8BD5\u3002";
128
- case "skill_marketplace_project_unavailable":
129
- return "\u5F53\u524D\u9879\u76EE\u65E0\u6CD5\u5B89\u88C5\u6280\u80FD\uFF0C\u8BF7\u9009\u62E9\u5DF2\u767B\u8BB0\u7684\u9879\u76EE\u3002";
130
118
  default:
131
119
  return "The desktop host could not complete the operation.";
132
120
  }
@@ -168,7 +156,7 @@ var AppHostError = class extends Error {
168
156
  };
169
157
 
170
158
  // ../domain-contracts/src/app-host/wire-validation.ts
171
- var text = (max = 1024, empty3 = false) => (v) => typeof v === "string" && (empty3 || v.length > 0) && new TextEncoder().encode(v).byteLength <= max;
159
+ var text = (max = 1024, empty2 = false) => (v) => typeof v === "string" && (empty2 || v.length > 0) && new TextEncoder().encode(v).byteLength <= max;
172
160
  var id = (v) => typeof v === "string" && HOST_REQUEST_ID.test(v);
173
161
  var count = (v) => typeof v === "number" && Number.isSafeInteger(v) && v >= 0;
174
162
  var bool = (v) => typeof v === "boolean";
@@ -271,6 +259,11 @@ var FETCH_MAX_STREAMS = 16;
271
259
  var FETCH_METADATA_BYTES = 64 * 1024;
272
260
  var FETCH_HEADERS_TIMEOUT_MS = 3e4;
273
261
  var FETCH_IDLE_TIMEOUT_MS = 12e4;
262
+ function pageFetchHeadersTimeout(method, target2) {
263
+ 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 ?? "");
265
+ return preparesExtension ? 33e4 : FETCH_HEADERS_TIMEOUT_MS;
266
+ }
274
267
  function isPageFetchFrame(value) {
275
268
  let size = 0;
276
269
  const visit = (entry, depth, binary = false) => {
@@ -663,7 +656,7 @@ function createAppCommandsApi(rpc) {
663
656
  rpc.requireFeature();
664
657
  snapshot = structuredClone(snapshot);
665
658
  const registrationId = crypto.randomUUID();
666
- let revision3 = 0;
659
+ let revision2 = 0;
667
660
  let disposed = false;
668
661
  let remoteValid = true;
669
662
  let disposal;
@@ -671,11 +664,11 @@ function createAppCommandsApi(rpc) {
671
664
  let conflicts = [];
672
665
  let queue = Promise.resolve();
673
666
  const off = rpc.onInvoke((event) => {
674
- if (!disposed && event.registrationId === registrationId && event.revision === revision3 && current.commands.some(
667
+ if (!disposed && event.registrationId === registrationId && event.revision === revision2 && current.commands.some(
675
668
  (c) => c.id === event.commandId && c.enabled !== false
676
669
  )) {
677
670
  void Promise.resolve().then(() => {
678
- if (!disposed && event.revision === revision3)
671
+ if (!disposed && event.revision === revision2)
679
672
  return invoke(event.commandId);
680
673
  }).catch(() => {
681
674
  });
@@ -695,14 +688,14 @@ function createAppCommandsApi(rpc) {
695
688
  const call = async (method, next) => {
696
689
  const params = {
697
690
  registrationId,
698
- revision: revision3,
691
+ revision: revision2,
699
692
  ...next === void 0 ? {} : { snapshot: next }
700
693
  };
701
694
  const result = await rpc.request(
702
695
  method,
703
696
  params
704
697
  );
705
- if (!validCommandReceipt(result) || result.registrationId !== registrationId || result.revision !== revision3)
698
+ if (!validCommandReceipt(result) || result.registrationId !== registrationId || result.revision !== revision2)
706
699
  throw new AppHostError("host_unavailable");
707
700
  conflicts = [...result.shortcutConflicts ?? []];
708
701
  };
@@ -712,7 +705,7 @@ function createAppCommandsApi(rpc) {
712
705
  try {
713
706
  await rpc.request("commands.dispose", {
714
707
  registrationId,
715
- revision: ++revision3
708
+ revision: ++revision2
716
709
  });
717
710
  } catch {
718
711
  }
@@ -736,7 +729,7 @@ function createAppCommandsApi(rpc) {
736
729
  const task = queue.then(async () => {
737
730
  if (disposed) throw new AppHostError("connection_revoked");
738
731
  rpc.requireFeature();
739
- revision3++;
732
+ revision2++;
740
733
  current = next;
741
734
  try {
742
735
  await call("commands.update", next);
@@ -754,7 +747,7 @@ function createAppCommandsApi(rpc) {
754
747
  stop();
755
748
  disposal = queue.then(async () => {
756
749
  if (!remoteValid) return;
757
- revision3++;
750
+ revision2++;
758
751
  try {
759
752
  await call("commands.dispose");
760
753
  } finally {
@@ -791,7 +784,7 @@ function text2(value, limit = 256) {
791
784
  return typeof value === "string" && value.length > 0 && value.length <= limit;
792
785
  }
793
786
  function keys(value, ...names) {
794
- return Object.keys(value).length === names.length && names.every((name2) => Object.hasOwn(value, name2));
787
+ return Object.keys(value).length === names.length && names.every((name) => Object.hasOwn(value, name));
795
788
  }
796
789
  function isWorkbenchComputerMethod(method) {
797
790
  return WORKBENCH_COMPUTER_METHODS.includes(method);
@@ -879,9 +872,9 @@ function createConversationPreparationApi(rpc) {
879
872
  // src/client-connections.ts
880
873
  var connections = /* @__PURE__ */ new WeakMap();
881
874
  function createClientConnection(wire, streams) {
882
- const { connectionId, baseUrl, cwd: cwd2, defaultTaskLocation } = wire;
875
+ const { connectionId, baseUrl, cwd, defaultTaskLocation } = wire;
883
876
  const connection = {
884
- ...cwd2 === void 0 ? {} : { cwd: cwd2 },
877
+ ...cwd === void 0 ? {} : { cwd },
885
878
  ...defaultTaskLocation === void 0 ? {} : { defaultTaskLocation },
886
879
  clientOptions: { baseUrl, fetch: streams.fetchFor(connectionId, baseUrl) },
887
880
  isClosed: () => streams.isClosed?.(connectionId) === true
@@ -1056,7 +1049,7 @@ function createAppDesktopApi(rpc, owner, filesFeature = () => {
1056
1049
  if (!validDesktopResultForInput(method, params, value)) throw new AppHostError("host_unavailable");
1057
1050
  return value;
1058
1051
  };
1059
- const group = (name2) => Object.fromEntries(DESKTOP_METHODS.filter((method) => !DESKTOP_ADAPTED_METHODS.includes(method) && method.startsWith(`desktop.${name2}.`)).map((method) => [method.split(".")[2], (params) => call(method, params)]));
1052
+ const group = (name) => Object.fromEntries(DESKTOP_METHODS.filter((method) => !DESKTOP_ADAPTED_METHODS.includes(method) && method.startsWith(`desktop.${name}.`)).map((method) => [method.split(".")[2], (params) => call(method, params)]));
1060
1053
  const getOperation = async (input, validate2) => {
1061
1054
  if (!validate2(input)) throw new AppHostError("invalid_request");
1062
1055
  return call("desktop.files.getOperation", input);
@@ -1109,67 +1102,6 @@ function canonicalDesktopRequest(value) {
1109
1102
  return JSON.stringify(normalize(value));
1110
1103
  }
1111
1104
 
1112
- // src/extensions.ts
1113
- var empty = object({});
1114
- var cwd = object({ cwd: text(4096) });
1115
- var plugin = object({ cwd: text(4096), pluginId: text(256) });
1116
- var selection = object({ cwd: text(4096), selectionId: text(256) });
1117
- var cancel = object({ selectionId: text(256) });
1118
- var name = object({ name: text(256) });
1119
- var login = object({ loginId: text(256) });
1120
- var skillSelection = { id: text(64), version: text(32), sha256: digest };
1121
- var skillInstallOptions = { allowWhileRunning: bool };
1122
- var personalSkillInstall = object({ ...skillSelection, scope: enumeration("personal") }, skillInstallOptions);
1123
- var projectSkillInstall = object({
1124
- ...skillSelection,
1125
- scope: enumeration("project"),
1126
- projectPath: (value) => typeof value === "string" && value.trim().length > 0 && text(4096)(value)
1127
- }, skillInstallOptions);
1128
- var EXTENSION_INPUTS = {
1129
- context: empty,
1130
- "plugins.loadIcon": object({ src: text(8192) }),
1131
- "plugins.snapshot": cwd,
1132
- "plugins.enable": plugin,
1133
- "plugins.disable": plugin,
1134
- "plugins.uninstall": plugin,
1135
- "plugins.reload": cwd,
1136
- "plugins.importArchive": cwd,
1137
- "plugins.confirmArchive": selection,
1138
- "plugins.cancelArchive": cancel,
1139
- "plugins.importGit": object({ cwd: text(4096), url: text(8192) }, { ref: text(1024) }),
1140
- "plugins.confirmGit": selection,
1141
- "plugins.cancelGit": cancel,
1142
- "plugins.marketplaceCatalog": object({ cwd: text(4096) }, { refresh: bool }),
1143
- "plugins.marketplaceAddSource": object({ url: text(8192) }),
1144
- "plugins.marketplaceSetSourceEnabled": object({ sourceId: text(256), enabled: bool }),
1145
- "plugins.marketplaceRemoveSource": object({ sourceId: text(256) }),
1146
- "plugins.marketplacePreview": object({ cwd: text(4096), sourceId: text(256), pluginId: text(256) }, { version: text(256) }),
1147
- "plugins.marketplaceConfirm": selection,
1148
- "plugins.marketplaceCancel": cancel,
1149
- "plugins.marketplaceOperation": object({ cwd: text(4096), operationId: text(256) }),
1150
- "skills.snapshot": object({ projectPath: text(4096) }),
1151
- "skills.remove": object({ id: text(4096), expectedContent: text(8 * 1024 * 1024, true), projectPath: text(4096) }),
1152
- "skills.marketplaceCatalog": empty,
1153
- "skills.marketplaceInstall": (value) => personalSkillInstall(value) || projectSkillInstall(value),
1154
- "mcp.snapshot": empty,
1155
- "mcp.exportConfig": empty,
1156
- "mcp.getConfig": name,
1157
- "mcp.add": object({ name: text(256), config: jsonObject }),
1158
- "mcp.update": object({ name: text(256), config: jsonObject, expectedConfig: jsonObject }),
1159
- "mcp.remove": name,
1160
- "mcp.setEnabled": object({ name: text(256), enabled: bool }),
1161
- "mcp.login": object({ name: text(256), scopes: array(text(2048), 128) }),
1162
- "mcp.loginStatus": login,
1163
- "mcp.cancelLogin": login,
1164
- "mcp.logout": name
1165
- };
1166
- function validExtensionRequest(value) {
1167
- if (!object({ operation: text(128), input: jsonObject })(value)) return false;
1168
- const request = value;
1169
- return Object.hasOwn(EXTENSION_INPUTS, request.operation) && EXTENSION_INPUTS[request.operation](request.input);
1170
- }
1171
- var validExtensionResult = (value) => value === void 0 || json(value);
1172
-
1173
1105
  // src/projects.ts
1174
1106
  var id2 = text(256);
1175
1107
  var scope = { dataScopeId: id2 };
@@ -1257,7 +1189,7 @@ var found = object({ files: array(text(32768), 1e3), truncated: bool });
1257
1189
  var picked = object({ ...root2, ...identity, workspaceId: id });
1258
1190
  var url = object({ url: text(131072) });
1259
1191
  var openers = (value) => validDesktopResult("desktop.files.listOpeners", value);
1260
- var empty2 = (value) => value === void 0;
1192
+ var empty = (value) => value === void 0;
1261
1193
  var checks = {
1262
1194
  pick: nullable(picked),
1263
1195
  list: tree,
@@ -1265,9 +1197,9 @@ var checks = {
1265
1197
  read: preview,
1266
1198
  write: preview,
1267
1199
  getWrite: nullable(preview),
1268
- reveal: empty2,
1269
- openWith: empty2,
1270
- copyPath: empty2,
1200
+ reveal: empty,
1201
+ openWith: empty,
1202
+ copyPath: empty,
1271
1203
  listOpeners: openers,
1272
1204
  webPreview: url
1273
1205
  };
@@ -1275,77 +1207,6 @@ function validLocalWorkspaceResult(value, action2) {
1275
1207
  return action2 ? checks[action2](value) : Object.values(checks).some((check) => check(value));
1276
1208
  }
1277
1209
 
1278
- // ../domain-contracts/src/app-host/model-providers.ts
1279
- var provider = text(256);
1280
- var imageInputSupport = enumeration("native", "unsupported", "unknown");
1281
- var limits = { contextWindow: count, maxOutputTokens: count };
1282
- function headerValues(check) {
1283
- return (value) => {
1284
- if (!value || typeof value !== "object" || Array.isArray(value)) return false;
1285
- const keys3 = Object.keys(value);
1286
- return keys3.length <= 128 && keys3.every((key) => /^[!#$%&'*+.^_`|~0-9A-Za-z-]{1,256}$/.test(key)) && object(Object.fromEntries(keys3.map((key) => [key, check])))(value);
1287
- };
1288
- }
1289
- var headers = headerValues(text(8192, true));
1290
- var secretHeaders = headerValues(nullable(text(8192)));
1291
- var customProvider = object({
1292
- id: provider,
1293
- displayName: text(1024),
1294
- baseUrl: text(4096),
1295
- apiFormat: enumeration("openai"),
1296
- models: array(object({ id: text(1024), displayName: text(1024) }, { imageInputSupport, ...limits }), 16384)
1297
- }, { apiKey: text(8192), headers, secretHeaders });
1298
- function validModelProviderRequest(value) {
1299
- return object({ action: enumeration("list", "refresh") })(value) || object({ action: enumeration("connect"), provider, apiKey: text(8192) }, { headers, secretHeaders })(value) || object({ action: enumeration("updateHeaders"), provider, headers }, { secretHeaders })(value) || object({ action: enumeration("createCustom", "syncAccount"), value: customProvider })(value) || object({ action: enumeration("updateCustom"), provider, value: customProvider })(value) || object({ action: enumeration("disconnect", "removeCustom"), provider }, { disableDefault: bool })(value) || object({ action: enumeration("disconnect", "removeCustom"), provider, replacement: object({ provider, model: text(1024) }) })(value);
1300
- }
1301
- var validModel = object({ id: text(1024), label: text(1024) }, { imageInputSupport, declaredLimits: object({}, limits) });
1302
- var validConnection2 = object({
1303
- name: provider,
1304
- displayName: text(1024),
1305
- connected: bool,
1306
- active: bool,
1307
- credentialSource: enumeration("credentials", "environment", "subscription", "local", "configured", "none"),
1308
- models: array(validModel, 16384)
1309
- }, { source: enumeration("builtin", "catalog", "custom", "subscription"), custom: bool, credentialLabel: text(1024), baseUrl: text(4096), headers, secretHeaderNames: array(text(256), 128) });
1310
- function validModelProviderConnections(value) {
1311
- return array(validConnection2, 4096)(value);
1312
- }
1313
- var modelId = text(1024);
1314
- var effort = nullable(text(256));
1315
- var revision = text(8192);
1316
- var accountGatewayProof = (value) => typeof value === "string" && /^[a-f0-9]{64}$/.test(value);
1317
- function validProviderDefaultsRequest(value) {
1318
- return object({ action: enumeration("snapshot") }, { accountGatewayProof })(value) || object({ action: enumeration("updateModel"), model: modelId }, { provider, effort, expectedRevision: revision })(value) || object({ action: enumeration("updateEffort"), effort, expectedRevision: revision })(value) || object({ action: enumeration("test"), provider, model: modelId })(value);
1319
- }
1320
- var verifiedProvider = object({ model: modelId, checkedAt: count });
1321
- var verified = (value) => {
1322
- if (!value || typeof value !== "object" || Array.isArray(value)) return false;
1323
- const keys3 = Object.keys(value);
1324
- return keys3.length <= 4096 && keys3.every(provider) && object(Object.fromEntries(keys3.map((key) => [key, verifiedProvider])))(value);
1325
- };
1326
- var defaultsModel = object({ id: modelId, label: text(1024), provider: text(1024), providerName: provider }, {
1327
- reasoningEfforts: array(text(256, true)),
1328
- contextWindow: count,
1329
- inputModalities: array(text(256)),
1330
- inputCapabilities: object({ image: imageInputSupport })
1331
- });
1332
- var validProviderDefaultsSnapshot = object({
1333
- models: array(defaultsModel, 16384),
1334
- provider: nullable(provider),
1335
- model: nullable(modelId),
1336
- effort,
1337
- disabled: bool,
1338
- revision,
1339
- verified,
1340
- fastModeAvailable: enumeration(false),
1341
- fastModeReason: text(1024)
1342
- }, { accountGatewayMatches: bool });
1343
- var validProviderConnectionTestResult = object({
1344
- status: enumeration("verified", "failed"),
1345
- detail: text(8192),
1346
- checkedAt: count
1347
- }, { category: enumeration("authentication", "address", "network", "model", "unsupported", "service") });
1348
-
1349
1210
  // src/system.ts
1350
1211
  var SYSTEM_SETTINGS_SECTIONS = [
1351
1212
  "general",
@@ -1383,29 +1244,10 @@ var SYSTEM_SHORTCUT_IDS = [
1383
1244
  "resetZoom",
1384
1245
  "showShortcuts"
1385
1246
  ];
1386
- var CHANNEL_SETTINGS_ACTIONS = [
1387
- "snapshot",
1388
- "runtimeStatus",
1389
- "connect",
1390
- "patch",
1391
- "remove",
1392
- "allowAdd",
1393
- "allowRemove",
1394
- "startRegistration",
1395
- "registrationStatus",
1396
- "cancelRegistration",
1397
- "startRuntime",
1398
- "stopRuntime"
1399
- ];
1400
- var channelSettingsKey = /* @__PURE__ */ Symbol.for("nomi.workbench-channel-settings");
1401
- var channelSettingsValue = (value) => !!value && typeof value === "object" && !Array.isArray(value);
1402
1247
  var SYSTEM_METHODS = [
1403
1248
  "system.projects",
1404
1249
  "system.workspace",
1405
- "system.extensions",
1406
- "system.modelProviders",
1407
- "system.channelSettings",
1408
- "system.providerDefaults",
1250
+ "system.pickFile",
1409
1251
  "system.open",
1410
1252
  "system.getPresentationPreferences",
1411
1253
  "system.setTheme",
@@ -1480,7 +1322,11 @@ var validDesktopNavigationTarget = (v) => object(
1480
1322
  scheduledRunId: text(256)
1481
1323
  },
1482
1324
  { sessionId: text(256) }
1483
- )(v);
1325
+ )(v) || object({
1326
+ id: text(256),
1327
+ dataScopeId: text(256),
1328
+ kind: enumeration("extensions")
1329
+ })(v);
1484
1330
  function isSystemMethod(v) {
1485
1331
  return SYSTEM_METHODS.includes(v);
1486
1332
  }
@@ -1502,21 +1348,13 @@ function validSystemInput(method, value) {
1502
1348
  return validProjectRequest(value);
1503
1349
  case "system.workspace":
1504
1350
  return validLocalWorkspaceRequest(value);
1505
- case "system.extensions":
1506
- return validExtensionRequest(value);
1507
- case "system.modelProviders":
1508
- return validModelProviderRequest(value);
1509
- case "system.channelSettings": {
1510
- const action2 = enumeration(...CHANNEL_SETTINGS_ACTIONS);
1511
- if (object({ action: enumeration("allowRemove"), input: text() })(value)) return true;
1512
- if (object({
1513
- action: enumeration("connect", "patch", "allowAdd", "startRegistration"),
1514
- input: channelSettingsValue
1515
- })(value)) return true;
1516
- return object({ action: (entry) => action2(entry) && !["allowRemove", "connect", "patch", "allowAdd", "startRegistration"].includes(entry) })(value);
1517
- }
1518
- case "system.providerDefaults":
1519
- return validProviderDefaultsRequest(value);
1351
+ case "system.pickFile":
1352
+ return object({}, {
1353
+ filters: array(object({
1354
+ name: text(100),
1355
+ extensions: array((extension) => typeof extension === "string" && /^[a-z0-9][a-z0-9.-]{0,15}$/i.test(extension), 16)
1356
+ }), 16)
1357
+ })(value);
1520
1358
  case "system.setTheme":
1521
1359
  return object({ theme: themeMode })(value);
1522
1360
  case "system.setWindowMaterial":
@@ -1530,9 +1368,6 @@ function validSystemInput(method, value) {
1530
1368
  { page: enumeration("scheduled") },
1531
1369
  { taskId: text(256), scheduledRunId: text(256) }
1532
1370
  )(value) && (!Object.hasOwn(value, "scheduledRunId") || Object.hasOwn(value, "taskId")) || object(
1533
- { page: enumeration("extensions") },
1534
- { tab: enumeration("plugins", "skills", "mcp") }
1535
- )(value) || object(
1536
1371
  { page: enumeration("settings") },
1537
1372
  { section: enumeration(...SYSTEM_SETTINGS_SECTIONS) }
1538
1373
  )(value) || object({ page: enumeration("pet") })(value) || object(
@@ -1562,14 +1397,8 @@ function validSystemResult(method, value) {
1562
1397
  return validProjectSnapshot(value);
1563
1398
  case "system.workspace":
1564
1399
  return validLocalWorkspaceResult(value);
1565
- case "system.extensions":
1566
- return validExtensionResult(value);
1567
- case "system.modelProviders":
1568
- return validModelProviderConnections(value);
1569
- case "system.channelSettings":
1570
- return object({ value: channelSettingsValue })(value) || object({ error: enumeration("invalid_configuration", "conflict") })(value);
1571
- case "system.providerDefaults":
1572
- return validProviderDefaultsSnapshot(value) || validProviderConnectionTestResult(value);
1400
+ case "system.pickFile":
1401
+ return nullable(text(4096))(value);
1573
1402
  case "system.open":
1574
1403
  return object({ opened: enumeration(true) })(value);
1575
1404
  case "system.getPresentationPreferences":
@@ -1609,14 +1438,7 @@ function createAppSystemApi(requester, connectionOwner) {
1609
1438
  if (!validLocalWorkspaceResult(result, input.action)) throw new AppHostError("host_unavailable");
1610
1439
  return result;
1611
1440
  }),
1612
- extensions: (input) => send("system.extensions", input),
1613
- modelProviders: (input) => send("system.modelProviders", input),
1614
- providerDefaults: (async (input) => {
1615
- const result = await send("system.providerDefaults", input);
1616
- if (!(input.action === "test" ? validProviderConnectionTestResult(result) : validProviderDefaultsSnapshot(result)))
1617
- throw new AppHostError("invalid_request");
1618
- return result;
1619
- }),
1441
+ pickFile: (input = {}) => send("system.pickFile", input),
1620
1442
  open: (input) => {
1621
1443
  if (input.page !== "session-settings") return send("system.open", input);
1622
1444
  const { target: target2 } = input;
@@ -1640,9 +1462,6 @@ function createAppSystemApi(requester, connectionOwner) {
1640
1462
  navigationReady: () => send("system.navigationReady", {}),
1641
1463
  completeNavigation: (input) => send("system.completeNavigation", input)
1642
1464
  };
1643
- Object.defineProperty(system, channelSettingsKey, {
1644
- value: (input) => send("system.channelSettings", input)
1645
- });
1646
1465
  return system;
1647
1466
  }
1648
1467
 
@@ -1786,8 +1605,8 @@ function createAppAttachmentsApi(rpc, streams) {
1786
1605
 
1787
1606
  // src/auxiliary.ts
1788
1607
  var AUXILIARY_METHODS = ["sessions.getAuxiliaryOptions", "sessions.openAuxiliary", "sessions.getAuxiliary", "sessions.closeAuxiliary"];
1789
- var selection2 = object({ optionsRevision: text(), model: text(), workMode: text(), effort: text(1024, true) });
1790
- var tuple = object({ connectionId: text(), sessionId: text(), requestId: id, id: text(), selection: selection2 });
1608
+ var selection = object({ optionsRevision: text(), model: text(), workMode: text(), effort: text(1024, true) });
1609
+ var tuple = object({ connectionId: text(), sessionId: text(), requestId: id, id: text(), selection });
1791
1610
  var receipt2 = object({ requestId: id, id: text(), state: enumeration("opening", "open", "closing", "closed") }, { leaseId: text(), sessionId: text() });
1792
1611
  function isAuxiliaryMethod(method) {
1793
1612
  return AUXILIARY_METHODS.includes(method);
@@ -1944,7 +1763,7 @@ function isAppLifecycleFrame(value) {
1944
1763
  function createAppLifecycle(options) {
1945
1764
  const handlers = /* @__PURE__ */ new Set();
1946
1765
  let active;
1947
- const cancel2 = () => {
1766
+ const cancel = () => {
1948
1767
  const old = active;
1949
1768
  active = void 0;
1950
1769
  old?.controller.abort();
@@ -1962,14 +1781,14 @@ function createAppLifecycle(options) {
1962
1781
  };
1963
1782
  const finish = (pending, ready) => {
1964
1783
  if (active !== pending || pending.controller.signal.aborted) return;
1965
- if (!ready) cancel2();
1784
+ if (!ready) cancel();
1966
1785
  options.send({ protocol: 1, type: "lifecycle-result", id: pending.id, ready });
1967
1786
  };
1968
1787
  return {
1969
1788
  api,
1970
1789
  receive(frame) {
1971
1790
  if (frame.type === "lifecycle-cancel") {
1972
- if (active?.id === frame.id) cancel2();
1791
+ if (active?.id === frame.id) cancel();
1973
1792
  return;
1974
1793
  }
1975
1794
  if (active) {
@@ -1987,7 +1806,7 @@ function createAppLifecycle(options) {
1987
1806
  }))).then(() => finish(pending, true), () => finish(pending, false));
1988
1807
  },
1989
1808
  close() {
1990
- cancel2();
1809
+ cancel();
1991
1810
  handlers.clear();
1992
1811
  }
1993
1812
  };
@@ -2114,10 +1933,14 @@ function createDocumentPageFetchClient(options, getDocumentCloseError) {
2114
1933
  const touch = (s) => {
2115
1934
  if (s.stopped || closed) return;
2116
1935
  clearTimeout(s.idleTimer);
2117
- s.idleTimer = setTimeout(() => finish(s, timeout("idle_timeout"), true), FETCH_IDLE_TIMEOUT_MS);
1936
+ const deadline = s.uploadDone && !s.headers ? Math.max(FETCH_IDLE_TIMEOUT_MS, s.headersTimeoutMs + 1e3) : FETCH_IDLE_TIMEOUT_MS;
1937
+ s.idleTimer = setTimeout(() => finish(s, timeout("idle_timeout"), true), deadline);
2118
1938
  };
2119
1939
  const waitForHeaders = (s) => {
2120
- if (!s.headers) s.headTimer = setTimeout(() => finish(s, timeout("headers_timeout"), true), FETCH_HEADERS_TIMEOUT_MS);
1940
+ if (!s.headers) {
1941
+ s.headTimer = setTimeout(() => finish(s, timeout("headers_timeout"), true), s.headersTimeoutMs);
1942
+ touch(s);
1943
+ }
2121
1944
  };
2122
1945
  const shutdown = () => {
2123
1946
  if (closed) return;
@@ -2197,6 +2020,7 @@ function createDocumentPageFetchClient(options, getDocumentCloseError) {
2197
2020
  if (s.headers || message.hasBody && (s.request.method === "HEAD" || [204, 205, 304].includes(message.status))) throw error("invalid_request");
2198
2021
  s.headers = true;
2199
2022
  clearTimeout(s.headTimer);
2023
+ touch(s);
2200
2024
  const body = message.hasBody ? new ReadableStream({
2201
2025
  start(controller) {
2202
2026
  s.controller = controller;
@@ -2277,9 +2101,10 @@ function createDocumentPageFetchClient(options, getDocumentCloseError) {
2277
2101
  const request = new Request(input, init);
2278
2102
  const id3 = String(nextId + 1);
2279
2103
  let frame;
2104
+ let path;
2280
2105
  try {
2281
2106
  pageFetchPath(baseUrl, inputUrl);
2282
- pageFetchPath(baseUrl, request.url);
2107
+ path = pageFetchPath(baseUrl, request.url);
2283
2108
  if (request.signal.aborted) throw new DOMException("The operation was aborted", "AbortError");
2284
2109
  if (streams.size >= FETCH_MAX_STREAMS) throw error("invalid_request");
2285
2110
  frame = { protocol: 2, type: "fetch-open", id: id3, connectionId, url: request.url, method: request.method, headers: [...request.headers], hasBody: !!request.body };
@@ -2305,6 +2130,7 @@ function createDocumentPageFetchClient(options, getDocumentCloseError) {
2305
2130
  reject,
2306
2131
  headers: false,
2307
2132
  stopped: false,
2133
+ headersTimeoutMs: pageFetchHeadersTimeout(request.method, path),
2308
2134
  uploadDone: !request.body || frame.inlineBody !== void 0,
2309
2135
  downloadEnded: false,
2310
2136
  downloadDone: false,
@@ -2348,7 +2174,6 @@ function createDocumentPageFetchClient(options, getDocumentCloseError) {
2348
2174
  }
2349
2175
 
2350
2176
  // src/connection.ts
2351
- var SKILL_MARKETPLACE_TIMEOUT_MS = 3e5;
2352
2177
  var failure = (code) => new AppHostError(code);
2353
2178
  function invalidHostResponse(reason, frameKind, stage, operation) {
2354
2179
  const details = { reason, frameKind, stage, ...operation };
@@ -2871,11 +2696,11 @@ var DocumentConnection = class {
2871
2696
  get: (key) => this.request("storage.get", { key }),
2872
2697
  set: (key, value) => this.request("storage.set", { key, value }),
2873
2698
  delete: (key) => this.request("storage.delete", { key }),
2874
- putFile: async (name2, data) => {
2875
- if (!(data instanceof Blob) || !nonempty(name2) || data.size + new TextEncoder().encode(JSON.stringify({ name: name2 })).byteLength > APP_HOST_MAX_PAYLOAD_BYTES)
2699
+ putFile: async (name, data) => {
2700
+ if (!(data instanceof Blob) || !nonempty(name) || data.size + new TextEncoder().encode(JSON.stringify({ name })).byteLength > APP_HOST_MAX_PAYLOAD_BYTES)
2876
2701
  throw failure("invalid_request");
2877
2702
  return this.request("storage.putFile", {
2878
- name: name2,
2703
+ name,
2879
2704
  bytes: new Uint8Array(await data.arrayBuffer())
2880
2705
  });
2881
2706
  },
@@ -2931,14 +2756,8 @@ var DocumentConnection = class {
2931
2756
  const selectionRequestId = method === "workspace.select" ? params.requestId : void 0;
2932
2757
  let timeout = APP_HOST_REQUEST_TIMEOUT_MS;
2933
2758
  if (method === "workbench.computer.stopLocal") timeout = 1e3;
2934
- if (method === "auth.openLogin" || method === "workspace.select" || method === "workbench.computer.shareWindow" || method === "system.workspace" && "action" in params && params.action === "pick")
2759
+ if (method === "auth.openLogin" || method === "workspace.select" || method === "system.pickFile" || method === "workbench.computer.shareWindow" || method === "system.workspace" && "action" in params && params.action === "pick")
2935
2760
  timeout = APP_HOST_LOGIN_TRANSPORT_TIMEOUT_MS;
2936
- if (method === "system.extensions") {
2937
- const { operation } = params;
2938
- if (operation === "skills.marketplaceCatalog" || operation === "skills.marketplaceInstall") {
2939
- timeout = SKILL_MARKETPLACE_TIMEOUT_MS;
2940
- }
2941
- }
2942
2761
  return new Promise((resolve, reject) => {
2943
2762
  const id3 = String(++this.nextId);
2944
2763
  const timer = setTimeout(() => {
@@ -3106,7 +2925,7 @@ function parsePluginAppConversationInput(value) {
3106
2925
  source: parsePluginAppSource(input.source),
3107
2926
  lease: { token: identifier2(lease.token), backendGeneration: identifier2(lease.backendGeneration) },
3108
2927
  requestId: identifier2(input.requestId),
3109
- expectedRevision: revision2(input.expectedRevision),
2928
+ expectedRevision: revision(input.expectedRevision),
3110
2929
  text: input.text,
3111
2930
  data: copyPluginAppJson(input.data, PLUGIN_APP_INPUT_LIMITS.handoffBytes)
3112
2931
  };
@@ -3116,13 +2935,13 @@ function record3(value) {
3116
2935
  return value;
3117
2936
  }
3118
2937
  function fields3(value, names) {
3119
- if (Object.keys(value).length !== names.length || names.some((name2) => !Object.hasOwn(value, name2))) throw new InputError("plugin_app_invalid_request");
2938
+ if (Object.keys(value).length !== names.length || names.some((name) => !Object.hasOwn(value, name))) throw new InputError("plugin_app_invalid_request");
3120
2939
  }
3121
2940
  function identifier2(value) {
3122
2941
  if (typeof value !== "string" || !value.trim() || value.length > 1024) throw new InputError("plugin_app_invalid_request");
3123
2942
  return value;
3124
2943
  }
3125
- function revision2(value) {
2944
+ function revision(value) {
3126
2945
  if (!Number.isSafeInteger(value) || value < 0) throw new InputError("plugin_app_invalid_request");
3127
2946
  return value;
3128
2947
  }
@@ -3166,7 +2985,6 @@ function parsePluginAppComposerContexts2(value) {
3166
2985
  }
3167
2986
  export {
3168
2987
  AppHostError,
3169
- EXTENSION_INPUTS,
3170
2988
  WINDOW_METHODS,
3171
2989
  canonicalDesktopRequest,
3172
2990
  connectAppHost,
@@ -3176,8 +2994,6 @@ export {
3176
2994
  parsePluginAppComposerContexts2 as parsePluginAppComposerContexts,
3177
2995
  validAppCommandSnapshot,
3178
2996
  validAppWindowState,
3179
- validExtensionRequest,
3180
- validExtensionResult,
3181
2997
  validWindowEvent,
3182
2998
  validWindowInput,
3183
2999
  validWindowResult