@tobos/cli 0.4.51 → 0.4.53

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/cli.js +10 -5
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -278,7 +278,7 @@ function settings() {
278
278
  }
279
279
 
280
280
  // src/api.ts
281
- var VERSION = true ? "0.4.51" : "dev";
281
+ var VERSION = true ? "0.4.53" : "dev";
282
282
  function newer(a, b) {
283
283
  const parse = (v) => /^\d+\.\d+\.\d+/.test(v) ? v.split(".").map((n) => parseInt(n)) : null;
284
284
  const x = parse(a);
@@ -858,7 +858,9 @@ var LOGIN_WAIT_MS = 9e4;
858
858
  async function login(out, args) {
859
859
  const server = (args.values.server || settings().server).replace(/\/$/, "");
860
860
  const kept = settings().device;
861
+ const ref = typeof args.values.ref === "string" && args.values.ref ? args.values.ref : void 0;
861
862
  let device = kept && kept.server === server && Date.parse(kept.expires) > Date.now() ? kept : void 0;
863
+ if (device && ref && device.ref !== ref) save({ device: device = { ...device, ref } });
862
864
  let opened = false;
863
865
  if (!device) {
864
866
  const started = await api("/oauth/device", {
@@ -872,7 +874,8 @@ async function login(out, args) {
872
874
  userCode: started.user_code,
873
875
  url: started.verification_uri_complete,
874
876
  interval: started.interval,
875
- expires: new Date(Date.now() + started.expires_in * 1e3).toISOString()
877
+ expires: new Date(Date.now() + started.expires_in * 1e3).toISOString(),
878
+ ...ref ? { ref } : {}
876
879
  };
877
880
  save({ server, device });
878
881
  opened = await openUrl(device.url);
@@ -919,7 +922,8 @@ async function waitForApproval(device, note) {
919
922
  server: device.server,
920
923
  body: {
921
924
  grant_type: "urn:ietf:params:oauth:grant-type:device_code",
922
- device_code: device.deviceCode
925
+ device_code: device.deviceCode,
926
+ ...device.ref ? { ref: device.ref } : {}
923
927
  }
924
928
  });
925
929
  const answer = await response.json().catch(() => ({}));
@@ -1461,6 +1465,7 @@ var shown = (m) => [
1461
1465
  `Date: ${m.date}`,
1462
1466
  `Id: ${m.id} in ${m.inbox}`,
1463
1467
  ...(m.attachments ?? []).map((a) => `Attachment: ${a.name} (${a.type}, ${a.size} bytes)`),
1468
+ m.incomplete && `Incomplete: ${m.incomplete}`,
1464
1469
  "",
1465
1470
  m.withheld ?? m.text ?? ""
1466
1471
  ].filter((l) => l !== void 0 && l !== false).join("\n");
@@ -1610,7 +1615,7 @@ var VERB_ROWS = Object.values(VERBS).flatMap((verb) => verb.cli.map((c) => row(c
1610
1615
  var HELP = `tobos ${VERSION}: the command line of Tobos, the office suite your coding agent works in.
1611
1616
 
1612
1617
  Account
1613
- ${row("tobos login [--server URL]", "connect this machine: prints an address for the person to open and approve (logging in, or signing up, there); run it again once they did")}
1618
+ ${row("tobos login [--server URL] [--ref ID]", "connect this machine: prints an address for the person to open and approve (logging in, or signing up, there); run it again once they did; --ref: the one in the tobos.ai/start address they gave you")}
1614
1619
  ${row("tobos logout", "forget this machine's token")}
1615
1620
  ${row("tobos whoami", "who you are, on which server")}
1616
1621
 
@@ -1672,7 +1677,7 @@ var COMMON = {
1672
1677
  var TABLE = {
1673
1678
  login: {
1674
1679
  run: login,
1675
- options: { server: { type: "string" } }
1680
+ options: { server: { type: "string" }, ref: { type: "string" } }
1676
1681
  },
1677
1682
  logout: { run: logout },
1678
1683
  whoami: { run: whoami },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tobos/cli",
3
- "version": "0.4.51",
3
+ "version": "0.4.53",
4
4
  "description": "The command line of Tobos: https://tobos.ai",
5
5
  "type": "module",
6
6
  "license": "FSL-1.1-ALv2",