@aumos/agent-marketplace 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/dist/client.d.ts +99 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +129 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +188 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +13 -0
- package/dist/types.js.map +1 -0
- package/package.json +34 -0
- package/src/client.ts +296 -0
- package/src/index.ts +27 -0
- package/src/types.ts +245 -0
- package/tsconfig.json +25 -0
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client for the agent-marketplace capability registry API.
|
|
3
|
+
*
|
|
4
|
+
* Uses the Fetch API (available natively in Node 18+, browsers, and Deno).
|
|
5
|
+
* No external dependencies required.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { createAgentMarketplaceClient } from "@aumos/agent-marketplace";
|
|
10
|
+
*
|
|
11
|
+
* const client = createAgentMarketplaceClient({ baseUrl: "http://localhost:8092" });
|
|
12
|
+
*
|
|
13
|
+
* const result = await client.discoverAgents({
|
|
14
|
+
* required_capabilities: ["analysis"],
|
|
15
|
+
* min_trust: 0.8,
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* if (result.ok) {
|
|
19
|
+
* console.log("Found listings:", result.data.length);
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
import type { AgentListing, ApiResult, CapabilitySchema, CapabilityValidation, DiscoveryQuery, MatchResult } from "./types.js";
|
|
24
|
+
/** Configuration options for the AgentMarketplaceClient. */
|
|
25
|
+
export interface AgentMarketplaceClientConfig {
|
|
26
|
+
/** Base URL of the agent-marketplace server (e.g. "http://localhost:8092"). */
|
|
27
|
+
readonly baseUrl: string;
|
|
28
|
+
/** Optional request timeout in milliseconds (default: 30000). */
|
|
29
|
+
readonly timeoutMs?: number;
|
|
30
|
+
/** Optional extra HTTP headers sent with every request. */
|
|
31
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
32
|
+
}
|
|
33
|
+
/** Typed HTTP client for the agent-marketplace server. */
|
|
34
|
+
export interface AgentMarketplaceClient {
|
|
35
|
+
/**
|
|
36
|
+
* Register a new capability schema in the marketplace.
|
|
37
|
+
*
|
|
38
|
+
* @param capability - The full capability schema to register.
|
|
39
|
+
* @returns The registered CapabilitySchema with auto-generated capability_id.
|
|
40
|
+
*/
|
|
41
|
+
registerCapability(capability: Omit<CapabilitySchema, "capability_id">): Promise<ApiResult<CapabilitySchema>>;
|
|
42
|
+
/**
|
|
43
|
+
* Discover agents in the marketplace matching the given query parameters.
|
|
44
|
+
*
|
|
45
|
+
* @param query - Optional filter and ranking parameters.
|
|
46
|
+
* @returns Array of AgentListing records ranked by relevance.
|
|
47
|
+
*/
|
|
48
|
+
discoverAgents(query?: DiscoveryQuery): Promise<ApiResult<readonly AgentListing[]>>;
|
|
49
|
+
/**
|
|
50
|
+
* Match a structured capability request against all registered capabilities.
|
|
51
|
+
*
|
|
52
|
+
* Returns results ranked by composite match score (capability overlap,
|
|
53
|
+
* latency fitness, trust level, cost fitness).
|
|
54
|
+
*
|
|
55
|
+
* @param query - The discovery query specifying required capabilities and constraints.
|
|
56
|
+
* @returns Array of MatchResult records sorted best-first by match_score.
|
|
57
|
+
*/
|
|
58
|
+
matchCapabilities(query: DiscoveryQuery): Promise<ApiResult<readonly MatchResult[]>>;
|
|
59
|
+
/**
|
|
60
|
+
* Validate a capability schema against marketplace business rules.
|
|
61
|
+
*
|
|
62
|
+
* @param capability - The capability schema to validate.
|
|
63
|
+
* @returns A CapabilityValidation with any error messages.
|
|
64
|
+
*/
|
|
65
|
+
validateCapability(capability: Omit<CapabilitySchema, "capability_id">): Promise<ApiResult<CapabilityValidation>>;
|
|
66
|
+
/**
|
|
67
|
+
* Retrieve all marketplace listings, optionally filtered by namespace.
|
|
68
|
+
*
|
|
69
|
+
* @param options - Optional filter and pagination parameters.
|
|
70
|
+
* @returns Array of AgentListing records.
|
|
71
|
+
*/
|
|
72
|
+
getListings(options?: {
|
|
73
|
+
readonly namespace?: string;
|
|
74
|
+
readonly category?: string;
|
|
75
|
+
readonly limit?: number;
|
|
76
|
+
}): Promise<ApiResult<readonly AgentListing[]>>;
|
|
77
|
+
/**
|
|
78
|
+
* Retrieve a single capability by its unique identifier.
|
|
79
|
+
*
|
|
80
|
+
* @param capabilityId - The capability_id to look up.
|
|
81
|
+
* @returns The CapabilitySchema for the requested capability.
|
|
82
|
+
*/
|
|
83
|
+
getCapability(capabilityId: string): Promise<ApiResult<CapabilitySchema>>;
|
|
84
|
+
/**
|
|
85
|
+
* Deregister a capability from the marketplace.
|
|
86
|
+
*
|
|
87
|
+
* @param capabilityId - The capability_id to remove.
|
|
88
|
+
* @returns An empty object on successful deregistration.
|
|
89
|
+
*/
|
|
90
|
+
deregisterCapability(capabilityId: string): Promise<ApiResult<Readonly<Record<string, never>>>>;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Create a typed HTTP client for the agent-marketplace server.
|
|
94
|
+
*
|
|
95
|
+
* @param config - Client configuration including base URL.
|
|
96
|
+
* @returns An AgentMarketplaceClient instance.
|
|
97
|
+
*/
|
|
98
|
+
export declare function createAgentMarketplaceClient(config: AgentMarketplaceClientConfig): AgentMarketplaceClient;
|
|
99
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EACV,YAAY,EAEZ,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,WAA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AO,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAE1E;;;;;OAKG;IACH,oBAAoB,CAClB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;CACxD;AAMD;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,4BAA4B,GACnC,sBAAsB,CA2GxB"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client for the agent-marketplace capability registry API.
|
|
3
|
+
*
|
|
4
|
+
* Uses the Fetch API (available natively in Node 18+, browsers, and Deno).
|
|
5
|
+
* No external dependencies required.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { createAgentMarketplaceClient } from "@aumos/agent-marketplace";
|
|
10
|
+
*
|
|
11
|
+
* const client = createAgentMarketplaceClient({ baseUrl: "http://localhost:8092" });
|
|
12
|
+
*
|
|
13
|
+
* const result = await client.discoverAgents({
|
|
14
|
+
* required_capabilities: ["analysis"],
|
|
15
|
+
* min_trust: 0.8,
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* if (result.ok) {
|
|
19
|
+
* console.log("Found listings:", result.data.length);
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
// Internal helpers
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
async function fetchJson(url, init, timeoutMs) {
|
|
27
|
+
const controller = new AbortController();
|
|
28
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
29
|
+
try {
|
|
30
|
+
const response = await fetch(url, { ...init, signal: controller.signal });
|
|
31
|
+
clearTimeout(timeoutId);
|
|
32
|
+
const body = await response.json();
|
|
33
|
+
if (!response.ok) {
|
|
34
|
+
const errorBody = body;
|
|
35
|
+
return {
|
|
36
|
+
ok: false,
|
|
37
|
+
error: {
|
|
38
|
+
error: errorBody.error ?? "Unknown error",
|
|
39
|
+
detail: errorBody.detail ?? "",
|
|
40
|
+
},
|
|
41
|
+
status: response.status,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return { ok: true, data: body };
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
clearTimeout(timeoutId);
|
|
48
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
49
|
+
return {
|
|
50
|
+
ok: false,
|
|
51
|
+
error: { error: "Network error", detail: message },
|
|
52
|
+
status: 0,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function buildHeaders(extraHeaders) {
|
|
57
|
+
return {
|
|
58
|
+
"Content-Type": "application/json",
|
|
59
|
+
Accept: "application/json",
|
|
60
|
+
...extraHeaders,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
64
|
+
// Client factory
|
|
65
|
+
// ---------------------------------------------------------------------------
|
|
66
|
+
/**
|
|
67
|
+
* Create a typed HTTP client for the agent-marketplace server.
|
|
68
|
+
*
|
|
69
|
+
* @param config - Client configuration including base URL.
|
|
70
|
+
* @returns An AgentMarketplaceClient instance.
|
|
71
|
+
*/
|
|
72
|
+
export function createAgentMarketplaceClient(config) {
|
|
73
|
+
const { baseUrl, timeoutMs = 30000, headers: extraHeaders } = config;
|
|
74
|
+
const baseHeaders = buildHeaders(extraHeaders);
|
|
75
|
+
return {
|
|
76
|
+
async registerCapability(capability) {
|
|
77
|
+
return fetchJson(`${baseUrl}/capabilities`, {
|
|
78
|
+
method: "POST",
|
|
79
|
+
headers: baseHeaders,
|
|
80
|
+
body: JSON.stringify(capability),
|
|
81
|
+
}, timeoutMs);
|
|
82
|
+
},
|
|
83
|
+
async discoverAgents(query) {
|
|
84
|
+
return fetchJson(`${baseUrl}/discover`, {
|
|
85
|
+
method: "POST",
|
|
86
|
+
headers: baseHeaders,
|
|
87
|
+
body: JSON.stringify(query ?? {}),
|
|
88
|
+
}, timeoutMs);
|
|
89
|
+
},
|
|
90
|
+
async matchCapabilities(query) {
|
|
91
|
+
return fetchJson(`${baseUrl}/match`, {
|
|
92
|
+
method: "POST",
|
|
93
|
+
headers: baseHeaders,
|
|
94
|
+
body: JSON.stringify(query),
|
|
95
|
+
}, timeoutMs);
|
|
96
|
+
},
|
|
97
|
+
async validateCapability(capability) {
|
|
98
|
+
return fetchJson(`${baseUrl}/capabilities/validate`, {
|
|
99
|
+
method: "POST",
|
|
100
|
+
headers: baseHeaders,
|
|
101
|
+
body: JSON.stringify(capability),
|
|
102
|
+
}, timeoutMs);
|
|
103
|
+
},
|
|
104
|
+
async getListings(options) {
|
|
105
|
+
const params = new URLSearchParams();
|
|
106
|
+
if (options?.namespace !== undefined) {
|
|
107
|
+
params.set("namespace", options.namespace);
|
|
108
|
+
}
|
|
109
|
+
if (options?.category !== undefined) {
|
|
110
|
+
params.set("category", options.category);
|
|
111
|
+
}
|
|
112
|
+
if (options?.limit !== undefined) {
|
|
113
|
+
params.set("limit", String(options.limit));
|
|
114
|
+
}
|
|
115
|
+
const queryString = params.toString();
|
|
116
|
+
const url = queryString
|
|
117
|
+
? `${baseUrl}/listings?${queryString}`
|
|
118
|
+
: `${baseUrl}/listings`;
|
|
119
|
+
return fetchJson(url, { method: "GET", headers: baseHeaders }, timeoutMs);
|
|
120
|
+
},
|
|
121
|
+
async getCapability(capabilityId) {
|
|
122
|
+
return fetchJson(`${baseUrl}/capabilities/${encodeURIComponent(capabilityId)}`, { method: "GET", headers: baseHeaders }, timeoutMs);
|
|
123
|
+
},
|
|
124
|
+
async deregisterCapability(capabilityId) {
|
|
125
|
+
return fetchJson(`${baseUrl}/capabilities/${encodeURIComponent(capabilityId)}`, { method: "DELETE", headers: baseHeaders }, timeoutMs);
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
}
|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,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,EACvC,SAAS,CACV,CAAC;QACJ,CAAC;QAED,KAAK,CAAC,oBAAoB,CACxB,YAAoB;YAEpB,OAAO,SAAS,CACd,GAAG,OAAO,iBAAiB,kBAAkB,CAAC,YAAY,CAAC,EAAE,EAC7D,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,EAC1C,SAAS,CACV,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @aumos/agent-marketplace
|
|
3
|
+
*
|
|
4
|
+
* TypeScript client for the AumOS agent-marketplace library.
|
|
5
|
+
* Provides HTTP client and capability type definitions for agent capability
|
|
6
|
+
* registration, discovery, matching, and validation.
|
|
7
|
+
*/
|
|
8
|
+
export type { AgentMarketplaceClient, AgentMarketplaceClientConfig } from "./client.js";
|
|
9
|
+
export { createAgentMarketplaceClient } from "./client.js";
|
|
10
|
+
export type { CapabilityCategory, PricingModel, ProviderInfo, QualityMetrics, LatencyProfile, CapabilitySchema, AgentListing, DiscoveryQuery, MatchResult, CapabilityValidation, ApiError, ApiResult, } from "./types.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAG3D,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,WAAW,EACX,oBAAoB,EACpB,QAAQ,EACR,SAAS,GACV,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @aumos/agent-marketplace
|
|
3
|
+
*
|
|
4
|
+
* TypeScript client for the AumOS agent-marketplace library.
|
|
5
|
+
* Provides HTTP client and capability type definitions for agent capability
|
|
6
|
+
* registration, discovery, matching, and validation.
|
|
7
|
+
*/
|
|
8
|
+
export { createAgentMarketplaceClient } from "./client.js";
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript interfaces for the agent-marketplace capability registry.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the Pydantic models defined in:
|
|
5
|
+
* agent_marketplace.schema.capability
|
|
6
|
+
* agent_marketplace.schema.provider
|
|
7
|
+
* agent_marketplace.matching.engine
|
|
8
|
+
* agent_marketplace.matching.request
|
|
9
|
+
*
|
|
10
|
+
* All interfaces use readonly fields to match Python's frozen Pydantic models.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* High-level functional category for an agent capability.
|
|
14
|
+
* Maps to CapabilityCategory enum in Python.
|
|
15
|
+
*/
|
|
16
|
+
export type CapabilityCategory = "analysis" | "generation" | "transformation" | "extraction" | "interaction" | "automation" | "evaluation" | "research" | "reasoning" | "specialized";
|
|
17
|
+
/**
|
|
18
|
+
* How a capability charges for its use.
|
|
19
|
+
* Maps to PricingModel enum in Python.
|
|
20
|
+
*/
|
|
21
|
+
export type PricingModel = "per_call" | "per_token" | "per_minute" | "free" | "custom";
|
|
22
|
+
/**
|
|
23
|
+
* Identity and contact information for a capability provider.
|
|
24
|
+
* Maps to ProviderInfo in Python.
|
|
25
|
+
*/
|
|
26
|
+
export interface ProviderInfo {
|
|
27
|
+
/** Human-readable name of the provider (person or organization). */
|
|
28
|
+
readonly name: string;
|
|
29
|
+
/** Optional formal organization name. */
|
|
30
|
+
readonly organization: string;
|
|
31
|
+
/** Email address for support or inquiries. */
|
|
32
|
+
readonly contact_email: string;
|
|
33
|
+
/** Optional provider website URL. */
|
|
34
|
+
readonly website: string;
|
|
35
|
+
/** Optional GitHub username or org handle. */
|
|
36
|
+
readonly github_handle: string;
|
|
37
|
+
/** Optional Hugging Face username or org handle. */
|
|
38
|
+
readonly huggingface_handle: string;
|
|
39
|
+
/** Whether the provider identity has been externally verified. */
|
|
40
|
+
readonly verified: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Quantitative quality measurements for a capability.
|
|
44
|
+
* Maps to QualityMetrics in Python.
|
|
45
|
+
*/
|
|
46
|
+
export interface QualityMetrics {
|
|
47
|
+
/** Mapping of metric name to numeric score (e.g. {"accuracy": 0.94}). */
|
|
48
|
+
readonly metrics: Readonly<Record<string, number>>;
|
|
49
|
+
/** Name or URL of the benchmark that produced these numbers. */
|
|
50
|
+
readonly benchmark_source: string;
|
|
51
|
+
/** ISO 8601 date string when benchmarks were last run. */
|
|
52
|
+
readonly benchmark_date: string;
|
|
53
|
+
/** Whether these metrics have been independently verified. */
|
|
54
|
+
readonly verified: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Latency percentile measurements in milliseconds.
|
|
58
|
+
* Maps to LatencyProfile in Python.
|
|
59
|
+
*/
|
|
60
|
+
export interface LatencyProfile {
|
|
61
|
+
/** Median (50th percentile) latency in milliseconds. */
|
|
62
|
+
readonly p50_ms: number;
|
|
63
|
+
/** 95th percentile latency in milliseconds. */
|
|
64
|
+
readonly p95_ms: number;
|
|
65
|
+
/** 99th percentile latency in milliseconds. */
|
|
66
|
+
readonly p99_ms: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A fully described agent capability registered in the marketplace.
|
|
70
|
+
* Maps to AgentCapability in Python.
|
|
71
|
+
*/
|
|
72
|
+
export interface CapabilitySchema {
|
|
73
|
+
/** Auto-generated stable identifier (SHA-256 hex prefix of name+version+provider). */
|
|
74
|
+
readonly capability_id: string;
|
|
75
|
+
/** Short, human-readable capability name (e.g. "pdf-extractor"). */
|
|
76
|
+
readonly name: string;
|
|
77
|
+
/** Semantic version string (e.g. "1.2.0"). */
|
|
78
|
+
readonly version: string;
|
|
79
|
+
/** Prose description of what the capability does. */
|
|
80
|
+
readonly description: string;
|
|
81
|
+
/** Primary functional category. */
|
|
82
|
+
readonly category: CapabilityCategory;
|
|
83
|
+
/** Free-form tags for keyword search. */
|
|
84
|
+
readonly tags: readonly string[];
|
|
85
|
+
/** MIME types or schema names accepted by the capability. */
|
|
86
|
+
readonly input_types: readonly string[];
|
|
87
|
+
/** MIME type or schema name produced by the capability. */
|
|
88
|
+
readonly output_type: string;
|
|
89
|
+
/** Benchmark and quality scores. */
|
|
90
|
+
readonly quality_metrics: QualityMetrics;
|
|
91
|
+
/** How usage is billed. */
|
|
92
|
+
readonly pricing_model: PricingModel;
|
|
93
|
+
/** Unit cost corresponding to the pricing model (USD). */
|
|
94
|
+
readonly cost: number;
|
|
95
|
+
/** Latency percentile profile. */
|
|
96
|
+
readonly latency: LatencyProfile;
|
|
97
|
+
/** Natural language codes (ISO 639-1) the capability handles. */
|
|
98
|
+
readonly supported_languages: readonly string[];
|
|
99
|
+
/** Agent framework names this capability has adapters for. */
|
|
100
|
+
readonly supported_frameworks: readonly string[];
|
|
101
|
+
/** Current computed trust score (0.0–1.0); updated by TrustScorer. */
|
|
102
|
+
readonly trust_level: number;
|
|
103
|
+
/** Identity information for the capability publisher. */
|
|
104
|
+
readonly provider: ProviderInfo;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* A marketplace listing entry returned when browsing available capabilities.
|
|
108
|
+
* Combines the capability schema with marketplace metadata.
|
|
109
|
+
*/
|
|
110
|
+
export interface AgentListing {
|
|
111
|
+
/** The registered capability schema. */
|
|
112
|
+
readonly capability: CapabilitySchema;
|
|
113
|
+
/** ISO-8601 UTC timestamp when this capability was registered. */
|
|
114
|
+
readonly registered_at: string;
|
|
115
|
+
/** Total number of times this capability has been invoked. */
|
|
116
|
+
readonly usage_count: number;
|
|
117
|
+
/** Average user rating in [0.0, 5.0], or null if no ratings. */
|
|
118
|
+
readonly average_rating: number | null;
|
|
119
|
+
/** Namespace this capability belongs to (e.g. "aumos", "community"). */
|
|
120
|
+
readonly namespace: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Parameters for discovering agent capabilities in the marketplace.
|
|
124
|
+
* Maps to FilterConstraints + CapabilityRequest in Python.
|
|
125
|
+
*/
|
|
126
|
+
export interface DiscoveryQuery {
|
|
127
|
+
/** Required capability keywords, names, or category strings. */
|
|
128
|
+
readonly required_capabilities?: readonly string[];
|
|
129
|
+
/** Preferred median latency in milliseconds (soft preference). */
|
|
130
|
+
readonly preferred_latency_ms?: number;
|
|
131
|
+
/** Maximum acceptable cost per call in USD. */
|
|
132
|
+
readonly max_cost?: number;
|
|
133
|
+
/** Minimum acceptable trust level [0.0, 1.0]. */
|
|
134
|
+
readonly min_trust?: number;
|
|
135
|
+
/** Restrict results to a single capability category. */
|
|
136
|
+
readonly category?: CapabilityCategory;
|
|
137
|
+
/** Tags that must all be present (AND semantics). */
|
|
138
|
+
readonly required_tags?: readonly string[];
|
|
139
|
+
/** Maximum number of results to return. */
|
|
140
|
+
readonly limit?: number;
|
|
141
|
+
/** Namespace to restrict the search to. */
|
|
142
|
+
readonly namespace?: string;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* A capability paired with its composite match score for a specific request.
|
|
146
|
+
* Maps to MatchResult in Python.
|
|
147
|
+
*/
|
|
148
|
+
export interface MatchResult {
|
|
149
|
+
/** The matched capability schema. */
|
|
150
|
+
readonly capability: CapabilitySchema;
|
|
151
|
+
/** Composite match quality score in [0.0, 1.0]. Higher is better. */
|
|
152
|
+
readonly match_score: number;
|
|
153
|
+
/** Fraction of required capabilities matched [0.0, 1.0]. */
|
|
154
|
+
readonly capability_overlap: number;
|
|
155
|
+
/** Latency fitness component [0.0, 1.0]. */
|
|
156
|
+
readonly latency_score: number;
|
|
157
|
+
/** Trust component (direct from capability.trust_level). */
|
|
158
|
+
readonly trust_score: number;
|
|
159
|
+
/** Cost fitness component [0.0, 1.0]. */
|
|
160
|
+
readonly cost_score: number;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Result of validating a capability schema against marketplace business rules.
|
|
164
|
+
* Maps to the output of AgentCapability.validate() in Python.
|
|
165
|
+
*/
|
|
166
|
+
export interface CapabilityValidation {
|
|
167
|
+
/** Whether the capability passes all validation rules. */
|
|
168
|
+
readonly valid: boolean;
|
|
169
|
+
/** List of human-readable error messages; empty when valid. */
|
|
170
|
+
readonly errors: readonly string[];
|
|
171
|
+
/** The capability_id that was validated. */
|
|
172
|
+
readonly capability_id: string;
|
|
173
|
+
}
|
|
174
|
+
/** Standard error payload returned by the agent-marketplace API. */
|
|
175
|
+
export interface ApiError {
|
|
176
|
+
readonly error: string;
|
|
177
|
+
readonly detail: string;
|
|
178
|
+
}
|
|
179
|
+
/** Result type for all client operations. */
|
|
180
|
+
export type ApiResult<T> = {
|
|
181
|
+
readonly ok: true;
|
|
182
|
+
readonly data: T;
|
|
183
|
+
} | {
|
|
184
|
+
readonly ok: false;
|
|
185
|
+
readonly error: ApiError;
|
|
186
|
+
readonly status: number;
|
|
187
|
+
};
|
|
188
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAC1B,UAAU,GACV,YAAY,GACZ,gBAAgB,GAChB,YAAY,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C/D,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,4CAA4C;IAC5C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAMD,oEAAoE;AACpE,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,6CAA6C;AAC7C,MAAM,MAAM,SAAS,CAAC,CAAC,IACnB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GACvC;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript interfaces for the agent-marketplace capability registry.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the Pydantic models defined in:
|
|
5
|
+
* agent_marketplace.schema.capability
|
|
6
|
+
* agent_marketplace.schema.provider
|
|
7
|
+
* agent_marketplace.matching.engine
|
|
8
|
+
* agent_marketplace.matching.request
|
|
9
|
+
*
|
|
10
|
+
* All interfaces use readonly fields to match Python's frozen Pydantic models.
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aumos/agent-marketplace",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TypeScript client for the AumOS agent-marketplace — capability registration, discovery, matching, and validation",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"typecheck": "tsc --noEmit"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"typescript": "^5.3.0"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"aumos",
|
|
24
|
+
"agent-marketplace",
|
|
25
|
+
"capabilities",
|
|
26
|
+
"discovery",
|
|
27
|
+
"matching",
|
|
28
|
+
"typescript"
|
|
29
|
+
],
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/aumos-ai/agent-marketplace"
|
|
33
|
+
}
|
|
34
|
+
}
|
package/src/client.ts
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client for the agent-marketplace capability registry API.
|
|
3
|
+
*
|
|
4
|
+
* Uses the Fetch API (available natively in Node 18+, browsers, and Deno).
|
|
5
|
+
* No external dependencies required.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { createAgentMarketplaceClient } from "@aumos/agent-marketplace";
|
|
10
|
+
*
|
|
11
|
+
* const client = createAgentMarketplaceClient({ baseUrl: "http://localhost:8092" });
|
|
12
|
+
*
|
|
13
|
+
* const result = await client.discoverAgents({
|
|
14
|
+
* required_capabilities: ["analysis"],
|
|
15
|
+
* min_trust: 0.8,
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* if (result.ok) {
|
|
19
|
+
* console.log("Found listings:", result.data.length);
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import type {
|
|
25
|
+
AgentListing,
|
|
26
|
+
ApiError,
|
|
27
|
+
ApiResult,
|
|
28
|
+
CapabilitySchema,
|
|
29
|
+
CapabilityValidation,
|
|
30
|
+
DiscoveryQuery,
|
|
31
|
+
MatchResult,
|
|
32
|
+
} from "./types.js";
|
|
33
|
+
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
// Client configuration
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
|
|
38
|
+
/** Configuration options for the AgentMarketplaceClient. */
|
|
39
|
+
export interface AgentMarketplaceClientConfig {
|
|
40
|
+
/** Base URL of the agent-marketplace server (e.g. "http://localhost:8092"). */
|
|
41
|
+
readonly baseUrl: string;
|
|
42
|
+
/** Optional request timeout in milliseconds (default: 30000). */
|
|
43
|
+
readonly timeoutMs?: number;
|
|
44
|
+
/** Optional extra HTTP headers sent with every request. */
|
|
45
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
// Internal helpers
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
|
|
52
|
+
async function fetchJson<T>(
|
|
53
|
+
url: string,
|
|
54
|
+
init: RequestInit,
|
|
55
|
+
timeoutMs: number,
|
|
56
|
+
): Promise<ApiResult<T>> {
|
|
57
|
+
const controller = new AbortController();
|
|
58
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
const response = await fetch(url, { ...init, signal: controller.signal });
|
|
62
|
+
clearTimeout(timeoutId);
|
|
63
|
+
|
|
64
|
+
const body = await response.json() as unknown;
|
|
65
|
+
|
|
66
|
+
if (!response.ok) {
|
|
67
|
+
const errorBody = body as Partial<ApiError>;
|
|
68
|
+
return {
|
|
69
|
+
ok: false,
|
|
70
|
+
error: {
|
|
71
|
+
error: errorBody.error ?? "Unknown error",
|
|
72
|
+
detail: errorBody.detail ?? "",
|
|
73
|
+
},
|
|
74
|
+
status: response.status,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return { ok: true, data: body as T };
|
|
79
|
+
} catch (err: unknown) {
|
|
80
|
+
clearTimeout(timeoutId);
|
|
81
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
82
|
+
return {
|
|
83
|
+
ok: false,
|
|
84
|
+
error: { error: "Network error", detail: message },
|
|
85
|
+
status: 0,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function buildHeaders(
|
|
91
|
+
extraHeaders: Readonly<Record<string, string>> | undefined,
|
|
92
|
+
): Record<string, string> {
|
|
93
|
+
return {
|
|
94
|
+
"Content-Type": "application/json",
|
|
95
|
+
Accept: "application/json",
|
|
96
|
+
...extraHeaders,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// ---------------------------------------------------------------------------
|
|
101
|
+
// Client interface
|
|
102
|
+
// ---------------------------------------------------------------------------
|
|
103
|
+
|
|
104
|
+
/** Typed HTTP client for the agent-marketplace server. */
|
|
105
|
+
export interface AgentMarketplaceClient {
|
|
106
|
+
/**
|
|
107
|
+
* Register a new capability schema in the marketplace.
|
|
108
|
+
*
|
|
109
|
+
* @param capability - The full capability schema to register.
|
|
110
|
+
* @returns The registered CapabilitySchema with auto-generated capability_id.
|
|
111
|
+
*/
|
|
112
|
+
registerCapability(
|
|
113
|
+
capability: Omit<CapabilitySchema, "capability_id">,
|
|
114
|
+
): Promise<ApiResult<CapabilitySchema>>;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Discover agents in the marketplace matching the given query parameters.
|
|
118
|
+
*
|
|
119
|
+
* @param query - Optional filter and ranking parameters.
|
|
120
|
+
* @returns Array of AgentListing records ranked by relevance.
|
|
121
|
+
*/
|
|
122
|
+
discoverAgents(query?: DiscoveryQuery): Promise<ApiResult<readonly AgentListing[]>>;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Match a structured capability request against all registered capabilities.
|
|
126
|
+
*
|
|
127
|
+
* Returns results ranked by composite match score (capability overlap,
|
|
128
|
+
* latency fitness, trust level, cost fitness).
|
|
129
|
+
*
|
|
130
|
+
* @param query - The discovery query specifying required capabilities and constraints.
|
|
131
|
+
* @returns Array of MatchResult records sorted best-first by match_score.
|
|
132
|
+
*/
|
|
133
|
+
matchCapabilities(query: DiscoveryQuery): Promise<ApiResult<readonly MatchResult[]>>;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Validate a capability schema against marketplace business rules.
|
|
137
|
+
*
|
|
138
|
+
* @param capability - The capability schema to validate.
|
|
139
|
+
* @returns A CapabilityValidation with any error messages.
|
|
140
|
+
*/
|
|
141
|
+
validateCapability(
|
|
142
|
+
capability: Omit<CapabilitySchema, "capability_id">,
|
|
143
|
+
): Promise<ApiResult<CapabilityValidation>>;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Retrieve all marketplace listings, optionally filtered by namespace.
|
|
147
|
+
*
|
|
148
|
+
* @param options - Optional filter and pagination parameters.
|
|
149
|
+
* @returns Array of AgentListing records.
|
|
150
|
+
*/
|
|
151
|
+
getListings(options?: {
|
|
152
|
+
readonly namespace?: string;
|
|
153
|
+
readonly category?: string;
|
|
154
|
+
readonly limit?: number;
|
|
155
|
+
}): Promise<ApiResult<readonly AgentListing[]>>;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Retrieve a single capability by its unique identifier.
|
|
159
|
+
*
|
|
160
|
+
* @param capabilityId - The capability_id to look up.
|
|
161
|
+
* @returns The CapabilitySchema for the requested capability.
|
|
162
|
+
*/
|
|
163
|
+
getCapability(capabilityId: string): Promise<ApiResult<CapabilitySchema>>;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Deregister a capability from the marketplace.
|
|
167
|
+
*
|
|
168
|
+
* @param capabilityId - The capability_id to remove.
|
|
169
|
+
* @returns An empty object on successful deregistration.
|
|
170
|
+
*/
|
|
171
|
+
deregisterCapability(
|
|
172
|
+
capabilityId: string,
|
|
173
|
+
): Promise<ApiResult<Readonly<Record<string, never>>>>;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// ---------------------------------------------------------------------------
|
|
177
|
+
// Client factory
|
|
178
|
+
// ---------------------------------------------------------------------------
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Create a typed HTTP client for the agent-marketplace server.
|
|
182
|
+
*
|
|
183
|
+
* @param config - Client configuration including base URL.
|
|
184
|
+
* @returns An AgentMarketplaceClient instance.
|
|
185
|
+
*/
|
|
186
|
+
export function createAgentMarketplaceClient(
|
|
187
|
+
config: AgentMarketplaceClientConfig,
|
|
188
|
+
): AgentMarketplaceClient {
|
|
189
|
+
const { baseUrl, timeoutMs = 30_000, headers: extraHeaders } = config;
|
|
190
|
+
const baseHeaders = buildHeaders(extraHeaders);
|
|
191
|
+
|
|
192
|
+
return {
|
|
193
|
+
async registerCapability(
|
|
194
|
+
capability: Omit<CapabilitySchema, "capability_id">,
|
|
195
|
+
): Promise<ApiResult<CapabilitySchema>> {
|
|
196
|
+
return fetchJson<CapabilitySchema>(
|
|
197
|
+
`${baseUrl}/capabilities`,
|
|
198
|
+
{
|
|
199
|
+
method: "POST",
|
|
200
|
+
headers: baseHeaders,
|
|
201
|
+
body: JSON.stringify(capability),
|
|
202
|
+
},
|
|
203
|
+
timeoutMs,
|
|
204
|
+
);
|
|
205
|
+
},
|
|
206
|
+
|
|
207
|
+
async discoverAgents(
|
|
208
|
+
query?: DiscoveryQuery,
|
|
209
|
+
): Promise<ApiResult<readonly AgentListing[]>> {
|
|
210
|
+
return fetchJson<readonly AgentListing[]>(
|
|
211
|
+
`${baseUrl}/discover`,
|
|
212
|
+
{
|
|
213
|
+
method: "POST",
|
|
214
|
+
headers: baseHeaders,
|
|
215
|
+
body: JSON.stringify(query ?? {}),
|
|
216
|
+
},
|
|
217
|
+
timeoutMs,
|
|
218
|
+
);
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
async matchCapabilities(
|
|
222
|
+
query: DiscoveryQuery,
|
|
223
|
+
): Promise<ApiResult<readonly MatchResult[]>> {
|
|
224
|
+
return fetchJson<readonly MatchResult[]>(
|
|
225
|
+
`${baseUrl}/match`,
|
|
226
|
+
{
|
|
227
|
+
method: "POST",
|
|
228
|
+
headers: baseHeaders,
|
|
229
|
+
body: JSON.stringify(query),
|
|
230
|
+
},
|
|
231
|
+
timeoutMs,
|
|
232
|
+
);
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
async validateCapability(
|
|
236
|
+
capability: Omit<CapabilitySchema, "capability_id">,
|
|
237
|
+
): Promise<ApiResult<CapabilityValidation>> {
|
|
238
|
+
return fetchJson<CapabilityValidation>(
|
|
239
|
+
`${baseUrl}/capabilities/validate`,
|
|
240
|
+
{
|
|
241
|
+
method: "POST",
|
|
242
|
+
headers: baseHeaders,
|
|
243
|
+
body: JSON.stringify(capability),
|
|
244
|
+
},
|
|
245
|
+
timeoutMs,
|
|
246
|
+
);
|
|
247
|
+
},
|
|
248
|
+
|
|
249
|
+
async getListings(options?: {
|
|
250
|
+
readonly namespace?: string;
|
|
251
|
+
readonly category?: string;
|
|
252
|
+
readonly limit?: number;
|
|
253
|
+
}): Promise<ApiResult<readonly AgentListing[]>> {
|
|
254
|
+
const params = new URLSearchParams();
|
|
255
|
+
if (options?.namespace !== undefined) {
|
|
256
|
+
params.set("namespace", options.namespace);
|
|
257
|
+
}
|
|
258
|
+
if (options?.category !== undefined) {
|
|
259
|
+
params.set("category", options.category);
|
|
260
|
+
}
|
|
261
|
+
if (options?.limit !== undefined) {
|
|
262
|
+
params.set("limit", String(options.limit));
|
|
263
|
+
}
|
|
264
|
+
const queryString = params.toString();
|
|
265
|
+
const url = queryString
|
|
266
|
+
? `${baseUrl}/listings?${queryString}`
|
|
267
|
+
: `${baseUrl}/listings`;
|
|
268
|
+
return fetchJson<readonly AgentListing[]>(
|
|
269
|
+
url,
|
|
270
|
+
{ method: "GET", headers: baseHeaders },
|
|
271
|
+
timeoutMs,
|
|
272
|
+
);
|
|
273
|
+
},
|
|
274
|
+
|
|
275
|
+
async getCapability(
|
|
276
|
+
capabilityId: string,
|
|
277
|
+
): Promise<ApiResult<CapabilitySchema>> {
|
|
278
|
+
return fetchJson<CapabilitySchema>(
|
|
279
|
+
`${baseUrl}/capabilities/${encodeURIComponent(capabilityId)}`,
|
|
280
|
+
{ method: "GET", headers: baseHeaders },
|
|
281
|
+
timeoutMs,
|
|
282
|
+
);
|
|
283
|
+
},
|
|
284
|
+
|
|
285
|
+
async deregisterCapability(
|
|
286
|
+
capabilityId: string,
|
|
287
|
+
): Promise<ApiResult<Readonly<Record<string, never>>>> {
|
|
288
|
+
return fetchJson<Readonly<Record<string, never>>>(
|
|
289
|
+
`${baseUrl}/capabilities/${encodeURIComponent(capabilityId)}`,
|
|
290
|
+
{ method: "DELETE", headers: baseHeaders },
|
|
291
|
+
timeoutMs,
|
|
292
|
+
);
|
|
293
|
+
},
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @aumos/agent-marketplace
|
|
3
|
+
*
|
|
4
|
+
* TypeScript client for the AumOS agent-marketplace library.
|
|
5
|
+
* Provides HTTP client and capability type definitions for agent capability
|
|
6
|
+
* registration, discovery, matching, and validation.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// Client and configuration
|
|
10
|
+
export type { AgentMarketplaceClient, AgentMarketplaceClientConfig } from "./client.js";
|
|
11
|
+
export { createAgentMarketplaceClient } from "./client.js";
|
|
12
|
+
|
|
13
|
+
// Core types
|
|
14
|
+
export type {
|
|
15
|
+
CapabilityCategory,
|
|
16
|
+
PricingModel,
|
|
17
|
+
ProviderInfo,
|
|
18
|
+
QualityMetrics,
|
|
19
|
+
LatencyProfile,
|
|
20
|
+
CapabilitySchema,
|
|
21
|
+
AgentListing,
|
|
22
|
+
DiscoveryQuery,
|
|
23
|
+
MatchResult,
|
|
24
|
+
CapabilityValidation,
|
|
25
|
+
ApiError,
|
|
26
|
+
ApiResult,
|
|
27
|
+
} from "./types.js";
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript interfaces for the agent-marketplace capability registry.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the Pydantic models defined in:
|
|
5
|
+
* agent_marketplace.schema.capability
|
|
6
|
+
* agent_marketplace.schema.provider
|
|
7
|
+
* agent_marketplace.matching.engine
|
|
8
|
+
* agent_marketplace.matching.request
|
|
9
|
+
*
|
|
10
|
+
* All interfaces use readonly fields to match Python's frozen Pydantic models.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
// Enumerations
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* High-level functional category for an agent capability.
|
|
19
|
+
* Maps to CapabilityCategory enum in Python.
|
|
20
|
+
*/
|
|
21
|
+
export type CapabilityCategory =
|
|
22
|
+
| "analysis"
|
|
23
|
+
| "generation"
|
|
24
|
+
| "transformation"
|
|
25
|
+
| "extraction"
|
|
26
|
+
| "interaction"
|
|
27
|
+
| "automation"
|
|
28
|
+
| "evaluation"
|
|
29
|
+
| "research"
|
|
30
|
+
| "reasoning"
|
|
31
|
+
| "specialized";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* How a capability charges for its use.
|
|
35
|
+
* Maps to PricingModel enum in Python.
|
|
36
|
+
*/
|
|
37
|
+
export type PricingModel =
|
|
38
|
+
| "per_call"
|
|
39
|
+
| "per_token"
|
|
40
|
+
| "per_minute"
|
|
41
|
+
| "free"
|
|
42
|
+
| "custom";
|
|
43
|
+
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
// Provider info
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Identity and contact information for a capability provider.
|
|
50
|
+
* Maps to ProviderInfo in Python.
|
|
51
|
+
*/
|
|
52
|
+
export interface ProviderInfo {
|
|
53
|
+
/** Human-readable name of the provider (person or organization). */
|
|
54
|
+
readonly name: string;
|
|
55
|
+
/** Optional formal organization name. */
|
|
56
|
+
readonly organization: string;
|
|
57
|
+
/** Email address for support or inquiries. */
|
|
58
|
+
readonly contact_email: string;
|
|
59
|
+
/** Optional provider website URL. */
|
|
60
|
+
readonly website: string;
|
|
61
|
+
/** Optional GitHub username or org handle. */
|
|
62
|
+
readonly github_handle: string;
|
|
63
|
+
/** Optional Hugging Face username or org handle. */
|
|
64
|
+
readonly huggingface_handle: string;
|
|
65
|
+
/** Whether the provider identity has been externally verified. */
|
|
66
|
+
readonly verified: boolean;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// ---------------------------------------------------------------------------
|
|
70
|
+
// Quality metrics and latency profile
|
|
71
|
+
// ---------------------------------------------------------------------------
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Quantitative quality measurements for a capability.
|
|
75
|
+
* Maps to QualityMetrics in Python.
|
|
76
|
+
*/
|
|
77
|
+
export interface QualityMetrics {
|
|
78
|
+
/** Mapping of metric name to numeric score (e.g. {"accuracy": 0.94}). */
|
|
79
|
+
readonly metrics: Readonly<Record<string, number>>;
|
|
80
|
+
/** Name or URL of the benchmark that produced these numbers. */
|
|
81
|
+
readonly benchmark_source: string;
|
|
82
|
+
/** ISO 8601 date string when benchmarks were last run. */
|
|
83
|
+
readonly benchmark_date: string;
|
|
84
|
+
/** Whether these metrics have been independently verified. */
|
|
85
|
+
readonly verified: boolean;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Latency percentile measurements in milliseconds.
|
|
90
|
+
* Maps to LatencyProfile in Python.
|
|
91
|
+
*/
|
|
92
|
+
export interface LatencyProfile {
|
|
93
|
+
/** Median (50th percentile) latency in milliseconds. */
|
|
94
|
+
readonly p50_ms: number;
|
|
95
|
+
/** 95th percentile latency in milliseconds. */
|
|
96
|
+
readonly p95_ms: number;
|
|
97
|
+
/** 99th percentile latency in milliseconds. */
|
|
98
|
+
readonly p99_ms: number;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// ---------------------------------------------------------------------------
|
|
102
|
+
// Capability schema
|
|
103
|
+
// ---------------------------------------------------------------------------
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* A fully described agent capability registered in the marketplace.
|
|
107
|
+
* Maps to AgentCapability in Python.
|
|
108
|
+
*/
|
|
109
|
+
export interface CapabilitySchema {
|
|
110
|
+
/** Auto-generated stable identifier (SHA-256 hex prefix of name+version+provider). */
|
|
111
|
+
readonly capability_id: string;
|
|
112
|
+
/** Short, human-readable capability name (e.g. "pdf-extractor"). */
|
|
113
|
+
readonly name: string;
|
|
114
|
+
/** Semantic version string (e.g. "1.2.0"). */
|
|
115
|
+
readonly version: string;
|
|
116
|
+
/** Prose description of what the capability does. */
|
|
117
|
+
readonly description: string;
|
|
118
|
+
/** Primary functional category. */
|
|
119
|
+
readonly category: CapabilityCategory;
|
|
120
|
+
/** Free-form tags for keyword search. */
|
|
121
|
+
readonly tags: readonly string[];
|
|
122
|
+
/** MIME types or schema names accepted by the capability. */
|
|
123
|
+
readonly input_types: readonly string[];
|
|
124
|
+
/** MIME type or schema name produced by the capability. */
|
|
125
|
+
readonly output_type: string;
|
|
126
|
+
/** Benchmark and quality scores. */
|
|
127
|
+
readonly quality_metrics: QualityMetrics;
|
|
128
|
+
/** How usage is billed. */
|
|
129
|
+
readonly pricing_model: PricingModel;
|
|
130
|
+
/** Unit cost corresponding to the pricing model (USD). */
|
|
131
|
+
readonly cost: number;
|
|
132
|
+
/** Latency percentile profile. */
|
|
133
|
+
readonly latency: LatencyProfile;
|
|
134
|
+
/** Natural language codes (ISO 639-1) the capability handles. */
|
|
135
|
+
readonly supported_languages: readonly string[];
|
|
136
|
+
/** Agent framework names this capability has adapters for. */
|
|
137
|
+
readonly supported_frameworks: readonly string[];
|
|
138
|
+
/** Current computed trust score (0.0–1.0); updated by TrustScorer. */
|
|
139
|
+
readonly trust_level: number;
|
|
140
|
+
/** Identity information for the capability publisher. */
|
|
141
|
+
readonly provider: ProviderInfo;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// ---------------------------------------------------------------------------
|
|
145
|
+
// Agent listing
|
|
146
|
+
// ---------------------------------------------------------------------------
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* A marketplace listing entry returned when browsing available capabilities.
|
|
150
|
+
* Combines the capability schema with marketplace metadata.
|
|
151
|
+
*/
|
|
152
|
+
export interface AgentListing {
|
|
153
|
+
/** The registered capability schema. */
|
|
154
|
+
readonly capability: CapabilitySchema;
|
|
155
|
+
/** ISO-8601 UTC timestamp when this capability was registered. */
|
|
156
|
+
readonly registered_at: string;
|
|
157
|
+
/** Total number of times this capability has been invoked. */
|
|
158
|
+
readonly usage_count: number;
|
|
159
|
+
/** Average user rating in [0.0, 5.0], or null if no ratings. */
|
|
160
|
+
readonly average_rating: number | null;
|
|
161
|
+
/** Namespace this capability belongs to (e.g. "aumos", "community"). */
|
|
162
|
+
readonly namespace: string;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// ---------------------------------------------------------------------------
|
|
166
|
+
// Discovery query
|
|
167
|
+
// ---------------------------------------------------------------------------
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Parameters for discovering agent capabilities in the marketplace.
|
|
171
|
+
* Maps to FilterConstraints + CapabilityRequest in Python.
|
|
172
|
+
*/
|
|
173
|
+
export interface DiscoveryQuery {
|
|
174
|
+
/** Required capability keywords, names, or category strings. */
|
|
175
|
+
readonly required_capabilities?: readonly string[];
|
|
176
|
+
/** Preferred median latency in milliseconds (soft preference). */
|
|
177
|
+
readonly preferred_latency_ms?: number;
|
|
178
|
+
/** Maximum acceptable cost per call in USD. */
|
|
179
|
+
readonly max_cost?: number;
|
|
180
|
+
/** Minimum acceptable trust level [0.0, 1.0]. */
|
|
181
|
+
readonly min_trust?: number;
|
|
182
|
+
/** Restrict results to a single capability category. */
|
|
183
|
+
readonly category?: CapabilityCategory;
|
|
184
|
+
/** Tags that must all be present (AND semantics). */
|
|
185
|
+
readonly required_tags?: readonly string[];
|
|
186
|
+
/** Maximum number of results to return. */
|
|
187
|
+
readonly limit?: number;
|
|
188
|
+
/** Namespace to restrict the search to. */
|
|
189
|
+
readonly namespace?: string;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// ---------------------------------------------------------------------------
|
|
193
|
+
// Match result
|
|
194
|
+
// ---------------------------------------------------------------------------
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* A capability paired with its composite match score for a specific request.
|
|
198
|
+
* Maps to MatchResult in Python.
|
|
199
|
+
*/
|
|
200
|
+
export interface MatchResult {
|
|
201
|
+
/** The matched capability schema. */
|
|
202
|
+
readonly capability: CapabilitySchema;
|
|
203
|
+
/** Composite match quality score in [0.0, 1.0]. Higher is better. */
|
|
204
|
+
readonly match_score: number;
|
|
205
|
+
/** Fraction of required capabilities matched [0.0, 1.0]. */
|
|
206
|
+
readonly capability_overlap: number;
|
|
207
|
+
/** Latency fitness component [0.0, 1.0]. */
|
|
208
|
+
readonly latency_score: number;
|
|
209
|
+
/** Trust component (direct from capability.trust_level). */
|
|
210
|
+
readonly trust_score: number;
|
|
211
|
+
/** Cost fitness component [0.0, 1.0]. */
|
|
212
|
+
readonly cost_score: number;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// ---------------------------------------------------------------------------
|
|
216
|
+
// Capability validation
|
|
217
|
+
// ---------------------------------------------------------------------------
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Result of validating a capability schema against marketplace business rules.
|
|
221
|
+
* Maps to the output of AgentCapability.validate() in Python.
|
|
222
|
+
*/
|
|
223
|
+
export interface CapabilityValidation {
|
|
224
|
+
/** Whether the capability passes all validation rules. */
|
|
225
|
+
readonly valid: boolean;
|
|
226
|
+
/** List of human-readable error messages; empty when valid. */
|
|
227
|
+
readonly errors: readonly string[];
|
|
228
|
+
/** The capability_id that was validated. */
|
|
229
|
+
readonly capability_id: string;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// ---------------------------------------------------------------------------
|
|
233
|
+
// API result wrapper
|
|
234
|
+
// ---------------------------------------------------------------------------
|
|
235
|
+
|
|
236
|
+
/** Standard error payload returned by the agent-marketplace API. */
|
|
237
|
+
export interface ApiError {
|
|
238
|
+
readonly error: string;
|
|
239
|
+
readonly detail: string;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/** Result type for all client operations. */
|
|
243
|
+
export type ApiResult<T> =
|
|
244
|
+
| { readonly ok: true; readonly data: T }
|
|
245
|
+
| { readonly ok: false; readonly error: ApiError; readonly status: number };
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"lib": ["ES2020", "DOM"],
|
|
7
|
+
"outDir": "./dist",
|
|
8
|
+
"rootDir": "./src",
|
|
9
|
+
"declaration": true,
|
|
10
|
+
"declarationMap": true,
|
|
11
|
+
"sourceMap": true,
|
|
12
|
+
"strict": true,
|
|
13
|
+
"noImplicitAny": true,
|
|
14
|
+
"strictNullChecks": true,
|
|
15
|
+
"noUnusedLocals": true,
|
|
16
|
+
"noUnusedParameters": true,
|
|
17
|
+
"noImplicitReturns": true,
|
|
18
|
+
"exactOptionalPropertyTypes": true,
|
|
19
|
+
"forceConsistentCasingInFileNames": true,
|
|
20
|
+
"esModuleInterop": true,
|
|
21
|
+
"skipLibCheck": true
|
|
22
|
+
},
|
|
23
|
+
"include": ["src/**/*"],
|
|
24
|
+
"exclude": ["node_modules", "dist"]
|
|
25
|
+
}
|