@canonry/canonry 7.51.6 → 7.53.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/assets/agent-workspace/skills/canonry/references/canonry-cli.md +19 -1
- package/assets/assets/{AccessControls-B5TqDgeq.js → AccessControls-B-5YUuLE.js} +1 -1
- package/assets/assets/{AuditHistoryPanel-DgxiizOW.js → AuditHistoryPanel-BkCUPvPv.js} +1 -1
- package/assets/assets/{BacklinksPage-Ay6pdphx.js → BacklinksPage-BMgHZKuw.js} +1 -1
- package/assets/assets/{HistoryPage-B11eFH21.js → HistoryPage-D2DOk7ms.js} +1 -1
- package/assets/assets/MeasurementPropertyPage-Bwv8nKS7.js +4 -0
- package/assets/assets/ProjectPage-CsJfGPx3.js +7 -0
- package/assets/assets/RunsPage-DSHDuj9b.js +1 -0
- package/assets/assets/SettingsPage-BDRdWk5X.js +1 -0
- package/assets/assets/SiteHealthSection-DV06NTxC.js +2 -0
- package/assets/assets/TrafficPage-CBMMwRfw.js +40 -0
- package/assets/assets/{TrafficSourceDetailPage-DQu0YNt2.js → TrafficSourceDetailPage-Czpt0S7j.js} +1 -1
- package/assets/assets/card-CVejjbhs.js +60 -0
- package/assets/assets/{extract-error-message-BRM1I_3L.js → extract-error-message-Co6zPipR.js} +1 -1
- package/assets/assets/{format-helpers-DrkFERj3.js → format-helpers-B_2jkVGI.js} +1 -1
- package/assets/assets/index-BnS2Vuv0.js +40 -0
- package/assets/assets/index-DgS5TTSb.css +1 -0
- package/assets/assets/{query-client-gRFnU4VF.js → query-client-BKJLgjJd.js} +1 -1
- package/assets/assets/react-query-ltP1RErY.js +1 -0
- package/assets/assets/{react-sigma_core.esm.min-D09H4byP.js → react-sigma_core.esm.min-Bjux3j_1.js} +1 -1
- package/assets/assets/service-CDsqgNrS.js +1 -0
- package/assets/index.html +8 -7
- package/dist/{ads-ABAT3K4K.js → ads-S4S74OXM.js} +3 -3
- package/dist/{agent-5G4DRLYX.js → agent-JZWKCI5V.js} +7 -7
- package/dist/{agent-ask-UDVCZRO7.js → agent-ask-N2DG5ZLZ.js} +3 -3
- package/dist/{agent-conversations-5E4JP2QZ.js → agent-conversations-7UDNE7YI.js} +3 -3
- package/dist/{agent-memory-7IIJ4HGZ.js → agent-memory-I74OWTU7.js} +3 -3
- package/dist/{agent-providers-BOXPUXZ4.js → agent-providers-MEMCZPGE.js} +3 -3
- package/dist/{agent-transcript-4O56G6PQ.js → agent-transcript-Z7VTL7PY.js} +3 -3
- package/dist/{analytics-PKMWX5XL.js → analytics-4NUSNTKT.js} +3 -3
- package/dist/{apply-OK4XEBDA.js → apply-OZKQK3YF.js} +3 -3
- package/dist/{backfill-2OT56CX2.js → backfill-PLY2NOOY.js} +9 -9
- package/dist/{backlinks-547WCHND.js → backlinks-2CMRJFWO.js} +3 -3
- package/dist/{bing-ZVBV4ZD5.js → bing-RD3DDESD.js} +3 -3
- package/dist/{bootstrap-HUB7XQ73.js → bootstrap-JOYV4SWM.js} +9 -9
- package/dist/{cdp-KQKQ4PWJ.js → cdp-LUGL3CT6.js} +7 -7
- package/dist/{chunk-HM4NNKLG.js → chunk-23UZNTF4.js} +1 -1
- package/dist/{chunk-73P65KPW.js → chunk-2EYBZYDG.js} +2 -2
- package/dist/{chunk-D6COIM3U.js → chunk-2GAXZAQJ.js} +5985 -5846
- package/dist/{chunk-VBCE4CLX.js → chunk-2HWY4NRQ.js} +3 -3
- package/dist/{chunk-ZWJRY5UI.js → chunk-2XDGFHPM.js} +6 -4
- package/dist/{chunk-I3A56PFP.js → chunk-3DO3CS7Y.js} +4 -4
- package/dist/{chunk-PCXRFT3N.js → chunk-6VSKBVB3.js} +3 -3
- package/dist/{chunk-RKIXES2B.js → chunk-6ZCZRZ66.js} +2 -2
- package/dist/{chunk-MMEO22MF.js → chunk-BGZL5RCP.js} +1 -1
- package/dist/{chunk-63ISSSGX.js → chunk-BH274VEO.js} +32 -4
- package/dist/{chunk-HACZUMGM.js → chunk-BQT7VLGM.js} +11 -1
- package/dist/{chunk-KFT5LOP2.js → chunk-C5GCRQ66.js} +10 -3
- package/dist/{chunk-7B2Q4NJE.js → chunk-DFQHGWPB.js} +1 -1
- package/dist/{chunk-TUTKNUMV.js → chunk-F55ER5RQ.js} +3 -3
- package/dist/{chunk-I77PLCWG.js → chunk-IWQGZQHE.js} +32 -12
- package/dist/{chunk-DGVUTH7W.js → chunk-JZARXJV6.js} +3031 -2283
- package/dist/{chunk-ZXUAWVWM.js → chunk-LGU3O5YP.js} +2 -2
- package/dist/{chunk-7WZ2FPB4.js → chunk-LYCYSM6O.js} +1 -1
- package/dist/chunk-N3WQHLDI.js +1199 -0
- package/dist/{chunk-WAULJDKO.js → chunk-N6MS4VG2.js} +226 -5
- package/dist/{chunk-B2FR2ZQ4.js → chunk-NKSASP4U.js} +1 -1
- package/dist/{chunk-B5J675KK.js → chunk-O3OTW7F4.js} +39 -2
- package/dist/{chunk-6G6FTDWC.js → chunk-P4SXRRB4.js} +313 -196
- package/dist/{chunk-42D2LE2B.js → chunk-QARV5HVI.js} +26 -240
- package/dist/{chunk-VYMZ3QXG.js → chunk-QNU7IIO7.js} +326 -324
- package/dist/{chunk-ISOQPVPY.js → chunk-QXJ356KK.js} +4 -4
- package/dist/{chunk-QWKPSFGL.js → chunk-RVBGFWJ3.js} +1 -1
- package/dist/{chunk-WDFI5YMD.js → chunk-SZG7S7TE.js} +1 -1
- package/dist/{chunk-GO2J7SYT.js → chunk-U7JJKXLA.js} +5 -5
- package/dist/{chunk-PITHTCAX.js → chunk-VEH4YLWR.js} +1 -1
- package/dist/{chunk-NHQ2U5I4.js → chunk-WNXKW3NS.js} +1 -1
- package/dist/{chunk-2G6IP3MO.js → chunk-XTIP5WSA.js} +11 -4
- package/dist/{chunk-U3AHE2RT.js → chunk-ZXH5IFIA.js} +4 -4
- package/dist/{citations-UYB2RU5U.js → citations-GMLBTNLW.js} +3 -3
- package/dist/{cli-catalog-F6FI7NB2.js → cli-catalog-WKUCQEWA.js} +3 -3
- package/dist/{cli-commands-ZG5ILKDA.js → cli-commands-YCHQWUNK.js} +7 -7
- package/dist/cli.js +13 -13
- package/dist/{competitor-EKP4R7YY.js → competitor-QNPVJFEI.js} +3 -3
- package/dist/{content-DREE6JF3.js → content-NFTC74HD.js} +3 -3
- package/dist/{dashboard-ZALEOLLU.js → dashboard-TMUQT5H5.js} +6 -6
- package/dist/{demo-JG4Y22O4.js → demo-O5SPVLZZ.js} +1 -1
- package/dist/{demo-server-3A4J2C65.js → demo-server-WKZ53RGK.js} +11 -11
- package/dist/{discover-W6GMD2HS.js → discover-LTTO7KHN.js} +3 -3
- package/dist/{discover-eval-CKFZHRBW.js → discover-eval-QRDNMDUE.js} +3 -3
- package/dist/{doctor-TNGBSUMA.js → doctor-SFL5FOW4.js} +3 -3
- package/dist/{evidence-3H2GFQBZ.js → evidence-J6WZ767P.js} +3 -3
- package/dist/{export-cmd-WUIKU5GK.js → export-cmd-D3JDTBDV.js} +3 -3
- package/dist/{ga-JI6REFO4.js → ga-N56LXQUN.js} +3 -3
- package/dist/{gbp-4ENDM5NS.js → gbp-7WVJYWDR.js} +3 -3
- package/dist/{google-HKQSCLOC.js → google-YLRVXYVJ.js} +4 -4
- package/dist/{google-marketing-KQR5J2S4.js → google-marketing-4DGX3RBB.js} +1 -1
- package/dist/{health-cmd-TS7EMMCS.js → health-cmd-PK3BASF6.js} +3 -3
- package/dist/{history-MSD5DK6K.js → history-UWTEZ626.js} +3 -3
- package/dist/index.d.ts +120 -48
- package/dist/index.js +23 -23
- package/dist/{init-L6WAEOWX.js → init-RBI2IOBY.js} +11 -11
- package/dist/{insights-RTZ3IZTD.js → insights-ZUC5XHFD.js} +3 -3
- package/dist/intelligence-service-JXXB43RB.js +15 -0
- package/dist/{keys-625DZBRM.js → keys-NOG3M76V.js} +3 -3
- package/dist/{keyword-CW46RNRR.js → keyword-HD57L76I.js} +3 -3
- package/dist/{logs-V33SHBIW.js → logs-VAB7ITBS.js} +3 -3
- package/dist/{mcp-DFEDPSEG.js → mcp-HYHIL5FB.js} +2 -2
- package/dist/mcp.js +9 -9
- package/dist/{measurement-plan-6W37RUOP.js → measurement-plan-GEHOHCH3.js} +5 -5
- package/dist/{notify-DSUOT7WO.js → notify-VQ2ZDGN4.js} +3 -3
- package/dist/{organic-evidence-BMN6L4OB.js → organic-evidence-6TX627YW.js} +3 -3
- package/dist/{overview-WRRMBZ6S.js → overview-XBO7WYAV.js} +4 -4
- package/dist/{project-2GJIU3FE.js → project-DR6744WZ.js} +3 -3
- package/dist/{query-3XPMGJUA.js → query-OGVTCPG5.js} +3 -3
- package/dist/{research-V433CKJ4.js → research-B2TGKSMC.js} +3 -3
- package/dist/{results-export-RGBU7QQQ.js → results-export-K7PAYPWQ.js} +3 -3
- package/dist/{run-NIAC6OJN.js → run-Y6LUMCVL.js} +4 -4
- package/dist/{schedule-KDWXRIE7.js → schedule-PNAUJ5FX.js} +3 -3
- package/dist/{search-626MPUJN.js → search-PMVOGL4U.js} +3 -3
- package/dist/{serve-73SMMASI.js → serve-PQHXSS5T.js} +67 -26
- package/dist/{session-7WWOETZB.js → session-S5NDMMKF.js} +16 -15
- package/dist/{settings-VKFQO6F2.js → settings-AL7E7QUK.js} +3 -3
- package/dist/{skills-5HC5H7TE.js → skills-GQOOTDR7.js} +2 -2
- package/dist/{snapshot-BSJUHFBC.js → snapshot-W3FXRTZM.js} +3 -3
- package/dist/{src-F6HM73TN.js → src-WZLTQFCH.js} +2 -2
- package/dist/{status-V4OWP7LZ.js → status-MBJVN4W5.js} +4 -4
- package/dist/{technical-aeo-TG7CGU3F.js → technical-aeo-Y4RFST72.js} +3 -3
- package/dist/{telemetry-O2IUNUBW.js → telemetry-VK6F5QSZ.js} +4 -4
- package/dist/{tools-2GJIDKND.js → tools-W3AQY5TY.js} +11 -11
- package/dist/{traffic-XV4I3UPH.js → traffic-ER4I6V3B.js} +5 -5
- package/dist/{users-VGBLDL5K.js → users-KZK2OF4L.js} +3 -3
- package/dist/{visibility-stats-UKJYJ6PP.js → visibility-stats-CR7BUG5G.js} +3 -3
- package/dist/{wordpress-JZA7CGC6.js → wordpress-DG5JUCAC.js} +3 -3
- package/package.json +2 -1
- package/assets/assets/MeasurementPropertyPage-1UYI7mzP.js +0 -4
- package/assets/assets/ProjectPage-DoY0hftd.js +0 -8
- package/assets/assets/RunsPage-BPBmuQAS.js +0 -1
- package/assets/assets/SettingsPage-ClKnP8xy.js +0 -1
- package/assets/assets/SiteHealthSection-PWjKMmEn.js +0 -2
- package/assets/assets/TrafficPage-DkfGiJXR.js +0 -40
- package/assets/assets/card-DYMyvhB9.js +0 -60
- package/assets/assets/index-CG1Jox52.js +0 -39
- package/assets/assets/index-CsPsaUr7.css +0 -1
- package/assets/assets/react-query-lH82FULK.js +0 -1
- package/assets/assets/service-Cx0HSnE9.js +0 -1
- package/dist/chunk-UQ3MOZGC.js +0 -644
- package/dist/intelligence-service-TH52PCNJ.js +0 -15
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
|
-
AGENT_PROVIDERS,
|
|
3
2
|
AeroLlmUsageFeatures,
|
|
4
3
|
aeroTurnStatus,
|
|
5
4
|
aeroTurnUsage,
|
|
6
5
|
aeroViewPrompt,
|
|
7
|
-
agentProviderApiKeyEnvVar,
|
|
8
|
-
agentProvidersByPriority,
|
|
9
6
|
buildAeroViewTool,
|
|
10
|
-
buildAgentProvidersResponse,
|
|
11
7
|
buildApiKeyResolver,
|
|
12
8
|
buildSkillDocTools,
|
|
13
|
-
coerceAgentProvider,
|
|
14
|
-
completeOnce,
|
|
15
9
|
configureAeroRuntime,
|
|
16
10
|
createAeroSession,
|
|
17
11
|
describeAgentPin,
|
|
18
12
|
detectAgentProvider,
|
|
19
|
-
getAgentProvider,
|
|
20
|
-
isAgentModelAvailable,
|
|
21
13
|
isRunFailureMessage,
|
|
22
14
|
isSystemMessage,
|
|
23
15
|
loadAeroSystemPrompt,
|
|
@@ -28,19 +20,17 @@ import {
|
|
|
28
20
|
resolveAgentEnabled,
|
|
29
21
|
resolveAgentProactiveEnabled,
|
|
30
22
|
resolveAgentReasoning,
|
|
31
|
-
resolveApiKeyFor,
|
|
32
23
|
resolveConfiguredAgentProvider,
|
|
33
|
-
resolveModelForCapability,
|
|
34
24
|
resolveSessionProviderAndModel,
|
|
35
25
|
setAeroSystemPrompt
|
|
36
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-QARV5HVI.js";
|
|
37
27
|
import {
|
|
38
28
|
AeroToolProfiles,
|
|
39
29
|
AeroToolScopes,
|
|
40
30
|
buildAeroStateTools,
|
|
41
31
|
isAeroToolProfile,
|
|
42
32
|
truncateToolResult
|
|
43
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-ZXH5IFIA.js";
|
|
44
34
|
import {
|
|
45
35
|
getGoogleAuthConfig,
|
|
46
36
|
getGoogleConnection,
|
|
@@ -59,7 +49,7 @@ import {
|
|
|
59
49
|
removeCloudflareTrafficConnection,
|
|
60
50
|
removeCloudflareTrafficConnectionBySourceId,
|
|
61
51
|
upsertCloudflareTrafficConnection
|
|
62
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-WNXKW3NS.js";
|
|
63
53
|
import {
|
|
64
54
|
claudeAdapter,
|
|
65
55
|
embedQueries,
|
|
@@ -68,8 +58,9 @@ import {
|
|
|
68
58
|
geminiAdapter,
|
|
69
59
|
museAdapter,
|
|
70
60
|
openaiAdapter,
|
|
61
|
+
openrouterAdapter,
|
|
71
62
|
perplexityAdapter
|
|
72
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-N6MS4VG2.js";
|
|
73
64
|
import {
|
|
74
65
|
classifyUsageSurface,
|
|
75
66
|
createApiUsageTelemetry,
|
|
@@ -81,7 +72,7 @@ import {
|
|
|
81
72
|
startOutcomeTimer,
|
|
82
73
|
trackFeatureCompleted,
|
|
83
74
|
trackInstallState
|
|
84
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-QXJ356KK.js";
|
|
85
76
|
import {
|
|
86
77
|
isLoopbackBindHost
|
|
87
78
|
} from "./chunk-TSENU4GG.js";
|
|
@@ -89,7 +80,7 @@ import {
|
|
|
89
80
|
isApiProviderRegistrable,
|
|
90
81
|
isCdpProviderRegistrable,
|
|
91
82
|
registeredProviderNames
|
|
92
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-RVBGFWJ3.js";
|
|
93
84
|
import {
|
|
94
85
|
checkLatestVersionForServer,
|
|
95
86
|
getOrCreateAnonymousId,
|
|
@@ -100,46 +91,62 @@ import {
|
|
|
100
91
|
recordDashboardEvent,
|
|
101
92
|
setTelemetryPreference,
|
|
102
93
|
trackEvent
|
|
103
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-6ZCZRZ66.js";
|
|
104
95
|
import {
|
|
105
96
|
createCanonryMcpServer
|
|
106
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-6VSKBVB3.js";
|
|
107
98
|
import {
|
|
108
99
|
CANONRY_MCP_TIERS,
|
|
109
100
|
CANONRY_MCP_TOOLKIT_NAMES
|
|
110
101
|
} from "./chunk-4MJYGB56.js";
|
|
111
102
|
import {
|
|
112
103
|
ApiClient
|
|
113
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-O3OTW7F4.js";
|
|
114
105
|
import {
|
|
106
|
+
AGENT_PROVIDERS,
|
|
115
107
|
adapterSupportsBatch,
|
|
108
|
+
aeroModels,
|
|
109
|
+
agentProviderApiKeyEnvVar,
|
|
110
|
+
agentProvidersByPriority,
|
|
116
111
|
batchEligibleProviderNames,
|
|
112
|
+
buildAgentProvidersResponse,
|
|
113
|
+
coerceAgentProvider,
|
|
114
|
+
completeOnce,
|
|
117
115
|
dashboardManagedRunKindsSchema,
|
|
116
|
+
getAgentProvider,
|
|
118
117
|
getConfigPath,
|
|
118
|
+
getSharedProviderExecutionGate,
|
|
119
|
+
isAgentModelAvailable,
|
|
120
|
+
isAgentModelUnchecked,
|
|
119
121
|
loadConfig,
|
|
120
122
|
loadConfigRaw,
|
|
123
|
+
openRouterModels,
|
|
121
124
|
providerConfigFromEntry,
|
|
122
125
|
providersWithUnsupportedBatch,
|
|
126
|
+
refreshAgentModels,
|
|
127
|
+
resolveApiKeyFor,
|
|
128
|
+
resolveModelForCapability,
|
|
123
129
|
resolveOperatorApiKeyIds,
|
|
124
130
|
resolveSentimentInstallConfig,
|
|
125
131
|
saveConfig,
|
|
126
132
|
saveConfigPatch,
|
|
127
|
-
sentimentInstallReadiness
|
|
128
|
-
|
|
133
|
+
sentimentInstallReadiness,
|
|
134
|
+
updateSharedProviderExecutionGate
|
|
135
|
+
} from "./chunk-N3WQHLDI.js";
|
|
129
136
|
import {
|
|
130
137
|
getBundledSkillSnapshots
|
|
131
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-NKSASP4U.js";
|
|
132
139
|
import {
|
|
133
140
|
computeFactorAverages,
|
|
134
141
|
deleteSiteCrawlGraphLayout,
|
|
135
142
|
persistSiteCrawlGraphLayout,
|
|
136
143
|
prepareSiteCrawlGraphLayout,
|
|
137
144
|
recordedSharePct
|
|
138
|
-
} from "./chunk-
|
|
145
|
+
} from "./chunk-2EYBZYDG.js";
|
|
139
146
|
import {
|
|
140
147
|
CanonryMcpToolNames,
|
|
141
148
|
canonryMcpTools
|
|
142
|
-
} from "./chunk-
|
|
149
|
+
} from "./chunk-2XDGFHPM.js";
|
|
143
150
|
import {
|
|
144
151
|
PACKAGE_VERSION
|
|
145
152
|
} from "./chunk-AOJU5LKX.js";
|
|
@@ -151,11 +158,11 @@ import {
|
|
|
151
158
|
addLogListener,
|
|
152
159
|
createFastifyLogger,
|
|
153
160
|
createLogger
|
|
154
|
-
} from "./chunk-
|
|
161
|
+
} from "./chunk-U7JJKXLA.js";
|
|
155
162
|
import {
|
|
156
163
|
computeCitedCompetitorDomains,
|
|
157
164
|
determineCitationState
|
|
158
|
-
} from "./chunk-
|
|
165
|
+
} from "./chunk-BGZL5RCP.js";
|
|
159
166
|
import {
|
|
160
167
|
BingApiError,
|
|
161
168
|
CC_CACHE_DIR,
|
|
@@ -248,6 +255,7 @@ import {
|
|
|
248
255
|
readMarketCompetitorNames,
|
|
249
256
|
redactNotificationUrl,
|
|
250
257
|
refreshAccessToken,
|
|
258
|
+
refreshSnapshotMentionIdentity,
|
|
251
259
|
registerAgentConversationRoutes,
|
|
252
260
|
registerOAuthAdminRoutes,
|
|
253
261
|
registerOAuthRoutes,
|
|
@@ -270,7 +278,7 @@ import {
|
|
|
270
278
|
webhookResponseReason,
|
|
271
279
|
webhookTargetRefusalReason,
|
|
272
280
|
writeAuditLog
|
|
273
|
-
} from "./chunk-
|
|
281
|
+
} from "./chunk-JZARXJV6.js";
|
|
274
282
|
import {
|
|
275
283
|
OperationalLogStore,
|
|
276
284
|
SentimentIdempotencyConflict,
|
|
@@ -352,7 +360,7 @@ import {
|
|
|
352
360
|
siteLivenessState,
|
|
353
361
|
trafficSources,
|
|
354
362
|
usageCounters
|
|
355
|
-
} from "./chunk-
|
|
363
|
+
} from "./chunk-BH274VEO.js";
|
|
356
364
|
import {
|
|
357
365
|
AGENT_MEMORY_VALUE_MAX_BYTES,
|
|
358
366
|
AI_ENGINE_DOMAINS,
|
|
@@ -384,6 +392,7 @@ import {
|
|
|
384
392
|
GtmSnapshotKinds,
|
|
385
393
|
INTEGRATION_NAMES,
|
|
386
394
|
IntegrationNames,
|
|
395
|
+
LlmCapabilities,
|
|
387
396
|
MEASUREMENT_CHANGES_NOISE_ANSWERS,
|
|
388
397
|
MEASUREMENT_PLAN_V2_SCHEMA_VERSION,
|
|
389
398
|
MemorySources,
|
|
@@ -410,6 +419,9 @@ import {
|
|
|
410
419
|
RunKinds,
|
|
411
420
|
RunStatuses,
|
|
412
421
|
RunTriggers,
|
|
422
|
+
SENTIMENT_MODEL,
|
|
423
|
+
SENTIMENT_OPENROUTER_MODEL,
|
|
424
|
+
SENTIMENT_OPENROUTER_SERVED_MODEL,
|
|
413
425
|
SITE_AUDIT_DEFAULT_PAGE_LIMIT,
|
|
414
426
|
SITE_AUDIT_MAX_EDGE_LIMIT,
|
|
415
427
|
SITE_AUDIT_MAX_PAGE_LIMIT,
|
|
@@ -505,10 +517,12 @@ import {
|
|
|
505
517
|
inclusiveDayCount,
|
|
506
518
|
isBrowserProvider,
|
|
507
519
|
isNegativeReviewRating,
|
|
520
|
+
isOpenRouterRoute,
|
|
508
521
|
isReadOnlyKey,
|
|
509
522
|
isRetryableHttpError,
|
|
510
523
|
isSearchLocationIgnored,
|
|
511
524
|
isSelfLink,
|
|
525
|
+
isSweepProvider,
|
|
512
526
|
isVertexGroundingRedirect,
|
|
513
527
|
mapWithConcurrency,
|
|
514
528
|
matcherMatchesText,
|
|
@@ -527,11 +541,13 @@ import {
|
|
|
527
541
|
notificationEventSchema,
|
|
528
542
|
observeTemplateLinkDetection,
|
|
529
543
|
observeTemplateLinkEdges,
|
|
544
|
+
openRouterRouteModel,
|
|
530
545
|
operationInProgress,
|
|
531
546
|
parseMeasurementRunManifestV1,
|
|
532
547
|
parseOriginList,
|
|
533
548
|
parseRunError,
|
|
534
549
|
percentOf,
|
|
550
|
+
providerConnectionName,
|
|
535
551
|
providerError,
|
|
536
552
|
providerSupportsLocationContext,
|
|
537
553
|
quotaExceeded,
|
|
@@ -544,6 +560,7 @@ import {
|
|
|
544
560
|
retryAfterDelayMs,
|
|
545
561
|
sentimentClassifierInputSchema,
|
|
546
562
|
sentimentClassifierOutputSchema,
|
|
563
|
+
sentimentEvaluatorProvider,
|
|
547
564
|
sentimentSelectionSchema,
|
|
548
565
|
serializeForInlineScript,
|
|
549
566
|
serializeRunError,
|
|
@@ -565,7 +582,7 @@ import {
|
|
|
565
582
|
winnabilityClassLabel,
|
|
566
583
|
withRetry,
|
|
567
584
|
withSkippedProviders
|
|
568
|
-
} from "./chunk-
|
|
585
|
+
} from "./chunk-2GAXZAQJ.js";
|
|
569
586
|
|
|
570
587
|
// src/google-marketing-runtime.ts
|
|
571
588
|
import crypto2 from "crypto";
|
|
@@ -957,10 +974,10 @@ function findRequestId(value, depth = 0) {
|
|
|
957
974
|
}
|
|
958
975
|
return void 0;
|
|
959
976
|
}
|
|
960
|
-
const
|
|
961
|
-
const direct = safeRequestId(
|
|
977
|
+
const record = value;
|
|
978
|
+
const direct = safeRequestId(record.requestId) ?? safeRequestId(record.request_id);
|
|
962
979
|
if (direct) return direct;
|
|
963
|
-
for (const nested of Object.values(
|
|
980
|
+
for (const nested of Object.values(record)) {
|
|
964
981
|
const found = findRequestId(nested, depth + 1);
|
|
965
982
|
if (found) return found;
|
|
966
983
|
}
|
|
@@ -3262,11 +3279,9 @@ import { createHash } from "crypto";
|
|
|
3262
3279
|
|
|
3263
3280
|
// ../integration-typesafe/src/client.ts
|
|
3264
3281
|
var TYPESAFE_URL = "https://api.typesafe.ai/v1/systemone";
|
|
3265
|
-
|
|
3266
|
-
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
3267
|
-
}
|
|
3282
|
+
var JEV_MODEL = SENTIMENT_MODEL;
|
|
3268
3283
|
function usageFrom(value) {
|
|
3269
|
-
const usage =
|
|
3284
|
+
const usage = asRecord(asRecord(value)?.usage);
|
|
3270
3285
|
const input = usage?.input_tokens;
|
|
3271
3286
|
const output = usage?.output_tokens;
|
|
3272
3287
|
if (typeof input === "number" && Number.isSafeInteger(input) && input >= 0 && typeof output === "number" && Number.isSafeInteger(output) && output >= 0) {
|
|
@@ -3279,6 +3294,7 @@ function failure(code, message, retryable = false, retryAfterMs = null, usage =
|
|
|
3279
3294
|
}
|
|
3280
3295
|
async function fetchOnce2(request, options) {
|
|
3281
3296
|
if (options.signal?.aborted) return failure("canceled", "Classification was canceled before dispatch.");
|
|
3297
|
+
if (request.model !== JEV_MODEL) return failure("model-mismatch", "The direct TypeSafe evaluator requires its pinned model.");
|
|
3282
3298
|
if (!options.apiKey.trim()) return failure("credential-missing", "TypeSafe credentials are unavailable.");
|
|
3283
3299
|
const timeoutMs = options.timeoutMs ?? 3e4;
|
|
3284
3300
|
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0 || timeoutMs > 12e4) {
|
|
@@ -3314,12 +3330,12 @@ async function fetchOnce2(request, options) {
|
|
|
3314
3330
|
const code = response.status === 401 || response.status === 403 ? "provider-authorization" : response.status === 413 ? "provider-context-limit" : response.status === 429 ? "provider-rate-limit" : retryable ? "provider-unavailable" : "provider-rejected";
|
|
3315
3331
|
return failure(code, `TypeSafe returned HTTP ${response.status}.`, retryable, retryAfterDelayMs(statusError), usage);
|
|
3316
3332
|
}
|
|
3317
|
-
const parsed =
|
|
3333
|
+
const parsed = asRecord(body);
|
|
3318
3334
|
const model = typeof parsed?.model === "string" ? parsed.model : null;
|
|
3319
3335
|
if (model !== null && model !== request.model) {
|
|
3320
3336
|
return failure("model-mismatch", "TypeSafe returned a different evaluator model.", false, null, usage, model);
|
|
3321
3337
|
}
|
|
3322
|
-
const answers =
|
|
3338
|
+
const answers = asRecord(parsed?.answers);
|
|
3323
3339
|
if (!model || !answers || usage.kind !== "reported") {
|
|
3324
3340
|
return failure("response-contract", "TypeSafe returned an incomplete evaluation response.", false, null, usage, model);
|
|
3325
3341
|
}
|
|
@@ -3414,8 +3430,8 @@ function buildJevSentimentRequest(input) {
|
|
|
3414
3430
|
return { ok: true, request, estimate };
|
|
3415
3431
|
}
|
|
3416
3432
|
function parseChoice(value, question) {
|
|
3417
|
-
const answer =
|
|
3418
|
-
const probabilities =
|
|
3433
|
+
const answer = asRecord(value);
|
|
3434
|
+
const probabilities = asRecord(answer?.probabilities);
|
|
3419
3435
|
if (answer?.type !== "choice" || typeof answer.choice !== "string" || !Object.hasOwn(question.criteria, answer.choice) || !probabilities) return null;
|
|
3420
3436
|
const expected = Object.keys(question.criteria);
|
|
3421
3437
|
if (Object.keys(probabilities).length !== expected.length || expected.some((key) => typeof probabilities[key] !== "number" || !Number.isFinite(probabilities[key]) || probabilities[key] < 0 || probabilities[key] > 1)) return null;
|
|
@@ -3425,13 +3441,16 @@ function parseChoice(value, question) {
|
|
|
3425
3441
|
return { choice: answer.choice, confidence: typeof answer.confidence === "number" ? answer.confidence : null };
|
|
3426
3442
|
}
|
|
3427
3443
|
function createTypeSafeClassifier(options) {
|
|
3444
|
+
return createJevSentimentClassifier((request, signal) => requestJev(request, { ...options, signal }));
|
|
3445
|
+
}
|
|
3446
|
+
function createJevSentimentClassifier(dispatch) {
|
|
3428
3447
|
return { async classify(rawInput, callOptions) {
|
|
3429
3448
|
const valid = sentimentClassifierInputSchema.safeParse(rawInput);
|
|
3430
3449
|
if (!valid.success) return { kind: "failed", outcome: SentimentOutcomes.failed, returnedModel: null, usage: UNKNOWN_USAGE, error: { code: "input-contract", message: "The classifier input does not match its frozen contract.", retryable: false, retryAfterMs: null } };
|
|
3431
3450
|
const input = valid.data;
|
|
3432
3451
|
const built = buildJevSentimentRequest(input);
|
|
3433
3452
|
if (!built.ok) return { kind: "abstained", outcome: built.outcome, reason: built.reason, returnedModel: null, usage: UNKNOWN_USAGE };
|
|
3434
|
-
const response = await
|
|
3453
|
+
const response = await dispatch(built.request, callOptions?.signal);
|
|
3435
3454
|
if (!response.ok) return { kind: "failed", outcome: SentimentOutcomes.failed, returnedModel: response.returnedModel, usage: response.usage, error: response.error };
|
|
3436
3455
|
const parsed = Object.fromEntries(Object.entries(built.request.questions).map(([id, question]) => [id, parseChoice(response.answers[id], question)]));
|
|
3437
3456
|
const spans = new Map(input.sentences.map((span) => [span.id, span]));
|
|
@@ -3442,7 +3461,7 @@ function createTypeSafeClassifier(options) {
|
|
|
3442
3461
|
return span ? [{ ...span }] : null;
|
|
3443
3462
|
};
|
|
3444
3463
|
const abstain = (outcome, reason) => ({ kind: "abstained", outcome, reason, returnedModel: response.returnedModel, usage: response.usage });
|
|
3445
|
-
if (!parsed.identity || !parsed.judgment || !parsed.stance) return { kind: "failed", outcome: SentimentOutcomes.failed, returnedModel: response.returnedModel, usage: response.usage, error: { code: "response-contract", message: "
|
|
3464
|
+
if (!parsed.identity || !parsed.judgment || !parsed.stance) return { kind: "failed", outcome: SentimentOutcomes.failed, returnedModel: response.returnedModel, usage: response.usage, error: { code: "response-contract", message: "Jev returned a malformed headline decision.", retryable: false, retryAfterMs: null } };
|
|
3446
3465
|
if (parsed.identity.choice === "absent") return abstain(SentimentOutcomes["subject-not-mentioned"], "The known intended subject is not discussed in the answer.");
|
|
3447
3466
|
if (parsed.identity.choice === "wrong") return abstain(SentimentOutcomes["wrong-subject"], "The answer refers to another subject.");
|
|
3448
3467
|
if (parsed.identity.choice !== "correct") return abstain(SentimentOutcomes["ambiguous-subject"], "The intended subject cannot be resolved unambiguously.");
|
|
@@ -3465,6 +3484,70 @@ var SENTIMENT_CHALLENGE_GATES = {
|
|
|
3465
3484
|
"caveated-favorable": { outcome: SentimentOutcomes.favorable, target: 0.9 }
|
|
3466
3485
|
};
|
|
3467
3486
|
|
|
3487
|
+
// src/sentiment-openrouter.ts
|
|
3488
|
+
var OPENROUTER_SYSTEM_ONE_URL = "https://openrouter.ai/api/v1/systemone";
|
|
3489
|
+
var UNKNOWN_USAGE2 = { kind: "unknown", inputTokens: null, outputTokens: null };
|
|
3490
|
+
function createConfiguredSentimentClassifier(configuration, registry, reload) {
|
|
3491
|
+
if (configuration.provider !== "openrouter") return createTypeSafeClassifier({ apiKey: configuration.apiKey });
|
|
3492
|
+
return createJevSentimentClassifier(async (request, signal) => {
|
|
3493
|
+
const failure2 = (code, retryable = false, usage = UNKNOWN_USAGE2, returnedModel = null, retryAfterMs = null) => ({
|
|
3494
|
+
ok: false,
|
|
3495
|
+
returnedModel,
|
|
3496
|
+
usage,
|
|
3497
|
+
error: { code, message: "The OpenRouter sentiment evaluator did not return a usable pinned result.", retryable, retryAfterMs }
|
|
3498
|
+
});
|
|
3499
|
+
if (request.model !== SENTIMENT_OPENROUTER_MODEL) return failure2("model-mismatch");
|
|
3500
|
+
const model = aeroModels.getModelOfType("classifier", "openrouter", SENTIMENT_OPENROUTER_MODEL);
|
|
3501
|
+
if (!model) return failure2("unsupported-model");
|
|
3502
|
+
const quota = registry?.get("openrouter")?.config.quotaPolicy;
|
|
3503
|
+
const gate = getSharedProviderExecutionGate("openrouter", quota?.maxConcurrency ?? configuration.maxConcurrency, quota?.maxRequestsPerMinute ?? configuration.maxRequestsPerMinute);
|
|
3504
|
+
return gate.run(async () => {
|
|
3505
|
+
const active = reload?.() ?? configuration;
|
|
3506
|
+
const readiness = sentimentInstallReadiness(active);
|
|
3507
|
+
if (!readiness.ready) return failure2(readiness.reason ?? "invalid-config", true);
|
|
3508
|
+
if (active.provider !== configuration.provider || active.model !== request.model) return failure2("evaluator-route-changed", true);
|
|
3509
|
+
const observed = { body: null };
|
|
3510
|
+
const observedFetch = async (url, init) => {
|
|
3511
|
+
const endpoint = typeof url === "string" ? url : url instanceof URL ? url.href : url.url;
|
|
3512
|
+
if (endpoint !== OPENROUTER_SYSTEM_ONE_URL) throw new Error("Unsupported sentiment transport endpoint.");
|
|
3513
|
+
const response = await fetch(OPENROUTER_SYSTEM_ONE_URL, { ...init, redirect: "error" });
|
|
3514
|
+
observed.status = response.status;
|
|
3515
|
+
observed.retryAfter = response.headers.get("retry-after") ?? void 0;
|
|
3516
|
+
try {
|
|
3517
|
+
observed.body = asRecord(await response.clone().json());
|
|
3518
|
+
} catch {
|
|
3519
|
+
observed.body = null;
|
|
3520
|
+
}
|
|
3521
|
+
return response;
|
|
3522
|
+
};
|
|
3523
|
+
const result = await aeroModels.classify(model, { state: request.state, questions: request.questions }, {
|
|
3524
|
+
apiKey: active.apiKey,
|
|
3525
|
+
signal,
|
|
3526
|
+
maxRetries: 0,
|
|
3527
|
+
timeoutMs: 3e4,
|
|
3528
|
+
headers: { "User-Agent": "canonry" },
|
|
3529
|
+
fetch: observedFetch
|
|
3530
|
+
});
|
|
3531
|
+
const responseBody = observed.body;
|
|
3532
|
+
const returnedModel = typeof responseBody?.model === "string" ? responseBody.model : null;
|
|
3533
|
+
const counts = asRecord(responseBody?.usage);
|
|
3534
|
+
const input = counts?.input_tokens;
|
|
3535
|
+
const output = counts?.output_tokens;
|
|
3536
|
+
const usage = typeof input === "number" && Number.isSafeInteger(input) && input >= 0 && typeof output === "number" && Number.isSafeInteger(output) && output >= 0 ? { kind: "reported", inputTokens: input, outputTokens: output } : UNKNOWN_USAGE2;
|
|
3537
|
+
if (result.stopReason !== "stop") {
|
|
3538
|
+
if (signal?.aborted) return failure2("canceled", false, usage, returnedModel);
|
|
3539
|
+
const { status, retryAfter } = observed;
|
|
3540
|
+
const httpError = { status, retryAfter };
|
|
3541
|
+
const code = status === 401 || status === 403 ? "provider-authorization" : status === 413 ? "provider-context-limit" : status === 429 ? "provider-rate-limit" : status && status >= 400 ? isRetryableHttpError(httpError) ? "provider-unavailable" : "provider-rejected" : status ? "response-contract" : "provider-network";
|
|
3542
|
+
return failure2(code, isRetryableHttpError(httpError), usage, returnedModel, retryAfterDelayMs(httpError));
|
|
3543
|
+
}
|
|
3544
|
+
if (returnedModel !== SENTIMENT_OPENROUTER_SERVED_MODEL) return failure2("model-mismatch", false, usage, returnedModel);
|
|
3545
|
+
if (usage.kind !== "reported") return failure2("response-contract", false, usage, returnedModel);
|
|
3546
|
+
return { ok: true, returnedModel, usage, answers: result.answers };
|
|
3547
|
+
}, signal).catch(() => signal?.aborted ? failure2(signal.reason instanceof DOMException && signal.reason.name === "TimeoutError" ? "provider-timeout" : "canceled", signal.reason instanceof DOMException && signal.reason.name === "TimeoutError") : failure2("provider-network", true));
|
|
3548
|
+
});
|
|
3549
|
+
}
|
|
3550
|
+
|
|
3468
3551
|
// src/sentiment-worker.ts
|
|
3469
3552
|
import { createHash as createHash3, randomUUID } from "crypto";
|
|
3470
3553
|
import { and, asc, eq, gt } from "drizzle-orm";
|
|
@@ -3498,6 +3581,9 @@ function abstentionReason(outcome) {
|
|
|
3498
3581
|
if (outcome === "unsupported-language" || outcome === "ambiguous-judgment") return OutcomeReasonCodes.UNSUPPORTED;
|
|
3499
3582
|
return OutcomeReasonCodes.NO_DATA;
|
|
3500
3583
|
}
|
|
3584
|
+
var applyMentionIdentity = (tx, work) => {
|
|
3585
|
+
refreshSnapshotMentionIdentity(tx, [work.snapshotId]);
|
|
3586
|
+
};
|
|
3501
3587
|
function credentialFingerprint(apiKey) {
|
|
3502
3588
|
return createHash3("sha256").update("canonry-sentiment-credential\0").update(apiKey ?? "").digest("hex");
|
|
3503
3589
|
}
|
|
@@ -3519,7 +3605,7 @@ var SentimentWorker = class {
|
|
|
3519
3605
|
service() {
|
|
3520
3606
|
return new SentimentService(this.db, { install: () => {
|
|
3521
3607
|
const config = this.options.configuration();
|
|
3522
|
-
return { ...sentimentInstallReadiness(config), model: config.model };
|
|
3608
|
+
return { ...sentimentInstallReadiness(config), model: config.model, provider: config.provider };
|
|
3523
3609
|
}, previewSecret: this.owner, now: this.options.now });
|
|
3524
3610
|
}
|
|
3525
3611
|
/** The completion callback is merely a wakeup; receipts make a missed callback recoverable. */
|
|
@@ -3534,7 +3620,7 @@ var SentimentWorker = class {
|
|
|
3534
3620
|
const receipts = this.db.select().from(sentimentCompletionReceipts).where(and(eq(sentimentCompletionReceipts.projectId, settings.projectId), gt(sentimentCompletionReceipts.sequence, start))).orderBy(asc(sentimentCompletionReceipts.sequence)).all();
|
|
3535
3621
|
if (!receipts.length) continue;
|
|
3536
3622
|
const definition = service.definition(settings.evaluationDefinitionId);
|
|
3537
|
-
if (!hasCurrentSentimentTemplate(definition)) continue;
|
|
3623
|
+
if (!hasCurrentSentimentTemplate(definition) || sentimentEvaluatorProvider(definition) !== configuration.provider || definition.requestedModel !== configuration.model) continue;
|
|
3538
3624
|
let reconciled = start;
|
|
3539
3625
|
try {
|
|
3540
3626
|
for (const receipt of receipts) {
|
|
@@ -3626,7 +3712,7 @@ var SentimentWorker = class {
|
|
|
3626
3712
|
const prepared = this.options.prepare?.(input);
|
|
3627
3713
|
if (unavailable || prepared?.ok === false) {
|
|
3628
3714
|
const result2 = { kind: "abstained", outcome: unavailable ?? (prepared.ok === false ? prepared.outcome : "input-too-large"), reason: unavailable ?? (prepared.ok === false ? prepared.reason : "Input unavailable"), returnedModel: null, usage: { kind: "unknown", inputTokens: null, outputTokens: null } };
|
|
3629
|
-
this.repository.completeWork({ workItemId: work.id, owner, outcome: result2.outcome, result: result2, returnedModel: null, now: this.now() });
|
|
3715
|
+
this.repository.completeWork({ workItemId: work.id, owner, outcome: result2.outcome, result: result2, returnedModel: null, now: this.now() }, applyMentionIdentity);
|
|
3630
3716
|
report({ status: OutcomeStatuses.skipped, reasonCode: abstentionReason(result2.outcome) });
|
|
3631
3717
|
return;
|
|
3632
3718
|
}
|
|
@@ -3636,6 +3722,11 @@ var SentimentWorker = class {
|
|
|
3636
3722
|
report({ status: OutcomeStatuses.skipped, reasonCode: OutcomeReasonCodes.NOT_CONNECTED });
|
|
3637
3723
|
return;
|
|
3638
3724
|
}
|
|
3725
|
+
if (sentimentEvaluatorProvider(input.definition) !== config.provider || input.definition.requestedModel !== config.model) {
|
|
3726
|
+
this.repository.failWork({ workItemId: work.id, owner, now: this.now(), errorCode: "EVALUATOR_ROUTE_CHANGED", retryAt: new Date(Date.parse(this.now()) + 6e4).toISOString() });
|
|
3727
|
+
report({ status: OutcomeStatuses.skipped, reasonCode: OutcomeReasonCodes.NOT_CONNECTED });
|
|
3728
|
+
return;
|
|
3729
|
+
}
|
|
3639
3730
|
const settings = this.repository.getSettings(work.projectId);
|
|
3640
3731
|
if (!settings?.enabled || settings.enablementEpoch !== work.enablementEpoch) {
|
|
3641
3732
|
this.repository.cancelProject(work.projectId, this.now());
|
|
@@ -3673,8 +3764,9 @@ var SentimentWorker = class {
|
|
|
3673
3764
|
result = { kind: "failed", outcome: "failed", returnedModel: null, usage: { kind: "unknown", inputTokens: null, outputTokens: null }, error: { code: "CLASSIFIER_TRANSPORT_ERROR", message: "The classifier attempt did not return a usable response.", retryable: true, retryAfterMs: null } };
|
|
3674
3765
|
}
|
|
3675
3766
|
const now = this.now();
|
|
3676
|
-
const
|
|
3677
|
-
|
|
3767
|
+
const evaluatorProvider = sentimentEvaluatorProvider(input.definition);
|
|
3768
|
+
const usage = result.usage.inputTokens !== null && result.usage.outputTokens !== null ? { inputTokens: result.usage.inputTokens, outputTokens: result.usage.outputTokens, ...evaluatorProvider === "typesafe" ? { costMillicents: Math.round(result.usage.inputTokens * 42e-4) } : {} } : void 0;
|
|
3769
|
+
this.repository.finishAttempt({ attemptId: attempt.id, now, provider: evaluatorProvider, returnedModel: result.returnedModel, usageStatus: result.usage.kind, usage, safeFailure: result.kind === "failed" ? result.error.code : null });
|
|
3678
3770
|
const counts = { attempts: attempt.attemptNumber, ...usage ? { inputTokens: usage.inputTokens, outputTokens: usage.outputTokens } : {} };
|
|
3679
3771
|
if (result.kind === "failed") {
|
|
3680
3772
|
const failure2 = transportError ? outcomeFailure(transportError.error) : { reasonCode: CLASSIFIER_FAILURE_REASONS[result.error.code] ?? OutcomeReasonCodes.UNKNOWN };
|
|
@@ -3704,7 +3796,7 @@ var SentimentWorker = class {
|
|
|
3704
3796
|
this.repository.failWork({ workItemId: work.id, owner, now, errorCode: result.error.code, ...result.error.retryable && attempt.attemptNumber - work.attemptBudgetStart < latest.maxAttempts ? { retryAt: new Date(Date.parse(now) + retryMs).toISOString() } : {} });
|
|
3705
3797
|
reportFailed();
|
|
3706
3798
|
} else {
|
|
3707
|
-
this.repository.completeWork({ workItemId: work.id, owner, outcome: result.outcome, result, returnedModel: result.returnedModel, now });
|
|
3799
|
+
this.repository.completeWork({ workItemId: work.id, owner, outcome: result.outcome, result, returnedModel: result.returnedModel, now }, applyMentionIdentity);
|
|
3708
3800
|
this.repository.releaseDispatchPause({ now, dispatchedAt: attempt.dispatchedAt });
|
|
3709
3801
|
report({ status: OutcomeStatuses.succeeded, counts });
|
|
3710
3802
|
}
|
|
@@ -3741,7 +3833,9 @@ function loadSentimentInstallConfig() {
|
|
|
3741
3833
|
const document = parse(fs.readFileSync(getConfigPath(), "utf8"));
|
|
3742
3834
|
const sentiment = isRecord(document) ? document.sentiment : void 0;
|
|
3743
3835
|
if (!isRecord(document) || sentiment != null && !isRecord(sentiment)) return invalidSentimentInstallConfig();
|
|
3744
|
-
|
|
3836
|
+
const providers = isRecord(document.providers) ? document.providers : void 0;
|
|
3837
|
+
const openrouter = providers && isRecord(providers.openrouter) ? providers.openrouter.apiKey : void 0;
|
|
3838
|
+
return resolveSentimentInstallConfig(process.env, sentiment ?? void 0, { openrouter: typeof openrouter === "string" ? openrouter : void 0 });
|
|
3745
3839
|
} catch {
|
|
3746
3840
|
return invalidSentimentInstallConfig();
|
|
3747
3841
|
}
|
|
@@ -4959,7 +5053,7 @@ var UI_EVENT_HOUR_CAPACITY = 600;
|
|
|
4959
5053
|
function createUiTelemetryGate(options = {}) {
|
|
4960
5054
|
const now = options.now ?? Date.now;
|
|
4961
5055
|
const enabled = options.enabled ?? isTelemetryEnabled;
|
|
4962
|
-
const
|
|
5056
|
+
const record = options.record ?? recordDashboardEvent;
|
|
4963
5057
|
const buckets = [
|
|
4964
5058
|
{ capacity: UI_EVENT_MINUTE_CAPACITY, perMs: UI_EVENT_MINUTE_CAPACITY / 6e4, tokens: UI_EVENT_MINUTE_CAPACITY },
|
|
4965
5059
|
{ capacity: UI_EVENT_HOUR_CAPACITY, perMs: UI_EVENT_HOUR_CAPACITY / 36e5, tokens: UI_EVENT_HOUR_CAPACITY }
|
|
@@ -4973,7 +5067,7 @@ function createUiTelemetryGate(options = {}) {
|
|
|
4973
5067
|
for (const bucket of buckets) bucket.tokens = Math.min(bucket.capacity, bucket.tokens + elapsed * bucket.perMs);
|
|
4974
5068
|
if (buckets.some((bucket) => bucket.tokens < 1)) return false;
|
|
4975
5069
|
for (const bucket of buckets) bucket.tokens -= 1;
|
|
4976
|
-
|
|
5070
|
+
record(event);
|
|
4977
5071
|
return true;
|
|
4978
5072
|
};
|
|
4979
5073
|
}
|
|
@@ -4984,7 +5078,7 @@ function nonBlank(value) {
|
|
|
4984
5078
|
return trimmed ? trimmed : void 0;
|
|
4985
5079
|
}
|
|
4986
5080
|
function resolveBuildCommit(env = process.env) {
|
|
4987
|
-
const embedded = true ? "
|
|
5081
|
+
const embedded = true ? "e27d5bf88109fe71ea2bfa3a1456e269ca3370d8" : void 0;
|
|
4988
5082
|
return nonBlank(embedded) ?? nonBlank(env.CANONRY_COMMIT);
|
|
4989
5083
|
}
|
|
4990
5084
|
function resolveInstanceIdentity(env = process.env) {
|
|
@@ -5031,7 +5125,7 @@ function buildRunCompletedProps(input) {
|
|
|
5031
5125
|
const props = {
|
|
5032
5126
|
status: input.status,
|
|
5033
5127
|
providerCount: input.providerCount,
|
|
5034
|
-
providers: [...input.providers],
|
|
5128
|
+
providers: [...new Set(input.providers.map(providerConnectionName))],
|
|
5035
5129
|
queryCount: input.queryCount,
|
|
5036
5130
|
durationMs: totalMs
|
|
5037
5131
|
};
|
|
@@ -5044,7 +5138,7 @@ function buildRunCompletedProps(input) {
|
|
|
5044
5138
|
return props;
|
|
5045
5139
|
}
|
|
5046
5140
|
function runUsageProps(answers) {
|
|
5047
|
-
const counted = answers.filter((answer) => KNOWN_PROVIDERS.has(answer.provider));
|
|
5141
|
+
const counted = answers.map((answer) => ({ ...answer, provider: providerConnectionName(answer.provider) })).filter((answer) => KNOWN_PROVIDERS.has(answer.provider));
|
|
5048
5142
|
if (counted.length === 0) return {};
|
|
5049
5143
|
const providerCalls = {};
|
|
5050
5144
|
for (const answer of [...counted].sort((left, right) => compareText(left.provider, right.provider))) {
|
|
@@ -5064,9 +5158,17 @@ function runUsageProps(answers) {
|
|
|
5064
5158
|
return { providerCalls, usage };
|
|
5065
5159
|
}
|
|
5066
5160
|
function providerLatencyProps(latencies) {
|
|
5161
|
+
const byConnection = /* @__PURE__ */ new Map();
|
|
5162
|
+
for (const [provider, values] of latencies ?? []) {
|
|
5163
|
+
const connection = providerConnectionName(provider);
|
|
5164
|
+
if (!KNOWN_PROVIDERS.has(connection)) continue;
|
|
5165
|
+
const samples = byConnection.get(connection) ?? [];
|
|
5166
|
+
samples.push(...values);
|
|
5167
|
+
byConnection.set(connection, samples);
|
|
5168
|
+
}
|
|
5067
5169
|
const providerLatencyMs = {};
|
|
5068
|
-
for (const [provider, values] of [...
|
|
5069
|
-
const middle =
|
|
5170
|
+
for (const [provider, values] of [...byConnection].sort(([left], [right]) => compareText(left, right))) {
|
|
5171
|
+
const middle = median(values);
|
|
5070
5172
|
if (middle !== null) providerLatencyMs[provider] = Math.max(0, Math.round(middle));
|
|
5071
5173
|
}
|
|
5072
5174
|
return Object.keys(providerLatencyMs).length > 0 ? { providerLatencyMs } : {};
|
|
@@ -5099,32 +5201,42 @@ var MAX_NESTED_KEYS = 12;
|
|
|
5099
5201
|
function buildProviderOutcomeProps(providers, providerErrors, skippedProviders = []) {
|
|
5100
5202
|
if (providerErrors.size === 0 && skippedProviders.length === 0) return {};
|
|
5101
5203
|
const skipped = new Set(skippedProviders);
|
|
5102
|
-
const
|
|
5204
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
5205
|
+
for (const provider of /* @__PURE__ */ new Set([...providers, ...providerErrors.keys(), ...skipped])) {
|
|
5206
|
+
const name = providerConnectionName(provider);
|
|
5207
|
+
grouped.set(name, [...grouped.get(name) ?? [], provider]);
|
|
5208
|
+
}
|
|
5103
5209
|
const providerOutcomes = {};
|
|
5104
5210
|
const providerHttpStatus = {};
|
|
5105
|
-
for (const name of
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
}
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
providerOutcomes[name] = "ok";
|
|
5211
|
+
for (const [name, routes] of [...grouped].slice(0, MAX_NESTED_KEYS)) {
|
|
5212
|
+
const failures = routes.flatMap((route) => {
|
|
5213
|
+
const message2 = providerErrors.get(route);
|
|
5214
|
+
return !skipped.has(route) && message2 !== void 0 ? [{ message: message2, code: classifyProviderErrorMessage(message2) }] : [];
|
|
5215
|
+
});
|
|
5216
|
+
if (failures.length === 0) {
|
|
5217
|
+
providerOutcomes[name] = routes.every((route) => skipped.has(route)) ? "skipped" : "ok";
|
|
5113
5218
|
continue;
|
|
5114
5219
|
}
|
|
5115
|
-
|
|
5220
|
+
const code = mostActionableProviderErrorCode(failures.map((failure2) => failure2.code));
|
|
5221
|
+
const message = failures.find((failure2) => failure2.code === code).message;
|
|
5222
|
+
providerOutcomes[name] = code;
|
|
5116
5223
|
const status = extractProviderHttpStatus(message);
|
|
5117
5224
|
if (status !== void 0) providerHttpStatus[name] = status;
|
|
5118
5225
|
}
|
|
5119
5226
|
return Object.keys(providerHttpStatus).length > 0 ? { providerOutcomes, providerHttpStatus } : { providerOutcomes };
|
|
5120
5227
|
}
|
|
5121
5228
|
function buildRunRefusedProps(input) {
|
|
5122
|
-
const outcomes =
|
|
5229
|
+
const outcomes = /* @__PURE__ */ new Map();
|
|
5230
|
+
for (const [provider, code] of Object.entries(input.providers)) {
|
|
5231
|
+
const name = providerConnectionName(provider);
|
|
5232
|
+
const previous = outcomes.get(name);
|
|
5233
|
+
outcomes.set(name, previous === void 0 ? code : mostActionableProviderErrorCode([previous, code]));
|
|
5234
|
+
}
|
|
5123
5235
|
const props = {
|
|
5124
5236
|
reason: "providers_failing",
|
|
5125
5237
|
providerCount: Object.keys(input.providers).length,
|
|
5126
|
-
providers:
|
|
5127
|
-
providerOutcomes: Object.fromEntries(outcomes),
|
|
5238
|
+
providers: [...outcomes.keys()],
|
|
5239
|
+
providerOutcomes: Object.fromEntries([...outcomes].slice(0, MAX_NESTED_KEYS)),
|
|
5128
5240
|
trigger: input.trigger
|
|
5129
5241
|
};
|
|
5130
5242
|
const domainHash = hashDomain(input.canonicalDomain ?? null);
|
|
@@ -5160,83 +5272,6 @@ function failureStreakSampling(status, priorStreak, runId) {
|
|
|
5160
5272
|
};
|
|
5161
5273
|
}
|
|
5162
5274
|
|
|
5163
|
-
// src/provider-execution-gate.ts
|
|
5164
|
-
var ProviderExecutionGate = class {
|
|
5165
|
-
constructor(maxConcurrency, maxPerMinute) {
|
|
5166
|
-
this.maxConcurrency = maxConcurrency;
|
|
5167
|
-
this.maxPerMinute = maxPerMinute;
|
|
5168
|
-
}
|
|
5169
|
-
maxConcurrency;
|
|
5170
|
-
maxPerMinute;
|
|
5171
|
-
window = [];
|
|
5172
|
-
waiters = [];
|
|
5173
|
-
rateTimer;
|
|
5174
|
-
dispatching = false;
|
|
5175
|
-
inFlight = 0;
|
|
5176
|
-
updatePolicy(maxConcurrency, maxPerMinute) {
|
|
5177
|
-
this.maxConcurrency = maxConcurrency;
|
|
5178
|
-
this.maxPerMinute = maxPerMinute;
|
|
5179
|
-
this.dispatchQueued();
|
|
5180
|
-
}
|
|
5181
|
-
async run(task) {
|
|
5182
|
-
return new Promise((resolve, reject) => {
|
|
5183
|
-
this.waiters.push(() => {
|
|
5184
|
-
void this.execute(task, resolve, reject);
|
|
5185
|
-
});
|
|
5186
|
-
this.dispatchQueued();
|
|
5187
|
-
});
|
|
5188
|
-
}
|
|
5189
|
-
async execute(task, resolve, reject) {
|
|
5190
|
-
try {
|
|
5191
|
-
resolve(await task());
|
|
5192
|
-
} catch (error) {
|
|
5193
|
-
reject(error);
|
|
5194
|
-
} finally {
|
|
5195
|
-
this.inFlight--;
|
|
5196
|
-
this.dispatchQueued();
|
|
5197
|
-
}
|
|
5198
|
-
}
|
|
5199
|
-
dispatchQueued() {
|
|
5200
|
-
if (this.dispatching) return;
|
|
5201
|
-
if (this.rateTimer !== void 0) {
|
|
5202
|
-
clearTimeout(this.rateTimer);
|
|
5203
|
-
this.rateTimer = void 0;
|
|
5204
|
-
}
|
|
5205
|
-
this.dispatching = true;
|
|
5206
|
-
try {
|
|
5207
|
-
while (this.waiters.length > 0 && this.inFlight < Math.max(1, this.maxConcurrency)) {
|
|
5208
|
-
const now = Date.now();
|
|
5209
|
-
const windowStart = now - 6e4;
|
|
5210
|
-
while (this.window.length > 0 && this.window[0] < windowStart) this.window.shift();
|
|
5211
|
-
if (this.window.length >= this.maxPerMinute) break;
|
|
5212
|
-
this.window.push(now);
|
|
5213
|
-
this.inFlight++;
|
|
5214
|
-
this.waiters.shift()();
|
|
5215
|
-
}
|
|
5216
|
-
} finally {
|
|
5217
|
-
this.dispatching = false;
|
|
5218
|
-
}
|
|
5219
|
-
if (this.waiters.length > 0 && this.inFlight < Math.max(1, this.maxConcurrency)) {
|
|
5220
|
-
this.rateTimer = setTimeout(() => {
|
|
5221
|
-
this.rateTimer = void 0;
|
|
5222
|
-
this.dispatchQueued();
|
|
5223
|
-
}, this.window[0] + 6e4 - Date.now() + 50);
|
|
5224
|
-
}
|
|
5225
|
-
}
|
|
5226
|
-
};
|
|
5227
|
-
var sharedGates = /* @__PURE__ */ new Map();
|
|
5228
|
-
function getSharedProviderExecutionGate(providerName, maxConcurrency, maxPerMinute) {
|
|
5229
|
-
const key = providerName.trim().toLocaleLowerCase("en");
|
|
5230
|
-
const existing = sharedGates.get(key);
|
|
5231
|
-
if (existing) return existing;
|
|
5232
|
-
const gate = new ProviderExecutionGate(maxConcurrency, maxPerMinute);
|
|
5233
|
-
sharedGates.set(key, gate);
|
|
5234
|
-
return gate;
|
|
5235
|
-
}
|
|
5236
|
-
function updateSharedProviderExecutionGate(providerName, maxConcurrency, maxPerMinute) {
|
|
5237
|
-
getSharedProviderExecutionGate(providerName, maxConcurrency, maxPerMinute).updatePolicy(maxConcurrency, maxPerMinute);
|
|
5238
|
-
}
|
|
5239
|
-
|
|
5240
5275
|
// src/usage-quota.ts
|
|
5241
5276
|
import crypto5 from "crypto";
|
|
5242
5277
|
import { and as and2, eq as eq2, lte, sql } from "drizzle-orm";
|
|
@@ -5279,7 +5314,7 @@ var RESOLUTION_TIMEOUT_MS = 5e3;
|
|
|
5279
5314
|
var MAX_VERTEX_PROXY_HOPS = 3;
|
|
5280
5315
|
var REDIRECT_STATUSES = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
|
|
5281
5316
|
function isRouteCapableProvider(provider) {
|
|
5282
|
-
return ROUTE_CAPABLE_CITED_URL_PROVIDERS.includes(provider);
|
|
5317
|
+
return isOpenRouterRoute(provider) || ROUTE_CAPABLE_CITED_URL_PROVIDERS.includes(provider);
|
|
5283
5318
|
}
|
|
5284
5319
|
function parseHttpUrl(value, base) {
|
|
5285
5320
|
try {
|
|
@@ -5507,8 +5542,7 @@ function resolvePlanExecution(run, projectQueries) {
|
|
|
5507
5542
|
return {
|
|
5508
5543
|
manifest,
|
|
5509
5544
|
unitsByProvider,
|
|
5510
|
-
nodeCount: nodes.size
|
|
5511
|
-
maxUnitsPerProvider: Math.max(0, ...[...unitsByProvider.values()].map((units) => units.length))
|
|
5545
|
+
nodeCount: nodes.size
|
|
5512
5546
|
};
|
|
5513
5547
|
}
|
|
5514
5548
|
function resolveProviderFanout() {
|
|
@@ -5795,10 +5829,10 @@ var JobRunner = class {
|
|
|
5795
5829
|
...runTrigger ? { trigger: runTrigger } : {},
|
|
5796
5830
|
...canonicalDomain ? { canonicalDomain } : {}
|
|
5797
5831
|
};
|
|
5798
|
-
const queriesPerProvider = planExecution?.maxUnitsPerProvider ?? projectQueries.length;
|
|
5799
5832
|
const todayPeriod = getCurrentUsageDay();
|
|
5800
5833
|
for (const p of calledProviders) {
|
|
5801
|
-
const
|
|
5834
|
+
const queriesPerProvider = planExecution ? planExecution.unitsByProvider.get(p.adapter.name)?.length ?? 0 : projectQueries.length;
|
|
5835
|
+
const providerScope = `${projectId}:${providerConnectionName(p.adapter.name)}`;
|
|
5802
5836
|
const limit = p.config.quotaPolicy.maxRequestsPerDay;
|
|
5803
5837
|
const quota = reserveDailyQueryQuota(this.db, { scope: providerScope, period: todayPeriod, count: queriesPerProvider, limit });
|
|
5804
5838
|
if (!quota.reserved) {
|
|
@@ -5899,7 +5933,7 @@ var JobRunner = class {
|
|
|
5899
5933
|
allBrandNames,
|
|
5900
5934
|
competitorAliases
|
|
5901
5935
|
);
|
|
5902
|
-
const answerLocation = runLocation && isSearchLocationIgnored(providerName, normalized.retrievalStatus) ? { location: null, requestedContext: runLocation, supportedContext: { status: "ignored" } } : { location: runLocation?.label ?? null };
|
|
5936
|
+
const answerLocation = runLocation && (isOpenRouterRoute(providerName) || isSearchLocationIgnored(providerName, normalized.retrievalStatus)) ? { location: null, requestedContext: runLocation, supportedContext: { status: "ignored" } } : { location: runLocation?.label ?? null };
|
|
5903
5937
|
let screenshotRelPath = null;
|
|
5904
5938
|
if (raw.screenshotPath && fs3.existsSync(raw.screenshotPath)) {
|
|
5905
5939
|
const snapshotId = crypto6.randomUUID();
|
|
@@ -6172,7 +6206,7 @@ var JobRunner = class {
|
|
|
6172
6206
|
trackEvent("run.aborted", {
|
|
6173
6207
|
reason: abortReason2,
|
|
6174
6208
|
providerCount: executionContext.providerCount,
|
|
6175
|
-
providers: executionContext.providers,
|
|
6209
|
+
providers: [...new Set(executionContext.providers.map(providerConnectionName))],
|
|
6176
6210
|
queryCount: executionContext.queryCount,
|
|
6177
6211
|
durationMs: Date.now() - startTime,
|
|
6178
6212
|
...executionContext.trigger ? { trigger: executionContext.trigger } : {},
|
|
@@ -7002,7 +7036,7 @@ var JobRunner = class {
|
|
|
7002
7036
|
for (const registered of activeProviders) {
|
|
7003
7037
|
const name = registered.adapter.name;
|
|
7004
7038
|
const count4 = unitsByProvider.get(name)?.length ?? 0;
|
|
7005
|
-
const scope = `${projectId}:${name}`;
|
|
7039
|
+
const scope = `${projectId}:${providerConnectionName(name)}`;
|
|
7006
7040
|
const limit = registered.config.quotaPolicy.maxRequestsPerDay;
|
|
7007
7041
|
const quota = reserveDailyQueryQuota(this.db, { scope, period: todayPeriod, count: count4, limit });
|
|
7008
7042
|
if (!quota.reserved) {
|
|
@@ -7210,7 +7244,7 @@ var JobRunner = class {
|
|
|
7210
7244
|
const providerName = adapter.name;
|
|
7211
7245
|
const { domains: competitorDomains, aliases: competitorAliases } = ctx.competitorsFor(unit.executionId);
|
|
7212
7246
|
const requestedContext = unit.context;
|
|
7213
|
-
const supportedContext = requestedContext && providerSupportsLocationContext(adapter) ? { status: "applied", resolved: requestedContext } : null;
|
|
7247
|
+
const supportedContext = requestedContext && providerSupportsLocationContext(adapter) ? { status: "applied", resolved: requestedContext } : requestedContext && isOpenRouterRoute(providerName) ? { status: "ignored" } : null;
|
|
7214
7248
|
this.throwIfRunCancelled(ctx.runId);
|
|
7215
7249
|
const providerResult = adapter.normalizeResult(raw);
|
|
7216
7250
|
const rawGroundingSources = providerResult.groundingSources;
|
|
@@ -10423,8 +10457,10 @@ async function executeDiscoveryRun(opts) {
|
|
|
10423
10457
|
canonicalDomains,
|
|
10424
10458
|
competitorDomains: projectCompetitors
|
|
10425
10459
|
};
|
|
10460
|
+
const classifierConfig = opts.getClassifierConfig?.() ?? opts.classifierConfig;
|
|
10461
|
+
await refreshAgentModels(classifierConfig?.classification?.provider);
|
|
10426
10462
|
notConfigured = true;
|
|
10427
|
-
const deps = buildDefaultDeps(opts.registry);
|
|
10463
|
+
const deps = buildDefaultDeps(opts.registry, classifierConfig);
|
|
10428
10464
|
notConfigured = false;
|
|
10429
10465
|
const result = await executeDiscovery({
|
|
10430
10466
|
db: opts.db,
|
|
@@ -10480,7 +10516,7 @@ async function executeDiscoveryRun(opts) {
|
|
|
10480
10516
|
});
|
|
10481
10517
|
}
|
|
10482
10518
|
}
|
|
10483
|
-
function buildDefaultDeps(registry) {
|
|
10519
|
+
function buildDefaultDeps(registry, classifierConfig) {
|
|
10484
10520
|
const gemini = registry.get("gemini");
|
|
10485
10521
|
if (!gemini) {
|
|
10486
10522
|
throw new Error("Gemini provider is not configured. Add a Gemini API key (or Vertex project) before running discovery.");
|
|
@@ -10490,6 +10526,9 @@ function buildDefaultDeps(registry) {
|
|
|
10490
10526
|
throw new Error("Gemini provider is missing both apiKey and vertexProject \u2014 cannot run discovery.");
|
|
10491
10527
|
}
|
|
10492
10528
|
const adapter = gemini.adapter;
|
|
10529
|
+
const classifierProvider = classifierConfig?.classification?.provider ?? AgentProviderIds.gemini;
|
|
10530
|
+
const classifierModel = classifierConfig?.classification ? resolveModelForCapability(classifierProvider, LlmCapabilities.classify, classifierConfig.classification.model) : void 0;
|
|
10531
|
+
const classifierKey = resolveApiKeyFor(classifierProvider, classifierConfig ?? { providers: { gemini: { apiKey: cfg.apiKey } } });
|
|
10493
10532
|
function seedProviderFor(name) {
|
|
10494
10533
|
if (name === "gemini") return { adapter, config: cfg };
|
|
10495
10534
|
const entry = registry.get(name);
|
|
@@ -10570,8 +10609,19 @@ function buildDefaultDeps(registry) {
|
|
|
10570
10609
|
},
|
|
10571
10610
|
async classifyDomains(input) {
|
|
10572
10611
|
const prompt = buildClassificationPrompt(input);
|
|
10573
|
-
|
|
10574
|
-
|
|
10612
|
+
if (!classifierModel) {
|
|
10613
|
+
const text2 = await adapter.generateText(prompt, cfg);
|
|
10614
|
+
return { classifications: parseClassificationResponse(text2, input.domains), evaluator: { provider: "gemini", requestedModel: cfg.model ?? adapter.modelRegistry.defaultModel, servedModel: null, promptVersion: "domain-category-v1" } };
|
|
10615
|
+
}
|
|
10616
|
+
if (!classifierKey) throw new Error("The configured domain classifier has no API key.");
|
|
10617
|
+
const quota = registry.get(classifierProvider)?.config.quotaPolicy ?? cfg.quotaPolicy;
|
|
10618
|
+
const generate = () => completeOnce(classifierModel, {
|
|
10619
|
+
messages: [{ role: "user", content: prompt, timestamp: Date.now() }]
|
|
10620
|
+
}, { apiKey: classifierKey });
|
|
10621
|
+
const response = classifierProvider === AgentProviderIds.openrouter ? await generate() : await getSharedProviderExecutionGate(classifierProvider, quota.maxConcurrency, quota.maxRequestsPerMinute).run(generate);
|
|
10622
|
+
if (response.stopReason === "error" || response.stopReason === "aborted") throw new Error("The domain classifier did not complete.");
|
|
10623
|
+
const text = response.content.filter((part) => part.type === "text").map((part) => part.text).join("\n");
|
|
10624
|
+
return { classifications: parseClassificationResponse(text, input.domains), evaluator: { provider: classifierProvider, requestedModel: classifierModel.id, servedModel: response.responseModel ?? null, promptVersion: "domain-category-v1" } };
|
|
10575
10625
|
}
|
|
10576
10626
|
};
|
|
10577
10627
|
}
|
|
@@ -11898,22 +11948,37 @@ var ProviderRegistry = class {
|
|
|
11898
11948
|
}
|
|
11899
11949
|
}
|
|
11900
11950
|
get(name) {
|
|
11901
|
-
|
|
11951
|
+
const registered = this.providers.get(name);
|
|
11952
|
+
if (registered) return registered;
|
|
11953
|
+
const model = openRouterRouteModel(name);
|
|
11954
|
+
const connection = model ? this.providers.get(providerConnectionName(name)) : void 0;
|
|
11955
|
+
if (!connection || !model) return void 0;
|
|
11956
|
+
const config = { ...connection.config, provider: name, model };
|
|
11957
|
+
return {
|
|
11958
|
+
config,
|
|
11959
|
+
adapter: {
|
|
11960
|
+
...connection.adapter,
|
|
11961
|
+
name,
|
|
11962
|
+
displayName: `${model} \xB7 OpenRouter`,
|
|
11963
|
+
modelRegistry: { ...connection.adapter.modelRegistry, defaultModel: model },
|
|
11964
|
+
parseTrackedQueryResponse: connection.adapter.parseTrackedQueryResponse ? (body, requestedModel) => ({ ...connection.adapter.parseTrackedQueryResponse(body, requestedModel), provider: name }) : void 0
|
|
11965
|
+
}
|
|
11966
|
+
};
|
|
11902
11967
|
}
|
|
11903
11968
|
getAll() {
|
|
11904
11969
|
return [...this.providers.values()];
|
|
11905
11970
|
}
|
|
11906
11971
|
getForProject(projectProviders) {
|
|
11907
11972
|
if (projectProviders.length === 0) {
|
|
11908
|
-
return this.getAll();
|
|
11973
|
+
return this.getAll().filter((provider) => isSweepProvider(provider.adapter.name));
|
|
11909
11974
|
}
|
|
11910
11975
|
const result = [];
|
|
11911
11976
|
const seen = /* @__PURE__ */ new Set();
|
|
11912
11977
|
for (const name of projectProviders) {
|
|
11913
11978
|
if (seen.has(name)) continue;
|
|
11914
11979
|
seen.add(name);
|
|
11915
|
-
const provider = this.
|
|
11916
|
-
if (provider) {
|
|
11980
|
+
const provider = this.get(name);
|
|
11981
|
+
if (provider && isSweepProvider(provider.adapter.name)) {
|
|
11917
11982
|
result.push(provider);
|
|
11918
11983
|
}
|
|
11919
11984
|
}
|
|
@@ -11925,7 +11990,7 @@ var ProviderRegistry = class {
|
|
|
11925
11990
|
}
|
|
11926
11991
|
/** Get only API-based providers */
|
|
11927
11992
|
getApiProviders() {
|
|
11928
|
-
return this.getAll().filter((p) => !isBrowserProvider(p.adapter.name));
|
|
11993
|
+
return this.getAll().filter((p) => !isBrowserProvider(p.adapter.name) && isSweepProvider(p.adapter.name));
|
|
11929
11994
|
}
|
|
11930
11995
|
get size() {
|
|
11931
11996
|
return this.providers.size;
|
|
@@ -12011,8 +12076,10 @@ function buildInstallState(sources, now, startedAt) {
|
|
|
12011
12076
|
if (isCdpProviderRegistrable(config.cdp)) connected.add(IntegrationNames.cdp);
|
|
12012
12077
|
const providerCalls = /* @__PURE__ */ new Map();
|
|
12013
12078
|
const addCalls = (provider, calls) => {
|
|
12014
|
-
if (!provider ||
|
|
12015
|
-
|
|
12079
|
+
if (!provider || calls <= 0) return;
|
|
12080
|
+
const connection = providerConnectionName(provider);
|
|
12081
|
+
if (!KNOWN_PROVIDERS2.has(connection)) return;
|
|
12082
|
+
providerCalls.set(connection, (providerCalls.get(connection) ?? 0) + calls);
|
|
12016
12083
|
};
|
|
12017
12084
|
const usagePath = (field) => sql7`json_extract(${querySnapshots.usage}, ${`$.${field}`})`;
|
|
12018
12085
|
const answers = db.select({
|
|
@@ -12236,8 +12303,8 @@ var RETRY_MS = 60 * 1e3;
|
|
|
12236
12303
|
var TIMEOUT_MS2 = 3e3;
|
|
12237
12304
|
function createProviderModelCatalog(registry) {
|
|
12238
12305
|
const cache = /* @__PURE__ */ new Map();
|
|
12239
|
-
const read = async (name) => {
|
|
12240
|
-
const provider = registry.get(name);
|
|
12306
|
+
const read = async (name, unregistered) => {
|
|
12307
|
+
const provider = registry.get(name) ?? unregistered?.();
|
|
12241
12308
|
if (!provider) {
|
|
12242
12309
|
cache.delete(name);
|
|
12243
12310
|
return [];
|
|
@@ -12279,14 +12346,21 @@ function createProviderModelCatalog(registry) {
|
|
|
12279
12346
|
});
|
|
12280
12347
|
return current.pending;
|
|
12281
12348
|
};
|
|
12282
|
-
const cached = (name) => {
|
|
12283
|
-
const provider = registry.get(name);
|
|
12349
|
+
const cached = (name, unregistered) => {
|
|
12350
|
+
const provider = registry.get(name) ?? unregistered?.();
|
|
12284
12351
|
if (!provider) return [];
|
|
12285
12352
|
const entry = cache.get(name);
|
|
12286
12353
|
const identity = createHash5("sha256").update(JSON.stringify(provider.config)).digest("hex");
|
|
12287
12354
|
return (entry?.identity === identity ? entry.models : void 0) ?? provider.adapter.modelRegistry.knownModels;
|
|
12288
12355
|
};
|
|
12289
|
-
return Object.assign(read, {
|
|
12356
|
+
return Object.assign((name) => read(name), {
|
|
12357
|
+
cached: (name) => cached(name),
|
|
12358
|
+
/** The same reads, falling back to `unregistered` when the registry has no connection under the name. */
|
|
12359
|
+
orUnregistered: (unregistered) => ({
|
|
12360
|
+
read: (name) => read(name, unregistered),
|
|
12361
|
+
cached: (name) => cached(name, unregistered)
|
|
12362
|
+
})
|
|
12363
|
+
});
|
|
12290
12364
|
}
|
|
12291
12365
|
|
|
12292
12366
|
// src/scheduler.ts
|
|
@@ -13111,9 +13185,9 @@ function gaRefreshDays(now = /* @__PURE__ */ new Date()) {
|
|
|
13111
13185
|
return Math.max(30, reach);
|
|
13112
13186
|
}
|
|
13113
13187
|
function queuedRun(result) {
|
|
13114
|
-
const
|
|
13115
|
-
const runId =
|
|
13116
|
-
const runStatus =
|
|
13188
|
+
const record = asRecord(result);
|
|
13189
|
+
const runId = record?.runId ?? record?.id;
|
|
13190
|
+
const runStatus = record?.status;
|
|
13117
13191
|
return {
|
|
13118
13192
|
runId: typeof runId === "string" ? runId : null,
|
|
13119
13193
|
runStatus: typeof runStatus === "string" ? runStatus : null
|
|
@@ -15086,6 +15160,8 @@ ${lines.join("\n")}
|
|
|
15086
15160
|
* that names no provider returns to it.
|
|
15087
15161
|
*/
|
|
15088
15162
|
async acquireForTurn(projectName, preferences) {
|
|
15163
|
+
preferences?.signal?.throwIfAborted();
|
|
15164
|
+
await refreshAgentModels(this.turnProvider(projectName, preferences), preferences?.signal);
|
|
15089
15165
|
preferences?.signal?.throwIfAborted();
|
|
15090
15166
|
if (this.acquisitions.has(projectName)) throw agentBusy(projectName);
|
|
15091
15167
|
const agent = this.getOrCreate(projectName, preferences);
|
|
@@ -15222,11 +15298,31 @@ ${lines.join("\n")}
|
|
|
15222
15298
|
const stored = coerceAgentProvider(current.provider ?? void 0);
|
|
15223
15299
|
const provider = preferences?.provider ?? pinned ?? stored ?? detectAgentProvider(this.opts.config);
|
|
15224
15300
|
if (!provider) throw new Error(missingProviderMessage());
|
|
15225
|
-
const carried = !preferences?.provider && !pinned && provider === current.provider && current.modelId && isAgentModelAvailable(provider, current.modelId) ? current.modelId : void 0;
|
|
15301
|
+
const carried = !preferences?.provider && !pinned && provider === current.provider && current.modelId && (isAgentModelAvailable(provider, current.modelId) || isAgentModelUnchecked(provider, current.modelId) && !!resolveApiKeyFor(provider, this.opts.config)) ? current.modelId : void 0;
|
|
15226
15302
|
const pinnedModelId = provider === pinned ? this.opts.config.agent?.model ?? void 0 : void 0;
|
|
15227
15303
|
const modelId = preferences?.modelId ?? pinnedModelId ?? carried ?? getAgentProvider(provider).defaultModel;
|
|
15228
15304
|
return { provider, modelId };
|
|
15229
15305
|
}
|
|
15306
|
+
/** The provider the next turn would run on; undefined when none can (the turn then fails as before). */
|
|
15307
|
+
turnProvider(projectName, preferences) {
|
|
15308
|
+
return this.nextTurnModel(projectName, preferences)?.provider;
|
|
15309
|
+
}
|
|
15310
|
+
/**
|
|
15311
|
+
* The provider and model the next turn would run on, resolved exactly as the
|
|
15312
|
+
* turn resolves them: a request's choice, then the `agent.provider` pin, then
|
|
15313
|
+
* the conversation's stored model, then the provider default. With no
|
|
15314
|
+
* preferences this is what the dashboard shows when the operator has picked
|
|
15315
|
+
* nothing. Null when no provider can run.
|
|
15316
|
+
*/
|
|
15317
|
+
nextTurnModel(projectName, preferences) {
|
|
15318
|
+
const projectId = this.tryResolveProjectId(projectName);
|
|
15319
|
+
const row = projectId ? this.loadRow(projectId) : null;
|
|
15320
|
+
try {
|
|
15321
|
+
return this.resolveTurnModel(preferences, { provider: row?.modelProvider, modelId: row?.modelId });
|
|
15322
|
+
} catch {
|
|
15323
|
+
return null;
|
|
15324
|
+
}
|
|
15325
|
+
}
|
|
15230
15326
|
alignModel(projectName, agent, preferences) {
|
|
15231
15327
|
const projectId = this.tryResolveProjectId(projectName);
|
|
15232
15328
|
if (!projectId) return;
|
|
@@ -15237,7 +15333,7 @@ ${lines.join("\n")}
|
|
|
15237
15333
|
const { provider: nextProvider, modelId: nextModelId } = this.resolveTurnModel(preferences, { provider: row.modelProvider, modelId: row.modelId });
|
|
15238
15334
|
if (nextProvider === currentProvider && nextModelId === currentModelId) return;
|
|
15239
15335
|
agent.state.model = resolveAeroModel(nextProvider, nextModelId);
|
|
15240
|
-
agent.state.thinkingLevel = resolveAgentReasoning(process.env, this.opts.config, nextProvider);
|
|
15336
|
+
agent.state.thinkingLevel = resolveAgentReasoning(process.env, this.opts.config, nextProvider, agent.state.model.id);
|
|
15241
15337
|
this.opts.db.update(agentSessions).set({
|
|
15242
15338
|
modelProvider: nextProvider,
|
|
15243
15339
|
modelId: nextModelId,
|
|
@@ -15432,12 +15528,13 @@ ${lines.join("\n")}
|
|
|
15432
15528
|
}
|
|
15433
15529
|
insertRow(params) {
|
|
15434
15530
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
15531
|
+
const modelProvider = params.provider ?? params.modelProvider ?? AgentProviderIds.claude;
|
|
15435
15532
|
this.opts.db.insert(agentSessions).values({
|
|
15436
15533
|
id: params.id ?? crypto23.randomUUID(),
|
|
15437
15534
|
projectId: params.projectId,
|
|
15438
15535
|
systemPrompt: params.systemPrompt,
|
|
15439
|
-
modelProvider
|
|
15440
|
-
modelId: params.modelId ??
|
|
15536
|
+
modelProvider,
|
|
15537
|
+
modelId: params.modelId ?? getAgentProvider(coerceAgentProvider(modelProvider) ?? AgentProviderIds.claude).defaultModel,
|
|
15441
15538
|
messages: JSON.stringify(withoutPersistedToolDetails(params.messages)),
|
|
15442
15539
|
followUpQueue: JSON.stringify(params.followUpQueue),
|
|
15443
15540
|
createdAt: now,
|
|
@@ -15581,7 +15678,7 @@ var ViewerAeroSessions = class {
|
|
|
15581
15678
|
let handedOff = false;
|
|
15582
15679
|
try {
|
|
15583
15680
|
const client = new ApiClient(this.opts.selfApiUrl, minted.raw, { skipProbe: true, surface: "aero" });
|
|
15584
|
-
const agent = this.sessions.get(key)?.agent ?? this.createAgent(project, client);
|
|
15681
|
+
const agent = this.sessions.get(key)?.agent ?? await this.createAgent(project, client, preferences.signal);
|
|
15585
15682
|
agent.state.messages = trimViewerTranscript(agent.state.messages.filter((message) => message.role !== "system"));
|
|
15586
15683
|
const view = { client, projectName: project.name, basePath: this.opts.config.basePath, context: preferences.context };
|
|
15587
15684
|
const evidence = preferences.context ? await readAeroViewEvidence(view) : void 0;
|
|
@@ -15615,8 +15712,9 @@ var ViewerAeroSessions = class {
|
|
|
15615
15712
|
}
|
|
15616
15713
|
}
|
|
15617
15714
|
}
|
|
15618
|
-
createAgent(project, client) {
|
|
15715
|
+
async createAgent(project, client, signal) {
|
|
15619
15716
|
const { provider, modelId } = resolveSessionProviderAndModel(this.opts.config);
|
|
15717
|
+
await refreshAgentModels(provider, signal);
|
|
15620
15718
|
return createAeroSession({
|
|
15621
15719
|
projectName: project.name,
|
|
15622
15720
|
client,
|
|
@@ -16038,8 +16136,9 @@ function registerAgentRoutes(app, opts) {
|
|
|
16038
16136
|
requireInstanceAdministrator(request);
|
|
16039
16137
|
const project = resolveProject(opts.db, request.params.name);
|
|
16040
16138
|
const row = opts.db.select().from(agentSessions).where(eq28(agentSessions.projectId, project.id)).get();
|
|
16139
|
+
const nextTurn = opts.sessionRegistry.nextTurnModel(project.name);
|
|
16041
16140
|
if (!row) {
|
|
16042
|
-
return { conversationId: null, messages: [], modelProvider: null, modelId: null, updatedAt: null };
|
|
16141
|
+
return { conversationId: null, messages: [], modelProvider: null, modelId: null, nextTurn, updatedAt: null };
|
|
16043
16142
|
}
|
|
16044
16143
|
const messages = parseJsonColumn(row.messages, []);
|
|
16045
16144
|
return {
|
|
@@ -16048,6 +16147,7 @@ function registerAgentRoutes(app, opts) {
|
|
|
16048
16147
|
isStreaming: opts.sessionRegistry.isBusy(project.name),
|
|
16049
16148
|
modelProvider: row.modelProvider,
|
|
16050
16149
|
modelId: row.modelId,
|
|
16150
|
+
nextTurn,
|
|
16051
16151
|
updatedAt: row.updatedAt
|
|
16052
16152
|
};
|
|
16053
16153
|
}
|
|
@@ -16057,7 +16157,7 @@ function registerAgentRoutes(app, opts) {
|
|
|
16057
16157
|
async (request) => {
|
|
16058
16158
|
requireInstanceAdministrator(request);
|
|
16059
16159
|
resolveProject(opts.db, request.params.name);
|
|
16060
|
-
return buildAgentProvidersResponse(opts.sessionRegistry.getConfig());
|
|
16160
|
+
return buildAgentProvidersResponse(opts.sessionRegistry.getConfig(), { models: true });
|
|
16061
16161
|
}
|
|
16062
16162
|
);
|
|
16063
16163
|
app.delete(
|
|
@@ -16288,6 +16388,7 @@ function pickExplainProvider(config, providerOverride) {
|
|
|
16288
16388
|
function createRecommendationExplainer(opts) {
|
|
16289
16389
|
return async (input) => {
|
|
16290
16390
|
const provider = pickExplainProvider(opts.config, input.providerOverride);
|
|
16391
|
+
await refreshAgentModels(provider);
|
|
16291
16392
|
const model = resolveModelForCapability(provider, "analyze", input.modelOverride);
|
|
16292
16393
|
const prompt = buildRecommendationPrompt({
|
|
16293
16394
|
projectName: input.projectName,
|
|
@@ -16366,6 +16467,7 @@ function parseBrief(text, recommendation) {
|
|
|
16366
16467
|
function createRecommendationBriefSynthesizer(opts) {
|
|
16367
16468
|
return async (input) => {
|
|
16368
16469
|
const provider = pickExplainProvider(opts.config, input.providerOverride);
|
|
16470
|
+
await refreshAgentModels(provider);
|
|
16369
16471
|
const model = resolveModelForCapability(provider, "analyze", input.modelOverride);
|
|
16370
16472
|
const apiKey = resolveApiKeyFor(provider, opts.config);
|
|
16371
16473
|
const prompt = buildBriefPrompt({
|
|
@@ -16525,9 +16627,10 @@ var SnapshotService = class {
|
|
|
16525
16627
|
const manualCompetitors = normalizeStringList(input.competitors ?? []);
|
|
16526
16628
|
const requestedNames = input.providers === void 0 ? void 0 : [...new Set(input.providers)];
|
|
16527
16629
|
const mode = input.providerMode ?? SnapshotProviderModes.all;
|
|
16528
|
-
const providers = requestedNames === void 0 ? this.registry.getAll().filter((provider) => mode === SnapshotProviderModes.all || provider.adapter.mode === mode) : requestedNames.map((name) => {
|
|
16630
|
+
const providers = requestedNames === void 0 ? this.registry.getAll().filter((provider) => isSweepProvider(provider.adapter.name) && (mode === SnapshotProviderModes.all || provider.adapter.mode === mode)) : requestedNames.map((name) => {
|
|
16529
16631
|
const provider = this.registry.get(name);
|
|
16530
16632
|
if (!provider) throw validationError(`Snapshot provider "${name}" is not configured`);
|
|
16633
|
+
if (!isSweepProvider(name)) throw validationError("Select a concrete OpenRouter model for the snapshot");
|
|
16531
16634
|
if (mode !== SnapshotProviderModes.all && provider.adapter.mode !== mode) {
|
|
16532
16635
|
throw validationError(`Snapshot provider "${name}" does not match providerMode "${mode}"`);
|
|
16533
16636
|
}
|
|
@@ -17064,7 +17167,7 @@ async function executeResearchRun(db, registry, runId, projectId, options = {})
|
|
|
17064
17167
|
throw new Error("Configured API provider is unavailable.");
|
|
17065
17168
|
}
|
|
17066
17169
|
const period = getCurrentUsageDay();
|
|
17067
|
-
const scope = `${projectId}:${run.provider}`;
|
|
17170
|
+
const scope = `${projectId}:${providerConnectionName(run.provider)}`;
|
|
17068
17171
|
const quota = reserveDailyQueryQuota(db, {
|
|
17069
17172
|
scope,
|
|
17070
17173
|
period,
|
|
@@ -17141,13 +17244,14 @@ async function executeResearchRun(db, registry, runId, projectId, options = {})
|
|
|
17141
17244
|
if (reservation && reserved > dispatched) {
|
|
17142
17245
|
releaseDailyQueryQuota(db, { ...reservation, count: reserved - dispatched });
|
|
17143
17246
|
}
|
|
17247
|
+
const telemetryProvider = providerConnectionName(run.provider);
|
|
17144
17248
|
trackFeatureCompleted({
|
|
17145
17249
|
feature: "research",
|
|
17146
17250
|
operation: "run",
|
|
17147
17251
|
status: researchOutcomeStatus(final.status),
|
|
17148
17252
|
// Batches re-dispatched at boot are the server's own; any other batch reports who asked.
|
|
17149
17253
|
...options.trigger ? { trigger: options.trigger, ...options.trigger === OutcomeTriggers.startup ? { surface: OutcomeSurfaces.system } : {} } : requested ?? { trigger: OutcomeTriggers.manual },
|
|
17150
|
-
...PROVIDER_NAMES.includes(
|
|
17254
|
+
...PROVIDER_NAMES.includes(telemetryProvider) ? { provider: telemetryProvider } : {},
|
|
17151
17255
|
...final.status === ResearchRunStatuses.completed ? {} : fatalReason ?? classifyProviderOutcomeError(queryFailure),
|
|
17152
17256
|
durationBucket: elapsed(),
|
|
17153
17257
|
counts: { queries: final.total, snapshots: final.completed, failures: final.failed }
|
|
@@ -17574,7 +17678,8 @@ var API_ADAPTERS = [
|
|
|
17574
17678
|
claudeAdapter,
|
|
17575
17679
|
localAdapter,
|
|
17576
17680
|
perplexityAdapter,
|
|
17577
|
-
museAdapter
|
|
17681
|
+
museAdapter,
|
|
17682
|
+
openrouterAdapter
|
|
17578
17683
|
];
|
|
17579
17684
|
var BROWSER_ADAPTERS = [cdpChatgptAdapter];
|
|
17580
17685
|
var adapterMap = Object.fromEntries(
|
|
@@ -18626,8 +18731,8 @@ async function createServer(opts) {
|
|
|
18626
18731
|
getConnection: (projectName) => {
|
|
18627
18732
|
return getCloudRunConnection(opts.config, projectName);
|
|
18628
18733
|
},
|
|
18629
|
-
upsertConnection: (
|
|
18630
|
-
const updated = upsertCloudRunConnection(opts.config,
|
|
18734
|
+
upsertConnection: (record) => {
|
|
18735
|
+
const updated = upsertCloudRunConnection(opts.config, record);
|
|
18631
18736
|
saveConfigPatch(opts.config);
|
|
18632
18737
|
return updated;
|
|
18633
18738
|
},
|
|
@@ -18641,8 +18746,8 @@ async function createServer(opts) {
|
|
|
18641
18746
|
getConnection: (projectName) => {
|
|
18642
18747
|
return getWordpressTrafficConnection(opts.config, projectName);
|
|
18643
18748
|
},
|
|
18644
|
-
upsertConnection: (
|
|
18645
|
-
const updated = upsertWordpressTrafficConnection(opts.config,
|
|
18749
|
+
upsertConnection: (record) => {
|
|
18750
|
+
const updated = upsertWordpressTrafficConnection(opts.config, record);
|
|
18646
18751
|
saveConfigPatch(opts.config);
|
|
18647
18752
|
return updated;
|
|
18648
18753
|
},
|
|
@@ -18659,8 +18764,8 @@ async function createServer(opts) {
|
|
|
18659
18764
|
getConnection: (projectName) => {
|
|
18660
18765
|
return getVercelTrafficConnection(opts.config, projectName);
|
|
18661
18766
|
},
|
|
18662
|
-
upsertConnection: (
|
|
18663
|
-
const updated = upsertVercelTrafficConnection(opts.config,
|
|
18767
|
+
upsertConnection: (record) => {
|
|
18768
|
+
const updated = upsertVercelTrafficConnection(opts.config, record);
|
|
18664
18769
|
saveConfigPatch(opts.config);
|
|
18665
18770
|
return updated;
|
|
18666
18771
|
},
|
|
@@ -18677,8 +18782,8 @@ async function createServer(opts) {
|
|
|
18677
18782
|
getConnectionBySourceId: (sourceId) => {
|
|
18678
18783
|
return getCloudflareTrafficConnectionBySourceId(opts.config, sourceId);
|
|
18679
18784
|
},
|
|
18680
|
-
upsertConnection: (
|
|
18681
|
-
const updated = upsertCloudflareTrafficConnection(opts.config,
|
|
18785
|
+
upsertConnection: (record) => {
|
|
18786
|
+
const updated = upsertCloudflareTrafficConnection(opts.config, record);
|
|
18682
18787
|
saveConfigPatch(opts.config);
|
|
18683
18788
|
return updated;
|
|
18684
18789
|
},
|
|
@@ -19082,7 +19187,7 @@ async function createServer(opts) {
|
|
|
19082
19187
|
};
|
|
19083
19188
|
const sentimentWorker = new SentimentWorker(opts.db, {
|
|
19084
19189
|
configuration: loadSentimentInstallConfig,
|
|
19085
|
-
classifier: (configuration) =>
|
|
19190
|
+
classifier: (configuration) => createConfiguredSentimentClassifier(configuration, registry, loadSentimentInstallConfig),
|
|
19086
19191
|
prepare: (input) => {
|
|
19087
19192
|
const built = buildJevSentimentRequest(input);
|
|
19088
19193
|
return built.ok ? { ok: true, estimatedInputTokens: built.estimate.inputTokens } : built;
|
|
@@ -19214,6 +19319,17 @@ async function createServer(opts) {
|
|
|
19214
19319
|
await sentimentPoller.settled();
|
|
19215
19320
|
});
|
|
19216
19321
|
const providerModelCatalog = createProviderModelCatalog(registry);
|
|
19322
|
+
const aeroOpenRouterCatalog = providerModelCatalog.orUnregistered(() => {
|
|
19323
|
+
const apiKey = resolveApiKeyFor(ProviderNames.openrouter, opts.config);
|
|
19324
|
+
return apiKey ? { adapter: openrouterAdapter, config: { provider: ProviderNames.openrouter, apiKey, quotaPolicy: DEFAULT_PROVIDER_QUOTA } } : void 0;
|
|
19325
|
+
});
|
|
19326
|
+
const disconnectOpenRouterModels = openRouterModels.connect({
|
|
19327
|
+
read: () => aeroOpenRouterCatalog.read(ProviderNames.openrouter),
|
|
19328
|
+
cached: () => aeroOpenRouterCatalog.cached(ProviderNames.openrouter)
|
|
19329
|
+
});
|
|
19330
|
+
app.addHook("onClose", async () => {
|
|
19331
|
+
disconnectOpenRouterModels();
|
|
19332
|
+
});
|
|
19217
19333
|
const recordProviderChange = (name, before, after, auditContext) => {
|
|
19218
19334
|
const beforeConfig = summarizeProviderConfig(before);
|
|
19219
19335
|
const afterConfig = summarizeProviderConfig(after);
|
|
@@ -19250,7 +19366,7 @@ async function createServer(opts) {
|
|
|
19250
19366
|
sentiment: {
|
|
19251
19367
|
install: () => {
|
|
19252
19368
|
const configuration = loadSentimentInstallConfig();
|
|
19253
|
-
return { ...sentimentInstallReadiness(configuration), model: configuration.model };
|
|
19369
|
+
return { ...sentimentInstallReadiness(configuration), model: configuration.model, provider: configuration.provider };
|
|
19254
19370
|
},
|
|
19255
19371
|
previewSecret: opts.config.apiKey,
|
|
19256
19372
|
estimate: (input) => {
|
|
@@ -19507,6 +19623,7 @@ async function createServer(opts) {
|
|
|
19507
19623
|
executeDiscoveryRun({
|
|
19508
19624
|
db: opts.db,
|
|
19509
19625
|
registry,
|
|
19626
|
+
getClassifierConfig: () => loadConfig(runtimeConfigPath),
|
|
19510
19627
|
runId: input.runId,
|
|
19511
19628
|
sessionId: input.sessionId,
|
|
19512
19629
|
projectId: input.projectId,
|