@qwen-code/arena-agent 0.0.10-dev.8-test.0 → 0.0.10-test.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.
Files changed (151) hide show
  1. package/.env.example +61 -10
  2. package/CHANGELOG.md +148 -17
  3. package/README.md +309 -46
  4. package/dist/agent.d.ts +20 -6
  5. package/dist/agent.js +353 -72
  6. package/dist/agent.js.map +1 -1
  7. package/dist/anthropic.d.ts +1 -1
  8. package/dist/anthropic.js +46 -57
  9. package/dist/anthropic.js.map +1 -1
  10. package/dist/arena-history.d.ts +12 -0
  11. package/dist/arena-history.js +119 -0
  12. package/dist/arena-history.js.map +1 -0
  13. package/dist/ask-user.js +44 -2
  14. package/dist/ask-user.js.map +1 -1
  15. package/dist/attachment-limits.d.ts +4 -0
  16. package/dist/attachment-limits.js +10 -0
  17. package/dist/attachment-limits.js.map +1 -0
  18. package/dist/attachments.d.ts +4 -2
  19. package/dist/attachments.js +9 -11
  20. package/dist/attachments.js.map +1 -1
  21. package/dist/brave-search.js +11 -7
  22. package/dist/brave-search.js.map +1 -1
  23. package/dist/canonical-data.d.ts +9 -0
  24. package/dist/canonical-data.js +12 -3
  25. package/dist/canonical-data.js.map +1 -1
  26. package/dist/cli.js +140 -40
  27. package/dist/cli.js.map +1 -1
  28. package/dist/code-tool-schema.d.ts +3 -0
  29. package/dist/code-tool-schema.js +92 -0
  30. package/dist/code-tool-schema.js.map +1 -0
  31. package/dist/code-tools.d.ts +2 -1
  32. package/dist/code-tools.js +103 -31
  33. package/dist/code-tools.js.map +1 -1
  34. package/dist/compaction-threshold.d.ts +3 -0
  35. package/dist/compaction-threshold.js +6 -0
  36. package/dist/compaction-threshold.js.map +1 -0
  37. package/dist/compaction.d.ts +24 -7
  38. package/dist/compaction.js +242 -66
  39. package/dist/compaction.js.map +1 -1
  40. package/dist/config.d.ts +17 -0
  41. package/dist/config.js +30 -5
  42. package/dist/config.js.map +1 -1
  43. package/dist/connector-errors.d.ts +16 -0
  44. package/dist/connector-errors.js +69 -0
  45. package/dist/connector-errors.js.map +1 -0
  46. package/dist/connector-files.d.ts +31 -0
  47. package/dist/connector-files.js +249 -0
  48. package/dist/connector-files.js.map +1 -0
  49. package/dist/connector-input.d.ts +10 -0
  50. package/dist/connector-input.js +79 -0
  51. package/dist/connector-input.js.map +1 -0
  52. package/dist/connector-mcp.d.ts +60 -0
  53. package/dist/connector-mcp.js +474 -0
  54. package/dist/connector-mcp.js.map +1 -0
  55. package/dist/connectors.d.ts +13 -0
  56. package/dist/connectors.js +69 -0
  57. package/dist/connectors.js.map +1 -0
  58. package/dist/fetch-page.js +2 -2
  59. package/dist/fetch-page.js.map +1 -1
  60. package/dist/history.d.ts +16 -5
  61. package/dist/history.js +73 -14
  62. package/dist/history.js.map +1 -1
  63. package/dist/image-choice.d.ts +23 -0
  64. package/dist/image-choice.js +190 -0
  65. package/dist/image-choice.js.map +1 -0
  66. package/dist/image-input-fallback.js +5 -0
  67. package/dist/image-input-fallback.js.map +1 -1
  68. package/dist/image-model.d.ts +6 -0
  69. package/dist/image-model.js +32 -0
  70. package/dist/image-model.js.map +1 -0
  71. package/dist/midturn-checkpoint-hook.d.ts +14 -1
  72. package/dist/midturn-checkpoint-hook.js.map +1 -1
  73. package/dist/mode.js +1 -1
  74. package/dist/mode.js.map +1 -1
  75. package/dist/model-capabilities.js +18 -8
  76. package/dist/model-capabilities.js.map +1 -1
  77. package/dist/model-router-media.js +55 -3
  78. package/dist/model-router-media.js.map +1 -1
  79. package/dist/model-stream.d.ts +16 -0
  80. package/dist/model-stream.js +129 -0
  81. package/dist/model-stream.js.map +1 -0
  82. package/dist/openai-responses.d.ts +2 -1
  83. package/dist/openai-responses.js +85 -88
  84. package/dist/openai-responses.js.map +1 -1
  85. package/dist/process-manager.js +9 -9
  86. package/dist/process-manager.js.map +1 -1
  87. package/dist/prompts.d.ts +0 -2
  88. package/dist/prompts.js +10 -60
  89. package/dist/prompts.js.map +1 -1
  90. package/dist/protocol.d.ts +5 -1
  91. package/dist/protocol.js +23 -2
  92. package/dist/protocol.js.map +1 -1
  93. package/dist/provider.d.ts +18 -0
  94. package/dist/provider.js +120 -51
  95. package/dist/provider.js.map +1 -1
  96. package/dist/repo.d.ts +1 -1
  97. package/dist/repo.js +26 -4
  98. package/dist/repo.js.map +1 -1
  99. package/dist/routify-web-fetch.js +2 -2
  100. package/dist/routify-web-fetch.js.map +1 -1
  101. package/dist/server.js +55 -27
  102. package/dist/server.js.map +1 -1
  103. package/dist/session-memory-prompts.d.ts +3 -1
  104. package/dist/session-memory-prompts.js +4 -2
  105. package/dist/session-memory-prompts.js.map +1 -1
  106. package/dist/side-query.js +5 -0
  107. package/dist/side-query.js.map +1 -1
  108. package/dist/spec.d.ts +5 -4
  109. package/dist/spec.js +31 -23
  110. package/dist/spec.js.map +1 -1
  111. package/dist/startup-config.d.ts +39 -0
  112. package/dist/startup-config.js +347 -0
  113. package/dist/startup-config.js.map +1 -0
  114. package/dist/startup-main-config.d.ts +63 -0
  115. package/dist/startup-main-config.js +94 -0
  116. package/dist/startup-main-config.js.map +1 -0
  117. package/dist/startup-tool-config.d.ts +8 -0
  118. package/dist/startup-tool-config.js +116 -0
  119. package/dist/startup-tool-config.js.map +1 -0
  120. package/dist/summary-compaction.d.ts +29 -0
  121. package/dist/{legacy-compaction.js → summary-compaction.js} +79 -14
  122. package/dist/summary-compaction.js.map +1 -0
  123. package/dist/tools.d.ts +5 -1
  124. package/dist/tools.js +195 -68
  125. package/dist/tools.js.map +1 -1
  126. package/dist/tui.js +26 -6
  127. package/dist/tui.js.map +1 -1
  128. package/dist/types.d.ts +21 -1
  129. package/dist/web/app.js +30 -5
  130. package/dist/web/app.js.map +1 -1
  131. package/dist/workspace.js +61 -13
  132. package/dist/workspace.js.map +1 -1
  133. package/docs/BINARY_DISTRIBUTION.md +44 -8
  134. package/docs/MODES_AND_RELEASES.md +79 -6
  135. package/docs/SDK.md +1 -0
  136. package/modes/code-arena/capture-provenance.json +57 -0
  137. package/modes/code-arena/full-stack/dependencies.lock.json +8670 -0
  138. package/modes/code-arena/full-stack/system-prompt.txt +1 -1
  139. package/modes/code-arena/full-stack/template/eslint.config.mjs +3 -4
  140. package/modes/code-arena/full-stack/template/postcss.config.mjs +2 -2
  141. package/modes/code-arena/full-stack/tools.json +186 -186
  142. package/modes/code-arena/html/system-prompt.txt +1 -1
  143. package/modes/code-arena/html/tools.json +123 -123
  144. package/modes/code-arena/react/dependencies.lock.json +2707 -0
  145. package/modes/code-arena/react/system-prompt.txt +4 -3
  146. package/modes/code-arena/react/tools.json +178 -184
  147. package/package.json +7 -2
  148. package/scripts/README.md +23 -4
  149. package/web/styles.css +22 -0
  150. package/dist/legacy-compaction.d.ts +0 -16
  151. package/dist/legacy-compaction.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connector-input.js","sourceRoot":"","sources":["../src/connector-input.ts"],"names":[],"mappings":"AAEA,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CAAC,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC5I,SAAS,OAAO,CAAC,MAAc,EAAE,IAAY;IAC3C,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,OAAO,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QACjG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACtB,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,IAAS,EAAE,GAAW,EAAE,EAAE,CAC/E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AAC;QAC5D,CAAC;aAAM,IAAI,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,WAAW,CAAC,IAAI,EAAC,KAAK,EAAC,IAAI,CAAC;YAAE,MAAM,CAAC,GAAG,CAAC,GAAC,IAAI,CAAC;IAC9F,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,60 @@
1
+ import { type CallToolResult } from "@modelcontextprotocol/sdk/types.js";
2
+ import { type ValidateFunction } from "ajv";
3
+ import { type ConnectorService } from "./connectors.js";
4
+ import { type ConnectorFileOptions } from "./connector-files.js";
5
+ import type { Message, ToolDefinition } from "./types.js";
6
+ export interface MergeConnectorConfig {
7
+ accessKey?: string;
8
+ toolPackId?: string;
9
+ registeredUserId?: string;
10
+ /** Default: https://ah-api.merge.dev. HTTP is allowed only on loopback. */
11
+ apiBase?: string;
12
+ timeoutMs?: number;
13
+ }
14
+ export declare function mergeConnectorConfigFromEnv(): MergeConnectorConfig;
15
+ interface CatalogEntry {
16
+ name: string;
17
+ description: string;
18
+ }
19
+ export declare function capturedConnectorCatalog(service: ConnectorService): CatalogEntry[];
20
+ export declare function capturedConnectorDefinitions(service: ConnectorService): ToolDefinition[] | undefined;
21
+ export declare const connectorFailureText = "Something went wrong. Please try again.";
22
+ export declare const connectorTruncationMarker = "\n...[middle of result omitted]...\n";
23
+ export declare const connectorTruncationNote = "This result is not complete. It holds the start and the end of a larger result, and the middle is missing. Do not parse it as JSON. The same call with the same arguments returns this same truncated result. If this tool offers filters or pagination, use those arguments to request a smaller result. If it offers neither, do not invent arguments or infer values from the omitted content. Use another tool that can return the required detail, or tell the user that the detail is unavailable.";
24
+ /** Captured display shape, independent of the backend's negotiated MCP revision. */
25
+ export declare function formatConnectorResult(result: CallToolResult): string;
26
+ export declare class ConnectorTools {
27
+ private readonly config;
28
+ private readonly disallowed;
29
+ private readonly signal?;
30
+ private readonly allowed;
31
+ private readonly registered;
32
+ private readonly connections;
33
+ private readonly loading;
34
+ private readonly loaded;
35
+ private readonly connected;
36
+ private readonly files;
37
+ private readonly failures;
38
+ private readonly completedWrites;
39
+ private readonly runningWrites;
40
+ private readonly fileSizes;
41
+ constructor(allowed: readonly ConnectorService[], config?: MergeConnectorConfig, disallowed?: readonly string[], signal?: AbortSignal | undefined, options?: ConnectorFileOptions & {
42
+ connected?: readonly string[];
43
+ });
44
+ definitions(): ToolDefinition[];
45
+ validator(name: string): ValidateFunction | undefined;
46
+ normalizeArguments(name: string, value: unknown): unknown;
47
+ historyValue(name: string, value: unknown): unknown;
48
+ has(name: string): boolean;
49
+ recognizes(name: string): boolean;
50
+ discover(service: string): Promise<string>;
51
+ private discoveryResult;
52
+ private load;
53
+ call(name: string, args: Record<string, unknown>): Promise<string>;
54
+ private rememberFileSizes;
55
+ beginTurn(history?: readonly Message[]): Promise<void>;
56
+ close(): Promise<void>;
57
+ }
58
+ /** Restore discovery only, never replay page/event writes when resuming a turn. */
59
+ export declare function loadedConnectorsFromHistory(history: readonly Message[]): ConnectorService[];
60
+ export {};
@@ -0,0 +1,474 @@
1
+ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
2
+ import { StreamableHTTPClientTransport, StreamableHTTPError } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
3
+ import { CallToolResultSchema, ListToolsResultSchema, McpError, ErrorCode } from "@modelcontextprotocol/sdk/types.js";
4
+ import { Ajv } from "ajv";
5
+ import { Ajv2020 } from "ajv/dist/2020.js";
6
+ import addFormats from "ajv-formats";
7
+ import { connectorCatalogJson, connectorToolDefinitionsJson } from "./canonical-data.js";
8
+ import { normalizeConnectors, normalizeConnectedConnectors, connectorSlug } from "./connectors.js";
9
+ import { storedJson } from "./arena-history.js";
10
+ import { connectorBackendInput, connectorSchemaValue, normalizeConnectorInput } from "./connector-input.js";
11
+ import { connectorErrorText, connectorResultFailure, connectorWrites, completedConnectorWrite, describeConnectorFailure, repeatedConnectorFailure } from "./connector-errors.js";
12
+ import { ConnectorFiles, ConnectorFileError, connectorApiBase, connectorDownloadTools, connectorFileLimit, connectorResultObjects, oversizedConnectorDownload } from "./connector-files.js";
13
+ export function mergeConnectorConfigFromEnv() {
14
+ const timeout = process.env.ARENA_CONNECTOR_TIMEOUT_MS;
15
+ if (timeout && (!Number.isSafeInteger(Number(timeout)) || Number(timeout) <= 0)) {
16
+ throw new Error("ARENA_CONNECTOR_TIMEOUT_MS must be a positive integer");
17
+ }
18
+ return {
19
+ accessKey: process.env.ARENA_MERGE_ACCESS_KEY,
20
+ toolPackId: process.env.ARENA_MERGE_TOOL_PACK_ID,
21
+ registeredUserId: process.env.ARENA_MERGE_REGISTERED_USER_ID,
22
+ apiBase: process.env.ARENA_MERGE_API_BASE,
23
+ timeoutMs: timeout ? Number(timeout) : undefined,
24
+ };
25
+ }
26
+ const catalog = JSON.parse(connectorCatalogJson);
27
+ const capturedDefinitions = JSON.parse(connectorToolDefinitionsJson);
28
+ export function capturedConnectorCatalog(service) {
29
+ return structuredClone(catalog[service]);
30
+ }
31
+ export function capturedConnectorDefinitions(service) {
32
+ return structuredClone(capturedDefinitions[service]);
33
+ }
34
+ // 1008-dashscope.jsonl, row 359 (also duplicated in rows 1706 and 1871).
35
+ export const connectorFailureText = "Something went wrong. Please try again.";
36
+ export const connectorTruncationMarker = "\n...[middle of result omitted]...\n";
37
+ export const connectorTruncationNote = "This result is not complete. It holds the start and the end of a larger result, and the middle is missing. Do not parse it as JSON. The same call with the same arguments returns this same truncated result. If this tool offers filters or pagination, use those arguments to request a smaller result. If it offers neither, do not invent arguments or infer values from the omitted content. Use another tool that can return the required detail, or tell the user that the detail is unavailable.";
38
+ /** Captured display shape, independent of the backend's negotiated MCP revision. */
39
+ export function formatConnectorResult(result) {
40
+ // Newer MCP revisions duplicate text into structuredContent. The captured
41
+ // Arena surface only exposes these fields; do not re-serialize content.text.
42
+ const text = JSON.stringify({
43
+ content: result.content,
44
+ ...(result.isError === undefined ? {} : { isError: result.isError }),
45
+ ...(result._meta === undefined ? {} : { _meta: result._meta }),
46
+ });
47
+ // Head/tail lengths and marker are observed. 20k is a local boundary choice:
48
+ // this export has no untruncated examples close enough to prove the threshold.
49
+ const characters = Array.from(text);
50
+ if (characters.length > 20_000) {
51
+ return JSON.stringify({ status: "success",
52
+ result_text: characters.slice(0, 15_000).join("") + connectorTruncationMarker + characters.slice(-4_000).join(""),
53
+ truncated: true,
54
+ truncation_note: connectorTruncationNote });
55
+ }
56
+ return JSON.stringify({ status: "success", result_text: text });
57
+ }
58
+ function localDiscoveryError(service, error, message) {
59
+ // Backend configuration failures are local diagnostics, separate from the
60
+ // captured enabled/disconnected/unsupported app states.
61
+ return JSON.stringify({ status: "error", connector: service, error, message });
62
+ }
63
+ function compileConnectorSchema(schema, defaults = false) {
64
+ const options = { strict: false, allErrors: true, removeAdditional: false,
65
+ coerceTypes: false, useDefaults: defaults };
66
+ const ajv = String(schema.$schema || "").includes("2020-12")
67
+ ? new Ajv2020(options) : new Ajv(options);
68
+ addFormats(ajv);
69
+ return ajv.compile(structuredClone(schema));
70
+ }
71
+ function mergeUrl(config, service) {
72
+ const url = connectorApiBase(config);
73
+ url.pathname = `${url.pathname.replace(/\/$/, "")}/api/v1/tool-packs/${encodeURIComponent(config.toolPackId)}/registered-users/${encodeURIComponent(config.registeredUserId)}/mcp`;
74
+ url.searchParams.set("connectors", service);
75
+ url.searchParams.set("paginated", "true");
76
+ return url;
77
+ }
78
+ /** One serialized stream per service, so rotating MCP session IDs stay ordered. */
79
+ class MergeConnection {
80
+ url;
81
+ config;
82
+ signal;
83
+ client;
84
+ tail = Promise.resolve();
85
+ constructor(url, config, signal) {
86
+ this.url = url;
87
+ this.config = config;
88
+ this.signal = signal;
89
+ }
90
+ async withClient(operation) {
91
+ const pending = this.tail.then(async () => {
92
+ this.signal?.throwIfAborted();
93
+ try {
94
+ if (!this.client) {
95
+ const client = new Client({ name: "arena-harness-connectors", version: "1" });
96
+ const transport = new StreamableHTTPClientTransport(this.url, {
97
+ requestInit: { headers: { Authorization: `Bearer ${this.config.accessKey}` }, redirect: "error" },
98
+ reconnectionOptions: { maxRetries: 0, initialReconnectionDelay: 1000,
99
+ maxReconnectionDelay: 1000, reconnectionDelayGrowFactor: 1 },
100
+ });
101
+ this.client = client;
102
+ // No OAuth provider and no POST retries: a timed-out create may already
103
+ // have succeeded. Reconnect only for a subsequent, explicit invocation.
104
+ // SDK request timeouts cover initialize, but not the subsequent
105
+ // notifications/initialized HTTP request. Bound the whole handshake.
106
+ const cancelConnect = () => { void transport.close(); };
107
+ const timer = setTimeout(cancelConnect, this.config.timeoutMs ?? 60_000);
108
+ this.signal?.addEventListener("abort", cancelConnect, { once: true });
109
+ try {
110
+ await client.connect(transport, this.requestOptions());
111
+ this.signal?.throwIfAborted();
112
+ }
113
+ finally {
114
+ clearTimeout(timer);
115
+ this.signal?.removeEventListener("abort", cancelConnect);
116
+ }
117
+ }
118
+ return await operation(this.client);
119
+ }
120
+ catch (error) {
121
+ await this.disconnect();
122
+ throw error;
123
+ }
124
+ });
125
+ this.tail = pending.catch(() => { });
126
+ return pending;
127
+ }
128
+ requestOptions() {
129
+ return { signal: this.signal, timeout: this.config.timeoutMs ?? 60_000 };
130
+ }
131
+ listTools() {
132
+ return this.withClient(async (client) => {
133
+ const tools = [];
134
+ const cursors = new Set();
135
+ let cursor;
136
+ do {
137
+ const page = await client.request({ method: "tools/list", params: cursor ? { cursor } : {} }, ListToolsResultSchema, this.requestOptions());
138
+ tools.push(...page.tools);
139
+ cursor = page.nextCursor;
140
+ if (cursor && cursors.has(cursor))
141
+ throw new Error("MCP tools/list repeated its cursor");
142
+ if (cursor)
143
+ cursors.add(cursor);
144
+ if (cursors.size > 100)
145
+ throw new Error("MCP tool catalog exceeded the pagination limit");
146
+ } while (cursor);
147
+ return tools;
148
+ });
149
+ }
150
+ callTool(name, args) {
151
+ return this.withClient(client => client.request({ method: "tools/call", params: { name, arguments: args } }, CallToolResultSchema, this.requestOptions()));
152
+ }
153
+ async disconnect() {
154
+ const client = this.client;
155
+ this.client = undefined;
156
+ await client?.close().catch(() => { });
157
+ }
158
+ async close() {
159
+ await this.tail;
160
+ await this.disconnect();
161
+ }
162
+ }
163
+ export class ConnectorTools {
164
+ config;
165
+ disallowed;
166
+ signal;
167
+ allowed;
168
+ registered = new Map();
169
+ connections = new Map();
170
+ loading = new Map();
171
+ loaded = [];
172
+ connected;
173
+ files;
174
+ failures = new Map();
175
+ completedWrites = new Set();
176
+ runningWrites = new Set();
177
+ fileSizes = new Map();
178
+ constructor(allowed, config = {}, disallowed = [], signal, options = {}) {
179
+ this.config = config;
180
+ this.disallowed = disallowed;
181
+ this.signal = signal;
182
+ this.allowed = normalizeConnectors(allowed);
183
+ this.connected = normalizeConnectedConnectors(options.connected) || this.allowed;
184
+ this.files = new ConnectorFiles(config, options, signal);
185
+ }
186
+ definitions() {
187
+ return [...this.registered.values()].map(tool => structuredClone(tool.definition));
188
+ }
189
+ validator(name) { return this.registered.get(name)?.validate; }
190
+ normalizeArguments(name, value) { return normalizeConnectorInput(name, value); }
191
+ historyValue(name, value) {
192
+ const schema = this.registered.get(name)?.definition.function.parameters;
193
+ return schema ? connectorSchemaValue(value, schema) : value;
194
+ }
195
+ has(name) { return this.registered.has(name); }
196
+ recognizes(name) {
197
+ return this.allowed.some(service => catalog[service].some(tool => `${service}__${tool.name}` === name));
198
+ }
199
+ async discover(service) {
200
+ service = connectorSlug(service);
201
+ if (!Object.hasOwn(catalog, service)) {
202
+ return this.connected.includes(service) ? localDiscoveryError(service, "connector_not_implemented", "This connected app has no captured tool contract in this harness.")
203
+ : JSON.stringify({ status: "unsupported" });
204
+ }
205
+ if (this.disallowed.includes("list_connector_tools"))
206
+ return localDiscoveryError(service, "connector_not_enabled", "Connector discovery is disabled.");
207
+ if (!this.connected.includes(service))
208
+ return JSON.stringify({ status: "disconnected", connector: service });
209
+ if (!this.allowed.includes(service)) {
210
+ return JSON.stringify({ status: this.connected.includes(service) ? "disabled" : "disconnected", connector: service });
211
+ }
212
+ const slug = service;
213
+ if (this.loaded.includes(slug))
214
+ return this.discoveryResult(slug);
215
+ const existing = this.loading.get(slug);
216
+ if (existing)
217
+ return existing;
218
+ const pending = this.load(slug);
219
+ this.loading.set(slug, pending);
220
+ try {
221
+ return await pending;
222
+ }
223
+ finally {
224
+ this.loading.delete(slug);
225
+ }
226
+ }
227
+ discoveryResult(service) {
228
+ // Current-reply captures put status first; persisted history later sorts
229
+ // the same value to tools/status/connector through storedJson.
230
+ return JSON.stringify({ status: "enabled", connector: service,
231
+ tools: catalog[service].filter(tool => this.registered.has(`${service}__${tool.name}`)) });
232
+ }
233
+ async load(service) {
234
+ const missing = [["accessKey", "ARENA_MERGE_ACCESS_KEY"], ["toolPackId", "ARENA_MERGE_TOOL_PACK_ID"],
235
+ ["registeredUserId", "ARENA_MERGE_REGISTERED_USER_ID"]]
236
+ .filter(([key]) => !this.config[key]?.trim()).map(([, variable]) => variable);
237
+ if (missing.length)
238
+ return localDiscoveryError(service, "connector_backend_not_configured", `Set ${missing.join(", ")} and authorize this app for the Registered User in Merge.`);
239
+ try {
240
+ const connection = this.connections.get(service) || new MergeConnection(mergeUrl(this.config, service), this.config, this.signal);
241
+ this.connections.set(service, connection);
242
+ const remote = await connection.listTools();
243
+ const byName = new Map(remote.map(tool => [tool.name, tool]));
244
+ if (byName.size !== remote.length)
245
+ throw new Error("MCP returned duplicate tool names");
246
+ const expected = catalog[service].filter(tool => !this.disallowed.includes(`${service}__${tool.name}`));
247
+ const absent = expected.filter(tool => !byName.has(`${service}__${tool.name}`));
248
+ if (absent.length)
249
+ return localDiscoveryError(service, "connector_toolset_mismatch", `The Merge Tool Pack is missing captured tools: ${absent.map(tool => tool.name).join(", ")}.`);
250
+ const pending = [];
251
+ for (const captured of expected) {
252
+ const name = `${service}__${captured.name}`;
253
+ const tool = byName.get(name);
254
+ // Arena's model schema differs from Merge's schema, including file_path
255
+ // and relaxed nullable fields. Preserve both sides of that boundary.
256
+ const definition = capturedDefinitions[service]?.find(t => t.function.name === name)
257
+ || { type: "function", function: { name, description: captured.description, parameters: structuredClone(tool.inputSchema) } };
258
+ const schema = structuredClone(definition.function.parameters);
259
+ const validateBackend = compileConnectorSchema(tool.inputSchema);
260
+ pending.push({ service, definition: structuredClone(definition), validate: capturedDefinitions[service]
261
+ ? compileConnectorSchema(schema, true) : validateBackend,
262
+ backendSchema: structuredClone(tool.inputSchema), validateBackend });
263
+ }
264
+ // Publish atomically: a failed page or schema never leaves half an app loaded.
265
+ for (const tool of pending)
266
+ this.registered.set(tool.definition.function.name, tool);
267
+ this.loaded.push(service);
268
+ return this.discoveryResult(service);
269
+ }
270
+ catch (error) {
271
+ if (this.signal?.aborted)
272
+ throw error;
273
+ // Avoid echoing server bodies, URLs, or authorization headers to the model.
274
+ const detail = error instanceof StreamableHTTPError ? ` (HTTP ${error.code})` : "";
275
+ return localDiscoveryError(service, "connector_discovery_failed", `Unable to load the Merge tool catalog${detail}. Check backend configuration, authorization and schema compatibility.`);
276
+ }
277
+ }
278
+ async call(name, args) {
279
+ const tool = this.registered.get(name);
280
+ if (!tool)
281
+ return connectorFailureText;
282
+ const key = storedJson({ name, args }), write = connectorWrites(name);
283
+ const failed = this.failures.get(key);
284
+ if (failed) {
285
+ const repeated = repeatedConnectorFailure(failed.code);
286
+ if (failed.code === "file_transfer_failed")
287
+ repeated.error = failed.error + " " + repeated.error;
288
+ return connectorErrorText(repeated);
289
+ }
290
+ if (write && (this.runningWrites.has(key) || this.completedWrites.has(key)))
291
+ return connectorErrorText(completedConnectorWrite(this.runningWrites.has(key)));
292
+ if (write)
293
+ this.runningWrites.add(key);
294
+ try {
295
+ if (name === "google_drive__download_file") {
296
+ const size = this.fileSizes.get(String(args.input?.file_id));
297
+ if (size !== undefined && size > connectorFileLimit)
298
+ throw oversizedConnectorDownload(size);
299
+ }
300
+ let backendArgs = await this.files.upload(name, structuredClone(args));
301
+ if (connectorDownloadTools.has(name)) {
302
+ // These flags are hidden by the captured Arena schema; file bytes are
303
+ // returned to the workspace instead of being exposed to the model.
304
+ const inputSchema = tool.backendSchema.properties?.input;
305
+ const properties = inputSchema?.properties || inputSchema?.anyOf?.find((s) => s.type === "object")?.properties;
306
+ const flag = properties?.return_download_url ? "return_download_url" : properties?.returnDownloadUrl ? "returnDownloadUrl" : undefined;
307
+ if (flag && backendArgs.input && typeof backendArgs.input === "object")
308
+ backendArgs.input[flag] = true;
309
+ }
310
+ backendArgs = connectorBackendInput(backendArgs, tool.backendSchema);
311
+ if (!tool.validateBackend(backendArgs)) {
312
+ const failure = { code: "invalid_request", error: "The configured MCP backend schema does not accept this captured Arena input. Check the connector version and configuration." };
313
+ this.failures.set(key, failure);
314
+ return connectorErrorText(failure);
315
+ }
316
+ const result = await this.connections.get(tool.service).callTool(name, backendArgs);
317
+ const failure = connectorResultFailure(result, write, name);
318
+ if (failure) {
319
+ this.failures.set(key, failure);
320
+ return connectorErrorText(failure);
321
+ }
322
+ this.rememberFileSizes(name, result);
323
+ const file = await this.files.download(name, result, backendArgs);
324
+ if (write)
325
+ this.completedWrites.add(key);
326
+ if (file !== undefined)
327
+ return JSON.stringify({ status: "success", result_text: file });
328
+ return formatConnectorResult(result);
329
+ }
330
+ catch (error) {
331
+ if (this.signal?.aborted)
332
+ throw error;
333
+ if (error instanceof ConnectorFileError) {
334
+ const failure = { code: "file_transfer_failed", error: error.message };
335
+ if (error.cacheFailure)
336
+ this.failures.set(key, failure);
337
+ return connectorErrorText(failure);
338
+ }
339
+ if (error instanceof McpError && error.code === ErrorCode.InvalidParams) {
340
+ // JSON-RPC error messages can contain credentials or backend request
341
+ // bodies. Preserve the classification without echoing those diagnostics.
342
+ const failure = describeConnectorFailure("The connector rejected the arguments.", write, "invalid_request");
343
+ this.failures.set(key, failure);
344
+ return connectorErrorText(failure);
345
+ }
346
+ // Transport diagnostics can contain credentials. Expose only status/type.
347
+ const failure = describeConnectorFailure(error instanceof StreamableHTTPError ? `HTTP ${error.code}` : "The connector request failed.", write, error instanceof StreamableHTTPError ? undefined : "provider_unavailable", error instanceof StreamableHTTPError ? error.code : undefined);
348
+ this.failures.set(key, failure);
349
+ return connectorErrorText(failure);
350
+ }
351
+ finally {
352
+ this.runningWrites.delete(key);
353
+ }
354
+ }
355
+ rememberFileSizes(name, result) {
356
+ if (!["google_drive__get_file", "google_drive__list_files", "google_drive__search_files"].includes(name))
357
+ return;
358
+ for (const object of connectorResultObjects(result)) {
359
+ const data = object.data && typeof object.data === "object" ? object.data : object;
360
+ for (const file of [data, data.file, ...(Array.isArray(data.files) ? data.files : [])]) {
361
+ if (file && typeof file.id === "string" && file.size !== null && file.size !== undefined && Number.isFinite(Number(file.size)))
362
+ this.fileSizes.set(file.id, Number(file.size));
363
+ }
364
+ }
365
+ }
366
+ async beginTurn(history) {
367
+ this.registered.clear();
368
+ this.loaded.length = 0;
369
+ this.failures.clear();
370
+ this.completedWrites.clear();
371
+ this.runningWrites.clear();
372
+ this.fileSizes.clear();
373
+ this.files.reset();
374
+ if (!history)
375
+ return;
376
+ for (const service of loadedConnectorsFromHistory(history)) {
377
+ if (!this.allowed.includes(service))
378
+ continue;
379
+ const result = JSON.parse(await this.discover(service));
380
+ if (result.status !== "enabled")
381
+ throw new Error(result.message);
382
+ }
383
+ const calls = new Map();
384
+ for (const message of history) {
385
+ if (connectorTurnBoundary(message)) {
386
+ calls.clear();
387
+ this.failures.clear();
388
+ this.completedWrites.clear();
389
+ this.fileSizes.clear();
390
+ this.files.reset();
391
+ }
392
+ if (message.role === "assistant")
393
+ for (const call of message.tool_calls || []) {
394
+ if (!this.has(call.function.name))
395
+ continue;
396
+ try {
397
+ const args = this.normalizeArguments(call.function.name, JSON.parse(call.function.arguments));
398
+ if (this.validator(call.function.name)?.(args))
399
+ calls.set(call.id, { name: call.function.name, args: args });
400
+ }
401
+ catch { /* malformed history */ }
402
+ }
403
+ if (message.role !== "tool")
404
+ continue;
405
+ const call = calls.get(message.tool_call_id);
406
+ if (!call)
407
+ continue;
408
+ try {
409
+ const result = JSON.parse(message.content), key = storedJson(call);
410
+ if (result.status === "error" && typeof result.error === "string" && !result.error.startsWith("This exact write ")) {
411
+ if (["invalid_request", "provider_unavailable", "unknown"].includes(result.code)
412
+ || (result.code === "file_transfer_failed" && /^(Arena did not send this download\.|A security filter at the connector provider)/.test(result.error))) {
413
+ if (!this.failures.has(key))
414
+ this.failures.set(key, { code: result.code, error: result.error });
415
+ }
416
+ if (result.code === "file_transfer_failed")
417
+ this.files.restoreFailure(result.error);
418
+ }
419
+ if (result.status === "success" && connectorWrites(call.name))
420
+ this.completedWrites.add(key);
421
+ if (result.status === "success" && !result.truncated) {
422
+ const mcp = JSON.parse(result.result_text);
423
+ if (Array.isArray(mcp.content))
424
+ this.rememberFileSizes(call.name, mcp);
425
+ }
426
+ }
427
+ catch { /* Plain text or truncated results do not establish successful side effects. */ }
428
+ }
429
+ }
430
+ async close() {
431
+ await Promise.all([...this.connections.values()].map(connection => connection.close()));
432
+ this.connections.clear();
433
+ this.registered.clear();
434
+ this.loaded.length = 0;
435
+ }
436
+ }
437
+ function connectorTurnBoundary(message) {
438
+ if (message.role !== "user")
439
+ return false;
440
+ const text = typeof message.content === "string" ? message.content : message.content.flatMap(part => "text" in part ? [part.text] : []).join("\n");
441
+ return !/^<arena-system-message>\nThe image\(s\) below are the result of the preceding tool call\.[\s\S]*?<\/arena-system-message>\s*$/.test(text);
442
+ }
443
+ /** Restore discovery only, never replay page/event writes when resuming a turn. */
444
+ export function loadedConnectorsFromHistory(history) {
445
+ const calls = new Map();
446
+ const loaded = new Set();
447
+ for (const message of history) {
448
+ if (connectorTurnBoundary(message)) {
449
+ calls.clear();
450
+ loaded.clear();
451
+ }
452
+ if (message.role === "assistant") {
453
+ for (const call of message.tool_calls || []) {
454
+ if (call.function.name !== "list_connector_tools")
455
+ continue;
456
+ try {
457
+ calls.set(call.id, connectorSlug(JSON.parse(call.function.arguments).service));
458
+ }
459
+ catch { /* malformed history */ }
460
+ }
461
+ }
462
+ if (message.role === "tool" && calls.has(message.tool_call_id)) {
463
+ try {
464
+ const service = calls.get(message.tool_call_id);
465
+ const result = JSON.parse(message.content);
466
+ if (service && Object.hasOwn(catalog, service) && result.status === "enabled" && result.connector === service)
467
+ loaded.add(service);
468
+ }
469
+ catch { /* Only a paired, successful discovery enables restoration. */ }
470
+ }
471
+ }
472
+ return [...loaded];
473
+ }
474
+ //# sourceMappingURL=connector-mcp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connector-mcp.js","sourceRoot":"","sources":["../src/connector-mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AACxH,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,QAAQ,EAAE,SAAS,EAAkC,MAAM,oCAAoC,CAAC;AACtJ,OAAO,EAAE,GAAG,EAAyB,MAAM,KAAK,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAyB,mBAAmB,EAAE,4BAA4B,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC1H,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC5G,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,eAAe,EAAE,uBAAuB,EAC3F,wBAAwB,EAAE,wBAAwB,EAAyB,MAAM,uBAAuB,CAAC;AAC3G,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,kBAAkB,EACvG,sBAAsB,EAAE,0BAA0B,EAA6B,MAAM,sBAAsB,CAAC;AAY9G,MAA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O,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;YACjC,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,UAAU,IAAI,EAAE,EAAE,CAAC;gBAC5C,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,sBAAsB;oBAAE,SAAS;gBAC5D,IAAI,CAAC;oBAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;gBAAC,CAAC;gBAAC,MAAM,CAAC,CAAC,uBAAuB,CAAC,CAAC;YAC3H,CAAC;QACH,CAAC;QACD,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;YAC/D,IAAI,CAAC;gBACH,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;gBAChD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBAC3C,IAAI,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,EAAC,OAAO,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,SAAS,KAAK,OAAO;oBAAE,MAAM,CAAC,GAAG,CAAC,OAA2B,CAAC,CAAC;YACxJ,CAAC;YAAC,MAAM,CAAC,CAAC,8DAA8D,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,MAAM,CAAC,CAAC;AACrB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { ToolDefinition } from "./types.js";
2
+ export declare const connectorServices: readonly ["notion", "google_calendar", "gmail", "google_drive", "google_docs", "google_sheets", "google_slides", "dropbox", "supabase", "vercel", "linear"];
3
+ export type ConnectorService = typeof connectorServices[number];
4
+ /** Conversation opt-in only; this does not establish an authenticated connection. */
5
+ export declare function normalizeConnectors(value: unknown, name?: string): ConnectorService[];
6
+ /** The host's authenticated-app snapshot may include apps without captured tools. */
7
+ export declare function normalizeConnectedConnectors(value: unknown): string[] | undefined;
8
+ export declare function connectedConnectorsFromEnv(value: string | undefined): string[] | undefined;
9
+ /** Hyphen spellings are observed in the capture's disconnected responses. */
10
+ export declare function connectorSlug(value: string): string;
11
+ export declare function connectorsFromEnv(value: string | undefined): ConnectorService[];
12
+ export declare function appendConnectorPrompt(content: string, connectors?: readonly ConnectorService[], connectedConnectors?: readonly string[]): string;
13
+ export declare function connectorDiscoveryTool(): ToolDefinition;