claude-use 11.4.0 → 11.5.0
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.cjs +335 -64
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/types/index.d.ts +6 -6
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -23007,7 +23007,7 @@ var require_dumper = __commonJS({
|
|
|
23007
23007
|
}
|
|
23008
23008
|
return false;
|
|
23009
23009
|
}
|
|
23010
|
-
function
|
|
23010
|
+
function isWhitespace2(c10) {
|
|
23011
23011
|
return c10 === CHAR_SPACE || c10 === CHAR_TAB;
|
|
23012
23012
|
}
|
|
23013
23013
|
function isPrintable(c10) {
|
|
@@ -23019,19 +23019,19 @@ var require_dumper = __commonJS({
|
|
|
23019
23019
|
}
|
|
23020
23020
|
function isPlainSafe(c10, prev, inblock) {
|
|
23021
23021
|
const cIsNsCharOrWhitespace = isNsCharOrWhitespace(c10);
|
|
23022
|
-
const cIsNsChar = cIsNsCharOrWhitespace && !
|
|
23022
|
+
const cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace2(c10);
|
|
23023
23023
|
return (
|
|
23024
23024
|
// ns-plain-safe
|
|
23025
23025
|
(inblock ? cIsNsCharOrWhitespace : cIsNsCharOrWhitespace && // - c-flow-indicator
|
|
23026
23026
|
c10 !== CHAR_COMMA && c10 !== CHAR_LEFT_SQUARE_BRACKET && c10 !== CHAR_RIGHT_SQUARE_BRACKET && c10 !== CHAR_LEFT_CURLY_BRACKET && c10 !== CHAR_RIGHT_CURLY_BRACKET) && // ns-plain-char
|
|
23027
23027
|
c10 !== CHAR_SHARP && // false on '#'
|
|
23028
23028
|
!(prev === CHAR_COLON && !cIsNsChar) || // false on ': '
|
|
23029
|
-
isNsCharOrWhitespace(prev) && !
|
|
23029
|
+
isNsCharOrWhitespace(prev) && !isWhitespace2(prev) && c10 === CHAR_SHARP || // change to true on '[^ ]#'
|
|
23030
23030
|
prev === CHAR_COLON && cIsNsChar
|
|
23031
23031
|
);
|
|
23032
23032
|
}
|
|
23033
23033
|
function isPlainSafeFirst(c10) {
|
|
23034
|
-
return isPrintable(c10) && c10 !== CHAR_BOM && !
|
|
23034
|
+
return isPrintable(c10) && c10 !== CHAR_BOM && !isWhitespace2(c10) && // - s-white
|
|
23035
23035
|
// - (c-indicator ::=
|
|
23036
23036
|
// “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}”
|
|
23037
23037
|
c10 !== CHAR_MINUS && c10 !== CHAR_QUESTION && c10 !== CHAR_COLON && c10 !== CHAR_COMMA && c10 !== CHAR_LEFT_SQUARE_BRACKET && c10 !== CHAR_RIGHT_SQUARE_BRACKET && c10 !== CHAR_LEFT_CURLY_BRACKET && c10 !== CHAR_RIGHT_CURLY_BRACKET && // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"”
|
|
@@ -23039,7 +23039,7 @@ var require_dumper = __commonJS({
|
|
|
23039
23039
|
c10 !== CHAR_PERCENT && c10 !== CHAR_COMMERCIAL_AT && c10 !== CHAR_GRAVE_ACCENT;
|
|
23040
23040
|
}
|
|
23041
23041
|
function isPlainSafeLast(c10) {
|
|
23042
|
-
return !
|
|
23042
|
+
return !isWhitespace2(c10) && c10 !== CHAR_COLON;
|
|
23043
23043
|
}
|
|
23044
23044
|
function codePointAt(string4, pos) {
|
|
23045
23045
|
const first = string4.charCodeAt(pos);
|
|
@@ -27111,7 +27111,7 @@ var init_schema = __esm({
|
|
|
27111
27111
|
context.addIssue({ code: "custom", path: ["readMaturation"], message: "readMaturation needs rolloutChannel beta or dev" });
|
|
27112
27112
|
}
|
|
27113
27113
|
});
|
|
27114
|
-
HEADROOM_DEFAULT_SOURCE = "headroom-ai[proxy] @ git+https://github.com/ExaDev/headroom@
|
|
27114
|
+
HEADROOM_DEFAULT_SOURCE = "headroom-ai[proxy] @ git+https://github.com/ExaDev/headroom@2dfa958e47814533751cdd0c5362d8f352ec5b75";
|
|
27115
27115
|
HEADROOM_DEFAULT_IDLE_SHUTDOWN_MINUTES = 15;
|
|
27116
27116
|
FRONTDOOR_DEFAULT_IDLE_SHUTDOWN_MINUTES = 15;
|
|
27117
27117
|
FrontDoorGlobalConfigSchema = external_exports.strictObject({
|
|
@@ -31952,9 +31952,9 @@ function referencesFact(when, key) {
|
|
|
31952
31952
|
if (when === void 0 || !("kind" in when)) {
|
|
31953
31953
|
return false;
|
|
31954
31954
|
}
|
|
31955
|
-
const
|
|
31955
|
+
const walk2 = (node2) => {
|
|
31956
31956
|
if (Array.isArray(node2)) {
|
|
31957
|
-
return node2.some(
|
|
31957
|
+
return node2.some(walk2);
|
|
31958
31958
|
}
|
|
31959
31959
|
if (typeof node2 !== "object" || node2 === null) {
|
|
31960
31960
|
return false;
|
|
@@ -31962,9 +31962,9 @@ function referencesFact(when, key) {
|
|
|
31962
31962
|
if ("kind" in node2 && node2.kind === "reference" && "key" in node2 && node2.key === key) {
|
|
31963
31963
|
return true;
|
|
31964
31964
|
}
|
|
31965
|
-
return Object.values(node2).some(
|
|
31965
|
+
return Object.values(node2).some(walk2);
|
|
31966
31966
|
};
|
|
31967
|
-
return
|
|
31967
|
+
return walk2(when);
|
|
31968
31968
|
}
|
|
31969
31969
|
function isVacuousWhen(when) {
|
|
31970
31970
|
return when !== void 0 && !("kind" in when) && Object.keys(when).length === 0;
|
|
@@ -33976,7 +33976,7 @@ var init_package = __esm({
|
|
|
33976
33976
|
"package.json"() {
|
|
33977
33977
|
package_default = {
|
|
33978
33978
|
name: "claude-use",
|
|
33979
|
-
version: "11.
|
|
33979
|
+
version: "11.5.0",
|
|
33980
33980
|
description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
|
|
33981
33981
|
license: "MIT",
|
|
33982
33982
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -34635,7 +34635,7 @@ function createUsageMiddleware(deps) {
|
|
|
34635
34635
|
const endedAt = deps.now();
|
|
34636
34636
|
deps.defer(() => {
|
|
34637
34637
|
try {
|
|
34638
|
-
deps.record(buildRecord(event, { headAt, endedAt, outcome, scan: scanning && scanner !== void 0 ? scanner.result() : void 0 }));
|
|
34638
|
+
deps.record(buildRecord(event, { headAt, endedAt, outcome, scan: scanning && scanner !== void 0 ? scanner.result() : void 0 }), event);
|
|
34639
34639
|
} catch (error63) {
|
|
34640
34640
|
deps.log(`usage: could not record ${event.method} ${event.path} (${String(event.status)}): ${error63 instanceof Error ? error63.message : String(error63)}`);
|
|
34641
34641
|
}
|
|
@@ -40329,7 +40329,7 @@ var require_webidl = __commonJS({
|
|
|
40329
40329
|
var { runtimeFeatures } = require_runtime_features();
|
|
40330
40330
|
var UNDEFINED = 1;
|
|
40331
40331
|
var BOOLEAN = 2;
|
|
40332
|
-
var
|
|
40332
|
+
var STRING2 = 3;
|
|
40333
40333
|
var SYMBOL = 4;
|
|
40334
40334
|
var NUMBER = 5;
|
|
40335
40335
|
var BIGINT = 6;
|
|
@@ -40400,7 +40400,7 @@ var require_webidl = __commonJS({
|
|
|
40400
40400
|
case "boolean":
|
|
40401
40401
|
return BOOLEAN;
|
|
40402
40402
|
case "string":
|
|
40403
|
-
return
|
|
40403
|
+
return STRING2;
|
|
40404
40404
|
case "symbol":
|
|
40405
40405
|
return SYMBOL;
|
|
40406
40406
|
case "number":
|
|
@@ -40419,7 +40419,7 @@ var require_webidl = __commonJS({
|
|
|
40419
40419
|
webidl.util.Types = {
|
|
40420
40420
|
UNDEFINED,
|
|
40421
40421
|
BOOLEAN,
|
|
40422
|
-
STRING,
|
|
40422
|
+
STRING: STRING2,
|
|
40423
40423
|
SYMBOL,
|
|
40424
40424
|
NUMBER,
|
|
40425
40425
|
BIGINT,
|
|
@@ -40432,7 +40432,7 @@ var require_webidl = __commonJS({
|
|
|
40432
40432
|
return "Undefined";
|
|
40433
40433
|
case BOOLEAN:
|
|
40434
40434
|
return "Boolean";
|
|
40435
|
-
case
|
|
40435
|
+
case STRING2:
|
|
40436
40436
|
return "String";
|
|
40437
40437
|
case SYMBOL:
|
|
40438
40438
|
return "Symbol";
|
|
@@ -40518,7 +40518,7 @@ var require_webidl = __commonJS({
|
|
|
40518
40518
|
return `Symbol(${V7.description})`;
|
|
40519
40519
|
case OBJECT:
|
|
40520
40520
|
return inspect(V7);
|
|
40521
|
-
case
|
|
40521
|
+
case STRING2:
|
|
40522
40522
|
return `"${V7}"`;
|
|
40523
40523
|
case BIGINT:
|
|
40524
40524
|
return `${V7}n`;
|
|
@@ -60955,8 +60955,8 @@ var require_eventsource_stream = __commonJS({
|
|
|
60955
60955
|
var BOM = [239, 187, 191];
|
|
60956
60956
|
var LF3 = 10;
|
|
60957
60957
|
var CR3 = 13;
|
|
60958
|
-
var
|
|
60959
|
-
var
|
|
60958
|
+
var COLON2 = 58;
|
|
60959
|
+
var SPACE3 = 32;
|
|
60960
60960
|
var DATA = Buffer.from("data");
|
|
60961
60961
|
var EVENT = Buffer.from("event");
|
|
60962
60962
|
var ID2 = Buffer.from("id");
|
|
@@ -61101,7 +61101,7 @@ var require_eventsource_stream = __commonJS({
|
|
|
61101
61101
|
if (line.length === 0) {
|
|
61102
61102
|
return;
|
|
61103
61103
|
}
|
|
61104
|
-
const colonPosition = line.indexOf(
|
|
61104
|
+
const colonPosition = line.indexOf(COLON2);
|
|
61105
61105
|
if (colonPosition === 0) {
|
|
61106
61106
|
return;
|
|
61107
61107
|
}
|
|
@@ -61110,7 +61110,7 @@ var require_eventsource_stream = __commonJS({
|
|
|
61110
61110
|
if (colonPosition !== -1) {
|
|
61111
61111
|
fieldLength = colonPosition;
|
|
61112
61112
|
valueStart = colonPosition + 1;
|
|
61113
|
-
if (line[valueStart] ===
|
|
61113
|
+
if (line[valueStart] === SPACE3) {
|
|
61114
61114
|
++valueStart;
|
|
61115
61115
|
}
|
|
61116
61116
|
}
|
|
@@ -61304,7 +61304,7 @@ var require_eventsource = __commonJS({
|
|
|
61304
61304
|
var experimentalWarned = false;
|
|
61305
61305
|
var defaultReconnectionTime = 3e3;
|
|
61306
61306
|
var CONNECTING = 0;
|
|
61307
|
-
var
|
|
61307
|
+
var OPEN2 = 1;
|
|
61308
61308
|
var CLOSED = 2;
|
|
61309
61309
|
var ANONYMOUS = "anonymous";
|
|
61310
61310
|
var USE_CREDENTIALS = "use-credentials";
|
|
@@ -61437,7 +61437,7 @@ var require_eventsource = __commonJS({
|
|
|
61437
61437
|
this.dispatchEvent(new Event("error"));
|
|
61438
61438
|
return;
|
|
61439
61439
|
}
|
|
61440
|
-
this.#readyState =
|
|
61440
|
+
this.#readyState = OPEN2;
|
|
61441
61441
|
this.dispatchEvent(new Event("open"));
|
|
61442
61442
|
this.#state.origin = response.urlList[response.urlList.length - 1].origin;
|
|
61443
61443
|
const eventSourceStream = new EventSourceStream({
|
|
@@ -61547,7 +61547,7 @@ var require_eventsource = __commonJS({
|
|
|
61547
61547
|
__proto__: null,
|
|
61548
61548
|
configurable: false,
|
|
61549
61549
|
enumerable: true,
|
|
61550
|
-
value:
|
|
61550
|
+
value: OPEN2,
|
|
61551
61551
|
writable: false
|
|
61552
61552
|
},
|
|
61553
61553
|
CLOSED: {
|
|
@@ -62357,7 +62357,7 @@ function isAnthropicUsageStale(member, nowMs) {
|
|
|
62357
62357
|
function poolIdentityNames(pools, poolName) {
|
|
62358
62358
|
const seenPools = /* @__PURE__ */ new Set();
|
|
62359
62359
|
const identities = /* @__PURE__ */ new Set();
|
|
62360
|
-
const
|
|
62360
|
+
const walk2 = (name) => {
|
|
62361
62361
|
const pool = pools[name];
|
|
62362
62362
|
if (pool === void 0 || seenPools.has(name)) {
|
|
62363
62363
|
return;
|
|
@@ -62369,11 +62369,11 @@ function poolIdentityNames(pools, poolName) {
|
|
|
62369
62369
|
if (nested === void 0) {
|
|
62370
62370
|
identities.add(member);
|
|
62371
62371
|
} else {
|
|
62372
|
-
|
|
62372
|
+
walk2(nested);
|
|
62373
62373
|
}
|
|
62374
62374
|
}
|
|
62375
62375
|
};
|
|
62376
|
-
|
|
62376
|
+
walk2(poolName);
|
|
62377
62377
|
return [...identities];
|
|
62378
62378
|
}
|
|
62379
62379
|
function describeError(error63) {
|
|
@@ -109499,7 +109499,7 @@ function writePools(paths, pools) {
|
|
|
109499
109499
|
applyPatch(paths.globalConfigFile, GlobalConfigSchema, { pools }, { defaults: {} });
|
|
109500
109500
|
}
|
|
109501
109501
|
function poolCycleOf(pools, name) {
|
|
109502
|
-
const
|
|
109502
|
+
const walk2 = (current, path59) => {
|
|
109503
109503
|
for (const entry of pools[current]?.identities ?? []) {
|
|
109504
109504
|
const nested = poolNameOf(poolMemberIdentity(entry));
|
|
109505
109505
|
if (nested === void 0) {
|
|
@@ -109511,14 +109511,14 @@ function poolCycleOf(pools, name) {
|
|
|
109511
109511
|
if (path59.includes(nested)) {
|
|
109512
109512
|
continue;
|
|
109513
109513
|
}
|
|
109514
|
-
const found =
|
|
109514
|
+
const found = walk2(nested, [...path59, nested]);
|
|
109515
109515
|
if (found !== void 0) {
|
|
109516
109516
|
return found;
|
|
109517
109517
|
}
|
|
109518
109518
|
}
|
|
109519
109519
|
return void 0;
|
|
109520
109520
|
};
|
|
109521
|
-
return
|
|
109521
|
+
return walk2(name, [name]);
|
|
109522
109522
|
}
|
|
109523
109523
|
function validateMembers(pools, name, members2) {
|
|
109524
109524
|
for (const entry of members2) {
|
|
@@ -112452,7 +112452,7 @@ function registerCodexCommand(program2, deps) {
|
|
|
112452
112452
|
}
|
|
112453
112453
|
|
|
112454
112454
|
// src/frontdoor/commands.ts
|
|
112455
|
-
var
|
|
112455
|
+
var import_node_crypto21 = require("node:crypto");
|
|
112456
112456
|
var import_node_path51 = __toESM(require("node:path"), 1);
|
|
112457
112457
|
var import_node_fs18 = __toESM(require("node:fs"), 1);
|
|
112458
112458
|
init_commandDeps();
|
|
@@ -113671,8 +113671,11 @@ function createRoutingSettingReader(paths) {
|
|
|
113671
113671
|
|
|
113672
113672
|
// src/frontdoor/headroomDecision.ts
|
|
113673
113673
|
init_pick();
|
|
113674
|
+
var CONSECUTIVE_PREFIX_MISSES = 2;
|
|
113675
|
+
var SHORTEST_PROMPT_CACHE_TTL_MS = 3e5;
|
|
113674
113676
|
function createHeadroomDecision(setting) {
|
|
113675
113677
|
const sessions = /* @__PURE__ */ new Map();
|
|
113678
|
+
const threads = /* @__PURE__ */ new Map();
|
|
113676
113679
|
return {
|
|
113677
113680
|
decide: async (sessionId, launchFlag, nowMs, available) => {
|
|
113678
113681
|
const choice = choiceFor(setting(), sessionId);
|
|
@@ -113683,29 +113686,46 @@ function createHeadroomDecision(setting) {
|
|
|
113683
113686
|
const state = sessions.get(sessionId);
|
|
113684
113687
|
const forced = choice?.force !== void 0 && choice.force !== state?.appliedForce;
|
|
113685
113688
|
const atBoundary = forced || state === void 0 || nowMs - state.lastEndedAtMs > PROMPT_CACHE_TTL_MS || state.cacheSurplusTokens <= 0;
|
|
113686
|
-
const
|
|
113689
|
+
const prefixBroken = state?.prefixBroken ?? false;
|
|
113690
|
+
const viaHeadroom = atBoundary ? wanted && !prefixBroken && await available() : state.viaHeadroom;
|
|
113687
113691
|
sessions.set(sessionId, {
|
|
113688
113692
|
viaHeadroom,
|
|
113689
113693
|
lastEndedAtMs: state?.lastEndedAtMs ?? nowMs,
|
|
113690
113694
|
cacheSurplusTokens: state?.cacheSurplusTokens ?? 0,
|
|
113691
|
-
appliedForce: choice?.force ?? state?.appliedForce
|
|
113695
|
+
appliedForce: choice?.force ?? state?.appliedForce,
|
|
113696
|
+
prefixMisses: state?.prefixMisses ?? 0,
|
|
113697
|
+
prefixBroken
|
|
113692
113698
|
});
|
|
113693
113699
|
return viaHeadroom;
|
|
113694
113700
|
},
|
|
113695
|
-
observe: ({ sessionId, endedAtMs, cache }) => {
|
|
113701
|
+
observe: ({ sessionId, startedAtMs, endedAtMs, viaHeadroom, lineage, cache }) => {
|
|
113696
113702
|
if (sessionId === void 0 || cache === void 0) {
|
|
113697
113703
|
return;
|
|
113698
113704
|
}
|
|
113699
113705
|
const cacheSurplusTokens = cache.readTokens - cache.writtenTokens - cache.uncachedTokens;
|
|
113700
113706
|
const state = sessions.get(sessionId);
|
|
113707
|
+
let { prefixMisses, prefixBroken } = state ?? { prefixMisses: 0, prefixBroken: false };
|
|
113708
|
+
if (lineage !== void 0) {
|
|
113709
|
+
const previous = lineage.parentKey === void 0 ? void 0 : threads.get(`${sessionId}:${lineage.parentKey}`);
|
|
113710
|
+
if (previous !== void 0 && previous.viaHeadroom && viaHeadroom && startedAtMs - previous.endedAtMs <= SHORTEST_PROMPT_CACHE_TTL_MS) {
|
|
113711
|
+
prefixMisses = cache.readTokens < previous.cachedTokens ? prefixMisses + 1 : 0;
|
|
113712
|
+
prefixBroken = prefixBroken || prefixMisses >= CONSECUTIVE_PREFIX_MISSES;
|
|
113713
|
+
}
|
|
113714
|
+
threads.set(`${sessionId}:${lineage.ownKey}`, { cachedTokens: cache.readTokens + cache.writtenTokens, endedAtMs, viaHeadroom });
|
|
113715
|
+
}
|
|
113701
113716
|
if (state !== void 0) {
|
|
113702
|
-
sessions.set(sessionId, { ...state, lastEndedAtMs: endedAtMs, cacheSurplusTokens });
|
|
113717
|
+
sessions.set(sessionId, { ...state, lastEndedAtMs: endedAtMs, cacheSurplusTokens, prefixMisses, prefixBroken });
|
|
113703
113718
|
}
|
|
113704
113719
|
for (const [id2, held] of sessions) {
|
|
113705
113720
|
if (endedAtMs - held.lastEndedAtMs > PROMPT_CACHE_TTL_MS) {
|
|
113706
113721
|
sessions.delete(id2);
|
|
113707
113722
|
}
|
|
113708
113723
|
}
|
|
113724
|
+
for (const [id2, point] of threads) {
|
|
113725
|
+
if (endedAtMs - point.endedAtMs > PROMPT_CACHE_TTL_MS) {
|
|
113726
|
+
threads.delete(id2);
|
|
113727
|
+
}
|
|
113728
|
+
}
|
|
113709
113729
|
}
|
|
113710
113730
|
};
|
|
113711
113731
|
}
|
|
@@ -126414,6 +126434,212 @@ function createLaunchEventPublisher(hub, now) {
|
|
|
126414
126434
|
var http4 = __toESM(require("node:http"), 1);
|
|
126415
126435
|
var import_consumers = require("node:stream/consumers");
|
|
126416
126436
|
init_route();
|
|
126437
|
+
|
|
126438
|
+
// src/frontdoor/lineage.ts
|
|
126439
|
+
var import_node_crypto18 = require("node:crypto");
|
|
126440
|
+
var CACHE_MARKER_KEY = '"cache_control"';
|
|
126441
|
+
var THREAD_MEMBER_KEYS = /* @__PURE__ */ new Set(['"model"', '"system"', '"tools"']);
|
|
126442
|
+
var MESSAGES_KEY = '"messages"';
|
|
126443
|
+
var NESTING_DEPTH_LIMIT = 64;
|
|
126444
|
+
var MESSAGES_PER_REQUEST_LIMIT = 1e5;
|
|
126445
|
+
var CONTEXT_WINDOW_TOKENS = 1e6;
|
|
126446
|
+
var BYTES_PER_TOKEN = 4;
|
|
126447
|
+
var LINEAGE_BODY_BYTES_LIMIT = CONTEXT_WINDOW_TOKENS * BYTES_PER_TOKEN;
|
|
126448
|
+
var MESSAGES_ARRAY_DEPTH = 2;
|
|
126449
|
+
var MESSAGES_PER_TURN = 2;
|
|
126450
|
+
var QUOTE = 34;
|
|
126451
|
+
var BACKSLASH = 92;
|
|
126452
|
+
var OPEN_BRACE = 123;
|
|
126453
|
+
var CLOSE_BRACE = 125;
|
|
126454
|
+
var OPEN_BRACKET = 91;
|
|
126455
|
+
var CLOSE_BRACKET = 93;
|
|
126456
|
+
var COLON = 58;
|
|
126457
|
+
var COMMA = 44;
|
|
126458
|
+
var SEPARATOR = Buffer.from([0]);
|
|
126459
|
+
var SPACE2 = 32;
|
|
126460
|
+
var TAB = 9;
|
|
126461
|
+
var LINE_FEED2 = 10;
|
|
126462
|
+
var CARRIAGE_RETURN = 13;
|
|
126463
|
+
function isWhitespace(byte) {
|
|
126464
|
+
return byte === SPACE2 || byte === TAB || byte === LINE_FEED2 || byte === CARRIAGE_RETURN;
|
|
126465
|
+
}
|
|
126466
|
+
var STRING = 1;
|
|
126467
|
+
var OPEN = 2;
|
|
126468
|
+
var CLOSE = 3;
|
|
126469
|
+
var COLON_TOKEN = 4;
|
|
126470
|
+
var COMMA_TOKEN = 5;
|
|
126471
|
+
var SCALAR = 6;
|
|
126472
|
+
var END = 0;
|
|
126473
|
+
var tokenStart = 0;
|
|
126474
|
+
var tokenEnd = 0;
|
|
126475
|
+
function nextToken(body, from) {
|
|
126476
|
+
let index = from;
|
|
126477
|
+
while (index < body.length && isWhitespace(body[index] ?? 0)) {
|
|
126478
|
+
index += 1;
|
|
126479
|
+
}
|
|
126480
|
+
if (index >= body.length) {
|
|
126481
|
+
return END;
|
|
126482
|
+
}
|
|
126483
|
+
tokenStart = index;
|
|
126484
|
+
const byte = body[index] ?? 0;
|
|
126485
|
+
if (byte === QUOTE) {
|
|
126486
|
+
let end = index + 1;
|
|
126487
|
+
while (end < body.length && body[end] !== QUOTE) {
|
|
126488
|
+
end += body[end] === BACKSLASH ? 2 : 1;
|
|
126489
|
+
}
|
|
126490
|
+
tokenEnd = Math.min(end + 1, body.length);
|
|
126491
|
+
return STRING;
|
|
126492
|
+
}
|
|
126493
|
+
tokenEnd = index + 1;
|
|
126494
|
+
if (byte === OPEN_BRACE || byte === OPEN_BRACKET) {
|
|
126495
|
+
return OPEN;
|
|
126496
|
+
}
|
|
126497
|
+
if (byte === CLOSE_BRACE || byte === CLOSE_BRACKET) {
|
|
126498
|
+
return CLOSE;
|
|
126499
|
+
}
|
|
126500
|
+
if (byte === COLON) {
|
|
126501
|
+
return COLON_TOKEN;
|
|
126502
|
+
}
|
|
126503
|
+
if (byte === COMMA) {
|
|
126504
|
+
return COMMA_TOKEN;
|
|
126505
|
+
}
|
|
126506
|
+
while (tokenEnd < body.length) {
|
|
126507
|
+
const next = body[tokenEnd] ?? 0;
|
|
126508
|
+
if (isWhitespace(next) || next === COMMA || next === CLOSE_BRACE || next === CLOSE_BRACKET || next === COLON) {
|
|
126509
|
+
break;
|
|
126510
|
+
}
|
|
126511
|
+
tokenEnd += 1;
|
|
126512
|
+
}
|
|
126513
|
+
return SCALAR;
|
|
126514
|
+
}
|
|
126515
|
+
function walk(body, hashing, parentAfter) {
|
|
126516
|
+
const thread = (0, import_node_crypto18.createHash)("sha256");
|
|
126517
|
+
const messages = (0, import_node_crypto18.createHash)("sha256");
|
|
126518
|
+
let parentDigest;
|
|
126519
|
+
let elements = 0;
|
|
126520
|
+
let depth = 0;
|
|
126521
|
+
let topKey;
|
|
126522
|
+
let inMessages = false;
|
|
126523
|
+
let sawMessages = false;
|
|
126524
|
+
const expectKey = [];
|
|
126525
|
+
let skipUntilDepth;
|
|
126526
|
+
let skipNextValue = false;
|
|
126527
|
+
const elementEnded = () => {
|
|
126528
|
+
elements += 1;
|
|
126529
|
+
if (hashing && parentAfter !== void 0 && elements === parentAfter) {
|
|
126530
|
+
parentDigest = messages.copy().digest("hex");
|
|
126531
|
+
}
|
|
126532
|
+
return elements > MESSAGES_PER_REQUEST_LIMIT;
|
|
126533
|
+
};
|
|
126534
|
+
const overLimit = () => ({ abandoned: true, sawMessages, elements, threadDigest: "", messagesDigest: "", parentDigest: void 0 });
|
|
126535
|
+
let cursor3 = 0;
|
|
126536
|
+
let lexicalTokens = 0;
|
|
126537
|
+
for (; ; ) {
|
|
126538
|
+
const kind = nextToken(body, cursor3);
|
|
126539
|
+
if (kind === END) {
|
|
126540
|
+
break;
|
|
126541
|
+
}
|
|
126542
|
+
lexicalTokens += 1;
|
|
126543
|
+
if (lexicalTokens > CONTEXT_WINDOW_TOKENS) {
|
|
126544
|
+
return overLimit();
|
|
126545
|
+
}
|
|
126546
|
+
const start = tokenStart;
|
|
126547
|
+
const end = tokenEnd;
|
|
126548
|
+
cursor3 = end;
|
|
126549
|
+
if (skipUntilDepth !== void 0) {
|
|
126550
|
+
if (kind === OPEN) {
|
|
126551
|
+
depth += 1;
|
|
126552
|
+
} else if (kind === CLOSE) {
|
|
126553
|
+
depth -= 1;
|
|
126554
|
+
if (depth === skipUntilDepth) {
|
|
126555
|
+
skipUntilDepth = void 0;
|
|
126556
|
+
}
|
|
126557
|
+
}
|
|
126558
|
+
continue;
|
|
126559
|
+
}
|
|
126560
|
+
if (kind === COMMA_TOKEN) {
|
|
126561
|
+
if (depth >= 1) {
|
|
126562
|
+
expectKey[depth - 1] = true;
|
|
126563
|
+
}
|
|
126564
|
+
continue;
|
|
126565
|
+
}
|
|
126566
|
+
if (kind === COLON_TOKEN) {
|
|
126567
|
+
if (depth >= 1) {
|
|
126568
|
+
expectKey[depth - 1] = false;
|
|
126569
|
+
}
|
|
126570
|
+
if (skipNextValue) {
|
|
126571
|
+
skipNextValue = false;
|
|
126572
|
+
const valueKind = nextToken(body, cursor3);
|
|
126573
|
+
if (valueKind !== END) {
|
|
126574
|
+
cursor3 = tokenEnd;
|
|
126575
|
+
if (valueKind === OPEN) {
|
|
126576
|
+
skipUntilDepth = depth;
|
|
126577
|
+
depth += 1;
|
|
126578
|
+
}
|
|
126579
|
+
}
|
|
126580
|
+
}
|
|
126581
|
+
continue;
|
|
126582
|
+
}
|
|
126583
|
+
const isKey = kind === STRING && depth >= 1 && expectKey[depth - 1] === true;
|
|
126584
|
+
const text2 = isKey ? body.toString("latin1", start, end) : void 0;
|
|
126585
|
+
if (isKey && text2 === CACHE_MARKER_KEY) {
|
|
126586
|
+
skipNextValue = true;
|
|
126587
|
+
continue;
|
|
126588
|
+
}
|
|
126589
|
+
if (depth === 1 && isKey) {
|
|
126590
|
+
topKey = text2;
|
|
126591
|
+
}
|
|
126592
|
+
const closesMessages = kind === CLOSE && inMessages && depth === MESSAGES_ARRAY_DEPTH;
|
|
126593
|
+
if (hashing && !closesMessages && !(depth === 1 && isKey && !THREAD_MEMBER_KEYS.has(text2 ?? ""))) {
|
|
126594
|
+
const target = inMessages ? messages : depth >= 1 && topKey !== void 0 && THREAD_MEMBER_KEYS.has(topKey) ? thread : void 0;
|
|
126595
|
+
if (target !== void 0) {
|
|
126596
|
+
target.update(body.subarray(start, end));
|
|
126597
|
+
target.update(SEPARATOR);
|
|
126598
|
+
}
|
|
126599
|
+
}
|
|
126600
|
+
if (kind === OPEN) {
|
|
126601
|
+
if (depth >= NESTING_DEPTH_LIMIT) {
|
|
126602
|
+
return { abandoned: true, sawMessages, elements, threadDigest: "", messagesDigest: "", parentDigest: void 0 };
|
|
126603
|
+
}
|
|
126604
|
+
const startsMessages = depth === 1 && topKey === MESSAGES_KEY && body[start] === OPEN_BRACKET && !sawMessages;
|
|
126605
|
+
depth += 1;
|
|
126606
|
+
expectKey.push(body[start] === OPEN_BRACE);
|
|
126607
|
+
if (startsMessages) {
|
|
126608
|
+
inMessages = true;
|
|
126609
|
+
sawMessages = true;
|
|
126610
|
+
}
|
|
126611
|
+
} else if (kind === CLOSE) {
|
|
126612
|
+
expectKey.pop();
|
|
126613
|
+
depth -= 1;
|
|
126614
|
+
if (inMessages && depth === 1) {
|
|
126615
|
+
inMessages = false;
|
|
126616
|
+
} else if (inMessages && depth === 2 && elementEnded()) {
|
|
126617
|
+
return overLimit();
|
|
126618
|
+
}
|
|
126619
|
+
} else if (inMessages && depth === 2 && kind === SCALAR && elementEnded()) {
|
|
126620
|
+
return overLimit();
|
|
126621
|
+
}
|
|
126622
|
+
if (depth < 0) {
|
|
126623
|
+
break;
|
|
126624
|
+
}
|
|
126625
|
+
}
|
|
126626
|
+
return { abandoned: false, sawMessages, elements, threadDigest: thread.digest("hex"), messagesDigest: messages.digest("hex"), parentDigest };
|
|
126627
|
+
}
|
|
126628
|
+
function lineageOf(body) {
|
|
126629
|
+
if (body.length > LINEAGE_BODY_BYTES_LIMIT) {
|
|
126630
|
+
return void 0;
|
|
126631
|
+
}
|
|
126632
|
+
const counted = walk(body, false, void 0);
|
|
126633
|
+
if (counted.abandoned || !counted.sawMessages) {
|
|
126634
|
+
return void 0;
|
|
126635
|
+
}
|
|
126636
|
+
const parentAfter = counted.elements > MESSAGES_PER_TURN ? counted.elements - MESSAGES_PER_TURN : void 0;
|
|
126637
|
+
const hashed = walk(body, true, parentAfter);
|
|
126638
|
+
const combine = (messagesDigest) => (0, import_node_crypto18.createHash)("sha256").update(hashed.threadDigest).update(messagesDigest).digest("hex");
|
|
126639
|
+
return { ownKey: combine(hashed.messagesDigest), parentKey: hashed.parentDigest === void 0 ? void 0 : combine(hashed.parentDigest) };
|
|
126640
|
+
}
|
|
126641
|
+
|
|
126642
|
+
// src/frontdoor/headroomHop.ts
|
|
126417
126643
|
var HTTP_BAD_GATEWAY2 = HTTP_STATUS.badGateway;
|
|
126418
126644
|
function responseHeaders(headers) {
|
|
126419
126645
|
const result = {};
|
|
@@ -126425,7 +126651,7 @@ function responseHeaders(headers) {
|
|
|
126425
126651
|
}
|
|
126426
126652
|
return result;
|
|
126427
126653
|
}
|
|
126428
|
-
async function applyHeadroomHop(request7, response, upstream, deps) {
|
|
126654
|
+
async function applyHeadroomHop(request7, response, upstream, deps, onThread) {
|
|
126429
126655
|
const target = deps.headroomSocket();
|
|
126430
126656
|
if (target === void 0) {
|
|
126431
126657
|
await answerBadGateway(response, "agent-shim front door: the headroom daemon is restarting");
|
|
@@ -126461,7 +126687,7 @@ async function applyHeadroomHop(request7, response, upstream, deps) {
|
|
|
126461
126687
|
}
|
|
126462
126688
|
headers[HOP_SECRET_HEADER] = deps.hopSecret;
|
|
126463
126689
|
try {
|
|
126464
|
-
await forwardThroughHeadroom(request7, response, { socketPath, headers, log: deps.log });
|
|
126690
|
+
await forwardThroughHeadroom(request7, response, { socketPath, headers, log: deps.log, onThread });
|
|
126465
126691
|
} finally {
|
|
126466
126692
|
if (hopId !== void 0) {
|
|
126467
126693
|
deps.custody.release(hopId);
|
|
@@ -126503,19 +126729,59 @@ async function headroomReady(deps, signal) {
|
|
|
126503
126729
|
}
|
|
126504
126730
|
var HOP_RESET_RETRIES = 1;
|
|
126505
126731
|
var HOP_RESET_CODES = /* @__PURE__ */ new Set(["ECONNRESET", "EPIPE"]);
|
|
126506
|
-
|
|
126507
|
-
|
|
126508
|
-
|
|
126509
|
-
|
|
126510
|
-
|
|
126511
|
-
|
|
126732
|
+
var BYTES_PER_MIB = 1048576;
|
|
126733
|
+
var MESSAGES_API_LIMIT_MIB = 32;
|
|
126734
|
+
var MAX_BODY_BYTES = MESSAGES_API_LIMIT_MIB * BYTES_PER_MIB;
|
|
126735
|
+
async function collectBody(body) {
|
|
126736
|
+
return await new Promise((resolve2) => {
|
|
126737
|
+
const chunks = [];
|
|
126738
|
+
let size = 0;
|
|
126739
|
+
let settled = false;
|
|
126740
|
+
const settle2 = (result) => {
|
|
126741
|
+
if (!settled) {
|
|
126742
|
+
settled = true;
|
|
126743
|
+
resolve2(result);
|
|
126744
|
+
}
|
|
126745
|
+
};
|
|
126746
|
+
body.on("data", (chunk) => {
|
|
126747
|
+
if (settled) {
|
|
126748
|
+
return;
|
|
126749
|
+
}
|
|
126750
|
+
const piece = typeof chunk === "string" ? Buffer.from(chunk) : chunk instanceof Uint8Array ? Buffer.from(chunk) : void 0;
|
|
126751
|
+
if (piece === void 0) {
|
|
126752
|
+
settle2({ kind: "failed" });
|
|
126753
|
+
return;
|
|
126754
|
+
}
|
|
126755
|
+
size += piece.length;
|
|
126756
|
+
if (size > MAX_BODY_BYTES) {
|
|
126757
|
+
chunks.length = 0;
|
|
126758
|
+
settle2({ kind: "too-large" });
|
|
126759
|
+
return;
|
|
126760
|
+
}
|
|
126761
|
+
chunks.push(piece);
|
|
126762
|
+
});
|
|
126763
|
+
body.on("end", () => {
|
|
126764
|
+
settle2({ kind: "body", body: Buffer.concat(chunks) });
|
|
126765
|
+
});
|
|
126766
|
+
body.on("error", () => {
|
|
126767
|
+
settle2({ kind: "failed" });
|
|
126768
|
+
});
|
|
126769
|
+
});
|
|
126512
126770
|
}
|
|
126513
126771
|
async function forwardThroughHeadroom(request7, response, target) {
|
|
126514
|
-
const
|
|
126515
|
-
if (
|
|
126772
|
+
const collected = await collectBody(request7.body);
|
|
126773
|
+
if (collected.kind === "failed") {
|
|
126516
126774
|
response.destroy();
|
|
126517
126775
|
return;
|
|
126518
126776
|
}
|
|
126777
|
+
if (collected.kind === "too-large") {
|
|
126778
|
+
response.start(HTTP_STATUS.payloadTooLarge, { "Content-Type": "application/json" });
|
|
126779
|
+
await response.write(JSON.stringify({ type: "error", error: { type: "request_too_large", message: "agent-shim front door: the request body is larger than the Messages API accepts" } }));
|
|
126780
|
+
response.end();
|
|
126781
|
+
return;
|
|
126782
|
+
}
|
|
126783
|
+
const { body } = collected;
|
|
126784
|
+
target.onThread(lineageOf(body));
|
|
126519
126785
|
for (let retriesLeft = HOP_RESET_RETRIES; ; retriesLeft -= 1) {
|
|
126520
126786
|
const outcome = await hopOnce(request7, response, target, body, retriesLeft > 0);
|
|
126521
126787
|
if (outcome === "settled") {
|
|
@@ -126655,7 +126921,7 @@ function createRoutedResponse(response, context) {
|
|
|
126655
126921
|
start: (status, headers) => {
|
|
126656
126922
|
for (const observe of deps.responseObservers) {
|
|
126657
126923
|
try {
|
|
126658
|
-
const body = observe({ session, route, method: request7.method, path: request7.path, receivedAt: request7.receivedAt, viaHeadroom: request7.viaHeadroom, status, headers });
|
|
126924
|
+
const body = observe({ session, route, method: request7.method, path: request7.path, receivedAt: request7.receivedAt, viaHeadroom: request7.viaHeadroom, lineage: request7.thread.lineage, status, headers });
|
|
126659
126925
|
if (body !== void 0) {
|
|
126660
126926
|
bodyObservers.push(body);
|
|
126661
126927
|
}
|
|
@@ -126696,7 +126962,7 @@ function createRoutedResponse(response, context) {
|
|
|
126696
126962
|
};
|
|
126697
126963
|
}
|
|
126698
126964
|
async function serveRouted(request7, deps) {
|
|
126699
|
-
const observed = { method: request7.method, path: pathOf(request7.url), receivedAt: deps.now(), viaHeadroom: false };
|
|
126965
|
+
const observed = { method: request7.method, path: pathOf(request7.url), receivedAt: deps.now(), viaHeadroom: false, thread: { lineage: void 0 } };
|
|
126700
126966
|
const identified = identifyRequest(request7.headers);
|
|
126701
126967
|
const admission = deps.admit({ url: request7.url, headers: request7.headers, forwardable: identified.forwardableHeaders });
|
|
126702
126968
|
if (!admission.ok) {
|
|
@@ -126723,12 +126989,14 @@ async function serveRouted(request7, deps) {
|
|
|
126723
126989
|
return;
|
|
126724
126990
|
}
|
|
126725
126991
|
const { headroom } = deps;
|
|
126726
|
-
const wantsHeadroom = await deps.headroomDecision.decide(identified.session.sessionId, identified.session.headroom, deps.now(), async () =>
|
|
126992
|
+
const wantsHeadroom = headroom !== void 0 && await deps.headroomDecision.decide(identified.session.sessionId, identified.session.headroom, deps.now(), async () => await headroomReady(headroom, request7.signal));
|
|
126727
126993
|
const viaHeadroom = wantsHeadroom && resolution.route.headroomEligible && deps.headroom !== void 0;
|
|
126728
126994
|
const response = createRoutedResponse(request7.response, { deps, session: identified.session, route: resolution.route.name, request: { ...observed, viaHeadroom } });
|
|
126729
126995
|
try {
|
|
126730
126996
|
if (viaHeadroom) {
|
|
126731
|
-
await applyHeadroomHop(routed, response, resolution.route.headroomUpstream, deps.headroom)
|
|
126997
|
+
await applyHeadroomHop(routed, response, resolution.route.headroomUpstream, deps.headroom, (lineage) => {
|
|
126998
|
+
observed.thread.lineage = lineage;
|
|
126999
|
+
});
|
|
126732
127000
|
} else {
|
|
126733
127001
|
await resolution.route.serve(routed, response);
|
|
126734
127002
|
}
|
|
@@ -126752,7 +127020,7 @@ init_load();
|
|
|
126752
127020
|
init_schema();
|
|
126753
127021
|
|
|
126754
127022
|
// src/codex/translate.ts
|
|
126755
|
-
var
|
|
127023
|
+
var import_node_crypto19 = require("node:crypto");
|
|
126756
127024
|
init_schema();
|
|
126757
127025
|
|
|
126758
127026
|
// src/codex/anthropic.ts
|
|
@@ -126867,7 +127135,7 @@ function shortToolName(name, names) {
|
|
|
126867
127135
|
if (name.length <= CODEX_TOOL_NAME_LIMIT) {
|
|
126868
127136
|
return name;
|
|
126869
127137
|
}
|
|
126870
|
-
const hash2 = (0,
|
|
127138
|
+
const hash2 = (0, import_node_crypto19.createHash)("sha256").update(name).digest("hex").slice(0, TOOL_NAME_HASH_CHARS);
|
|
126871
127139
|
const shortened = `${name.slice(0, CODEX_TOOL_NAME_LIMIT - TOOL_NAME_HASH_CHARS - 1)}_${hash2}`;
|
|
126872
127140
|
names.set(shortened, name);
|
|
126873
127141
|
return shortened;
|
|
@@ -127914,7 +128182,7 @@ function attachingProviderCredential(route, deps) {
|
|
|
127914
128182
|
init_realFrontDoorPort();
|
|
127915
128183
|
|
|
127916
128184
|
// src/frontdoor/rcCommands.ts
|
|
127917
|
-
var
|
|
128185
|
+
var import_node_crypto20 = require("node:crypto");
|
|
127918
128186
|
init_commandDeps();
|
|
127919
128187
|
init_cliError();
|
|
127920
128188
|
init_realPorts();
|
|
@@ -128521,8 +128789,8 @@ function registerRcCommand(frontdoor, paths) {
|
|
|
128521
128789
|
identitiesDir: paths.identitiesDir,
|
|
128522
128790
|
frontdoorDir: paths.frontdoorDir,
|
|
128523
128791
|
identity,
|
|
128524
|
-
newUuid:
|
|
128525
|
-
randomToken: () => (0,
|
|
128792
|
+
newUuid: import_node_crypto20.randomUUID,
|
|
128793
|
+
randomToken: () => (0, import_node_crypto20.randomBytes)(MINTED_TOKEN_RANDOM_BYTES).toString("base64url"),
|
|
128526
128794
|
force: options.force === true,
|
|
128527
128795
|
now: () => Date.now()
|
|
128528
128796
|
});
|
|
@@ -130775,8 +131043,8 @@ function realFrontDoorSupervisorPorts(paths) {
|
|
|
130775
131043
|
};
|
|
130776
131044
|
const rcSelfHostSurface = rcSelfHost ? createRcSelfHostSurface({
|
|
130777
131045
|
now: () => Date.now(),
|
|
130778
|
-
newUuid:
|
|
130779
|
-
randomToken: () => (0,
|
|
131046
|
+
newUuid: import_node_crypto21.randomUUID,
|
|
131047
|
+
randomToken: () => (0, import_node_crypto21.randomBytes)(MINTED_TOKEN_RANDOM_BYTES).toString("base64url"),
|
|
130780
131048
|
credentialRecord: () => readRcSelfHostRecord(realFarmFs, paths.frontdoorDir),
|
|
130781
131049
|
webFetch: realRcWebFetch({ allowPrivate: rcWebFetchAllowsPrivateFromEnv(process.env) }),
|
|
130782
131050
|
log
|
|
@@ -130799,7 +131067,7 @@ function realFrontDoorSupervisorPorts(paths) {
|
|
|
130799
131067
|
saveSequenceNum: rcCredentialStore.writeCursor,
|
|
130800
131068
|
dial: rcSelfHost ? lateRcStreamDial(rcSelfHostDialTarget) : realRcStreamDial(),
|
|
130801
131069
|
fanout: rcFanout,
|
|
130802
|
-
newClientId:
|
|
131070
|
+
newClientId: import_node_crypto21.randomUUID,
|
|
130803
131071
|
backoffMs: RC_STREAM_BACKOFF_MS,
|
|
130804
131072
|
sleep: async (ms2) => {
|
|
130805
131073
|
await new Promise((resolve2) => {
|
|
@@ -130811,7 +131079,7 @@ function realFrontDoorSupervisorPorts(paths) {
|
|
|
130811
131079
|
}
|
|
130812
131080
|
});
|
|
130813
131081
|
const routingSnapshots = /* @__PURE__ */ new Map();
|
|
130814
|
-
const rcControlToken = (0,
|
|
131082
|
+
const rcControlToken = (0, import_node_crypto21.randomUUID)();
|
|
130815
131083
|
const resolveRoute = rcObservingResolver(
|
|
130816
131084
|
createProviderRouteResolver({
|
|
130817
131085
|
fs: realFsPort,
|
|
@@ -130902,10 +131170,13 @@ function realFrontDoorSupervisorPorts(paths) {
|
|
|
130902
131170
|
const recordUsage = withQuotaRefresh(usageStore.record, quotaRefresher);
|
|
130903
131171
|
const usageMiddleware = createUsageMiddleware({
|
|
130904
131172
|
// Each finished response also tells the per-session headroom decision when the session's cache was last touched and whether it read from it.
|
|
130905
|
-
record: (record2) => {
|
|
131173
|
+
record: (record2, event) => {
|
|
130906
131174
|
const { usage } = record2;
|
|
130907
131175
|
headroomDecision.observe({
|
|
130908
131176
|
sessionId: record2.sessionId,
|
|
131177
|
+
startedAtMs: Date.parse(record2.at),
|
|
131178
|
+
viaHeadroom: record2.viaHeadroom === true,
|
|
131179
|
+
lineage: event.lineage,
|
|
130909
131180
|
endedAtMs: Date.parse(record2.at) + record2.durationMs,
|
|
130910
131181
|
cache: usage === void 0 ? void 0 : { readTokens: usage.cacheReadInputTokens ?? 0, writtenTokens: usage.cacheCreationInputTokens ?? 0, uncachedTokens: usage.inputTokens ?? 0 }
|
|
130911
131182
|
});
|
|
@@ -130924,9 +131195,9 @@ function realFrontDoorSupervisorPorts(paths) {
|
|
|
130924
131195
|
now: () => Date.now(),
|
|
130925
131196
|
headroomSocket: () => headroomSocketTarget(realFarmFs, realHeadroomSocketTrust, paths),
|
|
130926
131197
|
// The per-generation capability the direct listener demands: held only in this process's memory, so a loopback process that discovers the direct port still cannot use it.
|
|
130927
|
-
hopSecret: (0,
|
|
131198
|
+
hopSecret: (0, import_node_crypto21.randomUUID)(),
|
|
130928
131199
|
headroomDecision,
|
|
130929
|
-
custody: createCredentialCustody(() => (0,
|
|
131200
|
+
custody: createCredentialCustody(() => (0, import_node_crypto21.randomUUID)()),
|
|
130930
131201
|
log
|
|
130931
131202
|
});
|
|
130932
131203
|
const onListenerError = (name) => (error63) => {
|
|
@@ -130949,9 +131220,9 @@ function realFrontDoorSupervisorPorts(paths) {
|
|
|
130949
131220
|
startProviderListener: async (preferredPort) => {
|
|
130950
131221
|
const authority = loadCa();
|
|
130951
131222
|
const rcDial = rcSelfHost ? lateRcEventDial(rcSelfHostDialTarget) : realRcEventDial();
|
|
130952
|
-
const rcInject = async (sessionId, text2) => await injectRcUserMessage({ credentialOf: rcTracker.credentialOf, noteSequenceNums: rcTracker.noteSequenceNums, dial: rcDial, newUuid:
|
|
131223
|
+
const rcInject = async (sessionId, text2) => await injectRcUserMessage({ credentialOf: rcTracker.credentialOf, noteSequenceNums: rcTracker.noteSequenceNums, dial: rcDial, newUuid: import_node_crypto21.randomUUID }, sessionId, text2);
|
|
130953
131224
|
const rcAnswer = async (sessionId, requestId, decision) => await answerRcControlRequest({ credentialOf: rcTracker.credentialOf, pendingOf: (id2) => rcTracker.pendingOf(id2), completePending: rcTracker.completePending, noteSequenceNums: rcTracker.noteSequenceNums, dial: rcDial }, sessionId, requestId, decision);
|
|
130954
|
-
const rcControlRequestDeps = { credentialOf: rcTracker.credentialOf, noteSequenceNums: rcTracker.noteSequenceNums, dial: rcDial, newUuid:
|
|
131225
|
+
const rcControlRequestDeps = { credentialOf: rcTracker.credentialOf, noteSequenceNums: rcTracker.noteSequenceNums, dial: rcDial, newUuid: import_node_crypto21.randomUUID };
|
|
130955
131226
|
const rcInterrupt = async (sessionId) => await interruptRcSession(rcControlRequestDeps, sessionId);
|
|
130956
131227
|
const rcSetModel = async (sessionId, model) => await setRcSessionModel(rcControlRequestDeps, sessionId, model);
|
|
130957
131228
|
const rcSetPermissionMode = async (sessionId, mode) => await setRcSessionPermissionMode(rcControlRequestDeps, sessionId, mode);
|
|
@@ -131050,7 +131321,7 @@ function realFrontDoorSupervisorPorts(paths) {
|
|
|
131050
131321
|
},
|
|
131051
131322
|
startConnectListener: async (preferredPort) => {
|
|
131052
131323
|
const wantedTransparentPort = process.env.AGENT_SHIM_TRANSPARENT_SURFACE === void 0 ? void 0 : Number(process.env.AGENT_SHIM_TRANSPARENT_SURFACE);
|
|
131053
|
-
const transparentCapability = wantedTransparentPort === void 0 || Number.isNaN(wantedTransparentPort) ? void 0 : (0,
|
|
131324
|
+
const transparentCapability = wantedTransparentPort === void 0 || Number.isNaN(wantedTransparentPort) ? void 0 : (0, import_node_crypto21.randomUUID)();
|
|
131054
131325
|
if (transparentCapability !== void 0) {
|
|
131055
131326
|
writeFrontDoorSession(realFarmFs, paths.frontdoorSessionsDir, { pid: process.pid, startedAt: Date.now(), token: transparentCapability });
|
|
131056
131327
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -472,7 +472,7 @@ var init_schema = __esm({
|
|
|
472
472
|
context.addIssue({ code: "custom", path: ["readMaturation"], message: "readMaturation needs rolloutChannel beta or dev" });
|
|
473
473
|
}
|
|
474
474
|
});
|
|
475
|
-
HEADROOM_DEFAULT_SOURCE = "headroom-ai[proxy] @ git+https://github.com/ExaDev/headroom@
|
|
475
|
+
HEADROOM_DEFAULT_SOURCE = "headroom-ai[proxy] @ git+https://github.com/ExaDev/headroom@2dfa958e47814533751cdd0c5362d8f352ec5b75";
|
|
476
476
|
HEADROOM_DEFAULT_IDLE_SHUTDOWN_MINUTES = 15;
|
|
477
477
|
FrontDoorGlobalConfigSchema = import_zod.z.strictObject({
|
|
478
478
|
/** How long the front door may sit with no registered sessions before it closes and exits. Defaults to FRONTDOOR_DEFAULT_IDLE_SHUTDOWN_MINUTES. */
|
|
@@ -2758,7 +2758,7 @@ var init_package = __esm({
|
|
|
2758
2758
|
"package.json"() {
|
|
2759
2759
|
package_default = {
|
|
2760
2760
|
name: "claude-use",
|
|
2761
|
-
version: "11.
|
|
2761
|
+
version: "11.5.0",
|
|
2762
2762
|
description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
|
|
2763
2763
|
license: "MIT",
|
|
2764
2764
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
package/dist/index.mjs
CHANGED
|
@@ -450,7 +450,7 @@ var init_schema = __esm({
|
|
|
450
450
|
context.addIssue({ code: "custom", path: ["readMaturation"], message: "readMaturation needs rolloutChannel beta or dev" });
|
|
451
451
|
}
|
|
452
452
|
});
|
|
453
|
-
HEADROOM_DEFAULT_SOURCE = "headroom-ai[proxy] @ git+https://github.com/ExaDev/headroom@
|
|
453
|
+
HEADROOM_DEFAULT_SOURCE = "headroom-ai[proxy] @ git+https://github.com/ExaDev/headroom@2dfa958e47814533751cdd0c5362d8f352ec5b75";
|
|
454
454
|
HEADROOM_DEFAULT_IDLE_SHUTDOWN_MINUTES = 15;
|
|
455
455
|
FrontDoorGlobalConfigSchema = z.strictObject({
|
|
456
456
|
/** How long the front door may sit with no registered sessions before it closes and exits. Defaults to FRONTDOOR_DEFAULT_IDLE_SHUTDOWN_MINUTES. */
|
|
@@ -2734,7 +2734,7 @@ var init_package = __esm({
|
|
|
2734
2734
|
"package.json"() {
|
|
2735
2735
|
package_default = {
|
|
2736
2736
|
name: "claude-use",
|
|
2737
|
-
version: "11.
|
|
2737
|
+
version: "11.5.0",
|
|
2738
2738
|
description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
|
|
2739
2739
|
license: "MIT",
|
|
2740
2740
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5656,6 +5656,7 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
|
|
|
5656
5656
|
kind: zod.ZodLiteral<"profile">;
|
|
5657
5657
|
name: zod.ZodString;
|
|
5658
5658
|
value: zod.ZodObject<{
|
|
5659
|
+
description: zod.ZodOptional<zod.ZodString>;
|
|
5659
5660
|
entries: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnion<readonly [zod.ZodBoolean, zod.ZodObject<{
|
|
5660
5661
|
value: zod.ZodBoolean;
|
|
5661
5662
|
when: zod.ZodUnion<readonly [zod.ZodObject<{
|
|
@@ -5731,7 +5732,6 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
|
|
|
5731
5732
|
key: zod.ZodType<trilean.JsonValue, unknown, zod_v4_core.$ZodTypeInternals<trilean.JsonValue, unknown>>;
|
|
5732
5733
|
}, zod_v4_core.$strip>], "kind">]>;
|
|
5733
5734
|
}, zod_v4_core.$strict>]>>>;
|
|
5734
|
-
description: zod.ZodOptional<zod.ZodString>;
|
|
5735
5735
|
extends: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
|
|
5736
5736
|
categories: zod.ZodOptional<zod.ZodPipe<zod.ZodObject<{
|
|
5737
5737
|
all: zod.ZodOptional<zod.ZodBoolean>;
|
|
@@ -5775,6 +5775,7 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
|
|
|
5775
5775
|
kind: zod.ZodLiteral<"profile">;
|
|
5776
5776
|
name: zod.ZodString;
|
|
5777
5777
|
value: zod.ZodObject<{
|
|
5778
|
+
description: zod.ZodOptional<zod.ZodString>;
|
|
5778
5779
|
entries: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnion<readonly [zod.ZodBoolean, zod.ZodObject<{
|
|
5779
5780
|
value: zod.ZodBoolean;
|
|
5780
5781
|
when: zod.ZodUnion<readonly [zod.ZodObject<{
|
|
@@ -5850,7 +5851,6 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
|
|
|
5850
5851
|
key: zod.ZodType<trilean.JsonValue, unknown, zod_v4_core.$ZodTypeInternals<trilean.JsonValue, unknown>>;
|
|
5851
5852
|
}, zod_v4_core.$strip>], "kind">]>;
|
|
5852
5853
|
}, zod_v4_core.$strict>]>>>;
|
|
5853
|
-
description: zod.ZodOptional<zod.ZodString>;
|
|
5854
5854
|
extends: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
|
|
5855
5855
|
categories: zod.ZodOptional<zod.ZodPipe<zod.ZodObject<{
|
|
5856
5856
|
all: zod.ZodOptional<zod.ZodBoolean>;
|
|
@@ -8606,6 +8606,7 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
|
|
|
8606
8606
|
kind: zod.ZodLiteral<"profile">;
|
|
8607
8607
|
name: zod.ZodString;
|
|
8608
8608
|
value: zod.ZodObject<{
|
|
8609
|
+
description: zod.ZodOptional<zod.ZodString>;
|
|
8609
8610
|
entries: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnion<readonly [zod.ZodBoolean, zod.ZodObject<{
|
|
8610
8611
|
value: zod.ZodBoolean;
|
|
8611
8612
|
when: zod.ZodUnion<readonly [zod.ZodObject<{
|
|
@@ -8681,7 +8682,6 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
|
|
|
8681
8682
|
key: zod.ZodType<trilean.JsonValue, unknown, zod_v4_core.$ZodTypeInternals<trilean.JsonValue, unknown>>;
|
|
8682
8683
|
}, zod_v4_core.$strip>], "kind">]>;
|
|
8683
8684
|
}, zod_v4_core.$strict>]>>>;
|
|
8684
|
-
description: zod.ZodOptional<zod.ZodString>;
|
|
8685
8685
|
extends: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
|
|
8686
8686
|
categories: zod.ZodOptional<zod.ZodPipe<zod.ZodObject<{
|
|
8687
8687
|
all: zod.ZodOptional<zod.ZodBoolean>;
|
|
@@ -8725,6 +8725,7 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
|
|
|
8725
8725
|
kind: zod.ZodLiteral<"profile">;
|
|
8726
8726
|
name: zod.ZodString;
|
|
8727
8727
|
value: zod.ZodObject<{
|
|
8728
|
+
description: zod.ZodOptional<zod.ZodString>;
|
|
8728
8729
|
entries: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnion<readonly [zod.ZodBoolean, zod.ZodObject<{
|
|
8729
8730
|
value: zod.ZodBoolean;
|
|
8730
8731
|
when: zod.ZodUnion<readonly [zod.ZodObject<{
|
|
@@ -8800,7 +8801,6 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
|
|
|
8800
8801
|
key: zod.ZodType<trilean.JsonValue, unknown, zod_v4_core.$ZodTypeInternals<trilean.JsonValue, unknown>>;
|
|
8801
8802
|
}, zod_v4_core.$strip>], "kind">]>;
|
|
8802
8803
|
}, zod_v4_core.$strict>]>>>;
|
|
8803
|
-
description: zod.ZodOptional<zod.ZodString>;
|
|
8804
8804
|
extends: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
|
|
8805
8805
|
categories: zod.ZodOptional<zod.ZodPipe<zod.ZodObject<{
|
|
8806
8806
|
all: zod.ZodOptional<zod.ZodBoolean>;
|
|
@@ -10714,6 +10714,7 @@ declare const ConfigProfileAddOutputSchema: z.ZodObject<{
|
|
|
10714
10714
|
kind: z.ZodLiteral<"profile">;
|
|
10715
10715
|
name: z.ZodString;
|
|
10716
10716
|
value: z.ZodObject<{
|
|
10717
|
+
description: z.ZodOptional<z.ZodString>;
|
|
10717
10718
|
entries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
10718
10719
|
value: z.ZodBoolean;
|
|
10719
10720
|
when: z.ZodUnion<readonly [z.ZodObject<{
|
|
@@ -10789,7 +10790,6 @@ declare const ConfigProfileAddOutputSchema: z.ZodObject<{
|
|
|
10789
10790
|
key: z.ZodType<trilean.JsonValue, unknown, z.core.$ZodTypeInternals<trilean.JsonValue, unknown>>;
|
|
10790
10791
|
}, z.core.$strip>], "kind">]>;
|
|
10791
10792
|
}, z.core.$strict>]>>>;
|
|
10792
|
-
description: z.ZodOptional<z.ZodString>;
|
|
10793
10793
|
extends: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
10794
10794
|
categories: z.ZodOptional<z.ZodPipe<z.ZodObject<{
|
|
10795
10795
|
all: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -10835,6 +10835,7 @@ declare const ConfigProfileSetOutputSchema: z.ZodObject<{
|
|
|
10835
10835
|
kind: z.ZodLiteral<"profile">;
|
|
10836
10836
|
name: z.ZodString;
|
|
10837
10837
|
value: z.ZodObject<{
|
|
10838
|
+
description: z.ZodOptional<z.ZodString>;
|
|
10838
10839
|
entries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
10839
10840
|
value: z.ZodBoolean;
|
|
10840
10841
|
when: z.ZodUnion<readonly [z.ZodObject<{
|
|
@@ -10910,7 +10911,6 @@ declare const ConfigProfileSetOutputSchema: z.ZodObject<{
|
|
|
10910
10911
|
key: z.ZodType<trilean.JsonValue, unknown, z.core.$ZodTypeInternals<trilean.JsonValue, unknown>>;
|
|
10911
10912
|
}, z.core.$strip>], "kind">]>;
|
|
10912
10913
|
}, z.core.$strict>]>>>;
|
|
10913
|
-
description: z.ZodOptional<z.ZodString>;
|
|
10914
10914
|
extends: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
10915
10915
|
categories: z.ZodOptional<z.ZodPipe<z.ZodObject<{
|
|
10916
10916
|
all: z.ZodOptional<z.ZodBoolean>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-use",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.5.0",
|
|
4
4
|
"description": "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Joseph Mearman <joseph@mearman.co.uk>",
|