@frihet/mcp-server 1.16.6 → 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 (108) hide show
  1. package/README.md +168 -82
  2. package/dist/agent-onboarding.d.ts +98 -0
  3. package/dist/agent-onboarding.js +275 -0
  4. package/dist/api-origin.d.ts +9 -0
  5. package/dist/api-origin.js +41 -0
  6. package/dist/canary/mcp-harness.d.ts +77 -0
  7. package/dist/canary/mcp-harness.js +552 -0
  8. package/dist/capability-truth.d.ts +29 -0
  9. package/dist/capability-truth.js +262 -0
  10. package/dist/claude-candidate-contract.d.ts +482 -0
  11. package/dist/claude-candidate-contract.js +87 -0
  12. package/dist/claude-output-privacy.d.ts +17 -0
  13. package/dist/claude-output-privacy.js +240 -0
  14. package/dist/claude-profile.d.ts +18 -0
  15. package/dist/claude-profile.js +260 -0
  16. package/dist/client-interface.d.ts +47 -33
  17. package/dist/client.d.ts +172 -40
  18. package/dist/client.js +708 -165
  19. package/dist/demo-client.d.ts +41 -32
  20. package/dist/demo-client.js +202 -31
  21. package/dist/demo-fixtures.d.ts +3 -3
  22. package/dist/demo-fixtures.js +7 -7
  23. package/dist/deposit-contract.d.ts +29 -0
  24. package/dist/deposit-contract.js +76 -0
  25. package/dist/fetch-no-redirect.d.ts +3 -0
  26. package/dist/fetch-no-redirect.js +16 -0
  27. package/dist/fiscal-aliases.d.ts +44 -0
  28. package/dist/fiscal-aliases.js +62 -0
  29. package/dist/fiscal-period.d.ts +26 -0
  30. package/dist/fiscal-period.js +31 -0
  31. package/dist/google-profile.d.ts +19 -0
  32. package/dist/google-profile.js +122 -0
  33. package/dist/index.js +68 -59
  34. package/dist/logger.d.ts +2 -2
  35. package/dist/logger.js +140 -8
  36. package/dist/muse-profile.d.ts +19 -0
  37. package/dist/muse-profile.js +122 -0
  38. package/dist/observability.d.ts +18 -29
  39. package/dist/observability.js +194 -106
  40. package/dist/openai-profile.d.ts +26 -22
  41. package/dist/openai-profile.js +1193 -157
  42. package/dist/openai-review-contract.d.ts +15 -6
  43. package/dist/openai-review-contract.js +714 -41
  44. package/dist/openai-review-oauth.d.ts +149 -2
  45. package/dist/openai-review-oauth.js +220 -6
  46. package/dist/prompts/register-all.d.ts +2 -0
  47. package/dist/prompts/register-all.js +34 -78
  48. package/dist/public-capability-contract.d.ts +39 -0
  49. package/dist/public-capability-contract.js +186 -0
  50. package/dist/redaction.d.ts +15 -0
  51. package/dist/redaction.js +83 -0
  52. package/dist/resources/register-all.js +154 -64
  53. package/dist/retry-after.d.ts +19 -0
  54. package/dist/retry-after.js +84 -0
  55. package/dist/server-composition.d.ts +19 -0
  56. package/dist/server-composition.js +74 -0
  57. package/dist/tool-exposure.d.ts +31 -27
  58. package/dist/tool-exposure.js +211 -87
  59. package/dist/tools/accountingClose.d.ts +14 -5
  60. package/dist/tools/accountingClose.js +41 -23
  61. package/dist/tools/audit_gl.js +8 -8
  62. package/dist/tools/backend-availability.d.ts +8 -29
  63. package/dist/tools/backend-availability.js +31 -30
  64. package/dist/tools/bank_rules.js +66 -15
  65. package/dist/tools/banking.js +5 -13
  66. package/dist/tools/clients.js +261 -15
  67. package/dist/tools/crm.js +22 -21
  68. package/dist/tools/deposits.js +114 -85
  69. package/dist/tools/einvoice.d.ts +16 -2
  70. package/dist/tools/einvoice.js +59 -12
  71. package/dist/tools/expenses.d.ts +16 -0
  72. package/dist/tools/expenses.js +47 -27
  73. package/dist/tools/fiscal.d.ts +3 -4
  74. package/dist/tools/fiscal.js +93 -60
  75. package/dist/tools/gestoria.js +15 -7
  76. package/dist/tools/hr.d.ts +2 -3
  77. package/dist/tools/hr.js +49 -20
  78. package/dist/tools/igic.d.ts +9 -8
  79. package/dist/tools/igic.js +34 -64
  80. package/dist/tools/impuesto_sociedades.d.ts +4 -5
  81. package/dist/tools/impuesto_sociedades.js +16 -37
  82. package/dist/tools/intelligence.js +166 -12
  83. package/dist/tools/invoices.js +224 -54
  84. package/dist/tools/kitchen.js +19 -9
  85. package/dist/tools/payroll.d.ts +5 -8
  86. package/dist/tools/payroll.js +19 -32
  87. package/dist/tools/permissions.d.ts +4 -7
  88. package/dist/tools/permissions.js +11 -14
  89. package/dist/tools/products.js +6 -6
  90. package/dist/tools/quotes.js +172 -26
  91. package/dist/tools/recurring.js +26 -25
  92. package/dist/tools/register-all.d.ts +2 -2
  93. package/dist/tools/register-all.js +9 -6
  94. package/dist/tools/search.d.ts +19 -0
  95. package/dist/tools/search.js +84 -0
  96. package/dist/tools/shared.d.ts +1445 -109
  97. package/dist/tools/shared.js +478 -102
  98. package/dist/tools/team.js +24 -28
  99. package/dist/tools/time.js +4 -12
  100. package/dist/tools/vendors.js +249 -15
  101. package/dist/tools/webhooks.js +35 -30
  102. package/dist/types.d.ts +31 -5
  103. package/dist/workflows/daily-operational-brief.d.ts +163 -0
  104. package/dist/workflows/daily-operational-brief.js +881 -0
  105. package/docs/agent-onboarding.json +391 -0
  106. package/package.json +49 -12
  107. package/dist/tools/onboarding.d.ts +0 -19
  108. package/dist/tools/onboarding.js +0 -64
@@ -0,0 +1,482 @@
1
+ declare function captureSurface(local: boolean, grouped: boolean): Promise<{
2
+ groups?: {} | undefined;
3
+ tools: {
4
+ inputSchema: {
5
+ [x: string]: unknown;
6
+ type: "object";
7
+ properties?: Record<string, object> | undefined;
8
+ required?: string[] | undefined;
9
+ };
10
+ name: string;
11
+ description?: string | undefined;
12
+ outputSchema?: {
13
+ [x: string]: unknown;
14
+ type: "object";
15
+ properties?: Record<string, object> | undefined;
16
+ required?: string[] | undefined;
17
+ } | undefined;
18
+ annotations?: {
19
+ title?: string | undefined;
20
+ readOnlyHint?: boolean | undefined;
21
+ destructiveHint?: boolean | undefined;
22
+ idempotentHint?: boolean | undefined;
23
+ openWorldHint?: boolean | undefined;
24
+ } | undefined;
25
+ execution?: {
26
+ taskSupport?: "optional" | "required" | "forbidden" | undefined;
27
+ } | undefined;
28
+ _meta?: Record<string, unknown> | undefined;
29
+ icons?: {
30
+ src: string;
31
+ mimeType?: string | undefined;
32
+ sizes?: string[] | undefined;
33
+ theme?: "light" | "dark" | undefined;
34
+ }[] | undefined;
35
+ title?: string | undefined;
36
+ }[];
37
+ resources: {
38
+ uri: string;
39
+ name: string;
40
+ description?: string | undefined;
41
+ mimeType?: string | undefined;
42
+ size?: number | undefined;
43
+ annotations?: {
44
+ audience?: ("user" | "assistant")[] | undefined;
45
+ priority?: number | undefined;
46
+ lastModified?: string | undefined;
47
+ } | undefined;
48
+ _meta?: {
49
+ [x: string]: unknown;
50
+ } | undefined;
51
+ icons?: {
52
+ src: string;
53
+ mimeType?: string | undefined;
54
+ sizes?: string[] | undefined;
55
+ theme?: "light" | "dark" | undefined;
56
+ }[] | undefined;
57
+ title?: string | undefined;
58
+ }[];
59
+ prompts: {
60
+ name: string;
61
+ description?: string | undefined;
62
+ arguments?: {
63
+ name: string;
64
+ description?: string | undefined;
65
+ required?: boolean | undefined;
66
+ }[] | undefined;
67
+ _meta?: {
68
+ [x: string]: unknown;
69
+ } | undefined;
70
+ icons?: {
71
+ src: string;
72
+ mimeType?: string | undefined;
73
+ sizes?: string[] | undefined;
74
+ theme?: "light" | "dark" | undefined;
75
+ }[] | undefined;
76
+ title?: string | undefined;
77
+ }[];
78
+ promptContent: {
79
+ name: string;
80
+ result: {
81
+ [x: string]: unknown;
82
+ messages: {
83
+ role: "user" | "assistant";
84
+ content: {
85
+ type: "text";
86
+ text: string;
87
+ annotations?: {
88
+ audience?: ("user" | "assistant")[] | undefined;
89
+ priority?: number | undefined;
90
+ lastModified?: string | undefined;
91
+ } | undefined;
92
+ _meta?: Record<string, unknown> | undefined;
93
+ } | {
94
+ type: "image";
95
+ data: string;
96
+ mimeType: string;
97
+ annotations?: {
98
+ audience?: ("user" | "assistant")[] | undefined;
99
+ priority?: number | undefined;
100
+ lastModified?: string | undefined;
101
+ } | undefined;
102
+ _meta?: Record<string, unknown> | undefined;
103
+ } | {
104
+ type: "audio";
105
+ data: string;
106
+ mimeType: string;
107
+ annotations?: {
108
+ audience?: ("user" | "assistant")[] | undefined;
109
+ priority?: number | undefined;
110
+ lastModified?: string | undefined;
111
+ } | undefined;
112
+ _meta?: Record<string, unknown> | undefined;
113
+ } | {
114
+ type: "resource";
115
+ resource: {
116
+ uri: string;
117
+ text: string;
118
+ mimeType?: string | undefined;
119
+ _meta?: Record<string, unknown> | undefined;
120
+ } | {
121
+ uri: string;
122
+ blob: string;
123
+ mimeType?: string | undefined;
124
+ _meta?: Record<string, unknown> | undefined;
125
+ };
126
+ annotations?: {
127
+ audience?: ("user" | "assistant")[] | undefined;
128
+ priority?: number | undefined;
129
+ lastModified?: string | undefined;
130
+ } | undefined;
131
+ _meta?: Record<string, unknown> | undefined;
132
+ } | {
133
+ uri: string;
134
+ name: string;
135
+ type: "resource_link";
136
+ description?: string | undefined;
137
+ mimeType?: string | undefined;
138
+ size?: number | undefined;
139
+ annotations?: {
140
+ audience?: ("user" | "assistant")[] | undefined;
141
+ priority?: number | undefined;
142
+ lastModified?: string | undefined;
143
+ } | undefined;
144
+ _meta?: {
145
+ [x: string]: unknown;
146
+ } | undefined;
147
+ icons?: {
148
+ src: string;
149
+ mimeType?: string | undefined;
150
+ sizes?: string[] | undefined;
151
+ theme?: "light" | "dark" | undefined;
152
+ }[] | undefined;
153
+ title?: string | undefined;
154
+ };
155
+ }[];
156
+ _meta?: {
157
+ [x: string]: unknown;
158
+ progressToken?: string | number | undefined;
159
+ "io.modelcontextprotocol/related-task"?: {
160
+ taskId: string;
161
+ } | undefined;
162
+ } | undefined;
163
+ description?: string | undefined;
164
+ };
165
+ }[];
166
+ currencies: {
167
+ [x: string]: unknown;
168
+ contents: ({
169
+ uri: string;
170
+ text: string;
171
+ mimeType?: string | undefined;
172
+ _meta?: Record<string, unknown> | undefined;
173
+ } | {
174
+ uri: string;
175
+ blob: string;
176
+ mimeType?: string | undefined;
177
+ _meta?: Record<string, unknown> | undefined;
178
+ })[];
179
+ _meta?: {
180
+ [x: string]: unknown;
181
+ progressToken?: string | number | undefined;
182
+ "io.modelcontextprotocol/related-task"?: {
183
+ taskId: string;
184
+ } | undefined;
185
+ } | undefined;
186
+ };
187
+ }>;
188
+ type CapturedSurface = Awaited<ReturnType<typeof captureSurface>>;
189
+ export declare function assertClaudeCandidateCaptureParity({ localFull, localGrouped, remoteFull, remoteGrouped }: {
190
+ localFull: CapturedSurface;
191
+ localGrouped: CapturedSurface;
192
+ remoteFull: CapturedSurface;
193
+ remoteGrouped: CapturedSurface;
194
+ }): void;
195
+ export declare function captureClaudeCandidateContract(): Promise<{
196
+ contractVersion: number;
197
+ status: string;
198
+ inventorySource: string;
199
+ instructions: string;
200
+ catalogue: {
201
+ canonicalOperations: number;
202
+ aliases: {
203
+ [k: string]: string;
204
+ };
205
+ discoveryNames: string[];
206
+ };
207
+ exclusions: {
208
+ tools: Readonly<Record<string, string>>;
209
+ resources: Readonly<Record<string, string>>;
210
+ prompts: Readonly<Record<string, string>>;
211
+ };
212
+ tools: {
213
+ full: {
214
+ inputSchema: {
215
+ [x: string]: unknown;
216
+ type: "object";
217
+ properties?: Record<string, object> | undefined;
218
+ required?: string[] | undefined;
219
+ };
220
+ name: string;
221
+ description?: string | undefined;
222
+ outputSchema?: {
223
+ [x: string]: unknown;
224
+ type: "object";
225
+ properties?: Record<string, object> | undefined;
226
+ required?: string[] | undefined;
227
+ } | undefined;
228
+ annotations?: {
229
+ title?: string | undefined;
230
+ readOnlyHint?: boolean | undefined;
231
+ destructiveHint?: boolean | undefined;
232
+ idempotentHint?: boolean | undefined;
233
+ openWorldHint?: boolean | undefined;
234
+ } | undefined;
235
+ execution?: {
236
+ taskSupport?: "optional" | "required" | "forbidden" | undefined;
237
+ } | undefined;
238
+ _meta?: Record<string, unknown> | undefined;
239
+ icons?: {
240
+ src: string;
241
+ mimeType?: string | undefined;
242
+ sizes?: string[] | undefined;
243
+ theme?: "light" | "dark" | undefined;
244
+ }[] | undefined;
245
+ title?: string | undefined;
246
+ }[];
247
+ grouped: {
248
+ inputSchema: {
249
+ [x: string]: unknown;
250
+ type: "object";
251
+ properties?: Record<string, object> | undefined;
252
+ required?: string[] | undefined;
253
+ };
254
+ name: string;
255
+ description?: string | undefined;
256
+ outputSchema?: {
257
+ [x: string]: unknown;
258
+ type: "object";
259
+ properties?: Record<string, object> | undefined;
260
+ required?: string[] | undefined;
261
+ } | undefined;
262
+ annotations?: {
263
+ title?: string | undefined;
264
+ readOnlyHint?: boolean | undefined;
265
+ destructiveHint?: boolean | undefined;
266
+ idempotentHint?: boolean | undefined;
267
+ openWorldHint?: boolean | undefined;
268
+ } | undefined;
269
+ execution?: {
270
+ taskSupport?: "optional" | "required" | "forbidden" | undefined;
271
+ } | undefined;
272
+ _meta?: Record<string, unknown> | undefined;
273
+ icons?: {
274
+ src: string;
275
+ mimeType?: string | undefined;
276
+ sizes?: string[] | undefined;
277
+ theme?: "light" | "dark" | undefined;
278
+ }[] | undefined;
279
+ title?: string | undefined;
280
+ }[];
281
+ };
282
+ resources: {
283
+ local: {
284
+ uri: string;
285
+ name: string;
286
+ description?: string | undefined;
287
+ mimeType?: string | undefined;
288
+ size?: number | undefined;
289
+ annotations?: {
290
+ audience?: ("user" | "assistant")[] | undefined;
291
+ priority?: number | undefined;
292
+ lastModified?: string | undefined;
293
+ } | undefined;
294
+ _meta?: {
295
+ [x: string]: unknown;
296
+ } | undefined;
297
+ icons?: {
298
+ src: string;
299
+ mimeType?: string | undefined;
300
+ sizes?: string[] | undefined;
301
+ theme?: "light" | "dark" | undefined;
302
+ }[] | undefined;
303
+ title?: string | undefined;
304
+ }[];
305
+ remote: {
306
+ uri: string;
307
+ name: string;
308
+ description?: string | undefined;
309
+ mimeType?: string | undefined;
310
+ size?: number | undefined;
311
+ annotations?: {
312
+ audience?: ("user" | "assistant")[] | undefined;
313
+ priority?: number | undefined;
314
+ lastModified?: string | undefined;
315
+ } | undefined;
316
+ _meta?: {
317
+ [x: string]: unknown;
318
+ } | undefined;
319
+ icons?: {
320
+ src: string;
321
+ mimeType?: string | undefined;
322
+ sizes?: string[] | undefined;
323
+ theme?: "light" | "dark" | undefined;
324
+ }[] | undefined;
325
+ title?: string | undefined;
326
+ }[];
327
+ };
328
+ prompts: {
329
+ name: string;
330
+ description?: string | undefined;
331
+ arguments?: {
332
+ name: string;
333
+ description?: string | undefined;
334
+ required?: boolean | undefined;
335
+ }[] | undefined;
336
+ _meta?: {
337
+ [x: string]: unknown;
338
+ } | undefined;
339
+ icons?: {
340
+ src: string;
341
+ mimeType?: string | undefined;
342
+ sizes?: string[] | undefined;
343
+ theme?: "light" | "dark" | undefined;
344
+ }[] | undefined;
345
+ title?: string | undefined;
346
+ }[];
347
+ promptContent: {
348
+ name: string;
349
+ result: {
350
+ [x: string]: unknown;
351
+ messages: {
352
+ role: "user" | "assistant";
353
+ content: {
354
+ type: "text";
355
+ text: string;
356
+ annotations?: {
357
+ audience?: ("user" | "assistant")[] | undefined;
358
+ priority?: number | undefined;
359
+ lastModified?: string | undefined;
360
+ } | undefined;
361
+ _meta?: Record<string, unknown> | undefined;
362
+ } | {
363
+ type: "image";
364
+ data: string;
365
+ mimeType: string;
366
+ annotations?: {
367
+ audience?: ("user" | "assistant")[] | undefined;
368
+ priority?: number | undefined;
369
+ lastModified?: string | undefined;
370
+ } | undefined;
371
+ _meta?: Record<string, unknown> | undefined;
372
+ } | {
373
+ type: "audio";
374
+ data: string;
375
+ mimeType: string;
376
+ annotations?: {
377
+ audience?: ("user" | "assistant")[] | undefined;
378
+ priority?: number | undefined;
379
+ lastModified?: string | undefined;
380
+ } | undefined;
381
+ _meta?: Record<string, unknown> | undefined;
382
+ } | {
383
+ type: "resource";
384
+ resource: {
385
+ uri: string;
386
+ text: string;
387
+ mimeType?: string | undefined;
388
+ _meta?: Record<string, unknown> | undefined;
389
+ } | {
390
+ uri: string;
391
+ blob: string;
392
+ mimeType?: string | undefined;
393
+ _meta?: Record<string, unknown> | undefined;
394
+ };
395
+ annotations?: {
396
+ audience?: ("user" | "assistant")[] | undefined;
397
+ priority?: number | undefined;
398
+ lastModified?: string | undefined;
399
+ } | undefined;
400
+ _meta?: Record<string, unknown> | undefined;
401
+ } | {
402
+ uri: string;
403
+ name: string;
404
+ type: "resource_link";
405
+ description?: string | undefined;
406
+ mimeType?: string | undefined;
407
+ size?: number | undefined;
408
+ annotations?: {
409
+ audience?: ("user" | "assistant")[] | undefined;
410
+ priority?: number | undefined;
411
+ lastModified?: string | undefined;
412
+ } | undefined;
413
+ _meta?: {
414
+ [x: string]: unknown;
415
+ } | undefined;
416
+ icons?: {
417
+ src: string;
418
+ mimeType?: string | undefined;
419
+ sizes?: string[] | undefined;
420
+ theme?: "light" | "dark" | undefined;
421
+ }[] | undefined;
422
+ title?: string | undefined;
423
+ };
424
+ }[];
425
+ _meta?: {
426
+ [x: string]: unknown;
427
+ progressToken?: string | number | undefined;
428
+ "io.modelcontextprotocol/related-task"?: {
429
+ taskId: string;
430
+ } | undefined;
431
+ } | undefined;
432
+ description?: string | undefined;
433
+ };
434
+ }[];
435
+ currencies: {
436
+ [x: string]: unknown;
437
+ contents: ({
438
+ uri: string;
439
+ text: string;
440
+ mimeType?: string | undefined;
441
+ _meta?: Record<string, unknown> | undefined;
442
+ } | {
443
+ uri: string;
444
+ blob: string;
445
+ mimeType?: string | undefined;
446
+ _meta?: Record<string, unknown> | undefined;
447
+ })[];
448
+ _meta?: {
449
+ [x: string]: unknown;
450
+ progressToken?: string | number | undefined;
451
+ "io.modelcontextprotocol/related-task"?: {
452
+ taskId: string;
453
+ } | undefined;
454
+ } | undefined;
455
+ };
456
+ groups: {} | undefined;
457
+ surfaces: {
458
+ localFull: {
459
+ tools: string;
460
+ resources: string;
461
+ toolNames: number;
462
+ };
463
+ localGrouped: {
464
+ tools: string;
465
+ resources: string;
466
+ toolNames: number;
467
+ };
468
+ remoteFull: {
469
+ tools: string;
470
+ resources: string;
471
+ toolNames: number;
472
+ };
473
+ remoteGrouped: {
474
+ tools: string;
475
+ resources: string;
476
+ toolNames: number;
477
+ };
478
+ };
479
+ }>;
480
+ export declare function serializeClaudeCandidateContract(contract: Awaited<ReturnType<typeof captureClaudeCandidateContract>>): string;
481
+ export {};
482
+ //# sourceMappingURL=claude-candidate-contract.d.ts.map
@@ -0,0 +1,87 @@
1
+ /** Exact candidate descriptors from the real SDK; no hosted auth or API claims. */
2
+ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
3
+ import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";
4
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
5
+ import { CLAUDE_CANDIDATE_INSTRUCTIONS, CLAUDE_EXCLUDED_TOOLS, CLAUDE_EXCLUDED_RESOURCES, CLAUDE_EXCLUDED_PROMPTS, } from "./claude-profile.js";
6
+ import { FISCAL_MODELO_ALIASES } from "./fiscal-aliases.js";
7
+ import { localMcpSurfaceComposition, remoteMcpSurfaceComposition, registerMcpSurface } from "./server-composition.js";
8
+ async function captureSurface(local, grouped) {
9
+ const server = new McpServer({ name: "claude-candidate-capture", version: "1.0.0" }, {
10
+ instructions: CLAUDE_CANDIDATE_INSTRUCTIONS,
11
+ });
12
+ const api = new Proxy({}, { get: () => () => { throw new Error("Descriptor capture must not call the API"); } });
13
+ registerMcpSurface(server, api, (local ? localMcpSurfaceComposition : remoteMcpSurfaceComposition)(false, grouped, true));
14
+ const client = new Client({ name: "claude-candidate-capture-client", version: "1.0.0" });
15
+ const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
16
+ try {
17
+ await Promise.all([server.connect(serverTransport), client.connect(clientTransport)]);
18
+ const tools = (await client.listTools()).tools.sort((a, b) => a.name.localeCompare(b.name));
19
+ const resources = (await client.listResources()).resources.sort((a, b) => a.uri.localeCompare(b.uri));
20
+ const prompts = client.getServerCapabilities()?.prompts
21
+ ? (await client.listPrompts()).prompts.sort((a, b) => a.name.localeCompare(b.name))
22
+ : [];
23
+ const promptContent = await Promise.all(prompts.map(async ({ name }) => ({ name, result: await client.getPrompt({ name }) })));
24
+ const currencies = await client.readResource({ uri: "frihet://config/currencies" });
25
+ const groups = grouped ? (await client.callTool({ name: "list_tool_groups", arguments: {} })).structuredContent : undefined;
26
+ return { tools, resources, prompts, promptContent, currencies, ...(groups ? { groups } : {}) };
27
+ }
28
+ finally {
29
+ await Promise.allSettled([client.close(), server.close()]);
30
+ }
31
+ }
32
+ export function assertClaudeCandidateCaptureParity({ localFull, localGrouped, remoteFull, remoteGrouped }) {
33
+ const comparisons = [
34
+ ["full tools", localFull.tools, remoteFull.tools],
35
+ ["grouped tools", localGrouped.tools, remoteGrouped.tools],
36
+ ["local resources", localFull.resources, localGrouped.resources],
37
+ ["remote resources", remoteFull.resources, remoteGrouped.resources],
38
+ ["grouped discovery", remoteGrouped.groups, localGrouped.groups],
39
+ ];
40
+ for (const [name, surface] of Object.entries({ localGrouped, remoteFull, remoteGrouped })) {
41
+ for (const key of ["prompts", "promptContent", "currencies"]) {
42
+ comparisons.push([`${name} ${key}`, localFull[key], surface[key]]);
43
+ }
44
+ }
45
+ for (const [label, expected, actual] of comparisons) {
46
+ if (JSON.stringify(expected) !== JSON.stringify(actual)) {
47
+ throw new Error(`Claude candidate capture diverged: ${label}`);
48
+ }
49
+ }
50
+ }
51
+ export async function captureClaudeCandidateContract() {
52
+ const localFull = await captureSurface(true, false);
53
+ const localGrouped = await captureSurface(true, true);
54
+ const remoteFull = await captureSurface(false, false);
55
+ const remoteGrouped = await captureSurface(false, true);
56
+ assertClaudeCandidateCaptureParity({ localFull, localGrouped, remoteFull, remoteGrouped });
57
+ const aliases = Object.fromEntries(Object.entries(FISCAL_MODELO_ALIASES).filter(([alias]) => localFull.tools.some((tool) => tool.name === alias)));
58
+ return {
59
+ contractVersion: 1,
60
+ status: "local-candidate-only",
61
+ inventorySource: "176de12",
62
+ instructions: CLAUDE_CANDIDATE_INSTRUCTIONS,
63
+ catalogue: {
64
+ canonicalOperations: localFull.tools.length - Object.keys(aliases).length,
65
+ aliases,
66
+ discoveryNames: ["list_tool_groups", "search_tools", "describe_tool"],
67
+ },
68
+ exclusions: { tools: CLAUDE_EXCLUDED_TOOLS, resources: CLAUDE_EXCLUDED_RESOURCES, prompts: CLAUDE_EXCLUDED_PROMPTS },
69
+ // Capture all four compositions, store each identical descriptor only once.
70
+ tools: { full: localFull.tools, grouped: localGrouped.tools },
71
+ resources: { local: localFull.resources, remote: remoteFull.resources },
72
+ prompts: localFull.prompts,
73
+ promptContent: localFull.promptContent,
74
+ currencies: localFull.currencies,
75
+ groups: remoteGrouped.groups,
76
+ surfaces: {
77
+ localFull: { tools: "full", resources: "local", toolNames: localFull.tools.length },
78
+ localGrouped: { tools: "grouped", resources: "local", toolNames: localGrouped.tools.length },
79
+ remoteFull: { tools: "full", resources: "remote", toolNames: remoteFull.tools.length },
80
+ remoteGrouped: { tools: "grouped", resources: "remote", toolNames: remoteGrouped.tools.length },
81
+ },
82
+ };
83
+ }
84
+ export function serializeClaudeCandidateContract(contract) {
85
+ return `${JSON.stringify(contract, null, 2)}\n`;
86
+ }
87
+ //# sourceMappingURL=claude-candidate-contract.js.map
@@ -0,0 +1,17 @@
1
+ /** Output-only privacy boundary for Claude. No transport, input or retry policy. */
2
+ import { z } from "zod/v4";
3
+ export declare function sanitizeClaudeOutput(value: unknown, toolName?: string): unknown;
4
+ /** Keep the existing output shape, including open summaries, but never require
5
+ * or advertise a field removed by the runtime boundary. Inputs are untouched.
6
+ * Open/dynamic values are still sanitized recursively by sanitizeClaudeOutput.
7
+ */
8
+ export declare function claudeOutputSchema(schema: unknown): z.ZodType;
9
+ /** Never forward opaque content blocks or arbitrary response metadata. */
10
+ export declare function claudeToolResult(result: Record<string, unknown>, toolName?: string): Record<string, unknown>;
11
+ /** Candidate resources are JSON. Refuse opaque or unexpected formats. */
12
+ export declare function claudeResourceResult(result: {
13
+ contents?: unknown[];
14
+ }, uri: string): {
15
+ contents: unknown[];
16
+ };
17
+ //# sourceMappingURL=claude-output-privacy.d.ts.map