@lazehq/cli 0.1.143 → 0.1.144
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 +62 -3
- package/package.json +1 -1
package/dist/laze.mjs
CHANGED
|
@@ -36984,7 +36984,7 @@ function shadowedLinkLineOf({ shadow }) {
|
|
|
36984
36984
|
}
|
|
36985
36985
|
|
|
36986
36986
|
// src/rules/cli-version.rules.ts
|
|
36987
|
-
var STAMPED = "0.1.
|
|
36987
|
+
var STAMPED = "0.1.144";
|
|
36988
36988
|
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
36989
36989
|
return stamped.startsWith("__") ? "dev" : stamped;
|
|
36990
36990
|
}
|
|
@@ -86263,6 +86263,65 @@ async function handedOut({
|
|
|
86263
86263
|
);
|
|
86264
86264
|
}
|
|
86265
86265
|
|
|
86266
|
+
// src/services/vault-requester.service.ts
|
|
86267
|
+
var HARNESS_NAMES4 = { "claude-code": "Claude Code", codex: "Codex" };
|
|
86268
|
+
function usableAgents({ config: config2 }) {
|
|
86269
|
+
return Object.keys(config2.profiles).filter((name3) => {
|
|
86270
|
+
const profile = config2.profiles[name3];
|
|
86271
|
+
return profile?.kind === "agent" && !profile.migrated;
|
|
86272
|
+
});
|
|
86273
|
+
}
|
|
86274
|
+
function labelOf({ name: name3, profile }) {
|
|
86275
|
+
return `"${profile?.name ?? name3}" (profile ${name3})`;
|
|
86276
|
+
}
|
|
86277
|
+
function vaultRequesterOf({
|
|
86278
|
+
config: config2,
|
|
86279
|
+
named,
|
|
86280
|
+
namedBy,
|
|
86281
|
+
sessionAgent,
|
|
86282
|
+
harness,
|
|
86283
|
+
cwd
|
|
86284
|
+
}) {
|
|
86285
|
+
if (sessionAgent) {
|
|
86286
|
+
const other = named ? config2.profiles[named] : void 0;
|
|
86287
|
+
if (!named || named === sessionAgent || other?.kind !== "agent") return {};
|
|
86288
|
+
const session = labelOf({ name: sessionAgent, profile: config2.profiles[sessionAgent] });
|
|
86289
|
+
const asked = labelOf({ name: named, profile: other });
|
|
86290
|
+
return {
|
|
86291
|
+
profile: sessionAgent,
|
|
86292
|
+
note: `laze vault: this session is bound to the agent ${session}, so it asks as that agent, not as ${asked} from ${namedBy}.
|
|
86293
|
+
`
|
|
86294
|
+
};
|
|
86295
|
+
}
|
|
86296
|
+
if (named || harness === "other" || folderLoginOf({ config: config2, cwd })) return {};
|
|
86297
|
+
const fallback = config2.current ? config2.profiles[config2.current] : void 0;
|
|
86298
|
+
const agents2 = usableAgents({ config: config2 });
|
|
86299
|
+
if (fallback?.kind !== "agent" || agents2.length < 2) return {};
|
|
86300
|
+
const example = agents2.find((name3) => name3 !== "machine") ?? agents2[0] ?? "<profile>";
|
|
86301
|
+
throw new CliUsageError(
|
|
86302
|
+
`laze vault: Laze can't tell which agent is asking: this ${HARNESS_NAMES4[harness]} session is not bound to a Laze agent and this machine holds ${agents2.length}. Nothing was asked and the command did not run. Bind the session once with \`laze agent bind --profile <profile>\` (for example \`laze agent bind --profile ${example}\`), or pass \`--profile <profile>\` on the command.`
|
|
86303
|
+
);
|
|
86304
|
+
}
|
|
86305
|
+
async function vaultSignedIn({
|
|
86306
|
+
context,
|
|
86307
|
+
args
|
|
86308
|
+
}) {
|
|
86309
|
+
const config2 = await context.store.read();
|
|
86310
|
+
const session = await currentSessionOf({ context, args }).catch(() => void 0);
|
|
86311
|
+
const flag2 = flagText({ args, name: "profile" }) || void 0;
|
|
86312
|
+
const requester = vaultRequesterOf({
|
|
86313
|
+
config: config2,
|
|
86314
|
+
named: flag2 || context.environment.profile,
|
|
86315
|
+
namedBy: flag2 ? "--profile" : "LAZE_PROFILE",
|
|
86316
|
+
sessionAgent: await sessionAgentOf({ context, session }),
|
|
86317
|
+
harness: session ? session.harness : context.environment.harness,
|
|
86318
|
+
cwd: context.cwd
|
|
86319
|
+
});
|
|
86320
|
+
if (requester.note) context.err(requester.note);
|
|
86321
|
+
const asked = requester.profile ? { ...args, flags: { ...args.flags, profile: requester.profile } } : args;
|
|
86322
|
+
return signedIn({ context, args: asked }).catch(() => null);
|
|
86323
|
+
}
|
|
86324
|
+
|
|
86266
86325
|
// src/services/vault-commands.service.ts
|
|
86267
86326
|
var USAGE4 = `Usage: laze vault run <connection>... --reason "<one plain sentence>" [--wait <s>] [--real-value] -- <command> [args...]
|
|
86268
86327
|
Name every key the command needs in one run: they ask on one card. Runs nested in each other
|
|
@@ -86553,7 +86612,7 @@ async function keyRelease({
|
|
|
86553
86612
|
command,
|
|
86554
86613
|
deadline
|
|
86555
86614
|
}) {
|
|
86556
|
-
const signed2 = await
|
|
86615
|
+
const signed2 = await vaultSignedIn({ context, args });
|
|
86557
86616
|
if (signed2?.profile.kind !== "agent" && signed2?.profile.kind !== "person") {
|
|
86558
86617
|
throw new CliUsageError(`laze vault run ${WHERE}`);
|
|
86559
86618
|
}
|
|
@@ -106895,7 +106954,7 @@ async function doorOf({
|
|
|
106895
106954
|
})
|
|
106896
106955
|
};
|
|
106897
106956
|
}
|
|
106898
|
-
const signed2 = await
|
|
106957
|
+
const signed2 = await vaultSignedIn({ context, args });
|
|
106899
106958
|
if (signed2?.profile.kind !== "agent" && signed2?.profile.kind !== "person") {
|
|
106900
106959
|
throw new CliUsageError(`laze vault env ${WHERE}`);
|
|
106901
106960
|
}
|
package/package.json
CHANGED