@arbidocs/cli 0.3.64 → 0.3.66

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,42 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.3.66
4
+
5
+ [compare changes](https://github.com/arbicity/ARBI-frontend/compare/v0.3.65...HEAD)
6
+
7
+ ### 🚀 Enhancements
8
+
9
+ - **artifact:** Always-editable .md tab + mount-time normalisation absorption ([#754](https://github.com/arbicity/ARBI-frontend/pull/754))
10
+ - **dm:** WhatsApp-style chat bubbles, conversation header, date separators ([#762](https://github.com/arbicity/ARBI-frontend/pull/762))
11
+
12
+ ### 🩹 Fixes
13
+
14
+ - **pdf:** Polyfill the bleeding-edge TC39 APIs pdfjs 5.x relies on ([#755](https://github.com/arbicity/ARBI-frontend/pull/755))
15
+ - **grid:** Filter task_update transactions to rows the grid actually has ([#756](https://github.com/arbicity/ARBI-frontend/pull/756))
16
+ - **auth:** Gate protected queries on token+user, not token alone ([#757](https://github.com/arbicity/ARBI-frontend/pull/757))
17
+ - **mcp:** Read 'sk' JWT claim, not 'session_key', in openAllWorkspacesForSession ([#758](https://github.com/arbicity/ARBI-frontend/pull/758))
18
+ - **docviewer:** Treat *.md uploads as markdown docs; restore Edit/Cancel toggle ([#760](https://github.com/arbicity/ARBI-frontend/pull/760))
19
+ - **ui:** Restore logout modal with active sessions list ([#768](https://github.com/arbicity/ARBI-frontend/pull/768))
20
+ - **sdk,cli:** Keep PA-agent CLI on the same session across workspace touches ([#769](https://github.com/arbicity/ARBI-frontend/pull/769))
21
+ - **sdk:** Restore userExtId and always call /open in session fast-path ([#771](https://github.com/arbicity/ARBI-frontend/pull/771))
22
+
23
+ ### 💅 Refactors
24
+
25
+ - Remove obsolete isDelegatedSession state ([#765](https://github.com/arbicity/ARBI-frontend/pull/765), [#766](https://github.com/arbicity/ARBI-frontend/pull/766))
26
+
27
+ ### 🏡 Chore
28
+
29
+ - **lint:** Zero warnings — drop unused userSettings hook in Dashboard, extract UserSettings experimental section ([#753](https://github.com/arbicity/ARBI-frontend/pull/753))
30
+ - **ci:** Run SDK unit tests on every PR ([#770](https://github.com/arbicity/ARBI-frontend/pull/770))
31
+
32
+ ## v0.3.65
33
+
34
+ [compare changes](https://github.com/arbicity/ARBI-frontend/compare/v0.3.64...HEAD)
35
+
36
+ ### 🩹 Fixes
37
+
38
+ - **tsc:** Zero typecheck errors across all four packages ([#752](https://github.com/arbicity/ARBI-frontend/pull/752))
39
+
3
40
  ## v0.3.64
4
41
 
5
42
  [compare changes](https://github.com/arbicity/ARBI-frontend/compare/v0.3.63...HEAD)
package/dist/index.js CHANGED
@@ -113,9 +113,9 @@ function getCachedWorkspaceName(id) {
113
113
  return null;
114
114
  }
115
115
  }
116
- function updateCompletionCache(workspaces3) {
116
+ function updateCompletionCache(workspaces4) {
117
117
  const cache = {
118
- workspaces: workspaces3.filter((w) => w.external_id).map((w) => ({ id: w.external_id, name: w.name ?? "" })),
118
+ workspaces: workspaces4.filter((w) => w.external_id).map((w) => ({ id: w.external_id, name: w.name ?? "" })),
119
119
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
120
120
  };
121
121
  const filePath = getCacheFile();
@@ -3694,7 +3694,7 @@ function getLatestVersion(skipCache = false) {
3694
3694
  }
3695
3695
  }
3696
3696
  function getCurrentVersion() {
3697
- return "0.3.64";
3697
+ return "0.3.66";
3698
3698
  }
3699
3699
  function readChangelog(fromVersion, toVersion) {
3700
3700
  try {
@@ -3747,17 +3747,17 @@ function showChangelog(fromVersion, toVersion) {
3747
3747
  async function checkForUpdates(autoUpdate) {
3748
3748
  try {
3749
3749
  const latest = getLatestVersion();
3750
- if (!latest || latest === "0.3.64") return;
3750
+ if (!latest || latest === "0.3.66") return;
3751
3751
  if (autoUpdate) {
3752
3752
  warn(`
3753
- Your arbi version is out of date (${"0.3.64"} \u2192 ${latest}). Updating...`);
3753
+ Your arbi version is out of date (${"0.3.66"} \u2192 ${latest}). Updating...`);
3754
3754
  child_process.execSync("npm install -g @arbidocs/cli@latest", { stdio: "inherit" });
3755
- showChangelog("0.3.64", latest);
3755
+ showChangelog("0.3.66", latest);
3756
3756
  console.log(`Updated to ${latest}.`);
3757
3757
  } else {
3758
3758
  warn(
3759
3759
  `
3760
- Your arbi version is out of date (${"0.3.64"} \u2192 ${latest}).
3760
+ Your arbi version is out of date (${"0.3.66"} \u2192 ${latest}).
3761
3761
  Run "arbi update" to upgrade, or "arbi update auto" to always stay up to date.`
3762
3762
  );
3763
3763
  }
@@ -3789,10 +3789,10 @@ function markNagShown(latest) {
3789
3789
  function hintUpdateOnError() {
3790
3790
  try {
3791
3791
  const cached = readCache();
3792
- if (!cached || cached.latest === "0.3.64") return;
3792
+ if (!cached || cached.latest === "0.3.66") return;
3793
3793
  if (!shouldShowNag(cached.latest)) return;
3794
3794
  warn(
3795
- `Your arbi version is out of date (${"0.3.64"} \u2192 ${cached.latest}). Run "arbi update".`
3795
+ `Your arbi version is out of date (${"0.3.66"} \u2192 ${cached.latest}). Run "arbi update".`
3796
3796
  );
3797
3797
  markNagShown(cached.latest);
3798
3798
  } catch {
@@ -4353,8 +4353,8 @@ Open this URL in your browser:
4353
4353
  })();
4354
4354
  if (!opts.json) success(`Logged in as ${email}`);
4355
4355
  clearChatSession();
4356
- const { data: workspaces3 } = await arbi.fetch.GET("/v1/user/workspaces");
4357
- const wsList = workspaces3 || [];
4356
+ const { data: workspaces4 } = await arbi.fetch.GET("/v1/user/workspaces");
4357
+ const wsList = workspaces4 || [];
4358
4358
  updateCompletionCache(wsList);
4359
4359
  const memberWorkspaces = wsList.filter(
4360
4360
  (ws) => ws.users?.some((u) => u.user.email === email)
@@ -4688,8 +4688,8 @@ async function loginAfterRegister(config, email, password2, { json = false } = {
4688
4688
  try {
4689
4689
  const { arbi, loginResult } = await sdk.performPasswordLogin(config, email, password2, store);
4690
4690
  if (!json) success(`Logged in as ${email}`);
4691
- const { data: workspaces3 } = await arbi.fetch.GET("/v1/user/workspaces");
4692
- const wsList = workspaces3 || [];
4691
+ const { data: workspaces4 } = await arbi.fetch.GET("/v1/user/workspaces");
4692
+ const wsList = workspaces4 || [];
4693
4693
  updateCompletionCache(wsList);
4694
4694
  const memberWorkspaces = wsList.filter((ws) => ws.users?.some((u) => u.user.email === email));
4695
4695
  let selectedWorkspace;
@@ -4842,8 +4842,12 @@ function registerWorkspacesCommand(program2) {
4842
4842
  }
4843
4843
  if (opts.json) {
4844
4844
  const selectedId2 = getConfig()?.selectedWorkspaceId ?? null;
4845
+ const myEmail = store.requireCredentials().email;
4845
4846
  const out = data.map((w) => {
4846
- const role = w.users?.[0]?.role ?? null;
4847
+ const myRow = w.users?.find(
4848
+ (u) => u?.user?.email === myEmail
4849
+ );
4850
+ const role = myRow?.role ?? null;
4847
4851
  return {
4848
4852
  id: w.external_id,
4849
4853
  name: w.name,
@@ -4884,10 +4888,16 @@ function registerWorkspacesCommand(program2) {
4884
4888
  {
4885
4889
  header: "ROLE",
4886
4890
  width: 12,
4887
- // `common` (italics dimmed) for memberless rows the caller can
4888
- // see only because it's a deployment-wide workspace. The blank
4889
- // ROLE that used to render here read like missing data.
4890
- value: (r) => r.users?.[0]?.role ?? "common"
4891
+ // `common` (italics dimmed) for memberless rows the caller
4892
+ // can see only because it's a deployment-wide workspace.
4893
+ // Match by the caller's email so we render *our* role, not
4894
+ // whichever membership happens to come first in the array.
4895
+ value: (r) => {
4896
+ const myRow = r.users?.find(
4897
+ (u) => u?.user?.email === store.requireCredentials().email
4898
+ );
4899
+ return myRow?.role ?? "common";
4900
+ }
4891
4901
  }
4892
4902
  ],
4893
4903
  data
@@ -5359,7 +5369,13 @@ function registerDocsCommand(program2) {
5359
5369
  "Write output to a file instead of stdout. Extension determines the format when combined with --ids/--json/--csv (default: csv with doc_id, file_name, folder, status)"
5360
5370
  ).action(
5361
5371
  (opts) => runAction(async () => {
5362
- const { arbi } = await resolveWorkspace(opts.workspace);
5372
+ const { arbi, workspaceId } = await resolveWorkspace(opts.workspace);
5373
+ let workspaceName = null;
5374
+ try {
5375
+ const list = await sdk.workspaces.listWorkspaces(arbi);
5376
+ workspaceName = list.find((w) => w.external_id === workspaceId)?.name ?? null;
5377
+ } catch {
5378
+ }
5363
5379
  const fields = opts.lite ? "lite" : void 0;
5364
5380
  const hardLimit = opts.limit ? parseInt(opts.limit, 10) : void 0;
5365
5381
  const needsSort = !!(opts.sort && opts.sort !== "status");
@@ -5416,15 +5432,27 @@ function registerDocsCommand(program2) {
5416
5432
  }
5417
5433
  if (totalFetched === 0 && data.length === 0) {
5418
5434
  if (opts.json) {
5419
- if (opts.output) fs5.writeFileSync(opts.output, "[]\n");
5420
- else console.log("[]");
5435
+ const emptyPayload = JSON.stringify(
5436
+ {
5437
+ workspace: { external_id: workspaceId, name: workspaceName },
5438
+ documents: []
5439
+ },
5440
+ null,
5441
+ opts.output ? 2 : 0
5442
+ );
5443
+ if (opts.output) fs5.writeFileSync(opts.output, emptyPayload + "\n");
5444
+ else console.log(emptyPayload);
5421
5445
  } else if (opts.ids) {
5422
5446
  if (opts.output) fs5.writeFileSync(opts.output, "");
5423
5447
  } else if (opts.csv) {
5424
5448
  if (opts.output) fs5.writeFileSync(opts.output, csvHeader + "\n");
5425
5449
  } else if (opts.count) {
5450
+ const wsLabel2 = workspaceName ? `${workspaceName} (${workspaceId})` : workspaceId;
5451
+ console.log(chalk2__default.default.dim(`Workspace: ${wsLabel2}`));
5426
5452
  console.log("0");
5427
5453
  } else {
5454
+ const wsLabel2 = workspaceName ? `${workspaceName} (${workspaceId})` : workspaceId;
5455
+ console.log(chalk2__default.default.dim(`Workspace: ${wsLabel2}`));
5428
5456
  console.log("No documents found.");
5429
5457
  }
5430
5458
  return;
@@ -5466,6 +5494,8 @@ function registerDocsCommand(program2) {
5466
5494
  }).length;
5467
5495
  const totalPages = data.reduce((sum, d) => sum + (d.n_pages ?? 0), 0);
5468
5496
  const totalTokens = data.reduce((sum, d) => sum + (d.tokens ?? 0), 0);
5497
+ const wsLabel2 = workspaceName ? `${workspaceName} (${workspaceId})` : workspaceId;
5498
+ console.log(chalk2__default.default.dim(`Workspace: ${wsLabel2}`));
5469
5499
  console.log(chalk2__default.default.bold(`Total: ${data.length} documents`));
5470
5500
  for (const [status2, count] of Object.entries(counts).sort()) {
5471
5501
  const colorFn = statusColor(status2);
@@ -5491,7 +5521,11 @@ function registerDocsCommand(program2) {
5491
5521
  return;
5492
5522
  }
5493
5523
  if (opts.json) {
5494
- writeOut(JSON.stringify(data, null, opts.output ? 2 : 0), "json");
5524
+ const payload = {
5525
+ workspace: { external_id: workspaceId, name: workspaceName },
5526
+ documents: data
5527
+ };
5528
+ writeOut(JSON.stringify(payload, null, opts.output ? 2 : 0), "json");
5495
5529
  return;
5496
5530
  }
5497
5531
  if (opts.csv || opts.output && !opts.ids && !opts.json) {
@@ -5502,6 +5536,8 @@ function registerDocsCommand(program2) {
5502
5536
  writeOut(lines.join("\n"), "csv");
5503
5537
  return;
5504
5538
  }
5539
+ const wsLabel = workspaceName ? `${workspaceName} (${workspaceId})` : workspaceId;
5540
+ console.log(chalk2__default.default.dim(`Workspace: ${wsLabel}`));
5505
5541
  console.log(chalk2__default.default.dim(`${data.length} documents
5506
5542
  `));
5507
5543
  printTable(
@@ -7884,7 +7920,7 @@ function registerDmCommand(program2) {
7884
7920
  (opts) => runAction(async () => {
7885
7921
  const { arbi, crypto: crypto2 } = await resolveDmCrypto();
7886
7922
  const all = await sdk.dm.listDecryptedDMs(arbi, crypto2);
7887
- const myExtId = arbi.session.getState().userExtId;
7923
+ const myExtId = arbi.session.getState().userExtId ?? void 0;
7888
7924
  const dms = all.filter((r) => r.type === "user_message");
7889
7925
  const filterOpts = {
7890
7926
  unread: Boolean(opts.unread),
@@ -8947,8 +8983,8 @@ async function runQuickstart(url) {
8947
8983
  try {
8948
8984
  const { arbi, loginResult } = await sdk.performPasswordLogin(config, email, password2, store);
8949
8985
  success(`Logged in as ${email}`);
8950
- const { data: workspaces3 } = await arbi.fetch.GET("/v1/user/workspaces");
8951
- const wsList = workspaces3 || [];
8986
+ const { data: workspaces4 } = await arbi.fetch.GET("/v1/user/workspaces");
8987
+ const wsList = workspaces4 || [];
8952
8988
  const memberWorkspaces = wsList.filter((ws) => ws.users?.some((u) => u.user.email === email));
8953
8989
  const userProjects = await sdk.projects.listProjects(arbi);
8954
8990
  const defaultProjectExtId = userProjects[0]?.external_id;
@@ -9839,7 +9875,7 @@ function registerFilesCommand(program2) {
9839
9875
  );
9840
9876
  files.command("upload <path>").description("Upload a file (file ID is returned for use with arbi ask -b --attach)").option("--purpose <name>", "OpenAI purpose tag (default: assistants)", "assistants").action(
9841
9877
  (path7, opts) => runAction(async () => {
9842
- const { arbi, loginResult } = await resolveWorkspace();
9878
+ const { loginResult, config } = await resolveWorkspace();
9843
9879
  const filePath = path5.resolve(path7);
9844
9880
  let bytes;
9845
9881
  try {
@@ -9851,7 +9887,7 @@ function registerFilesCommand(program2) {
9851
9887
  const blob = new Blob([new Uint8Array(bytes)]);
9852
9888
  const data = await sdk.files.uploadFile(
9853
9889
  {
9854
- baseUrl: arbi.fetch.baseUrl,
9890
+ baseUrl: config.baseUrl,
9855
9891
  accessToken: loginResult.accessToken
9856
9892
  },
9857
9893
  blob,
@@ -9881,10 +9917,10 @@ function registerFilesCommand(program2) {
9881
9917
  );
9882
9918
  files.command("content <id>").description("Fetch a file's raw bytes (writes to disk or stdout)").option("-o, --output <path>", 'Output file path (use "-" for stdout)').action(
9883
9919
  (id, opts) => runAction(async () => {
9884
- const { arbi, loginResult } = await resolveWorkspace();
9920
+ const { loginResult, config } = await resolveWorkspace();
9885
9921
  const res = await sdk.files.getFileContent(
9886
9922
  {
9887
- baseUrl: arbi.fetch.baseUrl,
9923
+ baseUrl: config.baseUrl,
9888
9924
  accessToken: loginResult.accessToken
9889
9925
  },
9890
9926
  id
@@ -9940,7 +9976,6 @@ function registerUsageCommand(program2) {
9940
9976
  await usage.commands.find((c) => c.name() === "today").parseAsync(tail, { from: "user" });
9941
9977
  });
9942
9978
  }
9943
- init_prompts();
9944
9979
  function registerAuthCommand(program2) {
9945
9980
  const auth = program2.command("auth").description("Self-service account ops: profile, change-email, delete-account, sso-config");
9946
9981
  auth.command("profile").description("Show or update your display profile (given/family name, picture)").option("--name <given>", "New given name").option("--family <family>", "New family name (empty string clears it)").option(
@@ -10015,38 +10050,6 @@ function registerAuthCommand(program2) {
10015
10050
  success(`Email changed to ${opts.newEmail}.`);
10016
10051
  })()
10017
10052
  );
10018
- auth.command("delete-account").description("Request account deletion (30-day grace window \u2014 use cancel-deletion to undo)").option("-y, --yes", "Skip confirmation (required in non-TTY shells)").option("--dry-run", "Preview the deletion request (no SDK call)").action(
10019
- (opts) => runAction(async () => {
10020
- const { arbi } = await resolveAuth();
10021
- if (opts.dryRun) {
10022
- const email = arbi.session.getState().userExtId ?? "(unknown)";
10023
- dryRun("request account deletion (30-day grace)", email);
10024
- return;
10025
- }
10026
- if (!opts.yes) {
10027
- requireInteractive("Pass -y/--yes to confirm in non-TTY shells.");
10028
- const confirmed = await promptConfirm(
10029
- "Request deletion of this account (30-day grace)?",
10030
- false
10031
- );
10032
- if (!confirmed) {
10033
- console.log("Cancelled.");
10034
- return;
10035
- }
10036
- }
10037
- const res = await arbi.fetch.POST("/v1/user/request-deletion", { body: {} });
10038
- if (res.error) throw new Error(`request-deletion failed: ${JSON.stringify(res.error)}`);
10039
- success("Deletion requested. You have 30 days to cancel with: arbi auth cancel-deletion");
10040
- })()
10041
- );
10042
- auth.command("cancel-deletion").description("Cancel an in-flight account deletion request").action(
10043
- () => runAction(async () => {
10044
- const { arbi } = await resolveAuth();
10045
- const res = await arbi.fetch.POST("/v1/user/cancel-deletion", { body: {} });
10046
- if (res.error) throw new Error(`cancel-deletion failed: ${JSON.stringify(res.error)}`);
10047
- success("Deletion cancelled. Account is active.");
10048
- })()
10049
- );
10050
10053
  auth.command("sso-config").description("Show SSO config for this deployment (sso_enabled, Auth0 domain, audience)").option("--json", "Output as JSON").action(
10051
10054
  (opts) => runAction(async () => {
10052
10055
  const { arbi } = await resolveAuth();
@@ -10083,7 +10086,7 @@ console.info = (...args) => {
10083
10086
  _origInfo(...args);
10084
10087
  };
10085
10088
  var program = new commander.Command();
10086
- program.name("arbi").description("ARBI CLI \u2014 interact with ARBI from the terminal").version("0.3.64").showHelpAfterError(true).showSuggestionAfterError(true);
10089
+ program.name("arbi").description("ARBI CLI \u2014 interact with ARBI from the terminal").version("0.3.66").showHelpAfterError(true).showSuggestionAfterError(true);
10087
10090
  registerConfigCommand(program);
10088
10091
  registerLoginCommand(program);
10089
10092
  registerRegisterCommand(program);