@decionis/agent-safe-pipeline 0.4.1 → 0.5.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 (75) hide show
  1. package/README.md +10 -0
  2. package/dist/Index.d.ts +6 -0
  3. package/dist/Index.d.ts.map +1 -1
  4. package/dist/Index.js +6 -0
  5. package/dist/Index.js.map +1 -1
  6. package/dist/execution/ActionRegistry.d.ts +12 -0
  7. package/dist/execution/ActionRegistry.d.ts.map +1 -1
  8. package/dist/execution/ActionRegistry.js +14 -0
  9. package/dist/execution/ActionRegistry.js.map +1 -1
  10. package/dist/execution/GovernedExecutionRunner.d.ts +8 -0
  11. package/dist/execution/GovernedExecutionRunner.d.ts.map +1 -1
  12. package/dist/execution/GovernedExecutionRunner.js +28 -0
  13. package/dist/execution/GovernedExecutionRunner.js.map +1 -1
  14. package/dist/execution/NativeExecutor.d.ts +13 -0
  15. package/dist/execution/NativeExecutor.d.ts.map +1 -1
  16. package/dist/execution/NativeExecutor.js.map +1 -1
  17. package/dist/intent/ExecutionIntent.d.ts +11 -0
  18. package/dist/intent/ExecutionIntent.d.ts.map +1 -1
  19. package/dist/intent/ExecutionIntent.js +15 -0
  20. package/dist/intent/ExecutionIntent.js.map +1 -1
  21. package/dist/intent/ExecutionSignals.d.ts +9 -1
  22. package/dist/intent/ExecutionSignals.d.ts.map +1 -1
  23. package/dist/intent/ExecutionSignals.js +9 -0
  24. package/dist/intent/ExecutionSignals.js.map +1 -1
  25. package/dist/intent/IntentCapture.d.ts.map +1 -1
  26. package/dist/intent/IntentCapture.js +15 -4
  27. package/dist/intent/IntentCapture.js.map +1 -1
  28. package/dist/intent/TargetPrecondition.d.ts +36 -0
  29. package/dist/intent/TargetPrecondition.d.ts.map +1 -0
  30. package/dist/intent/TargetPrecondition.js +57 -0
  31. package/dist/intent/TargetPrecondition.js.map +1 -0
  32. package/dist/manifest/ActionManifest.d.ts +112 -0
  33. package/dist/manifest/ActionManifest.d.ts.map +1 -0
  34. package/dist/manifest/ActionManifest.js +182 -0
  35. package/dist/manifest/ActionManifest.js.map +1 -0
  36. package/dist/plan/GovernedPlan.d.ts +109 -0
  37. package/dist/plan/GovernedPlan.d.ts.map +1 -0
  38. package/dist/plan/GovernedPlan.js +187 -0
  39. package/dist/plan/GovernedPlan.js.map +1 -0
  40. package/dist/plan/PlanState.d.ts +94 -0
  41. package/dist/plan/PlanState.d.ts.map +1 -0
  42. package/dist/plan/PlanState.js +240 -0
  43. package/dist/plan/PlanState.js.map +1 -0
  44. package/dist/plan/PlanStepReference.d.ts +16 -0
  45. package/dist/plan/PlanStepReference.d.ts.map +1 -0
  46. package/dist/plan/PlanStepReference.js +25 -0
  47. package/dist/plan/PlanStepReference.js.map +1 -0
  48. package/dist/profile/ApiProfile.d.ts +202 -2
  49. package/dist/profile/ApiProfile.d.ts.map +1 -1
  50. package/dist/profile/ApiProfile.js +397 -11
  51. package/dist/profile/ApiProfile.js.map +1 -1
  52. package/dist/profile/BuiltInApiProfiles.d.ts.map +1 -1
  53. package/dist/profile/BuiltInApiProfiles.js +199 -1
  54. package/dist/profile/BuiltInApiProfiles.js.map +1 -1
  55. package/dist/profile/McpToolProfile.d.ts +129 -0
  56. package/dist/profile/McpToolProfile.d.ts.map +1 -0
  57. package/dist/profile/McpToolProfile.js +270 -0
  58. package/dist/profile/McpToolProfile.js.map +1 -0
  59. package/dist/testing/Index.d.ts +3 -1
  60. package/dist/testing/Index.d.ts.map +1 -1
  61. package/dist/testing/Index.js +2 -0
  62. package/dist/testing/Index.js.map +1 -1
  63. package/dist/testing/LocalAssumptionBreaches.d.ts +96 -0
  64. package/dist/testing/LocalAssumptionBreaches.d.ts.map +1 -0
  65. package/dist/testing/LocalAssumptionBreaches.js +109 -0
  66. package/dist/testing/LocalAssumptionBreaches.js.map +1 -0
  67. package/dist/testing/LocalAuthority.d.ts +152 -5
  68. package/dist/testing/LocalAuthority.d.ts.map +1 -1
  69. package/dist/testing/LocalAuthority.js +294 -18
  70. package/dist/testing/LocalAuthority.js.map +1 -1
  71. package/dist/testing/LocalPlans.d.ts +43 -0
  72. package/dist/testing/LocalPlans.d.ts.map +1 -0
  73. package/dist/testing/LocalPlans.js +124 -0
  74. package/dist/testing/LocalPlans.js.map +1 -0
  75. package/package.json +2 -2
@@ -9,7 +9,7 @@ export const BUILT_IN_API_PROFILES = [
9
9
  profile: "agent-safe.profile.api/1",
10
10
  id: "businesscentral/api/v2",
11
11
  platform: "business-central",
12
- title: "Business Central API v2.0: the postings and master-data writes an agent can make",
12
+ title: "Business Central API v2.0: the postings and master-data writes an agent can make, and the customer reads it can be scoped to",
13
13
  prefixes: ["/v2.0/{tenantId}/{environment}/api/v2.0", "/v2.0/{environment}/api/v2.0", ""],
14
14
  operations: [
15
15
  {
@@ -78,6 +78,10 @@ export const BUILT_IN_API_PROFILES = [
78
78
  external_document_number: "/body/externalDocumentNumber",
79
79
  },
80
80
  policy_projection: null,
81
+ subject: {
82
+ request: "/body/customerNumber",
83
+ response: "/body/customerNumber",
84
+ },
81
85
  },
82
86
  {
83
87
  id: "purchaseInvoices.post",
@@ -148,6 +152,200 @@ export const BUILT_IN_API_PROFILES = [
148
152
  blocked: "/body/blocked",
149
153
  },
150
154
  policy_projection: null,
155
+ subject: {
156
+ response: "/body/number",
157
+ },
158
+ precondition: {
159
+ read: "customers.get",
160
+ version: "/body/@odata.etag",
161
+ state: "/body/blocked",
162
+ },
163
+ },
164
+ {
165
+ id: "customers.list",
166
+ method: "GET",
167
+ path: "/companies({companyId})/customers",
168
+ action: "customer.read",
169
+ summary: "List customers.",
170
+ facts: {},
171
+ policy_projection: null,
172
+ subject: {
173
+ response: "/body/value/*/number",
174
+ query: {
175
+ name: "$filter",
176
+ template: "number eq '{subject}'",
177
+ },
178
+ parameters: ["$select", "$top", "$skip", "$orderby", "$expand", "$skiptoken"],
179
+ envelope: ["@odata.context", "@odata.nextLink"],
180
+ },
181
+ },
182
+ {
183
+ id: "customers.get",
184
+ method: "GET",
185
+ path: "/companies({companyId})/customers({customerId})",
186
+ action: "customer.read",
187
+ summary: "Read one customer.",
188
+ facts: {},
189
+ policy_projection: null,
190
+ subject: {
191
+ response: "/body/number",
192
+ parameters: ["$select", "$expand"],
193
+ },
194
+ },
195
+ {
196
+ id: "salesInvoices.list",
197
+ method: "GET",
198
+ path: "/companies({companyId})/salesInvoices",
199
+ action: "sales.read",
200
+ summary: "List sales invoices.",
201
+ facts: {},
202
+ policy_projection: null,
203
+ subject: {
204
+ response: "/body/value/*/customerNumber",
205
+ query: {
206
+ name: "$filter",
207
+ template: "customerNumber eq '{subject}'",
208
+ },
209
+ parameters: ["$select", "$top", "$skip", "$orderby", "$expand", "$skiptoken"],
210
+ envelope: ["@odata.context", "@odata.nextLink"],
211
+ },
212
+ },
213
+ {
214
+ id: "salesInvoices.get",
215
+ method: "GET",
216
+ path: "/companies({companyId})/salesInvoices({salesInvoiceId})",
217
+ action: "sales.read",
218
+ summary: "Read one sales invoice.",
219
+ facts: {},
220
+ policy_projection: null,
221
+ subject: {
222
+ response: "/body/customerNumber",
223
+ parameters: ["$select", "$expand"],
224
+ },
225
+ },
226
+ {
227
+ id: "salesOrders.list",
228
+ method: "GET",
229
+ path: "/companies({companyId})/salesOrders",
230
+ action: "sales.read",
231
+ summary: "List sales orders.",
232
+ facts: {},
233
+ policy_projection: null,
234
+ subject: {
235
+ response: "/body/value/*/customerNumber",
236
+ query: {
237
+ name: "$filter",
238
+ template: "customerNumber eq '{subject}'",
239
+ },
240
+ parameters: ["$select", "$top", "$skip", "$orderby", "$expand", "$skiptoken"],
241
+ envelope: ["@odata.context", "@odata.nextLink"],
242
+ },
243
+ },
244
+ {
245
+ id: "salesOrders.get",
246
+ method: "GET",
247
+ path: "/companies({companyId})/salesOrders({salesOrderId})",
248
+ action: "sales.read",
249
+ summary: "Read one sales order.",
250
+ facts: {},
251
+ policy_projection: null,
252
+ subject: {
253
+ response: "/body/customerNumber",
254
+ parameters: ["$select", "$expand"],
255
+ },
256
+ },
257
+ {
258
+ id: "salesQuotes.list",
259
+ method: "GET",
260
+ path: "/companies({companyId})/salesQuotes",
261
+ action: "sales.read",
262
+ summary: "List sales quotes.",
263
+ facts: {},
264
+ policy_projection: null,
265
+ subject: {
266
+ response: "/body/value/*/customerNumber",
267
+ query: {
268
+ name: "$filter",
269
+ template: "customerNumber eq '{subject}'",
270
+ },
271
+ parameters: ["$select", "$top", "$skip", "$orderby", "$expand", "$skiptoken"],
272
+ envelope: ["@odata.context", "@odata.nextLink"],
273
+ },
274
+ },
275
+ {
276
+ id: "salesQuotes.get",
277
+ method: "GET",
278
+ path: "/companies({companyId})/salesQuotes({salesQuoteId})",
279
+ action: "sales.read",
280
+ summary: "Read one sales quote.",
281
+ facts: {},
282
+ policy_projection: null,
283
+ subject: {
284
+ response: "/body/customerNumber",
285
+ parameters: ["$select", "$expand"],
286
+ },
287
+ },
288
+ {
289
+ id: "salesCreditMemos.list",
290
+ method: "GET",
291
+ path: "/companies({companyId})/salesCreditMemos",
292
+ action: "sales.read",
293
+ summary: "List sales credit memos.",
294
+ facts: {},
295
+ policy_projection: null,
296
+ subject: {
297
+ response: "/body/value/*/customerNumber",
298
+ query: {
299
+ name: "$filter",
300
+ template: "customerNumber eq '{subject}'",
301
+ },
302
+ parameters: ["$select", "$top", "$skip", "$orderby", "$expand", "$skiptoken"],
303
+ envelope: ["@odata.context", "@odata.nextLink"],
304
+ },
305
+ },
306
+ {
307
+ id: "salesCreditMemos.get",
308
+ method: "GET",
309
+ path: "/companies({companyId})/salesCreditMemos({salesCreditMemoId})",
310
+ action: "sales.read",
311
+ summary: "Read one sales credit memo.",
312
+ facts: {},
313
+ policy_projection: null,
314
+ subject: {
315
+ response: "/body/customerNumber",
316
+ parameters: ["$select", "$expand"],
317
+ },
318
+ },
319
+ {
320
+ id: "customerLedgerEntries.list",
321
+ method: "GET",
322
+ path: "/companies({companyId})/customerLedgerEntries",
323
+ action: "ledger.read",
324
+ summary: "List customer ledger entries.",
325
+ facts: {},
326
+ policy_projection: null,
327
+ subject: {
328
+ response: "/body/value/*/customerNumber",
329
+ query: {
330
+ name: "$filter",
331
+ template: "customerNumber eq '{subject}'",
332
+ },
333
+ parameters: ["$select", "$top", "$skip", "$orderby", "$expand", "$skiptoken"],
334
+ envelope: ["@odata.context", "@odata.nextLink"],
335
+ },
336
+ },
337
+ {
338
+ id: "customerLedgerEntries.get",
339
+ method: "GET",
340
+ path: "/companies({companyId})/customerLedgerEntries({entryId})",
341
+ action: "ledger.read",
342
+ summary: "Read one customer ledger entry.",
343
+ facts: {},
344
+ policy_projection: null,
345
+ subject: {
346
+ response: "/body/customerNumber",
347
+ parameters: ["$select", "$expand"],
348
+ },
151
349
  },
152
350
  ],
153
351
  },
@@ -1 +1 @@
1
- {"version":3,"file":"BuiltInApiProfiles.js","sourceRoot":"","sources":["../../src/profile/BuiltInApiProfiles.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAoC;IACpE;QACE,OAAO,EAAE,0BAA0B;QACnC,EAAE,EAAE,wBAAwB;QAC5B,QAAQ,EAAE,kBAAkB;QAC5B,KAAK,EAAE,kFAAkF;QACzF,QAAQ,EAAE,CAAC,yCAAyC,EAAE,8BAA8B,EAAE,EAAE,CAAC;QACzF,UAAU,EAAE;YACV;gBACE,EAAE,EAAE,oBAAoB;gBACxB,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,4EAA4E;gBAClF,MAAM,EAAE,YAAY;gBACpB,OAAO,EAAE,uBAAuB;gBAChC,KAAK,EAAE;oBACL,UAAU,EAAE,iBAAiB;oBAC7B,WAAW,EAAE,mBAAmB;oBAChC,WAAW,EAAE,sBAAsB;iBACpC;gBACD,iBAAiB,EAAE,IAAI;aACxB;YACD;gBACE,EAAE,EAAE,2BAA2B;gBAC/B,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,mFAAmF;gBACzF,MAAM,EAAE,YAAY;gBACpB,OAAO,EAAE,mDAAmD;gBA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;YACD;gBACE,EAAE,EAAE,kBAAkB;gBACtB,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,eAAe;gBACrB,MAAM,EAAE,kBAAkB;gBAC1B,OAAO,EAAE,wCAAwC;gBACjD,KAAK,EAAE;oBACL,GAAG,EAAE,YAAY;oBACjB,QAAQ,EAAE,uBAAuB;oBACjC,aAAa,EAAE,qBAAqB;iBACrC;gBACD,iBAAiB,EAAE;oBACjB,aAAa,EAAE,oBAAoB;oBACnC,gBAAgB,EAAE,oBAAoB;oBACtC,YAAY,EAAE,6BAA6B;oBAC3C,OAAO,EAAE,IAAI;iBACd;aACF;YACD;gBACE,EAAE,EAAE,cAAc;gBAClB,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,WAAW;gBACjB,MAAM,EAAE,aAAa;gBACrB,OAAO,EAAE,4DAA4D;gBACrE,KAAK,EAAE;oBACL,SAAS,EAAE,iBAAiB;iBAC7B;gBACD,iBAAiB,EAAE,IAAI;aACxB;SACF;KACF;CACF,CAAC"}
1
+ {"version":3,"file":"BuiltInApiProfiles.js","sourceRoot":"","sources":["../../src/profile/BuiltInApiProfiles.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAoC;IACpE;QACE,OAAO,EAAE,0BAA0B;QACnC,EAAE,EAAE,wBAAwB;QAC5B,QAAQ,EAAE,kBAAkB;QAC5B,KAAK,EACH,8HAA8H;QAChI,QAAQ,EAAE,CAAC,yCAAyC,EAAE,8BAA8B,EAAE,EAAE,CAAC;QACzF,UAAU,EAAE;YACV;gBACE,EAAE,EAAE,oBAAoB;gBACxB,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,4EAA4E;gBAClF,MAAM,EAAE,YAAY;gBACpB,OAAO,EAAE,uBAAuB;gBAChC,KAAK,EAAE;oBACL,UAAU,EAAE,iBAAiB;oBAC7B,WAAW,EAAE,mBAAmB;oBAChC,WAAW,EAAE,sBAAsB;iBACpC;gBACD,iBAAiB,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AAiB,EAAE;oBACjB,aAAa,EAAE,cAAc;oBAC7B,gBAAgB,EAAE,cAAc;oBAChC,YAAY,EAAE,uBAAuB;oBACrC,OAAO,EAAE,IAAI;iBACd;aACF;YACD;gBACE,EAAE,EAAE,kBAAkB;gBACtB,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,eAAe;gBACrB,MAAM,EAAE,kBAAkB;gBAC1B,OAAO,EAAE,wCAAwC;gBACjD,KAAK,EAAE;oBACL,GAAG,EAAE,YAAY;oBACjB,QAAQ,EAAE,uBAAuB;oBACjC,aAAa,EAAE,qBAAqB;iBACrC;gBACD,iBAAiB,EAAE;oBACjB,aAAa,EAAE,oBAAoB;oBACnC,gBAAgB,EAAE,oBAAoB;oBACtC,YAAY,EAAE,6BAA6B;oBAC3C,OAAO,EAAE,IAAI;iBACd;aACF;YACD;gBACE,EAAE,EAAE,cAAc;gBAClB,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,WAAW;gBACjB,MAAM,EAAE,aAAa;gBACrB,OAAO,EAAE,4DAA4D;gBACrE,KAAK,EAAE;oBACL,SAAS,EAAE,iBAAiB;iBAC7B;gBACD,iBAAiB,EAAE,IAAI;aACxB;SACF;KACF;CACF,CAAC"}
@@ -0,0 +1,129 @@
1
+ import { z } from "zod";
2
+ import { type JsonObject } from "../intent/JsonValue.js";
3
+ /**
4
+ * `agent-safe.profile.mcp/1`: an MCP server's consequential tools described as
5
+ * data. Each tool names the action it becomes, the target it acts on (a
6
+ * template over its arguments), the argument that names its subject (the
7
+ * customer it is for), the arguments that decide what it does, and the
8
+ * arguments it accepts. A guard reads the file in place of a binding written
9
+ * in code, so governing a tool is a reviewable file, not code reached by name.
10
+ */
11
+ export declare const MCP_PROFILE_CONTRACT = "agent-safe.profile.mcp/1";
12
+ export declare const MCP_PROFILE_SCHEMA_ID = "https://github.com/decionis/agent-safe-pipeline/blob/master/spec/profiles/mcp/v1/schema.json";
13
+ /** The most arguments a tool declares, and the most placeholders its target holds. */
14
+ export declare const MAX_TOOL_ARGUMENTS = 64;
15
+ export declare const MAX_TARGET_PLACEHOLDERS = 16;
16
+ /** The types an argument may be declared as; a scalar one may fill a target or name a subject. */
17
+ export declare const MCP_ARGUMENT_TYPES: readonly ["string", "number", "integer", "boolean", "array", "object"];
18
+ export type McpArgumentType = (typeof MCP_ARGUMENT_TYPES)[number];
19
+ export declare const McpArgumentSchema: z.ZodObject<{
20
+ type: z.ZodEnum<{
21
+ string: "string";
22
+ number: "number";
23
+ boolean: "boolean";
24
+ object: "object";
25
+ array: "array";
26
+ integer: "integer";
27
+ }>;
28
+ required: z.ZodOptional<z.ZodBoolean>;
29
+ maxLength: z.ZodOptional<z.ZodNumber>;
30
+ }, z.core.$strict>;
31
+ export declare const McpToolSchema: z.ZodObject<{
32
+ tool: z.ZodString;
33
+ action: z.ZodString;
34
+ operation: z.ZodString;
35
+ summary: z.ZodString;
36
+ target: z.ZodString;
37
+ subject: z.ZodOptional<z.ZodString>;
38
+ consequential: z.ZodArray<z.ZodString>;
39
+ arguments: z.ZodRecord<z.ZodString, z.ZodObject<{
40
+ type: z.ZodEnum<{
41
+ string: "string";
42
+ number: "number";
43
+ boolean: "boolean";
44
+ object: "object";
45
+ array: "array";
46
+ integer: "integer";
47
+ }>;
48
+ required: z.ZodOptional<z.ZodBoolean>;
49
+ maxLength: z.ZodOptional<z.ZodNumber>;
50
+ }, z.core.$strict>>;
51
+ }, z.core.$strict>;
52
+ export declare const McpProfileDefinitionSchema: z.ZodObject<{
53
+ profile: z.ZodLiteral<"agent-safe.profile.mcp/1">;
54
+ id: z.ZodString;
55
+ title: z.ZodString;
56
+ system: z.ZodString;
57
+ environment: z.ZodOptional<z.ZodString>;
58
+ tools: z.ZodArray<z.ZodObject<{
59
+ tool: z.ZodString;
60
+ action: z.ZodString;
61
+ operation: z.ZodString;
62
+ summary: z.ZodString;
63
+ target: z.ZodString;
64
+ subject: z.ZodOptional<z.ZodString>;
65
+ consequential: z.ZodArray<z.ZodString>;
66
+ arguments: z.ZodRecord<z.ZodString, z.ZodObject<{
67
+ type: z.ZodEnum<{
68
+ string: "string";
69
+ number: "number";
70
+ boolean: "boolean";
71
+ object: "object";
72
+ array: "array";
73
+ integer: "integer";
74
+ }>;
75
+ required: z.ZodOptional<z.ZodBoolean>;
76
+ maxLength: z.ZodOptional<z.ZodNumber>;
77
+ }, z.core.$strict>>;
78
+ }, z.core.$strict>>;
79
+ }, z.core.$strict>;
80
+ export type McpArgumentDefinition = z.infer<typeof McpArgumentSchema>;
81
+ export type McpToolDefinition = z.infer<typeof McpToolSchema>;
82
+ export type McpProfileDefinition = z.infer<typeof McpProfileDefinitionSchema>;
83
+ /** A subject check's answer for a tool call: `MATCH`, or why it is refused. */
84
+ export type McpSubjectCheck = "MATCH" | "SUBJECT_ABSENT" | "SUBJECT_MISMATCH";
85
+ export declare class McpProfileError extends Error {
86
+ readonly code: "MCP_PROFILE_INVALID";
87
+ readonly detail: string;
88
+ constructor(code: "MCP_PROFILE_INVALID", detail: string);
89
+ }
90
+ /**
91
+ * One MCP tool profile, validated. Every rule a schema cannot state is held
92
+ * here, at parse: a tool named twice, two tools on one action, a target that
93
+ * names an argument a call
94
+ * could leave out, a subject that is not a required identifier, a
95
+ * consequential argument the tool does not accept.
96
+ */
97
+ export declare class McpToolProfile {
98
+ readonly definition: McpProfileDefinition;
99
+ private readonly byName;
100
+ private readonly schemas;
101
+ private constructor();
102
+ /** Validates a definition (closed schema, the rules above) and compiles it. */
103
+ static parse(value: unknown): McpToolProfile;
104
+ get id(): string;
105
+ /** Every tool the profile governs, in profile order. */
106
+ tools(): readonly string[];
107
+ tool(name: string): McpToolDefinition | null;
108
+ /**
109
+ * The arguments a tool accepts, as a closed validator: each declared one of
110
+ * its type, a required one present, any other refused. A number is finite;
111
+ * an integer is whole; an array or object holds JSON.
112
+ */
113
+ argumentsSchema(name: string): z.ZodType<JsonObject>;
114
+ /**
115
+ * The subject a call names, when its tool names a subject argument: a
116
+ * string or a finite number, as a string, of 1 to 200 characters; null when
117
+ * the argument holds neither. Undefined when the tool names no subject.
118
+ */
119
+ static subjectOf(tool: McpToolDefinition, args: JsonObject): string | null | undefined;
120
+ /** A call's subject against the session's, as `agent-safe.profile.api/1` checks a read's. */
121
+ static checkSubject(tool: McpToolDefinition, args: JsonObject, subject: string): McpSubjectCheck;
122
+ private static validator;
123
+ private static rules;
124
+ /** A target's placeholder names, by one linear scan; null when a brace is unbalanced or empty. */
125
+ private static placeholders;
126
+ }
127
+ /** The published JSON Schema of an MCP tool profile, generated from the validator above. */
128
+ export declare function mcpProfileJsonSchema(): Record<string, unknown>;
129
+ //# sourceMappingURL=McpToolProfile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"McpToolProfile.d.ts","sourceRoot":"","sources":["../../src/profile/McpToolProfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAmB,KAAK,UAAU,EAAkB,MAAM,wBAAwB,CAAC;AAE1F;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,6BAA6B,CAAC;AAE/D,eAAO,MAAM,qBAAqB,iGAC8D,CAAC;AAEjG,sFAAsF;AACtF,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C,kGAAkG;AAClG,eAAO,MAAM,kBAAkB,wEAOrB,CAAC;AACX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAMlE,eAAO,MAAM,iBAAiB;;;;;;;;;;;kBAM5B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;kBAuBxB,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAYrC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AACtE,MAAM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4FAA4F;AAC5F,wBAAgB,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAa9D"}
@@ -0,0 +1,270 @@
1
+ import { z } from "zod";
2
+ import { JsonValueSchema } from "../intent/JsonValue.js";
3
+ /**
4
+ * `agent-safe.profile.mcp/1`: an MCP server's consequential tools described as
5
+ * data. Each tool names the action it becomes, the target it acts on (a
6
+ * template over its arguments), the argument that names its subject (the
7
+ * customer it is for), the arguments that decide what it does, and the
8
+ * arguments it accepts. A guard reads the file in place of a binding written
9
+ * in code, so governing a tool is a reviewable file, not code reached by name.
10
+ */
11
+ export const MCP_PROFILE_CONTRACT = "agent-safe.profile.mcp/1";
12
+ export const MCP_PROFILE_SCHEMA_ID = "https://github.com/decionis/agent-safe-pipeline/blob/master/spec/profiles/mcp/v1/schema.json";
13
+ /** The most arguments a tool declares, and the most placeholders its target holds. */
14
+ export const MAX_TOOL_ARGUMENTS = 64;
15
+ export const MAX_TARGET_PLACEHOLDERS = 16;
16
+ /** The types an argument may be declared as; a scalar one may fill a target or name a subject. */
17
+ export const MCP_ARGUMENT_TYPES = [
18
+ "string",
19
+ "number",
20
+ "integer",
21
+ "boolean",
22
+ "array",
23
+ "object",
24
+ ];
25
+ /** An argument's name starts with a letter, so no declared name can be `__proto__`. */
26
+ const argumentName = z.string().regex(/^[a-z]\w{0,63}$/i);
27
+ const text = (max) => z.string().trim().min(1).max(max);
28
+ export const McpArgumentSchema = z.strictObject({
29
+ type: z.enum(MCP_ARGUMENT_TYPES),
30
+ /** Absent means optional: a call may leave the argument out. */
31
+ required: z.boolean().optional(),
32
+ /** The longest a string argument may be; a string only. */
33
+ maxLength: z.number().int().min(1).max(100_000).optional(),
34
+ });
35
+ export const McpToolSchema = z.strictObject({
36
+ /** The tool as the server publishes it. */
37
+ tool: z
38
+ .string()
39
+ .min(1)
40
+ .max(200)
41
+ .regex(/^[a-z0-9][\w.:/-]*$/i),
42
+ /** The intent's action type. */
43
+ action: z
44
+ .string()
45
+ .max(120)
46
+ .regex(/^[a-z][a-z0-9._:-]*$/),
47
+ /** The operation in the downstream system, for the intent's downstream target. */
48
+ operation: text(200),
49
+ summary: text(300),
50
+ /** `crm:customer:{customerId}`: every placeholder a required scalar argument. */
51
+ target: z.string().min(1).max(500),
52
+ /** The argument naming the tool's subject, when the tool acts for one party. */
53
+ subject: argumentName.optional(),
54
+ /** The arguments that decide what the tool does, for evidence and an approval screen. */
55
+ consequential: z.array(argumentName).max(MAX_TOOL_ARGUMENTS),
56
+ /** Every argument the tool accepts; any other is refused, never dropped. */
57
+ arguments: z.record(argumentName, McpArgumentSchema),
58
+ });
59
+ export const McpProfileDefinitionSchema = z.strictObject({
60
+ profile: z.literal(MCP_PROFILE_CONTRACT),
61
+ /** `<system>/<server>/<version>`, for example `crm/mcp/v1`. */
62
+ id: z
63
+ .string()
64
+ .regex(/^[a-z][a-z0-9]*\/[a-z][a-z0-9]*\/v\d+(\.\d+)?$/)
65
+ .max(120),
66
+ title: text(200),
67
+ /** The system the tools' effects land in: the intent's downstream system. */
68
+ system: text(200),
69
+ environment: text(200).optional(),
70
+ tools: z.array(McpToolSchema).min(1).max(200),
71
+ });
72
+ export class McpProfileError extends Error {
73
+ code;
74
+ detail;
75
+ constructor(code, detail) {
76
+ super(code);
77
+ this.code = code;
78
+ this.detail = detail;
79
+ this.name = "McpProfileError";
80
+ }
81
+ }
82
+ const SCALAR = new Set(["string", "number", "integer", "boolean"]);
83
+ const SUBJECT_TYPES = new Set(["string", "number", "integer"]);
84
+ /** The longest subject: an identifier, never a payload. */
85
+ const MAX_SUBJECT_LENGTH = 200;
86
+ /**
87
+ * One MCP tool profile, validated. Every rule a schema cannot state is held
88
+ * here, at parse: a tool named twice, two tools on one action, a target that
89
+ * names an argument a call
90
+ * could leave out, a subject that is not a required identifier, a
91
+ * consequential argument the tool does not accept.
92
+ */
93
+ export class McpToolProfile {
94
+ definition;
95
+ byName;
96
+ schemas = new Map();
97
+ constructor(definition) {
98
+ this.definition = definition;
99
+ const byName = new Map();
100
+ const actions = new Set();
101
+ for (const tool of definition.tools) {
102
+ if (byName.has(tool.tool))
103
+ throw new McpProfileError("MCP_PROFILE_INVALID", `duplicate tool ${tool.tool}`);
104
+ // A grant authorizes an action, and the guard dispatches the one tool
105
+ // registered under it: two tools on one action would be ambiguous.
106
+ if (actions.has(tool.action))
107
+ throw new McpProfileError("MCP_PROFILE_INVALID", `tool ${tool.tool} repeats an action`);
108
+ actions.add(tool.action);
109
+ McpToolProfile.rules(tool);
110
+ byName.set(tool.tool, tool);
111
+ }
112
+ this.byName = byName;
113
+ }
114
+ /** Validates a definition (closed schema, the rules above) and compiles it. */
115
+ static parse(value) {
116
+ const parsed = McpProfileDefinitionSchema.safeParse(value);
117
+ if (!parsed.success)
118
+ throw new McpProfileError("MCP_PROFILE_INVALID", parsed.error.issues
119
+ .slice(0, 3)
120
+ .map((issue) => `${issue.path.join(".") || "(root)"}: ${issue.message}`)
121
+ .join("; "));
122
+ return new McpToolProfile(parsed.data);
123
+ }
124
+ get id() {
125
+ return this.definition.id;
126
+ }
127
+ /** Every tool the profile governs, in profile order. */
128
+ tools() {
129
+ return this.definition.tools.map((tool) => tool.tool);
130
+ }
131
+ tool(name) {
132
+ return this.byName.get(name) ?? null;
133
+ }
134
+ /**
135
+ * The arguments a tool accepts, as a closed validator: each declared one of
136
+ * its type, a required one present, any other refused. A number is finite;
137
+ * an integer is whole; an array or object holds JSON.
138
+ */
139
+ argumentsSchema(name) {
140
+ const cached = this.schemas.get(name);
141
+ if (cached !== undefined)
142
+ return cached;
143
+ const tool = this.byName.get(name);
144
+ if (tool === undefined)
145
+ throw new McpProfileError("MCP_PROFILE_INVALID", `no tool ${name}`);
146
+ const shape = {};
147
+ for (const [argument, declared] of Object.entries(tool.arguments)) {
148
+ const base = McpToolProfile.validator(declared);
149
+ shape[argument] = declared.required === true ? base : base.optional();
150
+ }
151
+ const schema = z.strictObject(shape);
152
+ this.schemas.set(name, schema);
153
+ return schema;
154
+ }
155
+ /**
156
+ * The subject a call names, when its tool names a subject argument: a
157
+ * string or a finite number, as a string, of 1 to 200 characters; null when
158
+ * the argument holds neither. Undefined when the tool names no subject.
159
+ */
160
+ static subjectOf(tool, args) {
161
+ if (tool.subject === undefined)
162
+ return undefined;
163
+ const value = Object.hasOwn(args, tool.subject)
164
+ ? args[tool.subject]
165
+ : undefined;
166
+ const named = typeof value === "string"
167
+ ? value
168
+ : typeof value === "number" && Number.isFinite(value)
169
+ ? String(value)
170
+ : null;
171
+ return named === null || named.length === 0 || named.length > MAX_SUBJECT_LENGTH ? null : named;
172
+ }
173
+ /** A call's subject against the session's, as `agent-safe.profile.api/1` checks a read's. */
174
+ static checkSubject(tool, args, subject) {
175
+ const named = McpToolProfile.subjectOf(tool, args);
176
+ if (named === undefined)
177
+ return "MATCH";
178
+ if (named === null)
179
+ return "SUBJECT_ABSENT";
180
+ return named === subject ? "MATCH" : "SUBJECT_MISMATCH";
181
+ }
182
+ static validator(declared) {
183
+ switch (declared.type) {
184
+ case "string":
185
+ return declared.maxLength === undefined ? z.string() : z.string().max(declared.maxLength);
186
+ case "number":
187
+ return z.number().finite();
188
+ case "integer":
189
+ return z.number().int();
190
+ case "boolean":
191
+ return z.boolean();
192
+ case "array":
193
+ return z.array(JsonValueSchema);
194
+ case "object":
195
+ return z.record(z.string(), JsonValueSchema);
196
+ }
197
+ }
198
+ static rules(tool) {
199
+ const refuse = (detail) => {
200
+ throw new McpProfileError("MCP_PROFILE_INVALID", `tool ${tool.tool} ${detail}`);
201
+ };
202
+ const declared = Object.entries(tool.arguments);
203
+ if (declared.length > MAX_TOOL_ARGUMENTS)
204
+ refuse("declares too many arguments");
205
+ for (const [name, argument] of declared) {
206
+ if (argument.maxLength !== undefined && argument.type !== "string")
207
+ refuse(`bounds the length of ${name}, which is not a string`);
208
+ }
209
+ const required = (name, types) => {
210
+ const argument = tool.arguments[name];
211
+ return (Object.hasOwn(tool.arguments, name) &&
212
+ argument !== undefined &&
213
+ argument.required === true &&
214
+ types.has(argument.type));
215
+ };
216
+ const placeholders = McpToolProfile.placeholders(tool.target);
217
+ if (placeholders === null)
218
+ refuse("has a malformed target");
219
+ for (const name of placeholders ?? []) {
220
+ if (!required(name, SCALAR))
221
+ refuse(`fills its target from ${name}, not a required scalar`);
222
+ }
223
+ if (tool.subject !== undefined && !required(tool.subject, SUBJECT_TYPES))
224
+ refuse(`names ${tool.subject} as its subject, not a required string or number`);
225
+ if (new Set(tool.consequential).size !== tool.consequential.length)
226
+ refuse("names a consequential argument twice");
227
+ for (const name of tool.consequential) {
228
+ if (!Object.hasOwn(tool.arguments, name))
229
+ refuse(`names ${name} consequential, not accepted`);
230
+ }
231
+ }
232
+ /** A target's placeholder names, by one linear scan; null when a brace is unbalanced or empty. */
233
+ static placeholders(target) {
234
+ const names = [];
235
+ for (let at = 0; at < target.length; at += 1) {
236
+ const character = target[at];
237
+ if (character === "}")
238
+ return null;
239
+ if (character !== "{")
240
+ continue;
241
+ const close = target.indexOf("}", at + 1);
242
+ if (close === -1)
243
+ return null;
244
+ const name = target.slice(at + 1, close);
245
+ if (name.length === 0 || name.includes("{"))
246
+ return null;
247
+ names.push(name);
248
+ if (names.length > MAX_TARGET_PLACEHOLDERS)
249
+ return null;
250
+ at = close;
251
+ }
252
+ return names;
253
+ }
254
+ }
255
+ /** The published JSON Schema of an MCP tool profile, generated from the validator above. */
256
+ export function mcpProfileJsonSchema() {
257
+ const generated = z.toJSONSchema(McpProfileDefinitionSchema, {
258
+ target: "draft-2020-12",
259
+ io: "input",
260
+ });
261
+ const schema = { ...generated };
262
+ delete schema["$schema"];
263
+ return {
264
+ $schema: "https://json-schema.org/draft/2020-12/schema",
265
+ $id: MCP_PROFILE_SCHEMA_ID,
266
+ title: MCP_PROFILE_CONTRACT,
267
+ ...schema,
268
+ };
269
+ }
270
+ //# sourceMappingURL=McpToolProfile.js.map