dsh-lark-bot 0.19.14 → 0.19.15
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/cli.js +152 -65
- package/dist/cli.js.map +1 -1
- package/dist/plugin.js +152 -65
- package/dist/plugin.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6190,7 +6190,7 @@ async function runDoctor(options) {
|
|
|
6190
6190
|
|
|
6191
6191
|
// src/cli/commands/run.ts
|
|
6192
6192
|
import { mkdir as mkdir22 } from "fs/promises";
|
|
6193
|
-
import { randomUUID as
|
|
6193
|
+
import { randomUUID as randomUUID16 } from "crypto";
|
|
6194
6194
|
import { join as join27 } from "path";
|
|
6195
6195
|
|
|
6196
6196
|
// src/bot/active-runs.ts
|
|
@@ -11229,6 +11229,9 @@ function abortError() {
|
|
|
11229
11229
|
return error;
|
|
11230
11230
|
}
|
|
11231
11231
|
|
|
11232
|
+
// src/onboard/sink-qr-providers.ts
|
|
11233
|
+
import { createDecipheriv, randomBytes as randomBytes2, randomUUID as randomUUID8 } from "crypto";
|
|
11234
|
+
|
|
11232
11235
|
// src/notify/sinks/text.ts
|
|
11233
11236
|
function renderSinkText(message) {
|
|
11234
11237
|
const zhLine = `${message.title.zh}\uFF08scope \`${message.scope}\`\uFF09${message.detail ? `\uFF1A${message.detail}` : ""}`;
|
|
@@ -11310,63 +11313,131 @@ function splitDestination(value) {
|
|
|
11310
11313
|
}
|
|
11311
11314
|
|
|
11312
11315
|
// src/onboard/sink-qr-providers.ts
|
|
11313
|
-
var
|
|
11314
|
-
|
|
11315
|
-
|
|
11316
|
+
var API_HEADERS = { "content-type": "application/json", accept: "application/json" };
|
|
11317
|
+
var BIND_STATUS = { NONE: 0, PENDING: 1, COMPLETED: 2, EXPIRED: 3 };
|
|
11318
|
+
var QqQrProvider = class {
|
|
11319
|
+
constructor(portalHost = process.env.DSH_LARK_QQ_PORTAL_HOST ?? "q.qq.com", fetchImpl = fetch, genKey = () => randomBytes2(32).toString("base64")) {
|
|
11320
|
+
this.portalHost = portalHost;
|
|
11316
11321
|
this.fetchImpl = fetchImpl;
|
|
11322
|
+
this.genKey = genKey;
|
|
11317
11323
|
}
|
|
11318
|
-
|
|
11324
|
+
portalHost;
|
|
11319
11325
|
fetchImpl;
|
|
11320
|
-
|
|
11326
|
+
genKey;
|
|
11327
|
+
type = "qq";
|
|
11328
|
+
sessions = /* @__PURE__ */ new Map();
|
|
11321
11329
|
async begin(_options) {
|
|
11322
|
-
const
|
|
11330
|
+
const aesKey = this.genKey();
|
|
11331
|
+
const response = await this.fetchImpl(`https://${this.portalHost}/lite/create_bind_task`, {
|
|
11332
|
+
method: "POST",
|
|
11333
|
+
headers: API_HEADERS,
|
|
11334
|
+
body: JSON.stringify({ key: aesKey })
|
|
11335
|
+
});
|
|
11323
11336
|
const payload = await response.json().catch(() => ({}));
|
|
11324
|
-
const
|
|
11325
|
-
if (!response.ok || !
|
|
11326
|
-
throw new Error(payload.msg ??
|
|
11337
|
+
const taskId = payload.data?.task_id;
|
|
11338
|
+
if (!response.ok || !taskId || payload.retcode !== void 0 && payload.retcode !== 0) {
|
|
11339
|
+
throw new Error(`qq create_bind_task failed: ${payload.msg ?? ""} (http ${response.status})`);
|
|
11327
11340
|
}
|
|
11328
|
-
|
|
11341
|
+
const sessionId = randomUUID8();
|
|
11342
|
+
this.sessions.set(sessionId, { taskId, aesKey });
|
|
11343
|
+
const qrUrl = `https://q.qq.com/qqbot/openclaw/connect.html?task_id=${encodeURIComponent(taskId)}&_wv=2&source=dsh-lark-bot`;
|
|
11344
|
+
return { providerType: this.type, sessionId, qrUrl, expireIn: 600 };
|
|
11329
11345
|
}
|
|
11330
11346
|
async poll(sessionId, _signal) {
|
|
11331
|
-
const
|
|
11332
|
-
|
|
11333
|
-
|
|
11334
|
-
|
|
11335
|
-
|
|
11336
|
-
|
|
11347
|
+
const state = this.sessions.get(sessionId);
|
|
11348
|
+
if (!state) return { phase: "failed", error: "unknown session" };
|
|
11349
|
+
let data = {};
|
|
11350
|
+
try {
|
|
11351
|
+
const response = await this.fetchImpl(`https://${this.portalHost}/lite/poll_bind_result`, {
|
|
11352
|
+
method: "POST",
|
|
11353
|
+
headers: API_HEADERS,
|
|
11354
|
+
body: JSON.stringify({ task_id: state.taskId })
|
|
11355
|
+
});
|
|
11356
|
+
const payload = await response.json();
|
|
11357
|
+
if (!response.ok || payload.retcode !== void 0 && payload.retcode !== 0) return { phase: "pending" };
|
|
11358
|
+
data = payload.data ?? {};
|
|
11359
|
+
} catch {
|
|
11360
|
+
return { phase: "pending" };
|
|
11361
|
+
}
|
|
11362
|
+
const status = data.status ?? BIND_STATUS.NONE;
|
|
11363
|
+
if (status === BIND_STATUS.COMPLETED && data.bot_appid && data.bot_encrypt_secret) {
|
|
11364
|
+
let clientSecret;
|
|
11365
|
+
try {
|
|
11366
|
+
clientSecret = decryptSecret(data.bot_encrypt_secret, state.aesKey);
|
|
11367
|
+
} catch (error) {
|
|
11368
|
+
this.sessions.delete(sessionId);
|
|
11369
|
+
return { phase: "failed", error: `decrypt failed: ${error instanceof Error ? error.message : String(error)}` };
|
|
11370
|
+
}
|
|
11371
|
+
const target = data.user_openid ? `user:${data.user_openid}` : "";
|
|
11372
|
+
this.sessions.delete(sessionId);
|
|
11373
|
+
return {
|
|
11374
|
+
phase: "completed",
|
|
11375
|
+
channel: {
|
|
11376
|
+
id: "",
|
|
11377
|
+
type: "qq",
|
|
11378
|
+
label: "QQ",
|
|
11379
|
+
destination: target,
|
|
11380
|
+
secret: `${data.bot_appid}:${clientSecret}`
|
|
11381
|
+
}
|
|
11382
|
+
};
|
|
11383
|
+
}
|
|
11384
|
+
if (status === BIND_STATUS.EXPIRED) {
|
|
11385
|
+
this.sessions.delete(sessionId);
|
|
11386
|
+
return { phase: "expired" };
|
|
11387
|
+
}
|
|
11337
11388
|
return { phase: "pending" };
|
|
11338
11389
|
}
|
|
11339
11390
|
};
|
|
11340
|
-
var
|
|
11341
|
-
constructor(
|
|
11342
|
-
this.
|
|
11391
|
+
var WeChatQrProvider = class {
|
|
11392
|
+
constructor(baseUrl = process.env.DSH_LARK_WECHAT_ILINK_URL ?? "https://ilinkai.weixin.qq.com", fetchImpl = fetch) {
|
|
11393
|
+
this.baseUrl = baseUrl;
|
|
11343
11394
|
this.fetchImpl = fetchImpl;
|
|
11344
11395
|
}
|
|
11345
|
-
|
|
11396
|
+
baseUrl;
|
|
11346
11397
|
fetchImpl;
|
|
11347
|
-
type = "
|
|
11398
|
+
type = "wechat";
|
|
11399
|
+
sessions = /* @__PURE__ */ new Map();
|
|
11348
11400
|
async begin(_options) {
|
|
11349
|
-
const response = await this.fetchImpl(
|
|
11350
|
-
method: "
|
|
11351
|
-
headers: { "content-type": "application/json" },
|
|
11352
|
-
body: JSON.stringify({})
|
|
11401
|
+
const response = await this.fetchImpl(`${this.baseUrl}/ilink/bot/get_bot_qrcode?bot_type=3`, {
|
|
11402
|
+
method: "GET"
|
|
11353
11403
|
});
|
|
11354
11404
|
const payload = await response.json().catch(() => ({}));
|
|
11355
|
-
const
|
|
11356
|
-
if (!response.ok || !
|
|
11357
|
-
throw new Error(`
|
|
11405
|
+
const qrcode2 = payload.qrcode ?? payload.url ?? "";
|
|
11406
|
+
if (!response.ok || !qrcode2) {
|
|
11407
|
+
throw new Error(payload.msg ?? `wechat get_bot_qrcode failed: http ${response.status}`);
|
|
11358
11408
|
}
|
|
11359
|
-
const
|
|
11360
|
-
|
|
11409
|
+
const sessionId = randomUUID8();
|
|
11410
|
+
this.sessions.set(sessionId, { qrcode: qrcode2 });
|
|
11411
|
+
return { providerType: this.type, sessionId, qrUrl: qrcode2, expireIn: 180 };
|
|
11361
11412
|
}
|
|
11362
11413
|
async poll(sessionId, _signal) {
|
|
11363
|
-
const
|
|
11364
|
-
|
|
11365
|
-
|
|
11366
|
-
|
|
11367
|
-
|
|
11368
|
-
|
|
11369
|
-
|
|
11414
|
+
const state = this.sessions.get(sessionId);
|
|
11415
|
+
if (!state) return { phase: "failed", error: "unknown session" };
|
|
11416
|
+
const statusUrl = `${this.baseUrl}/ilink/bot/get_qrcode_status?qrcode=${encodeURIComponent(state.qrcode)}`;
|
|
11417
|
+
try {
|
|
11418
|
+
const response = await this.fetchImpl(statusUrl, {
|
|
11419
|
+
method: "GET",
|
|
11420
|
+
headers: { "iLink-App-Id": "bot", "iLink-App-ClientVersion": "131072" }
|
|
11421
|
+
});
|
|
11422
|
+
const payload = await response.json().catch(() => ({}));
|
|
11423
|
+
const status = String(payload.status ?? "wait").toLowerCase();
|
|
11424
|
+
if (status === "confirmed" || status === "success" || status === "scanned" || status === "2") {
|
|
11425
|
+
const token = payload.token ?? payload.access_token ?? "";
|
|
11426
|
+
const userId = payload.openid ?? payload.user_id ?? payload.to_user_id ?? "";
|
|
11427
|
+
this.sessions.delete(sessionId);
|
|
11428
|
+
return {
|
|
11429
|
+
phase: "completed",
|
|
11430
|
+
channel: { id: "", type: "wechat", label: "\u5FAE\u4FE1", destination: userId ? `${userId}|` : "", secret: token }
|
|
11431
|
+
};
|
|
11432
|
+
}
|
|
11433
|
+
if (status === "expired") {
|
|
11434
|
+
this.sessions.delete(sessionId);
|
|
11435
|
+
return { phase: "expired" };
|
|
11436
|
+
}
|
|
11437
|
+
return { phase: "pending" };
|
|
11438
|
+
} catch {
|
|
11439
|
+
return { phase: "pending" };
|
|
11440
|
+
}
|
|
11370
11441
|
}
|
|
11371
11442
|
};
|
|
11372
11443
|
function buildSinkQrProviders() {
|
|
@@ -11378,7 +11449,21 @@ function coerceSinkQrChannel(input) {
|
|
|
11378
11449
|
}
|
|
11379
11450
|
function normalizeWechatDestination(value) {
|
|
11380
11451
|
if (value.includes("|")) return value;
|
|
11381
|
-
|
|
11452
|
+
const [id] = splitDestination(value);
|
|
11453
|
+
return id ? `${id}|` : value;
|
|
11454
|
+
}
|
|
11455
|
+
function decryptSecret(encryptedBase64, keyBase64) {
|
|
11456
|
+
const key = Buffer.from(keyBase64, "base64");
|
|
11457
|
+
const raw = Buffer.from(encryptedBase64, "base64");
|
|
11458
|
+
if (key.length !== 32) throw new Error("bind key must be 32 bytes");
|
|
11459
|
+
if (raw.length < 12 + 16) throw new Error("ciphertext too short");
|
|
11460
|
+
const iv = raw.subarray(0, 12);
|
|
11461
|
+
const body3 = raw.subarray(12);
|
|
11462
|
+
const tag = body3.subarray(body3.length - 16);
|
|
11463
|
+
const ciphertext = body3.subarray(0, body3.length - 16);
|
|
11464
|
+
const decipher = createDecipheriv("aes-256-gcm", key, iv);
|
|
11465
|
+
decipher.setAuthTag(tag);
|
|
11466
|
+
return Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString("utf8");
|
|
11382
11467
|
}
|
|
11383
11468
|
|
|
11384
11469
|
// src/onboard/qr-image.ts
|
|
@@ -13628,7 +13713,7 @@ function safe(value, maxBytes) {
|
|
|
13628
13713
|
}
|
|
13629
13714
|
|
|
13630
13715
|
// src/session/projection-protocol.ts
|
|
13631
|
-
import { randomUUID as
|
|
13716
|
+
import { randomUUID as randomUUID9 } from "crypto";
|
|
13632
13717
|
var WebSessionProjectionSource = class {
|
|
13633
13718
|
constructor(transport) {
|
|
13634
13719
|
this.transport = transport;
|
|
@@ -13667,7 +13752,7 @@ var WebSessionProjectionSource = class {
|
|
|
13667
13752
|
});
|
|
13668
13753
|
return { events, hasMore: value.hasMore === true };
|
|
13669
13754
|
}
|
|
13670
|
-
async prompt(sessionId, text, rpcId =
|
|
13755
|
+
async prompt(sessionId, text, rpcId = randomUUID9()) {
|
|
13671
13756
|
responseValue(await this.transport.rpc("session.prompt", {
|
|
13672
13757
|
sessionId,
|
|
13673
13758
|
mode: "queue",
|
|
@@ -14340,7 +14425,7 @@ function wait(ms) {
|
|
|
14340
14425
|
}
|
|
14341
14426
|
|
|
14342
14427
|
// src/commands/session-projection.ts
|
|
14343
|
-
import { randomUUID as
|
|
14428
|
+
import { randomUUID as randomUUID10 } from "crypto";
|
|
14344
14429
|
var SessionProjectionController = class {
|
|
14345
14430
|
constructor(deps) {
|
|
14346
14431
|
this.deps = deps;
|
|
@@ -14480,7 +14565,7 @@ workspace: \`${workspaceCwd}\``
|
|
|
14480
14565
|
if (owner && owner.scope !== input.identity.scope && !this.deps.access.isAdmin(input.identity.actorId)) {
|
|
14481
14566
|
throw new Error("\u8BE5 session \u5DF2\u7ED1\u5B9A\u5176\u4ED6\u98DE\u4E66 scope\uFF1B\u72EC\u5360\u8FC1\u79FB\u4EC5 profile \u7BA1\u7406\u5458\u53EF\u786E\u8BA4");
|
|
14482
14567
|
}
|
|
14483
|
-
const nonce =
|
|
14568
|
+
const nonce = randomUUID10();
|
|
14484
14569
|
const expiresAt = Date.now() + (this.deps.confirmationTtlMs ?? 10 * 6e4);
|
|
14485
14570
|
const timer = setTimeout(() => this.pending.delete(nonce), expiresAt - Date.now());
|
|
14486
14571
|
timer.unref?.();
|
|
@@ -15517,7 +15602,7 @@ function attachRunCardAnchors(channel, anchors) {
|
|
|
15517
15602
|
|
|
15518
15603
|
// src/notify/server.ts
|
|
15519
15604
|
import { createServer } from "http";
|
|
15520
|
-
import { randomBytes as
|
|
15605
|
+
import { randomBytes as randomBytes3 } from "crypto";
|
|
15521
15606
|
var NotifyServer = class {
|
|
15522
15607
|
server;
|
|
15523
15608
|
token;
|
|
@@ -15804,7 +15889,7 @@ function readBody(req) {
|
|
|
15804
15889
|
});
|
|
15805
15890
|
}
|
|
15806
15891
|
function generateNotifyToken() {
|
|
15807
|
-
return `dsh-lark-${
|
|
15892
|
+
return `dsh-lark-${randomBytes3(18).toString("hex")}`;
|
|
15808
15893
|
}
|
|
15809
15894
|
|
|
15810
15895
|
// src/notify/ask-handler.ts
|
|
@@ -15996,7 +16081,7 @@ async function settleCancelledCard(deps, chatId, cardMessageId, options) {
|
|
|
15996
16081
|
}
|
|
15997
16082
|
|
|
15998
16083
|
// src/notify/approval-handler.ts
|
|
15999
|
-
import { randomUUID as
|
|
16084
|
+
import { randomUUID as randomUUID11 } from "crypto";
|
|
16000
16085
|
init_tool_policy();
|
|
16001
16086
|
function buildApprovalHandler(deps) {
|
|
16002
16087
|
return async (payload, signal) => {
|
|
@@ -16039,7 +16124,7 @@ ${policyDenialText(denial)}
|
|
|
16039
16124
|
return { ok: true, outcome: "rejected", denial };
|
|
16040
16125
|
}
|
|
16041
16126
|
if (payload.lowRisk) return { ok: true, outcome: "allowed-once" };
|
|
16042
|
-
const id = `approval-${
|
|
16127
|
+
const id = `approval-${randomUUID11().replaceAll("-", "")}`;
|
|
16043
16128
|
const request = {
|
|
16044
16129
|
id,
|
|
16045
16130
|
...payload.callId === void 0 ? {} : { callId: payload.callId },
|
|
@@ -16368,14 +16453,16 @@ var QqSink = class {
|
|
|
16368
16453
|
type = "qq";
|
|
16369
16454
|
async send(channel, message) {
|
|
16370
16455
|
const [appId, clientSecret] = splitAppCredential(channel.secret);
|
|
16371
|
-
const
|
|
16372
|
-
if (!appId || !clientSecret || !
|
|
16456
|
+
const target = channel.destination;
|
|
16457
|
+
if (!appId || !clientSecret || !target) {
|
|
16373
16458
|
log.warn("sink:qq", "missing-credential", { channel: channel.id });
|
|
16374
16459
|
return false;
|
|
16375
16460
|
}
|
|
16461
|
+
const isC2c = target.startsWith("user:");
|
|
16462
|
+
const openId = isC2c ? target.slice("user:".length) : target;
|
|
16463
|
+
const url = `${this.apiBase}/v2/${isC2c ? "users" : "groups"}/${encodeURIComponent(openId)}/messages`;
|
|
16376
16464
|
try {
|
|
16377
16465
|
const token = await this.fetchAccessToken(appId, clientSecret);
|
|
16378
|
-
const url = `${this.apiBase}/v2/groups/${encodeURIComponent(groupOpenId)}/messages`;
|
|
16379
16466
|
const controller = new AbortController();
|
|
16380
16467
|
const timer = setTimeout(() => controller.abort(), 1e4);
|
|
16381
16468
|
timer.unref?.();
|
|
@@ -17045,7 +17132,7 @@ function normalizeContextSnapshot(value) {
|
|
|
17045
17132
|
|
|
17046
17133
|
// src/session/projection-store.ts
|
|
17047
17134
|
import { readFile as readFile26 } from "fs/promises";
|
|
17048
|
-
import { randomUUID as
|
|
17135
|
+
import { randomUUID as randomUUID12 } from "crypto";
|
|
17049
17136
|
var MAX_RECENT_MESSAGES = 64;
|
|
17050
17137
|
var MAX_PROMPT_CORRELATIONS = 64;
|
|
17051
17138
|
var PROMPT_CORRELATION_TTL_MS = 24 * 60 * 6e4;
|
|
@@ -17112,7 +17199,7 @@ var SessionProjectionStore = class {
|
|
|
17112
17199
|
recentMessages: currentOwner?.scope === input.scope && currentOwner.workspaceCwd === input.workspaceCwd ? structuredClone(currentOwner.recentMessages) : [],
|
|
17113
17200
|
promptCorrelations: structuredClone(currentOwner?.promptCorrelations ?? []),
|
|
17114
17201
|
boundAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
17115
|
-
generationId:
|
|
17202
|
+
generationId: randomUUID12()
|
|
17116
17203
|
};
|
|
17117
17204
|
this.data.bindings[targetKey] = binding;
|
|
17118
17205
|
return {
|
|
@@ -17269,7 +17356,7 @@ function normalizeCorrelation(value) {
|
|
|
17269
17356
|
|
|
17270
17357
|
// src/session/archive.ts
|
|
17271
17358
|
import { execFile as execFile2 } from "child_process";
|
|
17272
|
-
import { randomBytes as
|
|
17359
|
+
import { randomBytes as randomBytes4 } from "crypto";
|
|
17273
17360
|
import { access, mkdir as mkdir17, readdir as readdir3, readFile as readFile27, unlink, writeFile as writeFile8 } from "fs/promises";
|
|
17274
17361
|
import { join as join24 } from "path";
|
|
17275
17362
|
import { promisify } from "util";
|
|
@@ -17280,7 +17367,7 @@ function archiveScopeSlug(scope) {
|
|
|
17280
17367
|
}
|
|
17281
17368
|
function timestampId() {
|
|
17282
17369
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace(/\.\d{3}/, "");
|
|
17283
|
-
return `${stamp}-${
|
|
17370
|
+
return `${stamp}-${randomBytes4(3).toString("hex")}`;
|
|
17284
17371
|
}
|
|
17285
17372
|
function renderMarkdown(input, record) {
|
|
17286
17373
|
const lines = [
|
|
@@ -17594,7 +17681,7 @@ async function safeRemove(path) {
|
|
|
17594
17681
|
|
|
17595
17682
|
// src/workspace/git-worktree.ts
|
|
17596
17683
|
import { execFile as execFile3 } from "child_process";
|
|
17597
|
-
import { createHash as createHash2, randomBytes as
|
|
17684
|
+
import { createHash as createHash2, randomBytes as randomBytes5 } from "crypto";
|
|
17598
17685
|
import { access as access2, copyFile, mkdir as mkdir18, realpath as realpath2 } from "fs/promises";
|
|
17599
17686
|
import { dirname as dirname16, join as join25 } from "path";
|
|
17600
17687
|
import { promisify as promisify2 } from "util";
|
|
@@ -17655,7 +17742,7 @@ var GitWorktreeManager = class {
|
|
|
17655
17742
|
return { cwd: target, created: false };
|
|
17656
17743
|
}
|
|
17657
17744
|
}
|
|
17658
|
-
const branch = `dsh-lark/${slug}-${Date.now().toString(36)}-${
|
|
17745
|
+
const branch = `dsh-lark/${slug}-${Date.now().toString(36)}-${randomBytes5(3).toString("hex")}`;
|
|
17659
17746
|
await mkdir18(this.options.worktreesRoot, { recursive: true });
|
|
17660
17747
|
await this.runGit(["worktree", "add", "-b", branch, target, "HEAD"], base);
|
|
17661
17748
|
await this.ensureProjectRules(base, target);
|
|
@@ -18639,7 +18726,7 @@ function projectDiagnosticLogs(lines) {
|
|
|
18639
18726
|
}
|
|
18640
18727
|
|
|
18641
18728
|
// src/secret/registry.ts
|
|
18642
|
-
import { randomUUID as
|
|
18729
|
+
import { randomUUID as randomUUID13 } from "crypto";
|
|
18643
18730
|
var SecretRequestRegistry = class {
|
|
18644
18731
|
constructor(writer, options = {}) {
|
|
18645
18732
|
this.writer = writer;
|
|
@@ -18652,7 +18739,7 @@ var SecretRequestRegistry = class {
|
|
|
18652
18739
|
now;
|
|
18653
18740
|
register(input) {
|
|
18654
18741
|
this.writer.validate(input.target, input.reference);
|
|
18655
|
-
const id = `secret-${
|
|
18742
|
+
const id = `secret-${randomUUID13().replaceAll("-", "")}`;
|
|
18656
18743
|
let resolve6;
|
|
18657
18744
|
const promise = new Promise((settle) => {
|
|
18658
18745
|
resolve6 = settle;
|
|
@@ -18802,7 +18889,7 @@ function buildSecretHandler(deps) {
|
|
|
18802
18889
|
init_own_package();
|
|
18803
18890
|
|
|
18804
18891
|
// src/guardian/update-handoff.ts
|
|
18805
|
-
import { createHash as createHash3, randomUUID as
|
|
18892
|
+
import { createHash as createHash3, randomUUID as randomUUID14 } from "crypto";
|
|
18806
18893
|
import { spawn as spawn7 } from "child_process";
|
|
18807
18894
|
import { chmod, mkdir as mkdir21, readFile as readFile32, rm as rm10 } from "fs/promises";
|
|
18808
18895
|
import { dirname as dirname19, join as join26 } from "path";
|
|
@@ -18976,7 +19063,7 @@ var GuardianUpdateHandoff = class {
|
|
|
18976
19063
|
this.options = options;
|
|
18977
19064
|
this.launch = options.launch ?? defaultLaunch;
|
|
18978
19065
|
this.now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
18979
|
-
this.id = options.id ??
|
|
19066
|
+
this.id = options.id ?? randomUUID14;
|
|
18980
19067
|
}
|
|
18981
19068
|
options;
|
|
18982
19069
|
launch;
|
|
@@ -19092,14 +19179,14 @@ var GuardianUpdateHandoff = class {
|
|
|
19092
19179
|
};
|
|
19093
19180
|
|
|
19094
19181
|
// src/upgrade/channel-update.ts
|
|
19095
|
-
import { randomUUID as
|
|
19182
|
+
import { randomUUID as randomUUID15 } from "crypto";
|
|
19096
19183
|
var OFFER_TTL_MS = 10 * 6e4;
|
|
19097
19184
|
var ChannelUpdateController = class {
|
|
19098
19185
|
constructor(options) {
|
|
19099
19186
|
this.options = options;
|
|
19100
19187
|
this.current = options.current ?? currentVersion();
|
|
19101
19188
|
this.probe = options.probe ?? (() => latestVersion({ cacheMs: 0 }));
|
|
19102
|
-
this.id = options.id ??
|
|
19189
|
+
this.id = options.id ?? randomUUID15;
|
|
19103
19190
|
this.now = options.now ?? Date.now;
|
|
19104
19191
|
this.ttl = options.offerTtlMs ?? OFFER_TTL_MS;
|
|
19105
19192
|
}
|
|
@@ -19458,7 +19545,7 @@ async function startBridgeEngine(options) {
|
|
|
19458
19545
|
ledgerClaimed = await claimJobDispatch({
|
|
19459
19546
|
jobs,
|
|
19460
19547
|
messageIds: ledgerMessageIds,
|
|
19461
|
-
runId: `dispatch-${
|
|
19548
|
+
runId: `dispatch-${randomUUID16()}`,
|
|
19462
19549
|
first,
|
|
19463
19550
|
channel: streaming
|
|
19464
19551
|
});
|
|
@@ -20573,7 +20660,7 @@ ${changeLines.join("\n")}
|
|
|
20573
20660
|
import { join as join33 } from "path";
|
|
20574
20661
|
|
|
20575
20662
|
// src/guardian/service.ts
|
|
20576
|
-
import { randomUUID as
|
|
20663
|
+
import { randomUUID as randomUUID17 } from "crypto";
|
|
20577
20664
|
import { readFileSync as readFileSync6 } from "fs";
|
|
20578
20665
|
import { homedir as homedir21 } from "os";
|
|
20579
20666
|
import { join as join32 } from "path";
|
|
@@ -21420,7 +21507,7 @@ var GuardianService = class {
|
|
|
21420
21507
|
}
|
|
21421
21508
|
const transcript = this.transcripts.get(scope) ?? [];
|
|
21422
21509
|
const prompt = buildSafePrompt(transcript, msg.content);
|
|
21423
|
-
const runId =
|
|
21510
|
+
const runId = randomUUID17();
|
|
21424
21511
|
const density = this.options.safeDensity;
|
|
21425
21512
|
const timeoutMs = this.options.safeTimeoutMs;
|
|
21426
21513
|
const now = Date.now();
|