nolo-cli 0.191.0-alpha.2 → 0.191.0
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/{_executeModel-WQ2D4ZRH.js → _executeModel-4HQQXPN4.js} +44 -46
- package/{action-BHWB4MOK.js → action-HNG2JKWK.js} +3 -3
- package/{addContentAction-BY375D35.js → addContentAction-FEN3H2EE.js} +6 -6
- package/{addDialogAgentAction-HOZYOCWC.js → addDialogAgentAction-DDA6S3WS.js} +5 -5
- package/{agentDeleteCommand-TTCVC74A.js → agentDeleteCommand-HZFWSKED.js} +57 -59
- package/{agentEmailCommands-PTG35KER.js → agentEmailCommands-HRYMVHC7.js} +59 -61
- package/{agentListCommands-MAG736RU.js → agentListCommands-HE2CCZEW.js} +33 -31
- package/{agentMachineCommands-ATOZK3R5.js → agentMachineCommands-ISSULCRR.js} +23 -23
- package/{agentProviderCommands-XSZUCNIR.js → agentProviderCommands-4EAYN3ZY.js} +3 -3
- package/{agentRecordCommands-KGRPIJN5.js → agentRecordCommands-WGAMWQLA.js} +57 -59
- package/{agentRunCommand-75VVJTNU.js → agentRunCommand-7EQ64FIB.js} +59 -61
- package/{agentRunControl-6HHESKDB.js → agentRunControl-EJPBPVLU.js} +5 -5
- package/{agentRuntimeLocal-NAAYNHCW.js → agentRuntimeLocal-ONSIOOQB.js} +20 -20
- package/{agentSlice-UJPIKKKP.js → agentSlice-CHWNVAS5.js} +6 -6
- package/{appDeleteCommands-VDHCDVBF.js → appDeleteCommands-RNAF4V5C.js} +25 -25
- package/{appDeployCommands-V6UTKVXR.js → appDeployCommands-LTIZ4QH7.js} +25 -25
- package/{appDeployStatusCommands-4UIFSEPC.js → appDeployStatusCommands-OJJR4LDK.js} +25 -25
- package/{appGetCommands-XKDXLC3C.js → appGetCommands-UJZF6U4V.js} +25 -25
- package/{appListCommands-BELRVX2Y.js → appListCommands-M5C5BIDY.js} +25 -25
- package/{authCommand-RV5MQDWN.js → authCommand-RMUBRAXF.js} +11 -11
- package/{builtinSkillRegistry-7MBUY5EY.js → builtinSkillRegistry-XDBPVNY6.js} +3 -5
- package/{chromeOpsCommands-C46BXHEE.js → chromeOpsCommands-P4PFQDT7.js} +19 -4
- package/{chunk-7UODCAWW.js → chunk-32GANJHJ.js} +1 -1
- package/{chunk-G6OOUQWJ.js → chunk-4KB6WQUL.js} +2 -0
- package/{chunk-LHOR5MC2.js → chunk-4KYV2TAI.js} +164 -323
- package/{chunk-5EFNSNAV.js → chunk-6CFXWUYE.js} +7 -7
- package/{chunk-6XIE5ZGI.js → chunk-6HIGYUBQ.js} +1 -1
- package/{chunk-LBXUNNDS.js → chunk-6K2AKJAD.js} +1 -1
- package/{chunk-U5ZHUOLT.js → chunk-6OBTQSJ2.js} +2 -2
- package/{chunk-XPL63OIC.js → chunk-7SUYSFPG.js} +140 -66
- package/{chunk-53RSTB7T.js → chunk-7TMVGMM3.js} +26 -31
- package/{chunk-ZBCBFOWC.js → chunk-A2ZMIRLN.js} +2 -2
- package/{chunk-MJWUBTK7.js → chunk-AOYR4XOA.js} +1 -1
- package/{chunk-IIX6VWLW.js → chunk-AV6IE6NM.js} +224 -38
- package/{chunk-WFUIXNKC.js → chunk-BMXR7CFX.js} +3 -3
- package/{chunk-JIFYXQRD.js → chunk-BTYQAODF.js} +26 -8
- package/{chunk-VHGD6FHV.js → chunk-BZKBX5BO.js} +28 -5
- package/{chunk-Q6RMLYSA.js → chunk-CMLBKYEI.js} +4 -2
- package/chunk-CMTTXP5Y.js +291 -0
- package/{chunk-OHRDHS4N.js → chunk-CVCRAO6Q.js} +9 -4
- package/{chunk-SM56M7N7.js → chunk-DBRXPVWY.js} +39 -5
- package/{chunk-2KBNF477.js → chunk-DSVR6ZAV.js} +30 -21
- package/{chunk-ADTJJVDJ.js → chunk-DXDG4XLD.js} +2838 -2255
- package/{chunk-R5LJWMZE.js → chunk-EMXVOJDB.js} +3 -3
- package/{chunk-KHCLMKZZ.js → chunk-EY7V7REW.js} +280 -6
- package/{chunk-KGP7UTNN.js → chunk-FNXSQ7A3.js} +15 -15
- package/{chunk-BTBT2566.js → chunk-FSEGCTZQ.js} +1 -1
- package/{chunk-CNMQATUF.js → chunk-GL7W7TTR.js} +2 -2
- package/{chunk-5KTQVMCX.js → chunk-GOO6G4PY.js} +85 -0
- package/{chunk-HTLIKE5U.js → chunk-GVMF62PR.js} +2 -2
- package/{chunk-UZHYRBUB.js → chunk-H4CFODT7.js} +137 -61
- package/{chunk-R4BMKAR5.js → chunk-HAB2UDLT.js} +1 -1
- package/{chunk-3NPXGNSK.js → chunk-HVXL4VOO.js} +348 -87
- package/{chunk-32ZKZET7.js → chunk-HWZT5DKX.js} +1 -1
- package/{chunk-GYVLAHA4.js → chunk-IY7DGZSY.js} +10 -4
- package/{chunk-FEDJHD5X.js → chunk-J5Z2SSIY.js} +6 -6
- package/{chunk-UVWBGWBO.js → chunk-JA6WCCDO.js} +3 -3
- package/{chunk-YE6A72XL.js → chunk-JI5MQU5B.js} +35 -31
- package/{chunk-TFSMPRAY.js → chunk-JLOCKFSI.js} +4 -4
- package/{chunk-UBLITLAZ.js → chunk-K2GL335R.js} +13 -3
- package/{chunk-DS5DAOIY.js → chunk-KYQXW7DL.js} +3 -3
- package/{chunk-5HAPEKNH.js → chunk-LFJRTOUV.js} +158 -43
- package/{chunk-N7E3LQ4A.js → chunk-LGW6A7GK.js} +1 -1
- package/{chunk-UNOILAZP.js → chunk-M6AGLVV4.js} +74 -2
- package/{chunk-BA2FHPS4.js → chunk-MOCY5LJI.js} +1 -1
- package/{chunk-INFHX73M.js → chunk-MR6L6U46.js} +55 -3
- package/{chunk-CTPFBJAF.js → chunk-N7IBYQEC.js} +182 -91
- package/{chunk-QU3TLYBR.js → chunk-NHI3JZP4.js} +32 -8
- package/{chunk-B2N5GZBU.js → chunk-OHYCQKPW.js} +6 -6
- package/{chunk-WAZ6BTSC.js → chunk-OOERQPG5.js} +1 -1
- package/{chunk-EHB4CKUI.js → chunk-OTKNEZE3.js} +9 -9
- package/chunk-OVBUUU7L.js +2648 -0
- package/{chunk-PVD7CRYV.js → chunk-P7SUBTGZ.js} +3 -3
- package/{chunk-RJ3EYB5G.js → chunk-PRIROPK4.js} +1 -1
- package/chunk-PRJ473FK.js +63 -0
- package/{chunk-K6TZSON4.js → chunk-PXERKNSJ.js} +1 -1
- package/{chunk-B6EZB6DW.js → chunk-QAYCF4CH.js} +2 -2
- package/{chunk-5DPVRMSY.js → chunk-RBJASUX4.js} +1 -1
- package/{chunk-NVOYW6H4.js → chunk-RDKNGJ5M.js} +12 -8
- package/{chunk-GTP6VNWH.js → chunk-RQ22OZD7.js} +3 -3
- package/{chunk-2E5M3JVS.js → chunk-RWGIVUH3.js} +11 -5
- package/{chunk-DFF6B7P7.js → chunk-RXUKDHS5.js} +1 -1
- package/{chunk-JLR5NWP2.js → chunk-RXX262QX.js} +17 -3
- package/{chunk-GC64WGMD.js → chunk-SM3NSZJV.js} +16 -5
- package/{chunk-A5BLRE3G.js → chunk-T3U2KQF4.js} +2 -2
- package/{chunk-HLAL63BZ.js → chunk-T43B7LB2.js} +1 -1
- package/{chunk-LCSAJ5TJ.js → chunk-UDKNC3CV.js} +3 -3
- package/{chunk-VE3FEZIT.js → chunk-WKGOIXFV.js} +5 -5
- package/{chunk-4YMD7B4Y.js → chunk-WPOKOKZA.js} +2 -2
- package/{chunk-YIRADHSY.js → chunk-WYKMOZTW.js} +1 -1
- package/{chunk-WRCZXJ4N.js → chunk-X4F26D5K.js} +2 -0
- package/{chunk-4MYCKDSI.js → chunk-XUOF4MA7.js} +2 -2
- package/{chunk-PD2YRFAI.js → chunk-Y5ZEHS3F.js} +1 -1
- package/{chunk-4CEAZRZ4.js → chunk-YU2DGFKG.js} +1 -1
- package/{chunk-TVGX5QIN.js → chunk-YUA6OAH5.js} +2 -2
- package/{chunk-53PBXLID.js → chunk-Z3MQYKRN.js} +17 -17
- package/{chunk-I3HWJODB.js → chunk-ZHOKF4MY.js} +31 -26
- package/{chunk-2XUOREKD.js → chunk-ZI5MFQ42.js} +5 -4
- package/{chunk-DYQXB46J.js → chunk-ZSCIGIJS.js} +1 -1
- package/{commandRegistry-4JHVRMW7.js → commandRegistry-O2657YC7.js} +86 -66
- package/{contentThunks-HQBAAXNW.js → contentThunks-THWDEBJU.js} +17 -17
- package/{cooldownCommands-4XKJFEBW.js → cooldownCommands-V4EEBD55.js} +3 -3
- package/{createAgentAutomationAction-KELPOVMP.js → createAgentAutomationAction-2ZZTFGWG.js} +17 -17
- package/{createDialogAction-Z3SASMTM.js → createDialogAction-FCRKPKIT.js} +20 -22
- package/{createPageAction-PNHOIG44.js → createPageAction-EC25JTKW.js} +18 -19
- package/{dbSlice-QAUXABCC.js → dbSlice-JK7LWBDO.js} +5 -5
- package/{deleteFile-R5OBP7OM.js → deleteFile-CE24BROO.js} +3 -3
- package/{dialogCommands-4BGV6DPD.js → dialogCommands-QH7BJ3DJ.js} +26 -26
- package/{dialogSlice-QHV6I3OQ.js → dialogSlice-Z5E7POEN.js} +16 -16
- package/{docCreateCommands-3CW75UF2.js → docCreateCommands-KP42NGIF.js} +26 -27
- package/{docDeleteCommands-NL4ZYMN5.js → docDeleteCommands-7YOCX5GC.js} +27 -28
- package/{docReadCommands-HXCNVDPQ.js → docReadCommands-EJEIAOKQ.js} +26 -27
- package/{docStore-LVMUSECS.js → docStore-6MHLMMWO.js} +6 -6
- package/{docUpdateCommands-RMVBAMDE.js → docUpdateCommands-ACJLISGA.js} +26 -27
- package/{getPricing-E2PLNWCR.js → getPricing-3PQY3TGI.js} +3 -3
- package/{handleSendMessageAction-7TONIXHY.js → handleSendMessageAction-MTOPN4D3.js} +86 -42
- package/index.js +7 -7
- package/{lib-4YTWAGY7.js → lib-5KKIBFIT.js} +439 -272
- package/{localRuntimeAdapter-HRAB7P5E.js → localRuntimeAdapter-4USQ3EP7.js} +55 -57
- package/{machineCommands-OTXFRTDA.js → machineCommands-CJMSDSOO.js} +56 -58
- package/{machineWsRunDispatch-KWVWOHHG.js → machineWsRunDispatch-YIPO76QH.js} +56 -58
- package/{memberThunks-ZAE52VIP.js → memberThunks-WT2KVRP4.js} +158 -55
- package/{models-UUNO6DOL.js → models-PJBE6JDV.js} +2 -2
- package/package.json +1 -1
- package/{providerPresetApply-JGNMO2KX.js → providerPresetApply-ISA35424.js} +5 -5
- package/{providerRegistry-33J3ZYFJ.js → providerRegistry-QIQCHVNP.js} +5 -5
- package/{read-D6NEWSGG.js → read-ILTT75DW.js} +3 -3
- package/{readDocTool-NTAXO7SX.js → readDocTool-374CFJYO.js} +1 -1
- package/{readlineWorkspace-CEX5TXGM.js → readlineWorkspace-RORGDWZN.js} +291 -99
- package/{removeDialogAgentAction-YEPO5AYI.js → removeDialogAgentAction-BDLO7UC2.js} +7 -7
- package/{runAgentClientLoop-DCV4BD2W.js → runAgentClientLoop-CDCBSUWW.js} +41 -43
- package/{runtimeDoctorCommands-NYBOTA6D.js → runtimeDoctorCommands-AM2V5YVH.js} +5 -5
- package/{secretCommands-N6CMCJDZ.js → secretCommands-G5XYCXZB.js} +308 -1
- package/{setDialogExtraReferencesAction-EH5GWDAJ.js → setDialogExtraReferencesAction-GBIT7WAG.js} +6 -6
- package/{setPrimaryDialogAgentAction-PNWRK6IY.js → setPrimaryDialogAgentAction-PGBTR247.js} +7 -7
- package/{settingThunks-7VCWB6P7.js → settingThunks-XQJZVA4D.js} +38 -7
- package/{skillDiscovery-F3TMVQOJ.js → skillDiscovery-DO5372J5.js} +2 -3
- package/{spaceCommands-ZUI4CTSO.js → spaceCommands-BTSANKDH.js} +23 -23
- package/{streamAgentChatTurn-NKFKMFQ2.js → streamAgentChatTurn-VUF3EUMS.js} +66 -59
- package/{switchDialogAgentAction-23BFWJMV.js → switchDialogAgentAction-O7WTPLKG.js} +5 -5
- package/{tools-626VXEY7.js → tools-GAAYAIEW.js} +35 -37
- package/{tuiSummaryLlmCaller-FSOADMXK.js → tuiSummaryLlmCaller-MKOLOSH3.js} +11 -11
- package/{updateCommands-KE6LP3QX.js → updateCommands-W7TXEV7N.js} +3 -3
- package/{updateDialogTitleAction-RNNQAMXG.js → updateDialogTitleAction-LE2DBQDS.js} +17 -17
- package/{windowsSelfUpdate-26TSFXEZ.js → windowsSelfUpdate-575VQ6QO.js} +2 -2
- package/chunk-7KWPNGVJ.js +0 -150
- package/chunk-AETZ7AD6.js +0 -274
- package/chunk-EUGTFFO6.js +0 -42
- package/chunk-VYNMQ6HW.js +0 -138
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
} from "./chunk-UEILX4EV.js";
|
|
4
4
|
import {
|
|
5
5
|
compareAgentSelection
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-K2GL335R.js";
|
|
7
7
|
import {
|
|
8
8
|
DEFAULT_PROVIDER_RETRY_MS,
|
|
9
9
|
isAgentUnavailableNow,
|
|
10
10
|
resolveAgentAvailability
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-RXX262QX.js";
|
|
12
12
|
import {
|
|
13
13
|
isOAuthApiKeyRef
|
|
14
14
|
} from "./chunk-UKZX3NHN.js";
|
|
@@ -21,10 +21,10 @@ import {
|
|
|
21
21
|
isAntigravityOAuthAgent,
|
|
22
22
|
isSubscriptionEndpoint,
|
|
23
23
|
isSubscriptionOAuthCredential
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-NHI3JZP4.js";
|
|
25
25
|
import {
|
|
26
26
|
getModelAbility
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-T43B7LB2.js";
|
|
28
28
|
|
|
29
29
|
// packages/ai/agent/agentBilling.ts
|
|
30
30
|
function resolveBillingSource(candidate) {
|
|
@@ -403,6 +403,7 @@ function toSafeAgentSummary(record, options) {
|
|
|
403
403
|
const isPublic = record?.isPublic === true || record?.isPublicFlag === true || record?.publicRecordExists === true;
|
|
404
404
|
const updatedAt = safeTimestamp(record?.updatedAt ?? record?.createdAt ?? record?.created);
|
|
405
405
|
const nextAvailableAt = typeof record?.nextAvailableAt === "number" && Number.isFinite(record.nextAvailableAt) ? record.nextAvailableAt : void 0;
|
|
406
|
+
const quotaExhaustion = record?.quotaExhaustion && typeof record.quotaExhaustion.observedAt === "number" && Number.isFinite(record.quotaExhaustion.observedAt) ? { observedAt: record.quotaExhaustion.observedAt } : void 0;
|
|
406
407
|
const rawQuota = record?.quota;
|
|
407
408
|
const quota = rawQuota && typeof rawQuota === "object" && Array.isArray(rawQuota.windows) && typeof rawQuota.observedAt === "number" && Number.isFinite(rawQuota.observedAt) ? rawQuota : void 0;
|
|
408
409
|
const currentUserId = options?.userId;
|
|
@@ -445,7 +446,7 @@ function toSafeAgentSummary(record, options) {
|
|
|
445
446
|
const credentialKind = record?.credentialKind ?? credInfo?.credentialKind;
|
|
446
447
|
const { tier } = resolveDefaultAgentTier(record?.model);
|
|
447
448
|
const availability = resolveAgentAvailability(
|
|
448
|
-
{ nextAvailableAt, quota },
|
|
449
|
+
{ nextAvailableAt, quota, quotaExhaustion },
|
|
449
450
|
options?.now ?? Date.now()
|
|
450
451
|
);
|
|
451
452
|
return {
|
|
@@ -475,6 +476,7 @@ function toSafeAgentSummary(record, options) {
|
|
|
475
476
|
availabilityStatus: availability.status,
|
|
476
477
|
availabilityReason: availability.reason,
|
|
477
478
|
...quota !== void 0 ? { quota } : {},
|
|
479
|
+
...quotaExhaustion ? { quotaExhaustion } : {},
|
|
478
480
|
...credentialGroup !== void 0 ? { credentialGroup } : {},
|
|
479
481
|
...credentialKind !== void 0 ? { credentialKind } : {},
|
|
480
482
|
// 「未知 ≠ 独立」:无 credentialGroup 时显式 credentialed:false,调用方
|
|
@@ -487,33 +489,37 @@ function sortSafeAgentSummaries(agents) {
|
|
|
487
489
|
return [...agents].sort(compareAgentSelection);
|
|
488
490
|
}
|
|
489
491
|
var COMPACT_AGENT_SUMMARY_FIELDS = [
|
|
492
|
+
// —— 派发决策必需(短字段,必须排最前)——
|
|
493
|
+
// agentKey 是唯一不可推导、必须逐字复制的字段;截断时它首先被保住。
|
|
490
494
|
"agentKey",
|
|
491
495
|
"name",
|
|
492
496
|
"model",
|
|
493
497
|
// 能力档弱先验(unknown = 模型名没给出信号,不推断强弱)。
|
|
494
498
|
"tier",
|
|
495
|
-
"provider",
|
|
496
|
-
"apiSource",
|
|
497
499
|
"billingSource",
|
|
500
|
+
"availabilityStatus",
|
|
501
|
+
"credentialGroup",
|
|
498
502
|
"isFavorite",
|
|
499
503
|
"isOAuth",
|
|
500
504
|
"isOwned",
|
|
501
505
|
"isPublic",
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
"
|
|
506
|
+
// —— 次要身份/来源字段(仍很短)——
|
|
507
|
+
"provider",
|
|
508
|
+
"apiSource",
|
|
509
|
+
"credentialKind",
|
|
510
|
+
"credentialed",
|
|
506
511
|
// 仅限流中的 agent 才会带(可用 agent 上不存在)。对"现在能不能选它"是
|
|
507
512
|
// 决策信息(CLI --show-unavailable 场景);默认列表已把这类 agent 过滤掉,
|
|
508
513
|
// 所以通常根本不占字节。
|
|
509
514
|
"nextAvailableAt",
|
|
510
|
-
// 额度快照:只有上游真上报过窗口的 agent 才带(通常是小对象)。
|
|
511
|
-
"quota",
|
|
512
|
-
"availabilityStatus",
|
|
513
515
|
"availabilityReason",
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
516
|
+
// —— 体积大的说明性字段(排在每条记录最后,截断时先牺牲它们)——
|
|
517
|
+
// Phase 2A economics 快照(period/multipliers/changesAt 等小对象)。
|
|
518
|
+
// 只对 DeepSeek API / BigModel GLM Coding Plan 存在;不含完整 policy/windows。
|
|
519
|
+
"economics",
|
|
520
|
+
"tools",
|
|
521
|
+
// 额度快照(windows 数组,体积最大):只有上游真上报过窗口的 agent 才带。
|
|
522
|
+
"quota"
|
|
517
523
|
];
|
|
518
524
|
function omitNullishAgentSummaryFields(summary) {
|
|
519
525
|
const result = {};
|
|
@@ -683,25 +689,15 @@ function buildAgentDiscoveryResult(options) {
|
|
|
683
689
|
return {
|
|
684
690
|
total: projectedAgents.length,
|
|
685
691
|
unavailableCount,
|
|
686
|
-
|
|
692
|
+
agents: projectedAgents,
|
|
687
693
|
credentialGroups,
|
|
688
|
-
|
|
694
|
+
unavailableAgents
|
|
689
695
|
};
|
|
690
696
|
}
|
|
691
697
|
function toDiscoverySafeAgentSummary(record, options) {
|
|
692
698
|
const mergedOptions = record?.publicRecordExists === true ? { ...options, publicRecordExists: true } : options;
|
|
693
699
|
return toSafeAgentSummary(record, mergedOptions);
|
|
694
700
|
}
|
|
695
|
-
function assembleAgentDiscoveryResult(options) {
|
|
696
|
-
const { records, summaryOptions, ...discoveryOptions } = options;
|
|
697
|
-
const agents = records.map(
|
|
698
|
-
(record) => toDiscoverySafeAgentSummary(
|
|
699
|
-
record,
|
|
700
|
-
typeof summaryOptions === "function" ? summaryOptions(record) : summaryOptions
|
|
701
|
-
)
|
|
702
|
-
);
|
|
703
|
-
return buildAgentDiscoveryResult({ ...discoveryOptions, agents });
|
|
704
|
-
}
|
|
705
701
|
|
|
706
702
|
export {
|
|
707
703
|
resolveBillingSource,
|
|
@@ -712,6 +708,5 @@ export {
|
|
|
712
708
|
resolveDiscoveryScope,
|
|
713
709
|
matchesAgentQuery,
|
|
714
710
|
buildAgentDiscoveryResult,
|
|
715
|
-
toDiscoverySafeAgentSummary
|
|
716
|
-
assembleAgentDiscoveryResult
|
|
711
|
+
toDiscoverySafeAgentSummary
|
|
717
712
|
};
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-4JH2UMJR.js";
|
|
7
7
|
import {
|
|
8
8
|
getModelConfig
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-SM3NSZJV.js";
|
|
10
10
|
import {
|
|
11
11
|
asOptionalPositiveFiniteNumber
|
|
12
12
|
} from "./chunk-U6VC4MU4.js";
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
isPlatformHostedImageModel,
|
|
18
18
|
isPlatformManagedProvider,
|
|
19
19
|
resolvePlatformEffectiveModel
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-GOO6G4PY.js";
|
|
21
21
|
|
|
22
22
|
// packages/ai/llm/getPricing.ts
|
|
23
23
|
var MAX_OUTPUT_TOKENS = 8192;
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-HNUWUO75.js";
|
|
4
4
|
import {
|
|
5
5
|
resolveToolImagePolicy
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-P7SUBTGZ.js";
|
|
7
7
|
import {
|
|
8
8
|
projectOpenAiToolImages
|
|
9
9
|
} from "./chunk-E2BESSAW.js";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
getAntigravityUserAgent,
|
|
12
12
|
readAntigravityProjectId,
|
|
13
13
|
resolveAntigravityCloudCodeBaseUrl
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-NHI3JZP4.js";
|
|
15
15
|
import {
|
|
16
16
|
asOptionalTrimmedString
|
|
17
17
|
} from "./chunk-G3SUCT4W.js";
|
|
@@ -408,7 +408,8 @@ function sanitizeGeminiSchemaNodeInner(src, out, seen) {
|
|
|
408
408
|
if (typeof firstNonNull === "string") out.type = firstNonNull;
|
|
409
409
|
out.nullable = true;
|
|
410
410
|
} else if (typeof src.type === "string") {
|
|
411
|
-
out.type = src.type;
|
|
411
|
+
out.type = src.type === "null" ? "string" : src.type;
|
|
412
|
+
if (src.type === "null") out.nullable = true;
|
|
412
413
|
}
|
|
413
414
|
if (typeof src.description === "string") out.description = src.description;
|
|
414
415
|
if (typeof src.minimum === "number") out.minimum = src.minimum;
|
|
@@ -420,54 +421,229 @@ function sanitizeGeminiSchemaNodeInner(src, out, seen) {
|
|
|
420
421
|
enumMetaByNode.set(out, { values: enumValues, baseDescription });
|
|
421
422
|
applyGeminiEnum(out, geminiEnumFields(enumValues, baseDescription));
|
|
422
423
|
}
|
|
424
|
+
if (src.type === "null") {
|
|
425
|
+
out.description = [out.description, "null only"].filter(Boolean).join("\n");
|
|
426
|
+
}
|
|
423
427
|
const variantBranches = [
|
|
424
428
|
...Array.isArray(src.oneOf) ? src.oneOf : [],
|
|
425
429
|
...Array.isArray(src.anyOf) ? src.anyOf : []
|
|
426
430
|
];
|
|
427
431
|
if (variantBranches.length > 0) {
|
|
428
|
-
const
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
432
|
+
const rawBranches = variantBranches.map(
|
|
433
|
+
(branch) => branch && typeof branch === "object" && !Array.isArray(branch) ? branch : {}
|
|
434
|
+
);
|
|
435
|
+
const allSanitized = variantBranches.map(
|
|
436
|
+
(branch) => sanitizeGeminiSchemaNode(branch, seen)
|
|
437
|
+
);
|
|
438
|
+
if (rawBranches.some(
|
|
439
|
+
(branch, index) => branch.type === "null" || allSanitized[index]?.nullable === true || rawEnumValues(branch)?.includes(null)
|
|
440
|
+
)) out.nullable = true;
|
|
441
|
+
const nonNullIndices = rawBranches.flatMap(
|
|
442
|
+
(branch, index) => branch.type === "null" ? [] : [index]
|
|
443
|
+
);
|
|
444
|
+
const branches = nonNullIndices.map((index) => rawBranches[index]);
|
|
445
|
+
const sanitizedBranches = nonNullIndices.map((index) => allSanitized[index]);
|
|
446
|
+
const inferType = (branch) => {
|
|
447
|
+
if (typeof branch.type === "string") return branch.type;
|
|
448
|
+
const values = rawEnumValues(branch)?.filter((value) => value !== null);
|
|
449
|
+
if (!values?.length) return void 0;
|
|
450
|
+
if (values.every((value) => typeof value === "number")) {
|
|
451
|
+
return values.every((value) => Number.isInteger(value)) ? "integer" : "number";
|
|
452
|
+
}
|
|
453
|
+
if (values.every((value) => typeof value === "boolean")) return "boolean";
|
|
454
|
+
if (values.every((value) => typeof value === "string")) return "string";
|
|
455
|
+
return void 0;
|
|
456
|
+
};
|
|
457
|
+
const candidateTypes = (branch, active = /* @__PURE__ */ new Set()) => {
|
|
458
|
+
if (active.has(branch)) return [];
|
|
459
|
+
active.add(branch);
|
|
460
|
+
const nested = [branch.oneOf, branch.anyOf].flatMap((value) => Array.isArray(value) ? value : []);
|
|
461
|
+
const type = inferType(branch);
|
|
462
|
+
const types = [
|
|
463
|
+
...type && type !== "null" ? [type] : [],
|
|
464
|
+
...nested.flatMap((value) => value && typeof value === "object" ? candidateTypes(value, active) : [])
|
|
465
|
+
];
|
|
466
|
+
active.delete(branch);
|
|
467
|
+
return types;
|
|
468
|
+
};
|
|
469
|
+
const unconstrainedBranch = branches.some(
|
|
470
|
+
(branch) => branch.type === void 0 && rawEnumValues(branch) === void 0 && branch.properties === void 0 && branch.oneOf === void 0 && branch.anyOf === void 0 && branch.allOf === void 0 && branch.$ref === void 0
|
|
471
|
+
);
|
|
472
|
+
if (sanitizedBranches.every(
|
|
473
|
+
(branch) => branch.properties === void 0 && branch.required === void 0
|
|
474
|
+
)) {
|
|
475
|
+
const types = [...new Set(branches.flatMap((branch) => candidateTypes(branch)))];
|
|
476
|
+
const first = sanitizedBranches[0] ?? {};
|
|
477
|
+
const baseDescription = typeof out.description === "string" ? out.description : typeof branches[0]?.description === "string" ? branches[0].description : void 0;
|
|
478
|
+
const scalar = {
|
|
479
|
+
...first,
|
|
480
|
+
type: types.length > 0 && types.every((type) => type === "integer" || type === "number") ? types.includes("number") ? "number" : "integer" : types[0] ?? "string",
|
|
481
|
+
...out
|
|
482
|
+
};
|
|
483
|
+
delete scalar.description;
|
|
484
|
+
if (baseDescription !== void 0) scalar.description = baseDescription;
|
|
485
|
+
if (!enumValues) {
|
|
486
|
+
delete scalar.enum;
|
|
487
|
+
const values = branches.flatMap(
|
|
488
|
+
(branch, index) => rawEnumValues(branch) ?? enumMetaOf(sanitizedBranches[index])?.values ?? []
|
|
489
|
+
);
|
|
490
|
+
const allEnum = branches.length > 0 && branches.every(
|
|
491
|
+
(branch, index) => rawEnumValues(branch) !== void 0 || enumMetaOf(sanitizedBranches[index]) !== void 0
|
|
492
|
+
);
|
|
493
|
+
if (values.length > 0) {
|
|
494
|
+
if (allEnum) {
|
|
495
|
+
if (typeof out.type !== "string") {
|
|
496
|
+
scalar.type = inferType({ enum: values }) ?? "string";
|
|
497
|
+
}
|
|
498
|
+
applyGeminiEnum(scalar, geminiEnumFields(values, baseDescription));
|
|
499
|
+
enumMetaByNode.set(out, { values, baseDescription });
|
|
500
|
+
} else {
|
|
501
|
+
scalar.description = [
|
|
502
|
+
baseDescription,
|
|
503
|
+
`Candidates: ${[...new Set(values.map(geminiEnumLiteral))].join(", ")}`
|
|
504
|
+
].filter(Boolean).join("\n");
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
const conflictingRanges = [];
|
|
509
|
+
for (const key of ["minimum", "maximum", "minLength", "maxLength"]) {
|
|
510
|
+
if (typeof src[key] === "number") {
|
|
511
|
+
scalar[key] = src[key];
|
|
512
|
+
continue;
|
|
513
|
+
}
|
|
514
|
+
const values = branches.map((branch) => branch[key]).filter((value) => typeof value === "number");
|
|
515
|
+
if (values.length !== branches.length || new Set(values).size > 1) {
|
|
516
|
+
delete scalar[key];
|
|
517
|
+
if (values.length > 0 && conflictingRanges.length === 0) {
|
|
518
|
+
conflictingRanges.push(...branches.map((branch) => Object.fromEntries(
|
|
519
|
+
["minimum", "maximum", "minLength", "maxLength"].flatMap(
|
|
520
|
+
(name) => typeof branch[name] === "number" ? [[name, branch[name]]] : []
|
|
521
|
+
)
|
|
522
|
+
)));
|
|
523
|
+
}
|
|
524
|
+
} else if (values.length > 0) scalar[key] = values[0];
|
|
525
|
+
}
|
|
526
|
+
if (conflictingRanges.length > 0) {
|
|
527
|
+
scalar.description = [
|
|
528
|
+
scalar.description,
|
|
529
|
+
`Original ranges: ${conflictingRanges.map((range) => JSON.stringify(range)).join(" | ")}`
|
|
530
|
+
].filter(Boolean).join("\n");
|
|
531
|
+
}
|
|
532
|
+
const stableValue = (value) => {
|
|
533
|
+
if (Array.isArray(value)) return value.map(stableValue);
|
|
534
|
+
if (value && typeof value === "object") return Object.fromEntries(
|
|
535
|
+
Object.keys(value).sort().map((key) => [key, stableValue(value[key])])
|
|
536
|
+
);
|
|
537
|
+
return value;
|
|
538
|
+
};
|
|
539
|
+
if (src.items === void 0 && branches.some((branch) => branch.items !== void 0)) {
|
|
540
|
+
const firstItems = branches[0]?.items;
|
|
541
|
+
const sameItems = firstItems !== void 0 && branches.every(
|
|
542
|
+
(branch) => branch.items !== void 0 && JSON.stringify(stableValue(branch.items)) === JSON.stringify(stableValue(firstItems))
|
|
543
|
+
);
|
|
544
|
+
if (!sameItems) {
|
|
545
|
+
const itemTypes = branches.map((branch) => {
|
|
546
|
+
const items = branch.items;
|
|
547
|
+
return items && typeof items === "object" && !Array.isArray(items) ? items.type : void 0;
|
|
548
|
+
});
|
|
549
|
+
const commonType = itemTypes[0];
|
|
550
|
+
const fallbackType = typeof commonType === "string" && ["string", "integer", "number", "boolean", "object", "array"].includes(commonType) && itemTypes.every((type) => type === commonType) ? commonType : "string";
|
|
551
|
+
scalar.items = fallbackType === "array" ? { type: "array", items: { type: "string" } } : { type: fallbackType };
|
|
552
|
+
scalar.description = [
|
|
553
|
+
scalar.description,
|
|
554
|
+
`Original items: ${branches.map((branch) => branch.items === void 0 ? "unconstrained" : geminiEnumLiteral(branch.items)).join(" | ")}`
|
|
555
|
+
].filter(Boolean).join("\n");
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
const originalConstraints = branches.map((branch) => Object.fromEntries(
|
|
559
|
+
["pattern", "format"].flatMap((key) => branch[key] !== void 0 ? [[key, branch[key]]] : [])
|
|
560
|
+
));
|
|
561
|
+
if (originalConstraints.some((constraints) => Object.keys(constraints).length > 0)) {
|
|
562
|
+
scalar.description = [
|
|
563
|
+
scalar.description,
|
|
564
|
+
`Original constraints: ${originalConstraints.map((value) => JSON.stringify(value)).join(" | ")}`
|
|
565
|
+
].filter(Boolean).join("\n");
|
|
566
|
+
}
|
|
567
|
+
for (let index = 0; index < branches.length; index++) {
|
|
568
|
+
if ((branches[index].oneOf || branches[index].anyOf) && sanitizedBranches[index].description) {
|
|
569
|
+
scalar.description = [
|
|
570
|
+
scalar.description,
|
|
571
|
+
`Branch ${index + 1}: ${sanitizedBranches[index].description}`
|
|
572
|
+
].filter(Boolean).join("\n");
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
if (types.length > 1) {
|
|
576
|
+
scalar.description = [scalar.description, `One of: ${types.join(" | ")}`].filter(Boolean).join("\n");
|
|
577
|
+
}
|
|
578
|
+
if (branches.length === 0) {
|
|
579
|
+
scalar.description = [scalar.description, "null only"].filter(Boolean).join("\n");
|
|
580
|
+
} else if (branches.some((branch) => inferType(branch) === void 0 && rawEnumValues(branch)?.some((value) => value !== null))) {
|
|
581
|
+
scalar.description = [scalar.description, "Mixed enum types; using a fallback type"].filter(Boolean).join("\n");
|
|
582
|
+
}
|
|
583
|
+
Object.assign(out, scalar);
|
|
584
|
+
} else {
|
|
585
|
+
const mergedProperties = {};
|
|
586
|
+
let requiredIntersection;
|
|
587
|
+
for (const sanitized of sanitizedBranches) {
|
|
588
|
+
const branchProperties = sanitized.properties ?? {};
|
|
589
|
+
for (const [key, value] of Object.entries(branchProperties)) {
|
|
590
|
+
const previous = mergedProperties[key];
|
|
591
|
+
const prevMeta = enumMetaOf(previous);
|
|
592
|
+
const nextMeta = enumMetaOf(value);
|
|
593
|
+
if (prevMeta && nextMeta) {
|
|
594
|
+
const values = [...prevMeta.values, ...nextMeta.values];
|
|
595
|
+
const baseDescription = nextMeta.baseDescription ?? prevMeta.baseDescription;
|
|
596
|
+
const node = {
|
|
597
|
+
...value
|
|
598
|
+
};
|
|
599
|
+
delete node.enum;
|
|
600
|
+
delete node.description;
|
|
601
|
+
applyGeminiEnum(node, geminiEnumFields(values, baseDescription));
|
|
602
|
+
enumMetaByNode.set(node, { values, baseDescription });
|
|
603
|
+
mergedProperties[key] = node;
|
|
604
|
+
} else {
|
|
605
|
+
mergedProperties[key] = value;
|
|
606
|
+
}
|
|
450
607
|
}
|
|
608
|
+
const branchRequired = Array.isArray(sanitized.required) ? sanitized.required : [];
|
|
609
|
+
requiredIntersection = requiredIntersection === void 0 ? [...branchRequired] : requiredIntersection.filter((r) => branchRequired.includes(r));
|
|
610
|
+
}
|
|
611
|
+
out.properties = {
|
|
612
|
+
...out.properties ?? {},
|
|
613
|
+
...mergedProperties
|
|
614
|
+
};
|
|
615
|
+
if (requiredIntersection !== void 0 && requiredIntersection.length > 0) {
|
|
616
|
+
out.required = requiredIntersection;
|
|
617
|
+
}
|
|
618
|
+
if (typeof out.type !== "string") out.type = "object";
|
|
619
|
+
if (sanitizedBranches.some((branch) => branch.properties === void 0)) {
|
|
620
|
+
const types = [...new Set(branches.flatMap(
|
|
621
|
+
(branch) => branch.properties !== void 0 ? ["object"] : candidateTypes(branch)
|
|
622
|
+
))].sort();
|
|
623
|
+
if (rawBranches.some((branch) => branch.type === "null")) types.push("null");
|
|
624
|
+
out.description = [
|
|
625
|
+
out.description,
|
|
626
|
+
`One of: ${types.join(" | ")}. This declaration represents only one branch of the union; other candidates are not structurally represented.`
|
|
627
|
+
].filter(Boolean).join("\n");
|
|
451
628
|
}
|
|
452
|
-
const branchRequired = Array.isArray(sanitized.required) ? sanitized.required : [];
|
|
453
|
-
requiredIntersection = requiredIntersection === void 0 ? [...branchRequired] : requiredIntersection.filter((r) => branchRequired.includes(r));
|
|
454
629
|
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
out.
|
|
630
|
+
if (unconstrainedBranch) {
|
|
631
|
+
out.description = [
|
|
632
|
+
out.description,
|
|
633
|
+
"An unconstrained branch accepts any JSON value (any value, including null). This declaration uses a fallback type and cannot express the full union."
|
|
634
|
+
].filter(Boolean).join("\n");
|
|
635
|
+
if (src.type === void 0) out.nullable = true;
|
|
461
636
|
}
|
|
462
|
-
if (typeof out.type !== "string") out.type = "object";
|
|
463
637
|
}
|
|
464
638
|
if (Array.isArray(src.allOf)) {
|
|
465
639
|
for (const branch of src.allOf) {
|
|
466
640
|
const sanitized = sanitizeGeminiSchemaNode(branch, seen);
|
|
467
|
-
out.properties
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
641
|
+
if (out.type === void 0 || out.type === "object" || out.properties || sanitized.properties) {
|
|
642
|
+
out.properties = {
|
|
643
|
+
...out.properties ?? {},
|
|
644
|
+
...sanitized.properties ?? {}
|
|
645
|
+
};
|
|
646
|
+
}
|
|
471
647
|
if (Array.isArray(sanitized.required)) {
|
|
472
648
|
out.required = [
|
|
473
649
|
.../* @__PURE__ */ new Set([
|
|
@@ -501,6 +677,16 @@ function sanitizeGeminiSchemaNodeInner(src, out, seen) {
|
|
|
501
677
|
if (typeof out.type !== "string") out.type = "array";
|
|
502
678
|
}
|
|
503
679
|
if (typeof out.type !== "string") out.type = "object";
|
|
680
|
+
if (out.type === "array" && !out.items) out.items = { type: "string" };
|
|
681
|
+
if (out.type !== "object" && !out.properties) {
|
|
682
|
+
const dropped = Object.fromEntries(["minLength", "maxLength", "pattern", "format"].flatMap(
|
|
683
|
+
(key) => src[key] !== void 0 && out[key] === void 0 ? [[key, src[key]]] : []
|
|
684
|
+
));
|
|
685
|
+
if (Object.keys(dropped).length > 0) out.description = [
|
|
686
|
+
out.description,
|
|
687
|
+
`Original constraints: ${JSON.stringify(dropped)}`
|
|
688
|
+
].filter(Boolean).join("\n");
|
|
689
|
+
}
|
|
504
690
|
return out;
|
|
505
691
|
}
|
|
506
692
|
function convertOpenAiToolsToGemini(tools) {
|
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
ANTIGRAVITY_CLOUD_CODE_BASE_URL,
|
|
6
6
|
isAntigravityCloudCodeBaseUrl,
|
|
7
7
|
isAntigravityOAuthAgent
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-NHI3JZP4.js";
|
|
9
9
|
import {
|
|
10
10
|
isOpenAiResponsesModel,
|
|
11
11
|
resolvePlatformChatCompletionsEndpoint,
|
|
12
12
|
resolvePlatformResponsesEndpoint
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-YUA6OAH5.js";
|
|
14
14
|
import {
|
|
15
15
|
findModelConfig
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-SM3NSZJV.js";
|
|
17
17
|
import {
|
|
18
18
|
asOptionalTrimmedString
|
|
19
19
|
} from "./chunk-G3SUCT4W.js";
|
|
@@ -3,13 +3,14 @@ import {
|
|
|
3
3
|
} from "./chunk-PSCNXBYA.js";
|
|
4
4
|
import {
|
|
5
5
|
MODEL_LOOKUP_MAP
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SM3NSZJV.js";
|
|
7
7
|
import {
|
|
8
8
|
ALL_MODELS
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-T43B7LB2.js";
|
|
10
10
|
import {
|
|
11
|
-
isPlatformManagedProvider
|
|
12
|
-
|
|
11
|
+
isPlatformManagedProvider,
|
|
12
|
+
resolvePlatformEffectiveModel
|
|
13
|
+
} from "./chunk-GOO6G4PY.js";
|
|
13
14
|
|
|
14
15
|
// packages/core/chat/messageContentSerialize.ts
|
|
15
16
|
var serializeMessageContent = (content, imagePlaceholder = "[\u56FE\u7247]") => {
|
|
@@ -771,8 +772,12 @@ var QWEN_3_6_CONTEXT_WINDOW = 262144;
|
|
|
771
772
|
var GLM_5_2_CONTEXT_WINDOW = 1e6;
|
|
772
773
|
var GPT_6_1_SOL_CONTEXT_WINDOW = 5e5;
|
|
773
774
|
var GPT_6_1_SOL_PATTERN = /(^|\/)gpt-6\.1[- ]sol(?![a-z])/;
|
|
775
|
+
var GPT_6_1_PINNED_PATTERN = /(^|\/)gpt-6\.1[- ](sol|terra)(?![a-z0-9])/;
|
|
776
|
+
var GPT_272K_PINNED_PATTERN = /(^|\/)(gpt-6[- ](astra|luna|sol)|gpt-5\.6[- ](sol|terra|luna))(?![a-z0-9])/;
|
|
777
|
+
var GPT_272K_CONTEXT_WINDOW = 272e3;
|
|
774
778
|
function channelPinnedContextWindow(normalizedName) {
|
|
775
|
-
if (
|
|
779
|
+
if (GPT_6_1_PINNED_PATTERN.test(normalizedName)) return GPT_6_1_SOL_CONTEXT_WINDOW;
|
|
780
|
+
if (GPT_272K_PINNED_PATTERN.test(normalizedName)) return GPT_272K_CONTEXT_WINDOW;
|
|
776
781
|
return void 0;
|
|
777
782
|
}
|
|
778
783
|
var ANTIGRAVITY_EFFORT_SUFFIXES = [
|
|
@@ -844,6 +849,8 @@ function fuzzyContextWindow(normalizedName) {
|
|
|
844
849
|
if (normalizedName.includes("glm-5.2") || normalizedName.includes("glm5.2")) return GLM_5_2_CONTEXT_WINDOW;
|
|
845
850
|
if (normalizedName.includes("deepseek")) return 1e6;
|
|
846
851
|
if (GPT_6_1_SOL_PATTERN.test(normalizedName)) return GPT_6_1_SOL_CONTEXT_WINDOW;
|
|
852
|
+
const channelPinned = channelPinnedContextWindow(normalizedName);
|
|
853
|
+
if (channelPinned !== void 0) return channelPinned;
|
|
847
854
|
if (normalizedName.includes("gpt-5") || normalizedName.includes("gpt-4.1")) return 1047576;
|
|
848
855
|
if (normalizedName.startsWith("cursor-grok-4.5")) return 1e6;
|
|
849
856
|
if (normalizedName.includes("claude-4.6")) return 1e6;
|
|
@@ -916,15 +923,26 @@ var findModelContextWindow = (modelName, provider) => {
|
|
|
916
923
|
for (const candidate of candidates) {
|
|
917
924
|
const model = map.get(candidate);
|
|
918
925
|
if (model?.contextWindow) {
|
|
919
|
-
if (!onPlatformChannel &&
|
|
926
|
+
if (!onPlatformChannel && (channelPinnedContextWindow(model.name.toLowerCase()) !== void 0 || channelPinnedContextWindow(candidate.toLowerCase()) !== void 0)) {
|
|
920
927
|
continue;
|
|
921
928
|
}
|
|
922
929
|
return typeof model.contextWindow === "number" ? model.contextWindow : void 0;
|
|
923
930
|
}
|
|
924
931
|
}
|
|
932
|
+
if (onPlatformChannel) {
|
|
933
|
+
const effective = resolvePlatformEffectiveModel(normalizedName);
|
|
934
|
+
if (effective && effective !== normalizedName) {
|
|
935
|
+
const aliased = map.get(effective);
|
|
936
|
+
if (aliased?.contextWindow) {
|
|
937
|
+
return typeof aliased.contextWindow === "number" ? aliased.contextWindow : void 0;
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
}
|
|
925
941
|
if (!onPlatformChannel) {
|
|
926
|
-
const
|
|
927
|
-
|
|
942
|
+
for (const candidate of candidates) {
|
|
943
|
+
const pinned = channelPinnedContextWindow(candidate.toLowerCase());
|
|
944
|
+
if (pinned !== void 0) return pinned;
|
|
945
|
+
}
|
|
928
946
|
}
|
|
929
947
|
return fuzzyContextWindow(normalizedName);
|
|
930
948
|
};
|
|
@@ -62,13 +62,19 @@ function parseCiStatusPayload(raw) {
|
|
|
62
62
|
const single = toCiJob(parsed);
|
|
63
63
|
return single ? [single] : void 0;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function resolveCiPort() {
|
|
66
66
|
const rawPort = process.env.NOLO_CI_PORT?.trim() ?? "";
|
|
67
|
-
|
|
67
|
+
return /^\d{1,5}$/.test(rawPort) && Number(rawPort) > 0 && Number(rawPort) <= 65535 ? rawPort : DEFAULT_CI_PORT;
|
|
68
|
+
}
|
|
69
|
+
function buildRemoteCommand(limit) {
|
|
70
|
+
const port = resolveCiPort();
|
|
68
71
|
const safeLimit = Math.max(1, Math.min(20, Math.trunc(limit) || 5));
|
|
69
72
|
return `curl -s -m 3 "http://127.0.0.1:${port}/status?limit=${safeLimit}"`;
|
|
70
73
|
}
|
|
71
74
|
function fetchCiStatus(limit = 5, timeoutMs = 4e3) {
|
|
75
|
+
return fetchCiPayload(buildRemoteCommand(limit), parseCiStatusPayload, timeoutMs);
|
|
76
|
+
}
|
|
77
|
+
function fetchCiPayload(command, parse, timeoutMs) {
|
|
72
78
|
return new Promise((resolve) => {
|
|
73
79
|
let settled = false;
|
|
74
80
|
let guard;
|
|
@@ -83,14 +89,18 @@ function fetchCiStatus(limit = 5, timeoutMs = 4e3) {
|
|
|
83
89
|
try {
|
|
84
90
|
execFile(
|
|
85
91
|
"ssh",
|
|
86
|
-
["-o", "BatchMode=yes", "-o", `ConnectTimeout=3`, resolveSshTarget(),
|
|
92
|
+
["-o", "BatchMode=yes", "-o", `ConnectTimeout=3`, resolveSshTarget(), command],
|
|
87
93
|
{ timeout: timeoutMs, encoding: "utf8", maxBuffer: 1024 * 1024 },
|
|
88
94
|
(error, stdout) => {
|
|
89
95
|
if (error) {
|
|
90
96
|
finish(void 0);
|
|
91
97
|
return;
|
|
92
98
|
}
|
|
93
|
-
|
|
99
|
+
try {
|
|
100
|
+
finish(parse(stdout ?? ""));
|
|
101
|
+
} catch {
|
|
102
|
+
finish(void 0);
|
|
103
|
+
}
|
|
94
104
|
}
|
|
95
105
|
);
|
|
96
106
|
} catch {
|
|
@@ -109,8 +119,21 @@ function summarizeLatest(jobs) {
|
|
|
109
119
|
}
|
|
110
120
|
return `ci:${sha} ${latest.status}`;
|
|
111
121
|
}
|
|
122
|
+
function fetchCiCancel(jobId, timeoutMs = 12e4) {
|
|
123
|
+
const body = JSON.stringify({ jobId }).replace(/'/g, "'\\''");
|
|
124
|
+
const endpoint = `http://127.0.0.1:${resolveCiPort()}/cancel`;
|
|
125
|
+
return fetchCiPayload(
|
|
126
|
+
`curl -s -m 110 -H 'Content-Type: application/json' -X POST --data '${body}' "${endpoint}"`,
|
|
127
|
+
(stdout) => {
|
|
128
|
+
const response = JSON.parse(stdout);
|
|
129
|
+
return response?.ok === true && response?.cancelled === true && response?.jobId === jobId ? true : false;
|
|
130
|
+
},
|
|
131
|
+
timeoutMs
|
|
132
|
+
);
|
|
133
|
+
}
|
|
112
134
|
|
|
113
135
|
export {
|
|
114
136
|
fetchCiStatus,
|
|
115
|
-
summarizeLatest
|
|
137
|
+
summarizeLatest,
|
|
138
|
+
fetchCiCancel
|
|
116
139
|
};
|
|
@@ -295,13 +295,14 @@ var buildSkillDiscoveryCatalogLayer = (catalog) => {
|
|
|
295
295
|
}
|
|
296
296
|
return makeLayer("skill-discovery", lines.join("\n"), "session");
|
|
297
297
|
};
|
|
298
|
+
var buildAgentsMdLayerHeader = (fileName = "AGENTS.md") => `--- \u9879\u76EE\u6307\u4EE4\uFF08${fileName}\uFF09---
|
|
299
|
+
`;
|
|
298
300
|
var buildAgentsMdLayer = (content, fileName = "AGENTS.md") => {
|
|
299
301
|
const trimmed = content.trim();
|
|
300
302
|
if (!trimmed) return null;
|
|
301
303
|
return makeLayer(
|
|
302
304
|
"agents-md",
|
|
303
|
-
|
|
304
|
-
${trimmed}`,
|
|
305
|
+
`${buildAgentsMdLayerHeader(fileName)}${trimmed}`,
|
|
305
306
|
"session"
|
|
306
307
|
);
|
|
307
308
|
};
|
|
@@ -375,6 +376,7 @@ export {
|
|
|
375
376
|
resolveSkillCatalogSync,
|
|
376
377
|
buildSpaceContextLayer,
|
|
377
378
|
buildSkillDiscoveryCatalogLayer,
|
|
379
|
+
buildAgentsMdLayerHeader,
|
|
378
380
|
buildAgentsMdLayer,
|
|
379
381
|
buildLinkedSpacesSection,
|
|
380
382
|
renderTurnContextBlocksWithScope,
|