@lazehq/cli 0.1.135 → 0.1.136

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 +61 -33
  2. package/package.json +1 -1
package/dist/laze.mjs CHANGED
@@ -31893,6 +31893,15 @@ function isKeyMaterial(value) {
31893
31893
  const c = charClasses(value);
31894
31894
  return c.digit >= 2 && (c.lower >= 2 || c.upper >= 2);
31895
31895
  }
31896
+ var VARIABLE_NAME = "[A-Za-z_][A-Za-z0-9_]*";
31897
+ var VARIABLE_REFERENCE = new RegExp(
31898
+ `^(?:\\$(${VARIABLE_NAME})|\\$\\{(${VARIABLE_NAME})\\}|%(${VARIABLE_NAME})%|\\$env:(${VARIABLE_NAME}))$`,
31899
+ "i"
31900
+ );
31901
+ function isVariableReference(value) {
31902
+ const name3 = VARIABLE_REFERENCE.exec(value)?.slice(1).find(Boolean);
31903
+ return name3 !== void 0 && !isKeyMaterial(name3);
31904
+ }
31896
31905
  function isBasicAuthPayload(value) {
31897
31906
  if (value.endsWith("=")) return true;
31898
31907
  const c = charClasses(value);
@@ -32366,7 +32375,8 @@ function matchSlice({
32366
32375
  }
32367
32376
  const urlValues = urlValuesIn(text3);
32368
32377
  const placed = urlValues.length === 0 ? found : inLinkValues({ text: text3, found, urlValues, ruleIds });
32369
- return withoutOverlaps(placed).map((match) => {
32378
+ const values = placed.filter((match) => !isVariableReference(text3.slice(match.start, match.end)));
32379
+ return withoutOverlaps(values).map((match) => {
32370
32380
  const value = text3.slice(match.start, match.end);
32371
32381
  return {
32372
32382
  value,
@@ -36960,7 +36970,7 @@ function shadowedLinkLineOf({ shadow }) {
36960
36970
  }
36961
36971
 
36962
36972
  // src/rules/cli-version.rules.ts
36963
- var STAMPED = "0.1.135";
36973
+ var STAMPED = "0.1.136";
36964
36974
  function cliVersionOf({ stamped = STAMPED } = {}) {
36965
36975
  return stamped.startsWith("__") ? "dev" : stamped;
36966
36976
  }
@@ -59689,6 +59699,12 @@ function uiTokens(owner) {
59689
59699
  };
59690
59700
  }
59691
59701
 
59702
+ // ../../packages/module/src/contract/read-audience.ts
59703
+ var AUDIENCE_KEYWORD = "x-laze-audience";
59704
+ function ownerOnly(schema) {
59705
+ return schema.meta({ [AUDIENCE_KEYWORD]: "owner" });
59706
+ }
59707
+
59692
59708
  // ../../modules/api-key/contract/src/machine-key.ts
59693
59709
  var MACHINE_PROOF_HEADER = "dpop";
59694
59710
  var MACHINE_KEY_WARNING_HEADER = "x-laze-key-warning";
@@ -71641,7 +71657,7 @@ var agentSchemaDefinition = external_exports.object({
71641
71657
  /** `<roster>:<seed>`, `file:<file id>`, or empty for the sloth drawn from its id. */
71642
71658
  avatar: external_exports.string().max(AGENT_AVATAR_MAX).default(""),
71643
71659
  /** A Laze agent's SOUL.md. */
71644
- instructions: external_exports.string().default(""),
71660
+ instructions: ownerOnly(external_exports.string().default("")),
71645
71661
  /** A Laze models agent's level: the one picked, or what Default resolves to. */
71646
71662
  modelLevel: agentModelLevelSchema.nullable().default(null),
71647
71663
  /** True when `modelLevel` is what Default resolves to, not a level someone picked. */
@@ -71657,9 +71673,9 @@ var agentSchemaDefinition = external_exports.object({
71657
71673
  /** The thinking effort it runs at; null for its model's default. */
71658
71674
  effort: external_exports.string().nullable().default(null),
71659
71675
  /** The models its harness listed for its login when it last started; null before then. */
71660
- harnessModels: harnessModelsSchema.nullable().default(null),
71676
+ harnessModels: ownerOnly(harnessModelsSchema.nullable().default(null)),
71661
71677
  /** The GitHub identity a Laze agent works as; null when it has none. */
71662
- github: agentGithubSchema.nullable().default(null),
71678
+ github: ownerOnly(agentGithubSchema.nullable().default(null)),
71663
71679
  /** Out of usage (its login or its Laze models budget) until this time; null when it can work. */
71664
71680
  limitedUntil: external_exports.iso.datetime().nullable().default(null),
71665
71681
  /** Why it is limited: "usage" (its login; also when absent) or "budget" (Laze models). */
@@ -71668,17 +71684,17 @@ var agentSchemaDefinition = external_exports.object({
71668
71684
  pausedAt: external_exports.iso.datetime().nullable().default(null),
71669
71685
  /** Who paused it and the reason they gave; null when it runs or no reason was given. */
71670
71686
  pausedByUserId: external_exports.string().nullable().default(null),
71671
- pauseReason: external_exports.string().nullable().default(null),
71687
+ pauseReason: ownerOnly(external_exports.string().nullable().default(null)),
71672
71688
  /** The owner's own machine the agent's turns run on; null for a Laze sandbox. */
71673
- host: agentHostSchemaDefinition.nullable().default(null),
71689
+ host: ownerOnly(agentHostSchemaDefinition.nullable().default(null)),
71674
71690
  /** The Laze computer it runs on, as compute names it; null for its owner's default computer. */
71675
- computerKey: external_exports.string().nullable().default(null),
71691
+ computerKey: ownerOnly(external_exports.string().nullable().default(null)),
71676
71692
  /** The login pool a Claude Code or Codex agent draws from; null for its owner's own logins. */
71677
- loginPoolId: external_exports.string().nullable().default(null),
71693
+ loginPoolId: ownerOnly(external_exports.string().nullable().default(null)),
71678
71694
  /** The login it runs on now, "On Work Max"; null before its first turn and on other harnesses. */
71679
- login: agentLoginSchema.nullable().default(null),
71695
+ login: ownerOnly(agentLoginSchema.nullable().default(null)),
71680
71696
  /** The session a connected agent listens in; null until its CLI first names one. */
71681
- session: agentSessionSchemaDefinition.nullable().optional(),
71697
+ session: ownerOnly(agentSessionSchemaDefinition.nullable().optional()),
71682
71698
  /** How the background setup after creating it went. */
71683
71699
  setup: agentSetupStateSchema.optional(),
71684
71700
  /** `support` for the locked Laze Support agent; absent reads as `standard`. */
@@ -92665,42 +92681,44 @@ var machineDefinition = external_exports.object({
92665
92681
  requesterUserId: idSchema26,
92666
92682
  renterAgentId: idSchema26.nullable(),
92667
92683
  channelId: idSchema26.nullable(),
92668
- ipAddress: external_exports.string().nullable(),
92669
- sites: external_exports.array(machineSiteDefinition),
92684
+ ipAddress: ownerOnly(external_exports.string().nullable()),
92685
+ sites: ownerOnly(external_exports.array(machineSiteDefinition)),
92670
92686
  /** Members and agents the owner shared the machine with, beyond the owner's own agents. */
92671
- grants: external_exports.array(machineGrantDefinition),
92687
+ grants: ownerOnly(external_exports.array(machineGrantDefinition)),
92672
92688
  /** Set while the owner has the screen open; the agent waits until then. */
92673
92689
  inHumanUse: external_exports.boolean(),
92674
92690
  /** The spend cap for one `budgetPeriod`, at list price. */
92675
- budgetUsd: external_exports.number().nonnegative(),
92691
+ budgetUsd: ownerOnly(external_exports.number().nonnegative()),
92676
92692
  budgetPeriod: machineBudgetPeriodSchema,
92677
92693
  /** What the machine cost so far in the current budget period. */
92678
- periodCostUsd: external_exports.number().nonnegative(),
92694
+ periodCostUsd: ownerOnly(external_exports.number().nonnegative()),
92679
92695
  /** Set when the period's cost reached the cap: the machine sleeps until the period ends. */
92680
92696
  budgetReached: external_exports.boolean(),
92681
92697
  /** When the current budget period ends and the cost starts again from zero. */
92682
92698
  budgetResetsAt: external_exports.iso.datetime(),
92683
- monthCostUsd: external_exports.number().nonnegative(),
92699
+ monthCostUsd: ownerOnly(external_exports.number().nonnegative()),
92684
92700
  price: machinePriceDefinition,
92685
92701
  /** Whether the machine's daemon holds its link to Laze right now. */
92686
92702
  online: external_exports.boolean(),
92687
92703
  /** When the daemon was last linked; null before it ever was. */
92688
92704
  lastSeenAt: external_exports.iso.datetime().nullable(),
92689
92705
  /** What an own machine's connector reported last, and when. */
92690
- health: machineHealthSchema.nullable(),
92706
+ health: ownerOnly(machineHealthSchema.nullable()),
92691
92707
  healthCheckedAt: external_exports.iso.datetime().nullable(),
92692
92708
  /** While an own machine waits for its connector: when the connect code stops working. */
92693
92709
  connectExpiresAt: external_exports.iso.datetime().nullable(),
92694
92710
  /** Set on an own machine Laze reaches over SSH instead of through the connector. */
92695
- ssh: machineSshSchema.optional(),
92711
+ ssh: ownerOnly(machineSshSchema.optional()),
92696
92712
  /** The owner's agents set to run on this own machine. */
92697
- hostedAgents: external_exports.array(
92698
- external_exports.object({
92699
- id: idSchema26,
92700
- name: external_exports.string(),
92701
- whenOffline: external_exports.enum(["wait", "sandbox"])
92702
- })
92703
- ).default([]),
92713
+ hostedAgents: ownerOnly(
92714
+ external_exports.array(
92715
+ external_exports.object({
92716
+ id: idSchema26,
92717
+ name: external_exports.string(),
92718
+ whenOffline: external_exports.enum(["wait", "sandbox"])
92719
+ })
92720
+ ).default([])
92721
+ ),
92704
92722
  lastUsedAt: external_exports.iso.datetime(),
92705
92723
  createdAt: external_exports.iso.datetime(),
92706
92724
  /** The machine's screen in Laze; absent where the deployment names no origin. */
@@ -95453,7 +95471,8 @@ var DISCORD_PERMISSIONS = {
95453
95471
  SEND_MESSAGES_IN_THREADS: 1n << 38n
95454
95472
  };
95455
95473
  var discordSetupDefinition = external_exports.object({
95456
- setupKey: external_exports.string().min(1),
95474
+ /** The handle that saves the bot; empty to anyone who cannot set it up. */
95475
+ setupKey: external_exports.string(),
95457
95476
  /** The OAuth2 redirect to add in the portal. */
95458
95477
  redirectUrl: external_exports.url(),
95459
95478
  /** The Developer Portal's applications page. */
@@ -95836,8 +95855,12 @@ var overview = async ({ context, args, client }) => {
95836
95855
  const view = await client.get(DISCORD_KEY_PATHS.overview);
95837
95856
  if (json4({ context, args, data: view })) return;
95838
95857
  if (!view.setup) context.out("No Discord bot is set up. An admin runs `laze discord setup`.\n");
95839
- else if (!view.setup.saved) context.out(`Setup started: ${view.setup.setupKey}
95840
- `);
95858
+ else if (!view.setup.saved) {
95859
+ context.out(
95860
+ view.setup.setupKey ? `Setup started: ${view.setup.setupKey}
95861
+ ` : "An admin started setup.\n"
95862
+ );
95863
+ }
95841
95864
  if (view.connections.length === 0) return context.out("No Discord server is connected.\n");
95842
95865
  for (const row of view.connections) printConnection2({ context, row });
95843
95866
  };
@@ -106842,7 +106865,7 @@ var USAGE20 = [
106842
106865
  " laze whatsapp read [<machine>] <chat> [--limit <n>] a chat's last messages, oldest first",
106843
106866
  " (a read your owner set to Always ask waits for their answer; --request <id> picks it up later)",
106844
106867
  " laze whatsapp file [<machine>] <chat> <message-id> [--out <path>] save a message's photo, voice message or file",
106845
- ' laze whatsapp send <machine> <chat> "<text>"|- send as the owner (- reads stdin); an agent waits for their approval',
106868
+ ' laze whatsapp send [<machine>] <chat> "<text>"|- send as the owner (- reads stdin); an agent waits for their approval',
106846
106869
  " laze whatsapp status <send-id> where a send stands",
106847
106870
  " laze whatsapp sync [<machine>] check WhatsApp now (the owner only)",
106848
106871
  WHATSAPP_PAIRING_USAGE,
@@ -106979,12 +107002,17 @@ Still waiting. Run \`laze whatsapp status ${send5.id}\` later to see the answer.
106979
107002
  return send5.state === "sent" || !SETTLED.has(send5.state) ? 0 : 1;
106980
107003
  }
106981
107004
  async function send4({ context, args }) {
106982
- const text3 = args.words.length > 4 ? await textOf({ context, args, from: 4 }) : args.rest.join(" ").trim();
107005
+ const after = args.words.length - 2;
107006
+ const fewest = args.rest.length > 0 ? 1 : 2;
107007
+ if (after < fewest) throw new CliUsageError(USAGE20);
107008
+ const named = after > fewest;
107009
+ const textAt = named ? 4 : 3;
107010
+ const text3 = args.rest.length > 0 && args.words.length <= textAt ? args.rest.join(" ").trim() : await textOf({ context, args, from: textAt });
106983
107011
  if (!text3) throw new CliUsageError(USAGE20);
106984
107012
  const client = await computeClient({ context, args });
106985
107013
  const asked = await client.post(PATHS3.send, {
106986
- machine: word2({ args, at: 2 }),
106987
- chat: word2({ args, at: 3 }),
107014
+ ...named ? { machine: word2({ args, at: 2 }) } : {},
107015
+ chat: word2({ args, at: named ? 3 : 2 }),
106988
107016
  text: text3
106989
107017
  });
106990
107018
  if (!SETTLED.has(asked.state) && !args.flags.json) context.err(`${asked.outcome}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazehq/cli",
3
- "version": "0.1.135",
3
+ "version": "0.1.136",
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",