@threadbase-sh/streamer 1.69.3 → 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 +52 -31
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +45 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -8
- package/dist/index.js.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
package/dist/index.js
CHANGED
|
@@ -4089,7 +4089,7 @@ async function readGitBranch(dir) {
|
|
|
4089
4089
|
// src/server.ts
|
|
4090
4090
|
import { createNodeWebSocket } from "@hono/node-ws";
|
|
4091
4091
|
import { Connection, Client as TemporalClient } from "@temporalio/client";
|
|
4092
|
-
import { randomUUID as
|
|
4092
|
+
import { randomUUID as randomUUID6 } from "crypto";
|
|
4093
4093
|
import { EventEmitter } from "events";
|
|
4094
4094
|
import { existsSync as existsSync16 } from "fs";
|
|
4095
4095
|
import { realpath as realpath2 } from "fs/promises";
|
|
@@ -9211,6 +9211,7 @@ var ConversationHandlers = class {
|
|
|
9211
9211
|
};
|
|
9212
9212
|
|
|
9213
9213
|
// src/api/handlers/sessions.handlers.ts
|
|
9214
|
+
import { randomUUID as randomUUID4 } from "crypto";
|
|
9214
9215
|
import { existsSync as existsSync10 } from "fs";
|
|
9215
9216
|
import { basename as basename6, dirname as dirname9, join as join16 } from "path";
|
|
9216
9217
|
|
|
@@ -10506,7 +10507,9 @@ var SessionHandlers = class {
|
|
|
10506
10507
|
}
|
|
10507
10508
|
const key = permissionContentKey(gate);
|
|
10508
10509
|
if (this.pendingPermissionKey.get(sessionId) === key) return;
|
|
10509
|
-
this.pendingPermission.
|
|
10510
|
+
const prior = this.pendingPermission.get(sessionId);
|
|
10511
|
+
const gateId = prior && permissionGateKey(prior) === permissionGateKey(gate) ? prior.gateId : randomUUID4();
|
|
10512
|
+
this.pendingPermission.set(sessionId, { ...gate, gateId });
|
|
10510
10513
|
this.pendingPermissionKey.set(sessionId, key);
|
|
10511
10514
|
const subscriberCount = this.sessionSubscribers.get(sessionId)?.size ?? 0;
|
|
10512
10515
|
this.log.info(
|
|
@@ -10520,7 +10523,8 @@ var SessionHandlers = class {
|
|
|
10520
10523
|
...gate.detail ? { detail: gate.detail } : {},
|
|
10521
10524
|
options: gate.options,
|
|
10522
10525
|
...gate.cursor !== void 0 ? { cursor: gate.cursor } : {},
|
|
10523
|
-
contentKey: permissionGateKey(gate)
|
|
10526
|
+
contentKey: permissionGateKey(gate),
|
|
10527
|
+
gateId
|
|
10524
10528
|
});
|
|
10525
10529
|
}
|
|
10526
10530
|
/**
|
|
@@ -10548,10 +10552,15 @@ var SessionHandlers = class {
|
|
|
10548
10552
|
const body = await readBody2(req);
|
|
10549
10553
|
const contentKey = body?.contentKey;
|
|
10550
10554
|
const optionIndex = body?.optionIndex;
|
|
10555
|
+
const gateId = body?.gateId;
|
|
10551
10556
|
if (typeof contentKey !== "string" || !Number.isInteger(optionIndex) || optionIndex < 0) {
|
|
10552
10557
|
json(res, 400, { ok: false, reason: "Expected { contentKey: string, optionIndex: number }" });
|
|
10553
10558
|
return;
|
|
10554
10559
|
}
|
|
10560
|
+
if (gateId !== void 0 && typeof gateId !== "string") {
|
|
10561
|
+
json(res, 400, { ok: false, reason: "Expected gateId to be a string" });
|
|
10562
|
+
return;
|
|
10563
|
+
}
|
|
10555
10564
|
const gateClosed = () => {
|
|
10556
10565
|
this.pendingPermission.delete(sessionId);
|
|
10557
10566
|
this.pendingPermissionKey.delete(sessionId);
|
|
@@ -10563,6 +10572,16 @@ var SessionHandlers = class {
|
|
|
10563
10572
|
gateClosed();
|
|
10564
10573
|
return;
|
|
10565
10574
|
}
|
|
10575
|
+
if (gateId !== void 0 && gateId !== gate.gateId) {
|
|
10576
|
+
json(res, 409, { ok: false, reason: "gate_mismatch" });
|
|
10577
|
+
return;
|
|
10578
|
+
}
|
|
10579
|
+
if (gateId === void 0) {
|
|
10580
|
+
this.log.info(`[permission.answer_legacy_identity] ${sessionId.slice(0, 8)}`, {
|
|
10581
|
+
event: "permission.answer_legacy_identity",
|
|
10582
|
+
sessionId
|
|
10583
|
+
});
|
|
10584
|
+
}
|
|
10566
10585
|
if (permissionGateKey(gate) !== contentKey) {
|
|
10567
10586
|
json(res, 409, { ok: false, reason: "gate_mismatch" });
|
|
10568
10587
|
return;
|
|
@@ -10572,7 +10591,8 @@ var SessionHandlers = class {
|
|
|
10572
10591
|
json(res, 409, { ok: false, reason: "unknown_option" });
|
|
10573
10592
|
return;
|
|
10574
10593
|
}
|
|
10575
|
-
|
|
10594
|
+
const provider = this.sessionStore.getManaged(sessionId)?.provider;
|
|
10595
|
+
if (provider !== CODEX_CLI_PROVIDER && !await this.permissionGateStillOpen(sessionId, contentKey)) {
|
|
10576
10596
|
gateClosed();
|
|
10577
10597
|
return;
|
|
10578
10598
|
}
|
|
@@ -11280,7 +11300,7 @@ var ManagedSessionsRepository = class {
|
|
|
11280
11300
|
};
|
|
11281
11301
|
|
|
11282
11302
|
// src/db/repositories/projects.repository.ts
|
|
11283
|
-
import { randomUUID as
|
|
11303
|
+
import { randomUUID as randomUUID5 } from "crypto";
|
|
11284
11304
|
function rowToProject(row) {
|
|
11285
11305
|
return {
|
|
11286
11306
|
id: row.id,
|
|
@@ -11365,7 +11385,7 @@ var ProjectsRepository = class {
|
|
|
11365
11385
|
});
|
|
11366
11386
|
return rowToProject(this.getById.get(existing.id));
|
|
11367
11387
|
}
|
|
11368
|
-
const id =
|
|
11388
|
+
const id = randomUUID5();
|
|
11369
11389
|
this.insert.run({
|
|
11370
11390
|
id,
|
|
11371
11391
|
path,
|
|
@@ -13142,7 +13162,8 @@ function createApiDeps(deps) {
|
|
|
13142
13162
|
...pendingGate.detail ? { detail: pendingGate.detail } : {},
|
|
13143
13163
|
options: pendingGate.options,
|
|
13144
13164
|
...pendingGate.cursor !== void 0 ? { cursor: pendingGate.cursor } : {},
|
|
13145
|
-
contentKey: permissionGateKey(pendingGate)
|
|
13165
|
+
contentKey: permissionGateKey(pendingGate),
|
|
13166
|
+
gateId: pendingGate.gateId
|
|
13146
13167
|
})
|
|
13147
13168
|
);
|
|
13148
13169
|
}
|
|
@@ -16000,7 +16021,7 @@ var StreamerServer = class {
|
|
|
16000
16021
|
runtimeStore = null;
|
|
16001
16022
|
// Identifies this streamer run. A registry row carrying a different id is a
|
|
16002
16023
|
// session that outlived the process that started it.
|
|
16003
|
-
streamerInstanceId =
|
|
16024
|
+
streamerInstanceId = randomUUID6();
|
|
16004
16025
|
cacheMetadataRepo = null;
|
|
16005
16026
|
// Push registration + delivery state (C7). Null when the cache DB failed to
|
|
16006
16027
|
// open — registration then degrades to a no-op rather than 500ing.
|