@construct-space/cli 1.6.2 → 1.6.3

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
@@ -5354,7 +5354,7 @@ async function scaffold(nameArg, options) {
5354
5354
  // src/commands/build.ts
5355
5355
  init_source();
5356
5356
  import { existsSync as existsSync6, readFileSync as readFileSync4, readdirSync as readdirSync3, renameSync, statSync as statSync3 } from "fs";
5357
- import { join as join6 } from "path";
5357
+ import { extname as extname3, join as join6 } from "path";
5358
5358
  import { createHash } from "crypto";
5359
5359
 
5360
5360
  // node_modules/ora/index.js
@@ -8422,6 +8422,71 @@ function extractActionMetadata(actionsPath) {
8422
8422
  return null;
8423
8423
  }
8424
8424
  }
8425
+ var ICON_MIME = {
8426
+ ".svg": "image/svg+xml",
8427
+ ".png": "image/png",
8428
+ ".jpg": "image/jpeg",
8429
+ ".jpeg": "image/jpeg",
8430
+ ".webp": "image/webp",
8431
+ ".gif": "image/gif",
8432
+ ".ico": "image/x-icon"
8433
+ };
8434
+ function isInlineableIcon(value) {
8435
+ if (typeof value !== "string" || !value)
8436
+ return false;
8437
+ if (value.startsWith("i-") || value.startsWith("lucide:"))
8438
+ return false;
8439
+ if (value.startsWith("data:"))
8440
+ return false;
8441
+ if (/^https?:\/\//.test(value))
8442
+ return false;
8443
+ return extname3(value).toLowerCase() in ICON_MIME;
8444
+ }
8445
+ function resolveIconPath(root, ref) {
8446
+ const rel = ref.replace(/^\.?\//, "");
8447
+ for (const candidate of [join6(root, rel), join6(root, "src", rel)]) {
8448
+ if (existsSync6(candidate))
8449
+ return candidate;
8450
+ }
8451
+ return null;
8452
+ }
8453
+ function inlineIcon(root, ref) {
8454
+ const abs = resolveIconPath(root, ref);
8455
+ if (!abs)
8456
+ return null;
8457
+ const mime = ICON_MIME[extname3(abs).toLowerCase()] || "application/octet-stream";
8458
+ const b64 = readFileSync4(abs).toString("base64");
8459
+ return `data:${mime};base64,${b64}`;
8460
+ }
8461
+ function inlineManifestIcons(root, raw) {
8462
+ if (isInlineableIcon(raw.icon)) {
8463
+ const data = inlineIcon(root, raw.icon);
8464
+ if (data)
8465
+ raw.icon = data;
8466
+ else
8467
+ console.warn(source_default.yellow(` Icon not found: ${raw.icon}`));
8468
+ }
8469
+ const nav = raw.navigation;
8470
+ if (nav && isInlineableIcon(nav.icon)) {
8471
+ const data = inlineIcon(root, nav.icon);
8472
+ if (data)
8473
+ nav.icon = data;
8474
+ else
8475
+ console.warn(source_default.yellow(` navigation.icon not found: ${nav.icon}`));
8476
+ }
8477
+ const pages = raw.pages;
8478
+ if (Array.isArray(pages)) {
8479
+ for (const p of pages) {
8480
+ if (isInlineableIcon(p.icon)) {
8481
+ const data = inlineIcon(root, p.icon);
8482
+ if (data)
8483
+ p.icon = data;
8484
+ else
8485
+ console.warn(source_default.yellow(` page icon not found: ${p.icon}`));
8486
+ }
8487
+ }
8488
+ }
8489
+ }
8425
8490
  async function build(options) {
8426
8491
  const root = process.cwd();
8427
8492
  if (!exists(root)) {
@@ -8470,6 +8535,7 @@ async function build(options) {
8470
8535
  const bundleData = readFileSync4(bundlePath);
8471
8536
  const checksum = createHash("sha256").update(bundleData).digest("hex");
8472
8537
  const raw = readRaw(root);
8538
+ inlineManifestIcons(root, raw);
8473
8539
  const actionsPath = join6(root, "src", "actions.ts");
8474
8540
  if (existsSync6(actionsPath)) {
8475
8541
  const actionMeta = extractActionMetadata(actionsPath);
@@ -11379,7 +11445,7 @@ function graphFork(newSpaceID) {
11379
11445
  // package.json
11380
11446
  var package_default = {
11381
11447
  name: "@construct-space/cli",
11382
- version: "1.6.2",
11448
+ version: "1.6.3",
11383
11449
  description: "Construct CLI \u2014 scaffold, build, develop, and publish spaces",
11384
11450
  type: "module",
11385
11451
  bin: {
@@ -215,7 +215,7 @@ await tasks.remove(id)
215
215
 
216
216
  ## Actions (agent surface)
217
217
 
218
- `src/actions.ts` exports an `actions` object — each entry becomes an agent-callable tool via `space_run_action`.
218
+ `src/actions.ts` exports an `actions` object — each entry is exposed to the space's agent as a first-class tool.
219
219
 
220
220
  ```ts
221
221
  export const actions = {
@@ -230,7 +230,24 @@ export const actions = {
230
230
  }
231
231
  ```
232
232
 
233
- The agent (configured in `agent/config.md`) calls `space_list_actions` then `space_run_action`. Keep descriptions tight and specific they're the only docstring the agent sees.
233
+ ### Wiring (REQUIREDeasy to miss)
234
+
235
+ Each action becomes a tool named **`{spaceID}.{actionName}`** (dot, not underscore). The operator only pre-registers actions that are **explicitly whitelisted** in the agent config. An empty `tools: []` means the agent sees zero action tools and will report "unknown tool".
236
+
237
+ ```yaml
238
+ # agent/config.md frontmatter
239
+ ---
240
+ id: {{.ID}}
241
+ tools:
242
+ - {{.ID}}.createTask
243
+ - {{.ID}}.listTasks
244
+ - {{.ID}}.updateTask
245
+ ---
246
+ ```
247
+
248
+ Fallback: agents can also discover/invoke actions via the generic `space_list_actions` + `space_run_action` bridge tools. Prefer the whitelist — it gives the model proper tool definitions instead of stringly-typed action names.
249
+
250
+ Keep action descriptions tight and specific — they're the only docstring the agent sees.
234
251
 
235
252
  ---
236
253
 
@@ -30,7 +30,7 @@
30
30
  "vue-tsc": "^3.2.5"
31
31
  },
32
32
  "dependencies": {
33
- "@construct-space/graph": "^0.5.0",
34
- "@construct-space/ui": "^0.5.2"
33
+ "@construct-space/graph": "^0.6.2",
34
+ "@construct-space/ui": "^0.6.1"
35
35
  }
36
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@construct-space/cli",
3
- "version": "1.6.2",
3
+ "version": "1.6.3",
4
4
  "description": "Construct CLI — scaffold, build, develop, and publish spaces",
5
5
  "type": "module",
6
6
  "bin": {
@@ -215,7 +215,7 @@ await tasks.remove(id)
215
215
 
216
216
  ## Actions (agent surface)
217
217
 
218
- `src/actions.ts` exports an `actions` object — each entry becomes an agent-callable tool via `space_run_action`.
218
+ `src/actions.ts` exports an `actions` object — each entry is exposed to the space's agent as a first-class tool.
219
219
 
220
220
  ```ts
221
221
  export const actions = {
@@ -230,7 +230,24 @@ export const actions = {
230
230
  }
231
231
  ```
232
232
 
233
- The agent (configured in `agent/config.md`) calls `space_list_actions` then `space_run_action`. Keep descriptions tight and specific they're the only docstring the agent sees.
233
+ ### Wiring (REQUIREDeasy to miss)
234
+
235
+ Each action becomes a tool named **`{spaceID}.{actionName}`** (dot, not underscore). The operator only pre-registers actions that are **explicitly whitelisted** in the agent config. An empty `tools: []` means the agent sees zero action tools and will report "unknown tool".
236
+
237
+ ```yaml
238
+ # agent/config.md frontmatter
239
+ ---
240
+ id: {{.ID}}
241
+ tools:
242
+ - {{.ID}}.createTask
243
+ - {{.ID}}.listTasks
244
+ - {{.ID}}.updateTask
245
+ ---
246
+ ```
247
+
248
+ Fallback: agents can also discover/invoke actions via the generic `space_list_actions` + `space_run_action` bridge tools. Prefer the whitelist — it gives the model proper tool definitions instead of stringly-typed action names.
249
+
250
+ Keep action descriptions tight and specific — they're the only docstring the agent sees.
234
251
 
235
252
  ---
236
253
 
@@ -30,7 +30,7 @@
30
30
  "vue-tsc": "^3.2.5"
31
31
  },
32
32
  "dependencies": {
33
- "@construct-space/graph": "^0.5.0",
34
- "@construct-space/ui": "^0.5.2"
33
+ "@construct-space/graph": "^0.6.2",
34
+ "@construct-space/ui": "^0.6.1"
35
35
  }
36
36
  }