@tangle-network/agent-gateway 0.6.0 → 0.7.1

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/dist/types.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { a as AgentMeta, A as ApiKeyInfo, c as ChatCompletionChunk, d as ChatCompletionRequest, C as ChatMessage, G as GatewayConfig, h as GatewayUsageEvent, M as MppConfig, P as PaymentMethod, i as PaymentResult, S as SandboxBox, j as SandboxStreamEvent, X as X402Config } from './types-C_L7yXXI.js';
1
+ export { e as AgentMeta, A as ApiKeyInfo, j as ChatCompletionChunk, k as ChatCompletionRequest, C as ChatMessage, G as GatewayConfig, q as GatewayUsageEvent, M as MppConfig, x as PaymentMethod, y as PaymentResult, S as SandboxBox, K as SandboxStreamEvent, X as X402Config } from './types-DEsMmS-X.js';
2
2
  import './nonce-store.js';
3
3
  import './rate-limit.js';
package/package.json CHANGED
@@ -1,6 +1,10 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-gateway",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/tangle-network/agent-gateway.git"
7
+ },
4
8
  "type": "module",
5
9
  "description": "x402 + API key payment gateway for Tangle agent products. Mount on any Hono app to expose agents as paid OpenAI-compatible endpoints.",
6
10
  "exports": {
@@ -25,14 +29,6 @@
25
29
  "dist",
26
30
  "src"
27
31
  ],
28
- "scripts": {
29
- "build": "tsup",
30
- "dev": "tsup --watch",
31
- "typecheck": "tsc --noEmit",
32
- "test": "vitest run",
33
- "test:watch": "vitest",
34
- "test:coverage": "vitest run --coverage"
35
- },
36
32
  "dependencies": {
37
33
  "hono": "^4.6.0"
38
34
  },
@@ -43,5 +39,13 @@
43
39
  "typescript": "^5.7.0",
44
40
  "viem": "^2.48.1",
45
41
  "vitest": "^4.1.4"
42
+ },
43
+ "scripts": {
44
+ "build": "tsup",
45
+ "dev": "tsup --watch",
46
+ "typecheck": "tsc --noEmit",
47
+ "test": "vitest run",
48
+ "test:watch": "vitest",
49
+ "test:coverage": "vitest run --coverage"
46
50
  }
47
- }
51
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Build an A2A AgentCard from the gateway's existing AgentMeta + GatewayConfig.
3
+ * The card's `url` MUST be the JSON-RPC endpoint a client POSTs to; clients
4
+ * fetch the card from `<url>/.well-known/agent.json` per A2A convention.
5
+ *
6
+ * Auth schemes advertised reflect the gateway's actually-accepted payment
7
+ * methods (x402 always; mpp and Bearer only when configured). Skills
8
+ * fall back to a single synthesized "chat" skill when the AgentMeta doesn't
9
+ * declare its own — most consumers will override.
10
+ */
11
+
12
+ import type { AgentMeta, GatewayConfig } from '../types'
13
+ import { isApiKeyAuthEnabled, isMppAuthEnabled } from '../verify'
14
+ import type { AgentCard, AgentSkill } from './types'
15
+
16
+ export function buildAgentCard(
17
+ agent: AgentMeta,
18
+ config: GatewayConfig,
19
+ agentUrl: string,
20
+ ): AgentCard {
21
+ const schemes: string[] = ['x402']
22
+ if (isMppAuthEnabled(config)) schemes.push('mpp')
23
+ if (isApiKeyAuthEnabled(config)) schemes.push('Bearer')
24
+
25
+ const skills: AgentSkill[] =
26
+ agent.skills && agent.skills.length > 0
27
+ ? agent.skills
28
+ : [
29
+ {
30
+ id: 'chat',
31
+ name: agent.slug,
32
+ description: agent.description ?? `${agent.slug} agent`,
33
+ tags: ['chat'],
34
+ inputModes: ['text'],
35
+ outputModes: ['text'],
36
+ },
37
+ ]
38
+
39
+ return {
40
+ name: agent.slug,
41
+ description: agent.description ?? `${agent.slug} agent`,
42
+ url: agentUrl,
43
+ version: '1.0.0',
44
+ provider: { organization: 'Tangle', url: 'https://tangle.tools' },
45
+ capabilities: {
46
+ streaming: true,
47
+ pushNotifications: !!config.a2a?.pushStore,
48
+ stateTransitionHistory: false,
49
+ },
50
+ authentication: { schemes },
51
+ defaultInputModes: ['text'],
52
+ defaultOutputModes: ['text'],
53
+ skills,
54
+ }
55
+ }