@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.cjs
CHANGED
|
@@ -65775,7 +65775,7 @@ function normalizeNumberish(value) {
|
|
|
65775
65775
|
}
|
|
65776
65776
|
//#endregion
|
|
65777
65777
|
//#region package.json
|
|
65778
|
-
var version$1 = "0.10.
|
|
65778
|
+
var version$1 = "0.10.16";
|
|
65779
65779
|
//#endregion
|
|
65780
65780
|
//#region src/sentry.ts
|
|
65781
65781
|
const SERVER_APP_NAME = "forge-server";
|
|
@@ -66248,7 +66248,7 @@ function readCmmdAvatarUrl(raw) {
|
|
|
66248
66248
|
function readTrimmedString$2(value) {
|
|
66249
66249
|
return typeof value === "string" ? value.trim() || null : null;
|
|
66250
66250
|
}
|
|
66251
|
-
function asRecord$
|
|
66251
|
+
function asRecord$14(value) {
|
|
66252
66252
|
return value && typeof value === "object" ? value : null;
|
|
66253
66253
|
}
|
|
66254
66254
|
function readDirectPlanLabelFromRecord(obj) {
|
|
@@ -66260,26 +66260,26 @@ function readNestedPlanLabelFromRecord(obj) {
|
|
|
66260
66260
|
function readCmmdPlanLabel(obj) {
|
|
66261
66261
|
const direct = readDirectPlanLabelFromRecord(obj);
|
|
66262
66262
|
if (direct) return direct;
|
|
66263
|
-
const plan = asRecord$
|
|
66263
|
+
const plan = asRecord$14(obj["plan"]);
|
|
66264
66264
|
if (plan) {
|
|
66265
66265
|
const label = readNestedPlanLabelFromRecord(plan);
|
|
66266
66266
|
if (label) return label;
|
|
66267
66267
|
}
|
|
66268
|
-
const subscription = asRecord$
|
|
66268
|
+
const subscription = asRecord$14(obj["subscription"]);
|
|
66269
66269
|
if (subscription) {
|
|
66270
66270
|
const label = readNestedPlanLabelFromRecord(subscription);
|
|
66271
66271
|
if (label) return label;
|
|
66272
|
-
const subscriptionPlan = asRecord$
|
|
66272
|
+
const subscriptionPlan = asRecord$14(subscription["plan"]);
|
|
66273
66273
|
if (subscriptionPlan) {
|
|
66274
66274
|
const nestedLabel = readNestedPlanLabelFromRecord(subscriptionPlan);
|
|
66275
66275
|
if (nestedLabel) return nestedLabel;
|
|
66276
66276
|
}
|
|
66277
66277
|
}
|
|
66278
|
-
const billing = asRecord$
|
|
66278
|
+
const billing = asRecord$14(obj["billing"]);
|
|
66279
66279
|
if (billing) {
|
|
66280
66280
|
const label = readNestedPlanLabelFromRecord(billing);
|
|
66281
66281
|
if (label) return label;
|
|
66282
|
-
const billingPlan = asRecord$
|
|
66282
|
+
const billingPlan = asRecord$14(billing["plan"]);
|
|
66283
66283
|
if (billingPlan) return readNestedPlanLabelFromRecord(billingPlan);
|
|
66284
66284
|
}
|
|
66285
66285
|
return null;
|
|
@@ -70094,22 +70094,22 @@ const EMPTY_PARSED_ERROR = {
|
|
|
70094
70094
|
message: null,
|
|
70095
70095
|
raw: null
|
|
70096
70096
|
};
|
|
70097
|
-
function asRecord$
|
|
70097
|
+
function asRecord$13(value) {
|
|
70098
70098
|
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
70099
70099
|
}
|
|
70100
70100
|
function readTrimmedString$1(value) {
|
|
70101
70101
|
return (typeof value === "string" ? value.trim() : "") || null;
|
|
70102
70102
|
}
|
|
70103
70103
|
function readErrorEnvelope(record) {
|
|
70104
|
-
return asRecord$
|
|
70104
|
+
return asRecord$13(record["error"]);
|
|
70105
70105
|
}
|
|
70106
70106
|
function readUpstreamErrorCode(body) {
|
|
70107
|
-
const record = asRecord$
|
|
70107
|
+
const record = asRecord$13(body);
|
|
70108
70108
|
if (record === null) return null;
|
|
70109
70109
|
return readTrimmedString$1(record["code"]) ?? readTrimmedString$1(readErrorEnvelope(record)?.["code"]);
|
|
70110
70110
|
}
|
|
70111
70111
|
function readErrorMessage$2(raw) {
|
|
70112
|
-
const record = asRecord$
|
|
70112
|
+
const record = asRecord$13(raw);
|
|
70113
70113
|
if (record === null) return null;
|
|
70114
70114
|
const error = record["error"];
|
|
70115
70115
|
const nestedMessage = readErrorEnvelope(record)?.["message"];
|
|
@@ -72197,7 +72197,7 @@ function readStringJS(length) {
|
|
|
72197
72197
|
if (units.length > 0) result += fromCharCode.apply(String, units);
|
|
72198
72198
|
return result;
|
|
72199
72199
|
}
|
|
72200
|
-
function readString$
|
|
72200
|
+
function readString$5(source, start, length) {
|
|
72201
72201
|
let existingSrc = src;
|
|
72202
72202
|
src = source;
|
|
72203
72203
|
position$1 = start;
|
|
@@ -74062,7 +74062,7 @@ function readStruct(src, position, srcEnd, unpackr) {
|
|
|
74062
74062
|
}
|
|
74063
74063
|
if (end == null) end = source.bytesEnd - refStart;
|
|
74064
74064
|
if (source.srcString) return source.srcString.slice(ref, end);
|
|
74065
|
-
return readString$
|
|
74065
|
+
return readString$5(src, ref + refStart, end - ref);
|
|
74066
74066
|
};
|
|
74067
74067
|
break;
|
|
74068
74068
|
case UTF8:
|
|
@@ -77414,7 +77414,7 @@ require_Schema$1.succeed$1(TraceDiagnostics, TraceDiagnostics.of({ read: (option
|
|
|
77414
77414
|
* through the server is what lets it ask at all.
|
|
77415
77415
|
*/
|
|
77416
77416
|
const RUNTIMES_PATH = "/api/forge/context/runtimes";
|
|
77417
|
-
function asRecord$
|
|
77417
|
+
function asRecord$12(value) {
|
|
77418
77418
|
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
77419
77419
|
}
|
|
77420
77420
|
/** A trimmed string, or null. Empty and whitespace are the same as absent. */
|
|
@@ -77429,7 +77429,7 @@ function text$1(value) {
|
|
|
77429
77429
|
* something that cannot work.
|
|
77430
77430
|
*/
|
|
77431
77431
|
function toSummary(value) {
|
|
77432
|
-
const row = asRecord$
|
|
77432
|
+
const row = asRecord$12(value);
|
|
77433
77433
|
if (!row) return null;
|
|
77434
77434
|
const runtimeId = text$1(row["runtimeId"]);
|
|
77435
77435
|
const organizationId = row["organizationId"];
|
|
@@ -77453,7 +77453,7 @@ function listCloudRuntimes(input) {
|
|
|
77453
77453
|
return require_Schema$1.gen(function* () {
|
|
77454
77454
|
const jwt = input.jwt;
|
|
77455
77455
|
if (jwt === null || jwt.trim().length === 0) return yield* require_Schema$1.fail(new CloudRuntimeListError({ failure: "not_signed_in" }));
|
|
77456
|
-
const runtimes = asRecord$
|
|
77456
|
+
const runtimes = asRecord$12(asRecord$12(yield* require_Schema$1.tryPromise({
|
|
77457
77457
|
try: () => input.request({
|
|
77458
77458
|
method: "GET",
|
|
77459
77459
|
jwt,
|
|
@@ -100880,7 +100880,7 @@ const EMPTY_PLAN_VALUES = new Set([
|
|
|
100880
100880
|
"none",
|
|
100881
100881
|
"null"
|
|
100882
100882
|
]);
|
|
100883
|
-
function asRecord$
|
|
100883
|
+
function asRecord$11(value) {
|
|
100884
100884
|
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
100885
100885
|
return value;
|
|
100886
100886
|
}
|
|
@@ -100897,7 +100897,7 @@ function decodeJwtClaims(token) {
|
|
|
100897
100897
|
try {
|
|
100898
100898
|
const decoded = Buffer.from(payload, "base64url");
|
|
100899
100899
|
if (decoded.byteLength > MAX_CLAIMS_BYTES) return void 0;
|
|
100900
|
-
return asRecord$
|
|
100900
|
+
return asRecord$11(JSON.parse(decoded.toString("utf8")));
|
|
100901
100901
|
} catch {
|
|
100902
100902
|
return;
|
|
100903
100903
|
}
|
|
@@ -100919,7 +100919,7 @@ function findPlanType(claims) {
|
|
|
100919
100919
|
const direct = fromRecord(claims);
|
|
100920
100920
|
if (direct) return direct;
|
|
100921
100921
|
for (const value of Object.values(claims)) {
|
|
100922
|
-
const nested = asRecord$
|
|
100922
|
+
const nested = asRecord$11(value);
|
|
100923
100923
|
if (!nested) continue;
|
|
100924
100924
|
const found = fromRecord(nested);
|
|
100925
100925
|
if (found) return found;
|
|
@@ -100936,7 +100936,7 @@ function readCodexAuthIdentity(authJson) {
|
|
|
100936
100936
|
} catch {
|
|
100937
100937
|
return {};
|
|
100938
100938
|
}
|
|
100939
|
-
const claims = decodeJwtClaims(asRecord$
|
|
100939
|
+
const claims = decodeJwtClaims(asRecord$11(asRecord$11(parsed)?.tokens)?.id_token);
|
|
100940
100940
|
if (!claims) return {};
|
|
100941
100941
|
const email = findEmail(claims);
|
|
100942
100942
|
const planType = findPlanType(claims);
|
|
@@ -149409,11 +149409,11 @@ function readObject(value) {
|
|
|
149409
149409
|
function readArray(value) {
|
|
149410
149410
|
return Array.isArray(value) ? value : void 0;
|
|
149411
149411
|
}
|
|
149412
|
-
function readString$
|
|
149412
|
+
function readString$4(value) {
|
|
149413
149413
|
return typeof value === "string" ? value : void 0;
|
|
149414
149414
|
}
|
|
149415
149415
|
function nonEmptyTrimmed$1(value) {
|
|
149416
|
-
const candidate = readString$
|
|
149416
|
+
const candidate = readString$4(value)?.trim();
|
|
149417
149417
|
return candidate ? candidate : void 0;
|
|
149418
149418
|
}
|
|
149419
149419
|
function readBoolean$2(value) {
|
|
@@ -206928,7 +206928,7 @@ function createCodexBrowserDynamicTools() {
|
|
|
206928
206928
|
function readArgs$3(value) {
|
|
206929
206929
|
return value && typeof value === "object" ? value : {};
|
|
206930
206930
|
}
|
|
206931
|
-
function readString$
|
|
206931
|
+
function readString$3(args, key) {
|
|
206932
206932
|
const value = args[key];
|
|
206933
206933
|
return typeof value === "string" && value.trim().length > 0 ? value : void 0;
|
|
206934
206934
|
}
|
|
@@ -206957,27 +206957,27 @@ function createCodexBrowserDynamicToolHandler(browserManager, options = {}) {
|
|
|
206957
206957
|
const toolScope = options.environmentId === void 0 ? {} : { environmentId: options.environmentId };
|
|
206958
206958
|
const handlers = makeBrowserHandlers(browserManager, ThreadId.make(input.threadId), toolScope);
|
|
206959
206959
|
const args = readArgs$3(input.arguments);
|
|
206960
|
-
const tabId = readString$
|
|
206960
|
+
const tabId = readString$3(args, "tabId");
|
|
206961
206961
|
switch (input.tool) {
|
|
206962
206962
|
case "forge_browser_list_sessions": return toCodexDynamicToolResult$2(await handlers.listSessions());
|
|
206963
206963
|
case "forge_browser_name_session": {
|
|
206964
|
-
const name = readString$
|
|
206964
|
+
const name = readString$3(args, "name");
|
|
206965
206965
|
if (!name) throw new Error("forge_browser_name_session requires a name.");
|
|
206966
206966
|
return toCodexDynamicToolResult$2(await handlers.nameSession(name));
|
|
206967
206967
|
}
|
|
206968
206968
|
case "forge_browser_set_visibility": {
|
|
206969
|
-
const visibility = readString$
|
|
206969
|
+
const visibility = readString$3(args, "visibility");
|
|
206970
206970
|
if (visibility !== "hidden" && visibility !== "visible") throw new Error("forge_browser_set_visibility requires visibility hidden or visible.");
|
|
206971
206971
|
return toCodexDynamicToolResult$2(await handlers.setVisibility(visibility));
|
|
206972
206972
|
}
|
|
206973
206973
|
case "forge_browser_close_session":
|
|
206974
206974
|
case "forge_browser_reset_session": return toCodexDynamicToolResult$2(await handlers.closeSession());
|
|
206975
206975
|
case "forge_browser_navigate": {
|
|
206976
|
-
const url = readString$
|
|
206976
|
+
const url = readString$3(args, "url");
|
|
206977
206977
|
if (!url) throw new Error("forge_browser_navigate requires a URL.");
|
|
206978
206978
|
return toCodexDynamicToolResult$2(await handlers.navigate(url, tabId));
|
|
206979
206979
|
}
|
|
206980
|
-
case "forge_browser_new_tab": return toCodexDynamicToolResult$2(await handlers.newTab(readString$
|
|
206980
|
+
case "forge_browser_new_tab": return toCodexDynamicToolResult$2(await handlers.newTab(readString$3(args, "url")));
|
|
206981
206981
|
case "forge_browser_close_tab":
|
|
206982
206982
|
if (!tabId) throw new Error("forge_browser_close_tab requires a tabId.");
|
|
206983
206983
|
return toCodexDynamicToolResult$2(await handlers.closeTab(tabId));
|
|
@@ -206988,33 +206988,33 @@ function createCodexBrowserDynamicToolHandler(browserManager, options = {}) {
|
|
|
206988
206988
|
case "forge_browser_go_forward": return toCodexDynamicToolResult$2(await handlers.goForward(tabId));
|
|
206989
206989
|
case "forge_browser_reload": return toCodexDynamicToolResult$2(await handlers.reload(tabId));
|
|
206990
206990
|
case "forge_browser_click": {
|
|
206991
|
-
const selector = readString$
|
|
206991
|
+
const selector = readString$3(args, "selector");
|
|
206992
206992
|
if (!selector) throw new Error("forge_browser_click requires a selector.");
|
|
206993
206993
|
return toCodexDynamicToolResult$2(await handlers.click(selector, tabId));
|
|
206994
206994
|
}
|
|
206995
206995
|
case "forge_browser_click_point": {
|
|
206996
206996
|
const x = readNumber$2(args, "x");
|
|
206997
206997
|
const y = readNumber$2(args, "y");
|
|
206998
|
-
const button = readString$
|
|
206998
|
+
const button = readString$3(args, "button");
|
|
206999
206999
|
const clickCount = readNumber$2(args, "clickCount");
|
|
207000
207000
|
if (x === void 0 || y === void 0) throw new Error("forge_browser_click_point requires x and y.");
|
|
207001
207001
|
if (button !== void 0 && button !== "left" && button !== "middle" && button !== "right") throw new Error("forge_browser_click_point requires button left, middle, or right.");
|
|
207002
207002
|
return toCodexDynamicToolResult$2(await handlers.clickPoint(x, y, button, clickCount, tabId));
|
|
207003
207003
|
}
|
|
207004
207004
|
case "forge_browser_type": {
|
|
207005
|
-
const selector = readString$
|
|
207005
|
+
const selector = readString$3(args, "selector");
|
|
207006
207006
|
if (!selector) throw new Error("forge_browser_type requires a selector.");
|
|
207007
|
-
const text = readString$
|
|
207007
|
+
const text = readString$3(args, "text");
|
|
207008
207008
|
if (text === void 0) throw new Error("forge_browser_type requires text.");
|
|
207009
207009
|
return toCodexDynamicToolResult$2(await handlers.type(selector, text, readBoolean$1(args, "append"), tabId));
|
|
207010
207010
|
}
|
|
207011
207011
|
case "forge_browser_type_text": {
|
|
207012
|
-
const text = readString$
|
|
207012
|
+
const text = readString$3(args, "text");
|
|
207013
207013
|
if (text === void 0) throw new Error("forge_browser_type_text requires text.");
|
|
207014
207014
|
return toCodexDynamicToolResult$2(await handlers.typeText(text, readBoolean$1(args, "pressEnter"), tabId));
|
|
207015
207015
|
}
|
|
207016
207016
|
case "forge_browser_press_key": {
|
|
207017
|
-
const key = readString$
|
|
207017
|
+
const key = readString$3(args, "key");
|
|
207018
207018
|
if (!key) throw new Error("forge_browser_press_key requires a key.");
|
|
207019
207019
|
return toCodexDynamicToolResult$2(await handlers.pressKey(key, tabId));
|
|
207020
207020
|
}
|
|
@@ -207328,7 +207328,7 @@ function createCodexComputerDynamicToolHandler(computerManager) {
|
|
|
207328
207328
|
function readArgs$1(value) {
|
|
207329
207329
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
207330
207330
|
}
|
|
207331
|
-
function readString$
|
|
207331
|
+
function readString$2(args, key) {
|
|
207332
207332
|
const value = args[key];
|
|
207333
207333
|
return typeof value === "string" ? value : void 0;
|
|
207334
207334
|
}
|
|
@@ -207348,7 +207348,7 @@ function readStringArray(args, key) {
|
|
|
207348
207348
|
return value.filter((entry) => typeof entry === "string");
|
|
207349
207349
|
}
|
|
207350
207350
|
function readRequiredString(args, key, toolName) {
|
|
207351
|
-
const value = readString$
|
|
207351
|
+
const value = readString$2(args, key)?.trim();
|
|
207352
207352
|
if (!value) throw new Error(`${toolName} requires ${key}.`);
|
|
207353
207353
|
return value;
|
|
207354
207354
|
}
|
|
@@ -207383,7 +207383,7 @@ async function runGitHubLifecycleTool(toolName, context) {
|
|
|
207383
207383
|
action,
|
|
207384
207384
|
args: lifecycleArgs,
|
|
207385
207385
|
mode
|
|
207386
|
-
}), mode === "write" ? readString$
|
|
207386
|
+
}), mode === "write" ? readString$2(args, "confirmationId") : void 0);
|
|
207387
207387
|
}
|
|
207388
207388
|
//#endregion
|
|
207389
207389
|
//#region src/github/GitHubCodexPullRequestTools.ts
|
|
@@ -207393,8 +207393,8 @@ async function runGitHubPullRequestTool(toolName, context) {
|
|
|
207393
207393
|
case "forge_github_create_pull_request": {
|
|
207394
207394
|
const cwd = readRequiredString(args, "cwd", toolName);
|
|
207395
207395
|
const title = readRequiredString(args, "title", toolName);
|
|
207396
|
-
const body = readString$
|
|
207397
|
-
const headBranch = readString$
|
|
207396
|
+
const body = readString$2(args, "body");
|
|
207397
|
+
const headBranch = readString$2(args, "headBranch")?.trim();
|
|
207398
207398
|
if (body === void 0) throw new Error("forge_github_create_pull_request requires body.");
|
|
207399
207399
|
const request = {
|
|
207400
207400
|
cwd,
|
|
@@ -207403,7 +207403,7 @@ async function runGitHubPullRequestTool(toolName, context) {
|
|
|
207403
207403
|
baseBranch: readRequiredString(args, "baseBranch", toolName),
|
|
207404
207404
|
...headBranch ? { headBranch } : {}
|
|
207405
207405
|
};
|
|
207406
|
-
return runTool(request, () => broker.createPullRequest(auth, request), readString$
|
|
207406
|
+
return runTool(request, () => broker.createPullRequest(auth, request), readString$2(args, "confirmationId"));
|
|
207407
207407
|
}
|
|
207408
207408
|
case "forge_github_get_pull_request": {
|
|
207409
207409
|
const cwd = readRequiredString(args, "cwd", toolName);
|
|
@@ -207425,29 +207425,29 @@ function runStatus$1({ auth, broker, runTool }) {
|
|
|
207425
207425
|
return runTool({}, () => broker.status(auth));
|
|
207426
207426
|
}
|
|
207427
207427
|
function runListRepositories({ args, auth, broker, runTool }) {
|
|
207428
|
-
const search = readString$
|
|
207428
|
+
const search = readString$2(args, "search");
|
|
207429
207429
|
return runTool({ search: search ?? null }, () => broker.listRepositories(auth, { search }));
|
|
207430
207430
|
}
|
|
207431
207431
|
function runCloneRepository({ args, auth, broker, runTool }) {
|
|
207432
207432
|
const toolName = "forge_github_clone_repository";
|
|
207433
207433
|
const repoFullName = readRequiredString(args, "repoFullName", toolName);
|
|
207434
207434
|
const destination = readRequiredString(args, "destination", toolName);
|
|
207435
|
-
const branch = readString$
|
|
207435
|
+
const branch = readString$2(args, "branch");
|
|
207436
207436
|
const request = {
|
|
207437
207437
|
repoFullName,
|
|
207438
207438
|
destination,
|
|
207439
207439
|
...branch ? { branch } : {}
|
|
207440
207440
|
};
|
|
207441
|
-
return runTool(request, () => broker.cloneRepository(auth, request), readString$
|
|
207441
|
+
return runTool(request, () => broker.cloneRepository(auth, request), readString$2(args, "confirmationId"));
|
|
207442
207442
|
}
|
|
207443
207443
|
function runCreateRepository({ args, auth, broker, runTool }) {
|
|
207444
207444
|
const toolName = "forge_github_create_repository";
|
|
207445
207445
|
const owner = readRequiredString(args, "owner", toolName);
|
|
207446
207446
|
const name = readRequiredString(args, "name", toolName);
|
|
207447
|
-
const visibility = readString$
|
|
207447
|
+
const visibility = readString$2(args, "visibility");
|
|
207448
207448
|
if (visibility !== void 0 && visibility !== "private" && visibility !== "public") throw new Error("forge_github_create_repository visibility must be private or public.");
|
|
207449
207449
|
const repositoryVisibility = visibility;
|
|
207450
|
-
const description = readString$
|
|
207450
|
+
const description = readString$2(args, "description");
|
|
207451
207451
|
const request = {
|
|
207452
207452
|
owner,
|
|
207453
207453
|
name,
|
|
@@ -207455,32 +207455,32 @@ function runCreateRepository({ args, auth, broker, runTool }) {
|
|
|
207455
207455
|
...repositoryVisibility ? { visibility: repositoryVisibility } : {},
|
|
207456
207456
|
...description !== void 0 ? { description } : {}
|
|
207457
207457
|
};
|
|
207458
|
-
return runTool(request, () => broker.createRepository(auth, request), readString$
|
|
207458
|
+
return runTool(request, () => broker.createRepository(auth, request), readString$2(args, "confirmationId"));
|
|
207459
207459
|
}
|
|
207460
207460
|
function runLinkProjectRepository({ args, auth, broker, runTool }) {
|
|
207461
207461
|
const toolName = "forge_github_link_project_repository";
|
|
207462
207462
|
const cwd = readRequiredString(args, "cwd", toolName);
|
|
207463
207463
|
const repoFullName = readRequiredString(args, "repoFullName", toolName);
|
|
207464
|
-
const branch = readString$
|
|
207464
|
+
const branch = readString$2(args, "branch");
|
|
207465
207465
|
const request = {
|
|
207466
207466
|
cwd,
|
|
207467
207467
|
repoFullName,
|
|
207468
207468
|
...branch ? { branch } : {}
|
|
207469
207469
|
};
|
|
207470
|
-
return runTool(request, () => broker.linkProjectRepository(auth, request), readString$
|
|
207470
|
+
return runTool(request, () => broker.linkProjectRepository(auth, request), readString$2(args, "confirmationId"));
|
|
207471
207471
|
}
|
|
207472
207472
|
function runPushBranch({ args, auth, broker, runTool }) {
|
|
207473
207473
|
const cwd = readRequiredString(args, "cwd", "forge_github_push_branch");
|
|
207474
|
-
const branch = readString$
|
|
207474
|
+
const branch = readString$2(args, "branch");
|
|
207475
207475
|
const request = {
|
|
207476
207476
|
cwd,
|
|
207477
207477
|
...branch ? { branch } : {}
|
|
207478
207478
|
};
|
|
207479
|
-
return runTool(request, () => broker.pushProjectBranch(auth, request), readString$
|
|
207479
|
+
return runTool(request, () => broker.pushProjectBranch(auth, request), readString$2(args, "confirmationId"));
|
|
207480
207480
|
}
|
|
207481
207481
|
function runRefreshCredentials({ args, auth, broker, runTool }) {
|
|
207482
207482
|
const request = { cwd: readRequiredString(args, "cwd", "forge_github_refresh_credentials") };
|
|
207483
|
-
return runTool(request, () => broker.refreshProjectCredentials(auth, request), readString$
|
|
207483
|
+
return runTool(request, () => broker.refreshProjectCredentials(auth, request), readString$2(args, "confirmationId"));
|
|
207484
207484
|
}
|
|
207485
207485
|
const repositoryToolHandlers = {
|
|
207486
207486
|
forge_github_status: runStatus$1,
|
|
@@ -207518,7 +207518,7 @@ async function runGitHubWorkflowTool(toolName, context) {
|
|
|
207518
207518
|
}
|
|
207519
207519
|
function listWorkflowRuns({ args, auth, broker, runTool }) {
|
|
207520
207520
|
const cwd = readRequiredString(args, "cwd", "forge_github_list_workflow_runs");
|
|
207521
|
-
const branch = readString$
|
|
207521
|
+
const branch = readString$2(args, "branch")?.trim();
|
|
207522
207522
|
const limit = readNumber$1(args, "limit");
|
|
207523
207523
|
const request = {
|
|
207524
207524
|
cwd,
|
|
@@ -207537,7 +207537,7 @@ function watchWorkflowRun({ args, auth, broker, runTool }) {
|
|
|
207537
207537
|
}
|
|
207538
207538
|
function getWorkflowRunLogs({ args, auth, broker, runTool }) {
|
|
207539
207539
|
const { cwd, runId } = readWorkflowRunRequest(args, "forge_github_get_workflow_run_logs");
|
|
207540
|
-
const jobId = readString$
|
|
207540
|
+
const jobId = readString$2(args, "jobId")?.trim();
|
|
207541
207541
|
const request = {
|
|
207542
207542
|
cwd,
|
|
207543
207543
|
runId,
|
|
@@ -207547,16 +207547,16 @@ function getWorkflowRunLogs({ args, auth, broker, runTool }) {
|
|
|
207547
207547
|
}
|
|
207548
207548
|
function downloadWorkflowArtifacts({ args, auth, broker, runTool }) {
|
|
207549
207549
|
const cwd = readRequiredString(args, "cwd", "forge_github_download_workflow_artifacts");
|
|
207550
|
-
const runId = readString$
|
|
207551
|
-
const artifactName = readString$
|
|
207552
|
-
const destinationDir = readString$
|
|
207550
|
+
const runId = readString$2(args, "runId")?.trim();
|
|
207551
|
+
const artifactName = readString$2(args, "artifactName")?.trim();
|
|
207552
|
+
const destinationDir = readString$2(args, "destinationDir")?.trim();
|
|
207553
207553
|
const request = {
|
|
207554
207554
|
cwd,
|
|
207555
207555
|
...runId ? { runId } : {},
|
|
207556
207556
|
...artifactName ? { artifactName } : {},
|
|
207557
207557
|
...destinationDir ? { destinationDir } : {}
|
|
207558
207558
|
};
|
|
207559
|
-
return runTool(request, () => broker.downloadWorkflowArtifacts(auth, request), readString$
|
|
207559
|
+
return runTool(request, () => broker.downloadWorkflowArtifacts(auth, request), readString$2(args, "confirmationId"));
|
|
207560
207560
|
}
|
|
207561
207561
|
function listWorkflows({ args, auth, broker, runTool }) {
|
|
207562
207562
|
const cwd = readRequiredString(args, "cwd", "forge_github_list_workflows");
|
|
@@ -207575,7 +207575,7 @@ function getWorkflow({ args, auth, broker, runTool }) {
|
|
|
207575
207575
|
}
|
|
207576
207576
|
function runWorkflow({ args, auth, broker, runTool }) {
|
|
207577
207577
|
const { cwd, workflow } = readWorkflowRequest(args, "forge_github_run_workflow");
|
|
207578
|
-
const ref = readString$
|
|
207578
|
+
const ref = readString$2(args, "ref")?.trim();
|
|
207579
207579
|
const fields = readStringRecord(args, "fields");
|
|
207580
207580
|
const request = {
|
|
207581
207581
|
cwd,
|
|
@@ -207583,7 +207583,7 @@ function runWorkflow({ args, auth, broker, runTool }) {
|
|
|
207583
207583
|
...ref ? { ref } : {},
|
|
207584
207584
|
...fields && Object.keys(fields).length > 0 ? { fields } : {}
|
|
207585
207585
|
};
|
|
207586
|
-
return runTool(request, () => broker.runWorkflow(auth, request), readString$
|
|
207586
|
+
return runTool(request, () => broker.runWorkflow(auth, request), readString$2(args, "confirmationId"));
|
|
207587
207587
|
}
|
|
207588
207588
|
function enableWorkflow(context) {
|
|
207589
207589
|
return runWorkflowToggle("forge_github_enable_workflow", context, "enableWorkflow");
|
|
@@ -207606,12 +207606,12 @@ function readWorkflowRequest(args, toolName) {
|
|
|
207606
207606
|
async function runWorkflowRunMutation(toolName, context, brokerMethod) {
|
|
207607
207607
|
const { args, auth, broker, runTool } = context;
|
|
207608
207608
|
const request = readWorkflowRunRequest(args, toolName);
|
|
207609
|
-
return runTool(request, () => broker[brokerMethod](auth, request), readString$
|
|
207609
|
+
return runTool(request, () => broker[brokerMethod](auth, request), readString$2(args, "confirmationId"));
|
|
207610
207610
|
}
|
|
207611
207611
|
function runWorkflowToggle(toolName, context, brokerMethod) {
|
|
207612
207612
|
const { args, auth, broker, runTool } = context;
|
|
207613
207613
|
const request = readWorkflowRequest(args, toolName);
|
|
207614
|
-
return runTool(request, () => broker[brokerMethod](auth, request), readString$
|
|
207614
|
+
return runTool(request, () => broker[brokerMethod](auth, request), readString$2(args, "confirmationId"));
|
|
207615
207615
|
}
|
|
207616
207616
|
//#endregion
|
|
207617
207617
|
//#region src/github/GitHubCodexWorkspaceGitTools.ts
|
|
@@ -207628,7 +207628,7 @@ async function runWorkspaceGitTool(toolName, context) {
|
|
|
207628
207628
|
case "forge_git_commit": return runCommit("forge_git_commit", context);
|
|
207629
207629
|
case "forge_git_reset_hard": return runResetHard("forge_git_reset_hard", context);
|
|
207630
207630
|
case "forge_git": {
|
|
207631
|
-
const operation = readString$
|
|
207631
|
+
const operation = readString$2(args, "operation")?.trim();
|
|
207632
207632
|
switch (operation) {
|
|
207633
207633
|
case "status": return runStatus(toolName, context, "status");
|
|
207634
207634
|
case "log": return runLog(toolName, context);
|
|
@@ -207657,7 +207657,7 @@ function runLog(toolName, { args, broker, runTool }) {
|
|
|
207657
207657
|
}
|
|
207658
207658
|
function runStash(toolName, { args, broker, runTool }, operation) {
|
|
207659
207659
|
const cwd = readRequiredString(args, "cwd", toolName);
|
|
207660
|
-
const message = readString$
|
|
207660
|
+
const message = readString$2(args, "message")?.trim();
|
|
207661
207661
|
return runTool({
|
|
207662
207662
|
cwd,
|
|
207663
207663
|
...operation ? { operation } : {},
|
|
@@ -207665,12 +207665,12 @@ function runStash(toolName, { args, broker, runTool }, operation) {
|
|
|
207665
207665
|
}, () => broker.stashWorkspace({
|
|
207666
207666
|
cwd,
|
|
207667
207667
|
...message ? { message } : {}
|
|
207668
|
-
}), readString$
|
|
207668
|
+
}), readString$2(args, "confirmationId"));
|
|
207669
207669
|
}
|
|
207670
207670
|
function runCommit(toolName, { args, broker, runTool }, operation) {
|
|
207671
207671
|
const cwd = readRequiredString(args, "cwd", toolName);
|
|
207672
207672
|
const message = readRequiredString(args, "message", operation ? `${toolName} operation=commit` : toolName);
|
|
207673
|
-
const branch = readString$
|
|
207673
|
+
const branch = readString$2(args, "branch")?.trim();
|
|
207674
207674
|
return runTool({
|
|
207675
207675
|
cwd,
|
|
207676
207676
|
...operation ? { operation } : {},
|
|
@@ -207680,11 +207680,11 @@ function runCommit(toolName, { args, broker, runTool }, operation) {
|
|
|
207680
207680
|
cwd,
|
|
207681
207681
|
message,
|
|
207682
207682
|
...branch ? { branch } : {}
|
|
207683
|
-
}), readString$
|
|
207683
|
+
}), readString$2(args, "confirmationId"));
|
|
207684
207684
|
}
|
|
207685
207685
|
function runResetHard(toolName, { args, broker, runTool }, operation) {
|
|
207686
207686
|
const cwd = readRequiredString(args, "cwd", toolName);
|
|
207687
|
-
const ref = readString$
|
|
207687
|
+
const ref = readString$2(args, "ref")?.trim();
|
|
207688
207688
|
return runTool({
|
|
207689
207689
|
cwd,
|
|
207690
207690
|
...operation ? { operation } : {},
|
|
@@ -207692,7 +207692,7 @@ function runResetHard(toolName, { args, broker, runTool }, operation) {
|
|
|
207692
207692
|
}, () => broker.resetWorkspaceHard({
|
|
207693
207693
|
cwd,
|
|
207694
207694
|
...ref ? { ref } : {}
|
|
207695
|
-
}), readString$
|
|
207695
|
+
}), readString$2(args, "confirmationId"));
|
|
207696
207696
|
}
|
|
207697
207697
|
//#endregion
|
|
207698
207698
|
//#region src/github/GitHubCodexToolRunner.ts
|
|
@@ -208326,7 +208326,7 @@ function createCodexGitHubDynamicToolHandler(options = {}) {
|
|
|
208326
208326
|
error: "Forge could not resolve the authenticated user session for this thread. Send a new turn from the Forge UI and retry."
|
|
208327
208327
|
}, false);
|
|
208328
208328
|
const args = readArgs$1(input.arguments);
|
|
208329
|
-
const dispatchOperation = input.tool === "forge_git" ? readString$
|
|
208329
|
+
const dispatchOperation = input.tool === "forge_git" ? readString$2(args, "operation")?.trim() : void 0;
|
|
208330
208330
|
const operation = dispatchOperation ?? operationForTool(input.tool);
|
|
208331
208331
|
const requiresConfirmation = !bypassWriteConfirmation && (isGitHubWriteTool(input.tool) || dispatchOperation !== void 0 && FORGE_GIT_WRITE_OPERATIONS.has(dispatchOperation));
|
|
208332
208332
|
const runTool = async (request, execute, confirmationId) => {
|
|
@@ -208848,7 +208848,7 @@ function createCodexDevServerDynamicTools() {
|
|
|
208848
208848
|
function readArgs(value) {
|
|
208849
208849
|
return value && typeof value === "object" ? value : {};
|
|
208850
208850
|
}
|
|
208851
|
-
function readString(args, key) {
|
|
208851
|
+
function readString$1(args, key) {
|
|
208852
208852
|
const value = args[key];
|
|
208853
208853
|
return typeof value === "string" && value.trim().length > 0 ? value : void 0;
|
|
208854
208854
|
}
|
|
@@ -208861,8 +208861,8 @@ function readBoolean(args, key) {
|
|
|
208861
208861
|
return typeof value === "boolean" ? value : void 0;
|
|
208862
208862
|
}
|
|
208863
208863
|
function runDevServerStart(handlers, args) {
|
|
208864
|
-
const command = readString(args, "command");
|
|
208865
|
-
const cwd = readString(args, "cwd");
|
|
208864
|
+
const command = readString$1(args, "command");
|
|
208865
|
+
const cwd = readString$1(args, "cwd");
|
|
208866
208866
|
const port = readNumber(args, "port");
|
|
208867
208867
|
const readyTimeoutMs = readNumber(args, "readyTimeoutMs");
|
|
208868
208868
|
const openPreview = readBoolean(args, "openPreview");
|
|
@@ -209018,7 +209018,7 @@ function readConnectorParams(tool, args) {
|
|
|
209018
209018
|
switch (tool.tool) {
|
|
209019
209019
|
case "forge_gmail_search": return {
|
|
209020
209020
|
...params,
|
|
209021
|
-
query: readString$
|
|
209021
|
+
query: readString$2(args, "query") ?? ""
|
|
209022
209022
|
};
|
|
209023
209023
|
case "forge_gmail_list_recent": return {
|
|
209024
209024
|
...params,
|
|
@@ -209030,7 +209030,7 @@ function readConnectorParams(tool, args) {
|
|
|
209030
209030
|
}
|
|
209031
209031
|
}
|
|
209032
209032
|
function appendString(target, args, key) {
|
|
209033
|
-
const value = readString$
|
|
209033
|
+
const value = readString$2(args, key);
|
|
209034
209034
|
if (value !== void 0) target[key] = value;
|
|
209035
209035
|
}
|
|
209036
209036
|
function appendNumber(target, args, key) {
|
|
@@ -209619,7 +209619,7 @@ const collectStreamAsString = (stream) => stream.pipe(require_Path.decodeText(),
|
|
|
209619
209619
|
//#region src/orchestration/WorkerPlanCodexTools.ts
|
|
209620
209620
|
const FORGE_PROPOSE_WORKER_TASKS_TOOL = "forge_propose_worker_tasks";
|
|
209621
209621
|
const MAX_WORKER_PLAN_ITEMS = 5;
|
|
209622
|
-
function asRecord$
|
|
209622
|
+
function asRecord$10(value) {
|
|
209623
209623
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
209624
209624
|
}
|
|
209625
209625
|
function readTrimmedString(value) {
|
|
@@ -209635,7 +209635,7 @@ function isValidWorkerSummary(value) {
|
|
|
209635
209635
|
return value !== void 0 && value.length > 0 && value.length <= 4e3;
|
|
209636
209636
|
}
|
|
209637
209637
|
function decodeWorkerPlanItem(value) {
|
|
209638
|
-
const item = asRecord$
|
|
209638
|
+
const item = asRecord$10(value);
|
|
209639
209639
|
const slug = readTrimmedString(item?.slug);
|
|
209640
209640
|
const title = readTrimmedString(item?.title);
|
|
209641
209641
|
const summary = readTrimmedString(item?.summary);
|
|
@@ -209699,7 +209699,7 @@ function createWorkerPlanDynamicTools() {
|
|
|
209699
209699
|
function createWorkerPlanDynamicToolHandler() {
|
|
209700
209700
|
return async (input) => {
|
|
209701
209701
|
if (input.tool !== "forge_propose_worker_tasks") throw new Error(`Unsupported worker-plan tool: ${input.tool}`);
|
|
209702
|
-
if (!decodeWorkerPlanItems(asRecord$
|
|
209702
|
+
if (!decodeWorkerPlanItems(asRecord$10(input.arguments)?.items)) throw new Error("Worker plans require one to five unique, fully described items.");
|
|
209703
209703
|
return {
|
|
209704
209704
|
success: true,
|
|
209705
209705
|
contentItems: [{
|
|
@@ -211520,25 +211520,25 @@ const AUTH_METHOD_CONTAINER_KEYS = [
|
|
|
211520
211520
|
/** Lift an unknown value into `Option<string>` if it is a non-empty string. */
|
|
211521
211521
|
const asNonEmptyString = (v) => typeof v === "string" && v.length > 0 ? require_Schema$1.some(v) : require_Schema$1.none();
|
|
211522
211522
|
/** Lift an unknown value into `Option<Record>` if it is a plain object. */
|
|
211523
|
-
const asRecord$
|
|
211523
|
+
const asRecord$9 = (v) => typeof v === "object" && v !== null && !globalThis.Array.isArray(v) ? require_Schema$1.some(v) : require_Schema$1.none();
|
|
211524
211524
|
/**
|
|
211525
211525
|
* Walk an unknown parsed JSON value looking for a subscription/plan
|
|
211526
211526
|
* identifier, returning the first match as an `Option`.
|
|
211527
211527
|
*/
|
|
211528
211528
|
function findSubscriptionType(value) {
|
|
211529
211529
|
if (globalThis.Array.isArray(value)) return require_Schema$1.firstSomeOf(value.map(findSubscriptionType));
|
|
211530
|
-
return asRecord$
|
|
211530
|
+
return asRecord$9(value).pipe(require_Schema$1.flatMap$2((record) => {
|
|
211531
211531
|
const direct = require_Schema$1.firstSomeOf(SUBSCRIPTION_TYPE_KEYS.map((key) => asNonEmptyString(record[key])));
|
|
211532
211532
|
if (require_Schema$1.isSome(direct)) return direct;
|
|
211533
|
-
return require_Schema$1.firstSomeOf(SUBSCRIPTION_CONTAINER_KEYS.map((key) => asRecord$
|
|
211533
|
+
return require_Schema$1.firstSomeOf(SUBSCRIPTION_CONTAINER_KEYS.map((key) => asRecord$9(record[key]).pipe(require_Schema$1.flatMap$2(findSubscriptionType))));
|
|
211534
211534
|
}));
|
|
211535
211535
|
}
|
|
211536
211536
|
function findAuthMethod(value) {
|
|
211537
211537
|
if (globalThis.Array.isArray(value)) return require_Schema$1.firstSomeOf(value.map(findAuthMethod));
|
|
211538
|
-
return asRecord$
|
|
211538
|
+
return asRecord$9(value).pipe(require_Schema$1.flatMap$2((record) => {
|
|
211539
211539
|
const direct = require_Schema$1.firstSomeOf(AUTH_METHOD_KEYS.map((key) => asNonEmptyString(record[key])));
|
|
211540
211540
|
if (require_Schema$1.isSome(direct)) return direct;
|
|
211541
|
-
return require_Schema$1.firstSomeOf(AUTH_METHOD_CONTAINER_KEYS.map((key) => asRecord$
|
|
211541
|
+
return require_Schema$1.firstSomeOf(AUTH_METHOD_CONTAINER_KEYS.map((key) => asRecord$9(record[key]).pipe(require_Schema$1.flatMap$2(findAuthMethod))));
|
|
211542
211542
|
}));
|
|
211543
211543
|
}
|
|
211544
211544
|
/**
|
|
@@ -212784,7 +212784,7 @@ function userInputQuestionsFromToolInput(toolInput) {
|
|
|
212784
212784
|
return (Array.isArray(toolInput.questions) ? toolInput.questions : []).map((question, idx) => userInputQuestionFromUnknown(question, idx));
|
|
212785
212785
|
}
|
|
212786
212786
|
function userInputQuestionFromUnknown(question, idx) {
|
|
212787
|
-
const value = asRecord$
|
|
212787
|
+
const value = asRecord$8(question) ?? {};
|
|
212788
212788
|
return {
|
|
212789
212789
|
id: typeof value.header === "string" ? value.header : `q-${idx}`,
|
|
212790
212790
|
header: typeof value.header === "string" ? value.header : `Question ${idx + 1}`,
|
|
@@ -212794,13 +212794,13 @@ function userInputQuestionFromUnknown(question, idx) {
|
|
|
212794
212794
|
};
|
|
212795
212795
|
}
|
|
212796
212796
|
function userInputOptionFromUnknown(option) {
|
|
212797
|
-
const value = asRecord$
|
|
212797
|
+
const value = asRecord$8(option) ?? {};
|
|
212798
212798
|
return {
|
|
212799
212799
|
label: typeof value.label === "string" ? value.label : "",
|
|
212800
212800
|
description: typeof value.description === "string" ? value.description : ""
|
|
212801
212801
|
};
|
|
212802
212802
|
}
|
|
212803
|
-
function asRecord$
|
|
212803
|
+
function asRecord$8(value) {
|
|
212804
212804
|
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
212805
212805
|
}
|
|
212806
212806
|
function permissionResultFromDecision(decision, toolInput, suggestions) {
|
|
@@ -213705,7 +213705,7 @@ const makeClaudeAdapter = require_Schema$1.fn("makeClaudeAdapter")(function* (op
|
|
|
213705
213705
|
const updateResumeCursor = require_Schema$1.fn("updateResumeCursor")(function* (context) {
|
|
213706
213706
|
const threadId = context.session.threadId;
|
|
213707
213707
|
if (!threadId) return;
|
|
213708
|
-
const providerDeliveryBinding = readProviderDeliveryBinding(asRecord$
|
|
213708
|
+
const providerDeliveryBinding = readProviderDeliveryBinding(asRecord$8(context.session.resumeCursor)?.providerDeliveryBinding);
|
|
213709
213709
|
const resumeCursor = {
|
|
213710
213710
|
threadId,
|
|
213711
213711
|
...context.resumeSessionId ? { resume: context.resumeSessionId } : {},
|
|
@@ -218783,7 +218783,7 @@ function makeAcpContentDeltaEvent(input) {
|
|
|
218783
218783
|
}
|
|
218784
218784
|
//#endregion
|
|
218785
218785
|
//#region ../../packages/shared/src/toolActivity.ts
|
|
218786
|
-
function asRecord$
|
|
218786
|
+
function asRecord$7(value) {
|
|
218787
218787
|
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
218788
218788
|
}
|
|
218789
218789
|
function asTrimmedString(value) {
|
|
@@ -218809,10 +218809,10 @@ function extractCommandFromTitle$1(title) {
|
|
|
218809
218809
|
return /`([^`]+)`/u.exec(title)?.[1]?.trim() || void 0;
|
|
218810
218810
|
}
|
|
218811
218811
|
function extractToolCommand(data, title) {
|
|
218812
|
-
const item = asRecord$
|
|
218813
|
-
const itemInput = asRecord$
|
|
218814
|
-
const itemResult = asRecord$
|
|
218815
|
-
const rawInput = asRecord$
|
|
218812
|
+
const item = asRecord$7(data?.item);
|
|
218813
|
+
const itemInput = asRecord$7(item?.input);
|
|
218814
|
+
const itemResult = asRecord$7(item?.result);
|
|
218815
|
+
const rawInput = asRecord$7(data?.rawInput);
|
|
218816
218816
|
const direct = [
|
|
218817
218817
|
normalizeCommandValue$1(item?.command),
|
|
218818
218818
|
normalizeCommandValue$1(itemInput?.command),
|
|
@@ -218840,7 +218840,7 @@ function collectPaths(value, paths, seen, depth) {
|
|
|
218840
218840
|
}
|
|
218841
218841
|
return;
|
|
218842
218842
|
}
|
|
218843
|
-
const record = asRecord$
|
|
218843
|
+
const record = asRecord$7(value);
|
|
218844
218844
|
if (!record) return;
|
|
218845
218845
|
for (const key of [
|
|
218846
218846
|
"path",
|
|
@@ -218899,7 +218899,7 @@ function deriveToolActivityPresentation(input) {
|
|
|
218899
218899
|
const title = asTrimmedString(input.title);
|
|
218900
218900
|
const detail = stripTrailingExitCode(asTrimmedString(input.detail));
|
|
218901
218901
|
const fallbackSummary = asTrimmedString(input.fallbackSummary) ?? "Tool";
|
|
218902
|
-
const data = asRecord$
|
|
218902
|
+
const data = asRecord$7(input.data);
|
|
218903
218903
|
const command = extractToolCommand(data, title);
|
|
218904
218904
|
const primaryPath = extractPrimaryPath(data);
|
|
218905
218905
|
const action = classifyToolAction({
|
|
@@ -218923,7 +218923,7 @@ function deriveToolActivityPresentation(input) {
|
|
|
218923
218923
|
...primaryPath ? { detail: primaryPath } : {}
|
|
218924
218924
|
};
|
|
218925
218925
|
if (action === "search") {
|
|
218926
|
-
const query = asTrimmedString(asRecord$
|
|
218926
|
+
const query = asTrimmedString(asRecord$7(data?.rawInput)?.query) ?? asTrimmedString(asRecord$7(data?.rawInput)?.pattern) ?? asTrimmedString(asRecord$7(data?.rawInput)?.searchTerm);
|
|
218927
218927
|
return {
|
|
218928
218928
|
summary: "Searched files",
|
|
218929
218929
|
...query ? { detail: query } : {}
|
|
@@ -285783,7 +285783,7 @@ function makeApprovedWorkerPlanEventState() {
|
|
|
285783
285783
|
function promptKey(masterThreadId, promptId) {
|
|
285784
285784
|
return `${masterThreadId}\n${promptId}`;
|
|
285785
285785
|
}
|
|
285786
|
-
function asRecord$
|
|
285786
|
+
function asRecord$6(value) {
|
|
285787
285787
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
285788
285788
|
}
|
|
285789
285789
|
function exactMaterializedTaskIds(value, expectedCount) {
|
|
@@ -285793,7 +285793,7 @@ function exactMaterializedTaskIds(value, expectedCount) {
|
|
|
285793
285793
|
}
|
|
285794
285794
|
function readyBatchFromActivity(state, event) {
|
|
285795
285795
|
if (event.payload.activity.kind !== "plan.task-creation.batch-succeeded") return null;
|
|
285796
|
-
const payload = asRecord$
|
|
285796
|
+
const payload = asRecord$6(event.payload.activity.payload);
|
|
285797
285797
|
const promptId = payload?.["promptId"];
|
|
285798
285798
|
if (typeof promptId !== "string") return null;
|
|
285799
285799
|
const key = promptKey(event.payload.threadId, promptId);
|
|
@@ -286993,7 +286993,7 @@ function runtimeGrantNeedsRefresh(token, identity, nowSeconds = Math.floor(Date.
|
|
|
286993
286993
|
return claims.expiresAtSeconds - nowSeconds <= RUNTIME_GRANT_REFRESH_SKEW_SECONDS;
|
|
286994
286994
|
}
|
|
286995
286995
|
/** Narrow an unknown to a plain object, or null. */
|
|
286996
|
-
function asRecord$
|
|
286996
|
+
function asRecord$5(value) {
|
|
286997
286997
|
return value !== null && typeof value === "object" ? value : null;
|
|
286998
286998
|
}
|
|
286999
286999
|
/** The raw (untrimmed) string when it is present and not blank, else null. */
|
|
@@ -287005,7 +287005,7 @@ function asTimestamp(value) {
|
|
|
287005
287005
|
return typeof value === "string" && Number.isFinite(Date.parse(value)) ? value : null;
|
|
287006
287006
|
}
|
|
287007
287007
|
function parseRuntimeGrantRefreshResponse(runtimeId, value) {
|
|
287008
|
-
const data = asRecord$
|
|
287008
|
+
const data = asRecord$5(asRecord$5(value)?.data);
|
|
287009
287009
|
if (!data || data.runtimeId !== runtimeId) return null;
|
|
287010
287010
|
const grantToken = asNonBlankString(data.grantToken);
|
|
287011
287011
|
const expiresAt = asTimestamp(data.expiresAt);
|
|
@@ -287066,7 +287066,6 @@ async function refreshRuntimeProvisioningGrant(input) {
|
|
|
287066
287066
|
async function maybeRefreshRuntimeProvisioningGrant(input) {
|
|
287067
287067
|
const current = require_runtimeControlAuthority.runtimeGrantToken();
|
|
287068
287068
|
if (!current) return "skipped";
|
|
287069
|
-
if (!runtimeGrantNeedsRefresh(current, input)) return "skipped";
|
|
287070
287069
|
const exactIdentity = exactRuntimeControlIdentity(input);
|
|
287071
287070
|
const currentClaims = currentGrantClaimsForRefresh({
|
|
287072
287071
|
currentGrant: current,
|
|
@@ -287075,6 +287074,11 @@ async function maybeRefreshRuntimeProvisioningGrant(input) {
|
|
|
287075
287074
|
});
|
|
287076
287075
|
if (!currentClaims) throw invalidRefreshResponse("Current runtime provisioning grant is unverifiable.");
|
|
287077
287076
|
const currentAuthorityClass = currentGrantAuthorityClass(currentClaims, exactIdentity);
|
|
287077
|
+
const controlAuthorityMissing = currentAuthorityClass === "exact" && exactIdentity !== null && require_runtimeControlAuthority.readRuntimeControlAuthority({
|
|
287078
|
+
runtimeId: input.runtimeId,
|
|
287079
|
+
...exactIdentity
|
|
287080
|
+
}) === null;
|
|
287081
|
+
if (!runtimeGrantNeedsRefresh(current, input) && !controlAuthorityMissing) return "skipped";
|
|
287078
287082
|
const refreshed = await refreshRuntimeProvisioningGrant({
|
|
287079
287083
|
runtimeId: input.runtimeId,
|
|
287080
287084
|
currentGrant: current,
|
|
@@ -294068,7 +294072,7 @@ function resolveBuildCommitFromEnv(env) {
|
|
|
294068
294072
|
* environment descriptor down instead of reporting an honest "unknown".
|
|
294069
294073
|
*/
|
|
294070
294074
|
function readBakedBuildCommit() {
|
|
294071
|
-
return "
|
|
294075
|
+
return "7f0d765bc59cb837f8aa8025b9b2f855df3fd36d";
|
|
294072
294076
|
}
|
|
294073
294077
|
async function resolveServerBuildCommit(input) {
|
|
294074
294078
|
if (isFullCommitSha(input.baked)) return input.baked;
|
|
@@ -303171,7 +303175,7 @@ const LocalAutomationSchedulerLive = require_Schema$1.effectDiscard(require_Sche
|
|
|
303171
303175
|
}));
|
|
303172
303176
|
//#endregion
|
|
303173
303177
|
//#region src/command/providerUsageEnvironment.ts
|
|
303174
|
-
function asRecord$
|
|
303178
|
+
function asRecord$4(value) {
|
|
303175
303179
|
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
303176
303180
|
}
|
|
303177
303181
|
function positiveInteger(value) {
|
|
@@ -303191,7 +303195,7 @@ function readRuntimeId(row) {
|
|
|
303191
303195
|
return typeof runtimeId === "string" && runtimeId.trim() !== "" ? runtimeId : null;
|
|
303192
303196
|
}
|
|
303193
303197
|
function readCandidate(runtime, ownerUserId) {
|
|
303194
|
-
const row = asRecord$
|
|
303198
|
+
const row = asRecord$4(runtime);
|
|
303195
303199
|
if (row === null || !isOwnedRuntime(row, ownerUserId) || row["desiredState"] !== "running") return null;
|
|
303196
303200
|
const organizationId = positiveInteger(row["organizationId"]);
|
|
303197
303201
|
const environmentId = readEnvironmentId(row["environmentId"]);
|
|
@@ -303226,15 +303230,17 @@ function deduplicateCandidates(candidates) {
|
|
|
303226
303230
|
* organization from browser input.
|
|
303227
303231
|
*/
|
|
303228
303232
|
function selectProviderUsageEnvironment(rawCatalog, ownerUserId) {
|
|
303229
|
-
const runtimes = asRecord$
|
|
303233
|
+
const runtimes = asRecord$4(asRecord$4(rawCatalog)?.["data"])?.["runtimes"];
|
|
303230
303234
|
if (!Array.isArray(runtimes)) return { kind: "unavailable" };
|
|
303231
303235
|
const candidates = deduplicateCandidates(runtimes.map((runtime) => readCandidate(runtime, ownerUserId)).filter((candidate) => candidate !== null));
|
|
303232
303236
|
const bestRank = Math.min(...candidates.map((candidate) => statusRank(candidate.status)));
|
|
303233
303237
|
const bestCandidates = candidates.filter((candidate) => statusRank(candidate.status) === bestRank);
|
|
303234
303238
|
if (bestCandidates.length !== 1) return { kind: "unavailable" };
|
|
303239
|
+
const selected = bestCandidates[0];
|
|
303235
303240
|
return {
|
|
303236
303241
|
kind: "ready",
|
|
303237
|
-
organizationId:
|
|
303242
|
+
organizationId: selected.organizationId,
|
|
303243
|
+
runtimeId: selected.runtimeId
|
|
303238
303244
|
};
|
|
303239
303245
|
}
|
|
303240
303246
|
//#endregion
|
|
@@ -303255,13 +303261,22 @@ function selectProviderUsageEnvironment(rawCatalog, ownerUserId) {
|
|
|
303255
303261
|
const FAILURE_TEXT = {
|
|
303256
303262
|
CLAUDE_USAGE_ENVIRONMENT_UNAVAILABLE: "Refresh needs your Environment running.",
|
|
303257
303263
|
CLAUDE_USAGE_CREDENTIAL_NOT_READY: "The Claude credential is not applied to your Environment yet.",
|
|
303264
|
+
CLAUDE_USAGE_CREDENTIAL_APPLY_FAILED: "Your Environment rejected the delivered Claude credential.",
|
|
303265
|
+
CLAUDE_USAGE_CREDENTIAL_REFRESHING: "The delivered Claude credential expired. CMMD is sending a replacement.",
|
|
303258
303266
|
CLAUDE_USAGE_REFRESH_IN_PROGRESS: "A refresh for this account is already running.",
|
|
303259
303267
|
CLAUDE_USAGE_PROBE_FAILED: "Your Environment could not read Claude usage.",
|
|
303260
303268
|
CLAUDE_USAGE_RECONNECT_REQUIRED: "Reconnect this Claude account to refresh usage.",
|
|
303261
303269
|
CLAUDE_USAGE_ACCOUNT_NOT_FOUND: "This Claude account is no longer connected.",
|
|
303262
303270
|
CLAUDE_USAGE_REFRESH_UNAVAILABLE: "Claude usage refresh is unavailable."
|
|
303263
303271
|
};
|
|
303264
|
-
/**
|
|
303272
|
+
/**
|
|
303273
|
+
* Verbatim from CMMD `personal-claude-usage.ts` and `provider-usage-service.ts`.
|
|
303274
|
+
*
|
|
303275
|
+
* Three reasons land on `CLAUDE_USAGE_CREDENTIAL_NOT_READY` because the refresh
|
|
303276
|
+
* response cannot tell them apart. `claudeUsageCredentialReadiness.ts` splits
|
|
303277
|
+
* them afterwards by reading the runtime's readiness, which is the only place
|
|
303278
|
+
* that knows whether a delivery is on its way or has already failed.
|
|
303279
|
+
*/
|
|
303265
303280
|
const CODE_BY_UPSTREAM_REASON = {
|
|
303266
303281
|
runtime_not_active: "CLAUDE_USAGE_ENVIRONMENT_UNAVAILABLE",
|
|
303267
303282
|
claude_native_delivery_disabled: "CLAUDE_USAGE_ENVIRONMENT_UNAVAILABLE",
|
|
@@ -303274,7 +303289,12 @@ const CODE_BY_UPSTREAM_REASON = {
|
|
|
303274
303289
|
usage_receipt_invalid: "CLAUDE_USAGE_PROBE_FAILED",
|
|
303275
303290
|
usage_output_invalid: "CLAUDE_USAGE_PROBE_FAILED"
|
|
303276
303291
|
};
|
|
303277
|
-
|
|
303292
|
+
/**
|
|
303293
|
+
* The one place a failure body is built, so every sentence a browser reads is
|
|
303294
|
+
* written in `FAILURE_TEXT` above. `claudeUsageCredentialReadiness.ts` calls it
|
|
303295
|
+
* to reach the two codes no upstream reason maps to.
|
|
303296
|
+
*/
|
|
303297
|
+
function describeClaudeUsageRefreshFailureCode(code, status) {
|
|
303278
303298
|
return {
|
|
303279
303299
|
status,
|
|
303280
303300
|
body: {
|
|
@@ -303283,6 +303303,9 @@ function failure(code, status) {
|
|
|
303283
303303
|
}
|
|
303284
303304
|
};
|
|
303285
303305
|
}
|
|
303306
|
+
function failure(code, status) {
|
|
303307
|
+
return describeClaudeUsageRefreshFailureCode(code, status);
|
|
303308
|
+
}
|
|
303286
303309
|
/**
|
|
303287
303310
|
* CMMD sends the reason as `{ "error": "<reason>" }`. Anything else, including
|
|
303288
303311
|
* a longer sentence that happens to start with an allowlisted word, is treated
|
|
@@ -303303,6 +303326,77 @@ function describeClaudeUsageRefreshFailure(error) {
|
|
|
303303
303326
|
return failure("CLAUDE_USAGE_REFRESH_UNAVAILABLE", error.status === 503 ? 503 : 502);
|
|
303304
303327
|
}
|
|
303305
303328
|
//#endregion
|
|
303329
|
+
//#region src/command/claudeUsageCredentialReadiness.ts
|
|
303330
|
+
/**
|
|
303331
|
+
* Which "credential not ready" a Claude usage refresh actually hit.
|
|
303332
|
+
*
|
|
303333
|
+
* CMMD answers a blocked refresh with one reason for three different worlds:
|
|
303334
|
+
* a delivery still travelling, a delivery CMMD cannot produce, and a delivery
|
|
303335
|
+
* the Environment already ran and rejected. `claudeUsageRefreshFailure.ts` has
|
|
303336
|
+
* to collapse all three into `CLAUDE_USAGE_CREDENTIAL_NOT_READY`, because the
|
|
303337
|
+
* refresh response carries nothing that separates them. The card then says
|
|
303338
|
+
* "not applied yet", which asks the user to wait even when waiting can never
|
|
303339
|
+
* work: on 2026-09-08 CMMD's reconciler failed native credential validation on
|
|
303340
|
+
* runtime 523cd771 forty-three times in seventy-two minutes, and the card said
|
|
303341
|
+
* "yet" through all of it.
|
|
303342
|
+
*
|
|
303343
|
+
* The runtime readiness read is the one source that separates the worlds, so
|
|
303344
|
+
* the handler makes that read only for the collapsed code and hands the answer
|
|
303345
|
+
* here. Every sentence is written in `claudeUsageRefreshFailure.ts`; nothing
|
|
303346
|
+
* from CMMD's `lastErrorCode` or `lastErrorMessage` is repeated to a browser.
|
|
303347
|
+
*/
|
|
303348
|
+
const CMMD_READINESS_PATH_PREFIX = "/api/forge/context/providers/claude/runtime-readiness/";
|
|
303349
|
+
/** Typed as the gateway's absolute-path shape so the call site needs no cast. */
|
|
303350
|
+
function claudeUsageReadinessPath(runtimeId) {
|
|
303351
|
+
return `${CMMD_READINESS_PATH_PREFIX}${encodeURIComponent(runtimeId)}`;
|
|
303352
|
+
}
|
|
303353
|
+
/**
|
|
303354
|
+
* Whether a readiness read would tell the caller anything it does not know.
|
|
303355
|
+
*
|
|
303356
|
+
* Only the collapsed code is ambiguous. Every other failure already names its
|
|
303357
|
+
* own cause, so asking CMMD again would cost a round trip on the error path
|
|
303358
|
+
* and could only produce a less specific answer.
|
|
303359
|
+
*/
|
|
303360
|
+
function claudeUsageFailureWantsReadiness(failure) {
|
|
303361
|
+
return failure.body.code === "CLAUDE_USAGE_CREDENTIAL_NOT_READY";
|
|
303362
|
+
}
|
|
303363
|
+
function asRecord$3(value) {
|
|
303364
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
303365
|
+
}
|
|
303366
|
+
function readString(value) {
|
|
303367
|
+
return typeof value === "string" && value !== "" ? value : null;
|
|
303368
|
+
}
|
|
303369
|
+
/**
|
|
303370
|
+
* Refines the collapsed credential failure using the runtime's readiness.
|
|
303371
|
+
*
|
|
303372
|
+
* The ranking is by what the user can act on, not by which field looks most
|
|
303373
|
+
* severe:
|
|
303374
|
+
*
|
|
303375
|
+
* 1. A reason of `credential_reconnect_required` or `credential_not_connected`
|
|
303376
|
+
* means CMMD holds no usable grant. That is upstream of delivery, so it wins
|
|
303377
|
+
* even when the delivery it caused also failed. No re-delivery helps; only a
|
|
303378
|
+
* reconnect does.
|
|
303379
|
+
* 2. `deliveryStatus: "failed"` means CMMD had a credential, sent it, and the
|
|
303380
|
+
* Environment rejected it. Waiting cannot fix that, which is exactly what
|
|
303381
|
+
* the collapsed sentence tells the user to do.
|
|
303382
|
+
* 3. `credential_expired_refreshing` means a replacement is already in flight,
|
|
303383
|
+
* so the honest instruction is to retry shortly.
|
|
303384
|
+
*
|
|
303385
|
+
* Anything else, including a readiness read that failed or answered a shape
|
|
303386
|
+
* this module does not recognise, keeps the collapsed failure. A refinement
|
|
303387
|
+
* that guessed would be worse than the vague sentence it replaced.
|
|
303388
|
+
*/
|
|
303389
|
+
function refineClaudeUsageRefreshFailure(failure, rawReadiness) {
|
|
303390
|
+
if (!claudeUsageFailureWantsReadiness(failure)) return failure;
|
|
303391
|
+
const readiness = asRecord$3(asRecord$3(rawReadiness)?.["data"]);
|
|
303392
|
+
if (readiness === null) return failure;
|
|
303393
|
+
const reasonCode = claudeReadinessReasonCode(readString(readiness["reason"]));
|
|
303394
|
+
if (reasonCode === "CREDENTIAL_RECONNECT_REQUIRED") return describeClaudeUsageRefreshFailureCode("CLAUDE_USAGE_RECONNECT_REQUIRED", 409);
|
|
303395
|
+
if (readiness["deliveryStatus"] === "failed") return describeClaudeUsageRefreshFailureCode("CLAUDE_USAGE_CREDENTIAL_APPLY_FAILED", 503);
|
|
303396
|
+
if (reasonCode === "CREDENTIAL_EXPIRED_REFRESHING") return describeClaudeUsageRefreshFailureCode("CLAUDE_USAGE_CREDENTIAL_REFRESHING", 503);
|
|
303397
|
+
return failure;
|
|
303398
|
+
}
|
|
303399
|
+
//#endregion
|
|
303306
303400
|
//#region src/command/wsToken.ts
|
|
303307
303401
|
/**
|
|
303308
303402
|
* Build the WS token response given an optional PAT and the configured CMMD
|
|
@@ -305168,6 +305262,25 @@ function buildClaudeUsageRefreshErrorResponse(error) {
|
|
|
305168
305262
|
const failure = describeClaudeUsageRefreshFailure(error);
|
|
305169
305263
|
return require_HttpServer.jsonUnsafe(failure.body, { status: failure.status });
|
|
305170
305264
|
}
|
|
305265
|
+
/**
|
|
305266
|
+
* Answers a refresh CMMD refused, asking the selected runtime what state its
|
|
305267
|
+
* Claude credential is in when the refusal alone cannot say. Only the collapsed
|
|
305268
|
+
* credential code costs the extra read, and a readiness read that itself fails
|
|
305269
|
+
* leaves the original answer untouched.
|
|
305270
|
+
*/
|
|
305271
|
+
function answerBlockedClaudeUsageRefresh(input) {
|
|
305272
|
+
return require_Schema$1.gen(function* () {
|
|
305273
|
+
const failure = describeClaudeUsageRefreshFailure(input.error);
|
|
305274
|
+
if (!claudeUsageFailureWantsReadiness(failure)) return require_HttpServer.jsonUnsafe(failure.body, { status: failure.status });
|
|
305275
|
+
const readinessOutcome = yield* runCmmdRestProxy(input.session, (jwt) => cmmdGateway.request({
|
|
305276
|
+
method: "GET",
|
|
305277
|
+
jwt,
|
|
305278
|
+
path: claudeUsageReadinessPath(input.runtimeId)
|
|
305279
|
+
}), { jwt: input.requestJwt });
|
|
305280
|
+
const refined = refineClaudeUsageRefreshFailure(failure, readinessOutcome.ok ? readinessOutcome.value : null);
|
|
305281
|
+
return require_HttpServer.jsonUnsafe(refined.body, { status: refined.status });
|
|
305282
|
+
});
|
|
305283
|
+
}
|
|
305171
305284
|
function makeRefreshProviderUsageHandler(dependencies = {}) {
|
|
305172
305285
|
return require_Schema$1.gen(function* () {
|
|
305173
305286
|
const request = yield* require_HttpServer.HttpServerRequest;
|
|
@@ -305204,7 +305317,12 @@ function makeRefreshProviderUsageHandler(dependencies = {}) {
|
|
|
305204
305317
|
body: { providerAccountId: input.providerAccountId },
|
|
305205
305318
|
orgId: String(target.organizationId)
|
|
305206
305319
|
}), { jwt: requestJwt });
|
|
305207
|
-
if (!refreshOutcome.ok) return
|
|
305320
|
+
if (!refreshOutcome.ok) return yield* answerBlockedClaudeUsageRefresh({
|
|
305321
|
+
session,
|
|
305322
|
+
requestJwt,
|
|
305323
|
+
runtimeId: target.runtimeId,
|
|
305324
|
+
error: refreshOutcome.error
|
|
305325
|
+
});
|
|
305208
305326
|
const snapshotOutcome = yield* runCmmdRestProxy(session, (jwt) => cmmdGateway.request({
|
|
305209
305327
|
method: "GET",
|
|
305210
305328
|
jwt,
|
|
@@ -305303,6 +305421,22 @@ registerProxyRoute({
|
|
|
305303
305421
|
responseShape: "unwrapData",
|
|
305304
305422
|
successStatus: 200
|
|
305305
305423
|
});
|
|
305424
|
+
registerProxyRoute({
|
|
305425
|
+
forgePath: "/api/cmmd/forge-runtimes/:runtimeId/execution-intents",
|
|
305426
|
+
method: "POST",
|
|
305427
|
+
cmmdPath: "/api/forge/context/runtimes/:runtimeId/execution-intents",
|
|
305428
|
+
orgIdSource: "none",
|
|
305429
|
+
responseShape: "unwrapData",
|
|
305430
|
+
successStatus: 200
|
|
305431
|
+
});
|
|
305432
|
+
registerProxyRoute({
|
|
305433
|
+
forgePath: "/api/cmmd/forge-runtimes/:runtimeId/execution-intents/:intentId/dispatched",
|
|
305434
|
+
method: "POST",
|
|
305435
|
+
cmmdPath: "/api/forge/context/runtimes/:runtimeId/execution-intents/:intentId/dispatched",
|
|
305436
|
+
orgIdSource: "none",
|
|
305437
|
+
responseShape: "unwrapData",
|
|
305438
|
+
successStatus: 200
|
|
305439
|
+
});
|
|
305306
305440
|
registerProxyRoute({
|
|
305307
305441
|
forgePath: "/api/cmmd/devices/:deviceId/revoke",
|
|
305308
305442
|
method: "POST",
|