@codelia/runtime 0.1.82 → 0.1.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-CGWVQ7AE.js → chunk-A6CO4J5P.js} +160 -76
- package/dist/{chunk-WA2KLV6H.js → chunk-JRAJDBQ3.js} +2396 -2352
- package/dist/index.cjs +3557 -3437
- package/dist/index.js +2 -2
- package/dist/sdk.cjs +3557 -3437
- package/dist/sdk.d.cts +3 -3
- package/dist/sdk.d.ts +3 -3
- package/dist/sdk.js +2 -2
- package/dist/subagents/child-entry.cjs +161 -83
- package/dist/subagents/child-entry.js +1 -1
- package/package.json +9 -9
package/dist/sdk.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import * as _codelia_config from '@codelia/config';
|
|
|
2
2
|
import { PermissionsConfig, SubagentConfig, PermissionRule } from '@codelia/config';
|
|
3
3
|
import { SessionStateStore, RunEventStoreFactory, ToolOutputCacheStore, Tool } from '@codelia/core';
|
|
4
4
|
import { RpcNotification } from '@codelia/protocol';
|
|
5
|
-
import { SubagentLineage, ApprovalMode, AgentMessage, ModelReasoningLevel } from '@codelia/shared-types';
|
|
5
|
+
import { ModelFastMode, SubagentLineage, ApprovalMode, AgentMessage, ModelReasoningLevel } from '@codelia/shared-types';
|
|
6
6
|
import { TaskResult, TaskState, TaskRecord, TaskKind, TaskWorkspaceMode, TaskRegistryStore } from '@codelia/storage';
|
|
7
7
|
|
|
8
8
|
type ResolvedModelConfig = {
|
|
@@ -11,7 +11,7 @@ type ResolvedModelConfig = {
|
|
|
11
11
|
name?: string;
|
|
12
12
|
reasoning?: string;
|
|
13
13
|
verbosity?: string;
|
|
14
|
-
fast?:
|
|
14
|
+
fast?: ModelFastMode;
|
|
15
15
|
experimental?: {
|
|
16
16
|
openai?: {
|
|
17
17
|
websocket_mode?: "off" | "auto" | "on";
|
|
@@ -304,7 +304,7 @@ type RuntimeConfigProvider = {
|
|
|
304
304
|
provider: string;
|
|
305
305
|
name: string;
|
|
306
306
|
reasoning?: ModelReasoningLevel;
|
|
307
|
-
fast?:
|
|
307
|
+
fast?: ModelFastMode;
|
|
308
308
|
}) => Promise<WriteTarget>;
|
|
309
309
|
updateTuiTheme?: (workingDir: string | undefined, theme: string) => Promise<WriteTarget>;
|
|
310
310
|
appendPermissionAllowRules?: (workingDir: string | undefined, rules: PermissionRule[]) => Promise<void>;
|
package/dist/sdk.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as _codelia_config from '@codelia/config';
|
|
|
2
2
|
import { PermissionsConfig, SubagentConfig, PermissionRule } from '@codelia/config';
|
|
3
3
|
import { SessionStateStore, RunEventStoreFactory, ToolOutputCacheStore, Tool } from '@codelia/core';
|
|
4
4
|
import { RpcNotification } from '@codelia/protocol';
|
|
5
|
-
import { SubagentLineage, ApprovalMode, AgentMessage, ModelReasoningLevel } from '@codelia/shared-types';
|
|
5
|
+
import { ModelFastMode, SubagentLineage, ApprovalMode, AgentMessage, ModelReasoningLevel } from '@codelia/shared-types';
|
|
6
6
|
import { TaskResult, TaskState, TaskRecord, TaskKind, TaskWorkspaceMode, TaskRegistryStore } from '@codelia/storage';
|
|
7
7
|
|
|
8
8
|
type ResolvedModelConfig = {
|
|
@@ -11,7 +11,7 @@ type ResolvedModelConfig = {
|
|
|
11
11
|
name?: string;
|
|
12
12
|
reasoning?: string;
|
|
13
13
|
verbosity?: string;
|
|
14
|
-
fast?:
|
|
14
|
+
fast?: ModelFastMode;
|
|
15
15
|
experimental?: {
|
|
16
16
|
openai?: {
|
|
17
17
|
websocket_mode?: "off" | "auto" | "on";
|
|
@@ -304,7 +304,7 @@ type RuntimeConfigProvider = {
|
|
|
304
304
|
provider: string;
|
|
305
305
|
name: string;
|
|
306
306
|
reasoning?: ModelReasoningLevel;
|
|
307
|
-
fast?:
|
|
307
|
+
fast?: ModelFastMode;
|
|
308
308
|
}) => Promise<WriteTarget>;
|
|
309
309
|
updateTuiTheme?: (workingDir: string | undefined, theme: string) => Promise<WriteTarget>;
|
|
310
310
|
appendPermissionAllowRules?: (workingDir: string | undefined, rules: PermissionRule[]) => Promise<void>;
|
package/dist/sdk.js
CHANGED
|
@@ -1005,57 +1005,31 @@ var AuthResolver = class _AuthResolver {
|
|
|
1005
1005
|
}
|
|
1006
1006
|
};
|
|
1007
1007
|
|
|
1008
|
-
// src/responses-provider.ts
|
|
1009
|
-
var import_core2 = require("@codelia/core");
|
|
1010
|
-
var getResponsesProvider = (config, provider) => config.providers && Object.hasOwn(config.providers, provider) ? config.providers[provider] : void 0;
|
|
1011
|
-
var configuredModelSpecs = (providers) => Object.entries(providers ?? {}).flatMap(
|
|
1012
|
-
([provider, endpoint]) => Object.entries(endpoint.models).map(([model, spec]) => ({
|
|
1013
|
-
id: `${provider}/${model}`,
|
|
1014
|
-
provider,
|
|
1015
|
-
providerModelId: model,
|
|
1016
|
-
aliases: [model],
|
|
1017
|
-
contextWindow: spec.context_window,
|
|
1018
|
-
maxInputTokens: spec.max_input_tokens,
|
|
1019
|
-
maxOutputTokens: spec.max_output_tokens,
|
|
1020
|
-
supportsTools: spec.supports_tools === true,
|
|
1021
|
-
supportsVision: spec.supports_vision === true,
|
|
1022
|
-
supportsReasoning: spec.supports_reasoning === true,
|
|
1023
|
-
supportsJsonSchema: spec.supports_json_schema === true,
|
|
1024
|
-
supportsFast: false
|
|
1025
|
-
}))
|
|
1026
|
-
);
|
|
1027
|
-
var buildConfiguredModelRegistry = (providers) => (0, import_core2.createModelRegistry)([
|
|
1028
|
-
...Object.values(import_core2.DEFAULT_MODEL_REGISTRY.modelsById),
|
|
1029
|
-
...configuredModelSpecs(providers)
|
|
1030
|
-
]);
|
|
1031
|
-
var resolveConfiguredReasoning = (config, provider, model) => {
|
|
1032
|
-
const endpoint = getResponsesProvider(config, provider);
|
|
1033
|
-
const spec = endpoint && Object.hasOwn(endpoint.models, model) ? endpoint.models[model] : void 0;
|
|
1034
|
-
if (!spec) throw new Error(`Unknown model for ${provider}: ${model}`);
|
|
1035
|
-
if (!spec.supports_reasoning) {
|
|
1036
|
-
return void 0;
|
|
1037
|
-
}
|
|
1038
|
-
const levels = spec.reasoning_levels ?? ["low", "medium", "high"];
|
|
1039
|
-
const effort = config.reasoning ?? (levels.includes("medium") ? "medium" : levels[0]);
|
|
1040
|
-
if (!levels.some((level) => level === effort))
|
|
1041
|
-
throw new Error(
|
|
1042
|
-
`Unsupported reasoning effort for ${provider}/${model}: ${effort}`
|
|
1043
|
-
);
|
|
1044
|
-
return effort;
|
|
1045
|
-
};
|
|
1046
|
-
|
|
1047
1008
|
// src/model-factory.ts
|
|
1048
|
-
var
|
|
1009
|
+
var import_core5 = require("@codelia/core");
|
|
1049
1010
|
var import_model_metadata = require("@codelia/model-metadata");
|
|
1050
1011
|
var import_storage3 = require("@codelia/storage");
|
|
1051
1012
|
|
|
1052
1013
|
// src/model-fast.ts
|
|
1053
|
-
var
|
|
1014
|
+
var import_core2 = require("@codelia/core");
|
|
1054
1015
|
var resolveFastMode = (params) => {
|
|
1016
|
+
if (params.requested === "ultrafast") {
|
|
1017
|
+
const model = (0, import_core2.resolveProviderModelId)(
|
|
1018
|
+
import_core2.DEFAULT_MODEL_REGISTRY,
|
|
1019
|
+
params.model,
|
|
1020
|
+
params.provider
|
|
1021
|
+
) ?? params.model;
|
|
1022
|
+
if (params.provider !== "openai" || !["gpt-6-astra", "gpt-6.1-sol"].includes(model)) {
|
|
1023
|
+
throw new Error(
|
|
1024
|
+
"Ultrafast requires OpenAI gpt-6-astra or gpt-6.1-sol; select /fast off before using another model."
|
|
1025
|
+
);
|
|
1026
|
+
}
|
|
1027
|
+
return { enabled: true, provider: "openai", serviceTier: "ultrafast" };
|
|
1028
|
+
}
|
|
1055
1029
|
if (params.requested !== true) {
|
|
1056
1030
|
return { enabled: false };
|
|
1057
1031
|
}
|
|
1058
|
-
if (!(0,
|
|
1032
|
+
if (!(0, import_core2.supportsFastMode)(import_core2.DEFAULT_MODEL_REGISTRY, params.model, params.provider)) {
|
|
1059
1033
|
return { enabled: false };
|
|
1060
1034
|
}
|
|
1061
1035
|
if (params.provider === "openai") {
|
|
@@ -1066,8 +1040,16 @@ var resolveFastMode = (params) => {
|
|
|
1066
1040
|
}
|
|
1067
1041
|
return { enabled: false };
|
|
1068
1042
|
};
|
|
1043
|
+
var assertUltrafastAuth = (fast, method) => {
|
|
1044
|
+
if (fast === "ultrafast" && method !== "api_key") {
|
|
1045
|
+
throw new Error(
|
|
1046
|
+
"Ultrafast requires OpenAI API-key authentication. Codex OAuth support is unverified; credentials will not be switched automatically."
|
|
1047
|
+
);
|
|
1048
|
+
}
|
|
1049
|
+
};
|
|
1069
1050
|
|
|
1070
1051
|
// src/model-reasoning.ts
|
|
1052
|
+
var import_core3 = require("@codelia/core");
|
|
1071
1053
|
var import_shared_types2 = require("@codelia/shared-types");
|
|
1072
1054
|
var REASONING_LEVEL_ORDER = import_shared_types2.MODEL_REASONING_LEVELS;
|
|
1073
1055
|
var DEFAULT_REASONING_LEVEL = "medium";
|
|
@@ -1086,6 +1068,7 @@ var RESPONSES_XHIGH_UNSUPPORTED_MODELS = /* @__PURE__ */ new Set([
|
|
|
1086
1068
|
"gpt-5.1-codex-mini"
|
|
1087
1069
|
]);
|
|
1088
1070
|
var RESPONSES_MAX_SUPPORTED_MODELS = /* @__PURE__ */ new Set([
|
|
1071
|
+
"gpt-6.1-terra",
|
|
1089
1072
|
"gpt-6.1-sol",
|
|
1090
1073
|
"gpt-6-astra",
|
|
1091
1074
|
"gpt-6-sol",
|
|
@@ -1124,6 +1107,28 @@ var ANTHROPIC_OUTPUT_EFFORT_WITHOUT_XHIGH = {
|
|
|
1124
1107
|
max: "max"
|
|
1125
1108
|
};
|
|
1126
1109
|
var ANTHROPIC_REASONING_MODEL_TABLE = {
|
|
1110
|
+
"claude-sonnet-5-5": {
|
|
1111
|
+
supportedLevels: ["low", "medium", "high", "xhigh", "max"],
|
|
1112
|
+
budgetPresetByLevel: {
|
|
1113
|
+
low: "reasoning_low",
|
|
1114
|
+
medium: "reasoning_medium",
|
|
1115
|
+
high: "reasoning_high",
|
|
1116
|
+
xhigh: "reasoning_xhigh",
|
|
1117
|
+
max: "reasoning_xhigh"
|
|
1118
|
+
},
|
|
1119
|
+
outputEffortByLevel: ANTHROPIC_OUTPUT_EFFORT_ALL
|
|
1120
|
+
},
|
|
1121
|
+
"claude-haiku-5-5": {
|
|
1122
|
+
supportedLevels: ["low", "medium", "high", "xhigh", "max"],
|
|
1123
|
+
budgetPresetByLevel: {
|
|
1124
|
+
low: "reasoning_low",
|
|
1125
|
+
medium: "reasoning_medium",
|
|
1126
|
+
high: "reasoning_high",
|
|
1127
|
+
xhigh: "reasoning_xhigh",
|
|
1128
|
+
max: "reasoning_xhigh"
|
|
1129
|
+
},
|
|
1130
|
+
outputEffortByLevel: ANTHROPIC_OUTPUT_EFFORT_ALL
|
|
1131
|
+
},
|
|
1127
1132
|
"claude-fable-5-1": {
|
|
1128
1133
|
supportedLevels: ["low", "medium", "high", "xhigh", "max"],
|
|
1129
1134
|
budgetPresetByLevel: {
|
|
@@ -1275,6 +1280,8 @@ var ANTHROPIC_REASONING_MODEL_TABLE = {
|
|
|
1275
1280
|
}
|
|
1276
1281
|
};
|
|
1277
1282
|
var ANTHROPIC_ADAPTIVE_THINKING_MODELS = /* @__PURE__ */ new Set([
|
|
1283
|
+
"claude-sonnet-5-5",
|
|
1284
|
+
"claude-haiku-5-5",
|
|
1278
1285
|
"claude-fable-5-1",
|
|
1279
1286
|
"claude-opus-5-5",
|
|
1280
1287
|
"claude-sonnet-5",
|
|
@@ -1393,8 +1400,20 @@ var resolveAnthropicMaxTokens = ({
|
|
|
1393
1400
|
return normalizedBudget + ANTHROPIC_MAX_TOKENS_FALLBACK_HEADROOM;
|
|
1394
1401
|
};
|
|
1395
1402
|
var resolveZaiReasoning = ({
|
|
1403
|
+
model,
|
|
1396
1404
|
requested
|
|
1397
1405
|
}) => {
|
|
1406
|
+
if (model === "glm-5.3") {
|
|
1407
|
+
const resolution = resolveReasoningAgainstSupportedLevels({
|
|
1408
|
+
requested,
|
|
1409
|
+
supportedLevels: ["low", "high", "max"]
|
|
1410
|
+
});
|
|
1411
|
+
return {
|
|
1412
|
+
...resolution,
|
|
1413
|
+
applied: resolution.applied,
|
|
1414
|
+
effort: resolution.applied
|
|
1415
|
+
};
|
|
1416
|
+
}
|
|
1398
1417
|
const normalizedRequested = normalizeRequestedReasoning(requested);
|
|
1399
1418
|
if (normalizedRequested === "xhigh" || normalizedRequested === "max") {
|
|
1400
1419
|
return {
|
|
@@ -1414,20 +1433,25 @@ var resolveZaiReasoning = ({
|
|
|
1414
1433
|
};
|
|
1415
1434
|
};
|
|
1416
1435
|
var resolveMoonshotReasoning = ({
|
|
1436
|
+
model,
|
|
1417
1437
|
requested
|
|
1418
1438
|
}) => {
|
|
1419
1439
|
const resolution = resolveReasoningAgainstSupportedLevels({
|
|
1420
1440
|
requested,
|
|
1421
|
-
supportedLevels: ["max"]
|
|
1441
|
+
supportedLevels: model && import_core3.MOONSHOT_K3_1_MODELS.has(model) ? ["low", "high", "max"] : ["max"]
|
|
1422
1442
|
});
|
|
1423
|
-
return {
|
|
1443
|
+
return {
|
|
1444
|
+
...resolution,
|
|
1445
|
+
effort: resolution.applied
|
|
1446
|
+
};
|
|
1424
1447
|
};
|
|
1425
1448
|
var resolveXaiReasoning = ({
|
|
1449
|
+
model,
|
|
1426
1450
|
requested
|
|
1427
1451
|
}) => {
|
|
1428
1452
|
const resolution = resolveReasoningAgainstSupportedLevels({
|
|
1429
1453
|
requested,
|
|
1430
|
-
supportedLevels: ["low", "medium", "high"]
|
|
1454
|
+
supportedLevels: model === "grok-4.7" ? ["low", "medium", "high", "xhigh"] : ["low", "medium", "high"]
|
|
1431
1455
|
});
|
|
1432
1456
|
return {
|
|
1433
1457
|
...resolution,
|
|
@@ -1435,6 +1459,45 @@ var resolveXaiReasoning = ({
|
|
|
1435
1459
|
};
|
|
1436
1460
|
};
|
|
1437
1461
|
|
|
1462
|
+
// src/responses-provider.ts
|
|
1463
|
+
var import_core4 = require("@codelia/core");
|
|
1464
|
+
var getResponsesProvider = (config, provider) => config.providers && Object.hasOwn(config.providers, provider) ? config.providers[provider] : void 0;
|
|
1465
|
+
var configuredModelSpecs = (providers) => Object.entries(providers ?? {}).flatMap(
|
|
1466
|
+
([provider, endpoint]) => Object.entries(endpoint.models).map(([model, spec]) => ({
|
|
1467
|
+
id: `${provider}/${model}`,
|
|
1468
|
+
provider,
|
|
1469
|
+
providerModelId: model,
|
|
1470
|
+
aliases: [model],
|
|
1471
|
+
contextWindow: spec.context_window,
|
|
1472
|
+
maxInputTokens: spec.max_input_tokens,
|
|
1473
|
+
maxOutputTokens: spec.max_output_tokens,
|
|
1474
|
+
supportsTools: spec.supports_tools === true,
|
|
1475
|
+
supportsVision: spec.supports_vision === true,
|
|
1476
|
+
supportsReasoning: spec.supports_reasoning === true,
|
|
1477
|
+
supportsJsonSchema: spec.supports_json_schema === true,
|
|
1478
|
+
supportsFast: false
|
|
1479
|
+
}))
|
|
1480
|
+
);
|
|
1481
|
+
var buildConfiguredModelRegistry = (providers) => (0, import_core4.createModelRegistry)([
|
|
1482
|
+
...Object.values(import_core4.DEFAULT_MODEL_REGISTRY.modelsById),
|
|
1483
|
+
...configuredModelSpecs(providers)
|
|
1484
|
+
]);
|
|
1485
|
+
var resolveConfiguredReasoning = (config, provider, model) => {
|
|
1486
|
+
const endpoint = getResponsesProvider(config, provider);
|
|
1487
|
+
const spec = endpoint && Object.hasOwn(endpoint.models, model) ? endpoint.models[model] : void 0;
|
|
1488
|
+
if (!spec) throw new Error(`Unknown model for ${provider}: ${model}`);
|
|
1489
|
+
if (!spec.supports_reasoning) {
|
|
1490
|
+
return void 0;
|
|
1491
|
+
}
|
|
1492
|
+
const levels = spec.reasoning_levels ?? ["low", "medium", "high"];
|
|
1493
|
+
const effort = config.reasoning ?? (levels.includes("medium") ? "medium" : levels[0]);
|
|
1494
|
+
if (!levels.some((level) => level === effort))
|
|
1495
|
+
throw new Error(
|
|
1496
|
+
`Unsupported reasoning effort for ${provider}/${model}: ${effort}`
|
|
1497
|
+
);
|
|
1498
|
+
return effort;
|
|
1499
|
+
};
|
|
1500
|
+
|
|
1438
1501
|
// src/model-factory.ts
|
|
1439
1502
|
var OPENAI_OAUTH_ORIGINATOR = "codelia";
|
|
1440
1503
|
var OPENAI_OAUTH_USER_AGENT = "codelia-cli";
|
|
@@ -1561,7 +1624,7 @@ var resolveModelMaxTokensFromEntry = (entry) => {
|
|
|
1561
1624
|
return null;
|
|
1562
1625
|
};
|
|
1563
1626
|
var resolveAnthropicStaticModelMaxTokens = (model) => {
|
|
1564
|
-
const spec = (0,
|
|
1627
|
+
const spec = (0, import_core5.resolveModel)(import_core5.DEFAULT_MODEL_REGISTRY, model, "anthropic");
|
|
1565
1628
|
const candidates = [
|
|
1566
1629
|
spec?.maxOutputTokens,
|
|
1567
1630
|
spec?.maxInputTokens,
|
|
@@ -1594,13 +1657,21 @@ var createRuntimeModel = async ({
|
|
|
1594
1657
|
log: log2,
|
|
1595
1658
|
getOpenAiAccessToken
|
|
1596
1659
|
}) => {
|
|
1660
|
+
if (config.fast === "ultrafast") {
|
|
1661
|
+
resolveFastMode({
|
|
1662
|
+
provider,
|
|
1663
|
+
model: config.name ?? import_core5.OPENAI_DEFAULT_MODEL,
|
|
1664
|
+
requested: config.fast
|
|
1665
|
+
});
|
|
1666
|
+
assertUltrafastAuth(config.fast, auth.method);
|
|
1667
|
+
}
|
|
1597
1668
|
const endpoint = getResponsesProvider(config, provider);
|
|
1598
1669
|
if (endpoint) {
|
|
1599
1670
|
const modelName = config.name ?? Object.keys(endpoint.models)[0];
|
|
1600
1671
|
if (!modelName || !Object.hasOwn(endpoint.models, modelName))
|
|
1601
1672
|
throw new Error(`Unknown model for ${provider}: ${modelName}`);
|
|
1602
1673
|
return {
|
|
1603
|
-
llm: new
|
|
1674
|
+
llm: new import_core5.ChatResponses({
|
|
1604
1675
|
provider,
|
|
1605
1676
|
model: modelName,
|
|
1606
1677
|
endpoint,
|
|
@@ -1616,11 +1687,11 @@ var createRuntimeModel = async ({
|
|
|
1616
1687
|
};
|
|
1617
1688
|
}
|
|
1618
1689
|
const requestedReasoning = resolveReasoningEffort(config.reasoning) ?? "medium";
|
|
1619
|
-
const
|
|
1690
|
+
const requestedFastMode = config.fast;
|
|
1620
1691
|
switch (provider) {
|
|
1621
1692
|
case "openai": {
|
|
1622
|
-
const modelName = config.name ??
|
|
1623
|
-
const providerModelName = (0,
|
|
1693
|
+
const modelName = config.name ?? import_core5.OPENAI_DEFAULT_MODEL;
|
|
1694
|
+
const providerModelName = (0, import_core5.resolveProviderModelId)(import_core5.DEFAULT_MODEL_REGISTRY, modelName, "openai") ?? modelName;
|
|
1624
1695
|
const reasoning = resolveResponsesReasoning({
|
|
1625
1696
|
model: providerModelName,
|
|
1626
1697
|
requested: requestedReasoning
|
|
@@ -1630,10 +1701,10 @@ var createRuntimeModel = async ({
|
|
|
1630
1701
|
const fastMode = resolveFastMode({
|
|
1631
1702
|
provider: "openai",
|
|
1632
1703
|
model: modelName,
|
|
1633
|
-
requested:
|
|
1704
|
+
requested: requestedFastMode
|
|
1634
1705
|
});
|
|
1635
1706
|
return {
|
|
1636
|
-
llm: new
|
|
1707
|
+
llm: new import_core5.ChatOpenAI({
|
|
1637
1708
|
clientOptions: buildOpenAiClientOptions(
|
|
1638
1709
|
getOpenAiAccessToken,
|
|
1639
1710
|
auth,
|
|
@@ -1653,14 +1724,14 @@ var createRuntimeModel = async ({
|
|
|
1653
1724
|
};
|
|
1654
1725
|
}
|
|
1655
1726
|
case "openrouter": {
|
|
1656
|
-
const modelName = config.name ??
|
|
1727
|
+
const modelName = config.name ?? import_core5.OPENAI_DEFAULT_MODEL;
|
|
1657
1728
|
const reasoning = resolveResponsesReasoning({
|
|
1658
1729
|
model: modelName,
|
|
1659
1730
|
requested: requestedReasoning
|
|
1660
1731
|
});
|
|
1661
1732
|
const textVerbosity = resolveTextVerbosity(config.verbosity);
|
|
1662
1733
|
return {
|
|
1663
|
-
llm: new
|
|
1734
|
+
llm: new import_core5.ChatOpenRouter({
|
|
1664
1735
|
clientOptions: buildOpenRouterClientOptions(auth),
|
|
1665
1736
|
model: modelName,
|
|
1666
1737
|
reasoningEffort: reasoning.effort,
|
|
@@ -1673,7 +1744,7 @@ var createRuntimeModel = async ({
|
|
|
1673
1744
|
};
|
|
1674
1745
|
}
|
|
1675
1746
|
case "anthropic": {
|
|
1676
|
-
const modelName = config.name ??
|
|
1747
|
+
const modelName = config.name ?? import_core5.ANTHROPIC_DEFAULT_MODEL;
|
|
1677
1748
|
const reasoning = resolveAnthropicReasoning({
|
|
1678
1749
|
model: modelName,
|
|
1679
1750
|
requested: requestedReasoning,
|
|
@@ -1698,10 +1769,10 @@ var createRuntimeModel = async ({
|
|
|
1698
1769
|
const fastMode = resolveFastMode({
|
|
1699
1770
|
provider: "anthropic",
|
|
1700
1771
|
model: modelName,
|
|
1701
|
-
requested:
|
|
1772
|
+
requested: requestedFastMode
|
|
1702
1773
|
});
|
|
1703
1774
|
return {
|
|
1704
|
-
llm: new
|
|
1775
|
+
llm: new import_core5.ChatAnthropic({
|
|
1705
1776
|
clientOptions: {
|
|
1706
1777
|
apiKey: requireApiKeyAuth("Anthropic", auth)
|
|
1707
1778
|
},
|
|
@@ -1721,14 +1792,15 @@ var createRuntimeModel = async ({
|
|
|
1721
1792
|
};
|
|
1722
1793
|
}
|
|
1723
1794
|
case "zai": {
|
|
1724
|
-
const modelName = config.name ??
|
|
1795
|
+
const modelName = config.name ?? import_core5.ZAI_DEFAULT_MODEL;
|
|
1725
1796
|
const reasoning = resolveZaiReasoning({
|
|
1797
|
+
model: modelName,
|
|
1726
1798
|
requested: requestedReasoning
|
|
1727
1799
|
});
|
|
1728
|
-
const providerModelName = (0,
|
|
1729
|
-
const supportsReasoningEffort =
|
|
1800
|
+
const providerModelName = (0, import_core5.resolveProviderModelId)(import_core5.DEFAULT_MODEL_REGISTRY, modelName, "zai") ?? modelName;
|
|
1801
|
+
const supportsReasoningEffort = import_core5.ZAI_REASONING_EFFORT_MODELS.has(providerModelName);
|
|
1730
1802
|
return {
|
|
1731
|
-
llm: new
|
|
1803
|
+
llm: new import_core5.ChatZai({
|
|
1732
1804
|
...buildZaiClientOptions(auth),
|
|
1733
1805
|
model: modelName,
|
|
1734
1806
|
reasoningEffort: supportsReasoningEffort ? reasoning.effort : null,
|
|
@@ -1740,26 +1812,29 @@ var createRuntimeModel = async ({
|
|
|
1740
1812
|
};
|
|
1741
1813
|
}
|
|
1742
1814
|
case "moonshot": {
|
|
1743
|
-
const modelName = config.name ??
|
|
1815
|
+
const modelName = config.name ?? import_core5.MOONSHOT_DEFAULT_MODEL;
|
|
1744
1816
|
const reasoning = resolveMoonshotReasoning({
|
|
1817
|
+
model: modelName,
|
|
1745
1818
|
requested: requestedReasoning
|
|
1746
1819
|
});
|
|
1747
1820
|
return {
|
|
1748
|
-
llm: new
|
|
1821
|
+
llm: new import_core5.ChatMoonshot({
|
|
1749
1822
|
...buildMoonshotClientOptions(auth),
|
|
1750
1823
|
model: modelName,
|
|
1824
|
+
reasoningEffort: reasoning.effort,
|
|
1751
1825
|
reasoningLevelRequested: reasoning.requested
|
|
1752
1826
|
}),
|
|
1753
1827
|
resolvedModelName: modelName
|
|
1754
1828
|
};
|
|
1755
1829
|
}
|
|
1756
1830
|
case "xai": {
|
|
1757
|
-
const modelName = config.name ??
|
|
1831
|
+
const modelName = config.name ?? import_core5.XAI_DEFAULT_MODEL;
|
|
1758
1832
|
const reasoning = resolveXaiReasoning({
|
|
1833
|
+
model: modelName,
|
|
1759
1834
|
requested: requestedReasoning
|
|
1760
1835
|
});
|
|
1761
1836
|
return {
|
|
1762
|
-
llm: new
|
|
1837
|
+
llm: new import_core5.ChatXai({
|
|
1763
1838
|
clientOptions: buildXaiClientOptions(auth),
|
|
1764
1839
|
model: modelName,
|
|
1765
1840
|
reasoningEffort: reasoning.effort,
|
|
@@ -2009,6 +2084,7 @@ var RuntimeState = class {
|
|
|
2009
2084
|
sessionMeta = null;
|
|
2010
2085
|
sessionAppend = null;
|
|
2011
2086
|
agent = null;
|
|
2087
|
+
cachedAuthProviders = /* @__PURE__ */ new Set();
|
|
2012
2088
|
prepareRunImages;
|
|
2013
2089
|
agentsResolver = null;
|
|
2014
2090
|
skillsResolver = null;
|
|
@@ -2139,7 +2215,9 @@ var subagentModelSchema = import_zod.z.object({
|
|
|
2139
2215
|
name: import_zod.z.string().min(1),
|
|
2140
2216
|
reasoning: import_zod.z.string().optional(),
|
|
2141
2217
|
verbosity: import_zod.z.string().optional(),
|
|
2142
|
-
fast: import_zod.z.boolean().optional()
|
|
2218
|
+
fast: import_zod.z.union([import_zod.z.boolean(), import_zod.z.literal("ultrafast")]).optional().describe(
|
|
2219
|
+
'Optional speed selection. true uses supported fast mode; "ultrafast" requires OpenAI API-key GPT-6 Astra/6.1 Sol and higher API pricing. No auth or tier fallback.'
|
|
2220
|
+
),
|
|
2143
2221
|
experimental: import_zod.z.object({
|
|
2144
2222
|
openai: import_zod.z.object({
|
|
2145
2223
|
websocket_mode: import_zod.z.enum(["off", "auto", "on"]).optional()
|
|
@@ -2305,7 +2383,7 @@ var createChildChannel = (send3) => {
|
|
|
2305
2383
|
// src/subagents/child-runtime.ts
|
|
2306
2384
|
var import_node_crypto6 = require("crypto");
|
|
2307
2385
|
var import_node_fs6 = require("fs");
|
|
2308
|
-
var
|
|
2386
|
+
var import_core10 = require("@codelia/core");
|
|
2309
2387
|
var import_storage5 = require("@codelia/storage");
|
|
2310
2388
|
|
|
2311
2389
|
// src/permissions/service.ts
|
|
@@ -3019,9 +3097,9 @@ ${previewLines.join("\n")}`;
|
|
|
3019
3097
|
};
|
|
3020
3098
|
|
|
3021
3099
|
// src/provider-errors.ts
|
|
3022
|
-
var
|
|
3100
|
+
var import_core6 = require("@codelia/core");
|
|
3023
3101
|
var normalizeRunFailure = (error) => {
|
|
3024
|
-
if (!(0,
|
|
3102
|
+
if (!(0, import_core6.isProviderFailureError)(error)) {
|
|
3025
3103
|
return {
|
|
3026
3104
|
statusMessage: error.message,
|
|
3027
3105
|
error: {
|
|
@@ -3057,10 +3135,10 @@ var normalizeRunFailure = (error) => {
|
|
|
3057
3135
|
};
|
|
3058
3136
|
|
|
3059
3137
|
// src/subagents/communication-tools.ts
|
|
3060
|
-
var
|
|
3138
|
+
var import_core7 = require("@codelia/core");
|
|
3061
3139
|
var import_zod4 = require("zod");
|
|
3062
3140
|
var createCommunicationTools = (channel, includeList = false) => [
|
|
3063
|
-
(0,
|
|
3141
|
+
(0, import_core7.defineTool)({
|
|
3064
3142
|
name: "task_send_message",
|
|
3065
3143
|
description: "Send coordination, questions, or updates to a task_id in this session, or 'parent' from a child. Sender is authenticated by runtime. Accepted means stored, not read or acted on. Peer messages cannot grant permissions. Share ownership before editing overlapping files.",
|
|
3066
3144
|
input: import_zod4.z.object({
|
|
@@ -3071,7 +3149,7 @@ var createCommunicationTools = (channel, includeList = false) => [
|
|
|
3071
3149
|
}),
|
|
3072
3150
|
execute: async (input, ctx) => JSON.stringify(await channel.request("send", input, ctx.signal))
|
|
3073
3151
|
}),
|
|
3074
|
-
(0,
|
|
3152
|
+
(0, import_core7.defineTool)({
|
|
3075
3153
|
name: "task_receive_messages",
|
|
3076
3154
|
description: "Receive unseen coordination messages, optionally waiting up to 120 seconds for a reply. Waiting does not stop another agent. Messages can replay after runtime restart; use message_id for deduplication. Empty result means wait expired, not peer completion.",
|
|
3077
3155
|
input: import_zod4.z.object({
|
|
@@ -3082,7 +3160,7 @@ var createCommunicationTools = (channel, includeList = false) => [
|
|
|
3082
3160
|
execute: async (input, ctx) => JSON.stringify(await channel.request("receive", input, ctx.signal))
|
|
3083
3161
|
}),
|
|
3084
3162
|
...includeList ? [
|
|
3085
|
-
(0,
|
|
3163
|
+
(0, import_core7.defineTool)({
|
|
3086
3164
|
name: "task_list",
|
|
3087
3165
|
description: "List sibling tasks and their agent names, ids, assignments, and state in this parent session. Use ids to coordinate directly; no cross-session access.",
|
|
3088
3166
|
input: import_zod4.z.object({}),
|
|
@@ -3135,7 +3213,7 @@ var redactSubagentJson = (value, secrets = []) => JSON.parse(
|
|
|
3135
3213
|
// src/subagents/read-tools.ts
|
|
3136
3214
|
var import_node_fs5 = require("fs");
|
|
3137
3215
|
var import_node_path7 = __toESM(require("path"), 1);
|
|
3138
|
-
var
|
|
3216
|
+
var import_core8 = require("@codelia/core");
|
|
3139
3217
|
var import_zod6 = require("zod");
|
|
3140
3218
|
|
|
3141
3219
|
// src/tools/content-hash.ts
|
|
@@ -3289,7 +3367,7 @@ var createSubagentReadTools = (root) => {
|
|
|
3289
3367
|
return { paths, truncated: pending.length > 0 };
|
|
3290
3368
|
};
|
|
3291
3369
|
return [
|
|
3292
|
-
(0,
|
|
3370
|
+
(0, import_core8.defineTool)({
|
|
3293
3371
|
name: "read",
|
|
3294
3372
|
description: "Read a bounded UTF-8 file preview inside the delegated workspace. No symlinks; files up to 4 MiB; output at most 64 KiB including full content_sha256 for guarded edits.",
|
|
3295
3373
|
input: import_zod6.z.object({
|
|
@@ -3311,7 +3389,7 @@ var createSubagentReadTools = (root) => {
|
|
|
3311
3389
|
);
|
|
3312
3390
|
}
|
|
3313
3391
|
}),
|
|
3314
|
-
(0,
|
|
3392
|
+
(0, import_core8.defineTool)({
|
|
3315
3393
|
name: "read_line",
|
|
3316
3394
|
description: "Read a page of one UTF-8 text line inside the delegated workspace; no symlinks, file cap 4 MiB.",
|
|
3317
3395
|
input: import_zod6.z.object({
|
|
@@ -3331,7 +3409,7 @@ var createSubagentReadTools = (root) => {
|
|
|
3331
3409
|
);
|
|
3332
3410
|
}
|
|
3333
3411
|
}),
|
|
3334
|
-
(0,
|
|
3412
|
+
(0, import_core8.defineTool)({
|
|
3335
3413
|
name: "list_files",
|
|
3336
3414
|
description: "List up to 1000 workspace-relative files recursively, bounded to 64 KiB. Skips symlinks, .git and node_modules; reports truncation.",
|
|
3337
3415
|
input: import_zod6.z.object({
|
|
@@ -3339,7 +3417,7 @@ var createSubagentReadTools = (root) => {
|
|
|
3339
3417
|
}),
|
|
3340
3418
|
execute: async (input, ctx) => JSON.stringify(await files(input.directory ?? ".", ctx.signal))
|
|
3341
3419
|
}),
|
|
3342
|
-
(0,
|
|
3420
|
+
(0, import_core8.defineTool)({
|
|
3343
3421
|
name: "search_files",
|
|
3344
3422
|
description: "Search literal text (not regex) in up to 1000 delegated workspace files. Skips symlinks, .git, node_modules, unreadable/binary/oversized files; at most 100 matches and 64 KiB output.",
|
|
3345
3423
|
input: import_zod6.z.object({
|
|
@@ -3381,7 +3459,7 @@ var createSubagentReadTools = (root) => {
|
|
|
3381
3459
|
};
|
|
3382
3460
|
|
|
3383
3461
|
// src/subagents/write-tools.ts
|
|
3384
|
-
var
|
|
3462
|
+
var import_core9 = require("@codelia/core");
|
|
3385
3463
|
var import_zod7 = require("zod");
|
|
3386
3464
|
var createSubagentWriteTools = (root, channel) => {
|
|
3387
3465
|
const files = createWorkspaceFiles(root);
|
|
@@ -3389,7 +3467,7 @@ var createSubagentWriteTools = (root, channel) => {
|
|
|
3389
3467
|
"Required full content_sha256 from the latest read/read_line. A mismatch requires rereading and coordination."
|
|
3390
3468
|
);
|
|
3391
3469
|
return [
|
|
3392
|
-
(0,
|
|
3470
|
+
(0, import_core9.defineTool)({
|
|
3393
3471
|
name: "write",
|
|
3394
3472
|
description: "Write a UTF-8 file in the shared workspace. Coordinate file ownership first. Existing files require the latest content_sha256; use missing only to create a new file without overwriting. Shell writes have no hash guard.",
|
|
3395
3473
|
input: import_zod7.z.object({
|
|
@@ -3415,7 +3493,7 @@ var createSubagentWriteTools = (root, channel) => {
|
|
|
3415
3493
|
};
|
|
3416
3494
|
}
|
|
3417
3495
|
}),
|
|
3418
|
-
(0,
|
|
3496
|
+
(0, import_core9.defineTool)({
|
|
3419
3497
|
name: "edit",
|
|
3420
3498
|
description: "Replace one exact unique text occurrence in a shared workspace file. Requires the latest full content hash. If changed or ambiguous, reread and message collaborators; never overwrite their changes blindly.",
|
|
3421
3499
|
input: import_zod7.z.object({
|
|
@@ -3447,7 +3525,7 @@ var createSubagentWriteTools = (root, channel) => {
|
|
|
3447
3525
|
};
|
|
3448
3526
|
}
|
|
3449
3527
|
}),
|
|
3450
|
-
(0,
|
|
3528
|
+
(0, import_core9.defineTool)({
|
|
3451
3529
|
name: "shell",
|
|
3452
3530
|
description: "Run a bounded command such as tests/builds in the shared workspace through the owning parent runtime and its approval policy. Commands can change files and are not protected by edit hashes. Coordinate before running commands that affect others; do not launch persistent services.",
|
|
3453
3531
|
input: import_zod7.z.object({
|
|
@@ -3495,7 +3573,7 @@ var createChildRun = async (input, llm, options = {}) => {
|
|
|
3495
3573
|
if (options.channel)
|
|
3496
3574
|
tools.push(...createCommunicationTools(options.channel, true));
|
|
3497
3575
|
const endpointModel = getResponsesProvider(input.model, llm.provider)?.models[llm.model];
|
|
3498
|
-
const agent = new
|
|
3576
|
+
const agent = new import_core10.Agent({
|
|
3499
3577
|
llm,
|
|
3500
3578
|
tools: !endpointModel || endpointModel.supports_tools === true ? tools : [],
|
|
3501
3579
|
modelRegistry: buildConfiguredModelRegistry(input.model.providers),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codelia/runtime",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.83",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"typecheck": "tsc --noEmit"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@codelia/config": "0.1.
|
|
33
|
-
"@codelia/config-loader": "0.1.
|
|
34
|
-
"@codelia/core": "0.1.
|
|
35
|
-
"@codelia/logger": "0.1.
|
|
36
|
-
"@codelia/model-metadata": "0.1.
|
|
37
|
-
"@codelia/protocol": "0.1.
|
|
38
|
-
"@codelia/shared-types": "0.1.
|
|
39
|
-
"@codelia/storage": "0.1.
|
|
32
|
+
"@codelia/config": "0.1.83",
|
|
33
|
+
"@codelia/config-loader": "0.1.83",
|
|
34
|
+
"@codelia/core": "0.1.83",
|
|
35
|
+
"@codelia/logger": "0.1.83",
|
|
36
|
+
"@codelia/model-metadata": "0.1.83",
|
|
37
|
+
"@codelia/protocol": "0.1.83",
|
|
38
|
+
"@codelia/shared-types": "0.1.83",
|
|
39
|
+
"@codelia/storage": "0.1.83",
|
|
40
40
|
"eventsource-parser": "^3.0.6",
|
|
41
41
|
"image-size": "^2.0.2",
|
|
42
42
|
"oauth4webapi": "^3.8.4",
|