@contractspec/lib.ai-agent 1.60.0 → 1.62.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 (144) hide show
  1. package/dist/agent/agent-factory.d.ts +5 -0
  2. package/dist/agent/agent-factory.d.ts.map +1 -1
  3. package/dist/agent/agent-factory.js +2256 -29
  4. package/dist/agent/contract-spec-agent.d.ts +6 -0
  5. package/dist/agent/contract-spec-agent.d.ts.map +1 -1
  6. package/dist/agent/contract-spec-agent.js +2255 -29
  7. package/dist/agent/index.js +2369 -87
  8. package/dist/agent/json-runner.d.ts +1 -0
  9. package/dist/agent/json-runner.d.ts.map +1 -1
  10. package/dist/agent/json-runner.js +2288 -54
  11. package/dist/agent/unified-agent.d.ts.map +1 -1
  12. package/dist/agent/unified-agent.js +2336 -62
  13. package/dist/approval/index.js +2095 -1
  14. package/dist/approval/workflow.d.ts.map +1 -1
  15. package/dist/approval/workflow.js +2095 -1
  16. package/dist/exporters/claude-agent-exporter.d.ts.map +1 -1
  17. package/dist/exporters/claude-agent-exporter.js +2144 -35
  18. package/dist/exporters/index.js +2193 -69
  19. package/dist/exporters/opencode-exporter.d.ts.map +1 -1
  20. package/dist/exporters/opencode-exporter.js +2152 -39
  21. package/dist/i18n/catalogs/en.d.ts +9 -0
  22. package/dist/i18n/catalogs/en.d.ts.map +1 -0
  23. package/dist/i18n/catalogs/en.js +614 -0
  24. package/dist/i18n/catalogs/es.d.ts +9 -0
  25. package/dist/i18n/catalogs/es.d.ts.map +1 -0
  26. package/dist/i18n/catalogs/es.js +663 -0
  27. package/dist/i18n/catalogs/fr.d.ts +9 -0
  28. package/dist/i18n/catalogs/fr.d.ts.map +1 -0
  29. package/dist/i18n/catalogs/fr.js +629 -0
  30. package/dist/i18n/catalogs/index.d.ts +9 -0
  31. package/dist/i18n/catalogs/index.d.ts.map +1 -0
  32. package/dist/i18n/catalogs/index.js +1875 -0
  33. package/dist/i18n/i18n.test.d.ts +2 -0
  34. package/dist/i18n/i18n.test.d.ts.map +1 -0
  35. package/dist/i18n/index.d.ts +30 -0
  36. package/dist/i18n/index.d.ts.map +1 -0
  37. package/dist/i18n/index.js +2127 -0
  38. package/dist/i18n/keys.d.ts +553 -0
  39. package/dist/i18n/keys.d.ts.map +1 -0
  40. package/dist/i18n/keys.js +188 -0
  41. package/dist/i18n/locale.d.ts +34 -0
  42. package/dist/i18n/locale.d.ts.map +1 -0
  43. package/dist/i18n/locale.js +41 -0
  44. package/dist/i18n/messages.d.ts +66 -0
  45. package/dist/i18n/messages.d.ts.map +1 -0
  46. package/dist/i18n/messages.js +1939 -0
  47. package/dist/index.d.ts +1 -0
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +2556 -187
  50. package/dist/interop/index.js +2182 -47
  51. package/dist/interop/spec-consumer.d.ts.map +1 -1
  52. package/dist/interop/spec-consumer.js +2151 -34
  53. package/dist/interop/tool-consumer.d.ts.map +1 -1
  54. package/dist/interop/tool-consumer.js +2122 -13
  55. package/dist/knowledge/index.js +2105 -7
  56. package/dist/knowledge/injector.d.ts +2 -2
  57. package/dist/knowledge/injector.d.ts.map +1 -1
  58. package/dist/knowledge/injector.js +2104 -7
  59. package/dist/node/agent/agent-factory.js +2256 -29
  60. package/dist/node/agent/contract-spec-agent.js +2255 -29
  61. package/dist/node/agent/index.js +2369 -87
  62. package/dist/node/agent/json-runner.js +2288 -54
  63. package/dist/node/agent/unified-agent.js +2336 -62
  64. package/dist/node/approval/index.js +2095 -1
  65. package/dist/node/approval/workflow.js +2095 -1
  66. package/dist/node/exporters/claude-agent-exporter.js +2144 -35
  67. package/dist/node/exporters/index.js +2193 -69
  68. package/dist/node/exporters/opencode-exporter.js +2152 -39
  69. package/dist/node/i18n/catalogs/en.js +614 -0
  70. package/dist/node/i18n/catalogs/es.js +663 -0
  71. package/dist/node/i18n/catalogs/fr.js +629 -0
  72. package/dist/node/i18n/catalogs/index.js +1875 -0
  73. package/dist/node/i18n/index.js +2127 -0
  74. package/dist/node/i18n/keys.js +188 -0
  75. package/dist/node/i18n/locale.js +41 -0
  76. package/dist/node/i18n/messages.js +1939 -0
  77. package/dist/node/index.js +2556 -187
  78. package/dist/node/interop/index.js +2182 -47
  79. package/dist/node/interop/spec-consumer.js +2151 -34
  80. package/dist/node/interop/tool-consumer.js +2122 -13
  81. package/dist/node/knowledge/index.js +2105 -7
  82. package/dist/node/knowledge/injector.js +2104 -7
  83. package/dist/node/providers/claude-agent-sdk/adapter.js +2143 -22
  84. package/dist/node/providers/claude-agent-sdk/index.js +2144 -22
  85. package/dist/node/providers/claude-agent-sdk/tool-bridge.js +2101 -3
  86. package/dist/node/providers/index.js +2182 -39
  87. package/dist/node/providers/opencode-sdk/adapter.js +2148 -27
  88. package/dist/node/providers/opencode-sdk/agent-bridge.js +2110 -10
  89. package/dist/node/providers/opencode-sdk/index.js +2149 -27
  90. package/dist/node/providers/opencode-sdk/tool-bridge.js +2101 -3
  91. package/dist/node/providers/registry.js +2094 -2
  92. package/dist/node/spec/index.js +2110 -6
  93. package/dist/node/spec/registry.js +2095 -1
  94. package/dist/node/spec/spec.js +2105 -5
  95. package/dist/node/telemetry/index.js +117 -1
  96. package/dist/node/telemetry/posthog-types.js +0 -0
  97. package/dist/node/telemetry/posthog.js +132 -0
  98. package/dist/node/tools/index.js +2117 -17
  99. package/dist/node/tools/knowledge-tool.js +2105 -11
  100. package/dist/node/tools/mcp-server.js +2101 -5
  101. package/dist/node/tools/tool-adapter.js +2093 -1
  102. package/dist/providers/claude-agent-sdk/adapter.d.ts.map +1 -1
  103. package/dist/providers/claude-agent-sdk/adapter.js +2143 -22
  104. package/dist/providers/claude-agent-sdk/index.js +2144 -22
  105. package/dist/providers/claude-agent-sdk/tool-bridge.d.ts.map +1 -1
  106. package/dist/providers/claude-agent-sdk/tool-bridge.js +2101 -3
  107. package/dist/providers/index.js +2182 -39
  108. package/dist/providers/opencode-sdk/adapter.d.ts.map +1 -1
  109. package/dist/providers/opencode-sdk/adapter.js +2148 -27
  110. package/dist/providers/opencode-sdk/agent-bridge.d.ts.map +1 -1
  111. package/dist/providers/opencode-sdk/agent-bridge.js +2110 -10
  112. package/dist/providers/opencode-sdk/index.js +2149 -27
  113. package/dist/providers/opencode-sdk/tool-bridge.d.ts.map +1 -1
  114. package/dist/providers/opencode-sdk/tool-bridge.js +2101 -3
  115. package/dist/providers/registry.d.ts.map +1 -1
  116. package/dist/providers/registry.js +2094 -2
  117. package/dist/spec/index.js +2110 -6
  118. package/dist/spec/registry.d.ts.map +1 -1
  119. package/dist/spec/registry.js +2095 -1
  120. package/dist/spec/spec.d.ts +2 -0
  121. package/dist/spec/spec.d.ts.map +1 -1
  122. package/dist/spec/spec.js +2105 -5
  123. package/dist/telemetry/index.d.ts +2 -0
  124. package/dist/telemetry/index.d.ts.map +1 -1
  125. package/dist/telemetry/index.js +117 -1
  126. package/dist/telemetry/posthog-types.d.ts +60 -0
  127. package/dist/telemetry/posthog-types.d.ts.map +1 -0
  128. package/dist/telemetry/posthog-types.js +1 -0
  129. package/dist/telemetry/posthog.d.ts +81 -0
  130. package/dist/telemetry/posthog.d.ts.map +1 -0
  131. package/dist/telemetry/posthog.js +132 -0
  132. package/dist/telemetry/posthog.test.d.ts +2 -0
  133. package/dist/telemetry/posthog.test.d.ts.map +1 -0
  134. package/dist/tools/index.js +2117 -17
  135. package/dist/tools/knowledge-tool.d.ts +1 -1
  136. package/dist/tools/knowledge-tool.d.ts.map +1 -1
  137. package/dist/tools/knowledge-tool.js +2105 -11
  138. package/dist/tools/mcp-server.d.ts.map +1 -1
  139. package/dist/tools/mcp-server.js +2101 -5
  140. package/dist/tools/tool-adapter.d.ts.map +1 -1
  141. package/dist/tools/tool-adapter.js +2093 -1
  142. package/dist/types.d.ts +4 -0
  143. package/dist/types.d.ts.map +1 -1
  144. package/package.json +290 -137
@@ -12,24 +12,2119 @@ var __export = (target, all) => {
12
12
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
13
13
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
14
14
 
15
+ // src/i18n/catalogs/en.ts
16
+ import { defineTranslation } from "@contractspec/lib.contracts/translations";
17
+ var enMessages;
18
+ var init_en = __esm(() => {
19
+ enMessages = defineTranslation({
20
+ meta: {
21
+ key: "ai-agent.messages",
22
+ version: "1.0.0",
23
+ domain: "ai-agent",
24
+ description: "All user-facing, LLM-facing, and developer-facing strings for the ai-agent package",
25
+ owners: ["platform"],
26
+ stability: "experimental"
27
+ },
28
+ locale: "en",
29
+ fallback: "en",
30
+ messages: {
31
+ "agent.json.rules.validJsonOnly": {
32
+ value: "You MUST output valid JSON ONLY.",
33
+ description: "JSON runner rule: output must be valid JSON"
34
+ },
35
+ "agent.json.rules.noMarkdownFences": {
36
+ value: "Do not wrap the output in markdown fences.",
37
+ description: "JSON runner rule: no markdown code fences"
38
+ },
39
+ "agent.json.rules.noCommentary": {
40
+ value: "Do not include commentary or explanation.",
41
+ description: "JSON runner rule: no extra text"
42
+ },
43
+ "agent.json.rules.doubleQuotes": {
44
+ value: "Use double quotes for all keys and string values.",
45
+ description: "JSON runner rule: double quotes only"
46
+ },
47
+ "agent.json.rules.noTrailingCommas": {
48
+ value: "Do not include trailing commas.",
49
+ description: "JSON runner rule: no trailing commas"
50
+ },
51
+ "agent.json.defaultDescription": {
52
+ value: "JSON-only agent runner for deterministic pipelines.",
53
+ description: "Default description for the JSON runner spec"
54
+ },
55
+ "agent.json.systemPrompt": {
56
+ value: "You are a precise JSON generator.",
57
+ description: "Default system prompt for the JSON runner"
58
+ },
59
+ "knowledge.header": {
60
+ value: "# Reference Knowledge",
61
+ description: "Header for injected knowledge section in system prompt"
62
+ },
63
+ "knowledge.description": {
64
+ value: "The following information is provided for your reference. Use it to inform your responses.",
65
+ description: "Description below the knowledge header"
66
+ },
67
+ "tool.knowledge.description": {
68
+ value: "Query knowledge bases for relevant information. Use this tool when you need to look up specific information that may not be in your context.",
69
+ description: "Description for the knowledge query tool shown to the LLM"
70
+ },
71
+ "tool.knowledge.availableSpaces": {
72
+ value: "Available knowledge spaces:",
73
+ description: "Label before listing available knowledge spaces"
74
+ },
75
+ "tool.knowledge.spaceDefault": {
76
+ value: "Knowledge space",
77
+ description: "Fallback description for unnamed knowledge spaces"
78
+ },
79
+ "tool.knowledge.param.query": {
80
+ value: "The question or search query to find relevant information",
81
+ description: "Parameter description for the query field"
82
+ },
83
+ "tool.knowledge.param.spaceKey": {
84
+ value: "Specific knowledge space to query. If omitted, searches all available spaces.",
85
+ description: "Parameter description for the spaceKey field"
86
+ },
87
+ "tool.knowledge.param.topK": {
88
+ value: "Maximum number of results to return",
89
+ description: "Parameter description for the topK field"
90
+ },
91
+ "tool.knowledge.noResults": {
92
+ value: "No relevant information found in the knowledge bases.",
93
+ description: "Message when no knowledge results are found"
94
+ },
95
+ "tool.knowledge.sourceLabel": {
96
+ value: "[Source {index} - {space}] (relevance: {score}%)",
97
+ description: "Label for each knowledge search result",
98
+ placeholders: [
99
+ { name: "index", type: "number", description: "1-based source index" },
100
+ { name: "space", type: "string", description: "Knowledge space name" },
101
+ { name: "score", type: "number", description: "Relevance percentage" }
102
+ ]
103
+ },
104
+ "tool.fallbackDescription": {
105
+ value: "Execute {name}",
106
+ description: "Fallback description when a tool has no explicit description",
107
+ placeholders: [
108
+ { name: "name", type: "string", description: "Tool name" }
109
+ ]
110
+ },
111
+ "tool.mcp.param.message": {
112
+ value: "The message or query to send to the agent",
113
+ description: "MCP server: message parameter description"
114
+ },
115
+ "tool.mcp.param.sessionId": {
116
+ value: "Optional session ID to continue a conversation",
117
+ description: "MCP server: sessionId parameter description"
118
+ },
119
+ "tool.mcp.agentDescription": {
120
+ value: "Interact with {key} agent",
121
+ description: "MCP server: agent tool description",
122
+ placeholders: [
123
+ { name: "key", type: "string", description: "Agent spec key" }
124
+ ]
125
+ },
126
+ "tool.mcp.executePrompt": {
127
+ value: "Execute the {name} tool with the following arguments: {args}",
128
+ description: "MCP server: prompt sent when executing an individual tool",
129
+ placeholders: [
130
+ { name: "name", type: "string", description: "Tool name" },
131
+ {
132
+ name: "args",
133
+ type: "string",
134
+ description: "JSON-stringified arguments"
135
+ }
136
+ ]
137
+ },
138
+ "tool.mcp.toolDescription": {
139
+ value: "Execute {name} tool",
140
+ description: "MCP server: individual tool description",
141
+ placeholders: [
142
+ { name: "name", type: "string", description: "Tool name" }
143
+ ]
144
+ },
145
+ "interop.prompt.agentIdentity": {
146
+ value: "# Agent Identity",
147
+ description: "Section header for agent identity in LLM prompt"
148
+ },
149
+ "interop.prompt.youAre": {
150
+ value: "You are {key} (v{version}).",
151
+ description: "Agent identity statement in LLM prompt",
152
+ placeholders: [
153
+ { name: "key", type: "string" },
154
+ { name: "version", type: "string" }
155
+ ]
156
+ },
157
+ "interop.prompt.description": {
158
+ value: "## Description",
159
+ description: "Section header for description"
160
+ },
161
+ "interop.prompt.instructions": {
162
+ value: "## Instructions",
163
+ description: "Section header for instructions"
164
+ },
165
+ "interop.prompt.availableTools": {
166
+ value: "## Available Tools",
167
+ description: "Section header for available tools"
168
+ },
169
+ "interop.prompt.toolsIntro": {
170
+ value: "You have access to the following tools:",
171
+ description: "Introduction before listing tools"
172
+ },
173
+ "interop.prompt.parameters": {
174
+ value: "Parameters:",
175
+ description: "Label before tool parameters block"
176
+ },
177
+ "interop.prompt.knowledgeContext": {
178
+ value: "## Knowledge Context",
179
+ description: "Section header for knowledge context"
180
+ },
181
+ "interop.prompt.additionalContext": {
182
+ value: "## Additional Context",
183
+ description: "Section header for additional context"
184
+ },
185
+ "interop.md.toc": {
186
+ value: "## Table of Contents",
187
+ description: "TOC header"
188
+ },
189
+ "interop.md.overview": {
190
+ value: "## Overview",
191
+ description: "Overview header"
192
+ },
193
+ "interop.md.tools": { value: "## Tools", description: "Tools header" },
194
+ "interop.md.knowledge": {
195
+ value: "## Knowledge",
196
+ description: "Knowledge header"
197
+ },
198
+ "interop.md.policy": { value: "## Policy", description: "Policy header" },
199
+ "interop.md.metaKey": {
200
+ value: "- **Key**: `{key}`",
201
+ description: "Metadata line for key",
202
+ placeholders: [{ name: "key", type: "string" }]
203
+ },
204
+ "interop.md.metaVersion": {
205
+ value: "- **Version**: {version}",
206
+ description: "Metadata line for version",
207
+ placeholders: [{ name: "version", type: "string" }]
208
+ },
209
+ "interop.md.metaStability": {
210
+ value: "- **Stability**: {stability}",
211
+ description: "Metadata line for stability",
212
+ placeholders: [{ name: "stability", type: "string" }]
213
+ },
214
+ "interop.md.metaOwners": {
215
+ value: "- **Owners**: {owners}",
216
+ description: "Metadata line for owners",
217
+ placeholders: [{ name: "owners", type: "string" }]
218
+ },
219
+ "interop.md.metaTags": {
220
+ value: "- **Tags**: {tags}",
221
+ description: "Metadata line for tags",
222
+ placeholders: [{ name: "tags", type: "string" }]
223
+ },
224
+ "interop.md.schema": { value: "**Schema:**", description: "Schema label" },
225
+ "interop.md.automationSafe": {
226
+ value: "**Automation Safe**: {value}",
227
+ description: "Automation safe field",
228
+ placeholders: [{ name: "value", type: "string" }]
229
+ },
230
+ "interop.md.required": {
231
+ value: "(required)",
232
+ description: "Required marker"
233
+ },
234
+ "interop.md.optional": {
235
+ value: "(optional)",
236
+ description: "Optional marker"
237
+ },
238
+ "interop.md.minConfidence": {
239
+ value: "- **Minimum Confidence**: {min}",
240
+ description: "Minimum confidence policy line",
241
+ placeholders: [{ name: "min", type: "number" }]
242
+ },
243
+ "interop.md.escalationThreshold": {
244
+ value: "- **Escalation Threshold**: {threshold}",
245
+ description: "Escalation threshold policy line",
246
+ placeholders: [{ name: "threshold", type: "number" }]
247
+ },
248
+ "interop.md.escalateToolFailure": {
249
+ value: "- **Escalate on Tool Failure**: Yes",
250
+ description: "Escalate on tool failure policy line"
251
+ },
252
+ "interop.md.escalateTimeout": {
253
+ value: "- **Escalate on Timeout**: Yes",
254
+ description: "Escalate on timeout policy line"
255
+ },
256
+ "interop.md.yes": { value: "Yes", description: "Yes label" },
257
+ "interop.md.no": { value: "No", description: "No label" },
258
+ "error.jsonRunner.requiresModel": {
259
+ value: "createAgentJsonRunner requires a model or provider config",
260
+ description: "Error when JSON runner has no model or provider"
261
+ },
262
+ "error.missingToolHandler": {
263
+ value: "Missing handler for tool: {name}",
264
+ description: "Error when a tool handler is not registered",
265
+ placeholders: [{ name: "name", type: "string" }]
266
+ },
267
+ "error.unknownBackend": {
268
+ value: "Unknown backend: {backend}",
269
+ description: "Error when an unknown backend is specified",
270
+ placeholders: [{ name: "backend", type: "string" }]
271
+ },
272
+ "error.claudeSdk.notAvailable": {
273
+ value: "Claude Agent SDK not available. Install @anthropic-ai/claude-agent-sdk",
274
+ description: "Error when Claude Agent SDK is not available"
275
+ },
276
+ "error.claudeSdk.notInstalled": {
277
+ value: "Claude Agent SDK not installed. Run: npm install @anthropic-ai/claude-agent-sdk",
278
+ description: "Error when Claude Agent SDK module is not found"
279
+ },
280
+ "error.opencodeSdk.notAvailable": {
281
+ value: "OpenCode SDK not available. Install @opencode-ai/sdk",
282
+ description: "Error when OpenCode SDK is not available"
283
+ },
284
+ "error.opencodeSdk.notInstalled": {
285
+ value: "OpenCode SDK not installed. Run: npm install @opencode-ai/sdk",
286
+ description: "Error when OpenCode SDK module is not found"
287
+ },
288
+ "error.providerNotInitialized": {
289
+ value: "Provider not initialized",
290
+ description: "Error when provider has not been initialized before use"
291
+ },
292
+ "error.agentKeyRequired": {
293
+ value: "Agent key is required",
294
+ description: "Validation error: missing agent key"
295
+ },
296
+ "error.agentMissingVersion": {
297
+ value: "Agent {key} is missing a string version",
298
+ description: "Validation error: version not a string",
299
+ placeholders: [{ name: "key", type: "string" }]
300
+ },
301
+ "error.agentRequiresInstructions": {
302
+ value: "Agent {key} requires instructions",
303
+ description: "Validation error: missing instructions",
304
+ placeholders: [{ name: "key", type: "string" }]
305
+ },
306
+ "error.agentRequiresTool": {
307
+ value: "Agent {key} must expose at least one tool",
308
+ description: "Validation error: no tools defined",
309
+ placeholders: [{ name: "key", type: "string" }]
310
+ },
311
+ "error.agentDuplicateTool": {
312
+ value: "Agent {key} has duplicate tool name: {name}",
313
+ description: "Validation error: duplicate tool name",
314
+ placeholders: [
315
+ { name: "key", type: "string" },
316
+ { name: "name", type: "string" }
317
+ ]
318
+ },
319
+ "error.agentSpecNotFound": {
320
+ value: "Agent spec not found for {name}",
321
+ description: "Error when agent spec is not in the registry",
322
+ placeholders: [{ name: "name", type: "string" }]
323
+ },
324
+ "error.specNotFound": {
325
+ value: "Spec not found: {specKey}",
326
+ description: "Error when a spec key is not found",
327
+ placeholders: [{ name: "specKey", type: "string" }]
328
+ },
329
+ "error.toolNotFound": {
330
+ value: "Tool not found: {name}",
331
+ description: "Error when a tool is not found",
332
+ placeholders: [{ name: "name", type: "string" }]
333
+ },
334
+ "error.noHandlerForTool": {
335
+ value: "No handler registered for tool: {name}",
336
+ description: "Error when no handler is registered for a tool",
337
+ placeholders: [{ name: "name", type: "string" }]
338
+ },
339
+ "error.noToolHandler": {
340
+ value: "No handler for tool: {name}",
341
+ description: "Short error when no handler exists",
342
+ placeholders: [{ name: "name", type: "string" }]
343
+ },
344
+ "error.unknownExportFormat": {
345
+ value: "Unknown export format: {format}",
346
+ description: "Error for unsupported export format",
347
+ placeholders: [{ name: "format", type: "string" }]
348
+ },
349
+ "error.handlerNotFoundForTool": {
350
+ value: "Handler not found for tool {name}",
351
+ description: "Error in tool bridge when handler is missing",
352
+ placeholders: [{ name: "name", type: "string" }]
353
+ },
354
+ "error.toolNotFoundOrNoHandler": {
355
+ value: "Error: Tool '{name}' not found or has no handler",
356
+ description: "Error returned to LLM when tool execution fails",
357
+ placeholders: [{ name: "name", type: "string" }]
358
+ },
359
+ "error.toolNoExecuteHandler": {
360
+ value: "Tool {name} has no execute handler",
361
+ description: "Error when tool lacks an execute function",
362
+ placeholders: [{ name: "name", type: "string" }]
363
+ },
364
+ "error.provider.notRegistered": {
365
+ value: "not registered",
366
+ description: "Provider availability reason: not registered"
367
+ },
368
+ "error.provider.depsNotInstalled": {
369
+ value: "dependencies not installed or not configured",
370
+ description: "Provider availability reason: deps missing"
371
+ },
372
+ "error.provider.sdkNotConfigured": {
373
+ value: "SDK not installed or API key not configured",
374
+ description: "Provider availability reason: SDK or key missing"
375
+ },
376
+ "error.provider.claudeSdkMissing": {
377
+ value: "@anthropic-ai/claude-agent-sdk is not installed",
378
+ description: "Error when Claude Agent SDK require.resolve fails"
379
+ },
380
+ "error.provider.opencodeSdkMissing": {
381
+ value: "@opencode-ai/sdk is not installed",
382
+ description: "Error when OpenCode SDK require.resolve fails"
383
+ },
384
+ "error.provider.sdkNotInstalled": {
385
+ value: "SDK not installed",
386
+ description: "Generic provider error: SDK not installed"
387
+ },
388
+ "error.provider.contextCreation": {
389
+ value: "Failed to create context: {error}",
390
+ description: "Error during provider context creation",
391
+ placeholders: [{ name: "error", type: "string" }]
392
+ },
393
+ "error.provider.executionFailed": {
394
+ value: "Execution failed: {error}",
395
+ description: "Error during provider execution",
396
+ placeholders: [{ name: "error", type: "string" }]
397
+ },
398
+ "error.provider.streamFailed": {
399
+ value: "Stream failed: {error}",
400
+ description: "Error during provider streaming",
401
+ placeholders: [{ name: "error", type: "string" }]
402
+ },
403
+ "export.agentConfiguration": {
404
+ value: "# Agent Configuration",
405
+ description: "Markdown heading"
406
+ },
407
+ "export.metadata": {
408
+ value: "## Metadata",
409
+ description: "Markdown heading"
410
+ },
411
+ "export.metaName": {
412
+ value: "- **Name**: {name}",
413
+ description: "Metadata line",
414
+ placeholders: [{ name: "name", type: "string" }]
415
+ },
416
+ "export.metaVersion": {
417
+ value: "- **Version**: {version}",
418
+ description: "Metadata line",
419
+ placeholders: [{ name: "version", type: "string" }]
420
+ },
421
+ "export.metaOwners": {
422
+ value: "- **Owners**: {owners}",
423
+ description: "Metadata line",
424
+ placeholders: [{ name: "owners", type: "string" }]
425
+ },
426
+ "export.metaModel": {
427
+ value: "- **Model**: {model}",
428
+ description: "Metadata line",
429
+ placeholders: [{ name: "model", type: "string" }]
430
+ },
431
+ "export.instructions": {
432
+ value: "## Instructions",
433
+ description: "Markdown heading"
434
+ },
435
+ "export.availableTools": {
436
+ value: "## Available Tools",
437
+ description: "Markdown heading"
438
+ },
439
+ "export.tools": { value: "## Tools", description: "Markdown heading" },
440
+ "export.knowledgeSources": {
441
+ value: "## Knowledge Sources",
442
+ description: "Markdown heading"
443
+ },
444
+ "export.policy": { value: "## Policy", description: "Markdown heading" },
445
+ "export.additionalContext": {
446
+ value: "## Additional Context",
447
+ description: "Markdown heading"
448
+ },
449
+ "export.configuration": {
450
+ value: "## Configuration",
451
+ description: "Markdown heading"
452
+ },
453
+ "export.mcpServers": {
454
+ value: "## MCP Servers",
455
+ description: "Markdown heading"
456
+ },
457
+ "export.parameters": {
458
+ value: "**Parameters:**",
459
+ description: "Parameters label"
460
+ },
461
+ "export.requiresApproval": {
462
+ value: "requires approval",
463
+ description: "Tool flag"
464
+ },
465
+ "export.notAutomationSafe": {
466
+ value: "not automation safe",
467
+ description: "Tool flag"
468
+ },
469
+ "export.requiresApprovalMd": {
470
+ value: "*(requires approval)*",
471
+ description: "Markdown tool flag"
472
+ },
473
+ "export.notAutomationSafeMd": {
474
+ value: "*(not automation safe)*",
475
+ description: "Markdown tool flag"
476
+ },
477
+ "export.required": { value: "(required)", description: "Required marker" },
478
+ "export.optional": { value: "(optional)", description: "Optional marker" },
479
+ "export.minConfidence": {
480
+ value: "- Minimum confidence: {min}",
481
+ description: "Policy line",
482
+ placeholders: [{ name: "min", type: "number" }]
483
+ },
484
+ "export.escalationConfigured": {
485
+ value: "- Escalation policy is configured",
486
+ description: "Policy line for system prompt"
487
+ },
488
+ "export.escalationPolicyConfigured": {
489
+ value: "- Escalation policy configured",
490
+ description: "Policy line for markdown export"
491
+ },
492
+ "export.featureFlags": {
493
+ value: "- Feature flags: {flags}",
494
+ description: "Feature flags policy line",
495
+ placeholders: [{ name: "flags", type: "string" }]
496
+ },
497
+ "export.generatedFrom": {
498
+ value: "*Generated from ContractSpec: {key}*",
499
+ description: "Footer attribution line",
500
+ placeholders: [{ name: "key", type: "string" }]
501
+ },
502
+ "export.exportedAt": {
503
+ value: "*Exported at: {date}*",
504
+ description: "Footer timestamp",
505
+ placeholders: [{ name: "date", type: "string" }]
506
+ },
507
+ "export.agentType": {
508
+ value: "> Agent type: **{type}**",
509
+ description: "Agent type callout",
510
+ placeholders: [{ name: "type", type: "string" }]
511
+ },
512
+ "export.noDescription": {
513
+ value: "No description",
514
+ description: "Fallback when tool has no description"
515
+ },
516
+ "export.validation.requiresKey": {
517
+ value: "Spec must have a meta.key",
518
+ description: "Validation error"
519
+ },
520
+ "export.validation.requiresInstructions": {
521
+ value: "Spec must have instructions",
522
+ description: "Validation error"
523
+ },
524
+ "export.validation.requiresTool": {
525
+ value: "Spec must have at least one tool",
526
+ description: "Validation error"
527
+ },
528
+ "export.validation.toolRequiresName": {
529
+ value: "All tools must have a name",
530
+ description: "Validation error"
531
+ },
532
+ "export.validation.toolRequiresDescOrName": {
533
+ value: "Tool must have a description or name",
534
+ description: "Validation error"
535
+ },
536
+ "export.validation.toolInvalidName": {
537
+ value: "Tool name '{name}' should be a valid identifier (letters, numbers, underscores)",
538
+ description: "Validation error for invalid tool name",
539
+ placeholders: [{ name: "name", type: "string" }]
540
+ },
541
+ "export.agentType.build": {
542
+ value: "Primary agent with full tool access for code generation and modification.",
543
+ description: "Build agent type description"
544
+ },
545
+ "export.agentType.plan": {
546
+ value: "Restricted agent for analysis and planning. File edits and bash commands require approval.",
547
+ description: "Plan agent type description"
548
+ },
549
+ "export.agentType.general": {
550
+ value: "General-purpose subagent for complex questions and multi-step tasks.",
551
+ description: "General agent type description"
552
+ },
553
+ "export.agentType.explore": {
554
+ value: "Fast subagent optimized for codebase exploration and pattern searching.",
555
+ description: "Explore agent type description"
556
+ },
557
+ "export.bridge.requiresApproval": {
558
+ value: "(requires approval)",
559
+ description: "Tool permission label"
560
+ },
561
+ "export.bridge.askMode": {
562
+ value: "(ask mode)",
563
+ description: "Tool permission label"
564
+ },
565
+ "approval.toolRequiresApproval": {
566
+ value: 'Tool "{name}" requires approval',
567
+ description: "Default reason for tool approval requests",
568
+ placeholders: [{ name: "name", type: "string" }]
569
+ },
570
+ "log.unifiedAgent.fallback": {
571
+ value: "[UnifiedAgent] {backend} failed, falling back to {fallback}",
572
+ description: "Warning when a backend fails and fallback is used",
573
+ placeholders: [
574
+ { name: "backend", type: "string" },
575
+ { name: "fallback", type: "string" }
576
+ ]
577
+ },
578
+ "log.knowledge.spaceNotAvailable": {
579
+ value: 'Required knowledge space "{key}" is not available',
580
+ description: "Warning when a required knowledge space is missing",
581
+ placeholders: [{ name: "key", type: "string" }]
582
+ },
583
+ "log.knowledge.loadFailed": {
584
+ value: 'Failed to load required knowledge "{key}":',
585
+ description: "Warning when knowledge loading fails",
586
+ placeholders: [{ name: "key", type: "string" }]
587
+ },
588
+ "log.knowledge.queryFailed": {
589
+ value: "Failed to query knowledge space {space}:",
590
+ description: "Warning when knowledge querying fails",
591
+ placeholders: [{ name: "space", type: "string" }]
592
+ },
593
+ "log.mcpServer.started": {
594
+ value: "[MCPToolServer] Started {name}@{version} with {count} tools",
595
+ description: "Log message when MCP tool server starts",
596
+ placeholders: [
597
+ { name: "name", type: "string" },
598
+ { name: "version", type: "string" },
599
+ { name: "count", type: "number" }
600
+ ]
601
+ },
602
+ "log.mcpServer.stopped": {
603
+ value: "[MCPToolServer] Stopped {name}",
604
+ description: "Log message when MCP tool server stops",
605
+ placeholders: [{ name: "name", type: "string" }]
606
+ }
607
+ }
608
+ });
609
+ });
610
+
611
+ // src/i18n/catalogs/fr.ts
612
+ import { defineTranslation as defineTranslation2 } from "@contractspec/lib.contracts/translations";
613
+ var frMessages;
614
+ var init_fr = __esm(() => {
615
+ frMessages = defineTranslation2({
616
+ meta: {
617
+ key: "ai-agent.messages",
618
+ version: "1.0.0",
619
+ domain: "ai-agent",
620
+ description: "Toutes les chaînes destinées aux utilisateurs, aux LLM et aux développeurs pour le package ai-agent",
621
+ owners: ["platform"],
622
+ stability: "experimental"
623
+ },
624
+ locale: "fr",
625
+ fallback: "en",
626
+ messages: {
627
+ "agent.json.rules.validJsonOnly": {
628
+ value: "Vous DEVEZ produire uniquement du JSON valide.",
629
+ description: "JSON runner rule: output must be valid JSON"
630
+ },
631
+ "agent.json.rules.noMarkdownFences": {
632
+ value: "N'encapsulez pas la sortie dans des blocs de code markdown.",
633
+ description: "JSON runner rule: no markdown code fences"
634
+ },
635
+ "agent.json.rules.noCommentary": {
636
+ value: "N'incluez ni commentaire ni explication.",
637
+ description: "JSON runner rule: no extra text"
638
+ },
639
+ "agent.json.rules.doubleQuotes": {
640
+ value: "Utilisez des guillemets doubles pour toutes les clés et valeurs de type chaîne.",
641
+ description: "JSON runner rule: double quotes only"
642
+ },
643
+ "agent.json.rules.noTrailingCommas": {
644
+ value: "N'incluez pas de virgules finales.",
645
+ description: "JSON runner rule: no trailing commas"
646
+ },
647
+ "agent.json.defaultDescription": {
648
+ value: "Exécuteur d'agent JSON uniquement pour les pipelines déterministes.",
649
+ description: "Default description for the JSON runner spec"
650
+ },
651
+ "agent.json.systemPrompt": {
652
+ value: "Vous êtes un générateur JSON précis.",
653
+ description: "Default system prompt for the JSON runner"
654
+ },
655
+ "knowledge.header": {
656
+ value: "# Connaissances de référence",
657
+ description: "Header for injected knowledge section in system prompt"
658
+ },
659
+ "knowledge.description": {
660
+ value: "Les informations suivantes sont fournies à titre de référence. Utilisez-les pour éclairer vos réponses.",
661
+ description: "Description below the knowledge header"
662
+ },
663
+ "tool.knowledge.description": {
664
+ value: "Interrogez les bases de connaissances pour obtenir des informations pertinentes. Utilisez cet outil lorsque vous avez besoin de rechercher des informations spécifiques qui ne sont pas dans votre contexte.",
665
+ description: "Description for the knowledge query tool shown to the LLM"
666
+ },
667
+ "tool.knowledge.availableSpaces": {
668
+ value: "Espaces de connaissances disponibles :",
669
+ description: "Label before listing available knowledge spaces"
670
+ },
671
+ "tool.knowledge.spaceDefault": {
672
+ value: "Espace de connaissances",
673
+ description: "Fallback description for unnamed knowledge spaces"
674
+ },
675
+ "tool.knowledge.param.query": {
676
+ value: "La question ou la requête de recherche pour trouver des informations pertinentes",
677
+ description: "Parameter description for the query field"
678
+ },
679
+ "tool.knowledge.param.spaceKey": {
680
+ value: "Espace de connaissances spécifique à interroger. Si omis, recherche dans tous les espaces disponibles.",
681
+ description: "Parameter description for the spaceKey field"
682
+ },
683
+ "tool.knowledge.param.topK": {
684
+ value: "Nombre maximum de résultats à retourner",
685
+ description: "Parameter description for the topK field"
686
+ },
687
+ "tool.knowledge.noResults": {
688
+ value: "Aucune information pertinente trouvée dans les bases de connaissances.",
689
+ description: "Message when no knowledge results are found"
690
+ },
691
+ "tool.knowledge.sourceLabel": {
692
+ value: "[Source {index} - {space}] (pertinence : {score} %)",
693
+ description: "Label for each knowledge search result",
694
+ placeholders: [
695
+ { name: "index", type: "number", description: "1-based source index" },
696
+ { name: "space", type: "string", description: "Knowledge space name" },
697
+ { name: "score", type: "number", description: "Relevance percentage" }
698
+ ]
699
+ },
700
+ "tool.fallbackDescription": {
701
+ value: "Exécuter {name}",
702
+ description: "Fallback description when a tool has no explicit description",
703
+ placeholders: [
704
+ { name: "name", type: "string", description: "Tool name" }
705
+ ]
706
+ },
707
+ "tool.mcp.param.message": {
708
+ value: "Le message ou la requête à envoyer à l'agent",
709
+ description: "MCP server: message parameter description"
710
+ },
711
+ "tool.mcp.param.sessionId": {
712
+ value: "Identifiant de session optionnel pour poursuivre une conversation",
713
+ description: "MCP server: sessionId parameter description"
714
+ },
715
+ "tool.mcp.agentDescription": {
716
+ value: "Interagir avec l'agent {key}",
717
+ description: "MCP server: agent tool description",
718
+ placeholders: [
719
+ { name: "key", type: "string", description: "Agent spec key" }
720
+ ]
721
+ },
722
+ "tool.mcp.executePrompt": {
723
+ value: "Exécutez l'outil {name} avec les arguments suivants : {args}",
724
+ description: "MCP server: prompt sent when executing an individual tool",
725
+ placeholders: [
726
+ { name: "name", type: "string", description: "Tool name" },
727
+ {
728
+ name: "args",
729
+ type: "string",
730
+ description: "JSON-stringified arguments"
731
+ }
732
+ ]
733
+ },
734
+ "tool.mcp.toolDescription": {
735
+ value: "Exécuter l'outil {name}",
736
+ description: "MCP server: individual tool description",
737
+ placeholders: [
738
+ { name: "name", type: "string", description: "Tool name" }
739
+ ]
740
+ },
741
+ "interop.prompt.agentIdentity": {
742
+ value: "# Identité de l'agent",
743
+ description: "Section header for agent identity in LLM prompt"
744
+ },
745
+ "interop.prompt.youAre": {
746
+ value: "Vous êtes {key} (v{version}).",
747
+ description: "Agent identity statement in LLM prompt",
748
+ placeholders: [
749
+ { name: "key", type: "string" },
750
+ { name: "version", type: "string" }
751
+ ]
752
+ },
753
+ "interop.prompt.description": {
754
+ value: "## Description",
755
+ description: "Section header for description"
756
+ },
757
+ "interop.prompt.instructions": {
758
+ value: "## Instructions",
759
+ description: "Section header for instructions"
760
+ },
761
+ "interop.prompt.availableTools": {
762
+ value: "## Outils disponibles",
763
+ description: "Section header for available tools"
764
+ },
765
+ "interop.prompt.toolsIntro": {
766
+ value: "Vous avez accès aux outils suivants :",
767
+ description: "Introduction before listing tools"
768
+ },
769
+ "interop.prompt.parameters": {
770
+ value: "Paramètres :",
771
+ description: "Label before tool parameters block"
772
+ },
773
+ "interop.prompt.knowledgeContext": {
774
+ value: "## Contexte de connaissances",
775
+ description: "Section header for knowledge context"
776
+ },
777
+ "interop.prompt.additionalContext": {
778
+ value: "## Contexte supplémentaire",
779
+ description: "Section header for additional context"
780
+ },
781
+ "interop.md.toc": {
782
+ value: "## Table des matières",
783
+ description: "TOC header"
784
+ },
785
+ "interop.md.overview": {
786
+ value: "## Aperçu",
787
+ description: "Overview header"
788
+ },
789
+ "interop.md.tools": { value: "## Outils", description: "Tools header" },
790
+ "interop.md.knowledge": {
791
+ value: "## Connaissances",
792
+ description: "Knowledge header"
793
+ },
794
+ "interop.md.policy": {
795
+ value: "## Politique",
796
+ description: "Policy header"
797
+ },
798
+ "interop.md.metaKey": {
799
+ value: "- **Clé** : `{key}`",
800
+ description: "Metadata line for key",
801
+ placeholders: [{ name: "key", type: "string" }]
802
+ },
803
+ "interop.md.metaVersion": {
804
+ value: "- **Version** : {version}",
805
+ description: "Metadata line for version",
806
+ placeholders: [{ name: "version", type: "string" }]
807
+ },
808
+ "interop.md.metaStability": {
809
+ value: "- **Stabilité** : {stability}",
810
+ description: "Metadata line for stability",
811
+ placeholders: [{ name: "stability", type: "string" }]
812
+ },
813
+ "interop.md.metaOwners": {
814
+ value: "- **Propriétaires** : {owners}",
815
+ description: "Metadata line for owners",
816
+ placeholders: [{ name: "owners", type: "string" }]
817
+ },
818
+ "interop.md.metaTags": {
819
+ value: "- **Tags** : {tags}",
820
+ description: "Metadata line for tags",
821
+ placeholders: [{ name: "tags", type: "string" }]
822
+ },
823
+ "interop.md.schema": {
824
+ value: "**Schéma :**",
825
+ description: "Schema label"
826
+ },
827
+ "interop.md.automationSafe": {
828
+ value: "**Compatible avec l'automatisation** : {value}",
829
+ description: "Automation safe field",
830
+ placeholders: [{ name: "value", type: "string" }]
831
+ },
832
+ "interop.md.required": {
833
+ value: "(obligatoire)",
834
+ description: "Required marker"
835
+ },
836
+ "interop.md.optional": {
837
+ value: "(optionnel)",
838
+ description: "Optional marker"
839
+ },
840
+ "interop.md.minConfidence": {
841
+ value: "- **Confiance minimale** : {min}",
842
+ description: "Minimum confidence policy line",
843
+ placeholders: [{ name: "min", type: "number" }]
844
+ },
845
+ "interop.md.escalationThreshold": {
846
+ value: "- **Seuil d'escalade** : {threshold}",
847
+ description: "Escalation threshold policy line",
848
+ placeholders: [{ name: "threshold", type: "number" }]
849
+ },
850
+ "interop.md.escalateToolFailure": {
851
+ value: "- **Escalader en cas d'échec d'outil** : Oui",
852
+ description: "Escalate on tool failure policy line"
853
+ },
854
+ "interop.md.escalateTimeout": {
855
+ value: "- **Escalader en cas de délai d'attente dépassé** : Oui",
856
+ description: "Escalate on timeout policy line"
857
+ },
858
+ "interop.md.yes": { value: "Oui", description: "Yes label" },
859
+ "interop.md.no": { value: "Non", description: "No label" },
860
+ "error.jsonRunner.requiresModel": {
861
+ value: "createAgentJsonRunner nécessite un modèle ou une configuration de fournisseur",
862
+ description: "Error when JSON runner has no model or provider"
863
+ },
864
+ "error.missingToolHandler": {
865
+ value: "Gestionnaire manquant pour l'outil : {name}",
866
+ description: "Error when a tool handler is not registered",
867
+ placeholders: [{ name: "name", type: "string" }]
868
+ },
869
+ "error.unknownBackend": {
870
+ value: "Backend inconnu : {backend}",
871
+ description: "Error when an unknown backend is specified",
872
+ placeholders: [{ name: "backend", type: "string" }]
873
+ },
874
+ "error.claudeSdk.notAvailable": {
875
+ value: "Claude Agent SDK non disponible. Installez @anthropic-ai/claude-agent-sdk",
876
+ description: "Error when Claude Agent SDK is not available"
877
+ },
878
+ "error.claudeSdk.notInstalled": {
879
+ value: "Claude Agent SDK non installé. Exécutez : npm install @anthropic-ai/claude-agent-sdk",
880
+ description: "Error when Claude Agent SDK module is not found"
881
+ },
882
+ "error.opencodeSdk.notAvailable": {
883
+ value: "OpenCode SDK non disponible. Installez @opencode-ai/sdk",
884
+ description: "Error when OpenCode SDK is not available"
885
+ },
886
+ "error.opencodeSdk.notInstalled": {
887
+ value: "OpenCode SDK non installé. Exécutez : npm install @opencode-ai/sdk",
888
+ description: "Error when OpenCode SDK module is not found"
889
+ },
890
+ "error.providerNotInitialized": {
891
+ value: "Fournisseur non initialisé",
892
+ description: "Error when provider has not been initialized before use"
893
+ },
894
+ "error.agentKeyRequired": {
895
+ value: "La clé de l'agent est obligatoire",
896
+ description: "Validation error: missing agent key"
897
+ },
898
+ "error.agentMissingVersion": {
899
+ value: "L'agent {key} n'a pas de version sous forme de chaîne de caractères",
900
+ description: "Validation error: version not a string",
901
+ placeholders: [{ name: "key", type: "string" }]
902
+ },
903
+ "error.agentRequiresInstructions": {
904
+ value: "L'agent {key} nécessite des instructions",
905
+ description: "Validation error: missing instructions",
906
+ placeholders: [{ name: "key", type: "string" }]
907
+ },
908
+ "error.agentRequiresTool": {
909
+ value: "L'agent {key} doit exposer au moins un outil",
910
+ description: "Validation error: no tools defined",
911
+ placeholders: [{ name: "key", type: "string" }]
912
+ },
913
+ "error.agentDuplicateTool": {
914
+ value: "L'agent {key} a un nom d'outil en double : {name}",
915
+ description: "Validation error: duplicate tool name",
916
+ placeholders: [
917
+ { name: "key", type: "string" },
918
+ { name: "name", type: "string" }
919
+ ]
920
+ },
921
+ "error.agentSpecNotFound": {
922
+ value: "Spécification d'agent introuvable pour {name}",
923
+ description: "Error when agent spec is not in the registry",
924
+ placeholders: [{ name: "name", type: "string" }]
925
+ },
926
+ "error.specNotFound": {
927
+ value: "Spécification introuvable : {specKey}",
928
+ description: "Error when a spec key is not found",
929
+ placeholders: [{ name: "specKey", type: "string" }]
930
+ },
931
+ "error.toolNotFound": {
932
+ value: "Outil introuvable : {name}",
933
+ description: "Error when a tool is not found",
934
+ placeholders: [{ name: "name", type: "string" }]
935
+ },
936
+ "error.noHandlerForTool": {
937
+ value: "Aucun gestionnaire enregistré pour l'outil : {name}",
938
+ description: "Error when no handler is registered for a tool",
939
+ placeholders: [{ name: "name", type: "string" }]
940
+ },
941
+ "error.noToolHandler": {
942
+ value: "Aucun gestionnaire pour l'outil : {name}",
943
+ description: "Short error when no handler exists",
944
+ placeholders: [{ name: "name", type: "string" }]
945
+ },
946
+ "error.unknownExportFormat": {
947
+ value: "Format d'export inconnu : {format}",
948
+ description: "Error for unsupported export format",
949
+ placeholders: [{ name: "format", type: "string" }]
950
+ },
951
+ "error.handlerNotFoundForTool": {
952
+ value: "Gestionnaire introuvable pour l'outil {name}",
953
+ description: "Error in tool bridge when handler is missing",
954
+ placeholders: [{ name: "name", type: "string" }]
955
+ },
956
+ "error.toolNotFoundOrNoHandler": {
957
+ value: "Erreur : L'outil « {name} » est introuvable ou n'a pas de gestionnaire",
958
+ description: "Error returned to LLM when tool execution fails",
959
+ placeholders: [{ name: "name", type: "string" }]
960
+ },
961
+ "error.toolNoExecuteHandler": {
962
+ value: "L'outil {name} n'a pas de gestionnaire d'exécution",
963
+ description: "Error when tool lacks an execute function",
964
+ placeholders: [{ name: "name", type: "string" }]
965
+ },
966
+ "error.provider.notRegistered": {
967
+ value: "non enregistré",
968
+ description: "Provider availability reason: not registered"
969
+ },
970
+ "error.provider.depsNotInstalled": {
971
+ value: "dépendances non installées ou non configurées",
972
+ description: "Provider availability reason: deps missing"
973
+ },
974
+ "error.provider.sdkNotConfigured": {
975
+ value: "SDK non installé ou clé d'API non configurée",
976
+ description: "Provider availability reason: SDK or key missing"
977
+ },
978
+ "error.provider.claudeSdkMissing": {
979
+ value: "@anthropic-ai/claude-agent-sdk n'est pas installé",
980
+ description: "Error when Claude Agent SDK require.resolve fails"
981
+ },
982
+ "error.provider.opencodeSdkMissing": {
983
+ value: "@opencode-ai/sdk n'est pas installé",
984
+ description: "Error when OpenCode SDK require.resolve fails"
985
+ },
986
+ "error.provider.sdkNotInstalled": {
987
+ value: "SDK non installé",
988
+ description: "Generic provider error: SDK not installed"
989
+ },
990
+ "error.provider.contextCreation": {
991
+ value: "Échec de la création du contexte : {error}",
992
+ description: "Error during provider context creation",
993
+ placeholders: [{ name: "error", type: "string" }]
994
+ },
995
+ "error.provider.executionFailed": {
996
+ value: "Échec de l'exécution : {error}",
997
+ description: "Error during provider execution",
998
+ placeholders: [{ name: "error", type: "string" }]
999
+ },
1000
+ "error.provider.streamFailed": {
1001
+ value: "Échec du flux : {error}",
1002
+ description: "Error during provider streaming",
1003
+ placeholders: [{ name: "error", type: "string" }]
1004
+ },
1005
+ "export.agentConfiguration": {
1006
+ value: "# Configuration de l'agent",
1007
+ description: "Markdown heading"
1008
+ },
1009
+ "export.metadata": {
1010
+ value: "## Métadonnées",
1011
+ description: "Markdown heading"
1012
+ },
1013
+ "export.metaName": {
1014
+ value: "- **Nom** : {name}",
1015
+ description: "Metadata line",
1016
+ placeholders: [{ name: "name", type: "string" }]
1017
+ },
1018
+ "export.metaVersion": {
1019
+ value: "- **Version** : {version}",
1020
+ description: "Metadata line",
1021
+ placeholders: [{ name: "version", type: "string" }]
1022
+ },
1023
+ "export.metaOwners": {
1024
+ value: "- **Propriétaires** : {owners}",
1025
+ description: "Metadata line",
1026
+ placeholders: [{ name: "owners", type: "string" }]
1027
+ },
1028
+ "export.metaModel": {
1029
+ value: "- **Modèle** : {model}",
1030
+ description: "Metadata line",
1031
+ placeholders: [{ name: "model", type: "string" }]
1032
+ },
1033
+ "export.instructions": {
1034
+ value: "## Instructions",
1035
+ description: "Markdown heading"
1036
+ },
1037
+ "export.availableTools": {
1038
+ value: "## Outils disponibles",
1039
+ description: "Markdown heading"
1040
+ },
1041
+ "export.tools": { value: "## Outils", description: "Markdown heading" },
1042
+ "export.knowledgeSources": {
1043
+ value: "## Sources de connaissances",
1044
+ description: "Markdown heading"
1045
+ },
1046
+ "export.policy": {
1047
+ value: "## Politique",
1048
+ description: "Markdown heading"
1049
+ },
1050
+ "export.additionalContext": {
1051
+ value: "## Contexte supplémentaire",
1052
+ description: "Markdown heading"
1053
+ },
1054
+ "export.configuration": {
1055
+ value: "## Configuration",
1056
+ description: "Markdown heading"
1057
+ },
1058
+ "export.mcpServers": {
1059
+ value: "## Serveurs MCP",
1060
+ description: "Markdown heading"
1061
+ },
1062
+ "export.parameters": {
1063
+ value: "**Paramètres :**",
1064
+ description: "Parameters label"
1065
+ },
1066
+ "export.requiresApproval": {
1067
+ value: "nécessite une approbation",
1068
+ description: "Tool flag"
1069
+ },
1070
+ "export.notAutomationSafe": {
1071
+ value: "non compatible avec l'automatisation",
1072
+ description: "Tool flag"
1073
+ },
1074
+ "export.requiresApprovalMd": {
1075
+ value: "*(nécessite une approbation)*",
1076
+ description: "Markdown tool flag"
1077
+ },
1078
+ "export.notAutomationSafeMd": {
1079
+ value: "*(non compatible avec l'automatisation)*",
1080
+ description: "Markdown tool flag"
1081
+ },
1082
+ "export.required": {
1083
+ value: "(obligatoire)",
1084
+ description: "Required marker"
1085
+ },
1086
+ "export.optional": {
1087
+ value: "(optionnel)",
1088
+ description: "Optional marker"
1089
+ },
1090
+ "export.minConfidence": {
1091
+ value: "- Confiance minimale : {min}",
1092
+ description: "Policy line",
1093
+ placeholders: [{ name: "min", type: "number" }]
1094
+ },
1095
+ "export.escalationConfigured": {
1096
+ value: "- La politique d'escalade est configurée",
1097
+ description: "Policy line for system prompt"
1098
+ },
1099
+ "export.escalationPolicyConfigured": {
1100
+ value: "- Politique d'escalade configurée",
1101
+ description: "Policy line for markdown export"
1102
+ },
1103
+ "export.featureFlags": {
1104
+ value: "- Indicateurs de fonctionnalités : {flags}",
1105
+ description: "Feature flags policy line",
1106
+ placeholders: [{ name: "flags", type: "string" }]
1107
+ },
1108
+ "export.generatedFrom": {
1109
+ value: "*Généré à partir de ContractSpec : {key}*",
1110
+ description: "Footer attribution line",
1111
+ placeholders: [{ name: "key", type: "string" }]
1112
+ },
1113
+ "export.exportedAt": {
1114
+ value: "*Exporté le : {date}*",
1115
+ description: "Footer timestamp",
1116
+ placeholders: [{ name: "date", type: "string" }]
1117
+ },
1118
+ "export.agentType": {
1119
+ value: "> Type d'agent : **{type}**",
1120
+ description: "Agent type callout",
1121
+ placeholders: [{ name: "type", type: "string" }]
1122
+ },
1123
+ "export.noDescription": {
1124
+ value: "Aucune description",
1125
+ description: "Fallback when tool has no description"
1126
+ },
1127
+ "export.validation.requiresKey": {
1128
+ value: "La spécification doit avoir une meta.key",
1129
+ description: "Validation error"
1130
+ },
1131
+ "export.validation.requiresInstructions": {
1132
+ value: "La spécification doit avoir des instructions",
1133
+ description: "Validation error"
1134
+ },
1135
+ "export.validation.requiresTool": {
1136
+ value: "La spécification doit avoir au moins un outil",
1137
+ description: "Validation error"
1138
+ },
1139
+ "export.validation.toolRequiresName": {
1140
+ value: "Tous les outils doivent avoir un nom",
1141
+ description: "Validation error"
1142
+ },
1143
+ "export.validation.toolRequiresDescOrName": {
1144
+ value: "L'outil doit avoir une description ou un nom",
1145
+ description: "Validation error"
1146
+ },
1147
+ "export.validation.toolInvalidName": {
1148
+ value: "Le nom d'outil « {name} » doit être un identifiant valide (lettres, chiffres, underscores)",
1149
+ description: "Validation error for invalid tool name",
1150
+ placeholders: [{ name: "name", type: "string" }]
1151
+ },
1152
+ "export.agentType.build": {
1153
+ value: "Agent principal avec accès complet aux outils pour la génération et la modification de code.",
1154
+ description: "Build agent type description"
1155
+ },
1156
+ "export.agentType.plan": {
1157
+ value: "Agent restreint pour l'analyse et la planification. Les modifications de fichiers et les commandes bash nécessitent une approbation.",
1158
+ description: "Plan agent type description"
1159
+ },
1160
+ "export.agentType.general": {
1161
+ value: "Sous-agent généraliste pour les questions complexes et les tâches en plusieurs étapes.",
1162
+ description: "General agent type description"
1163
+ },
1164
+ "export.agentType.explore": {
1165
+ value: "Sous-agent rapide optimisé pour l'exploration de la base de code et la recherche de motifs.",
1166
+ description: "Explore agent type description"
1167
+ },
1168
+ "export.bridge.requiresApproval": {
1169
+ value: "(nécessite une approbation)",
1170
+ description: "Tool permission label"
1171
+ },
1172
+ "export.bridge.askMode": {
1173
+ value: "(mode interrogation)",
1174
+ description: "Tool permission label"
1175
+ },
1176
+ "approval.toolRequiresApproval": {
1177
+ value: "L'outil « {name} » nécessite une approbation",
1178
+ description: "Default reason for tool approval requests",
1179
+ placeholders: [{ name: "name", type: "string" }]
1180
+ },
1181
+ "log.unifiedAgent.fallback": {
1182
+ value: "[UnifiedAgent] {backend} a échoué, repli sur {fallback}",
1183
+ description: "Warning when a backend fails and fallback is used",
1184
+ placeholders: [
1185
+ { name: "backend", type: "string" },
1186
+ { name: "fallback", type: "string" }
1187
+ ]
1188
+ },
1189
+ "log.knowledge.spaceNotAvailable": {
1190
+ value: "L'espace de connaissances requis « {key} » n'est pas disponible",
1191
+ description: "Warning when a required knowledge space is missing",
1192
+ placeholders: [{ name: "key", type: "string" }]
1193
+ },
1194
+ "log.knowledge.loadFailed": {
1195
+ value: "Échec du chargement des connaissances requises « {key} » :",
1196
+ description: "Warning when knowledge loading fails",
1197
+ placeholders: [{ name: "key", type: "string" }]
1198
+ },
1199
+ "log.knowledge.queryFailed": {
1200
+ value: "Échec de l'interrogation de l'espace de connaissances {space} :",
1201
+ description: "Warning when knowledge querying fails",
1202
+ placeholders: [{ name: "space", type: "string" }]
1203
+ },
1204
+ "log.mcpServer.started": {
1205
+ value: "[MCPToolServer] {name}@{version} démarré avec {count} outils",
1206
+ description: "Log message when MCP tool server starts",
1207
+ placeholders: [
1208
+ { name: "name", type: "string" },
1209
+ { name: "version", type: "string" },
1210
+ { name: "count", type: "number" }
1211
+ ]
1212
+ },
1213
+ "log.mcpServer.stopped": {
1214
+ value: "[MCPToolServer] {name} arrêté",
1215
+ description: "Log message when MCP tool server stops",
1216
+ placeholders: [{ name: "name", type: "string" }]
1217
+ }
1218
+ }
1219
+ });
1220
+ });
1221
+
1222
+ // src/i18n/catalogs/es.ts
1223
+ import { defineTranslation as defineTranslation3 } from "@contractspec/lib.contracts/translations";
1224
+ var esMessages;
1225
+ var init_es = __esm(() => {
1226
+ esMessages = defineTranslation3({
1227
+ meta: {
1228
+ key: "ai-agent.messages",
1229
+ version: "1.0.0",
1230
+ domain: "ai-agent",
1231
+ description: "Todas las cadenas de texto orientadas al usuario, al LLM y al desarrollador del paquete ai-agent",
1232
+ owners: ["platform"],
1233
+ stability: "experimental"
1234
+ },
1235
+ locale: "es",
1236
+ fallback: "en",
1237
+ messages: {
1238
+ "agent.json.rules.validJsonOnly": {
1239
+ value: "Usted DEBE generar ÚNICAMENTE JSON válido.",
1240
+ description: "Regla del ejecutor JSON: la salida debe ser JSON válido"
1241
+ },
1242
+ "agent.json.rules.noMarkdownFences": {
1243
+ value: "No envuelva la salida en bloques de código markdown.",
1244
+ description: "Regla del ejecutor JSON: sin bloques de código markdown"
1245
+ },
1246
+ "agent.json.rules.noCommentary": {
1247
+ value: "No incluya comentarios ni explicaciones.",
1248
+ description: "Regla del ejecutor JSON: sin texto adicional"
1249
+ },
1250
+ "agent.json.rules.doubleQuotes": {
1251
+ value: "Utilice comillas dobles para todas las claves y valores de cadena.",
1252
+ description: "Regla del ejecutor JSON: solo comillas dobles"
1253
+ },
1254
+ "agent.json.rules.noTrailingCommas": {
1255
+ value: "No incluya comas finales.",
1256
+ description: "Regla del ejecutor JSON: sin comas finales"
1257
+ },
1258
+ "agent.json.defaultDescription": {
1259
+ value: "Ejecutor de agentes exclusivamente JSON para pipelines deterministas.",
1260
+ description: "Descripción predeterminada para la especificación del ejecutor JSON"
1261
+ },
1262
+ "agent.json.systemPrompt": {
1263
+ value: "Usted es un generador preciso de JSON.",
1264
+ description: "Prompt de sistema predeterminado para el ejecutor JSON"
1265
+ },
1266
+ "knowledge.header": {
1267
+ value: "# Conocimiento de referencia",
1268
+ description: "Encabezado para la sección de conocimiento inyectado en el prompt del sistema"
1269
+ },
1270
+ "knowledge.description": {
1271
+ value: "La siguiente información se proporciona como referencia. Utilícela para fundamentar sus respuestas.",
1272
+ description: "Descripción debajo del encabezado de conocimiento"
1273
+ },
1274
+ "tool.knowledge.description": {
1275
+ value: "Consultar bases de conocimiento para obtener información relevante. Utilice esta herramienta cuando necesite buscar información específica que pueda no estar en su contexto.",
1276
+ description: "Descripción de la herramienta de consulta de conocimiento mostrada al LLM"
1277
+ },
1278
+ "tool.knowledge.availableSpaces": {
1279
+ value: "Espacios de conocimiento disponibles:",
1280
+ description: "Etiqueta antes de listar los espacios de conocimiento disponibles"
1281
+ },
1282
+ "tool.knowledge.spaceDefault": {
1283
+ value: "Espacio de conocimiento",
1284
+ description: "Descripción de respaldo para espacios de conocimiento sin nombre"
1285
+ },
1286
+ "tool.knowledge.param.query": {
1287
+ value: "La pregunta o consulta de búsqueda para encontrar información relevante",
1288
+ description: "Descripción del parámetro para el campo de consulta"
1289
+ },
1290
+ "tool.knowledge.param.spaceKey": {
1291
+ value: "Espacio de conocimiento específico a consultar. Si se omite, busca en todos los espacios disponibles.",
1292
+ description: "Descripción del parámetro para el campo spaceKey"
1293
+ },
1294
+ "tool.knowledge.param.topK": {
1295
+ value: "Número máximo de resultados a devolver",
1296
+ description: "Descripción del parámetro para el campo topK"
1297
+ },
1298
+ "tool.knowledge.noResults": {
1299
+ value: "No se encontró información relevante en las bases de conocimiento.",
1300
+ description: "Mensaje cuando no se encuentran resultados de conocimiento"
1301
+ },
1302
+ "tool.knowledge.sourceLabel": {
1303
+ value: "[Fuente {index} - {space}] (relevancia: {score}%)",
1304
+ description: "Etiqueta para cada resultado de búsqueda de conocimiento",
1305
+ placeholders: [
1306
+ {
1307
+ name: "index",
1308
+ type: "number",
1309
+ description: "Índice de fuente basado en 1"
1310
+ },
1311
+ {
1312
+ name: "space",
1313
+ type: "string",
1314
+ description: "Nombre del espacio de conocimiento"
1315
+ },
1316
+ {
1317
+ name: "score",
1318
+ type: "number",
1319
+ description: "Porcentaje de relevancia"
1320
+ }
1321
+ ]
1322
+ },
1323
+ "tool.fallbackDescription": {
1324
+ value: "Ejecutar {name}",
1325
+ description: "Descripción de respaldo cuando una herramienta no tiene descripción explícita",
1326
+ placeholders: [
1327
+ {
1328
+ name: "name",
1329
+ type: "string",
1330
+ description: "Nombre de la herramienta"
1331
+ }
1332
+ ]
1333
+ },
1334
+ "tool.mcp.param.message": {
1335
+ value: "El mensaje o consulta a enviar al agente",
1336
+ description: "Servidor MCP: descripción del parámetro message"
1337
+ },
1338
+ "tool.mcp.param.sessionId": {
1339
+ value: "ID de sesión opcional para continuar una conversación",
1340
+ description: "Servidor MCP: descripción del parámetro sessionId"
1341
+ },
1342
+ "tool.mcp.agentDescription": {
1343
+ value: "Interactuar con el agente {key}",
1344
+ description: "Servidor MCP: descripción de la herramienta de agente",
1345
+ placeholders: [
1346
+ {
1347
+ name: "key",
1348
+ type: "string",
1349
+ description: "Clave de la especificación del agente"
1350
+ }
1351
+ ]
1352
+ },
1353
+ "tool.mcp.executePrompt": {
1354
+ value: "Ejecute la herramienta {name} con los siguientes argumentos: {args}",
1355
+ description: "Servidor MCP: prompt enviado al ejecutar una herramienta individual",
1356
+ placeholders: [
1357
+ {
1358
+ name: "name",
1359
+ type: "string",
1360
+ description: "Nombre de la herramienta"
1361
+ },
1362
+ {
1363
+ name: "args",
1364
+ type: "string",
1365
+ description: "Argumentos serializados como JSON"
1366
+ }
1367
+ ]
1368
+ },
1369
+ "tool.mcp.toolDescription": {
1370
+ value: "Ejecutar la herramienta {name}",
1371
+ description: "Servidor MCP: descripción de herramienta individual",
1372
+ placeholders: [
1373
+ {
1374
+ name: "name",
1375
+ type: "string",
1376
+ description: "Nombre de la herramienta"
1377
+ }
1378
+ ]
1379
+ },
1380
+ "interop.prompt.agentIdentity": {
1381
+ value: "# Identidad del agente",
1382
+ description: "Encabezado de sección para la identidad del agente en el prompt del LLM"
1383
+ },
1384
+ "interop.prompt.youAre": {
1385
+ value: "Usted es {key} (v{version}).",
1386
+ description: "Declaración de identidad del agente en el prompt del LLM",
1387
+ placeholders: [
1388
+ { name: "key", type: "string" },
1389
+ { name: "version", type: "string" }
1390
+ ]
1391
+ },
1392
+ "interop.prompt.description": {
1393
+ value: "## Descripción",
1394
+ description: "Encabezado de sección para la descripción"
1395
+ },
1396
+ "interop.prompt.instructions": {
1397
+ value: "## Instrucciones",
1398
+ description: "Encabezado de sección para las instrucciones"
1399
+ },
1400
+ "interop.prompt.availableTools": {
1401
+ value: "## Herramientas disponibles",
1402
+ description: "Encabezado de sección para las herramientas disponibles"
1403
+ },
1404
+ "interop.prompt.toolsIntro": {
1405
+ value: "Usted tiene acceso a las siguientes herramientas:",
1406
+ description: "Introducción antes de listar las herramientas"
1407
+ },
1408
+ "interop.prompt.parameters": {
1409
+ value: "Parámetros:",
1410
+ description: "Etiqueta antes del bloque de parámetros de la herramienta"
1411
+ },
1412
+ "interop.prompt.knowledgeContext": {
1413
+ value: "## Contexto de conocimiento",
1414
+ description: "Encabezado de sección para el contexto de conocimiento"
1415
+ },
1416
+ "interop.prompt.additionalContext": {
1417
+ value: "## Contexto adicional",
1418
+ description: "Encabezado de sección para el contexto adicional"
1419
+ },
1420
+ "interop.md.toc": {
1421
+ value: "## Tabla de contenidos",
1422
+ description: "Encabezado de tabla de contenidos"
1423
+ },
1424
+ "interop.md.overview": {
1425
+ value: "## Resumen general",
1426
+ description: "Encabezado de resumen general"
1427
+ },
1428
+ "interop.md.tools": {
1429
+ value: "## Herramientas",
1430
+ description: "Encabezado de herramientas"
1431
+ },
1432
+ "interop.md.knowledge": {
1433
+ value: "## Conocimiento",
1434
+ description: "Encabezado de conocimiento"
1435
+ },
1436
+ "interop.md.policy": {
1437
+ value: "## Política",
1438
+ description: "Encabezado de política"
1439
+ },
1440
+ "interop.md.metaKey": {
1441
+ value: "- **Clave**: `{key}`",
1442
+ description: "Línea de metadatos para la clave",
1443
+ placeholders: [{ name: "key", type: "string" }]
1444
+ },
1445
+ "interop.md.metaVersion": {
1446
+ value: "- **Versión**: {version}",
1447
+ description: "Línea de metadatos para la versión",
1448
+ placeholders: [{ name: "version", type: "string" }]
1449
+ },
1450
+ "interop.md.metaStability": {
1451
+ value: "- **Estabilidad**: {stability}",
1452
+ description: "Línea de metadatos para la estabilidad",
1453
+ placeholders: [{ name: "stability", type: "string" }]
1454
+ },
1455
+ "interop.md.metaOwners": {
1456
+ value: "- **Propietarios**: {owners}",
1457
+ description: "Línea de metadatos para los propietarios",
1458
+ placeholders: [{ name: "owners", type: "string" }]
1459
+ },
1460
+ "interop.md.metaTags": {
1461
+ value: "- **Etiquetas**: {tags}",
1462
+ description: "Línea de metadatos para las etiquetas",
1463
+ placeholders: [{ name: "tags", type: "string" }]
1464
+ },
1465
+ "interop.md.schema": {
1466
+ value: "**Esquema:**",
1467
+ description: "Etiqueta de esquema"
1468
+ },
1469
+ "interop.md.automationSafe": {
1470
+ value: "**Seguro para automatización**: {value}",
1471
+ description: "Campo de seguridad para automatización",
1472
+ placeholders: [{ name: "value", type: "string" }]
1473
+ },
1474
+ "interop.md.required": {
1475
+ value: "(obligatorio)",
1476
+ description: "Marcador de obligatorio"
1477
+ },
1478
+ "interop.md.optional": {
1479
+ value: "(opcional)",
1480
+ description: "Marcador de opcional"
1481
+ },
1482
+ "interop.md.minConfidence": {
1483
+ value: "- **Confianza mínima**: {min}",
1484
+ description: "Línea de política de confianza mínima",
1485
+ placeholders: [{ name: "min", type: "number" }]
1486
+ },
1487
+ "interop.md.escalationThreshold": {
1488
+ value: "- **Umbral de escalamiento**: {threshold}",
1489
+ description: "Línea de política de umbral de escalamiento",
1490
+ placeholders: [{ name: "threshold", type: "number" }]
1491
+ },
1492
+ "interop.md.escalateToolFailure": {
1493
+ value: "- **Escalar ante fallo de herramienta**: Sí",
1494
+ description: "Línea de política de escalamiento ante fallo de herramienta"
1495
+ },
1496
+ "interop.md.escalateTimeout": {
1497
+ value: "- **Escalar ante tiempo de espera agotado**: Sí",
1498
+ description: "Línea de política de escalamiento ante tiempo de espera"
1499
+ },
1500
+ "interop.md.yes": { value: "Sí", description: "Etiqueta de Sí" },
1501
+ "interop.md.no": { value: "No", description: "Etiqueta de No" },
1502
+ "error.jsonRunner.requiresModel": {
1503
+ value: "createAgentJsonRunner requiere un modelo o configuración de proveedor",
1504
+ description: "Error cuando el ejecutor JSON no tiene modelo ni proveedor"
1505
+ },
1506
+ "error.missingToolHandler": {
1507
+ value: "Falta el manejador para la herramienta: {name}",
1508
+ description: "Error cuando un manejador de herramienta no está registrado",
1509
+ placeholders: [{ name: "name", type: "string" }]
1510
+ },
1511
+ "error.unknownBackend": {
1512
+ value: "Backend desconocido: {backend}",
1513
+ description: "Error cuando se especifica un backend desconocido",
1514
+ placeholders: [{ name: "backend", type: "string" }]
1515
+ },
1516
+ "error.claudeSdk.notAvailable": {
1517
+ value: "Claude Agent SDK no disponible. Instale @anthropic-ai/claude-agent-sdk",
1518
+ description: "Error cuando el Claude Agent SDK no está disponible"
1519
+ },
1520
+ "error.claudeSdk.notInstalled": {
1521
+ value: "Claude Agent SDK no instalado. Ejecute: npm install @anthropic-ai/claude-agent-sdk",
1522
+ description: "Error cuando no se encuentra el módulo del Claude Agent SDK"
1523
+ },
1524
+ "error.opencodeSdk.notAvailable": {
1525
+ value: "OpenCode SDK no disponible. Instale @opencode-ai/sdk",
1526
+ description: "Error cuando el OpenCode SDK no está disponible"
1527
+ },
1528
+ "error.opencodeSdk.notInstalled": {
1529
+ value: "OpenCode SDK no instalado. Ejecute: npm install @opencode-ai/sdk",
1530
+ description: "Error cuando no se encuentra el módulo del OpenCode SDK"
1531
+ },
1532
+ "error.providerNotInitialized": {
1533
+ value: "Proveedor no inicializado",
1534
+ description: "Error cuando el proveedor no ha sido inicializado antes de su uso"
1535
+ },
1536
+ "error.agentKeyRequired": {
1537
+ value: "La clave del agente es obligatoria",
1538
+ description: "Error de validación: falta la clave del agente"
1539
+ },
1540
+ "error.agentMissingVersion": {
1541
+ value: "Al agente {key} le falta una versión de tipo cadena",
1542
+ description: "Error de validación: la versión no es una cadena de texto",
1543
+ placeholders: [{ name: "key", type: "string" }]
1544
+ },
1545
+ "error.agentRequiresInstructions": {
1546
+ value: "El agente {key} requiere instrucciones",
1547
+ description: "Error de validación: faltan instrucciones",
1548
+ placeholders: [{ name: "key", type: "string" }]
1549
+ },
1550
+ "error.agentRequiresTool": {
1551
+ value: "El agente {key} debe exponer al menos una herramienta",
1552
+ description: "Error de validación: no hay herramientas definidas",
1553
+ placeholders: [{ name: "key", type: "string" }]
1554
+ },
1555
+ "error.agentDuplicateTool": {
1556
+ value: "El agente {key} tiene un nombre de herramienta duplicado: {name}",
1557
+ description: "Error de validación: nombre de herramienta duplicado",
1558
+ placeholders: [
1559
+ { name: "key", type: "string" },
1560
+ { name: "name", type: "string" }
1561
+ ]
1562
+ },
1563
+ "error.agentSpecNotFound": {
1564
+ value: "Especificación de agente no encontrada para {name}",
1565
+ description: "Error cuando la especificación del agente no está en el registro",
1566
+ placeholders: [{ name: "name", type: "string" }]
1567
+ },
1568
+ "error.specNotFound": {
1569
+ value: "Especificación no encontrada: {specKey}",
1570
+ description: "Error cuando no se encuentra una clave de especificación",
1571
+ placeholders: [{ name: "specKey", type: "string" }]
1572
+ },
1573
+ "error.toolNotFound": {
1574
+ value: "Herramienta no encontrada: {name}",
1575
+ description: "Error cuando no se encuentra una herramienta",
1576
+ placeholders: [{ name: "name", type: "string" }]
1577
+ },
1578
+ "error.noHandlerForTool": {
1579
+ value: "No hay manejador registrado para la herramienta: {name}",
1580
+ description: "Error cuando no hay manejador registrado para una herramienta",
1581
+ placeholders: [{ name: "name", type: "string" }]
1582
+ },
1583
+ "error.noToolHandler": {
1584
+ value: "Sin manejador para la herramienta: {name}",
1585
+ description: "Error breve cuando no existe manejador",
1586
+ placeholders: [{ name: "name", type: "string" }]
1587
+ },
1588
+ "error.unknownExportFormat": {
1589
+ value: "Formato de exportación desconocido: {format}",
1590
+ description: "Error para formato de exportación no soportado",
1591
+ placeholders: [{ name: "format", type: "string" }]
1592
+ },
1593
+ "error.handlerNotFoundForTool": {
1594
+ value: "Manejador no encontrado para la herramienta {name}",
1595
+ description: "Error en el puente de herramientas cuando falta el manejador",
1596
+ placeholders: [{ name: "name", type: "string" }]
1597
+ },
1598
+ "error.toolNotFoundOrNoHandler": {
1599
+ value: "Error: La herramienta '{name}' no fue encontrada o no tiene manejador",
1600
+ description: "Error devuelto al LLM cuando la ejecución de la herramienta falla",
1601
+ placeholders: [{ name: "name", type: "string" }]
1602
+ },
1603
+ "error.toolNoExecuteHandler": {
1604
+ value: "La herramienta {name} no tiene manejador de ejecución",
1605
+ description: "Error cuando la herramienta carece de una función de ejecución",
1606
+ placeholders: [{ name: "name", type: "string" }]
1607
+ },
1608
+ "error.provider.notRegistered": {
1609
+ value: "no registrado",
1610
+ description: "Razón de disponibilidad del proveedor: no registrado"
1611
+ },
1612
+ "error.provider.depsNotInstalled": {
1613
+ value: "dependencias no instaladas o no configuradas",
1614
+ description: "Razón de disponibilidad del proveedor: faltan dependencias"
1615
+ },
1616
+ "error.provider.sdkNotConfigured": {
1617
+ value: "SDK no instalado o clave de API no configurada",
1618
+ description: "Razón de disponibilidad del proveedor: falta SDK o clave"
1619
+ },
1620
+ "error.provider.claudeSdkMissing": {
1621
+ value: "@anthropic-ai/claude-agent-sdk no está instalado",
1622
+ description: "Error cuando falla require.resolve del Claude Agent SDK"
1623
+ },
1624
+ "error.provider.opencodeSdkMissing": {
1625
+ value: "@opencode-ai/sdk no está instalado",
1626
+ description: "Error cuando falla require.resolve del OpenCode SDK"
1627
+ },
1628
+ "error.provider.sdkNotInstalled": {
1629
+ value: "SDK no instalado",
1630
+ description: "Error genérico del proveedor: SDK no instalado"
1631
+ },
1632
+ "error.provider.contextCreation": {
1633
+ value: "Error al crear el contexto: {error}",
1634
+ description: "Error durante la creación del contexto del proveedor",
1635
+ placeholders: [{ name: "error", type: "string" }]
1636
+ },
1637
+ "error.provider.executionFailed": {
1638
+ value: "La ejecución falló: {error}",
1639
+ description: "Error durante la ejecución del proveedor",
1640
+ placeholders: [{ name: "error", type: "string" }]
1641
+ },
1642
+ "error.provider.streamFailed": {
1643
+ value: "El stream falló: {error}",
1644
+ description: "Error durante el streaming del proveedor",
1645
+ placeholders: [{ name: "error", type: "string" }]
1646
+ },
1647
+ "export.agentConfiguration": {
1648
+ value: "# Configuración del agente",
1649
+ description: "Encabezado Markdown"
1650
+ },
1651
+ "export.metadata": {
1652
+ value: "## Metadatos",
1653
+ description: "Encabezado Markdown"
1654
+ },
1655
+ "export.metaName": {
1656
+ value: "- **Nombre**: {name}",
1657
+ description: "Línea de metadatos",
1658
+ placeholders: [{ name: "name", type: "string" }]
1659
+ },
1660
+ "export.metaVersion": {
1661
+ value: "- **Versión**: {version}",
1662
+ description: "Línea de metadatos",
1663
+ placeholders: [{ name: "version", type: "string" }]
1664
+ },
1665
+ "export.metaOwners": {
1666
+ value: "- **Propietarios**: {owners}",
1667
+ description: "Línea de metadatos",
1668
+ placeholders: [{ name: "owners", type: "string" }]
1669
+ },
1670
+ "export.metaModel": {
1671
+ value: "- **Modelo**: {model}",
1672
+ description: "Línea de metadatos",
1673
+ placeholders: [{ name: "model", type: "string" }]
1674
+ },
1675
+ "export.instructions": {
1676
+ value: "## Instrucciones",
1677
+ description: "Encabezado Markdown"
1678
+ },
1679
+ "export.availableTools": {
1680
+ value: "## Herramientas disponibles",
1681
+ description: "Encabezado Markdown"
1682
+ },
1683
+ "export.tools": {
1684
+ value: "## Herramientas",
1685
+ description: "Encabezado Markdown"
1686
+ },
1687
+ "export.knowledgeSources": {
1688
+ value: "## Fuentes de conocimiento",
1689
+ description: "Encabezado Markdown"
1690
+ },
1691
+ "export.policy": {
1692
+ value: "## Política",
1693
+ description: "Encabezado Markdown"
1694
+ },
1695
+ "export.additionalContext": {
1696
+ value: "## Contexto adicional",
1697
+ description: "Encabezado Markdown"
1698
+ },
1699
+ "export.configuration": {
1700
+ value: "## Configuración",
1701
+ description: "Encabezado Markdown"
1702
+ },
1703
+ "export.mcpServers": {
1704
+ value: "## Servidores MCP",
1705
+ description: "Encabezado Markdown"
1706
+ },
1707
+ "export.parameters": {
1708
+ value: "**Parámetros:**",
1709
+ description: "Etiqueta de parámetros"
1710
+ },
1711
+ "export.requiresApproval": {
1712
+ value: "requiere aprobación",
1713
+ description: "Indicador de herramienta"
1714
+ },
1715
+ "export.notAutomationSafe": {
1716
+ value: "no es seguro para automatización",
1717
+ description: "Indicador de herramienta"
1718
+ },
1719
+ "export.requiresApprovalMd": {
1720
+ value: "*(requiere aprobación)*",
1721
+ description: "Indicador de herramienta en Markdown"
1722
+ },
1723
+ "export.notAutomationSafeMd": {
1724
+ value: "*(no es seguro para automatización)*",
1725
+ description: "Indicador de herramienta en Markdown"
1726
+ },
1727
+ "export.required": {
1728
+ value: "(obligatorio)",
1729
+ description: "Marcador de obligatorio"
1730
+ },
1731
+ "export.optional": {
1732
+ value: "(opcional)",
1733
+ description: "Marcador de opcional"
1734
+ },
1735
+ "export.minConfidence": {
1736
+ value: "- Confianza mínima: {min}",
1737
+ description: "Línea de política",
1738
+ placeholders: [{ name: "min", type: "number" }]
1739
+ },
1740
+ "export.escalationConfigured": {
1741
+ value: "- La política de escalamiento está configurada",
1742
+ description: "Línea de política para el prompt del sistema"
1743
+ },
1744
+ "export.escalationPolicyConfigured": {
1745
+ value: "- Política de escalamiento configurada",
1746
+ description: "Línea de política para la exportación en Markdown"
1747
+ },
1748
+ "export.featureFlags": {
1749
+ value: "- Indicadores de características: {flags}",
1750
+ description: "Línea de política de indicadores de características",
1751
+ placeholders: [{ name: "flags", type: "string" }]
1752
+ },
1753
+ "export.generatedFrom": {
1754
+ value: "*Generado desde ContractSpec: {key}*",
1755
+ description: "Línea de atribución en el pie",
1756
+ placeholders: [{ name: "key", type: "string" }]
1757
+ },
1758
+ "export.exportedAt": {
1759
+ value: "*Exportado el: {date}*",
1760
+ description: "Marca de tiempo en el pie",
1761
+ placeholders: [{ name: "date", type: "string" }]
1762
+ },
1763
+ "export.agentType": {
1764
+ value: "> Tipo de agente: **{type}**",
1765
+ description: "Llamada de tipo de agente",
1766
+ placeholders: [{ name: "type", type: "string" }]
1767
+ },
1768
+ "export.noDescription": {
1769
+ value: "Sin descripción",
1770
+ description: "Texto de respaldo cuando la herramienta no tiene descripción"
1771
+ },
1772
+ "export.validation.requiresKey": {
1773
+ value: "La especificación debe tener una meta.key",
1774
+ description: "Error de validación"
1775
+ },
1776
+ "export.validation.requiresInstructions": {
1777
+ value: "La especificación debe tener instrucciones",
1778
+ description: "Error de validación"
1779
+ },
1780
+ "export.validation.requiresTool": {
1781
+ value: "La especificación debe tener al menos una herramienta",
1782
+ description: "Error de validación"
1783
+ },
1784
+ "export.validation.toolRequiresName": {
1785
+ value: "Todas las herramientas deben tener un nombre",
1786
+ description: "Error de validación"
1787
+ },
1788
+ "export.validation.toolRequiresDescOrName": {
1789
+ value: "La herramienta debe tener una descripción o un nombre",
1790
+ description: "Error de validación"
1791
+ },
1792
+ "export.validation.toolInvalidName": {
1793
+ value: "El nombre de herramienta '{name}' debe ser un identificador válido (letras, números, guiones bajos)",
1794
+ description: "Error de validación para nombre de herramienta inválido",
1795
+ placeholders: [{ name: "name", type: "string" }]
1796
+ },
1797
+ "export.agentType.build": {
1798
+ value: "Agente principal con acceso completo a herramientas para la generación y modificación de código.",
1799
+ description: "Descripción del tipo de agente de construcción"
1800
+ },
1801
+ "export.agentType.plan": {
1802
+ value: "Agente restringido para análisis y planificación. Las ediciones de archivos y los comandos bash requieren aprobación.",
1803
+ description: "Descripción del tipo de agente de planificación"
1804
+ },
1805
+ "export.agentType.general": {
1806
+ value: "Subagente de propósito general para preguntas complejas y tareas de múltiples pasos.",
1807
+ description: "Descripción del tipo de agente general"
1808
+ },
1809
+ "export.agentType.explore": {
1810
+ value: "Subagente rápido optimizado para exploración de código y búsqueda de patrones.",
1811
+ description: "Descripción del tipo de agente de exploración"
1812
+ },
1813
+ "export.bridge.requiresApproval": {
1814
+ value: "(requiere aprobación)",
1815
+ description: "Etiqueta de permiso de herramienta"
1816
+ },
1817
+ "export.bridge.askMode": {
1818
+ value: "(modo consulta)",
1819
+ description: "Etiqueta de permiso de herramienta"
1820
+ },
1821
+ "approval.toolRequiresApproval": {
1822
+ value: 'La herramienta "{name}" requiere aprobación',
1823
+ description: "Razón predeterminada para solicitudes de aprobación de herramientas",
1824
+ placeholders: [{ name: "name", type: "string" }]
1825
+ },
1826
+ "log.unifiedAgent.fallback": {
1827
+ value: "[UnifiedAgent] {backend} falló, recurriendo a {fallback}",
1828
+ description: "Advertencia cuando un backend falla y se utiliza el respaldo",
1829
+ placeholders: [
1830
+ { name: "backend", type: "string" },
1831
+ { name: "fallback", type: "string" }
1832
+ ]
1833
+ },
1834
+ "log.knowledge.spaceNotAvailable": {
1835
+ value: 'El espacio de conocimiento requerido "{key}" no está disponible',
1836
+ description: "Advertencia cuando un espacio de conocimiento requerido no existe",
1837
+ placeholders: [{ name: "key", type: "string" }]
1838
+ },
1839
+ "log.knowledge.loadFailed": {
1840
+ value: 'Error al cargar el conocimiento requerido "{key}":',
1841
+ description: "Advertencia cuando falla la carga de conocimiento",
1842
+ placeholders: [{ name: "key", type: "string" }]
1843
+ },
1844
+ "log.knowledge.queryFailed": {
1845
+ value: "Error al consultar el espacio de conocimiento {space}:",
1846
+ description: "Advertencia cuando falla la consulta de conocimiento",
1847
+ placeholders: [{ name: "space", type: "string" }]
1848
+ },
1849
+ "log.mcpServer.started": {
1850
+ value: "[MCPToolServer] Iniciado {name}@{version} con {count} herramientas",
1851
+ description: "Mensaje de registro cuando el servidor de herramientas MCP se inicia",
1852
+ placeholders: [
1853
+ { name: "name", type: "string" },
1854
+ { name: "version", type: "string" },
1855
+ { name: "count", type: "number" }
1856
+ ]
1857
+ },
1858
+ "log.mcpServer.stopped": {
1859
+ value: "[MCPToolServer] Detenido {name}",
1860
+ description: "Mensaje de registro cuando el servidor de herramientas MCP se detiene",
1861
+ placeholders: [{ name: "name", type: "string" }]
1862
+ }
1863
+ }
1864
+ });
1865
+ });
1866
+
1867
+ // src/i18n/locale.ts
1868
+ function resolveLocale(specLocale, runtimeLocale) {
1869
+ const raw = runtimeLocale ?? specLocale ?? DEFAULT_LOCALE;
1870
+ if (isSupportedLocale(raw)) {
1871
+ return raw;
1872
+ }
1873
+ const base = raw.split("-")[0];
1874
+ if (base && isSupportedLocale(base)) {
1875
+ return base;
1876
+ }
1877
+ return DEFAULT_LOCALE;
1878
+ }
1879
+ function isSupportedLocale(locale) {
1880
+ return SUPPORTED_LOCALES.includes(locale);
1881
+ }
1882
+ var DEFAULT_LOCALE = "en", SUPPORTED_LOCALES;
1883
+ var init_locale = __esm(() => {
1884
+ SUPPORTED_LOCALES = ["en", "fr", "es"];
1885
+ });
1886
+
1887
+ // src/i18n/messages.ts
1888
+ import { TranslationRegistry } from "@contractspec/lib.contracts/translations";
1889
+ function getRegistry() {
1890
+ if (!sharedRegistry) {
1891
+ sharedRegistry = new TranslationRegistry([
1892
+ enMessages,
1893
+ frMessages,
1894
+ esMessages
1895
+ ]);
1896
+ }
1897
+ return sharedRegistry;
1898
+ }
1899
+ function interpolate(template, params) {
1900
+ if (!params)
1901
+ return template;
1902
+ return template.replace(/\{(\w+)\}/g, (match, key) => {
1903
+ if (key in params) {
1904
+ return String(params[key]);
1905
+ }
1906
+ return match;
1907
+ });
1908
+ }
1909
+ function createAgentI18n(specLocale, runtimeLocale) {
1910
+ const locale = resolveLocale(specLocale, runtimeLocale);
1911
+ const registry = getRegistry();
1912
+ return {
1913
+ locale,
1914
+ t(key, params) {
1915
+ const raw = registry.getValue(SPEC_KEY, key, locale, key);
1916
+ return interpolate(raw, params);
1917
+ }
1918
+ };
1919
+ }
1920
+ function getDefaultI18n() {
1921
+ return createAgentI18n(DEFAULT_LOCALE);
1922
+ }
1923
+ function resetI18nRegistry() {
1924
+ sharedRegistry = null;
1925
+ }
1926
+ var SPEC_KEY = "ai-agent.messages", sharedRegistry = null;
1927
+ var init_messages = __esm(() => {
1928
+ init_en();
1929
+ init_fr();
1930
+ init_es();
1931
+ init_locale();
1932
+ });
1933
+
1934
+ // src/i18n/keys.ts
1935
+ var AGENT_KEYS, KNOWLEDGE_KEYS, TOOL_KEYS, INTEROP_KEYS, ERROR_KEYS, EXPORT_KEYS, APPROVAL_KEYS, LOG_KEYS, I18N_KEYS;
1936
+ var init_keys = __esm(() => {
1937
+ AGENT_KEYS = {
1938
+ "agent.json.rules.validJsonOnly": "agent.json.rules.validJsonOnly",
1939
+ "agent.json.rules.noMarkdownFences": "agent.json.rules.noMarkdownFences",
1940
+ "agent.json.rules.noCommentary": "agent.json.rules.noCommentary",
1941
+ "agent.json.rules.doubleQuotes": "agent.json.rules.doubleQuotes",
1942
+ "agent.json.rules.noTrailingCommas": "agent.json.rules.noTrailingCommas",
1943
+ "agent.json.defaultDescription": "agent.json.defaultDescription",
1944
+ "agent.json.systemPrompt": "agent.json.systemPrompt"
1945
+ };
1946
+ KNOWLEDGE_KEYS = {
1947
+ "knowledge.header": "knowledge.header",
1948
+ "knowledge.description": "knowledge.description"
1949
+ };
1950
+ TOOL_KEYS = {
1951
+ "tool.knowledge.description": "tool.knowledge.description",
1952
+ "tool.knowledge.availableSpaces": "tool.knowledge.availableSpaces",
1953
+ "tool.knowledge.spaceDefault": "tool.knowledge.spaceDefault",
1954
+ "tool.knowledge.param.query": "tool.knowledge.param.query",
1955
+ "tool.knowledge.param.spaceKey": "tool.knowledge.param.spaceKey",
1956
+ "tool.knowledge.param.topK": "tool.knowledge.param.topK",
1957
+ "tool.knowledge.noResults": "tool.knowledge.noResults",
1958
+ "tool.knowledge.sourceLabel": "tool.knowledge.sourceLabel",
1959
+ "tool.fallbackDescription": "tool.fallbackDescription",
1960
+ "tool.mcp.param.message": "tool.mcp.param.message",
1961
+ "tool.mcp.param.sessionId": "tool.mcp.param.sessionId",
1962
+ "tool.mcp.agentDescription": "tool.mcp.agentDescription",
1963
+ "tool.mcp.executePrompt": "tool.mcp.executePrompt",
1964
+ "tool.mcp.toolDescription": "tool.mcp.toolDescription"
1965
+ };
1966
+ INTEROP_KEYS = {
1967
+ "interop.prompt.agentIdentity": "interop.prompt.agentIdentity",
1968
+ "interop.prompt.youAre": "interop.prompt.youAre",
1969
+ "interop.prompt.description": "interop.prompt.description",
1970
+ "interop.prompt.instructions": "interop.prompt.instructions",
1971
+ "interop.prompt.availableTools": "interop.prompt.availableTools",
1972
+ "interop.prompt.toolsIntro": "interop.prompt.toolsIntro",
1973
+ "interop.prompt.parameters": "interop.prompt.parameters",
1974
+ "interop.prompt.knowledgeContext": "interop.prompt.knowledgeContext",
1975
+ "interop.prompt.additionalContext": "interop.prompt.additionalContext",
1976
+ "interop.md.toc": "interop.md.toc",
1977
+ "interop.md.overview": "interop.md.overview",
1978
+ "interop.md.tools": "interop.md.tools",
1979
+ "interop.md.knowledge": "interop.md.knowledge",
1980
+ "interop.md.policy": "interop.md.policy",
1981
+ "interop.md.metaKey": "interop.md.metaKey",
1982
+ "interop.md.metaVersion": "interop.md.metaVersion",
1983
+ "interop.md.metaStability": "interop.md.metaStability",
1984
+ "interop.md.metaOwners": "interop.md.metaOwners",
1985
+ "interop.md.metaTags": "interop.md.metaTags",
1986
+ "interop.md.schema": "interop.md.schema",
1987
+ "interop.md.automationSafe": "interop.md.automationSafe",
1988
+ "interop.md.required": "interop.md.required",
1989
+ "interop.md.optional": "interop.md.optional",
1990
+ "interop.md.minConfidence": "interop.md.minConfidence",
1991
+ "interop.md.escalationThreshold": "interop.md.escalationThreshold",
1992
+ "interop.md.escalateToolFailure": "interop.md.escalateToolFailure",
1993
+ "interop.md.escalateTimeout": "interop.md.escalateTimeout",
1994
+ "interop.md.yes": "interop.md.yes",
1995
+ "interop.md.no": "interop.md.no"
1996
+ };
1997
+ ERROR_KEYS = {
1998
+ "error.jsonRunner.requiresModel": "error.jsonRunner.requiresModel",
1999
+ "error.missingToolHandler": "error.missingToolHandler",
2000
+ "error.unknownBackend": "error.unknownBackend",
2001
+ "error.claudeSdk.notAvailable": "error.claudeSdk.notAvailable",
2002
+ "error.claudeSdk.notInstalled": "error.claudeSdk.notInstalled",
2003
+ "error.opencodeSdk.notAvailable": "error.opencodeSdk.notAvailable",
2004
+ "error.opencodeSdk.notInstalled": "error.opencodeSdk.notInstalled",
2005
+ "error.providerNotInitialized": "error.providerNotInitialized",
2006
+ "error.agentKeyRequired": "error.agentKeyRequired",
2007
+ "error.agentMissingVersion": "error.agentMissingVersion",
2008
+ "error.agentRequiresInstructions": "error.agentRequiresInstructions",
2009
+ "error.agentRequiresTool": "error.agentRequiresTool",
2010
+ "error.agentDuplicateTool": "error.agentDuplicateTool",
2011
+ "error.agentSpecNotFound": "error.agentSpecNotFound",
2012
+ "error.specNotFound": "error.specNotFound",
2013
+ "error.toolNotFound": "error.toolNotFound",
2014
+ "error.noHandlerForTool": "error.noHandlerForTool",
2015
+ "error.noToolHandler": "error.noToolHandler",
2016
+ "error.unknownExportFormat": "error.unknownExportFormat",
2017
+ "error.handlerNotFoundForTool": "error.handlerNotFoundForTool",
2018
+ "error.toolNotFoundOrNoHandler": "error.toolNotFoundOrNoHandler",
2019
+ "error.toolNoExecuteHandler": "error.toolNoExecuteHandler",
2020
+ "error.provider.notRegistered": "error.provider.notRegistered",
2021
+ "error.provider.depsNotInstalled": "error.provider.depsNotInstalled",
2022
+ "error.provider.sdkNotConfigured": "error.provider.sdkNotConfigured",
2023
+ "error.provider.claudeSdkMissing": "error.provider.claudeSdkMissing",
2024
+ "error.provider.opencodeSdkMissing": "error.provider.opencodeSdkMissing",
2025
+ "error.provider.sdkNotInstalled": "error.provider.sdkNotInstalled",
2026
+ "error.provider.contextCreation": "error.provider.contextCreation",
2027
+ "error.provider.executionFailed": "error.provider.executionFailed",
2028
+ "error.provider.streamFailed": "error.provider.streamFailed"
2029
+ };
2030
+ EXPORT_KEYS = {
2031
+ "export.agentConfiguration": "export.agentConfiguration",
2032
+ "export.metadata": "export.metadata",
2033
+ "export.metaName": "export.metaName",
2034
+ "export.metaVersion": "export.metaVersion",
2035
+ "export.metaOwners": "export.metaOwners",
2036
+ "export.metaModel": "export.metaModel",
2037
+ "export.instructions": "export.instructions",
2038
+ "export.availableTools": "export.availableTools",
2039
+ "export.tools": "export.tools",
2040
+ "export.knowledgeSources": "export.knowledgeSources",
2041
+ "export.policy": "export.policy",
2042
+ "export.additionalContext": "export.additionalContext",
2043
+ "export.configuration": "export.configuration",
2044
+ "export.mcpServers": "export.mcpServers",
2045
+ "export.parameters": "export.parameters",
2046
+ "export.requiresApproval": "export.requiresApproval",
2047
+ "export.notAutomationSafe": "export.notAutomationSafe",
2048
+ "export.requiresApprovalMd": "export.requiresApprovalMd",
2049
+ "export.notAutomationSafeMd": "export.notAutomationSafeMd",
2050
+ "export.required": "export.required",
2051
+ "export.optional": "export.optional",
2052
+ "export.minConfidence": "export.minConfidence",
2053
+ "export.escalationConfigured": "export.escalationConfigured",
2054
+ "export.escalationPolicyConfigured": "export.escalationPolicyConfigured",
2055
+ "export.featureFlags": "export.featureFlags",
2056
+ "export.generatedFrom": "export.generatedFrom",
2057
+ "export.exportedAt": "export.exportedAt",
2058
+ "export.agentType": "export.agentType",
2059
+ "export.noDescription": "export.noDescription",
2060
+ "export.validation.requiresKey": "export.validation.requiresKey",
2061
+ "export.validation.requiresInstructions": "export.validation.requiresInstructions",
2062
+ "export.validation.requiresTool": "export.validation.requiresTool",
2063
+ "export.validation.toolRequiresName": "export.validation.toolRequiresName",
2064
+ "export.validation.toolRequiresDescOrName": "export.validation.toolRequiresDescOrName",
2065
+ "export.validation.toolInvalidName": "export.validation.toolInvalidName",
2066
+ "export.agentType.build": "export.agentType.build",
2067
+ "export.agentType.plan": "export.agentType.plan",
2068
+ "export.agentType.general": "export.agentType.general",
2069
+ "export.agentType.explore": "export.agentType.explore",
2070
+ "export.bridge.requiresApproval": "export.bridge.requiresApproval",
2071
+ "export.bridge.askMode": "export.bridge.askMode"
2072
+ };
2073
+ APPROVAL_KEYS = {
2074
+ "approval.toolRequiresApproval": "approval.toolRequiresApproval"
2075
+ };
2076
+ LOG_KEYS = {
2077
+ "log.unifiedAgent.fallback": "log.unifiedAgent.fallback",
2078
+ "log.knowledge.spaceNotAvailable": "log.knowledge.spaceNotAvailable",
2079
+ "log.knowledge.loadFailed": "log.knowledge.loadFailed",
2080
+ "log.knowledge.queryFailed": "log.knowledge.queryFailed",
2081
+ "log.mcpServer.started": "log.mcpServer.started",
2082
+ "log.mcpServer.stopped": "log.mcpServer.stopped"
2083
+ };
2084
+ I18N_KEYS = {
2085
+ ...AGENT_KEYS,
2086
+ ...KNOWLEDGE_KEYS,
2087
+ ...TOOL_KEYS,
2088
+ ...INTEROP_KEYS,
2089
+ ...ERROR_KEYS,
2090
+ ...EXPORT_KEYS,
2091
+ ...APPROVAL_KEYS,
2092
+ ...LOG_KEYS
2093
+ };
2094
+ });
2095
+
2096
+ // src/i18n/index.ts
2097
+ var init_i18n = __esm(() => {
2098
+ init_messages();
2099
+ init_locale();
2100
+ init_keys();
2101
+ init_en();
2102
+ init_fr();
2103
+ init_es();
2104
+ });
2105
+
15
2106
  // src/spec/spec.ts
16
2107
  function defineAgent(spec) {
2108
+ const i18n = getDefaultI18n();
17
2109
  if (!spec.meta?.key) {
18
- throw new Error("Agent key is required");
2110
+ throw new Error(i18n.t("error.agentKeyRequired"));
19
2111
  }
20
2112
  if (typeof spec.meta.version !== "string") {
21
- throw new Error(`Agent ${spec.meta.key} is missing a string version`);
2113
+ throw new Error(i18n.t("error.agentMissingVersion", { key: spec.meta.key }));
22
2114
  }
23
2115
  if (!spec.instructions?.trim()) {
24
- throw new Error(`Agent ${spec.meta.key} requires instructions`);
2116
+ throw new Error(i18n.t("error.agentRequiresInstructions", { key: spec.meta.key }));
25
2117
  }
26
2118
  if (!spec.tools?.length) {
27
- throw new Error(`Agent ${spec.meta.key} must expose at least one tool`);
2119
+ throw new Error(i18n.t("error.agentRequiresTool", { key: spec.meta.key }));
28
2120
  }
29
2121
  const toolNames = new Set;
30
2122
  for (const tool of spec.tools) {
31
2123
  if (toolNames.has(tool.name)) {
32
- throw new Error(`Agent ${spec.meta.key} has duplicate tool name: ${tool.name}`);
2124
+ throw new Error(i18n.t("error.agentDuplicateTool", {
2125
+ key: spec.meta.key,
2126
+ name: tool.name
2127
+ }));
33
2128
  }
34
2129
  toolNames.add(tool.name);
35
2130
  }
@@ -38,6 +2133,9 @@ function defineAgent(spec) {
38
2133
  function agentKey(meta) {
39
2134
  return `${meta.key}.v${meta.version}`;
40
2135
  }
2136
+ var init_spec = __esm(() => {
2137
+ init_i18n();
2138
+ });
41
2139
 
42
2140
  // src/schema/json-schema-to-zod.ts
43
2141
  import { z } from "zod";
@@ -197,7 +2295,7 @@ function specToolsToAISDKTools(specTools, handlers, context = {}) {
197
2295
  for (const specTool of specTools) {
198
2296
  const handler = handlers.get(specTool.name);
199
2297
  if (!handler) {
200
- throw new Error(`Missing handler for tool: ${specTool.name}`);
2298
+ throw new Error(getDefaultI18n().t("error.missingToolHandler", { name: specTool.name }));
201
2299
  }
202
2300
  tools[specTool.name] = specToolToAISDKTool(specTool, handler, context);
203
2301
  }
@@ -213,27 +2311,29 @@ function buildToolHandlers(handlersObj) {
213
2311
  }
214
2312
  var init_tool_adapter = __esm(() => {
215
2313
  init_json_schema_to_zod();
2314
+ init_i18n();
216
2315
  });
217
2316
 
218
2317
  // src/tools/knowledge-tool.ts
219
2318
  import { tool as tool2 } from "ai";
220
2319
  import * as z2 from "zod";
221
- function createKnowledgeQueryTool(retriever, knowledgeRefs) {
2320
+ function createKnowledgeQueryTool(retriever, knowledgeRefs, locale) {
2321
+ const i18n = createAgentI18n(locale);
222
2322
  const optionalSpaces = knowledgeRefs.filter((k) => !k.required).map((k) => k.key).filter((key) => retriever.supportsSpace(key));
223
2323
  if (optionalSpaces.length === 0) {
224
2324
  return null;
225
2325
  }
226
- const spaceDescriptions = knowledgeRefs.filter((k) => !k.required && retriever.supportsSpace(k.key)).map((k) => `- ${k.key}: ${k.instructions ?? "Knowledge space"}`).join(`
2326
+ const spaceDescriptions = knowledgeRefs.filter((k) => !k.required && retriever.supportsSpace(k.key)).map((k) => `- ${k.key}: ${k.instructions ?? i18n.t("tool.knowledge.spaceDefault")}`).join(`
227
2327
  `);
228
2328
  return tool2({
229
- description: `Query knowledge bases for relevant information. Use this tool when you need to look up specific information that may not be in your context.
2329
+ description: `${i18n.t("tool.knowledge.description")}
230
2330
 
231
- Available knowledge spaces:
2331
+ ${i18n.t("tool.knowledge.availableSpaces")}
232
2332
  ${spaceDescriptions}`,
233
2333
  inputSchema: z2.object({
234
- query: z2.string().describe("The question or search query to find relevant information"),
235
- spaceKey: z2.enum(optionalSpaces).optional().describe("Specific knowledge space to query. If omitted, searches all available spaces."),
236
- topK: z2.number().optional().default(5).describe("Maximum number of results to return")
2334
+ query: z2.string().describe(i18n.t("tool.knowledge.param.query")),
2335
+ spaceKey: z2.enum(optionalSpaces).optional().describe(i18n.t("tool.knowledge.param.spaceKey")),
2336
+ topK: z2.number().optional().default(5).describe(i18n.t("tool.knowledge.param.topK"))
237
2337
  }),
238
2338
  execute: async ({ query, spaceKey, topK }) => {
239
2339
  const spacesToSearch = spaceKey ? [spaceKey] : optionalSpaces;
@@ -252,15 +2352,15 @@ ${spaceDescriptions}`,
252
2352
  });
253
2353
  }
254
2354
  } catch (error) {
255
- console.warn(`Failed to query knowledge space ${space}:`, error);
2355
+ console.warn(i18n.t("log.knowledge.queryFailed", { space }), error);
256
2356
  }
257
2357
  }
258
2358
  if (allResults.length === 0) {
259
- return "No relevant information found in the knowledge bases.";
2359
+ return i18n.t("tool.knowledge.noResults");
260
2360
  }
261
2361
  allResults.sort((a, b) => b.score - a.score);
262
2362
  const topResults = allResults.slice(0, topK ?? 5);
263
- return topResults.map((r, i) => `[Source ${i + 1} - ${r.space}] (relevance: ${(r.score * 100).toFixed(0)}%)
2363
+ return topResults.map((r, i) => `${i18n.t("tool.knowledge.sourceLabel", { index: i + 1, space: r.space, score: (r.score * 100).toFixed(0) })}
264
2364
  ${r.content}`).join(`
265
2365
 
266
2366
  ---
@@ -269,19 +2369,22 @@ ${r.content}`).join(`
269
2369
  }
270
2370
  });
271
2371
  }
272
- var init_knowledge_tool = () => {};
2372
+ var init_knowledge_tool = __esm(() => {
2373
+ init_i18n();
2374
+ });
273
2375
 
274
2376
  // src/knowledge/injector.ts
275
- async function injectStaticKnowledge(instructions, knowledgeRefs, retriever) {
2377
+ async function injectStaticKnowledge(instructions, knowledgeRefs, retriever, locale) {
276
2378
  if (!retriever)
277
2379
  return instructions;
278
2380
  const requiredRefs = knowledgeRefs.filter((ref) => ref.required);
279
2381
  if (requiredRefs.length === 0)
280
2382
  return instructions;
2383
+ const i18n = createAgentI18n(locale);
281
2384
  const blocks = [];
282
2385
  for (const ref of requiredRefs) {
283
2386
  if (!retriever.supportsSpace(ref.key)) {
284
- console.warn(`Required knowledge space "${ref.key}" is not available`);
2387
+ console.warn(i18n.t("log.knowledge.spaceNotAvailable", { key: ref.key }));
285
2388
  continue;
286
2389
  }
287
2390
  try {
@@ -294,7 +2397,7 @@ ${ref.instructions}` : `## ${ref.key}`;
294
2397
  ${content}`);
295
2398
  }
296
2399
  } catch (error) {
297
- console.warn(`Failed to load required knowledge "${ref.key}":`, error);
2400
+ console.warn(i18n.t("log.knowledge.loadFailed", { key: ref.key }), error);
298
2401
  }
299
2402
  }
300
2403
  if (blocks.length === 0)
@@ -303,9 +2406,9 @@ ${content}`);
303
2406
 
304
2407
  ---
305
2408
 
306
- # Reference Knowledge
2409
+ # ${i18n.t("knowledge.header")}
307
2410
 
308
- The following information is provided for your reference. Use it to inform your responses.
2411
+ ${i18n.t("knowledge.description")}
309
2412
 
310
2413
  ${blocks.join(`
311
2414
 
@@ -313,13 +2416,16 @@ ${blocks.join(`
313
2416
 
314
2417
  `)}`;
315
2418
  }
316
- function createKnowledgeInjector(retriever) {
2419
+ function createKnowledgeInjector(retriever, locale) {
317
2420
  return {
318
- inject: (instructions, knowledgeRefs) => injectStaticKnowledge(instructions, knowledgeRefs, retriever),
2421
+ inject: (instructions, knowledgeRefs) => injectStaticKnowledge(instructions, knowledgeRefs, retriever, locale),
319
2422
  hasSpace: (spaceKey) => retriever?.supportsSpace(spaceKey) ?? false,
320
2423
  listSpaces: () => retriever?.listSpaces() ?? []
321
2424
  };
322
2425
  }
2426
+ var init_injector = __esm(() => {
2427
+ init_i18n();
2428
+ });
323
2429
 
324
2430
  // src/session/store.ts
325
2431
  class InMemorySessionStore {
@@ -457,6 +2563,118 @@ var init_adapter = __esm(() => {
457
2563
  };
458
2564
  });
459
2565
 
2566
+ // src/telemetry/posthog.ts
2567
+ var exports_posthog = {};
2568
+ __export(exports_posthog, {
2569
+ createPostHogTracedModel: () => createPostHogTracedModel,
2570
+ createPostHogTelemetryCollector: () => createPostHogTelemetryCollector,
2571
+ createCompositeTelemetryCollector: () => createCompositeTelemetryCollector,
2572
+ PostHogTelemetryCollector: () => PostHogTelemetryCollector,
2573
+ CompositeTelemetryCollector: () => CompositeTelemetryCollector
2574
+ });
2575
+ async function createPostHogTracedModel(model, config, overrides) {
2576
+ const { withTracing } = await importPostHogAI();
2577
+ const phClient = await resolvePostHogClient(config);
2578
+ const tracingOptions = {
2579
+ ...config.defaults,
2580
+ ...overrides
2581
+ };
2582
+ return withTracing(model, phClient, tracingOptions);
2583
+ }
2584
+
2585
+ class PostHogTelemetryCollector {
2586
+ phClient;
2587
+ config;
2588
+ initPromise;
2589
+ constructor(config) {
2590
+ this.config = config;
2591
+ this.phClient = config.client;
2592
+ }
2593
+ async collect(sample) {
2594
+ const client = await this.getClient();
2595
+ const distinctId = this.config.defaults?.posthogDistinctId ?? sample.metadata?.["actorId"] ?? "system";
2596
+ client.capture({
2597
+ distinctId,
2598
+ event: "$ai_generation",
2599
+ properties: {
2600
+ $ai_model: sample.operation.name,
2601
+ $ai_provider: "contractspec",
2602
+ $ai_latency: sample.durationMs / 1000,
2603
+ $ai_is_error: !sample.success,
2604
+ $ai_trace_id: this.config.defaults?.posthogTraceId,
2605
+ ...sample.metadata?.["tokenUsage"] ? mapTokenUsage(sample.metadata["tokenUsage"]) : {},
2606
+ ...this.config.defaults?.posthogProperties,
2607
+ contractspec_operation: sample.operation.name,
2608
+ contractspec_version: sample.operation.version,
2609
+ contractspec_agent_id: sample.metadata?.["agentId"],
2610
+ contractspec_finish_reason: sample.metadata?.["finishReason"],
2611
+ contractspec_tool_count: sample.metadata?.["toolCallCount"]
2612
+ },
2613
+ groups: this.config.defaults?.posthogGroups
2614
+ });
2615
+ }
2616
+ async shutdown() {
2617
+ if (this.phClient?.shutdown) {
2618
+ await this.phClient.shutdown();
2619
+ }
2620
+ }
2621
+ async getClient() {
2622
+ if (this.phClient)
2623
+ return this.phClient;
2624
+ if (!this.initPromise) {
2625
+ this.initPromise = resolvePostHogClient(this.config).then((client) => {
2626
+ this.phClient = client;
2627
+ return client;
2628
+ });
2629
+ }
2630
+ return this.initPromise;
2631
+ }
2632
+ }
2633
+ function createPostHogTelemetryCollector(config) {
2634
+ return new PostHogTelemetryCollector(config);
2635
+ }
2636
+
2637
+ class CompositeTelemetryCollector {
2638
+ collectors;
2639
+ constructor(collectors) {
2640
+ this.collectors = collectors;
2641
+ }
2642
+ async collect(sample) {
2643
+ await Promise.all(this.collectors.map((c) => c.collect(sample)));
2644
+ }
2645
+ }
2646
+ function createCompositeTelemetryCollector(collectors) {
2647
+ return new CompositeTelemetryCollector(collectors);
2648
+ }
2649
+ async function importPostHogAI() {
2650
+ try {
2651
+ return await import("@posthog/ai");
2652
+ } catch {
2653
+ throw new Error("PostHog LLM Analytics requires @posthog/ai to be installed. Run: npm install @posthog/ai posthog-node");
2654
+ }
2655
+ }
2656
+ async function resolvePostHogClient(config) {
2657
+ if (config.client)
2658
+ return config.client;
2659
+ if (!config.apiKey) {
2660
+ throw new Error("PostHog LLM Analytics requires either a client instance or an apiKey.");
2661
+ }
2662
+ try {
2663
+ const { PostHog } = await import("posthog-node");
2664
+ return new PostHog(config.apiKey, {
2665
+ host: config.host ?? "https://us.i.posthog.com"
2666
+ });
2667
+ } catch {
2668
+ throw new Error("PostHog LLM Analytics requires posthog-node to be installed. Run: npm install posthog-node");
2669
+ }
2670
+ }
2671
+ function mapTokenUsage(usage) {
2672
+ return {
2673
+ $ai_input_tokens: usage["promptTokens"],
2674
+ $ai_output_tokens: usage["completionTokens"]
2675
+ };
2676
+ }
2677
+
460
2678
  // src/agent/contract-spec-agent.ts
461
2679
  var exports_contract_spec_agent = {};
462
2680
  __export(exports_contract_spec_agent, {
@@ -494,15 +2712,21 @@ class ContractSpecAgent {
494
2712
  });
495
2713
  }
496
2714
  static async create(config) {
497
- const instructions = await injectStaticKnowledge(config.spec.instructions, config.spec.knowledge ?? [], config.knowledgeRetriever);
498
- const specTools = specToolsToAISDKTools(config.spec.tools, config.toolHandlers, { agentId: agentKey(config.spec.meta) });
499
- const knowledgeTool = config.knowledgeRetriever ? createKnowledgeQueryTool(config.knowledgeRetriever, config.spec.knowledge ?? []) : null;
2715
+ let effectiveConfig = config;
2716
+ if (config.posthogConfig) {
2717
+ const { createPostHogTracedModel: createPostHogTracedModel2 } = await Promise.resolve().then(() => exports_posthog);
2718
+ const tracedModel = await createPostHogTracedModel2(config.model, config.posthogConfig, config.posthogConfig.tracingOptions);
2719
+ effectiveConfig = { ...config, model: tracedModel };
2720
+ }
2721
+ const instructions = await injectStaticKnowledge(effectiveConfig.spec.instructions, effectiveConfig.spec.knowledge ?? [], effectiveConfig.knowledgeRetriever);
2722
+ const specTools = specToolsToAISDKTools(effectiveConfig.spec.tools, effectiveConfig.toolHandlers, { agentId: agentKey(effectiveConfig.spec.meta) });
2723
+ const knowledgeTool = effectiveConfig.knowledgeRetriever ? createKnowledgeQueryTool(effectiveConfig.knowledgeRetriever, effectiveConfig.spec.knowledge ?? []) : null;
500
2724
  const tools = {
501
2725
  ...specTools,
502
2726
  ...knowledgeTool ? { query_knowledge: knowledgeTool } : {},
503
- ...config.additionalTools ?? {}
2727
+ ...effectiveConfig.additionalTools ?? {}
504
2728
  };
505
- return new ContractSpecAgent(config, instructions, tools);
2729
+ return new ContractSpecAgent(effectiveConfig, instructions, tools);
506
2730
  }
507
2731
  async generate(params) {
508
2732
  const sessionId = params.options?.sessionId ?? generateSessionId();
@@ -590,8 +2814,10 @@ ${params.prompt}` : params.prompt;
590
2814
  }
591
2815
  var ContractSpecCallOptionsSchema;
592
2816
  var init_contract_spec_agent = __esm(() => {
2817
+ init_spec();
593
2818
  init_tool_adapter();
594
2819
  init_knowledge_tool();
2820
+ init_injector();
595
2821
  init_adapter();
596
2822
  ContractSpecCallOptionsSchema = z3.object({
597
2823
  tenantId: z3.string().optional(),
@@ -640,7 +2866,7 @@ var init_types = __esm(() => {
640
2866
  function specToolToClaudeAgentTool(tool3, handler, context) {
641
2867
  return {
642
2868
  name: tool3.name,
643
- description: tool3.description ?? `Execute ${tool3.name}`,
2869
+ description: tool3.description ?? getDefaultI18n().t("tool.fallbackDescription", { name: tool3.name }),
644
2870
  input_schema: normalizeSchema(tool3.schema),
645
2871
  requires_confirmation: tool3.requiresApproval ?? !tool3.automationSafe,
646
2872
  execute: async (input) => {
@@ -660,7 +2886,9 @@ function specToolsToClaudeAgentTools(tools, handlers, context) {
660
2886
  return tools.filter((tool3) => handlers.has(tool3.name)).map((tool3) => {
661
2887
  const handler = handlers.get(tool3.name);
662
2888
  if (!handler) {
663
- throw new Error(`Handler not found for tool ${tool3.name}`);
2889
+ throw new Error(getDefaultI18n().t("error.handlerNotFoundForTool", {
2890
+ name: tool3.name
2891
+ }));
664
2892
  }
665
2893
  return specToolToClaudeAgentTool(tool3, handler, context);
666
2894
  });
@@ -691,7 +2919,7 @@ function claudeAgentToolsToSpecTools(claudeTools) {
691
2919
  function specToolToExternalTool(tool3, handler, context) {
692
2920
  return {
693
2921
  name: tool3.name,
694
- description: tool3.description ?? `Execute ${tool3.name}`,
2922
+ description: tool3.description ?? getDefaultI18n().t("tool.fallbackDescription", { name: tool3.name }),
695
2923
  inputSchema: tool3.schema ?? { type: "object" },
696
2924
  requiresApproval: tool3.requiresApproval ?? !tool3.automationSafe,
697
2925
  execute: handler ? async (input) => {
@@ -732,6 +2960,9 @@ function extractToolCalls(response) {
732
2960
  args: block.input
733
2961
  }));
734
2962
  }
2963
+ var init_tool_bridge = __esm(() => {
2964
+ init_i18n();
2965
+ });
735
2966
 
736
2967
  // src/providers/claude-agent-sdk/session-bridge.ts
737
2968
  function toClaudeAgentSession(state) {
@@ -884,7 +3115,7 @@ class ClaudeAgentSDKProvider {
884
3115
  }
885
3116
  async createContext(spec) {
886
3117
  if (!this.isAvailable()) {
887
- throw new ProviderNotAvailableError(this.name, "SDK not installed or API key not configured");
3118
+ throw new ProviderNotAvailableError(this.name, getDefaultI18n().t("error.provider.sdkNotConfigured"));
888
3119
  }
889
3120
  try {
890
3121
  const toolSet = {};
@@ -909,7 +3140,9 @@ class ClaudeAgentSDKProvider {
909
3140
  cleanup: async () => {}
910
3141
  };
911
3142
  } catch (error) {
912
- throw new ContextCreationError(this.name, `Failed to create context: ${error instanceof Error ? error.message : String(error)}`, error instanceof Error ? error : undefined);
3143
+ throw new ContextCreationError(this.name, getDefaultI18n().t("error.provider.contextCreation", {
3144
+ error: error instanceof Error ? error.message : String(error)
3145
+ }), error instanceof Error ? error : undefined);
913
3146
  }
914
3147
  }
915
3148
  async execute(context, params) {
@@ -965,7 +3198,9 @@ ${params.systemOverride}` : context.spec.instructions;
965
3198
  }
966
3199
  };
967
3200
  } catch (error) {
968
- throw new ProviderExecutionError(this.name, `Execution failed: ${error instanceof Error ? error.message : String(error)}`, error instanceof Error ? error : undefined);
3201
+ throw new ProviderExecutionError(this.name, getDefaultI18n().t("error.provider.executionFailed", {
3202
+ error: error instanceof Error ? error.message : String(error)
3203
+ }), error instanceof Error ? error : undefined);
969
3204
  }
970
3205
  }
971
3206
  async* stream(context, params) {
@@ -1045,7 +3280,9 @@ ${params.systemOverride}` : context.spec.instructions;
1045
3280
  }
1046
3281
  };
1047
3282
  } catch (error) {
1048
- throw new ProviderExecutionError(this.name, `Stream failed: ${error instanceof Error ? error.message : String(error)}`, error instanceof Error ? error : undefined);
3283
+ throw new ProviderExecutionError(this.name, getDefaultI18n().t("error.provider.streamFailed", {
3284
+ error: error instanceof Error ? error.message : String(error)
3285
+ }), error instanceof Error ? error : undefined);
1049
3286
  }
1050
3287
  }
1051
3288
  async loadSDK() {
@@ -1053,7 +3290,7 @@ ${params.systemOverride}` : context.spec.instructions;
1053
3290
  const module = __require("@anthropic-ai/claude-agent-sdk");
1054
3291
  return module.default ?? module;
1055
3292
  } catch {
1056
- throw new ProviderNotAvailableError(this.name, "@anthropic-ai/claude-agent-sdk is not installed");
3293
+ throw new ProviderNotAvailableError(this.name, getDefaultI18n().t("error.provider.claudeSdkMissing"));
1057
3294
  }
1058
3295
  }
1059
3296
  prepareToolsForSDK(context, params) {
@@ -1063,7 +3300,9 @@ ${params.systemOverride}` : context.spec.instructions;
1063
3300
  if (externalTool?.execute) {
1064
3301
  handlers.set(tool3.name, async (input) => {
1065
3302
  if (!externalTool.execute) {
1066
- throw new Error(`Tool ${tool3.name} has no execute handler`);
3303
+ throw new Error(getDefaultI18n().t("error.toolNoExecuteHandler", {
3304
+ name: tool3.name
3305
+ }));
1067
3306
  }
1068
3307
  const result = await externalTool.execute(input);
1069
3308
  return typeof result === "string" ? result : JSON.stringify(result);
@@ -1085,7 +3324,9 @@ ${params.systemOverride}` : context.spec.instructions;
1085
3324
  return {
1086
3325
  toolCallId: toolCall.toolCallId,
1087
3326
  toolName: toolCall.toolName,
1088
- output: `Error: Tool '${toolCall.toolName}' not found or has no handler`
3327
+ output: getDefaultI18n().t("error.toolNotFoundOrNoHandler", {
3328
+ name: toolCall.toolName
3329
+ })
1089
3330
  };
1090
3331
  }
1091
3332
  try {
@@ -1127,7 +3368,11 @@ ${params.systemOverride}` : context.spec.instructions;
1127
3368
  }
1128
3369
  }
1129
3370
  var init_adapter2 = __esm(() => {
3371
+ init_spec();
1130
3372
  init_types();
3373
+ init_tool_bridge();
3374
+ init_injector();
3375
+ init_i18n();
1131
3376
  });
1132
3377
 
1133
3378
  // src/providers/claude-agent-sdk/index.ts
@@ -1157,13 +3402,14 @@ __export(exports_claude_agent_sdk, {
1157
3402
  });
1158
3403
  var init_claude_agent_sdk = __esm(() => {
1159
3404
  init_adapter2();
3405
+ init_tool_bridge();
1160
3406
  });
1161
3407
 
1162
3408
  // src/providers/opencode-sdk/tool-bridge.ts
1163
3409
  function specToolToOpenCodeTool(tool3) {
1164
3410
  return {
1165
3411
  name: tool3.name,
1166
- description: tool3.description ?? `Execute ${tool3.name}`,
3412
+ description: tool3.description ?? getDefaultI18n().t("tool.fallbackDescription", { name: tool3.name }),
1167
3413
  parameters: normalizeToOpenCodeParameters(tool3.schema),
1168
3414
  permission: getPermissionLevel(tool3)
1169
3415
  };
@@ -1195,7 +3441,7 @@ function openCodeToolsToSpecTools(openCodeTools) {
1195
3441
  function specToolToExternalToolForOpenCode(tool3, handler, context) {
1196
3442
  return {
1197
3443
  name: tool3.name,
1198
- description: tool3.description ?? `Execute ${tool3.name}`,
3444
+ description: tool3.description ?? getDefaultI18n().t("tool.fallbackDescription", { name: tool3.name }),
1199
3445
  inputSchema: tool3.schema ?? { type: "object" },
1200
3446
  requiresApproval: tool3.requiresApproval ?? !tool3.automationSafe,
1201
3447
  execute: handler ? async (input) => {
@@ -1259,7 +3505,9 @@ async function executeToolCall(toolCall, handlers) {
1259
3505
  if (!handler) {
1260
3506
  return {
1261
3507
  tool_call_id: toolCall.id,
1262
- output: `Error: Tool '${toolCall.name}' not found`,
3508
+ output: getDefaultI18n().t("error.toolNotFoundOrNoHandler", {
3509
+ name: toolCall.name
3510
+ }),
1263
3511
  is_error: true
1264
3512
  };
1265
3513
  }
@@ -1277,6 +3525,9 @@ async function executeToolCall(toolCall, handlers) {
1277
3525
  };
1278
3526
  }
1279
3527
  }
3528
+ var init_tool_bridge2 = __esm(() => {
3529
+ init_i18n();
3530
+ });
1280
3531
 
1281
3532
  // src/providers/opencode-sdk/agent-bridge.ts
1282
3533
  function inferAgentType(spec) {
@@ -1351,6 +3602,7 @@ function specToOpenCodeMarkdown(spec, options) {
1351
3602
  };
1352
3603
  }
1353
3604
  function buildMarkdownBody(spec) {
3605
+ const i18n = getDefaultI18n();
1354
3606
  const lines = [];
1355
3607
  lines.push(`# ${spec.meta.key}`);
1356
3608
  lines.push("");
@@ -1358,24 +3610,24 @@ function buildMarkdownBody(spec) {
1358
3610
  lines.push(spec.description ?? spec.meta.description ?? "");
1359
3611
  lines.push("");
1360
3612
  }
1361
- lines.push("## Instructions");
3613
+ lines.push(i18n.t("export.instructions"));
1362
3614
  lines.push("");
1363
3615
  lines.push(spec.instructions);
1364
3616
  lines.push("");
1365
3617
  if (spec.tools.length > 0) {
1366
- lines.push("## Tools");
3618
+ lines.push(i18n.t("export.tools"));
1367
3619
  lines.push("");
1368
3620
  for (const tool3 of spec.tools) {
1369
- const permission = tool3.requiresApproval ? "(requires approval)" : tool3.automationSafe === false ? "(ask mode)" : "";
1370
- lines.push(`- **${tool3.name}**: ${tool3.description ?? "No description"} ${permission}`.trim());
3621
+ const permission = tool3.requiresApproval ? i18n.t("export.bridge.requiresApproval") : tool3.automationSafe === false ? i18n.t("export.bridge.askMode") : "";
3622
+ lines.push(`- **${tool3.name}**: ${tool3.description ?? i18n.t("export.noDescription")} ${permission}`.trim());
1371
3623
  }
1372
3624
  lines.push("");
1373
3625
  }
1374
3626
  if (spec.knowledge && spec.knowledge.length > 0) {
1375
- lines.push("## Knowledge Sources");
3627
+ lines.push(i18n.t("export.knowledgeSources"));
1376
3628
  lines.push("");
1377
3629
  for (const k of spec.knowledge) {
1378
- const required = k.required ? "(required)" : "(optional)";
3630
+ const required = k.required ? i18n.t("export.required") : i18n.t("export.optional");
1379
3631
  lines.push(`- ${k.key} ${required}`);
1380
3632
  }
1381
3633
  lines.push("");
@@ -1434,7 +3686,10 @@ function openCodeConfigToSpec(config) {
1434
3686
  maxSteps: config.config?.max_steps ?? 10
1435
3687
  };
1436
3688
  }
1437
- var init_agent_bridge = () => {};
3689
+ var init_agent_bridge = __esm(() => {
3690
+ init_tool_bridge2();
3691
+ init_i18n();
3692
+ });
1438
3693
 
1439
3694
  // src/providers/opencode-sdk/adapter.ts
1440
3695
  class OpenCodeSDKProvider {
@@ -1469,7 +3724,7 @@ class OpenCodeSDKProvider {
1469
3724
  }
1470
3725
  async createContext(spec) {
1471
3726
  if (!this.isAvailable()) {
1472
- throw new ProviderNotAvailableError(this.name, "SDK not installed");
3727
+ throw new ProviderNotAvailableError(this.name, getDefaultI18n().t("error.provider.sdkNotInstalled"));
1473
3728
  }
1474
3729
  try {
1475
3730
  const sdk = await this.loadSDK();
@@ -1508,7 +3763,9 @@ class OpenCodeSDKProvider {
1508
3763
  }
1509
3764
  };
1510
3765
  } catch (error) {
1511
- throw new ContextCreationError(this.name, `Failed to create context: ${error instanceof Error ? error.message : String(error)}`, error instanceof Error ? error : undefined);
3766
+ throw new ContextCreationError(this.name, getDefaultI18n().t("error.provider.contextCreation", {
3767
+ error: error instanceof Error ? error.message : String(error)
3768
+ }), error instanceof Error ? error : undefined);
1512
3769
  }
1513
3770
  }
1514
3771
  async execute(context, params) {
@@ -1556,7 +3813,9 @@ ${params.systemOverride}` : context.spec.instructions;
1556
3813
  }
1557
3814
  };
1558
3815
  } catch (error) {
1559
- throw new ProviderExecutionError(this.name, `Execution failed: ${error instanceof Error ? error.message : String(error)}`, error instanceof Error ? error : undefined);
3816
+ throw new ProviderExecutionError(this.name, getDefaultI18n().t("error.provider.executionFailed", {
3817
+ error: error instanceof Error ? error.message : String(error)
3818
+ }), error instanceof Error ? error : undefined);
1560
3819
  }
1561
3820
  }
1562
3821
  async* stream(context, params) {
@@ -1642,7 +3901,9 @@ ${params.systemOverride}` : context.spec.instructions;
1642
3901
  }
1643
3902
  };
1644
3903
  } catch (error) {
1645
- throw new ProviderExecutionError(this.name, `Stream failed: ${error instanceof Error ? error.message : String(error)}`, error instanceof Error ? error : undefined);
3904
+ throw new ProviderExecutionError(this.name, getDefaultI18n().t("error.provider.streamFailed", {
3905
+ error: error instanceof Error ? error.message : String(error)
3906
+ }), error instanceof Error ? error : undefined);
1646
3907
  }
1647
3908
  }
1648
3909
  async loadSDK() {
@@ -1650,7 +3911,7 @@ ${params.systemOverride}` : context.spec.instructions;
1650
3911
  const module = __require("@opencode-ai/sdk");
1651
3912
  return module;
1652
3913
  } catch {
1653
- throw new ProviderNotAvailableError(this.name, "@opencode-ai/sdk is not installed");
3914
+ throw new ProviderNotAvailableError(this.name, getDefaultI18n().t("error.provider.opencodeSdkMissing"));
1654
3915
  }
1655
3916
  }
1656
3917
  getHostname() {
@@ -1694,8 +3955,12 @@ ${params.systemOverride}` : context.spec.instructions;
1694
3955
  }
1695
3956
  }
1696
3957
  var init_adapter3 = __esm(() => {
3958
+ init_spec();
1697
3959
  init_types();
3960
+ init_tool_bridge2();
1698
3961
  init_agent_bridge();
3962
+ init_injector();
3963
+ init_i18n();
1699
3964
  });
1700
3965
 
1701
3966
  // src/providers/opencode-sdk/index.ts
@@ -1717,40 +3982,48 @@ __export(exports_opencode_sdk, {
1717
3982
  });
1718
3983
  var init_opencode_sdk = __esm(() => {
1719
3984
  init_adapter3();
3985
+ init_tool_bridge2();
1720
3986
  init_agent_bridge();
1721
3987
  });
1722
3988
 
1723
3989
  // src/agent/json-runner.ts
3990
+ init_i18n();
1724
3991
  init_contract_spec_agent();
1725
3992
  import { createProvider } from "@contractspec/lib.ai-providers/factory";
1726
3993
  import { StabilityEnum } from "@contractspec/lib.contracts/ownership";
1727
- var JSON_ONLY_RULES = [
1728
- "You MUST output valid JSON ONLY.",
1729
- "Do not wrap the output in markdown fences.",
1730
- "Do not include commentary or explanation.",
1731
- "Use double quotes for all keys and string values.",
1732
- "Do not include trailing commas."
1733
- ].join(`
3994
+ function getJsonOnlyRules(locale) {
3995
+ const i18n = createAgentI18n(locale);
3996
+ return [
3997
+ i18n.t("agent.json.rules.validJsonOnly"),
3998
+ i18n.t("agent.json.rules.noMarkdownFences"),
3999
+ i18n.t("agent.json.rules.noCommentary"),
4000
+ i18n.t("agent.json.rules.doubleQuotes"),
4001
+ i18n.t("agent.json.rules.noTrailingCommas")
4002
+ ].join(`
1734
4003
  `);
1735
- var DEFAULT_SPEC = {
1736
- meta: {
1737
- key: "agent.json-runner",
1738
- version: "1.0.0",
1739
- description: "JSON-only agent runner for deterministic pipelines.",
1740
- stability: StabilityEnum.Experimental,
1741
- owners: ["platform.core"],
1742
- tags: ["json", "agent"]
1743
- },
1744
- instructions: "You are a precise JSON generator.",
1745
- tools: []
1746
- };
4004
+ }
4005
+ function getDefaultSpec(locale) {
4006
+ const i18n = createAgentI18n(locale);
4007
+ return {
4008
+ meta: {
4009
+ key: "agent.json-runner",
4010
+ version: "1.0.0",
4011
+ description: i18n.t("agent.json.defaultDescription"),
4012
+ stability: StabilityEnum.Experimental,
4013
+ owners: ["platform.core"],
4014
+ tags: ["json", "agent"]
4015
+ },
4016
+ instructions: i18n.t("agent.json.systemPrompt"),
4017
+ tools: []
4018
+ };
4019
+ }
1747
4020
  function resolveModel(options) {
1748
4021
  if (options.model)
1749
4022
  return options.model;
1750
4023
  if (options.provider) {
1751
4024
  return createProvider(options.provider).getModel();
1752
4025
  }
1753
- throw new Error("createAgentJsonRunner requires a model or provider config");
4026
+ throw new Error(getDefaultI18n().t("error.jsonRunner.requiresModel"));
1754
4027
  }
1755
4028
  function applyModelSettings(model, settings) {
1756
4029
  const { temperature } = settings;
@@ -1762,15 +4035,15 @@ function applyModelSettings(model, settings) {
1762
4035
  }
1763
4036
  return model;
1764
4037
  }
1765
- function buildInstructions(base, system) {
1766
- return [base, JSON_ONLY_RULES, system].filter(Boolean).join(`
4038
+ function buildInstructions(base, locale, system) {
4039
+ return [base, getJsonOnlyRules(locale), system].filter(Boolean).join(`
1767
4040
 
1768
4041
  `);
1769
4042
  }
1770
4043
  function ensureToolHandlers(spec, handlers) {
1771
4044
  for (const tool3 of spec.tools) {
1772
4045
  if (!handlers.has(tool3.name)) {
1773
- throw new Error(`Missing handler for tool: ${tool3.name}`);
4046
+ throw new Error(getDefaultI18n().t("error.missingToolHandler", { name: tool3.name }));
1774
4047
  }
1775
4048
  }
1776
4049
  }
@@ -1778,10 +4051,11 @@ async function createAgentJsonRunner(options) {
1778
4051
  const model = applyModelSettings(resolveModel(options), {
1779
4052
  temperature: options.temperature ?? 0
1780
4053
  });
1781
- const baseSpec = options.spec ?? DEFAULT_SPEC;
4054
+ const baseSpec = options.spec ?? getDefaultSpec(options.locale);
1782
4055
  const spec = {
1783
4056
  ...baseSpec,
1784
- instructions: buildInstructions(baseSpec.instructions, options.system),
4057
+ locale: options.spec?.locale ?? options.locale,
4058
+ instructions: buildInstructions(baseSpec.instructions, options.locale, options.system),
1785
4059
  maxSteps: options.maxSteps ?? baseSpec.maxSteps
1786
4060
  };
1787
4061
  const toolHandlers = options.toolHandlers ?? new Map;
@@ -1800,6 +4074,7 @@ async function createAgentJsonRunner(options) {
1800
4074
  }
1801
4075
 
1802
4076
  // src/agent/unified-agent.ts
4077
+ init_i18n();
1803
4078
  import { createProvider as createProvider2 } from "@contractspec/lib.ai-providers/factory";
1804
4079
 
1805
4080
  class UnifiedAgent {
@@ -1833,12 +4108,17 @@ class UnifiedAgent {
1833
4108
  await this.initializeOpenCodeSDK();
1834
4109
  break;
1835
4110
  default:
1836
- throw new Error(`Unknown backend: ${backend}`);
4111
+ throw new Error(getDefaultI18n().t("error.unknownBackend", {
4112
+ backend: String(backend)
4113
+ }));
1837
4114
  }
1838
4115
  } catch (error) {
1839
4116
  this.state.lastError = error instanceof Error ? error : new Error(String(error));
1840
4117
  if (this.config.fallbackBackend && this.config.fallbackBackend !== backend) {
1841
- console.warn(`[UnifiedAgent] ${backend} failed, falling back to ${this.config.fallbackBackend}`);
4118
+ console.warn(getDefaultI18n().t("log.unifiedAgent.fallback", {
4119
+ backend: String(backend),
4120
+ fallback: String(this.config.fallbackBackend)
4121
+ }));
1842
4122
  this.state.backend = this.config.fallbackBackend;
1843
4123
  await this.initialize();
1844
4124
  } else {
@@ -1852,13 +4132,13 @@ class UnifiedAgent {
1852
4132
  const config = this.config.config;
1853
4133
  this.provider = new ClaudeAgentSDKProvider2(config ?? {});
1854
4134
  if (!this.provider.isAvailable()) {
1855
- throw new Error("Claude Agent SDK not available. Install @anthropic-ai/claude-agent-sdk");
4135
+ throw new Error(getDefaultI18n().t("error.claudeSdk.notAvailable"));
1856
4136
  }
1857
4137
  this.context = await this.provider.createContext(this.spec);
1858
4138
  this.state.isReady = true;
1859
4139
  } catch (error) {
1860
4140
  if (error.code === "MODULE_NOT_FOUND") {
1861
- throw new Error("Claude Agent SDK not installed. Run: npm install @anthropic-ai/claude-agent-sdk");
4141
+ throw new Error(getDefaultI18n().t("error.claudeSdk.notInstalled"));
1862
4142
  }
1863
4143
  throw error;
1864
4144
  }
@@ -1869,13 +4149,13 @@ class UnifiedAgent {
1869
4149
  const config = this.config.config;
1870
4150
  this.provider = new OpenCodeSDKProvider2(config ?? {});
1871
4151
  if (!this.provider.isAvailable()) {
1872
- throw new Error("OpenCode SDK not available. Install @opencode-ai/sdk");
4152
+ throw new Error(getDefaultI18n().t("error.opencodeSdk.notAvailable"));
1873
4153
  }
1874
4154
  this.context = await this.provider.createContext(this.spec);
1875
4155
  this.state.isReady = true;
1876
4156
  } catch (error) {
1877
4157
  if (error.code === "MODULE_NOT_FOUND") {
1878
- throw new Error("OpenCode SDK not installed. Run: npm install @opencode-ai/sdk");
4158
+ throw new Error(getDefaultI18n().t("error.opencodeSdk.notInstalled"));
1879
4159
  }
1880
4160
  throw error;
1881
4161
  }
@@ -1894,7 +4174,9 @@ class UnifiedAgent {
1894
4174
  case "opencode-sdk":
1895
4175
  return await this.runWithExternalProvider(message, options);
1896
4176
  default:
1897
- throw new Error(`Unknown backend: ${backend}`);
4177
+ throw new Error(getDefaultI18n().t("error.unknownBackend", {
4178
+ backend: String(backend)
4179
+ }));
1898
4180
  }
1899
4181
  } catch (error) {
1900
4182
  this.state.lastError = error instanceof Error ? error : new Error(String(error));
@@ -1916,7 +4198,7 @@ class UnifiedAgent {
1916
4198
  }
1917
4199
  async runWithExternalProvider(message, options) {
1918
4200
  if (!this.provider || !this.context) {
1919
- throw new Error("Provider not initialized");
4201
+ throw new Error(getDefaultI18n().t("error.providerNotInitialized"));
1920
4202
  }
1921
4203
  const result = await this.provider.execute(this.context, {
1922
4204
  prompt: message,
@@ -2093,6 +4375,7 @@ async function getAvailableBackends() {
2093
4375
  init_contract_spec_agent();
2094
4376
 
2095
4377
  // src/approval/workflow.ts
4378
+ init_i18n();
2096
4379
  import { randomUUID } from "node:crypto";
2097
4380
 
2098
4381
  class InMemoryApprovalStore {
@@ -2165,7 +4448,9 @@ class ApprovalWorkflow {
2165
4448
  toolName: toolCall.toolName,
2166
4449
  toolCallId: toolCall.toolCallId,
2167
4450
  toolArgs: toolCall.args,
2168
- reason: context.reason ?? `Tool "${toolCall.toolName}" requires approval`
4451
+ reason: context.reason ?? getDefaultI18n().t("approval.toolRequiresApproval", {
4452
+ name: toolCall.toolName
4453
+ })
2169
4454
  });
2170
4455
  }
2171
4456
  async approve(id, reviewer, notes) {
@@ -2203,6 +4488,9 @@ function createApprovalWorkflow(store) {
2203
4488
  return new ApprovalWorkflow(store);
2204
4489
  }
2205
4490
  // src/exporters/claude-agent-exporter.ts
4491
+ init_spec();
4492
+ init_i18n();
4493
+
2206
4494
  class ClaudeAgentExporter {
2207
4495
  format = "claude-agent";
2208
4496
  export(spec, options = {}) {
@@ -2221,22 +4509,23 @@ class ClaudeAgentExporter {
2221
4509
  return specs.map((spec) => this.export(spec, options));
2222
4510
  }
2223
4511
  validate(spec) {
4512
+ const i18n = getDefaultI18n();
2224
4513
  const errors = [];
2225
4514
  if (!spec.meta?.key) {
2226
- errors.push("Spec must have a meta.key");
4515
+ errors.push(i18n.t("export.validation.requiresKey"));
2227
4516
  }
2228
4517
  if (!spec.instructions) {
2229
- errors.push("Spec must have instructions");
4518
+ errors.push(i18n.t("export.validation.requiresInstructions"));
2230
4519
  }
2231
4520
  if (!spec.tools || spec.tools.length === 0) {
2232
- errors.push("Spec must have at least one tool");
4521
+ errors.push(i18n.t("export.validation.requiresTool"));
2233
4522
  }
2234
4523
  for (const tool3 of spec.tools ?? []) {
2235
4524
  if (!tool3.name) {
2236
- errors.push("All tools must have a name");
4525
+ errors.push(i18n.t("export.validation.toolRequiresName"));
2237
4526
  }
2238
4527
  if (!tool3.description && !tool3.name) {
2239
- errors.push(`Tool must have a description or name`);
4528
+ errors.push(i18n.t("export.validation.toolRequiresDescOrName"));
2240
4529
  }
2241
4530
  }
2242
4531
  return { valid: errors.length === 0, errors };
@@ -2260,11 +4549,12 @@ class ClaudeAgentExporter {
2260
4549
  return config;
2261
4550
  }
2262
4551
  buildSystemPrompt(spec, options) {
4552
+ const i18n = getDefaultI18n();
2263
4553
  const parts = [];
2264
4554
  parts.push(spec.instructions);
2265
4555
  if (spec.knowledge && spec.knowledge.length > 0) {
2266
4556
  parts.push("");
2267
- parts.push("## Knowledge Sources");
4557
+ parts.push(i18n.t("export.knowledgeSources"));
2268
4558
  for (const k of spec.knowledge) {
2269
4559
  if (k.instructions) {
2270
4560
  parts.push(`- ${k.key}: ${k.instructions}`);
@@ -2273,17 +4563,17 @@ class ClaudeAgentExporter {
2273
4563
  }
2274
4564
  if (spec.policy) {
2275
4565
  parts.push("");
2276
- parts.push("## Policy");
4566
+ parts.push(i18n.t("export.policy"));
2277
4567
  if (spec.policy.confidence?.min) {
2278
- parts.push(`- Minimum confidence: ${spec.policy.confidence.min}`);
4568
+ parts.push(i18n.t("export.minConfidence", { min: spec.policy.confidence.min }));
2279
4569
  }
2280
4570
  if (spec.policy.escalation) {
2281
- parts.push("- Escalation policy is configured");
4571
+ parts.push(i18n.t("export.escalationConfigured"));
2282
4572
  }
2283
4573
  }
2284
4574
  if (options.metadata) {
2285
4575
  parts.push("");
2286
- parts.push("## Additional Context");
4576
+ parts.push(i18n.t("export.additionalContext"));
2287
4577
  for (const [key, value] of Object.entries(options.metadata)) {
2288
4578
  parts.push(`- ${key}: ${String(value)}`);
2289
4579
  }
@@ -2292,9 +4582,10 @@ class ClaudeAgentExporter {
2292
4582
  `);
2293
4583
  }
2294
4584
  exportTools(spec) {
4585
+ const i18n = getDefaultI18n();
2295
4586
  return spec.tools.map((tool3) => ({
2296
4587
  name: tool3.name,
2297
- description: tool3.description ?? `Execute ${tool3.name}`,
4588
+ description: tool3.description ?? i18n.t("tool.fallbackDescription", { name: tool3.name }),
2298
4589
  input_schema: this.normalizeSchema(tool3.schema),
2299
4590
  requires_confirmation: tool3.requiresApproval ?? !tool3.automationSafe
2300
4591
  }));
@@ -2317,38 +4608,41 @@ class ClaudeAgentExporter {
2317
4608
  };
2318
4609
  }
2319
4610
  generateClaudeMd(spec, options) {
4611
+ const i18n = getDefaultI18n();
2320
4612
  const lines = [];
2321
- lines.push("# Agent Configuration");
4613
+ lines.push(i18n.t("export.agentConfiguration"));
2322
4614
  lines.push("");
2323
4615
  if (spec.description) {
2324
4616
  lines.push(`> ${spec.description}`);
2325
4617
  lines.push("");
2326
4618
  }
2327
- lines.push("## Metadata");
4619
+ lines.push(i18n.t("export.metadata"));
2328
4620
  lines.push("");
2329
- lines.push(`- **Name**: ${spec.meta.key}`);
2330
- lines.push(`- **Version**: ${spec.meta.version}`);
4621
+ lines.push(i18n.t("export.metaName", { name: spec.meta.key }));
4622
+ lines.push(i18n.t("export.metaVersion", { version: spec.meta.version }));
2331
4623
  if (spec.meta.owners && spec.meta.owners.length > 0) {
2332
- lines.push(`- **Owners**: ${spec.meta.owners.join(", ")}`);
4624
+ lines.push(i18n.t("export.metaOwners", {
4625
+ owners: spec.meta.owners.join(", ")
4626
+ }));
2333
4627
  }
2334
4628
  if (options.model) {
2335
- lines.push(`- **Model**: ${options.model}`);
4629
+ lines.push(i18n.t("export.metaModel", { model: options.model }));
2336
4630
  }
2337
4631
  lines.push("");
2338
- lines.push("## Instructions");
4632
+ lines.push(i18n.t("export.instructions"));
2339
4633
  lines.push("");
2340
4634
  lines.push(spec.instructions);
2341
4635
  lines.push("");
2342
4636
  if (spec.tools.length > 0) {
2343
- lines.push("## Available Tools");
4637
+ lines.push(i18n.t("export.availableTools"));
2344
4638
  lines.push("");
2345
4639
  for (const tool3 of spec.tools) {
2346
4640
  const flags = [];
2347
4641
  if (tool3.requiresApproval) {
2348
- flags.push("requires approval");
4642
+ flags.push(i18n.t("export.requiresApproval"));
2349
4643
  }
2350
4644
  if (tool3.automationSafe === false) {
2351
- flags.push("not automation safe");
4645
+ flags.push(i18n.t("export.notAutomationSafe"));
2352
4646
  }
2353
4647
  const flagStr = flags.length > 0 ? ` (${flags.join(", ")})` : "";
2354
4648
  lines.push(`### ${tool3.name}${flagStr}`);
@@ -2358,7 +4652,7 @@ class ClaudeAgentExporter {
2358
4652
  lines.push("");
2359
4653
  }
2360
4654
  if (tool3.schema) {
2361
- lines.push("**Parameters:**");
4655
+ lines.push(i18n.t("export.parameters"));
2362
4656
  lines.push("```json");
2363
4657
  lines.push(JSON.stringify(tool3.schema, null, 2));
2364
4658
  lines.push("```");
@@ -2367,10 +4661,10 @@ class ClaudeAgentExporter {
2367
4661
  }
2368
4662
  }
2369
4663
  if (spec.knowledge && spec.knowledge.length > 0) {
2370
- lines.push("## Knowledge Sources");
4664
+ lines.push(i18n.t("export.knowledgeSources"));
2371
4665
  lines.push("");
2372
4666
  for (const k of spec.knowledge) {
2373
- const required = k.required ? "(required)" : "(optional)";
4667
+ const required = k.required ? i18n.t("export.required") : i18n.t("export.optional");
2374
4668
  lines.push(`- **${k.key}** ${required}`);
2375
4669
  if (k.instructions) {
2376
4670
  lines.push(` - ${k.instructions}`);
@@ -2379,21 +4673,23 @@ class ClaudeAgentExporter {
2379
4673
  lines.push("");
2380
4674
  }
2381
4675
  if (spec.policy) {
2382
- lines.push("## Policy");
4676
+ lines.push(i18n.t("export.policy"));
2383
4677
  lines.push("");
2384
4678
  if (spec.policy.confidence?.min) {
2385
- lines.push(`- Minimum confidence: ${spec.policy.confidence.min}`);
4679
+ lines.push(i18n.t("export.minConfidence", { min: spec.policy.confidence.min }));
2386
4680
  }
2387
4681
  if (spec.policy.escalation) {
2388
- lines.push("- Escalation policy configured");
4682
+ lines.push(i18n.t("export.escalationPolicyConfigured"));
2389
4683
  }
2390
4684
  if (spec.policy.flags && spec.policy.flags.length > 0) {
2391
- lines.push(`- Feature flags: ${spec.policy.flags.join(", ")}`);
4685
+ lines.push(i18n.t("export.featureFlags", {
4686
+ flags: spec.policy.flags.join(", ")
4687
+ }));
2392
4688
  }
2393
4689
  lines.push("");
2394
4690
  }
2395
4691
  if (options.mcpServers && options.mcpServers.length > 0) {
2396
- lines.push("## MCP Servers");
4692
+ lines.push(i18n.t("export.mcpServers"));
2397
4693
  lines.push("");
2398
4694
  for (const server of options.mcpServers) {
2399
4695
  lines.push(`- **${server.name}**: \`${server.command}${server.args ? " " + server.args.join(" ") : ""}\``);
@@ -2402,7 +4698,7 @@ class ClaudeAgentExporter {
2402
4698
  }
2403
4699
  lines.push("---");
2404
4700
  lines.push("");
2405
- lines.push(`*Generated from ContractSpec: ${agentKey(spec.meta)}*`);
4701
+ lines.push(i18n.t("export.generatedFrom", { key: agentKey(spec.meta) }));
2406
4702
  return lines.join(`
2407
4703
  `);
2408
4704
  }
@@ -2421,7 +4717,9 @@ function validateForClaudeAgent(spec) {
2421
4717
  return exporter.validate(spec);
2422
4718
  }
2423
4719
  // src/exporters/opencode-exporter.ts
4720
+ init_spec();
2424
4721
  init_agent_bridge();
4722
+ init_i18n();
2425
4723
 
2426
4724
  class OpenCodeExporter {
2427
4725
  format = "opencode";
@@ -2439,19 +4737,20 @@ class OpenCodeExporter {
2439
4737
  return specs.map((spec) => this.export(spec, options));
2440
4738
  }
2441
4739
  validate(spec) {
4740
+ const i18n = getDefaultI18n();
2442
4741
  const errors = [];
2443
4742
  if (!spec.meta?.key) {
2444
- errors.push("Spec must have a meta.key");
4743
+ errors.push(i18n.t("export.validation.requiresKey"));
2445
4744
  }
2446
4745
  if (!spec.instructions) {
2447
- errors.push("Spec must have instructions");
4746
+ errors.push(i18n.t("export.validation.requiresInstructions"));
2448
4747
  }
2449
4748
  for (const tool3 of spec.tools ?? []) {
2450
4749
  if (!tool3.name) {
2451
- errors.push("All tools must have a name");
4750
+ errors.push(i18n.t("export.validation.toolRequiresName"));
2452
4751
  }
2453
4752
  if (tool3.name && !/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(tool3.name)) {
2454
- errors.push(`Tool name '${tool3.name}' should be a valid identifier (letters, numbers, underscores)`);
4753
+ errors.push(i18n.t("export.validation.toolInvalidName", { name: tool3.name }));
2455
4754
  }
2456
4755
  }
2457
4756
  return { valid: errors.length === 0, errors };
@@ -2473,14 +4772,16 @@ class OpenCodeExporter {
2473
4772
  };
2474
4773
  }
2475
4774
  exportTools(spec) {
4775
+ const i18n = getDefaultI18n();
2476
4776
  return spec.tools.map((tool3) => ({
2477
4777
  name: tool3.name,
2478
- description: tool3.description ?? `Execute ${tool3.name}`,
4778
+ description: tool3.description ?? i18n.t("tool.fallbackDescription", { name: tool3.name }),
2479
4779
  schema: tool3.schema ?? { type: "object" },
2480
4780
  requires_approval: tool3.requiresApproval ?? !tool3.automationSafe
2481
4781
  }));
2482
4782
  }
2483
4783
  generateMarkdown(spec, jsonConfig, options) {
4784
+ const i18n = getDefaultI18n();
2484
4785
  const lines = [];
2485
4786
  lines.push("---");
2486
4787
  lines.push(`name: ${jsonConfig.name}`);
@@ -2500,7 +4801,7 @@ class OpenCodeExporter {
2500
4801
  if (jsonConfig.tools.length > 0) {
2501
4802
  lines.push("tools:");
2502
4803
  for (const tool3 of jsonConfig.tools) {
2503
- const permission = tool3.requires_approval ? " # requires approval" : "";
4804
+ const permission = tool3.requires_approval ? ` # ${i18n.t("export.requiresApproval")}` : "";
2504
4805
  lines.push(` - ${tool3.name}${permission}`);
2505
4806
  }
2506
4807
  }
@@ -2512,20 +4813,20 @@ class OpenCodeExporter {
2512
4813
  lines.push(spec.description);
2513
4814
  lines.push("");
2514
4815
  }
2515
- lines.push(`> Agent type: **${jsonConfig.type}**`);
4816
+ lines.push(i18n.t("export.agentType", { type: jsonConfig.type }));
2516
4817
  lines.push("");
2517
4818
  lines.push(this.getAgentTypeDescription(jsonConfig.type));
2518
4819
  lines.push("");
2519
- lines.push("## Instructions");
4820
+ lines.push(i18n.t("export.instructions"));
2520
4821
  lines.push("");
2521
4822
  lines.push(spec.instructions);
2522
4823
  lines.push("");
2523
4824
  if (spec.tools.length > 0) {
2524
- lines.push("## Tools");
4825
+ lines.push(i18n.t("export.tools"));
2525
4826
  lines.push("");
2526
4827
  for (const tool3 of spec.tools) {
2527
- const approval = tool3.requiresApproval ? " *(requires approval)*" : "";
2528
- const safe = tool3.automationSafe === false ? " *(not automation safe)*" : "";
4828
+ const approval = tool3.requiresApproval ? ` ${i18n.t("export.requiresApprovalMd")}` : "";
4829
+ const safe = tool3.automationSafe === false ? ` ${i18n.t("export.notAutomationSafeMd")}` : "";
2529
4830
  lines.push(`### ${tool3.name}${approval}${safe}`);
2530
4831
  lines.push("");
2531
4832
  if (tool3.description) {
@@ -2533,7 +4834,7 @@ class OpenCodeExporter {
2533
4834
  lines.push("");
2534
4835
  }
2535
4836
  if (tool3.schema && options.includeComments !== false) {
2536
- lines.push("**Parameters:**");
4837
+ lines.push(i18n.t("export.parameters"));
2537
4838
  lines.push("");
2538
4839
  lines.push("```json");
2539
4840
  lines.push(JSON.stringify(tool3.schema, null, options.prettyPrint !== false ? 2 : 0));
@@ -2543,10 +4844,10 @@ class OpenCodeExporter {
2543
4844
  }
2544
4845
  }
2545
4846
  if (spec.knowledge && spec.knowledge.length > 0) {
2546
- lines.push("## Knowledge Sources");
4847
+ lines.push(i18n.t("export.knowledgeSources"));
2547
4848
  lines.push("");
2548
4849
  for (const k of spec.knowledge) {
2549
- const required = k.required ? "(required)" : "(optional)";
4850
+ const required = k.required ? i18n.t("export.required") : i18n.t("export.optional");
2550
4851
  lines.push(`- **${k.key}** ${required}`);
2551
4852
  if (k.instructions) {
2552
4853
  lines.push(` - ${k.instructions}`);
@@ -2555,17 +4856,17 @@ class OpenCodeExporter {
2555
4856
  lines.push("");
2556
4857
  }
2557
4858
  if (spec.policy) {
2558
- lines.push("## Policy");
4859
+ lines.push(i18n.t("export.policy"));
2559
4860
  lines.push("");
2560
4861
  if (spec.policy.confidence?.min) {
2561
- lines.push(`- Minimum confidence: ${spec.policy.confidence.min}`);
4862
+ lines.push(i18n.t("export.minConfidence", { min: spec.policy.confidence.min }));
2562
4863
  }
2563
4864
  if (spec.policy.escalation) {
2564
- lines.push("- Escalation policy configured");
4865
+ lines.push(i18n.t("export.escalationPolicyConfigured"));
2565
4866
  }
2566
4867
  lines.push("");
2567
4868
  }
2568
- lines.push("## Configuration");
4869
+ lines.push(i18n.t("export.configuration"));
2569
4870
  lines.push("");
2570
4871
  lines.push("```json");
2571
4872
  lines.push(JSON.stringify(jsonConfig.config, null, options.prettyPrint !== false ? 2 : 0));
@@ -2573,21 +4874,22 @@ class OpenCodeExporter {
2573
4874
  lines.push("");
2574
4875
  lines.push("---");
2575
4876
  lines.push("");
2576
- lines.push(`*Generated from ContractSpec: ${agentKey(spec.meta)}*`);
2577
- lines.push(`*Exported at: ${new Date().toISOString()}*`);
4877
+ lines.push(i18n.t("export.generatedFrom", { key: agentKey(spec.meta) }));
4878
+ lines.push(i18n.t("export.exportedAt", { date: new Date().toISOString() }));
2578
4879
  return lines.join(`
2579
4880
  `);
2580
4881
  }
2581
4882
  getAgentTypeDescription(type) {
4883
+ const i18n = getDefaultI18n();
2582
4884
  switch (type) {
2583
4885
  case "build":
2584
- return "Primary agent with full tool access for code generation and modification.";
4886
+ return i18n.t("export.agentType.build");
2585
4887
  case "plan":
2586
- return "Restricted agent for analysis and planning. File edits and bash commands require approval.";
4888
+ return i18n.t("export.agentType.plan");
2587
4889
  case "general":
2588
- return "General-purpose subagent for complex questions and multi-step tasks.";
4890
+ return i18n.t("export.agentType.general");
2589
4891
  case "explore":
2590
- return "Fast subagent optimized for codebase exploration and pattern searching.";
4892
+ return i18n.t("export.agentType.explore");
2591
4893
  default:
2592
4894
  return "";
2593
4895
  }
@@ -2612,6 +4914,7 @@ function validateForOpenCode(spec) {
2612
4914
  return exporter.validate(spec);
2613
4915
  }
2614
4916
  // src/spec/registry.ts
4917
+ init_i18n();
2615
4918
  import { compareVersions } from "compare-versions";
2616
4919
  import { SpecContractRegistry } from "@contractspec/lib.contracts/registry";
2617
4920
 
@@ -2629,7 +4932,9 @@ class AgentRegistry extends SpecContractRegistry {
2629
4932
  require(name, version) {
2630
4933
  const spec = this.get(name, version);
2631
4934
  if (!spec) {
2632
- throw new Error(`Agent spec not found for ${name}${version != null ? `.v${version}` : ""}`);
4935
+ throw new Error(getDefaultI18n().t("error.agentSpecNotFound", {
4936
+ name: `${name}${version != null ? `.v${version}` : ""}`
4937
+ }));
2633
4938
  }
2634
4939
  return spec;
2635
4940
  }
@@ -2649,6 +4954,9 @@ class AgentRegistry extends SpecContractRegistry {
2649
4954
  function createAgentRegistry() {
2650
4955
  return new AgentRegistry;
2651
4956
  }
4957
+
4958
+ // src/spec/index.ts
4959
+ init_spec();
2652
4960
  // src/tools/mcp-client.ts
2653
4961
  import { experimental_createMCPClient } from "@ai-sdk/mcp";
2654
4962
  import { Experimental_StdioMCPTransport as StdioClientTransport } from "@ai-sdk/mcp/mcp-stdio";
@@ -2681,18 +4989,20 @@ async function createMcpToolsets(configs) {
2681
4989
 
2682
4990
  // src/tools/mcp-server.ts
2683
4991
  init_json_schema_to_zod();
4992
+ init_i18n();
2684
4993
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2685
4994
  import * as z4 from "zod";
2686
4995
  function agentToMcpServer(agent, spec2) {
4996
+ const i18n = createAgentI18n();
2687
4997
  const server = new McpServer({
2688
4998
  name: spec2.meta.key,
2689
4999
  version: `${spec2.meta.version}`
2690
5000
  });
2691
5001
  server.registerTool(spec2.meta.key, {
2692
- description: spec2.description ?? `Interact with ${spec2.meta.key} agent`,
5002
+ description: spec2.description ?? i18n.t("tool.mcp.agentDescription", { key: spec2.meta.key }),
2693
5003
  inputSchema: z4.object({
2694
- message: z4.string().describe("The message or query to send to the agent"),
2695
- sessionId: z4.string().optional().describe("Optional session ID to continue a conversation")
5004
+ message: z4.string().describe(i18n.t("tool.mcp.param.message")),
5005
+ sessionId: z4.string().optional().describe(i18n.t("tool.mcp.param.sessionId"))
2696
5006
  })
2697
5007
  }, async (args) => {
2698
5008
  const { message, sessionId } = args;
@@ -2712,11 +5022,14 @@ function agentToMcpServer(agent, spec2) {
2712
5022
  for (const toolConfig of spec2.tools) {
2713
5023
  const inputSchema = toolConfig.schema ? jsonSchemaToZodSafe(toolConfig.schema) : z4.object({});
2714
5024
  server.registerTool(`${spec2.meta.key}.${toolConfig.name}`, {
2715
- description: toolConfig.description ?? `Execute ${toolConfig.name} tool`,
5025
+ description: toolConfig.description ?? i18n.t("tool.mcp.toolDescription", { name: toolConfig.name }),
2716
5026
  inputSchema
2717
5027
  }, async (args) => {
2718
5028
  const result = await agent.generate({
2719
- prompt: `Execute the ${toolConfig.name} tool with the following arguments: ${JSON.stringify(args)}`
5029
+ prompt: i18n.t("tool.mcp.executePrompt", {
5030
+ name: toolConfig.name,
5031
+ args: JSON.stringify(args)
5032
+ })
2720
5033
  });
2721
5034
  return {
2722
5035
  content: [
@@ -2776,11 +5089,15 @@ var SchemaOutput = {
2776
5089
 
2777
5090
  // src/schema/index.ts
2778
5091
  init_json_schema_to_zod();
5092
+
5093
+ // src/knowledge/index.ts
5094
+ init_injector();
2779
5095
  // src/telemetry/index.ts
2780
5096
  init_adapter();
2781
5097
 
2782
5098
  // src/providers/registry.ts
2783
5099
  init_types();
5100
+ init_i18n();
2784
5101
 
2785
5102
  class InMemoryProviderRegistry {
2786
5103
  providers = new Map;
@@ -2800,10 +5117,10 @@ class InMemoryProviderRegistry {
2800
5117
  require(name) {
2801
5118
  const provider = this.providers.get(name);
2802
5119
  if (!provider) {
2803
- throw new ProviderNotAvailableError(name, "not registered");
5120
+ throw new ProviderNotAvailableError(name, getDefaultI18n().t("error.provider.notRegistered"));
2804
5121
  }
2805
5122
  if (!provider.isAvailable()) {
2806
- throw new ProviderNotAvailableError(name, "dependencies not installed or not configured");
5123
+ throw new ProviderNotAvailableError(name, getDefaultI18n().t("error.provider.depsNotInstalled"));
2807
5124
  }
2808
5125
  return provider;
2809
5126
  }
@@ -2821,6 +5138,9 @@ init_claude_agent_sdk();
2821
5138
  init_opencode_sdk();
2822
5139
  init_types();
2823
5140
  // src/interop/spec-consumer.ts
5141
+ init_spec();
5142
+ init_i18n();
5143
+
2824
5144
  class ContractSpecConsumer {
2825
5145
  specs;
2826
5146
  includeMetadata;
@@ -2837,8 +5157,9 @@ class ContractSpecConsumer {
2837
5157
  getSpecMarkdown(specKey, options) {
2838
5158
  const spec2 = this.specs.get(specKey);
2839
5159
  if (!spec2) {
2840
- throw new Error(`Spec not found: ${specKey}`);
5160
+ throw new Error(getDefaultI18n().t("error.specNotFound", { specKey }));
2841
5161
  }
5162
+ const i18n = getDefaultI18n();
2842
5163
  const sections = [];
2843
5164
  const opts = {
2844
5165
  includeToc: options?.includeToc ?? true,
@@ -2857,7 +5178,7 @@ class ContractSpecConsumer {
2857
5178
  sections.push("");
2858
5179
  }
2859
5180
  if (opts.includeToc) {
2860
- sections.push("## Table of Contents");
5181
+ sections.push(i18n.t("interop.md.toc"));
2861
5182
  sections.push("");
2862
5183
  sections.push("- [Overview](#overview)");
2863
5184
  sections.push("- [Instructions](#instructions)");
@@ -2869,28 +5190,32 @@ class ContractSpecConsumer {
2869
5190
  }
2870
5191
  sections.push("");
2871
5192
  }
2872
- sections.push("## Overview");
5193
+ sections.push(i18n.t("interop.md.overview"));
2873
5194
  sections.push("");
2874
5195
  if (this.includeMetadata) {
2875
- sections.push(`- **Key**: \`${spec2.meta.key}\``);
2876
- sections.push(`- **Version**: ${spec2.meta.version}`);
5196
+ sections.push(i18n.t("interop.md.metaKey", { key: spec2.meta.key }));
5197
+ sections.push(i18n.t("interop.md.metaVersion", { version: spec2.meta.version }));
2877
5198
  if (spec2.meta.stability) {
2878
- sections.push(`- **Stability**: ${spec2.meta.stability}`);
5199
+ sections.push(i18n.t("interop.md.metaStability", {
5200
+ stability: spec2.meta.stability
5201
+ }));
2879
5202
  }
2880
5203
  if (spec2.meta.owners && spec2.meta.owners.length > 0) {
2881
- sections.push(`- **Owners**: ${spec2.meta.owners.join(", ")}`);
5204
+ sections.push(i18n.t("interop.md.metaOwners", {
5205
+ owners: spec2.meta.owners.join(", ")
5206
+ }));
2882
5207
  }
2883
5208
  if (spec2.tags && spec2.tags.length > 0) {
2884
- sections.push(`- **Tags**: ${spec2.tags.join(", ")}`);
5209
+ sections.push(i18n.t("interop.md.metaTags", { tags: spec2.tags.join(", ") }));
2885
5210
  }
2886
5211
  }
2887
5212
  sections.push("");
2888
- sections.push("## Instructions");
5213
+ sections.push(i18n.t("interop.prompt.instructions"));
2889
5214
  sections.push("");
2890
5215
  sections.push(spec2.instructions);
2891
5216
  sections.push("");
2892
5217
  if (opts.includeTools && spec2.tools && spec2.tools.length > 0) {
2893
- sections.push("## Tools");
5218
+ sections.push(i18n.t("interop.md.tools"));
2894
5219
  sections.push("");
2895
5220
  for (const tool3 of spec2.tools) {
2896
5221
  sections.push(`### ${tool3.name}`);
@@ -2900,7 +5225,7 @@ class ContractSpecConsumer {
2900
5225
  sections.push("");
2901
5226
  }
2902
5227
  if (tool3.schema) {
2903
- sections.push("**Schema:**");
5228
+ sections.push(i18n.t("interop.md.schema"));
2904
5229
  sections.push("");
2905
5230
  sections.push("```json");
2906
5231
  sections.push(JSON.stringify(tool3.schema, null, 2));
@@ -2908,16 +5233,19 @@ class ContractSpecConsumer {
2908
5233
  sections.push("");
2909
5234
  }
2910
5235
  if (tool3.automationSafe !== undefined) {
2911
- sections.push(`**Automation Safe**: ${tool3.automationSafe ? "Yes" : "No"}`);
5236
+ sections.push(i18n.t("interop.md.automationSafe", {
5237
+ value: tool3.automationSafe ? i18n.t("interop.md.yes") : i18n.t("interop.md.no")
5238
+ }));
2912
5239
  sections.push("");
2913
5240
  }
2914
5241
  }
2915
5242
  }
2916
5243
  if (spec2.knowledge && spec2.knowledge.length > 0) {
2917
- sections.push("## Knowledge");
5244
+ sections.push(i18n.t("interop.md.knowledge"));
2918
5245
  sections.push("");
2919
5246
  for (const k of spec2.knowledge) {
2920
- sections.push(`- **${k.key}**${k.required ? " (required)" : ""}`);
5247
+ const marker = k.required ? ` ${i18n.t("interop.md.required")}` : "";
5248
+ sections.push(`- **${k.key}**${marker}`);
2921
5249
  if (k.instructions) {
2922
5250
  sections.push(` - ${k.instructions}`);
2923
5251
  }
@@ -2925,21 +5253,25 @@ class ContractSpecConsumer {
2925
5253
  sections.push("");
2926
5254
  }
2927
5255
  if (spec2.policy) {
2928
- sections.push("## Policy");
5256
+ sections.push(i18n.t("interop.md.policy"));
2929
5257
  sections.push("");
2930
5258
  if (spec2.policy.confidence) {
2931
- sections.push(`- **Minimum Confidence**: ${spec2.policy.confidence.min ?? 0.7}`);
5259
+ sections.push(i18n.t("interop.md.minConfidence", {
5260
+ min: spec2.policy.confidence.min ?? 0.7
5261
+ }));
2932
5262
  }
2933
5263
  if (spec2.policy.escalation) {
2934
5264
  const esc = spec2.policy.escalation;
2935
5265
  if (esc.confidenceThreshold) {
2936
- sections.push(`- **Escalation Threshold**: ${esc.confidenceThreshold}`);
5266
+ sections.push(i18n.t("interop.md.escalationThreshold", {
5267
+ threshold: esc.confidenceThreshold
5268
+ }));
2937
5269
  }
2938
5270
  if (esc.onToolFailure) {
2939
- sections.push("- **Escalate on Tool Failure**: Yes");
5271
+ sections.push(i18n.t("interop.md.escalateToolFailure"));
2940
5272
  }
2941
5273
  if (esc.onTimeout) {
2942
- sections.push("- **Escalate on Timeout**: Yes");
5274
+ sections.push(i18n.t("interop.md.escalateTimeout"));
2943
5275
  }
2944
5276
  }
2945
5277
  sections.push("");
@@ -2950,32 +5282,36 @@ class ContractSpecConsumer {
2950
5282
  getSpecPrompt(specKey, options) {
2951
5283
  const spec2 = this.specs.get(specKey);
2952
5284
  if (!spec2) {
2953
- throw new Error(`Spec not found: ${specKey}`);
5285
+ throw new Error(getDefaultI18n().t("error.specNotFound", { specKey }));
2954
5286
  }
5287
+ const i18n = getDefaultI18n();
2955
5288
  const sections = [];
2956
5289
  const opts = {
2957
5290
  includeTools: options?.includeTools ?? true,
2958
5291
  format: options?.format ?? "structured",
2959
5292
  ...options
2960
5293
  };
2961
- sections.push("# Agent Identity");
5294
+ sections.push(i18n.t("interop.prompt.agentIdentity"));
2962
5295
  sections.push("");
2963
- sections.push(`You are ${spec2.meta.key} (v${spec2.meta.version}).`);
5296
+ sections.push(i18n.t("interop.prompt.youAre", {
5297
+ key: spec2.meta.key,
5298
+ version: spec2.meta.version
5299
+ }));
2964
5300
  sections.push("");
2965
5301
  if (spec2.description) {
2966
- sections.push("## Description");
5302
+ sections.push(i18n.t("interop.prompt.description"));
2967
5303
  sections.push("");
2968
5304
  sections.push(spec2.description);
2969
5305
  sections.push("");
2970
5306
  }
2971
- sections.push("## Instructions");
5307
+ sections.push(i18n.t("interop.prompt.instructions"));
2972
5308
  sections.push("");
2973
5309
  sections.push(spec2.instructions);
2974
5310
  sections.push("");
2975
5311
  if (opts.includeTools && spec2.tools && spec2.tools.length > 0) {
2976
- sections.push("## Available Tools");
5312
+ sections.push(i18n.t("interop.prompt.availableTools"));
2977
5313
  sections.push("");
2978
- sections.push("You have access to the following tools:");
5314
+ sections.push(i18n.t("interop.prompt.toolsIntro"));
2979
5315
  sections.push("");
2980
5316
  for (const tool3 of spec2.tools) {
2981
5317
  sections.push(`### ${tool3.name}`);
@@ -2985,7 +5321,7 @@ class ContractSpecConsumer {
2985
5321
  sections.push("");
2986
5322
  }
2987
5323
  if (tool3.schema && opts.format === "structured") {
2988
- sections.push("Parameters:");
5324
+ sections.push(i18n.t("interop.prompt.parameters"));
2989
5325
  sections.push("```json");
2990
5326
  sections.push(JSON.stringify(tool3.schema, null, 2));
2991
5327
  sections.push("```");
@@ -2996,7 +5332,7 @@ class ContractSpecConsumer {
2996
5332
  if (spec2.knowledge && spec2.knowledge.length > 0) {
2997
5333
  const requiredKnowledge = spec2.knowledge.filter((k) => k.required);
2998
5334
  if (requiredKnowledge.length > 0) {
2999
- sections.push("## Knowledge Context");
5335
+ sections.push(i18n.t("interop.prompt.knowledgeContext"));
3000
5336
  sections.push("");
3001
5337
  for (const k of requiredKnowledge) {
3002
5338
  if (k.instructions) {
@@ -3007,7 +5343,7 @@ class ContractSpecConsumer {
3007
5343
  }
3008
5344
  }
3009
5345
  if (options?.customContext) {
3010
- sections.push("## Additional Context");
5346
+ sections.push(i18n.t("interop.prompt.additionalContext"));
3011
5347
  sections.push("");
3012
5348
  sections.push(options.customContext);
3013
5349
  sections.push("");
@@ -3083,6 +5419,10 @@ function createSingleSpecConsumer(spec2, options) {
3083
5419
  }
3084
5420
 
3085
5421
  // src/interop/tool-consumer.ts
5422
+ init_tool_bridge();
5423
+ init_tool_bridge2();
5424
+ init_i18n();
5425
+
3086
5426
  class MCPToolServer {
3087
5427
  tools;
3088
5428
  name;
@@ -3101,14 +5441,18 @@ class MCPToolServer {
3101
5441
  return;
3102
5442
  }
3103
5443
  this.running = true;
3104
- console.log(`[MCPToolServer] Started ${this.name}@${this.version} with ${this.tools.size} tools`);
5444
+ console.log(getDefaultI18n().t("log.mcpServer.started", {
5445
+ name: this.name,
5446
+ version: this.version,
5447
+ count: this.tools.size
5448
+ }));
3105
5449
  }
3106
5450
  async stop() {
3107
5451
  if (!this.running) {
3108
5452
  return;
3109
5453
  }
3110
5454
  this.running = false;
3111
- console.log(`[MCPToolServer] Stopped ${this.name}`);
5455
+ console.log(getDefaultI18n().t("log.mcpServer.stopped", { name: this.name }));
3112
5456
  }
3113
5457
  isRunning() {
3114
5458
  return this.running;
@@ -3119,10 +5463,10 @@ class MCPToolServer {
3119
5463
  async executeTool(toolName, args, context) {
3120
5464
  const tool3 = this.tools.get(toolName);
3121
5465
  if (!tool3) {
3122
- throw new Error(`Tool not found: ${toolName}`);
5466
+ throw new Error(getDefaultI18n().t("error.toolNotFound", { name: toolName }));
3123
5467
  }
3124
5468
  if (!tool3.handler) {
3125
- throw new Error(`No handler registered for tool: ${toolName}`);
5469
+ throw new Error(getDefaultI18n().t("error.noHandlerForTool", { name: toolName }));
3126
5470
  }
3127
5471
  const fullContext = {
3128
5472
  agentId: context?.agentId ?? "mcp-server",
@@ -3199,7 +5543,7 @@ class ContractSpecToolConsumer {
3199
5543
  }
3200
5544
  }));
3201
5545
  default:
3202
- throw new Error(`Unknown export format: ${format}`);
5546
+ throw new Error(getDefaultI18n().t("error.unknownExportFormat", { format }));
3203
5547
  }
3204
5548
  }
3205
5549
  createBridgedHandler(toolName, _format) {
@@ -3228,10 +5572,10 @@ class ContractSpecToolConsumer {
3228
5572
  async executeTool(name, args, context) {
3229
5573
  const tool3 = this.tools.get(name);
3230
5574
  if (!tool3) {
3231
- throw new Error(`Tool not found: ${name}`);
5575
+ throw new Error(getDefaultI18n().t("error.toolNotFound", { name }));
3232
5576
  }
3233
5577
  if (!tool3.handler) {
3234
- throw new Error(`No handler for tool: ${name}`);
5578
+ throw new Error(getDefaultI18n().t("error.noToolHandler", { name }));
3235
5579
  }
3236
5580
  const fullContext = {
3237
5581
  agentId: context?.agentId ?? "consumer",
@@ -3266,6 +5610,7 @@ function exportToolsForExternalSDK(tools, format) {
3266
5610
  return consumer.exportToolsForSDK(format);
3267
5611
  }
3268
5612
  // src/index.ts
5613
+ init_i18n();
3269
5614
  import { Experimental_Agent } from "ai";
3270
5615
  export {
3271
5616
  zodToOutput,
@@ -3275,22 +5620,29 @@ export {
3275
5620
  textOutput,
3276
5621
  specToolsToAISDKTools,
3277
5622
  specToolToAISDKTool,
5623
+ resolveLocale,
5624
+ resetI18nRegistry,
3278
5625
  noopTelemetryCollector,
3279
5626
  mcpServerToTools,
3280
5627
  jsonSchemaToZodSafe,
3281
5628
  jsonSchemaToZod,
3282
5629
  jsonSchemaToOutput,
3283
5630
  jsonSchemaToArrayOutput,
5631
+ isSupportedLocale,
3284
5632
  injectStaticKnowledge,
5633
+ getDefaultI18n,
3285
5634
  getAvailableBackends,
3286
5635
  generateSessionId,
3287
5636
  generateOpenCodeMarkdown,
3288
5637
  generateOpenCodeJSON,
3289
5638
  generateClaudeMd,
5639
+ frMessages,
3290
5640
  exportToolsForExternalSDK,
3291
5641
  exportToOpenCode,
3292
5642
  exportToClaudeAgent,
5643
+ esMessages,
3293
5644
  enumToChoiceOutput,
5645
+ enMessages,
3294
5646
  defineAgent,
3295
5647
  defaultProviderRegistry,
3296
5648
  createUnifiedAgent,
@@ -3300,38 +5652,55 @@ export {
3300
5652
  createSpecConsumer,
3301
5653
  createSingleSpecConsumer,
3302
5654
  createProviderRegistry,
5655
+ createPostHogTracedModel,
5656
+ createPostHogTelemetryCollector,
3303
5657
  createOpenCodeSDKAgent,
3304
5658
  createMcpToolsets,
3305
5659
  createKnowledgeQueryTool,
3306
5660
  createKnowledgeInjector,
3307
5661
  createInMemoryTelemetryCollector,
3308
5662
  createInMemorySessionStore,
5663
+ createCompositeTelemetryCollector,
3309
5664
  createClaudeAgentSDKAgent,
3310
5665
  createApprovalWorkflow,
3311
5666
  createAgentRegistry,
3312
5667
  createAgentMcpServer,
3313
5668
  createAgentJsonRunner,
5669
+ createAgentI18n,
3314
5670
  createAISDKAgent,
3315
5671
  buildToolHandlers,
3316
5672
  agentToMcpServer,
3317
5673
  agentKey,
3318
5674
  UnifiedAgent,
3319
5675
  Experimental_Agent as ToolLoopAgent,
5676
+ TOOL_KEYS,
3320
5677
  SchemaOutput,
5678
+ SUPPORTED_LOCALES,
3321
5679
  ProviderNotAvailableError,
3322
5680
  ProviderExecutionError,
5681
+ PostHogTelemetryCollector,
3323
5682
  OpenCodeSDKProvider,
3324
5683
  OpenCodeExporter,
5684
+ LOG_KEYS,
5685
+ KNOWLEDGE_KEYS,
3325
5686
  InMemoryTelemetryCollector,
3326
5687
  InMemorySessionStore,
3327
5688
  InMemoryApprovalStore,
5689
+ INTEROP_KEYS,
5690
+ I18N_KEYS,
3328
5691
  ExternalProviderError,
5692
+ EXPORT_KEYS,
5693
+ ERROR_KEYS,
5694
+ DEFAULT_LOCALE,
3329
5695
  ContractSpecToolConsumer,
3330
5696
  ContractSpecConsumer,
3331
5697
  ContractSpecAgent,
3332
5698
  ContextCreationError,
5699
+ CompositeTelemetryCollector,
3333
5700
  ClaudeAgentSDKProvider,
3334
5701
  ClaudeAgentExporter,
3335
5702
  ApprovalWorkflow,
3336
- AgentRegistry
5703
+ AgentRegistry,
5704
+ APPROVAL_KEYS,
5705
+ AGENT_KEYS
3337
5706
  };