buckyos 0.7.151 → 0.7.153

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
@@ -4816,7 +4816,33 @@ function validateObjectGraph(appDoc, packageMeta, payloads, hasJson, hasSigned,
4816
4816
  canonicalMatch
4817
4817
  };
4818
4818
  }
4819
+ function validateAppPresentation(value, label) {
4820
+ const presentation = expectObject$3(value, label);
4821
+ rejectUnknown(presentation, ["title", "summary", "description", "icons", "links", "license"], label);
4822
+ for (const field of ["title", "summary", "description", "icons", "links"]) {
4823
+ const values = expectObject$3(presentation[field], `${label}.${field}`);
4824
+ for (const [key, item] of Object.entries(values)) {
4825
+ if (typeof item !== "string") {
4826
+ throw invalid("appdoc", `${label}.${field}.${key} must be a string`);
4827
+ }
4828
+ if (field === "icons") {
4829
+ try {
4830
+ ndn.ObjId.fromString(item);
4831
+ } catch {
4832
+ throw invalid("appdoc", `${label}.${field}.${key} must be an ObjectId`);
4833
+ }
4834
+ }
4835
+ }
4836
+ }
4837
+ if (typeof presentation.license !== "string") {
4838
+ throw invalid("appdoc", `${label}.license must be a string`);
4839
+ }
4840
+ return presentation;
4841
+ }
4819
4842
  function validateAppDocShape(appDoc) {
4843
+ if (appDoc.presentation !== void 0 && appDoc.presentation !== null) {
4844
+ validateAppPresentation(appDoc.presentation, "APPDOC.presentation");
4845
+ }
4820
4846
  rejectUnknown(
4821
4847
  appDoc,
4822
4848
  [
@@ -5179,7 +5205,7 @@ function validateContentHandlers(value, permissions) {
5179
5205
  }
5180
5206
  return value;
5181
5207
  }
5182
- const PACKAGE_VERSION = "0.7.151";
5208
+ const PACKAGE_VERSION = "0.7.153";
5183
5209
  const TOOL_VERSION = PACKAGE_VERSION;
5184
5210
  const SDK_VERSION = PACKAGE_VERSION;
5185
5211
  const PROTOCOL_VERSION = "1";
@@ -5748,6 +5774,7 @@ async function buildCommand(ctx, input, docker, now) {
5748
5774
  categories: appMeta.categories,
5749
5775
  pkg_list: pkgList,
5750
5776
  show_name: appMeta.show_name,
5777
+ ...appMeta.presentation ? { presentation: appMeta.presentation } : {},
5751
5778
  ...appMeta.permissions.length ? { permissions: appMeta.permissions } : {},
5752
5779
  ...appMeta.content_handlers?.length ? { content_handlers: appMeta.content_handlers } : {},
5753
5780
  selector_type: appMeta.selector_type,
@@ -5911,6 +5938,7 @@ function parseAppMeta(value) {
5911
5938
  "owner",
5912
5939
  "author",
5913
5940
  "show_name",
5941
+ "presentation",
5914
5942
  "categories",
5915
5943
  "permissions",
5916
5944
  "content_handlers",
@@ -5953,6 +5981,11 @@ function parseAppMeta(value) {
5953
5981
  owner,
5954
5982
  author: developmentString(value.author, "app.json.author"),
5955
5983
  show_name: developmentString(value.show_name, "app.json.show_name"),
5984
+ ...value.presentation === void 0 ? {} : {
5985
+ presentation: developmentValidation(
5986
+ () => validateAppPresentation(value.presentation, "app.json.presentation")
5987
+ )
5988
+ },
5956
5989
  categories,
5957
5990
  permissions,
5958
5991
  ...value.content_handlers === void 0 ? {} : { content_handlers: developmentValidation(() => validateContentHandlers(value.content_handlers, permissions)) },
@@ -8336,7 +8369,7 @@ function createDiagnosticModule(dependencies = {}) {
8336
8369
  return {
8337
8370
  name: "diagnostic",
8338
8371
  summary: "Collect and export privileged redacted diagnostic bundles",
8339
- commands: [collectCommand(), exportCommand$1(dependencies)]
8372
+ commands: [collectCommand(), exportCommand$2(dependencies)]
8340
8373
  };
8341
8374
  }
8342
8375
  function collectCommand() {
@@ -8404,7 +8437,7 @@ function collectCommand() {
8404
8437
  }
8405
8438
  };
8406
8439
  }
8407
- function exportCommand$1(dependencies) {
8440
+ function exportCommand$2(dependencies) {
8408
8441
  return {
8409
8442
  verb: "export",
8410
8443
  summary: "Export one diagnostic bundle to a new file",
@@ -8476,7 +8509,7 @@ function createLogModule(dependencies = {}) {
8476
8509
  servicesCommand(),
8477
8510
  queryCommand$1(),
8478
8511
  tailCommand(dependencies),
8479
- exportCommand(dependencies)
8512
+ exportCommand$1(dependencies)
8480
8513
  ]
8481
8514
  };
8482
8515
  }
@@ -8604,7 +8637,7 @@ function tailCommand(dependencies) {
8604
8637
  }
8605
8638
  };
8606
8639
  }
8607
- function exportCommand(dependencies) {
8640
+ function exportCommand$1(dependencies) {
8608
8641
  return {
8609
8642
  verb: "export",
8610
8643
  summary: "Export a bounded redacted log archive to a new file",
@@ -11215,11 +11248,103 @@ const runReportCommand = {
11215
11248
  return aiws(ctx, "proc.report", params);
11216
11249
  }
11217
11250
  };
11251
+ const controlsCommand = {
11252
+ verb: "controls",
11253
+ summary: "Block-controls a canvas offers: `list` (kind, what it is, when to use it), `describe <kind>` (the full self-description to follow)",
11254
+ positionals: [{ name: "action", description: "list | describe", required: true }, { name: "kind", description: "Control kind for describe, e.g. mindmap", required: false }],
11255
+ options: [],
11256
+ inputSchema: { type: "object", properties: { action: { type: "string", enum: ["list", "describe"] }, kind: { type: "string" } }, required: ["action"], additionalProperties: false },
11257
+ outputSchema: OBJECT_OUTPUT,
11258
+ resultSchemaVersion: 1,
11259
+ access: { mode: "fixed", level: "read" },
11260
+ asyncMode: "sync",
11261
+ requiresSession: true,
11262
+ examples: ["buckyos aiws controls list", "buckyos aiws controls describe mindmap"],
11263
+ handler: (ctx, input) => {
11264
+ const action = requiredInputString(input, "action");
11265
+ if (action === "list")
11266
+ return aiws(ctx, "control.list", {});
11267
+ if (action !== "describe")
11268
+ throw new UsageError("AIWS_USAGE", "controls: list or describe <kind>");
11269
+ return aiws(ctx, "control.describe", { kind: requiredInputString(input, "kind") });
11270
+ }
11271
+ };
11272
+ function exchangeFormat(explicit, file) {
11273
+ if (explicit)
11274
+ return explicit;
11275
+ return /\.(opml|xml)$/i.test(file) ? "opml" : "markdown";
11276
+ }
11277
+ const importCommand = {
11278
+ verb: "import",
11279
+ summary: "Create a Block-control from an exchange file: a mind map from a Markdown outline (nested list) or OPML",
11280
+ positionals: [{ name: "file", description: "Local file (.md / .opml)", required: true }],
11281
+ options: [
11282
+ WORKSPACE_OPTION,
11283
+ { name: "parent", property: "parent_id", description: "Surface (or group) id to put the control on", type: "string", required: true },
11284
+ { name: "kind", property: "kind", description: "Control kind (default mindmap)", type: "string" },
11285
+ { name: "format", property: "format", description: "markdown | opml (default: by the file extension)", type: "string", enum: ["markdown", "opml"] },
11286
+ { name: "at", property: "at", description: "x,y on a free canvas: where the first root goes", type: "string" },
11287
+ { name: "title", property: "title", description: "Title of the control (default: the single root, or the OPML title)", type: "string" }
11288
+ ],
11289
+ inputSchema: workspaceInput({ file: { type: "string", minLength: 1 }, parent_id: { type: "string", minLength: 1 }, kind: { type: "string" }, format: { type: "string" }, at: { type: "string" }, title: { type: "string" } }, ["file", "parent_id"]),
11290
+ outputSchema: OBJECT_OUTPUT,
11291
+ resultSchemaVersion: 1,
11292
+ access: { mode: "fixed", level: "write" },
11293
+ asyncMode: "sync",
11294
+ requiresSession: true,
11295
+ examples: ["buckyos aiws import plan.md --workspace ws_abc --parent sf_main --at 100,80", "buckyos aiws import ideas.opml --workspace ws_abc --parent sf_main"],
11296
+ handler: async (ctx, input) => {
11297
+ const file = requiredInputString(input, "file");
11298
+ const params = {
11299
+ workspace_id: requiredInputString(input, "workspace_id"),
11300
+ parent_id: requiredInputString(input, "parent_id"),
11301
+ kind: inputString(input, "kind") ?? "mindmap",
11302
+ format: exchangeFormat(inputString(input, "format"), file),
11303
+ text: await getHost().readTextFile(file)
11304
+ };
11305
+ const at = inputString(input, "at");
11306
+ if (at) {
11307
+ const [x, y] = at.split(",").map(Number);
11308
+ if (!Number.isFinite(x) || !Number.isFinite(y))
11309
+ throw new UsageError("AIWS_USAGE", "--at is x,y");
11310
+ params.at = { x, y };
11311
+ }
11312
+ const title = inputString(input, "title");
11313
+ if (title)
11314
+ params.title = title;
11315
+ return aiws(ctx, "control.import", params);
11316
+ }
11317
+ };
11318
+ const exportCommand = {
11319
+ verb: "export",
11320
+ summary: "A Block-control in an exchange format: a mind map as a Markdown outline or OPML",
11321
+ positionals: [{ name: "entity_id", description: "The control (container) id", required: true }],
11322
+ options: [
11323
+ WORKSPACE_OPTION,
11324
+ { name: "format", property: "format", description: "markdown (default) | opml", type: "string", enum: ["markdown", "opml"] },
11325
+ { name: "out", property: "out", description: "Write the text to this file instead of answering it", type: "string" }
11326
+ ],
11327
+ inputSchema: workspaceInput({ entity_id: { type: "string", minLength: 1 }, format: { type: "string" }, out: { type: "string" } }, ["entity_id"]),
11328
+ outputSchema: OBJECT_OUTPUT,
11329
+ resultSchemaVersion: 1,
11330
+ access: { mode: "fixed", level: "read" },
11331
+ asyncMode: "sync",
11332
+ requiresSession: true,
11333
+ examples: ["buckyos aiws export mm_plan --workspace ws_abc", "buckyos aiws export mm_plan --workspace ws_abc --format opml --out plan.opml"],
11334
+ handler: async (ctx, input) => {
11335
+ const result = await aiws(ctx, "control.export", { workspace_id: requiredInputString(input, "workspace_id"), entity_id: requiredInputString(input, "entity_id"), format: inputString(input, "format") ?? "markdown" });
11336
+ const out = inputString(input, "out");
11337
+ if (!out)
11338
+ return result;
11339
+ await getHost().writeTextFile(out, String(result.text ?? ""));
11340
+ return { ok: true, format: result.format, kind: result.kind, path: out };
11341
+ }
11342
+ };
11218
11343
  function createAiwsModule() {
11219
11344
  return {
11220
11345
  name: "aiws",
11221
- summary: "AI Workspace: read a workspace, and execute wish runs as their executor (claim, heartbeat, report)",
11222
- commands: [infoCommand, readCommand, queryCommand, runGetCommand, runClaimCommand, runHeartbeatCommand, runFilesCommand, runToolCommand, runProgramCommand, runReportCommand]
11346
+ summary: "AI Workspace: read a workspace, Block-controls (catalogue, import, export), and execute wish runs as their executor (claim, heartbeat, report)",
11347
+ commands: [infoCommand, readCommand, queryCommand, controlsCommand, importCommand, exportCommand, runGetCommand, runClaimCommand, runHeartbeatCommand, runFilesCommand, runToolCommand, runProgramCommand, runReportCommand]
11223
11348
  };
11224
11349
  }
11225
11350
  const VERSION = TOOL_VERSION;