@arbidocs/cli 0.5.118 → 0.5.120

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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.5.120
4
+
5
+ [compare changes](https://github.com/arbicity/ARBI-frontend/compare/v0.5.119...HEAD)
6
+
7
+ ### 🚀 Enhancements
8
+
9
+ - **react:** Sharing entity pill (Only me / Workspace) with member hover ([#2310](https://github.com/arbicity/ARBI-frontend/pull/2310))
10
+ - **blocks:** Light a citation's passages on the PDF page ([#2308](https://github.com/arbicity/ARBI-frontend/pull/2308))
11
+
12
+ ## v0.5.119
13
+
14
+ [compare changes](https://github.com/arbicity/ARBI-frontend/compare/v0.5.118...HEAD)
15
+
16
+ ### 🩹 Fixes
17
+
18
+ - **cli:** Make presence output explicit and resolve display names ([#2303](https://github.com/arbicity/ARBI-frontend/pull/2303))
19
+
3
20
  ## v0.5.118
4
21
 
5
22
  [compare changes](https://github.com/arbicity/ARBI-frontend/compare/v0.5.117...HEAD)
package/dist/index.js CHANGED
@@ -3689,7 +3689,7 @@ function getLatestVersion(skipCache = false) {
3689
3689
  }
3690
3690
  }
3691
3691
  function getCurrentVersion() {
3692
- return "0.5.118";
3692
+ return "0.5.120";
3693
3693
  }
3694
3694
  function readChangelog(fromVersion, toVersion) {
3695
3695
  try {
@@ -3742,17 +3742,17 @@ function showChangelog(fromVersion, toVersion) {
3742
3742
  async function checkForUpdates(autoUpdate) {
3743
3743
  try {
3744
3744
  const latest = getLatestVersion();
3745
- if (!latest || latest === "0.5.118") return;
3745
+ if (!latest || latest === "0.5.120") return;
3746
3746
  if (autoUpdate) {
3747
3747
  warn(`
3748
- Your arbi version is out of date (${"0.5.118"} \u2192 ${latest}). Updating...`);
3748
+ Your arbi version is out of date (${"0.5.120"} \u2192 ${latest}). Updating...`);
3749
3749
  child_process.execSync("npm install -g @arbidocs/cli@latest", { stdio: "inherit" });
3750
- showChangelog("0.5.118", latest);
3750
+ showChangelog("0.5.120", latest);
3751
3751
  console.log(`Updated to ${latest}.`);
3752
3752
  } else {
3753
3753
  warn(
3754
3754
  `
3755
- Your arbi version is out of date (${"0.5.118"} \u2192 ${latest}).
3755
+ Your arbi version is out of date (${"0.5.120"} \u2192 ${latest}).
3756
3756
  Run "arbi update" to upgrade, or "arbi update auto" to always stay up to date.`
3757
3757
  );
3758
3758
  }
@@ -3784,10 +3784,10 @@ function markNagShown(latest) {
3784
3784
  function hintUpdateOnError() {
3785
3785
  try {
3786
3786
  const cached = readCache();
3787
- if (!cached || cached.latest === "0.5.118") return;
3787
+ if (!cached || cached.latest === "0.5.120") return;
3788
3788
  if (!shouldShowNag(cached.latest)) return;
3789
3789
  warn(
3790
- `Your arbi version is out of date (${"0.5.118"} \u2192 ${cached.latest}). Run "arbi update".`
3790
+ `Your arbi version is out of date (${"0.5.120"} \u2192 ${cached.latest}). Run "arbi update".`
3791
3791
  );
3792
3792
  markNagShown(cached.latest);
3793
3793
  } catch {
@@ -3858,6 +3858,7 @@ async function startBackgroundNotifications(baseUrl, accessToken) {
3858
3858
  baseUrl,
3859
3859
  accessToken,
3860
3860
  onMessage: (msg) => {
3861
+ if (msg.type === "presence_update") return;
3861
3862
  if (client.isMessageType(msg, "response_complete")) {
3862
3863
  updateTaskStatus(msg.response_id, msg.status);
3863
3864
  }
@@ -5034,14 +5035,14 @@ function registerDmCommand(program2) {
5034
5035
  requireInteractive(
5035
5036
  'Pass recipient + message as arguments: arbi dm send <email-or-id> "<message>"'
5036
5037
  );
5037
- const contacts = await sdk.contacts.listContacts(arbi);
5038
- if (contacts.length === 0) {
5038
+ const contacts2 = await sdk.contacts.listContacts(arbi);
5039
+ if (contacts2.length === 0) {
5039
5040
  error("No contacts found. Add contacts first: arbi contacts add <email>");
5040
5041
  process.exit(1);
5041
5042
  }
5042
5043
  recipient = await promptSelect(
5043
5044
  "Send to",
5044
- contacts.map((c) => {
5045
+ contacts2.map((c) => {
5045
5046
  const u = c.user;
5046
5047
  const name = sdk.formatUserName(u);
5047
5048
  return {
@@ -8232,6 +8233,36 @@ Found ${chalk2__default.default.bold(String(filtered.length))} result${filtered.
8232
8233
  })()
8233
8234
  );
8234
8235
  }
8236
+ function presenceRequested(types) {
8237
+ return types?.has("presence_update") === true;
8238
+ }
8239
+ async function loadPresenceNames(arbi) {
8240
+ const names = /* @__PURE__ */ new Map();
8241
+ await Promise.allSettled([
8242
+ sdk.contacts.listContacts(arbi).then((rows) => {
8243
+ for (const row of rows) {
8244
+ const id = row.user?.external_id;
8245
+ const name = row.card?.name || sdk.formatUserName(row.user);
8246
+ if (id && name) names.set(id, name);
8247
+ }
8248
+ }),
8249
+ sdk.agents.listAgents(arbi).then((rows) => {
8250
+ for (const row of rows) {
8251
+ const name = sdk.formatUserName(row);
8252
+ if (name) names.set(row.external_id, name);
8253
+ }
8254
+ }),
8255
+ arbi.fetch.GET("/v1/user/me").then(({ data }) => {
8256
+ if (data) {
8257
+ const name = sdk.formatUserName(data);
8258
+ if (name) names.set(data.external_id, name);
8259
+ }
8260
+ })
8261
+ ]);
8262
+ return names;
8263
+ }
8264
+
8265
+ // src/commands/watch.ts
8235
8266
  function colorize2(level, text) {
8236
8267
  if (level === "success") return chalk2__default.default.green(text);
8237
8268
  if (level === "error") return chalk2__default.default.red(text);
@@ -8249,10 +8280,10 @@ var KNOWN_WATCH_TYPES = [
8249
8280
  function registerWatchCommand(program2) {
8250
8281
  program2.command("watch").description("Watch workspace activity in real time").option("-w, --workspace <id>", "Workspace ID (defaults to selected workspace)").option("-t, --timeout <seconds>", "Auto-close after N seconds").option("-n, --count <n>", "Stop after N messages").option(
8251
8282
  "--type <comma-list>",
8252
- `Only emit events of these types (default: all). Known: ${KNOWN_WATCH_TYPES.join(",")}`
8283
+ `Only emit these event types (default: all except presence). Known: ${KNOWN_WATCH_TYPES.join(",")}`
8253
8284
  ).option("--json", "Output NDJSON (one JSON object per line)").action(
8254
8285
  (opts) => runAction(async () => {
8255
- const { config, accessToken, workspaceId } = await resolveWorkspace(opts.workspace, {
8286
+ const { arbi, config, accessToken, workspaceId } = await resolveWorkspace(opts.workspace, {
8256
8287
  skipNotifications: true
8257
8288
  });
8258
8289
  const timeoutSec = opts.timeout ? parseInt(opts.timeout, 10) : void 0;
@@ -8280,6 +8311,8 @@ Known: ${KNOWN_WATCH_TYPES.join(", ")}`
8280
8311
  parts.push("(Ctrl+C to stop)");
8281
8312
  console.log(parts.join(" "));
8282
8313
  }
8314
+ const presenceNames = !jsonMode && presenceRequested(typeFilter) ? await loadPresenceNames(arbi) : /* @__PURE__ */ new Map();
8315
+ const presenceStates = /* @__PURE__ */ new Map();
8283
8316
  let messageCount = 0;
8284
8317
  let timedOut = false;
8285
8318
  let onDone;
@@ -8290,16 +8323,28 @@ Known: ${KNOWN_WATCH_TYPES.join(", ")}`
8290
8323
  baseUrl: config.baseUrl,
8291
8324
  accessToken,
8292
8325
  onMessage: (msg) => {
8326
+ if (msg.type === "presence_update" && !presenceRequested(typeFilter)) return;
8293
8327
  if (typeFilter) {
8294
8328
  const type = msg.type;
8295
8329
  if (!type || !typeFilter.has(type)) return;
8296
8330
  }
8331
+ if (msg.type === "presence_update" && !jsonMode && "user_id" in msg && "status" in msg) {
8332
+ const id = String(msg.user_id);
8333
+ const status2 = String(msg.status);
8334
+ if (presenceStates.get(id) === status2) return;
8335
+ presenceStates.set(id, status2);
8336
+ }
8297
8337
  messageCount++;
8298
8338
  if (jsonMode) {
8299
8339
  console.log(JSON.stringify(msg));
8300
8340
  } else {
8301
- const { text, level } = sdk.formatWsMessage(msg);
8302
- console.log(colorize2(level, text));
8341
+ if (msg.type === "presence_update" && "user_id" in msg && "status" in msg) {
8342
+ const id = String(msg.user_id);
8343
+ console.log(`${presenceNames.get(id) || id} is ${msg.status}`);
8344
+ } else {
8345
+ const { text, level } = sdk.formatWsMessage(msg);
8346
+ console.log(colorize2(level, text));
8347
+ }
8303
8348
  }
8304
8349
  if (maxCount && messageCount >= maxCount) {
8305
8350
  if (!jsonMode) console.log(chalk2__default.default.dim(`
@@ -8374,8 +8419,8 @@ function redactPictures(rows) {
8374
8419
  });
8375
8420
  }
8376
8421
  function registerContactsCommand(program2) {
8377
- const contacts = program2.command("contacts").description("Contacts: list, add, search, remove");
8378
- contacts.command("list").description("List all contacts").option("--json", "Output as JSON").option("--include-pictures", "Keep base64 profile-picture bytes in --json output").action(
8422
+ const contacts2 = program2.command("contacts").description("Contacts: list, add, search, remove");
8423
+ contacts2.command("list").description("List all contacts").option("--json", "Output as JSON").option("--include-pictures", "Keep base64 profile-picture bytes in --json output").action(
8379
8424
  (opts) => runAction(async () => {
8380
8425
  const { arbi } = await resolveAuth();
8381
8426
  const data = await sdk.contacts.listContacts(arbi);
@@ -8402,7 +8447,7 @@ function registerContactsCommand(program2) {
8402
8447
  );
8403
8448
  })()
8404
8449
  );
8405
- contacts.command("add [emails...]").description("Invite or link people by email (prompt if no emails given)").action(
8450
+ contacts2.command("add [emails...]").description("Invite or link people by email (prompt if no emails given)").action(
8406
8451
  (emails) => runAction(async () => {
8407
8452
  const { arbi } = await resolveAuth();
8408
8453
  if (!emails || emails.length === 0) {
@@ -8422,7 +8467,7 @@ function registerContactsCommand(program2) {
8422
8467
  }
8423
8468
  })()
8424
8469
  );
8425
- contacts.command("search <query>").description("Search your contacts and people who share a workspace with you").option("--json", "Output as JSON").action(
8470
+ contacts2.command("search <query>").description("Search your contacts and people who share a workspace with you").option("--json", "Output as JSON").action(
8426
8471
  (query, opts) => runAction(async () => {
8427
8472
  const { arbi } = await resolveAuth();
8428
8473
  const data = await sdk.contacts.searchContacts(arbi, query);
@@ -8444,7 +8489,7 @@ function registerContactsCommand(program2) {
8444
8489
  );
8445
8490
  })()
8446
8491
  );
8447
- contacts.command("remove [ids...]").description("Remove contacts (interactive picker if no IDs given)").option("--dry-run", "Preview which contacts would be removed (no SDK call)").action(
8492
+ contacts2.command("remove [ids...]").description("Remove contacts (interactive picker if no IDs given)").option("--dry-run", "Preview which contacts would be removed (no SDK call)").action(
8448
8493
  (ids, opts) => runAction(async () => {
8449
8494
  const { arbi } = await resolveAuth();
8450
8495
  let contactIds = ids && ids.length > 0 ? ids : void 0;
@@ -8476,9 +8521,9 @@ function registerContactsCommand(program2) {
8476
8521
  success(`Removed ${contactIds.length} contact(s).`);
8477
8522
  })()
8478
8523
  );
8479
- contacts.allowUnknownOption(true).allowExcessArguments(true).action(async () => {
8480
- const tail = contacts.args ?? [];
8481
- await contacts.commands.find((c) => c.name() === "list").parseAsync(tail, { from: "user" });
8524
+ contacts2.allowUnknownOption(true).allowExcessArguments(true).action(async () => {
8525
+ const tail = contacts2.args ?? [];
8526
+ await contacts2.commands.find((c) => c.name() === "list").parseAsync(tail, { from: "user" });
8482
8527
  });
8483
8528
  }
8484
8529
  async function resolveMembers(arbi, refs) {
@@ -12635,7 +12680,7 @@ console.info = (...args) => {
12635
12680
  _origInfo(...args);
12636
12681
  };
12637
12682
  var program = new commander.Command();
12638
- program.name("arbi").description("ARBI CLI \u2014 interact with ARBI from the terminal").version("0.5.118").showHelpAfterError(true).showSuggestionAfterError(true);
12683
+ program.name("arbi").description("ARBI CLI \u2014 interact with ARBI from the terminal").version("0.5.120").showHelpAfterError(true).showSuggestionAfterError(true);
12639
12684
  registerConfigCommand(program);
12640
12685
  registerLoginCommand(program);
12641
12686
  registerRegisterCommand(program);