@bobannomi/client 0.7.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.
package/dist/service.js CHANGED
@@ -1610,12 +1610,12 @@ var require_proper_lockfile = __commonJS({
1610
1610
 
1611
1611
  // src/service/service.ts
1612
1612
  import { access, realpath, unlink } from "node:fs/promises";
1613
- import { basename as basename2, dirname as dirname3, join as join2, resolve as resolve4 } from "node:path";
1613
+ import { basename as basename2, dirname as dirname4, join as join2, resolve as resolve4 } from "node:path";
1614
1614
  import { setTimeout as sleep2 } from "node:timers/promises";
1615
1615
 
1616
1616
  // ../host-config/src/storage/paths.ts
1617
- import { basename, isAbsolute, join, parse, resolve } from "node:path";
1618
- import { userInfo } from "node:os";
1617
+ import { basename, dirname, isAbsolute, join, parse, relative, resolve, sep } from "node:path";
1618
+ import { homedir, userInfo } from "node:os";
1619
1619
  var PROJECT_CONFIG_DIR_NAME = ".bobannomi";
1620
1620
  function requireAbsoluteDataRoot(path2, source = "dataRoot") {
1621
1621
  const incompleteWindowsPath = process.platform === "win32" && (parse(path2).root.length === 1 || /^[\\/]{2}[?.][\\/]/.test(path2));
@@ -1781,6 +1781,25 @@ var ScheduleResource = class {
1781
1781
  }
1782
1782
  };
1783
1783
 
1784
+ // ../plugin-contracts/src/manifest/desktop.ts
1785
+ var DESKTOP_COMPOSER_PLACEMENTS = [
1786
+ "composer.above",
1787
+ "composer.toolbar.left",
1788
+ "composer.toolbar.right"
1789
+ ];
1790
+ var DESKTOP_PLACEMENTS = [
1791
+ "start.visual",
1792
+ "shell.floating",
1793
+ "appearance.theme",
1794
+ "shell.brand",
1795
+ "conversation.view",
1796
+ "tools.panel",
1797
+ "conversation.header.actions",
1798
+ ...DESKTOP_COMPOSER_PLACEMENTS,
1799
+ "settings.extension",
1800
+ "main.page"
1801
+ ];
1802
+
1784
1803
  // ../domain-contracts/src/sessions/records.ts
1785
1804
  var SESSION_EVENT_SCHEMA_VERSION = 1;
1786
1805
  var SESSION_EVENT_SCHEMA_VERSIONS = {
@@ -2915,7 +2934,7 @@ function parseAttachmentUploadRequest(value) {
2915
2934
  }
2916
2935
 
2917
2936
  // ../protocol/src/runtime/capabilities.ts
2918
- var CURRENT_PROTOCOL_VERSION = 7;
2937
+ var CURRENT_PROTOCOL_VERSION = 1;
2919
2938
  var PROTOCOL_VERSION_HEADER = "x-bobannomi-protocol-version";
2920
2939
  function parseServerCapabilities(value) {
2921
2940
  if (!isRecord(value))
@@ -3978,10 +3997,7 @@ async function create(transport, input, options = {}, prepareModel) {
3978
3997
  {
3979
3998
  method: "POST",
3980
3999
  body,
3981
- headers: {
3982
- ...body.workspaceId === void 0 ? {} : { "x-bobannomi-workspace-id": body.workspaceId },
3983
- ...modelConnection === void 0 ? {} : { "x-bobannomi-model-connection": modelConnection }
3984
- },
4000
+ ...modelConnection === void 0 ? {} : { headers: { "x-bobannomi-model-connection": modelConnection } },
3985
4001
  signal: options.signal
3986
4002
  }
3987
4003
  );
@@ -4693,10 +4709,9 @@ async function waitForRun(client, options) {
4693
4709
  const bucket = update.state.buckets[options.sessionId];
4694
4710
  const run = bucket?.runs[options.runId];
4695
4711
  if (!run || run.status === "pending" || run.status === "running") continue;
4696
- return {
4697
- run,
4698
- messages: getVisibleSessionMessages(bucket).filter((item) => item.message.runId === options.runId)
4699
- };
4712
+ const messages = getVisibleSessionMessages(bucket).filter((item) => item.message.runId === options.runId);
4713
+ const text3 = messages.filter(({ message }) => message.role === "assistant").flatMap(({ parts }) => parts.filter((part) => part.type === "text").map((part) => part.text ?? "")).join("");
4714
+ return { run, messages, text: text3 };
4700
4715
  }
4701
4716
  options.signal?.throwIfAborted();
4702
4717
  throw new Error(`Run ${options.runId} observation ended before a terminal state was available`);
@@ -4957,8 +4972,8 @@ async function interrupt(transport, sessionId, options = {}) {
4957
4972
  );
4958
4973
  }
4959
4974
 
4960
- // src/resources/session/session-handle.ts
4961
- function createSessionHandle(transport, syncClient, management, sessionId, prepareModel) {
4975
+ // src/resources/session/session.ts
4976
+ function bindSession(transport, syncClient, management, sessionId, prepareModel) {
4962
4977
  function cancelQueuedPrompt2(inputId, input, options) {
4963
4978
  return cancelQueuedPrompt(transport, sessionId, inputId, input, options);
4964
4979
  }
@@ -5007,7 +5022,12 @@ function createSessionHandle(transport, syncClient, management, sessionId, prepa
5007
5022
  return decodeAgentSessionStateSnapshot(response);
5008
5023
  },
5009
5024
  /** `POST /sessions/:id/prompts` — 提交用户输入并触发/排队一次 run。 */
5010
- prompt(input, options = {}) {
5025
+ async prompt(input, options) {
5026
+ if (input.text !== void 0) {
5027
+ const { text: text3, ...fields3 } = input;
5028
+ if (fields3.items !== void 0) throw new TypeError("Pass either text or items to session.prompt()");
5029
+ return admitPrompt(transport, sessionId, { ...fields3, items: [{ type: "text", text: text3 }] }, options);
5030
+ }
5011
5031
  return admitPrompt(transport, sessionId, input, options);
5012
5032
  },
5013
5033
  /** `POST /sessions/:id/interrupt` — 中断当前/排队中的 run。 */
@@ -5240,7 +5260,7 @@ var SessionResource = class {
5240
5260
  /** Bind a session ID locally. Operations use this resource's daemon connection when called. */
5241
5261
  byId(sessionId) {
5242
5262
  if (typeof sessionId !== "string" || sessionId.length === 0) throw new TypeError("sessionId is required");
5243
- return createSessionHandle(this.#transport, { sessions: this, events: this.#events }, this.#management, sessionId, this.prepareModel);
5263
+ return bindSession(this.#transport, { sessions: this, events: this.#events }, this.#management, sessionId, this.prepareModel);
5244
5264
  }
5245
5265
  /** `GET /sessions/search` - search saved conversation text without opening it. */
5246
5266
  async search(options) {
@@ -5269,9 +5289,10 @@ var SessionResource = class {
5269
5289
  getDraftComposerOptions(input, options = {}) {
5270
5290
  return getDraftComposerOptions(this.#transport, input, options);
5271
5291
  }
5272
- /** `POST /sessions` */
5273
- create(input, options = {}) {
5274
- return create(this.#transport, input, options, this.prepareModel);
5292
+ /** Create a session and bind its operations to this connection. */
5293
+ async create(input, options = {}) {
5294
+ const record4 = await create(this.#transport, input, options, this.prepareModel);
5295
+ return { ...this.byId(record4.id), record: record4 };
5275
5296
  }
5276
5297
  getConfigurationOptions(input, options = {}) {
5277
5298
  return getConfigurationOptions(this.#transport, input, options);
@@ -5287,7 +5308,7 @@ var AttachmentResource = class {
5287
5308
  this.transport = transport;
5288
5309
  }
5289
5310
  transport;
5290
- /** Manage daemon attachment storage. Ordinary session connections cannot use these methods. */
5311
+ /** Inspect and maintain attachment storage for the current daemon. */
5291
5312
  storage = {
5292
5313
  scan: (options) => this.transport.request("/attachments/storage", options),
5293
5314
  repair: (options) => this.transport.request("/attachments/storage/actions", { ...options, method: "POST", body: { action: "repair-safe" } }),
@@ -5302,19 +5323,24 @@ var AttachmentResource = class {
5302
5323
  method: "POST",
5303
5324
  headers: headers2,
5304
5325
  body: input.body,
5326
+ query: { sessionId: input.sessionId },
5305
5327
  signal: input.signal
5306
5328
  });
5307
5329
  return parseAttachmentAssetRecord(await response.json());
5308
5330
  }
5309
5331
  async getUpload(input) {
5310
- const response = await this.transport.requestResponse("/attachments/uploads", { headers: uploadIdentityHeaders(input), signal: input.signal });
5332
+ const response = await this.transport.requestResponse("/attachments/uploads", {
5333
+ headers: uploadIdentityHeaders(input),
5334
+ query: { sessionId: input.sessionId },
5335
+ signal: input.signal
5336
+ });
5311
5337
  const value = await response.json();
5312
5338
  return value === null ? null : parseAttachmentAssetRecord(value);
5313
5339
  }
5314
5340
  async get(id2, options = {}) {
5315
5341
  const value = await this.transport.request(
5316
5342
  `/attachments/${encodeURIComponent(id2)}`,
5317
- { signal: options.signal }
5343
+ { query: { sessionId: options.sessionId }, signal: options.signal }
5318
5344
  );
5319
5345
  return parseAttachmentAssetRecord(value);
5320
5346
  }
@@ -5325,13 +5351,13 @@ var AttachmentResource = class {
5325
5351
  if (range) headers2.range = range;
5326
5352
  return await this.transport.requestResponse(
5327
5353
  `/attachments/${encodeURIComponent(id2)}/content`,
5328
- { method: "GET", headers: headers2, signal: options.signal }
5354
+ { method: "GET", headers: headers2, query: { sessionId: options.sessionId }, signal: options.signal }
5329
5355
  );
5330
5356
  }
5331
- async delete(id2, options = {}) {
5357
+ async delete(id2, options) {
5332
5358
  const value = await this.transport.request(
5333
5359
  `/attachments/${encodeURIComponent(id2)}`,
5334
- { method: "DELETE", signal: options.signal }
5360
+ { method: "DELETE", query: { sessionId: options.sessionId, draftId: options.draftId }, signal: options.signal }
5335
5361
  );
5336
5362
  return parseAttachmentAssetRecord(value);
5337
5363
  }
@@ -5530,7 +5556,7 @@ var PluginMarketplaceResource = class {
5530
5556
  this.transport = transport;
5531
5557
  }
5532
5558
  transport;
5533
- catalog({ signal, ...query }) {
5559
+ catalog({ signal, ...query } = {}) {
5534
5560
  return this.transport.request(`${market}/catalog`, { query, signal });
5535
5561
  }
5536
5562
  listSources(options) {
@@ -5571,6 +5597,7 @@ function matchingOperation(receipt2, operationId) {
5571
5597
  }
5572
5598
 
5573
5599
  // src/resources/plugins/plugin-resource.ts
5600
+ var archiveUploads = "/plugins/archive/uploads";
5574
5601
  var PluginResource = class {
5575
5602
  constructor(transport) {
5576
5603
  this.transport = transport;
@@ -5579,9 +5606,13 @@ var PluginResource = class {
5579
5606
  transport;
5580
5607
  marketplace;
5581
5608
  /** List native plugins for a directory in the daemon environment. */
5582
- list({ signal, cwd }) {
5609
+ list({ signal, cwd } = {}) {
5583
5610
  return this.transport.request("/plugins", { query: { cwd }, signal });
5584
5611
  }
5612
+ /** Load an image from an installed plugin or a marketplace entry in the daemon. */
5613
+ getIcon(input, options) {
5614
+ return this.transport.request("/plugins/icon", { ...options, query: input });
5615
+ }
5585
5616
  enable(id2, input, options) {
5586
5617
  return this.transport.request(`/plugins/${encodeURIComponent(id2)}/enable`, { ...options, method: "POST", body: input });
5587
5618
  }
@@ -5612,6 +5643,37 @@ var PluginResource = class {
5612
5643
  installArchive(input, options) {
5613
5644
  return this.transport.request("/plugins/archive/install", { ...options, method: "POST", body: input });
5614
5645
  }
5646
+ /** Preview a client-selected archive by uploading its bytes to the daemon. */
5647
+ async uploadArchive(input, options) {
5648
+ const format = input.fileName.toLowerCase().match(/\.(zip|tar|tar\.gz|tgz)$/)?.[1];
5649
+ if (!format) throw new Error("Plugin archive must be ZIP, TAR, TAR.GZ or TGZ");
5650
+ const response = await this.transport.requestResponse(archiveUploads, {
5651
+ ...options,
5652
+ method: "POST",
5653
+ body: input.archive,
5654
+ query: { cwd: input.cwd, format },
5655
+ headers: { "content-type": "application/octet-stream" }
5656
+ });
5657
+ const preview = await response.json();
5658
+ if (!preview?.candidateId || !/^[a-f0-9]{64}$/.test(preview.archiveDigest)) {
5659
+ throw new ProtocolDataError("Plugin archive preview is missing its candidate ID or SHA-256 digest");
5660
+ }
5661
+ return preview;
5662
+ }
5663
+ /** Release an uploaded archive preview. Unclaimed previews also expire. */
5664
+ cancelUploadedArchive(candidateId, options) {
5665
+ return this.transport.request(`${archiveUploads}/${encodeURIComponent(candidateId)}`, { ...options, method: "DELETE" });
5666
+ }
5667
+ /** Save the operation ID before submitting. Recover an uncertain result with getArchiveInstallOperation. */
5668
+ async installUploadedArchive(input, options) {
5669
+ const receipt2 = await this.transport.request(`${archiveUploads}/install`, { ...options, method: "POST", body: input });
5670
+ return matchingArchiveReceipt(receipt2, input.operationId);
5671
+ }
5672
+ /** Read the result of the original upload install without submitting it again. */
5673
+ async getArchiveInstallOperation(operationId, options) {
5674
+ const receipt2 = await this.transport.request(`${archiveUploads}/operations/${encodeURIComponent(operationId)}`, options);
5675
+ return matchingArchiveReceipt(receipt2, operationId);
5676
+ }
5615
5677
  /** Read the digest and required permissions for a Git source. */
5616
5678
  previewGit(input, options) {
5617
5679
  return this.transport.request("/plugins/git/preview", { ...options, method: "POST", body: input });
@@ -5623,10 +5685,14 @@ var PluginResource = class {
5623
5685
  uninstall(id2, input, options) {
5624
5686
  return this.transport.request(`/plugins/${encodeURIComponent(id2)}`, { ...options, method: "DELETE", body: input });
5625
5687
  }
5626
- reload(input, options) {
5688
+ reload(input = {}, options) {
5627
5689
  return this.transport.request("/plugins/reload", { ...options, method: "POST", body: input });
5628
5690
  }
5629
5691
  };
5692
+ function matchingArchiveReceipt(receipt2, operationId) {
5693
+ if (receipt2?.operationId !== operationId) throw new ProtocolDataError("Plugin archive receipt does not match original operation", "operationId");
5694
+ return receipt2;
5695
+ }
5630
5696
 
5631
5697
  // src/resources/channels/channel-resource.ts
5632
5698
  var ChannelResource = class {
@@ -5648,7 +5714,7 @@ var ChannelResource = class {
5648
5714
  disconnect: (options) => this.transport.request("/channels/feishu", { ...options, method: "DELETE" }),
5649
5715
  allowlist: {
5650
5716
  add: (input, options) => this.transport.request("/channels/feishu/allow", { ...options, method: "POST", body: input }),
5651
- remove: (key, options) => this.transport.request(`/channels/feishu/allow/${encodeURIComponent(key)}`, { ...options, method: "DELETE" })
5717
+ remove: (key, options) => this.transport.request("/channels/feishu/allow", { ...options, method: "DELETE", query: { key } })
5652
5718
  },
5653
5719
  registration: {
5654
5720
  start: (input = {}, options) => this.transport.request("/channels/feishu/registration", { ...options, method: "POST", body: input }),
@@ -5693,6 +5759,14 @@ var ProjectResource = class {
5693
5759
  this.transport = transport;
5694
5760
  }
5695
5761
  transport;
5762
+ /** Read the daemon's registered project directories and their current directory identities. */
5763
+ listDirectories(options) {
5764
+ return this.transport.request("/projects/directories", options);
5765
+ }
5766
+ /** Apply the default shell only while the observed project and registered directory still match. */
5767
+ setDirectoryDefaultShell(input, options) {
5768
+ return this.transport.request("/projects/directories/default-shell", { ...options, method: "PATCH", body: input });
5769
+ }
5696
5770
  /** `GET /projects` */
5697
5771
  async list(options = {}) {
5698
5772
  const { signal, ...query } = options;
@@ -5702,7 +5776,7 @@ var ProjectResource = class {
5702
5776
  );
5703
5777
  return response.projects;
5704
5778
  }
5705
- /** Register or reopen a directory on the daemon host and update its last-opened time. */
5779
+ /** Register or reopen a project on the daemon host, recording the directory identity and last-opened time. */
5706
5780
  async register(path2, options) {
5707
5781
  return (await this.transport.request("/projects/inspect", {
5708
5782
  ...options,
@@ -5735,7 +5809,7 @@ var ProjectResource = class {
5735
5809
  { ...options, method: "PATCH", body: { defaultShell } }
5736
5810
  )).project;
5737
5811
  }
5738
- /** `POST /projects/:id/rebind` */
5812
+ /** Rebind a project to the current directory at path. Pass the prior project path as expectedPath to reject a stale update. */
5739
5813
  async rebind(projectId, path2, options) {
5740
5814
  const { expectedPath, signal } = typeof options === "string" ? { expectedPath: options } : options ?? {};
5741
5815
  return (await this.transport.request(
@@ -5784,11 +5858,58 @@ var WorktreeResource = class {
5784
5858
  };
5785
5859
 
5786
5860
  // src/resources/workspace/git-resource.ts
5861
+ var GitWorkspaceResource = class {
5862
+ constructor(transport, target) {
5863
+ this.transport = transport;
5864
+ this.target = target;
5865
+ }
5866
+ transport;
5867
+ target;
5868
+ status(options) {
5869
+ return this.read("git.status", {}, options);
5870
+ }
5871
+ listBranches(options) {
5872
+ return this.read("git.listBranches", {}, options);
5873
+ }
5874
+ changes(params = {}, options) {
5875
+ return this.read("git.changes", params, options);
5876
+ }
5877
+ diff(params = {}, options) {
5878
+ return this.read("git.diff", params, options);
5879
+ }
5880
+ /** Submit an original branch operation for a registered project. */
5881
+ changeBranch(requestId, original, options) {
5882
+ return this.transport.request("/git/workspace/branch", {
5883
+ ...options,
5884
+ method: "POST",
5885
+ body: { target: this.target, requestId, original }
5886
+ });
5887
+ }
5888
+ /** Query the same original body and request ID after an interrupted branch operation. */
5889
+ getBranchOperation(requestId, original, options) {
5890
+ return this.transport.request("/git/workspace/branch-result", {
5891
+ ...options,
5892
+ method: "POST",
5893
+ body: { target: this.target, requestId, original }
5894
+ });
5895
+ }
5896
+ read(method, params, options) {
5897
+ return this.transport.request("/git/workspace/read", {
5898
+ ...options,
5899
+ method: "POST",
5900
+ body: { target: this.target, method, params }
5901
+ });
5902
+ }
5903
+ };
5787
5904
  var GitResource = class {
5788
5905
  constructor(transport) {
5789
5906
  this.transport = transport;
5790
5907
  }
5791
5908
  transport;
5909
+ /** Open Git operations for a registered project or an existing session in the current daemon. */
5910
+ workspace(target) {
5911
+ return new GitWorkspaceResource(this.transport, structuredClone(target));
5912
+ }
5792
5913
  /** `GET /git/diff?cwd=&full=` */
5793
5914
  async getDiff(options) {
5794
5915
  const { signal, cwd, full } = options;
@@ -5854,6 +5975,11 @@ var McpServersResource = class {
5854
5975
  list(options) {
5855
5976
  return this.request(this.basePath, options);
5856
5977
  }
5978
+ /** List manually configured and application-registered connections without credentials. */
5979
+ async inventory(options) {
5980
+ await requireDaemonFeature(this.transport, "mcpServerInventory", options?.signal);
5981
+ return this.request(`${this.basePath}/config/inventory`, options);
5982
+ }
5857
5983
  getConfig(name, options) {
5858
5984
  return this.request(this.serverPath(name), options);
5859
5985
  }
@@ -5867,13 +5993,13 @@ var McpServersResource = class {
5867
5993
  return this.request(this.serverPath(name), { ...options, method: "PUT", body });
5868
5994
  }
5869
5995
  setEnabled({ name, enabled }, options) {
5870
- return this.request(`${this.serverPath(name)}/enabled`, { ...options, method: "PUT", body: { enabled } });
5996
+ return this.request(this.serverPath(name, "/enabled"), { ...options, method: "PUT", body: { enabled } });
5871
5997
  }
5872
5998
  remove(name, options) {
5873
5999
  return this.request(this.serverPath(name), { ...options, method: "DELETE" });
5874
6000
  }
5875
- serverPath(name) {
5876
- return `${this.basePath}/${encodeURIComponent(name)}`;
6001
+ serverPath(name, suffix = "") {
6002
+ return this.transport.path(`${this.basePath}/config/entry${suffix}`, { name });
5877
6003
  }
5878
6004
  async request(path2, options) {
5879
6005
  await requireDaemonFeature(this.transport, "mcpServerManagement", options?.signal);
@@ -5925,7 +6051,7 @@ var McpResource = class {
5925
6051
  }
5926
6052
  async startLogin(name, input, options = {}) {
5927
6053
  return await this.transport.request(
5928
- `/mcp/${encodeURIComponent(name)}/oauth/login`,
6054
+ this.transport.path("/mcp/oauth/login", { name }),
5929
6055
  { method: "POST", body: input, signal: options.signal }
5930
6056
  );
5931
6057
  }
@@ -5949,7 +6075,7 @@ var McpResource = class {
5949
6075
  }
5950
6076
  async logout(name, options = {}) {
5951
6077
  return await this.transport.request(
5952
- `/mcp/${encodeURIComponent(name)}/oauth/logout`,
6078
+ this.transport.path("/mcp/oauth/logout", { name }),
5953
6079
  { method: "POST", body: {}, signal: options.signal }
5954
6080
  );
5955
6081
  }
@@ -6091,6 +6217,8 @@ var MaintenanceResource = class {
6091
6217
  usage = {
6092
6218
  get: (input = {}, options) => this.post("/usage", input, options),
6093
6219
  getSettings: (options) => this.transport.request("/maintenance/usage/settings", options),
6220
+ /** Read whether known usage has reached the current monthly budget. */
6221
+ getBudgetStatus: (options) => this.transport.request("/maintenance/usage/budget", options),
6094
6222
  updateBudget: (input, options) => this.post("/usage/budget", input, options),
6095
6223
  addPrice: (input, options) => this.post("/usage/price", input, options)
6096
6224
  };
@@ -6193,6 +6321,58 @@ var SettingsResource = class {
6193
6321
  this.transport = transport;
6194
6322
  }
6195
6323
  transport;
6324
+ /** Runtime environment management from an existing full daemon connection. */
6325
+ runtimeEnvironment = {
6326
+ get: async ({ cwd } = {}, options) => {
6327
+ await requireDaemonFeature(this.transport, "runtimeEnvironmentSettings", options?.signal);
6328
+ return this.transport.request(this.transport.path("/settings/runtime-environment", { cwd }), options);
6329
+ },
6330
+ save: async (input, options) => {
6331
+ await requireDaemonFeature(this.transport, "runtimeEnvironmentSettings", options?.signal);
6332
+ return this.transport.request("/settings/runtime-environment", { ...options, method: "PATCH", body: input });
6333
+ },
6334
+ check: async (input, options) => {
6335
+ await requireDaemonFeature(this.transport, "runtimeEnvironmentSettings", options?.signal);
6336
+ return this.transport.request("/settings/runtime-environment/check", { ...options, method: "POST", body: input });
6337
+ }
6338
+ };
6339
+ /** Global or registered-project memory configuration from a full daemon connection. */
6340
+ personalization = {
6341
+ get: async ({ projectId } = {}, options) => {
6342
+ await requireDaemonFeature(this.transport, "personalizationSettings", options?.signal);
6343
+ return this.transport.request(this.transport.path("/settings/personalization", { projectId }), options);
6344
+ },
6345
+ save: async (input, options) => {
6346
+ await requireDaemonFeature(this.transport, "personalizationSettings", options?.signal);
6347
+ return this.transport.request("/settings/personalization", { ...options, method: "PATCH", body: input });
6348
+ }
6349
+ };
6350
+ /** Export selected non-secret settings and confirm an import preview from the same daemon. */
6351
+ portable = {
6352
+ export: async (categories, options) => {
6353
+ await requireDaemonFeature(this.transport, "portableConfigurationSettings", options?.signal);
6354
+ return this.transport.request("/settings/portable/export", { ...options, method: "POST", body: { categories } });
6355
+ },
6356
+ preview: async (value, options) => {
6357
+ await requireDaemonFeature(this.transport, "portableConfigurationSettings", options?.signal);
6358
+ return this.transport.request("/settings/portable/preview", { ...options, method: "POST", body: { value } });
6359
+ },
6360
+ apply: async ({ id: id2, categories }, options) => {
6361
+ await requireDaemonFeature(this.transport, "portableConfigurationSettings", options?.signal);
6362
+ await this.update({ importConfiguration: { previewId: id2, categories } }, options);
6363
+ }
6364
+ };
6365
+ /** Read the daemon's effective isolation availability or check a draft rule without running it. */
6366
+ permissionConfiguration = {
6367
+ get: async (options) => {
6368
+ await requireDaemonFeature(this.transport, "permissionConfigurationSettings", options?.signal);
6369
+ return this.transport.request("/settings/permissions", options);
6370
+ },
6371
+ check: async (input, options) => {
6372
+ await requireDaemonFeature(this.transport, "permissionConfigurationSettings", options?.signal);
6373
+ return this.transport.request("/settings/permissions/check", { ...options, method: "POST", body: input });
6374
+ }
6375
+ };
6196
6376
  /** Read the daemon's current global settings. */
6197
6377
  getGlobal({ signal } = {}) {
6198
6378
  return this.get({ signal });
@@ -6407,7 +6587,7 @@ var BobanNomiClient = class {
6407
6587
  import { spawn } from "node:child_process";
6408
6588
  import { createRequire } from "node:module";
6409
6589
  import { readFile } from "node:fs/promises";
6410
- import { dirname, resolve as resolve2 } from "node:path";
6590
+ import { dirname as dirname2, resolve as resolve2 } from "node:path";
6411
6591
  async function defaultCommand(cwd, dataRoot) {
6412
6592
  try {
6413
6593
  const require2 = createRequire(resolve2(cwd, "package.json"));
@@ -6415,7 +6595,7 @@ async function defaultCommand(cwd, dataRoot) {
6415
6595
  const manifest = JSON.parse(await readFile(manifestPath, "utf8"));
6416
6596
  const bin = typeof manifest.bin === "string" ? manifest.bin : manifest.bin?.nomi;
6417
6597
  if (typeof bin !== "string") throw new Error("CLI bin is missing");
6418
- return [process.execPath, resolve2(dirname(manifestPath), bin), "--data-root", dataRoot, "serve", "--register", "--host", "127.0.0.1", "--port", "0"];
6598
+ return [process.execPath, resolve2(dirname2(manifestPath), bin), "--data-root", dataRoot, "serve", "--register", "--host", "127.0.0.1", "--port", "0"];
6419
6599
  } catch {
6420
6600
  throw new Error("Cannot locate BobanNomi CLI. Pass Service.ensure({ command: [executable, ...args] }) with a built CLI.");
6421
6601
  }
@@ -6499,7 +6679,7 @@ function sameInstance(left, right) {
6499
6679
  // src/service/startup-lock.ts
6500
6680
  var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
6501
6681
  import { lstat, mkdir } from "node:fs/promises";
6502
- import { dirname as dirname2 } from "node:path";
6682
+ import { dirname as dirname3 } from "node:path";
6503
6683
  import { setTimeout as sleep } from "node:timers/promises";
6504
6684
  var startupLockPath = (file) => `${file}.sdk-start.lock`;
6505
6685
  async function hasStartupLock(file) {
@@ -6512,7 +6692,7 @@ async function hasStartupLock(file) {
6512
6692
  }
6513
6693
  }
6514
6694
  async function acquireStartupLock(file, end, signal) {
6515
- await mkdir(dirname2(file), { recursive: true });
6695
+ await mkdir(dirname3(file), { recursive: true });
6516
6696
  const compromised = new AbortController();
6517
6697
  while (Date.now() < end) {
6518
6698
  signal?.throwIfAborted();
@@ -6598,7 +6778,7 @@ async function realpathAllowMissing(path2) {
6598
6778
  try {
6599
6779
  return await realpath(path2);
6600
6780
  } catch (error) {
6601
- const parent = dirname3(path2);
6781
+ const parent = dirname4(path2);
6602
6782
  if (error.code !== "ENOENT" || parent === path2) throw error;
6603
6783
  return join2(await realpathAllowMissing(parent), basename2(path2));
6604
6784
  }