claude-use 11.89.1 → 11.90.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/README.md +1 -0
- package/dist/cli.cjs +1873 -1018
- package/dist/index.cjs +1089 -594
- package/dist/index.mjs +1071 -585
- package/dist/types/index.d.ts +541 -183
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -7268,30 +7268,30 @@ var init_state2 = __esm({
|
|
|
7268
7268
|
});
|
|
7269
7269
|
|
|
7270
7270
|
// src/headroom/earlierRelease.ts
|
|
7271
|
-
function withoutOurSocket(
|
|
7271
|
+
function withoutOurSocket(commandLine2, socketPath) {
|
|
7272
7272
|
for (const argument of [`--uds ${socketPath}`, `--uds=${socketPath}`]) {
|
|
7273
7273
|
let from = 0;
|
|
7274
7274
|
for (; ; ) {
|
|
7275
|
-
const index =
|
|
7275
|
+
const index = commandLine2.indexOf(argument, from);
|
|
7276
7276
|
if (index === -1) {
|
|
7277
7277
|
break;
|
|
7278
7278
|
}
|
|
7279
7279
|
const end = index + argument.length;
|
|
7280
|
-
const startsArgument = index === 0 || /\s/.test(
|
|
7281
|
-
const endsArgument = end ===
|
|
7280
|
+
const startsArgument = index === 0 || /\s/.test(commandLine2.charAt(index - 1));
|
|
7281
|
+
const endsArgument = end === commandLine2.length || /\s/.test(commandLine2.charAt(end));
|
|
7282
7282
|
if (startsArgument && endsArgument) {
|
|
7283
|
-
return `${
|
|
7283
|
+
return `${commandLine2.slice(0, index)} ${commandLine2.slice(end)}`;
|
|
7284
7284
|
}
|
|
7285
7285
|
from = index + 1;
|
|
7286
7286
|
}
|
|
7287
7287
|
}
|
|
7288
7288
|
return void 0;
|
|
7289
7289
|
}
|
|
7290
|
-
function daemonIdentity(
|
|
7291
|
-
if (
|
|
7290
|
+
function daemonIdentity(commandLine2, socketPath) {
|
|
7291
|
+
if (commandLine2 === void 0) {
|
|
7292
7292
|
return "unreadable";
|
|
7293
7293
|
}
|
|
7294
|
-
const rest = withoutOurSocket(
|
|
7294
|
+
const rest = withoutOurSocket(commandLine2, socketPath);
|
|
7295
7295
|
const argumentsList = rest === void 0 ? [] : rest.trim().split(/\s+/);
|
|
7296
7296
|
if (rest === void 0 || !argumentsList.includes("proxy")) {
|
|
7297
7297
|
return "not-headroom";
|
|
@@ -7390,8 +7390,8 @@ function ensureHeadroom(params) {
|
|
|
7390
7390
|
writeSession(ports.fs, paths.headroomSessionsDir, { pid: params.launcherPid, startedAt: ports.now(), supervisorPid: state.supervisorPid });
|
|
7391
7391
|
return { socketPath: state.socketPath };
|
|
7392
7392
|
}
|
|
7393
|
-
const
|
|
7394
|
-
const earlierRelease = earlierReleaseDaemon(ports.fs, paths, { commandLine, socketPath: state.socketPath, recordedHash: state.allowlistHash });
|
|
7393
|
+
const commandLine2 = commandLineOf(state.headroomPid);
|
|
7394
|
+
const earlierRelease = earlierReleaseDaemon(ports.fs, paths, { commandLine: commandLine2, socketPath: state.socketPath, recordedHash: state.allowlistHash });
|
|
7395
7395
|
if (earlierRelease !== void 0) {
|
|
7396
7396
|
if (earlierRelease.admitsServingDoor) {
|
|
7397
7397
|
writeSession(ports.fs, paths.headroomSessionsDir, { pid: params.launcherPid, startedAt: ports.now(), supervisorPid: state.supervisorPid });
|
|
@@ -7401,7 +7401,7 @@ function ensureHeadroom(params) {
|
|
|
7401
7401
|
`the running headroom daemon (pid ${String(state.headroomPid)}) was ${EARLIER_RELEASE_ALLOWLIST}, and its allowlist cannot be shown to admit the serving front door; launch with --no-headroom until then. Supervisor and daemon log: ${paths.headroomLogPath}`
|
|
7402
7402
|
);
|
|
7403
7403
|
}
|
|
7404
|
-
awaiting = { daemonPid: state.headroomPid, identity: daemonIdentity(
|
|
7404
|
+
awaiting = { daemonPid: state.headroomPid, identity: daemonIdentity(commandLine2, state.socketPath) };
|
|
7405
7405
|
}
|
|
7406
7406
|
if (state.lastError !== void 0) {
|
|
7407
7407
|
throw new HeadroomStartError(
|
|
@@ -10492,7 +10492,7 @@ var init_package = __esm({
|
|
|
10492
10492
|
"package.json"() {
|
|
10493
10493
|
package_default = {
|
|
10494
10494
|
name: "claude-use",
|
|
10495
|
-
version: "11.
|
|
10495
|
+
version: "11.90.0",
|
|
10496
10496
|
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.",
|
|
10497
10497
|
license: "MIT",
|
|
10498
10498
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -10838,7 +10838,7 @@ var init_paths = __esm({
|
|
|
10838
10838
|
});
|
|
10839
10839
|
|
|
10840
10840
|
// src/providerAliases.ts
|
|
10841
|
-
import { z as
|
|
10841
|
+
import { z as z25 } from "zod";
|
|
10842
10842
|
function parseAliases(file, raw) {
|
|
10843
10843
|
const parsed = ProviderAliasesSchema.safeParse(raw);
|
|
10844
10844
|
if (!parsed.success) {
|
|
@@ -10877,7 +10877,7 @@ var init_providerAliases = __esm({
|
|
|
10877
10877
|
init_cliError();
|
|
10878
10878
|
init_load();
|
|
10879
10879
|
init_store();
|
|
10880
|
-
ProviderAliasesSchema =
|
|
10880
|
+
ProviderAliasesSchema = z25.record(z25.string().min(1), z25.string().min(1));
|
|
10881
10881
|
}
|
|
10882
10882
|
});
|
|
10883
10883
|
|
|
@@ -11102,14 +11102,14 @@ function requireProviderExists(paths, name) {
|
|
|
11102
11102
|
throw new ProviderNotFoundError(name);
|
|
11103
11103
|
}
|
|
11104
11104
|
}
|
|
11105
|
-
function
|
|
11105
|
+
function isRecord8(value) {
|
|
11106
11106
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
11107
11107
|
}
|
|
11108
11108
|
function legacyProviderConversion(raw) {
|
|
11109
|
-
if (!
|
|
11109
|
+
if (!isRecord8(raw) || "credential" in raw) {
|
|
11110
11110
|
return void 0;
|
|
11111
11111
|
}
|
|
11112
|
-
const env =
|
|
11112
|
+
const env = isRecord8(raw.env) ? raw.env : void 0;
|
|
11113
11113
|
const legacyEnvKeys = env === void 0 ? [] : Object.keys(env).filter((key) => LEGACY_ENV_CREDENTIAL_KEYS.includes(key));
|
|
11114
11114
|
const fields = [...LEGACY_PROVIDER_FIELDS.filter((field) => field in raw), ...legacyEnvKeys.map((key) => `env.${key}`)];
|
|
11115
11115
|
if (fields.length === 0) {
|
|
@@ -11592,7 +11592,7 @@ var init_headers = __esm({
|
|
|
11592
11592
|
|
|
11593
11593
|
// src/launcher/injected.ts
|
|
11594
11594
|
import { createHash as createHash8 } from "node:crypto";
|
|
11595
|
-
import { z as
|
|
11595
|
+
import { z as z26 } from "zod";
|
|
11596
11596
|
function listKey(list) {
|
|
11597
11597
|
return `${list},appended`;
|
|
11598
11598
|
}
|
|
@@ -11685,7 +11685,7 @@ var init_injected = __esm({
|
|
|
11685
11685
|
INJECTED_ENV = "AGENT_SHIM_INJECTED";
|
|
11686
11686
|
CUSTOM_HEADERS_ENV = "ANTHROPIC_CUSTOM_HEADERS";
|
|
11687
11687
|
HEADER_KEY_PREFIX = `${CUSTOM_HEADERS_ENV}:`;
|
|
11688
|
-
InjectedSchema =
|
|
11688
|
+
InjectedSchema = z26.record(z26.string(), z26.string());
|
|
11689
11689
|
}
|
|
11690
11690
|
});
|
|
11691
11691
|
|
|
@@ -11821,7 +11821,7 @@ var init_commandDeps = __esm({
|
|
|
11821
11821
|
// src/claudeShim.ts
|
|
11822
11822
|
import fs11 from "node:fs";
|
|
11823
11823
|
import path38 from "node:path";
|
|
11824
|
-
import { z as
|
|
11824
|
+
import { z as z31 } from "zod";
|
|
11825
11825
|
function commandFilename(ownExecutablePath, commandName) {
|
|
11826
11826
|
return ownExecutablePath.toLowerCase().endsWith(".exe") ? `${commandName}.exe` : commandName;
|
|
11827
11827
|
}
|
|
@@ -11871,35 +11871,35 @@ var init_claudeShim = __esm({
|
|
|
11871
11871
|
init_store();
|
|
11872
11872
|
init_realPorts();
|
|
11873
11873
|
init_cliError();
|
|
11874
|
-
ClaudeShimStateSchema =
|
|
11875
|
-
targetPath:
|
|
11876
|
-
method:
|
|
11877
|
-
installedAtMs:
|
|
11874
|
+
ClaudeShimStateSchema = z31.strictObject({
|
|
11875
|
+
targetPath: z31.string().min(1),
|
|
11876
|
+
method: z31.enum(["hardlink", "copy"]),
|
|
11877
|
+
installedAtMs: z31.number()
|
|
11878
11878
|
});
|
|
11879
11879
|
nodeLinkFs = { link: fs11.linkSync, copyFile: fs11.copyFileSync, chmod: fs11.chmodSync };
|
|
11880
11880
|
}
|
|
11881
11881
|
});
|
|
11882
11882
|
|
|
11883
11883
|
// src/codex/auth.ts
|
|
11884
|
-
import { z as
|
|
11884
|
+
import { z as z32 } from "zod";
|
|
11885
11885
|
var AuthFileSchema, TokenGrantSchema, CodexAuthError;
|
|
11886
11886
|
var init_auth = __esm({
|
|
11887
11887
|
"src/codex/auth.ts"() {
|
|
11888
11888
|
"use strict";
|
|
11889
|
-
AuthFileSchema =
|
|
11890
|
-
tokens:
|
|
11891
|
-
access_token:
|
|
11892
|
-
refresh_token:
|
|
11893
|
-
id_token:
|
|
11894
|
-
account_id:
|
|
11889
|
+
AuthFileSchema = z32.looseObject({
|
|
11890
|
+
tokens: z32.looseObject({
|
|
11891
|
+
access_token: z32.string().optional(),
|
|
11892
|
+
refresh_token: z32.string().optional(),
|
|
11893
|
+
id_token: z32.string().optional(),
|
|
11894
|
+
account_id: z32.string().optional()
|
|
11895
11895
|
}).nullish(),
|
|
11896
|
-
last_refresh:
|
|
11896
|
+
last_refresh: z32.string().optional()
|
|
11897
11897
|
});
|
|
11898
|
-
TokenGrantSchema =
|
|
11899
|
-
access_token:
|
|
11900
|
-
refresh_token:
|
|
11901
|
-
id_token:
|
|
11902
|
-
account_id:
|
|
11898
|
+
TokenGrantSchema = z32.looseObject({
|
|
11899
|
+
access_token: z32.string().min(1).optional(),
|
|
11900
|
+
refresh_token: z32.string().min(1).optional(),
|
|
11901
|
+
id_token: z32.string().min(1).optional(),
|
|
11902
|
+
account_id: z32.string().min(1).optional()
|
|
11903
11903
|
});
|
|
11904
11904
|
CodexAuthError = class extends Error {
|
|
11905
11905
|
constructor(message) {
|
|
@@ -11911,7 +11911,7 @@ var init_auth = __esm({
|
|
|
11911
11911
|
});
|
|
11912
11912
|
|
|
11913
11913
|
// src/codex/siwc.ts
|
|
11914
|
-
import { z as
|
|
11914
|
+
import { z as z33 } from "zod";
|
|
11915
11915
|
var SIWC_RESOURCE, SIWC_RESPONSES_URL, SIWC_PLAN_SCOPE, TokenResponseSchema, JwtHeaderSchema, IdTokenClaimsSchema, JwksSchema;
|
|
11916
11916
|
var init_siwc = __esm({
|
|
11917
11917
|
"src/codex/siwc.ts"() {
|
|
@@ -11919,28 +11919,28 @@ var init_siwc = __esm({
|
|
|
11919
11919
|
SIWC_RESOURCE = "https://api.openai.com/v1";
|
|
11920
11920
|
SIWC_RESPONSES_URL = `${SIWC_RESOURCE}/responses`;
|
|
11921
11921
|
SIWC_PLAN_SCOPE = "chatgpt.tokens.use.direct";
|
|
11922
|
-
TokenResponseSchema =
|
|
11923
|
-
access_token:
|
|
11924
|
-
refresh_token:
|
|
11925
|
-
id_token:
|
|
11926
|
-
expires_in:
|
|
11927
|
-
scope:
|
|
11922
|
+
TokenResponseSchema = z33.looseObject({
|
|
11923
|
+
access_token: z33.string().min(1),
|
|
11924
|
+
refresh_token: z33.string().min(1).optional(),
|
|
11925
|
+
id_token: z33.string().min(1).optional(),
|
|
11926
|
+
expires_in: z33.number().positive(),
|
|
11927
|
+
scope: z33.string().optional()
|
|
11928
11928
|
});
|
|
11929
|
-
JwtHeaderSchema =
|
|
11930
|
-
IdTokenClaimsSchema =
|
|
11931
|
-
iss:
|
|
11932
|
-
sub:
|
|
11933
|
-
aud:
|
|
11934
|
-
exp:
|
|
11935
|
-
nonce:
|
|
11936
|
-
email:
|
|
11929
|
+
JwtHeaderSchema = z33.looseObject({ alg: z33.string(), kid: z33.string().optional() });
|
|
11930
|
+
IdTokenClaimsSchema = z33.looseObject({
|
|
11931
|
+
iss: z33.string(),
|
|
11932
|
+
sub: z33.string().min(1),
|
|
11933
|
+
aud: z33.union([z33.string(), z33.array(z33.string())]),
|
|
11934
|
+
exp: z33.number(),
|
|
11935
|
+
nonce: z33.string().optional(),
|
|
11936
|
+
email: z33.string().optional()
|
|
11937
11937
|
});
|
|
11938
|
-
JwksSchema =
|
|
11938
|
+
JwksSchema = z33.object({ keys: z33.array(z33.looseObject({ kid: z33.string().optional(), kty: z33.string() })) });
|
|
11939
11939
|
}
|
|
11940
11940
|
});
|
|
11941
11941
|
|
|
11942
11942
|
// src/codex/siwcStore.ts
|
|
11943
|
-
import { z as
|
|
11943
|
+
import { z as z34 } from "zod";
|
|
11944
11944
|
function parseSiwcFile(raw, filePath) {
|
|
11945
11945
|
let json;
|
|
11946
11946
|
try {
|
|
@@ -11960,18 +11960,18 @@ var init_siwcStore = __esm({
|
|
|
11960
11960
|
"use strict";
|
|
11961
11961
|
init_auth();
|
|
11962
11962
|
init_siwc();
|
|
11963
|
-
SiwcGrantSchema =
|
|
11964
|
-
clientId:
|
|
11965
|
-
sub:
|
|
11966
|
-
email:
|
|
11967
|
-
idToken:
|
|
11968
|
-
accessToken:
|
|
11969
|
-
refreshToken:
|
|
11970
|
-
scopes:
|
|
11963
|
+
SiwcGrantSchema = z34.strictObject({
|
|
11964
|
+
clientId: z34.string().min(1),
|
|
11965
|
+
sub: z34.string().min(1),
|
|
11966
|
+
email: z34.string().optional(),
|
|
11967
|
+
idToken: z34.string().min(1),
|
|
11968
|
+
accessToken: z34.string().min(1),
|
|
11969
|
+
refreshToken: z34.string().min(1),
|
|
11970
|
+
scopes: z34.array(z34.string()).readonly(),
|
|
11971
11971
|
/** When the access token stops working, in milliseconds since the epoch. */
|
|
11972
|
-
expiresAt:
|
|
11972
|
+
expiresAt: z34.number()
|
|
11973
11973
|
});
|
|
11974
|
-
SiwcFileSchema =
|
|
11974
|
+
SiwcFileSchema = z34.strictObject({ registeredClientId: z34.string().min(1).optional(), grant: SiwcGrantSchema.optional() });
|
|
11975
11975
|
}
|
|
11976
11976
|
});
|
|
11977
11977
|
|
|
@@ -12031,7 +12031,7 @@ var init_modelsStore = __esm({
|
|
|
12031
12031
|
// src/codex/catalogueCredential.ts
|
|
12032
12032
|
import { createHash as createHash9 } from "node:crypto";
|
|
12033
12033
|
import path41 from "node:path";
|
|
12034
|
-
import { z as
|
|
12034
|
+
import { z as z35 } from "zod";
|
|
12035
12035
|
function parseCatalogueBinding(raw) {
|
|
12036
12036
|
if (raw === void 0) return void 0;
|
|
12037
12037
|
try {
|
|
@@ -12072,7 +12072,7 @@ var init_catalogueCredential = __esm({
|
|
|
12072
12072
|
"src/codex/catalogueCredential.ts"() {
|
|
12073
12073
|
"use strict";
|
|
12074
12074
|
init_siwcStore();
|
|
12075
|
-
CatalogueBindingSchema =
|
|
12075
|
+
CatalogueBindingSchema = z35.strictObject({ fingerprint: z35.string().min(1), source: z35.string().min(1), revision: z35.string().min(1) });
|
|
12076
12076
|
}
|
|
12077
12077
|
});
|
|
12078
12078
|
|
|
@@ -12123,64 +12123,64 @@ var init_signatures = __esm({
|
|
|
12123
12123
|
});
|
|
12124
12124
|
|
|
12125
12125
|
// src/codex/anthropic.ts
|
|
12126
|
-
import { z as
|
|
12126
|
+
import { z as z36 } from "zod";
|
|
12127
12127
|
var TextBlockSchema, Base64ImageSourceSchema, UrlImageSourceSchema, ImageBlockSchema, ToolUseBlockSchema, ToolResultContentBlockSchema, ToolResultBlockSchema, OtherBlockSchema, ContentBlockSchema, MessageSchema, ToolSchema, ToolChoiceSchema, SystemSchema, MessagesRequestSchema, CountTokensRequestSchema;
|
|
12128
12128
|
var init_anthropic = __esm({
|
|
12129
12129
|
"src/codex/anthropic.ts"() {
|
|
12130
12130
|
"use strict";
|
|
12131
|
-
TextBlockSchema =
|
|
12132
|
-
Base64ImageSourceSchema =
|
|
12133
|
-
UrlImageSourceSchema =
|
|
12134
|
-
ImageBlockSchema =
|
|
12135
|
-
type:
|
|
12136
|
-
source:
|
|
12131
|
+
TextBlockSchema = z36.looseObject({ type: z36.literal("text"), text: z36.string() });
|
|
12132
|
+
Base64ImageSourceSchema = z36.looseObject({ type: z36.literal("base64"), media_type: z36.string().min(1), data: z36.string() });
|
|
12133
|
+
UrlImageSourceSchema = z36.looseObject({ type: z36.literal("url"), url: z36.string().min(1) });
|
|
12134
|
+
ImageBlockSchema = z36.looseObject({
|
|
12135
|
+
type: z36.literal("image"),
|
|
12136
|
+
source: z36.union([Base64ImageSourceSchema, UrlImageSourceSchema])
|
|
12137
12137
|
});
|
|
12138
|
-
ToolUseBlockSchema =
|
|
12139
|
-
type:
|
|
12140
|
-
id:
|
|
12141
|
-
name:
|
|
12142
|
-
input:
|
|
12138
|
+
ToolUseBlockSchema = z36.looseObject({
|
|
12139
|
+
type: z36.literal("tool_use"),
|
|
12140
|
+
id: z36.string().min(1),
|
|
12141
|
+
name: z36.string().min(1),
|
|
12142
|
+
input: z36.unknown()
|
|
12143
12143
|
});
|
|
12144
|
-
ToolResultContentBlockSchema =
|
|
12145
|
-
ToolResultBlockSchema =
|
|
12146
|
-
type:
|
|
12147
|
-
tool_use_id:
|
|
12148
|
-
content:
|
|
12144
|
+
ToolResultContentBlockSchema = z36.union([TextBlockSchema, z36.looseObject({ type: z36.string() })]);
|
|
12145
|
+
ToolResultBlockSchema = z36.looseObject({
|
|
12146
|
+
type: z36.literal("tool_result"),
|
|
12147
|
+
tool_use_id: z36.string().min(1),
|
|
12148
|
+
content: z36.union([z36.string(), z36.array(ToolResultContentBlockSchema)]).optional()
|
|
12149
12149
|
});
|
|
12150
|
-
OtherBlockSchema =
|
|
12151
|
-
ContentBlockSchema =
|
|
12152
|
-
MessageSchema =
|
|
12153
|
-
role:
|
|
12154
|
-
content:
|
|
12150
|
+
OtherBlockSchema = z36.looseObject({ type: z36.string() });
|
|
12151
|
+
ContentBlockSchema = z36.union([TextBlockSchema, ImageBlockSchema, ToolUseBlockSchema, ToolResultBlockSchema, OtherBlockSchema]);
|
|
12152
|
+
MessageSchema = z36.looseObject({
|
|
12153
|
+
role: z36.enum(["user", "assistant", "system"]),
|
|
12154
|
+
content: z36.union([z36.string(), z36.array(ContentBlockSchema)])
|
|
12155
12155
|
});
|
|
12156
|
-
ToolSchema =
|
|
12157
|
-
name:
|
|
12158
|
-
description:
|
|
12159
|
-
input_schema:
|
|
12160
|
-
allowed_domains:
|
|
12161
|
-
blocked_domains:
|
|
12156
|
+
ToolSchema = z36.looseObject({
|
|
12157
|
+
name: z36.string().min(1),
|
|
12158
|
+
description: z36.string().optional(),
|
|
12159
|
+
input_schema: z36.record(z36.string(), z36.unknown()).optional(),
|
|
12160
|
+
allowed_domains: z36.array(z36.string()).optional(),
|
|
12161
|
+
blocked_domains: z36.array(z36.string()).optional()
|
|
12162
12162
|
});
|
|
12163
|
-
ToolChoiceSchema =
|
|
12164
|
-
|
|
12165
|
-
|
|
12163
|
+
ToolChoiceSchema = z36.union([
|
|
12164
|
+
z36.looseObject({ type: z36.enum(["auto", "none", "any"]) }),
|
|
12165
|
+
z36.looseObject({ type: z36.literal("tool"), name: z36.string().min(1) })
|
|
12166
12166
|
]);
|
|
12167
|
-
SystemSchema =
|
|
12168
|
-
MessagesRequestSchema =
|
|
12169
|
-
model:
|
|
12167
|
+
SystemSchema = z36.union([z36.string(), z36.array(z36.union([TextBlockSchema, OtherBlockSchema]))]);
|
|
12168
|
+
MessagesRequestSchema = z36.looseObject({
|
|
12169
|
+
model: z36.string().optional(),
|
|
12170
12170
|
system: SystemSchema.optional(),
|
|
12171
|
-
messages:
|
|
12172
|
-
tools:
|
|
12171
|
+
messages: z36.array(MessageSchema),
|
|
12172
|
+
tools: z36.array(ToolSchema).optional(),
|
|
12173
12173
|
tool_choice: ToolChoiceSchema.optional(),
|
|
12174
|
-
stream:
|
|
12174
|
+
stream: z36.boolean().optional(),
|
|
12175
12175
|
/** `user_id` is stable for one Claude Code session and differs between sessions, which is what makes it the right key for both the backend's prompt cache and its session header. */
|
|
12176
|
-
metadata:
|
|
12176
|
+
metadata: z36.looseObject({ user_id: z36.string().optional() }).optional(),
|
|
12177
12177
|
/** Claude Code's effort setting. Any string is accepted; the translator honours only the levels the backend understands. */
|
|
12178
|
-
output_config:
|
|
12178
|
+
output_config: z36.looseObject({ effort: z36.string().optional(), format: z36.object({ type: z36.literal("json_schema"), schema: z36.record(z36.string(), z36.unknown()) }).optional() }).optional()
|
|
12179
12179
|
});
|
|
12180
|
-
CountTokensRequestSchema =
|
|
12181
|
-
system:
|
|
12182
|
-
messages:
|
|
12183
|
-
tools:
|
|
12180
|
+
CountTokensRequestSchema = z36.looseObject({
|
|
12181
|
+
system: z36.unknown().optional(),
|
|
12182
|
+
messages: z36.unknown().optional(),
|
|
12183
|
+
tools: z36.unknown().optional()
|
|
12184
12184
|
});
|
|
12185
12185
|
}
|
|
12186
12186
|
});
|
|
@@ -13534,7 +13534,7 @@ function withLauncherSettings(passthrough, settings) {
|
|
|
13534
13534
|
}
|
|
13535
13535
|
return [...kept, "--settings", settings, ...tail];
|
|
13536
13536
|
}
|
|
13537
|
-
function
|
|
13537
|
+
function isRecord16(value) {
|
|
13538
13538
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
13539
13539
|
}
|
|
13540
13540
|
function mergeSettings(parts) {
|
|
@@ -13545,7 +13545,7 @@ function mergeSettings(parts) {
|
|
|
13545
13545
|
continue;
|
|
13546
13546
|
}
|
|
13547
13547
|
const parsed = JSON.parse(part);
|
|
13548
|
-
if (!
|
|
13548
|
+
if (!isRecord16(parsed)) {
|
|
13549
13549
|
throw new Error("a launch's settings part is not a JSON object");
|
|
13550
13550
|
}
|
|
13551
13551
|
for (const [key, value] of Object.entries(parsed)) {
|
|
@@ -15227,7 +15227,7 @@ var init_identityClaude = __esm({
|
|
|
15227
15227
|
});
|
|
15228
15228
|
|
|
15229
15229
|
// src/usage/providerQuota.ts
|
|
15230
|
-
import { z as
|
|
15230
|
+
import { z as z45 } from "zod";
|
|
15231
15231
|
var MS_PER_SECOND9, SECONDS_PER_HOUR3, HOURS_PER_DAY6, DAYS_PER_MONTH, ZAI_HOST, ZAI_QUOTA_URL, ZAI_UNIT_HOURS, ZAI_UNIT_MONTHS, ZAI_UNIT_MS, ZaiLimitSchema, ZaiResponseSchema, OPENROUTER_HOST, OPENROUTER_KEY_URL, OPENROUTER_CREDITS_URL, MS_PER_DAY2, OpenRouterKeySchema, OpenRouterCreditsSchema, ANTIGRAVITY_HOST, ANTIGRAVITY_QUOTA_URL, ANTIGRAVITY_USER_URL, FIVE_HOURS2, DAYS_PER_WEEK2, FIVE_HOURS_MS, WEEK_MS, AntigravityBucketSchema, AntigravitySummarySchema, GoogleTokenInfoSchema, AntigravityUserSchema;
|
|
15232
15232
|
var init_providerQuota = __esm({
|
|
15233
15233
|
"src/usage/providerQuota.ts"() {
|
|
@@ -15246,35 +15246,35 @@ var init_providerQuota = __esm({
|
|
|
15246
15246
|
[ZAI_UNIT_HOURS, SECONDS_PER_HOUR3 * MS_PER_SECOND9],
|
|
15247
15247
|
[ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND9]
|
|
15248
15248
|
]);
|
|
15249
|
-
ZaiLimitSchema =
|
|
15250
|
-
type:
|
|
15251
|
-
unit:
|
|
15252
|
-
number:
|
|
15253
|
-
percentage:
|
|
15254
|
-
nextResetTime:
|
|
15255
|
-
usage:
|
|
15256
|
-
currentValue:
|
|
15257
|
-
remaining:
|
|
15249
|
+
ZaiLimitSchema = z45.object({
|
|
15250
|
+
type: z45.string(),
|
|
15251
|
+
unit: z45.number().int(),
|
|
15252
|
+
number: z45.number().int().positive(),
|
|
15253
|
+
percentage: z45.number().nonnegative(),
|
|
15254
|
+
nextResetTime: z45.number().positive().optional(),
|
|
15255
|
+
usage: z45.number().nonnegative().optional(),
|
|
15256
|
+
currentValue: z45.number().nonnegative().optional(),
|
|
15257
|
+
remaining: z45.number().nonnegative().optional()
|
|
15258
15258
|
});
|
|
15259
|
-
ZaiResponseSchema =
|
|
15260
|
-
success:
|
|
15261
|
-
msg:
|
|
15262
|
-
data:
|
|
15259
|
+
ZaiResponseSchema = z45.object({
|
|
15260
|
+
success: z45.boolean(),
|
|
15261
|
+
msg: z45.string().optional(),
|
|
15262
|
+
data: z45.object({ level: z45.string().optional(), limits: z45.array(ZaiLimitSchema) })
|
|
15263
15263
|
});
|
|
15264
15264
|
OPENROUTER_HOST = "openrouter.ai";
|
|
15265
15265
|
OPENROUTER_KEY_URL = `https://${OPENROUTER_HOST}/api/v1/key`;
|
|
15266
15266
|
OPENROUTER_CREDITS_URL = `https://${OPENROUTER_HOST}/api/v1/credits`;
|
|
15267
15267
|
MS_PER_DAY2 = HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
|
|
15268
|
-
OpenRouterKeySchema =
|
|
15269
|
-
data:
|
|
15270
|
-
limit:
|
|
15271
|
-
limit_remaining:
|
|
15272
|
-
limit_reset:
|
|
15273
|
-
is_free_tier:
|
|
15274
|
-
free_model_daily_requests:
|
|
15268
|
+
OpenRouterKeySchema = z45.object({
|
|
15269
|
+
data: z45.object({
|
|
15270
|
+
limit: z45.number().nonnegative().nullable(),
|
|
15271
|
+
limit_remaining: z45.number().nullable(),
|
|
15272
|
+
limit_reset: z45.string().nullable(),
|
|
15273
|
+
is_free_tier: z45.boolean().optional(),
|
|
15274
|
+
free_model_daily_requests: z45.object({ used: z45.number().nonnegative(), limit: z45.number().nonnegative(), remaining: z45.number() }).optional()
|
|
15275
15275
|
})
|
|
15276
15276
|
});
|
|
15277
|
-
OpenRouterCreditsSchema =
|
|
15277
|
+
OpenRouterCreditsSchema = z45.object({ data: z45.object({ total_credits: z45.number().nonnegative(), total_usage: z45.number().nonnegative() }) });
|
|
15278
15278
|
ANTIGRAVITY_HOST = "daily-cloudcode-pa.googleapis.com";
|
|
15279
15279
|
ANTIGRAVITY_QUOTA_URL = `https://${ANTIGRAVITY_HOST}/v1internal:retrieveUserQuotaSummary`;
|
|
15280
15280
|
ANTIGRAVITY_USER_URL = `https://${ANTIGRAVITY_HOST}/v1internal:loadCodeAssist`;
|
|
@@ -15282,21 +15282,21 @@ var init_providerQuota = __esm({
|
|
|
15282
15282
|
DAYS_PER_WEEK2 = 7;
|
|
15283
15283
|
FIVE_HOURS_MS = FIVE_HOURS2 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
|
|
15284
15284
|
WEEK_MS = DAYS_PER_WEEK2 * HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
|
|
15285
|
-
AntigravityBucketSchema =
|
|
15286
|
-
bucketId:
|
|
15287
|
-
remainingFraction:
|
|
15288
|
-
resetTime:
|
|
15285
|
+
AntigravityBucketSchema = z45.object({
|
|
15286
|
+
bucketId: z45.string(),
|
|
15287
|
+
remainingFraction: z45.number().optional(),
|
|
15288
|
+
resetTime: z45.string().optional()
|
|
15289
15289
|
});
|
|
15290
|
-
AntigravitySummarySchema =
|
|
15291
|
-
GoogleTokenInfoSchema =
|
|
15292
|
-
email:
|
|
15293
|
-
sub:
|
|
15290
|
+
AntigravitySummarySchema = z45.object({ groups: z45.array(z45.object({ buckets: z45.array(AntigravityBucketSchema) })) });
|
|
15291
|
+
GoogleTokenInfoSchema = z45.object({
|
|
15292
|
+
email: z45.string().optional(),
|
|
15293
|
+
sub: z45.string().optional()
|
|
15294
15294
|
});
|
|
15295
|
-
AntigravityUserSchema =
|
|
15295
|
+
AntigravityUserSchema = z45.object({
|
|
15296
15296
|
/** The code-assist tier context, which defaults to the free tier for every account. */
|
|
15297
|
-
currentTier:
|
|
15297
|
+
currentTier: z45.object({ name: z45.string().optional(), id: z45.string().optional() }).optional(),
|
|
15298
15298
|
/** The account's paid subscription; absent when the account has none. */
|
|
15299
|
-
paidTier:
|
|
15299
|
+
paidTier: z45.object({ name: z45.string().optional(), id: z45.string().optional() }).optional()
|
|
15300
15300
|
});
|
|
15301
15301
|
}
|
|
15302
15302
|
});
|
|
@@ -15949,9 +15949,11 @@ function createRcSessionTracker(deps) {
|
|
|
15949
15949
|
if (id?.startsWith(RC_SESSION_ID_PREFIX) !== true) {
|
|
15950
15950
|
return void 0;
|
|
15951
15951
|
}
|
|
15952
|
+
const isClientWrite = method === "POST" && (rest === `${id}/events` || rest === `${id}/teleport-events`);
|
|
15953
|
+
const sessionFacts = isClientWrite ? { ...facts, anthropicClientPlatform: void 0 } : facts;
|
|
15952
15954
|
const tracked = entries.get(id);
|
|
15953
15955
|
if (tracked !== void 0) {
|
|
15954
|
-
refresh(tracked,
|
|
15956
|
+
refresh(tracked, sessionFacts);
|
|
15955
15957
|
}
|
|
15956
15958
|
const bodyKind = method === "POST" && rest === `${id}/worker/events` ? "worker-events" : method === "POST" && rest === `${id}/events` ? "client-events" : method === "POST" && rest === `${id}/worker/heartbeat` ? "heartbeat" : method === "PUT" && rest === `${id}/worker` ? "worker-registration" : void 0;
|
|
15957
15959
|
let chunks = [];
|
|
@@ -16021,7 +16023,7 @@ function createRcSessionTracker(deps) {
|
|
|
16021
16023
|
}
|
|
16022
16024
|
accepted = isSuccessful(status);
|
|
16023
16025
|
if (accepted && !entries.has(id)) {
|
|
16024
|
-
persistCredential(birth(id,
|
|
16026
|
+
persistCredential(birth(id, sessionFacts));
|
|
16025
16027
|
}
|
|
16026
16028
|
file();
|
|
16027
16029
|
},
|
|
@@ -17746,6 +17748,11 @@ import { OpenAPIHandler } from "@orpc/openapi/node";
|
|
|
17746
17748
|
import { eventIterator, os as os3, withEventMeta } from "@orpc/server";
|
|
17747
17749
|
import { BodyLimitPlugin, RPCHandler } from "@orpc/server/node";
|
|
17748
17750
|
import { Agent as Agent3, fetch as undiciFetch } from "undici";
|
|
17751
|
+
|
|
17752
|
+
// src/supervise/compactTimeout.ts
|
|
17753
|
+
var COMPACT_TIMEOUT_MS = 9e5;
|
|
17754
|
+
|
|
17755
|
+
// src/frontdoor/rcApi.ts
|
|
17749
17756
|
init_capability();
|
|
17750
17757
|
|
|
17751
17758
|
// src/frontdoor/rcSchemas.ts
|
|
@@ -17917,6 +17924,438 @@ var RcAnswerOutputSchema = z22.strictObject({
|
|
|
17917
17924
|
sequenceNums: z22.readonly(z22.array(z22.number()))
|
|
17918
17925
|
});
|
|
17919
17926
|
|
|
17927
|
+
// src/frontdoor/rcSlashCommandSchemas.ts
|
|
17928
|
+
import { z as z23 } from "zod";
|
|
17929
|
+
|
|
17930
|
+
// src/frontdoor/rcSessionCommands.ts
|
|
17931
|
+
import { setTimeout as sleep } from "node:timers/promises";
|
|
17932
|
+
|
|
17933
|
+
// src/supervise/sessionControl.ts
|
|
17934
|
+
var RESULT_POLL_MS = 250;
|
|
17935
|
+
var REQUEST_INSTANT_DIGITS = String(Number.MAX_SAFE_INTEGER).length;
|
|
17936
|
+
|
|
17937
|
+
// src/frontdoor/rcSelfHostCommands.ts
|
|
17938
|
+
var RC_PERSON_CLIENT_PLATFORM = "web_claude_ai";
|
|
17939
|
+
async function writeRcPersonMessage(deps, sessionId, text) {
|
|
17940
|
+
const credential = deps.credentialOf(sessionId);
|
|
17941
|
+
if (credential === void 0) {
|
|
17942
|
+
return { ok: false, message: rcSessionNotObservedMessage(sessionId) };
|
|
17943
|
+
}
|
|
17944
|
+
if (credential.authorization === void 0) {
|
|
17945
|
+
return noOAuthCredentialResult(sessionId);
|
|
17946
|
+
}
|
|
17947
|
+
const body = JSON.stringify(buildRcEventWriteBody(buildRcUserMessagePayload(deps.newUuid(), sessionId, text)));
|
|
17948
|
+
const bytes = Buffer.byteLength(body, "utf8");
|
|
17949
|
+
if (bytes > CONTROL_BODY_CAP_BYTES) {
|
|
17950
|
+
return { ok: false, message: `the command for session ${sessionId} makes an event write of ${String(bytes)} bytes, over the ${String(CONTROL_BODY_CAP_BYTES)} bytes the door's self-hosted surface reads; shorten its arguments` };
|
|
17951
|
+
}
|
|
17952
|
+
let answer;
|
|
17953
|
+
try {
|
|
17954
|
+
answer = await deps.dial.writeEvents(sessionId, rcWriteHeaders({ ...credential, anthropicClientPlatform: RC_PERSON_CLIENT_PLATFORM }), body);
|
|
17955
|
+
} catch (error) {
|
|
17956
|
+
return { ok: false, message: `the door could not write to its own self-hosted surface for session ${sessionId}: ${error instanceof Error ? error.message : String(error)}` };
|
|
17957
|
+
}
|
|
17958
|
+
const result = rcEventWriteResultFromAnswer(answer);
|
|
17959
|
+
if (result.ok) {
|
|
17960
|
+
deps.noteSequenceNums(sessionId, result.sequenceNums);
|
|
17961
|
+
}
|
|
17962
|
+
return result;
|
|
17963
|
+
}
|
|
17964
|
+
function isRecord7(value) {
|
|
17965
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17966
|
+
}
|
|
17967
|
+
function rcLocalCommandAnswerOf(event, command, args) {
|
|
17968
|
+
const payload = event.envelope.payload;
|
|
17969
|
+
if (!isRecord7(payload) || payload.type !== "assistant" || !isRecord7(payload.local_command_run) || payload.local_command_run.command !== command || payload.local_command_run.args !== args) {
|
|
17970
|
+
return void 0;
|
|
17971
|
+
}
|
|
17972
|
+
const message = payload.message;
|
|
17973
|
+
if (!isRecord7(message) || !Array.isArray(message.content)) {
|
|
17974
|
+
return void 0;
|
|
17975
|
+
}
|
|
17976
|
+
const blocks = message.content;
|
|
17977
|
+
const text = blocks.flatMap((block) => isRecord7(block) && block.type === "text" && typeof block.text === "string" ? [block.text] : []).join("\n");
|
|
17978
|
+
const outcome = isRecord7(payload.local_command_outcome) && typeof payload.local_command_outcome.kind === "string" ? payload.local_command_outcome.kind : void 0;
|
|
17979
|
+
return { text, outcome };
|
|
17980
|
+
}
|
|
17981
|
+
function rcManualCompactBoundaryOf(event) {
|
|
17982
|
+
const payload = event.envelope.payload;
|
|
17983
|
+
if (!isRecord7(payload) || payload.type !== "system" || payload.subtype !== "compact_boundary" || !isRecord7(payload.compact_metadata)) {
|
|
17984
|
+
return void 0;
|
|
17985
|
+
}
|
|
17986
|
+
const metadata = payload.compact_metadata;
|
|
17987
|
+
if (metadata.trigger !== "manual" || typeof metadata.pre_tokens !== "number" || typeof metadata.post_tokens !== "number") {
|
|
17988
|
+
return void 0;
|
|
17989
|
+
}
|
|
17990
|
+
return { trigger: metadata.trigger, preTokens: metadata.pre_tokens, postTokens: metadata.post_tokens };
|
|
17991
|
+
}
|
|
17992
|
+
function isPeerDelivery(event, text) {
|
|
17993
|
+
const payload = event.envelope.payload;
|
|
17994
|
+
if (!isRecord7(payload) || payload.type !== "user" || !isRecord7(payload.origin) || payload.origin.kind !== "peer" || !isRecord7(payload.message)) {
|
|
17995
|
+
return false;
|
|
17996
|
+
}
|
|
17997
|
+
return typeof payload.message.content === "string" && payload.message.content.includes(text);
|
|
17998
|
+
}
|
|
17999
|
+
var NO_GOAL_PREFIX = "No goal set";
|
|
18000
|
+
var ACTIVE_GOAL_PATTERN = /^Goal active: (?<condition>[\s\S]*?) \((?:not yet evaluated|(?<iterations>\d+) turns?)\)(?:\nLast check: (?<lastCheck>[\s\S]*))?$/u;
|
|
18001
|
+
function parseRcGoalOutput(output) {
|
|
18002
|
+
if (output.startsWith(NO_GOAL_PREFIX)) {
|
|
18003
|
+
return { goal: null };
|
|
18004
|
+
}
|
|
18005
|
+
const groups = ACTIVE_GOAL_PATTERN.exec(output)?.groups;
|
|
18006
|
+
const condition = groups?.condition;
|
|
18007
|
+
if (condition === void 0) {
|
|
18008
|
+
return void 0;
|
|
18009
|
+
}
|
|
18010
|
+
return { goal: { condition, iterations: groups?.iterations === void 0 ? 0 : Number(groups.iterations), ...groups?.lastCheck === void 0 ? {} : { lastCheck: groups.lastCheck } } };
|
|
18011
|
+
}
|
|
18012
|
+
var GOAL_CLEARED_PREFIX = "Goal cleared: ";
|
|
18013
|
+
var GOAL_SET_PREFIX = "Goal set: ";
|
|
18014
|
+
function commandLine(command) {
|
|
18015
|
+
if (command.kind === "goal-set") {
|
|
18016
|
+
return { name: "goal", args: command.condition };
|
|
18017
|
+
}
|
|
18018
|
+
if (command.kind === "compact") {
|
|
18019
|
+
return { name: "compact", args: command.instructions ?? "" };
|
|
18020
|
+
}
|
|
18021
|
+
return { name: "goal", args: command.kind === "goal-clear" ? "clear" : "" };
|
|
18022
|
+
}
|
|
18023
|
+
function recognise(command, event, name, args) {
|
|
18024
|
+
if (command.kind === "compact") {
|
|
18025
|
+
const boundary = rcManualCompactBoundaryOf(event);
|
|
18026
|
+
if (boundary !== void 0) {
|
|
18027
|
+
return { ok: true, report: boundary };
|
|
18028
|
+
}
|
|
18029
|
+
}
|
|
18030
|
+
const answer = rcLocalCommandAnswerOf(event, name, args);
|
|
18031
|
+
if (answer === void 0) {
|
|
18032
|
+
return void 0;
|
|
18033
|
+
}
|
|
18034
|
+
if (answer.outcome === "failed") {
|
|
18035
|
+
return { ok: false, message: `the worker reported /${name} failed: ${answer.text}` };
|
|
18036
|
+
}
|
|
18037
|
+
if (command.kind === "goal-get") {
|
|
18038
|
+
const report = parseRcGoalOutput(answer.text);
|
|
18039
|
+
return report === void 0 ? { ok: false, message: `the worker answered /goal with text the verified versions never produce: ${answer.text}` } : { ok: true, report };
|
|
18040
|
+
}
|
|
18041
|
+
if (command.kind === "goal-set") {
|
|
18042
|
+
return answer.text.startsWith(GOAL_SET_PREFIX) ? { ok: true, report: { condition: answer.text.slice(GOAL_SET_PREFIX.length) } } : { ok: false, message: `the worker did not set the goal: ${answer.text}` };
|
|
18043
|
+
}
|
|
18044
|
+
if (command.kind === "goal-clear") {
|
|
18045
|
+
if (answer.text.startsWith(GOAL_CLEARED_PREFIX)) {
|
|
18046
|
+
return { ok: true, report: { cleared: answer.text.slice(GOAL_CLEARED_PREFIX.length) } };
|
|
18047
|
+
}
|
|
18048
|
+
return answer.text === NO_GOAL_PREFIX ? { ok: true, report: { cleared: null } } : { ok: false, message: `the worker answered /goal clear with text the verified versions never produce: ${answer.text}` };
|
|
18049
|
+
}
|
|
18050
|
+
return { ok: false, message: `the worker did not compact the session: ${answer.text}` };
|
|
18051
|
+
}
|
|
18052
|
+
async function runSelfHostedSlashCommand(deps, sessionId, command, waitMs, signal) {
|
|
18053
|
+
const { name, args } = commandLine(command);
|
|
18054
|
+
const text = args === "" ? `/${name}` : `/${name} ${args}`;
|
|
18055
|
+
const early = [];
|
|
18056
|
+
let after;
|
|
18057
|
+
let settle;
|
|
18058
|
+
const judge = (event) => {
|
|
18059
|
+
if (after === void 0) {
|
|
18060
|
+
early.push(event);
|
|
18061
|
+
return;
|
|
18062
|
+
}
|
|
18063
|
+
if (event.envelope.sequence_num <= after || event.envelope.source !== "worker") {
|
|
18064
|
+
return;
|
|
18065
|
+
}
|
|
18066
|
+
if (isPeerDelivery(event, text)) {
|
|
18067
|
+
settle?.({ ok: false, message: `session ${sessionId}'s worker passed ${text} to its model as a peer's message instead of running it, so it did not read the write as a person's` });
|
|
18068
|
+
return;
|
|
18069
|
+
}
|
|
18070
|
+
const outcome = recognise(command, event, name, args);
|
|
18071
|
+
if (outcome !== void 0) {
|
|
18072
|
+
settle?.(outcome);
|
|
18073
|
+
}
|
|
18074
|
+
};
|
|
18075
|
+
const detach = deps.fanout.subscribe(sessionId, judge);
|
|
18076
|
+
let cancelTimer;
|
|
18077
|
+
const onAbort = () => {
|
|
18078
|
+
settle?.({ ok: false, message: `the request for ${text} on session ${sessionId} was aborted before the worker answered` });
|
|
18079
|
+
};
|
|
18080
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
18081
|
+
try {
|
|
18082
|
+
const answered = new Promise((resolve) => {
|
|
18083
|
+
settle = resolve;
|
|
18084
|
+
});
|
|
18085
|
+
const written = await writeRcPersonMessage(deps.personWrite, sessionId, text);
|
|
18086
|
+
if (!written.ok) {
|
|
18087
|
+
return written;
|
|
18088
|
+
}
|
|
18089
|
+
if (signal.aborted) {
|
|
18090
|
+
return { ok: false, message: `the request for ${text} on session ${sessionId} was aborted after it was written (sequence_num ${written.sequenceNums.join(", ")})` };
|
|
18091
|
+
}
|
|
18092
|
+
after = Math.max(...written.sequenceNums);
|
|
18093
|
+
const bound = waitMs ?? deps.defaultWaitMs;
|
|
18094
|
+
cancelTimer = deps.setTimer(() => {
|
|
18095
|
+
settle?.({ ok: false, message: `${text} was delivered to session ${sessionId} (sequence_num ${written.sequenceNums.join(", ")}) but the worker reported no outcome within ${String(bound)} ms; it may still be queued behind a running turn, so read the session's stream before sending it again` });
|
|
18096
|
+
}, bound);
|
|
18097
|
+
for (const event of early.splice(0)) {
|
|
18098
|
+
judge(event);
|
|
18099
|
+
}
|
|
18100
|
+
return await answered;
|
|
18101
|
+
} finally {
|
|
18102
|
+
signal.removeEventListener("abort", onAbort);
|
|
18103
|
+
cancelTimer?.();
|
|
18104
|
+
detach();
|
|
18105
|
+
}
|
|
18106
|
+
}
|
|
18107
|
+
function createRcClaudeCodeVersions(fanout) {
|
|
18108
|
+
const versions = /* @__PURE__ */ new Map();
|
|
18109
|
+
fanout.subscribe(void 0, (event) => {
|
|
18110
|
+
const payload = event.envelope.payload;
|
|
18111
|
+
if (event.envelope.source === "worker" && isRecord7(payload) && payload.type === "system" && payload.subtype === "init" && typeof payload.claude_code_version === "string") {
|
|
18112
|
+
versions.set(event.session, payload.claude_code_version);
|
|
18113
|
+
}
|
|
18114
|
+
});
|
|
18115
|
+
return {
|
|
18116
|
+
versionOf: (sessionId) => versions.get(sessionId),
|
|
18117
|
+
sweep: (isTracked) => {
|
|
18118
|
+
for (const sessionId of [...versions.keys()]) {
|
|
18119
|
+
if (!isTracked(sessionId)) {
|
|
18120
|
+
versions.delete(sessionId);
|
|
18121
|
+
}
|
|
18122
|
+
}
|
|
18123
|
+
}
|
|
18124
|
+
};
|
|
18125
|
+
}
|
|
18126
|
+
|
|
18127
|
+
// src/frontdoor/rcSessionCommands.ts
|
|
18128
|
+
var RC_SESSION_COMMAND_VERIFIED_VERSIONS = ["2.1.319"];
|
|
18129
|
+
var RC_GOAL_CLEAR_WORDS = ["clear", "stop", "off", "reset", "none", "cancel"];
|
|
18130
|
+
var RC_GOAL_CONDITION_MAX_CHARS = 4e3;
|
|
18131
|
+
var MAX_JSON_BYTES_PER_CODE_UNIT = 6;
|
|
18132
|
+
var RC_COMPACT_INSTRUCTIONS_MAX_CHARS = Math.floor(CONTROL_BODY_CAP_BYTES / MAX_JSON_BYTES_PER_CODE_UNIT);
|
|
18133
|
+
var RC_SESSION_COMMAND_MAX_WAIT_MS = 2147483647;
|
|
18134
|
+
function unverifiedVersionMessage(sessionId, version, source) {
|
|
18135
|
+
const verified = RC_SESSION_COMMAND_VERIFIED_VERSIONS.join(", ");
|
|
18136
|
+
return version === void 0 ? `session ${sessionId} has not reported its Claude Code version (${source}), and goal and compaction control is verified only on Claude Code ${verified}` : `session ${sessionId} runs Claude Code ${version}, and goal and compaction control is verified only on Claude Code ${verified}: the door will not act on a version whose behaviour it has not verified`;
|
|
18137
|
+
}
|
|
18138
|
+
function unsupportedMessage(sessionId) {
|
|
18139
|
+
return `session ${sessionId} was not launched under an agent-shim supervisor, so the door has no in-process channel into it, and it is not on the door's own self-hosted surface. Over the real Remote Control service, Claude Code ${RC_SESSION_COMMAND_VERIFIED_VERSIONS.join(", ")} runs a slash command only when a person's app wrote it and treats any other writer as a peer, whose message the model reads as text, and the door does not claim to be a person's app on a service it does not run. Launch the session under a pool with resumeOnLimit (which supervises it), or run it against the door's self-hosted surface.`;
|
|
18140
|
+
}
|
|
18141
|
+
function createRcSessionCommands(deps) {
|
|
18142
|
+
const queues = /* @__PURE__ */ new Map();
|
|
18143
|
+
const serialised = async (sessionId, work) => {
|
|
18144
|
+
const before = queues.get(sessionId) ?? Promise.resolve();
|
|
18145
|
+
const run = before.then(work, work);
|
|
18146
|
+
const settled = run.then(() => void 0, () => void 0);
|
|
18147
|
+
queues.set(sessionId, settled);
|
|
18148
|
+
try {
|
|
18149
|
+
return await run;
|
|
18150
|
+
} finally {
|
|
18151
|
+
if (queues.get(sessionId) === settled) {
|
|
18152
|
+
queues.delete(sessionId);
|
|
18153
|
+
}
|
|
18154
|
+
}
|
|
18155
|
+
};
|
|
18156
|
+
const onRoute = async (sessionId, options, actions) => await serialised(sessionId, async () => {
|
|
18157
|
+
const signal = options.signal ?? new AbortController().signal;
|
|
18158
|
+
if (signal.aborted) {
|
|
18159
|
+
return { ok: false, message: `the request for session ${sessionId} was aborted before it ran` };
|
|
18160
|
+
}
|
|
18161
|
+
const target = await deps.supervisedOf(sessionId);
|
|
18162
|
+
if (target !== void 0 && "refused" in target) {
|
|
18163
|
+
return { ok: false, message: target.refused };
|
|
18164
|
+
}
|
|
18165
|
+
if (target !== void 0) {
|
|
18166
|
+
if (target.version === void 0 || !RC_SESSION_COMMAND_VERIFIED_VERSIONS.includes(target.version)) {
|
|
18167
|
+
return { ok: false, message: unverifiedVersionMessage(sessionId, target.version, "its supervisor's control plugin has not loaded") };
|
|
18168
|
+
}
|
|
18169
|
+
const waitMs = options.waitMs ?? COMPACT_TIMEOUT_MS;
|
|
18170
|
+
const timeout = AbortSignal.timeout(waitMs);
|
|
18171
|
+
const bounded3 = AbortSignal.any([signal, timeout]);
|
|
18172
|
+
try {
|
|
18173
|
+
return await actions.supervised(target, bounded3, waitMs);
|
|
18174
|
+
} catch (error) {
|
|
18175
|
+
if (timeout.aborted) {
|
|
18176
|
+
return { ok: false, message: `session ${sessionId}'s control plugin did not answer within ${String(waitMs)} ms. A request the plugin had not started is withdrawn; one it had started runs once the session is idle (a turn waiting on a permission prompt holds it), so read the session's goal or transcript before asking again` };
|
|
18177
|
+
}
|
|
18178
|
+
return { ok: false, message: `session ${sessionId}'s control plugin did not complete the request: ${error instanceof Error ? error.message : String(error)}` };
|
|
18179
|
+
}
|
|
18180
|
+
}
|
|
18181
|
+
if (!deps.isObserved(sessionId)) {
|
|
18182
|
+
return { ok: false, message: `the front door has not observed Remote Control session ${sessionId}` };
|
|
18183
|
+
}
|
|
18184
|
+
if (deps.selfHost !== void 0) {
|
|
18185
|
+
const unavailable = deps.selfHost.unavailable();
|
|
18186
|
+
if (unavailable !== void 0) {
|
|
18187
|
+
return { ok: false, message: `session ${sessionId} was not launched under an agent-shim supervisor, and the door's self-hosted surface cannot take a command: ${unavailable}` };
|
|
18188
|
+
}
|
|
18189
|
+
const version = deps.selfHost.versionOf(sessionId);
|
|
18190
|
+
if (version === void 0 || !RC_SESSION_COMMAND_VERIFIED_VERSIONS.includes(version)) {
|
|
18191
|
+
return { ok: false, message: unverifiedVersionMessage(sessionId, version, "no system/init from its worker has been observed on its stream; send it a prompt so it reports one") };
|
|
18192
|
+
}
|
|
18193
|
+
const waitMs = options.waitMs ?? deps.selfHost.defaultWaitMs;
|
|
18194
|
+
const timeout = AbortSignal.timeout(waitMs);
|
|
18195
|
+
const result = await actions.selfHosted(deps.selfHost, AbortSignal.any([signal, timeout]));
|
|
18196
|
+
if (!result.ok && timeout.aborted) {
|
|
18197
|
+
return { ok: false, message: `session ${sessionId}'s worker did not answer within ${String(waitMs)} ms in all; it may still be queued behind a running turn, so read the session's stream before asking again` };
|
|
18198
|
+
}
|
|
18199
|
+
return result;
|
|
18200
|
+
}
|
|
18201
|
+
return { ok: false, message: unsupportedMessage(sessionId) };
|
|
18202
|
+
});
|
|
18203
|
+
const transcriptGoal = async (sessionId, target) => {
|
|
18204
|
+
const goal = target.transcriptPath === void 0 ? void 0 : await deps.goalOf(target.transcriptPath);
|
|
18205
|
+
if (goal === void 0) {
|
|
18206
|
+
return { ok: false, message: `session ${sessionId}'s supervisor has not recorded its transcript yet, which is where its goal is read from; retry once it has finished a turn` };
|
|
18207
|
+
}
|
|
18208
|
+
return { ok: true, report: goal };
|
|
18209
|
+
};
|
|
18210
|
+
const settledGoal = async (sessionId, target, signal, holds) => {
|
|
18211
|
+
for (; ; ) {
|
|
18212
|
+
const read = await transcriptGoal(sessionId, target);
|
|
18213
|
+
if (!read.ok || holds(read.report) || signal.aborted) {
|
|
18214
|
+
return read;
|
|
18215
|
+
}
|
|
18216
|
+
await sleep(RESULT_POLL_MS);
|
|
18217
|
+
}
|
|
18218
|
+
};
|
|
18219
|
+
const waitOf = (options) => options.waitMs;
|
|
18220
|
+
return {
|
|
18221
|
+
/** Reads the session's goal: from the transcript for a supervised session, with no effect on it; by running `/goal` on the self-hosted surface otherwise. */
|
|
18222
|
+
goalGet: async (sessionId, options = {}) => await onRoute(sessionId, options, {
|
|
18223
|
+
supervised: async (target) => {
|
|
18224
|
+
const read = await transcriptGoal(sessionId, target);
|
|
18225
|
+
return await Promise.resolve(read.ok ? { ok: true, report: { route: "supervised", goal: read.report } } : read);
|
|
18226
|
+
},
|
|
18227
|
+
selfHosted: async (selfHost, signal) => {
|
|
18228
|
+
const read = await runSelfHostedSlashCommand(selfHost, sessionId, { kind: "goal-get" }, waitOf(options), signal);
|
|
18229
|
+
return read.ok ? { ok: true, report: { route: "self-hosted", goal: read.report.goal } } : read;
|
|
18230
|
+
}
|
|
18231
|
+
}),
|
|
18232
|
+
/**
|
|
18233
|
+
* Sets the session's goal: the goal check then keeps the session working until the condition holds, and the condition reaches its model as a directive (`docs/rc-slash-commands.md`, the trust boundary). Refused unsent: an empty condition, one `/goal` reads as a clear, and one longer than it accepts. The answer names the goal it replaced.
|
|
18234
|
+
*/
|
|
18235
|
+
goalSet: async (sessionId, condition, options = {}) => {
|
|
18236
|
+
const trimmed = condition.trim();
|
|
18237
|
+
if (trimmed === "") {
|
|
18238
|
+
return { ok: false, message: "a goal set needs a non-empty condition" };
|
|
18239
|
+
}
|
|
18240
|
+
if (RC_GOAL_CLEAR_WORDS.includes(trimmed.toLowerCase())) {
|
|
18241
|
+
return { ok: false, message: `"${trimmed}" cannot be set as a goal condition: /goal reads ${RC_GOAL_CLEAR_WORDS.join(", ")} as a request to clear the goal, so use the clear verb for that` };
|
|
18242
|
+
}
|
|
18243
|
+
if (/[\r\n]/u.test(trimmed)) {
|
|
18244
|
+
return { ok: false, message: "a goal condition is one line: /goal reads its condition from the line it is typed on, and both routes confirm the goal by the exact condition, so a condition spanning lines is refused rather than set as something else" };
|
|
18245
|
+
}
|
|
18246
|
+
if (trimmed.length > RC_GOAL_CONDITION_MAX_CHARS) {
|
|
18247
|
+
return { ok: false, message: `a goal condition is limited to ${String(RC_GOAL_CONDITION_MAX_CHARS)} characters, and this one has ${String(trimmed.length)}` };
|
|
18248
|
+
}
|
|
18249
|
+
return await onRoute(sessionId, options, {
|
|
18250
|
+
supervised: async (target, signal, waitMs) => {
|
|
18251
|
+
const before = await transcriptGoal(sessionId, target);
|
|
18252
|
+
if (!before.ok) {
|
|
18253
|
+
return before;
|
|
18254
|
+
}
|
|
18255
|
+
await target.runGoal(trimmed, signal, waitMs);
|
|
18256
|
+
const after = await settledGoal(sessionId, target, signal, (goal) => goal?.condition === trimmed);
|
|
18257
|
+
if (!after.ok) {
|
|
18258
|
+
return after;
|
|
18259
|
+
}
|
|
18260
|
+
return after.report?.condition === trimmed ? { ok: true, report: { route: "supervised", condition: trimmed, superseded: before.report?.condition ?? null } } : { ok: false, message: `session ${sessionId} ran /goal but its transcript does not record the goal as set` };
|
|
18261
|
+
},
|
|
18262
|
+
selfHosted: async (selfHost, signal) => {
|
|
18263
|
+
const before = await runSelfHostedSlashCommand(selfHost, sessionId, { kind: "goal-get" }, waitOf(options), signal);
|
|
18264
|
+
if (!before.ok) {
|
|
18265
|
+
return before;
|
|
18266
|
+
}
|
|
18267
|
+
const set = await runSelfHostedSlashCommand(selfHost, sessionId, { kind: "goal-set", condition: trimmed }, waitOf(options), signal);
|
|
18268
|
+
return set.ok ? { ok: true, report: { route: "self-hosted", condition: set.report.condition, superseded: before.report.goal?.condition ?? null } } : set;
|
|
18269
|
+
}
|
|
18270
|
+
});
|
|
18271
|
+
},
|
|
18272
|
+
/** Clears the session's goal and names the condition it cleared, or `null` when there was none, which is not a failure (clearing is idempotent). */
|
|
18273
|
+
goalClear: async (sessionId, options = {}) => await onRoute(sessionId, options, {
|
|
18274
|
+
supervised: async (target, signal, waitMs) => {
|
|
18275
|
+
const before = await transcriptGoal(sessionId, target);
|
|
18276
|
+
if (!before.ok) {
|
|
18277
|
+
return before;
|
|
18278
|
+
}
|
|
18279
|
+
if (before.report === null) {
|
|
18280
|
+
return { ok: true, report: { route: "supervised", cleared: null } };
|
|
18281
|
+
}
|
|
18282
|
+
await target.runGoal("clear", signal, waitMs);
|
|
18283
|
+
const after = await settledGoal(sessionId, target, signal, (goal) => goal === null);
|
|
18284
|
+
if (!after.ok) {
|
|
18285
|
+
return after;
|
|
18286
|
+
}
|
|
18287
|
+
return after.report === null ? { ok: true, report: { route: "supervised", cleared: before.report.condition } } : { ok: false, message: `session ${sessionId} ran /goal clear but its transcript still records the goal "${after.report.condition}"` };
|
|
18288
|
+
},
|
|
18289
|
+
selfHosted: async (selfHost, signal) => {
|
|
18290
|
+
const cleared = await runSelfHostedSlashCommand(selfHost, sessionId, { kind: "goal-clear" }, waitOf(options), signal);
|
|
18291
|
+
return cleared.ok ? { ok: true, report: { route: "self-hosted", cleared: cleared.report.cleared } } : cleared;
|
|
18292
|
+
}
|
|
18293
|
+
}),
|
|
18294
|
+
/** Compacts the session's conversation, with custom summary instructions when given, and resolves with the outcome: the trigger and token counts, or the session's reason for not compacting. */
|
|
18295
|
+
compact: async (sessionId, options = {}) => {
|
|
18296
|
+
const instructions = options.instructions?.trim();
|
|
18297
|
+
const given = instructions === void 0 || instructions === "" ? void 0 : instructions;
|
|
18298
|
+
return await onRoute(sessionId, options, {
|
|
18299
|
+
supervised: async (target, signal, waitMs) => {
|
|
18300
|
+
const result = await target.compact(signal, given, waitMs);
|
|
18301
|
+
if (result.kind === "unchanged") {
|
|
18302
|
+
return { ok: false, message: `session ${sessionId} was not compacted: ${result.reason}` };
|
|
18303
|
+
}
|
|
18304
|
+
return { ok: true, report: { route: "supervised", trigger: "plugin", ...result.beforeTokens === void 0 ? {} : { preTokens: result.beforeTokens }, ...result.afterTokens === void 0 ? {} : { postTokens: result.afterTokens } } };
|
|
18305
|
+
},
|
|
18306
|
+
selfHosted: async (selfHost, signal) => {
|
|
18307
|
+
const compacted = await runSelfHostedSlashCommand(selfHost, sessionId, { kind: "compact", instructions: given }, waitOf(options), signal);
|
|
18308
|
+
return compacted.ok ? { ok: true, report: { route: "self-hosted", ...compacted.report } } : compacted;
|
|
18309
|
+
}
|
|
18310
|
+
});
|
|
18311
|
+
}
|
|
18312
|
+
};
|
|
18313
|
+
}
|
|
18314
|
+
|
|
18315
|
+
// src/frontdoor/rcSlashCommandSchemas.ts
|
|
18316
|
+
var WaitMsSchema = z23.int().positive().max(RC_SESSION_COMMAND_MAX_WAIT_MS).optional();
|
|
18317
|
+
var RcGoalSessionInputSchema = z23.strictObject({
|
|
18318
|
+
session: z23.string().min(1),
|
|
18319
|
+
waitMs: WaitMsSchema
|
|
18320
|
+
});
|
|
18321
|
+
var RcGoalSetInputSchema = z23.strictObject({
|
|
18322
|
+
session: z23.string().min(1),
|
|
18323
|
+
condition: z23.string().trim().min(1).max(RC_GOAL_CONDITION_MAX_CHARS).regex(/^[^\r\n]*$/u, "a goal condition is one line"),
|
|
18324
|
+
waitMs: WaitMsSchema
|
|
18325
|
+
});
|
|
18326
|
+
var RcCompactInputSchema = z23.strictObject({
|
|
18327
|
+
session: z23.string().min(1),
|
|
18328
|
+
waitMs: WaitMsSchema
|
|
18329
|
+
});
|
|
18330
|
+
var RcCompactWithInstructionsInputSchema = z23.strictObject({
|
|
18331
|
+
session: z23.string().min(1),
|
|
18332
|
+
instructions: z23.string().trim().min(1).max(RC_COMPACT_INSTRUCTIONS_MAX_CHARS),
|
|
18333
|
+
waitMs: WaitMsSchema
|
|
18334
|
+
});
|
|
18335
|
+
var commandAnswerShape = {
|
|
18336
|
+
session: z23.string(),
|
|
18337
|
+
route: z23.enum(["supervised", "self-hosted"])
|
|
18338
|
+
};
|
|
18339
|
+
var RcGoalGetOutputSchema = z23.strictObject({
|
|
18340
|
+
...commandAnswerShape,
|
|
18341
|
+
goal: z23.strictObject({ condition: z23.string(), iterations: z23.int().nonnegative(), lastCheck: z23.string().optional() }).nullable()
|
|
18342
|
+
});
|
|
18343
|
+
var RcGoalSetOutputSchema = z23.strictObject({
|
|
18344
|
+
...commandAnswerShape,
|
|
18345
|
+
condition: z23.string(),
|
|
18346
|
+
superseded: z23.string().nullable()
|
|
18347
|
+
});
|
|
18348
|
+
var RcGoalClearOutputSchema = z23.strictObject({
|
|
18349
|
+
...commandAnswerShape,
|
|
18350
|
+
cleared: z23.string().nullable()
|
|
18351
|
+
});
|
|
18352
|
+
var RcCompactOutputSchema = z23.strictObject({
|
|
18353
|
+
...commandAnswerShape,
|
|
18354
|
+
trigger: z23.string(),
|
|
18355
|
+
preTokens: z23.number().optional(),
|
|
18356
|
+
postTokens: z23.number().optional()
|
|
18357
|
+
});
|
|
18358
|
+
|
|
17920
18359
|
// src/frontdoor/rcApi.ts
|
|
17921
18360
|
var RC_ORPC_PATH_PREFIX = "/__agent-shim/orpc";
|
|
17922
18361
|
var RC_OPENAPI_DOC_PATH = "/openapi.json";
|
|
@@ -17938,6 +18377,7 @@ function doorApiAuth(expectedToken) {
|
|
|
17938
18377
|
});
|
|
17939
18378
|
}
|
|
17940
18379
|
var RC_API_TAG = "remote-control";
|
|
18380
|
+
var RC_DIRECTIVE_TAG = "remote-control-directives";
|
|
17941
18381
|
function createRcApiRouter(deps) {
|
|
17942
18382
|
const authed = doorApiAuth(deps.expectedToken);
|
|
17943
18383
|
const delivered = (sessionId, result) => {
|
|
@@ -17955,6 +18395,13 @@ function createRcApiRouter(deps) {
|
|
|
17955
18395
|
}
|
|
17956
18396
|
return { request: result.requestId, sequenceNums: result.sequenceNums };
|
|
17957
18397
|
};
|
|
18398
|
+
const commanded = (sessionId, result) => {
|
|
18399
|
+
if (!result.ok) {
|
|
18400
|
+
throw new ORPCError("BAD_GATEWAY", { message: result.message });
|
|
18401
|
+
}
|
|
18402
|
+
return { session: sessionId, ...result.report };
|
|
18403
|
+
};
|
|
18404
|
+
const optionsOf = (waitMs, signal) => ({ ...waitMs === void 0 ? {} : { waitMs }, ...signal === void 0 ? {} : { signal } });
|
|
17958
18405
|
return {
|
|
17959
18406
|
rc: {
|
|
17960
18407
|
list: authed.meta(openapi({ method: "GET", path: "/rest/rc/sessions", summary: "List the observed Remote Control sessions", tags: [RC_API_TAG] })).output(RcListOutputSchema).handler(() => ({ sessions: deps.list() })),
|
|
@@ -17991,6 +18438,11 @@ function createRcApiRouter(deps) {
|
|
|
17991
18438
|
mcpAuthenticate: authed.meta(openapi({ method: "POST", path: "/rest/rc/mcp-authenticate", summary: "Start OAuth for one MCP server on a session", tags: [RC_API_TAG] })).input(RcMcpAuthenticateInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.mcpAuthenticate(input.session, input.serverName, input.redirectUri)) })),
|
|
17992
18439
|
mcpOAuthCallbackUrl: authed.meta(openapi({ method: "POST", path: "/rest/rc/mcp-oauth-callback-url", summary: "Hand a completed MCP OAuth callback to a session", tags: [RC_API_TAG] })).input(RcMcpOAuthCallbackUrlInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.mcpOAuthCallbackUrl(input.session, input.serverName, input.callbackUrl)) })),
|
|
17993
18440
|
teleport: authed.meta(openapi({ method: "POST", path: "/rest/rc/teleport", summary: "Teleport a session to a conversation marker", tags: [RC_API_TAG] })).input(RcTeleportInputSchema).output(RcWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, sequenceNums: delivered(input.session, await deps.teleport(input.session, input.marker)) })),
|
|
18441
|
+
goalGet: authed.meta(openapi({ method: "POST", path: "/rest/rc/goal/get", summary: "Read a session's goal", tags: [RC_API_TAG] })).input(RcGoalSessionInputSchema).output(RcGoalGetOutputSchema).handler(async ({ input, signal }) => commanded(input.session, await deps.goalGet(input.session, optionsOf(input.waitMs, signal)))),
|
|
18442
|
+
goalSet: authed.meta(openapi({ method: "POST", path: "/rest/rc/goal/set", summary: "Set a session's goal, a directive its model then works to", tags: [RC_DIRECTIVE_TAG] })).input(RcGoalSetInputSchema).output(RcGoalSetOutputSchema).handler(async ({ input, signal }) => commanded(input.session, await deps.goalSet(input.session, input.condition, optionsOf(input.waitMs, signal)))),
|
|
18443
|
+
goalClear: authed.meta(openapi({ method: "POST", path: "/rest/rc/goal/clear", summary: "Clear a session's goal", tags: [RC_API_TAG] })).input(RcGoalSessionInputSchema).output(RcGoalClearOutputSchema).handler(async ({ input, signal }) => commanded(input.session, await deps.goalClear(input.session, optionsOf(input.waitMs, signal)))),
|
|
18444
|
+
compact: authed.meta(openapi({ method: "POST", path: "/rest/rc/compact", summary: "Compact a session's conversation", tags: [RC_API_TAG] })).input(RcCompactInputSchema).output(RcCompactOutputSchema).handler(async ({ input, signal }) => commanded(input.session, await deps.compact(input.session, optionsOf(input.waitMs, signal)))),
|
|
18445
|
+
compactWithInstructions: authed.meta(openapi({ method: "POST", path: "/rest/rc/compact-with-instructions", summary: "Compact a session's conversation under summary instructions, a directive to its model", tags: [RC_DIRECTIVE_TAG] })).input(RcCompactWithInstructionsInputSchema).output(RcCompactOutputSchema).handler(async ({ input, signal }) => commanded(input.session, await deps.compact(input.session, { ...optionsOf(input.waitMs, signal), instructions: input.instructions }))),
|
|
17994
18446
|
subscribe: authed.meta(openapi({ method: "GET", path: "/rest/rc/events", summary: "Stream a session's Remote Control events (SSE)", tags: [RC_API_TAG] })).input(RcSessionQuerySchema).output(eventIterator(RcStreamEventSchema)).handler(async function* ({ input, signal }) {
|
|
17995
18447
|
const queue = [];
|
|
17996
18448
|
let wake;
|
|
@@ -18071,8 +18523,27 @@ function doorApiNodeHandlerOf(router, expectedToken) {
|
|
|
18071
18523
|
function createRcApiNodeHandler(deps) {
|
|
18072
18524
|
return doorApiNodeHandlerOf(createRcApiRouter(deps), deps.expectedToken);
|
|
18073
18525
|
}
|
|
18526
|
+
var DEFAULT_HEADERS_TIMEOUT_MS = 3e5;
|
|
18527
|
+
var SESSION_COMMAND_PROCEDURES = ["rc/goalGet", "rc/goalSet", "rc/goalClear", "rc/compact", "rc/compactWithInstructions"];
|
|
18528
|
+
function headersTimeoutOf(url, body) {
|
|
18529
|
+
if (!SESSION_COMMAND_PROCEDURES.some((procedure) => url.endsWith(`${RC_ORPC_PATH_PREFIX}/${procedure}`))) {
|
|
18530
|
+
return DEFAULT_HEADERS_TIMEOUT_MS;
|
|
18531
|
+
}
|
|
18532
|
+
const parsed = body === void 0 ? void 0 : JSON.parse(body.toString("utf8"));
|
|
18533
|
+
const waitMs = typeof parsed === "object" && parsed !== null && "json" in parsed && typeof parsed.json === "object" && parsed.json !== null && "waitMs" in parsed.json && typeof parsed.json.waitMs === "number" ? parsed.json.waitMs : COMPACT_TIMEOUT_MS;
|
|
18534
|
+
return Math.min(waitMs + DEFAULT_HEADERS_TIMEOUT_MS, RC_SESSION_COMMAND_MAX_WAIT_MS);
|
|
18535
|
+
}
|
|
18074
18536
|
function frontDoorApiLink(port, ca, token) {
|
|
18075
|
-
const
|
|
18537
|
+
const dispatchers = /* @__PURE__ */ new Map();
|
|
18538
|
+
const dispatcherFor = (headersTimeout) => {
|
|
18539
|
+
const existing = dispatchers.get(headersTimeout);
|
|
18540
|
+
if (existing !== void 0) {
|
|
18541
|
+
return existing;
|
|
18542
|
+
}
|
|
18543
|
+
const created = new Agent3({ connect: { ca }, headersTimeout });
|
|
18544
|
+
dispatchers.set(headersTimeout, created);
|
|
18545
|
+
return created;
|
|
18546
|
+
};
|
|
18076
18547
|
return new RPCLink({
|
|
18077
18548
|
origin: `https://127.0.0.1:${String(port)}`,
|
|
18078
18549
|
url: RC_ORPC_PATH_PREFIX,
|
|
@@ -18085,7 +18556,7 @@ function frontDoorApiLink(port, ca, token) {
|
|
|
18085
18556
|
method: request4.method,
|
|
18086
18557
|
headers: [...request4.headers],
|
|
18087
18558
|
...body === void 0 ? {} : { body },
|
|
18088
|
-
dispatcher,
|
|
18559
|
+
dispatcher: dispatcherFor(headersTimeoutOf(request4.url, body)),
|
|
18089
18560
|
...options.signal === void 0 ? {} : { signal: options.signal }
|
|
18090
18561
|
});
|
|
18091
18562
|
return new Response(answered.body, { status: answered.status, statusText: answered.statusText, headers: [...answered.headers] });
|
|
@@ -18101,48 +18572,48 @@ init_cliError();
|
|
|
18101
18572
|
init_package();
|
|
18102
18573
|
|
|
18103
18574
|
// src/codex/appServerSchemas.ts
|
|
18104
|
-
import { z as
|
|
18575
|
+
import { z as z24 } from "zod";
|
|
18105
18576
|
var CODEX_APP_SERVER_GENERATED_AGAINST = "0.160.0";
|
|
18106
|
-
var RateLimitWindowSchema =
|
|
18107
|
-
usedPercent:
|
|
18108
|
-
resetsAt:
|
|
18109
|
-
windowDurationMins:
|
|
18110
|
-
});
|
|
18111
|
-
var RateLimitSnapshotSchema =
|
|
18112
|
-
limitId:
|
|
18113
|
-
limitName:
|
|
18114
|
-
planType:
|
|
18577
|
+
var RateLimitWindowSchema = z24.object({
|
|
18578
|
+
usedPercent: z24.number(),
|
|
18579
|
+
resetsAt: z24.number().nullish(),
|
|
18580
|
+
windowDurationMins: z24.number().nullish()
|
|
18581
|
+
});
|
|
18582
|
+
var RateLimitSnapshotSchema = z24.object({
|
|
18583
|
+
limitId: z24.string().nullish(),
|
|
18584
|
+
limitName: z24.string().nullish(),
|
|
18585
|
+
planType: z24.string().nullish(),
|
|
18115
18586
|
primary: RateLimitWindowSchema.nullish(),
|
|
18116
18587
|
secondary: RateLimitWindowSchema.nullish(),
|
|
18117
|
-
rateLimitReachedType:
|
|
18118
|
-
spendControlReached:
|
|
18119
|
-
});
|
|
18120
|
-
var RateLimitResetCreditSchema =
|
|
18121
|
-
id:
|
|
18122
|
-
grantedAt:
|
|
18123
|
-
expiresAt:
|
|
18124
|
-
resetType:
|
|
18125
|
-
status:
|
|
18126
|
-
title:
|
|
18127
|
-
description:
|
|
18128
|
-
});
|
|
18129
|
-
var CodexAccountSchema =
|
|
18130
|
-
|
|
18131
|
-
|
|
18132
|
-
|
|
18588
|
+
rateLimitReachedType: z24.string().nullish(),
|
|
18589
|
+
spendControlReached: z24.boolean().nullish()
|
|
18590
|
+
});
|
|
18591
|
+
var RateLimitResetCreditSchema = z24.object({
|
|
18592
|
+
id: z24.string(),
|
|
18593
|
+
grantedAt: z24.number(),
|
|
18594
|
+
expiresAt: z24.number().nullish(),
|
|
18595
|
+
resetType: z24.string(),
|
|
18596
|
+
status: z24.string(),
|
|
18597
|
+
title: z24.string().nullish(),
|
|
18598
|
+
description: z24.string().nullish()
|
|
18599
|
+
});
|
|
18600
|
+
var CodexAccountSchema = z24.discriminatedUnion("type", [
|
|
18601
|
+
z24.object({ type: z24.literal("apiKey") }),
|
|
18602
|
+
z24.object({ type: z24.literal("chatgpt"), email: z24.string().nullable(), planType: z24.string() }),
|
|
18603
|
+
z24.object({ type: z24.literal("amazonBedrock"), usesCodexManagedCredentials: z24.boolean().default(false) })
|
|
18133
18604
|
]);
|
|
18134
|
-
var CodexAccountReadSchema =
|
|
18605
|
+
var CodexAccountReadSchema = z24.object({
|
|
18135
18606
|
account: CodexAccountSchema.nullable(),
|
|
18136
|
-
requiresOpenaiAuth:
|
|
18607
|
+
requiresOpenaiAuth: z24.boolean()
|
|
18137
18608
|
});
|
|
18138
|
-
var CodexRateLimitsReadSchema =
|
|
18609
|
+
var CodexRateLimitsReadSchema = z24.object({
|
|
18139
18610
|
rateLimits: RateLimitSnapshotSchema,
|
|
18140
|
-
rateLimitsByLimitId:
|
|
18141
|
-
rateLimitResetCredits:
|
|
18142
|
-
accountId:
|
|
18143
|
-
ordinaryUsageAllowed:
|
|
18611
|
+
rateLimitsByLimitId: z24.record(z24.string(), RateLimitSnapshotSchema).nullish(),
|
|
18612
|
+
rateLimitResetCredits: z24.object({ availableCount: z24.number(), credits: z24.array(RateLimitResetCreditSchema).nullish() }).nullish(),
|
|
18613
|
+
accountId: z24.string().nullish(),
|
|
18614
|
+
ordinaryUsageAllowed: z24.boolean().nullish()
|
|
18144
18615
|
});
|
|
18145
|
-
var CodexInitializeResultSchema =
|
|
18616
|
+
var CodexInitializeResultSchema = z24.object({ userAgent: z24.string() });
|
|
18146
18617
|
|
|
18147
18618
|
// src/codex/appServer.ts
|
|
18148
18619
|
var CodexAppServerUnavailableError = class extends CliError {
|
|
@@ -18482,7 +18953,7 @@ init_projects();
|
|
|
18482
18953
|
init_injected();
|
|
18483
18954
|
init_pipeline();
|
|
18484
18955
|
import path37 from "node:path";
|
|
18485
|
-
import { z as
|
|
18956
|
+
import { z as z27 } from "zod";
|
|
18486
18957
|
var HISTORY_PROJECTS_KEY_PREFIX = "history/projects/";
|
|
18487
18958
|
function projectFragmentOf(rawKey) {
|
|
18488
18959
|
return rawKey.startsWith(HISTORY_PROJECTS_KEY_PREFIX) ? rawKey.slice(HISTORY_PROJECTS_KEY_PREFIX.length) : void 0;
|
|
@@ -18551,9 +19022,9 @@ function lookupKeychainService(run, farmRoot) {
|
|
|
18551
19022
|
}
|
|
18552
19023
|
return { checked: true, found: true, serviceName, note: `Keychain service name for this identity: "${serviceName}".` };
|
|
18553
19024
|
}
|
|
18554
|
-
var SettingsSecretsShapeSchema =
|
|
18555
|
-
env:
|
|
18556
|
-
hooks:
|
|
19025
|
+
var SettingsSecretsShapeSchema = z27.looseObject({
|
|
19026
|
+
env: z27.record(z27.string(), z27.unknown()).optional(),
|
|
19027
|
+
hooks: z27.record(z27.string(), z27.array(z27.unknown())).optional()
|
|
18557
19028
|
});
|
|
18558
19029
|
function hookCommandCountOf(group) {
|
|
18559
19030
|
if (typeof group !== "object" || group === null) {
|
|
@@ -18858,7 +19329,7 @@ init_schema();
|
|
|
18858
19329
|
init_claudeVersion();
|
|
18859
19330
|
init_identity();
|
|
18860
19331
|
init_projects();
|
|
18861
|
-
import { z as
|
|
19332
|
+
import { z as z29 } from "zod";
|
|
18862
19333
|
|
|
18863
19334
|
// src/resolve/types.ts
|
|
18864
19335
|
var LAYER_KINDS = [
|
|
@@ -18919,123 +19390,123 @@ var DIAGNOSTIC_SEVERITIES = ["error", "warning", "info"];
|
|
|
18919
19390
|
|
|
18920
19391
|
// src/usage/pickReportSchema.ts
|
|
18921
19392
|
init_plan2();
|
|
18922
|
-
import { z as
|
|
18923
|
-
var PoolPickCandidateViewSchema =
|
|
18924
|
-
identity:
|
|
19393
|
+
import { z as z28 } from "zod";
|
|
19394
|
+
var PoolPickCandidateViewSchema = z28.strictObject({
|
|
19395
|
+
identity: z28.string(),
|
|
18925
19396
|
/** In pick order: `scored` has usable quota data, `unknown` has none and no plan known to bill by use, `pay-per-use` bills by use whether or not usage is recorded, `ineligible` is refused right now. */
|
|
18926
|
-
class:
|
|
19397
|
+
class: z28.enum(["scored", "unknown", "pay-per-use", "ineligible"]),
|
|
18927
19398
|
/** Plan-size-weighted remaining quota per hour until its reset; present for `scored` only. */
|
|
18928
|
-
score:
|
|
19399
|
+
score: z28.number().optional(),
|
|
18929
19400
|
/** Which window's reset divides the score: the seven-day window, or the five-hour one when the member reports no seven-day utilisation or its measured-ratio five-hour term outranks the weekly one; present with `score`. */
|
|
18930
|
-
scoreWindow:
|
|
19401
|
+
scoreWindow: z28.enum(["sevenDay", "fiveHour"]).optional(),
|
|
18931
19402
|
/** False when the five-hour window would run dry, at the observed pace, before it resets. */
|
|
18932
|
-
feasible:
|
|
19403
|
+
feasible: z28.boolean(),
|
|
18933
19404
|
/** When an `ineligible` member can be used again, as an ISO instant. */
|
|
18934
|
-
blockedUntil:
|
|
19405
|
+
blockedUntil: z28.iso.datetime().optional(),
|
|
18935
19406
|
plan: PlanClassSchema,
|
|
18936
19407
|
/** The facts behind the class and score, in the order they matter. */
|
|
18937
|
-
reasons:
|
|
19408
|
+
reasons: z28.array(z28.string())
|
|
18938
19409
|
});
|
|
18939
|
-
var PoolPickReportSchema =
|
|
18940
|
-
pool:
|
|
18941
|
-
directory:
|
|
19410
|
+
var PoolPickReportSchema = z28.strictObject({
|
|
19411
|
+
pool: z28.string(),
|
|
19412
|
+
directory: z28.string(),
|
|
18942
19413
|
/** The member a launch would run as, absent when every member is refused. */
|
|
18943
|
-
pick:
|
|
18944
|
-
candidates:
|
|
19414
|
+
pick: z28.string().optional(),
|
|
19415
|
+
candidates: z28.array(PoolPickCandidateViewSchema),
|
|
18945
19416
|
/** Identity members anywhere in the pool's graph that do not exist; a launch skips them. */
|
|
18946
|
-
missing:
|
|
19417
|
+
missing: z28.array(z28.string()),
|
|
18947
19418
|
/** When nothing can be picked, the soonest any member returns. */
|
|
18948
|
-
earliestReturn:
|
|
19419
|
+
earliestReturn: z28.strictObject({ identity: z28.string(), at: z28.iso.datetime() }).optional(),
|
|
18949
19420
|
/** The member a resumed conversation started on but moved off, and why, when the ranking could not keep it. */
|
|
18950
|
-
movedOff:
|
|
19421
|
+
movedOff: z28.strictObject({ identity: z28.string(), reason: z28.string() }).optional(),
|
|
18951
19422
|
/** Why the last-pick record could not be read, when that is the case. */
|
|
18952
|
-
stickyProblem:
|
|
19423
|
+
stickyProblem: z28.string().optional()
|
|
18953
19424
|
});
|
|
18954
19425
|
|
|
18955
19426
|
// src/checkReportSchema.ts
|
|
18956
19427
|
var CHECK_CREDENTIAL_APPLIES = ["provider", "identity", "stored-login"];
|
|
18957
|
-
var CheckLayerViewSchema =
|
|
18958
|
-
id:
|
|
18959
|
-
kind:
|
|
18960
|
-
source:
|
|
18961
|
-
});
|
|
18962
|
-
var CheckEntryViewSchema =
|
|
18963
|
-
path:
|
|
18964
|
-
shared:
|
|
18965
|
-
via:
|
|
19428
|
+
var CheckLayerViewSchema = z29.strictObject({
|
|
19429
|
+
id: z29.int(),
|
|
19430
|
+
kind: z29.enum(LAYER_KINDS),
|
|
19431
|
+
source: z29.string()
|
|
19432
|
+
});
|
|
19433
|
+
var CheckEntryViewSchema = z29.strictObject({
|
|
19434
|
+
path: z29.string(),
|
|
19435
|
+
shared: z29.boolean(),
|
|
19436
|
+
via: z29.enum(DECISION_VIAS),
|
|
18966
19437
|
/** The entry's real category, or null when nothing classifies it. */
|
|
18967
|
-
category:
|
|
18968
|
-
rule:
|
|
19438
|
+
category: z29.enum(CATEGORY_NAMES).nullable(),
|
|
19439
|
+
rule: z29.strictObject({ key: z29.string(), layer: z29.int() }).optional(),
|
|
18969
19440
|
/** Rules that matched but whose `when` condition failed, each with the conditions that failed. */
|
|
18970
|
-
eliminated:
|
|
18971
|
-
});
|
|
18972
|
-
var CheckDiagnosticSchema =
|
|
18973
|
-
code:
|
|
18974
|
-
severity:
|
|
18975
|
-
message:
|
|
18976
|
-
subject:
|
|
18977
|
-
layer:
|
|
18978
|
-
});
|
|
18979
|
-
var CheckAmbientCredentialSchema =
|
|
18980
|
-
var CheckKeychainSchema =
|
|
18981
|
-
checked:
|
|
18982
|
-
found:
|
|
18983
|
-
serviceName:
|
|
18984
|
-
note:
|
|
18985
|
-
});
|
|
18986
|
-
var CheckSettingsExposureSchema =
|
|
18987
|
-
file:
|
|
18988
|
-
envKeyNames:
|
|
18989
|
-
hookEventNames:
|
|
18990
|
-
hookCommandCount:
|
|
18991
|
-
});
|
|
18992
|
-
var CredentialSourceSummarySchema =
|
|
18993
|
-
|
|
18994
|
-
|
|
18995
|
-
|
|
18996
|
-
|
|
18997
|
-
|
|
18998
|
-
|
|
19441
|
+
eliminated: z29.readonly(z29.array(z29.strictObject({ key: z29.string(), failed: z29.readonly(z29.array(z29.string())) }))).optional()
|
|
19442
|
+
});
|
|
19443
|
+
var CheckDiagnosticSchema = z29.strictObject({
|
|
19444
|
+
code: z29.enum(DIAGNOSTIC_CODES),
|
|
19445
|
+
severity: z29.enum(DIAGNOSTIC_SEVERITIES),
|
|
19446
|
+
message: z29.string(),
|
|
19447
|
+
subject: z29.string().optional(),
|
|
19448
|
+
layer: z29.int().optional()
|
|
19449
|
+
});
|
|
19450
|
+
var CheckAmbientCredentialSchema = z29.union([z29.strictObject({ ok: z29.literal(true) }), z29.strictObject({ ok: z29.literal(false), variable: z29.string(), message: z29.string() })]);
|
|
19451
|
+
var CheckKeychainSchema = z29.strictObject({
|
|
19452
|
+
checked: z29.literal(true),
|
|
19453
|
+
found: z29.boolean(),
|
|
19454
|
+
serviceName: z29.string().optional(),
|
|
19455
|
+
note: z29.string()
|
|
19456
|
+
});
|
|
19457
|
+
var CheckSettingsExposureSchema = z29.strictObject({
|
|
19458
|
+
file: z29.string(),
|
|
19459
|
+
envKeyNames: z29.readonly(z29.array(z29.string())),
|
|
19460
|
+
hookEventNames: z29.readonly(z29.array(z29.string())),
|
|
19461
|
+
hookCommandCount: z29.int().nonnegative()
|
|
19462
|
+
});
|
|
19463
|
+
var CredentialSourceSummarySchema = z29.union([
|
|
19464
|
+
z29.strictObject({ kind: z29.literal("env"), variable: z29.string() }),
|
|
19465
|
+
z29.strictObject({ kind: z29.literal("file"), path: z29.string() }),
|
|
19466
|
+
z29.strictObject({ kind: z29.literal("command"), program: z29.string() }),
|
|
19467
|
+
z29.strictObject({ kind: z29.literal("op"), reference: z29.string() }),
|
|
19468
|
+
z29.strictObject({ kind: z29.literal("keychain"), service: z29.string(), account: z29.string().optional() }),
|
|
19469
|
+
z29.strictObject({ kind: z29.literal("literal") })
|
|
18999
19470
|
]);
|
|
19000
|
-
var CredentialSummarySchema =
|
|
19001
|
-
target:
|
|
19002
|
-
sources:
|
|
19471
|
+
var CredentialSummarySchema = z29.strictObject({
|
|
19472
|
+
target: z29.enum(CREDENTIAL_TARGETS),
|
|
19473
|
+
sources: z29.readonly(z29.array(CredentialSourceSummarySchema)),
|
|
19003
19474
|
cache: CredentialCacheSchema.optional()
|
|
19004
19475
|
});
|
|
19005
|
-
var CachedCredentialStateSchema =
|
|
19006
|
-
|
|
19007
|
-
|
|
19008
|
-
|
|
19476
|
+
var CachedCredentialStateSchema = z29.union([
|
|
19477
|
+
z29.strictObject({ store: z29.enum(CREDENTIAL_CACHE_STORES), status: z29.literal("empty") }),
|
|
19478
|
+
z29.strictObject({ store: z29.enum(CREDENTIAL_CACHE_STORES), status: z29.literal("unreadable"), reason: z29.string() }),
|
|
19479
|
+
z29.strictObject({ store: z29.enum(CREDENTIAL_CACHE_STORES), status: z29.enum(["fresh", "expired"]), ageMs: z29.number(), expiresInMs: z29.number().optional() })
|
|
19009
19480
|
]);
|
|
19010
|
-
var CheckCredentialProviderSchema =
|
|
19011
|
-
|
|
19012
|
-
|
|
19481
|
+
var CheckCredentialProviderSchema = z29.union([
|
|
19482
|
+
z29.strictObject({ name: z29.string(), credential: CredentialSummarySchema.optional(), cached: CachedCredentialStateSchema.optional() }),
|
|
19483
|
+
z29.strictObject({ name: z29.string(), problem: z29.string() })
|
|
19013
19484
|
]);
|
|
19014
|
-
var CheckCredentialSchema =
|
|
19015
|
-
applies:
|
|
19485
|
+
var CheckCredentialSchema = z29.strictObject({
|
|
19486
|
+
applies: z29.enum(CHECK_CREDENTIAL_APPLIES),
|
|
19016
19487
|
provider: CheckCredentialProviderSchema.optional(),
|
|
19017
19488
|
identity: CredentialSummarySchema.optional(),
|
|
19018
19489
|
identityCached: CachedCredentialStateSchema.optional()
|
|
19019
19490
|
});
|
|
19020
|
-
var CheckClaudeVersionSchema =
|
|
19021
|
-
pinned:
|
|
19022
|
-
highestInstalled:
|
|
19023
|
-
installed:
|
|
19491
|
+
var CheckClaudeVersionSchema = z29.strictObject({
|
|
19492
|
+
pinned: z29.strictObject({ version: z29.string(), source: z29.enum(CLAUDE_VERSION_SOURCES), installed: z29.boolean() }).optional(),
|
|
19493
|
+
highestInstalled: z29.string().optional(),
|
|
19494
|
+
installed: z29.readonly(z29.array(z29.string()))
|
|
19024
19495
|
});
|
|
19025
|
-
var CheckReportJsonSchema =
|
|
19026
|
-
identity:
|
|
19496
|
+
var CheckReportJsonSchema = z29.strictObject({
|
|
19497
|
+
identity: z29.strictObject({ name: z29.string().nullable(), source: z29.enum(IDENTITY_DECISION_SOURCES) }),
|
|
19027
19498
|
/** The pool ranking, when the launch named a pool instead of an identity. */
|
|
19028
19499
|
pool: PoolPickReportSchema.optional(),
|
|
19029
|
-
configProfile:
|
|
19030
|
-
layers:
|
|
19031
|
-
entries:
|
|
19032
|
-
projectEncodingAmbiguities:
|
|
19033
|
-
|
|
19500
|
+
configProfile: z29.strictObject({ name: z29.string().nullable(), source: z29.enum(CONFIG_PROFILE_DECISION_SOURCES) }),
|
|
19501
|
+
layers: z29.readonly(z29.array(CheckLayerViewSchema)),
|
|
19502
|
+
entries: z29.readonly(z29.array(CheckEntryViewSchema)),
|
|
19503
|
+
projectEncodingAmbiguities: z29.readonly(
|
|
19504
|
+
z29.array(z29.strictObject({ fragment: z29.string(), encoded: z29.string(), reason: z29.enum(ENCODING_AMBIGUITY_REASONS), detail: z29.string() }))
|
|
19034
19505
|
),
|
|
19035
|
-
diagnostics:
|
|
19506
|
+
diagnostics: z29.readonly(z29.array(CheckDiagnosticSchema)),
|
|
19036
19507
|
ambientCredential: CheckAmbientCredentialSchema,
|
|
19037
19508
|
keychain: CheckKeychainSchema.optional(),
|
|
19038
|
-
settingsExposure:
|
|
19509
|
+
settingsExposure: z29.readonly(z29.array(CheckSettingsExposureSchema)),
|
|
19039
19510
|
credential: CheckCredentialSchema,
|
|
19040
19511
|
claudeVersion: CheckClaudeVersionSchema.optional()
|
|
19041
19512
|
});
|
|
@@ -19046,28 +19517,28 @@ init_preflight();
|
|
|
19046
19517
|
init_resets();
|
|
19047
19518
|
|
|
19048
19519
|
// src/usage/resetsSchema.ts
|
|
19049
|
-
import { z as
|
|
19050
|
-
var ResetRowSchema =
|
|
19051
|
-
identity:
|
|
19052
|
-
provider:
|
|
19520
|
+
import { z as z30 } from "zod";
|
|
19521
|
+
var ResetRowSchema = z30.strictObject({
|
|
19522
|
+
identity: z30.string(),
|
|
19523
|
+
provider: z30.string(),
|
|
19053
19524
|
/** What the window is: `5h`, `7d` or `extra usage` for an Anthropic account, or the provider's own measure and period (`tokens 5h`). */
|
|
19054
|
-
window:
|
|
19525
|
+
window: z30.string(),
|
|
19055
19526
|
/** When the state the window comes from was observed, as an ISO instant. */
|
|
19056
|
-
observedAt:
|
|
19527
|
+
observedAt: z30.iso.datetime(),
|
|
19057
19528
|
/** When the window resets, as an ISO instant; absent when the upstream reported none. */
|
|
19058
|
-
resetsAt:
|
|
19529
|
+
resetsAt: z30.iso.datetime().optional(),
|
|
19059
19530
|
/** True when the reset time has passed, so the recorded observation describes a window that no longer exists and its utilisation reads as 0. */
|
|
19060
|
-
reset:
|
|
19531
|
+
reset: z30.boolean(),
|
|
19061
19532
|
/** The fraction used, as `effectiveWindow` reads it at the report's own clock. */
|
|
19062
|
-
utilization:
|
|
19533
|
+
utilization: z30.number().optional(),
|
|
19063
19534
|
/** The window's own status, for a window that has not reset yet. */
|
|
19064
|
-
status:
|
|
19535
|
+
status: z30.string().optional()
|
|
19065
19536
|
});
|
|
19066
|
-
var ResetScheduleSchema =
|
|
19537
|
+
var ResetScheduleSchema = z30.strictObject({ resets: z30.readonly(z30.array(ResetRowSchema)) });
|
|
19067
19538
|
|
|
19068
19539
|
// src/frontdoor/controlSchemas.ts
|
|
19069
19540
|
import path43 from "node:path";
|
|
19070
|
-
import { z as
|
|
19541
|
+
import { z as z37 } from "zod";
|
|
19071
19542
|
|
|
19072
19543
|
// src/codex/doctor.ts
|
|
19073
19544
|
function codexIdentityFindings(entry, identity) {
|
|
@@ -20294,92 +20765,92 @@ function collectDoctorReport(params) {
|
|
|
20294
20765
|
// src/frontdoor/controlSchemas.ts
|
|
20295
20766
|
init_schema2();
|
|
20296
20767
|
init_state();
|
|
20297
|
-
var UsageListOutputSchema =
|
|
20298
|
-
var UsageWindowsInputSchema =
|
|
20299
|
-
identity:
|
|
20300
|
-
provider:
|
|
20768
|
+
var UsageListOutputSchema = z37.strictObject({ snapshots: z37.readonly(z37.array(UsageSnapshotSchema)) });
|
|
20769
|
+
var UsageWindowsInputSchema = z37.strictObject({
|
|
20770
|
+
identity: z37.string().min(1),
|
|
20771
|
+
provider: z37.string().min(1).optional()
|
|
20301
20772
|
});
|
|
20302
|
-
var EffectiveWindowSchema =
|
|
20773
|
+
var EffectiveWindowSchema = z37.strictObject({
|
|
20303
20774
|
/** True when the window's reset time has passed, so the recorded observation describes a window that no longer exists. */
|
|
20304
|
-
reset:
|
|
20775
|
+
reset: z37.boolean(),
|
|
20305
20776
|
/** The fraction used: 0 for a reset window, otherwise what was last observed, absent when none was reported. */
|
|
20306
|
-
utilization:
|
|
20777
|
+
utilization: z37.number().optional(),
|
|
20307
20778
|
/** The reset instant, for a window that has not reset yet and reported one. */
|
|
20308
|
-
resetsAtMs:
|
|
20779
|
+
resetsAtMs: z37.number().optional(),
|
|
20309
20780
|
/** The window's own status, for a window that has not reset yet. */
|
|
20310
|
-
status:
|
|
20781
|
+
status: z37.string().optional()
|
|
20311
20782
|
});
|
|
20312
|
-
var UsageWindowsOutputSchema =
|
|
20313
|
-
identity:
|
|
20314
|
-
provider:
|
|
20783
|
+
var UsageWindowsOutputSchema = z37.strictObject({
|
|
20784
|
+
identity: z37.string(),
|
|
20785
|
+
provider: z37.string(),
|
|
20315
20786
|
/** When the rate-limit state the windows come from was observed. */
|
|
20316
|
-
observedAt:
|
|
20787
|
+
observedAt: z37.iso.datetime().optional(),
|
|
20317
20788
|
fiveHour: EffectiveWindowSchema.optional(),
|
|
20318
20789
|
sevenDay: EffectiveWindowSchema.optional()
|
|
20319
20790
|
});
|
|
20320
|
-
var UsageLiveOutputSchema =
|
|
20791
|
+
var UsageLiveOutputSchema = z37.strictObject({
|
|
20321
20792
|
/** The freshest observation the door holds, never narrowed by the read's session filter because it is the door's single latest statement of the account's quota; absent while no rate_limit_event has been filed at all. */
|
|
20322
20793
|
latest: RcLiveRateLimitSchema.optional(),
|
|
20323
20794
|
/** One observation per session whose stream has filed a rate_limit_event this door generation. */
|
|
20324
|
-
sessions:
|
|
20795
|
+
sessions: z37.readonly(z37.array(RcLiveRateLimitSchema))
|
|
20325
20796
|
});
|
|
20326
|
-
var FrontDoorSessionStatusSchema =
|
|
20327
|
-
pid:
|
|
20328
|
-
startedAt:
|
|
20329
|
-
alive:
|
|
20797
|
+
var FrontDoorSessionStatusSchema = z37.strictObject({
|
|
20798
|
+
pid: z37.int().positive(),
|
|
20799
|
+
startedAt: z37.number(),
|
|
20800
|
+
alive: z37.boolean()
|
|
20330
20801
|
});
|
|
20331
|
-
var HeadroomSocketTargetSchema =
|
|
20332
|
-
var FrontDoorStatusOutputSchema =
|
|
20802
|
+
var HeadroomSocketTargetSchema = z37.union([z37.strictObject({ socketPath: z37.string() }), z37.strictObject({ refused: z37.string() })]);
|
|
20803
|
+
var FrontDoorStatusOutputSchema = z37.strictObject({
|
|
20333
20804
|
state: FrontDoorStateSchema,
|
|
20334
|
-
supervisorAlive:
|
|
20805
|
+
supervisorAlive: z37.boolean(),
|
|
20335
20806
|
/** The pids of earlier doors that released their addresses and are finishing the connections they carried: running, but not serving anything new. */
|
|
20336
|
-
draining:
|
|
20337
|
-
sessions:
|
|
20807
|
+
draining: z37.readonly(z37.array(z37.number().int().positive())),
|
|
20808
|
+
sessions: z37.readonly(z37.array(FrontDoorSessionStatusSchema)),
|
|
20338
20809
|
headroomSocket: HeadroomSocketTargetSchema.optional(),
|
|
20339
|
-
logPath:
|
|
20340
|
-
logExists:
|
|
20810
|
+
logPath: z37.string(),
|
|
20811
|
+
logExists: z37.boolean()
|
|
20341
20812
|
});
|
|
20342
|
-
var FrontDoorSessionsOutputSchema =
|
|
20343
|
-
var CheckRunInputSchema =
|
|
20344
|
-
path:
|
|
20345
|
-
identity:
|
|
20813
|
+
var FrontDoorSessionsOutputSchema = z37.strictObject({ sessions: z37.readonly(z37.array(FrontDoorSessionStatusSchema)) });
|
|
20814
|
+
var CheckRunInputSchema = z37.strictObject({
|
|
20815
|
+
path: z37.string().min(1),
|
|
20816
|
+
identity: z37.string().min(1).optional()
|
|
20346
20817
|
}).refine((input) => path43.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
|
|
20347
|
-
var PoolPickInputSchema =
|
|
20348
|
-
pool:
|
|
20349
|
-
path:
|
|
20818
|
+
var PoolPickInputSchema = z37.strictObject({
|
|
20819
|
+
pool: z37.string().min(1),
|
|
20820
|
+
path: z37.string().min(1)
|
|
20350
20821
|
}).refine((input) => path43.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
|
|
20351
|
-
var DoctorFindingSchema =
|
|
20352
|
-
section:
|
|
20353
|
-
subject:
|
|
20354
|
-
severity:
|
|
20355
|
-
message:
|
|
20822
|
+
var DoctorFindingSchema = z37.strictObject({
|
|
20823
|
+
section: z37.enum(DOCTOR_SECTIONS),
|
|
20824
|
+
subject: z37.string().optional(),
|
|
20825
|
+
severity: z37.enum(DOCTOR_SEVERITIES),
|
|
20826
|
+
message: z37.string()
|
|
20356
20827
|
});
|
|
20357
|
-
var DoctorRunOutputSchema =
|
|
20828
|
+
var DoctorRunOutputSchema = z37.strictObject({
|
|
20358
20829
|
/** False exactly when any finding is a `fail`; a `warn` never fails the report on its own. */
|
|
20359
|
-
ok:
|
|
20360
|
-
findings:
|
|
20361
|
-
});
|
|
20362
|
-
var FrontDoorRestartOutputSchema =
|
|
20363
|
-
action:
|
|
20364
|
-
previousPid:
|
|
20365
|
-
});
|
|
20366
|
-
var UpdateCheckOutputSchema =
|
|
20367
|
-
current:
|
|
20368
|
-
latest:
|
|
20369
|
-
action:
|
|
20370
|
-
});
|
|
20371
|
-
var CodexSignInSchema =
|
|
20372
|
-
|
|
20373
|
-
|
|
20374
|
-
|
|
20830
|
+
ok: z37.boolean(),
|
|
20831
|
+
findings: z37.readonly(z37.array(DoctorFindingSchema))
|
|
20832
|
+
});
|
|
20833
|
+
var FrontDoorRestartOutputSchema = z37.strictObject({
|
|
20834
|
+
action: z37.literal("restarting"),
|
|
20835
|
+
previousPid: z37.int().positive()
|
|
20836
|
+
});
|
|
20837
|
+
var UpdateCheckOutputSchema = z37.strictObject({
|
|
20838
|
+
current: z37.string(),
|
|
20839
|
+
latest: z37.string(),
|
|
20840
|
+
action: z37.enum(["current", "available", "updated"])
|
|
20841
|
+
});
|
|
20842
|
+
var CodexSignInSchema = z37.discriminatedUnion("state", [
|
|
20843
|
+
z37.strictObject({ state: z37.literal("none") }),
|
|
20844
|
+
z37.strictObject({ state: z37.literal("signed-in"), email: z37.string().optional(), planScope: z37.boolean(), accessTokenExpiresAt: z37.number() }),
|
|
20845
|
+
z37.strictObject({ state: z37.literal("unreadable"), message: z37.string() })
|
|
20375
20846
|
]);
|
|
20376
|
-
var CodexStatusOutputSchema =
|
|
20847
|
+
var CodexStatusOutputSchema = z37.strictObject({
|
|
20377
20848
|
signIn: CodexSignInSchema,
|
|
20378
|
-
codexProviders:
|
|
20849
|
+
codexProviders: z37.readonly(z37.array(z37.string()))
|
|
20379
20850
|
});
|
|
20380
|
-
var CodexLogoutOutputSchema =
|
|
20381
|
-
hadGrant:
|
|
20382
|
-
revoked:
|
|
20851
|
+
var CodexLogoutOutputSchema = z37.strictObject({
|
|
20852
|
+
hadGrant: z37.boolean(),
|
|
20853
|
+
revoked: z37.boolean()
|
|
20383
20854
|
});
|
|
20384
20855
|
|
|
20385
20856
|
// src/frontdoor/codexApi.ts
|
|
@@ -20447,67 +20918,67 @@ init_schema();
|
|
|
20447
20918
|
init_names();
|
|
20448
20919
|
init_keychainLogin();
|
|
20449
20920
|
init_statusline();
|
|
20450
|
-
import { z as
|
|
20451
|
-
var RemovalConfirmationSchema =
|
|
20452
|
-
var CredentialWriteSchema = (targets) =>
|
|
20453
|
-
sources:
|
|
20454
|
-
target:
|
|
20455
|
-
cache:
|
|
20456
|
-
});
|
|
20457
|
-
var CredentialSummarySchema2 =
|
|
20458
|
-
target:
|
|
20459
|
-
sources:
|
|
20460
|
-
|
|
20461
|
-
|
|
20462
|
-
|
|
20463
|
-
|
|
20464
|
-
|
|
20465
|
-
|
|
20466
|
-
|
|
20921
|
+
import { z as z38 } from "zod";
|
|
20922
|
+
var RemovalConfirmationSchema = z38.boolean();
|
|
20923
|
+
var CredentialWriteSchema = (targets) => z38.strictObject({
|
|
20924
|
+
sources: z38.array(RemoteCredentialSourceSchema).min(1).optional(),
|
|
20925
|
+
target: z38.enum(targets).optional(),
|
|
20926
|
+
cache: z38.union([z38.literal(false), CredentialCacheSchema]).optional()
|
|
20927
|
+
});
|
|
20928
|
+
var CredentialSummarySchema2 = z38.strictObject({
|
|
20929
|
+
target: z38.enum(CREDENTIAL_TARGETS),
|
|
20930
|
+
sources: z38.readonly(z38.array(
|
|
20931
|
+
z38.discriminatedUnion("kind", [
|
|
20932
|
+
z38.strictObject({ kind: z38.literal("env"), variable: z38.string() }),
|
|
20933
|
+
z38.strictObject({ kind: z38.literal("file"), path: z38.string() }),
|
|
20934
|
+
z38.strictObject({ kind: z38.literal("command"), program: z38.string() }),
|
|
20935
|
+
z38.strictObject({ kind: z38.literal("op"), reference: z38.string() }),
|
|
20936
|
+
z38.strictObject({ kind: z38.literal("keychain"), service: z38.string(), account: z38.string().optional() }),
|
|
20937
|
+
z38.strictObject({ kind: z38.literal("literal") })
|
|
20467
20938
|
])
|
|
20468
20939
|
)),
|
|
20469
20940
|
cache: CredentialCacheSchema.optional()
|
|
20470
20941
|
});
|
|
20471
|
-
var mutationOutput = (kind, action) =>
|
|
20472
|
-
var storedMutationOutput = (kind, action, value) =>
|
|
20473
|
-
var IdentityValueSchema =
|
|
20474
|
-
name:
|
|
20475
|
-
label:
|
|
20476
|
-
defaultConfigProfile:
|
|
20477
|
-
provider:
|
|
20478
|
-
allowAmbientCredential:
|
|
20942
|
+
var mutationOutput = (kind, action) => z38.strictObject({ action: z38.literal(action), kind: z38.literal(kind), name: z38.string() });
|
|
20943
|
+
var storedMutationOutput = (kind, action, value) => z38.strictObject({ action: z38.literal(action), kind: z38.literal(kind), name: z38.string(), value });
|
|
20944
|
+
var IdentityValueSchema = z38.strictObject({
|
|
20945
|
+
name: z38.string(),
|
|
20946
|
+
label: z38.string().optional(),
|
|
20947
|
+
defaultConfigProfile: z38.string().optional(),
|
|
20948
|
+
provider: z38.string().optional(),
|
|
20949
|
+
allowAmbientCredential: z38.boolean(),
|
|
20479
20950
|
credential: CredentialSummarySchema2.optional(),
|
|
20480
|
-
anchors:
|
|
20951
|
+
anchors: z38.array(AnchorSchema).optional()
|
|
20481
20952
|
});
|
|
20482
20953
|
var ProfileValueSchema = ConfigProfileSchema.omit({ $schema: true });
|
|
20483
|
-
var ProviderValueSchema =
|
|
20484
|
-
name:
|
|
20485
|
-
kind:
|
|
20486
|
-
displayName:
|
|
20487
|
-
baseUrl:
|
|
20954
|
+
var ProviderValueSchema = z38.strictObject({
|
|
20955
|
+
name: z38.string(),
|
|
20956
|
+
kind: z38.enum(PROVIDER_KINDS),
|
|
20957
|
+
displayName: z38.string(),
|
|
20958
|
+
baseUrl: z38.string().optional(),
|
|
20488
20959
|
codex: CodexProviderConfigSchema.optional(),
|
|
20489
20960
|
credential: CredentialSummarySchema2.optional(),
|
|
20490
|
-
env:
|
|
20961
|
+
env: z38.record(z38.string(), z38.string()).optional()
|
|
20491
20962
|
});
|
|
20492
|
-
var ConfigNameInputSchema =
|
|
20493
|
-
var ConfigIdentityAddInputSchema =
|
|
20963
|
+
var ConfigNameInputSchema = z38.strictObject({ name: z38.string().min(1) });
|
|
20964
|
+
var ConfigIdentityAddInputSchema = z38.strictObject({ name: z38.string().min(1), keepKeychainLogin: z38.boolean().optional().describe(KEEP_KEYCHAIN_LOGIN_DESCRIPTION) });
|
|
20494
20965
|
var ConfigIdentityAddOutputSchema = storedMutationOutput("identity", "created", IdentityValueSchema);
|
|
20495
|
-
var ConfigIdentitySetInputSchema =
|
|
20496
|
-
name:
|
|
20966
|
+
var ConfigIdentitySetInputSchema = z38.strictObject({
|
|
20967
|
+
name: z38.string().min(1),
|
|
20497
20968
|
/** The identity's display label; `false` clears it. */
|
|
20498
|
-
label:
|
|
20499
|
-
defaultConfigProfile:
|
|
20969
|
+
label: z38.union([IdentityLabelSchema, z38.literal(false)]).optional(),
|
|
20970
|
+
defaultConfigProfile: z38.union([z38.string().min(1), z38.literal(false)]).optional(),
|
|
20500
20971
|
/** The provider the identity exists for; `false` clears it. */
|
|
20501
|
-
provider:
|
|
20502
|
-
allowAmbientCredential:
|
|
20503
|
-
credential:
|
|
20972
|
+
provider: z38.union([z38.string().min(1), z38.literal(false)]).optional(),
|
|
20973
|
+
allowAmbientCredential: z38.boolean().optional(),
|
|
20974
|
+
credential: z38.union([z38.literal(false), CredentialWriteSchema(CREDENTIAL_TARGETS)]).optional(),
|
|
20504
20975
|
/** `false` removes the anchors; a list replaces them. */
|
|
20505
|
-
anchors:
|
|
20976
|
+
anchors: z38.union([z38.literal(false), z38.array(AnchorSchema).min(1)]).optional()
|
|
20506
20977
|
});
|
|
20507
20978
|
var ConfigIdentitySetOutputSchema = storedMutationOutput("identity", "updated", IdentityValueSchema);
|
|
20508
|
-
var ConfigIdentityRemoveInputSchema =
|
|
20979
|
+
var ConfigIdentityRemoveInputSchema = z38.strictObject({ name: z38.string().min(1), confirm: RemovalConfirmationSchema });
|
|
20509
20980
|
var ConfigIdentityRemoveOutputSchema = mutationOutput("identity", "removed");
|
|
20510
|
-
var ConfigStatuslineSetSchema =
|
|
20981
|
+
var ConfigStatuslineSetSchema = z38.record(z38.string(), z38.unknown()).superRefine((settings, context) => {
|
|
20511
20982
|
for (const key of Object.keys(settings)) {
|
|
20512
20983
|
if (key === STATUSLINE_EXTRA_GROUP || key.startsWith(`${STATUSLINE_EXTRA_GROUP}.`)) {
|
|
20513
20984
|
context.addIssue({ code: "custom", path: [key], message: `a config write through the API cannot set "${key}": the extra segment's command runs a program, so only your own configuration (the global config, a profile you edit yourself, a directory rule or a command-line assignment) may set it` });
|
|
@@ -20515,93 +20986,93 @@ var ConfigStatuslineSetSchema = z37.record(z37.string(), z37.unknown()).superRef
|
|
|
20515
20986
|
}
|
|
20516
20987
|
});
|
|
20517
20988
|
var ConfigIdentityUseOutputSchema = mutationOutput("identity", "selected");
|
|
20518
|
-
var ConfigProfileAddInputSchema =
|
|
20519
|
-
name:
|
|
20520
|
-
extends:
|
|
20521
|
-
description:
|
|
20989
|
+
var ConfigProfileAddInputSchema = z38.strictObject({
|
|
20990
|
+
name: z38.string().min(1),
|
|
20991
|
+
extends: z38.array(z38.string().min(1)).optional(),
|
|
20992
|
+
description: z38.string().optional()
|
|
20522
20993
|
});
|
|
20523
20994
|
var ConfigProfileAddOutputSchema = storedMutationOutput("profile", "created", ProfileValueSchema);
|
|
20524
|
-
var ConfigProfileSetInputSchema =
|
|
20525
|
-
name:
|
|
20526
|
-
category:
|
|
20527
|
-
entry:
|
|
20528
|
-
extends:
|
|
20529
|
-
description:
|
|
20530
|
-
launch:
|
|
20531
|
-
skipPermissions:
|
|
20532
|
-
remoteControl:
|
|
20533
|
-
headroom:
|
|
20534
|
-
trackUsage:
|
|
20535
|
-
provider:
|
|
20536
|
-
claudeVersion:
|
|
20537
|
-
delay:
|
|
20538
|
-
pause:
|
|
20539
|
-
explain:
|
|
20540
|
-
proxyBypass:
|
|
20541
|
-
statusline:
|
|
20995
|
+
var ConfigProfileSetInputSchema = z38.strictObject({
|
|
20996
|
+
name: z38.string().min(1),
|
|
20997
|
+
category: z38.record(z38.string(), z38.boolean()).optional(),
|
|
20998
|
+
entry: z38.record(z38.string(), z38.boolean()).optional(),
|
|
20999
|
+
extends: z38.union([z38.array(z38.string().min(1)), z38.literal(false)]).optional(),
|
|
21000
|
+
description: z38.union([z38.string(), z38.literal(false)]).optional(),
|
|
21001
|
+
launch: z38.strictObject({
|
|
21002
|
+
skipPermissions: z38.boolean().optional(),
|
|
21003
|
+
remoteControl: z38.boolean().optional(),
|
|
21004
|
+
headroom: z38.boolean().optional(),
|
|
21005
|
+
trackUsage: z38.boolean().optional(),
|
|
21006
|
+
provider: z38.union([z38.string().min(1), z38.literal(false)]).optional(),
|
|
21007
|
+
claudeVersion: z38.union([z38.string().min(1), z38.literal(false)]).optional(),
|
|
21008
|
+
delay: z38.union([z38.string().regex(DURATION_RE), z38.literal(false)]).optional(),
|
|
21009
|
+
pause: z38.boolean().optional(),
|
|
21010
|
+
explain: z38.boolean().optional(),
|
|
21011
|
+
proxyBypass: z38.union([z38.array(z38.string().min(1)), z38.literal(false)]).optional(),
|
|
21012
|
+
statusline: z38.strictObject({
|
|
20542
21013
|
set: ConfigStatuslineSetSchema.optional(),
|
|
20543
|
-
unset:
|
|
21014
|
+
unset: z38.array(z38.string()).optional()
|
|
20544
21015
|
}).optional()
|
|
20545
21016
|
}).optional()
|
|
20546
21017
|
});
|
|
20547
21018
|
var ConfigProfileSetOutputSchema = storedMutationOutput("profile", "updated", ProfileValueSchema);
|
|
20548
|
-
var ConfigProfileRemoveInputSchema =
|
|
21019
|
+
var ConfigProfileRemoveInputSchema = z38.strictObject({ name: z38.string().min(1), confirm: RemovalConfirmationSchema });
|
|
20549
21020
|
var ConfigProfileRemoveOutputSchema = mutationOutput("profile", "removed");
|
|
20550
21021
|
var ConfigProfileUseOutputSchema = mutationOutput("profile", "selected");
|
|
20551
|
-
var PoolMembersInputSchema =
|
|
20552
|
-
var ConfigPoolAddInputSchema =
|
|
20553
|
-
name:
|
|
21022
|
+
var PoolMembersInputSchema = z38.array(z38.string().min(1)).min(1);
|
|
21023
|
+
var ConfigPoolAddInputSchema = z38.strictObject({
|
|
21024
|
+
name: z38.string().min(1),
|
|
20554
21025
|
identities: PoolMembersInputSchema,
|
|
20555
|
-
preference:
|
|
20556
|
-
resumeOnLimit:
|
|
20557
|
-
compactBeforeLimit:
|
|
21026
|
+
preference: z38.enum(POOL_PREFERENCES).optional(),
|
|
21027
|
+
resumeOnLimit: z38.boolean().optional(),
|
|
21028
|
+
compactBeforeLimit: z38.boolean().optional(),
|
|
20558
21029
|
compactAtUtilisation: CompactAtUtilisationSchema.optional()
|
|
20559
21030
|
});
|
|
20560
21031
|
var ConfigPoolAddOutputSchema = storedMutationOutput("pool", "created", PoolSchema);
|
|
20561
|
-
var ConfigPoolSetInputSchema =
|
|
20562
|
-
name:
|
|
21032
|
+
var ConfigPoolSetInputSchema = z38.strictObject({
|
|
21033
|
+
name: z38.string().min(1),
|
|
20563
21034
|
identities: PoolMembersInputSchema.optional(),
|
|
20564
|
-
preference:
|
|
20565
|
-
resumeOnLimit:
|
|
20566
|
-
compactBeforeLimit:
|
|
20567
|
-
compactAtUtilisation:
|
|
21035
|
+
preference: z38.union([z38.enum(POOL_PREFERENCES), z38.literal(false)]).optional(),
|
|
21036
|
+
resumeOnLimit: z38.boolean().optional(),
|
|
21037
|
+
compactBeforeLimit: z38.boolean().optional(),
|
|
21038
|
+
compactAtUtilisation: z38.union([CompactAtUtilisationSchema, z38.literal(false)]).optional()
|
|
20568
21039
|
});
|
|
20569
21040
|
var ConfigPoolSetOutputSchema = storedMutationOutput("pool", "updated", PoolSchema);
|
|
20570
|
-
var ConfigPoolRemoveInputSchema =
|
|
21041
|
+
var ConfigPoolRemoveInputSchema = z38.strictObject({ name: z38.string().min(1), confirm: RemovalConfirmationSchema });
|
|
20571
21042
|
var ConfigPoolRemoveOutputSchema = mutationOutput("pool", "removed");
|
|
20572
21043
|
var ConfigPoolUseOutputSchema = mutationOutput("pool", "selected");
|
|
20573
|
-
var ConfigProviderAddInputSchema =
|
|
20574
|
-
name:
|
|
20575
|
-
kind:
|
|
20576
|
-
displayName:
|
|
20577
|
-
baseUrl:
|
|
21044
|
+
var ConfigProviderAddInputSchema = z38.strictObject({
|
|
21045
|
+
name: z38.string().min(1),
|
|
21046
|
+
kind: z38.enum(PROVIDER_KINDS).optional(),
|
|
21047
|
+
displayName: z38.string().min(1),
|
|
21048
|
+
baseUrl: z38.string().min(1).optional(),
|
|
20578
21049
|
credential: CredentialWriteSchema(PROVIDER_CREDENTIAL_TARGETS).required({ sources: true }),
|
|
20579
21050
|
codex: CodexProviderConfigSchema.optional()
|
|
20580
21051
|
});
|
|
20581
21052
|
var ConfigProviderAddOutputSchema = storedMutationOutput("provider", "created", ProviderValueSchema);
|
|
20582
|
-
var ConfigProviderSetInputSchema =
|
|
20583
|
-
name:
|
|
20584
|
-
displayName:
|
|
20585
|
-
baseUrl:
|
|
21053
|
+
var ConfigProviderSetInputSchema = z38.strictObject({
|
|
21054
|
+
name: z38.string().min(1),
|
|
21055
|
+
displayName: z38.string().min(1).optional(),
|
|
21056
|
+
baseUrl: z38.string().min(1).optional(),
|
|
20586
21057
|
credential: CredentialWriteSchema(PROVIDER_CREDENTIAL_TARGETS).optional(),
|
|
20587
21058
|
codex: CodexProviderConfigSchema.optional()
|
|
20588
21059
|
});
|
|
20589
21060
|
var ConfigProviderSetOutputSchema = storedMutationOutput("provider", "updated", ProviderValueSchema);
|
|
20590
|
-
var ConfigProviderRemoveInputSchema =
|
|
21061
|
+
var ConfigProviderRemoveInputSchema = z38.strictObject({ name: z38.string().min(1), confirm: RemovalConfirmationSchema });
|
|
20591
21062
|
var ConfigProviderRemoveOutputSchema = mutationOutput("provider", "removed");
|
|
20592
|
-
var ConfigRuleAddInputSchema =
|
|
20593
|
-
path:
|
|
20594
|
-
configProfile:
|
|
20595
|
-
identity:
|
|
21063
|
+
var ConfigRuleAddInputSchema = z38.strictObject({
|
|
21064
|
+
path: z38.string().min(1),
|
|
21065
|
+
configProfile: z38.string().min(1).optional(),
|
|
21066
|
+
identity: z38.string().min(1).optional()
|
|
20596
21067
|
});
|
|
20597
21068
|
var ConfigRuleAddOutputSchema = storedMutationOutput("rule", "created", DirectoryRuleSchema);
|
|
20598
|
-
var ConfigRuleSetInputSchema =
|
|
20599
|
-
path:
|
|
20600
|
-
configProfile:
|
|
20601
|
-
identity:
|
|
21069
|
+
var ConfigRuleSetInputSchema = z38.strictObject({
|
|
21070
|
+
path: z38.string().min(1),
|
|
21071
|
+
configProfile: z38.union([z38.string().min(1), z38.literal(false)]).optional(),
|
|
21072
|
+
identity: z38.union([z38.string().min(1), z38.literal(false)]).optional()
|
|
20602
21073
|
});
|
|
20603
21074
|
var ConfigRuleSetOutputSchema = storedMutationOutput("rule", "updated", DirectoryRuleSchema);
|
|
20604
|
-
var ConfigRuleRemoveInputSchema =
|
|
21075
|
+
var ConfigRuleRemoveInputSchema = z38.strictObject({ path: z38.string().min(1), confirm: RemovalConfirmationSchema });
|
|
20605
21076
|
var ConfigRuleRemoveOutputSchema = mutationOutput("rule", "removed");
|
|
20606
21077
|
|
|
20607
21078
|
// src/frontdoor/configApi.ts
|
|
@@ -20954,50 +21425,50 @@ import { eventIterator as eventIterator2, withEventMeta as withEventMeta2 } from
|
|
|
20954
21425
|
|
|
20955
21426
|
// src/frontdoor/eventSchemas.ts
|
|
20956
21427
|
init_schema2();
|
|
20957
|
-
import { z as
|
|
21428
|
+
import { z as z39 } from "zod";
|
|
20958
21429
|
var DOOR_EVENT_SOURCE_RC = "rc";
|
|
20959
21430
|
var LAUNCH_EVENT_SOURCE = "launch";
|
|
20960
21431
|
var USAGE_EVENT_SOURCE = "usage";
|
|
20961
21432
|
var DOOR_HEALTH_EVENT_SOURCE = "door";
|
|
20962
21433
|
var QUOTA_EXPIRING_EVENT_SOURCE = "quota-expiring";
|
|
20963
|
-
var DoorEventSchema =
|
|
20964
|
-
source:
|
|
21434
|
+
var DoorEventSchema = z39.strictObject({
|
|
21435
|
+
source: z39.string().min(1),
|
|
20965
21436
|
/** A positive integer because the backbone's counters start at one and only ever increase. */
|
|
20966
|
-
sequence:
|
|
20967
|
-
payload:
|
|
20968
|
-
});
|
|
20969
|
-
var DoorEventSourceQuerySchema =
|
|
20970
|
-
sources:
|
|
20971
|
-
});
|
|
20972
|
-
var LaunchLifecycleEventSchema =
|
|
20973
|
-
kind:
|
|
20974
|
-
pid:
|
|
20975
|
-
startedAt:
|
|
20976
|
-
observedAt:
|
|
20977
|
-
});
|
|
20978
|
-
var DoorHealthEventSchema =
|
|
20979
|
-
|
|
20980
|
-
|
|
20981
|
-
|
|
20982
|
-
|
|
20983
|
-
|
|
20984
|
-
|
|
21437
|
+
sequence: z39.number().int().positive(),
|
|
21438
|
+
payload: z39.unknown()
|
|
21439
|
+
});
|
|
21440
|
+
var DoorEventSourceQuerySchema = z39.strictObject({
|
|
21441
|
+
sources: z39.array(z39.string().min(1)).min(1).optional()
|
|
21442
|
+
});
|
|
21443
|
+
var LaunchLifecycleEventSchema = z39.strictObject({
|
|
21444
|
+
kind: z39.enum(["registered", "pruned", "ended"]),
|
|
21445
|
+
pid: z39.number().int().positive(),
|
|
21446
|
+
startedAt: z39.number(),
|
|
21447
|
+
observedAt: z39.number()
|
|
21448
|
+
});
|
|
21449
|
+
var DoorHealthEventSchema = z39.discriminatedUnion("kind", [
|
|
21450
|
+
z39.strictObject({ kind: z39.literal("generation"), pid: z39.number().int().positive(), providerPort: z39.number().int().positive(), connectPort: z39.number().int().positive(), directPort: z39.number().int().positive(), observedAt: z39.number() }),
|
|
21451
|
+
z39.strictObject({ kind: z39.literal("listenerFailed"), pid: z39.number().int().positive(), listener: z39.enum(["provider", "connect", "direct"]), message: z39.string(), observedAt: z39.number() }),
|
|
21452
|
+
z39.strictObject({ kind: z39.literal("binaryTurnover"), pid: z39.number().int().positive(), observedAt: z39.number() }),
|
|
21453
|
+
z39.strictObject({ kind: z39.literal("idleShutdown"), pid: z39.number().int().positive(), observedAt: z39.number() }),
|
|
21454
|
+
z39.strictObject({ kind: z39.literal("superseded"), pid: z39.number().int().positive(), ownerPid: z39.number().int().positive(), observedAt: z39.number() }),
|
|
21455
|
+
z39.strictObject({ kind: z39.literal("drained"), pid: z39.number().int().positive(), observedAt: z39.number() })
|
|
20985
21456
|
]);
|
|
20986
|
-
var QuotaExpiringEventSchema =
|
|
21457
|
+
var QuotaExpiringEventSchema = z39.strictObject({
|
|
20987
21458
|
/** The id of the identity whose window it is: what its usage is filed under, which a rename keeps. */
|
|
20988
|
-
id:
|
|
21459
|
+
id: z39.string().min(1),
|
|
20989
21460
|
/** The identity's name when the event was published, absent for an identity no longer stored under the id. */
|
|
20990
|
-
name:
|
|
20991
|
-
provider:
|
|
20992
|
-
window:
|
|
21461
|
+
name: z39.string().min(1).optional(),
|
|
21462
|
+
provider: z39.string().min(1),
|
|
21463
|
+
window: z39.enum(["fiveHour", "sevenDay"]),
|
|
20993
21464
|
/** The fraction of the window already used when it was seen expiring, always below one because a fully used window has nothing left to spend. */
|
|
20994
|
-
utilization:
|
|
20995
|
-
resetsAt:
|
|
20996
|
-
observedAt:
|
|
21465
|
+
utilization: z39.number().min(0).max(1),
|
|
21466
|
+
resetsAt: z39.iso.datetime(),
|
|
21467
|
+
observedAt: z39.number()
|
|
20997
21468
|
});
|
|
20998
21469
|
var UsageChangeEventSchema = UsageSnapshotSchema.extend({
|
|
20999
|
-
id:
|
|
21000
|
-
name:
|
|
21470
|
+
id: z39.string().min(1),
|
|
21471
|
+
name: z39.string().min(1).optional()
|
|
21001
21472
|
});
|
|
21002
21473
|
|
|
21003
21474
|
// src/frontdoor/eventsApi.ts
|
|
@@ -21042,14 +21513,14 @@ function createEventsApiRouter(deps) {
|
|
|
21042
21513
|
init_update();
|
|
21043
21514
|
import { ORPCError as ORPCError4 } from "@orpc/client";
|
|
21044
21515
|
import { openapi as openapi5 } from "@orpc/openapi";
|
|
21045
|
-
import { z as
|
|
21516
|
+
import { z as z40 } from "zod";
|
|
21046
21517
|
var FRONTDOOR_API_TAG = "frontdoor";
|
|
21047
21518
|
var UPDATE_API_TAG = "update";
|
|
21048
21519
|
function createLifecycleApiRouter(deps) {
|
|
21049
21520
|
const authed = doorApiAuth(deps.expectedToken);
|
|
21050
21521
|
return {
|
|
21051
21522
|
frontdoor: {
|
|
21052
|
-
refreshCatalogues: authed.meta(openapi5({ method: "POST", path: "/rest/frontdoor/catalogues/refresh", summary: "Request a catalogue refresh tick", tags: [FRONTDOOR_API_TAG] })).output(
|
|
21523
|
+
refreshCatalogues: authed.meta(openapi5({ method: "POST", path: "/rest/frontdoor/catalogues/refresh", summary: "Request a catalogue refresh tick", tags: [FRONTDOOR_API_TAG] })).output(z40.strictObject({ requested: z40.literal(true) })).handler(() => {
|
|
21053
21524
|
deps.refreshCatalogues();
|
|
21054
21525
|
return { requested: true };
|
|
21055
21526
|
}),
|
|
@@ -21086,62 +21557,62 @@ import { openapi as openapi6 } from "@orpc/openapi";
|
|
|
21086
21557
|
|
|
21087
21558
|
// src/frontdoor/launchSchemas.ts
|
|
21088
21559
|
import path44 from "node:path";
|
|
21089
|
-
import { z as
|
|
21560
|
+
import { z as z41 } from "zod";
|
|
21090
21561
|
init_statusline();
|
|
21091
21562
|
init_claudeVersion();
|
|
21092
21563
|
init_identity();
|
|
21093
|
-
var LaunchResolveInputSchema =
|
|
21094
|
-
path:
|
|
21564
|
+
var LaunchResolveInputSchema = z41.strictObject({
|
|
21565
|
+
path: z41.string().min(1),
|
|
21095
21566
|
/** `@name`, launch flags, then the arguments for `claude`; empty for a bare launch. */
|
|
21096
|
-
argv:
|
|
21567
|
+
argv: z41.readonly(z41.array(z41.string())).optional(),
|
|
21097
21568
|
/** The launch's inherited environment. Absent means an empty one: the door's own environment is never a substitute for the caller's, so a caller that wants `AGENT_SHIM_*` switches or a `CLAUDE_CONFIG_DIR` considered names them here. Values are read, never reported. */
|
|
21098
|
-
env:
|
|
21569
|
+
env: z41.record(z41.string(), z41.string()).optional()
|
|
21099
21570
|
}).refine((input) => path44.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
|
|
21100
|
-
var LaunchPoolDecisionSchema =
|
|
21101
|
-
name:
|
|
21102
|
-
reasons:
|
|
21103
|
-
movedOff:
|
|
21104
|
-
});
|
|
21105
|
-
var LaunchDecisionSchema =
|
|
21106
|
-
identity:
|
|
21107
|
-
identityId:
|
|
21108
|
-
identitySource:
|
|
21571
|
+
var LaunchPoolDecisionSchema = z41.strictObject({
|
|
21572
|
+
name: z41.string(),
|
|
21573
|
+
reasons: z41.readonly(z41.array(z41.string())),
|
|
21574
|
+
movedOff: z41.strictObject({ identity: z41.string(), reason: z41.string() }).optional()
|
|
21575
|
+
});
|
|
21576
|
+
var LaunchDecisionSchema = z41.strictObject({
|
|
21577
|
+
identity: z41.string().optional(),
|
|
21578
|
+
identityId: z41.string().optional(),
|
|
21579
|
+
identitySource: z41.enum(IDENTITY_DECISION_SOURCES),
|
|
21109
21580
|
pool: LaunchPoolDecisionSchema.optional(),
|
|
21110
21581
|
/** True when `CLAUDE_CONFIG_DIR` was already set and nothing on the command line named an identity; an identity named there outranks the variable and leaves it false. */
|
|
21111
|
-
configDirEscapeHatch:
|
|
21112
|
-
configDir:
|
|
21113
|
-
configProfile:
|
|
21114
|
-
configProfileSource:
|
|
21115
|
-
provider:
|
|
21116
|
-
});
|
|
21117
|
-
var LaunchFlagsSchema =
|
|
21118
|
-
skipPermissions:
|
|
21119
|
-
remoteControl:
|
|
21120
|
-
headroom:
|
|
21121
|
-
trackUsage:
|
|
21122
|
-
pause:
|
|
21123
|
-
explain:
|
|
21582
|
+
configDirEscapeHatch: z41.boolean(),
|
|
21583
|
+
configDir: z41.string().optional(),
|
|
21584
|
+
configProfile: z41.string().optional(),
|
|
21585
|
+
configProfileSource: z41.enum(CONFIG_PROFILE_DECISION_SOURCES),
|
|
21586
|
+
provider: z41.string().optional()
|
|
21587
|
+
});
|
|
21588
|
+
var LaunchFlagsSchema = z41.strictObject({
|
|
21589
|
+
skipPermissions: z41.boolean(),
|
|
21590
|
+
remoteControl: z41.boolean(),
|
|
21591
|
+
headroom: z41.boolean(),
|
|
21592
|
+
trackUsage: z41.boolean(),
|
|
21593
|
+
pause: z41.boolean(),
|
|
21594
|
+
explain: z41.boolean(),
|
|
21124
21595
|
/** How long the launch waits after its own output before it starts claude, in milliseconds. */
|
|
21125
|
-
delayMs:
|
|
21596
|
+
delayMs: z41.number(),
|
|
21126
21597
|
/** The hosts the launch keeps off the front door by adding them to the child's `NO_PROXY`. */
|
|
21127
|
-
proxyBypass:
|
|
21598
|
+
proxyBypass: z41.array(z41.string()).readonly(),
|
|
21128
21599
|
/** How the session's built-in statusline looks, when the launch configures any of it. */
|
|
21129
21600
|
statusline: StatuslineSchema.optional()
|
|
21130
21601
|
});
|
|
21131
|
-
var LaunchResolveOutputSchema =
|
|
21602
|
+
var LaunchResolveOutputSchema = z41.strictObject({
|
|
21132
21603
|
decision: LaunchDecisionSchema,
|
|
21133
21604
|
flags: LaunchFlagsSchema,
|
|
21134
|
-
claudeVersion:
|
|
21605
|
+
claudeVersion: z41.strictObject({ version: z41.string(), source: z41.enum(CLAUDE_VERSION_SOURCES) }).optional(),
|
|
21135
21606
|
/** The real `claude` binary the launch would spawn, on the door's host. */
|
|
21136
|
-
bin:
|
|
21607
|
+
bin: z41.string(),
|
|
21137
21608
|
/** The arguments the launch would pass it: the tool's own flags, then `CLAUDE_EXTRA_FLAGS`, then the caller's own. */
|
|
21138
|
-
args:
|
|
21609
|
+
args: z41.readonly(z41.array(z41.string())),
|
|
21139
21610
|
/** The credential the launch would authenticate with, by target and source kinds. Absent when none applies. */
|
|
21140
|
-
credential:
|
|
21141
|
-
routing:
|
|
21611
|
+
credential: z41.strictObject({ subject: z41.enum(["provider", "identity"]), name: z41.string(), summary: CredentialSummarySchema }).optional(),
|
|
21612
|
+
routing: z41.strictObject({ frontDoor: z41.boolean(), headroom: z41.boolean() }),
|
|
21142
21613
|
/** The names of the environment variables the launch would set or unset, sorted. Values are not reported. */
|
|
21143
|
-
environment:
|
|
21144
|
-
warnings:
|
|
21614
|
+
environment: z41.readonly(z41.array(z41.string())),
|
|
21615
|
+
warnings: z41.readonly(z41.array(z41.string()))
|
|
21145
21616
|
});
|
|
21146
21617
|
|
|
21147
21618
|
// src/frontdoor/launchApi.ts
|
|
@@ -21177,22 +21648,22 @@ function createLaunchApiRouter(deps) {
|
|
|
21177
21648
|
// src/frontdoor/agentTreesApi.ts
|
|
21178
21649
|
import { ORPCError as ORPCError6 } from "@orpc/client";
|
|
21179
21650
|
import { openapi as openapi7 } from "@orpc/openapi";
|
|
21180
|
-
import { z as
|
|
21651
|
+
import { z as z42 } from "zod";
|
|
21181
21652
|
init_cliError();
|
|
21182
|
-
var AgentTreesListInputSchema =
|
|
21653
|
+
var AgentTreesListInputSchema = z42.strictObject({
|
|
21183
21654
|
/** Only this identity's sessions. */
|
|
21184
|
-
identity:
|
|
21655
|
+
identity: z42.string().optional(),
|
|
21185
21656
|
/** Include sessions that spawned no agent and ran no workflow. */
|
|
21186
|
-
all:
|
|
21657
|
+
all: z42.boolean().optional()
|
|
21187
21658
|
});
|
|
21188
|
-
var AgentTreesListOutputSchema =
|
|
21189
|
-
var AgentTreesShowInputSchema =
|
|
21659
|
+
var AgentTreesListOutputSchema = z42.array(SessionSummarySchema);
|
|
21660
|
+
var AgentTreesShowInputSchema = z42.strictObject({
|
|
21190
21661
|
/** A session id, or an unambiguous prefix of one. */
|
|
21191
|
-
session:
|
|
21662
|
+
session: z42.string().min(1),
|
|
21192
21663
|
/** Look only in this identity. */
|
|
21193
|
-
identity:
|
|
21664
|
+
identity: z42.string().optional()
|
|
21194
21665
|
});
|
|
21195
|
-
var AgentTreesShowOutputSchema =
|
|
21666
|
+
var AgentTreesShowOutputSchema = z42.strictObject({ identities: z42.array(z42.string()), ...MergedAgentTreeSchema.shape });
|
|
21196
21667
|
function asBadRequest(error) {
|
|
21197
21668
|
if (error instanceof CliError) {
|
|
21198
21669
|
throw new ORPCError6("BAD_REQUEST", { message: error.message });
|
|
@@ -21245,7 +21716,7 @@ import { openapi as openapi8 } from "@orpc/openapi";
|
|
|
21245
21716
|
import { eventIterator as eventIterator3, withEventMeta as withEventMeta3 } from "@orpc/server";
|
|
21246
21717
|
|
|
21247
21718
|
// src/frontdoor/rcEventLog.ts
|
|
21248
|
-
import { z as
|
|
21719
|
+
import { z as z43 } from "zod";
|
|
21249
21720
|
|
|
21250
21721
|
// src/frontdoor/eventHub.ts
|
|
21251
21722
|
var DOOR_EVENT_BUFFER_EVENTS = 100;
|
|
@@ -21368,46 +21839,46 @@ var NUMBER_FIELDS = ["at", "sequence"].length;
|
|
|
21368
21839
|
var BYTES_PER_CODE_UNIT = Uint16Array.BYTES_PER_ELEMENT;
|
|
21369
21840
|
var RC_SESSION_END_REASONS = ["expired", "archived", "conflict"];
|
|
21370
21841
|
var RC_PENDING_RETIRE_REASONS = ["answered", "expired", "session-ended"];
|
|
21371
|
-
var transitionBase = { session:
|
|
21372
|
-
var cursorFields = { cursor:
|
|
21373
|
-
var sessionAppearedShape = { kind:
|
|
21374
|
-
var sessionEndedShape = { kind:
|
|
21375
|
-
var workerStateShape = { kind:
|
|
21376
|
-
var pendingBornShape = { kind:
|
|
21377
|
-
var pendingRetiredShape = { kind:
|
|
21378
|
-
var RcSessionTransitionSchema =
|
|
21379
|
-
|
|
21380
|
-
|
|
21381
|
-
|
|
21382
|
-
|
|
21383
|
-
|
|
21842
|
+
var transitionBase = { session: z43.string(), at: z43.number() };
|
|
21843
|
+
var cursorFields = { cursor: z43.string(), sequence: z43.int().positive() };
|
|
21844
|
+
var sessionAppearedShape = { kind: z43.literal("session-appeared"), ...transitionBase };
|
|
21845
|
+
var sessionEndedShape = { kind: z43.literal("session-ended"), reason: z43.enum(RC_SESSION_END_REASONS), ...transitionBase };
|
|
21846
|
+
var workerStateShape = { kind: z43.literal("worker-state"), state: z43.string(), previous: z43.string().optional(), ...transitionBase };
|
|
21847
|
+
var pendingBornShape = { kind: z43.literal("pending-born"), requestId: z43.string(), type: z43.string(), summary: z43.string(), ...transitionBase };
|
|
21848
|
+
var pendingRetiredShape = { kind: z43.literal("pending-retired"), requestId: z43.string(), reason: z43.enum(RC_PENDING_RETIRE_REASONS), ...transitionBase };
|
|
21849
|
+
var RcSessionTransitionSchema = z43.discriminatedUnion("kind", [
|
|
21850
|
+
z43.strictObject(sessionAppearedShape),
|
|
21851
|
+
z43.strictObject(sessionEndedShape),
|
|
21852
|
+
z43.strictObject(workerStateShape),
|
|
21853
|
+
z43.strictObject(pendingBornShape),
|
|
21854
|
+
z43.strictObject(pendingRetiredShape)
|
|
21384
21855
|
]);
|
|
21385
21856
|
var KIND_MAX_CHARS = Math.max(...RcSessionTransitionSchema.options.map((option) => option.shape.kind.value.length));
|
|
21386
21857
|
var RC_SESSION_EVENT_MAX_BYTES = (RC_SESSION_EVENT_GENERATION_MAX_CHARS + ".".length + SEQUENCE_MAX_DIGITS + RC_SESSION_EVENT_TOKEN_MAX_CHARS + KIND_MAX_CHARS + RC_SESSION_EVENT_TOKEN_MAX_CHARS + RC_SESSION_EVENT_TOKEN_MAX_CHARS + RC_SESSION_EVENT_SUMMARY_MAX_CHARS) * BYTES_PER_CODE_UNIT + NUMBER_FIELDS * NUMBER_BYTES;
|
|
21387
21858
|
var RC_SESSION_EVENT_LOG_CAPACITY = Math.floor(CONTROL_BODY_CAP_BYTES / RC_SESSION_EVENT_MAX_BYTES);
|
|
21388
|
-
var RcSessionEventSchema =
|
|
21389
|
-
|
|
21390
|
-
|
|
21391
|
-
|
|
21392
|
-
|
|
21393
|
-
|
|
21859
|
+
var RcSessionEventSchema = z43.discriminatedUnion("kind", [
|
|
21860
|
+
z43.strictObject({ ...cursorFields, ...sessionAppearedShape }),
|
|
21861
|
+
z43.strictObject({ ...cursorFields, ...sessionEndedShape }),
|
|
21862
|
+
z43.strictObject({ ...cursorFields, ...workerStateShape }),
|
|
21863
|
+
z43.strictObject({ ...cursorFields, ...pendingBornShape }),
|
|
21864
|
+
z43.strictObject({ ...cursorFields, ...pendingRetiredShape })
|
|
21394
21865
|
]);
|
|
21395
|
-
var RcSessionEventsReadInputSchema =
|
|
21866
|
+
var RcSessionEventsReadInputSchema = z43.strictObject({
|
|
21396
21867
|
/** The cursor of the last event the caller saw; every retained event when omitted. */
|
|
21397
|
-
since:
|
|
21868
|
+
since: z43.string().min(1).optional(),
|
|
21398
21869
|
/** One `cse_` session id; every session when omitted. */
|
|
21399
|
-
session:
|
|
21870
|
+
session: z43.string().min(1).optional(),
|
|
21400
21871
|
/** The most events one answer carries; every event after `since` when omitted. */
|
|
21401
|
-
limit:
|
|
21872
|
+
limit: z43.int().positive().optional()
|
|
21402
21873
|
});
|
|
21403
21874
|
var RcSessionEventsPageInputSchema = RcSessionEventsReadInputSchema.extend({
|
|
21404
21875
|
/** The most events this page carries: by default and at most, the bound the door's event backbone already holds per slow consumer (`DOOR_EVENT_BUFFER_EVENTS`, oRPC's own documented default for that case). A page lands whole in its reader, so a reader receives at most one consumer buffer's worth at a time (at worst `DOOR_EVENT_BUFFER_EVENTS` times `RC_SESSION_EVENT_MAX_BYTES`) and pages on with the cursor for more; a maximum of the whole window would let one page carry the log's entire memory budget into an agent's context. */
|
|
21405
|
-
limit:
|
|
21876
|
+
limit: z43.int().positive().max(DOOR_EVENT_BUFFER_EVENTS).default(DOOR_EVENT_BUFFER_EVENTS)
|
|
21406
21877
|
});
|
|
21407
21878
|
var RcSessionEventsStreamInputSchema = RcSessionEventsReadInputSchema.omit({ limit: true });
|
|
21408
|
-
var RcSessionEventsReadOutputSchema =
|
|
21409
|
-
|
|
21410
|
-
|
|
21879
|
+
var RcSessionEventsReadOutputSchema = z43.discriminatedUnion("status", [
|
|
21880
|
+
z43.strictObject({ status: z43.literal("ok"), events: z43.readonly(z43.array(RcSessionEventSchema)), cursor: z43.string(), more: z43.boolean(), head: z43.string() }),
|
|
21881
|
+
z43.strictObject({ status: z43.literal("expired"), message: z43.string(), head: z43.string() })
|
|
21411
21882
|
]);
|
|
21412
21883
|
var CURSOR_SEPARATOR = ".";
|
|
21413
21884
|
var RESYNC_ADVICE = "cursor expired, resync from status: read `rc status` for every session's present state, then resume after the head this answer names";
|
|
@@ -21906,15 +22377,15 @@ function createQuotaExpiringPublisher(hub, deps) {
|
|
|
21906
22377
|
|
|
21907
22378
|
// src/frontdoor/rcLiveUsage.ts
|
|
21908
22379
|
var RC_RATE_LIMIT_EVENT_TYPE = "rate_limit_event";
|
|
21909
|
-
function
|
|
22380
|
+
function isRecord9(value) {
|
|
21910
22381
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
21911
22382
|
}
|
|
21912
22383
|
function rcRateLimitInfoOf(event) {
|
|
21913
22384
|
const payload = event.envelope.payload;
|
|
21914
|
-
if (!
|
|
22385
|
+
if (!isRecord9(payload) || payload.type !== RC_RATE_LIMIT_EVENT_TYPE) {
|
|
21915
22386
|
return void 0;
|
|
21916
22387
|
}
|
|
21917
|
-
if (!
|
|
22388
|
+
if (!isRecord9(payload.rate_limit_info)) {
|
|
21918
22389
|
return void 0;
|
|
21919
22390
|
}
|
|
21920
22391
|
const parsed = RcRateLimitInfoSchema.safeParse(payload.rate_limit_info);
|
|
@@ -22002,7 +22473,7 @@ function createSseParser() {
|
|
|
22002
22473
|
}
|
|
22003
22474
|
};
|
|
22004
22475
|
}
|
|
22005
|
-
function
|
|
22476
|
+
function isRecord10(value) {
|
|
22006
22477
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22007
22478
|
}
|
|
22008
22479
|
function sequenceNumOf(value) {
|
|
@@ -22024,7 +22495,7 @@ function parseRcStreamEnvelope(parsed) {
|
|
|
22024
22495
|
} catch {
|
|
22025
22496
|
return void 0;
|
|
22026
22497
|
}
|
|
22027
|
-
if (!
|
|
22498
|
+
if (!isRecord10(data)) {
|
|
22028
22499
|
return void 0;
|
|
22029
22500
|
}
|
|
22030
22501
|
const eventType = data.event_type;
|
|
@@ -22271,7 +22742,13 @@ init_capability();
|
|
|
22271
22742
|
// src/frontdoor/rcSelfHostEndpoints.ts
|
|
22272
22743
|
var RC_SOURCE_WORKER = "worker";
|
|
22273
22744
|
var RC_SOURCE_CLIENT = "client";
|
|
22274
|
-
|
|
22745
|
+
var CLIENT_PLATFORM_HEADER = "anthropic-client-platform";
|
|
22746
|
+
function withClientPlatform(payload, headers) {
|
|
22747
|
+
const rest = Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "client_platform"));
|
|
22748
|
+
const platform = headers[CLIENT_PLATFORM_HEADER];
|
|
22749
|
+
return typeof platform === "string" && platform !== "" ? { ...rest, client_platform: platform } : rest;
|
|
22750
|
+
}
|
|
22751
|
+
function isRecord11(value) {
|
|
22275
22752
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22276
22753
|
}
|
|
22277
22754
|
function parseJsonObject2(body) {
|
|
@@ -22281,7 +22758,7 @@ function parseJsonObject2(body) {
|
|
|
22281
22758
|
} catch {
|
|
22282
22759
|
return void 0;
|
|
22283
22760
|
}
|
|
22284
|
-
return
|
|
22761
|
+
return isRecord11(parsed) ? parsed : void 0;
|
|
22285
22762
|
}
|
|
22286
22763
|
function nonEmptyString2(record, field) {
|
|
22287
22764
|
const value = record === void 0 ? void 0 : record[field];
|
|
@@ -22355,11 +22832,11 @@ async function serveRcClientChannels(ctx, tail, method, maxBatchEvents) {
|
|
|
22355
22832
|
}
|
|
22356
22833
|
const results = [];
|
|
22357
22834
|
for (const event of events) {
|
|
22358
|
-
if (!
|
|
22835
|
+
if (!isRecord11(event) || !isRecord11(event.payload)) {
|
|
22359
22836
|
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" } });
|
|
22360
22837
|
return true;
|
|
22361
22838
|
}
|
|
22362
|
-
const published = ctx.publish(host.conversation, host.writer, RC_SOURCE_CLIENT, event.payload);
|
|
22839
|
+
const published = ctx.publish(host.conversation, host.writer, RC_SOURCE_CLIENT, withClientPlatform(event.payload, request4.headers));
|
|
22363
22840
|
results.push({ sequence_num: String(published.sequenceNum), duplicate: published.duplicate });
|
|
22364
22841
|
}
|
|
22365
22842
|
ctx.sweep();
|
|
@@ -22455,7 +22932,7 @@ async function serveRcCompatSessions(ctx, pathname, compatPath) {
|
|
|
22455
22932
|
// src/frontdoor/rcSelfHostConversations.ts
|
|
22456
22933
|
var RC_CONVERSATIONS_PATH_PREFIX = "/v1/code/conversations";
|
|
22457
22934
|
var RC_CONVERSATION_ID_PREFIX = "conv_";
|
|
22458
|
-
function
|
|
22935
|
+
function isRecord12(value) {
|
|
22459
22936
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22460
22937
|
}
|
|
22461
22938
|
function parseJsonObject3(body) {
|
|
@@ -22465,7 +22942,7 @@ function parseJsonObject3(body) {
|
|
|
22465
22942
|
} catch {
|
|
22466
22943
|
return void 0;
|
|
22467
22944
|
}
|
|
22468
|
-
return
|
|
22945
|
+
return isRecord12(parsed) ? parsed : void 0;
|
|
22469
22946
|
}
|
|
22470
22947
|
function nonEmptyString3(record, field) {
|
|
22471
22948
|
const value = record === void 0 ? void 0 : record[field];
|
|
@@ -22519,11 +22996,11 @@ async function serveRcConversations(ctx, pathname, method) {
|
|
|
22519
22996
|
}
|
|
22520
22997
|
const results = [];
|
|
22521
22998
|
for (const event of events) {
|
|
22522
|
-
if (!
|
|
22999
|
+
if (!isRecord12(event) || !isRecord12(event.payload)) {
|
|
22523
23000
|
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" } });
|
|
22524
23001
|
return;
|
|
22525
23002
|
}
|
|
22526
|
-
const published = ctx.publish(conversation, { session: void 0, half: "client" }, RC_SOURCE_CLIENT, event.payload);
|
|
23003
|
+
const published = ctx.publish(conversation, { session: void 0, half: "client" }, RC_SOURCE_CLIENT, withClientPlatform(event.payload, request4.headers));
|
|
22527
23004
|
results.push({ sequence_num: String(published.sequenceNum), duplicate: published.duplicate });
|
|
22528
23005
|
}
|
|
22529
23006
|
ctx.sweep();
|
|
@@ -22551,7 +23028,7 @@ var RC_SELF_HOST_SCOPE_LIST = ["user:profile", "user:inference", "user:sessions:
|
|
|
22551
23028
|
var RC_SELF_HOST_OAUTH_TOKEN_TTL_SECONDS = 3600;
|
|
22552
23029
|
var MS_PER_SECOND6 = 1e3;
|
|
22553
23030
|
var HTTP_SERVICE_UNAVAILABLE = 503;
|
|
22554
|
-
function
|
|
23031
|
+
function isRecord13(value) {
|
|
22555
23032
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22556
23033
|
}
|
|
22557
23034
|
function parseJsonObject4(body) {
|
|
@@ -22561,7 +23038,7 @@ function parseJsonObject4(body) {
|
|
|
22561
23038
|
} catch {
|
|
22562
23039
|
return void 0;
|
|
22563
23040
|
}
|
|
22564
|
-
return
|
|
23041
|
+
return isRecord13(parsed) ? parsed : void 0;
|
|
22565
23042
|
}
|
|
22566
23043
|
function growthBookFeatures() {
|
|
22567
23044
|
return {
|
|
@@ -22915,7 +23392,7 @@ var RC_SELF_HOST_WORKER_EPOCH = 1;
|
|
|
22915
23392
|
var RC_STREAM_EVENT_NAME2 = "client_event";
|
|
22916
23393
|
var CONFLICT_REASON_HEADER2 = "x-ccr-conflict-reason";
|
|
22917
23394
|
var CONFLICT_REASON_EPOCH_STALE = "epoch_stale";
|
|
22918
|
-
function
|
|
23395
|
+
function isRecord14(value) {
|
|
22919
23396
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22920
23397
|
}
|
|
22921
23398
|
function isWebSearchRefusal(value) {
|
|
@@ -22999,7 +23476,7 @@ function parseJsonObject5(body) {
|
|
|
22999
23476
|
} catch {
|
|
23000
23477
|
return void 0;
|
|
23001
23478
|
}
|
|
23002
|
-
return
|
|
23479
|
+
return isRecord14(parsed) ? parsed : void 0;
|
|
23003
23480
|
}
|
|
23004
23481
|
function mintWorkerJwt(randomToken, issuedAt) {
|
|
23005
23482
|
const encode = (value) => Buffer.from(JSON.stringify(value), "utf8").toString("base64url");
|
|
@@ -23259,7 +23736,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
23259
23736
|
if (status !== void 0) {
|
|
23260
23737
|
session.workerStatus = status;
|
|
23261
23738
|
}
|
|
23262
|
-
if (
|
|
23739
|
+
if (isRecord14(body?.external_metadata)) {
|
|
23263
23740
|
session.externalMetadata = body.external_metadata;
|
|
23264
23741
|
}
|
|
23265
23742
|
await answerJson2(response, HTTP_STATUS.ok, {});
|
|
@@ -23289,7 +23766,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
23289
23766
|
}
|
|
23290
23767
|
const results = [];
|
|
23291
23768
|
for (const event of events) {
|
|
23292
|
-
if (!
|
|
23769
|
+
if (!isRecord14(event) || !isRecord14(event.payload)) {
|
|
23293
23770
|
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" } });
|
|
23294
23771
|
return;
|
|
23295
23772
|
}
|
|
@@ -23322,7 +23799,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
23322
23799
|
return;
|
|
23323
23800
|
}
|
|
23324
23801
|
for (const event of events) {
|
|
23325
|
-
if (
|
|
23802
|
+
if (isRecord14(event)) {
|
|
23326
23803
|
session.internalEvents.push({ eventId: deps.newUuid(), body: event });
|
|
23327
23804
|
}
|
|
23328
23805
|
}
|
|
@@ -23418,11 +23895,11 @@ data: ${JSON.stringify(envelope)}
|
|
|
23418
23895
|
}
|
|
23419
23896
|
const results = [];
|
|
23420
23897
|
for (const event of events) {
|
|
23421
|
-
if (!
|
|
23898
|
+
if (!isRecord14(event) || !isRecord14(event.payload)) {
|
|
23422
23899
|
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" } });
|
|
23423
23900
|
return;
|
|
23424
23901
|
}
|
|
23425
|
-
const published = publish(session.conversation, { session: session.id, half: "client" }, RC_SOURCE_CLIENT, event.payload);
|
|
23902
|
+
const published = publish(session.conversation, { session: session.id, half: "client" }, RC_SOURCE_CLIENT, withClientPlatform(event.payload, request4.headers));
|
|
23426
23903
|
results.push({ sequence_num: String(published.sequenceNum), duplicate: published.duplicate });
|
|
23427
23904
|
}
|
|
23428
23905
|
sweep();
|
|
@@ -23556,7 +24033,7 @@ var RC_SELF_HOST_RECORD_DIR = "rc-selfhost";
|
|
|
23556
24033
|
var RC_SELF_HOST_RECORD_FILE = "credential.json";
|
|
23557
24034
|
var SELF_HOST_EMAIL = "selfhost@agent-shim.invalid";
|
|
23558
24035
|
var SELF_HOST_SUBSCRIPTION_TYPE = "max";
|
|
23559
|
-
function
|
|
24036
|
+
function isRecord15(value) {
|
|
23560
24037
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23561
24038
|
}
|
|
23562
24039
|
function readJsonObject(fs17, file) {
|
|
@@ -23570,7 +24047,7 @@ function readJsonObject(fs17, file) {
|
|
|
23570
24047
|
} catch {
|
|
23571
24048
|
return void 0;
|
|
23572
24049
|
}
|
|
23573
|
-
return
|
|
24050
|
+
return isRecord15(parsed) ? parsed : void 0;
|
|
23574
24051
|
}
|
|
23575
24052
|
function readRcSelfHostRecord(fs17, frontdoorDir) {
|
|
23576
24053
|
const parsed = readJsonObject(fs17, path45.join(frontdoorDir, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE));
|
|
@@ -23598,7 +24075,7 @@ function mintRcSelfHostCredential(deps) {
|
|
|
23598
24075
|
const recordFile2 = path45.join(recordDir, RC_SELF_HOST_RECORD_FILE);
|
|
23599
24076
|
const previousRecord = readRcSelfHostRecord(deps.fs, deps.frontdoorDir);
|
|
23600
24077
|
const existingCredentials = readJsonObject(deps.fs, credentialsFile);
|
|
23601
|
-
const existingOauth =
|
|
24078
|
+
const existingOauth = isRecord15(existingCredentials?.claudeAiOauth) ? existingCredentials.claudeAiOauth : void 0;
|
|
23602
24079
|
const existingToken = typeof existingOauth?.accessToken === "string" && existingOauth.accessToken !== "" ? existingOauth.accessToken : void 0;
|
|
23603
24080
|
const existingIsOwn = existingToken !== void 0 && previousRecord?.accessToken === existingToken;
|
|
23604
24081
|
if (existingToken !== void 0 && !existingIsOwn && !deps.force) {
|
|
@@ -23615,7 +24092,7 @@ function mintRcSelfHostCredential(deps) {
|
|
|
23615
24092
|
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)}
|
|
23616
24093
|
`);
|
|
23617
24094
|
const claudeJson = readJsonObject(deps.fs, claudeJsonFile) ?? {};
|
|
23618
|
-
const existingBlock = (value) =>
|
|
24095
|
+
const existingBlock = (value) => isRecord15(value) ? value : {};
|
|
23619
24096
|
deps.fs.writeFilePrivate(claudeJsonFile, `${JSON.stringify({
|
|
23620
24097
|
...claudeJson,
|
|
23621
24098
|
oauthAccount: {
|
|
@@ -23738,7 +24215,7 @@ init_poolPick();
|
|
|
23738
24215
|
|
|
23739
24216
|
// src/agents/read.ts
|
|
23740
24217
|
import path47 from "node:path";
|
|
23741
|
-
import { z as
|
|
24218
|
+
import { z as z44 } from "zod";
|
|
23742
24219
|
var PROJECTS_DIR = "projects";
|
|
23743
24220
|
var TASKS_DIR = "tasks";
|
|
23744
24221
|
var SUBAGENTS_DIR = "subagents";
|
|
@@ -23857,14 +24334,14 @@ function parseJson2(text) {
|
|
|
23857
24334
|
return void 0;
|
|
23858
24335
|
}
|
|
23859
24336
|
}
|
|
23860
|
-
var TaskFileSchema =
|
|
23861
|
-
var WorkflowRunFileSchema =
|
|
23862
|
-
runId:
|
|
23863
|
-
workflowName:
|
|
23864
|
-
status:
|
|
23865
|
-
startTime:
|
|
23866
|
-
phases:
|
|
23867
|
-
summary:
|
|
24337
|
+
var TaskFileSchema = z44.object({ ...TaskItemSchema.omit({ taskList: true }).shape, blocks: z44.array(z44.string()).default([]), blockedBy: z44.array(z44.string()).default([]) });
|
|
24338
|
+
var WorkflowRunFileSchema = z44.object({
|
|
24339
|
+
runId: z44.string(),
|
|
24340
|
+
workflowName: z44.string().optional(),
|
|
24341
|
+
status: z44.string().optional(),
|
|
24342
|
+
startTime: z44.number().optional(),
|
|
24343
|
+
phases: z44.array(z44.object({ title: z44.string() })).default([]),
|
|
24344
|
+
summary: z44.string().optional()
|
|
23868
24345
|
});
|
|
23869
24346
|
function summariseSession(fs17, configDir, ref) {
|
|
23870
24347
|
const sessionRelative = path47.join(PROJECTS_DIR, ref.project, ref.entry);
|
|
@@ -24368,6 +24845,8 @@ export {
|
|
|
24368
24845
|
QUOTA_EXPIRING_EVENT_SOURCE,
|
|
24369
24846
|
QuotaExpiringEventSchema,
|
|
24370
24847
|
RC_CONTEXT_USAGE_DETAILS,
|
|
24848
|
+
RC_GOAL_CLEAR_WORDS,
|
|
24849
|
+
RC_GOAL_CONDITION_MAX_CHARS,
|
|
24371
24850
|
RC_IDLE_EXPIRY_MS,
|
|
24372
24851
|
RC_ORPC_PATH_PREFIX,
|
|
24373
24852
|
RC_PENDING_DEADLINE_MS,
|
|
@@ -24383,6 +24862,8 @@ export {
|
|
|
24383
24862
|
RC_SELF_HOST_SCOPE_LIST,
|
|
24384
24863
|
RC_SELF_HOST_WORKER_JWT_TTL_SECONDS,
|
|
24385
24864
|
RC_SESSIONS_PATH_PREFIX,
|
|
24865
|
+
RC_SESSION_COMMAND_MAX_WAIT_MS,
|
|
24866
|
+
RC_SESSION_COMMAND_VERIFIED_VERSIONS,
|
|
24386
24867
|
RC_SESSION_END_REASONS,
|
|
24387
24868
|
RC_SESSION_EVENT_LOG_CAPACITY,
|
|
24388
24869
|
RC_STREAM_BACKOFF_MS,
|
|
@@ -24478,11 +24959,13 @@ export {
|
|
|
24478
24959
|
createQuotaExpiringPublisher,
|
|
24479
24960
|
createRcApiNodeHandler,
|
|
24480
24961
|
createRcApiRouter,
|
|
24962
|
+
createRcClaudeCodeVersions,
|
|
24481
24963
|
createRcControlHandler,
|
|
24482
24964
|
createRcCredentialStore,
|
|
24483
24965
|
createRcEventFanout,
|
|
24484
24966
|
createRcLiveUsage,
|
|
24485
24967
|
createRcSelfHostSurface,
|
|
24968
|
+
createRcSessionCommands,
|
|
24486
24969
|
createRcSessionEventLog,
|
|
24487
24970
|
createRcSessionEventsApiRouter,
|
|
24488
24971
|
createRcSessionRegistryReader,
|
|
@@ -24545,6 +25028,7 @@ export {
|
|
|
24545
25028
|
mintRcSelfHostCredential,
|
|
24546
25029
|
observingRoutedRoute,
|
|
24547
25030
|
parseConnectTarget,
|
|
25031
|
+
parseRcGoalOutput,
|
|
24548
25032
|
parseRcStreamEnvelope,
|
|
24549
25033
|
planOf,
|
|
24550
25034
|
poolIdentities,
|
|
@@ -24556,6 +25040,8 @@ export {
|
|
|
24556
25040
|
rankPool,
|
|
24557
25041
|
rcEventWriteResultFromAnswer,
|
|
24558
25042
|
rcFanoutOnDoorHub,
|
|
25043
|
+
rcLocalCommandAnswerOf,
|
|
25044
|
+
rcManualCompactBoundaryOf,
|
|
24559
25045
|
rcObserverAsPassthrough,
|
|
24560
25046
|
rcRateLimitInfoOf,
|
|
24561
25047
|
rcSelfHostFromEnv,
|