@cmmd-center/forge 0.10.14 → 0.10.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.cjs +241 -107
- package/dist/bin.mjs +265 -131
- package/dist/client/assets/{DiffPanel-Bnkifxef.js → DiffPanel-CniKcSxk.js} +2 -2
- package/dist/client/assets/{DiffPanel.logic-Bk4d9mRT.js → DiffPanel.logic-UU4xEJJO.js} +2 -2
- package/dist/client/assets/DiffPanelShell-BpK-LVcn.js +2531 -0
- package/dist/client/assets/{DiffWorkerPoolProvider-BO-u17g1.js → DiffWorkerPoolProvider-B6dAKEIU.js} +2 -2
- package/dist/client/assets/{PullRequestCodePanel-Bbuxcu5g.js → PullRequestCodePanel-DHZ0dDeb.js} +2 -2
- package/dist/client/assets/{Virtualizer-BxZHsCOD.js → Virtualizer-BaXfuCj_.js} +2 -2
- package/dist/client/assets/{index-BeMh8T3m.js → index-CpaFL0BH.js} +59 -59
- package/dist/client/index.html +4 -4
- package/dist/forge-build.json +1 -1
- package/dist/{open-FIgTDosf.mjs → open-D8mGyWmt.mjs} +3 -3
- package/package.json +1 -1
- package/dist/client/assets/DiffPanelShell-D_nSDbjF.js +0 -2531
package/dist/bin.mjs
CHANGED
|
@@ -22,7 +22,7 @@ import { createCipheriv, createDecipheriv, createHash, createHmac, createPublicK
|
|
|
22
22
|
import * as FS$1 from "node:fs";
|
|
23
23
|
import fs, { accessSync, chmodSync, constants, createReadStream, existsSync, mkdirSync, mkdtempSync, promises, readFile, readFileSync, readdir, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
24
24
|
import * as NodeOS from "node:os";
|
|
25
|
-
import
|
|
25
|
+
import $U, { homedir, networkInterfaces, tmpdir } from "node:os";
|
|
26
26
|
import * as Path$1 from "node:path";
|
|
27
27
|
import path, { basename, delimiter, dirname, extname, isAbsolute, join, posix, relative, resolve, sep } from "node:path";
|
|
28
28
|
import { pathToFileURL } from "node:url";
|
|
@@ -50107,7 +50107,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
50107
50107
|
const min = forceColor || 0;
|
|
50108
50108
|
if (env.TERM === "dumb") return min;
|
|
50109
50109
|
if (process$1.platform === "win32") {
|
|
50110
|
-
const osRelease =
|
|
50110
|
+
const osRelease = $U.release().split(".");
|
|
50111
50111
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
50112
50112
|
return 1;
|
|
50113
50113
|
}
|
|
@@ -52550,7 +52550,7 @@ var require_ProcessDetector = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
52550
52550
|
exports.processDetector = void 0;
|
|
52551
52551
|
const api_1 = (init_esm$1(), __toCommonJS(esm_exports$1));
|
|
52552
52552
|
const semconv_1 = require_semconv$1();
|
|
52553
|
-
const os$
|
|
52553
|
+
const os$3 = __require("os");
|
|
52554
52554
|
/**
|
|
52555
52555
|
* ProcessDetector will be used to detect the resources related current process running
|
|
52556
52556
|
* and being instrumented from the NodeJS Process module.
|
|
@@ -52572,7 +52572,7 @@ var require_ProcessDetector = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
52572
52572
|
};
|
|
52573
52573
|
if (process.argv.length > 1) attributes[semconv_1.ATTR_PROCESS_COMMAND] = process.argv[1];
|
|
52574
52574
|
try {
|
|
52575
|
-
const userInfo = os$
|
|
52575
|
+
const userInfo = os$3.userInfo();
|
|
52576
52576
|
attributes[semconv_1.ATTR_PROCESS_OWNER] = userInfo.username;
|
|
52577
52577
|
} catch (e) {
|
|
52578
52578
|
api_1.diag.debug(`error obtaining process owner: ${e}`);
|
|
@@ -65495,7 +65495,7 @@ function normalizeNumberish(value) {
|
|
|
65495
65495
|
}
|
|
65496
65496
|
//#endregion
|
|
65497
65497
|
//#region package.json
|
|
65498
|
-
var version$1 = "0.10.
|
|
65498
|
+
var version$1 = "0.10.16";
|
|
65499
65499
|
//#endregion
|
|
65500
65500
|
//#region src/sentry.ts
|
|
65501
65501
|
const SERVER_APP_NAME = "forge-server";
|
|
@@ -65968,7 +65968,7 @@ function readCmmdAvatarUrl(raw) {
|
|
|
65968
65968
|
function readTrimmedString$2(value) {
|
|
65969
65969
|
return typeof value === "string" ? value.trim() || null : null;
|
|
65970
65970
|
}
|
|
65971
|
-
function asRecord$
|
|
65971
|
+
function asRecord$14(value) {
|
|
65972
65972
|
return value && typeof value === "object" ? value : null;
|
|
65973
65973
|
}
|
|
65974
65974
|
function readDirectPlanLabelFromRecord(obj) {
|
|
@@ -65980,26 +65980,26 @@ function readNestedPlanLabelFromRecord(obj) {
|
|
|
65980
65980
|
function readCmmdPlanLabel(obj) {
|
|
65981
65981
|
const direct = readDirectPlanLabelFromRecord(obj);
|
|
65982
65982
|
if (direct) return direct;
|
|
65983
|
-
const plan = asRecord$
|
|
65983
|
+
const plan = asRecord$14(obj["plan"]);
|
|
65984
65984
|
if (plan) {
|
|
65985
65985
|
const label = readNestedPlanLabelFromRecord(plan);
|
|
65986
65986
|
if (label) return label;
|
|
65987
65987
|
}
|
|
65988
|
-
const subscription = asRecord$
|
|
65988
|
+
const subscription = asRecord$14(obj["subscription"]);
|
|
65989
65989
|
if (subscription) {
|
|
65990
65990
|
const label = readNestedPlanLabelFromRecord(subscription);
|
|
65991
65991
|
if (label) return label;
|
|
65992
|
-
const subscriptionPlan = asRecord$
|
|
65992
|
+
const subscriptionPlan = asRecord$14(subscription["plan"]);
|
|
65993
65993
|
if (subscriptionPlan) {
|
|
65994
65994
|
const nestedLabel = readNestedPlanLabelFromRecord(subscriptionPlan);
|
|
65995
65995
|
if (nestedLabel) return nestedLabel;
|
|
65996
65996
|
}
|
|
65997
65997
|
}
|
|
65998
|
-
const billing = asRecord$
|
|
65998
|
+
const billing = asRecord$14(obj["billing"]);
|
|
65999
65999
|
if (billing) {
|
|
66000
66000
|
const label = readNestedPlanLabelFromRecord(billing);
|
|
66001
66001
|
if (label) return label;
|
|
66002
|
-
const billingPlan = asRecord$
|
|
66002
|
+
const billingPlan = asRecord$14(billing["plan"]);
|
|
66003
66003
|
if (billingPlan) return readNestedPlanLabelFromRecord(billingPlan);
|
|
66004
66004
|
}
|
|
66005
66005
|
return null;
|
|
@@ -69794,22 +69794,22 @@ const EMPTY_PARSED_ERROR = {
|
|
|
69794
69794
|
message: null,
|
|
69795
69795
|
raw: null
|
|
69796
69796
|
};
|
|
69797
|
-
function asRecord$
|
|
69797
|
+
function asRecord$13(value) {
|
|
69798
69798
|
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
69799
69799
|
}
|
|
69800
69800
|
function readTrimmedString$1(value) {
|
|
69801
69801
|
return (typeof value === "string" ? value.trim() : "") || null;
|
|
69802
69802
|
}
|
|
69803
69803
|
function readErrorEnvelope(record) {
|
|
69804
|
-
return asRecord$
|
|
69804
|
+
return asRecord$13(record["error"]);
|
|
69805
69805
|
}
|
|
69806
69806
|
function readUpstreamErrorCode(body) {
|
|
69807
|
-
const record = asRecord$
|
|
69807
|
+
const record = asRecord$13(body);
|
|
69808
69808
|
if (record === null) return null;
|
|
69809
69809
|
return readTrimmedString$1(record["code"]) ?? readTrimmedString$1(readErrorEnvelope(record)?.["code"]);
|
|
69810
69810
|
}
|
|
69811
69811
|
function readErrorMessage$2(raw) {
|
|
69812
|
-
const record = asRecord$
|
|
69812
|
+
const record = asRecord$13(raw);
|
|
69813
69813
|
if (record === null) return null;
|
|
69814
69814
|
const error = record["error"];
|
|
69815
69815
|
const nestedMessage = readErrorEnvelope(record)?.["message"];
|
|
@@ -71891,7 +71891,7 @@ function readStringJS(length) {
|
|
|
71891
71891
|
if (units.length > 0) result += fromCharCode.apply(String, units);
|
|
71892
71892
|
return result;
|
|
71893
71893
|
}
|
|
71894
|
-
function readString$
|
|
71894
|
+
function readString$5(source, start, length) {
|
|
71895
71895
|
let existingSrc = src;
|
|
71896
71896
|
src = source;
|
|
71897
71897
|
position$1 = start;
|
|
@@ -73756,7 +73756,7 @@ function readStruct(src, position, srcEnd, unpackr) {
|
|
|
73756
73756
|
}
|
|
73757
73757
|
if (end == null) end = source.bytesEnd - refStart;
|
|
73758
73758
|
if (source.srcString) return source.srcString.slice(ref, end);
|
|
73759
|
-
return readString$
|
|
73759
|
+
return readString$5(src, ref + refStart, end - ref);
|
|
73760
73760
|
};
|
|
73761
73761
|
break;
|
|
73762
73762
|
case UTF8:
|
|
@@ -74232,7 +74232,7 @@ var require_node_gyp_build = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
74232
74232
|
var fs$6 = __require("fs");
|
|
74233
74233
|
var path$5 = __require("path");
|
|
74234
74234
|
var url$1 = __require("url");
|
|
74235
|
-
var os$
|
|
74235
|
+
var os$2 = __require("os");
|
|
74236
74236
|
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
74237
74237
|
var vars = process.config && process.config.variables || {};
|
|
74238
74238
|
var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
|
|
@@ -74240,8 +74240,8 @@ var require_node_gyp_build = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
74240
74240
|
var abi = versions.modules;
|
|
74241
74241
|
if (versions.deno || process.isBun) abi = "unsupported";
|
|
74242
74242
|
var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node";
|
|
74243
|
-
var arch = process.env.npm_config_arch || os$
|
|
74244
|
-
var platform = process.env.npm_config_platform || os$
|
|
74243
|
+
var arch = process.env.npm_config_arch || os$2.arch();
|
|
74244
|
+
var platform = process.env.npm_config_platform || os$2.platform();
|
|
74245
74245
|
var libc = process.env.LIBC || (isMusl(platform) ? "musl" : "glibc");
|
|
74246
74246
|
var armv = process.env.ARM_VERSION || (arch === "arm64" ? "8" : vars.arm_version) || "";
|
|
74247
74247
|
var uv = (versions.uv || "").split(".")[0];
|
|
@@ -77105,7 +77105,7 @@ succeed$2(TraceDiagnostics, TraceDiagnostics.of({ read: (options) => succeed(mak
|
|
|
77105
77105
|
* through the server is what lets it ask at all.
|
|
77106
77106
|
*/
|
|
77107
77107
|
const RUNTIMES_PATH = "/api/forge/context/runtimes";
|
|
77108
|
-
function asRecord$
|
|
77108
|
+
function asRecord$12(value) {
|
|
77109
77109
|
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
77110
77110
|
}
|
|
77111
77111
|
/** A trimmed string, or null. Empty and whitespace are the same as absent. */
|
|
@@ -77120,7 +77120,7 @@ function text$1(value) {
|
|
|
77120
77120
|
* something that cannot work.
|
|
77121
77121
|
*/
|
|
77122
77122
|
function toSummary(value) {
|
|
77123
|
-
const row = asRecord$
|
|
77123
|
+
const row = asRecord$12(value);
|
|
77124
77124
|
if (!row) return null;
|
|
77125
77125
|
const runtimeId = text$1(row["runtimeId"]);
|
|
77126
77126
|
const organizationId = row["organizationId"];
|
|
@@ -77144,7 +77144,7 @@ function listCloudRuntimes(input) {
|
|
|
77144
77144
|
return gen(function* () {
|
|
77145
77145
|
const jwt = input.jwt;
|
|
77146
77146
|
if (jwt === null || jwt.trim().length === 0) return yield* fail(new CloudRuntimeListError({ failure: "not_signed_in" }));
|
|
77147
|
-
const runtimes = asRecord$
|
|
77147
|
+
const runtimes = asRecord$12(asRecord$12(yield* tryPromise({
|
|
77148
77148
|
try: () => input.request({
|
|
77149
77149
|
method: "GET",
|
|
77150
77150
|
jwt,
|
|
@@ -91971,7 +91971,7 @@ const launchDetached = (launch) => gen(function* () {
|
|
|
91971
91971
|
});
|
|
91972
91972
|
const OpenLive = effect(Open, gen(function* () {
|
|
91973
91973
|
const open = yield* tryPromise({
|
|
91974
|
-
try: () => import("./open-
|
|
91974
|
+
try: () => import("./open-D8mGyWmt.mjs"),
|
|
91975
91975
|
catch: (cause) => new OpenError$1({
|
|
91976
91976
|
message: "failed to load browser opener",
|
|
91977
91977
|
cause
|
|
@@ -100501,7 +100501,7 @@ const EMPTY_PLAN_VALUES = new Set([
|
|
|
100501
100501
|
"none",
|
|
100502
100502
|
"null"
|
|
100503
100503
|
]);
|
|
100504
|
-
function asRecord$
|
|
100504
|
+
function asRecord$11(value) {
|
|
100505
100505
|
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
100506
100506
|
return value;
|
|
100507
100507
|
}
|
|
@@ -100518,7 +100518,7 @@ function decodeJwtClaims(token) {
|
|
|
100518
100518
|
try {
|
|
100519
100519
|
const decoded = Buffer.from(payload, "base64url");
|
|
100520
100520
|
if (decoded.byteLength > MAX_CLAIMS_BYTES) return void 0;
|
|
100521
|
-
return asRecord$
|
|
100521
|
+
return asRecord$11(JSON.parse(decoded.toString("utf8")));
|
|
100522
100522
|
} catch {
|
|
100523
100523
|
return;
|
|
100524
100524
|
}
|
|
@@ -100540,7 +100540,7 @@ function findPlanType(claims) {
|
|
|
100540
100540
|
const direct = fromRecord(claims);
|
|
100541
100541
|
if (direct) return direct;
|
|
100542
100542
|
for (const value of Object.values(claims)) {
|
|
100543
|
-
const nested = asRecord$
|
|
100543
|
+
const nested = asRecord$11(value);
|
|
100544
100544
|
if (!nested) continue;
|
|
100545
100545
|
const found = fromRecord(nested);
|
|
100546
100546
|
if (found) return found;
|
|
@@ -100557,7 +100557,7 @@ function readCodexAuthIdentity(authJson) {
|
|
|
100557
100557
|
} catch {
|
|
100558
100558
|
return {};
|
|
100559
100559
|
}
|
|
100560
|
-
const claims = decodeJwtClaims(asRecord$
|
|
100560
|
+
const claims = decodeJwtClaims(asRecord$11(asRecord$11(parsed)?.tokens)?.id_token);
|
|
100561
100561
|
if (!claims) return {};
|
|
100562
100562
|
const email = findEmail(claims);
|
|
100563
100563
|
const planType = findPlanType(claims);
|
|
@@ -149004,11 +149004,11 @@ function readObject(value) {
|
|
|
149004
149004
|
function readArray(value) {
|
|
149005
149005
|
return Array.isArray(value) ? value : void 0;
|
|
149006
149006
|
}
|
|
149007
|
-
function readString$
|
|
149007
|
+
function readString$4(value) {
|
|
149008
149008
|
return typeof value === "string" ? value : void 0;
|
|
149009
149009
|
}
|
|
149010
149010
|
function nonEmptyTrimmed$1(value) {
|
|
149011
|
-
const candidate = readString$
|
|
149011
|
+
const candidate = readString$4(value)?.trim();
|
|
149012
149012
|
return candidate ? candidate : void 0;
|
|
149013
149013
|
}
|
|
149014
149014
|
function readBoolean$2(value) {
|
|
@@ -189006,7 +189006,7 @@ var Vce = {
|
|
|
189006
189006
|
function Ve() {
|
|
189007
189007
|
return Vce;
|
|
189008
189008
|
}
|
|
189009
|
-
var Us =
|
|
189009
|
+
var Us = $U.homedir(), lk = $U.tmpdir(), { env: Vc } = process$1, Yce = (e) => {
|
|
189010
189010
|
let t = path.join(Us, "Library");
|
|
189011
189011
|
return {
|
|
189012
189012
|
data: path.join(t, "Application Support", e),
|
|
@@ -199206,12 +199206,12 @@ function qZ(e, t) {
|
|
|
199206
199206
|
}
|
|
199207
199207
|
return n;
|
|
199208
199208
|
}
|
|
199209
|
-
var os$
|
|
199209
|
+
var os$1 = "https://code.claude.com/docs/en", kKe = [
|
|
199210
199210
|
{
|
|
199211
199211
|
matches: (e) => e.path === "permissions.defaultMode" && e.code === "invalid_value",
|
|
199212
199212
|
tip: {
|
|
199213
199213
|
suggestion: "Valid modes: \"acceptEdits\" (ask before file changes), \"plan\" (analysis only), \"bypassPermissions\" (auto-accept all), or \"default\" (standard behavior)",
|
|
199214
|
-
docLink: `${os$
|
|
199214
|
+
docLink: `${os$1}/iam#permission-modes`
|
|
199215
199215
|
}
|
|
199216
199216
|
},
|
|
199217
199217
|
{
|
|
@@ -199226,7 +199226,7 @@ var os$2 = "https://code.claude.com/docs/en", kKe = [
|
|
|
199226
199226
|
matches: (e) => e.path.startsWith("env.") && e.code === "invalid_type",
|
|
199227
199227
|
tip: {
|
|
199228
199228
|
suggestion: "Environment variables must be strings. Wrap numbers and booleans in quotes. Example: \"DEBUG\": \"true\", \"PORT\": \"3000\"",
|
|
199229
|
-
docLink: `${os$
|
|
199229
|
+
docLink: `${os$1}/settings#environment-variables`
|
|
199230
199230
|
}
|
|
199231
199231
|
},
|
|
199232
199232
|
{
|
|
@@ -199237,14 +199237,14 @@ var os$2 = "https://code.claude.com/docs/en", kKe = [
|
|
|
199237
199237
|
matches: (e) => e.path.startsWith("hooks.") && e.code === "invalid_key",
|
|
199238
199238
|
tip: {
|
|
199239
199239
|
suggestion: "Not a recognized hook event. Common events: PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd, Stop. Check spelling and capitalization.",
|
|
199240
|
-
docLink: `${os$
|
|
199240
|
+
docLink: `${os$1}/hooks`
|
|
199241
199241
|
}
|
|
199242
199242
|
},
|
|
199243
199243
|
{
|
|
199244
199244
|
matches: (e) => /\.hooks\.\d+\.command$/.test(e.path) && e.code === "invalid_type" && e.received === "undefined",
|
|
199245
199245
|
tip: {
|
|
199246
199246
|
suggestion: "Command hooks require `command`. For exec form (no shell), set `command` to the executable and `args` to its arguments: {\"type\": \"command\", \"command\": \"echo\", \"args\": [\"hi\"]}. For shell form, set `command` to the full shell string: {\"type\": \"command\", \"command\": \"echo hi\"}.",
|
|
199247
|
-
docLink: `${os$
|
|
199247
|
+
docLink: `${os$1}/hooks#exec-form-and-shell-form`
|
|
199248
199248
|
}
|
|
199249
199249
|
},
|
|
199250
199250
|
{
|
|
@@ -199259,7 +199259,7 @@ var os$2 = "https://code.claude.com/docs/en", kKe = [
|
|
|
199259
199259
|
matches: (e) => e.code === "unrecognized_keys",
|
|
199260
199260
|
tip: {
|
|
199261
199261
|
suggestion: "Check for typos or refer to the documentation for valid fields",
|
|
199262
|
-
docLink: `${os$
|
|
199262
|
+
docLink: `${os$1}/settings`
|
|
199263
199263
|
}
|
|
199264
199264
|
},
|
|
199265
199265
|
{
|
|
@@ -199274,13 +199274,13 @@ var os$2 = "https://code.claude.com/docs/en", kKe = [
|
|
|
199274
199274
|
matches: (e) => e.path === "permissions.additionalDirectories" && e.code === "invalid_type",
|
|
199275
199275
|
tip: {
|
|
199276
199276
|
suggestion: "Must be an array of directory paths. Example: [\"~/projects\", \"/tmp/workspace\"]. You can also use --add-dir flag or /add-dir command",
|
|
199277
|
-
docLink: `${os$
|
|
199277
|
+
docLink: `${os$1}/iam#working-directories`
|
|
199278
199278
|
}
|
|
199279
199279
|
}
|
|
199280
199280
|
], AKe = {
|
|
199281
|
-
permissions: `${os$
|
|
199282
|
-
env: `${os$
|
|
199283
|
-
hooks: `${os$
|
|
199281
|
+
permissions: `${os$1}/iam#configuring-permissions`,
|
|
199282
|
+
env: `${os$1}/settings#environment-variables`,
|
|
199283
|
+
hooks: `${os$1}/hooks`
|
|
199284
199284
|
};
|
|
199285
199285
|
function GZ(e) {
|
|
199286
199286
|
let t = kKe.find((r) => r.matches(e));
|
|
@@ -206523,7 +206523,7 @@ function createCodexBrowserDynamicTools() {
|
|
|
206523
206523
|
function readArgs$3(value) {
|
|
206524
206524
|
return value && typeof value === "object" ? value : {};
|
|
206525
206525
|
}
|
|
206526
|
-
function readString$
|
|
206526
|
+
function readString$3(args, key) {
|
|
206527
206527
|
const value = args[key];
|
|
206528
206528
|
return typeof value === "string" && value.trim().length > 0 ? value : void 0;
|
|
206529
206529
|
}
|
|
@@ -206552,27 +206552,27 @@ function createCodexBrowserDynamicToolHandler(browserManager, options = {}) {
|
|
|
206552
206552
|
const toolScope = options.environmentId === void 0 ? {} : { environmentId: options.environmentId };
|
|
206553
206553
|
const handlers = makeBrowserHandlers(browserManager, ThreadId.make(input.threadId), toolScope);
|
|
206554
206554
|
const args = readArgs$3(input.arguments);
|
|
206555
|
-
const tabId = readString$
|
|
206555
|
+
const tabId = readString$3(args, "tabId");
|
|
206556
206556
|
switch (input.tool) {
|
|
206557
206557
|
case "forge_browser_list_sessions": return toCodexDynamicToolResult$2(await handlers.listSessions());
|
|
206558
206558
|
case "forge_browser_name_session": {
|
|
206559
|
-
const name = readString$
|
|
206559
|
+
const name = readString$3(args, "name");
|
|
206560
206560
|
if (!name) throw new Error("forge_browser_name_session requires a name.");
|
|
206561
206561
|
return toCodexDynamicToolResult$2(await handlers.nameSession(name));
|
|
206562
206562
|
}
|
|
206563
206563
|
case "forge_browser_set_visibility": {
|
|
206564
|
-
const visibility = readString$
|
|
206564
|
+
const visibility = readString$3(args, "visibility");
|
|
206565
206565
|
if (visibility !== "hidden" && visibility !== "visible") throw new Error("forge_browser_set_visibility requires visibility hidden or visible.");
|
|
206566
206566
|
return toCodexDynamicToolResult$2(await handlers.setVisibility(visibility));
|
|
206567
206567
|
}
|
|
206568
206568
|
case "forge_browser_close_session":
|
|
206569
206569
|
case "forge_browser_reset_session": return toCodexDynamicToolResult$2(await handlers.closeSession());
|
|
206570
206570
|
case "forge_browser_navigate": {
|
|
206571
|
-
const url = readString$
|
|
206571
|
+
const url = readString$3(args, "url");
|
|
206572
206572
|
if (!url) throw new Error("forge_browser_navigate requires a URL.");
|
|
206573
206573
|
return toCodexDynamicToolResult$2(await handlers.navigate(url, tabId));
|
|
206574
206574
|
}
|
|
206575
|
-
case "forge_browser_new_tab": return toCodexDynamicToolResult$2(await handlers.newTab(readString$
|
|
206575
|
+
case "forge_browser_new_tab": return toCodexDynamicToolResult$2(await handlers.newTab(readString$3(args, "url")));
|
|
206576
206576
|
case "forge_browser_close_tab":
|
|
206577
206577
|
if (!tabId) throw new Error("forge_browser_close_tab requires a tabId.");
|
|
206578
206578
|
return toCodexDynamicToolResult$2(await handlers.closeTab(tabId));
|
|
@@ -206583,33 +206583,33 @@ function createCodexBrowserDynamicToolHandler(browserManager, options = {}) {
|
|
|
206583
206583
|
case "forge_browser_go_forward": return toCodexDynamicToolResult$2(await handlers.goForward(tabId));
|
|
206584
206584
|
case "forge_browser_reload": return toCodexDynamicToolResult$2(await handlers.reload(tabId));
|
|
206585
206585
|
case "forge_browser_click": {
|
|
206586
|
-
const selector = readString$
|
|
206586
|
+
const selector = readString$3(args, "selector");
|
|
206587
206587
|
if (!selector) throw new Error("forge_browser_click requires a selector.");
|
|
206588
206588
|
return toCodexDynamicToolResult$2(await handlers.click(selector, tabId));
|
|
206589
206589
|
}
|
|
206590
206590
|
case "forge_browser_click_point": {
|
|
206591
206591
|
const x = readNumber$2(args, "x");
|
|
206592
206592
|
const y = readNumber$2(args, "y");
|
|
206593
|
-
const button = readString$
|
|
206593
|
+
const button = readString$3(args, "button");
|
|
206594
206594
|
const clickCount = readNumber$2(args, "clickCount");
|
|
206595
206595
|
if (x === void 0 || y === void 0) throw new Error("forge_browser_click_point requires x and y.");
|
|
206596
206596
|
if (button !== void 0 && button !== "left" && button !== "middle" && button !== "right") throw new Error("forge_browser_click_point requires button left, middle, or right.");
|
|
206597
206597
|
return toCodexDynamicToolResult$2(await handlers.clickPoint(x, y, button, clickCount, tabId));
|
|
206598
206598
|
}
|
|
206599
206599
|
case "forge_browser_type": {
|
|
206600
|
-
const selector = readString$
|
|
206600
|
+
const selector = readString$3(args, "selector");
|
|
206601
206601
|
if (!selector) throw new Error("forge_browser_type requires a selector.");
|
|
206602
|
-
const text = readString$
|
|
206602
|
+
const text = readString$3(args, "text");
|
|
206603
206603
|
if (text === void 0) throw new Error("forge_browser_type requires text.");
|
|
206604
206604
|
return toCodexDynamicToolResult$2(await handlers.type(selector, text, readBoolean$1(args, "append"), tabId));
|
|
206605
206605
|
}
|
|
206606
206606
|
case "forge_browser_type_text": {
|
|
206607
|
-
const text = readString$
|
|
206607
|
+
const text = readString$3(args, "text");
|
|
206608
206608
|
if (text === void 0) throw new Error("forge_browser_type_text requires text.");
|
|
206609
206609
|
return toCodexDynamicToolResult$2(await handlers.typeText(text, readBoolean$1(args, "pressEnter"), tabId));
|
|
206610
206610
|
}
|
|
206611
206611
|
case "forge_browser_press_key": {
|
|
206612
|
-
const key = readString$
|
|
206612
|
+
const key = readString$3(args, "key");
|
|
206613
206613
|
if (!key) throw new Error("forge_browser_press_key requires a key.");
|
|
206614
206614
|
return toCodexDynamicToolResult$2(await handlers.pressKey(key, tabId));
|
|
206615
206615
|
}
|
|
@@ -206923,7 +206923,7 @@ function createCodexComputerDynamicToolHandler(computerManager) {
|
|
|
206923
206923
|
function readArgs$1(value) {
|
|
206924
206924
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
206925
206925
|
}
|
|
206926
|
-
function readString$
|
|
206926
|
+
function readString$2(args, key) {
|
|
206927
206927
|
const value = args[key];
|
|
206928
206928
|
return typeof value === "string" ? value : void 0;
|
|
206929
206929
|
}
|
|
@@ -206943,7 +206943,7 @@ function readStringArray(args, key) {
|
|
|
206943
206943
|
return value.filter((entry) => typeof entry === "string");
|
|
206944
206944
|
}
|
|
206945
206945
|
function readRequiredString(args, key, toolName) {
|
|
206946
|
-
const value = readString$
|
|
206946
|
+
const value = readString$2(args, key)?.trim();
|
|
206947
206947
|
if (!value) throw new Error(`${toolName} requires ${key}.`);
|
|
206948
206948
|
return value;
|
|
206949
206949
|
}
|
|
@@ -206978,7 +206978,7 @@ async function runGitHubLifecycleTool(toolName, context) {
|
|
|
206978
206978
|
action,
|
|
206979
206979
|
args: lifecycleArgs,
|
|
206980
206980
|
mode
|
|
206981
|
-
}), mode === "write" ? readString$
|
|
206981
|
+
}), mode === "write" ? readString$2(args, "confirmationId") : void 0);
|
|
206982
206982
|
}
|
|
206983
206983
|
//#endregion
|
|
206984
206984
|
//#region src/github/GitHubCodexPullRequestTools.ts
|
|
@@ -206988,8 +206988,8 @@ async function runGitHubPullRequestTool(toolName, context) {
|
|
|
206988
206988
|
case "forge_github_create_pull_request": {
|
|
206989
206989
|
const cwd = readRequiredString(args, "cwd", toolName);
|
|
206990
206990
|
const title = readRequiredString(args, "title", toolName);
|
|
206991
|
-
const body = readString$
|
|
206992
|
-
const headBranch = readString$
|
|
206991
|
+
const body = readString$2(args, "body");
|
|
206992
|
+
const headBranch = readString$2(args, "headBranch")?.trim();
|
|
206993
206993
|
if (body === void 0) throw new Error("forge_github_create_pull_request requires body.");
|
|
206994
206994
|
const request = {
|
|
206995
206995
|
cwd,
|
|
@@ -206998,7 +206998,7 @@ async function runGitHubPullRequestTool(toolName, context) {
|
|
|
206998
206998
|
baseBranch: readRequiredString(args, "baseBranch", toolName),
|
|
206999
206999
|
...headBranch ? { headBranch } : {}
|
|
207000
207000
|
};
|
|
207001
|
-
return runTool(request, () => broker.createPullRequest(auth, request), readString$
|
|
207001
|
+
return runTool(request, () => broker.createPullRequest(auth, request), readString$2(args, "confirmationId"));
|
|
207002
207002
|
}
|
|
207003
207003
|
case "forge_github_get_pull_request": {
|
|
207004
207004
|
const cwd = readRequiredString(args, "cwd", toolName);
|
|
@@ -207020,29 +207020,29 @@ function runStatus$1({ auth, broker, runTool }) {
|
|
|
207020
207020
|
return runTool({}, () => broker.status(auth));
|
|
207021
207021
|
}
|
|
207022
207022
|
function runListRepositories({ args, auth, broker, runTool }) {
|
|
207023
|
-
const search = readString$
|
|
207023
|
+
const search = readString$2(args, "search");
|
|
207024
207024
|
return runTool({ search: search ?? null }, () => broker.listRepositories(auth, { search }));
|
|
207025
207025
|
}
|
|
207026
207026
|
function runCloneRepository({ args, auth, broker, runTool }) {
|
|
207027
207027
|
const toolName = "forge_github_clone_repository";
|
|
207028
207028
|
const repoFullName = readRequiredString(args, "repoFullName", toolName);
|
|
207029
207029
|
const destination = readRequiredString(args, "destination", toolName);
|
|
207030
|
-
const branch = readString$
|
|
207030
|
+
const branch = readString$2(args, "branch");
|
|
207031
207031
|
const request = {
|
|
207032
207032
|
repoFullName,
|
|
207033
207033
|
destination,
|
|
207034
207034
|
...branch ? { branch } : {}
|
|
207035
207035
|
};
|
|
207036
|
-
return runTool(request, () => broker.cloneRepository(auth, request), readString$
|
|
207036
|
+
return runTool(request, () => broker.cloneRepository(auth, request), readString$2(args, "confirmationId"));
|
|
207037
207037
|
}
|
|
207038
207038
|
function runCreateRepository({ args, auth, broker, runTool }) {
|
|
207039
207039
|
const toolName = "forge_github_create_repository";
|
|
207040
207040
|
const owner = readRequiredString(args, "owner", toolName);
|
|
207041
207041
|
const name = readRequiredString(args, "name", toolName);
|
|
207042
|
-
const visibility = readString$
|
|
207042
|
+
const visibility = readString$2(args, "visibility");
|
|
207043
207043
|
if (visibility !== void 0 && visibility !== "private" && visibility !== "public") throw new Error("forge_github_create_repository visibility must be private or public.");
|
|
207044
207044
|
const repositoryVisibility = visibility;
|
|
207045
|
-
const description = readString$
|
|
207045
|
+
const description = readString$2(args, "description");
|
|
207046
207046
|
const request = {
|
|
207047
207047
|
owner,
|
|
207048
207048
|
name,
|
|
@@ -207050,32 +207050,32 @@ function runCreateRepository({ args, auth, broker, runTool }) {
|
|
|
207050
207050
|
...repositoryVisibility ? { visibility: repositoryVisibility } : {},
|
|
207051
207051
|
...description !== void 0 ? { description } : {}
|
|
207052
207052
|
};
|
|
207053
|
-
return runTool(request, () => broker.createRepository(auth, request), readString$
|
|
207053
|
+
return runTool(request, () => broker.createRepository(auth, request), readString$2(args, "confirmationId"));
|
|
207054
207054
|
}
|
|
207055
207055
|
function runLinkProjectRepository({ args, auth, broker, runTool }) {
|
|
207056
207056
|
const toolName = "forge_github_link_project_repository";
|
|
207057
207057
|
const cwd = readRequiredString(args, "cwd", toolName);
|
|
207058
207058
|
const repoFullName = readRequiredString(args, "repoFullName", toolName);
|
|
207059
|
-
const branch = readString$
|
|
207059
|
+
const branch = readString$2(args, "branch");
|
|
207060
207060
|
const request = {
|
|
207061
207061
|
cwd,
|
|
207062
207062
|
repoFullName,
|
|
207063
207063
|
...branch ? { branch } : {}
|
|
207064
207064
|
};
|
|
207065
|
-
return runTool(request, () => broker.linkProjectRepository(auth, request), readString$
|
|
207065
|
+
return runTool(request, () => broker.linkProjectRepository(auth, request), readString$2(args, "confirmationId"));
|
|
207066
207066
|
}
|
|
207067
207067
|
function runPushBranch({ args, auth, broker, runTool }) {
|
|
207068
207068
|
const cwd = readRequiredString(args, "cwd", "forge_github_push_branch");
|
|
207069
|
-
const branch = readString$
|
|
207069
|
+
const branch = readString$2(args, "branch");
|
|
207070
207070
|
const request = {
|
|
207071
207071
|
cwd,
|
|
207072
207072
|
...branch ? { branch } : {}
|
|
207073
207073
|
};
|
|
207074
|
-
return runTool(request, () => broker.pushProjectBranch(auth, request), readString$
|
|
207074
|
+
return runTool(request, () => broker.pushProjectBranch(auth, request), readString$2(args, "confirmationId"));
|
|
207075
207075
|
}
|
|
207076
207076
|
function runRefreshCredentials({ args, auth, broker, runTool }) {
|
|
207077
207077
|
const request = { cwd: readRequiredString(args, "cwd", "forge_github_refresh_credentials") };
|
|
207078
|
-
return runTool(request, () => broker.refreshProjectCredentials(auth, request), readString$
|
|
207078
|
+
return runTool(request, () => broker.refreshProjectCredentials(auth, request), readString$2(args, "confirmationId"));
|
|
207079
207079
|
}
|
|
207080
207080
|
const repositoryToolHandlers = {
|
|
207081
207081
|
forge_github_status: runStatus$1,
|
|
@@ -207113,7 +207113,7 @@ async function runGitHubWorkflowTool(toolName, context) {
|
|
|
207113
207113
|
}
|
|
207114
207114
|
function listWorkflowRuns({ args, auth, broker, runTool }) {
|
|
207115
207115
|
const cwd = readRequiredString(args, "cwd", "forge_github_list_workflow_runs");
|
|
207116
|
-
const branch = readString$
|
|
207116
|
+
const branch = readString$2(args, "branch")?.trim();
|
|
207117
207117
|
const limit = readNumber$1(args, "limit");
|
|
207118
207118
|
const request = {
|
|
207119
207119
|
cwd,
|
|
@@ -207132,7 +207132,7 @@ function watchWorkflowRun({ args, auth, broker, runTool }) {
|
|
|
207132
207132
|
}
|
|
207133
207133
|
function getWorkflowRunLogs({ args, auth, broker, runTool }) {
|
|
207134
207134
|
const { cwd, runId } = readWorkflowRunRequest(args, "forge_github_get_workflow_run_logs");
|
|
207135
|
-
const jobId = readString$
|
|
207135
|
+
const jobId = readString$2(args, "jobId")?.trim();
|
|
207136
207136
|
const request = {
|
|
207137
207137
|
cwd,
|
|
207138
207138
|
runId,
|
|
@@ -207142,16 +207142,16 @@ function getWorkflowRunLogs({ args, auth, broker, runTool }) {
|
|
|
207142
207142
|
}
|
|
207143
207143
|
function downloadWorkflowArtifacts({ args, auth, broker, runTool }) {
|
|
207144
207144
|
const cwd = readRequiredString(args, "cwd", "forge_github_download_workflow_artifacts");
|
|
207145
|
-
const runId = readString$
|
|
207146
|
-
const artifactName = readString$
|
|
207147
|
-
const destinationDir = readString$
|
|
207145
|
+
const runId = readString$2(args, "runId")?.trim();
|
|
207146
|
+
const artifactName = readString$2(args, "artifactName")?.trim();
|
|
207147
|
+
const destinationDir = readString$2(args, "destinationDir")?.trim();
|
|
207148
207148
|
const request = {
|
|
207149
207149
|
cwd,
|
|
207150
207150
|
...runId ? { runId } : {},
|
|
207151
207151
|
...artifactName ? { artifactName } : {},
|
|
207152
207152
|
...destinationDir ? { destinationDir } : {}
|
|
207153
207153
|
};
|
|
207154
|
-
return runTool(request, () => broker.downloadWorkflowArtifacts(auth, request), readString$
|
|
207154
|
+
return runTool(request, () => broker.downloadWorkflowArtifacts(auth, request), readString$2(args, "confirmationId"));
|
|
207155
207155
|
}
|
|
207156
207156
|
function listWorkflows({ args, auth, broker, runTool }) {
|
|
207157
207157
|
const cwd = readRequiredString(args, "cwd", "forge_github_list_workflows");
|
|
@@ -207170,7 +207170,7 @@ function getWorkflow({ args, auth, broker, runTool }) {
|
|
|
207170
207170
|
}
|
|
207171
207171
|
function runWorkflow({ args, auth, broker, runTool }) {
|
|
207172
207172
|
const { cwd, workflow } = readWorkflowRequest(args, "forge_github_run_workflow");
|
|
207173
|
-
const ref = readString$
|
|
207173
|
+
const ref = readString$2(args, "ref")?.trim();
|
|
207174
207174
|
const fields = readStringRecord(args, "fields");
|
|
207175
207175
|
const request = {
|
|
207176
207176
|
cwd,
|
|
@@ -207178,7 +207178,7 @@ function runWorkflow({ args, auth, broker, runTool }) {
|
|
|
207178
207178
|
...ref ? { ref } : {},
|
|
207179
207179
|
...fields && Object.keys(fields).length > 0 ? { fields } : {}
|
|
207180
207180
|
};
|
|
207181
|
-
return runTool(request, () => broker.runWorkflow(auth, request), readString$
|
|
207181
|
+
return runTool(request, () => broker.runWorkflow(auth, request), readString$2(args, "confirmationId"));
|
|
207182
207182
|
}
|
|
207183
207183
|
function enableWorkflow(context) {
|
|
207184
207184
|
return runWorkflowToggle("forge_github_enable_workflow", context, "enableWorkflow");
|
|
@@ -207201,12 +207201,12 @@ function readWorkflowRequest(args, toolName) {
|
|
|
207201
207201
|
async function runWorkflowRunMutation(toolName, context, brokerMethod) {
|
|
207202
207202
|
const { args, auth, broker, runTool } = context;
|
|
207203
207203
|
const request = readWorkflowRunRequest(args, toolName);
|
|
207204
|
-
return runTool(request, () => broker[brokerMethod](auth, request), readString$
|
|
207204
|
+
return runTool(request, () => broker[brokerMethod](auth, request), readString$2(args, "confirmationId"));
|
|
207205
207205
|
}
|
|
207206
207206
|
function runWorkflowToggle(toolName, context, brokerMethod) {
|
|
207207
207207
|
const { args, auth, broker, runTool } = context;
|
|
207208
207208
|
const request = readWorkflowRequest(args, toolName);
|
|
207209
|
-
return runTool(request, () => broker[brokerMethod](auth, request), readString$
|
|
207209
|
+
return runTool(request, () => broker[brokerMethod](auth, request), readString$2(args, "confirmationId"));
|
|
207210
207210
|
}
|
|
207211
207211
|
//#endregion
|
|
207212
207212
|
//#region src/github/GitHubCodexWorkspaceGitTools.ts
|
|
@@ -207223,7 +207223,7 @@ async function runWorkspaceGitTool(toolName, context) {
|
|
|
207223
207223
|
case "forge_git_commit": return runCommit("forge_git_commit", context);
|
|
207224
207224
|
case "forge_git_reset_hard": return runResetHard("forge_git_reset_hard", context);
|
|
207225
207225
|
case "forge_git": {
|
|
207226
|
-
const operation = readString$
|
|
207226
|
+
const operation = readString$2(args, "operation")?.trim();
|
|
207227
207227
|
switch (operation) {
|
|
207228
207228
|
case "status": return runStatus(toolName, context, "status");
|
|
207229
207229
|
case "log": return runLog(toolName, context);
|
|
@@ -207252,7 +207252,7 @@ function runLog(toolName, { args, broker, runTool }) {
|
|
|
207252
207252
|
}
|
|
207253
207253
|
function runStash(toolName, { args, broker, runTool }, operation) {
|
|
207254
207254
|
const cwd = readRequiredString(args, "cwd", toolName);
|
|
207255
|
-
const message = readString$
|
|
207255
|
+
const message = readString$2(args, "message")?.trim();
|
|
207256
207256
|
return runTool({
|
|
207257
207257
|
cwd,
|
|
207258
207258
|
...operation ? { operation } : {},
|
|
@@ -207260,12 +207260,12 @@ function runStash(toolName, { args, broker, runTool }, operation) {
|
|
|
207260
207260
|
}, () => broker.stashWorkspace({
|
|
207261
207261
|
cwd,
|
|
207262
207262
|
...message ? { message } : {}
|
|
207263
|
-
}), readString$
|
|
207263
|
+
}), readString$2(args, "confirmationId"));
|
|
207264
207264
|
}
|
|
207265
207265
|
function runCommit(toolName, { args, broker, runTool }, operation) {
|
|
207266
207266
|
const cwd = readRequiredString(args, "cwd", toolName);
|
|
207267
207267
|
const message = readRequiredString(args, "message", operation ? `${toolName} operation=commit` : toolName);
|
|
207268
|
-
const branch = readString$
|
|
207268
|
+
const branch = readString$2(args, "branch")?.trim();
|
|
207269
207269
|
return runTool({
|
|
207270
207270
|
cwd,
|
|
207271
207271
|
...operation ? { operation } : {},
|
|
@@ -207275,11 +207275,11 @@ function runCommit(toolName, { args, broker, runTool }, operation) {
|
|
|
207275
207275
|
cwd,
|
|
207276
207276
|
message,
|
|
207277
207277
|
...branch ? { branch } : {}
|
|
207278
|
-
}), readString$
|
|
207278
|
+
}), readString$2(args, "confirmationId"));
|
|
207279
207279
|
}
|
|
207280
207280
|
function runResetHard(toolName, { args, broker, runTool }, operation) {
|
|
207281
207281
|
const cwd = readRequiredString(args, "cwd", toolName);
|
|
207282
|
-
const ref = readString$
|
|
207282
|
+
const ref = readString$2(args, "ref")?.trim();
|
|
207283
207283
|
return runTool({
|
|
207284
207284
|
cwd,
|
|
207285
207285
|
...operation ? { operation } : {},
|
|
@@ -207287,7 +207287,7 @@ function runResetHard(toolName, { args, broker, runTool }, operation) {
|
|
|
207287
207287
|
}, () => broker.resetWorkspaceHard({
|
|
207288
207288
|
cwd,
|
|
207289
207289
|
...ref ? { ref } : {}
|
|
207290
|
-
}), readString$
|
|
207290
|
+
}), readString$2(args, "confirmationId"));
|
|
207291
207291
|
}
|
|
207292
207292
|
//#endregion
|
|
207293
207293
|
//#region src/github/GitHubCodexToolRunner.ts
|
|
@@ -207921,7 +207921,7 @@ function createCodexGitHubDynamicToolHandler(options = {}) {
|
|
|
207921
207921
|
error: "Forge could not resolve the authenticated user session for this thread. Send a new turn from the Forge UI and retry."
|
|
207922
207922
|
}, false);
|
|
207923
207923
|
const args = readArgs$1(input.arguments);
|
|
207924
|
-
const dispatchOperation = input.tool === "forge_git" ? readString$
|
|
207924
|
+
const dispatchOperation = input.tool === "forge_git" ? readString$2(args, "operation")?.trim() : void 0;
|
|
207925
207925
|
const operation = dispatchOperation ?? operationForTool(input.tool);
|
|
207926
207926
|
const requiresConfirmation = !bypassWriteConfirmation && (isGitHubWriteTool(input.tool) || dispatchOperation !== void 0 && FORGE_GIT_WRITE_OPERATIONS.has(dispatchOperation));
|
|
207927
207927
|
const runTool = async (request, execute, confirmationId) => {
|
|
@@ -208443,7 +208443,7 @@ function createCodexDevServerDynamicTools() {
|
|
|
208443
208443
|
function readArgs(value) {
|
|
208444
208444
|
return value && typeof value === "object" ? value : {};
|
|
208445
208445
|
}
|
|
208446
|
-
function readString(args, key) {
|
|
208446
|
+
function readString$1(args, key) {
|
|
208447
208447
|
const value = args[key];
|
|
208448
208448
|
return typeof value === "string" && value.trim().length > 0 ? value : void 0;
|
|
208449
208449
|
}
|
|
@@ -208456,8 +208456,8 @@ function readBoolean(args, key) {
|
|
|
208456
208456
|
return typeof value === "boolean" ? value : void 0;
|
|
208457
208457
|
}
|
|
208458
208458
|
function runDevServerStart(handlers, args) {
|
|
208459
|
-
const command = readString(args, "command");
|
|
208460
|
-
const cwd = readString(args, "cwd");
|
|
208459
|
+
const command = readString$1(args, "command");
|
|
208460
|
+
const cwd = readString$1(args, "cwd");
|
|
208461
208461
|
const port = readNumber(args, "port");
|
|
208462
208462
|
const readyTimeoutMs = readNumber(args, "readyTimeoutMs");
|
|
208463
208463
|
const openPreview = readBoolean(args, "openPreview");
|
|
@@ -208613,7 +208613,7 @@ function readConnectorParams(tool, args) {
|
|
|
208613
208613
|
switch (tool.tool) {
|
|
208614
208614
|
case "forge_gmail_search": return {
|
|
208615
208615
|
...params,
|
|
208616
|
-
query: readString$
|
|
208616
|
+
query: readString$2(args, "query") ?? ""
|
|
208617
208617
|
};
|
|
208618
208618
|
case "forge_gmail_list_recent": return {
|
|
208619
208619
|
...params,
|
|
@@ -208625,7 +208625,7 @@ function readConnectorParams(tool, args) {
|
|
|
208625
208625
|
}
|
|
208626
208626
|
}
|
|
208627
208627
|
function appendString(target, args, key) {
|
|
208628
|
-
const value = readString$
|
|
208628
|
+
const value = readString$2(args, key);
|
|
208629
208629
|
if (value !== void 0) target[key] = value;
|
|
208630
208630
|
}
|
|
208631
208631
|
function appendNumber(target, args, key) {
|
|
@@ -209214,7 +209214,7 @@ const collectStreamAsString = (stream) => stream.pipe(decodeText$1(), runFold(()
|
|
|
209214
209214
|
//#region src/orchestration/WorkerPlanCodexTools.ts
|
|
209215
209215
|
const FORGE_PROPOSE_WORKER_TASKS_TOOL = "forge_propose_worker_tasks";
|
|
209216
209216
|
const MAX_WORKER_PLAN_ITEMS = 5;
|
|
209217
|
-
function asRecord$
|
|
209217
|
+
function asRecord$10(value) {
|
|
209218
209218
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
209219
209219
|
}
|
|
209220
209220
|
function readTrimmedString(value) {
|
|
@@ -209230,7 +209230,7 @@ function isValidWorkerSummary(value) {
|
|
|
209230
209230
|
return value !== void 0 && value.length > 0 && value.length <= 4e3;
|
|
209231
209231
|
}
|
|
209232
209232
|
function decodeWorkerPlanItem(value) {
|
|
209233
|
-
const item = asRecord$
|
|
209233
|
+
const item = asRecord$10(value);
|
|
209234
209234
|
const slug = readTrimmedString(item?.slug);
|
|
209235
209235
|
const title = readTrimmedString(item?.title);
|
|
209236
209236
|
const summary = readTrimmedString(item?.summary);
|
|
@@ -209294,7 +209294,7 @@ function createWorkerPlanDynamicTools() {
|
|
|
209294
209294
|
function createWorkerPlanDynamicToolHandler() {
|
|
209295
209295
|
return async (input) => {
|
|
209296
209296
|
if (input.tool !== "forge_propose_worker_tasks") throw new Error(`Unsupported worker-plan tool: ${input.tool}`);
|
|
209297
|
-
if (!decodeWorkerPlanItems(asRecord$
|
|
209297
|
+
if (!decodeWorkerPlanItems(asRecord$10(input.arguments)?.items)) throw new Error("Worker plans require one to five unique, fully described items.");
|
|
209298
209298
|
return {
|
|
209299
209299
|
success: true,
|
|
209300
209300
|
contentItems: [{
|
|
@@ -211110,25 +211110,25 @@ const AUTH_METHOD_CONTAINER_KEYS = [
|
|
|
211110
211110
|
/** Lift an unknown value into `Option<string>` if it is a non-empty string. */
|
|
211111
211111
|
const asNonEmptyString = (v) => typeof v === "string" && v.length > 0 ? some(v) : none$4();
|
|
211112
211112
|
/** Lift an unknown value into `Option<Record>` if it is a plain object. */
|
|
211113
|
-
const asRecord$
|
|
211113
|
+
const asRecord$9 = (v) => typeof v === "object" && v !== null && !globalThis.Array.isArray(v) ? some(v) : none$4();
|
|
211114
211114
|
/**
|
|
211115
211115
|
* Walk an unknown parsed JSON value looking for a subscription/plan
|
|
211116
211116
|
* identifier, returning the first match as an `Option`.
|
|
211117
211117
|
*/
|
|
211118
211118
|
function findSubscriptionType(value) {
|
|
211119
211119
|
if (globalThis.Array.isArray(value)) return firstSomeOf(value.map(findSubscriptionType));
|
|
211120
|
-
return asRecord$
|
|
211120
|
+
return asRecord$9(value).pipe(flatMap$2((record) => {
|
|
211121
211121
|
const direct = firstSomeOf(SUBSCRIPTION_TYPE_KEYS.map((key) => asNonEmptyString(record[key])));
|
|
211122
211122
|
if (isSome(direct)) return direct;
|
|
211123
|
-
return firstSomeOf(SUBSCRIPTION_CONTAINER_KEYS.map((key) => asRecord$
|
|
211123
|
+
return firstSomeOf(SUBSCRIPTION_CONTAINER_KEYS.map((key) => asRecord$9(record[key]).pipe(flatMap$2(findSubscriptionType))));
|
|
211124
211124
|
}));
|
|
211125
211125
|
}
|
|
211126
211126
|
function findAuthMethod(value) {
|
|
211127
211127
|
if (globalThis.Array.isArray(value)) return firstSomeOf(value.map(findAuthMethod));
|
|
211128
|
-
return asRecord$
|
|
211128
|
+
return asRecord$9(value).pipe(flatMap$2((record) => {
|
|
211129
211129
|
const direct = firstSomeOf(AUTH_METHOD_KEYS.map((key) => asNonEmptyString(record[key])));
|
|
211130
211130
|
if (isSome(direct)) return direct;
|
|
211131
|
-
return firstSomeOf(AUTH_METHOD_CONTAINER_KEYS.map((key) => asRecord$
|
|
211131
|
+
return firstSomeOf(AUTH_METHOD_CONTAINER_KEYS.map((key) => asRecord$9(record[key]).pipe(flatMap$2(findAuthMethod))));
|
|
211132
211132
|
}));
|
|
211133
211133
|
}
|
|
211134
211134
|
/**
|
|
@@ -212374,7 +212374,7 @@ function userInputQuestionsFromToolInput(toolInput) {
|
|
|
212374
212374
|
return (Array.isArray(toolInput.questions) ? toolInput.questions : []).map((question, idx) => userInputQuestionFromUnknown(question, idx));
|
|
212375
212375
|
}
|
|
212376
212376
|
function userInputQuestionFromUnknown(question, idx) {
|
|
212377
|
-
const value = asRecord$
|
|
212377
|
+
const value = asRecord$8(question) ?? {};
|
|
212378
212378
|
return {
|
|
212379
212379
|
id: typeof value.header === "string" ? value.header : `q-${idx}`,
|
|
212380
212380
|
header: typeof value.header === "string" ? value.header : `Question ${idx + 1}`,
|
|
@@ -212384,13 +212384,13 @@ function userInputQuestionFromUnknown(question, idx) {
|
|
|
212384
212384
|
};
|
|
212385
212385
|
}
|
|
212386
212386
|
function userInputOptionFromUnknown(option) {
|
|
212387
|
-
const value = asRecord$
|
|
212387
|
+
const value = asRecord$8(option) ?? {};
|
|
212388
212388
|
return {
|
|
212389
212389
|
label: typeof value.label === "string" ? value.label : "",
|
|
212390
212390
|
description: typeof value.description === "string" ? value.description : ""
|
|
212391
212391
|
};
|
|
212392
212392
|
}
|
|
212393
|
-
function asRecord$
|
|
212393
|
+
function asRecord$8(value) {
|
|
212394
212394
|
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
212395
212395
|
}
|
|
212396
212396
|
function permissionResultFromDecision(decision, toolInput, suggestions) {
|
|
@@ -213294,7 +213294,7 @@ const makeClaudeAdapter = fn$1("makeClaudeAdapter")(function* (options) {
|
|
|
213294
213294
|
const updateResumeCursor = fn$1("updateResumeCursor")(function* (context) {
|
|
213295
213295
|
const threadId = context.session.threadId;
|
|
213296
213296
|
if (!threadId) return;
|
|
213297
|
-
const providerDeliveryBinding = readProviderDeliveryBinding(asRecord$
|
|
213297
|
+
const providerDeliveryBinding = readProviderDeliveryBinding(asRecord$8(context.session.resumeCursor)?.providerDeliveryBinding);
|
|
213298
213298
|
const resumeCursor = {
|
|
213299
213299
|
threadId,
|
|
213300
213300
|
...context.resumeSessionId ? { resume: context.resumeSessionId } : {},
|
|
@@ -218369,7 +218369,7 @@ function makeAcpContentDeltaEvent(input) {
|
|
|
218369
218369
|
}
|
|
218370
218370
|
//#endregion
|
|
218371
218371
|
//#region ../../packages/shared/src/toolActivity.ts
|
|
218372
|
-
function asRecord$
|
|
218372
|
+
function asRecord$7(value) {
|
|
218373
218373
|
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
218374
218374
|
}
|
|
218375
218375
|
function asTrimmedString(value) {
|
|
@@ -218395,10 +218395,10 @@ function extractCommandFromTitle$1(title) {
|
|
|
218395
218395
|
return /`([^`]+)`/u.exec(title)?.[1]?.trim() || void 0;
|
|
218396
218396
|
}
|
|
218397
218397
|
function extractToolCommand(data, title) {
|
|
218398
|
-
const item = asRecord$
|
|
218399
|
-
const itemInput = asRecord$
|
|
218400
|
-
const itemResult = asRecord$
|
|
218401
|
-
const rawInput = asRecord$
|
|
218398
|
+
const item = asRecord$7(data?.item);
|
|
218399
|
+
const itemInput = asRecord$7(item?.input);
|
|
218400
|
+
const itemResult = asRecord$7(item?.result);
|
|
218401
|
+
const rawInput = asRecord$7(data?.rawInput);
|
|
218402
218402
|
const direct = [
|
|
218403
218403
|
normalizeCommandValue$1(item?.command),
|
|
218404
218404
|
normalizeCommandValue$1(itemInput?.command),
|
|
@@ -218426,7 +218426,7 @@ function collectPaths(value, paths, seen, depth) {
|
|
|
218426
218426
|
}
|
|
218427
218427
|
return;
|
|
218428
218428
|
}
|
|
218429
|
-
const record = asRecord$
|
|
218429
|
+
const record = asRecord$7(value);
|
|
218430
218430
|
if (!record) return;
|
|
218431
218431
|
for (const key of [
|
|
218432
218432
|
"path",
|
|
@@ -218485,7 +218485,7 @@ function deriveToolActivityPresentation(input) {
|
|
|
218485
218485
|
const title = asTrimmedString(input.title);
|
|
218486
218486
|
const detail = stripTrailingExitCode(asTrimmedString(input.detail));
|
|
218487
218487
|
const fallbackSummary = asTrimmedString(input.fallbackSummary) ?? "Tool";
|
|
218488
|
-
const data = asRecord$
|
|
218488
|
+
const data = asRecord$7(input.data);
|
|
218489
218489
|
const command = extractToolCommand(data, title);
|
|
218490
218490
|
const primaryPath = extractPrimaryPath(data);
|
|
218491
218491
|
const action = classifyToolAction({
|
|
@@ -218509,7 +218509,7 @@ function deriveToolActivityPresentation(input) {
|
|
|
218509
218509
|
...primaryPath ? { detail: primaryPath } : {}
|
|
218510
218510
|
};
|
|
218511
218511
|
if (action === "search") {
|
|
218512
|
-
const query = asTrimmedString(asRecord$
|
|
218512
|
+
const query = asTrimmedString(asRecord$7(data?.rawInput)?.query) ?? asTrimmedString(asRecord$7(data?.rawInput)?.pattern) ?? asTrimmedString(asRecord$7(data?.rawInput)?.searchTerm);
|
|
218513
218513
|
return {
|
|
218514
218514
|
summary: "Searched files",
|
|
218515
218515
|
...query ? { detail: query } : {}
|
|
@@ -265212,7 +265212,7 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
|
|
|
265212
265212
|
var dgram = __require("dgram");
|
|
265213
265213
|
var thunky = require_thunky();
|
|
265214
265214
|
var events = __require("events");
|
|
265215
|
-
var os
|
|
265215
|
+
var os = __require("os");
|
|
265216
265216
|
var noop = function() {};
|
|
265217
265217
|
module.exports = function(opts) {
|
|
265218
265218
|
if (!opts) opts = {};
|
|
@@ -265343,14 +265343,14 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
|
|
|
265343
265343
|
return that;
|
|
265344
265344
|
};
|
|
265345
265345
|
function defaultInterface() {
|
|
265346
|
-
var networks = os
|
|
265346
|
+
var networks = os.networkInterfaces();
|
|
265347
265347
|
var names = Object.keys(networks);
|
|
265348
265348
|
for (var i = 0; i < names.length; i++) {
|
|
265349
265349
|
var net = networks[names[i]];
|
|
265350
265350
|
for (var j = 0; j < net.length; j++) {
|
|
265351
265351
|
var iface = net[j];
|
|
265352
265352
|
if (isIPv4(iface.family) && !iface.internal) {
|
|
265353
|
-
if (os
|
|
265353
|
+
if (os.platform() === "darwin" && names[i] === "en0") return iface.address;
|
|
265354
265354
|
return "0.0.0.0";
|
|
265355
265355
|
}
|
|
265356
265356
|
}
|
|
@@ -265358,7 +265358,7 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
|
|
|
265358
265358
|
return "127.0.0.1";
|
|
265359
265359
|
}
|
|
265360
265360
|
function allInterfaces() {
|
|
265361
|
-
var networks = os
|
|
265361
|
+
var networks = os.networkInterfaces();
|
|
265362
265362
|
var names = Object.keys(networks);
|
|
265363
265363
|
var res = [];
|
|
265364
265364
|
for (var i = 0; i < names.length; i++) {
|
|
@@ -285311,7 +285311,7 @@ function makeApprovedWorkerPlanEventState() {
|
|
|
285311
285311
|
function promptKey(masterThreadId, promptId) {
|
|
285312
285312
|
return `${masterThreadId}\n${promptId}`;
|
|
285313
285313
|
}
|
|
285314
|
-
function asRecord$
|
|
285314
|
+
function asRecord$6(value) {
|
|
285315
285315
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
285316
285316
|
}
|
|
285317
285317
|
function exactMaterializedTaskIds(value, expectedCount) {
|
|
@@ -285321,7 +285321,7 @@ function exactMaterializedTaskIds(value, expectedCount) {
|
|
|
285321
285321
|
}
|
|
285322
285322
|
function readyBatchFromActivity(state, event) {
|
|
285323
285323
|
if (event.payload.activity.kind !== "plan.task-creation.batch-succeeded") return null;
|
|
285324
|
-
const payload = asRecord$
|
|
285324
|
+
const payload = asRecord$6(event.payload.activity.payload);
|
|
285325
285325
|
const promptId = payload?.["promptId"];
|
|
285326
285326
|
if (typeof promptId !== "string") return null;
|
|
285327
285327
|
const key = promptKey(event.payload.threadId, promptId);
|
|
@@ -286497,7 +286497,7 @@ function runtimeGrantNeedsRefresh(token, identity, nowSeconds = Math.floor(Date.
|
|
|
286497
286497
|
return claims.expiresAtSeconds - nowSeconds <= RUNTIME_GRANT_REFRESH_SKEW_SECONDS;
|
|
286498
286498
|
}
|
|
286499
286499
|
/** Narrow an unknown to a plain object, or null. */
|
|
286500
|
-
function asRecord$
|
|
286500
|
+
function asRecord$5(value) {
|
|
286501
286501
|
return value !== null && typeof value === "object" ? value : null;
|
|
286502
286502
|
}
|
|
286503
286503
|
/** The raw (untrimmed) string when it is present and not blank, else null. */
|
|
@@ -286509,7 +286509,7 @@ function asTimestamp(value) {
|
|
|
286509
286509
|
return typeof value === "string" && Number.isFinite(Date.parse(value)) ? value : null;
|
|
286510
286510
|
}
|
|
286511
286511
|
function parseRuntimeGrantRefreshResponse(runtimeId, value) {
|
|
286512
|
-
const data = asRecord$
|
|
286512
|
+
const data = asRecord$5(asRecord$5(value)?.data);
|
|
286513
286513
|
if (!data || data.runtimeId !== runtimeId) return null;
|
|
286514
286514
|
const grantToken = asNonBlankString(data.grantToken);
|
|
286515
286515
|
const expiresAt = asTimestamp(data.expiresAt);
|
|
@@ -286570,7 +286570,6 @@ async function refreshRuntimeProvisioningGrant(input) {
|
|
|
286570
286570
|
async function maybeRefreshRuntimeProvisioningGrant(input) {
|
|
286571
286571
|
const current = runtimeGrantToken();
|
|
286572
286572
|
if (!current) return "skipped";
|
|
286573
|
-
if (!runtimeGrantNeedsRefresh(current, input)) return "skipped";
|
|
286574
286573
|
const exactIdentity = exactRuntimeControlIdentity(input);
|
|
286575
286574
|
const currentClaims = currentGrantClaimsForRefresh({
|
|
286576
286575
|
currentGrant: current,
|
|
@@ -286579,6 +286578,11 @@ async function maybeRefreshRuntimeProvisioningGrant(input) {
|
|
|
286579
286578
|
});
|
|
286580
286579
|
if (!currentClaims) throw invalidRefreshResponse("Current runtime provisioning grant is unverifiable.");
|
|
286581
286580
|
const currentAuthorityClass = currentGrantAuthorityClass(currentClaims, exactIdentity);
|
|
286581
|
+
const controlAuthorityMissing = currentAuthorityClass === "exact" && exactIdentity !== null && readRuntimeControlAuthority({
|
|
286582
|
+
runtimeId: input.runtimeId,
|
|
286583
|
+
...exactIdentity
|
|
286584
|
+
}) === null;
|
|
286585
|
+
if (!runtimeGrantNeedsRefresh(current, input) && !controlAuthorityMissing) return "skipped";
|
|
286582
286586
|
const refreshed = await refreshRuntimeProvisioningGrant({
|
|
286583
286587
|
runtimeId: input.runtimeId,
|
|
286584
286588
|
currentGrant: current,
|
|
@@ -293520,7 +293524,7 @@ function resolveBuildCommitFromEnv(env) {
|
|
|
293520
293524
|
* environment descriptor down instead of reporting an honest "unknown".
|
|
293521
293525
|
*/
|
|
293522
293526
|
function readBakedBuildCommit() {
|
|
293523
|
-
return "
|
|
293527
|
+
return "7f0d765bc59cb837f8aa8025b9b2f855df3fd36d";
|
|
293524
293528
|
}
|
|
293525
293529
|
async function resolveServerBuildCommit(input) {
|
|
293526
293530
|
if (isFullCommitSha(input.baked)) return input.baked;
|
|
@@ -302551,7 +302555,7 @@ const LocalAutomationSchedulerLive = effectDiscard(gen(function* () {
|
|
|
302551
302555
|
}));
|
|
302552
302556
|
//#endregion
|
|
302553
302557
|
//#region src/command/providerUsageEnvironment.ts
|
|
302554
|
-
function asRecord$
|
|
302558
|
+
function asRecord$4(value) {
|
|
302555
302559
|
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
302556
302560
|
}
|
|
302557
302561
|
function positiveInteger(value) {
|
|
@@ -302571,7 +302575,7 @@ function readRuntimeId(row) {
|
|
|
302571
302575
|
return typeof runtimeId === "string" && runtimeId.trim() !== "" ? runtimeId : null;
|
|
302572
302576
|
}
|
|
302573
302577
|
function readCandidate(runtime, ownerUserId) {
|
|
302574
|
-
const row = asRecord$
|
|
302578
|
+
const row = asRecord$4(runtime);
|
|
302575
302579
|
if (row === null || !isOwnedRuntime(row, ownerUserId) || row["desiredState"] !== "running") return null;
|
|
302576
302580
|
const organizationId = positiveInteger(row["organizationId"]);
|
|
302577
302581
|
const environmentId = readEnvironmentId(row["environmentId"]);
|
|
@@ -302606,15 +302610,17 @@ function deduplicateCandidates(candidates) {
|
|
|
302606
302610
|
* organization from browser input.
|
|
302607
302611
|
*/
|
|
302608
302612
|
function selectProviderUsageEnvironment(rawCatalog, ownerUserId) {
|
|
302609
|
-
const runtimes = asRecord$
|
|
302613
|
+
const runtimes = asRecord$4(asRecord$4(rawCatalog)?.["data"])?.["runtimes"];
|
|
302610
302614
|
if (!Array.isArray(runtimes)) return { kind: "unavailable" };
|
|
302611
302615
|
const candidates = deduplicateCandidates(runtimes.map((runtime) => readCandidate(runtime, ownerUserId)).filter((candidate) => candidate !== null));
|
|
302612
302616
|
const bestRank = Math.min(...candidates.map((candidate) => statusRank(candidate.status)));
|
|
302613
302617
|
const bestCandidates = candidates.filter((candidate) => statusRank(candidate.status) === bestRank);
|
|
302614
302618
|
if (bestCandidates.length !== 1) return { kind: "unavailable" };
|
|
302619
|
+
const selected = bestCandidates[0];
|
|
302615
302620
|
return {
|
|
302616
302621
|
kind: "ready",
|
|
302617
|
-
organizationId:
|
|
302622
|
+
organizationId: selected.organizationId,
|
|
302623
|
+
runtimeId: selected.runtimeId
|
|
302618
302624
|
};
|
|
302619
302625
|
}
|
|
302620
302626
|
//#endregion
|
|
@@ -302635,13 +302641,22 @@ function selectProviderUsageEnvironment(rawCatalog, ownerUserId) {
|
|
|
302635
302641
|
const FAILURE_TEXT = {
|
|
302636
302642
|
CLAUDE_USAGE_ENVIRONMENT_UNAVAILABLE: "Refresh needs your Environment running.",
|
|
302637
302643
|
CLAUDE_USAGE_CREDENTIAL_NOT_READY: "The Claude credential is not applied to your Environment yet.",
|
|
302644
|
+
CLAUDE_USAGE_CREDENTIAL_APPLY_FAILED: "Your Environment rejected the delivered Claude credential.",
|
|
302645
|
+
CLAUDE_USAGE_CREDENTIAL_REFRESHING: "The delivered Claude credential expired. CMMD is sending a replacement.",
|
|
302638
302646
|
CLAUDE_USAGE_REFRESH_IN_PROGRESS: "A refresh for this account is already running.",
|
|
302639
302647
|
CLAUDE_USAGE_PROBE_FAILED: "Your Environment could not read Claude usage.",
|
|
302640
302648
|
CLAUDE_USAGE_RECONNECT_REQUIRED: "Reconnect this Claude account to refresh usage.",
|
|
302641
302649
|
CLAUDE_USAGE_ACCOUNT_NOT_FOUND: "This Claude account is no longer connected.",
|
|
302642
302650
|
CLAUDE_USAGE_REFRESH_UNAVAILABLE: "Claude usage refresh is unavailable."
|
|
302643
302651
|
};
|
|
302644
|
-
/**
|
|
302652
|
+
/**
|
|
302653
|
+
* Verbatim from CMMD `personal-claude-usage.ts` and `provider-usage-service.ts`.
|
|
302654
|
+
*
|
|
302655
|
+
* Three reasons land on `CLAUDE_USAGE_CREDENTIAL_NOT_READY` because the refresh
|
|
302656
|
+
* response cannot tell them apart. `claudeUsageCredentialReadiness.ts` splits
|
|
302657
|
+
* them afterwards by reading the runtime's readiness, which is the only place
|
|
302658
|
+
* that knows whether a delivery is on its way or has already failed.
|
|
302659
|
+
*/
|
|
302645
302660
|
const CODE_BY_UPSTREAM_REASON = {
|
|
302646
302661
|
runtime_not_active: "CLAUDE_USAGE_ENVIRONMENT_UNAVAILABLE",
|
|
302647
302662
|
claude_native_delivery_disabled: "CLAUDE_USAGE_ENVIRONMENT_UNAVAILABLE",
|
|
@@ -302654,7 +302669,12 @@ const CODE_BY_UPSTREAM_REASON = {
|
|
|
302654
302669
|
usage_receipt_invalid: "CLAUDE_USAGE_PROBE_FAILED",
|
|
302655
302670
|
usage_output_invalid: "CLAUDE_USAGE_PROBE_FAILED"
|
|
302656
302671
|
};
|
|
302657
|
-
|
|
302672
|
+
/**
|
|
302673
|
+
* The one place a failure body is built, so every sentence a browser reads is
|
|
302674
|
+
* written in `FAILURE_TEXT` above. `claudeUsageCredentialReadiness.ts` calls it
|
|
302675
|
+
* to reach the two codes no upstream reason maps to.
|
|
302676
|
+
*/
|
|
302677
|
+
function describeClaudeUsageRefreshFailureCode(code, status) {
|
|
302658
302678
|
return {
|
|
302659
302679
|
status,
|
|
302660
302680
|
body: {
|
|
@@ -302663,6 +302683,9 @@ function failure(code, status) {
|
|
|
302663
302683
|
}
|
|
302664
302684
|
};
|
|
302665
302685
|
}
|
|
302686
|
+
function failure(code, status) {
|
|
302687
|
+
return describeClaudeUsageRefreshFailureCode(code, status);
|
|
302688
|
+
}
|
|
302666
302689
|
/**
|
|
302667
302690
|
* CMMD sends the reason as `{ "error": "<reason>" }`. Anything else, including
|
|
302668
302691
|
* a longer sentence that happens to start with an allowlisted word, is treated
|
|
@@ -302683,6 +302706,77 @@ function describeClaudeUsageRefreshFailure(error) {
|
|
|
302683
302706
|
return failure("CLAUDE_USAGE_REFRESH_UNAVAILABLE", error.status === 503 ? 503 : 502);
|
|
302684
302707
|
}
|
|
302685
302708
|
//#endregion
|
|
302709
|
+
//#region src/command/claudeUsageCredentialReadiness.ts
|
|
302710
|
+
/**
|
|
302711
|
+
* Which "credential not ready" a Claude usage refresh actually hit.
|
|
302712
|
+
*
|
|
302713
|
+
* CMMD answers a blocked refresh with one reason for three different worlds:
|
|
302714
|
+
* a delivery still travelling, a delivery CMMD cannot produce, and a delivery
|
|
302715
|
+
* the Environment already ran and rejected. `claudeUsageRefreshFailure.ts` has
|
|
302716
|
+
* to collapse all three into `CLAUDE_USAGE_CREDENTIAL_NOT_READY`, because the
|
|
302717
|
+
* refresh response carries nothing that separates them. The card then says
|
|
302718
|
+
* "not applied yet", which asks the user to wait even when waiting can never
|
|
302719
|
+
* work: on 2026-09-08 CMMD's reconciler failed native credential validation on
|
|
302720
|
+
* runtime 523cd771 forty-three times in seventy-two minutes, and the card said
|
|
302721
|
+
* "yet" through all of it.
|
|
302722
|
+
*
|
|
302723
|
+
* The runtime readiness read is the one source that separates the worlds, so
|
|
302724
|
+
* the handler makes that read only for the collapsed code and hands the answer
|
|
302725
|
+
* here. Every sentence is written in `claudeUsageRefreshFailure.ts`; nothing
|
|
302726
|
+
* from CMMD's `lastErrorCode` or `lastErrorMessage` is repeated to a browser.
|
|
302727
|
+
*/
|
|
302728
|
+
const CMMD_READINESS_PATH_PREFIX = "/api/forge/context/providers/claude/runtime-readiness/";
|
|
302729
|
+
/** Typed as the gateway's absolute-path shape so the call site needs no cast. */
|
|
302730
|
+
function claudeUsageReadinessPath(runtimeId) {
|
|
302731
|
+
return `${CMMD_READINESS_PATH_PREFIX}${encodeURIComponent(runtimeId)}`;
|
|
302732
|
+
}
|
|
302733
|
+
/**
|
|
302734
|
+
* Whether a readiness read would tell the caller anything it does not know.
|
|
302735
|
+
*
|
|
302736
|
+
* Only the collapsed code is ambiguous. Every other failure already names its
|
|
302737
|
+
* own cause, so asking CMMD again would cost a round trip on the error path
|
|
302738
|
+
* and could only produce a less specific answer.
|
|
302739
|
+
*/
|
|
302740
|
+
function claudeUsageFailureWantsReadiness(failure) {
|
|
302741
|
+
return failure.body.code === "CLAUDE_USAGE_CREDENTIAL_NOT_READY";
|
|
302742
|
+
}
|
|
302743
|
+
function asRecord$3(value) {
|
|
302744
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
302745
|
+
}
|
|
302746
|
+
function readString(value) {
|
|
302747
|
+
return typeof value === "string" && value !== "" ? value : null;
|
|
302748
|
+
}
|
|
302749
|
+
/**
|
|
302750
|
+
* Refines the collapsed credential failure using the runtime's readiness.
|
|
302751
|
+
*
|
|
302752
|
+
* The ranking is by what the user can act on, not by which field looks most
|
|
302753
|
+
* severe:
|
|
302754
|
+
*
|
|
302755
|
+
* 1. A reason of `credential_reconnect_required` or `credential_not_connected`
|
|
302756
|
+
* means CMMD holds no usable grant. That is upstream of delivery, so it wins
|
|
302757
|
+
* even when the delivery it caused also failed. No re-delivery helps; only a
|
|
302758
|
+
* reconnect does.
|
|
302759
|
+
* 2. `deliveryStatus: "failed"` means CMMD had a credential, sent it, and the
|
|
302760
|
+
* Environment rejected it. Waiting cannot fix that, which is exactly what
|
|
302761
|
+
* the collapsed sentence tells the user to do.
|
|
302762
|
+
* 3. `credential_expired_refreshing` means a replacement is already in flight,
|
|
302763
|
+
* so the honest instruction is to retry shortly.
|
|
302764
|
+
*
|
|
302765
|
+
* Anything else, including a readiness read that failed or answered a shape
|
|
302766
|
+
* this module does not recognise, keeps the collapsed failure. A refinement
|
|
302767
|
+
* that guessed would be worse than the vague sentence it replaced.
|
|
302768
|
+
*/
|
|
302769
|
+
function refineClaudeUsageRefreshFailure(failure, rawReadiness) {
|
|
302770
|
+
if (!claudeUsageFailureWantsReadiness(failure)) return failure;
|
|
302771
|
+
const readiness = asRecord$3(asRecord$3(rawReadiness)?.["data"]);
|
|
302772
|
+
if (readiness === null) return failure;
|
|
302773
|
+
const reasonCode = claudeReadinessReasonCode(readString(readiness["reason"]));
|
|
302774
|
+
if (reasonCode === "CREDENTIAL_RECONNECT_REQUIRED") return describeClaudeUsageRefreshFailureCode("CLAUDE_USAGE_RECONNECT_REQUIRED", 409);
|
|
302775
|
+
if (readiness["deliveryStatus"] === "failed") return describeClaudeUsageRefreshFailureCode("CLAUDE_USAGE_CREDENTIAL_APPLY_FAILED", 503);
|
|
302776
|
+
if (reasonCode === "CREDENTIAL_EXPIRED_REFRESHING") return describeClaudeUsageRefreshFailureCode("CLAUDE_USAGE_CREDENTIAL_REFRESHING", 503);
|
|
302777
|
+
return failure;
|
|
302778
|
+
}
|
|
302779
|
+
//#endregion
|
|
302686
302780
|
//#region src/command/wsToken.ts
|
|
302687
302781
|
/**
|
|
302688
302782
|
* Build the WS token response given an optional PAT and the configured CMMD
|
|
@@ -304547,6 +304641,25 @@ function buildClaudeUsageRefreshErrorResponse(error) {
|
|
|
304547
304641
|
const failure = describeClaudeUsageRefreshFailure(error);
|
|
304548
304642
|
return jsonUnsafe(failure.body, { status: failure.status });
|
|
304549
304643
|
}
|
|
304644
|
+
/**
|
|
304645
|
+
* Answers a refresh CMMD refused, asking the selected runtime what state its
|
|
304646
|
+
* Claude credential is in when the refusal alone cannot say. Only the collapsed
|
|
304647
|
+
* credential code costs the extra read, and a readiness read that itself fails
|
|
304648
|
+
* leaves the original answer untouched.
|
|
304649
|
+
*/
|
|
304650
|
+
function answerBlockedClaudeUsageRefresh(input) {
|
|
304651
|
+
return gen(function* () {
|
|
304652
|
+
const failure = describeClaudeUsageRefreshFailure(input.error);
|
|
304653
|
+
if (!claudeUsageFailureWantsReadiness(failure)) return jsonUnsafe(failure.body, { status: failure.status });
|
|
304654
|
+
const readinessOutcome = yield* runCmmdRestProxy(input.session, (jwt) => cmmdGateway.request({
|
|
304655
|
+
method: "GET",
|
|
304656
|
+
jwt,
|
|
304657
|
+
path: claudeUsageReadinessPath(input.runtimeId)
|
|
304658
|
+
}), { jwt: input.requestJwt });
|
|
304659
|
+
const refined = refineClaudeUsageRefreshFailure(failure, readinessOutcome.ok ? readinessOutcome.value : null);
|
|
304660
|
+
return jsonUnsafe(refined.body, { status: refined.status });
|
|
304661
|
+
});
|
|
304662
|
+
}
|
|
304550
304663
|
function makeRefreshProviderUsageHandler(dependencies = {}) {
|
|
304551
304664
|
return gen(function* () {
|
|
304552
304665
|
const request = yield* HttpServerRequest;
|
|
@@ -304583,7 +304696,12 @@ function makeRefreshProviderUsageHandler(dependencies = {}) {
|
|
|
304583
304696
|
body: { providerAccountId: input.providerAccountId },
|
|
304584
304697
|
orgId: String(target.organizationId)
|
|
304585
304698
|
}), { jwt: requestJwt });
|
|
304586
|
-
if (!refreshOutcome.ok) return
|
|
304699
|
+
if (!refreshOutcome.ok) return yield* answerBlockedClaudeUsageRefresh({
|
|
304700
|
+
session,
|
|
304701
|
+
requestJwt,
|
|
304702
|
+
runtimeId: target.runtimeId,
|
|
304703
|
+
error: refreshOutcome.error
|
|
304704
|
+
});
|
|
304587
304705
|
const snapshotOutcome = yield* runCmmdRestProxy(session, (jwt) => cmmdGateway.request({
|
|
304588
304706
|
method: "GET",
|
|
304589
304707
|
jwt,
|
|
@@ -304682,6 +304800,22 @@ registerProxyRoute({
|
|
|
304682
304800
|
responseShape: "unwrapData",
|
|
304683
304801
|
successStatus: 200
|
|
304684
304802
|
});
|
|
304803
|
+
registerProxyRoute({
|
|
304804
|
+
forgePath: "/api/cmmd/forge-runtimes/:runtimeId/execution-intents",
|
|
304805
|
+
method: "POST",
|
|
304806
|
+
cmmdPath: "/api/forge/context/runtimes/:runtimeId/execution-intents",
|
|
304807
|
+
orgIdSource: "none",
|
|
304808
|
+
responseShape: "unwrapData",
|
|
304809
|
+
successStatus: 200
|
|
304810
|
+
});
|
|
304811
|
+
registerProxyRoute({
|
|
304812
|
+
forgePath: "/api/cmmd/forge-runtimes/:runtimeId/execution-intents/:intentId/dispatched",
|
|
304813
|
+
method: "POST",
|
|
304814
|
+
cmmdPath: "/api/forge/context/runtimes/:runtimeId/execution-intents/:intentId/dispatched",
|
|
304815
|
+
orgIdSource: "none",
|
|
304816
|
+
responseShape: "unwrapData",
|
|
304817
|
+
successStatus: 200
|
|
304818
|
+
});
|
|
304685
304819
|
registerProxyRoute({
|
|
304686
304820
|
forgePath: "/api/cmmd/devices/:deviceId/revoke",
|
|
304687
304821
|
method: "POST",
|
|
@@ -317378,7 +317512,7 @@ const connectLoginCommand = make$34("login", {
|
|
|
317378
317512
|
})).json();
|
|
317379
317513
|
},
|
|
317380
317514
|
openBrowser: async (url) => {
|
|
317381
|
-
const open = (await import("./open-
|
|
317515
|
+
const open = (await import("./open-D8mGyWmt.mjs")).default;
|
|
317382
317516
|
await open(url);
|
|
317383
317517
|
return true;
|
|
317384
317518
|
},
|