@aroha-sdk/micro 1.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.
@@ -0,0 +1,73 @@
1
+ /**
2
+ * @aroha-sdk/micro — Express-like Aroha agent API.
3
+ *
4
+ * The full Aroha protocol (Ed25519 DIDs, saga state machine, policy middleware)
5
+ * is designed for zero-trust production networks. @aroha-sdk/micro makes the same
6
+ * protocol accessible in 5 lines for local development and hackathons.
7
+ *
8
+ * Dev mode (default):
9
+ * - Ed25519 signing is performed but VERIFICATION is skipped on inbound msgs
10
+ * - ArohaReserve → auto-commits (single-call instead of two-phase saga)
11
+ * - Agent self-registers with the local `aroha dev` sandbox if it is running
12
+ *
13
+ * Production mode (devMode: false):
14
+ * - Full signature verification re-enabled; nothing else changes in your code
15
+ */
16
+ /** Handler for a single capability. Return any JSON-serialisable value. */
17
+ export type CapabilityHandler = (params: Record<string, unknown>) => Promise<unknown> | unknown;
18
+ export interface MicroAgentOptions {
19
+ /** Agent display name — used for console output and registry display. */
20
+ name: string;
21
+ /** Port to listen on. */
22
+ port: number;
23
+ /**
24
+ * Dev mode: skip inbound crypto verification and auto-commit sagas.
25
+ * Default: true. Set to false before going to production — nothing else
26
+ * in your handlers needs to change.
27
+ */
28
+ devMode?: boolean;
29
+ /**
30
+ * URL of a running `aroha dev` registry to auto-register with on startup.
31
+ * Default: http://localhost:3000. Silently ignored if the registry is offline.
32
+ */
33
+ registryUrl?: string;
34
+ }
35
+ export declare class MicroAgent {
36
+ private readonly handlers;
37
+ private server;
38
+ private _did;
39
+ private _privateKey;
40
+ private readonly opts;
41
+ constructor(opts: MicroAgentOptions);
42
+ get did(): string;
43
+ get endpoint(): string;
44
+ /**
45
+ * Register a capability handler. Chainable.
46
+ *
47
+ * @example
48
+ * agent
49
+ * .on("get-weather", async ({ city }) => ({ temp: 22, condition: "sunny" }))
50
+ * .on("book-hotel", async ({ city, nights }) => ({ ref: "HT-123" }));
51
+ */
52
+ on(capability: string, handler: CapabilityHandler): this;
53
+ /** Start listening. Generates an ephemeral Ed25519 DID on each run. */
54
+ start(): Promise<void>;
55
+ /** Gracefully stop the server. */
56
+ stop(): Promise<void>;
57
+ private dispatch;
58
+ private invokeAndReply;
59
+ private tryRegister;
60
+ private printBanner;
61
+ }
62
+ /**
63
+ * Create a Aroha micro-agent.
64
+ *
65
+ * @example
66
+ * import { createAgent } from '@aroha-sdk/micro';
67
+ *
68
+ * const agent = createAgent({ name: 'weather', port: 3001 });
69
+ * agent.on('get-weather', async ({ city }) => ({ temp: 22, condition: 'sunny' }));
70
+ * await agent.start();
71
+ */
72
+ export declare function createAgent(opts: MicroAgentOptions): MicroAgent;
73
+ //# sourceMappingURL=agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAgBH,2EAA2E;AAC3E,MAAM,MAAM,iBAAiB,GAAG,CAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC5B,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AAEhC,MAAM,WAAW,iBAAiB;IAChC,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwC;IACjE,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,IAAI,CAAM;IAClB,OAAO,CAAC,WAAW,CAAkC;IACrD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA8B;gBAEvC,IAAI,EAAE,iBAAiB;IAQnC,IAAI,GAAG,IAAI,MAAM,CAAsB;IACvC,IAAI,QAAQ,IAAI,MAAM,CAAiD;IAEvE;;;;;;;OAOG;IACH,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,IAAI;IAKxD,uEAAuE;IACjE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA8B5B,kCAAkC;IAC5B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;YAMb,QAAQ;YAgCR,cAAc;YAyCd,WAAW;IAmBzB,OAAO,CAAC,WAAW;CAapB;AAID;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,iBAAiB,GAAG,UAAU,CAE/D"}
package/dist/agent.js ADDED
@@ -0,0 +1,167 @@
1
+ /**
2
+ * @aroha-sdk/micro — Express-like Aroha agent API.
3
+ *
4
+ * The full Aroha protocol (Ed25519 DIDs, saga state machine, policy middleware)
5
+ * is designed for zero-trust production networks. @aroha-sdk/micro makes the same
6
+ * protocol accessible in 5 lines for local development and hackathons.
7
+ *
8
+ * Dev mode (default):
9
+ * - Ed25519 signing is performed but VERIFICATION is skipped on inbound msgs
10
+ * - ArohaReserve → auto-commits (single-call instead of two-phase saga)
11
+ * - Agent self-registers with the local `aroha dev` sandbox if it is running
12
+ *
13
+ * Production mode (devMode: false):
14
+ * - Full signature verification re-enabled; nothing else changes in your code
15
+ */
16
+ import { ArohaServer, generateDID, buildEnvelope, ArohaErrorCode, } from "@aroha-sdk/core";
17
+ // ─── MicroAgent ───────────────────────────────────────────────────────────────
18
+ export class MicroAgent {
19
+ handlers = new Map();
20
+ server = null;
21
+ _did = "";
22
+ _privateKey = new Uint8Array(32);
23
+ opts;
24
+ constructor(opts) {
25
+ this.opts = {
26
+ devMode: true,
27
+ registryUrl: "http://localhost:3000",
28
+ ...opts,
29
+ };
30
+ }
31
+ get did() { return this._did; }
32
+ get endpoint() { return `http://localhost:${this.opts.port}`; }
33
+ /**
34
+ * Register a capability handler. Chainable.
35
+ *
36
+ * @example
37
+ * agent
38
+ * .on("get-weather", async ({ city }) => ({ temp: 22, condition: "sunny" }))
39
+ * .on("book-hotel", async ({ city, nights }) => ({ ref: "HT-123" }));
40
+ */
41
+ on(capability, handler) {
42
+ this.handlers.set(capability, handler);
43
+ return this;
44
+ }
45
+ /** Start listening. Generates an ephemeral Ed25519 DID on each run. */
46
+ async start() {
47
+ const endpoint = `${this.endpoint}/aroha/v1`;
48
+ const identity = await generateDID(this.opts.name, endpoint);
49
+ this._did = identity.did;
50
+ this._privateKey = identity.privateKey;
51
+ const knownPublicKeys = new Map();
52
+ knownPublicKeys.set(this._did, identity.publicKey);
53
+ this.server = new ArohaServer({
54
+ agentDID: this._did,
55
+ didDocument: identity.document,
56
+ port: this.opts.port,
57
+ devMode: this.opts.devMode,
58
+ resolvePublicKey: async (senderDID) => {
59
+ // In dev mode the ArohaServer short-circuits before verifying the key,
60
+ // so this is only reached in production mode.
61
+ return knownPublicKeys.get(senderDID) ?? null;
62
+ },
63
+ onMessage: async (envelope, respond) => this.dispatch(envelope, respond),
64
+ });
65
+ await this.server.start();
66
+ if (this.opts.devMode) {
67
+ await this.tryRegister();
68
+ this.printBanner();
69
+ }
70
+ }
71
+ /** Gracefully stop the server. */
72
+ async stop() {
73
+ await this.server?.stop();
74
+ }
75
+ // ─── Internal dispatch ────────────────────────────────────────────────────
76
+ async dispatch(envelope, respond) {
77
+ const { type, body, from, correlationId } = envelope;
78
+ if (type === "ArohaRequest") {
79
+ const { capability, params = {} } = body;
80
+ await this.invokeAndReply(capability, params, from, correlationId, respond, "ArohaResponse");
81
+ return;
82
+ }
83
+ if (type === "ArohaReserve") {
84
+ if (this.opts.devMode) {
85
+ // Dev mode: skip two-phase saga, execute immediately and return CommitAck
86
+ const { capability, params = {} } = body;
87
+ await this.invokeAndReply(capability, params, from, correlationId, respond, "ArohaCommitAck");
88
+ }
89
+ else {
90
+ // Production: caller must implement full saga handlers via ArohaServer directly
91
+ const err = await buildEnvelope("ArohaError", this._did, from, { code: ArohaErrorCode.ReservationFailed, message: "Saga not implemented — use ArohaServer directly for production sagas", retryable: false }, correlationId, this._privateKey);
92
+ respond(err);
93
+ }
94
+ return;
95
+ }
96
+ // Silently ignore other message types (ArohaCancel, ArohaSatisfactionSignal, etc.)
97
+ }
98
+ async invokeAndReply(capability, params, from, correlationId, respond, successType) {
99
+ const handler = this.handlers.get(capability);
100
+ if (!handler) {
101
+ respond(await buildEnvelope("ArohaError", this._did, from, { code: ArohaErrorCode.UnknownCapability, message: `Unknown capability: ${capability}`, retryable: false }, correlationId, this._privateKey));
102
+ return;
103
+ }
104
+ try {
105
+ const raw = await handler(params);
106
+ const result = (raw !== null && typeof raw === "object" ? raw : { value: raw });
107
+ if (successType === "ArohaResponse") {
108
+ const responseBody = { capability, result };
109
+ respond(await buildEnvelope("ArohaResponse", this._did, from, responseBody, correlationId, this._privateKey));
110
+ }
111
+ else {
112
+ const ackBody = { reservationToken: `dev-${Date.now()}`, result };
113
+ respond(await buildEnvelope("ArohaCommitAck", this._did, from, ackBody, correlationId, this._privateKey));
114
+ }
115
+ }
116
+ catch (err) {
117
+ respond(await buildEnvelope("ArohaError", this._did, from, { code: ArohaErrorCode.InternalError, message: String(err), retryable: true }, correlationId, this._privateKey));
118
+ }
119
+ }
120
+ // ─── Dev sandbox integration ──────────────────────────────────────────────
121
+ async tryRegister() {
122
+ try {
123
+ await fetch(`${this.opts.registryUrl}/registry/register`, {
124
+ method: "POST",
125
+ headers: { "Content-Type": "application/json" },
126
+ body: JSON.stringify({
127
+ did: this._did,
128
+ endpoint: this.endpoint,
129
+ capabilities: [...this.handlers.keys()],
130
+ name: this.opts.name,
131
+ registeredAt: new Date().toISOString(),
132
+ }),
133
+ signal: AbortSignal.timeout(600),
134
+ });
135
+ }
136
+ catch {
137
+ // `aroha dev` may not be running — that's fine, agents work standalone
138
+ }
139
+ }
140
+ printBanner() {
141
+ const caps = [...this.handlers.keys()].join(", ") || "(none yet)";
142
+ const W = "\x1b[33m"; // yellow
143
+ const G = "\x1b[32m"; // green
144
+ const C = "\x1b[36m"; // cyan
145
+ const R = "\x1b[0m";
146
+ console.log(`${G}✓${R} ${C}${this.opts.name}${R} ready`);
147
+ console.log(` endpoint ${this.endpoint}/aroha/v1`);
148
+ console.log(` DID ${this._did}`);
149
+ console.log(` capabilities ${caps}`);
150
+ console.log(` mode ${W}dev${R} — flip devMode: false for production\n`);
151
+ }
152
+ }
153
+ // ─── Factory ──────────────────────────────────────────────────────────────────
154
+ /**
155
+ * Create a Aroha micro-agent.
156
+ *
157
+ * @example
158
+ * import { createAgent } from '@aroha-sdk/micro';
159
+ *
160
+ * const agent = createAgent({ name: 'weather', port: 3001 });
161
+ * agent.on('get-weather', async ({ city }) => ({ temp: 22, condition: 'sunny' }));
162
+ * await agent.start();
163
+ */
164
+ export function createAgent(opts) {
165
+ return new MicroAgent(opts);
166
+ }
167
+ //# sourceMappingURL=agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,WAAW,EACX,WAAW,EACX,aAAa,EACb,cAAc,GAMf,MAAM,iBAAiB,CAAC;AA2BzB,iFAAiF;AAEjF,MAAM,OAAO,UAAU;IACJ,QAAQ,GAAG,IAAI,GAAG,EAA6B,CAAC;IACzD,MAAM,GAAuB,IAAI,CAAC;IAClC,IAAI,GAAG,EAAE,CAAC;IACV,WAAW,GAAe,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IACpC,IAAI,CAA8B;IAEnD,YAAY,IAAuB;QACjC,IAAI,CAAC,IAAI,GAAG;YACV,OAAO,EAAE,IAAI;YACb,WAAW,EAAE,uBAAuB;YACpC,GAAG,IAAI;SACR,CAAC;IACJ,CAAC;IAED,IAAI,GAAG,KAAa,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,IAAI,QAAQ,KAAa,OAAO,oBAAoB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,C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QAClE,MAAM,CAAC,GAAG,UAAU,CAAC,CAAE,SAAS;QAChC,MAAM,CAAC,GAAG,UAAU,CAAC,CAAE,QAAQ;QAC/B,MAAM,CAAC,GAAG,UAAU,CAAC,CAAE,OAAO;QAC9B,MAAM,CAAC,GAAG,SAAS,CAAC;QAEpB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC;QACzD,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,CAAC,QAAQ,WAAW,CAAC,CAAC;QACxD,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAC3C,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,EAAE,CAAC,CAAC;QACtC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,MAAM,CAAC,yCAAyC,CAAC,CAAC;IACnF,CAAC;CACF;AAED,iFAAiF;AAEjF;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CAAC,IAAuB;IACjD,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { createAgent, MicroAgent } from "./agent.js";
2
+ export type { MicroAgentOptions, CapabilityHandler } from "./agent.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACrD,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { createAgent, MicroAgent } from "./agent.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@aroha-sdk/micro",
3
+ "version": "1.0.0",
4
+ "description": "Express-like one-file API for Aroha agents — build a multi-agent app in 5 lines",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": "./dist/index.js"
10
+ },
11
+ "files": ["dist"],
12
+ "scripts": {
13
+ "build": "tsc -p tsconfig.json",
14
+ "dev": "tsc -p tsconfig.json --watch",
15
+ "test": "vitest run --passWithNoTests"
16
+ },
17
+ "dependencies": {
18
+ "@aroha-sdk/core": "^1.0.0"
19
+ },
20
+ "devDependencies": {
21
+ "@types/node": "^20.14.0",
22
+ "typescript": "^5.4.5",
23
+ "vitest": "^1.6.0"
24
+ },
25
+ "keywords": ["aroha", "agent", "micro", "dev"],
26
+ "engines": {
27
+ "node": ">=22.0.0"
28
+ }
29
+ }