@lazehq/cli 0.1.55 → 0.1.57
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 +1630 -434
- package/package.json +1 -1
package/dist/laze.mjs
CHANGED
|
@@ -2491,7 +2491,7 @@ var require_websocket = __commonJS({
|
|
|
2491
2491
|
var http = __require("http");
|
|
2492
2492
|
var net = __require("net");
|
|
2493
2493
|
var tls = __require("tls");
|
|
2494
|
-
var { randomBytes: randomBytes2, createHash:
|
|
2494
|
+
var { randomBytes: randomBytes2, createHash: createHash4 } = __require("crypto");
|
|
2495
2495
|
var { Duplex, Readable } = __require("stream");
|
|
2496
2496
|
var { URL: URL2 } = __require("url");
|
|
2497
2497
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
@@ -3159,7 +3159,7 @@ var require_websocket = __commonJS({
|
|
|
3159
3159
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
3160
3160
|
return;
|
|
3161
3161
|
}
|
|
3162
|
-
const digest =
|
|
3162
|
+
const digest = createHash4("sha1").update(key + GUID).digest("base64");
|
|
3163
3163
|
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
3164
3164
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
3165
3165
|
return;
|
|
@@ -3528,7 +3528,7 @@ var require_websocket_server = __commonJS({
|
|
|
3528
3528
|
var EventEmitter = __require("events");
|
|
3529
3529
|
var http = __require("http");
|
|
3530
3530
|
var { Duplex } = __require("stream");
|
|
3531
|
-
var { createHash:
|
|
3531
|
+
var { createHash: createHash4 } = __require("crypto");
|
|
3532
3532
|
var extension2 = require_extension();
|
|
3533
3533
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
3534
3534
|
var subprotocol2 = require_subprotocol();
|
|
@@ -3835,7 +3835,7 @@ var require_websocket_server = __commonJS({
|
|
|
3835
3835
|
);
|
|
3836
3836
|
}
|
|
3837
3837
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
3838
|
-
const digest =
|
|
3838
|
+
const digest = createHash4("sha1").update(key + GUID).digest("base64");
|
|
3839
3839
|
const headers = [
|
|
3840
3840
|
"HTTP/1.1 101 Switching Protocols",
|
|
3841
3841
|
"Upgrade: websocket",
|
|
@@ -18733,7 +18733,7 @@ var require_snapshot_utils = __commonJS({
|
|
|
18733
18733
|
var require_snapshot_recorder = __commonJS({
|
|
18734
18734
|
"../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
|
|
18735
18735
|
"use strict";
|
|
18736
|
-
var { writeFile: writeFile24, readFile:
|
|
18736
|
+
var { writeFile: writeFile24, readFile: readFile44, mkdir: mkdir23 } = __require("node:fs/promises");
|
|
18737
18737
|
var { dirname: dirname24, resolve: resolve21 } = __require("node:path");
|
|
18738
18738
|
var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
|
|
18739
18739
|
var { InvalidArgumentError, UndiciError } = require_errors();
|
|
@@ -18950,7 +18950,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
18950
18950
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
18951
18951
|
}
|
|
18952
18952
|
try {
|
|
18953
|
-
const data = await
|
|
18953
|
+
const data = await readFile44(resolve21(path), "utf8");
|
|
18954
18954
|
const parsed = JSON.parse(data);
|
|
18955
18955
|
if (Array.isArray(parsed)) {
|
|
18956
18956
|
this.#snapshots.clear();
|
|
@@ -31489,6 +31489,13 @@ function findSecrets({
|
|
|
31489
31489
|
(secret) => !isPlaceholderValue({ value: secret.value, kind: secret.kind })
|
|
31490
31490
|
);
|
|
31491
31491
|
}
|
|
31492
|
+
function redactDetectedSecrets({ text: text2 }) {
|
|
31493
|
+
let out = text2;
|
|
31494
|
+
for (const secret of matchSecrets({ text: text2 }).reverse()) {
|
|
31495
|
+
out = out.slice(0, secret.start) + REDACTION_MARKER + out.slice(secret.end);
|
|
31496
|
+
}
|
|
31497
|
+
return out;
|
|
31498
|
+
}
|
|
31492
31499
|
|
|
31493
31500
|
// ../../packages/secret-guard/src/detector/one-time-links.ts
|
|
31494
31501
|
var URL_PATTERN = /https?:\/\/[^\s<>"'`)\]]+/g;
|
|
@@ -31580,6 +31587,91 @@ function secretValuesOf({
|
|
|
31580
31587
|
return Object.entries(fields).filter(([name3]) => !isIdentifierField({ name: name3 })).map(([, value]) => value);
|
|
31581
31588
|
}
|
|
31582
31589
|
|
|
31590
|
+
// ../../packages/secret-guard/src/redaction/jsonl-strings.ts
|
|
31591
|
+
var JSONL_STRUCTURAL_KEYS = /* @__PURE__ */ new Set([
|
|
31592
|
+
"uuid",
|
|
31593
|
+
"parentUuid",
|
|
31594
|
+
"leafUuid",
|
|
31595
|
+
"logicalParentUuid",
|
|
31596
|
+
"sessionId",
|
|
31597
|
+
"requestId",
|
|
31598
|
+
"messageId",
|
|
31599
|
+
"id",
|
|
31600
|
+
"tool_use_id",
|
|
31601
|
+
"call_id",
|
|
31602
|
+
"type",
|
|
31603
|
+
"role",
|
|
31604
|
+
"timestamp",
|
|
31605
|
+
"version",
|
|
31606
|
+
"model",
|
|
31607
|
+
"signature",
|
|
31608
|
+
"cwd",
|
|
31609
|
+
"gitBranch",
|
|
31610
|
+
"userType",
|
|
31611
|
+
"stop_reason",
|
|
31612
|
+
"originator",
|
|
31613
|
+
"cli_version"
|
|
31614
|
+
]);
|
|
31615
|
+
function recordSlotsOf(record4, into) {
|
|
31616
|
+
for (const [key, item] of Object.entries(record4)) {
|
|
31617
|
+
if (typeof item !== "string") slotsOf(item, into);
|
|
31618
|
+
else if (!JSONL_STRUCTURAL_KEYS.has(key)) into.push({ holder: record4, key });
|
|
31619
|
+
}
|
|
31620
|
+
}
|
|
31621
|
+
function slotsOf(value, into) {
|
|
31622
|
+
if (Array.isArray(value)) {
|
|
31623
|
+
value.forEach((item, index) => {
|
|
31624
|
+
if (typeof item === "string") into.push({ holder: value, key: index });
|
|
31625
|
+
else slotsOf(item, into);
|
|
31626
|
+
});
|
|
31627
|
+
return;
|
|
31628
|
+
}
|
|
31629
|
+
if (typeof value === "object" && value !== null) {
|
|
31630
|
+
recordSlotsOf(value, into);
|
|
31631
|
+
}
|
|
31632
|
+
}
|
|
31633
|
+
function read(slot) {
|
|
31634
|
+
return slot.holder[slot.key] ?? "";
|
|
31635
|
+
}
|
|
31636
|
+
function write(slot, text2) {
|
|
31637
|
+
slot.holder[slot.key] = text2;
|
|
31638
|
+
}
|
|
31639
|
+
function parsedLine(line) {
|
|
31640
|
+
if (line.trim() === "") return { raw: true };
|
|
31641
|
+
try {
|
|
31642
|
+
return { raw: false, value: JSON.parse(line) };
|
|
31643
|
+
} catch {
|
|
31644
|
+
return { raw: true };
|
|
31645
|
+
}
|
|
31646
|
+
}
|
|
31647
|
+
async function mapJsonlStrings({
|
|
31648
|
+
text: text2,
|
|
31649
|
+
mapAll
|
|
31650
|
+
}) {
|
|
31651
|
+
const sources = text2.split("\n");
|
|
31652
|
+
const cells = [];
|
|
31653
|
+
const raw = [];
|
|
31654
|
+
const slots = [];
|
|
31655
|
+
sources.forEach((source, index) => {
|
|
31656
|
+
const line = parsedLine(source);
|
|
31657
|
+
raw.push(line.raw);
|
|
31658
|
+
cells.push(line.raw ? source : line.value);
|
|
31659
|
+
if (typeof cells[index] !== "string") slotsOf(cells[index], slots);
|
|
31660
|
+
else if (source.trim() !== "") slots.push({ holder: cells, key: index });
|
|
31661
|
+
});
|
|
31662
|
+
const before = slots.map(read);
|
|
31663
|
+
const after = await mapAll(before);
|
|
31664
|
+
if (after.length !== before.length) throw new Error("mapAll answered a different count");
|
|
31665
|
+
let changed = 0;
|
|
31666
|
+
slots.forEach((slot, index) => {
|
|
31667
|
+
const next = after[index] ?? "";
|
|
31668
|
+
if (next !== before[index]) changed += 1;
|
|
31669
|
+
write(slot, next);
|
|
31670
|
+
});
|
|
31671
|
+
const out = cells.map((cell, index) => raw[index] ? String(cell) : JSON.stringify(cell));
|
|
31672
|
+
return { text: out.join("\n"), changed };
|
|
31673
|
+
}
|
|
31674
|
+
|
|
31583
31675
|
// ../../packages/secret-guard/src/redaction/redactor.ts
|
|
31584
31676
|
var REDACTED = "****";
|
|
31585
31677
|
var MIN_REDACTED_LENGTH = 4;
|
|
@@ -35656,6 +35748,17 @@ var ConfigStore = class _ConfigStore {
|
|
|
35656
35748
|
await this.write({ ...config2, profiles: { ...config2.profiles, [name3]: updated } });
|
|
35657
35749
|
return true;
|
|
35658
35750
|
}
|
|
35751
|
+
/** Marks a profile migrated; false when there is none. */
|
|
35752
|
+
async markMigrated({ name: name3, migrated }) {
|
|
35753
|
+
const config2 = await this.read();
|
|
35754
|
+
const profile = config2.profiles[name3];
|
|
35755
|
+
if (!profile) return false;
|
|
35756
|
+
await this.write({
|
|
35757
|
+
...config2,
|
|
35758
|
+
profiles: { ...config2.profiles, [name3]: { ...profile, migrated } }
|
|
35759
|
+
});
|
|
35760
|
+
return true;
|
|
35761
|
+
}
|
|
35659
35762
|
async removeProfile({ name: name3 }) {
|
|
35660
35763
|
const config2 = await this.read();
|
|
35661
35764
|
if (!config2.profiles[name3]) return false;
|
|
@@ -35739,7 +35842,8 @@ var SWITCHES = /* @__PURE__ */ new Set([
|
|
|
35739
35842
|
"names",
|
|
35740
35843
|
"shell",
|
|
35741
35844
|
"self",
|
|
35742
|
-
"all"
|
|
35845
|
+
"all",
|
|
35846
|
+
"resend"
|
|
35743
35847
|
]);
|
|
35744
35848
|
function parseArgs({ argv }) {
|
|
35745
35849
|
const words = [];
|
|
@@ -35777,7 +35881,7 @@ function flagText({
|
|
|
35777
35881
|
}
|
|
35778
35882
|
|
|
35779
35883
|
// src/rules/cli-version.rules.ts
|
|
35780
|
-
var STAMPED = "0.1.
|
|
35884
|
+
var STAMPED = "0.1.57";
|
|
35781
35885
|
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
35782
35886
|
return stamped.startsWith("__") ? "dev" : stamped;
|
|
35783
35887
|
}
|
|
@@ -35789,6 +35893,14 @@ var CliUsageError = class extends Error {
|
|
|
35789
35893
|
this.name = "CliUsageError";
|
|
35790
35894
|
}
|
|
35791
35895
|
};
|
|
35896
|
+
var ProfileMigratedError = class extends Error {
|
|
35897
|
+
constructor(profile) {
|
|
35898
|
+
super(`The agent of profile "${profile}" moved into Laze.`);
|
|
35899
|
+
this.profile = profile;
|
|
35900
|
+
this.name = "ProfileMigratedError";
|
|
35901
|
+
}
|
|
35902
|
+
profile;
|
|
35903
|
+
};
|
|
35792
35904
|
|
|
35793
35905
|
// ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/external.js
|
|
35794
35906
|
var external_exports = {};
|
|
@@ -57706,13 +57818,13 @@ function moduleApi(name3) {
|
|
|
57706
57818
|
|
|
57707
57819
|
// ../../packages/module/src/contract/trpc-contract.ts
|
|
57708
57820
|
function contractBuilder(namespace, members3) {
|
|
57709
|
-
const member = (name3, kind2,
|
|
57821
|
+
const member = (name3, kind2, read4 = {}) => ({
|
|
57710
57822
|
withInput: (input2) => {
|
|
57711
57823
|
assertUndeclared(namespace, name3, members3);
|
|
57712
57824
|
const cached2 = {
|
|
57713
|
-
...
|
|
57714
|
-
...
|
|
57715
|
-
...
|
|
57825
|
+
...read4.invalidatedBy ? { invalidatedBy: read4.invalidatedBy } : {},
|
|
57826
|
+
...read4.fromProjection ? { fromProjection: read4.fromProjection } : {},
|
|
57827
|
+
...read4.revision === void 0 ? {} : { revision: read4.revision }
|
|
57716
57828
|
};
|
|
57717
57829
|
const declared = { ...members3, [name3]: { kind: kind2, input: input2, output: void 0, ...cached2 } };
|
|
57718
57830
|
return {
|
|
@@ -57835,6 +57947,12 @@ var revokeApiKeyInputSchemaDefinition = external_exports.object({
|
|
|
57835
57947
|
apiKeyId: external_exports.string().min(1)
|
|
57836
57948
|
});
|
|
57837
57949
|
var revokeApiKeyInputSchema = revokeApiKeyInputSchemaDefinition;
|
|
57950
|
+
var retiredKeyNoticeSchemaDefinition = external_exports.object({
|
|
57951
|
+
code: external_exports.enum(["agent_migrated"]),
|
|
57952
|
+
message: external_exports.string().min(1).max(1e3),
|
|
57953
|
+
/** Where the holder goes instead, such as the migrated agent's chat. */
|
|
57954
|
+
link: external_exports.string().max(2e3).optional()
|
|
57955
|
+
});
|
|
57838
57956
|
var revokeCurrentKeyInputSchemaDefinition = external_exports.object({});
|
|
57839
57957
|
var createApiKeyByKeyInputSchemaDefinition = external_exports.object({
|
|
57840
57958
|
name: external_exports.string().trim().min(1).max(80),
|
|
@@ -58030,13 +58148,28 @@ var layoutBlockSchemaDefinition = external_exports.discriminatedUnion("type", [
|
|
|
58030
58148
|
cardSchemaDefinition,
|
|
58031
58149
|
external_exports.object({ type: external_exports.literal("carousel"), cards: external_exports.array(cardSchemaDefinition).max(10) })
|
|
58032
58150
|
]);
|
|
58151
|
+
var layoutChipSchemaDefinition = external_exports.object({
|
|
58152
|
+
label: plain,
|
|
58153
|
+
color: external_exports.string().regex(/^[a-z]{1,20}$/)
|
|
58154
|
+
});
|
|
58033
58155
|
var attachmentFieldSchemaDefinition = external_exports.object({
|
|
58034
58156
|
title: plain,
|
|
58035
58157
|
value: markdown,
|
|
58036
|
-
short: external_exports.boolean()
|
|
58158
|
+
short: external_exports.boolean(),
|
|
58159
|
+
chips: external_exports.array(layoutChipSchemaDefinition).max(LAYOUT_ITEMS_MAX).optional()
|
|
58160
|
+
});
|
|
58161
|
+
var layoutFileSchemaDefinition = external_exports.object({
|
|
58162
|
+
name: plain,
|
|
58163
|
+
path: external_exports.string().max(600).regex(/^\/api\/[^\s]*$/),
|
|
58164
|
+
image: external_exports.boolean()
|
|
58037
58165
|
});
|
|
58038
58166
|
var layoutAttachmentSchemaDefinition = external_exports.object({
|
|
58039
58167
|
type: external_exports.literal("attachment"),
|
|
58168
|
+
/** A list item draws its fields as a table; a shared message is a quoted message. */
|
|
58169
|
+
kind: external_exports.enum(["list_item", "message"]).optional(),
|
|
58170
|
+
/** The line under the author or title, such as "Posted in #channel". */
|
|
58171
|
+
subtitle: markdown.optional(),
|
|
58172
|
+
files: external_exports.array(layoutFileSchemaDefinition).max(10).optional(),
|
|
58040
58173
|
/** `#RRGGBB`, or null for the default grey bar. */
|
|
58041
58174
|
color: external_exports.string().regex(/^#[0-9A-F]{6}$/).nullable(),
|
|
58042
58175
|
pretext: markdown,
|
|
@@ -59246,8 +59379,11 @@ var markReadInputSchema = markReadInputSchemaDefinition;
|
|
|
59246
59379
|
var markUnreadInputSchemaDefinition = external_exports.object({
|
|
59247
59380
|
workspaceId: workspaceIdSchema,
|
|
59248
59381
|
channelId: idSchema4,
|
|
59249
|
-
/**
|
|
59250
|
-
|
|
59382
|
+
/**
|
|
59383
|
+
* The message to read again from: the marker moves to just before it. Absent: the last
|
|
59384
|
+
* message that counts as unread for the reader, and the marker never moves forward.
|
|
59385
|
+
*/
|
|
59386
|
+
seq: external_exports.number().int().positive().optional()
|
|
59251
59387
|
});
|
|
59252
59388
|
var markUnreadInputSchema = markUnreadInputSchemaDefinition;
|
|
59253
59389
|
var searchInputSchemaDefinition = external_exports.object({
|
|
@@ -59539,7 +59675,15 @@ var draftSchemaDefinition = external_exports.object({
|
|
|
59539
59675
|
reachable: external_exports.boolean()
|
|
59540
59676
|
});
|
|
59541
59677
|
var draftSchema = draftSchemaDefinition;
|
|
59542
|
-
var
|
|
59678
|
+
var clearedDraftSchemaDefinition = external_exports.object({
|
|
59679
|
+
channelId: idSchema4,
|
|
59680
|
+
threadRootId: idSchema4.nullable(),
|
|
59681
|
+
savedAt: external_exports.iso.datetime()
|
|
59682
|
+
});
|
|
59683
|
+
var draftListSchemaDefinition = external_exports.object({
|
|
59684
|
+
drafts: external_exports.array(draftSchemaDefinition),
|
|
59685
|
+
cleared: external_exports.array(clearedDraftSchemaDefinition).default([])
|
|
59686
|
+
});
|
|
59543
59687
|
var draftListSchema = draftListSchemaDefinition;
|
|
59544
59688
|
var saveDraftInputSchemaDefinition = external_exports.object({
|
|
59545
59689
|
workspaceId: workspaceIdSchema,
|
|
@@ -60605,7 +60749,9 @@ var readMarkerMovedPayloadSchemaDefinition = external_exports.object({
|
|
|
60605
60749
|
seq: external_exports.number().int().nonnegative(),
|
|
60606
60750
|
at: external_exports.iso.datetime(),
|
|
60607
60751
|
/** A mirror moved it to match its source, so the source needs no telling. */
|
|
60608
|
-
fromSource: external_exports.boolean().default(false)
|
|
60752
|
+
fromSource: external_exports.boolean().default(false),
|
|
60753
|
+
/** The reader marked it unread: a Laze-side change the source never hears of. */
|
|
60754
|
+
markedUnread: external_exports.boolean().optional()
|
|
60609
60755
|
});
|
|
60610
60756
|
var realtimePublicationSchemaDefinition = external_exports.discriminatedUnion("type", [
|
|
60611
60757
|
external_exports.object({
|
|
@@ -61739,6 +61885,8 @@ var vaultConfig = Config.define((c) => ({
|
|
|
61739
61885
|
publicOriginAliases,
|
|
61740
61886
|
/** A file each audit chain head is appended to as a JSON line; unset only logs the heads. */
|
|
61741
61887
|
auditHeadFile: c.env("VAULT_AUDIT_HEAD_FILE", external_exports.string().min(1).optional()),
|
|
61888
|
+
/** The progress board's alert folder for ops cards (a-content-open-fail); unset only logs. */
|
|
61889
|
+
opsAlertDir: c.env("VAULT_OPS_ALERT_DIR", external_exports.string().min(1).optional()),
|
|
61742
61890
|
/** vaultd's socket; set, the master key and data keys stay in vaultd, unset keeps them here. */
|
|
61743
61891
|
vaultdSocket: c.env("LAZE_VAULTD_SOCKET", external_exports.string().min(1).optional()),
|
|
61744
61892
|
/** Where the in-process key sends AWS STS calls instead of AWS; vaultd has its own flag. */
|
|
@@ -62843,6 +62991,18 @@ var claudeGatewayModelsSchemaDefinition = external_exports.object({
|
|
|
62843
62991
|
haiku: external_exports.string().min(1)
|
|
62844
62992
|
});
|
|
62845
62993
|
var claudeGatewayModelsSchema = claudeGatewayModelsSchemaDefinition;
|
|
62994
|
+
var sessionImportSchemaDefinition = external_exports.object({
|
|
62995
|
+
migrationId: external_exports.string().regex(/^[A-Za-z0-9_-]{1,200}$/),
|
|
62996
|
+
/** `resume` writes the transcript where the harness resumes it; `seed` writes MIGRATED.md. */
|
|
62997
|
+
mode: external_exports.enum(["resume", "seed"]),
|
|
62998
|
+
/** The harness the transcript came from. */
|
|
62999
|
+
harness: harnessKindSchema,
|
|
63000
|
+
/** The harness's own session id the resume names; absent for a seed. */
|
|
63001
|
+
sessionId: external_exports.string().regex(/^[A-Za-z0-9_-]{1,100}$/).optional(),
|
|
63002
|
+
/** The Codex rollout's file name. */
|
|
63003
|
+
fileName: external_exports.string().regex(/^[A-Za-z0-9._-]{1,200}\.jsonl$/).optional()
|
|
63004
|
+
});
|
|
63005
|
+
var sessionImportSchema = sessionImportSchemaDefinition;
|
|
62846
63006
|
var agentSandboxSpecSchemaDefinition = external_exports.object({
|
|
62847
63007
|
workspaceId: external_exports.string().min(1),
|
|
62848
63008
|
agentId: external_exports.string().regex(/^[a-zA-Z0-9_-]+$/),
|
|
@@ -62871,7 +63031,9 @@ var agentSandboxSpecSchemaDefinition = external_exports.object({
|
|
|
62871
63031
|
/** A personal agent's owner: their dedicated IP's route applies to this agent. */
|
|
62872
63032
|
routeOwnerUserId: external_exports.string().min(1).optional(),
|
|
62873
63033
|
/** Set by the runtime from the workspace's plan: egress applies the Free plan's rules. */
|
|
62874
|
-
freePlan: external_exports.boolean().optional()
|
|
63034
|
+
freePlan: external_exports.boolean().optional(),
|
|
63035
|
+
/** A migrated agent's imported session, used when its main session first starts. */
|
|
63036
|
+
sessionImport: sessionImportSchemaDefinition.optional()
|
|
62875
63037
|
});
|
|
62876
63038
|
var deliveredFileSchemaDefinition = external_exports.object({
|
|
62877
63039
|
/** Relative to the agent's work folder, e.g. `attachments/<messageId>/report.pdf`. */
|
|
@@ -63059,6 +63221,8 @@ var supervisorLaunchSchemaDefinition = external_exports.object({
|
|
|
63059
63221
|
cli: external_exports.object({ workspaceId: external_exports.string().min(1), agentName: external_exports.string().min(1) }).optional(),
|
|
63060
63222
|
/** The agent's DM with its owner: its one session is tagged with it and its events carry it. */
|
|
63061
63223
|
mainChannelId: external_exports.string().regex(/^[a-zA-Z0-9_-]+$/).optional(),
|
|
63224
|
+
/** A migrated agent's imported session, fetched once when the main session first starts. */
|
|
63225
|
+
sessionImport: sessionImportSchema.optional(),
|
|
63062
63226
|
/** Set by the connector on a person's own machine: ports, paths and the local token. */
|
|
63063
63227
|
machine: supervisorMachineSchemaDefinition.optional(),
|
|
63064
63228
|
/** On a machine, by relay connection id: the placeholder a local caller must present. */
|
|
@@ -65195,6 +65359,124 @@ var uploadAvatarAsCallerInputSchemaDefinition = external_exports.object({
|
|
|
65195
65359
|
dataBase64: external_exports.string().min(1).max(Math.ceil(AGENT_AVATAR_PICK_MAX_BYTES * 4 / 3) + 8)
|
|
65196
65360
|
});
|
|
65197
65361
|
|
|
65362
|
+
// ../../modules/agent/contract/src/agent-migration.ts
|
|
65363
|
+
var workspaceIdSchema8 = external_exports.string().min(1);
|
|
65364
|
+
var idSchema12 = external_exports.string().min(1).max(200);
|
|
65365
|
+
var agentRefSchema5 = external_exports.string().trim().min(1).max(80);
|
|
65366
|
+
var MIGRATION_PART_MAX_BYTES = 1024 * 1024;
|
|
65367
|
+
var MIGRATION_PARTS_MAX = 64;
|
|
65368
|
+
var migrationSourceSchema = external_exports.enum(["claude-code", "codex"]);
|
|
65369
|
+
var migrationModeSchema = external_exports.enum(["resume", "seed"]);
|
|
65370
|
+
var migrationStatusSchema = external_exports.enum(["waiting", "uploading", "done", "cancelled"]);
|
|
65371
|
+
var migrationRemovedSchemaDefinition = external_exports.object({
|
|
65372
|
+
/** Redacted on the owner's machine before the upload. */
|
|
65373
|
+
local: external_exports.number().int().nonnegative(),
|
|
65374
|
+
/** Values held in the workspace's vault. */
|
|
65375
|
+
vault: external_exports.number().int().nonnegative(),
|
|
65376
|
+
/** Key-shaped text the server's detector found. */
|
|
65377
|
+
patterns: external_exports.number().int().nonnegative()
|
|
65378
|
+
});
|
|
65379
|
+
var agentMigrationSchemaDefinition = external_exports.object({
|
|
65380
|
+
id: external_exports.string().min(1),
|
|
65381
|
+
agentId: external_exports.string().min(1),
|
|
65382
|
+
agentName: external_exports.string(),
|
|
65383
|
+
source: migrationSourceSchema,
|
|
65384
|
+
target: hostedHarnessSchema,
|
|
65385
|
+
modelLevel: external_exports.enum(["frontier", "fast"]).nullable(),
|
|
65386
|
+
mode: migrationModeSchema,
|
|
65387
|
+
status: migrationStatusSchema,
|
|
65388
|
+
requestedAt: external_exports.iso.datetime(),
|
|
65389
|
+
updatedAt: external_exports.iso.datetime(),
|
|
65390
|
+
completedAt: external_exports.iso.datetime().nullable(),
|
|
65391
|
+
/** When the agent's machine last called Laze; null when it never did. */
|
|
65392
|
+
machineLastSeenAt: external_exports.iso.datetime().nullable(),
|
|
65393
|
+
/** The agent's DM, where the request and the notice are. */
|
|
65394
|
+
channelId: external_exports.string().nullable(),
|
|
65395
|
+
/** The notice's place in the DM, once done. */
|
|
65396
|
+
noticeSeq: external_exports.number().int().nullable(),
|
|
65397
|
+
/** Counts of what was removed, never the values; null before it is done. */
|
|
65398
|
+
removed: migrationRemovedSchemaDefinition.nullable()
|
|
65399
|
+
});
|
|
65400
|
+
var agentMigrationSchema = agentMigrationSchemaDefinition;
|
|
65401
|
+
var migrateAgentInputSchemaDefinition = external_exports.object({
|
|
65402
|
+
workspaceId: workspaceIdSchema8,
|
|
65403
|
+
agentId: idSchema12,
|
|
65404
|
+
harness: hostedHarnessSchema,
|
|
65405
|
+
/** For Laze models; fast when not given. */
|
|
65406
|
+
modelLevel: external_exports.enum(["frontier", "fast"]).optional(),
|
|
65407
|
+
/** Post the request to the agent's session again while one waits. */
|
|
65408
|
+
resend: external_exports.boolean().default(false)
|
|
65409
|
+
});
|
|
65410
|
+
var migrateAgentInputSchema = migrateAgentInputSchemaDefinition;
|
|
65411
|
+
var agentMigrationInputSchemaDefinition = external_exports.object({
|
|
65412
|
+
workspaceId: workspaceIdSchema8,
|
|
65413
|
+
agentId: idSchema12
|
|
65414
|
+
});
|
|
65415
|
+
var agentMigrationInputSchema = agentMigrationInputSchemaDefinition;
|
|
65416
|
+
var migrateAgentAsCallerInputSchemaDefinition = external_exports.object({
|
|
65417
|
+
agent: agentRefSchema5,
|
|
65418
|
+
/** Where it runs in Laze; its own harness when not given. */
|
|
65419
|
+
harness: hostedHarnessSchema.optional(),
|
|
65420
|
+
modelLevel: external_exports.enum(["frontier", "fast"]).optional(),
|
|
65421
|
+
resend: external_exports.boolean().default(false)
|
|
65422
|
+
});
|
|
65423
|
+
var agentMigrationAsCallerInputSchemaDefinition = external_exports.object({ agent: agentRefSchema5 });
|
|
65424
|
+
var nullableMigrationSchemaDefinition = external_exports.object({
|
|
65425
|
+
migration: agentMigrationSchemaDefinition.nullable()
|
|
65426
|
+
});
|
|
65427
|
+
var nullableMigrationSchema = nullableMigrationSchemaDefinition;
|
|
65428
|
+
var migrationIdParamsSchemaDefinition = external_exports.object({ migrationId: idSchema12 });
|
|
65429
|
+
var migrationPartParamsSchemaDefinition = external_exports.object({
|
|
65430
|
+
migrationId: idSchema12,
|
|
65431
|
+
index: external_exports.coerce.number().int().min(0).max(MIGRATION_PARTS_MAX - 1)
|
|
65432
|
+
});
|
|
65433
|
+
var migrationTicketSchemaDefinition = external_exports.object({
|
|
65434
|
+
id: external_exports.string().min(1),
|
|
65435
|
+
status: migrationStatusSchema,
|
|
65436
|
+
source: migrationSourceSchema,
|
|
65437
|
+
mode: migrationModeSchema,
|
|
65438
|
+
/** The session the agent was bound to, when it was. */
|
|
65439
|
+
sessionId: external_exports.string().nullable(),
|
|
65440
|
+
partMaxBytes: external_exports.number().int().positive(),
|
|
65441
|
+
partsMax: external_exports.number().int().positive()
|
|
65442
|
+
});
|
|
65443
|
+
var uploadMigrationPartInputSchemaDefinition = external_exports.object({
|
|
65444
|
+
text: external_exports.string().max(MIGRATION_PART_MAX_BYTES)
|
|
65445
|
+
});
|
|
65446
|
+
var completeMigrationInputSchemaDefinition = external_exports.object({
|
|
65447
|
+
parts: external_exports.number().int().min(1).max(MIGRATION_PARTS_MAX),
|
|
65448
|
+
/** Of the joined parts' UTF-8, so the server knows it holds what was sent. */
|
|
65449
|
+
sha256: external_exports.string().regex(/^[0-9a-f]{64}$/),
|
|
65450
|
+
/** The transcript was longer than the cap: only its newest lines were sent. */
|
|
65451
|
+
truncated: external_exports.boolean().default(false),
|
|
65452
|
+
/** The harness's own session id: Claude's session or Codex's thread. */
|
|
65453
|
+
sessionId: external_exports.string().regex(/^[A-Za-z0-9_-]{1,100}$/).optional(),
|
|
65454
|
+
/** The transcript's file name, which Codex finds its rollout by. */
|
|
65455
|
+
fileName: external_exports.string().regex(/^[A-Za-z0-9._-]{1,200}\.jsonl$/).optional(),
|
|
65456
|
+
localRedactions: external_exports.number().int().nonnegative().default(0)
|
|
65457
|
+
});
|
|
65458
|
+
var completedMigrationSchemaDefinition = external_exports.object({
|
|
65459
|
+
migration: agentMigrationSchemaDefinition,
|
|
65460
|
+
/** The agent's chat at the notice, to open in the browser. */
|
|
65461
|
+
link: external_exports.string()
|
|
65462
|
+
});
|
|
65463
|
+
var transcriptPartQuerySchemaDefinition = external_exports.object({
|
|
65464
|
+
part: external_exports.coerce.number().int().min(0).max(MIGRATION_PARTS_MAX - 1).default(0)
|
|
65465
|
+
});
|
|
65466
|
+
var transcriptPartSchemaDefinition = external_exports.object({
|
|
65467
|
+
index: external_exports.number().int().nonnegative(),
|
|
65468
|
+
count: external_exports.number().int().positive(),
|
|
65469
|
+
text: external_exports.string(),
|
|
65470
|
+
mode: migrationModeSchema,
|
|
65471
|
+
harness: migrationSourceSchema,
|
|
65472
|
+
sessionId: external_exports.string().nullable(),
|
|
65473
|
+
fileName: external_exports.string().nullable()
|
|
65474
|
+
});
|
|
65475
|
+
function migrationUploadCommandOf({ migrationId }) {
|
|
65476
|
+
return `laze agent migrate upload ${migrationId}`;
|
|
65477
|
+
}
|
|
65478
|
+
var agentMigrationTrpc = defineTrpcContract("agents").mutation("migrate").withInput(migrateAgentInputSchema).withOutput(agentMigrationSchema).query("migration").withInput(agentMigrationInputSchema).withOutput(nullableMigrationSchema).mutation("cancelMigration").withInput(agentMigrationInputSchema).withOutput(agentMigrationSchema).build();
|
|
65479
|
+
|
|
65198
65480
|
// ../../modules/agent/contract/src/agent-monitors.ts
|
|
65199
65481
|
var MONITOR_PROMPT_MAX = 4e3;
|
|
65200
65482
|
var MONITOR_RUNS_PER_DAY_DEFAULT = 100;
|
|
@@ -65256,8 +65538,8 @@ var addedMonitorSchemaDefinition = external_exports.object({
|
|
|
65256
65538
|
// ../../modules/agent/contract/src/agent-oauth.ts
|
|
65257
65539
|
var OAUTH_CODE_TTL_SECONDS = 5 * 60;
|
|
65258
65540
|
var REMOTE_MCP_PATH = "/mcp";
|
|
65259
|
-
var
|
|
65260
|
-
var
|
|
65541
|
+
var workspaceIdSchema9 = external_exports.string().min(1);
|
|
65542
|
+
var idSchema13 = external_exports.string().min(1).max(80);
|
|
65261
65543
|
var oauthAuthorizeRequestSchemaDefinition = external_exports.object({
|
|
65262
65544
|
response_type: external_exports.string().max(40).optional(),
|
|
65263
65545
|
client_id: external_exports.string().min(1).max(4096),
|
|
@@ -65269,7 +65551,7 @@ var oauthAuthorizeRequestSchemaDefinition = external_exports.object({
|
|
|
65269
65551
|
scope: external_exports.string().max(400).optional()
|
|
65270
65552
|
});
|
|
65271
65553
|
var oauthRequestInputSchemaDefinition = external_exports.object({
|
|
65272
|
-
workspaceId:
|
|
65554
|
+
workspaceId: workspaceIdSchema9,
|
|
65273
65555
|
request: oauthAuthorizeRequestSchemaDefinition
|
|
65274
65556
|
});
|
|
65275
65557
|
var oauthRequestInputSchema = oauthRequestInputSchemaDefinition;
|
|
@@ -65278,16 +65560,16 @@ var oauthRequestViewSchemaDefinition = external_exports.object({
|
|
|
65278
65560
|
/** The host the browser returns to, such as `chatgpt.com`. */
|
|
65279
65561
|
redirectHost: external_exports.string(),
|
|
65280
65562
|
/** The person's connected agents of this client in the workspace, newest first. */
|
|
65281
|
-
reconnectable: external_exports.array(external_exports.object({ id:
|
|
65563
|
+
reconnectable: external_exports.array(external_exports.object({ id: idSchema13, name: external_exports.string() })),
|
|
65282
65564
|
defaultName: external_exports.string()
|
|
65283
65565
|
});
|
|
65284
65566
|
var oauthRequestViewSchema = oauthRequestViewSchemaDefinition;
|
|
65285
65567
|
var approveOAuthInputSchemaDefinition = external_exports.object({
|
|
65286
|
-
workspaceId:
|
|
65568
|
+
workspaceId: workspaceIdSchema9,
|
|
65287
65569
|
request: oauthAuthorizeRequestSchemaDefinition,
|
|
65288
65570
|
name: external_exports.string().trim().min(1).max(80),
|
|
65289
65571
|
/** One of the person's agents of this client to hand a new key, instead of a new agent. */
|
|
65290
|
-
reconnectAgentId:
|
|
65572
|
+
reconnectAgentId: idSchema13.optional()
|
|
65291
65573
|
});
|
|
65292
65574
|
var approveOAuthInputSchema = approveOAuthInputSchemaDefinition;
|
|
65293
65575
|
var oauthRedirectSchemaDefinition = external_exports.object({ redirectUrl: external_exports.string() });
|
|
@@ -65319,9 +65601,9 @@ var agentPermissionPromptSchemaDefinition = external_exports.object({
|
|
|
65319
65601
|
var agentPermissionPromptSchema = agentPermissionPromptSchemaDefinition;
|
|
65320
65602
|
|
|
65321
65603
|
// ../../modules/agent/contract/src/agent-transfer.ts
|
|
65322
|
-
var
|
|
65323
|
-
var
|
|
65324
|
-
var
|
|
65604
|
+
var workspaceIdSchema10 = external_exports.string().min(1);
|
|
65605
|
+
var idSchema14 = external_exports.string().min(1).max(200);
|
|
65606
|
+
var agentRefSchema6 = external_exports.string().trim().min(1).max(80);
|
|
65325
65607
|
var agentTransferOfferSchemaDefinition = external_exports.object({
|
|
65326
65608
|
id: external_exports.string().min(1),
|
|
65327
65609
|
agentId: external_exports.string().min(1),
|
|
@@ -65336,11 +65618,11 @@ var agentTransferOfferSchemaDefinition = external_exports.object({
|
|
|
65336
65618
|
});
|
|
65337
65619
|
var agentTransferOfferSchema = agentTransferOfferSchemaDefinition;
|
|
65338
65620
|
var agentTransferInputSchemaDefinition = external_exports.object({
|
|
65339
|
-
workspaceId:
|
|
65340
|
-
agentId:
|
|
65621
|
+
workspaceId: workspaceIdSchema10,
|
|
65622
|
+
agentId: idSchema14
|
|
65341
65623
|
});
|
|
65342
65624
|
var agentTransferInputSchema = agentTransferInputSchemaDefinition;
|
|
65343
|
-
var agentTransferAsCallerInputSchemaDefinition = external_exports.object({ agent:
|
|
65625
|
+
var agentTransferAsCallerInputSchemaDefinition = external_exports.object({ agent: agentRefSchema6 });
|
|
65344
65626
|
var agentTransferOfferedPayloadSchemaDefinition = external_exports.object({
|
|
65345
65627
|
workspaceId: external_exports.string().min(1),
|
|
65346
65628
|
offerId: external_exports.string().min(1),
|
|
@@ -65370,24 +65652,24 @@ var agentWorkingSchemaDefinition = external_exports.object({ working: external_e
|
|
|
65370
65652
|
var agentWorkingSchema = agentWorkingSchemaDefinition;
|
|
65371
65653
|
|
|
65372
65654
|
// ../../modules/agent/contract/src/agent-workspace-default.ts
|
|
65373
|
-
var
|
|
65374
|
-
var
|
|
65375
|
-
var
|
|
65655
|
+
var workspaceIdSchema11 = external_exports.string().min(1);
|
|
65656
|
+
var idSchema15 = external_exports.string().min(1).max(200);
|
|
65657
|
+
var agentRefSchema7 = external_exports.string().trim().min(1).max(80);
|
|
65376
65658
|
var workspaceDefaultAgentSchemaDefinition = external_exports.object({
|
|
65377
65659
|
/** Null when the workspace has none, or its pick was removed. */
|
|
65378
|
-
agentId:
|
|
65660
|
+
agentId: idSchema15.nullable(),
|
|
65379
65661
|
name: external_exports.string().nullable()
|
|
65380
65662
|
});
|
|
65381
65663
|
var workspaceDefaultAgentSchema = workspaceDefaultAgentSchemaDefinition;
|
|
65382
65664
|
var setWorkspaceDefaultAgentInputSchemaDefinition = external_exports.object({
|
|
65383
|
-
workspaceId:
|
|
65665
|
+
workspaceId: workspaceIdSchema11,
|
|
65384
65666
|
/** A team agent of the workspace; null clears the pick. */
|
|
65385
|
-
agentId:
|
|
65667
|
+
agentId: idSchema15.nullable()
|
|
65386
65668
|
});
|
|
65387
65669
|
var setWorkspaceDefaultAgentInputSchema = setWorkspaceDefaultAgentInputSchemaDefinition;
|
|
65388
65670
|
var setWorkspaceDefaultAgentAsCallerInputSchemaDefinition = external_exports.object({
|
|
65389
65671
|
/** The agent by id or name; null clears the pick. */
|
|
65390
|
-
agent:
|
|
65672
|
+
agent: agentRefSchema7.nullable()
|
|
65391
65673
|
});
|
|
65392
65674
|
|
|
65393
65675
|
// ../../modules/agent/contract/src/agent.ts
|
|
@@ -65395,8 +65677,8 @@ var AGENT_LINK_TTL_SECONDS = 30 * 60;
|
|
|
65395
65677
|
var AGENT_JOIN_REQUEST_TTL_SECONDS = 24 * 60 * 60;
|
|
65396
65678
|
var AGENT_ONLINE_WINDOW_SECONDS = 5 * 60;
|
|
65397
65679
|
var INBOX_WAIT_MAX_SECONDS = 55;
|
|
65398
|
-
var
|
|
65399
|
-
var
|
|
65680
|
+
var workspaceIdSchema12 = external_exports.string().min(1);
|
|
65681
|
+
var idSchema16 = external_exports.string().min(1).max(80);
|
|
65400
65682
|
var agentHarnessSchema = external_exports.enum([
|
|
65401
65683
|
"claude-code",
|
|
65402
65684
|
"codex",
|
|
@@ -65443,27 +65725,27 @@ var agentContextSchemaDefinition = external_exports.object({
|
|
|
65443
65725
|
updatedAt: external_exports.iso.datetime().nullable()
|
|
65444
65726
|
});
|
|
65445
65727
|
var agentHostSchemaDefinition = external_exports.object({
|
|
65446
|
-
machineId:
|
|
65728
|
+
machineId: idSchema16,
|
|
65447
65729
|
whenOffline: external_exports.enum(["wait", "sandbox"])
|
|
65448
65730
|
});
|
|
65449
65731
|
var setAgentHostInputSchemaDefinition = external_exports.object({
|
|
65450
|
-
workspaceId:
|
|
65451
|
-
agentId:
|
|
65732
|
+
workspaceId: workspaceIdSchema12,
|
|
65733
|
+
agentId: idSchema16,
|
|
65452
65734
|
host: agentHostSchemaDefinition.nullable()
|
|
65453
65735
|
});
|
|
65454
65736
|
var setAgentComputerKeyInputSchemaDefinition = external_exports.object({
|
|
65455
|
-
workspaceId:
|
|
65456
|
-
agentId:
|
|
65737
|
+
workspaceId: workspaceIdSchema12,
|
|
65738
|
+
agentId: idSchema16,
|
|
65457
65739
|
computerKey: external_exports.string().min(1).max(200).nullable()
|
|
65458
65740
|
});
|
|
65459
65741
|
var agentSchemaDefinition = external_exports.object({
|
|
65460
|
-
id:
|
|
65461
|
-
workspaceId:
|
|
65742
|
+
id: idSchema16,
|
|
65743
|
+
workspaceId: workspaceIdSchema12,
|
|
65462
65744
|
name: external_exports.string(),
|
|
65463
65745
|
kind: external_exports.enum(["personal", "team"]),
|
|
65464
65746
|
hosting: agentHostingSchema,
|
|
65465
65747
|
harness: agentHarnessSchema,
|
|
65466
|
-
ownerUserId:
|
|
65748
|
+
ownerUserId: idSchema16,
|
|
65467
65749
|
status: external_exports.enum(["connected", "disconnected"]),
|
|
65468
65750
|
online: external_exports.boolean(),
|
|
65469
65751
|
lastSeenAt: external_exports.iso.datetime().nullable(),
|
|
@@ -65505,7 +65787,7 @@ var agentSchemaDefinition = external_exports.object({
|
|
|
65505
65787
|
});
|
|
65506
65788
|
var agentSchema = agentSchemaDefinition;
|
|
65507
65789
|
var agentChannelSchemaDefinition = external_exports.object({
|
|
65508
|
-
id:
|
|
65790
|
+
id: idSchema16,
|
|
65509
65791
|
name: external_exports.string(),
|
|
65510
65792
|
kind: external_exports.enum(["public", "private", "dm", "group", "chat"])
|
|
65511
65793
|
});
|
|
@@ -65520,22 +65802,22 @@ var agentNameSchema = external_exports.string().trim().min(1).max(80);
|
|
|
65520
65802
|
var instructionsSchema = external_exports.string().max(2e4);
|
|
65521
65803
|
var linkedAvatarSchema = external_exports.string().trim().max(16);
|
|
65522
65804
|
var createAgentInputSchemaDefinition = external_exports.object({
|
|
65523
|
-
workspaceId:
|
|
65805
|
+
workspaceId: workspaceIdSchema12,
|
|
65524
65806
|
name: agentNameSchema,
|
|
65525
65807
|
avatar: agentAvatarInputSchema.default(""),
|
|
65526
65808
|
harness: hostedHarnessSchema,
|
|
65527
65809
|
modelLevel: agentModelLevelSchema.optional(),
|
|
65528
65810
|
kind: external_exports.enum(["personal", "team"]).default("personal"),
|
|
65529
65811
|
instructions: instructionsSchema.default(""),
|
|
65530
|
-
channelIds: external_exports.array(
|
|
65812
|
+
channelIds: external_exports.array(idSchema16).max(50).default([]),
|
|
65531
65813
|
/** A Claude Code or Codex agent drawing from this login pool; a team one needs a pool. */
|
|
65532
65814
|
/** The pool's id or name. */
|
|
65533
65815
|
loginPoolId: external_exports.string().min(1).max(200).optional()
|
|
65534
65816
|
});
|
|
65535
65817
|
var createAgentInputSchema = createAgentInputSchemaDefinition;
|
|
65536
65818
|
var updateAgentInputSchemaDefinition = external_exports.object({
|
|
65537
|
-
workspaceId:
|
|
65538
|
-
agentId:
|
|
65819
|
+
workspaceId: workspaceIdSchema12,
|
|
65820
|
+
agentId: idSchema16,
|
|
65539
65821
|
name: agentNameSchema.optional(),
|
|
65540
65822
|
avatar: agentAvatarInputSchema.optional(),
|
|
65541
65823
|
modelLevel: agentModelLevelSchema.optional(),
|
|
@@ -65547,7 +65829,7 @@ var updateAgentInputSchemaDefinition = external_exports.object({
|
|
|
65547
65829
|
effort: runEffortInputSchema.optional(),
|
|
65548
65830
|
instructions: instructionsSchema.optional(),
|
|
65549
65831
|
/** The whole set: channels left out are left. */
|
|
65550
|
-
channelIds: external_exports.array(
|
|
65832
|
+
channelIds: external_exports.array(idSchema16).max(50).optional(),
|
|
65551
65833
|
/** Agents Laze runs only: paused, it does not wake until resumed and its messages wait. */
|
|
65552
65834
|
paused: external_exports.boolean().optional(),
|
|
65553
65835
|
/** Why it is paused, shown on the agents page and in the notice under held messages. */
|
|
@@ -65555,14 +65837,14 @@ var updateAgentInputSchemaDefinition = external_exports.object({
|
|
|
65555
65837
|
});
|
|
65556
65838
|
var updateAgentInputSchema = updateAgentInputSchemaDefinition;
|
|
65557
65839
|
var saveHarnessLoginInputSchemaDefinition = external_exports.object({
|
|
65558
|
-
workspaceId:
|
|
65840
|
+
workspaceId: workspaceIdSchema12,
|
|
65559
65841
|
harness: harnessLoginSchema,
|
|
65560
65842
|
secret: external_exports.string().trim().min(10).max(2e4).optional(),
|
|
65561
65843
|
signIn: harnessSignInValueSchema.optional()
|
|
65562
65844
|
});
|
|
65563
65845
|
var saveHarnessLoginInputSchema = saveHarnessLoginInputSchemaDefinition;
|
|
65564
65846
|
var removeHarnessLoginInputSchemaDefinition = external_exports.object({
|
|
65565
|
-
workspaceId:
|
|
65847
|
+
workspaceId: workspaceIdSchema12,
|
|
65566
65848
|
harness: harnessLoginSchema
|
|
65567
65849
|
});
|
|
65568
65850
|
var removeHarnessLoginInputSchema = removeHarnessLoginInputSchemaDefinition;
|
|
@@ -65574,13 +65856,13 @@ var harnessLoginsSchema = harnessLoginsSchemaDefinition;
|
|
|
65574
65856
|
var lastRuntimeSchemaDefinition = external_exports.object({ harness: hostedHarnessSchema.nullable() });
|
|
65575
65857
|
var lastRuntimeSchema = lastRuntimeSchemaDefinition;
|
|
65576
65858
|
var mintLinkInputSchemaDefinition = external_exports.object({
|
|
65577
|
-
workspaceId:
|
|
65859
|
+
workspaceId: workspaceIdSchema12,
|
|
65578
65860
|
/** Left out, the agent names itself when it joins, else it takes its harness's name. */
|
|
65579
65861
|
name: external_exports.string().trim().max(80).optional(),
|
|
65580
65862
|
/** The channel the agent joins once linked. */
|
|
65581
|
-
channelId:
|
|
65863
|
+
channelId: idSchema16.optional(),
|
|
65582
65864
|
/** One of the minting person's connected agents: redeeming gives it a new key instead. */
|
|
65583
|
-
reconnectAgentId:
|
|
65865
|
+
reconnectAgentId: idSchema16.optional()
|
|
65584
65866
|
});
|
|
65585
65867
|
var mintLinkInputSchema = mintLinkInputSchemaDefinition;
|
|
65586
65868
|
var mintedLinkSchemaDefinition = external_exports.object({
|
|
@@ -65612,7 +65894,7 @@ var redeemedLinkSchemaDefinition = external_exports.object({
|
|
|
65612
65894
|
agent: agentSchemaDefinition,
|
|
65613
65895
|
/** The agent's own `lz_` key, shown once. */
|
|
65614
65896
|
apiKey: external_exports.string(),
|
|
65615
|
-
channelId:
|
|
65897
|
+
channelId: idSchema16.nullable(),
|
|
65616
65898
|
/** The owner's key that may only ask for a new agent (`laze agent request`), shown once. */
|
|
65617
65899
|
requestKey: external_exports.string().nullable().optional()
|
|
65618
65900
|
});
|
|
@@ -65651,12 +65933,12 @@ var joinRequestAnswerSchemaDefinition = external_exports.discriminatedUnion("sta
|
|
|
65651
65933
|
})
|
|
65652
65934
|
]);
|
|
65653
65935
|
var joinRequestInputSchemaDefinition = external_exports.object({
|
|
65654
|
-
workspaceId:
|
|
65936
|
+
workspaceId: workspaceIdSchema12,
|
|
65655
65937
|
code: external_exports.string().trim().min(1).max(20)
|
|
65656
65938
|
});
|
|
65657
65939
|
var joinRequestInputSchema = joinRequestInputSchemaDefinition;
|
|
65658
65940
|
var approveJoinRequestInputSchemaDefinition = external_exports.object({
|
|
65659
|
-
workspaceId:
|
|
65941
|
+
workspaceId: workspaceIdSchema12,
|
|
65660
65942
|
code: external_exports.string().trim().min(1).max(20),
|
|
65661
65943
|
/** The person may rename the agent as they approve it. */
|
|
65662
65944
|
name: external_exports.string().trim().max(80).optional()
|
|
@@ -65677,12 +65959,12 @@ var inboxCatchUpSchemaDefinition = external_exports.object({
|
|
|
65677
65959
|
});
|
|
65678
65960
|
var inboxCatchUpSchema = inboxCatchUpSchemaDefinition;
|
|
65679
65961
|
var inboxMessageSchemaDefinition = external_exports.object({
|
|
65680
|
-
messageId:
|
|
65681
|
-
channelId:
|
|
65962
|
+
messageId: idSchema16,
|
|
65963
|
+
channelId: idSchema16,
|
|
65682
65964
|
channelName: external_exports.string(),
|
|
65683
65965
|
channelKind: external_exports.enum(["public", "private", "dm", "group", "chat"]),
|
|
65684
|
-
threadRootId:
|
|
65685
|
-
author: external_exports.object({ kind: external_exports.enum(["person", "agent"]), id:
|
|
65966
|
+
threadRootId: idSchema16.nullable(),
|
|
65967
|
+
author: external_exports.object({ kind: external_exports.enum(["person", "agent"]), id: idSchema16, name: external_exports.string() }),
|
|
65686
65968
|
body: external_exports.string(),
|
|
65687
65969
|
postedAt: external_exports.iso.datetime(),
|
|
65688
65970
|
/** On the first message of each conversation in a catch up (agent-catch-up.feature). */
|
|
@@ -65702,9 +65984,9 @@ var inboxWaitingSchemaDefinition = external_exports.object({
|
|
|
65702
65984
|
});
|
|
65703
65985
|
var callerSchemaDefinition = external_exports.object({
|
|
65704
65986
|
kind: external_exports.enum(["person", "agent"]),
|
|
65705
|
-
id:
|
|
65987
|
+
id: idSchema16,
|
|
65706
65988
|
name: external_exports.string(),
|
|
65707
|
-
workspaceId:
|
|
65989
|
+
workspaceId: workspaceIdSchema12,
|
|
65708
65990
|
agent: agentSchemaDefinition.nullable(),
|
|
65709
65991
|
/** Messages waiting in the agent's inbox, not taken yet; 0 for a person. */
|
|
65710
65992
|
pendingCount: external_exports.number().int().min(0).optional(),
|
|
@@ -65720,7 +66002,7 @@ var agentGuideFilesSchemaDefinition = external_exports.object({
|
|
|
65720
66002
|
});
|
|
65721
66003
|
var agentChannelLevelSchema = external_exports.enum(["everything", "mentions"]);
|
|
65722
66004
|
var callerChannelSchemaDefinition = external_exports.object({
|
|
65723
|
-
id:
|
|
66005
|
+
id: idSchema16,
|
|
65724
66006
|
name: external_exports.string(),
|
|
65725
66007
|
kind: external_exports.enum(["public", "private", "dm", "group", "chat"]),
|
|
65726
66008
|
unread: external_exports.number().int().nonnegative(),
|
|
@@ -65734,9 +66016,9 @@ var callerChannelSchemaDefinition = external_exports.object({
|
|
|
65734
66016
|
isDefault: external_exports.boolean().default(false)
|
|
65735
66017
|
});
|
|
65736
66018
|
var setChannelLevelInputSchemaDefinition = external_exports.object({
|
|
65737
|
-
workspaceId:
|
|
65738
|
-
agentId:
|
|
65739
|
-
channelId:
|
|
66019
|
+
workspaceId: workspaceIdSchema12,
|
|
66020
|
+
agentId: idSchema16,
|
|
66021
|
+
channelId: idSchema16,
|
|
65740
66022
|
level: agentChannelLevelSchema
|
|
65741
66023
|
});
|
|
65742
66024
|
var setChannelLevelInputSchema = setChannelLevelInputSchemaDefinition;
|
|
@@ -65759,12 +66041,12 @@ var postAsCallerInputSchemaDefinition = external_exports.object({
|
|
|
65759
66041
|
/** A channel's name (with or without `#`) or id. */
|
|
65760
66042
|
channel: external_exports.string().trim().min(1).max(81),
|
|
65761
66043
|
body: external_exports.string().trim().min(1).max(4e4),
|
|
65762
|
-
threadRootId:
|
|
66044
|
+
threadRootId: idSchema16.optional(),
|
|
65763
66045
|
/** The messages of the agent's turn this post answers. */
|
|
65764
|
-
answers: external_exports.array(
|
|
66046
|
+
answers: external_exports.array(idSchema16).max(200).optional()
|
|
65765
66047
|
});
|
|
65766
66048
|
var replyAsCallerInputSchemaDefinition = external_exports.object({
|
|
65767
|
-
messageId:
|
|
66049
|
+
messageId: idSchema16,
|
|
65768
66050
|
body: external_exports.string().trim().min(1).max(4e4),
|
|
65769
66051
|
/** Needed for a message that is not in the caller's inbox. */
|
|
65770
66052
|
channel: external_exports.string().trim().min(1).max(81).optional(),
|
|
@@ -65773,18 +66055,18 @@ var replyAsCallerInputSchemaDefinition = external_exports.object({
|
|
|
65773
66055
|
/** A thread reply also shows in the channel, as "Also send to #channel" does. */
|
|
65774
66056
|
alsoInChannel: external_exports.boolean().optional(),
|
|
65775
66057
|
/** The other messages of the agent's turn this reply answers. */
|
|
65776
|
-
answers: external_exports.array(
|
|
66058
|
+
answers: external_exports.array(idSchema16).max(200).optional()
|
|
65777
66059
|
});
|
|
65778
66060
|
var postedMessageSchemaDefinition = external_exports.object({
|
|
65779
|
-
messageId:
|
|
65780
|
-
channelId:
|
|
65781
|
-
threadRootId:
|
|
66061
|
+
messageId: idSchema16,
|
|
66062
|
+
channelId: idSchema16,
|
|
66063
|
+
threadRootId: idSchema16.nullable(),
|
|
65782
66064
|
/** Workspace members the message mentioned who are not in the channel: it did not reach them. */
|
|
65783
66065
|
notInChannel: external_exports.array(external_exports.object({ ...notInChannelSchema.shape, name: external_exports.string() })).default([]),
|
|
65784
66066
|
/** Mentioned agents that are paused or out of usage: the message waits for each of them. */
|
|
65785
66067
|
waitsFor: external_exports.array(
|
|
65786
66068
|
external_exports.object({
|
|
65787
|
-
agentId:
|
|
66069
|
+
agentId: idSchema16,
|
|
65788
66070
|
name: external_exports.string(),
|
|
65789
66071
|
cause: external_exports.enum(["paused", "out_of_usage"]),
|
|
65790
66072
|
/** When an agent out of usage gets its usage back; null while paused. */
|
|
@@ -65801,15 +66083,15 @@ var searchAsCallerInputSchemaDefinition = external_exports.object({
|
|
|
65801
66083
|
});
|
|
65802
66084
|
var callerActorNameSchema = external_exports.object({
|
|
65803
66085
|
kind: external_exports.enum(["person", "agent"]),
|
|
65804
|
-
id:
|
|
66086
|
+
id: idSchema16,
|
|
65805
66087
|
name: external_exports.string()
|
|
65806
66088
|
});
|
|
65807
66089
|
var callerSearchHitSchemaDefinition = external_exports.object({
|
|
65808
|
-
messageId:
|
|
65809
|
-
channelId:
|
|
66090
|
+
messageId: idSchema16,
|
|
66091
|
+
channelId: idSchema16,
|
|
65810
66092
|
channelName: external_exports.string(),
|
|
65811
66093
|
channelKind: external_exports.enum(["public", "private", "dm", "group", "chat"]),
|
|
65812
|
-
threadRootId:
|
|
66094
|
+
threadRootId: idSchema16.nullable(),
|
|
65813
66095
|
seq: external_exports.number().int().positive(),
|
|
65814
66096
|
/** `external` for a mirrored message from someone outside Laze. */
|
|
65815
66097
|
author: external_exports.object({
|
|
@@ -65831,7 +66113,7 @@ var callerSearchResultSchemaDefinition = external_exports.object({
|
|
|
65831
66113
|
/** Names for the mention tokens in the bodies. */
|
|
65832
66114
|
mentions: external_exports.object({
|
|
65833
66115
|
actors: external_exports.array(callerActorNameSchema),
|
|
65834
|
-
channels: external_exports.array(external_exports.object({ id:
|
|
66116
|
+
channels: external_exports.array(external_exports.object({ id: idSchema16, name: external_exports.string() }))
|
|
65835
66117
|
})
|
|
65836
66118
|
});
|
|
65837
66119
|
var agentActivityInputSchemaDefinition = external_exports.object({
|
|
@@ -65903,14 +66185,14 @@ var codexLoginRefreshInputSchemaDefinition = external_exports.object({
|
|
|
65903
66185
|
authJson: external_exports.string().min(2).max(CODEX_LOGIN_MAX_LENGTH)
|
|
65904
66186
|
});
|
|
65905
66187
|
var AgentApi = moduleApi()("agent");
|
|
65906
|
-
var agentCoreTrpc = defineTrpcContract("agents").query("list").withInput(external_exports.object({ workspaceId:
|
|
66188
|
+
var agentCoreTrpc = defineTrpcContract("agents").query("list").withInput(external_exports.object({ workspaceId: workspaceIdSchema12 })).withOutput(external_exports.array(agentListEntrySchema)).mutation("create").withInput(createAgentInputSchema).withOutput(agentSchema).mutation("update").withInput(updateAgentInputSchema).withOutput(agentSchema).mutation("remove").withInput(external_exports.object({ workspaceId: workspaceIdSchema12, agentId: idSchema16 })).withOutput(external_exports.object({ removed: external_exports.literal(true) })).mutation("transfer").withInput(transferAgentInputSchema).withOutput(agentSchema).mutation("resetSession").withInput(resetAgentSessionInputSchema).withOutput(agentSchema).query("faces").withInput(external_exports.object({ workspaceId: workspaceIdSchema12 })).withOutput(external_exports.array(agentFaceSchema)).query("presence").withInput(external_exports.object({ workspaceId: workspaceIdSchema12 })).withOutput(external_exports.array(agentPresenceSchema)).mutation("uploadAvatar").withInput(uploadAgentAvatarInputSchema).withOutput(uploadedAgentAvatarSchema).query("access").withInput(external_exports.object({ workspaceId: workspaceIdSchema12, agentId: idSchema16 })).withOutput(agentAccessSchema).query("loginActivity").withInput(external_exports.object({ workspaceId: workspaceIdSchema12, agentId: idSchema16 })).withOutput(loginActivitySchema).mutation("raiseBudget").withInput(raiseBudgetInputSchema).withOutput(external_exports.object({ limitUsd: external_exports.number() })).query("permissionPrompts").withInput(external_exports.object({ workspaceId: workspaceIdSchema12, agentId: idSchema16 })).withOutput(external_exports.array(agentPermissionPromptSchema)).mutation("share").withInput(shareAgentInputSchema).withOutput(agentAccessSchema).mutation("unshare").withInput(shareAgentInputSchema).withOutput(agentAccessSchema).query("harnessLogins").withInput(external_exports.object({ workspaceId: workspaceIdSchema12 })).withOutput(harnessLoginsSchema).mutation("saveHarnessLogin").withInput(saveHarnessLoginInputSchema).withOutput(harnessLoginsSchema).mutation("removeHarnessLogin").withInput(removeHarnessLoginInputSchema).withOutput(harnessLoginsSchema).query("listHarnessLogins").withInput(external_exports.object({ workspaceId: workspaceIdSchema12 })).withOutput(harnessLoginListSchema).mutation("addHarnessLogin").withInput(addHarnessLoginInputSchema).withOutput(harnessLoginListSchema).mutation("renameHarnessLogin").withInput(renameHarnessLoginInputSchema).withOutput(harnessLoginListSchema).mutation("deleteHarnessLogin").withInput(deleteHarnessLoginInputSchema).withOutput(harnessLoginListSchema).mutation("checkLoginUsage").withInput(checkLoginUsageInputSchema).withOutput(loginUsageCheckSchema).query("loginPools").withInput(external_exports.object({ workspaceId: workspaceIdSchema12 })).withOutput(loginPoolsSchema).mutation("createLoginPool").withInput(createLoginPoolInputSchema).withOutput(loginPoolsSchema).mutation("renameLoginPool").withInput(renameLoginPoolInputSchema).withOutput(loginPoolsSchema).mutation("deleteLoginPool").withInput(loginPoolRefInputSchema).withOutput(loginPoolsSchema).mutation("addPoolLogin").withInput(addPoolLoginInputSchema).withOutput(loginPoolsSchema).mutation("removePoolLogin").withInput(removePoolLoginInputSchema).withOutput(loginPoolsSchema).mutation("setPoolMember").withInput(setPoolMemberInputSchema).withOutput(loginPoolsSchema).mutation("removePoolMember").withInput(removePoolMemberInputSchema).withOutput(loginPoolsSchema).mutation("setAgentPool").withInput(setAgentPoolInputSchema).withOutput(agentSchema).mutation("openDirect").withInput(external_exports.object({ workspaceId: workspaceIdSchema12, agentId: idSchema16 })).withOutput(external_exports.object({ channelId: idSchema16 })).mutation("startConversation").withInput(startConversationInputSchema).withOutput(startedConversationSchema).query("conversations").withInput(listConversationsInputSchema).withOutput(external_exports.array(conversationSummarySchema2)).mutation("joinConversation").withInput(conversationInputSchema).withOutput(conversationSummarySchema2).mutation("renameConversation").withInput(renameConversationInputSchema).withOutput(conversationSummarySchema2).mutation("leaveConversation").withInput(conversationInputSchema).withOutput(external_exports.object({ left: external_exports.literal(true) })).mutation("deleteConversation").withInput(conversationInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).mutation("mintLink").withInput(mintLinkInputSchema).withOutput(mintedLinkSchema).query("linkRedemption").withInput(linkRedemptionInputSchema).withOutput(linkRedemptionSchema).query("oauthRequest").withInput(oauthRequestInputSchema).withOutput(oauthRequestViewSchema).mutation("oauthApprove").withInput(approveOAuthInputSchema).withOutput(oauthRedirectSchema).mutation("oauthDeny").withInput(oauthRequestInputSchema).withOutput(oauthRedirectSchema).mutation("disconnect").withInput(external_exports.object({ workspaceId: workspaceIdSchema12, agentId: idSchema16 })).withOutput(external_exports.object({ disconnected: external_exports.literal(true) })).mutation("setGithub").withInput(setAgentGithubInputSchema).withOutput(agentSchema).query("githubWatches").withInput(external_exports.object({ workspaceId: workspaceIdSchema12, agentId: idSchema16 })).withOutput(external_exports.array(agentGithubWatchSchema)).mutation("watchGithub").withInput(watchGithubInputSchema).withOutput(agentGithubWatchSchema).mutation("unwatchGithub").withInput(unwatchGithubInputSchema).withOutput(external_exports.object({ removed: external_exports.literal(true) })).build();
|
|
65907
66189
|
var agentTurnTrpc = defineTrpcContract("agents").mutation("answerAttention").withInput(answerAttentionInputSchema).withOutput(external_exports.object({ answered: external_exports.literal(true) })).mutation("stopTurn").withInput(stopAgentTurnInputSchema).withOutput(external_exports.object({ stopped: external_exports.literal(true) })).query("mayStopTurn").withInput(stopAgentTurnInputSchema).withOutput(external_exports.object({ allowed: external_exports.boolean() })).mutation("retryTurn").withInput(retryAgentTurnInputSchema).withOutput(external_exports.object({ retried: external_exports.literal(true) })).query("retryState").withInput(retryAgentTurnInputSchema).withOutput(agentRetryStateSchema).query("liveSteps").withInput(liveStepsInputSchema).withOutput(liveStepsSchema).query("workingNow").withInput(agentWorkingInputSchema).withOutput(agentWorkingSchema).mutation("compactSession").withInput(compactAgentSessionInputSchema).withOutput(external_exports.object({ requested: external_exports.literal(true) })).mutation("catchUp").withInput(startCatchUpInputSchema).withOutput(catchUpRunSchema).mutation("catchUpAsk").withInput(askCatchUpInputSchema).withOutput(catchUpRunSchema).query("catchUpRun").withInput(catchUpRunInputSchema).withOutput(catchUpRunSchema).mutation("catchUpStop").withInput(catchUpRunInputSchema).withOutput(catchUpRunSchema).mutation("restartComputer").withInput(restartAgentComputerInputSchema).withOutput(external_exports.object({ restarted: external_exports.boolean() })).build();
|
|
65908
|
-
var agentChannelSettingsTrpc = defineTrpcContract("agents").query("monitors").withInput(external_exports.object({ workspaceId:
|
|
66190
|
+
var agentChannelSettingsTrpc = defineTrpcContract("agents").query("monitors").withInput(external_exports.object({ workspaceId: workspaceIdSchema12, agentId: idSchema16 })).withOutput(external_exports.array(agentMonitorSchema)).query("channelLevel").withInput(external_exports.object({ workspaceId: workspaceIdSchema12, agentId: idSchema16, channelId: idSchema16 })).withOutput(channelLevelSchema).mutation("setChannelLevel").withInput(setChannelLevelInputSchema).withOutput(channelLevelSchema).mutation("unmuteChannel").withInput(unmuteAgentChannelInputSchema).withOutput(channelLevelSchema).mutation("cancelHeld").withInput(cancelHeldInputSchema).withOutput(cancelHeldResultSchema).build();
|
|
65909
66191
|
var agentJoinTrpc = defineTrpcContract("agents").query("joinRequest").withInput(joinRequestInputSchema).withOutput(joinRequestViewSchema).mutation("approveJoinRequest").withInput(approveJoinRequestInputSchema).withOutput(joinRequestViewSchema).mutation("denyJoinRequest").withInput(joinRequestInputSchema).withOutput(joinRequestViewSchema).build();
|
|
65910
66192
|
var agentLoginTroubleTrpc = defineTrpcContract("agents").mutation("replaceHarnessLogin").withInput(replaceHarnessLoginInputSchema).withOutput(harnessLoginListSchema).mutation("startHarnessSignIn").withInput(startHarnessSignInInputSchema).withOutput(harnessSignInSchema).mutation("pollHarnessSignIn").withInput(pollHarnessSignInInputSchema).withOutput(harnessSignInPollSchema).mutation("waitForLogins").withInput(loginCardActionInputSchema).withOutput(external_exports.object({ waiting: external_exports.boolean() })).mutation("useAnotherLogin").withInput(loginCardActionInputSchema).withOutput(external_exports.object({ loginName: external_exports.string() })).build();
|
|
65911
|
-
var agentWorkspaceDefaultTrpc = defineTrpcContract("agents").query("workspaceDefault").withInput(external_exports.object({ workspaceId:
|
|
65912
|
-
var agentRuntimeChoiceTrpc = defineTrpcContract("agents").query("lastRuntime").withInput(external_exports.object({ workspaceId:
|
|
65913
|
-
var agentArchiveTrpc = defineTrpcContract("agents").query("archived").withInput(external_exports.object({ workspaceId:
|
|
66193
|
+
var agentWorkspaceDefaultTrpc = defineTrpcContract("agents").query("workspaceDefault").withInput(external_exports.object({ workspaceId: workspaceIdSchema12 })).withOutput(workspaceDefaultAgentSchema).mutation("setWorkspaceDefault").withInput(setWorkspaceDefaultAgentInputSchema).withOutput(workspaceDefaultAgentSchema).build();
|
|
66194
|
+
var agentRuntimeChoiceTrpc = defineTrpcContract("agents").query("lastRuntime").withInput(external_exports.object({ workspaceId: workspaceIdSchema12 })).withOutput(lastRuntimeSchema).build();
|
|
66195
|
+
var agentArchiveTrpc = defineTrpcContract("agents").query("archived").withInput(external_exports.object({ workspaceId: workspaceIdSchema12 })).withOutput(external_exports.array(archivedAgentSchema)).mutation("restore").withInput(restoreAgentInputSchema).withOutput(agentSchema).mutation("copy").withInput(copyAgentInputSchema).withOutput(agentSchema).mutation("deleteArchived").withInput(restoreAgentInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).query("transferOffers").withInput(external_exports.object({ workspaceId: workspaceIdSchema12 })).withOutput(external_exports.array(agentTransferOfferSchema)).mutation("acceptTransfer").withInput(agentTransferInputSchema).withOutput(agentSchema).mutation("declineTransfer").withInput(agentTransferInputSchema).withOutput(external_exports.object({ declined: external_exports.literal(true) })).mutation("cancelTransfer").withInput(agentTransferInputSchema).withOutput(external_exports.object({ cancelled: external_exports.literal(true) })).build();
|
|
65914
66196
|
var agentTrpc = joinTrpcContracts(
|
|
65915
66197
|
"agents",
|
|
65916
66198
|
agentCoreTrpc,
|
|
@@ -65920,7 +66202,8 @@ var agentTrpc = joinTrpcContracts(
|
|
|
65920
66202
|
agentLoginTroubleTrpc,
|
|
65921
66203
|
agentWorkspaceDefaultTrpc,
|
|
65922
66204
|
agentRuntimeChoiceTrpc,
|
|
65923
|
-
agentArchiveTrpc
|
|
66205
|
+
agentArchiveTrpc,
|
|
66206
|
+
agentMigrationTrpc
|
|
65924
66207
|
);
|
|
65925
66208
|
var agentUi = uiTokens("agent");
|
|
65926
66209
|
var AgentNavSlot = agentUi.component("nav");
|
|
@@ -65938,6 +66221,7 @@ var AgentEditDialogSlot = agentUi.component("editDialog");
|
|
|
65938
66221
|
var AgentFaceSlot = agentUi.component("face");
|
|
65939
66222
|
var AgentAccessSlot = agentUi.component("access");
|
|
65940
66223
|
var AgentConnectDialogSlot = agentUi.component("connectDialog");
|
|
66224
|
+
var AgentMigrateDialogSlot = agentUi.component("migrateDialog");
|
|
65941
66225
|
var AgentChannelLevelSlot = agentUi.component("channelLevel");
|
|
65942
66226
|
var AgentMuteNoticeSlot = agentUi.component("muteNotice");
|
|
65943
66227
|
var AgentHopLimitNoticeSlot = agentUi.component("hopLimitNotice");
|
|
@@ -66049,27 +66333,27 @@ var agentKeepsFailingPayloadSchemaDefinition = external_exports.object({
|
|
|
66049
66333
|
});
|
|
66050
66334
|
|
|
66051
66335
|
// ../../modules/agent/contract/src/agent-caller-access.ts
|
|
66052
|
-
var
|
|
66053
|
-
var
|
|
66054
|
-
var agentAsCallerInputSchemaDefinition = external_exports.object({ agent:
|
|
66336
|
+
var agentRefSchema8 = external_exports.string().trim().min(1).max(80);
|
|
66337
|
+
var idSchema17 = external_exports.string().min(1).max(64);
|
|
66338
|
+
var agentAsCallerInputSchemaDefinition = external_exports.object({ agent: agentRefSchema8 });
|
|
66055
66339
|
var shareAgentAsCallerInputSchemaDefinition = external_exports.object({
|
|
66056
|
-
agent:
|
|
66340
|
+
agent: agentRefSchema8,
|
|
66057
66341
|
grantee: agentGranteeSchema
|
|
66058
66342
|
});
|
|
66059
66343
|
var stopTurnAsCallerInputSchemaDefinition = external_exports.object({
|
|
66060
|
-
agent:
|
|
66061
|
-
channelId:
|
|
66344
|
+
agent: agentRefSchema8,
|
|
66345
|
+
channelId: idSchema17
|
|
66062
66346
|
});
|
|
66063
66347
|
var retryTurnAsCallerInputSchemaDefinition = external_exports.object({
|
|
66064
|
-
agent:
|
|
66065
|
-
channelId:
|
|
66066
|
-
messageId:
|
|
66348
|
+
agent: agentRefSchema8,
|
|
66349
|
+
channelId: idSchema17,
|
|
66350
|
+
messageId: idSchema17
|
|
66067
66351
|
});
|
|
66068
66352
|
var postTurnFailureAsCallerInputSchemaDefinition = external_exports.object({
|
|
66069
|
-
channelId:
|
|
66070
|
-
threadRootId:
|
|
66353
|
+
channelId: idSchema17,
|
|
66354
|
+
threadRootId: idSchema17.optional(),
|
|
66071
66355
|
/** The person's message the turn was on, which Try again sends to the agent again. */
|
|
66072
|
-
messageId:
|
|
66356
|
+
messageId: idSchema17,
|
|
66073
66357
|
/** The attempt that failed, so Try again knows once a later one is stored. */
|
|
66074
66358
|
attempt: external_exports.number().int().min(1).optional(),
|
|
66075
66359
|
line: external_exports.string().trim().min(1).max(1e3),
|
|
@@ -66078,7 +66362,9 @@ var postTurnFailureAsCallerInputSchemaDefinition = external_exports.object({
|
|
|
66078
66362
|
var mintLinkAsCallerInputSchemaDefinition = external_exports.object({
|
|
66079
66363
|
/** Left out, the agent that joins with the link names itself. */
|
|
66080
66364
|
name: external_exports.string().trim().max(80).optional(),
|
|
66081
|
-
channelId:
|
|
66365
|
+
channelId: idSchema17.optional(),
|
|
66366
|
+
/** One of the key's person's agents by id or name: redeeming gives it a new key instead. */
|
|
66367
|
+
reconnect: external_exports.string().trim().min(1).max(80).optional()
|
|
66082
66368
|
});
|
|
66083
66369
|
|
|
66084
66370
|
// ../../modules/agent/contract/src/agent-secret-sweep.ts
|
|
@@ -66188,25 +66474,25 @@ var agentScheduledRunMissedPayloadSchemaDefinition = external_exports.object({
|
|
|
66188
66474
|
});
|
|
66189
66475
|
|
|
66190
66476
|
// ../../modules/agent/contract/src/agent-history.ts
|
|
66191
|
-
var
|
|
66477
|
+
var idSchema18 = external_exports.string().min(1).max(80);
|
|
66192
66478
|
var CALLER_HISTORY_LIMIT_MAX = 100;
|
|
66193
66479
|
var historyAsCallerInputSchemaDefinition = external_exports.object({
|
|
66194
66480
|
/** A channel the key's speaker is in, by id or name. */
|
|
66195
66481
|
channel: external_exports.string().trim().min(1).max(200),
|
|
66196
66482
|
/** Messages before this Laze message; none reads the newest page. */
|
|
66197
|
-
before:
|
|
66483
|
+
before: idSchema18.optional(),
|
|
66198
66484
|
/** Already past the cache: no cached messages, only where the live read goes on. */
|
|
66199
66485
|
olderThan: external_exports.iso.datetime().optional(),
|
|
66200
66486
|
limit: external_exports.number().int().min(1).max(CALLER_HISTORY_LIMIT_MAX).default(50)
|
|
66201
66487
|
});
|
|
66202
66488
|
var callerHistoryMessageSchemaDefinition = external_exports.object({
|
|
66203
|
-
messageId:
|
|
66204
|
-
threadRootId:
|
|
66489
|
+
messageId: idSchema18,
|
|
66490
|
+
threadRootId: idSchema18.nullable(),
|
|
66205
66491
|
seq: external_exports.number().int().positive(),
|
|
66206
66492
|
/** `external` for a mirrored message from someone outside Laze. */
|
|
66207
66493
|
author: external_exports.object({
|
|
66208
66494
|
kind: external_exports.enum(["person", "agent", "external"]),
|
|
66209
|
-
id:
|
|
66495
|
+
id: idSchema18,
|
|
66210
66496
|
name: external_exports.string()
|
|
66211
66497
|
}),
|
|
66212
66498
|
body: external_exports.string(),
|
|
@@ -66216,7 +66502,7 @@ var callerHistoryMessageSchemaDefinition = external_exports.object({
|
|
|
66216
66502
|
originKey: external_exports.string().nullable()
|
|
66217
66503
|
});
|
|
66218
66504
|
var callerHistorySchemaDefinition = external_exports.object({
|
|
66219
|
-
channelId:
|
|
66505
|
+
channelId: idSchema18,
|
|
66220
66506
|
channelName: external_exports.string(),
|
|
66221
66507
|
channelKind: external_exports.enum(["public", "private", "dm", "group", "chat"]),
|
|
66222
66508
|
/** The outside workspace a mirrored conversation shows, such as "Slack ACME HQ". */
|
|
@@ -66230,12 +66516,12 @@ var callerHistorySchemaDefinition = external_exports.object({
|
|
|
66230
66516
|
});
|
|
66231
66517
|
|
|
66232
66518
|
// ../../modules/agent/contract/src/agent-channel-admin.ts
|
|
66233
|
-
var
|
|
66519
|
+
var idSchema19 = external_exports.string().min(1).max(80);
|
|
66234
66520
|
var channelRefSchema = external_exports.string().trim().min(1).max(200);
|
|
66235
66521
|
var channelAsCallerInputSchemaDefinition = external_exports.object({ channel: channelRefSchema });
|
|
66236
66522
|
var callerChannelMemberSchemaDefinition = external_exports.object({
|
|
66237
66523
|
kind: external_exports.enum(["person", "agent"]),
|
|
66238
|
-
id:
|
|
66524
|
+
id: idSchema19,
|
|
66239
66525
|
name: external_exports.string(),
|
|
66240
66526
|
role: external_exports.enum(["admin", "member"]),
|
|
66241
66527
|
/** Active, away or unknown for a person the speaker may see; absent for agents. */
|
|
@@ -66245,7 +66531,7 @@ var callerChannelMemberSchemaDefinition = external_exports.object({
|
|
|
66245
66531
|
doNotDisturb: doNotDisturbSchema.nullable().optional()
|
|
66246
66532
|
});
|
|
66247
66533
|
var callerChannelDetailSchemaDefinition = external_exports.object({
|
|
66248
|
-
id:
|
|
66534
|
+
id: idSchema19,
|
|
66249
66535
|
name: external_exports.string(),
|
|
66250
66536
|
kind: external_exports.enum(["public", "private", "dm", "group", "chat"]),
|
|
66251
66537
|
topic: external_exports.string(),
|
|
@@ -66276,17 +66562,17 @@ var activityAsCallerInputSchemaDefinition = external_exports.object({
|
|
|
66276
66562
|
limit: external_exports.number().int().min(1).max(100).default(50)
|
|
66277
66563
|
});
|
|
66278
66564
|
var callerActivityItemSchemaDefinition = external_exports.object({
|
|
66279
|
-
id:
|
|
66565
|
+
id: idSchema19,
|
|
66280
66566
|
kind: external_exports.enum(["mention", "thread_reply", "keyword", "reaction"]),
|
|
66281
|
-
channelId:
|
|
66567
|
+
channelId: idSchema19,
|
|
66282
66568
|
channelName: external_exports.string(),
|
|
66283
66569
|
channelKind: external_exports.enum(["public", "private", "dm", "group", "chat"]),
|
|
66284
|
-
messageId:
|
|
66285
|
-
threadRootId:
|
|
66570
|
+
messageId: idSchema19,
|
|
66571
|
+
threadRootId: idSchema19.nullable(),
|
|
66286
66572
|
/** `external` is someone outside Laze whose message a mirror brought in, named at the source. */
|
|
66287
66573
|
actor: external_exports.object({
|
|
66288
66574
|
kind: external_exports.enum(["person", "agent", "external"]),
|
|
66289
|
-
id:
|
|
66575
|
+
id: idSchema19,
|
|
66290
66576
|
name: external_exports.string()
|
|
66291
66577
|
}),
|
|
66292
66578
|
emoji: external_exports.string().nullable(),
|
|
@@ -66303,12 +66589,12 @@ var setStatusAsCallerInputSchemaDefinition = setStatusInputSchema.omit({ workspa
|
|
|
66303
66589
|
var setAwayAsCallerInputSchemaDefinition = external_exports.object({ away: external_exports.boolean() });
|
|
66304
66590
|
|
|
66305
66591
|
// ../../modules/agent/contract/src/agent-scheduled.ts
|
|
66306
|
-
var
|
|
66592
|
+
var idSchema20 = external_exports.string().min(1).max(80);
|
|
66307
66593
|
var channelRefSchema2 = external_exports.string().trim().min(1).max(200);
|
|
66308
66594
|
var scheduleAsCallerInputSchemaDefinition = external_exports.object({
|
|
66309
66595
|
channel: channelRefSchema2.optional(),
|
|
66310
|
-
threadRootId:
|
|
66311
|
-
replyTo:
|
|
66596
|
+
threadRootId: idSchema20.optional(),
|
|
66597
|
+
replyTo: idSchema20.optional(),
|
|
66312
66598
|
body: external_exports.string().trim().min(1).max(4e4),
|
|
66313
66599
|
sendAt: external_exports.iso.datetime({ offset: true }),
|
|
66314
66600
|
/** A reply that also goes to the channel at its time (`--also-channel`). */
|
|
@@ -66319,9 +66605,9 @@ var scheduleAsCallerInputSchemaDefinition = external_exports.object({
|
|
|
66319
66605
|
var listScheduledAsCallerInputSchemaDefinition = external_exports.object({
|
|
66320
66606
|
channel: channelRefSchema2.optional()
|
|
66321
66607
|
});
|
|
66322
|
-
var scheduledAsCallerInputSchemaDefinition = external_exports.object({ scheduledId:
|
|
66608
|
+
var scheduledAsCallerInputSchemaDefinition = external_exports.object({ scheduledId: idSchema20 });
|
|
66323
66609
|
var editScheduledAsCallerInputSchemaDefinition = external_exports.object({
|
|
66324
|
-
scheduledId:
|
|
66610
|
+
scheduledId: idSchema20,
|
|
66325
66611
|
body: external_exports.string().trim().min(1).max(4e4).optional(),
|
|
66326
66612
|
sendAt: external_exports.iso.datetime({ offset: true }).optional()
|
|
66327
66613
|
}).refine((input2) => input2.body !== void 0 || input2.sendAt !== void 0, {
|
|
@@ -66434,6 +66720,32 @@ var inviteAsCallerInputSchemaDefinition = external_exports.object({
|
|
|
66434
66720
|
email: external_exports.email().max(320),
|
|
66435
66721
|
role: roleSchema.default("MEMBER")
|
|
66436
66722
|
});
|
|
66723
|
+
var inviteManyAsCallerInputSchemaDefinition = external_exports.object({
|
|
66724
|
+
emails: external_exports.array(external_exports.string().trim().min(1).max(320)).min(1).max(50),
|
|
66725
|
+
/** A conversation by id or `#name`; invitees join it and land in it. */
|
|
66726
|
+
to: external_exports.string().trim().min(1).max(200).optional(),
|
|
66727
|
+
role: roleSchema.default("MEMBER"),
|
|
66728
|
+
confirmed: external_exports.literal(true)
|
|
66729
|
+
});
|
|
66730
|
+
var callerRefusedAddressSchema = external_exports.object({
|
|
66731
|
+
email: external_exports.string(),
|
|
66732
|
+
reason: external_exports.enum(["invalid", "duplicate", "member"])
|
|
66733
|
+
});
|
|
66734
|
+
var callerInviteManySchemaDefinition = external_exports.object({
|
|
66735
|
+
invites: external_exports.array(callerWorkspaceInviteSchemaDefinition),
|
|
66736
|
+
refused: external_exports.array(callerRefusedAddressSchema),
|
|
66737
|
+
/** Some invitations wait for Team (or for seats) before any email goes out. */
|
|
66738
|
+
held: external_exports.boolean(),
|
|
66739
|
+
/** The conversation they land in; null without `to`. */
|
|
66740
|
+
channelId: external_exports.string().nullable()
|
|
66741
|
+
});
|
|
66742
|
+
var callerRequestInvitesSchemaDefinition = external_exports.object({
|
|
66743
|
+
requests: external_exports.array(callerAccessRequestSchemaDefinition),
|
|
66744
|
+
refused: external_exports.array(callerRefusedAddressSchema),
|
|
66745
|
+
channelId: external_exports.string().nullable(),
|
|
66746
|
+
/** The Owners and Admins who approve them, by name. */
|
|
66747
|
+
approvers: external_exports.array(external_exports.string()).default([])
|
|
66748
|
+
});
|
|
66437
66749
|
var revokeInviteAsCallerInputSchemaDefinition = external_exports.object({
|
|
66438
66750
|
invite: external_exports.string().trim().min(1).max(320)
|
|
66439
66751
|
});
|
|
@@ -66680,6 +66992,13 @@ var LazeApiError = class extends Error {
|
|
|
66680
66992
|
/** What Laze adds to the code, such as the bound session of a `session_not_bound`. */
|
|
66681
66993
|
meta;
|
|
66682
66994
|
};
|
|
66995
|
+
var AGENT_MIGRATED = "agent_migrated";
|
|
66996
|
+
function migratedNoticeOf(error62) {
|
|
66997
|
+
if (!(error62 instanceof LazeApiError) || error62.code !== AGENT_MIGRATED) return void 0;
|
|
66998
|
+
const notice = typeof error62.meta?.notice === "string" ? error62.meta.notice : error62.message;
|
|
66999
|
+
const link = typeof error62.meta?.link === "string" ? error62.meta.link : null;
|
|
67000
|
+
return { notice, link };
|
|
67001
|
+
}
|
|
66683
67002
|
var LazeClient = class _LazeClient {
|
|
66684
67003
|
constructor(options) {
|
|
66685
67004
|
this.options = options;
|
|
@@ -66688,9 +67007,16 @@ var LazeClient = class _LazeClient {
|
|
|
66688
67007
|
static create({
|
|
66689
67008
|
baseUrl,
|
|
66690
67009
|
token: token2,
|
|
66691
|
-
fetcher
|
|
67010
|
+
fetcher,
|
|
67011
|
+
onMigrated
|
|
66692
67012
|
}) {
|
|
66693
|
-
return new _LazeClient({
|
|
67013
|
+
return new _LazeClient({
|
|
67014
|
+
baseUrl: baseUrl.replace(/\/+$/, ""),
|
|
67015
|
+
token: token2,
|
|
67016
|
+
fetcher,
|
|
67017
|
+
headers: {},
|
|
67018
|
+
onMigrated
|
|
67019
|
+
});
|
|
66694
67020
|
}
|
|
66695
67021
|
/** The same client, sending these headers too on every call. */
|
|
66696
67022
|
withHeaders(headers) {
|
|
@@ -66703,6 +67029,9 @@ var LazeClient = class _LazeClient {
|
|
|
66703
67029
|
post(path, body, { signal } = {}) {
|
|
66704
67030
|
return this.send({ method: "POST", path, body, signal });
|
|
66705
67031
|
}
|
|
67032
|
+
put(path, body) {
|
|
67033
|
+
return this.send({ method: "PUT", path, body });
|
|
67034
|
+
}
|
|
66706
67035
|
/** A JSON body sent as it is, answered as it came: the status and text, never thrown. */
|
|
66707
67036
|
async forward({
|
|
66708
67037
|
path,
|
|
@@ -66720,7 +67049,14 @@ var LazeClient = class _LazeClient {
|
|
|
66720
67049
|
headers,
|
|
66721
67050
|
body
|
|
66722
67051
|
});
|
|
66723
|
-
|
|
67052
|
+
const text2 = await response.text();
|
|
67053
|
+
if (response.status === 401) await this.toldMigrated(apiErrorOf({ status: 401, text: text2 }));
|
|
67054
|
+
return { status: response.status, text: text2 };
|
|
67055
|
+
}
|
|
67056
|
+
async toldMigrated(error62) {
|
|
67057
|
+
const found = migratedNoticeOf(error62);
|
|
67058
|
+
if (found && this.options.onMigrated)
|
|
67059
|
+
await this.options.onMigrated(found).catch(() => void 0);
|
|
66724
67060
|
}
|
|
66725
67061
|
async send({
|
|
66726
67062
|
method,
|
|
@@ -66743,10 +67079,23 @@ var LazeClient = class _LazeClient {
|
|
|
66743
67079
|
});
|
|
66744
67080
|
const text2 = await response.text();
|
|
66745
67081
|
const parsed = text2 ? JSON.parse(text2) : void 0;
|
|
66746
|
-
if (!response.ok)
|
|
67082
|
+
if (!response.ok) {
|
|
67083
|
+
const error62 = errorOf({ status: response.status, body: parsed });
|
|
67084
|
+
await this.toldMigrated(error62);
|
|
67085
|
+
throw error62;
|
|
67086
|
+
}
|
|
66747
67087
|
return parsed;
|
|
66748
67088
|
}
|
|
66749
67089
|
};
|
|
67090
|
+
function apiErrorOf({ status: status9, text: text2 }) {
|
|
67091
|
+
let body;
|
|
67092
|
+
try {
|
|
67093
|
+
body = text2 ? JSON.parse(text2) : void 0;
|
|
67094
|
+
} catch {
|
|
67095
|
+
body = void 0;
|
|
67096
|
+
}
|
|
67097
|
+
return errorOf({ status: status9, body });
|
|
67098
|
+
}
|
|
66750
67099
|
function errorOf({ status: status9, body }) {
|
|
66751
67100
|
const record4 = typeof body === "object" && body !== null ? body : {};
|
|
66752
67101
|
const nested = typeof record4.error === "object" && record4.error !== null ? record4.error : record4;
|
|
@@ -66760,6 +67109,16 @@ function errorOf({ status: status9, body }) {
|
|
|
66760
67109
|
}
|
|
66761
67110
|
|
|
66762
67111
|
// src/services/session.service.ts
|
|
67112
|
+
function markMigratedOn({ context, profile }) {
|
|
67113
|
+
return async ({ notice, link }) => context.store.markMigrated({ name: profile, migrated: { at: context.nowMs(), link, notice } });
|
|
67114
|
+
}
|
|
67115
|
+
function quietWhenMigrated({ args }) {
|
|
67116
|
+
const [first = "", second = ""] = args.words;
|
|
67117
|
+
if (first === "hook") return true;
|
|
67118
|
+
if (first === "inbox") return Boolean(args.flags.wait);
|
|
67119
|
+
if (first === "adopt") return !args.flags.status && !args.flags.stop;
|
|
67120
|
+
return first === "connect" && second === "run";
|
|
67121
|
+
}
|
|
66763
67122
|
async function signedIn({
|
|
66764
67123
|
context,
|
|
66765
67124
|
args
|
|
@@ -66775,10 +67134,14 @@ async function signedIn({
|
|
|
66775
67134
|
throw new CliUsageError(
|
|
66776
67135
|
"Not signed in: run `laze login`, or `laze agent link --token <token>` from an agent."
|
|
66777
67136
|
);
|
|
67137
|
+
if (chosen.profile.migrated && quietWhenMigrated({ args })) {
|
|
67138
|
+
throw new ProfileMigratedError(chosen.name);
|
|
67139
|
+
}
|
|
66778
67140
|
const client = LazeClient.create({
|
|
66779
67141
|
baseUrl: chosen.profile.url,
|
|
66780
67142
|
token: chosen.profile.token,
|
|
66781
|
-
fetcher: context.fetcher
|
|
67143
|
+
fetcher: context.fetcher,
|
|
67144
|
+
onMigrated: markMigratedOn({ context, profile: chosen.name })
|
|
66782
67145
|
});
|
|
66783
67146
|
if (chosen.profile.kind === "agent") await namingFirst({ client, args });
|
|
66784
67147
|
return { name: chosen.name, profile: chosen.profile, client };
|
|
@@ -66792,7 +67155,8 @@ var ALWAYS_FREE = [
|
|
|
66792
67155
|
"logout",
|
|
66793
67156
|
"update",
|
|
66794
67157
|
"agent link",
|
|
66795
|
-
"agent bind"
|
|
67158
|
+
"agent bind",
|
|
67159
|
+
"agent migrate"
|
|
66796
67160
|
];
|
|
66797
67161
|
async function namingFirst({ client, args }) {
|
|
66798
67162
|
const [first = "", second = ""] = args.words;
|
|
@@ -66910,15 +67274,21 @@ async function disconnectAgent({ context, args }) {
|
|
|
66910
67274
|
async function inviteAgent({ context, args }) {
|
|
66911
67275
|
const name3 = flagText({ args, name: "name" });
|
|
66912
67276
|
const channelId = flagText({ args, name: "channel" });
|
|
67277
|
+
const reconnect = flagText({ args, name: "reconnect" });
|
|
67278
|
+
if (args.flags.reconnect === true) {
|
|
67279
|
+
throw new CliUsageError("Usage: laze agent invite --reconnect <agent>");
|
|
67280
|
+
}
|
|
66913
67281
|
const { client } = await signedIn({ context, args });
|
|
66914
67282
|
const link = await client.post("/api/agents/links", {
|
|
66915
67283
|
...name3 ? { name: name3 } : {},
|
|
66916
|
-
...channelId ? { channelId } : {}
|
|
67284
|
+
...channelId ? { channelId } : {},
|
|
67285
|
+
...reconnect ? { reconnect } : {}
|
|
66917
67286
|
});
|
|
66918
67287
|
if (args.flags.json) return context.out(`${JSON.stringify(link, null, 2)}
|
|
66919
67288
|
`);
|
|
67289
|
+
const where = reconnect ? `the session that should run ${reconnect} again` : "the agent's session";
|
|
66920
67290
|
context.out(
|
|
66921
|
-
`Paste this into
|
|
67291
|
+
`Paste this into ${where} (the link works once, until ${link.expiresAt}):
|
|
66922
67292
|
|
|
66923
67293
|
${link.prompt}
|
|
66924
67294
|
`
|
|
@@ -67407,7 +67777,7 @@ var dismissSlackLinkPromptInputSchemaDefinition = external_exports.object({
|
|
|
67407
67777
|
var dismissSlackLinkPromptInputSchema = dismissSlackLinkPromptInputSchemaDefinition;
|
|
67408
67778
|
|
|
67409
67779
|
// ../../modules/slack/contract/src/slack-move.ts
|
|
67410
|
-
var
|
|
67780
|
+
var workspaceIdSchema13 = external_exports.string().min(1);
|
|
67411
67781
|
var teamIdSchema = external_exports.string().regex(/^[TE][A-Z0-9]{2,20}$/);
|
|
67412
67782
|
var slackChannelIdSchema = external_exports.string().regex(/^[CG][A-Z0-9]{2,20}$/);
|
|
67413
67783
|
var slackUserIdSchema = external_exports.string().regex(/^[UW][A-Z0-9]{2,20}$/);
|
|
@@ -67480,7 +67850,7 @@ var slackMovePreviewSchemaDefinition = external_exports.object({
|
|
|
67480
67850
|
});
|
|
67481
67851
|
var slackMovePreviewSchema = slackMovePreviewSchemaDefinition;
|
|
67482
67852
|
var slackMoveChannelInputSchemaDefinition = external_exports.object({
|
|
67483
|
-
workspaceId:
|
|
67853
|
+
workspaceId: workspaceIdSchema13,
|
|
67484
67854
|
teamId: teamIdSchema,
|
|
67485
67855
|
slackChannelId: slackChannelIdSchema
|
|
67486
67856
|
});
|
|
@@ -67495,7 +67865,7 @@ var slackMoveRequestSchemaDefinition = external_exports.object({
|
|
|
67495
67865
|
farewell: external_exports.string().trim().min(1).max(SLACK_FAREWELL_MAX).optional()
|
|
67496
67866
|
});
|
|
67497
67867
|
var startSlackMovesInputSchemaDefinition = external_exports.object({
|
|
67498
|
-
workspaceId:
|
|
67868
|
+
workspaceId: workspaceIdSchema13,
|
|
67499
67869
|
teamId: teamIdSchema,
|
|
67500
67870
|
channels: external_exports.array(slackMoveRequestSchemaDefinition).min(1).max(SLACK_MOVE_BATCH_MAX)
|
|
67501
67871
|
});
|
|
@@ -67510,7 +67880,7 @@ var startedSlackMovesSchemaDefinition = external_exports.object({
|
|
|
67510
67880
|
});
|
|
67511
67881
|
var startedSlackMovesSchema = startedSlackMovesSchemaDefinition;
|
|
67512
67882
|
var slackMoveInputSchemaDefinition = external_exports.object({
|
|
67513
|
-
workspaceId:
|
|
67883
|
+
workspaceId: workspaceIdSchema13,
|
|
67514
67884
|
moveId: external_exports.string().min(1).max(100)
|
|
67515
67885
|
});
|
|
67516
67886
|
var slackMoveInputSchema = slackMoveInputSchemaDefinition;
|
|
@@ -67584,7 +67954,7 @@ var slackExternalPeopleSchemaDefinition = external_exports.object({
|
|
|
67584
67954
|
var slackExternalPeopleSchema = slackExternalPeopleSchemaDefinition;
|
|
67585
67955
|
|
|
67586
67956
|
// ../../modules/slack/contract/src/slack-setup.ts
|
|
67587
|
-
var
|
|
67957
|
+
var workspaceIdSchema14 = external_exports.string().min(1);
|
|
67588
67958
|
var appKeySchema = external_exports.string().regex(/^[a-z0-9]{8,64}$/);
|
|
67589
67959
|
var returnToSchema3 = external_exports.string().startsWith("/").max(500).optional();
|
|
67590
67960
|
var slackAppCredentialFieldSchema = external_exports.enum([
|
|
@@ -67593,7 +67963,7 @@ var slackAppCredentialFieldSchema = external_exports.enum([
|
|
|
67593
67963
|
"clientSecret",
|
|
67594
67964
|
"signingSecret"
|
|
67595
67965
|
]);
|
|
67596
|
-
var beginSlackSetupInputSchemaDefinition = external_exports.object({ workspaceId:
|
|
67966
|
+
var beginSlackSetupInputSchemaDefinition = external_exports.object({ workspaceId: workspaceIdSchema14 });
|
|
67597
67967
|
var beginSlackSetupInputSchema = beginSlackSetupInputSchemaDefinition;
|
|
67598
67968
|
var slackSetupSchemaDefinition = external_exports.object({
|
|
67599
67969
|
appKey: appKeySchema,
|
|
@@ -67607,7 +67977,7 @@ var slackSetupSchemaDefinition = external_exports.object({
|
|
|
67607
67977
|
});
|
|
67608
67978
|
var slackSetupSchema = slackSetupSchemaDefinition;
|
|
67609
67979
|
var saveSlackAppCredentialsInputSchemaDefinition = external_exports.object({
|
|
67610
|
-
workspaceId:
|
|
67980
|
+
workspaceId: workspaceIdSchema14,
|
|
67611
67981
|
appKey: appKeySchema,
|
|
67612
67982
|
appId: external_exports.string().max(200),
|
|
67613
67983
|
clientId: external_exports.string().max(200),
|
|
@@ -67617,7 +67987,7 @@ var saveSlackAppCredentialsInputSchemaDefinition = external_exports.object({
|
|
|
67617
67987
|
});
|
|
67618
67988
|
var saveSlackAppCredentialsInputSchema = saveSlackAppCredentialsInputSchemaDefinition;
|
|
67619
67989
|
var installSlackAppInputSchemaDefinition = external_exports.object({
|
|
67620
|
-
workspaceId:
|
|
67990
|
+
workspaceId: workspaceIdSchema14,
|
|
67621
67991
|
appKey: appKeySchema,
|
|
67622
67992
|
returnTo: returnToSchema3
|
|
67623
67993
|
});
|
|
@@ -67752,7 +68122,7 @@ var slackEventsPausedPayloadSchemaDefinition = external_exports.object({
|
|
|
67752
68122
|
var SLACK_CACHE_DAYS_MAX = 30;
|
|
67753
68123
|
var SLACK_HISTORY_PATH = "/api/slack/history";
|
|
67754
68124
|
var SLACK_READ_BUDGET_MAX = 5e3;
|
|
67755
|
-
var
|
|
68125
|
+
var workspaceIdSchema15 = external_exports.string().min(1);
|
|
67756
68126
|
var teamIdSchema2 = external_exports.string().regex(/^[TE][A-Z0-9]{2,20}$/);
|
|
67757
68127
|
var slackChannelIdSchema2 = external_exports.string().regex(/^[CG][A-Z0-9]{2,20}$/);
|
|
67758
68128
|
var slackConnectionStatusSchema = external_exports.enum(["connected", "needs_reinstall"]);
|
|
@@ -67816,13 +68186,13 @@ var slackChannelViewSchemaDefinition = external_exports.object({
|
|
|
67816
68186
|
});
|
|
67817
68187
|
var slackChannelViewSchema = slackChannelViewSchemaDefinition;
|
|
67818
68188
|
var startSlackInstallInputSchemaDefinition = external_exports.object({
|
|
67819
|
-
workspaceId:
|
|
68189
|
+
workspaceId: workspaceIdSchema15,
|
|
67820
68190
|
/** A path in Laze to land on afterwards; defaults to the Connectors page. */
|
|
67821
68191
|
returnTo: external_exports.string().startsWith("/").max(500).optional()
|
|
67822
68192
|
});
|
|
67823
68193
|
var startSlackInstallInputSchema = startSlackInstallInputSchemaDefinition;
|
|
67824
68194
|
var startSlackLinkInputSchemaDefinition = external_exports.object({
|
|
67825
|
-
workspaceId:
|
|
68195
|
+
workspaceId: workspaceIdSchema15,
|
|
67826
68196
|
teamId: teamIdSchema2,
|
|
67827
68197
|
returnTo: external_exports.string().startsWith("/").max(500).optional()
|
|
67828
68198
|
});
|
|
@@ -67830,7 +68200,7 @@ var startSlackLinkInputSchema = startSlackLinkInputSchemaDefinition;
|
|
|
67830
68200
|
var startedSlackAuthorizeSchemaDefinition = external_exports.object({ authorizeUrl: external_exports.url() });
|
|
67831
68201
|
var startedSlackAuthorizeSchema = startedSlackAuthorizeSchemaDefinition;
|
|
67832
68202
|
var startSlackSetupInputSchemaDefinition = external_exports.object({
|
|
67833
|
-
workspaceId:
|
|
68203
|
+
workspaceId: workspaceIdSchema15,
|
|
67834
68204
|
configToken: external_exports.string().trim().min(10).max(1e3),
|
|
67835
68205
|
returnTo: external_exports.string().startsWith("/").max(500).optional()
|
|
67836
68206
|
});
|
|
@@ -67849,19 +68219,19 @@ var slackEventsHeadersSchemaDefinition = external_exports.object({
|
|
|
67849
68219
|
});
|
|
67850
68220
|
var slackEventsAnswerSchemaDefinition = external_exports.object({ challenge: external_exports.string().nullable() });
|
|
67851
68221
|
var teamInputSchemaDefinition = external_exports.object({
|
|
67852
|
-
workspaceId:
|
|
68222
|
+
workspaceId: workspaceIdSchema15,
|
|
67853
68223
|
teamId: teamIdSchema2
|
|
67854
68224
|
});
|
|
67855
68225
|
var slackTeamInputSchema = teamInputSchemaDefinition;
|
|
67856
68226
|
var setSlackMirrorInputSchemaDefinition = external_exports.object({
|
|
67857
|
-
workspaceId:
|
|
68227
|
+
workspaceId: workspaceIdSchema15,
|
|
67858
68228
|
teamId: teamIdSchema2,
|
|
67859
68229
|
slackChannelId: slackChannelIdSchema2,
|
|
67860
68230
|
mirrored: external_exports.boolean()
|
|
67861
68231
|
});
|
|
67862
68232
|
var setSlackMirrorInputSchema = setSlackMirrorInputSchemaDefinition;
|
|
67863
68233
|
var updateSlackConnectionInputSchemaDefinition = external_exports.object({
|
|
67864
|
-
workspaceId:
|
|
68234
|
+
workspaceId: workspaceIdSchema15,
|
|
67865
68235
|
teamId: teamIdSchema2,
|
|
67866
68236
|
label: external_exports.string().trim().max(80).nullable().optional(),
|
|
67867
68237
|
cacheDays: external_exports.number().int().min(1).max(SLACK_CACHE_DAYS_MAX).optional(),
|
|
@@ -67869,17 +68239,17 @@ var updateSlackConnectionInputSchemaDefinition = external_exports.object({
|
|
|
67869
68239
|
});
|
|
67870
68240
|
var updateSlackConnectionInputSchema = updateSlackConnectionInputSchemaDefinition;
|
|
67871
68241
|
var updateSlackAppInputSchemaDefinition = external_exports.object({
|
|
67872
|
-
workspaceId:
|
|
68242
|
+
workspaceId: workspaceIdSchema15,
|
|
67873
68243
|
teamId: teamIdSchema2,
|
|
67874
68244
|
configToken: external_exports.string().trim().min(10).max(1e3)
|
|
67875
68245
|
});
|
|
67876
68246
|
var updateSlackAppInputSchema = updateSlackAppInputSchemaDefinition;
|
|
67877
68247
|
var slackLinkParamsSchemaDefinition = external_exports.object({
|
|
67878
|
-
workspaceId:
|
|
68248
|
+
workspaceId: workspaceIdSchema15,
|
|
67879
68249
|
teamId: teamIdSchema2
|
|
67880
68250
|
});
|
|
67881
68251
|
var slackHistoryInputSchemaDefinition = external_exports.object({
|
|
67882
|
-
workspaceId:
|
|
68252
|
+
workspaceId: workspaceIdSchema15,
|
|
67883
68253
|
/** The Laze conversation that mirrors the Slack channel. */
|
|
67884
68254
|
channelId: external_exports.string().min(1),
|
|
67885
68255
|
/** Messages before this time; the oldest message the cache shows. */
|
|
@@ -67909,7 +68279,7 @@ var slackHistoryPageSchemaDefinition = external_exports.object({
|
|
|
67909
68279
|
});
|
|
67910
68280
|
var slackHistoryPageSchema = slackHistoryPageSchemaDefinition;
|
|
67911
68281
|
var slackFileParamsSchemaDefinition = external_exports.object({
|
|
67912
|
-
workspaceId:
|
|
68282
|
+
workspaceId: workspaceIdSchema15,
|
|
67913
68283
|
/** The Laze conversation that mirrors the Slack channel. */
|
|
67914
68284
|
channelId: external_exports.string().min(1).max(200),
|
|
67915
68285
|
fileId: external_exports.string().regex(/^F[A-Z0-9]{2,30}$/)
|
|
@@ -67917,7 +68287,7 @@ var slackFileParamsSchemaDefinition = external_exports.object({
|
|
|
67917
68287
|
var SLACK_SEARCH_QUERY_MIN = 2;
|
|
67918
68288
|
var SLACK_SEARCH_QUERY_MAX = 200;
|
|
67919
68289
|
var slackSearchInputSchemaDefinition = external_exports.object({
|
|
67920
|
-
workspaceId:
|
|
68290
|
+
workspaceId: workspaceIdSchema15,
|
|
67921
68291
|
query: external_exports.string().trim().min(SLACK_SEARCH_QUERY_MIN).max(SLACK_SEARCH_QUERY_MAX)
|
|
67922
68292
|
});
|
|
67923
68293
|
var slackSearchInputSchema = slackSearchInputSchemaDefinition;
|
|
@@ -67965,7 +68335,7 @@ var slackSearchAnswerSchemaDefinition = external_exports.object({
|
|
|
67965
68335
|
});
|
|
67966
68336
|
var slackSearchAnswerSchema = slackSearchAnswerSchemaDefinition;
|
|
67967
68337
|
var SlackApi = moduleApi()("slack");
|
|
67968
|
-
var workspaceInput3 = external_exports.object({ workspaceId:
|
|
68338
|
+
var workspaceInput3 = external_exports.object({ workspaceId: workspaceIdSchema15 });
|
|
67969
68339
|
var slackTrpc = defineTrpcContract("slack").query("overview").withInput(workspaceInput3).withOutput(slackOverviewSchema).mutation("startSetup").withInput(startSlackSetupInputSchema).withOutput(startedSlackAuthorizeSchema).mutation("beginSetup").withInput(beginSlackSetupInputSchema).withOutput(slackSetupSchema).mutation("saveAppCredentials").withInput(saveSlackAppCredentialsInputSchema).withOutput(startedSlackAuthorizeSchema).mutation("installApp").withInput(installSlackAppInputSchema).withOutput(startedSlackAuthorizeSchema).mutation("startInstall").withInput(startSlackInstallInputSchema).withOutput(startedSlackAuthorizeSchema).mutation("startLink").withInput(startSlackLinkInputSchema).withOutput(startedSlackAuthorizeSchema).query("channels").withInput(slackTeamInputSchema).withOutput(external_exports.array(slackChannelViewSchema)).mutation("setMirror").withInput(setSlackMirrorInputSchema).withOutput(slackConnectionViewSchema).mutation("updateConnection").withInput(updateSlackConnectionInputSchema).withOutput(slackConnectionViewSchema).mutation("disconnect").withInput(slackTeamInputSchema).withOutput(external_exports.object({ disconnected: external_exports.literal(true) })).mutation("unlink").withInput(slackTeamInputSchema).withOutput(slackConnectionViewSchema).query("linkPrompts").withInput(workspaceInput3).withOutput(slackLinkPromptsSchema).mutation("dismissLinkPrompt").withInput(dismissSlackLinkPromptInputSchema).withOutput(slackLinkPromptsSchema).query("people").withInput(slackPeopleInputSchema).withOutput(slackPeopleSchema).query("bookmarks").withInput(slackBookmarksInputSchema).withOutput(slackBookmarksSchema).query("profiles").withInput(slackProfilesInputSchema).withOutput(slackProfilesSchema).query("linkedNames").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(slackLinkedNamesSchema).query("externalPeople").withInput(slackExternalPeopleInputSchema).withOutput(slackExternalPeopleSchema).mutation("openDirect").withInput(openSlackDirectInputSchema).withOutput(openedSlackDirectSchema).mutation("updateApp").withInput(updateSlackAppInputSchema).withOutput(external_exports.object({ updated: external_exports.literal(true) })).query("history").withInput(slackHistoryInputSchema).withOutput(slackHistoryPageSchema).query("search").withInput(slackSearchInputSchema).withOutput(slackSearchAnswerSchema).query("movePreview").withInput(slackMoveChannelInputSchema).withOutput(slackMovePreviewSchema).mutation("startMoves").withInput(startSlackMovesInputSchema).withOutput(startedSlackMovesSchema).mutation("cancelMove").withInput(slackMoveInputSchema).withOutput(slackMoveViewSchema).query("moves").withInput(workspaceInput3).withOutput(slackMovesSchema).query("emojiSource").withInput(workspaceInput3).withOutput(slackEmojiSourceSchema).mutation("importEmoji").withInput(workspaceInput3).withOutput(slackEmojiImportSchema).build();
|
|
67970
68340
|
|
|
67971
68341
|
// ../../modules/slack/contract/src/slack-keys.ts
|
|
@@ -68607,7 +68977,8 @@ async function agentProfileHere({
|
|
|
68607
68977
|
args: await sessionProfileArgs({ context, args: asked, session, binds: false }),
|
|
68608
68978
|
name: "profile"
|
|
68609
68979
|
});
|
|
68610
|
-
|
|
68980
|
+
const profile = name3 ? config2.profiles[name3] : void 0;
|
|
68981
|
+
return name3 && profile?.kind === "agent" && !profile.migrated ? name3 : void 0;
|
|
68611
68982
|
}
|
|
68612
68983
|
async function projectHooksHere({ context }) {
|
|
68613
68984
|
const directory = context.environment.inherited.CLAUDE_PROJECT_DIR || context.cwd;
|
|
@@ -68697,7 +69068,8 @@ async function preToolHook({ context, args }) {
|
|
|
68697
69068
|
const client = LazeClient.create({
|
|
68698
69069
|
baseUrl: profile.url,
|
|
68699
69070
|
token: profile.token,
|
|
68700
|
-
fetcher: (input3, init) => context.fetcher(input3, { ...init, signal: AbortSignal.timeout(PRE_TOOL_TIMEOUT_MS) })
|
|
69071
|
+
fetcher: (input3, init) => context.fetcher(input3, { ...init, signal: AbortSignal.timeout(PRE_TOOL_TIMEOUT_MS) }),
|
|
69072
|
+
onMigrated: markMigratedOn({ context, profile: name3 })
|
|
68701
69073
|
});
|
|
68702
69074
|
const state = await readState({ context, agent: name3 });
|
|
68703
69075
|
const answer5 = await beat({ client, state, working: true });
|
|
@@ -68716,8 +69088,13 @@ async function preToolHook({ context, args }) {
|
|
|
68716
69088
|
})
|
|
68717
69089
|
);
|
|
68718
69090
|
} catch (error62) {
|
|
68719
|
-
|
|
68720
|
-
|
|
69091
|
+
if (error62 instanceof ProfileMigratedError) return;
|
|
69092
|
+
const migrated = migratedNoticeOf(error62);
|
|
69093
|
+
context.err(
|
|
69094
|
+
migrated ? `${migrated.notice}
|
|
69095
|
+
` : `laze: the PreToolUse hook skipped: ${String(error62)}
|
|
69096
|
+
`
|
|
69097
|
+
);
|
|
68721
69098
|
}
|
|
68722
69099
|
}
|
|
68723
69100
|
|
|
@@ -69411,15 +69788,23 @@ import { dirname as dirname9, join as join11 } from "node:path";
|
|
|
69411
69788
|
|
|
69412
69789
|
// src/services/codex-turn-watch.service.ts
|
|
69413
69790
|
import { open as open2, readdir as readdir2 } from "node:fs/promises";
|
|
69414
|
-
import { join as join6 } from "node:path";
|
|
69791
|
+
import { basename as basename3, join as join6 } from "node:path";
|
|
69415
69792
|
var READ_MS = 1500;
|
|
69416
69793
|
var KEEP_WORKING_MS = 3e4;
|
|
69417
|
-
async function
|
|
69418
|
-
|
|
69794
|
+
async function codexRolloutPathOf({
|
|
69795
|
+
codexHome,
|
|
69796
|
+
threadId
|
|
69797
|
+
}) {
|
|
69798
|
+
const root = join6(codexHome, "sessions");
|
|
69419
69799
|
const files2 = await readdir2(root, { recursive: true }).catch(() => []);
|
|
69420
|
-
const file3 = files2.find(
|
|
69800
|
+
const file3 = files2.find(
|
|
69801
|
+
(name3) => basename3(name3).startsWith("rollout-") && name3.endsWith(`-${threadId}.jsonl`)
|
|
69802
|
+
);
|
|
69421
69803
|
return file3 ? join6(root, file3) : void 0;
|
|
69422
69804
|
}
|
|
69805
|
+
function rolloutPathOf({ delivery }) {
|
|
69806
|
+
return codexRolloutPathOf({ codexHome: delivery.codexHome, threadId: delivery.threadId });
|
|
69807
|
+
}
|
|
69423
69808
|
async function readFrom({ path, offset }) {
|
|
69424
69809
|
const handle = await open2(path, "r");
|
|
69425
69810
|
try {
|
|
@@ -69508,7 +69893,7 @@ import { chmod as chmod2, mkdir as mkdir5, readFile as readFile6, writeFile as w
|
|
|
69508
69893
|
import { dirname as dirname5, join as join7 } from "node:path";
|
|
69509
69894
|
|
|
69510
69895
|
// ../../modules/openclaw/contract/src/openclaw.ts
|
|
69511
|
-
var
|
|
69896
|
+
var workspaceIdSchema16 = external_exports.string().min(1);
|
|
69512
69897
|
var connectionIdSchema = external_exports.string().min(1).max(80);
|
|
69513
69898
|
var openclawAgentIdSchema = external_exports.string().min(1).max(120);
|
|
69514
69899
|
var openclawConnectionStatusSchema = external_exports.enum([
|
|
@@ -69563,14 +69948,14 @@ var openclawOverviewSchemaDefinition = external_exports.object({
|
|
|
69563
69948
|
});
|
|
69564
69949
|
var openclawOverviewSchema = openclawOverviewSchemaDefinition;
|
|
69565
69950
|
var connectOpenclawInputSchemaDefinition = external_exports.object({
|
|
69566
|
-
workspaceId:
|
|
69951
|
+
workspaceId: workspaceIdSchema16,
|
|
69567
69952
|
gatewayUrl: external_exports.string().trim().min(1).max(500),
|
|
69568
69953
|
token: external_exports.string().trim().min(1).max(500),
|
|
69569
69954
|
label: external_exports.string().trim().min(1).max(80).optional()
|
|
69570
69955
|
});
|
|
69571
69956
|
var connectOpenclawInputSchema = connectOpenclawInputSchemaDefinition;
|
|
69572
69957
|
var openclawConnectionRefSchemaDefinition = external_exports.object({
|
|
69573
|
-
workspaceId:
|
|
69958
|
+
workspaceId: workspaceIdSchema16,
|
|
69574
69959
|
connectionId: connectionIdSchema
|
|
69575
69960
|
});
|
|
69576
69961
|
var openclawConnectionRefSchema = openclawConnectionRefSchemaDefinition;
|
|
@@ -69597,7 +69982,7 @@ var openclawAgentKeySchemaDefinition = external_exports.object({
|
|
|
69597
69982
|
});
|
|
69598
69983
|
var openclawAgentKeySchema = openclawAgentKeySchemaDefinition;
|
|
69599
69984
|
var OpenclawApi = moduleApi()("openclaw");
|
|
69600
|
-
var openclawTrpc = defineTrpcContract("openclaw").query("overview").withInput(external_exports.object({ workspaceId:
|
|
69985
|
+
var openclawTrpc = defineTrpcContract("openclaw").query("overview").withInput(external_exports.object({ workspaceId: workspaceIdSchema16 })).withOutput(openclawOverviewSchema).mutation("connect").withInput(connectOpenclawInputSchema).withOutput(openclawConnectionViewSchema).mutation("setAgent").withInput(setOpenclawAgentInputSchema).withOutput(openclawConnectionViewSchema).mutation("setFeed").withInput(setOpenclawFeedInputSchema).withOutput(openclawConnectionViewSchema).mutation("agentKey").withInput(openclawAgentRefSchema).withOutput(openclawAgentKeySchema).mutation("disconnect").withInput(openclawConnectionRefSchema).withOutput(external_exports.object({ disconnected: external_exports.literal(true) })).build();
|
|
69601
69986
|
|
|
69602
69987
|
// ../../modules/openclaw/contract/src/openclaw.config.ts
|
|
69603
69988
|
var positiveInt5 = external_exports.coerce.number().int().positive();
|
|
@@ -69616,7 +70001,9 @@ var openclawConfig = Config.define((c) => ({
|
|
|
69616
70001
|
/** A run that shows no progress for this long is given up and said so in the conversation. */
|
|
69617
70002
|
runTimeoutMinutes: c.env("OPENCLAW_RUN_TIMEOUT_MINUTES", positiveInt5.default(30)),
|
|
69618
70003
|
/** The hard limit of one run, progress or not; OpenClaw gets it as the run's `timeoutMs`. */
|
|
69619
|
-
runMaxHours: c.env("OPENCLAW_RUN_MAX_HOURS", positiveInt5.default(6))
|
|
70004
|
+
runMaxHours: c.env("OPENCLAW_RUN_MAX_HOURS", positiveInt5.default(6)),
|
|
70005
|
+
/** Where the progress board ops card for a gateway that stopped answering is written. */
|
|
70006
|
+
opsAlertDir: c.env("OPENCLAW_OPS_ALERT_DIR", external_exports.string().min(1).optional())
|
|
69620
70007
|
}));
|
|
69621
70008
|
|
|
69622
70009
|
// ../../modules/openclaw/contract/src/openclaw.events.ts
|
|
@@ -70017,8 +70404,9 @@ async function notesOf({ context }) {
|
|
|
70017
70404
|
async function rushListenersOf({
|
|
70018
70405
|
context
|
|
70019
70406
|
}) {
|
|
70020
|
-
const
|
|
70021
|
-
|
|
70407
|
+
const config2 = await context.store.read();
|
|
70408
|
+
const bound = Object.entries(config2.sessions ?? {}).filter(
|
|
70409
|
+
([key, profile]) => key.startsWith("claude-code:") && !config2.profiles[profile]?.migrated
|
|
70022
70410
|
);
|
|
70023
70411
|
if (bound.length === 0) return [];
|
|
70024
70412
|
const listed = await rushListingOf({ context });
|
|
@@ -70089,11 +70477,12 @@ var CHECK_TIMEOUT_MS = 5e3;
|
|
|
70089
70477
|
function clientOf({ context, profile }) {
|
|
70090
70478
|
return context.store.read().then((config2) => {
|
|
70091
70479
|
const entry = config2.profiles[profile];
|
|
70092
|
-
if (!entry) return void 0;
|
|
70480
|
+
if (!entry || entry.migrated) return void 0;
|
|
70093
70481
|
return LazeClient.create({
|
|
70094
70482
|
baseUrl: entry.url,
|
|
70095
70483
|
token: entry.token,
|
|
70096
|
-
fetcher: (input2, init) => context.fetcher(input2, { ...init, signal: AbortSignal.timeout(CHECK_TIMEOUT_MS) })
|
|
70484
|
+
fetcher: (input2, init) => context.fetcher(input2, { ...init, signal: AbortSignal.timeout(CHECK_TIMEOUT_MS) }),
|
|
70485
|
+
onMigrated: markMigratedOn({ context, profile })
|
|
70097
70486
|
});
|
|
70098
70487
|
});
|
|
70099
70488
|
}
|
|
@@ -70306,7 +70695,8 @@ async function serveAgent({
|
|
|
70306
70695
|
const client = LazeClient.create({
|
|
70307
70696
|
baseUrl: entry.url,
|
|
70308
70697
|
token: entry.token,
|
|
70309
|
-
fetcher: context.fetcher
|
|
70698
|
+
fetcher: context.fetcher,
|
|
70699
|
+
onMigrated: markMigratedOn({ context, profile })
|
|
70310
70700
|
});
|
|
70311
70701
|
const watch = CodexTurnWatch.create({ context, client, profile, delivery: entry.delivery });
|
|
70312
70702
|
const ended = new AbortController();
|
|
@@ -70343,6 +70733,13 @@ async function serveRounds({
|
|
|
70343
70733
|
wait = 1;
|
|
70344
70734
|
if (delivered === 0) await context.sleep(1e3, signal);
|
|
70345
70735
|
} catch (error62) {
|
|
70736
|
+
const migrated = migratedNoticeOf(error62);
|
|
70737
|
+
if (migrated) {
|
|
70738
|
+
await report4(profile, "stopped: the agent moved into Laze");
|
|
70739
|
+
context.err(`${profile}: ${migrated.notice}
|
|
70740
|
+
`);
|
|
70741
|
+
return;
|
|
70742
|
+
}
|
|
70346
70743
|
if (error62 instanceof LazeApiError && error62.status === 401) {
|
|
70347
70744
|
await report4(profile, "stopped: Laze refused the agent's key; link the session again");
|
|
70348
70745
|
context.err(`${profile}: Laze refused the key; this agent is no longer served
|
|
@@ -70376,14 +70773,15 @@ async function syncLoops(run4) {
|
|
|
70376
70773
|
const config2 = await run4.context.store.read();
|
|
70377
70774
|
for (const [profile, current2] of run4.served) {
|
|
70378
70775
|
const entry = config2.profiles[profile];
|
|
70379
|
-
|
|
70776
|
+
const same2 = entry?.token === current2.token && entry.delivery?.threadId === current2.threadId;
|
|
70777
|
+
if (same2 && !entry.migrated) continue;
|
|
70380
70778
|
current2.stop.abort();
|
|
70381
70779
|
await current2.done;
|
|
70382
70780
|
run4.served.delete(profile);
|
|
70383
70781
|
setAgent(run4, profile, void 0);
|
|
70384
70782
|
}
|
|
70385
70783
|
const linked = Object.entries(config2.profiles).filter(
|
|
70386
|
-
(pair2) => pair2[1].delivery?.harness === "codex" && pair2[1].kind === "agent"
|
|
70784
|
+
(pair2) => pair2[1].delivery?.harness === "codex" && pair2[1].kind === "agent" && !pair2[1].migrated
|
|
70387
70785
|
);
|
|
70388
70786
|
for (const [profile, entry] of linked.filter(([name3]) => !run4.served.has(name3))) {
|
|
70389
70787
|
const { threadId } = entry.delivery;
|
|
@@ -70883,6 +71281,13 @@ async function waitHook({ context, args }) {
|
|
|
70883
71281
|
try {
|
|
70884
71282
|
return await waitForMessages({ context, args });
|
|
70885
71283
|
} catch (error62) {
|
|
71284
|
+
if (error62 instanceof ProfileMigratedError) return 0;
|
|
71285
|
+
const migrated = migratedNoticeOf(error62);
|
|
71286
|
+
if (migrated) {
|
|
71287
|
+
context.err(`${migrated.notice}
|
|
71288
|
+
`);
|
|
71289
|
+
return 2;
|
|
71290
|
+
}
|
|
70886
71291
|
context.err(`laze: the background waiter stopped: ${String(error62)}
|
|
70887
71292
|
`);
|
|
70888
71293
|
return 0;
|
|
@@ -71160,6 +71565,10 @@ async function supervise({
|
|
|
71160
71565
|
const code = await context.runCommand({ command, env: {} }).catch(() => 1);
|
|
71161
71566
|
if (context.nowMs() - started > HEALTHY_RUN_MS) wait = 1;
|
|
71162
71567
|
if ((await recordOf({ path }))?.pid !== context.processes.pid) break;
|
|
71568
|
+
if ((await context.store.read()).profiles[profile]?.migrated) {
|
|
71569
|
+
context.out("The agent moved into Laze; laze adopt codex stops here.\n");
|
|
71570
|
+
break;
|
|
71571
|
+
}
|
|
71163
71572
|
context.out(`laze adopt codex exited ${code}; starting it again in ${wait}s
|
|
71164
71573
|
`);
|
|
71165
71574
|
await context.sleep(wait * 1e3);
|
|
@@ -71592,10 +72001,10 @@ async function cachedPluginOf({ context }) {
|
|
|
71592
72001
|
async function refreshStaleCache({ context, folder }) {
|
|
71593
72002
|
const cached2 = await cachedPluginOf({ context });
|
|
71594
72003
|
if (!cached2) return true;
|
|
71595
|
-
const
|
|
72004
|
+
const read4 = (path) => readFile12(path, "utf8").catch(() => "");
|
|
71596
72005
|
for (const file3 of RUN_FILES) {
|
|
71597
|
-
const ours = await
|
|
71598
|
-
if (ours === await
|
|
72006
|
+
const ours = await read4(join15(folder, LAZE_PLUGIN, file3));
|
|
72007
|
+
if (ours === await read4(join15(cached2, file3))) continue;
|
|
71599
72008
|
const plugin2 = `${LAZE_PLUGIN}@${LAZE_PLUGIN}`;
|
|
71600
72009
|
const script = [
|
|
71601
72010
|
`claude plugin uninstall ${plugin2} --scope user ${QUIET}`,
|
|
@@ -71738,11 +72147,18 @@ async function pushInbox({
|
|
|
71738
72147
|
while (!signal.aborted) {
|
|
71739
72148
|
const messages = await client.post("/api/agents/me/inbox", { waitSeconds: ROUND_SECONDS3 }, { signal }).catch(async (error62) => {
|
|
71740
72149
|
if (signal.aborted) return [];
|
|
72150
|
+
const migrated = migratedNoticeOf(error62);
|
|
72151
|
+
if (migrated) {
|
|
72152
|
+
context.err(`${migrated.notice}
|
|
72153
|
+
`);
|
|
72154
|
+
return void 0;
|
|
72155
|
+
}
|
|
71741
72156
|
context.err(`laze mcp: could not read the inbox: ${String(error62)}
|
|
71742
72157
|
`);
|
|
71743
72158
|
await context.sleep(RETRY_MS, signal);
|
|
71744
72159
|
return [];
|
|
71745
72160
|
});
|
|
72161
|
+
if (messages === void 0) break;
|
|
71746
72162
|
if (messages.length === 0) {
|
|
71747
72163
|
await context.sleep(1e3, signal);
|
|
71748
72164
|
continue;
|
|
@@ -72087,6 +72503,11 @@ function stopContext({ context, text: text2 }) {
|
|
|
72087
72503
|
const hookSpecificOutput = { hookEventName: "Stop", additionalContext: text2 };
|
|
72088
72504
|
context.out(JSON.stringify({ hookSpecificOutput }));
|
|
72089
72505
|
}
|
|
72506
|
+
function reportFailed({ context, error: error62 }) {
|
|
72507
|
+
if (migratedNoticeOf(error62)) throw error62;
|
|
72508
|
+
context.err(`laze: could not report context: ${String(error62)}
|
|
72509
|
+
`);
|
|
72510
|
+
}
|
|
72090
72511
|
async function handOver({ context, args }) {
|
|
72091
72512
|
const raw = await context.readStdin();
|
|
72092
72513
|
const input2 = raw.trim() ? JSON.parse(raw) : {};
|
|
@@ -72097,8 +72518,7 @@ async function handOver({ context, args }) {
|
|
|
72097
72518
|
const named = await sessionProfileArgs({ context, args: asked, session });
|
|
72098
72519
|
const { client, name: agent2 } = await signedIn({ context, args: named });
|
|
72099
72520
|
await reportTranscript({ client, input: input2 }).catch(
|
|
72100
|
-
(error62) =>
|
|
72101
|
-
`)
|
|
72521
|
+
(error62) => reportFailed({ context, error: error62 })
|
|
72102
72522
|
);
|
|
72103
72523
|
if (input2.stop_hook_active) return;
|
|
72104
72524
|
if (await monitorServes({ context, profile: agent2, claudePid })) {
|
|
@@ -72170,6 +72590,9 @@ async function stopHook({ context, args }) {
|
|
|
72170
72590
|
try {
|
|
72171
72591
|
await handOver({ context, args });
|
|
72172
72592
|
} catch (error62) {
|
|
72593
|
+
if (error62 instanceof ProfileMigratedError) return;
|
|
72594
|
+
const migrated = migratedNoticeOf(error62);
|
|
72595
|
+
if (migrated) return stopContext({ context, text: migrated.notice });
|
|
72173
72596
|
context.err(`laze: the Stop hook skipped: ${String(error62)}
|
|
72174
72597
|
`);
|
|
72175
72598
|
}
|
|
@@ -72916,6 +73339,336 @@ async function setAgentPool({
|
|
|
72916
73339
|
});
|
|
72917
73340
|
}
|
|
72918
73341
|
|
|
73342
|
+
// src/services/agent-migrate-commands.service.ts
|
|
73343
|
+
import { readdir as readdir6, readFile as readFile16, stat as stat5 } from "node:fs/promises";
|
|
73344
|
+
import { homedir as homedir4 } from "node:os";
|
|
73345
|
+
import { basename as basename4, join as join17 } from "node:path";
|
|
73346
|
+
|
|
73347
|
+
// src/rules/migration-upload.rules.ts
|
|
73348
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
73349
|
+
function markersIn(text2) {
|
|
73350
|
+
return text2.split(REDACTION_MARKER).length - 1;
|
|
73351
|
+
}
|
|
73352
|
+
async function redactTranscript({
|
|
73353
|
+
text: text2
|
|
73354
|
+
}) {
|
|
73355
|
+
let redactions = 0;
|
|
73356
|
+
const redacted = await mapJsonlStrings({
|
|
73357
|
+
text: text2,
|
|
73358
|
+
mapAll: async (strings) => strings.map((value) => {
|
|
73359
|
+
const next = redactDetectedSecrets({ text: value });
|
|
73360
|
+
redactions += Math.max(0, markersIn(next) - markersIn(value));
|
|
73361
|
+
return next;
|
|
73362
|
+
})
|
|
73363
|
+
});
|
|
73364
|
+
return { text: redacted.text, redactions };
|
|
73365
|
+
}
|
|
73366
|
+
function sha256Of({ text: text2 }) {
|
|
73367
|
+
return createHash2("sha256").update(text2, "utf8").digest("hex");
|
|
73368
|
+
}
|
|
73369
|
+
var bytesOf2 = (text2) => Buffer.byteLength(text2, "utf8");
|
|
73370
|
+
function piecesOf({ line, maxBytes }) {
|
|
73371
|
+
if (bytesOf2(line) <= maxBytes) return [line];
|
|
73372
|
+
const pieces = [];
|
|
73373
|
+
let current2 = "";
|
|
73374
|
+
let size = 0;
|
|
73375
|
+
for (const char of line) {
|
|
73376
|
+
const width = bytesOf2(char);
|
|
73377
|
+
if (size + width > maxBytes) {
|
|
73378
|
+
pieces.push(current2);
|
|
73379
|
+
current2 = "";
|
|
73380
|
+
size = 0;
|
|
73381
|
+
}
|
|
73382
|
+
current2 += char;
|
|
73383
|
+
size += width;
|
|
73384
|
+
}
|
|
73385
|
+
if (current2) pieces.push(current2);
|
|
73386
|
+
return pieces;
|
|
73387
|
+
}
|
|
73388
|
+
function packed({ lines: lines2, maxBytes }) {
|
|
73389
|
+
const parts = [];
|
|
73390
|
+
let current2 = "";
|
|
73391
|
+
let size = 0;
|
|
73392
|
+
for (const piece of lines2.flatMap((line) => piecesOf({ line, maxBytes }))) {
|
|
73393
|
+
const width = bytesOf2(piece);
|
|
73394
|
+
if (size + width > maxBytes && current2) {
|
|
73395
|
+
parts.push(current2);
|
|
73396
|
+
current2 = "";
|
|
73397
|
+
size = 0;
|
|
73398
|
+
}
|
|
73399
|
+
current2 += piece;
|
|
73400
|
+
size += width;
|
|
73401
|
+
}
|
|
73402
|
+
if (current2) parts.push(current2);
|
|
73403
|
+
return parts;
|
|
73404
|
+
}
|
|
73405
|
+
function transcriptPartsOf({
|
|
73406
|
+
text: text2,
|
|
73407
|
+
maxBytes,
|
|
73408
|
+
maxParts
|
|
73409
|
+
}) {
|
|
73410
|
+
const lines2 = text2.split(/(?<=\n)/);
|
|
73411
|
+
const whole = packed({ lines: lines2, maxBytes });
|
|
73412
|
+
if (whole.length <= maxParts) return { parts: whole, truncated: false };
|
|
73413
|
+
let low = 1;
|
|
73414
|
+
let high = lines2.length - 1;
|
|
73415
|
+
while (low < high) {
|
|
73416
|
+
const middle = Math.floor((low + high) / 2);
|
|
73417
|
+
if (packed({ lines: lines2.slice(middle), maxBytes }).length <= maxParts) high = middle;
|
|
73418
|
+
else low = middle + 1;
|
|
73419
|
+
}
|
|
73420
|
+
const kept = packed({ lines: lines2.slice(low), maxBytes });
|
|
73421
|
+
return { parts: kept.slice(-maxParts), truncated: true };
|
|
73422
|
+
}
|
|
73423
|
+
|
|
73424
|
+
// src/services/agent-migrate-commands.service.ts
|
|
73425
|
+
var MIGRATE_USAGE = `laze agent migrate <agent> [--to claude-code|codex|laze-models] [--level fast|frontier] [--resend]
|
|
73426
|
+
move your connected Claude Code or Codex agent into Laze, as the same agent: its own session
|
|
73427
|
+
uploads its conversation with secrets removed, then Laze runs it; --to picks where it runs
|
|
73428
|
+
(its own harness when left out), --level the Laze models level, --resend asks its session again
|
|
73429
|
+
laze agent migrate status <agent> [--json] the agent's latest migration
|
|
73430
|
+
laze agent migrate cancel <agent> cancel a migration still waiting for the agent's session
|
|
73431
|
+
laze agent migrate upload <migrationId> run inside the agent's own session: uploads its transcript
|
|
73432
|
+
`;
|
|
73433
|
+
var TARGETS = /* @__PURE__ */ new Set(["claude-code", "codex", "laze-models"]);
|
|
73434
|
+
var LEVELS3 = /* @__PURE__ */ new Set(["fast", "frontier"]);
|
|
73435
|
+
var HARNESS_NAMES3 = {
|
|
73436
|
+
"claude-code": "Claude Code",
|
|
73437
|
+
codex: "Codex",
|
|
73438
|
+
"laze-models": "Laze models"
|
|
73439
|
+
};
|
|
73440
|
+
var SESSION_ID = /^[A-Za-z0-9_-]{1,100}$/;
|
|
73441
|
+
var FILE_NAME2 = /^[A-Za-z0-9._-]{1,200}\.jsonl$/;
|
|
73442
|
+
var quoted = (value) => /^[\w.@:+-]+$/.test(value) ? value : `"${value.replaceAll('"', '\\"')}"`;
|
|
73443
|
+
function targetOf(migration) {
|
|
73444
|
+
const name3 = HARNESS_NAMES3[migration.target] ?? migration.target;
|
|
73445
|
+
return migration.modelLevel ? `${name3}, ${migration.modelLevel}` : name3;
|
|
73446
|
+
}
|
|
73447
|
+
function modeLine(migration) {
|
|
73448
|
+
return migration.mode === "resume" ? "Laze resumes that same session" : "Laze starts a fresh session from a summary of it";
|
|
73449
|
+
}
|
|
73450
|
+
function agentOf({ args, usage }) {
|
|
73451
|
+
const agent2 = args.words[3] ?? "";
|
|
73452
|
+
if (!agent2) throw new CliUsageError(usage);
|
|
73453
|
+
return agent2;
|
|
73454
|
+
}
|
|
73455
|
+
async function migrate({ context, args }) {
|
|
73456
|
+
const agent2 = args.words[2] ?? "";
|
|
73457
|
+
const harness = flagText({ args, name: "to" });
|
|
73458
|
+
const level = flagText({ args, name: "level" });
|
|
73459
|
+
const known = (!harness || TARGETS.has(harness)) && (!level || LEVELS3.has(level));
|
|
73460
|
+
if (!agent2 || !known) {
|
|
73461
|
+
throw new CliUsageError(`Usage: ${MIGRATE_USAGE}`);
|
|
73462
|
+
}
|
|
73463
|
+
const { client } = await signedIn({ context, args });
|
|
73464
|
+
const migration = await client.post("/api/agents/migrate", {
|
|
73465
|
+
agent: agent2,
|
|
73466
|
+
...harness ? { harness } : {},
|
|
73467
|
+
...level ? { modelLevel: level } : {},
|
|
73468
|
+
resend: Boolean(args.flags.resend)
|
|
73469
|
+
});
|
|
73470
|
+
if (args.flags.json) return context.out(`${JSON.stringify(migration, null, 2)}
|
|
73471
|
+
`);
|
|
73472
|
+
const name3 = migration.agentName;
|
|
73473
|
+
context.out(
|
|
73474
|
+
[
|
|
73475
|
+
`Asked ${name3} to move into Laze, to run on ${targetOf(migration)}.`,
|
|
73476
|
+
`${name3}'s session uploads its conversation, secrets removed, when it reads the request in its direct messages; ${modeLine(migration)}.`,
|
|
73477
|
+
...migration.machineLastSeenAt ? [] : [`${name3}'s machine has not called Laze yet: the request waits until it is on.`],
|
|
73478
|
+
`Cancel it: laze agent migrate cancel ${quoted(name3)}`,
|
|
73479
|
+
`Check on it: laze agent migrate status ${quoted(name3)}`,
|
|
73480
|
+
""
|
|
73481
|
+
].join("\n")
|
|
73482
|
+
);
|
|
73483
|
+
}
|
|
73484
|
+
function statusLines(migration) {
|
|
73485
|
+
const removed = migration.removed;
|
|
73486
|
+
return [
|
|
73487
|
+
`${migration.agentName}: ${migration.status}`,
|
|
73488
|
+
`From ${HARNESS_NAMES3[migration.source] ?? migration.source} to ${targetOf(migration)}`,
|
|
73489
|
+
`Session: ${migration.mode === "resume" ? "resumed" : "started fresh from a summary"}`,
|
|
73490
|
+
`Asked: ${migration.requestedAt}`,
|
|
73491
|
+
...migration.completedAt ? [`Done: ${migration.completedAt}`] : [],
|
|
73492
|
+
...removed ? [
|
|
73493
|
+
`Secrets removed: ${removed.local} on the machine, ${removed.vault} vault values, ${removed.patterns} key-shaped texts`
|
|
73494
|
+
] : [],
|
|
73495
|
+
`Machine last seen: ${migration.machineLastSeenAt ?? "never"}`
|
|
73496
|
+
];
|
|
73497
|
+
}
|
|
73498
|
+
async function migrationStatus({ context, args }) {
|
|
73499
|
+
const agent2 = agentOf({ context, args, usage: "Usage: laze agent migrate status <agent>" });
|
|
73500
|
+
const { client } = await signedIn({ context, args });
|
|
73501
|
+
const { migration } = await client.get(
|
|
73502
|
+
`/api/agents/migration?agent=${encodeURIComponent(agent2)}`
|
|
73503
|
+
);
|
|
73504
|
+
if (args.flags.json) return context.out(`${JSON.stringify(migration, null, 2)}
|
|
73505
|
+
`);
|
|
73506
|
+
if (!migration) return context.out(`${agent2} has no migration.
|
|
73507
|
+
`);
|
|
73508
|
+
context.out(`${statusLines(migration).join("\n")}
|
|
73509
|
+
`);
|
|
73510
|
+
}
|
|
73511
|
+
async function cancelMigration({ context, args }) {
|
|
73512
|
+
const agent2 = agentOf({ context, args, usage: "Usage: laze agent migrate cancel <agent>" });
|
|
73513
|
+
const { client } = await signedIn({ context, args });
|
|
73514
|
+
const migration = await client.post("/api/agents/migrate/cancel", { agent: agent2 });
|
|
73515
|
+
if (args.flags.json) return context.out(`${JSON.stringify(migration, null, 2)}
|
|
73516
|
+
`);
|
|
73517
|
+
context.out(`Cancelled ${migration.agentName}'s migration; it stays connected on its machine.
|
|
73518
|
+
`);
|
|
73519
|
+
}
|
|
73520
|
+
async function claudeTranscriptOf({
|
|
73521
|
+
context,
|
|
73522
|
+
sessionId
|
|
73523
|
+
}) {
|
|
73524
|
+
const inherited = context.environment.inherited;
|
|
73525
|
+
const root = join17(
|
|
73526
|
+
inherited.CLAUDE_CONFIG_DIR || join17(inherited.HOME || homedir4(), ".claude"),
|
|
73527
|
+
"projects"
|
|
73528
|
+
);
|
|
73529
|
+
const folders = await readdir6(root).catch(() => []);
|
|
73530
|
+
const found = await Promise.all(
|
|
73531
|
+
folders.map(async (folder) => {
|
|
73532
|
+
const path = join17(root, folder, `${sessionId}.jsonl`);
|
|
73533
|
+
return stat5(path).then(
|
|
73534
|
+
(info) => info.isFile() ? [{ path, at: info.mtimeMs }] : [],
|
|
73535
|
+
() => []
|
|
73536
|
+
);
|
|
73537
|
+
})
|
|
73538
|
+
);
|
|
73539
|
+
return { root, path: found.flat().toSorted((a, b) => b.at - a.at)[0]?.path };
|
|
73540
|
+
}
|
|
73541
|
+
async function transcriptOf({ context, ticket }) {
|
|
73542
|
+
const inherited = context.environment.inherited;
|
|
73543
|
+
const own2 = ticket.source === "codex" ? inherited.CODEX_THREAD_ID : inherited.CLAUDE_CODE_SESSION_ID;
|
|
73544
|
+
const sessionId = own2 || ticket.sessionId || "";
|
|
73545
|
+
if (!SESSION_ID.test(sessionId)) {
|
|
73546
|
+
throw new CliUsageError(
|
|
73547
|
+
`No ${HARNESS_NAMES3[ticket.source]} session id here: run this inside the agent's own session. Nothing was uploaded.`
|
|
73548
|
+
);
|
|
73549
|
+
}
|
|
73550
|
+
if (ticket.source === "codex") {
|
|
73551
|
+
const codexHome = context.environment.codexHome;
|
|
73552
|
+
const path2 = await codexRolloutPathOf({ codexHome, threadId: sessionId });
|
|
73553
|
+
return { sessionId, path: path2, where: join17(codexHome, "sessions") };
|
|
73554
|
+
}
|
|
73555
|
+
const { root, path } = await claudeTranscriptOf({ context, sessionId });
|
|
73556
|
+
return { sessionId, path, where: root };
|
|
73557
|
+
}
|
|
73558
|
+
async function agentHere({ context, args }) {
|
|
73559
|
+
const session = await currentSessionOf({ context, args });
|
|
73560
|
+
const named = await sessionProfileArgs({ context, args, session, binds: false });
|
|
73561
|
+
const signed2 = await signedIn({ context, args: named });
|
|
73562
|
+
if (signed2.profile.kind !== "agent") {
|
|
73563
|
+
throw new CliUsageError(
|
|
73564
|
+
"laze agent migrate upload runs inside the agent's own session, with the agent's key."
|
|
73565
|
+
);
|
|
73566
|
+
}
|
|
73567
|
+
return signed2;
|
|
73568
|
+
}
|
|
73569
|
+
async function uploadParts({
|
|
73570
|
+
client,
|
|
73571
|
+
migrationId,
|
|
73572
|
+
upload
|
|
73573
|
+
}) {
|
|
73574
|
+
const again = migrationUploadCommandOf({ migrationId: decodeURIComponent(migrationId) });
|
|
73575
|
+
for (const [index, text2] of upload.parts.entries()) {
|
|
73576
|
+
try {
|
|
73577
|
+
await client.put(`/api/agents/me/migrations/${migrationId}/parts/${index}`, { text: text2 });
|
|
73578
|
+
} catch (error62) {
|
|
73579
|
+
if (migratedNoticeOf(error62)) throw error62;
|
|
73580
|
+
const why = error62 instanceof Error ? error62.message : String(error62);
|
|
73581
|
+
throw new CliUsageError(
|
|
73582
|
+
`Part ${index + 1} of ${upload.parts.length} did not upload (${why}). Nothing moved yet: run \`${again}\` again.`
|
|
73583
|
+
);
|
|
73584
|
+
}
|
|
73585
|
+
}
|
|
73586
|
+
}
|
|
73587
|
+
async function uploadTranscript({ context, args, client }) {
|
|
73588
|
+
const migrationId = agentOf({
|
|
73589
|
+
context,
|
|
73590
|
+
args,
|
|
73591
|
+
usage: "Usage: laze agent migrate upload <migrationId>"
|
|
73592
|
+
});
|
|
73593
|
+
const id2 = encodeURIComponent(migrationId);
|
|
73594
|
+
const ticket = await client.get(`/api/agents/me/migrations/${id2}`);
|
|
73595
|
+
if (ticket.status === "cancelled") {
|
|
73596
|
+
throw new CliUsageError("This migration was cancelled; nothing was uploaded.");
|
|
73597
|
+
}
|
|
73598
|
+
const found = await transcriptOf({ context, ticket });
|
|
73599
|
+
if (!found.path) {
|
|
73600
|
+
throw new CliUsageError(
|
|
73601
|
+
`The transcript of session ${found.sessionId} was not found under ${found.where}; nothing was uploaded.`
|
|
73602
|
+
);
|
|
73603
|
+
}
|
|
73604
|
+
const raw = await readFile16(found.path, "utf8");
|
|
73605
|
+
if (!raw.trim()) throw new CliUsageError(`${found.path} is empty; nothing was uploaded.`);
|
|
73606
|
+
const redacted = await redactTranscript({ text: raw });
|
|
73607
|
+
const { parts, truncated } = transcriptPartsOf({
|
|
73608
|
+
text: redacted.text,
|
|
73609
|
+
maxBytes: Math.min(ticket.partMaxBytes, MIGRATION_PART_MAX_BYTES),
|
|
73610
|
+
maxParts: Math.min(ticket.partsMax, MIGRATION_PARTS_MAX)
|
|
73611
|
+
});
|
|
73612
|
+
const upload = { parts, truncated, redactions: redacted.redactions };
|
|
73613
|
+
await uploadParts({ client, migrationId: id2, upload });
|
|
73614
|
+
const fileName = basename4(found.path);
|
|
73615
|
+
const completed = await client.post(
|
|
73616
|
+
`/api/agents/me/migrations/${id2}/complete`,
|
|
73617
|
+
{
|
|
73618
|
+
parts: parts.length,
|
|
73619
|
+
sha256: sha256Of({ text: parts.join("") }),
|
|
73620
|
+
truncated,
|
|
73621
|
+
sessionId: found.sessionId,
|
|
73622
|
+
...FILE_NAME2.test(fileName) ? { fileName } : {},
|
|
73623
|
+
localRedactions: redacted.redactions
|
|
73624
|
+
}
|
|
73625
|
+
);
|
|
73626
|
+
if (args.flags.json) context.out(`${JSON.stringify(completed, null, 2)}
|
|
73627
|
+
`);
|
|
73628
|
+
return {
|
|
73629
|
+
link: completed.link,
|
|
73630
|
+
agentName: completed.migration.agentName,
|
|
73631
|
+
sent: `Uploaded ${fileName} in ${parts.length} part${parts.length === 1 ? "" : "s"}${truncated ? ", only its newest lines (it was over the cap)" : ""}; ${redacted.redactions} secret${redacted.redactions === 1 ? "" : "s"} removed on this machine.`
|
|
73632
|
+
};
|
|
73633
|
+
}
|
|
73634
|
+
function linkIn(text2) {
|
|
73635
|
+
return /https?:\/\/[^\s)]+[^\s).,]/.exec(text2)?.[0] ?? null;
|
|
73636
|
+
}
|
|
73637
|
+
async function uploadMigration({ context, args }) {
|
|
73638
|
+
const { client, name: name3, profile } = await agentHere({ context, args });
|
|
73639
|
+
const moved = await uploadTranscript({ context, args, client }).catch((error62) => {
|
|
73640
|
+
const migrated = migratedNoticeOf(error62);
|
|
73641
|
+
if (!migrated) throw error62;
|
|
73642
|
+
const link = migrated.link ?? linkIn(migrated.notice);
|
|
73643
|
+
return { link: link ?? "", agentName: profile.name, sent: void 0 };
|
|
73644
|
+
});
|
|
73645
|
+
const notice = moved.link ? `Moved to Laze: ${moved.link}` : "Moved to Laze.";
|
|
73646
|
+
await context.store.markMigrated({
|
|
73647
|
+
name: name3,
|
|
73648
|
+
migrated: { at: context.nowMs(), link: moved.link || null, notice }
|
|
73649
|
+
});
|
|
73650
|
+
if (args.flags.json) return;
|
|
73651
|
+
context.out(
|
|
73652
|
+
[
|
|
73653
|
+
notice,
|
|
73654
|
+
...moved.sent ? [moved.sent] : [],
|
|
73655
|
+
`Laze runs ${moved.agentName} from now on. Stop working in this session now: tell your person the agent continues in Laze at the link above, and answer nothing more here.`,
|
|
73656
|
+
""
|
|
73657
|
+
].join("\n")
|
|
73658
|
+
);
|
|
73659
|
+
}
|
|
73660
|
+
var SUBCOMMANDS = {
|
|
73661
|
+
status: migrationStatus,
|
|
73662
|
+
cancel: cancelMigration,
|
|
73663
|
+
upload: uploadMigration
|
|
73664
|
+
};
|
|
73665
|
+
async function agentMigrate({ context, args }) {
|
|
73666
|
+
const sub = SUBCOMMANDS[args.words[2] ?? ""];
|
|
73667
|
+
if (sub && args.words[3]) return sub({ context, args });
|
|
73668
|
+
if (sub || !args.words[2]) throw new CliUsageError(`Usage: ${MIGRATE_USAGE}`);
|
|
73669
|
+
return migrate({ context, args });
|
|
73670
|
+
}
|
|
73671
|
+
|
|
72919
73672
|
// src/services/agent-session-commands.service.ts
|
|
72920
73673
|
var NO_SESSION = "Run this inside the Claude Code or Codex session the agent should listen in, or pass --session <id>.";
|
|
72921
73674
|
var NO_AGENT = "This session and its folder have no agent: name one with `laze agent bind --profile <name>`.";
|
|
@@ -73070,8 +73823,8 @@ async function requestAgent({ context, args }) {
|
|
|
73070
73823
|
}
|
|
73071
73824
|
|
|
73072
73825
|
// src/services/app-commands.service.ts
|
|
73073
|
-
import { mkdir as mkdir16, readdir as
|
|
73074
|
-
import { dirname as dirname16, join as
|
|
73826
|
+
import { mkdir as mkdir16, readdir as readdir7, readFile as readFile18, writeFile as writeFile16 } from "node:fs/promises";
|
|
73827
|
+
import { dirname as dirname16, join as join20, relative as relative3, resolve as resolve6, sep as sep3 } from "node:path";
|
|
73075
73828
|
|
|
73076
73829
|
// ../../modules/app/contract/src/app.connections.ts
|
|
73077
73830
|
var appFunctionNameSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/);
|
|
@@ -73232,6 +73985,8 @@ var appSchemaDefinition = external_exports.object({
|
|
|
73232
73985
|
archivedAt: external_exports.iso.datetime().nullable().optional(),
|
|
73233
73986
|
/** The reader's role in the app; absent where the app is read without a reader. */
|
|
73234
73987
|
role: appRoleSchema.nullable().optional(),
|
|
73988
|
+
/** The agent that built it, a Builder by standing; null or absent when a person did. */
|
|
73989
|
+
creatorAgentId: external_exports.string().nullable().optional(),
|
|
73235
73990
|
createdAt: external_exports.iso.datetime(),
|
|
73236
73991
|
updatedAt: external_exports.iso.datetime()
|
|
73237
73992
|
});
|
|
@@ -73329,7 +74084,9 @@ var createAppInputSchemaDefinition = external_exports.object({
|
|
|
73329
74084
|
slug: appSlugSchema.optional(),
|
|
73330
74085
|
channelId: external_exports.string().min(1).optional(),
|
|
73331
74086
|
/** Restricted unless chosen: owner, admins, shares and the conversations it is pinned to. */
|
|
73332
|
-
visibility: appVisibilitySchema.default("restricted")
|
|
74087
|
+
visibility: appVisibilitySchema.default("restricted"),
|
|
74088
|
+
/** The agent a person hands the new app to, which becomes its creator and a Builder. */
|
|
74089
|
+
creatorAgentId: external_exports.string().min(1).optional()
|
|
73333
74090
|
});
|
|
73334
74091
|
var createAppInputSchema = createAppInputSchemaDefinition;
|
|
73335
74092
|
var listAppsInputSchemaDefinition = external_exports.object({
|
|
@@ -73744,15 +74501,18 @@ var appAccessRequestSchemaDefinition = external_exports.object({
|
|
|
73744
74501
|
role: appRoleSchema.nullable(),
|
|
73745
74502
|
decidedBy: appActorSchema.nullable(),
|
|
73746
74503
|
createdAt: external_exports.iso.datetime(),
|
|
73747
|
-
decidedAt: external_exports.iso.datetime().nullable()
|
|
74504
|
+
decidedAt: external_exports.iso.datetime().nullable(),
|
|
74505
|
+
/** `agent` for an agent's request, whose `userId` and `userName` are then the agent's. */
|
|
74506
|
+
subjectType: external_exports.enum(["user", "agent"]).optional()
|
|
73748
74507
|
});
|
|
73749
74508
|
var appAccessRequestSchema = appAccessRequestSchemaDefinition;
|
|
73750
74509
|
var appMemberSourceSchemaDefinition = external_exports.object({
|
|
73751
|
-
|
|
74510
|
+
/** `agent-owner` is no longer sent; older clients still read it. */
|
|
74511
|
+
kind: external_exports.enum(["owner", "creator", "admin", "direct", "channel", "workspace", "agent-owner"]),
|
|
73752
74512
|
/** The channel, for `channel`: a pin there, a share with it, or the app's own channel. */
|
|
73753
74513
|
channelId: external_exports.string().nullable(),
|
|
73754
74514
|
channelName: external_exports.string().nullable(),
|
|
73755
|
-
/**
|
|
74515
|
+
/** Unused since agents stopped holding apps through their owner; always null. */
|
|
73756
74516
|
ownerName: external_exports.string().nullable()
|
|
73757
74517
|
});
|
|
73758
74518
|
var appMemberSchemaDefinition = external_exports.object({
|
|
@@ -73776,6 +74536,31 @@ var appAccessPinSchemaDefinition = external_exports.object({
|
|
|
73776
74536
|
name: external_exports.string().nullable(),
|
|
73777
74537
|
role: appRoleSchema
|
|
73778
74538
|
});
|
|
74539
|
+
var appAgentAccessPathSchemaDefinition = external_exports.object({
|
|
74540
|
+
kind: external_exports.enum(["channel", "direct"]),
|
|
74541
|
+
/** The channel, for `channel`. */
|
|
74542
|
+
channelId: external_exports.string().nullable(),
|
|
74543
|
+
channelName: external_exports.string().nullable(),
|
|
74544
|
+
/** The highest role approving gives: the owner's own, or the channel's. */
|
|
74545
|
+
maxRole: appRoleSchema
|
|
74546
|
+
});
|
|
74547
|
+
var appAgentAccessRequestSchemaDefinition = external_exports.object({
|
|
74548
|
+
id: external_exports.string().min(1),
|
|
74549
|
+
appId: external_exports.string().min(1),
|
|
74550
|
+
appName: external_exports.string(),
|
|
74551
|
+
agentId: external_exports.string().min(1),
|
|
74552
|
+
agentName: external_exports.string().nullable(),
|
|
74553
|
+
/** The agent's owner, who answers it. */
|
|
74554
|
+
approverUserId: external_exports.string().min(1),
|
|
74555
|
+
approverName: external_exports.string().nullable(),
|
|
74556
|
+
status: external_exports.enum(["pending", "granted", "declined"]),
|
|
74557
|
+
/** The role approving gave; null while pending or when declined. */
|
|
74558
|
+
role: appRoleSchema.nullable(),
|
|
74559
|
+
/** While pending, how approving would add the agent; once granted, how it did. */
|
|
74560
|
+
path: appAgentAccessPathSchemaDefinition.nullable(),
|
|
74561
|
+
createdAt: external_exports.iso.datetime(),
|
|
74562
|
+
decidedAt: external_exports.iso.datetime().nullable()
|
|
74563
|
+
});
|
|
73779
74564
|
var appAccessSchemaDefinition = external_exports.object({
|
|
73780
74565
|
appId: external_exports.string().min(1),
|
|
73781
74566
|
visibility: appVisibilitySchema,
|
|
@@ -73788,6 +74573,8 @@ var appAccessSchemaDefinition = external_exports.object({
|
|
|
73788
74573
|
pins: external_exports.array(appAccessPinSchemaDefinition).default([]),
|
|
73789
74574
|
/** Pending requests, to the app's Builders; empty for anyone else. */
|
|
73790
74575
|
requests: external_exports.array(appAccessRequestSchemaDefinition),
|
|
74576
|
+
/** Pending requests of the reader's own agents; empty for anyone else. */
|
|
74577
|
+
agentRequests: external_exports.array(appAgentAccessRequestSchemaDefinition).default([]),
|
|
73791
74578
|
/** The reader's own role. */
|
|
73792
74579
|
role: appRoleSchema,
|
|
73793
74580
|
/** The workspace's name, for "Everyone in <workspace>". */
|
|
@@ -73847,8 +74634,14 @@ var pendingAppAccessSchemaDefinition = external_exports.object({
|
|
|
73847
74634
|
appName: external_exports.string(),
|
|
73848
74635
|
/** The role a grant from the feed card gives. */
|
|
73849
74636
|
memberRole: appRoleSchema,
|
|
73850
|
-
/** The Builders who answer it. */
|
|
73851
|
-
builderUserIds: external_exports.array(external_exports.string())
|
|
74637
|
+
/** The Builders who answer it; for an agent's request, the agent's owner only. */
|
|
74638
|
+
builderUserIds: external_exports.array(external_exports.string()),
|
|
74639
|
+
/** Set for an agent's request: whose it is and how approving adds it. */
|
|
74640
|
+
agent: external_exports.object({
|
|
74641
|
+
id: external_exports.string().min(1),
|
|
74642
|
+
name: external_exports.string().nullable(),
|
|
74643
|
+
path: appAgentAccessPathSchemaDefinition.nullable()
|
|
74644
|
+
}).nullable().optional()
|
|
73852
74645
|
});
|
|
73853
74646
|
var visibilityOutcomeSchemaDefinition = external_exports.object({
|
|
73854
74647
|
app: appSchema,
|
|
@@ -74539,7 +75332,7 @@ var appCliCommands = [
|
|
|
74539
75332
|
command: "laze app members",
|
|
74540
75333
|
operation: "listMembers",
|
|
74541
75334
|
arguments: ["[app]"],
|
|
74542
|
-
summary: "Everyone who can open the app, people and agents, each with how: Owner, Shared directly, via #channel or the workspace"
|
|
75335
|
+
summary: "Everyone who can open the app, people and agents, each with how: Owner, Creator, Shared directly, via #channel or the workspace"
|
|
74543
75336
|
},
|
|
74544
75337
|
{
|
|
74545
75338
|
command: "laze app access",
|
|
@@ -74575,13 +75368,19 @@ var appCliCommands = [
|
|
|
74575
75368
|
command: "laze app access pin-role",
|
|
74576
75369
|
operation: "setPinRole",
|
|
74577
75370
|
arguments: ["<channel-id>", "viewer|editor|builder"],
|
|
74578
|
-
summary: "The role a conversation the app is pinned in gives its members and
|
|
75371
|
+
summary: "The role a conversation the app is pinned in gives its members, people and agents (default builder)"
|
|
74579
75372
|
},
|
|
74580
75373
|
{
|
|
74581
75374
|
command: "laze app access approve",
|
|
74582
75375
|
operation: "decideAccessRequest",
|
|
74583
75376
|
arguments: ["<request-id>", "[viewer|editor|builder]"],
|
|
74584
|
-
summary: "Let in someone who asked for access (laze app access decline <request-id> refuses)"
|
|
75377
|
+
summary: "Let in someone who asked for access, or your own agent (laze app access decline <request-id> refuses)"
|
|
75378
|
+
},
|
|
75379
|
+
{
|
|
75380
|
+
command: "laze app request",
|
|
75381
|
+
operation: "requestAgentAccess",
|
|
75382
|
+
arguments: ["[app]"],
|
|
75383
|
+
summary: "As an agent that cannot open the app, ask your owner for access; they approve it in Laze"
|
|
74585
75384
|
},
|
|
74586
75385
|
{
|
|
74587
75386
|
command: "laze app cost",
|
|
@@ -75738,7 +76537,7 @@ async function appPinsCommand({
|
|
|
75738
76537
|
import { execFile } from "node:child_process";
|
|
75739
76538
|
import { mkdtemp, rm as rm8, writeFile as writeFile15 } from "node:fs/promises";
|
|
75740
76539
|
import { tmpdir } from "node:os";
|
|
75741
|
-
import { join as
|
|
76540
|
+
import { join as join18 } from "node:path";
|
|
75742
76541
|
import { promisify } from "node:util";
|
|
75743
76542
|
var run2 = promisify(execFile);
|
|
75744
76543
|
var MODULE_SYNTAX = /^\s*(import|export)\s/m;
|
|
@@ -75767,11 +76566,11 @@ async function scriptErrorsOf({
|
|
|
75767
76566
|
const unknown2 = unknownCollectionsOf({ files: files2, collections });
|
|
75768
76567
|
const scripts = files2.flatMap(scriptsOf);
|
|
75769
76568
|
if (scripts.length === 0) return unknown2;
|
|
75770
|
-
const dir = await mkdtemp(
|
|
76569
|
+
const dir = await mkdtemp(join18(tmpdir(), "laze-app-check-"));
|
|
75771
76570
|
try {
|
|
75772
76571
|
const errors = await Promise.all(
|
|
75773
76572
|
scripts.map(async (script, index) => {
|
|
75774
|
-
const file3 =
|
|
76573
|
+
const file3 = join18(dir, `${index}.${script.module ? "mjs" : "cjs"}`);
|
|
75775
76574
|
await writeFile15(file3, script.code);
|
|
75776
76575
|
try {
|
|
75777
76576
|
await run2(process.execPath, ["--check", file3]);
|
|
@@ -75789,9 +76588,9 @@ async function scriptErrorsOf({
|
|
|
75789
76588
|
}
|
|
75790
76589
|
|
|
75791
76590
|
// src/services/app-serve.service.ts
|
|
75792
|
-
import { readFile as
|
|
76591
|
+
import { readFile as readFile17, stat as stat6 } from "node:fs/promises";
|
|
75793
76592
|
import { createServer } from "node:http";
|
|
75794
|
-
import { extname as extname2, join as
|
|
76593
|
+
import { extname as extname2, join as join19, normalize, sep as sep2 } from "node:path";
|
|
75795
76594
|
var TYPES = {
|
|
75796
76595
|
".html": "text/html; charset=utf-8",
|
|
75797
76596
|
".js": "text/javascript; charset=utf-8",
|
|
@@ -75842,13 +76641,13 @@ async function staticFile({
|
|
|
75842
76641
|
if (clean.startsWith("..") || hidden) {
|
|
75843
76642
|
return json2({ response, status: 404, value: { code: "not_found", message: "Not found" } });
|
|
75844
76643
|
}
|
|
75845
|
-
const candidates = [
|
|
75846
|
-
if (!extname2(clean)) candidates.push(
|
|
76644
|
+
const candidates = [join19(folder, clean), join19(folder, clean, "index.html")];
|
|
76645
|
+
if (!extname2(clean)) candidates.push(join19(folder, "index.html"));
|
|
75847
76646
|
for (const target of candidates) {
|
|
75848
|
-
const info = await
|
|
76647
|
+
const info = await stat6(target).catch(() => void 0);
|
|
75849
76648
|
if (!info?.isFile()) continue;
|
|
75850
76649
|
const type = TYPES[extname2(target).toLowerCase()] ?? "application/octet-stream";
|
|
75851
|
-
const body = await
|
|
76650
|
+
const body = await readFile17(target);
|
|
75852
76651
|
if (extname2(target) === ".html") {
|
|
75853
76652
|
return send2({ response, status: 200, type, body: withServeThemeScript(body.toString()) });
|
|
75854
76653
|
}
|
|
@@ -76081,7 +76880,7 @@ async function turnTokenOf({
|
|
|
76081
76880
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
76082
76881
|
if (pinned) return pinned;
|
|
76083
76882
|
if (env.LAZE_TURN_FILE) {
|
|
76084
|
-
return
|
|
76883
|
+
return readFile18(env.LAZE_TURN_FILE, "utf8").then(
|
|
76085
76884
|
(text2) => text2.trim(),
|
|
76086
76885
|
() => ""
|
|
76087
76886
|
);
|
|
@@ -76111,7 +76910,7 @@ function folderOf({ context, word: word3 }) {
|
|
|
76111
76910
|
return resolve6(context.cwd, word3 ?? ".");
|
|
76112
76911
|
}
|
|
76113
76912
|
async function readManifest(folder) {
|
|
76114
|
-
const text2 = await
|
|
76913
|
+
const text2 = await readFile18(join20(folder, APP_MANIFEST_FILE), "utf8").catch(() => void 0);
|
|
76115
76914
|
if (text2 === void 0) return void 0;
|
|
76116
76915
|
const parsed = appManifestSchema.safeParse(JSON.parse(text2));
|
|
76117
76916
|
if (!parsed.success) {
|
|
@@ -76146,7 +76945,7 @@ async function jsonFlag({
|
|
|
76146
76945
|
}) {
|
|
76147
76946
|
const raw = flagText({ args, name: name3 });
|
|
76148
76947
|
if (!raw) return void 0;
|
|
76149
|
-
const text2 = raw.startsWith("@") ? await
|
|
76948
|
+
const text2 = raw.startsWith("@") ? await readFile18(resolve6(context.cwd, raw.slice(1)), "utf8") : raw;
|
|
76150
76949
|
try {
|
|
76151
76950
|
return JSON.parse(text2);
|
|
76152
76951
|
} catch {
|
|
@@ -76158,8 +76957,8 @@ async function listFiles(folder) {
|
|
|
76158
76957
|
const pending2 = [folder];
|
|
76159
76958
|
while (pending2.length > 0 && found.length <= MAX_FILES) {
|
|
76160
76959
|
const current2 = pending2.pop() ?? folder;
|
|
76161
|
-
for (const entry of await
|
|
76162
|
-
const path =
|
|
76960
|
+
for (const entry of await readdir7(current2, { withFileTypes: true })) {
|
|
76961
|
+
const path = join20(current2, entry.name);
|
|
76163
76962
|
const rel = relative3(folder, path).split(sep3).join("/");
|
|
76164
76963
|
if (isSkippedPath({ path: rel })) continue;
|
|
76165
76964
|
if (entry.isDirectory()) pending2.push(path);
|
|
@@ -76203,8 +77002,8 @@ var appCreate = async ({ context, args }) => {
|
|
|
76203
77002
|
await mkdir16(folder, { recursive: true });
|
|
76204
77003
|
const files2 = template ? templateFiles({ template, name: name3 }) : {};
|
|
76205
77004
|
for (const [path, content] of Object.entries(files2)) {
|
|
76206
|
-
await mkdir16(dirname16(
|
|
76207
|
-
await writeFile16(
|
|
77005
|
+
await mkdir16(dirname16(join20(folder, path)), { recursive: true });
|
|
77006
|
+
await writeFile16(join20(folder, path), content);
|
|
76208
77007
|
}
|
|
76209
77008
|
const manifest = {
|
|
76210
77009
|
app: { id: app2.id, name: app2.name, slug: app2.slug },
|
|
@@ -76212,7 +77011,7 @@ var appCreate = async ({ context, args }) => {
|
|
|
76212
77011
|
views: template?.views ? [...template.views] : [],
|
|
76213
77012
|
seed: template ? { ...template.seed } : {}
|
|
76214
77013
|
};
|
|
76215
|
-
await writeFile16(
|
|
77014
|
+
await writeFile16(join20(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
|
|
76216
77015
|
`);
|
|
76217
77016
|
print5({
|
|
76218
77017
|
context,
|
|
@@ -76227,6 +77026,11 @@ var appList = async ({ context, args }) => {
|
|
|
76227
77026
|
const client = await appClient({ context, args });
|
|
76228
77027
|
const apps = await client.get("/api/apps");
|
|
76229
77028
|
const lines2 = apps.map((app2) => {
|
|
77029
|
+
if (app2.role === null) {
|
|
77030
|
+
const owner = app2.ownerName ? `, ${app2.ownerName}'s` : "";
|
|
77031
|
+
return `${app2.slug} ${app2.id} no access${owner}: laze app request ${app2.slug} asks your owner
|
|
77032
|
+
`;
|
|
77033
|
+
}
|
|
76230
77034
|
const state = app2.publishedVersion ? `live (${app2.visibility})` : "not live";
|
|
76231
77035
|
return `${app2.slug} ${app2.id} ${state} ${app2.publishedUrl}
|
|
76232
77036
|
`;
|
|
@@ -76249,7 +77053,7 @@ var appPush = async ({ context, args }) => {
|
|
|
76249
77053
|
paths.map(
|
|
76250
77054
|
async (path) => buildFileOf({
|
|
76251
77055
|
path: relative3(folder, path).split(sep3).join("/"),
|
|
76252
|
-
bytes: await
|
|
77056
|
+
bytes: await readFile18(path)
|
|
76253
77057
|
})
|
|
76254
77058
|
)
|
|
76255
77059
|
);
|
|
@@ -76369,7 +77173,7 @@ async function folderClaim({
|
|
|
76369
77173
|
folder,
|
|
76370
77174
|
appId
|
|
76371
77175
|
}) {
|
|
76372
|
-
const entries = await
|
|
77176
|
+
const entries = await readdir7(folder).catch(() => []);
|
|
76373
77177
|
if (entries.length === 0) return "empty";
|
|
76374
77178
|
const manifest = await readManifest(folder).catch(() => void 0);
|
|
76375
77179
|
if (!manifest) return "other-files";
|
|
@@ -76407,7 +77211,7 @@ var appPull = async ({ context, args }) => {
|
|
|
76407
77211
|
);
|
|
76408
77212
|
}
|
|
76409
77213
|
for (const file3 of pulled.files) {
|
|
76410
|
-
const target =
|
|
77214
|
+
const target = join20(folder, ...file3.path.split("/"));
|
|
76411
77215
|
await mkdir16(dirname16(target), { recursive: true });
|
|
76412
77216
|
await writeFile16(
|
|
76413
77217
|
target,
|
|
@@ -76426,7 +77230,7 @@ var appPull = async ({ context, args }) => {
|
|
|
76426
77230
|
])
|
|
76427
77231
|
)
|
|
76428
77232
|
};
|
|
76429
|
-
await writeFile16(
|
|
77233
|
+
await writeFile16(join20(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
|
|
76430
77234
|
`);
|
|
76431
77235
|
const names = pulled.collections.map((collection) => collection.name);
|
|
76432
77236
|
const where = relative3(context.cwd, folder) || ".";
|
|
@@ -76730,7 +77534,7 @@ var appImport = async ({ context, args }) => {
|
|
|
76730
77534
|
const words = args.words.slice(2);
|
|
76731
77535
|
const [named, collection, file3] = words.length >= 3 ? words : [void 0, ...words];
|
|
76732
77536
|
if (!collection || !file3) throw new CliUsageError(USAGE5);
|
|
76733
|
-
const csv = await
|
|
77537
|
+
const csv = await readFile18(resolve6(context.cwd, file3), "utf8").catch(() => {
|
|
76734
77538
|
throw new CliUsageError(`Cannot read ${file3}`);
|
|
76735
77539
|
});
|
|
76736
77540
|
const scoped = named ? { ...args, flags: { ...args.flags, app: named } } : args;
|
|
@@ -76809,6 +77613,13 @@ function subjectOf(word3) {
|
|
|
76809
77613
|
}
|
|
76810
77614
|
return { type, id: id2 };
|
|
76811
77615
|
}
|
|
77616
|
+
function agentPathText(path) {
|
|
77617
|
+
if (!path) return "you cannot open the app yourself, so you cannot let it in";
|
|
77618
|
+
if (path.kind === "channel") {
|
|
77619
|
+
return `approving adds it to ${path.channelName ?? path.channelId ?? "your channel"} as ${ROLE_NAMES[path.maxRole]}`;
|
|
77620
|
+
}
|
|
77621
|
+
return `approving shares the app with it as ${ROLE_NAMES[path.maxRole]} at most`;
|
|
77622
|
+
}
|
|
76812
77623
|
function accessText(access) {
|
|
76813
77624
|
const lines2 = [
|
|
76814
77625
|
`Visibility: ${access.visibility}. Everyone it admits is ${ROLE_NAMES[access.memberRole]}.`,
|
|
@@ -76821,6 +77632,9 @@ function accessText(access) {
|
|
|
76821
77632
|
),
|
|
76822
77633
|
...access.requests.map(
|
|
76823
77634
|
(request2) => ` asks for access: ${request2.userName ?? request2.userId} (${request2.id})`
|
|
77635
|
+
),
|
|
77636
|
+
...(access.agentRequests ?? []).map(
|
|
77637
|
+
(request2) => ` your agent ${request2.agentName ?? request2.agentId} asks for access (${request2.id}): ${agentPathText(request2.path)}`
|
|
76824
77638
|
)
|
|
76825
77639
|
];
|
|
76826
77640
|
return `${lines2.join("\n")}
|
|
@@ -76910,6 +77724,8 @@ function sourceText(source) {
|
|
|
76910
77724
|
switch (source.kind) {
|
|
76911
77725
|
case "owner":
|
|
76912
77726
|
return "Owner";
|
|
77727
|
+
case "creator":
|
|
77728
|
+
return "Creator";
|
|
76913
77729
|
case "admin":
|
|
76914
77730
|
return "Workspace admin";
|
|
76915
77731
|
case "direct":
|
|
@@ -76956,6 +77772,26 @@ var appAccess = async ({ context, args }) => {
|
|
|
76956
77772
|
if (!run4) throw new CliUsageError(USAGE5);
|
|
76957
77773
|
print5({ context, args, ...await run4({ client, appId, first, second }) });
|
|
76958
77774
|
};
|
|
77775
|
+
var appRequest = async ({ context, args }) => {
|
|
77776
|
+
const scoped = args.words[2] ? { ...args, flags: { ...args.flags, app: args.words[2] } } : args;
|
|
77777
|
+
const client = await appClient({ context, args: scoped });
|
|
77778
|
+
const appId = await appIdOf({
|
|
77779
|
+
client,
|
|
77780
|
+
args: scoped,
|
|
77781
|
+
folder: folderOf({ context, word: void 0 })
|
|
77782
|
+
});
|
|
77783
|
+
const request2 = await client.post("/api/apps/access/request", {
|
|
77784
|
+
appId
|
|
77785
|
+
});
|
|
77786
|
+
const owner = request2.approverName ?? "your owner";
|
|
77787
|
+
print5({
|
|
77788
|
+
context,
|
|
77789
|
+
args,
|
|
77790
|
+
value: request2,
|
|
77791
|
+
text: `Asked ${owner} for access to ${request2.appName} (${request2.id}); ${agentPathText(request2.path)}. Run laze app list to see when it opens.
|
|
77792
|
+
`
|
|
77793
|
+
});
|
|
77794
|
+
};
|
|
76959
77795
|
var appUnpublish = async ({ context, args }) => {
|
|
76960
77796
|
const client = await appClient({ context, args });
|
|
76961
77797
|
const appId = await appIdOf({ client, args, folder: folderOf({ context, word: void 0 }) });
|
|
@@ -76969,21 +77805,21 @@ var appUnpublish = async ({ context, args }) => {
|
|
|
76969
77805
|
});
|
|
76970
77806
|
};
|
|
76971
77807
|
function costText({ name: name3, cost }) {
|
|
76972
|
-
const
|
|
77808
|
+
const money3 = (amount) => formatAppMoney({ amount, currency: cost.currency });
|
|
76973
77809
|
const month = Temporal3.PlainDate.from(`${cost.month}-01`).toLocaleString("en-GB", {
|
|
76974
77810
|
month: "long",
|
|
76975
77811
|
year: "numeric"
|
|
76976
77812
|
});
|
|
76977
77813
|
const rows = cost.lines.map((line) => {
|
|
76978
77814
|
const used = appCostQuantityText(line);
|
|
76979
|
-
return ` ${APP_COST_PART_LABELS[line.part].padEnd(16)} ${
|
|
77815
|
+
return ` ${APP_COST_PART_LABELS[line.part].padEnd(16)} ${money3(line.amount).padStart(12)}${used ? ` ${used}` : ""}
|
|
76980
77816
|
`;
|
|
76981
77817
|
});
|
|
76982
77818
|
const { budget: budget2 } = cost;
|
|
76983
|
-
const budgetLine = budget2.monthly === null ? "No budget. laze app budget <amount> sets one.\n" : `Budget ${
|
|
77819
|
+
const budgetLine = budget2.monthly === null ? "No budget. laze app budget <amount> sets one.\n" : `Budget ${money3(budget2.monthly)} a month, ${Math.round(cost.total / budget2.monthly * 100).toString()}% used.
|
|
76984
77820
|
`;
|
|
76985
77821
|
const paused = budget2.paused ? "Paused: server functions and agent work on this app stop until the budget is raised or the month ends. Pages and records keep working.\n" : "";
|
|
76986
|
-
return `${name3} cost ${
|
|
77822
|
+
return `${name3} cost ${money3(cost.total)} so far in ${month}, at Laze list prices:
|
|
76987
77823
|
${rows.join("")}${budgetLine}${paused}`;
|
|
76988
77824
|
}
|
|
76989
77825
|
async function appOfWord({
|
|
@@ -77040,6 +77876,7 @@ var APP_COMMANDS = {
|
|
|
77040
77876
|
unpublish: appUnpublish,
|
|
77041
77877
|
access: appAccess,
|
|
77042
77878
|
members: appMembers,
|
|
77879
|
+
request: appRequest,
|
|
77043
77880
|
name: appName,
|
|
77044
77881
|
versions: appVersions,
|
|
77045
77882
|
log: appVersions,
|
|
@@ -77238,7 +78075,13 @@ var BILLING_USAGE = `Usage:
|
|
|
77238
78075
|
laze billing currency usd|eur bill in USD or EUR, until the first payment (admins)
|
|
77239
78076
|
laze billing top-up <amount> a Stripe link that adds prepaid credits, 10 or more (admins)
|
|
77240
78077
|
laze billing auto-recharge on|off [--amount <n>] [--limit <n>] (admins)
|
|
77241
|
-
laze billing referral <code> apply another workspace's referral code (admins)
|
|
78078
|
+
laze billing referral <code> apply another workspace's referral code (admins)
|
|
78079
|
+
laze billing details the company, address, billing email and tax id on invoices (admins)
|
|
78080
|
+
laze billing details set --company <name> --email <billing email> --line1 <street> --city <city>
|
|
78081
|
+
--country <NL> [--postal <code>] [--line2 <text>] [--state <text>]
|
|
78082
|
+
[--tax-id <NL123456789B01>|none] [--tax-type eu_vat|gb_vat|ch_vat|no_vat|us_ein|au_abn|ca_bn] (admins)
|
|
78083
|
+
laze billing cancel end Team at the end of the paid period (admins)
|
|
78084
|
+
laze billing keep keep Team after a cancellation (admins)`;
|
|
77242
78085
|
var printJson = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
|
|
77243
78086
|
`);
|
|
77244
78087
|
async function plan({ context, args }) {
|
|
@@ -77275,8 +78118,14 @@ function printAccount({ context, args }, account) {
|
|
|
77275
78118
|
const of = (amount) => money(amount, account.currency);
|
|
77276
78119
|
const plan2 = account.plan === "team" ? `Team, ${of(account.seats.monthlyPrice)} a month for ${account.seats.people} people` : "Free, for one person";
|
|
77277
78120
|
const pending2 = account.status === "pending_payment" ? " (payment pending: run laze billing checkout)" : "";
|
|
77278
|
-
|
|
78121
|
+
const ending = account.cancelAtPeriodEnd && account.period ? ` (ends ${account.period.end.slice(0, 10)}: run laze billing keep to renew)` : "";
|
|
78122
|
+
context.out(`Plan: ${plan2}${pending2}${ending}
|
|
78123
|
+
`);
|
|
78124
|
+
if (account.paymentIssue) {
|
|
78125
|
+
const link = account.paymentIssue.invoiceUrl ? ` ${account.paymentIssue.invoiceUrl}` : "";
|
|
78126
|
+
context.out(`Payment: ${account.paymentIssue.message ?? account.paymentIssue.kind}${link}
|
|
77279
78127
|
`);
|
|
78128
|
+
}
|
|
77280
78129
|
context.out(
|
|
77281
78130
|
`Credits: ${of(account.credits.includedLeft)} of ${of(account.credits.included)} included left, ${of(account.credits.prepaid)} prepaid${prepaidNoteOf(account, of)}${account.credits.paused ? " (paused: top up to resume)" : ""}
|
|
77282
78131
|
`
|
|
@@ -77305,8 +78154,9 @@ async function invoices({ context, args }) {
|
|
|
77305
78154
|
if (list11.length === 0) return context.out("No invoices yet.\n");
|
|
77306
78155
|
for (const invoice of list11) {
|
|
77307
78156
|
const link = invoice.hostedUrl ? ` ${invoice.hostedUrl}` : "";
|
|
78157
|
+
const tax = invoice.tax ? ` (tax ${money(invoice.tax, invoice.currency)})` : "";
|
|
77308
78158
|
context.out(
|
|
77309
|
-
`${invoice.createdAt.slice(0, 10)} ${invoice.number ?? "draft"} ${invoice.status} ${money(invoice.total, invoice.currency)}${link}
|
|
78159
|
+
`${invoice.createdAt.slice(0, 10)} ${invoice.number ?? "draft"} ${invoice.status} ${money(invoice.total, invoice.currency)}${tax}${link}
|
|
77310
78160
|
`
|
|
77311
78161
|
);
|
|
77312
78162
|
}
|
|
@@ -77369,6 +78219,73 @@ async function referral({ context, args }) {
|
|
|
77369
78219
|
await client.post("/api/billing-account/referral", { code })
|
|
77370
78220
|
);
|
|
77371
78221
|
}
|
|
78222
|
+
function addressLine(address) {
|
|
78223
|
+
if (!address) return "not set";
|
|
78224
|
+
const town = [address.postalCode, address.city].filter(Boolean).join(" ");
|
|
78225
|
+
return [address.line1, address.line2, town, address.state, address.country].filter(Boolean).join(", ");
|
|
78226
|
+
}
|
|
78227
|
+
function printDetails({ context, args }, details2) {
|
|
78228
|
+
if (args.flags.json) return printJson(context, details2);
|
|
78229
|
+
const taxId = details2.taxId ? `${details2.taxId.value} (${details2.taxId.type}, ${details2.taxId.status})` : "none";
|
|
78230
|
+
context.out(`Company: ${details2.companyName ?? "not set"}
|
|
78231
|
+
`);
|
|
78232
|
+
context.out(`Billing email: ${details2.email ?? "not set"}
|
|
78233
|
+
`);
|
|
78234
|
+
context.out(`Address: ${addressLine(details2.address)}
|
|
78235
|
+
`);
|
|
78236
|
+
context.out(`Tax id: ${taxId}
|
|
78237
|
+
`);
|
|
78238
|
+
if (details2.taxIdRemoved) {
|
|
78239
|
+
context.out(
|
|
78240
|
+
`Removed: ${details2.taxIdRemoved.value}, which the EU VAT service rejected; invoices carry VAT until a valid number is set
|
|
78241
|
+
`
|
|
78242
|
+
);
|
|
78243
|
+
}
|
|
78244
|
+
}
|
|
78245
|
+
var TAX_TYPES = ["eu_vat", "gb_vat", "ch_vat", "no_vat", "us_ein", "au_abn", "ca_bn"];
|
|
78246
|
+
function needed({ args, name: name3 }) {
|
|
78247
|
+
const value = flagText({ args, name: name3 });
|
|
78248
|
+
if (!value) throw new CliUsageError(`--${name3} is needed.
|
|
78249
|
+
${BILLING_USAGE}`);
|
|
78250
|
+
return value;
|
|
78251
|
+
}
|
|
78252
|
+
function detailsBody({ args }) {
|
|
78253
|
+
const taxText = flagText({ args, name: "tax-id" });
|
|
78254
|
+
const taxType = flagText({ args, name: "tax-type" }) || "eu_vat";
|
|
78255
|
+
if (!TAX_TYPES.includes(taxType)) {
|
|
78256
|
+
throw new CliUsageError(`--tax-type takes ${TAX_TYPES.join(", ")}.
|
|
78257
|
+
${BILLING_USAGE}`);
|
|
78258
|
+
}
|
|
78259
|
+
return {
|
|
78260
|
+
companyName: needed({ args, name: "company" }),
|
|
78261
|
+
email: needed({ args, name: "email" }),
|
|
78262
|
+
address: {
|
|
78263
|
+
line1: needed({ args, name: "line1" }),
|
|
78264
|
+
line2: flagText({ args, name: "line2" }) || null,
|
|
78265
|
+
city: needed({ args, name: "city" }),
|
|
78266
|
+
postalCode: flagText({ args, name: "postal" }) || null,
|
|
78267
|
+
state: flagText({ args, name: "state" }) || null,
|
|
78268
|
+
country: needed({ args, name: "country" })
|
|
78269
|
+
},
|
|
78270
|
+
taxId: !taxText || taxText === "none" ? null : { type: taxType, value: taxText }
|
|
78271
|
+
};
|
|
78272
|
+
}
|
|
78273
|
+
async function details({ context, args }) {
|
|
78274
|
+
const action = args.words[2];
|
|
78275
|
+
if (action !== void 0 && action !== "set") throw new CliUsageError(BILLING_USAGE);
|
|
78276
|
+
const body = action === "set" ? detailsBody({ args }) : null;
|
|
78277
|
+
const { client } = await signedIn({ context, args });
|
|
78278
|
+
const answer5 = body ? await client.post("/api/billing-account/details", body) : await client.get("/api/billing-account/details");
|
|
78279
|
+
printDetails({ context, args }, answer5);
|
|
78280
|
+
}
|
|
78281
|
+
async function cancel({ context, args }) {
|
|
78282
|
+
const { client } = await signedIn({ context, args });
|
|
78283
|
+
printAccount({ context, args }, await client.post("/api/billing-account/cancel", {}));
|
|
78284
|
+
}
|
|
78285
|
+
async function keep({ context, args }) {
|
|
78286
|
+
const { client } = await signedIn({ context, args });
|
|
78287
|
+
printAccount({ context, args }, await client.post("/api/billing-account/keep", {}));
|
|
78288
|
+
}
|
|
77372
78289
|
var BILLING_COMMANDS = {
|
|
77373
78290
|
account: show,
|
|
77374
78291
|
invoices,
|
|
@@ -77377,7 +78294,10 @@ var BILLING_COMMANDS = {
|
|
|
77377
78294
|
currency,
|
|
77378
78295
|
"top-up": topUp,
|
|
77379
78296
|
"auto-recharge": autoRecharge,
|
|
77380
|
-
referral
|
|
78297
|
+
referral,
|
|
78298
|
+
details,
|
|
78299
|
+
cancel,
|
|
78300
|
+
keep
|
|
77381
78301
|
};
|
|
77382
78302
|
async function billing({ context, args }) {
|
|
77383
78303
|
const name3 = args.words[1];
|
|
@@ -77389,13 +78309,13 @@ async function billing({ context, args }) {
|
|
|
77389
78309
|
|
|
77390
78310
|
// src/services/browser-commands.service.ts
|
|
77391
78311
|
import { randomBytes } from "node:crypto";
|
|
77392
|
-
import { mkdir as mkdir19, readFile as
|
|
77393
|
-
import { dirname as dirname18, join as
|
|
78312
|
+
import { mkdir as mkdir19, readFile as readFile20, writeFile as writeFile19 } from "node:fs/promises";
|
|
78313
|
+
import { dirname as dirname18, join as join23 } from "node:path";
|
|
77394
78314
|
|
|
77395
78315
|
// src/services/browser-tab-commands.service.ts
|
|
77396
78316
|
import { mkdir as mkdir18, writeFile as writeFile18 } from "node:fs/promises";
|
|
77397
78317
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
77398
|
-
import { join as
|
|
78318
|
+
import { join as join22 } from "node:path";
|
|
77399
78319
|
|
|
77400
78320
|
// src/rules/browser-login.rules.ts
|
|
77401
78321
|
var PASSWORD_NAME = /pass|pwd/i;
|
|
@@ -77425,10 +78345,10 @@ function loginValuesOf({
|
|
|
77425
78345
|
}
|
|
77426
78346
|
|
|
77427
78347
|
// src/services/vault-commands.service.ts
|
|
77428
|
-
import { createHash as
|
|
77429
|
-
import { mkdir as mkdir17, readFile as
|
|
78348
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
78349
|
+
import { mkdir as mkdir17, readFile as readFile19, rm as rm9, writeFile as writeFile17 } from "node:fs/promises";
|
|
77430
78350
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
77431
|
-
import { dirname as dirname17, join as
|
|
78351
|
+
import { dirname as dirname17, join as join21 } from "node:path";
|
|
77432
78352
|
var USAGE6 = `Usage: laze vault run <connection> --reason "<one plain sentence>" [--wait <s>] -- <command> [args...]
|
|
77433
78353
|
Runs the command with the connection's values in its environment, on a Laze agent's computer,
|
|
77434
78354
|
on a machine it runs on, or where a connected agent runs, with its own key.
|
|
@@ -77464,7 +78384,7 @@ async function turnTokenOf2({
|
|
|
77464
78384
|
if (pinned) return pinned;
|
|
77465
78385
|
if (!turnFile) throw new CliUsageError(`${command} works only during an agent's turn`);
|
|
77466
78386
|
try {
|
|
77467
|
-
return (await
|
|
78387
|
+
return (await readFile19(turnFile, "utf8")).trim();
|
|
77468
78388
|
} catch {
|
|
77469
78389
|
throw new CliUsageError(`${command} works only during an agent's turn`);
|
|
77470
78390
|
}
|
|
@@ -77474,12 +78394,12 @@ function runKeyPathOf({
|
|
|
77474
78394
|
connection,
|
|
77475
78395
|
profile = ""
|
|
77476
78396
|
}) {
|
|
77477
|
-
const name3 =
|
|
77478
|
-
const base = turnFile ? dirname17(turnFile) :
|
|
77479
|
-
return
|
|
78397
|
+
const name3 = createHash3("sha256").update(connection).digest("hex");
|
|
78398
|
+
const base = turnFile ? dirname17(turnFile) : join21(tmpdir2(), "laze-vault", profile);
|
|
78399
|
+
return join21(base, "vault-run-keys", `${name3}.json`);
|
|
77480
78400
|
}
|
|
77481
78401
|
async function runKeyAt({ path }) {
|
|
77482
|
-
const saved3 = await
|
|
78402
|
+
const saved3 = await readFile19(path, "utf8").then(
|
|
77483
78403
|
(text2) => JSON.parse(text2),
|
|
77484
78404
|
() => void 0
|
|
77485
78405
|
);
|
|
@@ -77989,9 +78909,9 @@ async function savedScreenshot({
|
|
|
77989
78909
|
data,
|
|
77990
78910
|
nowMs
|
|
77991
78911
|
}) {
|
|
77992
|
-
const folder =
|
|
78912
|
+
const folder = join22(tmpdir3(), "laze-browser");
|
|
77993
78913
|
await mkdir18(folder, { recursive: true, mode: 448 });
|
|
77994
|
-
const path =
|
|
78914
|
+
const path = join22(folder, `${tabId.replace(/[^a-zA-Z0-9_-]/g, "_")}-login-${nowMs}.jpg`);
|
|
77995
78915
|
await writeFile18(path, Buffer.from(data, "base64"), { mode: 384 });
|
|
77996
78916
|
return path;
|
|
77997
78917
|
}
|
|
@@ -78468,7 +79388,7 @@ async function turnTokenOf3({
|
|
|
78468
79388
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
78469
79389
|
if (pinned) return pinned;
|
|
78470
79390
|
if (env.LAZE_TURN_FILE) {
|
|
78471
|
-
return
|
|
79391
|
+
return readFile20(env.LAZE_TURN_FILE, "utf8").then(
|
|
78472
79392
|
(text2) => text2.trim(),
|
|
78473
79393
|
() => ""
|
|
78474
79394
|
);
|
|
@@ -78558,7 +79478,7 @@ async function answering({
|
|
|
78558
79478
|
}
|
|
78559
79479
|
function bridgeStatePath({ context, machine: machine2 }) {
|
|
78560
79480
|
const safe = machine2.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
78561
|
-
return
|
|
79481
|
+
return join23(dirname18(context.environment.configPath), "bridges", `${safe}.json`);
|
|
78562
79482
|
}
|
|
78563
79483
|
async function bridgePort({
|
|
78564
79484
|
context,
|
|
@@ -78566,7 +79486,7 @@ async function bridgePort({
|
|
|
78566
79486
|
access
|
|
78567
79487
|
}) {
|
|
78568
79488
|
const path = bridgeStatePath({ context, machine: machine2 });
|
|
78569
|
-
const live = await
|
|
79489
|
+
const live = await readFile20(path, "utf8").then(
|
|
78570
79490
|
(text2) => JSON.parse(text2),
|
|
78571
79491
|
() => void 0
|
|
78572
79492
|
);
|
|
@@ -78979,7 +79899,7 @@ async function activityRead({ context, args }) {
|
|
|
78979
79899
|
|
|
78980
79900
|
// src/services/channel-config-commands.service.ts
|
|
78981
79901
|
var AGENT_HINT2 = "Roles, archiving and removing others are a channel admin's change: ask one.\n";
|
|
78982
|
-
var
|
|
79902
|
+
var LEVELS4 = ["default", "all", "mentions", "nothing", "mute", "unmute"];
|
|
78983
79903
|
async function changing2({
|
|
78984
79904
|
context,
|
|
78985
79905
|
profile,
|
|
@@ -79165,7 +80085,7 @@ function instantOf({ until }) {
|
|
|
79165
80085
|
}
|
|
79166
80086
|
function notifyBodyOf({ args }) {
|
|
79167
80087
|
const [, , channel, word3] = args.words;
|
|
79168
|
-
const level =
|
|
80088
|
+
const level = LEVELS4.find((candidate) => candidate === word3);
|
|
79169
80089
|
if (!channel || !level) throw new CliUsageError(NOTIFY_USAGE);
|
|
79170
80090
|
if (level === "unmute") return { channel, muted: false };
|
|
79171
80091
|
if (level !== "mute") return { channel, level };
|
|
@@ -79241,8 +80161,8 @@ async function channelSettings({ context, args }) {
|
|
|
79241
80161
|
}
|
|
79242
80162
|
|
|
79243
80163
|
// src/services/chat-actions-commands.service.ts
|
|
79244
|
-
import { readFile as
|
|
79245
|
-
import { basename as
|
|
80164
|
+
import { readFile as readFile21 } from "node:fs/promises";
|
|
80165
|
+
import { basename as basename5, isAbsolute as isAbsolute2, relative as relative4, resolve as resolve7 } from "node:path";
|
|
79246
80166
|
|
|
79247
80167
|
// src/rules/file-types.rules.ts
|
|
79248
80168
|
var TYPES2 = {
|
|
@@ -79337,12 +80257,12 @@ async function threadWaitReply({
|
|
|
79337
80257
|
if (!messageId) throw new CliUsageError(USAGE7);
|
|
79338
80258
|
const seconds = timeoutOf({ args });
|
|
79339
80259
|
const { client } = await signedIn({ context, args });
|
|
79340
|
-
const
|
|
79341
|
-
const seen = new Set((await
|
|
80260
|
+
const read4 = () => client.post(CHAT_KEY_PATHS.thread, { messageId });
|
|
80261
|
+
const seen = new Set((await read4()).replies.map((reply2) => reply2.id));
|
|
79342
80262
|
const isNew = (reply2) => reply2.author.kind === "person" && !seen.has(reply2.id);
|
|
79343
80263
|
for (let waited = 0; waited < seconds * 1e3; waited += POLL_MS2) {
|
|
79344
80264
|
await context.sleep(POLL_MS2);
|
|
79345
|
-
const reply2 = (await
|
|
80265
|
+
const reply2 = (await read4()).replies.find(isNew);
|
|
79346
80266
|
if (!reply2) continue;
|
|
79347
80267
|
const line = `${reply2.seq} ${reply2.id} person ${reply2.author.id} ${reply2.body}
|
|
79348
80268
|
`;
|
|
@@ -79371,7 +80291,7 @@ var CHAT_ACTIONS_USAGE = `Usage:
|
|
|
79371
80291
|
laze message restore <messageId> put a scrubbed secret back in your message (people)
|
|
79372
80292
|
laze pins <channel> a conversation's pinned messages
|
|
79373
80293
|
laze channel read <channel> [--seq <n>] mark it read, up to a message or to the newest
|
|
79374
|
-
laze channel unread <channel> --seq <n>
|
|
80294
|
+
laze channel unread <channel> [--seq <n>] mark it unread from a message, or its last one
|
|
79375
80295
|
laze files <channel> [--before <fileId>] [--limit <n>] its files, newest first
|
|
79376
80296
|
laze file link <fileId> [--variant original|thumbnail|poster|preview] [--download]
|
|
79377
80297
|
laze file rename <fileId> <name> rename a file you posted
|
|
@@ -79549,10 +80469,9 @@ var channelRead = async ({ context, args, client }) => {
|
|
|
79549
80469
|
};
|
|
79550
80470
|
var channelUnread = async ({ context, args, client }) => {
|
|
79551
80471
|
const seq = numberFlag(args, "seq");
|
|
79552
|
-
if (!seq) throw new CliUsageError(CHAT_ACTIONS_USAGE);
|
|
79553
80472
|
const answer5 = await client.post(CHAT_KEY_PATHS.markUnread, {
|
|
79554
80473
|
channel: wordAt(args, 2),
|
|
79555
|
-
seq
|
|
80474
|
+
...seq !== void 0 && { seq }
|
|
79556
80475
|
});
|
|
79557
80476
|
print6({ context, args, answer: answer5, text: (it) => `Read up to ${it.lastReadSeq}.
|
|
79558
80477
|
` });
|
|
@@ -79575,11 +80494,11 @@ var files = async ({ context, args, client }) => {
|
|
|
79575
80494
|
};
|
|
79576
80495
|
function uploadNameOf({ cwd, path }) {
|
|
79577
80496
|
const inside = relative4(cwd, path);
|
|
79578
|
-
return inside && !inside.startsWith("..") && !isAbsolute2(inside) ? inside :
|
|
80497
|
+
return inside && !inside.startsWith("..") && !isAbsolute2(inside) ? inside : basename5(path);
|
|
79579
80498
|
}
|
|
79580
80499
|
var fileUpload = async ({ context, args, client }) => {
|
|
79581
80500
|
const path = resolve7(context.cwd, wordAt(args, 3));
|
|
79582
|
-
const bytes = new Uint8Array(await
|
|
80501
|
+
const bytes = new Uint8Array(await readFile21(path));
|
|
79583
80502
|
const answer5 = await uploadFile({
|
|
79584
80503
|
context,
|
|
79585
80504
|
client,
|
|
@@ -79752,7 +80671,7 @@ async function chatActions({
|
|
|
79752
80671
|
}
|
|
79753
80672
|
|
|
79754
80673
|
// src/services/claude-monitor.service.ts
|
|
79755
|
-
import { readFile as
|
|
80674
|
+
import { readFile as readFile22, rm as rm10 } from "node:fs/promises";
|
|
79756
80675
|
var MONITOR_IDLE_MS = 3e4;
|
|
79757
80676
|
var MONITOR_OUTRANKED_MS = 3e3;
|
|
79758
80677
|
async function deliverOnce({
|
|
@@ -79793,6 +80712,12 @@ async function deliverOnce({
|
|
|
79793
80712
|
async function monitorRound(turn) {
|
|
79794
80713
|
const { context, session } = turn;
|
|
79795
80714
|
return deliverOnce(turn).catch(async (error62) => {
|
|
80715
|
+
const migrated = migratedNoticeOf(error62);
|
|
80716
|
+
if (migrated) {
|
|
80717
|
+
context.out(`${migrated.notice}
|
|
80718
|
+
`);
|
|
80719
|
+
return false;
|
|
80720
|
+
}
|
|
79796
80721
|
const named = { ...turn.args, flags: { ...turn.args.flags, profile: turn.profile } };
|
|
79797
80722
|
const { client } = await signedIn({ context, args: named });
|
|
79798
80723
|
const claim3 = forSession({ client, session });
|
|
@@ -79853,7 +80778,7 @@ async function monitorSessionOf({
|
|
|
79853
80778
|
const fromEnv = sessionOf({ context, harness: "claude-code", sessionId });
|
|
79854
80779
|
if (fromEnv || !claudePid) return fromEnv;
|
|
79855
80780
|
const path = statePathOf({ context, kind: "sessions", profile: String(claudePid) });
|
|
79856
|
-
return
|
|
80781
|
+
return readFile22(path, "utf8").then(
|
|
79857
80782
|
(text2) => JSON.parse(text2),
|
|
79858
80783
|
() => void 0
|
|
79859
80784
|
);
|
|
@@ -80080,6 +81005,14 @@ var billingConfig = Config.define((c) => ({
|
|
|
80080
81005
|
stripeApiBase: c.env("STRIPE_API_BASE", external_exports.url().default("https://api.stripe.com")),
|
|
80081
81006
|
/** Team's graduated per-person price (`TEAM_PRICING`), one quantity per person. */
|
|
80082
81007
|
teamPriceId: c.env("STRIPE_PRICE_TEAM", priceId),
|
|
81008
|
+
/** Team's price before 2026-10-25 (first step of 2), kept by subscriptions started on it. */
|
|
81009
|
+
legacyTeamPriceId: c.env("STRIPE_PRICE_TEAM_LEGACY", priceId),
|
|
81010
|
+
/** The product every top-up and auto-recharge line names; a bare line without it. */
|
|
81011
|
+
creditsProductId: c.env("STRIPE_PRODUCT_CREDITS", external_exports.string().min(1).optional()),
|
|
81012
|
+
/** The customer portal configuration; Stripe's default one without it. */
|
|
81013
|
+
portalConfigurationId: c.env("STRIPE_PORTAL_CONFIGURATION", external_exports.string().min(1).optional()),
|
|
81014
|
+
/** Stripe Tax on checkouts, recharge invoices and subscriptions; needs Stripe Tax active. */
|
|
81015
|
+
automaticTax: c.env("STRIPE_AUTOMATIC_TAX", environmentBooleanSchema.default(true)),
|
|
80083
81016
|
/** The coupon for a referral: `REFERRAL_TERMS` off, repeating for its months. */
|
|
80084
81017
|
referralCouponId: c.env("STRIPE_COUPON_REFERRAL", external_exports.string().min(1).optional()),
|
|
80085
81018
|
/** List price over cost per usage category; never shown on the site. */
|
|
@@ -80103,7 +81036,9 @@ var referralRefusalSchema = external_exports.enum([
|
|
|
80103
81036
|
"unknown",
|
|
80104
81037
|
"own_code",
|
|
80105
81038
|
"already_applied",
|
|
80106
|
-
"subscribed"
|
|
81039
|
+
"subscribed",
|
|
81040
|
+
"same_person",
|
|
81041
|
+
"same_company"
|
|
80107
81042
|
]);
|
|
80108
81043
|
|
|
80109
81044
|
// ../../modules/billing/contract/src/billing.plans.ts
|
|
@@ -80111,6 +81046,19 @@ var currencySchema = external_exports.enum(["usd", "eur"]);
|
|
|
80111
81046
|
var planSchema = external_exports.enum(["free", "team"]);
|
|
80112
81047
|
var LEGACY_PLANS = { free: "free", team: "team", none: "free", individual: "team" };
|
|
80113
81048
|
var storedPlanSchema = external_exports.enum(["free", "team", "none", "individual"]).transform((plan2) => LEGACY_PLANS[plan2]);
|
|
81049
|
+
var TEAM_PRICING = {
|
|
81050
|
+
firstPeople: 3,
|
|
81051
|
+
teamSizeStep: 10,
|
|
81052
|
+
prices: {
|
|
81053
|
+
usd: { firstPeoplePrice: 20, perPersonToStep: 10, perPersonAfterStep: 8 },
|
|
81054
|
+
eur: { firstPeoplePrice: 18, perPersonToStep: 9, perPersonAfterStep: 7 }
|
|
81055
|
+
}
|
|
81056
|
+
};
|
|
81057
|
+
var teamPricingRuleSchema = external_exports.enum(["first_three", "first_two"]);
|
|
81058
|
+
var FIRST_PEOPLE = {
|
|
81059
|
+
first_three: TEAM_PRICING.firstPeople,
|
|
81060
|
+
first_two: 2
|
|
81061
|
+
};
|
|
80114
81062
|
var computerSizeSchema = external_exports.enum(["small", "medium", "large", "xl"]);
|
|
80115
81063
|
var COMPUTER_MARKUP = 2;
|
|
80116
81064
|
function computerSize(input2) {
|
|
@@ -80225,6 +81173,13 @@ var subscriptionStatusSchema = external_exports.enum([
|
|
|
80225
81173
|
]);
|
|
80226
81174
|
var pauseReasonSchema = external_exports.enum(["credits"]);
|
|
80227
81175
|
var spendLineDefinition = external_exports.object({ id: external_exports.string(), amount: external_exports.number() });
|
|
81176
|
+
var referralStateSchema = external_exports.enum(["waiting", "rewarded", "over_limit"]);
|
|
81177
|
+
var referralEntryDefinition = external_exports.object({
|
|
81178
|
+
state: referralStateSchema,
|
|
81179
|
+
referredAt: external_exports.iso.datetime(),
|
|
81180
|
+
settledAt: external_exports.iso.datetime().nullable(),
|
|
81181
|
+
reward: external_exports.enum(["discount", "banked", "credits"]).nullable()
|
|
81182
|
+
});
|
|
80228
81183
|
var billingAccountViewDefinition = external_exports.object({
|
|
80229
81184
|
workspaceId: external_exports.string(),
|
|
80230
81185
|
plan: planSchema,
|
|
@@ -80241,6 +81196,8 @@ var billingAccountViewDefinition = external_exports.object({
|
|
|
80241
81196
|
/** What the plan costs a month for these people; 0 on Free. */
|
|
80242
81197
|
monthlyPrice: external_exports.number().nonnegative()
|
|
80243
81198
|
}),
|
|
81199
|
+
/** The first step Team is priced by: `first_two` for subscriptions from before 2026-10-25. */
|
|
81200
|
+
pricingRule: teamPricingRuleSchema.default("first_three"),
|
|
80244
81201
|
/** Team given free of charge by Laze staff, for this many people; null when paid or Free. */
|
|
80245
81202
|
complimentary: external_exports.object({ seats: external_exports.number().int().positive() }).nullable().default(null),
|
|
80246
81203
|
credits: external_exports.object({
|
|
@@ -80280,9 +81237,21 @@ var billingAccountViewDefinition = external_exports.object({
|
|
|
80280
81237
|
/** The code this workspace applied, if any. */
|
|
80281
81238
|
appliedCode: external_exports.string().nullable(),
|
|
80282
81239
|
/** Discounts earned and not yet on a subscription. */
|
|
80283
|
-
discountsPending: external_exports.number().int().nonnegative()
|
|
81240
|
+
discountsPending: external_exports.number().int().nonnegative(),
|
|
81241
|
+
/** Each workspace this code brought, oldest first; never who or which workspace it is. */
|
|
81242
|
+
referrals: external_exports.array(referralEntryDefinition).default([]),
|
|
81243
|
+
/** Rewards earned in the last 365 days, against `REFERRAL_CARD_TERMS.yearlyRewardLimit`. */
|
|
81244
|
+
rewardsThisYear: external_exports.number().int().nonnegative().default(0)
|
|
80284
81245
|
}),
|
|
80285
|
-
portalAvailable: external_exports.boolean()
|
|
81246
|
+
portalAvailable: external_exports.boolean(),
|
|
81247
|
+
/** A Team payment that failed or waits for the buyer's bank, until an invoice is paid. */
|
|
81248
|
+
paymentIssue: external_exports.object({
|
|
81249
|
+
kind: external_exports.enum(["failed", "action_required"]),
|
|
81250
|
+
message: external_exports.string().nullable(),
|
|
81251
|
+
/** Stripe's page that pays or confirms the invoice. */
|
|
81252
|
+
invoiceUrl: external_exports.string().nullable(),
|
|
81253
|
+
at: external_exports.iso.datetime()
|
|
81254
|
+
}).nullable().default(null)
|
|
80286
81255
|
});
|
|
80287
81256
|
var billingAccountViewSchema = billingAccountViewDefinition;
|
|
80288
81257
|
var invoiceDefinition = external_exports.object({
|
|
@@ -80290,12 +81259,61 @@ var invoiceDefinition = external_exports.object({
|
|
|
80290
81259
|
number: external_exports.string().nullable(),
|
|
80291
81260
|
status: external_exports.string(),
|
|
80292
81261
|
total: external_exports.number(),
|
|
81262
|
+
/** The tax on the invoice, in the same units as `total`. */
|
|
81263
|
+
tax: external_exports.number().default(0),
|
|
80293
81264
|
currency: currencySchema,
|
|
80294
81265
|
createdAt: external_exports.iso.datetime(),
|
|
80295
81266
|
hostedUrl: external_exports.string().nullable(),
|
|
80296
81267
|
pdfUrl: external_exports.string().nullable()
|
|
80297
81268
|
});
|
|
80298
81269
|
var billingInvoiceSchema = invoiceDefinition;
|
|
81270
|
+
var taxIdTypeSchema = external_exports.enum([
|
|
81271
|
+
"eu_vat",
|
|
81272
|
+
"gb_vat",
|
|
81273
|
+
"ch_vat",
|
|
81274
|
+
"no_vat",
|
|
81275
|
+
"us_ein",
|
|
81276
|
+
"au_abn",
|
|
81277
|
+
"ca_bn"
|
|
81278
|
+
]);
|
|
81279
|
+
var billingAddressDefinition = external_exports.object({
|
|
81280
|
+
line1: external_exports.string().trim().min(1).max(200),
|
|
81281
|
+
line2: external_exports.string().trim().max(200).nullable().default(null),
|
|
81282
|
+
city: external_exports.string().trim().min(1).max(100),
|
|
81283
|
+
postalCode: external_exports.string().trim().max(20).nullable().default(null),
|
|
81284
|
+
state: external_exports.string().trim().max(100).nullable().default(null),
|
|
81285
|
+
/** ISO 3166-1 alpha-2, upper case. */
|
|
81286
|
+
country: external_exports.string().trim().regex(/^[A-Za-z]{2}$/, "a two-letter country code").transform((code) => code.toUpperCase())
|
|
81287
|
+
});
|
|
81288
|
+
var billingDetailsDefinition = external_exports.object({
|
|
81289
|
+
workspaceId: external_exports.string(),
|
|
81290
|
+
companyName: external_exports.string().nullable(),
|
|
81291
|
+
/** Where Stripe sends invoices and receipts. */
|
|
81292
|
+
email: external_exports.string().nullable(),
|
|
81293
|
+
address: billingAddressDefinition.nullable(),
|
|
81294
|
+
taxId: external_exports.object({
|
|
81295
|
+
type: taxIdTypeSchema,
|
|
81296
|
+
value: external_exports.string(),
|
|
81297
|
+
/** The EU VAT service's answer; `pending` until it gives one. */
|
|
81298
|
+
status: external_exports.enum(["pending", "verified", "unverified", "unavailable"])
|
|
81299
|
+
}).nullable(),
|
|
81300
|
+
/** A tax id the EU VAT service rejected after it was saved, removed from the customer. */
|
|
81301
|
+
taxIdRemoved: external_exports.object({ value: external_exports.string(), at: external_exports.iso.datetime() }).nullable()
|
|
81302
|
+
});
|
|
81303
|
+
var billingDetailsSchema = billingDetailsDefinition;
|
|
81304
|
+
var setBillingDetailsInputDefinition = external_exports.object({
|
|
81305
|
+
workspaceId: external_exports.string().min(1),
|
|
81306
|
+
companyName: external_exports.string().trim().min(1).max(200),
|
|
81307
|
+
email: external_exports.email().max(254),
|
|
81308
|
+
address: billingAddressDefinition,
|
|
81309
|
+
/** Null removes the tax id. */
|
|
81310
|
+
taxId: external_exports.object({ type: taxIdTypeSchema, value: external_exports.string().trim().min(2).max(40) }).nullable()
|
|
81311
|
+
});
|
|
81312
|
+
var setBillingDetailsInputSchema = setBillingDetailsInputDefinition;
|
|
81313
|
+
var setBillingDetailsByKeyInputDefinition = setBillingDetailsInputDefinition.omit({
|
|
81314
|
+
workspaceId: true
|
|
81315
|
+
});
|
|
81316
|
+
var emptyDefinition = external_exports.object({});
|
|
80299
81317
|
var returnPathSchema = external_exports.string().max(500).regex(/^\/(?!\/)/, "a path on this site").optional();
|
|
80300
81318
|
var startCheckoutInputDefinition = external_exports.object({
|
|
80301
81319
|
workspaceId: external_exports.string().min(1),
|
|
@@ -80310,6 +81328,37 @@ var openPortalInputDefinition = external_exports.object({
|
|
|
80310
81328
|
var openPortalInputSchema = openPortalInputDefinition;
|
|
80311
81329
|
var redirectDefinition = external_exports.object({ url: external_exports.string() });
|
|
80312
81330
|
var billingRedirectSchema = redirectDefinition;
|
|
81331
|
+
var inviteQuoteInputDefinition = external_exports.object({
|
|
81332
|
+
workspaceId: external_exports.string().min(1),
|
|
81333
|
+
/** People about to be invited, beyond the members and the seats already held for invitations. */
|
|
81334
|
+
adding: external_exports.number().int().min(0).max(100)
|
|
81335
|
+
});
|
|
81336
|
+
var inviteQuoteInputSchema = inviteQuoteInputDefinition;
|
|
81337
|
+
var inviteQuoteByKeyInputDefinition = inviteQuoteInputDefinition.omit({ workspaceId: true });
|
|
81338
|
+
var inviteQuoteDefinition = external_exports.object({
|
|
81339
|
+
workspaceId: external_exports.string(),
|
|
81340
|
+
plan: planSchema,
|
|
81341
|
+
currency: currencySchema,
|
|
81342
|
+
rule: teamPricingRuleSchema,
|
|
81343
|
+
/** Members plus the seats held for invitations, now. */
|
|
81344
|
+
people: external_exports.number().int().nonnegative(),
|
|
81345
|
+
peopleAfter: external_exports.number().int().nonnegative(),
|
|
81346
|
+
/** What the workspace pays a month now: 0 on Free or a complimentary Team. */
|
|
81347
|
+
monthlyNow: external_exports.number().nonnegative(),
|
|
81348
|
+
monthlyAfter: external_exports.number().nonnegative(),
|
|
81349
|
+
perPersonAfter: external_exports.number().nonnegative(),
|
|
81350
|
+
/** Seats Team's first step still includes after the invite ("1 free seat left"); 0 when none. */
|
|
81351
|
+
freeSeatsLeft: external_exports.number().int().nonnegative().default(0),
|
|
81352
|
+
/** Free, or a Team not paid for: inviting starts Team through Stripe Checkout. */
|
|
81353
|
+
upgradeNeeded: external_exports.boolean(),
|
|
81354
|
+
/** A live paid Team: the new people are added to the subscription, prorated, as they join. */
|
|
81355
|
+
prorated: external_exports.boolean(),
|
|
81356
|
+
/** The most people the plan holds; null when it holds everyone. */
|
|
81357
|
+
seatCap: external_exports.number().int().positive().nullable(),
|
|
81358
|
+
/** How many of the added people the cap leaves waiting. */
|
|
81359
|
+
overCap: external_exports.number().int().nonnegative()
|
|
81360
|
+
});
|
|
81361
|
+
var inviteQuoteSchema = inviteQuoteDefinition;
|
|
80313
81362
|
var setCurrencyInputDefinition = external_exports.object({
|
|
80314
81363
|
workspaceId: external_exports.string().min(1),
|
|
80315
81364
|
currency: currencySchema
|
|
@@ -80336,6 +81385,23 @@ var applyReferralInputDefinition = external_exports.object({
|
|
|
80336
81385
|
code: external_exports.string().trim().min(1).max(64)
|
|
80337
81386
|
});
|
|
80338
81387
|
var applyReferralInputSchema = applyReferralInputDefinition;
|
|
81388
|
+
var referralCardDefinition = external_exports.object({
|
|
81389
|
+
show: external_exports.enum(["offer", "reward", "hidden"]),
|
|
81390
|
+
code: external_exports.string(),
|
|
81391
|
+
url: external_exports.string(),
|
|
81392
|
+
/** "50% off Team for a month". */
|
|
81393
|
+
offer: external_exports.string(),
|
|
81394
|
+
/** The last reward the workspace earned, for the `reward` card. */
|
|
81395
|
+
rewardedAt: external_exports.iso.datetime().nullable()
|
|
81396
|
+
});
|
|
81397
|
+
var referralCardSchema = referralCardDefinition;
|
|
81398
|
+
var claimReferralInputDefinition = external_exports.object({ code: external_exports.string().trim().min(1).max(64) });
|
|
81399
|
+
var claimReferralInputSchema = claimReferralInputDefinition;
|
|
81400
|
+
var claimReferralOutputDefinition = external_exports.object({
|
|
81401
|
+
outcome: external_exports.enum(["kept", "applied", "refused"]),
|
|
81402
|
+
reason: referralRefusalSchema.nullable()
|
|
81403
|
+
});
|
|
81404
|
+
var claimReferralOutputSchema = claimReferralOutputDefinition;
|
|
80339
81405
|
var usageCategorySchema = external_exports.enum([
|
|
80340
81406
|
"model",
|
|
80341
81407
|
"machine",
|
|
@@ -80373,7 +81439,7 @@ var grantCreditsInputDefinition = external_exports.object({
|
|
|
80373
81439
|
reason: external_exports.string().trim().min(3).max(500)
|
|
80374
81440
|
});
|
|
80375
81441
|
var BillingApi = moduleApi()("billing");
|
|
80376
|
-
var billingTrpc = defineTrpcContract("billing").query("account").withInput(billingWorkspaceInputSchema).withOutput(billingAccountViewSchema).query("invoices").withInput(billingWorkspaceInputSchema).withOutput(external_exports.array(billingInvoiceSchema)).mutation("startCheckout").withInput(startCheckoutInputSchema).withOutput(billingRedirectSchema).mutation("openPortal").withInput(openPortalInputSchema).withOutput(billingRedirectSchema).mutation("setCurrency").withInput(setCurrencyInputSchema).withOutput(billingAccountViewSchema).mutation("topUp").withInput(topUpInputSchema).withOutput(billingRedirectSchema).mutation("setAutoRecharge").withInput(setAutoRechargeInputSchema).withOutput(billingAccountViewSchema).mutation("applyReferral").withInput(applyReferralInputSchema).withOutput(billingAccountViewSchema).build();
|
|
81442
|
+
var billingTrpc = defineTrpcContract("billing").query("account").withInput(billingWorkspaceInputSchema).withOutput(billingAccountViewSchema).query("invoices").withInput(billingWorkspaceInputSchema).withOutput(external_exports.array(billingInvoiceSchema)).mutation("startCheckout").withInput(startCheckoutInputSchema).withOutput(billingRedirectSchema).query("inviteQuote").withInput(inviteQuoteInputSchema).withOutput(inviteQuoteSchema).mutation("openPortal").withInput(openPortalInputSchema).withOutput(billingRedirectSchema).mutation("setCurrency").withInput(setCurrencyInputSchema).withOutput(billingAccountViewSchema).mutation("topUp").withInput(topUpInputSchema).withOutput(billingRedirectSchema).mutation("setAutoRecharge").withInput(setAutoRechargeInputSchema).withOutput(billingAccountViewSchema).mutation("applyReferral").withInput(applyReferralInputSchema).withOutput(billingAccountViewSchema).query("referralCard").withInput(billingWorkspaceInputSchema).withOutput(referralCardSchema).mutation("dismissReferralCard").withInput(billingWorkspaceInputSchema).withOutput(referralCardSchema).mutation("claimReferral").withInput(claimReferralInputSchema).withOutput(claimReferralOutputSchema).query("billingDetails").withInput(billingWorkspaceInputSchema).withOutput(billingDetailsSchema).mutation("setBillingDetails").withInput(setBillingDetailsInputSchema).withOutput(billingDetailsSchema).mutation("cancelPlan").withInput(billingWorkspaceInputSchema).withOutput(billingAccountViewSchema).mutation("keepPlan").withInput(billingWorkspaceInputSchema).withOutput(billingAccountViewSchema).build();
|
|
80377
81443
|
var stripeWebhookHeadersDefinition = external_exports.object({
|
|
80378
81444
|
"stripe-signature": external_exports.string().max(1e3).default("")
|
|
80379
81445
|
});
|
|
@@ -80788,7 +81854,7 @@ var dedicatedIpKeyReleasedDefinition = external_exports.object({
|
|
|
80788
81854
|
});
|
|
80789
81855
|
|
|
80790
81856
|
// ../../modules/compute/contract/src/own-machine-ssh.ts
|
|
80791
|
-
var
|
|
81857
|
+
var workspaceIdSchema17 = external_exports.string().min(1).max(64);
|
|
80792
81858
|
var machineRefText = external_exports.string().min(1).max(64);
|
|
80793
81859
|
var sshHostKeySchema = external_exports.string().regex(/^SHA256:[A-Za-z0-9+/]{43}$/);
|
|
80794
81860
|
function sshTargetText({ target }) {
|
|
@@ -80810,7 +81876,7 @@ var machineSshDefinition = external_exports.object({
|
|
|
80810
81876
|
});
|
|
80811
81877
|
var machineSshSchema = machineSshDefinition;
|
|
80812
81878
|
var connectSshDefinition = external_exports.object({
|
|
80813
|
-
workspaceId:
|
|
81879
|
+
workspaceId: workspaceIdSchema17,
|
|
80814
81880
|
/** Checked by `checkMachineName`, so a refusal reads as a sentence. */
|
|
80815
81881
|
name: external_exports.string().max(200),
|
|
80816
81882
|
/** `user@host[:port]`, checked by `parseSshTarget`. */
|
|
@@ -80819,7 +81885,7 @@ var connectSshDefinition = external_exports.object({
|
|
|
80819
81885
|
var connectSshMachineInputSchema = connectSshDefinition;
|
|
80820
81886
|
var restConnectSshDefinition = connectSshDefinition.omit({ workspaceId: true });
|
|
80821
81887
|
var trustHostKeyDefinition = external_exports.object({
|
|
80822
|
-
workspaceId:
|
|
81888
|
+
workspaceId: workspaceIdSchema17,
|
|
80823
81889
|
machine: machineRefText,
|
|
80824
81890
|
hostKey: sshHostKeySchema
|
|
80825
81891
|
});
|
|
@@ -80827,7 +81893,7 @@ var trustHostKeyInputSchema = trustHostKeyDefinition;
|
|
|
80827
81893
|
var restTrustHostKeyDefinition = trustHostKeyDefinition.omit({ workspaceId: true });
|
|
80828
81894
|
|
|
80829
81895
|
// ../../modules/compute/contract/src/own-machine-whatsapp.ts
|
|
80830
|
-
var
|
|
81896
|
+
var workspaceIdSchema18 = external_exports.string().min(1).max(64);
|
|
80831
81897
|
var machineRefText2 = external_exports.string().min(1).max(64);
|
|
80832
81898
|
var WHATSAPP_TEXT_MAX = 4096;
|
|
80833
81899
|
var WHATSAPP_LIMIT_MAX = 200;
|
|
@@ -80864,25 +81930,25 @@ var messagesResultDefinition = external_exports.object({
|
|
|
80864
81930
|
var limitSchema = external_exports.number().int().min(1).max(WHATSAPP_LIMIT_MAX);
|
|
80865
81931
|
var chatRefSchema = external_exports.string().trim().min(1).max(200);
|
|
80866
81932
|
var chatsInputDefinition = external_exports.object({
|
|
80867
|
-
workspaceId:
|
|
81933
|
+
workspaceId: workspaceIdSchema18,
|
|
80868
81934
|
machine: machineRefText2,
|
|
80869
81935
|
limit: limitSchema.optional()
|
|
80870
81936
|
});
|
|
80871
81937
|
var readInputDefinition = external_exports.object({
|
|
80872
|
-
workspaceId:
|
|
81938
|
+
workspaceId: workspaceIdSchema18,
|
|
80873
81939
|
machine: machineRefText2,
|
|
80874
81940
|
/** A chat id, a phone number or a contact or group name. */
|
|
80875
81941
|
chat: chatRefSchema,
|
|
80876
81942
|
limit: limitSchema.optional()
|
|
80877
81943
|
});
|
|
80878
81944
|
var sendInputDefinition = external_exports.object({
|
|
80879
|
-
workspaceId:
|
|
81945
|
+
workspaceId: workspaceIdSchema18,
|
|
80880
81946
|
machine: machineRefText2,
|
|
80881
81947
|
chat: chatRefSchema,
|
|
80882
81948
|
text: external_exports.string().trim().min(1).max(WHATSAPP_TEXT_MAX)
|
|
80883
81949
|
});
|
|
80884
81950
|
var sendStatusInputDefinition = external_exports.object({
|
|
80885
|
-
workspaceId:
|
|
81951
|
+
workspaceId: workspaceIdSchema18,
|
|
80886
81952
|
sendId: external_exports.string().min(1).max(64),
|
|
80887
81953
|
/** Wait up to this long for the owner's answer; 0 answers at once. */
|
|
80888
81954
|
waitSeconds: external_exports.number().int().min(0).max(WHATSAPP_STATUS_WAIT_MAX_SECONDS).default(0)
|
|
@@ -80920,7 +81986,7 @@ var whatsappPairingDefinition = external_exports.object({
|
|
|
80920
81986
|
});
|
|
80921
81987
|
var whatsappPairingSchema = whatsappPairingDefinition;
|
|
80922
81988
|
var pairingRefDefinition = external_exports.object({
|
|
80923
|
-
workspaceId:
|
|
81989
|
+
workspaceId: workspaceIdSchema18,
|
|
80924
81990
|
pairingId: external_exports.string().min(1).max(64)
|
|
80925
81991
|
});
|
|
80926
81992
|
var whatsappPairingRefSchema = pairingRefDefinition;
|
|
@@ -80941,7 +82007,7 @@ var COMPUTE_WHATSAPP_REST_PATHS = {
|
|
|
80941
82007
|
};
|
|
80942
82008
|
|
|
80943
82009
|
// ../../modules/compute/contract/src/own-machine.ts
|
|
80944
|
-
var
|
|
82010
|
+
var workspaceIdSchema19 = external_exports.string().min(1).max(64);
|
|
80945
82011
|
var machineRefText3 = external_exports.string().min(1).max(64);
|
|
80946
82012
|
var machineBrowserDefinition = external_exports.object({
|
|
80947
82013
|
ready: external_exports.boolean(),
|
|
@@ -80974,7 +82040,7 @@ var machineHealthDefinition = external_exports.object({
|
|
|
80974
82040
|
});
|
|
80975
82041
|
var machineHealthSchema = machineHealthDefinition;
|
|
80976
82042
|
var connectOwnDefinition = external_exports.object({
|
|
80977
|
-
workspaceId:
|
|
82043
|
+
workspaceId: workspaceIdSchema19,
|
|
80978
82044
|
/** Checked by `checkMachineName`, so a refusal reads as a sentence. */
|
|
80979
82045
|
name: external_exports.string().max(200)
|
|
80980
82046
|
});
|
|
@@ -80982,7 +82048,7 @@ var connectOwnMachineInputSchema = connectOwnDefinition;
|
|
|
80982
82048
|
var MACHINE_EXEC_MAX_SECONDS = 240;
|
|
80983
82049
|
var MACHINE_EXEC_OUTPUT_BYTES = 1024 * 1024;
|
|
80984
82050
|
var execDefinition = external_exports.object({
|
|
80985
|
-
workspaceId:
|
|
82051
|
+
workspaceId: workspaceIdSchema19,
|
|
80986
82052
|
machine: machineRefText3,
|
|
80987
82053
|
command: external_exports.string().min(1).max(64 * 1024),
|
|
80988
82054
|
timeoutSeconds: external_exports.number().int().min(1).max(MACHINE_EXEC_MAX_SECONDS).optional(),
|
|
@@ -81054,14 +82120,14 @@ function gigabytes(bytes) {
|
|
|
81054
82120
|
}
|
|
81055
82121
|
var hostWhenOfflineSchema = external_exports.enum(["wait", "sandbox"]);
|
|
81056
82122
|
var hostAgentDefinition = external_exports.object({
|
|
81057
|
-
workspaceId:
|
|
82123
|
+
workspaceId: workspaceIdSchema19,
|
|
81058
82124
|
machine: machineRefText3,
|
|
81059
82125
|
agentId: external_exports.string().min(1).max(64),
|
|
81060
82126
|
whenOffline: hostWhenOfflineSchema.default("wait")
|
|
81061
82127
|
});
|
|
81062
82128
|
var hostAgentInputSchema = hostAgentDefinition;
|
|
81063
82129
|
var unhostAgentDefinition = external_exports.object({
|
|
81064
|
-
workspaceId:
|
|
82130
|
+
workspaceId: workspaceIdSchema19,
|
|
81065
82131
|
agentId: external_exports.string().min(1).max(64)
|
|
81066
82132
|
});
|
|
81067
82133
|
var unhostAgentInputSchema = unhostAgentDefinition;
|
|
@@ -81080,8 +82146,8 @@ var agentHostGrantDefinition = external_exports.object({
|
|
|
81080
82146
|
});
|
|
81081
82147
|
|
|
81082
82148
|
// ../../modules/compute/contract/src/compute.ts
|
|
81083
|
-
var
|
|
81084
|
-
var
|
|
82149
|
+
var idSchema21 = external_exports.string().min(1).max(64);
|
|
82150
|
+
var workspaceIdSchema20 = external_exports.string().min(1).max(64);
|
|
81085
82151
|
var machineStateSchema = external_exports.enum([
|
|
81086
82152
|
"starting",
|
|
81087
82153
|
"ready",
|
|
@@ -81102,24 +82168,24 @@ var machinePriceDefinition = external_exports.object({
|
|
|
81102
82168
|
asleepMonthUsd: external_exports.number()
|
|
81103
82169
|
});
|
|
81104
82170
|
var machineGranteeKindSchema = external_exports.enum(["member", "agent"]);
|
|
81105
|
-
var machineGranteeDefinition = external_exports.object({ kind: machineGranteeKindSchema, id:
|
|
82171
|
+
var machineGranteeDefinition = external_exports.object({ kind: machineGranteeKindSchema, id: idSchema21 });
|
|
81106
82172
|
var machineGrantDefinition = external_exports.object({
|
|
81107
82173
|
kind: machineGranteeKindSchema,
|
|
81108
|
-
id:
|
|
81109
|
-
grantedByUserId:
|
|
82174
|
+
id: idSchema21,
|
|
82175
|
+
grantedByUserId: idSchema21,
|
|
81110
82176
|
grantedAt: external_exports.iso.datetime()
|
|
81111
82177
|
});
|
|
81112
82178
|
var machineDefinition = external_exports.object({
|
|
81113
|
-
id:
|
|
81114
|
-
workspaceId:
|
|
82179
|
+
id: idSchema21,
|
|
82180
|
+
workspaceId: workspaceIdSchema20,
|
|
81115
82181
|
name: external_exports.string(),
|
|
81116
82182
|
type: machineTypeSchema,
|
|
81117
82183
|
zone: external_exports.string(),
|
|
81118
82184
|
state: machineStateSchema,
|
|
81119
|
-
ownerUserId:
|
|
81120
|
-
requesterUserId:
|
|
81121
|
-
renterAgentId:
|
|
81122
|
-
channelId:
|
|
82185
|
+
ownerUserId: idSchema21,
|
|
82186
|
+
requesterUserId: idSchema21,
|
|
82187
|
+
renterAgentId: idSchema21.nullable(),
|
|
82188
|
+
channelId: idSchema21.nullable(),
|
|
81123
82189
|
ipAddress: external_exports.string().nullable(),
|
|
81124
82190
|
sites: external_exports.array(machineSiteDefinition),
|
|
81125
82191
|
/** Members and agents the owner shared the machine with, beyond the owner's own agents. */
|
|
@@ -81151,7 +82217,7 @@ var machineDefinition = external_exports.object({
|
|
|
81151
82217
|
/** The owner's agents set to run on this own machine. */
|
|
81152
82218
|
hostedAgents: external_exports.array(
|
|
81153
82219
|
external_exports.object({
|
|
81154
|
-
id:
|
|
82220
|
+
id: idSchema21,
|
|
81155
82221
|
name: external_exports.string(),
|
|
81156
82222
|
whenOffline: external_exports.enum(["wait", "sandbox"])
|
|
81157
82223
|
})
|
|
@@ -81162,23 +82228,23 @@ var machineDefinition = external_exports.object({
|
|
|
81162
82228
|
var machineSchema = machineDefinition;
|
|
81163
82229
|
var computeStatusDefinition = external_exports.object({ available: external_exports.boolean() });
|
|
81164
82230
|
var computeStatusSchema = computeStatusDefinition;
|
|
81165
|
-
var workspaceInputDefinition2 = external_exports.object({ workspaceId:
|
|
82231
|
+
var workspaceInputDefinition2 = external_exports.object({ workspaceId: workspaceIdSchema20 });
|
|
81166
82232
|
var computeWorkspaceInputSchema = workspaceInputDefinition2;
|
|
81167
82233
|
var machineRefDefinition = external_exports.object({
|
|
81168
|
-
workspaceId:
|
|
82234
|
+
workspaceId: workspaceIdSchema20,
|
|
81169
82235
|
machine: external_exports.string().min(1).max(64)
|
|
81170
82236
|
});
|
|
81171
82237
|
var machineRefSchema = machineRefDefinition;
|
|
81172
82238
|
var MACHINE_NAME_MAX = 40;
|
|
81173
82239
|
var machineNameSchema = external_exports.string().min(2).max(MACHINE_NAME_MAX).regex(/^[a-z0-9][a-z0-9-]*$/, "lowercase letters, digits and dashes");
|
|
81174
82240
|
var renameDefinition = external_exports.object({
|
|
81175
|
-
workspaceId:
|
|
82241
|
+
workspaceId: workspaceIdSchema20,
|
|
81176
82242
|
machine: external_exports.string().min(1).max(64),
|
|
81177
82243
|
name: external_exports.string().max(200)
|
|
81178
82244
|
});
|
|
81179
82245
|
var renameMachineInputSchema = renameDefinition;
|
|
81180
82246
|
var setupBrowserDefinition = external_exports.object({
|
|
81181
|
-
workspaceId:
|
|
82247
|
+
workspaceId: workspaceIdSchema20,
|
|
81182
82248
|
/** The site the person signs in to, as a host or a URL. */
|
|
81183
82249
|
site: external_exports.string().min(1).max(500),
|
|
81184
82250
|
name: machineNameSchema.optional(),
|
|
@@ -81187,29 +82253,29 @@ var setupBrowserDefinition = external_exports.object({
|
|
|
81187
82253
|
});
|
|
81188
82254
|
var setupBrowserInputSchema = setupBrowserDefinition;
|
|
81189
82255
|
var grantDefinition = external_exports.object({
|
|
81190
|
-
workspaceId:
|
|
82256
|
+
workspaceId: workspaceIdSchema20,
|
|
81191
82257
|
machine: external_exports.string().min(1).max(64),
|
|
81192
82258
|
grantee: machineGranteeDefinition
|
|
81193
82259
|
});
|
|
81194
82260
|
var machineGrantInputSchema = grantDefinition;
|
|
81195
82261
|
var setBudgetDefinition = external_exports.object({
|
|
81196
|
-
workspaceId:
|
|
82262
|
+
workspaceId: workspaceIdSchema20,
|
|
81197
82263
|
machine: external_exports.string().min(1).max(64),
|
|
81198
82264
|
budgetUsd: external_exports.number().min(0).max(1e4),
|
|
81199
82265
|
period: machineBudgetPeriodSchema
|
|
81200
82266
|
});
|
|
81201
82267
|
var setMachineBudgetInputSchema = setBudgetDefinition;
|
|
81202
82268
|
var openScreenDefinition = external_exports.object({
|
|
81203
|
-
workspaceId:
|
|
82269
|
+
workspaceId: workspaceIdSchema20,
|
|
81204
82270
|
machine: external_exports.string().min(1).max(64),
|
|
81205
82271
|
site: external_exports.string().min(1).max(500).optional()
|
|
81206
82272
|
});
|
|
81207
82273
|
var openScreenInputSchema = openScreenDefinition;
|
|
81208
|
-
var screenRefDefinition = external_exports.object({ workspaceId:
|
|
82274
|
+
var screenRefDefinition = external_exports.object({ workspaceId: workspaceIdSchema20, sessionId: idSchema21 });
|
|
81209
82275
|
var screenRefSchema = screenRefDefinition;
|
|
81210
82276
|
var screenSessionDefinition = external_exports.object({
|
|
81211
|
-
sessionId:
|
|
81212
|
-
machineId:
|
|
82277
|
+
sessionId: idSchema21,
|
|
82278
|
+
machineId: idSchema21,
|
|
81213
82279
|
machineName: external_exports.string(),
|
|
81214
82280
|
site: external_exports.string().nullable(),
|
|
81215
82281
|
expiresAt: external_exports.iso.datetime(),
|
|
@@ -81243,7 +82309,7 @@ var ownMachineSshConnectDefinition = external_exports.object({
|
|
|
81243
82309
|
publicKey: external_exports.string()
|
|
81244
82310
|
});
|
|
81245
82311
|
var ownMachineSshConnectSchema = ownMachineSshConnectDefinition;
|
|
81246
|
-
var reconcileDefinition = external_exports.object({ workspaceId:
|
|
82312
|
+
var reconcileDefinition = external_exports.object({ workspaceId: workspaceIdSchema20, machineId: idSchema21 });
|
|
81247
82313
|
var ComputeApi = moduleApi()("compute");
|
|
81248
82314
|
var computeCoreTrpc = defineTrpcContract("compute").query("status").withInput(computeWorkspaceInputSchema).withOutput(computeStatusSchema).query("browserTabs").withInput(browserTabListInputSchema).withOutput(browserTabListSchema).query("browserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("openBrowserTab").withInput(openBrowserTabInputSchema).withOutput(browserTabSchema).mutation("browserTabScreen").withInput(browserTabInputSchema).withOutput(browserTabScreenSchema).mutation("sizeBrowserTabScreen").withInput(browserTabScreenSizeInputSchema).withOutput(browserTabScreenSizeSchema).mutation("gotoBrowserTab").withInput(browserTabGotoInputSchema).withOutput(browserTabPageSchema).mutation("doneOnBrowserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("shareBrowserTab").withInput(browserTabShareInputSchema).withOutput(browserTabSchema).mutation("closeBrowserTab").withInput(browserTabInputSchema).withOutput(external_exports.object({ closed: external_exports.literal(true) })).query("computer").withInput(computeWorkspaceInputSchema).withOutput(computerStatusSchema).mutation("setComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerSizeAnswerSchema).mutation("requestComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerRequestSchema).mutation("cancelComputerRequest").withInput(computerRequestRefSchema).withOutput(computerRequestSchema).mutation("restartComputer").withInput(restartComputerInputSchema).withOutput(computerRestartAnswerSchema).query("computers").withInput(computeWorkspaceInputSchema).withOutput(computerListSchema).query("dedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpStatusSchema).mutation("setDedicatedIp").withInput(setDedicatedIpInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("turnOffDedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("setDedicatedIpDomains").withInput(setDedicatedIpDomainsInputSchema).withOutput(dedicatedIpAnswerSchema).query("dedicatedIps").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpListSchema).query("dedicatedIpCountries").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpCountriesSchema).query("dedicatedIpOffer").withInput(dedicatedIpOfferInputSchema).withOutput(dedicatedIpOfferSchema).query("list").withInput(computeWorkspaceInputSchema).withOutput(external_exports.array(machineSchema)).query("get").withInput(machineRefSchema).withOutput(machineSchema).mutation("setupBrowser").withInput(setupBrowserInputSchema).withOutput(machineSchema).mutation("sleep").withInput(machineRefSchema).withOutput(machineSchema).mutation("wake").withInput(machineRefSchema).withOutput(machineSchema).mutation("delete").withInput(machineRefSchema).withOutput(machineSchema).mutation("rename").withInput(renameMachineInputSchema).withOutput(machineSchema).mutation("grant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("revokeGrant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("setBudget").withInput(setMachineBudgetInputSchema).withOutput(machineSchema).mutation("openScreen").withInput(openScreenInputSchema).withOutput(screenSessionSchema).mutation("finishScreen").withInput(screenRefSchema).withOutput(machineSchema).mutation("connectOwn").withInput(connectOwnMachineInputSchema).withOutput(ownMachineConnectSchema).mutation("newConnectCommand").withInput(machineRefSchema).withOutput(ownMachineConnectSchema).mutation("connectSsh").withInput(connectSshMachineInputSchema).withOutput(ownMachineSshConnectSchema).mutation("trustHostKey").withInput(trustHostKeyInputSchema).withOutput(machineSchema).mutation("checkHealth").withInput(machineRefSchema).withOutput(machineSchema).mutation("hostAgent").withInput(hostAgentInputSchema).withOutput(machineSchema).mutation("unhostAgent").withInput(unhostAgentInputSchema).withOutput(external_exports.object({ agentId: external_exports.string() })).mutation("pairWhatsapp").withInput(machineRefSchema).withOutput(whatsappPairingSchema).query("whatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("cancelWhatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("unpairWhatsapp").withInput(machineRefSchema).withOutput(machineSchema).build();
|
|
81249
82315
|
var computeFleetTrpc = defineTrpcContract("compute").query("myComputers").withInput(computeWorkspaceInputSchema).withOutput(myComputersSchema).mutation("createComputer").withInput(createComputerInputSchema).withOutput(computerStatusSchema).mutation("deleteComputer").withInput(deleteComputerInputSchema).withOutput(deleteComputerAnswerSchema).mutation("setComputerCreators").withInput(setComputerCreatorsInputSchema).withOutput(computerStatusSchema).mutation("setAgentComputer").withInput(setAgentComputerInputSchema).withOutput(agentComputerAnswerSchema).build();
|
|
@@ -81341,9 +82407,9 @@ function creatorsOf(args) {
|
|
|
81341
82407
|
return { everyone: args.flags.everyone === true, userIds };
|
|
81342
82408
|
}
|
|
81343
82409
|
function lineOf3(computer2) {
|
|
81344
|
-
const
|
|
82410
|
+
const money3 = `${computer2.monthlyCharge} ${computer2.currency.toUpperCase()} a month`;
|
|
81345
82411
|
const agents = `${computer2.agents.length} agent(s)`;
|
|
81346
|
-
return ` ${computer2.computerId} ${computer2.name} ${computer2.kind} ${computer2.size} ${
|
|
82412
|
+
return ` ${computer2.computerId} ${computer2.name} ${computer2.kind} ${computer2.size} ${money3} ${agents} ${computer2.state}`;
|
|
81347
82413
|
}
|
|
81348
82414
|
async function mine({ context, args }) {
|
|
81349
82415
|
const client = await computeClient({ context, args });
|
|
@@ -81532,7 +82598,7 @@ Message to forward: ${answer5.message}
|
|
|
81532
82598
|
`
|
|
81533
82599
|
);
|
|
81534
82600
|
}
|
|
81535
|
-
async function
|
|
82601
|
+
async function cancel2({ context, args }) {
|
|
81536
82602
|
const requestId = args.words[2];
|
|
81537
82603
|
if (!requestId) throw new CliUsageError(COMPUTER_USAGE);
|
|
81538
82604
|
const client = await computeClient({ context, args });
|
|
@@ -81561,9 +82627,9 @@ async function list2({ context, args }) {
|
|
|
81561
82627
|
const client = await computeClient({ context, args });
|
|
81562
82628
|
const answer5 = await client.get(COMPUTER_REST_PATHS.all);
|
|
81563
82629
|
if (args.flags.json) return printJson3(context, answer5);
|
|
81564
|
-
const
|
|
82630
|
+
const money3 = (amount) => `${amount} ${answer5.currency.toUpperCase()}`;
|
|
81565
82631
|
const lines2 = answer5.computers.map(
|
|
81566
|
-
(one) => ` ${one.name ?? one.ownerName} ${one.size} ${
|
|
82632
|
+
(one) => ` ${one.name ?? one.ownerName} ${one.size} ${money3(one.monthlyCharge)} a month ${one.agents} agent(s) ${one.state}`
|
|
81567
82633
|
);
|
|
81568
82634
|
context.out(
|
|
81569
82635
|
`Everyone's computers (${answer5.includedSize} included per person):
|
|
@@ -81576,7 +82642,7 @@ var COMPUTER_COMMANDS = {
|
|
|
81576
82642
|
sizes,
|
|
81577
82643
|
upgrade,
|
|
81578
82644
|
request,
|
|
81579
|
-
cancel,
|
|
82645
|
+
cancel: cancel2,
|
|
81580
82646
|
restart,
|
|
81581
82647
|
list: list2,
|
|
81582
82648
|
...COMPUTER_FLEET_COMMANDS
|
|
@@ -81590,10 +82656,10 @@ async function computer({ context, args }) {
|
|
|
81590
82656
|
}
|
|
81591
82657
|
|
|
81592
82658
|
// src/services/connect-commands.service.ts
|
|
81593
|
-
import { readFile as
|
|
82659
|
+
import { readFile as readFile24 } from "node:fs/promises";
|
|
81594
82660
|
|
|
81595
82661
|
// src/services/mcp-gateway.service.ts
|
|
81596
|
-
import { readFile as
|
|
82662
|
+
import { readFile as readFile23 } from "node:fs/promises";
|
|
81597
82663
|
import { createInterface as createInterface3 } from "node:readline";
|
|
81598
82664
|
var TURN_HEADER = "x-laze-turn";
|
|
81599
82665
|
function serveMcpGateway({
|
|
@@ -81636,7 +82702,7 @@ async function relayMcpLines({
|
|
|
81636
82702
|
const github3 = env.LAZE_GITHUB_CONNECTION;
|
|
81637
82703
|
const url2 = `${profile.url.replace(/\/+$/, "")}/api/connectors/mcp/${encodeURIComponent(profile.agentId)}${github3 ? `?github=${encodeURIComponent(github3)}` : ""}`;
|
|
81638
82704
|
const turnFile = env.LAZE_TURN_FILE;
|
|
81639
|
-
const readTurn = () =>
|
|
82705
|
+
const readTurn = () => readFile23(turnFile, "utf8").then(
|
|
81640
82706
|
(text2) => text2.trim(),
|
|
81641
82707
|
() => ""
|
|
81642
82708
|
);
|
|
@@ -81726,7 +82792,7 @@ async function turnOf({ context }) {
|
|
|
81726
82792
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
81727
82793
|
if (pinned) return pinned;
|
|
81728
82794
|
const file3 = env.LAZE_TURN_FILE;
|
|
81729
|
-
const turn = file3 ? await
|
|
82795
|
+
const turn = file3 ? await readFile24(file3, "utf8").then(
|
|
81730
82796
|
(text2) => text2.trim(),
|
|
81731
82797
|
() => ""
|
|
81732
82798
|
) : "";
|
|
@@ -81784,11 +82850,11 @@ async function connect({
|
|
|
81784
82850
|
}
|
|
81785
82851
|
|
|
81786
82852
|
// src/services/connector-commands.service.ts
|
|
81787
|
-
import { readFile as
|
|
82853
|
+
import { readFile as readFile26 } from "node:fs/promises";
|
|
81788
82854
|
import { resolve as resolve8 } from "node:path";
|
|
81789
82855
|
|
|
81790
82856
|
// src/services/vault-keychain-commands.service.ts
|
|
81791
|
-
import { readFile as
|
|
82857
|
+
import { readFile as readFile25 } from "node:fs/promises";
|
|
81792
82858
|
|
|
81793
82859
|
// src/rules/vault-input.rules.ts
|
|
81794
82860
|
function secondsOf(text2) {
|
|
@@ -82168,7 +83234,7 @@ async function secretText({ context, args }) {
|
|
|
82168
83234
|
);
|
|
82169
83235
|
}
|
|
82170
83236
|
const file3 = flagText({ args, name: "from-file" });
|
|
82171
|
-
const text2 = file3 ? await
|
|
83237
|
+
const text2 = file3 ? await readFile25(file3, "utf8") : await context.readStdin();
|
|
82172
83238
|
const trimmed = text2.replace(/\r?\n$/, "");
|
|
82173
83239
|
if (!trimmed.trim()) throw new CliUsageError("No value: pipe it on stdin or use --from-file.");
|
|
82174
83240
|
return trimmed;
|
|
@@ -82397,7 +83463,7 @@ async function keyText({ context, args }) {
|
|
|
82397
83463
|
throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
|
|
82398
83464
|
}
|
|
82399
83465
|
const file3 = flagText({ args, name: "from-file" });
|
|
82400
|
-
const text2 = file3 ? await
|
|
83466
|
+
const text2 = file3 ? await readFile26(resolve8(context.cwd, file3), "utf8") : await context.readStdin();
|
|
82401
83467
|
const trimmed = text2.trim();
|
|
82402
83468
|
if (!trimmed) throw new CliUsageError("No key: pipe it on stdin or use --from-file.");
|
|
82403
83469
|
return trimmed;
|
|
@@ -82715,12 +83781,12 @@ async function conversationDelete({ context, args }) {
|
|
|
82715
83781
|
}
|
|
82716
83782
|
|
|
82717
83783
|
// src/services/discord-commands.service.ts
|
|
82718
|
-
import { readFile as
|
|
83784
|
+
import { readFile as readFile27 } from "node:fs/promises";
|
|
82719
83785
|
import { resolve as resolve9 } from "node:path";
|
|
82720
83786
|
|
|
82721
83787
|
// ../../modules/discord/contract/src/discord.ts
|
|
82722
|
-
var
|
|
82723
|
-
var workspaceInput4 = external_exports.object({ workspaceId:
|
|
83788
|
+
var workspaceIdSchema21 = external_exports.string().min(1).max(64);
|
|
83789
|
+
var workspaceInput4 = external_exports.object({ workspaceId: workspaceIdSchema21 });
|
|
82724
83790
|
var discordIdSchema = external_exports.string().regex(/^\d{5,25}$/);
|
|
82725
83791
|
var DISCORD_PERMISSIONS = {
|
|
82726
83792
|
ADMINISTRATOR: 1n << 3n,
|
|
@@ -82802,10 +83868,10 @@ var discordChannelViewDefinition = external_exports.object({
|
|
|
82802
83868
|
url: external_exports.url()
|
|
82803
83869
|
});
|
|
82804
83870
|
var discordChannelViewSchema = discordChannelViewDefinition;
|
|
82805
|
-
var guildInputDefinition = external_exports.object({ workspaceId:
|
|
83871
|
+
var guildInputDefinition = external_exports.object({ workspaceId: workspaceIdSchema21, guildId: discordIdSchema });
|
|
82806
83872
|
var discordGuildInputSchema = guildInputDefinition;
|
|
82807
83873
|
var saveDiscordAppDefinition = external_exports.object({
|
|
82808
|
-
workspaceId:
|
|
83874
|
+
workspaceId: workspaceIdSchema21,
|
|
82809
83875
|
setupKey: external_exports.string().min(1).max(64),
|
|
82810
83876
|
applicationId: external_exports.string().trim().max(40),
|
|
82811
83877
|
clientSecret: external_exports.string().trim().max(200),
|
|
@@ -82815,7 +83881,7 @@ var saveDiscordAppInputSchema = saveDiscordAppDefinition;
|
|
|
82815
83881
|
var startedAuthorizeDefinition = external_exports.object({ authorizeUrl: external_exports.url() });
|
|
82816
83882
|
var startedDiscordAuthorizeSchema = startedAuthorizeDefinition;
|
|
82817
83883
|
var pickDefinition = external_exports.object({
|
|
82818
|
-
workspaceId:
|
|
83884
|
+
workspaceId: workspaceIdSchema21,
|
|
82819
83885
|
guildId: discordIdSchema,
|
|
82820
83886
|
channelId: discordIdSchema,
|
|
82821
83887
|
picked: external_exports.boolean(),
|
|
@@ -82823,7 +83889,7 @@ var pickDefinition = external_exports.object({
|
|
|
82823
83889
|
});
|
|
82824
83890
|
var discordPickInputSchema = pickDefinition;
|
|
82825
83891
|
var updateConnectionDefinition = external_exports.object({
|
|
82826
|
-
workspaceId:
|
|
83892
|
+
workspaceId: workspaceIdSchema21,
|
|
82827
83893
|
guildId: discordIdSchema,
|
|
82828
83894
|
label: external_exports.string().trim().max(80).nullable().optional(),
|
|
82829
83895
|
cacheDays: external_exports.number().int().min(1).max(30).optional()
|
|
@@ -82836,9 +83902,9 @@ var oauthCallbackDefinition = external_exports.object({
|
|
|
82836
83902
|
permissions: external_exports.string().max(40).optional(),
|
|
82837
83903
|
error: external_exports.string().max(200).optional()
|
|
82838
83904
|
});
|
|
82839
|
-
var linkParamsDefinition = external_exports.object({ workspaceId:
|
|
83905
|
+
var linkParamsDefinition = external_exports.object({ workspaceId: workspaceIdSchema21, guildId: discordIdSchema });
|
|
82840
83906
|
var historyInputDefinition = external_exports.object({
|
|
82841
|
-
workspaceId:
|
|
83907
|
+
workspaceId: workspaceIdSchema21,
|
|
82842
83908
|
/** The Laze conversation that mirrors the Discord channel. */
|
|
82843
83909
|
channelId: external_exports.string().min(1).max(200),
|
|
82844
83910
|
before: external_exports.iso.datetime()
|
|
@@ -82867,7 +83933,7 @@ var historyPageDefinition = external_exports.object({
|
|
|
82867
83933
|
});
|
|
82868
83934
|
var discordHistoryPageSchema = historyPageDefinition;
|
|
82869
83935
|
var fileParamsDefinition = external_exports.object({
|
|
82870
|
-
workspaceId:
|
|
83936
|
+
workspaceId: workspaceIdSchema21,
|
|
82871
83937
|
channelId: external_exports.string().min(1).max(200),
|
|
82872
83938
|
messageId: discordIdSchema,
|
|
82873
83939
|
attachmentId: discordIdSchema
|
|
@@ -82882,7 +83948,7 @@ var saveAppByKeyDefinition = external_exports.object({
|
|
|
82882
83948
|
var pickByKeyDefinition = pickDefinition.omit({ workspaceId: true });
|
|
82883
83949
|
var updateByKeyDefinition = updateConnectionDefinition.omit({ workspaceId: true });
|
|
82884
83950
|
var historyByKeyDefinition = historyInputDefinition.omit({ workspaceId: true });
|
|
82885
|
-
var
|
|
83951
|
+
var emptyDefinition2 = external_exports.object({});
|
|
82886
83952
|
var DISCORD_KEY_PATHS = {
|
|
82887
83953
|
overview: "/api/discord/overview",
|
|
82888
83954
|
beginSetup: "/api/discord/setup",
|
|
@@ -83037,7 +84103,7 @@ async function secretsOf({ context, args }) {
|
|
|
83037
84103
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
83038
84104
|
if (fromConnection) return { fromConnection };
|
|
83039
84105
|
const file3 = flagText({ args, name: "from-file" });
|
|
83040
|
-
const text2 = file3 ? await
|
|
84106
|
+
const text2 = file3 ? await readFile27(resolve9(context.cwd, file3), "utf8") : await context.readStdin();
|
|
83041
84107
|
const lines2 = text2.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
83042
84108
|
if (lines2.length !== 2) {
|
|
83043
84109
|
throw new CliUsageError(
|
|
@@ -83307,8 +84373,8 @@ var DOMAINS_USAGE = `Usage:
|
|
|
83307
84373
|
var printJson5 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
|
|
83308
84374
|
`);
|
|
83309
84375
|
function printDomain(context, row) {
|
|
83310
|
-
const
|
|
83311
|
-
context.out(`${row.domain} ${
|
|
84376
|
+
const join28 = row.autoJoin ? "auto-join on" : "auto-join off";
|
|
84377
|
+
context.out(`${row.domain} ${join28}${row.enforced ? " single sign-on enforced" : ""}
|
|
83312
84378
|
`);
|
|
83313
84379
|
}
|
|
83314
84380
|
async function list4({ context, args }) {
|
|
@@ -83340,7 +84406,7 @@ async function domains({ context, args }) {
|
|
|
83340
84406
|
}
|
|
83341
84407
|
|
|
83342
84408
|
// src/services/emoji-commands.service.ts
|
|
83343
|
-
import { readFile as
|
|
84409
|
+
import { readFile as readFile28 } from "node:fs/promises";
|
|
83344
84410
|
import { resolve as resolve10 } from "node:path";
|
|
83345
84411
|
var EMOJI_USAGE = `Usage:
|
|
83346
84412
|
laze emoji list [--json] the workspace's custom emoji, aliases and who added each
|
|
@@ -83381,7 +84447,7 @@ async function addEmoji({ context, args, client }) {
|
|
|
83381
84447
|
const file3 = wordAt4(args, 3);
|
|
83382
84448
|
let bytes;
|
|
83383
84449
|
try {
|
|
83384
|
-
bytes = new Uint8Array(await
|
|
84450
|
+
bytes = new Uint8Array(await readFile28(resolve10(context.cwd, file3)));
|
|
83385
84451
|
} catch {
|
|
83386
84452
|
throw new CliUsageError(`Cannot read ${file3}.`);
|
|
83387
84453
|
}
|
|
@@ -83447,10 +84513,10 @@ var EXTERNAL_CONNECTION_REST_PATHS = {
|
|
|
83447
84513
|
block: "/api/external-connections/block",
|
|
83448
84514
|
report: "/api/external-connections/report"
|
|
83449
84515
|
};
|
|
83450
|
-
var
|
|
83451
|
-
var
|
|
84516
|
+
var workspaceIdSchema22 = external_exports.string().min(1).max(64);
|
|
84517
|
+
var idSchema22 = external_exports.string().min(1).max(64);
|
|
83452
84518
|
var iso = external_exports.iso.datetime();
|
|
83453
|
-
var workspaceInput5 = external_exports.object({ workspaceId:
|
|
84519
|
+
var workspaceInput5 = external_exports.object({ workspaceId: workspaceIdSchema22 });
|
|
83454
84520
|
var connectionReference = external_exports.string().trim().min(1).max(120);
|
|
83455
84521
|
var externalConnectionStateSchema = external_exports.enum(["active", "ended"]);
|
|
83456
84522
|
var externalInviteStateSchema = external_exports.enum([
|
|
@@ -83554,10 +84620,10 @@ var rosterDefinition = external_exports.object({
|
|
|
83554
84620
|
members: external_exports.array(rosterMemberDefinition)
|
|
83555
84621
|
});
|
|
83556
84622
|
var externalRosterSchema = rosterDefinition;
|
|
83557
|
-
var rosterInputDefinition = external_exports.object({ workspaceId:
|
|
84623
|
+
var rosterInputDefinition = external_exports.object({ workspaceId: workspaceIdSchema22, channelId: idSchema22 });
|
|
83558
84624
|
var externalRosterInputSchema = rosterInputDefinition;
|
|
83559
84625
|
var inviteInputDefinition = external_exports.object({
|
|
83560
|
-
workspaceId:
|
|
84626
|
+
workspaceId: workspaceIdSchema22,
|
|
83561
84627
|
email: external_exports.email().max(320),
|
|
83562
84628
|
/** The first channel to share, by id or name; it is shared once the invitation is accepted. */
|
|
83563
84629
|
share: external_exports.string().trim().min(1).max(81).optional(),
|
|
@@ -83565,7 +84631,7 @@ var inviteInputDefinition = external_exports.object({
|
|
|
83565
84631
|
company: external_exports.string().trim().min(1).max(80).optional()
|
|
83566
84632
|
});
|
|
83567
84633
|
var externalInviteInputSchema = inviteInputDefinition;
|
|
83568
|
-
var inviteRefDefinition = external_exports.object({ workspaceId:
|
|
84634
|
+
var inviteRefDefinition = external_exports.object({ workspaceId: workspaceIdSchema22, inviteId: idSchema22 });
|
|
83569
84635
|
var externalInviteRefSchema = inviteRefDefinition;
|
|
83570
84636
|
var pendingShareDefinition = external_exports.object({
|
|
83571
84637
|
channelId: external_exports.string(),
|
|
@@ -83589,8 +84655,8 @@ var pendingSharesDefinition = external_exports.object({
|
|
|
83589
84655
|
var externalPendingSharesSchema = pendingSharesDefinition;
|
|
83590
84656
|
var acceptInviteDefinition = external_exports.object({
|
|
83591
84657
|
/** The workspace to connect: one where the person is Admin or Owner. */
|
|
83592
|
-
workspaceId:
|
|
83593
|
-
inviteId:
|
|
84658
|
+
workspaceId: workspaceIdSchema22,
|
|
84659
|
+
inviteId: idSchema22,
|
|
83594
84660
|
/** The emailed link's secret; without it the invitation must be addressed to the person. */
|
|
83595
84661
|
secret: external_exports.string().trim().max(200).optional()
|
|
83596
84662
|
});
|
|
@@ -83598,40 +84664,40 @@ var externalAcceptInviteInputSchema = acceptInviteDefinition;
|
|
|
83598
84664
|
var answeredDefinition = external_exports.object({ id: external_exports.string(), state: externalInviteStateSchema });
|
|
83599
84665
|
var externalInviteAnsweredSchema = answeredDefinition;
|
|
83600
84666
|
var connectionInputDefinition = external_exports.object({
|
|
83601
|
-
workspaceId:
|
|
84667
|
+
workspaceId: workspaceIdSchema22,
|
|
83602
84668
|
connection: connectionReference
|
|
83603
84669
|
});
|
|
83604
84670
|
var externalConnectionInputSchema = connectionInputDefinition;
|
|
83605
84671
|
var settingsInputDefinition = external_exports.object({
|
|
83606
|
-
workspaceId:
|
|
84672
|
+
workspaceId: workspaceIdSchema22,
|
|
83607
84673
|
connection: connectionReference,
|
|
83608
84674
|
agentsAllowed: external_exports.boolean().optional(),
|
|
83609
84675
|
directAllowed: external_exports.boolean().optional()
|
|
83610
84676
|
});
|
|
83611
84677
|
var externalSettingsInputSchema = settingsInputDefinition;
|
|
83612
84678
|
var shareInputDefinition = external_exports.object({
|
|
83613
|
-
workspaceId:
|
|
84679
|
+
workspaceId: workspaceIdSchema22,
|
|
83614
84680
|
connection: connectionReference,
|
|
83615
84681
|
/** The channel as its id or name, `#` optional. */
|
|
83616
84682
|
channel: external_exports.string().trim().min(1).max(81)
|
|
83617
84683
|
});
|
|
83618
84684
|
var externalShareInputSchema = shareInputDefinition;
|
|
83619
84685
|
var acceptShareDefinition = external_exports.object({
|
|
83620
|
-
workspaceId:
|
|
83621
|
-
shareId:
|
|
84686
|
+
workspaceId: workspaceIdSchema22,
|
|
84687
|
+
shareId: idSchema22,
|
|
83622
84688
|
/** Its name here; the host's name when left out. */
|
|
83623
84689
|
name: external_exports.string().trim().min(1).max(80).optional(),
|
|
83624
84690
|
visibility: external_exports.enum(["public", "private"]).default("public")
|
|
83625
84691
|
});
|
|
83626
84692
|
var externalAcceptShareInputSchema = acceptShareDefinition;
|
|
83627
84693
|
var shareRefDefinition = external_exports.object({
|
|
83628
|
-
workspaceId:
|
|
84694
|
+
workspaceId: workspaceIdSchema22,
|
|
83629
84695
|
/** The share's id, or this workspace's channel as its id or name. */
|
|
83630
84696
|
share: external_exports.string().trim().min(1).max(81)
|
|
83631
84697
|
});
|
|
83632
84698
|
var externalShareRefSchema = shareRefDefinition;
|
|
83633
84699
|
var reportInputDefinition = external_exports.object({
|
|
83634
|
-
workspaceId:
|
|
84700
|
+
workspaceId: workspaceIdSchema22,
|
|
83635
84701
|
connection: connectionReference,
|
|
83636
84702
|
note: external_exports.string().trim().min(1).max(2e3)
|
|
83637
84703
|
});
|
|
@@ -83642,7 +84708,7 @@ var blockedDefinition = external_exports.object({
|
|
|
83642
84708
|
});
|
|
83643
84709
|
var externalBlockedSchema = blockedDefinition;
|
|
83644
84710
|
var openDirectDefinition = external_exports.object({
|
|
83645
|
-
workspaceId:
|
|
84711
|
+
workspaceId: workspaceIdSchema22,
|
|
83646
84712
|
/** The external person: their roster id (`laze:<id>`) or their name in a shared channel. */
|
|
83647
84713
|
person: external_exports.string().trim().min(1).max(120),
|
|
83648
84714
|
/** Their workspace, as a connection reference; needed only when a name is in two. */
|
|
@@ -83668,7 +84734,7 @@ var externalConnectionConfig = Config.define(() => ({ publicBaseUrl }));
|
|
|
83668
84734
|
|
|
83669
84735
|
// ../../modules/external-connection/contract/src/external-connection.rest.ts
|
|
83670
84736
|
var keyed = { workspaceId: true };
|
|
83671
|
-
var
|
|
84737
|
+
var emptyDefinition3 = external_exports.object({});
|
|
83672
84738
|
var rosterDefinition2 = externalRosterInputSchema.omit(keyed);
|
|
83673
84739
|
var inviteDefinition = externalInviteInputSchema.omit(keyed);
|
|
83674
84740
|
var inviteRefDefinition2 = externalInviteRefSchema.omit(keyed);
|
|
@@ -83688,7 +84754,7 @@ var ExternalChannelBannerSlot = externalUi.component("channel-banner");
|
|
|
83688
84754
|
var ExternalSharingHooksToken = externalUi.hooks("sharing");
|
|
83689
84755
|
|
|
83690
84756
|
// src/services/workspace-commands.service.ts
|
|
83691
|
-
import { readFile as
|
|
84757
|
+
import { readFile as readFile29 } from "node:fs/promises";
|
|
83692
84758
|
import { resolve as resolve11 } from "node:path";
|
|
83693
84759
|
var ROLE_NAMES2 = {
|
|
83694
84760
|
OWNER: "Owner",
|
|
@@ -83871,7 +84937,7 @@ var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze work
|
|
|
83871
84937
|
async function readLogo({ context, file: file3 }) {
|
|
83872
84938
|
let bytes;
|
|
83873
84939
|
try {
|
|
83874
|
-
bytes = new Uint8Array(await
|
|
84940
|
+
bytes = new Uint8Array(await readFile29(resolve11(context.cwd, file3)));
|
|
83875
84941
|
} catch {
|
|
83876
84942
|
throw new CliUsageError(`No file to read at ${file3}.`);
|
|
83877
84943
|
}
|
|
@@ -84187,7 +85253,7 @@ async function list6({ context, args }) {
|
|
|
84187
85253
|
...overview3.connections.flatMap(connectionLines),
|
|
84188
85254
|
...overview3.invites.length > 0 ? ["Invitations sent:"] : [],
|
|
84189
85255
|
...overview3.invites.map(
|
|
84190
|
-
(
|
|
85256
|
+
(invite4) => ` ${invite4.email} ${invite4.state} expires ${utcTimeOf(invite4.expiresAt)} ${invite4.id}`
|
|
84191
85257
|
),
|
|
84192
85258
|
...overview3.blocked.map((each) => `Blocked: ${each.name}`)
|
|
84193
85259
|
];
|
|
@@ -84444,7 +85510,7 @@ async function external({ context, args }) {
|
|
|
84444
85510
|
}
|
|
84445
85511
|
|
|
84446
85512
|
// src/services/feed-commands.service.ts
|
|
84447
|
-
import { readFile as
|
|
85513
|
+
import { readFile as readFile31 } from "node:fs/promises";
|
|
84448
85514
|
import { resolve as resolve13 } from "node:path";
|
|
84449
85515
|
|
|
84450
85516
|
// ../../modules/feed/contract/src/feed.ts
|
|
@@ -84632,6 +85698,13 @@ var feedApprovalSchemaDefinition = external_exports.object({
|
|
|
84632
85698
|
"vault_share"
|
|
84633
85699
|
]),
|
|
84634
85700
|
requestId: external_exports.string(),
|
|
85701
|
+
/** Every request an invite card answers at once, `requestId` first; absent means just it. */
|
|
85702
|
+
requestIds: external_exports.array(external_exports.string()).optional(),
|
|
85703
|
+
/**
|
|
85704
|
+
* An invite card whose approval raises what the workspace pays (Team, more seats or a higher
|
|
85705
|
+
* price): the web shows the price and runs the upgrade; iOS sends the admin to the web.
|
|
85706
|
+
*/
|
|
85707
|
+
needsUpgrade: external_exports.boolean().optional(),
|
|
84635
85708
|
/** The app, for an `app_publish` or `app_access` card. */
|
|
84636
85709
|
appId: external_exports.string().nullable(),
|
|
84637
85710
|
subject: external_exports.string(),
|
|
@@ -85069,15 +86142,15 @@ function decisionsLineOf(count5) {
|
|
|
85069
86142
|
function csvCellsOf(line) {
|
|
85070
86143
|
const cells = [];
|
|
85071
86144
|
let cell = "";
|
|
85072
|
-
let
|
|
86145
|
+
let quoted2 = false;
|
|
85073
86146
|
for (let at = 0; at < line.length; at += 1) {
|
|
85074
86147
|
const char = line[at];
|
|
85075
|
-
if (
|
|
86148
|
+
if (quoted2 && char === '"' && line[at + 1] === '"') {
|
|
85076
86149
|
cell += '"';
|
|
85077
86150
|
at += 1;
|
|
85078
86151
|
} else if (char === '"') {
|
|
85079
|
-
|
|
85080
|
-
} else if (char === "," && !
|
|
86152
|
+
quoted2 = !quoted2;
|
|
86153
|
+
} else if (char === "," && !quoted2) {
|
|
85081
86154
|
cells.push(cell);
|
|
85082
86155
|
cell = "";
|
|
85083
86156
|
} else {
|
|
@@ -85194,9 +86267,9 @@ function feedFlagsOf({ args }) {
|
|
|
85194
86267
|
}
|
|
85195
86268
|
|
|
85196
86269
|
// src/services/feed-files.service.ts
|
|
85197
|
-
import { readFile as
|
|
85198
|
-
import { basename as
|
|
85199
|
-
async function
|
|
86270
|
+
import { readFile as readFile30 } from "node:fs/promises";
|
|
86271
|
+
import { basename as basename6, resolve as resolve12 } from "node:path";
|
|
86272
|
+
async function bytesOf3({
|
|
85200
86273
|
context,
|
|
85201
86274
|
source
|
|
85202
86275
|
}) {
|
|
@@ -85211,7 +86284,7 @@ async function bytesOf2({
|
|
|
85211
86284
|
async function downloaded({ context, url: url2 }) {
|
|
85212
86285
|
const response = await context.fetcher(url2);
|
|
85213
86286
|
if (!response.ok) throw new CliUsageError(`${url2} answered ${response.status}`);
|
|
85214
|
-
const fileName =
|
|
86287
|
+
const fileName = basename6(new URL(url2).pathname) || "file";
|
|
85215
86288
|
const header = (response.headers.get("content-type") ?? "").split(";")[0]?.trim();
|
|
85216
86289
|
return {
|
|
85217
86290
|
fileName,
|
|
@@ -85221,11 +86294,11 @@ async function downloaded({ context, url: url2 }) {
|
|
|
85221
86294
|
}
|
|
85222
86295
|
async function local({ context, path }) {
|
|
85223
86296
|
const full = resolve12(context.cwd, path);
|
|
85224
|
-
const fileName =
|
|
86297
|
+
const fileName = basename6(full);
|
|
85225
86298
|
return {
|
|
85226
86299
|
fileName,
|
|
85227
86300
|
contentType: contentTypeOf(fileName),
|
|
85228
|
-
bytes: new Uint8Array(await
|
|
86301
|
+
bytes: new Uint8Array(await readFile30(full))
|
|
85229
86302
|
};
|
|
85230
86303
|
}
|
|
85231
86304
|
async function directWith({ client, to }) {
|
|
@@ -85253,7 +86326,7 @@ async function feedAttachmentIdsOf({
|
|
|
85253
86326
|
throw new CliUsageError(`An item carries at most ${FEED_ATTACHMENTS_MAX} files`);
|
|
85254
86327
|
}
|
|
85255
86328
|
const files2 = [];
|
|
85256
|
-
for (const source of sources) files2.push(await
|
|
86329
|
+
for (const source of sources) files2.push(await bytesOf3({ context, source }));
|
|
85257
86330
|
const target = channel || await directWith({ client, to: args.lists.to ?? [] });
|
|
85258
86331
|
const ids = [];
|
|
85259
86332
|
for (const file3 of files2) {
|
|
@@ -85307,10 +86380,10 @@ async function bodyOf2({
|
|
|
85307
86380
|
flags: flags2
|
|
85308
86381
|
}) {
|
|
85309
86382
|
const body = { ...flags2.fields };
|
|
85310
|
-
const
|
|
85311
|
-
for (const [field, source] of Object.entries(flags2.texts)) body[field] = await
|
|
86383
|
+
const read4 = (source) => "file" in source ? readFile31(resolve13(context.cwd, source.file), "utf8") : source.text;
|
|
86384
|
+
for (const [field, source] of Object.entries(flags2.texts)) body[field] = await read4(source);
|
|
85312
86385
|
if (flags2.rich) {
|
|
85313
|
-
const text2 = await
|
|
86386
|
+
const text2 = await read4(flags2.rich.source);
|
|
85314
86387
|
try {
|
|
85315
86388
|
body.rich = richBodyOf({ kind: flags2.rich.kind, text: text2 });
|
|
85316
86389
|
} catch (error62) {
|
|
@@ -85389,10 +86462,10 @@ async function feedRead({ context, args }) {
|
|
|
85389
86462
|
const itemId = args.words[2];
|
|
85390
86463
|
if (!itemId) throw new CliUsageError(USAGE9);
|
|
85391
86464
|
const { client } = await signedIn({ context, args });
|
|
85392
|
-
const
|
|
85393
|
-
printItem({ context, args, item:
|
|
85394
|
-
if (!args.flags.json &&
|
|
85395
|
-
${
|
|
86465
|
+
const read4 = await client.post("/api/feed/items/read", { itemId });
|
|
86466
|
+
printItem({ context, args, item: read4 });
|
|
86467
|
+
if (!args.flags.json && read4.item.draft) context.out(`Draft:
|
|
86468
|
+
${read4.item.draft}
|
|
85396
86469
|
`);
|
|
85397
86470
|
}
|
|
85398
86471
|
async function feedInbox({ context, args }) {
|
|
@@ -85502,7 +86575,7 @@ async function textFlag({
|
|
|
85502
86575
|
}) {
|
|
85503
86576
|
const value = flagText({ args, name: name3 });
|
|
85504
86577
|
if (!value.startsWith("@")) return value;
|
|
85505
|
-
return
|
|
86578
|
+
return readFile31(resolve13(context.cwd, value.slice(1)), "utf8");
|
|
85506
86579
|
}
|
|
85507
86580
|
async function feedList({ context, args }) {
|
|
85508
86581
|
const { client } = await signedIn({ context, args });
|
|
@@ -85625,7 +86698,7 @@ async function feed({ context, args }) {
|
|
|
85625
86698
|
}
|
|
85626
86699
|
|
|
85627
86700
|
// src/services/github-commands.service.ts
|
|
85628
|
-
import { readFile as
|
|
86701
|
+
import { readFile as readFile32 } from "node:fs/promises";
|
|
85629
86702
|
|
|
85630
86703
|
// src/rules/github-signature.rules.ts
|
|
85631
86704
|
var TURN_SEPARATOR = "~";
|
|
@@ -85695,7 +86768,7 @@ var REAL_GH = "/usr/bin/gh";
|
|
|
85695
86768
|
var NOT_SET = "laze: agent_github_not_set: this agent has no GitHub connection. Its owner sets one on the agent's settings page or with `laze agent set-github <agent> <connection>`.";
|
|
85696
86769
|
async function turnFileToken({ env }) {
|
|
85697
86770
|
if (!env.LAZE_TURN_FILE) return "";
|
|
85698
|
-
return
|
|
86771
|
+
return readFile32(env.LAZE_TURN_FILE, "utf8").then(
|
|
85699
86772
|
(text2) => text2.trim(),
|
|
85700
86773
|
() => ""
|
|
85701
86774
|
);
|
|
@@ -85729,7 +86802,7 @@ async function githubGh({
|
|
|
85729
86802
|
args: args.rest,
|
|
85730
86803
|
agentName: profile.name ?? "An agent",
|
|
85731
86804
|
threadUrl: threadUrlOf({ env, workspaceId: profile.workspaceId }),
|
|
85732
|
-
readBodyFile: (path) => path === "-" ? context.readStdin() :
|
|
86805
|
+
readBodyFile: (path) => path === "-" ? context.readStdin() : readFile32(path, "utf8")
|
|
85733
86806
|
});
|
|
85734
86807
|
return context.runCommand({
|
|
85735
86808
|
command: [REAL_GH, ...ghArgs],
|
|
@@ -85828,7 +86901,7 @@ async function setAgentGithub({
|
|
|
85828
86901
|
}
|
|
85829
86902
|
|
|
85830
86903
|
// src/services/history-commands.service.ts
|
|
85831
|
-
import { readFile as
|
|
86904
|
+
import { readFile as readFile33 } from "node:fs/promises";
|
|
85832
86905
|
|
|
85833
86906
|
// src/rules/history-format.rules.ts
|
|
85834
86907
|
function timeOf2(iso2) {
|
|
@@ -85924,7 +86997,7 @@ async function turnTokenOf4({ context }) {
|
|
|
85924
86997
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
85925
86998
|
if (pinned) return pinned;
|
|
85926
86999
|
if (!env.LAZE_TURN_FILE) return "";
|
|
85927
|
-
return
|
|
87000
|
+
return readFile33(env.LAZE_TURN_FILE, "utf8").then(
|
|
85928
87001
|
(text2) => text2.trim(),
|
|
85929
87002
|
() => ""
|
|
85930
87003
|
);
|
|
@@ -85975,6 +87048,100 @@ async function history2({
|
|
|
85975
87048
|
return 1;
|
|
85976
87049
|
}
|
|
85977
87050
|
|
|
87051
|
+
// src/rules/invite-format.rules.ts
|
|
87052
|
+
function money2({ amount, currency: currency2 }) {
|
|
87053
|
+
return `${currency2.toUpperCase()} ${Number(amount.toFixed(2))}`;
|
|
87054
|
+
}
|
|
87055
|
+
function inviteQuoteText(quote4) {
|
|
87056
|
+
const at = (amount) => money2({ amount, currency: quote4.currency });
|
|
87057
|
+
const people2 = `${quote4.peopleAfter} ${quote4.peopleAfter === 1 ? "person" : "people"}`;
|
|
87058
|
+
const seats = quote4.freeSeatsLeft ? ` ${quote4.freeSeatsLeft} free ${quote4.freeSeatsLeft === 1 ? "seat" : "seats"} left.` : "";
|
|
87059
|
+
if (quote4.seatCap !== null && !quote4.upgradeNeeded) {
|
|
87060
|
+
return `Your plan holds ${quote4.seatCap} people, at no charge.
|
|
87061
|
+
`;
|
|
87062
|
+
}
|
|
87063
|
+
const price = `${at(quote4.monthlyAfter)} a month for ${people2} (${at(quote4.perPersonAfter)} per person).${seats}`;
|
|
87064
|
+
if (quote4.upgradeNeeded)
|
|
87065
|
+
return `Team: ${price} This starts Team, paid through Stripe Checkout.
|
|
87066
|
+
`;
|
|
87067
|
+
const change2 = quote4.monthlyAfter === quote4.monthlyNow ? "No change to your price." : `Was ${at(quote4.monthlyNow)}; the change is prorated as each person joins.`;
|
|
87068
|
+
return `New price: ${price} ${change2}
|
|
87069
|
+
`;
|
|
87070
|
+
}
|
|
87071
|
+
|
|
87072
|
+
// src/services/invite-commands.service.ts
|
|
87073
|
+
var INVITE_USAGE = "Usage: laze invite [--to <conversation>] [--role member|guest|admin|owner] [--yes] <email>...";
|
|
87074
|
+
var ROLES3 = {
|
|
87075
|
+
owner: "OWNER",
|
|
87076
|
+
admin: "ADMIN",
|
|
87077
|
+
member: "MEMBER",
|
|
87078
|
+
guest: "GUEST"
|
|
87079
|
+
};
|
|
87080
|
+
function inviteInput(args) {
|
|
87081
|
+
const emails = args.words.slice(1);
|
|
87082
|
+
const roleFlag = typeof args.flags.role === "string" ? args.flags.role.toLowerCase() : "member";
|
|
87083
|
+
const role2 = ROLES3[roleFlag];
|
|
87084
|
+
if (emails.length === 0 || !role2) throw new CliUsageError(INVITE_USAGE);
|
|
87085
|
+
const to = typeof args.flags.to === "string" ? args.flags.to : void 0;
|
|
87086
|
+
return { emails, role: role2, ...to ? { to } : {}, confirmed: true };
|
|
87087
|
+
}
|
|
87088
|
+
function refusedLines(refused) {
|
|
87089
|
+
const why = { invalid: "not an email address", duplicate: "listed twice", member: "already in" };
|
|
87090
|
+
return refused.map((one) => `Left out ${one.email}: ${why[one.reason]}.
|
|
87091
|
+
`).join("");
|
|
87092
|
+
}
|
|
87093
|
+
async function invite3({ context, args }) {
|
|
87094
|
+
const input2 = inviteInput(args);
|
|
87095
|
+
const { client } = await signedIn({ context, args });
|
|
87096
|
+
const quote4 = await client.post("/api/billing-account/invite-quote", {
|
|
87097
|
+
adding: input2.emails.length
|
|
87098
|
+
});
|
|
87099
|
+
if (!args.flags.yes) {
|
|
87100
|
+
context.out(`${inviteQuoteText(quote4)}Nothing was sent. Run it again with --yes to send.
|
|
87101
|
+
`);
|
|
87102
|
+
return;
|
|
87103
|
+
}
|
|
87104
|
+
let sent;
|
|
87105
|
+
try {
|
|
87106
|
+
sent = await client.post("/api/agents/me/workspace/invite-many", input2);
|
|
87107
|
+
} catch (error62) {
|
|
87108
|
+
if (!(error62 instanceof LazeApiError) || error62.status !== 403) throw error62;
|
|
87109
|
+
const asked = await client.post(
|
|
87110
|
+
"/api/agents/me/workspace/request-invites",
|
|
87111
|
+
input2
|
|
87112
|
+
);
|
|
87113
|
+
const approvers = asked.approvers.length > 0 ? asked.approvers.join(" or ") : "an admin";
|
|
87114
|
+
context.out(
|
|
87115
|
+
`${refusedLines(asked.refused)}Sent ${asked.requests.length} to ${approvers} for approval. The invitations go out once approved.
|
|
87116
|
+
`
|
|
87117
|
+
);
|
|
87118
|
+
return;
|
|
87119
|
+
}
|
|
87120
|
+
context.out(refusedLines(sent.refused));
|
|
87121
|
+
if (!quote4.upgradeNeeded) {
|
|
87122
|
+
context.out(`Invited ${sent.invites.length}.${sent.held ? " Some wait for seats." : ""}
|
|
87123
|
+
`);
|
|
87124
|
+
return;
|
|
87125
|
+
}
|
|
87126
|
+
const returnPath = sent.channelId ? `/workspaces/${quote4.workspaceId}?c=${encodeURIComponent(sent.channelId)}&invite=checkout` : `/workspaces/${quote4.workspaceId}?invite=checkout`;
|
|
87127
|
+
try {
|
|
87128
|
+
const { url: url2 } = await client.post("/api/billing-account/checkout", {
|
|
87129
|
+
currency: quote4.currency,
|
|
87130
|
+
returnPath
|
|
87131
|
+
});
|
|
87132
|
+
context.out(
|
|
87133
|
+
`Saved ${sent.invites.length} invitations for Team. Open this link to upgrade; they go out once it is paid: ${url2}
|
|
87134
|
+
`
|
|
87135
|
+
);
|
|
87136
|
+
} catch (error62) {
|
|
87137
|
+
if (!(error62 instanceof LazeApiError) || error62.status !== 403) throw error62;
|
|
87138
|
+
context.out(
|
|
87139
|
+
`Saved ${sent.invites.length} invitations for Team. An admin has to upgrade the workspace (laze billing checkout) before they go out.
|
|
87140
|
+
`
|
|
87141
|
+
);
|
|
87142
|
+
}
|
|
87143
|
+
}
|
|
87144
|
+
|
|
85978
87145
|
// src/services/ip-commands.service.ts
|
|
85979
87146
|
var IP_USAGE = `Usage:
|
|
85980
87147
|
laze ip [status] [--json] your dedicated IP: on or off, country, address, domains
|
|
@@ -86091,9 +87258,9 @@ async function list7({ context, args }) {
|
|
|
86091
87258
|
const answer5 = await client.get(DEDICATED_IP_REST_PATHS.all);
|
|
86092
87259
|
if (args.flags.json) return printJson7(context, answer5);
|
|
86093
87260
|
if (answer5.ips.length === 0) return context.out("No one has a dedicated IP.\n");
|
|
86094
|
-
const
|
|
87261
|
+
const money3 = (amount) => `${amount} ${answer5.currency.toUpperCase()}`;
|
|
86095
87262
|
const lines2 = answer5.ips.map(
|
|
86096
|
-
(one) => ` ${one.ownerName} ${one.country.name} ${one.state === "on" ? "on" : "being bought"} ${
|
|
87263
|
+
(one) => ` ${one.ownerName} ${one.country.name} ${one.state === "on" ? "on" : "being bought"} ${money3(one.monthlyPrice)} a month`
|
|
86097
87264
|
);
|
|
86098
87265
|
context.out(`Dedicated IPs:
|
|
86099
87266
|
${lines2.join("\n")}
|
|
@@ -86116,19 +87283,19 @@ async function ip({ context, args }) {
|
|
|
86116
87283
|
}
|
|
86117
87284
|
|
|
86118
87285
|
// src/services/join-commands.service.ts
|
|
86119
|
-
import { mkdir as mkdir20, readFile as
|
|
86120
|
-
import { dirname as dirname19, join as
|
|
87286
|
+
import { mkdir as mkdir20, readFile as readFile34, rename as rename6, rm as rm11, writeFile as writeFile20 } from "node:fs/promises";
|
|
87287
|
+
import { dirname as dirname19, join as join24 } from "node:path";
|
|
86121
87288
|
var DEFAULT_WAIT_SECONDS2 = 100;
|
|
86122
87289
|
var JOIN_USAGE = "Usage: laze join [--workspace <name|id|invite link>] [--for <email>] [--name <name>] [--note <text>] [--timeout <seconds>] [--project <folder>]";
|
|
86123
87290
|
function pendingPathOf({ context }) {
|
|
86124
|
-
return
|
|
87291
|
+
return join24(dirname19(context.environment.configPath), "join", "pending.json");
|
|
86125
87292
|
}
|
|
86126
87293
|
async function readPending({
|
|
86127
87294
|
context,
|
|
86128
87295
|
url: url2,
|
|
86129
87296
|
args
|
|
86130
87297
|
}) {
|
|
86131
|
-
const pending2 = await
|
|
87298
|
+
const pending2 = await readFile34(pendingPathOf({ context }), "utf8").then(
|
|
86132
87299
|
(text2) => JSON.parse(text2),
|
|
86133
87300
|
() => void 0
|
|
86134
87301
|
);
|
|
@@ -86848,8 +88015,14 @@ function withLocalTools(answer5) {
|
|
|
86848
88015
|
if (!Array.isArray(result.tools)) return answer5;
|
|
86849
88016
|
return { ...recordOf3(answer5), result: { ...result, tools: [...TOOLS, ...result.tools] } };
|
|
86850
88017
|
}
|
|
86851
|
-
function
|
|
86852
|
-
|
|
88018
|
+
function refusedLines2({
|
|
88019
|
+
message: message2,
|
|
88020
|
+
status: status9,
|
|
88021
|
+
text: text2
|
|
88022
|
+
}) {
|
|
88023
|
+
const migrated = status9 === 401 ? migratedNoticeOf(apiErrorOf({ status: status9, text: text2 })) : void 0;
|
|
88024
|
+
const refused = status9 === 401 ? "Laze refused this key: run `laze login` or link the agent again" : `Laze answered ${status9}`;
|
|
88025
|
+
const reason = migrated?.notice ?? refused;
|
|
86853
88026
|
const errors = idsOf(message2).map((id2) => ({
|
|
86854
88027
|
jsonrpc: "2.0",
|
|
86855
88028
|
id: id2,
|
|
@@ -86899,7 +88072,7 @@ async function answerLine({
|
|
|
86899
88072
|
}
|
|
86900
88073
|
const answer5 = await client.forward({ path: REMOTE_MCP_PATH, body: line });
|
|
86901
88074
|
if (answer5.status < 200 || answer5.status >= 300) {
|
|
86902
|
-
return
|
|
88075
|
+
return refusedLines2({ message: message2, status: answer5.status, text: answer5.text });
|
|
86903
88076
|
}
|
|
86904
88077
|
const replied = repliedTo({ request: request2 });
|
|
86905
88078
|
if (replied)
|
|
@@ -86962,14 +88135,14 @@ async function serveMcp({
|
|
|
86962
88135
|
}
|
|
86963
88136
|
|
|
86964
88137
|
// src/services/mount-files.service.ts
|
|
86965
|
-
import { mkdir as mkdir21, readFile as
|
|
88138
|
+
import { mkdir as mkdir21, readFile as readFile35, rm as rm12, writeFile as writeFile21 } from "node:fs/promises";
|
|
86966
88139
|
import { dirname as dirname20, relative as relative5, resolve as resolve14 } from "node:path";
|
|
86967
88140
|
async function textArgument({
|
|
86968
88141
|
context,
|
|
86969
88142
|
value
|
|
86970
88143
|
}) {
|
|
86971
88144
|
if (value === "-") return context.readStdin();
|
|
86972
|
-
if (value.startsWith("@")) return
|
|
88145
|
+
if (value.startsWith("@")) return readFile35(resolve14(context.cwd, value.slice(1)), "utf8");
|
|
86973
88146
|
return value;
|
|
86974
88147
|
}
|
|
86975
88148
|
function turnChannel({ context, args }) {
|
|
@@ -87252,7 +88425,7 @@ async function models({ context, args }) {
|
|
|
87252
88425
|
|
|
87253
88426
|
// src/services/monitor-commands.service.ts
|
|
87254
88427
|
var ADD_USAGE = "Usage: laze monitor add <name> --channel '#support-*' --prompt '<what to do>' [--from anyone|people|slack] [--not-from bots] [--thread roots-only] [--matches '<pattern>'] [--max-runs-per-day <n>] [--agent <name>]";
|
|
87255
|
-
function
|
|
88428
|
+
function agentOf2(args) {
|
|
87256
88429
|
const agent2 = flagText({ args, name: "agent" });
|
|
87257
88430
|
return agent2 ? { agent: agent2 } : {};
|
|
87258
88431
|
}
|
|
@@ -87273,7 +88446,7 @@ async function monitorAdd({ context, args }) {
|
|
|
87273
88446
|
if (maxRuns && !/^\d+$/.test(maxRuns)) throw new CliUsageError(ADD_USAGE);
|
|
87274
88447
|
const { client } = await signedIn({ context, args });
|
|
87275
88448
|
const added = await client.post("/api/agents/monitors", {
|
|
87276
|
-
...
|
|
88449
|
+
...agentOf2(args),
|
|
87277
88450
|
name: name3,
|
|
87278
88451
|
channels: channels3,
|
|
87279
88452
|
prompt,
|
|
@@ -87309,7 +88482,7 @@ function stateRun(path, verb) {
|
|
|
87309
88482
|
if (!name3) throw new CliUsageError(`Usage: laze monitor ${verb} <name> [--agent <name>]`);
|
|
87310
88483
|
const { client } = await signedIn({ context, args });
|
|
87311
88484
|
const answer5 = await client.post(path, {
|
|
87312
|
-
...
|
|
88485
|
+
...agentOf2(args),
|
|
87313
88486
|
name: name3
|
|
87314
88487
|
});
|
|
87315
88488
|
if (args.flags.json) return context.out(`${JSON.stringify(answer5, null, 2)}
|
|
@@ -87648,8 +88821,8 @@ ${OPS_USAGE}`);
|
|
|
87648
88821
|
}
|
|
87649
88822
|
|
|
87650
88823
|
// src/services/release-watch.service.ts
|
|
87651
|
-
import { mkdir as mkdir22, readFile as
|
|
87652
|
-
import { dirname as dirname21, join as
|
|
88824
|
+
import { mkdir as mkdir22, readFile as readFile36, realpath, writeFile as writeFile22 } from "node:fs/promises";
|
|
88825
|
+
import { dirname as dirname21, join as join25 } from "node:path";
|
|
87653
88826
|
|
|
87654
88827
|
// src/rules/cli-update.rules.ts
|
|
87655
88828
|
var CLI_PACKAGE = "@lazehq/cli";
|
|
@@ -87796,15 +88969,15 @@ async function startedUpdate({
|
|
|
87796
88969
|
const plan2 = updatePlanOf({ script: await scriptOf(context) });
|
|
87797
88970
|
if (plan2.kind !== "install") return null;
|
|
87798
88971
|
const folder = dirname21(context.environment.configPath);
|
|
87799
|
-
const stamp =
|
|
87800
|
-
const last = await
|
|
88972
|
+
const stamp = join25(folder, "auto-update.json");
|
|
88973
|
+
const last = await readFile36(stamp, "utf8").then((text2) => JSON.parse(text2)).catch(() => null);
|
|
87801
88974
|
const now = context.nowMs();
|
|
87802
88975
|
if (last?.server === server && now - last.atMs < RETRY_AFTER_MS) return null;
|
|
87803
88976
|
await mkdir22(folder, { recursive: true, mode: 448 });
|
|
87804
88977
|
await writeFile22(stamp, JSON.stringify({ server, atMs: now }), { mode: 384 });
|
|
87805
88978
|
context.processes.spawnDetached({
|
|
87806
88979
|
argv: [...context.program, "update"],
|
|
87807
|
-
logPath:
|
|
88980
|
+
logPath: join25(folder, "auto-update.log")
|
|
87808
88981
|
});
|
|
87809
88982
|
return { manager: plan2.manager };
|
|
87810
88983
|
}
|
|
@@ -87841,7 +89014,7 @@ function watchingRelease({
|
|
|
87841
89014
|
}
|
|
87842
89015
|
|
|
87843
89016
|
// src/services/rush-guard.service.ts
|
|
87844
|
-
import { readFile as
|
|
89017
|
+
import { readFile as readFile37, rm as rm13 } from "node:fs/promises";
|
|
87845
89018
|
var WATCH_MS3 = 2e3;
|
|
87846
89019
|
var RETRY_MS2 = 3e4;
|
|
87847
89020
|
async function guardRound(guard) {
|
|
@@ -87884,7 +89057,7 @@ async function rushWakeHook({ context, args }) {
|
|
|
87884
89057
|
while (context.processes.alive(claudePid)) await context.sleep(WATCH_MS3);
|
|
87885
89058
|
const { client, name: name3 } = await signedIn({ context, args });
|
|
87886
89059
|
const noted = statePathOf({ context, kind: "sessions", profile: String(claudePid) });
|
|
87887
|
-
const note = await
|
|
89060
|
+
const note = await readFile37(noted, "utf8").then(
|
|
87888
89061
|
(text2) => JSON.parse(text2),
|
|
87889
89062
|
() => void 0
|
|
87890
89063
|
);
|
|
@@ -87897,6 +89070,12 @@ async function rushWakeHook({ context, args }) {
|
|
|
87897
89070
|
try {
|
|
87898
89071
|
while (context.nowMs() < deadline) {
|
|
87899
89072
|
const done = await guardRound(guard).catch((error62) => {
|
|
89073
|
+
const migrated = migratedNoticeOf(error62);
|
|
89074
|
+
if (migrated) {
|
|
89075
|
+
context.err(`${migrated.notice}
|
|
89076
|
+
`);
|
|
89077
|
+
return true;
|
|
89078
|
+
}
|
|
87900
89079
|
context.err(`laze: the rush guard will try again: ${String(error62)}
|
|
87901
89080
|
`);
|
|
87902
89081
|
return "failed";
|
|
@@ -88053,8 +89232,8 @@ async function schedule({ context, args }) {
|
|
|
88053
89232
|
}
|
|
88054
89233
|
|
|
88055
89234
|
// src/services/skill-commands.service.ts
|
|
88056
|
-
import { readdir as
|
|
88057
|
-
import { join as
|
|
89235
|
+
import { readdir as readdir8, readFile as readFile38 } from "node:fs/promises";
|
|
89236
|
+
import { join as join26, relative as relative6, resolve as resolve16 } from "node:path";
|
|
88058
89237
|
var USAGE15 = `Usage:
|
|
88059
89238
|
laze skill list [--agent <agentId>]
|
|
88060
89239
|
laze skill install <catalogue-id> [--as <name>] [--agent <agentId>]
|
|
@@ -88071,12 +89250,12 @@ var USAGE15 = `Usage:
|
|
|
88071
89250
|
--agent names the agent with a person's key; an agent's key works on its own skills.
|
|
88072
89251
|
With a person's key, list without --agent shows every agent's skills.`;
|
|
88073
89252
|
async function folderFiles({ root }) {
|
|
88074
|
-
const entries = await
|
|
89253
|
+
const entries = await readdir8(root, { recursive: true, withFileTypes: true });
|
|
88075
89254
|
const files2 = [];
|
|
88076
89255
|
for (const entry of entries) {
|
|
88077
89256
|
if (!entry.isFile()) continue;
|
|
88078
|
-
const full =
|
|
88079
|
-
files2.push({ path: relative6(root, full), content: await
|
|
89257
|
+
const full = join26(entry.parentPath, entry.name);
|
|
89258
|
+
files2.push({ path: relative6(root, full), content: await readFile38(full, "utf8") });
|
|
88080
89259
|
}
|
|
88081
89260
|
return files2.toSorted((a, b) => a.path.localeCompare(b.path));
|
|
88082
89261
|
}
|
|
@@ -88174,7 +89353,7 @@ async function skillUpdate({ context, args }) {
|
|
|
88174
89353
|
if (!name3 || !newName && description === void 0 && !skillMdFile) {
|
|
88175
89354
|
throw new CliUsageError(USAGE15);
|
|
88176
89355
|
}
|
|
88177
|
-
const skillMd = skillMdFile ? await
|
|
89356
|
+
const skillMd = skillMdFile ? await readFile38(resolve16(context.cwd, skillMdFile), "utf8") : void 0;
|
|
88178
89357
|
const { client } = await signedIn({ context, args });
|
|
88179
89358
|
const updated = await client.post("/api/skills/update", {
|
|
88180
89359
|
name: name3,
|
|
@@ -88220,7 +89399,7 @@ async function skill({ context, args }) {
|
|
|
88220
89399
|
}
|
|
88221
89400
|
|
|
88222
89401
|
// src/services/slack-commands.service.ts
|
|
88223
|
-
import { readFile as
|
|
89402
|
+
import { readFile as readFile39 } from "node:fs/promises";
|
|
88224
89403
|
import { resolve as resolve17 } from "node:path";
|
|
88225
89404
|
var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
|
|
88226
89405
|
laze slack overview connected Slack workspaces, mirrors, your link
|
|
@@ -88268,7 +89447,7 @@ async function secretLines({ context, args }) {
|
|
|
88268
89447
|
throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
|
|
88269
89448
|
}
|
|
88270
89449
|
const file3 = flagText({ args, name: "from-file" });
|
|
88271
|
-
const text2 = file3 ? await
|
|
89450
|
+
const text2 = file3 ? await readFile39(resolve17(context.cwd, file3), "utf8") : await context.readStdin();
|
|
88272
89451
|
return text2.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
88273
89452
|
}
|
|
88274
89453
|
async function secretsOf2({
|
|
@@ -88499,14 +89678,14 @@ function moveBody(args) {
|
|
|
88499
89678
|
const name3 = flagText({ args, name: "name" });
|
|
88500
89679
|
if (ids.length === 0 || name3 && ids.length > 1) throw new CliUsageError(SLACK_USAGE);
|
|
88501
89680
|
const farewell = flagText({ args, name: "farewell" });
|
|
88502
|
-
const
|
|
89681
|
+
const invite4 = args.lists.invite ?? [];
|
|
88503
89682
|
return {
|
|
88504
89683
|
teamId: wordAt8(args, 2),
|
|
88505
89684
|
channels: ids.map((slackChannelId) => ({
|
|
88506
89685
|
slackChannelId,
|
|
88507
89686
|
...name3 && { name: name3 },
|
|
88508
89687
|
...farewell && { farewell },
|
|
88509
|
-
invite:
|
|
89688
|
+
invite: invite4
|
|
88510
89689
|
}))
|
|
88511
89690
|
};
|
|
88512
89691
|
}
|
|
@@ -88572,7 +89751,7 @@ async function slack({
|
|
|
88572
89751
|
}
|
|
88573
89752
|
|
|
88574
89753
|
// src/services/sso-commands.service.ts
|
|
88575
|
-
import { readFile as
|
|
89754
|
+
import { readFile as readFile40 } from "node:fs/promises";
|
|
88576
89755
|
var SSO_USAGE = `Usage:
|
|
88577
89756
|
laze sso domains claimed domains and how each signs in (admins)
|
|
88578
89757
|
laze sso claim <domain> the TXT record that proves the domain
|
|
@@ -88659,7 +89838,7 @@ function refuseSecretFlags({ args }) {
|
|
|
88659
89838
|
}
|
|
88660
89839
|
async function clientSecretOf({ context, args }) {
|
|
88661
89840
|
const file3 = flagText({ args, name: "from-file" });
|
|
88662
|
-
const text2 = file3 ? await
|
|
89841
|
+
const text2 = file3 ? await readFile40(file3, "utf8") : await context.readStdin();
|
|
88663
89842
|
const secret = text2.trim();
|
|
88664
89843
|
if (!secret) throw new CliUsageError("No client secret: pipe it on stdin or use --from-file.");
|
|
88665
89844
|
return secret;
|
|
@@ -88918,8 +90097,8 @@ async function releaseAgeSettingsOf({
|
|
|
88918
90097
|
manager
|
|
88919
90098
|
}) {
|
|
88920
90099
|
const settings3 = [];
|
|
88921
|
-
for (const { setting, read:
|
|
88922
|
-
const value = settingValueOf({ printed: await printedBy({ context, command:
|
|
90100
|
+
for (const { setting, read: read4 } of RELEASE_AGE_SETTINGS[manager] ?? []) {
|
|
90101
|
+
const value = settingValueOf({ printed: await printedBy({ context, command: read4 }) ?? "" });
|
|
88923
90102
|
if (value) settings3.push(`${setting}=${value}`);
|
|
88924
90103
|
}
|
|
88925
90104
|
return settings3;
|
|
@@ -88991,8 +90170,8 @@ async function update2({
|
|
|
88991
90170
|
}
|
|
88992
90171
|
|
|
88993
90172
|
// src/services/vault-env-commands.service.ts
|
|
88994
|
-
import { readFile as
|
|
88995
|
-
import { dirname as dirname22, join as
|
|
90173
|
+
import { readFile as readFile41, stat as stat7 } from "node:fs/promises";
|
|
90174
|
+
import { dirname as dirname22, join as join27, resolve as resolve18 } from "node:path";
|
|
88996
90175
|
|
|
88997
90176
|
// src/rules/vault-manifest.rules.ts
|
|
88998
90177
|
var VARIABLE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
@@ -89262,15 +90441,15 @@ async function valuesOf({
|
|
|
89262
90441
|
return { exitCode: refused };
|
|
89263
90442
|
}
|
|
89264
90443
|
const opened = /* @__PURE__ */ new Map();
|
|
89265
|
-
let
|
|
90444
|
+
let keep2 = false;
|
|
89266
90445
|
for (const [key, release2] of settled2) {
|
|
89267
90446
|
if (release2.outcome !== "allow") continue;
|
|
89268
90447
|
opened.set(key, await envOf({ release: release2, run: run4 }));
|
|
89269
|
-
if (leaseHolds({ release: release2, nowMs: context.nowMs() }))
|
|
90448
|
+
if (leaseHolds({ release: release2, nowMs: context.nowMs() })) keep2 = true;
|
|
89270
90449
|
if (release2.message) context.err(`${release2.message}
|
|
89271
90450
|
`);
|
|
89272
90451
|
}
|
|
89273
|
-
if (!
|
|
90452
|
+
if (!keep2) await rm14(keyPath, { force: true });
|
|
89274
90453
|
const released = /* @__PURE__ */ new Map();
|
|
89275
90454
|
for (const entry of entries) {
|
|
89276
90455
|
const fields = opened.get(keyOf(entry));
|
|
@@ -89323,7 +90502,7 @@ function refusedReason({
|
|
|
89323
90502
|
return VAULT_EXIT_BAD_REASON;
|
|
89324
90503
|
}
|
|
89325
90504
|
async function isFile(path) {
|
|
89326
|
-
return
|
|
90505
|
+
return stat7(path).then(
|
|
89327
90506
|
(found) => found.isFile(),
|
|
89328
90507
|
() => false
|
|
89329
90508
|
);
|
|
@@ -89337,7 +90516,7 @@ async function manifestPathOf({
|
|
|
89337
90516
|
const environment = flagText({ args, name: "env" });
|
|
89338
90517
|
const file3 = environment ? `.env.${environment}.vault` : ".env.vault";
|
|
89339
90518
|
for (let dir = resolve18(context.cwd); ; dir = dirname22(dir)) {
|
|
89340
|
-
if (await isFile(
|
|
90519
|
+
if (await isFile(join27(dir, file3))) return join27(dir, file3);
|
|
89341
90520
|
if (dirname22(dir) === dir) break;
|
|
89342
90521
|
}
|
|
89343
90522
|
throw new CliUsageError(`laze vault: no ${file3} here or in a parent folder
|
|
@@ -89348,7 +90527,7 @@ async function manifestOf({
|
|
|
89348
90527
|
args
|
|
89349
90528
|
}) {
|
|
89350
90529
|
const file3 = await manifestPathOf({ context, args });
|
|
89351
|
-
const text2 = await
|
|
90530
|
+
const text2 = await readFile41(file3, "utf8").catch(() => {
|
|
89352
90531
|
throw new CliUsageError(`laze vault: cannot read ${file3}`);
|
|
89353
90532
|
});
|
|
89354
90533
|
return { file: file3, lines: parseManifest({ text: text2, file: file3 }) };
|
|
@@ -89579,7 +90758,7 @@ async function vaultScrub({ context, args }) {
|
|
|
89579
90758
|
}
|
|
89580
90759
|
|
|
89581
90760
|
// src/services/whatsapp-business-commands.service.ts
|
|
89582
|
-
import { readFile as
|
|
90761
|
+
import { readFile as readFile42 } from "node:fs/promises";
|
|
89583
90762
|
import { resolve as resolve19 } from "node:path";
|
|
89584
90763
|
|
|
89585
90764
|
// ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
|
|
@@ -89627,8 +90806,8 @@ var WHATSAPP_BUSINESS_REST_PATHS = {
|
|
|
89627
90806
|
var WHATSAPP_BUSINESS_TEXT_MAX = 4096;
|
|
89628
90807
|
var WHATSAPP_BUSINESS_LIMIT_MAX = 200;
|
|
89629
90808
|
var WHATSAPP_BUSINESS_STATUS_WAIT_MAX_SECONDS = 50;
|
|
89630
|
-
var
|
|
89631
|
-
var workspaceInput6 = external_exports.object({ workspaceId:
|
|
90809
|
+
var workspaceIdSchema23 = external_exports.string().min(1).max(64);
|
|
90810
|
+
var workspaceInput6 = external_exports.object({ workspaceId: workspaceIdSchema23 });
|
|
89632
90811
|
var digits = (what) => external_exports.string().trim().regex(/^\d{5,30}$/, `${what} is the number Meta shows, digits only`);
|
|
89633
90812
|
var appSecretSchema = external_exports.string().trim().regex(/^[a-f0-9]{32}$/i, "The app secret is 32 letters and digits from App settings > Basic");
|
|
89634
90813
|
var accessTokenSchema = external_exports.string().trim().min(20, "The access token is the long permanent system user token").max(2e3).regex(/^\S+$/, "The access token is one line with no spaces");
|
|
@@ -89662,7 +90841,7 @@ var statusDefinition = external_exports.object({
|
|
|
89662
90841
|
});
|
|
89663
90842
|
var whatsappBusinessStatusSchema = statusDefinition;
|
|
89664
90843
|
var connectDefinition = external_exports.object({
|
|
89665
|
-
workspaceId:
|
|
90844
|
+
workspaceId: workspaceIdSchema23,
|
|
89666
90845
|
appId: digits("The app id"),
|
|
89667
90846
|
wabaId: digits("The WhatsApp Business Account id"),
|
|
89668
90847
|
phoneNumberId: digits("The phone number id"),
|
|
@@ -89685,7 +90864,7 @@ var webhookDefinition = external_exports.object({
|
|
|
89685
90864
|
});
|
|
89686
90865
|
var whatsappBusinessWebhookSchema = webhookDefinition;
|
|
89687
90866
|
var settingsDefinition3 = external_exports.object({
|
|
89688
|
-
workspaceId:
|
|
90867
|
+
workspaceId: workspaceIdSchema23,
|
|
89689
90868
|
/** The agent that answers; null for none. Left out keeps the current one. */
|
|
89690
90869
|
agentId: external_exports.string().min(1).max(64).nullable().optional(),
|
|
89691
90870
|
replyMode: whatsappBusinessReplyModeSchema.optional()
|
|
@@ -89705,7 +90884,7 @@ var whatsappBusinessConversationSchema = conversationDefinition;
|
|
|
89705
90884
|
var limitSchema2 = external_exports.number().int().min(1).max(WHATSAPP_BUSINESS_LIMIT_MAX);
|
|
89706
90885
|
var contactRefSchema = external_exports.string().trim().min(1).max(64);
|
|
89707
90886
|
var conversationsInputDefinition = external_exports.object({
|
|
89708
|
-
workspaceId:
|
|
90887
|
+
workspaceId: workspaceIdSchema23,
|
|
89709
90888
|
limit: limitSchema2.optional()
|
|
89710
90889
|
});
|
|
89711
90890
|
var whatsappBusinessConversationsInputSchema = conversationsInputDefinition;
|
|
@@ -89731,7 +90910,7 @@ var messageDefinition2 = external_exports.object({
|
|
|
89731
90910
|
template: external_exports.string().nullable()
|
|
89732
90911
|
});
|
|
89733
90912
|
var readInputDefinition2 = external_exports.object({
|
|
89734
|
-
workspaceId:
|
|
90913
|
+
workspaceId: workspaceIdSchema23,
|
|
89735
90914
|
contact: contactRefSchema,
|
|
89736
90915
|
limit: limitSchema2.optional()
|
|
89737
90916
|
});
|
|
@@ -89740,12 +90919,12 @@ var readDefinition = external_exports.object({
|
|
|
89740
90919
|
messages: external_exports.array(messageDefinition2)
|
|
89741
90920
|
});
|
|
89742
90921
|
var sendInputDefinition2 = external_exports.object({
|
|
89743
|
-
workspaceId:
|
|
90922
|
+
workspaceId: workspaceIdSchema23,
|
|
89744
90923
|
to: contactRefSchema,
|
|
89745
90924
|
text: external_exports.string().trim().min(1).max(WHATSAPP_BUSINESS_TEXT_MAX)
|
|
89746
90925
|
});
|
|
89747
90926
|
var sendTemplateInputDefinition = external_exports.object({
|
|
89748
|
-
workspaceId:
|
|
90927
|
+
workspaceId: workspaceIdSchema23,
|
|
89749
90928
|
to: contactRefSchema,
|
|
89750
90929
|
template: external_exports.string().trim().min(1).max(512),
|
|
89751
90930
|
/** The template's language code; the only approved one when left out. */
|
|
@@ -89772,7 +90951,7 @@ function whatsappBusinessSendSettled({
|
|
|
89772
90951
|
return state !== "waiting" && state !== "sending";
|
|
89773
90952
|
}
|
|
89774
90953
|
var sendStatusInputDefinition2 = external_exports.object({
|
|
89775
|
-
workspaceId:
|
|
90954
|
+
workspaceId: workspaceIdSchema23,
|
|
89776
90955
|
sendId: external_exports.string().min(1).max(64),
|
|
89777
90956
|
waitSeconds: external_exports.number().int().min(0).max(WHATSAPP_BUSINESS_STATUS_WAIT_MAX_SECONDS).default(0)
|
|
89778
90957
|
});
|
|
@@ -89822,7 +91001,7 @@ var restSendStatusDefinition2 = sendStatusInputDefinition2.omit({ workspaceId: t
|
|
|
89822
91001
|
var restSettingsDefinition = settingsDefinition3.omit({ workspaceId: true });
|
|
89823
91002
|
var restEmptyDefinition = external_exports.object({});
|
|
89824
91003
|
var WhatsappBusinessApi = moduleApi()("whatsapp-business");
|
|
89825
|
-
var whatsappBusinessTrpc = defineTrpcContract("whatsappBusiness").query("status").withInput(workspaceInput6).withOutput(whatsappBusinessStatusSchema).mutation("connect").withInput(connectWhatsappBusinessInputSchema).withOutput(whatsappBusinessWebhookSchema).mutation("check").withInput(workspaceInput6).withOutput(whatsappBusinessStatusSchema).mutation("verifyToken").withInput(workspaceInput6).withOutput(whatsappBusinessWebhookSchema).mutation("settings").withInput(updateWhatsappBusinessSettingsInputSchema).withOutput(whatsappBusinessStatusSchema).mutation("disconnect").withInput(workspaceInput6).withOutput(whatsappBusinessStatusSchema).query("conversations").withInput(whatsappBusinessConversationsInputSchema).withOutput(external_exports.array(whatsappBusinessConversationSchema)).query("templates").withInput(workspaceInput6).withOutput(external_exports.array(whatsappBusinessTemplateSchema)).query("prices").withInput(external_exports.object({ ...pricesInputDefinition.shape, workspaceId:
|
|
91004
|
+
var whatsappBusinessTrpc = defineTrpcContract("whatsappBusiness").query("status").withInput(workspaceInput6).withOutput(whatsappBusinessStatusSchema).mutation("connect").withInput(connectWhatsappBusinessInputSchema).withOutput(whatsappBusinessWebhookSchema).mutation("check").withInput(workspaceInput6).withOutput(whatsappBusinessStatusSchema).mutation("verifyToken").withInput(workspaceInput6).withOutput(whatsappBusinessWebhookSchema).mutation("settings").withInput(updateWhatsappBusinessSettingsInputSchema).withOutput(whatsappBusinessStatusSchema).mutation("disconnect").withInput(workspaceInput6).withOutput(whatsappBusinessStatusSchema).query("conversations").withInput(whatsappBusinessConversationsInputSchema).withOutput(external_exports.array(whatsappBusinessConversationSchema)).query("templates").withInput(workspaceInput6).withOutput(external_exports.array(whatsappBusinessTemplateSchema)).query("prices").withInput(external_exports.object({ ...pricesInputDefinition.shape, workspaceId: workspaceIdSchema23 })).withOutput(whatsappBusinessPricesSchema).build();
|
|
89826
91005
|
|
|
89827
91006
|
// ../../modules/whatsapp-business/contract/src/whatsapp-business.config.ts
|
|
89828
91007
|
var whatsappBusinessConfig = Config.define((c) => ({
|
|
@@ -89999,7 +91178,7 @@ async function secretsOf3({ context, args }) {
|
|
|
89999
91178
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
90000
91179
|
if (fromConnection) return { fromConnection };
|
|
90001
91180
|
const file3 = flagText({ args, name: "from-file" });
|
|
90002
|
-
const text2 = file3 ? await
|
|
91181
|
+
const text2 = file3 ? await readFile42(resolve19(context.cwd, file3), "utf8") : await context.readStdin();
|
|
90003
91182
|
const lines2 = text2.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
90004
91183
|
if (lines2.length !== 2) {
|
|
90005
91184
|
throw new CliUsageError(
|
|
@@ -90032,7 +91211,7 @@ var conversations = async ({ context, args, client }) => {
|
|
|
90032
91211
|
`);
|
|
90033
91212
|
}
|
|
90034
91213
|
};
|
|
90035
|
-
var
|
|
91214
|
+
var read2 = async ({ context, args, client }) => {
|
|
90036
91215
|
const answer5 = await client.post(WHATSAPP_BUSINESS_REST_PATHS.read, {
|
|
90037
91216
|
contact: wordAt9(args, 2),
|
|
90038
91217
|
...limitOf4(args)
|
|
@@ -90176,7 +91355,7 @@ var disconnect5 = async ({ context, args, client }) => {
|
|
|
90176
91355
|
var RUNS6 = {
|
|
90177
91356
|
status: status7,
|
|
90178
91357
|
conversations,
|
|
90179
|
-
read,
|
|
91358
|
+
read: read2,
|
|
90180
91359
|
send: send3,
|
|
90181
91360
|
"send-template": sendTemplate,
|
|
90182
91361
|
"send-status": sendStatus,
|
|
@@ -90251,7 +91430,7 @@ async function pairing({ context, args }) {
|
|
|
90251
91430
|
});
|
|
90252
91431
|
await report2({ context, args, pairing: answer5 });
|
|
90253
91432
|
}
|
|
90254
|
-
async function
|
|
91433
|
+
async function cancel3({ context, args }) {
|
|
90255
91434
|
const pairingId = wordAt10({ args, at: 2 });
|
|
90256
91435
|
const client = await computeClient({ context, args });
|
|
90257
91436
|
const answer5 = await client.post(COMPUTE_WHATSAPP_REST_PATHS.cancelPairing, {
|
|
@@ -90271,7 +91450,7 @@ async function unpair({ context, args }) {
|
|
|
90271
91450
|
context.out(`WhatsApp is unlinked from ${answer5.name}.
|
|
90272
91451
|
`);
|
|
90273
91452
|
}
|
|
90274
|
-
var COMMANDS2 = { pair, pairing, cancel:
|
|
91453
|
+
var COMMANDS2 = { pair, pairing, cancel: cancel3, unpair };
|
|
90275
91454
|
function whatsappPairingCommand(name3) {
|
|
90276
91455
|
return name3 && Object.hasOwn(COMMANDS2, name3) ? COMMANDS2[name3] : void 0;
|
|
90277
91456
|
}
|
|
@@ -90325,7 +91504,7 @@ async function chats({ context, args }) {
|
|
|
90325
91504
|
);
|
|
90326
91505
|
}
|
|
90327
91506
|
}
|
|
90328
|
-
async function
|
|
91507
|
+
async function read3({ context, args }) {
|
|
90329
91508
|
const client = await computeClient({ context, args });
|
|
90330
91509
|
const answer5 = await client.post(
|
|
90331
91510
|
PATHS3.read,
|
|
@@ -90390,7 +91569,7 @@ async function whatsapp({
|
|
|
90390
91569
|
}) {
|
|
90391
91570
|
const command = args.words[1];
|
|
90392
91571
|
if (command === "chats") return chats({ context, args });
|
|
90393
|
-
if (command === "read") return
|
|
91572
|
+
if (command === "read") return read3({ context, args });
|
|
90394
91573
|
if (command === "send") return send4({ context, args });
|
|
90395
91574
|
if (command === "status") return status8({ context, args });
|
|
90396
91575
|
const linking = whatsappPairingCommand(command);
|
|
@@ -90622,6 +91801,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
90622
91801
|
laze workspace leave leave this workspace
|
|
90623
91802
|
laze workspace delete --confirm <name> | cancel-deletion schedule its deletion, or take it back (Owners)
|
|
90624
91803
|
laze members the workspace's people, each with their role
|
|
91804
|
+
laze invite [--to <conversation>] [--yes] <email>... invite people to a chat; shows the price first
|
|
90625
91805
|
laze members invite <email> [--role owner|admin|member|guest] invite someone (admins)
|
|
90626
91806
|
laze members invites | revoke-invite <email|id> invitations waiting, or take one back (admins)
|
|
90627
91807
|
laze members invite-link <email|id> a fresh link for an invitation, shown once (admins)
|
|
@@ -90733,6 +91913,12 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
90733
91913
|
laze agent retry <agent> --channel <id> --message <id> Try again on its failed turn on that message
|
|
90734
91914
|
laze agent invite [--name <name>] [--channel <id>] a one-time link that connects a new agent;
|
|
90735
91915
|
without --name the agent picks its own
|
|
91916
|
+
laze agent invite --reconnect <agent> a link that connects one of your agents again with a new key,
|
|
91917
|
+
a migrated one back on its own machine
|
|
91918
|
+
laze agent migrate <agent> [--to claude-code|codex|laze-models] [--level fast|frontier] [--resend]
|
|
91919
|
+
move your connected agent into Laze as the same agent; its session uploads its conversation, secrets removed
|
|
91920
|
+
laze agent migrate status|cancel <agent> the latest migration, or cancel one still waiting
|
|
91921
|
+
laze agent migrate upload <migrationId> run inside the agent's own session: hands its transcript to Laze
|
|
90736
91922
|
laze agent faces every agent's sloth seed or picture
|
|
90737
91923
|
laze adopt codex [--thread <id>] answer Laze messages in a Codex thread
|
|
90738
91924
|
laze adopt codex --status | --stop the background adopt that laze agent link started
|
|
@@ -90835,6 +92021,7 @@ var COMMANDS3 = {
|
|
|
90835
92021
|
workspaces,
|
|
90836
92022
|
workspace,
|
|
90837
92023
|
members: members2,
|
|
92024
|
+
invite: invite3,
|
|
90838
92025
|
update: update2,
|
|
90839
92026
|
"channels list": listChannels,
|
|
90840
92027
|
"channel set": setChannelLevel,
|
|
@@ -90998,6 +92185,7 @@ var COMMANDS3 = {
|
|
|
90998
92185
|
"agent retry": retryAgentTurn,
|
|
90999
92186
|
"agent disconnect": disconnectAgent,
|
|
91000
92187
|
"agent invite": inviteAgent,
|
|
92188
|
+
"agent migrate": agentMigrate,
|
|
91001
92189
|
"mcp gateway": serveMcpGateway,
|
|
91002
92190
|
mcp: (input2) => serveMcp({ ...input2, runCommandLine: runCli })
|
|
91003
92191
|
};
|
|
@@ -91041,7 +92229,8 @@ async function runCli({
|
|
|
91041
92229
|
[browser, `${BROWSER_USAGE}
|
|
91042
92230
|
`],
|
|
91043
92231
|
[external, `${EXTERNAL_USAGE}
|
|
91044
|
-
`]
|
|
92232
|
+
`],
|
|
92233
|
+
[agentMigrate, MIGRATE_USAGE]
|
|
91045
92234
|
]);
|
|
91046
92235
|
if (command && args.flags.help && ownHelp.has(command)) {
|
|
91047
92236
|
context.out(ownHelp.get(command) ?? HELP);
|
|
@@ -91055,19 +92244,26 @@ async function runCli({
|
|
|
91055
92244
|
const quiet = args.words[0] === "hook";
|
|
91056
92245
|
return await command({ context: watchingRelease({ context, quiet }), args }) ?? 0;
|
|
91057
92246
|
} catch (error62) {
|
|
91058
|
-
|
|
92247
|
+
return exitCodeOf({ context, error: error62 });
|
|
92248
|
+
}
|
|
92249
|
+
}
|
|
92250
|
+
function exitCodeOf({ context, error: error62 }) {
|
|
92251
|
+
if (error62 instanceof ProfileMigratedError) return 0;
|
|
92252
|
+
const migrated = migratedNoticeOf(error62);
|
|
92253
|
+
if (migrated) context.err(`${migrated.notice}
|
|
91059
92254
|
`);
|
|
91060
|
-
|
|
92255
|
+
else if (error62 instanceof CliUsageError) context.err(`${error62.message}
|
|
91061
92256
|
`);
|
|
91062
|
-
|
|
91063
|
-
|
|
91064
|
-
|
|
92257
|
+
else if (error62 instanceof LazeApiError) context.err(`laze: ${error62.message} (${error62.code})
|
|
92258
|
+
`);
|
|
92259
|
+
else throw error62;
|
|
92260
|
+
return 1;
|
|
91065
92261
|
}
|
|
91066
92262
|
|
|
91067
92263
|
// src/services/processes.service.ts
|
|
91068
92264
|
import { execFile as execFile2, spawn as spawn4 } from "node:child_process";
|
|
91069
92265
|
import { mkdirSync, openSync } from "node:fs";
|
|
91070
|
-
import { readFile as
|
|
92266
|
+
import { readFile as readFile43, readlink } from "node:fs/promises";
|
|
91071
92267
|
import { dirname as dirname23 } from "node:path";
|
|
91072
92268
|
import { promisify as promisify2 } from "node:util";
|
|
91073
92269
|
var run3 = promisify2(execFile2);
|
|
@@ -91081,15 +92277,15 @@ function alive(pid) {
|
|
|
91081
92277
|
}
|
|
91082
92278
|
}
|
|
91083
92279
|
async function argsOf(pid) {
|
|
91084
|
-
const raw = await
|
|
92280
|
+
const raw = await readFile43(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
|
|
91085
92281
|
if (raw) return raw.split("\0").filter(Boolean);
|
|
91086
92282
|
const listed = await run3("ps", ["-o", "args=", "-p", String(pid)]).catch(() => void 0);
|
|
91087
92283
|
const line = listed?.stdout.trim();
|
|
91088
92284
|
return line ? line.split(/\s+/) : void 0;
|
|
91089
92285
|
}
|
|
91090
92286
|
async function parentOf(pid) {
|
|
91091
|
-
const
|
|
91092
|
-
const fromStat =
|
|
92287
|
+
const stat8 = await readFile43(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
|
|
92288
|
+
const fromStat = stat8 ? Number(stat8.slice(stat8.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
|
|
91093
92289
|
if (fromStat > 0) return fromStat;
|
|
91094
92290
|
const listed = await run3("ps", ["-o", "ppid=", "-p", String(pid)]).catch(() => void 0);
|
|
91095
92291
|
const parent = Number(listed?.stdout.trim());
|