@lazehq/cli 0.1.100 → 0.1.102

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/laze.mjs +143 -37
  2. package/package.json +1 -1
package/dist/laze.mjs CHANGED
@@ -36960,7 +36960,7 @@ function shadowedLinkLineOf({ shadow }) {
36960
36960
  }
36961
36961
 
36962
36962
  // src/rules/cli-version.rules.ts
36963
- var STAMPED = "0.1.100";
36963
+ var STAMPED = "0.1.102";
36964
36964
  function cliVersionOf({ stamped = STAMPED } = {}) {
36965
36965
  return stamped.startsWith("__") ? "dev" : stamped;
36966
36966
  }
@@ -66756,6 +66756,15 @@ var agentRuntimeConfig = Config.define((c) => ({
66756
66756
  "AGENT_RUNTIME_COMPUTER_HOST_PROBE_SECONDS",
66757
66757
  positive.default(60)
66758
66758
  ),
66759
+ /**
66760
+ * Test stacks only: the loopback `host:port` of a test computer daemon, which every computer
66761
+ * then is (ADR 20261106-test-computer). A production process refuses to boot with it set.
66762
+ */
66763
+ testComputerDaemon: c.env(
66764
+ "AGENT_RUNTIME_TEST_COMPUTER_DAEMON",
66765
+ external_exports.string().regex(/^127\.0\.0\.1:\d{1,5}$/).optional()
66766
+ ),
66767
+ nodeEnvironment,
66759
66768
  /** How long a wake waits for its computer's move before it fails with computer_moving. */
66760
66769
  computerMoveWaitSeconds: c.env("AGENT_RUNTIME_COMPUTER_MOVE_WAIT_SECONDS", positive.default(600))
66761
66770
  }));
@@ -77266,6 +77275,10 @@ without a recap; the person's DM already shows your messages elsewhere.
77266
77275
  - \`laze history <channel>\` and \`laze thread <id>\` read a conversation.
77267
77276
  - \`laze search "words"\` searches messages.
77268
77277
  - \`laze channels list\` lists the conversations you are in.
77278
+ - \`laze conversation new <agent> "text"\` starts a conversation (yours starts it for your
77279
+ person), \`laze conversation add <id> <member>\` adds people already in the workspace to it,
77280
+ and \`laze channel add <channel> <member>\` does the same for a channel. \`laze invite\` is only
77281
+ for people new to the workspace.
77269
77282
  - \`laze agent update --self --name "<name>"\` renames you; \`--description <text>\` and
77270
77283
  \`--avatar <file>\` change your description and face.
77271
77284
  - \`laze channel info <channel>\` shows its members and the apps pinned there. Read a pinned app
@@ -85690,7 +85703,8 @@ import { randomBytes as randomBytes4 } from "node:crypto";
85690
85703
 
85691
85704
  // src/rules/channel-format.rules.ts
85692
85705
  function channelLabelOf(detail) {
85693
- return detail.kind === "public" || detail.kind === "private" ? `#${detail.name}` : "(direct)";
85706
+ if (detail.kind === "public" || detail.kind === "private") return `#${detail.name}`;
85707
+ return detail.kind === "chat" ? "the conversation" : "(direct)";
85694
85708
  }
85695
85709
  var ROLE = { admin: "Admin", member: "Member" };
85696
85710
  function dndColumn(member) {
@@ -86126,19 +86140,23 @@ async function channelUnarchive({ context, args }) {
86126
86140
  `
86127
86141
  });
86128
86142
  }
86129
- async function channelAdd({ context, args }) {
86130
- const [, , channel, ...members3] = args.words;
86131
- if (!channel || members3.length === 0) {
86132
- throw new CliUsageError("Usage: laze channel add <channel> <member> [<member>...]");
86133
- }
86134
- return changeChannel({
86135
- context,
86136
- args,
86137
- path: "/api/agents/me/channels/add",
86138
- body: { channel, members: members3 },
86139
- line: (detail) => membersChangedLine({ detail, members: members3, change: "added" })
86140
- });
86143
+ function addMembers(usage) {
86144
+ return async ({ context, args }) => {
86145
+ const [, , channel, ...members3] = args.words;
86146
+ if (!channel || members3.length === 0) throw new CliUsageError(usage);
86147
+ return changeChannel({
86148
+ context,
86149
+ args,
86150
+ path: "/api/agents/me/channels/add",
86151
+ body: { channel, members: members3 },
86152
+ line: (detail) => membersChangedLine({ detail, members: members3, change: "added" })
86153
+ });
86154
+ };
86141
86155
  }
86156
+ var channelAdd = addMembers("Usage: laze channel add <channel> <member> [<member>...]");
86157
+ var conversationAdd = addMembers(
86158
+ "Usage: laze conversation add <conversation> <member> [<member>...] people already in the workspace, by email, name or id"
86159
+ );
86142
86160
  async function channelGroups({ context, args }) {
86143
86161
  const [, , channel] = args.words;
86144
86162
  if (!channel) throw new CliUsageError("Usage: laze channel groups <channel>");
@@ -86295,6 +86313,30 @@ async function channelSettings({ context, args }) {
86295
86313
  import { readFile as readFile19 } from "node:fs/promises";
86296
86314
  import { basename as basename8, isAbsolute as isAbsolute2, relative as relative4, resolve as resolve11 } from "node:path";
86297
86315
 
86316
+ // src/rules/app-link.rules.ts
86317
+ var MARKDOWN_LINK = /^\[[^\]]*\]\((\S+)\)$/;
86318
+ var APP_PAGE = /^\/workspaces\/[^/]+\/apps\/([^/?#]+)\/?$/;
86319
+ function onlyUrlOf(body) {
86320
+ const text3 = body.trim().replace(/^<(.+)>$/, "$1");
86321
+ const linked = MARKDOWN_LINK.exec(text3)?.[1] ?? text3;
86322
+ return /^https?:\/\/\S+$/.test(linked) ? linked : null;
86323
+ }
86324
+ function appOfLinkOnly(body) {
86325
+ const url2 = onlyUrlOf(body);
86326
+ if (!url2) return null;
86327
+ let parsed;
86328
+ try {
86329
+ parsed = new URL(url2);
86330
+ } catch {
86331
+ return null;
86332
+ }
86333
+ const page = APP_PAGE.exec(parsed.pathname)?.[1];
86334
+ if (page) return decodeURIComponent(page);
86335
+ const [label3 = ""] = parsed.hostname.split(".");
86336
+ const [app2, workspace2] = label3.split("--");
86337
+ return app2 && workspace2 ? app2 : null;
86338
+ }
86339
+
86298
86340
  // src/services/file-download.service.ts
86299
86341
  import { createWriteStream } from "node:fs";
86300
86342
  import { mkdir as mkdir8, rename as rename3, rm as rm13, stat as stat10, truncate } from "node:fs/promises";
@@ -86478,7 +86520,9 @@ var CHAT_ACTIONS_USAGE = `Usage:
86478
86520
  laze message delete <messageId> delete your own message
86479
86521
  laze message remove <messageId> remove anyone's message (admins)
86480
86522
  laze message react <messageId> <emoji> add a reaction, or take yours back
86481
- laze message pin <messageId> [--off] pin it in its conversation, or unpin it
86523
+ laze message pin <messageId> [--off] pin it in its conversation, or unpin it; a message
86524
+ that is only an app link says to run laze app pin
86525
+ [--message] pin that message anyway
86482
86526
  laze message restore <messageId> put a scrubbed secret back in your message (people)
86483
86527
  laze pins <channel> a conversation's pinned messages
86484
86528
  laze channel read <channel> [--seq <n>] mark it read, up to a message or to the newest
@@ -86626,6 +86670,9 @@ var MESSAGE_VERBS = {
86626
86670
  },
86627
86671
  pin: async ({ context, args, client }) => {
86628
86672
  const pinned = !args.flags.off;
86673
+ if (pinned && !args.flags.message) {
86674
+ await refuseAppLinkPin({ client, messageId: wordAt(args, 2) });
86675
+ }
86629
86676
  const answer6 = await client.post(CHAT_KEY_PATHS.pin, {
86630
86677
  messageId: wordAt(args, 2),
86631
86678
  pinned
@@ -86641,6 +86688,21 @@ var MESSAGE_VERBS = {
86641
86688
  ` });
86642
86689
  }
86643
86690
  };
86691
+ async function refuseAppLinkPin({
86692
+ client,
86693
+ messageId
86694
+ }) {
86695
+ const thread2 = await client.post(CHAT_KEY_PATHS.thread, { messageId }).catch(() => null);
86696
+ const found = thread2 && [thread2.root, ...thread2.replies].find((one) => one.id === messageId);
86697
+ const wanted = found ? appOfLinkOnly(found.body) : null;
86698
+ if (!found || !wanted) return;
86699
+ const app2 = await client.post("/api/apps/find", { app: wanted }).catch(() => null);
86700
+ if (!app2) return;
86701
+ throw new CliUsageError(
86702
+ `${messageId} is only a link to the app ${app2.name}, so it was not pinned. To put the app in the conversation as a tab, run: laze app pin ${app2.slug} --channel ${found.channelId}
86703
+ To pin the message itself, run: laze message pin ${messageId} --message`
86704
+ );
86705
+ }
86644
86706
  var message = (input2) => {
86645
86707
  const verb = input2.args.words[1] ?? "";
86646
86708
  const run4 = Object.hasOwn(MESSAGE_VERBS, verb) ? MESSAGE_VERBS[verb] : void 0;
@@ -90795,8 +90857,11 @@ function stateOf2(chat) {
90795
90857
 
90796
90858
  // src/services/conversation-commands.service.ts
90797
90859
  var CONVERSATION_USAGE = `Usage:
90798
- laze conversation new <agent> <text|-> start a conversation with an agent (people)
90799
- [--about <message id>] continue from a message: the first one quotes it
90860
+ laze conversation new <agent> <text|-> start a conversation with an agent; an agent's key
90861
+ [--about <message id>] starts it for its person. --about continues from a
90862
+ message: the first one quotes it
90863
+ laze conversation add <id> <member>... add people already in the workspace (by email, name
90864
+ or id); laze invite is only for people new to it
90800
90865
  laze conversation list [--agent <agent>] yours (an agent: its own; --unnamed for untitled)
90801
90866
  [--closed] only the closed ones, which the list leaves out
90802
90867
  laze conversation rename <id> <title> name it (its agent, or a person in it)
@@ -94894,7 +94959,9 @@ function inviteQuoteText(quote4) {
94894
94959
  }
94895
94960
 
94896
94961
  // src/services/invite-commands.service.ts
94897
- var INVITE_USAGE = "Usage: laze invite [--to <conversation>] [--role member|guest|admin|owner] [--yes] <email>...";
94962
+ var INVITE_USAGE = `Usage: laze invite [--to <conversation>] [--role member|guest|admin|owner] [--yes] <email>...
94963
+ invites people who are not in the workspace yet. Someone already in it needs no invite:
94964
+ laze conversation add <conversation> <member>... or laze channel add <channel> <member>...`;
94898
94965
  var ROLES3 = {
94899
94966
  owner: "OWNER",
94900
94967
  admin: "ADMIN",
@@ -94919,14 +94986,58 @@ function personLines(sent) {
94919
94986
  return sent.invites.flatMap((one) => one.personId ? [`${one.email} is person ${one.personId}.
94920
94987
  `] : []).join("");
94921
94988
  }
94922
- function refusedLines(refused) {
94923
- const why = { invalid: "not an email address", duplicate: "listed twice", member: "already in" };
94924
- return refused.map((one) => `Left out ${one.email}: ${why[one.reason]}.
94925
- `).join("");
94989
+ function addCommandOf({ to, email: email3 }) {
94990
+ return to ? `laze conversation add ${to} ${email3}` : `laze conversation add <conversation> ${email3} (or laze channel add <channel> ${email3})`;
94991
+ }
94992
+ function alreadyInLine({ to, email: email3 }) {
94993
+ return `${email3} is already in the workspace, so there is nothing to invite or pay for. To add them, run: ${addCommandOf({ to, email: email3 })}
94994
+ `;
94995
+ }
94996
+ function refusedLines({
94997
+ refused,
94998
+ to
94999
+ }) {
95000
+ const why = { invalid: "not an email address", duplicate: "listed twice" };
95001
+ return refused.map(
95002
+ (one) => one.reason === "member" ? alreadyInLine({ to, email: one.email }) : `Left out ${one.email}: ${why[one.reason]}.
95003
+ `
95004
+ ).join("");
95005
+ }
95006
+ async function memberEmailsOf(client) {
95007
+ try {
95008
+ const members3 = await client.get("/api/workspaces/current/members");
95009
+ return new Set(members3.map((member) => member.email.toLowerCase()));
95010
+ } catch (error63) {
95011
+ if (error63 instanceof LazeApiError) return /* @__PURE__ */ new Set();
95012
+ throw error63;
95013
+ }
95014
+ }
95015
+ async function askAdmins({
95016
+ context,
95017
+ client,
95018
+ input: input2
95019
+ }) {
95020
+ const requested = await client.post(
95021
+ "/api/agents/me/workspace/request-invites",
95022
+ input2
95023
+ );
95024
+ context.out(refusedLines({ refused: requested.refused, to: input2.to }));
95025
+ if (requested.requests.length === 0) return;
95026
+ const approvers = requested.approvers.length > 0 ? requested.approvers.join(" or ") : "an admin";
95027
+ context.out(
95028
+ `Sent ${requested.requests.length} to ${approvers} for approval. The invitations go out once approved.
95029
+ `
95030
+ );
94926
95031
  }
94927
95032
  async function invite3({ context, args }) {
94928
- const input2 = inviteInput(args);
95033
+ const asked = inviteInput(args);
94929
95034
  const { client } = await signedIn({ context, args });
95035
+ const members3 = await memberEmailsOf(client);
95036
+ const already = asked.emails.filter((email3) => members3.has(email3.toLowerCase()));
95037
+ for (const email3 of already) context.out(alreadyInLine({ to: asked.to, email: email3 }));
95038
+ const emails = asked.emails.filter((email3) => !members3.has(email3.toLowerCase()));
95039
+ if (emails.length === 0) return;
95040
+ const input2 = { ...asked, emails };
94930
95041
  const quote4 = await client.post("/api/billing-account/invite-quote", {
94931
95042
  adding: input2.emails.length
94932
95043
  });
@@ -94940,18 +95051,9 @@ async function invite3({ context, args }) {
94940
95051
  sent = await client.post("/api/agents/me/workspace/invite-many", input2);
94941
95052
  } catch (error63) {
94942
95053
  if (!(error63 instanceof LazeApiError) || error63.status !== 403) throw error63;
94943
- const asked = await client.post(
94944
- "/api/agents/me/workspace/request-invites",
94945
- input2
94946
- );
94947
- const approvers = asked.approvers.length > 0 ? asked.approvers.join(" or ") : "an admin";
94948
- context.out(
94949
- `${refusedLines(asked.refused)}Sent ${asked.requests.length} to ${approvers} for approval. The invitations go out once approved.
94950
- `
94951
- );
94952
- return;
95054
+ return askAdmins({ context, client, input: input2 });
94953
95055
  }
94954
- context.out(refusedLines(sent.refused));
95056
+ context.out(refusedLines({ refused: sent.refused, to: input2.to }));
94955
95057
  context.out(personLines(sent));
94956
95058
  if (!quote4.upgradeNeeded) {
94957
95059
  context.out(`Invited ${sent.invites.length}.${sent.held ? " Some wait for seats." : ""}
@@ -101721,7 +101823,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
101721
101823
  laze workspace leave leave this workspace
101722
101824
  laze workspace delete --confirm <name> | cancel-deletion schedule its deletion, or take it back (Owners)
101723
101825
  laze members the workspace's people, each with their role
101724
- laze invite [--to <conversation>] [--yes] <email>... invite people to a chat; shows the price first
101826
+ laze invite [--to <conversation>] [--yes] <email>... invite people new to the workspace; shows the price first
101725
101827
  laze members invite <email> [--role owner|admin|member|guest] invite someone (admins)
101726
101828
  laze members invites | revoke-invite <email|id> invitations waiting, or take one back (admins)
101727
101829
  laze members invite-link <email|id> a fresh link for an invitation, shown once (admins)
@@ -101750,7 +101852,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
101750
101852
  laze channel update <channel> [--name <n>] [--topic <t>] [--description <d>] [--private] [--mentioned-only on|off] rename, set its topic or Mentioned only (people)
101751
101853
  laze channel default <channel> <agent>|--clear the agent that answers unnamed messages (channel admins)
101752
101854
  laze channel archive|unarchive <channel> freeze a channel or bring it back (channel admins)
101753
- laze channel add <channel> <member>... add people or agents to a channel (people)
101855
+ laze channel add <channel> <member>... add workspace members or agents to a channel
101754
101856
  laze channel add-group <channel> <group> add a group; its people follow it in and out (people)
101755
101857
  laze channel remove-group <channel> <group> take a group out, with the people it brought (people)
101756
101858
  laze channel groups <channel> list the groups in a channel
@@ -101763,7 +101865,8 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
101763
101865
  laze emoji list | add <name> <file> [--alias <a,b>] | alias <alias> <name> | remove <name> the workspace's custom emoji
101764
101866
  laze status set <emoji> [text] [--for 30m|1h|4h|today|week|never] your status next to your name (people)
101765
101867
  laze status clear | away | active clear it, or set yourself away by hand until active
101766
- laze conversation new <agent> <text|-> [--about <message id>] start a conversation with an agent; it names it
101868
+ laze conversation new <agent> <text|-> [--about <message id>] start a conversation with an agent; it names it (an agent's key starts it for its person)
101869
+ laze conversation add <id> <member>... add people already in the workspace to a conversation (a person in it, or its agent while its person is in it)
101767
101870
  laze conversation list [--agent <agent>] [--unnamed] your conversations with agents
101768
101871
  laze conversation rename <id> <title> name a conversation (its agent, or a person in it)
101769
101872
  laze conversation join|close <id> open one of an agent shared with you, or leave it
@@ -101795,6 +101898,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
101795
101898
  laze thread <id> --wait-reply [--timeout <s>] wait until a person replies in the thread
101796
101899
  laze threads [unread] the threads you follow (people)
101797
101900
  laze message edit|delete|remove|react|pin|restore <id> change a message; laze pins <channel>
101901
+ message pin pins a message; an app goes in as a tab with laze app pin <app> --channel <c>
101798
101902
  laze channel read|unread <channel> [--seq <n>] move your read marker
101799
101903
  laze files <channel> | file link|download|rename|upload a conversation's files, and uploading one
101800
101904
  laze saved [marks|done|remind] | laze save <id> your saved messages (people)
@@ -101818,6 +101922,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
101818
101922
  laze app create <name> ... build an app from scratch (--template slides for a deck), push, revert
101819
101923
  apps are also called artifacts: asked for an artifact, page, dashboard, deck or mock, build a Laze app
101820
101924
  laze app open|screenshot [file] look at your app in a browser tab, signed in as you, view only
101925
+ laze app pin <app> --channel <c> put an app in a conversation as a tab (not laze message pin)
101821
101926
  laze app every laze app command, with its flags
101822
101927
  laze agents list | laze agents status <name> the workspace's agents and their context
101823
101928
  laze agents show <name> [--json] an agent's profile: kind, how it runs, intelligence
@@ -102014,6 +102119,7 @@ var COMMANDS4 = {
102014
102119
  dnd,
102015
102120
  emoji: emoji3,
102016
102121
  "conversation new": conversationNew,
102122
+ "conversation add": conversationAdd,
102017
102123
  "conversation list": conversationList,
102018
102124
  "conversation rename": conversationRename,
102019
102125
  "conversation join": conversationJoin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazehq/cli",
3
- "version": "0.1.100",
3
+ "version": "0.1.102",
4
4
  "description": "The Laze command line: sign in, read and post in chat, and connect your own Claude Code or Codex session as an agent.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",