claude-use 11.18.0 → 11.19.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 +200 -106
- package/dist/index.cjs +164 -70
- package/dist/index.mjs +164 -70
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -24527,25 +24527,102 @@ var require_dist = __commonJS({
|
|
|
24527
24527
|
}
|
|
24528
24528
|
});
|
|
24529
24529
|
|
|
24530
|
+
// src/config/unrecognisedKeys.ts
|
|
24531
|
+
function isRecord(value2) {
|
|
24532
|
+
return typeof value2 === "object" && value2 !== null;
|
|
24533
|
+
}
|
|
24534
|
+
function parseIgnoringUnrecognisedKeys(schema, raw) {
|
|
24535
|
+
const first = schema.safeParse(raw);
|
|
24536
|
+
if (first.success) {
|
|
24537
|
+
return { success: true, data: first.data, ignored: [] };
|
|
24538
|
+
}
|
|
24539
|
+
const unrecognised = first.error.issues.filter((issue2) => issue2.code === "unrecognized_keys");
|
|
24540
|
+
const others = first.error.issues.filter((issue2) => issue2.code !== "unrecognized_keys");
|
|
24541
|
+
if (others.length > 0) {
|
|
24542
|
+
return { success: false, issues: others };
|
|
24543
|
+
}
|
|
24544
|
+
const stripped = structuredClone(raw);
|
|
24545
|
+
const ignored = [];
|
|
24546
|
+
for (const issue2 of unrecognised) {
|
|
24547
|
+
let holder = stripped;
|
|
24548
|
+
for (const step2 of issue2.path) {
|
|
24549
|
+
holder = isRecord(holder) ? holder[step2] : void 0;
|
|
24550
|
+
}
|
|
24551
|
+
if (isRecord(holder)) {
|
|
24552
|
+
const values = Object.fromEntries(issue2.keys.map((key) => [key, holder[key]]));
|
|
24553
|
+
for (const key of issue2.keys) {
|
|
24554
|
+
Reflect.deleteProperty(holder, key);
|
|
24555
|
+
}
|
|
24556
|
+
ignored.push({ path: issue2.path, keys: issue2.keys, values });
|
|
24557
|
+
}
|
|
24558
|
+
}
|
|
24559
|
+
const second = schema.safeParse(stripped);
|
|
24560
|
+
return second.success ? { success: true, data: second.data, ignored } : { success: false, issues: second.error.issues };
|
|
24561
|
+
}
|
|
24562
|
+
function describeIgnoredKeys(filePath, ignored) {
|
|
24563
|
+
const places = ignored.map(({ path: path61, keys }) => `${path61.length === 0 ? "" : `${path61.map(String).join(".")}.`}${keys.join(", ")}`);
|
|
24564
|
+
return `${filePath} has settings this version of agent-shim does not know and ignores: ${places.join("; ")}. A newer release may read them.`;
|
|
24565
|
+
}
|
|
24566
|
+
function noteIgnoredKeys(filePath, ignored) {
|
|
24567
|
+
if (ignored.length === 0) {
|
|
24568
|
+
ignoredByFile.delete(filePath);
|
|
24569
|
+
return;
|
|
24570
|
+
}
|
|
24571
|
+
ignoredByFile.set(filePath, ignored);
|
|
24572
|
+
const message = `agent-shim: warning: ${describeIgnoredKeys(filePath, ignored)}
|
|
24573
|
+
`;
|
|
24574
|
+
if (!warned.has(message)) {
|
|
24575
|
+
warned.add(message);
|
|
24576
|
+
process.stderr.write(message);
|
|
24577
|
+
}
|
|
24578
|
+
}
|
|
24579
|
+
function restoreIgnoredKeys(filePath, value2) {
|
|
24580
|
+
const ignored = ignoredByFile.get(filePath);
|
|
24581
|
+
if (ignored === void 0) {
|
|
24582
|
+
return value2;
|
|
24583
|
+
}
|
|
24584
|
+
const restored = structuredClone(value2);
|
|
24585
|
+
for (const { path: path61, values } of ignored) {
|
|
24586
|
+
let holder = restored;
|
|
24587
|
+
for (const step2 of path61) {
|
|
24588
|
+
holder = isRecord(holder) ? holder[step2] : void 0;
|
|
24589
|
+
}
|
|
24590
|
+
if (isRecord(holder)) {
|
|
24591
|
+
for (const [key, held] of Object.entries(values)) {
|
|
24592
|
+
holder[key] = held;
|
|
24593
|
+
}
|
|
24594
|
+
}
|
|
24595
|
+
}
|
|
24596
|
+
return restored;
|
|
24597
|
+
}
|
|
24598
|
+
var warned, ignoredByFile;
|
|
24599
|
+
var init_unrecognisedKeys = __esm({
|
|
24600
|
+
"src/config/unrecognisedKeys.ts"() {
|
|
24601
|
+
"use strict";
|
|
24602
|
+
warned = /* @__PURE__ */ new Set();
|
|
24603
|
+
ignoredByFile = /* @__PURE__ */ new Map();
|
|
24604
|
+
}
|
|
24605
|
+
});
|
|
24606
|
+
|
|
24530
24607
|
// src/config/load.ts
|
|
24531
24608
|
function createExplorer(moduleName = "agent-shim") {
|
|
24532
24609
|
return (0, import_cosmiconfig.cosmiconfigSync)(moduleName, { searchPlaces: [] });
|
|
24533
24610
|
}
|
|
24534
|
-
function
|
|
24611
|
+
function isRecord2(value2) {
|
|
24535
24612
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
24536
24613
|
}
|
|
24537
24614
|
function captureEntryOrder(value2) {
|
|
24538
|
-
if (!
|
|
24615
|
+
if (!isRecord2(value2)) {
|
|
24539
24616
|
return [];
|
|
24540
24617
|
}
|
|
24541
24618
|
const entries = value2.entries;
|
|
24542
|
-
if (!
|
|
24619
|
+
if (!isRecord2(entries)) {
|
|
24543
24620
|
return [];
|
|
24544
24621
|
}
|
|
24545
24622
|
return Object.keys(entries);
|
|
24546
24623
|
}
|
|
24547
24624
|
function captureRuleEntryOrders(value2) {
|
|
24548
|
-
if (!
|
|
24625
|
+
if (!isRecord2(value2)) {
|
|
24549
24626
|
return [];
|
|
24550
24627
|
}
|
|
24551
24628
|
const rules = value2.rules;
|
|
@@ -24560,7 +24637,7 @@ function cosmiconfigReader(explorer = createExplorer()) {
|
|
|
24560
24637
|
try {
|
|
24561
24638
|
result = explorer.load(filepath);
|
|
24562
24639
|
} catch (error63) {
|
|
24563
|
-
const code =
|
|
24640
|
+
const code = isRecord2(error63) ? error63.code : void 0;
|
|
24564
24641
|
if (code === "ENOENT") {
|
|
24565
24642
|
return void 0;
|
|
24566
24643
|
}
|
|
@@ -24577,10 +24654,11 @@ function loadConfigFile(filepath, schema, read = cosmiconfigReader()) {
|
|
|
24577
24654
|
if (raw === void 0) {
|
|
24578
24655
|
return void 0;
|
|
24579
24656
|
}
|
|
24580
|
-
const parsed = schema
|
|
24657
|
+
const parsed = parseIgnoringUnrecognisedKeys(schema, raw);
|
|
24581
24658
|
if (!parsed.success) {
|
|
24582
|
-
throw new ConfigValidationError(filepath, parsed.
|
|
24659
|
+
throw new ConfigValidationError(filepath, parsed.issues);
|
|
24583
24660
|
}
|
|
24661
|
+
noteIgnoredKeys(filepath, parsed.ignored);
|
|
24584
24662
|
return {
|
|
24585
24663
|
filepath,
|
|
24586
24664
|
config: parsed.data,
|
|
@@ -24594,6 +24672,7 @@ var init_load = __esm({
|
|
|
24594
24672
|
"use strict";
|
|
24595
24673
|
import_cosmiconfig = __toESM(require_dist(), 1);
|
|
24596
24674
|
init_cliError();
|
|
24675
|
+
init_unrecognisedKeys();
|
|
24597
24676
|
ConfigValidationError = class extends CliError {
|
|
24598
24677
|
constructor(filepath, issues) {
|
|
24599
24678
|
const detail = issues.map((issue2) => ` ${issue2.path.join(".") || "(root)"}: ${issue2.message}`).join("\n");
|
|
@@ -24619,10 +24698,11 @@ function readJson(filePath, schema, storeFs = nodeStoreFs) {
|
|
|
24619
24698
|
return void 0;
|
|
24620
24699
|
}
|
|
24621
24700
|
const parsed = JSON.parse(raw);
|
|
24622
|
-
const result = schema
|
|
24701
|
+
const result = parseIgnoringUnrecognisedKeys(schema, parsed);
|
|
24623
24702
|
if (!result.success) {
|
|
24624
|
-
throw new ConfigValidationError(filePath, result.
|
|
24703
|
+
throw new ConfigValidationError(filePath, result.issues);
|
|
24625
24704
|
}
|
|
24705
|
+
noteIgnoredKeys(filePath, result.ignored);
|
|
24626
24706
|
return result.data;
|
|
24627
24707
|
}
|
|
24628
24708
|
function writeTextAtomic(filePath, contents, storeFs = nodeStoreFs) {
|
|
@@ -24638,7 +24718,7 @@ function writeTextAtomic(filePath, contents, storeFs = nodeStoreFs) {
|
|
|
24638
24718
|
}
|
|
24639
24719
|
}
|
|
24640
24720
|
function writeJsonAtomic(filePath, data, storeFs = nodeStoreFs) {
|
|
24641
|
-
writeTextAtomic(filePath, `${JSON.stringify(data, null, 2)}
|
|
24721
|
+
writeTextAtomic(filePath, `${JSON.stringify(restoreIgnoredKeys(filePath, data), null, 2)}
|
|
24642
24722
|
`, storeFs);
|
|
24643
24723
|
}
|
|
24644
24724
|
function applyPatch(filePath, schema, patch, options = {}) {
|
|
@@ -24664,6 +24744,7 @@ var init_store = __esm({
|
|
|
24664
24744
|
import_node_path2 = __toESM(require("node:path"), 1);
|
|
24665
24745
|
import_node_crypto = require("node:crypto");
|
|
24666
24746
|
init_load();
|
|
24747
|
+
init_unrecognisedKeys();
|
|
24667
24748
|
nodeStoreFs = {
|
|
24668
24749
|
readFileUtf8(filePath) {
|
|
24669
24750
|
try {
|
|
@@ -33966,7 +34047,7 @@ function formatCredentialSummary(summary) {
|
|
|
33966
34047
|
function describeCredential(credential) {
|
|
33967
34048
|
return formatCredentialSummary(summariseCredential(credential));
|
|
33968
34049
|
}
|
|
33969
|
-
function
|
|
34050
|
+
function isRecord3(value2) {
|
|
33970
34051
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
33971
34052
|
}
|
|
33972
34053
|
function unpackKeyringToken(raw) {
|
|
@@ -33978,7 +34059,7 @@ function unpackKeyringToken(raw) {
|
|
|
33978
34059
|
const base64Str = trimmed.slice(GO_KEYRING_BASE64_PREFIX.length);
|
|
33979
34060
|
const decoded = Buffer.from(base64Str, "base64").toString("utf8");
|
|
33980
34061
|
const parsed = JSON.parse(decoded);
|
|
33981
|
-
if (
|
|
34062
|
+
if (isRecord3(parsed) && isRecord3(parsed.token)) {
|
|
33982
34063
|
const accessToken = parsed.token.access_token;
|
|
33983
34064
|
if (typeof accessToken === "string" && accessToken.trim() !== "") {
|
|
33984
34065
|
return accessToken.trim();
|
|
@@ -34091,7 +34172,7 @@ var init_package = __esm({
|
|
|
34091
34172
|
"package.json"() {
|
|
34092
34173
|
package_default = {
|
|
34093
34174
|
name: "claude-use",
|
|
34094
|
-
version: "11.
|
|
34175
|
+
version: "11.19.0",
|
|
34095
34176
|
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.",
|
|
34096
34177
|
license: "MIT",
|
|
34097
34178
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -35666,14 +35747,14 @@ function providerJsonPath(paths, name) {
|
|
|
35666
35747
|
function providerExists(paths, name) {
|
|
35667
35748
|
return import_node_fs10.default.existsSync(providerJsonPath(paths, name));
|
|
35668
35749
|
}
|
|
35669
|
-
function
|
|
35750
|
+
function isRecord4(value2) {
|
|
35670
35751
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
35671
35752
|
}
|
|
35672
35753
|
function legacyProviderConversion(raw) {
|
|
35673
|
-
if (!
|
|
35754
|
+
if (!isRecord4(raw) || "credential" in raw) {
|
|
35674
35755
|
return void 0;
|
|
35675
35756
|
}
|
|
35676
|
-
const env =
|
|
35757
|
+
const env = isRecord4(raw.env) ? raw.env : void 0;
|
|
35677
35758
|
const legacyEnvKeys = env === void 0 ? [] : Object.keys(env).filter((key) => LEGACY_ENV_CREDENTIAL_KEYS.includes(key));
|
|
35678
35759
|
const fields = [...LEGACY_PROVIDER_FIELDS.filter((field) => field in raw), ...legacyEnvKeys.map((key) => `env.${key}`)];
|
|
35679
35760
|
if (fields.length === 0) {
|
|
@@ -35706,10 +35787,11 @@ function parseProviderFile(filePath, raw) {
|
|
|
35706
35787
|
if (conversion !== void 0) {
|
|
35707
35788
|
throw new LegacyProviderFileError(filePath, conversion);
|
|
35708
35789
|
}
|
|
35709
|
-
const parsed = ProviderSchema
|
|
35790
|
+
const parsed = parseIgnoringUnrecognisedKeys(ProviderSchema, raw);
|
|
35710
35791
|
if (!parsed.success) {
|
|
35711
|
-
throw new ConfigValidationError(filePath, parsed.
|
|
35792
|
+
throw new ConfigValidationError(filePath, parsed.issues);
|
|
35712
35793
|
}
|
|
35794
|
+
noteIgnoredKeys(filePath, parsed.ignored);
|
|
35713
35795
|
return parsed.data;
|
|
35714
35796
|
}
|
|
35715
35797
|
function readProvider(paths, name) {
|
|
@@ -35919,6 +36001,7 @@ var init_providersStore = __esm({
|
|
|
35919
36001
|
import_node_path29 = __toESM(require("node:path"), 1);
|
|
35920
36002
|
init_load();
|
|
35921
36003
|
init_store();
|
|
36004
|
+
init_unrecognisedKeys();
|
|
35922
36005
|
init_schema();
|
|
35923
36006
|
init_cliError();
|
|
35924
36007
|
init_credential();
|
|
@@ -63129,7 +63212,7 @@ function resolvePoolLaunch(params) {
|
|
|
63129
63212
|
if (stickyRead.problem !== void 0) {
|
|
63130
63213
|
log.warn(`agent-shim: ${stickyRead.problem}; ignoring the last-pick record`);
|
|
63131
63214
|
}
|
|
63132
|
-
const
|
|
63215
|
+
const warned2 = /* @__PURE__ */ new Set();
|
|
63133
63216
|
for (; ; ) {
|
|
63134
63217
|
const nowMs = params.now();
|
|
63135
63218
|
let graph;
|
|
@@ -63153,8 +63236,8 @@ function resolvePoolLaunch(params) {
|
|
|
63153
63236
|
}
|
|
63154
63237
|
for (const gone of graph.missing) {
|
|
63155
63238
|
const key = `${gone.pool}:${gone.identity}`;
|
|
63156
|
-
if (!
|
|
63157
|
-
|
|
63239
|
+
if (!warned2.has(key)) {
|
|
63240
|
+
warned2.add(key);
|
|
63158
63241
|
log.warn(`agent-shim: pool "${gone.pool}" names identity "${gone.identity}", which does not exist; skipping it`);
|
|
63159
63242
|
}
|
|
63160
63243
|
}
|
|
@@ -64036,11 +64119,11 @@ function buildCloudRequestBody(params) {
|
|
|
64036
64119
|
}
|
|
64037
64120
|
return JSON.stringify(params.request);
|
|
64038
64121
|
}
|
|
64039
|
-
function
|
|
64122
|
+
function isRecord5(value2) {
|
|
64040
64123
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
64041
64124
|
}
|
|
64042
64125
|
function isGeminiChunk(value2) {
|
|
64043
|
-
return
|
|
64126
|
+
return isRecord5(value2);
|
|
64044
64127
|
}
|
|
64045
64128
|
async function* callCloudAntigravity(params, fetchFn = fetch) {
|
|
64046
64129
|
const url2 = buildCloudUrl(params.config, params.model);
|
|
@@ -64075,8 +64158,8 @@ async function* callCloudAntigravity(params, fetchFn = fetch) {
|
|
|
64075
64158
|
if (jsonStr.length > 0) {
|
|
64076
64159
|
try {
|
|
64077
64160
|
const parsed = JSON.parse(jsonStr);
|
|
64078
|
-
if (
|
|
64079
|
-
const unwrapped =
|
|
64161
|
+
if (isRecord5(parsed)) {
|
|
64162
|
+
const unwrapped = isRecord5(parsed.response) ? parsed.response : parsed;
|
|
64080
64163
|
if (isGeminiChunk(unwrapped)) {
|
|
64081
64164
|
yield unwrapped;
|
|
64082
64165
|
}
|
|
@@ -115102,7 +115185,7 @@ var LiveTaskSchema = external_exports.strictObject({
|
|
|
115102
115185
|
observedAt: external_exports.number()
|
|
115103
115186
|
});
|
|
115104
115187
|
var SYSTEM_SUBTYPES = ["task_started", "task_progress", "task_updated", "task_notification", "background_tasks_changed"];
|
|
115105
|
-
function
|
|
115188
|
+
function isRecord6(value2) {
|
|
115106
115189
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
115107
115190
|
}
|
|
115108
115191
|
function stringField(record2, field) {
|
|
@@ -115119,7 +115202,7 @@ function booleanField(record2, field) {
|
|
|
115119
115202
|
}
|
|
115120
115203
|
function usageOf(record2) {
|
|
115121
115204
|
const raw = record2.usage;
|
|
115122
|
-
if (!
|
|
115205
|
+
if (!isRecord6(raw)) {
|
|
115123
115206
|
return void 0;
|
|
115124
115207
|
}
|
|
115125
115208
|
const totalTokens = numberField(raw, "total_tokens");
|
|
@@ -115151,7 +115234,7 @@ function bounded(book) {
|
|
|
115151
115234
|
return book;
|
|
115152
115235
|
}
|
|
115153
115236
|
function applyAgentTaskEvent(book, sessionId, payload, observedAt2) {
|
|
115154
|
-
if (!
|
|
115237
|
+
if (!isRecord6(payload) || payload.type !== "system") {
|
|
115155
115238
|
return book;
|
|
115156
115239
|
}
|
|
115157
115240
|
const subtype = payload.subtype;
|
|
@@ -115167,8 +115250,8 @@ function applyAgentTaskEvent(book, sessionId, payload, observedAt2) {
|
|
|
115167
115250
|
if (subtype === "background_tasks_changed") {
|
|
115168
115251
|
const tasks = Array.isArray(payload.tasks) ? payload.tasks : [];
|
|
115169
115252
|
for (const raw of tasks) {
|
|
115170
|
-
const taskId2 =
|
|
115171
|
-
if (
|
|
115253
|
+
const taskId2 = isRecord6(raw) ? stringField(raw, "task_id") : void 0;
|
|
115254
|
+
if (isRecord6(raw) && taskId2 !== void 0) {
|
|
115172
115255
|
upsert(taskId2, { runId: stringField(raw, "run_id"), taskType: stringField(raw, "task_type"), description: stringField(raw, "description") });
|
|
115173
115256
|
}
|
|
115174
115257
|
}
|
|
@@ -115191,7 +115274,7 @@ function applyAgentTaskEvent(book, sessionId, payload, observedAt2) {
|
|
|
115191
115274
|
} else if (subtype === "task_progress") {
|
|
115192
115275
|
upsert(taskId, { ...common, subagentType: stringField(payload, "subagent_type"), lastToolName: stringField(payload, "last_tool_name"), usage: usageOf(payload) });
|
|
115193
115276
|
} else if (subtype === "task_updated") {
|
|
115194
|
-
const patch =
|
|
115277
|
+
const patch = isRecord6(payload.patch) ? payload.patch : {};
|
|
115195
115278
|
upsert(taskId, { runId: stringField(payload, "run_id"), status: stringField(patch, "status") });
|
|
115196
115279
|
} else {
|
|
115197
115280
|
upsert(taskId, { ...common, status: stringField(payload, "status"), outputFile: stringField(payload, "output_file"), summary: stringField(payload, "summary"), usage: usageOf(payload) });
|
|
@@ -115273,7 +115356,7 @@ function sessionCreateId(body) {
|
|
|
115273
115356
|
const id2 = session.id;
|
|
115274
115357
|
return typeof id2 === "string" && id2.startsWith(RC_SESSION_ID_PREFIX) ? id2 : void 0;
|
|
115275
115358
|
}
|
|
115276
|
-
function
|
|
115359
|
+
function isRecord7(value2) {
|
|
115277
115360
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
115278
115361
|
}
|
|
115279
115362
|
function parseJsonObject(body) {
|
|
@@ -115283,7 +115366,7 @@ function parseJsonObject(body) {
|
|
|
115283
115366
|
} catch {
|
|
115284
115367
|
return void 0;
|
|
115285
115368
|
}
|
|
115286
|
-
return
|
|
115369
|
+
return isRecord7(parsed) ? parsed : void 0;
|
|
115287
115370
|
}
|
|
115288
115371
|
function nonEmptyString(record2, field) {
|
|
115289
115372
|
const value2 = record2 === void 0 ? void 0 : record2[field];
|
|
@@ -115304,11 +115387,11 @@ function payloadEventsOf(body) {
|
|
|
115304
115387
|
}
|
|
115305
115388
|
const payloads = [];
|
|
115306
115389
|
for (const event of events) {
|
|
115307
|
-
if (!
|
|
115390
|
+
if (!isRecord7(event)) {
|
|
115308
115391
|
continue;
|
|
115309
115392
|
}
|
|
115310
115393
|
const payload = event.payload;
|
|
115311
|
-
if (!
|
|
115394
|
+
if (!isRecord7(payload)) {
|
|
115312
115395
|
continue;
|
|
115313
115396
|
}
|
|
115314
115397
|
payloads.push(payload);
|
|
@@ -115323,7 +115406,7 @@ function pendingOfControlRequestPayload(payload) {
|
|
|
115323
115406
|
if (requestId === void 0) {
|
|
115324
115407
|
return void 0;
|
|
115325
115408
|
}
|
|
115326
|
-
const request7 =
|
|
115409
|
+
const request7 = isRecord7(payload.request) ? payload.request : void 0;
|
|
115327
115410
|
const subtype = nonEmptyString(request7, "subtype");
|
|
115328
115411
|
const type2 = subtype ?? "control_request";
|
|
115329
115412
|
let summary = "";
|
|
@@ -115340,7 +115423,7 @@ function answeredRequestIdsOfControlResponsePayload(payload) {
|
|
|
115340
115423
|
if (payload.type !== "control_response") {
|
|
115341
115424
|
return [];
|
|
115342
115425
|
}
|
|
115343
|
-
const response =
|
|
115426
|
+
const response = isRecord7(payload.response) ? payload.response : void 0;
|
|
115344
115427
|
const id2 = nonEmptyString(response, "request_id") ?? nonEmptyString(payload, "request_id") ?? nonEmptyString(payload, "uuid");
|
|
115345
115428
|
return id2 === void 0 ? [] : [id2];
|
|
115346
115429
|
}
|
|
@@ -115569,7 +115652,7 @@ function createRcSessionTracker(deps) {
|
|
|
115569
115652
|
return;
|
|
115570
115653
|
}
|
|
115571
115654
|
entry.sequenceNum = entry.sequenceNum === void 0 || event.sequence_num > entry.sequenceNum ? event.sequence_num : entry.sequenceNum;
|
|
115572
|
-
if (!
|
|
115655
|
+
if (!isRecord7(event.payload)) {
|
|
115573
115656
|
return;
|
|
115574
115657
|
}
|
|
115575
115658
|
entry.liveTasks = applyAgentTaskEvent(entry.liveTasks, sessionId, event.payload, deps.now());
|
|
@@ -117143,6 +117226,7 @@ function identitySignIn(fs24, probe, identity) {
|
|
|
117143
117226
|
|
|
117144
117227
|
// src/doctorReport.ts
|
|
117145
117228
|
init_load();
|
|
117229
|
+
init_unrecognisedKeys();
|
|
117146
117230
|
init_schema();
|
|
117147
117231
|
init_credential();
|
|
117148
117232
|
init_credentialCache();
|
|
@@ -117353,11 +117437,11 @@ function validateJson(schema, input2) {
|
|
|
117353
117437
|
} catch (error63) {
|
|
117354
117438
|
return { ok: false, message: `${input2.path} is not valid JSON: ${error63 instanceof Error ? error63.message : String(error63)}` };
|
|
117355
117439
|
}
|
|
117356
|
-
const result = schema
|
|
117440
|
+
const result = parseIgnoringUnrecognisedKeys(schema, parsed);
|
|
117357
117441
|
if (!result.success) {
|
|
117358
|
-
return { ok: false, message: new ConfigValidationError(input2.path, result.
|
|
117442
|
+
return { ok: false, message: new ConfigValidationError(input2.path, result.issues).message };
|
|
117359
117443
|
}
|
|
117360
|
-
return { ok: true, data: result.data };
|
|
117444
|
+
return { ok: true, data: result.data, ...result.ignored.length === 0 ? {} : { warning: describeIgnoredKeys(input2.path, result.ignored) } };
|
|
117361
117445
|
}
|
|
117362
117446
|
function tcpPortEraRecord(raw) {
|
|
117363
117447
|
let parsed;
|
|
@@ -117450,11 +117534,14 @@ function pushProvider(push, entry, cacheEnv, signIn) {
|
|
|
117450
117534
|
push("provider", "fail", new LegacyProviderFileError(entry.path, conversion).message, entry.name);
|
|
117451
117535
|
return;
|
|
117452
117536
|
}
|
|
117453
|
-
const validated2 = ProviderSchema
|
|
117537
|
+
const validated2 = parseIgnoringUnrecognisedKeys(ProviderSchema, parsed);
|
|
117454
117538
|
if (!validated2.success) {
|
|
117455
|
-
push("provider", "fail", new ConfigValidationError(entry.path, validated2.
|
|
117539
|
+
push("provider", "fail", new ConfigValidationError(entry.path, validated2.issues).message, entry.name);
|
|
117456
117540
|
return;
|
|
117457
117541
|
}
|
|
117542
|
+
if (validated2.ignored.length > 0) {
|
|
117543
|
+
push("provider", "warn", describeIgnoredKeys(entry.path, validated2.ignored), entry.name);
|
|
117544
|
+
}
|
|
117458
117545
|
const cache = cacheClause(cacheEnv, `provider ${entry.name}`, validated2.data.credential);
|
|
117459
117546
|
push("provider", cache.unreadable ? "fail" : "pass", `${entry.name} is valid (${describeProviderEndpoint(validated2.data)}, credential ${describeCredential(validated2.data.credential)})${cache.text}.`, entry.name);
|
|
117460
117547
|
if (validated2.data.env?.ENABLE_TOOL_SEARCH === void 0) {
|
|
@@ -117489,6 +117576,13 @@ function runDoctor(params) {
|
|
|
117489
117576
|
const push = (section, severity, message, subject) => {
|
|
117490
117577
|
findings.push({ section, severity, message, ...subject === void 0 ? {} : { subject } });
|
|
117491
117578
|
};
|
|
117579
|
+
const validate2 = (schema, input2, section, subject) => {
|
|
117580
|
+
const validated2 = validateJson(schema, input2);
|
|
117581
|
+
if (validated2.ok && validated2.warning !== void 0) {
|
|
117582
|
+
push(section, "warn", validated2.warning, subject);
|
|
117583
|
+
}
|
|
117584
|
+
return validated2;
|
|
117585
|
+
};
|
|
117492
117586
|
const checkPin = (section, subject, where, version2) => {
|
|
117493
117587
|
const installed = params.installedClaudeVersions;
|
|
117494
117588
|
if (version2 === void 0 || installed === void 0 || installed.includes(version2)) {
|
|
@@ -117528,7 +117622,7 @@ function runDoctor(params) {
|
|
|
117528
117622
|
pushLegacyName(push, params);
|
|
117529
117623
|
const profileSources = /* @__PURE__ */ new Map();
|
|
117530
117624
|
for (const entry of params.configProfiles) {
|
|
117531
|
-
const validated2 =
|
|
117625
|
+
const validated2 = validate2(ConfigProfileSchema, entry, "config-profile", entry.name);
|
|
117532
117626
|
if (!validated2.ok) {
|
|
117533
117627
|
push("config-profile", "fail", validated2.message, entry.name);
|
|
117534
117628
|
continue;
|
|
@@ -117550,7 +117644,7 @@ function runDoctor(params) {
|
|
|
117550
117644
|
const validProfileNames = new Set(profileSources.keys());
|
|
117551
117645
|
const validIdentityNames = /* @__PURE__ */ new Set();
|
|
117552
117646
|
for (const entry of params.identities) {
|
|
117553
|
-
const validated2 =
|
|
117647
|
+
const validated2 = validate2(IdentitySchema, entry, "identity", entry.name);
|
|
117554
117648
|
if (!validated2.ok) {
|
|
117555
117649
|
push("identity", "fail", validated2.message, entry.name);
|
|
117556
117650
|
continue;
|
|
@@ -117636,7 +117730,7 @@ function runDoctor(params) {
|
|
|
117636
117730
|
if (params.directoryRules.raw === void 0) {
|
|
117637
117731
|
push("directory-rules", "pass", "No directory-rules.json configured.");
|
|
117638
117732
|
} else {
|
|
117639
|
-
const validated2 =
|
|
117733
|
+
const validated2 = validate2(DirectoryRulesSchema, params.directoryRules, "directory-rules");
|
|
117640
117734
|
if (!validated2.ok) {
|
|
117641
117735
|
push("directory-rules", "fail", validated2.message);
|
|
117642
117736
|
} else {
|
|
@@ -117661,7 +117755,7 @@ function runDoctor(params) {
|
|
|
117661
117755
|
if (params.globalConfig.raw === void 0) {
|
|
117662
117756
|
push("global-config", "pass", "No config.json configured.");
|
|
117663
117757
|
} else {
|
|
117664
|
-
const validated2 =
|
|
117758
|
+
const validated2 = validate2(GlobalConfigSchema, params.globalConfig, "global-config");
|
|
117665
117759
|
if (!validated2.ok) {
|
|
117666
117760
|
push("global-config", "fail", validated2.message);
|
|
117667
117761
|
} else {
|
|
@@ -117681,7 +117775,7 @@ function runDoctor(params) {
|
|
|
117681
117775
|
if (params.categoriesLocal.raw === void 0) {
|
|
117682
117776
|
push("categories-local", "pass", "No categories.local.json configured.");
|
|
117683
117777
|
} else {
|
|
117684
|
-
const validated2 =
|
|
117778
|
+
const validated2 = validate2(CategoryClassificationOverlaySchema, params.categoriesLocal, "categories-local");
|
|
117685
117779
|
push(
|
|
117686
117780
|
"categories-local",
|
|
117687
117781
|
validated2.ok ? "pass" : "fail",
|
|
@@ -120447,7 +120541,7 @@ var HTTP_METHODS_UP_TO_V31 = [
|
|
|
120447
120541
|
function operationFields(convert) {
|
|
120448
120542
|
return Object.fromEntries(HTTP_METHODS_UP_TO_V31.map((method) => [method, convert]));
|
|
120449
120543
|
}
|
|
120450
|
-
function
|
|
120544
|
+
function isRecord8(value2) {
|
|
120451
120545
|
if (typeof value2 !== "object" || value2 === null) {
|
|
120452
120546
|
return false;
|
|
120453
120547
|
}
|
|
@@ -120467,7 +120561,7 @@ function setOwn2(object3, key, value2) {
|
|
|
120467
120561
|
}
|
|
120468
120562
|
}
|
|
120469
120563
|
function cloneValue(value2, seen) {
|
|
120470
|
-
if (!(Array.isArray(value2) ||
|
|
120564
|
+
if (!(Array.isArray(value2) || isRecord8(value2))) {
|
|
120471
120565
|
return value2;
|
|
120472
120566
|
}
|
|
120473
120567
|
const existing = seen.get(value2);
|
|
@@ -120490,14 +120584,14 @@ function cloneValue(value2, seen) {
|
|
|
120490
120584
|
return out;
|
|
120491
120585
|
}
|
|
120492
120586
|
function deepClone(value2) {
|
|
120493
|
-
if (!(Array.isArray(value2) ||
|
|
120587
|
+
if (!(Array.isArray(value2) || isRecord8(value2))) {
|
|
120494
120588
|
return value2;
|
|
120495
120589
|
}
|
|
120496
120590
|
return cloneValue(value2, /* @__PURE__ */ new WeakMap());
|
|
120497
120591
|
}
|
|
120498
120592
|
var converting = /* @__PURE__ */ new WeakMap();
|
|
120499
120593
|
function convertRecord(value2, fields, finish) {
|
|
120500
|
-
if (!
|
|
120594
|
+
if (!isRecord8(value2)) {
|
|
120501
120595
|
return deepClone(value2);
|
|
120502
120596
|
}
|
|
120503
120597
|
const inProgress = converting.get(value2);
|
|
@@ -120523,7 +120617,7 @@ function convertRecord(value2, fields, finish) {
|
|
|
120523
120617
|
}
|
|
120524
120618
|
}
|
|
120525
120619
|
function mapRecord(value2, convert) {
|
|
120526
|
-
if (!
|
|
120620
|
+
if (!isRecord8(value2)) {
|
|
120527
120621
|
return deepClone(value2);
|
|
120528
120622
|
}
|
|
120529
120623
|
const out = {};
|
|
@@ -120542,7 +120636,7 @@ function mapArray(value2, convert) {
|
|
|
120542
120636
|
return value2.map((item) => convert(item)).filter((item) => item !== DROP);
|
|
120543
120637
|
}
|
|
120544
120638
|
function getRef(value2) {
|
|
120545
|
-
if (
|
|
120639
|
+
if (isRecord8(value2) && typeof value2.$ref === "string") {
|
|
120546
120640
|
return value2.$ref;
|
|
120547
120641
|
}
|
|
120548
120642
|
return void 0;
|
|
@@ -120748,7 +120842,7 @@ function convertSchema2(schema) {
|
|
|
120748
120842
|
if (schema === false) {
|
|
120749
120843
|
return { not: {} };
|
|
120750
120844
|
}
|
|
120751
|
-
if (
|
|
120845
|
+
if (isRecord8(schema) && typeof schema.$ref === "string" && Object.keys(schema).length === 1) {
|
|
120752
120846
|
return { $ref: schema.$ref };
|
|
120753
120847
|
}
|
|
120754
120848
|
return convertRecord(schema, SCHEMA_FIELDS, finishSchema);
|
|
@@ -120760,7 +120854,7 @@ function resolveSchemeType(name, schemes, seen) {
|
|
|
120760
120854
|
return void 0;
|
|
120761
120855
|
}
|
|
120762
120856
|
const scheme = schemes[name];
|
|
120763
|
-
if (!
|
|
120857
|
+
if (!isRecord8(scheme)) {
|
|
120764
120858
|
return void 0;
|
|
120765
120859
|
}
|
|
120766
120860
|
if (typeof scheme.type === "string") {
|
|
@@ -120777,11 +120871,11 @@ function resolveSchemeType(name, schemes, seen) {
|
|
|
120777
120871
|
return void 0;
|
|
120778
120872
|
}
|
|
120779
120873
|
function createContext(spec) {
|
|
120780
|
-
const components =
|
|
120781
|
-
const pathItems =
|
|
120782
|
-
const schemes =
|
|
120874
|
+
const components = isRecord8(spec) ? spec.components : void 0;
|
|
120875
|
+
const pathItems = isRecord8(components) ? components.pathItems : void 0;
|
|
120876
|
+
const schemes = isRecord8(components) ? components.securitySchemes : void 0;
|
|
120783
120877
|
const schemeTypes = /* @__PURE__ */ new Map();
|
|
120784
|
-
if (
|
|
120878
|
+
if (isRecord8(schemes)) {
|
|
120785
120879
|
for (const name of Object.keys(schemes)) {
|
|
120786
120880
|
const type2 = resolveSchemeType(name, schemes, /* @__PURE__ */ new Set());
|
|
120787
120881
|
if (type2 !== void 0) {
|
|
@@ -120791,7 +120885,7 @@ function createContext(spec) {
|
|
|
120791
120885
|
}
|
|
120792
120886
|
return {
|
|
120793
120887
|
inlining: /* @__PURE__ */ new Set(),
|
|
120794
|
-
pathItems:
|
|
120888
|
+
pathItems: isRecord8(pathItems) ? pathItems : void 0,
|
|
120795
120889
|
schemeTypes
|
|
120796
120890
|
};
|
|
120797
120891
|
}
|
|
@@ -120799,7 +120893,7 @@ function isMutualTls(name, context) {
|
|
|
120799
120893
|
return context.schemeTypes.get(name) === "mutualTLS";
|
|
120800
120894
|
}
|
|
120801
120895
|
function convertRequirement(value2, context) {
|
|
120802
|
-
if (!
|
|
120896
|
+
if (!isRecord8(value2)) {
|
|
120803
120897
|
return deepClone(value2);
|
|
120804
120898
|
}
|
|
120805
120899
|
const entries = Object.entries(value2);
|
|
@@ -120899,10 +120993,10 @@ function resolvePathItemRef(value2, context) {
|
|
|
120899
120993
|
return void 0;
|
|
120900
120994
|
}
|
|
120901
120995
|
const target = context.pathItems[name];
|
|
120902
|
-
return
|
|
120996
|
+
return isRecord8(target) ? [name, target] : void 0;
|
|
120903
120997
|
}
|
|
120904
120998
|
function convertPathItem(value2, context) {
|
|
120905
|
-
if (!
|
|
120999
|
+
if (!isRecord8(value2)) {
|
|
120906
121000
|
return deepClone(value2);
|
|
120907
121001
|
}
|
|
120908
121002
|
const resolved = resolvePathItemRef(value2, context);
|
|
@@ -121002,7 +121096,7 @@ function convertExample(value2) {
|
|
|
121002
121096
|
});
|
|
121003
121097
|
}
|
|
121004
121098
|
function isQuerystringParameter(value2) {
|
|
121005
|
-
return
|
|
121099
|
+
return isRecord8(value2) && value2.in === "querystring";
|
|
121006
121100
|
}
|
|
121007
121101
|
function isRemovedRef(value2, removed) {
|
|
121008
121102
|
const ref = getRef(value2);
|
|
@@ -121018,7 +121112,7 @@ function convertParameterOrHeader2(value2, context) {
|
|
|
121018
121112
|
style: (item) => item === "cookie" ? DROP : deepClone(item)
|
|
121019
121113
|
},
|
|
121020
121114
|
(out, parameter) => {
|
|
121021
|
-
const lostContent =
|
|
121115
|
+
const lostContent = isRecord8(parameter.content) && Object.keys(parameter.content).length > 0 && isRecord8(out.content) && Object.keys(out.content).length === 0;
|
|
121022
121116
|
return lostContent ? DROP : out;
|
|
121023
121117
|
}
|
|
121024
121118
|
);
|
|
@@ -121139,7 +121233,7 @@ function convertComponents2(value2, context) {
|
|
|
121139
121233
|
});
|
|
121140
121234
|
}
|
|
121141
121235
|
function losesEntireContent(value2, mediaTypes) {
|
|
121142
|
-
if (!(
|
|
121236
|
+
if (!(isRecord8(value2) && isRecord8(value2.content))) {
|
|
121143
121237
|
return false;
|
|
121144
121238
|
}
|
|
121145
121239
|
const entries = Object.values(value2.content);
|
|
@@ -121147,7 +121241,7 @@ function losesEntireContent(value2, mediaTypes) {
|
|
|
121147
121241
|
}
|
|
121148
121242
|
function indexRemovedComponentRefs(map2, prefix, mediaTypes, isDirectlyRemoved) {
|
|
121149
121243
|
const removed = /* @__PURE__ */ new Set();
|
|
121150
|
-
if (!
|
|
121244
|
+
if (!isRecord8(map2)) {
|
|
121151
121245
|
return removed;
|
|
121152
121246
|
}
|
|
121153
121247
|
const entries = Object.entries(map2);
|
|
@@ -121169,12 +121263,12 @@ function indexRemovedComponentRefs(map2, prefix, mediaTypes, isDirectlyRemoved)
|
|
|
121169
121263
|
return removed;
|
|
121170
121264
|
}
|
|
121171
121265
|
function createContext2(spec) {
|
|
121172
|
-
const components =
|
|
121173
|
-
const mediaTypes =
|
|
121266
|
+
const components = isRecord8(spec) ? spec.components : void 0;
|
|
121267
|
+
const mediaTypes = isRecord8(components) && isRecord8(components.mediaTypes) ? components.mediaTypes : void 0;
|
|
121174
121268
|
return {
|
|
121175
121269
|
mediaTypes,
|
|
121176
|
-
removedHeaderRefs: indexRemovedComponentRefs(
|
|
121177
|
-
removedParameterRefs: indexRemovedComponentRefs(
|
|
121270
|
+
removedHeaderRefs: indexRemovedComponentRefs(isRecord8(components) ? components.headers : void 0, HEADERS_REF_PREFIX, mediaTypes, () => false),
|
|
121271
|
+
removedParameterRefs: indexRemovedComponentRefs(isRecord8(components) ? components.parameters : void 0, PARAMETERS_REF_PREFIX, mediaTypes, isQuerystringParameter)
|
|
121178
121272
|
};
|
|
121179
121273
|
}
|
|
121180
121274
|
function convertJsonSchemaDialect(value2) {
|
|
@@ -127923,11 +128017,11 @@ function antigravityQuotaExhaustion(quota, model, nowMs) {
|
|
|
127923
128017
|
const binding = spent.reduce((latest, next) => latest === void 0 || next.resetSec > latest.resetSec ? next : latest, void 0);
|
|
127924
128018
|
return binding === void 0 ? void 0 : { window: binding.window, resetSec: binding.resetSec, exhaustedWindows: spent.map((entry) => entry.window) };
|
|
127925
128019
|
}
|
|
127926
|
-
function
|
|
128020
|
+
function isRecord9(value2) {
|
|
127927
128021
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
127928
128022
|
}
|
|
127929
128023
|
function bucketToEntry(bucket, nowMs) {
|
|
127930
|
-
if (!
|
|
128024
|
+
if (!isRecord9(bucket) || typeof bucket.bucketId !== "string") {
|
|
127931
128025
|
return void 0;
|
|
127932
128026
|
}
|
|
127933
128027
|
const remainingFraction = typeof bucket.remainingFraction === "number" && Number.isFinite(bucket.remainingFraction) ? bucket.remainingFraction : void 0;
|
|
@@ -127969,12 +128063,12 @@ async function fetchAntigravityQuotaSummary(params) {
|
|
|
127969
128063
|
} catch {
|
|
127970
128064
|
return void 0;
|
|
127971
128065
|
}
|
|
127972
|
-
if (!
|
|
128066
|
+
if (!isRecord9(parsed) || !Array.isArray(parsed.groups)) {
|
|
127973
128067
|
return void 0;
|
|
127974
128068
|
}
|
|
127975
128069
|
const map2 = {};
|
|
127976
128070
|
for (const group of parsed.groups) {
|
|
127977
|
-
if (!
|
|
128071
|
+
if (!isRecord9(group) || !Array.isArray(group.buckets)) {
|
|
127978
128072
|
continue;
|
|
127979
128073
|
}
|
|
127980
128074
|
for (const bucket of group.buckets) {
|
|
@@ -128198,7 +128292,7 @@ function turnBlocks2(message) {
|
|
|
128198
128292
|
}
|
|
128199
128293
|
return blocks.map((block2) => isTextBlock(block2) ? { ...block2, text: systemReminder2(block2.text) } : block2);
|
|
128200
128294
|
}
|
|
128201
|
-
function
|
|
128295
|
+
function isRecord10(value2) {
|
|
128202
128296
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
128203
128297
|
}
|
|
128204
128298
|
function messagesToGeminiContents(messages, names, toolIdToName) {
|
|
@@ -128244,7 +128338,7 @@ function messagesToGeminiContents(messages, names, toolIdToName) {
|
|
|
128244
128338
|
ensureRole("model").push({
|
|
128245
128339
|
functionCall: {
|
|
128246
128340
|
name: sanitizedName,
|
|
128247
|
-
args:
|
|
128341
|
+
args: isRecord10(block2.input) ? block2.input : {}
|
|
128248
128342
|
},
|
|
128249
128343
|
// The relay remembered the signature the backend attached to this exact call; echoing it back is what the backend requires of a repeated function call. A call with none remembered (made before a door restart, evicted from the bounded store, or produced by another model in a resumed session) gets the backend's documented bypass, since history is resent whole on every request and a single unsigned call would otherwise fail the whole conversation for good.
|
|
128250
128344
|
thoughtSignature: signature ?? UNVERIFIED_THOUGHT_SIGNATURE
|
|
@@ -129183,7 +129277,7 @@ var AcpStreamMessageSchema = external_exports.looseObject({
|
|
|
129183
129277
|
chunk: external_exports.looseObject({}).optional()
|
|
129184
129278
|
}).optional()
|
|
129185
129279
|
});
|
|
129186
|
-
function
|
|
129280
|
+
function isRecord11(value2) {
|
|
129187
129281
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
129188
129282
|
}
|
|
129189
129283
|
function normalizeFinishReason(reason) {
|
|
@@ -129208,7 +129302,7 @@ function parseJsonRecord(raw) {
|
|
|
129208
129302
|
}
|
|
129209
129303
|
try {
|
|
129210
129304
|
const parsed = JSON.parse(raw);
|
|
129211
|
-
if (
|
|
129305
|
+
if (isRecord11(parsed)) {
|
|
129212
129306
|
return parsed;
|
|
129213
129307
|
}
|
|
129214
129308
|
} catch {
|
|
@@ -129983,15 +130077,15 @@ function readFrontDoorControlMaterial(fsPort, paths, purpose) {
|
|
|
129983
130077
|
|
|
129984
130078
|
// src/frontdoor/rcLiveUsage.ts
|
|
129985
130079
|
var RC_RATE_LIMIT_EVENT_TYPE = "rate_limit_event";
|
|
129986
|
-
function
|
|
130080
|
+
function isRecord12(value2) {
|
|
129987
130081
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
129988
130082
|
}
|
|
129989
130083
|
function rcRateLimitInfoOf(event) {
|
|
129990
130084
|
const payload = event.envelope.payload;
|
|
129991
|
-
if (!
|
|
130085
|
+
if (!isRecord12(payload) || payload.type !== RC_RATE_LIMIT_EVENT_TYPE) {
|
|
129992
130086
|
return void 0;
|
|
129993
130087
|
}
|
|
129994
|
-
if (!
|
|
130088
|
+
if (!isRecord12(payload.rate_limit_info)) {
|
|
129995
130089
|
return void 0;
|
|
129996
130090
|
}
|
|
129997
130091
|
const parsed = RcRateLimitInfoSchema.safeParse(payload.rate_limit_info);
|
|
@@ -130027,7 +130121,7 @@ var RC_SELF_HOST_SCOPE_LIST = ["user:profile", "user:inference", "user:sessions:
|
|
|
130027
130121
|
var RC_SELF_HOST_OAUTH_TOKEN_TTL_SECONDS = 3600;
|
|
130028
130122
|
var MS_PER_SECOND11 = 1e3;
|
|
130029
130123
|
var HTTP_SERVICE_UNAVAILABLE = 503;
|
|
130030
|
-
function
|
|
130124
|
+
function isRecord13(value2) {
|
|
130031
130125
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
130032
130126
|
}
|
|
130033
130127
|
function parseJsonObject2(body) {
|
|
@@ -130037,7 +130131,7 @@ function parseJsonObject2(body) {
|
|
|
130037
130131
|
} catch {
|
|
130038
130132
|
return void 0;
|
|
130039
130133
|
}
|
|
130040
|
-
return
|
|
130134
|
+
return isRecord13(parsed) ? parsed : void 0;
|
|
130041
130135
|
}
|
|
130042
130136
|
function growthBookFeatures() {
|
|
130043
130137
|
return {
|
|
@@ -130131,7 +130225,7 @@ var RC_SELF_HOST_RECORD_DIR = "rc-selfhost";
|
|
|
130131
130225
|
var RC_SELF_HOST_RECORD_FILE = "credential.json";
|
|
130132
130226
|
var SELF_HOST_EMAIL = "selfhost@agent-shim.invalid";
|
|
130133
130227
|
var SELF_HOST_SUBSCRIPTION_TYPE = "max";
|
|
130134
|
-
function
|
|
130228
|
+
function isRecord14(value2) {
|
|
130135
130229
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
130136
130230
|
}
|
|
130137
130231
|
function readJsonObject(fs24, file2) {
|
|
@@ -130145,7 +130239,7 @@ function readJsonObject(fs24, file2) {
|
|
|
130145
130239
|
} catch {
|
|
130146
130240
|
return void 0;
|
|
130147
130241
|
}
|
|
130148
|
-
return
|
|
130242
|
+
return isRecord14(parsed) ? parsed : void 0;
|
|
130149
130243
|
}
|
|
130150
130244
|
function readRcSelfHostRecord(fs24, frontdoorDir) {
|
|
130151
130245
|
const parsed = readJsonObject(fs24, import_node_path49.default.join(frontdoorDir, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE));
|
|
@@ -130169,7 +130263,7 @@ function mintRcSelfHostCredential(deps) {
|
|
|
130169
130263
|
const recordFile = import_node_path49.default.join(recordDir, RC_SELF_HOST_RECORD_FILE);
|
|
130170
130264
|
const previousRecord = readRcSelfHostRecord(deps.fs, deps.frontdoorDir);
|
|
130171
130265
|
const existingCredentials = readJsonObject(deps.fs, credentialsFile);
|
|
130172
|
-
const existingOauth =
|
|
130266
|
+
const existingOauth = isRecord14(existingCredentials?.claudeAiOauth) ? existingCredentials.claudeAiOauth : void 0;
|
|
130173
130267
|
const existingToken = typeof existingOauth?.accessToken === "string" && existingOauth.accessToken !== "" ? existingOauth.accessToken : void 0;
|
|
130174
130268
|
const existingIsOwn = existingToken !== void 0 && previousRecord?.accessToken === existingToken;
|
|
130175
130269
|
if (existingToken !== void 0 && !existingIsOwn && !deps.force) {
|
|
@@ -130186,7 +130280,7 @@ function mintRcSelfHostCredential(deps) {
|
|
|
130186
130280
|
deps.fs.writeFilePrivate(credentialsFile, `${JSON.stringify({ ...existingCredentials, claudeAiOauth: { accessToken, refreshToken, expiresAt: null, scopes: [...RC_SELF_HOST_SCOPE_LIST], subscriptionType: SELF_HOST_SUBSCRIPTION_TYPE, rateLimitTier: null } }, null, 2)}
|
|
130187
130281
|
`);
|
|
130188
130282
|
const claudeJson = readJsonObject(deps.fs, claudeJsonFile) ?? {};
|
|
130189
|
-
const existingBlock = (value2) =>
|
|
130283
|
+
const existingBlock = (value2) => isRecord14(value2) ? value2 : {};
|
|
130190
130284
|
deps.fs.writeFilePrivate(claudeJsonFile, `${JSON.stringify({
|
|
130191
130285
|
...claudeJson,
|
|
130192
130286
|
oauthAccount: {
|
|
@@ -130573,11 +130667,11 @@ var import_node_path50 = __toESM(require("node:path"), 1);
|
|
|
130573
130667
|
function isSafeSessionId(sessionId) {
|
|
130574
130668
|
return /^[A-Za-z0-9_-]+$/.test(sessionId);
|
|
130575
130669
|
}
|
|
130576
|
-
function
|
|
130670
|
+
function isRecord15(value2) {
|
|
130577
130671
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
130578
130672
|
}
|
|
130579
130673
|
function credentialOfJson(parsed) {
|
|
130580
|
-
if (!
|
|
130674
|
+
if (!isRecord15(parsed)) {
|
|
130581
130675
|
return void 0;
|
|
130582
130676
|
}
|
|
130583
130677
|
const { authorization, anthropicVersion, anthropicClientPlatform } = parsed;
|
|
@@ -130607,7 +130701,7 @@ function createRcCredentialStore(fs24, dir) {
|
|
|
130607
130701
|
} catch {
|
|
130608
130702
|
return void 0;
|
|
130609
130703
|
}
|
|
130610
|
-
return
|
|
130704
|
+
return isRecord15(parsed) ? parsed : void 0;
|
|
130611
130705
|
};
|
|
130612
130706
|
return {
|
|
130613
130707
|
read: (sessionId) => {
|
|
@@ -131175,7 +131269,7 @@ init_capability();
|
|
|
131175
131269
|
// src/frontdoor/rcSelfHostEndpoints.ts
|
|
131176
131270
|
var RC_SOURCE_WORKER = "worker";
|
|
131177
131271
|
var RC_SOURCE_CLIENT = "client";
|
|
131178
|
-
function
|
|
131272
|
+
function isRecord16(value2) {
|
|
131179
131273
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
131180
131274
|
}
|
|
131181
131275
|
function parseJsonObject3(body) {
|
|
@@ -131185,7 +131279,7 @@ function parseJsonObject3(body) {
|
|
|
131185
131279
|
} catch {
|
|
131186
131280
|
return void 0;
|
|
131187
131281
|
}
|
|
131188
|
-
return
|
|
131282
|
+
return isRecord16(parsed) ? parsed : void 0;
|
|
131189
131283
|
}
|
|
131190
131284
|
function nonEmptyString2(record2, field) {
|
|
131191
131285
|
const value2 = record2 === void 0 ? void 0 : record2[field];
|
|
@@ -131259,7 +131353,7 @@ async function serveRcClientChannels(ctx, tail, method, maxBatchEvents) {
|
|
|
131259
131353
|
}
|
|
131260
131354
|
const results = [];
|
|
131261
131355
|
for (const event of events) {
|
|
131262
|
-
if (!
|
|
131356
|
+
if (!isRecord16(event) || !isRecord16(event.payload)) {
|
|
131263
131357
|
await ctx.answerJson(response, HTTP_STATUS.badRequest, { type: "error", error: { type: "invalid_request_error", message: "every event in a teleport write is an object carrying one payload object" } });
|
|
131264
131358
|
return true;
|
|
131265
131359
|
}
|
|
@@ -131359,7 +131453,7 @@ async function serveRcCompatSessions(ctx, pathname, compatPath) {
|
|
|
131359
131453
|
// src/frontdoor/rcSelfHostConversations.ts
|
|
131360
131454
|
var RC_CONVERSATIONS_PATH_PREFIX = "/v1/code/conversations";
|
|
131361
131455
|
var RC_CONVERSATION_ID_PREFIX = "conv_";
|
|
131362
|
-
function
|
|
131456
|
+
function isRecord17(value2) {
|
|
131363
131457
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
131364
131458
|
}
|
|
131365
131459
|
function parseJsonObject4(body) {
|
|
@@ -131369,7 +131463,7 @@ function parseJsonObject4(body) {
|
|
|
131369
131463
|
} catch {
|
|
131370
131464
|
return void 0;
|
|
131371
131465
|
}
|
|
131372
|
-
return
|
|
131466
|
+
return isRecord17(parsed) ? parsed : void 0;
|
|
131373
131467
|
}
|
|
131374
131468
|
function nonEmptyString3(record2, field) {
|
|
131375
131469
|
const value2 = record2 === void 0 ? void 0 : record2[field];
|
|
@@ -131423,7 +131517,7 @@ async function serveRcConversations(ctx, pathname, method) {
|
|
|
131423
131517
|
}
|
|
131424
131518
|
const results = [];
|
|
131425
131519
|
for (const event of events) {
|
|
131426
|
-
if (!
|
|
131520
|
+
if (!isRecord17(event) || !isRecord17(event.payload)) {
|
|
131427
131521
|
await ctx.answerJson(response, HTTP_STATUS.badRequest, { type: "error", error: { type: "invalid_request_error", message: "every event in a write is an object carrying one payload object" } });
|
|
131428
131522
|
return;
|
|
131429
131523
|
}
|
|
@@ -131716,7 +131810,7 @@ var RC_SELF_HOST_WORKER_EPOCH = 1;
|
|
|
131716
131810
|
var RC_STREAM_EVENT_NAME = "client_event";
|
|
131717
131811
|
var CONFLICT_REASON_HEADER2 = "x-ccr-conflict-reason";
|
|
131718
131812
|
var CONFLICT_REASON_EPOCH_STALE = "epoch_stale";
|
|
131719
|
-
function
|
|
131813
|
+
function isRecord18(value2) {
|
|
131720
131814
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
131721
131815
|
}
|
|
131722
131816
|
function isWebSearchRefusal(value2) {
|
|
@@ -131800,7 +131894,7 @@ function parseJsonObject5(body) {
|
|
|
131800
131894
|
} catch {
|
|
131801
131895
|
return void 0;
|
|
131802
131896
|
}
|
|
131803
|
-
return
|
|
131897
|
+
return isRecord18(parsed) ? parsed : void 0;
|
|
131804
131898
|
}
|
|
131805
131899
|
function mintWorkerJwt(randomToken, issuedAt) {
|
|
131806
131900
|
const encode3 = (value2) => Buffer.from(JSON.stringify(value2), "utf8").toString("base64url");
|
|
@@ -132060,7 +132154,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
132060
132154
|
if (status !== void 0) {
|
|
132061
132155
|
session.workerStatus = status;
|
|
132062
132156
|
}
|
|
132063
|
-
if (
|
|
132157
|
+
if (isRecord18(body?.external_metadata)) {
|
|
132064
132158
|
session.externalMetadata = body.external_metadata;
|
|
132065
132159
|
}
|
|
132066
132160
|
await answerJson2(response, HTTP_STATUS.ok, {});
|
|
@@ -132090,7 +132184,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
132090
132184
|
}
|
|
132091
132185
|
const results = [];
|
|
132092
132186
|
for (const event of events) {
|
|
132093
|
-
if (!
|
|
132187
|
+
if (!isRecord18(event) || !isRecord18(event.payload)) {
|
|
132094
132188
|
await answerJson2(response, HTTP_STATUS.badRequest, { type: "error", error: { type: "invalid_request_error", message: "every event in a batch is an object carrying one payload object" } });
|
|
132095
132189
|
return;
|
|
132096
132190
|
}
|
|
@@ -132123,7 +132217,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
132123
132217
|
return;
|
|
132124
132218
|
}
|
|
132125
132219
|
for (const event of events) {
|
|
132126
|
-
if (
|
|
132220
|
+
if (isRecord18(event)) {
|
|
132127
132221
|
session.internalEvents.push({ eventId: deps.newUuid(), body: event });
|
|
132128
132222
|
}
|
|
132129
132223
|
}
|
|
@@ -132219,7 +132313,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
132219
132313
|
}
|
|
132220
132314
|
const results = [];
|
|
132221
132315
|
for (const event of events) {
|
|
132222
|
-
if (!
|
|
132316
|
+
if (!isRecord18(event) || !isRecord18(event.payload)) {
|
|
132223
132317
|
await answerJson2(response, HTTP_STATUS.badRequest, { type: "error", error: { type: "invalid_request_error", message: "every event in a write is an object carrying one payload object" } });
|
|
132224
132318
|
return;
|
|
132225
132319
|
}
|
|
@@ -132409,7 +132503,7 @@ function createSseParser() {
|
|
|
132409
132503
|
}
|
|
132410
132504
|
};
|
|
132411
132505
|
}
|
|
132412
|
-
function
|
|
132506
|
+
function isRecord19(value2) {
|
|
132413
132507
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
132414
132508
|
}
|
|
132415
132509
|
function sequenceNumOf(value2) {
|
|
@@ -132431,7 +132525,7 @@ function parseRcStreamEnvelope(parsed) {
|
|
|
132431
132525
|
} catch {
|
|
132432
132526
|
return void 0;
|
|
132433
132527
|
}
|
|
132434
|
-
if (!
|
|
132528
|
+
if (!isRecord19(data)) {
|
|
132435
132529
|
return void 0;
|
|
132436
132530
|
}
|
|
132437
132531
|
const eventType = data.event_type;
|