buckyos 0.7.132 → 0.7.133

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/cli/dist/cli.mjs CHANGED
@@ -686,9 +686,9 @@ async function readDistributionManifest(host2 = getHost()) {
686
686
  function distributionManifestView(manifest) {
687
687
  if (!manifest)
688
688
  return null;
689
- const { npm_files: files, ...summary } = manifest;
689
+ const { npm_files: files, ...summary2 } = manifest;
690
690
  return {
691
- ...summary,
691
+ ...summary2,
692
692
  npm_file_count: Array.isArray(files) ? files.length : null
693
693
  };
694
694
  }
@@ -2499,7 +2499,7 @@ function replPrompt(config) {
2499
2499
  return `buckyos[${profile}|${zone}|${identity}]> `;
2500
2500
  }
2501
2501
  const EMPTY_INPUT$3 = { type: "object", properties: {}, additionalProperties: false };
2502
- const OBJECT_OUTPUT$b = { type: "object", additionalProperties: true };
2502
+ const OBJECT_OUTPUT$c = { type: "object", additionalProperties: true };
2503
2503
  function createAuthModule() {
2504
2504
  return {
2505
2505
  name: "auth",
@@ -2509,7 +2509,7 @@ function createAuthModule() {
2509
2509
  verb: "whoami",
2510
2510
  summary: "Show the effective principal and application identity",
2511
2511
  inputSchema: EMPTY_INPUT$3,
2512
- outputSchema: OBJECT_OUTPUT$b,
2512
+ outputSchema: OBJECT_OUTPUT$c,
2513
2513
  resultSchemaVersion: 1,
2514
2514
  access: { mode: "fixed", level: "read" },
2515
2515
  asyncMode: "sync",
@@ -2527,7 +2527,7 @@ function createAuthModule() {
2527
2527
  verb: "session-status",
2528
2528
  summary: "Show the in-memory session state without exposing credentials",
2529
2529
  inputSchema: EMPTY_INPUT$3,
2530
- outputSchema: OBJECT_OUTPUT$b,
2530
+ outputSchema: OBJECT_OUTPUT$c,
2531
2531
  resultSchemaVersion: 1,
2532
2532
  access: { mode: "fixed", level: "read" },
2533
2533
  asyncMode: "sync",
@@ -2548,7 +2548,7 @@ const EMPTY_INPUT$2 = {
2548
2548
  properties: {},
2549
2549
  additionalProperties: false
2550
2550
  };
2551
- const OBJECT_OUTPUT$a = { type: "object", additionalProperties: true };
2551
+ const OBJECT_OUTPUT$b = { type: "object", additionalProperties: true };
2552
2552
  function createCoreModules(registry) {
2553
2553
  return [createCommandModule(registry), createConfigModule(), createCompletionModule(registry)];
2554
2554
  }
@@ -2561,7 +2561,7 @@ function createCommandModule(registry) {
2561
2561
  verb: "list",
2562
2562
  summary: "List registered modules and commands",
2563
2563
  inputSchema: EMPTY_INPUT$2,
2564
- outputSchema: OBJECT_OUTPUT$a,
2564
+ outputSchema: OBJECT_OUTPUT$b,
2565
2565
  resultSchemaVersion: 1,
2566
2566
  access: { mode: "fixed", level: "read" },
2567
2567
  asyncMode: "sync",
@@ -2594,7 +2594,7 @@ function createCommandModule(registry) {
2594
2594
  required: ["target_module", "target_verb"],
2595
2595
  additionalProperties: false
2596
2596
  },
2597
- outputSchema: OBJECT_OUTPUT$a,
2597
+ outputSchema: OBJECT_OUTPUT$b,
2598
2598
  resultSchemaVersion: 1,
2599
2599
  access: { mode: "fixed", level: "read" },
2600
2600
  asyncMode: "sync",
@@ -2616,7 +2616,7 @@ function createConfigModule() {
2616
2616
  verb: "list",
2617
2617
  summary: "List the global configuration and available profiles",
2618
2618
  inputSchema: EMPTY_INPUT$2,
2619
- outputSchema: OBJECT_OUTPUT$a,
2619
+ outputSchema: OBJECT_OUTPUT$b,
2620
2620
  resultSchemaVersion: 1,
2621
2621
  access: { mode: "fixed", level: "read" },
2622
2622
  asyncMode: "sync",
@@ -2647,7 +2647,7 @@ function createConfigModule() {
2647
2647
  },
2648
2648
  additionalProperties: false
2649
2649
  },
2650
- outputSchema: OBJECT_OUTPUT$a,
2650
+ outputSchema: OBJECT_OUTPUT$b,
2651
2651
  resultSchemaVersion: 1,
2652
2652
  access: { mode: "fixed", level: "read" },
2653
2653
  asyncMode: "sync",
@@ -2693,7 +2693,7 @@ function createConfigModule() {
2693
2693
  required: ["key", "value"],
2694
2694
  additionalProperties: false
2695
2695
  },
2696
- outputSchema: OBJECT_OUTPUT$a,
2696
+ outputSchema: OBJECT_OUTPUT$b,
2697
2697
  resultSchemaVersion: 1,
2698
2698
  access: { mode: "fixed", level: "write" },
2699
2699
  asyncMode: "sync",
@@ -2733,7 +2733,7 @@ function createConfigModule() {
2733
2733
  required: ["profile_name"],
2734
2734
  additionalProperties: false
2735
2735
  },
2736
- outputSchema: OBJECT_OUTPUT$a,
2736
+ outputSchema: OBJECT_OUTPUT$b,
2737
2737
  resultSchemaVersion: 1,
2738
2738
  access: { mode: "fixed", level: "write" },
2739
2739
  asyncMode: "sync",
@@ -2765,7 +2765,7 @@ function createConfigModule() {
2765
2765
  properties: { effective: { type: "boolean" } },
2766
2766
  additionalProperties: false
2767
2767
  },
2768
- outputSchema: OBJECT_OUTPUT$a,
2768
+ outputSchema: OBJECT_OUTPUT$b,
2769
2769
  resultSchemaVersion: 1,
2770
2770
  access: { mode: "fixed", level: "read" },
2771
2771
  asyncMode: "sync",
@@ -3007,7 +3007,7 @@ async function buckyosInfo(ctx) {
3007
3007
  );
3008
3008
  }
3009
3009
  const SERVICE_NAME = "system_config";
3010
- const OBJECT_OUTPUT$9 = { type: "object", additionalProperties: false };
3010
+ const OBJECT_OUTPUT$a = { type: "object", additionalProperties: false };
3011
3011
  const KEY_INPUT = {
3012
3012
  type: "object",
3013
3013
  properties: { key: { type: "string", minLength: 1 } },
@@ -3025,7 +3025,7 @@ function createSystemConfigModule() {
3025
3025
  positionals: [{ name: "key", description: "System-config key" }],
3026
3026
  inputSchema: KEY_INPUT,
3027
3027
  outputSchema: {
3028
- ...OBJECT_OUTPUT$9,
3028
+ ...OBJECT_OUTPUT$a,
3029
3029
  properties: {
3030
3030
  key: { type: "string" },
3031
3031
  value: { type: "string" },
@@ -3068,7 +3068,7 @@ function createSystemConfigModule() {
3068
3068
  additionalProperties: false
3069
3069
  },
3070
3070
  outputSchema: {
3071
- ...OBJECT_OUTPUT$9,
3071
+ ...OBJECT_OUTPUT$a,
3072
3072
  properties: {
3073
3073
  key: { type: "string" },
3074
3074
  items: { type: "array", items: { type: "string" } }
@@ -3122,7 +3122,7 @@ function setCommand() {
3122
3122
  additionalProperties: false
3123
3123
  },
3124
3124
  outputSchema: {
3125
- ...OBJECT_OUTPUT$9,
3125
+ ...OBJECT_OUTPUT$a,
3126
3126
  properties: { key: { type: "string" }, updated: { type: "boolean" } },
3127
3127
  required: ["key", "updated"]
3128
3128
  },
@@ -3161,7 +3161,7 @@ function setFileCommand() {
3161
3161
  additionalProperties: false
3162
3162
  },
3163
3163
  outputSchema: {
3164
- ...OBJECT_OUTPUT$9,
3164
+ ...OBJECT_OUTPUT$a,
3165
3165
  properties: { key: { type: "string" }, updated: { type: "boolean" } },
3166
3166
  required: ["key", "updated"]
3167
3167
  },
@@ -3198,7 +3198,7 @@ function mutationCommand(options) {
3198
3198
  additionalProperties: false
3199
3199
  },
3200
3200
  outputSchema: {
3201
- ...OBJECT_OUTPUT$9,
3201
+ ...OBJECT_OUTPUT$a,
3202
3202
  properties: {
3203
3203
  key: { type: "string" },
3204
3204
  [options.resultProperty]: { type: "boolean" }
@@ -5106,7 +5106,7 @@ function validateContentHandlers(value, permissions) {
5106
5106
  }
5107
5107
  return value;
5108
5108
  }
5109
- const PACKAGE_VERSION = "0.7.132";
5109
+ const PACKAGE_VERSION = "0.7.133";
5110
5110
  const TOOL_VERSION = PACKAGE_VERSION;
5111
5111
  const SDK_VERSION = PACKAGE_VERSION;
5112
5112
  const PROTOCOL_VERSION = "1";
@@ -5123,7 +5123,7 @@ const VERSION$1 = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
5123
5123
  const SHA256_ID = /^sha256:[0-9a-f]{64}$/;
5124
5124
  const OBJECT_ID = /^(?:appdoc|pkg):[0-9a-f]{64}$/;
5125
5125
  const SAFE_GENERATED_FILE = /^[A-Za-z0-9._-]+$/;
5126
- const OBJECT_OUTPUT$8 = { type: "object", additionalProperties: true };
5126
+ const OBJECT_OUTPUT$9 = { type: "object", additionalProperties: true };
5127
5127
  const APP_KINDS = ["static-web", "script", "docker", "agent-skills"];
5128
5128
  const PATH_KINDS = {
5129
5129
  "static-web": { key: "web", category: "web", selectorType: "static" },
@@ -5166,7 +5166,7 @@ function createPikgModule(dependencies = {}) {
5166
5166
  properties: { meta_dir: { type: "string", minLength: 1 } },
5167
5167
  additionalProperties: false
5168
5168
  },
5169
- outputSchema: OBJECT_OUTPUT$8,
5169
+ outputSchema: OBJECT_OUTPUT$9,
5170
5170
  resultSchemaVersion: 1,
5171
5171
  access: { mode: "fixed", level: "read" },
5172
5172
  asyncMode: "sync",
@@ -5213,7 +5213,7 @@ function createPikgModule(dependencies = {}) {
5213
5213
  },
5214
5214
  additionalProperties: false
5215
5215
  },
5216
- outputSchema: OBJECT_OUTPUT$8,
5216
+ outputSchema: OBJECT_OUTPUT$9,
5217
5217
  resultSchemaVersion: 1,
5218
5218
  access: { mode: "fixed", level: "write" },
5219
5219
  asyncMode: "sync",
@@ -5238,7 +5238,7 @@ function createPikgModule(dependencies = {}) {
5238
5238
  properties: { meta_dir: { type: "string", minLength: 1 } },
5239
5239
  additionalProperties: false
5240
5240
  },
5241
- outputSchema: OBJECT_OUTPUT$8,
5241
+ outputSchema: OBJECT_OUTPUT$9,
5242
5242
  resultSchemaVersion: 1,
5243
5243
  access: { mode: "fixed", level: "write" },
5244
5244
  asyncMode: "sync",
@@ -5259,7 +5259,7 @@ function createPikgModule(dependencies = {}) {
5259
5259
  properties: { dist_dir: { type: "string", minLength: 1 } },
5260
5260
  additionalProperties: false
5261
5261
  },
5262
- outputSchema: OBJECT_OUTPUT$8,
5262
+ outputSchema: OBJECT_OUTPUT$9,
5263
5263
  resultSchemaVersion: 1,
5264
5264
  access: { mode: "fixed", level: "write" },
5265
5265
  asyncMode: "sync",
@@ -5279,7 +5279,7 @@ function createPikgModule(dependencies = {}) {
5279
5279
  required: ["pikg_path"],
5280
5280
  additionalProperties: false
5281
5281
  },
5282
- outputSchema: OBJECT_OUTPUT$8,
5282
+ outputSchema: OBJECT_OUTPUT$9,
5283
5283
  resultSchemaVersion: 1,
5284
5284
  access: { mode: "fixed", level: "read" },
5285
5285
  asyncMode: "sync",
@@ -5300,7 +5300,7 @@ function createPikgModule(dependencies = {}) {
5300
5300
  properties: { meta_dir: { type: "string", minLength: 1 } },
5301
5301
  additionalProperties: false
5302
5302
  },
5303
- outputSchema: OBJECT_OUTPUT$8,
5303
+ outputSchema: OBJECT_OUTPUT$9,
5304
5304
  resultSchemaVersion: 1,
5305
5305
  access: { mode: "fixed", level: "destructive" },
5306
5306
  asyncMode: "sync",
@@ -6563,7 +6563,7 @@ const CONTROL_PANEL_SERVICE = "control-panel";
6563
6563
  const PLAN_SCHEMA_VERSION = 4;
6564
6564
  const STAGING_RELEASE_TIMEOUT_MS = 5e3;
6565
6565
  const ZIP_LOCAL_MAGIC = [80, 75, 3, 4];
6566
- const OBJECT_OUTPUT$7 = { type: "object", additionalProperties: true };
6566
+ const OBJECT_OUTPUT$8 = { type: "object", additionalProperties: true };
6567
6567
  const INSTALL_POLICIES = [
6568
6568
  "strict-public",
6569
6569
  "normal",
@@ -6574,8 +6574,8 @@ const INSTALL_POLICIES = [
6574
6574
  function createAppModule(dependencies = {}) {
6575
6575
  const commands = [
6576
6576
  fetchCommand(dependencies),
6577
- listCommand$1(),
6578
- getCommand$1(),
6577
+ listCommand$2(),
6578
+ getCommand$2(),
6579
6579
  installCommand(dependencies),
6580
6580
  upgradeCommand(dependencies),
6581
6581
  uninstallCommand(dependencies),
@@ -6614,7 +6614,7 @@ function cancelCommand$1() {
6614
6614
  required: ["task_id"],
6615
6615
  additionalProperties: false
6616
6616
  },
6617
- outputSchema: OBJECT_OUTPUT$7,
6617
+ outputSchema: OBJECT_OUTPUT$8,
6618
6618
  resultSchemaVersion: 1,
6619
6619
  access: { mode: "fixed", level: "write" },
6620
6620
  asyncMode: "sync",
@@ -6649,7 +6649,7 @@ function fetchCommand(dependencies) {
6649
6649
  target: { type: "object", additionalProperties: true },
6650
6650
  install_params: { type: "object", additionalProperties: true }
6651
6651
  }),
6652
- outputSchema: OBJECT_OUTPUT$7,
6652
+ outputSchema: OBJECT_OUTPUT$8,
6653
6653
  resultSchemaVersion: 1,
6654
6654
  access: { mode: "fixed", level: "read" },
6655
6655
  asyncMode: "sync",
@@ -6661,12 +6661,12 @@ function fetchCommand(dependencies) {
6661
6661
  handler: async (ctx, input) => await fetchApp(ctx, input, dependencies)
6662
6662
  };
6663
6663
  }
6664
- function listCommand$1() {
6664
+ function listCommand$2() {
6665
6665
  return {
6666
6666
  verb: "list",
6667
6667
  summary: "List visible installed Apps",
6668
6668
  inputSchema: emptyInputSchema(),
6669
- outputSchema: OBJECT_OUTPUT$7,
6669
+ outputSchema: OBJECT_OUTPUT$8,
6670
6670
  resultSchemaVersion: 1,
6671
6671
  access: { mode: "fixed", level: "read" },
6672
6672
  asyncMode: "sync",
@@ -6675,7 +6675,7 @@ function listCommand$1() {
6675
6675
  handler: async (ctx) => await callControl(ctx, "apps.list", {})
6676
6676
  };
6677
6677
  }
6678
- function getCommand$1() {
6678
+ function getCommand$2() {
6679
6679
  return selectorCommand({
6680
6680
  verb: "get",
6681
6681
  summary: "Get installation and runtime details for one App",
@@ -6724,7 +6724,7 @@ function installCommand(dependencies) {
6724
6724
  no_wait: { type: "boolean" },
6725
6725
  policy: { type: "string", enum: [...INSTALL_POLICIES] }
6726
6726
  }),
6727
- outputSchema: OBJECT_OUTPUT$7,
6727
+ outputSchema: OBJECT_OUTPUT$8,
6728
6728
  resultSchemaVersion: 1,
6729
6729
  access: { mode: "fixed", level: "write" },
6730
6730
  asyncMode: "either",
@@ -6768,7 +6768,7 @@ function upgradeCommand(dependencies) {
6768
6768
  },
6769
6769
  additionalProperties: false
6770
6770
  },
6771
- outputSchema: OBJECT_OUTPUT$7,
6771
+ outputSchema: OBJECT_OUTPUT$8,
6772
6772
  resultSchemaVersion: 1,
6773
6773
  access: { mode: "fixed", level: "write" },
6774
6774
  asyncMode: "either",
@@ -6821,11 +6821,11 @@ function uninstallCommand(dependencies) {
6821
6821
  examples: ["buckyos app uninstall app1 --data retain"]
6822
6822
  };
6823
6823
  }
6824
- function lifecycleCommand(verb, summary) {
6824
+ function lifecycleCommand(verb, summary2) {
6825
6825
  return {
6826
6826
  ...selectorCommand({
6827
6827
  verb,
6828
- summary,
6828
+ summary: summary2,
6829
6829
  access: "write",
6830
6830
  asyncMode: verb === "start" ? "task" : "either",
6831
6831
  handler: async (ctx, input) => await mutateLifecycle(ctx, input, verb)
@@ -6897,7 +6897,7 @@ function statusCommand$1() {
6897
6897
  properties: { app_name: { type: "string", minLength: 1 } },
6898
6898
  additionalProperties: false
6899
6899
  },
6900
- outputSchema: OBJECT_OUTPUT$7,
6900
+ outputSchema: OBJECT_OUTPUT$8,
6901
6901
  resultSchemaVersion: 1,
6902
6902
  access: { mode: "fixed", level: "read" },
6903
6903
  asyncMode: "sync",
@@ -6911,10 +6911,10 @@ function statusCommand$1() {
6911
6911
  callControl(ctx, "apps.details", { selector })
6912
6912
  ]);
6913
6913
  const detailObject = expectObject$1(details, "apps.details response");
6914
- const summary = expectObject$1(detailObject.summary, "apps.details summary");
6914
+ const summary2 = expectObject$1(detailObject.summary, "apps.details summary");
6915
6915
  return {
6916
6916
  ...expectObject$1(status, "apps.status response"),
6917
- web_hosts: Array.isArray(summary.web_hosts) ? summary.web_hosts : []
6917
+ web_hosts: Array.isArray(summary2.web_hosts) ? summary2.web_hosts : []
6918
6918
  };
6919
6919
  }
6920
6920
  const listed = expectObject$1(await callControl(ctx, "apps.list", {}), "apps.list response");
@@ -6968,7 +6968,7 @@ function publishCommand() {
6968
6968
  required: ["local_dir", "app_doc"],
6969
6969
  additionalProperties: false
6970
6970
  },
6971
- outputSchema: OBJECT_OUTPUT$7,
6971
+ outputSchema: OBJECT_OUTPUT$8,
6972
6972
  resultSchemaVersion: 1,
6973
6973
  access: { mode: "fixed", level: "write" },
6974
6974
  asyncMode: "sync",
@@ -7485,7 +7485,7 @@ async function stagePikg(ctx, snapshot, purpose) {
7485
7485
  throw new ToolError("AUTH_REQUIRED", "authenticated session is required", 3);
7486
7486
  const token = (await session.ensureValid()).token;
7487
7487
  const proxy = ndm_proxy.createNdmProxyClient({
7488
- endpoint: gatewayOrigin(ctx.connection.endpoint),
7488
+ endpoint: gatewayOrigin$1(ctx.connection.endpoint),
7489
7489
  sessionToken: token,
7490
7490
  fetcher: (request, init) => fetch(normalizeNdmRequestUrl(request), { ...init, signal: ctx.signal })
7491
7491
  });
@@ -7649,8 +7649,8 @@ async function observeInstallTask(ctx, taskId) {
7649
7649
  data: status
7650
7650
  };
7651
7651
  }
7652
- async function confirmChange(ctx, action, summary) {
7653
- await ctx.io.stderr(`${JSON.stringify({ action, preflight: summary }, null, 2)}
7652
+ async function confirmChange(ctx, action, summary2) {
7653
+ await ctx.io.stderr(`${JSON.stringify({ action, preflight: summary2 }, null, 2)}
7654
7654
  `);
7655
7655
  if (ctx.confirmed)
7656
7656
  return;
@@ -8022,7 +8022,7 @@ function validatePikgSnapshot(bytes) {
8022
8022
  throw new UsageError("INVALID_PIKG", "PIKG magic mismatch: expected a ZIP container");
8023
8023
  }
8024
8024
  }
8025
- function gatewayOrigin(endpoint) {
8025
+ function gatewayOrigin$1(endpoint) {
8026
8026
  const url = new URL(endpoint);
8027
8027
  const marker = url.pathname.indexOf("/kapi");
8028
8028
  url.pathname = marker >= 0 ? url.pathname.slice(0, marker) || "/" : "/";
@@ -8094,7 +8094,7 @@ function selectorCommand(options) {
8094
8094
  required: ["app_name"],
8095
8095
  additionalProperties: false
8096
8096
  },
8097
- outputSchema: OBJECT_OUTPUT$7,
8097
+ outputSchema: OBJECT_OUTPUT$8,
8098
8098
  resultSchemaVersion: 1,
8099
8099
  access: { mode: "fixed", level: options.access },
8100
8100
  asyncMode: options.asyncMode,
@@ -8258,7 +8258,7 @@ function toHex(bytes) {
8258
8258
  return [...bytes].map((byte) => byte.toString(16).padStart(2, "0")).join("");
8259
8259
  }
8260
8260
  const CONTROL_PANEL$3 = "control-panel";
8261
- const OBJECT_OUTPUT$6 = { type: "object", additionalProperties: true };
8261
+ const OBJECT_OUTPUT$7 = { type: "object", additionalProperties: true };
8262
8262
  function createDiagnosticModule(dependencies = {}) {
8263
8263
  return {
8264
8264
  name: "diagnostic",
@@ -8297,7 +8297,7 @@ function collectCommand() {
8297
8297
  required: ["services"],
8298
8298
  additionalProperties: false
8299
8299
  },
8300
- outputSchema: OBJECT_OUTPUT$6,
8300
+ outputSchema: OBJECT_OUTPUT$7,
8301
8301
  resultSchemaVersion: 1,
8302
8302
  access: { mode: "fixed", level: "privileged" },
8303
8303
  asyncMode: "task",
@@ -8351,7 +8351,7 @@ function exportCommand$1(dependencies) {
8351
8351
  required: ["bundle_id", "path"],
8352
8352
  additionalProperties: false
8353
8353
  },
8354
- outputSchema: OBJECT_OUTPUT$6,
8354
+ outputSchema: OBJECT_OUTPUT$7,
8355
8355
  resultSchemaVersion: 1,
8356
8356
  access: { mode: "fixed", level: "privileged" },
8357
8357
  asyncMode: "sync",
@@ -8393,7 +8393,7 @@ function compact$2(value) {
8393
8393
  return Object.fromEntries(Object.entries(value).filter(([, item]) => item !== void 0));
8394
8394
  }
8395
8395
  const CONTROL_PANEL$2 = "control-panel";
8396
- const OBJECT_OUTPUT$5 = { type: "object", additionalProperties: true };
8396
+ const OBJECT_OUTPUT$6 = { type: "object", additionalProperties: true };
8397
8397
  const LOG_LEVELS = ["error", "warning", "info", "debug", "trace"];
8398
8398
  function createLogModule(dependencies = {}) {
8399
8399
  return {
@@ -8414,7 +8414,7 @@ function servicesCommand() {
8414
8414
  inputSchema: { type: "object", properties: {}, additionalProperties: false },
8415
8415
  outputSchema: {
8416
8416
  type: "object",
8417
- properties: { services: { type: "array", items: OBJECT_OUTPUT$5 } },
8417
+ properties: { services: { type: "array", items: OBJECT_OUTPUT$6 } },
8418
8418
  required: ["services"],
8419
8419
  additionalProperties: false
8420
8420
  },
@@ -8487,7 +8487,7 @@ function tailCommand(dependencies) {
8487
8487
  }
8488
8488
  ],
8489
8489
  inputSchema: filterSchema({ from: { type: "string", enum: ["start", "end"] } }),
8490
- outputSchema: OBJECT_OUTPUT$5,
8490
+ outputSchema: OBJECT_OUTPUT$6,
8491
8491
  resultSchemaVersion: 1,
8492
8492
  access: { mode: "fixed", level: "read" },
8493
8493
  asyncMode: "stream",
@@ -8543,7 +8543,7 @@ function exportCommand(dependencies) {
8543
8543
  ...filterSchema({ path: { type: "string", minLength: 1 } }),
8544
8544
  required: ["path"]
8545
8545
  },
8546
- outputSchema: OBJECT_OUTPUT$5,
8546
+ outputSchema: OBJECT_OUTPUT$6,
8547
8547
  resultSchemaVersion: 1,
8548
8548
  access: { mode: "fixed", level: "read" },
8549
8549
  asyncMode: "sync",
@@ -8695,15 +8695,15 @@ function abortableSleep(milliseconds, signal) {
8695
8695
  }
8696
8696
  const TASK_MANAGER = "task-manager";
8697
8697
  const CONTROL_PANEL$1 = "control-panel";
8698
- const OBJECT_OUTPUT$4 = { type: "object", additionalProperties: true };
8698
+ const OBJECT_OUTPUT$5 = { type: "object", additionalProperties: true };
8699
8699
  function createTaskModule() {
8700
8700
  return {
8701
8701
  name: "task",
8702
8702
  summary: "Inspect, wait for, cancel, and retry durable Tasks",
8703
- commands: [listCommand(), getCommand(), waitCommand(), cancelCommand(), retryCommand()]
8703
+ commands: [listCommand$1(), getCommand$1(), waitCommand(), cancelCommand(), retryCommand()]
8704
8704
  };
8705
8705
  }
8706
- function listCommand() {
8706
+ function listCommand$1() {
8707
8707
  return {
8708
8708
  verb: "list",
8709
8709
  summary: "List visible Tasks",
@@ -8769,7 +8769,7 @@ function listCommand() {
8769
8769
  }
8770
8770
  };
8771
8771
  }
8772
- function getCommand() {
8772
+ function getCommand$1() {
8773
8773
  return {
8774
8774
  verb: "get",
8775
8775
  summary: "Get one Task snapshot and its direct children",
@@ -8798,7 +8798,7 @@ function getCommand() {
8798
8798
  required: ["task_id"],
8799
8799
  additionalProperties: false
8800
8800
  },
8801
- outputSchema: OBJECT_OUTPUT$4,
8801
+ outputSchema: OBJECT_OUTPUT$5,
8802
8802
  resultSchemaVersion: 1,
8803
8803
  access: { mode: "fixed", level: "read" },
8804
8804
  asyncMode: "sync",
@@ -8839,7 +8839,7 @@ function waitCommand() {
8839
8839
  summary: "Stream changes until a Task becomes terminal",
8840
8840
  positionals: [{ name: "task_id", description: "Opaque Task ID", required: true }],
8841
8841
  inputSchema: taskIdSchema(),
8842
- outputSchema: OBJECT_OUTPUT$4,
8842
+ outputSchema: OBJECT_OUTPUT$5,
8843
8843
  resultSchemaVersion: 1,
8844
8844
  access: { mode: "fixed", level: "read" },
8845
8845
  asyncMode: "stream",
@@ -8890,7 +8890,7 @@ function cancelCommand() {
8890
8890
  required: ["task_id"],
8891
8891
  additionalProperties: false
8892
8892
  },
8893
- outputSchema: OBJECT_OUTPUT$4,
8893
+ outputSchema: OBJECT_OUTPUT$5,
8894
8894
  resultSchemaVersion: 1,
8895
8895
  access: { mode: "fixed", level: "write" },
8896
8896
  asyncMode: "sync",
@@ -8933,7 +8933,7 @@ function retryCommand() {
8933
8933
  required: ["task_id"],
8934
8934
  additionalProperties: false
8935
8935
  },
8936
- outputSchema: OBJECT_OUTPUT$4,
8936
+ outputSchema: OBJECT_OUTPUT$5,
8937
8937
  resultSchemaVersion: 1,
8938
8938
  access: { mode: "fixed", level: "write" },
8939
8939
  asyncMode: "either",
@@ -9007,7 +9007,7 @@ function invalidResponse$1(label) {
9007
9007
  throw new ToolError("INVALID_SERVICE_RESPONSE", `${label} is invalid`, EXIT_INTERNAL);
9008
9008
  }
9009
9009
  const sdk = provisionSdk;
9010
- const OBJECT_OUTPUT$3 = { type: "object", additionalProperties: true };
9010
+ const OBJECT_OUTPUT$4 = { type: "object", additionalProperties: true };
9011
9011
  const ROOT_OPTION = {
9012
9012
  name: "root",
9013
9013
  description: "Installed BuckyOS root on this machine (BUCKYOS_ROOT); read by status/check, written by activate",
@@ -9091,7 +9091,7 @@ function statusCommand(deps) {
9091
9091
  additionalProperties: false
9092
9092
  },
9093
9093
  outputSchema: {
9094
- ...OBJECT_OUTPUT$3,
9094
+ ...OBJECT_OUTPUT$4,
9095
9095
  properties: {
9096
9096
  root: { type: "string" },
9097
9097
  state: {
@@ -9129,7 +9129,7 @@ function checkCommand(deps) {
9129
9129
  additionalProperties: false
9130
9130
  },
9131
9131
  outputSchema: {
9132
- ...OBJECT_OUTPUT$3,
9132
+ ...OBJECT_OUTPUT$4,
9133
9133
  properties: {
9134
9134
  ready: { type: "boolean" },
9135
9135
  root: { type: "string" },
@@ -9177,7 +9177,7 @@ function activateCommand(deps) {
9177
9177
  additionalProperties: false
9178
9178
  },
9179
9179
  outputSchema: {
9180
- ...OBJECT_OUTPUT$3,
9180
+ ...OBJECT_OUTPUT$4,
9181
9181
  properties: {
9182
9182
  root: { type: "string" },
9183
9183
  state: { type: "string", enum: ["configured"] },
@@ -9459,7 +9459,7 @@ function inputFingerprint(input) {
9459
9459
  hash.update(new TextEncoder().encode(JSON.stringify(material)));
9460
9460
  return hash.digestHex();
9461
9461
  }
9462
- const OBJECT_OUTPUT$2 = { type: "object", additionalProperties: true };
9462
+ const OBJECT_OUTPUT$3 = { type: "object", additionalProperties: true };
9463
9463
  const SKILL_KINDS = ["cmd", "goal"];
9464
9464
  const SKILLS_SUB_PKG = "agent_skills";
9465
9465
  const SKILL_DIRS = ["cmd_skills", "goal_skills", "tools"];
@@ -9496,7 +9496,7 @@ function createSkillModule() {
9496
9496
  required: ["agent_id"],
9497
9497
  additionalProperties: false
9498
9498
  },
9499
- outputSchema: OBJECT_OUTPUT$2,
9499
+ outputSchema: OBJECT_OUTPUT$3,
9500
9500
  resultSchemaVersion: 1,
9501
9501
  access: { mode: "fixed", level: "read" },
9502
9502
  asyncMode: "sync",
@@ -9535,7 +9535,7 @@ function createSkillModule() {
9535
9535
  required: ["pikg_path", "agent_id"],
9536
9536
  additionalProperties: false
9537
9537
  },
9538
- outputSchema: OBJECT_OUTPUT$2,
9538
+ outputSchema: OBJECT_OUTPUT$3,
9539
9539
  resultSchemaVersion: 1,
9540
9540
  access: { mode: "fixed", level: "write" },
9541
9541
  asyncMode: "sync",
@@ -9562,7 +9562,7 @@ function createSkillModule() {
9562
9562
  required: ["name", "agent_id"],
9563
9563
  additionalProperties: false
9564
9564
  },
9565
- outputSchema: OBJECT_OUTPUT$2,
9565
+ outputSchema: OBJECT_OUTPUT$3,
9566
9566
  resultSchemaVersion: 1,
9567
9567
  access: { mode: "fixed", level: "destructive" },
9568
9568
  asyncMode: "sync",
@@ -9683,7 +9683,7 @@ function base64(bytes) {
9683
9683
  return btoa(binary);
9684
9684
  }
9685
9685
  const CONTROL_PANEL = "control-panel";
9686
- const OBJECT_OUTPUT$1 = { type: "object", additionalProperties: true };
9686
+ const OBJECT_OUTPUT$2 = { type: "object", additionalProperties: true };
9687
9687
  const AGENT_POSITIONAL = {
9688
9688
  name: "agent_id",
9689
9689
  description: "Agent ID as `agent list` prints it (raw host name, e.g. jarvis.example.zone)"
@@ -9707,7 +9707,7 @@ function createAgentModule() {
9707
9707
  inputSchema: { type: "object", properties: {}, additionalProperties: false },
9708
9708
  outputSchema: {
9709
9709
  type: "object",
9710
- properties: { agents: { type: "array", items: OBJECT_OUTPUT$1 } },
9710
+ properties: { agents: { type: "array", items: OBJECT_OUTPUT$2 } },
9711
9711
  required: ["agents"],
9712
9712
  additionalProperties: false
9713
9713
  },
@@ -9733,7 +9733,7 @@ function createAgentModule() {
9733
9733
  summary: "Get one Agent: profile, settings, install state, template, and runtime",
9734
9734
  positionals: [AGENT_POSITIONAL],
9735
9735
  inputSchema: AGENT_INPUT,
9736
- outputSchema: OBJECT_OUTPUT$1,
9736
+ outputSchema: OBJECT_OUTPUT$2,
9737
9737
  resultSchemaVersion: 1,
9738
9738
  access: { mode: "fixed", level: "read" },
9739
9739
  asyncMode: "sync",
@@ -9746,7 +9746,7 @@ function createAgentModule() {
9746
9746
  summary: "Get the public profile (display name, bio, avatar) of an Agent",
9747
9747
  positionals: [AGENT_POSITIONAL],
9748
9748
  inputSchema: AGENT_INPUT,
9749
- outputSchema: OBJECT_OUTPUT$1,
9749
+ outputSchema: OBJECT_OUTPUT$2,
9750
9750
  resultSchemaVersion: 1,
9751
9751
  access: { mode: "fixed", level: "read" },
9752
9752
  asyncMode: "sync",
@@ -9787,8 +9787,8 @@ function createAgentModule() {
9787
9787
  type: "object",
9788
9788
  properties: {
9789
9789
  agent_id: { type: "string" },
9790
- before: OBJECT_OUTPUT$1,
9791
- profile: OBJECT_OUTPUT$1
9790
+ before: OBJECT_OUTPUT$2,
9791
+ profile: OBJECT_OUTPUT$2
9792
9792
  },
9793
9793
  required: ["agent_id", "before", "profile"],
9794
9794
  additionalProperties: false
@@ -9833,7 +9833,7 @@ async function callAgent(ctx, method, params) {
9833
9833
  }
9834
9834
  }
9835
9835
  const AICC = "aicc";
9836
- const OBJECT_OUTPUT = { type: "object", additionalProperties: true };
9836
+ const OBJECT_OUTPUT$1 = { type: "object", additionalProperties: true };
9837
9837
  const EMPTY_INPUT = { type: "object", properties: {}, additionalProperties: false };
9838
9838
  const RANGES = ["last1d", "last7d", "last30d"];
9839
9839
  const GROUPS = [
@@ -9873,7 +9873,7 @@ function readCommand(options) {
9873
9873
  summary: options.summary,
9874
9874
  description: options.description,
9875
9875
  inputSchema: EMPTY_INPUT,
9876
- outputSchema: OBJECT_OUTPUT,
9876
+ outputSchema: OBJECT_OUTPUT$1,
9877
9877
  resultSchemaVersion: 1,
9878
9878
  access: { mode: "fixed", level: "read" },
9879
9879
  asyncMode: "sync",
@@ -9925,7 +9925,7 @@ function usageCommand() {
9925
9925
  },
9926
9926
  additionalProperties: false
9927
9927
  },
9928
- outputSchema: OBJECT_OUTPUT,
9928
+ outputSchema: OBJECT_OUTPUT$1,
9929
9929
  resultSchemaVersion: 1,
9930
9930
  access: { mode: "fixed", level: "read" },
9931
9931
  asyncMode: "sync",
@@ -9970,6 +9970,350 @@ function timeRange(input) {
9970
9970
  }
9971
9971
  return { kind: "explicit", start_time_ms: since, end_time_ms: until ?? Date.now() };
9972
9972
  }
9973
+ const OBJECT_OUTPUT = { type: "object", additionalProperties: true };
9974
+ const DAY_MS = 864e5;
9975
+ const EXPIRES_HELP = "1d, 7d (default), 30d, none, or an RFC 3339 time";
9976
+ function createShareModule() {
9977
+ return {
9978
+ name: "share",
9979
+ summary: "Share files and folders as links, and manage what you have shared",
9980
+ commands: [
9981
+ createCommand(),
9982
+ listCommand(),
9983
+ getCommand(),
9984
+ updateCommand(),
9985
+ stopCommand(),
9986
+ statsCommand()
9987
+ ]
9988
+ };
9989
+ }
9990
+ async function openNfsp(ctx) {
9991
+ const session = ctx.session;
9992
+ if (!session)
9993
+ throw new ToolError("AUTH_REQUIRED", "authenticated session is required", 3);
9994
+ const token = (await session.ensureValid()).token;
9995
+ const base = gatewayOrigin(ctx.connection.endpoint);
9996
+ let seq = 0;
9997
+ const post = async (method, body) => {
9998
+ const response = await fetch(`${base}/nfs/v1/${method}`, {
9999
+ method: "POST",
10000
+ headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}` },
10001
+ body: JSON.stringify(body),
10002
+ signal: ctx.signal
10003
+ });
10004
+ let parsed;
10005
+ try {
10006
+ parsed = await response.json();
10007
+ } catch {
10008
+ throw new ToolError("INVALID_SERVICE_RESPONSE", `file service answered HTTP ${response.status}`, EXIT_INTERNAL);
10009
+ }
10010
+ if (parsed.ok !== true) {
10011
+ const error = parsed.error ?? {};
10012
+ const reason = typeof error.reason === "string" ? error.reason.toUpperCase() : String(error.code ?? "INTERNAL");
10013
+ throw new ToolError(`SHARE_${reason}`, String(error.message ?? "share request failed"));
10014
+ }
10015
+ return expectObject$4(parsed.result, `${method} result`);
10016
+ };
10017
+ const hello = await post("hello", { args: { versions: ["nfsp/0"] } });
10018
+ const sessionId = String(hello.session ?? "");
10019
+ if (!Array.isArray(hello.features) || !hello.features.includes("share")) {
10020
+ throw new ToolError("SHARE_UNSUPPORTED", "the file service of this Zone does not support sharing");
10021
+ }
10022
+ return {
10023
+ call: (method, args, write = false) => post(method, { session: sessionId, args: { ...args, source_hint: "cli" }, ...write ? { seq: ++seq } : {} })
10024
+ };
10025
+ }
10026
+ function gatewayOrigin(endpoint) {
10027
+ const url = new URL(endpoint);
10028
+ const marker = url.pathname.indexOf("/kapi");
10029
+ url.pathname = marker >= 0 ? url.pathname.slice(0, marker) || "/" : "/";
10030
+ url.search = "";
10031
+ url.hash = "";
10032
+ return url.toString().replace(/\/$/, "");
10033
+ }
10034
+ function parseExpires(value) {
10035
+ if (value === void 0)
10036
+ return void 0;
10037
+ const text = String(value).trim().toLowerCase();
10038
+ if (text === "none" || text === "never")
10039
+ return null;
10040
+ const days = text.match(/^(\d+)d$/);
10041
+ if (days)
10042
+ return Math.floor((Date.now() + Number(days[1]) * DAY_MS) / 1e3);
10043
+ const at = parseTimestamp(value, "expires");
10044
+ if (at === void 0)
10045
+ return void 0;
10046
+ if (at <= Date.now())
10047
+ throw new UsageError("INVALID_ARGUMENT", "expires must be in the future");
10048
+ return Math.floor(at / 1e3);
10049
+ }
10050
+ function sourceLocator(path) {
10051
+ if (path.startsWith("cyfs://"))
10052
+ return { uri: path };
10053
+ return { path: path.startsWith("/") ? path : `/${path}` };
10054
+ }
10055
+ function summary(share) {
10056
+ const keep = ["share_id", "kind", "title", "status", "access", "expires_at", "url", "target_app", "delivery_state", "source_path", "revision", "created_at", "stats"];
10057
+ return Object.fromEntries(keep.filter((key) => share[key] !== void 0).map((key) => [key, share[key]]));
10058
+ }
10059
+ function createCommand() {
10060
+ return {
10061
+ verb: "create",
10062
+ summary: "Share a file or folder as a link (a snapshot of its current content)",
10063
+ positionals: [{ name: "path", description: "File or folder, e.g. /home/alice/report.pdf or cyfs:///home/alice/report.pdf", required: true }],
10064
+ options: [
10065
+ { name: "expires", description: `Link expiry: ${EXPIRES_HELP}`, type: "string" },
10066
+ { name: "password", description: "Require this password to open the link", type: "string" },
10067
+ { name: "title", description: "Title shown to visitors", type: "string" },
10068
+ { name: "no-download", property: "no_download", description: "Preview only, no download button", type: "boolean" },
10069
+ { name: "wait", description: "Wait for a large snapshot to finish", type: "boolean" }
10070
+ ],
10071
+ inputSchema: {
10072
+ type: "object",
10073
+ properties: {
10074
+ path: { type: "string", minLength: 1 },
10075
+ expires: { type: "string", minLength: 1 },
10076
+ password: { type: "string", minLength: 1 },
10077
+ title: { type: "string", minLength: 1 },
10078
+ no_download: { type: "boolean" },
10079
+ wait: { type: "boolean" }
10080
+ },
10081
+ required: ["path"],
10082
+ additionalProperties: false
10083
+ },
10084
+ outputSchema: OBJECT_OUTPUT,
10085
+ resultSchemaVersion: 1,
10086
+ access: { mode: "fixed", level: "write" },
10087
+ asyncMode: "either",
10088
+ requiresSession: true,
10089
+ examples: [
10090
+ "buckyos share create /home/alice/report.pdf",
10091
+ "buckyos share create /home/alice/photos --expires 30d --password s3cret"
10092
+ ],
10093
+ handler: async (ctx, input) => {
10094
+ const nfsp = await openNfsp(ctx);
10095
+ const expires = parseExpires(input.expires);
10096
+ const password = inputString(input, "password");
10097
+ const policy2 = {
10098
+ access: password ? "password" : "holder",
10099
+ allow_download: input.no_download !== true,
10100
+ ...password ? { password } : {},
10101
+ ...expires !== void 0 ? { expires_at: expires } : {}
10102
+ };
10103
+ let op = await nfsp.call("share.create", {
10104
+ source: sourceLocator(requiredInputString(input, "path")),
10105
+ policy: policy2,
10106
+ title: inputString(input, "title"),
10107
+ idempotency_key: ctx.idempotencyKey ?? crypto.randomUUID()
10108
+ }, true);
10109
+ while (input.wait === true && (op.state === "running" || op.state === "preparing")) {
10110
+ await new Promise((resolve2) => setTimeout(resolve2, 1e3));
10111
+ ctx.signal.throwIfAborted();
10112
+ op = await nfsp.call("share.operation", { operation_id: op.operation_id });
10113
+ }
10114
+ if (op.state === "failed" || op.state === "canceled") {
10115
+ const error = op.error ?? {};
10116
+ throw new ToolError(`SHARE_${String(error.reason ?? op.state).toUpperCase()}`, String(error.message ?? `share ${op.state}`));
10117
+ }
10118
+ return {
10119
+ operation_id: op.operation_id,
10120
+ state: op.state,
10121
+ share_id: op.share_id ?? null,
10122
+ url: op.url ?? null,
10123
+ source_changed: op.source_changed ?? false,
10124
+ ...op.share ? { share: summary(op.share) } : {}
10125
+ };
10126
+ }
10127
+ };
10128
+ }
10129
+ function listCommand() {
10130
+ return {
10131
+ verb: "list",
10132
+ summary: "List your shares",
10133
+ options: [
10134
+ { name: "kind", description: "link or app_delivery", type: "string", enum: ["link", "app_delivery"] },
10135
+ { name: "status", description: "active, stopped, expired, ...", type: "string" },
10136
+ { name: "q", description: "Search title and path", type: "string" },
10137
+ { name: "include-hidden", property: "include_hidden", description: "Include hidden shares", type: "boolean" },
10138
+ { name: "cursor", description: "Page cursor", type: "string" },
10139
+ { name: "limit", description: "Page size, at most 200", type: "integer" }
10140
+ ],
10141
+ inputSchema: {
10142
+ type: "object",
10143
+ properties: {
10144
+ kind: { type: "string", enum: ["link", "app_delivery"] },
10145
+ status: { type: "string", minLength: 1 },
10146
+ q: { type: "string", minLength: 1 },
10147
+ include_hidden: { type: "boolean" },
10148
+ cursor: { type: "string", minLength: 1 },
10149
+ limit: { type: "integer", minimum: 1 }
10150
+ },
10151
+ additionalProperties: false
10152
+ },
10153
+ outputSchema: OBJECT_OUTPUT,
10154
+ resultSchemaVersion: 1,
10155
+ access: { mode: "fixed", level: "read" },
10156
+ asyncMode: "sync",
10157
+ requiresSession: true,
10158
+ examples: ["buckyos share list --kind link --status active"],
10159
+ handler: async (ctx, input) => {
10160
+ const nfsp = await openNfsp(ctx);
10161
+ const page = await nfsp.call("share.list", {
10162
+ kind: input.kind,
10163
+ status: input.status,
10164
+ q: input.q,
10165
+ include_hidden: input.include_hidden === true,
10166
+ cursor: input.cursor,
10167
+ limit: input.limit
10168
+ });
10169
+ const items = Array.isArray(page.items) ? page.items : [];
10170
+ return { items: items.map(summary), next_cursor: page.next_cursor ?? null };
10171
+ }
10172
+ };
10173
+ }
10174
+ function getCommand() {
10175
+ return {
10176
+ verb: "get",
10177
+ summary: "Show one share: link, policy, snapshot, delivery, statistics and history",
10178
+ positionals: [{ name: "share_id", description: "Share ID (sh_…)", required: true }],
10179
+ inputSchema: {
10180
+ type: "object",
10181
+ properties: { share_id: { type: "string", minLength: 1 } },
10182
+ required: ["share_id"],
10183
+ additionalProperties: false
10184
+ },
10185
+ outputSchema: OBJECT_OUTPUT,
10186
+ resultSchemaVersion: 1,
10187
+ access: { mode: "fixed", level: "read" },
10188
+ asyncMode: "sync",
10189
+ requiresSession: true,
10190
+ examples: ["buckyos share get sh_0123456789abcdef"],
10191
+ handler: async (ctx, input) => {
10192
+ const nfsp = await openNfsp(ctx);
10193
+ return await nfsp.call("share.get", { share_id: requiredInputString(input, "share_id") });
10194
+ }
10195
+ };
10196
+ }
10197
+ function updateCommand() {
10198
+ return {
10199
+ verb: "update",
10200
+ summary: "Change a link's expiry, password, title or download setting",
10201
+ positionals: [{ name: "share_id", description: "Share ID (sh_…)", required: true }],
10202
+ options: [
10203
+ { name: "expires", description: `New expiry: ${EXPIRES_HELP}`, type: "string" },
10204
+ { name: "password", description: "Set or change the password", type: "string" },
10205
+ { name: "no-password", property: "no_password", description: "Remove the password", type: "boolean" },
10206
+ { name: "title", description: "New title", type: "string" },
10207
+ { name: "download", description: "Allow (true) or forbid (false) downloading", type: "boolean" }
10208
+ ],
10209
+ inputSchema: {
10210
+ type: "object",
10211
+ properties: {
10212
+ share_id: { type: "string", minLength: 1 },
10213
+ expires: { type: "string", minLength: 1 },
10214
+ password: { type: "string", minLength: 1 },
10215
+ no_password: { type: "boolean" },
10216
+ title: { type: "string", minLength: 1 },
10217
+ download: { type: "boolean" }
10218
+ },
10219
+ required: ["share_id"],
10220
+ additionalProperties: false
10221
+ },
10222
+ outputSchema: OBJECT_OUTPUT,
10223
+ resultSchemaVersion: 1,
10224
+ access: { mode: "fixed", level: "write" },
10225
+ asyncMode: "sync",
10226
+ requiresSession: true,
10227
+ examples: ["buckyos share update sh_0123456789abcdef --expires none", "buckyos share update sh_0123456789abcdef --password n3w"],
10228
+ handler: async (ctx, input) => {
10229
+ if (input.password !== void 0 && input.no_password === true) {
10230
+ throw new UsageError("INVALID_ARGUMENT", "use either --password or --no-password");
10231
+ }
10232
+ const changes = {};
10233
+ const expires = parseExpires(input.expires);
10234
+ if (expires !== void 0)
10235
+ changes.expires_at = expires;
10236
+ if (input.password !== void 0)
10237
+ changes.password = String(input.password);
10238
+ if (input.no_password === true)
10239
+ changes.password = null;
10240
+ if (input.title !== void 0)
10241
+ changes.title = String(input.title);
10242
+ if (input.download !== void 0)
10243
+ changes.allow_download = input.download === true;
10244
+ if (!Object.keys(changes).length)
10245
+ throw new UsageError("INVALID_ARGUMENT", "nothing to change");
10246
+ const nfsp = await openNfsp(ctx);
10247
+ const shareId = requiredInputString(input, "share_id");
10248
+ const current = await nfsp.call("share.get", { share_id: shareId });
10249
+ const result = await nfsp.call("share.update", { share_id: shareId, revision: current.revision, changes }, true);
10250
+ return { revision: result.revision, share: summary(expectObject$4(result.share, "share.update share")) };
10251
+ }
10252
+ };
10253
+ }
10254
+ function stopCommand() {
10255
+ return {
10256
+ verb: "stop",
10257
+ summary: "Stop a share: the link stops working and the kept snapshot is released",
10258
+ positionals: [{ name: "share_id", description: "Share ID (sh_…)", required: true }],
10259
+ options: [{ name: "reason", description: "Recorded in the share history", type: "string" }],
10260
+ inputSchema: {
10261
+ type: "object",
10262
+ properties: { share_id: { type: "string", minLength: 1 }, reason: { type: "string", minLength: 1 } },
10263
+ required: ["share_id"],
10264
+ additionalProperties: false
10265
+ },
10266
+ outputSchema: OBJECT_OUTPUT,
10267
+ resultSchemaVersion: 1,
10268
+ access: { mode: "fixed", level: "destructive" },
10269
+ asyncMode: "sync",
10270
+ requiresSession: true,
10271
+ examples: ['buckyos share stop sh_0123456789abcdef --reason "sent by mistake"'],
10272
+ handler: async (ctx, input) => {
10273
+ const nfsp = await openNfsp(ctx);
10274
+ const shareId = requiredInputString(input, "share_id");
10275
+ const current = await nfsp.call("share.get", { share_id: shareId });
10276
+ return await nfsp.call("share.stop", { share_id: shareId, revision: current.revision, reason: inputString(input, "reason") }, true);
10277
+ }
10278
+ };
10279
+ }
10280
+ function statsCommand() {
10281
+ return {
10282
+ verb: "stats",
10283
+ summary: "Views, downloads, traffic and visitors of one share or all of yours",
10284
+ options: [
10285
+ { name: "share-id", property: "share_id", description: "One share instead of all", type: "string" },
10286
+ { name: "days", description: "How many days back (default 30)", type: "integer" },
10287
+ { name: "granularity", description: "day or hour", type: "string", enum: ["day", "hour"] }
10288
+ ],
10289
+ inputSchema: {
10290
+ type: "object",
10291
+ properties: {
10292
+ share_id: { type: "string", minLength: 1 },
10293
+ days: { type: "integer", minimum: 1 },
10294
+ granularity: { type: "string", enum: ["day", "hour"] }
10295
+ },
10296
+ additionalProperties: false
10297
+ },
10298
+ outputSchema: OBJECT_OUTPUT,
10299
+ resultSchemaVersion: 1,
10300
+ access: { mode: "fixed", level: "read" },
10301
+ asyncMode: "sync",
10302
+ requiresSession: true,
10303
+ examples: ["buckyos share stats --days 7", "buckyos share stats --share-id sh_0123456789abcdef --granularity hour --days 2"],
10304
+ handler: async (ctx, input) => {
10305
+ const nfsp = await openNfsp(ctx);
10306
+ const to = Math.floor(Date.now() / 1e3) + 1;
10307
+ const days = typeof input.days === "number" ? input.days : 30;
10308
+ return await nfsp.call("share.stats", {
10309
+ share_id: inputString(input, "share_id"),
10310
+ from: to - days * 86400,
10311
+ to,
10312
+ granularity: input.granularity ?? "day"
10313
+ });
10314
+ }
10315
+ };
10316
+ }
9973
10317
  const VERSION = TOOL_VERSION;
9974
10318
  class BuckyOSToolApplication {
9975
10319
  #environment;
@@ -10336,6 +10680,7 @@ function createRegistry(pikgDependencies, appDependencies, logDependencies, diag
10336
10680
  registry.register(createSkillModule());
10337
10681
  registry.register(createAgentModule());
10338
10682
  registry.register(createAiModule());
10683
+ registry.register(createShareModule());
10339
10684
  return registry;
10340
10685
  }
10341
10686
  function assertNoSessionOptions(global, command) {