@threadbase-sh/streamer 1.69.2 → 1.69.4
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/api/handlers/sessions.handlers.d.ts +2 -0
- package/dist/api/handlers/sessions.handlers.d.ts.map +1 -1
- package/dist/cli.cjs +83 -74
- package/dist/cli.cjs.map +1 -1
- package/dist/codex-pty-runner.d.ts.map +1 -1
- package/dist/index.cjs +76 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +60 -51
- package/dist/index.js.map +1 -1
- package/dist/pty-manager.d.ts.map +1 -1
- package/dist/pty-shared.d.ts +0 -1
- package/dist/pty-shared.d.ts.map +1 -1
- package/dist/server-wiring.d.ts +2 -0
- package/dist/server-wiring.d.ts.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -57,6 +57,8 @@ export type SessionHandlersDeps = {
|
|
|
57
57
|
detail?: string;
|
|
58
58
|
options: PermissionOption[];
|
|
59
59
|
cursor?: number;
|
|
60
|
+
/** Server-owned instance id, minted by handlePermissionChange. */
|
|
61
|
+
gateId: string;
|
|
60
62
|
}>;
|
|
61
63
|
pendingPermissionKey: Map<string, string>;
|
|
62
64
|
contendedSessions: Set<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessions.handlers.d.ts","sourceRoot":"","sources":["../../../src/api/handlers/sessions.handlers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sessions.handlers.d.ts","sourceRoot":"","sources":["../../../src/api/handlers/sessions.handlers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE3C,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAE5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,K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,eAAe,EACpB,GAAG,EAAE,cAAc,GAClB,OAAO,CAAC,IAAI,CAAC,CAiCf;YAIa,qBAAqB;IAS7B,gBAAgB,CACpB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,GAClB,OAAO,CAAC,IAAI,CAAC,CA4Df;IAED,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,GAAG,IAAI,CAS5D;IAED,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,GAAG,IAAI,CASzD;IAEK,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CA6D7E;IAED;;;;;OAKG;IACH,OAAO,CAAC,wBAAwB;IAOhC,OAAO,CAAC,wBAAwB;IAiBhC,OAAO,CAAC,yBAAyB;IAYjC;;;;OAIG;IACH,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAO3C;IAEK,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAuHvE;IAEK,kBAAkB,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAwIjF;IAEK,oBAAoB,CACxB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,GAClB,OAAO,CAAC,IAAI,CAAC,CAmBf;IAED,qBAAqB,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI,CAM/C;CACF"}
|
package/dist/cli.cjs
CHANGED
|
@@ -107285,11 +107285,6 @@ ${i3.join("\n")}
|
|
|
107285
107285
|
});
|
|
107286
107286
|
|
|
107287
107287
|
// src/pty-shared.ts
|
|
107288
|
-
function digestBytes(s3) {
|
|
107289
|
-
const escaped = s3.replace(new RegExp(String.fromCharCode(27), "g"), "\\x1b").replace(/\r/g, "\\r").replace(/\n/g, "\\n").replace(/\t/g, "\\t");
|
|
107290
|
-
if (escaped.length <= 200) return escaped;
|
|
107291
|
-
return `${escaped.slice(0, 100)}\u2026[${escaped.length - 200}B omitted]\u2026${escaped.slice(-100)}`;
|
|
107292
|
-
}
|
|
107293
107288
|
async function loadPty() {
|
|
107294
107289
|
if (pty) return pty;
|
|
107295
107290
|
try {
|
|
@@ -119710,11 +119705,11 @@ function toPublicSession(s3) {
|
|
|
119710
119705
|
subStatus: s3.subStatus ?? null
|
|
119711
119706
|
};
|
|
119712
119707
|
}
|
|
119713
|
-
var
|
|
119708
|
+
var import_crypto12, import_fs26, import_path26, OUTPUT_BUFFER_MAX, INPUT_HISTORY_MAX, QUIET_DETECT_MS, CODEX_READY_FALLBACK_MS, SUBMIT_BYTES, CODEX_SUBMIT_DELAY_MS, CODEX_SUBMIT_MAX_WAIT_MS, CODEX_SUBMIT_STALE_MS, CodexPtyRunner;
|
|
119714
119709
|
var init_codex_pty_runner = __esm({
|
|
119715
119710
|
"src/codex-pty-runner.ts"() {
|
|
119716
119711
|
"use strict";
|
|
119717
|
-
|
|
119712
|
+
import_crypto12 = require("crypto");
|
|
119718
119713
|
import_fs26 = require("fs");
|
|
119719
119714
|
import_path26 = require("path");
|
|
119720
119715
|
init_logger();
|
|
@@ -119879,7 +119874,7 @@ var init_codex_pty_runner = __esm({
|
|
|
119879
119874
|
// binding logic). This runner generates a local placeholder id for the
|
|
119880
119875
|
// ManagedSession handle only.
|
|
119881
119876
|
async startFresh(options) {
|
|
119882
|
-
const sessionId = (0,
|
|
119877
|
+
const sessionId = (0, import_crypto12.randomUUID)();
|
|
119883
119878
|
const args = ["--cd", options.projectPath, "--no-alt-screen"];
|
|
119884
119879
|
if (options.systemPrompt) {
|
|
119885
119880
|
args.push(options.systemPrompt);
|
|
@@ -119898,7 +119893,7 @@ var init_codex_pty_runner = __esm({
|
|
|
119898
119893
|
* until watchForCodexRollout binds the real id.
|
|
119899
119894
|
*/
|
|
119900
119895
|
async startFork(options) {
|
|
119901
|
-
const sessionId = (0,
|
|
119896
|
+
const sessionId = (0, import_crypto12.randomUUID)();
|
|
119902
119897
|
return this.launch(
|
|
119903
119898
|
sessionId,
|
|
119904
119899
|
["fork", options.forkFromId, "--cd", options.projectPath, "--no-alt-screen"],
|
|
@@ -119929,17 +119924,12 @@ var init_codex_pty_runner = __esm({
|
|
|
119929
119924
|
const lines = await this.getOutputLines(sessionId, PTY_ROWS);
|
|
119930
119925
|
if (!this.pendingReady.has(sessionId)) return;
|
|
119931
119926
|
const busy = codexScreenBlocksComposer(lines);
|
|
119932
|
-
|
|
119933
|
-
|
|
119934
|
-
|
|
119935
|
-
|
|
119936
|
-
|
|
119937
|
-
|
|
119938
|
-
busy,
|
|
119939
|
-
hasReady: codexScreenShowsReady(lines),
|
|
119940
|
-
statusBar: bar.slice(0, 160)
|
|
119941
|
-
}
|
|
119942
|
-
);
|
|
119927
|
+
this.log.info(`[codex.ready_fallback] ${sessionId.slice(0, 8)} busy=${busy}`, {
|
|
119928
|
+
event: "codex.ready_fallback",
|
|
119929
|
+
sessionId,
|
|
119930
|
+
busy,
|
|
119931
|
+
hasReady: codexScreenShowsReady(lines)
|
|
119932
|
+
});
|
|
119943
119933
|
if (busy) {
|
|
119944
119934
|
this.armReadyFallback(sessionId);
|
|
119945
119935
|
return;
|
|
@@ -119974,10 +119964,11 @@ var init_codex_pty_runner = __esm({
|
|
|
119974
119964
|
const gate = this.openGate.get(sessionId);
|
|
119975
119965
|
const digit = gate ? /^([0-9])\r?$/.exec(keys)?.[1] : void 0;
|
|
119976
119966
|
const out = gate && digit ? this.resolveGateAnswer(sessionId, gate, digit) : keys;
|
|
119977
|
-
this.log.info(
|
|
119978
|
-
|
|
119979
|
-
|
|
119980
|
-
|
|
119967
|
+
this.log.info(`[codex.keys.write] ${sessionId.slice(0, 8)} bytes=${out.length}`, {
|
|
119968
|
+
event: "codex.keys_write",
|
|
119969
|
+
sessionId,
|
|
119970
|
+
byteLen: out.length
|
|
119971
|
+
});
|
|
119981
119972
|
session.process.write(out);
|
|
119982
119973
|
session.lastActivityAt = /* @__PURE__ */ new Date();
|
|
119983
119974
|
}
|
|
@@ -120056,13 +120047,12 @@ var init_codex_pty_runner = __esm({
|
|
|
120056
120047
|
writeSubmit(sessionId, session, input, path2, promptCount) {
|
|
120057
120048
|
this.recordUserMessage(session, input);
|
|
120058
120049
|
this.log.info(
|
|
120059
|
-
`[codex.input.write] ${sessionId.slice(0, 8)} promptCount=${promptCount} bytes=${input.length}
|
|
120050
|
+
`[codex.input.write] ${sessionId.slice(0, 8)} promptCount=${promptCount} bytes=${input.length}`,
|
|
120060
120051
|
{
|
|
120061
120052
|
event: "codex.input_write",
|
|
120062
120053
|
sessionId,
|
|
120063
120054
|
promptCount,
|
|
120064
120055
|
byteLen: input.length,
|
|
120065
|
-
digest: digestBytes(input),
|
|
120066
120056
|
path: path2,
|
|
120067
120057
|
phase: "input"
|
|
120068
120058
|
}
|
|
@@ -120126,8 +120116,7 @@ var init_codex_pty_runner = __esm({
|
|
|
120126
120116
|
}
|
|
120127
120117
|
this.log.info(`[codex.submit_stale] ${sessionId.slice(0, 8)} recovering`, {
|
|
120128
120118
|
event: "codex.submit_stale",
|
|
120129
|
-
sessionId
|
|
120130
|
-
statusBar: codexStatusBarLine(lines).slice(0, 160)
|
|
120119
|
+
sessionId
|
|
120131
120120
|
});
|
|
120132
120121
|
this.markReady(sessionId, session, "quiet-fallback", "submit-stale");
|
|
120133
120122
|
} catch (err) {
|
|
@@ -120410,7 +120399,7 @@ var init_codex_pty_runner = __esm({
|
|
|
120410
120399
|
if (this.lastScreenLog.get(sessionId) !== screenFp) {
|
|
120411
120400
|
this.lastScreenLog.set(sessionId, screenFp);
|
|
120412
120401
|
this.log.info(
|
|
120413
|
-
`[codex.screen] ${sessionId.slice(0, 8)} pending=${this.pendingReady.has(sessionId)} status=${session.status} ready=${hasReady} busy=${busy} usage=${Boolean(blocking)}
|
|
120402
|
+
`[codex.screen] ${sessionId.slice(0, 8)} pending=${this.pendingReady.has(sessionId)} status=${session.status} ready=${hasReady} busy=${busy} usage=${Boolean(blocking)}`,
|
|
120414
120403
|
{
|
|
120415
120404
|
event: "codex.screen",
|
|
120416
120405
|
sessionId,
|
|
@@ -120420,8 +120409,7 @@ var init_codex_pty_runner = __esm({
|
|
|
120420
120409
|
hasReady,
|
|
120421
120410
|
busy,
|
|
120422
120411
|
usageHit: Boolean(blocking),
|
|
120423
|
-
usageSoft: Boolean(blocking?.soft)
|
|
120424
|
-
statusBar: bar.slice(0, 160)
|
|
120412
|
+
usageSoft: Boolean(blocking?.soft)
|
|
120425
120413
|
}
|
|
120426
120414
|
);
|
|
120427
120415
|
}
|
|
@@ -120456,8 +120444,7 @@ var init_codex_pty_runner = __esm({
|
|
|
120456
120444
|
session.failureReason = blocking.detail ? `${blocking.prompt} ${blocking.detail}` : blocking.prompt;
|
|
120457
120445
|
this.log.info(`[codex.usage_limit] ${sessionId.slice(0, 8)}`, {
|
|
120458
120446
|
event: "codex.usage_limit",
|
|
120459
|
-
sessionId
|
|
120460
|
-
prompt: blocking.prompt
|
|
120447
|
+
sessionId
|
|
120461
120448
|
});
|
|
120462
120449
|
this.onPermissionChange?.(sessionId, blocking);
|
|
120463
120450
|
}
|
|
@@ -120503,8 +120490,7 @@ var init_codex_pty_runner = __esm({
|
|
|
120503
120490
|
this.log.info(`[codex.gate_prompt] ${sessionId.slice(0, 8)} ${gate}`, {
|
|
120504
120491
|
event: "codex.gate_prompt",
|
|
120505
120492
|
sessionId,
|
|
120506
|
-
gate
|
|
120507
|
-
prompt: card.prompt
|
|
120493
|
+
gate
|
|
120508
120494
|
});
|
|
120509
120495
|
this.onPermissionChange?.(sessionId, card);
|
|
120510
120496
|
}
|
|
@@ -121125,11 +121111,11 @@ function toPublicSession2(s3) {
|
|
|
121125
121111
|
subStatus: s3.subStatus ?? null
|
|
121126
121112
|
};
|
|
121127
121113
|
}
|
|
121128
|
-
var
|
|
121114
|
+
var import_crypto13, import_fs27, import_path27, OUTPUT_BUFFER_MAX2, INPUT_HISTORY_MAX2, CLAUDE_PROMPT_MARKERS, QUIET_DETECT_MS2, OSC_TAIL_CHARS, SCRAPE_THROTTLE_MS, CLAUDE_READY_FALLBACK_MS, SUBMIT_BYTES2, SUBMIT_DELAY_MS, SUBMIT_MAX_WAIT_MS, PTYManager;
|
|
121129
121115
|
var init_pty_manager = __esm({
|
|
121130
121116
|
"src/pty-manager.ts"() {
|
|
121131
121117
|
"use strict";
|
|
121132
|
-
|
|
121118
|
+
import_crypto13 = require("crypto");
|
|
121133
121119
|
import_fs27 = require("fs");
|
|
121134
121120
|
import_path27 = require("path");
|
|
121135
121121
|
init_claude_flags();
|
|
@@ -121322,7 +121308,7 @@ var init_pty_manager = __esm({
|
|
|
121322
121308
|
// onReady fires once Claude reaches its first prompt (waiting_input).
|
|
121323
121309
|
async startFresh(options) {
|
|
121324
121310
|
const nodePty = await loadPty();
|
|
121325
|
-
const sessionId = (0,
|
|
121311
|
+
const sessionId = (0, import_crypto13.randomUUID)();
|
|
121326
121312
|
const projectName = options.projectName ?? (0, import_path27.basename)(options.projectPath);
|
|
121327
121313
|
const permissionMode = options.permissionMode ?? "acceptEdits";
|
|
121328
121314
|
const args = [
|
|
@@ -121398,10 +121384,11 @@ var init_pty_manager = __esm({
|
|
|
121398
121384
|
session.statusUpdatedAt = /* @__PURE__ */ new Date();
|
|
121399
121385
|
this.onStatusChange?.(toPublicSession2(session));
|
|
121400
121386
|
}
|
|
121401
|
-
this.log.info(
|
|
121402
|
-
|
|
121403
|
-
|
|
121404
|
-
|
|
121387
|
+
this.log.info(`[pty.keys.write] ${sessionId.slice(0, 8)} bytes=${keys.length}`, {
|
|
121388
|
+
event: "pty.keys_write",
|
|
121389
|
+
sessionId,
|
|
121390
|
+
byteLen: keys.length
|
|
121391
|
+
});
|
|
121405
121392
|
session.process.write(keys);
|
|
121406
121393
|
session.lastActivityAt = /* @__PURE__ */ new Date();
|
|
121407
121394
|
const openGate = this.permissionOpen.get(sessionId);
|
|
@@ -121463,13 +121450,12 @@ var init_pty_manager = __esm({
|
|
|
121463
121450
|
this.recordUserMessage(session, input);
|
|
121464
121451
|
const pasteBytes = buildPasteBytes(input);
|
|
121465
121452
|
this.log.info(
|
|
121466
|
-
`[pty.input.write] ${sessionId.slice(0, 8)} promptCount=${promptCount} bytes=${pasteBytes.length}
|
|
121453
|
+
`[pty.input.write] ${sessionId.slice(0, 8)} promptCount=${promptCount} bytes=${pasteBytes.length}`,
|
|
121467
121454
|
{
|
|
121468
121455
|
event: "pty.input_write",
|
|
121469
121456
|
sessionId,
|
|
121470
121457
|
promptCount,
|
|
121471
121458
|
byteLen: pasteBytes.length,
|
|
121472
|
-
digest: digestBytes(pasteBytes),
|
|
121473
121459
|
path: path2,
|
|
121474
121460
|
phase: "paste"
|
|
121475
121461
|
}
|
|
@@ -121669,7 +121655,7 @@ var init_pty_manager = __esm({
|
|
|
121669
121655
|
this.lastChunkAt.set(sessionId, now);
|
|
121670
121656
|
const gapMs = last == null ? 0 : now - last;
|
|
121671
121657
|
this.log.info(
|
|
121672
|
-
`[pty.chunk] ${sessionId.slice(0, 8)} #${idx} +${chunk.length}B gap=${gapMs}ms status=${session.status}
|
|
121658
|
+
`[pty.chunk] ${sessionId.slice(0, 8)} #${idx} +${chunk.length}B gap=${gapMs}ms status=${session.status}`,
|
|
121673
121659
|
{
|
|
121674
121660
|
event: "pty.chunk",
|
|
121675
121661
|
sessionId,
|
|
@@ -121677,8 +121663,7 @@ var init_pty_manager = __esm({
|
|
|
121677
121663
|
chunkBytes: chunk.length,
|
|
121678
121664
|
gapMs,
|
|
121679
121665
|
status: session.status,
|
|
121680
|
-
pendingReady: this.pendingReady.has(sessionId)
|
|
121681
|
-
digest: digestBytes(data)
|
|
121666
|
+
pendingReady: this.pendingReady.has(sessionId)
|
|
121682
121667
|
}
|
|
121683
121668
|
);
|
|
121684
121669
|
session.outputBuffer = Buffer.concat([session.outputBuffer, chunk]);
|
|
@@ -121742,15 +121727,18 @@ var init_pty_manager = __esm({
|
|
|
121742
121727
|
}
|
|
121743
121728
|
const askFooterOnScreen = lines.some((l) => /Enter to select/i.test(l));
|
|
121744
121729
|
if (oscPermission || hasAskFooter || askFooterOnScreen) {
|
|
121730
|
+
const permGate = oscPermission && !askFooterOnScreen ? scrapePermissionGate(lines) : null;
|
|
121731
|
+
const askQuestion = askFooterOnScreen ? detectQuestionFromScreen(lines) : null;
|
|
121745
121732
|
this.log.debug?.(`[pty.prompt_detect] ${sessionId.slice(0, 8)} trigger`, {
|
|
121746
121733
|
event: "pty.prompt_detect",
|
|
121747
121734
|
sessionId,
|
|
121748
121735
|
oscPermission,
|
|
121749
121736
|
hasAskFooter,
|
|
121750
121737
|
askFooterOnScreen,
|
|
121751
|
-
|
|
121752
|
-
|
|
121753
|
-
|
|
121738
|
+
permGateDetected: permGate !== null,
|
|
121739
|
+
permGateOptionCount: permGate?.options.length ?? 0,
|
|
121740
|
+
askQuestionDetected: askQuestion !== null,
|
|
121741
|
+
askQuestionCount: askQuestion?.questions.length ?? 0
|
|
121754
121742
|
});
|
|
121755
121743
|
}
|
|
121756
121744
|
if (oscPermission && !askFooterOnScreen) {
|
|
@@ -132361,7 +132349,7 @@ Content-Length: 0\r
|
|
|
132361
132349
|
|
|
132362
132350
|
// src/server.ts
|
|
132363
132351
|
var import_client = __toESM(require_lib3(), 1);
|
|
132364
|
-
var
|
|
132352
|
+
var import_crypto16 = require("crypto");
|
|
132365
132353
|
var import_events2 = require("events");
|
|
132366
132354
|
var import_fs39 = require("fs");
|
|
132367
132355
|
var import_promises16 = require("fs/promises");
|
|
@@ -147078,6 +147066,7 @@ var ConversationHandlers = class {
|
|
|
147078
147066
|
};
|
|
147079
147067
|
|
|
147080
147068
|
// src/api/handlers/sessions.handlers.ts
|
|
147069
|
+
var import_crypto9 = require("crypto");
|
|
147081
147070
|
var import_fs22 = require("fs");
|
|
147082
147071
|
var import_path22 = require("path");
|
|
147083
147072
|
|
|
@@ -148653,7 +148642,9 @@ var SessionHandlers = class {
|
|
|
148653
148642
|
}
|
|
148654
148643
|
const key = permissionContentKey(gate);
|
|
148655
148644
|
if (this.pendingPermissionKey.get(sessionId) === key) return;
|
|
148656
|
-
this.pendingPermission.
|
|
148645
|
+
const prior = this.pendingPermission.get(sessionId);
|
|
148646
|
+
const gateId = prior && permissionGateKey(prior) === permissionGateKey(gate) ? prior.gateId : (0, import_crypto9.randomUUID)();
|
|
148647
|
+
this.pendingPermission.set(sessionId, { ...gate, gateId });
|
|
148657
148648
|
this.pendingPermissionKey.set(sessionId, key);
|
|
148658
148649
|
const subscriberCount = this.sessionSubscribers.get(sessionId)?.size ?? 0;
|
|
148659
148650
|
this.log.info(
|
|
@@ -148667,7 +148658,8 @@ var SessionHandlers = class {
|
|
|
148667
148658
|
...gate.detail ? { detail: gate.detail } : {},
|
|
148668
148659
|
options: gate.options,
|
|
148669
148660
|
...gate.cursor !== void 0 ? { cursor: gate.cursor } : {},
|
|
148670
|
-
contentKey: permissionGateKey(gate)
|
|
148661
|
+
contentKey: permissionGateKey(gate),
|
|
148662
|
+
gateId
|
|
148671
148663
|
});
|
|
148672
148664
|
}
|
|
148673
148665
|
/**
|
|
@@ -148695,10 +148687,15 @@ var SessionHandlers = class {
|
|
|
148695
148687
|
const body = await readBody2(req);
|
|
148696
148688
|
const contentKey = body?.contentKey;
|
|
148697
148689
|
const optionIndex = body?.optionIndex;
|
|
148690
|
+
const gateId = body?.gateId;
|
|
148698
148691
|
if (typeof contentKey !== "string" || !Number.isInteger(optionIndex) || optionIndex < 0) {
|
|
148699
148692
|
json2(res, 400, { ok: false, reason: "Expected { contentKey: string, optionIndex: number }" });
|
|
148700
148693
|
return;
|
|
148701
148694
|
}
|
|
148695
|
+
if (gateId !== void 0 && typeof gateId !== "string") {
|
|
148696
|
+
json2(res, 400, { ok: false, reason: "Expected gateId to be a string" });
|
|
148697
|
+
return;
|
|
148698
|
+
}
|
|
148702
148699
|
const gateClosed = () => {
|
|
148703
148700
|
this.pendingPermission.delete(sessionId);
|
|
148704
148701
|
this.pendingPermissionKey.delete(sessionId);
|
|
@@ -148710,6 +148707,16 @@ var SessionHandlers = class {
|
|
|
148710
148707
|
gateClosed();
|
|
148711
148708
|
return;
|
|
148712
148709
|
}
|
|
148710
|
+
if (gateId !== void 0 && gateId !== gate.gateId) {
|
|
148711
|
+
json2(res, 409, { ok: false, reason: "gate_mismatch" });
|
|
148712
|
+
return;
|
|
148713
|
+
}
|
|
148714
|
+
if (gateId === void 0) {
|
|
148715
|
+
this.log.info(`[permission.answer_legacy_identity] ${sessionId.slice(0, 8)}`, {
|
|
148716
|
+
event: "permission.answer_legacy_identity",
|
|
148717
|
+
sessionId
|
|
148718
|
+
});
|
|
148719
|
+
}
|
|
148713
148720
|
if (permissionGateKey(gate) !== contentKey) {
|
|
148714
148721
|
json2(res, 409, { ok: false, reason: "gate_mismatch" });
|
|
148715
148722
|
return;
|
|
@@ -148719,7 +148726,8 @@ var SessionHandlers = class {
|
|
|
148719
148726
|
json2(res, 409, { ok: false, reason: "unknown_option" });
|
|
148720
148727
|
return;
|
|
148721
148728
|
}
|
|
148722
|
-
|
|
148729
|
+
const provider = this.sessionStore.getManaged(sessionId)?.provider;
|
|
148730
|
+
if (provider !== CODEX_CLI_PROVIDER && !await this.permissionGateStillOpen(sessionId, contentKey)) {
|
|
148723
148731
|
gateClosed();
|
|
148724
148732
|
return;
|
|
148725
148733
|
}
|
|
@@ -149524,7 +149532,7 @@ var ManagedSessionsRepository = class {
|
|
|
149524
149532
|
};
|
|
149525
149533
|
|
|
149526
149534
|
// src/db/repositories/projects.repository.ts
|
|
149527
|
-
var
|
|
149535
|
+
var import_crypto10 = require("crypto");
|
|
149528
149536
|
function rowToProject(row) {
|
|
149529
149537
|
return {
|
|
149530
149538
|
id: row.id,
|
|
@@ -149609,7 +149617,7 @@ var ProjectsRepository = class {
|
|
|
149609
149617
|
});
|
|
149610
149618
|
return rowToProject(this.getById.get(existing.id));
|
|
149611
149619
|
}
|
|
149612
|
-
const id = (0,
|
|
149620
|
+
const id = (0, import_crypto10.randomUUID)();
|
|
149613
149621
|
this.insert.run({
|
|
149614
149622
|
id,
|
|
149615
149623
|
path: path2,
|
|
@@ -149648,7 +149656,7 @@ var SessionsRepository = class {
|
|
|
149648
149656
|
init_runtime_store();
|
|
149649
149657
|
|
|
149650
149658
|
// src/e2ee/noise.ts
|
|
149651
|
-
var
|
|
149659
|
+
var import_crypto11 = require("crypto");
|
|
149652
149660
|
var NOISE_PROTOCOL_NAME = "Noise_IKpsk1_25519_ChaChaPoly_SHA256";
|
|
149653
149661
|
var PAIR_PROLOGUE = Buffer.from("threadbase-e2ee/1 pair", "utf-8");
|
|
149654
149662
|
var DHLEN = 32;
|
|
@@ -149664,15 +149672,15 @@ var NoiseError = class extends Error {
|
|
|
149664
149672
|
}
|
|
149665
149673
|
};
|
|
149666
149674
|
function generateKeyPair() {
|
|
149667
|
-
const { publicKey, privateKey } = (0,
|
|
149675
|
+
const { publicKey, privateKey } = (0, import_crypto11.generateKeyPairSync)("x25519");
|
|
149668
149676
|
return { publicKey, privateKey, publicKeyRaw: rawPublicKey(publicKey) };
|
|
149669
149677
|
}
|
|
149670
149678
|
function keyPairFrom(privateKey) {
|
|
149671
|
-
const publicKey = (0,
|
|
149679
|
+
const publicKey = (0, import_crypto11.createPublicKey)(privateKey);
|
|
149672
149680
|
return { publicKey, privateKey, publicKeyRaw: rawPublicKey(publicKey) };
|
|
149673
149681
|
}
|
|
149674
149682
|
function rawPublicKey(key) {
|
|
149675
|
-
const pub = key.type === "public" ? key : (0,
|
|
149683
|
+
const pub = key.type === "public" ? key : (0, import_crypto11.createPublicKey)(key);
|
|
149676
149684
|
const jwk = pub.export({ format: "jwk" });
|
|
149677
149685
|
if (jwk.crv !== "X25519" || typeof jwk.x !== "string") {
|
|
149678
149686
|
throw new NoiseError("Not an X25519 public key");
|
|
@@ -149684,7 +149692,7 @@ function publicKeyFromRaw(raw2) {
|
|
|
149684
149692
|
throw new NoiseError(`X25519 public key must be ${DHLEN} bytes, got ${raw2.length}`);
|
|
149685
149693
|
}
|
|
149686
149694
|
try {
|
|
149687
|
-
return (0,
|
|
149695
|
+
return (0, import_crypto11.createPublicKey)({
|
|
149688
149696
|
key: { kty: "OKP", crv: "X25519", x: raw2.toString("base64url") },
|
|
149689
149697
|
format: "jwk"
|
|
149690
149698
|
});
|
|
@@ -149693,7 +149701,7 @@ function publicKeyFromRaw(raw2) {
|
|
|
149693
149701
|
}
|
|
149694
149702
|
}
|
|
149695
149703
|
function pskFromPairToken(token) {
|
|
149696
|
-
return (0,
|
|
149704
|
+
return (0, import_crypto11.createHash)("sha256").update("threadbase-e2ee/1 psk", "utf-8").update(token, "utf-8").digest();
|
|
149697
149705
|
}
|
|
149698
149706
|
function chachaNonce(n) {
|
|
149699
149707
|
const nonce = Buffer.alloc(12);
|
|
@@ -149712,7 +149720,7 @@ var CipherState = class {
|
|
|
149712
149720
|
}
|
|
149713
149721
|
encryptWithAd(ad, plaintext) {
|
|
149714
149722
|
if (!this.k) return plaintext;
|
|
149715
|
-
const cipher = (0,
|
|
149723
|
+
const cipher = (0, import_crypto11.createCipheriv)("chacha20-poly1305", this.k, chachaNonce(this.n), {
|
|
149716
149724
|
authTagLength: TAGLEN
|
|
149717
149725
|
});
|
|
149718
149726
|
cipher.setAAD(ad, { plaintextLength: plaintext.length });
|
|
@@ -149725,7 +149733,7 @@ var CipherState = class {
|
|
|
149725
149733
|
if (ciphertext.length < TAGLEN) throw new NoiseError("Ciphertext shorter than its tag");
|
|
149726
149734
|
const body = ciphertext.subarray(0, ciphertext.length - TAGLEN);
|
|
149727
149735
|
const tag = ciphertext.subarray(ciphertext.length - TAGLEN);
|
|
149728
|
-
const decipher = (0,
|
|
149736
|
+
const decipher = (0, import_crypto11.createDecipheriv)("chacha20-poly1305", this.k, chachaNonce(this.n), {
|
|
149729
149737
|
authTagLength: TAGLEN
|
|
149730
149738
|
});
|
|
149731
149739
|
decipher.setAAD(ad, { plaintextLength: body.length });
|
|
@@ -149746,7 +149754,7 @@ var SymmetricState = class {
|
|
|
149746
149754
|
cipher = new CipherState();
|
|
149747
149755
|
constructor(protocolName) {
|
|
149748
149756
|
const name = Buffer.from(protocolName, "utf-8");
|
|
149749
|
-
this.h = name.length <= HASHLEN ? Buffer.concat([name, Buffer.alloc(HASHLEN - name.length)]) : (0,
|
|
149757
|
+
this.h = name.length <= HASHLEN ? Buffer.concat([name, Buffer.alloc(HASHLEN - name.length)]) : (0, import_crypto11.createHash)("sha256").update(name).digest();
|
|
149750
149758
|
this.ck = Buffer.from(this.h);
|
|
149751
149759
|
this.cipher.initializeKey(null);
|
|
149752
149760
|
}
|
|
@@ -149758,7 +149766,7 @@ var SymmetricState = class {
|
|
|
149758
149766
|
* subtly wrong.
|
|
149759
149767
|
*/
|
|
149760
149768
|
hkdf(ikm, outputs) {
|
|
149761
|
-
const raw2 = Buffer.from((0,
|
|
149769
|
+
const raw2 = Buffer.from((0, import_crypto11.hkdfSync)("sha256", ikm, this.ck, Buffer.alloc(0), HASHLEN * outputs));
|
|
149762
149770
|
const out = [];
|
|
149763
149771
|
for (let i = 0; i < outputs; i++) out.push(raw2.subarray(i * HASHLEN, (i + 1) * HASHLEN));
|
|
149764
149772
|
return out;
|
|
@@ -149769,7 +149777,7 @@ var SymmetricState = class {
|
|
|
149769
149777
|
this.cipher.initializeKey(tempK);
|
|
149770
149778
|
}
|
|
149771
149779
|
mixHash(data) {
|
|
149772
|
-
this.h = (0,
|
|
149780
|
+
this.h = (0, import_crypto11.createHash)("sha256").update(this.h).update(data).digest();
|
|
149773
149781
|
}
|
|
149774
149782
|
/** Spec §5.2. Used only by the `psk` token. */
|
|
149775
149783
|
mixKeyAndHash(ikm) {
|
|
@@ -149799,7 +149807,7 @@ var SymmetricState = class {
|
|
|
149799
149807
|
}
|
|
149800
149808
|
};
|
|
149801
149809
|
function dh(privateKey, publicKey) {
|
|
149802
|
-
return (0,
|
|
149810
|
+
return (0, import_crypto11.diffieHellman)({ privateKey, publicKey });
|
|
149803
149811
|
}
|
|
149804
149812
|
function readMessage1(args) {
|
|
149805
149813
|
assertMessageSize(args.message1, NOISE_MESSAGE_1_OVERHEAD);
|
|
@@ -150117,7 +150125,7 @@ init_live_session_manager();
|
|
|
150117
150125
|
init_logger();
|
|
150118
150126
|
|
|
150119
150127
|
// src/pair-store.ts
|
|
150120
|
-
var
|
|
150128
|
+
var import_crypto14 = require("crypto");
|
|
150121
150129
|
var DEFAULT_TTL_SECONDS = 180;
|
|
150122
150130
|
var SWEEP_INTERVAL_MS = 6e4;
|
|
150123
150131
|
var PairTokenStore = class {
|
|
@@ -150132,7 +150140,7 @@ var PairTokenStore = class {
|
|
|
150132
150140
|
}
|
|
150133
150141
|
}
|
|
150134
150142
|
mint() {
|
|
150135
|
-
const token = `pt_${(0,
|
|
150143
|
+
const token = `pt_${(0, import_crypto14.randomBytes)(16).toString("hex")}`;
|
|
150136
150144
|
const expiresAt = Date.now() + this.ttlMs;
|
|
150137
150145
|
this.current = { token, expiresAt, used: false };
|
|
150138
150146
|
return {
|
|
@@ -151479,7 +151487,8 @@ function createApiDeps(deps) {
|
|
|
151479
151487
|
...pendingGate.detail ? { detail: pendingGate.detail } : {},
|
|
151480
151488
|
options: pendingGate.options,
|
|
151481
151489
|
...pendingGate.cursor !== void 0 ? { cursor: pendingGate.cursor } : {},
|
|
151482
|
-
contentKey: permissionGateKey(pendingGate)
|
|
151490
|
+
contentKey: permissionGateKey(pendingGate),
|
|
151491
|
+
gateId: pendingGate.gateId
|
|
151483
151492
|
})
|
|
151484
151493
|
);
|
|
151485
151494
|
}
|
|
@@ -151546,7 +151555,7 @@ function createApiDeps(deps) {
|
|
|
151546
151555
|
}
|
|
151547
151556
|
|
|
151548
151557
|
// src/services/cache-integrity/cacheIntegrityMonitor.ts
|
|
151549
|
-
var
|
|
151558
|
+
var import_crypto15 = require("crypto");
|
|
151550
151559
|
var import_fs34 = require("fs");
|
|
151551
151560
|
|
|
151552
151561
|
// src/services/cache-integrity/alertStore.ts
|
|
@@ -151611,7 +151620,7 @@ function envInt(name, fallback) {
|
|
|
151611
151620
|
}
|
|
151612
151621
|
function fingerprintOf(ids) {
|
|
151613
151622
|
const sorted = [...ids].sort();
|
|
151614
|
-
return `sha256:${(0,
|
|
151623
|
+
return `sha256:${(0, import_crypto15.createHash)("sha256").update(sorted.join("\n")).digest("hex")}`;
|
|
151615
151624
|
}
|
|
151616
151625
|
var CacheIntegrityMonitor = class {
|
|
151617
151626
|
constructor(cache, wsHub, log15, cacheDir, rescan, runDuringReset) {
|
|
@@ -154381,7 +154390,7 @@ var StreamerServer = class {
|
|
|
154381
154390
|
runtimeStore = null;
|
|
154382
154391
|
// Identifies this streamer run. A registry row carrying a different id is a
|
|
154383
154392
|
// session that outlived the process that started it.
|
|
154384
|
-
streamerInstanceId = (0,
|
|
154393
|
+
streamerInstanceId = (0, import_crypto16.randomUUID)();
|
|
154385
154394
|
cacheMetadataRepo = null;
|
|
154386
154395
|
// Push registration + delivery state (C7). Null when the cache DB failed to
|
|
154387
154396
|
// open — registration then degrades to a no-op rather than 500ing.
|