@arbidocs/cli 0.4.85 → 0.4.87

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,18 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.4.87
4
+
5
+ [compare changes](https://github.com/arbicity/ARBI-frontend/compare/v0.4.85...HEAD)
6
+
7
+ ### 🚀 Enhancements
8
+
9
+ - **docx:** Open AI drafts as their stored DOCX ([59c17460a](https://github.com/arbicity/ARBI-frontend/commit/59c17460a))
10
+ - **notifications:** Follow/mute controls and workspace activity feed ([c36826bfd](https://github.com/arbicity/ARBI-frontend/commit/c36826bfd))
11
+
12
+ ### 🩹 Fixes
13
+
14
+ - Type follow/mute patches and CLI activity rows against the regenerated schema ([4f88de687](https://github.com/arbicity/ARBI-frontend/commit/4f88de687))
15
+
3
16
  ## v0.4.85
4
17
 
5
18
  [compare changes](https://github.com/arbicity/ARBI-frontend/compare/v0.4.83...HEAD)
package/dist/index.js CHANGED
@@ -114,9 +114,9 @@ function getCachedWorkspaceName(id) {
114
114
  return null;
115
115
  }
116
116
  }
117
- function updateCompletionCache(workspaces4) {
117
+ function updateCompletionCache(workspaces5) {
118
118
  const cache = {
119
- workspaces: workspaces4.filter((w) => w.external_id).map((w) => ({ id: w.external_id, name: w.name ?? "" })),
119
+ workspaces: workspaces5.filter((w) => w.external_id).map((w) => ({ id: w.external_id, name: w.name ?? "" })),
120
120
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
121
121
  };
122
122
  const filePath = getCacheFile();
@@ -3695,7 +3695,7 @@ function getLatestVersion(skipCache = false) {
3695
3695
  }
3696
3696
  }
3697
3697
  function getCurrentVersion() {
3698
- return "0.4.85";
3698
+ return "0.4.87";
3699
3699
  }
3700
3700
  function readChangelog(fromVersion, toVersion) {
3701
3701
  try {
@@ -3748,17 +3748,17 @@ function showChangelog(fromVersion, toVersion) {
3748
3748
  async function checkForUpdates(autoUpdate) {
3749
3749
  try {
3750
3750
  const latest = getLatestVersion();
3751
- if (!latest || latest === "0.4.85") return;
3751
+ if (!latest || latest === "0.4.87") return;
3752
3752
  if (autoUpdate) {
3753
3753
  warn(`
3754
- Your arbi version is out of date (${"0.4.85"} \u2192 ${latest}). Updating...`);
3754
+ Your arbi version is out of date (${"0.4.87"} \u2192 ${latest}). Updating...`);
3755
3755
  child_process.execSync("npm install -g @arbidocs/cli@latest", { stdio: "inherit" });
3756
- showChangelog("0.4.85", latest);
3756
+ showChangelog("0.4.87", latest);
3757
3757
  console.log(`Updated to ${latest}.`);
3758
3758
  } else {
3759
3759
  warn(
3760
3760
  `
3761
- Your arbi version is out of date (${"0.4.85"} \u2192 ${latest}).
3761
+ Your arbi version is out of date (${"0.4.87"} \u2192 ${latest}).
3762
3762
  Run "arbi update" to upgrade, or "arbi update auto" to always stay up to date.`
3763
3763
  );
3764
3764
  }
@@ -3790,10 +3790,10 @@ function markNagShown(latest) {
3790
3790
  function hintUpdateOnError() {
3791
3791
  try {
3792
3792
  const cached = readCache();
3793
- if (!cached || cached.latest === "0.4.85") return;
3793
+ if (!cached || cached.latest === "0.4.87") return;
3794
3794
  if (!shouldShowNag(cached.latest)) return;
3795
3795
  warn(
3796
- `Your arbi version is out of date (${"0.4.85"} \u2192 ${cached.latest}). Run "arbi update".`
3796
+ `Your arbi version is out of date (${"0.4.87"} \u2192 ${cached.latest}). Run "arbi update".`
3797
3797
  );
3798
3798
  markNagShown(cached.latest);
3799
3799
  } catch {
@@ -4356,8 +4356,8 @@ Open this URL in your browser:
4356
4356
  })();
4357
4357
  if (!opts.json) success(`Logged in as ${email}`);
4358
4358
  clearChatSession();
4359
- const { data: workspaces4 } = await arbi.fetch.GET("/v1/user/workspaces");
4360
- const wsList = workspaces4 || [];
4359
+ const { data: workspaces5 } = await arbi.fetch.GET("/v1/user/workspaces");
4360
+ const wsList = workspaces5 || [];
4361
4361
  updateCompletionCache(wsList);
4362
4362
  const memberWorkspaces = wsList.filter(
4363
4363
  (ws) => ws.users?.some((u) => u.user.email === email)
@@ -4738,8 +4738,8 @@ async function loginAfterRegister(config, email, password2, { json = false } = {
4738
4738
  try {
4739
4739
  const { arbi, loginResult } = await sdk.performPasswordLogin(config, email, password2, store);
4740
4740
  if (!json) success(`Logged in as ${email}`);
4741
- const { data: workspaces4 } = await arbi.fetch.GET("/v1/user/workspaces");
4742
- const wsList = workspaces4 || [];
4741
+ const { data: workspaces5 } = await arbi.fetch.GET("/v1/user/workspaces");
4742
+ const wsList = workspaces5 || [];
4743
4743
  updateCompletionCache(wsList);
4744
4744
  const memberWorkspaces = wsList.filter((ws) => ws.users?.some((u) => u.user.email === email));
4745
4745
  let selectedWorkspace;
@@ -9304,15 +9304,15 @@ function registerConversationsCommand(program2) {
9304
9304
  });
9305
9305
  }
9306
9306
  function registerSettingsCommand(program2) {
9307
- const settings = program2.command("settings").description("User settings: get, set");
9308
- settings.command("get").description("Show current user settings (always JSON; --json accepted for consistency)").option("--json", "Output as JSON (default \u2014 always JSON)").action(
9307
+ const settings2 = program2.command("settings").description("User settings: get, set");
9308
+ settings2.command("get").description("Show current user settings (always JSON; --json accepted for consistency)").option("--json", "Output as JSON (default \u2014 always JSON)").action(
9309
9309
  () => runAction(async () => {
9310
9310
  const { arbi } = await resolveAuth();
9311
9311
  const data = await sdk.settings.getSettings(arbi);
9312
9312
  printJson(data);
9313
9313
  })()
9314
9314
  );
9315
- settings.command("set <json>").description("Update user settings (pass JSON object)").action(
9315
+ settings2.command("set <json>").description("Update user settings (pass JSON object)").action(
9316
9316
  (json) => runAction(async () => {
9317
9317
  const body = parseJsonArg(json, `arbi settings set '{"hide_online_status": true}'`);
9318
9318
  const { arbi } = await resolveAuth();
@@ -9320,8 +9320,8 @@ function registerSettingsCommand(program2) {
9320
9320
  success("Settings updated.");
9321
9321
  })()
9322
9322
  );
9323
- settings.action(async () => {
9324
- await settings.commands.find((c) => c.name() === "get").parseAsync([], { from: "user" });
9323
+ settings2.action(async () => {
9324
+ await settings2.commands.find((c) => c.name() === "get").parseAsync([], { from: "user" });
9325
9325
  });
9326
9326
  }
9327
9327
  init_prompts();
@@ -9770,8 +9770,8 @@ async function runQuickstart(url) {
9770
9770
  try {
9771
9771
  const { arbi, loginResult } = await sdk.performPasswordLogin(config, email, password2, store);
9772
9772
  success(`Logged in as ${email}`);
9773
- const { data: workspaces4 } = await arbi.fetch.GET("/v1/user/workspaces");
9774
- const wsList = workspaces4 || [];
9773
+ const { data: workspaces5 } = await arbi.fetch.GET("/v1/user/workspaces");
9774
+ const wsList = workspaces5 || [];
9775
9775
  const memberWorkspaces = wsList.filter((ws) => ws.users?.some((u) => u.user.email === email));
9776
9776
  const userProjects = await sdk.projects.listProjects(arbi);
9777
9777
  const defaultProjectExtId = userProjects[0]?.external_id;
@@ -12062,6 +12062,120 @@ function registerSkillsCommand(program2) {
12062
12062
  })()
12063
12063
  );
12064
12064
  }
12065
+ function activitySubject(entry) {
12066
+ if (entry.source === "document") {
12067
+ const name = entry.document_name ?? entry.document_ext_id ?? "";
12068
+ return entry.kind === "document_uploaded" || !entry.version ? name : `${name} (v${entry.version})`;
12069
+ }
12070
+ if (entry.source === "workflow") {
12071
+ const name = entry.workflow_name ?? entry.workflow_ext_id ?? "";
12072
+ return entry.status ? `${name} [${entry.status}]` : name;
12073
+ }
12074
+ return entry.conversation_title ?? entry.conversation_ext_id ?? "";
12075
+ }
12076
+ var kindOf = (id) => id.startsWith("wrk-") ? "workspace" : id.startsWith("con-") ? "thread" : /^(usr|agt)-/.test(id) ? "person" : null;
12077
+ function requireKind(id, allowed, verb) {
12078
+ const kind = kindOf(id);
12079
+ if (!kind || !allowed.includes(kind)) {
12080
+ throw new Error(
12081
+ kind === "thread" && verb === "mute" ? "Threads cannot be muted: a thread you are not part of is not pushed. Unfollow it instead." : `Cannot ${verb} "${id}": expected ${allowed.map((k) => k === "workspace" ? "wrk-\u2026" : k === "thread" ? "con-\u2026" : "usr-\u2026/agt-\u2026").join(" or ")}.`
12082
+ );
12083
+ }
12084
+ return kind;
12085
+ }
12086
+ function registerRelevanceCommands(program2) {
12087
+ const workspace = program2.commands.find((c) => c.name() === "workspace") ?? program2.command("workspace").description("Workspace management");
12088
+ workspace.command("activity").description("What happened in the workspace, newest first (threads, posts, documents, runs)").option("-w, --workspace <id>", "Workspace ID (defaults to selected workspace)").option("-l, --limit <n>", "Entries per page (1-100, default 30)", (v) => parseInt(v, 10)).option("--cursor <cursor>", "Continue after a previous page (its next_cursor)").option("--all", "Read every page").option("--json", "Output as JSON: { items, next_cursor }").action(
12089
+ (opts) => runAction(async () => {
12090
+ const { arbi, workspaceId } = await resolveWorkspace(opts.workspace);
12091
+ const items = [];
12092
+ let cursor = opts.cursor;
12093
+ do {
12094
+ const page = await sdk.workspaces.getWorkspaceActivity(arbi, workspaceId, {
12095
+ cursor,
12096
+ limit: opts.limit
12097
+ });
12098
+ items.push(...page.items);
12099
+ cursor = page.next_cursor;
12100
+ } while (opts.all && cursor);
12101
+ if (opts.json) {
12102
+ printJson({ items, next_cursor: cursor ?? null });
12103
+ return;
12104
+ }
12105
+ if (!emitListOrTable(items, {}, "No activity.")) return;
12106
+ printTable(
12107
+ [
12108
+ { header: "TIME", width: 22, value: (r) => String(r.created_at).slice(0, 19) },
12109
+ { header: "KIND", width: 22, value: (r) => r.kind },
12110
+ { header: "BY", width: 15, value: (r) => r.actor_ext_id ?? "" },
12111
+ {
12112
+ header: "SUBJECT",
12113
+ width: 42,
12114
+ value: (r) => truncate(activitySubject(r), 41)
12115
+ }
12116
+ ],
12117
+ items
12118
+ );
12119
+ if (cursor) process.stderr.write(`More: --cursor ${cursor}
12120
+ `);
12121
+ })()
12122
+ );
12123
+ program2.command("follow [id]").description("Follow a workspace (wrk-\u2026) or thread (con-\u2026): be notified of everything in it").option("--off", "Stop following").option("--json", "Output as JSON (the list, when no id is given)").action(
12124
+ (id, opts) => runAction(async () => {
12125
+ const { arbi } = await resolveAuth();
12126
+ if (!id) {
12127
+ const s = await sdk.settings.getSettings(arbi);
12128
+ const rows = [
12129
+ ...s.followed_workspaces.map((x) => ({ id: x, kind: "workspace" })),
12130
+ ...s.followed_threads.map((x) => ({ id: x, kind: "thread" }))
12131
+ ];
12132
+ if (!emitListOrTable(rows, opts, "Following nothing.")) return;
12133
+ printTable(
12134
+ [
12135
+ { header: "ID", width: 16, value: (r) => r.id },
12136
+ { header: "KIND", width: 10, value: (r) => r.kind }
12137
+ ],
12138
+ rows
12139
+ );
12140
+ return;
12141
+ }
12142
+ const kind = requireKind(id, ["workspace", "thread"], "follow");
12143
+ if (kind === "thread")
12144
+ await sdk.settings.setListMembership(arbi, "followed_threads", id, !opts.off);
12145
+ else if (opts.off) await sdk.settings.setListMembership(arbi, "followed_workspaces", id, false);
12146
+ else await sdk.settings.setWorkspaceNotificationLevel(arbi, id, "following");
12147
+ success(opts.off ? `Unfollowed ${id}` : `Following ${id}`);
12148
+ })()
12149
+ );
12150
+ program2.command("mute [id]").description(
12151
+ "Mute a workspace (wrk-\u2026) or person (usr-/agt-\u2026): no notifications, mentions included"
12152
+ ).option("--off", "Unmute").option("--json", "Output as JSON (the list, when no id is given)").action(
12153
+ (id, opts) => runAction(async () => {
12154
+ const { arbi } = await resolveAuth();
12155
+ if (!id) {
12156
+ const s = await sdk.settings.getSettings(arbi);
12157
+ const rows = [
12158
+ ...s.muted_workspaces.map((x) => ({ id: x, kind: "workspace" })),
12159
+ ...s.muted_users.map((x) => ({ id: x, kind: "person" }))
12160
+ ];
12161
+ if (!emitListOrTable(rows, opts, "Nothing muted.")) return;
12162
+ printTable(
12163
+ [
12164
+ { header: "ID", width: 16, value: (r) => r.id },
12165
+ { header: "KIND", width: 10, value: (r) => r.kind }
12166
+ ],
12167
+ rows
12168
+ );
12169
+ return;
12170
+ }
12171
+ const kind = requireKind(id, ["workspace", "person"], "mute");
12172
+ if (kind === "person") await sdk.settings.setListMembership(arbi, "muted_users", id, !opts.off);
12173
+ else if (opts.off) await sdk.settings.setListMembership(arbi, "muted_workspaces", id, false);
12174
+ else await sdk.settings.setWorkspaceNotificationLevel(arbi, id, "muted");
12175
+ success(opts.off ? `Unmuted ${id}` : `Muted ${id}`);
12176
+ })()
12177
+ );
12178
+ }
12065
12179
 
12066
12180
  // src/index.ts
12067
12181
  console.debug = () => {
@@ -12072,7 +12186,7 @@ console.info = (...args) => {
12072
12186
  _origInfo(...args);
12073
12187
  };
12074
12188
  var program = new commander.Command();
12075
- program.name("arbi").description("ARBI CLI \u2014 interact with ARBI from the terminal").version("0.4.85").showHelpAfterError(true).showSuggestionAfterError(true);
12189
+ program.name("arbi").description("ARBI CLI \u2014 interact with ARBI from the terminal").version("0.4.87").showHelpAfterError(true).showSuggestionAfterError(true);
12076
12190
  registerConfigCommand(program);
12077
12191
  registerLoginCommand(program);
12078
12192
  registerRegisterCommand(program);
@@ -12115,6 +12229,7 @@ registerFilesCommand(program);
12115
12229
  registerUsageCommand(program);
12116
12230
  registerAuthCommand(program);
12117
12231
  registerSkillsCommand(program);
12232
+ registerRelevanceCommands(program);
12118
12233
  applyHelpGroups(program, {
12119
12234
  "Getting started:": [
12120
12235
  "quickstart",
@@ -12129,7 +12244,15 @@ applyHelpGroups(program, {
12129
12244
  "Documents:": ["docs", "doc", "add", "upload", "download"],
12130
12245
  "Search & ask:": ["ask", "find", "cite", "watch"],
12131
12246
  "Tagging:": ["tags", "doctags"],
12132
- "Conversations & messaging:": ["convo", "dm", "listen", "notifications", "contacts"],
12247
+ "Conversations & messaging:": [
12248
+ "convo",
12249
+ "dm",
12250
+ "listen",
12251
+ "notifications",
12252
+ "follow",
12253
+ "mute",
12254
+ "contacts"
12255
+ ],
12133
12256
  "Agents & tasks:": ["agent", "agent-create", "task", "workflow", "run", "agentconfig", "session"],
12134
12257
  "Account:": ["auth", "usage", "files"],
12135
12258
  "System:": ["health", "models", "settings", "tui", "local", "update"]