@lazehq/cli 0.1.103 → 0.1.104
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/laze.mjs +545 -284
- package/package.json +1 -1
package/dist/laze.mjs
CHANGED
|
@@ -5926,8 +5926,8 @@ var require_util = __commonJS({
|
|
|
5926
5926
|
const rawHeaders = [];
|
|
5927
5927
|
for (const [name3, value] of Object.entries(headers)) {
|
|
5928
5928
|
if (Array.isArray(value)) {
|
|
5929
|
-
for (const
|
|
5930
|
-
rawHeaders.push(name3, `${
|
|
5929
|
+
for (const entry2 of value) {
|
|
5930
|
+
rawHeaders.push(name3, `${entry2}`);
|
|
5931
5931
|
}
|
|
5932
5932
|
} else {
|
|
5933
5933
|
rawHeaders.push(name3, `${value}`);
|
|
@@ -5953,8 +5953,8 @@ var require_util = __commonJS({
|
|
|
5953
5953
|
const rawHeaders = [];
|
|
5954
5954
|
for (const [name3, value] of Object.entries(headers)) {
|
|
5955
5955
|
if (Array.isArray(value)) {
|
|
5956
|
-
for (const
|
|
5957
|
-
rawHeaders.push(Buffer.from(name3, "latin1"), Buffer.from(`${
|
|
5956
|
+
for (const entry2 of value) {
|
|
5957
|
+
rawHeaders.push(Buffer.from(name3, "latin1"), Buffer.from(`${entry2}`, "latin1"));
|
|
5958
5958
|
}
|
|
5959
5959
|
} else {
|
|
5960
5960
|
rawHeaders.push(Buffer.from(name3, "latin1"), Buffer.from(`${value}`, "latin1"));
|
|
@@ -10391,22 +10391,22 @@ var require_formdata = __commonJS({
|
|
|
10391
10391
|
} else {
|
|
10392
10392
|
value = webidl.converters.USVString(value);
|
|
10393
10393
|
}
|
|
10394
|
-
const
|
|
10395
|
-
this.#state.push(
|
|
10394
|
+
const entry2 = makeEntry(name3, value, filename);
|
|
10395
|
+
this.#state.push(entry2);
|
|
10396
10396
|
}
|
|
10397
10397
|
delete(name3) {
|
|
10398
10398
|
webidl.brandCheck(this, _FormData);
|
|
10399
10399
|
const prefix = "FormData.delete";
|
|
10400
10400
|
webidl.argumentLengthCheck(arguments, 1, prefix);
|
|
10401
10401
|
name3 = webidl.converters.USVString(name3);
|
|
10402
|
-
this.#state = this.#state.filter((
|
|
10402
|
+
this.#state = this.#state.filter((entry2) => entry2.name !== name3);
|
|
10403
10403
|
}
|
|
10404
10404
|
get(name3) {
|
|
10405
10405
|
webidl.brandCheck(this, _FormData);
|
|
10406
10406
|
const prefix = "FormData.get";
|
|
10407
10407
|
webidl.argumentLengthCheck(arguments, 1, prefix);
|
|
10408
10408
|
name3 = webidl.converters.USVString(name3);
|
|
10409
|
-
const idx = this.#state.findIndex((
|
|
10409
|
+
const idx = this.#state.findIndex((entry2) => entry2.name === name3);
|
|
10410
10410
|
if (idx === -1) {
|
|
10411
10411
|
return null;
|
|
10412
10412
|
}
|
|
@@ -10417,14 +10417,14 @@ var require_formdata = __commonJS({
|
|
|
10417
10417
|
const prefix = "FormData.getAll";
|
|
10418
10418
|
webidl.argumentLengthCheck(arguments, 1, prefix);
|
|
10419
10419
|
name3 = webidl.converters.USVString(name3);
|
|
10420
|
-
return this.#state.filter((
|
|
10420
|
+
return this.#state.filter((entry2) => entry2.name === name3).map((entry2) => entry2.value);
|
|
10421
10421
|
}
|
|
10422
10422
|
has(name3) {
|
|
10423
10423
|
webidl.brandCheck(this, _FormData);
|
|
10424
10424
|
const prefix = "FormData.has";
|
|
10425
10425
|
webidl.argumentLengthCheck(arguments, 1, prefix);
|
|
10426
10426
|
name3 = webidl.converters.USVString(name3);
|
|
10427
|
-
return this.#state.findIndex((
|
|
10427
|
+
return this.#state.findIndex((entry2) => entry2.name === name3) !== -1;
|
|
10428
10428
|
}
|
|
10429
10429
|
set(name3, value, filename = void 0) {
|
|
10430
10430
|
webidl.brandCheck(this, _FormData);
|
|
@@ -10439,16 +10439,16 @@ var require_formdata = __commonJS({
|
|
|
10439
10439
|
} else {
|
|
10440
10440
|
value = webidl.converters.USVString(value);
|
|
10441
10441
|
}
|
|
10442
|
-
const
|
|
10443
|
-
const idx = this.#state.findIndex((
|
|
10442
|
+
const entry2 = makeEntry(name3, value, filename);
|
|
10443
|
+
const idx = this.#state.findIndex((entry3) => entry3.name === name3);
|
|
10444
10444
|
if (idx !== -1) {
|
|
10445
10445
|
this.#state = [
|
|
10446
10446
|
...this.#state.slice(0, idx),
|
|
10447
|
-
|
|
10448
|
-
...this.#state.slice(idx + 1).filter((
|
|
10447
|
+
entry2,
|
|
10448
|
+
...this.#state.slice(idx + 1).filter((entry3) => entry3.name !== name3)
|
|
10449
10449
|
];
|
|
10450
10450
|
} else {
|
|
10451
|
-
this.#state.push(
|
|
10451
|
+
this.#state.push(entry2);
|
|
10452
10452
|
}
|
|
10453
10453
|
}
|
|
10454
10454
|
[nodeUtil.inspect.custom](depth, options) {
|
|
@@ -16262,14 +16262,14 @@ var require_env_http_proxy_agent = __commonJS({
|
|
|
16262
16262
|
return false;
|
|
16263
16263
|
}
|
|
16264
16264
|
for (let i = 0; i < this.#noProxyEntries.length; i++) {
|
|
16265
|
-
const
|
|
16266
|
-
if (
|
|
16265
|
+
const entry2 = this.#noProxyEntries[i];
|
|
16266
|
+
if (entry2.port && entry2.port !== port) {
|
|
16267
16267
|
continue;
|
|
16268
16268
|
}
|
|
16269
|
-
if (hostname8 ===
|
|
16269
|
+
if (hostname8 === entry2.hostname) {
|
|
16270
16270
|
return false;
|
|
16271
16271
|
}
|
|
16272
|
-
if (hostname8.slice(-(
|
|
16272
|
+
if (hostname8.slice(-(entry2.hostname.length + 1)) === `.${entry2.hostname}`) {
|
|
16273
16273
|
return false;
|
|
16274
16274
|
}
|
|
16275
16275
|
}
|
|
@@ -16280,17 +16280,17 @@ var require_env_http_proxy_agent = __commonJS({
|
|
|
16280
16280
|
const noProxySplit = noProxyValue.split(/[,\s]/);
|
|
16281
16281
|
const noProxyEntries = [];
|
|
16282
16282
|
for (let i = 0; i < noProxySplit.length; i++) {
|
|
16283
|
-
const
|
|
16284
|
-
if (!
|
|
16283
|
+
const entry2 = noProxySplit[i];
|
|
16284
|
+
if (!entry2) {
|
|
16285
16285
|
continue;
|
|
16286
16286
|
}
|
|
16287
16287
|
let hostname8, port;
|
|
16288
|
-
const ipv6WithPort =
|
|
16288
|
+
const ipv6WithPort = entry2.match(/^\[(.+)\]:(\d+)$/);
|
|
16289
16289
|
if (ipv6WithPort) {
|
|
16290
16290
|
hostname8 = ipv6WithPort[1];
|
|
16291
16291
|
port = Number.parseInt(ipv6WithPort[2], 10);
|
|
16292
16292
|
} else {
|
|
16293
|
-
const unbracketed =
|
|
16293
|
+
const unbracketed = entry2.replace(/^\[(.+)\]$/, "$1");
|
|
16294
16294
|
const colonCount = (unbracketed.match(/:/g) || []).length;
|
|
16295
16295
|
const parsed = colonCount === 1 && unbracketed.match(/^(.+):(\d+)$/);
|
|
16296
16296
|
hostname8 = parsed ? parsed[1] : unbracketed;
|
|
@@ -22731,18 +22731,18 @@ var require_memory_cache_store = __commonJS({
|
|
|
22731
22731
|
const topLevelKey = `${key.origin}:${key.path}`;
|
|
22732
22732
|
const now = Date.now();
|
|
22733
22733
|
const entries = this.#entries.get(topLevelKey);
|
|
22734
|
-
const
|
|
22735
|
-
return
|
|
22736
|
-
statusMessage:
|
|
22737
|
-
statusCode:
|
|
22738
|
-
headers:
|
|
22739
|
-
body:
|
|
22740
|
-
vary:
|
|
22741
|
-
etag:
|
|
22742
|
-
cacheControlDirectives:
|
|
22743
|
-
cachedAt:
|
|
22744
|
-
staleAt:
|
|
22745
|
-
deleteAt:
|
|
22734
|
+
const entry2 = entries ? findEntry(key, entries, now) : null;
|
|
22735
|
+
return entry2 == null ? void 0 : {
|
|
22736
|
+
statusMessage: entry2.statusMessage,
|
|
22737
|
+
statusCode: entry2.statusCode,
|
|
22738
|
+
headers: entry2.headers,
|
|
22739
|
+
body: entry2.body,
|
|
22740
|
+
vary: entry2.vary ? entry2.vary : void 0,
|
|
22741
|
+
etag: entry2.etag,
|
|
22742
|
+
cacheControlDirectives: entry2.cacheControlDirectives,
|
|
22743
|
+
cachedAt: entry2.cachedAt,
|
|
22744
|
+
staleAt: entry2.staleAt,
|
|
22745
|
+
deleteAt: entry2.deleteAt
|
|
22746
22746
|
};
|
|
22747
22747
|
}
|
|
22748
22748
|
/**
|
|
@@ -22755,17 +22755,17 @@ var require_memory_cache_store = __commonJS({
|
|
|
22755
22755
|
assertCacheValue(val);
|
|
22756
22756
|
const topLevelKey = `${key.origin}:${key.path}`;
|
|
22757
22757
|
const store = this;
|
|
22758
|
-
const
|
|
22758
|
+
const entry2 = { ...key, ...val, body: [], size: 0 };
|
|
22759
22759
|
return new Writable({
|
|
22760
22760
|
write(chunk, encoding, callback) {
|
|
22761
22761
|
if (typeof chunk === "string") {
|
|
22762
22762
|
chunk = Buffer.from(chunk, encoding);
|
|
22763
22763
|
}
|
|
22764
|
-
|
|
22765
|
-
if (
|
|
22764
|
+
entry2.size += chunk.byteLength;
|
|
22765
|
+
if (entry2.size > store.#maxEntrySize) {
|
|
22766
22766
|
this.destroy();
|
|
22767
22767
|
} else {
|
|
22768
|
-
|
|
22768
|
+
entry2.body.push(chunk);
|
|
22769
22769
|
}
|
|
22770
22770
|
callback(null);
|
|
22771
22771
|
},
|
|
@@ -22778,13 +22778,13 @@ var require_memory_cache_store = __commonJS({
|
|
|
22778
22778
|
const previousEntry = findEntry(key, entries, Date.now());
|
|
22779
22779
|
if (previousEntry) {
|
|
22780
22780
|
const index = entries.indexOf(previousEntry);
|
|
22781
|
-
entries.splice(index, 1,
|
|
22781
|
+
entries.splice(index, 1, entry2);
|
|
22782
22782
|
store.#size -= previousEntry.size;
|
|
22783
22783
|
} else {
|
|
22784
|
-
entries.push(
|
|
22784
|
+
entries.push(entry2);
|
|
22785
22785
|
store.#count += 1;
|
|
22786
22786
|
}
|
|
22787
|
-
store.#size +=
|
|
22787
|
+
store.#size += entry2.size;
|
|
22788
22788
|
if (store.#size > store.#maxSize || store.#count > store.#maxCount) {
|
|
22789
22789
|
if (!store.#hasEmittedMaxSizeEvent) {
|
|
22790
22790
|
store.emit("maxSizeExceeded", {
|
|
@@ -22796,8 +22796,8 @@ var require_memory_cache_store = __commonJS({
|
|
|
22796
22796
|
store.#hasEmittedMaxSizeEvent = true;
|
|
22797
22797
|
}
|
|
22798
22798
|
for (const [key2, entries2] of store.#entries) {
|
|
22799
|
-
for (const
|
|
22800
|
-
store.#size -=
|
|
22799
|
+
for (const entry3 of entries2.splice(0, entries2.length / 2)) {
|
|
22800
|
+
store.#size -= entry3.size;
|
|
22801
22801
|
store.#count -= 1;
|
|
22802
22802
|
}
|
|
22803
22803
|
if (entries2.length === 0) {
|
|
@@ -22820,8 +22820,8 @@ var require_memory_cache_store = __commonJS({
|
|
|
22820
22820
|
throw new TypeError(`expected key to be object, got ${typeof key}`);
|
|
22821
22821
|
}
|
|
22822
22822
|
const topLevelKey = `${key.origin}:${key.path}`;
|
|
22823
|
-
for (const
|
|
22824
|
-
this.#size -=
|
|
22823
|
+
for (const entry2 of this.#entries.get(topLevelKey) ?? []) {
|
|
22824
|
+
this.#size -= entry2.size;
|
|
22825
22825
|
this.#count -= 1;
|
|
22826
22826
|
}
|
|
22827
22827
|
this.#entries.delete(topLevelKey);
|
|
@@ -22829,18 +22829,18 @@ var require_memory_cache_store = __commonJS({
|
|
|
22829
22829
|
};
|
|
22830
22830
|
function findEntry(key, entries, now) {
|
|
22831
22831
|
for (let i = 0; i < entries.length; i++) {
|
|
22832
|
-
const
|
|
22833
|
-
if (
|
|
22834
|
-
return
|
|
22832
|
+
const entry2 = entries[i];
|
|
22833
|
+
if (entry2.deleteAt > now && entry2.method === key.method && varyMatches(key, entry2)) {
|
|
22834
|
+
return entry2;
|
|
22835
22835
|
}
|
|
22836
22836
|
}
|
|
22837
22837
|
}
|
|
22838
|
-
function varyMatches(key,
|
|
22839
|
-
if (
|
|
22838
|
+
function varyMatches(key, entry2) {
|
|
22839
|
+
if (entry2.vary == null) {
|
|
22840
22840
|
return true;
|
|
22841
22841
|
}
|
|
22842
|
-
for (const headerName in
|
|
22843
|
-
if (Object.hasOwn(
|
|
22842
|
+
for (const headerName in entry2.vary) {
|
|
22843
|
+
if (Object.hasOwn(entry2.vary, headerName) && !headerValueEquals(key.headers?.[headerName], entry2.vary[headerName])) {
|
|
22844
22844
|
return false;
|
|
22845
22845
|
}
|
|
22846
22846
|
}
|
|
@@ -26321,8 +26321,8 @@ var require_fetch = __commonJS({
|
|
|
26321
26321
|
}
|
|
26322
26322
|
for (const [name3, value] of Object.entries(headers ?? {})) {
|
|
26323
26323
|
if (Array.isArray(value)) {
|
|
26324
|
-
for (const
|
|
26325
|
-
headersList.append(name3, `${
|
|
26324
|
+
for (const entry2 of value) {
|
|
26325
|
+
headersList.append(name3, `${entry2}`, true);
|
|
26326
26326
|
}
|
|
26327
26327
|
} else {
|
|
26328
26328
|
headersList.append(name3, `${value}`, true);
|
|
@@ -31077,15 +31077,15 @@ ${value}`;
|
|
|
31077
31077
|
pos = 0;
|
|
31078
31078
|
}
|
|
31079
31079
|
}
|
|
31080
|
-
discardLeadingBytes(
|
|
31081
|
-
while (
|
|
31080
|
+
discardLeadingBytes(count6) {
|
|
31081
|
+
while (count6 > 0 && this.lineChunkIndex < this.chunks.length) {
|
|
31082
31082
|
const chunk = this.chunks[this.lineChunkIndex];
|
|
31083
31083
|
const remaining = chunk.length - this.linePos;
|
|
31084
|
-
if (
|
|
31085
|
-
this.linePos +=
|
|
31086
|
-
|
|
31084
|
+
if (count6 < remaining) {
|
|
31085
|
+
this.linePos += count6;
|
|
31086
|
+
count6 = 0;
|
|
31087
31087
|
} else {
|
|
31088
|
-
|
|
31088
|
+
count6 -= remaining;
|
|
31089
31089
|
this.lineChunkIndex++;
|
|
31090
31090
|
this.linePos = 0;
|
|
31091
31091
|
}
|
|
@@ -31834,8 +31834,8 @@ function shannonEntropyBits(value) {
|
|
|
31834
31834
|
const counts = /* @__PURE__ */ new Map();
|
|
31835
31835
|
for (const char of sample) counts.set(char, (counts.get(char) ?? 0) + 1);
|
|
31836
31836
|
let entropy = 0;
|
|
31837
|
-
for (const
|
|
31838
|
-
const p =
|
|
31837
|
+
for (const count6 of counts.values()) {
|
|
31838
|
+
const p = count6 / sample.length;
|
|
31839
31839
|
entropy -= p * Math.log2(p);
|
|
31840
31840
|
}
|
|
31841
31841
|
return entropy;
|
|
@@ -36960,7 +36960,7 @@ function shadowedLinkLineOf({ shadow }) {
|
|
|
36960
36960
|
}
|
|
36961
36961
|
|
|
36962
36962
|
// src/rules/cli-version.rules.ts
|
|
36963
|
-
var STAMPED = "0.1.
|
|
36963
|
+
var STAMPED = "0.1.104";
|
|
36964
36964
|
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
36965
36965
|
return stamped.startsWith("__") ? "dev" : stamped;
|
|
36966
36966
|
}
|
|
@@ -38724,14 +38724,14 @@ function codePointLength(str) {
|
|
|
38724
38724
|
const units = str.length;
|
|
38725
38725
|
if (!highSurrogate.test(str))
|
|
38726
38726
|
return units;
|
|
38727
|
-
let
|
|
38727
|
+
let count6 = units;
|
|
38728
38728
|
for (let i = 0; i < units - 1; i++) {
|
|
38729
38729
|
if ((str.charCodeAt(i) & 64512) === 55296 && (str.charCodeAt(i + 1) & 64512) === 56320) {
|
|
38730
|
-
|
|
38730
|
+
count6--;
|
|
38731
38731
|
i++;
|
|
38732
38732
|
}
|
|
38733
38733
|
}
|
|
38734
|
-
return
|
|
38734
|
+
return count6;
|
|
38735
38735
|
}
|
|
38736
38736
|
function getLengthableOrigin(input2) {
|
|
38737
38737
|
if (Array.isArray(input2))
|
|
@@ -42692,9 +42692,9 @@ var memo = {
|
|
|
42692
42692
|
if (!bucket)
|
|
42693
42693
|
return empty;
|
|
42694
42694
|
handoff = void 0;
|
|
42695
|
-
const
|
|
42696
|
-
bucket.set(payload.value,
|
|
42697
|
-
open2.push(
|
|
42695
|
+
const entry2 = { value: empty, issues: null };
|
|
42696
|
+
bucket.set(payload.value, entry2);
|
|
42697
|
+
open2.push(entry2);
|
|
42698
42698
|
return empty;
|
|
42699
42699
|
},
|
|
42700
42700
|
guard(inst) {
|
|
@@ -42768,16 +42768,16 @@ var memo = {
|
|
|
42768
42768
|
const depth = open2.length;
|
|
42769
42769
|
const result2 = base(payload, ctx);
|
|
42770
42770
|
handoff = void 0;
|
|
42771
|
-
const
|
|
42771
|
+
const entry2 = open2.length > depth ? open2.pop() : void 0;
|
|
42772
42772
|
if (result2 instanceof Promise) {
|
|
42773
42773
|
return result2.then((r) => {
|
|
42774
|
-
if (
|
|
42775
|
-
|
|
42774
|
+
if (entry2)
|
|
42775
|
+
entry2.issues = r.issues.length ? cloneIssues(r.issues) : NO_ISSUES;
|
|
42776
42776
|
return r;
|
|
42777
42777
|
});
|
|
42778
42778
|
}
|
|
42779
|
-
if (
|
|
42780
|
-
|
|
42779
|
+
if (entry2)
|
|
42780
|
+
entry2.issues = result2.issues.length ? cloneIssues(result2.issues) : NO_ISSUES;
|
|
42781
42781
|
return result2;
|
|
42782
42782
|
};
|
|
42783
42783
|
inst._zod.parse = wrapped;
|
|
@@ -43086,8 +43086,8 @@ function az_default() {
|
|
|
43086
43086
|
}
|
|
43087
43087
|
|
|
43088
43088
|
// ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/be.js
|
|
43089
|
-
function getBelarusianPlural(
|
|
43090
|
-
const absCount = Math.abs(
|
|
43089
|
+
function getBelarusianPlural(count6, one, few, many) {
|
|
43090
|
+
const absCount = Math.abs(count6);
|
|
43091
43091
|
const lastDigit = absCount % 10;
|
|
43092
43092
|
const lastTwoDigits = absCount % 100;
|
|
43093
43093
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -45734,8 +45734,8 @@ function hu_default() {
|
|
|
45734
45734
|
}
|
|
45735
45735
|
|
|
45736
45736
|
// ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/hy.js
|
|
45737
|
-
function getArmenianPlural(
|
|
45738
|
-
return Math.abs(
|
|
45737
|
+
function getArmenianPlural(count6, one, many) {
|
|
45738
|
+
return Math.abs(count6) === 1 ? one : many;
|
|
45739
45739
|
}
|
|
45740
45740
|
function withDefiniteArticle(word3) {
|
|
45741
45741
|
if (!word3)
|
|
@@ -48473,8 +48473,8 @@ function ro_default() {
|
|
|
48473
48473
|
}
|
|
48474
48474
|
|
|
48475
48475
|
// ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ru.js
|
|
48476
|
-
function getRussianPlural(
|
|
48477
|
-
const absCount = Math.abs(
|
|
48476
|
+
function getRussianPlural(count6, one, few, many) {
|
|
48477
|
+
const absCount = Math.abs(count6);
|
|
48478
48478
|
const lastDigit = absCount % 10;
|
|
48479
48479
|
const lastTwoDigits = absCount % 100;
|
|
48480
48480
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -53183,42 +53183,42 @@ function extractDefs(ctx, schema) {
|
|
|
53183
53183
|
if (ctx.external && ctx.sharedDefsExtractedFor === ctx.external)
|
|
53184
53184
|
return;
|
|
53185
53185
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
53186
|
-
for (const
|
|
53187
|
-
const id4 = ctx.metadataRegistry.get(
|
|
53186
|
+
for (const entry2 of ctx.seen.entries()) {
|
|
53187
|
+
const id4 = ctx.metadataRegistry.get(entry2[0])?.id;
|
|
53188
53188
|
if (id4) {
|
|
53189
53189
|
const existing = idToSchema.get(id4);
|
|
53190
|
-
if (existing && existing !==
|
|
53190
|
+
if (existing && existing !== entry2[0]) {
|
|
53191
53191
|
throw new Error(`Duplicate schema id "${id4}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
53192
53192
|
}
|
|
53193
|
-
idToSchema.set(id4,
|
|
53193
|
+
idToSchema.set(id4, entry2[0]);
|
|
53194
53194
|
}
|
|
53195
53195
|
}
|
|
53196
|
-
const makeURI = (
|
|
53196
|
+
const makeURI = (entry2) => {
|
|
53197
53197
|
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
53198
53198
|
if (ctx.external) {
|
|
53199
|
-
const externalId = ctx.external.registry.get(
|
|
53199
|
+
const externalId = ctx.external.registry.get(entry2[0])?.id;
|
|
53200
53200
|
const uriGenerator = ctx.external.uri ?? ((id5) => id5);
|
|
53201
53201
|
if (externalId) {
|
|
53202
53202
|
return { ref: uriGenerator(externalId) };
|
|
53203
53203
|
}
|
|
53204
|
-
const id4 =
|
|
53205
|
-
|
|
53204
|
+
const id4 = entry2[1].defId ?? entry2[1].schema.id ?? `schema${ctx.counter++}`;
|
|
53205
|
+
entry2[1].defId = id4;
|
|
53206
53206
|
return { defId: id4, ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id4)}` };
|
|
53207
53207
|
}
|
|
53208
53208
|
const uriPrefix = `#`;
|
|
53209
53209
|
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
53210
|
-
if (
|
|
53210
|
+
if (entry2[1] === root && !entry2[1].schema.id) {
|
|
53211
53211
|
return { ref: uriPrefix };
|
|
53212
53212
|
}
|
|
53213
|
-
const defId =
|
|
53213
|
+
const defId = entry2[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
53214
53214
|
return { defId, ref: defUriPrefix + encodeJSONPointerSegment(defId) };
|
|
53215
53215
|
};
|
|
53216
|
-
const extractToDef = (
|
|
53217
|
-
if (
|
|
53216
|
+
const extractToDef = (entry2) => {
|
|
53217
|
+
if (entry2[1].schema.$ref) {
|
|
53218
53218
|
return;
|
|
53219
53219
|
}
|
|
53220
|
-
const seen =
|
|
53221
|
-
const { ref, defId } = makeURI(
|
|
53220
|
+
const seen = entry2[1];
|
|
53221
|
+
const { ref, defId } = makeURI(entry2);
|
|
53222
53222
|
seen.def = { ...seen.schema };
|
|
53223
53223
|
if (defId)
|
|
53224
53224
|
seen.defId = defId;
|
|
@@ -53229,8 +53229,8 @@ function extractDefs(ctx, schema) {
|
|
|
53229
53229
|
schema2.$ref = ref;
|
|
53230
53230
|
};
|
|
53231
53231
|
if (ctx.cycles === "throw") {
|
|
53232
|
-
for (const
|
|
53233
|
-
const seen =
|
|
53232
|
+
for (const entry2 of ctx.seen.entries()) {
|
|
53233
|
+
const seen = entry2[1];
|
|
53234
53234
|
if (seen.cycle) {
|
|
53235
53235
|
throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
|
|
53236
53236
|
|
|
@@ -53238,31 +53238,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
53238
53238
|
}
|
|
53239
53239
|
}
|
|
53240
53240
|
}
|
|
53241
|
-
for (const
|
|
53242
|
-
const seen =
|
|
53243
|
-
if (schema ===
|
|
53244
|
-
extractToDef(
|
|
53241
|
+
for (const entry2 of ctx.seen.entries()) {
|
|
53242
|
+
const seen = entry2[1];
|
|
53243
|
+
if (schema === entry2[0]) {
|
|
53244
|
+
extractToDef(entry2);
|
|
53245
53245
|
continue;
|
|
53246
53246
|
}
|
|
53247
53247
|
if (ctx.external) {
|
|
53248
|
-
const ext = ctx.external.registry.get(
|
|
53249
|
-
if (schema !==
|
|
53250
|
-
extractToDef(
|
|
53248
|
+
const ext = ctx.external.registry.get(entry2[0])?.id;
|
|
53249
|
+
if (schema !== entry2[0] && ext) {
|
|
53250
|
+
extractToDef(entry2);
|
|
53251
53251
|
continue;
|
|
53252
53252
|
}
|
|
53253
53253
|
}
|
|
53254
|
-
const id4 = ctx.metadataRegistry.get(
|
|
53254
|
+
const id4 = ctx.metadataRegistry.get(entry2[0])?.id;
|
|
53255
53255
|
if (id4) {
|
|
53256
|
-
extractToDef(
|
|
53256
|
+
extractToDef(entry2);
|
|
53257
53257
|
continue;
|
|
53258
53258
|
}
|
|
53259
53259
|
if (seen.cycle) {
|
|
53260
|
-
extractToDef(
|
|
53260
|
+
extractToDef(entry2);
|
|
53261
53261
|
continue;
|
|
53262
53262
|
}
|
|
53263
53263
|
if (seen.count > 1) {
|
|
53264
53264
|
if (ctx.reused === "ref") {
|
|
53265
|
-
extractToDef(
|
|
53265
|
+
extractToDef(entry2);
|
|
53266
53266
|
}
|
|
53267
53267
|
}
|
|
53268
53268
|
}
|
|
@@ -53444,12 +53444,12 @@ function finalize(ctx, schema) {
|
|
|
53444
53444
|
});
|
|
53445
53445
|
};
|
|
53446
53446
|
if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {
|
|
53447
|
-
for (const
|
|
53448
|
-
flattenRef(
|
|
53447
|
+
for (const entry2 of [...ctx.seen.entries()].reverse()) {
|
|
53448
|
+
flattenRef(entry2[0]);
|
|
53449
53449
|
}
|
|
53450
53450
|
if (ctx.target !== "openapi-3.0") {
|
|
53451
|
-
for (const
|
|
53452
|
-
compactTypeUnion(
|
|
53451
|
+
for (const entry2 of ctx.seen.entries()) {
|
|
53452
|
+
compactTypeUnion(entry2[1].def ?? entry2[1].schema);
|
|
53453
53453
|
}
|
|
53454
53454
|
}
|
|
53455
53455
|
for (const rewrite of ctx.deferred)
|
|
@@ -53496,8 +53496,8 @@ function finalize(ctx, schema) {
|
|
|
53496
53496
|
delete result2.id;
|
|
53497
53497
|
const defs = ctx.external?.defs ?? {};
|
|
53498
53498
|
if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {
|
|
53499
|
-
for (const
|
|
53500
|
-
const seen =
|
|
53499
|
+
for (const entry2 of ctx.seen.entries()) {
|
|
53500
|
+
const seen = entry2[1];
|
|
53501
53501
|
if (seen.def && seen.defId) {
|
|
53502
53502
|
if (seen.def.id === seen.defId)
|
|
53503
53503
|
delete seen.def.id;
|
|
@@ -54109,9 +54109,9 @@ function stringifyKeyNames(bySchema, json7, visited) {
|
|
|
54109
54109
|
var pendingRecords = /* @__PURE__ */ new WeakMap();
|
|
54110
54110
|
function rewriteKeyNames(ctx) {
|
|
54111
54111
|
const bySchema = /* @__PURE__ */ new Map();
|
|
54112
|
-
for (const
|
|
54113
|
-
if (
|
|
54114
|
-
bySchema.set(
|
|
54112
|
+
for (const entry2 of ctx.seen.values()) {
|
|
54113
|
+
if (entry2.def && !bySchema.has(entry2.schema))
|
|
54114
|
+
bySchema.set(entry2.schema, entry2);
|
|
54115
54115
|
}
|
|
54116
54116
|
const rewrites = /* @__PURE__ */ new Map();
|
|
54117
54117
|
for (const record4 of pendingRecords.get(ctx) ?? []) {
|
|
@@ -54125,8 +54125,8 @@ function rewriteKeyNames(ctx) {
|
|
|
54125
54125
|
}
|
|
54126
54126
|
if (!rewrites.size)
|
|
54127
54127
|
return;
|
|
54128
|
-
for (const
|
|
54129
|
-
for (const carrier of [
|
|
54128
|
+
for (const entry2 of ctx.seen.values()) {
|
|
54129
|
+
for (const carrier of [entry2.schema, entry2.def]) {
|
|
54130
54130
|
const rewritten = carrier && rewrites.get(carrier.propertyNames);
|
|
54131
54131
|
if (rewritten)
|
|
54132
54132
|
carrier.propertyNames = rewritten;
|
|
@@ -54320,8 +54320,8 @@ function toJSONSchema(input2, params) {
|
|
|
54320
54320
|
const registry4 = input2;
|
|
54321
54321
|
const ctx2 = initializeContext({ ...params, processors: allProcessors });
|
|
54322
54322
|
const defs = {};
|
|
54323
|
-
for (const
|
|
54324
|
-
const [_, schema] =
|
|
54323
|
+
for (const entry2 of registry4._idmap.entries()) {
|
|
54324
|
+
const [_, schema] = entry2;
|
|
54325
54325
|
processSchema(schema, ctx2);
|
|
54326
54326
|
}
|
|
54327
54327
|
const schemas = {};
|
|
@@ -54331,8 +54331,8 @@ function toJSONSchema(input2, params) {
|
|
|
54331
54331
|
defs
|
|
54332
54332
|
};
|
|
54333
54333
|
ctx2.external = external2;
|
|
54334
|
-
for (const
|
|
54335
|
-
const [key, schema] =
|
|
54334
|
+
for (const entry2 of registry4._idmap.entries()) {
|
|
54335
|
+
const [key, schema] = entry2;
|
|
54336
54336
|
extractDefs(ctx2, schema);
|
|
54337
54337
|
assignProp(schemas, key, finalize(ctx2, schema));
|
|
54338
54338
|
}
|
|
@@ -59252,7 +59252,7 @@ var registry3 = {
|
|
|
59252
59252
|
var REMEDIATION_CODES = Object.keys(registry3);
|
|
59253
59253
|
var REMEDIATION_DOC_PATHS = Object.values(
|
|
59254
59254
|
registry3
|
|
59255
|
-
).map((
|
|
59255
|
+
).map((entry2) => entry2.docsPath).filter((p) => p !== void 0);
|
|
59256
59256
|
|
|
59257
59257
|
// ../../packages/handled-error/src/serialized-handled-error.ts
|
|
59258
59258
|
var handledErrorFaultSchema = external_exports.enum([
|
|
@@ -59850,7 +59850,7 @@ var { publicOriginAliases } = Config.define((c) => ({
|
|
|
59850
59850
|
)
|
|
59851
59851
|
}));
|
|
59852
59852
|
function originsOf({ list: list12 }) {
|
|
59853
|
-
const origins = list12.split(",").map((
|
|
59853
|
+
const origins = list12.split(",").map((entry2) => entry2.trim()).filter((entry2) => URL.canParse(entry2)).map((entry2) => new URL(entry2)).filter((url2) => url2.protocol === "https:" || url2.protocol === "http:").map((url2) => url2.origin);
|
|
59854
59854
|
return [...new Set(origins)];
|
|
59855
59855
|
}
|
|
59856
59856
|
var { appsDomain } = Config.define((c) => ({
|
|
@@ -61797,15 +61797,15 @@ function clustersIn({
|
|
|
61797
61797
|
const out = [];
|
|
61798
61798
|
let current3 = null;
|
|
61799
61799
|
for (let index = segment.start; index <= segment.end; index += 1) {
|
|
61800
|
-
const
|
|
61801
|
-
if (
|
|
61800
|
+
const count6 = flagged[index] ?? 0;
|
|
61801
|
+
if (count6 === 0) continue;
|
|
61802
61802
|
if (current3 && index - current3.end - 1 <= REDACTED_BLOCK_MAX_GAP) {
|
|
61803
61803
|
current3.end = index;
|
|
61804
|
-
current3.values +=
|
|
61804
|
+
current3.values += count6;
|
|
61805
61805
|
continue;
|
|
61806
61806
|
}
|
|
61807
61807
|
if (current3) out.push(current3);
|
|
61808
|
-
current3 = { start: index, end: index, values:
|
|
61808
|
+
current3 = { start: index, end: index, values: count6 };
|
|
61809
61809
|
}
|
|
61810
61810
|
if (current3) out.push(current3);
|
|
61811
61811
|
return out;
|
|
@@ -61845,7 +61845,7 @@ function redactedBlocksAt({
|
|
|
61845
61845
|
}
|
|
61846
61846
|
const blocks = redactedBlocks({ lines: lines2, flagged });
|
|
61847
61847
|
const inside = (line) => blocks.some((block2) => line >= block2.start && line <= block2.end);
|
|
61848
|
-
const values = flagged.reduce((sum,
|
|
61848
|
+
const values = flagged.reduce((sum, count6, line) => inside(line) ? sum + count6 : sum, 0);
|
|
61849
61849
|
return { values, insideAt: (offset) => inside(lineAt(offset)) };
|
|
61850
61850
|
}
|
|
61851
61851
|
|
|
@@ -62522,7 +62522,9 @@ var layoutQuotedSchemaDefinition = external_exports.object({
|
|
|
62522
62522
|
originKey: external_exports.string().min(1).max(200),
|
|
62523
62523
|
channelId: external_exports.string().min(1).max(100).nullable(),
|
|
62524
62524
|
seq: external_exports.number().int().positive().nullable(),
|
|
62525
|
-
imageId: external_exports.string().min(1).max(100).nullable()
|
|
62525
|
+
imageId: external_exports.string().min(1).max(100).nullable(),
|
|
62526
|
+
/** The Laze person who wrote the original, such as a mirror's owner: their picture shows. */
|
|
62527
|
+
by: external_exports.object({ kind: external_exports.literal("person"), id: external_exports.string().min(1).max(100) }).optional()
|
|
62526
62528
|
});
|
|
62527
62529
|
var layoutAttachmentSchemaDefinition = external_exports.object({
|
|
62528
62530
|
type: external_exports.literal("attachment"),
|
|
@@ -62562,6 +62564,10 @@ var messageLayoutSchemaDefinition = external_exports.object({
|
|
|
62562
62564
|
});
|
|
62563
62565
|
var messageLayoutSchema = messageLayoutSchemaDefinition;
|
|
62564
62566
|
|
|
62567
|
+
// ../../modules/chat/contract/src/chat.pairs.ts
|
|
62568
|
+
var directPairSchemaDefinition = external_exports.object({ laze: external_exports.string(), slack: external_exports.string() });
|
|
62569
|
+
var directPairSchema = directPairSchemaDefinition;
|
|
62570
|
+
|
|
62565
62571
|
// ../../modules/chat/contract/src/chat.possible-secrets.ts
|
|
62566
62572
|
var possibleSecretInputSchemaDefinition = external_exports.object({
|
|
62567
62573
|
workspaceId: external_exports.string().min(1),
|
|
@@ -63426,7 +63432,12 @@ var conversationSummarySchemaDefinition = external_exports.object({
|
|
|
63426
63432
|
*/
|
|
63427
63433
|
activeAt: external_exports.iso.datetime().optional(),
|
|
63428
63434
|
/** In a Laze DM paired with a Slack DM: the side the reader picked; absent follows the other. */
|
|
63429
|
-
replySide: replySideSchema.optional()
|
|
63435
|
+
replySide: replySideSchema.optional(),
|
|
63436
|
+
/**
|
|
63437
|
+
* On both sides of a Laze DM paired with the reader's Slack DM of the same people: the two ids,
|
|
63438
|
+
* so every app lists them as one. Absent when not paired.
|
|
63439
|
+
*/
|
|
63440
|
+
directPair: directPairSchema.optional()
|
|
63430
63441
|
});
|
|
63431
63442
|
var conversationSummarySchema = conversationSummarySchemaDefinition;
|
|
63432
63443
|
var directoryEntrySchemaDefinition = external_exports.object({
|
|
@@ -63692,10 +63703,20 @@ var openAgentDirectInputSchemaDefinition = external_exports.object({
|
|
|
63692
63703
|
runsOutside: external_exports.boolean().optional()
|
|
63693
63704
|
}),
|
|
63694
63705
|
/** The name an agent opening the DM joins under; a person keeps their own. */
|
|
63695
|
-
openerName: external_exports.string().trim().min(1).max(80).optional()
|
|
63706
|
+
openerName: external_exports.string().trim().min(1).max(80).optional(),
|
|
63707
|
+
/** People who read this DM of two agents without being in it: the owners of its agents. */
|
|
63708
|
+
watcherUserIds: external_exports.array(idSchema4).max(4).optional()
|
|
63696
63709
|
});
|
|
63710
|
+
var agentsDirectInputSchemaDefinition = external_exports.object({
|
|
63711
|
+
workspaceId: workspaceIdSchema,
|
|
63712
|
+
agentIds: external_exports.tuple([idSchema4, idSchema4]).readonly()
|
|
63713
|
+
});
|
|
63714
|
+
var agentsDirectSchemaDefinition = external_exports.discriminatedUnion("kind", [
|
|
63715
|
+
external_exports.object({ kind: external_exports.literal("open"), channelId: idSchema4 }),
|
|
63716
|
+
external_exports.object({ kind: external_exports.literal("none") })
|
|
63717
|
+
]);
|
|
63697
63718
|
var agentChatMemberInputSchemaDefinition = external_exports.object({
|
|
63698
|
-
...openAgentDirectInputSchemaDefinition.shape,
|
|
63719
|
+
...openAgentDirectInputSchemaDefinition.omit({ watcherUserIds: true }).shape,
|
|
63699
63720
|
ownerUserId: idSchema4,
|
|
63700
63721
|
userId: idSchema4
|
|
63701
63722
|
});
|
|
@@ -63733,6 +63754,11 @@ var postMessageInputSchemaDefinition = external_exports.object({
|
|
|
63733
63754
|
threadRootId: idSchema4.optional(),
|
|
63734
63755
|
/** A reply that also shows in its conversation; ignored without `threadRootId`. */
|
|
63735
63756
|
alsoInChannel: external_exports.boolean().optional(),
|
|
63757
|
+
/**
|
|
63758
|
+
* In a mirrored conversation: the message this one replies to, quoted above it as the
|
|
63759
|
+
* source quotes its replies. Spec: modules/chat/specs/mirror-quote-reply.feature
|
|
63760
|
+
*/
|
|
63761
|
+
quotedMessageId: idSchema4.optional(),
|
|
63736
63762
|
/** In a direct message: notify the people in Do Not Disturb anyway, once. */
|
|
63737
63763
|
notifyAnyway: external_exports.boolean().optional(),
|
|
63738
63764
|
/** In a Laze DM: also post it to this paired Slack DM, as the sender; one Laze message. */
|
|
@@ -65436,7 +65462,12 @@ var messagePostedPayloadSchemaDefinition = external_exports.object({
|
|
|
65436
65462
|
/** The card this message carries, such as an approval: a system card, not something said. */
|
|
65437
65463
|
cardType: external_exports.string().optional(),
|
|
65438
65464
|
/** Mirrored history in a batch: no live publication of its own, its conversation reads again. */
|
|
65439
|
-
quiet: external_exports.boolean().optional()
|
|
65465
|
+
quiet: external_exports.boolean().optional(),
|
|
65466
|
+
/**
|
|
65467
|
+
* The message a reply in a mirrored conversation quotes: its source key when a mirror brought
|
|
65468
|
+
* it in, else `laze:<message id>`.
|
|
65469
|
+
*/
|
|
65470
|
+
quoted: external_exports.object({ originKey: external_exports.string().min(1) }).optional()
|
|
65440
65471
|
});
|
|
65441
65472
|
var messageChangedPayloadSchemaDefinition = external_exports.object({
|
|
65442
65473
|
workspaceId: external_exports.string().min(1),
|
|
@@ -65739,7 +65770,8 @@ var idSchema5 = external_exports.string().min(1).max(80);
|
|
|
65739
65770
|
var agentGranteeSchemaDefinition = external_exports.discriminatedUnion("kind", [
|
|
65740
65771
|
external_exports.object({ kind: external_exports.literal("person"), userId: idSchema5 }),
|
|
65741
65772
|
external_exports.object({ kind: external_exports.literal("channel"), channelId: idSchema5 }),
|
|
65742
|
-
external_exports.object({ kind: external_exports.literal("group"), groupId: idSchema5 })
|
|
65773
|
+
external_exports.object({ kind: external_exports.literal("group"), groupId: idSchema5 }),
|
|
65774
|
+
external_exports.object({ kind: external_exports.literal("agent"), agentId: idSchema5 })
|
|
65743
65775
|
]);
|
|
65744
65776
|
var agentGranteeSchema = agentGranteeSchemaDefinition;
|
|
65745
65777
|
var shareAgentInputSchemaDefinition = external_exports.object({
|
|
@@ -65748,6 +65780,14 @@ var shareAgentInputSchemaDefinition = external_exports.object({
|
|
|
65748
65780
|
grantee: agentGranteeSchemaDefinition
|
|
65749
65781
|
});
|
|
65750
65782
|
var shareAgentInputSchema = shareAgentInputSchemaDefinition;
|
|
65783
|
+
var agentLinkSchema = external_exports.object({
|
|
65784
|
+
agentId: idSchema5,
|
|
65785
|
+
name: external_exports.string(),
|
|
65786
|
+
ownerUserId: idSchema5,
|
|
65787
|
+
grantedByUserId: idSchema5,
|
|
65788
|
+
grantedAt: external_exports.iso.datetime(),
|
|
65789
|
+
channelId: idSchema5.nullable()
|
|
65790
|
+
});
|
|
65751
65791
|
var agentAccessSchemaDefinition = external_exports.object({
|
|
65752
65792
|
agentId: idSchema5,
|
|
65753
65793
|
kind: external_exports.enum(["personal", "team"]),
|
|
@@ -65766,6 +65806,10 @@ var agentAccessSchemaDefinition = external_exports.object({
|
|
|
65766
65806
|
),
|
|
65767
65807
|
/** The groups it is shared with, whose people may talk to it for as long as they are in them. */
|
|
65768
65808
|
groups: external_exports.array(external_exports.object({ id: idSchema5, name: external_exports.string(), memberIds: external_exports.array(external_exports.string()) })).optional(),
|
|
65809
|
+
/** The agents added to it, which DM it directly; `channelId` is their DM once opened. */
|
|
65810
|
+
agents: external_exports.array(agentLinkSchema).optional(),
|
|
65811
|
+
/** The agents it was added to, which it may DM; its owner takes it off any of them. */
|
|
65812
|
+
addedTo: external_exports.array(agentLinkSchema).optional(),
|
|
65769
65813
|
/** Whether the reader may share it and take shares back. */
|
|
65770
65814
|
mayShare: external_exports.boolean()
|
|
65771
65815
|
});
|
|
@@ -66799,7 +66843,9 @@ var computerHostCapacityDefinition = external_exports.object({
|
|
|
66799
66843
|
memoryMb: external_exports.number().int().positive(),
|
|
66800
66844
|
diskGb: external_exports.number().int().positive(),
|
|
66801
66845
|
overcommit: external_exports.number().positive(),
|
|
66802
|
-
diskOvercommit: external_exports.number().positive()
|
|
66846
|
+
diskOvercommit: external_exports.number().positive(),
|
|
66847
|
+
/** Awake vCPU is booked up to vcpus times this; null or absent books it at `overcommit`. */
|
|
66848
|
+
cpuOvercommit: external_exports.number().positive().nullable().optional()
|
|
66803
66849
|
});
|
|
66804
66850
|
var hostIdSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9-]{0,31}$/, "a host name is 1 to 32 of a-z, 0-9 and -");
|
|
66805
66851
|
var addComputerHostInputDefinition = external_exports.object({
|
|
@@ -66862,7 +66908,8 @@ var computerPoolFactDefinition = external_exports.discriminatedUnion("kind", [
|
|
|
66862
66908
|
kind: external_exports.literal("host_overcommit_changed"),
|
|
66863
66909
|
hostId: external_exports.string(),
|
|
66864
66910
|
overcommit: external_exports.number(),
|
|
66865
|
-
diskOvercommit: external_exports.number()
|
|
66911
|
+
diskOvercommit: external_exports.number(),
|
|
66912
|
+
cpuOvercommit: external_exports.number().nullable().optional()
|
|
66866
66913
|
}),
|
|
66867
66914
|
external_exports.object({ kind: external_exports.literal("host_removed"), hostId: external_exports.string() }),
|
|
66868
66915
|
external_exports.object({
|
|
@@ -71417,7 +71464,7 @@ async function keepTaken({
|
|
|
71417
71464
|
if (messages.length === 0) return;
|
|
71418
71465
|
const path = statePathOf({ context, kind: "spool", profile });
|
|
71419
71466
|
const ids = new Set(messages.map((message2) => message2.messageId));
|
|
71420
|
-
const kept = (await readSpool({ path })).filter((
|
|
71467
|
+
const kept = (await readSpool({ path })).filter((entry2) => !ids.has(entry2.message.messageId));
|
|
71421
71468
|
const now = context.nowMs();
|
|
71422
71469
|
const taken = messages.map((message2) => ({
|
|
71423
71470
|
message: message2,
|
|
@@ -71435,7 +71482,7 @@ async function dropFromSpool({
|
|
|
71435
71482
|
const path = statePathOf({ context, kind: "spool", profile });
|
|
71436
71483
|
const entries = await readSpool({ path });
|
|
71437
71484
|
const ids = new Set(messageIds);
|
|
71438
|
-
const kept = entries.filter((
|
|
71485
|
+
const kept = entries.filter((entry2) => !ids.has(entry2.message.messageId));
|
|
71439
71486
|
if (kept.length !== entries.length) await writeSpool({ path, entries: kept });
|
|
71440
71487
|
}
|
|
71441
71488
|
async function dueFromSpool({
|
|
@@ -71447,19 +71494,19 @@ async function dueFromSpool({
|
|
|
71447
71494
|
}) {
|
|
71448
71495
|
const path = statePathOf({ context, kind: "spool", profile });
|
|
71449
71496
|
const entries = await readSpool({ path });
|
|
71450
|
-
const pushed = entries.some((
|
|
71497
|
+
const pushed = entries.some((entry2) => entry2.pushedAt !== void 0);
|
|
71451
71498
|
const text3 = pushed ? await seen().catch(() => "") : "";
|
|
71452
71499
|
const shown2 = entries.filter(
|
|
71453
|
-
(
|
|
71500
|
+
(entry2) => entry2.pushedAt !== void 0 && text3.includes(entry2.message.messageId)
|
|
71454
71501
|
);
|
|
71455
71502
|
await dropFromSpool({
|
|
71456
71503
|
context,
|
|
71457
71504
|
profile,
|
|
71458
|
-
messageIds: shown2.map((
|
|
71505
|
+
messageIds: shown2.map((entry2) => entry2.message.messageId)
|
|
71459
71506
|
});
|
|
71460
71507
|
const late = context.nowMs() - PUSH_GRACE_MS;
|
|
71461
71508
|
const settled2 = context.nowMs() - IN_FLIGHT_MS;
|
|
71462
|
-
return entries.filter((
|
|
71509
|
+
return entries.filter((entry2) => !shown2.includes(entry2)).filter((entry2) => !settledOnly || entry2.takenAt <= settled2).filter((entry2) => entry2.pushedAt === void 0 || pushedToo && entry2.pushedAt <= late).map((entry2) => entry2.message);
|
|
71463
71510
|
}
|
|
71464
71511
|
|
|
71465
71512
|
// src/services/machine-report.service.ts
|
|
@@ -71634,7 +71681,7 @@ function serverUrlOf({ context, args }) {
|
|
|
71634
71681
|
}
|
|
71635
71682
|
|
|
71636
71683
|
// src/services/agent-access-commands.service.ts
|
|
71637
|
-
var SHARE_USAGE = "Usage: laze agent share|unshare <agent> --person <userId> | --group <groupId> | --channel <channelId>";
|
|
71684
|
+
var SHARE_USAGE = "Usage: laze agent share|unshare <agent> --person <userId> | --group <groupId> | --channel <channelId> | --agent <agent>";
|
|
71638
71685
|
function agentWord({ args, usage }) {
|
|
71639
71686
|
const agent3 = args.words[2];
|
|
71640
71687
|
if (!agent3) throw new CliUsageError(usage);
|
|
@@ -71646,11 +71693,15 @@ function printAccess({ context, args, access }) {
|
|
|
71646
71693
|
const people2 = access.people.map((person) => person.userId).join(", ") || "no one";
|
|
71647
71694
|
const channels3 = access.channels.map((channel) => `#${channel.name}`).join(", ") || "none";
|
|
71648
71695
|
const groups2 = (access.groups ?? []).map((group) => `@${group.name}`).join(", ") || "none";
|
|
71696
|
+
const agents = (access.agents ?? []).map((agent3) => agent3.name).join(", ") || "none";
|
|
71697
|
+
const addedTo = (access.addedTo ?? []).map((agent3) => agent3.name).join(", ") || "none";
|
|
71649
71698
|
context.out(
|
|
71650
71699
|
`${access.kind} agent, owned by ${access.ownerUserId}
|
|
71651
71700
|
People: ${people2}
|
|
71652
71701
|
Groups: ${groups2}
|
|
71653
71702
|
Channels: ${channels3}
|
|
71703
|
+
Agents: ${agents}
|
|
71704
|
+
Can DM: ${addedTo}
|
|
71654
71705
|
`
|
|
71655
71706
|
);
|
|
71656
71707
|
}
|
|
@@ -71685,10 +71736,12 @@ async function agentPermissionPrompts({ context, args }) {
|
|
|
71685
71736
|
function granteeOf({
|
|
71686
71737
|
person,
|
|
71687
71738
|
group,
|
|
71688
|
-
channel
|
|
71739
|
+
channel,
|
|
71740
|
+
agent: agent3
|
|
71689
71741
|
}) {
|
|
71690
71742
|
if (person) return { kind: "person", userId: person };
|
|
71691
71743
|
if (group) return { kind: "group", groupId: group };
|
|
71744
|
+
if (agent3) return { kind: "agent", agentId: agent3 };
|
|
71692
71745
|
return { kind: "channel", channelId: channel };
|
|
71693
71746
|
}
|
|
71694
71747
|
async function shareAgent({ context, args }) {
|
|
@@ -71696,8 +71749,11 @@ async function shareAgent({ context, args }) {
|
|
|
71696
71749
|
const person = flagText({ args, name: "person" });
|
|
71697
71750
|
const group = flagText({ args, name: "group" });
|
|
71698
71751
|
const channel = flagText({ args, name: "channel" });
|
|
71699
|
-
|
|
71700
|
-
|
|
71752
|
+
const other = flagText({ args, name: "agent" });
|
|
71753
|
+
if ([person, group, channel, other].filter(Boolean).length !== 1) {
|
|
71754
|
+
throw new CliUsageError(SHARE_USAGE);
|
|
71755
|
+
}
|
|
71756
|
+
const grantee = granteeOf({ person, group, channel, agent: other });
|
|
71701
71757
|
const path = args.words[1] === "unshare" ? "/api/agents/unshare" : "/api/agents/share";
|
|
71702
71758
|
const { client } = await signedIn({ context, args });
|
|
71703
71759
|
printAccess({ context, args, access: await client.post(path, { agent: agent3, grantee }) });
|
|
@@ -71936,7 +71992,7 @@ function withHooks({
|
|
|
71936
71992
|
}) {
|
|
71937
71993
|
const current3 = Array.isArray(hooks[event]) ? hooks[event] : [];
|
|
71938
71994
|
const others = current3.filter(
|
|
71939
|
-
(
|
|
71995
|
+
(entry2) => !entry2.hooks?.some((hook) => hook.command?.includes(LAZE_HOOK_MARKER))
|
|
71940
71996
|
);
|
|
71941
71997
|
hooks[event] = [...others, ...added.map((hook) => ({ hooks: [hook] }))];
|
|
71942
71998
|
}
|
|
@@ -71993,7 +72049,7 @@ function hookCommand({
|
|
|
71993
72049
|
function holdsOurs({ settings: settings3, event }) {
|
|
71994
72050
|
const hooks = settings3.hooks ?? {};
|
|
71995
72051
|
return Array.isArray(hooks[event]) && hooks[event].some(
|
|
71996
|
-
(
|
|
72052
|
+
(entry2) => entry2.hooks?.some((hook) => hook.command?.includes(LAZE_HOOK_MARKER))
|
|
71997
72053
|
);
|
|
71998
72054
|
}
|
|
71999
72055
|
function lacksSessionStartWaiter({ settings: settings3 }) {
|
|
@@ -72013,10 +72069,10 @@ function whereOf(message2) {
|
|
|
72013
72069
|
}
|
|
72014
72070
|
function catchUpLinesOf(message2) {
|
|
72015
72071
|
if (!message2.catchUp) return [];
|
|
72016
|
-
const { count:
|
|
72072
|
+
const { count: count6, older } = message2.catchUp;
|
|
72017
72073
|
const where = whereOf(message2);
|
|
72018
72074
|
const lines2 = [
|
|
72019
|
-
`${
|
|
72075
|
+
`${count6} ${count6 === 1 ? "message" : "messages"} in ${where} while you were away.`
|
|
72020
72076
|
];
|
|
72021
72077
|
if (older === 0) return lines2;
|
|
72022
72078
|
const channel = message2.channelKind === "public" || message2.channelKind === "private";
|
|
@@ -72039,9 +72095,9 @@ function hookContextOf({
|
|
|
72039
72095
|
messages,
|
|
72040
72096
|
self: self2
|
|
72041
72097
|
}) {
|
|
72042
|
-
const
|
|
72098
|
+
const count6 = messages.length === 1 ? "A message" : `${messages.length} messages`;
|
|
72043
72099
|
return [
|
|
72044
|
-
`${
|
|
72100
|
+
`${count6} reached you in Laze${selfClauseOf({ self: self2 })}:`,
|
|
72045
72101
|
"",
|
|
72046
72102
|
...messages.map((message2) => formatInboxMessage({ message: message2 })),
|
|
72047
72103
|
"",
|
|
@@ -72070,20 +72126,20 @@ function contextWindowOf({ model }) {
|
|
|
72070
72126
|
return /\[1m\]|-1m\b/i.test(model) ? 1e6 : 2e5;
|
|
72071
72127
|
}
|
|
72072
72128
|
function compactionOf({
|
|
72073
|
-
entry,
|
|
72129
|
+
entry: entry2,
|
|
72074
72130
|
index
|
|
72075
72131
|
}) {
|
|
72076
|
-
const meta3 = record2(
|
|
72132
|
+
const meta3 = record2(entry2.compactMetadata);
|
|
72077
72133
|
return {
|
|
72078
|
-
key: typeof
|
|
72134
|
+
key: typeof entry2.uuid === "string" ? entry2.uuid : String(index),
|
|
72079
72135
|
trigger: meta3.trigger === "manual" ? "manual" : "auto",
|
|
72080
72136
|
tokensBefore: count2(meta3.preTokens),
|
|
72081
72137
|
tokensAfter: count2(meta3.postTokens),
|
|
72082
|
-
at: typeof
|
|
72138
|
+
at: typeof entry2.timestamp === "string" ? entry2.timestamp : "1970-01-01T00:00:00.000Z"
|
|
72083
72139
|
};
|
|
72084
72140
|
}
|
|
72085
|
-
function usageOf({ entry }) {
|
|
72086
|
-
const message2 = record2(
|
|
72141
|
+
function usageOf({ entry: entry2 }) {
|
|
72142
|
+
const message2 = record2(entry2.message);
|
|
72087
72143
|
const usage = record2(message2.usage);
|
|
72088
72144
|
const input2 = count2(usage.input_tokens);
|
|
72089
72145
|
if (input2 === void 0) return void 0;
|
|
@@ -72098,15 +72154,15 @@ function readTranscript({ lines: lines2 }) {
|
|
|
72098
72154
|
let contextWindow;
|
|
72099
72155
|
const compactions = [];
|
|
72100
72156
|
for (const line of lines2) {
|
|
72101
|
-
const
|
|
72102
|
-
if (!
|
|
72103
|
-
if (
|
|
72104
|
-
const compaction = compactionOf({ entry, index: compactions.length });
|
|
72157
|
+
const entry2 = parse3(line);
|
|
72158
|
+
if (!entry2 || entry2.isSidechain === true) continue;
|
|
72159
|
+
if (entry2.type === "system" && entry2.subtype === "compact_boundary") {
|
|
72160
|
+
const compaction = compactionOf({ entry: entry2, index: compactions.length });
|
|
72105
72161
|
compactions.push(compaction);
|
|
72106
72162
|
contextTokens = compaction.tokensAfter ?? contextTokens;
|
|
72107
72163
|
continue;
|
|
72108
72164
|
}
|
|
72109
|
-
const usage =
|
|
72165
|
+
const usage = entry2.type === "assistant" ? usageOf({ entry: entry2 }) : void 0;
|
|
72110
72166
|
if (!usage) continue;
|
|
72111
72167
|
contextTokens = usage.tokens;
|
|
72112
72168
|
if (usage.model) contextWindow = contextWindowOf({ model: usage.model });
|
|
@@ -73128,19 +73184,19 @@ function lastCallAtOf({ text: text3, command }) {
|
|
|
73128
73184
|
for (let index = lines2.length - 1; index >= 0; index -= 1) {
|
|
73129
73185
|
const line = lines2[index]?.trim();
|
|
73130
73186
|
if (!line?.startsWith("{")) continue;
|
|
73131
|
-
let
|
|
73187
|
+
let entry2;
|
|
73132
73188
|
try {
|
|
73133
|
-
|
|
73189
|
+
entry2 = JSON.parse(line);
|
|
73134
73190
|
} catch {
|
|
73135
73191
|
continue;
|
|
73136
73192
|
}
|
|
73137
|
-
const at = callAtOf({ entry, command });
|
|
73193
|
+
const at = callAtOf({ entry: entry2, command });
|
|
73138
73194
|
if (at !== null) return at;
|
|
73139
73195
|
}
|
|
73140
73196
|
return null;
|
|
73141
73197
|
}
|
|
73142
|
-
function callAtOf({ entry, command }) {
|
|
73143
|
-
const { type, timestamp, message: message2 } =
|
|
73198
|
+
function callAtOf({ entry: entry2, command }) {
|
|
73199
|
+
const { type, timestamp, message: message2 } = entry2 ?? {};
|
|
73144
73200
|
if (type !== "assistant" || typeof timestamp !== "string") return null;
|
|
73145
73201
|
const content = Array.isArray(message2?.content) ? message2.content : [];
|
|
73146
73202
|
const runs = content.some((part) => {
|
|
@@ -75555,11 +75611,11 @@ var RelaySession = class {
|
|
|
75555
75611
|
const socket = new wrapper_default(this.relay.gatewayUrl, {
|
|
75556
75612
|
maxPayload: OPENCLAW_RELAY_MAX_FRAME_BYTES
|
|
75557
75613
|
});
|
|
75558
|
-
const
|
|
75559
|
-
this.#lines.set(line,
|
|
75614
|
+
const entry2 = { socket, waiting: [] };
|
|
75615
|
+
this.#lines.set(line, entry2);
|
|
75560
75616
|
socket.on("open", () => {
|
|
75561
75617
|
send({ socket: relay2, kind: "opened", line, payload: new Uint8Array() });
|
|
75562
|
-
for (const frame of
|
|
75618
|
+
for (const frame of entry2.waiting.splice(0))
|
|
75563
75619
|
socket.send(frame.data, { binary: frame.binary });
|
|
75564
75620
|
});
|
|
75565
75621
|
socket.on("message", (data, binary) => {
|
|
@@ -75567,7 +75623,7 @@ var RelaySession = class {
|
|
|
75567
75623
|
});
|
|
75568
75624
|
socket.on("error", () => void 0);
|
|
75569
75625
|
socket.on("close", (code, reason2) => {
|
|
75570
|
-
const known = this.#lines.get(line) ===
|
|
75626
|
+
const known = this.#lines.get(line) === entry2;
|
|
75571
75627
|
this.#lines.delete(line);
|
|
75572
75628
|
if (!known) return;
|
|
75573
75629
|
const closed = relayClosePayload({
|
|
@@ -75719,8 +75775,8 @@ async function rushListenersOf({
|
|
|
75719
75775
|
for (const [key, profile] of bound) {
|
|
75720
75776
|
const one = sessions.find((each) => `claude-code:${each.sessionId}` === key);
|
|
75721
75777
|
if (!one?.id) continue;
|
|
75722
|
-
const
|
|
75723
|
-
const refused =
|
|
75778
|
+
const entry2 = config2.profiles[profile];
|
|
75779
|
+
const refused = entry2 ? refusedRecently({ profile: entry2, nowMs: context.nowMs() }) : false;
|
|
75724
75780
|
const own2 = notes.filter((note) => note.key === key);
|
|
75725
75781
|
rows.push(await rowOf({ context, key, profile, rushId: one.id, one, own: own2, refused }));
|
|
75726
75782
|
}
|
|
@@ -75792,15 +75848,15 @@ var UNDELIVERED_AFTER_MS = 6e4;
|
|
|
75792
75848
|
var CHECK_TIMEOUT_MS = 5e3;
|
|
75793
75849
|
function clientOf({ context, profile }) {
|
|
75794
75850
|
return context.store.read().then((config2) => {
|
|
75795
|
-
const
|
|
75796
|
-
if (!
|
|
75797
|
-
if (refusedRecently({ profile:
|
|
75851
|
+
const entry2 = config2.profiles[profile];
|
|
75852
|
+
if (!entry2 || entry2.migrated) return void 0;
|
|
75853
|
+
if (refusedRecently({ profile: entry2, nowMs: context.nowMs() })) return void 0;
|
|
75798
75854
|
return LazeClient.create({
|
|
75799
|
-
baseUrl:
|
|
75800
|
-
token:
|
|
75855
|
+
baseUrl: entry2.url,
|
|
75856
|
+
token: entry2.token,
|
|
75801
75857
|
fetcher: (input2, init) => context.fetcher(input2, { ...init, signal: AbortSignal.timeout(CHECK_TIMEOUT_MS) }),
|
|
75802
75858
|
onMigrated: markMigratedOn({ context, profile }),
|
|
75803
|
-
onRefused: markRefusedOn({ context, profile, token:
|
|
75859
|
+
onRefused: markRefusedOn({ context, profile, token: entry2.token })
|
|
75804
75860
|
});
|
|
75805
75861
|
});
|
|
75806
75862
|
}
|
|
@@ -76006,22 +76062,22 @@ function stateOfError({ error: error63, delivery }) {
|
|
|
76006
76062
|
async function serveAgent({
|
|
76007
76063
|
context,
|
|
76008
76064
|
profile,
|
|
76009
|
-
entry,
|
|
76065
|
+
entry: entry2,
|
|
76010
76066
|
signal,
|
|
76011
76067
|
report: report3
|
|
76012
76068
|
}) {
|
|
76013
76069
|
const client = LazeClient.create({
|
|
76014
|
-
baseUrl:
|
|
76015
|
-
token:
|
|
76070
|
+
baseUrl: entry2.url,
|
|
76071
|
+
token: entry2.token,
|
|
76016
76072
|
fetcher: context.fetcher,
|
|
76017
76073
|
onMigrated: markMigratedOn({ context, profile }),
|
|
76018
|
-
onRefused: markRefusedOn({ context, profile, token:
|
|
76074
|
+
onRefused: markRefusedOn({ context, profile, token: entry2.token })
|
|
76019
76075
|
});
|
|
76020
|
-
const watch = CodexTurnWatch.create({ context, client, profile, delivery:
|
|
76076
|
+
const watch = CodexTurnWatch.create({ context, client, profile, delivery: entry2.delivery });
|
|
76021
76077
|
const ended = new AbortController();
|
|
76022
76078
|
const watching = watch.run({ signal: AbortSignal.any([signal, ended.signal]) });
|
|
76023
76079
|
try {
|
|
76024
|
-
await serveRounds({ context, client, profile, entry, signal, report: report3, watch });
|
|
76080
|
+
await serveRounds({ context, client, profile, entry: entry2, signal, report: report3, watch });
|
|
76025
76081
|
} finally {
|
|
76026
76082
|
ended.abort();
|
|
76027
76083
|
await watching;
|
|
@@ -76031,7 +76087,7 @@ async function serveRounds({
|
|
|
76031
76087
|
context,
|
|
76032
76088
|
client,
|
|
76033
76089
|
profile,
|
|
76034
|
-
entry,
|
|
76090
|
+
entry: entry2,
|
|
76035
76091
|
signal,
|
|
76036
76092
|
report: report3,
|
|
76037
76093
|
watch
|
|
@@ -76044,14 +76100,14 @@ async function serveRounds({
|
|
|
76044
76100
|
context,
|
|
76045
76101
|
client,
|
|
76046
76102
|
profile,
|
|
76047
|
-
delivery:
|
|
76103
|
+
delivery: entry2.delivery,
|
|
76048
76104
|
signal,
|
|
76049
76105
|
watch
|
|
76050
76106
|
});
|
|
76051
76107
|
if (backoff.answered() > 0) await report3(profile, "listening");
|
|
76052
76108
|
if (delivered === 0) await context.sleep(1e3, signal);
|
|
76053
76109
|
} catch (error63) {
|
|
76054
|
-
const go = await afterRoundError({ context, profile, entry, report: report3, error: error63, backoff });
|
|
76110
|
+
const go = await afterRoundError({ context, profile, entry: entry2, report: report3, error: error63, backoff });
|
|
76055
76111
|
if (go === "stop") return;
|
|
76056
76112
|
await context.sleep(go.delayMs, signal);
|
|
76057
76113
|
}
|
|
@@ -76060,7 +76116,7 @@ async function serveRounds({
|
|
|
76060
76116
|
async function afterRoundError({
|
|
76061
76117
|
context,
|
|
76062
76118
|
profile,
|
|
76063
|
-
entry,
|
|
76119
|
+
entry: entry2,
|
|
76064
76120
|
report: report3,
|
|
76065
76121
|
error: error63,
|
|
76066
76122
|
backoff
|
|
@@ -76083,7 +76139,7 @@ async function afterRoundError({
|
|
|
76083
76139
|
await report3(profile, "stopped: Laze has not answered for 3 days");
|
|
76084
76140
|
return "stop";
|
|
76085
76141
|
}
|
|
76086
|
-
const state = stateOfError({ error: error63, delivery:
|
|
76142
|
+
const state = stateOfError({ error: error63, delivery: entry2.delivery });
|
|
76087
76143
|
await report3(profile, state);
|
|
76088
76144
|
context.err(`${profile}: ${state}; trying again in ${Math.ceil(next.delayMs / 1e3)}s
|
|
76089
76145
|
`);
|
|
@@ -76102,9 +76158,9 @@ function setAgent(run4, profile, agent3) {
|
|
|
76102
76158
|
async function syncLoops(run4) {
|
|
76103
76159
|
const config2 = await run4.context.store.read();
|
|
76104
76160
|
for (const [profile, current3] of run4.served) {
|
|
76105
|
-
const
|
|
76106
|
-
const same2 =
|
|
76107
|
-
if (same2 && !
|
|
76161
|
+
const entry2 = config2.profiles[profile];
|
|
76162
|
+
const same2 = entry2?.token === current3.token && entry2.delivery?.threadId === current3.threadId;
|
|
76163
|
+
if (same2 && !entry2.migrated) continue;
|
|
76108
76164
|
current3.stop.abort();
|
|
76109
76165
|
await current3.done;
|
|
76110
76166
|
run4.served.delete(profile);
|
|
@@ -76113,9 +76169,9 @@ async function syncLoops(run4) {
|
|
|
76113
76169
|
const linked = Object.entries(config2.profiles).filter(
|
|
76114
76170
|
(pair) => pair[1].delivery?.harness === "codex" && pair[1].kind === "agent" && !pair[1].migrated
|
|
76115
76171
|
);
|
|
76116
|
-
for (const [profile,
|
|
76117
|
-
const { threadId } =
|
|
76118
|
-
setAgent(run4, profile, { agent:
|
|
76172
|
+
for (const [profile, entry2] of linked.filter(([name3]) => !run4.served.has(name3))) {
|
|
76173
|
+
const { threadId } = entry2.delivery;
|
|
76174
|
+
setAgent(run4, profile, { agent: entry2.name, threadId, state: "starting" });
|
|
76119
76175
|
const stop3 = new AbortController();
|
|
76120
76176
|
const report3 = async (name3, line) => {
|
|
76121
76177
|
const agent3 = run4.state.agents[name3];
|
|
@@ -76123,8 +76179,8 @@ async function syncLoops(run4) {
|
|
|
76123
76179
|
setAgent(run4, name3, { ...agent3, state: line });
|
|
76124
76180
|
if (await holdsLock(run4)) await save(run4);
|
|
76125
76181
|
};
|
|
76126
|
-
const done = serveAgent({ context: run4.context, profile, entry, signal: stop3.signal, report: report3 });
|
|
76127
|
-
run4.served.set(profile, { token:
|
|
76182
|
+
const done = serveAgent({ context: run4.context, profile, entry: entry2, signal: stop3.signal, report: report3 });
|
|
76183
|
+
run4.served.set(profile, { token: entry2.token, threadId, stop: stop3, done });
|
|
76128
76184
|
}
|
|
76129
76185
|
}
|
|
76130
76186
|
async function runConnectLoop({ context }) {
|
|
@@ -79982,6 +80038,14 @@ var appRefSchemaDefinition = external_exports.object({
|
|
|
79982
80038
|
appId: external_exports.string().min(1)
|
|
79983
80039
|
});
|
|
79984
80040
|
var appRefSchema = appRefSchemaDefinition;
|
|
80041
|
+
var appLinkNamesInputSchemaDefinition = external_exports.object({
|
|
80042
|
+
...appRefSchemaDefinition.shape,
|
|
80043
|
+
userIds: external_exports.array(external_exports.string().min(1)).max(500)
|
|
80044
|
+
});
|
|
80045
|
+
var appLinkNameSchemaDefinition = external_exports.object({
|
|
80046
|
+
userId: external_exports.string().min(1),
|
|
80047
|
+
name: external_exports.string().nullable()
|
|
80048
|
+
});
|
|
79985
80049
|
var createAppInputSchemaDefinition = external_exports.object({
|
|
79986
80050
|
workspaceId: external_exports.string().min(1),
|
|
79987
80051
|
name: external_exports.string().trim().min(1).max(80),
|
|
@@ -81894,6 +81958,7 @@ var appUi = uiTokens("app");
|
|
|
81894
81958
|
var AppNavSlot = appUi.component("nav");
|
|
81895
81959
|
var AppPanelSlot = appUi.component("panel");
|
|
81896
81960
|
var AppCardSlot = appUi.component("card");
|
|
81961
|
+
var AppLinkCardSlot = appUi.component("link-card");
|
|
81897
81962
|
var AppPinStripSlot = appUi.component("pin-strip");
|
|
81898
81963
|
var AppLinkHooksToken = appUi.hooks("links");
|
|
81899
81964
|
var AppPinListSlot = appUi.component("pin-list");
|
|
@@ -82930,7 +82995,7 @@ function backupsText({ name: name3, status: status11 }) {
|
|
|
82930
82995
|
const window2 = status11.from && status11.to ? `A restore can go back to any time from ${status11.from} to ${status11.to}.` : "Nothing to restore to yet.";
|
|
82931
82996
|
const replicating = status11.replicating ? "The app data replicates to object storage." : "The app data does not replicate on this host.";
|
|
82932
82997
|
const restores = status11.restores.map(
|
|
82933
|
-
(
|
|
82998
|
+
(entry2) => ` ${entry2.id} ${entry2.to ? `to ${entry2.to}` : `undid ${entry2.undid ?? ""}`}
|
|
82934
82999
|
`
|
|
82935
83000
|
);
|
|
82936
83001
|
return `${name3}: ${replicating} ${window2}
|
|
@@ -83440,8 +83505,8 @@ var USAGE6 = `Usage: laze app <command>. The app comes from ${APP_MANIFEST_FILE}
|
|
|
83440
83505
|
${APP_ARTIFACT_RULE}
|
|
83441
83506
|
${APP_ARTIFACT_RULE}
|
|
83442
83507
|
|
|
83443
|
-
${appCliCommands.map((
|
|
83444
|
-
${
|
|
83508
|
+
${appCliCommands.map((entry2) => ` ${entry2.command} ${entry2.arguments.join(" ")}
|
|
83509
|
+
${entry2.summary}`).join("\n")}`;
|
|
83445
83510
|
var MAX_FILES = 2e3;
|
|
83446
83511
|
async function turnTokenOf3({
|
|
83447
83512
|
context,
|
|
@@ -83536,12 +83601,12 @@ async function listFiles(folder) {
|
|
|
83536
83601
|
const pending2 = [folder];
|
|
83537
83602
|
while (pending2.length > 0 && found.length <= MAX_FILES) {
|
|
83538
83603
|
const current3 = pending2.pop() ?? folder;
|
|
83539
|
-
for (const
|
|
83540
|
-
const path = join26(current3,
|
|
83604
|
+
for (const entry2 of await readdir7(current3, { withFileTypes: true })) {
|
|
83605
|
+
const path = join26(current3, entry2.name);
|
|
83541
83606
|
const rel = relative3(folder, path).split(sep3).join("/");
|
|
83542
83607
|
if (isSkippedPath({ path: rel })) continue;
|
|
83543
|
-
if (
|
|
83544
|
-
else if (
|
|
83608
|
+
if (entry2.isDirectory()) pending2.push(path);
|
|
83609
|
+
else if (entry2.isFile()) found.push(path);
|
|
83545
83610
|
}
|
|
83546
83611
|
}
|
|
83547
83612
|
if (found.length > MAX_FILES)
|
|
@@ -83612,7 +83677,7 @@ async function templateStart({
|
|
|
83612
83677
|
client.post("/api/apps/pull", { appId }),
|
|
83613
83678
|
client.get("/api/apps/templates")
|
|
83614
83679
|
]);
|
|
83615
|
-
const found = templates2.find((
|
|
83680
|
+
const found = templates2.find((entry2) => entry2.name === template);
|
|
83616
83681
|
if (!found) throw new CliUsageError(`No template called ${template}`);
|
|
83617
83682
|
return { files: pulled.files, template: found };
|
|
83618
83683
|
}
|
|
@@ -83756,7 +83821,7 @@ var appWrite = async ({ context, args }) => {
|
|
|
83756
83821
|
});
|
|
83757
83822
|
};
|
|
83758
83823
|
function seedLine(seeded) {
|
|
83759
|
-
const created = Object.entries(seeded.created).map(([name3,
|
|
83824
|
+
const created = Object.entries(seeded.created).map(([name3, count6]) => `${count6} in ${name3}`);
|
|
83760
83825
|
const parts = [
|
|
83761
83826
|
created.length ? `Loaded starter records: ${created.join(", ")}.` : "",
|
|
83762
83827
|
seeded.skipped.length ? `Left ${seeded.skipped.join(", ")} as it was: it already holds records.` : ""
|
|
@@ -83934,7 +83999,7 @@ async function versionOf({
|
|
|
83934
83999
|
}) {
|
|
83935
84000
|
if (/^[0-9a-f]{40}$/.test(prefix)) return prefix;
|
|
83936
84001
|
const versions = await client.post("/api/apps/versions", { appId });
|
|
83937
|
-
const matches = versions.filter((
|
|
84002
|
+
const matches = versions.filter((entry2) => entry2.version.startsWith(prefix));
|
|
83938
84003
|
if (matches.length !== 1 || !matches[0]) {
|
|
83939
84004
|
throw new CliUsageError(
|
|
83940
84005
|
`laze: No single version starts with ${prefix} (app_version_not_found)`
|
|
@@ -84081,8 +84146,8 @@ function cardLine({ choice }) {
|
|
|
84081
84146
|
var appCard = async ({ context, args }) => {
|
|
84082
84147
|
const client = await appClient({ context, args });
|
|
84083
84148
|
const appId = await appIdOf({ client, args, folder: folderOf({ context, word: void 0 }) });
|
|
84084
|
-
const
|
|
84085
|
-
if (!Number.isInteger(
|
|
84149
|
+
const count6 = Number(flagText({ args, name: "rows", fallback: "5" }));
|
|
84150
|
+
if (!Number.isInteger(count6) || count6 < 1 || count6 > 10) {
|
|
84086
84151
|
throw new CliUsageError("--rows is a whole number from 1 to 10");
|
|
84087
84152
|
}
|
|
84088
84153
|
const text3 = (name3) => flagText({ args, name: name3 }) || null;
|
|
@@ -84095,7 +84160,7 @@ var appCard = async ({ context, args }) => {
|
|
|
84095
84160
|
collection: text3("collection"),
|
|
84096
84161
|
filter: flagText({ args, name: "where" }) || flagText({ args, name: "filter" }),
|
|
84097
84162
|
sort: flagText({ args, name: "sort" }),
|
|
84098
|
-
rows:
|
|
84163
|
+
rows: count6,
|
|
84099
84164
|
caption: text3("caption")
|
|
84100
84165
|
}
|
|
84101
84166
|
});
|
|
@@ -84230,14 +84295,14 @@ var appImport = async ({ context, args }) => {
|
|
|
84230
84295
|
` : "")
|
|
84231
84296
|
});
|
|
84232
84297
|
};
|
|
84233
|
-
function functionLogLine(
|
|
84234
|
-
const head = `${
|
|
84235
|
-
if (
|
|
84236
|
-
const cold =
|
|
84237
|
-
return `${head} ${
|
|
84298
|
+
function functionLogLine(entry2) {
|
|
84299
|
+
const head = `${entry2.at.slice(0, 19).replace("T", " ")} ${entry2.function} ${entry2.requestId}`;
|
|
84300
|
+
if (entry2.level === "request") {
|
|
84301
|
+
const cold = entry2.cold ? " cold" : "";
|
|
84302
|
+
return `${head} ${entry2.message} -> ${entry2.status ?? "?"} in ${entry2.durationMs ?? 0} ms${cold}
|
|
84238
84303
|
`;
|
|
84239
84304
|
}
|
|
84240
|
-
return `${head} ${
|
|
84305
|
+
return `${head} ${entry2.level}: ${entry2.message}
|
|
84241
84306
|
`;
|
|
84242
84307
|
}
|
|
84243
84308
|
var appLogs = async ({ context, args }) => {
|
|
@@ -85514,7 +85579,7 @@ async function computeClient({
|
|
|
85514
85579
|
return turn ? client.withHeaders({ "x-laze-turn": turn }) : client;
|
|
85515
85580
|
}
|
|
85516
85581
|
function siteLine(machine2) {
|
|
85517
|
-
return machine2.sites.map((
|
|
85582
|
+
return machine2.sites.map((entry2) => `${entry2.site} (${entry2.status.replaceAll("_", " ")})`).join(", ");
|
|
85518
85583
|
}
|
|
85519
85584
|
function statusLine(machine2) {
|
|
85520
85585
|
const cost = machine2.type === "own" ? "No Laze compute cost" : `${machine2.monthCostUsd.toFixed(2)} of ${machine2.monthlyBudgetUsd} USD this month`;
|
|
@@ -85721,9 +85786,9 @@ function presenceColumns(member) {
|
|
|
85721
85786
|
return [member.presence, `${status11.emoji} ${status11.text}`.trim() + until, ...dndColumn(member)];
|
|
85722
85787
|
}
|
|
85723
85788
|
function formatMembers({ detail }) {
|
|
85724
|
-
const
|
|
85789
|
+
const count6 = `${detail.members.length} ${detail.members.length === 1 ? "member" : "members"}`;
|
|
85725
85790
|
const ends = detail.endsAt ? `, ends ${utcTimeOf(detail.endsAt)}` : "";
|
|
85726
|
-
const head = `${channelLabelOf(detail)} (${detail.id}), ${
|
|
85791
|
+
const head = `${channelLabelOf(detail)} (${detail.id}), ${count6}${ends}`;
|
|
85727
85792
|
const rows = detail.members.map(
|
|
85728
85793
|
(member) => [ROLE[member.role], member.name, member.kind, member.id, ...presenceColumns(member)].join(" ")
|
|
85729
85794
|
);
|
|
@@ -85762,13 +85827,13 @@ function formatBrowsable({
|
|
|
85762
85827
|
}) {
|
|
85763
85828
|
if (channels3.length === 0) return "No channels to browse.\n";
|
|
85764
85829
|
const rows = channels3.map((channel) => {
|
|
85765
|
-
const
|
|
85830
|
+
const count6 = `${channel.memberCount} ${channel.memberCount === 1 ? "member" : "members"}`;
|
|
85766
85831
|
const marks = [
|
|
85767
85832
|
channel.joined ? "joined" : "not joined",
|
|
85768
85833
|
...channel.private ? ["private"] : [],
|
|
85769
85834
|
...channel.archived ? ["archived"] : []
|
|
85770
85835
|
].join(", ");
|
|
85771
|
-
return `#${channel.name} ${channel.id} ${
|
|
85836
|
+
return `#${channel.name} ${channel.id} ${count6} ${marks} ${channel.topic}`;
|
|
85772
85837
|
});
|
|
85773
85838
|
return `${rows.join("\n")}
|
|
85774
85839
|
`;
|
|
@@ -85817,10 +85882,10 @@ var DURATION = /^(\d+)\s*(m|min|mins|minutes?|h|hours?|d|days?)$/i;
|
|
|
85817
85882
|
function minutesOf({ text: text3 }) {
|
|
85818
85883
|
const match = DURATION.exec(text3.trim());
|
|
85819
85884
|
if (!match?.[1] || !match[2]) return null;
|
|
85820
|
-
const
|
|
85885
|
+
const count6 = Number(match[1]);
|
|
85821
85886
|
const unit = match[2].toLowerCase()[0];
|
|
85822
85887
|
const perUnit = { d: 1440, h: 60, m: 1 };
|
|
85823
|
-
const minutes =
|
|
85888
|
+
const minutes = count6 * (perUnit[unit ?? "m"] ?? 1);
|
|
85824
85889
|
return minutes > 0 ? minutes : null;
|
|
85825
85890
|
}
|
|
85826
85891
|
function muteTextOf({ mute }) {
|
|
@@ -88697,7 +88762,9 @@ var whatsappChangeDefinition = external_exports.object({
|
|
|
88697
88762
|
quote: external_exports.object({
|
|
88698
88763
|
id: external_exports.string().min(1).max(200),
|
|
88699
88764
|
sender: external_exports.string().max(500),
|
|
88700
|
-
text: external_exports.string().max(1e3)
|
|
88765
|
+
text: external_exports.string().max(1e3),
|
|
88766
|
+
/** A quote of the account owner's own message; absent from older connectors. */
|
|
88767
|
+
fromMe: external_exports.boolean().optional()
|
|
88701
88768
|
}).optional()
|
|
88702
88769
|
});
|
|
88703
88770
|
var whatsappReadDefinition = external_exports.object({
|
|
@@ -89294,7 +89361,7 @@ ${COMPUTER_COPY_USAGE}`);
|
|
|
89294
89361
|
const full = resolve12(context.cwd, path);
|
|
89295
89362
|
const found = await stat11(full).catch(() => void 0);
|
|
89296
89363
|
if (!found) throw new CliUsageError(`${path} does not exist`);
|
|
89297
|
-
const { name: name3, parent, entry } = packingOf({
|
|
89364
|
+
const { name: name3, parent, entry: entry2 } = packingOf({
|
|
89298
89365
|
path: path.endsWith("/") ? `${full}/` : full,
|
|
89299
89366
|
isDirectory: found.isDirectory()
|
|
89300
89367
|
});
|
|
@@ -89302,7 +89369,7 @@ ${COMPUTER_COPY_USAGE}`);
|
|
|
89302
89369
|
const archive2 = resolve12(dir, `${name3}.tar.gz`);
|
|
89303
89370
|
try {
|
|
89304
89371
|
const code = await context.runCommand({
|
|
89305
|
-
command: ["tar", "-czf", archive2, "-C", parent,
|
|
89372
|
+
command: ["tar", "-czf", archive2, "-C", parent, entry2],
|
|
89306
89373
|
env: { COPYFILE_DISABLE: "1" }
|
|
89307
89374
|
});
|
|
89308
89375
|
if (code !== 0) throw new CliUsageError(`tar could not pack ${path} (exit ${code})`);
|
|
@@ -90187,9 +90254,9 @@ function readOf(args) {
|
|
|
90187
90254
|
...before && { before: Number(before) }
|
|
90188
90255
|
};
|
|
90189
90256
|
}
|
|
90190
|
-
function printEntry({ context, entry }) {
|
|
90191
|
-
const who = `${
|
|
90192
|
-
context.out(`${
|
|
90257
|
+
function printEntry({ context, entry: entry2 }) {
|
|
90258
|
+
const who = `${entry2.actorKind}:${entry2.actorId ?? "-"}`;
|
|
90259
|
+
context.out(`${entry2.seq} ${entry2.at} ${entry2.action} ${entry2.outcome} ${who}
|
|
90193
90260
|
`);
|
|
90194
90261
|
}
|
|
90195
90262
|
var listAudit = async ({ context, args }) => {
|
|
@@ -90197,12 +90264,12 @@ var listAudit = async ({ context, args }) => {
|
|
|
90197
90264
|
if (args.words[1] === "activity") {
|
|
90198
90265
|
const entries = await client.post("/api/vault/activity", readOf(args));
|
|
90199
90266
|
if (args.flags.json) return printJson4({ context, data: entries });
|
|
90200
|
-
for (const
|
|
90267
|
+
for (const entry2 of entries) printEntry({ context, entry: entry2 });
|
|
90201
90268
|
return;
|
|
90202
90269
|
}
|
|
90203
90270
|
const page = await client.post("/api/vault/audit", readOf(args));
|
|
90204
90271
|
if (args.flags.json) return printJson4({ context, data: page });
|
|
90205
|
-
for (const
|
|
90272
|
+
for (const entry2 of page.entries) printEntry({ context, entry: entry2 });
|
|
90206
90273
|
const chain = page.chain.intact ? "intact" : `broken at ${page.chain.brokenAtSeq}`;
|
|
90207
90274
|
context.out(`Chain ${chain}.${page.nextCursor ? ` Older: --before ${page.nextCursor}` : ""}
|
|
90208
90275
|
`);
|
|
@@ -93719,8 +93786,8 @@ function draftFilesMissingText(names) {
|
|
|
93719
93786
|
}
|
|
93720
93787
|
|
|
93721
93788
|
// ../../modules/feed/contract/src/feed.decisions.ts
|
|
93722
|
-
function decisionsLineOf(
|
|
93723
|
-
return `${
|
|
93789
|
+
function decisionsLineOf(count6) {
|
|
93790
|
+
return `${count6} ${count6 === 1 ? "decision" : "decisions"} waiting on you`;
|
|
93724
93791
|
}
|
|
93725
93792
|
|
|
93726
93793
|
// src/rules/feed-input.rules.ts
|
|
@@ -94217,13 +94284,13 @@ function shareCommand({ move: move3 }) {
|
|
|
94217
94284
|
}
|
|
94218
94285
|
function optionalWords(words) {
|
|
94219
94286
|
return Object.fromEntries(
|
|
94220
|
-
Object.entries(words).filter((
|
|
94287
|
+
Object.entries(words).filter((entry2) => Boolean(entry2[1]))
|
|
94221
94288
|
);
|
|
94222
94289
|
}
|
|
94223
94290
|
function shareLinesOf({ move: move3, answer: answer6 }) {
|
|
94224
94291
|
const names = answer6.people.map((person) => person.name).join(", ") || "no one new";
|
|
94225
|
-
const
|
|
94226
|
-
const items = `${
|
|
94292
|
+
const count6 = answer6.itemIds.length;
|
|
94293
|
+
const items = `${count6} item${count6 === 1 ? "" : "s"}`;
|
|
94227
94294
|
const head = move3 === "share" ? `Shared ${items} with ${names}` : `Took ${names} off ${items}`;
|
|
94228
94295
|
return [head, ...answer6.itemIds].map((line) => `${line}
|
|
94229
94296
|
`).join("");
|
|
@@ -94854,13 +94921,13 @@ function formatHistory(output2) {
|
|
|
94854
94921
|
const lines2 = linesOf3(output2);
|
|
94855
94922
|
if (lines2.length === 0) return `${where}${from}: no messages.
|
|
94856
94923
|
`;
|
|
94857
|
-
const
|
|
94924
|
+
const count6 = lines2.length === 1 ? "1 message" : `${lines2.length} messages`;
|
|
94858
94925
|
const blocks = lines2.map(blockOf2).join("\n\n");
|
|
94859
94926
|
const cursor = olderCursorOf(output2);
|
|
94860
94927
|
const older = cursor ? `
|
|
94861
94928
|
|
|
94862
94929
|
Older: laze history ${output2.channel} --before ${cursor}` : "";
|
|
94863
|
-
return `${where}${from}: ${
|
|
94930
|
+
return `${where}${from}: ${count6}, oldest first
|
|
94864
94931
|
|
|
94865
94932
|
${blocks}${older}
|
|
94866
94933
|
`;
|
|
@@ -96071,10 +96138,10 @@ ${USAGE12}`);
|
|
|
96071
96138
|
if ("exitCode" in released) return released;
|
|
96072
96139
|
Object.assign(env, released.env);
|
|
96073
96140
|
}
|
|
96074
|
-
const
|
|
96075
|
-
if (
|
|
96141
|
+
const count6 = Object.keys(env).length;
|
|
96142
|
+
if (count6 > EXEC_ENV_MAX) {
|
|
96076
96143
|
context.err(
|
|
96077
|
-
`laze: these connections hold ${
|
|
96144
|
+
`laze: these connections hold ${count6} variables; at most ${EXEC_ENV_MAX} go with a command. Send fewer connections, or run the command with \`laze vault run\` where you run.
|
|
96078
96145
|
`
|
|
96079
96146
|
);
|
|
96080
96147
|
return { exitCode: 1 };
|
|
@@ -96229,7 +96296,7 @@ function secretRefusal({
|
|
|
96229
96296
|
rules = MCP_SECRET_COMMANDS
|
|
96230
96297
|
}) {
|
|
96231
96298
|
const { words, flags: flags2 } = parseArgs({ argv });
|
|
96232
|
-
const command = [3, 2, 1].map((
|
|
96299
|
+
const command = [3, 2, 1].map((count6) => words.slice(0, count6).join(" ")).find((name3) => Object.hasOwn(rules, name3));
|
|
96233
96300
|
const rule = command === void 0 ? void 0 : rules[command];
|
|
96234
96301
|
if (!command || !rule) return void 0;
|
|
96235
96302
|
const vaultFlag = rule.vaultFlag ?? "from-vault";
|
|
@@ -96948,11 +97015,11 @@ async function monitorAdd({ context, args }) {
|
|
|
96948
97015
|
});
|
|
96949
97016
|
if (args.flags.json) return context.out(`${JSON.stringify(added, null, 2)}
|
|
96950
97017
|
`);
|
|
96951
|
-
const
|
|
97018
|
+
const count6 = added.watching.length;
|
|
96952
97019
|
context.out(
|
|
96953
97020
|
`${added.monitor.id} ${added.monitor.name}
|
|
96954
97021
|
${added.watching.join(" ")}
|
|
96955
|
-
Watching ${
|
|
97022
|
+
Watching ${count6} ${count6 === 1 ? "channel" : "channels"}
|
|
96956
97023
|
`
|
|
96957
97024
|
);
|
|
96958
97025
|
}
|
|
@@ -98508,7 +98575,8 @@ var OPERATOR_KEY_ACTIONS = [
|
|
|
98508
98575
|
"user.lookup",
|
|
98509
98576
|
"workspace.flag",
|
|
98510
98577
|
"workspace.credits",
|
|
98511
|
-
"workspace.plan"
|
|
98578
|
+
"workspace.plan",
|
|
98579
|
+
"ops.functions"
|
|
98512
98580
|
];
|
|
98513
98581
|
var operatorKeyActionSchema = external_exports.enum(OPERATOR_KEY_ACTIONS);
|
|
98514
98582
|
var OPERATOR_KEY_REST_PATHS = {
|
|
@@ -98536,6 +98604,8 @@ var requestInputDefinition2 = external_exports.object({
|
|
|
98536
98604
|
action: external_exports.string().trim().min(1).max(80),
|
|
98537
98605
|
target: id3,
|
|
98538
98606
|
args: argsDefinition.default({}),
|
|
98607
|
+
/** The ops functions an `ops.functions` lease may call (ADR-214); empty for any other action. */
|
|
98608
|
+
functions: external_exports.array(external_exports.string().trim().min(1).max(80)).max(50).default([]),
|
|
98539
98609
|
reason,
|
|
98540
98610
|
/** sha256 of the secret the CLI made and keeps; the secret itself never comes here. */
|
|
98541
98611
|
secretHash: sha256Hex
|
|
@@ -98545,6 +98615,8 @@ var keyDefinition = external_exports.object({
|
|
|
98545
98615
|
action: operatorKeyActionSchema,
|
|
98546
98616
|
target: external_exports.string(),
|
|
98547
98617
|
args: argsDefinition,
|
|
98618
|
+
/** The ops functions an `ops.functions` lease may call; empty for any other action. */
|
|
98619
|
+
functions: external_exports.array(external_exports.string()).default([]),
|
|
98548
98620
|
reason: external_exports.string(),
|
|
98549
98621
|
status: operatorKeyStatusSchema,
|
|
98550
98622
|
/** The API key that asked; only that key can use this one. */
|
|
@@ -98569,12 +98641,20 @@ var keyDefinition = external_exports.object({
|
|
|
98569
98641
|
var operatorKeySchema = keyDefinition;
|
|
98570
98642
|
var statusInputDefinition = external_exports.object({ keyId: id3 });
|
|
98571
98643
|
var operatorKeyIdSchema = statusInputDefinition;
|
|
98572
|
-
var useInputDefinition = external_exports.object({
|
|
98644
|
+
var useInputDefinition = external_exports.object({
|
|
98645
|
+
keyId: id3,
|
|
98646
|
+
secret: external_exports.string().min(32).max(128),
|
|
98647
|
+
/** On an `ops.functions` lease: which of its functions to call, and that function's input. */
|
|
98648
|
+
function: external_exports.string().trim().min(1).max(80).optional(),
|
|
98649
|
+
input: external_exports.unknown().optional()
|
|
98650
|
+
});
|
|
98573
98651
|
var useAnswerDefinition = external_exports.object({
|
|
98574
98652
|
keyId: external_exports.string(),
|
|
98575
98653
|
action: operatorKeyActionSchema,
|
|
98576
98654
|
target: external_exports.string(),
|
|
98577
98655
|
endsAt: external_exports.iso.datetime(),
|
|
98656
|
+
/** The function called, on an `ops.functions` lease. */
|
|
98657
|
+
function: external_exports.string().optional(),
|
|
98578
98658
|
result: external_exports.unknown()
|
|
98579
98659
|
});
|
|
98580
98660
|
var approveDefinition2 = external_exports.object({ keyId: id3, assertion: vaultPasskeyAssertionSchema });
|
|
@@ -98587,6 +98667,9 @@ var OPERATOR_KEY_COPY = {
|
|
|
98587
98667
|
operator_key_needs_manage: "This action needs an owner holding ops:manage",
|
|
98588
98668
|
operator_key_bad_target: "This target is not the kind this action works on",
|
|
98589
98669
|
operator_key_bad_args: "This action does not take those arguments",
|
|
98670
|
+
operator_key_unknown_function: "Name only functions the ops registry lists (laze ops functions)",
|
|
98671
|
+
operator_key_bad_scope: "A lease reads the platform or one workspace: tenant functions need --tenant, platform ones must not have it",
|
|
98672
|
+
operator_key_bad_input: "This function does not take that input",
|
|
98590
98673
|
operator_key_too_many_waiting: `At most ${OPERATOR_KEY.maxWaiting} keys can wait at once`,
|
|
98591
98674
|
operator_key_not_found: "There is no such operator key",
|
|
98592
98675
|
operator_key_not_pending: "This key was already answered or has expired",
|
|
@@ -98638,8 +98721,114 @@ var viewDefinition = external_exports.object({
|
|
|
98638
98721
|
});
|
|
98639
98722
|
var hostLoadViewSchema = viewDefinition;
|
|
98640
98723
|
|
|
98724
|
+
// ../../modules/ops/contract/src/ops-functions.ts
|
|
98725
|
+
var OPS_FUNCTION = {
|
|
98726
|
+
/** Functions one lease may name. */
|
|
98727
|
+
maxPerLease: 12,
|
|
98728
|
+
/** The longest range a function reads. */
|
|
98729
|
+
maxRangeDays: 31,
|
|
98730
|
+
/** The target of a lease that reads no single workspace. */
|
|
98731
|
+
platformTarget: "platform"
|
|
98732
|
+
};
|
|
98733
|
+
var opsFunctionScopeSchema = external_exports.enum(["lookup", "platform", "tenant"]);
|
|
98734
|
+
var findInputDefinition = external_exports.object({ query: external_exports.string().trim().min(1).max(200) }).strict();
|
|
98735
|
+
var findOutputDefinition = external_exports.object({
|
|
98736
|
+
workspaces: external_exports.array(
|
|
98737
|
+
external_exports.object({
|
|
98738
|
+
id: external_exports.string(),
|
|
98739
|
+
name: external_exports.string(),
|
|
98740
|
+
createdAt: external_exports.iso.datetime(),
|
|
98741
|
+
plan: external_exports.enum(["free", "team"])
|
|
98742
|
+
})
|
|
98743
|
+
)
|
|
98744
|
+
});
|
|
98745
|
+
var funnelInputDefinition = external_exports.object({
|
|
98746
|
+
from: external_exports.iso.datetime(),
|
|
98747
|
+
to: external_exports.iso.datetime(),
|
|
98748
|
+
bucketMinutes: external_exports.union([external_exports.literal(10), external_exports.literal(60), external_exports.literal(1440)]).default(60)
|
|
98749
|
+
}).strict();
|
|
98750
|
+
var count5 = external_exports.number().int().nonnegative();
|
|
98751
|
+
var funnelCountsDefinition = external_exports.object({
|
|
98752
|
+
signUps: count5,
|
|
98753
|
+
workspaces: count5,
|
|
98754
|
+
activatedTeams: count5,
|
|
98755
|
+
payingTeams: count5
|
|
98756
|
+
});
|
|
98757
|
+
var funnelOutputDefinition = external_exports.object({
|
|
98758
|
+
bucketMinutes: external_exports.number().int(),
|
|
98759
|
+
buckets: external_exports.array(external_exports.object({ at: external_exports.iso.datetime(), ...funnelCountsDefinition.shape })),
|
|
98760
|
+
totals: funnelCountsDefinition
|
|
98761
|
+
});
|
|
98762
|
+
var noInputDefinition = external_exports.object({}).strict();
|
|
98763
|
+
var capacityOutputDefinition = external_exports.object({
|
|
98764
|
+
/** The pool now; null where the process runs no pool. */
|
|
98765
|
+
pool: capacityNumbersSchema.nullable(),
|
|
98766
|
+
/** The last day of host load, oldest first. */
|
|
98767
|
+
history: external_exports.array(hostLoadPointSchema)
|
|
98768
|
+
});
|
|
98769
|
+
var tally = external_exports.array(external_exports.object({ key: external_exports.string(), count: count5 }));
|
|
98770
|
+
var snapshotOutputDefinition = external_exports.object({
|
|
98771
|
+
workspaceId: external_exports.string(),
|
|
98772
|
+
createdAt: external_exports.iso.datetime(),
|
|
98773
|
+
plan: external_exports.string(),
|
|
98774
|
+
status: external_exports.string(),
|
|
98775
|
+
seats: external_exports.object({ people: count5, limit: external_exports.number().int().nullable() }),
|
|
98776
|
+
membersByRole: tally,
|
|
98777
|
+
invitesByStatus: tally,
|
|
98778
|
+
agentsByKind: tally,
|
|
98779
|
+
agentsByHosting: tally,
|
|
98780
|
+
agentsConnected: count5,
|
|
98781
|
+
flagsOn: external_exports.array(external_exports.string()),
|
|
98782
|
+
complimentaryComputers: count5
|
|
98783
|
+
});
|
|
98784
|
+
var entry = (value) => value;
|
|
98785
|
+
var OPS_FUNCTIONS = {
|
|
98786
|
+
"workspaces.find": entry({
|
|
98787
|
+
title: "Find a workspace by name",
|
|
98788
|
+
scope: "lookup",
|
|
98789
|
+
view: "table",
|
|
98790
|
+
input: findInputDefinition,
|
|
98791
|
+
output: findOutputDefinition
|
|
98792
|
+
}),
|
|
98793
|
+
"signups.funnel": entry({
|
|
98794
|
+
title: "Sign-ups, workspaces, activated and paying teams over time",
|
|
98795
|
+
scope: "platform",
|
|
98796
|
+
view: "buckets",
|
|
98797
|
+
input: funnelInputDefinition,
|
|
98798
|
+
output: funnelOutputDefinition
|
|
98799
|
+
}),
|
|
98800
|
+
"computers.capacity": entry({
|
|
98801
|
+
title: "Computer pool capacity and host load",
|
|
98802
|
+
scope: "platform",
|
|
98803
|
+
view: "numbers",
|
|
98804
|
+
input: noInputDefinition,
|
|
98805
|
+
output: capacityOutputDefinition
|
|
98806
|
+
}),
|
|
98807
|
+
"tenant.snapshot": entry({
|
|
98808
|
+
title: "One workspace's plan, members, agents and flags, as counts",
|
|
98809
|
+
scope: "tenant",
|
|
98810
|
+
view: "numbers",
|
|
98811
|
+
input: noInputDefinition,
|
|
98812
|
+
output: snapshotOutputDefinition
|
|
98813
|
+
})
|
|
98814
|
+
};
|
|
98815
|
+
var OPS_FUNCTION_NAMES = Object.keys(OPS_FUNCTIONS);
|
|
98816
|
+
var opsFunctionNameSchema = external_exports.enum(OPS_FUNCTION_NAMES);
|
|
98817
|
+
var runDefinition = external_exports.object({
|
|
98818
|
+
function: external_exports.string().trim().min(1).max(80),
|
|
98819
|
+
input: external_exports.unknown().default({})
|
|
98820
|
+
});
|
|
98821
|
+
var opsFunctionRunInputSchema = runDefinition;
|
|
98822
|
+
var answerDefinition = external_exports.object({ function: external_exports.string(), result: external_exports.unknown() });
|
|
98823
|
+
var opsFunctionAnswerSchema = answerDefinition;
|
|
98824
|
+
var OPS_FUNCTION_COPY = {
|
|
98825
|
+
ops_function_unknown: `Choose one of: ${OPS_FUNCTION_NAMES.join(", ")}`,
|
|
98826
|
+
ops_function_wrong_scope: "This function does not read that scope",
|
|
98827
|
+
ops_function_bad_input: "This function does not take that input"
|
|
98828
|
+
};
|
|
98829
|
+
|
|
98641
98830
|
// ../../modules/ops/contract/src/ops.trpc.ts
|
|
98642
|
-
var opsTrpc = defineTrpcContract("ops").query("me").withInput(external_exports.object({})).withOutput(opsOperatorSchema).query("workspaces").withInput(opsSearchInputSchema).withOutput(external_exports.array(opsWorkspaceRowSchema)).query("workspace").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(opsWorkspaceDetailSchema).query("users").withInput(opsSearchInputSchema).withOutput(external_exports.array(opsUserRowSchema)).mutation("setPlan").withInput(opsSetPlanInputSchema).withOutput(opsWorkspaceDetailSchema).mutation("setComplimentaryComputer").withInput(opsSetComputerInputSchema).withOutput(opsWorkspaceDetailSchema).mutation("grantCredits").withInput(opsGrantCreditsInputSchema).withOutput(opsWorkspaceDetailSchema).mutation("setFlag").withInput(opsSetFlagInputSchema).withOutput(opsWorkspaceDetailSchema).query("parked").withInput(external_exports.object({})).withOutput(opsParkedSchema).mutation("parkedAct").withInput(opsParkedActInputSchema).withOutput(external_exports.object({ changed: external_exports.number().int() })).mutation("impersonate").withInput(opsImpersonateInputSchema).withOutput(impersonationSchema).query("operators").withInput(external_exports.object({})).withOutput(external_exports.array(opsOperatorGrantSchema)).query("audit").withInput(external_exports.object({ limit: external_exports.number().int().min(1).max(200).default(100) })).withOutput(external_exports.array(opsAuditRowSchema)).query("vaultLockdown").withInput(external_exports.object({})).withOutput(vaultLockdownSchema).mutation("vaultBreakerChallenge").withInput(external_exports.object({})).withOutput(vaultBreakerChallengeSchema).mutation("proposeOperatorPasskey").withInput(opsProposeOperatorPasskeyInputSchema).withOutput(vaultOperatorProposalSchema).mutation("operatorPasskeyChallenge").withInput(vaultOperatorChallengeInputSchema).withOutput(vaultOperatorChallengeSchema).mutation("commitOperatorRecord").withInput(opsCommitOperatorRecordInputSchema).withOutput(external_exports.object({ seq: external_exports.number().int() })).mutation("resetVaultBreaker").withInput(opsResetVaultBreakerInputSchema).withOutput(external_exports.object({ breaker: external_exports.literal("closed") })).mutation("setVaultOverride").withInput(opsSetVaultOverrideInputSchema).withOutput(vaultLockdownOverrideSchema).mutation("endVaultOverride").withInput(opsEndVaultOverrideInputSchema).withOutput(external_exports.object({ ended: external_exports.boolean() })).query("breakGlassRequests").withInput(external_exports.object({})).withOutput(external_exports.array(breakGlassRequestSchema)).mutation("requestBreakGlass").withInput(breakGlassRequestInputSchema).withOutput(breakGlassRequestSchema).mutation("breakGlassChallenge").withInput(breakGlassRequestIdSchema).withOutput(vaultReauthChallengeSchema).mutation("approveBreakGlass").withInput(breakGlassApproveInputSchema).withOutput(breakGlassRequestSchema).mutation("denyBreakGlass").withInput(breakGlassDenyInputSchema).withOutput(breakGlassRequestSchema).mutation("readBreakGlass").withInput(breakGlassReadInputSchema).withOutput(breakGlassPageSchema).query("operatorKeys").withInput(external_exports.object({})).withOutput(external_exports.array(operatorKeySchema)).mutation("operatorKeyChallenge").withInput(operatorKeyIdSchema).withOutput(vaultOperatorKeyChallengeSchema).mutation("approveOperatorKey").withInput(operatorKeyApproveInputSchema).withOutput(operatorKeySchema).mutation("denyOperatorKey").withInput(operatorKeyDenyInputSchema).withOutput(operatorKeySchema).mutation("revokeOperatorKey").withInput(operatorKeyDenyInputSchema).withOutput(operatorKeySchema).query("hostLoad").withInput(external_exports.object({})).withOutput(hostLoadViewSchema).build();
|
|
98831
|
+
var opsTrpc = defineTrpcContract("ops").query("me").withInput(external_exports.object({})).withOutput(opsOperatorSchema).query("workspaces").withInput(opsSearchInputSchema).withOutput(external_exports.array(opsWorkspaceRowSchema)).query("workspace").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(opsWorkspaceDetailSchema).query("users").withInput(opsSearchInputSchema).withOutput(external_exports.array(opsUserRowSchema)).mutation("setPlan").withInput(opsSetPlanInputSchema).withOutput(opsWorkspaceDetailSchema).mutation("setComplimentaryComputer").withInput(opsSetComputerInputSchema).withOutput(opsWorkspaceDetailSchema).mutation("grantCredits").withInput(opsGrantCreditsInputSchema).withOutput(opsWorkspaceDetailSchema).mutation("setFlag").withInput(opsSetFlagInputSchema).withOutput(opsWorkspaceDetailSchema).query("parked").withInput(external_exports.object({})).withOutput(opsParkedSchema).mutation("parkedAct").withInput(opsParkedActInputSchema).withOutput(external_exports.object({ changed: external_exports.number().int() })).mutation("impersonate").withInput(opsImpersonateInputSchema).withOutput(impersonationSchema).query("operators").withInput(external_exports.object({})).withOutput(external_exports.array(opsOperatorGrantSchema)).query("audit").withInput(external_exports.object({ limit: external_exports.number().int().min(1).max(200).default(100) })).withOutput(external_exports.array(opsAuditRowSchema)).query("vaultLockdown").withInput(external_exports.object({})).withOutput(vaultLockdownSchema).mutation("vaultBreakerChallenge").withInput(external_exports.object({})).withOutput(vaultBreakerChallengeSchema).mutation("proposeOperatorPasskey").withInput(opsProposeOperatorPasskeyInputSchema).withOutput(vaultOperatorProposalSchema).mutation("operatorPasskeyChallenge").withInput(vaultOperatorChallengeInputSchema).withOutput(vaultOperatorChallengeSchema).mutation("commitOperatorRecord").withInput(opsCommitOperatorRecordInputSchema).withOutput(external_exports.object({ seq: external_exports.number().int() })).mutation("resetVaultBreaker").withInput(opsResetVaultBreakerInputSchema).withOutput(external_exports.object({ breaker: external_exports.literal("closed") })).mutation("setVaultOverride").withInput(opsSetVaultOverrideInputSchema).withOutput(vaultLockdownOverrideSchema).mutation("endVaultOverride").withInput(opsEndVaultOverrideInputSchema).withOutput(external_exports.object({ ended: external_exports.boolean() })).query("breakGlassRequests").withInput(external_exports.object({})).withOutput(external_exports.array(breakGlassRequestSchema)).mutation("requestBreakGlass").withInput(breakGlassRequestInputSchema).withOutput(breakGlassRequestSchema).mutation("breakGlassChallenge").withInput(breakGlassRequestIdSchema).withOutput(vaultReauthChallengeSchema).mutation("approveBreakGlass").withInput(breakGlassApproveInputSchema).withOutput(breakGlassRequestSchema).mutation("denyBreakGlass").withInput(breakGlassDenyInputSchema).withOutput(breakGlassRequestSchema).mutation("readBreakGlass").withInput(breakGlassReadInputSchema).withOutput(breakGlassPageSchema).query("operatorKeys").withInput(external_exports.object({})).withOutput(external_exports.array(operatorKeySchema)).mutation("operatorKeyChallenge").withInput(operatorKeyIdSchema).withOutput(vaultOperatorKeyChallengeSchema).mutation("approveOperatorKey").withInput(operatorKeyApproveInputSchema).withOutput(operatorKeySchema).mutation("denyOperatorKey").withInput(operatorKeyDenyInputSchema).withOutput(operatorKeySchema).mutation("revokeOperatorKey").withInput(operatorKeyDenyInputSchema).withOutput(operatorKeySchema).query("hostLoad").withInput(external_exports.object({})).withOutput(hostLoadViewSchema).mutation("runOpsFunction").withInput(opsFunctionRunInputSchema).withOutput(opsFunctionAnswerSchema).build();
|
|
98643
98832
|
|
|
98644
98833
|
// ../../modules/ops/contract/src/ops.config.ts
|
|
98645
98834
|
var opsConfig = Config.define((c) => ({
|
|
@@ -98654,7 +98843,13 @@ var OPERATOR_KEY_USAGE = `Temporary operator keys (ask, an operator approves wit
|
|
|
98654
98843
|
laze ops request <action> <target> --reason "<why>" [--arg name=value] [--wait]
|
|
98655
98844
|
actions: ${OPERATOR_KEY_ACTIONS.join(", ")}
|
|
98656
98845
|
laze ops status <key> waiting, approved or ended
|
|
98657
|
-
laze ops use <key> run the approved action and print the answer
|
|
98846
|
+
laze ops use <key> run the approved action and print the answer
|
|
98847
|
+
Ops function leases (ADR-214), instead of reading the database:
|
|
98848
|
+
laze ops functions the functions, their scope and what each answers
|
|
98849
|
+
laze ops lease request --functions a,b --reason "<why>" [--tenant <workspace id>] [--wait]
|
|
98850
|
+
without --tenant: lookup and platform functions; with it: that one workspace's functions
|
|
98851
|
+
laze ops lease status <lease>
|
|
98852
|
+
laze ops call <lease> <function> [--input '<json>'] call one function of an approved lease`;
|
|
98658
98853
|
var POLL_MS3 = 5e3;
|
|
98659
98854
|
var keyFile = ({ context, keyId }) => join31(dirname22(context.environment.configPath), "operator-keys", keyId.replaceAll("/", "_"));
|
|
98660
98855
|
async function saveSecret({
|
|
@@ -98684,7 +98879,7 @@ var EXPIRED_LINE = `Expired: nobody answered within ${OPERATOR_KEY.pendingMinute
|
|
|
98684
98879
|
function statusLine2({ key, nowMs: nowMs2 }) {
|
|
98685
98880
|
switch (key.status) {
|
|
98686
98881
|
case "approved":
|
|
98687
|
-
return `Approved until ${key.endsAt}. Run: laze ops use ${key.id}`;
|
|
98882
|
+
return key.action === "ops.functions" ? `Approved until ${key.endsAt}. Run: laze ops call ${key.id} <${key.functions.join("|")}>` : `Approved until ${key.endsAt}. Run: laze ops use ${key.id}`;
|
|
98688
98883
|
case "pending":
|
|
98689
98884
|
return Temporal3.Instant.from(key.pendingUntil).epochMilliseconds <= nowMs2 ? EXPIRED_LINE : `Waiting for an operator's passkey at /ops/keys. Nothing runs until they approve. It expires at ${key.pendingUntil} if nobody answers.`;
|
|
98690
98885
|
case "expired":
|
|
@@ -98752,7 +98947,11 @@ async function forgetIfOver({
|
|
|
98752
98947
|
}
|
|
98753
98948
|
return key;
|
|
98754
98949
|
}
|
|
98755
|
-
async function useKey({
|
|
98950
|
+
async function useKey({
|
|
98951
|
+
context,
|
|
98952
|
+
args,
|
|
98953
|
+
call
|
|
98954
|
+
}) {
|
|
98756
98955
|
const [, , keyId] = args.words;
|
|
98757
98956
|
if (!keyId) throw new CliUsageError(OPERATOR_KEY_USAGE);
|
|
98758
98957
|
const { client } = await signedIn({ context, args });
|
|
@@ -98764,7 +98963,8 @@ async function useKey({ context, args }) {
|
|
|
98764
98963
|
try {
|
|
98765
98964
|
const answer6 = await client.post(OPERATOR_KEY_REST_PATHS.use, {
|
|
98766
98965
|
keyId,
|
|
98767
|
-
secret
|
|
98966
|
+
secret,
|
|
98967
|
+
...call
|
|
98768
98968
|
});
|
|
98769
98969
|
context.out(`${JSON.stringify(answer6.result, null, 2)}
|
|
98770
98970
|
`);
|
|
@@ -98781,8 +98981,68 @@ async function useKey({ context, args }) {
|
|
|
98781
98981
|
throw error63;
|
|
98782
98982
|
}
|
|
98783
98983
|
}
|
|
98984
|
+
function listFunctions({ context, args }) {
|
|
98985
|
+
const rows = OPS_FUNCTION_NAMES.map((name3) => ({
|
|
98986
|
+
name: name3,
|
|
98987
|
+
scope: OPS_FUNCTIONS[name3].scope,
|
|
98988
|
+
title: OPS_FUNCTIONS[name3].title
|
|
98989
|
+
}));
|
|
98990
|
+
if (args.flags.json) return context.out(`${JSON.stringify(rows, null, 2)}
|
|
98991
|
+
`);
|
|
98992
|
+
const width = Math.max(...rows.map((row) => row.name.length));
|
|
98993
|
+
for (const row of rows) {
|
|
98994
|
+
context.out(`${row.name.padEnd(width)} ${row.scope.padEnd(8)} ${row.title}
|
|
98995
|
+
`);
|
|
98996
|
+
}
|
|
98997
|
+
}
|
|
98998
|
+
async function requestLease({ context, args }) {
|
|
98999
|
+
const reason2 = flagText({ args, name: "reason" });
|
|
99000
|
+
const functions = flagText({ args, name: "functions" }).split(",").map((name3) => name3.trim()).filter(Boolean);
|
|
99001
|
+
if (functions.length === 0 || !reason2.trim()) throw new CliUsageError(OPERATOR_KEY_USAGE);
|
|
99002
|
+
const tenant = flagText({ args, name: "tenant" }).trim();
|
|
99003
|
+
const { client } = await signedIn({ context, args });
|
|
99004
|
+
const secret = randomBytes5(32).toString("hex");
|
|
99005
|
+
const key = await client.post(OPERATOR_KEY_REST_PATHS.request, {
|
|
99006
|
+
action: "ops.functions",
|
|
99007
|
+
target: tenant || OPS_FUNCTION.platformTarget,
|
|
99008
|
+
args: {},
|
|
99009
|
+
functions,
|
|
99010
|
+
reason: reason2,
|
|
99011
|
+
secretHash: createHash7("sha256").update(secret).digest("hex")
|
|
99012
|
+
});
|
|
99013
|
+
await saveSecret({ context, keyId: key.id, secret });
|
|
99014
|
+
const answered = args.flags.wait ? await waitForAnswer({ context, client, key }) : key;
|
|
99015
|
+
if (args.flags.json) return context.out(`${JSON.stringify(answered, null, 2)}
|
|
99016
|
+
`);
|
|
99017
|
+
context.out(`Lease ${key.id}: ${statusLine2({ key: answered, nowMs: context.nowMs() })}
|
|
99018
|
+
`);
|
|
99019
|
+
}
|
|
99020
|
+
function inputOf({ args }) {
|
|
99021
|
+
const text3 = flagText({ args, name: "input" }).trim();
|
|
99022
|
+
if (!text3) return {};
|
|
99023
|
+
try {
|
|
99024
|
+
return JSON.parse(text3);
|
|
99025
|
+
} catch {
|
|
99026
|
+
throw new CliUsageError(`--input takes JSON, such as '{"from":"...","to":"..."}'.`);
|
|
99027
|
+
}
|
|
99028
|
+
}
|
|
99029
|
+
async function callFunction({ context, args }) {
|
|
99030
|
+
const [, , keyId, name3] = args.words;
|
|
99031
|
+
if (!keyId || !name3) throw new CliUsageError(OPERATOR_KEY_USAGE);
|
|
99032
|
+
await useKey({ context, args, call: { function: name3, input: inputOf({ args }) } });
|
|
99033
|
+
}
|
|
98784
99034
|
function operatorKey({ context, args }) {
|
|
98785
|
-
const [, action] = args.words;
|
|
99035
|
+
const [, action, step] = args.words;
|
|
99036
|
+
if (action === "functions") return Promise.resolve(listFunctions({ context, args }));
|
|
99037
|
+
if (action === "call") return callFunction({ context, args });
|
|
99038
|
+
if (action === "lease" && step === "request") return requestLease({ context, args });
|
|
99039
|
+
if (action === "lease" && step === "status") {
|
|
99040
|
+
return keyStatus({
|
|
99041
|
+
context,
|
|
99042
|
+
args: { ...args, words: ["ops", "status", ...args.words.slice(3)] }
|
|
99043
|
+
});
|
|
99044
|
+
}
|
|
99045
|
+
if (action === "lease") throw new CliUsageError(OPERATOR_KEY_USAGE);
|
|
98786
99046
|
if (action === "request") return requestKey({ context, args });
|
|
98787
99047
|
if (action === "status") return keyStatus({ context, args });
|
|
98788
99048
|
return useKey({ context, args });
|
|
@@ -98795,7 +99055,8 @@ var OPS_USAGE = `Usage (operators, with LAZE_OPS_TOKEN set):
|
|
|
98795
99055
|
${OPERATOR_KEY_USAGE}`;
|
|
98796
99056
|
async function ops({ context, args }) {
|
|
98797
99057
|
const [, action, workspaceId] = args.words;
|
|
98798
|
-
|
|
99058
|
+
const keyed3 = ["request", "status", "use", "lease", "call", "functions"];
|
|
99059
|
+
if (action !== void 0 && keyed3.includes(action)) {
|
|
98799
99060
|
return operatorKey({ context, args });
|
|
98800
99061
|
}
|
|
98801
99062
|
const reason2 = flagText({ args, name: "reason" });
|
|
@@ -99161,9 +99422,9 @@ var USAGE17 = `Usage:
|
|
|
99161
99422
|
async function folderFiles({ root }) {
|
|
99162
99423
|
const entries = await readdir9(root, { recursive: true, withFileTypes: true });
|
|
99163
99424
|
const files2 = [];
|
|
99164
|
-
for (const
|
|
99165
|
-
if (!
|
|
99166
|
-
const full = join33(
|
|
99425
|
+
for (const entry2 of entries) {
|
|
99426
|
+
if (!entry2.isFile()) continue;
|
|
99427
|
+
const full = join33(entry2.parentPath, entry2.name);
|
|
99167
99428
|
files2.push({ path: relative6(root, full), content: await readFile32(full, "utf8") });
|
|
99168
99429
|
}
|
|
99169
99430
|
return files2.toSorted((a, b) => a.path.localeCompare(b.path));
|
|
@@ -100262,7 +100523,7 @@ async function resolveBatch({
|
|
|
100262
100523
|
const answer6 = await door.ask({ refs, reason: "", command: [], resolveOnly: true });
|
|
100263
100524
|
return answer6.entries;
|
|
100264
100525
|
}
|
|
100265
|
-
var keyOf = (
|
|
100526
|
+
var keyOf = (entry2) => entry2.connection?.name ?? entry2.ref;
|
|
100266
100527
|
async function untilAllAnswered({
|
|
100267
100528
|
context,
|
|
100268
100529
|
door,
|
|
@@ -100310,21 +100571,21 @@ async function releaseBatch({
|
|
|
100310
100571
|
let settled2;
|
|
100311
100572
|
try {
|
|
100312
100573
|
answer6 = await door.ask({ refs, reason: reason2, command, recipient: run4.publicKey });
|
|
100313
|
-
const missing = answer6.entries.filter((
|
|
100574
|
+
const missing = answer6.entries.filter((entry2) => !entry2.connection);
|
|
100314
100575
|
if (missing.length > 0) {
|
|
100315
100576
|
context.err(
|
|
100316
|
-
`laze vault: no key named ${missing.map((
|
|
100577
|
+
`laze vault: no key named ${missing.map((entry2) => entry2.ref).join(", ")} in your vault or reachable by this agent
|
|
100317
100578
|
`
|
|
100318
100579
|
);
|
|
100319
100580
|
return { exitCode: 1 };
|
|
100320
100581
|
}
|
|
100321
100582
|
settled2 = /* @__PURE__ */ new Map();
|
|
100322
100583
|
const waiting = /* @__PURE__ */ new Map();
|
|
100323
|
-
for (const
|
|
100324
|
-
const release2 =
|
|
100584
|
+
for (const entry2 of answer6.entries) {
|
|
100585
|
+
const release2 = entry2.release;
|
|
100325
100586
|
if (!release2) continue;
|
|
100326
|
-
if (release2.outcome === "ask") waiting.set(keyOf(
|
|
100327
|
-
else settled2.set(keyOf(
|
|
100587
|
+
if (release2.outcome === "ask") waiting.set(keyOf(entry2), release2);
|
|
100588
|
+
else settled2.set(keyOf(entry2), release2);
|
|
100328
100589
|
}
|
|
100329
100590
|
const later = await untilAllAnswered({ context, door, waiting, deadline });
|
|
100330
100591
|
if (later === "capped") return { exitCode: 75 };
|
|
@@ -100374,9 +100635,9 @@ async function valuesOf({
|
|
|
100374
100635
|
}
|
|
100375
100636
|
if (!keep2) await rm20(keyPath, { force: true });
|
|
100376
100637
|
const released = /* @__PURE__ */ new Map();
|
|
100377
|
-
for (const
|
|
100378
|
-
const fields = opened.get(keyOf(
|
|
100379
|
-
if (fields) released.set(
|
|
100638
|
+
for (const entry2 of entries) {
|
|
100639
|
+
const fields = opened.get(keyOf(entry2));
|
|
100640
|
+
if (fields) released.set(entry2.ref, { fields });
|
|
100380
100641
|
}
|
|
100381
100642
|
return { released, entries };
|
|
100382
100643
|
}
|
|
@@ -100462,7 +100723,7 @@ async function printNames({
|
|
|
100462
100723
|
}) {
|
|
100463
100724
|
const refs = refsOf(lines2);
|
|
100464
100725
|
const entries = refs.length > 0 ? await resolveBatch({ context, args, refs }) : [];
|
|
100465
|
-
const byRef = new Map(entries.map((
|
|
100726
|
+
const byRef = new Map(entries.map((entry2) => [entry2.ref, entry2.connection]));
|
|
100466
100727
|
let missing = false;
|
|
100467
100728
|
for (const line of lines2) {
|
|
100468
100729
|
const label3 = line.kind === "connection" ? line.ref : line.variable;
|
|
@@ -100497,9 +100758,9 @@ async function releasedKeys({
|
|
|
100497
100758
|
if (refs.length === 0) return { released: /* @__PURE__ */ new Map(), byConnection };
|
|
100498
100759
|
const outcome = await releaseBatch({ context, args, refs, reason: reason2, command: [...command] });
|
|
100499
100760
|
if ("exitCode" in outcome) return outcome;
|
|
100500
|
-
for (const
|
|
100501
|
-
const fields = outcome.released.get(
|
|
100502
|
-
if (
|
|
100761
|
+
for (const entry2 of outcome.entries) {
|
|
100762
|
+
const fields = outcome.released.get(entry2.ref)?.fields;
|
|
100763
|
+
if (entry2.connection && fields) byConnection.set(entry2.connection.name, fields);
|
|
100503
100764
|
}
|
|
100504
100765
|
return { released: outcome.released, byConnection };
|
|
100505
100766
|
}
|
|
@@ -100635,7 +100896,7 @@ ${EXEC_PROVIDER_USAGE}`);
|
|
|
100635
100896
|
context,
|
|
100636
100897
|
args,
|
|
100637
100898
|
refs: [...new Set(ids.map((id4) => splitExecId({ id: id4 }).connection))]
|
|
100638
|
-
})).filter((
|
|
100899
|
+
})).filter((entry2) => entry2.connection).map((entry2) => entry2.ref)
|
|
100639
100900
|
);
|
|
100640
100901
|
for (const id4 of ids) {
|
|
100641
100902
|
const { connection, field } = splitExecId({ id: id4 });
|
|
@@ -100743,7 +101004,7 @@ async function vaultSave({ context, args }) {
|
|
|
100743
101004
|
// src/services/vault-scrub-commands.service.ts
|
|
100744
101005
|
function lineOf5(channel) {
|
|
100745
101006
|
const where = channel.name ? `#${channel.name}` : channel.channelId;
|
|
100746
|
-
const found = Object.entries(channel.found).map(([vendor,
|
|
101007
|
+
const found = Object.entries(channel.found).map(([vendor, count6]) => `${vendor} ${count6}`).join(", ");
|
|
100747
101008
|
const kinds = [`held ${channel.held}`, ...found ? [`found: ${found}`] : []].join("; ");
|
|
100748
101009
|
return `${where} scanned ${channel.scanned} changed ${channel.messages} ${kinds}
|
|
100749
101010
|
`;
|
|
@@ -101733,8 +101994,8 @@ async function roles({ context, args }) {
|
|
|
101733
101994
|
const catalogue = await client.get("/api/roles");
|
|
101734
101995
|
if (args.flags.json) return printJson11(context, catalogue);
|
|
101735
101996
|
for (const role2 of catalogue) {
|
|
101736
|
-
const
|
|
101737
|
-
context.out(`${role2.label} ${
|
|
101997
|
+
const count6 = `${role2.permissions.length} permissions`;
|
|
101998
|
+
context.out(`${role2.label} ${count6} ${role2.description}
|
|
101738
101999
|
`);
|
|
101739
102000
|
context.out(` ${role2.permissions.join(", ")}
|
|
101740
102001
|
`);
|
|
@@ -101749,12 +102010,12 @@ async function audit({ context, args }) {
|
|
|
101749
102010
|
const entries = await client.post("/api/audit-log/list", limit ? { limit } : {});
|
|
101750
102011
|
if (args.flags.json) return printJson11(context, entries);
|
|
101751
102012
|
if (entries.length === 0) return context.out("No audited actions yet.\n");
|
|
101752
|
-
for (const
|
|
101753
|
-
const actor = `${
|
|
101754
|
-
const target =
|
|
101755
|
-
const refused =
|
|
102013
|
+
for (const entry2 of entries) {
|
|
102014
|
+
const actor = `${entry2.actorType}${entry2.actorId ? ` ${entry2.actorId}` : ""}`;
|
|
102015
|
+
const target = entry2.targetKind ? `${entry2.targetKind} ${entry2.targetId ?? ""}`.trim() : "";
|
|
102016
|
+
const refused = entry2.errorCode ? `refused: ${entry2.errorCode}` : "";
|
|
101756
102017
|
context.out(
|
|
101757
|
-
`${[
|
|
102018
|
+
`${[entry2.createdAt, actor, entry2.action, target, refused].filter(Boolean).join(" ")}
|
|
101758
102019
|
`
|
|
101759
102020
|
);
|
|
101760
102021
|
}
|
|
@@ -101960,7 +102221,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
101960
102221
|
laze agent runs-on <agent> laze|claude|codex [--pool <pool>] moves it to Laze credits, Claude Code or Codex
|
|
101961
102222
|
laze agent access|dm|disconnect <agent> who can talk to it, your conversation with it, revoke its key
|
|
101962
102223
|
laze agent permission-prompts <agent> each permission prompt its harness raised and rush's answer
|
|
101963
|
-
laze agent share|unshare <agent> --person <userId> | --group <groupId> | --channel <channelId> share it (its owner)
|
|
102224
|
+
laze agent share|unshare <agent> --person <userId> | --group <groupId> | --channel <channelId> | --agent <agent> share it (its owner); an added agent DMs it
|
|
101964
102225
|
laze agent stop <agent> --channel <channelId> stop its running turn there
|
|
101965
102226
|
laze agent retry <agent> --channel <id> --message <id> Try again on its failed turn on that message
|
|
101966
102227
|
laze agent invite [--name <name>] [--channel <id>] a one-time link that connects a new agent;
|