@lazehq/cli 0.1.128 → 0.1.130
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 +845 -377
- 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.130";
|
|
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 {
|
|
@@ -89406,7 +89656,7 @@ async function channelSettings({ context, args }) {
|
|
|
89406
89656
|
|
|
89407
89657
|
// src/services/chat-actions-commands.service.ts
|
|
89408
89658
|
import { readFile as readFile19 } from "node:fs/promises";
|
|
89409
|
-
import { basename as basename9,
|
|
89659
|
+
import { basename as basename9, resolve as resolve11 } from "node:path";
|
|
89410
89660
|
|
|
89411
89661
|
// src/rules/app-link.rules.ts
|
|
89412
89662
|
var MARKDOWN_LINK = /^\[[^\]]*\]\((\S+)\)$/;
|
|
@@ -89626,7 +89876,7 @@ var CHAT_ACTIONS_USAGE = `Usage:
|
|
|
89626
89876
|
laze file link <fileId> [--variant original|thumbnail|poster|preview] [--download]
|
|
89627
89877
|
laze file download <fileId> [--out <path>] save a file to disk, up to 1 GB
|
|
89628
89878
|
laze file rename <fileId> <name> rename a file you posted
|
|
89629
|
-
laze file upload <channel> <path> [--name <name>] [--type <content-type>] upload a file; post it with its id
|
|
89879
|
+
laze file upload <channel> <path> [--name <name>] [--type <content-type>] upload a file under its own name (or --name); post it with its id
|
|
89630
89880
|
laze saved [--done] [--limit <n>] | laze saved marks your saved messages (people)
|
|
89631
89881
|
laze save <messageId> [--off] save a message for later, or take it out
|
|
89632
89882
|
laze saved done <messageId> [--undo] mark a saved message done, or open again
|
|
@@ -89850,10 +90100,6 @@ var files = async ({ context, args, client }) => {
|
|
|
89850
90100
|
}).join("") || "No files.\n"
|
|
89851
90101
|
});
|
|
89852
90102
|
};
|
|
89853
|
-
function uploadNameOf({ cwd, path }) {
|
|
89854
|
-
const inside = relative4(cwd, path);
|
|
89855
|
-
return inside && !inside.startsWith("..") && !isAbsolute2(inside) ? inside : basename9(path);
|
|
89856
|
-
}
|
|
89857
90103
|
var fileUpload = async ({ context, args, client }) => {
|
|
89858
90104
|
const path = resolve11(context.cwd, wordAt(args, 3));
|
|
89859
90105
|
const bytes = new Uint8Array(await readFile19(path));
|
|
@@ -89863,7 +90109,7 @@ var fileUpload = async ({ context, args, client }) => {
|
|
|
89863
90109
|
file: {
|
|
89864
90110
|
channel: wordAt(args, 2),
|
|
89865
90111
|
fileName: readableUploadName({
|
|
89866
|
-
name:
|
|
90112
|
+
name: basename9(path),
|
|
89867
90113
|
...flagText({ args, name: "name" }) && { asked: flagText({ args, name: "name" }) }
|
|
89868
90114
|
}),
|
|
89869
90115
|
contentType: flagText({ args, name: "type", fallback: contentTypeOf(path) }),
|
|
@@ -90171,6 +90417,8 @@ var browserTabDefinition = external_exports.object({
|
|
|
90171
90417
|
createdAt: external_exports.iso.datetime(),
|
|
90172
90418
|
/** Only on an open: an open tab of that title was reused instead of making a second one. */
|
|
90173
90419
|
reused: external_exports.boolean().optional(),
|
|
90420
|
+
/** Only on a read: the site the owner's dedicated IP last failed to reach, lately. */
|
|
90421
|
+
routeFailure: external_exports.object({ host: external_exports.string().min(1), at: external_exports.iso.datetime() }).nullable().optional(),
|
|
90174
90422
|
/** What the reader may do: see the screen, type into it, change the tab; asked: the open
|
|
90175
90423
|
* request names them. */
|
|
90176
90424
|
you: external_exports.object({
|
|
@@ -90209,6 +90457,12 @@ var gotoDefinition = external_exports.object({
|
|
|
90209
90457
|
url: external_exports.string().trim().min(1).max(4096)
|
|
90210
90458
|
});
|
|
90211
90459
|
var browserTabGotoInputSchema = gotoDefinition;
|
|
90460
|
+
var browserTabStepSchema = external_exports.enum(["back", "forward", "reload"]);
|
|
90461
|
+
var stepDefinition = external_exports.object({
|
|
90462
|
+
...browserTabRefDefinition.shape,
|
|
90463
|
+
step: browserTabStepSchema
|
|
90464
|
+
});
|
|
90465
|
+
var browserTabStepInputSchema = stepDefinition;
|
|
90212
90466
|
var askDefinition = external_exports.object({
|
|
90213
90467
|
...browserTabRefDefinition.shape,
|
|
90214
90468
|
text: external_exports.string().trim().min(1).max(500)
|
|
@@ -92106,6 +92360,39 @@ var agentHostGrantDefinition = external_exports.object({
|
|
|
92106
92360
|
expiresAt: external_exports.iso.datetime()
|
|
92107
92361
|
});
|
|
92108
92362
|
|
|
92363
|
+
// ../../modules/compute/contract/src/whatsapp-history.ts
|
|
92364
|
+
var WHATSAPP_HISTORY_PATH = "/api/compute/whatsapp/history";
|
|
92365
|
+
var historyInputDefinition = external_exports.object({
|
|
92366
|
+
workspaceId: external_exports.string().min(1).max(64),
|
|
92367
|
+
/** The Laze conversation that mirrors the chat. */
|
|
92368
|
+
channelId: external_exports.string().min(1).max(64),
|
|
92369
|
+
/** The page holds messages written before this time. */
|
|
92370
|
+
before: external_exports.iso.datetime({ offset: true })
|
|
92371
|
+
});
|
|
92372
|
+
var whatsappHistoryInputSchema = historyInputDefinition;
|
|
92373
|
+
var historyByKeyInputDefinition = historyInputDefinition.omit({ workspaceId: true });
|
|
92374
|
+
var historyMessageDefinition = external_exports.object({
|
|
92375
|
+
/** The same key a cached copy of the message carries. */
|
|
92376
|
+
key: external_exports.string().min(1),
|
|
92377
|
+
createdAt: external_exports.iso.datetime(),
|
|
92378
|
+
authorName: external_exports.string(),
|
|
92379
|
+
authorAvatarUrl: external_exports.null(),
|
|
92380
|
+
/** The owner, for their own messages; else null. */
|
|
92381
|
+
authorUserId: external_exports.string().nullable(),
|
|
92382
|
+
/** The chat's outside author id, as the cached copies carry it; null for the owner. */
|
|
92383
|
+
authorExternalId: external_exports.string().nullable(),
|
|
92384
|
+
/** Laze markdown; a file is named, and opens on the phone. */
|
|
92385
|
+
body: external_exports.string(),
|
|
92386
|
+
replyCount: external_exports.literal(0),
|
|
92387
|
+
files: external_exports.array(external_exports.never())
|
|
92388
|
+
});
|
|
92389
|
+
var historyPageDefinition = external_exports.object({
|
|
92390
|
+
/** Oldest first. */
|
|
92391
|
+
messages: external_exports.array(historyMessageDefinition),
|
|
92392
|
+
hasOlder: external_exports.boolean()
|
|
92393
|
+
});
|
|
92394
|
+
var whatsappHistoryPageSchema = historyPageDefinition;
|
|
92395
|
+
|
|
92109
92396
|
// ../../modules/compute/contract/src/compute.ts
|
|
92110
92397
|
var idSchema26 = external_exports.string().min(1).max(64);
|
|
92111
92398
|
var workspaceIdSchema23 = external_exports.string().min(1).max(64);
|
|
@@ -92301,10 +92588,12 @@ var ownMachineSshConnectDefinition = external_exports.object({
|
|
|
92301
92588
|
var ownMachineSshConnectSchema = ownMachineSshConnectDefinition;
|
|
92302
92589
|
var reconcileDefinition = external_exports.object({ workspaceId: workspaceIdSchema23, machineId: idSchema26 });
|
|
92303
92590
|
var ComputeApi = moduleApi()("compute");
|
|
92304
|
-
var
|
|
92305
|
-
var
|
|
92591
|
+
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();
|
|
92592
|
+
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();
|
|
92593
|
+
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
92594
|
var computeTrpc = joinTrpcContracts(
|
|
92307
92595
|
"compute",
|
|
92596
|
+
computeBrowserTabTrpc,
|
|
92308
92597
|
computeCoreTrpc,
|
|
92309
92598
|
computeFleetTrpc,
|
|
92310
92599
|
computeWaitlistTrpc
|
|
@@ -92812,7 +93101,23 @@ var whatsappMirrorHealthDefinition = external_exports.object({
|
|
|
92812
93101
|
failureCode: external_exports.string().nullable()
|
|
92813
93102
|
}).nullable(),
|
|
92814
93103
|
/** 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 }))
|
|
93104
|
+
holds: external_exports.array(external_exports.object({ kind: external_exports.string(), code: external_exports.string(), count: count11, oldestAt: at4 })),
|
|
93105
|
+
/**
|
|
93106
|
+
* The computer store's fill (ADR-223): chats done, how many mirrored items from the last 6
|
|
93107
|
+
* months Laze held, those the store held and those sent; the mirrored items Laze holds now
|
|
93108
|
+
* and how many a trim to 7 days after last read would delete. Null before a fill started.
|
|
93109
|
+
*/
|
|
93110
|
+
storeFill: external_exports.object({
|
|
93111
|
+
chats: count11,
|
|
93112
|
+
lazeHeld: count11,
|
|
93113
|
+
alreadyHeld: count11,
|
|
93114
|
+
sent: count11,
|
|
93115
|
+
problem: external_exports.string().nullable(),
|
|
93116
|
+
filledAt: at4.nullable(),
|
|
93117
|
+
updatedAt: at4,
|
|
93118
|
+
mirrored: count11,
|
|
93119
|
+
trimmable: count11
|
|
93120
|
+
}).nullable().optional()
|
|
92816
93121
|
})
|
|
92817
93122
|
)
|
|
92818
93123
|
});
|
|
@@ -92977,7 +93282,18 @@ var computerBrowserFactsDefinition = external_exports.object({
|
|
|
92977
93282
|
openTabs: external_exports.number().int().nonnegative(),
|
|
92978
93283
|
streamsNow: external_exports.number().int().nonnegative(),
|
|
92979
93284
|
/** Since this api process started, newest last, at most 60. */
|
|
92980
|
-
events: external_exports.array(relayEventDefinition).max(60)
|
|
93285
|
+
events: external_exports.array(relayEventDefinition).max(60),
|
|
93286
|
+
/**
|
|
93287
|
+
* Where the browser's traffic leaves: the person's dedicated IP and whether the computer's
|
|
93288
|
+
* browser joins it (only a route for all traffic does), else the shared address.
|
|
93289
|
+
*/
|
|
93290
|
+
egress: external_exports.object({
|
|
93291
|
+
dedicatedIp: external_exports.enum(["none", "off", "pending", "on"]),
|
|
93292
|
+
scope: dedicatedIpScopeSchema.nullable(),
|
|
93293
|
+
countryCode: external_exports.string().max(8).nullable(),
|
|
93294
|
+
onSince: at5.nullable(),
|
|
93295
|
+
browserLeaves: external_exports.enum(["dedicated_ip", "shared_address"])
|
|
93296
|
+
})
|
|
92981
93297
|
});
|
|
92982
93298
|
var computerBrowserFactsSchema = computerBrowserFactsDefinition;
|
|
92983
93299
|
|
|
@@ -93813,11 +94129,11 @@ async function suggestServer({
|
|
|
93813
94129
|
}
|
|
93814
94130
|
|
|
93815
94131
|
// src/services/connector-commands.service.ts
|
|
93816
|
-
import { readFile as
|
|
94132
|
+
import { readFile as readFile24 } from "node:fs/promises";
|
|
93817
94133
|
import { resolve as resolve14 } from "node:path";
|
|
93818
94134
|
|
|
93819
94135
|
// src/services/vault-keychain-commands.service.ts
|
|
93820
|
-
import { readFile as
|
|
94136
|
+
import { readFile as readFile23 } from "node:fs/promises";
|
|
93821
94137
|
|
|
93822
94138
|
// src/rules/vault-input.rules.ts
|
|
93823
94139
|
function secondsOf(text3) {
|
|
@@ -94110,6 +94426,273 @@ var listDevices = async ({ context, args }) => {
|
|
|
94110
94426
|
}
|
|
94111
94427
|
};
|
|
94112
94428
|
|
|
94429
|
+
// src/services/vault-batch.service.ts
|
|
94430
|
+
import { readFile as readFile22, rm as rm16 } from "node:fs/promises";
|
|
94431
|
+
async function placeholdersOf({
|
|
94432
|
+
env
|
|
94433
|
+
}) {
|
|
94434
|
+
const path = env.LAZE_VAULT_PLACEHOLDERS;
|
|
94435
|
+
if (!path || !proxyOf({ env })) return {};
|
|
94436
|
+
try {
|
|
94437
|
+
const parsed = JSON.parse(await readFile22(path, "utf8"));
|
|
94438
|
+
return parsed && typeof parsed === "object" ? parsed : {};
|
|
94439
|
+
} catch {
|
|
94440
|
+
return {};
|
|
94441
|
+
}
|
|
94442
|
+
}
|
|
94443
|
+
async function batchOf({ response }) {
|
|
94444
|
+
const text3 = await response.text();
|
|
94445
|
+
if (!response.ok) {
|
|
94446
|
+
const code4 = /"code"\s*:\s*"([^"]+)"/.exec(text3)?.[1] ?? `status ${response.status}`;
|
|
94447
|
+
throw new CliUsageError(`laze vault: the batch was refused (${code4})`);
|
|
94448
|
+
}
|
|
94449
|
+
return JSON.parse(text3);
|
|
94450
|
+
}
|
|
94451
|
+
async function doorOf({
|
|
94452
|
+
context,
|
|
94453
|
+
args,
|
|
94454
|
+
keyName
|
|
94455
|
+
}) {
|
|
94456
|
+
const env = context.environment.inherited;
|
|
94457
|
+
const proxy = proxyOf({ env });
|
|
94458
|
+
if (proxy) {
|
|
94459
|
+
const turnFile = turnFileOf({ env });
|
|
94460
|
+
const headers = {
|
|
94461
|
+
"proxy-authorization": proxy.authorization,
|
|
94462
|
+
"x-laze-turn": await turnTokenOf2({ env, turnFile, command: "laze vault env" })
|
|
94463
|
+
};
|
|
94464
|
+
return {
|
|
94465
|
+
keyPath: runKeyPathOf({ turnFile, connection: keyName }),
|
|
94466
|
+
ask: async (body) => batchOf({
|
|
94467
|
+
response: await reach({
|
|
94468
|
+
context,
|
|
94469
|
+
url: `${proxy.origin}/vault/release-batch`,
|
|
94470
|
+
init: {
|
|
94471
|
+
method: "POST",
|
|
94472
|
+
headers: { ...headers, "content-type": "application/json" },
|
|
94473
|
+
body: JSON.stringify(body)
|
|
94474
|
+
}
|
|
94475
|
+
})
|
|
94476
|
+
}),
|
|
94477
|
+
status: async (requestId) => releaseOf({
|
|
94478
|
+
response: await reach({
|
|
94479
|
+
context,
|
|
94480
|
+
url: `${proxy.origin}/vault/release/${encodeURIComponent(requestId)}`,
|
|
94481
|
+
init: { method: "GET", headers }
|
|
94482
|
+
})
|
|
94483
|
+
})
|
|
94484
|
+
};
|
|
94485
|
+
}
|
|
94486
|
+
const signed2 = await signedIn({ context, args }).catch(() => null);
|
|
94487
|
+
if (signed2?.profile.kind !== "agent" && signed2?.profile.kind !== "person") {
|
|
94488
|
+
throw new CliUsageError(`laze vault env ${WHERE}`);
|
|
94489
|
+
}
|
|
94490
|
+
const { name: name3 } = signed2;
|
|
94491
|
+
const harnessSession = await currentSessionOf({ context, args });
|
|
94492
|
+
const client = forSession({ client: signed2.client, session: harnessSession });
|
|
94493
|
+
const door = signed2.profile.kind === "person" ? {
|
|
94494
|
+
ask: "/api/vault/session/release-batch",
|
|
94495
|
+
status: "/api/vault/session/release-status",
|
|
94496
|
+
extra: { session: await vaultSessionFor({ context, args, harnessSession }) }
|
|
94497
|
+
} : {
|
|
94498
|
+
ask: "/api/agents/me/vault/release-batch",
|
|
94499
|
+
status: "/api/agents/me/vault/release-status",
|
|
94500
|
+
extra: { channelId: flagText({ args, name: "channel" }) || null }
|
|
94501
|
+
};
|
|
94502
|
+
return {
|
|
94503
|
+
keyPath: runKeyPathOf({ turnFile: void 0, connection: keyName, profile: name3 }),
|
|
94504
|
+
ask: async (body) => {
|
|
94505
|
+
try {
|
|
94506
|
+
return await client.post(door.ask, { ...body, ...door.extra });
|
|
94507
|
+
} catch (error63) {
|
|
94508
|
+
if (!(error63 instanceof LazeApiError)) throw error63;
|
|
94509
|
+
throw new CliUsageError(`laze vault: the batch was refused: ${refusalText(error63)}`);
|
|
94510
|
+
}
|
|
94511
|
+
},
|
|
94512
|
+
status: (requestId) => patiently({
|
|
94513
|
+
context,
|
|
94514
|
+
call: () => client.post(door.status, { requestId, ...door.extra })
|
|
94515
|
+
}).catch(refusedRelease)
|
|
94516
|
+
};
|
|
94517
|
+
}
|
|
94518
|
+
async function resolveBatch({
|
|
94519
|
+
context,
|
|
94520
|
+
args,
|
|
94521
|
+
refs
|
|
94522
|
+
}) {
|
|
94523
|
+
const door = await doorOf({ context, args, keyName: "env-names" });
|
|
94524
|
+
const answer6 = await door.ask({ refs, reason: "", command: [], resolveOnly: true });
|
|
94525
|
+
return answer6.entries;
|
|
94526
|
+
}
|
|
94527
|
+
var keyOf = (entry2) => entry2.connection?.name ?? entry2.ref;
|
|
94528
|
+
async function untilAllAnswered({
|
|
94529
|
+
context,
|
|
94530
|
+
door,
|
|
94531
|
+
waiting,
|
|
94532
|
+
deadline
|
|
94533
|
+
}) {
|
|
94534
|
+
const answered = /* @__PURE__ */ new Map();
|
|
94535
|
+
if (waiting.size === 0) return answered;
|
|
94536
|
+
const [first] = waiting.values();
|
|
94537
|
+
context.err(
|
|
94538
|
+
`laze vault: ${[...waiting.keys()].join(", ")} wait for an answer (${first?.message ?? "a card"}); cards expire after 24 hours...
|
|
94539
|
+
`
|
|
94540
|
+
);
|
|
94541
|
+
while (waiting.size > 0) {
|
|
94542
|
+
if (context.nowMs() + POLL_MS > deadline) {
|
|
94543
|
+
context.err(
|
|
94544
|
+
`laze vault: ${[...waiting.keys()].join(", ")} not approved yet; ask again later.
|
|
94545
|
+
`
|
|
94546
|
+
);
|
|
94547
|
+
return "capped";
|
|
94548
|
+
}
|
|
94549
|
+
await context.sleep(POLL_MS);
|
|
94550
|
+
for (const [key, pending2] of waiting) {
|
|
94551
|
+
const next = await door.status(pending2.requestId);
|
|
94552
|
+
if (next.outcome === "ask") waiting.set(key, next);
|
|
94553
|
+
else {
|
|
94554
|
+
waiting.delete(key);
|
|
94555
|
+
answered.set(key, next);
|
|
94556
|
+
}
|
|
94557
|
+
}
|
|
94558
|
+
}
|
|
94559
|
+
return answered;
|
|
94560
|
+
}
|
|
94561
|
+
async function releaseBatch({
|
|
94562
|
+
context,
|
|
94563
|
+
args,
|
|
94564
|
+
refs,
|
|
94565
|
+
reason: reason2,
|
|
94566
|
+
command
|
|
94567
|
+
}) {
|
|
94568
|
+
const deadline = deadlineOf({ args, nowMs: context.nowMs() });
|
|
94569
|
+
const door = await doorOf({ context, args, keyName: `env:${[...refs].toSorted().join(",")}` });
|
|
94570
|
+
const run4 = await runKeyAt({ path: door.keyPath });
|
|
94571
|
+
const placeholders = await placeholdersOf({ env: context.environment.inherited });
|
|
94572
|
+
let answer6;
|
|
94573
|
+
let settled3;
|
|
94574
|
+
try {
|
|
94575
|
+
answer6 = await door.ask({
|
|
94576
|
+
refs,
|
|
94577
|
+
reason: reason2,
|
|
94578
|
+
command,
|
|
94579
|
+
recipient: run4.publicKey,
|
|
94580
|
+
...Object.keys(placeholders).length > 0 && { placeholders: true }
|
|
94581
|
+
});
|
|
94582
|
+
const missing = answer6.entries.filter((entry2) => !entry2.connection);
|
|
94583
|
+
if (missing.length > 0) {
|
|
94584
|
+
context.err(
|
|
94585
|
+
`laze vault: no key named ${missing.map((entry2) => entry2.ref).join(", ")} in your vault or reachable by this agent
|
|
94586
|
+
`
|
|
94587
|
+
);
|
|
94588
|
+
return { exitCode: 1 };
|
|
94589
|
+
}
|
|
94590
|
+
const sorted = sortedReleasesOf({ entries: answer6.entries });
|
|
94591
|
+
settled3 = sorted.settled;
|
|
94592
|
+
const { waiting } = sorted;
|
|
94593
|
+
const later = await untilAllAnswered({ context, door, waiting, deadline });
|
|
94594
|
+
if (later === "capped") return { exitCode: 75 };
|
|
94595
|
+
for (const [key, release2] of later) settled3.set(key, release2);
|
|
94596
|
+
} catch (error63) {
|
|
94597
|
+
if (!(error63 instanceof ServerGoneError)) throw error63;
|
|
94598
|
+
context.err(`${error63.message}. Run the command again to keep waiting.
|
|
94599
|
+
`);
|
|
94600
|
+
return { exitCode: 75 };
|
|
94601
|
+
}
|
|
94602
|
+
const swapped = swappedOf({ context, entries: answer6.entries, placeholders });
|
|
94603
|
+
if (!swapped) return { exitCode: 1 };
|
|
94604
|
+
const outcome = await valuesOf({
|
|
94605
|
+
context,
|
|
94606
|
+
entries: answer6.entries,
|
|
94607
|
+
settled: settled3,
|
|
94608
|
+
run: run4,
|
|
94609
|
+
keyPath: door.keyPath
|
|
94610
|
+
});
|
|
94611
|
+
if ("exitCode" in outcome) return outcome;
|
|
94612
|
+
for (const [ref2, fields] of swapped) outcome.released.set(ref2, { fields });
|
|
94613
|
+
return outcome;
|
|
94614
|
+
}
|
|
94615
|
+
function swappedOf({
|
|
94616
|
+
context,
|
|
94617
|
+
entries,
|
|
94618
|
+
placeholders
|
|
94619
|
+
}) {
|
|
94620
|
+
const swapped = /* @__PURE__ */ new Map();
|
|
94621
|
+
for (const entry2 of entries) {
|
|
94622
|
+
if (!entry2.boundary || !entry2.connection) continue;
|
|
94623
|
+
const held = placeholders[entry2.boundary.connectionId] ?? {};
|
|
94624
|
+
const fields = Object.fromEntries(
|
|
94625
|
+
entry2.connection.fieldNames.flatMap((field) => {
|
|
94626
|
+
const placeholder = held[field];
|
|
94627
|
+
return placeholder ? [[field, placeholder]] : [];
|
|
94628
|
+
})
|
|
94629
|
+
);
|
|
94630
|
+
if (Object.keys(fields).length === 0) {
|
|
94631
|
+
context.err(
|
|
94632
|
+
`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
|
|
94633
|
+
`
|
|
94634
|
+
);
|
|
94635
|
+
return null;
|
|
94636
|
+
}
|
|
94637
|
+
swapped.set(entry2.ref, fields);
|
|
94638
|
+
}
|
|
94639
|
+
return swapped;
|
|
94640
|
+
}
|
|
94641
|
+
function sortedReleasesOf({ entries }) {
|
|
94642
|
+
const settled3 = /* @__PURE__ */ new Map();
|
|
94643
|
+
const waiting = /* @__PURE__ */ new Map();
|
|
94644
|
+
for (const entry2 of entries) {
|
|
94645
|
+
const release2 = entry2.release;
|
|
94646
|
+
if (!release2) continue;
|
|
94647
|
+
if (release2.outcome === "ask") waiting.set(keyOf(entry2), release2);
|
|
94648
|
+
else settled3.set(keyOf(entry2), release2);
|
|
94649
|
+
}
|
|
94650
|
+
return { settled: settled3, waiting };
|
|
94651
|
+
}
|
|
94652
|
+
function refusalOf({
|
|
94653
|
+
context,
|
|
94654
|
+
settled: settled3
|
|
94655
|
+
}) {
|
|
94656
|
+
const codes = [];
|
|
94657
|
+
for (const release2 of settled3.values()) {
|
|
94658
|
+
if (release2.outcome !== "deny") continue;
|
|
94659
|
+
context.err(`${release2.message}
|
|
94660
|
+
`);
|
|
94661
|
+
codes.push(release2.exitCode || 1);
|
|
94662
|
+
}
|
|
94663
|
+
if (codes.length === 0) return 0;
|
|
94664
|
+
return codes.includes(77) ? 77 : codes[0] ?? 1;
|
|
94665
|
+
}
|
|
94666
|
+
async function valuesOf({
|
|
94667
|
+
context,
|
|
94668
|
+
entries,
|
|
94669
|
+
settled: settled3,
|
|
94670
|
+
run: run4,
|
|
94671
|
+
keyPath
|
|
94672
|
+
}) {
|
|
94673
|
+
const refused = refusalOf({ context, settled: settled3 });
|
|
94674
|
+
if (refused !== 0) {
|
|
94675
|
+
await rm16(keyPath, { force: true });
|
|
94676
|
+
return { exitCode: refused };
|
|
94677
|
+
}
|
|
94678
|
+
const opened = /* @__PURE__ */ new Map();
|
|
94679
|
+
let keep2 = false;
|
|
94680
|
+
for (const [key, release2] of settled3) {
|
|
94681
|
+
if (release2.outcome !== "allow") continue;
|
|
94682
|
+
opened.set(key, await envOf({ release: release2, run: run4 }));
|
|
94683
|
+
if (leaseHolds({ release: release2, nowMs: context.nowMs() })) keep2 = true;
|
|
94684
|
+
if (release2.message) context.err(`${release2.message}
|
|
94685
|
+
`);
|
|
94686
|
+
}
|
|
94687
|
+
if (!keep2) await rm16(keyPath, { force: true });
|
|
94688
|
+
const released = /* @__PURE__ */ new Map();
|
|
94689
|
+
for (const entry2 of entries) {
|
|
94690
|
+
const fields = opened.get(keyOf(entry2));
|
|
94691
|
+
if (fields) released.set(entry2.ref, { fields });
|
|
94692
|
+
}
|
|
94693
|
+
return { released, entries };
|
|
94694
|
+
}
|
|
94695
|
+
|
|
94113
94696
|
// src/services/vault-share-commands.service.ts
|
|
94114
94697
|
var SHARE_USAGE2 = "Usage: laze vault share <connection> --with <email|userId> [--for 1h]";
|
|
94115
94698
|
var WAITING_LINE = "It waits for the owner's approval with a passkey or Face ID, in Settings > Vault.";
|
|
@@ -94173,14 +94756,14 @@ var VAULT_USAGE = `Usage (your own key; an agent's key lists and runs its owner'
|
|
|
94173
94756
|
from an agent, its owner's keys it may use
|
|
94174
94757
|
laze vault add <name> --label <text> [--keychain personal|workspace|agent:<id>]
|
|
94175
94758
|
[--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>]
|
|
94759
|
+
[--lease 15m|1h|8h|1d|2d] [--every-use-asks] [--local-use] [--field <FIELD>] [--from-file <path>]
|
|
94177
94760
|
levels as the page names them: allow (agents use it), auto (the automatic check reads
|
|
94178
94761
|
each use against --rules), always-ask (a person approves), human-only (agents never do)
|
|
94179
94762
|
--lease (or --max-lease) is how long an approval lasts for the agent, 2 days by default
|
|
94180
94763
|
the value comes from stdin or --from-file, never a flag: KEY=value lines, one value
|
|
94181
94764
|
with --field, or a JSON secret bundle ({"kind":"api_key_set","fields":{...}})
|
|
94182
94765
|
laze vault update <connection> [--label] [--level] [--rules] [--approver]... [--lease 1h|none]
|
|
94183
|
-
[--every-use-asks yes|no] [--device-approval]
|
|
94766
|
+
[--every-use-asks yes|no] [--local-use yes|no] [--device-approval]
|
|
94184
94767
|
--device-approval: every Allow and lease needs Touch ID, a passkey or Face ID from then on;
|
|
94185
94768
|
it is turned off only in Settings > Vault, on a device
|
|
94186
94769
|
laze vault replace <connection> [--field <FIELD>] [--from-file <path>] a new value, from stdin
|
|
@@ -94238,9 +94821,16 @@ async function secretText({ context, args }) {
|
|
|
94238
94821
|
);
|
|
94239
94822
|
}
|
|
94240
94823
|
const file4 = flagText({ args, name: "from-file" });
|
|
94241
|
-
const text3 = file4 ? await
|
|
94824
|
+
const text3 = file4 ? await readFile23(file4, "utf8") : await context.readStdin();
|
|
94242
94825
|
const trimmed = text3.replace(/\r?\n$/, "");
|
|
94243
94826
|
if (!trimmed.trim()) throw new CliUsageError("No value: pipe it on stdin or use --from-file.");
|
|
94827
|
+
const held = await placeholdersOf({ env: context.environment.inherited });
|
|
94828
|
+
const field = Object.values(held).flatMap((fields) => Object.entries(fields)).find(([, placeholder]) => trimmed.includes(placeholder))?.[0];
|
|
94829
|
+
if (field) {
|
|
94830
|
+
throw new CliUsageError(
|
|
94831
|
+
`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>.`
|
|
94832
|
+
);
|
|
94833
|
+
}
|
|
94244
94834
|
return trimmed;
|
|
94245
94835
|
}
|
|
94246
94836
|
async function keychainOf2({ client, args }) {
|
|
@@ -94256,6 +94846,7 @@ function settingsOf2(args) {
|
|
|
94256
94846
|
const lease = flagText({ args, name: "lease" }) || flagText({ args, name: "max-lease" });
|
|
94257
94847
|
const approvers = args.lists.approver;
|
|
94258
94848
|
const everyUseAsks = yesNoOf({ args, name: "every-use-asks" });
|
|
94849
|
+
const localUse = yesNoOf({ args, name: "local-use" });
|
|
94259
94850
|
const label3 = flagText({ args, name: "label" });
|
|
94260
94851
|
const rules = args.flags.rules;
|
|
94261
94852
|
return {
|
|
@@ -94264,7 +94855,8 @@ function settingsOf2(args) {
|
|
|
94264
94855
|
...typeof rules === "string" && { rules },
|
|
94265
94856
|
...approvers && { approverUserIds: [...approvers] },
|
|
94266
94857
|
...lease && { maxLeaseSeconds: lease === "none" ? null : secondsOf(lease) },
|
|
94267
|
-
...everyUseAsks !== void 0 && { everyUseAsks }
|
|
94858
|
+
...everyUseAsks !== void 0 && { everyUseAsks },
|
|
94859
|
+
...localUse !== void 0 && { localUse }
|
|
94268
94860
|
};
|
|
94269
94861
|
}
|
|
94270
94862
|
var list4 = async ({ context, args }) => {
|
|
@@ -94474,7 +95066,7 @@ async function keyText({ context, args }) {
|
|
|
94474
95066
|
throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
|
|
94475
95067
|
}
|
|
94476
95068
|
const file4 = flagText({ args, name: "from-file" });
|
|
94477
|
-
const text3 = file4 ? await
|
|
95069
|
+
const text3 = file4 ? await readFile24(resolve14(context.cwd, file4), "utf8") : await context.readStdin();
|
|
94478
95070
|
const trimmed = text3.trim();
|
|
94479
95071
|
if (!trimmed) throw new CliUsageError("No key: pipe it on stdin or use --from-file.");
|
|
94480
95072
|
return trimmed;
|
|
@@ -94863,7 +95455,7 @@ async function conversationDelete({ context, args }) {
|
|
|
94863
95455
|
}
|
|
94864
95456
|
|
|
94865
95457
|
// src/services/discord-commands.service.ts
|
|
94866
|
-
import { readFile as
|
|
95458
|
+
import { readFile as readFile25 } from "node:fs/promises";
|
|
94867
95459
|
import { resolve as resolve15 } from "node:path";
|
|
94868
95460
|
|
|
94869
95461
|
// ../../modules/discord/contract/src/discord.ts
|
|
@@ -94985,13 +95577,13 @@ var oauthCallbackDefinition = external_exports.object({
|
|
|
94985
95577
|
error: external_exports.string().max(200).optional()
|
|
94986
95578
|
});
|
|
94987
95579
|
var linkParamsDefinition = external_exports.object({ workspaceId: workspaceIdSchema25, guildId: discordIdSchema });
|
|
94988
|
-
var
|
|
95580
|
+
var historyInputDefinition2 = external_exports.object({
|
|
94989
95581
|
workspaceId: workspaceIdSchema25,
|
|
94990
95582
|
/** The Laze conversation that mirrors the Discord channel. */
|
|
94991
95583
|
channelId: external_exports.string().min(1).max(200),
|
|
94992
95584
|
before: external_exports.iso.datetime()
|
|
94993
95585
|
});
|
|
94994
|
-
var discordHistoryInputSchema =
|
|
95586
|
+
var discordHistoryInputSchema = historyInputDefinition2;
|
|
94995
95587
|
var channelPeopleInputDefinition = external_exports.object({
|
|
94996
95588
|
workspaceId: workspaceIdSchema25,
|
|
94997
95589
|
channelId: external_exports.string().min(1).max(200)
|
|
@@ -95007,7 +95599,7 @@ var discordFileDefinition = external_exports.object({
|
|
|
95007
95599
|
mimetype: external_exports.string(),
|
|
95008
95600
|
size: external_exports.number().int().nonnegative()
|
|
95009
95601
|
});
|
|
95010
|
-
var
|
|
95602
|
+
var historyMessageDefinition2 = external_exports.object({
|
|
95011
95603
|
key: external_exports.string().min(1),
|
|
95012
95604
|
createdAt: external_exports.iso.datetime(),
|
|
95013
95605
|
authorName: external_exports.string(),
|
|
@@ -95017,12 +95609,12 @@ var historyMessageDefinition = external_exports.object({
|
|
|
95017
95609
|
replyCount: external_exports.number().int().nonnegative(),
|
|
95018
95610
|
files: external_exports.array(discordFileDefinition)
|
|
95019
95611
|
});
|
|
95020
|
-
var
|
|
95612
|
+
var historyPageDefinition2 = external_exports.object({
|
|
95021
95613
|
/** Oldest first. */
|
|
95022
|
-
messages: external_exports.array(
|
|
95614
|
+
messages: external_exports.array(historyMessageDefinition2),
|
|
95023
95615
|
hasOlder: external_exports.boolean()
|
|
95024
95616
|
});
|
|
95025
|
-
var discordHistoryPageSchema =
|
|
95617
|
+
var discordHistoryPageSchema = historyPageDefinition2;
|
|
95026
95618
|
var fileParamsDefinition = external_exports.object({
|
|
95027
95619
|
workspaceId: workspaceIdSchema25,
|
|
95028
95620
|
channelId: external_exports.string().min(1).max(200),
|
|
@@ -95038,7 +95630,7 @@ var saveAppByKeyDefinition = external_exports.object({
|
|
|
95038
95630
|
});
|
|
95039
95631
|
var pickByKeyDefinition = pickDefinition.omit({ workspaceId: true });
|
|
95040
95632
|
var updateByKeyDefinition = updateConnectionDefinition.omit({ workspaceId: true });
|
|
95041
|
-
var historyByKeyDefinition =
|
|
95633
|
+
var historyByKeyDefinition = historyInputDefinition2.omit({ workspaceId: true });
|
|
95042
95634
|
var emptyDefinition3 = external_exports.object({});
|
|
95043
95635
|
var DISCORD_KEY_PATHS = {
|
|
95044
95636
|
overview: "/api/discord/overview",
|
|
@@ -95211,7 +95803,7 @@ async function secretsOf({ context, args }) {
|
|
|
95211
95803
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
95212
95804
|
if (fromConnection) return { fromConnection };
|
|
95213
95805
|
const file4 = flagText({ args, name: "from-file" });
|
|
95214
|
-
const text3 = file4 ? await
|
|
95806
|
+
const text3 = file4 ? await readFile25(resolve15(context.cwd, file4), "utf8") : await context.readStdin();
|
|
95215
95807
|
const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
95216
95808
|
if (lines2.length !== 2) {
|
|
95217
95809
|
throw new CliUsageError(
|
|
@@ -95514,7 +96106,7 @@ async function domains({ context, args }) {
|
|
|
95514
96106
|
}
|
|
95515
96107
|
|
|
95516
96108
|
// src/services/emoji-commands.service.ts
|
|
95517
|
-
import { readFile as
|
|
96109
|
+
import { readFile as readFile26 } from "node:fs/promises";
|
|
95518
96110
|
import { resolve as resolve16 } from "node:path";
|
|
95519
96111
|
var EMOJI_USAGE = `Usage:
|
|
95520
96112
|
laze emoji list [--json] the workspace's custom emoji, aliases and who added each
|
|
@@ -95555,7 +96147,7 @@ async function addEmoji({ context, args, client }) {
|
|
|
95555
96147
|
const file4 = wordAt4(args, 3);
|
|
95556
96148
|
let bytes;
|
|
95557
96149
|
try {
|
|
95558
|
-
bytes = new Uint8Array(await
|
|
96150
|
+
bytes = new Uint8Array(await readFile26(resolve16(context.cwd, file4)));
|
|
95559
96151
|
} catch {
|
|
95560
96152
|
throw new CliUsageError(`Cannot read ${file4}.`);
|
|
95561
96153
|
}
|
|
@@ -95894,7 +96486,7 @@ var ExternalChannelBannerSlot = externalUi.component("channel-banner");
|
|
|
95894
96486
|
var ExternalSharingHooksToken = externalUi.hooks("sharing");
|
|
95895
96487
|
|
|
95896
96488
|
// src/services/workspace-commands.service.ts
|
|
95897
|
-
import { readFile as
|
|
96489
|
+
import { readFile as readFile27 } from "node:fs/promises";
|
|
95898
96490
|
import { resolve as resolve17 } from "node:path";
|
|
95899
96491
|
var ROLE_NAMES2 = {
|
|
95900
96492
|
OWNER: "Owner",
|
|
@@ -96077,7 +96669,7 @@ var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze work
|
|
|
96077
96669
|
async function readLogo({ context, file: file4 }) {
|
|
96078
96670
|
let bytes;
|
|
96079
96671
|
try {
|
|
96080
|
-
bytes = new Uint8Array(await
|
|
96672
|
+
bytes = new Uint8Array(await readFile27(resolve17(context.cwd, file4)));
|
|
96081
96673
|
} catch {
|
|
96082
96674
|
throw new CliUsageError(`No file to read at ${file4}.`);
|
|
96083
96675
|
}
|
|
@@ -96712,7 +97304,7 @@ async function agentFeedAccess({
|
|
|
96712
97304
|
}
|
|
96713
97305
|
|
|
96714
97306
|
// src/services/feed-commands.service.ts
|
|
96715
|
-
import { readFile as
|
|
97307
|
+
import { readFile as readFile28 } from "node:fs/promises";
|
|
96716
97308
|
import { resolve as resolve18 } from "node:path";
|
|
96717
97309
|
|
|
96718
97310
|
// ../../modules/feed/contract/src/feed.delegate.ts
|
|
@@ -97866,7 +98458,7 @@ async function feedTurnOf({
|
|
|
97866
98458
|
const read4 = async () => {
|
|
97867
98459
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
97868
98460
|
if (pinned) return pinned;
|
|
97869
|
-
if (env.LAZE_TURN_FILE) return (await
|
|
98461
|
+
if (env.LAZE_TURN_FILE) return (await readFile28(env.LAZE_TURN_FILE, "utf8")).trim();
|
|
97870
98462
|
return agent3 ? connectedTurnTokenOf({ client, channelId: channel }) : "";
|
|
97871
98463
|
};
|
|
97872
98464
|
const turn = await read4().catch(() => "");
|
|
@@ -97940,7 +98532,7 @@ async function bodyOf2({
|
|
|
97940
98532
|
flags: flags2
|
|
97941
98533
|
}) {
|
|
97942
98534
|
const body = { ...flags2.fields };
|
|
97943
|
-
const read4 = (source) => "file" in source ?
|
|
98535
|
+
const read4 = (source) => "file" in source ? readFile28(resolve18(context.cwd, source.file), "utf8") : source.text;
|
|
97944
98536
|
for (const [field, source] of Object.entries(flags2.texts)) body[field] = await read4(source);
|
|
97945
98537
|
if (flags2.rich) {
|
|
97946
98538
|
const text3 = await read4(flags2.rich.source);
|
|
@@ -98217,7 +98809,7 @@ async function textFlag({
|
|
|
98217
98809
|
}) {
|
|
98218
98810
|
const value = flagText({ args, name: name3 });
|
|
98219
98811
|
if (!value.startsWith("@")) return value;
|
|
98220
|
-
return
|
|
98812
|
+
return readFile28(resolve18(context.cwd, value.slice(1)), "utf8");
|
|
98221
98813
|
}
|
|
98222
98814
|
async function feedList({ context, args }) {
|
|
98223
98815
|
const { client, profile } = await signedIn({ context, args });
|
|
@@ -98307,7 +98899,7 @@ async function ranksOf({
|
|
|
98307
98899
|
}) {
|
|
98308
98900
|
const file4 = flagText({ args, name: "file" });
|
|
98309
98901
|
if (file4) {
|
|
98310
|
-
const parsed = JSON.parse(await
|
|
98902
|
+
const parsed = JSON.parse(await readFile28(resolve18(context.cwd, file4), "utf8"));
|
|
98311
98903
|
if (Array.isArray(parsed)) return parsed;
|
|
98312
98904
|
throw new CliUsageError("--file holds a list of {itemId, priority}");
|
|
98313
98905
|
}
|
|
@@ -98422,7 +99014,7 @@ async function feed({ context, args }) {
|
|
|
98422
99014
|
}
|
|
98423
99015
|
|
|
98424
99016
|
// src/services/github-commands.service.ts
|
|
98425
|
-
import { readFile as
|
|
99017
|
+
import { readFile as readFile29 } from "node:fs/promises";
|
|
98426
99018
|
|
|
98427
99019
|
// src/rules/github-signature.rules.ts
|
|
98428
99020
|
var TURN_SEPARATOR = "~";
|
|
@@ -98492,7 +99084,7 @@ var REAL_GH = "/usr/bin/gh";
|
|
|
98492
99084
|
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
99085
|
async function turnFileToken({ env }) {
|
|
98494
99086
|
if (!env.LAZE_TURN_FILE) return "";
|
|
98495
|
-
return
|
|
99087
|
+
return readFile29(env.LAZE_TURN_FILE, "utf8").then(
|
|
98496
99088
|
(text3) => text3.trim(),
|
|
98497
99089
|
() => ""
|
|
98498
99090
|
);
|
|
@@ -98526,7 +99118,7 @@ async function githubGh({
|
|
|
98526
99118
|
args: args.rest,
|
|
98527
99119
|
agentName: profile.name ?? "An agent",
|
|
98528
99120
|
threadUrl: threadUrlOf({ env, workspaceId: profile.workspaceId }),
|
|
98529
|
-
readBodyFile: (path) => path === "-" ? context.readStdin() :
|
|
99121
|
+
readBodyFile: (path) => path === "-" ? context.readStdin() : readFile29(path, "utf8")
|
|
98530
99122
|
});
|
|
98531
99123
|
return context.runCommand({
|
|
98532
99124
|
command: [REAL_GH, ...ghArgs],
|
|
@@ -98742,6 +99334,14 @@ async function groups({ context, args }) {
|
|
|
98742
99334
|
}
|
|
98743
99335
|
|
|
98744
99336
|
// src/rules/history-format.rules.ts
|
|
99337
|
+
var SOURCE_LABELS = {
|
|
99338
|
+
slack: "Slack",
|
|
99339
|
+
discord: "Discord",
|
|
99340
|
+
whatsapp: "WhatsApp"
|
|
99341
|
+
};
|
|
99342
|
+
function sourceOfKey(key) {
|
|
99343
|
+
return key ? SOURCE_LABELS[key.split(":")[0] ?? ""] ?? null : null;
|
|
99344
|
+
}
|
|
98745
99345
|
function timeOf2(iso3) {
|
|
98746
99346
|
return `${iso3.slice(0, 10)} ${iso3.slice(11, 16)} UTC`;
|
|
98747
99347
|
}
|
|
@@ -98749,8 +99349,9 @@ function linesOf3(output2) {
|
|
|
98749
99349
|
const live = (output2.live?.messages ?? []).map((message2) => ({
|
|
98750
99350
|
at: message2.createdAt,
|
|
98751
99351
|
author: message2.authorName,
|
|
98752
|
-
|
|
98753
|
-
|
|
99352
|
+
source: sourceOfKey(message2.key) ?? SOURCE_LABELS[output2.laze.mirror?.source ?? ""] ?? null,
|
|
99353
|
+
// A Slack key reads back as its time; other sources' keys do not, so their time is the cursor.
|
|
99354
|
+
cursor: message2.key.startsWith("slack:") ? message2.key : message2.createdAt,
|
|
98754
99355
|
threadRootId: null,
|
|
98755
99356
|
replyCount: message2.replyCount,
|
|
98756
99357
|
body: message2.body
|
|
@@ -98758,7 +99359,7 @@ function linesOf3(output2) {
|
|
|
98758
99359
|
const cached2 = output2.laze.messages.map((message2) => ({
|
|
98759
99360
|
at: message2.postedAt,
|
|
98760
99361
|
author: message2.author.name,
|
|
98761
|
-
|
|
99362
|
+
source: sourceOfKey(message2.originKey),
|
|
98762
99363
|
cursor: message2.messageId,
|
|
98763
99364
|
threadRootId: message2.threadRootId,
|
|
98764
99365
|
replyCount: message2.replyCount,
|
|
@@ -98768,7 +99369,7 @@ function linesOf3(output2) {
|
|
|
98768
99369
|
return [...live, ...cached2];
|
|
98769
99370
|
}
|
|
98770
99371
|
function blockOf2(line) {
|
|
98771
|
-
const badge = line.
|
|
99372
|
+
const badge = line.source ? ` [${line.source}]` : "";
|
|
98772
99373
|
const thread2 = line.threadRootId ? ` in thread ${line.threadRootId}` : "";
|
|
98773
99374
|
const link2 = line.link ? ` ${line.link}` : "";
|
|
98774
99375
|
const head = `${timeOf2(line.at)} ${line.author}${badge} ${line.cursor}${thread2}${link2}`;
|
|
@@ -98804,10 +99405,16 @@ ${blocks}${older}
|
|
|
98804
99405
|
// src/services/history-commands.service.ts
|
|
98805
99406
|
var HISTORY_USAGE = `Usage: laze history <channel> [--before <message-id>] [--limit <1-${CALLER_HISTORY_LIMIT_MAX}>] [--json]
|
|
98806
99407
|
|
|
98807
|
-
A conversation's messages before a message, oldest first: the cached ones, then, in a
|
|
98808
|
-
that mirrors Slack, older ones
|
|
98809
|
-
|
|
98810
|
-
|
|
99408
|
+
A conversation's messages before a message, oldest first: the cached ones, then, in a
|
|
99409
|
+
conversation that mirrors Slack, Discord or WhatsApp, older ones pulled back from the source
|
|
99410
|
+
(WhatsApp's from the owner's Laze computer, which wakes for it). --before also takes a Slack
|
|
99411
|
+
message key or an ISO time, as the "Older:" line prints it. An agent reads while it answers a
|
|
99412
|
+
message: outside a turn the call is refused.`;
|
|
99413
|
+
var LIVE_PATHS = {
|
|
99414
|
+
slack: SLACK_HISTORY_PATH,
|
|
99415
|
+
discord: DISCORD_KEY_PATHS.history,
|
|
99416
|
+
whatsapp: WHATSAPP_HISTORY_PATH
|
|
99417
|
+
};
|
|
98811
99418
|
var SLACK_KEY = /^slack:[^:]+:[^:]+:(\d+(?:\.\d+)?)$/;
|
|
98812
99419
|
function isoOf(epochMilliseconds) {
|
|
98813
99420
|
return Temporal3.Instant.fromEpochMilliseconds(epochMilliseconds).toString({
|
|
@@ -98849,9 +99456,10 @@ async function history2({
|
|
|
98849
99456
|
});
|
|
98850
99457
|
let live = null;
|
|
98851
99458
|
let refused = null;
|
|
99459
|
+
const livePath = LIVE_PATHS[laze.mirror?.source ?? "slack"] ?? SLACK_HISTORY_PATH;
|
|
98852
99460
|
if (laze.messages.length < limit && laze.liveBefore) {
|
|
98853
99461
|
try {
|
|
98854
|
-
const page = await client.post(
|
|
99462
|
+
const page = await client.post(livePath, {
|
|
98855
99463
|
channelId: laze.channelId,
|
|
98856
99464
|
before: laze.liveBefore
|
|
98857
99465
|
});
|
|
@@ -99174,7 +99782,7 @@ async function ip({ context, args }) {
|
|
|
99174
99782
|
}
|
|
99175
99783
|
|
|
99176
99784
|
// src/services/join-commands.service.ts
|
|
99177
|
-
import { rm as
|
|
99785
|
+
import { rm as rm17 } from "node:fs/promises";
|
|
99178
99786
|
import { hostname as hostname9 } from "node:os";
|
|
99179
99787
|
import { dirname as dirname22, join as join31 } from "node:path";
|
|
99180
99788
|
var DEFAULT_WAIT_SECONDS2 = 100;
|
|
@@ -99196,7 +99804,7 @@ async function keepPending({ context, pending: pending2 }) {
|
|
|
99196
99804
|
await writeStateJson({ path: pendingPathOf({ context }), value: pending2 });
|
|
99197
99805
|
}
|
|
99198
99806
|
async function dropPending({ context }) {
|
|
99199
|
-
await
|
|
99807
|
+
await rm17(pendingPathOf({ context }), { force: true });
|
|
99200
99808
|
}
|
|
99201
99809
|
function waitSecondsOf3({ args }) {
|
|
99202
99810
|
const raw = flagText({ args, name: "timeout" });
|
|
@@ -100455,18 +101063,18 @@ async function serveMcp({
|
|
|
100455
101063
|
}
|
|
100456
101064
|
|
|
100457
101065
|
// src/services/memory-commands.service.ts
|
|
100458
|
-
import { readdir as readdir7, readFile as
|
|
101066
|
+
import { readdir as readdir7, readFile as readFile31 } from "node:fs/promises";
|
|
100459
101067
|
import { join as join32, resolve as resolve20 } from "node:path";
|
|
100460
101068
|
|
|
100461
101069
|
// src/services/mount-files.service.ts
|
|
100462
|
-
import { mkdir as mkdir11, readFile as
|
|
100463
|
-
import { dirname as dirname23, relative as
|
|
101070
|
+
import { mkdir as mkdir11, readFile as readFile30, rm as rm18, writeFile as writeFile8 } from "node:fs/promises";
|
|
101071
|
+
import { dirname as dirname23, relative as relative4, resolve as resolve19 } from "node:path";
|
|
100464
101072
|
async function textArgument({
|
|
100465
101073
|
context,
|
|
100466
101074
|
value
|
|
100467
101075
|
}) {
|
|
100468
101076
|
if (value === "-") return context.readStdin();
|
|
100469
|
-
if (value.startsWith("@")) return
|
|
101077
|
+
if (value.startsWith("@")) return readFile30(resolve19(context.cwd, value.slice(1)), "utf8");
|
|
100470
101078
|
return value;
|
|
100471
101079
|
}
|
|
100472
101080
|
function turnChannel({ context, args }) {
|
|
@@ -100479,11 +101087,11 @@ async function writeMount({
|
|
|
100479
101087
|
files: files2
|
|
100480
101088
|
}) {
|
|
100481
101089
|
const root = resolve19(context.cwd, flagText({ args, name: "dir", fallback: ".laze" }), folder);
|
|
100482
|
-
await
|
|
101090
|
+
await rm18(root, { recursive: true, force: true });
|
|
100483
101091
|
await mkdir11(root, { recursive: true });
|
|
100484
101092
|
for (const file4 of files2) {
|
|
100485
101093
|
const target = resolve19(root, file4.path);
|
|
100486
|
-
const inside =
|
|
101094
|
+
const inside = relative4(root, target);
|
|
100487
101095
|
if (!inside || inside.startsWith(".."))
|
|
100488
101096
|
throw new Error(`Refusing to write outside ${root}: ${file4.path}`);
|
|
100489
101097
|
await mkdir11(dirname23(target), { recursive: true });
|
|
@@ -100613,7 +101221,7 @@ async function turnTokenOf5({ context }) {
|
|
|
100613
101221
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
100614
101222
|
if (pinned) return pinned;
|
|
100615
101223
|
if (!env.LAZE_TURN_FILE) return "";
|
|
100616
|
-
return
|
|
101224
|
+
return readFile31(env.LAZE_TURN_FILE, "utf8").then(
|
|
100617
101225
|
(text3) => text3.trim(),
|
|
100618
101226
|
() => ""
|
|
100619
101227
|
);
|
|
@@ -100743,7 +101351,7 @@ async function siestaImport({
|
|
|
100743
101351
|
dir
|
|
100744
101352
|
}) {
|
|
100745
101353
|
const root = resolve20(context.cwd, dir);
|
|
100746
|
-
const log = await
|
|
101354
|
+
const log = await readFile31(join32(root, "LOG.md"));
|
|
100747
101355
|
const names = (await readdir7(join32(root, "tree")).catch(() => [])).filter(
|
|
100748
101356
|
(name3) => /^\d{1,6}-\d{1,6}\.md$/.test(name3)
|
|
100749
101357
|
);
|
|
@@ -100751,7 +101359,7 @@ async function siestaImport({
|
|
|
100751
101359
|
await Promise.all(
|
|
100752
101360
|
names.map(async (name3) => [
|
|
100753
101361
|
name3.slice(0, -3),
|
|
100754
|
-
(await
|
|
101362
|
+
(await readFile31(join32(root, "tree", name3))).toString("base64")
|
|
100755
101363
|
])
|
|
100756
101364
|
)
|
|
100757
101365
|
);
|
|
@@ -100771,7 +101379,7 @@ async function memoryImport({ context, args }) {
|
|
|
100771
101379
|
const dir = flagText({ args, name: "optmem" });
|
|
100772
101380
|
if (!dir) throw new CliUsageError(USAGE14);
|
|
100773
101381
|
const root = resolve20(context.cwd, dir);
|
|
100774
|
-
const log = await
|
|
101382
|
+
const log = await readFile31(join32(root, "LOG.txt"));
|
|
100775
101383
|
const sizes2 = (await readdir7(join32(root, "TREE")).catch(() => [])).filter(
|
|
100776
101384
|
(name3) => /^\d{1,4}$/.test(name3)
|
|
100777
101385
|
);
|
|
@@ -100779,7 +101387,7 @@ async function memoryImport({ context, args }) {
|
|
|
100779
101387
|
await Promise.all(
|
|
100780
101388
|
sizes2.map(async (size) => [
|
|
100781
101389
|
size,
|
|
100782
|
-
(await
|
|
101390
|
+
(await readFile31(join32(root, "TREE", size))).toString("base64")
|
|
100783
101391
|
])
|
|
100784
101392
|
)
|
|
100785
101393
|
);
|
|
@@ -101376,7 +101984,7 @@ async function openclaw({
|
|
|
101376
101984
|
|
|
101377
101985
|
// src/services/operator-key-commands.service.ts
|
|
101378
101986
|
import { createHash as createHash10, randomBytes as randomBytes5 } from "node:crypto";
|
|
101379
|
-
import { mkdir as mkdir12, readFile as
|
|
101987
|
+
import { mkdir as mkdir12, readFile as readFile32, rm as rm19, writeFile as writeFile9 } from "node:fs/promises";
|
|
101380
101988
|
import { dirname as dirname24, join as join33 } from "node:path";
|
|
101381
101989
|
|
|
101382
101990
|
// ../../modules/audit-log/contract/src/audit-log.api.ts
|
|
@@ -102535,7 +103143,15 @@ var snapshotOutputDefinition = external_exports.object({
|
|
|
102535
103143
|
var eventsInputDefinition = external_exports.object({ from: external_exports.iso.datetime(), to: external_exports.iso.datetime() }).strict();
|
|
102536
103144
|
var eventCountsDefinition = external_exports.object({
|
|
102537
103145
|
total: count12,
|
|
102538
|
-
|
|
103146
|
+
/** Per type: how many, and the stored bytes of their payloads and sealed copies. */
|
|
103147
|
+
byType: external_exports.array(
|
|
103148
|
+
external_exports.object({
|
|
103149
|
+
eventType: external_exports.string(),
|
|
103150
|
+
count: count12,
|
|
103151
|
+
payloadBytes: external_exports.number().nonnegative(),
|
|
103152
|
+
encryptedCopyBytes: external_exports.number().nonnegative()
|
|
103153
|
+
})
|
|
103154
|
+
)
|
|
102539
103155
|
});
|
|
102540
103156
|
var tenantEventsInputDefinition = external_exports.object({
|
|
102541
103157
|
from: external_exports.iso.datetime(),
|
|
@@ -102591,11 +103207,35 @@ var databaseHealthDefinition = external_exports.object({
|
|
|
102591
103207
|
longestActiveSeconds: external_exports.number().nonnegative(),
|
|
102592
103208
|
longestIdleInTransactionSeconds: external_exports.number().nonnegative()
|
|
102593
103209
|
}),
|
|
103210
|
+
/** Every database this role may open, by size: they share the volume. */
|
|
103211
|
+
databases: external_exports.array(external_exports.object({ name: external_exports.string(), sizeBytes: external_exports.number().nonnegative() })),
|
|
103212
|
+
/** pg_wal's size (null when the role may not list it) and what each replication slot holds. */
|
|
103213
|
+
wal: external_exports.object({
|
|
103214
|
+
bytes: external_exports.number().nonnegative().nullable(),
|
|
103215
|
+
slots: external_exports.array(
|
|
103216
|
+
external_exports.object({ type: external_exports.string(), active: external_exports.boolean(), retainedBytes: external_exports.number().nonnegative() })
|
|
103217
|
+
)
|
|
103218
|
+
}),
|
|
103219
|
+
/** When the statistics counters started from zero; scans below count from then. */
|
|
103220
|
+
statsSince: external_exports.iso.datetime().nullable(),
|
|
103221
|
+
/** The largest indexes with their scans since statsSince; unique ones enforce a rule unread. */
|
|
103222
|
+
indexes: external_exports.array(
|
|
103223
|
+
external_exports.object({
|
|
103224
|
+
table: external_exports.string(),
|
|
103225
|
+
index: external_exports.string(),
|
|
103226
|
+
sizeBytes: external_exports.number().nonnegative(),
|
|
103227
|
+
scans: external_exports.number().nonnegative(),
|
|
103228
|
+
unique: external_exports.boolean()
|
|
103229
|
+
})
|
|
103230
|
+
),
|
|
102594
103231
|
/** The tables, largest first: sizes, row estimates and scans; never a row. */
|
|
102595
103232
|
tables: pageOf(
|
|
102596
103233
|
external_exports.object({
|
|
102597
103234
|
table: external_exports.string(),
|
|
102598
103235
|
totalBytes: external_exports.number().nonnegative(),
|
|
103236
|
+
heapBytes: external_exports.number().nonnegative(),
|
|
103237
|
+
toastBytes: external_exports.number().nonnegative(),
|
|
103238
|
+
indexBytes: external_exports.number().nonnegative(),
|
|
102599
103239
|
liveRows: external_exports.number().nonnegative(),
|
|
102600
103240
|
deadRows: external_exports.number().nonnegative(),
|
|
102601
103241
|
seqScans: external_exports.number().nonnegative(),
|
|
@@ -102817,6 +103457,32 @@ var contentBreakerOutputDefinition = external_exports.object({
|
|
|
102817
103457
|
upkeepCeilings: vaultContentBreakerSchema.shape.upkeepCeilings,
|
|
102818
103458
|
rows: pageOf(vaultContentBreakerSchema.shape.rows.element)
|
|
102819
103459
|
});
|
|
103460
|
+
var vaultAlertsInputDefinition = external_exports.object({
|
|
103461
|
+
from: external_exports.iso.datetime(),
|
|
103462
|
+
to: external_exports.iso.datetime(),
|
|
103463
|
+
kind: external_exports.string().trim().min(1).max(64).optional(),
|
|
103464
|
+
limit: external_exports.number().int().min(1).max(500).default(100),
|
|
103465
|
+
cursor: cursorDefinition.optional()
|
|
103466
|
+
}).strict();
|
|
103467
|
+
var vaultAlertRowDefinition = external_exports.object({
|
|
103468
|
+
at: external_exports.iso.datetime(),
|
|
103469
|
+
seq: external_exports.number().int().nullable(),
|
|
103470
|
+
kind: external_exports.string(),
|
|
103471
|
+
subjectWorkspaceId: external_exports.string().nullable(),
|
|
103472
|
+
scope: external_exports.string().nullable(),
|
|
103473
|
+
window: external_exports.string().nullable(),
|
|
103474
|
+
count: external_exports.number().nullable(),
|
|
103475
|
+
ceiling: external_exports.number().nullable(),
|
|
103476
|
+
wouldLock: external_exports.boolean(),
|
|
103477
|
+
topUse: external_exports.string().nullable(),
|
|
103478
|
+
/** Opens per vault use (`release`, `token_refresh`...) in the window that tripped. */
|
|
103479
|
+
uses: external_exports.record(external_exports.string(), external_exports.number()),
|
|
103480
|
+
/** The busiest code-path labels and their opens; never an id. */
|
|
103481
|
+
callers: external_exports.record(external_exports.string(), external_exports.number()),
|
|
103482
|
+
/** A gate or process alert's operation, such as `unwrap`. */
|
|
103483
|
+
op: external_exports.string().nullable()
|
|
103484
|
+
});
|
|
103485
|
+
var vaultAlertsOutputDefinition = external_exports.object({ alerts: pageOf(vaultAlertRowDefinition) });
|
|
102820
103486
|
var judgeMeasureInputDefinition = external_exports.object({
|
|
102821
103487
|
from: external_exports.iso.datetime(),
|
|
102822
103488
|
to: external_exports.iso.datetime(),
|
|
@@ -103072,6 +103738,13 @@ var OPS_FUNCTIONS = {
|
|
|
103072
103738
|
input: contentBreakerInputDefinition,
|
|
103073
103739
|
output: contentBreakerOutputDefinition
|
|
103074
103740
|
}),
|
|
103741
|
+
"vault.alerts": entry({
|
|
103742
|
+
title: "Vault alerts over a range: kind, when vaultd raised it, the workspace id, the breaker numbers, uses and busiest callers",
|
|
103743
|
+
scope: "platform",
|
|
103744
|
+
view: "table",
|
|
103745
|
+
input: vaultAlertsInputDefinition,
|
|
103746
|
+
output: vaultAlertsOutputDefinition
|
|
103747
|
+
}),
|
|
103075
103748
|
"vault.judge_measure": entry({
|
|
103076
103749
|
title: "The vault judge's verdicts against people's answers, with false allows and blocks",
|
|
103077
103750
|
scope: "platform",
|
|
@@ -103250,7 +103923,7 @@ async function forgetIfOver({
|
|
|
103250
103923
|
const key = await client.post(OPERATOR_KEY_REST_PATHS.status, { keyId });
|
|
103251
103924
|
const windowOver = key.endsAt !== null && Temporal3.Instant.from(key.endsAt).epochMilliseconds <= context.nowMs();
|
|
103252
103925
|
if (key.status !== "pending" && (key.status !== "approved" || windowOver || key.spentAt)) {
|
|
103253
|
-
await
|
|
103926
|
+
await rm19(keyFile({ context, keyId }), { force: true });
|
|
103254
103927
|
}
|
|
103255
103928
|
return key;
|
|
103256
103929
|
}
|
|
@@ -103263,7 +103936,7 @@ async function useKey({
|
|
|
103263
103936
|
if (!keyId) throw new CliUsageError(OPERATOR_KEY_USAGE);
|
|
103264
103937
|
const { client } = await signedIn({ context, args });
|
|
103265
103938
|
const path = keyFile({ context, keyId });
|
|
103266
|
-
const secret = await
|
|
103939
|
+
const secret = await readFile32(path, "utf8").catch(() => null);
|
|
103267
103940
|
if (secret === null) {
|
|
103268
103941
|
throw new CliUsageError(`No operator key ${keyId} is kept on this machine.`);
|
|
103269
103942
|
}
|
|
@@ -103462,7 +104135,7 @@ function watchingRelease({
|
|
|
103462
104135
|
}
|
|
103463
104136
|
|
|
103464
104137
|
// src/services/rush-guard.service.ts
|
|
103465
|
-
import { rm as
|
|
104138
|
+
import { rm as rm20 } from "node:fs/promises";
|
|
103466
104139
|
var WATCH_MS3 = 2e3;
|
|
103467
104140
|
async function guardRound(guard) {
|
|
103468
104141
|
const { context, client, name: name3, lock, claudePid, session, rush, launch } = guard;
|
|
@@ -103549,10 +104222,10 @@ async function rushWakeHook({ context, args }) {
|
|
|
103549
104222
|
return await guardRounds(guard);
|
|
103550
104223
|
} finally {
|
|
103551
104224
|
if ((await holderOf({ path: lock }))?.pid === context.processes.pid)
|
|
103552
|
-
await
|
|
104225
|
+
await rm20(lock, { force: true });
|
|
103553
104226
|
}
|
|
103554
104227
|
} finally {
|
|
103555
|
-
await
|
|
104228
|
+
await rm20(path, { force: true });
|
|
103556
104229
|
}
|
|
103557
104230
|
}
|
|
103558
104231
|
|
|
@@ -103721,8 +104394,8 @@ async function schedule({ context, args }) {
|
|
|
103721
104394
|
}
|
|
103722
104395
|
|
|
103723
104396
|
// src/services/skill-commands.service.ts
|
|
103724
|
-
import { readdir as readdir8, readFile as
|
|
103725
|
-
import { join as join35, relative as
|
|
104397
|
+
import { readdir as readdir8, readFile as readFile33 } from "node:fs/promises";
|
|
104398
|
+
import { join as join35, relative as relative5, resolve as resolve22 } from "node:path";
|
|
103726
104399
|
var USAGE18 = `Usage:
|
|
103727
104400
|
laze skill list [--agent <agentId>]
|
|
103728
104401
|
laze skill install <catalogue-id> [--as <name>] [--agent <agentId>]
|
|
@@ -103744,7 +104417,7 @@ async function folderFiles({ root }) {
|
|
|
103744
104417
|
for (const entry2 of entries) {
|
|
103745
104418
|
if (!entry2.isFile()) continue;
|
|
103746
104419
|
const full = join35(entry2.parentPath, entry2.name);
|
|
103747
|
-
files2.push({ path:
|
|
104420
|
+
files2.push({ path: relative5(root, full), content: await readFile33(full, "utf8") });
|
|
103748
104421
|
}
|
|
103749
104422
|
return files2.toSorted((a, b) => a.path.localeCompare(b.path));
|
|
103750
104423
|
}
|
|
@@ -103842,7 +104515,7 @@ async function skillUpdate({ context, args }) {
|
|
|
103842
104515
|
if (!name3 || !newName && description === void 0 && !skillMdFile) {
|
|
103843
104516
|
throw new CliUsageError(USAGE18);
|
|
103844
104517
|
}
|
|
103845
|
-
const skillMd = skillMdFile ? await
|
|
104518
|
+
const skillMd = skillMdFile ? await readFile33(resolve22(context.cwd, skillMdFile), "utf8") : void 0;
|
|
103846
104519
|
const { client } = await signedIn({ context, args });
|
|
103847
104520
|
const updated = await client.post("/api/skills/update", {
|
|
103848
104521
|
name: name3,
|
|
@@ -103888,7 +104561,7 @@ async function skill({ context, args }) {
|
|
|
103888
104561
|
}
|
|
103889
104562
|
|
|
103890
104563
|
// src/services/slack-commands.service.ts
|
|
103891
|
-
import { readFile as
|
|
104564
|
+
import { readFile as readFile34 } from "node:fs/promises";
|
|
103892
104565
|
import { resolve as resolve23 } from "node:path";
|
|
103893
104566
|
var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
|
|
103894
104567
|
laze slack overview connected Slack workspaces, mirrors, your link
|
|
@@ -103939,7 +104612,7 @@ async function secretLines({ context, args }) {
|
|
|
103939
104612
|
throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
|
|
103940
104613
|
}
|
|
103941
104614
|
const file4 = flagText({ args, name: "from-file" });
|
|
103942
|
-
const text3 = file4 ? await
|
|
104615
|
+
const text3 = file4 ? await readFile34(resolve23(context.cwd, file4), "utf8") : await context.readStdin();
|
|
103943
104616
|
return text3.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
103944
104617
|
}
|
|
103945
104618
|
async function secretsOf2({
|
|
@@ -104257,7 +104930,7 @@ async function slack({
|
|
|
104257
104930
|
}
|
|
104258
104931
|
|
|
104259
104932
|
// src/services/sso-commands.service.ts
|
|
104260
|
-
import { readFile as
|
|
104933
|
+
import { readFile as readFile35 } from "node:fs/promises";
|
|
104261
104934
|
var SSO_USAGE = `Usage:
|
|
104262
104935
|
laze sso domains claimed domains and how each signs in (admins)
|
|
104263
104936
|
laze sso claim <domain> the TXT record that proves the domain
|
|
@@ -104344,7 +105017,7 @@ function refuseSecretFlags({ args }) {
|
|
|
104344
105017
|
}
|
|
104345
105018
|
async function clientSecretOf({ context, args }) {
|
|
104346
105019
|
const file4 = flagText({ args, name: "from-file" });
|
|
104347
|
-
const text3 = file4 ? await
|
|
105020
|
+
const text3 = file4 ? await readFile35(file4, "utf8") : await context.readStdin();
|
|
104348
105021
|
const secret = text3.trim();
|
|
104349
105022
|
if (!secret) throw new CliUsageError("No client secret: pipe it on stdin or use --from-file.");
|
|
104350
105023
|
return secret;
|
|
@@ -104688,7 +105361,7 @@ async function checkInstalled({
|
|
|
104688
105361
|
}
|
|
104689
105362
|
|
|
104690
105363
|
// src/services/vault-env-commands.service.ts
|
|
104691
|
-
import { readFile as
|
|
105364
|
+
import { readFile as readFile36, stat as stat12 } from "node:fs/promises";
|
|
104692
105365
|
import { dirname as dirname26, join as join36, resolve as resolve24 } from "node:path";
|
|
104693
105366
|
|
|
104694
105367
|
// src/rules/vault-manifest.rules.ts
|
|
@@ -104776,211 +105449,6 @@ function credentialProcessJson(fields) {
|
|
|
104776
105449
|
});
|
|
104777
105450
|
}
|
|
104778
105451
|
|
|
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
105452
|
// src/services/vault-env-commands.service.ts
|
|
104985
105453
|
var ENV_USAGE = `Usage: laze vault env [<file>] [--env <name>] --reason "<one plain sentence>" [--wait <s>] -- <command> [args...]
|
|
104986
105454
|
laze vault env [<file>] [--env <name>] --names
|
|
@@ -105050,7 +105518,7 @@ async function manifestOf({
|
|
|
105050
105518
|
args
|
|
105051
105519
|
}) {
|
|
105052
105520
|
const file4 = await manifestPathOf({ context, args });
|
|
105053
|
-
const text3 = await
|
|
105521
|
+
const text3 = await readFile36(file4, "utf8").catch(() => {
|
|
105054
105522
|
throw new CliUsageError(`laze vault: cannot read ${file4}`);
|
|
105055
105523
|
});
|
|
105056
105524
|
return { file: file4, lines: parseManifest({ text: text3, file: file4 }) };
|
|
@@ -105412,7 +105880,7 @@ async function vaultScrub({ context, args }) {
|
|
|
105412
105880
|
}
|
|
105413
105881
|
|
|
105414
105882
|
// src/services/whatsapp-business-commands.service.ts
|
|
105415
|
-
import { readFile as
|
|
105883
|
+
import { readFile as readFile37 } from "node:fs/promises";
|
|
105416
105884
|
import { resolve as resolve25 } from "node:path";
|
|
105417
105885
|
|
|
105418
105886
|
// ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
|
|
@@ -105909,7 +106377,7 @@ async function secretsOf3({ context, args }) {
|
|
|
105909
106377
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
105910
106378
|
if (fromConnection) return { fromConnection };
|
|
105911
106379
|
const file4 = flagText({ args, name: "from-file" });
|
|
105912
|
-
const text3 = file4 ? await
|
|
106380
|
+
const text3 = file4 ? await readFile37(resolve25(context.cwd, file4), "utf8") : await context.readStdin();
|
|
105913
106381
|
const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
105914
106382
|
if (lines2.length !== 2) {
|
|
105915
106383
|
throw new CliUsageError(
|
|
@@ -107114,7 +107582,7 @@ import {
|
|
|
107114
107582
|
randomBytes as randomBytes6,
|
|
107115
107583
|
sign
|
|
107116
107584
|
} from "node:crypto";
|
|
107117
|
-
import { chmod, link, mkdir as mkdir13, readFile as
|
|
107585
|
+
import { chmod, link, mkdir as mkdir13, readFile as readFile38, rm as rm21, writeFile as writeFile11 } from "node:fs/promises";
|
|
107118
107586
|
import { dirname as dirname27, join as join37 } from "node:path";
|
|
107119
107587
|
var KEYCHAIN_SERVICE = "laze-cli-machine-key";
|
|
107120
107588
|
var runProgram = ({ program, args, stdin: stdin2, timeoutMs }) => new Promise((resolve27, reject) => {
|
|
@@ -107187,7 +107655,7 @@ var MachineKeyStore = class _MachineKeyStore {
|
|
|
107187
107655
|
async read() {
|
|
107188
107656
|
let meta3;
|
|
107189
107657
|
try {
|
|
107190
|
-
meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await
|
|
107658
|
+
meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await readFile38(this.metaPath, "utf8")));
|
|
107191
107659
|
} catch {
|
|
107192
107660
|
return null;
|
|
107193
107661
|
}
|
|
@@ -107202,7 +107670,7 @@ var MachineKeyStore = class _MachineKeyStore {
|
|
|
107202
107670
|
"-w"
|
|
107203
107671
|
],
|
|
107204
107672
|
timeoutMs: 1e4
|
|
107205
|
-
}) : await
|
|
107673
|
+
}) : await readFile38(this.pemPathOf(meta3.jwk), "utf8");
|
|
107206
107674
|
return keyOf2({ meta: meta3, privateKey: createPrivateKey(pemOf(pem)) });
|
|
107207
107675
|
}
|
|
107208
107676
|
async make() {
|
|
@@ -107344,7 +107812,7 @@ function machineProofFetch({
|
|
|
107344
107812
|
// src/services/processes.service.ts
|
|
107345
107813
|
import { execFile as execFile3, spawn as spawn4, spawnSync } from "node:child_process";
|
|
107346
107814
|
import { closeSync, mkdirSync, openSync, renameSync, statSync } from "node:fs";
|
|
107347
|
-
import { readFile as
|
|
107815
|
+
import { readFile as readFile39, readlink } from "node:fs/promises";
|
|
107348
107816
|
import { dirname as dirname28 } from "node:path";
|
|
107349
107817
|
import { promisify as promisify2 } from "node:util";
|
|
107350
107818
|
var run3 = promisify2(execFile3);
|
|
@@ -107358,14 +107826,14 @@ function alive(pid) {
|
|
|
107358
107826
|
}
|
|
107359
107827
|
}
|
|
107360
107828
|
async function argsOf2(pid) {
|
|
107361
|
-
const raw = await
|
|
107829
|
+
const raw = await readFile39(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
|
|
107362
107830
|
if (raw) return raw.split("\0").filter(Boolean);
|
|
107363
107831
|
const listed = await run3("ps", ["-o", "args=", "-p", String(pid)]).catch(() => void 0);
|
|
107364
107832
|
const line = listed?.stdout.trim();
|
|
107365
107833
|
return line ? line.split(/\s+/) : void 0;
|
|
107366
107834
|
}
|
|
107367
107835
|
async function parentOf(pid) {
|
|
107368
|
-
const stat13 = await
|
|
107836
|
+
const stat13 = await readFile39(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
|
|
107369
107837
|
const fromStat = stat13 ? Number(stat13.slice(stat13.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
|
|
107370
107838
|
if (fromStat > 0) return fromStat;
|
|
107371
107839
|
const listed = await run3("ps", ["-o", "ppid=", "-p", String(pid)]).catch(() => void 0);
|
|
@@ -107373,7 +107841,7 @@ async function parentOf(pid) {
|
|
|
107373
107841
|
return parent > 0 ? parent : void 0;
|
|
107374
107842
|
}
|
|
107375
107843
|
async function startOf(pid) {
|
|
107376
|
-
const stat13 = await
|
|
107844
|
+
const stat13 = await readFile39(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
|
|
107377
107845
|
const ticks = stat13 ? stat13.slice(stat13.lastIndexOf(")") + 2).split(" ")[19] : void 0;
|
|
107378
107846
|
if (ticks) return ticks;
|
|
107379
107847
|
const listed = await run3("ps", ["-o", "lstart=", "-p", String(pid)]).catch(() => void 0);
|