@super-one/cli 0.50.8-alpha → 0.51.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 +176 -82
- package/package.json +1 -1
package/MANIFEST.json
CHANGED
package/lib/cli.mjs
CHANGED
|
@@ -14282,6 +14282,12 @@ function familyBaseUrl(family, baseUrl) {
|
|
|
14282
14282
|
if (family === "openai" || family === "newapi") return `${trimmed}/v1`;
|
|
14283
14283
|
return trimmed;
|
|
14284
14284
|
}
|
|
14285
|
+
function harnessChatProtocols(harness, options) {
|
|
14286
|
+
if (harness === "claude" && options?.experimentalClaudeOpenAiChatEnabled) {
|
|
14287
|
+
return [...HARNESS_CHAT_PROTOCOLS.claude, "openai-chat"];
|
|
14288
|
+
}
|
|
14289
|
+
return HARNESS_CHAT_PROTOCOLS[harness];
|
|
14290
|
+
}
|
|
14285
14291
|
var PROTOCOL_TASKS, PROTOCOL_FAMILIES, PROTOCOL_FAMILY, FAMILY_PROTOCOLS, PROTOCOL_ORDER, CAPABILITY_ORDER, FAMILY_TASK_PROTOCOL, FAMILY_TASKS, HARNESS_CHAT_PROTOCOLS, PROXY_TRANSFORMERS_ENV;
|
|
14286
14292
|
var init_protocols = __esm({
|
|
14287
14293
|
"../../packages/shared/src/platform-registry/protocols.ts"() {
|
|
@@ -14354,7 +14360,7 @@ var init_protocols = __esm({
|
|
|
14354
14360
|
google: CAPABILITY_ORDER.filter((task) => FAMILY_TASK_PROTOCOL.google[task])
|
|
14355
14361
|
};
|
|
14356
14362
|
HARNESS_CHAT_PROTOCOLS = {
|
|
14357
|
-
claude: ["anthropic-messages"
|
|
14363
|
+
claude: ["anthropic-messages"],
|
|
14358
14364
|
codex: ["openai-responses", "openai-chat"]
|
|
14359
14365
|
};
|
|
14360
14366
|
PROXY_TRANSFORMERS_ENV = "SUPERONE_PROXY_TRANSFORMERS";
|
|
@@ -14463,11 +14469,31 @@ var init_model_tasks = __esm({
|
|
|
14463
14469
|
});
|
|
14464
14470
|
|
|
14465
14471
|
// ../../packages/shared/src/platform-registry/relay-discovery.ts
|
|
14472
|
+
var CANONICAL_CATALOG_PROVIDERS, FIRST_PARTY_CATALOG_PROVIDERS;
|
|
14466
14473
|
var init_relay_discovery = __esm({
|
|
14467
14474
|
"../../packages/shared/src/platform-registry/relay-discovery.ts"() {
|
|
14468
14475
|
"use strict";
|
|
14469
14476
|
init_model_tasks();
|
|
14470
14477
|
init_protocols();
|
|
14478
|
+
CANONICAL_CATALOG_PROVIDERS = ["openai", "anthropic", "google"];
|
|
14479
|
+
FIRST_PARTY_CATALOG_PROVIDERS = /* @__PURE__ */ new Set([
|
|
14480
|
+
...CANONICAL_CATALOG_PROVIDERS,
|
|
14481
|
+
"xai",
|
|
14482
|
+
"deepseek",
|
|
14483
|
+
"mistral",
|
|
14484
|
+
"cohere",
|
|
14485
|
+
"meta",
|
|
14486
|
+
"moonshotai",
|
|
14487
|
+
"moonshotai-cn",
|
|
14488
|
+
"zhipuai",
|
|
14489
|
+
"zhipuai-coding-plan",
|
|
14490
|
+
"alibaba",
|
|
14491
|
+
"alibaba-cn",
|
|
14492
|
+
"minimax",
|
|
14493
|
+
"minimax-cn",
|
|
14494
|
+
"bytedance",
|
|
14495
|
+
"perplexity"
|
|
14496
|
+
]);
|
|
14471
14497
|
}
|
|
14472
14498
|
});
|
|
14473
14499
|
|
|
@@ -15431,16 +15457,16 @@ function findPlatform(platforms, platformId) {
|
|
|
15431
15457
|
function findPlan(platform2, planId) {
|
|
15432
15458
|
return platform2?.plans.find((p2) => p2.id === planId);
|
|
15433
15459
|
}
|
|
15434
|
-
function selectProtocol(endpoint, task, harness) {
|
|
15460
|
+
function selectProtocol(endpoint, task, harness, options) {
|
|
15435
15461
|
const serving = endpoint.protocols.filter((p2) => protocolServes(p2, task));
|
|
15436
|
-
if (harness) return
|
|
15462
|
+
if (harness) return harnessChatProtocols(harness, options).find((p2) => serving.includes(p2));
|
|
15437
15463
|
return [...serving].sort((a, b2) => PROTOCOL_ORDER.indexOf(a) - PROTOCOL_ORDER.indexOf(b2))[0];
|
|
15438
15464
|
}
|
|
15439
|
-
function selectEndpoint(plan, consumer, endpointId, credential, endpoints = plan.endpoints) {
|
|
15465
|
+
function selectEndpoint(plan, consumer, endpointId, credential, endpoints = plan.endpoints, options) {
|
|
15440
15466
|
const task = CONSUMER_TASK[consumer];
|
|
15441
15467
|
const harness = consumer === "chat:claude" ? "claude" : consumer === "chat:codex" ? "codex" : void 0;
|
|
15442
15468
|
const pick3 = (e) => {
|
|
15443
|
-
const protocol = selectProtocol(e, task, harness);
|
|
15469
|
+
const protocol = selectProtocol(e, task, harness, options);
|
|
15444
15470
|
if (!protocol) return void 0;
|
|
15445
15471
|
if (harness) return protocol;
|
|
15446
15472
|
if (!credential) return protocol;
|
|
@@ -15462,7 +15488,7 @@ function selectEndpoint(plan, consumer, endpointId, credential, endpoints = plan
|
|
|
15462
15488
|
}
|
|
15463
15489
|
}
|
|
15464
15490
|
if (harness) {
|
|
15465
|
-
for (const proto of
|
|
15491
|
+
for (const proto of harnessChatProtocols(harness, options)) {
|
|
15466
15492
|
const endpoint = endpoints.find((e) => e.protocols.includes(proto) && protocolServes(proto, task));
|
|
15467
15493
|
if (endpoint) return { endpoint, protocol: proto };
|
|
15468
15494
|
}
|
|
@@ -18259,7 +18285,7 @@ function platformsForNode(store) {
|
|
|
18259
18285
|
for (const p2 of custom2) byId2.set(p2.id, p2);
|
|
18260
18286
|
return [...byId2.values()];
|
|
18261
18287
|
}
|
|
18262
|
-
function resolveServiceFromCredential(consumer, cred, platforms, binding) {
|
|
18288
|
+
function resolveServiceFromCredential(consumer, cred, platforms, binding, options) {
|
|
18263
18289
|
const platform2 = findPlatform(platforms, cred.platformId);
|
|
18264
18290
|
const plan = findPlan(platform2, cred.planId);
|
|
18265
18291
|
if (!platform2 || !plan) return null;
|
|
@@ -18269,7 +18295,8 @@ function resolveServiceFromCredential(consumer, cred, platforms, binding) {
|
|
|
18269
18295
|
consumer,
|
|
18270
18296
|
binding?.endpointId,
|
|
18271
18297
|
cred,
|
|
18272
|
-
endpoints
|
|
18298
|
+
endpoints,
|
|
18299
|
+
options
|
|
18273
18300
|
);
|
|
18274
18301
|
if (!selected) return null;
|
|
18275
18302
|
const { endpoint, protocol } = selected;
|
|
@@ -18302,7 +18329,7 @@ function consumerForHarness(harness) {
|
|
|
18302
18329
|
if (harness === "codex") return "chat:codex";
|
|
18303
18330
|
return null;
|
|
18304
18331
|
}
|
|
18305
|
-
function listHarnessApiProviders(store, harness) {
|
|
18332
|
+
function listHarnessApiProviders(store, harness, options) {
|
|
18306
18333
|
const consumer = consumerForHarness(harness);
|
|
18307
18334
|
if (!consumer) return [];
|
|
18308
18335
|
const platforms = platformsForNode(store);
|
|
@@ -18312,7 +18339,7 @@ function listHarnessApiProviders(store, harness) {
|
|
|
18312
18339
|
const plan = findPlan(platform2, cred.planId);
|
|
18313
18340
|
if (!platform2 || !plan) continue;
|
|
18314
18341
|
const endpoints = effectiveEndpoints(platform2, plan, cred);
|
|
18315
|
-
if (!selectEndpoint(plan, consumer, void 0, cred, endpoints)) continue;
|
|
18342
|
+
if (!selectEndpoint(plan, consumer, void 0, cred, endpoints, options)) continue;
|
|
18316
18343
|
out.push({
|
|
18317
18344
|
id: cred.id,
|
|
18318
18345
|
name: platform2.name ?? cred.name,
|
|
@@ -18361,7 +18388,7 @@ async function buildHarnessEnvWithProxy(harness, resolved) {
|
|
|
18361
18388
|
}
|
|
18362
18389
|
return env;
|
|
18363
18390
|
}
|
|
18364
|
-
function resolveHarnessService(store, harness, apiProviderId) {
|
|
18391
|
+
function resolveHarnessService(store, harness, apiProviderId, options) {
|
|
18365
18392
|
const consumer = consumerForHarness(harness);
|
|
18366
18393
|
if (!consumer) return null;
|
|
18367
18394
|
const platforms = platformsForNode(store);
|
|
@@ -18375,11 +18402,12 @@ function resolveHarnessService(store, harness, apiProviderId) {
|
|
|
18375
18402
|
consumer,
|
|
18376
18403
|
cred,
|
|
18377
18404
|
platforms,
|
|
18378
|
-
binding && binding.credentialId === cred.id ? { endpointId: binding.endpointId, config: binding.config } : null
|
|
18405
|
+
binding && binding.credentialId === cred.id ? { endpointId: binding.endpointId, config: binding.config } : null,
|
|
18406
|
+
options
|
|
18379
18407
|
);
|
|
18380
18408
|
}
|
|
18381
|
-
function listHarnessProviderModels(store, harness, apiProviderId) {
|
|
18382
|
-
const resolved = resolveHarnessService(store, harness, apiProviderId);
|
|
18409
|
+
function listHarnessProviderModels(store, harness, apiProviderId, options) {
|
|
18410
|
+
const resolved = resolveHarnessService(store, harness, apiProviderId, options);
|
|
18383
18411
|
if (resolved) {
|
|
18384
18412
|
const mapped = /* @__PURE__ */ new Map();
|
|
18385
18413
|
for (const m2 of resolved.models ?? []) {
|
|
@@ -18410,8 +18438,8 @@ function listHarnessProviderModels(store, harness, apiProviderId) {
|
|
|
18410
18438
|
}
|
|
18411
18439
|
return [];
|
|
18412
18440
|
}
|
|
18413
|
-
function listHarnessModels(store, harness, apiProviderId) {
|
|
18414
|
-
const fromProvider = listHarnessProviderModels(store, harness, apiProviderId);
|
|
18441
|
+
function listHarnessModels(store, harness, apiProviderId, options) {
|
|
18442
|
+
const fromProvider = listHarnessProviderModels(store, harness, apiProviderId, options);
|
|
18415
18443
|
if (fromProvider.length > 0) return fromProvider;
|
|
18416
18444
|
if (harness === "claude") return DEFAULT_CLAUDE_MODELS;
|
|
18417
18445
|
if (harness === "codex") return DEFAULT_CODEX_MODELS;
|
|
@@ -21337,7 +21365,9 @@ function createNodeClaudeTurnRunner(opts) {
|
|
|
21337
21365
|
const cwd = input.session.cwd && input.session.cwd.trim() ? input.session.cwd.trim() : projectRoot2;
|
|
21338
21366
|
const providerEnv = opts.providers ? await buildHarnessEnvWithProxy(
|
|
21339
21367
|
"claude",
|
|
21340
|
-
resolveHarnessService(opts.providers, "claude", input.apiProviderId
|
|
21368
|
+
resolveHarnessService(opts.providers, "claude", input.apiProviderId, {
|
|
21369
|
+
experimentalClaudeOpenAiChatEnabled: opts.experimentalClaudeOpenAiChatEnabled?.() ?? false
|
|
21370
|
+
})
|
|
21341
21371
|
) : {};
|
|
21342
21372
|
const authEnv = {
|
|
21343
21373
|
...process.env,
|
|
@@ -41094,9 +41124,14 @@ function createXaiCorrelationState(opts) {
|
|
|
41094
41124
|
goalStarted: /* @__PURE__ */ new Set(),
|
|
41095
41125
|
lastEventSeq: null,
|
|
41096
41126
|
lastUsage: null,
|
|
41097
|
-
lastMessageId: null
|
|
41127
|
+
lastMessageId: null,
|
|
41128
|
+
turnTokens: { input: 0, output: 0, cacheRead: 0 },
|
|
41129
|
+
rateLimited: false
|
|
41098
41130
|
};
|
|
41099
41131
|
}
|
|
41132
|
+
function resetTurnTokens(state) {
|
|
41133
|
+
state.turnTokens = { input: 0, output: 0, cacheRead: 0 };
|
|
41134
|
+
}
|
|
41100
41135
|
function resolveGrokChildChatHistoryPath(cwd, childSessionId) {
|
|
41101
41136
|
if (!cwd || !childSessionId) return void 0;
|
|
41102
41137
|
return join16(homedir4(), ".grok", "sessions", encodeURIComponent(cwd), childSessionId, "chat_history.jsonl");
|
|
@@ -41352,6 +41387,10 @@ function mapXaiSessionUpdate(update, state, ctx = {}) {
|
|
|
41352
41387
|
return mapScheduledTaskDeleted(update, state);
|
|
41353
41388
|
case "turn_completed":
|
|
41354
41389
|
return mapTurnCompleted(update, state, ctx);
|
|
41390
|
+
case "response_started":
|
|
41391
|
+
return mapResponseStarted(update, state, ctx);
|
|
41392
|
+
case "response_completed":
|
|
41393
|
+
return mapResponseCompleted(update, state, ctx);
|
|
41355
41394
|
case "auto_compact_started":
|
|
41356
41395
|
return mapAutoCompactStarted(update);
|
|
41357
41396
|
case "auto_compact_completed":
|
|
@@ -41892,9 +41931,55 @@ function noteContextWindow(state, maxTokens) {
|
|
|
41892
41931
|
function uncachedPromptInputTokens(fullInput, cachedRead) {
|
|
41893
41932
|
return Math.max(0, fullInput - cachedRead);
|
|
41894
41933
|
}
|
|
41934
|
+
function messageUsageFromTurnTokens(state, ctx, tokens) {
|
|
41935
|
+
const messageId = ctx.messageId ?? state.lastMessageId;
|
|
41936
|
+
if (!messageId) return null;
|
|
41937
|
+
if (tokens.input <= 0 && tokens.output <= 0 && tokens.cacheRead <= 0) return null;
|
|
41938
|
+
const prev = state.lastUsage;
|
|
41939
|
+
const contextTokens = prev?.totalTokens && prev.totalTokens > 0 ? prev.totalTokens : 0;
|
|
41940
|
+
const maxTokens = prev?.maxTokens && prev.maxTokens > 0 ? prev.maxTokens : 0;
|
|
41941
|
+
return {
|
|
41942
|
+
type: "message_usage",
|
|
41943
|
+
messageId,
|
|
41944
|
+
inputTokens: tokens.input,
|
|
41945
|
+
outputTokens: tokens.output,
|
|
41946
|
+
...tokens.cacheRead > 0 ? { cacheReadTokens: tokens.cacheRead } : {},
|
|
41947
|
+
...contextTokens > 0 ? { contextTokens } : {},
|
|
41948
|
+
...maxTokens > 0 ? { contextWindow: maxTokens } : {}
|
|
41949
|
+
};
|
|
41950
|
+
}
|
|
41951
|
+
function mapResponseStarted(u, state, ctx) {
|
|
41952
|
+
const input = numField(u, "inputTokens", "input_tokens") ?? 0;
|
|
41953
|
+
const cacheRead = numField(u, "cacheReadInputTokens", "cache_read_input_tokens") ?? 0;
|
|
41954
|
+
const provisional = {
|
|
41955
|
+
input: state.turnTokens.input + input,
|
|
41956
|
+
output: state.turnTokens.output,
|
|
41957
|
+
cacheRead: state.turnTokens.cacheRead + cacheRead
|
|
41958
|
+
};
|
|
41959
|
+
const event = messageUsageFromTurnTokens(state, ctx, provisional);
|
|
41960
|
+
return event ? [event] : [];
|
|
41961
|
+
}
|
|
41962
|
+
function mapResponseCompleted(u, state, ctx) {
|
|
41963
|
+
const usageRaw = asRecord7(u.usage) ?? u;
|
|
41964
|
+
const input = numField(usageRaw, "inputTokens", "input_tokens") ?? 0;
|
|
41965
|
+
const output = numField(usageRaw, "outputTokens", "output_tokens") ?? 0;
|
|
41966
|
+
const cacheRead = numField(usageRaw, "cacheReadInputTokens", "cache_read_input_tokens") ?? 0;
|
|
41967
|
+
if (input <= 0 && output <= 0 && cacheRead <= 0) return [];
|
|
41968
|
+
state.turnTokens = {
|
|
41969
|
+
input: state.turnTokens.input + input,
|
|
41970
|
+
output: state.turnTokens.output + output,
|
|
41971
|
+
cacheRead: state.turnTokens.cacheRead + cacheRead
|
|
41972
|
+
};
|
|
41973
|
+
const event = messageUsageFromTurnTokens(state, ctx, state.turnTokens);
|
|
41974
|
+
return event ? [event] : [];
|
|
41975
|
+
}
|
|
41895
41976
|
function mapTurnCompleted(u, state, ctx) {
|
|
41977
|
+
const events = mapTurnStopReason(u, state);
|
|
41896
41978
|
const usageRaw = asRecord7(u.usage);
|
|
41897
|
-
if (!usageRaw)
|
|
41979
|
+
if (!usageRaw) {
|
|
41980
|
+
resetTurnTokens(state);
|
|
41981
|
+
return events;
|
|
41982
|
+
}
|
|
41898
41983
|
const fullInput = numField(usageRaw, "inputTokens", "input_tokens") ?? 0;
|
|
41899
41984
|
const cachedRead = numField(usageRaw, "cachedReadTokens", "cached_read_tokens") ?? 0;
|
|
41900
41985
|
const uncachedInput = uncachedPromptInputTokens(fullInput, cachedRead);
|
|
@@ -41917,18 +42002,39 @@ function mapTurnCompleted(u, state, ctx) {
|
|
|
41917
42002
|
model: prev?.model ?? ""
|
|
41918
42003
|
};
|
|
41919
42004
|
}
|
|
42005
|
+
state.turnTokens = {
|
|
42006
|
+
input: uncachedInput,
|
|
42007
|
+
output: outputTokens,
|
|
42008
|
+
cacheRead: cachedRead
|
|
42009
|
+
};
|
|
41920
42010
|
const messageId = ctx.messageId ?? state.lastMessageId;
|
|
41921
|
-
if (
|
|
41922
|
-
|
|
41923
|
-
|
|
41924
|
-
|
|
41925
|
-
|
|
41926
|
-
|
|
41927
|
-
|
|
41928
|
-
|
|
41929
|
-
|
|
41930
|
-
|
|
41931
|
-
|
|
42011
|
+
if (messageId) {
|
|
42012
|
+
events.push({
|
|
42013
|
+
type: "message_usage",
|
|
42014
|
+
messageId,
|
|
42015
|
+
// Footer: this-turn new spend (exclude cache hits).
|
|
42016
|
+
inputTokens: uncachedInput,
|
|
42017
|
+
outputTokens,
|
|
42018
|
+
...cachedRead > 0 ? { cacheReadTokens: cachedRead } : {},
|
|
42019
|
+
...contextTokens > 0 ? { contextTokens } : {},
|
|
42020
|
+
...maxTokens > 0 ? { contextWindow: maxTokens } : {},
|
|
42021
|
+
...costUsd != null ? { costUsd } : {}
|
|
42022
|
+
});
|
|
42023
|
+
}
|
|
42024
|
+
resetTurnTokens(state);
|
|
42025
|
+
return events;
|
|
42026
|
+
}
|
|
42027
|
+
function mapTurnStopReason(u, state) {
|
|
42028
|
+
const stopReason = strField(u, "stopReason", "stop_reason");
|
|
42029
|
+
if (stopReason === "rate_limit") {
|
|
42030
|
+
state.rateLimited = true;
|
|
42031
|
+
return [{ type: "rate_limit", status: "rejected", rateLimitType: "api" }];
|
|
42032
|
+
}
|
|
42033
|
+
if (stopReason === "end_turn" && state.rateLimited) {
|
|
42034
|
+
state.rateLimited = false;
|
|
42035
|
+
return [{ type: "rate_limit", status: "allowed" }];
|
|
42036
|
+
}
|
|
42037
|
+
return [];
|
|
41932
42038
|
}
|
|
41933
42039
|
function mapAutoCompactStarted(u) {
|
|
41934
42040
|
void u;
|
|
@@ -50024,6 +50130,7 @@ function createProductionTurnRunner(opts) {
|
|
|
50024
50130
|
queryFn: opts.claudeQueryFn,
|
|
50025
50131
|
allowSimulatedFallback: opts.allowSimulatedFallback,
|
|
50026
50132
|
providers: opts.providers,
|
|
50133
|
+
experimentalClaudeOpenAiChatEnabled: opts.experimentalClaudeOpenAiChatEnabled,
|
|
50027
50134
|
createHostActionClaudeMcp: opts.createHostActionClaudeMcp,
|
|
50028
50135
|
mcpMergeMode: opts.mcpMergeMode,
|
|
50029
50136
|
homeDir: opts.homeDir
|
|
@@ -57444,8 +57551,8 @@ import { fileURLToPath } from "node:url";
|
|
|
57444
57551
|
function resolveCliReleaseVersion() {
|
|
57445
57552
|
const fromEnv = process.env.SUPERONE_CLI_VERSION?.trim();
|
|
57446
57553
|
if (fromEnv) return fromEnv;
|
|
57447
|
-
if ("0.
|
|
57448
|
-
return "0.
|
|
57554
|
+
if ("0.51.0-alpha".trim()) {
|
|
57555
|
+
return "0.51.0-alpha".trim();
|
|
57449
57556
|
}
|
|
57450
57557
|
const fromDist = readDistManifestVersion();
|
|
57451
57558
|
if (fromDist) return fromDist;
|
|
@@ -58606,7 +58713,7 @@ var DEFAULT_NODE_AGENT_SETTINGS = {
|
|
|
58606
58713
|
defaultEffort: "",
|
|
58607
58714
|
permissionPreset: ""
|
|
58608
58715
|
},
|
|
58609
|
-
|
|
58716
|
+
experimentalClaudeOpenAiChatEnabled: false
|
|
58610
58717
|
};
|
|
58611
58718
|
function asString(value, fallback) {
|
|
58612
58719
|
return typeof value === "string" ? value : fallback;
|
|
@@ -58648,8 +58755,8 @@ function normalizeNodeAgentSettings(raw) {
|
|
|
58648
58755
|
return {
|
|
58649
58756
|
claude: normalizeClaude(agent.claude),
|
|
58650
58757
|
codex: normalizeCodex(agent.codex),
|
|
58651
|
-
|
|
58652
|
-
agent.
|
|
58758
|
+
experimentalClaudeOpenAiChatEnabled: asBoolean(
|
|
58759
|
+
agent.experimentalClaudeOpenAiChatEnabled,
|
|
58653
58760
|
false
|
|
58654
58761
|
)
|
|
58655
58762
|
};
|
|
@@ -58658,7 +58765,7 @@ function mergeNodeAgentSettings(current, patch) {
|
|
|
58658
58765
|
const next = {
|
|
58659
58766
|
claude: { ...current.claude },
|
|
58660
58767
|
codex: { ...current.codex },
|
|
58661
|
-
|
|
58768
|
+
experimentalClaudeOpenAiChatEnabled: current.experimentalClaudeOpenAiChatEnabled
|
|
58662
58769
|
};
|
|
58663
58770
|
if (patch.claude) {
|
|
58664
58771
|
if (typeof patch.claude.defaultModel === "string") {
|
|
@@ -58692,8 +58799,8 @@ function mergeNodeAgentSettings(current, patch) {
|
|
|
58692
58799
|
}
|
|
58693
58800
|
}
|
|
58694
58801
|
}
|
|
58695
|
-
if (typeof patch.
|
|
58696
|
-
next.
|
|
58802
|
+
if (typeof patch.experimentalClaudeOpenAiChatEnabled === "boolean") {
|
|
58803
|
+
next.experimentalClaudeOpenAiChatEnabled = patch.experimentalClaudeOpenAiChatEnabled;
|
|
58697
58804
|
}
|
|
58698
58805
|
return normalizeNodeAgentSettings(next);
|
|
58699
58806
|
}
|
|
@@ -58712,7 +58819,7 @@ function readConfigFile(path) {
|
|
|
58712
58819
|
function loadNodeAgentSettings(configPath) {
|
|
58713
58820
|
const file2 = readConfigFile(configPath);
|
|
58714
58821
|
if (file2.agent) return normalizeNodeAgentSettings(file2.agent);
|
|
58715
|
-
if (file2.claude || file2.codex || typeof file2.
|
|
58822
|
+
if (file2.claude || file2.codex || typeof file2.experimentalClaudeOpenAiChatEnabled === "boolean") {
|
|
58716
58823
|
return normalizeNodeAgentSettings(file2);
|
|
58717
58824
|
}
|
|
58718
58825
|
return { ...DEFAULT_NODE_AGENT_SETTINGS, claude: { ...DEFAULT_NODE_AGENT_SETTINGS.claude, disabledSkills: [] }, codex: { ...DEFAULT_NODE_AGENT_SETTINGS.codex } };
|
|
@@ -61523,8 +61630,16 @@ async function handleHarnessResources(payload, ctx) {
|
|
|
61523
61630
|
ctx.projects.touch(projectId);
|
|
61524
61631
|
const harnessId = typeof p2.harnessId === "string" && p2.harnessId.trim() ? p2.harnessId.trim() : null;
|
|
61525
61632
|
const apiProviderId = typeof p2.apiProviderId === "string" && p2.apiProviderId.trim() ? p2.apiProviderId.trim() : p2.apiProviderId === null ? null : void 0;
|
|
61633
|
+
const providerOptions = {
|
|
61634
|
+
experimentalClaudeOpenAiChatEnabled: ctx.experimentalClaudeOpenAiChatEnabled ?? false
|
|
61635
|
+
};
|
|
61526
61636
|
const listModels = (hid, apiId) => {
|
|
61527
|
-
return listHarnessProviderModels(
|
|
61637
|
+
return listHarnessProviderModels(
|
|
61638
|
+
ctx.providers,
|
|
61639
|
+
hid,
|
|
61640
|
+
apiId ?? null,
|
|
61641
|
+
providerOptions
|
|
61642
|
+
);
|
|
61528
61643
|
};
|
|
61529
61644
|
const probeModels = async (hid) => {
|
|
61530
61645
|
const probe = ctx.probeModels ?? defaultProbeModels(ctx);
|
|
@@ -61533,7 +61648,12 @@ async function handleHarnessResources(payload, ctx) {
|
|
|
61533
61648
|
console.warn(
|
|
61534
61649
|
`[harness.resources] ${hid} probe returned no models; serving the built-in fallback table`
|
|
61535
61650
|
);
|
|
61536
|
-
return listHarnessModels(
|
|
61651
|
+
return listHarnessModels(
|
|
61652
|
+
ctx.providers,
|
|
61653
|
+
hid,
|
|
61654
|
+
apiProviderId ?? null,
|
|
61655
|
+
providerOptions
|
|
61656
|
+
);
|
|
61537
61657
|
};
|
|
61538
61658
|
const bundle = await collectHarnessResources({
|
|
61539
61659
|
projectPath: project.path,
|
|
@@ -61716,7 +61836,8 @@ async function dispatchRpcInner(method, payload, ctx) {
|
|
|
61716
61836
|
client: ctx.client,
|
|
61717
61837
|
projects: ctx.projects,
|
|
61718
61838
|
providers: ctx.providers,
|
|
61719
|
-
harnesses: ctx.harnesses
|
|
61839
|
+
harnesses: ctx.harnesses,
|
|
61840
|
+
experimentalClaudeOpenAiChatEnabled: loadNodeAgentSettings(ctx.settingsConfigPath).experimentalClaudeOpenAiChatEnabled
|
|
61720
61841
|
});
|
|
61721
61842
|
if (harnessResources) return harnessResources;
|
|
61722
61843
|
const codex = await dispatchCodexRpc(method, payload, {
|
|
@@ -62037,7 +62158,11 @@ function handleProviderListModels(payload, ctx) {
|
|
|
62037
62158
|
const p2 = asRecord14(payload);
|
|
62038
62159
|
const harness = String(p2.harness ?? p2.harnessId ?? "claude");
|
|
62039
62160
|
const apiProviderId = typeof p2.apiProviderId === "string" && p2.apiProviderId.trim() ? p2.apiProviderId.trim() : null;
|
|
62040
|
-
return {
|
|
62161
|
+
return {
|
|
62162
|
+
result: listHarnessModels(ctx.providers, harness, apiProviderId, {
|
|
62163
|
+
experimentalClaudeOpenAiChatEnabled: loadNodeAgentSettings(ctx.settingsConfigPath).experimentalClaudeOpenAiChatEnabled
|
|
62164
|
+
})
|
|
62165
|
+
};
|
|
62041
62166
|
}
|
|
62042
62167
|
function handleProviderImportBundle(payload, ctx) {
|
|
62043
62168
|
const denied = requireScopes6(ctx.client, OPERATION_SCOPES.adminNode);
|
|
@@ -65942,39 +66067,28 @@ var CollaborationService = class {
|
|
|
65942
66067
|
constructor(deps) {
|
|
65943
66068
|
this.deps = deps;
|
|
65944
66069
|
}
|
|
65945
|
-
isEnabled() {
|
|
65946
|
-
return this.deps.isEnabled?.() ?? true;
|
|
65947
|
-
}
|
|
65948
|
-
assertEnabled() {
|
|
65949
|
-
if (!this.isEnabled()) {
|
|
65950
|
-
throw Object.assign(
|
|
65951
|
-
new Error(
|
|
65952
|
-
"Agent session collaboration is disabled. Enable experimentalAgentCollaborationEnabled in node settings."
|
|
65953
|
-
),
|
|
65954
|
-
{ code: "failed_precondition" }
|
|
65955
|
-
);
|
|
65956
|
-
}
|
|
65957
|
-
}
|
|
65958
66070
|
/** Agent profiles from session_providers (+ ready-harness fallback). */
|
|
65959
66071
|
listProfiles() {
|
|
65960
|
-
this.assertEnabled();
|
|
65961
66072
|
const { harnesses, providers, sessions, sessionProviders } = this.deps;
|
|
65962
66073
|
const profiles = [];
|
|
65963
66074
|
const seen = /* @__PURE__ */ new Set();
|
|
66075
|
+
const providerOptions = {
|
|
66076
|
+
experimentalClaudeOpenAiChatEnabled: this.deps.experimentalClaudeOpenAiChatEnabled?.() ?? false
|
|
66077
|
+
};
|
|
65964
66078
|
const pushProfile = (profileId, harnessId, name, description, profileConfig) => {
|
|
65965
66079
|
if (seen.has(profileId)) return;
|
|
65966
66080
|
if (harnessId !== "claude" && harnessId !== "codex" && harnessId !== "acp" && harnessId !== "opencode") {
|
|
65967
66081
|
return;
|
|
65968
66082
|
}
|
|
65969
66083
|
seen.add(profileId);
|
|
65970
|
-
const models = listHarnessModels(providers, harnessId, null).map((m2) => ({
|
|
66084
|
+
const models = listHarnessModels(providers, harnessId, null, providerOptions).map((m2) => ({
|
|
65971
66085
|
id: m2.id,
|
|
65972
66086
|
name: m2.name || m2.id,
|
|
65973
66087
|
...m2.description ? { description: m2.description } : {}
|
|
65974
66088
|
}));
|
|
65975
66089
|
const defaultModel = models.find((m2) => m2.isDefault) ?? models[0];
|
|
65976
66090
|
const efforts = /* @__PURE__ */ new Set();
|
|
65977
|
-
for (const m2 of listHarnessModels(providers, harnessId, null)) {
|
|
66091
|
+
for (const m2 of listHarnessModels(providers, harnessId, null, providerOptions)) {
|
|
65978
66092
|
for (const e of m2.supportedEffortLevels ?? []) efforts.add(e);
|
|
65979
66093
|
}
|
|
65980
66094
|
const cfg = profileConfig && typeof profileConfig === "object" && !Array.isArray(profileConfig) ? profileConfig : {};
|
|
@@ -65994,7 +66108,7 @@ var CollaborationService = class {
|
|
|
65994
66108
|
},
|
|
65995
66109
|
models: models.length > 0 ? models : [{ id: "default", name: "Default" }],
|
|
65996
66110
|
efforts: [...efforts],
|
|
65997
|
-
apiProviders: listHarnessApiProviders(providers, harnessId)
|
|
66111
|
+
apiProviders: listHarnessApiProviders(providers, harnessId, providerOptions)
|
|
65998
66112
|
});
|
|
65999
66113
|
};
|
|
66000
66114
|
if (sessionProviders) {
|
|
@@ -66040,7 +66154,6 @@ var CollaborationService = class {
|
|
|
66040
66154
|
* RPC path defaults to auto-approve (already-trusted controller).
|
|
66041
66155
|
*/
|
|
66042
66156
|
async request(input) {
|
|
66043
|
-
this.assertEnabled();
|
|
66044
66157
|
const parent = this.deps.sessions.get(input.parentSessionId);
|
|
66045
66158
|
if (!parent) {
|
|
66046
66159
|
throw Object.assign(new Error("Parent session is not available"), { code: "not_found" });
|
|
@@ -66210,7 +66323,6 @@ var CollaborationService = class {
|
|
|
66210
66323
|
return { status: "approved", launches: results };
|
|
66211
66324
|
}
|
|
66212
66325
|
async start(input) {
|
|
66213
|
-
this.assertEnabled();
|
|
66214
66326
|
let grant = this.resolveGrant(input.credential, input.grantId);
|
|
66215
66327
|
if (!grant) {
|
|
66216
66328
|
throw Object.assign(new Error("Invalid collaboration credential"), { code: "not_found" });
|
|
@@ -66349,7 +66461,6 @@ var CollaborationService = class {
|
|
|
66349
66461
|
};
|
|
66350
66462
|
}
|
|
66351
66463
|
send(input) {
|
|
66352
|
-
this.assertEnabled();
|
|
66353
66464
|
const grant = this.grantForCredential(input.credential);
|
|
66354
66465
|
if (!grant) {
|
|
66355
66466
|
throw Object.assign(new Error("Invalid collaboration credential"), { code: "not_found" });
|
|
@@ -66429,7 +66540,6 @@ var CollaborationService = class {
|
|
|
66429
66540
|
};
|
|
66430
66541
|
}
|
|
66431
66542
|
retrieve(input) {
|
|
66432
|
-
this.assertEnabled();
|
|
66433
66543
|
const credentials = [
|
|
66434
66544
|
...typeof input.credential === "string" && input.credential.trim() ? [input.credential.trim()] : [],
|
|
66435
66545
|
...Array.isArray(input.credentials) ? input.credentials.filter((c) => typeof c === "string" && c.trim().length > 0) : []
|
|
@@ -78333,16 +78443,6 @@ function collabDescriptor(name) {
|
|
|
78333
78443
|
};
|
|
78334
78444
|
}
|
|
78335
78445
|
function registerNodeCollabTools(server, superoneSessionId, collab) {
|
|
78336
|
-
const requireEnabled = () => {
|
|
78337
|
-
if (!collab.isEnabled()) {
|
|
78338
|
-
throw Object.assign(
|
|
78339
|
-
new Error(
|
|
78340
|
-
"Agent session collaboration is disabled. Enable experimentalAgentCollaborationEnabled in node settings."
|
|
78341
|
-
),
|
|
78342
|
-
{ code: "failed_precondition" }
|
|
78343
|
-
);
|
|
78344
|
-
}
|
|
78345
|
-
};
|
|
78346
78446
|
const listDesc = collabDescriptor("session_collab_list_agents");
|
|
78347
78447
|
server.registerTool(
|
|
78348
78448
|
"session_collab_list_agents",
|
|
@@ -78352,7 +78452,6 @@ function registerNodeCollabTools(server, superoneSessionId, collab) {
|
|
|
78352
78452
|
},
|
|
78353
78453
|
async () => {
|
|
78354
78454
|
try {
|
|
78355
|
-
requireEnabled();
|
|
78356
78455
|
const agents = await collab.listAgents(superoneSessionId);
|
|
78357
78456
|
return toolResultJson({ agents });
|
|
78358
78457
|
} catch (err) {
|
|
@@ -78369,7 +78468,6 @@ function registerNodeCollabTools(server, superoneSessionId, collab) {
|
|
|
78369
78468
|
},
|
|
78370
78469
|
async (args, extra) => {
|
|
78371
78470
|
try {
|
|
78372
|
-
requireEnabled();
|
|
78373
78471
|
const result = await collab.request(superoneSessionId, args ?? {}, extra?.signal);
|
|
78374
78472
|
const status = result && typeof result === "object" && "status" in result ? String(result.status) : "ok";
|
|
78375
78473
|
return toolResultJson(result, status === "error");
|
|
@@ -78389,7 +78487,6 @@ function registerNodeCollabTools(server, superoneSessionId, collab) {
|
|
|
78389
78487
|
},
|
|
78390
78488
|
async (args) => {
|
|
78391
78489
|
try {
|
|
78392
|
-
requireEnabled();
|
|
78393
78490
|
const result = await collab.start(superoneSessionId, args ?? {});
|
|
78394
78491
|
return toolResultJson(result);
|
|
78395
78492
|
} catch (err) {
|
|
@@ -78406,7 +78503,6 @@ function registerNodeCollabTools(server, superoneSessionId, collab) {
|
|
|
78406
78503
|
},
|
|
78407
78504
|
async (args) => {
|
|
78408
78505
|
try {
|
|
78409
|
-
requireEnabled();
|
|
78410
78506
|
const result = await collab.send(superoneSessionId, args ?? {});
|
|
78411
78507
|
return toolResultJson(result);
|
|
78412
78508
|
} catch (err) {
|
|
@@ -78423,7 +78519,6 @@ function registerNodeCollabTools(server, superoneSessionId, collab) {
|
|
|
78423
78519
|
},
|
|
78424
78520
|
async (args) => {
|
|
78425
78521
|
try {
|
|
78426
|
-
requireEnabled();
|
|
78427
78522
|
const result = await collab.retrieve(superoneSessionId, args ?? {});
|
|
78428
78523
|
return toolResultJson(result);
|
|
78429
78524
|
} catch (err) {
|
|
@@ -79713,7 +79808,6 @@ async function startNodeRuntime(partial2 = {}) {
|
|
|
79713
79808
|
const collabSecrets = createNodeSecretCrypto(paths.providerSecretsKey);
|
|
79714
79809
|
let sessionsRef = null;
|
|
79715
79810
|
let collaborationRef = null;
|
|
79716
|
-
const isCollabEnabled = () => loadNodeAgentSettings(paths.configJson).experimentalAgentCollaborationEnabled;
|
|
79717
79811
|
const hostActionMcp = await startHostActionMcpServer({
|
|
79718
79812
|
requestHostAction: (input) => {
|
|
79719
79813
|
if (!sessionsRef) {
|
|
@@ -79724,7 +79818,6 @@ async function startNodeRuntime(partial2 = {}) {
|
|
|
79724
79818
|
return sessionsRef.requestHostAction(input);
|
|
79725
79819
|
},
|
|
79726
79820
|
collab: {
|
|
79727
|
-
isEnabled: isCollabEnabled,
|
|
79728
79821
|
listAgents: () => {
|
|
79729
79822
|
if (!collaborationRef) throw Object.assign(new Error("collab not ready"), { code: "failed_precondition" });
|
|
79730
79823
|
return collaborationRef.listProfiles();
|
|
@@ -79773,6 +79866,7 @@ async function startNodeRuntime(partial2 = {}) {
|
|
|
79773
79866
|
resolveProjectPath: (projectId) => projects.get(projectId)?.path ?? null,
|
|
79774
79867
|
allowSimulatedFallback: allowSimulatedTurnFallback,
|
|
79775
79868
|
providers,
|
|
79869
|
+
experimentalClaudeOpenAiChatEnabled: () => loadNodeAgentSettings(paths.configJson).experimentalClaudeOpenAiChatEnabled,
|
|
79776
79870
|
// Claude: in-process SDK MCP (same core tools as HTTP).
|
|
79777
79871
|
createHostActionClaudeMcp: (sessionId) => hostActionMcp.createClaudeSdkMcp(sessionId),
|
|
79778
79872
|
// Codex / ACP / OpenCode: loopback HTTP with per-session HMAC.
|
|
@@ -79805,7 +79899,7 @@ async function startNodeRuntime(partial2 = {}) {
|
|
|
79805
79899
|
workspaceGit,
|
|
79806
79900
|
secrets: collabSecrets,
|
|
79807
79901
|
sessionProviders,
|
|
79808
|
-
|
|
79902
|
+
experimentalClaudeOpenAiChatEnabled: () => loadNodeAgentSettings(paths.configJson).experimentalClaudeOpenAiChatEnabled
|
|
79809
79903
|
});
|
|
79810
79904
|
collaborationRef = collaboration;
|
|
79811
79905
|
collaboration.rehydrateSystemPrompts();
|
package/package.json
CHANGED