@lazehq/cli 0.1.131 → 0.1.133
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 +435 -369
- 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: readFile39, 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 readFile39(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.133";
|
|
36964
36964
|
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
36965
36965
|
return stamped.startsWith("__") ? "dev" : stamped;
|
|
36966
36966
|
}
|
|
@@ -37286,6 +37286,11 @@ var ConfigStore = class _ConfigStore {
|
|
|
37286
37286
|
static create({ path }) {
|
|
37287
37287
|
return new _ConfigStore(path);
|
|
37288
37288
|
}
|
|
37289
|
+
/** How a login names its profile to Laze: `name`, or `<file>:name` for another config file. */
|
|
37290
|
+
loginProfileOf({ name: name3 }) {
|
|
37291
|
+
const file4 = basename2(this.path);
|
|
37292
|
+
return (file4 === "config.json" ? name3 : `${file4}:${name3}`).slice(0, 80);
|
|
37293
|
+
}
|
|
37289
37294
|
async read() {
|
|
37290
37295
|
const text3 = await readFile3(this.path, "utf8").catch((error63) => {
|
|
37291
37296
|
if (error63.code === "ENOENT") return void 0;
|
|
@@ -37535,7 +37540,7 @@ function parseArgs({ argv }) {
|
|
|
37535
37540
|
const words = [];
|
|
37536
37541
|
const flags2 = {};
|
|
37537
37542
|
const lists = {};
|
|
37538
|
-
const
|
|
37543
|
+
const remember2 = (name3, value) => {
|
|
37539
37544
|
flags2[name3] = value;
|
|
37540
37545
|
lists[name3] = [...lists[name3] ?? [], value];
|
|
37541
37546
|
};
|
|
@@ -37548,10 +37553,10 @@ function parseArgs({ argv }) {
|
|
|
37548
37553
|
}
|
|
37549
37554
|
const [name3 = "", inline] = arg.slice(2).split(/=(.*)/s, 2);
|
|
37550
37555
|
const next = argv[index + 1];
|
|
37551
|
-
if (inline !== void 0)
|
|
37556
|
+
if (inline !== void 0) remember2(name3, inline);
|
|
37552
37557
|
else if (SWITCHES.has(name3) || next === void 0 || next.startsWith("--")) flags2[name3] = true;
|
|
37553
37558
|
else {
|
|
37554
|
-
|
|
37559
|
+
remember2(name3, next);
|
|
37555
37560
|
index += 1;
|
|
37556
37561
|
}
|
|
37557
37562
|
}
|
|
@@ -59793,7 +59798,9 @@ var startDeviceGrantInputSchemaDefinition = external_exports.object({
|
|
|
59793
59798
|
/** What the CLI calls itself on the approval page, such as "laze on build-box". */
|
|
59794
59799
|
clientName: external_exports.string().trim().min(1).max(80).default("laze CLI"),
|
|
59795
59800
|
/** The machine key the CLI made; the key it receives is bound to it. */
|
|
59796
|
-
machineKey: machineKeyRegistrationSchema.optional()
|
|
59801
|
+
machineKey: machineKeyRegistrationSchema.optional(),
|
|
59802
|
+
/** The CLI profile signing in; a later login of that profile on this machine replaces the key. */
|
|
59803
|
+
profile: external_exports.string().trim().min(1).max(80).optional()
|
|
59797
59804
|
});
|
|
59798
59805
|
var startedDeviceGrantSchemaDefinition = external_exports.object({
|
|
59799
59806
|
/** Eight characters the person sees and the approval page asks for. */
|
|
@@ -60209,12 +60216,11 @@ var vaultValueShapeSchemaDefinition = external_exports.object({
|
|
|
60209
60216
|
symbols: external_exports.string()
|
|
60210
60217
|
});
|
|
60211
60218
|
var vaultValueShapeSchema = vaultValueShapeSchemaDefinition;
|
|
60212
|
-
var
|
|
60213
|
-
connectionId: external_exports.string()
|
|
60214
|
-
|
|
60215
|
-
field: external_exports.string().min(1),
|
|
60216
|
-
shape: vaultValueShapeSchema
|
|
60219
|
+
var vaultBoundaryHandoutSchemaDefinition = external_exports.object({
|
|
60220
|
+
connectionId: external_exports.string(),
|
|
60221
|
+
shapes: external_exports.record(external_exports.string(), vaultValueShapeSchema).optional()
|
|
60217
60222
|
});
|
|
60223
|
+
var vaultBoundaryHandoutSchema = vaultBoundaryHandoutSchemaDefinition;
|
|
60218
60224
|
var vaultEgressHostSchemaDefinition = external_exports.object({
|
|
60219
60225
|
host: external_exports.string(),
|
|
60220
60226
|
addedBy: external_exports.enum(["judge", "person"]),
|
|
@@ -60998,7 +61004,9 @@ var vaultRunReleaseSchemaDefinition = external_exports.discriminatedUnion("outco
|
|
|
60998
61004
|
/** A sealed connection's values, encrypted to the run's own key. */
|
|
60999
61005
|
sealed: vaultRunSealedReleaseSchema.optional(),
|
|
61000
61006
|
/** What the approver told the agent, for the run to print. */
|
|
61001
|
-
message: external_exports.string().optional()
|
|
61007
|
+
message: external_exports.string().optional(),
|
|
61008
|
+
/** On a hosted computer: the values are placeholders the egress proxy swaps. */
|
|
61009
|
+
boundary: vaultBoundaryHandoutSchema.optional()
|
|
61002
61010
|
}),
|
|
61003
61011
|
external_exports.object({
|
|
61004
61012
|
outcome: external_exports.literal("ask"),
|
|
@@ -61039,7 +61047,9 @@ var vaultEgressReleaseInputSchemaDefinition = external_exports.object({
|
|
|
61039
61047
|
reason: external_exports.string(),
|
|
61040
61048
|
command: external_exports.array(external_exports.string()).default([]),
|
|
61041
61049
|
/** The run's P-256 public key, base64url; a sealed connection is released only to it. */
|
|
61042
|
-
recipient: external_exports.string().max(200).optional()
|
|
61050
|
+
recipient: external_exports.string().max(200).optional(),
|
|
61051
|
+
/** Set by a computer's egress proxy: a key it swaps comes back as shapes, not values. */
|
|
61052
|
+
placeholders: external_exports.boolean().default(false)
|
|
61043
61053
|
});
|
|
61044
61054
|
var vaultEgressReleaseInputSchema = vaultEgressReleaseInputSchemaDefinition;
|
|
61045
61055
|
var vaultEgressStatusInputSchemaDefinition = external_exports.object({
|
|
@@ -62445,7 +62455,7 @@ var vaultBatchReleaseInputSchemaDefinition = external_exports.object({
|
|
|
62445
62455
|
var vaultBatchReleaseInputSchema = vaultBatchReleaseInputSchemaDefinition;
|
|
62446
62456
|
var vaultEgressBatchReleaseInputSchemaDefinition = external_exports.object({
|
|
62447
62457
|
...vaultBatchReleaseInputSchemaDefinition.shape,
|
|
62448
|
-
/**
|
|
62458
|
+
/** Set by a computer's egress proxy: a key it swaps comes back as `boundary`, not values. */
|
|
62449
62459
|
placeholders: external_exports.boolean().default(false)
|
|
62450
62460
|
});
|
|
62451
62461
|
var vaultBatchConnectionSchemaDefinition = external_exports.object({
|
|
@@ -62460,8 +62470,8 @@ var vaultBatchEntrySchemaDefinition = external_exports.object({
|
|
|
62460
62470
|
ref: external_exports.string(),
|
|
62461
62471
|
connection: vaultBatchConnectionSchema.nullable(),
|
|
62462
62472
|
release: vaultRunReleaseSchema.nullable(),
|
|
62463
|
-
/**
|
|
62464
|
-
boundary:
|
|
62473
|
+
/** A key swapped at the egress boundary: its shapes, which the proxy makes placeholders of. */
|
|
62474
|
+
boundary: vaultBoundaryHandoutSchema.optional()
|
|
62465
62475
|
});
|
|
62466
62476
|
var vaultBatchEntrySchema = vaultBatchEntrySchemaDefinition;
|
|
62467
62477
|
var vaultBatchReleaseSchemaDefinition = external_exports.object({
|
|
@@ -62497,7 +62507,7 @@ var vaultSessionSchemaDefinition = external_exports.object({
|
|
|
62497
62507
|
});
|
|
62498
62508
|
var vaultSessionSchema = vaultSessionSchemaDefinition;
|
|
62499
62509
|
var vaultSessionReleaseInputSchemaDefinition = external_exports.object({
|
|
62500
|
-
...vaultEgressReleaseInputSchema.omit({ agentId: true }).shape,
|
|
62510
|
+
...vaultEgressReleaseInputSchema.omit({ agentId: true, placeholders: true }).shape,
|
|
62501
62511
|
session: vaultSessionSchema
|
|
62502
62512
|
});
|
|
62503
62513
|
var vaultSessionStatusInputSchemaDefinition = external_exports.object({
|
|
@@ -63967,6 +63977,7 @@ var reachableConversationSchemaDefinition = external_exports.object({
|
|
|
63967
63977
|
readable: external_exports.boolean()
|
|
63968
63978
|
});
|
|
63969
63979
|
var replySideSchema = external_exports.enum(["laze", "slack"]);
|
|
63980
|
+
var sendViaSchema = external_exports.enum(["laze", "slack", "both"]);
|
|
63970
63981
|
var conversationSummarySchemaDefinition = external_exports.object({
|
|
63971
63982
|
...conversationSchemaDefinition.shape,
|
|
63972
63983
|
lastReadSeq: external_exports.number().int().nonnegative(),
|
|
@@ -64327,6 +64338,11 @@ var postMessageInputSchemaDefinition = external_exports.object({
|
|
|
64327
64338
|
notifyAnyway: external_exports.boolean().optional(),
|
|
64328
64339
|
/** In a Laze DM: also post it to this paired Slack DM, as the sender; one Laze message. */
|
|
64329
64340
|
alsoSendTo: idSchema4.optional(),
|
|
64341
|
+
/**
|
|
64342
|
+
* In a Laze DM paired with the sender's Slack DM: where this post goes. Absent, a person's
|
|
64343
|
+
* top-level post follows the side they picked in that DM, both when they picked none.
|
|
64344
|
+
*/
|
|
64345
|
+
via: sendViaSchema.optional(),
|
|
64330
64346
|
attachmentIds: external_exports.array(idSchema4).max(10).default([]),
|
|
64331
64347
|
/** The feed cards an agent's reply links; chat keeps them only when an agent posts. */
|
|
64332
64348
|
feedRefs: external_exports.array(messageFeedRefSchemaDefinition).max(MESSAGE_FEED_REFS_MAX).optional(),
|
|
@@ -65229,7 +65245,7 @@ var chatConversationsTrpc = defineTrpcContract("chat").query("overview", { mirro
|
|
|
65229
65245
|
var chatChannelRolesTrpc = defineTrpcContract("chat").mutation("setChannelRole").withInput(setChannelRoleInputSchema).withOutput(conversationSchema).mutation("extendChannel").withInput(extendChannelInputSchema).withOutput(conversationSchema).build();
|
|
65230
65246
|
var chatMessagesTrpc = defineTrpcContract("chat").query("history", { mirrored: historyMirror }).withInput(historyInputSchema).withOutput(historyPageSchema).query("thread").withInput(messageInputSchema).withOutput(threadSchema).query("message").withInput(messageInputSchema).withOutput(messageSchema).mutation("post").withInput(postMessageInputSchema).withOutput(messageSchema).mutation("forward").withInput(forwardMessageInputSchema).withOutput(messageSchema).mutation("addMentioned").withInput(addMentionedInputSchema).withOutput(messageSchema).mutation("edit").withInput(editMessageInputSchema).withOutput(messageSchema).mutation("delete").withInput(messageInputSchema).withOutput(messageSchema).mutation("remove").withInput(messageInputSchema).withOutput(messageSchema).mutation("react").withInput(reactInputSchema).withOutput(messageSchema).mutation("signalTyping").withInput(signalTypingInputSchema).withOutput(external_exports.object({ sent: external_exports.literal(true) })).mutation("markRead").withInput(markReadInputSchema).withOutput(external_exports.object({ lastReadSeq: external_exports.number().int().nonnegative() })).mutation("markUnread").withInput(markUnreadInputSchema).withOutput(external_exports.object({ lastReadSeq: external_exports.number().int().nonnegative() })).query("search").withInput(searchInputSchema).withOutput(searchResultSchema).build();
|
|
65231
65247
|
var chatFilesTrpc = defineTrpcContract("chat").mutation("startUpload").withInput(startUploadInputSchema).withOutput(uploadTicketSchema).mutation("completeUpload").withInput(completeUploadInputSchema).withOutput(attachmentSchema).mutation("transcribeVoiceSegment").withInput(transcribeVoiceSegmentInputSchema).withOutput(voiceSegmentTextSchema).mutation("abortUpload").withInput(fileInputSchema).withOutput(external_exports.object({ aborted: external_exports.literal(true) })).query("fileLink").withInput(fileLinkInputSchema).withOutput(fileLinkSchema).query("channelFiles").withInput(channelFilesInputSchema).withOutput(channelFilesSchema).mutation("renameAttachment").withInput(renameAttachmentInputSchema).withOutput(attachmentSchema).mutation("hideUnfurl").withInput(hideUnfurlInputSchema).withOutput(messageSchema).query("unfurlImage").withInput(unfurlImageInputSchema).withOutput(fileLinkSchema).query("searchGifs").withInput(searchGifsInputSchema).withOutput(gifResultsSchema).build();
|
|
65232
|
-
var chatFollowingTrpc = defineTrpcContract("chat").mutation("setNotify").withInput(setNotifyInputSchema).withOutput(conversationSummarySchema).mutation("setReplySide").withInput(setReplySideInputSchema).withOutput(conversationSummarySchema).mutation("hideConversation").withInput(channelInputSchema).withOutput(external_exports.object({ hidden: external_exports.literal(true) })).mutation("followThread").withInput(followThreadInputSchema).withOutput(threadFollowSchema).query("threadFollow").withInput(messageInputSchema).withOutput(threadFollowSchema).query("threads", { mirrored: threadsMirror }).withInput(threadsInputSchema).withOutput(threadsPageSchema).query("threadsUnread").withInput(workspaceInputSchema).withOutput(threadsUnreadSchema).query("notificationCount").withInput(workspaceInputSchema).withOutput(external_exports.object({ count: external_exports.number().int().nonnegative() })).mutation("markThreadRead").withInput(messageInputSchema).withOutput(external_exports.object({ read: external_exports.literal(true) })).mutation("pin").withInput(pinMessageInputSchema).withOutput(messageSchema).mutation("retryMirrorDelivery").withInput(messageInputSchema).withOutput(external_exports.object({ retried: external_exports.boolean() })).query("pins").withInput(channelInputSchema).withOutput(pinsPageSchema).query("saved").withInput(savedInputSchema).withOutput(savedPageSchema).query("savedMarks").withInput(workspaceInputSchema).withOutput(savedMarksSchema).mutation("saveMessage").withInput(saveMessageInputSchema).withOutput(savedStatusSchema).mutation("markSavedDone").withInput(markSavedDoneInputSchema).withOutput(savedStatusSchema).mutation("setReminder").withInput(setReminderInputSchema).withOutput(savedStatusSchema).query("activity").withInput(activityInputSchema).withOutput(activityPageSchema).mutation("markActivityRead").withInput(markActivityReadInputSchema).withOutput(external_exports.object({ read: external_exports.literal(true) })).build();
|
|
65248
|
+
var chatFollowingTrpc = defineTrpcContract("chat").mutation("setNotify").withInput(setNotifyInputSchema).withOutput(conversationSummarySchema).mutation("setReplySide").withInput(setReplySideInputSchema).withOutput(conversationSummarySchema).mutation("hideConversation").withInput(channelInputSchema).withOutput(external_exports.object({ hidden: external_exports.literal(true) })).mutation("followThread").withInput(followThreadInputSchema).withOutput(threadFollowSchema).query("threadFollow").withInput(messageInputSchema).withOutput(threadFollowSchema).query("threads", { mirrored: threadsMirror }).withInput(threadsInputSchema).withOutput(threadsPageSchema).query("threadsUnread").withInput(workspaceInputSchema).withOutput(threadsUnreadSchema).query("notificationCount").withInput(workspaceInputSchema).withOutput(external_exports.object({ count: external_exports.number().int().nonnegative() })).mutation("markThreadRead").withInput(messageInputSchema).withOutput(external_exports.object({ read: external_exports.literal(true) })).mutation("pin").withInput(pinMessageInputSchema).withOutput(messageSchema).mutation("retryMirrorDelivery").withInput(messageInputSchema).withOutput(external_exports.object({ retried: external_exports.boolean() })).mutation("alsoSendToSlack").withInput(messageInputSchema).withOutput(messageSchema).query("pins").withInput(channelInputSchema).withOutput(pinsPageSchema).query("saved").withInput(savedInputSchema).withOutput(savedPageSchema).query("savedMarks").withInput(workspaceInputSchema).withOutput(savedMarksSchema).mutation("saveMessage").withInput(saveMessageInputSchema).withOutput(savedStatusSchema).mutation("markSavedDone").withInput(markSavedDoneInputSchema).withOutput(savedStatusSchema).mutation("setReminder").withInput(setReminderInputSchema).withOutput(savedStatusSchema).query("activity").withInput(activityInputSchema).withOutput(activityPageSchema).mutation("markActivityRead").withInput(markActivityReadInputSchema).withOutput(external_exports.object({ read: external_exports.literal(true) })).build();
|
|
65233
65249
|
var chatSessionTrpc = defineTrpcContract("chat").mutation("realtimeToken").withInput(workspaceInputSchema).withOutput(realtimeTokenSchema).query("drafts").withInput(workspaceInputSchema).withOutput(draftListSchema).mutation("saveDraft").withInput(saveDraftInputSchema).withOutput(draftSavedSchema).mutation("deleteDraft").withInput(deleteDraftInputSchema).withOutput(draftSavedSchema).query("sent").withInput(listSentInputSchema).withOutput(sentPageSchema).query("sidebarLayout").withInput(workspaceInputSchema).withOutput(sidebarLayoutSchema).mutation("editSidebar").withInput(editSidebarInputSchema).withOutput(sidebarLayoutSchema).query("readerPreferences").withInput(workspaceInputSchema).withOutput(readerPreferencesSchema).mutation("setReaderPreferences").withInput(setReaderPreferencesInputSchema).withOutput(readerPreferencesSchema).mutation("star").withInput(starInputSchema).withOutput(starStatusSchema).query("starred").withInput(workspaceInputSchema).withOutput(starredListSchema).mutation("scrubSecrets").withInput(scrubChatInputSchema).withOutput(chatScrubReportSchema).mutation("restoreScrubbed").withInput(messageInputSchema).withOutput(messageSchema).build();
|
|
65234
65250
|
var chatScheduledTrpc = defineTrpcContract("chat").mutation("scheduleMessage").withInput(scheduleMessageInputSchema).withOutput(scheduledMessageSchema).query("scheduled").withInput(listScheduledInputSchema).withOutput(scheduledListSchema).mutation("editScheduled").withInput(editScheduledInputSchema).withOutput(scheduledMessageSchema).mutation("sendScheduledNow").withInput(scheduledInputSchema).withOutput(scheduledMessageSchema).mutation("cancelScheduled").withInput(scheduledInputSchema).withOutput(scheduledMessageSchema).build();
|
|
65235
65251
|
var chatPresenceTrpc = defineTrpcContract("chat").mutation("heartbeat").withInput(workspaceInputSchema).withOutput(heartbeatSchema).query("presence").withInput(workspaceInputSchema).withOutput(presenceListSchema).mutation("setStatus").withInput(setStatusInputSchema).withOutput(personPresenceSchema).mutation("clearStatus").withInput(workspaceInputSchema).withOutput(personPresenceSchema).mutation("setAway").withInput(setAwayInputSchema).withOutput(personPresenceSchema).build();
|
|
@@ -67532,17 +67548,6 @@ var egressConnectionSchemaDefinition = external_exports.object({
|
|
|
67532
67548
|
message: "A connection holds a secret or is the vault's, never both"
|
|
67533
67549
|
});
|
|
67534
67550
|
var egressConnectionSchema = egressConnectionSchemaDefinition;
|
|
67535
|
-
var boundaryKeySchemaDefinition = external_exports.object({
|
|
67536
|
-
connectionId: external_exports.string().min(1),
|
|
67537
|
-
name: external_exports.string().min(1),
|
|
67538
|
-
field: external_exports.string().min(1),
|
|
67539
|
-
shape: external_exports.object({
|
|
67540
|
-
kept: external_exports.string().max(8),
|
|
67541
|
-
classes: external_exports.string().regex(/^[luds]*$/),
|
|
67542
|
-
symbols: external_exports.string()
|
|
67543
|
-
})
|
|
67544
|
-
});
|
|
67545
|
-
var BOUNDARY_KEYS_MAX = 1e3;
|
|
67546
67551
|
var claudeGatewayModelsSchemaDefinition = external_exports.object({
|
|
67547
67552
|
opus: external_exports.string().min(1),
|
|
67548
67553
|
sonnet: external_exports.string().min(1),
|
|
@@ -67578,8 +67583,6 @@ var agentSandboxSpecSchemaDefinition = external_exports.object({
|
|
|
67578
67583
|
/** The harness model's context window, when Laze knows it: compaction is set against it. */
|
|
67579
67584
|
contextWindow: external_exports.number().int().positive().optional(),
|
|
67580
67585
|
connections: external_exports.array(egressConnectionSchema).default([]),
|
|
67581
|
-
/** Vault keys swapped at the egress boundary; only for an agent in a Laze computer. */
|
|
67582
|
-
boundaryKeys: external_exports.array(boundaryKeySchemaDefinition).max(BOUNDARY_KEYS_MAX).optional(),
|
|
67583
67586
|
/** Harness credentials that must live inside the sandbox (a user's own subscription token). */
|
|
67584
67587
|
harnessEnvironment: external_exports.record(external_exports.string(), external_exports.string()).default({}),
|
|
67585
67588
|
/** Files the supervisor writes under the home folder at every start, by relative path. */
|
|
@@ -68722,9 +68725,11 @@ function launchEffortOf({ agent: agent3 }) {
|
|
|
68722
68725
|
const effort = agent3.effort ?? (!running || running.efforts.includes(AGENT_DEFAULT_EFFORT) ? AGENT_DEFAULT_EFFORT : running.defaultEffort);
|
|
68723
68726
|
return effort ? { kind: "set", effort } : { kind: "none" };
|
|
68724
68727
|
}
|
|
68725
|
-
function
|
|
68728
|
+
function describeEffortLine({ agent: agent3 }) {
|
|
68726
68729
|
const launched = launchEffortOf({ agent: agent3 });
|
|
68727
|
-
|
|
68730
|
+
if (launched.kind !== "set") return null;
|
|
68731
|
+
const label3 = effortLabelOf({ effort: launched.effort });
|
|
68732
|
+
return agent3.effort ? label3 : `Default (${label3})`;
|
|
68728
68733
|
}
|
|
68729
68734
|
function claudeWindowOf({ model }) {
|
|
68730
68735
|
const name3 = model ? `${model.name} ${model.description} ${model.id}` : "";
|
|
@@ -68746,7 +68751,7 @@ function contextLineOf({ agent: agent3 }) {
|
|
|
68746
68751
|
function agentRunSummaryOf({ agent: agent3 }) {
|
|
68747
68752
|
return {
|
|
68748
68753
|
model: modelLineOf({ agent: agent3 }),
|
|
68749
|
-
effort:
|
|
68754
|
+
effort: describeEffortLine({ agent: agent3 }),
|
|
68750
68755
|
context: contextLineOf({ agent: agent3 })
|
|
68751
68756
|
};
|
|
68752
68757
|
}
|
|
@@ -71976,7 +71981,12 @@ var postAsCallerInputSchemaDefinition = external_exports.object({
|
|
|
71976
71981
|
/** Files the caller uploaded to this conversation, carried as the composer's attachments are. */
|
|
71977
71982
|
attachmentIds: external_exports.array(idSchema19).max(10).optional(),
|
|
71978
71983
|
/** The messages of the agent's turn this post answers. */
|
|
71979
|
-
answers: external_exports.array(idSchema19).max(200).optional()
|
|
71984
|
+
answers: external_exports.array(idSchema19).max(200).optional(),
|
|
71985
|
+
/**
|
|
71986
|
+
* In a Laze DM paired with the person's Slack DM: Laze, Slack or both for this one post. Absent
|
|
71987
|
+
* follows the side the person picked in that DM, as the composer does.
|
|
71988
|
+
*/
|
|
71989
|
+
via: sendViaSchema.optional()
|
|
71980
71990
|
});
|
|
71981
71991
|
var replyAsCallerInputSchemaDefinition = external_exports.object({
|
|
71982
71992
|
messageId: idSchema19,
|
|
@@ -71990,7 +72000,12 @@ var replyAsCallerInputSchemaDefinition = external_exports.object({
|
|
|
71990
72000
|
/** Files the caller uploaded to the reply's conversation, carried as the composer's are. */
|
|
71991
72001
|
attachmentIds: external_exports.array(idSchema19).max(10).optional(),
|
|
71992
72002
|
/** The other messages of the agent's turn this reply answers. */
|
|
71993
|
-
answers: external_exports.array(idSchema19).max(200).optional()
|
|
72003
|
+
answers: external_exports.array(idSchema19).max(200).optional(),
|
|
72004
|
+
/**
|
|
72005
|
+
* In a Laze DM paired with the person's Slack DM: Laze, Slack or both for this one post. Absent
|
|
72006
|
+
* follows the side the person picked in that DM, as the composer does.
|
|
72007
|
+
*/
|
|
72008
|
+
via: sendViaSchema.optional()
|
|
71994
72009
|
});
|
|
71995
72010
|
var postedMessageSchemaDefinition = external_exports.object({
|
|
71996
72011
|
messageId: idSchema19,
|
|
@@ -72097,7 +72112,11 @@ var agentTurnTokenSchemaDefinition = external_exports.object({
|
|
|
72097
72112
|
turnToken: external_exports.string(),
|
|
72098
72113
|
expiresAt: external_exports.iso.datetime()
|
|
72099
72114
|
});
|
|
72100
|
-
var {
|
|
72115
|
+
var {
|
|
72116
|
+
agentId: _agentId,
|
|
72117
|
+
placeholders: _placeholders,
|
|
72118
|
+
...releaseShape
|
|
72119
|
+
} = vaultEgressReleaseInputSchema.shape;
|
|
72101
72120
|
var agentVaultReleaseInputSchemaDefinition = external_exports.object({
|
|
72102
72121
|
...releaseShape,
|
|
72103
72122
|
channelId: external_exports.string().min(1).max(80).nullable().default(null)
|
|
@@ -72155,7 +72174,9 @@ var agentTurnTrpc = defineTrpcContract("agents").mutation("answerAttention").wit
|
|
|
72155
72174
|
var agentChannelSettingsTrpc = defineTrpcContract("agents").query("monitors").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema19 })).withOutput(external_exports.array(agentMonitorSchema)).query("channelLevel").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema19, channelId: idSchema19 })).withOutput(channelLevelSchema).mutation("setChannelLevel").withInput(setChannelLevelInputSchema).withOutput(channelLevelSchema).mutation("unmuteChannel").withInput(unmuteAgentChannelInputSchema).withOutput(channelLevelSchema).mutation("cancelHeld").withInput(cancelHeldInputSchema).withOutput(cancelHeldResultSchema).mutation("useLazeModelsUntilReset").withInput(useLazeModelsUntilResetInputSchema).withOutput(lazeModelsUntilResetSchema).query("agentLoginChoices").withInput(agentLoginChoicesInputSchema).withOutput(agentLoginChoicesSchema).mutation("switchAgentLogin").withInput(switchAgentLoginInputSchema).withOutput(switchedAgentLoginSchema).build();
|
|
72156
72175
|
var agentJoinTrpc = defineTrpcContract("agents").query("joinRequest").withInput(joinRequestInputSchema).withOutput(joinRequestViewSchema).mutation("approveJoinRequest").withInput(approveJoinRequestInputSchema).withOutput(joinRequestViewSchema).mutation("denyJoinRequest").withInput(joinRequestInputSchema).withOutput(joinRequestViewSchema).build();
|
|
72157
72176
|
var agentLoginTroubleTrpc = defineTrpcContract("agents").mutation("replaceHarnessLogin").withInput(replaceHarnessLoginInputSchema).withOutput(harnessLoginListSchema).mutation("startHarnessSignIn").withInput(startHarnessSignInInputSchema).withOutput(harnessSignInSchema).mutation("pollHarnessSignIn").withInput(pollHarnessSignInInputSchema).withOutput(harnessSignInPollSchema).mutation("waitForLogins").withInput(loginCardActionInputSchema).withOutput(external_exports.object({ waiting: external_exports.boolean() })).mutation("useAnotherLogin").withInput(loginCardActionInputSchema).withOutput(external_exports.object({ loginName: external_exports.string() })).build();
|
|
72158
|
-
var
|
|
72177
|
+
var talkableAgentsSchemaDefinition = external_exports.object({ agentIds: external_exports.array(idSchema19) });
|
|
72178
|
+
var talkableAgentsSchema = talkableAgentsSchemaDefinition;
|
|
72179
|
+
var agentWorkspaceDefaultTrpc = defineTrpcContract("agents").query("talkable").withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).withOutput(talkableAgentsSchema).query("workspaceDefault").withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).withOutput(workspaceDefaultAgentSchema).mutation("setWorkspaceDefault").withInput(setWorkspaceDefaultAgentInputSchema).withOutput(workspaceDefaultAgentSchema).build();
|
|
72159
72180
|
var agentRuntimeChoiceTrpc = defineTrpcContract("agents").query("setup").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema19 })).withOutput(agentSetupReadingSchema).mutation("retrySetup").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema19 })).withOutput(agentSchema).query("lastRuntime").withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).withOutput(lastRuntimeSchema).build();
|
|
72160
72181
|
var agentArchiveTrpc = defineTrpcContract("agents").query("archived").withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).withOutput(external_exports.array(archivedAgentSchema)).mutation("restore").withInput(restoreAgentInputSchema).withOutput(agentSchema).mutation("copy").withInput(copyAgentInputSchema).withOutput(agentSchema).mutation("deleteArchived").withInput(restoreAgentInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).query("transferOffers").withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).withOutput(external_exports.array(agentTransferOfferSchema)).mutation("acceptTransfer").withInput(agentTransferInputSchema).withOutput(agentSchema).mutation("declineTransfer").withInput(agentTransferInputSchema).withOutput(external_exports.object({ declined: external_exports.literal(true) })).mutation("cancelTransfer").withInput(agentTransferInputSchema).withOutput(external_exports.object({ cancelled: external_exports.literal(true) })).build();
|
|
72161
72182
|
var agentLangwatchTrpc = defineTrpcContract("agents").query("langwatchTracing").withInput(agentLangwatchInputSchema).withOutput(agentLangwatchTracingSchema).mutation("setLangwatchTracing").withInput(setAgentLangwatchInputSchema).withOutput(agentLangwatchTracingSchema).query("langwatchAgents").withInput(agentLangwatchListInputSchema).withOutput(agentLangwatchRowsSchema).build();
|
|
@@ -76667,8 +76688,19 @@ function turnAnswersOf({ context }) {
|
|
|
76667
76688
|
return answers.length > 0 ? { answers } : {};
|
|
76668
76689
|
}
|
|
76669
76690
|
var FILES_USAGE = "[--image <path|url|fileId>]... [--file <path|url|fileId>]... (at most 6)";
|
|
76670
|
-
var
|
|
76671
|
-
var
|
|
76691
|
+
var VIA_USAGE = "[--via laze|slack|both]";
|
|
76692
|
+
var POST_USAGE = `Usage: laze post <channel> <text|-> [--thread <id>] ${VIA_USAGE} ${FILES_USAGE} [--at <time> [--tz <zone>]] [--json]`;
|
|
76693
|
+
var REPLY_USAGE = `Usage: laze reply <message-id> <text|-> [--new-thread] [--also-channel] ${VIA_USAGE} ${FILES_USAGE} [--at <time> [--tz <zone>]]`;
|
|
76694
|
+
var VIAS = ["laze", "slack", "both"];
|
|
76695
|
+
function viaOf({ args, usage: usage2 }) {
|
|
76696
|
+
const via = flagText({ args, name: "via" });
|
|
76697
|
+
if (!via) return {};
|
|
76698
|
+
if (!VIAS.includes(via)) {
|
|
76699
|
+
throw new CliUsageError(`--via takes laze, slack or both.
|
|
76700
|
+
${usage2}`);
|
|
76701
|
+
}
|
|
76702
|
+
return { via };
|
|
76703
|
+
}
|
|
76672
76704
|
function keyedPost({
|
|
76673
76705
|
client,
|
|
76674
76706
|
path,
|
|
@@ -76711,6 +76743,7 @@ async function post({
|
|
|
76711
76743
|
const leaves = leavesLazeOf({ client, channel });
|
|
76712
76744
|
const body = await textToSend({ context, args, profile, client, text: typed, leaves });
|
|
76713
76745
|
const thread2 = flagText({ args, name: "thread" });
|
|
76746
|
+
const via = viaOf({ args, usage: POST_USAGE });
|
|
76714
76747
|
const files2 = await filesOf({ context, args, client, at: at8, channel: async () => channel });
|
|
76715
76748
|
if (at8) {
|
|
76716
76749
|
const target = { channel, ...thread2 ? { threadRootId: thread2 } : {} };
|
|
@@ -76723,6 +76756,7 @@ async function post({
|
|
|
76723
76756
|
channel,
|
|
76724
76757
|
body,
|
|
76725
76758
|
...thread2 ? { threadRootId: thread2 } : {},
|
|
76759
|
+
...via,
|
|
76726
76760
|
...files2,
|
|
76727
76761
|
...turnAnswersOf({ context })
|
|
76728
76762
|
}
|
|
@@ -76748,6 +76782,7 @@ async function reply({
|
|
|
76748
76782
|
const at8 = scheduleAtOf({ args, usage: REPLY_USAGE });
|
|
76749
76783
|
const { client, profile, name: name3 } = await signedIn({ context, args });
|
|
76750
76784
|
const channel = flagText({ args, name: "channel" });
|
|
76785
|
+
const via = viaOf({ args, usage: REPLY_USAGE });
|
|
76751
76786
|
const typed = await textOf({ context, args, from: 2 });
|
|
76752
76787
|
const leaves = leavesLazeOf({ client, channel });
|
|
76753
76788
|
const body = await textToSend({ context, args, profile, client, text: typed, leaves });
|
|
@@ -76770,6 +76805,7 @@ async function reply({
|
|
|
76770
76805
|
...channel ? { channel } : {},
|
|
76771
76806
|
...args.flags["new-thread"] === true ? { thread: true } : {},
|
|
76772
76807
|
...args.flags["also-channel"] === true ? { alsoInChannel: true } : {},
|
|
76808
|
+
...via,
|
|
76773
76809
|
...files2,
|
|
76774
76810
|
...turnAnswersOf({ context })
|
|
76775
76811
|
}
|
|
@@ -85314,6 +85350,44 @@ function vaultSessionOf({
|
|
|
85314
85350
|
return { ...base, harness: "script", id: folder.slice(0, 200) || "script" };
|
|
85315
85351
|
}
|
|
85316
85352
|
|
|
85353
|
+
// src/services/vault-placeholders-file.service.ts
|
|
85354
|
+
async function placeholdersOf({ env }) {
|
|
85355
|
+
const path = env.LAZE_VAULT_PLACEHOLDERS;
|
|
85356
|
+
if (!path) return {};
|
|
85357
|
+
const parsed = await readStateJson({ path });
|
|
85358
|
+
return parsed && typeof parsed === "object" ? parsed : {};
|
|
85359
|
+
}
|
|
85360
|
+
async function remember({
|
|
85361
|
+
env,
|
|
85362
|
+
connectionId,
|
|
85363
|
+
fields
|
|
85364
|
+
}) {
|
|
85365
|
+
const path = env.LAZE_VAULT_PLACEHOLDERS;
|
|
85366
|
+
if (!path) return;
|
|
85367
|
+
await withStateLock({
|
|
85368
|
+
path,
|
|
85369
|
+
work: async () => {
|
|
85370
|
+
const held = await placeholdersOf({ env });
|
|
85371
|
+
const value = { ...held, [connectionId]: { ...held[connectionId], ...fields } };
|
|
85372
|
+
await writeStateJson({ path, value, pretty: true });
|
|
85373
|
+
}
|
|
85374
|
+
});
|
|
85375
|
+
}
|
|
85376
|
+
async function handedOut({
|
|
85377
|
+
context,
|
|
85378
|
+
name: name3,
|
|
85379
|
+
connectionId,
|
|
85380
|
+
fields
|
|
85381
|
+
}) {
|
|
85382
|
+
await remember({ env: context.environment.inherited, connectionId, fields }).catch(
|
|
85383
|
+
() => void 0
|
|
85384
|
+
);
|
|
85385
|
+
context.err(
|
|
85386
|
+
`laze vault: ${Object.keys(fields).join(", ")} of ${name3} hold a stand-in; Laze's proxy puts the key in only on sites approved for it. A command that needs the value itself (signing, a database) needs ${name3} marked "Used on the computer only".
|
|
85387
|
+
`
|
|
85388
|
+
);
|
|
85389
|
+
}
|
|
85390
|
+
|
|
85317
85391
|
// src/services/vault-commands.service.ts
|
|
85318
85392
|
var USAGE3 = `Usage: laze vault run <connection> --reason "<one plain sentence>" [--wait <s>] -- <command> [args...]
|
|
85319
85393
|
Runs the command with the connection's values in its environment, on a Laze agent's computer,
|
|
@@ -85493,7 +85567,8 @@ async function vaultRelease({
|
|
|
85493
85567
|
args,
|
|
85494
85568
|
connection,
|
|
85495
85569
|
reason: reason2,
|
|
85496
|
-
command
|
|
85570
|
+
command,
|
|
85571
|
+
value = false
|
|
85497
85572
|
}) {
|
|
85498
85573
|
const deadline = deadlineOf({ args, nowMs: context.nowMs() });
|
|
85499
85574
|
const env = context.environment.inherited;
|
|
@@ -85506,7 +85581,13 @@ async function vaultRelease({
|
|
|
85506
85581
|
};
|
|
85507
85582
|
const keyPath = runKeyPathOf({ turnFile, connection });
|
|
85508
85583
|
const run4 = await runKeyAt({ path: keyPath });
|
|
85509
|
-
const body = JSON.stringify({
|
|
85584
|
+
const body = JSON.stringify({
|
|
85585
|
+
connection,
|
|
85586
|
+
reason: reason2,
|
|
85587
|
+
command,
|
|
85588
|
+
recipient: run4.publicKey,
|
|
85589
|
+
...value && { value: true }
|
|
85590
|
+
});
|
|
85510
85591
|
let release2;
|
|
85511
85592
|
try {
|
|
85512
85593
|
const first = await releaseOf({
|
|
@@ -85549,7 +85630,7 @@ async function settled2({
|
|
|
85549
85630
|
if (!leaseHolds({ release: release2, nowMs: context.nowMs() })) await rm11(keyPath, { force: true });
|
|
85550
85631
|
if (release2.message) context.err(`${release2.message}
|
|
85551
85632
|
`);
|
|
85552
|
-
return { env: values };
|
|
85633
|
+
return { env: values, ...release2.boundary && { boundary: release2.boundary } };
|
|
85553
85634
|
}
|
|
85554
85635
|
function refusedRelease(error63) {
|
|
85555
85636
|
if (!(error63 instanceof LazeApiError)) throw error63;
|
|
@@ -85633,6 +85714,10 @@ ${USAGE3}`);
|
|
|
85633
85714
|
}
|
|
85634
85715
|
const released = await vaultRelease({ context, args, connection, reason: reason2, command: args.rest });
|
|
85635
85716
|
if ("exitCode" in released) return released.exitCode;
|
|
85717
|
+
if (released.boundary) {
|
|
85718
|
+
const { connectionId } = released.boundary;
|
|
85719
|
+
await handedOut({ context, name: connection, connectionId, fields: released.env });
|
|
85720
|
+
}
|
|
85636
85721
|
const prepared = preparedCommand({
|
|
85637
85722
|
command: args.rest,
|
|
85638
85723
|
released: /* @__PURE__ */ new Map([[connection, released.env]])
|
|
@@ -85865,7 +85950,8 @@ ${BROWSER_TAB_USAGE}`
|
|
|
85865
85950
|
args,
|
|
85866
85951
|
connection,
|
|
85867
85952
|
reason: reason2,
|
|
85868
|
-
command: ["laze", "browser", "login", tab]
|
|
85953
|
+
command: ["laze", "browser", "login", tab],
|
|
85954
|
+
value: true
|
|
85869
85955
|
});
|
|
85870
85956
|
if ("exitCode" in released) return released.exitCode;
|
|
85871
85957
|
const [problem] = unusableFieldProblems({ fields: released.env });
|
|
@@ -88025,7 +88111,7 @@ async function login({ context, args }) {
|
|
|
88025
88111
|
const url2 = serverUrlOf({ context, args });
|
|
88026
88112
|
const name3 = flagText({ args, name: "profile", fallback: "default" });
|
|
88027
88113
|
const given = flagText({ args, name: "token" });
|
|
88028
|
-
const token2 = given || await deviceToken({ context, url: url2, args });
|
|
88114
|
+
const token2 = given || await deviceToken({ context, url: url2, args, profile: name3 });
|
|
88029
88115
|
const profile = await profileOf({ context, url: url2, token: token2 });
|
|
88030
88116
|
const here = Boolean(args.flags.here);
|
|
88031
88117
|
await context.store.saveProfile({
|
|
@@ -88050,7 +88136,8 @@ async function machineLine({ context }) {
|
|
|
88050
88136
|
async function deviceToken({
|
|
88051
88137
|
context,
|
|
88052
88138
|
url: url2,
|
|
88053
|
-
args
|
|
88139
|
+
args,
|
|
88140
|
+
profile
|
|
88054
88141
|
}) {
|
|
88055
88142
|
const client = LazeClient.create({ baseUrl: url2, fetcher: context.fetcher });
|
|
88056
88143
|
const machineKey = await context.machineKeys?.registration().catch(() => void 0);
|
|
@@ -88060,7 +88147,7 @@ async function deviceToken({
|
|
|
88060
88147
|
name: "client",
|
|
88061
88148
|
fallback: `laze CLI on ${hostname8()}`.slice(0, 80)
|
|
88062
88149
|
}),
|
|
88063
|
-
...machineKey ? { machineKey } : {}
|
|
88150
|
+
...machineKey ? { machineKey, profile: context.store.loginProfileOf({ name: profile }) } : {}
|
|
88064
88151
|
});
|
|
88065
88152
|
context.out(
|
|
88066
88153
|
[
|
|
@@ -94168,11 +94255,11 @@ async function suggestServer({
|
|
|
94168
94255
|
}
|
|
94169
94256
|
|
|
94170
94257
|
// src/services/connector-commands.service.ts
|
|
94171
|
-
import { readFile as
|
|
94258
|
+
import { readFile as readFile23 } from "node:fs/promises";
|
|
94172
94259
|
import { resolve as resolve14 } from "node:path";
|
|
94173
94260
|
|
|
94174
94261
|
// src/services/vault-keychain-commands.service.ts
|
|
94175
|
-
import { readFile as
|
|
94262
|
+
import { readFile as readFile22 } from "node:fs/promises";
|
|
94176
94263
|
|
|
94177
94264
|
// src/rules/vault-input.rules.ts
|
|
94178
94265
|
function secondsOf(text3) {
|
|
@@ -94465,273 +94552,6 @@ var listDevices = async ({ context, args }) => {
|
|
|
94465
94552
|
}
|
|
94466
94553
|
};
|
|
94467
94554
|
|
|
94468
|
-
// src/services/vault-batch.service.ts
|
|
94469
|
-
import { readFile as readFile22, rm as rm16 } from "node:fs/promises";
|
|
94470
|
-
async function placeholdersOf({
|
|
94471
|
-
env
|
|
94472
|
-
}) {
|
|
94473
|
-
const path = env.LAZE_VAULT_PLACEHOLDERS;
|
|
94474
|
-
if (!path || !proxyOf({ env })) return {};
|
|
94475
|
-
try {
|
|
94476
|
-
const parsed = JSON.parse(await readFile22(path, "utf8"));
|
|
94477
|
-
return parsed && typeof parsed === "object" ? parsed : {};
|
|
94478
|
-
} catch {
|
|
94479
|
-
return {};
|
|
94480
|
-
}
|
|
94481
|
-
}
|
|
94482
|
-
async function batchOf({ response }) {
|
|
94483
|
-
const text3 = await response.text();
|
|
94484
|
-
if (!response.ok) {
|
|
94485
|
-
const code4 = /"code"\s*:\s*"([^"]+)"/.exec(text3)?.[1] ?? `status ${response.status}`;
|
|
94486
|
-
throw new CliUsageError(`laze vault: the batch was refused (${code4})`);
|
|
94487
|
-
}
|
|
94488
|
-
return JSON.parse(text3);
|
|
94489
|
-
}
|
|
94490
|
-
async function doorOf({
|
|
94491
|
-
context,
|
|
94492
|
-
args,
|
|
94493
|
-
keyName
|
|
94494
|
-
}) {
|
|
94495
|
-
const env = context.environment.inherited;
|
|
94496
|
-
const proxy = proxyOf({ env });
|
|
94497
|
-
if (proxy) {
|
|
94498
|
-
const turnFile = turnFileOf({ env });
|
|
94499
|
-
const headers = {
|
|
94500
|
-
"proxy-authorization": proxy.authorization,
|
|
94501
|
-
"x-laze-turn": await turnTokenOf2({ env, turnFile, command: "laze vault env" })
|
|
94502
|
-
};
|
|
94503
|
-
return {
|
|
94504
|
-
keyPath: runKeyPathOf({ turnFile, connection: keyName }),
|
|
94505
|
-
ask: async (body) => batchOf({
|
|
94506
|
-
response: await reach({
|
|
94507
|
-
context,
|
|
94508
|
-
url: `${proxy.origin}/vault/release-batch`,
|
|
94509
|
-
init: {
|
|
94510
|
-
method: "POST",
|
|
94511
|
-
headers: { ...headers, "content-type": "application/json" },
|
|
94512
|
-
body: JSON.stringify(body)
|
|
94513
|
-
}
|
|
94514
|
-
})
|
|
94515
|
-
}),
|
|
94516
|
-
status: async (requestId) => releaseOf({
|
|
94517
|
-
response: await reach({
|
|
94518
|
-
context,
|
|
94519
|
-
url: `${proxy.origin}/vault/release/${encodeURIComponent(requestId)}`,
|
|
94520
|
-
init: { method: "GET", headers }
|
|
94521
|
-
})
|
|
94522
|
-
})
|
|
94523
|
-
};
|
|
94524
|
-
}
|
|
94525
|
-
const signed2 = await signedIn({ context, args }).catch(() => null);
|
|
94526
|
-
if (signed2?.profile.kind !== "agent" && signed2?.profile.kind !== "person") {
|
|
94527
|
-
throw new CliUsageError(`laze vault env ${WHERE}`);
|
|
94528
|
-
}
|
|
94529
|
-
const { name: name3 } = signed2;
|
|
94530
|
-
const harnessSession = await currentSessionOf({ context, args });
|
|
94531
|
-
const client = forSession({ client: signed2.client, session: harnessSession });
|
|
94532
|
-
const door = signed2.profile.kind === "person" ? {
|
|
94533
|
-
ask: "/api/vault/session/release-batch",
|
|
94534
|
-
status: "/api/vault/session/release-status",
|
|
94535
|
-
extra: { session: await vaultSessionFor({ context, args, harnessSession }) }
|
|
94536
|
-
} : {
|
|
94537
|
-
ask: "/api/agents/me/vault/release-batch",
|
|
94538
|
-
status: "/api/agents/me/vault/release-status",
|
|
94539
|
-
extra: { channelId: flagText({ args, name: "channel" }) || null }
|
|
94540
|
-
};
|
|
94541
|
-
return {
|
|
94542
|
-
keyPath: runKeyPathOf({ turnFile: void 0, connection: keyName, profile: name3 }),
|
|
94543
|
-
ask: async (body) => {
|
|
94544
|
-
try {
|
|
94545
|
-
return await client.post(door.ask, { ...body, ...door.extra });
|
|
94546
|
-
} catch (error63) {
|
|
94547
|
-
if (!(error63 instanceof LazeApiError)) throw error63;
|
|
94548
|
-
throw new CliUsageError(`laze vault: the batch was refused: ${refusalText(error63)}`);
|
|
94549
|
-
}
|
|
94550
|
-
},
|
|
94551
|
-
status: (requestId) => patiently({
|
|
94552
|
-
context,
|
|
94553
|
-
call: () => client.post(door.status, { requestId, ...door.extra })
|
|
94554
|
-
}).catch(refusedRelease)
|
|
94555
|
-
};
|
|
94556
|
-
}
|
|
94557
|
-
async function resolveBatch({
|
|
94558
|
-
context,
|
|
94559
|
-
args,
|
|
94560
|
-
refs
|
|
94561
|
-
}) {
|
|
94562
|
-
const door = await doorOf({ context, args, keyName: "env-names" });
|
|
94563
|
-
const answer6 = await door.ask({ refs, reason: "", command: [], resolveOnly: true });
|
|
94564
|
-
return answer6.entries;
|
|
94565
|
-
}
|
|
94566
|
-
var keyOf = (entry2) => entry2.connection?.name ?? entry2.ref;
|
|
94567
|
-
async function untilAllAnswered({
|
|
94568
|
-
context,
|
|
94569
|
-
door,
|
|
94570
|
-
waiting,
|
|
94571
|
-
deadline
|
|
94572
|
-
}) {
|
|
94573
|
-
const answered = /* @__PURE__ */ new Map();
|
|
94574
|
-
if (waiting.size === 0) return answered;
|
|
94575
|
-
const [first] = waiting.values();
|
|
94576
|
-
context.err(
|
|
94577
|
-
`laze vault: ${[...waiting.keys()].join(", ")} wait for an answer (${first?.message ?? "a card"}); cards expire after 24 hours...
|
|
94578
|
-
`
|
|
94579
|
-
);
|
|
94580
|
-
while (waiting.size > 0) {
|
|
94581
|
-
if (context.nowMs() + POLL_MS > deadline) {
|
|
94582
|
-
context.err(
|
|
94583
|
-
`laze vault: ${[...waiting.keys()].join(", ")} not approved yet; ask again later.
|
|
94584
|
-
`
|
|
94585
|
-
);
|
|
94586
|
-
return "capped";
|
|
94587
|
-
}
|
|
94588
|
-
await context.sleep(POLL_MS);
|
|
94589
|
-
for (const [key, pending2] of waiting) {
|
|
94590
|
-
const next = await door.status(pending2.requestId);
|
|
94591
|
-
if (next.outcome === "ask") waiting.set(key, next);
|
|
94592
|
-
else {
|
|
94593
|
-
waiting.delete(key);
|
|
94594
|
-
answered.set(key, next);
|
|
94595
|
-
}
|
|
94596
|
-
}
|
|
94597
|
-
}
|
|
94598
|
-
return answered;
|
|
94599
|
-
}
|
|
94600
|
-
async function releaseBatch({
|
|
94601
|
-
context,
|
|
94602
|
-
args,
|
|
94603
|
-
refs,
|
|
94604
|
-
reason: reason2,
|
|
94605
|
-
command
|
|
94606
|
-
}) {
|
|
94607
|
-
const deadline = deadlineOf({ args, nowMs: context.nowMs() });
|
|
94608
|
-
const door = await doorOf({ context, args, keyName: `env:${[...refs].toSorted().join(",")}` });
|
|
94609
|
-
const run4 = await runKeyAt({ path: door.keyPath });
|
|
94610
|
-
const placeholders = await placeholdersOf({ env: context.environment.inherited });
|
|
94611
|
-
let answer6;
|
|
94612
|
-
let settled3;
|
|
94613
|
-
try {
|
|
94614
|
-
answer6 = await door.ask({
|
|
94615
|
-
refs,
|
|
94616
|
-
reason: reason2,
|
|
94617
|
-
command,
|
|
94618
|
-
recipient: run4.publicKey,
|
|
94619
|
-
...Object.keys(placeholders).length > 0 && { placeholders: true }
|
|
94620
|
-
});
|
|
94621
|
-
const missing = answer6.entries.filter((entry2) => !entry2.connection);
|
|
94622
|
-
if (missing.length > 0) {
|
|
94623
|
-
context.err(
|
|
94624
|
-
`laze vault: no key named ${missing.map((entry2) => entry2.ref).join(", ")} in your vault or reachable by this agent
|
|
94625
|
-
`
|
|
94626
|
-
);
|
|
94627
|
-
return { exitCode: 1 };
|
|
94628
|
-
}
|
|
94629
|
-
const sorted = sortedReleasesOf({ entries: answer6.entries });
|
|
94630
|
-
settled3 = sorted.settled;
|
|
94631
|
-
const { waiting } = sorted;
|
|
94632
|
-
const later = await untilAllAnswered({ context, door, waiting, deadline });
|
|
94633
|
-
if (later === "capped") return { exitCode: 75 };
|
|
94634
|
-
for (const [key, release2] of later) settled3.set(key, release2);
|
|
94635
|
-
} catch (error63) {
|
|
94636
|
-
if (!(error63 instanceof ServerGoneError)) throw error63;
|
|
94637
|
-
context.err(`${error63.message}. Run the command again to keep waiting.
|
|
94638
|
-
`);
|
|
94639
|
-
return { exitCode: 75 };
|
|
94640
|
-
}
|
|
94641
|
-
const swapped = swappedOf({ context, entries: answer6.entries, placeholders });
|
|
94642
|
-
if (!swapped) return { exitCode: 1 };
|
|
94643
|
-
const outcome = await valuesOf({
|
|
94644
|
-
context,
|
|
94645
|
-
entries: answer6.entries,
|
|
94646
|
-
settled: settled3,
|
|
94647
|
-
run: run4,
|
|
94648
|
-
keyPath: door.keyPath
|
|
94649
|
-
});
|
|
94650
|
-
if ("exitCode" in outcome) return outcome;
|
|
94651
|
-
for (const [ref2, fields] of swapped) outcome.released.set(ref2, { fields });
|
|
94652
|
-
return outcome;
|
|
94653
|
-
}
|
|
94654
|
-
function swappedOf({
|
|
94655
|
-
context,
|
|
94656
|
-
entries,
|
|
94657
|
-
placeholders
|
|
94658
|
-
}) {
|
|
94659
|
-
const swapped = /* @__PURE__ */ new Map();
|
|
94660
|
-
for (const entry2 of entries) {
|
|
94661
|
-
if (!entry2.boundary || !entry2.connection) continue;
|
|
94662
|
-
const held = placeholders[entry2.boundary.connectionId] ?? {};
|
|
94663
|
-
const fields = Object.fromEntries(
|
|
94664
|
-
entry2.connection.fieldNames.flatMap((field) => {
|
|
94665
|
-
const placeholder = held[field];
|
|
94666
|
-
return placeholder ? [[field, placeholder]] : [];
|
|
94667
|
-
})
|
|
94668
|
-
);
|
|
94669
|
-
if (Object.keys(fields).length === 0) {
|
|
94670
|
-
context.err(
|
|
94671
|
-
`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
|
|
94672
|
-
`
|
|
94673
|
-
);
|
|
94674
|
-
return null;
|
|
94675
|
-
}
|
|
94676
|
-
swapped.set(entry2.ref, fields);
|
|
94677
|
-
}
|
|
94678
|
-
return swapped;
|
|
94679
|
-
}
|
|
94680
|
-
function sortedReleasesOf({ entries }) {
|
|
94681
|
-
const settled3 = /* @__PURE__ */ new Map();
|
|
94682
|
-
const waiting = /* @__PURE__ */ new Map();
|
|
94683
|
-
for (const entry2 of entries) {
|
|
94684
|
-
const release2 = entry2.release;
|
|
94685
|
-
if (!release2) continue;
|
|
94686
|
-
if (release2.outcome === "ask") waiting.set(keyOf(entry2), release2);
|
|
94687
|
-
else settled3.set(keyOf(entry2), release2);
|
|
94688
|
-
}
|
|
94689
|
-
return { settled: settled3, waiting };
|
|
94690
|
-
}
|
|
94691
|
-
function refusalOf({
|
|
94692
|
-
context,
|
|
94693
|
-
settled: settled3
|
|
94694
|
-
}) {
|
|
94695
|
-
const codes = [];
|
|
94696
|
-
for (const release2 of settled3.values()) {
|
|
94697
|
-
if (release2.outcome !== "deny") continue;
|
|
94698
|
-
context.err(`${release2.message}
|
|
94699
|
-
`);
|
|
94700
|
-
codes.push(release2.exitCode || 1);
|
|
94701
|
-
}
|
|
94702
|
-
if (codes.length === 0) return 0;
|
|
94703
|
-
return codes.includes(77) ? 77 : codes[0] ?? 1;
|
|
94704
|
-
}
|
|
94705
|
-
async function valuesOf({
|
|
94706
|
-
context,
|
|
94707
|
-
entries,
|
|
94708
|
-
settled: settled3,
|
|
94709
|
-
run: run4,
|
|
94710
|
-
keyPath
|
|
94711
|
-
}) {
|
|
94712
|
-
const refused = refusalOf({ context, settled: settled3 });
|
|
94713
|
-
if (refused !== 0) {
|
|
94714
|
-
await rm16(keyPath, { force: true });
|
|
94715
|
-
return { exitCode: refused };
|
|
94716
|
-
}
|
|
94717
|
-
const opened = /* @__PURE__ */ new Map();
|
|
94718
|
-
let keep2 = false;
|
|
94719
|
-
for (const [key, release2] of settled3) {
|
|
94720
|
-
if (release2.outcome !== "allow") continue;
|
|
94721
|
-
opened.set(key, await envOf({ release: release2, run: run4 }));
|
|
94722
|
-
if (leaseHolds({ release: release2, nowMs: context.nowMs() })) keep2 = true;
|
|
94723
|
-
if (release2.message) context.err(`${release2.message}
|
|
94724
|
-
`);
|
|
94725
|
-
}
|
|
94726
|
-
if (!keep2) await rm16(keyPath, { force: true });
|
|
94727
|
-
const released = /* @__PURE__ */ new Map();
|
|
94728
|
-
for (const entry2 of entries) {
|
|
94729
|
-
const fields = opened.get(keyOf(entry2));
|
|
94730
|
-
if (fields) released.set(entry2.ref, { fields });
|
|
94731
|
-
}
|
|
94732
|
-
return { released, entries };
|
|
94733
|
-
}
|
|
94734
|
-
|
|
94735
94555
|
// src/services/vault-share-commands.service.ts
|
|
94736
94556
|
var SHARE_USAGE2 = "Usage: laze vault share <connection> --with <email|userId> [--for 1h]";
|
|
94737
94557
|
var WAITING_LINE = "It waits for the owner's approval with a passkey or Face ID, in Settings > Vault.";
|
|
@@ -94860,7 +94680,7 @@ async function secretText({ context, args }) {
|
|
|
94860
94680
|
);
|
|
94861
94681
|
}
|
|
94862
94682
|
const file4 = flagText({ args, name: "from-file" });
|
|
94863
|
-
const text3 = file4 ? await
|
|
94683
|
+
const text3 = file4 ? await readFile22(file4, "utf8") : await context.readStdin();
|
|
94864
94684
|
const trimmed = text3.replace(/\r?\n$/, "");
|
|
94865
94685
|
if (!trimmed.trim()) throw new CliUsageError("No value: pipe it on stdin or use --from-file.");
|
|
94866
94686
|
const held = await placeholdersOf({ env: context.environment.inherited });
|
|
@@ -95105,7 +94925,7 @@ async function keyText({ context, args }) {
|
|
|
95105
94925
|
throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
|
|
95106
94926
|
}
|
|
95107
94927
|
const file4 = flagText({ args, name: "from-file" });
|
|
95108
|
-
const text3 = file4 ? await
|
|
94928
|
+
const text3 = file4 ? await readFile23(resolve14(context.cwd, file4), "utf8") : await context.readStdin();
|
|
95109
94929
|
const trimmed = text3.trim();
|
|
95110
94930
|
if (!trimmed) throw new CliUsageError("No key: pipe it on stdin or use --from-file.");
|
|
95111
94931
|
return trimmed;
|
|
@@ -95494,7 +95314,7 @@ async function conversationDelete({ context, args }) {
|
|
|
95494
95314
|
}
|
|
95495
95315
|
|
|
95496
95316
|
// src/services/discord-commands.service.ts
|
|
95497
|
-
import { readFile as
|
|
95317
|
+
import { readFile as readFile24 } from "node:fs/promises";
|
|
95498
95318
|
import { resolve as resolve15 } from "node:path";
|
|
95499
95319
|
|
|
95500
95320
|
// ../../modules/discord/contract/src/discord.ts
|
|
@@ -95842,7 +95662,7 @@ async function secretsOf({ context, args }) {
|
|
|
95842
95662
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
95843
95663
|
if (fromConnection) return { fromConnection };
|
|
95844
95664
|
const file4 = flagText({ args, name: "from-file" });
|
|
95845
|
-
const text3 = file4 ? await
|
|
95665
|
+
const text3 = file4 ? await readFile24(resolve15(context.cwd, file4), "utf8") : await context.readStdin();
|
|
95846
95666
|
const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
95847
95667
|
if (lines2.length !== 2) {
|
|
95848
95668
|
throw new CliUsageError(
|
|
@@ -96145,7 +95965,7 @@ async function domains({ context, args }) {
|
|
|
96145
95965
|
}
|
|
96146
95966
|
|
|
96147
95967
|
// src/services/emoji-commands.service.ts
|
|
96148
|
-
import { readFile as
|
|
95968
|
+
import { readFile as readFile25 } from "node:fs/promises";
|
|
96149
95969
|
import { resolve as resolve16 } from "node:path";
|
|
96150
95970
|
var EMOJI_USAGE = `Usage:
|
|
96151
95971
|
laze emoji list [--json] the workspace's custom emoji, aliases and who added each
|
|
@@ -96186,7 +96006,7 @@ async function addEmoji({ context, args, client }) {
|
|
|
96186
96006
|
const file4 = wordAt4(args, 3);
|
|
96187
96007
|
let bytes;
|
|
96188
96008
|
try {
|
|
96189
|
-
bytes = new Uint8Array(await
|
|
96009
|
+
bytes = new Uint8Array(await readFile25(resolve16(context.cwd, file4)));
|
|
96190
96010
|
} catch {
|
|
96191
96011
|
throw new CliUsageError(`Cannot read ${file4}.`);
|
|
96192
96012
|
}
|
|
@@ -96525,7 +96345,7 @@ var ExternalChannelBannerSlot = externalUi.component("channel-banner");
|
|
|
96525
96345
|
var ExternalSharingHooksToken = externalUi.hooks("sharing");
|
|
96526
96346
|
|
|
96527
96347
|
// src/services/workspace-commands.service.ts
|
|
96528
|
-
import { readFile as
|
|
96348
|
+
import { readFile as readFile26 } from "node:fs/promises";
|
|
96529
96349
|
import { resolve as resolve17 } from "node:path";
|
|
96530
96350
|
var ROLE_NAMES2 = {
|
|
96531
96351
|
OWNER: "Owner",
|
|
@@ -96708,7 +96528,7 @@ var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze work
|
|
|
96708
96528
|
async function readLogo({ context, file: file4 }) {
|
|
96709
96529
|
let bytes;
|
|
96710
96530
|
try {
|
|
96711
|
-
bytes = new Uint8Array(await
|
|
96531
|
+
bytes = new Uint8Array(await readFile26(resolve17(context.cwd, file4)));
|
|
96712
96532
|
} catch {
|
|
96713
96533
|
throw new CliUsageError(`No file to read at ${file4}.`);
|
|
96714
96534
|
}
|
|
@@ -97343,7 +97163,7 @@ async function agentFeedAccess({
|
|
|
97343
97163
|
}
|
|
97344
97164
|
|
|
97345
97165
|
// src/services/feed-commands.service.ts
|
|
97346
|
-
import { readFile as
|
|
97166
|
+
import { readFile as readFile27 } from "node:fs/promises";
|
|
97347
97167
|
import { resolve as resolve18 } from "node:path";
|
|
97348
97168
|
|
|
97349
97169
|
// ../../modules/feed/contract/src/feed.delegate.ts
|
|
@@ -98497,7 +98317,7 @@ async function feedTurnOf({
|
|
|
98497
98317
|
const read4 = async () => {
|
|
98498
98318
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
98499
98319
|
if (pinned) return pinned;
|
|
98500
|
-
if (env.LAZE_TURN_FILE) return (await
|
|
98320
|
+
if (env.LAZE_TURN_FILE) return (await readFile27(env.LAZE_TURN_FILE, "utf8")).trim();
|
|
98501
98321
|
return agent3 ? connectedTurnTokenOf({ client, channelId: channel }) : "";
|
|
98502
98322
|
};
|
|
98503
98323
|
const turn = await read4().catch(() => "");
|
|
@@ -98571,7 +98391,7 @@ async function bodyOf2({
|
|
|
98571
98391
|
flags: flags2
|
|
98572
98392
|
}) {
|
|
98573
98393
|
const body = { ...flags2.fields };
|
|
98574
|
-
const read4 = (source) => "file" in source ?
|
|
98394
|
+
const read4 = (source) => "file" in source ? readFile27(resolve18(context.cwd, source.file), "utf8") : source.text;
|
|
98575
98395
|
for (const [field, source] of Object.entries(flags2.texts)) body[field] = await read4(source);
|
|
98576
98396
|
if (flags2.rich) {
|
|
98577
98397
|
const text3 = await read4(flags2.rich.source);
|
|
@@ -98848,7 +98668,7 @@ async function textFlag({
|
|
|
98848
98668
|
}) {
|
|
98849
98669
|
const value = flagText({ args, name: name3 });
|
|
98850
98670
|
if (!value.startsWith("@")) return value;
|
|
98851
|
-
return
|
|
98671
|
+
return readFile27(resolve18(context.cwd, value.slice(1)), "utf8");
|
|
98852
98672
|
}
|
|
98853
98673
|
async function feedList({ context, args }) {
|
|
98854
98674
|
const { client, profile } = await signedIn({ context, args });
|
|
@@ -98938,7 +98758,7 @@ async function ranksOf({
|
|
|
98938
98758
|
}) {
|
|
98939
98759
|
const file4 = flagText({ args, name: "file" });
|
|
98940
98760
|
if (file4) {
|
|
98941
|
-
const parsed = JSON.parse(await
|
|
98761
|
+
const parsed = JSON.parse(await readFile27(resolve18(context.cwd, file4), "utf8"));
|
|
98942
98762
|
if (Array.isArray(parsed)) return parsed;
|
|
98943
98763
|
throw new CliUsageError("--file holds a list of {itemId, priority}");
|
|
98944
98764
|
}
|
|
@@ -99053,7 +98873,7 @@ async function feed({ context, args }) {
|
|
|
99053
98873
|
}
|
|
99054
98874
|
|
|
99055
98875
|
// src/services/github-commands.service.ts
|
|
99056
|
-
import { readFile as
|
|
98876
|
+
import { readFile as readFile28 } from "node:fs/promises";
|
|
99057
98877
|
|
|
99058
98878
|
// src/rules/github-signature.rules.ts
|
|
99059
98879
|
var TURN_SEPARATOR = "~";
|
|
@@ -99123,7 +98943,7 @@ var REAL_GH = "/usr/bin/gh";
|
|
|
99123
98943
|
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>`.";
|
|
99124
98944
|
async function turnFileToken({ env }) {
|
|
99125
98945
|
if (!env.LAZE_TURN_FILE) return "";
|
|
99126
|
-
return
|
|
98946
|
+
return readFile28(env.LAZE_TURN_FILE, "utf8").then(
|
|
99127
98947
|
(text3) => text3.trim(),
|
|
99128
98948
|
() => ""
|
|
99129
98949
|
);
|
|
@@ -99157,7 +98977,7 @@ async function githubGh({
|
|
|
99157
98977
|
args: args.rest,
|
|
99158
98978
|
agentName: profile.name ?? "An agent",
|
|
99159
98979
|
threadUrl: threadUrlOf({ env, workspaceId: profile.workspaceId }),
|
|
99160
|
-
readBodyFile: (path) => path === "-" ? context.readStdin() :
|
|
98980
|
+
readBodyFile: (path) => path === "-" ? context.readStdin() : readFile28(path, "utf8")
|
|
99161
98981
|
});
|
|
99162
98982
|
return context.runCommand({
|
|
99163
98983
|
command: [REAL_GH, ...ghArgs],
|
|
@@ -99821,7 +99641,7 @@ async function ip({ context, args }) {
|
|
|
99821
99641
|
}
|
|
99822
99642
|
|
|
99823
99643
|
// src/services/join-commands.service.ts
|
|
99824
|
-
import { rm as
|
|
99644
|
+
import { rm as rm16 } from "node:fs/promises";
|
|
99825
99645
|
import { hostname as hostname9 } from "node:os";
|
|
99826
99646
|
import { dirname as dirname22, join as join31 } from "node:path";
|
|
99827
99647
|
var DEFAULT_WAIT_SECONDS2 = 100;
|
|
@@ -99843,7 +99663,7 @@ async function keepPending({ context, pending: pending2 }) {
|
|
|
99843
99663
|
await writeStateJson({ path: pendingPathOf({ context }), value: pending2 });
|
|
99844
99664
|
}
|
|
99845
99665
|
async function dropPending({ context }) {
|
|
99846
|
-
await
|
|
99666
|
+
await rm16(pendingPathOf({ context }), { force: true });
|
|
99847
99667
|
}
|
|
99848
99668
|
function waitSecondsOf3({ args }) {
|
|
99849
99669
|
const raw = flagText({ args, name: "timeout" });
|
|
@@ -100773,7 +100593,14 @@ ${USAGE13}`);
|
|
|
100773
100593
|
${USAGE13}`);
|
|
100774
100594
|
const env = {};
|
|
100775
100595
|
for (const connection of new Set(connections)) {
|
|
100776
|
-
const released = await vaultRelease({
|
|
100596
|
+
const released = await vaultRelease({
|
|
100597
|
+
context,
|
|
100598
|
+
args,
|
|
100599
|
+
connection,
|
|
100600
|
+
reason: reason2,
|
|
100601
|
+
command: args.rest,
|
|
100602
|
+
value: true
|
|
100603
|
+
});
|
|
100777
100604
|
if ("exitCode" in released) return released;
|
|
100778
100605
|
Object.assign(env, released.env);
|
|
100779
100606
|
}
|
|
@@ -101102,18 +100929,18 @@ async function serveMcp({
|
|
|
101102
100929
|
}
|
|
101103
100930
|
|
|
101104
100931
|
// src/services/memory-commands.service.ts
|
|
101105
|
-
import { readdir as readdir7, readFile as
|
|
100932
|
+
import { readdir as readdir7, readFile as readFile30 } from "node:fs/promises";
|
|
101106
100933
|
import { join as join32, resolve as resolve20 } from "node:path";
|
|
101107
100934
|
|
|
101108
100935
|
// src/services/mount-files.service.ts
|
|
101109
|
-
import { mkdir as mkdir11, readFile as
|
|
100936
|
+
import { mkdir as mkdir11, readFile as readFile29, rm as rm17, writeFile as writeFile8 } from "node:fs/promises";
|
|
101110
100937
|
import { dirname as dirname23, relative as relative4, resolve as resolve19 } from "node:path";
|
|
101111
100938
|
async function textArgument({
|
|
101112
100939
|
context,
|
|
101113
100940
|
value
|
|
101114
100941
|
}) {
|
|
101115
100942
|
if (value === "-") return context.readStdin();
|
|
101116
|
-
if (value.startsWith("@")) return
|
|
100943
|
+
if (value.startsWith("@")) return readFile29(resolve19(context.cwd, value.slice(1)), "utf8");
|
|
101117
100944
|
return value;
|
|
101118
100945
|
}
|
|
101119
100946
|
function turnChannel({ context, args }) {
|
|
@@ -101126,7 +100953,7 @@ async function writeMount({
|
|
|
101126
100953
|
files: files2
|
|
101127
100954
|
}) {
|
|
101128
100955
|
const root = resolve19(context.cwd, flagText({ args, name: "dir", fallback: ".laze" }), folder);
|
|
101129
|
-
await
|
|
100956
|
+
await rm17(root, { recursive: true, force: true });
|
|
101130
100957
|
await mkdir11(root, { recursive: true });
|
|
101131
100958
|
for (const file4 of files2) {
|
|
101132
100959
|
const target = resolve19(root, file4.path);
|
|
@@ -101260,7 +101087,7 @@ async function turnTokenOf5({ context }) {
|
|
|
101260
101087
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
101261
101088
|
if (pinned) return pinned;
|
|
101262
101089
|
if (!env.LAZE_TURN_FILE) return "";
|
|
101263
|
-
return
|
|
101090
|
+
return readFile30(env.LAZE_TURN_FILE, "utf8").then(
|
|
101264
101091
|
(text3) => text3.trim(),
|
|
101265
101092
|
() => ""
|
|
101266
101093
|
);
|
|
@@ -101390,7 +101217,7 @@ async function siestaImport({
|
|
|
101390
101217
|
dir
|
|
101391
101218
|
}) {
|
|
101392
101219
|
const root = resolve20(context.cwd, dir);
|
|
101393
|
-
const log = await
|
|
101220
|
+
const log = await readFile30(join32(root, "LOG.md"));
|
|
101394
101221
|
const names = (await readdir7(join32(root, "tree")).catch(() => [])).filter(
|
|
101395
101222
|
(name3) => /^\d{1,6}-\d{1,6}\.md$/.test(name3)
|
|
101396
101223
|
);
|
|
@@ -101398,7 +101225,7 @@ async function siestaImport({
|
|
|
101398
101225
|
await Promise.all(
|
|
101399
101226
|
names.map(async (name3) => [
|
|
101400
101227
|
name3.slice(0, -3),
|
|
101401
|
-
(await
|
|
101228
|
+
(await readFile30(join32(root, "tree", name3))).toString("base64")
|
|
101402
101229
|
])
|
|
101403
101230
|
)
|
|
101404
101231
|
);
|
|
@@ -101418,7 +101245,7 @@ async function memoryImport({ context, args }) {
|
|
|
101418
101245
|
const dir = flagText({ args, name: "optmem" });
|
|
101419
101246
|
if (!dir) throw new CliUsageError(USAGE14);
|
|
101420
101247
|
const root = resolve20(context.cwd, dir);
|
|
101421
|
-
const log = await
|
|
101248
|
+
const log = await readFile30(join32(root, "LOG.txt"));
|
|
101422
101249
|
const sizes2 = (await readdir7(join32(root, "TREE")).catch(() => [])).filter(
|
|
101423
101250
|
(name3) => /^\d{1,4}$/.test(name3)
|
|
101424
101251
|
);
|
|
@@ -101426,7 +101253,7 @@ async function memoryImport({ context, args }) {
|
|
|
101426
101253
|
await Promise.all(
|
|
101427
101254
|
sizes2.map(async (size) => [
|
|
101428
101255
|
size,
|
|
101429
|
-
(await
|
|
101256
|
+
(await readFile30(join32(root, "TREE", size))).toString("base64")
|
|
101430
101257
|
])
|
|
101431
101258
|
)
|
|
101432
101259
|
);
|
|
@@ -102023,7 +101850,7 @@ async function openclaw({
|
|
|
102023
101850
|
|
|
102024
101851
|
// src/services/operator-key-commands.service.ts
|
|
102025
101852
|
import { createHash as createHash10, randomBytes as randomBytes5 } from "node:crypto";
|
|
102026
|
-
import { mkdir as mkdir12, readFile as
|
|
101853
|
+
import { mkdir as mkdir12, readFile as readFile31, rm as rm18, writeFile as writeFile9 } from "node:fs/promises";
|
|
102027
101854
|
import { dirname as dirname24, join as join33 } from "node:path";
|
|
102028
101855
|
|
|
102029
101856
|
// ../../modules/audit-log/contract/src/audit-log.api.ts
|
|
@@ -103962,7 +103789,7 @@ async function forgetIfOver({
|
|
|
103962
103789
|
const key = await client.post(OPERATOR_KEY_REST_PATHS.status, { keyId });
|
|
103963
103790
|
const windowOver = key.endsAt !== null && Temporal3.Instant.from(key.endsAt).epochMilliseconds <= context.nowMs();
|
|
103964
103791
|
if (key.status !== "pending" && (key.status !== "approved" || windowOver || key.spentAt)) {
|
|
103965
|
-
await
|
|
103792
|
+
await rm18(keyFile({ context, keyId }), { force: true });
|
|
103966
103793
|
}
|
|
103967
103794
|
return key;
|
|
103968
103795
|
}
|
|
@@ -103975,7 +103802,7 @@ async function useKey({
|
|
|
103975
103802
|
if (!keyId) throw new CliUsageError(OPERATOR_KEY_USAGE);
|
|
103976
103803
|
const { client } = await signedIn({ context, args });
|
|
103977
103804
|
const path = keyFile({ context, keyId });
|
|
103978
|
-
const secret = await
|
|
103805
|
+
const secret = await readFile31(path, "utf8").catch(() => null);
|
|
103979
103806
|
if (secret === null) {
|
|
103980
103807
|
throw new CliUsageError(`No operator key ${keyId} is kept on this machine.`);
|
|
103981
103808
|
}
|
|
@@ -104174,7 +104001,7 @@ function watchingRelease({
|
|
|
104174
104001
|
}
|
|
104175
104002
|
|
|
104176
104003
|
// src/services/rush-guard.service.ts
|
|
104177
|
-
import { rm as
|
|
104004
|
+
import { rm as rm19 } from "node:fs/promises";
|
|
104178
104005
|
var WATCH_MS3 = 2e3;
|
|
104179
104006
|
async function guardRound(guard) {
|
|
104180
104007
|
const { context, client, name: name3, lock, claudePid, session, rush, launch } = guard;
|
|
@@ -104261,10 +104088,10 @@ async function rushWakeHook({ context, args }) {
|
|
|
104261
104088
|
return await guardRounds(guard);
|
|
104262
104089
|
} finally {
|
|
104263
104090
|
if ((await holderOf({ path: lock }))?.pid === context.processes.pid)
|
|
104264
|
-
await
|
|
104091
|
+
await rm19(lock, { force: true });
|
|
104265
104092
|
}
|
|
104266
104093
|
} finally {
|
|
104267
|
-
await
|
|
104094
|
+
await rm19(path, { force: true });
|
|
104268
104095
|
}
|
|
104269
104096
|
}
|
|
104270
104097
|
|
|
@@ -104433,7 +104260,7 @@ async function schedule({ context, args }) {
|
|
|
104433
104260
|
}
|
|
104434
104261
|
|
|
104435
104262
|
// src/services/skill-commands.service.ts
|
|
104436
|
-
import { readdir as readdir8, readFile as
|
|
104263
|
+
import { readdir as readdir8, readFile as readFile32 } from "node:fs/promises";
|
|
104437
104264
|
import { join as join35, relative as relative5, resolve as resolve22 } from "node:path";
|
|
104438
104265
|
var USAGE18 = `Usage:
|
|
104439
104266
|
laze skill list [--agent <agentId>]
|
|
@@ -104456,7 +104283,7 @@ async function folderFiles({ root }) {
|
|
|
104456
104283
|
for (const entry2 of entries) {
|
|
104457
104284
|
if (!entry2.isFile()) continue;
|
|
104458
104285
|
const full = join35(entry2.parentPath, entry2.name);
|
|
104459
|
-
files2.push({ path: relative5(root, full), content: await
|
|
104286
|
+
files2.push({ path: relative5(root, full), content: await readFile32(full, "utf8") });
|
|
104460
104287
|
}
|
|
104461
104288
|
return files2.toSorted((a, b) => a.path.localeCompare(b.path));
|
|
104462
104289
|
}
|
|
@@ -104554,7 +104381,7 @@ async function skillUpdate({ context, args }) {
|
|
|
104554
104381
|
if (!name3 || !newName && description === void 0 && !skillMdFile) {
|
|
104555
104382
|
throw new CliUsageError(USAGE18);
|
|
104556
104383
|
}
|
|
104557
|
-
const skillMd = skillMdFile ? await
|
|
104384
|
+
const skillMd = skillMdFile ? await readFile32(resolve22(context.cwd, skillMdFile), "utf8") : void 0;
|
|
104558
104385
|
const { client } = await signedIn({ context, args });
|
|
104559
104386
|
const updated = await client.post("/api/skills/update", {
|
|
104560
104387
|
name: name3,
|
|
@@ -104600,7 +104427,7 @@ async function skill({ context, args }) {
|
|
|
104600
104427
|
}
|
|
104601
104428
|
|
|
104602
104429
|
// src/services/slack-commands.service.ts
|
|
104603
|
-
import { readFile as
|
|
104430
|
+
import { readFile as readFile33 } from "node:fs/promises";
|
|
104604
104431
|
import { resolve as resolve23 } from "node:path";
|
|
104605
104432
|
var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
|
|
104606
104433
|
laze slack overview connected Slack workspaces, mirrors, your link
|
|
@@ -104651,7 +104478,7 @@ async function secretLines({ context, args }) {
|
|
|
104651
104478
|
throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
|
|
104652
104479
|
}
|
|
104653
104480
|
const file4 = flagText({ args, name: "from-file" });
|
|
104654
|
-
const text3 = file4 ? await
|
|
104481
|
+
const text3 = file4 ? await readFile33(resolve23(context.cwd, file4), "utf8") : await context.readStdin();
|
|
104655
104482
|
return text3.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
104656
104483
|
}
|
|
104657
104484
|
async function secretsOf2({
|
|
@@ -104969,7 +104796,7 @@ async function slack({
|
|
|
104969
104796
|
}
|
|
104970
104797
|
|
|
104971
104798
|
// src/services/sso-commands.service.ts
|
|
104972
|
-
import { readFile as
|
|
104799
|
+
import { readFile as readFile34 } from "node:fs/promises";
|
|
104973
104800
|
var SSO_USAGE = `Usage:
|
|
104974
104801
|
laze sso domains claimed domains and how each signs in (admins)
|
|
104975
104802
|
laze sso claim <domain> the TXT record that proves the domain
|
|
@@ -105056,7 +104883,7 @@ function refuseSecretFlags({ args }) {
|
|
|
105056
104883
|
}
|
|
105057
104884
|
async function clientSecretOf({ context, args }) {
|
|
105058
104885
|
const file4 = flagText({ args, name: "from-file" });
|
|
105059
|
-
const text3 = file4 ? await
|
|
104886
|
+
const text3 = file4 ? await readFile34(file4, "utf8") : await context.readStdin();
|
|
105060
104887
|
const secret = text3.trim();
|
|
105061
104888
|
if (!secret) throw new CliUsageError("No client secret: pipe it on stdin or use --from-file.");
|
|
105062
104889
|
return secret;
|
|
@@ -105400,7 +105227,7 @@ async function checkInstalled({
|
|
|
105400
105227
|
}
|
|
105401
105228
|
|
|
105402
105229
|
// src/services/vault-env-commands.service.ts
|
|
105403
|
-
import { readFile as
|
|
105230
|
+
import { readFile as readFile35, stat as stat12 } from "node:fs/promises";
|
|
105404
105231
|
import { dirname as dirname26, join as join36, resolve as resolve24 } from "node:path";
|
|
105405
105232
|
|
|
105406
105233
|
// src/rules/vault-manifest.rules.ts
|
|
@@ -105488,6 +105315,243 @@ function credentialProcessJson(fields) {
|
|
|
105488
105315
|
});
|
|
105489
105316
|
}
|
|
105490
105317
|
|
|
105318
|
+
// src/services/vault-batch.service.ts
|
|
105319
|
+
import { rm as rm20 } from "node:fs/promises";
|
|
105320
|
+
async function batchOf({ response }) {
|
|
105321
|
+
const text3 = await response.text();
|
|
105322
|
+
if (!response.ok) {
|
|
105323
|
+
const code4 = /"code"\s*:\s*"([^"]+)"/.exec(text3)?.[1] ?? `status ${response.status}`;
|
|
105324
|
+
throw new CliUsageError(`laze vault: the batch was refused (${code4})`);
|
|
105325
|
+
}
|
|
105326
|
+
return JSON.parse(text3);
|
|
105327
|
+
}
|
|
105328
|
+
async function doorOf({
|
|
105329
|
+
context,
|
|
105330
|
+
args,
|
|
105331
|
+
keyName
|
|
105332
|
+
}) {
|
|
105333
|
+
const env = context.environment.inherited;
|
|
105334
|
+
const proxy = proxyOf({ env });
|
|
105335
|
+
if (proxy) {
|
|
105336
|
+
const turnFile = turnFileOf({ env });
|
|
105337
|
+
const headers = {
|
|
105338
|
+
"proxy-authorization": proxy.authorization,
|
|
105339
|
+
"x-laze-turn": await turnTokenOf2({ env, turnFile, command: "laze vault env" })
|
|
105340
|
+
};
|
|
105341
|
+
return {
|
|
105342
|
+
keyPath: runKeyPathOf({ turnFile, connection: keyName }),
|
|
105343
|
+
ask: async (body) => batchOf({
|
|
105344
|
+
response: await reach({
|
|
105345
|
+
context,
|
|
105346
|
+
url: `${proxy.origin}/vault/release-batch`,
|
|
105347
|
+
init: {
|
|
105348
|
+
method: "POST",
|
|
105349
|
+
headers: { ...headers, "content-type": "application/json" },
|
|
105350
|
+
body: JSON.stringify(body)
|
|
105351
|
+
}
|
|
105352
|
+
})
|
|
105353
|
+
}),
|
|
105354
|
+
status: async (requestId) => releaseOf({
|
|
105355
|
+
response: await reach({
|
|
105356
|
+
context,
|
|
105357
|
+
url: `${proxy.origin}/vault/release/${encodeURIComponent(requestId)}`,
|
|
105358
|
+
init: { method: "GET", headers }
|
|
105359
|
+
})
|
|
105360
|
+
})
|
|
105361
|
+
};
|
|
105362
|
+
}
|
|
105363
|
+
const signed2 = await signedIn({ context, args }).catch(() => null);
|
|
105364
|
+
if (signed2?.profile.kind !== "agent" && signed2?.profile.kind !== "person") {
|
|
105365
|
+
throw new CliUsageError(`laze vault env ${WHERE}`);
|
|
105366
|
+
}
|
|
105367
|
+
const { name: name3 } = signed2;
|
|
105368
|
+
const harnessSession = await currentSessionOf({ context, args });
|
|
105369
|
+
const client = forSession({ client: signed2.client, session: harnessSession });
|
|
105370
|
+
const door = signed2.profile.kind === "person" ? {
|
|
105371
|
+
ask: "/api/vault/session/release-batch",
|
|
105372
|
+
status: "/api/vault/session/release-status",
|
|
105373
|
+
extra: { session: await vaultSessionFor({ context, args, harnessSession }) }
|
|
105374
|
+
} : {
|
|
105375
|
+
ask: "/api/agents/me/vault/release-batch",
|
|
105376
|
+
status: "/api/agents/me/vault/release-status",
|
|
105377
|
+
extra: { channelId: flagText({ args, name: "channel" }) || null }
|
|
105378
|
+
};
|
|
105379
|
+
return {
|
|
105380
|
+
keyPath: runKeyPathOf({ turnFile: void 0, connection: keyName, profile: name3 }),
|
|
105381
|
+
ask: async (body) => {
|
|
105382
|
+
try {
|
|
105383
|
+
return await client.post(door.ask, { ...body, ...door.extra });
|
|
105384
|
+
} catch (error63) {
|
|
105385
|
+
if (!(error63 instanceof LazeApiError)) throw error63;
|
|
105386
|
+
throw new CliUsageError(`laze vault: the batch was refused: ${refusalText(error63)}`);
|
|
105387
|
+
}
|
|
105388
|
+
},
|
|
105389
|
+
status: (requestId) => patiently({
|
|
105390
|
+
context,
|
|
105391
|
+
call: () => client.post(door.status, { requestId, ...door.extra })
|
|
105392
|
+
}).catch(refusedRelease)
|
|
105393
|
+
};
|
|
105394
|
+
}
|
|
105395
|
+
async function resolveBatch({
|
|
105396
|
+
context,
|
|
105397
|
+
args,
|
|
105398
|
+
refs
|
|
105399
|
+
}) {
|
|
105400
|
+
const door = await doorOf({ context, args, keyName: "env-names" });
|
|
105401
|
+
const answer6 = await door.ask({ refs, reason: "", command: [], resolveOnly: true });
|
|
105402
|
+
return answer6.entries;
|
|
105403
|
+
}
|
|
105404
|
+
var keyOf = (entry2) => entry2.connection?.name ?? entry2.ref;
|
|
105405
|
+
async function untilAllAnswered({
|
|
105406
|
+
context,
|
|
105407
|
+
door,
|
|
105408
|
+
waiting,
|
|
105409
|
+
deadline
|
|
105410
|
+
}) {
|
|
105411
|
+
const answered = /* @__PURE__ */ new Map();
|
|
105412
|
+
if (waiting.size === 0) return answered;
|
|
105413
|
+
const [first] = waiting.values();
|
|
105414
|
+
context.err(
|
|
105415
|
+
`laze vault: ${[...waiting.keys()].join(", ")} wait for an answer (${first?.message ?? "a card"}); cards expire after 24 hours...
|
|
105416
|
+
`
|
|
105417
|
+
);
|
|
105418
|
+
while (waiting.size > 0) {
|
|
105419
|
+
if (context.nowMs() + POLL_MS > deadline) {
|
|
105420
|
+
context.err(
|
|
105421
|
+
`laze vault: ${[...waiting.keys()].join(", ")} not approved yet; ask again later.
|
|
105422
|
+
`
|
|
105423
|
+
);
|
|
105424
|
+
return "capped";
|
|
105425
|
+
}
|
|
105426
|
+
await context.sleep(POLL_MS);
|
|
105427
|
+
for (const [key, pending2] of waiting) {
|
|
105428
|
+
const next = await door.status(pending2.requestId);
|
|
105429
|
+
if (next.outcome === "ask") waiting.set(key, next);
|
|
105430
|
+
else {
|
|
105431
|
+
waiting.delete(key);
|
|
105432
|
+
answered.set(key, next);
|
|
105433
|
+
}
|
|
105434
|
+
}
|
|
105435
|
+
}
|
|
105436
|
+
return answered;
|
|
105437
|
+
}
|
|
105438
|
+
async function releaseBatch({
|
|
105439
|
+
context,
|
|
105440
|
+
args,
|
|
105441
|
+
refs,
|
|
105442
|
+
reason: reason2,
|
|
105443
|
+
command
|
|
105444
|
+
}) {
|
|
105445
|
+
const deadline = deadlineOf({ args, nowMs: context.nowMs() });
|
|
105446
|
+
const door = await doorOf({ context, args, keyName: `env:${[...refs].toSorted().join(",")}` });
|
|
105447
|
+
const run4 = await runKeyAt({ path: door.keyPath });
|
|
105448
|
+
let answer6;
|
|
105449
|
+
let settled3;
|
|
105450
|
+
try {
|
|
105451
|
+
answer6 = await door.ask({
|
|
105452
|
+
refs,
|
|
105453
|
+
reason: reason2,
|
|
105454
|
+
command,
|
|
105455
|
+
recipient: run4.publicKey
|
|
105456
|
+
});
|
|
105457
|
+
const missing = answer6.entries.filter((entry2) => !entry2.connection);
|
|
105458
|
+
if (missing.length > 0) {
|
|
105459
|
+
context.err(
|
|
105460
|
+
`laze vault: no key named ${missing.map((entry2) => entry2.ref).join(", ")} in your vault or reachable by this agent
|
|
105461
|
+
`
|
|
105462
|
+
);
|
|
105463
|
+
return { exitCode: 1 };
|
|
105464
|
+
}
|
|
105465
|
+
const sorted = sortedReleasesOf({ entries: answer6.entries });
|
|
105466
|
+
settled3 = sorted.settled;
|
|
105467
|
+
const { waiting } = sorted;
|
|
105468
|
+
const later = await untilAllAnswered({ context, door, waiting, deadline });
|
|
105469
|
+
if (later === "capped") return { exitCode: 75 };
|
|
105470
|
+
for (const [key, release2] of later) settled3.set(key, release2);
|
|
105471
|
+
} catch (error63) {
|
|
105472
|
+
if (!(error63 instanceof ServerGoneError)) throw error63;
|
|
105473
|
+
context.err(`${error63.message}. Run the command again to keep waiting.
|
|
105474
|
+
`);
|
|
105475
|
+
return { exitCode: 75 };
|
|
105476
|
+
}
|
|
105477
|
+
const unswapped = answer6.entries.find((entry2) => entry2.boundary && !entry2.release);
|
|
105478
|
+
if (unswapped) {
|
|
105479
|
+
context.err(
|
|
105480
|
+
`laze vault: ${unswapped.ref} is swapped by Laze's proxy, which did not hand out its stand-in; run the command again
|
|
105481
|
+
`
|
|
105482
|
+
);
|
|
105483
|
+
return { exitCode: 75 };
|
|
105484
|
+
}
|
|
105485
|
+
const outcome = await valuesOf({
|
|
105486
|
+
context,
|
|
105487
|
+
entries: answer6.entries,
|
|
105488
|
+
settled: settled3,
|
|
105489
|
+
run: run4,
|
|
105490
|
+
keyPath: door.keyPath
|
|
105491
|
+
});
|
|
105492
|
+
if ("exitCode" in outcome) return outcome;
|
|
105493
|
+
for (const [key, release2] of settled3) {
|
|
105494
|
+
if (release2.outcome !== "allow" || !release2.boundary) continue;
|
|
105495
|
+
const { connectionId } = release2.boundary;
|
|
105496
|
+
await handedOut({ context, name: key, connectionId, fields: release2.env });
|
|
105497
|
+
}
|
|
105498
|
+
return outcome;
|
|
105499
|
+
}
|
|
105500
|
+
function sortedReleasesOf({ entries }) {
|
|
105501
|
+
const settled3 = /* @__PURE__ */ new Map();
|
|
105502
|
+
const waiting = /* @__PURE__ */ new Map();
|
|
105503
|
+
for (const entry2 of entries) {
|
|
105504
|
+
const release2 = entry2.release;
|
|
105505
|
+
if (!release2) continue;
|
|
105506
|
+
if (release2.outcome === "ask") waiting.set(keyOf(entry2), release2);
|
|
105507
|
+
else settled3.set(keyOf(entry2), release2);
|
|
105508
|
+
}
|
|
105509
|
+
return { settled: settled3, waiting };
|
|
105510
|
+
}
|
|
105511
|
+
function refusalOf({
|
|
105512
|
+
context,
|
|
105513
|
+
settled: settled3
|
|
105514
|
+
}) {
|
|
105515
|
+
const codes = [];
|
|
105516
|
+
for (const release2 of settled3.values()) {
|
|
105517
|
+
if (release2.outcome !== "deny") continue;
|
|
105518
|
+
context.err(`${release2.message}
|
|
105519
|
+
`);
|
|
105520
|
+
codes.push(release2.exitCode || 1);
|
|
105521
|
+
}
|
|
105522
|
+
if (codes.length === 0) return 0;
|
|
105523
|
+
return codes.includes(77) ? 77 : codes[0] ?? 1;
|
|
105524
|
+
}
|
|
105525
|
+
async function valuesOf({
|
|
105526
|
+
context,
|
|
105527
|
+
entries,
|
|
105528
|
+
settled: settled3,
|
|
105529
|
+
run: run4,
|
|
105530
|
+
keyPath
|
|
105531
|
+
}) {
|
|
105532
|
+
const refused = refusalOf({ context, settled: settled3 });
|
|
105533
|
+
if (refused !== 0) {
|
|
105534
|
+
await rm20(keyPath, { force: true });
|
|
105535
|
+
return { exitCode: refused };
|
|
105536
|
+
}
|
|
105537
|
+
const opened = /* @__PURE__ */ new Map();
|
|
105538
|
+
let keep2 = false;
|
|
105539
|
+
for (const [key, release2] of settled3) {
|
|
105540
|
+
if (release2.outcome !== "allow") continue;
|
|
105541
|
+
opened.set(key, await envOf({ release: release2, run: run4 }));
|
|
105542
|
+
if (leaseHolds({ release: release2, nowMs: context.nowMs() })) keep2 = true;
|
|
105543
|
+
if (release2.message) context.err(`${release2.message}
|
|
105544
|
+
`);
|
|
105545
|
+
}
|
|
105546
|
+
if (!keep2) await rm20(keyPath, { force: true });
|
|
105547
|
+
const released = /* @__PURE__ */ new Map();
|
|
105548
|
+
for (const entry2 of entries) {
|
|
105549
|
+
const fields = opened.get(keyOf(entry2));
|
|
105550
|
+
if (fields) released.set(entry2.ref, { fields });
|
|
105551
|
+
}
|
|
105552
|
+
return { released, entries };
|
|
105553
|
+
}
|
|
105554
|
+
|
|
105491
105555
|
// src/services/vault-env-commands.service.ts
|
|
105492
105556
|
var ENV_USAGE = `Usage: laze vault env [<file>] [--env <name>] --reason "<one plain sentence>" [--wait <s>] -- <command> [args...]
|
|
105493
105557
|
laze vault env [<file>] [--env <name>] --names
|
|
@@ -105557,7 +105621,7 @@ async function manifestOf({
|
|
|
105557
105621
|
args
|
|
105558
105622
|
}) {
|
|
105559
105623
|
const file4 = await manifestPathOf({ context, args });
|
|
105560
|
-
const text3 = await
|
|
105624
|
+
const text3 = await readFile35(file4, "utf8").catch(() => {
|
|
105561
105625
|
throw new CliUsageError(`laze vault: cannot read ${file4}`);
|
|
105562
105626
|
});
|
|
105563
105627
|
return { file: file4, lines: parseManifest({ text: text3, file: file4 }) };
|
|
@@ -105919,7 +105983,7 @@ async function vaultScrub({ context, args }) {
|
|
|
105919
105983
|
}
|
|
105920
105984
|
|
|
105921
105985
|
// src/services/whatsapp-business-commands.service.ts
|
|
105922
|
-
import { readFile as
|
|
105986
|
+
import { readFile as readFile36 } from "node:fs/promises";
|
|
105923
105987
|
import { resolve as resolve25 } from "node:path";
|
|
105924
105988
|
|
|
105925
105989
|
// ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
|
|
@@ -106416,7 +106480,7 @@ async function secretsOf3({ context, args }) {
|
|
|
106416
106480
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
106417
106481
|
if (fromConnection) return { fromConnection };
|
|
106418
106482
|
const file4 = flagText({ args, name: "from-file" });
|
|
106419
|
-
const text3 = file4 ? await
|
|
106483
|
+
const text3 = file4 ? await readFile36(resolve25(context.cwd, file4), "utf8") : await context.readStdin();
|
|
106420
106484
|
const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
106421
106485
|
if (lines2.length !== 2) {
|
|
106422
106486
|
throw new CliUsageError(
|
|
@@ -107132,6 +107196,8 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
107132
107196
|
your reply is the post or reply: once it is where it belongs, end the turn with no recap
|
|
107133
107197
|
--new-thread on reply starts a thread under a top-level message instead
|
|
107134
107198
|
--also-channel on a thread reply shows it in the channel too, as "Also send to #channel" does
|
|
107199
|
+
in a DM paired with Slack a post goes where you picked in that DM (via Laze and Slack unless
|
|
107200
|
+
you changed it); --via laze|slack|both on post or reply sends this one message elsewhere
|
|
107135
107201
|
--image <path|url|fileId> and --file <path|url|fileId> on post or reply attach files
|
|
107136
107202
|
(repeatable, at most 6), uploaded to the conversation as the web composer does
|
|
107137
107203
|
--at 2026-10-20T09:00 [--tz Europe/Amsterdam] on post or reply sends it later instead
|
|
@@ -107621,7 +107687,7 @@ import {
|
|
|
107621
107687
|
randomBytes as randomBytes6,
|
|
107622
107688
|
sign
|
|
107623
107689
|
} from "node:crypto";
|
|
107624
|
-
import { chmod, link, mkdir as mkdir13, readFile as
|
|
107690
|
+
import { chmod, link, mkdir as mkdir13, readFile as readFile37, rm as rm21, writeFile as writeFile11 } from "node:fs/promises";
|
|
107625
107691
|
import { dirname as dirname27, join as join37 } from "node:path";
|
|
107626
107692
|
var KEYCHAIN_SERVICE = "laze-cli-machine-key";
|
|
107627
107693
|
var runProgram = ({ program, args, stdin: stdin2, timeoutMs }) => new Promise((resolve27, reject) => {
|
|
@@ -107694,7 +107760,7 @@ var MachineKeyStore = class _MachineKeyStore {
|
|
|
107694
107760
|
async read() {
|
|
107695
107761
|
let meta3;
|
|
107696
107762
|
try {
|
|
107697
|
-
meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await
|
|
107763
|
+
meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await readFile37(this.metaPath, "utf8")));
|
|
107698
107764
|
} catch {
|
|
107699
107765
|
return null;
|
|
107700
107766
|
}
|
|
@@ -107709,7 +107775,7 @@ var MachineKeyStore = class _MachineKeyStore {
|
|
|
107709
107775
|
"-w"
|
|
107710
107776
|
],
|
|
107711
107777
|
timeoutMs: 1e4
|
|
107712
|
-
}) : await
|
|
107778
|
+
}) : await readFile37(this.pemPathOf(meta3.jwk), "utf8");
|
|
107713
107779
|
return keyOf2({ meta: meta3, privateKey: createPrivateKey(pemOf(pem)) });
|
|
107714
107780
|
}
|
|
107715
107781
|
async make() {
|
|
@@ -107851,7 +107917,7 @@ function machineProofFetch({
|
|
|
107851
107917
|
// src/services/processes.service.ts
|
|
107852
107918
|
import { execFile as execFile3, spawn as spawn4, spawnSync } from "node:child_process";
|
|
107853
107919
|
import { closeSync, mkdirSync, openSync, renameSync, statSync } from "node:fs";
|
|
107854
|
-
import { readFile as
|
|
107920
|
+
import { readFile as readFile38, readlink } from "node:fs/promises";
|
|
107855
107921
|
import { dirname as dirname28 } from "node:path";
|
|
107856
107922
|
import { promisify as promisify2 } from "node:util";
|
|
107857
107923
|
var run3 = promisify2(execFile3);
|
|
@@ -107865,14 +107931,14 @@ function alive(pid) {
|
|
|
107865
107931
|
}
|
|
107866
107932
|
}
|
|
107867
107933
|
async function argsOf2(pid) {
|
|
107868
|
-
const raw = await
|
|
107934
|
+
const raw = await readFile38(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
|
|
107869
107935
|
if (raw) return raw.split("\0").filter(Boolean);
|
|
107870
107936
|
const listed = await run3("ps", ["-o", "args=", "-p", String(pid)]).catch(() => void 0);
|
|
107871
107937
|
const line = listed?.stdout.trim();
|
|
107872
107938
|
return line ? line.split(/\s+/) : void 0;
|
|
107873
107939
|
}
|
|
107874
107940
|
async function parentOf(pid) {
|
|
107875
|
-
const stat13 = await
|
|
107941
|
+
const stat13 = await readFile38(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
|
|
107876
107942
|
const fromStat = stat13 ? Number(stat13.slice(stat13.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
|
|
107877
107943
|
if (fromStat > 0) return fromStat;
|
|
107878
107944
|
const listed = await run3("ps", ["-o", "ppid=", "-p", String(pid)]).catch(() => void 0);
|
|
@@ -107880,7 +107946,7 @@ async function parentOf(pid) {
|
|
|
107880
107946
|
return parent > 0 ? parent : void 0;
|
|
107881
107947
|
}
|
|
107882
107948
|
async function startOf(pid) {
|
|
107883
|
-
const stat13 = await
|
|
107949
|
+
const stat13 = await readFile38(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
|
|
107884
107950
|
const ticks = stat13 ? stat13.slice(stat13.lastIndexOf(")") + 2).split(" ")[19] : void 0;
|
|
107885
107951
|
if (ticks) return ticks;
|
|
107886
107952
|
const listed = await run3("ps", ["-o", "lstart=", "-p", String(pid)]).catch(() => void 0);
|