@canonry/canonry 7.101.0 → 7.102.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 +9 -0
- package/assets/assets/{AccessControls-BMcboMU7.js → AccessControls-CpSlWN3W.js} +1 -1
- package/assets/assets/{AgentSetupPage-D8zYfyZC.js → AgentSetupPage-0le_Bx7d.js} +4 -4
- package/assets/assets/AuditHistoryPanel-BQH1dQ4V.js +1 -0
- package/assets/assets/{BacklinksPage-D8HxzRDh.js → BacklinksPage-_ffwmtrl.js} +1 -1
- package/assets/assets/{ChartPrimitives-nJi3Kmez.js → ChartPrimitives-6Yq_3ION.js} +1 -1
- package/assets/assets/{HistoryPage-DZ9Cuei4.js → HistoryPage-DUR17GrK.js} +1 -1
- package/assets/assets/MeasurementPropertyPage-dutXSW7s.js +4 -0
- package/assets/assets/ProjectPage-DA-07-jJ.js +15 -0
- package/assets/assets/{RunsPage-Q_prFKG5.js → RunsPage-Bs4f0-sW.js} +1 -1
- package/assets/assets/{ServerTrafficSection-D03quNUe.js → ServerTrafficSection-qMBbUI-0.js} +2 -2
- package/assets/assets/{SettingsPage-BjNzAJC4.js → SettingsPage-Bccypqbr.js} +1 -1
- package/assets/assets/ToneBadge-DvK4cIwq.js +60 -0
- package/assets/assets/{TrafficPage-B6W88b1f.js → TrafficPage-BPojOqd_.js} +1 -1
- package/assets/assets/{TrafficSourceDetailPage-zSr5FqmD.js → TrafficSourceDetailPage-DSoQk94d.js} +1 -1
- package/assets/assets/{account-context-Do9YhtFR.js → account-context-evpXzY8L.js} +1 -1
- package/assets/assets/{agent-trust-copy-CYbhNL0S.js → agent-trust-copy-CkaSg2FT.js} +1 -1
- package/assets/assets/{card-FXvJKWST.js → card-01OafAPU.js} +1 -1
- package/assets/assets/{index-C4GJ1tQ2.css → index-DPz1idfn.css} +1 -1
- package/assets/assets/index-StZErOkd.js +43 -0
- package/assets/assets/{query-client-BhpTEFNb.js → query-client-D6xwAuZW.js} +1 -1
- package/assets/assets/react-query-CdE7FNH6.js +1 -0
- package/assets/assets/{react-sigma_core.esm.min-DseCmd8v.js → react-sigma_core.esm.min-DlfcmDYc.js} +1 -1
- package/assets/assets/{server-traffic-1qKARWJy.js → server-traffic-yEflW4RI.js} +1 -1
- package/assets/assets/{service-CLPD132h.js → service-DfuRVpyN.js} +1 -1
- package/assets/index.html +9 -9
- package/dist/{ads-BCYHOU4L.js → ads-UDJVYKHF.js} +3 -3
- package/dist/{agent-EX5MI762.js → agent-EOB54XNS.js} +7 -7
- package/dist/{agent-ask-BQPVESBJ.js → agent-ask-5V4LX4VW.js} +3 -3
- package/dist/{agent-conversations-A3JVDL3D.js → agent-conversations-OAF6RCFP.js} +3 -3
- package/dist/{agent-journeys-3LQ7XWYH.js → agent-journeys-GETB4UGM.js} +3 -3
- package/dist/{agent-memory-LPQQOZR7.js → agent-memory-JXHPH6H5.js} +3 -3
- package/dist/{agent-providers-34EDHZQB.js → agent-providers-AAUCUOKY.js} +3 -3
- package/dist/{agent-transcript-LQUMSRRD.js → agent-transcript-WT4QH3ZY.js} +3 -3
- package/dist/{analytics-CVTVJUUE.js → analytics-JEZWLRTZ.js} +3 -3
- package/dist/{apply-6532DFBW.js → apply-LDIMMO4N.js} +3 -3
- package/dist/{backfill-TC57HUDP.js → backfill-JOJHBVGV.js} +10 -10
- package/dist/{backlinks-MZXW2DZL.js → backlinks-D2O3UM6F.js} +3 -3
- package/dist/{bing-VTXDVW6U.js → bing-BG7KZZPK.js} +3 -3
- package/dist/{bootstrap-3IC5HUMH.js → bootstrap-IXVATZLB.js} +10 -10
- package/dist/{cdp-CTL2TJE6.js → cdp-3AJG7OLP.js} +7 -7
- package/dist/{chunk-3QA5NJR4.js → chunk-2YLTELT2.js} +1 -1
- package/dist/{chunk-PX7O4WH2.js → chunk-3TPHFDZN.js} +2 -2
- package/dist/{chunk-7HQWMG3E.js → chunk-4CF5536B.js} +31 -1
- package/dist/{chunk-HN4EB3RS.js → chunk-66EXWVMN.js} +2 -2
- package/dist/{chunk-OMGPF7QF.js → chunk-7I2NJ4BH.js} +134 -1
- package/dist/{chunk-MUK7BYVL.js → chunk-7JJCFGL2.js} +3 -3
- package/dist/{chunk-S7UYYD2Y.js → chunk-AENOUFTF.js} +2 -2
- package/dist/{chunk-VLNJ2HEZ.js → chunk-AG6BTE7R.js} +3 -3
- package/dist/{chunk-BRNVPRLS.js → chunk-BDLHLE2F.js} +3 -3
- package/dist/{chunk-3ED3KWEP.js → chunk-BG6TVNA6.js} +409 -366
- package/dist/{chunk-E2SYIZ55.js → chunk-C2YVADFC.js} +1 -1
- package/dist/{chunk-5TSSSL2I.js → chunk-CZOGOHIN.js} +1 -1
- package/dist/{chunk-WSAWPVPE.js → chunk-DP3FE2OW.js} +5 -5
- package/dist/{chunk-CT45LO6U.js → chunk-DRNBMKR5.js} +6 -6
- package/dist/{chunk-XZE6RAHE.js → chunk-EXPBZFN4.js} +1 -1
- package/dist/{chunk-3SJDTQMT.js → chunk-FHK6M4RK.js} +3 -3
- package/dist/{chunk-FGITR7KU.js → chunk-G4ODBZO7.js} +4 -1
- package/dist/{chunk-JFTB74BQ.js → chunk-GLKR6C2L.js} +1 -1
- package/dist/{chunk-CLYPPLCG.js → chunk-IBRABPHA.js} +2 -2
- package/dist/{chunk-WDGVJPWZ.js → chunk-LGTSVS6Q.js} +4 -4
- package/dist/{chunk-L7WSODHZ.js → chunk-M25KDHD4.js} +1 -1
- package/dist/{chunk-YMWX6QAX.js → chunk-N4VEG6GB.js} +4 -4
- package/dist/{chunk-2FFTK4PG.js → chunk-N7773GJW.js} +1 -1
- package/dist/{chunk-5WZPTVEF.js → chunk-NAJ3ZYZ2.js} +3 -3
- package/dist/{chunk-6UB4Y6CB.js → chunk-NHBXQWE3.js} +298 -139
- package/dist/{chunk-UE27XRSS.js → chunk-NJZVDUKD.js} +3 -3
- package/dist/{chunk-UBOUJ6RS.js → chunk-O5AIKUW3.js} +1 -1
- package/dist/{chunk-YIJLFPSH.js → chunk-ONHBQYSA.js} +7 -7
- package/dist/{chunk-F4FHK5IK.js → chunk-QK4IICRM.js} +2 -2
- package/dist/{chunk-2T5HRNYT.js → chunk-RXWD25P7.js} +1 -1
- package/dist/{chunk-G7LYCMQJ.js → chunk-S7ZOYNW3.js} +32 -2
- package/dist/{chunk-VAHTXCUU.js → chunk-UX6XWC4F.js} +5 -5
- package/dist/{chunk-2UF2K6MD.js → chunk-VH424YVI.js} +2540 -1169
- package/dist/{chunk-AOIDPATQ.js → chunk-WNR3YQAD.js} +1 -1
- package/dist/{chunk-XM6OZ2OK.js → chunk-YTR2S4MU.js} +4 -4
- package/dist/{chunk-F73M7PKH.js → chunk-ZIKPEZ3K.js} +286 -28
- package/dist/{citations-QXQ5MUSF.js → citations-GM42U2ZH.js} +4 -4
- package/dist/{cli-catalog-B3TUL26L.js → cli-catalog-EMZPMAJP.js} +3 -3
- package/dist/{cli-commands-R3CN4VVC.js → cli-commands-VDMZAETM.js} +7 -7
- package/dist/cli.js +13 -13
- package/dist/{competitor-25MZKLVJ.js → competitor-4ZLKGNQW.js} +3 -3
- package/dist/{content-4STS5IKM.js → content-YJRMT4JW.js} +3 -3
- package/dist/{dashboard-XBMH4MGN.js → dashboard-L4EE3C5T.js} +6 -6
- package/dist/{demo-2S46SBJD.js → demo-3XDVCUT5.js} +1 -1
- package/dist/{demo-server-JTRHOBVR.js → demo-server-7ZJWSGE2.js} +12 -12
- package/dist/{discover-W6BSJXYO.js → discover-SQGUDXSU.js} +4 -4
- package/dist/{discover-eval-VP3XYODD.js → discover-eval-BUNKP6EW.js} +3 -3
- package/dist/{doctor-M5CC6T2H.js → doctor-HPIGLMRX.js} +3 -3
- package/dist/{evidence-KA6S266J.js → evidence-JKEM5BYW.js} +3 -3
- package/dist/{export-cmd-IBWYGJ2S.js → export-cmd-KTQM455W.js} +3 -3
- package/dist/{ga-GR2QLPZI.js → ga-D7ZLTSSA.js} +3 -3
- package/dist/{gbp-U7NRBE2Q.js → gbp-OWBX2BFK.js} +3 -3
- package/dist/{google-IV62SWDP.js → google-UNAGUCXQ.js} +4 -4
- package/dist/{google-marketing-LBEJZ2NZ.js → google-marketing-AZC7WHZR.js} +1 -1
- package/dist/{health-cmd-Y57EUJCG.js → health-cmd-XHEDL6CF.js} +4 -4
- package/dist/{history-ZKZNZ24X.js → history-MKQDN6LY.js} +3 -3
- package/dist/index.d.ts +845 -11
- package/dist/index.js +25 -25
- package/dist/{init-X6NNIX63.js → init-W4LWSMCC.js} +12 -12
- package/dist/{insights-3A2I5LQ5.js → insights-HNJR7UEC.js} +3 -3
- package/dist/intelligence-service-SWQABQ3X.js +16 -0
- package/dist/{journeys-WHQ4XC4I.js → journeys-RQBYPWHU.js} +3 -3
- package/dist/{keys-6XIMEOV2.js → keys-KNZAMXJU.js} +3 -3
- package/dist/{keyword-DGGFQNYE.js → keyword-7SUZG7RB.js} +3 -3
- package/dist/{logs-Z5ZV7ODN.js → logs-RTQFOKLJ.js} +3 -3
- package/dist/{mcp-U64GUOQN.js → mcp-JWBPAYR4.js} +4 -4
- package/dist/mcp.js +9 -9
- package/dist/{measurement-plan-J5ERRBIR.js → measurement-plan-AETWMIGC.js} +5 -5
- package/dist/{notify-43M77D6T.js → notify-DGFNKFVG.js} +3 -3
- package/dist/{organic-evidence-H2X6ILDC.js → organic-evidence-VA47O6HU.js} +3 -3
- package/dist/{overview-XT35O2XZ.js → overview-SMXNZLPG.js} +5 -5
- package/dist/{project-F2EKXLWT.js → project-WXEDQJLS.js} +3 -3
- package/dist/{project-setup-5GB65EUE.js → project-setup-VFBTUA5W.js} +3 -3
- package/dist/{query-MHSMDWMP.js → query-C2VIB2XW.js} +3 -3
- package/dist/{research-FH62JC57.js → research-76TYES7M.js} +3 -3
- package/dist/{results-export-D4VB2OBW.js → results-export-F4FKVOQN.js} +3 -3
- package/dist/{run-B4B3CG7J.js → run-H6GGXFKQ.js} +5 -5
- package/dist/{schedule-BUJX7ULT.js → schedule-KTQNJGMO.js} +3 -3
- package/dist/{search-6CXRPRG6.js → search-YRFUC7SW.js} +3 -3
- package/dist/{serve-BAIQI6TL.js → serve-PWIVPUX7.js} +26 -26
- package/dist/{session-AXSKOKCZ.js → session-LRR2N6IP.js} +13 -13
- package/dist/{settings-TADPOGVE.js → settings-TLDN77K4.js} +3 -3
- package/dist/{sitemaps-HHEQTH4E.js → sitemaps-BQ6JI4EW.js} +3 -3
- package/dist/{skills-4L7SDS6D.js → skills-SQBKFXAN.js} +2 -2
- package/dist/{snapshot-6RWDOATX.js → snapshot-ICGETMOY.js} +3 -3
- package/dist/{src-XZVMW2PD.js → src-XW5T4IQS.js} +10 -2
- package/dist/{status-4NRAVD3B.js → status-VN65JTUD.js} +5 -5
- package/dist/{technical-aeo-DBWEDC3J.js → technical-aeo-OBCWTN3M.js} +3 -3
- package/dist/{telemetry-OEAHQV6Q.js → telemetry-ZU6REKKU.js} +4 -4
- package/dist/{tools-64NJHOA5.js → tools-RQDMCSZB.js} +11 -11
- package/dist/{traffic-M2TCCDCP.js → traffic-YLZSRX5P.js} +5 -5
- package/dist/{trends-XHOOQAGY.js → trends-OWWELIE2.js} +3 -3
- package/dist/{users-VX5RRVBY.js → users-2ICURHTW.js} +54 -4
- package/dist/{visibility-stats-QGEQKBPJ.js → visibility-stats-FJK3MDYE.js} +4 -4
- package/dist/{wordpress-HRTBWGT4.js → wordpress-UQFA5TFU.js} +3 -3
- package/package.json +1 -1
- package/assets/assets/AuditHistoryPanel-DWM5jJ3T.js +0 -1
- package/assets/assets/MeasurementPropertyPage-9-ItFHr-.js +0 -4
- package/assets/assets/ProjectPage-yQTM6p0E.js +0 -15
- package/assets/assets/ToneBadge-BZJuMrq1.js +0 -60
- package/assets/assets/index-BYLZIyID.js +0 -43
- package/assets/assets/react-query-Cja6j8Tp.js +0 -1
- package/dist/intelligence-service-5FILIP2J.js +0 -16
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
measurementDraftUpsertGroupRequestSchema,
|
|
24
24
|
measurementDraftUpsertMarketRequestSchema,
|
|
25
25
|
measurementDraftUpsertTargetRequestSchema
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-NHBXQWE3.js";
|
|
27
27
|
|
|
28
28
|
// src/measurement-draft-actions.ts
|
|
29
29
|
import { z } from "zod";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runWithUsageTags
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-S7ZOYNW3.js";
|
|
4
4
|
import {
|
|
5
5
|
CanonryMcpToolNames,
|
|
6
6
|
DEPRECATED_MCP_TOOL_ALIAS_NAMES,
|
|
7
7
|
canonryMcpTools
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-AG6BTE7R.js";
|
|
9
9
|
import {
|
|
10
10
|
CliError
|
|
11
11
|
} from "./chunk-HGMYEDAQ.js";
|
|
12
12
|
import {
|
|
13
13
|
buildOpenApiDocument
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-VH424YVI.js";
|
|
15
15
|
import {
|
|
16
16
|
DEFAULT_COMPETITOR_AUTO_ALIAS_MODE,
|
|
17
17
|
MeasurementPortfolioLists,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
seoDatasetWithoutVendor,
|
|
25
25
|
seoProviderSchema,
|
|
26
26
|
truncateUtf16
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-NHBXQWE3.js";
|
|
28
28
|
|
|
29
29
|
// src/agent/tools.ts
|
|
30
30
|
import { Type as Type2 } from "@earendil-works/pi-ai";
|
|
@@ -23,18 +23,18 @@ import {
|
|
|
23
23
|
resolveConfiguredAgentProvider,
|
|
24
24
|
resolveSessionProviderAndModel,
|
|
25
25
|
setAeroSystemPrompt
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-DRNBMKR5.js";
|
|
27
27
|
import {
|
|
28
28
|
answerServiceAdapters,
|
|
29
29
|
answerServiceDescriptors
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-M25KDHD4.js";
|
|
31
31
|
import {
|
|
32
32
|
AeroToolProfiles,
|
|
33
33
|
AeroToolScopes,
|
|
34
34
|
buildAeroStateTools,
|
|
35
35
|
isAeroToolProfile,
|
|
36
36
|
truncateToolResult
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-YTR2S4MU.js";
|
|
38
38
|
import {
|
|
39
39
|
getGoogleAuthConfig,
|
|
40
40
|
getGoogleConnection,
|
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
removeCloudflareTrafficConnection,
|
|
54
54
|
removeCloudflareTrafficConnectionBySourceId,
|
|
55
55
|
upsertCloudflareTrafficConnection
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-N7773GJW.js";
|
|
57
57
|
import {
|
|
58
58
|
claudeAdapter,
|
|
59
59
|
embedQueries,
|
|
@@ -65,7 +65,7 @@ import {
|
|
|
65
65
|
openrouterAdapter,
|
|
66
66
|
perplexityAdapter,
|
|
67
67
|
startTrafficReclassification
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-UX6XWC4F.js";
|
|
69
69
|
import {
|
|
70
70
|
classifyUsageSurface,
|
|
71
71
|
createApiUsageTelemetry,
|
|
@@ -77,7 +77,7 @@ import {
|
|
|
77
77
|
startOutcomeTimer,
|
|
78
78
|
trackFeatureCompleted,
|
|
79
79
|
trackInstallState
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-LGTSVS6Q.js";
|
|
81
81
|
import {
|
|
82
82
|
isLoopbackBindHost
|
|
83
83
|
} from "./chunk-TSENU4GG.js";
|
|
@@ -85,7 +85,7 @@ import {
|
|
|
85
85
|
isApiProviderRegistrable,
|
|
86
86
|
isCdpProviderRegistrable,
|
|
87
87
|
registeredProviderNames
|
|
88
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-2YLTELT2.js";
|
|
89
89
|
import {
|
|
90
90
|
checkLatestVersionForServer,
|
|
91
91
|
getOrCreateAnonymousId,
|
|
@@ -97,21 +97,23 @@ import {
|
|
|
97
97
|
recordDashboardEvent,
|
|
98
98
|
setTelemetryPreference,
|
|
99
99
|
trackEvent
|
|
100
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-IBRABPHA.js";
|
|
101
101
|
import {
|
|
102
102
|
createCanonryMcpServer
|
|
103
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-FHK6M4RK.js";
|
|
104
104
|
import {
|
|
105
105
|
CANONRY_MCP_TIERS,
|
|
106
106
|
CANONRY_MCP_TOOLKIT_NAMES
|
|
107
107
|
} from "./chunk-2FWYWGIR.js";
|
|
108
108
|
import {
|
|
109
109
|
ApiClient
|
|
110
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-S7ZOYNW3.js";
|
|
111
111
|
import {
|
|
112
112
|
AGENT_PROVIDERS,
|
|
113
|
+
PROVIDER_MODELS,
|
|
113
114
|
adapterSupportsBatch,
|
|
114
115
|
aeroModels,
|
|
116
|
+
aeroStreamFn,
|
|
115
117
|
agentProviderApiKeyEnvVar,
|
|
116
118
|
agentProvidersByPriority,
|
|
117
119
|
batchEligibleProviderNames,
|
|
@@ -140,21 +142,21 @@ import {
|
|
|
140
142
|
saveConfigPatch,
|
|
141
143
|
sentimentInstallReadiness,
|
|
142
144
|
updateSharedProviderExecutionGate
|
|
143
|
-
} from "./chunk-
|
|
145
|
+
} from "./chunk-4CF5536B.js";
|
|
144
146
|
import {
|
|
145
147
|
getBundledSkillSnapshots
|
|
146
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-RXWD25P7.js";
|
|
147
149
|
import {
|
|
148
150
|
computeFactorAverages,
|
|
149
151
|
deleteSiteCrawlGraphLayout,
|
|
150
152
|
persistSiteCrawlGraphLayout,
|
|
151
153
|
prepareSiteCrawlGraphLayout,
|
|
152
154
|
recordedSharePct
|
|
153
|
-
} from "./chunk-
|
|
155
|
+
} from "./chunk-QK4IICRM.js";
|
|
154
156
|
import {
|
|
155
157
|
CanonryMcpToolNames,
|
|
156
158
|
canonryMcpTools
|
|
157
|
-
} from "./chunk-
|
|
159
|
+
} from "./chunk-AG6BTE7R.js";
|
|
158
160
|
import {
|
|
159
161
|
PACKAGE_VERSION
|
|
160
162
|
} from "./chunk-AOJU5LKX.js";
|
|
@@ -163,19 +165,21 @@ import {
|
|
|
163
165
|
} from "./chunk-HGMYEDAQ.js";
|
|
164
166
|
import {
|
|
165
167
|
IntelligenceService
|
|
166
|
-
} from "./chunk-
|
|
168
|
+
} from "./chunk-DP3FE2OW.js";
|
|
167
169
|
import {
|
|
168
170
|
computeCitedCompetitorDomains,
|
|
169
171
|
determineCitationState
|
|
170
|
-
} from "./chunk-
|
|
172
|
+
} from "./chunk-O5AIKUW3.js";
|
|
171
173
|
import {
|
|
172
174
|
addLogListener,
|
|
173
175
|
createFastifyLogger,
|
|
174
176
|
createLogger
|
|
175
|
-
} from "./chunk-
|
|
177
|
+
} from "./chunk-3TPHFDZN.js";
|
|
176
178
|
import {
|
|
177
179
|
BingApiError,
|
|
178
180
|
CC_CACHE_DIR,
|
|
181
|
+
ChatGptAccounts,
|
|
182
|
+
ChatGptPlanError,
|
|
179
183
|
DUCKDB_SPEC,
|
|
180
184
|
EgressFailedError,
|
|
181
185
|
EgressRefusedError,
|
|
@@ -280,6 +284,7 @@ import {
|
|
|
280
284
|
nextRunFromSchedule,
|
|
281
285
|
notProbeRun,
|
|
282
286
|
parseBingDate,
|
|
287
|
+
parseChatGptTokenKey,
|
|
283
288
|
parseCookieHeader,
|
|
284
289
|
previewCompetitorAutoAliases,
|
|
285
290
|
probeLatestRelease,
|
|
@@ -317,7 +322,7 @@ import {
|
|
|
317
322
|
webhookResponseReason,
|
|
318
323
|
webhookTargetRefusalReason,
|
|
319
324
|
writeAuditLog
|
|
320
|
-
} from "./chunk-
|
|
325
|
+
} from "./chunk-VH424YVI.js";
|
|
321
326
|
import {
|
|
322
327
|
OperationalLogStore,
|
|
323
328
|
SentimentIdempotencyConflict,
|
|
@@ -416,7 +421,7 @@ import {
|
|
|
416
421
|
unrecognizedAgentEventsHourly,
|
|
417
422
|
unrecognizedAgentNotifyState,
|
|
418
423
|
usageCounters
|
|
419
|
-
} from "./chunk-
|
|
424
|
+
} from "./chunk-7I2NJ4BH.js";
|
|
420
425
|
import {
|
|
421
426
|
AGENT_MEMORY_VALUE_MAX_BYTES,
|
|
422
427
|
AI_ENGINE_DOMAINS,
|
|
@@ -427,9 +432,12 @@ import {
|
|
|
427
432
|
AppError,
|
|
428
433
|
BacklinkSources,
|
|
429
434
|
BingSiteSnapshotKinds,
|
|
435
|
+
CHATGPT_AERO_ERRORS,
|
|
436
|
+
CHATGPT_RESOURCE,
|
|
430
437
|
CHECK_RUNTIME_ERROR_SUFFIX,
|
|
431
438
|
CITED_URL_CAPTURE_VERSION,
|
|
432
439
|
CcReleaseSyncStatuses,
|
|
440
|
+
ChatGptPlanStatuses,
|
|
433
441
|
CheckNotificationPolicies,
|
|
434
442
|
CheckStatuses,
|
|
435
443
|
CitationStates,
|
|
@@ -602,6 +610,7 @@ import {
|
|
|
602
610
|
hostOf,
|
|
603
611
|
inclusiveDayCount,
|
|
604
612
|
isBrowserProvider,
|
|
613
|
+
isChatGptAeroError,
|
|
605
614
|
isCitationMeasurable,
|
|
606
615
|
isCitationStateMeasured,
|
|
607
616
|
isEligibleFor,
|
|
@@ -690,7 +699,7 @@ import {
|
|
|
690
699
|
winnabilityClassLabel,
|
|
691
700
|
withRetry,
|
|
692
701
|
withSkippedProviders
|
|
693
|
-
} from "./chunk-
|
|
702
|
+
} from "./chunk-NHBXQWE3.js";
|
|
694
703
|
|
|
695
704
|
// src/google-marketing-runtime.ts
|
|
696
705
|
import crypto2 from "crypto";
|
|
@@ -6444,7 +6453,7 @@ function nonBlank(value) {
|
|
|
6444
6453
|
return trimmed ? trimmed : void 0;
|
|
6445
6454
|
}
|
|
6446
6455
|
function resolveBuildCommit(env = process.env) {
|
|
6447
|
-
const embedded = true ? "
|
|
6456
|
+
const embedded = true ? "b3e583c0cefcae761dd3c2cb452f72599528b8ab" : void 0;
|
|
6448
6457
|
return nonBlank(embedded) ?? nonBlank(env.CANONRY_COMMIT);
|
|
6449
6458
|
}
|
|
6450
6459
|
function resolveInstanceIdentity(env = process.env) {
|
|
@@ -18216,6 +18225,139 @@ ${lines.join("\n")}
|
|
|
18216
18225
|
// src/agent/viewer-sessions.ts
|
|
18217
18226
|
import crypto28 from "crypto";
|
|
18218
18227
|
import { and as and27, eq as eq33, isNotNull as isNotNull4, like as like2 } from "drizzle-orm";
|
|
18228
|
+
|
|
18229
|
+
// src/agent/chatgpt-plan.ts
|
|
18230
|
+
import { createAssistantMessageEventStream } from "@earendil-works/pi-ai";
|
|
18231
|
+
var CHATGPT_TOOL_NAMESPACE = "canonry";
|
|
18232
|
+
var ZERO_COST = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
|
|
18233
|
+
function chatGptPlanModel(modelId) {
|
|
18234
|
+
const known = aeroModels.getModel("openai", modelId);
|
|
18235
|
+
const base = known ?? {
|
|
18236
|
+
id: modelId,
|
|
18237
|
+
name: modelId,
|
|
18238
|
+
api: "openai-responses",
|
|
18239
|
+
provider: "openai",
|
|
18240
|
+
baseUrl: CHATGPT_RESOURCE,
|
|
18241
|
+
reasoning: false,
|
|
18242
|
+
input: ["text"],
|
|
18243
|
+
contextWindow: 128e3,
|
|
18244
|
+
maxTokens: 32e3,
|
|
18245
|
+
cost: ZERO_COST
|
|
18246
|
+
};
|
|
18247
|
+
return { ...base, api: "openai-responses", provider: "openai", baseUrl: CHATGPT_RESOURCE, cost: ZERO_COST };
|
|
18248
|
+
}
|
|
18249
|
+
function asRecord2(value) {
|
|
18250
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
18251
|
+
}
|
|
18252
|
+
function namespaceChatGptPayload(payload) {
|
|
18253
|
+
const params = asRecord2(payload);
|
|
18254
|
+
if (!params) return void 0;
|
|
18255
|
+
const input = Array.isArray(params.input) ? params.input.map((item) => {
|
|
18256
|
+
const record = asRecord2(item);
|
|
18257
|
+
if (!record) return item;
|
|
18258
|
+
if (record.role === "system") return { ...record, role: "developer" };
|
|
18259
|
+
if ((record.type === "function_call" || record.type === "custom_tool_call") && record.namespace === void 0) {
|
|
18260
|
+
return { ...record, namespace: CHATGPT_TOOL_NAMESPACE };
|
|
18261
|
+
}
|
|
18262
|
+
return item;
|
|
18263
|
+
}) : params.input;
|
|
18264
|
+
const tools = Array.isArray(params.tools) ? params.tools : [];
|
|
18265
|
+
return {
|
|
18266
|
+
...params,
|
|
18267
|
+
input,
|
|
18268
|
+
...tools.length > 0 ? { tools: [{ type: "namespace", name: CHATGPT_TOOL_NAMESPACE, description: "Canonry tools Aero may use for this answer.", tools }] } : {}
|
|
18269
|
+
};
|
|
18270
|
+
}
|
|
18271
|
+
function chatGptPlanFailure(status, detail) {
|
|
18272
|
+
const text = detail ?? "";
|
|
18273
|
+
if (status === 401 || text.includes("subscription_sharing_invalid_user")) return CHATGPT_AERO_ERRORS.reconnect;
|
|
18274
|
+
if (text.includes("subscription_sharing_usage_limit_exceeded") || status === 429) return CHATGPT_AERO_ERRORS.usageLimit;
|
|
18275
|
+
if (text.includes("subscription_sharing_user_not_eligible")) return CHATGPT_AERO_ERRORS.notEligible;
|
|
18276
|
+
if (text.includes("chatpass_v2_scope_not_authorized") || text.includes("chatpass_v2_invalid_authorization_context")) return CHATGPT_AERO_ERRORS.reconnect;
|
|
18277
|
+
if (status === 403) return CHATGPT_AERO_ERRORS.notEligible;
|
|
18278
|
+
if (status === 503 || text.includes("subscription_sharing_usage_unavailable") || text.includes("subscription_sharing_user_unavailable")) {
|
|
18279
|
+
return CHATGPT_AERO_ERRORS.unavailable;
|
|
18280
|
+
}
|
|
18281
|
+
return CHATGPT_AERO_ERRORS.failed;
|
|
18282
|
+
}
|
|
18283
|
+
function chatGptPlanStreamFn(onReconnect) {
|
|
18284
|
+
return (model, context, options) => {
|
|
18285
|
+
let status;
|
|
18286
|
+
const output = createAssistantMessageEventStream();
|
|
18287
|
+
const rewrite = (message) => {
|
|
18288
|
+
const failure2 = chatGptPlanFailure(status, message.errorMessage);
|
|
18289
|
+
if (failure2 === CHATGPT_AERO_ERRORS.reconnect) onReconnect();
|
|
18290
|
+
message.errorMessage = failure2;
|
|
18291
|
+
message.content = [];
|
|
18292
|
+
};
|
|
18293
|
+
void (async () => {
|
|
18294
|
+
try {
|
|
18295
|
+
const source = await aeroStreamFn(model, context, {
|
|
18296
|
+
...options,
|
|
18297
|
+
// Observe every HTTP response, failures included: pi-ai calls
|
|
18298
|
+
// onResponse only for a successful one, and its error text is not a
|
|
18299
|
+
// contract to parse a status out of.
|
|
18300
|
+
fetch: async (input, init) => {
|
|
18301
|
+
const response = await (options?.fetch ?? globalThis.fetch)(input, init);
|
|
18302
|
+
status = response.status;
|
|
18303
|
+
return response;
|
|
18304
|
+
}
|
|
18305
|
+
});
|
|
18306
|
+
for await (const event of source) {
|
|
18307
|
+
if (event.type === "error") rewrite(event.error);
|
|
18308
|
+
output.push(event);
|
|
18309
|
+
}
|
|
18310
|
+
const result = await source.result();
|
|
18311
|
+
if (result.stopReason === "error" && !Object.values(CHATGPT_AERO_ERRORS).includes(result.errorMessage)) {
|
|
18312
|
+
rewrite(result);
|
|
18313
|
+
}
|
|
18314
|
+
output.end(result);
|
|
18315
|
+
} catch (error) {
|
|
18316
|
+
const message = error instanceof ChatGptPlanError ? error.message : CHATGPT_AERO_ERRORS.failed;
|
|
18317
|
+
output.push({
|
|
18318
|
+
type: "error",
|
|
18319
|
+
reason: "error",
|
|
18320
|
+
error: {
|
|
18321
|
+
role: "assistant",
|
|
18322
|
+
content: [],
|
|
18323
|
+
api: model.api,
|
|
18324
|
+
provider: model.provider,
|
|
18325
|
+
model: model.id,
|
|
18326
|
+
usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, totalTokens: 0, cost: { ...ZERO_COST, total: 0 } },
|
|
18327
|
+
stopReason: "error",
|
|
18328
|
+
errorMessage: message,
|
|
18329
|
+
timestamp: Date.now()
|
|
18330
|
+
}
|
|
18331
|
+
});
|
|
18332
|
+
output.end();
|
|
18333
|
+
}
|
|
18334
|
+
})();
|
|
18335
|
+
return output;
|
|
18336
|
+
};
|
|
18337
|
+
}
|
|
18338
|
+
function preferredChatGptModel(config) {
|
|
18339
|
+
try {
|
|
18340
|
+
const { provider, modelId } = resolveSessionProviderAndModel(config);
|
|
18341
|
+
if (provider === AgentProviderIds.openai) return modelId;
|
|
18342
|
+
} catch {
|
|
18343
|
+
}
|
|
18344
|
+
return PROVIDER_MODELS[AgentProviderIds.openai].agent;
|
|
18345
|
+
}
|
|
18346
|
+
function fundingKey(funding) {
|
|
18347
|
+
return funding.kind === "install" ? "install" : `plan:${funding.connectionId}`;
|
|
18348
|
+
}
|
|
18349
|
+
function applyChatGptPlanTurn(agent, input) {
|
|
18350
|
+
agent.state.model = chatGptPlanModel(input.modelId);
|
|
18351
|
+
agent.state.thinkingLevel = resolveAgentReasoning(process.env, input.config, AgentProviderIds.openai, input.modelId);
|
|
18352
|
+
agent.getApiKey = async (provider) => {
|
|
18353
|
+
if (provider !== "openai") return void 0;
|
|
18354
|
+
const access = await input.accounts.planAccess(input.userId);
|
|
18355
|
+
return access.accessToken;
|
|
18356
|
+
};
|
|
18357
|
+
agent.onPayload = (payload) => namespaceChatGptPayload(payload);
|
|
18358
|
+
}
|
|
18359
|
+
|
|
18360
|
+
// src/agent/viewer-sessions.ts
|
|
18219
18361
|
var AERO_VIEWER_EXCLUDED_MCP_TOOLS = /* @__PURE__ */ new Set([
|
|
18220
18362
|
CanonryMcpToolNames.canonry_ads_account,
|
|
18221
18363
|
CanonryMcpToolNames.canonry_ads_geo_search,
|
|
@@ -18247,6 +18389,7 @@ var OPERATOR_ONLY_TOOL_NAMES = new Set(
|
|
|
18247
18389
|
);
|
|
18248
18390
|
var VIEWER_AERO_MAX_PROMPT_CHARS = 4e3;
|
|
18249
18391
|
var VIEWER_AERO_DAILY_TURN_LIMIT = 50;
|
|
18392
|
+
var VIEWER_AERO_PLAN_DAILY_TURN_LIMIT = 200;
|
|
18250
18393
|
function viewerAeroDailyLimitExceeded(limit) {
|
|
18251
18394
|
return new AppError(
|
|
18252
18395
|
"QUOTA_EXCEEDED",
|
|
@@ -18255,6 +18398,20 @@ function viewerAeroDailyLimitExceeded(limit) {
|
|
|
18255
18398
|
{ metric: "aero.viewer.turns", limit }
|
|
18256
18399
|
);
|
|
18257
18400
|
}
|
|
18401
|
+
function chatGptPlanAppError(error) {
|
|
18402
|
+
switch (error.kind) {
|
|
18403
|
+
case "usage-limit":
|
|
18404
|
+
return new AppError("QUOTA_EXCEEDED", error.message, 429, { reason: "chatgpt-usage-limit" });
|
|
18405
|
+
case "not-eligible":
|
|
18406
|
+
return new AppError("FORBIDDEN", error.message, 403, { reason: "chatgpt-not-eligible" });
|
|
18407
|
+
case "unavailable":
|
|
18408
|
+
return new AppError("PROVIDER_ERROR", error.message, 503, { reason: "chatgpt-unavailable" });
|
|
18409
|
+
case "not-connected":
|
|
18410
|
+
return new AppError("VALIDATION_ERROR", error.message, 409, { reason: "chatgpt-connect-required" });
|
|
18411
|
+
default:
|
|
18412
|
+
return new AppError("VALIDATION_ERROR", error.message, 409, { reason: "chatgpt-reconnect" });
|
|
18413
|
+
}
|
|
18414
|
+
}
|
|
18258
18415
|
var VIEWER_AERO_KEY_PREFIX = "aero-viewer:";
|
|
18259
18416
|
var VIEWER_AERO_PROMPT = "\n\nThis conversation is with a view-only account. You can read this project's data but cannot change anything, start or schedule sweeps, or spend on live provider reads. If asked to, say an administrator has to do it. You cannot see the operator's own Aero conversations or notes.";
|
|
18260
18417
|
var MAX_VIEWER_MESSAGES = 40;
|
|
@@ -18326,16 +18483,22 @@ var ViewerAeroSessions = class {
|
|
|
18326
18483
|
this.evictIdle();
|
|
18327
18484
|
const key = this.key(project.name, userId);
|
|
18328
18485
|
if (this.isBusy(project.name, userId)) throw agentBusy(project.name);
|
|
18486
|
+
const funding = await this.resolveFunding(userId);
|
|
18487
|
+
preferences.signal?.throwIfAborted();
|
|
18488
|
+
if (this.isBusy(project.name, userId)) throw agentBusy(project.name);
|
|
18329
18489
|
const today = new Date(this.now()).toISOString().slice(0, 10);
|
|
18330
18490
|
const used = this.turnsToday.get(key);
|
|
18331
18491
|
const count6 = used?.date === today ? used.count : 0;
|
|
18332
|
-
|
|
18492
|
+
const limit = funding.kind === "plan" ? VIEWER_AERO_PLAN_DAILY_TURN_LIMIT : VIEWER_AERO_DAILY_TURN_LIMIT;
|
|
18493
|
+
if (count6 >= limit) throw viewerAeroDailyLimitExceeded(limit);
|
|
18333
18494
|
const minted = mintViewerAeroKey(this.opts.db, userId, new Date(this.now()));
|
|
18334
18495
|
this.acquisitions.add(key);
|
|
18335
18496
|
let handedOff = false;
|
|
18336
18497
|
try {
|
|
18337
18498
|
const client = new ApiClient(this.opts.selfApiUrl, minted.raw, { skipProbe: true, surface: "aero" });
|
|
18338
|
-
const
|
|
18499
|
+
const existing = this.sessions.get(key);
|
|
18500
|
+
const reusable = existing && existing.funding === fundingKey(funding) ? existing.agent : void 0;
|
|
18501
|
+
const agent = reusable ?? await this.createAgent(project, client, preferences.signal, funding, userId);
|
|
18339
18502
|
agent.state.messages = trimViewerTranscript(agent.state.messages.filter((message) => message.role !== "system"));
|
|
18340
18503
|
const view = { client, projectName: project.name, basePath: this.opts.config.basePath, context: preferences.context };
|
|
18341
18504
|
const evidence = preferences.context ? await readAeroViewEvidenceForTurn(view, preferences.signal) : void 0;
|
|
@@ -18343,7 +18506,10 @@ var ViewerAeroSessions = class {
|
|
|
18343
18506
|
const shape = aeroProjectShape(this.opts.db, project.id);
|
|
18344
18507
|
setAeroSystemPrompt(agent, loadAeroSystemPrompt(void 0, { extras: false }) + VIEWER_AERO_PROMPT + shape.prompt + aeroViewPrompt(preferences.context));
|
|
18345
18508
|
configureAeroRuntime(agent, [...buildViewerAeroTools(client, project.name, this.opts.managedSweeps), buildAeroViewTool(view, evidence)], void 0, true, shape.pinned);
|
|
18346
|
-
|
|
18509
|
+
if (funding.kind === "plan") {
|
|
18510
|
+
applyChatGptPlanTurn(agent, { accounts: this.opts.chatgpt, userId, modelId: funding.modelId, config: this.opts.config });
|
|
18511
|
+
}
|
|
18512
|
+
this.sessions.set(key, { agent, lastUsedAt: this.now(), updatedAt: existing?.updatedAt ?? null, funding: fundingKey(funding) });
|
|
18347
18513
|
this.turnsToday.set(key, { date: today, count: count6 + 1 });
|
|
18348
18514
|
handedOff = true;
|
|
18349
18515
|
let released = false;
|
|
@@ -18369,7 +18535,23 @@ var ViewerAeroSessions = class {
|
|
|
18369
18535
|
}
|
|
18370
18536
|
}
|
|
18371
18537
|
}
|
|
18372
|
-
async createAgent(project, client, signal) {
|
|
18538
|
+
async createAgent(project, client, signal, funding, userId) {
|
|
18539
|
+
if (funding.kind === "plan") {
|
|
18540
|
+
const accounts = this.opts.chatgpt;
|
|
18541
|
+
return createAeroSession({
|
|
18542
|
+
projectName: project.name,
|
|
18543
|
+
client,
|
|
18544
|
+
config: this.opts.config,
|
|
18545
|
+
provider: AgentProviderIds.openai,
|
|
18546
|
+
modelId: PROVIDER_MODELS[AgentProviderIds.openai].agent,
|
|
18547
|
+
systemPromptOverride: loadAeroSystemPrompt(void 0, { extras: false }) + VIEWER_AERO_PROMPT,
|
|
18548
|
+
toolScope: AeroToolScopes.readOnly,
|
|
18549
|
+
managedSweeps: this.opts.managedSweeps,
|
|
18550
|
+
db: this.opts.db,
|
|
18551
|
+
projectId: project.id,
|
|
18552
|
+
streamFn: chatGptPlanStreamFn(() => accounts.markReconnectRequired(userId, funding.connectionId))
|
|
18553
|
+
});
|
|
18554
|
+
}
|
|
18373
18555
|
const { provider, modelId } = resolveSessionProviderAndModel(this.opts.config);
|
|
18374
18556
|
await refreshAgentModels(provider, signal);
|
|
18375
18557
|
return createAeroSession({
|
|
@@ -18385,6 +18567,27 @@ var ViewerAeroSessions = class {
|
|
|
18385
18567
|
projectId: project.id
|
|
18386
18568
|
});
|
|
18387
18569
|
}
|
|
18570
|
+
/**
|
|
18571
|
+
* What this viewer's next turn runs on. A connected ChatGPT plan wins; a plan
|
|
18572
|
+
* that needs connecting again is refused rather than quietly charged to the
|
|
18573
|
+
* install; no plan means the install's Aero, as before.
|
|
18574
|
+
*/
|
|
18575
|
+
async resolveFunding(userId) {
|
|
18576
|
+
const accounts = this.opts.chatgpt;
|
|
18577
|
+
if (!accounts?.planUsageEnabled()) return { kind: "install" };
|
|
18578
|
+
const plan = accounts.status(userId).account?.plan;
|
|
18579
|
+
if (!plan || plan.status === ChatGptPlanStatuses.notConnected) {
|
|
18580
|
+
if (accounts.planRequired()) throw chatGptPlanAppError(new ChatGptPlanError("not-connected", CHATGPT_AERO_ERRORS.connectRequired));
|
|
18581
|
+
return { kind: "install" };
|
|
18582
|
+
}
|
|
18583
|
+
try {
|
|
18584
|
+
const { access, modelId } = await accounts.resolveModel(userId, preferredChatGptModel(this.opts.config));
|
|
18585
|
+
return { kind: "plan", connectionId: access.connectionId, modelId };
|
|
18586
|
+
} catch (error) {
|
|
18587
|
+
if (error instanceof ChatGptPlanError) throw chatGptPlanAppError(error);
|
|
18588
|
+
throw error;
|
|
18589
|
+
}
|
|
18590
|
+
}
|
|
18388
18591
|
/**
|
|
18389
18592
|
* Delete the turn's key rather than revoke it: the key list shows revoked
|
|
18390
18593
|
* keys too, and one per turn would bury the operator's own. Revoke only if
|
|
@@ -18845,6 +19048,42 @@ function registerMcpHttpRoutes(scope, opts) {
|
|
|
18845
19048
|
}
|
|
18846
19049
|
}
|
|
18847
19050
|
|
|
19051
|
+
// src/chatgpt-config.ts
|
|
19052
|
+
var CALLBACK_SUFFIX = "/api/v1/auth/chatgpt/callback";
|
|
19053
|
+
function isLoopbackHost(hostname) {
|
|
19054
|
+
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "[::1]" || hostname.endsWith(".localhost");
|
|
19055
|
+
}
|
|
19056
|
+
function chatGptRedirectUri(publicUrl) {
|
|
19057
|
+
const configured = publicUrl?.trim();
|
|
19058
|
+
if (!configured) return null;
|
|
19059
|
+
let url;
|
|
19060
|
+
try {
|
|
19061
|
+
url = new URL(configured);
|
|
19062
|
+
} catch {
|
|
19063
|
+
return null;
|
|
19064
|
+
}
|
|
19065
|
+
if (url.username || url.password || url.search || url.hash) return null;
|
|
19066
|
+
if (url.protocol !== "https:" && !(url.protocol === "http:" && isLoopbackHost(url.hostname))) return null;
|
|
19067
|
+
return `${url.origin}${url.pathname.replace(/\/$/, "")}${CALLBACK_SUFFIX}`;
|
|
19068
|
+
}
|
|
19069
|
+
function resolveChatGptSettings(config, env = process.env) {
|
|
19070
|
+
const entry = config.chatgpt;
|
|
19071
|
+
const clientId = entry?.clientId?.trim();
|
|
19072
|
+
if (!entry || !clientId || entry.signIn !== true && entry.planUsage !== true) return null;
|
|
19073
|
+
const redirectUri = chatGptRedirectUri(config.publicUrl);
|
|
19074
|
+
if (!redirectUri) return null;
|
|
19075
|
+
const clientSecret = entry.clientSecret?.trim();
|
|
19076
|
+
return {
|
|
19077
|
+
clientId,
|
|
19078
|
+
...clientSecret ? { clientSecret } : {},
|
|
19079
|
+
signIn: entry.signIn === true,
|
|
19080
|
+
planUsage: entry.planUsage === true,
|
|
19081
|
+
requirePlan: entry.requirePlan === true,
|
|
19082
|
+
tokenKey: parseChatGptTokenKey(env.CANONRY_CHATGPT_TOKEN_KEY ?? entry.tokenKey),
|
|
19083
|
+
redirectUri
|
|
19084
|
+
};
|
|
19085
|
+
}
|
|
19086
|
+
|
|
18848
19087
|
// src/agent/agent-routes.ts
|
|
18849
19088
|
import { eq as eq35 } from "drizzle-orm";
|
|
18850
19089
|
function viewerAeroCaller(request, opts) {
|
|
@@ -18858,9 +19097,12 @@ function viewerRedact(_key, value) {
|
|
|
18858
19097
|
if (!value || typeof value !== "object" || value.role !== "assistant") return value;
|
|
18859
19098
|
const copy = { ...value };
|
|
18860
19099
|
for (const key of VIEWER_HIDDEN_ASSISTANT_KEYS) delete copy[key];
|
|
18861
|
-
if (typeof copy.errorMessage === "string" && copy.errorMessage) copy.errorMessage =
|
|
19100
|
+
if (typeof copy.errorMessage === "string" && copy.errorMessage) copy.errorMessage = viewerErrorText(copy.errorMessage);
|
|
18862
19101
|
return copy;
|
|
18863
19102
|
}
|
|
19103
|
+
function viewerErrorText(message) {
|
|
19104
|
+
return isChatGptAeroError(message) ? message : VIEWER_ERROR_MESSAGE;
|
|
19105
|
+
}
|
|
18864
19106
|
function redactForViewer(value) {
|
|
18865
19107
|
return JSON.parse(JSON.stringify(value, viewerRedact));
|
|
18866
19108
|
}
|
|
@@ -18908,7 +19150,7 @@ async function streamAgentTurn(reply, agent, turn) {
|
|
|
18908
19150
|
const write = (payload) => {
|
|
18909
19151
|
if (reply.raw.writableEnded) return;
|
|
18910
19152
|
try {
|
|
18911
|
-
const frame = turn.viewer && payload.type === "error" ? { type: "error", message:
|
|
19153
|
+
const frame = turn.viewer && payload.type === "error" ? { type: "error", message: viewerErrorText(payload.message) } : payload;
|
|
18912
19154
|
reply.raw.write(`data: ${JSON.stringify(frame, turn.viewer ? viewerRedact : void 0)}
|
|
18913
19155
|
|
|
18914
19156
|
`);
|
|
@@ -21129,12 +21371,22 @@ async function createServer(opts) {
|
|
|
21129
21371
|
proactive: agentProactive,
|
|
21130
21372
|
managedSweeps: dashboardManagedRunKinds.includes(SchedulableRunKinds["answer-visibility"])
|
|
21131
21373
|
}) : void 0;
|
|
21374
|
+
const chatgptAccounts = new ChatGptAccounts({
|
|
21375
|
+
db: opts.db,
|
|
21376
|
+
settings: () => resolveChatGptSettings(opts.config)
|
|
21377
|
+
});
|
|
21378
|
+
if (opts.config.chatgpt && (opts.config.chatgpt.signIn || opts.config.chatgpt.planUsage) && !resolveChatGptSettings(opts.config)) {
|
|
21379
|
+
log29.warn("chatgpt.disabled", {
|
|
21380
|
+
reason: "Sign in with ChatGPT needs chatgpt.clientId and an HTTPS publicUrl; it stays off until both are set."
|
|
21381
|
+
});
|
|
21382
|
+
}
|
|
21132
21383
|
const agentAllowViewers = agentEnabled && resolveAgentAllowViewers(process.env, opts.config);
|
|
21133
21384
|
const viewerAeroSessions = agentAllowViewers ? new ViewerAeroSessions({
|
|
21134
21385
|
db: opts.db,
|
|
21135
21386
|
config: opts.config,
|
|
21136
21387
|
selfApiUrl: opts.config.apiUrl,
|
|
21137
|
-
managedSweeps: dashboardManagedRunKinds.includes(SchedulableRunKinds["answer-visibility"])
|
|
21388
|
+
managedSweeps: dashboardManagedRunKinds.includes(SchedulableRunKinds["answer-visibility"]),
|
|
21389
|
+
chatgpt: chatgptAccounts
|
|
21138
21390
|
}) : void 0;
|
|
21139
21391
|
const runCoordinator = new RunCoordinator(
|
|
21140
21392
|
opts.db,
|
|
@@ -22441,6 +22693,9 @@ async function createServer(opts) {
|
|
|
22441
22693
|
path: sessionCookiePath,
|
|
22442
22694
|
...sessionCookieSecure ? { secure: true } : {}
|
|
22443
22695
|
},
|
|
22696
|
+
chatgptAccounts,
|
|
22697
|
+
chatgptPreferredModel: () => preferredChatGptModel(opts.config),
|
|
22698
|
+
dashboardPath: basePath ?? "/",
|
|
22444
22699
|
// Whether an operator has declared which hops to believe. The per-caller
|
|
22445
22700
|
// sign-in budget depends on this being the truth rather than something
|
|
22446
22701
|
// inferred from a header the caller controls.
|
|
@@ -23194,6 +23449,9 @@ async function createServer(opts) {
|
|
|
23194
23449
|
return resolved ? { id: resolved.user.id, name: resolved.user.name } : null;
|
|
23195
23450
|
},
|
|
23196
23451
|
credentials: credentialChecker,
|
|
23452
|
+
// A person whose account signs in only with ChatGPT approves MCP
|
|
23453
|
+
// clients too: the consent page offers it and comes back to itself.
|
|
23454
|
+
chatgptSignInUrl: (returnTo) => chatgptAccounts.signInEnabled() ? `${apiPrefix}/auth/chatgpt/start?${new URLSearchParams({ intent: "login", returnTo }).toString()}` : null,
|
|
23197
23455
|
startSession: (userId) => {
|
|
23198
23456
|
const token = createUserSession(opts.db, userId);
|
|
23199
23457
|
return serializeUserSessionCookie({
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
citationGlyph,
|
|
4
4
|
citedBase,
|
|
5
5
|
mentionGlyph
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-C2YVADFC.js";
|
|
7
7
|
import {
|
|
8
8
|
createApiClient
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-S7ZOYNW3.js";
|
|
10
|
+
import "./chunk-4CF5536B.js";
|
|
11
11
|
import "./chunk-AOJU5LKX.js";
|
|
12
12
|
import "./chunk-HGMYEDAQ.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-NHBXQWE3.js";
|
|
14
14
|
import "./chunk-MLKGABMK.js";
|
|
15
15
|
|
|
16
16
|
// src/commands/citations.ts
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
buildCliCatalog,
|
|
4
4
|
printCliCatalog,
|
|
5
5
|
renderTopLevelHelp
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-7JJCFGL2.js";
|
|
7
|
+
import "./chunk-G4ODBZO7.js";
|
|
8
8
|
import "./chunk-Z7IUAJOF.js";
|
|
9
9
|
import "./chunk-HGMYEDAQ.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-NHBXQWE3.js";
|
|
11
11
|
import "./chunk-MLKGABMK.js";
|
|
12
12
|
export {
|
|
13
13
|
CLI_ROOT_SUMMARIES,
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
REGISTERED_CLI_COMMANDS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BG6TVNA6.js";
|
|
4
4
|
import "./chunk-6GO5VVAC.js";
|
|
5
5
|
import "./chunk-VJWDBFSL.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-NAJ3ZYZ2.js";
|
|
7
7
|
import "./chunk-TSENU4GG.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-S7ZOYNW3.js";
|
|
9
|
+
import "./chunk-4CF5536B.js";
|
|
10
|
+
import "./chunk-G4ODBZO7.js";
|
|
11
11
|
import "./chunk-Z7IUAJOF.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-WNR3YQAD.js";
|
|
13
13
|
import "./chunk-AOJU5LKX.js";
|
|
14
14
|
import "./chunk-HGMYEDAQ.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-NHBXQWE3.js";
|
|
16
16
|
import "./chunk-MLKGABMK.js";
|
|
17
17
|
export {
|
|
18
18
|
REGISTERED_CLI_COMMANDS
|