negotium 0.22.4 → 0.22.6
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/agent-helpers.js +408 -1301
- package/dist/agent-helpers.js.map +6 -6
- package/dist/background-bash.js +12 -12
- package/dist/background-bash.js.map +2 -2
- package/dist/browser-runtime.js +42 -44
- package/dist/browser-runtime.js.map +2 -2
- package/dist/canonical-mcp-bridge.js +8 -9
- package/dist/canonical-mcp-bridge.js.map +1 -1
- package/dist/{chunk-y4tyc603.js → chunk-1e0nxy7p.js} +13 -13
- package/dist/chunk-1e0nxy7p.js.map +10 -0
- package/dist/{chunk-9zn0bkc9.js → chunk-1mba9m1j.js} +77 -116
- package/dist/{chunk-9zn0bkc9.js.map → chunk-1mba9m1j.js.map} +2 -2
- package/dist/{chunk-rwj7x5pg.js → chunk-9a50csg6.js} +123 -121
- package/dist/{chunk-rwj7x5pg.js.map → chunk-9a50csg6.js.map} +7 -7
- package/dist/chunk-bnyvxss3.js +77 -0
- package/dist/{chunk-q5djsg78.js.map → chunk-bnyvxss3.js.map} +1 -1
- package/dist/{chunk-0jtan6fd.js → chunk-e59kzyvy.js} +4 -5
- package/dist/{chunk-0jtan6fd.js.map → chunk-e59kzyvy.js.map} +2 -2
- package/dist/{chunk-f7p0h1gs.js → chunk-ww8a4ej4.js} +5 -5
- package/dist/{chunk-f7p0h1gs.js.map → chunk-ww8a4ej4.js.map} +2 -2
- package/dist/hosted-agent.js +127 -124
- package/dist/hosted-agent.js.map +4 -4
- package/dist/main.js +3327 -5138
- package/dist/main.js.map +10 -10
- package/dist/mcp-catalog.js +4 -4
- package/dist/mcp-catalog.js.map +1 -1
- package/dist/mcp-factories.js +630 -1515
- package/dist/mcp-factories.js.map +6 -6
- package/dist/mcp-servers.js +5 -5
- package/dist/mcp-servers.js.map +1 -1
- package/dist/media.js +3 -3
- package/dist/media.js.map +1 -1
- package/dist/outbox.js +15 -15
- package/dist/outbox.js.map +2 -2
- package/dist/platform-runtime.js +7 -7
- package/dist/platform-runtime.js.map +1 -1
- package/dist/prompts.js +6 -6
- package/dist/prompts.js.map +2 -2
- package/dist/query-runtime.js +16 -18
- package/dist/query-runtime.js.map +2 -2
- package/dist/registry.js +19 -20
- package/dist/registry.js.map +2 -2
- package/dist/rollout.js +41 -41
- package/dist/rollout.js.map +2 -2
- package/dist/runtime/src/agents/rollout/claude.ts +6 -1
- package/dist/runtime/src/application/submit-runtime-gateway-turn.ts +6 -4
- package/dist/runtime/src/node-host.ts +1 -0
- package/dist/runtime/src/platform/mcp-config.ts +60 -28
- package/dist/runtime/src/runtime/turn-runner.ts +9 -4
- package/dist/runtime/src/topics/update.ts +20 -0
- package/dist/runtime/src/version.ts +1 -1
- package/dist/runtime-gateway.js +12 -12
- package/dist/runtime-gateway.js.map +2 -2
- package/dist/runtime-helpers.js +52 -54
- package/dist/runtime-helpers.js.map +2 -2
- package/dist/sqlite.js +3 -5
- package/dist/sqlite.js.map +2 -2
- package/dist/storage.js +4831 -4802
- package/dist/storage.js.map +2 -2
- package/dist/types/packages/core/src/agents/rollout/claude.d.ts +5 -0
- package/dist/types/packages/core/src/platform/mcp-config.d.ts +8 -0
- package/dist/types/packages/core/src/runtime/turn-runner.d.ts +6 -2
- package/dist/types/packages/core/src/version.d.ts +1 -1
- package/dist/vault.js +20 -22
- package/dist/vault.js.map +2 -2
- package/package.json +1 -1
- package/dist/chunk-2mx7fq49.js +0 -6
- package/dist/chunk-2mx7fq49.js.map +0 -9
- package/dist/chunk-q5djsg78.js +0 -200
- package/dist/chunk-y4tyc603.js.map +0 -10
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var __require = import.meta.require;
|
|
3
|
-
|
|
4
2
|
// ../../packages/core/src/agents/rollout/shared.ts
|
|
5
3
|
import { mkdirSync as mkdirSync2 } from "fs";
|
|
6
4
|
import { resolve as resolve3 } from "path";
|
|
@@ -389,7 +387,7 @@ var trustedWorkspaceRoots = [
|
|
|
389
387
|
SESSION_WORKSPACE_DIR,
|
|
390
388
|
TOPIC_WORKSPACE_DIR
|
|
391
389
|
].map((root) => resolve3(root));
|
|
392
|
-
function
|
|
390
|
+
function configureRolloutHost2(options) {
|
|
393
391
|
if (!options.workspaceRoots && !options.fixturesDir) {
|
|
394
392
|
throw new Error("configureRolloutHost requires workspaceRoots or fixturesDir");
|
|
395
393
|
}
|
|
@@ -441,7 +439,7 @@ function truncate(text, n) {
|
|
|
441
439
|
const cps = Array.from(text);
|
|
442
440
|
return cps.length > n ? `${cps.slice(0, n).join("")}\u2026` : text;
|
|
443
441
|
}
|
|
444
|
-
function
|
|
442
|
+
function extractChatPairs2(entries, opts = { includeToolAnnotations: true }) {
|
|
445
443
|
const pairs = [];
|
|
446
444
|
let pendingUsers = [];
|
|
447
445
|
let pendingBatchSize = null;
|
|
@@ -545,9 +543,91 @@ ${toolBuffer.join(`
|
|
|
545
543
|
return pairs;
|
|
546
544
|
}
|
|
547
545
|
|
|
546
|
+
// ../../packages/core/src/platform/jsonl.ts
|
|
547
|
+
import {
|
|
548
|
+
appendFileSync,
|
|
549
|
+
closeSync,
|
|
550
|
+
fsyncSync,
|
|
551
|
+
mkdirSync as mkdirSync3,
|
|
552
|
+
openSync,
|
|
553
|
+
readFileSync as readFileSync2,
|
|
554
|
+
renameSync,
|
|
555
|
+
statSync,
|
|
556
|
+
unlinkSync as unlinkSync2,
|
|
557
|
+
writeFileSync as writeFileSync2
|
|
558
|
+
} from "fs";
|
|
559
|
+
import { dirname as dirname3 } from "path";
|
|
560
|
+
|
|
561
|
+
// ../../packages/core/src/platform/file-utils.ts
|
|
562
|
+
import { unlinkSync } from "fs";
|
|
563
|
+
function createSafeUnlink(host) {
|
|
564
|
+
return (path, warnLabel) => {
|
|
565
|
+
try {
|
|
566
|
+
host.unlink(path);
|
|
567
|
+
} catch (e) {
|
|
568
|
+
if (e?.code === "ENOENT")
|
|
569
|
+
return;
|
|
570
|
+
if (warnLabel)
|
|
571
|
+
host.warn({ err: e, path }, warnLabel);
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
var defaultSafeUnlink = createSafeUnlink({
|
|
576
|
+
unlink: unlinkSync,
|
|
577
|
+
warn: (context, message) => logger.warn(context, message)
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
// ../../packages/core/src/platform/jsonl.ts
|
|
581
|
+
function parseJsonlText(raw) {
|
|
582
|
+
return raw.trim().split(`
|
|
583
|
+
`).filter(Boolean).map((line) => JSON.parse(line));
|
|
584
|
+
}
|
|
585
|
+
var LOCK_SLEEP = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
|
586
|
+
function writeJsonlFile(filePath, entries) {
|
|
587
|
+
const dir = dirname3(filePath);
|
|
588
|
+
mkdirSync3(dir, { recursive: true });
|
|
589
|
+
const tmpPath = `${filePath}.tmp-${process.pid}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
590
|
+
const payload = `${entries.map((e) => JSON.stringify(e)).join(`
|
|
591
|
+
`)}
|
|
592
|
+
`;
|
|
593
|
+
let fd = null;
|
|
594
|
+
try {
|
|
595
|
+
fd = openSync(tmpPath, "w");
|
|
596
|
+
writeFileSync2(fd, payload);
|
|
597
|
+
fsyncSync(fd);
|
|
598
|
+
closeSync(fd);
|
|
599
|
+
fd = null;
|
|
600
|
+
renameSync(tmpPath, filePath);
|
|
601
|
+
fsyncDirectoryBestEffort(dir);
|
|
602
|
+
} catch (err) {
|
|
603
|
+
if (fd !== null) {
|
|
604
|
+
try {
|
|
605
|
+
closeSync(fd);
|
|
606
|
+
} catch {}
|
|
607
|
+
}
|
|
608
|
+
try {
|
|
609
|
+
unlinkSync2(tmpPath);
|
|
610
|
+
} catch {}
|
|
611
|
+
throw err;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
function fsyncDirectoryBestEffort(dir) {
|
|
615
|
+
let fd = null;
|
|
616
|
+
try {
|
|
617
|
+
fd = openSync(dir, "r");
|
|
618
|
+
fsyncSync(fd);
|
|
619
|
+
} catch {} finally {
|
|
620
|
+
if (fd !== null) {
|
|
621
|
+
try {
|
|
622
|
+
closeSync(fd);
|
|
623
|
+
} catch {}
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
548
628
|
// ../../packages/core/src/agents/execution-host.ts
|
|
549
629
|
import { AsyncLocalStorage } from "async_hooks";
|
|
550
|
-
import { dirname as
|
|
630
|
+
import { dirname as dirname5 } from "path";
|
|
551
631
|
|
|
552
632
|
// ../../packages/core/src/security/sensitive-path.ts
|
|
553
633
|
import { realpathSync as realpathSync2 } from "fs";
|
|
@@ -1205,12 +1285,12 @@ function createBackgroundBashManager(options = {}) {
|
|
|
1205
1285
|
usedPorts.clear();
|
|
1206
1286
|
knownContexts.clear();
|
|
1207
1287
|
const deadline = now() + 3000;
|
|
1208
|
-
await Promise.all(entries.map((instance) => new Promise((
|
|
1288
|
+
await Promise.all(entries.map((instance) => new Promise((resolve) => {
|
|
1209
1289
|
if (instance.process.exitCode !== null || instance.process.killed)
|
|
1210
|
-
return
|
|
1211
|
-
instance.process.once("exit",
|
|
1212
|
-
instance.process.once("error",
|
|
1213
|
-
const timer = setTimeout(
|
|
1290
|
+
return resolve();
|
|
1291
|
+
instance.process.once("exit", resolve);
|
|
1292
|
+
instance.process.once("error", resolve);
|
|
1293
|
+
const timer = setTimeout(resolve, Math.max(0, deadline - now()));
|
|
1214
1294
|
timer.unref?.();
|
|
1215
1295
|
})));
|
|
1216
1296
|
}
|
|
@@ -1305,9 +1385,9 @@ var RESERVED_TOPIC_NAMES = new Set([
|
|
|
1305
1385
|
var GENERAL_TOPIC_ID = "general";
|
|
1306
1386
|
|
|
1307
1387
|
// ../../packages/core/src/storage/storage-host.ts
|
|
1308
|
-
import { mkdirSync as
|
|
1388
|
+
import { mkdirSync as mkdirSync4 } from "fs";
|
|
1309
1389
|
import { homedir as homedir2 } from "os";
|
|
1310
|
-
import { dirname as
|
|
1390
|
+
import { dirname as dirname4, join as join2, resolve as resolve5 } from "path";
|
|
1311
1391
|
|
|
1312
1392
|
// ../../packages/core/src/storage/sqlite.ts
|
|
1313
1393
|
var isBun = typeof process.versions.bun === "string";
|
|
@@ -1442,7 +1522,7 @@ function defaultDatabase() {
|
|
|
1442
1522
|
return state.fallbackDatabase;
|
|
1443
1523
|
if (state.fallbackDatabase)
|
|
1444
1524
|
closeDatabase(state.fallbackDatabase);
|
|
1445
|
-
|
|
1525
|
+
mkdirSync4(dirname4(path), { recursive: true });
|
|
1446
1526
|
state.fallbackDatabase = new Database(path, { create: true });
|
|
1447
1527
|
state.fallbackDatabasePath = path;
|
|
1448
1528
|
initializeDatabase(state.fallbackDatabase);
|
|
@@ -1642,7 +1722,7 @@ var SCHEMA_TRIGGERS = {
|
|
|
1642
1722
|
};
|
|
1643
1723
|
var OTIUM_TOPIC_SCOPE_IMMUTABLE_ERROR = "otium_topic_scope_immutable";
|
|
1644
1724
|
function topicLinkSchemaIsCurrent(database, nodeId) {
|
|
1645
|
-
const objects = new Map(database.query("SELECT name, sql FROM sqlite_master WHERE type IN ('table','index','trigger')").all().map((
|
|
1725
|
+
const objects = new Map(database.query("SELECT name, sql FROM sqlite_master WHERE type IN ('table','index','trigger')").all().map((row) => [row.name, row.sql ?? ""]));
|
|
1646
1726
|
for (const name of [...SCHEMA_TABLES, ...SCHEMA_INDEXES, ...SCHEMA_INDEXES_TOMBSTONES]) {
|
|
1647
1727
|
if (!objects.has(name))
|
|
1648
1728
|
return false;
|
|
@@ -1659,7 +1739,7 @@ function topicLinkSchemaIsCurrent(database, nodeId) {
|
|
|
1659
1739
|
return false;
|
|
1660
1740
|
}
|
|
1661
1741
|
const identity = database.query("SELECT node_id, epoch_id FROM api_node_identity WHERE singleton = 1").all();
|
|
1662
|
-
if (identity.some((
|
|
1742
|
+
if (identity.some((row) => row.epoch_id === null))
|
|
1663
1743
|
return false;
|
|
1664
1744
|
if (nodeId && identity[0]?.node_id !== nodeId)
|
|
1665
1745
|
return false;
|
|
@@ -2821,6 +2901,12 @@ refreshForumCatalogViews();
|
|
|
2821
2901
|
function isReservedRuntimeMcpServerName(name) {
|
|
2822
2902
|
return Object.hasOwn(MCP_CATALOG, name) || nodeMcpEntries.some((entry) => entry.key === name);
|
|
2823
2903
|
}
|
|
2904
|
+
var MANAGER_ONLY_HOST_MCP_NAMES = new Set(["topic-admin"]);
|
|
2905
|
+
function withoutManagerOnlyHostMcpServers(hostMcpServers) {
|
|
2906
|
+
if (!hostMcpServers)
|
|
2907
|
+
return;
|
|
2908
|
+
return Object.fromEntries(Object.entries(hostMcpServers).filter(([name]) => !MANAGER_ONLY_HOST_MCP_NAMES.has(name)));
|
|
2909
|
+
}
|
|
2824
2910
|
function mergeHostMcpServers(base, hostMcpServers) {
|
|
2825
2911
|
if (!hostMcpServers)
|
|
2826
2912
|
return base;
|
|
@@ -3048,7 +3134,7 @@ function getMcpServersForQuery(opts) {
|
|
|
3048
3134
|
fileDeliveryTools: opts.fileDeliveryTools
|
|
3049
3135
|
}), opts.hostMcpServers), opts.topicId);
|
|
3050
3136
|
}
|
|
3051
|
-
return hideProviderIntrospectionForOtium(getForumMcpServers({
|
|
3137
|
+
return hideProviderIntrospectionForOtium(mergeHostMcpServers(getForumMcpServers({
|
|
3052
3138
|
userId: opts.userId || "local",
|
|
3053
3139
|
actorUserId: opts.actorUserId,
|
|
3054
3140
|
actorTopicScope: opts.actorTopicScope,
|
|
@@ -3075,7 +3161,7 @@ function getMcpServersForQuery(opts) {
|
|
|
3075
3161
|
extra: opts.mcpExtra,
|
|
3076
3162
|
silent: opts.silent,
|
|
3077
3163
|
peerBridge: opts.peerBridge
|
|
3078
|
-
}), opts.topicId);
|
|
3164
|
+
}), withoutManagerOnlyHostMcpServers(opts.hostMcpServers)), opts.topicId);
|
|
3079
3165
|
}
|
|
3080
3166
|
function hideProviderIntrospectionForOtium(servers, topicId) {
|
|
3081
3167
|
if (!topicId || getTopic(topicId)?.surface !== "otium")
|
|
@@ -3087,7 +3173,7 @@ function hideProviderIntrospectionForOtium(servers, topicId) {
|
|
|
3087
3173
|
}
|
|
3088
3174
|
|
|
3089
3175
|
// ../../packages/core/src/storage/vault.ts
|
|
3090
|
-
import { chmodSync as chmodSync2, mkdirSync as
|
|
3176
|
+
import { chmodSync as chmodSync2, mkdirSync as mkdirSync5 } from "fs";
|
|
3091
3177
|
import { join as join3 } from "path";
|
|
3092
3178
|
|
|
3093
3179
|
// ../../packages/core/src/storage/vault-crypto-core.ts
|
|
@@ -3181,7 +3267,7 @@ function initializeVaultDatabase(database) {
|
|
|
3181
3267
|
function openVaultDatabase(dataDir) {
|
|
3182
3268
|
const vaultDir = join3(dataDir, "vault");
|
|
3183
3269
|
const path = join3(vaultDir, "vault.db");
|
|
3184
|
-
|
|
3270
|
+
mkdirSync5(vaultDir, { recursive: true, mode: 448 });
|
|
3185
3271
|
const database = new Database(path, { create: true });
|
|
3186
3272
|
chmodSync2(path, 384);
|
|
3187
3273
|
initializeVaultDatabase(database);
|
|
@@ -3302,97 +3388,13 @@ function hostedCodexAuthFilePath() {
|
|
|
3302
3388
|
return activeHost().codexAuthFilePath();
|
|
3303
3389
|
}
|
|
3304
3390
|
function hostedCodexHomePath() {
|
|
3305
|
-
return
|
|
3391
|
+
return dirname5(hostedCodexAuthFilePath());
|
|
3306
3392
|
}
|
|
3307
3393
|
|
|
3308
3394
|
// ../../packages/core/src/agents/rollout/codex.ts
|
|
3309
3395
|
import { randomBytes as randomBytes4 } from "crypto";
|
|
3310
3396
|
import { existsSync as existsSync3, readFileSync as readFileSync3, realpathSync as realpathSync3, statSync as statSync2, unlinkSync as unlinkSync3 } from "fs";
|
|
3311
3397
|
import { basename, dirname as dirname6, join as join4, resolve as resolve6 } from "path";
|
|
3312
|
-
|
|
3313
|
-
// ../../packages/core/src/platform/jsonl.ts
|
|
3314
|
-
import {
|
|
3315
|
-
appendFileSync,
|
|
3316
|
-
closeSync,
|
|
3317
|
-
fsyncSync,
|
|
3318
|
-
mkdirSync as mkdirSync5,
|
|
3319
|
-
openSync,
|
|
3320
|
-
readFileSync as readFileSync2,
|
|
3321
|
-
renameSync,
|
|
3322
|
-
statSync,
|
|
3323
|
-
unlinkSync as unlinkSync2,
|
|
3324
|
-
writeFileSync as writeFileSync2
|
|
3325
|
-
} from "fs";
|
|
3326
|
-
import { dirname as dirname5 } from "path";
|
|
3327
|
-
|
|
3328
|
-
// ../../packages/core/src/platform/file-utils.ts
|
|
3329
|
-
import { unlinkSync } from "fs";
|
|
3330
|
-
function createSafeUnlink(host) {
|
|
3331
|
-
return (path, warnLabel) => {
|
|
3332
|
-
try {
|
|
3333
|
-
host.unlink(path);
|
|
3334
|
-
} catch (e) {
|
|
3335
|
-
if (e?.code === "ENOENT")
|
|
3336
|
-
return;
|
|
3337
|
-
if (warnLabel)
|
|
3338
|
-
host.warn({ err: e, path }, warnLabel);
|
|
3339
|
-
}
|
|
3340
|
-
};
|
|
3341
|
-
}
|
|
3342
|
-
var defaultSafeUnlink = createSafeUnlink({
|
|
3343
|
-
unlink: unlinkSync,
|
|
3344
|
-
warn: (context, message) => logger.warn(context, message)
|
|
3345
|
-
});
|
|
3346
|
-
|
|
3347
|
-
// ../../packages/core/src/platform/jsonl.ts
|
|
3348
|
-
function parseJsonlText(raw) {
|
|
3349
|
-
return raw.trim().split(`
|
|
3350
|
-
`).filter(Boolean).map((line) => JSON.parse(line));
|
|
3351
|
-
}
|
|
3352
|
-
var LOCK_SLEEP = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
|
3353
|
-
function writeJsonlFile(filePath, entries) {
|
|
3354
|
-
const dir = dirname5(filePath);
|
|
3355
|
-
mkdirSync5(dir, { recursive: true });
|
|
3356
|
-
const tmpPath = `${filePath}.tmp-${process.pid}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
3357
|
-
const payload = `${entries.map((e) => JSON.stringify(e)).join(`
|
|
3358
|
-
`)}
|
|
3359
|
-
`;
|
|
3360
|
-
let fd = null;
|
|
3361
|
-
try {
|
|
3362
|
-
fd = openSync(tmpPath, "w");
|
|
3363
|
-
writeFileSync2(fd, payload);
|
|
3364
|
-
fsyncSync(fd);
|
|
3365
|
-
closeSync(fd);
|
|
3366
|
-
fd = null;
|
|
3367
|
-
renameSync(tmpPath, filePath);
|
|
3368
|
-
fsyncDirectoryBestEffort(dir);
|
|
3369
|
-
} catch (err) {
|
|
3370
|
-
if (fd !== null) {
|
|
3371
|
-
try {
|
|
3372
|
-
closeSync(fd);
|
|
3373
|
-
} catch {}
|
|
3374
|
-
}
|
|
3375
|
-
try {
|
|
3376
|
-
unlinkSync2(tmpPath);
|
|
3377
|
-
} catch {}
|
|
3378
|
-
throw err;
|
|
3379
|
-
}
|
|
3380
|
-
}
|
|
3381
|
-
function fsyncDirectoryBestEffort(dir) {
|
|
3382
|
-
let fd = null;
|
|
3383
|
-
try {
|
|
3384
|
-
fd = openSync(dir, "r");
|
|
3385
|
-
fsyncSync(fd);
|
|
3386
|
-
} catch {} finally {
|
|
3387
|
-
if (fd !== null) {
|
|
3388
|
-
try {
|
|
3389
|
-
closeSync(fd);
|
|
3390
|
-
} catch {}
|
|
3391
|
-
}
|
|
3392
|
-
}
|
|
3393
|
-
}
|
|
3394
|
-
|
|
3395
|
-
// ../../packages/core/src/agents/rollout/codex.ts
|
|
3396
3398
|
function codexSessionsDir() {
|
|
3397
3399
|
return join4(hostedCodexHomePath(), "sessions");
|
|
3398
3400
|
}
|
|
@@ -3459,7 +3461,7 @@ function patchEnvContext(envContext, cwd, currentDate, timezone) {
|
|
|
3459
3461
|
}
|
|
3460
3462
|
}
|
|
3461
3463
|
function codexRolloutPath(threadId, fallback) {
|
|
3462
|
-
const threadCreatedAt =
|
|
3464
|
+
const threadCreatedAt = decodeUuidV7Timestamp2(threadId);
|
|
3463
3465
|
const createdAt = threadCreatedAt === null ? fallback : new Date(threadCreatedAt);
|
|
3464
3466
|
const yyyy = String(createdAt.getFullYear());
|
|
3465
3467
|
const mm = String(createdAt.getMonth() + 1).padStart(2, "0");
|
|
@@ -3531,7 +3533,7 @@ function changedPatchLines(value) {
|
|
|
3531
3533
|
`) } : {}
|
|
3532
3534
|
};
|
|
3533
3535
|
}
|
|
3534
|
-
function
|
|
3536
|
+
function extractLatestCodexPatchPreview2(jsonl, expectedPaths, consumedCallIds = new Set, expectedCallId) {
|
|
3535
3537
|
const expected = expectedPaths.map(canonicalFilePath);
|
|
3536
3538
|
const lines = jsonl.trimEnd().split(`
|
|
3537
3539
|
`);
|
|
@@ -3568,7 +3570,7 @@ function extractLatestCodexPatchPreview(jsonl, expectedPaths, consumedCallIds =
|
|
|
3568
3570
|
}
|
|
3569
3571
|
return;
|
|
3570
3572
|
}
|
|
3571
|
-
function
|
|
3573
|
+
function extractCodexPatchCallIds2(jsonl) {
|
|
3572
3574
|
const callIds = [];
|
|
3573
3575
|
for (const line of jsonl.trimEnd().split(`
|
|
3574
3576
|
`)) {
|
|
@@ -3581,29 +3583,29 @@ function extractCodexPatchCallIds(jsonl) {
|
|
|
3581
3583
|
}
|
|
3582
3584
|
return callIds;
|
|
3583
3585
|
}
|
|
3584
|
-
function
|
|
3586
|
+
function readCodexPatchCallIds2(threadId) {
|
|
3585
3587
|
const path = latestCodexRolloutPath(threadId);
|
|
3586
3588
|
if (!path)
|
|
3587
3589
|
return [];
|
|
3588
3590
|
try {
|
|
3589
|
-
return
|
|
3591
|
+
return extractCodexPatchCallIds2(readFileSync3(path, "utf8"));
|
|
3590
3592
|
} catch (error) {
|
|
3591
3593
|
logger.debug({ error, threadId }, "codex patch ids: rollout read failed");
|
|
3592
3594
|
return [];
|
|
3593
3595
|
}
|
|
3594
3596
|
}
|
|
3595
|
-
function
|
|
3597
|
+
function readLatestCodexPatchPreview2(threadId, expectedPaths, consumedCallIds = new Set, expectedCallId) {
|
|
3596
3598
|
const path = latestCodexRolloutPath(threadId);
|
|
3597
3599
|
if (!path)
|
|
3598
3600
|
return;
|
|
3599
3601
|
try {
|
|
3600
|
-
return
|
|
3602
|
+
return extractLatestCodexPatchPreview2(readFileSync3(path, "utf8"), expectedPaths, consumedCallIds, expectedCallId);
|
|
3601
3603
|
} catch (error) {
|
|
3602
3604
|
logger.debug({ error, threadId }, "codex patch preview: rollout read failed");
|
|
3603
3605
|
return;
|
|
3604
3606
|
}
|
|
3605
3607
|
}
|
|
3606
|
-
function
|
|
3608
|
+
function extractLatestCodexContextUsage2(jsonl) {
|
|
3607
3609
|
const lines = jsonl.trimEnd().split(`
|
|
3608
3610
|
`);
|
|
3609
3611
|
for (let index = lines.length - 1;index >= 0; index -= 1) {
|
|
@@ -3620,18 +3622,18 @@ function extractLatestCodexContextUsage(jsonl) {
|
|
|
3620
3622
|
}
|
|
3621
3623
|
return;
|
|
3622
3624
|
}
|
|
3623
|
-
function
|
|
3625
|
+
function readLatestCodexContextUsage2(threadId) {
|
|
3624
3626
|
const path = latestCodexRolloutPath(threadId);
|
|
3625
3627
|
if (!path)
|
|
3626
3628
|
return;
|
|
3627
3629
|
try {
|
|
3628
|
-
return
|
|
3630
|
+
return extractLatestCodexContextUsage2(readFileSync3(path, "utf8"));
|
|
3629
3631
|
} catch (error) {
|
|
3630
3632
|
logger.debug({ error, threadId }, "codex context usage: rollout read failed");
|
|
3631
3633
|
return;
|
|
3632
3634
|
}
|
|
3633
3635
|
}
|
|
3634
|
-
function
|
|
3636
|
+
function migrateCodexRolloutNativeMultiAgentMetadata2(threadId) {
|
|
3635
3637
|
const path = latestCodexRolloutPath(threadId);
|
|
3636
3638
|
if (!path)
|
|
3637
3639
|
return false;
|
|
@@ -3686,11 +3688,11 @@ function latestCodexRolloutPath(threadId) {
|
|
|
3686
3688
|
return;
|
|
3687
3689
|
}
|
|
3688
3690
|
}
|
|
3689
|
-
function
|
|
3691
|
+
function writeCodexRollout2(opts) {
|
|
3690
3692
|
const threadId = opts.threadId ?? uuidv7();
|
|
3691
3693
|
assertUuidLike("threadId", threadId);
|
|
3692
3694
|
ensureCwdExists(opts.cwd);
|
|
3693
|
-
const pairs = opts.pairs ??
|
|
3695
|
+
const pairs = opts.pairs ?? extractChatPairs2(opts.entries ?? []);
|
|
3694
3696
|
const now = new Date;
|
|
3695
3697
|
const tsIso = now.toISOString();
|
|
3696
3698
|
const currentDate = [
|
|
@@ -3839,7 +3841,7 @@ var MAX_DAY_SPAN = 30;
|
|
|
3839
3841
|
var DAY_MS = 86400000;
|
|
3840
3842
|
var LOCAL_DATE_SKEW_DAYS = 1;
|
|
3841
3843
|
function candidateDateBuckets(threadId) {
|
|
3842
|
-
const tidMs =
|
|
3844
|
+
const tidMs = decodeUuidV7Timestamp2(threadId);
|
|
3843
3845
|
if (tidMs === null)
|
|
3844
3846
|
return null;
|
|
3845
3847
|
const nowMs = Date.now();
|
|
@@ -3856,7 +3858,7 @@ function candidateDateBuckets(threadId) {
|
|
|
3856
3858
|
}
|
|
3857
3859
|
return buckets;
|
|
3858
3860
|
}
|
|
3859
|
-
function
|
|
3861
|
+
function decodeUuidV7Timestamp2(threadId) {
|
|
3860
3862
|
if (typeof threadId !== "string")
|
|
3861
3863
|
return null;
|
|
3862
3864
|
const m = /^([0-9a-fA-F]{8})-([0-9a-fA-F]{4})-7[0-9a-fA-F]{3}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.exec(threadId);
|
|
@@ -3879,6 +3881,6 @@ function formatDateBucket(d) {
|
|
|
3879
3881
|
return `${yyyy}/${mm}/${dd}`;
|
|
3880
3882
|
}
|
|
3881
3883
|
|
|
3882
|
-
export {
|
|
3884
|
+
export { CLAUDE_EFFORT_VALUES, CODEX_EFFORT_VALUES, MAESTRO_EFFORT_VALUES, logger, MODEL_SONNET, MODEL_OPUS, MODEL_FABLE, configureRolloutHost2, FIXTURES_DIR, clone, assertUuidLike, ensureCwdExists, extractChatPairs2, parseJsonlText, writeJsonlFile, hostedCodexHomePath, extractLatestCodexPatchPreview2, extractCodexPatchCallIds2, readCodexPatchCallIds2, readLatestCodexPatchPreview2, extractLatestCodexContextUsage2, readLatestCodexContextUsage2, migrateCodexRolloutNativeMultiAgentMetadata2, latestCodexRolloutPath, writeCodexRollout2, decodeUuidV7Timestamp2 };
|
|
3883
3885
|
|
|
3884
|
-
//# debugId=
|
|
3886
|
+
//# debugId=D6748D5B00827E4364756E2164756E21
|