@rookdaemon/agora 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 (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +66 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +347 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/identity/keypair.d.ts +42 -0
  8. package/dist/identity/keypair.d.ts.map +1 -0
  9. package/dist/identity/keypair.js +83 -0
  10. package/dist/identity/keypair.js.map +1 -0
  11. package/dist/index.d.ts +9 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +9 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/message/envelope.d.ts +58 -0
  16. package/dist/message/envelope.d.ts.map +1 -0
  17. package/dist/message/envelope.js +83 -0
  18. package/dist/message/envelope.js.map +1 -0
  19. package/dist/registry/capability.d.ts +44 -0
  20. package/dist/registry/capability.d.ts.map +1 -0
  21. package/dist/registry/capability.js +94 -0
  22. package/dist/registry/capability.js.map +1 -0
  23. package/dist/registry/messages.d.ts +50 -0
  24. package/dist/registry/messages.d.ts.map +1 -0
  25. package/dist/registry/messages.js +2 -0
  26. package/dist/registry/messages.js.map +1 -0
  27. package/dist/registry/peer-store.d.ts +56 -0
  28. package/dist/registry/peer-store.d.ts.map +1 -0
  29. package/dist/registry/peer-store.js +92 -0
  30. package/dist/registry/peer-store.js.map +1 -0
  31. package/dist/registry/peer.d.ts +20 -0
  32. package/dist/registry/peer.d.ts.map +1 -0
  33. package/dist/registry/peer.js +2 -0
  34. package/dist/registry/peer.js.map +1 -0
  35. package/dist/transport/http.d.ts +41 -0
  36. package/dist/transport/http.d.ts.map +1 -0
  37. package/dist/transport/http.js +99 -0
  38. package/dist/transport/http.js.map +1 -0
  39. package/dist/transport/peer-config.d.ts +33 -0
  40. package/dist/transport/peer-config.d.ts.map +1 -0
  41. package/dist/transport/peer-config.js +41 -0
  42. package/dist/transport/peer-config.js.map +1 -0
  43. package/package.json +38 -0
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Message types on the Agora network.
3
+ * Every piece of data flowing between agents is wrapped in an envelope.
4
+ */
5
+ export type MessageType = 'announce' | 'discover' | 'request' | 'response' | 'publish' | 'subscribe' | 'verify' | 'ack' | 'error';
6
+ /**
7
+ * The signed envelope that wraps every message on the network.
8
+ * Content-addressed: the ID is the hash of the canonical payload.
9
+ * Signed: every envelope carries a signature from the sender's private key.
10
+ */
11
+ export interface Envelope<T = unknown> {
12
+ /** Content-addressed ID: SHA-256 hash of canonical payload */
13
+ id: string;
14
+ /** Message type */
15
+ type: MessageType;
16
+ /** Sender's public key (hex-encoded ed25519) */
17
+ sender: string;
18
+ /** Unix timestamp (ms) when the message was created */
19
+ timestamp: number;
20
+ /** Optional: ID of the message this is responding to */
21
+ inReplyTo?: string;
22
+ /** The actual payload */
23
+ payload: T;
24
+ /** ed25519 signature over the canonical form (hex-encoded) */
25
+ signature: string;
26
+ }
27
+ /**
28
+ * Canonical form of an envelope for signing/hashing.
29
+ * Deterministic JSON serialization: recursively sorted keys, no whitespace.
30
+ */
31
+ export declare function canonicalize(type: MessageType, sender: string, timestamp: number, payload: unknown, inReplyTo?: string): string;
32
+ /**
33
+ * Compute the content-addressed ID for a message.
34
+ */
35
+ export declare function computeId(canonical: string): string;
36
+ /**
37
+ * Create a signed envelope.
38
+ * @param type - Message type
39
+ * @param sender - Sender's public key (hex)
40
+ * @param privateKey - Sender's private key (hex) for signing
41
+ * @param payload - The message payload
42
+ * @param inReplyTo - Optional ID of the message being replied to
43
+ * @returns A signed Envelope
44
+ */
45
+ export declare function createEnvelope<T>(type: MessageType, sender: string, privateKey: string, payload: T, inReplyTo?: string): Envelope<T>;
46
+ /**
47
+ * Verify an envelope's integrity and authenticity.
48
+ * Checks:
49
+ * 1. Canonical form matches the ID (content-addressing)
50
+ * 2. Signature is valid for the sender's public key
51
+ *
52
+ * @returns Object with `valid` boolean and optional `reason` for failure
53
+ */
54
+ export declare function verifyEnvelope(envelope: Envelope): {
55
+ valid: boolean;
56
+ reason?: string;
57
+ };
58
+ //# sourceMappingURL=envelope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../../src/message/envelope.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,MAAM,WAAW,GACnB,UAAU,GACV,UAAU,GACV,SAAS,GACT,UAAU,GACV,SAAS,GACT,WAAW,GACX,QAAQ,GACR,KAAK,GACL,OAAO,CAAC;AAEZ;;;;GAIG;AACH,MAAM,WAAW,QAAQ,CAAC,CAAC,GAAG,OAAO;IACnC,8DAA8D;IAC9D,EAAE,EAAE,MAAM,CAAC;IACX,mBAAmB;IACnB,IAAI,EAAE,WAAW,CAAC;IAClB,gDAAgD;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yBAAyB;IACzB,OAAO,EAAE,CAAC,CAAC;IACX,8DAA8D;IAC9D,SAAS,EAAE,MAAM,CAAC;CACnB;AAgBD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAM/H;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,CAAC,EACV,SAAS,CAAC,EAAE,MAAM,GACjB,QAAQ,CAAC,CAAC,CAAC,CAeb;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAmBtF"}
@@ -0,0 +1,83 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { signMessage, verifySignature } from '../identity/keypair.js';
3
+ /**
4
+ * Deterministic JSON serialization with recursively sorted keys.
5
+ */
6
+ function stableStringify(value) {
7
+ if (value === null || value === undefined)
8
+ return JSON.stringify(value);
9
+ if (typeof value !== 'object')
10
+ return JSON.stringify(value);
11
+ if (Array.isArray(value)) {
12
+ return '[' + value.map(stableStringify).join(',') + ']';
13
+ }
14
+ const keys = Object.keys(value).sort();
15
+ const pairs = keys.map(k => JSON.stringify(k) + ':' + stableStringify(value[k]));
16
+ return '{' + pairs.join(',') + '}';
17
+ }
18
+ /**
19
+ * Canonical form of an envelope for signing/hashing.
20
+ * Deterministic JSON serialization: recursively sorted keys, no whitespace.
21
+ */
22
+ export function canonicalize(type, sender, timestamp, payload, inReplyTo) {
23
+ const obj = { payload, sender, timestamp, type };
24
+ if (inReplyTo !== undefined) {
25
+ obj.inReplyTo = inReplyTo;
26
+ }
27
+ return stableStringify(obj);
28
+ }
29
+ /**
30
+ * Compute the content-addressed ID for a message.
31
+ */
32
+ export function computeId(canonical) {
33
+ return createHash('sha256').update(canonical).digest('hex');
34
+ }
35
+ /**
36
+ * Create a signed envelope.
37
+ * @param type - Message type
38
+ * @param sender - Sender's public key (hex)
39
+ * @param privateKey - Sender's private key (hex) for signing
40
+ * @param payload - The message payload
41
+ * @param inReplyTo - Optional ID of the message being replied to
42
+ * @returns A signed Envelope
43
+ */
44
+ export function createEnvelope(type, sender, privateKey, payload, inReplyTo) {
45
+ const timestamp = Date.now();
46
+ const canonical = canonicalize(type, sender, timestamp, payload, inReplyTo);
47
+ const id = computeId(canonical);
48
+ const signature = signMessage(canonical, privateKey);
49
+ return {
50
+ id,
51
+ type,
52
+ sender,
53
+ timestamp,
54
+ ...(inReplyTo !== undefined ? { inReplyTo } : {}),
55
+ payload,
56
+ signature,
57
+ };
58
+ }
59
+ /**
60
+ * Verify an envelope's integrity and authenticity.
61
+ * Checks:
62
+ * 1. Canonical form matches the ID (content-addressing)
63
+ * 2. Signature is valid for the sender's public key
64
+ *
65
+ * @returns Object with `valid` boolean and optional `reason` for failure
66
+ */
67
+ export function verifyEnvelope(envelope) {
68
+ const { id, type, sender, timestamp, payload, signature, inReplyTo } = envelope;
69
+ // Reconstruct canonical form
70
+ const canonical = canonicalize(type, sender, timestamp, payload, inReplyTo);
71
+ // Check content-addressed ID
72
+ const expectedId = computeId(canonical);
73
+ if (id !== expectedId) {
74
+ return { valid: false, reason: 'id_mismatch' };
75
+ }
76
+ // Check signature
77
+ const sigValid = verifySignature(canonical, signature, sender);
78
+ if (!sigValid) {
79
+ return { valid: false, reason: 'signature_invalid' };
80
+ }
81
+ return { valid: true };
82
+ }
83
+ //# sourceMappingURL=envelope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelope.js","sourceRoot":"","sources":["../../src/message/envelope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAuCtE;;GAEG;AACH,SAAS,eAAe,CAAC,KAAc;IACrC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACxE,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC5D,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;IAC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EAAE,UAAU,CAAC,CAAC;IAErD,OAAO;QACL,EAAE;QACF,IAAI;QACJ,MAAM;QACN,SAAS;QACT,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjD,OAAO;QACP,SAAS;KACV,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,QAAkB;IAC/C,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,QAAQ,CAAC;IAEhF,6BAA6B;IAC7B,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IAE5E,6BAA6B;IAC7B,MAAM,UAAU,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;IACxC,IAAI,EAAE,KAAK,UAAU,EAAE,CAAC;QACtB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;IACjD,CAAC;IAED,kBAAkB;IAClB,MAAM,QAAQ,GAAG,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAC/D,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC;IACvD,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * A capability describes something an agent can do
3
+ */
4
+ export interface Capability {
5
+ /** Unique ID (content-addressed hash of name + version + schema) */
6
+ id: string;
7
+ /** Human-readable name: 'code-review', 'summarization', 'translation' */
8
+ name: string;
9
+ /** Semantic version */
10
+ version: string;
11
+ /** What the capability does */
12
+ description: string;
13
+ /** JSON Schema for expected input */
14
+ inputSchema?: object;
15
+ /** JSON Schema for expected output */
16
+ outputSchema?: object;
17
+ /** Discovery tags: ['code', 'typescript', 'review'] */
18
+ tags: string[];
19
+ }
20
+ /**
21
+ * Creates a capability with a content-addressed ID.
22
+ *
23
+ * @param name - Human-readable capability name
24
+ * @param version - Semantic version string
25
+ * @param description - Description of what the capability does
26
+ * @param options - Optional input/output schemas and tags
27
+ * @returns A Capability object with computed ID
28
+ */
29
+ export declare function createCapability(name: string, version: string, description: string, options?: {
30
+ inputSchema?: object;
31
+ outputSchema?: object;
32
+ tags?: string[];
33
+ }): Capability;
34
+ /**
35
+ * Validates that a capability has all required fields.
36
+ *
37
+ * @param capability - The capability to validate
38
+ * @returns Object with `valid` boolean and optional `errors` array
39
+ */
40
+ export declare function validateCapability(capability: unknown): {
41
+ valid: boolean;
42
+ errors?: string[];
43
+ };
44
+ //# sourceMappingURL=capability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../../src/registry/capability.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,oEAAoE;IACpE,EAAE,EAAE,MAAM,CAAC;IACX,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,qCAAqC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uDAAuD;IACvD,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AA+BD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE;IACP,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACZ,GACL,UAAU,CAcZ;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,OAAO,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CA4C7F"}
@@ -0,0 +1,94 @@
1
+ import { createHash } from 'node:crypto';
2
+ /**
3
+ * Deterministic JSON serialization for capability hashing.
4
+ * Recursively sorts object keys.
5
+ */
6
+ function stableStringify(value) {
7
+ if (value === null || value === undefined)
8
+ return JSON.stringify(value);
9
+ if (typeof value !== 'object')
10
+ return JSON.stringify(value);
11
+ if (Array.isArray(value)) {
12
+ return '[' + value.map(stableStringify).join(',') + ']';
13
+ }
14
+ const keys = Object.keys(value).sort();
15
+ const pairs = keys.map(k => JSON.stringify(k) + ':' + stableStringify(value[k]));
16
+ return '{' + pairs.join(',') + '}';
17
+ }
18
+ /**
19
+ * Compute content-addressed ID for a capability based on name, version, and schemas.
20
+ */
21
+ function computeCapabilityId(name, version, inputSchema, outputSchema) {
22
+ const data = {
23
+ name,
24
+ version,
25
+ ...(inputSchema !== undefined ? { inputSchema } : {}),
26
+ ...(outputSchema !== undefined ? { outputSchema } : {}),
27
+ };
28
+ const canonical = stableStringify(data);
29
+ return createHash('sha256').update(canonical).digest('hex');
30
+ }
31
+ /**
32
+ * Creates a capability with a content-addressed ID.
33
+ *
34
+ * @param name - Human-readable capability name
35
+ * @param version - Semantic version string
36
+ * @param description - Description of what the capability does
37
+ * @param options - Optional input/output schemas and tags
38
+ * @returns A Capability object with computed ID
39
+ */
40
+ export function createCapability(name, version, description, options = {}) {
41
+ const { inputSchema, outputSchema, tags = [] } = options;
42
+ const id = computeCapabilityId(name, version, inputSchema, outputSchema);
43
+ return {
44
+ id,
45
+ name,
46
+ version,
47
+ description,
48
+ ...(inputSchema !== undefined ? { inputSchema } : {}),
49
+ ...(outputSchema !== undefined ? { outputSchema } : {}),
50
+ tags,
51
+ };
52
+ }
53
+ /**
54
+ * Validates that a capability has all required fields.
55
+ *
56
+ * @param capability - The capability to validate
57
+ * @returns Object with `valid` boolean and optional `errors` array
58
+ */
59
+ export function validateCapability(capability) {
60
+ const errors = [];
61
+ if (!capability || typeof capability !== 'object') {
62
+ return { valid: false, errors: ['Capability must be an object'] };
63
+ }
64
+ const cap = capability;
65
+ if (!cap.id || typeof cap.id !== 'string') {
66
+ errors.push('Missing or invalid field: id (must be a string)');
67
+ }
68
+ if (!cap.name || typeof cap.name !== 'string') {
69
+ errors.push('Missing or invalid field: name (must be a string)');
70
+ }
71
+ if (!cap.version || typeof cap.version !== 'string') {
72
+ errors.push('Missing or invalid field: version (must be a string)');
73
+ }
74
+ if (!cap.description || typeof cap.description !== 'string') {
75
+ errors.push('Missing or invalid field: description (must be a string)');
76
+ }
77
+ if (!Array.isArray(cap.tags)) {
78
+ errors.push('Missing or invalid field: tags (must be an array)');
79
+ }
80
+ else if (!cap.tags.every(tag => typeof tag === 'string')) {
81
+ errors.push('Invalid field: tags (all elements must be strings)');
82
+ }
83
+ if (cap.inputSchema !== undefined && (typeof cap.inputSchema !== 'object' || cap.inputSchema === null)) {
84
+ errors.push('Invalid field: inputSchema (must be an object)');
85
+ }
86
+ if (cap.outputSchema !== undefined && (typeof cap.outputSchema !== 'object' || cap.outputSchema === null)) {
87
+ errors.push('Invalid field: outputSchema (must be an object)');
88
+ }
89
+ if (errors.length > 0) {
90
+ return { valid: false, errors };
91
+ }
92
+ return { valid: true };
93
+ }
94
+ //# sourceMappingURL=capability.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability.js","sourceRoot":"","sources":["../../src/registry/capability.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAsBzC;;;GAGG;AACH,SAAS,eAAe,CAAC,KAAc;IACrC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO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M,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAC;IACtE,CAAC;IAED,IAAI,CAAC,GAAG,CAAC,WAAW,IAAI,OAAO,GAAG,CAAC,WAAW,KAAK,QAAQ,EAAE,CAAC;QAC5D,MAAM,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAC;IAC1E,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7B,MAAM,CAAC,IAAI,CAAC,mDAAmD,CAAC,CAAC;IACnE,CAAC;SAAM,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,EAAE,CAAC;QAC3D,MAAM,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC;IACpE,CAAC;IAED,IAAI,GAAG,CAAC,WAAW,KAAK,SAAS,IAAI,CAAC,OAAO,GAAG,CAAC,WAAW,KAAK,QAAQ,IAAI,GAAG,CAAC,WAAW,KAAK,IAAI,CAAC,EAAE,CAAC;QACvG,MAAM,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC;IAChE,CAAC;IAED,IAAI,GAAG,CAAC,YAAY,KAAK,SAAS,IAAI,CAAC,OAAO,GAAG,CAAC,YAAY,KAAK,QAAQ,IAAI,GAAG,CAAC,YAAY,KAAK,IAAI,CAAC,EAAE,CAAC;QAC1G,MAAM,CAAC,IAAI,CAAC,iDAAiD,CAAC,CAAC;IACjE,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAClC,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC"}
@@ -0,0 +1,50 @@
1
+ import type { Capability } from './capability.js';
2
+ /**
3
+ * Payload for 'announce' messages.
4
+ * An agent publishes its capabilities and metadata to the network.
5
+ */
6
+ export interface AnnouncePayload {
7
+ /** Capabilities this agent offers */
8
+ capabilities: Capability[];
9
+ /** Optional metadata about the agent */
10
+ metadata?: {
11
+ /** Human-readable agent name */
12
+ name?: string;
13
+ /** Agent software version */
14
+ version?: string;
15
+ };
16
+ }
17
+ /**
18
+ * Payload for 'discover' messages.
19
+ * An agent queries the network to find peers with specific capabilities.
20
+ */
21
+ export interface DiscoverPayload {
22
+ /** Query parameters for discovery */
23
+ query: {
24
+ /** Filter by capability name */
25
+ capabilityName?: string;
26
+ /** Filter by capability tag */
27
+ tag?: string;
28
+ };
29
+ }
30
+ /**
31
+ * Payload for responses to 'discover' messages.
32
+ * Returns a list of peers matching the discovery query.
33
+ */
34
+ export interface DiscoverResponsePayload {
35
+ /** Peers matching the discovery query */
36
+ peers: Array<{
37
+ /** Public key of the peer */
38
+ publicKey: string;
39
+ /** Capabilities the peer offers */
40
+ capabilities: Capability[];
41
+ /** Optional metadata about the peer */
42
+ metadata?: {
43
+ /** Human-readable peer name */
44
+ name?: string;
45
+ /** Peer software version */
46
+ version?: string;
47
+ };
48
+ }>;
49
+ }
50
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/registry/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,qCAAqC;IACrC,YAAY,EAAE,UAAU,EAAE,CAAC;IAC3B,wCAAwC;IACxC,QAAQ,CAAC,EAAE;QACT,gCAAgC;QAChC,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,6BAA6B;QAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,qCAAqC;IACrC,KAAK,EAAE;QACL,gCAAgC;QAChC,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,+BAA+B;QAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,yCAAyC;IACzC,KAAK,EAAE,KAAK,CAAC;QACX,6BAA6B;QAC7B,SAAS,EAAE,MAAM,CAAC;QAClB,mCAAmC;QACnC,YAAY,EAAE,UAAU,EAAE,CAAC;QAC3B,uCAAuC;QACvC,QAAQ,CAAC,EAAE;YACT,+BAA+B;YAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,4BAA4B;YAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;SAClB,CAAC;KACH,CAAC,CAAC;CACJ"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/registry/messages.ts"],"names":[],"mappings":""}
@@ -0,0 +1,56 @@
1
+ import type { Peer } from './peer.js';
2
+ /**
3
+ * In-memory store for known peers on the network
4
+ */
5
+ export declare class PeerStore {
6
+ private peers;
7
+ /**
8
+ * Add or update a peer in the store.
9
+ * If a peer with the same publicKey exists, it will be updated.
10
+ *
11
+ * @param peer - The peer to add or update
12
+ */
13
+ addOrUpdatePeer(peer: Peer): void;
14
+ /**
15
+ * Remove a peer from the store.
16
+ *
17
+ * @param publicKey - The public key of the peer to remove
18
+ * @returns true if the peer was removed, false if it didn't exist
19
+ */
20
+ removePeer(publicKey: string): boolean;
21
+ /**
22
+ * Get a peer by their public key.
23
+ *
24
+ * @param publicKey - The public key of the peer to retrieve
25
+ * @returns The peer if found, undefined otherwise
26
+ */
27
+ getPeer(publicKey: string): Peer | undefined;
28
+ /**
29
+ * Find all peers that offer a specific capability by name.
30
+ *
31
+ * @param name - The capability name to search for
32
+ * @returns Array of peers that have a capability with the given name
33
+ */
34
+ findByCapability(name: string): Peer[];
35
+ /**
36
+ * Find all peers that have capabilities with a specific tag.
37
+ *
38
+ * @param tag - The tag to search for
39
+ * @returns Array of peers that have at least one capability with the given tag
40
+ */
41
+ findByTag(tag: string): Peer[];
42
+ /**
43
+ * Get all peers in the store.
44
+ *
45
+ * @returns Array of all peers
46
+ */
47
+ allPeers(): Peer[];
48
+ /**
49
+ * Remove peers that haven't been seen within the specified time window.
50
+ *
51
+ * @param maxAgeMs - Maximum age in milliseconds. Peers older than this will be removed.
52
+ * @returns Number of peers removed
53
+ */
54
+ prune(maxAgeMs: number): number;
55
+ }
56
+ //# sourceMappingURL=peer-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"peer-store.d.ts","sourceRoot":"","sources":["../../src/registry/peer-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC;;GAEG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,KAAK,CAAgC;IAE7C;;;;;OAKG;IACH,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAIjC;;;;;OAKG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAItC;;;;;OAKG;IACH,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IAI5C;;;;;OAKG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE;IAatC;;;;;OAKG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE;IAa9B;;;;OAIG;IACH,QAAQ,IAAI,IAAI,EAAE;IAIlB;;;;;OAKG;IACH,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;CAchC"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * In-memory store for known peers on the network
3
+ */
4
+ export class PeerStore {
5
+ peers = new Map();
6
+ /**
7
+ * Add or update a peer in the store.
8
+ * If a peer with the same publicKey exists, it will be updated.
9
+ *
10
+ * @param peer - The peer to add or update
11
+ */
12
+ addOrUpdatePeer(peer) {
13
+ this.peers.set(peer.publicKey, peer);
14
+ }
15
+ /**
16
+ * Remove a peer from the store.
17
+ *
18
+ * @param publicKey - The public key of the peer to remove
19
+ * @returns true if the peer was removed, false if it didn't exist
20
+ */
21
+ removePeer(publicKey) {
22
+ return this.peers.delete(publicKey);
23
+ }
24
+ /**
25
+ * Get a peer by their public key.
26
+ *
27
+ * @param publicKey - The public key of the peer to retrieve
28
+ * @returns The peer if found, undefined otherwise
29
+ */
30
+ getPeer(publicKey) {
31
+ return this.peers.get(publicKey);
32
+ }
33
+ /**
34
+ * Find all peers that offer a specific capability by name.
35
+ *
36
+ * @param name - The capability name to search for
37
+ * @returns Array of peers that have a capability with the given name
38
+ */
39
+ findByCapability(name) {
40
+ const result = [];
41
+ for (const peer of this.peers.values()) {
42
+ const hasCapability = peer.capabilities.some(cap => cap.name === name);
43
+ if (hasCapability) {
44
+ result.push(peer);
45
+ }
46
+ }
47
+ return result;
48
+ }
49
+ /**
50
+ * Find all peers that have capabilities with a specific tag.
51
+ *
52
+ * @param tag - The tag to search for
53
+ * @returns Array of peers that have at least one capability with the given tag
54
+ */
55
+ findByTag(tag) {
56
+ const result = [];
57
+ for (const peer of this.peers.values()) {
58
+ const hasTag = peer.capabilities.some(cap => cap.tags.includes(tag));
59
+ if (hasTag) {
60
+ result.push(peer);
61
+ }
62
+ }
63
+ return result;
64
+ }
65
+ /**
66
+ * Get all peers in the store.
67
+ *
68
+ * @returns Array of all peers
69
+ */
70
+ allPeers() {
71
+ return Array.from(this.peers.values());
72
+ }
73
+ /**
74
+ * Remove peers that haven't been seen within the specified time window.
75
+ *
76
+ * @param maxAgeMs - Maximum age in milliseconds. Peers older than this will be removed.
77
+ * @returns Number of peers removed
78
+ */
79
+ prune(maxAgeMs) {
80
+ const now = Date.now();
81
+ const cutoff = now - maxAgeMs;
82
+ let removed = 0;
83
+ for (const [publicKey, peer] of this.peers.entries()) {
84
+ if (peer.lastSeen < cutoff) {
85
+ this.peers.delete(publicKey);
86
+ removed++;
87
+ }
88
+ }
89
+ return removed;
90
+ }
91
+ }
92
+ //# sourceMappingURL=peer-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"peer-store.js","sourceRoot":"","sources":["../../src/registry/peer-store.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,SAAS;IACZ,KAAK,GAAsB,IAAI,GAAG,EAAE,CAAC;IAE7C;;;;;OAKG;IACH,eAAe,CAAC,IAAU;QACxB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACvC,CAAC;IAED;;;;;OAKG;IACH,UAAU,CAAC,SAAiB;QAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,SAAiB;QACvB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACH,gBAAgB,CAAC,IAAY;QAC3B,MAAM,MAAM,GAAW,EAAE,CAAC;QAE1B,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;YACvC,MAAM,aAAa,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;YACvE,IAAI,aAAa,EAAE,CAAC;gBAClB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACpB,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACH,SAAS,CAAC,GAAW;QACnB,MAAM,MAAM,GAAW,EAAE,CAAC;QAE1B,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;YACvC,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;YACrE,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACpB,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACH,QAAQ;QACN,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IACzC,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,QAAgB;QACpB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,MAAM,MAAM,GAAG,GAAG,GAAG,QAAQ,CAAC;QAC9B,IAAI,OAAO,GAAG,CAAC,CAAC;QAEhB,KAAK,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;YACrD,IAAI,IAAI,CAAC,QAAQ,GAAG,MAAM,EAAE,CAAC;gBAC3B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;gBAC7B,OAAO,EAAE,CAAC;YACZ,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
@@ -0,0 +1,20 @@
1
+ import type { Capability } from './capability.js';
2
+ /**
3
+ * A peer is an agent on the network
4
+ */
5
+ export interface Peer {
6
+ /** Identity (hex-encoded ed25519 public key) */
7
+ publicKey: string;
8
+ /** Capabilities this peer offers */
9
+ capabilities: Capability[];
10
+ /** Unix timestamp (ms) when this peer was last seen */
11
+ lastSeen: number;
12
+ /** Optional metadata about the peer */
13
+ metadata?: {
14
+ /** Human-readable alias */
15
+ name?: string;
16
+ /** Agent software version */
17
+ version?: string;
18
+ };
19
+ }
20
+ //# sourceMappingURL=peer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"peer.d.ts","sourceRoot":"","sources":["../../src/registry/peer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,oCAAoC;IACpC,YAAY,EAAE,UAAU,EAAE,CAAC;IAC3B,uDAAuD;IACvD,QAAQ,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,QAAQ,CAAC,EAAE;QACT,2BAA2B;QAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,6BAA6B;QAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=peer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"peer.js","sourceRoot":"","sources":["../../src/registry/peer.ts"],"names":[],"mappings":""}
@@ -0,0 +1,41 @@
1
+ import { type Envelope, type MessageType } from '../message/envelope.js';
2
+ export interface PeerConfig {
3
+ /** Peer's webhook URL, e.g. http://localhost:18790/hooks */
4
+ url: string;
5
+ /** Peer's webhook auth token */
6
+ token: string;
7
+ /** Peer's public key (hex) for verifying responses */
8
+ publicKey: string;
9
+ }
10
+ export interface TransportConfig {
11
+ /** This agent's keypair */
12
+ identity: {
13
+ publicKey: string;
14
+ privateKey: string;
15
+ };
16
+ /** Known peers */
17
+ peers: Map<string, PeerConfig>;
18
+ }
19
+ /**
20
+ * Send a signed envelope to a peer via HTTP webhook.
21
+ * Creates the envelope, signs it, and POSTs to the peer's /hooks/agent endpoint.
22
+ * Returns the HTTP status code.
23
+ */
24
+ export declare function sendToPeer(config: TransportConfig, peerPublicKey: string, type: MessageType, payload: unknown, inReplyTo?: string): Promise<{
25
+ ok: boolean;
26
+ status: number;
27
+ error?: string;
28
+ }>;
29
+ /**
30
+ * Decode and verify an inbound Agora envelope from a webhook message.
31
+ * Expects the message to start with [AGORA_ENVELOPE] followed by base64.
32
+ * Returns the verified envelope or an error.
33
+ */
34
+ export declare function decodeInboundEnvelope(message: string, knownPeers: Map<string, PeerConfig>): {
35
+ ok: true;
36
+ envelope: Envelope;
37
+ } | {
38
+ ok: false;
39
+ reason: string;
40
+ };
41
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/transport/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAEzG,MAAM,WAAW,UAAU;IACzB,4DAA4D;IAC5D,GAAG,EAAE,MAAM,CAAC;IACZ,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,2BAA2B;IAC3B,QAAQ,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IACpD,kBAAkB;IAClB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CAChC;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,eAAe,EACvB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,OAAO,EAChB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAmD1D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,GAClC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAiDlE"}