@lambdacurry/arbor 0.4.24 → 0.4.25

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.
Files changed (2) hide show
  1. package/dist/arbor.js +61 -29
  2. package/package.json +1 -1
package/dist/arbor.js CHANGED
@@ -1,12 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  var __defProp = Object.defineProperty;
3
+ var __returnValue = (v) => v;
4
+ function __exportSetter(name, newValue) {
5
+ this[name] = __returnValue.bind(null, newValue);
6
+ }
3
7
  var __export = (target, all) => {
4
8
  for (var name in all)
5
9
  __defProp(target, name, {
6
10
  get: all[name],
7
11
  enumerable: true,
8
12
  configurable: true,
9
- set: (newValue) => all[name] = () => newValue
13
+ set: __exportSetter.bind(all, name)
10
14
  });
11
15
  };
12
16
 
@@ -1397,8 +1401,14 @@ var invitations = sqliteTable("invitations", {
1397
1401
  email: text("email").notNull(),
1398
1402
  profileId: text("profile_id").notNull().references(() => profiles.id),
1399
1403
  status: text("status").$type().notNull().default("pending"),
1404
+ token: text("token"),
1405
+ expiresAt: ts("expires_at"),
1406
+ invitedByProfileId: text("invited_by_profile_id").references(() => profiles.id),
1400
1407
  createdAt: ts("created_at").notNull()
1401
- }, (t) => ({ emailIdx: index("invitations_email_idx").on(t.email, t.status) }));
1408
+ }, (t) => ({
1409
+ emailIdx: index("invitations_email_idx").on(t.email, t.status),
1410
+ tokenIdx: uniqueIndex("invitations_token_idx").on(t.token)
1411
+ }));
1402
1412
  var agentPairings = sqliteTable("agent_pairings", {
1403
1413
  id: text("id").primaryKey(),
1404
1414
  orgId: text("org_id").notNull().references(() => orgs.id),
@@ -1614,6 +1624,7 @@ var notificationCursors = sqliteTable("notification_cursors", {
1614
1624
  lastSeenAt: ts("last_seen_at").notNull()
1615
1625
  });
1616
1626
  // ../core/src/ops/onboarding.ts
1627
+ var INVITE_TTL_MS = 7 * 24 * 60 * 60 * 1000;
1617
1628
  var EMOJI_RE = new RegExp("^\\p{RGI_Emoji}$", "v");
1618
1629
  // ../core/src/ops/agent-pairing.ts
1619
1630
  var PAIRING_TTL_MS = 15 * 60 * 1000;
@@ -13174,7 +13185,7 @@ function finalize(ctx, schema) {
13174
13185
  result.$schema = "http://json-schema.org/draft-07/schema#";
13175
13186
  } else if (ctx.target === "draft-04") {
13176
13187
  result.$schema = "http://json-schema.org/draft-04/schema#";
13177
- } else if (ctx.target === "openapi-3.0") {} else {}
13188
+ } else if (ctx.target === "openapi-3.0") {}
13178
13189
  if (ctx.external?.uri) {
13179
13190
  const id = ctx.external.registry.get(schema)?.id;
13180
13191
  if (!id)
@@ -13418,7 +13429,7 @@ var literalProcessor = (schema, ctx, json, _params) => {
13418
13429
  if (val === undefined) {
13419
13430
  if (ctx.unrepresentable === "throw") {
13420
13431
  throw new Error("Literal `undefined` cannot be represented in JSON Schema");
13421
- } else {}
13432
+ }
13422
13433
  } else if (typeof val === "bigint") {
13423
13434
  if (ctx.unrepresentable === "throw") {
13424
13435
  throw new Error("BigInt literals cannot be represented in JSON Schema");
@@ -16725,24 +16736,29 @@ var httpExecutor = {
16725
16736
 
16726
16737
  // src/output.ts
16727
16738
  import { randomUUID } from "node:crypto";
16739
+ function lastValue(value) {
16740
+ return Array.isArray(value) ? value[value.length - 1] : value;
16741
+ }
16728
16742
  var GLOBAL_BOOLEAN_FLAGS = new Set(["json", "quiet", "no-quiet", "version", "help"]);
16729
16743
  var RESERVED_FLAGS = new Set([...GLOBAL_BOOLEAN_FLAGS, "url", "fields"]);
16730
16744
  var TRUTHY = new Set(["true", "1", "yes", "on"]);
16731
16745
  function truthyFlag(value) {
16732
- return value === true || typeof value === "string" && TRUTHY.has(value.toLowerCase());
16746
+ const v = lastValue(value);
16747
+ return v === true || typeof v === "string" && TRUTHY.has(v.toLowerCase());
16733
16748
  }
16734
16749
  function stringFlag(value, name) {
16735
- if (value === undefined)
16750
+ const v = lastValue(value);
16751
+ if (v === undefined)
16736
16752
  return;
16737
- if (value === true)
16753
+ if (v === true)
16738
16754
  throw new UsageError(`--${name} expects a value`);
16739
- return String(value);
16755
+ return String(v);
16740
16756
  }
16741
16757
  function resolveOutput(flags, opts) {
16742
16758
  const json2 = truthyFlag(flags.json);
16743
16759
  const isTTY = opts?.isTTY ?? Boolean(process.stdout.isTTY);
16744
16760
  const quiet = truthyFlag(flags["no-quiet"]) ? false : truthyFlag(flags.quiet) || json2 || !isTTY;
16745
- const fieldsRaw = flags.fields;
16761
+ const fieldsRaw = lastValue(flags.fields);
16746
16762
  const fields = typeof fieldsRaw === "string" && fieldsRaw.trim() ? fieldsRaw.split(",").map((f) => f.trim()).filter(Boolean) : undefined;
16747
16763
  return { json: json2, quiet, fields };
16748
16764
  }
@@ -16875,7 +16891,7 @@ function buildInput(inputSchema, flags) {
16875
16891
  const input = {};
16876
16892
  for (const spec of flagsForSchema(inputSchema)) {
16877
16893
  if (spec.kind === "string") {
16878
- const fileSrc = flags[`${spec.flag}-file`];
16894
+ const fileSrc = lastValue(flags[`${spec.flag}-file`]);
16879
16895
  if (fileSrc !== undefined) {
16880
16896
  if (flags[spec.flag] !== undefined) {
16881
16897
  throw new UsageError(`pass either --${spec.flag} or --${spec.flag}-file, not both`);
@@ -16897,33 +16913,41 @@ function buildInput(inputSchema, flags) {
16897
16913
  }
16898
16914
  switch (spec.kind) {
16899
16915
  case "number": {
16900
- const n = Number(raw);
16916
+ const n = Number(lastValue(raw));
16901
16917
  if (Number.isNaN(n))
16902
- throw new UsageError(`--${spec.flag} expects a number, got: ${String(raw)}`);
16918
+ throw new UsageError(`--${spec.flag} expects a number, got: ${String(lastValue(raw))}`);
16903
16919
  input[spec.field] = n;
16904
16920
  break;
16905
16921
  }
16906
16922
  case "array": {
16907
- const text3 = String(raw).trim();
16908
- if (text3.startsWith("[")) {
16909
- try {
16910
- const parsed = JSON.parse(text3);
16911
- if (Array.isArray(parsed)) {
16912
- input[spec.field] = parsed;
16913
- break;
16923
+ const tokens = Array.isArray(raw) ? raw : [String(raw)];
16924
+ const out = [];
16925
+ for (const token of tokens) {
16926
+ const text3 = String(token).trim();
16927
+ if (text3.startsWith("[")) {
16928
+ try {
16929
+ const parsed = JSON.parse(text3);
16930
+ if (Array.isArray(parsed)) {
16931
+ out.push(...parsed);
16932
+ continue;
16933
+ }
16934
+ } catch {
16935
+ throw new UsageError(`--${spec.flag} looks like JSON but failed to parse — check the quoting`);
16914
16936
  }
16915
- } catch {
16916
- throw new UsageError(`--${spec.flag} looks like JSON but failed to parse — check the quoting`);
16917
16937
  }
16938
+ for (const part of text3.split(",").map((s) => s.trim()).filter(Boolean))
16939
+ out.push(part);
16918
16940
  }
16919
- input[spec.field] = text3.split(",").map((s) => s.trim()).filter(Boolean);
16941
+ input[spec.field] = out;
16920
16942
  break;
16921
16943
  }
16922
- case "boolean":
16923
- input[spec.field] = raw === true ? true : raw !== "false";
16944
+ case "boolean": {
16945
+ const v = lastValue(raw);
16946
+ input[spec.field] = v === true ? true : v !== "false";
16924
16947
  break;
16948
+ }
16925
16949
  default:
16926
- input[spec.field] = String(raw);
16950
+ input[spec.field] = String(lastValue(raw));
16927
16951
  }
16928
16952
  }
16929
16953
  return input;
@@ -17085,6 +17109,14 @@ async function login(opts) {
17085
17109
  }
17086
17110
 
17087
17111
  // src/index.ts
17112
+ function setFlag(flags, key, value) {
17113
+ const prev = flags[key];
17114
+ if (prev === undefined || typeof value === "boolean" || typeof prev === "boolean") {
17115
+ flags[key] = value;
17116
+ return;
17117
+ }
17118
+ flags[key] = Array.isArray(prev) ? [...prev, value] : [prev, value];
17119
+ }
17088
17120
  function parseArgs(argv) {
17089
17121
  const positionals = [];
17090
17122
  const flags = {};
@@ -17094,11 +17126,11 @@ function parseArgs(argv) {
17094
17126
  const body = arg.slice(2);
17095
17127
  const eq = body.indexOf("=");
17096
17128
  if (eq !== -1) {
17097
- flags[body.slice(0, eq)] = body.slice(eq + 1);
17129
+ setFlag(flags, body.slice(0, eq), body.slice(eq + 1));
17098
17130
  } else if (!GLOBAL_BOOLEAN_FLAGS.has(body) && i + 1 < argv.length && !argv[i + 1].startsWith("--")) {
17099
- flags[body] = argv[++i];
17131
+ setFlag(flags, body, argv[++i]);
17100
17132
  } else {
17101
- flags[body] = true;
17133
+ setFlag(flags, body, true);
17102
17134
  }
17103
17135
  } else {
17104
17136
  positionals.push(arg);
@@ -17128,7 +17160,7 @@ async function renderMe(ctx, action) {
17128
17160
  ` : "") + spaceLines;
17129
17161
  emitDual(me, human, action, ctx);
17130
17162
  }
17131
- var CLI_NOTE = `On this CLI, before your first write: flag names are kebab-derived from the inputs (\`--thread-id\`, \`--request-id\`, \`--contribution-id\` — not \`--thread\`/\`--request\`), so check \`arbor help\` or \`arbor <command> --help\` for a command's exact flags instead of guessing. Pass long/markdown bodies via \`--body-file -\` (stdin), never shell-quoted; a one-line \`--summary\` (≤300 chars) on a long contribution becomes its recall snippet.`;
17163
+ var CLI_NOTE = `On this CLI, before your first write: flag names are kebab-derived from the inputs (\`--thread-id\`, \`--request-id\`, \`--contribution-id\` — not \`--thread\`/\`--request\`), so check \`arbor help\` or \`arbor <command> --help\` for a command's exact flags instead of guessing. Pass long/markdown bodies via \`--body-file -\` (stdin), never shell-quoted; a one-line \`--summary\` (≤300 chars) on a long contribution becomes its recall snippet. List inputs (e.g. \`--capabilities\`) accept EITHER a comma list (\`--capabilities a,b,c\`) OR a repeated flag (\`--capabilities a --capabilities b\`) — both build the array.`;
17132
17164
  function renderOrient(ctx) {
17133
17165
  emitDual({ orientation: ORIENTATION, cliNote: CLI_NOTE }, `${ORIENTATION}
17134
17166
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambdacurry/arbor",
3
- "version": "0.4.24",
3
+ "version": "0.4.25",
4
4
  "description": "The Arbor CLI — a shared workspace for people and agents. The human + headless-agent write path over Arbor's guarded operation surface.",
5
5
  "type": "module",
6
6
  "bin": {