@ailu-ai/contracts 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 (142) hide show
  1. package/LICENSE +201 -0
  2. package/dist/admin.d.ts +99 -0
  3. package/dist/admin.d.ts.map +1 -0
  4. package/dist/admin.js +59 -0
  5. package/dist/admin.js.map +1 -0
  6. package/dist/admin.test.d.ts +2 -0
  7. package/dist/admin.test.d.ts.map +1 -0
  8. package/dist/admin.test.js +42 -0
  9. package/dist/admin.test.js.map +1 -0
  10. package/dist/approvals.d.ts +58 -0
  11. package/dist/approvals.d.ts.map +1 -0
  12. package/dist/approvals.js +28 -0
  13. package/dist/approvals.js.map +1 -0
  14. package/dist/artifacts.d.ts +22 -0
  15. package/dist/artifacts.d.ts.map +1 -0
  16. package/dist/artifacts.js +9 -0
  17. package/dist/artifacts.js.map +1 -0
  18. package/dist/catalog.d.ts +626 -0
  19. package/dist/catalog.d.ts.map +1 -0
  20. package/dist/catalog.js +69 -0
  21. package/dist/catalog.js.map +1 -0
  22. package/dist/catalog.test.d.ts +2 -0
  23. package/dist/catalog.test.d.ts.map +1 -0
  24. package/dist/catalog.test.js +98 -0
  25. package/dist/catalog.test.js.map +1 -0
  26. package/dist/compliance.d.ts +428 -0
  27. package/dist/compliance.d.ts.map +1 -0
  28. package/dist/compliance.js +80 -0
  29. package/dist/compliance.js.map +1 -0
  30. package/dist/connectors.d.ts +161 -0
  31. package/dist/connectors.d.ts.map +1 -0
  32. package/dist/connectors.js +49 -0
  33. package/dist/connectors.js.map +1 -0
  34. package/dist/error-envelope.d.ts +16 -0
  35. package/dist/error-envelope.d.ts.map +1 -0
  36. package/dist/error-envelope.js +7 -0
  37. package/dist/error-envelope.js.map +1 -0
  38. package/dist/eval.d.ts +144 -0
  39. package/dist/eval.d.ts.map +1 -0
  40. package/dist/eval.js +36 -0
  41. package/dist/eval.js.map +1 -0
  42. package/dist/events.d.ts +359 -0
  43. package/dist/events.d.ts.map +1 -0
  44. package/dist/events.js +134 -0
  45. package/dist/events.js.map +1 -0
  46. package/dist/fleet.d.ts +147 -0
  47. package/dist/fleet.d.ts.map +1 -0
  48. package/dist/fleet.js +34 -0
  49. package/dist/fleet.js.map +1 -0
  50. package/dist/fs-policy.d.ts +101 -0
  51. package/dist/fs-policy.d.ts.map +1 -0
  52. package/dist/fs-policy.js +36 -0
  53. package/dist/fs-policy.js.map +1 -0
  54. package/dist/fs-policy.test.d.ts +2 -0
  55. package/dist/fs-policy.test.d.ts.map +1 -0
  56. package/dist/fs-policy.test.js +35 -0
  57. package/dist/fs-policy.test.js.map +1 -0
  58. package/dist/fs.d.ts +182 -0
  59. package/dist/fs.d.ts.map +1 -0
  60. package/dist/fs.js +59 -0
  61. package/dist/fs.js.map +1 -0
  62. package/dist/fs.test.d.ts +2 -0
  63. package/dist/fs.test.d.ts.map +1 -0
  64. package/dist/fs.test.js +35 -0
  65. package/dist/fs.test.js.map +1 -0
  66. package/dist/graphs.d.ts +951 -0
  67. package/dist/graphs.d.ts.map +1 -0
  68. package/dist/graphs.js +94 -0
  69. package/dist/graphs.js.map +1 -0
  70. package/dist/graphs.test.d.ts +2 -0
  71. package/dist/graphs.test.d.ts.map +1 -0
  72. package/dist/graphs.test.js +65 -0
  73. package/dist/graphs.test.js.map +1 -0
  74. package/dist/index.d.ts +25 -0
  75. package/dist/index.d.ts.map +1 -0
  76. package/dist/index.js +25 -0
  77. package/dist/index.js.map +1 -0
  78. package/dist/index.test.d.ts +2 -0
  79. package/dist/index.test.d.ts.map +1 -0
  80. package/dist/index.test.js +9 -0
  81. package/dist/index.test.js.map +1 -0
  82. package/dist/knowledge.d.ts +315 -0
  83. package/dist/knowledge.d.ts.map +1 -0
  84. package/dist/knowledge.js +111 -0
  85. package/dist/knowledge.js.map +1 -0
  86. package/dist/knowledge.test.d.ts +2 -0
  87. package/dist/knowledge.test.d.ts.map +1 -0
  88. package/dist/knowledge.test.js +22 -0
  89. package/dist/knowledge.test.js.map +1 -0
  90. package/dist/node-metadata.d.ts +3096 -0
  91. package/dist/node-metadata.d.ts.map +1 -0
  92. package/dist/node-metadata.js +184 -0
  93. package/dist/node-metadata.js.map +1 -0
  94. package/dist/node-metadata.test.d.ts +2 -0
  95. package/dist/node-metadata.test.d.ts.map +1 -0
  96. package/dist/node-metadata.test.js +126 -0
  97. package/dist/node-metadata.test.js.map +1 -0
  98. package/dist/observability.d.ts +154 -0
  99. package/dist/observability.d.ts.map +1 -0
  100. package/dist/observability.js +34 -0
  101. package/dist/observability.js.map +1 -0
  102. package/dist/pii.d.ts +88 -0
  103. package/dist/pii.d.ts.map +1 -0
  104. package/dist/pii.js +42 -0
  105. package/dist/pii.js.map +1 -0
  106. package/dist/principal.d.ts +81 -0
  107. package/dist/principal.d.ts.map +1 -0
  108. package/dist/principal.js +48 -0
  109. package/dist/principal.js.map +1 -0
  110. package/dist/principal.test.d.ts +2 -0
  111. package/dist/principal.test.d.ts.map +1 -0
  112. package/dist/principal.test.js +44 -0
  113. package/dist/principal.test.js.map +1 -0
  114. package/dist/registries.d.ts +26 -0
  115. package/dist/registries.d.ts.map +1 -0
  116. package/dist/registries.js +11 -0
  117. package/dist/registries.js.map +1 -0
  118. package/dist/router.d.ts +48 -0
  119. package/dist/router.d.ts.map +1 -0
  120. package/dist/router.js +22 -0
  121. package/dist/router.js.map +1 -0
  122. package/dist/runs.d.ts +270 -0
  123. package/dist/runs.d.ts.map +1 -0
  124. package/dist/runs.js +108 -0
  125. package/dist/runs.js.map +1 -0
  126. package/dist/runs.test.d.ts +2 -0
  127. package/dist/runs.test.d.ts.map +1 -0
  128. package/dist/runs.test.js +79 -0
  129. package/dist/runs.test.js.map +1 -0
  130. package/dist/search.d.ts +88 -0
  131. package/dist/search.d.ts.map +1 -0
  132. package/dist/search.js +23 -0
  133. package/dist/search.js.map +1 -0
  134. package/dist/skills.d.ts +208 -0
  135. package/dist/skills.d.ts.map +1 -0
  136. package/dist/skills.js +63 -0
  137. package/dist/skills.js.map +1 -0
  138. package/dist/tenant.d.ts +204 -0
  139. package/dist/tenant.d.ts.map +1 -0
  140. package/dist/tenant.js +46 -0
  141. package/dist/tenant.js.map +1 -0
  142. package/package.json +33 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphs.d.ts","sourceRoot":"","sources":["../src/graphs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,cAAc,kEAAgE,CAAC;AAC5F,eAAO,MAAM,cAAc,uCAAqC,CAAC;AAOjE,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAe3B,CAAC;AAEH,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;EAM3B,CAAC;AAIH,QAAA,MAAM,0BAA0B;;;;IAI9B,iGAAiG;;;;;;;;;;;;EAEjG,CAAC;AAEH,QAAA,MAAM,iBAAiB;;;;IAJrB,iGAAiG;;;;;;;;;;;;GAIzB,CAAC;AAE3E,eAAO,MAAM,oBAAoB;;;;;;;;QAN/B,iGAAiG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAejG,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;QAjBzB,iGAAiG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2BjG,sFAAsF;;IAEtF,iDAAiD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEjD,CAAC;AAEH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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuEjG,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACxF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
package/dist/graphs.js ADDED
@@ -0,0 +1,94 @@
1
+ import { z } from "zod";
2
+ export const NodeTypeSchema = z.enum(["action", "agent", "tool", "human-gate", "subgraph"]);
3
+ export const EdgeTypeSchema = z.enum(["default", "conditional"]);
4
+ const RetryPolicySchema = z.object({
5
+ maxAttempts: z.number().int().min(1),
6
+ backoffMs: z.number().int().min(0)
7
+ });
8
+ const NodeDefinitionDtoSchema = z.object({
9
+ id: z.string().min(1),
10
+ type: NodeTypeSchema,
11
+ label: z.string().min(1),
12
+ subgraphId: z.string().min(1).optional(),
13
+ inputMapping: z.record(z.string(), z.string()).optional(),
14
+ outputMapping: z.record(z.string(), z.string()).optional(),
15
+ fanOut: z
16
+ .object({
17
+ parallelTo: z.array(z.string().min(1)).min(1),
18
+ joinAt: z.string().min(1)
19
+ })
20
+ .optional(),
21
+ retryPolicy: RetryPolicySchema.optional(),
22
+ metadata: z.record(z.string(), z.unknown()).optional()
23
+ });
24
+ const EdgeDefinitionDtoSchema = z.object({
25
+ id: z.string().min(1),
26
+ from: z.string().min(1),
27
+ to: z.string().min(1),
28
+ type: EdgeTypeSchema,
29
+ condition: z.string().min(1).optional()
30
+ });
31
+ const ChannelReducerDtoSchema = z.enum(["replace", "append", "merge"]);
32
+ const ChannelDefinitionDtoSchema = z.object({
33
+ type: z.string().min(1),
34
+ reducer: ChannelReducerDtoSchema,
35
+ default: z.unknown().optional(),
36
+ /** ADR 0032: never emit this channel's value in run events/logs (masked; still checkpointed). */
37
+ noLog: z.boolean().optional()
38
+ });
39
+ const ChannelsDtoSchema = z.record(z.string(), ChannelDefinitionDtoSchema);
40
+ export const CreateGraphDtoSchema = z.object({
41
+ version: z.string().min(1),
42
+ name: z.string().min(1),
43
+ recursionLimit: z.number().int().min(1).optional(),
44
+ channels: ChannelsDtoSchema,
45
+ nodes: z.array(NodeDefinitionDtoSchema),
46
+ edges: z.array(EdgeDefinitionDtoSchema),
47
+ entryNodeId: z.string().min(1),
48
+ metadata: z.record(z.string(), z.unknown()).optional()
49
+ });
50
+ export const GraphDtoSchema = z.object({
51
+ id: z.string().min(1),
52
+ version: z.string().min(1),
53
+ name: z.string().min(1),
54
+ recursionLimit: z.number().int().min(1).optional(),
55
+ channels: ChannelsDtoSchema,
56
+ nodes: z.array(NodeDefinitionDtoSchema),
57
+ edges: z.array(EdgeDefinitionDtoSchema),
58
+ entryNodeId: z.string().min(1),
59
+ metadata: z.record(z.string(), z.unknown()).optional(),
60
+ /** Owning tenant (tenancy). Optional for pre-tenancy rows backfilled to `default`. */
61
+ tenantId: z.string().min(1).optional(),
62
+ /** Id of the principal who created the graph. */
63
+ createdBy: z.string().min(1).optional()
64
+ });
65
+ /**
66
+ * The serializable graph shape an example graph carries. Wire-compatible with the
67
+ * engine `GraphDefinition` (version / name / channels / nodes / edges / entryNodeId),
68
+ * carrying everything the Studio's reactflow preview and create-graph flow need —
69
+ * without the Studio ever importing the engine or the SDK. The `id` is optional
70
+ * because example definitions are authored in code, not yet persisted.
71
+ */
72
+ export const ExampleGraphDefinitionDtoSchema = z.object({
73
+ id: z.string().min(1).optional(),
74
+ version: z.string().min(1),
75
+ name: z.string().min(1),
76
+ recursionLimit: z.number().int().min(1).optional(),
77
+ channels: ChannelsDtoSchema,
78
+ nodes: z.array(NodeDefinitionDtoSchema),
79
+ edges: z.array(EdgeDefinitionDtoSchema),
80
+ entryNodeId: z.string().min(1),
81
+ metadata: z.record(z.string(), z.unknown()).optional()
82
+ });
83
+ /**
84
+ * One example graph authored with `@ailu-ai/graph-sdk` and served by the control
85
+ * plane so the (commercial) Studio can render it — a name/description, plus the
86
+ * plain `definition` for the reactflow preview and the import-into-control-plane flow.
87
+ */
88
+ export const ExampleGraphDtoSchema = z.object({
89
+ slug: z.string().min(1),
90
+ name: z.string().min(1),
91
+ description: z.string().min(1),
92
+ definition: ExampleGraphDefinitionDtoSchema
93
+ });
94
+ //# sourceMappingURL=graphs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphs.js","sourceRoot":"","sources":["../src/graphs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC;AAC5F,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC;AAEjE,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACpC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACnC,CAAC,CAAC;AAEH,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACrB,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACxC,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EA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C,CAAC,KAAK,CAAC,uBAAuB,CAAC;IACvC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;CACvD,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,UAAU,EAAE,+BAA+B;CAC5C,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=graphs.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphs.test.d.ts","sourceRoot":"","sources":["../src/graphs.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,65 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { ExampleGraphDtoSchema } from "./graphs.js";
3
+ /**
4
+ * The example-graph contract is the API↔Studio boundary for SDK-authored example
5
+ * graphs. We assert a representative `ExampleGraphDto` parses cleanly and round-trips
6
+ * unchanged, so the API can validate the SDK metadata against this schema and forward
7
+ * it, and the Studio can render the preview + create flow from plain data.
8
+ */
9
+ describe("@ailu-ai/contracts — example graphs", () => {
10
+ const sample = {
11
+ slug: "publish-flow",
12
+ name: "Publish flow",
13
+ description: "A human-in-the-loop flow: write, approval gate, publish.",
14
+ definition: {
15
+ version: "1.0.0",
16
+ name: "publish-flow",
17
+ channels: {
18
+ draft: { type: "string", reducer: "replace", default: "" },
19
+ approved: { type: "boolean", reducer: "replace", default: false }
20
+ },
21
+ nodes: [
22
+ { id: "write", type: "action", label: "write" },
23
+ { id: "review", type: "human-gate", label: "review" },
24
+ { id: "publish", type: "action", label: "publish" }
25
+ ],
26
+ edges: [
27
+ { id: "write->review", from: "write", to: "review", type: "default" },
28
+ { id: "review->publish", from: "review", to: "publish", type: "default" }
29
+ ],
30
+ entryNodeId: "write"
31
+ }
32
+ };
33
+ it("parses a representative ExampleGraphDto", () => {
34
+ const result = ExampleGraphDtoSchema.safeParse(sample);
35
+ expect(result.success).toBe(true);
36
+ });
37
+ it("round-trips an ExampleGraphDto through parse unchanged", () => {
38
+ const parsed = ExampleGraphDtoSchema.parse(sample);
39
+ expect(parsed).toEqual(sample);
40
+ });
41
+ it("accepts an optional id on the definition", () => {
42
+ const withId = {
43
+ ...sample,
44
+ definition: { ...sample.definition, id: "graph_123" }
45
+ };
46
+ expect(ExampleGraphDtoSchema.safeParse(withId).success).toBe(true);
47
+ });
48
+ it("rejects an unknown node type", () => {
49
+ const bad = {
50
+ ...sample,
51
+ definition: {
52
+ ...sample.definition,
53
+ nodes: [{ id: "write", type: "magic", label: "write" }]
54
+ }
55
+ };
56
+ expect(ExampleGraphDtoSchema.safeParse(bad).success).toBe(false);
57
+ });
58
+ it("rejects a definition missing its entry node id", () => {
59
+ const definition = { ...sample.definition };
60
+ delete definition.entryNodeId;
61
+ const bad = { ...sample, definition };
62
+ expect(ExampleGraphDtoSchema.safeParse(bad).success).toBe(false);
63
+ });
64
+ });
65
+ //# sourceMappingURL=graphs.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphs.test.js","sourceRoot":"","sources":["../src/graphs.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,qBAAqB,EAAwB,MAAM,aAAa,CAAC;AAE1E;;;;;GAKG;AACH,QAAQ,CAAC,qCAAqC,EAAE,GAAG,EAAE;IACnD,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25 @@
1
+ export * from "./admin.js";
2
+ export * from "./error-envelope.js";
3
+ export * from "./connectors.js";
4
+ export * from "./graphs.js";
5
+ export * from "./runs.js";
6
+ export * from "./artifacts.js";
7
+ export * from "./approvals.js";
8
+ export * from "./events.js";
9
+ export * from "./registries.js";
10
+ export * from "./eval.js";
11
+ export * from "./observability.js";
12
+ export * from "./fleet.js";
13
+ export * from "./tenant.js";
14
+ export * from "./catalog.js";
15
+ export * from "./compliance.js";
16
+ export * from "./knowledge.js";
17
+ export * from "./skills.js";
18
+ export * from "./fs-policy.js";
19
+ export * from "./fs.js";
20
+ export * from "./node-metadata.js";
21
+ export * from "./pii.js";
22
+ export * from "./principal.js";
23
+ export * from "./router.js";
24
+ export * from "./search.js";
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,25 @@
1
+ export * from "./admin.js";
2
+ export * from "./error-envelope.js";
3
+ export * from "./connectors.js";
4
+ export * from "./graphs.js";
5
+ export * from "./runs.js";
6
+ export * from "./artifacts.js";
7
+ export * from "./approvals.js";
8
+ export * from "./events.js";
9
+ export * from "./registries.js";
10
+ export * from "./eval.js";
11
+ export * from "./observability.js";
12
+ export * from "./fleet.js";
13
+ export * from "./tenant.js";
14
+ export * from "./catalog.js";
15
+ export * from "./compliance.js";
16
+ export * from "./knowledge.js";
17
+ export * from "./skills.js";
18
+ export * from "./fs-policy.js";
19
+ export * from "./fs.js";
20
+ export * from "./node-metadata.js";
21
+ export * from "./pii.js";
22
+ export * from "./principal.js";
23
+ export * from "./router.js";
24
+ export * from "./search.js";
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import * as contracts from "./index.js";
3
+ describe("@ailu-ai/contracts exports", () => {
4
+ it("exposes contract modules", () => {
5
+ expect(contracts).toBeTypeOf("object");
6
+ expect(Object.keys(contracts).length).toBeGreaterThan(0);
7
+ });
8
+ });
9
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAExC,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE;QAClC,MAAM,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QACvC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,315 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * A document stored in the knowledge base (without its embedding vector). Carries the
4
+ * Open Knowledge Format (OKF) frontmatter so a bundle round-trips: `type` (OKF's only
5
+ * required field), plus the recommended `title`/`description`/`resource`/`tags`/`timestamp`,
6
+ * the bundle-relative `path`, the markdown cross-reference `links`, and any extra producer
7
+ * keys preserved in `frontmatter`.
8
+ */
9
+ export declare const KbDocumentDtoSchema: z.ZodObject<{
10
+ id: z.ZodString;
11
+ namespace: z.ZodString;
12
+ content: z.ZodString;
13
+ type: z.ZodString;
14
+ title: z.ZodOptional<z.ZodString>;
15
+ description: z.ZodOptional<z.ZodString>;
16
+ resource: z.ZodOptional<z.ZodString>;
17
+ timestamp: z.ZodOptional<z.ZodString>;
18
+ path: z.ZodOptional<z.ZodString>;
19
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
20
+ links: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
21
+ createdAt: z.ZodString;
22
+ }, "strip", z.ZodTypeAny, {
23
+ type: string;
24
+ id: string;
25
+ content: string;
26
+ createdAt: string;
27
+ namespace: string;
28
+ path?: string | undefined;
29
+ description?: string | undefined;
30
+ title?: string | undefined;
31
+ resource?: string | undefined;
32
+ timestamp?: string | undefined;
33
+ tags?: string[] | undefined;
34
+ links?: string[] | undefined;
35
+ }, {
36
+ type: string;
37
+ id: string;
38
+ content: string;
39
+ createdAt: string;
40
+ namespace: string;
41
+ path?: string | undefined;
42
+ description?: string | undefined;
43
+ title?: string | undefined;
44
+ resource?: string | undefined;
45
+ timestamp?: string | undefined;
46
+ tags?: string[] | undefined;
47
+ links?: string[] | undefined;
48
+ }>;
49
+ /** A single semantic-search hit: the matched document and its cosine score (1 = identical). */
50
+ export declare const KbSearchHitDtoSchema: z.ZodObject<{
51
+ id: z.ZodString;
52
+ content: z.ZodString;
53
+ score: z.ZodNumber;
54
+ type: z.ZodOptional<z.ZodString>;
55
+ title: z.ZodOptional<z.ZodString>;
56
+ }, "strip", z.ZodTypeAny, {
57
+ id: string;
58
+ content: string;
59
+ score: number;
60
+ type?: string | undefined;
61
+ title?: string | undefined;
62
+ }, {
63
+ id: string;
64
+ content: string;
65
+ score: number;
66
+ type?: string | undefined;
67
+ title?: string | undefined;
68
+ }>;
69
+ /**
70
+ * Body for ingesting raw documents into a namespace — each is embedded then stored. `.max(500)`
71
+ * (issue #453, security audit 2026-07-20 MEDIUM finding): the array itself had no upper bound,
72
+ * so a single request could enqueue an unbounded embedding workload. 500 comfortably covers a
73
+ * real batch ingest without leaving the endpoint effectively unbounded.
74
+ */
75
+ export declare const IngestKbDocumentsDtoSchema: z.ZodObject<{
76
+ documents: z.ZodArray<z.ZodObject<{
77
+ id: z.ZodOptional<z.ZodString>;
78
+ content: z.ZodString;
79
+ }, "strip", z.ZodTypeAny, {
80
+ content: string;
81
+ id?: string | undefined;
82
+ }, {
83
+ content: string;
84
+ id?: string | undefined;
85
+ }>, "many">;
86
+ }, "strip", z.ZodTypeAny, {
87
+ documents: {
88
+ content: string;
89
+ id?: string | undefined;
90
+ }[];
91
+ }, {
92
+ documents: {
93
+ content: string;
94
+ id?: string | undefined;
95
+ }[];
96
+ }>;
97
+ /** One file of an OKF bundle: a bundle-relative path and its raw markdown contents. */
98
+ export declare const OkfFileSchema: z.ZodObject<{
99
+ path: z.ZodString;
100
+ content: z.ZodString;
101
+ }, "strip", z.ZodTypeAny, {
102
+ path: string;
103
+ content: string;
104
+ }, {
105
+ path: string;
106
+ content: string;
107
+ }>;
108
+ /** Body for ingesting an OKF bundle — a set of markdown (+frontmatter) files. */
109
+ export declare const IngestOkfBundleDtoSchema: z.ZodObject<{
110
+ files: z.ZodArray<z.ZodObject<{
111
+ path: z.ZodString;
112
+ content: z.ZodString;
113
+ }, "strip", z.ZodTypeAny, {
114
+ path: string;
115
+ content: string;
116
+ }, {
117
+ path: string;
118
+ content: string;
119
+ }>, "many">;
120
+ }, "strip", z.ZodTypeAny, {
121
+ files: {
122
+ path: string;
123
+ content: string;
124
+ }[];
125
+ }, {
126
+ files: {
127
+ path: string;
128
+ content: string;
129
+ }[];
130
+ }>;
131
+ /** An OKF bundle returned by export — markdown files reconstructed from stored documents. */
132
+ export declare const OkfBundleDtoSchema: z.ZodObject<{
133
+ files: z.ZodArray<z.ZodObject<{
134
+ path: z.ZodString;
135
+ content: z.ZodString;
136
+ }, "strip", z.ZodTypeAny, {
137
+ path: string;
138
+ content: string;
139
+ }, {
140
+ path: string;
141
+ content: string;
142
+ }>, "many">;
143
+ }, "strip", z.ZodTypeAny, {
144
+ files: {
145
+ path: string;
146
+ content: string;
147
+ }[];
148
+ }, {
149
+ files: {
150
+ path: string;
151
+ content: string;
152
+ }[];
153
+ }>;
154
+ /** Body for ingesting a web page by URL — fetched, stripped to text, stored with provenance. */
155
+ export declare const IngestUrlDtoSchema: z.ZodObject<{
156
+ url: z.ZodString;
157
+ title: z.ZodOptional<z.ZodString>;
158
+ }, "strip", z.ZodTypeAny, {
159
+ url: string;
160
+ title?: string | undefined;
161
+ }, {
162
+ url: string;
163
+ title?: string | undefined;
164
+ }>;
165
+ /**
166
+ * Body for ingesting records from a JSON HTTP API (the generic SaaS-connector substrate:
167
+ * Slack/Notion/HubSpot are this with their base URL + a bearer header). Fetches `url`,
168
+ * walks `itemsPath` to an array, and maps each record's fields to an OKF document.
169
+ */
170
+ export declare const IngestApiDtoSchema: z.ZodObject<{
171
+ url: z.ZodString;
172
+ /** Dot path to the array of records (omit when the body is itself the array/object). */
173
+ itemsPath: z.ZodOptional<z.ZodString>;
174
+ /** Field holding each record's text content. */
175
+ contentField: z.ZodString;
176
+ idField: z.ZodOptional<z.ZodString>;
177
+ titleField: z.ZodOptional<z.ZodString>;
178
+ /** Extra request headers, e.g. `{ "authorization": "Bearer <token>" }`. */
179
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
180
+ }, "strip", z.ZodTypeAny, {
181
+ url: string;
182
+ contentField: string;
183
+ itemsPath?: string | undefined;
184
+ idField?: string | undefined;
185
+ titleField?: string | undefined;
186
+ headers?: Record<string, string> | undefined;
187
+ }, {
188
+ url: string;
189
+ contentField: string;
190
+ itemsPath?: string | undefined;
191
+ idField?: string | undefined;
192
+ titleField?: string | undefined;
193
+ headers?: Record<string, string> | undefined;
194
+ }>;
195
+ /** A node of the knowledge graph (a KB document). */
196
+ export declare const KbGraphNodeSchema: z.ZodObject<{
197
+ id: z.ZodString;
198
+ title: z.ZodOptional<z.ZodString>;
199
+ type: z.ZodString;
200
+ }, "strip", z.ZodTypeAny, {
201
+ type: string;
202
+ id: string;
203
+ title?: string | undefined;
204
+ }, {
205
+ type: string;
206
+ id: string;
207
+ title?: string | undefined;
208
+ }>;
209
+ /** A typed edge of the knowledge graph: `from --type--> to`. */
210
+ export declare const KbGraphEdgeSchema: z.ZodObject<{
211
+ from: z.ZodString;
212
+ to: z.ZodString;
213
+ type: z.ZodString;
214
+ }, "strip", z.ZodTypeAny, {
215
+ type: string;
216
+ to: string;
217
+ from: string;
218
+ }, {
219
+ type: string;
220
+ to: string;
221
+ from: string;
222
+ }>;
223
+ /** The knowledge graph of a namespace: typed relations between documents. */
224
+ export declare const KbGraphDtoSchema: z.ZodObject<{
225
+ nodes: z.ZodArray<z.ZodObject<{
226
+ id: z.ZodString;
227
+ title: z.ZodOptional<z.ZodString>;
228
+ type: z.ZodString;
229
+ }, "strip", z.ZodTypeAny, {
230
+ type: string;
231
+ id: string;
232
+ title?: string | undefined;
233
+ }, {
234
+ type: string;
235
+ id: string;
236
+ title?: string | undefined;
237
+ }>, "many">;
238
+ edges: z.ZodArray<z.ZodObject<{
239
+ from: z.ZodString;
240
+ to: z.ZodString;
241
+ type: z.ZodString;
242
+ }, "strip", z.ZodTypeAny, {
243
+ type: string;
244
+ to: string;
245
+ from: string;
246
+ }, {
247
+ type: string;
248
+ to: string;
249
+ from: string;
250
+ }>, "many">;
251
+ }, "strip", z.ZodTypeAny, {
252
+ nodes: {
253
+ type: string;
254
+ id: string;
255
+ title?: string | undefined;
256
+ }[];
257
+ edges: {
258
+ type: string;
259
+ to: string;
260
+ from: string;
261
+ }[];
262
+ }, {
263
+ nodes: {
264
+ type: string;
265
+ id: string;
266
+ title?: string | undefined;
267
+ }[];
268
+ edges: {
269
+ type: string;
270
+ to: string;
271
+ from: string;
272
+ }[];
273
+ }>;
274
+ export type KbGraphNode = z.infer<typeof KbGraphNodeSchema>;
275
+ export type KbGraphEdge = z.infer<typeof KbGraphEdgeSchema>;
276
+ export type KbGraphDto = z.infer<typeof KbGraphDtoSchema>;
277
+ /** Body for activation: search the KB for `query` and push the hits to a downstream webhook. */
278
+ export declare const ActivateDtoSchema: z.ZodObject<{
279
+ query: z.ZodString;
280
+ webhookUrl: z.ZodString;
281
+ k: z.ZodOptional<z.ZodNumber>;
282
+ }, "strip", z.ZodTypeAny, {
283
+ query: string;
284
+ webhookUrl: string;
285
+ k?: number | undefined;
286
+ }, {
287
+ query: string;
288
+ webhookUrl: string;
289
+ k?: number | undefined;
290
+ }>;
291
+ /** Result of an activation delivery. */
292
+ export declare const ActivationResultDtoSchema: z.ZodObject<{
293
+ delivered: z.ZodBoolean;
294
+ status: z.ZodNumber;
295
+ hits: z.ZodNumber;
296
+ }, "strip", z.ZodTypeAny, {
297
+ status: number;
298
+ delivered: boolean;
299
+ hits: number;
300
+ }, {
301
+ status: number;
302
+ delivered: boolean;
303
+ hits: number;
304
+ }>;
305
+ export type ActivateDto = z.infer<typeof ActivateDtoSchema>;
306
+ export type ActivationResultDto = z.infer<typeof ActivationResultDtoSchema>;
307
+ export type KbDocumentDto = z.infer<typeof KbDocumentDtoSchema>;
308
+ export type KbSearchHitDto = z.infer<typeof KbSearchHitDtoSchema>;
309
+ export type IngestKbDocumentsDto = z.infer<typeof IngestKbDocumentsDtoSchema>;
310
+ export type OkfFile = z.infer<typeof OkfFileSchema>;
311
+ export type IngestOkfBundleDto = z.infer<typeof IngestOkfBundleDtoSchema>;
312
+ export type OkfBundleDto = z.infer<typeof OkfBundleDtoSchema>;
313
+ export type IngestUrlDto = z.infer<typeof IngestUrlDtoSchema>;
314
+ export type IngestApiDto = z.infer<typeof IngestApiDtoSchema>;
315
+ //# sourceMappingURL=knowledge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knowledge.d.ts","sourceRoot":"","sources":["../src/knowledge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa9B,CAAC;AAEH,+FAA+F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