@mandatez/sdk 0.1.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 (54) hide show
  1. package/README.md +95 -0
  2. package/dist/client.d.ts +53 -0
  3. package/dist/client.d.ts.map +1 -0
  4. package/dist/client.js +85 -0
  5. package/dist/client.js.map +1 -0
  6. package/dist/events/index.d.ts +4 -0
  7. package/dist/events/index.d.ts.map +1 -0
  8. package/dist/events/index.js +3 -0
  9. package/dist/events/index.js.map +1 -0
  10. package/dist/events/schema.d.ts +58 -0
  11. package/dist/events/schema.d.ts.map +1 -0
  12. package/dist/events/schema.js +28 -0
  13. package/dist/events/schema.js.map +1 -0
  14. package/dist/events/signing.d.ts +17 -0
  15. package/dist/events/signing.d.ts.map +1 -0
  16. package/dist/events/signing.js +60 -0
  17. package/dist/events/signing.js.map +1 -0
  18. package/dist/identity/index.d.ts +16 -0
  19. package/dist/identity/index.d.ts.map +1 -0
  20. package/dist/identity/index.js +18 -0
  21. package/dist/identity/index.js.map +1 -0
  22. package/dist/index.d.ts +17 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +13 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/integrations/langchain/index.d.ts +46 -0
  27. package/dist/integrations/langchain/index.d.ts.map +1 -0
  28. package/dist/integrations/langchain/index.js +91 -0
  29. package/dist/integrations/langchain/index.js.map +1 -0
  30. package/dist/integrations/n8n/index.d.ts +26 -0
  31. package/dist/integrations/n8n/index.d.ts.map +1 -0
  32. package/dist/integrations/n8n/index.js +39 -0
  33. package/dist/integrations/n8n/index.js.map +1 -0
  34. package/dist/oversight/alerts.d.ts +32 -0
  35. package/dist/oversight/alerts.d.ts.map +1 -0
  36. package/dist/oversight/alerts.js +49 -0
  37. package/dist/oversight/alerts.js.map +1 -0
  38. package/dist/oversight/index.d.ts +58 -0
  39. package/dist/oversight/index.d.ts.map +1 -0
  40. package/dist/oversight/index.js +77 -0
  41. package/dist/oversight/index.js.map +1 -0
  42. package/dist/policy/index.d.ts +68 -0
  43. package/dist/policy/index.d.ts.map +1 -0
  44. package/dist/policy/index.js +82 -0
  45. package/dist/policy/index.js.map +1 -0
  46. package/dist/transport/index.d.ts +3 -0
  47. package/dist/transport/index.d.ts.map +1 -0
  48. package/dist/transport/index.js +2 -0
  49. package/dist/transport/index.js.map +1 -0
  50. package/dist/transport/supabase.d.ts +15 -0
  51. package/dist/transport/supabase.d.ts.map +1 -0
  52. package/dist/transport/supabase.js +31 -0
  53. package/dist/transport/supabase.js.map +1 -0
  54. package/package.json +49 -0
package/README.md ADDED
@@ -0,0 +1,95 @@
1
+ # MandateZ
2
+
3
+ **Every agent needs a mandate.**
4
+
5
+ MandateZ is the open, cross-vendor trust infrastructure for AI agents. Cryptographic identity, policy enforcement, human oversight, and tamper-proof audit logs — for any agent framework.
6
+
7
+ ## The Problem
8
+
9
+ AI agents act autonomously. There is no standard way to prove what they did, enforce what they can do, or produce compliance audit trails. MandateZ solves all three.
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ npm install @mandatez/sdk
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```typescript
20
+ import { generateAgentIdentity, MandateZClient } from '@mandatez/sdk';
21
+
22
+ const identity = await generateAgentIdentity();
23
+ const client = new MandateZClient({
24
+ agentId: identity.agent_id,
25
+ ownerId: 'your_org_id',
26
+ privateKey: identity.private_key,
27
+ supabaseUrl: process.env.SUPABASE_URL!,
28
+ supabaseAnonKey: process.env.SUPABASE_ANON_KEY!,
29
+ });
30
+
31
+ const event = await client.track({
32
+ action_type: 'read',
33
+ resource: 'emails',
34
+ });
35
+ // → signed, validated, emitted to your event stream
36
+ ```
37
+
38
+ ## What You Get
39
+
40
+ - **Agent Identity** — Ed25519 keypair per agent, unique `ag_` prefixed IDs
41
+ - **Signed Events** — every action produces a cryptographically signed, tamper-proof event
42
+ - **Policy Engine** — allow/block/flag rules with wildcard resource matching
43
+ - **Human Oversight** — pause execution, alert via Slack/webhook, auto-block on timeout
44
+ - **Compliance Reports** — JSON + PDF audit trail export
45
+ - **Framework Integrations** — LangChain, n8n, with more coming
46
+
47
+ ## Integrations
48
+
49
+ ### LangChain
50
+
51
+ ```typescript
52
+ import { MandateZLangChainCallback } from '@mandatez/sdk';
53
+
54
+ const callback = new MandateZLangChainCallback(client);
55
+ const chain = new ChatOpenAI({ callbacks: [callback] });
56
+ ```
57
+
58
+ ### n8n
59
+
60
+ ```typescript
61
+ import { MandateZN8nHook } from '@mandatez/sdk';
62
+
63
+ const hook = new MandateZN8nHook(client);
64
+ await hook.beforeExecution('wf_123', 'HTTP Request', inputData);
65
+ await hook.afterExecution('wf_123', 'HTTP Request', outputData, true);
66
+ ```
67
+
68
+ ## Architecture
69
+
70
+ Everything flows from one spine: the **Agent Event Stream**.
71
+
72
+ ```
73
+ Agent Action → Policy Engine → Oversight Gate → Sign (Ed25519) → Emit to Stream
74
+ ```
75
+
76
+ Every surface — SDK, dashboard, compliance engine, directory — reads the same stream. One data layer. No duplication.
77
+
78
+ ## Documentation
79
+
80
+ - [Quickstart](https://docs.mandatez.com/quickstart)
81
+ - [SDK Reference](https://docs.mandatez.com/sdk/track)
82
+ - [Protocol Specification](./protocol/SPEC.md)
83
+
84
+ ## Project Structure
85
+
86
+ ```
87
+ packages/sdk/ → @mandatez/sdk (open source, free forever)
88
+ apps/dashboard/ → Next.js event monitoring dashboard
89
+ protocol/ → Open protocol specification
90
+ docs/ → Documentation (Mintlify)
91
+ ```
92
+
93
+ ## License
94
+
95
+ MIT
@@ -0,0 +1,53 @@
1
+ import type { AgentEvent, AgentEventInput } from './events/schema.js';
2
+ import type { Policy } from './policy/index.js';
3
+ import type { OversightConfig } from './oversight/index.js';
4
+ /** The action fields a developer passes to track() */
5
+ export interface TrackInput {
6
+ action_type: AgentEventInput['action_type'];
7
+ resource: string;
8
+ outcome?: AgentEventInput['outcome'];
9
+ policy_id?: string | null;
10
+ metadata?: Record<string, unknown>;
11
+ /** Optional callback for human approval. If oversight requires approval
12
+ * and this is not provided, timeout_action applies immediately. */
13
+ waitForApproval?: () => Promise<boolean>;
14
+ }
15
+ export interface MandateZClientConfig {
16
+ agentId: string;
17
+ ownerId: string;
18
+ privateKey: string;
19
+ supabaseUrl: string;
20
+ supabaseAnonKey: string;
21
+ /** Optional policies — if provided, track() evaluates them to determine outcome */
22
+ policies?: Policy[];
23
+ /** Optional oversight config — if provided, flagged actions pause for human approval */
24
+ oversight?: OversightConfig;
25
+ }
26
+ /**
27
+ * Main SDK surface for developers.
28
+ *
29
+ * Wires together identity, signing, policy, oversight, and transport
30
+ * so a developer can track agent actions with a single method call.
31
+ */
32
+ export declare class MandateZClient {
33
+ private agentId;
34
+ private ownerId;
35
+ private privateKey;
36
+ private transport;
37
+ private policyEngine;
38
+ private oversightGate;
39
+ constructor(config: MandateZClientConfig);
40
+ /**
41
+ * Track an agent action.
42
+ *
43
+ * Flow:
44
+ * 1. Evaluate policy engine → determines outcome (allowed/blocked/flagged)
45
+ * 2. If blocked → sign event with 'blocked' outcome, emit, return (action does not proceed)
46
+ * 3. If oversight gate is configured and action requires approval:
47
+ * - Fire alerts, wait for human decision or timeout
48
+ * - Override outcome based on approval result
49
+ * 4. Sign event, emit to Supabase, return
50
+ */
51
+ track(input: TrackInput): Promise<AgentEvent>;
52
+ }
53
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,sDAAsD;AACtD,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IACrC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC;wEACoE;IACpE,eAAe,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1C;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,wFAAwF;IACxF,SAAS,CAAC,EAAE,eAAe,CAAC;CAC7B;AAED;;;;;GAKG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,SAAS,CAAoB;IACrC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,aAAa,CAAuB;gBAEhC,MAAM,EAAE,oBAAoB;IAqBxC;;;;;;;;;;OAUG;IACG,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;CA+CpD"}
package/dist/client.js ADDED
@@ -0,0 +1,85 @@
1
+ import { createSignedEvent } from './events/signing.js';
2
+ import { SupabaseTransport } from './transport/supabase.js';
3
+ import { PolicyEngine } from './policy/index.js';
4
+ import { OversightGate } from './oversight/index.js';
5
+ /**
6
+ * Main SDK surface for developers.
7
+ *
8
+ * Wires together identity, signing, policy, oversight, and transport
9
+ * so a developer can track agent actions with a single method call.
10
+ */
11
+ export class MandateZClient {
12
+ agentId;
13
+ ownerId;
14
+ privateKey;
15
+ transport;
16
+ policyEngine;
17
+ oversightGate;
18
+ constructor(config) {
19
+ this.agentId = config.agentId;
20
+ this.ownerId = config.ownerId;
21
+ this.privateKey = config.privateKey;
22
+ this.transport = new SupabaseTransport({
23
+ supabaseUrl: config.supabaseUrl,
24
+ supabaseAnonKey: config.supabaseAnonKey,
25
+ });
26
+ this.policyEngine = new PolicyEngine();
27
+ if (config.policies) {
28
+ for (const policy of config.policies) {
29
+ this.policyEngine.addPolicy(policy);
30
+ }
31
+ }
32
+ this.oversightGate = config.oversight
33
+ ? new OversightGate(config.oversight)
34
+ : null;
35
+ }
36
+ /**
37
+ * Track an agent action.
38
+ *
39
+ * Flow:
40
+ * 1. Evaluate policy engine → determines outcome (allowed/blocked/flagged)
41
+ * 2. If blocked → sign event with 'blocked' outcome, emit, return (action does not proceed)
42
+ * 3. If oversight gate is configured and action requires approval:
43
+ * - Fire alerts, wait for human decision or timeout
44
+ * - Override outcome based on approval result
45
+ * 4. Sign event, emit to Supabase, return
46
+ */
47
+ async track(input) {
48
+ // Step 1: Policy evaluation
49
+ const policyResult = this.policyEngine.evaluate(input.action_type, input.resource);
50
+ let outcome = input.outcome ?? policyResult.outcome;
51
+ let policyId = input.policy_id ?? policyResult.policy_id;
52
+ // Step 2: If policy says blocked, log it and stop
53
+ if (policyResult.outcome === 'blocked' && !input.outcome) {
54
+ outcome = 'blocked';
55
+ policyId = policyResult.policy_id;
56
+ }
57
+ // Step 3: Oversight gate — check if human approval is needed
58
+ if (outcome !== 'blocked' &&
59
+ this.oversightGate &&
60
+ this.oversightGate.requiresApproval(input.action_type)) {
61
+ const oversightResult = await this.oversightGate.requestApproval({
62
+ agent_id: this.agentId,
63
+ action_type: input.action_type,
64
+ resource: input.resource,
65
+ metadata: input.metadata ?? {},
66
+ timestamp: new Date().toISOString(),
67
+ requires_approval: true,
68
+ }, input.waitForApproval);
69
+ outcome = oversightResult.outcome;
70
+ }
71
+ // Step 4: Sign and emit
72
+ const eventInput = {
73
+ agent_id: this.agentId,
74
+ owner_id: this.ownerId,
75
+ action_type: input.action_type,
76
+ resource: input.resource,
77
+ outcome,
78
+ policy_id: policyId ?? null,
79
+ metadata: input.metadata ?? {},
80
+ };
81
+ const signed = await createSignedEvent(eventInput, this.privateKey);
82
+ return this.transport.emitEvent(signed);
83
+ }
84
+ }
85
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AA6BrD;;;;;GAKG;AACH,MAAM,OAAO,cAAc;IACjB,OAAO,CAAS;IAChB,OAAO,CAAS;IAChB,UAAU,CAAS;IACnB,SAAS,CAAoB;IAC7B,YAAY,CAAe;IAC3B,aAAa,CAAuB;IAE5C,YAAY,MAA4B;QACtC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QACpC,IAAI,CAAC,SAAS,GAAG,IAAI,iBAAiB,CAAC;YACrC,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,eAAe,EAAE,MAAM,CAAC,eAAe;SACxC,CAAC,CAAC;QAEH,IAAI,CAAC,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC;QACvC,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACpB,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACrC,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YACtC,CAAC;QACH,CAAC;QAED,IAAI,CAAC,aAAa,GAAG,MAAM,CAA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AClC,QAAQ,EAAE,IAAI,CAAC,OAAO;YACtB,QAAQ,EAAE,IAAI,CAAC,OAAO;YACtB,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,OAAO;YACP,SAAS,EAAE,QAAQ,IAAI,IAAI;YAC3B,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,EAAE;SAC/B,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACpE,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;CACF"}
@@ -0,0 +1,4 @@
1
+ export { AgentEventSchema, AgentEventInputSchema } from './schema.js';
2
+ export type { AgentEvent, AgentEventInput } from './schema.js';
3
+ export { createSignedEvent, verifyEvent } from './signing.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACtE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE/D,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { AgentEventSchema, AgentEventInputSchema } from './schema.js';
2
+ export { createSignedEvent, verifyEvent } from './signing.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGtE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,58 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Canonical AgentEvent schema — the spine of MandateZ.
4
+ *
5
+ * Every agent action produces one of these. Every surface reads from
6
+ * this same shape. Do not modify without explicit instruction.
7
+ */
8
+ export declare const AgentEventSchema: z.ZodObject<{
9
+ event_id: z.ZodString;
10
+ agent_id: z.ZodString;
11
+ owner_id: z.ZodString;
12
+ timestamp: z.ZodString;
13
+ action_type: z.ZodEnum<{
14
+ read: "read";
15
+ write: "write";
16
+ export: "export";
17
+ delete: "delete";
18
+ call: "call";
19
+ payment: "payment";
20
+ }>;
21
+ resource: z.ZodString;
22
+ outcome: z.ZodEnum<{
23
+ allowed: "allowed";
24
+ blocked: "blocked";
25
+ flagged: "flagged";
26
+ pending_approval: "pending_approval";
27
+ }>;
28
+ policy_id: z.ZodNullable<z.ZodString>;
29
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
30
+ signature: z.ZodString;
31
+ public_key: z.ZodString;
32
+ }, z.core.$strip>;
33
+ /** Canonical AgentEvent type — do not rename */
34
+ export type AgentEvent = z.infer<typeof AgentEventSchema>;
35
+ /** Input type for creating events before signing (no signature/public_key yet) */
36
+ export declare const AgentEventInputSchema: z.ZodObject<{
37
+ agent_id: z.ZodString;
38
+ owner_id: z.ZodString;
39
+ action_type: z.ZodEnum<{
40
+ read: "read";
41
+ write: "write";
42
+ export: "export";
43
+ delete: "delete";
44
+ call: "call";
45
+ payment: "payment";
46
+ }>;
47
+ resource: z.ZodString;
48
+ outcome: z.ZodEnum<{
49
+ allowed: "allowed";
50
+ blocked: "blocked";
51
+ flagged: "flagged";
52
+ pending_approval: "pending_approval";
53
+ }>;
54
+ policy_id: z.ZodNullable<z.ZodString>;
55
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
56
+ }, z.core.$strip>;
57
+ export type AgentEventInput = z.infer<typeof AgentEventInputSchema>;
58
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/events/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;iBAY3B,CAAC;AAEH,gDAAgD;AAChD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,kFAAkF;AAClF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;iBAKhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Canonical AgentEvent schema — the spine of MandateZ.
4
+ *
5
+ * Every agent action produces one of these. Every surface reads from
6
+ * this same shape. Do not modify without explicit instruction.
7
+ */
8
+ export const AgentEventSchema = z.object({
9
+ event_id: z.string().uuid(),
10
+ agent_id: z.string().regex(/^ag_[A-Za-z0-9_-]+$/, 'agent_id must start with ag_ prefix'),
11
+ owner_id: z.string().min(1),
12
+ timestamp: z.string().datetime(),
13
+ action_type: z.enum(['read', 'write', 'export', 'delete', 'call', 'payment']),
14
+ resource: z.string().min(1),
15
+ outcome: z.enum(['allowed', 'blocked', 'flagged', 'pending_approval']),
16
+ policy_id: z.string().nullable(),
17
+ metadata: z.record(z.string(), z.unknown()).default({}),
18
+ signature: z.string().min(1),
19
+ public_key: z.string().min(1),
20
+ });
21
+ /** Input type for creating events before signing (no signature/public_key yet) */
22
+ export const AgentEventInputSchema = AgentEventSchema.omit({
23
+ event_id: true,
24
+ signature: true,
25
+ public_key: true,
26
+ timestamp: true,
27
+ });
28
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/events/schema.ts"],"names":[],"mappings":"AAAA,O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,SAAS,EAAE,IAAI;CAChB,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { AgentEvent, AgentEventInput } from './schema.js';
2
+ /**
3
+ * Creates a complete, signed AgentEvent from input fields.
4
+ *
5
+ * Fills in event_id (UUIDv4), timestamp (ISO 8601 now), derives the
6
+ * public_key from the private_key, signs the canonical payload with
7
+ * Ed25519, and validates the result through the Zod schema.
8
+ */
9
+ export declare function createSignedEvent(input: AgentEventInput, privateKey: string): Promise<AgentEvent>;
10
+ /**
11
+ * Verifies an AgentEvent's signature against its public_key.
12
+ *
13
+ * Re-canonicalizes the payload (excluding signature), then checks the
14
+ * Ed25519 signature. Returns false on any error (bad key, tampered data).
15
+ */
16
+ export declare function verifyEvent(event: AgentEvent): Promise<boolean>;
17
+ //# sourceMappingURL=signing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signing.d.ts","sourceRoot":"","sources":["../../src/events/signing.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAY/D;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,eAAe,EACtB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,UAAU,CAAC,CAwBrB;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAcrE"}
@@ -0,0 +1,60 @@
1
+ import sodium from 'libsodium-wrappers';
2
+ import { randomUUID } from 'node:crypto';
3
+ import { AgentEventSchema } from './schema.js';
4
+ /**
5
+ * Builds the canonical payload string for signing/verification.
6
+ *
7
+ * Includes every field except `signature` itself, serialized with
8
+ * sorted keys for deterministic output across platforms.
9
+ */
10
+ function canonicalize(event) {
11
+ return JSON.stringify(event, Object.keys(event).sort());
12
+ }
13
+ /**
14
+ * Creates a complete, signed AgentEvent from input fields.
15
+ *
16
+ * Fills in event_id (UUIDv4), timestamp (ISO 8601 now), derives the
17
+ * public_key from the private_key, signs the canonical payload with
18
+ * Ed25519, and validates the result through the Zod schema.
19
+ */
20
+ export async function createSignedEvent(input, privateKey) {
21
+ await sodium.ready;
22
+ const secretKey = sodium.from_base64(privateKey, sodium.base64_variants.ORIGINAL);
23
+ const publicKey = secretKey.slice(32); // last 32 bytes of Ed25519 secret key
24
+ const unsigned = {
25
+ event_id: randomUUID(),
26
+ timestamp: new Date().toISOString(),
27
+ ...input,
28
+ public_key: sodium.to_base64(publicKey, sodium.base64_variants.ORIGINAL),
29
+ };
30
+ const payload = canonicalize(unsigned);
31
+ const message = new TextEncoder().encode(payload);
32
+ const sig = sodium.crypto_sign_detached(message, secretKey);
33
+ const event = {
34
+ ...unsigned,
35
+ signature: sodium.to_base64(sig, sodium.base64_variants.ORIGINAL),
36
+ };
37
+ // Never skip Zod validation on event schemas
38
+ return AgentEventSchema.parse(event);
39
+ }
40
+ /**
41
+ * Verifies an AgentEvent's signature against its public_key.
42
+ *
43
+ * Re-canonicalizes the payload (excluding signature), then checks the
44
+ * Ed25519 signature. Returns false on any error (bad key, tampered data).
45
+ */
46
+ export async function verifyEvent(event) {
47
+ await sodium.ready;
48
+ try {
49
+ const { signature, ...rest } = event;
50
+ const payload = canonicalize(rest);
51
+ const message = new TextEncoder().encode(payload);
52
+ const sig = sodium.from_base64(signature, sodium.base64_variants.ORIGINAL);
53
+ const publicKey = sodium.from_base64(event.public_key, sodium.base64_variants.ORIGINAL);
54
+ return sodium.crypto_sign_verify_detached(sig, message, publicKey);
55
+ }
56
+ catch {
57
+ return false;
58
+ }
59
+ }
60
+ //# sourceMappingURL=signing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signing.js","sourceRoot":"","sources":["../../src/events/signing.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,C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MAAM,MAAM,CAAC,KAAK,CAAC;IAEnB,IAAI,CAAC;QACH,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;QACrC,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;QACnC,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAClD,MAAM,GAAG,GAAG,MAAM,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QAC3E,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,UAAU,EAAE,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QAExF,OAAO,MAAM,CAAC,2BAA2B,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IACrE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,16 @@
1
+ export interface AgentIdentity {
2
+ /** Unique agent identifier: ag_ prefix + 21-char nanoid */
3
+ agent_id: string;
4
+ /** Ed25519 public key, base64-encoded */
5
+ public_key: string;
6
+ /** Ed25519 private key (seed), base64-encoded — never transmit or log */
7
+ private_key: string;
8
+ }
9
+ /**
10
+ * Generates a new agent identity with a unique ID and Ed25519 keypair.
11
+ *
12
+ * The keypair is used to sign every AgentEvent, creating a tamper-proof
13
+ * chain of custody for all agent actions.
14
+ */
15
+ export declare function generateAgentIdentity(): Promise<AgentIdentity>;
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/identity/index.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAa;IAC5B,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,aAAa,CAAC,CAUpE"}
@@ -0,0 +1,18 @@
1
+ import sodium from 'libsodium-wrappers';
2
+ import { nanoid } from 'nanoid';
3
+ /**
4
+ * Generates a new agent identity with a unique ID and Ed25519 keypair.
5
+ *
6
+ * The keypair is used to sign every AgentEvent, creating a tamper-proof
7
+ * chain of custody for all agent actions.
8
+ */
9
+ export async function generateAgentIdentity() {
10
+ await sodium.ready;
11
+ const keypair = sodium.crypto_sign_keypair();
12
+ return {
13
+ agent_id: `ag_${nanoid()}`,
14
+ public_key: sodium.to_base64(keypair.publicKey, sodium.base64_variants.ORIGINAL),
15
+ private_key: sodium.to_base64(keypair.privateKey, sodium.base64_variants.ORIGINAL),
16
+ };
17
+ }
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/identity/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAWhC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB;IACzC,MAAM,MAAM,CAAC,KAAK,CAAC;IAEnB,MAAM,OAAO,GAAG,MAAM,CAAC,mBAAmB,EAAE,CAAC;IAE7C,OAAO;QACL,QAAQ,EAAE,MAAM,MAAM,EAAE,EAAE;QAC1B,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC;QAChF,WAAW,EAAE,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC;KACnF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,17 @@
1
+ export { generateAgentIdentity } from './identity/index.js';
2
+ export type { AgentIdentity } from './identity/index.js';
3
+ export { AgentEventSchema, AgentEventInputSchema } from './events/index.js';
4
+ export type { AgentEvent, AgentEventInput } from './events/index.js';
5
+ export { createSignedEvent, verifyEvent } from './events/index.js';
6
+ export { SupabaseTransport } from './transport/index.js';
7
+ export type { SupabaseTransportConfig } from './transport/index.js';
8
+ export { PolicyEngine } from './policy/index.js';
9
+ export { PolicyRuleSchema, PolicySchema } from './policy/index.js';
10
+ export type { PolicyRule, Policy, PolicyOutcome, PolicyEvaluation } from './policy/index.js';
11
+ export { OversightGate, SlackAlertChannel, WebhookAlertChannel } from './oversight/index.js';
12
+ export type { OversightConfig, OversightResult, AlertChannel, OversightAlert, TimeoutAction, ApprovalDecision } from './oversight/index.js';
13
+ export { MandateZClient } from './client.js';
14
+ export type { MandateZClientConfig, TrackInput } from './client.js';
15
+ export { MandateZN8nHook } from './integrations/n8n/index.js';
16
+ export { MandateZLangChainCallback } from './integrations/langchain/index.js';
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACnE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE7F,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC7F,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE5I,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,YAAY,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ // @mandatez/sdk — MandateZ SDK entry point
2
+ // Every agent needs a mandate.
3
+ export { generateAgentIdentity } from './identity/index.js';
4
+ export { AgentEventSchema, AgentEventInputSchema } from './events/index.js';
5
+ export { createSignedEvent, verifyEvent } from './events/index.js';
6
+ export { SupabaseTransport } from './transport/index.js';
7
+ export { PolicyEngine } from './policy/index.js';
8
+ export { PolicyRuleSchema, PolicySchema } from './policy/index.js';
9
+ export { OversightGate, SlackAlertChannel, WebhookAlertChannel } from './oversight/index.js';
10
+ export { MandateZClient } from './client.js';
11
+ export { MandateZN8nHook } from './integrations/n8n/index.js';
12
+ export { MandateZLangChainCallback } from './integrations/langchain/index.js';
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,+BAA+B;AAE/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE5E,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGnE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAG7F,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC"}
@@ -0,0 +1,46 @@
1
+ import { MandateZClient } from '../../client.js';
2
+ import type { AgentEvent } from '../../events/schema.js';
3
+ /**
4
+ * MandateZ callback handler for LangChain.
5
+ *
6
+ * Implements the LangChain BaseCallbackHandler interface structurally —
7
+ * no @langchain/core dependency required. Pass this to any LangChain
8
+ * chain, agent, or LLM via the `callbacks` option.
9
+ *
10
+ * Tracked events:
11
+ * - handleLLMStart → action_type: 'call', resource: 'langchain/llm:{model}'
12
+ * - handleToolStart → action_type: 'call', resource: 'langchain/tool:{name}'
13
+ * - handleToolEnd → action_type: 'call', resource: 'langchain/tool:{name}'
14
+ * - handleChainError → action_type: 'call', resource: 'langchain/chain'
15
+ */
16
+ export declare class MandateZLangChainCallback {
17
+ name: string;
18
+ private client;
19
+ private events;
20
+ constructor(client: MandateZClient);
21
+ /** Returns all events tracked during this callback's lifetime. */
22
+ getEvents(): AgentEvent[];
23
+ /**
24
+ * Called when an LLM starts processing.
25
+ */
26
+ handleLLMStart(llm: {
27
+ name?: string;
28
+ id?: string[];
29
+ }, prompts: string[]): Promise<void>;
30
+ /**
31
+ * Called when a tool starts executing.
32
+ */
33
+ handleToolStart(tool: {
34
+ name?: string;
35
+ id?: string;
36
+ }, input: string): Promise<void>;
37
+ /**
38
+ * Called when a tool finishes executing.
39
+ */
40
+ handleToolEnd(output: string): Promise<void>;
41
+ /**
42
+ * Called when a chain encounters an error.
43
+ */
44
+ handleChainError(error: unknown): Promise<void>;
45
+ }
46
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/integrations/langchain/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;;;;;;;;;;GAYG;AACH,qBAAa,yBAAyB;IACpC,IAAI,SAA+B;IAEnC,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,MAAM,CAAoB;gBAEtB,MAAM,EAAE,cAAc;IAIlC,kEAAkE;IAClE,SAAS,IAAI,UAAU,EAAE;IAIzB;;OAEG;IACG,cAAc,CAClB,GAAG,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,EACrC,OAAO,EAAE,MAAM,EAAE,GAChB,OAAO,CAAC,IAAI,CAAC;IAehB;;OAEG;IACG,eAAe,CACnB,IAAI,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,EACpC,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC;IAehB;;OAEG;IACG,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAalD;;OAEG;IACG,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAatD"}