@lazehq/cli 0.1.0 → 0.1.2
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/README.md +1 -1
- package/dist/laze.mjs +905 -206
- package/package.json +1 -1
package/dist/laze.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __export = (target, all) => {
|
|
4
|
-
for (var
|
|
5
|
-
__defProp(target,
|
|
4
|
+
for (var name2 in all)
|
|
5
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
// src/main.ts
|
|
@@ -18,7 +18,7 @@ var expectedFinite = (entityName, num) => `Non-finite ${entityName}: ${num}`;
|
|
|
18
18
|
var forbiddenBigIntToNumber = (entityName) => `Cannot convert bigint to ${entityName}`;
|
|
19
19
|
var invalidObject = "Invalid object";
|
|
20
20
|
var numberOutOfRange = (entityName, val, min, max) => invalidEntity(entityName, val) + `; must be between ${min}-${max}`;
|
|
21
|
-
var invalidEntity = (
|
|
21
|
+
var invalidEntity = (fieldName2, val) => `Invalid ${fieldName2}: ${val}`;
|
|
22
22
|
|
|
23
23
|
// ../../node_modules/.pnpm/temporal-utils@1.0.2/node_modules/temporal-utils/dist/utils.js
|
|
24
24
|
var nanoInMicro = 1e3;
|
|
@@ -69,10 +69,10 @@ function requireObjectLike(arg) {
|
|
|
69
69
|
|
|
70
70
|
// ../../node_modules/.pnpm/temporal-polyfill@1.0.4/node_modules/temporal-polyfill/chunks/internal.js
|
|
71
71
|
var invalidEntity2 = invalidEntity;
|
|
72
|
-
var missingField = (
|
|
72
|
+
var missingField = (fieldName2) => `Missing ${fieldName2}`;
|
|
73
73
|
var noValidFields = (validFields) => "No valid fields: " + validFields.join();
|
|
74
74
|
var invalidBag = "Invalid bag";
|
|
75
|
-
var invalidChoice = (
|
|
75
|
+
var invalidChoice = (fieldName2, val, choiceMap) => invalidEntity(fieldName2, val) + "; must be " + Object.keys(choiceMap).join();
|
|
76
76
|
var forbiddenValueOf = "Cannot use valueOf";
|
|
77
77
|
var invalidCallingContext = "Invalid calling context";
|
|
78
78
|
var missingYear = (allowEra) => "Missing year" + (allowEra ? "/era/eraYear" : "");
|
|
@@ -111,8 +111,8 @@ function memoize(generator, MapClass = Map) {
|
|
|
111
111
|
return map2.set(key, val), val;
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
|
-
var createNameDescriptors = (
|
|
115
|
-
name
|
|
114
|
+
var createNameDescriptors = (name2) => createPropDescriptors({
|
|
115
|
+
name: name2
|
|
116
116
|
}, 1);
|
|
117
117
|
var createPropDescriptors = (propVals, readonly2) => mapProps((value) => ({
|
|
118
118
|
value,
|
|
@@ -324,8 +324,8 @@ var maxValues = {
|
|
|
324
324
|
};
|
|
325
325
|
function constrainTimeFields(timeFields, overflow) {
|
|
326
326
|
const constrainedFields = {};
|
|
327
|
-
for (const
|
|
328
|
-
constrainedFields[
|
|
327
|
+
for (const fieldName2 of timeFieldNamesAsc) {
|
|
328
|
+
constrainedFields[fieldName2] = clampEntity(fieldName2, timeFields[fieldName2], 0, maxValues[fieldName2] || 999, overflow);
|
|
329
329
|
}
|
|
330
330
|
return constrainedFields;
|
|
331
331
|
}
|
|
@@ -1479,15 +1479,15 @@ function negateDuration(slots) {
|
|
|
1479
1479
|
}
|
|
1480
1480
|
function negateDurationFields(fields) {
|
|
1481
1481
|
const res = {};
|
|
1482
|
-
for (const
|
|
1483
|
-
res[
|
|
1482
|
+
for (const fieldName2 of durationFieldNamesAsc) {
|
|
1483
|
+
res[fieldName2] = -1 * fields[fieldName2] || 0;
|
|
1484
1484
|
}
|
|
1485
1485
|
return res;
|
|
1486
1486
|
}
|
|
1487
1487
|
function computeDurationSign(fields, fieldNames = durationFieldNamesAsc) {
|
|
1488
1488
|
let sign = 0;
|
|
1489
|
-
for (const
|
|
1490
|
-
const fieldSign = Math.sign(fields[
|
|
1489
|
+
for (const fieldName2 of fieldNames) {
|
|
1490
|
+
const fieldSign = Math.sign(fields[fieldName2]);
|
|
1491
1491
|
fieldSign && (sign && sign !== fieldSign && throwRangeError("Cannot mix duration signs"), sign = fieldSign);
|
|
1492
1492
|
}
|
|
1493
1493
|
return sign;
|
|
@@ -1675,14 +1675,14 @@ var zonedDateTimeFieldRefiners = {
|
|
|
1675
1675
|
function readAndRefineBagFields(bag, validFieldNames, fieldRefiners, requiredFieldNames, disallowEmpty = !requiredFieldNames) {
|
|
1676
1676
|
const res = {};
|
|
1677
1677
|
let anyMatching = 0;
|
|
1678
|
-
for (const
|
|
1679
|
-
let fieldVal = bag[
|
|
1678
|
+
for (const fieldName2 of validFieldNames) {
|
|
1679
|
+
let fieldVal = bag[fieldName2];
|
|
1680
1680
|
if (void 0 !== fieldVal) {
|
|
1681
1681
|
anyMatching = 1;
|
|
1682
|
-
const refiner = fieldRefiners[
|
|
1683
|
-
refiner && (fieldVal = refiner(fieldVal,
|
|
1682
|
+
const refiner = fieldRefiners[fieldName2];
|
|
1683
|
+
refiner && (fieldVal = refiner(fieldVal, fieldName2)), res[fieldName2] = fieldVal;
|
|
1684
1684
|
} else {
|
|
1685
|
-
requiredFieldNames && requiredFieldNames.includes(
|
|
1685
|
+
requiredFieldNames && requiredFieldNames.includes(fieldName2) && throwTypeError(missingField(fieldName2));
|
|
1686
1686
|
}
|
|
1687
1687
|
}
|
|
1688
1688
|
return disallowEmpty && !anyMatching && throwTypeError(noValidFields(validFieldNames)), res;
|
|
@@ -2392,8 +2392,8 @@ function organizeAnnotationParts(s) {
|
|
|
2392
2392
|
const calendarIds = [];
|
|
2393
2393
|
return s.replace(annotationRegExp, (whole, criticalStr, mainStr) => {
|
|
2394
2394
|
const isCritical = Boolean(criticalStr);
|
|
2395
|
-
const [val,
|
|
2396
|
-
return
|
|
2395
|
+
const [val, name2] = mainStr.split("=").reverse();
|
|
2396
|
+
return name2 ? "u-ca" === name2 ? (calendarIds.push(val.toLowerCase()), calendarIsCritical || (calendarIsCritical = isCritical)) : (isCritical || /[A-Z]/.test(name2)) && throwRangeError(invalidSubstring(whole)) : (timeZoneId && throwRangeError(invalidSubstring(whole)), timeZoneId = val), "";
|
|
2397
2397
|
}), calendarIds.length > 1 && calendarIsCritical && throwRangeError(invalidSubstring(s)), {
|
|
2398
2398
|
timeZoneId,
|
|
2399
2399
|
calendarId: calendarIds[0] || "iso8601"
|
|
@@ -2583,9 +2583,9 @@ function createOptionsTransformer(shapeFieldNames, invalidShapeFieldNames, ignor
|
|
|
2583
2583
|
const otherFields = {};
|
|
2584
2584
|
let hasInvalidGranularShapeFields = 0;
|
|
2585
2585
|
let hasInvalidStyleFields = 0;
|
|
2586
|
-
for (const
|
|
2587
|
-
const value = options[
|
|
2588
|
-
void 0 === value || ignoredFieldNameSet.has(
|
|
2586
|
+
for (const name2 of Object.keys(options)) {
|
|
2587
|
+
const value = options[name2];
|
|
2588
|
+
void 0 === value || ignoredFieldNameSet.has(name2) || (shapeFieldNameSet.has(name2) ? "dateStyle" === name2 ? dateStyle = value : "timeStyle" === name2 ? timeStyle = value : granularShapeFields[name2] = value : "era" === name2 ? modifierFields[name2] = value : invalidShapeFieldNameSet.has(name2) ? "dateStyle" === name2 || "timeStyle" === name2 ? hasInvalidStyleFields = 1 : hasInvalidGranularShapeFields = 1 : otherFields[name2] = value);
|
|
2589
2589
|
}
|
|
2590
2590
|
const hasDateStyle = void 0 !== dateStyle;
|
|
2591
2591
|
const hasTimeStyle = void 0 !== timeStyle;
|
|
@@ -3751,7 +3751,7 @@ function harnessOf({
|
|
|
3751
3751
|
}) {
|
|
3752
3752
|
if (env.CLAUDECODE === "1") return "claude-code";
|
|
3753
3753
|
const names = Object.keys(env);
|
|
3754
|
-
return names.some((
|
|
3754
|
+
return names.some((name2) => name2.startsWith("CODEX_")) ? "codex" : "other";
|
|
3755
3755
|
}
|
|
3756
3756
|
function cliEnvironment({
|
|
3757
3757
|
env = process.env
|
|
@@ -3796,27 +3796,27 @@ var ConfigStore = class _ConfigStore {
|
|
|
3796
3796
|
await rename(temporary, this.path);
|
|
3797
3797
|
}
|
|
3798
3798
|
async saveProfile({
|
|
3799
|
-
name,
|
|
3799
|
+
name: name2,
|
|
3800
3800
|
profile,
|
|
3801
3801
|
bindDirectory
|
|
3802
3802
|
}) {
|
|
3803
3803
|
const config2 = await this.read();
|
|
3804
3804
|
await this.write({
|
|
3805
|
-
current: bindDirectory ? config2.current ??
|
|
3806
|
-
profiles: { ...config2.profiles, [
|
|
3807
|
-
bindings: bindDirectory ? { ...config2.bindings, [resolve(bindDirectory)]:
|
|
3805
|
+
current: bindDirectory ? config2.current ?? name2 : name2,
|
|
3806
|
+
profiles: { ...config2.profiles, [name2]: profile },
|
|
3807
|
+
bindings: bindDirectory ? { ...config2.bindings, [resolve(bindDirectory)]: name2 } : config2.bindings
|
|
3808
3808
|
});
|
|
3809
3809
|
}
|
|
3810
|
-
async removeProfile({ name }) {
|
|
3810
|
+
async removeProfile({ name: name2 }) {
|
|
3811
3811
|
const config2 = await this.read();
|
|
3812
|
-
if (!config2.profiles[
|
|
3812
|
+
if (!config2.profiles[name2]) return false;
|
|
3813
3813
|
const profiles = Object.fromEntries(
|
|
3814
|
-
Object.entries(config2.profiles).filter(([key]) => key !==
|
|
3814
|
+
Object.entries(config2.profiles).filter(([key]) => key !== name2)
|
|
3815
3815
|
);
|
|
3816
3816
|
const bindings = Object.fromEntries(
|
|
3817
|
-
Object.entries(config2.bindings).filter(([, bound]) => bound !==
|
|
3817
|
+
Object.entries(config2.bindings).filter(([, bound]) => bound !== name2)
|
|
3818
3818
|
);
|
|
3819
|
-
const current = config2.current ===
|
|
3819
|
+
const current = config2.current === name2 ? Object.keys(profiles)[0] : config2.current;
|
|
3820
3820
|
await this.write({ current, profiles, bindings });
|
|
3821
3821
|
return true;
|
|
3822
3822
|
}
|
|
@@ -3828,9 +3828,9 @@ function chooseProfile({
|
|
|
3828
3828
|
cwd
|
|
3829
3829
|
}) {
|
|
3830
3830
|
const bound = boundProfileOf({ bindings: config2.bindings, cwd });
|
|
3831
|
-
const
|
|
3832
|
-
const profile =
|
|
3833
|
-
return
|
|
3831
|
+
const name2 = flag || environment || bound || config2.current;
|
|
3832
|
+
const profile = name2 ? config2.profiles[name2] : void 0;
|
|
3833
|
+
return name2 && profile ? { name: name2, profile } : { name: void 0, profile: void 0 };
|
|
3834
3834
|
}
|
|
3835
3835
|
function boundProfileOf({
|
|
3836
3836
|
bindings,
|
|
@@ -3863,9 +3863,9 @@ function parseArgs({ argv }) {
|
|
|
3863
3863
|
const words = [];
|
|
3864
3864
|
const flags = {};
|
|
3865
3865
|
const lists = {};
|
|
3866
|
-
const remember = (
|
|
3867
|
-
flags[
|
|
3868
|
-
lists[
|
|
3866
|
+
const remember = (name2, value) => {
|
|
3867
|
+
flags[name2] = value;
|
|
3868
|
+
lists[name2] = [...lists[name2] ?? [], value];
|
|
3869
3869
|
};
|
|
3870
3870
|
for (let index = 0; index < argv.length; index += 1) {
|
|
3871
3871
|
const arg = argv[index] ?? "";
|
|
@@ -3874,12 +3874,12 @@ function parseArgs({ argv }) {
|
|
|
3874
3874
|
words.push(arg);
|
|
3875
3875
|
continue;
|
|
3876
3876
|
}
|
|
3877
|
-
const [
|
|
3877
|
+
const [name2 = "", inline] = arg.slice(2).split(/=(.*)/s, 2);
|
|
3878
3878
|
const next = argv[index + 1];
|
|
3879
|
-
if (inline !== void 0) remember(
|
|
3880
|
-
else if (SWITCHES.has(
|
|
3879
|
+
if (inline !== void 0) remember(name2, inline);
|
|
3880
|
+
else if (SWITCHES.has(name2) || next === void 0 || next.startsWith("--")) flags[name2] = true;
|
|
3881
3881
|
else {
|
|
3882
|
-
remember(
|
|
3882
|
+
remember(name2, next);
|
|
3883
3883
|
index += 1;
|
|
3884
3884
|
}
|
|
3885
3885
|
}
|
|
@@ -3887,15 +3887,15 @@ function parseArgs({ argv }) {
|
|
|
3887
3887
|
}
|
|
3888
3888
|
function flagText({
|
|
3889
3889
|
args,
|
|
3890
|
-
name,
|
|
3890
|
+
name: name2,
|
|
3891
3891
|
fallback = ""
|
|
3892
3892
|
}) {
|
|
3893
|
-
const value = args.flags[
|
|
3893
|
+
const value = args.flags[name2];
|
|
3894
3894
|
return typeof value === "string" ? value : fallback;
|
|
3895
3895
|
}
|
|
3896
3896
|
|
|
3897
3897
|
// src/rules/cli-version.rules.ts
|
|
3898
|
-
var STAMPED = "0.1.
|
|
3898
|
+
var STAMPED = "0.1.2";
|
|
3899
3899
|
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
3900
3900
|
return stamped.startsWith("__") ? "dev" : stamped;
|
|
3901
3901
|
}
|
|
@@ -4032,6 +4032,7 @@ var CliUsageError = class extends Error {
|
|
|
4032
4032
|
};
|
|
4033
4033
|
|
|
4034
4034
|
// src/services/laze-client.service.ts
|
|
4035
|
+
var CLI_VERSION_HEADER = "x-laze-cli-version";
|
|
4035
4036
|
var LazeApiError = class extends Error {
|
|
4036
4037
|
constructor(status, code, message) {
|
|
4037
4038
|
super(message);
|
|
@@ -4069,7 +4070,10 @@ var LazeClient = class _LazeClient {
|
|
|
4069
4070
|
path,
|
|
4070
4071
|
body
|
|
4071
4072
|
}) {
|
|
4072
|
-
const headers = {
|
|
4073
|
+
const headers = {
|
|
4074
|
+
accept: "application/json",
|
|
4075
|
+
[CLI_VERSION_HEADER]: cliVersionOf()
|
|
4076
|
+
};
|
|
4073
4077
|
if (body !== void 0) headers["content-type"] = "application/json";
|
|
4074
4078
|
if (this.token) headers.authorization = `Bearer ${this.token}`;
|
|
4075
4079
|
const response = await this.fetcher(`${this.baseUrl}${path}`, {
|
|
@@ -4077,8 +4081,8 @@ var LazeClient = class _LazeClient {
|
|
|
4077
4081
|
headers,
|
|
4078
4082
|
...body !== void 0 ? { body: JSON.stringify(body) } : {}
|
|
4079
4083
|
});
|
|
4080
|
-
const
|
|
4081
|
-
const parsed =
|
|
4084
|
+
const text2 = await response.text();
|
|
4085
|
+
const parsed = text2 ? JSON.parse(text2) : void 0;
|
|
4082
4086
|
if (!response.ok) throw errorOf({ status: response.status, body: parsed });
|
|
4083
4087
|
return parsed;
|
|
4084
4088
|
}
|
|
@@ -4130,9 +4134,9 @@ async function listChannels({ context, args }) {
|
|
|
4130
4134
|
if (args.flags.json) return context.out(`${JSON.stringify(channels, null, 2)}
|
|
4131
4135
|
`);
|
|
4132
4136
|
for (const channel of channels) {
|
|
4133
|
-
const
|
|
4137
|
+
const name2 = channel.kind === "dm" || channel.kind === "group" ? "(direct)" : `#${channel.name}`;
|
|
4134
4138
|
const unread = channel.unread > 0 ? ` ${channel.unread} unread` : "";
|
|
4135
|
-
context.out(`${channel.id} ${
|
|
4139
|
+
context.out(`${channel.id} ${name2}${unread}
|
|
4136
4140
|
`);
|
|
4137
4141
|
}
|
|
4138
4142
|
}
|
|
@@ -4142,9 +4146,9 @@ async function textOf({
|
|
|
4142
4146
|
from
|
|
4143
4147
|
}) {
|
|
4144
4148
|
const words = args.words.slice(from);
|
|
4145
|
-
const
|
|
4146
|
-
if (!
|
|
4147
|
-
return
|
|
4149
|
+
const text2 = (words.join(" ") === "-" ? await context.readStdin() : words.join(" ")).trim();
|
|
4150
|
+
if (!text2) throw new CliUsageError("Say something: the message text is missing.");
|
|
4151
|
+
return text2;
|
|
4148
4152
|
}
|
|
4149
4153
|
async function post({ context, args }) {
|
|
4150
4154
|
const channel = args.words[1];
|
|
@@ -4236,14 +4240,14 @@ function harnessOf2({ context, args }) {
|
|
|
4236
4240
|
if (named === "claude-code" || named === "codex" || named === "other") return named;
|
|
4237
4241
|
return context.environment.harness;
|
|
4238
4242
|
}
|
|
4239
|
-
function slugOf(
|
|
4240
|
-
return
|
|
4243
|
+
function slugOf(name2) {
|
|
4244
|
+
return name2.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "agent";
|
|
4241
4245
|
}
|
|
4242
4246
|
async function installStopHook({ context, profile }) {
|
|
4243
4247
|
const directory = join2(context.cwd, ".claude");
|
|
4244
4248
|
const path = join2(directory, "settings.local.json");
|
|
4245
4249
|
const current = await readFile2(path, "utf8").then(
|
|
4246
|
-
(
|
|
4250
|
+
(text2) => JSON.parse(text2),
|
|
4247
4251
|
() => ({})
|
|
4248
4252
|
);
|
|
4249
4253
|
const command = stopHookCommand({ program: context.program, profile });
|
|
@@ -4283,9 +4287,9 @@ async function linkAgent({ context, args }) {
|
|
|
4283
4287
|
const harness = harnessOf2({ context, args });
|
|
4284
4288
|
const client = LazeClient.create({ baseUrl: url2, fetcher: context.fetcher });
|
|
4285
4289
|
const linked = await client.post("/api/agents/links/redeem", { token, harness });
|
|
4286
|
-
const
|
|
4290
|
+
const name2 = flagText({ args, name: "profile" }) || `agent-${slugOf(linked.agent.name)}`;
|
|
4287
4291
|
await context.store.saveProfile({
|
|
4288
|
-
name,
|
|
4292
|
+
name: name2,
|
|
4289
4293
|
bindDirectory: context.cwd,
|
|
4290
4294
|
profile: {
|
|
4291
4295
|
url: url2,
|
|
@@ -4296,13 +4300,13 @@ async function linkAgent({ context, args }) {
|
|
|
4296
4300
|
agentId: linked.agent.id
|
|
4297
4301
|
}
|
|
4298
4302
|
});
|
|
4299
|
-
const hookPath = harness === "claude-code" && !args.flags["no-hook"] ? await installStopHook({ context, profile:
|
|
4303
|
+
const hookPath = harness === "claude-code" && !args.flags["no-hook"] ? await installStopHook({ context, profile: name2 }) : void 0;
|
|
4300
4304
|
context.out(
|
|
4301
4305
|
[
|
|
4302
|
-
`Linked as ${linked.agent.name} (${linked.agent.id}), profile "${
|
|
4306
|
+
`Linked as ${linked.agent.name} (${linked.agent.id}), profile "${name2}" for ${context.cwd}.`,
|
|
4303
4307
|
...hookPath ? [`Added the Laze Stop hook to ${hookPath}.`] : [],
|
|
4304
4308
|
"",
|
|
4305
|
-
nextStepsFor({ harness, profile:
|
|
4309
|
+
nextStepsFor({ harness, profile: name2, laze: lazeCommandOf({ program: context.program }) }),
|
|
4306
4310
|
""
|
|
4307
4311
|
].join("\n")
|
|
4308
4312
|
);
|
|
@@ -4415,50 +4419,50 @@ function isFeatureName(feature) {
|
|
|
4415
4419
|
|
|
4416
4420
|
// ../../packages/module/src/module-api-token.ts
|
|
4417
4421
|
var FeatureApiIdentity = class {
|
|
4418
|
-
constructor(
|
|
4419
|
-
this.name =
|
|
4422
|
+
constructor(name2) {
|
|
4423
|
+
this.name = name2;
|
|
4420
4424
|
}
|
|
4421
4425
|
name;
|
|
4422
4426
|
};
|
|
4423
4427
|
var ModuleApiToken = class _ModuleApiToken extends FeatureApiIdentity {
|
|
4424
|
-
constructor(
|
|
4425
|
-
super(
|
|
4428
|
+
constructor(name2) {
|
|
4429
|
+
super(name2);
|
|
4426
4430
|
}
|
|
4427
|
-
static create(
|
|
4428
|
-
publicNamespaceFromUnknown(
|
|
4429
|
-
const token = new _ModuleApiToken(
|
|
4431
|
+
static create(name2) {
|
|
4432
|
+
publicNamespaceFromUnknown(name2);
|
|
4433
|
+
const token = new _ModuleApiToken(name2);
|
|
4430
4434
|
Object.freeze(token);
|
|
4431
4435
|
return token;
|
|
4432
4436
|
}
|
|
4433
4437
|
};
|
|
4434
|
-
function moduleApi(
|
|
4435
|
-
if (
|
|
4438
|
+
function moduleApi(name2) {
|
|
4439
|
+
if (name2 === void 0) {
|
|
4436
4440
|
return (id) => ModuleApiToken.create(id);
|
|
4437
4441
|
}
|
|
4438
|
-
return ModuleApiToken.create(
|
|
4442
|
+
return ModuleApiToken.create(name2);
|
|
4439
4443
|
}
|
|
4440
4444
|
|
|
4441
4445
|
// ../../packages/module/src/contract/trpc-contract.ts
|
|
4442
4446
|
function contractBuilder(namespace, members2) {
|
|
4443
|
-
const member = (
|
|
4447
|
+
const member = (name2, kind, read = {}) => ({
|
|
4444
4448
|
withInput: (input2) => {
|
|
4445
|
-
assertUndeclared(namespace,
|
|
4449
|
+
assertUndeclared(namespace, name2, members2);
|
|
4446
4450
|
const cached2 = {
|
|
4447
4451
|
...read.invalidatedBy ? { invalidatedBy: read.invalidatedBy } : {},
|
|
4448
4452
|
...read.fromProjection ? { fromProjection: read.fromProjection } : {},
|
|
4449
4453
|
...read.revision === void 0 ? {} : { revision: read.revision }
|
|
4450
4454
|
};
|
|
4451
|
-
const declared = { ...members2, [
|
|
4455
|
+
const declared = { ...members2, [name2]: { kind, input: input2, output: void 0, ...cached2 } };
|
|
4452
4456
|
return {
|
|
4453
4457
|
...contractBuilder(namespace, declared),
|
|
4454
|
-
withOutput: (output2) => contractBuilder(namespace, { ...members2, [
|
|
4458
|
+
withOutput: (output2) => contractBuilder(namespace, { ...members2, [name2]: { kind, input: input2, output: output2, ...cached2 } })
|
|
4455
4459
|
};
|
|
4456
4460
|
}
|
|
4457
4461
|
});
|
|
4458
4462
|
return {
|
|
4459
|
-
query: (
|
|
4460
|
-
mutation: (
|
|
4461
|
-
subscription: (
|
|
4463
|
+
query: (name2, options) => member(name2, "query", options),
|
|
4464
|
+
mutation: (name2) => member(name2, "mutation"),
|
|
4465
|
+
subscription: (name2) => member(name2, "subscription"),
|
|
4462
4466
|
build: () => {
|
|
4463
4467
|
assertQueriesAnswer(namespace, members2);
|
|
4464
4468
|
const built = { namespace, members: Object.freeze({ ...members2 }) };
|
|
@@ -4466,15 +4470,15 @@ function contractBuilder(namespace, members2) {
|
|
|
4466
4470
|
}
|
|
4467
4471
|
};
|
|
4468
4472
|
}
|
|
4469
|
-
function assertUndeclared(namespace,
|
|
4470
|
-
if (
|
|
4471
|
-
throw new Error(`tRPC contract "${namespace}" declares procedure "${
|
|
4473
|
+
function assertUndeclared(namespace, name2, members2) {
|
|
4474
|
+
if (name2 in members2) {
|
|
4475
|
+
throw new Error(`tRPC contract "${namespace}" declares procedure "${name2}" twice`);
|
|
4472
4476
|
}
|
|
4473
4477
|
}
|
|
4474
4478
|
function assertQueriesAnswer(namespace, members2) {
|
|
4475
|
-
for (const [
|
|
4479
|
+
for (const [name2, member] of Object.entries(members2)) {
|
|
4476
4480
|
if (member.kind === "query" && member.output === void 0) {
|
|
4477
|
-
throw new Error(`tRPC contract "${namespace}" declares query "${
|
|
4481
|
+
throw new Error(`tRPC contract "${namespace}" declares query "${name2}" without withOutput`);
|
|
4478
4482
|
}
|
|
4479
4483
|
}
|
|
4480
4484
|
}
|
|
@@ -5600,12 +5604,12 @@ function merge(a, b) {
|
|
|
5600
5604
|
});
|
|
5601
5605
|
return clone(a, def);
|
|
5602
5606
|
}
|
|
5603
|
-
function partial(Class2, schema, mask,
|
|
5607
|
+
function partial(Class2, schema, mask, name2 = "partial") {
|
|
5604
5608
|
const currDef = schema._zod.def;
|
|
5605
5609
|
const checks = currDef.checks;
|
|
5606
5610
|
const hasChecks = checks && checks.length > 0;
|
|
5607
5611
|
if (hasChecks) {
|
|
5608
|
-
throw new Error(`.${
|
|
5612
|
+
throw new Error(`.${name2}() cannot be used on object schemas containing refinements`);
|
|
5609
5613
|
}
|
|
5610
5614
|
const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
|
|
5611
5615
|
const newShape = {};
|
|
@@ -5933,7 +5937,7 @@ function newError(Definition) {
|
|
|
5933
5937
|
return new Definition();
|
|
5934
5938
|
}
|
|
5935
5939
|
// @__NO_SIDE_EFFECTS__
|
|
5936
|
-
function $constructor(
|
|
5940
|
+
function $constructor(name2, initializer3, proto, params) {
|
|
5937
5941
|
const zodProto = {};
|
|
5938
5942
|
function Internals(def) {
|
|
5939
5943
|
this.def = def;
|
|
@@ -5951,10 +5955,10 @@ function $constructor(name, initializer3, proto, params) {
|
|
|
5951
5955
|
} finally {
|
|
5952
5956
|
_zodDesc.value = void 0;
|
|
5953
5957
|
}
|
|
5954
|
-
} else if (inst._zod.traits.has(
|
|
5958
|
+
} else if (inst._zod.traits.has(name2)) {
|
|
5955
5959
|
return;
|
|
5956
5960
|
}
|
|
5957
|
-
inst._zod.traits.add(
|
|
5961
|
+
inst._zod.traits.add(name2);
|
|
5958
5962
|
initializer3(inst, def);
|
|
5959
5963
|
if (initialized) {
|
|
5960
5964
|
const own2 = Object.getPrototypeOf(inst);
|
|
@@ -5980,7 +5984,7 @@ function $constructor(name, initializer3, proto, params) {
|
|
|
5980
5984
|
const Parent = params?.Parent ?? Object;
|
|
5981
5985
|
class Definition extends Parent {
|
|
5982
5986
|
}
|
|
5983
|
-
Object.defineProperty(Definition, "name", { value:
|
|
5987
|
+
Object.defineProperty(Definition, "name", { value: name2 });
|
|
5984
5988
|
function _(def) {
|
|
5985
5989
|
const inst = params?.Parent ? newError(Definition) : this;
|
|
5986
5990
|
init(inst, def);
|
|
@@ -6001,10 +6005,10 @@ function $constructor(name, initializer3, proto, params) {
|
|
|
6001
6005
|
value: (inst) => {
|
|
6002
6006
|
if (params?.Parent && inst instanceof params.Parent)
|
|
6003
6007
|
return true;
|
|
6004
|
-
return inst?._zod?.traits?.has(
|
|
6008
|
+
return inst?._zod?.traits?.has(name2);
|
|
6005
6009
|
}
|
|
6006
6010
|
});
|
|
6007
|
-
Object.defineProperty(_, "name", { value:
|
|
6011
|
+
Object.defineProperty(_, "name", { value: name2 });
|
|
6008
6012
|
return _;
|
|
6009
6013
|
}
|
|
6010
6014
|
var $brand = /* @__PURE__ */ Symbol("zod_brand");
|
|
@@ -6014,8 +6018,8 @@ var $ZodAsyncError = class extends Error {
|
|
|
6014
6018
|
}
|
|
6015
6019
|
};
|
|
6016
6020
|
var $ZodEncodeError = class extends Error {
|
|
6017
|
-
constructor(
|
|
6018
|
-
super(`Encountered unidirectional transform during encode: ${
|
|
6021
|
+
constructor(name2) {
|
|
6022
|
+
super(`Encountered unidirectional transform during encode: ${name2}`);
|
|
6019
6023
|
this.name = "ZodEncodeError";
|
|
6020
6024
|
}
|
|
6021
6025
|
};
|
|
@@ -13791,8 +13795,8 @@ function ko_default() {
|
|
|
13791
13795
|
}
|
|
13792
13796
|
|
|
13793
13797
|
// ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/lt.js
|
|
13794
|
-
var capitalizeFirstCharacter = (
|
|
13795
|
-
return
|
|
13798
|
+
var capitalizeFirstCharacter = (text2) => {
|
|
13799
|
+
return text2.charAt(0).toUpperCase() + text2.slice(1);
|
|
13796
13800
|
};
|
|
13797
13801
|
function getUnitTypeFromNumber(number4) {
|
|
13798
13802
|
const abs = Math.abs(number4);
|
|
@@ -17514,13 +17518,13 @@ ${code}
|
|
|
17514
17518
|
return fn;
|
|
17515
17519
|
}
|
|
17516
17520
|
function addConstant(ctx, value) {
|
|
17517
|
-
for (const [
|
|
17521
|
+
for (const [name3, v] of ctx.constants) {
|
|
17518
17522
|
if (v === value)
|
|
17519
|
-
return
|
|
17523
|
+
return name3;
|
|
17520
17524
|
}
|
|
17521
|
-
const
|
|
17522
|
-
ctx.constants.set(
|
|
17523
|
-
return
|
|
17525
|
+
const name2 = `c${ctx.constantCounter++}`;
|
|
17526
|
+
ctx.constants.set(name2, value);
|
|
17527
|
+
return name2;
|
|
17524
17528
|
}
|
|
17525
17529
|
function addUserConstant(ctx, fn) {
|
|
17526
17530
|
ctx.definite = false;
|
|
@@ -24152,10 +24156,10 @@ function date4(params) {
|
|
|
24152
24156
|
|
|
24153
24157
|
// ../../packages/module/src/contract/ui-tokens.ts
|
|
24154
24158
|
var UiTokenIdentity = class {
|
|
24155
|
-
constructor(kind, owner,
|
|
24159
|
+
constructor(kind, owner, name2) {
|
|
24156
24160
|
this.kind = kind;
|
|
24157
24161
|
this.owner = owner;
|
|
24158
|
-
this.name =
|
|
24162
|
+
this.name = name2;
|
|
24159
24163
|
}
|
|
24160
24164
|
kind;
|
|
24161
24165
|
owner;
|
|
@@ -24166,22 +24170,22 @@ var UiTokenIdentity = class {
|
|
|
24166
24170
|
}
|
|
24167
24171
|
};
|
|
24168
24172
|
var UiToken = class _UiToken extends UiTokenIdentity {
|
|
24169
|
-
constructor(kind, owner,
|
|
24170
|
-
super(kind, owner,
|
|
24173
|
+
constructor(kind, owner, name2) {
|
|
24174
|
+
super(kind, owner, name2);
|
|
24171
24175
|
}
|
|
24172
|
-
static create(kind, owner,
|
|
24173
|
-
const token = new _UiToken(kind, owner,
|
|
24176
|
+
static create(kind, owner, name2) {
|
|
24177
|
+
const token = new _UiToken(kind, owner, name2);
|
|
24174
24178
|
Object.freeze(token);
|
|
24175
24179
|
return token;
|
|
24176
24180
|
}
|
|
24177
24181
|
};
|
|
24178
24182
|
function uiTokens(owner) {
|
|
24179
24183
|
return {
|
|
24180
|
-
component: (
|
|
24181
|
-
extension: (
|
|
24182
|
-
operations: (
|
|
24183
|
-
hooks: (
|
|
24184
|
-
drawer: (
|
|
24184
|
+
component: (name2) => UiToken.create("component", owner, name2),
|
|
24185
|
+
extension: (name2) => UiToken.create("extension", owner, name2),
|
|
24186
|
+
operations: (name2) => UiToken.create("operations", owner, name2),
|
|
24187
|
+
hooks: (name2) => UiToken.create("hooks", owner, name2),
|
|
24188
|
+
drawer: (name2) => UiToken.create("drawer", owner, name2)
|
|
24185
24189
|
};
|
|
24186
24190
|
}
|
|
24187
24191
|
|
|
@@ -25110,7 +25114,7 @@ function wrapSpanContext(spanContext) {
|
|
|
25110
25114
|
var contextApi = ContextAPI.getInstance();
|
|
25111
25115
|
var NoopTracer = class {
|
|
25112
25116
|
// startSpan starts a noop span.
|
|
25113
|
-
startSpan(
|
|
25117
|
+
startSpan(name2, options, context = contextApi.active()) {
|
|
25114
25118
|
const root = Boolean(options === null || options === void 0 ? void 0 : options.root);
|
|
25115
25119
|
if (root) {
|
|
25116
25120
|
return new NonRecordingSpan();
|
|
@@ -25122,7 +25126,7 @@ var NoopTracer = class {
|
|
|
25122
25126
|
return new NonRecordingSpan();
|
|
25123
25127
|
}
|
|
25124
25128
|
}
|
|
25125
|
-
startActiveSpan(
|
|
25129
|
+
startActiveSpan(name2, arg2, arg3, arg4) {
|
|
25126
25130
|
let opts;
|
|
25127
25131
|
let ctx;
|
|
25128
25132
|
let fn;
|
|
@@ -25139,7 +25143,7 @@ var NoopTracer = class {
|
|
|
25139
25143
|
fn = arg4;
|
|
25140
25144
|
}
|
|
25141
25145
|
const parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active();
|
|
25142
|
-
const span = this.startSpan(
|
|
25146
|
+
const span = this.startSpan(name2, opts, parentContext);
|
|
25143
25147
|
const contextWithSpanSet = setSpan(parentContext, span);
|
|
25144
25148
|
return contextApi.with(contextWithSpanSet, fn, void 0, span);
|
|
25145
25149
|
}
|
|
@@ -25151,14 +25155,14 @@ function isSpanContext(spanContext) {
|
|
|
25151
25155
|
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js
|
|
25152
25156
|
var NOOP_TRACER = new NoopTracer();
|
|
25153
25157
|
var ProxyTracer = class {
|
|
25154
|
-
constructor(provider,
|
|
25158
|
+
constructor(provider, name2, version2, options) {
|
|
25155
25159
|
this._provider = provider;
|
|
25156
|
-
this.name =
|
|
25160
|
+
this.name = name2;
|
|
25157
25161
|
this.version = version2;
|
|
25158
25162
|
this.options = options;
|
|
25159
25163
|
}
|
|
25160
|
-
startSpan(
|
|
25161
|
-
return this._getTracer().startSpan(
|
|
25164
|
+
startSpan(name2, options, context) {
|
|
25165
|
+
return this._getTracer().startSpan(name2, options, context);
|
|
25162
25166
|
}
|
|
25163
25167
|
startActiveSpan(_name, _options, _context, _fn) {
|
|
25164
25168
|
const tracer = this._getTracer();
|
|
@@ -25194,9 +25198,9 @@ var ProxyTracerProvider = class {
|
|
|
25194
25198
|
/**
|
|
25195
25199
|
* Get a {@link ProxyTracer}
|
|
25196
25200
|
*/
|
|
25197
|
-
getTracer(
|
|
25201
|
+
getTracer(name2, version2, options) {
|
|
25198
25202
|
var _a3;
|
|
25199
|
-
return (_a3 = this.getDelegateTracer(
|
|
25203
|
+
return (_a3 = this.getDelegateTracer(name2, version2, options)) !== null && _a3 !== void 0 ? _a3 : new ProxyTracer(this, name2, version2, options);
|
|
25200
25204
|
}
|
|
25201
25205
|
getDelegate() {
|
|
25202
25206
|
var _a3;
|
|
@@ -25208,9 +25212,9 @@ var ProxyTracerProvider = class {
|
|
|
25208
25212
|
setDelegate(delegate) {
|
|
25209
25213
|
this._delegate = delegate;
|
|
25210
25214
|
}
|
|
25211
|
-
getDelegateTracer(
|
|
25215
|
+
getDelegateTracer(name2, version2, options) {
|
|
25212
25216
|
var _a3;
|
|
25213
|
-
return (_a3 = this._delegate) === null || _a3 === void 0 ? void 0 : _a3.getTracer(
|
|
25217
|
+
return (_a3 = this._delegate) === null || _a3 === void 0 ? void 0 : _a3.getTracer(name2, version2, options);
|
|
25214
25218
|
}
|
|
25215
25219
|
};
|
|
25216
25220
|
|
|
@@ -25257,8 +25261,8 @@ var TraceAPI = class _TraceAPI {
|
|
|
25257
25261
|
/**
|
|
25258
25262
|
* Returns a tracer from the global tracer provider.
|
|
25259
25263
|
*/
|
|
25260
|
-
getTracer(
|
|
25261
|
-
return this.getTracerProvider().getTracer(
|
|
25264
|
+
getTracer(name2, version2) {
|
|
25265
|
+
return this.getTracerProvider().getTracer(name2, version2);
|
|
25262
25266
|
}
|
|
25263
25267
|
/** Remove the global tracer provider */
|
|
25264
25268
|
disable() {
|
|
@@ -26641,9 +26645,9 @@ function isSkippedPath({ path }) {
|
|
|
26641
26645
|
return path.split("/").some((segment) => segment.startsWith(".") || segment === "node_modules");
|
|
26642
26646
|
}
|
|
26643
26647
|
function buildFileOf({ path, bytes }) {
|
|
26644
|
-
const
|
|
26645
|
-
const isText = !
|
|
26646
|
-
return isText ? { path, content:
|
|
26648
|
+
const text2 = bytes.toString("utf8");
|
|
26649
|
+
const isText = !text2.includes("\0") && Buffer.from(text2, "utf8").equals(bytes);
|
|
26650
|
+
return isText ? { path, content: text2, encoding: "utf8", bytes: bytes.length } : { path, content: bytes.toString("base64"), encoding: "base64", bytes: bytes.length };
|
|
26647
26651
|
}
|
|
26648
26652
|
function versionLine({ version: version2 }) {
|
|
26649
26653
|
const at = version2.createdAt.slice(0, 16).replace("T", " ");
|
|
@@ -27209,10 +27213,10 @@ var STARTER_TEMPLATES = {
|
|
|
27209
27213
|
};
|
|
27210
27214
|
function templateFiles({
|
|
27211
27215
|
template,
|
|
27212
|
-
name
|
|
27216
|
+
name: name2
|
|
27213
27217
|
}) {
|
|
27214
27218
|
return {
|
|
27215
|
-
"index.html": indexHtml({ title:
|
|
27219
|
+
"index.html": indexHtml({ title: name2.replaceAll("&", "&").replaceAll("<", "<") }),
|
|
27216
27220
|
"app.js": template.appJs,
|
|
27217
27221
|
"laze.js": LAZE_CLIENT_JS,
|
|
27218
27222
|
"laze-kit.css": LAZE_KIT_CSS
|
|
@@ -27235,9 +27239,9 @@ function folderOf({ context, word }) {
|
|
|
27235
27239
|
return resolve2(context.cwd, word ?? ".");
|
|
27236
27240
|
}
|
|
27237
27241
|
async function readManifest(folder) {
|
|
27238
|
-
const
|
|
27239
|
-
if (
|
|
27240
|
-
const parsed = appManifestSchema.safeParse(JSON.parse(
|
|
27242
|
+
const text2 = await readFile3(join3(folder, APP_MANIFEST_FILE), "utf8").catch(() => void 0);
|
|
27243
|
+
if (text2 === void 0) return void 0;
|
|
27244
|
+
const parsed = appManifestSchema.safeParse(JSON.parse(text2));
|
|
27241
27245
|
if (!parsed.success) {
|
|
27242
27246
|
throw new CliUsageError(`${APP_MANIFEST_FILE} is not valid: ${parsed.error.message}`);
|
|
27243
27247
|
}
|
|
@@ -27266,15 +27270,15 @@ async function appIdOf({
|
|
|
27266
27270
|
async function jsonFlag({
|
|
27267
27271
|
context,
|
|
27268
27272
|
args,
|
|
27269
|
-
name
|
|
27273
|
+
name: name2
|
|
27270
27274
|
}) {
|
|
27271
|
-
const raw = flagText({ args, name });
|
|
27275
|
+
const raw = flagText({ args, name: name2 });
|
|
27272
27276
|
if (!raw) return void 0;
|
|
27273
|
-
const
|
|
27277
|
+
const text2 = raw.startsWith("@") ? await readFile3(resolve2(context.cwd, raw.slice(1)), "utf8") : raw;
|
|
27274
27278
|
try {
|
|
27275
|
-
return JSON.parse(
|
|
27279
|
+
return JSON.parse(text2);
|
|
27276
27280
|
} catch {
|
|
27277
|
-
throw new CliUsageError(`--${
|
|
27281
|
+
throw new CliUsageError(`--${name2} must be JSON (or @file holding JSON)`);
|
|
27278
27282
|
}
|
|
27279
27283
|
}
|
|
27280
27284
|
async function listFiles(folder) {
|
|
@@ -27298,14 +27302,14 @@ function print({
|
|
|
27298
27302
|
context,
|
|
27299
27303
|
args,
|
|
27300
27304
|
value,
|
|
27301
|
-
text
|
|
27305
|
+
text: text2
|
|
27302
27306
|
}) {
|
|
27303
27307
|
context.out(args.flags.json ? `${JSON.stringify(value, null, 2)}
|
|
27304
|
-
` :
|
|
27308
|
+
` : text2);
|
|
27305
27309
|
}
|
|
27306
27310
|
var appCreate = async ({ context, args }) => {
|
|
27307
|
-
const
|
|
27308
|
-
if (!
|
|
27311
|
+
const name2 = args.words.slice(2).join(" ").trim();
|
|
27312
|
+
if (!name2) throw new CliUsageError(USAGE);
|
|
27309
27313
|
const templateName = flagText({ args, name: "template" });
|
|
27310
27314
|
if (templateName && !APP_TEMPLATES.includes(templateName)) {
|
|
27311
27315
|
throw new CliUsageError(
|
|
@@ -27318,14 +27322,14 @@ var appCreate = async ({ context, args }) => {
|
|
|
27318
27322
|
const slug = flagText({ args, name: "slug" });
|
|
27319
27323
|
const visibility = flagText({ args, name: "visibility" });
|
|
27320
27324
|
const app2 = await client.post("/api/apps/create", {
|
|
27321
|
-
name,
|
|
27325
|
+
name: name2,
|
|
27322
27326
|
...slug ? { slug } : {},
|
|
27323
27327
|
...channel ? { channel } : {},
|
|
27324
27328
|
...visibility ? { visibility } : {}
|
|
27325
27329
|
});
|
|
27326
27330
|
const folder = resolve2(context.cwd, flagText({ args, name: "dir", fallback: app2.slug }));
|
|
27327
27331
|
await mkdir3(folder, { recursive: true });
|
|
27328
|
-
const files = template ? templateFiles({ template, name }) : {};
|
|
27332
|
+
const files = template ? templateFiles({ template, name: name2 }) : {};
|
|
27329
27333
|
for (const [path, content] of Object.entries(files)) {
|
|
27330
27334
|
await writeFile3(join3(folder, path), content);
|
|
27331
27335
|
}
|
|
@@ -27380,11 +27384,11 @@ var appPush = async ({ context, args }) => {
|
|
|
27380
27384
|
if (files.length === 0) throw new CliUsageError(`No files to push in ${folder}`);
|
|
27381
27385
|
const { client } = await signedIn({ context, args });
|
|
27382
27386
|
const appId = await appIdOf({ client, args, folder });
|
|
27383
|
-
for (const [
|
|
27387
|
+
for (const [name2, collection] of Object.entries(manifest?.collections ?? {})) {
|
|
27384
27388
|
await client.post("/api/apps/collections/define", {
|
|
27385
27389
|
appId,
|
|
27386
27390
|
site: "draft",
|
|
27387
|
-
name,
|
|
27391
|
+
name: name2,
|
|
27388
27392
|
fields: collection.fields
|
|
27389
27393
|
});
|
|
27390
27394
|
}
|
|
@@ -27498,13 +27502,13 @@ var appCollections = async ({ context, args }) => {
|
|
|
27498
27502
|
const { client } = await signedIn({ context, args });
|
|
27499
27503
|
const appId = await appIdOf({ client, args, folder: folderOf({ context, word: void 0 }) });
|
|
27500
27504
|
if (args.words[2] === "define") {
|
|
27501
|
-
const
|
|
27505
|
+
const name2 = args.words[3];
|
|
27502
27506
|
const fields = await jsonFlag({ context, args, name: "fields" });
|
|
27503
|
-
if (!
|
|
27507
|
+
if (!name2 || !Array.isArray(fields)) throw new CliUsageError(USAGE);
|
|
27504
27508
|
const collection = await client.post("/api/apps/collections/define", {
|
|
27505
27509
|
appId,
|
|
27506
27510
|
site: siteOf(args, "draft"),
|
|
27507
|
-
name,
|
|
27511
|
+
name: name2,
|
|
27508
27512
|
fields
|
|
27509
27513
|
});
|
|
27510
27514
|
return print({
|
|
@@ -27616,12 +27620,12 @@ var APP_COMMANDS = {
|
|
|
27616
27620
|
export: appExport
|
|
27617
27621
|
};
|
|
27618
27622
|
async function app({ context, args }) {
|
|
27619
|
-
const
|
|
27620
|
-
const command = Object.hasOwn(APP_COMMANDS,
|
|
27623
|
+
const name2 = args.words[1] ?? "";
|
|
27624
|
+
const command = Object.hasOwn(APP_COMMANDS, name2) ? APP_COMMANDS[name2] : void 0;
|
|
27621
27625
|
if (!command) {
|
|
27622
27626
|
context.out(`${USAGE}
|
|
27623
27627
|
`);
|
|
27624
|
-
if (
|
|
27628
|
+
if (name2) throw new CliUsageError(`laze app has no command ${name2}`);
|
|
27625
27629
|
return;
|
|
27626
27630
|
}
|
|
27627
27631
|
await command({ context, args });
|
|
@@ -27646,12 +27650,12 @@ async function profileOf({
|
|
|
27646
27650
|
}
|
|
27647
27651
|
async function login({ context, args }) {
|
|
27648
27652
|
const url2 = serverUrlOf({ context, args });
|
|
27649
|
-
const
|
|
27653
|
+
const name2 = flagText({ args, name: "profile", fallback: "default" });
|
|
27650
27654
|
const given = flagText({ args, name: "token" });
|
|
27651
27655
|
const token = given || await deviceToken({ context, url: url2, args });
|
|
27652
27656
|
const profile = await profileOf({ context, url: url2, token });
|
|
27653
|
-
await context.store.saveProfile({ name, profile });
|
|
27654
|
-
context.out(`Signed in to ${url2} as ${profile.name} (profile "${
|
|
27657
|
+
await context.store.saveProfile({ name: name2, profile });
|
|
27658
|
+
context.out(`Signed in to ${url2} as ${profile.name} (profile "${name2}").
|
|
27655
27659
|
`);
|
|
27656
27660
|
}
|
|
27657
27661
|
async function deviceToken({
|
|
@@ -27682,18 +27686,18 @@ async function deviceToken({
|
|
|
27682
27686
|
throw new CliUsageError("The sign-in code expired: run `laze login` again.");
|
|
27683
27687
|
}
|
|
27684
27688
|
async function logout({ context, args }) {
|
|
27685
|
-
const { name } = await signedIn({ context, args });
|
|
27686
|
-
await context.store.removeProfile({ name });
|
|
27687
|
-
context.out(`Signed out of profile "${
|
|
27689
|
+
const { name: name2 } = await signedIn({ context, args });
|
|
27690
|
+
await context.store.removeProfile({ name: name2 });
|
|
27691
|
+
context.out(`Signed out of profile "${name2}". Its key stays valid until revoked in Laze.
|
|
27688
27692
|
`);
|
|
27689
27693
|
}
|
|
27690
27694
|
async function whoami({ context, args }) {
|
|
27691
|
-
const { client, name, profile } = await signedIn({ context, args });
|
|
27695
|
+
const { client, name: name2, profile } = await signedIn({ context, args });
|
|
27692
27696
|
const me = await client.get("/api/agents/me");
|
|
27693
27697
|
if (args.flags.json) return context.out(`${JSON.stringify(me, null, 2)}
|
|
27694
27698
|
`);
|
|
27695
27699
|
const who = me.kind === "agent" ? `agent ${me.name} (${me.id})` : `${me.name} (${me.id})`;
|
|
27696
|
-
context.out(`${who} in workspace ${me.workspaceId} at ${profile.url}, profile "${
|
|
27700
|
+
context.out(`${who} in workspace ${me.workspaceId} at ${profile.url}, profile "${name2}"
|
|
27697
27701
|
`);
|
|
27698
27702
|
}
|
|
27699
27703
|
async function workspaces({ context, args }) {
|
|
@@ -27701,10 +27705,10 @@ async function workspaces({ context, args }) {
|
|
|
27701
27705
|
const entries = Object.entries(config2.profiles);
|
|
27702
27706
|
if (entries.length === 0) return context.out("Not signed in: run `laze login` first.\n");
|
|
27703
27707
|
const active = await signedIn({ context, args }).catch(() => void 0);
|
|
27704
|
-
for (const [
|
|
27705
|
-
const star = active?.name ===
|
|
27708
|
+
for (const [name2, profile] of entries) {
|
|
27709
|
+
const star = active?.name === name2 ? "*" : " ";
|
|
27706
27710
|
context.out(
|
|
27707
|
-
`${star} ${
|
|
27711
|
+
`${star} ${name2} ${profile.workspaceId} ${profile.kind} ${profile.name} ${profile.url}
|
|
27708
27712
|
`
|
|
27709
27713
|
);
|
|
27710
27714
|
}
|
|
@@ -27761,7 +27765,7 @@ var CodexAppServer = class _CodexAppServer {
|
|
|
27761
27765
|
this.write({ method });
|
|
27762
27766
|
}
|
|
27763
27767
|
/** Runs one turn and waits for it to complete, keeping its last agent message. */
|
|
27764
|
-
async turn({ threadId, text }) {
|
|
27768
|
+
async turn({ threadId, text: text2 }) {
|
|
27765
27769
|
const result = { answer: "" };
|
|
27766
27770
|
const done = new Promise((resolve6) => {
|
|
27767
27771
|
const listen = (message) => {
|
|
@@ -27774,7 +27778,7 @@ var CodexAppServer = class _CodexAppServer {
|
|
|
27774
27778
|
});
|
|
27775
27779
|
await this.call("turn/start", {
|
|
27776
27780
|
threadId,
|
|
27777
|
-
input: [{ type: "text", text, text_elements: [] }]
|
|
27781
|
+
input: [{ type: "text", text: text2, text_elements: [] }]
|
|
27778
27782
|
});
|
|
27779
27783
|
await done;
|
|
27780
27784
|
return result;
|
|
@@ -28013,12 +28017,12 @@ async function feedUpdate({ context, args }) {
|
|
|
28013
28017
|
}
|
|
28014
28018
|
async function feedReply({ context, args }) {
|
|
28015
28019
|
const itemId = args.words[2];
|
|
28016
|
-
const
|
|
28017
|
-
if (!itemId || !
|
|
28020
|
+
const text2 = args.words.slice(3).join(" ").trim();
|
|
28021
|
+
if (!itemId || !text2) throw new CliUsageError(USAGE2);
|
|
28018
28022
|
const { client } = await signedIn({ context, args });
|
|
28019
28023
|
const replied = await client.post("/api/feed/items/reply", {
|
|
28020
28024
|
itemId,
|
|
28021
|
-
body:
|
|
28025
|
+
body: text2,
|
|
28022
28026
|
urgent: Boolean(args.flags.urgent)
|
|
28023
28027
|
});
|
|
28024
28028
|
printItem({ context, args, item: replied });
|
|
@@ -28048,8 +28052,8 @@ var FEED_COMMANDS = {
|
|
|
28048
28052
|
inbox: feedInbox
|
|
28049
28053
|
};
|
|
28050
28054
|
async function feed({ context, args }) {
|
|
28051
|
-
const
|
|
28052
|
-
const command = Object.hasOwn(FEED_COMMANDS,
|
|
28055
|
+
const name2 = args.words[1] ?? "";
|
|
28056
|
+
const command = Object.hasOwn(FEED_COMMANDS, name2) ? FEED_COMMANDS[name2] : void 0;
|
|
28053
28057
|
if (!command) throw new CliUsageError(USAGE2);
|
|
28054
28058
|
await command({ context, args });
|
|
28055
28059
|
}
|
|
@@ -28113,6 +28117,12 @@ async function signedGhArgs({
|
|
|
28113
28117
|
}
|
|
28114
28118
|
return out;
|
|
28115
28119
|
}
|
|
28120
|
+
var LOCAL_COMMANDS = /* @__PURE__ */ new Set(["--version", "version", "help", "--help", "-h", "completion"]);
|
|
28121
|
+
function isLocalGhCall(args) {
|
|
28122
|
+
const [first] = args;
|
|
28123
|
+
if (first === void 0 || LOCAL_COMMANDS.has(first)) return true;
|
|
28124
|
+
return args.includes("--help");
|
|
28125
|
+
}
|
|
28116
28126
|
|
|
28117
28127
|
// src/services/github-commands.service.ts
|
|
28118
28128
|
var REAL_GH = "/usr/bin/gh";
|
|
@@ -28121,7 +28131,7 @@ async function credentialOf({ env }) {
|
|
|
28121
28131
|
const placeholder = (env.GH_TOKEN ?? "").split(TURN_SEPARATOR)[0] ?? "";
|
|
28122
28132
|
if (!placeholder.startsWith("laze-ph-")) throw new CliUsageError(NOT_SET);
|
|
28123
28133
|
const turn = env.LAZE_TURN_FILE ? await readFile5(env.LAZE_TURN_FILE, "utf8").then(
|
|
28124
|
-
(
|
|
28134
|
+
(text2) => text2.trim(),
|
|
28125
28135
|
() => ""
|
|
28126
28136
|
) : "";
|
|
28127
28137
|
return turn ? `${placeholder}${TURN_SEPARATOR}${turn}` : placeholder;
|
|
@@ -28137,6 +28147,12 @@ async function githubGh({
|
|
|
28137
28147
|
args
|
|
28138
28148
|
}) {
|
|
28139
28149
|
const env = context.environment.inherited;
|
|
28150
|
+
if (isLocalGhCall(args.rest)) {
|
|
28151
|
+
return context.runCommand({
|
|
28152
|
+
command: [REAL_GH, ...args.rest],
|
|
28153
|
+
env: { GH_PROMPT_DISABLED: "1", GH_NO_UPDATE_NOTIFIER: "1" }
|
|
28154
|
+
});
|
|
28155
|
+
}
|
|
28140
28156
|
const credential = await credentialOf({ env });
|
|
28141
28157
|
const { profile } = await signedIn({ context, args: { ...args, flags: {} } });
|
|
28142
28158
|
const ghArgs = await signedGhArgs({
|
|
@@ -28266,7 +28282,7 @@ async function relayMcpLines({
|
|
|
28266
28282
|
for await (const line of lines) {
|
|
28267
28283
|
if (!line.trim()) continue;
|
|
28268
28284
|
const turn = await readFile6(turnFile, "utf8").then(
|
|
28269
|
-
(
|
|
28285
|
+
(text3) => text3.trim(),
|
|
28270
28286
|
() => ""
|
|
28271
28287
|
);
|
|
28272
28288
|
const response = await context.fetcher(url2, {
|
|
@@ -28279,8 +28295,8 @@ async function relayMcpLines({
|
|
|
28279
28295
|
},
|
|
28280
28296
|
body: line
|
|
28281
28297
|
});
|
|
28282
|
-
const
|
|
28283
|
-
if (
|
|
28298
|
+
const text2 = await response.text();
|
|
28299
|
+
if (text2.trim()) context.out(`${text2.trim()}
|
|
28284
28300
|
`);
|
|
28285
28301
|
}
|
|
28286
28302
|
}
|
|
@@ -28331,10 +28347,10 @@ function textOf2(value) {
|
|
|
28331
28347
|
async function callTool({
|
|
28332
28348
|
context,
|
|
28333
28349
|
client,
|
|
28334
|
-
name,
|
|
28350
|
+
name: name2,
|
|
28335
28351
|
input: input2
|
|
28336
28352
|
}) {
|
|
28337
|
-
switch (
|
|
28353
|
+
switch (name2) {
|
|
28338
28354
|
case "whoami":
|
|
28339
28355
|
return JSON.stringify(await client.get("/api/agents/me"));
|
|
28340
28356
|
case "list_channels":
|
|
@@ -28364,7 +28380,7 @@ async function callTool({
|
|
|
28364
28380
|
return `Replied ${posted.messageId}.`;
|
|
28365
28381
|
}
|
|
28366
28382
|
default:
|
|
28367
|
-
throw new Error(`Unknown tool ${
|
|
28383
|
+
throw new Error(`Unknown tool ${name2}`);
|
|
28368
28384
|
}
|
|
28369
28385
|
}
|
|
28370
28386
|
async function answer2({
|
|
@@ -28383,13 +28399,13 @@ async function answer2({
|
|
|
28383
28399
|
if (request.method === "tools/list") return { tools: TOOLS };
|
|
28384
28400
|
if (request.method === "tools/call") {
|
|
28385
28401
|
try {
|
|
28386
|
-
const
|
|
28402
|
+
const text2 = await callTool({
|
|
28387
28403
|
context,
|
|
28388
28404
|
client,
|
|
28389
28405
|
name: textOf2(params.name),
|
|
28390
28406
|
input: params.arguments ?? {}
|
|
28391
28407
|
});
|
|
28392
|
-
return { content: [{ type: "text", text }] };
|
|
28408
|
+
return { content: [{ type: "text", text: text2 }] };
|
|
28393
28409
|
} catch (error62) {
|
|
28394
28410
|
return { content: [{ type: "text", text: String(error62) }], isError: true };
|
|
28395
28411
|
}
|
|
@@ -28500,9 +28516,9 @@ async function memoryAppend({ context, args }) {
|
|
|
28500
28516
|
const ref = fileRef({ context, args });
|
|
28501
28517
|
const value = args.words.slice(3).join(" ");
|
|
28502
28518
|
if (!value) throw new CliUsageError(USAGE3);
|
|
28503
|
-
const
|
|
28519
|
+
const text2 = await textArgument({ context, value });
|
|
28504
28520
|
const { client } = await signedIn({ context, args });
|
|
28505
|
-
const saved = await client.post("/api/memory/append", { ...ref, text });
|
|
28521
|
+
const saved = await client.post("/api/memory/append", { ...ref, text: text2 });
|
|
28506
28522
|
if (args.flags.json) return printDocument({ context, args, document: saved });
|
|
28507
28523
|
context.out(`Saved ${saved.file} version ${saved.version}
|
|
28508
28524
|
`);
|
|
@@ -28540,8 +28556,8 @@ var MEMORY_COMMANDS = {
|
|
|
28540
28556
|
pull: memoryPull
|
|
28541
28557
|
};
|
|
28542
28558
|
async function memory({ context, args }) {
|
|
28543
|
-
const
|
|
28544
|
-
const command = Object.hasOwn(MEMORY_COMMANDS,
|
|
28559
|
+
const name2 = args.words[1] ?? "";
|
|
28560
|
+
const command = Object.hasOwn(MEMORY_COMMANDS, name2) ? MEMORY_COMMANDS[name2] : void 0;
|
|
28545
28561
|
if (!command) throw new CliUsageError(USAGE3);
|
|
28546
28562
|
await command({ context, args });
|
|
28547
28563
|
}
|
|
@@ -28572,15 +28588,15 @@ function printSchedule({ context, schedule: schedule2 }) {
|
|
|
28572
28588
|
);
|
|
28573
28589
|
}
|
|
28574
28590
|
async function scheduleAdd({ context, args }) {
|
|
28575
|
-
const
|
|
28591
|
+
const name2 = args.words.slice(2).join(" ").trim();
|
|
28576
28592
|
const prompt = flagText({ args, name: "prompt" });
|
|
28577
|
-
if (!
|
|
28593
|
+
if (!name2 || !prompt) throw new CliUsageError(USAGE4);
|
|
28578
28594
|
const timing = timingOf(args);
|
|
28579
28595
|
const { client } = await signedIn({ context, args });
|
|
28580
28596
|
const channelId = flagText({ args, name: "channel" });
|
|
28581
28597
|
const agentId = flagText({ args, name: "agent" });
|
|
28582
28598
|
const schedule2 = await client.post("/api/schedules", {
|
|
28583
|
-
name,
|
|
28599
|
+
name: name2,
|
|
28584
28600
|
prompt,
|
|
28585
28601
|
timing,
|
|
28586
28602
|
timezone: flagText({ args, name: "tz", fallback: "UTC" }),
|
|
@@ -28636,8 +28652,8 @@ var SCHEDULE_COMMANDS = {
|
|
|
28636
28652
|
runs: scheduleRuns
|
|
28637
28653
|
};
|
|
28638
28654
|
async function schedule({ context, args }) {
|
|
28639
|
-
const
|
|
28640
|
-
const command = Object.hasOwn(SCHEDULE_COMMANDS,
|
|
28655
|
+
const name2 = args.words[1] ?? "";
|
|
28656
|
+
const command = Object.hasOwn(SCHEDULE_COMMANDS, name2) ? SCHEDULE_COMMANDS[name2] : void 0;
|
|
28641
28657
|
if (!command) throw new CliUsageError(USAGE4);
|
|
28642
28658
|
await command({ context, args });
|
|
28643
28659
|
}
|
|
@@ -28677,12 +28693,12 @@ async function skillInstall({ context, args }) {
|
|
|
28677
28693
|
const catalogueId = args.words[2];
|
|
28678
28694
|
const from = flagText({ args, name: "from" });
|
|
28679
28695
|
if (!catalogueId === !from) throw new CliUsageError(USAGE5);
|
|
28680
|
-
const
|
|
28696
|
+
const name2 = flagText({ args, name: "as" });
|
|
28681
28697
|
const files = from ? await folderFiles({ root: resolve5(context.cwd, from) }) : void 0;
|
|
28682
28698
|
const { client } = await signedIn({ context, args });
|
|
28683
28699
|
const installed = await client.post("/api/skills/install", {
|
|
28684
28700
|
...catalogueId ? { catalogueId } : {},
|
|
28685
|
-
...
|
|
28701
|
+
...name2 ? { name: name2 } : {},
|
|
28686
28702
|
...files ? { files } : {}
|
|
28687
28703
|
});
|
|
28688
28704
|
if (args.flags.json) return context.out(`${JSON.stringify(installed, null, 2)}
|
|
@@ -28691,10 +28707,10 @@ async function skillInstall({ context, args }) {
|
|
|
28691
28707
|
`);
|
|
28692
28708
|
}
|
|
28693
28709
|
async function skillShow({ context, args }) {
|
|
28694
|
-
const
|
|
28695
|
-
if (!
|
|
28710
|
+
const name2 = args.words[2];
|
|
28711
|
+
if (!name2) throw new CliUsageError(USAGE5);
|
|
28696
28712
|
const { client } = await signedIn({ context, args });
|
|
28697
|
-
const skill2 = await client.post("/api/skills/show", { name });
|
|
28713
|
+
const skill2 = await client.post("/api/skills/show", { name: name2 });
|
|
28698
28714
|
if (args.flags.json) return context.out(`${JSON.stringify(skill2, null, 2)}
|
|
28699
28715
|
`);
|
|
28700
28716
|
context.out(`${skill2.name}${skill2.installed ? "" : " (not installed)"}: ${skill2.description}
|
|
@@ -28722,14 +28738,676 @@ var SKILL_COMMANDS = {
|
|
|
28722
28738
|
pull: skillPull
|
|
28723
28739
|
};
|
|
28724
28740
|
async function skill({ context, args }) {
|
|
28725
|
-
const
|
|
28726
|
-
const command = Object.hasOwn(SKILL_COMMANDS,
|
|
28741
|
+
const name2 = args.words[1] ?? "";
|
|
28742
|
+
const command = Object.hasOwn(SKILL_COMMANDS, name2) ? SKILL_COMMANDS[name2] : void 0;
|
|
28727
28743
|
if (!command) throw new CliUsageError(USAGE5);
|
|
28728
28744
|
await command({ context, args });
|
|
28729
28745
|
}
|
|
28730
28746
|
|
|
28731
28747
|
// src/services/vault-commands.service.ts
|
|
28732
28748
|
import { readFile as readFile9 } from "node:fs/promises";
|
|
28749
|
+
|
|
28750
|
+
// ../../modules/vault/contract/src/vault-devices.ts
|
|
28751
|
+
var base64Url = external_exports.string().regex(/^[A-Za-z0-9_-]+$/).max(16384);
|
|
28752
|
+
var name = external_exports.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/);
|
|
28753
|
+
var fieldName = external_exports.string().regex(/^[A-Z][A-Z0-9_]{0,63}$/);
|
|
28754
|
+
var vaultDeviceKindSchema = external_exports.enum(["passkey", "ios_secure_enclave"]);
|
|
28755
|
+
var vaultDeviceStateSchema = external_exports.enum(["pending", "active"]);
|
|
28756
|
+
var vaultDevicePasskeySchemaDefinition = external_exports.object({
|
|
28757
|
+
credentialId: base64Url,
|
|
28758
|
+
prfSalt: base64Url,
|
|
28759
|
+
wrappedPrivateKey: base64Url
|
|
28760
|
+
});
|
|
28761
|
+
var vaultDeviceSchemaDefinition = external_exports.object({
|
|
28762
|
+
id: external_exports.string().min(1),
|
|
28763
|
+
workspaceId: external_exports.string().min(1),
|
|
28764
|
+
userId: external_exports.string().min(1),
|
|
28765
|
+
label: external_exports.string(),
|
|
28766
|
+
kind: vaultDeviceKindSchema,
|
|
28767
|
+
state: vaultDeviceStateSchema,
|
|
28768
|
+
/** P-256 uncompressed point, base64url. */
|
|
28769
|
+
publicKey: base64Url,
|
|
28770
|
+
/** `4F2A 91C0`: the first four bytes of sha256(publicKey). */
|
|
28771
|
+
fingerprint: external_exports.string(),
|
|
28772
|
+
/** What the browser needs to unlock the device's key with its passkey; null for native. */
|
|
28773
|
+
passkey: vaultDevicePasskeySchemaDefinition.nullable(),
|
|
28774
|
+
createdAt: external_exports.iso.datetime(),
|
|
28775
|
+
activatedAt: external_exports.iso.datetime().nullable()
|
|
28776
|
+
});
|
|
28777
|
+
var vaultDeviceSchema = vaultDeviceSchemaDefinition;
|
|
28778
|
+
var vaultDeviceEnrolmentSchemaDefinition = external_exports.object({
|
|
28779
|
+
deviceId: external_exports.string(),
|
|
28780
|
+
/** Signed by the vault: the WebAuthn challenge is its UTF-8 bytes. */
|
|
28781
|
+
challenge: external_exports.string(),
|
|
28782
|
+
/** The passkey's user handle and names. */
|
|
28783
|
+
userId: external_exports.string(),
|
|
28784
|
+
/** True when this person has no active device, so the new one is active at once. */
|
|
28785
|
+
first: external_exports.boolean()
|
|
28786
|
+
});
|
|
28787
|
+
var vaultDeviceEnrolmentSchema = vaultDeviceEnrolmentSchemaDefinition;
|
|
28788
|
+
var finishVaultDeviceEnrolmentInputSchemaDefinition = external_exports.object({
|
|
28789
|
+
workspaceId: external_exports.string().min(1),
|
|
28790
|
+
deviceId: external_exports.string().min(1),
|
|
28791
|
+
challenge: external_exports.string().min(1),
|
|
28792
|
+
label: external_exports.string().trim().min(1).max(80),
|
|
28793
|
+
publicKey: base64Url,
|
|
28794
|
+
passkey: external_exports.object({
|
|
28795
|
+
...vaultDevicePasskeySchemaDefinition.shape,
|
|
28796
|
+
/** The passkey's own public key, SPKI DER, ES256 only. */
|
|
28797
|
+
credentialPublicKey: base64Url,
|
|
28798
|
+
credentialAlgorithm: external_exports.literal(-7),
|
|
28799
|
+
clientDataJSON: base64Url
|
|
28800
|
+
})
|
|
28801
|
+
});
|
|
28802
|
+
var finishVaultDeviceEnrolmentInputSchema = finishVaultDeviceEnrolmentInputSchemaDefinition;
|
|
28803
|
+
var sealedRecipientSchema = external_exports.object({
|
|
28804
|
+
deviceId: external_exports.string().min(1),
|
|
28805
|
+
epk: base64Url,
|
|
28806
|
+
wrappedKey: base64Url
|
|
28807
|
+
});
|
|
28808
|
+
var sealedSecretSchemaDefinition = external_exports.object({
|
|
28809
|
+
blob: base64Url,
|
|
28810
|
+
recipients: external_exports.array(sealedRecipientSchema).min(1).max(32)
|
|
28811
|
+
});
|
|
28812
|
+
var vaultDeviceAssertionSchemaDefinition = external_exports.object({
|
|
28813
|
+
credentialId: base64Url,
|
|
28814
|
+
clientDataJSON: base64Url,
|
|
28815
|
+
authenticatorData: base64Url,
|
|
28816
|
+
signature: base64Url
|
|
28817
|
+
});
|
|
28818
|
+
var approveVaultDeviceInputSchemaDefinition = external_exports.object({
|
|
28819
|
+
workspaceId: external_exports.string().min(1),
|
|
28820
|
+
deviceId: external_exports.string().min(1),
|
|
28821
|
+
challenge: external_exports.string().min(1),
|
|
28822
|
+
assertion: vaultDeviceAssertionSchemaDefinition,
|
|
28823
|
+
/** The new device's recipient for every sealed secret of the owner. */
|
|
28824
|
+
recipients: external_exports.array(
|
|
28825
|
+
external_exports.object({ connectionId: external_exports.string().min(1), recipient: sealedRecipientSchema })
|
|
28826
|
+
)
|
|
28827
|
+
});
|
|
28828
|
+
var approveVaultDeviceInputSchema = approveVaultDeviceInputSchemaDefinition;
|
|
28829
|
+
var createSealedConnectionInputSchemaDefinition = external_exports.object({
|
|
28830
|
+
workspaceId: external_exports.string().min(1),
|
|
28831
|
+
name,
|
|
28832
|
+
label: external_exports.string().trim().min(1).max(120),
|
|
28833
|
+
sensitivity: external_exports.enum(["ask", "human_only"]).default("ask"),
|
|
28834
|
+
rules: external_exports.string().max(2e3).default(""),
|
|
28835
|
+
fieldNames: external_exports.array(fieldName).min(1).max(32),
|
|
28836
|
+
sealed: sealedSecretSchemaDefinition,
|
|
28837
|
+
/** Only a personal API key set is sealed for now; anything else is refused, not ignored. */
|
|
28838
|
+
keychain: external_exports.enum(["personal", "workspace", "agent"]).default("personal"),
|
|
28839
|
+
kind: external_exports.enum(["api_key_set", "oauth", "mcp"]).default("api_key_set")
|
|
28840
|
+
});
|
|
28841
|
+
var createSealedConnectionInputSchema = createSealedConnectionInputSchemaDefinition;
|
|
28842
|
+
var resealConnectionInputSchemaDefinition = external_exports.object({
|
|
28843
|
+
workspaceId: external_exports.string().min(1),
|
|
28844
|
+
connectionId: external_exports.string().min(1),
|
|
28845
|
+
fieldNames: external_exports.array(fieldName).min(1).max(32),
|
|
28846
|
+
sealed: sealedSecretSchemaDefinition
|
|
28847
|
+
});
|
|
28848
|
+
var resealConnectionInputSchema = resealConnectionInputSchemaDefinition;
|
|
28849
|
+
var vaultSealedMaterialSchemaDefinition = external_exports.object({
|
|
28850
|
+
connectionId: external_exports.string(),
|
|
28851
|
+
workspaceId: external_exports.string(),
|
|
28852
|
+
ownerUserId: external_exports.string(),
|
|
28853
|
+
name,
|
|
28854
|
+
label: external_exports.string(),
|
|
28855
|
+
fieldNames: external_exports.array(external_exports.string()),
|
|
28856
|
+
blob: base64Url,
|
|
28857
|
+
recipients: external_exports.array(sealedRecipientSchema)
|
|
28858
|
+
});
|
|
28859
|
+
var vaultSealedMaterialSchema = vaultSealedMaterialSchemaDefinition;
|
|
28860
|
+
var vaultSealedApprovalSchemaDefinition = external_exports.object({
|
|
28861
|
+
requestId: external_exports.string(),
|
|
28862
|
+
agentId: external_exports.string(),
|
|
28863
|
+
reason: external_exports.string(),
|
|
28864
|
+
command: external_exports.array(external_exports.string()),
|
|
28865
|
+
/** The run's public key; the opened value is encrypted to it and nothing else. */
|
|
28866
|
+
runPublicKey: base64Url,
|
|
28867
|
+
material: vaultSealedMaterialSchemaDefinition
|
|
28868
|
+
});
|
|
28869
|
+
var vaultSealedApprovalSchema = vaultSealedApprovalSchemaDefinition;
|
|
28870
|
+
var answerSealedApprovalInputSchemaDefinition = external_exports.object({
|
|
28871
|
+
workspaceId: external_exports.string().min(1),
|
|
28872
|
+
requestId: external_exports.string().min(1),
|
|
28873
|
+
release: external_exports.object({ epk: base64Url, ciphertext: base64Url }),
|
|
28874
|
+
via: external_exports.enum(["feed", "channel", "ios", "desktop", "web"]).default("web")
|
|
28875
|
+
});
|
|
28876
|
+
var answerSealedApprovalInputSchema = answerSealedApprovalInputSchemaDefinition;
|
|
28877
|
+
var vaultRunSealedReleaseSchemaDefinition = external_exports.object({
|
|
28878
|
+
requestId: external_exports.string(),
|
|
28879
|
+
epk: base64Url,
|
|
28880
|
+
ciphertext: base64Url
|
|
28881
|
+
});
|
|
28882
|
+
var vaultRunSealedReleaseSchema = vaultRunSealedReleaseSchemaDefinition;
|
|
28883
|
+
|
|
28884
|
+
// ../../modules/vault/contract/src/vault-reason.ts
|
|
28885
|
+
var COMMAND_STARTS = new Set(
|
|
28886
|
+
"sudo laze kv aws curl wget npm pnpm yarn npx git gh kubectl helm docker terraform python python3 node bash sh zsh export cd make cargo go ssh scp psql uv pip echo cat env clickhouse-client".split(
|
|
28887
|
+
" "
|
|
28888
|
+
)
|
|
28889
|
+
);
|
|
28890
|
+
function checkVaultReason(reason) {
|
|
28891
|
+
const text2 = (reason ?? "").trim();
|
|
28892
|
+
if (text2 === "") return "missing";
|
|
28893
|
+
if (text2.includes("\n") || Array.from(text2).length > 200) return "too_long";
|
|
28894
|
+
const words = text2.split(/\s+/);
|
|
28895
|
+
if (COMMAND_STARTS.has((words[0] ?? "").toLowerCase())) return "looks_like_command";
|
|
28896
|
+
if (/(^|\s)--?[A-Za-z]/.test(text2) || /[|;&`$<>{}]/.test(text2)) return "looks_like_command";
|
|
28897
|
+
if (words.length < 4) return "too_short";
|
|
28898
|
+
return "ok";
|
|
28899
|
+
}
|
|
28900
|
+
var vaultReasonSchema = external_exports.string().transform((reason) => reason.trim()).superRefine((reason, context) => {
|
|
28901
|
+
const problem = checkVaultReason(reason);
|
|
28902
|
+
if (problem !== "ok")
|
|
28903
|
+
context.addIssue({ code: "custom", message: problem, params: { problem } });
|
|
28904
|
+
});
|
|
28905
|
+
|
|
28906
|
+
// ../../modules/vault/contract/src/vault.ts
|
|
28907
|
+
var vaultSensitivitySchema = external_exports.enum(["auto", "checked", "ask", "human_only"]);
|
|
28908
|
+
var vaultKeychainSchemaDefinition = external_exports.discriminatedUnion("kind", [
|
|
28909
|
+
external_exports.object({ kind: external_exports.literal("personal"), ownerUserId: external_exports.string().min(1) }),
|
|
28910
|
+
external_exports.object({ kind: external_exports.literal("workspace") }),
|
|
28911
|
+
external_exports.object({ kind: external_exports.literal("agent"), agentId: external_exports.string().min(1) })
|
|
28912
|
+
]);
|
|
28913
|
+
var vaultKeychainSchema = vaultKeychainSchemaDefinition;
|
|
28914
|
+
var vaultConnectionKindSchema = external_exports.enum(["api_key_set", "oauth", "mcp"]);
|
|
28915
|
+
var vaultConnectionStatusSchema = external_exports.enum(["active", "needs_reconnect"]);
|
|
28916
|
+
var vaultFieldNameSchema = external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).max(64);
|
|
28917
|
+
var vaultConnectionNameSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/);
|
|
28918
|
+
var vaultOAuthRevokeStyleSchema = external_exports.enum(["rfc7009", "github_grant", "slack"]);
|
|
28919
|
+
var vaultOAuthClientSchemaDefinition = external_exports.object({
|
|
28920
|
+
tokenUrl: external_exports.url(),
|
|
28921
|
+
clientId: external_exports.string().min(1),
|
|
28922
|
+
clientSecret: external_exports.string().min(1).nullable().default(null),
|
|
28923
|
+
authMethod: external_exports.enum(["client_secret_post", "client_secret_basic", "none", "github_app"]).default("client_secret_post"),
|
|
28924
|
+
/** How the token endpoint reads its body. */
|
|
28925
|
+
bodyFormat: external_exports.enum(["form", "json"]).default("form"),
|
|
28926
|
+
/** Where a nested provider answer keeps the person's token, Slack's `authed_user`. */
|
|
28927
|
+
tokenPath: external_exports.enum(["authed_user"]).nullable().default(null),
|
|
28928
|
+
revoke: external_exports.object({ style: vaultOAuthRevokeStyleSchema, url: external_exports.url() }).nullable().default(null)
|
|
28929
|
+
});
|
|
28930
|
+
var vaultOAuthClientSchema = vaultOAuthClientSchemaDefinition;
|
|
28931
|
+
var vaultOAuthTokensSchemaDefinition = external_exports.object({
|
|
28932
|
+
accessToken: external_exports.string().min(1),
|
|
28933
|
+
refreshToken: external_exports.string().min(1).nullable().default(null),
|
|
28934
|
+
/** ISO 8601; null when the provider's access tokens do not expire. */
|
|
28935
|
+
expiresAt: external_exports.iso.datetime().nullable().default(null),
|
|
28936
|
+
scopes: external_exports.array(external_exports.string().min(1)).default([]),
|
|
28937
|
+
client: vaultOAuthClientSchema
|
|
28938
|
+
});
|
|
28939
|
+
var vaultOAuthTokensSchema = vaultOAuthTokensSchemaDefinition;
|
|
28940
|
+
var vaultSecretBundleSchemaDefinition = external_exports.discriminatedUnion("kind", [
|
|
28941
|
+
external_exports.object({
|
|
28942
|
+
kind: external_exports.literal("api_key_set"),
|
|
28943
|
+
fields: external_exports.record(vaultFieldNameSchema, external_exports.string().min(1))
|
|
28944
|
+
}),
|
|
28945
|
+
/** A grant from a provider in the connector registry: Gmail, GitHub, Slack and the rest. */
|
|
28946
|
+
external_exports.object({
|
|
28947
|
+
kind: external_exports.literal("oauth"),
|
|
28948
|
+
provider: external_exports.string().min(1),
|
|
28949
|
+
/** Who the grant is for at the provider, shown to the owner: an address or a login. */
|
|
28950
|
+
account: external_exports.string().min(1).nullable().default(null),
|
|
28951
|
+
tokens: vaultOAuthTokensSchema
|
|
28952
|
+
}),
|
|
28953
|
+
/** A remote MCP server: the headers it takes, and its OAuth tokens when it signs people in. */
|
|
28954
|
+
external_exports.object({
|
|
28955
|
+
kind: external_exports.literal("mcp"),
|
|
28956
|
+
serverUrl: external_exports.url(),
|
|
28957
|
+
headers: external_exports.record(external_exports.string().regex(/^[A-Za-z0-9-]{1,64}$/), external_exports.string().min(1)).default({}),
|
|
28958
|
+
tokens: vaultOAuthTokensSchema.nullable().default(null)
|
|
28959
|
+
})
|
|
28960
|
+
]);
|
|
28961
|
+
var vaultSecretBundleSchema = vaultSecretBundleSchemaDefinition;
|
|
28962
|
+
var vaultConnectorDetailsSchemaDefinition = external_exports.object({
|
|
28963
|
+
provider: external_exports.string().nullable(),
|
|
28964
|
+
serverUrl: external_exports.string().nullable(),
|
|
28965
|
+
account: external_exports.string().nullable(),
|
|
28966
|
+
scopes: external_exports.array(external_exports.string()),
|
|
28967
|
+
/** When the access token runs out; the vault refreshes it on the next use. */
|
|
28968
|
+
expiresAt: external_exports.iso.datetime().nullable()
|
|
28969
|
+
});
|
|
28970
|
+
var vaultConnectorDetailsSchema = vaultConnectorDetailsSchemaDefinition;
|
|
28971
|
+
var vaultEgressTargetSchemaDefinition = external_exports.object({
|
|
28972
|
+
upstream: external_exports.url(),
|
|
28973
|
+
header: external_exports.string().min(1).default("Authorization"),
|
|
28974
|
+
prefix: external_exports.string().default("Bearer "),
|
|
28975
|
+
field: vaultFieldNameSchema
|
|
28976
|
+
});
|
|
28977
|
+
var vaultEgressTargetSchema = vaultEgressTargetSchemaDefinition;
|
|
28978
|
+
var vaultConnectionSchemaDefinition = external_exports.object({
|
|
28979
|
+
id: external_exports.string().min(1),
|
|
28980
|
+
workspaceId: external_exports.string().min(1),
|
|
28981
|
+
name: vaultConnectionNameSchema,
|
|
28982
|
+
label: external_exports.string(),
|
|
28983
|
+
kind: vaultConnectionKindSchema,
|
|
28984
|
+
keychain: vaultKeychainSchema,
|
|
28985
|
+
sensitivity: vaultSensitivitySchema,
|
|
28986
|
+
/** Plain-language rules the judge reads: "Read only; never send mail." */
|
|
28987
|
+
rules: external_exports.string(),
|
|
28988
|
+
/** Who answers an ask on a workspace or agent keychain; a personal one asks its owner. */
|
|
28989
|
+
approverUserIds: external_exports.array(external_exports.string().min(1)),
|
|
28990
|
+
/** The longest lease an approver may give, set by an admin. */
|
|
28991
|
+
maxLeaseSeconds: external_exports.number().int().positive().nullable(),
|
|
28992
|
+
fieldNames: external_exports.array(vaultFieldNameSchema),
|
|
28993
|
+
egress: vaultEgressTargetSchema.nullable(),
|
|
28994
|
+
status: vaultConnectionStatusSchema,
|
|
28995
|
+
/** Provider, account, scopes and expiry of an OAuth or MCP connection; null for API keys. */
|
|
28996
|
+
connector: vaultConnectorDetailsSchema.nullable(),
|
|
28997
|
+
/** Sealed to its owner's devices: the server cannot open it. */
|
|
28998
|
+
sealed: external_exports.boolean().default(false),
|
|
28999
|
+
/** False for a sealed connection no enrolled device can open any more. */
|
|
29000
|
+
openable: external_exports.boolean().default(true),
|
|
29001
|
+
createdByUserId: external_exports.string(),
|
|
29002
|
+
/** ISO 8601 */
|
|
29003
|
+
createdAt: external_exports.iso.datetime(),
|
|
29004
|
+
updatedAt: external_exports.iso.datetime()
|
|
29005
|
+
});
|
|
29006
|
+
var vaultConnectionSchema = vaultConnectionSchemaDefinition;
|
|
29007
|
+
var createVaultConnectionInputSchemaDefinition = external_exports.object({
|
|
29008
|
+
workspaceId: external_exports.string().min(1),
|
|
29009
|
+
name: vaultConnectionNameSchema,
|
|
29010
|
+
label: external_exports.string().trim().min(1).max(120),
|
|
29011
|
+
keychain: vaultKeychainSchema,
|
|
29012
|
+
sensitivity: vaultSensitivitySchema,
|
|
29013
|
+
rules: external_exports.string().max(2e3).default(""),
|
|
29014
|
+
approverUserIds: external_exports.array(external_exports.string().min(1)).default([]),
|
|
29015
|
+
maxLeaseSeconds: external_exports.number().int().positive().nullable().default(null),
|
|
29016
|
+
secret: vaultSecretBundleSchema,
|
|
29017
|
+
egress: vaultEgressTargetSchema.nullable().default(null)
|
|
29018
|
+
});
|
|
29019
|
+
var createVaultConnectionInputSchema = createVaultConnectionInputSchemaDefinition;
|
|
29020
|
+
var updateVaultConnectionInputSchemaDefinition = external_exports.object({
|
|
29021
|
+
workspaceId: external_exports.string().min(1),
|
|
29022
|
+
connectionId: external_exports.string().min(1),
|
|
29023
|
+
label: external_exports.string().trim().min(1).max(120).optional(),
|
|
29024
|
+
sensitivity: vaultSensitivitySchema.optional(),
|
|
29025
|
+
rules: external_exports.string().max(2e3).optional(),
|
|
29026
|
+
approverUserIds: external_exports.array(external_exports.string().min(1)).optional(),
|
|
29027
|
+
maxLeaseSeconds: external_exports.number().int().positive().nullable().optional(),
|
|
29028
|
+
secret: vaultSecretBundleSchema.optional(),
|
|
29029
|
+
egress: vaultEgressTargetSchema.nullable().optional()
|
|
29030
|
+
});
|
|
29031
|
+
var updateVaultConnectionInputSchema = updateVaultConnectionInputSchemaDefinition;
|
|
29032
|
+
var vaultGrantSubjectSchemaDefinition = external_exports.object({
|
|
29033
|
+
kind: external_exports.enum(["person", "group", "channel", "agent"]),
|
|
29034
|
+
id: external_exports.string().min(1)
|
|
29035
|
+
});
|
|
29036
|
+
var vaultGrantSubjectSchema = vaultGrantSubjectSchemaDefinition;
|
|
29037
|
+
var vaultGrantSchemaDefinition = external_exports.object({
|
|
29038
|
+
id: external_exports.string().min(1),
|
|
29039
|
+
connectionId: external_exports.string().min(1),
|
|
29040
|
+
subject: vaultGrantSubjectSchema,
|
|
29041
|
+
/** A lend: a personal connection opened to one channel's members through its owner's agent. */
|
|
29042
|
+
lend: external_exports.boolean(),
|
|
29043
|
+
grantedByUserId: external_exports.string(),
|
|
29044
|
+
expiresAt: external_exports.iso.datetime().nullable(),
|
|
29045
|
+
createdAt: external_exports.iso.datetime()
|
|
29046
|
+
});
|
|
29047
|
+
var vaultGrantSchema = vaultGrantSchemaDefinition;
|
|
29048
|
+
var grantVaultConnectionInputSchemaDefinition = external_exports.object({
|
|
29049
|
+
workspaceId: external_exports.string().min(1),
|
|
29050
|
+
connectionId: external_exports.string().min(1),
|
|
29051
|
+
subject: vaultGrantSubjectSchema,
|
|
29052
|
+
/** No end when null. */
|
|
29053
|
+
durationSeconds: external_exports.number().int().positive().nullable().default(null)
|
|
29054
|
+
});
|
|
29055
|
+
var grantVaultConnectionInputSchema = grantVaultConnectionInputSchemaDefinition;
|
|
29056
|
+
var lendVaultConnectionInputSchemaDefinition = external_exports.object({
|
|
29057
|
+
workspaceId: external_exports.string().min(1),
|
|
29058
|
+
connectionId: external_exports.string().min(1),
|
|
29059
|
+
channelId: external_exports.string().min(1),
|
|
29060
|
+
durationSeconds: external_exports.number().int().positive().nullable().default(null)
|
|
29061
|
+
});
|
|
29062
|
+
var lendVaultConnectionInputSchema = lendVaultConnectionInputSchemaDefinition;
|
|
29063
|
+
var vaultAgentKindSchema = external_exports.enum(["personal", "team"]);
|
|
29064
|
+
var openVaultTurnInputSchemaDefinition = external_exports.object({
|
|
29065
|
+
workspaceId: external_exports.string().min(1),
|
|
29066
|
+
agent: external_exports.object({
|
|
29067
|
+
id: external_exports.string().min(1),
|
|
29068
|
+
kind: vaultAgentKindSchema,
|
|
29069
|
+
ownerUserId: external_exports.string().min(1)
|
|
29070
|
+
}),
|
|
29071
|
+
requesterUserId: external_exports.string().min(1),
|
|
29072
|
+
requesterGroupIds: external_exports.array(external_exports.string().min(1)).default([]),
|
|
29073
|
+
channel: external_exports.object({ id: external_exports.string().min(1), kind: external_exports.enum(["public", "private", "dm"]) }),
|
|
29074
|
+
/** False when the requester can no longer see the channel (a schedule's creator who left). */
|
|
29075
|
+
requesterSeesChannel: external_exports.boolean().default(true),
|
|
29076
|
+
/** The requester's messages this turn, for the judge; other senders are never permission. */
|
|
29077
|
+
requesterMessages: external_exports.array(external_exports.string()).default([])
|
|
29078
|
+
});
|
|
29079
|
+
var vaultAlwaysApprovalActionSchema = external_exports.enum([
|
|
29080
|
+
"send_external",
|
|
29081
|
+
"publish_app_public",
|
|
29082
|
+
"rent_compute_above_budget",
|
|
29083
|
+
"create_agent_with_workspace_access",
|
|
29084
|
+
"invite_people"
|
|
29085
|
+
]);
|
|
29086
|
+
var VAULT_ALWAYS_APPROVAL_ACTIONS = vaultAlwaysApprovalActionSchema.options;
|
|
29087
|
+
var vaultPurposeSchema = external_exports.enum(["use", "send_external"]);
|
|
29088
|
+
var vaultUseInputSchemaDefinition = external_exports.object({
|
|
29089
|
+
turnToken: external_exports.string().min(1),
|
|
29090
|
+
/** The connection's name as the agent asks for it, or its id. */
|
|
29091
|
+
connection: external_exports.string().min(1),
|
|
29092
|
+
purpose: vaultPurposeSchema.default("use"),
|
|
29093
|
+
reason: vaultReasonSchema,
|
|
29094
|
+
command: external_exports.array(external_exports.string()).default([]),
|
|
29095
|
+
/** OAuth scopes this use needs; a grant without them is refused with the missing ones. */
|
|
29096
|
+
requiredScopes: external_exports.array(external_exports.string().min(1)).default([]),
|
|
29097
|
+
/** A floor on the connection's sensitivity, for a tool its owner marked more guarded. */
|
|
29098
|
+
atLeast: vaultSensitivitySchema.optional()
|
|
29099
|
+
});
|
|
29100
|
+
var vaultRunReleaseSchemaDefinition = external_exports.discriminatedUnion("outcome", [
|
|
29101
|
+
external_exports.object({
|
|
29102
|
+
outcome: external_exports.literal("allow"),
|
|
29103
|
+
env: external_exports.record(external_exports.string(), external_exports.string()),
|
|
29104
|
+
/** A sealed connection's values, encrypted to the run's own key. */
|
|
29105
|
+
sealed: vaultRunSealedReleaseSchema.optional()
|
|
29106
|
+
}),
|
|
29107
|
+
external_exports.object({
|
|
29108
|
+
outcome: external_exports.literal("ask"),
|
|
29109
|
+
requestId: external_exports.string(),
|
|
29110
|
+
message: external_exports.string()
|
|
29111
|
+
}),
|
|
29112
|
+
external_exports.object({ outcome: external_exports.literal("deny"), exitCode: external_exports.number().int(), message: external_exports.string() })
|
|
29113
|
+
]);
|
|
29114
|
+
var vaultEgressResolveInputSchemaDefinition = external_exports.object({
|
|
29115
|
+
agentId: external_exports.string().min(1),
|
|
29116
|
+
connectionId: external_exports.string().min(1),
|
|
29117
|
+
method: external_exports.string().default("GET"),
|
|
29118
|
+
host: external_exports.string().default(""),
|
|
29119
|
+
path: external_exports.string().default("/"),
|
|
29120
|
+
/** A floor the proxy sets for a guarded request, such as a git push asking before it goes. */
|
|
29121
|
+
atLeast: vaultSensitivitySchema.optional(),
|
|
29122
|
+
/** What the proxy knows the request is, such as "git push to github.com/acme/widgets". */
|
|
29123
|
+
reason: external_exports.string().max(300).optional()
|
|
29124
|
+
});
|
|
29125
|
+
var vaultEgressResolutionSchemaDefinition = external_exports.discriminatedUnion("decision", [
|
|
29126
|
+
external_exports.object({ decision: external_exports.literal("allow"), value: external_exports.string() }),
|
|
29127
|
+
external_exports.object({ decision: external_exports.literal("pending"), requestId: external_exports.string() }),
|
|
29128
|
+
external_exports.object({ decision: external_exports.literal("deny"), code: external_exports.string() })
|
|
29129
|
+
]);
|
|
29130
|
+
var vaultEgressReleaseInputSchemaDefinition = external_exports.object({
|
|
29131
|
+
agentId: external_exports.string().min(1),
|
|
29132
|
+
connection: external_exports.string().min(1),
|
|
29133
|
+
reason: external_exports.string(),
|
|
29134
|
+
command: external_exports.array(external_exports.string()).default([]),
|
|
29135
|
+
/** The run's P-256 public key, base64url; a sealed connection is released only to it. */
|
|
29136
|
+
recipient: external_exports.string().max(200).optional()
|
|
29137
|
+
});
|
|
29138
|
+
var vaultApprovalStateSchema = external_exports.enum([
|
|
29139
|
+
"pending",
|
|
29140
|
+
"approved_once",
|
|
29141
|
+
"approved_for_agent",
|
|
29142
|
+
"denied",
|
|
29143
|
+
"expired"
|
|
29144
|
+
]);
|
|
29145
|
+
var vaultAnswerViaSchema = external_exports.enum(["feed", "channel", "ios", "desktop", "web"]);
|
|
29146
|
+
var vaultApprovalRequestSchemaDefinition = external_exports.object({
|
|
29147
|
+
id: external_exports.string(),
|
|
29148
|
+
workspaceId: external_exports.string(),
|
|
29149
|
+
/** Null for an always-approval action that uses no connection. */
|
|
29150
|
+
connectionId: external_exports.string().nullable(),
|
|
29151
|
+
action: external_exports.string(),
|
|
29152
|
+
agentId: external_exports.string(),
|
|
29153
|
+
agentKind: vaultAgentKindSchema,
|
|
29154
|
+
requesterUserId: external_exports.string(),
|
|
29155
|
+
channelId: external_exports.string(),
|
|
29156
|
+
reason: external_exports.string(),
|
|
29157
|
+
command: external_exports.array(external_exports.string()),
|
|
29158
|
+
why: external_exports.string(),
|
|
29159
|
+
approverUserIds: external_exports.array(external_exports.string()),
|
|
29160
|
+
state: vaultApprovalStateSchema,
|
|
29161
|
+
/** How many asks joined this card. */
|
|
29162
|
+
joinCount: external_exports.number().int().positive(),
|
|
29163
|
+
createdAt: external_exports.iso.datetime(),
|
|
29164
|
+
expiresAt: external_exports.iso.datetime(),
|
|
29165
|
+
answeredByUserId: external_exports.string().nullable(),
|
|
29166
|
+
answeredVia: vaultAnswerViaSchema.nullable(),
|
|
29167
|
+
answeredAt: external_exports.iso.datetime().nullable(),
|
|
29168
|
+
leaseExpiresAt: external_exports.iso.datetime().nullable()
|
|
29169
|
+
});
|
|
29170
|
+
var vaultApprovalRequestSchema = vaultApprovalRequestSchemaDefinition;
|
|
29171
|
+
var answerVaultApprovalInputSchemaDefinition = external_exports.object({
|
|
29172
|
+
workspaceId: external_exports.string().min(1),
|
|
29173
|
+
requestId: external_exports.string().min(1),
|
|
29174
|
+
answer: external_exports.enum(["approve_once", "approve_for_agent", "deny"]),
|
|
29175
|
+
/** Approve for this agent only: up to the connection's admin maximum. */
|
|
29176
|
+
durationSeconds: external_exports.number().int().positive().optional(),
|
|
29177
|
+
via: vaultAnswerViaSchema
|
|
29178
|
+
});
|
|
29179
|
+
var answerVaultApprovalInputSchema = answerVaultApprovalInputSchemaDefinition;
|
|
29180
|
+
var requestVaultActionInputSchemaDefinition = external_exports.object({
|
|
29181
|
+
turnToken: external_exports.string().min(1),
|
|
29182
|
+
action: vaultAlwaysApprovalActionSchema,
|
|
29183
|
+
reason: vaultReasonSchema,
|
|
29184
|
+
/** The people the owning module says decide; the requester when empty. */
|
|
29185
|
+
approverUserIds: external_exports.array(external_exports.string().min(1)).default([])
|
|
29186
|
+
});
|
|
29187
|
+
var vaultAuditEntrySchemaDefinition = external_exports.object({
|
|
29188
|
+
id: external_exports.string(),
|
|
29189
|
+
seq: external_exports.number().int().positive(),
|
|
29190
|
+
at: external_exports.iso.datetime(),
|
|
29191
|
+
actorKind: external_exports.enum(["user", "agent", "system"]),
|
|
29192
|
+
actorId: external_exports.string().nullable(),
|
|
29193
|
+
action: external_exports.string(),
|
|
29194
|
+
connectionId: external_exports.string().nullable(),
|
|
29195
|
+
outcome: external_exports.string(),
|
|
29196
|
+
decider: external_exports.string().nullable(),
|
|
29197
|
+
requesterUserId: external_exports.string().nullable(),
|
|
29198
|
+
agentId: external_exports.string().nullable(),
|
|
29199
|
+
channelId: external_exports.string().nullable(),
|
|
29200
|
+
requestId: external_exports.string().nullable(),
|
|
29201
|
+
reason: external_exports.string().nullable(),
|
|
29202
|
+
detail: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
29203
|
+
prevHash: external_exports.string(),
|
|
29204
|
+
hash: external_exports.string()
|
|
29205
|
+
});
|
|
29206
|
+
var vaultAuditEntrySchema = vaultAuditEntrySchemaDefinition;
|
|
29207
|
+
var vaultAuditPageSchemaDefinition = external_exports.object({
|
|
29208
|
+
entries: external_exports.array(vaultAuditEntrySchema),
|
|
29209
|
+
/** The chain re-hashed: when broken, the first entry that does not follow from the last. */
|
|
29210
|
+
chain: external_exports.object({ intact: external_exports.boolean(), brokenAtSeq: external_exports.number().int().nullable() })
|
|
29211
|
+
});
|
|
29212
|
+
var vaultAuditPageSchema = vaultAuditPageSchemaDefinition;
|
|
29213
|
+
var vaultConnectionUseSchemaDefinition = external_exports.object({
|
|
29214
|
+
at: external_exports.iso.datetime(),
|
|
29215
|
+
action: external_exports.string(),
|
|
29216
|
+
outcome: external_exports.string(),
|
|
29217
|
+
agentId: external_exports.string().nullable(),
|
|
29218
|
+
requesterUserId: external_exports.string().nullable(),
|
|
29219
|
+
channelId: external_exports.string().nullable(),
|
|
29220
|
+
reason: external_exports.string().nullable(),
|
|
29221
|
+
/** The command or tool, as the use named it. */
|
|
29222
|
+
command: external_exports.array(external_exports.string())
|
|
29223
|
+
});
|
|
29224
|
+
var vaultConnectionUseSchema = vaultConnectionUseSchemaDefinition;
|
|
29225
|
+
var vaultRevokeAtProviderSchema = external_exports.enum(["revoked", "failed", "not_supported"]);
|
|
29226
|
+
var saveGithubInstallationInputSchemaDefinition = external_exports.object({
|
|
29227
|
+
workspaceId: external_exports.string().min(1),
|
|
29228
|
+
installationId: external_exports.string().regex(/^\d{1,20}$/),
|
|
29229
|
+
account: external_exports.string().min(1).max(100),
|
|
29230
|
+
name: external_exports.string().min(1).max(64),
|
|
29231
|
+
label: external_exports.string().min(1).max(200),
|
|
29232
|
+
approverUserIds: external_exports.array(external_exports.string()).default([]),
|
|
29233
|
+
/** The connection to point at this installation again, after a reinstall. */
|
|
29234
|
+
connectionId: external_exports.string().optional()
|
|
29235
|
+
});
|
|
29236
|
+
var VaultApi = moduleApi()("vault");
|
|
29237
|
+
var workspaceInput = external_exports.object({ workspaceId: external_exports.string().min(1) });
|
|
29238
|
+
var connectionInput = external_exports.object({
|
|
29239
|
+
workspaceId: external_exports.string().min(1),
|
|
29240
|
+
connectionId: external_exports.string().min(1)
|
|
29241
|
+
});
|
|
29242
|
+
var vaultTrpc = defineTrpcContract("vault").mutation("createConnection").withInput(createVaultConnectionInputSchema).withOutput(vaultConnectionSchema).query("listConnections").withInput(workspaceInput).withOutput(external_exports.array(vaultConnectionSchema)).mutation("updateConnection").withInput(updateVaultConnectionInputSchema).withOutput(vaultConnectionSchema).mutation("deleteConnection").withInput(connectionInput).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).mutation("revokeConnection").withInput(connectionInput).withOutput(external_exports.object({ atProvider: vaultRevokeAtProviderSchema })).query("listConnectionUses").withInput(
|
|
29243
|
+
external_exports.object({ ...connectionInput.shape, limit: external_exports.number().int().min(1).max(200).optional() })
|
|
29244
|
+
).withOutput(external_exports.array(vaultConnectionUseSchema)).mutation("revealConnection").withInput(external_exports.object({ ...connectionInput.shape, reason: external_exports.string().trim().min(1).max(200) })).withOutput(external_exports.object({ fields: external_exports.record(external_exports.string(), external_exports.string()) })).mutation("grantConnection").withInput(grantVaultConnectionInputSchema).withOutput(vaultGrantSchema).mutation("lendToChannel").withInput(lendVaultConnectionInputSchema).withOutput(vaultGrantSchema).mutation("revokeGrant").withInput(external_exports.object({ workspaceId: external_exports.string().min(1), grantId: external_exports.string().min(1) })).withOutput(external_exports.object({ revoked: external_exports.literal(true) })).query("listGrants").withInput(connectionInput).withOutput(external_exports.array(vaultGrantSchema)).query("listApprovals").withInput(external_exports.object({ ...workspaceInput.shape, state: vaultApprovalStateSchema.optional() })).withOutput(external_exports.array(vaultApprovalRequestSchema)).mutation("answerApproval").withInput(answerVaultApprovalInputSchema).withOutput(vaultApprovalRequestSchema).query("listAudit").withInput(
|
|
29245
|
+
external_exports.object({ ...workspaceInput.shape, limit: external_exports.number().int().min(1).max(500).optional() })
|
|
29246
|
+
).withOutput(vaultAuditPageSchema).query("listDevices").withInput(workspaceInput).withOutput(external_exports.array(vaultDeviceSchema)).mutation("beginDeviceEnrolment").withInput(workspaceInput).withOutput(vaultDeviceEnrolmentSchema).mutation("finishDeviceEnrolment").withInput(finishVaultDeviceEnrolmentInputSchema).withOutput(vaultDeviceSchema).mutation("beginDeviceApproval").withInput(external_exports.object({ ...workspaceInput.shape, deviceId: external_exports.string().min(1) })).withOutput(external_exports.object({ challenge: external_exports.string(), sealed: external_exports.array(vaultSealedMaterialSchema) })).mutation("approveDevice").withInput(approveVaultDeviceInputSchema).withOutput(vaultDeviceSchema).mutation("removeDevice").withInput(external_exports.object({ ...workspaceInput.shape, deviceId: external_exports.string().min(1) })).withOutput(external_exports.object({ removed: external_exports.literal(true) })).mutation("createSealedConnection").withInput(createSealedConnectionInputSchema).withOutput(vaultConnectionSchema).mutation("resealConnection").withInput(resealConnectionInputSchema).withOutput(vaultConnectionSchema).mutation("openSealedConnection").withInput(external_exports.object({ ...connectionInput.shape, reason: external_exports.string().trim().min(1).max(200) })).withOutput(vaultSealedMaterialSchema).query("getSealedApproval").withInput(external_exports.object({ ...workspaceInput.shape, requestId: external_exports.string().min(1) })).withOutput(vaultSealedApprovalSchema).mutation("answerSealedApproval").withInput(answerSealedApprovalInputSchema).withOutput(vaultApprovalRequestSchema).build();
|
|
29247
|
+
|
|
29248
|
+
// ../../modules/vault/contract/src/vault.config.ts
|
|
29249
|
+
var positiveInt = external_exports.coerce.number().int().positive();
|
|
29250
|
+
var vaultConfig = Config.define((c) => ({
|
|
29251
|
+
approvalTimeoutMinutes: c.env("VAULT_APPROVAL_TIMEOUT_MINUTES", positiveInt.default(60)),
|
|
29252
|
+
/** How long an approve-once answer waits for the same ask to come back for it. */
|
|
29253
|
+
approveOnceWindowMinutes: c.env("VAULT_APPROVE_ONCE_WINDOW_MINUTES", positiveInt.default(10)),
|
|
29254
|
+
/** The lease cap when an admin set none on the connection. */
|
|
29255
|
+
defaultMaxLeaseHours: c.env("VAULT_DEFAULT_MAX_LEASE_HOURS", positiveInt.default(168)),
|
|
29256
|
+
turnTtlMinutes: c.env("VAULT_TURN_TTL_MINUTES", positiveInt.default(720)),
|
|
29257
|
+
judgeTimeoutMs: c.env("VAULT_JUDGE_TIMEOUT_MS", positiveInt.default(2e4)),
|
|
29258
|
+
/** How long after a process starts it still accepts turn tokens signed under the previous key. */
|
|
29259
|
+
previousKeyGraceMinutes: c.env(
|
|
29260
|
+
"VAULT_PREVIOUS_KEY_GRACE_MINUTES",
|
|
29261
|
+
external_exports.coerce.number().int().min(0).default(30)
|
|
29262
|
+
),
|
|
29263
|
+
/** The origin passkeys are made on; unset accepts any localhost origin, for development. */
|
|
29264
|
+
publicBaseUrl
|
|
29265
|
+
}));
|
|
29266
|
+
|
|
29267
|
+
// ../../modules/vault/contract/src/vault.errors.ts
|
|
29268
|
+
var VaultSealMismatchError = class extends HandledError {
|
|
29269
|
+
constructor() {
|
|
29270
|
+
super("vault_seal_mismatch", "This sealed value does not belong to the secret it names", {
|
|
29271
|
+
httpStatus: 422
|
|
29272
|
+
});
|
|
29273
|
+
this.name = "VaultSealMismatchError";
|
|
29274
|
+
}
|
|
29275
|
+
};
|
|
29276
|
+
|
|
29277
|
+
// ../../modules/vault/contract/src/vault.events.ts
|
|
29278
|
+
var vaultApprovalRequestedPayloadSchemaDefinition = external_exports.object({
|
|
29279
|
+
workspaceId: external_exports.string().min(1),
|
|
29280
|
+
requestId: external_exports.string().min(1),
|
|
29281
|
+
connectionId: external_exports.string().nullable(),
|
|
29282
|
+
connectionLabel: external_exports.string().nullable(),
|
|
29283
|
+
action: external_exports.string(),
|
|
29284
|
+
agentId: external_exports.string(),
|
|
29285
|
+
requesterUserId: external_exports.string(),
|
|
29286
|
+
channelId: external_exports.string(),
|
|
29287
|
+
approverUserIds: external_exports.array(external_exports.string()),
|
|
29288
|
+
reason: external_exports.string(),
|
|
29289
|
+
why: external_exports.string(),
|
|
29290
|
+
/** The longest lease the card may offer; null offers only once and deny. */
|
|
29291
|
+
maxLeaseSeconds: external_exports.number().int().positive().nullable(),
|
|
29292
|
+
expiresAt: external_exports.iso.datetime()
|
|
29293
|
+
});
|
|
29294
|
+
var vaultApprovalResolvedPayloadSchemaDefinition = external_exports.object({
|
|
29295
|
+
workspaceId: external_exports.string().min(1),
|
|
29296
|
+
requestId: external_exports.string().min(1),
|
|
29297
|
+
state: external_exports.enum(["approved_once", "approved_for_agent", "denied", "expired"]),
|
|
29298
|
+
answeredByUserId: external_exports.string().nullable(),
|
|
29299
|
+
answeredVia: external_exports.string().nullable(),
|
|
29300
|
+
leaseExpiresAt: external_exports.iso.datetime().nullable(),
|
|
29301
|
+
at: external_exports.iso.datetime()
|
|
29302
|
+
});
|
|
29303
|
+
|
|
29304
|
+
// ../../modules/vault/contract/src/vault-oauth.ts
|
|
29305
|
+
var tokenFieldsSchema = external_exports.object({
|
|
29306
|
+
access_token: external_exports.string().min(1).optional(),
|
|
29307
|
+
refresh_token: external_exports.string().min(1).optional(),
|
|
29308
|
+
expires_in: external_exports.coerce.number().positive().optional(),
|
|
29309
|
+
scope: external_exports.string().optional(),
|
|
29310
|
+
token_type: external_exports.string().optional()
|
|
29311
|
+
});
|
|
29312
|
+
var oauthTokenResponseSchemaDefinition = external_exports.object({
|
|
29313
|
+
...tokenFieldsSchema.shape,
|
|
29314
|
+
ok: external_exports.boolean().optional(),
|
|
29315
|
+
error: external_exports.string().optional(),
|
|
29316
|
+
error_description: external_exports.string().optional(),
|
|
29317
|
+
authed_user: tokenFieldsSchema.optional()
|
|
29318
|
+
});
|
|
29319
|
+
|
|
29320
|
+
// ../../modules/vault/contract/src/sealing.ts
|
|
29321
|
+
var subtle = () => globalThis.crypto.subtle;
|
|
29322
|
+
var IV_BYTES = 12;
|
|
29323
|
+
var P256 = { name: "ECDH", namedCurve: "P-256" };
|
|
29324
|
+
var text = new TextEncoder();
|
|
29325
|
+
function toBase64Url(bytes) {
|
|
29326
|
+
let binary = "";
|
|
29327
|
+
for (const byte of bytes) binary += String.fromCharCode(byte);
|
|
29328
|
+
return btoa(binary).replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/, "");
|
|
29329
|
+
}
|
|
29330
|
+
function fromBase64Url(value) {
|
|
29331
|
+
const binary = atob(value.replaceAll("-", "+").replaceAll("_", "/"));
|
|
29332
|
+
const bytes = new Uint8Array(binary.length);
|
|
29333
|
+
for (let index = 0; index < binary.length; index += 1) bytes[index] = binary.charCodeAt(index);
|
|
29334
|
+
return bytes;
|
|
29335
|
+
}
|
|
29336
|
+
var concat = (...parts) => {
|
|
29337
|
+
const out = new Uint8Array(parts.reduce((sum, part) => sum + part.length, 0));
|
|
29338
|
+
let offset = 0;
|
|
29339
|
+
for (const part of parts) {
|
|
29340
|
+
out.set(part, offset);
|
|
29341
|
+
offset += part.length;
|
|
29342
|
+
}
|
|
29343
|
+
return out;
|
|
29344
|
+
};
|
|
29345
|
+
async function hkdfKey(input2) {
|
|
29346
|
+
const base = await subtle().importKey("raw", input2.ikm, "HKDF", false, ["deriveKey"]);
|
|
29347
|
+
return subtle().deriveKey(
|
|
29348
|
+
{ name: "HKDF", hash: "SHA-256", salt: input2.salt, info: text.encode(input2.info) },
|
|
29349
|
+
base,
|
|
29350
|
+
{ name: "AES-GCM", length: 256 },
|
|
29351
|
+
false,
|
|
29352
|
+
["encrypt", "decrypt"]
|
|
29353
|
+
);
|
|
29354
|
+
}
|
|
29355
|
+
async function gcmOpen(input2) {
|
|
29356
|
+
try {
|
|
29357
|
+
const plain = await subtle().decrypt(
|
|
29358
|
+
{
|
|
29359
|
+
name: "AES-GCM",
|
|
29360
|
+
iv: input2.sealed.subarray(0, IV_BYTES),
|
|
29361
|
+
additionalData: text.encode(input2.aad)
|
|
29362
|
+
},
|
|
29363
|
+
input2.key,
|
|
29364
|
+
input2.sealed.subarray(IV_BYTES)
|
|
29365
|
+
);
|
|
29366
|
+
return new Uint8Array(plain);
|
|
29367
|
+
} catch {
|
|
29368
|
+
throw new VaultSealMismatchError();
|
|
29369
|
+
}
|
|
29370
|
+
}
|
|
29371
|
+
var importPublic = (raw) => subtle().importKey("raw", raw, P256, true, []);
|
|
29372
|
+
async function sharedSecret(input2) {
|
|
29373
|
+
const bits = await subtle().deriveBits(
|
|
29374
|
+
{ name: "ECDH", public: await importPublic(input2.publicKey) },
|
|
29375
|
+
input2.privateKey,
|
|
29376
|
+
256
|
|
29377
|
+
);
|
|
29378
|
+
return new Uint8Array(bits);
|
|
29379
|
+
}
|
|
29380
|
+
async function decryptFrom(input2) {
|
|
29381
|
+
const epk = fromBase64Url(input2.epk);
|
|
29382
|
+
const ikm = await sharedSecret({ privateKey: input2.privateKey, publicKey: epk });
|
|
29383
|
+
const key = await hkdfKey({ ikm, salt: concat(epk, input2.publicKey), info: input2.info });
|
|
29384
|
+
return gcmOpen({ key, sealed: fromBase64Url(input2.sealed), aad: input2.aad });
|
|
29385
|
+
}
|
|
29386
|
+
async function generateEcdhKeys() {
|
|
29387
|
+
const pair = await subtle().generateKey(P256, true, ["deriveBits"]);
|
|
29388
|
+
const raw = new Uint8Array(await subtle().exportKey("raw", pair.publicKey));
|
|
29389
|
+
return { publicKey: toBase64Url(raw), privateKey: pair.privateKey };
|
|
29390
|
+
}
|
|
29391
|
+
function fieldsOf(value) {
|
|
29392
|
+
if (typeof value !== "object" || value === null) throw new VaultSealMismatchError();
|
|
29393
|
+
const entries = Object.entries(value);
|
|
29394
|
+
if (entries.some(([, field]) => typeof field !== "string")) throw new VaultSealMismatchError();
|
|
29395
|
+
return Object.fromEntries(entries);
|
|
29396
|
+
}
|
|
29397
|
+
var releaseLabel = (requestId) => `laze-vault/release/v1/${requestId}`;
|
|
29398
|
+
async function openRunRelease(input2) {
|
|
29399
|
+
const plain = await decryptFrom({
|
|
29400
|
+
privateKey: input2.runPrivateKey,
|
|
29401
|
+
publicKey: fromBase64Url(input2.runPublicKey),
|
|
29402
|
+
epk: input2.release.epk,
|
|
29403
|
+
sealed: input2.release.ciphertext,
|
|
29404
|
+
info: releaseLabel(input2.requestId),
|
|
29405
|
+
aad: releaseLabel(input2.requestId)
|
|
29406
|
+
});
|
|
29407
|
+
return fieldsOf(JSON.parse(new TextDecoder().decode(plain)).fields);
|
|
29408
|
+
}
|
|
29409
|
+
|
|
29410
|
+
// src/services/vault-commands.service.ts
|
|
28733
29411
|
var USAGE6 = `Usage: laze vault run <connection> --reason "<one plain sentence>" [--wait <s>] -- <command> [args...]
|
|
28734
29412
|
Runs the command with the connection's values in its environment, inside a Laze agent's sandbox.`;
|
|
28735
29413
|
var POLL_MS = 3e3;
|
|
@@ -28760,7 +29438,8 @@ async function askRelease({
|
|
|
28760
29438
|
context,
|
|
28761
29439
|
connection,
|
|
28762
29440
|
reason,
|
|
28763
|
-
command
|
|
29441
|
+
command,
|
|
29442
|
+
recipient
|
|
28764
29443
|
}) {
|
|
28765
29444
|
const env = context.environment.inherited;
|
|
28766
29445
|
const proxy = proxyOf({ env });
|
|
@@ -28771,18 +29450,31 @@ async function askRelease({
|
|
|
28771
29450
|
"proxy-authorization": proxy.authorization,
|
|
28772
29451
|
"x-laze-turn": await turnTokenOf({ env })
|
|
28773
29452
|
},
|
|
28774
|
-
body: JSON.stringify({ connection, reason, command })
|
|
29453
|
+
body: JSON.stringify({ connection, reason, command, recipient })
|
|
28775
29454
|
});
|
|
28776
|
-
const
|
|
29455
|
+
const text2 = await response.text();
|
|
28777
29456
|
if (!response.ok) {
|
|
28778
|
-
const code = /"code"\s*:\s*"([^"]+)"/.exec(
|
|
29457
|
+
const code = /"code"\s*:\s*"([^"]+)"/.exec(text2)?.[1] ?? `status ${response.status}`;
|
|
28779
29458
|
return {
|
|
28780
29459
|
outcome: "deny",
|
|
28781
29460
|
exitCode: 1,
|
|
28782
29461
|
message: `laze vault: the release was refused (${code})`
|
|
28783
29462
|
};
|
|
28784
29463
|
}
|
|
28785
|
-
return JSON.parse(
|
|
29464
|
+
return JSON.parse(text2);
|
|
29465
|
+
}
|
|
29466
|
+
async function envOf({
|
|
29467
|
+
release,
|
|
29468
|
+
run
|
|
29469
|
+
}) {
|
|
29470
|
+
if (!release.sealed) return release.env;
|
|
29471
|
+
const sealed = await openRunRelease({
|
|
29472
|
+
release: release.sealed,
|
|
29473
|
+
runPrivateKey: run.privateKey,
|
|
29474
|
+
runPublicKey: run.publicKey,
|
|
29475
|
+
requestId: release.sealed.requestId
|
|
29476
|
+
});
|
|
29477
|
+
return { ...release.env, ...sealed };
|
|
28786
29478
|
}
|
|
28787
29479
|
async function vaultRun({
|
|
28788
29480
|
context,
|
|
@@ -28796,10 +29488,17 @@ ${USAGE6}`);
|
|
|
28796
29488
|
const waitSeconds = Number(flagText({ args, name: "wait", fallback: `${DEFAULT_WAIT_SECONDS}` }));
|
|
28797
29489
|
const deadline = context.nowMs() + Math.max(0, waitSeconds) * 1e3;
|
|
28798
29490
|
let told = false;
|
|
29491
|
+
const run = await generateEcdhKeys();
|
|
28799
29492
|
for (; ; ) {
|
|
28800
|
-
const release = await askRelease({
|
|
29493
|
+
const release = await askRelease({
|
|
29494
|
+
context,
|
|
29495
|
+
connection,
|
|
29496
|
+
reason,
|
|
29497
|
+
command: args.rest,
|
|
29498
|
+
recipient: run.publicKey
|
|
29499
|
+
});
|
|
28801
29500
|
if (release.outcome === "allow") {
|
|
28802
|
-
return context.runCommand({ command: args.rest, env: release
|
|
29501
|
+
return context.runCommand({ command: args.rest, env: await envOf({ release, run }) });
|
|
28803
29502
|
}
|
|
28804
29503
|
if (release.outcome === "deny") {
|
|
28805
29504
|
context.err(`${release.message}
|
|
@@ -28883,8 +29582,8 @@ async function wikiSearch({ context, args }) {
|
|
|
28883
29582
|
}
|
|
28884
29583
|
var WIKI_COMMANDS = { list: wikiList, get: wikiGet, put: wikiPut, search: wikiSearch };
|
|
28885
29584
|
async function wiki({ context, args }) {
|
|
28886
|
-
const
|
|
28887
|
-
const command = Object.hasOwn(WIKI_COMMANDS,
|
|
29585
|
+
const name2 = args.words[1] ?? "";
|
|
29586
|
+
const command = Object.hasOwn(WIKI_COMMANDS, name2) ? WIKI_COMMANDS[name2] : void 0;
|
|
28888
29587
|
if (!command) throw new CliUsageError(USAGE7);
|
|
28889
29588
|
await command({ context, args });
|
|
28890
29589
|
}
|
|
@@ -29013,8 +29712,8 @@ if (true) {
|
|
|
29013
29712
|
program: [process.execPath, ...process.execArgv, process.argv[1] ?? ""],
|
|
29014
29713
|
store: ConfigStore.create({ path: environment.configPath }),
|
|
29015
29714
|
fetcher: (input2, init) => fetch(input2, init),
|
|
29016
|
-
out: (
|
|
29017
|
-
err: (
|
|
29715
|
+
out: (text2) => void process.stdout.write(text2),
|
|
29716
|
+
err: (text2) => void process.stderr.write(text2),
|
|
29018
29717
|
readStdin,
|
|
29019
29718
|
sleep: (ms) => new Promise((resolve6) => setTimeout(resolve6, ms)),
|
|
29020
29719
|
nowMs: () => nowInstant().epochMilliseconds,
|