@lazehq/cli 0.1.56 → 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 +1611 -432
- 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,
|
|
@@ -61752,6 +61885,8 @@ var vaultConfig = Config.define((c) => ({
|
|
|
61752
61885
|
publicOriginAliases,
|
|
61753
61886
|
/** A file each audit chain head is appended to as a JSON line; unset only logs the heads. */
|
|
61754
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()),
|
|
61755
61890
|
/** vaultd's socket; set, the master key and data keys stay in vaultd, unset keeps them here. */
|
|
61756
61891
|
vaultdSocket: c.env("LAZE_VAULTD_SOCKET", external_exports.string().min(1).optional()),
|
|
61757
61892
|
/** Where the in-process key sends AWS STS calls instead of AWS; vaultd has its own flag. */
|
|
@@ -62856,6 +62991,18 @@ var claudeGatewayModelsSchemaDefinition = external_exports.object({
|
|
|
62856
62991
|
haiku: external_exports.string().min(1)
|
|
62857
62992
|
});
|
|
62858
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;
|
|
62859
63006
|
var agentSandboxSpecSchemaDefinition = external_exports.object({
|
|
62860
63007
|
workspaceId: external_exports.string().min(1),
|
|
62861
63008
|
agentId: external_exports.string().regex(/^[a-zA-Z0-9_-]+$/),
|
|
@@ -62884,7 +63031,9 @@ var agentSandboxSpecSchemaDefinition = external_exports.object({
|
|
|
62884
63031
|
/** A personal agent's owner: their dedicated IP's route applies to this agent. */
|
|
62885
63032
|
routeOwnerUserId: external_exports.string().min(1).optional(),
|
|
62886
63033
|
/** Set by the runtime from the workspace's plan: egress applies the Free plan's rules. */
|
|
62887
|
-
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()
|
|
62888
63037
|
});
|
|
62889
63038
|
var deliveredFileSchemaDefinition = external_exports.object({
|
|
62890
63039
|
/** Relative to the agent's work folder, e.g. `attachments/<messageId>/report.pdf`. */
|
|
@@ -63072,6 +63221,8 @@ var supervisorLaunchSchemaDefinition = external_exports.object({
|
|
|
63072
63221
|
cli: external_exports.object({ workspaceId: external_exports.string().min(1), agentName: external_exports.string().min(1) }).optional(),
|
|
63073
63222
|
/** The agent's DM with its owner: its one session is tagged with it and its events carry it. */
|
|
63074
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(),
|
|
63075
63226
|
/** Set by the connector on a person's own machine: ports, paths and the local token. */
|
|
63076
63227
|
machine: supervisorMachineSchemaDefinition.optional(),
|
|
63077
63228
|
/** On a machine, by relay connection id: the placeholder a local caller must present. */
|
|
@@ -65208,6 +65359,124 @@ var uploadAvatarAsCallerInputSchemaDefinition = external_exports.object({
|
|
|
65208
65359
|
dataBase64: external_exports.string().min(1).max(Math.ceil(AGENT_AVATAR_PICK_MAX_BYTES * 4 / 3) + 8)
|
|
65209
65360
|
});
|
|
65210
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
|
+
|
|
65211
65480
|
// ../../modules/agent/contract/src/agent-monitors.ts
|
|
65212
65481
|
var MONITOR_PROMPT_MAX = 4e3;
|
|
65213
65482
|
var MONITOR_RUNS_PER_DAY_DEFAULT = 100;
|
|
@@ -65269,8 +65538,8 @@ var addedMonitorSchemaDefinition = external_exports.object({
|
|
|
65269
65538
|
// ../../modules/agent/contract/src/agent-oauth.ts
|
|
65270
65539
|
var OAUTH_CODE_TTL_SECONDS = 5 * 60;
|
|
65271
65540
|
var REMOTE_MCP_PATH = "/mcp";
|
|
65272
|
-
var
|
|
65273
|
-
var
|
|
65541
|
+
var workspaceIdSchema9 = external_exports.string().min(1);
|
|
65542
|
+
var idSchema13 = external_exports.string().min(1).max(80);
|
|
65274
65543
|
var oauthAuthorizeRequestSchemaDefinition = external_exports.object({
|
|
65275
65544
|
response_type: external_exports.string().max(40).optional(),
|
|
65276
65545
|
client_id: external_exports.string().min(1).max(4096),
|
|
@@ -65282,7 +65551,7 @@ var oauthAuthorizeRequestSchemaDefinition = external_exports.object({
|
|
|
65282
65551
|
scope: external_exports.string().max(400).optional()
|
|
65283
65552
|
});
|
|
65284
65553
|
var oauthRequestInputSchemaDefinition = external_exports.object({
|
|
65285
|
-
workspaceId:
|
|
65554
|
+
workspaceId: workspaceIdSchema9,
|
|
65286
65555
|
request: oauthAuthorizeRequestSchemaDefinition
|
|
65287
65556
|
});
|
|
65288
65557
|
var oauthRequestInputSchema = oauthRequestInputSchemaDefinition;
|
|
@@ -65291,16 +65560,16 @@ var oauthRequestViewSchemaDefinition = external_exports.object({
|
|
|
65291
65560
|
/** The host the browser returns to, such as `chatgpt.com`. */
|
|
65292
65561
|
redirectHost: external_exports.string(),
|
|
65293
65562
|
/** The person's connected agents of this client in the workspace, newest first. */
|
|
65294
|
-
reconnectable: external_exports.array(external_exports.object({ id:
|
|
65563
|
+
reconnectable: external_exports.array(external_exports.object({ id: idSchema13, name: external_exports.string() })),
|
|
65295
65564
|
defaultName: external_exports.string()
|
|
65296
65565
|
});
|
|
65297
65566
|
var oauthRequestViewSchema = oauthRequestViewSchemaDefinition;
|
|
65298
65567
|
var approveOAuthInputSchemaDefinition = external_exports.object({
|
|
65299
|
-
workspaceId:
|
|
65568
|
+
workspaceId: workspaceIdSchema9,
|
|
65300
65569
|
request: oauthAuthorizeRequestSchemaDefinition,
|
|
65301
65570
|
name: external_exports.string().trim().min(1).max(80),
|
|
65302
65571
|
/** One of the person's agents of this client to hand a new key, instead of a new agent. */
|
|
65303
|
-
reconnectAgentId:
|
|
65572
|
+
reconnectAgentId: idSchema13.optional()
|
|
65304
65573
|
});
|
|
65305
65574
|
var approveOAuthInputSchema = approveOAuthInputSchemaDefinition;
|
|
65306
65575
|
var oauthRedirectSchemaDefinition = external_exports.object({ redirectUrl: external_exports.string() });
|
|
@@ -65332,9 +65601,9 @@ var agentPermissionPromptSchemaDefinition = external_exports.object({
|
|
|
65332
65601
|
var agentPermissionPromptSchema = agentPermissionPromptSchemaDefinition;
|
|
65333
65602
|
|
|
65334
65603
|
// ../../modules/agent/contract/src/agent-transfer.ts
|
|
65335
|
-
var
|
|
65336
|
-
var
|
|
65337
|
-
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);
|
|
65338
65607
|
var agentTransferOfferSchemaDefinition = external_exports.object({
|
|
65339
65608
|
id: external_exports.string().min(1),
|
|
65340
65609
|
agentId: external_exports.string().min(1),
|
|
@@ -65349,11 +65618,11 @@ var agentTransferOfferSchemaDefinition = external_exports.object({
|
|
|
65349
65618
|
});
|
|
65350
65619
|
var agentTransferOfferSchema = agentTransferOfferSchemaDefinition;
|
|
65351
65620
|
var agentTransferInputSchemaDefinition = external_exports.object({
|
|
65352
|
-
workspaceId:
|
|
65353
|
-
agentId:
|
|
65621
|
+
workspaceId: workspaceIdSchema10,
|
|
65622
|
+
agentId: idSchema14
|
|
65354
65623
|
});
|
|
65355
65624
|
var agentTransferInputSchema = agentTransferInputSchemaDefinition;
|
|
65356
|
-
var agentTransferAsCallerInputSchemaDefinition = external_exports.object({ agent:
|
|
65625
|
+
var agentTransferAsCallerInputSchemaDefinition = external_exports.object({ agent: agentRefSchema6 });
|
|
65357
65626
|
var agentTransferOfferedPayloadSchemaDefinition = external_exports.object({
|
|
65358
65627
|
workspaceId: external_exports.string().min(1),
|
|
65359
65628
|
offerId: external_exports.string().min(1),
|
|
@@ -65383,24 +65652,24 @@ var agentWorkingSchemaDefinition = external_exports.object({ working: external_e
|
|
|
65383
65652
|
var agentWorkingSchema = agentWorkingSchemaDefinition;
|
|
65384
65653
|
|
|
65385
65654
|
// ../../modules/agent/contract/src/agent-workspace-default.ts
|
|
65386
|
-
var
|
|
65387
|
-
var
|
|
65388
|
-
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);
|
|
65389
65658
|
var workspaceDefaultAgentSchemaDefinition = external_exports.object({
|
|
65390
65659
|
/** Null when the workspace has none, or its pick was removed. */
|
|
65391
|
-
agentId:
|
|
65660
|
+
agentId: idSchema15.nullable(),
|
|
65392
65661
|
name: external_exports.string().nullable()
|
|
65393
65662
|
});
|
|
65394
65663
|
var workspaceDefaultAgentSchema = workspaceDefaultAgentSchemaDefinition;
|
|
65395
65664
|
var setWorkspaceDefaultAgentInputSchemaDefinition = external_exports.object({
|
|
65396
|
-
workspaceId:
|
|
65665
|
+
workspaceId: workspaceIdSchema11,
|
|
65397
65666
|
/** A team agent of the workspace; null clears the pick. */
|
|
65398
|
-
agentId:
|
|
65667
|
+
agentId: idSchema15.nullable()
|
|
65399
65668
|
});
|
|
65400
65669
|
var setWorkspaceDefaultAgentInputSchema = setWorkspaceDefaultAgentInputSchemaDefinition;
|
|
65401
65670
|
var setWorkspaceDefaultAgentAsCallerInputSchemaDefinition = external_exports.object({
|
|
65402
65671
|
/** The agent by id or name; null clears the pick. */
|
|
65403
|
-
agent:
|
|
65672
|
+
agent: agentRefSchema7.nullable()
|
|
65404
65673
|
});
|
|
65405
65674
|
|
|
65406
65675
|
// ../../modules/agent/contract/src/agent.ts
|
|
@@ -65408,8 +65677,8 @@ var AGENT_LINK_TTL_SECONDS = 30 * 60;
|
|
|
65408
65677
|
var AGENT_JOIN_REQUEST_TTL_SECONDS = 24 * 60 * 60;
|
|
65409
65678
|
var AGENT_ONLINE_WINDOW_SECONDS = 5 * 60;
|
|
65410
65679
|
var INBOX_WAIT_MAX_SECONDS = 55;
|
|
65411
|
-
var
|
|
65412
|
-
var
|
|
65680
|
+
var workspaceIdSchema12 = external_exports.string().min(1);
|
|
65681
|
+
var idSchema16 = external_exports.string().min(1).max(80);
|
|
65413
65682
|
var agentHarnessSchema = external_exports.enum([
|
|
65414
65683
|
"claude-code",
|
|
65415
65684
|
"codex",
|
|
@@ -65456,27 +65725,27 @@ var agentContextSchemaDefinition = external_exports.object({
|
|
|
65456
65725
|
updatedAt: external_exports.iso.datetime().nullable()
|
|
65457
65726
|
});
|
|
65458
65727
|
var agentHostSchemaDefinition = external_exports.object({
|
|
65459
|
-
machineId:
|
|
65728
|
+
machineId: idSchema16,
|
|
65460
65729
|
whenOffline: external_exports.enum(["wait", "sandbox"])
|
|
65461
65730
|
});
|
|
65462
65731
|
var setAgentHostInputSchemaDefinition = external_exports.object({
|
|
65463
|
-
workspaceId:
|
|
65464
|
-
agentId:
|
|
65732
|
+
workspaceId: workspaceIdSchema12,
|
|
65733
|
+
agentId: idSchema16,
|
|
65465
65734
|
host: agentHostSchemaDefinition.nullable()
|
|
65466
65735
|
});
|
|
65467
65736
|
var setAgentComputerKeyInputSchemaDefinition = external_exports.object({
|
|
65468
|
-
workspaceId:
|
|
65469
|
-
agentId:
|
|
65737
|
+
workspaceId: workspaceIdSchema12,
|
|
65738
|
+
agentId: idSchema16,
|
|
65470
65739
|
computerKey: external_exports.string().min(1).max(200).nullable()
|
|
65471
65740
|
});
|
|
65472
65741
|
var agentSchemaDefinition = external_exports.object({
|
|
65473
|
-
id:
|
|
65474
|
-
workspaceId:
|
|
65742
|
+
id: idSchema16,
|
|
65743
|
+
workspaceId: workspaceIdSchema12,
|
|
65475
65744
|
name: external_exports.string(),
|
|
65476
65745
|
kind: external_exports.enum(["personal", "team"]),
|
|
65477
65746
|
hosting: agentHostingSchema,
|
|
65478
65747
|
harness: agentHarnessSchema,
|
|
65479
|
-
ownerUserId:
|
|
65748
|
+
ownerUserId: idSchema16,
|
|
65480
65749
|
status: external_exports.enum(["connected", "disconnected"]),
|
|
65481
65750
|
online: external_exports.boolean(),
|
|
65482
65751
|
lastSeenAt: external_exports.iso.datetime().nullable(),
|
|
@@ -65518,7 +65787,7 @@ var agentSchemaDefinition = external_exports.object({
|
|
|
65518
65787
|
});
|
|
65519
65788
|
var agentSchema = agentSchemaDefinition;
|
|
65520
65789
|
var agentChannelSchemaDefinition = external_exports.object({
|
|
65521
|
-
id:
|
|
65790
|
+
id: idSchema16,
|
|
65522
65791
|
name: external_exports.string(),
|
|
65523
65792
|
kind: external_exports.enum(["public", "private", "dm", "group", "chat"])
|
|
65524
65793
|
});
|
|
@@ -65533,22 +65802,22 @@ var agentNameSchema = external_exports.string().trim().min(1).max(80);
|
|
|
65533
65802
|
var instructionsSchema = external_exports.string().max(2e4);
|
|
65534
65803
|
var linkedAvatarSchema = external_exports.string().trim().max(16);
|
|
65535
65804
|
var createAgentInputSchemaDefinition = external_exports.object({
|
|
65536
|
-
workspaceId:
|
|
65805
|
+
workspaceId: workspaceIdSchema12,
|
|
65537
65806
|
name: agentNameSchema,
|
|
65538
65807
|
avatar: agentAvatarInputSchema.default(""),
|
|
65539
65808
|
harness: hostedHarnessSchema,
|
|
65540
65809
|
modelLevel: agentModelLevelSchema.optional(),
|
|
65541
65810
|
kind: external_exports.enum(["personal", "team"]).default("personal"),
|
|
65542
65811
|
instructions: instructionsSchema.default(""),
|
|
65543
|
-
channelIds: external_exports.array(
|
|
65812
|
+
channelIds: external_exports.array(idSchema16).max(50).default([]),
|
|
65544
65813
|
/** A Claude Code or Codex agent drawing from this login pool; a team one needs a pool. */
|
|
65545
65814
|
/** The pool's id or name. */
|
|
65546
65815
|
loginPoolId: external_exports.string().min(1).max(200).optional()
|
|
65547
65816
|
});
|
|
65548
65817
|
var createAgentInputSchema = createAgentInputSchemaDefinition;
|
|
65549
65818
|
var updateAgentInputSchemaDefinition = external_exports.object({
|
|
65550
|
-
workspaceId:
|
|
65551
|
-
agentId:
|
|
65819
|
+
workspaceId: workspaceIdSchema12,
|
|
65820
|
+
agentId: idSchema16,
|
|
65552
65821
|
name: agentNameSchema.optional(),
|
|
65553
65822
|
avatar: agentAvatarInputSchema.optional(),
|
|
65554
65823
|
modelLevel: agentModelLevelSchema.optional(),
|
|
@@ -65560,7 +65829,7 @@ var updateAgentInputSchemaDefinition = external_exports.object({
|
|
|
65560
65829
|
effort: runEffortInputSchema.optional(),
|
|
65561
65830
|
instructions: instructionsSchema.optional(),
|
|
65562
65831
|
/** The whole set: channels left out are left. */
|
|
65563
|
-
channelIds: external_exports.array(
|
|
65832
|
+
channelIds: external_exports.array(idSchema16).max(50).optional(),
|
|
65564
65833
|
/** Agents Laze runs only: paused, it does not wake until resumed and its messages wait. */
|
|
65565
65834
|
paused: external_exports.boolean().optional(),
|
|
65566
65835
|
/** Why it is paused, shown on the agents page and in the notice under held messages. */
|
|
@@ -65568,14 +65837,14 @@ var updateAgentInputSchemaDefinition = external_exports.object({
|
|
|
65568
65837
|
});
|
|
65569
65838
|
var updateAgentInputSchema = updateAgentInputSchemaDefinition;
|
|
65570
65839
|
var saveHarnessLoginInputSchemaDefinition = external_exports.object({
|
|
65571
|
-
workspaceId:
|
|
65840
|
+
workspaceId: workspaceIdSchema12,
|
|
65572
65841
|
harness: harnessLoginSchema,
|
|
65573
65842
|
secret: external_exports.string().trim().min(10).max(2e4).optional(),
|
|
65574
65843
|
signIn: harnessSignInValueSchema.optional()
|
|
65575
65844
|
});
|
|
65576
65845
|
var saveHarnessLoginInputSchema = saveHarnessLoginInputSchemaDefinition;
|
|
65577
65846
|
var removeHarnessLoginInputSchemaDefinition = external_exports.object({
|
|
65578
|
-
workspaceId:
|
|
65847
|
+
workspaceId: workspaceIdSchema12,
|
|
65579
65848
|
harness: harnessLoginSchema
|
|
65580
65849
|
});
|
|
65581
65850
|
var removeHarnessLoginInputSchema = removeHarnessLoginInputSchemaDefinition;
|
|
@@ -65587,13 +65856,13 @@ var harnessLoginsSchema = harnessLoginsSchemaDefinition;
|
|
|
65587
65856
|
var lastRuntimeSchemaDefinition = external_exports.object({ harness: hostedHarnessSchema.nullable() });
|
|
65588
65857
|
var lastRuntimeSchema = lastRuntimeSchemaDefinition;
|
|
65589
65858
|
var mintLinkInputSchemaDefinition = external_exports.object({
|
|
65590
|
-
workspaceId:
|
|
65859
|
+
workspaceId: workspaceIdSchema12,
|
|
65591
65860
|
/** Left out, the agent names itself when it joins, else it takes its harness's name. */
|
|
65592
65861
|
name: external_exports.string().trim().max(80).optional(),
|
|
65593
65862
|
/** The channel the agent joins once linked. */
|
|
65594
|
-
channelId:
|
|
65863
|
+
channelId: idSchema16.optional(),
|
|
65595
65864
|
/** One of the minting person's connected agents: redeeming gives it a new key instead. */
|
|
65596
|
-
reconnectAgentId:
|
|
65865
|
+
reconnectAgentId: idSchema16.optional()
|
|
65597
65866
|
});
|
|
65598
65867
|
var mintLinkInputSchema = mintLinkInputSchemaDefinition;
|
|
65599
65868
|
var mintedLinkSchemaDefinition = external_exports.object({
|
|
@@ -65625,7 +65894,7 @@ var redeemedLinkSchemaDefinition = external_exports.object({
|
|
|
65625
65894
|
agent: agentSchemaDefinition,
|
|
65626
65895
|
/** The agent's own `lz_` key, shown once. */
|
|
65627
65896
|
apiKey: external_exports.string(),
|
|
65628
|
-
channelId:
|
|
65897
|
+
channelId: idSchema16.nullable(),
|
|
65629
65898
|
/** The owner's key that may only ask for a new agent (`laze agent request`), shown once. */
|
|
65630
65899
|
requestKey: external_exports.string().nullable().optional()
|
|
65631
65900
|
});
|
|
@@ -65664,12 +65933,12 @@ var joinRequestAnswerSchemaDefinition = external_exports.discriminatedUnion("sta
|
|
|
65664
65933
|
})
|
|
65665
65934
|
]);
|
|
65666
65935
|
var joinRequestInputSchemaDefinition = external_exports.object({
|
|
65667
|
-
workspaceId:
|
|
65936
|
+
workspaceId: workspaceIdSchema12,
|
|
65668
65937
|
code: external_exports.string().trim().min(1).max(20)
|
|
65669
65938
|
});
|
|
65670
65939
|
var joinRequestInputSchema = joinRequestInputSchemaDefinition;
|
|
65671
65940
|
var approveJoinRequestInputSchemaDefinition = external_exports.object({
|
|
65672
|
-
workspaceId:
|
|
65941
|
+
workspaceId: workspaceIdSchema12,
|
|
65673
65942
|
code: external_exports.string().trim().min(1).max(20),
|
|
65674
65943
|
/** The person may rename the agent as they approve it. */
|
|
65675
65944
|
name: external_exports.string().trim().max(80).optional()
|
|
@@ -65690,12 +65959,12 @@ var inboxCatchUpSchemaDefinition = external_exports.object({
|
|
|
65690
65959
|
});
|
|
65691
65960
|
var inboxCatchUpSchema = inboxCatchUpSchemaDefinition;
|
|
65692
65961
|
var inboxMessageSchemaDefinition = external_exports.object({
|
|
65693
|
-
messageId:
|
|
65694
|
-
channelId:
|
|
65962
|
+
messageId: idSchema16,
|
|
65963
|
+
channelId: idSchema16,
|
|
65695
65964
|
channelName: external_exports.string(),
|
|
65696
65965
|
channelKind: external_exports.enum(["public", "private", "dm", "group", "chat"]),
|
|
65697
|
-
threadRootId:
|
|
65698
|
-
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() }),
|
|
65699
65968
|
body: external_exports.string(),
|
|
65700
65969
|
postedAt: external_exports.iso.datetime(),
|
|
65701
65970
|
/** On the first message of each conversation in a catch up (agent-catch-up.feature). */
|
|
@@ -65715,9 +65984,9 @@ var inboxWaitingSchemaDefinition = external_exports.object({
|
|
|
65715
65984
|
});
|
|
65716
65985
|
var callerSchemaDefinition = external_exports.object({
|
|
65717
65986
|
kind: external_exports.enum(["person", "agent"]),
|
|
65718
|
-
id:
|
|
65987
|
+
id: idSchema16,
|
|
65719
65988
|
name: external_exports.string(),
|
|
65720
|
-
workspaceId:
|
|
65989
|
+
workspaceId: workspaceIdSchema12,
|
|
65721
65990
|
agent: agentSchemaDefinition.nullable(),
|
|
65722
65991
|
/** Messages waiting in the agent's inbox, not taken yet; 0 for a person. */
|
|
65723
65992
|
pendingCount: external_exports.number().int().min(0).optional(),
|
|
@@ -65733,7 +66002,7 @@ var agentGuideFilesSchemaDefinition = external_exports.object({
|
|
|
65733
66002
|
});
|
|
65734
66003
|
var agentChannelLevelSchema = external_exports.enum(["everything", "mentions"]);
|
|
65735
66004
|
var callerChannelSchemaDefinition = external_exports.object({
|
|
65736
|
-
id:
|
|
66005
|
+
id: idSchema16,
|
|
65737
66006
|
name: external_exports.string(),
|
|
65738
66007
|
kind: external_exports.enum(["public", "private", "dm", "group", "chat"]),
|
|
65739
66008
|
unread: external_exports.number().int().nonnegative(),
|
|
@@ -65747,9 +66016,9 @@ var callerChannelSchemaDefinition = external_exports.object({
|
|
|
65747
66016
|
isDefault: external_exports.boolean().default(false)
|
|
65748
66017
|
});
|
|
65749
66018
|
var setChannelLevelInputSchemaDefinition = external_exports.object({
|
|
65750
|
-
workspaceId:
|
|
65751
|
-
agentId:
|
|
65752
|
-
channelId:
|
|
66019
|
+
workspaceId: workspaceIdSchema12,
|
|
66020
|
+
agentId: idSchema16,
|
|
66021
|
+
channelId: idSchema16,
|
|
65753
66022
|
level: agentChannelLevelSchema
|
|
65754
66023
|
});
|
|
65755
66024
|
var setChannelLevelInputSchema = setChannelLevelInputSchemaDefinition;
|
|
@@ -65772,12 +66041,12 @@ var postAsCallerInputSchemaDefinition = external_exports.object({
|
|
|
65772
66041
|
/** A channel's name (with or without `#`) or id. */
|
|
65773
66042
|
channel: external_exports.string().trim().min(1).max(81),
|
|
65774
66043
|
body: external_exports.string().trim().min(1).max(4e4),
|
|
65775
|
-
threadRootId:
|
|
66044
|
+
threadRootId: idSchema16.optional(),
|
|
65776
66045
|
/** The messages of the agent's turn this post answers. */
|
|
65777
|
-
answers: external_exports.array(
|
|
66046
|
+
answers: external_exports.array(idSchema16).max(200).optional()
|
|
65778
66047
|
});
|
|
65779
66048
|
var replyAsCallerInputSchemaDefinition = external_exports.object({
|
|
65780
|
-
messageId:
|
|
66049
|
+
messageId: idSchema16,
|
|
65781
66050
|
body: external_exports.string().trim().min(1).max(4e4),
|
|
65782
66051
|
/** Needed for a message that is not in the caller's inbox. */
|
|
65783
66052
|
channel: external_exports.string().trim().min(1).max(81).optional(),
|
|
@@ -65786,18 +66055,18 @@ var replyAsCallerInputSchemaDefinition = external_exports.object({
|
|
|
65786
66055
|
/** A thread reply also shows in the channel, as "Also send to #channel" does. */
|
|
65787
66056
|
alsoInChannel: external_exports.boolean().optional(),
|
|
65788
66057
|
/** The other messages of the agent's turn this reply answers. */
|
|
65789
|
-
answers: external_exports.array(
|
|
66058
|
+
answers: external_exports.array(idSchema16).max(200).optional()
|
|
65790
66059
|
});
|
|
65791
66060
|
var postedMessageSchemaDefinition = external_exports.object({
|
|
65792
|
-
messageId:
|
|
65793
|
-
channelId:
|
|
65794
|
-
threadRootId:
|
|
66061
|
+
messageId: idSchema16,
|
|
66062
|
+
channelId: idSchema16,
|
|
66063
|
+
threadRootId: idSchema16.nullable(),
|
|
65795
66064
|
/** Workspace members the message mentioned who are not in the channel: it did not reach them. */
|
|
65796
66065
|
notInChannel: external_exports.array(external_exports.object({ ...notInChannelSchema.shape, name: external_exports.string() })).default([]),
|
|
65797
66066
|
/** Mentioned agents that are paused or out of usage: the message waits for each of them. */
|
|
65798
66067
|
waitsFor: external_exports.array(
|
|
65799
66068
|
external_exports.object({
|
|
65800
|
-
agentId:
|
|
66069
|
+
agentId: idSchema16,
|
|
65801
66070
|
name: external_exports.string(),
|
|
65802
66071
|
cause: external_exports.enum(["paused", "out_of_usage"]),
|
|
65803
66072
|
/** When an agent out of usage gets its usage back; null while paused. */
|
|
@@ -65814,15 +66083,15 @@ var searchAsCallerInputSchemaDefinition = external_exports.object({
|
|
|
65814
66083
|
});
|
|
65815
66084
|
var callerActorNameSchema = external_exports.object({
|
|
65816
66085
|
kind: external_exports.enum(["person", "agent"]),
|
|
65817
|
-
id:
|
|
66086
|
+
id: idSchema16,
|
|
65818
66087
|
name: external_exports.string()
|
|
65819
66088
|
});
|
|
65820
66089
|
var callerSearchHitSchemaDefinition = external_exports.object({
|
|
65821
|
-
messageId:
|
|
65822
|
-
channelId:
|
|
66090
|
+
messageId: idSchema16,
|
|
66091
|
+
channelId: idSchema16,
|
|
65823
66092
|
channelName: external_exports.string(),
|
|
65824
66093
|
channelKind: external_exports.enum(["public", "private", "dm", "group", "chat"]),
|
|
65825
|
-
threadRootId:
|
|
66094
|
+
threadRootId: idSchema16.nullable(),
|
|
65826
66095
|
seq: external_exports.number().int().positive(),
|
|
65827
66096
|
/** `external` for a mirrored message from someone outside Laze. */
|
|
65828
66097
|
author: external_exports.object({
|
|
@@ -65844,7 +66113,7 @@ var callerSearchResultSchemaDefinition = external_exports.object({
|
|
|
65844
66113
|
/** Names for the mention tokens in the bodies. */
|
|
65845
66114
|
mentions: external_exports.object({
|
|
65846
66115
|
actors: external_exports.array(callerActorNameSchema),
|
|
65847
|
-
channels: external_exports.array(external_exports.object({ id:
|
|
66116
|
+
channels: external_exports.array(external_exports.object({ id: idSchema16, name: external_exports.string() }))
|
|
65848
66117
|
})
|
|
65849
66118
|
});
|
|
65850
66119
|
var agentActivityInputSchemaDefinition = external_exports.object({
|
|
@@ -65916,14 +66185,14 @@ var codexLoginRefreshInputSchemaDefinition = external_exports.object({
|
|
|
65916
66185
|
authJson: external_exports.string().min(2).max(CODEX_LOGIN_MAX_LENGTH)
|
|
65917
66186
|
});
|
|
65918
66187
|
var AgentApi = moduleApi()("agent");
|
|
65919
|
-
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();
|
|
65920
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();
|
|
65921
|
-
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();
|
|
65922
66191
|
var agentJoinTrpc = defineTrpcContract("agents").query("joinRequest").withInput(joinRequestInputSchema).withOutput(joinRequestViewSchema).mutation("approveJoinRequest").withInput(approveJoinRequestInputSchema).withOutput(joinRequestViewSchema).mutation("denyJoinRequest").withInput(joinRequestInputSchema).withOutput(joinRequestViewSchema).build();
|
|
65923
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();
|
|
65924
|
-
var agentWorkspaceDefaultTrpc = defineTrpcContract("agents").query("workspaceDefault").withInput(external_exports.object({ workspaceId:
|
|
65925
|
-
var agentRuntimeChoiceTrpc = defineTrpcContract("agents").query("lastRuntime").withInput(external_exports.object({ workspaceId:
|
|
65926
|
-
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();
|
|
65927
66196
|
var agentTrpc = joinTrpcContracts(
|
|
65928
66197
|
"agents",
|
|
65929
66198
|
agentCoreTrpc,
|
|
@@ -65933,7 +66202,8 @@ var agentTrpc = joinTrpcContracts(
|
|
|
65933
66202
|
agentLoginTroubleTrpc,
|
|
65934
66203
|
agentWorkspaceDefaultTrpc,
|
|
65935
66204
|
agentRuntimeChoiceTrpc,
|
|
65936
|
-
agentArchiveTrpc
|
|
66205
|
+
agentArchiveTrpc,
|
|
66206
|
+
agentMigrationTrpc
|
|
65937
66207
|
);
|
|
65938
66208
|
var agentUi = uiTokens("agent");
|
|
65939
66209
|
var AgentNavSlot = agentUi.component("nav");
|
|
@@ -65951,6 +66221,7 @@ var AgentEditDialogSlot = agentUi.component("editDialog");
|
|
|
65951
66221
|
var AgentFaceSlot = agentUi.component("face");
|
|
65952
66222
|
var AgentAccessSlot = agentUi.component("access");
|
|
65953
66223
|
var AgentConnectDialogSlot = agentUi.component("connectDialog");
|
|
66224
|
+
var AgentMigrateDialogSlot = agentUi.component("migrateDialog");
|
|
65954
66225
|
var AgentChannelLevelSlot = agentUi.component("channelLevel");
|
|
65955
66226
|
var AgentMuteNoticeSlot = agentUi.component("muteNotice");
|
|
65956
66227
|
var AgentHopLimitNoticeSlot = agentUi.component("hopLimitNotice");
|
|
@@ -66062,27 +66333,27 @@ var agentKeepsFailingPayloadSchemaDefinition = external_exports.object({
|
|
|
66062
66333
|
});
|
|
66063
66334
|
|
|
66064
66335
|
// ../../modules/agent/contract/src/agent-caller-access.ts
|
|
66065
|
-
var
|
|
66066
|
-
var
|
|
66067
|
-
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 });
|
|
66068
66339
|
var shareAgentAsCallerInputSchemaDefinition = external_exports.object({
|
|
66069
|
-
agent:
|
|
66340
|
+
agent: agentRefSchema8,
|
|
66070
66341
|
grantee: agentGranteeSchema
|
|
66071
66342
|
});
|
|
66072
66343
|
var stopTurnAsCallerInputSchemaDefinition = external_exports.object({
|
|
66073
|
-
agent:
|
|
66074
|
-
channelId:
|
|
66344
|
+
agent: agentRefSchema8,
|
|
66345
|
+
channelId: idSchema17
|
|
66075
66346
|
});
|
|
66076
66347
|
var retryTurnAsCallerInputSchemaDefinition = external_exports.object({
|
|
66077
|
-
agent:
|
|
66078
|
-
channelId:
|
|
66079
|
-
messageId:
|
|
66348
|
+
agent: agentRefSchema8,
|
|
66349
|
+
channelId: idSchema17,
|
|
66350
|
+
messageId: idSchema17
|
|
66080
66351
|
});
|
|
66081
66352
|
var postTurnFailureAsCallerInputSchemaDefinition = external_exports.object({
|
|
66082
|
-
channelId:
|
|
66083
|
-
threadRootId:
|
|
66353
|
+
channelId: idSchema17,
|
|
66354
|
+
threadRootId: idSchema17.optional(),
|
|
66084
66355
|
/** The person's message the turn was on, which Try again sends to the agent again. */
|
|
66085
|
-
messageId:
|
|
66356
|
+
messageId: idSchema17,
|
|
66086
66357
|
/** The attempt that failed, so Try again knows once a later one is stored. */
|
|
66087
66358
|
attempt: external_exports.number().int().min(1).optional(),
|
|
66088
66359
|
line: external_exports.string().trim().min(1).max(1e3),
|
|
@@ -66091,7 +66362,9 @@ var postTurnFailureAsCallerInputSchemaDefinition = external_exports.object({
|
|
|
66091
66362
|
var mintLinkAsCallerInputSchemaDefinition = external_exports.object({
|
|
66092
66363
|
/** Left out, the agent that joins with the link names itself. */
|
|
66093
66364
|
name: external_exports.string().trim().max(80).optional(),
|
|
66094
|
-
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()
|
|
66095
66368
|
});
|
|
66096
66369
|
|
|
66097
66370
|
// ../../modules/agent/contract/src/agent-secret-sweep.ts
|
|
@@ -66201,25 +66474,25 @@ var agentScheduledRunMissedPayloadSchemaDefinition = external_exports.object({
|
|
|
66201
66474
|
});
|
|
66202
66475
|
|
|
66203
66476
|
// ../../modules/agent/contract/src/agent-history.ts
|
|
66204
|
-
var
|
|
66477
|
+
var idSchema18 = external_exports.string().min(1).max(80);
|
|
66205
66478
|
var CALLER_HISTORY_LIMIT_MAX = 100;
|
|
66206
66479
|
var historyAsCallerInputSchemaDefinition = external_exports.object({
|
|
66207
66480
|
/** A channel the key's speaker is in, by id or name. */
|
|
66208
66481
|
channel: external_exports.string().trim().min(1).max(200),
|
|
66209
66482
|
/** Messages before this Laze message; none reads the newest page. */
|
|
66210
|
-
before:
|
|
66483
|
+
before: idSchema18.optional(),
|
|
66211
66484
|
/** Already past the cache: no cached messages, only where the live read goes on. */
|
|
66212
66485
|
olderThan: external_exports.iso.datetime().optional(),
|
|
66213
66486
|
limit: external_exports.number().int().min(1).max(CALLER_HISTORY_LIMIT_MAX).default(50)
|
|
66214
66487
|
});
|
|
66215
66488
|
var callerHistoryMessageSchemaDefinition = external_exports.object({
|
|
66216
|
-
messageId:
|
|
66217
|
-
threadRootId:
|
|
66489
|
+
messageId: idSchema18,
|
|
66490
|
+
threadRootId: idSchema18.nullable(),
|
|
66218
66491
|
seq: external_exports.number().int().positive(),
|
|
66219
66492
|
/** `external` for a mirrored message from someone outside Laze. */
|
|
66220
66493
|
author: external_exports.object({
|
|
66221
66494
|
kind: external_exports.enum(["person", "agent", "external"]),
|
|
66222
|
-
id:
|
|
66495
|
+
id: idSchema18,
|
|
66223
66496
|
name: external_exports.string()
|
|
66224
66497
|
}),
|
|
66225
66498
|
body: external_exports.string(),
|
|
@@ -66229,7 +66502,7 @@ var callerHistoryMessageSchemaDefinition = external_exports.object({
|
|
|
66229
66502
|
originKey: external_exports.string().nullable()
|
|
66230
66503
|
});
|
|
66231
66504
|
var callerHistorySchemaDefinition = external_exports.object({
|
|
66232
|
-
channelId:
|
|
66505
|
+
channelId: idSchema18,
|
|
66233
66506
|
channelName: external_exports.string(),
|
|
66234
66507
|
channelKind: external_exports.enum(["public", "private", "dm", "group", "chat"]),
|
|
66235
66508
|
/** The outside workspace a mirrored conversation shows, such as "Slack ACME HQ". */
|
|
@@ -66243,12 +66516,12 @@ var callerHistorySchemaDefinition = external_exports.object({
|
|
|
66243
66516
|
});
|
|
66244
66517
|
|
|
66245
66518
|
// ../../modules/agent/contract/src/agent-channel-admin.ts
|
|
66246
|
-
var
|
|
66519
|
+
var idSchema19 = external_exports.string().min(1).max(80);
|
|
66247
66520
|
var channelRefSchema = external_exports.string().trim().min(1).max(200);
|
|
66248
66521
|
var channelAsCallerInputSchemaDefinition = external_exports.object({ channel: channelRefSchema });
|
|
66249
66522
|
var callerChannelMemberSchemaDefinition = external_exports.object({
|
|
66250
66523
|
kind: external_exports.enum(["person", "agent"]),
|
|
66251
|
-
id:
|
|
66524
|
+
id: idSchema19,
|
|
66252
66525
|
name: external_exports.string(),
|
|
66253
66526
|
role: external_exports.enum(["admin", "member"]),
|
|
66254
66527
|
/** Active, away or unknown for a person the speaker may see; absent for agents. */
|
|
@@ -66258,7 +66531,7 @@ var callerChannelMemberSchemaDefinition = external_exports.object({
|
|
|
66258
66531
|
doNotDisturb: doNotDisturbSchema.nullable().optional()
|
|
66259
66532
|
});
|
|
66260
66533
|
var callerChannelDetailSchemaDefinition = external_exports.object({
|
|
66261
|
-
id:
|
|
66534
|
+
id: idSchema19,
|
|
66262
66535
|
name: external_exports.string(),
|
|
66263
66536
|
kind: external_exports.enum(["public", "private", "dm", "group", "chat"]),
|
|
66264
66537
|
topic: external_exports.string(),
|
|
@@ -66289,17 +66562,17 @@ var activityAsCallerInputSchemaDefinition = external_exports.object({
|
|
|
66289
66562
|
limit: external_exports.number().int().min(1).max(100).default(50)
|
|
66290
66563
|
});
|
|
66291
66564
|
var callerActivityItemSchemaDefinition = external_exports.object({
|
|
66292
|
-
id:
|
|
66565
|
+
id: idSchema19,
|
|
66293
66566
|
kind: external_exports.enum(["mention", "thread_reply", "keyword", "reaction"]),
|
|
66294
|
-
channelId:
|
|
66567
|
+
channelId: idSchema19,
|
|
66295
66568
|
channelName: external_exports.string(),
|
|
66296
66569
|
channelKind: external_exports.enum(["public", "private", "dm", "group", "chat"]),
|
|
66297
|
-
messageId:
|
|
66298
|
-
threadRootId:
|
|
66570
|
+
messageId: idSchema19,
|
|
66571
|
+
threadRootId: idSchema19.nullable(),
|
|
66299
66572
|
/** `external` is someone outside Laze whose message a mirror brought in, named at the source. */
|
|
66300
66573
|
actor: external_exports.object({
|
|
66301
66574
|
kind: external_exports.enum(["person", "agent", "external"]),
|
|
66302
|
-
id:
|
|
66575
|
+
id: idSchema19,
|
|
66303
66576
|
name: external_exports.string()
|
|
66304
66577
|
}),
|
|
66305
66578
|
emoji: external_exports.string().nullable(),
|
|
@@ -66316,12 +66589,12 @@ var setStatusAsCallerInputSchemaDefinition = setStatusInputSchema.omit({ workspa
|
|
|
66316
66589
|
var setAwayAsCallerInputSchemaDefinition = external_exports.object({ away: external_exports.boolean() });
|
|
66317
66590
|
|
|
66318
66591
|
// ../../modules/agent/contract/src/agent-scheduled.ts
|
|
66319
|
-
var
|
|
66592
|
+
var idSchema20 = external_exports.string().min(1).max(80);
|
|
66320
66593
|
var channelRefSchema2 = external_exports.string().trim().min(1).max(200);
|
|
66321
66594
|
var scheduleAsCallerInputSchemaDefinition = external_exports.object({
|
|
66322
66595
|
channel: channelRefSchema2.optional(),
|
|
66323
|
-
threadRootId:
|
|
66324
|
-
replyTo:
|
|
66596
|
+
threadRootId: idSchema20.optional(),
|
|
66597
|
+
replyTo: idSchema20.optional(),
|
|
66325
66598
|
body: external_exports.string().trim().min(1).max(4e4),
|
|
66326
66599
|
sendAt: external_exports.iso.datetime({ offset: true }),
|
|
66327
66600
|
/** A reply that also goes to the channel at its time (`--also-channel`). */
|
|
@@ -66332,9 +66605,9 @@ var scheduleAsCallerInputSchemaDefinition = external_exports.object({
|
|
|
66332
66605
|
var listScheduledAsCallerInputSchemaDefinition = external_exports.object({
|
|
66333
66606
|
channel: channelRefSchema2.optional()
|
|
66334
66607
|
});
|
|
66335
|
-
var scheduledAsCallerInputSchemaDefinition = external_exports.object({ scheduledId:
|
|
66608
|
+
var scheduledAsCallerInputSchemaDefinition = external_exports.object({ scheduledId: idSchema20 });
|
|
66336
66609
|
var editScheduledAsCallerInputSchemaDefinition = external_exports.object({
|
|
66337
|
-
scheduledId:
|
|
66610
|
+
scheduledId: idSchema20,
|
|
66338
66611
|
body: external_exports.string().trim().min(1).max(4e4).optional(),
|
|
66339
66612
|
sendAt: external_exports.iso.datetime({ offset: true }).optional()
|
|
66340
66613
|
}).refine((input2) => input2.body !== void 0 || input2.sendAt !== void 0, {
|
|
@@ -66447,6 +66720,32 @@ var inviteAsCallerInputSchemaDefinition = external_exports.object({
|
|
|
66447
66720
|
email: external_exports.email().max(320),
|
|
66448
66721
|
role: roleSchema.default("MEMBER")
|
|
66449
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
|
+
});
|
|
66450
66749
|
var revokeInviteAsCallerInputSchemaDefinition = external_exports.object({
|
|
66451
66750
|
invite: external_exports.string().trim().min(1).max(320)
|
|
66452
66751
|
});
|
|
@@ -66693,6 +66992,13 @@ var LazeApiError = class extends Error {
|
|
|
66693
66992
|
/** What Laze adds to the code, such as the bound session of a `session_not_bound`. */
|
|
66694
66993
|
meta;
|
|
66695
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
|
+
}
|
|
66696
67002
|
var LazeClient = class _LazeClient {
|
|
66697
67003
|
constructor(options) {
|
|
66698
67004
|
this.options = options;
|
|
@@ -66701,9 +67007,16 @@ var LazeClient = class _LazeClient {
|
|
|
66701
67007
|
static create({
|
|
66702
67008
|
baseUrl,
|
|
66703
67009
|
token: token2,
|
|
66704
|
-
fetcher
|
|
67010
|
+
fetcher,
|
|
67011
|
+
onMigrated
|
|
66705
67012
|
}) {
|
|
66706
|
-
return new _LazeClient({
|
|
67013
|
+
return new _LazeClient({
|
|
67014
|
+
baseUrl: baseUrl.replace(/\/+$/, ""),
|
|
67015
|
+
token: token2,
|
|
67016
|
+
fetcher,
|
|
67017
|
+
headers: {},
|
|
67018
|
+
onMigrated
|
|
67019
|
+
});
|
|
66707
67020
|
}
|
|
66708
67021
|
/** The same client, sending these headers too on every call. */
|
|
66709
67022
|
withHeaders(headers) {
|
|
@@ -66716,6 +67029,9 @@ var LazeClient = class _LazeClient {
|
|
|
66716
67029
|
post(path, body, { signal } = {}) {
|
|
66717
67030
|
return this.send({ method: "POST", path, body, signal });
|
|
66718
67031
|
}
|
|
67032
|
+
put(path, body) {
|
|
67033
|
+
return this.send({ method: "PUT", path, body });
|
|
67034
|
+
}
|
|
66719
67035
|
/** A JSON body sent as it is, answered as it came: the status and text, never thrown. */
|
|
66720
67036
|
async forward({
|
|
66721
67037
|
path,
|
|
@@ -66733,7 +67049,14 @@ var LazeClient = class _LazeClient {
|
|
|
66733
67049
|
headers,
|
|
66734
67050
|
body
|
|
66735
67051
|
});
|
|
66736
|
-
|
|
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);
|
|
66737
67060
|
}
|
|
66738
67061
|
async send({
|
|
66739
67062
|
method,
|
|
@@ -66756,10 +67079,23 @@ var LazeClient = class _LazeClient {
|
|
|
66756
67079
|
});
|
|
66757
67080
|
const text2 = await response.text();
|
|
66758
67081
|
const parsed = text2 ? JSON.parse(text2) : void 0;
|
|
66759
|
-
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
|
+
}
|
|
66760
67087
|
return parsed;
|
|
66761
67088
|
}
|
|
66762
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
|
+
}
|
|
66763
67099
|
function errorOf({ status: status9, body }) {
|
|
66764
67100
|
const record4 = typeof body === "object" && body !== null ? body : {};
|
|
66765
67101
|
const nested = typeof record4.error === "object" && record4.error !== null ? record4.error : record4;
|
|
@@ -66773,6 +67109,16 @@ function errorOf({ status: status9, body }) {
|
|
|
66773
67109
|
}
|
|
66774
67110
|
|
|
66775
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
|
+
}
|
|
66776
67122
|
async function signedIn({
|
|
66777
67123
|
context,
|
|
66778
67124
|
args
|
|
@@ -66788,10 +67134,14 @@ async function signedIn({
|
|
|
66788
67134
|
throw new CliUsageError(
|
|
66789
67135
|
"Not signed in: run `laze login`, or `laze agent link --token <token>` from an agent."
|
|
66790
67136
|
);
|
|
67137
|
+
if (chosen.profile.migrated && quietWhenMigrated({ args })) {
|
|
67138
|
+
throw new ProfileMigratedError(chosen.name);
|
|
67139
|
+
}
|
|
66791
67140
|
const client = LazeClient.create({
|
|
66792
67141
|
baseUrl: chosen.profile.url,
|
|
66793
67142
|
token: chosen.profile.token,
|
|
66794
|
-
fetcher: context.fetcher
|
|
67143
|
+
fetcher: context.fetcher,
|
|
67144
|
+
onMigrated: markMigratedOn({ context, profile: chosen.name })
|
|
66795
67145
|
});
|
|
66796
67146
|
if (chosen.profile.kind === "agent") await namingFirst({ client, args });
|
|
66797
67147
|
return { name: chosen.name, profile: chosen.profile, client };
|
|
@@ -66805,7 +67155,8 @@ var ALWAYS_FREE = [
|
|
|
66805
67155
|
"logout",
|
|
66806
67156
|
"update",
|
|
66807
67157
|
"agent link",
|
|
66808
|
-
"agent bind"
|
|
67158
|
+
"agent bind",
|
|
67159
|
+
"agent migrate"
|
|
66809
67160
|
];
|
|
66810
67161
|
async function namingFirst({ client, args }) {
|
|
66811
67162
|
const [first = "", second = ""] = args.words;
|
|
@@ -66923,15 +67274,21 @@ async function disconnectAgent({ context, args }) {
|
|
|
66923
67274
|
async function inviteAgent({ context, args }) {
|
|
66924
67275
|
const name3 = flagText({ args, name: "name" });
|
|
66925
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
|
+
}
|
|
66926
67281
|
const { client } = await signedIn({ context, args });
|
|
66927
67282
|
const link = await client.post("/api/agents/links", {
|
|
66928
67283
|
...name3 ? { name: name3 } : {},
|
|
66929
|
-
...channelId ? { channelId } : {}
|
|
67284
|
+
...channelId ? { channelId } : {},
|
|
67285
|
+
...reconnect ? { reconnect } : {}
|
|
66930
67286
|
});
|
|
66931
67287
|
if (args.flags.json) return context.out(`${JSON.stringify(link, null, 2)}
|
|
66932
67288
|
`);
|
|
67289
|
+
const where = reconnect ? `the session that should run ${reconnect} again` : "the agent's session";
|
|
66933
67290
|
context.out(
|
|
66934
|
-
`Paste this into
|
|
67291
|
+
`Paste this into ${where} (the link works once, until ${link.expiresAt}):
|
|
66935
67292
|
|
|
66936
67293
|
${link.prompt}
|
|
66937
67294
|
`
|
|
@@ -67420,7 +67777,7 @@ var dismissSlackLinkPromptInputSchemaDefinition = external_exports.object({
|
|
|
67420
67777
|
var dismissSlackLinkPromptInputSchema = dismissSlackLinkPromptInputSchemaDefinition;
|
|
67421
67778
|
|
|
67422
67779
|
// ../../modules/slack/contract/src/slack-move.ts
|
|
67423
|
-
var
|
|
67780
|
+
var workspaceIdSchema13 = external_exports.string().min(1);
|
|
67424
67781
|
var teamIdSchema = external_exports.string().regex(/^[TE][A-Z0-9]{2,20}$/);
|
|
67425
67782
|
var slackChannelIdSchema = external_exports.string().regex(/^[CG][A-Z0-9]{2,20}$/);
|
|
67426
67783
|
var slackUserIdSchema = external_exports.string().regex(/^[UW][A-Z0-9]{2,20}$/);
|
|
@@ -67493,7 +67850,7 @@ var slackMovePreviewSchemaDefinition = external_exports.object({
|
|
|
67493
67850
|
});
|
|
67494
67851
|
var slackMovePreviewSchema = slackMovePreviewSchemaDefinition;
|
|
67495
67852
|
var slackMoveChannelInputSchemaDefinition = external_exports.object({
|
|
67496
|
-
workspaceId:
|
|
67853
|
+
workspaceId: workspaceIdSchema13,
|
|
67497
67854
|
teamId: teamIdSchema,
|
|
67498
67855
|
slackChannelId: slackChannelIdSchema
|
|
67499
67856
|
});
|
|
@@ -67508,7 +67865,7 @@ var slackMoveRequestSchemaDefinition = external_exports.object({
|
|
|
67508
67865
|
farewell: external_exports.string().trim().min(1).max(SLACK_FAREWELL_MAX).optional()
|
|
67509
67866
|
});
|
|
67510
67867
|
var startSlackMovesInputSchemaDefinition = external_exports.object({
|
|
67511
|
-
workspaceId:
|
|
67868
|
+
workspaceId: workspaceIdSchema13,
|
|
67512
67869
|
teamId: teamIdSchema,
|
|
67513
67870
|
channels: external_exports.array(slackMoveRequestSchemaDefinition).min(1).max(SLACK_MOVE_BATCH_MAX)
|
|
67514
67871
|
});
|
|
@@ -67523,7 +67880,7 @@ var startedSlackMovesSchemaDefinition = external_exports.object({
|
|
|
67523
67880
|
});
|
|
67524
67881
|
var startedSlackMovesSchema = startedSlackMovesSchemaDefinition;
|
|
67525
67882
|
var slackMoveInputSchemaDefinition = external_exports.object({
|
|
67526
|
-
workspaceId:
|
|
67883
|
+
workspaceId: workspaceIdSchema13,
|
|
67527
67884
|
moveId: external_exports.string().min(1).max(100)
|
|
67528
67885
|
});
|
|
67529
67886
|
var slackMoveInputSchema = slackMoveInputSchemaDefinition;
|
|
@@ -67597,7 +67954,7 @@ var slackExternalPeopleSchemaDefinition = external_exports.object({
|
|
|
67597
67954
|
var slackExternalPeopleSchema = slackExternalPeopleSchemaDefinition;
|
|
67598
67955
|
|
|
67599
67956
|
// ../../modules/slack/contract/src/slack-setup.ts
|
|
67600
|
-
var
|
|
67957
|
+
var workspaceIdSchema14 = external_exports.string().min(1);
|
|
67601
67958
|
var appKeySchema = external_exports.string().regex(/^[a-z0-9]{8,64}$/);
|
|
67602
67959
|
var returnToSchema3 = external_exports.string().startsWith("/").max(500).optional();
|
|
67603
67960
|
var slackAppCredentialFieldSchema = external_exports.enum([
|
|
@@ -67606,7 +67963,7 @@ var slackAppCredentialFieldSchema = external_exports.enum([
|
|
|
67606
67963
|
"clientSecret",
|
|
67607
67964
|
"signingSecret"
|
|
67608
67965
|
]);
|
|
67609
|
-
var beginSlackSetupInputSchemaDefinition = external_exports.object({ workspaceId:
|
|
67966
|
+
var beginSlackSetupInputSchemaDefinition = external_exports.object({ workspaceId: workspaceIdSchema14 });
|
|
67610
67967
|
var beginSlackSetupInputSchema = beginSlackSetupInputSchemaDefinition;
|
|
67611
67968
|
var slackSetupSchemaDefinition = external_exports.object({
|
|
67612
67969
|
appKey: appKeySchema,
|
|
@@ -67620,7 +67977,7 @@ var slackSetupSchemaDefinition = external_exports.object({
|
|
|
67620
67977
|
});
|
|
67621
67978
|
var slackSetupSchema = slackSetupSchemaDefinition;
|
|
67622
67979
|
var saveSlackAppCredentialsInputSchemaDefinition = external_exports.object({
|
|
67623
|
-
workspaceId:
|
|
67980
|
+
workspaceId: workspaceIdSchema14,
|
|
67624
67981
|
appKey: appKeySchema,
|
|
67625
67982
|
appId: external_exports.string().max(200),
|
|
67626
67983
|
clientId: external_exports.string().max(200),
|
|
@@ -67630,7 +67987,7 @@ var saveSlackAppCredentialsInputSchemaDefinition = external_exports.object({
|
|
|
67630
67987
|
});
|
|
67631
67988
|
var saveSlackAppCredentialsInputSchema = saveSlackAppCredentialsInputSchemaDefinition;
|
|
67632
67989
|
var installSlackAppInputSchemaDefinition = external_exports.object({
|
|
67633
|
-
workspaceId:
|
|
67990
|
+
workspaceId: workspaceIdSchema14,
|
|
67634
67991
|
appKey: appKeySchema,
|
|
67635
67992
|
returnTo: returnToSchema3
|
|
67636
67993
|
});
|
|
@@ -67765,7 +68122,7 @@ var slackEventsPausedPayloadSchemaDefinition = external_exports.object({
|
|
|
67765
68122
|
var SLACK_CACHE_DAYS_MAX = 30;
|
|
67766
68123
|
var SLACK_HISTORY_PATH = "/api/slack/history";
|
|
67767
68124
|
var SLACK_READ_BUDGET_MAX = 5e3;
|
|
67768
|
-
var
|
|
68125
|
+
var workspaceIdSchema15 = external_exports.string().min(1);
|
|
67769
68126
|
var teamIdSchema2 = external_exports.string().regex(/^[TE][A-Z0-9]{2,20}$/);
|
|
67770
68127
|
var slackChannelIdSchema2 = external_exports.string().regex(/^[CG][A-Z0-9]{2,20}$/);
|
|
67771
68128
|
var slackConnectionStatusSchema = external_exports.enum(["connected", "needs_reinstall"]);
|
|
@@ -67829,13 +68186,13 @@ var slackChannelViewSchemaDefinition = external_exports.object({
|
|
|
67829
68186
|
});
|
|
67830
68187
|
var slackChannelViewSchema = slackChannelViewSchemaDefinition;
|
|
67831
68188
|
var startSlackInstallInputSchemaDefinition = external_exports.object({
|
|
67832
|
-
workspaceId:
|
|
68189
|
+
workspaceId: workspaceIdSchema15,
|
|
67833
68190
|
/** A path in Laze to land on afterwards; defaults to the Connectors page. */
|
|
67834
68191
|
returnTo: external_exports.string().startsWith("/").max(500).optional()
|
|
67835
68192
|
});
|
|
67836
68193
|
var startSlackInstallInputSchema = startSlackInstallInputSchemaDefinition;
|
|
67837
68194
|
var startSlackLinkInputSchemaDefinition = external_exports.object({
|
|
67838
|
-
workspaceId:
|
|
68195
|
+
workspaceId: workspaceIdSchema15,
|
|
67839
68196
|
teamId: teamIdSchema2,
|
|
67840
68197
|
returnTo: external_exports.string().startsWith("/").max(500).optional()
|
|
67841
68198
|
});
|
|
@@ -67843,7 +68200,7 @@ var startSlackLinkInputSchema = startSlackLinkInputSchemaDefinition;
|
|
|
67843
68200
|
var startedSlackAuthorizeSchemaDefinition = external_exports.object({ authorizeUrl: external_exports.url() });
|
|
67844
68201
|
var startedSlackAuthorizeSchema = startedSlackAuthorizeSchemaDefinition;
|
|
67845
68202
|
var startSlackSetupInputSchemaDefinition = external_exports.object({
|
|
67846
|
-
workspaceId:
|
|
68203
|
+
workspaceId: workspaceIdSchema15,
|
|
67847
68204
|
configToken: external_exports.string().trim().min(10).max(1e3),
|
|
67848
68205
|
returnTo: external_exports.string().startsWith("/").max(500).optional()
|
|
67849
68206
|
});
|
|
@@ -67862,19 +68219,19 @@ var slackEventsHeadersSchemaDefinition = external_exports.object({
|
|
|
67862
68219
|
});
|
|
67863
68220
|
var slackEventsAnswerSchemaDefinition = external_exports.object({ challenge: external_exports.string().nullable() });
|
|
67864
68221
|
var teamInputSchemaDefinition = external_exports.object({
|
|
67865
|
-
workspaceId:
|
|
68222
|
+
workspaceId: workspaceIdSchema15,
|
|
67866
68223
|
teamId: teamIdSchema2
|
|
67867
68224
|
});
|
|
67868
68225
|
var slackTeamInputSchema = teamInputSchemaDefinition;
|
|
67869
68226
|
var setSlackMirrorInputSchemaDefinition = external_exports.object({
|
|
67870
|
-
workspaceId:
|
|
68227
|
+
workspaceId: workspaceIdSchema15,
|
|
67871
68228
|
teamId: teamIdSchema2,
|
|
67872
68229
|
slackChannelId: slackChannelIdSchema2,
|
|
67873
68230
|
mirrored: external_exports.boolean()
|
|
67874
68231
|
});
|
|
67875
68232
|
var setSlackMirrorInputSchema = setSlackMirrorInputSchemaDefinition;
|
|
67876
68233
|
var updateSlackConnectionInputSchemaDefinition = external_exports.object({
|
|
67877
|
-
workspaceId:
|
|
68234
|
+
workspaceId: workspaceIdSchema15,
|
|
67878
68235
|
teamId: teamIdSchema2,
|
|
67879
68236
|
label: external_exports.string().trim().max(80).nullable().optional(),
|
|
67880
68237
|
cacheDays: external_exports.number().int().min(1).max(SLACK_CACHE_DAYS_MAX).optional(),
|
|
@@ -67882,17 +68239,17 @@ var updateSlackConnectionInputSchemaDefinition = external_exports.object({
|
|
|
67882
68239
|
});
|
|
67883
68240
|
var updateSlackConnectionInputSchema = updateSlackConnectionInputSchemaDefinition;
|
|
67884
68241
|
var updateSlackAppInputSchemaDefinition = external_exports.object({
|
|
67885
|
-
workspaceId:
|
|
68242
|
+
workspaceId: workspaceIdSchema15,
|
|
67886
68243
|
teamId: teamIdSchema2,
|
|
67887
68244
|
configToken: external_exports.string().trim().min(10).max(1e3)
|
|
67888
68245
|
});
|
|
67889
68246
|
var updateSlackAppInputSchema = updateSlackAppInputSchemaDefinition;
|
|
67890
68247
|
var slackLinkParamsSchemaDefinition = external_exports.object({
|
|
67891
|
-
workspaceId:
|
|
68248
|
+
workspaceId: workspaceIdSchema15,
|
|
67892
68249
|
teamId: teamIdSchema2
|
|
67893
68250
|
});
|
|
67894
68251
|
var slackHistoryInputSchemaDefinition = external_exports.object({
|
|
67895
|
-
workspaceId:
|
|
68252
|
+
workspaceId: workspaceIdSchema15,
|
|
67896
68253
|
/** The Laze conversation that mirrors the Slack channel. */
|
|
67897
68254
|
channelId: external_exports.string().min(1),
|
|
67898
68255
|
/** Messages before this time; the oldest message the cache shows. */
|
|
@@ -67922,7 +68279,7 @@ var slackHistoryPageSchemaDefinition = external_exports.object({
|
|
|
67922
68279
|
});
|
|
67923
68280
|
var slackHistoryPageSchema = slackHistoryPageSchemaDefinition;
|
|
67924
68281
|
var slackFileParamsSchemaDefinition = external_exports.object({
|
|
67925
|
-
workspaceId:
|
|
68282
|
+
workspaceId: workspaceIdSchema15,
|
|
67926
68283
|
/** The Laze conversation that mirrors the Slack channel. */
|
|
67927
68284
|
channelId: external_exports.string().min(1).max(200),
|
|
67928
68285
|
fileId: external_exports.string().regex(/^F[A-Z0-9]{2,30}$/)
|
|
@@ -67930,7 +68287,7 @@ var slackFileParamsSchemaDefinition = external_exports.object({
|
|
|
67930
68287
|
var SLACK_SEARCH_QUERY_MIN = 2;
|
|
67931
68288
|
var SLACK_SEARCH_QUERY_MAX = 200;
|
|
67932
68289
|
var slackSearchInputSchemaDefinition = external_exports.object({
|
|
67933
|
-
workspaceId:
|
|
68290
|
+
workspaceId: workspaceIdSchema15,
|
|
67934
68291
|
query: external_exports.string().trim().min(SLACK_SEARCH_QUERY_MIN).max(SLACK_SEARCH_QUERY_MAX)
|
|
67935
68292
|
});
|
|
67936
68293
|
var slackSearchInputSchema = slackSearchInputSchemaDefinition;
|
|
@@ -67978,7 +68335,7 @@ var slackSearchAnswerSchemaDefinition = external_exports.object({
|
|
|
67978
68335
|
});
|
|
67979
68336
|
var slackSearchAnswerSchema = slackSearchAnswerSchemaDefinition;
|
|
67980
68337
|
var SlackApi = moduleApi()("slack");
|
|
67981
|
-
var workspaceInput3 = external_exports.object({ workspaceId:
|
|
68338
|
+
var workspaceInput3 = external_exports.object({ workspaceId: workspaceIdSchema15 });
|
|
67982
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();
|
|
67983
68340
|
|
|
67984
68341
|
// ../../modules/slack/contract/src/slack-keys.ts
|
|
@@ -68050,11 +68407,6 @@ var slackMoveByKeyInputSchemaDefinition = slackMoveInputSchema.omit(noWorkspace)
|
|
|
68050
68407
|
var positiveInt4 = external_exports.coerce.number().int().positive();
|
|
68051
68408
|
var slackConfig = Config.define((c) => ({
|
|
68052
68409
|
publicBaseUrl,
|
|
68053
|
-
/**
|
|
68054
|
-
* The origin Slack sends people back to after consent, when it is not `publicBaseUrl`: the
|
|
68055
|
-
* origin the Slack app lists as its redirect URL during a domain move (docs/ops/domains.md).
|
|
68056
|
-
*/
|
|
68057
|
-
oauthBaseUrl: c.env("SLACK_OAUTH_BASE_URL", external_exports.url().optional()),
|
|
68058
68410
|
/** The Web API base; methods are `${apiUrl}/<method>`. */
|
|
68059
68411
|
apiUrl: c.env("SLACK_API_URL", external_exports.url().default("https://slack.com/api")),
|
|
68060
68412
|
/** Slack's install and sign-in consent page. */
|
|
@@ -68625,7 +68977,8 @@ async function agentProfileHere({
|
|
|
68625
68977
|
args: await sessionProfileArgs({ context, args: asked, session, binds: false }),
|
|
68626
68978
|
name: "profile"
|
|
68627
68979
|
});
|
|
68628
|
-
|
|
68980
|
+
const profile = name3 ? config2.profiles[name3] : void 0;
|
|
68981
|
+
return name3 && profile?.kind === "agent" && !profile.migrated ? name3 : void 0;
|
|
68629
68982
|
}
|
|
68630
68983
|
async function projectHooksHere({ context }) {
|
|
68631
68984
|
const directory = context.environment.inherited.CLAUDE_PROJECT_DIR || context.cwd;
|
|
@@ -68715,7 +69068,8 @@ async function preToolHook({ context, args }) {
|
|
|
68715
69068
|
const client = LazeClient.create({
|
|
68716
69069
|
baseUrl: profile.url,
|
|
68717
69070
|
token: profile.token,
|
|
68718
|
-
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 })
|
|
68719
69073
|
});
|
|
68720
69074
|
const state = await readState({ context, agent: name3 });
|
|
68721
69075
|
const answer5 = await beat({ client, state, working: true });
|
|
@@ -68734,8 +69088,13 @@ async function preToolHook({ context, args }) {
|
|
|
68734
69088
|
})
|
|
68735
69089
|
);
|
|
68736
69090
|
} catch (error62) {
|
|
68737
|
-
|
|
68738
|
-
|
|
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
|
+
);
|
|
68739
69098
|
}
|
|
68740
69099
|
}
|
|
68741
69100
|
|
|
@@ -69429,15 +69788,23 @@ import { dirname as dirname9, join as join11 } from "node:path";
|
|
|
69429
69788
|
|
|
69430
69789
|
// src/services/codex-turn-watch.service.ts
|
|
69431
69790
|
import { open as open2, readdir as readdir2 } from "node:fs/promises";
|
|
69432
|
-
import { join as join6 } from "node:path";
|
|
69791
|
+
import { basename as basename3, join as join6 } from "node:path";
|
|
69433
69792
|
var READ_MS = 1500;
|
|
69434
69793
|
var KEEP_WORKING_MS = 3e4;
|
|
69435
|
-
async function
|
|
69436
|
-
|
|
69794
|
+
async function codexRolloutPathOf({
|
|
69795
|
+
codexHome,
|
|
69796
|
+
threadId
|
|
69797
|
+
}) {
|
|
69798
|
+
const root = join6(codexHome, "sessions");
|
|
69437
69799
|
const files2 = await readdir2(root, { recursive: true }).catch(() => []);
|
|
69438
|
-
const file3 = files2.find(
|
|
69800
|
+
const file3 = files2.find(
|
|
69801
|
+
(name3) => basename3(name3).startsWith("rollout-") && name3.endsWith(`-${threadId}.jsonl`)
|
|
69802
|
+
);
|
|
69439
69803
|
return file3 ? join6(root, file3) : void 0;
|
|
69440
69804
|
}
|
|
69805
|
+
function rolloutPathOf({ delivery }) {
|
|
69806
|
+
return codexRolloutPathOf({ codexHome: delivery.codexHome, threadId: delivery.threadId });
|
|
69807
|
+
}
|
|
69441
69808
|
async function readFrom({ path, offset }) {
|
|
69442
69809
|
const handle = await open2(path, "r");
|
|
69443
69810
|
try {
|
|
@@ -69526,7 +69893,7 @@ import { chmod as chmod2, mkdir as mkdir5, readFile as readFile6, writeFile as w
|
|
|
69526
69893
|
import { dirname as dirname5, join as join7 } from "node:path";
|
|
69527
69894
|
|
|
69528
69895
|
// ../../modules/openclaw/contract/src/openclaw.ts
|
|
69529
|
-
var
|
|
69896
|
+
var workspaceIdSchema16 = external_exports.string().min(1);
|
|
69530
69897
|
var connectionIdSchema = external_exports.string().min(1).max(80);
|
|
69531
69898
|
var openclawAgentIdSchema = external_exports.string().min(1).max(120);
|
|
69532
69899
|
var openclawConnectionStatusSchema = external_exports.enum([
|
|
@@ -69581,14 +69948,14 @@ var openclawOverviewSchemaDefinition = external_exports.object({
|
|
|
69581
69948
|
});
|
|
69582
69949
|
var openclawOverviewSchema = openclawOverviewSchemaDefinition;
|
|
69583
69950
|
var connectOpenclawInputSchemaDefinition = external_exports.object({
|
|
69584
|
-
workspaceId:
|
|
69951
|
+
workspaceId: workspaceIdSchema16,
|
|
69585
69952
|
gatewayUrl: external_exports.string().trim().min(1).max(500),
|
|
69586
69953
|
token: external_exports.string().trim().min(1).max(500),
|
|
69587
69954
|
label: external_exports.string().trim().min(1).max(80).optional()
|
|
69588
69955
|
});
|
|
69589
69956
|
var connectOpenclawInputSchema = connectOpenclawInputSchemaDefinition;
|
|
69590
69957
|
var openclawConnectionRefSchemaDefinition = external_exports.object({
|
|
69591
|
-
workspaceId:
|
|
69958
|
+
workspaceId: workspaceIdSchema16,
|
|
69592
69959
|
connectionId: connectionIdSchema
|
|
69593
69960
|
});
|
|
69594
69961
|
var openclawConnectionRefSchema = openclawConnectionRefSchemaDefinition;
|
|
@@ -69615,7 +69982,7 @@ var openclawAgentKeySchemaDefinition = external_exports.object({
|
|
|
69615
69982
|
});
|
|
69616
69983
|
var openclawAgentKeySchema = openclawAgentKeySchemaDefinition;
|
|
69617
69984
|
var OpenclawApi = moduleApi()("openclaw");
|
|
69618
|
-
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();
|
|
69619
69986
|
|
|
69620
69987
|
// ../../modules/openclaw/contract/src/openclaw.config.ts
|
|
69621
69988
|
var positiveInt5 = external_exports.coerce.number().int().positive();
|
|
@@ -69634,7 +70001,9 @@ var openclawConfig = Config.define((c) => ({
|
|
|
69634
70001
|
/** A run that shows no progress for this long is given up and said so in the conversation. */
|
|
69635
70002
|
runTimeoutMinutes: c.env("OPENCLAW_RUN_TIMEOUT_MINUTES", positiveInt5.default(30)),
|
|
69636
70003
|
/** The hard limit of one run, progress or not; OpenClaw gets it as the run's `timeoutMs`. */
|
|
69637
|
-
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())
|
|
69638
70007
|
}));
|
|
69639
70008
|
|
|
69640
70009
|
// ../../modules/openclaw/contract/src/openclaw.events.ts
|
|
@@ -70035,8 +70404,9 @@ async function notesOf({ context }) {
|
|
|
70035
70404
|
async function rushListenersOf({
|
|
70036
70405
|
context
|
|
70037
70406
|
}) {
|
|
70038
|
-
const
|
|
70039
|
-
|
|
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
|
|
70040
70410
|
);
|
|
70041
70411
|
if (bound.length === 0) return [];
|
|
70042
70412
|
const listed = await rushListingOf({ context });
|
|
@@ -70107,11 +70477,12 @@ var CHECK_TIMEOUT_MS = 5e3;
|
|
|
70107
70477
|
function clientOf({ context, profile }) {
|
|
70108
70478
|
return context.store.read().then((config2) => {
|
|
70109
70479
|
const entry = config2.profiles[profile];
|
|
70110
|
-
if (!entry) return void 0;
|
|
70480
|
+
if (!entry || entry.migrated) return void 0;
|
|
70111
70481
|
return LazeClient.create({
|
|
70112
70482
|
baseUrl: entry.url,
|
|
70113
70483
|
token: entry.token,
|
|
70114
|
-
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 })
|
|
70115
70486
|
});
|
|
70116
70487
|
});
|
|
70117
70488
|
}
|
|
@@ -70324,7 +70695,8 @@ async function serveAgent({
|
|
|
70324
70695
|
const client = LazeClient.create({
|
|
70325
70696
|
baseUrl: entry.url,
|
|
70326
70697
|
token: entry.token,
|
|
70327
|
-
fetcher: context.fetcher
|
|
70698
|
+
fetcher: context.fetcher,
|
|
70699
|
+
onMigrated: markMigratedOn({ context, profile })
|
|
70328
70700
|
});
|
|
70329
70701
|
const watch = CodexTurnWatch.create({ context, client, profile, delivery: entry.delivery });
|
|
70330
70702
|
const ended = new AbortController();
|
|
@@ -70361,6 +70733,13 @@ async function serveRounds({
|
|
|
70361
70733
|
wait = 1;
|
|
70362
70734
|
if (delivered === 0) await context.sleep(1e3, signal);
|
|
70363
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
|
+
}
|
|
70364
70743
|
if (error62 instanceof LazeApiError && error62.status === 401) {
|
|
70365
70744
|
await report4(profile, "stopped: Laze refused the agent's key; link the session again");
|
|
70366
70745
|
context.err(`${profile}: Laze refused the key; this agent is no longer served
|
|
@@ -70394,14 +70773,15 @@ async function syncLoops(run4) {
|
|
|
70394
70773
|
const config2 = await run4.context.store.read();
|
|
70395
70774
|
for (const [profile, current2] of run4.served) {
|
|
70396
70775
|
const entry = config2.profiles[profile];
|
|
70397
|
-
|
|
70776
|
+
const same2 = entry?.token === current2.token && entry.delivery?.threadId === current2.threadId;
|
|
70777
|
+
if (same2 && !entry.migrated) continue;
|
|
70398
70778
|
current2.stop.abort();
|
|
70399
70779
|
await current2.done;
|
|
70400
70780
|
run4.served.delete(profile);
|
|
70401
70781
|
setAgent(run4, profile, void 0);
|
|
70402
70782
|
}
|
|
70403
70783
|
const linked = Object.entries(config2.profiles).filter(
|
|
70404
|
-
(pair2) => pair2[1].delivery?.harness === "codex" && pair2[1].kind === "agent"
|
|
70784
|
+
(pair2) => pair2[1].delivery?.harness === "codex" && pair2[1].kind === "agent" && !pair2[1].migrated
|
|
70405
70785
|
);
|
|
70406
70786
|
for (const [profile, entry] of linked.filter(([name3]) => !run4.served.has(name3))) {
|
|
70407
70787
|
const { threadId } = entry.delivery;
|
|
@@ -70901,6 +71281,13 @@ async function waitHook({ context, args }) {
|
|
|
70901
71281
|
try {
|
|
70902
71282
|
return await waitForMessages({ context, args });
|
|
70903
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
|
+
}
|
|
70904
71291
|
context.err(`laze: the background waiter stopped: ${String(error62)}
|
|
70905
71292
|
`);
|
|
70906
71293
|
return 0;
|
|
@@ -71178,6 +71565,10 @@ async function supervise({
|
|
|
71178
71565
|
const code = await context.runCommand({ command, env: {} }).catch(() => 1);
|
|
71179
71566
|
if (context.nowMs() - started > HEALTHY_RUN_MS) wait = 1;
|
|
71180
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
|
+
}
|
|
71181
71572
|
context.out(`laze adopt codex exited ${code}; starting it again in ${wait}s
|
|
71182
71573
|
`);
|
|
71183
71574
|
await context.sleep(wait * 1e3);
|
|
@@ -71610,10 +72001,10 @@ async function cachedPluginOf({ context }) {
|
|
|
71610
72001
|
async function refreshStaleCache({ context, folder }) {
|
|
71611
72002
|
const cached2 = await cachedPluginOf({ context });
|
|
71612
72003
|
if (!cached2) return true;
|
|
71613
|
-
const
|
|
72004
|
+
const read4 = (path) => readFile12(path, "utf8").catch(() => "");
|
|
71614
72005
|
for (const file3 of RUN_FILES) {
|
|
71615
|
-
const ours = await
|
|
71616
|
-
if (ours === await
|
|
72006
|
+
const ours = await read4(join15(folder, LAZE_PLUGIN, file3));
|
|
72007
|
+
if (ours === await read4(join15(cached2, file3))) continue;
|
|
71617
72008
|
const plugin2 = `${LAZE_PLUGIN}@${LAZE_PLUGIN}`;
|
|
71618
72009
|
const script = [
|
|
71619
72010
|
`claude plugin uninstall ${plugin2} --scope user ${QUIET}`,
|
|
@@ -71756,11 +72147,18 @@ async function pushInbox({
|
|
|
71756
72147
|
while (!signal.aborted) {
|
|
71757
72148
|
const messages = await client.post("/api/agents/me/inbox", { waitSeconds: ROUND_SECONDS3 }, { signal }).catch(async (error62) => {
|
|
71758
72149
|
if (signal.aborted) return [];
|
|
72150
|
+
const migrated = migratedNoticeOf(error62);
|
|
72151
|
+
if (migrated) {
|
|
72152
|
+
context.err(`${migrated.notice}
|
|
72153
|
+
`);
|
|
72154
|
+
return void 0;
|
|
72155
|
+
}
|
|
71759
72156
|
context.err(`laze mcp: could not read the inbox: ${String(error62)}
|
|
71760
72157
|
`);
|
|
71761
72158
|
await context.sleep(RETRY_MS, signal);
|
|
71762
72159
|
return [];
|
|
71763
72160
|
});
|
|
72161
|
+
if (messages === void 0) break;
|
|
71764
72162
|
if (messages.length === 0) {
|
|
71765
72163
|
await context.sleep(1e3, signal);
|
|
71766
72164
|
continue;
|
|
@@ -72105,6 +72503,11 @@ function stopContext({ context, text: text2 }) {
|
|
|
72105
72503
|
const hookSpecificOutput = { hookEventName: "Stop", additionalContext: text2 };
|
|
72106
72504
|
context.out(JSON.stringify({ hookSpecificOutput }));
|
|
72107
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
|
+
}
|
|
72108
72511
|
async function handOver({ context, args }) {
|
|
72109
72512
|
const raw = await context.readStdin();
|
|
72110
72513
|
const input2 = raw.trim() ? JSON.parse(raw) : {};
|
|
@@ -72115,8 +72518,7 @@ async function handOver({ context, args }) {
|
|
|
72115
72518
|
const named = await sessionProfileArgs({ context, args: asked, session });
|
|
72116
72519
|
const { client, name: agent2 } = await signedIn({ context, args: named });
|
|
72117
72520
|
await reportTranscript({ client, input: input2 }).catch(
|
|
72118
|
-
(error62) =>
|
|
72119
|
-
`)
|
|
72521
|
+
(error62) => reportFailed({ context, error: error62 })
|
|
72120
72522
|
);
|
|
72121
72523
|
if (input2.stop_hook_active) return;
|
|
72122
72524
|
if (await monitorServes({ context, profile: agent2, claudePid })) {
|
|
@@ -72188,6 +72590,9 @@ async function stopHook({ context, args }) {
|
|
|
72188
72590
|
try {
|
|
72189
72591
|
await handOver({ context, args });
|
|
72190
72592
|
} catch (error62) {
|
|
72593
|
+
if (error62 instanceof ProfileMigratedError) return;
|
|
72594
|
+
const migrated = migratedNoticeOf(error62);
|
|
72595
|
+
if (migrated) return stopContext({ context, text: migrated.notice });
|
|
72191
72596
|
context.err(`laze: the Stop hook skipped: ${String(error62)}
|
|
72192
72597
|
`);
|
|
72193
72598
|
}
|
|
@@ -72934,6 +73339,336 @@ async function setAgentPool({
|
|
|
72934
73339
|
});
|
|
72935
73340
|
}
|
|
72936
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
|
+
|
|
72937
73672
|
// src/services/agent-session-commands.service.ts
|
|
72938
73673
|
var NO_SESSION = "Run this inside the Claude Code or Codex session the agent should listen in, or pass --session <id>.";
|
|
72939
73674
|
var NO_AGENT = "This session and its folder have no agent: name one with `laze agent bind --profile <name>`.";
|
|
@@ -73088,8 +73823,8 @@ async function requestAgent({ context, args }) {
|
|
|
73088
73823
|
}
|
|
73089
73824
|
|
|
73090
73825
|
// src/services/app-commands.service.ts
|
|
73091
|
-
import { mkdir as mkdir16, readdir as
|
|
73092
|
-
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";
|
|
73093
73828
|
|
|
73094
73829
|
// ../../modules/app/contract/src/app.connections.ts
|
|
73095
73830
|
var appFunctionNameSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/);
|
|
@@ -73250,6 +73985,8 @@ var appSchemaDefinition = external_exports.object({
|
|
|
73250
73985
|
archivedAt: external_exports.iso.datetime().nullable().optional(),
|
|
73251
73986
|
/** The reader's role in the app; absent where the app is read without a reader. */
|
|
73252
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(),
|
|
73253
73990
|
createdAt: external_exports.iso.datetime(),
|
|
73254
73991
|
updatedAt: external_exports.iso.datetime()
|
|
73255
73992
|
});
|
|
@@ -73347,7 +74084,9 @@ var createAppInputSchemaDefinition = external_exports.object({
|
|
|
73347
74084
|
slug: appSlugSchema.optional(),
|
|
73348
74085
|
channelId: external_exports.string().min(1).optional(),
|
|
73349
74086
|
/** Restricted unless chosen: owner, admins, shares and the conversations it is pinned to. */
|
|
73350
|
-
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()
|
|
73351
74090
|
});
|
|
73352
74091
|
var createAppInputSchema = createAppInputSchemaDefinition;
|
|
73353
74092
|
var listAppsInputSchemaDefinition = external_exports.object({
|
|
@@ -73762,15 +74501,18 @@ var appAccessRequestSchemaDefinition = external_exports.object({
|
|
|
73762
74501
|
role: appRoleSchema.nullable(),
|
|
73763
74502
|
decidedBy: appActorSchema.nullable(),
|
|
73764
74503
|
createdAt: external_exports.iso.datetime(),
|
|
73765
|
-
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()
|
|
73766
74507
|
});
|
|
73767
74508
|
var appAccessRequestSchema = appAccessRequestSchemaDefinition;
|
|
73768
74509
|
var appMemberSourceSchemaDefinition = external_exports.object({
|
|
73769
|
-
|
|
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"]),
|
|
73770
74512
|
/** The channel, for `channel`: a pin there, a share with it, or the app's own channel. */
|
|
73771
74513
|
channelId: external_exports.string().nullable(),
|
|
73772
74514
|
channelName: external_exports.string().nullable(),
|
|
73773
|
-
/**
|
|
74515
|
+
/** Unused since agents stopped holding apps through their owner; always null. */
|
|
73774
74516
|
ownerName: external_exports.string().nullable()
|
|
73775
74517
|
});
|
|
73776
74518
|
var appMemberSchemaDefinition = external_exports.object({
|
|
@@ -73794,6 +74536,31 @@ var appAccessPinSchemaDefinition = external_exports.object({
|
|
|
73794
74536
|
name: external_exports.string().nullable(),
|
|
73795
74537
|
role: appRoleSchema
|
|
73796
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
|
+
});
|
|
73797
74564
|
var appAccessSchemaDefinition = external_exports.object({
|
|
73798
74565
|
appId: external_exports.string().min(1),
|
|
73799
74566
|
visibility: appVisibilitySchema,
|
|
@@ -73806,6 +74573,8 @@ var appAccessSchemaDefinition = external_exports.object({
|
|
|
73806
74573
|
pins: external_exports.array(appAccessPinSchemaDefinition).default([]),
|
|
73807
74574
|
/** Pending requests, to the app's Builders; empty for anyone else. */
|
|
73808
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([]),
|
|
73809
74578
|
/** The reader's own role. */
|
|
73810
74579
|
role: appRoleSchema,
|
|
73811
74580
|
/** The workspace's name, for "Everyone in <workspace>". */
|
|
@@ -73865,8 +74634,14 @@ var pendingAppAccessSchemaDefinition = external_exports.object({
|
|
|
73865
74634
|
appName: external_exports.string(),
|
|
73866
74635
|
/** The role a grant from the feed card gives. */
|
|
73867
74636
|
memberRole: appRoleSchema,
|
|
73868
|
-
/** The Builders who answer it. */
|
|
73869
|
-
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()
|
|
73870
74645
|
});
|
|
73871
74646
|
var visibilityOutcomeSchemaDefinition = external_exports.object({
|
|
73872
74647
|
app: appSchema,
|
|
@@ -74557,7 +75332,7 @@ var appCliCommands = [
|
|
|
74557
75332
|
command: "laze app members",
|
|
74558
75333
|
operation: "listMembers",
|
|
74559
75334
|
arguments: ["[app]"],
|
|
74560
|
-
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"
|
|
74561
75336
|
},
|
|
74562
75337
|
{
|
|
74563
75338
|
command: "laze app access",
|
|
@@ -74593,13 +75368,19 @@ var appCliCommands = [
|
|
|
74593
75368
|
command: "laze app access pin-role",
|
|
74594
75369
|
operation: "setPinRole",
|
|
74595
75370
|
arguments: ["<channel-id>", "viewer|editor|builder"],
|
|
74596
|
-
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)"
|
|
74597
75372
|
},
|
|
74598
75373
|
{
|
|
74599
75374
|
command: "laze app access approve",
|
|
74600
75375
|
operation: "decideAccessRequest",
|
|
74601
75376
|
arguments: ["<request-id>", "[viewer|editor|builder]"],
|
|
74602
|
-
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"
|
|
74603
75384
|
},
|
|
74604
75385
|
{
|
|
74605
75386
|
command: "laze app cost",
|
|
@@ -75756,7 +76537,7 @@ async function appPinsCommand({
|
|
|
75756
76537
|
import { execFile } from "node:child_process";
|
|
75757
76538
|
import { mkdtemp, rm as rm8, writeFile as writeFile15 } from "node:fs/promises";
|
|
75758
76539
|
import { tmpdir } from "node:os";
|
|
75759
|
-
import { join as
|
|
76540
|
+
import { join as join18 } from "node:path";
|
|
75760
76541
|
import { promisify } from "node:util";
|
|
75761
76542
|
var run2 = promisify(execFile);
|
|
75762
76543
|
var MODULE_SYNTAX = /^\s*(import|export)\s/m;
|
|
@@ -75785,11 +76566,11 @@ async function scriptErrorsOf({
|
|
|
75785
76566
|
const unknown2 = unknownCollectionsOf({ files: files2, collections });
|
|
75786
76567
|
const scripts = files2.flatMap(scriptsOf);
|
|
75787
76568
|
if (scripts.length === 0) return unknown2;
|
|
75788
|
-
const dir = await mkdtemp(
|
|
76569
|
+
const dir = await mkdtemp(join18(tmpdir(), "laze-app-check-"));
|
|
75789
76570
|
try {
|
|
75790
76571
|
const errors = await Promise.all(
|
|
75791
76572
|
scripts.map(async (script, index) => {
|
|
75792
|
-
const file3 =
|
|
76573
|
+
const file3 = join18(dir, `${index}.${script.module ? "mjs" : "cjs"}`);
|
|
75793
76574
|
await writeFile15(file3, script.code);
|
|
75794
76575
|
try {
|
|
75795
76576
|
await run2(process.execPath, ["--check", file3]);
|
|
@@ -75807,9 +76588,9 @@ async function scriptErrorsOf({
|
|
|
75807
76588
|
}
|
|
75808
76589
|
|
|
75809
76590
|
// src/services/app-serve.service.ts
|
|
75810
|
-
import { readFile as
|
|
76591
|
+
import { readFile as readFile17, stat as stat6 } from "node:fs/promises";
|
|
75811
76592
|
import { createServer } from "node:http";
|
|
75812
|
-
import { extname as extname2, join as
|
|
76593
|
+
import { extname as extname2, join as join19, normalize, sep as sep2 } from "node:path";
|
|
75813
76594
|
var TYPES = {
|
|
75814
76595
|
".html": "text/html; charset=utf-8",
|
|
75815
76596
|
".js": "text/javascript; charset=utf-8",
|
|
@@ -75860,13 +76641,13 @@ async function staticFile({
|
|
|
75860
76641
|
if (clean.startsWith("..") || hidden) {
|
|
75861
76642
|
return json2({ response, status: 404, value: { code: "not_found", message: "Not found" } });
|
|
75862
76643
|
}
|
|
75863
|
-
const candidates = [
|
|
75864
|
-
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"));
|
|
75865
76646
|
for (const target of candidates) {
|
|
75866
|
-
const info = await
|
|
76647
|
+
const info = await stat6(target).catch(() => void 0);
|
|
75867
76648
|
if (!info?.isFile()) continue;
|
|
75868
76649
|
const type = TYPES[extname2(target).toLowerCase()] ?? "application/octet-stream";
|
|
75869
|
-
const body = await
|
|
76650
|
+
const body = await readFile17(target);
|
|
75870
76651
|
if (extname2(target) === ".html") {
|
|
75871
76652
|
return send2({ response, status: 200, type, body: withServeThemeScript(body.toString()) });
|
|
75872
76653
|
}
|
|
@@ -76099,7 +76880,7 @@ async function turnTokenOf({
|
|
|
76099
76880
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
76100
76881
|
if (pinned) return pinned;
|
|
76101
76882
|
if (env.LAZE_TURN_FILE) {
|
|
76102
|
-
return
|
|
76883
|
+
return readFile18(env.LAZE_TURN_FILE, "utf8").then(
|
|
76103
76884
|
(text2) => text2.trim(),
|
|
76104
76885
|
() => ""
|
|
76105
76886
|
);
|
|
@@ -76129,7 +76910,7 @@ function folderOf({ context, word: word3 }) {
|
|
|
76129
76910
|
return resolve6(context.cwd, word3 ?? ".");
|
|
76130
76911
|
}
|
|
76131
76912
|
async function readManifest(folder) {
|
|
76132
|
-
const text2 = await
|
|
76913
|
+
const text2 = await readFile18(join20(folder, APP_MANIFEST_FILE), "utf8").catch(() => void 0);
|
|
76133
76914
|
if (text2 === void 0) return void 0;
|
|
76134
76915
|
const parsed = appManifestSchema.safeParse(JSON.parse(text2));
|
|
76135
76916
|
if (!parsed.success) {
|
|
@@ -76164,7 +76945,7 @@ async function jsonFlag({
|
|
|
76164
76945
|
}) {
|
|
76165
76946
|
const raw = flagText({ args, name: name3 });
|
|
76166
76947
|
if (!raw) return void 0;
|
|
76167
|
-
const text2 = raw.startsWith("@") ? await
|
|
76948
|
+
const text2 = raw.startsWith("@") ? await readFile18(resolve6(context.cwd, raw.slice(1)), "utf8") : raw;
|
|
76168
76949
|
try {
|
|
76169
76950
|
return JSON.parse(text2);
|
|
76170
76951
|
} catch {
|
|
@@ -76176,8 +76957,8 @@ async function listFiles(folder) {
|
|
|
76176
76957
|
const pending2 = [folder];
|
|
76177
76958
|
while (pending2.length > 0 && found.length <= MAX_FILES) {
|
|
76178
76959
|
const current2 = pending2.pop() ?? folder;
|
|
76179
|
-
for (const entry of await
|
|
76180
|
-
const path =
|
|
76960
|
+
for (const entry of await readdir7(current2, { withFileTypes: true })) {
|
|
76961
|
+
const path = join20(current2, entry.name);
|
|
76181
76962
|
const rel = relative3(folder, path).split(sep3).join("/");
|
|
76182
76963
|
if (isSkippedPath({ path: rel })) continue;
|
|
76183
76964
|
if (entry.isDirectory()) pending2.push(path);
|
|
@@ -76221,8 +77002,8 @@ var appCreate = async ({ context, args }) => {
|
|
|
76221
77002
|
await mkdir16(folder, { recursive: true });
|
|
76222
77003
|
const files2 = template ? templateFiles({ template, name: name3 }) : {};
|
|
76223
77004
|
for (const [path, content] of Object.entries(files2)) {
|
|
76224
|
-
await mkdir16(dirname16(
|
|
76225
|
-
await writeFile16(
|
|
77005
|
+
await mkdir16(dirname16(join20(folder, path)), { recursive: true });
|
|
77006
|
+
await writeFile16(join20(folder, path), content);
|
|
76226
77007
|
}
|
|
76227
77008
|
const manifest = {
|
|
76228
77009
|
app: { id: app2.id, name: app2.name, slug: app2.slug },
|
|
@@ -76230,7 +77011,7 @@ var appCreate = async ({ context, args }) => {
|
|
|
76230
77011
|
views: template?.views ? [...template.views] : [],
|
|
76231
77012
|
seed: template ? { ...template.seed } : {}
|
|
76232
77013
|
};
|
|
76233
|
-
await writeFile16(
|
|
77014
|
+
await writeFile16(join20(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
|
|
76234
77015
|
`);
|
|
76235
77016
|
print5({
|
|
76236
77017
|
context,
|
|
@@ -76245,6 +77026,11 @@ var appList = async ({ context, args }) => {
|
|
|
76245
77026
|
const client = await appClient({ context, args });
|
|
76246
77027
|
const apps = await client.get("/api/apps");
|
|
76247
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
|
+
}
|
|
76248
77034
|
const state = app2.publishedVersion ? `live (${app2.visibility})` : "not live";
|
|
76249
77035
|
return `${app2.slug} ${app2.id} ${state} ${app2.publishedUrl}
|
|
76250
77036
|
`;
|
|
@@ -76267,7 +77053,7 @@ var appPush = async ({ context, args }) => {
|
|
|
76267
77053
|
paths.map(
|
|
76268
77054
|
async (path) => buildFileOf({
|
|
76269
77055
|
path: relative3(folder, path).split(sep3).join("/"),
|
|
76270
|
-
bytes: await
|
|
77056
|
+
bytes: await readFile18(path)
|
|
76271
77057
|
})
|
|
76272
77058
|
)
|
|
76273
77059
|
);
|
|
@@ -76387,7 +77173,7 @@ async function folderClaim({
|
|
|
76387
77173
|
folder,
|
|
76388
77174
|
appId
|
|
76389
77175
|
}) {
|
|
76390
|
-
const entries = await
|
|
77176
|
+
const entries = await readdir7(folder).catch(() => []);
|
|
76391
77177
|
if (entries.length === 0) return "empty";
|
|
76392
77178
|
const manifest = await readManifest(folder).catch(() => void 0);
|
|
76393
77179
|
if (!manifest) return "other-files";
|
|
@@ -76425,7 +77211,7 @@ var appPull = async ({ context, args }) => {
|
|
|
76425
77211
|
);
|
|
76426
77212
|
}
|
|
76427
77213
|
for (const file3 of pulled.files) {
|
|
76428
|
-
const target =
|
|
77214
|
+
const target = join20(folder, ...file3.path.split("/"));
|
|
76429
77215
|
await mkdir16(dirname16(target), { recursive: true });
|
|
76430
77216
|
await writeFile16(
|
|
76431
77217
|
target,
|
|
@@ -76444,7 +77230,7 @@ var appPull = async ({ context, args }) => {
|
|
|
76444
77230
|
])
|
|
76445
77231
|
)
|
|
76446
77232
|
};
|
|
76447
|
-
await writeFile16(
|
|
77233
|
+
await writeFile16(join20(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
|
|
76448
77234
|
`);
|
|
76449
77235
|
const names = pulled.collections.map((collection) => collection.name);
|
|
76450
77236
|
const where = relative3(context.cwd, folder) || ".";
|
|
@@ -76748,7 +77534,7 @@ var appImport = async ({ context, args }) => {
|
|
|
76748
77534
|
const words = args.words.slice(2);
|
|
76749
77535
|
const [named, collection, file3] = words.length >= 3 ? words : [void 0, ...words];
|
|
76750
77536
|
if (!collection || !file3) throw new CliUsageError(USAGE5);
|
|
76751
|
-
const csv = await
|
|
77537
|
+
const csv = await readFile18(resolve6(context.cwd, file3), "utf8").catch(() => {
|
|
76752
77538
|
throw new CliUsageError(`Cannot read ${file3}`);
|
|
76753
77539
|
});
|
|
76754
77540
|
const scoped = named ? { ...args, flags: { ...args.flags, app: named } } : args;
|
|
@@ -76827,6 +77613,13 @@ function subjectOf(word3) {
|
|
|
76827
77613
|
}
|
|
76828
77614
|
return { type, id: id2 };
|
|
76829
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
|
+
}
|
|
76830
77623
|
function accessText(access) {
|
|
76831
77624
|
const lines2 = [
|
|
76832
77625
|
`Visibility: ${access.visibility}. Everyone it admits is ${ROLE_NAMES[access.memberRole]}.`,
|
|
@@ -76839,6 +77632,9 @@ function accessText(access) {
|
|
|
76839
77632
|
),
|
|
76840
77633
|
...access.requests.map(
|
|
76841
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)}`
|
|
76842
77638
|
)
|
|
76843
77639
|
];
|
|
76844
77640
|
return `${lines2.join("\n")}
|
|
@@ -76928,6 +77724,8 @@ function sourceText(source) {
|
|
|
76928
77724
|
switch (source.kind) {
|
|
76929
77725
|
case "owner":
|
|
76930
77726
|
return "Owner";
|
|
77727
|
+
case "creator":
|
|
77728
|
+
return "Creator";
|
|
76931
77729
|
case "admin":
|
|
76932
77730
|
return "Workspace admin";
|
|
76933
77731
|
case "direct":
|
|
@@ -76974,6 +77772,26 @@ var appAccess = async ({ context, args }) => {
|
|
|
76974
77772
|
if (!run4) throw new CliUsageError(USAGE5);
|
|
76975
77773
|
print5({ context, args, ...await run4({ client, appId, first, second }) });
|
|
76976
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
|
+
};
|
|
76977
77795
|
var appUnpublish = async ({ context, args }) => {
|
|
76978
77796
|
const client = await appClient({ context, args });
|
|
76979
77797
|
const appId = await appIdOf({ client, args, folder: folderOf({ context, word: void 0 }) });
|
|
@@ -76987,21 +77805,21 @@ var appUnpublish = async ({ context, args }) => {
|
|
|
76987
77805
|
});
|
|
76988
77806
|
};
|
|
76989
77807
|
function costText({ name: name3, cost }) {
|
|
76990
|
-
const
|
|
77808
|
+
const money3 = (amount) => formatAppMoney({ amount, currency: cost.currency });
|
|
76991
77809
|
const month = Temporal3.PlainDate.from(`${cost.month}-01`).toLocaleString("en-GB", {
|
|
76992
77810
|
month: "long",
|
|
76993
77811
|
year: "numeric"
|
|
76994
77812
|
});
|
|
76995
77813
|
const rows = cost.lines.map((line) => {
|
|
76996
77814
|
const used = appCostQuantityText(line);
|
|
76997
|
-
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}` : ""}
|
|
76998
77816
|
`;
|
|
76999
77817
|
});
|
|
77000
77818
|
const { budget: budget2 } = cost;
|
|
77001
|
-
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.
|
|
77002
77820
|
`;
|
|
77003
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" : "";
|
|
77004
|
-
return `${name3} cost ${
|
|
77822
|
+
return `${name3} cost ${money3(cost.total)} so far in ${month}, at Laze list prices:
|
|
77005
77823
|
${rows.join("")}${budgetLine}${paused}`;
|
|
77006
77824
|
}
|
|
77007
77825
|
async function appOfWord({
|
|
@@ -77058,6 +77876,7 @@ var APP_COMMANDS = {
|
|
|
77058
77876
|
unpublish: appUnpublish,
|
|
77059
77877
|
access: appAccess,
|
|
77060
77878
|
members: appMembers,
|
|
77879
|
+
request: appRequest,
|
|
77061
77880
|
name: appName,
|
|
77062
77881
|
versions: appVersions,
|
|
77063
77882
|
log: appVersions,
|
|
@@ -77256,7 +78075,13 @@ var BILLING_USAGE = `Usage:
|
|
|
77256
78075
|
laze billing currency usd|eur bill in USD or EUR, until the first payment (admins)
|
|
77257
78076
|
laze billing top-up <amount> a Stripe link that adds prepaid credits, 10 or more (admins)
|
|
77258
78077
|
laze billing auto-recharge on|off [--amount <n>] [--limit <n>] (admins)
|
|
77259
|
-
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)`;
|
|
77260
78085
|
var printJson = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
|
|
77261
78086
|
`);
|
|
77262
78087
|
async function plan({ context, args }) {
|
|
@@ -77293,8 +78118,14 @@ function printAccount({ context, args }, account) {
|
|
|
77293
78118
|
const of = (amount) => money(amount, account.currency);
|
|
77294
78119
|
const plan2 = account.plan === "team" ? `Team, ${of(account.seats.monthlyPrice)} a month for ${account.seats.people} people` : "Free, for one person";
|
|
77295
78120
|
const pending2 = account.status === "pending_payment" ? " (payment pending: run laze billing checkout)" : "";
|
|
77296
|
-
|
|
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}
|
|
77297
78127
|
`);
|
|
78128
|
+
}
|
|
77298
78129
|
context.out(
|
|
77299
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)" : ""}
|
|
77300
78131
|
`
|
|
@@ -77323,8 +78154,9 @@ async function invoices({ context, args }) {
|
|
|
77323
78154
|
if (list11.length === 0) return context.out("No invoices yet.\n");
|
|
77324
78155
|
for (const invoice of list11) {
|
|
77325
78156
|
const link = invoice.hostedUrl ? ` ${invoice.hostedUrl}` : "";
|
|
78157
|
+
const tax = invoice.tax ? ` (tax ${money(invoice.tax, invoice.currency)})` : "";
|
|
77326
78158
|
context.out(
|
|
77327
|
-
`${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}
|
|
77328
78160
|
`
|
|
77329
78161
|
);
|
|
77330
78162
|
}
|
|
@@ -77387,6 +78219,73 @@ async function referral({ context, args }) {
|
|
|
77387
78219
|
await client.post("/api/billing-account/referral", { code })
|
|
77388
78220
|
);
|
|
77389
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
|
+
}
|
|
77390
78289
|
var BILLING_COMMANDS = {
|
|
77391
78290
|
account: show,
|
|
77392
78291
|
invoices,
|
|
@@ -77395,7 +78294,10 @@ var BILLING_COMMANDS = {
|
|
|
77395
78294
|
currency,
|
|
77396
78295
|
"top-up": topUp,
|
|
77397
78296
|
"auto-recharge": autoRecharge,
|
|
77398
|
-
referral
|
|
78297
|
+
referral,
|
|
78298
|
+
details,
|
|
78299
|
+
cancel,
|
|
78300
|
+
keep
|
|
77399
78301
|
};
|
|
77400
78302
|
async function billing({ context, args }) {
|
|
77401
78303
|
const name3 = args.words[1];
|
|
@@ -77407,13 +78309,13 @@ async function billing({ context, args }) {
|
|
|
77407
78309
|
|
|
77408
78310
|
// src/services/browser-commands.service.ts
|
|
77409
78311
|
import { randomBytes } from "node:crypto";
|
|
77410
|
-
import { mkdir as mkdir19, readFile as
|
|
77411
|
-
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";
|
|
77412
78314
|
|
|
77413
78315
|
// src/services/browser-tab-commands.service.ts
|
|
77414
78316
|
import { mkdir as mkdir18, writeFile as writeFile18 } from "node:fs/promises";
|
|
77415
78317
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
77416
|
-
import { join as
|
|
78318
|
+
import { join as join22 } from "node:path";
|
|
77417
78319
|
|
|
77418
78320
|
// src/rules/browser-login.rules.ts
|
|
77419
78321
|
var PASSWORD_NAME = /pass|pwd/i;
|
|
@@ -77443,10 +78345,10 @@ function loginValuesOf({
|
|
|
77443
78345
|
}
|
|
77444
78346
|
|
|
77445
78347
|
// src/services/vault-commands.service.ts
|
|
77446
|
-
import { createHash as
|
|
77447
|
-
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";
|
|
77448
78350
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
77449
|
-
import { dirname as dirname17, join as
|
|
78351
|
+
import { dirname as dirname17, join as join21 } from "node:path";
|
|
77450
78352
|
var USAGE6 = `Usage: laze vault run <connection> --reason "<one plain sentence>" [--wait <s>] -- <command> [args...]
|
|
77451
78353
|
Runs the command with the connection's values in its environment, on a Laze agent's computer,
|
|
77452
78354
|
on a machine it runs on, or where a connected agent runs, with its own key.
|
|
@@ -77482,7 +78384,7 @@ async function turnTokenOf2({
|
|
|
77482
78384
|
if (pinned) return pinned;
|
|
77483
78385
|
if (!turnFile) throw new CliUsageError(`${command} works only during an agent's turn`);
|
|
77484
78386
|
try {
|
|
77485
|
-
return (await
|
|
78387
|
+
return (await readFile19(turnFile, "utf8")).trim();
|
|
77486
78388
|
} catch {
|
|
77487
78389
|
throw new CliUsageError(`${command} works only during an agent's turn`);
|
|
77488
78390
|
}
|
|
@@ -77492,12 +78394,12 @@ function runKeyPathOf({
|
|
|
77492
78394
|
connection,
|
|
77493
78395
|
profile = ""
|
|
77494
78396
|
}) {
|
|
77495
|
-
const name3 =
|
|
77496
|
-
const base = turnFile ? dirname17(turnFile) :
|
|
77497
|
-
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`);
|
|
77498
78400
|
}
|
|
77499
78401
|
async function runKeyAt({ path }) {
|
|
77500
|
-
const saved3 = await
|
|
78402
|
+
const saved3 = await readFile19(path, "utf8").then(
|
|
77501
78403
|
(text2) => JSON.parse(text2),
|
|
77502
78404
|
() => void 0
|
|
77503
78405
|
);
|
|
@@ -78007,9 +78909,9 @@ async function savedScreenshot({
|
|
|
78007
78909
|
data,
|
|
78008
78910
|
nowMs
|
|
78009
78911
|
}) {
|
|
78010
|
-
const folder =
|
|
78912
|
+
const folder = join22(tmpdir3(), "laze-browser");
|
|
78011
78913
|
await mkdir18(folder, { recursive: true, mode: 448 });
|
|
78012
|
-
const path =
|
|
78914
|
+
const path = join22(folder, `${tabId.replace(/[^a-zA-Z0-9_-]/g, "_")}-login-${nowMs}.jpg`);
|
|
78013
78915
|
await writeFile18(path, Buffer.from(data, "base64"), { mode: 384 });
|
|
78014
78916
|
return path;
|
|
78015
78917
|
}
|
|
@@ -78486,7 +79388,7 @@ async function turnTokenOf3({
|
|
|
78486
79388
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
78487
79389
|
if (pinned) return pinned;
|
|
78488
79390
|
if (env.LAZE_TURN_FILE) {
|
|
78489
|
-
return
|
|
79391
|
+
return readFile20(env.LAZE_TURN_FILE, "utf8").then(
|
|
78490
79392
|
(text2) => text2.trim(),
|
|
78491
79393
|
() => ""
|
|
78492
79394
|
);
|
|
@@ -78576,7 +79478,7 @@ async function answering({
|
|
|
78576
79478
|
}
|
|
78577
79479
|
function bridgeStatePath({ context, machine: machine2 }) {
|
|
78578
79480
|
const safe = machine2.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
78579
|
-
return
|
|
79481
|
+
return join23(dirname18(context.environment.configPath), "bridges", `${safe}.json`);
|
|
78580
79482
|
}
|
|
78581
79483
|
async function bridgePort({
|
|
78582
79484
|
context,
|
|
@@ -78584,7 +79486,7 @@ async function bridgePort({
|
|
|
78584
79486
|
access
|
|
78585
79487
|
}) {
|
|
78586
79488
|
const path = bridgeStatePath({ context, machine: machine2 });
|
|
78587
|
-
const live = await
|
|
79489
|
+
const live = await readFile20(path, "utf8").then(
|
|
78588
79490
|
(text2) => JSON.parse(text2),
|
|
78589
79491
|
() => void 0
|
|
78590
79492
|
);
|
|
@@ -78997,7 +79899,7 @@ async function activityRead({ context, args }) {
|
|
|
78997
79899
|
|
|
78998
79900
|
// src/services/channel-config-commands.service.ts
|
|
78999
79901
|
var AGENT_HINT2 = "Roles, archiving and removing others are a channel admin's change: ask one.\n";
|
|
79000
|
-
var
|
|
79902
|
+
var LEVELS4 = ["default", "all", "mentions", "nothing", "mute", "unmute"];
|
|
79001
79903
|
async function changing2({
|
|
79002
79904
|
context,
|
|
79003
79905
|
profile,
|
|
@@ -79183,7 +80085,7 @@ function instantOf({ until }) {
|
|
|
79183
80085
|
}
|
|
79184
80086
|
function notifyBodyOf({ args }) {
|
|
79185
80087
|
const [, , channel, word3] = args.words;
|
|
79186
|
-
const level =
|
|
80088
|
+
const level = LEVELS4.find((candidate) => candidate === word3);
|
|
79187
80089
|
if (!channel || !level) throw new CliUsageError(NOTIFY_USAGE);
|
|
79188
80090
|
if (level === "unmute") return { channel, muted: false };
|
|
79189
80091
|
if (level !== "mute") return { channel, level };
|
|
@@ -79259,8 +80161,8 @@ async function channelSettings({ context, args }) {
|
|
|
79259
80161
|
}
|
|
79260
80162
|
|
|
79261
80163
|
// src/services/chat-actions-commands.service.ts
|
|
79262
|
-
import { readFile as
|
|
79263
|
-
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";
|
|
79264
80166
|
|
|
79265
80167
|
// src/rules/file-types.rules.ts
|
|
79266
80168
|
var TYPES2 = {
|
|
@@ -79355,12 +80257,12 @@ async function threadWaitReply({
|
|
|
79355
80257
|
if (!messageId) throw new CliUsageError(USAGE7);
|
|
79356
80258
|
const seconds = timeoutOf({ args });
|
|
79357
80259
|
const { client } = await signedIn({ context, args });
|
|
79358
|
-
const
|
|
79359
|
-
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));
|
|
79360
80262
|
const isNew = (reply2) => reply2.author.kind === "person" && !seen.has(reply2.id);
|
|
79361
80263
|
for (let waited = 0; waited < seconds * 1e3; waited += POLL_MS2) {
|
|
79362
80264
|
await context.sleep(POLL_MS2);
|
|
79363
|
-
const reply2 = (await
|
|
80265
|
+
const reply2 = (await read4()).replies.find(isNew);
|
|
79364
80266
|
if (!reply2) continue;
|
|
79365
80267
|
const line = `${reply2.seq} ${reply2.id} person ${reply2.author.id} ${reply2.body}
|
|
79366
80268
|
`;
|
|
@@ -79592,11 +80494,11 @@ var files = async ({ context, args, client }) => {
|
|
|
79592
80494
|
};
|
|
79593
80495
|
function uploadNameOf({ cwd, path }) {
|
|
79594
80496
|
const inside = relative4(cwd, path);
|
|
79595
|
-
return inside && !inside.startsWith("..") && !isAbsolute2(inside) ? inside :
|
|
80497
|
+
return inside && !inside.startsWith("..") && !isAbsolute2(inside) ? inside : basename5(path);
|
|
79596
80498
|
}
|
|
79597
80499
|
var fileUpload = async ({ context, args, client }) => {
|
|
79598
80500
|
const path = resolve7(context.cwd, wordAt(args, 3));
|
|
79599
|
-
const bytes = new Uint8Array(await
|
|
80501
|
+
const bytes = new Uint8Array(await readFile21(path));
|
|
79600
80502
|
const answer5 = await uploadFile({
|
|
79601
80503
|
context,
|
|
79602
80504
|
client,
|
|
@@ -79769,7 +80671,7 @@ async function chatActions({
|
|
|
79769
80671
|
}
|
|
79770
80672
|
|
|
79771
80673
|
// src/services/claude-monitor.service.ts
|
|
79772
|
-
import { readFile as
|
|
80674
|
+
import { readFile as readFile22, rm as rm10 } from "node:fs/promises";
|
|
79773
80675
|
var MONITOR_IDLE_MS = 3e4;
|
|
79774
80676
|
var MONITOR_OUTRANKED_MS = 3e3;
|
|
79775
80677
|
async function deliverOnce({
|
|
@@ -79810,6 +80712,12 @@ async function deliverOnce({
|
|
|
79810
80712
|
async function monitorRound(turn) {
|
|
79811
80713
|
const { context, session } = turn;
|
|
79812
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
|
+
}
|
|
79813
80721
|
const named = { ...turn.args, flags: { ...turn.args.flags, profile: turn.profile } };
|
|
79814
80722
|
const { client } = await signedIn({ context, args: named });
|
|
79815
80723
|
const claim3 = forSession({ client, session });
|
|
@@ -79870,7 +80778,7 @@ async function monitorSessionOf({
|
|
|
79870
80778
|
const fromEnv = sessionOf({ context, harness: "claude-code", sessionId });
|
|
79871
80779
|
if (fromEnv || !claudePid) return fromEnv;
|
|
79872
80780
|
const path = statePathOf({ context, kind: "sessions", profile: String(claudePid) });
|
|
79873
|
-
return
|
|
80781
|
+
return readFile22(path, "utf8").then(
|
|
79874
80782
|
(text2) => JSON.parse(text2),
|
|
79875
80783
|
() => void 0
|
|
79876
80784
|
);
|
|
@@ -80097,6 +81005,14 @@ var billingConfig = Config.define((c) => ({
|
|
|
80097
81005
|
stripeApiBase: c.env("STRIPE_API_BASE", external_exports.url().default("https://api.stripe.com")),
|
|
80098
81006
|
/** Team's graduated per-person price (`TEAM_PRICING`), one quantity per person. */
|
|
80099
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)),
|
|
80100
81016
|
/** The coupon for a referral: `REFERRAL_TERMS` off, repeating for its months. */
|
|
80101
81017
|
referralCouponId: c.env("STRIPE_COUPON_REFERRAL", external_exports.string().min(1).optional()),
|
|
80102
81018
|
/** List price over cost per usage category; never shown on the site. */
|
|
@@ -80120,7 +81036,9 @@ var referralRefusalSchema = external_exports.enum([
|
|
|
80120
81036
|
"unknown",
|
|
80121
81037
|
"own_code",
|
|
80122
81038
|
"already_applied",
|
|
80123
|
-
"subscribed"
|
|
81039
|
+
"subscribed",
|
|
81040
|
+
"same_person",
|
|
81041
|
+
"same_company"
|
|
80124
81042
|
]);
|
|
80125
81043
|
|
|
80126
81044
|
// ../../modules/billing/contract/src/billing.plans.ts
|
|
@@ -80128,6 +81046,19 @@ var currencySchema = external_exports.enum(["usd", "eur"]);
|
|
|
80128
81046
|
var planSchema = external_exports.enum(["free", "team"]);
|
|
80129
81047
|
var LEGACY_PLANS = { free: "free", team: "team", none: "free", individual: "team" };
|
|
80130
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
|
+
};
|
|
80131
81062
|
var computerSizeSchema = external_exports.enum(["small", "medium", "large", "xl"]);
|
|
80132
81063
|
var COMPUTER_MARKUP = 2;
|
|
80133
81064
|
function computerSize(input2) {
|
|
@@ -80242,6 +81173,13 @@ var subscriptionStatusSchema = external_exports.enum([
|
|
|
80242
81173
|
]);
|
|
80243
81174
|
var pauseReasonSchema = external_exports.enum(["credits"]);
|
|
80244
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
|
+
});
|
|
80245
81183
|
var billingAccountViewDefinition = external_exports.object({
|
|
80246
81184
|
workspaceId: external_exports.string(),
|
|
80247
81185
|
plan: planSchema,
|
|
@@ -80258,6 +81196,8 @@ var billingAccountViewDefinition = external_exports.object({
|
|
|
80258
81196
|
/** What the plan costs a month for these people; 0 on Free. */
|
|
80259
81197
|
monthlyPrice: external_exports.number().nonnegative()
|
|
80260
81198
|
}),
|
|
81199
|
+
/** The first step Team is priced by: `first_two` for subscriptions from before 2026-10-25. */
|
|
81200
|
+
pricingRule: teamPricingRuleSchema.default("first_three"),
|
|
80261
81201
|
/** Team given free of charge by Laze staff, for this many people; null when paid or Free. */
|
|
80262
81202
|
complimentary: external_exports.object({ seats: external_exports.number().int().positive() }).nullable().default(null),
|
|
80263
81203
|
credits: external_exports.object({
|
|
@@ -80297,9 +81237,21 @@ var billingAccountViewDefinition = external_exports.object({
|
|
|
80297
81237
|
/** The code this workspace applied, if any. */
|
|
80298
81238
|
appliedCode: external_exports.string().nullable(),
|
|
80299
81239
|
/** Discounts earned and not yet on a subscription. */
|
|
80300
|
-
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)
|
|
80301
81245
|
}),
|
|
80302
|
-
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)
|
|
80303
81255
|
});
|
|
80304
81256
|
var billingAccountViewSchema = billingAccountViewDefinition;
|
|
80305
81257
|
var invoiceDefinition = external_exports.object({
|
|
@@ -80307,12 +81259,61 @@ var invoiceDefinition = external_exports.object({
|
|
|
80307
81259
|
number: external_exports.string().nullable(),
|
|
80308
81260
|
status: external_exports.string(),
|
|
80309
81261
|
total: external_exports.number(),
|
|
81262
|
+
/** The tax on the invoice, in the same units as `total`. */
|
|
81263
|
+
tax: external_exports.number().default(0),
|
|
80310
81264
|
currency: currencySchema,
|
|
80311
81265
|
createdAt: external_exports.iso.datetime(),
|
|
80312
81266
|
hostedUrl: external_exports.string().nullable(),
|
|
80313
81267
|
pdfUrl: external_exports.string().nullable()
|
|
80314
81268
|
});
|
|
80315
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({});
|
|
80316
81317
|
var returnPathSchema = external_exports.string().max(500).regex(/^\/(?!\/)/, "a path on this site").optional();
|
|
80317
81318
|
var startCheckoutInputDefinition = external_exports.object({
|
|
80318
81319
|
workspaceId: external_exports.string().min(1),
|
|
@@ -80327,6 +81328,37 @@ var openPortalInputDefinition = external_exports.object({
|
|
|
80327
81328
|
var openPortalInputSchema = openPortalInputDefinition;
|
|
80328
81329
|
var redirectDefinition = external_exports.object({ url: external_exports.string() });
|
|
80329
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;
|
|
80330
81362
|
var setCurrencyInputDefinition = external_exports.object({
|
|
80331
81363
|
workspaceId: external_exports.string().min(1),
|
|
80332
81364
|
currency: currencySchema
|
|
@@ -80353,6 +81385,23 @@ var applyReferralInputDefinition = external_exports.object({
|
|
|
80353
81385
|
code: external_exports.string().trim().min(1).max(64)
|
|
80354
81386
|
});
|
|
80355
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;
|
|
80356
81405
|
var usageCategorySchema = external_exports.enum([
|
|
80357
81406
|
"model",
|
|
80358
81407
|
"machine",
|
|
@@ -80390,7 +81439,7 @@ var grantCreditsInputDefinition = external_exports.object({
|
|
|
80390
81439
|
reason: external_exports.string().trim().min(3).max(500)
|
|
80391
81440
|
});
|
|
80392
81441
|
var BillingApi = moduleApi()("billing");
|
|
80393
|
-
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();
|
|
80394
81443
|
var stripeWebhookHeadersDefinition = external_exports.object({
|
|
80395
81444
|
"stripe-signature": external_exports.string().max(1e3).default("")
|
|
80396
81445
|
});
|
|
@@ -80805,7 +81854,7 @@ var dedicatedIpKeyReleasedDefinition = external_exports.object({
|
|
|
80805
81854
|
});
|
|
80806
81855
|
|
|
80807
81856
|
// ../../modules/compute/contract/src/own-machine-ssh.ts
|
|
80808
|
-
var
|
|
81857
|
+
var workspaceIdSchema17 = external_exports.string().min(1).max(64);
|
|
80809
81858
|
var machineRefText = external_exports.string().min(1).max(64);
|
|
80810
81859
|
var sshHostKeySchema = external_exports.string().regex(/^SHA256:[A-Za-z0-9+/]{43}$/);
|
|
80811
81860
|
function sshTargetText({ target }) {
|
|
@@ -80827,7 +81876,7 @@ var machineSshDefinition = external_exports.object({
|
|
|
80827
81876
|
});
|
|
80828
81877
|
var machineSshSchema = machineSshDefinition;
|
|
80829
81878
|
var connectSshDefinition = external_exports.object({
|
|
80830
|
-
workspaceId:
|
|
81879
|
+
workspaceId: workspaceIdSchema17,
|
|
80831
81880
|
/** Checked by `checkMachineName`, so a refusal reads as a sentence. */
|
|
80832
81881
|
name: external_exports.string().max(200),
|
|
80833
81882
|
/** `user@host[:port]`, checked by `parseSshTarget`. */
|
|
@@ -80836,7 +81885,7 @@ var connectSshDefinition = external_exports.object({
|
|
|
80836
81885
|
var connectSshMachineInputSchema = connectSshDefinition;
|
|
80837
81886
|
var restConnectSshDefinition = connectSshDefinition.omit({ workspaceId: true });
|
|
80838
81887
|
var trustHostKeyDefinition = external_exports.object({
|
|
80839
|
-
workspaceId:
|
|
81888
|
+
workspaceId: workspaceIdSchema17,
|
|
80840
81889
|
machine: machineRefText,
|
|
80841
81890
|
hostKey: sshHostKeySchema
|
|
80842
81891
|
});
|
|
@@ -80844,7 +81893,7 @@ var trustHostKeyInputSchema = trustHostKeyDefinition;
|
|
|
80844
81893
|
var restTrustHostKeyDefinition = trustHostKeyDefinition.omit({ workspaceId: true });
|
|
80845
81894
|
|
|
80846
81895
|
// ../../modules/compute/contract/src/own-machine-whatsapp.ts
|
|
80847
|
-
var
|
|
81896
|
+
var workspaceIdSchema18 = external_exports.string().min(1).max(64);
|
|
80848
81897
|
var machineRefText2 = external_exports.string().min(1).max(64);
|
|
80849
81898
|
var WHATSAPP_TEXT_MAX = 4096;
|
|
80850
81899
|
var WHATSAPP_LIMIT_MAX = 200;
|
|
@@ -80881,25 +81930,25 @@ var messagesResultDefinition = external_exports.object({
|
|
|
80881
81930
|
var limitSchema = external_exports.number().int().min(1).max(WHATSAPP_LIMIT_MAX);
|
|
80882
81931
|
var chatRefSchema = external_exports.string().trim().min(1).max(200);
|
|
80883
81932
|
var chatsInputDefinition = external_exports.object({
|
|
80884
|
-
workspaceId:
|
|
81933
|
+
workspaceId: workspaceIdSchema18,
|
|
80885
81934
|
machine: machineRefText2,
|
|
80886
81935
|
limit: limitSchema.optional()
|
|
80887
81936
|
});
|
|
80888
81937
|
var readInputDefinition = external_exports.object({
|
|
80889
|
-
workspaceId:
|
|
81938
|
+
workspaceId: workspaceIdSchema18,
|
|
80890
81939
|
machine: machineRefText2,
|
|
80891
81940
|
/** A chat id, a phone number or a contact or group name. */
|
|
80892
81941
|
chat: chatRefSchema,
|
|
80893
81942
|
limit: limitSchema.optional()
|
|
80894
81943
|
});
|
|
80895
81944
|
var sendInputDefinition = external_exports.object({
|
|
80896
|
-
workspaceId:
|
|
81945
|
+
workspaceId: workspaceIdSchema18,
|
|
80897
81946
|
machine: machineRefText2,
|
|
80898
81947
|
chat: chatRefSchema,
|
|
80899
81948
|
text: external_exports.string().trim().min(1).max(WHATSAPP_TEXT_MAX)
|
|
80900
81949
|
});
|
|
80901
81950
|
var sendStatusInputDefinition = external_exports.object({
|
|
80902
|
-
workspaceId:
|
|
81951
|
+
workspaceId: workspaceIdSchema18,
|
|
80903
81952
|
sendId: external_exports.string().min(1).max(64),
|
|
80904
81953
|
/** Wait up to this long for the owner's answer; 0 answers at once. */
|
|
80905
81954
|
waitSeconds: external_exports.number().int().min(0).max(WHATSAPP_STATUS_WAIT_MAX_SECONDS).default(0)
|
|
@@ -80937,7 +81986,7 @@ var whatsappPairingDefinition = external_exports.object({
|
|
|
80937
81986
|
});
|
|
80938
81987
|
var whatsappPairingSchema = whatsappPairingDefinition;
|
|
80939
81988
|
var pairingRefDefinition = external_exports.object({
|
|
80940
|
-
workspaceId:
|
|
81989
|
+
workspaceId: workspaceIdSchema18,
|
|
80941
81990
|
pairingId: external_exports.string().min(1).max(64)
|
|
80942
81991
|
});
|
|
80943
81992
|
var whatsappPairingRefSchema = pairingRefDefinition;
|
|
@@ -80958,7 +82007,7 @@ var COMPUTE_WHATSAPP_REST_PATHS = {
|
|
|
80958
82007
|
};
|
|
80959
82008
|
|
|
80960
82009
|
// ../../modules/compute/contract/src/own-machine.ts
|
|
80961
|
-
var
|
|
82010
|
+
var workspaceIdSchema19 = external_exports.string().min(1).max(64);
|
|
80962
82011
|
var machineRefText3 = external_exports.string().min(1).max(64);
|
|
80963
82012
|
var machineBrowserDefinition = external_exports.object({
|
|
80964
82013
|
ready: external_exports.boolean(),
|
|
@@ -80991,7 +82040,7 @@ var machineHealthDefinition = external_exports.object({
|
|
|
80991
82040
|
});
|
|
80992
82041
|
var machineHealthSchema = machineHealthDefinition;
|
|
80993
82042
|
var connectOwnDefinition = external_exports.object({
|
|
80994
|
-
workspaceId:
|
|
82043
|
+
workspaceId: workspaceIdSchema19,
|
|
80995
82044
|
/** Checked by `checkMachineName`, so a refusal reads as a sentence. */
|
|
80996
82045
|
name: external_exports.string().max(200)
|
|
80997
82046
|
});
|
|
@@ -80999,7 +82048,7 @@ var connectOwnMachineInputSchema = connectOwnDefinition;
|
|
|
80999
82048
|
var MACHINE_EXEC_MAX_SECONDS = 240;
|
|
81000
82049
|
var MACHINE_EXEC_OUTPUT_BYTES = 1024 * 1024;
|
|
81001
82050
|
var execDefinition = external_exports.object({
|
|
81002
|
-
workspaceId:
|
|
82051
|
+
workspaceId: workspaceIdSchema19,
|
|
81003
82052
|
machine: machineRefText3,
|
|
81004
82053
|
command: external_exports.string().min(1).max(64 * 1024),
|
|
81005
82054
|
timeoutSeconds: external_exports.number().int().min(1).max(MACHINE_EXEC_MAX_SECONDS).optional(),
|
|
@@ -81071,14 +82120,14 @@ function gigabytes(bytes) {
|
|
|
81071
82120
|
}
|
|
81072
82121
|
var hostWhenOfflineSchema = external_exports.enum(["wait", "sandbox"]);
|
|
81073
82122
|
var hostAgentDefinition = external_exports.object({
|
|
81074
|
-
workspaceId:
|
|
82123
|
+
workspaceId: workspaceIdSchema19,
|
|
81075
82124
|
machine: machineRefText3,
|
|
81076
82125
|
agentId: external_exports.string().min(1).max(64),
|
|
81077
82126
|
whenOffline: hostWhenOfflineSchema.default("wait")
|
|
81078
82127
|
});
|
|
81079
82128
|
var hostAgentInputSchema = hostAgentDefinition;
|
|
81080
82129
|
var unhostAgentDefinition = external_exports.object({
|
|
81081
|
-
workspaceId:
|
|
82130
|
+
workspaceId: workspaceIdSchema19,
|
|
81082
82131
|
agentId: external_exports.string().min(1).max(64)
|
|
81083
82132
|
});
|
|
81084
82133
|
var unhostAgentInputSchema = unhostAgentDefinition;
|
|
@@ -81097,8 +82146,8 @@ var agentHostGrantDefinition = external_exports.object({
|
|
|
81097
82146
|
});
|
|
81098
82147
|
|
|
81099
82148
|
// ../../modules/compute/contract/src/compute.ts
|
|
81100
|
-
var
|
|
81101
|
-
var
|
|
82149
|
+
var idSchema21 = external_exports.string().min(1).max(64);
|
|
82150
|
+
var workspaceIdSchema20 = external_exports.string().min(1).max(64);
|
|
81102
82151
|
var machineStateSchema = external_exports.enum([
|
|
81103
82152
|
"starting",
|
|
81104
82153
|
"ready",
|
|
@@ -81119,24 +82168,24 @@ var machinePriceDefinition = external_exports.object({
|
|
|
81119
82168
|
asleepMonthUsd: external_exports.number()
|
|
81120
82169
|
});
|
|
81121
82170
|
var machineGranteeKindSchema = external_exports.enum(["member", "agent"]);
|
|
81122
|
-
var machineGranteeDefinition = external_exports.object({ kind: machineGranteeKindSchema, id:
|
|
82171
|
+
var machineGranteeDefinition = external_exports.object({ kind: machineGranteeKindSchema, id: idSchema21 });
|
|
81123
82172
|
var machineGrantDefinition = external_exports.object({
|
|
81124
82173
|
kind: machineGranteeKindSchema,
|
|
81125
|
-
id:
|
|
81126
|
-
grantedByUserId:
|
|
82174
|
+
id: idSchema21,
|
|
82175
|
+
grantedByUserId: idSchema21,
|
|
81127
82176
|
grantedAt: external_exports.iso.datetime()
|
|
81128
82177
|
});
|
|
81129
82178
|
var machineDefinition = external_exports.object({
|
|
81130
|
-
id:
|
|
81131
|
-
workspaceId:
|
|
82179
|
+
id: idSchema21,
|
|
82180
|
+
workspaceId: workspaceIdSchema20,
|
|
81132
82181
|
name: external_exports.string(),
|
|
81133
82182
|
type: machineTypeSchema,
|
|
81134
82183
|
zone: external_exports.string(),
|
|
81135
82184
|
state: machineStateSchema,
|
|
81136
|
-
ownerUserId:
|
|
81137
|
-
requesterUserId:
|
|
81138
|
-
renterAgentId:
|
|
81139
|
-
channelId:
|
|
82185
|
+
ownerUserId: idSchema21,
|
|
82186
|
+
requesterUserId: idSchema21,
|
|
82187
|
+
renterAgentId: idSchema21.nullable(),
|
|
82188
|
+
channelId: idSchema21.nullable(),
|
|
81140
82189
|
ipAddress: external_exports.string().nullable(),
|
|
81141
82190
|
sites: external_exports.array(machineSiteDefinition),
|
|
81142
82191
|
/** Members and agents the owner shared the machine with, beyond the owner's own agents. */
|
|
@@ -81168,7 +82217,7 @@ var machineDefinition = external_exports.object({
|
|
|
81168
82217
|
/** The owner's agents set to run on this own machine. */
|
|
81169
82218
|
hostedAgents: external_exports.array(
|
|
81170
82219
|
external_exports.object({
|
|
81171
|
-
id:
|
|
82220
|
+
id: idSchema21,
|
|
81172
82221
|
name: external_exports.string(),
|
|
81173
82222
|
whenOffline: external_exports.enum(["wait", "sandbox"])
|
|
81174
82223
|
})
|
|
@@ -81179,23 +82228,23 @@ var machineDefinition = external_exports.object({
|
|
|
81179
82228
|
var machineSchema = machineDefinition;
|
|
81180
82229
|
var computeStatusDefinition = external_exports.object({ available: external_exports.boolean() });
|
|
81181
82230
|
var computeStatusSchema = computeStatusDefinition;
|
|
81182
|
-
var workspaceInputDefinition2 = external_exports.object({ workspaceId:
|
|
82231
|
+
var workspaceInputDefinition2 = external_exports.object({ workspaceId: workspaceIdSchema20 });
|
|
81183
82232
|
var computeWorkspaceInputSchema = workspaceInputDefinition2;
|
|
81184
82233
|
var machineRefDefinition = external_exports.object({
|
|
81185
|
-
workspaceId:
|
|
82234
|
+
workspaceId: workspaceIdSchema20,
|
|
81186
82235
|
machine: external_exports.string().min(1).max(64)
|
|
81187
82236
|
});
|
|
81188
82237
|
var machineRefSchema = machineRefDefinition;
|
|
81189
82238
|
var MACHINE_NAME_MAX = 40;
|
|
81190
82239
|
var machineNameSchema = external_exports.string().min(2).max(MACHINE_NAME_MAX).regex(/^[a-z0-9][a-z0-9-]*$/, "lowercase letters, digits and dashes");
|
|
81191
82240
|
var renameDefinition = external_exports.object({
|
|
81192
|
-
workspaceId:
|
|
82241
|
+
workspaceId: workspaceIdSchema20,
|
|
81193
82242
|
machine: external_exports.string().min(1).max(64),
|
|
81194
82243
|
name: external_exports.string().max(200)
|
|
81195
82244
|
});
|
|
81196
82245
|
var renameMachineInputSchema = renameDefinition;
|
|
81197
82246
|
var setupBrowserDefinition = external_exports.object({
|
|
81198
|
-
workspaceId:
|
|
82247
|
+
workspaceId: workspaceIdSchema20,
|
|
81199
82248
|
/** The site the person signs in to, as a host or a URL. */
|
|
81200
82249
|
site: external_exports.string().min(1).max(500),
|
|
81201
82250
|
name: machineNameSchema.optional(),
|
|
@@ -81204,29 +82253,29 @@ var setupBrowserDefinition = external_exports.object({
|
|
|
81204
82253
|
});
|
|
81205
82254
|
var setupBrowserInputSchema = setupBrowserDefinition;
|
|
81206
82255
|
var grantDefinition = external_exports.object({
|
|
81207
|
-
workspaceId:
|
|
82256
|
+
workspaceId: workspaceIdSchema20,
|
|
81208
82257
|
machine: external_exports.string().min(1).max(64),
|
|
81209
82258
|
grantee: machineGranteeDefinition
|
|
81210
82259
|
});
|
|
81211
82260
|
var machineGrantInputSchema = grantDefinition;
|
|
81212
82261
|
var setBudgetDefinition = external_exports.object({
|
|
81213
|
-
workspaceId:
|
|
82262
|
+
workspaceId: workspaceIdSchema20,
|
|
81214
82263
|
machine: external_exports.string().min(1).max(64),
|
|
81215
82264
|
budgetUsd: external_exports.number().min(0).max(1e4),
|
|
81216
82265
|
period: machineBudgetPeriodSchema
|
|
81217
82266
|
});
|
|
81218
82267
|
var setMachineBudgetInputSchema = setBudgetDefinition;
|
|
81219
82268
|
var openScreenDefinition = external_exports.object({
|
|
81220
|
-
workspaceId:
|
|
82269
|
+
workspaceId: workspaceIdSchema20,
|
|
81221
82270
|
machine: external_exports.string().min(1).max(64),
|
|
81222
82271
|
site: external_exports.string().min(1).max(500).optional()
|
|
81223
82272
|
});
|
|
81224
82273
|
var openScreenInputSchema = openScreenDefinition;
|
|
81225
|
-
var screenRefDefinition = external_exports.object({ workspaceId:
|
|
82274
|
+
var screenRefDefinition = external_exports.object({ workspaceId: workspaceIdSchema20, sessionId: idSchema21 });
|
|
81226
82275
|
var screenRefSchema = screenRefDefinition;
|
|
81227
82276
|
var screenSessionDefinition = external_exports.object({
|
|
81228
|
-
sessionId:
|
|
81229
|
-
machineId:
|
|
82277
|
+
sessionId: idSchema21,
|
|
82278
|
+
machineId: idSchema21,
|
|
81230
82279
|
machineName: external_exports.string(),
|
|
81231
82280
|
site: external_exports.string().nullable(),
|
|
81232
82281
|
expiresAt: external_exports.iso.datetime(),
|
|
@@ -81260,7 +82309,7 @@ var ownMachineSshConnectDefinition = external_exports.object({
|
|
|
81260
82309
|
publicKey: external_exports.string()
|
|
81261
82310
|
});
|
|
81262
82311
|
var ownMachineSshConnectSchema = ownMachineSshConnectDefinition;
|
|
81263
|
-
var reconcileDefinition = external_exports.object({ workspaceId:
|
|
82312
|
+
var reconcileDefinition = external_exports.object({ workspaceId: workspaceIdSchema20, machineId: idSchema21 });
|
|
81264
82313
|
var ComputeApi = moduleApi()("compute");
|
|
81265
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();
|
|
81266
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();
|
|
@@ -81358,9 +82407,9 @@ function creatorsOf(args) {
|
|
|
81358
82407
|
return { everyone: args.flags.everyone === true, userIds };
|
|
81359
82408
|
}
|
|
81360
82409
|
function lineOf3(computer2) {
|
|
81361
|
-
const
|
|
82410
|
+
const money3 = `${computer2.monthlyCharge} ${computer2.currency.toUpperCase()} a month`;
|
|
81362
82411
|
const agents = `${computer2.agents.length} agent(s)`;
|
|
81363
|
-
return ` ${computer2.computerId} ${computer2.name} ${computer2.kind} ${computer2.size} ${
|
|
82412
|
+
return ` ${computer2.computerId} ${computer2.name} ${computer2.kind} ${computer2.size} ${money3} ${agents} ${computer2.state}`;
|
|
81364
82413
|
}
|
|
81365
82414
|
async function mine({ context, args }) {
|
|
81366
82415
|
const client = await computeClient({ context, args });
|
|
@@ -81549,7 +82598,7 @@ Message to forward: ${answer5.message}
|
|
|
81549
82598
|
`
|
|
81550
82599
|
);
|
|
81551
82600
|
}
|
|
81552
|
-
async function
|
|
82601
|
+
async function cancel2({ context, args }) {
|
|
81553
82602
|
const requestId = args.words[2];
|
|
81554
82603
|
if (!requestId) throw new CliUsageError(COMPUTER_USAGE);
|
|
81555
82604
|
const client = await computeClient({ context, args });
|
|
@@ -81578,9 +82627,9 @@ async function list2({ context, args }) {
|
|
|
81578
82627
|
const client = await computeClient({ context, args });
|
|
81579
82628
|
const answer5 = await client.get(COMPUTER_REST_PATHS.all);
|
|
81580
82629
|
if (args.flags.json) return printJson3(context, answer5);
|
|
81581
|
-
const
|
|
82630
|
+
const money3 = (amount) => `${amount} ${answer5.currency.toUpperCase()}`;
|
|
81582
82631
|
const lines2 = answer5.computers.map(
|
|
81583
|
-
(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}`
|
|
81584
82633
|
);
|
|
81585
82634
|
context.out(
|
|
81586
82635
|
`Everyone's computers (${answer5.includedSize} included per person):
|
|
@@ -81593,7 +82642,7 @@ var COMPUTER_COMMANDS = {
|
|
|
81593
82642
|
sizes,
|
|
81594
82643
|
upgrade,
|
|
81595
82644
|
request,
|
|
81596
|
-
cancel,
|
|
82645
|
+
cancel: cancel2,
|
|
81597
82646
|
restart,
|
|
81598
82647
|
list: list2,
|
|
81599
82648
|
...COMPUTER_FLEET_COMMANDS
|
|
@@ -81607,10 +82656,10 @@ async function computer({ context, args }) {
|
|
|
81607
82656
|
}
|
|
81608
82657
|
|
|
81609
82658
|
// src/services/connect-commands.service.ts
|
|
81610
|
-
import { readFile as
|
|
82659
|
+
import { readFile as readFile24 } from "node:fs/promises";
|
|
81611
82660
|
|
|
81612
82661
|
// src/services/mcp-gateway.service.ts
|
|
81613
|
-
import { readFile as
|
|
82662
|
+
import { readFile as readFile23 } from "node:fs/promises";
|
|
81614
82663
|
import { createInterface as createInterface3 } from "node:readline";
|
|
81615
82664
|
var TURN_HEADER = "x-laze-turn";
|
|
81616
82665
|
function serveMcpGateway({
|
|
@@ -81653,7 +82702,7 @@ async function relayMcpLines({
|
|
|
81653
82702
|
const github3 = env.LAZE_GITHUB_CONNECTION;
|
|
81654
82703
|
const url2 = `${profile.url.replace(/\/+$/, "")}/api/connectors/mcp/${encodeURIComponent(profile.agentId)}${github3 ? `?github=${encodeURIComponent(github3)}` : ""}`;
|
|
81655
82704
|
const turnFile = env.LAZE_TURN_FILE;
|
|
81656
|
-
const readTurn = () =>
|
|
82705
|
+
const readTurn = () => readFile23(turnFile, "utf8").then(
|
|
81657
82706
|
(text2) => text2.trim(),
|
|
81658
82707
|
() => ""
|
|
81659
82708
|
);
|
|
@@ -81743,7 +82792,7 @@ async function turnOf({ context }) {
|
|
|
81743
82792
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
81744
82793
|
if (pinned) return pinned;
|
|
81745
82794
|
const file3 = env.LAZE_TURN_FILE;
|
|
81746
|
-
const turn = file3 ? await
|
|
82795
|
+
const turn = file3 ? await readFile24(file3, "utf8").then(
|
|
81747
82796
|
(text2) => text2.trim(),
|
|
81748
82797
|
() => ""
|
|
81749
82798
|
) : "";
|
|
@@ -81801,11 +82850,11 @@ async function connect({
|
|
|
81801
82850
|
}
|
|
81802
82851
|
|
|
81803
82852
|
// src/services/connector-commands.service.ts
|
|
81804
|
-
import { readFile as
|
|
82853
|
+
import { readFile as readFile26 } from "node:fs/promises";
|
|
81805
82854
|
import { resolve as resolve8 } from "node:path";
|
|
81806
82855
|
|
|
81807
82856
|
// src/services/vault-keychain-commands.service.ts
|
|
81808
|
-
import { readFile as
|
|
82857
|
+
import { readFile as readFile25 } from "node:fs/promises";
|
|
81809
82858
|
|
|
81810
82859
|
// src/rules/vault-input.rules.ts
|
|
81811
82860
|
function secondsOf(text2) {
|
|
@@ -82185,7 +83234,7 @@ async function secretText({ context, args }) {
|
|
|
82185
83234
|
);
|
|
82186
83235
|
}
|
|
82187
83236
|
const file3 = flagText({ args, name: "from-file" });
|
|
82188
|
-
const text2 = file3 ? await
|
|
83237
|
+
const text2 = file3 ? await readFile25(file3, "utf8") : await context.readStdin();
|
|
82189
83238
|
const trimmed = text2.replace(/\r?\n$/, "");
|
|
82190
83239
|
if (!trimmed.trim()) throw new CliUsageError("No value: pipe it on stdin or use --from-file.");
|
|
82191
83240
|
return trimmed;
|
|
@@ -82414,7 +83463,7 @@ async function keyText({ context, args }) {
|
|
|
82414
83463
|
throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
|
|
82415
83464
|
}
|
|
82416
83465
|
const file3 = flagText({ args, name: "from-file" });
|
|
82417
|
-
const text2 = file3 ? await
|
|
83466
|
+
const text2 = file3 ? await readFile26(resolve8(context.cwd, file3), "utf8") : await context.readStdin();
|
|
82418
83467
|
const trimmed = text2.trim();
|
|
82419
83468
|
if (!trimmed) throw new CliUsageError("No key: pipe it on stdin or use --from-file.");
|
|
82420
83469
|
return trimmed;
|
|
@@ -82732,12 +83781,12 @@ async function conversationDelete({ context, args }) {
|
|
|
82732
83781
|
}
|
|
82733
83782
|
|
|
82734
83783
|
// src/services/discord-commands.service.ts
|
|
82735
|
-
import { readFile as
|
|
83784
|
+
import { readFile as readFile27 } from "node:fs/promises";
|
|
82736
83785
|
import { resolve as resolve9 } from "node:path";
|
|
82737
83786
|
|
|
82738
83787
|
// ../../modules/discord/contract/src/discord.ts
|
|
82739
|
-
var
|
|
82740
|
-
var workspaceInput4 = external_exports.object({ workspaceId:
|
|
83788
|
+
var workspaceIdSchema21 = external_exports.string().min(1).max(64);
|
|
83789
|
+
var workspaceInput4 = external_exports.object({ workspaceId: workspaceIdSchema21 });
|
|
82741
83790
|
var discordIdSchema = external_exports.string().regex(/^\d{5,25}$/);
|
|
82742
83791
|
var DISCORD_PERMISSIONS = {
|
|
82743
83792
|
ADMINISTRATOR: 1n << 3n,
|
|
@@ -82819,10 +83868,10 @@ var discordChannelViewDefinition = external_exports.object({
|
|
|
82819
83868
|
url: external_exports.url()
|
|
82820
83869
|
});
|
|
82821
83870
|
var discordChannelViewSchema = discordChannelViewDefinition;
|
|
82822
|
-
var guildInputDefinition = external_exports.object({ workspaceId:
|
|
83871
|
+
var guildInputDefinition = external_exports.object({ workspaceId: workspaceIdSchema21, guildId: discordIdSchema });
|
|
82823
83872
|
var discordGuildInputSchema = guildInputDefinition;
|
|
82824
83873
|
var saveDiscordAppDefinition = external_exports.object({
|
|
82825
|
-
workspaceId:
|
|
83874
|
+
workspaceId: workspaceIdSchema21,
|
|
82826
83875
|
setupKey: external_exports.string().min(1).max(64),
|
|
82827
83876
|
applicationId: external_exports.string().trim().max(40),
|
|
82828
83877
|
clientSecret: external_exports.string().trim().max(200),
|
|
@@ -82832,7 +83881,7 @@ var saveDiscordAppInputSchema = saveDiscordAppDefinition;
|
|
|
82832
83881
|
var startedAuthorizeDefinition = external_exports.object({ authorizeUrl: external_exports.url() });
|
|
82833
83882
|
var startedDiscordAuthorizeSchema = startedAuthorizeDefinition;
|
|
82834
83883
|
var pickDefinition = external_exports.object({
|
|
82835
|
-
workspaceId:
|
|
83884
|
+
workspaceId: workspaceIdSchema21,
|
|
82836
83885
|
guildId: discordIdSchema,
|
|
82837
83886
|
channelId: discordIdSchema,
|
|
82838
83887
|
picked: external_exports.boolean(),
|
|
@@ -82840,7 +83889,7 @@ var pickDefinition = external_exports.object({
|
|
|
82840
83889
|
});
|
|
82841
83890
|
var discordPickInputSchema = pickDefinition;
|
|
82842
83891
|
var updateConnectionDefinition = external_exports.object({
|
|
82843
|
-
workspaceId:
|
|
83892
|
+
workspaceId: workspaceIdSchema21,
|
|
82844
83893
|
guildId: discordIdSchema,
|
|
82845
83894
|
label: external_exports.string().trim().max(80).nullable().optional(),
|
|
82846
83895
|
cacheDays: external_exports.number().int().min(1).max(30).optional()
|
|
@@ -82853,9 +83902,9 @@ var oauthCallbackDefinition = external_exports.object({
|
|
|
82853
83902
|
permissions: external_exports.string().max(40).optional(),
|
|
82854
83903
|
error: external_exports.string().max(200).optional()
|
|
82855
83904
|
});
|
|
82856
|
-
var linkParamsDefinition = external_exports.object({ workspaceId:
|
|
83905
|
+
var linkParamsDefinition = external_exports.object({ workspaceId: workspaceIdSchema21, guildId: discordIdSchema });
|
|
82857
83906
|
var historyInputDefinition = external_exports.object({
|
|
82858
|
-
workspaceId:
|
|
83907
|
+
workspaceId: workspaceIdSchema21,
|
|
82859
83908
|
/** The Laze conversation that mirrors the Discord channel. */
|
|
82860
83909
|
channelId: external_exports.string().min(1).max(200),
|
|
82861
83910
|
before: external_exports.iso.datetime()
|
|
@@ -82884,7 +83933,7 @@ var historyPageDefinition = external_exports.object({
|
|
|
82884
83933
|
});
|
|
82885
83934
|
var discordHistoryPageSchema = historyPageDefinition;
|
|
82886
83935
|
var fileParamsDefinition = external_exports.object({
|
|
82887
|
-
workspaceId:
|
|
83936
|
+
workspaceId: workspaceIdSchema21,
|
|
82888
83937
|
channelId: external_exports.string().min(1).max(200),
|
|
82889
83938
|
messageId: discordIdSchema,
|
|
82890
83939
|
attachmentId: discordIdSchema
|
|
@@ -82899,7 +83948,7 @@ var saveAppByKeyDefinition = external_exports.object({
|
|
|
82899
83948
|
var pickByKeyDefinition = pickDefinition.omit({ workspaceId: true });
|
|
82900
83949
|
var updateByKeyDefinition = updateConnectionDefinition.omit({ workspaceId: true });
|
|
82901
83950
|
var historyByKeyDefinition = historyInputDefinition.omit({ workspaceId: true });
|
|
82902
|
-
var
|
|
83951
|
+
var emptyDefinition2 = external_exports.object({});
|
|
82903
83952
|
var DISCORD_KEY_PATHS = {
|
|
82904
83953
|
overview: "/api/discord/overview",
|
|
82905
83954
|
beginSetup: "/api/discord/setup",
|
|
@@ -83054,7 +84103,7 @@ async function secretsOf({ context, args }) {
|
|
|
83054
84103
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
83055
84104
|
if (fromConnection) return { fromConnection };
|
|
83056
84105
|
const file3 = flagText({ args, name: "from-file" });
|
|
83057
|
-
const text2 = file3 ? await
|
|
84106
|
+
const text2 = file3 ? await readFile27(resolve9(context.cwd, file3), "utf8") : await context.readStdin();
|
|
83058
84107
|
const lines2 = text2.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
83059
84108
|
if (lines2.length !== 2) {
|
|
83060
84109
|
throw new CliUsageError(
|
|
@@ -83324,8 +84373,8 @@ var DOMAINS_USAGE = `Usage:
|
|
|
83324
84373
|
var printJson5 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
|
|
83325
84374
|
`);
|
|
83326
84375
|
function printDomain(context, row) {
|
|
83327
|
-
const
|
|
83328
|
-
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" : ""}
|
|
83329
84378
|
`);
|
|
83330
84379
|
}
|
|
83331
84380
|
async function list4({ context, args }) {
|
|
@@ -83357,7 +84406,7 @@ async function domains({ context, args }) {
|
|
|
83357
84406
|
}
|
|
83358
84407
|
|
|
83359
84408
|
// src/services/emoji-commands.service.ts
|
|
83360
|
-
import { readFile as
|
|
84409
|
+
import { readFile as readFile28 } from "node:fs/promises";
|
|
83361
84410
|
import { resolve as resolve10 } from "node:path";
|
|
83362
84411
|
var EMOJI_USAGE = `Usage:
|
|
83363
84412
|
laze emoji list [--json] the workspace's custom emoji, aliases and who added each
|
|
@@ -83398,7 +84447,7 @@ async function addEmoji({ context, args, client }) {
|
|
|
83398
84447
|
const file3 = wordAt4(args, 3);
|
|
83399
84448
|
let bytes;
|
|
83400
84449
|
try {
|
|
83401
|
-
bytes = new Uint8Array(await
|
|
84450
|
+
bytes = new Uint8Array(await readFile28(resolve10(context.cwd, file3)));
|
|
83402
84451
|
} catch {
|
|
83403
84452
|
throw new CliUsageError(`Cannot read ${file3}.`);
|
|
83404
84453
|
}
|
|
@@ -83464,10 +84513,10 @@ var EXTERNAL_CONNECTION_REST_PATHS = {
|
|
|
83464
84513
|
block: "/api/external-connections/block",
|
|
83465
84514
|
report: "/api/external-connections/report"
|
|
83466
84515
|
};
|
|
83467
|
-
var
|
|
83468
|
-
var
|
|
84516
|
+
var workspaceIdSchema22 = external_exports.string().min(1).max(64);
|
|
84517
|
+
var idSchema22 = external_exports.string().min(1).max(64);
|
|
83469
84518
|
var iso = external_exports.iso.datetime();
|
|
83470
|
-
var workspaceInput5 = external_exports.object({ workspaceId:
|
|
84519
|
+
var workspaceInput5 = external_exports.object({ workspaceId: workspaceIdSchema22 });
|
|
83471
84520
|
var connectionReference = external_exports.string().trim().min(1).max(120);
|
|
83472
84521
|
var externalConnectionStateSchema = external_exports.enum(["active", "ended"]);
|
|
83473
84522
|
var externalInviteStateSchema = external_exports.enum([
|
|
@@ -83571,10 +84620,10 @@ var rosterDefinition = external_exports.object({
|
|
|
83571
84620
|
members: external_exports.array(rosterMemberDefinition)
|
|
83572
84621
|
});
|
|
83573
84622
|
var externalRosterSchema = rosterDefinition;
|
|
83574
|
-
var rosterInputDefinition = external_exports.object({ workspaceId:
|
|
84623
|
+
var rosterInputDefinition = external_exports.object({ workspaceId: workspaceIdSchema22, channelId: idSchema22 });
|
|
83575
84624
|
var externalRosterInputSchema = rosterInputDefinition;
|
|
83576
84625
|
var inviteInputDefinition = external_exports.object({
|
|
83577
|
-
workspaceId:
|
|
84626
|
+
workspaceId: workspaceIdSchema22,
|
|
83578
84627
|
email: external_exports.email().max(320),
|
|
83579
84628
|
/** The first channel to share, by id or name; it is shared once the invitation is accepted. */
|
|
83580
84629
|
share: external_exports.string().trim().min(1).max(81).optional(),
|
|
@@ -83582,7 +84631,7 @@ var inviteInputDefinition = external_exports.object({
|
|
|
83582
84631
|
company: external_exports.string().trim().min(1).max(80).optional()
|
|
83583
84632
|
});
|
|
83584
84633
|
var externalInviteInputSchema = inviteInputDefinition;
|
|
83585
|
-
var inviteRefDefinition = external_exports.object({ workspaceId:
|
|
84634
|
+
var inviteRefDefinition = external_exports.object({ workspaceId: workspaceIdSchema22, inviteId: idSchema22 });
|
|
83586
84635
|
var externalInviteRefSchema = inviteRefDefinition;
|
|
83587
84636
|
var pendingShareDefinition = external_exports.object({
|
|
83588
84637
|
channelId: external_exports.string(),
|
|
@@ -83606,8 +84655,8 @@ var pendingSharesDefinition = external_exports.object({
|
|
|
83606
84655
|
var externalPendingSharesSchema = pendingSharesDefinition;
|
|
83607
84656
|
var acceptInviteDefinition = external_exports.object({
|
|
83608
84657
|
/** The workspace to connect: one where the person is Admin or Owner. */
|
|
83609
|
-
workspaceId:
|
|
83610
|
-
inviteId:
|
|
84658
|
+
workspaceId: workspaceIdSchema22,
|
|
84659
|
+
inviteId: idSchema22,
|
|
83611
84660
|
/** The emailed link's secret; without it the invitation must be addressed to the person. */
|
|
83612
84661
|
secret: external_exports.string().trim().max(200).optional()
|
|
83613
84662
|
});
|
|
@@ -83615,40 +84664,40 @@ var externalAcceptInviteInputSchema = acceptInviteDefinition;
|
|
|
83615
84664
|
var answeredDefinition = external_exports.object({ id: external_exports.string(), state: externalInviteStateSchema });
|
|
83616
84665
|
var externalInviteAnsweredSchema = answeredDefinition;
|
|
83617
84666
|
var connectionInputDefinition = external_exports.object({
|
|
83618
|
-
workspaceId:
|
|
84667
|
+
workspaceId: workspaceIdSchema22,
|
|
83619
84668
|
connection: connectionReference
|
|
83620
84669
|
});
|
|
83621
84670
|
var externalConnectionInputSchema = connectionInputDefinition;
|
|
83622
84671
|
var settingsInputDefinition = external_exports.object({
|
|
83623
|
-
workspaceId:
|
|
84672
|
+
workspaceId: workspaceIdSchema22,
|
|
83624
84673
|
connection: connectionReference,
|
|
83625
84674
|
agentsAllowed: external_exports.boolean().optional(),
|
|
83626
84675
|
directAllowed: external_exports.boolean().optional()
|
|
83627
84676
|
});
|
|
83628
84677
|
var externalSettingsInputSchema = settingsInputDefinition;
|
|
83629
84678
|
var shareInputDefinition = external_exports.object({
|
|
83630
|
-
workspaceId:
|
|
84679
|
+
workspaceId: workspaceIdSchema22,
|
|
83631
84680
|
connection: connectionReference,
|
|
83632
84681
|
/** The channel as its id or name, `#` optional. */
|
|
83633
84682
|
channel: external_exports.string().trim().min(1).max(81)
|
|
83634
84683
|
});
|
|
83635
84684
|
var externalShareInputSchema = shareInputDefinition;
|
|
83636
84685
|
var acceptShareDefinition = external_exports.object({
|
|
83637
|
-
workspaceId:
|
|
83638
|
-
shareId:
|
|
84686
|
+
workspaceId: workspaceIdSchema22,
|
|
84687
|
+
shareId: idSchema22,
|
|
83639
84688
|
/** Its name here; the host's name when left out. */
|
|
83640
84689
|
name: external_exports.string().trim().min(1).max(80).optional(),
|
|
83641
84690
|
visibility: external_exports.enum(["public", "private"]).default("public")
|
|
83642
84691
|
});
|
|
83643
84692
|
var externalAcceptShareInputSchema = acceptShareDefinition;
|
|
83644
84693
|
var shareRefDefinition = external_exports.object({
|
|
83645
|
-
workspaceId:
|
|
84694
|
+
workspaceId: workspaceIdSchema22,
|
|
83646
84695
|
/** The share's id, or this workspace's channel as its id or name. */
|
|
83647
84696
|
share: external_exports.string().trim().min(1).max(81)
|
|
83648
84697
|
});
|
|
83649
84698
|
var externalShareRefSchema = shareRefDefinition;
|
|
83650
84699
|
var reportInputDefinition = external_exports.object({
|
|
83651
|
-
workspaceId:
|
|
84700
|
+
workspaceId: workspaceIdSchema22,
|
|
83652
84701
|
connection: connectionReference,
|
|
83653
84702
|
note: external_exports.string().trim().min(1).max(2e3)
|
|
83654
84703
|
});
|
|
@@ -83659,7 +84708,7 @@ var blockedDefinition = external_exports.object({
|
|
|
83659
84708
|
});
|
|
83660
84709
|
var externalBlockedSchema = blockedDefinition;
|
|
83661
84710
|
var openDirectDefinition = external_exports.object({
|
|
83662
|
-
workspaceId:
|
|
84711
|
+
workspaceId: workspaceIdSchema22,
|
|
83663
84712
|
/** The external person: their roster id (`laze:<id>`) or their name in a shared channel. */
|
|
83664
84713
|
person: external_exports.string().trim().min(1).max(120),
|
|
83665
84714
|
/** Their workspace, as a connection reference; needed only when a name is in two. */
|
|
@@ -83685,7 +84734,7 @@ var externalConnectionConfig = Config.define(() => ({ publicBaseUrl }));
|
|
|
83685
84734
|
|
|
83686
84735
|
// ../../modules/external-connection/contract/src/external-connection.rest.ts
|
|
83687
84736
|
var keyed = { workspaceId: true };
|
|
83688
|
-
var
|
|
84737
|
+
var emptyDefinition3 = external_exports.object({});
|
|
83689
84738
|
var rosterDefinition2 = externalRosterInputSchema.omit(keyed);
|
|
83690
84739
|
var inviteDefinition = externalInviteInputSchema.omit(keyed);
|
|
83691
84740
|
var inviteRefDefinition2 = externalInviteRefSchema.omit(keyed);
|
|
@@ -83705,7 +84754,7 @@ var ExternalChannelBannerSlot = externalUi.component("channel-banner");
|
|
|
83705
84754
|
var ExternalSharingHooksToken = externalUi.hooks("sharing");
|
|
83706
84755
|
|
|
83707
84756
|
// src/services/workspace-commands.service.ts
|
|
83708
|
-
import { readFile as
|
|
84757
|
+
import { readFile as readFile29 } from "node:fs/promises";
|
|
83709
84758
|
import { resolve as resolve11 } from "node:path";
|
|
83710
84759
|
var ROLE_NAMES2 = {
|
|
83711
84760
|
OWNER: "Owner",
|
|
@@ -83888,7 +84937,7 @@ var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze work
|
|
|
83888
84937
|
async function readLogo({ context, file: file3 }) {
|
|
83889
84938
|
let bytes;
|
|
83890
84939
|
try {
|
|
83891
|
-
bytes = new Uint8Array(await
|
|
84940
|
+
bytes = new Uint8Array(await readFile29(resolve11(context.cwd, file3)));
|
|
83892
84941
|
} catch {
|
|
83893
84942
|
throw new CliUsageError(`No file to read at ${file3}.`);
|
|
83894
84943
|
}
|
|
@@ -84204,7 +85253,7 @@ async function list6({ context, args }) {
|
|
|
84204
85253
|
...overview3.connections.flatMap(connectionLines),
|
|
84205
85254
|
...overview3.invites.length > 0 ? ["Invitations sent:"] : [],
|
|
84206
85255
|
...overview3.invites.map(
|
|
84207
|
-
(
|
|
85256
|
+
(invite4) => ` ${invite4.email} ${invite4.state} expires ${utcTimeOf(invite4.expiresAt)} ${invite4.id}`
|
|
84208
85257
|
),
|
|
84209
85258
|
...overview3.blocked.map((each) => `Blocked: ${each.name}`)
|
|
84210
85259
|
];
|
|
@@ -84461,7 +85510,7 @@ async function external({ context, args }) {
|
|
|
84461
85510
|
}
|
|
84462
85511
|
|
|
84463
85512
|
// src/services/feed-commands.service.ts
|
|
84464
|
-
import { readFile as
|
|
85513
|
+
import { readFile as readFile31 } from "node:fs/promises";
|
|
84465
85514
|
import { resolve as resolve13 } from "node:path";
|
|
84466
85515
|
|
|
84467
85516
|
// ../../modules/feed/contract/src/feed.ts
|
|
@@ -84649,6 +85698,13 @@ var feedApprovalSchemaDefinition = external_exports.object({
|
|
|
84649
85698
|
"vault_share"
|
|
84650
85699
|
]),
|
|
84651
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(),
|
|
84652
85708
|
/** The app, for an `app_publish` or `app_access` card. */
|
|
84653
85709
|
appId: external_exports.string().nullable(),
|
|
84654
85710
|
subject: external_exports.string(),
|
|
@@ -85086,15 +86142,15 @@ function decisionsLineOf(count5) {
|
|
|
85086
86142
|
function csvCellsOf(line) {
|
|
85087
86143
|
const cells = [];
|
|
85088
86144
|
let cell = "";
|
|
85089
|
-
let
|
|
86145
|
+
let quoted2 = false;
|
|
85090
86146
|
for (let at = 0; at < line.length; at += 1) {
|
|
85091
86147
|
const char = line[at];
|
|
85092
|
-
if (
|
|
86148
|
+
if (quoted2 && char === '"' && line[at + 1] === '"') {
|
|
85093
86149
|
cell += '"';
|
|
85094
86150
|
at += 1;
|
|
85095
86151
|
} else if (char === '"') {
|
|
85096
|
-
|
|
85097
|
-
} else if (char === "," && !
|
|
86152
|
+
quoted2 = !quoted2;
|
|
86153
|
+
} else if (char === "," && !quoted2) {
|
|
85098
86154
|
cells.push(cell);
|
|
85099
86155
|
cell = "";
|
|
85100
86156
|
} else {
|
|
@@ -85211,9 +86267,9 @@ function feedFlagsOf({ args }) {
|
|
|
85211
86267
|
}
|
|
85212
86268
|
|
|
85213
86269
|
// src/services/feed-files.service.ts
|
|
85214
|
-
import { readFile as
|
|
85215
|
-
import { basename as
|
|
85216
|
-
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({
|
|
85217
86273
|
context,
|
|
85218
86274
|
source
|
|
85219
86275
|
}) {
|
|
@@ -85228,7 +86284,7 @@ async function bytesOf2({
|
|
|
85228
86284
|
async function downloaded({ context, url: url2 }) {
|
|
85229
86285
|
const response = await context.fetcher(url2);
|
|
85230
86286
|
if (!response.ok) throw new CliUsageError(`${url2} answered ${response.status}`);
|
|
85231
|
-
const fileName =
|
|
86287
|
+
const fileName = basename6(new URL(url2).pathname) || "file";
|
|
85232
86288
|
const header = (response.headers.get("content-type") ?? "").split(";")[0]?.trim();
|
|
85233
86289
|
return {
|
|
85234
86290
|
fileName,
|
|
@@ -85238,11 +86294,11 @@ async function downloaded({ context, url: url2 }) {
|
|
|
85238
86294
|
}
|
|
85239
86295
|
async function local({ context, path }) {
|
|
85240
86296
|
const full = resolve12(context.cwd, path);
|
|
85241
|
-
const fileName =
|
|
86297
|
+
const fileName = basename6(full);
|
|
85242
86298
|
return {
|
|
85243
86299
|
fileName,
|
|
85244
86300
|
contentType: contentTypeOf(fileName),
|
|
85245
|
-
bytes: new Uint8Array(await
|
|
86301
|
+
bytes: new Uint8Array(await readFile30(full))
|
|
85246
86302
|
};
|
|
85247
86303
|
}
|
|
85248
86304
|
async function directWith({ client, to }) {
|
|
@@ -85270,7 +86326,7 @@ async function feedAttachmentIdsOf({
|
|
|
85270
86326
|
throw new CliUsageError(`An item carries at most ${FEED_ATTACHMENTS_MAX} files`);
|
|
85271
86327
|
}
|
|
85272
86328
|
const files2 = [];
|
|
85273
|
-
for (const source of sources) files2.push(await
|
|
86329
|
+
for (const source of sources) files2.push(await bytesOf3({ context, source }));
|
|
85274
86330
|
const target = channel || await directWith({ client, to: args.lists.to ?? [] });
|
|
85275
86331
|
const ids = [];
|
|
85276
86332
|
for (const file3 of files2) {
|
|
@@ -85324,10 +86380,10 @@ async function bodyOf2({
|
|
|
85324
86380
|
flags: flags2
|
|
85325
86381
|
}) {
|
|
85326
86382
|
const body = { ...flags2.fields };
|
|
85327
|
-
const
|
|
85328
|
-
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);
|
|
85329
86385
|
if (flags2.rich) {
|
|
85330
|
-
const text2 = await
|
|
86386
|
+
const text2 = await read4(flags2.rich.source);
|
|
85331
86387
|
try {
|
|
85332
86388
|
body.rich = richBodyOf({ kind: flags2.rich.kind, text: text2 });
|
|
85333
86389
|
} catch (error62) {
|
|
@@ -85406,10 +86462,10 @@ async function feedRead({ context, args }) {
|
|
|
85406
86462
|
const itemId = args.words[2];
|
|
85407
86463
|
if (!itemId) throw new CliUsageError(USAGE9);
|
|
85408
86464
|
const { client } = await signedIn({ context, args });
|
|
85409
|
-
const
|
|
85410
|
-
printItem({ context, args, item:
|
|
85411
|
-
if (!args.flags.json &&
|
|
85412
|
-
${
|
|
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}
|
|
85413
86469
|
`);
|
|
85414
86470
|
}
|
|
85415
86471
|
async function feedInbox({ context, args }) {
|
|
@@ -85519,7 +86575,7 @@ async function textFlag({
|
|
|
85519
86575
|
}) {
|
|
85520
86576
|
const value = flagText({ args, name: name3 });
|
|
85521
86577
|
if (!value.startsWith("@")) return value;
|
|
85522
|
-
return
|
|
86578
|
+
return readFile31(resolve13(context.cwd, value.slice(1)), "utf8");
|
|
85523
86579
|
}
|
|
85524
86580
|
async function feedList({ context, args }) {
|
|
85525
86581
|
const { client } = await signedIn({ context, args });
|
|
@@ -85642,7 +86698,7 @@ async function feed({ context, args }) {
|
|
|
85642
86698
|
}
|
|
85643
86699
|
|
|
85644
86700
|
// src/services/github-commands.service.ts
|
|
85645
|
-
import { readFile as
|
|
86701
|
+
import { readFile as readFile32 } from "node:fs/promises";
|
|
85646
86702
|
|
|
85647
86703
|
// src/rules/github-signature.rules.ts
|
|
85648
86704
|
var TURN_SEPARATOR = "~";
|
|
@@ -85712,7 +86768,7 @@ var REAL_GH = "/usr/bin/gh";
|
|
|
85712
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>`.";
|
|
85713
86769
|
async function turnFileToken({ env }) {
|
|
85714
86770
|
if (!env.LAZE_TURN_FILE) return "";
|
|
85715
|
-
return
|
|
86771
|
+
return readFile32(env.LAZE_TURN_FILE, "utf8").then(
|
|
85716
86772
|
(text2) => text2.trim(),
|
|
85717
86773
|
() => ""
|
|
85718
86774
|
);
|
|
@@ -85746,7 +86802,7 @@ async function githubGh({
|
|
|
85746
86802
|
args: args.rest,
|
|
85747
86803
|
agentName: profile.name ?? "An agent",
|
|
85748
86804
|
threadUrl: threadUrlOf({ env, workspaceId: profile.workspaceId }),
|
|
85749
|
-
readBodyFile: (path) => path === "-" ? context.readStdin() :
|
|
86805
|
+
readBodyFile: (path) => path === "-" ? context.readStdin() : readFile32(path, "utf8")
|
|
85750
86806
|
});
|
|
85751
86807
|
return context.runCommand({
|
|
85752
86808
|
command: [REAL_GH, ...ghArgs],
|
|
@@ -85845,7 +86901,7 @@ async function setAgentGithub({
|
|
|
85845
86901
|
}
|
|
85846
86902
|
|
|
85847
86903
|
// src/services/history-commands.service.ts
|
|
85848
|
-
import { readFile as
|
|
86904
|
+
import { readFile as readFile33 } from "node:fs/promises";
|
|
85849
86905
|
|
|
85850
86906
|
// src/rules/history-format.rules.ts
|
|
85851
86907
|
function timeOf2(iso2) {
|
|
@@ -85941,7 +86997,7 @@ async function turnTokenOf4({ context }) {
|
|
|
85941
86997
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
85942
86998
|
if (pinned) return pinned;
|
|
85943
86999
|
if (!env.LAZE_TURN_FILE) return "";
|
|
85944
|
-
return
|
|
87000
|
+
return readFile33(env.LAZE_TURN_FILE, "utf8").then(
|
|
85945
87001
|
(text2) => text2.trim(),
|
|
85946
87002
|
() => ""
|
|
85947
87003
|
);
|
|
@@ -85992,6 +87048,100 @@ async function history2({
|
|
|
85992
87048
|
return 1;
|
|
85993
87049
|
}
|
|
85994
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
|
+
|
|
85995
87145
|
// src/services/ip-commands.service.ts
|
|
85996
87146
|
var IP_USAGE = `Usage:
|
|
85997
87147
|
laze ip [status] [--json] your dedicated IP: on or off, country, address, domains
|
|
@@ -86108,9 +87258,9 @@ async function list7({ context, args }) {
|
|
|
86108
87258
|
const answer5 = await client.get(DEDICATED_IP_REST_PATHS.all);
|
|
86109
87259
|
if (args.flags.json) return printJson7(context, answer5);
|
|
86110
87260
|
if (answer5.ips.length === 0) return context.out("No one has a dedicated IP.\n");
|
|
86111
|
-
const
|
|
87261
|
+
const money3 = (amount) => `${amount} ${answer5.currency.toUpperCase()}`;
|
|
86112
87262
|
const lines2 = answer5.ips.map(
|
|
86113
|
-
(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`
|
|
86114
87264
|
);
|
|
86115
87265
|
context.out(`Dedicated IPs:
|
|
86116
87266
|
${lines2.join("\n")}
|
|
@@ -86133,19 +87283,19 @@ async function ip({ context, args }) {
|
|
|
86133
87283
|
}
|
|
86134
87284
|
|
|
86135
87285
|
// src/services/join-commands.service.ts
|
|
86136
|
-
import { mkdir as mkdir20, readFile as
|
|
86137
|
-
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";
|
|
86138
87288
|
var DEFAULT_WAIT_SECONDS2 = 100;
|
|
86139
87289
|
var JOIN_USAGE = "Usage: laze join [--workspace <name|id|invite link>] [--for <email>] [--name <name>] [--note <text>] [--timeout <seconds>] [--project <folder>]";
|
|
86140
87290
|
function pendingPathOf({ context }) {
|
|
86141
|
-
return
|
|
87291
|
+
return join24(dirname19(context.environment.configPath), "join", "pending.json");
|
|
86142
87292
|
}
|
|
86143
87293
|
async function readPending({
|
|
86144
87294
|
context,
|
|
86145
87295
|
url: url2,
|
|
86146
87296
|
args
|
|
86147
87297
|
}) {
|
|
86148
|
-
const pending2 = await
|
|
87298
|
+
const pending2 = await readFile34(pendingPathOf({ context }), "utf8").then(
|
|
86149
87299
|
(text2) => JSON.parse(text2),
|
|
86150
87300
|
() => void 0
|
|
86151
87301
|
);
|
|
@@ -86865,8 +88015,14 @@ function withLocalTools(answer5) {
|
|
|
86865
88015
|
if (!Array.isArray(result.tools)) return answer5;
|
|
86866
88016
|
return { ...recordOf3(answer5), result: { ...result, tools: [...TOOLS, ...result.tools] } };
|
|
86867
88017
|
}
|
|
86868
|
-
function
|
|
86869
|
-
|
|
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;
|
|
86870
88026
|
const errors = idsOf(message2).map((id2) => ({
|
|
86871
88027
|
jsonrpc: "2.0",
|
|
86872
88028
|
id: id2,
|
|
@@ -86916,7 +88072,7 @@ async function answerLine({
|
|
|
86916
88072
|
}
|
|
86917
88073
|
const answer5 = await client.forward({ path: REMOTE_MCP_PATH, body: line });
|
|
86918
88074
|
if (answer5.status < 200 || answer5.status >= 300) {
|
|
86919
|
-
return
|
|
88075
|
+
return refusedLines2({ message: message2, status: answer5.status, text: answer5.text });
|
|
86920
88076
|
}
|
|
86921
88077
|
const replied = repliedTo({ request: request2 });
|
|
86922
88078
|
if (replied)
|
|
@@ -86979,14 +88135,14 @@ async function serveMcp({
|
|
|
86979
88135
|
}
|
|
86980
88136
|
|
|
86981
88137
|
// src/services/mount-files.service.ts
|
|
86982
|
-
import { mkdir as mkdir21, readFile as
|
|
88138
|
+
import { mkdir as mkdir21, readFile as readFile35, rm as rm12, writeFile as writeFile21 } from "node:fs/promises";
|
|
86983
88139
|
import { dirname as dirname20, relative as relative5, resolve as resolve14 } from "node:path";
|
|
86984
88140
|
async function textArgument({
|
|
86985
88141
|
context,
|
|
86986
88142
|
value
|
|
86987
88143
|
}) {
|
|
86988
88144
|
if (value === "-") return context.readStdin();
|
|
86989
|
-
if (value.startsWith("@")) return
|
|
88145
|
+
if (value.startsWith("@")) return readFile35(resolve14(context.cwd, value.slice(1)), "utf8");
|
|
86990
88146
|
return value;
|
|
86991
88147
|
}
|
|
86992
88148
|
function turnChannel({ context, args }) {
|
|
@@ -87269,7 +88425,7 @@ async function models({ context, args }) {
|
|
|
87269
88425
|
|
|
87270
88426
|
// src/services/monitor-commands.service.ts
|
|
87271
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>]";
|
|
87272
|
-
function
|
|
88428
|
+
function agentOf2(args) {
|
|
87273
88429
|
const agent2 = flagText({ args, name: "agent" });
|
|
87274
88430
|
return agent2 ? { agent: agent2 } : {};
|
|
87275
88431
|
}
|
|
@@ -87290,7 +88446,7 @@ async function monitorAdd({ context, args }) {
|
|
|
87290
88446
|
if (maxRuns && !/^\d+$/.test(maxRuns)) throw new CliUsageError(ADD_USAGE);
|
|
87291
88447
|
const { client } = await signedIn({ context, args });
|
|
87292
88448
|
const added = await client.post("/api/agents/monitors", {
|
|
87293
|
-
...
|
|
88449
|
+
...agentOf2(args),
|
|
87294
88450
|
name: name3,
|
|
87295
88451
|
channels: channels3,
|
|
87296
88452
|
prompt,
|
|
@@ -87326,7 +88482,7 @@ function stateRun(path, verb) {
|
|
|
87326
88482
|
if (!name3) throw new CliUsageError(`Usage: laze monitor ${verb} <name> [--agent <name>]`);
|
|
87327
88483
|
const { client } = await signedIn({ context, args });
|
|
87328
88484
|
const answer5 = await client.post(path, {
|
|
87329
|
-
...
|
|
88485
|
+
...agentOf2(args),
|
|
87330
88486
|
name: name3
|
|
87331
88487
|
});
|
|
87332
88488
|
if (args.flags.json) return context.out(`${JSON.stringify(answer5, null, 2)}
|
|
@@ -87665,8 +88821,8 @@ ${OPS_USAGE}`);
|
|
|
87665
88821
|
}
|
|
87666
88822
|
|
|
87667
88823
|
// src/services/release-watch.service.ts
|
|
87668
|
-
import { mkdir as mkdir22, readFile as
|
|
87669
|
-
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";
|
|
87670
88826
|
|
|
87671
88827
|
// src/rules/cli-update.rules.ts
|
|
87672
88828
|
var CLI_PACKAGE = "@lazehq/cli";
|
|
@@ -87813,15 +88969,15 @@ async function startedUpdate({
|
|
|
87813
88969
|
const plan2 = updatePlanOf({ script: await scriptOf(context) });
|
|
87814
88970
|
if (plan2.kind !== "install") return null;
|
|
87815
88971
|
const folder = dirname21(context.environment.configPath);
|
|
87816
|
-
const stamp =
|
|
87817
|
-
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);
|
|
87818
88974
|
const now = context.nowMs();
|
|
87819
88975
|
if (last?.server === server && now - last.atMs < RETRY_AFTER_MS) return null;
|
|
87820
88976
|
await mkdir22(folder, { recursive: true, mode: 448 });
|
|
87821
88977
|
await writeFile22(stamp, JSON.stringify({ server, atMs: now }), { mode: 384 });
|
|
87822
88978
|
context.processes.spawnDetached({
|
|
87823
88979
|
argv: [...context.program, "update"],
|
|
87824
|
-
logPath:
|
|
88980
|
+
logPath: join25(folder, "auto-update.log")
|
|
87825
88981
|
});
|
|
87826
88982
|
return { manager: plan2.manager };
|
|
87827
88983
|
}
|
|
@@ -87858,7 +89014,7 @@ function watchingRelease({
|
|
|
87858
89014
|
}
|
|
87859
89015
|
|
|
87860
89016
|
// src/services/rush-guard.service.ts
|
|
87861
|
-
import { readFile as
|
|
89017
|
+
import { readFile as readFile37, rm as rm13 } from "node:fs/promises";
|
|
87862
89018
|
var WATCH_MS3 = 2e3;
|
|
87863
89019
|
var RETRY_MS2 = 3e4;
|
|
87864
89020
|
async function guardRound(guard) {
|
|
@@ -87901,7 +89057,7 @@ async function rushWakeHook({ context, args }) {
|
|
|
87901
89057
|
while (context.processes.alive(claudePid)) await context.sleep(WATCH_MS3);
|
|
87902
89058
|
const { client, name: name3 } = await signedIn({ context, args });
|
|
87903
89059
|
const noted = statePathOf({ context, kind: "sessions", profile: String(claudePid) });
|
|
87904
|
-
const note = await
|
|
89060
|
+
const note = await readFile37(noted, "utf8").then(
|
|
87905
89061
|
(text2) => JSON.parse(text2),
|
|
87906
89062
|
() => void 0
|
|
87907
89063
|
);
|
|
@@ -87914,6 +89070,12 @@ async function rushWakeHook({ context, args }) {
|
|
|
87914
89070
|
try {
|
|
87915
89071
|
while (context.nowMs() < deadline) {
|
|
87916
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
|
+
}
|
|
87917
89079
|
context.err(`laze: the rush guard will try again: ${String(error62)}
|
|
87918
89080
|
`);
|
|
87919
89081
|
return "failed";
|
|
@@ -88070,8 +89232,8 @@ async function schedule({ context, args }) {
|
|
|
88070
89232
|
}
|
|
88071
89233
|
|
|
88072
89234
|
// src/services/skill-commands.service.ts
|
|
88073
|
-
import { readdir as
|
|
88074
|
-
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";
|
|
88075
89237
|
var USAGE15 = `Usage:
|
|
88076
89238
|
laze skill list [--agent <agentId>]
|
|
88077
89239
|
laze skill install <catalogue-id> [--as <name>] [--agent <agentId>]
|
|
@@ -88088,12 +89250,12 @@ var USAGE15 = `Usage:
|
|
|
88088
89250
|
--agent names the agent with a person's key; an agent's key works on its own skills.
|
|
88089
89251
|
With a person's key, list without --agent shows every agent's skills.`;
|
|
88090
89252
|
async function folderFiles({ root }) {
|
|
88091
|
-
const entries = await
|
|
89253
|
+
const entries = await readdir8(root, { recursive: true, withFileTypes: true });
|
|
88092
89254
|
const files2 = [];
|
|
88093
89255
|
for (const entry of entries) {
|
|
88094
89256
|
if (!entry.isFile()) continue;
|
|
88095
|
-
const full =
|
|
88096
|
-
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") });
|
|
88097
89259
|
}
|
|
88098
89260
|
return files2.toSorted((a, b) => a.path.localeCompare(b.path));
|
|
88099
89261
|
}
|
|
@@ -88191,7 +89353,7 @@ async function skillUpdate({ context, args }) {
|
|
|
88191
89353
|
if (!name3 || !newName && description === void 0 && !skillMdFile) {
|
|
88192
89354
|
throw new CliUsageError(USAGE15);
|
|
88193
89355
|
}
|
|
88194
|
-
const skillMd = skillMdFile ? await
|
|
89356
|
+
const skillMd = skillMdFile ? await readFile38(resolve16(context.cwd, skillMdFile), "utf8") : void 0;
|
|
88195
89357
|
const { client } = await signedIn({ context, args });
|
|
88196
89358
|
const updated = await client.post("/api/skills/update", {
|
|
88197
89359
|
name: name3,
|
|
@@ -88237,7 +89399,7 @@ async function skill({ context, args }) {
|
|
|
88237
89399
|
}
|
|
88238
89400
|
|
|
88239
89401
|
// src/services/slack-commands.service.ts
|
|
88240
|
-
import { readFile as
|
|
89402
|
+
import { readFile as readFile39 } from "node:fs/promises";
|
|
88241
89403
|
import { resolve as resolve17 } from "node:path";
|
|
88242
89404
|
var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
|
|
88243
89405
|
laze slack overview connected Slack workspaces, mirrors, your link
|
|
@@ -88285,7 +89447,7 @@ async function secretLines({ context, args }) {
|
|
|
88285
89447
|
throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
|
|
88286
89448
|
}
|
|
88287
89449
|
const file3 = flagText({ args, name: "from-file" });
|
|
88288
|
-
const text2 = file3 ? await
|
|
89450
|
+
const text2 = file3 ? await readFile39(resolve17(context.cwd, file3), "utf8") : await context.readStdin();
|
|
88289
89451
|
return text2.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
88290
89452
|
}
|
|
88291
89453
|
async function secretsOf2({
|
|
@@ -88516,14 +89678,14 @@ function moveBody(args) {
|
|
|
88516
89678
|
const name3 = flagText({ args, name: "name" });
|
|
88517
89679
|
if (ids.length === 0 || name3 && ids.length > 1) throw new CliUsageError(SLACK_USAGE);
|
|
88518
89680
|
const farewell = flagText({ args, name: "farewell" });
|
|
88519
|
-
const
|
|
89681
|
+
const invite4 = args.lists.invite ?? [];
|
|
88520
89682
|
return {
|
|
88521
89683
|
teamId: wordAt8(args, 2),
|
|
88522
89684
|
channels: ids.map((slackChannelId) => ({
|
|
88523
89685
|
slackChannelId,
|
|
88524
89686
|
...name3 && { name: name3 },
|
|
88525
89687
|
...farewell && { farewell },
|
|
88526
|
-
invite:
|
|
89688
|
+
invite: invite4
|
|
88527
89689
|
}))
|
|
88528
89690
|
};
|
|
88529
89691
|
}
|
|
@@ -88589,7 +89751,7 @@ async function slack({
|
|
|
88589
89751
|
}
|
|
88590
89752
|
|
|
88591
89753
|
// src/services/sso-commands.service.ts
|
|
88592
|
-
import { readFile as
|
|
89754
|
+
import { readFile as readFile40 } from "node:fs/promises";
|
|
88593
89755
|
var SSO_USAGE = `Usage:
|
|
88594
89756
|
laze sso domains claimed domains and how each signs in (admins)
|
|
88595
89757
|
laze sso claim <domain> the TXT record that proves the domain
|
|
@@ -88676,7 +89838,7 @@ function refuseSecretFlags({ args }) {
|
|
|
88676
89838
|
}
|
|
88677
89839
|
async function clientSecretOf({ context, args }) {
|
|
88678
89840
|
const file3 = flagText({ args, name: "from-file" });
|
|
88679
|
-
const text2 = file3 ? await
|
|
89841
|
+
const text2 = file3 ? await readFile40(file3, "utf8") : await context.readStdin();
|
|
88680
89842
|
const secret = text2.trim();
|
|
88681
89843
|
if (!secret) throw new CliUsageError("No client secret: pipe it on stdin or use --from-file.");
|
|
88682
89844
|
return secret;
|
|
@@ -88935,8 +90097,8 @@ async function releaseAgeSettingsOf({
|
|
|
88935
90097
|
manager
|
|
88936
90098
|
}) {
|
|
88937
90099
|
const settings3 = [];
|
|
88938
|
-
for (const { setting, read:
|
|
88939
|
-
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 }) ?? "" });
|
|
88940
90102
|
if (value) settings3.push(`${setting}=${value}`);
|
|
88941
90103
|
}
|
|
88942
90104
|
return settings3;
|
|
@@ -89008,8 +90170,8 @@ async function update2({
|
|
|
89008
90170
|
}
|
|
89009
90171
|
|
|
89010
90172
|
// src/services/vault-env-commands.service.ts
|
|
89011
|
-
import { readFile as
|
|
89012
|
-
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";
|
|
89013
90175
|
|
|
89014
90176
|
// src/rules/vault-manifest.rules.ts
|
|
89015
90177
|
var VARIABLE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
@@ -89279,15 +90441,15 @@ async function valuesOf({
|
|
|
89279
90441
|
return { exitCode: refused };
|
|
89280
90442
|
}
|
|
89281
90443
|
const opened = /* @__PURE__ */ new Map();
|
|
89282
|
-
let
|
|
90444
|
+
let keep2 = false;
|
|
89283
90445
|
for (const [key, release2] of settled2) {
|
|
89284
90446
|
if (release2.outcome !== "allow") continue;
|
|
89285
90447
|
opened.set(key, await envOf({ release: release2, run: run4 }));
|
|
89286
|
-
if (leaseHolds({ release: release2, nowMs: context.nowMs() }))
|
|
90448
|
+
if (leaseHolds({ release: release2, nowMs: context.nowMs() })) keep2 = true;
|
|
89287
90449
|
if (release2.message) context.err(`${release2.message}
|
|
89288
90450
|
`);
|
|
89289
90451
|
}
|
|
89290
|
-
if (!
|
|
90452
|
+
if (!keep2) await rm14(keyPath, { force: true });
|
|
89291
90453
|
const released = /* @__PURE__ */ new Map();
|
|
89292
90454
|
for (const entry of entries) {
|
|
89293
90455
|
const fields = opened.get(keyOf(entry));
|
|
@@ -89340,7 +90502,7 @@ function refusedReason({
|
|
|
89340
90502
|
return VAULT_EXIT_BAD_REASON;
|
|
89341
90503
|
}
|
|
89342
90504
|
async function isFile(path) {
|
|
89343
|
-
return
|
|
90505
|
+
return stat7(path).then(
|
|
89344
90506
|
(found) => found.isFile(),
|
|
89345
90507
|
() => false
|
|
89346
90508
|
);
|
|
@@ -89354,7 +90516,7 @@ async function manifestPathOf({
|
|
|
89354
90516
|
const environment = flagText({ args, name: "env" });
|
|
89355
90517
|
const file3 = environment ? `.env.${environment}.vault` : ".env.vault";
|
|
89356
90518
|
for (let dir = resolve18(context.cwd); ; dir = dirname22(dir)) {
|
|
89357
|
-
if (await isFile(
|
|
90519
|
+
if (await isFile(join27(dir, file3))) return join27(dir, file3);
|
|
89358
90520
|
if (dirname22(dir) === dir) break;
|
|
89359
90521
|
}
|
|
89360
90522
|
throw new CliUsageError(`laze vault: no ${file3} here or in a parent folder
|
|
@@ -89365,7 +90527,7 @@ async function manifestOf({
|
|
|
89365
90527
|
args
|
|
89366
90528
|
}) {
|
|
89367
90529
|
const file3 = await manifestPathOf({ context, args });
|
|
89368
|
-
const text2 = await
|
|
90530
|
+
const text2 = await readFile41(file3, "utf8").catch(() => {
|
|
89369
90531
|
throw new CliUsageError(`laze vault: cannot read ${file3}`);
|
|
89370
90532
|
});
|
|
89371
90533
|
return { file: file3, lines: parseManifest({ text: text2, file: file3 }) };
|
|
@@ -89596,7 +90758,7 @@ async function vaultScrub({ context, args }) {
|
|
|
89596
90758
|
}
|
|
89597
90759
|
|
|
89598
90760
|
// src/services/whatsapp-business-commands.service.ts
|
|
89599
|
-
import { readFile as
|
|
90761
|
+
import { readFile as readFile42 } from "node:fs/promises";
|
|
89600
90762
|
import { resolve as resolve19 } from "node:path";
|
|
89601
90763
|
|
|
89602
90764
|
// ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
|
|
@@ -89644,8 +90806,8 @@ var WHATSAPP_BUSINESS_REST_PATHS = {
|
|
|
89644
90806
|
var WHATSAPP_BUSINESS_TEXT_MAX = 4096;
|
|
89645
90807
|
var WHATSAPP_BUSINESS_LIMIT_MAX = 200;
|
|
89646
90808
|
var WHATSAPP_BUSINESS_STATUS_WAIT_MAX_SECONDS = 50;
|
|
89647
|
-
var
|
|
89648
|
-
var workspaceInput6 = external_exports.object({ workspaceId:
|
|
90809
|
+
var workspaceIdSchema23 = external_exports.string().min(1).max(64);
|
|
90810
|
+
var workspaceInput6 = external_exports.object({ workspaceId: workspaceIdSchema23 });
|
|
89649
90811
|
var digits = (what) => external_exports.string().trim().regex(/^\d{5,30}$/, `${what} is the number Meta shows, digits only`);
|
|
89650
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");
|
|
89651
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");
|
|
@@ -89679,7 +90841,7 @@ var statusDefinition = external_exports.object({
|
|
|
89679
90841
|
});
|
|
89680
90842
|
var whatsappBusinessStatusSchema = statusDefinition;
|
|
89681
90843
|
var connectDefinition = external_exports.object({
|
|
89682
|
-
workspaceId:
|
|
90844
|
+
workspaceId: workspaceIdSchema23,
|
|
89683
90845
|
appId: digits("The app id"),
|
|
89684
90846
|
wabaId: digits("The WhatsApp Business Account id"),
|
|
89685
90847
|
phoneNumberId: digits("The phone number id"),
|
|
@@ -89702,7 +90864,7 @@ var webhookDefinition = external_exports.object({
|
|
|
89702
90864
|
});
|
|
89703
90865
|
var whatsappBusinessWebhookSchema = webhookDefinition;
|
|
89704
90866
|
var settingsDefinition3 = external_exports.object({
|
|
89705
|
-
workspaceId:
|
|
90867
|
+
workspaceId: workspaceIdSchema23,
|
|
89706
90868
|
/** The agent that answers; null for none. Left out keeps the current one. */
|
|
89707
90869
|
agentId: external_exports.string().min(1).max(64).nullable().optional(),
|
|
89708
90870
|
replyMode: whatsappBusinessReplyModeSchema.optional()
|
|
@@ -89722,7 +90884,7 @@ var whatsappBusinessConversationSchema = conversationDefinition;
|
|
|
89722
90884
|
var limitSchema2 = external_exports.number().int().min(1).max(WHATSAPP_BUSINESS_LIMIT_MAX);
|
|
89723
90885
|
var contactRefSchema = external_exports.string().trim().min(1).max(64);
|
|
89724
90886
|
var conversationsInputDefinition = external_exports.object({
|
|
89725
|
-
workspaceId:
|
|
90887
|
+
workspaceId: workspaceIdSchema23,
|
|
89726
90888
|
limit: limitSchema2.optional()
|
|
89727
90889
|
});
|
|
89728
90890
|
var whatsappBusinessConversationsInputSchema = conversationsInputDefinition;
|
|
@@ -89748,7 +90910,7 @@ var messageDefinition2 = external_exports.object({
|
|
|
89748
90910
|
template: external_exports.string().nullable()
|
|
89749
90911
|
});
|
|
89750
90912
|
var readInputDefinition2 = external_exports.object({
|
|
89751
|
-
workspaceId:
|
|
90913
|
+
workspaceId: workspaceIdSchema23,
|
|
89752
90914
|
contact: contactRefSchema,
|
|
89753
90915
|
limit: limitSchema2.optional()
|
|
89754
90916
|
});
|
|
@@ -89757,12 +90919,12 @@ var readDefinition = external_exports.object({
|
|
|
89757
90919
|
messages: external_exports.array(messageDefinition2)
|
|
89758
90920
|
});
|
|
89759
90921
|
var sendInputDefinition2 = external_exports.object({
|
|
89760
|
-
workspaceId:
|
|
90922
|
+
workspaceId: workspaceIdSchema23,
|
|
89761
90923
|
to: contactRefSchema,
|
|
89762
90924
|
text: external_exports.string().trim().min(1).max(WHATSAPP_BUSINESS_TEXT_MAX)
|
|
89763
90925
|
});
|
|
89764
90926
|
var sendTemplateInputDefinition = external_exports.object({
|
|
89765
|
-
workspaceId:
|
|
90927
|
+
workspaceId: workspaceIdSchema23,
|
|
89766
90928
|
to: contactRefSchema,
|
|
89767
90929
|
template: external_exports.string().trim().min(1).max(512),
|
|
89768
90930
|
/** The template's language code; the only approved one when left out. */
|
|
@@ -89789,7 +90951,7 @@ function whatsappBusinessSendSettled({
|
|
|
89789
90951
|
return state !== "waiting" && state !== "sending";
|
|
89790
90952
|
}
|
|
89791
90953
|
var sendStatusInputDefinition2 = external_exports.object({
|
|
89792
|
-
workspaceId:
|
|
90954
|
+
workspaceId: workspaceIdSchema23,
|
|
89793
90955
|
sendId: external_exports.string().min(1).max(64),
|
|
89794
90956
|
waitSeconds: external_exports.number().int().min(0).max(WHATSAPP_BUSINESS_STATUS_WAIT_MAX_SECONDS).default(0)
|
|
89795
90957
|
});
|
|
@@ -89839,7 +91001,7 @@ var restSendStatusDefinition2 = sendStatusInputDefinition2.omit({ workspaceId: t
|
|
|
89839
91001
|
var restSettingsDefinition = settingsDefinition3.omit({ workspaceId: true });
|
|
89840
91002
|
var restEmptyDefinition = external_exports.object({});
|
|
89841
91003
|
var WhatsappBusinessApi = moduleApi()("whatsapp-business");
|
|
89842
|
-
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();
|
|
89843
91005
|
|
|
89844
91006
|
// ../../modules/whatsapp-business/contract/src/whatsapp-business.config.ts
|
|
89845
91007
|
var whatsappBusinessConfig = Config.define((c) => ({
|
|
@@ -90016,7 +91178,7 @@ async function secretsOf3({ context, args }) {
|
|
|
90016
91178
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
90017
91179
|
if (fromConnection) return { fromConnection };
|
|
90018
91180
|
const file3 = flagText({ args, name: "from-file" });
|
|
90019
|
-
const text2 = file3 ? await
|
|
91181
|
+
const text2 = file3 ? await readFile42(resolve19(context.cwd, file3), "utf8") : await context.readStdin();
|
|
90020
91182
|
const lines2 = text2.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
90021
91183
|
if (lines2.length !== 2) {
|
|
90022
91184
|
throw new CliUsageError(
|
|
@@ -90049,7 +91211,7 @@ var conversations = async ({ context, args, client }) => {
|
|
|
90049
91211
|
`);
|
|
90050
91212
|
}
|
|
90051
91213
|
};
|
|
90052
|
-
var
|
|
91214
|
+
var read2 = async ({ context, args, client }) => {
|
|
90053
91215
|
const answer5 = await client.post(WHATSAPP_BUSINESS_REST_PATHS.read, {
|
|
90054
91216
|
contact: wordAt9(args, 2),
|
|
90055
91217
|
...limitOf4(args)
|
|
@@ -90193,7 +91355,7 @@ var disconnect5 = async ({ context, args, client }) => {
|
|
|
90193
91355
|
var RUNS6 = {
|
|
90194
91356
|
status: status7,
|
|
90195
91357
|
conversations,
|
|
90196
|
-
read,
|
|
91358
|
+
read: read2,
|
|
90197
91359
|
send: send3,
|
|
90198
91360
|
"send-template": sendTemplate,
|
|
90199
91361
|
"send-status": sendStatus,
|
|
@@ -90268,7 +91430,7 @@ async function pairing({ context, args }) {
|
|
|
90268
91430
|
});
|
|
90269
91431
|
await report2({ context, args, pairing: answer5 });
|
|
90270
91432
|
}
|
|
90271
|
-
async function
|
|
91433
|
+
async function cancel3({ context, args }) {
|
|
90272
91434
|
const pairingId = wordAt10({ args, at: 2 });
|
|
90273
91435
|
const client = await computeClient({ context, args });
|
|
90274
91436
|
const answer5 = await client.post(COMPUTE_WHATSAPP_REST_PATHS.cancelPairing, {
|
|
@@ -90288,7 +91450,7 @@ async function unpair({ context, args }) {
|
|
|
90288
91450
|
context.out(`WhatsApp is unlinked from ${answer5.name}.
|
|
90289
91451
|
`);
|
|
90290
91452
|
}
|
|
90291
|
-
var COMMANDS2 = { pair, pairing, cancel:
|
|
91453
|
+
var COMMANDS2 = { pair, pairing, cancel: cancel3, unpair };
|
|
90292
91454
|
function whatsappPairingCommand(name3) {
|
|
90293
91455
|
return name3 && Object.hasOwn(COMMANDS2, name3) ? COMMANDS2[name3] : void 0;
|
|
90294
91456
|
}
|
|
@@ -90342,7 +91504,7 @@ async function chats({ context, args }) {
|
|
|
90342
91504
|
);
|
|
90343
91505
|
}
|
|
90344
91506
|
}
|
|
90345
|
-
async function
|
|
91507
|
+
async function read3({ context, args }) {
|
|
90346
91508
|
const client = await computeClient({ context, args });
|
|
90347
91509
|
const answer5 = await client.post(
|
|
90348
91510
|
PATHS3.read,
|
|
@@ -90407,7 +91569,7 @@ async function whatsapp({
|
|
|
90407
91569
|
}) {
|
|
90408
91570
|
const command = args.words[1];
|
|
90409
91571
|
if (command === "chats") return chats({ context, args });
|
|
90410
|
-
if (command === "read") return
|
|
91572
|
+
if (command === "read") return read3({ context, args });
|
|
90411
91573
|
if (command === "send") return send4({ context, args });
|
|
90412
91574
|
if (command === "status") return status8({ context, args });
|
|
90413
91575
|
const linking = whatsappPairingCommand(command);
|
|
@@ -90639,6 +91801,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
90639
91801
|
laze workspace leave leave this workspace
|
|
90640
91802
|
laze workspace delete --confirm <name> | cancel-deletion schedule its deletion, or take it back (Owners)
|
|
90641
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
|
|
90642
91805
|
laze members invite <email> [--role owner|admin|member|guest] invite someone (admins)
|
|
90643
91806
|
laze members invites | revoke-invite <email|id> invitations waiting, or take one back (admins)
|
|
90644
91807
|
laze members invite-link <email|id> a fresh link for an invitation, shown once (admins)
|
|
@@ -90750,6 +91913,12 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
90750
91913
|
laze agent retry <agent> --channel <id> --message <id> Try again on its failed turn on that message
|
|
90751
91914
|
laze agent invite [--name <name>] [--channel <id>] a one-time link that connects a new agent;
|
|
90752
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
|
|
90753
91922
|
laze agent faces every agent's sloth seed or picture
|
|
90754
91923
|
laze adopt codex [--thread <id>] answer Laze messages in a Codex thread
|
|
90755
91924
|
laze adopt codex --status | --stop the background adopt that laze agent link started
|
|
@@ -90852,6 +92021,7 @@ var COMMANDS3 = {
|
|
|
90852
92021
|
workspaces,
|
|
90853
92022
|
workspace,
|
|
90854
92023
|
members: members2,
|
|
92024
|
+
invite: invite3,
|
|
90855
92025
|
update: update2,
|
|
90856
92026
|
"channels list": listChannels,
|
|
90857
92027
|
"channel set": setChannelLevel,
|
|
@@ -91015,6 +92185,7 @@ var COMMANDS3 = {
|
|
|
91015
92185
|
"agent retry": retryAgentTurn,
|
|
91016
92186
|
"agent disconnect": disconnectAgent,
|
|
91017
92187
|
"agent invite": inviteAgent,
|
|
92188
|
+
"agent migrate": agentMigrate,
|
|
91018
92189
|
"mcp gateway": serveMcpGateway,
|
|
91019
92190
|
mcp: (input2) => serveMcp({ ...input2, runCommandLine: runCli })
|
|
91020
92191
|
};
|
|
@@ -91058,7 +92229,8 @@ async function runCli({
|
|
|
91058
92229
|
[browser, `${BROWSER_USAGE}
|
|
91059
92230
|
`],
|
|
91060
92231
|
[external, `${EXTERNAL_USAGE}
|
|
91061
|
-
`]
|
|
92232
|
+
`],
|
|
92233
|
+
[agentMigrate, MIGRATE_USAGE]
|
|
91062
92234
|
]);
|
|
91063
92235
|
if (command && args.flags.help && ownHelp.has(command)) {
|
|
91064
92236
|
context.out(ownHelp.get(command) ?? HELP);
|
|
@@ -91072,19 +92244,26 @@ async function runCli({
|
|
|
91072
92244
|
const quiet = args.words[0] === "hook";
|
|
91073
92245
|
return await command({ context: watchingRelease({ context, quiet }), args }) ?? 0;
|
|
91074
92246
|
} catch (error62) {
|
|
91075
|
-
|
|
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}
|
|
91076
92254
|
`);
|
|
91077
|
-
|
|
92255
|
+
else if (error62 instanceof CliUsageError) context.err(`${error62.message}
|
|
91078
92256
|
`);
|
|
91079
|
-
|
|
91080
|
-
|
|
91081
|
-
|
|
92257
|
+
else if (error62 instanceof LazeApiError) context.err(`laze: ${error62.message} (${error62.code})
|
|
92258
|
+
`);
|
|
92259
|
+
else throw error62;
|
|
92260
|
+
return 1;
|
|
91082
92261
|
}
|
|
91083
92262
|
|
|
91084
92263
|
// src/services/processes.service.ts
|
|
91085
92264
|
import { execFile as execFile2, spawn as spawn4 } from "node:child_process";
|
|
91086
92265
|
import { mkdirSync, openSync } from "node:fs";
|
|
91087
|
-
import { readFile as
|
|
92266
|
+
import { readFile as readFile43, readlink } from "node:fs/promises";
|
|
91088
92267
|
import { dirname as dirname23 } from "node:path";
|
|
91089
92268
|
import { promisify as promisify2 } from "node:util";
|
|
91090
92269
|
var run3 = promisify2(execFile2);
|
|
@@ -91098,15 +92277,15 @@ function alive(pid) {
|
|
|
91098
92277
|
}
|
|
91099
92278
|
}
|
|
91100
92279
|
async function argsOf(pid) {
|
|
91101
|
-
const raw = await
|
|
92280
|
+
const raw = await readFile43(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
|
|
91102
92281
|
if (raw) return raw.split("\0").filter(Boolean);
|
|
91103
92282
|
const listed = await run3("ps", ["-o", "args=", "-p", String(pid)]).catch(() => void 0);
|
|
91104
92283
|
const line = listed?.stdout.trim();
|
|
91105
92284
|
return line ? line.split(/\s+/) : void 0;
|
|
91106
92285
|
}
|
|
91107
92286
|
async function parentOf(pid) {
|
|
91108
|
-
const
|
|
91109
|
-
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;
|
|
91110
92289
|
if (fromStat > 0) return fromStat;
|
|
91111
92290
|
const listed = await run3("ps", ["-o", "ppid=", "-p", String(pid)]).catch(() => void 0);
|
|
91112
92291
|
const parent = Number(listed?.stdout.trim());
|