@lambdacurry/arbor 0.8.7 → 0.8.9
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/arbor.js +45 -6
- package/package.json +1 -1
package/dist/arbor.js
CHANGED
|
@@ -16528,6 +16528,17 @@ var ACTIONS = [
|
|
|
16528
16528
|
toolset: "loop",
|
|
16529
16529
|
run: forward("thread.get")
|
|
16530
16530
|
},
|
|
16531
|
+
{
|
|
16532
|
+
name: "resolve_references",
|
|
16533
|
+
title: "Resolve reference ids",
|
|
16534
|
+
description: "Resolve Arbor object ids to their display labels — what a reference chip shows.",
|
|
16535
|
+
inputSchema: {
|
|
16536
|
+
ids: exports_external.array(exports_external.string()).describe("object ids to resolve — thr_…/con_…/ini_…/art_… (max 50; others ignored)")
|
|
16537
|
+
},
|
|
16538
|
+
surfaces: ["cli"],
|
|
16539
|
+
toolset: "loop",
|
|
16540
|
+
run: forward("reference.resolve")
|
|
16541
|
+
},
|
|
16531
16542
|
{
|
|
16532
16543
|
name: "tree",
|
|
16533
16544
|
title: "Navigate the workspace tree",
|
|
@@ -17408,7 +17419,8 @@ function flagsForSchema(inputSchema) {
|
|
|
17408
17419
|
};
|
|
17409
17420
|
});
|
|
17410
17421
|
}
|
|
17411
|
-
function buildInput(inputSchema, flags) {
|
|
17422
|
+
function buildInput(inputSchema, flags, command) {
|
|
17423
|
+
const primary = primaryPositionalField(inputSchema);
|
|
17412
17424
|
const input = {};
|
|
17413
17425
|
for (const spec of flagsForSchema(inputSchema)) {
|
|
17414
17426
|
if (spec.kind === "string") {
|
|
@@ -17425,8 +17437,10 @@ function buildInput(inputSchema, flags) {
|
|
|
17425
17437
|
}
|
|
17426
17438
|
const raw = flags[spec.flag];
|
|
17427
17439
|
if (raw === undefined) {
|
|
17428
|
-
if (spec.required)
|
|
17429
|
-
|
|
17440
|
+
if (spec.required) {
|
|
17441
|
+
const positional = primary && primary.field === spec.field && command ? ` — or pass it as the argument: arbor ${command} <${primary.field}>` : "";
|
|
17442
|
+
throw new UsageError(`missing required flag: --${spec.flag}${positional}`);
|
|
17443
|
+
}
|
|
17430
17444
|
continue;
|
|
17431
17445
|
}
|
|
17432
17446
|
if (spec.kind !== "boolean" && raw === true) {
|
|
@@ -17487,6 +17501,29 @@ function commandWords(action) {
|
|
|
17487
17501
|
var CLI_ACTIONS = ACTIONS.filter((a) => a.surfaces.includes("cli"));
|
|
17488
17502
|
var BY_COMMAND = new Map(CLI_ACTIONS.map((a) => [commandWords(a), a]));
|
|
17489
17503
|
var MAX_WORDS = Math.max(1, ...CLI_ACTIONS.map((a) => commandWords(a).split(" ").length));
|
|
17504
|
+
var KNOWN_MISREACHES = [
|
|
17505
|
+
{ tried: "thread list", use: "tree --depth threads", why: "threads are listed by the tree" },
|
|
17506
|
+
{ tried: "threads", use: "tree --depth threads", why: "threads are listed by the tree" },
|
|
17507
|
+
{ tried: "list threads", use: "tree --depth threads", why: "threads are listed by the tree" },
|
|
17508
|
+
{ tried: "spaces", use: "tree", why: "the tree lists spaces" },
|
|
17509
|
+
{ tried: "space list", use: "tree", why: "the tree lists spaces" },
|
|
17510
|
+
{ tried: "topics", use: "tree --depth topics", why: "topics are a tree depth" },
|
|
17511
|
+
{ tried: "search", use: "recall <query>", why: "recall is the search surface" }
|
|
17512
|
+
];
|
|
17513
|
+
function suggestCommand(positionals) {
|
|
17514
|
+
const typed = positionals.join(" ").toLowerCase();
|
|
17515
|
+
const known = KNOWN_MISREACHES.find((m) => m.tried === typed);
|
|
17516
|
+
if (known)
|
|
17517
|
+
return `use \`arbor ${known.use}\` — ${known.why}`;
|
|
17518
|
+
const head = positionals[0]?.toLowerCase();
|
|
17519
|
+
if (head) {
|
|
17520
|
+
const siblings = CLI_ACTIONS.map(commandWords).filter((c) => c === head || c.startsWith(`${head} `)).sort();
|
|
17521
|
+
if (siblings.length > 0) {
|
|
17522
|
+
return `\`${head}\` commands: ${siblings.slice(0, 8).join(", ")}${siblings.length > 8 ? ", …" : ""}`;
|
|
17523
|
+
}
|
|
17524
|
+
}
|
|
17525
|
+
return "run `arbor help` for the command list";
|
|
17526
|
+
}
|
|
17490
17527
|
function matchCommand(positionals) {
|
|
17491
17528
|
for (let n = Math.min(MAX_WORDS, positionals.length);n >= 1; n--) {
|
|
17492
17529
|
const key = positionals.slice(0, n).join(" ");
|
|
@@ -17561,8 +17598,10 @@ function commandCatalog() {
|
|
|
17561
17598
|
}
|
|
17562
17599
|
async function runObjectVerb(positionals, flags, ctx) {
|
|
17563
17600
|
const match = matchCommand(positionals);
|
|
17564
|
-
if (!match)
|
|
17565
|
-
|
|
17601
|
+
if (!match) {
|
|
17602
|
+
const typed = positionals.join(" ") || "(none)";
|
|
17603
|
+
throw new UsageError(`unknown command: ${typed} — ${suggestCommand(positionals)}`);
|
|
17604
|
+
}
|
|
17566
17605
|
const { action, words } = match;
|
|
17567
17606
|
const extras = positionals.slice(words);
|
|
17568
17607
|
if (extras.length > 0) {
|
|
@@ -17583,7 +17622,7 @@ async function runObjectVerb(positionals, flags, ctx) {
|
|
|
17583
17622
|
if (unknown2.length > 0) {
|
|
17584
17623
|
throw new UsageError(`unknown flag${unknown2.length > 1 ? "s" : ""}: ${unknown2.map((f) => `--${f}`).join(", ")}`);
|
|
17585
17624
|
}
|
|
17586
|
-
const input = buildInput(action.inputSchema, flags);
|
|
17625
|
+
const input = buildInput(action.inputSchema, flags, commandWords(action));
|
|
17587
17626
|
if (action.name === "agent_register") {
|
|
17588
17627
|
advise(`Agent registered. Save its apiKey now — it is shown only once:
|
|
17589
17628
|
`, ctx);
|
package/package.json
CHANGED