@lazehq/cli 0.1.28 → 0.1.30
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/dist/laze.mjs +530 -203
- package/package.json +1 -1
package/dist/laze.mjs
CHANGED
|
@@ -18733,8 +18733,8 @@ var require_snapshot_utils = __commonJS({
|
|
|
18733
18733
|
var require_snapshot_recorder = __commonJS({
|
|
18734
18734
|
"../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
|
|
18735
18735
|
"use strict";
|
|
18736
|
-
var { writeFile:
|
|
18737
|
-
var { dirname:
|
|
18736
|
+
var { writeFile: writeFile23, readFile: readFile38, mkdir: mkdir21 } = __require("node:fs/promises");
|
|
18737
|
+
var { dirname: dirname21, resolve: resolve17 } = __require("node:path");
|
|
18738
18738
|
var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
|
|
18739
18739
|
var { InvalidArgumentError, UndiciError } = require_errors();
|
|
18740
18740
|
var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
|
|
@@ -18950,7 +18950,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
18950
18950
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
18951
18951
|
}
|
|
18952
18952
|
try {
|
|
18953
|
-
const data = await
|
|
18953
|
+
const data = await readFile38(resolve17(path), "utf8");
|
|
18954
18954
|
const parsed = JSON.parse(data);
|
|
18955
18955
|
if (Array.isArray(parsed)) {
|
|
18956
18956
|
this.#snapshots.clear();
|
|
@@ -18980,12 +18980,12 @@ var require_snapshot_recorder = __commonJS({
|
|
|
18980
18980
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
18981
18981
|
}
|
|
18982
18982
|
const resolvedPath = resolve17(path);
|
|
18983
|
-
await
|
|
18983
|
+
await mkdir21(dirname21(resolvedPath), { recursive: true });
|
|
18984
18984
|
const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
|
|
18985
18985
|
hash: hash2,
|
|
18986
18986
|
snapshot
|
|
18987
18987
|
}));
|
|
18988
|
-
await
|
|
18988
|
+
await writeFile23(resolvedPath, JSON.stringify(data, null, 2), { flush: true });
|
|
18989
18989
|
}
|
|
18990
18990
|
/**
|
|
18991
18991
|
* Clears all recorded snapshots
|
|
@@ -35613,12 +35613,12 @@ var ConfigStore = class _ConfigStore {
|
|
|
35613
35613
|
};
|
|
35614
35614
|
function chooseProfile({
|
|
35615
35615
|
config: config2,
|
|
35616
|
-
flag,
|
|
35616
|
+
flag: flag2,
|
|
35617
35617
|
environment,
|
|
35618
35618
|
cwd
|
|
35619
35619
|
}) {
|
|
35620
35620
|
const bound = boundProfileOf({ bindings: config2.bindings, cwd });
|
|
35621
|
-
const name2 =
|
|
35621
|
+
const name2 = flag2 || environment || bound || config2.current;
|
|
35622
35622
|
const profile = name2 ? config2.profiles[name2] : void 0;
|
|
35623
35623
|
return name2 && profile ? { name: name2, profile } : { name: void 0, profile: void 0 };
|
|
35624
35624
|
}
|
|
@@ -35707,7 +35707,7 @@ function flagText({
|
|
|
35707
35707
|
}
|
|
35708
35708
|
|
|
35709
35709
|
// src/rules/cli-version.rules.ts
|
|
35710
|
-
var STAMPED = "0.1.
|
|
35710
|
+
var STAMPED = "0.1.30";
|
|
35711
35711
|
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
35712
35712
|
return stamped.startsWith("__") ? "dev" : stamped;
|
|
35713
35713
|
}
|
|
@@ -60942,17 +60942,17 @@ var computerBrowserStateSchemaDefinition = external_exports.object({ running: ex
|
|
|
60942
60942
|
var computerNoticeSchemaDefinition = external_exports.discriminatedUnion("type", [
|
|
60943
60943
|
external_exports.object({
|
|
60944
60944
|
type: external_exports.literal("memory_stop"),
|
|
60945
|
-
/** "stopped: your computer is out of memory (3.9 of 4 GB)". */
|
|
60945
|
+
/** "stopped: your agent computer is out of memory (3.9 of 4 GB)". */
|
|
60946
60946
|
text: external_exports.string().min(1).max(500)
|
|
60947
60947
|
}),
|
|
60948
60948
|
external_exports.object({
|
|
60949
60949
|
type: external_exports.literal("disk_warning"),
|
|
60950
|
-
/** "your computer's disk is 92% full (36.8 of 40 GB)". */
|
|
60950
|
+
/** "your agent computer's disk is 92% full (36.8 of 40 GB)". */
|
|
60951
60951
|
text: external_exports.string().min(1).max(500)
|
|
60952
60952
|
}),
|
|
60953
60953
|
external_exports.object({
|
|
60954
60954
|
type: external_exports.literal("disk_full"),
|
|
60955
|
-
/** "stopped: your computer's disk is full (40.1 of 40 GB)". */
|
|
60955
|
+
/** "stopped: your agent computer's disk is full (40.1 of 40 GB)". */
|
|
60956
60956
|
text: external_exports.string().min(1).max(500),
|
|
60957
60957
|
/** Whether one of this agent's commands was stopped for it. */
|
|
60958
60958
|
stopped: external_exports.boolean()
|
|
@@ -61864,6 +61864,13 @@ var VAULT_GMAIL_SEND_PATHS = [
|
|
|
61864
61864
|
"/upload/gmail/v1/users/*/drafts/send"
|
|
61865
61865
|
];
|
|
61866
61866
|
var VAULT_MAX_LEASE_SECONDS = 2 * 86400;
|
|
61867
|
+
var VAULT_LEASE_CHOICES = [
|
|
61868
|
+
15 * 60,
|
|
61869
|
+
3600,
|
|
61870
|
+
8 * 3600,
|
|
61871
|
+
86400,
|
|
61872
|
+
VAULT_MAX_LEASE_SECONDS
|
|
61873
|
+
];
|
|
61867
61874
|
var vaultConnectionSchemaDefinition = external_exports.object({
|
|
61868
61875
|
id: external_exports.string().min(1),
|
|
61869
61876
|
workspaceId: external_exports.string().min(1),
|
|
@@ -61876,7 +61883,7 @@ var vaultConnectionSchemaDefinition = external_exports.object({
|
|
|
61876
61883
|
rules: external_exports.string(),
|
|
61877
61884
|
/** Who answers an ask on a workspace or agent keychain; a personal one asks its owner. */
|
|
61878
61885
|
approverUserIds: external_exports.array(external_exports.string().min(1)),
|
|
61879
|
-
/**
|
|
61886
|
+
/** How long an approval lasts for the agent; null takes the deployment's default, 2 days. */
|
|
61880
61887
|
maxLeaseSeconds: external_exports.number().int().positive().nullable(),
|
|
61881
61888
|
/** Every use asks a person: no lease is offered and none covers it. */
|
|
61882
61889
|
everyUseAsks: external_exports.boolean().default(false),
|
|
@@ -62192,16 +62199,28 @@ var vaultMostAskedSchemaDefinition = external_exports.object({
|
|
|
62192
62199
|
)
|
|
62193
62200
|
});
|
|
62194
62201
|
var vaultMostAskedSchema = vaultMostAskedSchemaDefinition;
|
|
62202
|
+
var vaultUseOriginSchema = external_exports.enum(["computer", "connected"]);
|
|
62195
62203
|
var vaultConnectionUseSchemaDefinition = external_exports.object({
|
|
62196
62204
|
at: external_exports.iso.datetime(),
|
|
62197
62205
|
action: external_exports.string(),
|
|
62198
62206
|
outcome: external_exports.string(),
|
|
62207
|
+
/** Who used it: a person (`user`), an agent, or Laze itself (`system`). */
|
|
62208
|
+
actorKind: external_exports.enum(["user", "agent", "system"]).default("system"),
|
|
62209
|
+
actorId: external_exports.string().nullable().default(null),
|
|
62199
62210
|
agentId: external_exports.string().nullable(),
|
|
62200
62211
|
requesterUserId: external_exports.string().nullable(),
|
|
62201
62212
|
channelId: external_exports.string().nullable(),
|
|
62202
62213
|
reason: external_exports.string().nullable(),
|
|
62203
62214
|
/** The command or tool, as the use named it. */
|
|
62204
|
-
command: external_exports.array(external_exports.string())
|
|
62215
|
+
command: external_exports.array(external_exports.string()),
|
|
62216
|
+
/** What let it through, such as `approval`, `lease`, `judge` or `sensitivity`. */
|
|
62217
|
+
decider: external_exports.string().nullable().default(null),
|
|
62218
|
+
/** The approval card the use came under; uses under one lease share it. */
|
|
62219
|
+
requestId: external_exports.string().nullable().default(null),
|
|
62220
|
+
leaseId: external_exports.string().nullable().default(null),
|
|
62221
|
+
origin: vaultUseOriginSchema.nullable().default(null),
|
|
62222
|
+
/** How a person's read happened: `page` (Reveal) or `own_secret` (the CLI or Laze for them). */
|
|
62223
|
+
via: external_exports.string().nullable().default(null)
|
|
62205
62224
|
});
|
|
62206
62225
|
var vaultConnectionUseSchema = vaultConnectionUseSchemaDefinition;
|
|
62207
62226
|
var vaultRevokeAtProviderSchema = external_exports.enum(["revoked", "failed", "not_supported"]);
|
|
@@ -62336,6 +62355,39 @@ var vaultConfig = Config.define((c) => ({
|
|
|
62336
62355
|
auditHeadFile: c.env("VAULT_AUDIT_HEAD_FILE", external_exports.string().min(1).optional())
|
|
62337
62356
|
}));
|
|
62338
62357
|
|
|
62358
|
+
// ../../modules/vault/contract/src/vault-levels.ts
|
|
62359
|
+
var LEVEL_LABELS = {
|
|
62360
|
+
auto: "Allow",
|
|
62361
|
+
checked: "Auto",
|
|
62362
|
+
ask: "Always ask",
|
|
62363
|
+
human_only: "Human only"
|
|
62364
|
+
};
|
|
62365
|
+
function vaultLevelLabel(level) {
|
|
62366
|
+
return LEVEL_LABELS[level];
|
|
62367
|
+
}
|
|
62368
|
+
var CLI_LEVELS = {
|
|
62369
|
+
auto: "allow",
|
|
62370
|
+
checked: "auto",
|
|
62371
|
+
ask: "always-ask",
|
|
62372
|
+
human_only: "human-only"
|
|
62373
|
+
};
|
|
62374
|
+
var VAULT_CLI_LEVEL_NAMES = [
|
|
62375
|
+
"allow",
|
|
62376
|
+
"auto",
|
|
62377
|
+
"always-ask",
|
|
62378
|
+
"human-only"
|
|
62379
|
+
];
|
|
62380
|
+
function vaultCliLevelOf(level) {
|
|
62381
|
+
return CLI_LEVELS[level];
|
|
62382
|
+
}
|
|
62383
|
+
function vaultLevelOfCliName(name2) {
|
|
62384
|
+
const wanted = name2.toLowerCase();
|
|
62385
|
+
const found = Object.keys(CLI_LEVELS).find(
|
|
62386
|
+
(level) => CLI_LEVELS[level] === wanted
|
|
62387
|
+
);
|
|
62388
|
+
return found ?? "unknown";
|
|
62389
|
+
}
|
|
62390
|
+
|
|
62339
62391
|
// ../../modules/vault/contract/src/vault.errors.ts
|
|
62340
62392
|
var VaultSealMismatchError = class extends HandledError {
|
|
62341
62393
|
constructor() {
|
|
@@ -64108,6 +64160,11 @@ var setAgentHostInputSchemaDefinition = external_exports.object({
|
|
|
64108
64160
|
agentId: idSchema14,
|
|
64109
64161
|
host: agentHostSchemaDefinition.nullable()
|
|
64110
64162
|
});
|
|
64163
|
+
var setAgentComputerKeyInputSchemaDefinition = external_exports.object({
|
|
64164
|
+
workspaceId: workspaceIdSchema10,
|
|
64165
|
+
agentId: idSchema14,
|
|
64166
|
+
computerKey: external_exports.string().min(1).max(200).nullable()
|
|
64167
|
+
});
|
|
64111
64168
|
var agentSchemaDefinition = external_exports.object({
|
|
64112
64169
|
id: idSchema14,
|
|
64113
64170
|
workspaceId: workspaceIdSchema10,
|
|
@@ -64138,6 +64195,8 @@ var agentSchemaDefinition = external_exports.object({
|
|
|
64138
64195
|
pauseReason: external_exports.string().nullable().default(null),
|
|
64139
64196
|
/** The owner's own machine the agent's turns run on; null for a Laze sandbox. */
|
|
64140
64197
|
host: agentHostSchemaDefinition.nullable().default(null),
|
|
64198
|
+
/** The Laze computer it runs on, as compute names it; null for its owner's default computer. */
|
|
64199
|
+
computerKey: external_exports.string().nullable().default(null),
|
|
64141
64200
|
/** The login pool a Claude Code or Codex agent draws from; null for its owner's own logins. */
|
|
64142
64201
|
loginPoolId: external_exports.string().nullable().default(null),
|
|
64143
64202
|
/** The login it runs on now, "On Work Max"; null before its first turn and on other harnesses. */
|
|
@@ -67717,8 +67776,8 @@ async function takeLock({
|
|
|
67717
67776
|
const self2 = context.processes.pid;
|
|
67718
67777
|
if (holder && holder.pid !== self2 && context.processes.alive(holder.pid)) {
|
|
67719
67778
|
const served = await holderClaudeOf({ context, holder });
|
|
67720
|
-
const
|
|
67721
|
-
if (served && context.processes.alive(served) && !
|
|
67779
|
+
const mine4 = preempt && served === claudePid && !holder.monitor;
|
|
67780
|
+
if (served && context.processes.alive(served) && !mine4) return false;
|
|
67722
67781
|
context.processes.stop(holder.pid);
|
|
67723
67782
|
}
|
|
67724
67783
|
await mkdir6(dirname6(path), { recursive: true, mode: 448 });
|
|
@@ -69924,8 +69983,8 @@ async function registerMcp({
|
|
|
69924
69983
|
directory,
|
|
69925
69984
|
profile
|
|
69926
69985
|
}) {
|
|
69927
|
-
const
|
|
69928
|
-
const script = `cd ${quote3(directory)} && { claude mcp remove --scope local ${LAZE_MCP_SERVER} >/dev/null 2>&1 </dev/null; ${
|
|
69986
|
+
const add4 = mcpAddCommandOf({ context, profile });
|
|
69987
|
+
const script = `cd ${quote3(directory)} && { claude mcp remove --scope local ${LAZE_MCP_SERVER} >/dev/null 2>&1 </dev/null; ${add4} >/dev/null 2>&1 </dev/null; }`;
|
|
69929
69988
|
const run4 = context.runCommand({ command: ["sh", "-c", script], env: {} }).catch(() => 1);
|
|
69930
69989
|
const done = new AbortController();
|
|
69931
69990
|
const gaveUp = context.sleep(MCP_REGISTER_LIMIT_MS, done.signal).then(() => -1);
|
|
@@ -70582,7 +70641,7 @@ async function loginValueOf({
|
|
|
70582
70641
|
args,
|
|
70583
70642
|
usage
|
|
70584
70643
|
}) {
|
|
70585
|
-
if (SECRET_FLAGS.some((
|
|
70644
|
+
if (SECRET_FLAGS.some((flag2) => args.flags[flag2] !== void 0)) {
|
|
70586
70645
|
throw new CliUsageError(
|
|
70587
70646
|
"laze: a login token is read from stdin or --from-vault only, never from an argument, so it stays out of your shell history."
|
|
70588
70647
|
);
|
|
@@ -70701,7 +70760,7 @@ var LOGIN_ACTIONS = {
|
|
|
70701
70760
|
words: 1,
|
|
70702
70761
|
run: async (step) => {
|
|
70703
70762
|
const login2 = loginNamed({ logins: await loginsOf(step.client), wanted: step.first });
|
|
70704
|
-
if (SECRET_FLAGS.some((
|
|
70763
|
+
if (SECRET_FLAGS.some((flag2) => step.args.flags[flag2] !== void 0)) {
|
|
70705
70764
|
throw new CliUsageError(LOGIN_SIGN_IN_USAGE);
|
|
70706
70765
|
}
|
|
70707
70766
|
const secret = await secretOnStdin({ context: step.context });
|
|
@@ -73140,10 +73199,9 @@ var USAGE2 = `Usage:
|
|
|
73140
73199
|
laze app connections
|
|
73141
73200
|
laze app connection allow <connection>
|
|
73142
73201
|
laze app connection revoke <connection>`;
|
|
73143
|
-
var LEVELS3 = { auto: "Auto", checked: "Checked", ask: "Ask", human_only: "Human only" };
|
|
73144
73202
|
function connectionLine(connection) {
|
|
73145
73203
|
const whose = connection.ownerUserId ? `${connection.ownerName}'s keychain` : "workspace keychain";
|
|
73146
|
-
return `${connection.name} ${connection.label}, ${whose}, ${
|
|
73204
|
+
return `${connection.name} ${connection.label}, ${whose}, ${vaultLevelLabel(connection.sensitivity)}
|
|
73147
73205
|
used by ${connection.functions.join(", ")}; ${stateOf(connection)}
|
|
73148
73206
|
`;
|
|
73149
73207
|
}
|
|
@@ -75717,7 +75775,7 @@ function filterOf({ args }) {
|
|
|
75717
75775
|
["mentions", "mention"],
|
|
75718
75776
|
["threads", "thread_reply"],
|
|
75719
75777
|
["reactions", "reaction"]
|
|
75720
|
-
].filter(([
|
|
75778
|
+
].filter(([flag2]) => args.flags[flag2] !== void 0);
|
|
75721
75779
|
if (picked.length > 1) throw new CliUsageError(ACTIVITY_USAGE);
|
|
75722
75780
|
return picked[0]?.[1] ?? "all";
|
|
75723
75781
|
}
|
|
@@ -75750,7 +75808,7 @@ async function activityRead({ context, args }) {
|
|
|
75750
75808
|
|
|
75751
75809
|
// src/services/channel-config-commands.service.ts
|
|
75752
75810
|
var AGENT_HINT2 = "Roles, archiving and removing others are a channel admin's change: ask one.\n";
|
|
75753
|
-
var
|
|
75811
|
+
var LEVELS3 = ["default", "all", "mentions", "nothing", "mute", "unmute"];
|
|
75754
75812
|
async function changing2({
|
|
75755
75813
|
context,
|
|
75756
75814
|
profile,
|
|
@@ -75936,7 +75994,7 @@ function instantOf({ until }) {
|
|
|
75936
75994
|
}
|
|
75937
75995
|
function notifyBodyOf({ args }) {
|
|
75938
75996
|
const [, , channel, word3] = args.words;
|
|
75939
|
-
const level =
|
|
75997
|
+
const level = LEVELS3.find((candidate) => candidate === word3);
|
|
75940
75998
|
if (!channel || !level) throw new CliUsageError(NOTIFY_USAGE);
|
|
75941
75999
|
if (level === "unmute") return { channel, muted: false };
|
|
75942
76000
|
if (level !== "mute") return { channel, level };
|
|
@@ -76493,8 +76551,8 @@ async function deliverOnce({
|
|
|
76493
76551
|
profile
|
|
76494
76552
|
}) {
|
|
76495
76553
|
const lock = statePathOf({ context, kind: "waiters", profile });
|
|
76496
|
-
const
|
|
76497
|
-
if (!
|
|
76554
|
+
const mine4 = (await holderOf({ path: lock }))?.pid === context.processes.pid;
|
|
76555
|
+
if (!mine4 && !await takeLock({ context, path: lock, claudePid, preempt: true })) {
|
|
76498
76556
|
return "outranked";
|
|
76499
76557
|
}
|
|
76500
76558
|
const named = { ...args, flags: { ...args.flags, profile } };
|
|
@@ -77083,6 +77141,12 @@ var computeGuardSweepStateDefinition = external_exports.object({ lastSweepAt: ex
|
|
|
77083
77141
|
var computeGuardSweepIntentDefinition = external_exports.object({ scheduledFor: external_exports.number() });
|
|
77084
77142
|
|
|
77085
77143
|
// ../../modules/compute/contract/src/computer.ts
|
|
77144
|
+
var computerKindSchema = external_exports.enum(["default", "personal", "shared"]);
|
|
77145
|
+
var computerCreatorsDefinition = external_exports.object({
|
|
77146
|
+
/** Every Member, present and future; Owners and Admins always may. */
|
|
77147
|
+
everyone: external_exports.boolean(),
|
|
77148
|
+
userIds: external_exports.array(external_exports.string())
|
|
77149
|
+
});
|
|
77086
77150
|
var sizeTermsDefinition = external_exports.object({
|
|
77087
77151
|
id: computerSizeSchema,
|
|
77088
77152
|
label: external_exports.string(),
|
|
@@ -77100,7 +77164,9 @@ var computerAgentDefinition = external_exports.object({
|
|
|
77100
77164
|
state: external_exports.enum(["working", "idle", "asleep"]),
|
|
77101
77165
|
/** CPUs busy, 1 = one vCPU fully busy. */
|
|
77102
77166
|
cpuBusy: external_exports.number().nonnegative(),
|
|
77103
|
-
memoryGb: external_exports.number().nonnegative()
|
|
77167
|
+
memoryGb: external_exports.number().nonnegative(),
|
|
77168
|
+
/** Whose agent it is, on a shared computer; null on a person's own. */
|
|
77169
|
+
ownerName: external_exports.string().nullable().default(null)
|
|
77104
77170
|
});
|
|
77105
77171
|
var memoryStopDefinition = external_exports.object({
|
|
77106
77172
|
agentId: external_exports.string(),
|
|
@@ -77145,10 +77211,16 @@ var computerRequestDefinition = external_exports.object({
|
|
|
77145
77211
|
var computerRequestSchema = computerRequestDefinition;
|
|
77146
77212
|
var computerStatusDefinition = external_exports.object({
|
|
77147
77213
|
workspaceId: external_exports.string(),
|
|
77214
|
+
/** `default` is the person's included computer; more computers have their own ids. */
|
|
77215
|
+
computerId: external_exports.string().default("default"),
|
|
77216
|
+
kind: computerKindSchema.default("default"),
|
|
77217
|
+
/** Who may put agents on a shared computer; null on a person's own. */
|
|
77218
|
+
creators: computerCreatorsDefinition.nullable().default(null),
|
|
77219
|
+
canDelete: external_exports.boolean().default(false),
|
|
77148
77220
|
/** The person whose computer this is; an agent reads its owner's. */
|
|
77149
77221
|
ownerUserId: external_exports.string(),
|
|
77150
77222
|
ownerName: external_exports.string(),
|
|
77151
|
-
/** "
|
|
77223
|
+
/** "Agent computer" for its owner, "Mia's agent computer" for an agent or anyone else. */
|
|
77152
77224
|
name: external_exports.string(),
|
|
77153
77225
|
/** The size it runs at: the chosen one, or the included one when none was chosen. */
|
|
77154
77226
|
size: computerSizeSchema,
|
|
@@ -77187,7 +77259,9 @@ var computerStatusDefinition = external_exports.object({
|
|
|
77187
77259
|
var computerStatusSchema = computerStatusDefinition;
|
|
77188
77260
|
var setComputerSizeInputDefinition = external_exports.object({
|
|
77189
77261
|
workspaceId: external_exports.string().min(1),
|
|
77190
|
-
size: external_exports.string().trim().toLowerCase().min(1).max(32)
|
|
77262
|
+
size: external_exports.string().trim().toLowerCase().min(1).max(32),
|
|
77263
|
+
/** Another computer of the caller's, or a shared one; absent for the default computer. */
|
|
77264
|
+
computerId: external_exports.string().min(1).max(64).optional()
|
|
77191
77265
|
});
|
|
77192
77266
|
var setComputerSizeInputSchema = setComputerSizeInputDefinition;
|
|
77193
77267
|
var computerSizeAnswerDefinition = external_exports.object({
|
|
@@ -77237,7 +77311,69 @@ var restRestartComputerInputDefinition = restartComputerInputDefinition.omit({
|
|
|
77237
77311
|
});
|
|
77238
77312
|
var restComputerSizeInputDefinition = setComputerSizeInputDefinition.omit({ workspaceId: true });
|
|
77239
77313
|
var restComputerRequestRefDefinition = computerRequestRefDefinition.omit({ workspaceId: true });
|
|
77314
|
+
var myComputersDefinition = external_exports.object({
|
|
77315
|
+
currency: currencySchema,
|
|
77316
|
+
computers: external_exports.array(computerStatusDefinition),
|
|
77317
|
+
/** Whether the caller may add a computer at once; otherwise adding files a request. */
|
|
77318
|
+
canAdd: external_exports.boolean(),
|
|
77319
|
+
canAddShared: external_exports.boolean()
|
|
77320
|
+
});
|
|
77321
|
+
var myComputersSchema = myComputersDefinition;
|
|
77322
|
+
var createComputerInputDefinition = external_exports.object({
|
|
77323
|
+
workspaceId: external_exports.string().min(1),
|
|
77324
|
+
name: external_exports.string().trim().min(1).max(40),
|
|
77325
|
+
size: computerSizeSchema,
|
|
77326
|
+
kind: external_exports.enum(["personal", "shared"]),
|
|
77327
|
+
creators: computerCreatorsDefinition.nullable().default(null)
|
|
77328
|
+
});
|
|
77329
|
+
var createComputerInputSchema = createComputerInputDefinition;
|
|
77330
|
+
var computerRefDefinition = external_exports.object({
|
|
77331
|
+
workspaceId: external_exports.string().min(1),
|
|
77332
|
+
computerId: external_exports.string().min(1).max(64)
|
|
77333
|
+
});
|
|
77334
|
+
var deleteComputerInputDefinition = external_exports.object({
|
|
77335
|
+
...computerRefDefinition.shape,
|
|
77336
|
+
moveTo: external_exports.string().min(1).max(64).nullable().default(null)
|
|
77337
|
+
});
|
|
77338
|
+
var deleteComputerInputSchema = deleteComputerInputDefinition;
|
|
77339
|
+
var deleteComputerAnswerDefinition = external_exports.object({
|
|
77340
|
+
computerId: external_exports.string(),
|
|
77341
|
+
/** The agents moved to `moveTo` before the delete. */
|
|
77342
|
+
moved: external_exports.array(external_exports.string()),
|
|
77343
|
+
message: external_exports.string()
|
|
77344
|
+
});
|
|
77345
|
+
var deleteComputerAnswerSchema = deleteComputerAnswerDefinition;
|
|
77346
|
+
var setComputerCreatorsInputDefinition = external_exports.object({
|
|
77347
|
+
...computerRefDefinition.shape,
|
|
77348
|
+
creators: computerCreatorsDefinition
|
|
77349
|
+
});
|
|
77350
|
+
var setComputerCreatorsInputSchema = setComputerCreatorsInputDefinition;
|
|
77351
|
+
var setAgentComputerInputDefinition = external_exports.object({
|
|
77352
|
+
...computerRefDefinition.shape,
|
|
77353
|
+
agentId: external_exports.string().min(1)
|
|
77354
|
+
});
|
|
77355
|
+
var setAgentComputerInputSchema = setAgentComputerInputDefinition;
|
|
77356
|
+
var agentComputerAnswerDefinition = external_exports.object({
|
|
77357
|
+
agentId: external_exports.string(),
|
|
77358
|
+
computerId: external_exports.string(),
|
|
77359
|
+
message: external_exports.string()
|
|
77360
|
+
});
|
|
77361
|
+
var agentComputerAnswerSchema = agentComputerAnswerDefinition;
|
|
77362
|
+
var restCreateComputerInputDefinition = createComputerInputDefinition.omit({
|
|
77363
|
+
workspaceId: true
|
|
77364
|
+
});
|
|
77365
|
+
var restDeleteComputerInputDefinition = deleteComputerInputDefinition.omit({ workspaceId: true });
|
|
77366
|
+
var restSetComputerCreatorsInputDefinition = setComputerCreatorsInputDefinition.omit({
|
|
77367
|
+
workspaceId: true
|
|
77368
|
+
});
|
|
77369
|
+
var restSetAgentComputerInputDefinition = setAgentComputerInputDefinition.omit({
|
|
77370
|
+
workspaceId: true
|
|
77371
|
+
});
|
|
77240
77372
|
var computerListEntryDefinition = external_exports.object({
|
|
77373
|
+
computerId: external_exports.string().default("default"),
|
|
77374
|
+
kind: computerKindSchema.default("default"),
|
|
77375
|
+
/** Set on a person's extra computers and on shared ones; null on a default computer. */
|
|
77376
|
+
name: external_exports.string().nullable().default(null),
|
|
77241
77377
|
ownerUserId: external_exports.string(),
|
|
77242
77378
|
ownerName: external_exports.string(),
|
|
77243
77379
|
size: computerSizeSchema,
|
|
@@ -77259,7 +77395,12 @@ var COMPUTER_REST_PATHS = {
|
|
|
77259
77395
|
size: "/api/compute/computer/size",
|
|
77260
77396
|
requests: "/api/compute/computer/requests",
|
|
77261
77397
|
cancelRequest: "/api/compute/computer/requests/cancel",
|
|
77262
|
-
restart: "/api/compute/computer/restart"
|
|
77398
|
+
restart: "/api/compute/computer/restart",
|
|
77399
|
+
mine: "/api/compute/computers/mine",
|
|
77400
|
+
create: "/api/compute/computers",
|
|
77401
|
+
remove: "/api/compute/computers/remove",
|
|
77402
|
+
creators: "/api/compute/computers/creators",
|
|
77403
|
+
agent: "/api/compute/computers/agent"
|
|
77263
77404
|
};
|
|
77264
77405
|
var computerWatchStateDefinition = external_exports.object({
|
|
77265
77406
|
nextWakeAt: external_exports.number().nullable(),
|
|
@@ -77832,7 +77973,9 @@ var ownMachineSshConnectDefinition = external_exports.object({
|
|
|
77832
77973
|
var ownMachineSshConnectSchema = ownMachineSshConnectDefinition;
|
|
77833
77974
|
var reconcileDefinition = external_exports.object({ workspaceId: workspaceIdSchema18, machineId: idSchema19 });
|
|
77834
77975
|
var ComputeApi = moduleApi()("compute");
|
|
77835
|
-
var
|
|
77976
|
+
var computeCoreTrpc = defineTrpcContract("compute").query("status").withInput(computeWorkspaceInputSchema).withOutput(computeStatusSchema).query("browserTabs").withInput(browserTabListInputSchema).withOutput(browserTabListSchema).query("browserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("openBrowserTab").withInput(openBrowserTabInputSchema).withOutput(browserTabSchema).mutation("browserTabScreen").withInput(browserTabInputSchema).withOutput(browserTabScreenSchema).mutation("gotoBrowserTab").withInput(browserTabGotoInputSchema).withOutput(browserTabPageSchema).mutation("doneOnBrowserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("shareBrowserTab").withInput(browserTabShareInputSchema).withOutput(browserTabSchema).mutation("closeBrowserTab").withInput(browserTabInputSchema).withOutput(external_exports.object({ closed: external_exports.literal(true) })).query("computer").withInput(computeWorkspaceInputSchema).withOutput(computerStatusSchema).mutation("setComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerSizeAnswerSchema).mutation("requestComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerRequestSchema).mutation("cancelComputerRequest").withInput(computerRequestRefSchema).withOutput(computerRequestSchema).mutation("restartComputer").withInput(restartComputerInputSchema).withOutput(computerRestartAnswerSchema).query("computers").withInput(computeWorkspaceInputSchema).withOutput(computerListSchema).query("dedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpStatusSchema).mutation("setDedicatedIp").withInput(setDedicatedIpInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("turnOffDedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("setDedicatedIpDomains").withInput(setDedicatedIpDomainsInputSchema).withOutput(dedicatedIpAnswerSchema).query("dedicatedIps").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpListSchema).query("dedicatedIpCountries").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpCountriesSchema).query("dedicatedIpOffer").withInput(dedicatedIpOfferInputSchema).withOutput(dedicatedIpOfferSchema).query("list").withInput(computeWorkspaceInputSchema).withOutput(external_exports.array(machineSchema)).query("get").withInput(machineRefSchema).withOutput(machineSchema).mutation("setupBrowser").withInput(setupBrowserInputSchema).withOutput(machineSchema).mutation("sleep").withInput(machineRefSchema).withOutput(machineSchema).mutation("wake").withInput(machineRefSchema).withOutput(machineSchema).mutation("delete").withInput(machineRefSchema).withOutput(machineSchema).mutation("rename").withInput(renameMachineInputSchema).withOutput(machineSchema).mutation("grant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("revokeGrant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("setBudget").withInput(setMachineBudgetInputSchema).withOutput(machineSchema).mutation("openScreen").withInput(openScreenInputSchema).withOutput(screenSessionSchema).mutation("finishScreen").withInput(screenRefSchema).withOutput(machineSchema).mutation("connectOwn").withInput(connectOwnMachineInputSchema).withOutput(ownMachineConnectSchema).mutation("newConnectCommand").withInput(machineRefSchema).withOutput(ownMachineConnectSchema).mutation("connectSsh").withInput(connectSshMachineInputSchema).withOutput(ownMachineSshConnectSchema).mutation("trustHostKey").withInput(trustHostKeyInputSchema).withOutput(machineSchema).mutation("checkHealth").withInput(machineRefSchema).withOutput(machineSchema).mutation("hostAgent").withInput(hostAgentInputSchema).withOutput(machineSchema).mutation("unhostAgent").withInput(unhostAgentInputSchema).withOutput(external_exports.object({ agentId: external_exports.string() })).mutation("pairWhatsapp").withInput(machineRefSchema).withOutput(whatsappPairingSchema).query("whatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("cancelWhatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("unpairWhatsapp").withInput(machineRefSchema).withOutput(machineSchema).build();
|
|
77977
|
+
var computeFleetTrpc = defineTrpcContract("compute").query("myComputers").withInput(computeWorkspaceInputSchema).withOutput(myComputersSchema).mutation("createComputer").withInput(createComputerInputSchema).withOutput(computerStatusSchema).mutation("deleteComputer").withInput(deleteComputerInputSchema).withOutput(deleteComputerAnswerSchema).mutation("setComputerCreators").withInput(setComputerCreatorsInputSchema).withOutput(computerStatusSchema).mutation("setAgentComputer").withInput(setAgentComputerInputSchema).withOutput(agentComputerAnswerSchema).build();
|
|
77978
|
+
var computeTrpc = joinTrpcContracts("compute", computeCoreTrpc, computeFleetTrpc);
|
|
77836
77979
|
var restMachineInputDefinition = external_exports.object({ machine: external_exports.string().min(1).max(64) });
|
|
77837
77980
|
var restRenameInputDefinition = external_exports.object({
|
|
77838
77981
|
machine: external_exports.string().min(1).max(64),
|
|
@@ -77902,19 +78045,110 @@ var computeUi = uiTokens("compute");
|
|
|
77902
78045
|
var ComputeBrowserTabSlot = computeUi.component("browser-tab");
|
|
77903
78046
|
var ComputeOpenBrowserSlot = computeUi.component("open-browser");
|
|
77904
78047
|
|
|
78048
|
+
// src/services/computer-fleet-commands.service.ts
|
|
78049
|
+
var COMPUTER_FLEET_USAGE = ` laze computer mine [--json] every Laze computer your agents may run on, your default one first
|
|
78050
|
+
laze computer add <name> --size <size> [--shared [--everyone | --people <id,id>]]
|
|
78051
|
+
add a computer of your own or a shared one, at its full price (Owners and Admins)
|
|
78052
|
+
laze computer remove <computer> [--to <computer>]
|
|
78053
|
+
delete a computer; its agents move to --to first (default: their owner's default)
|
|
78054
|
+
laze computer creators <computer> --everyone | --people <id,id>
|
|
78055
|
+
who may put agents on a shared computer (Owners and Admins)
|
|
78056
|
+
laze computer move <agent> <computer|default>
|
|
78057
|
+
move an agent with its home to a Laze computer its owner may use`;
|
|
78058
|
+
var printJson2 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
|
|
78059
|
+
`);
|
|
78060
|
+
function flag(args, name2) {
|
|
78061
|
+
const value = args.flags[name2];
|
|
78062
|
+
if (value === true) throw new CliUsageError(COMPUTER_FLEET_USAGE);
|
|
78063
|
+
return value ?? null;
|
|
78064
|
+
}
|
|
78065
|
+
function creatorsOf(args) {
|
|
78066
|
+
const people2 = flag(args, "people");
|
|
78067
|
+
const userIds = (people2 ?? "").split(",").map((one) => one.trim()).filter(Boolean);
|
|
78068
|
+
return { everyone: args.flags.everyone === true, userIds };
|
|
78069
|
+
}
|
|
78070
|
+
function lineOf3(computer2) {
|
|
78071
|
+
const money2 = `${computer2.monthlyCharge} ${computer2.currency.toUpperCase()} a month`;
|
|
78072
|
+
const agents = `${computer2.agents.length} agent(s)`;
|
|
78073
|
+
return ` ${computer2.computerId} ${computer2.name} ${computer2.kind} ${computer2.size} ${money2} ${agents} ${computer2.state}`;
|
|
78074
|
+
}
|
|
78075
|
+
async function mine({ context, args }) {
|
|
78076
|
+
const client = await computeClient({ context, args });
|
|
78077
|
+
const answer4 = await client.get(COMPUTER_REST_PATHS.mine);
|
|
78078
|
+
if (args.flags.json) return printJson2(context, answer4);
|
|
78079
|
+
context.out(`Your agent computers:
|
|
78080
|
+
${answer4.computers.map(lineOf3).join("\n")}
|
|
78081
|
+
`);
|
|
78082
|
+
}
|
|
78083
|
+
async function add2({ context, args }) {
|
|
78084
|
+
const name2 = args.words[2];
|
|
78085
|
+
const size = flag(args, "size");
|
|
78086
|
+
if (!name2 || !size) throw new CliUsageError(COMPUTER_FLEET_USAGE);
|
|
78087
|
+
const shared = args.flags.shared === true;
|
|
78088
|
+
const client = await computeClient({ context, args });
|
|
78089
|
+
const answer4 = await client.post(COMPUTER_REST_PATHS.create, {
|
|
78090
|
+
name: name2,
|
|
78091
|
+
size,
|
|
78092
|
+
kind: shared ? "shared" : "personal",
|
|
78093
|
+
creators: shared ? creatorsOf(args) : null
|
|
78094
|
+
});
|
|
78095
|
+
if (args.flags.json) return printJson2(context, answer4);
|
|
78096
|
+
context.out(`${answer4.name} (${answer4.computerId}) is ready, ${answer4.monthlyCharge} a month.
|
|
78097
|
+
`);
|
|
78098
|
+
}
|
|
78099
|
+
async function remove3({ context, args }) {
|
|
78100
|
+
const computerId = args.words[2];
|
|
78101
|
+
if (!computerId) throw new CliUsageError(COMPUTER_FLEET_USAGE);
|
|
78102
|
+
const client = await computeClient({ context, args });
|
|
78103
|
+
const answer4 = await client.post(COMPUTER_REST_PATHS.remove, {
|
|
78104
|
+
computerId,
|
|
78105
|
+
moveTo: flag(args, "to")
|
|
78106
|
+
});
|
|
78107
|
+
if (args.flags.json) return printJson2(context, answer4);
|
|
78108
|
+
context.out(`${answer4.message}
|
|
78109
|
+
`);
|
|
78110
|
+
}
|
|
78111
|
+
async function creators({ context, args }) {
|
|
78112
|
+
const computerId = args.words[2];
|
|
78113
|
+
if (!computerId) throw new CliUsageError(COMPUTER_FLEET_USAGE);
|
|
78114
|
+
const client = await computeClient({ context, args });
|
|
78115
|
+
const answer4 = await client.post(COMPUTER_REST_PATHS.creators, {
|
|
78116
|
+
computerId,
|
|
78117
|
+
creators: creatorsOf(args)
|
|
78118
|
+
});
|
|
78119
|
+
if (args.flags.json) return printJson2(context, answer4);
|
|
78120
|
+
const who = answer4.creators?.everyone ? "everyone" : `${answer4.creators?.userIds.length ?? 0} people`;
|
|
78121
|
+
context.out(`${answer4.name}: ${who} may add agents, and Owners and Admins.
|
|
78122
|
+
`);
|
|
78123
|
+
}
|
|
78124
|
+
async function move({ context, args }) {
|
|
78125
|
+
const [, , agentId, computerId] = args.words;
|
|
78126
|
+
if (!agentId || !computerId) throw new CliUsageError(COMPUTER_FLEET_USAGE);
|
|
78127
|
+
const client = await computeClient({ context, args });
|
|
78128
|
+
const answer4 = await client.post(COMPUTER_REST_PATHS.agent, {
|
|
78129
|
+
agentId,
|
|
78130
|
+
computerId
|
|
78131
|
+
});
|
|
78132
|
+
if (args.flags.json) return printJson2(context, answer4);
|
|
78133
|
+
context.out(`${answer4.message}
|
|
78134
|
+
`);
|
|
78135
|
+
}
|
|
78136
|
+
var COMPUTER_FLEET_COMMANDS = { mine, add: add2, remove: remove3, creators, move };
|
|
78137
|
+
|
|
77905
78138
|
// src/services/computer-commands.service.ts
|
|
77906
78139
|
var COMPUTER_USAGE = `Usage:
|
|
77907
|
-
laze computer status [--json] your computer: size, CPU, memory and disk in use, your agents, the sizes
|
|
78140
|
+
laze computer status [--json] your agent computer: size, CPU, memory and disk in use, your agents, the sizes
|
|
77908
78141
|
laze computer sizes the sizes with their prices and what the plan includes per person
|
|
77909
|
-
laze computer upgrade <size> change your computer's size: small, medium, large or xl (Owners and
|
|
78142
|
+
laze computer upgrade <size> change your agent computer's size: small, medium, large or xl (Owners and
|
|
77910
78143
|
Admins); anyone else gets a message to forward and the admins a card
|
|
77911
|
-
laze computer request <size> ask the admins for a size for your computer
|
|
78144
|
+
laze computer request <size> ask the admins for a size for your agent computer
|
|
77912
78145
|
laze computer cancel <request> withdraw your request
|
|
77913
|
-
laze computer restart [--person <user id>]
|
|
77914
|
-
stop and start your computer, or a person's (Owners and Admins);
|
|
78146
|
+
laze computer restart [--person <user id>] [--computer <computer>]
|
|
78147
|
+
stop and start your agent computer, or a person's (Owners and Admins);
|
|
77915
78148
|
its agents start again on their next message
|
|
77916
|
-
laze computer list [--json] everyone's computers with size and monthly cost (Owners and Admins)
|
|
77917
|
-
|
|
78149
|
+
laze computer list [--json] everyone's computers with size and monthly cost (Owners and Admins)
|
|
78150
|
+
${COMPUTER_FLEET_USAGE}`;
|
|
78151
|
+
var printJson3 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
|
|
77918
78152
|
`);
|
|
77919
78153
|
var gb = (value) => `${Number(value.toFixed(1))} GB`;
|
|
77920
78154
|
var DISK_STATE_TEXT = {
|
|
@@ -77935,10 +78169,10 @@ function sizeLines(status8) {
|
|
|
77935
78169
|
});
|
|
77936
78170
|
}
|
|
77937
78171
|
function stateLine(status8) {
|
|
77938
|
-
if (status8.state === "none") return "State: no agent used
|
|
78172
|
+
if (status8.state === "none") return "State: ready, no agent used it yet";
|
|
77939
78173
|
if (status8.state === "asleep") {
|
|
77940
78174
|
const since = status8.lastRunningAt ? `, last ran ${utc(status8.lastRunningAt)}` : "";
|
|
77941
|
-
return `State:
|
|
78175
|
+
return `State: ready, wakes in seconds when an agent needs it${since}`;
|
|
77942
78176
|
}
|
|
77943
78177
|
return "State: running";
|
|
77944
78178
|
}
|
|
@@ -77983,13 +78217,13 @@ function printStatus({ context }, status8) {
|
|
|
77983
78217
|
async function status3({ context, args }) {
|
|
77984
78218
|
const client = await computeClient({ context, args });
|
|
77985
78219
|
const answer4 = await client.get(COMPUTER_REST_PATHS.computer);
|
|
77986
|
-
if (args.flags.json) return
|
|
78220
|
+
if (args.flags.json) return printJson3(context, answer4);
|
|
77987
78221
|
printStatus({ context, args }, answer4);
|
|
77988
78222
|
}
|
|
77989
78223
|
async function sizes({ context, args }) {
|
|
77990
78224
|
const client = await computeClient({ context, args });
|
|
77991
78225
|
const answer4 = await client.get(COMPUTER_REST_PATHS.computer);
|
|
77992
|
-
if (args.flags.json) return
|
|
78226
|
+
if (args.flags.json) return printJson3(context, answer4.sizes);
|
|
77993
78227
|
context.out(`${sizeLines(answer4).join("\n")}
|
|
77994
78228
|
Settings: ${answer4.settingsUrl}
|
|
77995
78229
|
`);
|
|
@@ -78003,7 +78237,7 @@ async function upgrade({ context, args }) {
|
|
|
78003
78237
|
const size = sizeArg({ args });
|
|
78004
78238
|
const client = await computeClient({ context, args });
|
|
78005
78239
|
const answer4 = await client.post(COMPUTER_REST_PATHS.size, { size });
|
|
78006
|
-
if (args.flags.json) return
|
|
78240
|
+
if (args.flags.json) return printJson3(context, answer4);
|
|
78007
78241
|
context.out(`${answer4.message}
|
|
78008
78242
|
`);
|
|
78009
78243
|
}
|
|
@@ -78011,7 +78245,7 @@ async function request({ context, args }) {
|
|
|
78011
78245
|
const size = sizeArg({ args });
|
|
78012
78246
|
const client = await computeClient({ context, args });
|
|
78013
78247
|
const answer4 = await client.post(COMPUTER_REST_PATHS.requests, { size });
|
|
78014
|
-
if (args.flags.json) return
|
|
78248
|
+
if (args.flags.json) return printJson3(context, answer4);
|
|
78015
78249
|
context.out(
|
|
78016
78250
|
`Asked the admins (request ${answer4.id}); they get a card in the feed.
|
|
78017
78251
|
Message to forward: ${answer4.message}
|
|
@@ -78025,7 +78259,7 @@ async function cancel({ context, args }) {
|
|
|
78025
78259
|
const answer4 = await client.post(COMPUTER_REST_PATHS.cancelRequest, {
|
|
78026
78260
|
requestId
|
|
78027
78261
|
});
|
|
78028
|
-
if (args.flags.json) return
|
|
78262
|
+
if (args.flags.json) return printJson3(context, answer4);
|
|
78029
78263
|
context.out(`Request ${answer4.id} is ${answer4.state}.
|
|
78030
78264
|
`);
|
|
78031
78265
|
}
|
|
@@ -78033,20 +78267,23 @@ async function restart({ context, args }) {
|
|
|
78033
78267
|
const person = args.flags.person;
|
|
78034
78268
|
if (person === true) throw new CliUsageError(COMPUTER_USAGE);
|
|
78035
78269
|
const client = await computeClient({ context, args });
|
|
78270
|
+
const computerId = args.flags.computer;
|
|
78271
|
+
if (computerId === true) throw new CliUsageError(COMPUTER_USAGE);
|
|
78036
78272
|
const answer4 = await client.post(COMPUTER_REST_PATHS.restart, {
|
|
78037
|
-
ownerUserId: person ?? null
|
|
78273
|
+
ownerUserId: person ?? null,
|
|
78274
|
+
...computerId ? { computerId } : {}
|
|
78038
78275
|
});
|
|
78039
|
-
if (args.flags.json) return
|
|
78276
|
+
if (args.flags.json) return printJson3(context, answer4);
|
|
78040
78277
|
context.out(`${answer4.message}
|
|
78041
78278
|
`);
|
|
78042
78279
|
}
|
|
78043
78280
|
async function list2({ context, args }) {
|
|
78044
78281
|
const client = await computeClient({ context, args });
|
|
78045
78282
|
const answer4 = await client.get(COMPUTER_REST_PATHS.all);
|
|
78046
|
-
if (args.flags.json) return
|
|
78283
|
+
if (args.flags.json) return printJson3(context, answer4);
|
|
78047
78284
|
const money2 = (amount) => `${amount} ${answer4.currency.toUpperCase()}`;
|
|
78048
78285
|
const lines = answer4.computers.map(
|
|
78049
|
-
(one) => ` ${one.ownerName} ${one.size} ${money2(one.monthlyCharge)} a month ${one.agents} agent(s) ${one.state}`
|
|
78286
|
+
(one) => ` ${one.name ?? one.ownerName} ${one.size} ${money2(one.monthlyCharge)} a month ${one.agents} agent(s) ${one.state}`
|
|
78050
78287
|
);
|
|
78051
78288
|
context.out(
|
|
78052
78289
|
`Everyone's computers (${answer4.includedSize} included per person):
|
|
@@ -78054,7 +78291,16 @@ ${lines.join("\n")}
|
|
|
78054
78291
|
`
|
|
78055
78292
|
);
|
|
78056
78293
|
}
|
|
78057
|
-
var COMPUTER_COMMANDS = {
|
|
78294
|
+
var COMPUTER_COMMANDS = {
|
|
78295
|
+
status: status3,
|
|
78296
|
+
sizes,
|
|
78297
|
+
upgrade,
|
|
78298
|
+
request,
|
|
78299
|
+
cancel,
|
|
78300
|
+
restart,
|
|
78301
|
+
list: list2,
|
|
78302
|
+
...COMPUTER_FLEET_COMMANDS
|
|
78303
|
+
};
|
|
78058
78304
|
async function computer({ context, args }) {
|
|
78059
78305
|
const name2 = args.words[1];
|
|
78060
78306
|
if (name2 === void 0) return status3({ context, args });
|
|
@@ -78306,7 +78552,7 @@ function keychainLabel(keychain) {
|
|
|
78306
78552
|
|
|
78307
78553
|
// src/services/vault-admin-commands.service.ts
|
|
78308
78554
|
var SUBJECTS = ["person", "group", "channel", "agent"];
|
|
78309
|
-
function
|
|
78555
|
+
function printJson4({ context, data }) {
|
|
78310
78556
|
context.out(`${JSON.stringify(data, null, 2)}
|
|
78311
78557
|
`);
|
|
78312
78558
|
}
|
|
@@ -78352,7 +78598,7 @@ var grantTo = async ({ context, args }) => {
|
|
|
78352
78598
|
subject: { kind: subject, id },
|
|
78353
78599
|
...durationOf(args)
|
|
78354
78600
|
});
|
|
78355
|
-
if (args.flags.json) return
|
|
78601
|
+
if (args.flags.json) return printJson4({ context, data: grant });
|
|
78356
78602
|
printGrant({ context, grant });
|
|
78357
78603
|
};
|
|
78358
78604
|
var lendTo = async ({ context, args }) => {
|
|
@@ -78365,7 +78611,7 @@ var lendTo = async ({ context, args }) => {
|
|
|
78365
78611
|
channelId,
|
|
78366
78612
|
...durationOf(args)
|
|
78367
78613
|
});
|
|
78368
|
-
if (args.flags.json) return
|
|
78614
|
+
if (args.flags.json) return printJson4({ context, data: grant });
|
|
78369
78615
|
printGrant({ context, grant });
|
|
78370
78616
|
};
|
|
78371
78617
|
var grantsOf = async ({ context, args }) => {
|
|
@@ -78374,7 +78620,7 @@ var grantsOf = async ({ context, args }) => {
|
|
|
78374
78620
|
const grants = await client.post("/api/vault/grants/list", {
|
|
78375
78621
|
connectionId: target.id
|
|
78376
78622
|
});
|
|
78377
|
-
if (args.flags.json) return
|
|
78623
|
+
if (args.flags.json) return printJson4({ context, data: grants });
|
|
78378
78624
|
if (grants.length === 0) return context.out(`${target.name} is shared with no one.
|
|
78379
78625
|
`);
|
|
78380
78626
|
for (const grant of grants) printGrant({ context, grant });
|
|
@@ -78384,14 +78630,14 @@ var revokeGrant = async ({ context, args }) => {
|
|
|
78384
78630
|
if (!grantId) throw new CliUsageError("Usage: laze vault ungrant <grantId>");
|
|
78385
78631
|
const { client } = await signedIn({ context, args });
|
|
78386
78632
|
const answer4 = await client.post("/api/vault/grants/revoke", { grantId });
|
|
78387
|
-
if (args.flags.json) return
|
|
78633
|
+
if (args.flags.json) return printJson4({ context, data: answer4 });
|
|
78388
78634
|
context.out(`Ended grant ${grantId}.
|
|
78389
78635
|
`);
|
|
78390
78636
|
};
|
|
78391
78637
|
var listLeases = async ({ context, args }) => {
|
|
78392
78638
|
const { client } = await signedIn({ context, args });
|
|
78393
78639
|
const leases = await client.get("/api/vault/leases");
|
|
78394
|
-
if (args.flags.json) return
|
|
78640
|
+
if (args.flags.json) return printJson4({ context, data: leases });
|
|
78395
78641
|
if (leases.length === 0) return context.out("No live leases.\n");
|
|
78396
78642
|
for (const lease of leases) {
|
|
78397
78643
|
context.out(
|
|
@@ -78405,7 +78651,7 @@ var endLease = async ({ context, args }) => {
|
|
|
78405
78651
|
if (!leaseId) throw new CliUsageError("Usage: laze vault end-lease <leaseId>");
|
|
78406
78652
|
const { client } = await signedIn({ context, args });
|
|
78407
78653
|
const answer4 = await client.post("/api/vault/leases/end", { leaseId });
|
|
78408
|
-
if (args.flags.json) return
|
|
78654
|
+
if (args.flags.json) return printJson4({ context, data: answer4 });
|
|
78409
78655
|
context.out(`Ended lease ${leaseId}.
|
|
78410
78656
|
`);
|
|
78411
78657
|
};
|
|
@@ -78415,14 +78661,16 @@ function printLimits({ context, limits }) {
|
|
|
78415
78661
|
const lease = limit.maxLeaseSeconds ? ` lease<=${limit.maxLeaseSeconds}s` : "";
|
|
78416
78662
|
const blocked = limit.blocked ? " blocked" : "";
|
|
78417
78663
|
const approve = limit.approveNew ? " approve-new" : "";
|
|
78418
|
-
context.out(
|
|
78419
|
-
|
|
78664
|
+
context.out(
|
|
78665
|
+
`${limit.subject} most ${vaultCliLevelOf(limit.most)}${lease}${blocked}${approve}
|
|
78666
|
+
`
|
|
78667
|
+
);
|
|
78420
78668
|
}
|
|
78421
78669
|
}
|
|
78422
78670
|
var listLimits = async ({ context, args }) => {
|
|
78423
78671
|
const { client } = await signedIn({ context, args });
|
|
78424
78672
|
const limits = await client.get("/api/vault/limits");
|
|
78425
|
-
if (args.flags.json) return
|
|
78673
|
+
if (args.flags.json) return printJson4({ context, data: limits });
|
|
78426
78674
|
printLimits({ context, limits });
|
|
78427
78675
|
};
|
|
78428
78676
|
var setLimit = async ({ context, args }) => {
|
|
@@ -78430,21 +78678,25 @@ var setLimit = async ({ context, args }) => {
|
|
|
78430
78678
|
const most = flagText({ args, name: "most" });
|
|
78431
78679
|
if (!subject || !most) {
|
|
78432
78680
|
throw new CliUsageError(
|
|
78433
|
-
"Usage: laze vault set-limit <subject> --most
|
|
78681
|
+
"Usage: laze vault set-limit <subject> --most auto|always-ask|human-only|none [--max-lease 1h|none]"
|
|
78434
78682
|
);
|
|
78435
78683
|
}
|
|
78684
|
+
const level = most === "none" ? null : vaultLevelOfCliName(most);
|
|
78685
|
+
if (level === "unknown" || level === "auto") {
|
|
78686
|
+
throw new CliUsageError("--most is one of auto, always-ask, human-only or none.");
|
|
78687
|
+
}
|
|
78436
78688
|
const lease = flagText({ args, name: "max-lease" });
|
|
78437
78689
|
const blocked = yesNoOf({ args, name: "blocked" });
|
|
78438
78690
|
const approveNew = yesNoOf({ args, name: "approve-new" });
|
|
78439
78691
|
const { client } = await signedIn({ context, args });
|
|
78440
78692
|
const limits = await client.post("/api/vault/limits", {
|
|
78441
78693
|
subject,
|
|
78442
|
-
most:
|
|
78694
|
+
most: level,
|
|
78443
78695
|
...lease && { maxLeaseSeconds: lease === "none" ? null : secondsOf(lease) },
|
|
78444
78696
|
...blocked !== void 0 && { blocked },
|
|
78445
78697
|
...approveNew !== void 0 && { approveNew }
|
|
78446
78698
|
});
|
|
78447
|
-
if (args.flags.json) return
|
|
78699
|
+
if (args.flags.json) return printJson4({ context, data: limits });
|
|
78448
78700
|
printLimits({ context, limits });
|
|
78449
78701
|
};
|
|
78450
78702
|
function readOf(args) {
|
|
@@ -78466,12 +78718,12 @@ var listAudit = async ({ context, args }) => {
|
|
|
78466
78718
|
const { client } = await signedIn({ context, args });
|
|
78467
78719
|
if (args.words[1] === "activity") {
|
|
78468
78720
|
const entries = await client.post("/api/vault/activity", readOf(args));
|
|
78469
|
-
if (args.flags.json) return
|
|
78721
|
+
if (args.flags.json) return printJson4({ context, data: entries });
|
|
78470
78722
|
for (const entry of entries) printEntry({ context, entry });
|
|
78471
78723
|
return;
|
|
78472
78724
|
}
|
|
78473
78725
|
const page = await client.post("/api/vault/audit", readOf(args));
|
|
78474
|
-
if (args.flags.json) return
|
|
78726
|
+
if (args.flags.json) return printJson4({ context, data: page });
|
|
78475
78727
|
for (const entry of page.entries) printEntry({ context, entry });
|
|
78476
78728
|
const chain = page.chain.intact ? "intact" : `broken at ${page.chain.brokenAtSeq}`;
|
|
78477
78729
|
context.out(`Chain ${chain}.${page.nextCursor ? ` Older: --before ${page.nextCursor}` : ""}
|
|
@@ -78483,7 +78735,7 @@ var mostAsked = async ({ context, args }) => {
|
|
|
78483
78735
|
const answer4 = await client.post("/api/vault/most-asked", {
|
|
78484
78736
|
...days && { days: Number(days) }
|
|
78485
78737
|
});
|
|
78486
|
-
if (args.flags.json) return
|
|
78738
|
+
if (args.flags.json) return printJson4({ context, data: answer4 });
|
|
78487
78739
|
for (const row of answer4.connections) {
|
|
78488
78740
|
context.out(
|
|
78489
78741
|
`${row.connectionId} ${row.cards} cards ${row.asks} asks ${row.denied} denied
|
|
@@ -78497,7 +78749,7 @@ var listApprovals = async ({ context, args }) => {
|
|
|
78497
78749
|
const cards = await client.post("/api/vault/approvals", {
|
|
78498
78750
|
...state && { state }
|
|
78499
78751
|
});
|
|
78500
|
-
if (args.flags.json) return
|
|
78752
|
+
if (args.flags.json) return printJson4({ context, data: cards });
|
|
78501
78753
|
if (cards.length === 0) return context.out("No approval cards.\n");
|
|
78502
78754
|
for (const card2 of cards) {
|
|
78503
78755
|
context.out(`${card2.id} ${card2.state} ${card2.action} ${card2.agentId} ${card2.reason}
|
|
@@ -78508,7 +78760,7 @@ var listApprovals = async ({ context, args }) => {
|
|
|
78508
78760
|
var judgeStatus = async ({ context, args }) => {
|
|
78509
78761
|
const { client } = await signedIn({ context, args });
|
|
78510
78762
|
const status8 = await client.get("/api/vault/judge");
|
|
78511
|
-
if (args.flags.json) return
|
|
78763
|
+
if (args.flags.json) return printJson4({ context, data: status8 });
|
|
78512
78764
|
context.out(
|
|
78513
78765
|
status8.configured ? "The judge is set up: Checked uses are decided by it.\n" : "No judge is set up: every Checked use asks a person.\n"
|
|
78514
78766
|
);
|
|
@@ -78516,8 +78768,9 @@ var judgeStatus = async ({ context, args }) => {
|
|
|
78516
78768
|
var listDevices = async ({ context, args }) => {
|
|
78517
78769
|
const { client } = await signedIn({ context, args });
|
|
78518
78770
|
const devices = await client.get("/api/vault/devices");
|
|
78519
|
-
if (args.flags.json) return
|
|
78520
|
-
if (devices.length === 0)
|
|
78771
|
+
if (args.flags.json) return printJson4({ context, data: devices });
|
|
78772
|
+
if (devices.length === 0)
|
|
78773
|
+
return context.out("No devices. Enrol one in Laze, under Settings, Vault, Passkeys.\n");
|
|
78521
78774
|
for (const device of devices) {
|
|
78522
78775
|
context.out(
|
|
78523
78776
|
`${device.id} ${device.label} ${device.kind} ${device.state} ${device.fingerprint}
|
|
@@ -78530,39 +78783,43 @@ var listDevices = async ({ context, args }) => {
|
|
|
78530
78783
|
var VAULT_USAGE = `Usage (your own key; an agent's key is refused, values are never printed):
|
|
78531
78784
|
laze vault list [--json] connections you manage or see: names, fields, levels
|
|
78532
78785
|
laze vault add <name> --label <text> [--keychain personal|workspace|agent:<id>]
|
|
78533
|
-
[--level auto|
|
|
78534
|
-
[--
|
|
78786
|
+
[--level allow|auto|always-ask|human-only] [--rules <text>] [--approver <userId>]...
|
|
78787
|
+
[--lease 15m|1h|8h|1d|2d] [--every-use-asks] [--field <FIELD>] [--from-file <path>]
|
|
78788
|
+
levels as the page names them: allow (agents use it), auto (the automatic check reads
|
|
78789
|
+
each use against --rules), always-ask (a person approves), human-only (agents never do)
|
|
78790
|
+
--lease (or --max-lease) is how long an approval lasts for the agent, 2 days by default
|
|
78535
78791
|
the value comes from stdin or --from-file, never a flag: KEY=value lines, one value
|
|
78536
78792
|
with --field, or a JSON secret bundle ({"kind":"api_key_set","fields":{...}})
|
|
78537
|
-
laze vault update <connection> [--label] [--level] [--rules] [--approver]... [--
|
|
78793
|
+
laze vault update <connection> [--label] [--level] [--rules] [--approver]... [--lease 1h|none]
|
|
78538
78794
|
[--every-use-asks yes|no]
|
|
78539
78795
|
laze vault replace <connection> [--field <FIELD>] [--from-file <path>] a new value, from stdin
|
|
78540
78796
|
laze vault compare <name> [--field <FIELD>] [--from-file <path>] is this value already held
|
|
78541
78797
|
laze vault rm|revoke <connection> delete it; revoke also takes it back at the provider
|
|
78542
|
-
laze vault uses <connection> [--limit <n>] who used it
|
|
78798
|
+
laze vault uses <connection> [--limit <n>] who used it, how, where, under which approval
|
|
78543
78799
|
laze vault grant <connection> --to person|group|channel|agent:<id> [--for 1h]
|
|
78544
78800
|
laze vault lend <connection> --channel <channelId> [--for 1h]
|
|
78545
78801
|
laze vault grants <connection> | laze vault ungrant <grantId>
|
|
78546
78802
|
laze vault leases | laze vault end-lease <leaseId>
|
|
78547
|
-
laze vault limits | laze vault set-limit <subject> [--most
|
|
78803
|
+
laze vault limits | laze vault set-limit <subject> [--most auto|always-ask|human-only|none]
|
|
78548
78804
|
[--max-lease 1h|none] [--blocked yes|no] [--approve-new yes|no] (admins)
|
|
78549
78805
|
laze vault audit|activity [--connection <c>] [--limit <n>] [--before <seq>] (audit: admins)
|
|
78550
78806
|
laze vault most-asked [--days <n>] (admins)
|
|
78551
78807
|
laze vault approvals [--state pending] cards you answer; answer them in Laze
|
|
78552
78808
|
laze vault judge | laze vault devices`;
|
|
78553
|
-
var LEVELS5 = ["auto", "checked", "ask", "human_only"];
|
|
78554
78809
|
function levelOf(args) {
|
|
78555
78810
|
const level = flagText({ args, name: "level" });
|
|
78556
78811
|
if (!level) return void 0;
|
|
78557
|
-
const known =
|
|
78558
|
-
if (
|
|
78812
|
+
const known = vaultLevelOfCliName(level);
|
|
78813
|
+
if (known === "unknown") {
|
|
78814
|
+
throw new CliUsageError(`--level is one of ${VAULT_CLI_LEVEL_NAMES.join(", ")}.`);
|
|
78815
|
+
}
|
|
78559
78816
|
return known;
|
|
78560
78817
|
}
|
|
78561
78818
|
function printConnection({ context, row }) {
|
|
78562
78819
|
const waiting = row.waitingApproval ? " (waiting for an admin)" : "";
|
|
78563
78820
|
const status8 = row.status === "active" ? "" : ` ${row.status}`;
|
|
78564
78821
|
context.out(
|
|
78565
|
-
`${row.id} ${row.name} ${row.label} ${keychainLabel(row.keychain)} ${row.sensitivity} ${row.fieldNames.join(",")}${status8}${waiting}
|
|
78822
|
+
`${row.id} ${row.name} ${row.label} ${keychainLabel(row.keychain)} ${vaultCliLevelOf(row.sensitivity)} ${row.fieldNames.join(",")}${status8}${waiting}
|
|
78566
78823
|
`
|
|
78567
78824
|
);
|
|
78568
78825
|
}
|
|
@@ -78588,7 +78845,7 @@ async function keychainOf2({ client, args }) {
|
|
|
78588
78845
|
return { kind: "personal", ownerUserId: me.id };
|
|
78589
78846
|
}
|
|
78590
78847
|
function settingsOf(args) {
|
|
78591
|
-
const lease = flagText({ args, name: "max-lease" });
|
|
78848
|
+
const lease = flagText({ args, name: "lease" }) || flagText({ args, name: "max-lease" });
|
|
78592
78849
|
const approvers = args.lists.approver;
|
|
78593
78850
|
const everyUseAsks = yesNoOf({ args, name: "every-use-asks" });
|
|
78594
78851
|
const label2 = flagText({ args, name: "label" });
|
|
@@ -78605,11 +78862,11 @@ function settingsOf(args) {
|
|
|
78605
78862
|
var list3 = async ({ context, args }) => {
|
|
78606
78863
|
const { client } = await signedIn({ context, args });
|
|
78607
78864
|
const rows = await client.get("/api/vault/connections");
|
|
78608
|
-
if (args.flags.json) return
|
|
78865
|
+
if (args.flags.json) return printJson4({ context, data: rows });
|
|
78609
78866
|
if (rows.length === 0) return context.out("No connections yet. Add one with laze vault add.\n");
|
|
78610
78867
|
for (const row of rows) printConnection({ context, row });
|
|
78611
78868
|
};
|
|
78612
|
-
var
|
|
78869
|
+
var add3 = async ({ context, args }) => {
|
|
78613
78870
|
const name2 = args.words[2];
|
|
78614
78871
|
const label2 = flagText({ args, name: "label" });
|
|
78615
78872
|
if (!name2 || !label2) throw new CliUsageError(VAULT_USAGE);
|
|
@@ -78625,9 +78882,11 @@ var add2 = async ({ context, args }) => {
|
|
|
78625
78882
|
...settingsOf(args),
|
|
78626
78883
|
secret
|
|
78627
78884
|
});
|
|
78628
|
-
if (args.flags.json) return
|
|
78629
|
-
context.out(
|
|
78630
|
-
`)
|
|
78885
|
+
if (args.flags.json) return printJson4({ context, data: created });
|
|
78886
|
+
context.out(
|
|
78887
|
+
`Added ${created.name} (${created.id}) at ${vaultLevelLabel(created.sensitivity)}.
|
|
78888
|
+
`
|
|
78889
|
+
);
|
|
78631
78890
|
};
|
|
78632
78891
|
var update = async ({ context, args }) => {
|
|
78633
78892
|
const { client } = await signedIn({ context, args });
|
|
@@ -78638,7 +78897,7 @@ var update = async ({ context, args }) => {
|
|
|
78638
78897
|
connectionId: target.id,
|
|
78639
78898
|
...settings2
|
|
78640
78899
|
});
|
|
78641
|
-
if (args.flags.json) return
|
|
78900
|
+
if (args.flags.json) return printJson4({ context, data: updated });
|
|
78642
78901
|
printConnection({ context, row: updated });
|
|
78643
78902
|
};
|
|
78644
78903
|
var replace = async ({ context, args }) => {
|
|
@@ -78651,7 +78910,7 @@ var replace = async ({ context, args }) => {
|
|
|
78651
78910
|
...field && { field },
|
|
78652
78911
|
value
|
|
78653
78912
|
});
|
|
78654
|
-
if (args.flags.json) return
|
|
78913
|
+
if (args.flags.json) return printJson4({ context, data: updated });
|
|
78655
78914
|
context.out(`Replaced the value of ${updated.name}.
|
|
78656
78915
|
`);
|
|
78657
78916
|
};
|
|
@@ -78666,7 +78925,7 @@ var compare = async ({ context, args }) => {
|
|
|
78666
78925
|
...field && { field },
|
|
78667
78926
|
value
|
|
78668
78927
|
});
|
|
78669
|
-
if (args.flags.json) return
|
|
78928
|
+
if (args.flags.json) return printJson4({ context, data: answer4 });
|
|
78670
78929
|
const said = {
|
|
78671
78930
|
absent: `You hold no connection named ${name2}.`,
|
|
78672
78931
|
same: `${name2} already holds this value.`,
|
|
@@ -78683,12 +78942,17 @@ function removal(path) {
|
|
|
78683
78942
|
`/api/vault/connections/${path}`,
|
|
78684
78943
|
{ connectionId: target.id }
|
|
78685
78944
|
);
|
|
78686
|
-
if (args.flags.json) return
|
|
78945
|
+
if (args.flags.json) return printJson4({ context, data: answer4 });
|
|
78687
78946
|
const provider = "atProvider" in answer4 ? ` (at the provider: ${answer4.atProvider})` : "";
|
|
78688
78947
|
context.out(`Deleted ${target.name}${provider}.
|
|
78689
78948
|
`);
|
|
78690
78949
|
};
|
|
78691
78950
|
}
|
|
78951
|
+
function usedBy(row) {
|
|
78952
|
+
if (row.actorKind === "user") return `person ${row.actorId ?? ""}`;
|
|
78953
|
+
if (row.agentId) return `agent ${row.agentId}`;
|
|
78954
|
+
return "laze";
|
|
78955
|
+
}
|
|
78692
78956
|
var uses = async ({ context, args }) => {
|
|
78693
78957
|
const { client } = await signedIn({ context, args });
|
|
78694
78958
|
const target = await connectionOf({ client, args, word: args.words[2] });
|
|
@@ -78697,18 +78961,22 @@ var uses = async ({ context, args }) => {
|
|
|
78697
78961
|
connectionId: target.id,
|
|
78698
78962
|
...limit && { limit: Number(limit) }
|
|
78699
78963
|
});
|
|
78700
|
-
if (args.flags.json) return
|
|
78964
|
+
if (args.flags.json) return printJson4({ context, data: rows });
|
|
78701
78965
|
if (rows.length === 0) return context.out(`No one used ${target.name} yet.
|
|
78702
78966
|
`);
|
|
78703
78967
|
for (const row of rows) {
|
|
78704
|
-
const who = row
|
|
78705
|
-
|
|
78706
|
-
|
|
78968
|
+
const who = usedBy(row);
|
|
78969
|
+
const where = row.origin ?? row.via ?? "-";
|
|
78970
|
+
const approval = row.requestId ?? "-";
|
|
78971
|
+
context.out(
|
|
78972
|
+
`${row.at} ${row.action} ${row.outcome} ${who} ${where} ${approval} ${row.reason ?? ""}
|
|
78973
|
+
`
|
|
78974
|
+
);
|
|
78707
78975
|
}
|
|
78708
78976
|
};
|
|
78709
78977
|
var VAULT_COMMANDS = {
|
|
78710
78978
|
list: list3,
|
|
78711
|
-
add:
|
|
78979
|
+
add: add3,
|
|
78712
78980
|
update,
|
|
78713
78981
|
replace,
|
|
78714
78982
|
compare,
|
|
@@ -78748,6 +79016,7 @@ var CONNECTOR_USAGE = `Usage (a person's key; an agent runs laze connect suggest
|
|
|
78748
79016
|
[--level <level>] [--again <connectionId>] a server with no key, or with its own sign-in
|
|
78749
79017
|
laze connect mcp refresh <connectionId> read its tools again
|
|
78750
79018
|
laze connect mcp tool-level <connectionId> <tool> <level|default>
|
|
79019
|
+
levels: allow, auto (the automatic check), always-ask, human-only
|
|
78751
79020
|
laze connect mcp-key <https url> --name <name> --label <label> [--header Authorization]
|
|
78752
79021
|
[--prefix "Bearer "] [--keychain ...] [--level <level>] the key from stdin or --from-file
|
|
78753
79022
|
laze connect github the GitHub App and its installations
|
|
@@ -78767,7 +79036,7 @@ function wordAt2(args, index) {
|
|
|
78767
79036
|
}
|
|
78768
79037
|
var KEY_FLAGS = ["key", "value", "token"];
|
|
78769
79038
|
async function keyText({ context, args }) {
|
|
78770
|
-
if (KEY_FLAGS.some((
|
|
79039
|
+
if (KEY_FLAGS.some((flag2) => args.flags[flag2] !== void 0)) {
|
|
78771
79040
|
throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
|
|
78772
79041
|
}
|
|
78773
79042
|
const file3 = flagText({ args, name: "from-file" });
|
|
@@ -78793,8 +79062,10 @@ var providers = async ({ context, args, client }) => {
|
|
|
78793
79062
|
if (json2({ context, args, data: rows })) return;
|
|
78794
79063
|
for (const row of rows) {
|
|
78795
79064
|
const ready = row.configured ? "" : " not set up here";
|
|
78796
|
-
context.out(
|
|
78797
|
-
|
|
79065
|
+
context.out(
|
|
79066
|
+
`${row.id} ${row.label} ${row.category} ${vaultCliLevelOf(row.sensitivity)}${ready}
|
|
79067
|
+
`
|
|
79068
|
+
);
|
|
78798
79069
|
}
|
|
78799
79070
|
};
|
|
78800
79071
|
var start = async ({ context, args, client }) => {
|
|
@@ -78883,10 +79154,14 @@ var mcpRefresh = async ({ context, args, client }) => {
|
|
|
78883
79154
|
};
|
|
78884
79155
|
var mcpToolLevel = async ({ context, args, client }) => {
|
|
78885
79156
|
const level = wordAt2(args, 5);
|
|
79157
|
+
const sensitivity = level === "default" ? null : vaultLevelOfCliName(level);
|
|
79158
|
+
if (sensitivity === "unknown") {
|
|
79159
|
+
throw new CliUsageError(`The level is one of ${VAULT_CLI_LEVEL_NAMES.join(", ")} or default.`);
|
|
79160
|
+
}
|
|
78886
79161
|
const server = await client.post(CONNECTOR_KEY_PATHS.mcpToolLevel, {
|
|
78887
79162
|
connectionId: wordAt2(args, 3),
|
|
78888
79163
|
tool: wordAt2(args, 4),
|
|
78889
|
-
sensitivity
|
|
79164
|
+
sensitivity
|
|
78890
79165
|
});
|
|
78891
79166
|
if (json2({ context, args, data: server })) return;
|
|
78892
79167
|
context.out(`${args.words[4]} is now ${level}.
|
|
@@ -79154,17 +79429,17 @@ async function dnd({ context, args }) {
|
|
|
79154
79429
|
var DOMAINS_USAGE = `Usage:
|
|
79155
79430
|
laze domains list proven domains, with auto-join (admins)
|
|
79156
79431
|
laze domains auto-join <domain> on|off people on the domain join without asking`;
|
|
79157
|
-
var
|
|
79432
|
+
var printJson5 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
|
|
79158
79433
|
`);
|
|
79159
79434
|
function printDomain(context, row) {
|
|
79160
|
-
const
|
|
79161
|
-
context.out(`${row.domain} ${
|
|
79435
|
+
const join22 = row.autoJoin ? "auto-join on" : "auto-join off";
|
|
79436
|
+
context.out(`${row.domain} ${join22}${row.enforced ? " single sign-on enforced" : ""}
|
|
79162
79437
|
`);
|
|
79163
79438
|
}
|
|
79164
79439
|
async function list4({ context, args }) {
|
|
79165
79440
|
const { client } = await signedIn({ context, args });
|
|
79166
79441
|
const rows = await client.get("/api/join-domains");
|
|
79167
|
-
if (args.flags.json) return
|
|
79442
|
+
if (args.flags.json) return printJson5(context, rows);
|
|
79168
79443
|
if (rows.length === 0) {
|
|
79169
79444
|
return context.out("No proven domains yet. laze sso claim <domain> starts proving one.\n");
|
|
79170
79445
|
}
|
|
@@ -79178,7 +79453,7 @@ async function autoJoin({ context, args }) {
|
|
|
79178
79453
|
domain: domain2,
|
|
79179
79454
|
autoJoin: state === "on"
|
|
79180
79455
|
});
|
|
79181
|
-
if (args.flags.json) return
|
|
79456
|
+
if (args.flags.json) return printJson5(context, row);
|
|
79182
79457
|
printDomain(context, row);
|
|
79183
79458
|
}
|
|
79184
79459
|
var DOMAIN_COMMANDS = { list: list4, "auto-join": autoJoin };
|
|
@@ -79245,10 +79520,10 @@ var FEED_WRITING = `Write for a person deciding on a phone in a few seconds:
|
|
|
79245
79520
|
The server pushes back with feed_hard_to_read when the text reads like a log;
|
|
79246
79521
|
rewrite it, or pass --force to post it as written.`;
|
|
79247
79522
|
var FEED_NO_BODY = "feed cards have no body: put the point in the title and one --summary line, text to send in --draft, sources in --link";
|
|
79248
|
-
function pairOf({ value, flag }) {
|
|
79523
|
+
function pairOf({ value, flag: flag2 }) {
|
|
79249
79524
|
const at = value.indexOf("=");
|
|
79250
79525
|
if (at <= 0 || at === value.length - 1) {
|
|
79251
|
-
throw new Error(`--${
|
|
79526
|
+
throw new Error(`--${flag2} takes <label>=<value>, got "${value}"`);
|
|
79252
79527
|
}
|
|
79253
79528
|
return [value.slice(0, at), value.slice(at + 1)];
|
|
79254
79529
|
}
|
|
@@ -79267,8 +79542,8 @@ function snoozeOf(args) {
|
|
|
79267
79542
|
}
|
|
79268
79543
|
function textsOf(args) {
|
|
79269
79544
|
const texts = {};
|
|
79270
|
-
for (const [
|
|
79271
|
-
const value = flagText({ args, name:
|
|
79545
|
+
for (const [flag2, field] of Object.entries(TEXT_FLAGS)) {
|
|
79546
|
+
const value = flagText({ args, name: flag2 });
|
|
79272
79547
|
if (value) texts[field] = sourceOf(value);
|
|
79273
79548
|
}
|
|
79274
79549
|
return texts;
|
|
@@ -79300,7 +79575,7 @@ function feedFlagsOf({ args }) {
|
|
|
79300
79575
|
if (header) fields.draftHeader = header.replaceAll("\\n", "\n");
|
|
79301
79576
|
const doneLabel = flagText({ args, name: "done-label" });
|
|
79302
79577
|
if (doneLabel) fields.doneLabel = doneLabel;
|
|
79303
|
-
for (const
|
|
79578
|
+
for (const flag2 of ["urgent", "force"]) if (args.flags[flag2]) fields[flag2] = true;
|
|
79304
79579
|
const showAt = flagText({ args, name: "show-at" });
|
|
79305
79580
|
if (showAt) fields.showAt = dateOf(showAt);
|
|
79306
79581
|
const group = flagText({ args, name: "group" });
|
|
@@ -79782,6 +80057,7 @@ var feedFileLinkSchema = feedFileLinkSchemaDefinition;
|
|
|
79782
80057
|
var feedTrpc = defineTrpcContract("feed").query("channelItems").withInput(external_exports.object({ workspaceId: external_exports.string().min(1), channelId: external_exports.string().min(1) })).withOutput(external_exports.array(feedAgentItemSchema)).query("list").withInput(listFeedInputSchema).withOutput(feedViewSchema).query("card").withInput(itemRef).withOutput(feedCardViewSchema).query("fileLink").withInput(feedFileLinkInputSchema).withOutput(feedFileLinkSchema).query("count").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.object({ count: external_exports.number().int().nonnegative() })).mutation("act").withInput(actFeedItemInputSchema).withOutput(feedItemSchema).mutation("comment").withInput(commentFeedItemInputSchema).withOutput(feedItemSchema).mutation("done").withInput(itemRef).withOutput(feedItemSchema).mutation("stopAutoSend").withInput(itemRef).withOutput(feedItemSchema).mutation("putBack").withInput(putBackFeedItemInputSchema).withOutput(feedItemSchema).mutation("snooze").withInput(snoozeFeedItemInputSchema).withOutput(feedItemSchema).mutation("unsnooze").withInput(itemRef).withOutput(feedItemSchema).mutation("saveDraft").withInput(saveFeedDraftInputSchema).withOutput(feedItemSchema).mutation("editItem").withInput(editFeedItemInputSchema).withOutput(feedItemSchema).mutation("saveMessage").withInput(saveFeedMessageInputSchema).withOutput(feedItemSchema).mutation("answerApproval").withInput(answerFeedApprovalInputSchema).withOutput(feedItemSchema).mutation("decidePublish").withInput(decideFeedPublishInputSchema).withOutput(feedItemSchema).mutation("decideAccess").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideServer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAppAccess").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideComputer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAgentJoin").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).build();
|
|
79783
80058
|
var feedUi = uiTokens("feed");
|
|
79784
80059
|
var FeedNavSlot = feedUi.component("nav");
|
|
80060
|
+
var FeedCountHooksToken = feedUi.hooks("count");
|
|
79785
80061
|
var FeedChannelCardSlot = feedUi.component("channel-card");
|
|
79786
80062
|
var FeedSearchSlot = feedUi.component("search");
|
|
79787
80063
|
|
|
@@ -80299,9 +80575,9 @@ async function signedGhArgs({
|
|
|
80299
80575
|
let bodied = false;
|
|
80300
80576
|
for (let index = 0; index < args.length; index += 1) {
|
|
80301
80577
|
const arg = args[index] ?? "";
|
|
80302
|
-
const [
|
|
80303
|
-
const isBody = BODY_FLAGS.has(
|
|
80304
|
-
const isFile = BODY_FILE_FLAGS.has(
|
|
80578
|
+
const [flag2 = "", inline] = arg.startsWith("--") ? arg.split(/=(.*)/s, 2) : [arg];
|
|
80579
|
+
const isBody = BODY_FLAGS.has(flag2);
|
|
80580
|
+
const isFile = BODY_FILE_FLAGS.has(flag2);
|
|
80305
80581
|
if (!isBody && !isFile) {
|
|
80306
80582
|
out.push(arg);
|
|
80307
80583
|
continue;
|
|
@@ -80619,7 +80895,7 @@ var IP_USAGE = `Usage:
|
|
|
80619
80895
|
laze ip domains add|remove <domain>... change them; laze ip domains reset brings the defaults back
|
|
80620
80896
|
laze ip offer [--site <domain>] the plain offer to pass on when a site blocks the shared address
|
|
80621
80897
|
laze ip list who has one, its country and price (Owners and Admins)`;
|
|
80622
|
-
var
|
|
80898
|
+
var printJson6 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
|
|
80623
80899
|
`);
|
|
80624
80900
|
var OFF_REASONS = {
|
|
80625
80901
|
credits: ", turned off because the credits ran out",
|
|
@@ -80651,12 +80927,12 @@ function ipLines(status8) {
|
|
|
80651
80927
|
async function status4({ context, args }) {
|
|
80652
80928
|
const client = await computeClient({ context, args });
|
|
80653
80929
|
const answer4 = await client.get(DEDICATED_IP_REST_PATHS.mine);
|
|
80654
|
-
if (args.flags.json) return
|
|
80930
|
+
if (args.flags.json) return printJson6(context, answer4);
|
|
80655
80931
|
context.out(`${ipLines(answer4).join("\n")}
|
|
80656
80932
|
`);
|
|
80657
80933
|
}
|
|
80658
80934
|
async function printAnswer({ context, args }, answer4) {
|
|
80659
|
-
if (args.flags.json) return
|
|
80935
|
+
if (args.flags.json) return printJson6(context, answer4);
|
|
80660
80936
|
context.out(`${answer4.message}
|
|
80661
80937
|
`);
|
|
80662
80938
|
}
|
|
@@ -80676,7 +80952,7 @@ async function turnOff(run4) {
|
|
|
80676
80952
|
async function countries({ context, args }) {
|
|
80677
80953
|
const client = await computeClient({ context, args });
|
|
80678
80954
|
const answer4 = await client.get(DEDICATED_IP_REST_PATHS.countries);
|
|
80679
|
-
if (args.flags.json) return
|
|
80955
|
+
if (args.flags.json) return printJson6(context, answer4);
|
|
80680
80956
|
const lines = answer4.countries.map((one) => ` ${one.code} ${one.name}`);
|
|
80681
80957
|
context.out(`Countries on sale:
|
|
80682
80958
|
${lines.join("\n")}
|
|
@@ -80697,7 +80973,7 @@ async function domains2(run4) {
|
|
|
80697
80973
|
if (!action) {
|
|
80698
80974
|
const client2 = await computeClient(run4);
|
|
80699
80975
|
const answer4 = await client2.get(DEDICATED_IP_REST_PATHS.mine);
|
|
80700
|
-
if (run4.args.flags.json) return
|
|
80976
|
+
if (run4.args.flags.json) return printJson6(run4.context, answer4.domains);
|
|
80701
80977
|
return run4.context.out(`${answer4.domains.join("\n")}
|
|
80702
80978
|
`);
|
|
80703
80979
|
}
|
|
@@ -80716,14 +80992,14 @@ async function offer({ context, args }) {
|
|
|
80716
80992
|
DEDICATED_IP_REST_PATHS.offer,
|
|
80717
80993
|
site ? { site } : {}
|
|
80718
80994
|
);
|
|
80719
|
-
if (args.flags.json) return
|
|
80995
|
+
if (args.flags.json) return printJson6(context, answer4);
|
|
80720
80996
|
context.out(`${answer4.message}
|
|
80721
80997
|
`);
|
|
80722
80998
|
}
|
|
80723
80999
|
async function list5({ context, args }) {
|
|
80724
81000
|
const client = await computeClient({ context, args });
|
|
80725
81001
|
const answer4 = await client.get(DEDICATED_IP_REST_PATHS.all);
|
|
80726
|
-
if (args.flags.json) return
|
|
81002
|
+
if (args.flags.json) return printJson6(context, answer4);
|
|
80727
81003
|
if (answer4.ips.length === 0) return context.out("No one has a dedicated IP.\n");
|
|
80728
81004
|
const money2 = (amount) => `${amount} ${answer4.currency.toUpperCase()}`;
|
|
80729
81005
|
const lines = answer4.ips.map(
|
|
@@ -80903,13 +81179,13 @@ var KEYS_USAGE = `Usage:
|
|
|
80903
81179
|
printed once, or with --to-vault saved to your personal keychain and never printed
|
|
80904
81180
|
laze keys revoke <id> revoke one of your own keys
|
|
80905
81181
|
laze keys revoke <id> --any revoke any key of the workspace (admins)`;
|
|
80906
|
-
var
|
|
81182
|
+
var printJson7 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
|
|
80907
81183
|
`);
|
|
80908
81184
|
var lastUsed = (at) => at ? `last used ${at}` : "never used";
|
|
80909
|
-
async function
|
|
81185
|
+
async function mine2({ context, args }) {
|
|
80910
81186
|
const { client } = await signedIn({ context, args });
|
|
80911
81187
|
const keys2 = await client.get("/api/api-keys/mine");
|
|
80912
|
-
if (args.flags.json) return
|
|
81188
|
+
if (args.flags.json) return printJson7(context, keys2);
|
|
80913
81189
|
if (keys2.length === 0)
|
|
80914
81190
|
return context.out("No keys yet. laze login or laze keys create make one.\n");
|
|
80915
81191
|
for (const key of keys2) {
|
|
@@ -80923,7 +81199,7 @@ async function mine({ context, args }) {
|
|
|
80923
81199
|
async function list6({ context, args }) {
|
|
80924
81200
|
const { client } = await signedIn({ context, args });
|
|
80925
81201
|
const keys2 = await client.get("/api/api-keys");
|
|
80926
|
-
if (args.flags.json) return
|
|
81202
|
+
if (args.flags.json) return printJson7(context, keys2);
|
|
80927
81203
|
if (keys2.length === 0) return context.out("The workspace has no live keys.\n");
|
|
80928
81204
|
for (const key of keys2) {
|
|
80929
81205
|
const held = `${key.permissions.length} permissions`;
|
|
@@ -80965,13 +81241,13 @@ async function create({ context, args }) {
|
|
|
80965
81241
|
const created = await client.post("/api/api-keys", { name: name2, permissions });
|
|
80966
81242
|
if (connection) {
|
|
80967
81243
|
await keepInVault({ client, created, connection });
|
|
80968
|
-
if (args.flags.json) return
|
|
81244
|
+
if (args.flags.json) return printJson7(context, { key: created.key, vault: connection });
|
|
80969
81245
|
return context.out(
|
|
80970
81246
|
`Created ${created.key.name} (${created.key.id}), kept in your vault as ${connection}.
|
|
80971
81247
|
`
|
|
80972
81248
|
);
|
|
80973
81249
|
}
|
|
80974
|
-
if (args.flags.json) return
|
|
81250
|
+
if (args.flags.json) return printJson7(context, created);
|
|
80975
81251
|
context.out(`Created ${created.key.name} (${created.key.id}). Its token, shown once:
|
|
80976
81252
|
`);
|
|
80977
81253
|
context.out(`${created.token}
|
|
@@ -80983,11 +81259,11 @@ async function revoke({ context, args }) {
|
|
|
80983
81259
|
const { client } = await signedIn({ context, args });
|
|
80984
81260
|
const path = args.flags.any ? "/api/api-keys/revoke" : "/api/api-keys/mine/revoke";
|
|
80985
81261
|
await client.post(path, { apiKeyId });
|
|
80986
|
-
if (args.flags.json) return
|
|
81262
|
+
if (args.flags.json) return printJson7(context, { revoked: true, apiKeyId });
|
|
80987
81263
|
context.out(`Revoked ${apiKeyId}.
|
|
80988
81264
|
`);
|
|
80989
81265
|
}
|
|
80990
|
-
var KEY_COMMANDS = { mine, list: list6, create, revoke };
|
|
81266
|
+
var KEY_COMMANDS = { mine: mine2, list: list6, create, revoke };
|
|
80991
81267
|
async function keys({ context, args }) {
|
|
80992
81268
|
const name2 = args.words[1] ?? "mine";
|
|
80993
81269
|
const command = Object.hasOwn(KEY_COMMANDS, name2) ? KEY_COMMANDS[name2] : void 0;
|
|
@@ -81340,7 +81616,7 @@ var USAGE11 = [
|
|
|
81340
81616
|
' laze machine exec <machine> --vault <connection> [--vault <other>] --reason "<why>" -- <command>',
|
|
81341
81617
|
" the same, with vault connections in its environment",
|
|
81342
81618
|
" laze machine host <machine> <agent> [--when-offline wait|computer] run your personal agent there (people)",
|
|
81343
|
-
" laze machine unhost <agent> run the agent on your computer again (people)",
|
|
81619
|
+
" laze machine unhost <agent> run the agent on your agent computer again (people)",
|
|
81344
81620
|
" laze machine remove <machine> cut the machine off and forget it (people)",
|
|
81345
81621
|
MACHINE_ACCESS_USAGE
|
|
81346
81622
|
].join("\n");
|
|
@@ -81546,7 +81822,7 @@ ${USAGE11}`);
|
|
|
81546
81822
|
});
|
|
81547
81823
|
if (args.flags.json) return context.out(`${JSON.stringify(machine2, null, 2)}
|
|
81548
81824
|
`);
|
|
81549
|
-
const offline = whenOffline === "wait" ? `${agent2} waits` : `${agent2} answers from your computer`;
|
|
81825
|
+
const offline = whenOffline === "wait" ? `${agent2} waits` : `${agent2} answers from your agent computer`;
|
|
81550
81826
|
context.out(
|
|
81551
81827
|
`${agent2} now runs on ${machine2.name}. While ${machine2.name} is offline, ${offline}.
|
|
81552
81828
|
`
|
|
@@ -81559,10 +81835,10 @@ async function unhost({ context, args }) {
|
|
|
81559
81835
|
const done = await client.post(COMPUTE_REST_PATHS.unhost, { agent: agent2 });
|
|
81560
81836
|
if (args.flags.json) return context.out(`${JSON.stringify(done, null, 2)}
|
|
81561
81837
|
`);
|
|
81562
|
-
context.out(`${agent2} runs on your computer again.
|
|
81838
|
+
context.out(`${agent2} runs on your agent computer again.
|
|
81563
81839
|
`);
|
|
81564
81840
|
}
|
|
81565
|
-
async function
|
|
81841
|
+
async function remove4({ context, args }) {
|
|
81566
81842
|
const client = await computeClient({ context, args });
|
|
81567
81843
|
const machine2 = await client.post(COMPUTE_REST_PATHS.remove, {
|
|
81568
81844
|
machine: machineArg2({ args })
|
|
@@ -81585,7 +81861,7 @@ async function machine({ context, args }) {
|
|
|
81585
81861
|
if (command === "list" || command === "ls") return list7({ context, args });
|
|
81586
81862
|
if (command === "health") return health({ context, args });
|
|
81587
81863
|
if (command === "exec") return exec({ context, args });
|
|
81588
|
-
if (command === "remove") return
|
|
81864
|
+
if (command === "remove") return remove4({ context, args });
|
|
81589
81865
|
if (command === "trust-host-key") return trustHostKey({ context, args });
|
|
81590
81866
|
if (command === "host") return host({ context, args });
|
|
81591
81867
|
if (command === "unhost") return unhost({ context, args });
|
|
@@ -81675,7 +81951,7 @@ function secretRefusal({
|
|
|
81675
81951
|
const rule = command === void 0 ? void 0 : rules[command];
|
|
81676
81952
|
if (!command || !rule) return void 0;
|
|
81677
81953
|
const vaultFlag = rule.vaultFlag ?? "from-vault";
|
|
81678
|
-
const raw = (rule.secretFlags ?? []).find((
|
|
81954
|
+
const raw = (rule.secretFlags ?? []).find((flag2) => flag2 in flags2);
|
|
81679
81955
|
if (raw)
|
|
81680
81956
|
return `laze ${command} takes no --${raw} over MCP; name a vault connection with --${vaultFlag}.`;
|
|
81681
81957
|
if (rule.vaultFlag && typeof flags2[rule.vaultFlag] === "string") return void 0;
|
|
@@ -82498,6 +82774,10 @@ ${OPS_USAGE}`);
|
|
|
82498
82774
|
`);
|
|
82499
82775
|
}
|
|
82500
82776
|
|
|
82777
|
+
// src/services/release-watch.service.ts
|
|
82778
|
+
import { mkdir as mkdir20, readFile as readFile30, realpath, writeFile as writeFile21 } from "node:fs/promises";
|
|
82779
|
+
import { dirname as dirname19, join as join20 } from "node:path";
|
|
82780
|
+
|
|
82501
82781
|
// src/rules/cli-update.rules.ts
|
|
82502
82782
|
var CLI_PACKAGE_LATEST = "@lazehq/cli@latest";
|
|
82503
82783
|
var MANAGERS = [
|
|
@@ -82537,10 +82817,10 @@ function releaseAgeRetryOf({
|
|
|
82537
82817
|
var CLI_RELEASE_HEADER = "x-laze-cli-release";
|
|
82538
82818
|
var STAMP = /^(\d+)\.(\d+)\.(\d+)(?:-g([0-9a-f]+))?$/;
|
|
82539
82819
|
function releaseSkewOf({
|
|
82540
|
-
mine:
|
|
82820
|
+
mine: mine4,
|
|
82541
82821
|
server
|
|
82542
82822
|
}) {
|
|
82543
|
-
const have = STAMP.exec(
|
|
82823
|
+
const have = STAMP.exec(mine4);
|
|
82544
82824
|
const ships = STAMP.exec(server);
|
|
82545
82825
|
if (!have || !ships) return null;
|
|
82546
82826
|
for (const part of [1, 2, 3]) {
|
|
@@ -82550,32 +82830,69 @@ function releaseSkewOf({
|
|
|
82550
82830
|
return have[4] && ships[4] && have[4] !== ships[4] ? "other_build" : null;
|
|
82551
82831
|
}
|
|
82552
82832
|
function releaseWarningOf({
|
|
82553
|
-
mine:
|
|
82833
|
+
mine: mine4,
|
|
82554
82834
|
server,
|
|
82555
82835
|
sandbox
|
|
82556
82836
|
}) {
|
|
82557
|
-
const skew = releaseSkewOf({ mine:
|
|
82837
|
+
const skew = releaseSkewOf({ mine: mine4, server });
|
|
82558
82838
|
if (!skew) return null;
|
|
82559
82839
|
if (sandbox) {
|
|
82560
|
-
return `laze: this CLI is ${
|
|
82840
|
+
return `laze: this CLI is ${mine4}, but the server ships ${server}. Laze updates the computer's CLI each time the agent connects, so restart the agent if this stays.
|
|
82561
82841
|
`;
|
|
82562
82842
|
}
|
|
82563
82843
|
if (skew === "newer") {
|
|
82564
|
-
return `laze: this CLI is ${
|
|
82844
|
+
return `laze: this CLI is ${mine4}, newer than the server's ${server}; a command the server does not have yet fails.
|
|
82565
82845
|
`;
|
|
82566
82846
|
}
|
|
82567
82847
|
const how = `Update it with npm i -g ${CLI_PACKAGE_LATEST} (or laze update).`;
|
|
82568
82848
|
if (skew === "older")
|
|
82569
|
-
return `laze: this CLI is ${
|
|
82849
|
+
return `laze: this CLI is ${mine4}, older than the server's ${server}. ${how}
|
|
82570
82850
|
`;
|
|
82571
|
-
return `laze: this CLI is ${
|
|
82851
|
+
return `laze: this CLI is ${mine4}, a different build from the server's ${server}. ${how}
|
|
82852
|
+
`;
|
|
82853
|
+
}
|
|
82854
|
+
function selfUpdateLineOf({
|
|
82855
|
+
mine: mine4,
|
|
82856
|
+
server,
|
|
82857
|
+
manager
|
|
82858
|
+
}) {
|
|
82859
|
+
return `laze: this CLI is ${mine4}, older than the server's ${server}. Updating it in the background with ${manager}; the next command runs the new one (LAZE_AUTO_UPDATE=0 turns this off).
|
|
82572
82860
|
`;
|
|
82573
82861
|
}
|
|
82574
82862
|
|
|
82575
82863
|
// src/services/release-watch.service.ts
|
|
82864
|
+
var RETRY_AFTER_MS = 6 * 60 * 60 * 1e3;
|
|
82865
|
+
async function scriptOf(context) {
|
|
82866
|
+
const script = context.program.at(-1) ?? "";
|
|
82867
|
+
try {
|
|
82868
|
+
return await realpath(script);
|
|
82869
|
+
} catch {
|
|
82870
|
+
return script;
|
|
82871
|
+
}
|
|
82872
|
+
}
|
|
82873
|
+
async function startedUpdate({
|
|
82874
|
+
context,
|
|
82875
|
+
server
|
|
82876
|
+
}) {
|
|
82877
|
+
if (context.environment.inherited.LAZE_AUTO_UPDATE === "0") return null;
|
|
82878
|
+
const plan2 = updatePlanOf({ script: await scriptOf(context) });
|
|
82879
|
+
if (plan2.kind !== "install") return null;
|
|
82880
|
+
const folder = dirname19(context.environment.configPath);
|
|
82881
|
+
const stamp = join20(folder, "auto-update.json");
|
|
82882
|
+
const last = await readFile30(stamp, "utf8").then((text2) => JSON.parse(text2)).catch(() => null);
|
|
82883
|
+
const now = context.nowMs();
|
|
82884
|
+
if (last?.server === server && now - last.atMs < RETRY_AFTER_MS) return null;
|
|
82885
|
+
await mkdir20(folder, { recursive: true, mode: 448 });
|
|
82886
|
+
await writeFile21(stamp, JSON.stringify({ server, atMs: now }), { mode: 384 });
|
|
82887
|
+
context.processes.spawnDetached({
|
|
82888
|
+
argv: [...context.program, "update"],
|
|
82889
|
+
logPath: join20(folder, "auto-update.log")
|
|
82890
|
+
});
|
|
82891
|
+
return { manager: plan2.manager };
|
|
82892
|
+
}
|
|
82576
82893
|
function watchingRelease({
|
|
82577
82894
|
context,
|
|
82578
|
-
mine:
|
|
82895
|
+
mine: mine4 = cliVersionOf()
|
|
82579
82896
|
}) {
|
|
82580
82897
|
const sandbox = context.program.at(-1) === SANDBOX_CLI_PATH;
|
|
82581
82898
|
let warned = false;
|
|
@@ -82585,10 +82902,12 @@ function watchingRelease({
|
|
|
82585
82902
|
const response = await context.fetcher(input2, init);
|
|
82586
82903
|
const server = response.headers.get(CLI_RELEASE_HEADER);
|
|
82587
82904
|
if (!warned && server) {
|
|
82588
|
-
const warning = releaseWarningOf({ mine:
|
|
82905
|
+
const warning = releaseWarningOf({ mine: mine4, server, sandbox });
|
|
82589
82906
|
if (warning) {
|
|
82590
82907
|
warned = true;
|
|
82591
|
-
|
|
82908
|
+
const older = !sandbox && releaseSkewOf({ mine: mine4, server }) === "older";
|
|
82909
|
+
const started = older ? await startedUpdate({ context, server }) : null;
|
|
82910
|
+
context.err(started ? selfUpdateLineOf({ mine: mine4, server, ...started }) : warning);
|
|
82592
82911
|
}
|
|
82593
82912
|
}
|
|
82594
82913
|
return response;
|
|
@@ -82597,7 +82916,7 @@ function watchingRelease({
|
|
|
82597
82916
|
}
|
|
82598
82917
|
|
|
82599
82918
|
// src/services/rush-guard.service.ts
|
|
82600
|
-
import { readFile as
|
|
82919
|
+
import { readFile as readFile31, rm as rm13 } from "node:fs/promises";
|
|
82601
82920
|
var WATCH_MS3 = 2e3;
|
|
82602
82921
|
var RETRY_MS2 = 3e4;
|
|
82603
82922
|
async function guardRound({ context, client, name: name2, lock, claudePid, session, rush }) {
|
|
@@ -82633,7 +82952,7 @@ async function rushWakeHook({ context, args }) {
|
|
|
82633
82952
|
while (context.processes.alive(claudePid)) await context.sleep(WATCH_MS3);
|
|
82634
82953
|
const { client, name: name2 } = await signedIn({ context, args });
|
|
82635
82954
|
const noted = statePathOf({ context, kind: "sessions", profile: String(claudePid) });
|
|
82636
|
-
const session = await
|
|
82955
|
+
const session = await readFile31(noted, "utf8").then(
|
|
82637
82956
|
(text2) => JSON.parse(text2),
|
|
82638
82957
|
() => void 0
|
|
82639
82958
|
);
|
|
@@ -82712,13 +83031,13 @@ function changesOf2(args) {
|
|
|
82712
83031
|
const changes = {};
|
|
82713
83032
|
const timed = ["cron", "rrule", "at"].some((name2) => flagText({ args, name: name2 }));
|
|
82714
83033
|
if (timed) changes.timing = timingOf(args);
|
|
82715
|
-
for (const [
|
|
83034
|
+
for (const [flag2, field] of [
|
|
82716
83035
|
["name", "name"],
|
|
82717
83036
|
["prompt", "prompt"],
|
|
82718
83037
|
["tz", "timezone"],
|
|
82719
83038
|
["agent", "agentId"]
|
|
82720
83039
|
]) {
|
|
82721
|
-
const value = flagText({ args, name:
|
|
83040
|
+
const value = flagText({ args, name: flag2 });
|
|
82722
83041
|
if (value) changes[field] = value;
|
|
82723
83042
|
}
|
|
82724
83043
|
const channel = flagText({ args, name: "channel" });
|
|
@@ -82799,8 +83118,8 @@ async function schedule({ context, args }) {
|
|
|
82799
83118
|
}
|
|
82800
83119
|
|
|
82801
83120
|
// src/services/skill-commands.service.ts
|
|
82802
|
-
import { readdir as readdir6, readFile as
|
|
82803
|
-
import { join as
|
|
83121
|
+
import { readdir as readdir6, readFile as readFile32 } from "node:fs/promises";
|
|
83122
|
+
import { join as join21, relative as relative6, resolve as resolve12 } from "node:path";
|
|
82804
83123
|
var USAGE16 = `Usage:
|
|
82805
83124
|
laze skill list [--agent <agentId>]
|
|
82806
83125
|
laze skill install <catalogue-id> [--as <name>] [--agent <agentId>]
|
|
@@ -82821,8 +83140,8 @@ async function folderFiles({ root }) {
|
|
|
82821
83140
|
const files2 = [];
|
|
82822
83141
|
for (const entry of entries) {
|
|
82823
83142
|
if (!entry.isFile()) continue;
|
|
82824
|
-
const full =
|
|
82825
|
-
files2.push({ path: relative6(root, full), content: await
|
|
83143
|
+
const full = join21(entry.parentPath, entry.name);
|
|
83144
|
+
files2.push({ path: relative6(root, full), content: await readFile32(full, "utf8") });
|
|
82826
83145
|
}
|
|
82827
83146
|
return files2.toSorted((a, b) => a.path.localeCompare(b.path));
|
|
82828
83147
|
}
|
|
@@ -82920,7 +83239,7 @@ async function skillUpdate({ context, args }) {
|
|
|
82920
83239
|
if (!name2 || !newName && description === void 0 && !skillMdFile) {
|
|
82921
83240
|
throw new CliUsageError(USAGE16);
|
|
82922
83241
|
}
|
|
82923
|
-
const skillMd = skillMdFile ? await
|
|
83242
|
+
const skillMd = skillMdFile ? await readFile32(resolve12(context.cwd, skillMdFile), "utf8") : void 0;
|
|
82924
83243
|
const { client } = await signedIn({ context, args });
|
|
82925
83244
|
const updated = await client.post("/api/skills/update", {
|
|
82926
83245
|
name: name2,
|
|
@@ -82966,7 +83285,7 @@ async function skill({ context, args }) {
|
|
|
82966
83285
|
}
|
|
82967
83286
|
|
|
82968
83287
|
// src/services/slack-commands.service.ts
|
|
82969
|
-
import { readFile as
|
|
83288
|
+
import { readFile as readFile33 } from "node:fs/promises";
|
|
82970
83289
|
import { resolve as resolve13 } from "node:path";
|
|
82971
83290
|
var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
|
|
82972
83291
|
laze slack overview connected Slack workspaces, mirrors, your link
|
|
@@ -83010,11 +83329,11 @@ function wordAt5(args, index) {
|
|
|
83010
83329
|
return word3;
|
|
83011
83330
|
}
|
|
83012
83331
|
async function secretLines({ context, args }) {
|
|
83013
|
-
if (SECRET_FLAGS2.some((
|
|
83332
|
+
if (SECRET_FLAGS2.some((flag2) => args.flags[flag2] !== void 0)) {
|
|
83014
83333
|
throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
|
|
83015
83334
|
}
|
|
83016
83335
|
const file3 = flagText({ args, name: "from-file" });
|
|
83017
|
-
const text2 = file3 ? await
|
|
83336
|
+
const text2 = file3 ? await readFile33(resolve13(context.cwd, file3), "utf8") : await context.readStdin();
|
|
83018
83337
|
return text2.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
83019
83338
|
}
|
|
83020
83339
|
async function secretsOf({
|
|
@@ -83212,16 +83531,16 @@ var disconnect2 = async ({ context, args, client }) => {
|
|
|
83212
83531
|
context.out(`Disconnected ${teamId}.
|
|
83213
83532
|
`);
|
|
83214
83533
|
};
|
|
83215
|
-
function printMove({ context, move:
|
|
83216
|
-
const problem =
|
|
83217
|
-
context.out(`${
|
|
83534
|
+
function printMove({ context, move: move3 }) {
|
|
83535
|
+
const problem = move3.problem ? ` ${move3.problem.message}` : "";
|
|
83536
|
+
context.out(`${move3.moveId} #${move3.slackName} -> #${move3.name} ${move3.state}${problem}
|
|
83218
83537
|
`);
|
|
83219
83538
|
}
|
|
83220
83539
|
var moves = async ({ context, args, client }) => {
|
|
83221
83540
|
const answer4 = await client.get(SLACK_KEY_PATHS.moves);
|
|
83222
83541
|
if (json3({ context, args, data: answer4 })) return;
|
|
83223
83542
|
if (answer4.moves.length === 0) context.out("No moves yet.\n");
|
|
83224
|
-
for (const
|
|
83543
|
+
for (const move3 of answer4.moves) printMove({ context, move: move3 });
|
|
83225
83544
|
};
|
|
83226
83545
|
var movePreview = async ({ context, args, client }) => {
|
|
83227
83546
|
const preview = await client.post(SLACK_KEY_PATHS.movePreview, {
|
|
@@ -83256,7 +83575,7 @@ function moveBody(args) {
|
|
|
83256
83575
|
}))
|
|
83257
83576
|
};
|
|
83258
83577
|
}
|
|
83259
|
-
var
|
|
83578
|
+
var move2 = async ({ context, args, client }) => {
|
|
83260
83579
|
const answer4 = await client.post(SLACK_KEY_PATHS.startMoves, moveBody(args));
|
|
83261
83580
|
if (json3({ context, args, data: answer4 })) return;
|
|
83262
83581
|
for (const one of answer4.started) {
|
|
@@ -83303,7 +83622,7 @@ var RUNS4 = {
|
|
|
83303
83622
|
disconnect: disconnect2,
|
|
83304
83623
|
moves,
|
|
83305
83624
|
"move-preview": movePreview,
|
|
83306
|
-
move,
|
|
83625
|
+
move: move2,
|
|
83307
83626
|
"cancel-move": cancelMove
|
|
83308
83627
|
};
|
|
83309
83628
|
async function slack({
|
|
@@ -83318,7 +83637,7 @@ async function slack({
|
|
|
83318
83637
|
}
|
|
83319
83638
|
|
|
83320
83639
|
// src/services/sso-commands.service.ts
|
|
83321
|
-
import { readFile as
|
|
83640
|
+
import { readFile as readFile34 } from "node:fs/promises";
|
|
83322
83641
|
var SSO_USAGE = `Usage:
|
|
83323
83642
|
laze sso domains claimed domains and how each signs in (admins)
|
|
83324
83643
|
laze sso claim <domain> the TXT record that proves the domain
|
|
@@ -83336,7 +83655,7 @@ var SCIM_USAGE = `Usage:
|
|
|
83336
83655
|
laze scim create-token <name> [--to-vault <name>] a token for the identity provider; printed
|
|
83337
83656
|
once, or with --to-vault kept in your personal keychain and never printed
|
|
83338
83657
|
laze scim revoke-token <id> the directory is refused at once`;
|
|
83339
|
-
var
|
|
83658
|
+
var printJson8 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
|
|
83340
83659
|
`);
|
|
83341
83660
|
function stateOf2(claim3) {
|
|
83342
83661
|
if (!claim3.verified) return "not verified";
|
|
@@ -83368,13 +83687,13 @@ async function claimCall({
|
|
|
83368
83687
|
}) {
|
|
83369
83688
|
const { client } = await signedIn({ context, args });
|
|
83370
83689
|
const claim3 = await client.post(path, body);
|
|
83371
|
-
if (args.flags.json) return
|
|
83690
|
+
if (args.flags.json) return printJson8(context, claim3);
|
|
83372
83691
|
printClaim(context, claim3);
|
|
83373
83692
|
}
|
|
83374
83693
|
async function domains3({ context, args }) {
|
|
83375
83694
|
const { client } = await signedIn({ context, args });
|
|
83376
83695
|
const claims = await client.get("/api/sso/domains");
|
|
83377
|
-
if (args.flags.json) return
|
|
83696
|
+
if (args.flags.json) return printJson8(context, claims);
|
|
83378
83697
|
if (claims.length === 0) return context.out("No claimed domains yet. laze sso claim <domain>.\n");
|
|
83379
83698
|
for (const claim3 of claims) printClaim(context, claim3);
|
|
83380
83699
|
}
|
|
@@ -83397,7 +83716,7 @@ var connectGoogle = ({ context, args }) => claimCall({
|
|
|
83397
83716
|
body: { domain: domainOf({ args, usage: SSO_USAGE }) }
|
|
83398
83717
|
});
|
|
83399
83718
|
function refuseSecretFlags({ args }) {
|
|
83400
|
-
if (["client-secret", "secret"].some((
|
|
83719
|
+
if (["client-secret", "secret"].some((flag2) => args.flags[flag2] !== void 0)) {
|
|
83401
83720
|
throw new CliUsageError(
|
|
83402
83721
|
"A client secret never goes in a flag (shell history keeps it): pipe it on stdin or use --from-file."
|
|
83403
83722
|
);
|
|
@@ -83405,7 +83724,7 @@ function refuseSecretFlags({ args }) {
|
|
|
83405
83724
|
}
|
|
83406
83725
|
async function clientSecretOf({ context, args }) {
|
|
83407
83726
|
const file3 = flagText({ args, name: "from-file" });
|
|
83408
|
-
const text2 = file3 ? await
|
|
83727
|
+
const text2 = file3 ? await readFile34(file3, "utf8") : await context.readStdin();
|
|
83409
83728
|
const secret = text2.trim();
|
|
83410
83729
|
if (!secret) throw new CliUsageError("No client secret: pipe it on stdin or use --from-file.");
|
|
83411
83730
|
return secret;
|
|
@@ -83435,7 +83754,7 @@ async function enforce({ context, args }) {
|
|
|
83435
83754
|
"/api/sso/enforce",
|
|
83436
83755
|
{ domain: domain2, enforced: state === "on" }
|
|
83437
83756
|
);
|
|
83438
|
-
if (args.flags.json) return
|
|
83757
|
+
if (args.flags.json) return printJson8(context, outcome);
|
|
83439
83758
|
printClaim(context, outcome.claim);
|
|
83440
83759
|
if (outcome.endedSessions > 0) {
|
|
83441
83760
|
context.out(`Ended ${outcome.endedSessions} sessions that signed in another way.
|
|
@@ -83456,7 +83775,7 @@ async function domainAction({ context, args, path }) {
|
|
|
83456
83775
|
const domain2 = domainOf({ args, usage: SSO_USAGE });
|
|
83457
83776
|
const { client } = await signedIn({ context, args });
|
|
83458
83777
|
const answer4 = await client.post(path, { domain: domain2 });
|
|
83459
|
-
if (args.flags.json) return
|
|
83778
|
+
if (args.flags.json) return printJson8(context, answer4);
|
|
83460
83779
|
context.out(`${path.endsWith("remove") ? "Removed" : "Disconnected"} ${domain2}.
|
|
83461
83780
|
`);
|
|
83462
83781
|
}
|
|
@@ -83479,7 +83798,7 @@ async function sso({ context, args }) {
|
|
|
83479
83798
|
async function scimTokens({ context, args }) {
|
|
83480
83799
|
const { client } = await signedIn({ context, args });
|
|
83481
83800
|
const tokens = await client.get("/api/scim-tokens");
|
|
83482
|
-
if (args.flags.json) return
|
|
83801
|
+
if (args.flags.json) return printJson8(context, tokens);
|
|
83483
83802
|
if (tokens.length === 0) return context.out("No SCIM tokens. laze scim create-token <name>.\n");
|
|
83484
83803
|
for (const token2 of tokens) {
|
|
83485
83804
|
context.out(`${token2.id} ${token2.name} by ${token2.createdByUserId} ${token2.createdAt}
|
|
@@ -83518,7 +83837,7 @@ async function scimCreateToken({ context, args }) {
|
|
|
83518
83837
|
if (connection) {
|
|
83519
83838
|
await keepScimToken({ client, minted, connection });
|
|
83520
83839
|
if (args.flags.json) {
|
|
83521
|
-
return
|
|
83840
|
+
return printJson8(context, {
|
|
83522
83841
|
token: minted.token,
|
|
83523
83842
|
baseUrl: minted.baseUrl,
|
|
83524
83843
|
vault: connection
|
|
@@ -83531,7 +83850,7 @@ async function scimCreateToken({ context, args }) {
|
|
|
83531
83850
|
return context.out(`SCIM base URL for your identity provider: ${minted.baseUrl}
|
|
83532
83851
|
`);
|
|
83533
83852
|
}
|
|
83534
|
-
if (args.flags.json) return
|
|
83853
|
+
if (args.flags.json) return printJson8(context, minted);
|
|
83535
83854
|
context.out(`Created ${minted.token.name} (${minted.token.id}). Its token, shown once:
|
|
83536
83855
|
`);
|
|
83537
83856
|
context.out(`${minted.secret}
|
|
@@ -83544,7 +83863,7 @@ async function scimRevokeToken({ context, args }) {
|
|
|
83544
83863
|
if (!tokenId) throw new CliUsageError(SCIM_USAGE);
|
|
83545
83864
|
const { client } = await signedIn({ context, args });
|
|
83546
83865
|
await client.post("/api/scim-tokens/revoke", { tokenId });
|
|
83547
|
-
if (args.flags.json) return
|
|
83866
|
+
if (args.flags.json) return printJson8(context, { revoked: true, tokenId });
|
|
83548
83867
|
context.out(`Revoked ${tokenId}.
|
|
83549
83868
|
`);
|
|
83550
83869
|
}
|
|
@@ -83618,12 +83937,12 @@ async function statusUsage() {
|
|
|
83618
83937
|
}
|
|
83619
83938
|
|
|
83620
83939
|
// src/services/update-commands.service.ts
|
|
83621
|
-
import { realpath } from "node:fs/promises";
|
|
83940
|
+
import { realpath as realpath2 } from "node:fs/promises";
|
|
83622
83941
|
var BY_HAND = `npm install -g ${CLI_PACKAGE_LATEST}`;
|
|
83623
83942
|
async function realScriptOf({ program }) {
|
|
83624
83943
|
const script = program.at(-1) ?? "";
|
|
83625
83944
|
try {
|
|
83626
|
-
return await
|
|
83945
|
+
return await realpath2(script);
|
|
83627
83946
|
} catch {
|
|
83628
83947
|
return script;
|
|
83629
83948
|
}
|
|
@@ -83755,7 +84074,7 @@ async function vaultSave({ context, args }) {
|
|
|
83755
84074
|
}
|
|
83756
84075
|
|
|
83757
84076
|
// src/services/vault-scrub-commands.service.ts
|
|
83758
|
-
function
|
|
84077
|
+
function lineOf4(channel) {
|
|
83759
84078
|
const where = channel.name ? `#${channel.name}` : channel.channelId;
|
|
83760
84079
|
const found = Object.entries(channel.found).map(([vendor, count4]) => `${vendor} ${count4}`).join(", ");
|
|
83761
84080
|
const kinds = [`held ${channel.held}`, ...found ? [`found: ${found}`] : []].join("; ");
|
|
@@ -83769,7 +84088,7 @@ async function vaultScrub({ context, args }) {
|
|
|
83769
84088
|
if (args.flags.json) return context.out(`${JSON.stringify(report3, null, 2)}
|
|
83770
84089
|
`);
|
|
83771
84090
|
const changed = report3.channels.filter((channel) => channel.messages > 0);
|
|
83772
|
-
for (const channel of changed) context.out(
|
|
84091
|
+
for (const channel of changed) context.out(lineOf4(channel));
|
|
83773
84092
|
const total = changed.reduce((sum, channel) => sum + channel.messages, 0);
|
|
83774
84093
|
context.out(
|
|
83775
84094
|
report3.dryRun ? `Dry run: ${total} message(s) would change. Nothing was changed.
|
|
@@ -83779,7 +84098,7 @@ async function vaultScrub({ context, args }) {
|
|
|
83779
84098
|
}
|
|
83780
84099
|
|
|
83781
84100
|
// src/services/whatsapp-business-commands.service.ts
|
|
83782
|
-
import { readFile as
|
|
84101
|
+
import { readFile as readFile35 } from "node:fs/promises";
|
|
83783
84102
|
import { resolve as resolve14 } from "node:path";
|
|
83784
84103
|
|
|
83785
84104
|
// ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
|
|
@@ -84191,7 +84510,7 @@ async function settle2({ client, send: send4 }) {
|
|
|
84191
84510
|
return current2;
|
|
84192
84511
|
}
|
|
84193
84512
|
async function secretsOf2({ context, args }) {
|
|
84194
|
-
if (SECRET_FLAGS3.some((
|
|
84513
|
+
if (SECRET_FLAGS3.some((flag2) => args.flags[flag2] !== void 0)) {
|
|
84195
84514
|
throw new CliUsageError(
|
|
84196
84515
|
"A secret never goes in a flag: pipe it on stdin, use --from-file or --from-vault."
|
|
84197
84516
|
);
|
|
@@ -84199,7 +84518,7 @@ async function secretsOf2({ context, args }) {
|
|
|
84199
84518
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
84200
84519
|
if (fromConnection) return { fromConnection };
|
|
84201
84520
|
const file3 = flagText({ args, name: "from-file" });
|
|
84202
|
-
const text2 = file3 ? await
|
|
84521
|
+
const text2 = file3 ? await readFile35(resolve14(context.cwd, file3), "utf8") : await context.readStdin();
|
|
84203
84522
|
const lines = text2.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
84204
84523
|
if (lines.length !== 2) {
|
|
84205
84524
|
throw new CliUsageError(
|
|
@@ -84400,7 +84719,7 @@ async function whatsappBusiness({
|
|
|
84400
84719
|
}
|
|
84401
84720
|
|
|
84402
84721
|
// src/services/whatsapp-pairing-commands.service.ts
|
|
84403
|
-
import { writeFile as
|
|
84722
|
+
import { writeFile as writeFile22 } from "node:fs/promises";
|
|
84404
84723
|
import { resolve as resolve15 } from "node:path";
|
|
84405
84724
|
var WHATSAPP_PAIRING_USAGE = [
|
|
84406
84725
|
" laze whatsapp pair <machine> [--qr <file.svg>] link WhatsApp on your machine; scan the code (owner)",
|
|
@@ -84421,7 +84740,7 @@ function svgOf(dataUrl) {
|
|
|
84421
84740
|
}
|
|
84422
84741
|
async function report({ context, args, pairing: pairing2 }) {
|
|
84423
84742
|
const qrFile = pairing2.qrSvg ? resolve15(context.cwd, flagText({ args, name: "qr", fallback: "whatsapp-qr.svg" })) : null;
|
|
84424
|
-
if (qrFile && pairing2.qrSvg) await
|
|
84743
|
+
if (qrFile && pairing2.qrSvg) await writeFile22(qrFile, svgOf(pairing2.qrSvg), "utf8");
|
|
84425
84744
|
if (args.flags.json) return context.out(`${JSON.stringify({ ...pairing2, qrFile }, null, 2)}
|
|
84426
84745
|
`);
|
|
84427
84746
|
context.out(`${pairing2.pairingId} ${pairing2.state}
|
|
@@ -84718,12 +85037,12 @@ async function wiki({ context, args }) {
|
|
|
84718
85037
|
var FLAGS_USAGE = `Usage:
|
|
84719
85038
|
laze flags list
|
|
84720
85039
|
laze flags set <key> on|off`;
|
|
84721
|
-
var
|
|
85040
|
+
var printJson9 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
|
|
84722
85041
|
`);
|
|
84723
85042
|
async function roles({ context, args }) {
|
|
84724
85043
|
const { client } = await signedIn({ context, args });
|
|
84725
85044
|
const catalogue = await client.get("/api/roles");
|
|
84726
|
-
if (args.flags.json) return
|
|
85045
|
+
if (args.flags.json) return printJson9(context, catalogue);
|
|
84727
85046
|
for (const role2 of catalogue) {
|
|
84728
85047
|
const count4 = `${role2.permissions.length} permissions`;
|
|
84729
85048
|
context.out(`${role2.label} ${count4} ${role2.description}
|
|
@@ -84739,7 +85058,7 @@ async function audit({ context, args }) {
|
|
|
84739
85058
|
throw new CliUsageError("Usage: laze audit [--limit <1-200>]");
|
|
84740
85059
|
const { client } = await signedIn({ context, args });
|
|
84741
85060
|
const entries = await client.post("/api/audit-log/list", limit ? { limit } : {});
|
|
84742
|
-
if (args.flags.json) return
|
|
85061
|
+
if (args.flags.json) return printJson9(context, entries);
|
|
84743
85062
|
if (entries.length === 0) return context.out("No audited actions yet.\n");
|
|
84744
85063
|
for (const entry of entries) {
|
|
84745
85064
|
const actor = `${entry.actorType}${entry.actorId ? ` ${entry.actorId}` : ""}`;
|
|
@@ -84754,21 +85073,21 @@ async function audit({ context, args }) {
|
|
|
84754
85073
|
async function flagsList({ context, args }) {
|
|
84755
85074
|
const { client } = await signedIn({ context, args });
|
|
84756
85075
|
const flags2 = await client.get("/api/feature-flags");
|
|
84757
|
-
if (args.flags.json) return
|
|
85076
|
+
if (args.flags.json) return printJson9(context, flags2);
|
|
84758
85077
|
if (flags2.length === 0) return context.out("No flag was ever set: every flag is off.\n");
|
|
84759
|
-
for (const
|
|
85078
|
+
for (const flag2 of flags2) context.out(`${flag2.key} ${flag2.enabled ? "on" : "off"}
|
|
84760
85079
|
`);
|
|
84761
85080
|
}
|
|
84762
85081
|
async function flagsSet({ context, args }) {
|
|
84763
85082
|
const [, , key, state] = args.words;
|
|
84764
85083
|
if (!key || state !== "on" && state !== "off") throw new CliUsageError(FLAGS_USAGE);
|
|
84765
85084
|
const { client } = await signedIn({ context, args });
|
|
84766
|
-
const
|
|
85085
|
+
const flag2 = await client.post("/api/feature-flags/set", {
|
|
84767
85086
|
key,
|
|
84768
85087
|
enabled: state === "on"
|
|
84769
85088
|
});
|
|
84770
|
-
if (args.flags.json) return
|
|
84771
|
-
context.out(`${
|
|
85089
|
+
if (args.flags.json) return printJson9(context, flag2);
|
|
85090
|
+
context.out(`${flag2.key} ${flag2.enabled ? "on" : "off"}
|
|
84772
85091
|
`);
|
|
84773
85092
|
}
|
|
84774
85093
|
var FLAG_COMMANDS = { list: flagsList, set: flagsSet };
|
|
@@ -84780,7 +85099,7 @@ async function flags({ context, args }) {
|
|
|
84780
85099
|
}
|
|
84781
85100
|
|
|
84782
85101
|
// src/services/workspace-commands.service.ts
|
|
84783
|
-
import { readFile as
|
|
85102
|
+
import { readFile as readFile36 } from "node:fs/promises";
|
|
84784
85103
|
import { resolve as resolve16 } from "node:path";
|
|
84785
85104
|
var ROLE_NAMES2 = {
|
|
84786
85105
|
OWNER: "Owner",
|
|
@@ -84813,7 +85132,7 @@ ${deleting}`;
|
|
|
84813
85132
|
}
|
|
84814
85133
|
});
|
|
84815
85134
|
}
|
|
84816
|
-
async function
|
|
85135
|
+
async function mine3({ context, args }) {
|
|
84817
85136
|
const { client } = await signedIn({ context, args });
|
|
84818
85137
|
const answer4 = await client.post("/api/agents/me/workspace/mine", {});
|
|
84819
85138
|
print8({
|
|
@@ -84963,7 +85282,7 @@ var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze work
|
|
|
84963
85282
|
async function readLogo({ context, file: file3 }) {
|
|
84964
85283
|
let bytes;
|
|
84965
85284
|
try {
|
|
84966
|
-
bytes = new Uint8Array(await
|
|
85285
|
+
bytes = new Uint8Array(await readFile36(resolve16(context.cwd, file3)));
|
|
84967
85286
|
} catch {
|
|
84968
85287
|
throw new CliUsageError(`No file to read at ${file3}.`);
|
|
84969
85288
|
}
|
|
@@ -85002,7 +85321,7 @@ var WORKSPACE_COMMANDS = {
|
|
|
85002
85321
|
list: listWorkspaces,
|
|
85003
85322
|
switch: switchTo,
|
|
85004
85323
|
logo,
|
|
85005
|
-
mine:
|
|
85324
|
+
mine: mine3,
|
|
85006
85325
|
rename: rename7,
|
|
85007
85326
|
create: create2,
|
|
85008
85327
|
leave,
|
|
@@ -85110,7 +85429,7 @@ async function role({ context, args }) {
|
|
|
85110
85429
|
`
|
|
85111
85430
|
});
|
|
85112
85431
|
}
|
|
85113
|
-
async function
|
|
85432
|
+
async function remove5({ context, args }) {
|
|
85114
85433
|
const member = args.words[2];
|
|
85115
85434
|
if (!member) throw new CliUsageError("Usage: laze members remove <member>");
|
|
85116
85435
|
const { client } = await signedIn({ context, args });
|
|
@@ -85159,7 +85478,7 @@ var MEMBERS_COMMANDS = {
|
|
|
85159
85478
|
"revoke-invite": revokeInvite,
|
|
85160
85479
|
"invite-link": inviteLink,
|
|
85161
85480
|
role,
|
|
85162
|
-
remove:
|
|
85481
|
+
remove: remove5,
|
|
85163
85482
|
requests,
|
|
85164
85483
|
approve: deciding("approved"),
|
|
85165
85484
|
deny: deciding("denied")
|
|
@@ -85355,11 +85674,14 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
85355
85674
|
laze machine list | health <machine> own machines: online or not, system, disk and tools
|
|
85356
85675
|
laze machine get|rename|grant|revoke|budget <machine> one machine, its name, who it is shared with, its cap
|
|
85357
85676
|
laze machine status whether Laze can rent machines here
|
|
85358
|
-
laze computer status | sizes your computer: size, CPU, memory, disk, each agent's share, prices
|
|
85677
|
+
laze computer status | sizes your agent computer: size, CPU, memory, disk, each agent's share, prices
|
|
85359
85678
|
laze computer upgrade <size> small, medium, large or xl (admins); only after the person said yes in chat
|
|
85360
85679
|
laze computer request <size> | cancel <request> ask the admins for a size, or withdraw the ask
|
|
85361
85680
|
laze computer list everyone's computers, size and monthly cost (Owners and Admins)
|
|
85362
85681
|
laze computer restart [--person <user id>] stop and start a computer that runs fine (people, not agents)
|
|
85682
|
+
laze computer mine | add <name> --size <size> [--shared] your agent computers; add one (Owners and Admins)
|
|
85683
|
+
laze computer remove <computer> [--to <computer>] | move <agent> <computer|default> delete one, or move an agent
|
|
85684
|
+
laze computer creators <computer> --everyone | --people <id,id> who may add agents on a shared computer
|
|
85363
85685
|
laze ip [status|on <country>|off|countries|domains [add|remove|reset]|list] your dedicated IP for sites that block Laze
|
|
85364
85686
|
laze ip offer --site <domain> when a site blocks the shared address: the offer to pass on, price included
|
|
85365
85687
|
laze ops suspend|release <workspace> --reason "<why>" Laze operators only, with LAZE_OPS_TOKEN
|
|
@@ -85367,7 +85689,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
85367
85689
|
When someone wants work done on their own machine, run it there; if it is offline, say so and go on where you run
|
|
85368
85690
|
laze machine exec <machine> --vault <connection> --reason "<why>" -- <command> the same, with a vault connection
|
|
85369
85691
|
laze machine host <machine> <agent> [--when-offline wait|computer] run your personal agent on your machine
|
|
85370
|
-
laze machine unhost <agent> run the agent on your computer again
|
|
85692
|
+
laze machine unhost <agent> run the agent on your agent computer again
|
|
85371
85693
|
laze whatsapp chats|read <machine> [<chat>] [--limit <n>] a person's WhatsApp, through their own machine
|
|
85372
85694
|
laze whatsapp send <machine> <chat> "<text>" send as its owner; each message waits for their approval
|
|
85373
85695
|
laze whatsapp pair|unpair <machine>, pairing|cancel <id> link WhatsApp on your own machine (owner)
|
|
@@ -85628,8 +85950,8 @@ async function runCli({
|
|
|
85628
85950
|
// src/services/processes.service.ts
|
|
85629
85951
|
import { execFile as execFile2, spawn as spawn4 } from "node:child_process";
|
|
85630
85952
|
import { mkdirSync, openSync } from "node:fs";
|
|
85631
|
-
import { readFile as
|
|
85632
|
-
import { dirname as
|
|
85953
|
+
import { readFile as readFile37, readlink } from "node:fs/promises";
|
|
85954
|
+
import { dirname as dirname20 } from "node:path";
|
|
85633
85955
|
import { promisify as promisify2 } from "node:util";
|
|
85634
85956
|
var run3 = promisify2(execFile2);
|
|
85635
85957
|
function alive(pid) {
|
|
@@ -85642,14 +85964,14 @@ function alive(pid) {
|
|
|
85642
85964
|
}
|
|
85643
85965
|
}
|
|
85644
85966
|
async function argsOf(pid) {
|
|
85645
|
-
const raw = await
|
|
85967
|
+
const raw = await readFile37(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
|
|
85646
85968
|
if (raw) return raw.split("\0").filter(Boolean);
|
|
85647
85969
|
const listed = await run3("ps", ["-o", "args=", "-p", String(pid)]).catch(() => void 0);
|
|
85648
85970
|
const line = listed?.stdout.trim();
|
|
85649
85971
|
return line ? line.split(/\s+/) : void 0;
|
|
85650
85972
|
}
|
|
85651
85973
|
async function parentOf(pid) {
|
|
85652
|
-
const stat3 = await
|
|
85974
|
+
const stat3 = await readFile37(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
|
|
85653
85975
|
const fromStat = stat3 ? Number(stat3.slice(stat3.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
|
|
85654
85976
|
if (fromStat > 0) return fromStat;
|
|
85655
85977
|
const listed = await run3("ps", ["-o", "ppid=", "-p", String(pid)]).catch(() => void 0);
|
|
@@ -85666,7 +85988,7 @@ async function cwdOf(pid) {
|
|
|
85666
85988
|
return line ? line.slice(1) : void 0;
|
|
85667
85989
|
}
|
|
85668
85990
|
function spawnDetached({ argv, logPath }) {
|
|
85669
|
-
mkdirSync(
|
|
85991
|
+
mkdirSync(dirname20(logPath), { recursive: true, mode: 448 });
|
|
85670
85992
|
const log = openSync(logPath, "a", 384);
|
|
85671
85993
|
const [program = "", ...rest] = argv;
|
|
85672
85994
|
const child = spawn4(program, rest, { detached: true, stdio: ["ignore", log, log] });
|
|
@@ -85773,7 +86095,12 @@ function sleep(ms, signal) {
|
|
|
85773
86095
|
signal?.addEventListener("abort", stop3, { once: true });
|
|
85774
86096
|
});
|
|
85775
86097
|
}
|
|
86098
|
+
function quietOnClosedPipe(error62) {
|
|
86099
|
+
if (error62.code !== "EPIPE") throw error62;
|
|
86100
|
+
process.exit(process.exitCode ?? 0);
|
|
86101
|
+
}
|
|
85776
86102
|
if (true) {
|
|
86103
|
+
process.stdout.on("error", quietOnClosedPipe);
|
|
85777
86104
|
const environment = cliEnvironment();
|
|
85778
86105
|
const ask = terminalAsk();
|
|
85779
86106
|
process.exitCode = await runCli({
|