@lazehq/cli 0.1.128 → 0.1.129
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 +839 -367
- package/package.json +1 -1
package/dist/laze.mjs
CHANGED
|
@@ -19486,7 +19486,7 @@ var require_snapshot_utils = __commonJS({
|
|
|
19486
19486
|
var require_snapshot_recorder = __commonJS({
|
|
19487
19487
|
"../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
|
|
19488
19488
|
"use strict";
|
|
19489
|
-
var { writeFile: writeFile12, readFile:
|
|
19489
|
+
var { writeFile: writeFile12, readFile: readFile40, mkdir: mkdir14 } = __require("node:fs/promises");
|
|
19490
19490
|
var { dirname: dirname29, resolve: resolve27 } = __require("node:path");
|
|
19491
19491
|
var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
|
|
19492
19492
|
var { InvalidArgumentError, UndiciError } = require_errors();
|
|
@@ -19703,7 +19703,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
19703
19703
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
19704
19704
|
}
|
|
19705
19705
|
try {
|
|
19706
|
-
const data = await
|
|
19706
|
+
const data = await readFile40(resolve27(path), "utf8");
|
|
19707
19707
|
const parsed = JSON.parse(data);
|
|
19708
19708
|
if (Array.isArray(parsed)) {
|
|
19709
19709
|
this.#snapshots.clear();
|
|
@@ -36960,7 +36960,7 @@ function shadowedLinkLineOf({ shadow }) {
|
|
|
36960
36960
|
}
|
|
36961
36961
|
|
|
36962
36962
|
// src/rules/cli-version.rules.ts
|
|
36963
|
-
var STAMPED = "0.1.
|
|
36963
|
+
var STAMPED = "0.1.129";
|
|
36964
36964
|
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
36965
36965
|
return stamped.startsWith("__") ? "dev" : stamped;
|
|
36966
36966
|
}
|
|
@@ -37586,7 +37586,7 @@ function linkedProfileNameOf({
|
|
|
37586
37586
|
}
|
|
37587
37587
|
}
|
|
37588
37588
|
function revokedKeyLineOf({ profile }) {
|
|
37589
|
-
return `${profile}: this agent's key
|
|
37589
|
+
return `${profile}: Laze refuses this agent's key. Ask its person for a new link (in Laze: Reconnect beside the agent, then Regenerate Connection Key) and run \`laze agent link --token <token>\` with it in the agent's session, or remove it with \`laze logout --profile ${profile}\``;
|
|
37590
37590
|
}
|
|
37591
37591
|
|
|
37592
37592
|
// src/rules/refusal-format.rules.ts
|
|
@@ -60135,6 +60135,101 @@ var dropVaultAgentAccessInputSchemaDefinition = external_exports.object({
|
|
|
60135
60135
|
});
|
|
60136
60136
|
var VaultAgentRulesDialogSlot = uiTokens("vault").component("agentRulesDialog");
|
|
60137
60137
|
|
|
60138
|
+
// ../../modules/vault/contract/src/vault-levels.ts
|
|
60139
|
+
var LEVEL_LABELS = {
|
|
60140
|
+
auto: "Allow",
|
|
60141
|
+
checked: "Auto",
|
|
60142
|
+
ask: "Always ask",
|
|
60143
|
+
human_only: "Human only"
|
|
60144
|
+
};
|
|
60145
|
+
function vaultLevelLabel(level2) {
|
|
60146
|
+
return LEVEL_LABELS[level2];
|
|
60147
|
+
}
|
|
60148
|
+
var CLI_LEVELS = {
|
|
60149
|
+
auto: "allow",
|
|
60150
|
+
checked: "auto",
|
|
60151
|
+
ask: "always-ask",
|
|
60152
|
+
human_only: "human-only"
|
|
60153
|
+
};
|
|
60154
|
+
var VAULT_CLI_LEVEL_NAMES = [
|
|
60155
|
+
"allow",
|
|
60156
|
+
"auto",
|
|
60157
|
+
"always-ask",
|
|
60158
|
+
"human-only"
|
|
60159
|
+
];
|
|
60160
|
+
function vaultCliLevelOf(level2) {
|
|
60161
|
+
return CLI_LEVELS[level2];
|
|
60162
|
+
}
|
|
60163
|
+
function vaultLevelOfCliName(name3) {
|
|
60164
|
+
const wanted = name3.toLowerCase();
|
|
60165
|
+
const found = Object.keys(CLI_LEVELS).find(
|
|
60166
|
+
(level2) => CLI_LEVELS[level2] === wanted
|
|
60167
|
+
);
|
|
60168
|
+
return found ?? "unknown";
|
|
60169
|
+
}
|
|
60170
|
+
|
|
60171
|
+
// ../../modules/vault/contract/src/vault.errors.ts
|
|
60172
|
+
var VaultSealMismatchError = class extends HandledError {
|
|
60173
|
+
constructor() {
|
|
60174
|
+
super("vault_seal_mismatch", "This sealed value does not belong to the secret it names", {
|
|
60175
|
+
httpStatus: 422
|
|
60176
|
+
});
|
|
60177
|
+
this.name = "VaultSealMismatchError";
|
|
60178
|
+
}
|
|
60179
|
+
};
|
|
60180
|
+
|
|
60181
|
+
// ../../modules/vault/contract/src/vault-boundary.ts
|
|
60182
|
+
var VAULT_BOUNDARY_HOST = /^(?=.{1,259}$)[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)*:\d{1,5}$/;
|
|
60183
|
+
var vaultBoundaryResolveInputSchemaDefinition = external_exports.object({
|
|
60184
|
+
agentId: external_exports.string().min(1),
|
|
60185
|
+
connectionId: external_exports.string().min(1),
|
|
60186
|
+
field: external_exports.string().min(1).max(200),
|
|
60187
|
+
host: external_exports.string().regex(VAULT_BOUNDARY_HOST),
|
|
60188
|
+
method: external_exports.string().max(20).default("GET"),
|
|
60189
|
+
path: external_exports.string().max(2e3).default("/"),
|
|
60190
|
+
/** The proxy read the body as a read, such as a GraphQL document of queries only. */
|
|
60191
|
+
readOnly: external_exports.boolean().optional(),
|
|
60192
|
+
/** The read the proxy found, such as "GraphQL query Issues". */
|
|
60193
|
+
operation: external_exports.string().max(120).optional()
|
|
60194
|
+
});
|
|
60195
|
+
var vaultBoundaryResolutionSchemaDefinition = external_exports.discriminatedUnion("decision", [
|
|
60196
|
+
external_exports.object({ decision: external_exports.literal("allow"), value: external_exports.string() }),
|
|
60197
|
+
external_exports.object({ decision: external_exports.literal("pending"), requestId: external_exports.string(), message: external_exports.string() }),
|
|
60198
|
+
external_exports.object({ decision: external_exports.literal("deny"), code: external_exports.string(), message: external_exports.string() })
|
|
60199
|
+
]);
|
|
60200
|
+
var vaultBoundaryStatusInputSchemaDefinition = external_exports.object({
|
|
60201
|
+
agentId: external_exports.string().min(1),
|
|
60202
|
+
requestId: external_exports.string().min(1),
|
|
60203
|
+
field: external_exports.string().min(1).max(200),
|
|
60204
|
+
host: external_exports.string().regex(VAULT_BOUNDARY_HOST)
|
|
60205
|
+
});
|
|
60206
|
+
var vaultValueShapeSchemaDefinition = external_exports.object({
|
|
60207
|
+
kept: external_exports.string().max(8),
|
|
60208
|
+
classes: external_exports.string().regex(/^[luds]*$/),
|
|
60209
|
+
symbols: external_exports.string()
|
|
60210
|
+
});
|
|
60211
|
+
var vaultValueShapeSchema = vaultValueShapeSchemaDefinition;
|
|
60212
|
+
var vaultBoundaryKeySchemaDefinition = external_exports.object({
|
|
60213
|
+
connectionId: external_exports.string().min(1),
|
|
60214
|
+
name: external_exports.string().min(1),
|
|
60215
|
+
field: external_exports.string().min(1),
|
|
60216
|
+
shape: vaultValueShapeSchema
|
|
60217
|
+
});
|
|
60218
|
+
var vaultEgressHostSchemaDefinition = external_exports.object({
|
|
60219
|
+
host: external_exports.string(),
|
|
60220
|
+
addedBy: external_exports.enum(["judge", "person"]),
|
|
60221
|
+
addedByUserId: external_exports.string().nullable(),
|
|
60222
|
+
reason: external_exports.string().nullable(),
|
|
60223
|
+
createdAt: external_exports.iso.datetime()
|
|
60224
|
+
});
|
|
60225
|
+
var vaultEgressHostSchema = vaultEgressHostSchemaDefinition;
|
|
60226
|
+
var vaultEgressHostInputSchemaDefinition = external_exports.object({
|
|
60227
|
+
workspaceId: external_exports.string().min(1),
|
|
60228
|
+
connectionId: external_exports.string().min(1),
|
|
60229
|
+
host: external_exports.string().min(1).max(260)
|
|
60230
|
+
});
|
|
60231
|
+
var vaultEgressHostInputSchema = vaultEgressHostInputSchemaDefinition;
|
|
60232
|
+
|
|
60138
60233
|
// ../../modules/vault/contract/src/vault-devices.ts
|
|
60139
60234
|
var base64Url = external_exports.string().regex(/^[A-Za-z0-9_-]+$/).max(16384);
|
|
60140
60235
|
var name = external_exports.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/);
|
|
@@ -60642,6 +60737,8 @@ var vaultConnectionSchemaDefinition = external_exports.object({
|
|
|
60642
60737
|
maxLeaseSeconds: external_exports.number().int().positive().nullable(),
|
|
60643
60738
|
/** Every use asks a person: no lease is offered and none covers it. */
|
|
60644
60739
|
everyUseAsks: external_exports.boolean().default(false),
|
|
60740
|
+
/** Used in-process on the agent's computer: a hosted agent gets the value, not a placeholder. */
|
|
60741
|
+
localUse: external_exports.boolean().default(false),
|
|
60645
60742
|
/** Every Allow and lease needs a passkey, Touch ID or Face ID proof, never a plain tap. */
|
|
60646
60743
|
deviceApproval: external_exports.boolean().optional(),
|
|
60647
60744
|
fieldNames: external_exports.array(vaultFieldNameSchema),
|
|
@@ -60674,6 +60771,7 @@ var createVaultConnectionInputSchemaDefinition = external_exports.object({
|
|
|
60674
60771
|
approverUserIds: external_exports.array(external_exports.string().min(1)).default([]),
|
|
60675
60772
|
maxLeaseSeconds: external_exports.number().int().positive().max(VAULT_LONGEST_LEASE_SECONDS).nullable().default(null),
|
|
60676
60773
|
everyUseAsks: external_exports.boolean().default(false),
|
|
60774
|
+
localUse: external_exports.boolean().default(false),
|
|
60677
60775
|
secret: vaultSecretBundleSchema,
|
|
60678
60776
|
egress: vaultEgressTargetSchema.nullable().default(null)
|
|
60679
60777
|
});
|
|
@@ -60687,6 +60785,7 @@ var updateVaultConnectionInputSchemaDefinition = external_exports.object({
|
|
|
60687
60785
|
approverUserIds: external_exports.array(external_exports.string().min(1)).optional(),
|
|
60688
60786
|
maxLeaseSeconds: external_exports.number().int().positive().max(VAULT_LONGEST_LEASE_SECONDS).nullable().optional(),
|
|
60689
60787
|
everyUseAsks: external_exports.boolean().optional(),
|
|
60788
|
+
localUse: external_exports.boolean().optional(),
|
|
60690
60789
|
/** On from anywhere; off only from the page, with a fresh device proof. */
|
|
60691
60790
|
deviceApproval: external_exports.boolean().optional(),
|
|
60692
60791
|
secret: vaultSecretBundleSchema.optional(),
|
|
@@ -60918,7 +61017,11 @@ var vaultEgressResolveInputSchemaDefinition = external_exports.object({
|
|
|
60918
61017
|
/** A floor the proxy sets for a guarded request, such as a git push asking before it goes. */
|
|
60919
61018
|
atLeast: vaultSensitivitySchema.optional(),
|
|
60920
61019
|
/** What the proxy knows the request is, such as "git push to github.com/acme/widgets". */
|
|
60921
|
-
reason: external_exports.string().max(300).optional()
|
|
61020
|
+
reason: external_exports.string().max(300).optional(),
|
|
61021
|
+
/** The proxy read the body as a read, such as a GraphQL document of queries only. */
|
|
61022
|
+
readOnly: external_exports.boolean().optional(),
|
|
61023
|
+
/** The read the proxy found, such as "GraphQL query PullRequestByNumber". */
|
|
61024
|
+
operation: external_exports.string().max(120).optional()
|
|
60922
61025
|
});
|
|
60923
61026
|
var vaultEgressResolutionSchemaDefinition = external_exports.discriminatedUnion("decision", [
|
|
60924
61027
|
external_exports.object({ decision: external_exports.literal("allow"), value: external_exports.string() }),
|
|
@@ -61294,11 +61397,13 @@ var vaultCoreTrpc = defineTrpcContract("vault").mutation("createConnection").wit
|
|
|
61294
61397
|
).withOutput(vaultSealedMaterialSchema).query("getSealedApproval").withInput(external_exports.object({ ...workspaceInput.shape, requestId: external_exports.string().min(1) })).withOutput(vaultSealedApprovalSchema).mutation("answerSealedApproval").withInput(answerSealedApprovalInputSchema).withOutput(vaultApprovalRequestSchema).mutation("compareSecret").withInput(compareVaultSecretInputSchema).withOutput(vaultSecretComparisonSchema).mutation("replaceSecretValue").withInput(replaceVaultSecretValueInputSchema).withOutput(vaultConnectionSchema).mutation("savePastedSecret").withInput(external_exports.object({ ...workspaceInput.shape, ...saveVaultPastedSecretBodySchema.shape })).withOutput(vaultPastedSecretSavedSchema).build();
|
|
61295
61398
|
var vaultAgentRuleTrpc = defineTrpcContract("vault").query("listAgentRules").withInput(listVaultAgentRulesInputSchema).withOutput(external_exports.array(vaultAgentRuleEntrySchema)).mutation("setAgentRule").withInput(setVaultAgentRuleInputSchema).withOutput(external_exports.array(vaultAgentRuleEntrySchema)).build();
|
|
61296
61399
|
var vaultTierTrpc = defineTrpcContract("vault").query("tierPolicy").withInput(workspaceInput).withOutput(vaultTierPolicySchema).mutation("setTierSetting").withInput(setVaultTierSettingInputSchema).withOutput(vaultTierPolicySchema).mutation("setSubjectTier").withInput(setVaultSubjectTierInputSchema).withOutput(vaultTierPolicySchema).build();
|
|
61400
|
+
var vaultEgressHostTrpc = defineTrpcContract("vault").query("listEgressHosts").withInput(vaultEgressHostInputSchema.omit({ host: true })).withOutput(external_exports.array(vaultEgressHostSchema)).mutation("addEgressHost").withInput(vaultEgressHostInputSchema).withOutput(external_exports.array(vaultEgressHostSchema)).mutation("removeEgressHost").withInput(vaultEgressHostInputSchema).withOutput(external_exports.array(vaultEgressHostSchema)).build();
|
|
61297
61401
|
var vaultTrpc = joinTrpcContracts(
|
|
61298
61402
|
"vault",
|
|
61299
61403
|
vaultCoreTrpc,
|
|
61300
61404
|
vaultAgentRuleTrpc,
|
|
61301
|
-
vaultTierTrpc
|
|
61405
|
+
vaultTierTrpc,
|
|
61406
|
+
vaultEgressHostTrpc
|
|
61302
61407
|
);
|
|
61303
61408
|
|
|
61304
61409
|
// ../../modules/vault/contract/src/vault.config.ts
|
|
@@ -61312,6 +61417,11 @@ var vaultConfig = Config.define((c) => ({
|
|
|
61312
61417
|
turnTtlMinutes: c.env("VAULT_TURN_TTL_MINUTES", positiveInt.default(1440)),
|
|
61313
61418
|
/** The judge runs only when this is on and its key is set; off, Checked asks a person. */
|
|
61314
61419
|
judgeEnabled: c.env("VAULT_JUDGE_ENABLED", environmentBooleanSchema.default(false)),
|
|
61420
|
+
/**
|
|
61421
|
+
* The judge decides new egress hosts when this is on (it passed its eval on the EU endpoint);
|
|
61422
|
+
* off, every new host asks a person. ADR 20261112-egress-boundary.
|
|
61423
|
+
*/
|
|
61424
|
+
hostJudgeEnabled: c.env("VAULT_HOST_JUDGE_ENABLED", environmentBooleanSchema.default(true)),
|
|
61315
61425
|
judgeTimeoutMs: c.env("VAULT_JUDGE_TIMEOUT_MS", positiveInt.default(2e4)),
|
|
61316
61426
|
/** Where the judge posts /v1/decisions: OpenAI's EU host, or the LangWatch AI gateway. */
|
|
61317
61427
|
judgeBaseUrl: c.env("VAULT_JUDGE_BASE_URL", external_exports.url().default("https://eu.api.openai.com")),
|
|
@@ -61351,49 +61461,6 @@ var vaultConfig = Config.define((c) => ({
|
|
|
61351
61461
|
alertWorkspaceId: c.env("VAULT_ALERT_WORKSPACE_ID", external_exports.string().min(1).optional())
|
|
61352
61462
|
}));
|
|
61353
61463
|
|
|
61354
|
-
// ../../modules/vault/contract/src/vault-levels.ts
|
|
61355
|
-
var LEVEL_LABELS = {
|
|
61356
|
-
auto: "Allow",
|
|
61357
|
-
checked: "Auto",
|
|
61358
|
-
ask: "Always ask",
|
|
61359
|
-
human_only: "Human only"
|
|
61360
|
-
};
|
|
61361
|
-
function vaultLevelLabel(level2) {
|
|
61362
|
-
return LEVEL_LABELS[level2];
|
|
61363
|
-
}
|
|
61364
|
-
var CLI_LEVELS = {
|
|
61365
|
-
auto: "allow",
|
|
61366
|
-
checked: "auto",
|
|
61367
|
-
ask: "always-ask",
|
|
61368
|
-
human_only: "human-only"
|
|
61369
|
-
};
|
|
61370
|
-
var VAULT_CLI_LEVEL_NAMES = [
|
|
61371
|
-
"allow",
|
|
61372
|
-
"auto",
|
|
61373
|
-
"always-ask",
|
|
61374
|
-
"human-only"
|
|
61375
|
-
];
|
|
61376
|
-
function vaultCliLevelOf(level2) {
|
|
61377
|
-
return CLI_LEVELS[level2];
|
|
61378
|
-
}
|
|
61379
|
-
function vaultLevelOfCliName(name3) {
|
|
61380
|
-
const wanted = name3.toLowerCase();
|
|
61381
|
-
const found = Object.keys(CLI_LEVELS).find(
|
|
61382
|
-
(level2) => CLI_LEVELS[level2] === wanted
|
|
61383
|
-
);
|
|
61384
|
-
return found ?? "unknown";
|
|
61385
|
-
}
|
|
61386
|
-
|
|
61387
|
-
// ../../modules/vault/contract/src/vault.errors.ts
|
|
61388
|
-
var VaultSealMismatchError = class extends HandledError {
|
|
61389
|
-
constructor() {
|
|
61390
|
-
super("vault_seal_mismatch", "This sealed value does not belong to the secret it names", {
|
|
61391
|
-
httpStatus: 422
|
|
61392
|
-
});
|
|
61393
|
-
this.name = "VaultSealMismatchError";
|
|
61394
|
-
}
|
|
61395
|
-
};
|
|
61396
|
-
|
|
61397
61464
|
// ../../modules/vault/contract/src/vault.events.ts
|
|
61398
61465
|
var vaultApprovalRequestedPayloadSchemaDefinition = external_exports.object({
|
|
61399
61466
|
workspaceId: external_exports.string().min(1),
|
|
@@ -61799,6 +61866,16 @@ var vaultAlertRaisedPayloadSchemaDefinition = external_exports.object({
|
|
|
61799
61866
|
recipientUserIds: external_exports.array(external_exports.string().min(1)),
|
|
61800
61867
|
at: external_exports.iso.datetime()
|
|
61801
61868
|
});
|
|
61869
|
+
var vaultOpsAlertSchemaDefinition = external_exports.object({
|
|
61870
|
+
/** When vaultd (or the vault) raised it, not when Laze recorded it. */
|
|
61871
|
+
at: external_exports.iso.datetime(),
|
|
61872
|
+
seq: external_exports.number().int().nonnegative().nullable(),
|
|
61873
|
+
kind: external_exports.string().min(1),
|
|
61874
|
+
/** The workspace the alert is about; null for a total or a process alert. */
|
|
61875
|
+
subjectWorkspaceId: external_exports.string().min(1).nullable(),
|
|
61876
|
+
/** Counts, windows, uses and caller labels as vaultd sent them: never a value or an AAD. */
|
|
61877
|
+
detail: vaultAlertDetailSchema
|
|
61878
|
+
});
|
|
61802
61879
|
|
|
61803
61880
|
// ../../modules/vault/contract/src/vault-pending.ts
|
|
61804
61881
|
var connectionName2 = external_exports.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/);
|
|
@@ -62366,6 +62443,11 @@ var vaultBatchReleaseInputSchemaDefinition = external_exports.object({
|
|
|
62366
62443
|
...batchFieldsDefinition
|
|
62367
62444
|
});
|
|
62368
62445
|
var vaultBatchReleaseInputSchema = vaultBatchReleaseInputSchemaDefinition;
|
|
62446
|
+
var vaultEgressBatchReleaseInputSchemaDefinition = external_exports.object({
|
|
62447
|
+
...vaultBatchReleaseInputSchemaDefinition.shape,
|
|
62448
|
+
/** The computer holds placeholders: a key swapped at the boundary comes back as `boundary`. */
|
|
62449
|
+
placeholders: external_exports.boolean().default(false)
|
|
62450
|
+
});
|
|
62369
62451
|
var vaultBatchConnectionSchemaDefinition = external_exports.object({
|
|
62370
62452
|
name: vaultConnectionNameSchema,
|
|
62371
62453
|
label: external_exports.string(),
|
|
@@ -62377,7 +62459,9 @@ var vaultBatchConnectionSchema = vaultBatchConnectionSchemaDefinition;
|
|
|
62377
62459
|
var vaultBatchEntrySchemaDefinition = external_exports.object({
|
|
62378
62460
|
ref: external_exports.string(),
|
|
62379
62461
|
connection: vaultBatchConnectionSchema.nullable(),
|
|
62380
|
-
release: vaultRunReleaseSchema.nullable()
|
|
62462
|
+
release: vaultRunReleaseSchema.nullable(),
|
|
62463
|
+
/** The key is swapped at the egress boundary: the computer's own placeholder stands in for it. */
|
|
62464
|
+
boundary: external_exports.object({ connectionId: external_exports.string() }).optional()
|
|
62381
62465
|
});
|
|
62382
62466
|
var vaultBatchEntrySchema = vaultBatchEntrySchemaDefinition;
|
|
62383
62467
|
var vaultBatchReleaseSchemaDefinition = external_exports.object({
|
|
@@ -64413,6 +64497,30 @@ var forgetMirroredInputSchemaDefinition = external_exports.object({
|
|
|
64413
64497
|
before: external_exports.iso.datetime(),
|
|
64414
64498
|
limit: external_exports.number().int().positive().max(1e3).default(500)
|
|
64415
64499
|
});
|
|
64500
|
+
var listMirroredMessagesInputSchemaDefinition = external_exports.object({
|
|
64501
|
+
workspaceId: workspaceIdSchema,
|
|
64502
|
+
channelId: idSchema4,
|
|
64503
|
+
since: external_exports.iso.datetime(),
|
|
64504
|
+
/** Messages numbered above this one; 0 starts at the first. */
|
|
64505
|
+
afterSeq: external_exports.number().int().nonnegative().default(0),
|
|
64506
|
+
limit: external_exports.number().int().min(1).max(500).default(200)
|
|
64507
|
+
});
|
|
64508
|
+
var mirroredMessagesPageSchemaDefinition = external_exports.object({
|
|
64509
|
+
messages: external_exports.array(
|
|
64510
|
+
external_exports.object({
|
|
64511
|
+
seq: external_exports.number().int(),
|
|
64512
|
+
originKey: external_exports.string(),
|
|
64513
|
+
createdAt: external_exports.iso.datetime(),
|
|
64514
|
+
/** The Laze person who wrote it through the mirror, such as the owner; null for others. */
|
|
64515
|
+
personId: external_exports.string().nullable(),
|
|
64516
|
+
/** The name the source gave its author; empty when it gave none. */
|
|
64517
|
+
authorName: external_exports.string(),
|
|
64518
|
+
body: external_exports.string()
|
|
64519
|
+
})
|
|
64520
|
+
),
|
|
64521
|
+
/** The `afterSeq` that reads on; null on the last page. */
|
|
64522
|
+
nextSeq: external_exports.number().int().nullable()
|
|
64523
|
+
});
|
|
64416
64524
|
var mirrorUnreadsInputSchemaDefinition = external_exports.object({
|
|
64417
64525
|
workspaceId: workspaceIdSchema,
|
|
64418
64526
|
userId: idSchema4,
|
|
@@ -65202,7 +65310,7 @@ var apnsPayloadSchemaDefinition = external_exports.object({
|
|
|
65202
65310
|
badge: external_exports.number().int().nonnegative().optional(),
|
|
65203
65311
|
/** Who a message alert is from, for a communication notification with their picture. */
|
|
65204
65312
|
sender: apnsSenderSchemaDefinition.optional(),
|
|
65205
|
-
/**
|
|
65313
|
+
/** Where a message alert was said ("#ops", a conversation, a group DM), to group it under. */
|
|
65206
65314
|
conversationName: external_exports.string().min(2).max(120).optional()
|
|
65207
65315
|
}).strict();
|
|
65208
65316
|
|
|
@@ -67405,6 +67513,17 @@ var egressConnectionSchemaDefinition = external_exports.object({
|
|
|
67405
67513
|
message: "A connection holds a secret or is the vault's, never both"
|
|
67406
67514
|
});
|
|
67407
67515
|
var egressConnectionSchema = egressConnectionSchemaDefinition;
|
|
67516
|
+
var boundaryKeySchemaDefinition = external_exports.object({
|
|
67517
|
+
connectionId: external_exports.string().min(1),
|
|
67518
|
+
name: external_exports.string().min(1),
|
|
67519
|
+
field: external_exports.string().min(1),
|
|
67520
|
+
shape: external_exports.object({
|
|
67521
|
+
kept: external_exports.string().max(8),
|
|
67522
|
+
classes: external_exports.string().regex(/^[luds]*$/),
|
|
67523
|
+
symbols: external_exports.string()
|
|
67524
|
+
})
|
|
67525
|
+
});
|
|
67526
|
+
var BOUNDARY_KEYS_MAX = 1e3;
|
|
67408
67527
|
var claudeGatewayModelsSchemaDefinition = external_exports.object({
|
|
67409
67528
|
opus: external_exports.string().min(1),
|
|
67410
67529
|
sonnet: external_exports.string().min(1),
|
|
@@ -67440,6 +67559,8 @@ var agentSandboxSpecSchemaDefinition = external_exports.object({
|
|
|
67440
67559
|
/** The harness model's context window, when Laze knows it: compaction is set against it. */
|
|
67441
67560
|
contextWindow: external_exports.number().int().positive().optional(),
|
|
67442
67561
|
connections: external_exports.array(egressConnectionSchema).default([]),
|
|
67562
|
+
/** Vault keys swapped at the egress boundary; only for an agent in a Laze computer. */
|
|
67563
|
+
boundaryKeys: external_exports.array(boundaryKeySchemaDefinition).max(BOUNDARY_KEYS_MAX).optional(),
|
|
67443
67564
|
/** Harness credentials that must live inside the sandbox (a user's own subscription token). */
|
|
67444
67565
|
harnessEnvironment: external_exports.record(external_exports.string(), external_exports.string()).default({}),
|
|
67445
67566
|
/** Files the supervisor writes under the home folder at every start, by relative path. */
|
|
@@ -67991,7 +68112,7 @@ var agentRuntimeConfig = Config.define((c) => ({
|
|
|
67991
68112
|
* run on their owners' machines. */
|
|
67992
68113
|
vmdSocketPath: c.env("AGENT_RUNTIME_VMD_SOCKET", external_exports.string().min(1).optional()),
|
|
67993
68114
|
/** The agent image vmd's base image is built from; a new one makes every computer anew. */
|
|
67994
|
-
image: c.env("AGENT_RUNTIME_IMAGE", external_exports.string().default("laze-agent:m5-rush-
|
|
68115
|
+
image: c.env("AGENT_RUNTIME_IMAGE", external_exports.string().default("laze-agent:m5-rush-8")),
|
|
67995
68116
|
supervisorBundlePath: c.env(
|
|
67996
68117
|
"AGENT_RUNTIME_SUPERVISOR_BUNDLE",
|
|
67997
68118
|
external_exports.string().default("/opt/laze/agent-supervisor/supervisor.mjs")
|
|
@@ -68456,7 +68577,12 @@ var agentReconnectSchemaDefinition = external_exports.discriminatedUnion("connec
|
|
|
68456
68577
|
/** The session's folder, for its owner alone; null when unknown. */
|
|
68457
68578
|
folder: external_exports.string().nullable(),
|
|
68458
68579
|
/** The session's machine, for its owner alone; null when unknown. */
|
|
68459
|
-
machine: external_exports.string().nullable()
|
|
68580
|
+
machine: external_exports.string().nullable(),
|
|
68581
|
+
/**
|
|
68582
|
+
* For its owner alone: whether Laze still takes the agent's key, so Reconnect asks the
|
|
68583
|
+
* session to check itself first and makes a new link only for a key that no longer works.
|
|
68584
|
+
*/
|
|
68585
|
+
keyWorks: external_exports.boolean().optional()
|
|
68460
68586
|
})
|
|
68461
68587
|
]);
|
|
68462
68588
|
var agentReconnectSchema = agentReconnectSchemaDefinition;
|
|
@@ -71149,6 +71275,10 @@ var remoteHttpRequestSchemaDefinition = external_exports.object({
|
|
|
71149
71275
|
host: external_exports.string().optional(),
|
|
71150
71276
|
/** This api process on loopback, where the MCP tools call the REST operations. */
|
|
71151
71277
|
loopbackOrigin: external_exports.string(),
|
|
71278
|
+
/** The `DPoP` header: a person's CLI key proves its machine on the request itself. */
|
|
71279
|
+
proof: external_exports.string().optional(),
|
|
71280
|
+
/** The caller's address behind the deployment's own hops. */
|
|
71281
|
+
clientAddress: external_exports.string().optional(),
|
|
71152
71282
|
/** The MCP-Protocol-Version, Mcp-Method and Mcp-Name headers, which 2026-07-28 checks. */
|
|
71153
71283
|
mcpProtocolVersion: external_exports.string().optional(),
|
|
71154
71284
|
mcpMethod: external_exports.string().optional(),
|
|
@@ -73517,7 +73647,7 @@ async function reportMachine({
|
|
|
73517
73647
|
function markMigratedOn({ context, profile }) {
|
|
73518
73648
|
return async ({ notice, link: link2 }) => context.store.markMigrated({ name: profile, migrated: { at: context.nowMs(), link: link2, notice } });
|
|
73519
73649
|
}
|
|
73520
|
-
var REFUSED_RECHECK_MS =
|
|
73650
|
+
var REFUSED_RECHECK_MS = 10 * 60 * 1e3;
|
|
73521
73651
|
function markRefusedOn({
|
|
73522
73652
|
context,
|
|
73523
73653
|
profile,
|
|
@@ -78075,17 +78205,23 @@ async function rearmRushGuards({ context }) {
|
|
|
78075
78205
|
// src/services/rush-watchdog.service.ts
|
|
78076
78206
|
var UNDELIVERED_AFTER_MS = 6e4;
|
|
78077
78207
|
var CHECK_TIMEOUT_MS = 5e3;
|
|
78078
|
-
function clientOf({
|
|
78208
|
+
function clientOf({
|
|
78209
|
+
context,
|
|
78210
|
+
profile,
|
|
78211
|
+
fresh = false
|
|
78212
|
+
}) {
|
|
78079
78213
|
return context.store.read().then((config2) => {
|
|
78080
78214
|
const entry2 = config2.profiles[profile];
|
|
78081
78215
|
if (!entry2 || entry2.migrated) return void 0;
|
|
78082
|
-
if (refusedRecently({ profile: entry2, nowMs: context.nowMs() })) return void 0;
|
|
78216
|
+
if (!fresh && refusedRecently({ profile: entry2, nowMs: context.nowMs() })) return void 0;
|
|
78217
|
+
const clear = () => context.store.markRefused({ name: profile, token: entry2.token, refused: void 0 });
|
|
78083
78218
|
return LazeClient.create({
|
|
78084
78219
|
baseUrl: entry2.url,
|
|
78085
78220
|
token: entry2.token,
|
|
78086
78221
|
fetcher: (input2, init) => context.fetcher(input2, { ...init, signal: AbortSignal.timeout(CHECK_TIMEOUT_MS) }),
|
|
78087
78222
|
onMigrated: markMigratedOn({ context, profile }),
|
|
78088
|
-
onRefused: markRefusedOn({ context, profile, token: entry2.token })
|
|
78223
|
+
onRefused: markRefusedOn({ context, profile, token: entry2.token }),
|
|
78224
|
+
...fresh && entry2.refused ? { onAnswered: clear } : {}
|
|
78089
78225
|
});
|
|
78090
78226
|
});
|
|
78091
78227
|
}
|
|
@@ -78093,9 +78229,9 @@ async function waitingOf({
|
|
|
78093
78229
|
context,
|
|
78094
78230
|
profile
|
|
78095
78231
|
}) {
|
|
78096
|
-
const client = await clientOf({ context, profile });
|
|
78232
|
+
const client = await clientOf({ context, profile, fresh: true });
|
|
78097
78233
|
return client?.get("/api/agents/me/inbox/waiting").catch(
|
|
78098
|
-
(error63) => error63 instanceof LazeApiError && error63
|
|
78234
|
+
(error63) => error63 instanceof LazeApiError && refusesTheKey(error63) ? "refused" : void 0
|
|
78099
78235
|
);
|
|
78100
78236
|
}
|
|
78101
78237
|
function waitedMsOf({ waiting, nowMs: nowMs2 }) {
|
|
@@ -78127,7 +78263,9 @@ async function checkSession({ context, row }) {
|
|
|
78127
78263
|
if (row.standing === "stopped" || !row.noted) return void 0;
|
|
78128
78264
|
const client = await clientOf({ context, profile: row.profile });
|
|
78129
78265
|
if (!client) return void 0;
|
|
78130
|
-
const waiting = await client.get(
|
|
78266
|
+
const waiting = await forSession({ client, session: row.noted.session }).get(
|
|
78267
|
+
"/api/agents/me/inbox/waiting"
|
|
78268
|
+
);
|
|
78131
78269
|
const waited = waitedMsOf({ waiting, nowMs: context.nowMs() });
|
|
78132
78270
|
if (waited <= UNDELIVERED_AFTER_MS) return void 0;
|
|
78133
78271
|
const taken = await claimFor({ context, client, row: { ...row, noted: row.noted } });
|
|
@@ -78618,7 +78756,7 @@ async function status2({ context }) {
|
|
|
78618
78756
|
}
|
|
78619
78757
|
for (const line of await mcpRelayLinesOf({ context })) context.out(`${line}
|
|
78620
78758
|
`);
|
|
78621
|
-
for (const line of await
|
|
78759
|
+
for (const line of await sessionLinesOf({ context, serviceRuns: live })) context.out(`${line}
|
|
78622
78760
|
`);
|
|
78623
78761
|
const config2 = await context.store.read();
|
|
78624
78762
|
const linked = Object.entries(config2.profiles).filter(([, profile]) => profile.delivery);
|
|
@@ -78639,40 +78777,132 @@ async function mcpRelayLinesOf({ context }) {
|
|
|
78639
78777
|
return `${connectionId} ${relay2.label} ${targetLineOf({ target: relay2.target })} ${state}`;
|
|
78640
78778
|
});
|
|
78641
78779
|
}
|
|
78642
|
-
async function
|
|
78780
|
+
async function sessionLinesOf({
|
|
78781
|
+
context,
|
|
78782
|
+
serviceRuns
|
|
78783
|
+
}) {
|
|
78643
78784
|
const lines2 = [...(await sessionNotesOf({ context, tell: false })).dropped];
|
|
78644
|
-
const
|
|
78645
|
-
|
|
78646
|
-
|
|
78647
|
-
|
|
78648
|
-
|
|
78649
|
-
|
|
78650
|
-
|
|
78651
|
-
|
|
78652
|
-
|
|
78785
|
+
const asked = /* @__PURE__ */ new Map();
|
|
78786
|
+
const rush = await rushListenersOf({ context });
|
|
78787
|
+
const plain3 = await plainSessionsOf({ context, skip: new Set(rush.map((row) => row.key)) });
|
|
78788
|
+
const rows = [
|
|
78789
|
+
...rush.map((row) => ({
|
|
78790
|
+
profile: row.profile,
|
|
78791
|
+
key: row.key,
|
|
78792
|
+
line: rushLineOf({ row, serviceRuns }),
|
|
78793
|
+
delivers: rushDelivers({ row, serviceRuns }),
|
|
78794
|
+
where: `rush session ${row.rushId}`
|
|
78795
|
+
})),
|
|
78796
|
+
...plain3.map((row) => ({
|
|
78797
|
+
profile: row.profile,
|
|
78798
|
+
key: row.key,
|
|
78799
|
+
line: plainLineOf({ row }),
|
|
78800
|
+
delivers: row.waiterPid !== void 0,
|
|
78801
|
+
where: row.claudePid ? "that Claude Code session" : `the session, once \`claude --resume ${row.sessionId}\` runs it again`
|
|
78802
|
+
}))
|
|
78803
|
+
];
|
|
78804
|
+
for (const row of rows) {
|
|
78805
|
+
if (!asked.has(row.profile)) {
|
|
78806
|
+
asked.set(row.profile, await waitingOf({ context, profile: row.profile }));
|
|
78807
|
+
}
|
|
78808
|
+
for (const line of rowLinesOf({
|
|
78809
|
+
row,
|
|
78810
|
+
waiting: asked.get(row.profile),
|
|
78811
|
+
nowMs: context.nowMs()
|
|
78812
|
+
})) {
|
|
78813
|
+
if (!lines2.includes(line)) lines2.push(line);
|
|
78814
|
+
}
|
|
78653
78815
|
}
|
|
78654
78816
|
return lines2;
|
|
78655
78817
|
}
|
|
78656
|
-
function
|
|
78818
|
+
function rowLinesOf({
|
|
78819
|
+
row,
|
|
78820
|
+
waiting,
|
|
78821
|
+
nowMs: nowMs2
|
|
78822
|
+
}) {
|
|
78823
|
+
if (waiting === "refused") return [revokedKeyLineOf({ profile: row.profile })];
|
|
78824
|
+
const next = nextStepOf({ ...row, waiting });
|
|
78825
|
+
return [`${row.line}${inLazeOf({ row, waiting, nowMs: nowMs2 })}`, ...next ? [` next: ${next}`] : []];
|
|
78826
|
+
}
|
|
78827
|
+
function rushDelivers({ row, serviceRuns }) {
|
|
78828
|
+
if (row.standing === "stopped") return false;
|
|
78829
|
+
if (row.waiterPid || row.listenerPid) return true;
|
|
78830
|
+
return serviceRuns && row.noted !== void 0;
|
|
78831
|
+
}
|
|
78832
|
+
function nextStepOf({
|
|
78833
|
+
profile,
|
|
78834
|
+
key,
|
|
78835
|
+
waiting,
|
|
78836
|
+
delivers,
|
|
78837
|
+
where
|
|
78838
|
+
}) {
|
|
78839
|
+
const bind = `\`laze agent bind --profile ${profile}\``;
|
|
78840
|
+
if (!waiting)
|
|
78841
|
+
return delivers ? void 0 : "Laze did not answer: run `laze connect status` again";
|
|
78842
|
+
if (boundAwayOf({ waiting, key })) {
|
|
78843
|
+
return `messages go to the session Laze binds it to; only its person moves it here, with ${bind} inside ${where}`;
|
|
78844
|
+
}
|
|
78845
|
+
if (delivers) return void 0;
|
|
78846
|
+
return `run ${bind} inside ${where}: its key works, and this keeps the agent in this session and starts its listener again`;
|
|
78847
|
+
}
|
|
78848
|
+
function rushLineOf({ row, serviceRuns }) {
|
|
78657
78849
|
const head = `${row.profile} Claude Code in rush ${row.rushId} ${row.standing}`;
|
|
78658
78850
|
if (row.standing === "awake" && row.waiterPid) {
|
|
78659
78851
|
return `${head}, its Claude Code delivers (waiter pid ${row.waiterPid})`;
|
|
78660
78852
|
}
|
|
78661
|
-
if (row.standing === "awake") {
|
|
78853
|
+
if (row.standing === "awake" && serviceRuns && row.noted) {
|
|
78662
78854
|
return `${head}, no hook waiter right now: the connect service hands over what waits over ${UNDELIVERED_AFTER_MS / 1e3}s`;
|
|
78663
78855
|
}
|
|
78856
|
+
if (row.standing === "awake") {
|
|
78857
|
+
const why = serviceRuns ? "no hook has noted this session" : "the connect service does not run";
|
|
78858
|
+
return `${head}, NO LISTENER: no hook waiter, and ${why}, so messages wait in Laze`;
|
|
78859
|
+
}
|
|
78664
78860
|
if (row.standing === "stopped") return `${head}, gets messages when rush starts it again`;
|
|
78665
78861
|
if (row.listenerPid) return `${head}, guard pid ${row.listenerPid}`;
|
|
78666
78862
|
return `${head}, NO LISTENER: messages wait in Laze; \`laze connect install\` brings a guard back`;
|
|
78667
78863
|
}
|
|
78864
|
+
async function plainSessionsOf({
|
|
78865
|
+
context,
|
|
78866
|
+
skip
|
|
78867
|
+
}) {
|
|
78868
|
+
const config2 = await context.store.read();
|
|
78869
|
+
const { notes } = await sessionNotesOf({ context, tell: false });
|
|
78870
|
+
const rows = [];
|
|
78871
|
+
for (const [key, profile] of Object.entries(config2.sessions ?? {})) {
|
|
78872
|
+
const entry2 = config2.profiles[profile];
|
|
78873
|
+
if (!key.startsWith("claude-code:") || skip.has(key) || !entry2 || entry2.migrated) continue;
|
|
78874
|
+
const sessionId = key.slice("claude-code:".length);
|
|
78875
|
+
const running = notes.find(
|
|
78876
|
+
(each) => each.note.sessionId === sessionId && each.standing === "live"
|
|
78877
|
+
);
|
|
78878
|
+
const waiter = await readJson({
|
|
78879
|
+
path: statePathOf({ context, kind: "waiters", profile })
|
|
78880
|
+
});
|
|
78881
|
+
const waiterPid = waiter?.sessionId === sessionId && context.processes.alive(waiter.pid) ? waiter.pid : void 0;
|
|
78882
|
+
rows.push({
|
|
78883
|
+
profile,
|
|
78884
|
+
key,
|
|
78885
|
+
sessionId,
|
|
78886
|
+
...running ? { claudePid: running.pid } : {},
|
|
78887
|
+
...waiterPid ? { waiterPid } : {}
|
|
78888
|
+
});
|
|
78889
|
+
}
|
|
78890
|
+
return rows;
|
|
78891
|
+
}
|
|
78892
|
+
function plainLineOf({ row }) {
|
|
78893
|
+
const head = `${row.profile} Claude Code session ${row.sessionId}`;
|
|
78894
|
+
if (row.waiterPid) return `${head} its Claude Code delivers (waiter pid ${row.waiterPid})`;
|
|
78895
|
+
if (row.claudePid) return `${head} Claude Code pid ${row.claudePid} runs it, NO LISTENER`;
|
|
78896
|
+
return `${head} not running: messages wait in Laze until it runs again`;
|
|
78897
|
+
}
|
|
78668
78898
|
function inLazeOf({
|
|
78669
78899
|
row,
|
|
78670
78900
|
waiting,
|
|
78671
78901
|
nowMs: nowMs2
|
|
78672
78902
|
}) {
|
|
78673
|
-
if (!waiting) return "; Laze
|
|
78903
|
+
if (!waiting) return "; Laze did not answer, so its key and binding are unknown";
|
|
78674
78904
|
const away = boundAwayOf({ waiting, key: row.key });
|
|
78675
|
-
const bound = away ? `; Laze binds the agent to ${away}, not this session` : ""
|
|
78905
|
+
const bound = away ? `; key works; Laze binds the agent to ${away}, not this session` : `; key works, bound ${waiting.session ? "here" : "to no session"} in Laze`;
|
|
78676
78906
|
const waited = waitedMsOf({ waiting, nowMs: nowMs2 });
|
|
78677
78907
|
if (waiting.count === 0) return bound;
|
|
78678
78908
|
const age = `the oldest for ${Math.round(waited / 1e3)}s`;
|
|
@@ -78871,8 +79101,8 @@ async function waitForMessages({ context, args }) {
|
|
|
78871
79101
|
const claudePid = await claudePidOf({ context });
|
|
78872
79102
|
const named = await pluginHookArgs({ context, args, session, claudePid, source: input2.source });
|
|
78873
79103
|
if (!named) return 0;
|
|
78874
|
-
const { client, name: name3 } = await signedIn({ context, args: named });
|
|
78875
79104
|
await rememberSession({ context, claudePid, session });
|
|
79105
|
+
const { client, name: name3 } = await signedIn({ context, args: named });
|
|
78876
79106
|
const rush = claudePid ? await rushAboveOf({ context, from: claudePid }) : void 0;
|
|
78877
79107
|
if (rush) await startRushGuard({ context, profile: name3, claudePid, rush });
|
|
78878
79108
|
if (rush) await healRushDelivery({ context });
|
|
@@ -78940,7 +79170,7 @@ async function refusedOnce({
|
|
|
78940
79170
|
}
|
|
78941
79171
|
await writeStateText({ path, text: String(context.nowMs()) });
|
|
78942
79172
|
context.err(
|
|
78943
|
-
`Laze: Laze refused this agent's key (${String(error63)}), so messages no longer reach this session.
|
|
79173
|
+
`Laze: Laze refused this agent's key (${String(error63)}), so messages no longer reach this session. ${revokedKeyLineOf({ profile })}
|
|
78944
79174
|
`
|
|
78945
79175
|
);
|
|
78946
79176
|
return 2;
|
|
@@ -81913,23 +82143,27 @@ async function bindAgentSession({
|
|
|
81913
82143
|
if (!target) throw new CliUsageError(NO_AGENT);
|
|
81914
82144
|
const named = { ...args, flags: { ...args.flags, profile: target } };
|
|
81915
82145
|
const { client, name: name3, profile } = await signedIn({ context, args: named });
|
|
82146
|
+
const before = await client.get("/api/agents/me/inbox/waiting").catch(() => void 0);
|
|
82147
|
+
const already = before?.session ? `${before.session.harness}:${before.session.sessionId}` === key : false;
|
|
81916
82148
|
await forSession({ client, session }).post("/api/agents/me/bind", {});
|
|
81917
82149
|
await context.store.bindSession({ session: key, profile: name3 });
|
|
81918
82150
|
const where = `profile ${name3}, config ${context.environment.configPath}`;
|
|
81919
82151
|
const from = own2 && own2 !== name3 ? ` It moved from "${config2.profiles[own2]?.name}".` : "";
|
|
81920
82152
|
const listener = await listenerOfBound({ context, args, name: name3, harness: session.harness });
|
|
81921
82153
|
if (listener !== "none") {
|
|
81922
|
-
context.out(
|
|
81923
|
-
`);
|
|
82154
|
+
context.out(
|
|
82155
|
+
already ? `"${profile.name}" already listens in this session (${where}); its listener runs again.
|
|
82156
|
+
` : `"${profile.name}" now listens in this session (${where}).${from}
|
|
82157
|
+
`
|
|
82158
|
+
);
|
|
81924
82159
|
return;
|
|
81925
82160
|
}
|
|
81926
82161
|
const { command: laze } = await rerunCommandOf({ context });
|
|
81927
82162
|
const lines2 = noListenerLinesOf({ laze, profile: name3 });
|
|
81928
|
-
|
|
81929
|
-
|
|
82163
|
+
const head = already ? `"${profile.name}" already listens in this session (${where}).` : `"${profile.name}" is bound to this session (${where}).${from}`;
|
|
82164
|
+
context.out(`${head}
|
|
81930
82165
|
${lines2.join("\n")}
|
|
81931
|
-
`
|
|
81932
|
-
);
|
|
82166
|
+
`);
|
|
81933
82167
|
}
|
|
81934
82168
|
async function listenerOfBound({
|
|
81935
82169
|
context,
|
|
@@ -86351,6 +86585,21 @@ async function serveAppFolder({
|
|
|
86351
86585
|
})
|
|
86352
86586
|
};
|
|
86353
86587
|
}
|
|
86588
|
+
function followingKey({
|
|
86589
|
+
client,
|
|
86590
|
+
reopen
|
|
86591
|
+
}) {
|
|
86592
|
+
let current3 = client;
|
|
86593
|
+
return async (call) => {
|
|
86594
|
+
try {
|
|
86595
|
+
return await call(current3);
|
|
86596
|
+
} catch (error63) {
|
|
86597
|
+
if (!(error63 instanceof LazeApiError) || error63.status !== 401) throw error63;
|
|
86598
|
+
current3 = await reopen();
|
|
86599
|
+
return call(current3);
|
|
86600
|
+
}
|
|
86601
|
+
};
|
|
86602
|
+
}
|
|
86354
86603
|
|
|
86355
86604
|
// src/services/app-trigger-commands.service.ts
|
|
86356
86605
|
var USAGE6 = `Usage:
|
|
@@ -86829,12 +87078,13 @@ var appServe = async ({ context, args }) => {
|
|
|
86829
87078
|
throw new CliUsageError("--port must be a port number");
|
|
86830
87079
|
}
|
|
86831
87080
|
const origin = live.url.replace(/\/+$/, "");
|
|
87081
|
+
const withKey = followingKey({ client, reopen: () => appClient({ context, args }) });
|
|
86832
87082
|
const served = await serveAppFolder({
|
|
86833
87083
|
folder,
|
|
86834
87084
|
port,
|
|
86835
87085
|
backend: {
|
|
86836
|
-
collections: () =>
|
|
86837
|
-
records: (input2) =>
|
|
87086
|
+
collections: () => withKey((now) => now.post("/api/apps/collections", { appId })),
|
|
87087
|
+
records: (input2) => withKey((now) => now.post("/api/apps/records", { appId, ...input2 })),
|
|
86838
87088
|
platformFile: async (path) => {
|
|
86839
87089
|
const answer6 = await context.fetcher(`${origin}${path}`);
|
|
86840
87090
|
return {
|
|
@@ -90171,6 +90421,8 @@ var browserTabDefinition = external_exports.object({
|
|
|
90171
90421
|
createdAt: external_exports.iso.datetime(),
|
|
90172
90422
|
/** Only on an open: an open tab of that title was reused instead of making a second one. */
|
|
90173
90423
|
reused: external_exports.boolean().optional(),
|
|
90424
|
+
/** Only on a read: the site the owner's dedicated IP last failed to reach, lately. */
|
|
90425
|
+
routeFailure: external_exports.object({ host: external_exports.string().min(1), at: external_exports.iso.datetime() }).nullable().optional(),
|
|
90174
90426
|
/** What the reader may do: see the screen, type into it, change the tab; asked: the open
|
|
90175
90427
|
* request names them. */
|
|
90176
90428
|
you: external_exports.object({
|
|
@@ -90209,6 +90461,12 @@ var gotoDefinition = external_exports.object({
|
|
|
90209
90461
|
url: external_exports.string().trim().min(1).max(4096)
|
|
90210
90462
|
});
|
|
90211
90463
|
var browserTabGotoInputSchema = gotoDefinition;
|
|
90464
|
+
var browserTabStepSchema = external_exports.enum(["back", "forward", "reload"]);
|
|
90465
|
+
var stepDefinition = external_exports.object({
|
|
90466
|
+
...browserTabRefDefinition.shape,
|
|
90467
|
+
step: browserTabStepSchema
|
|
90468
|
+
});
|
|
90469
|
+
var browserTabStepInputSchema = stepDefinition;
|
|
90212
90470
|
var askDefinition = external_exports.object({
|
|
90213
90471
|
...browserTabRefDefinition.shape,
|
|
90214
90472
|
text: external_exports.string().trim().min(1).max(500)
|
|
@@ -92106,6 +92364,39 @@ var agentHostGrantDefinition = external_exports.object({
|
|
|
92106
92364
|
expiresAt: external_exports.iso.datetime()
|
|
92107
92365
|
});
|
|
92108
92366
|
|
|
92367
|
+
// ../../modules/compute/contract/src/whatsapp-history.ts
|
|
92368
|
+
var WHATSAPP_HISTORY_PATH = "/api/compute/whatsapp/history";
|
|
92369
|
+
var historyInputDefinition = external_exports.object({
|
|
92370
|
+
workspaceId: external_exports.string().min(1).max(64),
|
|
92371
|
+
/** The Laze conversation that mirrors the chat. */
|
|
92372
|
+
channelId: external_exports.string().min(1).max(64),
|
|
92373
|
+
/** The page holds messages written before this time. */
|
|
92374
|
+
before: external_exports.iso.datetime({ offset: true })
|
|
92375
|
+
});
|
|
92376
|
+
var whatsappHistoryInputSchema = historyInputDefinition;
|
|
92377
|
+
var historyByKeyInputDefinition = historyInputDefinition.omit({ workspaceId: true });
|
|
92378
|
+
var historyMessageDefinition = external_exports.object({
|
|
92379
|
+
/** The same key a cached copy of the message carries. */
|
|
92380
|
+
key: external_exports.string().min(1),
|
|
92381
|
+
createdAt: external_exports.iso.datetime(),
|
|
92382
|
+
authorName: external_exports.string(),
|
|
92383
|
+
authorAvatarUrl: external_exports.null(),
|
|
92384
|
+
/** The owner, for their own messages; else null. */
|
|
92385
|
+
authorUserId: external_exports.string().nullable(),
|
|
92386
|
+
/** The chat's outside author id, as the cached copies carry it; null for the owner. */
|
|
92387
|
+
authorExternalId: external_exports.string().nullable(),
|
|
92388
|
+
/** Laze markdown; a file is named, and opens on the phone. */
|
|
92389
|
+
body: external_exports.string(),
|
|
92390
|
+
replyCount: external_exports.literal(0),
|
|
92391
|
+
files: external_exports.array(external_exports.never())
|
|
92392
|
+
});
|
|
92393
|
+
var historyPageDefinition = external_exports.object({
|
|
92394
|
+
/** Oldest first. */
|
|
92395
|
+
messages: external_exports.array(historyMessageDefinition),
|
|
92396
|
+
hasOlder: external_exports.boolean()
|
|
92397
|
+
});
|
|
92398
|
+
var whatsappHistoryPageSchema = historyPageDefinition;
|
|
92399
|
+
|
|
92109
92400
|
// ../../modules/compute/contract/src/compute.ts
|
|
92110
92401
|
var idSchema26 = external_exports.string().min(1).max(64);
|
|
92111
92402
|
var workspaceIdSchema23 = external_exports.string().min(1).max(64);
|
|
@@ -92301,10 +92592,12 @@ var ownMachineSshConnectDefinition = external_exports.object({
|
|
|
92301
92592
|
var ownMachineSshConnectSchema = ownMachineSshConnectDefinition;
|
|
92302
92593
|
var reconcileDefinition = external_exports.object({ workspaceId: workspaceIdSchema23, machineId: idSchema26 });
|
|
92303
92594
|
var ComputeApi = moduleApi()("compute");
|
|
92304
|
-
var
|
|
92305
|
-
var
|
|
92595
|
+
var computeBrowserTabTrpc = defineTrpcContract("compute").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("sizeBrowserTabScreen").withInput(browserTabScreenSizeInputSchema).withOutput(browserTabScreenSizeSchema).mutation("gotoBrowserTab").withInput(browserTabGotoInputSchema).withOutput(browserTabPageSchema).mutation("stepBrowserTab").withInput(browserTabStepInputSchema).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) })).build();
|
|
92596
|
+
var computeCoreTrpc = defineTrpcContract("compute").query("status").withInput(computeWorkspaceInputSchema).withOutput(computeStatusSchema).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("openLoginTerminal").withInput(openLoginTerminalInputSchema).withOutput(loginTerminalSchema).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(whatsappPairInputSchema).withOutput(whatsappPairingSchema).query("whatsappMirror").withInput(machineRefSchema).withOutput(whatsappMirrorSettingsSchema).mutation("setWhatsappMirror").withInput(setWhatsappMirrorInputSchema).withOutput(whatsappMirrorSettingsSchema).query("whatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("cancelWhatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("unpairWhatsapp").withInput(machineRefSchema).withOutput(machineSchema).build();
|
|
92597
|
+
var computeFleetTrpc = defineTrpcContract("compute").query("whatsappComputer").withInput(whatsappComputerInputSchema).withOutput(whatsappComputerSchema).mutation("prepareWhatsappComputer").withInput(whatsappComputerInputSchema).withOutput(whatsappComputerSchema).mutation("warmComputer").withInput(computeWorkspaceInputSchema).withOutput(warmComputerSchema).query("myComputers").withInput(computeWorkspaceInputSchema).withOutput(myComputersSchema).query("personComputer").withInput(personComputerInputSchema).withOutput(computerUseSchema2).mutation("createComputer").withInput(createComputerInputSchema).withOutput(computerStatusSchema).mutation("deleteComputer").withInput(deleteComputerInputSchema).withOutput(deleteComputerAnswerSchema).mutation("setComputerCreators").withInput(setComputerCreatorsInputSchema).withOutput(computerStatusSchema).mutation("setAgentComputer").withInput(setAgentComputerInputSchema).withOutput(agentComputerAnswerSchema).query("whatsappAgents").withInput(machineRefSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappAgent").withInput(setWhatsappAgentInputSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappAgentLease").withInput(setWhatsappAgentLeaseInputSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappEveryAgent").withInput(setWhatsappEveryAgentInputSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappAgentAccess").withInput(setWhatsappAgentAccessInputSchema).withOutput(whatsappAgentsSchema).mutation("checkWhatsappNow").withInput(machineRefSchema).withOutput(whatsappMirrorSettingsSchema).query("whatsappChatPeople").withInput(whatsappChatPeopleInputSchema).withOutput(whatsappChatPeopleSchema).query("whatsappHistory").withInput(whatsappHistoryInputSchema).withOutput(whatsappHistoryPageSchema).mutation("watchWhatsappChat").withInput(whatsappWatchInputSchema).withOutput(whatsappWatchSchema).mutation("checkWhatsappReply").withInput(whatsappReplyCheckInputSchema).withOutput(whatsappReplyCheckSchema).build();
|
|
92306
92598
|
var computeTrpc = joinTrpcContracts(
|
|
92307
92599
|
"compute",
|
|
92600
|
+
computeBrowserTabTrpc,
|
|
92308
92601
|
computeCoreTrpc,
|
|
92309
92602
|
computeFleetTrpc,
|
|
92310
92603
|
computeWaitlistTrpc
|
|
@@ -92812,7 +93105,23 @@ var whatsappMirrorHealthDefinition = external_exports.object({
|
|
|
92812
93105
|
failureCode: external_exports.string().nullable()
|
|
92813
93106
|
}).nullable(),
|
|
92814
93107
|
/** Intake holds (ADR-216 §11) by kind and code, with when the oldest was made. */
|
|
92815
|
-
holds: external_exports.array(external_exports.object({ kind: external_exports.string(), code: external_exports.string(), count: count11, oldestAt: at4 }))
|
|
93108
|
+
holds: external_exports.array(external_exports.object({ kind: external_exports.string(), code: external_exports.string(), count: count11, oldestAt: at4 })),
|
|
93109
|
+
/**
|
|
93110
|
+
* The computer store's fill (ADR-223): chats done, how many mirrored items from the last 6
|
|
93111
|
+
* months Laze held, those the store held and those sent; the mirrored items Laze holds now
|
|
93112
|
+
* and how many a trim to 7 days after last read would delete. Null before a fill started.
|
|
93113
|
+
*/
|
|
93114
|
+
storeFill: external_exports.object({
|
|
93115
|
+
chats: count11,
|
|
93116
|
+
lazeHeld: count11,
|
|
93117
|
+
alreadyHeld: count11,
|
|
93118
|
+
sent: count11,
|
|
93119
|
+
problem: external_exports.string().nullable(),
|
|
93120
|
+
filledAt: at4.nullable(),
|
|
93121
|
+
updatedAt: at4,
|
|
93122
|
+
mirrored: count11,
|
|
93123
|
+
trimmable: count11
|
|
93124
|
+
}).nullable().optional()
|
|
92816
93125
|
})
|
|
92817
93126
|
)
|
|
92818
93127
|
});
|
|
@@ -92977,7 +93286,18 @@ var computerBrowserFactsDefinition = external_exports.object({
|
|
|
92977
93286
|
openTabs: external_exports.number().int().nonnegative(),
|
|
92978
93287
|
streamsNow: external_exports.number().int().nonnegative(),
|
|
92979
93288
|
/** Since this api process started, newest last, at most 60. */
|
|
92980
|
-
events: external_exports.array(relayEventDefinition).max(60)
|
|
93289
|
+
events: external_exports.array(relayEventDefinition).max(60),
|
|
93290
|
+
/**
|
|
93291
|
+
* Where the browser's traffic leaves: the person's dedicated IP and whether the computer's
|
|
93292
|
+
* browser joins it (only a route for all traffic does), else the shared address.
|
|
93293
|
+
*/
|
|
93294
|
+
egress: external_exports.object({
|
|
93295
|
+
dedicatedIp: external_exports.enum(["none", "off", "pending", "on"]),
|
|
93296
|
+
scope: dedicatedIpScopeSchema.nullable(),
|
|
93297
|
+
countryCode: external_exports.string().max(8).nullable(),
|
|
93298
|
+
onSince: at5.nullable(),
|
|
93299
|
+
browserLeaves: external_exports.enum(["dedicated_ip", "shared_address"])
|
|
93300
|
+
})
|
|
92981
93301
|
});
|
|
92982
93302
|
var computerBrowserFactsSchema = computerBrowserFactsDefinition;
|
|
92983
93303
|
|
|
@@ -93813,11 +94133,11 @@ async function suggestServer({
|
|
|
93813
94133
|
}
|
|
93814
94134
|
|
|
93815
94135
|
// src/services/connector-commands.service.ts
|
|
93816
|
-
import { readFile as
|
|
94136
|
+
import { readFile as readFile24 } from "node:fs/promises";
|
|
93817
94137
|
import { resolve as resolve14 } from "node:path";
|
|
93818
94138
|
|
|
93819
94139
|
// src/services/vault-keychain-commands.service.ts
|
|
93820
|
-
import { readFile as
|
|
94140
|
+
import { readFile as readFile23 } from "node:fs/promises";
|
|
93821
94141
|
|
|
93822
94142
|
// src/rules/vault-input.rules.ts
|
|
93823
94143
|
function secondsOf(text3) {
|
|
@@ -94110,6 +94430,273 @@ var listDevices = async ({ context, args }) => {
|
|
|
94110
94430
|
}
|
|
94111
94431
|
};
|
|
94112
94432
|
|
|
94433
|
+
// src/services/vault-batch.service.ts
|
|
94434
|
+
import { readFile as readFile22, rm as rm16 } from "node:fs/promises";
|
|
94435
|
+
async function placeholdersOf({
|
|
94436
|
+
env
|
|
94437
|
+
}) {
|
|
94438
|
+
const path = env.LAZE_VAULT_PLACEHOLDERS;
|
|
94439
|
+
if (!path || !proxyOf({ env })) return {};
|
|
94440
|
+
try {
|
|
94441
|
+
const parsed = JSON.parse(await readFile22(path, "utf8"));
|
|
94442
|
+
return parsed && typeof parsed === "object" ? parsed : {};
|
|
94443
|
+
} catch {
|
|
94444
|
+
return {};
|
|
94445
|
+
}
|
|
94446
|
+
}
|
|
94447
|
+
async function batchOf({ response }) {
|
|
94448
|
+
const text3 = await response.text();
|
|
94449
|
+
if (!response.ok) {
|
|
94450
|
+
const code4 = /"code"\s*:\s*"([^"]+)"/.exec(text3)?.[1] ?? `status ${response.status}`;
|
|
94451
|
+
throw new CliUsageError(`laze vault: the batch was refused (${code4})`);
|
|
94452
|
+
}
|
|
94453
|
+
return JSON.parse(text3);
|
|
94454
|
+
}
|
|
94455
|
+
async function doorOf({
|
|
94456
|
+
context,
|
|
94457
|
+
args,
|
|
94458
|
+
keyName
|
|
94459
|
+
}) {
|
|
94460
|
+
const env = context.environment.inherited;
|
|
94461
|
+
const proxy = proxyOf({ env });
|
|
94462
|
+
if (proxy) {
|
|
94463
|
+
const turnFile = turnFileOf({ env });
|
|
94464
|
+
const headers = {
|
|
94465
|
+
"proxy-authorization": proxy.authorization,
|
|
94466
|
+
"x-laze-turn": await turnTokenOf2({ env, turnFile, command: "laze vault env" })
|
|
94467
|
+
};
|
|
94468
|
+
return {
|
|
94469
|
+
keyPath: runKeyPathOf({ turnFile, connection: keyName }),
|
|
94470
|
+
ask: async (body) => batchOf({
|
|
94471
|
+
response: await reach({
|
|
94472
|
+
context,
|
|
94473
|
+
url: `${proxy.origin}/vault/release-batch`,
|
|
94474
|
+
init: {
|
|
94475
|
+
method: "POST",
|
|
94476
|
+
headers: { ...headers, "content-type": "application/json" },
|
|
94477
|
+
body: JSON.stringify(body)
|
|
94478
|
+
}
|
|
94479
|
+
})
|
|
94480
|
+
}),
|
|
94481
|
+
status: async (requestId) => releaseOf({
|
|
94482
|
+
response: await reach({
|
|
94483
|
+
context,
|
|
94484
|
+
url: `${proxy.origin}/vault/release/${encodeURIComponent(requestId)}`,
|
|
94485
|
+
init: { method: "GET", headers }
|
|
94486
|
+
})
|
|
94487
|
+
})
|
|
94488
|
+
};
|
|
94489
|
+
}
|
|
94490
|
+
const signed2 = await signedIn({ context, args }).catch(() => null);
|
|
94491
|
+
if (signed2?.profile.kind !== "agent" && signed2?.profile.kind !== "person") {
|
|
94492
|
+
throw new CliUsageError(`laze vault env ${WHERE}`);
|
|
94493
|
+
}
|
|
94494
|
+
const { name: name3 } = signed2;
|
|
94495
|
+
const harnessSession = await currentSessionOf({ context, args });
|
|
94496
|
+
const client = forSession({ client: signed2.client, session: harnessSession });
|
|
94497
|
+
const door = signed2.profile.kind === "person" ? {
|
|
94498
|
+
ask: "/api/vault/session/release-batch",
|
|
94499
|
+
status: "/api/vault/session/release-status",
|
|
94500
|
+
extra: { session: await vaultSessionFor({ context, args, harnessSession }) }
|
|
94501
|
+
} : {
|
|
94502
|
+
ask: "/api/agents/me/vault/release-batch",
|
|
94503
|
+
status: "/api/agents/me/vault/release-status",
|
|
94504
|
+
extra: { channelId: flagText({ args, name: "channel" }) || null }
|
|
94505
|
+
};
|
|
94506
|
+
return {
|
|
94507
|
+
keyPath: runKeyPathOf({ turnFile: void 0, connection: keyName, profile: name3 }),
|
|
94508
|
+
ask: async (body) => {
|
|
94509
|
+
try {
|
|
94510
|
+
return await client.post(door.ask, { ...body, ...door.extra });
|
|
94511
|
+
} catch (error63) {
|
|
94512
|
+
if (!(error63 instanceof LazeApiError)) throw error63;
|
|
94513
|
+
throw new CliUsageError(`laze vault: the batch was refused: ${refusalText(error63)}`);
|
|
94514
|
+
}
|
|
94515
|
+
},
|
|
94516
|
+
status: (requestId) => patiently({
|
|
94517
|
+
context,
|
|
94518
|
+
call: () => client.post(door.status, { requestId, ...door.extra })
|
|
94519
|
+
}).catch(refusedRelease)
|
|
94520
|
+
};
|
|
94521
|
+
}
|
|
94522
|
+
async function resolveBatch({
|
|
94523
|
+
context,
|
|
94524
|
+
args,
|
|
94525
|
+
refs
|
|
94526
|
+
}) {
|
|
94527
|
+
const door = await doorOf({ context, args, keyName: "env-names" });
|
|
94528
|
+
const answer6 = await door.ask({ refs, reason: "", command: [], resolveOnly: true });
|
|
94529
|
+
return answer6.entries;
|
|
94530
|
+
}
|
|
94531
|
+
var keyOf = (entry2) => entry2.connection?.name ?? entry2.ref;
|
|
94532
|
+
async function untilAllAnswered({
|
|
94533
|
+
context,
|
|
94534
|
+
door,
|
|
94535
|
+
waiting,
|
|
94536
|
+
deadline
|
|
94537
|
+
}) {
|
|
94538
|
+
const answered = /* @__PURE__ */ new Map();
|
|
94539
|
+
if (waiting.size === 0) return answered;
|
|
94540
|
+
const [first] = waiting.values();
|
|
94541
|
+
context.err(
|
|
94542
|
+
`laze vault: ${[...waiting.keys()].join(", ")} wait for an answer (${first?.message ?? "a card"}); cards expire after 24 hours...
|
|
94543
|
+
`
|
|
94544
|
+
);
|
|
94545
|
+
while (waiting.size > 0) {
|
|
94546
|
+
if (context.nowMs() + POLL_MS > deadline) {
|
|
94547
|
+
context.err(
|
|
94548
|
+
`laze vault: ${[...waiting.keys()].join(", ")} not approved yet; ask again later.
|
|
94549
|
+
`
|
|
94550
|
+
);
|
|
94551
|
+
return "capped";
|
|
94552
|
+
}
|
|
94553
|
+
await context.sleep(POLL_MS);
|
|
94554
|
+
for (const [key, pending2] of waiting) {
|
|
94555
|
+
const next = await door.status(pending2.requestId);
|
|
94556
|
+
if (next.outcome === "ask") waiting.set(key, next);
|
|
94557
|
+
else {
|
|
94558
|
+
waiting.delete(key);
|
|
94559
|
+
answered.set(key, next);
|
|
94560
|
+
}
|
|
94561
|
+
}
|
|
94562
|
+
}
|
|
94563
|
+
return answered;
|
|
94564
|
+
}
|
|
94565
|
+
async function releaseBatch({
|
|
94566
|
+
context,
|
|
94567
|
+
args,
|
|
94568
|
+
refs,
|
|
94569
|
+
reason: reason2,
|
|
94570
|
+
command
|
|
94571
|
+
}) {
|
|
94572
|
+
const deadline = deadlineOf({ args, nowMs: context.nowMs() });
|
|
94573
|
+
const door = await doorOf({ context, args, keyName: `env:${[...refs].toSorted().join(",")}` });
|
|
94574
|
+
const run4 = await runKeyAt({ path: door.keyPath });
|
|
94575
|
+
const placeholders = await placeholdersOf({ env: context.environment.inherited });
|
|
94576
|
+
let answer6;
|
|
94577
|
+
let settled3;
|
|
94578
|
+
try {
|
|
94579
|
+
answer6 = await door.ask({
|
|
94580
|
+
refs,
|
|
94581
|
+
reason: reason2,
|
|
94582
|
+
command,
|
|
94583
|
+
recipient: run4.publicKey,
|
|
94584
|
+
...Object.keys(placeholders).length > 0 && { placeholders: true }
|
|
94585
|
+
});
|
|
94586
|
+
const missing = answer6.entries.filter((entry2) => !entry2.connection);
|
|
94587
|
+
if (missing.length > 0) {
|
|
94588
|
+
context.err(
|
|
94589
|
+
`laze vault: no key named ${missing.map((entry2) => entry2.ref).join(", ")} in your vault or reachable by this agent
|
|
94590
|
+
`
|
|
94591
|
+
);
|
|
94592
|
+
return { exitCode: 1 };
|
|
94593
|
+
}
|
|
94594
|
+
const sorted = sortedReleasesOf({ entries: answer6.entries });
|
|
94595
|
+
settled3 = sorted.settled;
|
|
94596
|
+
const { waiting } = sorted;
|
|
94597
|
+
const later = await untilAllAnswered({ context, door, waiting, deadline });
|
|
94598
|
+
if (later === "capped") return { exitCode: 75 };
|
|
94599
|
+
for (const [key, release2] of later) settled3.set(key, release2);
|
|
94600
|
+
} catch (error63) {
|
|
94601
|
+
if (!(error63 instanceof ServerGoneError)) throw error63;
|
|
94602
|
+
context.err(`${error63.message}. Run the command again to keep waiting.
|
|
94603
|
+
`);
|
|
94604
|
+
return { exitCode: 75 };
|
|
94605
|
+
}
|
|
94606
|
+
const swapped = swappedOf({ context, entries: answer6.entries, placeholders });
|
|
94607
|
+
if (!swapped) return { exitCode: 1 };
|
|
94608
|
+
const outcome = await valuesOf({
|
|
94609
|
+
context,
|
|
94610
|
+
entries: answer6.entries,
|
|
94611
|
+
settled: settled3,
|
|
94612
|
+
run: run4,
|
|
94613
|
+
keyPath: door.keyPath
|
|
94614
|
+
});
|
|
94615
|
+
if ("exitCode" in outcome) return outcome;
|
|
94616
|
+
for (const [ref2, fields] of swapped) outcome.released.set(ref2, { fields });
|
|
94617
|
+
return outcome;
|
|
94618
|
+
}
|
|
94619
|
+
function swappedOf({
|
|
94620
|
+
context,
|
|
94621
|
+
entries,
|
|
94622
|
+
placeholders
|
|
94623
|
+
}) {
|
|
94624
|
+
const swapped = /* @__PURE__ */ new Map();
|
|
94625
|
+
for (const entry2 of entries) {
|
|
94626
|
+
if (!entry2.boundary || !entry2.connection) continue;
|
|
94627
|
+
const held = placeholders[entry2.boundary.connectionId] ?? {};
|
|
94628
|
+
const fields = Object.fromEntries(
|
|
94629
|
+
entry2.connection.fieldNames.flatMap((field) => {
|
|
94630
|
+
const placeholder = held[field];
|
|
94631
|
+
return placeholder ? [[field, placeholder]] : [];
|
|
94632
|
+
})
|
|
94633
|
+
);
|
|
94634
|
+
if (Object.keys(fields).length === 0) {
|
|
94635
|
+
context.err(
|
|
94636
|
+
`laze vault: ${entry2.connection.name} is swapped by Laze's proxy, but this computer holds no placeholder for it yet; it gets one on its next start
|
|
94637
|
+
`
|
|
94638
|
+
);
|
|
94639
|
+
return null;
|
|
94640
|
+
}
|
|
94641
|
+
swapped.set(entry2.ref, fields);
|
|
94642
|
+
}
|
|
94643
|
+
return swapped;
|
|
94644
|
+
}
|
|
94645
|
+
function sortedReleasesOf({ entries }) {
|
|
94646
|
+
const settled3 = /* @__PURE__ */ new Map();
|
|
94647
|
+
const waiting = /* @__PURE__ */ new Map();
|
|
94648
|
+
for (const entry2 of entries) {
|
|
94649
|
+
const release2 = entry2.release;
|
|
94650
|
+
if (!release2) continue;
|
|
94651
|
+
if (release2.outcome === "ask") waiting.set(keyOf(entry2), release2);
|
|
94652
|
+
else settled3.set(keyOf(entry2), release2);
|
|
94653
|
+
}
|
|
94654
|
+
return { settled: settled3, waiting };
|
|
94655
|
+
}
|
|
94656
|
+
function refusalOf({
|
|
94657
|
+
context,
|
|
94658
|
+
settled: settled3
|
|
94659
|
+
}) {
|
|
94660
|
+
const codes = [];
|
|
94661
|
+
for (const release2 of settled3.values()) {
|
|
94662
|
+
if (release2.outcome !== "deny") continue;
|
|
94663
|
+
context.err(`${release2.message}
|
|
94664
|
+
`);
|
|
94665
|
+
codes.push(release2.exitCode || 1);
|
|
94666
|
+
}
|
|
94667
|
+
if (codes.length === 0) return 0;
|
|
94668
|
+
return codes.includes(77) ? 77 : codes[0] ?? 1;
|
|
94669
|
+
}
|
|
94670
|
+
async function valuesOf({
|
|
94671
|
+
context,
|
|
94672
|
+
entries,
|
|
94673
|
+
settled: settled3,
|
|
94674
|
+
run: run4,
|
|
94675
|
+
keyPath
|
|
94676
|
+
}) {
|
|
94677
|
+
const refused = refusalOf({ context, settled: settled3 });
|
|
94678
|
+
if (refused !== 0) {
|
|
94679
|
+
await rm16(keyPath, { force: true });
|
|
94680
|
+
return { exitCode: refused };
|
|
94681
|
+
}
|
|
94682
|
+
const opened = /* @__PURE__ */ new Map();
|
|
94683
|
+
let keep2 = false;
|
|
94684
|
+
for (const [key, release2] of settled3) {
|
|
94685
|
+
if (release2.outcome !== "allow") continue;
|
|
94686
|
+
opened.set(key, await envOf({ release: release2, run: run4 }));
|
|
94687
|
+
if (leaseHolds({ release: release2, nowMs: context.nowMs() })) keep2 = true;
|
|
94688
|
+
if (release2.message) context.err(`${release2.message}
|
|
94689
|
+
`);
|
|
94690
|
+
}
|
|
94691
|
+
if (!keep2) await rm16(keyPath, { force: true });
|
|
94692
|
+
const released = /* @__PURE__ */ new Map();
|
|
94693
|
+
for (const entry2 of entries) {
|
|
94694
|
+
const fields = opened.get(keyOf(entry2));
|
|
94695
|
+
if (fields) released.set(entry2.ref, { fields });
|
|
94696
|
+
}
|
|
94697
|
+
return { released, entries };
|
|
94698
|
+
}
|
|
94699
|
+
|
|
94113
94700
|
// src/services/vault-share-commands.service.ts
|
|
94114
94701
|
var SHARE_USAGE2 = "Usage: laze vault share <connection> --with <email|userId> [--for 1h]";
|
|
94115
94702
|
var WAITING_LINE = "It waits for the owner's approval with a passkey or Face ID, in Settings > Vault.";
|
|
@@ -94173,14 +94760,14 @@ var VAULT_USAGE = `Usage (your own key; an agent's key lists and runs its owner'
|
|
|
94173
94760
|
from an agent, its owner's keys it may use
|
|
94174
94761
|
laze vault add <name> --label <text> [--keychain personal|workspace|agent:<id>]
|
|
94175
94762
|
[--level allow|auto|always-ask|human-only] [--rules <text>] [--approver <userId>]...
|
|
94176
|
-
[--lease 15m|1h|8h|1d|2d] [--every-use-asks] [--field <FIELD>] [--from-file <path>]
|
|
94763
|
+
[--lease 15m|1h|8h|1d|2d] [--every-use-asks] [--local-use] [--field <FIELD>] [--from-file <path>]
|
|
94177
94764
|
levels as the page names them: allow (agents use it), auto (the automatic check reads
|
|
94178
94765
|
each use against --rules), always-ask (a person approves), human-only (agents never do)
|
|
94179
94766
|
--lease (or --max-lease) is how long an approval lasts for the agent, 2 days by default
|
|
94180
94767
|
the value comes from stdin or --from-file, never a flag: KEY=value lines, one value
|
|
94181
94768
|
with --field, or a JSON secret bundle ({"kind":"api_key_set","fields":{...}})
|
|
94182
94769
|
laze vault update <connection> [--label] [--level] [--rules] [--approver]... [--lease 1h|none]
|
|
94183
|
-
[--every-use-asks yes|no] [--device-approval]
|
|
94770
|
+
[--every-use-asks yes|no] [--local-use yes|no] [--device-approval]
|
|
94184
94771
|
--device-approval: every Allow and lease needs Touch ID, a passkey or Face ID from then on;
|
|
94185
94772
|
it is turned off only in Settings > Vault, on a device
|
|
94186
94773
|
laze vault replace <connection> [--field <FIELD>] [--from-file <path>] a new value, from stdin
|
|
@@ -94238,9 +94825,16 @@ async function secretText({ context, args }) {
|
|
|
94238
94825
|
);
|
|
94239
94826
|
}
|
|
94240
94827
|
const file4 = flagText({ args, name: "from-file" });
|
|
94241
|
-
const text3 = file4 ? await
|
|
94828
|
+
const text3 = file4 ? await readFile23(file4, "utf8") : await context.readStdin();
|
|
94242
94829
|
const trimmed = text3.replace(/\r?\n$/, "");
|
|
94243
94830
|
if (!trimmed.trim()) throw new CliUsageError("No value: pipe it on stdin or use --from-file.");
|
|
94831
|
+
const held = await placeholdersOf({ env: context.environment.inherited });
|
|
94832
|
+
const field = Object.values(held).flatMap((fields) => Object.entries(fields)).find(([, placeholder]) => trimmed.includes(placeholder))?.[0];
|
|
94833
|
+
if (field) {
|
|
94834
|
+
throw new CliUsageError(
|
|
94835
|
+
`This value holds the stand-in for ${field} that Laze's proxy swaps on this computer, not the key itself, so it would not work anywhere else. To copy the real key, run the copy with laze vault run <name> -- <command>.`
|
|
94836
|
+
);
|
|
94837
|
+
}
|
|
94244
94838
|
return trimmed;
|
|
94245
94839
|
}
|
|
94246
94840
|
async function keychainOf2({ client, args }) {
|
|
@@ -94256,6 +94850,7 @@ function settingsOf2(args) {
|
|
|
94256
94850
|
const lease = flagText({ args, name: "lease" }) || flagText({ args, name: "max-lease" });
|
|
94257
94851
|
const approvers = args.lists.approver;
|
|
94258
94852
|
const everyUseAsks = yesNoOf({ args, name: "every-use-asks" });
|
|
94853
|
+
const localUse = yesNoOf({ args, name: "local-use" });
|
|
94259
94854
|
const label3 = flagText({ args, name: "label" });
|
|
94260
94855
|
const rules = args.flags.rules;
|
|
94261
94856
|
return {
|
|
@@ -94264,7 +94859,8 @@ function settingsOf2(args) {
|
|
|
94264
94859
|
...typeof rules === "string" && { rules },
|
|
94265
94860
|
...approvers && { approverUserIds: [...approvers] },
|
|
94266
94861
|
...lease && { maxLeaseSeconds: lease === "none" ? null : secondsOf(lease) },
|
|
94267
|
-
...everyUseAsks !== void 0 && { everyUseAsks }
|
|
94862
|
+
...everyUseAsks !== void 0 && { everyUseAsks },
|
|
94863
|
+
...localUse !== void 0 && { localUse }
|
|
94268
94864
|
};
|
|
94269
94865
|
}
|
|
94270
94866
|
var list4 = async ({ context, args }) => {
|
|
@@ -94474,7 +95070,7 @@ async function keyText({ context, args }) {
|
|
|
94474
95070
|
throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
|
|
94475
95071
|
}
|
|
94476
95072
|
const file4 = flagText({ args, name: "from-file" });
|
|
94477
|
-
const text3 = file4 ? await
|
|
95073
|
+
const text3 = file4 ? await readFile24(resolve14(context.cwd, file4), "utf8") : await context.readStdin();
|
|
94478
95074
|
const trimmed = text3.trim();
|
|
94479
95075
|
if (!trimmed) throw new CliUsageError("No key: pipe it on stdin or use --from-file.");
|
|
94480
95076
|
return trimmed;
|
|
@@ -94863,7 +95459,7 @@ async function conversationDelete({ context, args }) {
|
|
|
94863
95459
|
}
|
|
94864
95460
|
|
|
94865
95461
|
// src/services/discord-commands.service.ts
|
|
94866
|
-
import { readFile as
|
|
95462
|
+
import { readFile as readFile25 } from "node:fs/promises";
|
|
94867
95463
|
import { resolve as resolve15 } from "node:path";
|
|
94868
95464
|
|
|
94869
95465
|
// ../../modules/discord/contract/src/discord.ts
|
|
@@ -94985,13 +95581,13 @@ var oauthCallbackDefinition = external_exports.object({
|
|
|
94985
95581
|
error: external_exports.string().max(200).optional()
|
|
94986
95582
|
});
|
|
94987
95583
|
var linkParamsDefinition = external_exports.object({ workspaceId: workspaceIdSchema25, guildId: discordIdSchema });
|
|
94988
|
-
var
|
|
95584
|
+
var historyInputDefinition2 = external_exports.object({
|
|
94989
95585
|
workspaceId: workspaceIdSchema25,
|
|
94990
95586
|
/** The Laze conversation that mirrors the Discord channel. */
|
|
94991
95587
|
channelId: external_exports.string().min(1).max(200),
|
|
94992
95588
|
before: external_exports.iso.datetime()
|
|
94993
95589
|
});
|
|
94994
|
-
var discordHistoryInputSchema =
|
|
95590
|
+
var discordHistoryInputSchema = historyInputDefinition2;
|
|
94995
95591
|
var channelPeopleInputDefinition = external_exports.object({
|
|
94996
95592
|
workspaceId: workspaceIdSchema25,
|
|
94997
95593
|
channelId: external_exports.string().min(1).max(200)
|
|
@@ -95007,7 +95603,7 @@ var discordFileDefinition = external_exports.object({
|
|
|
95007
95603
|
mimetype: external_exports.string(),
|
|
95008
95604
|
size: external_exports.number().int().nonnegative()
|
|
95009
95605
|
});
|
|
95010
|
-
var
|
|
95606
|
+
var historyMessageDefinition2 = external_exports.object({
|
|
95011
95607
|
key: external_exports.string().min(1),
|
|
95012
95608
|
createdAt: external_exports.iso.datetime(),
|
|
95013
95609
|
authorName: external_exports.string(),
|
|
@@ -95017,12 +95613,12 @@ var historyMessageDefinition = external_exports.object({
|
|
|
95017
95613
|
replyCount: external_exports.number().int().nonnegative(),
|
|
95018
95614
|
files: external_exports.array(discordFileDefinition)
|
|
95019
95615
|
});
|
|
95020
|
-
var
|
|
95616
|
+
var historyPageDefinition2 = external_exports.object({
|
|
95021
95617
|
/** Oldest first. */
|
|
95022
|
-
messages: external_exports.array(
|
|
95618
|
+
messages: external_exports.array(historyMessageDefinition2),
|
|
95023
95619
|
hasOlder: external_exports.boolean()
|
|
95024
95620
|
});
|
|
95025
|
-
var discordHistoryPageSchema =
|
|
95621
|
+
var discordHistoryPageSchema = historyPageDefinition2;
|
|
95026
95622
|
var fileParamsDefinition = external_exports.object({
|
|
95027
95623
|
workspaceId: workspaceIdSchema25,
|
|
95028
95624
|
channelId: external_exports.string().min(1).max(200),
|
|
@@ -95038,7 +95634,7 @@ var saveAppByKeyDefinition = external_exports.object({
|
|
|
95038
95634
|
});
|
|
95039
95635
|
var pickByKeyDefinition = pickDefinition.omit({ workspaceId: true });
|
|
95040
95636
|
var updateByKeyDefinition = updateConnectionDefinition.omit({ workspaceId: true });
|
|
95041
|
-
var historyByKeyDefinition =
|
|
95637
|
+
var historyByKeyDefinition = historyInputDefinition2.omit({ workspaceId: true });
|
|
95042
95638
|
var emptyDefinition3 = external_exports.object({});
|
|
95043
95639
|
var DISCORD_KEY_PATHS = {
|
|
95044
95640
|
overview: "/api/discord/overview",
|
|
@@ -95211,7 +95807,7 @@ async function secretsOf({ context, args }) {
|
|
|
95211
95807
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
95212
95808
|
if (fromConnection) return { fromConnection };
|
|
95213
95809
|
const file4 = flagText({ args, name: "from-file" });
|
|
95214
|
-
const text3 = file4 ? await
|
|
95810
|
+
const text3 = file4 ? await readFile25(resolve15(context.cwd, file4), "utf8") : await context.readStdin();
|
|
95215
95811
|
const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
95216
95812
|
if (lines2.length !== 2) {
|
|
95217
95813
|
throw new CliUsageError(
|
|
@@ -95514,7 +96110,7 @@ async function domains({ context, args }) {
|
|
|
95514
96110
|
}
|
|
95515
96111
|
|
|
95516
96112
|
// src/services/emoji-commands.service.ts
|
|
95517
|
-
import { readFile as
|
|
96113
|
+
import { readFile as readFile26 } from "node:fs/promises";
|
|
95518
96114
|
import { resolve as resolve16 } from "node:path";
|
|
95519
96115
|
var EMOJI_USAGE = `Usage:
|
|
95520
96116
|
laze emoji list [--json] the workspace's custom emoji, aliases and who added each
|
|
@@ -95555,7 +96151,7 @@ async function addEmoji({ context, args, client }) {
|
|
|
95555
96151
|
const file4 = wordAt4(args, 3);
|
|
95556
96152
|
let bytes;
|
|
95557
96153
|
try {
|
|
95558
|
-
bytes = new Uint8Array(await
|
|
96154
|
+
bytes = new Uint8Array(await readFile26(resolve16(context.cwd, file4)));
|
|
95559
96155
|
} catch {
|
|
95560
96156
|
throw new CliUsageError(`Cannot read ${file4}.`);
|
|
95561
96157
|
}
|
|
@@ -95894,7 +96490,7 @@ var ExternalChannelBannerSlot = externalUi.component("channel-banner");
|
|
|
95894
96490
|
var ExternalSharingHooksToken = externalUi.hooks("sharing");
|
|
95895
96491
|
|
|
95896
96492
|
// src/services/workspace-commands.service.ts
|
|
95897
|
-
import { readFile as
|
|
96493
|
+
import { readFile as readFile27 } from "node:fs/promises";
|
|
95898
96494
|
import { resolve as resolve17 } from "node:path";
|
|
95899
96495
|
var ROLE_NAMES2 = {
|
|
95900
96496
|
OWNER: "Owner",
|
|
@@ -96077,7 +96673,7 @@ var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze work
|
|
|
96077
96673
|
async function readLogo({ context, file: file4 }) {
|
|
96078
96674
|
let bytes;
|
|
96079
96675
|
try {
|
|
96080
|
-
bytes = new Uint8Array(await
|
|
96676
|
+
bytes = new Uint8Array(await readFile27(resolve17(context.cwd, file4)));
|
|
96081
96677
|
} catch {
|
|
96082
96678
|
throw new CliUsageError(`No file to read at ${file4}.`);
|
|
96083
96679
|
}
|
|
@@ -96712,7 +97308,7 @@ async function agentFeedAccess({
|
|
|
96712
97308
|
}
|
|
96713
97309
|
|
|
96714
97310
|
// src/services/feed-commands.service.ts
|
|
96715
|
-
import { readFile as
|
|
97311
|
+
import { readFile as readFile28 } from "node:fs/promises";
|
|
96716
97312
|
import { resolve as resolve18 } from "node:path";
|
|
96717
97313
|
|
|
96718
97314
|
// ../../modules/feed/contract/src/feed.delegate.ts
|
|
@@ -97866,7 +98462,7 @@ async function feedTurnOf({
|
|
|
97866
98462
|
const read4 = async () => {
|
|
97867
98463
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
97868
98464
|
if (pinned) return pinned;
|
|
97869
|
-
if (env.LAZE_TURN_FILE) return (await
|
|
98465
|
+
if (env.LAZE_TURN_FILE) return (await readFile28(env.LAZE_TURN_FILE, "utf8")).trim();
|
|
97870
98466
|
return agent3 ? connectedTurnTokenOf({ client, channelId: channel }) : "";
|
|
97871
98467
|
};
|
|
97872
98468
|
const turn = await read4().catch(() => "");
|
|
@@ -97940,7 +98536,7 @@ async function bodyOf2({
|
|
|
97940
98536
|
flags: flags2
|
|
97941
98537
|
}) {
|
|
97942
98538
|
const body = { ...flags2.fields };
|
|
97943
|
-
const read4 = (source) => "file" in source ?
|
|
98539
|
+
const read4 = (source) => "file" in source ? readFile28(resolve18(context.cwd, source.file), "utf8") : source.text;
|
|
97944
98540
|
for (const [field, source] of Object.entries(flags2.texts)) body[field] = await read4(source);
|
|
97945
98541
|
if (flags2.rich) {
|
|
97946
98542
|
const text3 = await read4(flags2.rich.source);
|
|
@@ -98217,7 +98813,7 @@ async function textFlag({
|
|
|
98217
98813
|
}) {
|
|
98218
98814
|
const value = flagText({ args, name: name3 });
|
|
98219
98815
|
if (!value.startsWith("@")) return value;
|
|
98220
|
-
return
|
|
98816
|
+
return readFile28(resolve18(context.cwd, value.slice(1)), "utf8");
|
|
98221
98817
|
}
|
|
98222
98818
|
async function feedList({ context, args }) {
|
|
98223
98819
|
const { client, profile } = await signedIn({ context, args });
|
|
@@ -98307,7 +98903,7 @@ async function ranksOf({
|
|
|
98307
98903
|
}) {
|
|
98308
98904
|
const file4 = flagText({ args, name: "file" });
|
|
98309
98905
|
if (file4) {
|
|
98310
|
-
const parsed = JSON.parse(await
|
|
98906
|
+
const parsed = JSON.parse(await readFile28(resolve18(context.cwd, file4), "utf8"));
|
|
98311
98907
|
if (Array.isArray(parsed)) return parsed;
|
|
98312
98908
|
throw new CliUsageError("--file holds a list of {itemId, priority}");
|
|
98313
98909
|
}
|
|
@@ -98422,7 +99018,7 @@ async function feed({ context, args }) {
|
|
|
98422
99018
|
}
|
|
98423
99019
|
|
|
98424
99020
|
// src/services/github-commands.service.ts
|
|
98425
|
-
import { readFile as
|
|
99021
|
+
import { readFile as readFile29 } from "node:fs/promises";
|
|
98426
99022
|
|
|
98427
99023
|
// src/rules/github-signature.rules.ts
|
|
98428
99024
|
var TURN_SEPARATOR = "~";
|
|
@@ -98492,7 +99088,7 @@ var REAL_GH = "/usr/bin/gh";
|
|
|
98492
99088
|
var NOT_SET = "laze: agent_github_not_set: this agent has no GitHub connection. Run `laze github request --repo <owner/name>` to post a card that gets it in one click, or its owner runs `laze agent set-github <agent> <connection>`.";
|
|
98493
99089
|
async function turnFileToken({ env }) {
|
|
98494
99090
|
if (!env.LAZE_TURN_FILE) return "";
|
|
98495
|
-
return
|
|
99091
|
+
return readFile29(env.LAZE_TURN_FILE, "utf8").then(
|
|
98496
99092
|
(text3) => text3.trim(),
|
|
98497
99093
|
() => ""
|
|
98498
99094
|
);
|
|
@@ -98526,7 +99122,7 @@ async function githubGh({
|
|
|
98526
99122
|
args: args.rest,
|
|
98527
99123
|
agentName: profile.name ?? "An agent",
|
|
98528
99124
|
threadUrl: threadUrlOf({ env, workspaceId: profile.workspaceId }),
|
|
98529
|
-
readBodyFile: (path) => path === "-" ? context.readStdin() :
|
|
99125
|
+
readBodyFile: (path) => path === "-" ? context.readStdin() : readFile29(path, "utf8")
|
|
98530
99126
|
});
|
|
98531
99127
|
return context.runCommand({
|
|
98532
99128
|
command: [REAL_GH, ...ghArgs],
|
|
@@ -98742,6 +99338,14 @@ async function groups({ context, args }) {
|
|
|
98742
99338
|
}
|
|
98743
99339
|
|
|
98744
99340
|
// src/rules/history-format.rules.ts
|
|
99341
|
+
var SOURCE_LABELS = {
|
|
99342
|
+
slack: "Slack",
|
|
99343
|
+
discord: "Discord",
|
|
99344
|
+
whatsapp: "WhatsApp"
|
|
99345
|
+
};
|
|
99346
|
+
function sourceOfKey(key) {
|
|
99347
|
+
return key ? SOURCE_LABELS[key.split(":")[0] ?? ""] ?? null : null;
|
|
99348
|
+
}
|
|
98745
99349
|
function timeOf2(iso3) {
|
|
98746
99350
|
return `${iso3.slice(0, 10)} ${iso3.slice(11, 16)} UTC`;
|
|
98747
99351
|
}
|
|
@@ -98749,8 +99353,9 @@ function linesOf3(output2) {
|
|
|
98749
99353
|
const live = (output2.live?.messages ?? []).map((message2) => ({
|
|
98750
99354
|
at: message2.createdAt,
|
|
98751
99355
|
author: message2.authorName,
|
|
98752
|
-
|
|
98753
|
-
|
|
99356
|
+
source: sourceOfKey(message2.key) ?? SOURCE_LABELS[output2.laze.mirror?.source ?? ""] ?? null,
|
|
99357
|
+
// A Slack key reads back as its time; other sources' keys do not, so their time is the cursor.
|
|
99358
|
+
cursor: message2.key.startsWith("slack:") ? message2.key : message2.createdAt,
|
|
98754
99359
|
threadRootId: null,
|
|
98755
99360
|
replyCount: message2.replyCount,
|
|
98756
99361
|
body: message2.body
|
|
@@ -98758,7 +99363,7 @@ function linesOf3(output2) {
|
|
|
98758
99363
|
const cached2 = output2.laze.messages.map((message2) => ({
|
|
98759
99364
|
at: message2.postedAt,
|
|
98760
99365
|
author: message2.author.name,
|
|
98761
|
-
|
|
99366
|
+
source: sourceOfKey(message2.originKey),
|
|
98762
99367
|
cursor: message2.messageId,
|
|
98763
99368
|
threadRootId: message2.threadRootId,
|
|
98764
99369
|
replyCount: message2.replyCount,
|
|
@@ -98768,7 +99373,7 @@ function linesOf3(output2) {
|
|
|
98768
99373
|
return [...live, ...cached2];
|
|
98769
99374
|
}
|
|
98770
99375
|
function blockOf2(line) {
|
|
98771
|
-
const badge = line.
|
|
99376
|
+
const badge = line.source ? ` [${line.source}]` : "";
|
|
98772
99377
|
const thread2 = line.threadRootId ? ` in thread ${line.threadRootId}` : "";
|
|
98773
99378
|
const link2 = line.link ? ` ${line.link}` : "";
|
|
98774
99379
|
const head = `${timeOf2(line.at)} ${line.author}${badge} ${line.cursor}${thread2}${link2}`;
|
|
@@ -98804,10 +99409,16 @@ ${blocks}${older}
|
|
|
98804
99409
|
// src/services/history-commands.service.ts
|
|
98805
99410
|
var HISTORY_USAGE = `Usage: laze history <channel> [--before <message-id>] [--limit <1-${CALLER_HISTORY_LIMIT_MAX}>] [--json]
|
|
98806
99411
|
|
|
98807
|
-
A conversation's messages before a message, oldest first: the cached ones, then, in a
|
|
98808
|
-
that mirrors Slack, older ones
|
|
98809
|
-
|
|
98810
|
-
|
|
99412
|
+
A conversation's messages before a message, oldest first: the cached ones, then, in a
|
|
99413
|
+
conversation that mirrors Slack, Discord or WhatsApp, older ones pulled back from the source
|
|
99414
|
+
(WhatsApp's from the owner's Laze computer, which wakes for it). --before also takes a Slack
|
|
99415
|
+
message key or an ISO time, as the "Older:" line prints it. An agent reads while it answers a
|
|
99416
|
+
message: outside a turn the call is refused.`;
|
|
99417
|
+
var LIVE_PATHS = {
|
|
99418
|
+
slack: SLACK_HISTORY_PATH,
|
|
99419
|
+
discord: DISCORD_KEY_PATHS.history,
|
|
99420
|
+
whatsapp: WHATSAPP_HISTORY_PATH
|
|
99421
|
+
};
|
|
98811
99422
|
var SLACK_KEY = /^slack:[^:]+:[^:]+:(\d+(?:\.\d+)?)$/;
|
|
98812
99423
|
function isoOf(epochMilliseconds) {
|
|
98813
99424
|
return Temporal3.Instant.fromEpochMilliseconds(epochMilliseconds).toString({
|
|
@@ -98849,9 +99460,10 @@ async function history2({
|
|
|
98849
99460
|
});
|
|
98850
99461
|
let live = null;
|
|
98851
99462
|
let refused = null;
|
|
99463
|
+
const livePath = LIVE_PATHS[laze.mirror?.source ?? "slack"] ?? SLACK_HISTORY_PATH;
|
|
98852
99464
|
if (laze.messages.length < limit && laze.liveBefore) {
|
|
98853
99465
|
try {
|
|
98854
|
-
const page = await client.post(
|
|
99466
|
+
const page = await client.post(livePath, {
|
|
98855
99467
|
channelId: laze.channelId,
|
|
98856
99468
|
before: laze.liveBefore
|
|
98857
99469
|
});
|
|
@@ -99174,7 +99786,7 @@ async function ip({ context, args }) {
|
|
|
99174
99786
|
}
|
|
99175
99787
|
|
|
99176
99788
|
// src/services/join-commands.service.ts
|
|
99177
|
-
import { rm as
|
|
99789
|
+
import { rm as rm17 } from "node:fs/promises";
|
|
99178
99790
|
import { hostname as hostname9 } from "node:os";
|
|
99179
99791
|
import { dirname as dirname22, join as join31 } from "node:path";
|
|
99180
99792
|
var DEFAULT_WAIT_SECONDS2 = 100;
|
|
@@ -99196,7 +99808,7 @@ async function keepPending({ context, pending: pending2 }) {
|
|
|
99196
99808
|
await writeStateJson({ path: pendingPathOf({ context }), value: pending2 });
|
|
99197
99809
|
}
|
|
99198
99810
|
async function dropPending({ context }) {
|
|
99199
|
-
await
|
|
99811
|
+
await rm17(pendingPathOf({ context }), { force: true });
|
|
99200
99812
|
}
|
|
99201
99813
|
function waitSecondsOf3({ args }) {
|
|
99202
99814
|
const raw = flagText({ args, name: "timeout" });
|
|
@@ -100455,18 +101067,18 @@ async function serveMcp({
|
|
|
100455
101067
|
}
|
|
100456
101068
|
|
|
100457
101069
|
// src/services/memory-commands.service.ts
|
|
100458
|
-
import { readdir as readdir7, readFile as
|
|
101070
|
+
import { readdir as readdir7, readFile as readFile31 } from "node:fs/promises";
|
|
100459
101071
|
import { join as join32, resolve as resolve20 } from "node:path";
|
|
100460
101072
|
|
|
100461
101073
|
// src/services/mount-files.service.ts
|
|
100462
|
-
import { mkdir as mkdir11, readFile as
|
|
101074
|
+
import { mkdir as mkdir11, readFile as readFile30, rm as rm18, writeFile as writeFile8 } from "node:fs/promises";
|
|
100463
101075
|
import { dirname as dirname23, relative as relative5, resolve as resolve19 } from "node:path";
|
|
100464
101076
|
async function textArgument({
|
|
100465
101077
|
context,
|
|
100466
101078
|
value
|
|
100467
101079
|
}) {
|
|
100468
101080
|
if (value === "-") return context.readStdin();
|
|
100469
|
-
if (value.startsWith("@")) return
|
|
101081
|
+
if (value.startsWith("@")) return readFile30(resolve19(context.cwd, value.slice(1)), "utf8");
|
|
100470
101082
|
return value;
|
|
100471
101083
|
}
|
|
100472
101084
|
function turnChannel({ context, args }) {
|
|
@@ -100479,7 +101091,7 @@ async function writeMount({
|
|
|
100479
101091
|
files: files2
|
|
100480
101092
|
}) {
|
|
100481
101093
|
const root = resolve19(context.cwd, flagText({ args, name: "dir", fallback: ".laze" }), folder);
|
|
100482
|
-
await
|
|
101094
|
+
await rm18(root, { recursive: true, force: true });
|
|
100483
101095
|
await mkdir11(root, { recursive: true });
|
|
100484
101096
|
for (const file4 of files2) {
|
|
100485
101097
|
const target = resolve19(root, file4.path);
|
|
@@ -100613,7 +101225,7 @@ async function turnTokenOf5({ context }) {
|
|
|
100613
101225
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
100614
101226
|
if (pinned) return pinned;
|
|
100615
101227
|
if (!env.LAZE_TURN_FILE) return "";
|
|
100616
|
-
return
|
|
101228
|
+
return readFile31(env.LAZE_TURN_FILE, "utf8").then(
|
|
100617
101229
|
(text3) => text3.trim(),
|
|
100618
101230
|
() => ""
|
|
100619
101231
|
);
|
|
@@ -100743,7 +101355,7 @@ async function siestaImport({
|
|
|
100743
101355
|
dir
|
|
100744
101356
|
}) {
|
|
100745
101357
|
const root = resolve20(context.cwd, dir);
|
|
100746
|
-
const log = await
|
|
101358
|
+
const log = await readFile31(join32(root, "LOG.md"));
|
|
100747
101359
|
const names = (await readdir7(join32(root, "tree")).catch(() => [])).filter(
|
|
100748
101360
|
(name3) => /^\d{1,6}-\d{1,6}\.md$/.test(name3)
|
|
100749
101361
|
);
|
|
@@ -100751,7 +101363,7 @@ async function siestaImport({
|
|
|
100751
101363
|
await Promise.all(
|
|
100752
101364
|
names.map(async (name3) => [
|
|
100753
101365
|
name3.slice(0, -3),
|
|
100754
|
-
(await
|
|
101366
|
+
(await readFile31(join32(root, "tree", name3))).toString("base64")
|
|
100755
101367
|
])
|
|
100756
101368
|
)
|
|
100757
101369
|
);
|
|
@@ -100771,7 +101383,7 @@ async function memoryImport({ context, args }) {
|
|
|
100771
101383
|
const dir = flagText({ args, name: "optmem" });
|
|
100772
101384
|
if (!dir) throw new CliUsageError(USAGE14);
|
|
100773
101385
|
const root = resolve20(context.cwd, dir);
|
|
100774
|
-
const log = await
|
|
101386
|
+
const log = await readFile31(join32(root, "LOG.txt"));
|
|
100775
101387
|
const sizes2 = (await readdir7(join32(root, "TREE")).catch(() => [])).filter(
|
|
100776
101388
|
(name3) => /^\d{1,4}$/.test(name3)
|
|
100777
101389
|
);
|
|
@@ -100779,7 +101391,7 @@ async function memoryImport({ context, args }) {
|
|
|
100779
101391
|
await Promise.all(
|
|
100780
101392
|
sizes2.map(async (size) => [
|
|
100781
101393
|
size,
|
|
100782
|
-
(await
|
|
101394
|
+
(await readFile31(join32(root, "TREE", size))).toString("base64")
|
|
100783
101395
|
])
|
|
100784
101396
|
)
|
|
100785
101397
|
);
|
|
@@ -101376,7 +101988,7 @@ async function openclaw({
|
|
|
101376
101988
|
|
|
101377
101989
|
// src/services/operator-key-commands.service.ts
|
|
101378
101990
|
import { createHash as createHash10, randomBytes as randomBytes5 } from "node:crypto";
|
|
101379
|
-
import { mkdir as mkdir12, readFile as
|
|
101991
|
+
import { mkdir as mkdir12, readFile as readFile32, rm as rm19, writeFile as writeFile9 } from "node:fs/promises";
|
|
101380
101992
|
import { dirname as dirname24, join as join33 } from "node:path";
|
|
101381
101993
|
|
|
101382
101994
|
// ../../modules/audit-log/contract/src/audit-log.api.ts
|
|
@@ -102535,7 +103147,15 @@ var snapshotOutputDefinition = external_exports.object({
|
|
|
102535
103147
|
var eventsInputDefinition = external_exports.object({ from: external_exports.iso.datetime(), to: external_exports.iso.datetime() }).strict();
|
|
102536
103148
|
var eventCountsDefinition = external_exports.object({
|
|
102537
103149
|
total: count12,
|
|
102538
|
-
|
|
103150
|
+
/** Per type: how many, and the stored bytes of their payloads and sealed copies. */
|
|
103151
|
+
byType: external_exports.array(
|
|
103152
|
+
external_exports.object({
|
|
103153
|
+
eventType: external_exports.string(),
|
|
103154
|
+
count: count12,
|
|
103155
|
+
payloadBytes: external_exports.number().nonnegative(),
|
|
103156
|
+
encryptedCopyBytes: external_exports.number().nonnegative()
|
|
103157
|
+
})
|
|
103158
|
+
)
|
|
102539
103159
|
});
|
|
102540
103160
|
var tenantEventsInputDefinition = external_exports.object({
|
|
102541
103161
|
from: external_exports.iso.datetime(),
|
|
@@ -102591,11 +103211,35 @@ var databaseHealthDefinition = external_exports.object({
|
|
|
102591
103211
|
longestActiveSeconds: external_exports.number().nonnegative(),
|
|
102592
103212
|
longestIdleInTransactionSeconds: external_exports.number().nonnegative()
|
|
102593
103213
|
}),
|
|
103214
|
+
/** Every database this role may open, by size: they share the volume. */
|
|
103215
|
+
databases: external_exports.array(external_exports.object({ name: external_exports.string(), sizeBytes: external_exports.number().nonnegative() })),
|
|
103216
|
+
/** pg_wal's size (null when the role may not list it) and what each replication slot holds. */
|
|
103217
|
+
wal: external_exports.object({
|
|
103218
|
+
bytes: external_exports.number().nonnegative().nullable(),
|
|
103219
|
+
slots: external_exports.array(
|
|
103220
|
+
external_exports.object({ type: external_exports.string(), active: external_exports.boolean(), retainedBytes: external_exports.number().nonnegative() })
|
|
103221
|
+
)
|
|
103222
|
+
}),
|
|
103223
|
+
/** When the statistics counters started from zero; scans below count from then. */
|
|
103224
|
+
statsSince: external_exports.iso.datetime().nullable(),
|
|
103225
|
+
/** The largest indexes with their scans since statsSince; unique ones enforce a rule unread. */
|
|
103226
|
+
indexes: external_exports.array(
|
|
103227
|
+
external_exports.object({
|
|
103228
|
+
table: external_exports.string(),
|
|
103229
|
+
index: external_exports.string(),
|
|
103230
|
+
sizeBytes: external_exports.number().nonnegative(),
|
|
103231
|
+
scans: external_exports.number().nonnegative(),
|
|
103232
|
+
unique: external_exports.boolean()
|
|
103233
|
+
})
|
|
103234
|
+
),
|
|
102594
103235
|
/** The tables, largest first: sizes, row estimates and scans; never a row. */
|
|
102595
103236
|
tables: pageOf(
|
|
102596
103237
|
external_exports.object({
|
|
102597
103238
|
table: external_exports.string(),
|
|
102598
103239
|
totalBytes: external_exports.number().nonnegative(),
|
|
103240
|
+
heapBytes: external_exports.number().nonnegative(),
|
|
103241
|
+
toastBytes: external_exports.number().nonnegative(),
|
|
103242
|
+
indexBytes: external_exports.number().nonnegative(),
|
|
102599
103243
|
liveRows: external_exports.number().nonnegative(),
|
|
102600
103244
|
deadRows: external_exports.number().nonnegative(),
|
|
102601
103245
|
seqScans: external_exports.number().nonnegative(),
|
|
@@ -102817,6 +103461,32 @@ var contentBreakerOutputDefinition = external_exports.object({
|
|
|
102817
103461
|
upkeepCeilings: vaultContentBreakerSchema.shape.upkeepCeilings,
|
|
102818
103462
|
rows: pageOf(vaultContentBreakerSchema.shape.rows.element)
|
|
102819
103463
|
});
|
|
103464
|
+
var vaultAlertsInputDefinition = external_exports.object({
|
|
103465
|
+
from: external_exports.iso.datetime(),
|
|
103466
|
+
to: external_exports.iso.datetime(),
|
|
103467
|
+
kind: external_exports.string().trim().min(1).max(64).optional(),
|
|
103468
|
+
limit: external_exports.number().int().min(1).max(500).default(100),
|
|
103469
|
+
cursor: cursorDefinition.optional()
|
|
103470
|
+
}).strict();
|
|
103471
|
+
var vaultAlertRowDefinition = external_exports.object({
|
|
103472
|
+
at: external_exports.iso.datetime(),
|
|
103473
|
+
seq: external_exports.number().int().nullable(),
|
|
103474
|
+
kind: external_exports.string(),
|
|
103475
|
+
subjectWorkspaceId: external_exports.string().nullable(),
|
|
103476
|
+
scope: external_exports.string().nullable(),
|
|
103477
|
+
window: external_exports.string().nullable(),
|
|
103478
|
+
count: external_exports.number().nullable(),
|
|
103479
|
+
ceiling: external_exports.number().nullable(),
|
|
103480
|
+
wouldLock: external_exports.boolean(),
|
|
103481
|
+
topUse: external_exports.string().nullable(),
|
|
103482
|
+
/** Opens per vault use (`release`, `token_refresh`...) in the window that tripped. */
|
|
103483
|
+
uses: external_exports.record(external_exports.string(), external_exports.number()),
|
|
103484
|
+
/** The busiest code-path labels and their opens; never an id. */
|
|
103485
|
+
callers: external_exports.record(external_exports.string(), external_exports.number()),
|
|
103486
|
+
/** A gate or process alert's operation, such as `unwrap`. */
|
|
103487
|
+
op: external_exports.string().nullable()
|
|
103488
|
+
});
|
|
103489
|
+
var vaultAlertsOutputDefinition = external_exports.object({ alerts: pageOf(vaultAlertRowDefinition) });
|
|
102820
103490
|
var judgeMeasureInputDefinition = external_exports.object({
|
|
102821
103491
|
from: external_exports.iso.datetime(),
|
|
102822
103492
|
to: external_exports.iso.datetime(),
|
|
@@ -103072,6 +103742,13 @@ var OPS_FUNCTIONS = {
|
|
|
103072
103742
|
input: contentBreakerInputDefinition,
|
|
103073
103743
|
output: contentBreakerOutputDefinition
|
|
103074
103744
|
}),
|
|
103745
|
+
"vault.alerts": entry({
|
|
103746
|
+
title: "Vault alerts over a range: kind, when vaultd raised it, the workspace id, the breaker numbers, uses and busiest callers",
|
|
103747
|
+
scope: "platform",
|
|
103748
|
+
view: "table",
|
|
103749
|
+
input: vaultAlertsInputDefinition,
|
|
103750
|
+
output: vaultAlertsOutputDefinition
|
|
103751
|
+
}),
|
|
103075
103752
|
"vault.judge_measure": entry({
|
|
103076
103753
|
title: "The vault judge's verdicts against people's answers, with false allows and blocks",
|
|
103077
103754
|
scope: "platform",
|
|
@@ -103250,7 +103927,7 @@ async function forgetIfOver({
|
|
|
103250
103927
|
const key = await client.post(OPERATOR_KEY_REST_PATHS.status, { keyId });
|
|
103251
103928
|
const windowOver = key.endsAt !== null && Temporal3.Instant.from(key.endsAt).epochMilliseconds <= context.nowMs();
|
|
103252
103929
|
if (key.status !== "pending" && (key.status !== "approved" || windowOver || key.spentAt)) {
|
|
103253
|
-
await
|
|
103930
|
+
await rm19(keyFile({ context, keyId }), { force: true });
|
|
103254
103931
|
}
|
|
103255
103932
|
return key;
|
|
103256
103933
|
}
|
|
@@ -103263,7 +103940,7 @@ async function useKey({
|
|
|
103263
103940
|
if (!keyId) throw new CliUsageError(OPERATOR_KEY_USAGE);
|
|
103264
103941
|
const { client } = await signedIn({ context, args });
|
|
103265
103942
|
const path = keyFile({ context, keyId });
|
|
103266
|
-
const secret = await
|
|
103943
|
+
const secret = await readFile32(path, "utf8").catch(() => null);
|
|
103267
103944
|
if (secret === null) {
|
|
103268
103945
|
throw new CliUsageError(`No operator key ${keyId} is kept on this machine.`);
|
|
103269
103946
|
}
|
|
@@ -103462,7 +104139,7 @@ function watchingRelease({
|
|
|
103462
104139
|
}
|
|
103463
104140
|
|
|
103464
104141
|
// src/services/rush-guard.service.ts
|
|
103465
|
-
import { rm as
|
|
104142
|
+
import { rm as rm20 } from "node:fs/promises";
|
|
103466
104143
|
var WATCH_MS3 = 2e3;
|
|
103467
104144
|
async function guardRound(guard) {
|
|
103468
104145
|
const { context, client, name: name3, lock, claudePid, session, rush, launch } = guard;
|
|
@@ -103549,10 +104226,10 @@ async function rushWakeHook({ context, args }) {
|
|
|
103549
104226
|
return await guardRounds(guard);
|
|
103550
104227
|
} finally {
|
|
103551
104228
|
if ((await holderOf({ path: lock }))?.pid === context.processes.pid)
|
|
103552
|
-
await
|
|
104229
|
+
await rm20(lock, { force: true });
|
|
103553
104230
|
}
|
|
103554
104231
|
} finally {
|
|
103555
|
-
await
|
|
104232
|
+
await rm20(path, { force: true });
|
|
103556
104233
|
}
|
|
103557
104234
|
}
|
|
103558
104235
|
|
|
@@ -103721,7 +104398,7 @@ async function schedule({ context, args }) {
|
|
|
103721
104398
|
}
|
|
103722
104399
|
|
|
103723
104400
|
// src/services/skill-commands.service.ts
|
|
103724
|
-
import { readdir as readdir8, readFile as
|
|
104401
|
+
import { readdir as readdir8, readFile as readFile33 } from "node:fs/promises";
|
|
103725
104402
|
import { join as join35, relative as relative6, resolve as resolve22 } from "node:path";
|
|
103726
104403
|
var USAGE18 = `Usage:
|
|
103727
104404
|
laze skill list [--agent <agentId>]
|
|
@@ -103744,7 +104421,7 @@ async function folderFiles({ root }) {
|
|
|
103744
104421
|
for (const entry2 of entries) {
|
|
103745
104422
|
if (!entry2.isFile()) continue;
|
|
103746
104423
|
const full = join35(entry2.parentPath, entry2.name);
|
|
103747
|
-
files2.push({ path: relative6(root, full), content: await
|
|
104424
|
+
files2.push({ path: relative6(root, full), content: await readFile33(full, "utf8") });
|
|
103748
104425
|
}
|
|
103749
104426
|
return files2.toSorted((a, b) => a.path.localeCompare(b.path));
|
|
103750
104427
|
}
|
|
@@ -103842,7 +104519,7 @@ async function skillUpdate({ context, args }) {
|
|
|
103842
104519
|
if (!name3 || !newName && description === void 0 && !skillMdFile) {
|
|
103843
104520
|
throw new CliUsageError(USAGE18);
|
|
103844
104521
|
}
|
|
103845
|
-
const skillMd = skillMdFile ? await
|
|
104522
|
+
const skillMd = skillMdFile ? await readFile33(resolve22(context.cwd, skillMdFile), "utf8") : void 0;
|
|
103846
104523
|
const { client } = await signedIn({ context, args });
|
|
103847
104524
|
const updated = await client.post("/api/skills/update", {
|
|
103848
104525
|
name: name3,
|
|
@@ -103888,7 +104565,7 @@ async function skill({ context, args }) {
|
|
|
103888
104565
|
}
|
|
103889
104566
|
|
|
103890
104567
|
// src/services/slack-commands.service.ts
|
|
103891
|
-
import { readFile as
|
|
104568
|
+
import { readFile as readFile34 } from "node:fs/promises";
|
|
103892
104569
|
import { resolve as resolve23 } from "node:path";
|
|
103893
104570
|
var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
|
|
103894
104571
|
laze slack overview connected Slack workspaces, mirrors, your link
|
|
@@ -103939,7 +104616,7 @@ async function secretLines({ context, args }) {
|
|
|
103939
104616
|
throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
|
|
103940
104617
|
}
|
|
103941
104618
|
const file4 = flagText({ args, name: "from-file" });
|
|
103942
|
-
const text3 = file4 ? await
|
|
104619
|
+
const text3 = file4 ? await readFile34(resolve23(context.cwd, file4), "utf8") : await context.readStdin();
|
|
103943
104620
|
return text3.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
103944
104621
|
}
|
|
103945
104622
|
async function secretsOf2({
|
|
@@ -104257,7 +104934,7 @@ async function slack({
|
|
|
104257
104934
|
}
|
|
104258
104935
|
|
|
104259
104936
|
// src/services/sso-commands.service.ts
|
|
104260
|
-
import { readFile as
|
|
104937
|
+
import { readFile as readFile35 } from "node:fs/promises";
|
|
104261
104938
|
var SSO_USAGE = `Usage:
|
|
104262
104939
|
laze sso domains claimed domains and how each signs in (admins)
|
|
104263
104940
|
laze sso claim <domain> the TXT record that proves the domain
|
|
@@ -104344,7 +105021,7 @@ function refuseSecretFlags({ args }) {
|
|
|
104344
105021
|
}
|
|
104345
105022
|
async function clientSecretOf({ context, args }) {
|
|
104346
105023
|
const file4 = flagText({ args, name: "from-file" });
|
|
104347
|
-
const text3 = file4 ? await
|
|
105024
|
+
const text3 = file4 ? await readFile35(file4, "utf8") : await context.readStdin();
|
|
104348
105025
|
const secret = text3.trim();
|
|
104349
105026
|
if (!secret) throw new CliUsageError("No client secret: pipe it on stdin or use --from-file.");
|
|
104350
105027
|
return secret;
|
|
@@ -104688,7 +105365,7 @@ async function checkInstalled({
|
|
|
104688
105365
|
}
|
|
104689
105366
|
|
|
104690
105367
|
// src/services/vault-env-commands.service.ts
|
|
104691
|
-
import { readFile as
|
|
105368
|
+
import { readFile as readFile36, stat as stat12 } from "node:fs/promises";
|
|
104692
105369
|
import { dirname as dirname26, join as join36, resolve as resolve24 } from "node:path";
|
|
104693
105370
|
|
|
104694
105371
|
// src/rules/vault-manifest.rules.ts
|
|
@@ -104776,211 +105453,6 @@ function credentialProcessJson(fields) {
|
|
|
104776
105453
|
});
|
|
104777
105454
|
}
|
|
104778
105455
|
|
|
104779
|
-
// src/services/vault-batch.service.ts
|
|
104780
|
-
import { rm as rm20 } from "node:fs/promises";
|
|
104781
|
-
async function batchOf({ response }) {
|
|
104782
|
-
const text3 = await response.text();
|
|
104783
|
-
if (!response.ok) {
|
|
104784
|
-
const code4 = /"code"\s*:\s*"([^"]+)"/.exec(text3)?.[1] ?? `status ${response.status}`;
|
|
104785
|
-
throw new CliUsageError(`laze vault: the batch was refused (${code4})`);
|
|
104786
|
-
}
|
|
104787
|
-
return JSON.parse(text3);
|
|
104788
|
-
}
|
|
104789
|
-
async function doorOf({
|
|
104790
|
-
context,
|
|
104791
|
-
args,
|
|
104792
|
-
keyName
|
|
104793
|
-
}) {
|
|
104794
|
-
const env = context.environment.inherited;
|
|
104795
|
-
const proxy = proxyOf({ env });
|
|
104796
|
-
if (proxy) {
|
|
104797
|
-
const turnFile = turnFileOf({ env });
|
|
104798
|
-
const headers = {
|
|
104799
|
-
"proxy-authorization": proxy.authorization,
|
|
104800
|
-
"x-laze-turn": await turnTokenOf2({ env, turnFile, command: "laze vault env" })
|
|
104801
|
-
};
|
|
104802
|
-
return {
|
|
104803
|
-
keyPath: runKeyPathOf({ turnFile, connection: keyName }),
|
|
104804
|
-
ask: async (body) => batchOf({
|
|
104805
|
-
response: await reach({
|
|
104806
|
-
context,
|
|
104807
|
-
url: `${proxy.origin}/vault/release-batch`,
|
|
104808
|
-
init: {
|
|
104809
|
-
method: "POST",
|
|
104810
|
-
headers: { ...headers, "content-type": "application/json" },
|
|
104811
|
-
body: JSON.stringify(body)
|
|
104812
|
-
}
|
|
104813
|
-
})
|
|
104814
|
-
}),
|
|
104815
|
-
status: async (requestId) => releaseOf({
|
|
104816
|
-
response: await reach({
|
|
104817
|
-
context,
|
|
104818
|
-
url: `${proxy.origin}/vault/release/${encodeURIComponent(requestId)}`,
|
|
104819
|
-
init: { method: "GET", headers }
|
|
104820
|
-
})
|
|
104821
|
-
})
|
|
104822
|
-
};
|
|
104823
|
-
}
|
|
104824
|
-
const signed2 = await signedIn({ context, args }).catch(() => null);
|
|
104825
|
-
if (signed2?.profile.kind !== "agent" && signed2?.profile.kind !== "person") {
|
|
104826
|
-
throw new CliUsageError(`laze vault env ${WHERE}`);
|
|
104827
|
-
}
|
|
104828
|
-
const { name: name3 } = signed2;
|
|
104829
|
-
const harnessSession = await currentSessionOf({ context, args });
|
|
104830
|
-
const client = forSession({ client: signed2.client, session: harnessSession });
|
|
104831
|
-
const door = signed2.profile.kind === "person" ? {
|
|
104832
|
-
ask: "/api/vault/session/release-batch",
|
|
104833
|
-
status: "/api/vault/session/release-status",
|
|
104834
|
-
extra: { session: await vaultSessionFor({ context, args, harnessSession }) }
|
|
104835
|
-
} : {
|
|
104836
|
-
ask: "/api/agents/me/vault/release-batch",
|
|
104837
|
-
status: "/api/agents/me/vault/release-status",
|
|
104838
|
-
extra: { channelId: flagText({ args, name: "channel" }) || null }
|
|
104839
|
-
};
|
|
104840
|
-
return {
|
|
104841
|
-
keyPath: runKeyPathOf({ turnFile: void 0, connection: keyName, profile: name3 }),
|
|
104842
|
-
ask: async (body) => {
|
|
104843
|
-
try {
|
|
104844
|
-
return await client.post(door.ask, { ...body, ...door.extra });
|
|
104845
|
-
} catch (error63) {
|
|
104846
|
-
if (!(error63 instanceof LazeApiError)) throw error63;
|
|
104847
|
-
throw new CliUsageError(`laze vault: the batch was refused: ${refusalText(error63)}`);
|
|
104848
|
-
}
|
|
104849
|
-
},
|
|
104850
|
-
status: (requestId) => patiently({
|
|
104851
|
-
context,
|
|
104852
|
-
call: () => client.post(door.status, { requestId, ...door.extra })
|
|
104853
|
-
}).catch(refusedRelease)
|
|
104854
|
-
};
|
|
104855
|
-
}
|
|
104856
|
-
async function resolveBatch({
|
|
104857
|
-
context,
|
|
104858
|
-
args,
|
|
104859
|
-
refs
|
|
104860
|
-
}) {
|
|
104861
|
-
const door = await doorOf({ context, args, keyName: "env-names" });
|
|
104862
|
-
const answer6 = await door.ask({ refs, reason: "", command: [], resolveOnly: true });
|
|
104863
|
-
return answer6.entries;
|
|
104864
|
-
}
|
|
104865
|
-
var keyOf = (entry2) => entry2.connection?.name ?? entry2.ref;
|
|
104866
|
-
async function untilAllAnswered({
|
|
104867
|
-
context,
|
|
104868
|
-
door,
|
|
104869
|
-
waiting,
|
|
104870
|
-
deadline
|
|
104871
|
-
}) {
|
|
104872
|
-
const answered = /* @__PURE__ */ new Map();
|
|
104873
|
-
if (waiting.size === 0) return answered;
|
|
104874
|
-
const [first] = waiting.values();
|
|
104875
|
-
context.err(
|
|
104876
|
-
`laze vault: ${[...waiting.keys()].join(", ")} wait for an answer (${first?.message ?? "a card"}); cards expire after 24 hours...
|
|
104877
|
-
`
|
|
104878
|
-
);
|
|
104879
|
-
while (waiting.size > 0) {
|
|
104880
|
-
if (context.nowMs() + POLL_MS > deadline) {
|
|
104881
|
-
context.err(
|
|
104882
|
-
`laze vault: ${[...waiting.keys()].join(", ")} not approved yet; ask again later.
|
|
104883
|
-
`
|
|
104884
|
-
);
|
|
104885
|
-
return "capped";
|
|
104886
|
-
}
|
|
104887
|
-
await context.sleep(POLL_MS);
|
|
104888
|
-
for (const [key, pending2] of waiting) {
|
|
104889
|
-
const next = await door.status(pending2.requestId);
|
|
104890
|
-
if (next.outcome === "ask") waiting.set(key, next);
|
|
104891
|
-
else {
|
|
104892
|
-
waiting.delete(key);
|
|
104893
|
-
answered.set(key, next);
|
|
104894
|
-
}
|
|
104895
|
-
}
|
|
104896
|
-
}
|
|
104897
|
-
return answered;
|
|
104898
|
-
}
|
|
104899
|
-
async function releaseBatch({
|
|
104900
|
-
context,
|
|
104901
|
-
args,
|
|
104902
|
-
refs,
|
|
104903
|
-
reason: reason2,
|
|
104904
|
-
command
|
|
104905
|
-
}) {
|
|
104906
|
-
const deadline = deadlineOf({ args, nowMs: context.nowMs() });
|
|
104907
|
-
const door = await doorOf({ context, args, keyName: `env:${[...refs].toSorted().join(",")}` });
|
|
104908
|
-
const run4 = await runKeyAt({ path: door.keyPath });
|
|
104909
|
-
let answer6;
|
|
104910
|
-
let settled3;
|
|
104911
|
-
try {
|
|
104912
|
-
answer6 = await door.ask({ refs, reason: reason2, command, recipient: run4.publicKey });
|
|
104913
|
-
const missing = answer6.entries.filter((entry2) => !entry2.connection);
|
|
104914
|
-
if (missing.length > 0) {
|
|
104915
|
-
context.err(
|
|
104916
|
-
`laze vault: no key named ${missing.map((entry2) => entry2.ref).join(", ")} in your vault or reachable by this agent
|
|
104917
|
-
`
|
|
104918
|
-
);
|
|
104919
|
-
return { exitCode: 1 };
|
|
104920
|
-
}
|
|
104921
|
-
settled3 = /* @__PURE__ */ new Map();
|
|
104922
|
-
const waiting = /* @__PURE__ */ new Map();
|
|
104923
|
-
for (const entry2 of answer6.entries) {
|
|
104924
|
-
const release2 = entry2.release;
|
|
104925
|
-
if (!release2) continue;
|
|
104926
|
-
if (release2.outcome === "ask") waiting.set(keyOf(entry2), release2);
|
|
104927
|
-
else settled3.set(keyOf(entry2), release2);
|
|
104928
|
-
}
|
|
104929
|
-
const later = await untilAllAnswered({ context, door, waiting, deadline });
|
|
104930
|
-
if (later === "capped") return { exitCode: 75 };
|
|
104931
|
-
for (const [key, release2] of later) settled3.set(key, release2);
|
|
104932
|
-
} catch (error63) {
|
|
104933
|
-
if (!(error63 instanceof ServerGoneError)) throw error63;
|
|
104934
|
-
context.err(`${error63.message}. Run the command again to keep waiting.
|
|
104935
|
-
`);
|
|
104936
|
-
return { exitCode: 75 };
|
|
104937
|
-
}
|
|
104938
|
-
return valuesOf({ context, entries: answer6.entries, settled: settled3, run: run4, keyPath: door.keyPath });
|
|
104939
|
-
}
|
|
104940
|
-
function refusalOf({
|
|
104941
|
-
context,
|
|
104942
|
-
settled: settled3
|
|
104943
|
-
}) {
|
|
104944
|
-
const codes = [];
|
|
104945
|
-
for (const release2 of settled3.values()) {
|
|
104946
|
-
if (release2.outcome !== "deny") continue;
|
|
104947
|
-
context.err(`${release2.message}
|
|
104948
|
-
`);
|
|
104949
|
-
codes.push(release2.exitCode || 1);
|
|
104950
|
-
}
|
|
104951
|
-
if (codes.length === 0) return 0;
|
|
104952
|
-
return codes.includes(77) ? 77 : codes[0] ?? 1;
|
|
104953
|
-
}
|
|
104954
|
-
async function valuesOf({
|
|
104955
|
-
context,
|
|
104956
|
-
entries,
|
|
104957
|
-
settled: settled3,
|
|
104958
|
-
run: run4,
|
|
104959
|
-
keyPath
|
|
104960
|
-
}) {
|
|
104961
|
-
const refused = refusalOf({ context, settled: settled3 });
|
|
104962
|
-
if (refused !== 0) {
|
|
104963
|
-
await rm20(keyPath, { force: true });
|
|
104964
|
-
return { exitCode: refused };
|
|
104965
|
-
}
|
|
104966
|
-
const opened = /* @__PURE__ */ new Map();
|
|
104967
|
-
let keep2 = false;
|
|
104968
|
-
for (const [key, release2] of settled3) {
|
|
104969
|
-
if (release2.outcome !== "allow") continue;
|
|
104970
|
-
opened.set(key, await envOf({ release: release2, run: run4 }));
|
|
104971
|
-
if (leaseHolds({ release: release2, nowMs: context.nowMs() })) keep2 = true;
|
|
104972
|
-
if (release2.message) context.err(`${release2.message}
|
|
104973
|
-
`);
|
|
104974
|
-
}
|
|
104975
|
-
if (!keep2) await rm20(keyPath, { force: true });
|
|
104976
|
-
const released = /* @__PURE__ */ new Map();
|
|
104977
|
-
for (const entry2 of entries) {
|
|
104978
|
-
const fields = opened.get(keyOf(entry2));
|
|
104979
|
-
if (fields) released.set(entry2.ref, { fields });
|
|
104980
|
-
}
|
|
104981
|
-
return { released, entries };
|
|
104982
|
-
}
|
|
104983
|
-
|
|
104984
105456
|
// src/services/vault-env-commands.service.ts
|
|
104985
105457
|
var ENV_USAGE = `Usage: laze vault env [<file>] [--env <name>] --reason "<one plain sentence>" [--wait <s>] -- <command> [args...]
|
|
104986
105458
|
laze vault env [<file>] [--env <name>] --names
|
|
@@ -105050,7 +105522,7 @@ async function manifestOf({
|
|
|
105050
105522
|
args
|
|
105051
105523
|
}) {
|
|
105052
105524
|
const file4 = await manifestPathOf({ context, args });
|
|
105053
|
-
const text3 = await
|
|
105525
|
+
const text3 = await readFile36(file4, "utf8").catch(() => {
|
|
105054
105526
|
throw new CliUsageError(`laze vault: cannot read ${file4}`);
|
|
105055
105527
|
});
|
|
105056
105528
|
return { file: file4, lines: parseManifest({ text: text3, file: file4 }) };
|
|
@@ -105412,7 +105884,7 @@ async function vaultScrub({ context, args }) {
|
|
|
105412
105884
|
}
|
|
105413
105885
|
|
|
105414
105886
|
// src/services/whatsapp-business-commands.service.ts
|
|
105415
|
-
import { readFile as
|
|
105887
|
+
import { readFile as readFile37 } from "node:fs/promises";
|
|
105416
105888
|
import { resolve as resolve25 } from "node:path";
|
|
105417
105889
|
|
|
105418
105890
|
// ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
|
|
@@ -105909,7 +106381,7 @@ async function secretsOf3({ context, args }) {
|
|
|
105909
106381
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
105910
106382
|
if (fromConnection) return { fromConnection };
|
|
105911
106383
|
const file4 = flagText({ args, name: "from-file" });
|
|
105912
|
-
const text3 = file4 ? await
|
|
106384
|
+
const text3 = file4 ? await readFile37(resolve25(context.cwd, file4), "utf8") : await context.readStdin();
|
|
105913
106385
|
const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
105914
106386
|
if (lines2.length !== 2) {
|
|
105915
106387
|
throw new CliUsageError(
|
|
@@ -107114,7 +107586,7 @@ import {
|
|
|
107114
107586
|
randomBytes as randomBytes6,
|
|
107115
107587
|
sign
|
|
107116
107588
|
} from "node:crypto";
|
|
107117
|
-
import { chmod, link, mkdir as mkdir13, readFile as
|
|
107589
|
+
import { chmod, link, mkdir as mkdir13, readFile as readFile38, rm as rm21, writeFile as writeFile11 } from "node:fs/promises";
|
|
107118
107590
|
import { dirname as dirname27, join as join37 } from "node:path";
|
|
107119
107591
|
var KEYCHAIN_SERVICE = "laze-cli-machine-key";
|
|
107120
107592
|
var runProgram = ({ program, args, stdin: stdin2, timeoutMs }) => new Promise((resolve27, reject) => {
|
|
@@ -107187,7 +107659,7 @@ var MachineKeyStore = class _MachineKeyStore {
|
|
|
107187
107659
|
async read() {
|
|
107188
107660
|
let meta3;
|
|
107189
107661
|
try {
|
|
107190
|
-
meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await
|
|
107662
|
+
meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await readFile38(this.metaPath, "utf8")));
|
|
107191
107663
|
} catch {
|
|
107192
107664
|
return null;
|
|
107193
107665
|
}
|
|
@@ -107202,7 +107674,7 @@ var MachineKeyStore = class _MachineKeyStore {
|
|
|
107202
107674
|
"-w"
|
|
107203
107675
|
],
|
|
107204
107676
|
timeoutMs: 1e4
|
|
107205
|
-
}) : await
|
|
107677
|
+
}) : await readFile38(this.pemPathOf(meta3.jwk), "utf8");
|
|
107206
107678
|
return keyOf2({ meta: meta3, privateKey: createPrivateKey(pemOf(pem)) });
|
|
107207
107679
|
}
|
|
107208
107680
|
async make() {
|
|
@@ -107344,7 +107816,7 @@ function machineProofFetch({
|
|
|
107344
107816
|
// src/services/processes.service.ts
|
|
107345
107817
|
import { execFile as execFile3, spawn as spawn4, spawnSync } from "node:child_process";
|
|
107346
107818
|
import { closeSync, mkdirSync, openSync, renameSync, statSync } from "node:fs";
|
|
107347
|
-
import { readFile as
|
|
107819
|
+
import { readFile as readFile39, readlink } from "node:fs/promises";
|
|
107348
107820
|
import { dirname as dirname28 } from "node:path";
|
|
107349
107821
|
import { promisify as promisify2 } from "node:util";
|
|
107350
107822
|
var run3 = promisify2(execFile3);
|
|
@@ -107358,14 +107830,14 @@ function alive(pid) {
|
|
|
107358
107830
|
}
|
|
107359
107831
|
}
|
|
107360
107832
|
async function argsOf2(pid) {
|
|
107361
|
-
const raw = await
|
|
107833
|
+
const raw = await readFile39(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
|
|
107362
107834
|
if (raw) return raw.split("\0").filter(Boolean);
|
|
107363
107835
|
const listed = await run3("ps", ["-o", "args=", "-p", String(pid)]).catch(() => void 0);
|
|
107364
107836
|
const line = listed?.stdout.trim();
|
|
107365
107837
|
return line ? line.split(/\s+/) : void 0;
|
|
107366
107838
|
}
|
|
107367
107839
|
async function parentOf(pid) {
|
|
107368
|
-
const stat13 = await
|
|
107840
|
+
const stat13 = await readFile39(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
|
|
107369
107841
|
const fromStat = stat13 ? Number(stat13.slice(stat13.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
|
|
107370
107842
|
if (fromStat > 0) return fromStat;
|
|
107371
107843
|
const listed = await run3("ps", ["-o", "ppid=", "-p", String(pid)]).catch(() => void 0);
|
|
@@ -107373,7 +107845,7 @@ async function parentOf(pid) {
|
|
|
107373
107845
|
return parent > 0 ? parent : void 0;
|
|
107374
107846
|
}
|
|
107375
107847
|
async function startOf(pid) {
|
|
107376
|
-
const stat13 = await
|
|
107848
|
+
const stat13 = await readFile39(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
|
|
107377
107849
|
const ticks = stat13 ? stat13.slice(stat13.lastIndexOf(")") + 2).split(" ")[19] : void 0;
|
|
107378
107850
|
if (ticks) return ticks;
|
|
107379
107851
|
const listed = await run3("ps", ["-o", "lstart=", "-p", String(pid)]).catch(() => void 0);
|