oacp-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.
- package/README.md +102 -0
- package/dist/agent.d.ts +201 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +715 -0
- package/dist/agent.js.map +1 -0
- package/dist/config.d.ts +57 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +12 -0
- package/dist/config.js.map +1 -0
- package/dist/crypto.d.ts +56 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/crypto.js +140 -0
- package/dist/crypto.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/trust.d.ts +98 -0
- package/dist/trust.d.ts.map +1 -0
- package/dist/trust.js +123 -0
- package/dist/trust.js.map +1 -0
- package/dist/types.d.ts +147 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +55 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OACP SDK — Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Re-exports and extends the shared OACP types for SDK consumers.
|
|
5
|
+
* These types mirror the Edge Function types but are packaged for npm consumption.
|
|
6
|
+
*/
|
|
7
|
+
export type AgentStatus = 'online' | 'offline' | 'busy';
|
|
8
|
+
export interface AgentCard {
|
|
9
|
+
agent_id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
owner_handle?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
endpoint_url?: string;
|
|
14
|
+
capabilities: string[];
|
|
15
|
+
status: AgentStatus;
|
|
16
|
+
public_key: string;
|
|
17
|
+
protocols_supported: string[];
|
|
18
|
+
metadata: AgentMetadata & Record<string, unknown>;
|
|
19
|
+
last_seen_at: string | null;
|
|
20
|
+
created_at: string;
|
|
21
|
+
updated_at: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Structured metadata for Agent Cards.
|
|
25
|
+
* All fields optional — agents include what's relevant to them.
|
|
26
|
+
*/
|
|
27
|
+
export interface AgentMetadata {
|
|
28
|
+
/** Action specs declaring what this agent can do */
|
|
29
|
+
action_specs?: Array<{
|
|
30
|
+
name: string;
|
|
31
|
+
description: string;
|
|
32
|
+
}>;
|
|
33
|
+
/** Model information — what powers this agent */
|
|
34
|
+
model?: ModelInfo;
|
|
35
|
+
/** Languages this agent can process (ISO 639-1 codes, e.g., ['en', 'es', 'ja']) */
|
|
36
|
+
languages?: string[];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Describes the model powering an agent.
|
|
40
|
+
* Enables model-specific discovery (e.g., "find me a GPT-4o agent").
|
|
41
|
+
*/
|
|
42
|
+
export interface ModelInfo {
|
|
43
|
+
/** Model provider (e.g., 'openai', 'anthropic', 'google', 'stability', 'local') */
|
|
44
|
+
provider?: string;
|
|
45
|
+
/** Model name (e.g., 'gpt-4o', 'claude-sonnet-4-20250514', 'stable-diffusion-xl') */
|
|
46
|
+
name?: string;
|
|
47
|
+
/** Model modalities — what input/output types it supports */
|
|
48
|
+
modalities?: Array<'text' | 'image' | 'audio' | 'video' | 'code' | 'geospatial'>;
|
|
49
|
+
}
|
|
50
|
+
export interface RegisterRequest {
|
|
51
|
+
name: string;
|
|
52
|
+
owner_handle?: string;
|
|
53
|
+
description?: string;
|
|
54
|
+
endpoint_url?: string;
|
|
55
|
+
capabilities: string[];
|
|
56
|
+
public_key: string;
|
|
57
|
+
protocols_supported?: string[];
|
|
58
|
+
metadata?: Record<string, unknown>;
|
|
59
|
+
}
|
|
60
|
+
export interface RegisterResponse {
|
|
61
|
+
agent_id: string;
|
|
62
|
+
registry_token: string;
|
|
63
|
+
created_at: string;
|
|
64
|
+
}
|
|
65
|
+
export interface ReregisterResponse {
|
|
66
|
+
agent_id: string;
|
|
67
|
+
updated: boolean;
|
|
68
|
+
last_seen_at: string;
|
|
69
|
+
}
|
|
70
|
+
export interface HeartbeatRequest {
|
|
71
|
+
agent_id: string;
|
|
72
|
+
}
|
|
73
|
+
export interface HeartbeatResponse {
|
|
74
|
+
agent_id: string;
|
|
75
|
+
status: AgentStatus;
|
|
76
|
+
last_seen_at: string;
|
|
77
|
+
}
|
|
78
|
+
export interface DiscoverQuery {
|
|
79
|
+
capability?: string;
|
|
80
|
+
status?: AgentStatus;
|
|
81
|
+
owner_handle?: string;
|
|
82
|
+
page?: number;
|
|
83
|
+
page_size?: number;
|
|
84
|
+
}
|
|
85
|
+
export interface DiscoverResponse {
|
|
86
|
+
agents: AgentCard[];
|
|
87
|
+
total: number;
|
|
88
|
+
page: number;
|
|
89
|
+
page_size: number;
|
|
90
|
+
}
|
|
91
|
+
export type MessageType = 'task_request' | 'task_ack' | 'task_result' | 'task_error';
|
|
92
|
+
export interface MessageEnvelope {
|
|
93
|
+
message_id: string;
|
|
94
|
+
sender_agent_id: string;
|
|
95
|
+
recipient_agent_id: string;
|
|
96
|
+
message_type: MessageType;
|
|
97
|
+
payload: Record<string, unknown>;
|
|
98
|
+
signature: string;
|
|
99
|
+
timestamp: string;
|
|
100
|
+
correlation_id?: string;
|
|
101
|
+
sequence?: number;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Content type hints for message payloads.
|
|
105
|
+
* Include as payload.content_type to tell the recipient what kind of data you're sending.
|
|
106
|
+
*/
|
|
107
|
+
export type PayloadContentType = 'text/plain' | 'text/markdown' | 'application/json' | 'image/url' | 'audio/url' | 'video/url' | 'application/geo+json' | 'application/base64' | string;
|
|
108
|
+
/**
|
|
109
|
+
* Payload conventions for binary/large content.
|
|
110
|
+
*
|
|
111
|
+
* Rather than embedding large binary data in the JSON message envelope,
|
|
112
|
+
* agents should use URL references:
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* // Image generation result
|
|
116
|
+
* {
|
|
117
|
+
* content_type: 'image/url',
|
|
118
|
+
* url: 'https://storage.example.com/generated/abc123.png',
|
|
119
|
+
* alt_text: 'A sunset over mountains',
|
|
120
|
+
* width: 1024,
|
|
121
|
+
* height: 1024,
|
|
122
|
+
* }
|
|
123
|
+
*
|
|
124
|
+
* // Audio transcription request
|
|
125
|
+
* {
|
|
126
|
+
* content_type: 'audio/url',
|
|
127
|
+
* url: 'https://storage.example.com/audio/recording.mp3',
|
|
128
|
+
* language: 'en',
|
|
129
|
+
* action: 'transcribe',
|
|
130
|
+
* }
|
|
131
|
+
*
|
|
132
|
+
* // GeoJSON analysis request
|
|
133
|
+
* {
|
|
134
|
+
* content_type: 'application/geo+json',
|
|
135
|
+
* action: 'analyze-region',
|
|
136
|
+
* geojson: { type: 'Feature', geometry: { ... } },
|
|
137
|
+
* }
|
|
138
|
+
*/
|
|
139
|
+
export interface ContentPayload extends Record<string, unknown> {
|
|
140
|
+
content_type?: PayloadContentType;
|
|
141
|
+
url?: string;
|
|
142
|
+
}
|
|
143
|
+
export interface ApiError {
|
|
144
|
+
error: string;
|
|
145
|
+
details?: Record<string, unknown>;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;AAExD,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,MAAM,EAAE,WAAW,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B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AAEX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,WAAW,cAAe,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC7D,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAMD,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "oacp-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TypeScript SDK for the Open Agent Communication Protocol — register, discover, and communicate with AI agents",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"lint": "tsc --noEmit",
|
|
11
|
+
"prepublishOnly": "npm run build",
|
|
12
|
+
"test": "echo \"Tests pending\" && exit 0"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"oacp",
|
|
16
|
+
"agent",
|
|
17
|
+
"ai",
|
|
18
|
+
"protocol",
|
|
19
|
+
"sdk",
|
|
20
|
+
"multi-agent",
|
|
21
|
+
"agent-communication",
|
|
22
|
+
"agent-discovery",
|
|
23
|
+
"interoperability",
|
|
24
|
+
"ed25519",
|
|
25
|
+
"supabase",
|
|
26
|
+
"realtime",
|
|
27
|
+
"a2a"
|
|
28
|
+
],
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/matthewaharris/agora.git",
|
|
33
|
+
"directory": "packages/oacp-sdk"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://github.com/matthewaharris/agora#readme",
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/matthewaharris/agora/issues"
|
|
38
|
+
},
|
|
39
|
+
"author": "matthewaharris",
|
|
40
|
+
"files": [
|
|
41
|
+
"dist/**/*",
|
|
42
|
+
"README.md"
|
|
43
|
+
],
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=20"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@noble/ed25519": "^3.0.0",
|
|
49
|
+
"@noble/hashes": "^1.7.0",
|
|
50
|
+
"@supabase/supabase-js": "^2.49.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"typescript": "^5.7.0"
|
|
54
|
+
}
|
|
55
|
+
}
|