@contractspec/lib.ai-agent 1.61.0 → 2.0.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 (207) hide show
  1. package/dist/agent/agent-factory.d.ts +5 -1
  2. package/dist/agent/agent-factory.js +2293 -31
  3. package/dist/agent/agent.test.d.ts +0 -1
  4. package/dist/agent/contract-spec-agent.d.ts +6 -1
  5. package/dist/agent/contract-spec-agent.js +2292 -31
  6. package/dist/agent/index.d.ts +0 -1
  7. package/dist/agent/index.js +2408 -91
  8. package/dist/agent/json-runner.d.ts +1 -1
  9. package/dist/agent/json-runner.js +2326 -57
  10. package/dist/agent/json-runner.test.d.ts +0 -1
  11. package/dist/agent/unified-agent.d.ts +0 -1
  12. package/dist/agent/unified-agent.js +2374 -65
  13. package/dist/approval/index.d.ts +0 -1
  14. package/dist/approval/index.js +2122 -2
  15. package/dist/approval/workflow.d.ts +7 -2
  16. package/dist/approval/workflow.js +2122 -2
  17. package/dist/exporters/claude-agent-exporter.d.ts +0 -1
  18. package/dist/exporters/claude-agent-exporter.js +2144 -35
  19. package/dist/exporters/index.d.ts +0 -1
  20. package/dist/exporters/index.js +2193 -69
  21. package/dist/exporters/opencode-exporter.d.ts +0 -1
  22. package/dist/exporters/opencode-exporter.js +2152 -39
  23. package/dist/exporters/types.d.ts +0 -1
  24. package/dist/i18n/catalogs/en.d.ts +8 -0
  25. package/dist/i18n/catalogs/en.js +614 -0
  26. package/dist/i18n/catalogs/es.d.ts +8 -0
  27. package/dist/i18n/catalogs/es.js +663 -0
  28. package/dist/i18n/catalogs/fr.d.ts +8 -0
  29. package/dist/i18n/catalogs/fr.js +629 -0
  30. package/dist/i18n/catalogs/index.d.ts +8 -0
  31. package/dist/i18n/catalogs/index.js +1875 -0
  32. package/dist/i18n/i18n.test.d.ts +1 -0
  33. package/dist/i18n/index.d.ts +29 -0
  34. package/dist/i18n/index.js +2127 -0
  35. package/dist/i18n/keys.d.ts +552 -0
  36. package/dist/i18n/keys.js +188 -0
  37. package/dist/i18n/locale.d.ts +33 -0
  38. package/dist/i18n/locale.js +41 -0
  39. package/dist/i18n/messages.d.ts +65 -0
  40. package/dist/i18n/messages.js +1939 -0
  41. package/dist/index.d.ts +0 -13
  42. package/dist/index.js +2106 -3254
  43. package/dist/interop/index.d.ts +0 -1
  44. package/dist/interop/index.js +2182 -47
  45. package/dist/interop/spec-consumer.d.ts +0 -1
  46. package/dist/interop/spec-consumer.js +2151 -34
  47. package/dist/interop/tool-consumer.d.ts +0 -1
  48. package/dist/interop/tool-consumer.js +2122 -13
  49. package/dist/interop/types.d.ts +0 -1
  50. package/dist/knowledge/index.d.ts +0 -1
  51. package/dist/knowledge/index.js +2105 -7
  52. package/dist/knowledge/injector.d.ts +2 -3
  53. package/dist/knowledge/injector.js +2104 -7
  54. package/dist/memory/in-memory.d.ts +0 -1
  55. package/dist/memory/index.d.ts +0 -1
  56. package/dist/memory/manager.d.ts +0 -1
  57. package/dist/memory/memory.test.d.ts +0 -1
  58. package/dist/node/agent/agent-factory.js +2293 -31
  59. package/dist/node/agent/contract-spec-agent.js +2292 -31
  60. package/dist/node/agent/index.js +2408 -91
  61. package/dist/node/agent/json-runner.js +2326 -57
  62. package/dist/node/agent/unified-agent.js +2374 -65
  63. package/dist/node/approval/index.js +2122 -2
  64. package/dist/node/approval/workflow.js +2122 -2
  65. package/dist/node/exporters/claude-agent-exporter.js +2144 -35
  66. package/dist/node/exporters/index.js +2193 -69
  67. package/dist/node/exporters/opencode-exporter.js +2152 -39
  68. package/dist/node/i18n/catalogs/en.js +614 -0
  69. package/dist/node/i18n/catalogs/es.js +663 -0
  70. package/dist/node/i18n/catalogs/fr.js +629 -0
  71. package/dist/node/i18n/catalogs/index.js +1875 -0
  72. package/dist/node/i18n/index.js +2127 -0
  73. package/dist/node/i18n/keys.js +188 -0
  74. package/dist/node/i18n/locale.js +41 -0
  75. package/dist/node/i18n/messages.js +1939 -0
  76. package/dist/node/index.js +2106 -3254
  77. package/dist/node/interop/index.js +2182 -47
  78. package/dist/node/interop/spec-consumer.js +2151 -34
  79. package/dist/node/interop/tool-consumer.js +2122 -13
  80. package/dist/node/knowledge/index.js +2105 -7
  81. package/dist/node/knowledge/injector.js +2104 -7
  82. package/dist/node/providers/claude-agent-sdk/adapter.js +2143 -22
  83. package/dist/node/providers/claude-agent-sdk/index.js +2144 -22
  84. package/dist/node/providers/claude-agent-sdk/tool-bridge.js +2101 -3
  85. package/dist/node/providers/index.js +2182 -39
  86. package/dist/node/providers/opencode-sdk/adapter.js +2148 -27
  87. package/dist/node/providers/opencode-sdk/agent-bridge.js +2110 -10
  88. package/dist/node/providers/opencode-sdk/index.js +2149 -27
  89. package/dist/node/providers/opencode-sdk/tool-bridge.js +2101 -3
  90. package/dist/node/providers/registry.js +2094 -2
  91. package/dist/node/session/index.js +37 -2
  92. package/dist/node/session/store.js +37 -2
  93. package/dist/node/spec/index.js +2111 -7
  94. package/dist/node/spec/registry.js +2096 -2
  95. package/dist/node/spec/spec.js +2105 -5
  96. package/dist/node/telemetry/index.js +117 -1
  97. package/dist/node/telemetry/posthog-types.js +0 -0
  98. package/dist/node/telemetry/posthog.js +132 -0
  99. package/dist/node/tools/index.js +2117 -17
  100. package/dist/node/tools/knowledge-tool.js +2105 -11
  101. package/dist/node/tools/mcp-server.js +2101 -5
  102. package/dist/node/tools/tool-adapter.js +2093 -1
  103. package/dist/providers/claude-agent-sdk/adapter.d.ts +0 -1
  104. package/dist/providers/claude-agent-sdk/adapter.js +2143 -22
  105. package/dist/providers/claude-agent-sdk/index.d.ts +0 -1
  106. package/dist/providers/claude-agent-sdk/index.js +2144 -22
  107. package/dist/providers/claude-agent-sdk/session-bridge.d.ts +0 -1
  108. package/dist/providers/claude-agent-sdk/tool-bridge.d.ts +0 -1
  109. package/dist/providers/claude-agent-sdk/tool-bridge.js +2101 -3
  110. package/dist/providers/index.d.ts +0 -1
  111. package/dist/providers/index.js +2182 -39
  112. package/dist/providers/opencode-sdk/adapter.d.ts +0 -1
  113. package/dist/providers/opencode-sdk/adapter.js +2148 -27
  114. package/dist/providers/opencode-sdk/agent-bridge.d.ts +0 -1
  115. package/dist/providers/opencode-sdk/agent-bridge.js +2110 -10
  116. package/dist/providers/opencode-sdk/index.d.ts +0 -1
  117. package/dist/providers/opencode-sdk/index.js +2149 -27
  118. package/dist/providers/opencode-sdk/tool-bridge.d.ts +0 -1
  119. package/dist/providers/opencode-sdk/tool-bridge.js +2101 -3
  120. package/dist/providers/registry.d.ts +0 -1
  121. package/dist/providers/registry.js +2094 -2
  122. package/dist/providers/types.d.ts +0 -1
  123. package/dist/schema/index.d.ts +0 -1
  124. package/dist/schema/json-schema-to-zod.d.ts +0 -1
  125. package/dist/schema/schema-output.d.ts +0 -1
  126. package/dist/session/index.d.ts +0 -1
  127. package/dist/session/index.js +37 -2
  128. package/dist/session/store.d.ts +12 -2
  129. package/dist/session/store.js +37 -2
  130. package/dist/spec/index.d.ts +0 -1
  131. package/dist/spec/index.js +2111 -7
  132. package/dist/spec/registry.d.ts +1 -2
  133. package/dist/spec/registry.js +2096 -2
  134. package/dist/spec/spec.d.ts +5 -4
  135. package/dist/spec/spec.js +2105 -5
  136. package/dist/telemetry/adapter.d.ts +0 -1
  137. package/dist/telemetry/index.d.ts +2 -1
  138. package/dist/telemetry/index.js +117 -1
  139. package/dist/telemetry/posthog-types.d.ts +59 -0
  140. package/dist/telemetry/posthog-types.js +1 -0
  141. package/dist/telemetry/posthog.d.ts +80 -0
  142. package/dist/telemetry/posthog.js +132 -0
  143. package/dist/telemetry/posthog.test.d.ts +1 -0
  144. package/dist/tools/index.d.ts +0 -1
  145. package/dist/tools/index.js +2117 -17
  146. package/dist/tools/knowledge-tool.d.ts +1 -2
  147. package/dist/tools/knowledge-tool.js +2105 -11
  148. package/dist/tools/mcp-client.d.ts +0 -1
  149. package/dist/tools/mcp-server.d.ts +0 -1
  150. package/dist/tools/mcp-server.js +2101 -5
  151. package/dist/tools/tool-adapter.d.ts +0 -1
  152. package/dist/tools/tool-adapter.js +2093 -1
  153. package/dist/tools/tools.test.d.ts +0 -1
  154. package/dist/types.d.ts +4 -1
  155. package/package.json +166 -13
  156. package/dist/agent/agent-factory.d.ts.map +0 -1
  157. package/dist/agent/agent.test.d.ts.map +0 -1
  158. package/dist/agent/contract-spec-agent.d.ts.map +0 -1
  159. package/dist/agent/index.d.ts.map +0 -1
  160. package/dist/agent/json-runner.d.ts.map +0 -1
  161. package/dist/agent/json-runner.test.d.ts.map +0 -1
  162. package/dist/agent/unified-agent.d.ts.map +0 -1
  163. package/dist/approval/index.d.ts.map +0 -1
  164. package/dist/approval/workflow.d.ts.map +0 -1
  165. package/dist/exporters/claude-agent-exporter.d.ts.map +0 -1
  166. package/dist/exporters/index.d.ts.map +0 -1
  167. package/dist/exporters/opencode-exporter.d.ts.map +0 -1
  168. package/dist/exporters/types.d.ts.map +0 -1
  169. package/dist/index.d.ts.map +0 -1
  170. package/dist/interop/index.d.ts.map +0 -1
  171. package/dist/interop/spec-consumer.d.ts.map +0 -1
  172. package/dist/interop/tool-consumer.d.ts.map +0 -1
  173. package/dist/interop/types.d.ts.map +0 -1
  174. package/dist/knowledge/index.d.ts.map +0 -1
  175. package/dist/knowledge/injector.d.ts.map +0 -1
  176. package/dist/memory/in-memory.d.ts.map +0 -1
  177. package/dist/memory/index.d.ts.map +0 -1
  178. package/dist/memory/manager.d.ts.map +0 -1
  179. package/dist/memory/memory.test.d.ts.map +0 -1
  180. package/dist/providers/claude-agent-sdk/adapter.d.ts.map +0 -1
  181. package/dist/providers/claude-agent-sdk/index.d.ts.map +0 -1
  182. package/dist/providers/claude-agent-sdk/session-bridge.d.ts.map +0 -1
  183. package/dist/providers/claude-agent-sdk/tool-bridge.d.ts.map +0 -1
  184. package/dist/providers/index.d.ts.map +0 -1
  185. package/dist/providers/opencode-sdk/adapter.d.ts.map +0 -1
  186. package/dist/providers/opencode-sdk/agent-bridge.d.ts.map +0 -1
  187. package/dist/providers/opencode-sdk/index.d.ts.map +0 -1
  188. package/dist/providers/opencode-sdk/tool-bridge.d.ts.map +0 -1
  189. package/dist/providers/registry.d.ts.map +0 -1
  190. package/dist/providers/types.d.ts.map +0 -1
  191. package/dist/schema/index.d.ts.map +0 -1
  192. package/dist/schema/json-schema-to-zod.d.ts.map +0 -1
  193. package/dist/schema/schema-output.d.ts.map +0 -1
  194. package/dist/session/index.d.ts.map +0 -1
  195. package/dist/session/store.d.ts.map +0 -1
  196. package/dist/spec/index.d.ts.map +0 -1
  197. package/dist/spec/registry.d.ts.map +0 -1
  198. package/dist/spec/spec.d.ts.map +0 -1
  199. package/dist/telemetry/adapter.d.ts.map +0 -1
  200. package/dist/telemetry/index.d.ts.map +0 -1
  201. package/dist/tools/index.d.ts.map +0 -1
  202. package/dist/tools/knowledge-tool.d.ts.map +0 -1
  203. package/dist/tools/mcp-client.d.ts.map +0 -1
  204. package/dist/tools/mcp-server.d.ts.map +0 -1
  205. package/dist/tools/tool-adapter.d.ts.map +0 -1
  206. package/dist/tools/tools.test.d.ts.map +0 -1
  207. package/dist/types.d.ts.map +0 -1
@@ -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-spec/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-spec/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-spec/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-spec/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,21 +2416,33 @@ ${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 {
326
2432
  sessions = new Map;
2433
+ maxSessions;
2434
+ maxMessagesPerSession;
2435
+ maxStepsPerSession;
2436
+ constructor(options = {}) {
2437
+ this.maxSessions = options.maxSessions ?? 500;
2438
+ this.maxMessagesPerSession = options.maxMessagesPerSession ?? 200;
2439
+ this.maxStepsPerSession = options.maxStepsPerSession ?? 200;
2440
+ }
327
2441
  async get(sessionId) {
328
2442
  return this.sessions.get(sessionId) ?? null;
329
2443
  }
330
2444
  async create(session) {
2445
+ this.evictIfNeeded();
331
2446
  const now = new Date;
332
2447
  const fullSession = {
333
2448
  ...session,
@@ -341,6 +2456,7 @@ class InMemorySessionStore {
341
2456
  const session = this.sessions.get(sessionId);
342
2457
  if (session) {
343
2458
  session.steps.push(step);
2459
+ this.trimArray(session.steps, this.maxStepsPerSession);
344
2460
  session.updatedAt = new Date;
345
2461
  }
346
2462
  }
@@ -348,6 +2464,7 @@ class InMemorySessionStore {
348
2464
  const session = this.sessions.get(sessionId);
349
2465
  if (session) {
350
2466
  session.messages.push(message);
2467
+ this.trimArray(session.messages, this.maxMessagesPerSession);
351
2468
  session.updatedAt = new Date;
352
2469
  }
353
2470
  }
@@ -385,9 +2502,33 @@ class InMemorySessionStore {
385
2502
  clear() {
386
2503
  this.sessions.clear();
387
2504
  }
2505
+ evictIfNeeded() {
2506
+ if (this.sessions.size < this.maxSessions) {
2507
+ return;
2508
+ }
2509
+ let oldestSessionId = null;
2510
+ let oldestUpdatedAt = Number.POSITIVE_INFINITY;
2511
+ for (const [sessionId, session] of this.sessions.entries()) {
2512
+ const updatedAt = session.updatedAt.getTime();
2513
+ if (updatedAt < oldestUpdatedAt) {
2514
+ oldestUpdatedAt = updatedAt;
2515
+ oldestSessionId = sessionId;
2516
+ }
2517
+ }
2518
+ if (oldestSessionId) {
2519
+ this.sessions.delete(oldestSessionId);
2520
+ }
2521
+ }
2522
+ trimArray(items, maxItems) {
2523
+ if (items.length <= maxItems) {
2524
+ return;
2525
+ }
2526
+ const overflow = items.length - maxItems;
2527
+ items.splice(0, overflow);
2528
+ }
388
2529
  }
389
- function createInMemorySessionStore() {
390
- return new InMemorySessionStore;
2530
+ function createInMemorySessionStore(options) {
2531
+ return new InMemorySessionStore(options);
391
2532
  }
392
2533
  function generateSessionId() {
393
2534
  return `sess_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;
@@ -457,6 +2598,118 @@ var init_adapter = __esm(() => {
457
2598
  };
458
2599
  });
459
2600
 
2601
+ // src/telemetry/posthog.ts
2602
+ var exports_posthog = {};
2603
+ __export(exports_posthog, {
2604
+ createPostHogTracedModel: () => createPostHogTracedModel,
2605
+ createPostHogTelemetryCollector: () => createPostHogTelemetryCollector,
2606
+ createCompositeTelemetryCollector: () => createCompositeTelemetryCollector,
2607
+ PostHogTelemetryCollector: () => PostHogTelemetryCollector,
2608
+ CompositeTelemetryCollector: () => CompositeTelemetryCollector
2609
+ });
2610
+ async function createPostHogTracedModel(model, config, overrides) {
2611
+ const { withTracing } = await importPostHogAI();
2612
+ const phClient = await resolvePostHogClient(config);
2613
+ const tracingOptions = {
2614
+ ...config.defaults,
2615
+ ...overrides
2616
+ };
2617
+ return withTracing(model, phClient, tracingOptions);
2618
+ }
2619
+
2620
+ class PostHogTelemetryCollector {
2621
+ phClient;
2622
+ config;
2623
+ initPromise;
2624
+ constructor(config) {
2625
+ this.config = config;
2626
+ this.phClient = config.client;
2627
+ }
2628
+ async collect(sample) {
2629
+ const client = await this.getClient();
2630
+ const distinctId = this.config.defaults?.posthogDistinctId ?? sample.metadata?.["actorId"] ?? "system";
2631
+ client.capture({
2632
+ distinctId,
2633
+ event: "$ai_generation",
2634
+ properties: {
2635
+ $ai_model: sample.operation.name,
2636
+ $ai_provider: "contractspec",
2637
+ $ai_latency: sample.durationMs / 1000,
2638
+ $ai_is_error: !sample.success,
2639
+ $ai_trace_id: this.config.defaults?.posthogTraceId,
2640
+ ...sample.metadata?.["tokenUsage"] ? mapTokenUsage(sample.metadata["tokenUsage"]) : {},
2641
+ ...this.config.defaults?.posthogProperties,
2642
+ contractspec_operation: sample.operation.name,
2643
+ contractspec_version: sample.operation.version,
2644
+ contractspec_agent_id: sample.metadata?.["agentId"],
2645
+ contractspec_finish_reason: sample.metadata?.["finishReason"],
2646
+ contractspec_tool_count: sample.metadata?.["toolCallCount"]
2647
+ },
2648
+ groups: this.config.defaults?.posthogGroups
2649
+ });
2650
+ }
2651
+ async shutdown() {
2652
+ if (this.phClient?.shutdown) {
2653
+ await this.phClient.shutdown();
2654
+ }
2655
+ }
2656
+ async getClient() {
2657
+ if (this.phClient)
2658
+ return this.phClient;
2659
+ if (!this.initPromise) {
2660
+ this.initPromise = resolvePostHogClient(this.config).then((client) => {
2661
+ this.phClient = client;
2662
+ return client;
2663
+ });
2664
+ }
2665
+ return this.initPromise;
2666
+ }
2667
+ }
2668
+ function createPostHogTelemetryCollector(config) {
2669
+ return new PostHogTelemetryCollector(config);
2670
+ }
2671
+
2672
+ class CompositeTelemetryCollector {
2673
+ collectors;
2674
+ constructor(collectors) {
2675
+ this.collectors = collectors;
2676
+ }
2677
+ async collect(sample) {
2678
+ await Promise.all(this.collectors.map((c) => c.collect(sample)));
2679
+ }
2680
+ }
2681
+ function createCompositeTelemetryCollector(collectors) {
2682
+ return new CompositeTelemetryCollector(collectors);
2683
+ }
2684
+ async function importPostHogAI() {
2685
+ try {
2686
+ return await import("@posthog/ai");
2687
+ } catch {
2688
+ throw new Error("PostHog LLM Analytics requires @posthog/ai to be installed. Run: npm install @posthog/ai posthog-node");
2689
+ }
2690
+ }
2691
+ async function resolvePostHogClient(config) {
2692
+ if (config.client)
2693
+ return config.client;
2694
+ if (!config.apiKey) {
2695
+ throw new Error("PostHog LLM Analytics requires either a client instance or an apiKey.");
2696
+ }
2697
+ try {
2698
+ const { PostHog } = await import("posthog-node");
2699
+ return new PostHog(config.apiKey, {
2700
+ host: config.host ?? "https://us.i.posthog.com"
2701
+ });
2702
+ } catch {
2703
+ throw new Error("PostHog LLM Analytics requires posthog-node to be installed. Run: npm install posthog-node");
2704
+ }
2705
+ }
2706
+ function mapTokenUsage(usage) {
2707
+ return {
2708
+ $ai_input_tokens: usage["promptTokens"],
2709
+ $ai_output_tokens: usage["completionTokens"]
2710
+ };
2711
+ }
2712
+
460
2713
  // src/agent/contract-spec-agent.ts
461
2714
  var exports_contract_spec_agent = {};
462
2715
  __export(exports_contract_spec_agent, {
@@ -494,15 +2747,21 @@ class ContractSpecAgent {
494
2747
  });
495
2748
  }
496
2749
  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;
2750
+ let effectiveConfig = config;
2751
+ if (config.posthogConfig) {
2752
+ const { createPostHogTracedModel: createPostHogTracedModel2 } = await Promise.resolve().then(() => exports_posthog);
2753
+ const tracedModel = await createPostHogTracedModel2(config.model, config.posthogConfig, config.posthogConfig.tracingOptions);
2754
+ effectiveConfig = { ...config, model: tracedModel };
2755
+ }
2756
+ const instructions = await injectStaticKnowledge(effectiveConfig.spec.instructions, effectiveConfig.spec.knowledge ?? [], effectiveConfig.knowledgeRetriever);
2757
+ const specTools = specToolsToAISDKTools(effectiveConfig.spec.tools, effectiveConfig.toolHandlers, { agentId: agentKey(effectiveConfig.spec.meta) });
2758
+ const knowledgeTool = effectiveConfig.knowledgeRetriever ? createKnowledgeQueryTool(effectiveConfig.knowledgeRetriever, effectiveConfig.spec.knowledge ?? []) : null;
500
2759
  const tools = {
501
2760
  ...specTools,
502
2761
  ...knowledgeTool ? { query_knowledge: knowledgeTool } : {},
503
- ...config.additionalTools ?? {}
2762
+ ...effectiveConfig.additionalTools ?? {}
504
2763
  };
505
- return new ContractSpecAgent(config, instructions, tools);
2764
+ return new ContractSpecAgent(effectiveConfig, instructions, tools);
506
2765
  }
507
2766
  async generate(params) {
508
2767
  const sessionId = params.options?.sessionId ?? generateSessionId();
@@ -590,8 +2849,10 @@ ${params.prompt}` : params.prompt;
590
2849
  }
591
2850
  var ContractSpecCallOptionsSchema;
592
2851
  var init_contract_spec_agent = __esm(() => {
2852
+ init_spec();
593
2853
  init_tool_adapter();
594
2854
  init_knowledge_tool();
2855
+ init_injector();
595
2856
  init_adapter();
596
2857
  ContractSpecCallOptionsSchema = z3.object({
597
2858
  tenantId: z3.string().optional(),
@@ -640,7 +2901,7 @@ var init_types = __esm(() => {
640
2901
  function specToolToClaudeAgentTool(tool3, handler, context) {
641
2902
  return {
642
2903
  name: tool3.name,
643
- description: tool3.description ?? `Execute ${tool3.name}`,
2904
+ description: tool3.description ?? getDefaultI18n().t("tool.fallbackDescription", { name: tool3.name }),
644
2905
  input_schema: normalizeSchema(tool3.schema),
645
2906
  requires_confirmation: tool3.requiresApproval ?? !tool3.automationSafe,
646
2907
  execute: async (input) => {
@@ -660,7 +2921,9 @@ function specToolsToClaudeAgentTools(tools, handlers, context) {
660
2921
  return tools.filter((tool3) => handlers.has(tool3.name)).map((tool3) => {
661
2922
  const handler = handlers.get(tool3.name);
662
2923
  if (!handler) {
663
- throw new Error(`Handler not found for tool ${tool3.name}`);
2924
+ throw new Error(getDefaultI18n().t("error.handlerNotFoundForTool", {
2925
+ name: tool3.name
2926
+ }));
664
2927
  }
665
2928
  return specToolToClaudeAgentTool(tool3, handler, context);
666
2929
  });
@@ -691,7 +2954,7 @@ function claudeAgentToolsToSpecTools(claudeTools) {
691
2954
  function specToolToExternalTool(tool3, handler, context) {
692
2955
  return {
693
2956
  name: tool3.name,
694
- description: tool3.description ?? `Execute ${tool3.name}`,
2957
+ description: tool3.description ?? getDefaultI18n().t("tool.fallbackDescription", { name: tool3.name }),
695
2958
  inputSchema: tool3.schema ?? { type: "object" },
696
2959
  requiresApproval: tool3.requiresApproval ?? !tool3.automationSafe,
697
2960
  execute: handler ? async (input) => {
@@ -732,6 +2995,9 @@ function extractToolCalls(response) {
732
2995
  args: block.input
733
2996
  }));
734
2997
  }
2998
+ var init_tool_bridge = __esm(() => {
2999
+ init_i18n();
3000
+ });
735
3001
 
736
3002
  // src/providers/claude-agent-sdk/session-bridge.ts
737
3003
  function toClaudeAgentSession(state) {
@@ -884,7 +3150,7 @@ class ClaudeAgentSDKProvider {
884
3150
  }
885
3151
  async createContext(spec) {
886
3152
  if (!this.isAvailable()) {
887
- throw new ProviderNotAvailableError(this.name, "SDK not installed or API key not configured");
3153
+ throw new ProviderNotAvailableError(this.name, getDefaultI18n().t("error.provider.sdkNotConfigured"));
888
3154
  }
889
3155
  try {
890
3156
  const toolSet = {};
@@ -909,7 +3175,9 @@ class ClaudeAgentSDKProvider {
909
3175
  cleanup: async () => {}
910
3176
  };
911
3177
  } catch (error) {
912
- throw new ContextCreationError(this.name, `Failed to create context: ${error instanceof Error ? error.message : String(error)}`, error instanceof Error ? error : undefined);
3178
+ throw new ContextCreationError(this.name, getDefaultI18n().t("error.provider.contextCreation", {
3179
+ error: error instanceof Error ? error.message : String(error)
3180
+ }), error instanceof Error ? error : undefined);
913
3181
  }
914
3182
  }
915
3183
  async execute(context, params) {
@@ -965,7 +3233,9 @@ ${params.systemOverride}` : context.spec.instructions;
965
3233
  }
966
3234
  };
967
3235
  } catch (error) {
968
- throw new ProviderExecutionError(this.name, `Execution failed: ${error instanceof Error ? error.message : String(error)}`, error instanceof Error ? error : undefined);
3236
+ throw new ProviderExecutionError(this.name, getDefaultI18n().t("error.provider.executionFailed", {
3237
+ error: error instanceof Error ? error.message : String(error)
3238
+ }), error instanceof Error ? error : undefined);
969
3239
  }
970
3240
  }
971
3241
  async* stream(context, params) {
@@ -1045,7 +3315,9 @@ ${params.systemOverride}` : context.spec.instructions;
1045
3315
  }
1046
3316
  };
1047
3317
  } catch (error) {
1048
- throw new ProviderExecutionError(this.name, `Stream failed: ${error instanceof Error ? error.message : String(error)}`, error instanceof Error ? error : undefined);
3318
+ throw new ProviderExecutionError(this.name, getDefaultI18n().t("error.provider.streamFailed", {
3319
+ error: error instanceof Error ? error.message : String(error)
3320
+ }), error instanceof Error ? error : undefined);
1049
3321
  }
1050
3322
  }
1051
3323
  async loadSDK() {
@@ -1053,7 +3325,7 @@ ${params.systemOverride}` : context.spec.instructions;
1053
3325
  const module = __require("@anthropic-ai/claude-agent-sdk");
1054
3326
  return module.default ?? module;
1055
3327
  } catch {
1056
- throw new ProviderNotAvailableError(this.name, "@anthropic-ai/claude-agent-sdk is not installed");
3328
+ throw new ProviderNotAvailableError(this.name, getDefaultI18n().t("error.provider.claudeSdkMissing"));
1057
3329
  }
1058
3330
  }
1059
3331
  prepareToolsForSDK(context, params) {
@@ -1063,7 +3335,9 @@ ${params.systemOverride}` : context.spec.instructions;
1063
3335
  if (externalTool?.execute) {
1064
3336
  handlers.set(tool3.name, async (input) => {
1065
3337
  if (!externalTool.execute) {
1066
- throw new Error(`Tool ${tool3.name} has no execute handler`);
3338
+ throw new Error(getDefaultI18n().t("error.toolNoExecuteHandler", {
3339
+ name: tool3.name
3340
+ }));
1067
3341
  }
1068
3342
  const result = await externalTool.execute(input);
1069
3343
  return typeof result === "string" ? result : JSON.stringify(result);
@@ -1085,7 +3359,9 @@ ${params.systemOverride}` : context.spec.instructions;
1085
3359
  return {
1086
3360
  toolCallId: toolCall.toolCallId,
1087
3361
  toolName: toolCall.toolName,
1088
- output: `Error: Tool '${toolCall.toolName}' not found or has no handler`
3362
+ output: getDefaultI18n().t("error.toolNotFoundOrNoHandler", {
3363
+ name: toolCall.toolName
3364
+ })
1089
3365
  };
1090
3366
  }
1091
3367
  try {
@@ -1127,7 +3403,11 @@ ${params.systemOverride}` : context.spec.instructions;
1127
3403
  }
1128
3404
  }
1129
3405
  var init_adapter2 = __esm(() => {
3406
+ init_spec();
1130
3407
  init_types();
3408
+ init_tool_bridge();
3409
+ init_injector();
3410
+ init_i18n();
1131
3411
  });
1132
3412
 
1133
3413
  // src/providers/claude-agent-sdk/index.ts
@@ -1157,13 +3437,14 @@ __export(exports_claude_agent_sdk, {
1157
3437
  });
1158
3438
  var init_claude_agent_sdk = __esm(() => {
1159
3439
  init_adapter2();
3440
+ init_tool_bridge();
1160
3441
  });
1161
3442
 
1162
3443
  // src/providers/opencode-sdk/tool-bridge.ts
1163
3444
  function specToolToOpenCodeTool(tool3) {
1164
3445
  return {
1165
3446
  name: tool3.name,
1166
- description: tool3.description ?? `Execute ${tool3.name}`,
3447
+ description: tool3.description ?? getDefaultI18n().t("tool.fallbackDescription", { name: tool3.name }),
1167
3448
  parameters: normalizeToOpenCodeParameters(tool3.schema),
1168
3449
  permission: getPermissionLevel(tool3)
1169
3450
  };
@@ -1195,7 +3476,7 @@ function openCodeToolsToSpecTools(openCodeTools) {
1195
3476
  function specToolToExternalToolForOpenCode(tool3, handler, context) {
1196
3477
  return {
1197
3478
  name: tool3.name,
1198
- description: tool3.description ?? `Execute ${tool3.name}`,
3479
+ description: tool3.description ?? getDefaultI18n().t("tool.fallbackDescription", { name: tool3.name }),
1199
3480
  inputSchema: tool3.schema ?? { type: "object" },
1200
3481
  requiresApproval: tool3.requiresApproval ?? !tool3.automationSafe,
1201
3482
  execute: handler ? async (input) => {
@@ -1259,7 +3540,9 @@ async function executeToolCall(toolCall, handlers) {
1259
3540
  if (!handler) {
1260
3541
  return {
1261
3542
  tool_call_id: toolCall.id,
1262
- output: `Error: Tool '${toolCall.name}' not found`,
3543
+ output: getDefaultI18n().t("error.toolNotFoundOrNoHandler", {
3544
+ name: toolCall.name
3545
+ }),
1263
3546
  is_error: true
1264
3547
  };
1265
3548
  }
@@ -1277,6 +3560,9 @@ async function executeToolCall(toolCall, handlers) {
1277
3560
  };
1278
3561
  }
1279
3562
  }
3563
+ var init_tool_bridge2 = __esm(() => {
3564
+ init_i18n();
3565
+ });
1280
3566
 
1281
3567
  // src/providers/opencode-sdk/agent-bridge.ts
1282
3568
  function inferAgentType(spec) {
@@ -1351,6 +3637,7 @@ function specToOpenCodeMarkdown(spec, options) {
1351
3637
  };
1352
3638
  }
1353
3639
  function buildMarkdownBody(spec) {
3640
+ const i18n = getDefaultI18n();
1354
3641
  const lines = [];
1355
3642
  lines.push(`# ${spec.meta.key}`);
1356
3643
  lines.push("");
@@ -1358,24 +3645,24 @@ function buildMarkdownBody(spec) {
1358
3645
  lines.push(spec.description ?? spec.meta.description ?? "");
1359
3646
  lines.push("");
1360
3647
  }
1361
- lines.push("## Instructions");
3648
+ lines.push(i18n.t("export.instructions"));
1362
3649
  lines.push("");
1363
3650
  lines.push(spec.instructions);
1364
3651
  lines.push("");
1365
3652
  if (spec.tools.length > 0) {
1366
- lines.push("## Tools");
3653
+ lines.push(i18n.t("export.tools"));
1367
3654
  lines.push("");
1368
3655
  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());
3656
+ const permission = tool3.requiresApproval ? i18n.t("export.bridge.requiresApproval") : tool3.automationSafe === false ? i18n.t("export.bridge.askMode") : "";
3657
+ lines.push(`- **${tool3.name}**: ${tool3.description ?? i18n.t("export.noDescription")} ${permission}`.trim());
1371
3658
  }
1372
3659
  lines.push("");
1373
3660
  }
1374
3661
  if (spec.knowledge && spec.knowledge.length > 0) {
1375
- lines.push("## Knowledge Sources");
3662
+ lines.push(i18n.t("export.knowledgeSources"));
1376
3663
  lines.push("");
1377
3664
  for (const k of spec.knowledge) {
1378
- const required = k.required ? "(required)" : "(optional)";
3665
+ const required = k.required ? i18n.t("export.required") : i18n.t("export.optional");
1379
3666
  lines.push(`- ${k.key} ${required}`);
1380
3667
  }
1381
3668
  lines.push("");
@@ -1434,7 +3721,10 @@ function openCodeConfigToSpec(config) {
1434
3721
  maxSteps: config.config?.max_steps ?? 10
1435
3722
  };
1436
3723
  }
1437
- var init_agent_bridge = () => {};
3724
+ var init_agent_bridge = __esm(() => {
3725
+ init_tool_bridge2();
3726
+ init_i18n();
3727
+ });
1438
3728
 
1439
3729
  // src/providers/opencode-sdk/adapter.ts
1440
3730
  class OpenCodeSDKProvider {
@@ -1469,7 +3759,7 @@ class OpenCodeSDKProvider {
1469
3759
  }
1470
3760
  async createContext(spec) {
1471
3761
  if (!this.isAvailable()) {
1472
- throw new ProviderNotAvailableError(this.name, "SDK not installed");
3762
+ throw new ProviderNotAvailableError(this.name, getDefaultI18n().t("error.provider.sdkNotInstalled"));
1473
3763
  }
1474
3764
  try {
1475
3765
  const sdk = await this.loadSDK();
@@ -1508,7 +3798,9 @@ class OpenCodeSDKProvider {
1508
3798
  }
1509
3799
  };
1510
3800
  } catch (error) {
1511
- throw new ContextCreationError(this.name, `Failed to create context: ${error instanceof Error ? error.message : String(error)}`, error instanceof Error ? error : undefined);
3801
+ throw new ContextCreationError(this.name, getDefaultI18n().t("error.provider.contextCreation", {
3802
+ error: error instanceof Error ? error.message : String(error)
3803
+ }), error instanceof Error ? error : undefined);
1512
3804
  }
1513
3805
  }
1514
3806
  async execute(context, params) {
@@ -1556,7 +3848,9 @@ ${params.systemOverride}` : context.spec.instructions;
1556
3848
  }
1557
3849
  };
1558
3850
  } catch (error) {
1559
- throw new ProviderExecutionError(this.name, `Execution failed: ${error instanceof Error ? error.message : String(error)}`, error instanceof Error ? error : undefined);
3851
+ throw new ProviderExecutionError(this.name, getDefaultI18n().t("error.provider.executionFailed", {
3852
+ error: error instanceof Error ? error.message : String(error)
3853
+ }), error instanceof Error ? error : undefined);
1560
3854
  }
1561
3855
  }
1562
3856
  async* stream(context, params) {
@@ -1642,7 +3936,9 @@ ${params.systemOverride}` : context.spec.instructions;
1642
3936
  }
1643
3937
  };
1644
3938
  } catch (error) {
1645
- throw new ProviderExecutionError(this.name, `Stream failed: ${error instanceof Error ? error.message : String(error)}`, error instanceof Error ? error : undefined);
3939
+ throw new ProviderExecutionError(this.name, getDefaultI18n().t("error.provider.streamFailed", {
3940
+ error: error instanceof Error ? error.message : String(error)
3941
+ }), error instanceof Error ? error : undefined);
1646
3942
  }
1647
3943
  }
1648
3944
  async loadSDK() {
@@ -1650,7 +3946,7 @@ ${params.systemOverride}` : context.spec.instructions;
1650
3946
  const module = __require("@opencode-ai/sdk");
1651
3947
  return module;
1652
3948
  } catch {
1653
- throw new ProviderNotAvailableError(this.name, "@opencode-ai/sdk is not installed");
3949
+ throw new ProviderNotAvailableError(this.name, getDefaultI18n().t("error.provider.opencodeSdkMissing"));
1654
3950
  }
1655
3951
  }
1656
3952
  getHostname() {
@@ -1694,8 +3990,12 @@ ${params.systemOverride}` : context.spec.instructions;
1694
3990
  }
1695
3991
  }
1696
3992
  var init_adapter3 = __esm(() => {
3993
+ init_spec();
1697
3994
  init_types();
3995
+ init_tool_bridge2();
1698
3996
  init_agent_bridge();
3997
+ init_injector();
3998
+ init_i18n();
1699
3999
  });
1700
4000
 
1701
4001
  // src/providers/opencode-sdk/index.ts
@@ -1717,11 +4017,12 @@ __export(exports_opencode_sdk, {
1717
4017
  });
1718
4018
  var init_opencode_sdk = __esm(() => {
1719
4019
  init_adapter3();
4020
+ init_tool_bridge2();
1720
4021
  init_agent_bridge();
1721
4022
  });
1722
4023
 
1723
4024
  // src/agent/unified-agent.ts
1724
- import { createProvider } from "@contractspec/lib.ai-providers/factory";
4025
+ init_i18n();
1725
4026
 
1726
4027
  class UnifiedAgent {
1727
4028
  spec;
@@ -1754,12 +4055,17 @@ class UnifiedAgent {
1754
4055
  await this.initializeOpenCodeSDK();
1755
4056
  break;
1756
4057
  default:
1757
- throw new Error(`Unknown backend: ${backend}`);
4058
+ throw new Error(getDefaultI18n().t("error.unknownBackend", {
4059
+ backend: String(backend)
4060
+ }));
1758
4061
  }
1759
4062
  } catch (error) {
1760
4063
  this.state.lastError = error instanceof Error ? error : new Error(String(error));
1761
4064
  if (this.config.fallbackBackend && this.config.fallbackBackend !== backend) {
1762
- console.warn(`[UnifiedAgent] ${backend} failed, falling back to ${this.config.fallbackBackend}`);
4065
+ console.warn(getDefaultI18n().t("log.unifiedAgent.fallback", {
4066
+ backend: String(backend),
4067
+ fallback: String(this.config.fallbackBackend)
4068
+ }));
1763
4069
  this.state.backend = this.config.fallbackBackend;
1764
4070
  await this.initialize();
1765
4071
  } else {
@@ -1773,13 +4079,13 @@ class UnifiedAgent {
1773
4079
  const config = this.config.config;
1774
4080
  this.provider = new ClaudeAgentSDKProvider2(config ?? {});
1775
4081
  if (!this.provider.isAvailable()) {
1776
- throw new Error("Claude Agent SDK not available. Install @anthropic-ai/claude-agent-sdk");
4082
+ throw new Error(getDefaultI18n().t("error.claudeSdk.notAvailable"));
1777
4083
  }
1778
4084
  this.context = await this.provider.createContext(this.spec);
1779
4085
  this.state.isReady = true;
1780
4086
  } catch (error) {
1781
4087
  if (error.code === "MODULE_NOT_FOUND") {
1782
- throw new Error("Claude Agent SDK not installed. Run: npm install @anthropic-ai/claude-agent-sdk");
4088
+ throw new Error(getDefaultI18n().t("error.claudeSdk.notInstalled"));
1783
4089
  }
1784
4090
  throw error;
1785
4091
  }
@@ -1790,13 +4096,13 @@ class UnifiedAgent {
1790
4096
  const config = this.config.config;
1791
4097
  this.provider = new OpenCodeSDKProvider2(config ?? {});
1792
4098
  if (!this.provider.isAvailable()) {
1793
- throw new Error("OpenCode SDK not available. Install @opencode-ai/sdk");
4099
+ throw new Error(getDefaultI18n().t("error.opencodeSdk.notAvailable"));
1794
4100
  }
1795
4101
  this.context = await this.provider.createContext(this.spec);
1796
4102
  this.state.isReady = true;
1797
4103
  } catch (error) {
1798
4104
  if (error.code === "MODULE_NOT_FOUND") {
1799
- throw new Error("OpenCode SDK not installed. Run: npm install @opencode-ai/sdk");
4105
+ throw new Error(getDefaultI18n().t("error.opencodeSdk.notInstalled"));
1800
4106
  }
1801
4107
  throw error;
1802
4108
  }
@@ -1815,7 +4121,9 @@ class UnifiedAgent {
1815
4121
  case "opencode-sdk":
1816
4122
  return await this.runWithExternalProvider(message, options);
1817
4123
  default:
1818
- throw new Error(`Unknown backend: ${backend}`);
4124
+ throw new Error(getDefaultI18n().t("error.unknownBackend", {
4125
+ backend: String(backend)
4126
+ }));
1819
4127
  }
1820
4128
  } catch (error) {
1821
4129
  this.state.lastError = error instanceof Error ? error : new Error(String(error));
@@ -1837,7 +4145,7 @@ class UnifiedAgent {
1837
4145
  }
1838
4146
  async runWithExternalProvider(message, options) {
1839
4147
  if (!this.provider || !this.context) {
1840
- throw new Error("Provider not initialized");
4148
+ throw new Error(getDefaultI18n().t("error.providerNotInitialized"));
1841
4149
  }
1842
4150
  const result = await this.provider.execute(this.context, {
1843
4151
  prompt: message,
@@ -1880,6 +4188,7 @@ class UnifiedAgent {
1880
4188
  if (backendConfig?.modelInstance) {
1881
4189
  model = backendConfig.modelInstance;
1882
4190
  } else if (backendConfig?.provider) {
4191
+ const { createProvider } = await import("@contractspec/lib.ai-providers/factory");
1883
4192
  model = createProvider(backendConfig.provider).getModel();
1884
4193
  } else {
1885
4194
  const { anthropic } = await import("@ai-sdk/anthropic");