@super-one/cli 0.55.2-alpha → 0.56.0-alpha
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/MANIFEST.json +2 -2
- package/lib/cli.mjs +782 -241
- package/package.json +10 -10
package/lib/cli.mjs
CHANGED
|
@@ -164,10 +164,105 @@ var init_host_actions = __esm({
|
|
|
164
164
|
});
|
|
165
165
|
|
|
166
166
|
// ../../packages/shared/src/environment/host-action-superone-descriptors.ts
|
|
167
|
-
var HOST_ACTION_SUPERONE_TOOL_DESCRIPTORS;
|
|
167
|
+
var deviceDescriptionProperty, deviceConditionSchema, deviceActionSchema, HOST_ACTION_SUPERONE_TOOL_DESCRIPTORS;
|
|
168
168
|
var init_host_action_superone_descriptors = __esm({
|
|
169
169
|
"../../packages/shared/src/environment/host-action-superone-descriptors.ts"() {
|
|
170
170
|
"use strict";
|
|
171
|
+
deviceDescriptionProperty = {
|
|
172
|
+
type: "string",
|
|
173
|
+
minLength: 1,
|
|
174
|
+
maxLength: 160,
|
|
175
|
+
description: "A short human-friendly explanation of what this step accomplishes, phrased for the user watching (e.g. 'Open the profile tab', 'Check the order total'). Shown in the UI in place of refs and coordinates. Write it in the conversation's language."
|
|
176
|
+
};
|
|
177
|
+
deviceConditionSchema = {
|
|
178
|
+
type: "object",
|
|
179
|
+
properties: {
|
|
180
|
+
kind: { type: "string", enum: ["exists", "notExists", "textEquals", "textContains"] },
|
|
181
|
+
ref: {
|
|
182
|
+
description: "Only valid within the snapshot it came from; prefer label or identifier when waiting.",
|
|
183
|
+
type: "string"
|
|
184
|
+
},
|
|
185
|
+
label: { description: "Visible name of the element.", type: "string" },
|
|
186
|
+
identifier: {
|
|
187
|
+
description: "Developer-assigned id. Survives copy changes and translation \u2014 the most durable target.",
|
|
188
|
+
type: "string"
|
|
189
|
+
},
|
|
190
|
+
text: {
|
|
191
|
+
description: "The string textEquals/textContains compares against. Required by those two kinds, and NOT a way to name an element \u2014 use label for that.",
|
|
192
|
+
type: "string",
|
|
193
|
+
minLength: 1
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
required: ["kind"],
|
|
197
|
+
additionalProperties: false
|
|
198
|
+
};
|
|
199
|
+
deviceActionSchema = {
|
|
200
|
+
type: "object",
|
|
201
|
+
properties: {
|
|
202
|
+
type: {
|
|
203
|
+
type: "string",
|
|
204
|
+
enum: ["tap", "doubleTap", "longPress", "swipe", "pinch", "press", "type", "key", "rotate", "keyboard"]
|
|
205
|
+
},
|
|
206
|
+
ref: { description: 'Element ref from the snapshot, e.g. "@e12". Preferred over coordinates.', type: "string" },
|
|
207
|
+
x: {
|
|
208
|
+
description: "Horizontal position as a fraction of the screen (0-1). Only when no ref fits.",
|
|
209
|
+
type: "number",
|
|
210
|
+
minimum: 0,
|
|
211
|
+
maximum: 1
|
|
212
|
+
},
|
|
213
|
+
y: {
|
|
214
|
+
description: "Vertical position as a fraction of the screen (0-1).",
|
|
215
|
+
type: "number",
|
|
216
|
+
minimum: 0,
|
|
217
|
+
maximum: 1
|
|
218
|
+
},
|
|
219
|
+
direction: {
|
|
220
|
+
description: 'swipe: which way the finger travels. Content moves the opposite way, so "up" scrolls down a list.',
|
|
221
|
+
type: "string",
|
|
222
|
+
enum: ["up", "down", "left", "right"]
|
|
223
|
+
},
|
|
224
|
+
distance: {
|
|
225
|
+
description: "swipe: travel as a fraction of the screen. Default 0.6.",
|
|
226
|
+
type: "number",
|
|
227
|
+
minimum: 0.05,
|
|
228
|
+
maximum: 1
|
|
229
|
+
},
|
|
230
|
+
toX: {
|
|
231
|
+
description: "swipe: explicit destination instead of direction.",
|
|
232
|
+
type: "number",
|
|
233
|
+
minimum: 0,
|
|
234
|
+
maximum: 1
|
|
235
|
+
},
|
|
236
|
+
toY: { type: "number", minimum: 0, maximum: 1 },
|
|
237
|
+
scale: {
|
|
238
|
+
description: "pinch: final separation factor. Below 1 pinches in (zoom out), above 1 spreads.",
|
|
239
|
+
type: "number",
|
|
240
|
+
minimum: 0.1,
|
|
241
|
+
maximum: 5
|
|
242
|
+
},
|
|
243
|
+
durationMs: {
|
|
244
|
+
description: "How long the gesture takes. Short swipes flick and coast; long ones drag and stop.",
|
|
245
|
+
type: "integer",
|
|
246
|
+
minimum: 16,
|
|
247
|
+
maximum: 1e4
|
|
248
|
+
},
|
|
249
|
+
text: {
|
|
250
|
+
description: "type: text to enter. Anything the simulated keyboard cannot spell (Chinese, emoji) is pasted automatically.",
|
|
251
|
+
type: "string"
|
|
252
|
+
},
|
|
253
|
+
button: { type: "string", enum: ["home", "lock", "side", "volume-up", "volume-down"] },
|
|
254
|
+
orientation: {
|
|
255
|
+
type: "string",
|
|
256
|
+
enum: ["portrait", "landscape-left", "portrait-upside-down", "landscape-right"]
|
|
257
|
+
},
|
|
258
|
+
connected: {
|
|
259
|
+
description: "keyboard: attach or detach the hardware keyboard. Detach it to make the on-screen keyboard appear.",
|
|
260
|
+
type: "boolean"
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
required: ["type"],
|
|
264
|
+
additionalProperties: false
|
|
265
|
+
};
|
|
171
266
|
HOST_ACTION_SUPERONE_TOOL_DESCRIPTORS = [
|
|
172
267
|
{
|
|
173
268
|
"name": "session_collab_list_agents",
|
|
@@ -3620,6 +3715,75 @@ If the tool returns an error containing "user_locked", the user has manually nam
|
|
|
3620
3715
|
],
|
|
3621
3716
|
"additionalProperties": false
|
|
3622
3717
|
}
|
|
3718
|
+
},
|
|
3719
|
+
{
|
|
3720
|
+
"name": "device_snapshot",
|
|
3721
|
+
"description": "Capture the screen and return a stateId later calls must quote. mode=semantic (default) returns the accessibility tree with @eN refs, labels, identifiers and bounds \u2014 prefer it: refs survive animation and rotation, coordinates do not. mode=visual saves a PNG and returns image.path (not pixels); Read it only if you need to look. mode=fused returns both. Waits for animation to stop first; settled=false means it was still moving, so treat geometry as approximate. A screen with no accessibility tree falls back to text read from pixels; the reply says source=ocr. Re-snapshot after anything that changes the screen \u2014 refs are positional and a stale stateId is rejected by device_act.",
|
|
3722
|
+
"inputSchema": {
|
|
3723
|
+
"type": "object",
|
|
3724
|
+
"properties": {
|
|
3725
|
+
"description": deviceDescriptionProperty,
|
|
3726
|
+
"mode": { "description": "Default semantic", "type": "string", "enum": ["semantic", "visual", "fused"] },
|
|
3727
|
+
"maxNodes": {
|
|
3728
|
+
"description": "Ceiling on tree size. Default 500; truncated=true means the screen has more.",
|
|
3729
|
+
"type": "integer",
|
|
3730
|
+
"minimum": 1,
|
|
3731
|
+
"maximum": 2e3
|
|
3732
|
+
}
|
|
3733
|
+
},
|
|
3734
|
+
"required": ["description"],
|
|
3735
|
+
"additionalProperties": false
|
|
3736
|
+
}
|
|
3737
|
+
},
|
|
3738
|
+
{
|
|
3739
|
+
"name": "device_query",
|
|
3740
|
+
"description": "Search or inspect an existing snapshot without re-capturing the device. Use this instead of taking another snapshot when you only need to find an element or read its details \u2014 it costs no device round trip and cannot race an animation. op=search matches text against labels, values and identifiers. op=inspect returns one element and its children.",
|
|
3741
|
+
"inputSchema": {
|
|
3742
|
+
"type": "object",
|
|
3743
|
+
"properties": {
|
|
3744
|
+
"description": deviceDescriptionProperty,
|
|
3745
|
+
"stateId": { "type": "string", "description": "From a prior device_snapshot." },
|
|
3746
|
+
"op": { "type": "string", "enum": ["search", "inspect"] },
|
|
3747
|
+
"text": { "description": "For search.", "type": "string" },
|
|
3748
|
+
"ref": { "description": 'For inspect, e.g. "@e12".', "type": "string" }
|
|
3749
|
+
},
|
|
3750
|
+
"required": ["description", "stateId", "op"],
|
|
3751
|
+
"additionalProperties": false
|
|
3752
|
+
}
|
|
3753
|
+
},
|
|
3754
|
+
{
|
|
3755
|
+
"name": "device_act",
|
|
3756
|
+
"description": "Run 1-10 touch actions against a snapshot, then re-observe to judge if they worked. Actions: tap, doubleTap, longPress, swipe(direction|toX/toY), pinch(scale), press(ref), type, key, rotate, keyboard. Prefer press for a ref-backed control; it goes through accessibility, immune to animation, rotation and scale (not on a source=ocr snapshot \u2014 tap there). Aim touch actions at refs too; raw x/y is a last resort. The whole batch, stale stateId included, is validated up front. rotate ends the snapshot it is in: put it last, then re-snapshot \u2014 a later ref or coordinate is refused. Returns worked|didnt|unknown; unknown means input landed but nothing visibly changed. Pass expect to define success.",
|
|
3757
|
+
"inputSchema": {
|
|
3758
|
+
"type": "object",
|
|
3759
|
+
"properties": {
|
|
3760
|
+
"description": deviceDescriptionProperty,
|
|
3761
|
+
"stateId": { "type": "string" },
|
|
3762
|
+
"actions": { "minItems": 1, "maxItems": 10, "type": "array", "items": deviceActionSchema },
|
|
3763
|
+
"expect": { "description": "Postcondition checked after the actions run.", ...deviceConditionSchema }
|
|
3764
|
+
},
|
|
3765
|
+
"required": ["description", "stateId", "actions"],
|
|
3766
|
+
"additionalProperties": false
|
|
3767
|
+
}
|
|
3768
|
+
},
|
|
3769
|
+
{
|
|
3770
|
+
"name": "device_wait_for",
|
|
3771
|
+
"description": "Wait until the screen satisfies a condition. Use this instead of snapshotting in a loop. Distinguishes preexisting (already true when asked) from verified (became true while waiting), so you can tell a real transition from a check that was never going to fail. Returns a fresh settled stateId and matching tree when successful. Target the element by label or identifier, not by ref: refs belong to one snapshot, and what you are waiting for usually does not exist yet. Every condition must name an element that way \u2014 text only says what to compare, it never selects.",
|
|
3772
|
+
"inputSchema": {
|
|
3773
|
+
"type": "object",
|
|
3774
|
+
"properties": {
|
|
3775
|
+
"description": deviceDescriptionProperty,
|
|
3776
|
+
"condition": deviceConditionSchema,
|
|
3777
|
+
"timeoutMs": {
|
|
3778
|
+
"description": "Default 5000",
|
|
3779
|
+
"type": "integer",
|
|
3780
|
+
"minimum": 100,
|
|
3781
|
+
"maximum": 6e4
|
|
3782
|
+
}
|
|
3783
|
+
},
|
|
3784
|
+
"required": ["description", "condition"],
|
|
3785
|
+
"additionalProperties": false
|
|
3786
|
+
}
|
|
3623
3787
|
}
|
|
3624
3788
|
];
|
|
3625
3789
|
}
|
|
@@ -3693,6 +3857,9 @@ var init_host_action_browser_catalog = __esm({
|
|
|
3693
3857
|
"widget_list_templates",
|
|
3694
3858
|
"miniapp_list",
|
|
3695
3859
|
"automation_list",
|
|
3860
|
+
"device_snapshot",
|
|
3861
|
+
"device_query",
|
|
3862
|
+
"device_wait_for",
|
|
3696
3863
|
// session_collab_* are node-local (not HA); list_agents stays "safe" if ever reclassified
|
|
3697
3864
|
"computer_apps",
|
|
3698
3865
|
"computer_snapshot",
|
|
@@ -20267,6 +20434,45 @@ function readString3(value) {
|
|
|
20267
20434
|
function readBoolean2(value) {
|
|
20268
20435
|
return typeof value === "boolean" ? value : null;
|
|
20269
20436
|
}
|
|
20437
|
+
function parseAccountAuthMode(value) {
|
|
20438
|
+
switch (value) {
|
|
20439
|
+
case "apiKey":
|
|
20440
|
+
case "chatgpt":
|
|
20441
|
+
case "chatgptAuthTokens":
|
|
20442
|
+
case "agentIdentity":
|
|
20443
|
+
case "personalAccessToken":
|
|
20444
|
+
case "amazonBedrock":
|
|
20445
|
+
case "bedrockApiKey":
|
|
20446
|
+
return value;
|
|
20447
|
+
default:
|
|
20448
|
+
return null;
|
|
20449
|
+
}
|
|
20450
|
+
}
|
|
20451
|
+
function parseAccountStatus(raw) {
|
|
20452
|
+
const account = asRecord3(raw.account);
|
|
20453
|
+
return {
|
|
20454
|
+
signedIn: account !== null,
|
|
20455
|
+
authMode: parseAccountAuthMode(account?.type),
|
|
20456
|
+
email: readString3(account?.email),
|
|
20457
|
+
planType: readString3(account?.planType),
|
|
20458
|
+
requiresOpenaiAuth: readBoolean2(raw.requiresOpenaiAuth) ?? false
|
|
20459
|
+
};
|
|
20460
|
+
}
|
|
20461
|
+
function parseAccountLoginStart(raw) {
|
|
20462
|
+
const loginId = readString3(raw.loginId);
|
|
20463
|
+
const type = readString3(raw.type);
|
|
20464
|
+
if (!loginId || type !== "chatgpt" && type !== "chatgptDeviceCode") {
|
|
20465
|
+
throw new Error("Codex returned an invalid account login response");
|
|
20466
|
+
}
|
|
20467
|
+
const result = { type, loginId };
|
|
20468
|
+
const authUrl = readString3(raw.authUrl);
|
|
20469
|
+
const verificationUrl = readString3(raw.verificationUrl);
|
|
20470
|
+
const userCode = readString3(raw.userCode);
|
|
20471
|
+
if (authUrl) result.authUrl = authUrl;
|
|
20472
|
+
if (verificationUrl) result.verificationUrl = verificationUrl;
|
|
20473
|
+
if (userCode) result.userCode = userCode;
|
|
20474
|
+
return result;
|
|
20475
|
+
}
|
|
20270
20476
|
function readFiniteNumber(value) {
|
|
20271
20477
|
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
20272
20478
|
}
|
|
@@ -20367,6 +20573,37 @@ async function readRateLimits(client3) {
|
|
|
20367
20573
|
throw safePublicError("account/rateLimits/read failed", err);
|
|
20368
20574
|
}
|
|
20369
20575
|
}
|
|
20576
|
+
async function readAccountStatus(client3, refreshToken = false) {
|
|
20577
|
+
try {
|
|
20578
|
+
return parseAccountStatus(await client3.request("account/read", { refreshToken }));
|
|
20579
|
+
} catch (err) {
|
|
20580
|
+
throw safePublicError("account/read failed", err);
|
|
20581
|
+
}
|
|
20582
|
+
}
|
|
20583
|
+
async function startAccountLogin(client3, type) {
|
|
20584
|
+
try {
|
|
20585
|
+
return parseAccountLoginStart(await client3.request(
|
|
20586
|
+
"account/login/start",
|
|
20587
|
+
type === "chatgpt" ? { type, useHostedLoginSuccessPage: true, appBrand: "chatgpt" } : { type }
|
|
20588
|
+
));
|
|
20589
|
+
} catch (err) {
|
|
20590
|
+
throw safePublicError("account/login/start failed", err);
|
|
20591
|
+
}
|
|
20592
|
+
}
|
|
20593
|
+
async function cancelAccountLogin(client3, loginId) {
|
|
20594
|
+
try {
|
|
20595
|
+
await client3.request("account/login/cancel", { loginId });
|
|
20596
|
+
} catch (err) {
|
|
20597
|
+
throw safePublicError("account/login/cancel failed", err);
|
|
20598
|
+
}
|
|
20599
|
+
}
|
|
20600
|
+
async function logoutAccount(client3) {
|
|
20601
|
+
try {
|
|
20602
|
+
await client3.request("account/logout");
|
|
20603
|
+
} catch (err) {
|
|
20604
|
+
throw safePublicError("account/logout failed", err);
|
|
20605
|
+
}
|
|
20606
|
+
}
|
|
20370
20607
|
async function readAccountUsage(client3) {
|
|
20371
20608
|
try {
|
|
20372
20609
|
const result = await client3.request("account/usage/read");
|
|
@@ -20618,7 +20855,7 @@ function isStaticHostOwnedSuperoneToolQualified(qualifiedName) {
|
|
|
20618
20855
|
const bare = qualifiedName.slice(MCP_SUPERONE_TOOL_PREFIX.length);
|
|
20619
20856
|
return isStaticHostOwnedSuperoneBareName(bare);
|
|
20620
20857
|
}
|
|
20621
|
-
var MCP_SUPERONE_TOOL_PREFIX, BROWSER_PRIMITIVE_TOOL_NAMES, BROWSER_ACTION_TOOL_NAMES, BROWSER_LEGACY_TOOL_NAMES, BROWSER_COMPACT_TOOL_NAMES, BROWSER_TOOL_NAMES, BUILT_IN_SUPERONE_TOOL_NAMES, MOBILE_SHARE_FILE_TOOL_NAME, MINIAPP_LIST_BARE_NAME, MINIAPP_CALL_BARE_NAME, STATIC_HOST_OWNED_SUPERONE_QUALIFIED_TOOL_NAMES;
|
|
20858
|
+
var MCP_SUPERONE_TOOL_PREFIX, BROWSER_PRIMITIVE_TOOL_NAMES, BROWSER_ACTION_TOOL_NAMES, BROWSER_LEGACY_TOOL_NAMES, BROWSER_COMPACT_TOOL_NAMES, BROWSER_TOOL_NAMES, DEVICE_AGENT_TOOL_NAMES, BUILT_IN_SUPERONE_TOOL_NAMES, MOBILE_SHARE_FILE_TOOL_NAME, MINIAPP_LIST_BARE_NAME, MINIAPP_CALL_BARE_NAME, STATIC_HOST_OWNED_SUPERONE_QUALIFIED_TOOL_NAMES;
|
|
20622
20859
|
var init_superone_host_owned_tools = __esm({
|
|
20623
20860
|
"../../packages/shared/src/superone-host-owned-tools.ts"() {
|
|
20624
20861
|
"use strict";
|
|
@@ -20679,6 +20916,12 @@ var init_superone_host_owned_tools = __esm({
|
|
|
20679
20916
|
(name) => !BROWSER_LEGACY_TOOL_NAMES.includes(name)
|
|
20680
20917
|
)
|
|
20681
20918
|
];
|
|
20919
|
+
DEVICE_AGENT_TOOL_NAMES = [
|
|
20920
|
+
"device_snapshot",
|
|
20921
|
+
"device_query",
|
|
20922
|
+
"device_act",
|
|
20923
|
+
"device_wait_for"
|
|
20924
|
+
];
|
|
20682
20925
|
BUILT_IN_SUPERONE_TOOL_NAMES = [
|
|
20683
20926
|
"read_manual",
|
|
20684
20927
|
"miniapp_dev_setup",
|
|
@@ -20709,7 +20952,8 @@ var init_superone_host_owned_tools = __esm({
|
|
|
20709
20952
|
"automation_list",
|
|
20710
20953
|
"automation_apply",
|
|
20711
20954
|
"automation_delete",
|
|
20712
|
-
...BROWSER_TOOL_NAMES
|
|
20955
|
+
...BROWSER_TOOL_NAMES,
|
|
20956
|
+
...DEVICE_AGENT_TOOL_NAMES
|
|
20713
20957
|
];
|
|
20714
20958
|
MOBILE_SHARE_FILE_TOOL_NAME = "mobile_share_file";
|
|
20715
20959
|
MINIAPP_LIST_BARE_NAME = "miniapp_list";
|
|
@@ -21182,6 +21426,7 @@ function createClaudeAgentEventMapper(options) {
|
|
|
21182
21426
|
outputStyle: system.output_style,
|
|
21183
21427
|
availableOutputStyles: system.available_output_styles,
|
|
21184
21428
|
plugins: system.plugins,
|
|
21429
|
+
...system.effort !== void 0 ? { appliedEffort: system.effort } : {},
|
|
21185
21430
|
fastModeState: system.fast_mode_state,
|
|
21186
21431
|
fastModeDisabledReason: system.fast_mode_disabled_reason
|
|
21187
21432
|
}
|
|
@@ -21716,6 +21961,94 @@ var init_root_permission_guard = __esm({
|
|
|
21716
21961
|
}
|
|
21717
21962
|
});
|
|
21718
21963
|
|
|
21964
|
+
// ../../packages/shared/src/ask-user-question.ts
|
|
21965
|
+
function asQuestionPreviewFormat(value) {
|
|
21966
|
+
const v2 = value?.trim();
|
|
21967
|
+
return v2 === "markdown" || v2 === "html" ? v2 : void 0;
|
|
21968
|
+
}
|
|
21969
|
+
function buildAnsweredQuestionInput(params) {
|
|
21970
|
+
const { questions, answers, previewFormat } = params;
|
|
21971
|
+
const annotations = { ...params.annotations };
|
|
21972
|
+
for (const q of questions) {
|
|
21973
|
+
const answer = answers[q.question];
|
|
21974
|
+
if (!answer) continue;
|
|
21975
|
+
const lastLabel = q.multiSelect ? answer.split(", ").pop() : answer;
|
|
21976
|
+
const selected = q.options?.find((o) => o.label === lastLabel);
|
|
21977
|
+
if (selected?.preview) {
|
|
21978
|
+
annotations[q.question] = { ...annotations[q.question], preview: selected.preview };
|
|
21979
|
+
}
|
|
21980
|
+
}
|
|
21981
|
+
return {
|
|
21982
|
+
questions,
|
|
21983
|
+
answers,
|
|
21984
|
+
...Object.keys(annotations).length > 0 && { annotations },
|
|
21985
|
+
...previewFormat ? { previewFormat } : {}
|
|
21986
|
+
};
|
|
21987
|
+
}
|
|
21988
|
+
function answeredQuestionDelta(messageId, toolUseId, input) {
|
|
21989
|
+
return {
|
|
21990
|
+
type: "content_delta",
|
|
21991
|
+
messageId,
|
|
21992
|
+
delta: {
|
|
21993
|
+
type: "tool_use",
|
|
21994
|
+
toolName: "AskUserQuestion",
|
|
21995
|
+
toolUseId,
|
|
21996
|
+
input: JSON.stringify(input)
|
|
21997
|
+
}
|
|
21998
|
+
};
|
|
21999
|
+
}
|
|
22000
|
+
var init_ask_user_question = __esm({
|
|
22001
|
+
"../../packages/shared/src/ask-user-question.ts"() {
|
|
22002
|
+
"use strict";
|
|
22003
|
+
}
|
|
22004
|
+
});
|
|
22005
|
+
|
|
22006
|
+
// ../../packages/claude/src/ask-user-question-bridge.ts
|
|
22007
|
+
function asRecord5(value) {
|
|
22008
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
22009
|
+
}
|
|
22010
|
+
async function resolveAskUserQuestion(params) {
|
|
22011
|
+
const { onQuestion, interactionId, toolName, toolUseId, input } = params;
|
|
22012
|
+
if (!onQuestion) {
|
|
22013
|
+
return { behavior: "deny", message: "Question denied by SuperOne node (no question handler)" };
|
|
22014
|
+
}
|
|
22015
|
+
const previewFormat = asQuestionPreviewFormat(params.previewFormat);
|
|
22016
|
+
const rawInput = asRecord5(input);
|
|
22017
|
+
const baseInput = rawInput ? { ...rawInput, ...previewFormat ? { previewFormat } : {} } : null;
|
|
22018
|
+
const answer = await onQuestion({
|
|
22019
|
+
interactionId,
|
|
22020
|
+
kind: "question",
|
|
22021
|
+
toolName,
|
|
22022
|
+
toolUseId,
|
|
22023
|
+
input: baseInput ?? void 0
|
|
22024
|
+
});
|
|
22025
|
+
const record2 = asRecord5(answer);
|
|
22026
|
+
const answers = record2 && "answers" in record2 ? record2.answers : answer;
|
|
22027
|
+
const answerMap = asRecord5(answers);
|
|
22028
|
+
const updatedInput = {
|
|
22029
|
+
...baseInput,
|
|
22030
|
+
...buildAnsweredQuestionInput({
|
|
22031
|
+
questions: Array.isArray(baseInput?.questions) ? baseInput.questions : [],
|
|
22032
|
+
answers: answerMap ?? {},
|
|
22033
|
+
annotations: record2?.annotations,
|
|
22034
|
+
previewFormat
|
|
22035
|
+
}),
|
|
22036
|
+
// Preserve the host's answer shape verbatim — it is not always a record.
|
|
22037
|
+
answers
|
|
22038
|
+
};
|
|
22039
|
+
const messageId = params.getMessageId?.();
|
|
22040
|
+
if (messageId && toolUseId && params.emitAgentEvent) {
|
|
22041
|
+
params.emitAgentEvent(answeredQuestionDelta(messageId, toolUseId, updatedInput));
|
|
22042
|
+
}
|
|
22043
|
+
return { behavior: "allow", updatedInput };
|
|
22044
|
+
}
|
|
22045
|
+
var init_ask_user_question_bridge = __esm({
|
|
22046
|
+
"../../packages/claude/src/ask-user-question-bridge.ts"() {
|
|
22047
|
+
"use strict";
|
|
22048
|
+
init_ask_user_question();
|
|
22049
|
+
}
|
|
22050
|
+
});
|
|
22051
|
+
|
|
21719
22052
|
// ../../packages/claude/src/run-sdk-turn.ts
|
|
21720
22053
|
import { query as sdkQuery } from "@anthropic-ai/claude-agent-sdk";
|
|
21721
22054
|
var init_run_sdk_turn = __esm({
|
|
@@ -21727,6 +22060,8 @@ var init_run_sdk_turn = __esm({
|
|
|
21727
22060
|
init_agent_event_mapper2();
|
|
21728
22061
|
init_resolve_sdk_binary();
|
|
21729
22062
|
init_root_permission_guard();
|
|
22063
|
+
init_ask_user_question_bridge();
|
|
22064
|
+
init_ask_user_question();
|
|
21730
22065
|
}
|
|
21731
22066
|
});
|
|
21732
22067
|
|
|
@@ -21800,7 +22135,7 @@ var init_message_bridge = __esm({
|
|
|
21800
22135
|
import { existsSync as existsSync18 } from "node:fs";
|
|
21801
22136
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
21802
22137
|
import { query as sdkQuery2 } from "@anthropic-ai/claude-agent-sdk";
|
|
21803
|
-
function buildLiveOptions(opts, onPermission, onQuestion, onPlan, signal, timing) {
|
|
22138
|
+
function buildLiveOptions(opts, onPermission, onQuestion, onPlan, signal, timing, turn) {
|
|
21804
22139
|
const abortController = new AbortController();
|
|
21805
22140
|
if (signal.aborted) abortController.abort();
|
|
21806
22141
|
else signal.addEventListener("abort", () => abortController.abort(), { once: true });
|
|
@@ -21813,26 +22148,16 @@ function buildLiveOptions(opts, onPermission, onQuestion, onPlan, signal, timing
|
|
|
21813
22148
|
}
|
|
21814
22149
|
const interactionId = typeof toolOpts.requestId === "string" && toolOpts.requestId || typeof toolOpts.toolUseID === "string" && toolOpts.toolUseID || `interaction_${Date.now()}`;
|
|
21815
22150
|
if (toolName === "AskUserQuestion") {
|
|
21816
|
-
|
|
21817
|
-
|
|
21818
|
-
}
|
|
21819
|
-
const answer = await onQuestion({
|
|
22151
|
+
return resolveAskUserQuestion({
|
|
22152
|
+
onQuestion,
|
|
21820
22153
|
interactionId,
|
|
21821
|
-
kind: "question",
|
|
21822
22154
|
toolName,
|
|
21823
22155
|
toolUseId: typeof toolOpts.toolUseID === "string" ? toolOpts.toolUseID : void 0,
|
|
21824
|
-
input
|
|
22156
|
+
input,
|
|
22157
|
+
previewFormat: opts.askUserQuestionPreviewFormat,
|
|
22158
|
+
emitAgentEvent: turn.emitAgentEvent,
|
|
22159
|
+
getMessageId: turn.getMessageId
|
|
21825
22160
|
});
|
|
21826
|
-
const record2 = answer && typeof answer === "object" ? answer : null;
|
|
21827
|
-
const answers = record2 && "answers" in record2 ? record2.answers : answer;
|
|
21828
|
-
return {
|
|
21829
|
-
behavior: "allow",
|
|
21830
|
-
updatedInput: {
|
|
21831
|
-
...input && typeof input === "object" ? input : {},
|
|
21832
|
-
answers,
|
|
21833
|
-
...record2 && record2.annotations !== void 0 ? { annotations: record2.annotations } : {}
|
|
21834
|
-
}
|
|
21835
|
-
};
|
|
21836
22161
|
}
|
|
21837
22162
|
if (toolName === "ExitPlanMode") {
|
|
21838
22163
|
if (!onPlan) {
|
|
@@ -21900,6 +22225,7 @@ function buildLiveOptions(opts, onPermission, onQuestion, onPlan, signal, timing
|
|
|
21900
22225
|
...sandbox ? { sandbox } : {},
|
|
21901
22226
|
...opts.additionalDirectories && opts.additionalDirectories.length > 0 ? { additionalDirectories: opts.additionalDirectories } : {},
|
|
21902
22227
|
...opts.enabledSkills && opts.enabledSkills.length > 0 ? { skills: opts.enabledSkills } : {},
|
|
22228
|
+
...asQuestionPreviewFormat(opts.askUserQuestionPreviewFormat) ? { toolConfig: { askUserQuestion: { previewFormat: asQuestionPreviewFormat(opts.askUserQuestionPreviewFormat) } } } : {},
|
|
21903
22229
|
systemPrompt: {
|
|
21904
22230
|
type: "preset",
|
|
21905
22231
|
preset: "claude_code",
|
|
@@ -21936,6 +22262,8 @@ var init_claude_live_session = __esm({
|
|
|
21936
22262
|
init_map_sdk_message();
|
|
21937
22263
|
init_resolve_sdk_binary();
|
|
21938
22264
|
init_root_permission_guard();
|
|
22265
|
+
init_ask_user_question_bridge();
|
|
22266
|
+
init_ask_user_question();
|
|
21939
22267
|
init_superone_system_prompt();
|
|
21940
22268
|
init_superone_host_owned_tools();
|
|
21941
22269
|
ClaudeLiveSession = class _ClaudeLiveSession {
|
|
@@ -21959,7 +22287,11 @@ var init_claude_live_session = __esm({
|
|
|
21959
22287
|
return this.planHandler(req);
|
|
21960
22288
|
},
|
|
21961
22289
|
this.processAbort.signal,
|
|
21962
|
-
this.timing
|
|
22290
|
+
this.timing,
|
|
22291
|
+
{
|
|
22292
|
+
emitAgentEvent: (e) => this.active?.input.onAgentEvent?.(e),
|
|
22293
|
+
getMessageId: () => this.active?.messageId
|
|
22294
|
+
}
|
|
21963
22295
|
);
|
|
21964
22296
|
const q = queryFn({ prompt: this.bridge, options });
|
|
21965
22297
|
this.iterationDone = this.iterate(q);
|
|
@@ -22481,7 +22813,7 @@ var init_content_delta = __esm({
|
|
|
22481
22813
|
});
|
|
22482
22814
|
|
|
22483
22815
|
// ../../packages/shared/src/node-session-event-map.ts
|
|
22484
|
-
function
|
|
22816
|
+
function asRecord6(value) {
|
|
22485
22817
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
22486
22818
|
return value;
|
|
22487
22819
|
}
|
|
@@ -22513,7 +22845,7 @@ function stamp(event, ctx, sequence) {
|
|
|
22513
22845
|
}
|
|
22514
22846
|
function mapQuestionRequest(payload, fallbackId) {
|
|
22515
22847
|
const interactionId = asString2(payload.interactionId) ?? asString2(payload.requestId) ?? fallbackId;
|
|
22516
|
-
const input =
|
|
22848
|
+
const input = asRecord6(payload.input);
|
|
22517
22849
|
const rawQuestions = Array.isArray(payload.questions) ? payload.questions : Array.isArray(input.questions) ? input.questions : [];
|
|
22518
22850
|
const questions = [];
|
|
22519
22851
|
for (const q of rawQuestions) {
|
|
@@ -22552,7 +22884,7 @@ function mapQuestionRequest(payload, fallbackId) {
|
|
|
22552
22884
|
}
|
|
22553
22885
|
function mapPlanRequest(payload, fallbackId) {
|
|
22554
22886
|
const interactionId = asString2(payload.interactionId) ?? asString2(payload.requestId) ?? fallbackId;
|
|
22555
|
-
const input =
|
|
22887
|
+
const input = asRecord6(payload.input);
|
|
22556
22888
|
let planContent = asString2(payload.plan) ?? asString2(payload.planContent) ?? asString2(input.plan) ?? asString2(input.planContent) ?? "";
|
|
22557
22889
|
if (!planContent && input.plan && typeof input.plan === "object") {
|
|
22558
22890
|
try {
|
|
@@ -22618,7 +22950,7 @@ function createNodeSessionEventMapper(ctx) {
|
|
|
22618
22950
|
if (envelope.aggregateType && envelope.aggregateType !== "session") return [];
|
|
22619
22951
|
if (envelope.aggregateId && envelope.aggregateId !== ctx.sessionId) return [];
|
|
22620
22952
|
const eventType = envelope.eventType;
|
|
22621
|
-
const payload =
|
|
22953
|
+
const payload = asRecord6(envelope.payload);
|
|
22622
22954
|
const out = [];
|
|
22623
22955
|
const push = (event) => {
|
|
22624
22956
|
out.push(stamp(event, ctx, envelope.sequence));
|
|
@@ -22644,7 +22976,7 @@ function createNodeSessionEventMapper(ctx) {
|
|
|
22644
22976
|
break;
|
|
22645
22977
|
}
|
|
22646
22978
|
case SESSION_DURABLE_EVENT.agentEvent: {
|
|
22647
|
-
const rawEvent =
|
|
22979
|
+
const rawEvent = asRecord6(payload.event);
|
|
22648
22980
|
const type = asString2(rawEvent.type);
|
|
22649
22981
|
if (!type) break;
|
|
22650
22982
|
const eventRecord = { ...rawEvent };
|
|
@@ -22654,7 +22986,7 @@ function createNodeSessionEventMapper(ctx) {
|
|
|
22654
22986
|
delete eventRecord.seq;
|
|
22655
22987
|
delete eventRecord.epoch;
|
|
22656
22988
|
const event = eventRecord;
|
|
22657
|
-
const rawMessageId = type === "message_start" ? asString2(
|
|
22989
|
+
const rawMessageId = type === "message_start" ? asString2(asRecord6(eventRecord.message).id) : asString2(eventRecord.messageId);
|
|
22658
22990
|
if (type === "message_start" && rawMessageId) {
|
|
22659
22991
|
startedAssistantIds.add(rawMessageId);
|
|
22660
22992
|
lastAssistantId = rawMessageId;
|
|
@@ -22832,7 +23164,7 @@ function createNodeSessionEventMapper(ctx) {
|
|
|
22832
23164
|
requestId: interactionId,
|
|
22833
23165
|
toolName,
|
|
22834
23166
|
toolUseId: asString2(payload.toolUseId),
|
|
22835
|
-
input:
|
|
23167
|
+
input: asRecord6(payload.input),
|
|
22836
23168
|
allowAlwaysAllow: requestKind === "session_agents_confirm" ? false : payload.allowAlwaysAllow !== false,
|
|
22837
23169
|
...requestKind ? {
|
|
22838
23170
|
requestKind
|
|
@@ -22937,7 +23269,7 @@ var init_node_session_event_map = __esm({
|
|
|
22937
23269
|
});
|
|
22938
23270
|
|
|
22939
23271
|
// ../../packages/runtime/src/session/message-catalog.ts
|
|
22940
|
-
function
|
|
23272
|
+
function asRecord7(value) {
|
|
22941
23273
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
22942
23274
|
return value;
|
|
22943
23275
|
}
|
|
@@ -23020,7 +23352,7 @@ function collectToolsByAssistantId(events, sessionId) {
|
|
|
23020
23352
|
for (const ev of events) {
|
|
23021
23353
|
if (ev.aggregateType && ev.aggregateType !== "session") continue;
|
|
23022
23354
|
if (ev.aggregateId && ev.aggregateId !== sessionId) continue;
|
|
23023
|
-
const payload =
|
|
23355
|
+
const payload = asRecord7(ev.payload);
|
|
23024
23356
|
switch (ev.eventType) {
|
|
23025
23357
|
case SESSION_DURABLE_EVENT.turnStarted: {
|
|
23026
23358
|
turnKey += 1;
|
|
@@ -23046,10 +23378,10 @@ function collectToolsByAssistantId(events, sessionId) {
|
|
|
23046
23378
|
break;
|
|
23047
23379
|
}
|
|
23048
23380
|
case SESSION_DURABLE_EVENT.agentEvent: {
|
|
23049
|
-
const raw =
|
|
23381
|
+
const raw = asRecord7(payload.event);
|
|
23050
23382
|
const type = asString3(raw.type);
|
|
23051
23383
|
if (type === "message_start") {
|
|
23052
|
-
const id = asString3(
|
|
23384
|
+
const id = asString3(asRecord7(raw.message).id);
|
|
23053
23385
|
if (id) bindAssistant(id);
|
|
23054
23386
|
} else if (type === "message_complete") {
|
|
23055
23387
|
const id = asString3(raw.messageId);
|
|
@@ -23057,7 +23389,7 @@ function collectToolsByAssistantId(events, sessionId) {
|
|
|
23057
23389
|
} else if (type === "content_delta") {
|
|
23058
23390
|
const messageId = asString3(raw.messageId);
|
|
23059
23391
|
if (messageId) bindAssistant(messageId);
|
|
23060
|
-
const delta =
|
|
23392
|
+
const delta = asRecord7(raw.delta);
|
|
23061
23393
|
const dType = asString3(delta.type);
|
|
23062
23394
|
if (dType === "tool_use") {
|
|
23063
23395
|
const toolUseId = asString3(delta.toolUseId);
|
|
@@ -23200,7 +23532,7 @@ function collectContentByAssistantId(events, sessionId) {
|
|
|
23200
23532
|
if (changed) contentById.set(ev.messageId, next);
|
|
23201
23533
|
}
|
|
23202
23534
|
}
|
|
23203
|
-
const payload =
|
|
23535
|
+
const payload = asRecord7(envelope.payload);
|
|
23204
23536
|
if (envelope.eventType === SESSION_DURABLE_EVENT.assistantMessage) {
|
|
23205
23537
|
const blockId = asString3(payload.blockId);
|
|
23206
23538
|
const sticky = stickyBefore ?? mapper.currentAssistantMessageId();
|
|
@@ -23224,7 +23556,7 @@ function extractCheckpointMeta(events, sessionId, blockId) {
|
|
|
23224
23556
|
const ev = events[i];
|
|
23225
23557
|
if (ev.aggregateType && ev.aggregateType !== "session") continue;
|
|
23226
23558
|
if (ev.aggregateId && ev.aggregateId !== sessionId) continue;
|
|
23227
|
-
const payload =
|
|
23559
|
+
const payload = asRecord7(ev.payload);
|
|
23228
23560
|
if (ev.eventType === SESSION_DURABLE_EVENT.assistantMessage) {
|
|
23229
23561
|
if (asString3(payload.blockId) !== blockId) continue;
|
|
23230
23562
|
const checkpointId = asString3(payload.checkpointId);
|
|
@@ -23239,7 +23571,7 @@ function extractCheckpointMeta(events, sessionId, blockId) {
|
|
|
23239
23571
|
}
|
|
23240
23572
|
}
|
|
23241
23573
|
if (ev.eventType === SESSION_DURABLE_EVENT.agentEvent) {
|
|
23242
|
-
const raw =
|
|
23574
|
+
const raw = asRecord7(payload.event);
|
|
23243
23575
|
if (asString3(raw.type) !== "message_complete" && asString3(raw.type) !== "checkpoint_captured") {
|
|
23244
23576
|
continue;
|
|
23245
23577
|
}
|
|
@@ -31046,6 +31378,7 @@ function createNodeClaudeTurnRunner(opts) {
|
|
|
31046
31378
|
permissionMode: permissions.permissionMode,
|
|
31047
31379
|
uid,
|
|
31048
31380
|
sandboxMode: input.sandboxMode && input.sandboxMode.trim() ? input.sandboxMode.trim() : void 0,
|
|
31381
|
+
askUserQuestionPreviewFormat: opts.askUserQuestionPreviewFormat?.(),
|
|
31049
31382
|
additionalDirectories: input.additionalDirectories?.filter(Boolean),
|
|
31050
31383
|
enabledSkills: resolveEnabledSkills(cwd, input.enabledSkills, input.disabledSkills),
|
|
31051
31384
|
env: authEnv,
|
|
@@ -50495,7 +50828,7 @@ function toolInputJson(raw) {
|
|
|
50495
50828
|
return "{}";
|
|
50496
50829
|
}
|
|
50497
50830
|
}
|
|
50498
|
-
function
|
|
50831
|
+
function asRecord8(raw) {
|
|
50499
50832
|
if (raw && typeof raw === "object" && !Array.isArray(raw)) return raw;
|
|
50500
50833
|
return {};
|
|
50501
50834
|
}
|
|
@@ -50634,7 +50967,7 @@ function grokMetaInput(tool) {
|
|
|
50634
50967
|
const xai = meta3["x.ai/tool"];
|
|
50635
50968
|
if (!xai || typeof xai !== "object") return {};
|
|
50636
50969
|
const input = xai.input;
|
|
50637
|
-
return
|
|
50970
|
+
return asRecord8(input);
|
|
50638
50971
|
}
|
|
50639
50972
|
function queryFromWebSearchTitle(title) {
|
|
50640
50973
|
if (!title) return void 0;
|
|
@@ -50895,11 +51228,11 @@ function unwrapMcpEnvelope(tool, raw) {
|
|
|
50895
51228
|
if (!isEnvelope) return null;
|
|
50896
51229
|
const id = raw.tool_name;
|
|
50897
51230
|
if (typeof id !== "string" || !id.includes("__")) return null;
|
|
50898
|
-
return { toolName: `mcp__${id}`, input:
|
|
51231
|
+
return { toolName: `mcp__${id}`, input: asRecord8(raw.tool_input) };
|
|
50899
51232
|
}
|
|
50900
51233
|
function normalizeAcpTool(tool, opts) {
|
|
50901
|
-
const raw = { ...grokMetaInput(tool), ...
|
|
50902
|
-
const mcp = unwrapMcpEnvelope(tool,
|
|
51234
|
+
const raw = { ...grokMetaInput(tool), ...asRecord8(tool.rawInput) };
|
|
51235
|
+
const mcp = unwrapMcpEnvelope(tool, asRecord8(tool.rawInput));
|
|
50903
51236
|
if (mcp) return mcp;
|
|
50904
51237
|
const diffs = extractDiffs(tool.content);
|
|
50905
51238
|
const terminalId = extractEmbeddedTerminalId(tool.content);
|
|
@@ -51093,6 +51426,39 @@ var init_tool_result_map = __esm({
|
|
|
51093
51426
|
}
|
|
51094
51427
|
});
|
|
51095
51428
|
|
|
51429
|
+
// ../../packages/shared/src/acp-goal.ts
|
|
51430
|
+
function normalizeAcpGoalStatus(raw) {
|
|
51431
|
+
const status = raw.trim().toLowerCase().replace(/-/g, "_");
|
|
51432
|
+
switch (status) {
|
|
51433
|
+
case "active":
|
|
51434
|
+
return "active";
|
|
51435
|
+
case "blocked":
|
|
51436
|
+
return "blocked";
|
|
51437
|
+
case "budget_limited":
|
|
51438
|
+
case "budgetlimited":
|
|
51439
|
+
return "budgetLimited";
|
|
51440
|
+
case "complete":
|
|
51441
|
+
case "completed":
|
|
51442
|
+
return "complete";
|
|
51443
|
+
case "cleared":
|
|
51444
|
+
return "cleared";
|
|
51445
|
+
case "user_paused":
|
|
51446
|
+
case "backoff_paused":
|
|
51447
|
+
case "back_off_paused":
|
|
51448
|
+
case "no_progress_paused":
|
|
51449
|
+
case "infra_paused":
|
|
51450
|
+
case "paused":
|
|
51451
|
+
return "paused";
|
|
51452
|
+
default:
|
|
51453
|
+
return "paused";
|
|
51454
|
+
}
|
|
51455
|
+
}
|
|
51456
|
+
var init_acp_goal = __esm({
|
|
51457
|
+
"../../packages/shared/src/acp-goal.ts"() {
|
|
51458
|
+
"use strict";
|
|
51459
|
+
}
|
|
51460
|
+
});
|
|
51461
|
+
|
|
51096
51462
|
// ../../packages/acp/src/xai-state.ts
|
|
51097
51463
|
import { homedir as homedir4 } from "node:os";
|
|
51098
51464
|
import { join as join20 } from "node:path";
|
|
@@ -51157,7 +51523,7 @@ function bindSubagentToolId(state, subagentId, toolUseId, description, migrateOu
|
|
|
51157
51523
|
});
|
|
51158
51524
|
}
|
|
51159
51525
|
}
|
|
51160
|
-
function
|
|
51526
|
+
function asRecord9(v2) {
|
|
51161
51527
|
if (!v2 || typeof v2 !== "object" || Array.isArray(v2)) return null;
|
|
51162
51528
|
return v2;
|
|
51163
51529
|
}
|
|
@@ -51190,18 +51556,18 @@ function arrField(o, ...keys) {
|
|
|
51190
51556
|
return void 0;
|
|
51191
51557
|
}
|
|
51192
51558
|
function parseXaiSessionNotificationEnvelope(raw) {
|
|
51193
|
-
const o =
|
|
51559
|
+
const o = asRecord9(raw);
|
|
51194
51560
|
if (!o) return null;
|
|
51195
|
-
const update =
|
|
51561
|
+
const update = asRecord9(o.update);
|
|
51196
51562
|
if (!update) return null;
|
|
51197
51563
|
const sessionId = strField(o, "sessionId", "session_id");
|
|
51198
|
-
const meta3 =
|
|
51564
|
+
const meta3 = asRecord9(o._meta) ?? asRecord9(o.meta);
|
|
51199
51565
|
const eventSeq = meta3 ? numField(meta3, "eventSeq", "event_seq") ?? null : null;
|
|
51200
51566
|
const eventId = meta3 ? strField(meta3, "eventId", "event_id") ?? null : null;
|
|
51201
51567
|
return { sessionId, update, meta: meta3, eventSeq, eventId };
|
|
51202
51568
|
}
|
|
51203
51569
|
function parseXaiExtParams(raw) {
|
|
51204
|
-
return
|
|
51570
|
+
return asRecord9(raw) ?? {};
|
|
51205
51571
|
}
|
|
51206
51572
|
function parsePlainTextTaskAck(text) {
|
|
51207
51573
|
const subagentId = text.match(/subagent_id:\s*(\S+)/i)?.[1] ?? text.match(/task_ids?\s*=\s*\[\s*"([^"]+)"/i)?.[1];
|
|
@@ -51306,13 +51672,13 @@ function tryParseJsonObject(text) {
|
|
|
51306
51672
|
if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) return null;
|
|
51307
51673
|
try {
|
|
51308
51674
|
const v2 = JSON.parse(trimmed);
|
|
51309
|
-
return
|
|
51675
|
+
return asRecord9(v2);
|
|
51310
51676
|
} catch {
|
|
51311
51677
|
const start = trimmed.indexOf("{");
|
|
51312
51678
|
const end = trimmed.lastIndexOf("}");
|
|
51313
51679
|
if (start < 0 || end <= start) return null;
|
|
51314
51680
|
try {
|
|
51315
|
-
return
|
|
51681
|
+
return asRecord9(JSON.parse(trimmed.slice(start, end + 1)));
|
|
51316
51682
|
} catch {
|
|
51317
51683
|
return null;
|
|
51318
51684
|
}
|
|
@@ -51550,7 +51916,7 @@ function mapWorkflowPhases(raw) {
|
|
|
51550
51916
|
if (!raw?.length) return [];
|
|
51551
51917
|
const out = [];
|
|
51552
51918
|
for (const item of raw) {
|
|
51553
|
-
const p2 =
|
|
51919
|
+
const p2 = asRecord9(item);
|
|
51554
51920
|
if (!p2) continue;
|
|
51555
51921
|
const title = strField(p2, "title");
|
|
51556
51922
|
if (!title) continue;
|
|
@@ -51568,7 +51934,7 @@ function mapWorkflowAgents(raw) {
|
|
|
51568
51934
|
if (!raw?.length) return [];
|
|
51569
51935
|
const out = [];
|
|
51570
51936
|
for (const item of raw) {
|
|
51571
|
-
const a =
|
|
51937
|
+
const a = asRecord9(item);
|
|
51572
51938
|
if (!a) continue;
|
|
51573
51939
|
const agentId = strField(a, "agent_id", "agentId");
|
|
51574
51940
|
const label = strField(a, "label") ?? agentId ?? "agent";
|
|
@@ -51594,7 +51960,7 @@ function buildWorkflowPhaseSummary(u, currentPhase, pauseMessage, lastEvent, las
|
|
|
51594
51960
|
const phaseBits = [];
|
|
51595
51961
|
if (phases?.length) {
|
|
51596
51962
|
for (const p2 of phases) {
|
|
51597
|
-
const ph =
|
|
51963
|
+
const ph = asRecord9(p2);
|
|
51598
51964
|
if (!ph) continue;
|
|
51599
51965
|
const title = strField(ph, "title") ?? "?";
|
|
51600
51966
|
const state = strField(ph, "state") ?? "";
|
|
@@ -51742,7 +52108,7 @@ function mapTaskBackgrounded(u, state) {
|
|
|
51742
52108
|
}];
|
|
51743
52109
|
}
|
|
51744
52110
|
function mapTaskCompleted(u, state) {
|
|
51745
|
-
const snapshot =
|
|
52111
|
+
const snapshot = asRecord9(u.task_snapshot) ?? asRecord9(u.taskSnapshot) ?? u;
|
|
51746
52112
|
const taskId = strField(snapshot, "task_id", "taskId");
|
|
51747
52113
|
if (!taskId) return [];
|
|
51748
52114
|
const known = state.bgTaskById.get(taskId);
|
|
@@ -51824,6 +52190,16 @@ function mapGoalUpdated(u, state) {
|
|
|
51824
52190
|
pauseMessage || lastEvent
|
|
51825
52191
|
].filter(Boolean).join(" \xB7 ");
|
|
51826
52192
|
const events = [];
|
|
52193
|
+
const goal = {
|
|
52194
|
+
goalId,
|
|
52195
|
+
objective,
|
|
52196
|
+
status: normalizeAcpGoalStatus(status),
|
|
52197
|
+
tokensUsed,
|
|
52198
|
+
elapsedMs,
|
|
52199
|
+
...pauseMessage ? { pauseMessage } : {},
|
|
52200
|
+
...phase ? { phase } : {}
|
|
52201
|
+
};
|
|
52202
|
+
events.push({ type: "acp_goal", goal: goal.status === "cleared" ? null : goal });
|
|
51827
52203
|
if (!state.goalStarted.has(goalId)) {
|
|
51828
52204
|
state.goalStarted.add(goalId);
|
|
51829
52205
|
events.push({
|
|
@@ -52008,7 +52384,7 @@ function mapResponseStarted(u, state, ctx) {
|
|
|
52008
52384
|
return event ? [event] : [];
|
|
52009
52385
|
}
|
|
52010
52386
|
function mapResponseCompleted(u, state, ctx) {
|
|
52011
|
-
const usageRaw =
|
|
52387
|
+
const usageRaw = asRecord9(u.usage) ?? u;
|
|
52012
52388
|
const input = numField(usageRaw, "inputTokens", "input_tokens") ?? 0;
|
|
52013
52389
|
const output = numField(usageRaw, "outputTokens", "output_tokens") ?? 0;
|
|
52014
52390
|
const cacheRead = numField(usageRaw, "cacheReadInputTokens", "cache_read_input_tokens") ?? 0;
|
|
@@ -52023,7 +52399,7 @@ function mapResponseCompleted(u, state, ctx) {
|
|
|
52023
52399
|
}
|
|
52024
52400
|
function mapTurnCompleted(u, state, ctx) {
|
|
52025
52401
|
const events = mapTurnStopReason(u, state);
|
|
52026
|
-
const usageRaw =
|
|
52402
|
+
const usageRaw = asRecord9(u.usage);
|
|
52027
52403
|
if (!usageRaw) {
|
|
52028
52404
|
resetTurnTokens(state);
|
|
52029
52405
|
return events;
|
|
@@ -52190,7 +52566,7 @@ function mapModelAutoSwitched(u) {
|
|
|
52190
52566
|
];
|
|
52191
52567
|
}
|
|
52192
52568
|
function mapRetryState(u) {
|
|
52193
|
-
const nested =
|
|
52569
|
+
const nested = asRecord9(u.retry_state) ?? asRecord9(u.retryState) ?? u;
|
|
52194
52570
|
const type = (strField(nested, "type") ?? "").toLowerCase();
|
|
52195
52571
|
if (type === "retrying") {
|
|
52196
52572
|
const attempt = numField(nested, "attempt") ?? 1;
|
|
@@ -52257,7 +52633,7 @@ function mapAutoRecoveryExhausted(u) {
|
|
|
52257
52633
|
}];
|
|
52258
52634
|
}
|
|
52259
52635
|
function mapFollowUps(u) {
|
|
52260
|
-
const meta3 =
|
|
52636
|
+
const meta3 = asRecord9(u._meta) ?? asRecord9(u.meta);
|
|
52261
52637
|
if (meta3 && meta3["x.ai/replayed"] === true) return [];
|
|
52262
52638
|
const responseId = strField(u, "response_id", "responseId");
|
|
52263
52639
|
if (!responseId || responseId.length > 128) return [];
|
|
@@ -52266,7 +52642,7 @@ function mapFollowUps(u) {
|
|
|
52266
52642
|
let count = 0;
|
|
52267
52643
|
for (const s2 of suggestions) {
|
|
52268
52644
|
if (count >= 6) break;
|
|
52269
|
-
const rec =
|
|
52645
|
+
const rec = asRecord9(s2);
|
|
52270
52646
|
const label = (rec ? strField(rec, "label") : typeof s2 === "string" ? s2 : void 0)?.trim();
|
|
52271
52647
|
if (!label) continue;
|
|
52272
52648
|
const cleaned = label.replace(/[\u0000-\u001f\u007f]/g, "").slice(0, 256).trim();
|
|
@@ -52288,6 +52664,7 @@ var log, WORKFLOW_TERMINAL;
|
|
|
52288
52664
|
var init_xai_event_map = __esm({
|
|
52289
52665
|
"../../packages/acp/src/xai-event-map.ts"() {
|
|
52290
52666
|
"use strict";
|
|
52667
|
+
init_acp_goal();
|
|
52291
52668
|
init_xai_state();
|
|
52292
52669
|
log = { debug: (..._args) => void 0 };
|
|
52293
52670
|
WORKFLOW_TERMINAL = /* @__PURE__ */ new Set([
|
|
@@ -60112,7 +60489,7 @@ function toolDisplayName(name) {
|
|
|
60112
60489
|
}
|
|
60113
60490
|
function unwrapCursorMcpTool(toolType, args) {
|
|
60114
60491
|
if (toolType.toLowerCase() !== "mcp") return { toolType, args };
|
|
60115
|
-
const rec =
|
|
60492
|
+
const rec = asRecord10(args);
|
|
60116
60493
|
if (!rec) return { toolType, args };
|
|
60117
60494
|
const server = typeof rec.providerIdentifier === "string" ? rec.providerIdentifier.trim() : "";
|
|
60118
60495
|
const name = typeof rec.toolName === "string" ? rec.toolName.trim() : "";
|
|
@@ -60138,12 +60515,12 @@ function idField(obj, ...keys) {
|
|
|
60138
60515
|
return stableIdField(obj, ...keys) ?? `tool_${Date.now()}`;
|
|
60139
60516
|
}
|
|
60140
60517
|
function extractCursorCallId(update) {
|
|
60141
|
-
const rec =
|
|
60518
|
+
const rec = asRecord10(update);
|
|
60142
60519
|
if (!rec) return null;
|
|
60143
|
-
const nested =
|
|
60520
|
+
const nested = asRecord10(rec.toolCall) ?? asRecord10(rec.message);
|
|
60144
60521
|
return stableIdField(rec, ...TOOL_CALL_ID_KEYS) ?? (nested ? stableIdField(nested, ...TOOL_CALL_ID_KEYS) : null);
|
|
60145
60522
|
}
|
|
60146
|
-
function
|
|
60523
|
+
function asRecord10(value) {
|
|
60147
60524
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
60148
60525
|
return value;
|
|
60149
60526
|
}
|
|
@@ -60157,13 +60534,13 @@ function stringifyPayload(value) {
|
|
|
60157
60534
|
}
|
|
60158
60535
|
}
|
|
60159
60536
|
function extractToolCallParts(update) {
|
|
60160
|
-
const rec =
|
|
60537
|
+
const rec = asRecord10(update) ?? {};
|
|
60161
60538
|
const callId = extractCursorCallId(update);
|
|
60162
|
-
const nested =
|
|
60539
|
+
const nested = asRecord10(rec.toolCall);
|
|
60163
60540
|
if (nested) {
|
|
60164
60541
|
const toolType2 = typeof nested.type === "string" && nested.type ? nested.type : "Tool";
|
|
60165
60542
|
const result = nested.result;
|
|
60166
|
-
const resultRec =
|
|
60543
|
+
const resultRec = asRecord10(result);
|
|
60167
60544
|
const isError = resultRec?.status === "error" || Boolean(rec.isError);
|
|
60168
60545
|
return {
|
|
60169
60546
|
callId,
|
|
@@ -60187,7 +60564,7 @@ function mapTodosPayload(todos) {
|
|
|
60187
60564
|
return {
|
|
60188
60565
|
type: "todos_updated",
|
|
60189
60566
|
todos: todos.map((todo, index) => {
|
|
60190
|
-
const row =
|
|
60567
|
+
const row = asRecord10(todo) ?? {};
|
|
60191
60568
|
const statusRaw = String(row.status ?? "pending");
|
|
60192
60569
|
return {
|
|
60193
60570
|
id: String(row.id ?? index + 1),
|
|
@@ -60216,15 +60593,15 @@ function toolUseEvent(messageId, callId, toolType, args, status) {
|
|
|
60216
60593
|
}
|
|
60217
60594
|
function normalizeCursorToolInput(toolName, args) {
|
|
60218
60595
|
if (toolName.startsWith("mcp__")) return args;
|
|
60219
|
-
const rec =
|
|
60596
|
+
const rec = asRecord10(args);
|
|
60220
60597
|
if (!rec) return args ?? {};
|
|
60221
60598
|
return normalizeTranscriptTool(toolName, rec).input;
|
|
60222
60599
|
}
|
|
60223
60600
|
function mergeCursorToolResultArgs(toolType, args, result) {
|
|
60224
60601
|
if (toolType.toLowerCase() === "mcp") return args;
|
|
60225
|
-
const res =
|
|
60602
|
+
const res = asRecord10(result);
|
|
60226
60603
|
if (!res) return args;
|
|
60227
|
-
const rec =
|
|
60604
|
+
const rec = asRecord10(args);
|
|
60228
60605
|
if (!rec) return args;
|
|
60229
60606
|
const diff = typeof res.diffString === "string" ? res.diffString : void 0;
|
|
60230
60607
|
const linesAdded = typeof res.linesAdded === "number" ? res.linesAdded : void 0;
|
|
@@ -60285,7 +60662,7 @@ function stampParentToolUseId(events, parentToolUseId) {
|
|
|
60285
60662
|
function mapInteractionUpdate(messageId, update, options) {
|
|
60286
60663
|
const events = [];
|
|
60287
60664
|
const type = String(update.type ?? "");
|
|
60288
|
-
const rec =
|
|
60665
|
+
const rec = asRecord10(update) ?? {};
|
|
60289
60666
|
switch (type) {
|
|
60290
60667
|
case "text-delta": {
|
|
60291
60668
|
const text = strField2(update, "text");
|
|
@@ -60325,7 +60702,7 @@ function mapInteractionUpdate(messageId, update, options) {
|
|
|
60325
60702
|
if (!parts.callId) break;
|
|
60326
60703
|
events.push(toolUseEvent(messageId, parts.callId, parts.toolType, parts.args, "streaming"));
|
|
60327
60704
|
if (parts.toolType === "updateTodos" || parts.toolType === "update_todos") {
|
|
60328
|
-
const todos =
|
|
60705
|
+
const todos = asRecord10(parts.args)?.todos;
|
|
60329
60706
|
const todoEvent = mapTodosPayload(todos);
|
|
60330
60707
|
if (todoEvent) events.push(todoEvent);
|
|
60331
60708
|
}
|
|
@@ -60362,7 +60739,7 @@ function mapInteractionUpdate(messageId, update, options) {
|
|
|
60362
60739
|
events.push(toolUseEvent(messageId, parts.callId, parts.toolType, args, "complete"));
|
|
60363
60740
|
events.push(toolResultEvent(messageId, parts.callId, parts.result, parts.isError));
|
|
60364
60741
|
if (parts.toolType === "updateTodos" || parts.toolType === "update_todos") {
|
|
60365
|
-
const todos =
|
|
60742
|
+
const todos = asRecord10(parts.args)?.todos ?? asRecord10(parts.result)?.todos;
|
|
60366
60743
|
const todoEvent = mapTodosPayload(todos);
|
|
60367
60744
|
if (todoEvent) events.push(todoEvent);
|
|
60368
60745
|
}
|
|
@@ -60467,7 +60844,7 @@ ${text}
|
|
|
60467
60844
|
}
|
|
60468
60845
|
function mapConversationStep(messageId, step, options) {
|
|
60469
60846
|
const events = [];
|
|
60470
|
-
const rec =
|
|
60847
|
+
const rec = asRecord10(step);
|
|
60471
60848
|
if (!rec) return events;
|
|
60472
60849
|
const stepType = strField2(rec, "type");
|
|
60473
60850
|
if (stepType === "assistantMessage" || stepType === "thinkingMessage") {
|
|
@@ -60475,14 +60852,14 @@ function mapConversationStep(messageId, step, options) {
|
|
|
60475
60852
|
}
|
|
60476
60853
|
if (stepType === "toolCall") {
|
|
60477
60854
|
const message = rec.message ?? rec.toolCall ?? rec;
|
|
60478
|
-
const nested =
|
|
60855
|
+
const nested = asRecord10(message);
|
|
60479
60856
|
const callId = extractCursorCallId(rec) || options?.resolveCallId?.(step) || null;
|
|
60480
60857
|
if (!callId) {
|
|
60481
60858
|
return events;
|
|
60482
60859
|
}
|
|
60483
60860
|
const toolType = nested && typeof nested.type === "string" && nested.type ? nested.type : strField2(rec, "name") || "Tool";
|
|
60484
60861
|
const args = nested?.args ?? nested?.input ?? {};
|
|
60485
|
-
const resultRec =
|
|
60862
|
+
const resultRec = asRecord10(nested?.result);
|
|
60486
60863
|
const resultValue = resultRec?.status === "success" ? resultRec.value ?? nested?.result : nested?.result;
|
|
60487
60864
|
events.push(toolUseEvent(
|
|
60488
60865
|
messageId,
|
|
@@ -60492,7 +60869,7 @@ function mapConversationStep(messageId, step, options) {
|
|
|
60492
60869
|
"complete"
|
|
60493
60870
|
));
|
|
60494
60871
|
if (toolType === "updateTodos" || toolType === "update_todos") {
|
|
60495
|
-
const todos =
|
|
60872
|
+
const todos = asRecord10(args)?.todos;
|
|
60496
60873
|
const todoEvent = mapTodosPayload(todos);
|
|
60497
60874
|
if (todoEvent) events.push(todoEvent);
|
|
60498
60875
|
}
|
|
@@ -60629,7 +61006,7 @@ var init_cursor_event_map = __esm({
|
|
|
60629
61006
|
observeDelta(update) {
|
|
60630
61007
|
const type = String(update.type ?? "");
|
|
60631
61008
|
if (type === "tool-call-delta") {
|
|
60632
|
-
const taskUpdate =
|
|
61009
|
+
const taskUpdate = asRecord10(update)?.taskUpdate;
|
|
60633
61010
|
if (taskUpdate && typeof taskUpdate === "object") {
|
|
60634
61011
|
this.observeDelta(taskUpdate);
|
|
60635
61012
|
}
|
|
@@ -62010,7 +62387,7 @@ var init_harness_runners = __esm({
|
|
|
62010
62387
|
});
|
|
62011
62388
|
|
|
62012
62389
|
// src/session/codex-live-turn.ts
|
|
62013
|
-
function
|
|
62390
|
+
function asRecord11(value) {
|
|
62014
62391
|
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
62015
62392
|
}
|
|
62016
62393
|
function readString4(value) {
|
|
@@ -62041,7 +62418,7 @@ function extractAgentTextFromTurn2(turn) {
|
|
|
62041
62418
|
let text = "";
|
|
62042
62419
|
const items = Array.isArray(turn.items) ? turn.items : [];
|
|
62043
62420
|
for (const item of items) {
|
|
62044
|
-
const rec =
|
|
62421
|
+
const rec = asRecord11(item);
|
|
62045
62422
|
if (!rec) continue;
|
|
62046
62423
|
if (readString4(rec.type) === "agentMessage" || readString4(rec.itemType) === "agentMessage") {
|
|
62047
62424
|
const t = readString4(rec.text);
|
|
@@ -62073,7 +62450,7 @@ async function openTurnAndStream(opts) {
|
|
|
62073
62450
|
...collaborationMode ? { collaborationMode } : {}
|
|
62074
62451
|
})
|
|
62075
62452
|
);
|
|
62076
|
-
const turn =
|
|
62453
|
+
const turn = asRecord11(turnStartResult.turn);
|
|
62077
62454
|
const turnId = readString4(turn?.id);
|
|
62078
62455
|
opts.onTurnStarted?.(turnId);
|
|
62079
62456
|
let finalText = "";
|
|
@@ -62101,7 +62478,7 @@ async function openTurnAndStream(opts) {
|
|
|
62101
62478
|
continue;
|
|
62102
62479
|
}
|
|
62103
62480
|
if (note.method === "turn/completed" || note.method === "turn/completed/v2") {
|
|
62104
|
-
const completedTurn =
|
|
62481
|
+
const completedTurn = asRecord11(note.params.turn);
|
|
62105
62482
|
const completedId = readString4(completedTurn?.id);
|
|
62106
62483
|
if (turnId && completedId && completedId !== turnId) continue;
|
|
62107
62484
|
}
|
|
@@ -62109,14 +62486,14 @@ async function openTurnAndStream(opts) {
|
|
|
62109
62486
|
const applied = agentEventMapper.apply(note);
|
|
62110
62487
|
if (applied.textDelta) finalText += applied.textDelta;
|
|
62111
62488
|
} else if (note.method === "item/agentMessage/delta" || note.method === "item/agentMessageDelta") {
|
|
62112
|
-
const delta = readString4(note.params.delta) ?? readString4(note.params.text) ?? readString4(
|
|
62489
|
+
const delta = readString4(note.params.delta) ?? readString4(note.params.text) ?? readString4(asRecord11(note.params.item)?.delta);
|
|
62113
62490
|
if (delta) {
|
|
62114
62491
|
finalText += delta;
|
|
62115
62492
|
opts.onDelta?.(delta);
|
|
62116
62493
|
}
|
|
62117
62494
|
}
|
|
62118
62495
|
if (note.method === "turn/completed" || note.method === "turn/completed/v2") {
|
|
62119
|
-
const completedTurn =
|
|
62496
|
+
const completedTurn = asRecord11(note.params.turn);
|
|
62120
62497
|
const status = readString4(completedTurn?.status) ?? readString4(note.params.status);
|
|
62121
62498
|
if (status === "failed" || status === "error") {
|
|
62122
62499
|
throw new Error("Codex turn failed");
|
|
@@ -62387,6 +62764,7 @@ function createProductionTurnRunner(opts) {
|
|
|
62387
62764
|
allowSimulatedFallback: opts.allowSimulatedFallback,
|
|
62388
62765
|
providers: opts.providers,
|
|
62389
62766
|
experimentalClaudeOpenAiChatEnabled: opts.experimentalClaudeOpenAiChatEnabled,
|
|
62767
|
+
askUserQuestionPreviewFormat: opts.askUserQuestionPreviewFormat,
|
|
62390
62768
|
createHostActionClaudeMcp: opts.createHostActionClaudeMcp,
|
|
62391
62769
|
mcpMergeMode: opts.mcpMergeMode,
|
|
62392
62770
|
homeDir: opts.homeDir
|
|
@@ -62452,8 +62830,13 @@ function createCodexAdminService(opts) {
|
|
|
62452
62830
|
}
|
|
62453
62831
|
function clearCodexAdminAuthForTest() {
|
|
62454
62832
|
projectAuthById.clear();
|
|
62833
|
+
for (const pending of pendingAccountLogins.values()) {
|
|
62834
|
+
void pending.client.close().catch(() => {
|
|
62835
|
+
});
|
|
62836
|
+
}
|
|
62837
|
+
pendingAccountLogins.clear();
|
|
62455
62838
|
}
|
|
62456
|
-
var projectAuthById, CodexAdminService;
|
|
62839
|
+
var projectAuthById, pendingAccountLogins, CodexAdminService;
|
|
62457
62840
|
var init_codex_admin_service = __esm({
|
|
62458
62841
|
"src/session/codex-admin-service.ts"() {
|
|
62459
62842
|
"use strict";
|
|
@@ -62462,6 +62845,7 @@ var init_codex_admin_service = __esm({
|
|
|
62462
62845
|
init_codex_turn_runner();
|
|
62463
62846
|
init_resolve_service();
|
|
62464
62847
|
projectAuthById = /* @__PURE__ */ new Map();
|
|
62848
|
+
pendingAccountLogins = /* @__PURE__ */ new Map();
|
|
62465
62849
|
CodexAdminService = class {
|
|
62466
62850
|
constructor(opts) {
|
|
62467
62851
|
this.opts = opts;
|
|
@@ -62535,6 +62919,91 @@ var init_codex_admin_service = __esm({
|
|
|
62535
62919
|
});
|
|
62536
62920
|
}
|
|
62537
62921
|
}
|
|
62922
|
+
async openAccountClient() {
|
|
62923
|
+
const binary = resolveCodexBinaryPath({
|
|
62924
|
+
binaryPath: this.opts.binaryPath,
|
|
62925
|
+
harnesses: this.opts.harnesses
|
|
62926
|
+
});
|
|
62927
|
+
if (!binary) {
|
|
62928
|
+
throw Object.assign(new Error("Codex binary not available"), {
|
|
62929
|
+
code: "failed_precondition"
|
|
62930
|
+
});
|
|
62931
|
+
}
|
|
62932
|
+
const env = { ...process.env, ...this.opts.env };
|
|
62933
|
+
delete env.CODEX_API_KEY;
|
|
62934
|
+
return openCodexAppServer({
|
|
62935
|
+
binaryPath: binary,
|
|
62936
|
+
env,
|
|
62937
|
+
spawnFn: this.opts.spawnFn
|
|
62938
|
+
});
|
|
62939
|
+
}
|
|
62940
|
+
async getAccountStatus() {
|
|
62941
|
+
const client3 = await this.openAccountClient();
|
|
62942
|
+
try {
|
|
62943
|
+
return await readAccountStatus(client3);
|
|
62944
|
+
} finally {
|
|
62945
|
+
await client3.close().catch(() => {
|
|
62946
|
+
});
|
|
62947
|
+
}
|
|
62948
|
+
}
|
|
62949
|
+
async startAccountLogin(projectId) {
|
|
62950
|
+
const client3 = await this.openAccountClient();
|
|
62951
|
+
try {
|
|
62952
|
+
const result = await startAccountLogin(client3, "chatgptDeviceCode");
|
|
62953
|
+
pendingAccountLogins.set(result.loginId, { projectId, client: client3 });
|
|
62954
|
+
void this.waitForAccountLogin(result.loginId, client3);
|
|
62955
|
+
return result;
|
|
62956
|
+
} catch (error51) {
|
|
62957
|
+
await client3.close().catch(() => {
|
|
62958
|
+
});
|
|
62959
|
+
throw error51;
|
|
62960
|
+
}
|
|
62961
|
+
}
|
|
62962
|
+
async waitForAccountLogin(loginId, client3) {
|
|
62963
|
+
const deadline = Date.now() + 15 * 6e4;
|
|
62964
|
+
try {
|
|
62965
|
+
while (Date.now() < deadline && pendingAccountLogins.get(loginId)?.client === client3) {
|
|
62966
|
+
const notification = await client3.nextNotification(Math.min(1e3, deadline - Date.now()));
|
|
62967
|
+
if (!notification) continue;
|
|
62968
|
+
if (notification.method === "account/login/completed" && notification.params.loginId === loginId) return;
|
|
62969
|
+
}
|
|
62970
|
+
} catch {
|
|
62971
|
+
} finally {
|
|
62972
|
+
if (pendingAccountLogins.get(loginId)?.client === client3) {
|
|
62973
|
+
pendingAccountLogins.delete(loginId);
|
|
62974
|
+
}
|
|
62975
|
+
await client3.close().catch(() => {
|
|
62976
|
+
});
|
|
62977
|
+
}
|
|
62978
|
+
}
|
|
62979
|
+
async cancelAccountLogin(loginId) {
|
|
62980
|
+
const pending = pendingAccountLogins.get(loginId);
|
|
62981
|
+
if (!pending) return;
|
|
62982
|
+
pendingAccountLogins.delete(loginId);
|
|
62983
|
+
try {
|
|
62984
|
+
await cancelAccountLogin(pending.client, loginId);
|
|
62985
|
+
} finally {
|
|
62986
|
+
await pending.client.close().catch(() => {
|
|
62987
|
+
});
|
|
62988
|
+
}
|
|
62989
|
+
}
|
|
62990
|
+
async logoutAccount() {
|
|
62991
|
+
for (const [loginId, pending] of [...pendingAccountLogins]) {
|
|
62992
|
+
pendingAccountLogins.delete(loginId);
|
|
62993
|
+
await cancelAccountLogin(pending.client, loginId).catch(() => {
|
|
62994
|
+
});
|
|
62995
|
+
await pending.client.close().catch(() => {
|
|
62996
|
+
});
|
|
62997
|
+
}
|
|
62998
|
+
const client3 = await this.openAccountClient();
|
|
62999
|
+
try {
|
|
63000
|
+
await logoutAccount(client3);
|
|
63001
|
+
return await readAccountStatus(client3);
|
|
63002
|
+
} finally {
|
|
63003
|
+
await client3.close().catch(() => {
|
|
63004
|
+
});
|
|
63005
|
+
}
|
|
63006
|
+
}
|
|
62538
63007
|
async getRateLimits(projectId, apiProviderId) {
|
|
62539
63008
|
const auth = this.getProjectAuth(projectId);
|
|
62540
63009
|
if (resolveMode(auth.mode, auth.apiKey) !== "chatgpt") return null;
|
|
@@ -69749,8 +70218,8 @@ import { fileURLToPath } from "node:url";
|
|
|
69749
70218
|
function resolveCliReleaseVersion() {
|
|
69750
70219
|
const fromEnv = process.env.SUPERONE_CLI_VERSION?.trim();
|
|
69751
70220
|
if (fromEnv) return fromEnv;
|
|
69752
|
-
if ("0.
|
|
69753
|
-
return "0.
|
|
70221
|
+
if ("0.56.0-alpha".trim()) {
|
|
70222
|
+
return "0.56.0-alpha".trim();
|
|
69754
70223
|
}
|
|
69755
70224
|
const fromDist = readDistManifestVersion();
|
|
69756
70225
|
if (fromDist) return fromDist;
|
|
@@ -71385,13 +71854,15 @@ import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as rea
|
|
|
71385
71854
|
import { dirname as dirname4 } from "node:path";
|
|
71386
71855
|
var CODEX_PRESETS = /* @__PURE__ */ new Set(["", "read-only", "default", "full-access"]);
|
|
71387
71856
|
var SANDBOX_MODES = /* @__PURE__ */ new Set(["", "off", "on", "auto"]);
|
|
71857
|
+
var QUESTION_PREVIEW_FORMATS = /* @__PURE__ */ new Set(["", "markdown", "html"]);
|
|
71388
71858
|
var DEFAULT_NODE_AGENT_SETTINGS = {
|
|
71389
71859
|
claude: {
|
|
71390
71860
|
defaultModel: "",
|
|
71391
71861
|
defaultEffort: "",
|
|
71392
71862
|
permissionMode: "",
|
|
71393
71863
|
sandboxMode: "",
|
|
71394
|
-
disabledSkills: []
|
|
71864
|
+
disabledSkills: [],
|
|
71865
|
+
askUserQuestionPreviewFormat: ""
|
|
71395
71866
|
},
|
|
71396
71867
|
codex: {
|
|
71397
71868
|
defaultModel: "",
|
|
@@ -71414,12 +71885,14 @@ function normalizeClaude(raw) {
|
|
|
71414
71885
|
const r = raw && typeof raw === "object" ? raw : {};
|
|
71415
71886
|
const sandboxMode = asString(r.sandboxMode ?? r.defaultSandboxMode, "");
|
|
71416
71887
|
const permissionMode = asString(r.permissionMode ?? r.defaultPermissionMode, "");
|
|
71888
|
+
const previewFormat = asString(r.askUserQuestionPreviewFormat, "");
|
|
71417
71889
|
return {
|
|
71418
71890
|
defaultModel: asString(r.defaultModel, ""),
|
|
71419
71891
|
defaultEffort: asString(r.defaultEffort, ""),
|
|
71420
71892
|
permissionMode,
|
|
71421
71893
|
sandboxMode: SANDBOX_MODES.has(sandboxMode) ? sandboxMode : "",
|
|
71422
|
-
disabledSkills: asStringArray(r.disabledSkills, [])
|
|
71894
|
+
disabledSkills: asStringArray(r.disabledSkills, []),
|
|
71895
|
+
askUserQuestionPreviewFormat: QUESTION_PREVIEW_FORMATS.has(previewFormat) ? previewFormat : ""
|
|
71423
71896
|
};
|
|
71424
71897
|
}
|
|
71425
71898
|
function normalizeCodex(raw) {
|
|
@@ -71466,6 +71939,10 @@ function mergeNodeAgentSettings(current, patch) {
|
|
|
71466
71939
|
const m2 = patch.claude.sandboxMode;
|
|
71467
71940
|
next.claude.sandboxMode = SANDBOX_MODES.has(m2) ? m2 : next.claude.sandboxMode;
|
|
71468
71941
|
}
|
|
71942
|
+
if (typeof patch.claude.askUserQuestionPreviewFormat === "string") {
|
|
71943
|
+
const f2 = patch.claude.askUserQuestionPreviewFormat;
|
|
71944
|
+
if (QUESTION_PREVIEW_FORMATS.has(f2)) next.claude.askUserQuestionPreviewFormat = f2;
|
|
71945
|
+
}
|
|
71469
71946
|
if (Array.isArray(patch.claude.disabledSkills)) {
|
|
71470
71947
|
next.claude.disabledSkills = patch.claude.disabledSkills.filter((s2) => typeof s2 === "string").map((s2) => s2.trim()).filter(Boolean);
|
|
71471
71948
|
}
|
|
@@ -71788,7 +72265,7 @@ function requireResourceWrite(client3, scope) {
|
|
|
71788
72265
|
if (scope === "user") return requireScopes(client3, OPERATION_SCOPES.adminNode);
|
|
71789
72266
|
return null;
|
|
71790
72267
|
}
|
|
71791
|
-
function
|
|
72268
|
+
function asRecord12(payload) {
|
|
71792
72269
|
return payload && typeof payload === "object" ? payload : {};
|
|
71793
72270
|
}
|
|
71794
72271
|
function mapThrown(err) {
|
|
@@ -71817,7 +72294,7 @@ function manageOpts(ctx) {
|
|
|
71817
72294
|
function handleSkillsList(payload, ctx) {
|
|
71818
72295
|
const denied = requireScopes(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
71819
72296
|
if (denied) return denied;
|
|
71820
|
-
const p2 =
|
|
72297
|
+
const p2 = asRecord12(payload);
|
|
71821
72298
|
try {
|
|
71822
72299
|
const projectId = String(p2.projectId ?? "");
|
|
71823
72300
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -71837,7 +72314,7 @@ function handleSkillsList(payload, ctx) {
|
|
|
71837
72314
|
function handleSkillsGet(payload, ctx) {
|
|
71838
72315
|
const denied = requireScopes(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
71839
72316
|
if (denied) return denied;
|
|
71840
|
-
const p2 =
|
|
72317
|
+
const p2 = asRecord12(payload);
|
|
71841
72318
|
try {
|
|
71842
72319
|
const projectId = String(p2.projectId ?? "");
|
|
71843
72320
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -71862,7 +72339,7 @@ function handleSkillsGet(payload, ctx) {
|
|
|
71862
72339
|
function handleSkillsReadFile(payload, ctx) {
|
|
71863
72340
|
const denied = requireScopes(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
71864
72341
|
if (denied) return denied;
|
|
71865
|
-
const p2 =
|
|
72342
|
+
const p2 = asRecord12(payload);
|
|
71866
72343
|
try {
|
|
71867
72344
|
const projectId = String(p2.projectId ?? "");
|
|
71868
72345
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -71896,7 +72373,7 @@ function handleSkillsReadFile(payload, ctx) {
|
|
|
71896
72373
|
function handleSkillsDelete(payload, ctx) {
|
|
71897
72374
|
const denied = requireScopes(ctx.client, OPERATION_SCOPES.writeWorkspace);
|
|
71898
72375
|
if (denied) return denied;
|
|
71899
|
-
const p2 =
|
|
72376
|
+
const p2 = asRecord12(payload);
|
|
71900
72377
|
try {
|
|
71901
72378
|
const projectId = String(p2.projectId ?? "");
|
|
71902
72379
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -71921,7 +72398,7 @@ function handleSkillsDelete(payload, ctx) {
|
|
|
71921
72398
|
function handleSkillsInstall(payload, ctx) {
|
|
71922
72399
|
const baseDenied = requireScopes(ctx.client, OPERATION_SCOPES.writeWorkspace);
|
|
71923
72400
|
if (baseDenied) return baseDenied;
|
|
71924
|
-
const p2 =
|
|
72401
|
+
const p2 = asRecord12(payload);
|
|
71925
72402
|
try {
|
|
71926
72403
|
const projectId = String(p2.projectId ?? "");
|
|
71927
72404
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -71955,7 +72432,7 @@ function handleSkillsInstall(payload, ctx) {
|
|
|
71955
72432
|
function handleMcpList(payload, ctx) {
|
|
71956
72433
|
const denied = requireScopes(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
71957
72434
|
if (denied) return denied;
|
|
71958
|
-
const p2 =
|
|
72435
|
+
const p2 = asRecord12(payload);
|
|
71959
72436
|
try {
|
|
71960
72437
|
const projectId = String(p2.projectId ?? "");
|
|
71961
72438
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -71979,7 +72456,7 @@ function handleMcpList(payload, ctx) {
|
|
|
71979
72456
|
function handleAdditionalDirsList(payload, ctx) {
|
|
71980
72457
|
const denied = requireScopes(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
71981
72458
|
if (denied) return denied;
|
|
71982
|
-
const p2 =
|
|
72459
|
+
const p2 = asRecord12(payload);
|
|
71983
72460
|
try {
|
|
71984
72461
|
const projectId = String(p2.projectId ?? "");
|
|
71985
72462
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -71994,7 +72471,7 @@ function handleAdditionalDirsList(payload, ctx) {
|
|
|
71994
72471
|
function handleAdditionalDirsAdd(payload, ctx) {
|
|
71995
72472
|
const denied = requireScopes(ctx.client, OPERATION_SCOPES.writeWorkspace);
|
|
71996
72473
|
if (denied) return denied;
|
|
71997
|
-
const p2 =
|
|
72474
|
+
const p2 = asRecord12(payload);
|
|
71998
72475
|
try {
|
|
71999
72476
|
const projectId = String(p2.projectId ?? "");
|
|
72000
72477
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -72012,7 +72489,7 @@ function handleAdditionalDirsAdd(payload, ctx) {
|
|
|
72012
72489
|
function handleAdditionalDirsRemove(payload, ctx) {
|
|
72013
72490
|
const denied = requireScopes(ctx.client, OPERATION_SCOPES.writeWorkspace);
|
|
72014
72491
|
if (denied) return denied;
|
|
72015
|
-
const p2 =
|
|
72492
|
+
const p2 = asRecord12(payload);
|
|
72016
72493
|
try {
|
|
72017
72494
|
const projectId = String(p2.projectId ?? "");
|
|
72018
72495
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -72063,7 +72540,7 @@ function parseMcpWriteConfig(raw) {
|
|
|
72063
72540
|
function handleMcpSave(payload, ctx) {
|
|
72064
72541
|
const baseDenied = requireScopes(ctx.client, OPERATION_SCOPES.writeWorkspace);
|
|
72065
72542
|
if (baseDenied) return baseDenied;
|
|
72066
|
-
const p2 =
|
|
72543
|
+
const p2 = asRecord12(payload);
|
|
72067
72544
|
try {
|
|
72068
72545
|
const projectId = String(p2.projectId ?? "");
|
|
72069
72546
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -72093,7 +72570,7 @@ function handleMcpSave(payload, ctx) {
|
|
|
72093
72570
|
function handleMcpToggle(payload, ctx) {
|
|
72094
72571
|
const baseDenied = requireScopes(ctx.client, OPERATION_SCOPES.writeWorkspace);
|
|
72095
72572
|
if (baseDenied) return baseDenied;
|
|
72096
|
-
const p2 =
|
|
72573
|
+
const p2 = asRecord12(payload);
|
|
72097
72574
|
try {
|
|
72098
72575
|
const projectId = String(p2.projectId ?? "");
|
|
72099
72576
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -72124,7 +72601,7 @@ function handleMcpToggle(payload, ctx) {
|
|
|
72124
72601
|
function handleMcpDelete(payload, ctx) {
|
|
72125
72602
|
const baseDenied = requireScopes(ctx.client, OPERATION_SCOPES.writeWorkspace);
|
|
72126
72603
|
if (baseDenied) return baseDenied;
|
|
72127
|
-
const p2 =
|
|
72604
|
+
const p2 = asRecord12(payload);
|
|
72128
72605
|
try {
|
|
72129
72606
|
const projectId = String(p2.projectId ?? "");
|
|
72130
72607
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -72164,7 +72641,7 @@ function parseMarketplaceScope(raw) {
|
|
|
72164
72641
|
async function handlePluginsList(payload, ctx) {
|
|
72165
72642
|
const denied = requireScopes(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
72166
72643
|
if (denied) return denied;
|
|
72167
|
-
const p2 =
|
|
72644
|
+
const p2 = asRecord12(payload);
|
|
72168
72645
|
try {
|
|
72169
72646
|
const projectId = String(p2.projectId ?? "");
|
|
72170
72647
|
projectRoot(ctx.projects, projectId);
|
|
@@ -72211,7 +72688,7 @@ async function handlePluginsList(payload, ctx) {
|
|
|
72211
72688
|
function handlePluginsGet(payload, ctx) {
|
|
72212
72689
|
const denied = requireScopes(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
72213
72690
|
if (denied) return denied;
|
|
72214
|
-
const p2 =
|
|
72691
|
+
const p2 = asRecord12(payload);
|
|
72215
72692
|
try {
|
|
72216
72693
|
const projectId = String(p2.projectId ?? "");
|
|
72217
72694
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -72235,7 +72712,7 @@ function handlePluginsGet(payload, ctx) {
|
|
|
72235
72712
|
function handlePluginsReadFile(payload, ctx) {
|
|
72236
72713
|
const denied = requireScopes(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
72237
72714
|
if (denied) return denied;
|
|
72238
|
-
const p2 =
|
|
72715
|
+
const p2 = asRecord12(payload);
|
|
72239
72716
|
try {
|
|
72240
72717
|
const projectId = String(p2.projectId ?? "");
|
|
72241
72718
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -72263,7 +72740,7 @@ function handlePluginsReadFile(payload, ctx) {
|
|
|
72263
72740
|
function handlePluginsDelete(payload, ctx) {
|
|
72264
72741
|
const baseDenied = requireScopes(ctx.client, OPERATION_SCOPES.writeWorkspace);
|
|
72265
72742
|
if (baseDenied) return baseDenied;
|
|
72266
|
-
const p2 =
|
|
72743
|
+
const p2 = asRecord12(payload);
|
|
72267
72744
|
try {
|
|
72268
72745
|
const projectId = String(p2.projectId ?? "");
|
|
72269
72746
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -72289,7 +72766,7 @@ function handlePluginsDelete(payload, ctx) {
|
|
|
72289
72766
|
async function handlePluginsInstall(payload, ctx) {
|
|
72290
72767
|
const baseDenied = requireScopes(ctx.client, OPERATION_SCOPES.writeWorkspace);
|
|
72291
72768
|
if (baseDenied) return baseDenied;
|
|
72292
|
-
const p2 =
|
|
72769
|
+
const p2 = asRecord12(payload);
|
|
72293
72770
|
try {
|
|
72294
72771
|
const projectId = String(p2.projectId ?? "");
|
|
72295
72772
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -72315,7 +72792,7 @@ async function handlePluginsInstall(payload, ctx) {
|
|
|
72315
72792
|
function handlePluginsUpdate(payload, ctx) {
|
|
72316
72793
|
const baseDenied = requireScopes(ctx.client, OPERATION_SCOPES.writeWorkspace);
|
|
72317
72794
|
if (baseDenied) return baseDenied;
|
|
72318
|
-
const p2 =
|
|
72795
|
+
const p2 = asRecord12(payload);
|
|
72319
72796
|
try {
|
|
72320
72797
|
const projectId = String(p2.projectId ?? "");
|
|
72321
72798
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -72341,7 +72818,7 @@ function handlePluginsUpdate(payload, ctx) {
|
|
|
72341
72818
|
function handlePluginsListMarketplace(payload, ctx) {
|
|
72342
72819
|
const denied = requireScopes(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
72343
72820
|
if (denied) return denied;
|
|
72344
|
-
const p2 =
|
|
72821
|
+
const p2 = asRecord12(payload);
|
|
72345
72822
|
try {
|
|
72346
72823
|
const projectId = String(p2.projectId ?? "");
|
|
72347
72824
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -72363,7 +72840,7 @@ function handlePluginsListMarketplace(payload, ctx) {
|
|
|
72363
72840
|
async function handlePluginsAddMarketplace(payload, ctx) {
|
|
72364
72841
|
const baseDenied = requireScopes(ctx.client, OPERATION_SCOPES.writeWorkspace);
|
|
72365
72842
|
if (baseDenied) return baseDenied;
|
|
72366
|
-
const p2 =
|
|
72843
|
+
const p2 = asRecord12(payload);
|
|
72367
72844
|
try {
|
|
72368
72845
|
const projectId = String(p2.projectId ?? "");
|
|
72369
72846
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -72389,7 +72866,7 @@ async function handlePluginsAddMarketplace(payload, ctx) {
|
|
|
72389
72866
|
async function handlePluginsRemoveMarketplace(payload, ctx) {
|
|
72390
72867
|
const baseDenied = requireScopes(ctx.client, OPERATION_SCOPES.writeWorkspace);
|
|
72391
72868
|
if (baseDenied) return baseDenied;
|
|
72392
|
-
const p2 =
|
|
72869
|
+
const p2 = asRecord12(payload);
|
|
72393
72870
|
try {
|
|
72394
72871
|
const projectId = String(p2.projectId ?? "");
|
|
72395
72872
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -72424,7 +72901,7 @@ async function handlePluginsUpdateMarketplace(payload, ctx) {
|
|
|
72424
72901
|
if (denied) return denied;
|
|
72425
72902
|
const adminDenied = requireScopes(ctx.client, OPERATION_SCOPES.adminNode);
|
|
72426
72903
|
if (adminDenied) return adminDenied;
|
|
72427
|
-
const p2 =
|
|
72904
|
+
const p2 = asRecord12(payload);
|
|
72428
72905
|
try {
|
|
72429
72906
|
const projectId = String(p2.projectId ?? "");
|
|
72430
72907
|
if (projectId) {
|
|
@@ -72446,7 +72923,7 @@ async function handlePluginsUpdateMarketplace(payload, ctx) {
|
|
|
72446
72923
|
function handlePluginsReadMarketplace(payload, ctx) {
|
|
72447
72924
|
const denied = requireScopes(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
72448
72925
|
if (denied) return denied;
|
|
72449
|
-
const p2 =
|
|
72926
|
+
const p2 = asRecord12(payload);
|
|
72450
72927
|
try {
|
|
72451
72928
|
const projectId = String(p2.projectId ?? "");
|
|
72452
72929
|
if (projectId) {
|
|
@@ -72477,7 +72954,7 @@ function handlePluginsReadMarketplace(payload, ctx) {
|
|
|
72477
72954
|
function handlePluginsReadMarketplaceFile(payload, ctx) {
|
|
72478
72955
|
const denied = requireScopes(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
72479
72956
|
if (denied) return denied;
|
|
72480
|
-
const p2 =
|
|
72957
|
+
const p2 = asRecord12(payload);
|
|
72481
72958
|
try {
|
|
72482
72959
|
const projectId = String(p2.projectId ?? "");
|
|
72483
72960
|
if (projectId) {
|
|
@@ -72511,7 +72988,7 @@ function handlePluginsReadMarketplaceFile(payload, ctx) {
|
|
|
72511
72988
|
function handleAgentsList(payload, ctx) {
|
|
72512
72989
|
const denied = requireScopes(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
72513
72990
|
if (denied) return denied;
|
|
72514
|
-
const p2 =
|
|
72991
|
+
const p2 = asRecord12(payload);
|
|
72515
72992
|
try {
|
|
72516
72993
|
const projectId = String(p2.projectId ?? "");
|
|
72517
72994
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -72528,7 +73005,7 @@ function handleAgentsList(payload, ctx) {
|
|
|
72528
73005
|
function handleAgentsReadFile(payload, ctx) {
|
|
72529
73006
|
const denied = requireScopes(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
72530
73007
|
if (denied) return denied;
|
|
72531
|
-
const p2 =
|
|
73008
|
+
const p2 = asRecord12(payload);
|
|
72532
73009
|
try {
|
|
72533
73010
|
const projectId = String(p2.projectId ?? "");
|
|
72534
73011
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -72560,7 +73037,7 @@ function parseHookSavePayload(raw) {
|
|
|
72560
73037
|
function handleHooksList(payload, ctx) {
|
|
72561
73038
|
const denied = requireScopes(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
72562
73039
|
if (denied) return denied;
|
|
72563
|
-
const p2 =
|
|
73040
|
+
const p2 = asRecord12(payload);
|
|
72564
73041
|
try {
|
|
72565
73042
|
const projectId = String(p2.projectId ?? "");
|
|
72566
73043
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -72573,7 +73050,7 @@ function handleHooksList(payload, ctx) {
|
|
|
72573
73050
|
function handleHooksSave(payload, ctx) {
|
|
72574
73051
|
const baseDenied = requireScopes(ctx.client, OPERATION_SCOPES.writeWorkspace);
|
|
72575
73052
|
if (baseDenied) return baseDenied;
|
|
72576
|
-
const p2 =
|
|
73053
|
+
const p2 = asRecord12(payload);
|
|
72577
73054
|
try {
|
|
72578
73055
|
const projectId = String(p2.projectId ?? "");
|
|
72579
73056
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -72601,7 +73078,7 @@ function handleHooksSave(payload, ctx) {
|
|
|
72601
73078
|
function handleHooksDelete(payload, ctx) {
|
|
72602
73079
|
const baseDenied = requireScopes(ctx.client, OPERATION_SCOPES.writeWorkspace);
|
|
72603
73080
|
if (baseDenied) return baseDenied;
|
|
72604
|
-
const p2 =
|
|
73081
|
+
const p2 = asRecord12(payload);
|
|
72605
73082
|
try {
|
|
72606
73083
|
const projectId = String(p2.projectId ?? "");
|
|
72607
73084
|
const cwd = projectRoot(ctx.projects, projectId);
|
|
@@ -72706,7 +73183,7 @@ function requireScopes2(client3, scopes) {
|
|
|
72706
73183
|
}
|
|
72707
73184
|
return null;
|
|
72708
73185
|
}
|
|
72709
|
-
function
|
|
73186
|
+
function asRecord13(payload) {
|
|
72710
73187
|
return payload && typeof payload === "object" ? payload : {};
|
|
72711
73188
|
}
|
|
72712
73189
|
function mapThrown2(err) {
|
|
@@ -72797,7 +73274,7 @@ function parseSchedule(raw) {
|
|
|
72797
73274
|
function handleAutomationList(payload, ctx) {
|
|
72798
73275
|
const denied = requireScopes2(ctx.client, OPERATION_SCOPES.readSession);
|
|
72799
73276
|
if (denied) return denied;
|
|
72800
|
-
const p2 =
|
|
73277
|
+
const p2 = asRecord13(payload);
|
|
72801
73278
|
const projectId = String(p2.projectId ?? "").trim();
|
|
72802
73279
|
if (!projectId) {
|
|
72803
73280
|
return { error: { code: "invalid_argument", message: "projectId is required" } };
|
|
@@ -72816,7 +73293,7 @@ function handleAutomationList(payload, ctx) {
|
|
|
72816
73293
|
function handleAutomationCreate(payload, ctx) {
|
|
72817
73294
|
const denied = requireScopes2(ctx.client, OPERATION_SCOPES.operateSession);
|
|
72818
73295
|
if (denied) return denied;
|
|
72819
|
-
const p2 =
|
|
73296
|
+
const p2 = asRecord13(payload);
|
|
72820
73297
|
const projectId = String(p2.projectId ?? "").trim();
|
|
72821
73298
|
if (!projectId) {
|
|
72822
73299
|
return { error: { code: "invalid_argument", message: "projectId is required" } };
|
|
@@ -72853,7 +73330,7 @@ function handleAutomationCreate(payload, ctx) {
|
|
|
72853
73330
|
function handleAutomationUpdate(payload, ctx) {
|
|
72854
73331
|
const denied = requireScopes2(ctx.client, OPERATION_SCOPES.operateSession);
|
|
72855
73332
|
if (denied) return denied;
|
|
72856
|
-
const p2 =
|
|
73333
|
+
const p2 = asRecord13(payload);
|
|
72857
73334
|
const automationId = String(p2.automationId ?? p2.id ?? "").trim();
|
|
72858
73335
|
if (!automationId) {
|
|
72859
73336
|
return { error: { code: "invalid_argument", message: "automationId is required" } };
|
|
@@ -72897,7 +73374,7 @@ function handleAutomationUpdate(payload, ctx) {
|
|
|
72897
73374
|
function handleAutomationDelete(payload, ctx) {
|
|
72898
73375
|
const denied = requireScopes2(ctx.client, OPERATION_SCOPES.operateSession);
|
|
72899
73376
|
if (denied) return denied;
|
|
72900
|
-
const p2 =
|
|
73377
|
+
const p2 = asRecord13(payload);
|
|
72901
73378
|
const automationId = String(p2.automationId ?? p2.id ?? "").trim();
|
|
72902
73379
|
if (!automationId) {
|
|
72903
73380
|
return { error: { code: "invalid_argument", message: "automationId is required" } };
|
|
@@ -72923,7 +73400,7 @@ function handleAutomationDelete(payload, ctx) {
|
|
|
72923
73400
|
async function handleAutomationRunNow(payload, ctx) {
|
|
72924
73401
|
const denied = requireScopes2(ctx.client, OPERATION_SCOPES.operateSession);
|
|
72925
73402
|
if (denied) return denied;
|
|
72926
|
-
const p2 =
|
|
73403
|
+
const p2 = asRecord13(payload);
|
|
72927
73404
|
const automationId = String(p2.automationId ?? p2.id ?? "").trim();
|
|
72928
73405
|
if (!automationId) {
|
|
72929
73406
|
return { error: { code: "invalid_argument", message: "automationId is required" } };
|
|
@@ -72980,7 +73457,7 @@ function requireScopes3(client3, scopes) {
|
|
|
72980
73457
|
}
|
|
72981
73458
|
return null;
|
|
72982
73459
|
}
|
|
72983
|
-
function
|
|
73460
|
+
function asRecord14(payload) {
|
|
72984
73461
|
return payload && typeof payload === "object" ? payload : {};
|
|
72985
73462
|
}
|
|
72986
73463
|
function optionalString(value) {
|
|
@@ -72989,7 +73466,7 @@ function optionalString(value) {
|
|
|
72989
73466
|
function parseAttachments(value) {
|
|
72990
73467
|
if (!Array.isArray(value)) return [];
|
|
72991
73468
|
return value.flatMap((raw) => {
|
|
72992
|
-
const a =
|
|
73469
|
+
const a = asRecord14(raw);
|
|
72993
73470
|
const name = typeof a.name === "string" ? a.name : "";
|
|
72994
73471
|
const mimeType = typeof a.mimeType === "string" ? a.mimeType : "";
|
|
72995
73472
|
const data = typeof a.data === "string" ? a.data : "";
|
|
@@ -73002,7 +73479,7 @@ function mapThrown3(err) {
|
|
|
73002
73479
|
function handleDraftList(payload, ctx) {
|
|
73003
73480
|
const denied = requireScopes3(ctx.client, OPERATION_SCOPES.readSession);
|
|
73004
73481
|
if (denied) return denied;
|
|
73005
|
-
const p2 =
|
|
73482
|
+
const p2 = asRecord14(payload);
|
|
73006
73483
|
const projectPath = optionalString(p2.projectPath);
|
|
73007
73484
|
try {
|
|
73008
73485
|
return { result: { drafts: ctx.drafts.list(projectPath ?? void 0) } };
|
|
@@ -73013,7 +73490,7 @@ function handleDraftList(payload, ctx) {
|
|
|
73013
73490
|
function handleDraftUpsert(payload, ctx) {
|
|
73014
73491
|
const denied = requireScopes3(ctx.client, OPERATION_SCOPES.operateSession);
|
|
73015
73492
|
if (denied) return denied;
|
|
73016
|
-
const p2 =
|
|
73493
|
+
const p2 = asRecord14(payload);
|
|
73017
73494
|
const id = String(p2.id ?? "").trim();
|
|
73018
73495
|
if (!id) {
|
|
73019
73496
|
return { error: { code: "invalid_argument", message: "id is required" } };
|
|
@@ -73044,7 +73521,7 @@ function handleDraftUpsert(payload, ctx) {
|
|
|
73044
73521
|
function handleDraftDelete(payload, ctx) {
|
|
73045
73522
|
const denied = requireScopes3(ctx.client, OPERATION_SCOPES.operateSession);
|
|
73046
73523
|
if (denied) return denied;
|
|
73047
|
-
const p2 =
|
|
73524
|
+
const p2 = asRecord14(payload);
|
|
73048
73525
|
const draftId = String(p2.draftId ?? "").trim();
|
|
73049
73526
|
if (!draftId) {
|
|
73050
73527
|
return { error: { code: "invalid_argument", message: "draftId is required" } };
|
|
@@ -73078,7 +73555,7 @@ function requireScopes4(client3, scopes) {
|
|
|
73078
73555
|
}
|
|
73079
73556
|
return null;
|
|
73080
73557
|
}
|
|
73081
|
-
function
|
|
73558
|
+
function asRecord15(payload) {
|
|
73082
73559
|
return payload && typeof payload === "object" ? payload : {};
|
|
73083
73560
|
}
|
|
73084
73561
|
function mapThrown4(err) {
|
|
@@ -73105,6 +73582,14 @@ async function dispatchCodexRpc(method, payload, ctx) {
|
|
|
73105
73582
|
return handleGetAuthStatus(payload, ctx);
|
|
73106
73583
|
case "codex.setAuth":
|
|
73107
73584
|
return handleSetAuth(payload, ctx);
|
|
73585
|
+
case "codex.getAccountStatus":
|
|
73586
|
+
return handleGetAccountStatus(payload, ctx);
|
|
73587
|
+
case "codex.accountLoginStart":
|
|
73588
|
+
return handleAccountLoginStart(payload, ctx);
|
|
73589
|
+
case "codex.accountLoginCancel":
|
|
73590
|
+
return handleAccountLoginCancel(payload, ctx);
|
|
73591
|
+
case "codex.accountLogout":
|
|
73592
|
+
return handleAccountLogout(payload, ctx);
|
|
73108
73593
|
case "codex.getRateLimits":
|
|
73109
73594
|
return handleGetRateLimits(payload, ctx);
|
|
73110
73595
|
case "codex.getAccountUsage":
|
|
@@ -73137,6 +73622,9 @@ async function dispatchCodexRpc(method, payload, ctx) {
|
|
|
73137
73622
|
}
|
|
73138
73623
|
var CODEX_MUTATING_METHODS = [
|
|
73139
73624
|
"codex.setAuth",
|
|
73625
|
+
"codex.accountLoginStart",
|
|
73626
|
+
"codex.accountLoginCancel",
|
|
73627
|
+
"codex.accountLogout",
|
|
73140
73628
|
"codex.consumeRateLimitReset",
|
|
73141
73629
|
"codex.loginMcpOauth",
|
|
73142
73630
|
"codex.importExternalAgent",
|
|
@@ -73149,7 +73637,7 @@ var CODEX_MUTATING_METHODS = [
|
|
|
73149
73637
|
function handleGetAuthStatus(payload, ctx) {
|
|
73150
73638
|
const denied = requireScopes4(ctx.client, OPERATION_SCOPES.readEnvironment);
|
|
73151
73639
|
if (denied) return denied;
|
|
73152
|
-
const p2 =
|
|
73640
|
+
const p2 = asRecord15(payload);
|
|
73153
73641
|
const projectId = projectIdOf(p2);
|
|
73154
73642
|
if (!projectId) {
|
|
73155
73643
|
return { error: { code: "invalid_argument", message: "projectId required" } };
|
|
@@ -73162,7 +73650,7 @@ function handleGetAuthStatus(payload, ctx) {
|
|
|
73162
73650
|
function handleSetAuth(payload, ctx) {
|
|
73163
73651
|
const denied = requireScopes4(ctx.client, OPERATION_SCOPES.adminNode);
|
|
73164
73652
|
if (denied) return denied;
|
|
73165
|
-
const p2 =
|
|
73653
|
+
const p2 = asRecord15(payload);
|
|
73166
73654
|
const projectId = projectIdOf(p2);
|
|
73167
73655
|
if (!projectId) {
|
|
73168
73656
|
return { error: { code: "invalid_argument", message: "projectId required" } };
|
|
@@ -73184,10 +73672,62 @@ function handleSetAuth(payload, ctx) {
|
|
|
73184
73672
|
return mapThrown4(err);
|
|
73185
73673
|
}
|
|
73186
73674
|
}
|
|
73675
|
+
async function handleGetAccountStatus(payload, ctx) {
|
|
73676
|
+
const denied = requireScopes4(ctx.client, OPERATION_SCOPES.readEnvironment);
|
|
73677
|
+
if (denied) return denied;
|
|
73678
|
+
const p2 = asRecord15(payload);
|
|
73679
|
+
const projectId = projectIdOf(p2);
|
|
73680
|
+
if (!projectId) return { error: { code: "invalid_argument", message: "projectId required" } };
|
|
73681
|
+
if (!ctx.projects.get(projectId)) return { error: { code: "not_found", message: "project not found" } };
|
|
73682
|
+
try {
|
|
73683
|
+
return { result: await admin(ctx).getAccountStatus() };
|
|
73684
|
+
} catch (err) {
|
|
73685
|
+
return mapThrown4(err);
|
|
73686
|
+
}
|
|
73687
|
+
}
|
|
73688
|
+
async function handleAccountLoginStart(payload, ctx) {
|
|
73689
|
+
const denied = requireScopes4(ctx.client, OPERATION_SCOPES.adminNode);
|
|
73690
|
+
if (denied) return denied;
|
|
73691
|
+
const p2 = asRecord15(payload);
|
|
73692
|
+
const projectId = projectIdOf(p2);
|
|
73693
|
+
if (!projectId) return { error: { code: "invalid_argument", message: "projectId required" } };
|
|
73694
|
+
if (!ctx.projects.get(projectId)) return { error: { code: "not_found", message: "project not found" } };
|
|
73695
|
+
try {
|
|
73696
|
+
return { result: await admin(ctx).startAccountLogin(projectId) };
|
|
73697
|
+
} catch (err) {
|
|
73698
|
+
return mapThrown4(err);
|
|
73699
|
+
}
|
|
73700
|
+
}
|
|
73701
|
+
async function handleAccountLoginCancel(payload, ctx) {
|
|
73702
|
+
const denied = requireScopes4(ctx.client, OPERATION_SCOPES.adminNode);
|
|
73703
|
+
if (denied) return denied;
|
|
73704
|
+
const p2 = asRecord15(payload);
|
|
73705
|
+
const loginId = typeof p2.loginId === "string" ? p2.loginId.trim() : "";
|
|
73706
|
+
if (!loginId) return { error: { code: "invalid_argument", message: "loginId required" } };
|
|
73707
|
+
try {
|
|
73708
|
+
await admin(ctx).cancelAccountLogin(loginId);
|
|
73709
|
+
return { result: { ok: true } };
|
|
73710
|
+
} catch (err) {
|
|
73711
|
+
return mapThrown4(err);
|
|
73712
|
+
}
|
|
73713
|
+
}
|
|
73714
|
+
async function handleAccountLogout(payload, ctx) {
|
|
73715
|
+
const denied = requireScopes4(ctx.client, OPERATION_SCOPES.adminNode);
|
|
73716
|
+
if (denied) return denied;
|
|
73717
|
+
const p2 = asRecord15(payload);
|
|
73718
|
+
const projectId = projectIdOf(p2);
|
|
73719
|
+
if (!projectId) return { error: { code: "invalid_argument", message: "projectId required" } };
|
|
73720
|
+
if (!ctx.projects.get(projectId)) return { error: { code: "not_found", message: "project not found" } };
|
|
73721
|
+
try {
|
|
73722
|
+
return { result: await admin(ctx).logoutAccount() };
|
|
73723
|
+
} catch (err) {
|
|
73724
|
+
return mapThrown4(err);
|
|
73725
|
+
}
|
|
73726
|
+
}
|
|
73187
73727
|
async function handleGetRateLimits(payload, ctx) {
|
|
73188
73728
|
const denied = requireScopes4(ctx.client, OPERATION_SCOPES.readEnvironment);
|
|
73189
73729
|
if (denied) return denied;
|
|
73190
|
-
const p2 =
|
|
73730
|
+
const p2 = asRecord15(payload);
|
|
73191
73731
|
const projectId = projectIdOf(p2);
|
|
73192
73732
|
if (!projectId) {
|
|
73193
73733
|
return { error: { code: "invalid_argument", message: "projectId required" } };
|
|
@@ -73214,7 +73754,7 @@ async function handleGetRateLimits(payload, ctx) {
|
|
|
73214
73754
|
async function handleGetAccountUsage(payload, ctx) {
|
|
73215
73755
|
const denied = requireScopes4(ctx.client, OPERATION_SCOPES.readEnvironment);
|
|
73216
73756
|
if (denied) return denied;
|
|
73217
|
-
const p2 =
|
|
73757
|
+
const p2 = asRecord15(payload);
|
|
73218
73758
|
const projectId = projectIdOf(p2);
|
|
73219
73759
|
if (!projectId) {
|
|
73220
73760
|
return { error: { code: "invalid_argument", message: "projectId required" } };
|
|
@@ -73241,7 +73781,7 @@ async function handleGetAccountUsage(payload, ctx) {
|
|
|
73241
73781
|
async function handleConsumeRateLimitReset(payload, ctx) {
|
|
73242
73782
|
const denied = requireScopes4(ctx.client, OPERATION_SCOPES.adminNode);
|
|
73243
73783
|
if (denied) return denied;
|
|
73244
|
-
const p2 =
|
|
73784
|
+
const p2 = asRecord15(payload);
|
|
73245
73785
|
const projectId = projectIdOf(p2);
|
|
73246
73786
|
if (!projectId) {
|
|
73247
73787
|
return { error: { code: "invalid_argument", message: "projectId required" } };
|
|
@@ -73271,7 +73811,7 @@ async function handleConsumeRateLimitReset(payload, ctx) {
|
|
|
73271
73811
|
async function handleLoginMcpOauth(payload, ctx) {
|
|
73272
73812
|
const denied = requireScopes4(ctx.client, OPERATION_SCOPES.adminNode);
|
|
73273
73813
|
if (denied) return denied;
|
|
73274
|
-
const p2 =
|
|
73814
|
+
const p2 = asRecord15(payload);
|
|
73275
73815
|
const projectId = projectIdOf(p2);
|
|
73276
73816
|
const serverName = String(p2.serverName ?? p2.name ?? "").trim();
|
|
73277
73817
|
if (!projectId || !serverName) {
|
|
@@ -73291,7 +73831,7 @@ async function handleLoginMcpOauth(payload, ctx) {
|
|
|
73291
73831
|
async function handleDetectExternalAgent(payload, ctx) {
|
|
73292
73832
|
const denied = requireScopes4(ctx.client, OPERATION_SCOPES.readEnvironment);
|
|
73293
73833
|
if (denied) return denied;
|
|
73294
|
-
const p2 =
|
|
73834
|
+
const p2 = asRecord15(payload);
|
|
73295
73835
|
const projectId = projectIdOf(p2);
|
|
73296
73836
|
if (!projectId) {
|
|
73297
73837
|
return { error: { code: "invalid_argument", message: "projectId required" } };
|
|
@@ -73310,7 +73850,7 @@ async function handleDetectExternalAgent(payload, ctx) {
|
|
|
73310
73850
|
async function handleImportExternalAgent(payload, ctx) {
|
|
73311
73851
|
const denied = requireScopes4(ctx.client, OPERATION_SCOPES.adminNode);
|
|
73312
73852
|
if (denied) return denied;
|
|
73313
|
-
const p2 =
|
|
73853
|
+
const p2 = asRecord15(payload);
|
|
73314
73854
|
const projectId = projectIdOf(p2);
|
|
73315
73855
|
if (!projectId) {
|
|
73316
73856
|
return { error: { code: "invalid_argument", message: "projectId required" } };
|
|
@@ -73328,7 +73868,7 @@ async function handleImportExternalAgent(payload, ctx) {
|
|
|
73328
73868
|
async function handlePluginsList2(payload, ctx) {
|
|
73329
73869
|
const denied = requireScopes4(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
73330
73870
|
if (denied) return denied;
|
|
73331
|
-
const p2 =
|
|
73871
|
+
const p2 = asRecord15(payload);
|
|
73332
73872
|
const projectId = projectIdOf(p2);
|
|
73333
73873
|
if (!projectId) {
|
|
73334
73874
|
return { error: { code: "invalid_argument", message: "projectId required" } };
|
|
@@ -73351,7 +73891,7 @@ async function handlePluginsList2(payload, ctx) {
|
|
|
73351
73891
|
async function handlePluginsInstall2(payload, ctx) {
|
|
73352
73892
|
const denied = requireScopes4(ctx.client, OPERATION_SCOPES.adminNode);
|
|
73353
73893
|
if (denied) return denied;
|
|
73354
|
-
const p2 =
|
|
73894
|
+
const p2 = asRecord15(payload);
|
|
73355
73895
|
const projectId = projectIdOf(p2);
|
|
73356
73896
|
const key = String(p2.key ?? p2.pluginId ?? "").trim();
|
|
73357
73897
|
if (!projectId || !key) {
|
|
@@ -73367,7 +73907,7 @@ async function handlePluginsInstall2(payload, ctx) {
|
|
|
73367
73907
|
async function handlePluginsUninstall(payload, ctx) {
|
|
73368
73908
|
const denied = requireScopes4(ctx.client, OPERATION_SCOPES.adminNode);
|
|
73369
73909
|
if (denied) return denied;
|
|
73370
|
-
const p2 =
|
|
73910
|
+
const p2 = asRecord15(payload);
|
|
73371
73911
|
const projectId = projectIdOf(p2);
|
|
73372
73912
|
const key = String(p2.key ?? p2.pluginId ?? "").trim();
|
|
73373
73913
|
if (!projectId || !key) {
|
|
@@ -73383,7 +73923,7 @@ async function handlePluginsUninstall(payload, ctx) {
|
|
|
73383
73923
|
async function handleMarketplaceAdd(payload, ctx) {
|
|
73384
73924
|
const denied = requireScopes4(ctx.client, OPERATION_SCOPES.adminNode);
|
|
73385
73925
|
if (denied) return denied;
|
|
73386
|
-
const p2 =
|
|
73926
|
+
const p2 = asRecord15(payload);
|
|
73387
73927
|
const projectId = projectIdOf(p2);
|
|
73388
73928
|
const source = String(p2.source ?? "").trim();
|
|
73389
73929
|
if (!projectId || !source) {
|
|
@@ -73412,7 +73952,7 @@ async function handleMarketplaceAdd(payload, ctx) {
|
|
|
73412
73952
|
async function handleMarketplaceRemove(payload, ctx) {
|
|
73413
73953
|
const denied = requireScopes4(ctx.client, OPERATION_SCOPES.adminNode);
|
|
73414
73954
|
if (denied) return denied;
|
|
73415
|
-
const p2 =
|
|
73955
|
+
const p2 = asRecord15(payload);
|
|
73416
73956
|
const projectId = projectIdOf(p2);
|
|
73417
73957
|
const marketplaceName = String(p2.marketplaceName ?? p2.name ?? "").trim();
|
|
73418
73958
|
if (!projectId || !marketplaceName) {
|
|
@@ -73435,7 +73975,7 @@ async function handleMarketplaceRemove(payload, ctx) {
|
|
|
73435
73975
|
async function handleMarketplaceUpgrade(payload, ctx) {
|
|
73436
73976
|
const denied = requireScopes4(ctx.client, OPERATION_SCOPES.adminNode);
|
|
73437
73977
|
if (denied) return denied;
|
|
73438
|
-
const p2 =
|
|
73978
|
+
const p2 = asRecord15(payload);
|
|
73439
73979
|
const projectId = projectIdOf(p2);
|
|
73440
73980
|
if (!projectId) {
|
|
73441
73981
|
return { error: { code: "invalid_argument", message: "projectId required" } };
|
|
@@ -73468,7 +74008,7 @@ function requireScopes5(client3, scopes) {
|
|
|
73468
74008
|
}
|
|
73469
74009
|
return null;
|
|
73470
74010
|
}
|
|
73471
|
-
function
|
|
74011
|
+
function asRecord16(payload) {
|
|
73472
74012
|
return payload && typeof payload === "object" ? payload : {};
|
|
73473
74013
|
}
|
|
73474
74014
|
function mapThrown5(err) {
|
|
@@ -73497,7 +74037,7 @@ function dispatchSessionProviderRpc(method, payload, ctx) {
|
|
|
73497
74037
|
function handleList(payload, ctx) {
|
|
73498
74038
|
const denied = requireScopes5(ctx.client, OPERATION_SCOPES.readEnvironment);
|
|
73499
74039
|
if (denied) return denied;
|
|
73500
|
-
const p2 =
|
|
74040
|
+
const p2 = asRecord16(payload);
|
|
73501
74041
|
try {
|
|
73502
74042
|
const harnessId = typeof p2.harnessId === "string" && p2.harnessId.trim() ? p2.harnessId.trim() : null;
|
|
73503
74043
|
const providers = harnessId ? ctx.sessionProviders.listByHarness(harnessId) : ctx.sessionProviders.list();
|
|
@@ -73509,7 +74049,7 @@ function handleList(payload, ctx) {
|
|
|
73509
74049
|
function handleGet(payload, ctx) {
|
|
73510
74050
|
const denied = requireScopes5(ctx.client, OPERATION_SCOPES.readEnvironment);
|
|
73511
74051
|
if (denied) return denied;
|
|
73512
|
-
const p2 =
|
|
74052
|
+
const p2 = asRecord16(payload);
|
|
73513
74053
|
const id = String(p2.id ?? "");
|
|
73514
74054
|
if (!id) return { error: { code: "invalid_argument", message: "id required" } };
|
|
73515
74055
|
try {
|
|
@@ -73521,7 +74061,7 @@ function handleGet(payload, ctx) {
|
|
|
73521
74061
|
function handleGetBase(payload, ctx) {
|
|
73522
74062
|
const denied = requireScopes5(ctx.client, OPERATION_SCOPES.readEnvironment);
|
|
73523
74063
|
if (denied) return denied;
|
|
73524
|
-
const p2 =
|
|
74064
|
+
const p2 = asRecord16(payload);
|
|
73525
74065
|
const harnessId = String(p2.harnessId ?? "");
|
|
73526
74066
|
if (!harnessId) return { error: { code: "invalid_argument", message: "harnessId required" } };
|
|
73527
74067
|
try {
|
|
@@ -73533,7 +74073,7 @@ function handleGetBase(payload, ctx) {
|
|
|
73533
74073
|
function handleCreate(payload, ctx) {
|
|
73534
74074
|
const denied = requireScopes5(ctx.client, OPERATION_SCOPES.adminNode);
|
|
73535
74075
|
if (denied) return denied;
|
|
73536
|
-
const p2 =
|
|
74076
|
+
const p2 = asRecord16(payload);
|
|
73537
74077
|
try {
|
|
73538
74078
|
const provider = ctx.sessionProviders.create({
|
|
73539
74079
|
harnessId: String(p2.harnessId ?? ""),
|
|
@@ -73549,7 +74089,7 @@ function handleCreate(payload, ctx) {
|
|
|
73549
74089
|
function handleUpdate(payload, ctx) {
|
|
73550
74090
|
const denied = requireScopes5(ctx.client, OPERATION_SCOPES.adminNode);
|
|
73551
74091
|
if (denied) return denied;
|
|
73552
|
-
const p2 =
|
|
74092
|
+
const p2 = asRecord16(payload);
|
|
73553
74093
|
const id = String(p2.id ?? "");
|
|
73554
74094
|
if (!id) return { error: { code: "invalid_argument", message: "id required" } };
|
|
73555
74095
|
try {
|
|
@@ -73565,7 +74105,7 @@ function handleUpdate(payload, ctx) {
|
|
|
73565
74105
|
function handleDelete(payload, ctx) {
|
|
73566
74106
|
const denied = requireScopes5(ctx.client, OPERATION_SCOPES.adminNode);
|
|
73567
74107
|
if (denied) return denied;
|
|
73568
|
-
const p2 =
|
|
74108
|
+
const p2 = asRecord16(payload);
|
|
73569
74109
|
const id = String(p2.id ?? "");
|
|
73570
74110
|
if (!id) return { error: { code: "invalid_argument", message: "id required" } };
|
|
73571
74111
|
try {
|
|
@@ -73606,7 +74146,7 @@ function requireScopes6(client3, scopes) {
|
|
|
73606
74146
|
}
|
|
73607
74147
|
return null;
|
|
73608
74148
|
}
|
|
73609
|
-
function
|
|
74149
|
+
function asRecord17(payload) {
|
|
73610
74150
|
return payload && typeof payload === "object" ? payload : {};
|
|
73611
74151
|
}
|
|
73612
74152
|
function defaultProbeModels(ctx) {
|
|
@@ -73634,7 +74174,7 @@ async function dispatchHarnessResourcesRpc(method, payload, ctx) {
|
|
|
73634
74174
|
async function handleHarnessResources(payload, ctx) {
|
|
73635
74175
|
const denied = requireScopes6(ctx.client, OPERATION_SCOPES.readEnvironment);
|
|
73636
74176
|
if (denied) return denied;
|
|
73637
|
-
const p2 =
|
|
74177
|
+
const p2 = asRecord17(payload);
|
|
73638
74178
|
const projectId = String(p2.projectId ?? "");
|
|
73639
74179
|
if (!projectId) {
|
|
73640
74180
|
return { error: { code: "invalid_argument", message: "projectId required" } };
|
|
@@ -74076,7 +74616,7 @@ function handleProviderListCredentials(ctx) {
|
|
|
74076
74616
|
function handleProviderGetCredentialDecrypted(payload, ctx) {
|
|
74077
74617
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.adminNode);
|
|
74078
74618
|
if (denied) return denied;
|
|
74079
|
-
const p2 =
|
|
74619
|
+
const p2 = asRecord18(payload);
|
|
74080
74620
|
const cred = ctx.providers.getCredentialDecrypted(String(p2.id ?? ""));
|
|
74081
74621
|
if (!cred) return { error: { code: "not_found", message: "credential not found" } };
|
|
74082
74622
|
return { result: cred };
|
|
@@ -74084,7 +74624,7 @@ function handleProviderGetCredentialDecrypted(payload, ctx) {
|
|
|
74084
74624
|
function handleProviderCreateCredential(payload, ctx) {
|
|
74085
74625
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.adminNode);
|
|
74086
74626
|
if (denied) return denied;
|
|
74087
|
-
const p2 =
|
|
74627
|
+
const p2 = asRecord18(payload);
|
|
74088
74628
|
try {
|
|
74089
74629
|
return {
|
|
74090
74630
|
result: ctx.providers.createCredential({
|
|
@@ -74106,7 +74646,7 @@ function handleProviderCreateCredential(payload, ctx) {
|
|
|
74106
74646
|
function handleProviderUpdateCredential(payload, ctx) {
|
|
74107
74647
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.adminNode);
|
|
74108
74648
|
if (denied) return denied;
|
|
74109
|
-
const p2 =
|
|
74649
|
+
const p2 = asRecord18(payload);
|
|
74110
74650
|
const id = String(p2.id ?? "");
|
|
74111
74651
|
const updated = ctx.providers.updateCredential(id, {
|
|
74112
74652
|
name: typeof p2.name === "string" ? p2.name : void 0,
|
|
@@ -74123,7 +74663,7 @@ function handleProviderUpdateCredential(payload, ctx) {
|
|
|
74123
74663
|
function handleProviderDeleteCredential(payload, ctx) {
|
|
74124
74664
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.adminNode);
|
|
74125
74665
|
if (denied) return denied;
|
|
74126
|
-
const p2 =
|
|
74666
|
+
const p2 = asRecord18(payload);
|
|
74127
74667
|
const ok = ctx.providers.deleteCredential(String(p2.id ?? ""));
|
|
74128
74668
|
if (!ok) return { error: { code: "not_found", message: "credential not found" } };
|
|
74129
74669
|
return { result: { ok: true } };
|
|
@@ -74136,7 +74676,7 @@ function handleProviderListBindings(ctx) {
|
|
|
74136
74676
|
function handleProviderSetBinding(payload, ctx) {
|
|
74137
74677
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.adminNode);
|
|
74138
74678
|
if (denied) return denied;
|
|
74139
|
-
const p2 =
|
|
74679
|
+
const p2 = asRecord18(payload);
|
|
74140
74680
|
const binding = p2;
|
|
74141
74681
|
if (!binding.consumer || !binding.credentialId) {
|
|
74142
74682
|
return { error: { code: "invalid_argument", message: "consumer and credentialId required" } };
|
|
@@ -74147,7 +74687,7 @@ function handleProviderSetBinding(payload, ctx) {
|
|
|
74147
74687
|
function handleProviderClearBinding(payload, ctx) {
|
|
74148
74688
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.adminNode);
|
|
74149
74689
|
if (denied) return denied;
|
|
74150
|
-
const p2 =
|
|
74690
|
+
const p2 = asRecord18(payload);
|
|
74151
74691
|
ctx.providers.clearBinding(String(p2.consumer ?? ""));
|
|
74152
74692
|
return { result: { ok: true } };
|
|
74153
74693
|
}
|
|
@@ -74159,14 +74699,14 @@ function handleProviderListCustomPlatforms(ctx) {
|
|
|
74159
74699
|
function handleProviderUpsertCustomPlatform(payload, ctx) {
|
|
74160
74700
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.adminNode);
|
|
74161
74701
|
if (denied) return denied;
|
|
74162
|
-
const def =
|
|
74702
|
+
const def = asRecord18(payload);
|
|
74163
74703
|
if (!def?.id) return { error: { code: "invalid_argument", message: "platform id required" } };
|
|
74164
74704
|
return { result: ctx.providers.upsertCustomPlatform(def) };
|
|
74165
74705
|
}
|
|
74166
74706
|
function handleProviderDeleteCustomPlatform(payload, ctx) {
|
|
74167
74707
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.adminNode);
|
|
74168
74708
|
if (denied) return denied;
|
|
74169
|
-
const p2 =
|
|
74709
|
+
const p2 = asRecord18(payload);
|
|
74170
74710
|
const ok = ctx.providers.deleteCustomPlatform(String(p2.id ?? ""));
|
|
74171
74711
|
if (!ok) return { error: { code: "not_found", message: "custom platform not found" } };
|
|
74172
74712
|
return { result: { ok: true } };
|
|
@@ -74179,7 +74719,7 @@ function handleProviderExportBundle(ctx) {
|
|
|
74179
74719
|
function handleProviderListModels(payload, ctx) {
|
|
74180
74720
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readEnvironment);
|
|
74181
74721
|
if (denied) return denied;
|
|
74182
|
-
const p2 =
|
|
74722
|
+
const p2 = asRecord18(payload);
|
|
74183
74723
|
const harness = String(p2.harness ?? p2.harnessId ?? "claude");
|
|
74184
74724
|
const apiProviderId = typeof p2.apiProviderId === "string" && p2.apiProviderId.trim() ? p2.apiProviderId.trim() : null;
|
|
74185
74725
|
return {
|
|
@@ -74191,7 +74731,7 @@ function handleProviderListModels(payload, ctx) {
|
|
|
74191
74731
|
function handleProviderImportBundle(payload, ctx) {
|
|
74192
74732
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.adminNode);
|
|
74193
74733
|
if (denied) return denied;
|
|
74194
|
-
const p2 =
|
|
74734
|
+
const p2 = asRecord18(payload);
|
|
74195
74735
|
const bundle = p2.bundle && typeof p2.bundle === "object" ? p2.bundle : p2;
|
|
74196
74736
|
const replaceAll = p2.replaceAll === true;
|
|
74197
74737
|
try {
|
|
@@ -74256,7 +74796,7 @@ function handleHarnessList(ctx) {
|
|
|
74256
74796
|
function handleHarnessShow(payload, ctx) {
|
|
74257
74797
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.adminNode);
|
|
74258
74798
|
if (denied) return denied;
|
|
74259
|
-
const p2 =
|
|
74799
|
+
const p2 = asRecord18(payload);
|
|
74260
74800
|
const id = typeof p2.harnessId === "string" ? p2.harnessId : typeof p2.id === "string" ? p2.id : "";
|
|
74261
74801
|
if (!isNodeHarnessId(id)) {
|
|
74262
74802
|
return { error: { code: "invalid_argument", message: `unknown harnessId: ${id}` } };
|
|
@@ -74266,7 +74806,7 @@ function handleHarnessShow(payload, ctx) {
|
|
|
74266
74806
|
function handleHarnessProbe(payload, ctx) {
|
|
74267
74807
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.adminNode);
|
|
74268
74808
|
if (denied) return denied;
|
|
74269
|
-
const p2 =
|
|
74809
|
+
const p2 = asRecord18(payload);
|
|
74270
74810
|
const id = typeof p2.harnessId === "string" ? p2.harnessId : typeof p2.id === "string" ? p2.id : "";
|
|
74271
74811
|
if (!isNodeHarnessId(id)) {
|
|
74272
74812
|
return { error: { code: "invalid_argument", message: `unknown harnessId: ${id}` } };
|
|
@@ -74281,7 +74821,7 @@ function handleHarnessProbe(payload, ctx) {
|
|
|
74281
74821
|
async function handleHarnessEnable(payload, ctx) {
|
|
74282
74822
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.adminNode);
|
|
74283
74823
|
if (denied) return denied;
|
|
74284
|
-
const p2 =
|
|
74824
|
+
const p2 = asRecord18(payload);
|
|
74285
74825
|
const id = typeof p2.harnessId === "string" ? p2.harnessId : typeof p2.id === "string" ? p2.id : "";
|
|
74286
74826
|
if (!isNodeHarnessId(id)) {
|
|
74287
74827
|
return { error: { code: "invalid_argument", message: `unknown harnessId: ${id}` } };
|
|
@@ -74307,7 +74847,7 @@ async function handleHarnessEnable(payload, ctx) {
|
|
|
74307
74847
|
function handleHarnessDisable(payload, ctx) {
|
|
74308
74848
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.adminNode);
|
|
74309
74849
|
if (denied) return denied;
|
|
74310
|
-
const p2 =
|
|
74850
|
+
const p2 = asRecord18(payload);
|
|
74311
74851
|
const id = typeof p2.harnessId === "string" ? p2.harnessId : typeof p2.id === "string" ? p2.id : "";
|
|
74312
74852
|
if (!isNodeHarnessId(id)) {
|
|
74313
74853
|
return { error: { code: "invalid_argument", message: `unknown harnessId: ${id}` } };
|
|
@@ -74372,7 +74912,7 @@ function handleSettingsGet(ctx) {
|
|
|
74372
74912
|
function handleSettingsPatch(payload, ctx) {
|
|
74373
74913
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.adminNode);
|
|
74374
74914
|
if (denied) return denied;
|
|
74375
|
-
const p2 =
|
|
74915
|
+
const p2 = asRecord18(payload);
|
|
74376
74916
|
const rawPatch = p2.patch && typeof p2.patch === "object" ? p2.patch : p2;
|
|
74377
74917
|
try {
|
|
74378
74918
|
const settings = patchNodeAgentSettings(
|
|
@@ -74393,13 +74933,13 @@ async function handleSandboxProbe(ctx) {
|
|
|
74393
74933
|
return mapThrown7(err);
|
|
74394
74934
|
}
|
|
74395
74935
|
}
|
|
74396
|
-
function
|
|
74936
|
+
function asRecord18(payload) {
|
|
74397
74937
|
return payload && typeof payload === "object" ? payload : {};
|
|
74398
74938
|
}
|
|
74399
74939
|
function handleTerminalCreate(payload, ctx) {
|
|
74400
74940
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateTerminal);
|
|
74401
74941
|
if (denied) return denied;
|
|
74402
|
-
const p2 =
|
|
74942
|
+
const p2 = asRecord18(payload);
|
|
74403
74943
|
const cwd = typeof p2.cwd === "string" ? p2.cwd : process.cwd();
|
|
74404
74944
|
try {
|
|
74405
74945
|
const info = ctx.terminals.create({
|
|
@@ -74424,7 +74964,7 @@ function handleTerminalCreate(payload, ctx) {
|
|
|
74424
74964
|
function handleTerminalAttach(payload, ctx) {
|
|
74425
74965
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateTerminal);
|
|
74426
74966
|
if (denied) return denied;
|
|
74427
|
-
const p2 =
|
|
74967
|
+
const p2 = asRecord18(payload);
|
|
74428
74968
|
const terminalId = String(p2.terminalId ?? "");
|
|
74429
74969
|
try {
|
|
74430
74970
|
const attached = ctx.terminals.attach(terminalId);
|
|
@@ -74436,7 +74976,7 @@ function handleTerminalAttach(payload, ctx) {
|
|
|
74436
74976
|
function handleTerminalRead(payload, ctx) {
|
|
74437
74977
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateTerminal);
|
|
74438
74978
|
if (denied) return denied;
|
|
74439
|
-
const p2 =
|
|
74979
|
+
const p2 = asRecord18(payload);
|
|
74440
74980
|
try {
|
|
74441
74981
|
return {
|
|
74442
74982
|
result: ctx.terminals.readAfter(
|
|
@@ -74464,7 +75004,7 @@ function requireTerminalLease(payload, ctx, terminalId) {
|
|
|
74464
75004
|
function handleTerminalWrite(payload, ctx) {
|
|
74465
75005
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateTerminal);
|
|
74466
75006
|
if (denied) return denied;
|
|
74467
|
-
const p2 =
|
|
75007
|
+
const p2 = asRecord18(payload);
|
|
74468
75008
|
const terminalId = String(p2.terminalId ?? "");
|
|
74469
75009
|
const leaseErr = requireTerminalLease(p2, ctx, terminalId);
|
|
74470
75010
|
if (leaseErr) return leaseErr;
|
|
@@ -74482,7 +75022,7 @@ function handleTerminalWrite(payload, ctx) {
|
|
|
74482
75022
|
function handleTerminalResize(payload, ctx) {
|
|
74483
75023
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateTerminal);
|
|
74484
75024
|
if (denied) return denied;
|
|
74485
|
-
const p2 =
|
|
75025
|
+
const p2 = asRecord18(payload);
|
|
74486
75026
|
const terminalId = String(p2.terminalId ?? "");
|
|
74487
75027
|
const leaseErr = requireTerminalLease(p2, ctx, terminalId);
|
|
74488
75028
|
if (leaseErr) return leaseErr;
|
|
@@ -74498,7 +75038,7 @@ function handleTerminalResize(payload, ctx) {
|
|
|
74498
75038
|
function handleTerminalKill(payload, ctx) {
|
|
74499
75039
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateTerminal);
|
|
74500
75040
|
if (denied) return denied;
|
|
74501
|
-
const p2 =
|
|
75041
|
+
const p2 = asRecord18(payload);
|
|
74502
75042
|
const terminalId = String(p2.terminalId ?? "");
|
|
74503
75043
|
const leaseErr = requireTerminalLease(p2, ctx, terminalId);
|
|
74504
75044
|
if (leaseErr) return leaseErr;
|
|
@@ -74512,7 +75052,7 @@ function handleTerminalKill(payload, ctx) {
|
|
|
74512
75052
|
function handleTerminalAcquireControl(payload, ctx) {
|
|
74513
75053
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateTerminal);
|
|
74514
75054
|
if (denied) return denied;
|
|
74515
|
-
const p2 =
|
|
75055
|
+
const p2 = asRecord18(payload);
|
|
74516
75056
|
const terminalId = String(p2.terminalId ?? "");
|
|
74517
75057
|
try {
|
|
74518
75058
|
return {
|
|
@@ -74529,7 +75069,7 @@ function handleTerminalAcquireControl(payload, ctx) {
|
|
|
74529
75069
|
function handleTerminalRenewControl(payload, ctx) {
|
|
74530
75070
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateTerminal);
|
|
74531
75071
|
if (denied) return denied;
|
|
74532
|
-
const p2 =
|
|
75072
|
+
const p2 = asRecord18(payload);
|
|
74533
75073
|
try {
|
|
74534
75074
|
return {
|
|
74535
75075
|
result: ctx.leases.renew({
|
|
@@ -74546,7 +75086,7 @@ function handleTerminalRenewControl(payload, ctx) {
|
|
|
74546
75086
|
function handleTerminalReleaseControl(payload, ctx) {
|
|
74547
75087
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateTerminal);
|
|
74548
75088
|
if (denied) return denied;
|
|
74549
|
-
const p2 =
|
|
75089
|
+
const p2 = asRecord18(payload);
|
|
74550
75090
|
try {
|
|
74551
75091
|
ctx.leases.release(
|
|
74552
75092
|
String(p2.leaseId ?? ""),
|
|
@@ -74571,7 +75111,7 @@ function handleProjectList(ctx) {
|
|
|
74571
75111
|
function handleProjectGet(payload, ctx) {
|
|
74572
75112
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readProject);
|
|
74573
75113
|
if (denied) return denied;
|
|
74574
|
-
const p2 =
|
|
75114
|
+
const p2 = asRecord18(payload);
|
|
74575
75115
|
const projectId = String(p2.projectId ?? "");
|
|
74576
75116
|
return { result: ctx.projects.get(projectId) };
|
|
74577
75117
|
}
|
|
@@ -74587,7 +75127,7 @@ function expandHostPath(path) {
|
|
|
74587
75127
|
function handleProjectOpen(payload, ctx) {
|
|
74588
75128
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.manageProject);
|
|
74589
75129
|
if (denied) return denied;
|
|
74590
|
-
const p2 =
|
|
75130
|
+
const p2 = asRecord18(payload);
|
|
74591
75131
|
const path = expandHostPath(String(p2.path ?? ""));
|
|
74592
75132
|
if (!path) {
|
|
74593
75133
|
return { error: { code: "invalid_argument", message: "path is required" } };
|
|
@@ -74605,7 +75145,7 @@ function handleProjectOpen(payload, ctx) {
|
|
|
74605
75145
|
function handleProjectRemove(payload, ctx) {
|
|
74606
75146
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.manageProject);
|
|
74607
75147
|
if (denied) return denied;
|
|
74608
|
-
const p2 =
|
|
75148
|
+
const p2 = asRecord18(payload);
|
|
74609
75149
|
const projectId = typeof p2.projectId === "string" && p2.projectId ? p2.projectId : void 0;
|
|
74610
75150
|
const pathRaw = typeof p2.path === "string" && p2.path ? expandHostPath(p2.path) : void 0;
|
|
74611
75151
|
if (!projectId && !pathRaw) {
|
|
@@ -74624,7 +75164,7 @@ function handleProjectRemove(payload, ctx) {
|
|
|
74624
75164
|
function handleFsListDir(payload, ctx) {
|
|
74625
75165
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
74626
75166
|
if (denied) return denied;
|
|
74627
|
-
const p2 =
|
|
75167
|
+
const p2 = asRecord18(payload);
|
|
74628
75168
|
const raw = String(p2.path ?? "");
|
|
74629
75169
|
if (!raw || raw.includes("\0")) {
|
|
74630
75170
|
return { error: { code: "invalid_argument", message: "path is required" } };
|
|
@@ -74650,7 +75190,7 @@ function handleFsListDir(payload, ctx) {
|
|
|
74650
75190
|
function handleWorkspaceListDir(payload, ctx) {
|
|
74651
75191
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
74652
75192
|
if (denied) return denied;
|
|
74653
|
-
const p2 =
|
|
75193
|
+
const p2 = asRecord18(payload);
|
|
74654
75194
|
try {
|
|
74655
75195
|
return {
|
|
74656
75196
|
result: ctx.workspaceFs.listDir(String(p2.projectId ?? ""), String(p2.relativePath ?? "."))
|
|
@@ -74662,7 +75202,7 @@ function handleWorkspaceListDir(payload, ctx) {
|
|
|
74662
75202
|
function handleWorkspaceListFiles(payload, ctx) {
|
|
74663
75203
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
74664
75204
|
if (denied) return denied;
|
|
74665
|
-
const p2 =
|
|
75205
|
+
const p2 = asRecord18(payload);
|
|
74666
75206
|
try {
|
|
74667
75207
|
return {
|
|
74668
75208
|
result: {
|
|
@@ -74680,7 +75220,7 @@ function handleWorkspaceListFiles(payload, ctx) {
|
|
|
74680
75220
|
function handleWorkspaceListSkills(payload, ctx) {
|
|
74681
75221
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
74682
75222
|
if (denied) return denied;
|
|
74683
|
-
const p2 =
|
|
75223
|
+
const p2 = asRecord18(payload);
|
|
74684
75224
|
try {
|
|
74685
75225
|
return {
|
|
74686
75226
|
result: ctx.workspaceFs.listSkillsAndCommands(String(p2.projectId ?? ""))
|
|
@@ -74692,7 +75232,7 @@ function handleWorkspaceListSkills(payload, ctx) {
|
|
|
74692
75232
|
function handleWorkspaceReadFile(payload, ctx) {
|
|
74693
75233
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
74694
75234
|
if (denied) return denied;
|
|
74695
|
-
const p2 =
|
|
75235
|
+
const p2 = asRecord18(payload);
|
|
74696
75236
|
try {
|
|
74697
75237
|
return {
|
|
74698
75238
|
result: ctx.workspaceFs.readFile(String(p2.projectId ?? ""), String(p2.relativePath ?? ""), {
|
|
@@ -74707,7 +75247,7 @@ function handleWorkspaceReadFile(payload, ctx) {
|
|
|
74707
75247
|
function handleWorkspaceWriteFile(payload, ctx) {
|
|
74708
75248
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.writeWorkspace);
|
|
74709
75249
|
if (denied) return denied;
|
|
74710
|
-
const p2 =
|
|
75250
|
+
const p2 = asRecord18(payload);
|
|
74711
75251
|
const raw = typeof p2.content === "string" ? p2.content : String(p2.content ?? "");
|
|
74712
75252
|
const encoding = p2.encoding === "base64" ? "base64" : "utf8";
|
|
74713
75253
|
let content = raw;
|
|
@@ -74737,7 +75277,7 @@ function handleWorkspaceWriteFile(payload, ctx) {
|
|
|
74737
75277
|
function handleWorkspaceSearch(payload, ctx) {
|
|
74738
75278
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
74739
75279
|
if (denied) return denied;
|
|
74740
|
-
const p2 =
|
|
75280
|
+
const p2 = asRecord18(payload);
|
|
74741
75281
|
try {
|
|
74742
75282
|
return {
|
|
74743
75283
|
result: ctx.workspaceFs.search(
|
|
@@ -74753,7 +75293,7 @@ function handleWorkspaceSearch(payload, ctx) {
|
|
|
74753
75293
|
function handleWorkspaceRename(payload, ctx) {
|
|
74754
75294
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.writeWorkspace);
|
|
74755
75295
|
if (denied) return denied;
|
|
74756
|
-
const p2 =
|
|
75296
|
+
const p2 = asRecord18(payload);
|
|
74757
75297
|
try {
|
|
74758
75298
|
return {
|
|
74759
75299
|
result: ctx.workspaceFs.rename(
|
|
@@ -74769,7 +75309,7 @@ function handleWorkspaceRename(payload, ctx) {
|
|
|
74769
75309
|
function handleWorkspaceMove(payload, ctx) {
|
|
74770
75310
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.writeWorkspace);
|
|
74771
75311
|
if (denied) return denied;
|
|
74772
|
-
const p2 =
|
|
75312
|
+
const p2 = asRecord18(payload);
|
|
74773
75313
|
try {
|
|
74774
75314
|
return {
|
|
74775
75315
|
result: ctx.workspaceFs.move(
|
|
@@ -74785,7 +75325,7 @@ function handleWorkspaceMove(payload, ctx) {
|
|
|
74785
75325
|
function handleWorkspaceDelete(payload, ctx) {
|
|
74786
75326
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.writeWorkspace);
|
|
74787
75327
|
if (denied) return denied;
|
|
74788
|
-
const p2 =
|
|
75328
|
+
const p2 = asRecord18(payload);
|
|
74789
75329
|
try {
|
|
74790
75330
|
return {
|
|
74791
75331
|
result: ctx.workspaceFs.delete(
|
|
@@ -74800,7 +75340,7 @@ function handleWorkspaceDelete(payload, ctx) {
|
|
|
74800
75340
|
function handleWorkspaceMkdir(payload, ctx) {
|
|
74801
75341
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.writeWorkspace);
|
|
74802
75342
|
if (denied) return denied;
|
|
74803
|
-
const p2 =
|
|
75343
|
+
const p2 = asRecord18(payload);
|
|
74804
75344
|
try {
|
|
74805
75345
|
return {
|
|
74806
75346
|
result: ctx.workspaceFs.mkdir(
|
|
@@ -74815,7 +75355,7 @@ function handleWorkspaceMkdir(payload, ctx) {
|
|
|
74815
75355
|
function handleWorkspaceWatchStart(payload, ctx) {
|
|
74816
75356
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
74817
75357
|
if (denied) return denied;
|
|
74818
|
-
const p2 =
|
|
75358
|
+
const p2 = asRecord18(payload);
|
|
74819
75359
|
try {
|
|
74820
75360
|
const events = [];
|
|
74821
75361
|
const { watchId, cancel } = ctx.workspaceWatch.subscribe(
|
|
@@ -74836,7 +75376,7 @@ function handleWorkspaceWatchStart(payload, ctx) {
|
|
|
74836
75376
|
function handleWorkspaceWatchPoll(payload, ctx) {
|
|
74837
75377
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
74838
75378
|
if (denied) return denied;
|
|
74839
|
-
const p2 =
|
|
75379
|
+
const p2 = asRecord18(payload);
|
|
74840
75380
|
const watchId = String(p2.watchId ?? "");
|
|
74841
75381
|
const buf = watchBuffers.get(watchId);
|
|
74842
75382
|
if (!buf || buf.owner !== ctx.client.clientSessionId) {
|
|
@@ -74848,7 +75388,7 @@ function handleWorkspaceWatchPoll(payload, ctx) {
|
|
|
74848
75388
|
function handleWorkspaceWatchStop(payload, ctx) {
|
|
74849
75389
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
74850
75390
|
if (denied) return denied;
|
|
74851
|
-
const p2 =
|
|
75391
|
+
const p2 = asRecord18(payload);
|
|
74852
75392
|
const watchId = String(p2.watchId ?? "");
|
|
74853
75393
|
const buf = watchBuffers.get(watchId);
|
|
74854
75394
|
if (buf && buf.owner === ctx.client.clientSessionId) {
|
|
@@ -74860,7 +75400,7 @@ function handleWorkspaceWatchStop(payload, ctx) {
|
|
|
74860
75400
|
function handleWorkspaceTailWatchStart(payload, ctx) {
|
|
74861
75401
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
74862
75402
|
if (denied) return denied;
|
|
74863
|
-
const p2 =
|
|
75403
|
+
const p2 = asRecord18(payload);
|
|
74864
75404
|
try {
|
|
74865
75405
|
const offset = typeof p2.offset === "number" ? p2.offset : void 0;
|
|
74866
75406
|
const absolutePath = typeof p2.absolutePath === "string" ? p2.absolutePath : void 0;
|
|
@@ -74878,7 +75418,7 @@ function handleWorkspaceTailWatchStart(payload, ctx) {
|
|
|
74878
75418
|
function handleWorkspaceTailWatchPoll(payload, ctx) {
|
|
74879
75419
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
74880
75420
|
if (denied) return denied;
|
|
74881
|
-
const p2 =
|
|
75421
|
+
const p2 = asRecord18(payload);
|
|
74882
75422
|
try {
|
|
74883
75423
|
return {
|
|
74884
75424
|
result: ctx.workspaceTailWatch.poll(String(p2.watchId ?? ""), ctx.client.clientSessionId)
|
|
@@ -74890,7 +75430,7 @@ function handleWorkspaceTailWatchPoll(payload, ctx) {
|
|
|
74890
75430
|
function handleWorkspaceTailWatchStop(payload, ctx) {
|
|
74891
75431
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
74892
75432
|
if (denied) return denied;
|
|
74893
|
-
const p2 =
|
|
75433
|
+
const p2 = asRecord18(payload);
|
|
74894
75434
|
try {
|
|
74895
75435
|
return {
|
|
74896
75436
|
result: ctx.workspaceTailWatch.stop(String(p2.watchId ?? ""), ctx.client.clientSessionId)
|
|
@@ -74902,7 +75442,7 @@ function handleWorkspaceTailWatchStop(payload, ctx) {
|
|
|
74902
75442
|
function handleGitStatus(payload, ctx) {
|
|
74903
75443
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
74904
75444
|
if (denied) return denied;
|
|
74905
|
-
const p2 =
|
|
75445
|
+
const p2 = asRecord18(payload);
|
|
74906
75446
|
try {
|
|
74907
75447
|
const projectId = String(p2.projectId ?? "");
|
|
74908
75448
|
const cwd = typeof p2.cwd === "string" ? p2.cwd : null;
|
|
@@ -74916,7 +75456,7 @@ function handleGitStatus(payload, ctx) {
|
|
|
74916
75456
|
function handleGitDiff(payload, ctx) {
|
|
74917
75457
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
74918
75458
|
if (denied) return denied;
|
|
74919
|
-
const p2 =
|
|
75459
|
+
const p2 = asRecord18(payload);
|
|
74920
75460
|
try {
|
|
74921
75461
|
return {
|
|
74922
75462
|
result: ctx.workspaceGit.diff(String(p2.projectId ?? ""), {
|
|
@@ -74931,7 +75471,7 @@ function handleGitDiff(payload, ctx) {
|
|
|
74931
75471
|
function handleGitBranches(payload, ctx) {
|
|
74932
75472
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
74933
75473
|
if (denied) return denied;
|
|
74934
|
-
const p2 =
|
|
75474
|
+
const p2 = asRecord18(payload);
|
|
74935
75475
|
try {
|
|
74936
75476
|
return {
|
|
74937
75477
|
result: ctx.workspaceGit.branches(
|
|
@@ -74946,7 +75486,7 @@ function handleGitBranches(payload, ctx) {
|
|
|
74946
75486
|
function handleGitSwitchBranch(payload, ctx) {
|
|
74947
75487
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.writeWorkspace);
|
|
74948
75488
|
if (denied) return denied;
|
|
74949
|
-
const p2 =
|
|
75489
|
+
const p2 = asRecord18(payload);
|
|
74950
75490
|
try {
|
|
74951
75491
|
return {
|
|
74952
75492
|
result: ctx.workspaceGit.switchBranch(String(p2.projectId ?? ""), String(p2.branch ?? ""), {
|
|
@@ -74961,7 +75501,7 @@ function handleGitSwitchBranch(payload, ctx) {
|
|
|
74961
75501
|
function handleGitCreateBranch(payload, ctx) {
|
|
74962
75502
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.writeWorkspace);
|
|
74963
75503
|
if (denied) return denied;
|
|
74964
|
-
const p2 =
|
|
75504
|
+
const p2 = asRecord18(payload);
|
|
74965
75505
|
try {
|
|
74966
75506
|
return {
|
|
74967
75507
|
result: ctx.workspaceGit.switchBranch(String(p2.projectId ?? ""), String(p2.branch ?? ""), {
|
|
@@ -74976,7 +75516,7 @@ function handleGitCreateBranch(payload, ctx) {
|
|
|
74976
75516
|
function handleGitWorktrees(payload, ctx) {
|
|
74977
75517
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
74978
75518
|
if (denied) return denied;
|
|
74979
|
-
const p2 =
|
|
75519
|
+
const p2 = asRecord18(payload);
|
|
74980
75520
|
try {
|
|
74981
75521
|
return { result: ctx.workspaceGit.worktrees(String(p2.projectId ?? "")) };
|
|
74982
75522
|
} catch (err) {
|
|
@@ -74986,7 +75526,7 @@ function handleGitWorktrees(payload, ctx) {
|
|
|
74986
75526
|
function handleGitWorktreeActivate(payload, ctx) {
|
|
74987
75527
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.writeWorkspace);
|
|
74988
75528
|
if (denied) return denied;
|
|
74989
|
-
const p2 =
|
|
75529
|
+
const p2 = asRecord18(payload);
|
|
74990
75530
|
const mode = p2.mode === "attach" || p2.mode === "detach" || p2.mode === "branch" ? p2.mode : null;
|
|
74991
75531
|
if (!mode) {
|
|
74992
75532
|
return { error: { code: "invalid_argument", message: "mode must be branch|attach|detach" } };
|
|
@@ -75007,7 +75547,7 @@ function handleGitWorktreeActivate(payload, ctx) {
|
|
|
75007
75547
|
function handleGitWorktreeCheckedOutBranches(payload, ctx) {
|
|
75008
75548
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
75009
75549
|
if (denied) return denied;
|
|
75010
|
-
const p2 =
|
|
75550
|
+
const p2 = asRecord18(payload);
|
|
75011
75551
|
try {
|
|
75012
75552
|
return { result: { branches: ctx.workspaceGit.checkedOutBranches(String(p2.projectId ?? "")) } };
|
|
75013
75553
|
} catch (err) {
|
|
@@ -75017,7 +75557,7 @@ function handleGitWorktreeCheckedOutBranches(payload, ctx) {
|
|
|
75017
75557
|
function handleGitWorktreeAssignBranch(payload, ctx) {
|
|
75018
75558
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.writeWorkspace);
|
|
75019
75559
|
if (denied) return denied;
|
|
75020
|
-
const p2 =
|
|
75560
|
+
const p2 = asRecord18(payload);
|
|
75021
75561
|
try {
|
|
75022
75562
|
return {
|
|
75023
75563
|
result: ctx.workspaceGit.assignBranch(
|
|
@@ -75033,7 +75573,7 @@ function handleGitWorktreeAssignBranch(payload, ctx) {
|
|
|
75033
75573
|
function handleGitWorktreeHandoff(payload, ctx) {
|
|
75034
75574
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.writeWorkspace);
|
|
75035
75575
|
if (denied) return denied;
|
|
75036
|
-
const p2 =
|
|
75576
|
+
const p2 = asRecord18(payload);
|
|
75037
75577
|
try {
|
|
75038
75578
|
return {
|
|
75039
75579
|
result: ctx.workspaceGit.handoffToMain(
|
|
@@ -75048,7 +75588,7 @@ function handleGitWorktreeHandoff(payload, ctx) {
|
|
|
75048
75588
|
function handleGitWorktreeHandoffPreview(payload, ctx) {
|
|
75049
75589
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readWorkspace);
|
|
75050
75590
|
if (denied) return denied;
|
|
75051
|
-
const p2 =
|
|
75591
|
+
const p2 = asRecord18(payload);
|
|
75052
75592
|
try {
|
|
75053
75593
|
return {
|
|
75054
75594
|
result: ctx.workspaceGit.handoffPreview(
|
|
@@ -75063,7 +75603,7 @@ function handleGitWorktreeHandoffPreview(payload, ctx) {
|
|
|
75063
75603
|
function handleSessionSetCwd(payload, ctx) {
|
|
75064
75604
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateSession);
|
|
75065
75605
|
if (denied) return denied;
|
|
75066
|
-
const p2 =
|
|
75606
|
+
const p2 = asRecord18(payload);
|
|
75067
75607
|
const sessionId = String(p2.sessionId ?? "");
|
|
75068
75608
|
const cwdRaw = p2.cwd;
|
|
75069
75609
|
const cwd = cwdRaw === null || cwdRaw === void 0 || cwdRaw === "" ? null : String(cwdRaw);
|
|
@@ -75092,7 +75632,7 @@ function handleSessionSetCwd(payload, ctx) {
|
|
|
75092
75632
|
function handleSessionPatchSettings(payload, ctx) {
|
|
75093
75633
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateSession);
|
|
75094
75634
|
if (denied) return denied;
|
|
75095
|
-
const p2 =
|
|
75635
|
+
const p2 = asRecord18(payload);
|
|
75096
75636
|
const sessionId = String(p2.sessionId ?? "").trim();
|
|
75097
75637
|
if (!sessionId) {
|
|
75098
75638
|
return { error: { code: "invalid_argument", message: "sessionId required" } };
|
|
@@ -75108,7 +75648,7 @@ function handleSessionPatchSettings(payload, ctx) {
|
|
|
75108
75648
|
generation: String(p2.generation ?? ""),
|
|
75109
75649
|
holderClientId: ctx.client.clientSessionId
|
|
75110
75650
|
});
|
|
75111
|
-
const settingsSrc =
|
|
75651
|
+
const settingsSrc = asRecord18(p2.settings ?? p2);
|
|
75112
75652
|
const patch = {};
|
|
75113
75653
|
const take = (key) => {
|
|
75114
75654
|
if (!(key in settingsSrc)) return;
|
|
@@ -75134,7 +75674,7 @@ function handleSessionPatchSettings(payload, ctx) {
|
|
|
75134
75674
|
async function handleSessionFork(payload, ctx) {
|
|
75135
75675
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateSession);
|
|
75136
75676
|
if (denied) return denied;
|
|
75137
|
-
const p2 =
|
|
75677
|
+
const p2 = asRecord18(payload);
|
|
75138
75678
|
const sessionId = String(p2.sessionId ?? "").trim();
|
|
75139
75679
|
if (!sessionId) {
|
|
75140
75680
|
return { error: { code: "invalid_argument", message: "sessionId required" } };
|
|
@@ -75221,7 +75761,7 @@ async function handleSessionFork(payload, ctx) {
|
|
|
75221
75761
|
async function handleGitClone(payload, ctx) {
|
|
75222
75762
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.manageProject);
|
|
75223
75763
|
if (denied) return denied;
|
|
75224
|
-
const p2 =
|
|
75764
|
+
const p2 = asRecord18(payload);
|
|
75225
75765
|
try {
|
|
75226
75766
|
const cloned = await cloneRepository({
|
|
75227
75767
|
remoteUrl: String(p2.remoteUrl ?? ""),
|
|
@@ -75237,7 +75777,7 @@ async function handleGitClone(payload, ctx) {
|
|
|
75237
75777
|
function handleSessionCreate(payload, ctx) {
|
|
75238
75778
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateSession);
|
|
75239
75779
|
if (denied) return denied;
|
|
75240
|
-
const p2 =
|
|
75780
|
+
const p2 = asRecord18(payload);
|
|
75241
75781
|
const rawHarnessId = typeof p2.harnessId === "string" ? p2.harnessId : "claude";
|
|
75242
75782
|
const harnessId = normalizeSessionHarnessId(rawHarnessId);
|
|
75243
75783
|
if (!harnessId) {
|
|
@@ -75290,7 +75830,7 @@ function handleSessionCreate(payload, ctx) {
|
|
|
75290
75830
|
try {
|
|
75291
75831
|
const agentSettings = loadNodeAgentSettings(ctx.settingsConfigPath);
|
|
75292
75832
|
const defaults = resolveAgentTurnDefaults(agentSettings, harnessId);
|
|
75293
|
-
const options =
|
|
75833
|
+
const options = asRecord18(p2.options);
|
|
75294
75834
|
const providerId = typeof p2.providerId === "string" && p2.providerId.trim() ? p2.providerId.trim() : void 0;
|
|
75295
75835
|
const profile = providerId ? ctx.sessionProviders.get(providerId) : null;
|
|
75296
75836
|
const profileSettings = profile ? settingsFromSessionProviderConfig(profile.config) : {};
|
|
@@ -75351,13 +75891,13 @@ function handleSessionCreate(payload, ctx) {
|
|
|
75351
75891
|
function handleSessionGet(payload, ctx) {
|
|
75352
75892
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readSession);
|
|
75353
75893
|
if (denied) return denied;
|
|
75354
|
-
const p2 =
|
|
75894
|
+
const p2 = asRecord18(payload);
|
|
75355
75895
|
return { result: ctx.sessions.get(String(p2.sessionId ?? "")) };
|
|
75356
75896
|
}
|
|
75357
75897
|
function handleSessionList(payload, ctx) {
|
|
75358
75898
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readSession);
|
|
75359
75899
|
if (denied) return denied;
|
|
75360
|
-
const p2 =
|
|
75900
|
+
const p2 = asRecord18(payload);
|
|
75361
75901
|
const projectId = typeof p2.projectId === "string" ? p2.projectId : void 0;
|
|
75362
75902
|
if (typeof p2.limit !== "number" || !Number.isFinite(p2.limit)) {
|
|
75363
75903
|
return { error: { code: "invalid_argument", message: "session.list requires finite limit" } };
|
|
@@ -75397,7 +75937,7 @@ function handleSessionList(payload, ctx) {
|
|
|
75397
75937
|
function handleSessionAcquireControl(payload, ctx) {
|
|
75398
75938
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateSession);
|
|
75399
75939
|
if (denied) return denied;
|
|
75400
|
-
const p2 =
|
|
75940
|
+
const p2 = asRecord18(payload);
|
|
75401
75941
|
const sessionId = String(p2.sessionId ?? "");
|
|
75402
75942
|
if (!sessionId) {
|
|
75403
75943
|
return { error: { code: "invalid_argument", message: "sessionId required" } };
|
|
@@ -75421,7 +75961,7 @@ function handleSessionAcquireControl(payload, ctx) {
|
|
|
75421
75961
|
function handleSessionRenewControl(payload, ctx) {
|
|
75422
75962
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateSession);
|
|
75423
75963
|
if (denied) return denied;
|
|
75424
|
-
const p2 =
|
|
75964
|
+
const p2 = asRecord18(payload);
|
|
75425
75965
|
try {
|
|
75426
75966
|
return {
|
|
75427
75967
|
result: ctx.leases.renew({
|
|
@@ -75438,7 +75978,7 @@ function handleSessionRenewControl(payload, ctx) {
|
|
|
75438
75978
|
function handleSessionReleaseControl(payload, ctx) {
|
|
75439
75979
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateSession);
|
|
75440
75980
|
if (denied) return denied;
|
|
75441
|
-
const p2 =
|
|
75981
|
+
const p2 = asRecord18(payload);
|
|
75442
75982
|
try {
|
|
75443
75983
|
ctx.leases.release(
|
|
75444
75984
|
String(p2.leaseId ?? ""),
|
|
@@ -75453,7 +75993,7 @@ function handleSessionReleaseControl(payload, ctx) {
|
|
|
75453
75993
|
function handleSessionClose(payload, ctx) {
|
|
75454
75994
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateSession);
|
|
75455
75995
|
if (denied) return denied;
|
|
75456
|
-
const p2 =
|
|
75996
|
+
const p2 = asRecord18(payload);
|
|
75457
75997
|
const sessionId = String(p2.sessionId ?? "");
|
|
75458
75998
|
try {
|
|
75459
75999
|
ctx.leases.assertValid({
|
|
@@ -75479,7 +76019,7 @@ function handleSessionClose(payload, ctx) {
|
|
|
75479
76019
|
function handleSessionRemove(payload, ctx) {
|
|
75480
76020
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateSession);
|
|
75481
76021
|
if (denied) return denied;
|
|
75482
|
-
const p2 =
|
|
76022
|
+
const p2 = asRecord18(payload);
|
|
75483
76023
|
const sessionId = String(p2.sessionId ?? "");
|
|
75484
76024
|
if (!sessionId) {
|
|
75485
76025
|
return { error: { code: "invalid_argument", message: "sessionId required" } };
|
|
@@ -75506,7 +76046,7 @@ function handleSessionRemove(payload, ctx) {
|
|
|
75506
76046
|
function handleSessionRename(payload, ctx) {
|
|
75507
76047
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateSession);
|
|
75508
76048
|
if (denied) return denied;
|
|
75509
|
-
const p2 =
|
|
76049
|
+
const p2 = asRecord18(payload);
|
|
75510
76050
|
const sessionId = String(p2.sessionId ?? "");
|
|
75511
76051
|
const title = String(p2.title ?? "");
|
|
75512
76052
|
const source = p2.source === "agent" ? "agent" : "user";
|
|
@@ -75522,7 +76062,7 @@ function handleSessionRename(payload, ctx) {
|
|
|
75522
76062
|
function handleSessionSetTags(payload, ctx) {
|
|
75523
76063
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateSession);
|
|
75524
76064
|
if (denied) return denied;
|
|
75525
|
-
const p2 =
|
|
76065
|
+
const p2 = asRecord18(payload);
|
|
75526
76066
|
const sessionId = String(p2.sessionId ?? "");
|
|
75527
76067
|
if (!sessionId) {
|
|
75528
76068
|
return { error: { code: "invalid_argument", message: "sessionId required" } };
|
|
@@ -75548,7 +76088,7 @@ function handleSessionSetTags(payload, ctx) {
|
|
|
75548
76088
|
function handleSessionSetUiFlags(payload, ctx) {
|
|
75549
76089
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateSession);
|
|
75550
76090
|
if (denied) return denied;
|
|
75551
|
-
const p2 =
|
|
76091
|
+
const p2 = asRecord18(payload);
|
|
75552
76092
|
const sessionId = String(p2.sessionId ?? "");
|
|
75553
76093
|
if (!sessionId) {
|
|
75554
76094
|
return { error: { code: "invalid_argument", message: "sessionId required" } };
|
|
@@ -75567,9 +76107,9 @@ function handleSessionSetUiFlags(payload, ctx) {
|
|
|
75567
76107
|
async function handleSessionSend(payload, ctx) {
|
|
75568
76108
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateSession);
|
|
75569
76109
|
if (denied) return denied;
|
|
75570
|
-
const p2 =
|
|
76110
|
+
const p2 = asRecord18(payload);
|
|
75571
76111
|
try {
|
|
75572
|
-
const options =
|
|
76112
|
+
const options = asRecord18(p2.options);
|
|
75573
76113
|
const modelFromOptions = typeof options.model === "string" && options.model.trim() ? options.model.trim() : null;
|
|
75574
76114
|
const modelTopLevel = typeof p2.model === "string" && p2.model.trim() ? p2.model.trim() : null;
|
|
75575
76115
|
const apiProviderId = typeof options.apiProviderId === "string" && options.apiProviderId.trim() ? options.apiProviderId.trim() : typeof p2.apiProviderId === "string" && p2.apiProviderId.trim() ? p2.apiProviderId.trim() : null;
|
|
@@ -75662,7 +76202,7 @@ async function handleSessionSend(payload, ctx) {
|
|
|
75662
76202
|
function handleSessionInterrupt(payload, ctx) {
|
|
75663
76203
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateSession);
|
|
75664
76204
|
if (denied) return denied;
|
|
75665
|
-
const p2 =
|
|
76205
|
+
const p2 = asRecord18(payload);
|
|
75666
76206
|
try {
|
|
75667
76207
|
ctx.sessions.interrupt(
|
|
75668
76208
|
String(p2.sessionId ?? ""),
|
|
@@ -75678,7 +76218,7 @@ function handleSessionInterrupt(payload, ctx) {
|
|
|
75678
76218
|
function handleSessionRespondPermission(payload, ctx) {
|
|
75679
76219
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateSession);
|
|
75680
76220
|
if (denied) return denied;
|
|
75681
|
-
const p2 =
|
|
76221
|
+
const p2 = asRecord18(payload);
|
|
75682
76222
|
try {
|
|
75683
76223
|
const formAnswers = p2.formAnswers && typeof p2.formAnswers === "object" && !Array.isArray(p2.formAnswers) ? p2.formAnswers : p2.options && typeof p2.options === "object" && !Array.isArray(p2.options) ? p2.options.formAnswers ?? p2.options : void 0;
|
|
75684
76224
|
ctx.sessions.respondPermission({
|
|
@@ -75699,7 +76239,7 @@ function handleSessionRespondPermission(payload, ctx) {
|
|
|
75699
76239
|
function handleSessionRespondQuestion(payload, ctx) {
|
|
75700
76240
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateSession);
|
|
75701
76241
|
if (denied) return denied;
|
|
75702
|
-
const p2 =
|
|
76242
|
+
const p2 = asRecord18(payload);
|
|
75703
76243
|
try {
|
|
75704
76244
|
ctx.sessions.respondQuestion({
|
|
75705
76245
|
sessionId: String(p2.sessionId ?? ""),
|
|
@@ -75717,7 +76257,7 @@ function handleSessionRespondQuestion(payload, ctx) {
|
|
|
75717
76257
|
function handleSessionRespondPlan(payload, ctx) {
|
|
75718
76258
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateSession);
|
|
75719
76259
|
if (denied) return denied;
|
|
75720
|
-
const p2 =
|
|
76260
|
+
const p2 = asRecord18(payload);
|
|
75721
76261
|
const decision = p2.decision === "approve" || p2.decision === "reject" ? p2.decision : null;
|
|
75722
76262
|
if (!decision) {
|
|
75723
76263
|
return { error: { code: "invalid_argument", message: "decision must be approve|reject" } };
|
|
@@ -75740,7 +76280,7 @@ function handleSessionRespondPlan(payload, ctx) {
|
|
|
75740
76280
|
async function handleSessionHostActionsPoll(payload, ctx) {
|
|
75741
76281
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateSession);
|
|
75742
76282
|
if (denied) return denied;
|
|
75743
|
-
const p2 =
|
|
76283
|
+
const p2 = asRecord18(payload);
|
|
75744
76284
|
try {
|
|
75745
76285
|
const result = await ctx.sessions.pollHostActions({
|
|
75746
76286
|
controllerClientSessionId: ctx.client.clientSessionId,
|
|
@@ -75756,7 +76296,7 @@ async function handleSessionHostActionsPoll(payload, ctx) {
|
|
|
75756
76296
|
function handleSessionClaimHostAction(payload, ctx) {
|
|
75757
76297
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateSession);
|
|
75758
76298
|
if (denied) return denied;
|
|
75759
|
-
const p2 =
|
|
76299
|
+
const p2 = asRecord18(payload);
|
|
75760
76300
|
try {
|
|
75761
76301
|
const result = ctx.sessions.claimHostAction({
|
|
75762
76302
|
actionId: String(p2.actionId ?? ""),
|
|
@@ -75772,7 +76312,7 @@ function handleSessionClaimHostAction(payload, ctx) {
|
|
|
75772
76312
|
function handleSessionRespondHostAction(payload, ctx) {
|
|
75773
76313
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateSession);
|
|
75774
76314
|
if (denied) return denied;
|
|
75775
|
-
const p2 =
|
|
76315
|
+
const p2 = asRecord18(payload);
|
|
75776
76316
|
const outcome = p2.outcome === "failed" ? "failed" : p2.outcome === "succeeded" ? "succeeded" : null;
|
|
75777
76317
|
if (!outcome) {
|
|
75778
76318
|
return { error: { code: "invalid_argument", message: "outcome must be succeeded|failed" } };
|
|
@@ -75794,14 +76334,14 @@ function handleSessionRespondHostAction(payload, ctx) {
|
|
|
75794
76334
|
function handleSessionEvents(payload, ctx) {
|
|
75795
76335
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readSession);
|
|
75796
76336
|
if (denied) return denied;
|
|
75797
|
-
const p2 =
|
|
76337
|
+
const p2 = asRecord18(payload);
|
|
75798
76338
|
const after = String(p2.afterSequence ?? "0");
|
|
75799
76339
|
return { result: { events: ctx.sessions.listEventsAfter(after) } };
|
|
75800
76340
|
}
|
|
75801
76341
|
function handleSessionMessagesList(payload, ctx) {
|
|
75802
76342
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readSession);
|
|
75803
76343
|
if (denied) return denied;
|
|
75804
|
-
const p2 =
|
|
76344
|
+
const p2 = asRecord18(payload);
|
|
75805
76345
|
const sessionId = String(p2.sessionId ?? "").trim();
|
|
75806
76346
|
if (!sessionId) {
|
|
75807
76347
|
return { error: { code: "invalid_argument", message: "sessionId required" } };
|
|
@@ -75840,7 +76380,7 @@ function handleCollaborationListProfiles(ctx) {
|
|
|
75840
76380
|
async function handleCollaborationRequest(payload, ctx) {
|
|
75841
76381
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateSession);
|
|
75842
76382
|
if (denied) return denied;
|
|
75843
|
-
const p2 =
|
|
76383
|
+
const p2 = asRecord18(payload);
|
|
75844
76384
|
const parentSessionId = String(p2.parentSessionId ?? "");
|
|
75845
76385
|
if (!parentSessionId) {
|
|
75846
76386
|
return { error: { code: "invalid_argument", message: "parentSessionId required" } };
|
|
@@ -75874,7 +76414,7 @@ async function handleCollaborationRequest(payload, ctx) {
|
|
|
75874
76414
|
async function handleCollaborationStart(payload, ctx) {
|
|
75875
76415
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateSession);
|
|
75876
76416
|
if (denied) return denied;
|
|
75877
|
-
const p2 =
|
|
76417
|
+
const p2 = asRecord18(payload);
|
|
75878
76418
|
const credential = typeof p2.credential === "string" ? p2.credential : void 0;
|
|
75879
76419
|
const grantId = typeof p2.grantId === "string" ? p2.grantId : void 0;
|
|
75880
76420
|
if (!credential && !grantId) {
|
|
@@ -75920,7 +76460,7 @@ async function handleCollaborationStart(payload, ctx) {
|
|
|
75920
76460
|
function handleCollaborationSend(payload, ctx) {
|
|
75921
76461
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.operateSession);
|
|
75922
76462
|
if (denied) return denied;
|
|
75923
|
-
const p2 =
|
|
76463
|
+
const p2 = asRecord18(payload);
|
|
75924
76464
|
const credential = String(p2.credential ?? "");
|
|
75925
76465
|
const sessionId = String(p2.sessionId ?? p2.fromSessionId ?? "");
|
|
75926
76466
|
const content = typeof p2.content === "string" ? p2.content : p2.body !== void 0 ? typeof p2.body === "string" ? p2.body : JSON.stringify(p2.body) : "";
|
|
@@ -75956,7 +76496,7 @@ function handleCollaborationSend(payload, ctx) {
|
|
|
75956
76496
|
function handleCollaborationRetrieve(payload, ctx) {
|
|
75957
76497
|
const denied = requireScopes7(ctx.client, OPERATION_SCOPES.readSession);
|
|
75958
76498
|
if (denied) return denied;
|
|
75959
|
-
const p2 =
|
|
76499
|
+
const p2 = asRecord18(payload);
|
|
75960
76500
|
const credential = String(p2.credential ?? "");
|
|
75961
76501
|
const sessionId = String(p2.sessionId ?? "");
|
|
75962
76502
|
if (!credential) {
|
|
@@ -76802,7 +77342,7 @@ function requiredRuntimeVersion(harnessId, manifest) {
|
|
|
76802
77342
|
import { existsSync as existsSync29, mkdirSync as mkdirSync18, readFileSync as readFileSync17, readdirSync as readdirSync10, statSync as statSync9, writeFileSync as writeFileSync13 } from "node:fs";
|
|
76803
77343
|
import { arch as osArch2, platform as osPlatform2 } from "node:os";
|
|
76804
77344
|
import { join as join27, resolve as resolve7 } from "node:path";
|
|
76805
|
-
var OFFICIAL_CLAUDE_SDK_VERSION = "0.3.
|
|
77345
|
+
var OFFICIAL_CLAUDE_SDK_VERSION = "0.3.238";
|
|
76806
77346
|
var OFFICIAL_CODEX_NPM_VERSION = "0.147.0";
|
|
76807
77347
|
var OFFICIAL_CODEX_PACKAGE = "@openai/codex";
|
|
76808
77348
|
function codexPlatformPackageVersion(baseVersion = OFFICIAL_CODEX_NPM_VERSION) {
|
|
@@ -94751,6 +95291,7 @@ async function startNodeRuntime(partial2 = {}) {
|
|
|
94751
95291
|
allowSimulatedFallback: allowSimulatedTurnFallback,
|
|
94752
95292
|
providers,
|
|
94753
95293
|
experimentalClaudeOpenAiChatEnabled: () => loadNodeAgentSettings(paths.configJson).experimentalClaudeOpenAiChatEnabled,
|
|
95294
|
+
askUserQuestionPreviewFormat: () => loadNodeAgentSettings(paths.configJson).claude.askUserQuestionPreviewFormat,
|
|
94754
95295
|
// Claude: in-process SDK MCP (same core tools as HTTP).
|
|
94755
95296
|
createHostActionClaudeMcp: (sessionId) => hostActionMcp.createClaudeSdkMcp(sessionId),
|
|
94756
95297
|
// Codex / ACP / OpenCode: loopback HTTP with per-session HMAC.
|