@hirey/hi-mcp-server 0.1.1 → 0.1.2

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,29 @@
1
+ {
2
+ "name": "@hirey/hi-agent-contracts",
3
+ "version": "0.1.8",
4
+ "private": false,
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist/",
10
+ "README.md"
11
+ ],
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "default": "./dist/index.js"
16
+ }
17
+ },
18
+ "scripts": {
19
+ "clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
20
+ "build": "npm run clean && tsc -p tsconfig.json",
21
+ "prepack": "npm run build"
22
+ },
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "devDependencies": {
27
+ "typescript": "^5.4.5"
28
+ }
29
+ }
@@ -0,0 +1,20 @@
1
+ # hi-agent-sdk
2
+
3
+ `hi-agent-sdk` 是 external agent 接入 Hi 的正式 client / stream SDK。
4
+
5
+ ## 当前内容
6
+
7
+ - `HiAgentPlatformClient`:well-known、skills、capabilities、capability call
8
+ - `HiAgentGatewayClient`:register / connect / activate / me / installation / endpoints / subscriptions / test-delivery / claim / fetch / ack
9
+ - `createHiAgentClients()`:先读 well-known,再自动构造 platform + gateway client
10
+ - `exchangeHiAgentClientCredentialsToken()`:用 register 返回的 `client_id/client_secret` 向 gateway `oauth_token_url` 交换短期 access token
11
+ - SSE stream helper
12
+
13
+ ## 使用顺序
14
+
15
+ - 先读取 `/.well-known/hi-agent-platform.json`
16
+ - 再按服务目录访问 skills / capabilities / registry / delivery
17
+ - 如果宿主需要声明自己的收消息方式,使用 register/connect 的 `delivery_capabilities`,或后续调用 `GET/PUT /v1/agents/me/installation`
18
+ - push profile 与 subscription/claim/fetch/ack 可以并行配置,但正式消费确认仍然建议走 claim/fetch/ack
19
+
20
+ 后续如果要支持 webhook 回调签名、自动重连状态机、cursor 持久化,可继续在这里扩展。
@@ -0,0 +1,421 @@
1
+ export type AgentEndpointKind = 'webhook' | 'http_api' | 'pull_stream';
2
+ export type AgentDeliveryProfile = 'generic.event-webhook.v1' | 'openclaw.hooks.agent.v1' | 'openresponses.v1' | 'hi.sse.v1';
3
+ export type AgentInstallationReceivingCapabilityKind = 'pull_stream' | 'claim_ack' | 'generic_webhook' | 'claude_channel' | 'openclaw_hooks' | 'openresponses' | 'local_receiver';
4
+ export type AgentInstallationReceivingCapabilityStatus = 'active' | 'disabled';
5
+ export type AgentEndpointStatus = 'active' | 'disabled';
6
+ export type AgentSubscriptionStatus = 'active' | 'disabled';
7
+ export type AgentEventAckStatus = 'consumed' | 'failed' | 'queued';
8
+ export type AgentGatewayTopic = 'agent.message.created' | 'pairing.created' | 'pairing.updated' | 'listing_matching_session.updated' | 'meeting.negotiation.updated' | 'meeting.execution.requested';
9
+ export type AgentRecord = {
10
+ agent_id: string;
11
+ display_name: string;
12
+ agent_kind: string;
13
+ capabilities: unknown;
14
+ metadata: Record<string, unknown> | null;
15
+ status: 'active' | 'disabled' | 'pending';
16
+ created_at: string;
17
+ updated_at: string;
18
+ };
19
+ export type AgentInstallationRecord = {
20
+ installation_id: string;
21
+ agent_id: string;
22
+ auth_principal: string;
23
+ auth_issuer: string;
24
+ status: 'active' | 'disabled' | 'pending';
25
+ metadata: Record<string, unknown> | null;
26
+ delivery_capabilities: AgentInstallationDeliveryDeclaration | null;
27
+ activated_at: string | null;
28
+ created_at: string;
29
+ updated_at: string;
30
+ };
31
+ export type AgentInstallationReceivingCapabilityInput = {
32
+ kind: AgentInstallationReceivingCapabilityKind;
33
+ status?: AgentInstallationReceivingCapabilityStatus;
34
+ config?: Record<string, unknown> | null;
35
+ };
36
+ export type AgentInstallationDeliveryDeclaration = {
37
+ capabilities: AgentInstallationReceivingCapabilityInput[];
38
+ preferred: AgentInstallationReceivingCapabilityKind | null;
39
+ };
40
+ export type AgentEndpointInput = {
41
+ kind: AgentEndpointKind;
42
+ profile: AgentDeliveryProfile;
43
+ status?: AgentEndpointStatus;
44
+ capability_ids?: string[];
45
+ url?: string | null;
46
+ auth?: Record<string, unknown> | null;
47
+ config?: Record<string, unknown> | null;
48
+ };
49
+ export type AgentEndpointRecord = {
50
+ id: string;
51
+ agent_id: string;
52
+ kind: AgentEndpointKind;
53
+ profile: AgentDeliveryProfile;
54
+ status: AgentEndpointStatus;
55
+ capability_ids: string[];
56
+ url: string | null;
57
+ auth: Record<string, unknown> | null;
58
+ config: Record<string, unknown> | null;
59
+ last_seen_at: string | null;
60
+ created_at: string;
61
+ updated_at: string;
62
+ };
63
+ export type AgentSubscriptionInput = {
64
+ topic: AgentGatewayTopic;
65
+ status?: AgentSubscriptionStatus;
66
+ filter?: Record<string, unknown> | null;
67
+ };
68
+ export type AgentSubscriptionRecord = {
69
+ id: string;
70
+ agent_id: string;
71
+ topic: AgentGatewayTopic;
72
+ status: AgentSubscriptionStatus;
73
+ filter: Record<string, unknown> | null;
74
+ created_at: string;
75
+ updated_at: string;
76
+ };
77
+ export type AgentGatewayContract = {
78
+ version: 'v1';
79
+ scopes: string[];
80
+ topics: AgentGatewayTopic[];
81
+ delivery_profiles: AgentDeliveryProfile[];
82
+ receiving_capabilities: AgentInstallationReceivingCapabilityKind[];
83
+ };
84
+ export type AgentGatewayResourceRef = {
85
+ resource_type: string;
86
+ resource_id: string;
87
+ scope_type?: string | null;
88
+ scope_id?: string | null;
89
+ pairing_id?: string | null;
90
+ conversation_id?: string | null;
91
+ source_message_id?: string | null;
92
+ };
93
+ export type AgentGatewayEventPreview = {
94
+ title?: string | null;
95
+ text?: string | null;
96
+ actor_agent_id?: string | null;
97
+ status?: string | null;
98
+ direction?: string | null;
99
+ };
100
+ export type AgentGatewayEventEnvelope = {
101
+ event_id: string;
102
+ target_agent_id: string;
103
+ stream_seq: number;
104
+ topic: AgentGatewayTopic;
105
+ occurred_at: string | null;
106
+ resource_ref: AgentGatewayResourceRef;
107
+ preview: AgentGatewayEventPreview | null;
108
+ fetch_uri: string;
109
+ idempotency_key: string | null;
110
+ };
111
+ export type AgentGatewayEventSnapshot = AgentGatewayEventEnvelope & {
112
+ status: 'queued' | 'processing' | 'consumed' | 'failed';
113
+ attempts: number;
114
+ available_at: string | null;
115
+ processing_started_at: string | null;
116
+ claimed_by_agent_id: string | null;
117
+ claimed_by_lease_id: string | null;
118
+ claimed_at: string | null;
119
+ consumed_at: string | null;
120
+ last_error: string | null;
121
+ result: Record<string, unknown> | null;
122
+ payload: Record<string, unknown> | null;
123
+ created_at: string | null;
124
+ updated_at: string | null;
125
+ };
126
+ export type HiAgentPlatformWellKnown = {
127
+ version: 'hi-agent-platform.v1';
128
+ generated_at: string;
129
+ platform: {
130
+ name: string;
131
+ platform_base_url: string;
132
+ registry_base_url: string;
133
+ };
134
+ services: {
135
+ skills_url: string;
136
+ capabilities_url: string;
137
+ capability_call_url_template: string;
138
+ oauth_token_url: string;
139
+ jwks_url: string;
140
+ register_url: string;
141
+ connect_url: string;
142
+ activate_url: string;
143
+ me_url: string;
144
+ installation_url: string;
145
+ endpoints_url: string;
146
+ subscriptions_url: string;
147
+ test_delivery_url: string;
148
+ stream_url: string;
149
+ claim_url: string;
150
+ fetch_url_template: string;
151
+ ack_url: string;
152
+ };
153
+ capability_bindings: Array<'hi.capability-http.v1' | 'hi.mcp.tool-call.v1'>;
154
+ delivery_profiles: AgentDeliveryProfile[];
155
+ };
156
+ export type HiAgentSkillSummary = {
157
+ id: string;
158
+ name: string;
159
+ description: string;
160
+ compatibility: string[];
161
+ current_version: string;
162
+ hash: string;
163
+ sha256: string;
164
+ raw_url: string;
165
+ manifest_url: string;
166
+ bundle_url: string;
167
+ required_capability_ids: string[];
168
+ };
169
+ export type HiAgentSkillListResponse = {
170
+ generated_at: string;
171
+ skills: HiAgentSkillSummary[];
172
+ };
173
+ export type HiAgentSkillResponse = {
174
+ skill: HiAgentSkillSummary;
175
+ };
176
+ export type HiAgentSkillManifest = {
177
+ format: 'hi.skill-manifest.v1';
178
+ id: string;
179
+ name: string;
180
+ description: string;
181
+ version: string;
182
+ hash: string;
183
+ sha256: string;
184
+ raw_url: string;
185
+ manifest_url: string;
186
+ bundle_url: string;
187
+ compatibility: string[];
188
+ required_capability_ids: string[];
189
+ };
190
+ export type PublicAgentCapabilityBinding = {
191
+ kind: 'http';
192
+ profile: 'hi.capability-http.v1';
193
+ method: 'POST';
194
+ path: string;
195
+ schema_path: string;
196
+ } | {
197
+ kind: 'mcp';
198
+ profile: 'hi.mcp.tool-call.v1';
199
+ tool_name: string;
200
+ handler_group: string;
201
+ };
202
+ export type PublicAgentCapability = {
203
+ capability_id: string;
204
+ tool_name: string;
205
+ title: string;
206
+ description: string;
207
+ handler_group: string;
208
+ scopes: string[];
209
+ parameters: Record<string, unknown>;
210
+ bindings: PublicAgentCapabilityBinding[];
211
+ legacy_tool_names: string[];
212
+ };
213
+ export type HiAgentCapabilityListResponse = {
214
+ capabilities: PublicAgentCapability[];
215
+ };
216
+ export type HiAgentCapabilityResponse = {
217
+ capability: PublicAgentCapability;
218
+ };
219
+ export type HiAgentCapabilitySchemaResponse = {
220
+ capability_id: string;
221
+ tool_name: string;
222
+ schema: Record<string, unknown>;
223
+ };
224
+ export type HiAgentCapabilityCallResponse = {
225
+ capability_id: string;
226
+ tool_name: string;
227
+ result: unknown;
228
+ };
229
+ export type AgentRegisterRequest = {
230
+ agent_id: string;
231
+ display_name: string;
232
+ agent_kind?: string;
233
+ capabilities?: unknown;
234
+ metadata?: Record<string, unknown> | null;
235
+ delivery_capabilities?: AgentInstallationDeliveryDeclaration | null;
236
+ status?: string | null;
237
+ };
238
+ export type AgentConnectRequest = {
239
+ agent_id: string;
240
+ metadata?: Record<string, unknown> | null;
241
+ delivery_capabilities?: AgentInstallationDeliveryDeclaration | null;
242
+ };
243
+ export type AgentActivateRequest = {
244
+ agent_id?: string | null;
245
+ };
246
+ export type AgentInstallationUpdateRequest = {
247
+ metadata?: Record<string, unknown> | null;
248
+ delivery_capabilities?: AgentInstallationDeliveryDeclaration | null;
249
+ };
250
+ export type AgentConnectionResponse = {
251
+ agent: AgentRecord;
252
+ installation: AgentInstallationRecord;
253
+ contract: AgentGatewayContract;
254
+ };
255
+ export type AgentBootstrapAuth = {
256
+ grant_type: 'client_credentials';
257
+ client_id: string;
258
+ client_secret: string;
259
+ installation_subject: string;
260
+ issuer: string;
261
+ audience: string;
262
+ token_url: string;
263
+ jwks_url: string;
264
+ };
265
+ export type AgentRegisterResponse = AgentConnectionResponse & {
266
+ auth: AgentBootstrapAuth;
267
+ next: {
268
+ connect: string;
269
+ activate: string;
270
+ };
271
+ };
272
+ export type AgentMeResponse = AgentConnectionResponse & {
273
+ jwt_principal: string | null;
274
+ jwt_issuer: string | null;
275
+ };
276
+ export type AgentInstallationResponse = {
277
+ installation: AgentInstallationRecord;
278
+ contract: AgentGatewayContract;
279
+ };
280
+ export type AgentEndpointsResponse = {
281
+ endpoints: AgentEndpointRecord[];
282
+ };
283
+ export type AgentSubscriptionsResponse = {
284
+ subscriptions: AgentSubscriptionRecord[];
285
+ };
286
+ export type AgentTestDeliveryRequest = {
287
+ topic?: AgentGatewayTopic;
288
+ text?: string;
289
+ payload?: Record<string, unknown>;
290
+ profile?: AgentDeliveryProfile;
291
+ };
292
+ export type AgentTestDeliveryResponse = {
293
+ ok: true;
294
+ results: Array<{
295
+ endpoint_id: string;
296
+ profile: AgentDeliveryProfile;
297
+ ok: boolean;
298
+ result?: Record<string, unknown> | null;
299
+ error?: string;
300
+ }>;
301
+ };
302
+ export type AgentEventClaimRequest = {
303
+ after_seq?: number;
304
+ limit?: number;
305
+ claim_lease_id?: string;
306
+ };
307
+ export type AgentEventClaimResponse = {
308
+ ok: true;
309
+ claim_lease_id: string;
310
+ items: AgentGatewayEventSnapshot[];
311
+ };
312
+ export type AgentEventFetchResponse = {
313
+ ok: true;
314
+ event: AgentGatewayEventSnapshot;
315
+ } | {
316
+ ok: false;
317
+ error: 'agent_event_not_found';
318
+ };
319
+ export type AgentEventAck = {
320
+ event_id: string;
321
+ status: AgentEventAckStatus;
322
+ last_error?: string | null;
323
+ result?: Record<string, unknown> | null;
324
+ retry_after_ms?: number | null;
325
+ };
326
+ export type AgentEventAckRequest = {
327
+ acks: AgentEventAck[];
328
+ };
329
+ export type HiAgentPlatformClientOptions = {
330
+ baseUrl: string;
331
+ token?: string;
332
+ fetchImpl?: typeof fetch;
333
+ };
334
+ export type HiAgentGatewayClientOptions = {
335
+ baseUrl: string;
336
+ token: string;
337
+ fetchImpl?: typeof fetch;
338
+ };
339
+ export type HiAgentTokenExchangeOptions = {
340
+ tokenUrl: string;
341
+ clientId: string;
342
+ clientSecret: string;
343
+ fetchImpl?: typeof fetch;
344
+ };
345
+ export type HiAgentTokenResponse = {
346
+ access_token: string;
347
+ token_type?: string;
348
+ expires_in?: number;
349
+ refresh_token?: string;
350
+ scope?: string;
351
+ };
352
+ type RequestOptions = {
353
+ method?: string;
354
+ body?: unknown;
355
+ headers?: Record<string, string>;
356
+ responseType?: 'json' | 'text' | 'bytes';
357
+ };
358
+ declare class BaseHiClient {
359
+ protected readonly baseUrl: string;
360
+ protected readonly token: string | null;
361
+ protected readonly fetchImpl: typeof fetch;
362
+ constructor(options: {
363
+ baseUrl: string;
364
+ token?: string | null;
365
+ fetchImpl?: typeof fetch;
366
+ });
367
+ protected request<T>(path: string, options?: RequestOptions): Promise<T>;
368
+ }
369
+ export declare class HiAgentPlatformClient extends BaseHiClient {
370
+ constructor(options: HiAgentPlatformClientOptions);
371
+ wellKnown(): Promise<HiAgentPlatformWellKnown>;
372
+ listSkills(): Promise<HiAgentSkillListResponse>;
373
+ getSkill(skillId: string): Promise<HiAgentSkillResponse>;
374
+ getSkillMarkdown(skillId: string, version: string): Promise<string>;
375
+ getSkillManifest(skillId: string, version: string): Promise<HiAgentSkillManifest>;
376
+ downloadSkillBundle(skillId: string, version: string): Promise<Uint8Array<ArrayBufferLike>>;
377
+ listCapabilities(): Promise<HiAgentCapabilityListResponse>;
378
+ getCapability(capabilityId: string): Promise<HiAgentCapabilityResponse>;
379
+ getCapabilitySchema(capabilityId: string): Promise<HiAgentCapabilitySchemaResponse>;
380
+ callCapability(capabilityId: string, body: Record<string, unknown>): Promise<HiAgentCapabilityCallResponse>;
381
+ }
382
+ export declare class HiAgentGatewayClient extends BaseHiClient {
383
+ constructor(options: HiAgentGatewayClientOptions);
384
+ register(body: AgentRegisterRequest): Promise<AgentRegisterResponse>;
385
+ connect(body: AgentConnectRequest): Promise<AgentConnectionResponse>;
386
+ activate(body?: AgentActivateRequest): Promise<AgentConnectionResponse>;
387
+ me(): Promise<AgentMeResponse>;
388
+ getInstallation(): Promise<AgentInstallationResponse>;
389
+ updateInstallation(body: AgentInstallationUpdateRequest): Promise<AgentInstallationResponse>;
390
+ listEndpoints(): Promise<AgentEndpointsResponse>;
391
+ upsertEndpoints(endpoints: AgentEndpointInput[] | {
392
+ endpoints: AgentEndpointInput[];
393
+ }): Promise<AgentEndpointsResponse>;
394
+ listSubscriptions(): Promise<AgentSubscriptionsResponse>;
395
+ upsertSubscriptions(subscriptions: AgentSubscriptionInput[] | {
396
+ subscriptions: AgentSubscriptionInput[];
397
+ }): Promise<AgentSubscriptionsResponse>;
398
+ testDelivery(body?: AgentTestDeliveryRequest): Promise<AgentTestDeliveryResponse>;
399
+ claimEvents(body?: AgentEventClaimRequest): Promise<AgentEventClaimResponse>;
400
+ fetchEvent(eventId: string): Promise<AgentEventFetchResponse>;
401
+ ackEvents(body: AgentEventAckRequest | (AgentEventAck & {
402
+ acks?: never;
403
+ })): Promise<{
404
+ ok: true;
405
+ items: AgentGatewayEventSnapshot[];
406
+ }>;
407
+ streamUrl(afterSeq?: number): string;
408
+ authorizationHeader(): string;
409
+ }
410
+ export declare function exchangeHiAgentClientCredentialsToken(options: HiAgentTokenExchangeOptions): Promise<HiAgentTokenResponse>;
411
+ export declare function createHiAgentClients(options: {
412
+ platformBaseUrl: string;
413
+ token: string;
414
+ fetchImpl?: typeof fetch;
415
+ }): Promise<{
416
+ wellKnown: HiAgentPlatformWellKnown;
417
+ platform: HiAgentPlatformClient;
418
+ gateway: HiAgentGatewayClient;
419
+ }>;
420
+ export {};
421
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,UAAU,GAAG,aAAa,CAAC;AACvE,MAAM,MAAM,oBAAoB,GAC5B,0BAA0B,GAC1B,yBAAyB,GACzB,kBAAkB,GAClB,WAAW,CAAC;AAChB,MAAM,MAAM,wCAAwC,GAChD,aAAa,GACb,WAAW,GACX,iBAAiB,GACjB,gBAAgB,GAChB,gBAAgB,GAChB,eAAe,GACf,gBAAgB,CAAC;AACrB,MAAM,MAAM,0CAA0C,GAAG,QAAQ,GAAG,UAAU,CAAC;AAC/E,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,UAAU,CAAC;AACxD,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,UAAU,CAAC;AAC5D,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;AACnE,MAAM,MAAM,iBAAiB,GACzB,uBAAuB,GACvB,iBAAiB,GACjB,iBAAiB,GACjB,kCAAkC,GAClC,6BAA6B,GAC7B,6BAA6B,CAAC;AAElC,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACzC,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,C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ace(/\/$/, '');
7
+ this.token = options.token ? String(options.token) : null;
8
+ this.fetchImpl = options.fetchImpl || fetch;
9
+ }
10
+ async request(path, options = {}) {
11
+ const hasBody = options.body != null;
12
+ const response = await this.fetchImpl(`${this.baseUrl}${path}`, {
13
+ method: options.method || 'GET',
14
+ headers: {
15
+ ...(this.token ? { authorization: `Bearer ${this.token}` } : {}),
16
+ ...(hasBody ? { 'content-type': 'application/json' } : {}),
17
+ ...(options.headers || {}),
18
+ },
19
+ body: hasBody ? JSON.stringify(options.body) : undefined,
20
+ });
21
+ if (options.responseType === 'text') {
22
+ const text = await response.text();
23
+ if (!response.ok) {
24
+ const error = new Error(text || response.statusText || 'request_failed');
25
+ error.status = response.status;
26
+ error.detail = text;
27
+ throw error;
28
+ }
29
+ return text;
30
+ }
31
+ if (options.responseType === 'bytes') {
32
+ const bytes = new Uint8Array(await response.arrayBuffer());
33
+ if (!response.ok) {
34
+ const error = new Error(response.statusText || 'request_failed');
35
+ error.status = response.status;
36
+ error.detail = bytes;
37
+ throw error;
38
+ }
39
+ return bytes;
40
+ }
41
+ const data = await response.json().catch(() => ({}));
42
+ if (!response.ok) {
43
+ const error = new Error(String(data?.error || response.statusText || 'request_failed'));
44
+ error.status = response.status;
45
+ error.detail = data;
46
+ throw error;
47
+ }
48
+ return data;
49
+ }
50
+ }
51
+ export class HiAgentPlatformClient extends BaseHiClient {
52
+ constructor(options) {
53
+ super(options);
54
+ }
55
+ // 外部 agent 先读 well-known,再按服务目录分发到 skills/capabilities/gateway。
56
+ wellKnown() {
57
+ return this.request('/.well-known/hi-agent-platform.json');
58
+ }
59
+ listSkills() {
60
+ return this.request('/v1/skills');
61
+ }
62
+ getSkill(skillId) {
63
+ return this.request(`/v1/skills/${encodeURIComponent(skillId)}`);
64
+ }
65
+ getSkillMarkdown(skillId, version) {
66
+ return this.request(`/v1/skills/${encodeURIComponent(skillId)}/versions/${encodeURIComponent(version)}/SKILL.md`, { responseType: 'text' });
67
+ }
68
+ getSkillManifest(skillId, version) {
69
+ return this.request(`/v1/skills/${encodeURIComponent(skillId)}/versions/${encodeURIComponent(version)}/manifest.json`);
70
+ }
71
+ downloadSkillBundle(skillId, version) {
72
+ return this.request(`/v1/skills/${encodeURIComponent(skillId)}/versions/${encodeURIComponent(version)}/bundle.zip`, { responseType: 'bytes' });
73
+ }
74
+ listCapabilities() {
75
+ return this.request('/v1/capabilities');
76
+ }
77
+ getCapability(capabilityId) {
78
+ return this.request(`/v1/capabilities/${encodeURIComponent(capabilityId)}`);
79
+ }
80
+ getCapabilitySchema(capabilityId) {
81
+ return this.request(`/v1/capabilities/${encodeURIComponent(capabilityId)}/schema`);
82
+ }
83
+ callCapability(capabilityId, body) {
84
+ return this.request(`/v1/capabilities/${encodeURIComponent(capabilityId)}/call`, { method: 'POST', body });
85
+ }
86
+ }
87
+ export class HiAgentGatewayClient extends BaseHiClient {
88
+ constructor(options) {
89
+ super(options);
90
+ }
91
+ register(body) {
92
+ return this.request('/v1/agents/register', { method: 'POST', body });
93
+ }
94
+ connect(body) {
95
+ return this.request('/v1/agents/connect', { method: 'POST', body });
96
+ }
97
+ activate(body = {}) {
98
+ return this.request('/v1/agents/activate', { method: 'POST', body });
99
+ }
100
+ me() {
101
+ return this.request('/v1/agents/me');
102
+ }
103
+ getInstallation() {
104
+ return this.request('/v1/agents/me/installation');
105
+ }
106
+ updateInstallation(body) {
107
+ return this.request('/v1/agents/me/installation', { method: 'PUT', body });
108
+ }
109
+ listEndpoints() {
110
+ return this.request('/v1/agents/me/endpoints');
111
+ }
112
+ upsertEndpoints(endpoints) {
113
+ const body = Array.isArray(endpoints) ? { endpoints } : endpoints;
114
+ return this.request('/v1/agents/me/endpoints', { method: 'PUT', body });
115
+ }
116
+ listSubscriptions() {
117
+ return this.request('/v1/agents/me/subscriptions');
118
+ }
119
+ upsertSubscriptions(subscriptions) {
120
+ const body = Array.isArray(subscriptions) ? { subscriptions } : subscriptions;
121
+ return this.request('/v1/agents/me/subscriptions', { method: 'PUT', body });
122
+ }
123
+ testDelivery(body = {}) {
124
+ return this.request('/v1/agents/me/test-delivery', { method: 'POST', body });
125
+ }
126
+ claimEvents(body = {}) {
127
+ return this.request('/v1/agent-events/claim', { method: 'POST', body });
128
+ }
129
+ fetchEvent(eventId) {
130
+ return this.request(`/v1/agent-events/${encodeURIComponent(eventId)}`);
131
+ }
132
+ ackEvents(body) {
133
+ const payload = Array.isArray(body.acks)
134
+ ? body
135
+ : { acks: [body] };
136
+ return this.request('/v1/agent-events/ack', {
137
+ method: 'POST',
138
+ body: payload,
139
+ });
140
+ }
141
+ streamUrl(afterSeq) {
142
+ const url = new URL(`${this.baseUrl}/v1/agent-events/stream`);
143
+ if (afterSeq != null)
144
+ url.searchParams.set('after_seq', String(afterSeq));
145
+ return url.toString();
146
+ }
147
+ authorizationHeader() {
148
+ return `Bearer ${this.token}`;
149
+ }
150
+ }
151
+ export async function exchangeHiAgentClientCredentialsToken(options) {
152
+ const fetchImpl = options.fetchImpl || fetch;
153
+ const response = await fetchImpl(options.tokenUrl, {
154
+ method: 'POST',
155
+ headers: {
156
+ 'content-type': 'application/json',
157
+ },
158
+ body: JSON.stringify({
159
+ grant_type: 'client_credentials',
160
+ client_id: options.clientId,
161
+ client_secret: options.clientSecret,
162
+ }),
163
+ });
164
+ const body = await response.json().catch(() => ({}));
165
+ if (!response.ok) {
166
+ const error = new Error(String(body?.error || response.statusText || 'request_failed'));
167
+ error.status = response.status;
168
+ error.detail = body;
169
+ throw error;
170
+ }
171
+ return body;
172
+ }
173
+ export async function createHiAgentClients(options) {
174
+ const platform = new HiAgentPlatformClient({
175
+ baseUrl: options.platformBaseUrl,
176
+ token: options.token,
177
+ fetchImpl: options.fetchImpl,
178
+ });
179
+ const wellKnown = await platform.wellKnown();
180
+ const gateway = new HiAgentGatewayClient({
181
+ baseUrl: wellKnown.platform.registry_base_url,
182
+ token: options.token,
183
+ fetchImpl: options.fetchImpl,
184
+ });
185
+ return {
186
+ wellKnown,
187
+ platform,
188
+ gateway,
189
+ };
190
+ }
@@ -0,0 +1,3 @@
1
+ export * from './client.js';
2
+ export * from './sse.js';
3
+ //# sourceMappingURL=index.d.ts.map