@aumos/agent-vertical 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 +101 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +118 -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 +190 -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 +36 -0
- package/src/client.ts +287 -0
- package/src/index.ts +31 -0
- package/src/types.ts +250 -0
- package/tsconfig.json +25 -0
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client for the agent-vertical domain template 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 { createAgentVerticalClient } from "@aumos/agent-vertical";
|
|
10
|
+
*
|
|
11
|
+
* const client = createAgentVerticalClient({ baseUrl: "http://localhost:8093" });
|
|
12
|
+
*
|
|
13
|
+
* const templates = await client.getTemplates({ domain: "healthcare" });
|
|
14
|
+
*
|
|
15
|
+
* if (templates.ok) {
|
|
16
|
+
* console.log("Available templates:", templates.data.map(t => t.metadata.name));
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
import type { ApiResult, DomainConfig, DomainTemplate, PromptPattern, TemplateConfig, TemplateValidationResult, ToolCollection } from "./types.js";
|
|
21
|
+
/** Configuration options for the AgentVerticalClient. */
|
|
22
|
+
export interface AgentVerticalClientConfig {
|
|
23
|
+
/** Base URL of the agent-vertical server (e.g. "http://localhost:8093"). */
|
|
24
|
+
readonly baseUrl: string;
|
|
25
|
+
/** Optional request timeout in milliseconds (default: 30000). */
|
|
26
|
+
readonly timeoutMs?: number;
|
|
27
|
+
/** Optional extra HTTP headers sent with every request. */
|
|
28
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
29
|
+
}
|
|
30
|
+
/** Typed HTTP client for the agent-vertical server. */
|
|
31
|
+
export interface AgentVerticalClient {
|
|
32
|
+
/**
|
|
33
|
+
* List all registered domain templates, optionally filtered by domain.
|
|
34
|
+
*
|
|
35
|
+
* @param options - Optional domain filter.
|
|
36
|
+
* @returns Array of DomainTemplate records sorted by full name.
|
|
37
|
+
*/
|
|
38
|
+
getTemplates(options?: {
|
|
39
|
+
domain?: string;
|
|
40
|
+
limit?: number;
|
|
41
|
+
}): Promise<ApiResult<readonly DomainTemplate[]>>;
|
|
42
|
+
/**
|
|
43
|
+
* Apply a named template to an agent deployment configuration.
|
|
44
|
+
*
|
|
45
|
+
* @param config - Template name and optional parameter overrides.
|
|
46
|
+
* @returns The resolved DomainTemplate with applied configuration.
|
|
47
|
+
*/
|
|
48
|
+
applyTemplate(config: TemplateConfig): Promise<ApiResult<DomainTemplate>>;
|
|
49
|
+
/**
|
|
50
|
+
* Validate a domain template for compliance and structural correctness.
|
|
51
|
+
*
|
|
52
|
+
* @param templateName - The machine-readable template name to validate.
|
|
53
|
+
* @returns A TemplateValidationResult with any warnings found.
|
|
54
|
+
*/
|
|
55
|
+
validateTemplate(templateName: string): Promise<ApiResult<TemplateValidationResult>>;
|
|
56
|
+
/**
|
|
57
|
+
* Get the tool collection for a specific domain or template.
|
|
58
|
+
*
|
|
59
|
+
* @param options - Domain or template name to retrieve tools for.
|
|
60
|
+
* @returns A ToolCollection with all available tool configs.
|
|
61
|
+
*/
|
|
62
|
+
getToolCollection(options: {
|
|
63
|
+
domain?: string;
|
|
64
|
+
template_name?: string;
|
|
65
|
+
}): Promise<ApiResult<ToolCollection>>;
|
|
66
|
+
/**
|
|
67
|
+
* Get the domain configuration including templates and compliance rules.
|
|
68
|
+
*
|
|
69
|
+
* @param domain - The domain identifier (e.g. "healthcare", "finance").
|
|
70
|
+
* @returns A DomainConfig with templates and compliance rules.
|
|
71
|
+
*/
|
|
72
|
+
getDomainConfig(domain: string): Promise<ApiResult<DomainConfig>>;
|
|
73
|
+
/**
|
|
74
|
+
* Get the compliance prompt patterns (rules) for a domain.
|
|
75
|
+
*
|
|
76
|
+
* @param domain - The domain identifier.
|
|
77
|
+
* @returns A PromptPattern with all ComplianceRule records for that domain.
|
|
78
|
+
*/
|
|
79
|
+
getPromptPattern(domain: string): Promise<ApiResult<PromptPattern>>;
|
|
80
|
+
/**
|
|
81
|
+
* List all registered domains.
|
|
82
|
+
*
|
|
83
|
+
* @returns Array of domain identifier strings.
|
|
84
|
+
*/
|
|
85
|
+
listDomains(): Promise<ApiResult<readonly string[]>>;
|
|
86
|
+
/**
|
|
87
|
+
* Retrieve a single template by name.
|
|
88
|
+
*
|
|
89
|
+
* @param templateName - The machine-readable template name.
|
|
90
|
+
* @returns The DomainTemplate record.
|
|
91
|
+
*/
|
|
92
|
+
getTemplate(templateName: string): Promise<ApiResult<DomainTemplate>>;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Create a typed HTTP client for the agent-vertical server.
|
|
96
|
+
*
|
|
97
|
+
* @param config - Client configuration including base URL.
|
|
98
|
+
* @returns An AgentVerticalClient instance.
|
|
99
|
+
*/
|
|
100
|
+
export declare function createAgentVerticalClient(config: AgentVerticalClientConfig): AgentVerticalClient;
|
|
101
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAEV,SAAS,EACT,YAAY,EACZ,cAAc,EACd,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB,cAAc,EACf,MAAM,YAAY,CAAC;AAMpB,yDAAyD;AACzD,MAA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W,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC;CACvE;AAMD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,yBAAyB,GAChC,mBAAmB,CAkGrB"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client for the agent-vertical domain template 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 { createAgentVerticalClient } from "@aumos/agent-vertical";
|
|
10
|
+
*
|
|
11
|
+
* const client = createAgentVerticalClient({ baseUrl: "http://localhost:8093" });
|
|
12
|
+
*
|
|
13
|
+
* const templates = await client.getTemplates({ domain: "healthcare" });
|
|
14
|
+
*
|
|
15
|
+
* if (templates.ok) {
|
|
16
|
+
* console.log("Available templates:", templates.data.map(t => t.metadata.name));
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// Internal helpers
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
async function fetchJson(url, init, timeoutMs) {
|
|
24
|
+
const controller = new AbortController();
|
|
25
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
26
|
+
try {
|
|
27
|
+
const response = await fetch(url, { ...init, signal: controller.signal });
|
|
28
|
+
clearTimeout(timeoutId);
|
|
29
|
+
const body = await response.json();
|
|
30
|
+
if (!response.ok) {
|
|
31
|
+
const errorBody = body;
|
|
32
|
+
return {
|
|
33
|
+
ok: false,
|
|
34
|
+
error: {
|
|
35
|
+
error: errorBody.error ?? "Unknown error",
|
|
36
|
+
detail: errorBody.detail ?? "",
|
|
37
|
+
},
|
|
38
|
+
status: response.status,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return { ok: true, data: body };
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
clearTimeout(timeoutId);
|
|
45
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
46
|
+
return {
|
|
47
|
+
ok: false,
|
|
48
|
+
error: { error: "Network error", detail: message },
|
|
49
|
+
status: 0,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function buildHeaders(extraHeaders) {
|
|
54
|
+
return {
|
|
55
|
+
"Content-Type": "application/json",
|
|
56
|
+
Accept: "application/json",
|
|
57
|
+
...extraHeaders,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
// ---------------------------------------------------------------------------
|
|
61
|
+
// Client factory
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
/**
|
|
64
|
+
* Create a typed HTTP client for the agent-vertical server.
|
|
65
|
+
*
|
|
66
|
+
* @param config - Client configuration including base URL.
|
|
67
|
+
* @returns An AgentVerticalClient instance.
|
|
68
|
+
*/
|
|
69
|
+
export function createAgentVerticalClient(config) {
|
|
70
|
+
const { baseUrl, timeoutMs = 30_000, headers: extraHeaders } = config;
|
|
71
|
+
const baseHeaders = buildHeaders(extraHeaders);
|
|
72
|
+
return {
|
|
73
|
+
async getTemplates(options) {
|
|
74
|
+
const params = new URLSearchParams();
|
|
75
|
+
if (options?.domain !== undefined) {
|
|
76
|
+
params.set("domain", options.domain);
|
|
77
|
+
}
|
|
78
|
+
if (options?.limit !== undefined) {
|
|
79
|
+
params.set("limit", String(options.limit));
|
|
80
|
+
}
|
|
81
|
+
const query = params.toString();
|
|
82
|
+
return fetchJson(`${baseUrl}/vertical/templates${query ? `?${query}` : ""}`, { method: "GET", headers: baseHeaders }, timeoutMs);
|
|
83
|
+
},
|
|
84
|
+
async applyTemplate(templateConfig) {
|
|
85
|
+
return fetchJson(`${baseUrl}/vertical/templates/apply`, {
|
|
86
|
+
method: "POST",
|
|
87
|
+
headers: baseHeaders,
|
|
88
|
+
body: JSON.stringify(templateConfig),
|
|
89
|
+
}, timeoutMs);
|
|
90
|
+
},
|
|
91
|
+
async validateTemplate(templateName) {
|
|
92
|
+
return fetchJson(`${baseUrl}/vertical/templates/${encodeURIComponent(templateName)}/validate`, { method: "GET", headers: baseHeaders }, timeoutMs);
|
|
93
|
+
},
|
|
94
|
+
async getToolCollection(options) {
|
|
95
|
+
const params = new URLSearchParams();
|
|
96
|
+
if (options.domain !== undefined) {
|
|
97
|
+
params.set("domain", options.domain);
|
|
98
|
+
}
|
|
99
|
+
if (options.template_name !== undefined) {
|
|
100
|
+
params.set("template_name", options.template_name);
|
|
101
|
+
}
|
|
102
|
+
return fetchJson(`${baseUrl}/vertical/tools?${params.toString()}`, { method: "GET", headers: baseHeaders }, timeoutMs);
|
|
103
|
+
},
|
|
104
|
+
async getDomainConfig(domain) {
|
|
105
|
+
return fetchJson(`${baseUrl}/vertical/domains/${encodeURIComponent(domain)}/config`, { method: "GET", headers: baseHeaders }, timeoutMs);
|
|
106
|
+
},
|
|
107
|
+
async getPromptPattern(domain) {
|
|
108
|
+
return fetchJson(`${baseUrl}/vertical/domains/${encodeURIComponent(domain)}/rules`, { method: "GET", headers: baseHeaders }, timeoutMs);
|
|
109
|
+
},
|
|
110
|
+
async listDomains() {
|
|
111
|
+
return fetchJson(`${baseUrl}/vertical/domains`, { method: "GET", headers: baseHeaders }, timeoutMs);
|
|
112
|
+
},
|
|
113
|
+
async getTemplate(templateName) {
|
|
114
|
+
return fetchJson(`${baseUrl}/vertical/templates/${encodeURIComponent(templateName)}`, { method: "GET", headers: baseHeaders }, timeoutMs);
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AA2BH,8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,CAAC,WAAW;YACf,OAAO,SAAS,CACd,GAAG,OAAO,mBAAmB,EAC7B,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,EACvC,SAAS,CACV,CAAC;QACJ,CAAC;QAED,KAAK,CAAC,WAAW,CAAC,YAAoB;YACpC,OAAO,SAAS,CACd,GAAG,OAAO,uBAAuB,kBAAkB,CAAC,YAAY,CAAC,EAAE,EACnE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,EACvC,SAAS,CACV,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @aumos/agent-vertical
|
|
3
|
+
*
|
|
4
|
+
* TypeScript client for the AumOS agent-vertical domain template system.
|
|
5
|
+
* Provides HTTP client, certified domain templates, safety rules, tool collections,
|
|
6
|
+
* compliance rules, and evaluation metric type definitions.
|
|
7
|
+
*/
|
|
8
|
+
export type { AgentVerticalClient, AgentVerticalClientConfig } from "./client.js";
|
|
9
|
+
export { createAgentVerticalClient } from "./client.js";
|
|
10
|
+
export type { ApiError, ApiResult, ComplianceFramework, ComplianceRule, DomainConfig, DomainTemplate, EvaluationMetric, PromptPattern, RiskLevel, RuleType, SafetyRule, TemplateConfig, TemplateMetadata, TemplateValidationResult, ToolCollection, ToolConfig, } 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,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAGxD,YAAY,EACV,QAAQ,EACR,SAAS,EACT,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,QAAQ,EACR,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,wBAAwB,EACxB,cAAc,EACd,UAAU,GACX,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @aumos/agent-vertical
|
|
3
|
+
*
|
|
4
|
+
* TypeScript client for the AumOS agent-vertical domain template system.
|
|
5
|
+
* Provides HTTP client, certified domain templates, safety rules, tool collections,
|
|
6
|
+
* compliance rules, and evaluation metric type definitions.
|
|
7
|
+
*/
|
|
8
|
+
export { createAgentVerticalClient } 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,yBAAyB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript interfaces for the agent-vertical domain template system.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the Python dataclasses and Pydantic models defined in:
|
|
5
|
+
* agent_vertical.templates.base (DomainTemplate, TemplateRegistry)
|
|
6
|
+
* agent_vertical.certified.schema (SafetyRule, ToolConfig, EvalBenchmark, TemplateMetadata, DomainTemplate)
|
|
7
|
+
* agent_vertical.compliance.domain_rules (RuleType, ComplianceRule, DomainComplianceRules)
|
|
8
|
+
* agent_vertical.certification.risk_tier (RiskTier)
|
|
9
|
+
*
|
|
10
|
+
* All interfaces use readonly fields to match Python frozen dataclasses.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Risk classification tiers for domain templates.
|
|
14
|
+
* Maps to RiskTier / RiskLevel enums in Python.
|
|
15
|
+
*/
|
|
16
|
+
export type RiskLevel = "LOW" | "MEDIUM" | "HIGH" | "CRITICAL";
|
|
17
|
+
/**
|
|
18
|
+
* Recognised compliance and regulatory frameworks.
|
|
19
|
+
* Maps to ComplianceFramework enum in Python.
|
|
20
|
+
*/
|
|
21
|
+
export type ComplianceFramework = "HIPAA" | "SOX" | "GDPR" | "SOC2" | "PCI_DSS" | "NONE";
|
|
22
|
+
/**
|
|
23
|
+
* The type of compliance rule.
|
|
24
|
+
* Maps to RuleType enum in Python.
|
|
25
|
+
*/
|
|
26
|
+
export type RuleType = "PROHIBITED_PHRASE" | "REQUIRED_DISCLAIMER" | "PROHIBITED_PATTERN" | "REQUIRED_PATTERN";
|
|
27
|
+
/**
|
|
28
|
+
* A single safety constraint applied to agent output at runtime.
|
|
29
|
+
* Maps to SafetyRule frozen dataclass in Python.
|
|
30
|
+
*/
|
|
31
|
+
export interface SafetyRule {
|
|
32
|
+
/** Unique dot-notation identifier (e.g. "hipaa.no_phi_exposure"). */
|
|
33
|
+
readonly rule_id: string;
|
|
34
|
+
/** Human-readable description of the constraint. */
|
|
35
|
+
readonly description: string;
|
|
36
|
+
/** Impact level: "warning", "error", or "critical". */
|
|
37
|
+
readonly severity: string;
|
|
38
|
+
/** Python regex pattern used to test agent output. */
|
|
39
|
+
readonly check_pattern: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Configuration for a single tool available to the agent.
|
|
43
|
+
* Maps to ToolConfig frozen dataclass in Python.
|
|
44
|
+
*/
|
|
45
|
+
export interface ToolConfig {
|
|
46
|
+
/** Machine-readable tool name (e.g. "audit_logger"). */
|
|
47
|
+
readonly name: string;
|
|
48
|
+
/** Human-readable description of what the tool does. */
|
|
49
|
+
readonly description: string;
|
|
50
|
+
/** When true, the tool must be wired up before the template is deployable. */
|
|
51
|
+
readonly required: boolean;
|
|
52
|
+
/** Parameter schema for the tool. */
|
|
53
|
+
readonly parameters: Readonly<Record<string, unknown>>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A named collection of tool configurations for a domain.
|
|
57
|
+
* Corresponds to the tools tuple on DomainTemplate in Python.
|
|
58
|
+
*/
|
|
59
|
+
export interface ToolCollection {
|
|
60
|
+
/** Name of this tool collection (typically matching the template domain). */
|
|
61
|
+
readonly collection_name: string;
|
|
62
|
+
/** The tool configurations in this collection. */
|
|
63
|
+
readonly tools: readonly ToolConfig[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* A single evaluation benchmark specification.
|
|
67
|
+
* Maps to EvalBenchmark frozen dataclass in Python.
|
|
68
|
+
*/
|
|
69
|
+
export interface EvaluationMetric {
|
|
70
|
+
/** Short identifier for the benchmark (e.g. "phi_redaction_rate"). */
|
|
71
|
+
readonly name: string;
|
|
72
|
+
/** The measurement being tracked (e.g. "precision", "recall"). */
|
|
73
|
+
readonly metric: string;
|
|
74
|
+
/** Minimum acceptable value on a 0.0–1.0 scale. */
|
|
75
|
+
readonly threshold: number;
|
|
76
|
+
/** Human-readable description of what this benchmark verifies. */
|
|
77
|
+
readonly description: string;
|
|
78
|
+
}
|
|
79
|
+
/** Provenance and classification metadata for a DomainTemplate. */
|
|
80
|
+
export interface TemplateMetadata {
|
|
81
|
+
/** Unique machine-readable template name. */
|
|
82
|
+
readonly name: string;
|
|
83
|
+
/** Semantic version string (e.g. "1.0.0"). */
|
|
84
|
+
readonly version: string;
|
|
85
|
+
/** Domain this template belongs to (e.g. "healthcare"). */
|
|
86
|
+
readonly domain: string;
|
|
87
|
+
/** Compliance frameworks the template is designed to satisfy. */
|
|
88
|
+
readonly compliance_frameworks: readonly ComplianceFramework[];
|
|
89
|
+
/** Risk classification for this template. */
|
|
90
|
+
readonly risk_level: RiskLevel;
|
|
91
|
+
/** Human-readable description of the template's purpose. */
|
|
92
|
+
readonly description: string;
|
|
93
|
+
/** Author or team identifier. */
|
|
94
|
+
readonly author: string;
|
|
95
|
+
/** ISO-8601 UTC datetime of initial template creation. */
|
|
96
|
+
readonly created_at: string;
|
|
97
|
+
/** Free-form tags for search and filtering. */
|
|
98
|
+
readonly tags: readonly string[];
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* A compliance-certified, self-describing agent template.
|
|
102
|
+
* Maps to DomainTemplate Pydantic model in Python (certified.schema).
|
|
103
|
+
*/
|
|
104
|
+
export interface DomainTemplate {
|
|
105
|
+
/** Provenance and classification metadata. */
|
|
106
|
+
readonly metadata: TemplateMetadata;
|
|
107
|
+
/** Full system prompt for the LLM context. */
|
|
108
|
+
readonly system_prompt: string;
|
|
109
|
+
/** Tool declarations with required/optional flags. */
|
|
110
|
+
readonly tool_configs: readonly ToolConfig[];
|
|
111
|
+
/** Runtime safety constraints with regex patterns. */
|
|
112
|
+
readonly safety_rules: readonly SafetyRule[];
|
|
113
|
+
/** Free-form governance policies (key/value). */
|
|
114
|
+
readonly governance_policies: Readonly<Record<string, unknown>>;
|
|
115
|
+
/** Evaluation benchmarks with numeric thresholds. */
|
|
116
|
+
readonly eval_benchmarks: readonly EvaluationMetric[];
|
|
117
|
+
/** Mapping of framework name to compliance evidence description. */
|
|
118
|
+
readonly compliance_evidence: Readonly<Record<string, string>>;
|
|
119
|
+
}
|
|
120
|
+
/** Configuration options for applying a template to an agent. */
|
|
121
|
+
export interface TemplateConfig {
|
|
122
|
+
/** The template name to apply. */
|
|
123
|
+
readonly template_name: string;
|
|
124
|
+
/** Optional parameter overrides for this deployment. */
|
|
125
|
+
readonly parameter_overrides?: Readonly<Record<string, unknown>>;
|
|
126
|
+
/** Whether to perform pre-apply validation. */
|
|
127
|
+
readonly validate_before_apply?: boolean;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* A single domain compliance rule.
|
|
131
|
+
* Maps to ComplianceRule frozen dataclass in Python.
|
|
132
|
+
*/
|
|
133
|
+
export interface ComplianceRule {
|
|
134
|
+
/** Unique identifier in dot notation (e.g. "hipaa.no_diagnosis"). */
|
|
135
|
+
readonly rule_id: string;
|
|
136
|
+
/** Whether this rule prohibits or requires content. */
|
|
137
|
+
readonly rule_type: RuleType;
|
|
138
|
+
/** The phrase or regex pattern to test against agent responses. */
|
|
139
|
+
readonly pattern: string;
|
|
140
|
+
/** Human-readable description of what this rule enforces. */
|
|
141
|
+
readonly description: string;
|
|
142
|
+
/** Impact level: "critical", "high", "medium", or "low". */
|
|
143
|
+
readonly severity: string;
|
|
144
|
+
/** Suggested fix when this rule is violated. */
|
|
145
|
+
readonly remediation: string;
|
|
146
|
+
/** When true, pattern is treated as a regular expression. */
|
|
147
|
+
readonly is_regex: boolean;
|
|
148
|
+
}
|
|
149
|
+
/** A collection of compliance rules for a specific domain. */
|
|
150
|
+
export interface PromptPattern {
|
|
151
|
+
/** Domain identifier (e.g. "healthcare"). */
|
|
152
|
+
readonly domain: string;
|
|
153
|
+
/** Ordered list of rules to enforce. */
|
|
154
|
+
readonly rules: readonly ComplianceRule[];
|
|
155
|
+
}
|
|
156
|
+
/** Result of validating a domain template. */
|
|
157
|
+
export interface TemplateValidationResult {
|
|
158
|
+
/** Whether the template passed all validation checks. */
|
|
159
|
+
readonly valid: boolean;
|
|
160
|
+
/** Human-readable warning messages (non-empty means issues found). */
|
|
161
|
+
readonly warnings: readonly string[];
|
|
162
|
+
/** The template name that was validated. */
|
|
163
|
+
readonly template_name: string;
|
|
164
|
+
}
|
|
165
|
+
/** Summary configuration for a specific domain. */
|
|
166
|
+
export interface DomainConfig {
|
|
167
|
+
/** Domain identifier. */
|
|
168
|
+
readonly domain: string;
|
|
169
|
+
/** Available templates in this domain. */
|
|
170
|
+
readonly templates: readonly string[];
|
|
171
|
+
/** Compliance rules applicable to this domain. */
|
|
172
|
+
readonly compliance_rules: readonly ComplianceRule[];
|
|
173
|
+
/** Supported compliance frameworks for this domain. */
|
|
174
|
+
readonly supported_frameworks: readonly ComplianceFramework[];
|
|
175
|
+
}
|
|
176
|
+
/** Standard error payload returned by the agent-vertical API. */
|
|
177
|
+
export interface ApiError {
|
|
178
|
+
readonly error: string;
|
|
179
|
+
readonly detail: string;
|
|
180
|
+
}
|
|
181
|
+
/** Result type for all client operations. */
|
|
182
|
+
export type ApiResult<T> = {
|
|
183
|
+
readonly ok: true;
|
|
184
|
+
readonly data: T;
|
|
185
|
+
} | {
|
|
186
|
+
readonly ok: false;
|
|
187
|
+
readonly error: ApiError;
|
|
188
|
+
readonly status: number;
|
|
189
|
+
};
|
|
190
|
+
//# 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,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;AAE/D;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAC3B,OAAO,GACP,KAAK,GACL,MAAM,GACN,MAAM,GACN,SAAS,GACT,MAAM,CAAC;AAEX;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAChB,mBAAmB,GACnB,qBAAqB,GACrB,oBAAoB,GACpB,kBAAkB,CAAC;AAMvB;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,qEAAqE;IACrE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,oDAAoD;IACpD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,sDAAsD;IACtD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAMD;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,wDAAwD;IACxD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,wDAAwD;IACxD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,8EAA8E;IAC9E,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,qCAAqC;IACrC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,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aces for the agent-vertical domain template system.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the Python dataclasses and Pydantic models defined in:
|
|
5
|
+
* agent_vertical.templates.base (DomainTemplate, TemplateRegistry)
|
|
6
|
+
* agent_vertical.certified.schema (SafetyRule, ToolConfig, EvalBenchmark, TemplateMetadata, DomainTemplate)
|
|
7
|
+
* agent_vertical.compliance.domain_rules (RuleType, ComplianceRule, DomainComplianceRules)
|
|
8
|
+
* agent_vertical.certification.risk_tier (RiskTier)
|
|
9
|
+
*
|
|
10
|
+
* All interfaces use readonly fields to match Python frozen dataclasses.
|
|
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,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aumos/agent-vertical",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TypeScript client for the AumOS agent-vertical domain templates — certified domain templates, safety rules, tool collections, and compliance 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-vertical",
|
|
25
|
+
"domain-templates",
|
|
26
|
+
"compliance",
|
|
27
|
+
"healthcare",
|
|
28
|
+
"finance",
|
|
29
|
+
"legal",
|
|
30
|
+
"typescript"
|
|
31
|
+
],
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/aumos-ai/agent-vertical"
|
|
35
|
+
}
|
|
36
|
+
}
|
package/src/client.ts
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client for the agent-vertical domain template 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 { createAgentVerticalClient } from "@aumos/agent-vertical";
|
|
10
|
+
*
|
|
11
|
+
* const client = createAgentVerticalClient({ baseUrl: "http://localhost:8093" });
|
|
12
|
+
*
|
|
13
|
+
* const templates = await client.getTemplates({ domain: "healthcare" });
|
|
14
|
+
*
|
|
15
|
+
* if (templates.ok) {
|
|
16
|
+
* console.log("Available templates:", templates.data.map(t => t.metadata.name));
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import type {
|
|
22
|
+
ApiError,
|
|
23
|
+
ApiResult,
|
|
24
|
+
DomainConfig,
|
|
25
|
+
DomainTemplate,
|
|
26
|
+
PromptPattern,
|
|
27
|
+
TemplateConfig,
|
|
28
|
+
TemplateValidationResult,
|
|
29
|
+
ToolCollection,
|
|
30
|
+
} from "./types.js";
|
|
31
|
+
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
// Client configuration
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
|
|
36
|
+
/** Configuration options for the AgentVerticalClient. */
|
|
37
|
+
export interface AgentVerticalClientConfig {
|
|
38
|
+
/** Base URL of the agent-vertical server (e.g. "http://localhost:8093"). */
|
|
39
|
+
readonly baseUrl: string;
|
|
40
|
+
/** Optional request timeout in milliseconds (default: 30000). */
|
|
41
|
+
readonly timeoutMs?: number;
|
|
42
|
+
/** Optional extra HTTP headers sent with every request. */
|
|
43
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
// Internal helpers
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
|
|
50
|
+
async function fetchJson<T>(
|
|
51
|
+
url: string,
|
|
52
|
+
init: RequestInit,
|
|
53
|
+
timeoutMs: number,
|
|
54
|
+
): Promise<ApiResult<T>> {
|
|
55
|
+
const controller = new AbortController();
|
|
56
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
const response = await fetch(url, { ...init, signal: controller.signal });
|
|
60
|
+
clearTimeout(timeoutId);
|
|
61
|
+
|
|
62
|
+
const body = await response.json() as unknown;
|
|
63
|
+
|
|
64
|
+
if (!response.ok) {
|
|
65
|
+
const errorBody = body as Partial<ApiError>;
|
|
66
|
+
return {
|
|
67
|
+
ok: false,
|
|
68
|
+
error: {
|
|
69
|
+
error: errorBody.error ?? "Unknown error",
|
|
70
|
+
detail: errorBody.detail ?? "",
|
|
71
|
+
},
|
|
72
|
+
status: response.status,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return { ok: true, data: body as T };
|
|
77
|
+
} catch (err: unknown) {
|
|
78
|
+
clearTimeout(timeoutId);
|
|
79
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
80
|
+
return {
|
|
81
|
+
ok: false,
|
|
82
|
+
error: { error: "Network error", detail: message },
|
|
83
|
+
status: 0,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function buildHeaders(
|
|
89
|
+
extraHeaders: Readonly<Record<string, string>> | undefined,
|
|
90
|
+
): Record<string, string> {
|
|
91
|
+
return {
|
|
92
|
+
"Content-Type": "application/json",
|
|
93
|
+
Accept: "application/json",
|
|
94
|
+
...extraHeaders,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// ---------------------------------------------------------------------------
|
|
99
|
+
// Client interface
|
|
100
|
+
// ---------------------------------------------------------------------------
|
|
101
|
+
|
|
102
|
+
/** Typed HTTP client for the agent-vertical server. */
|
|
103
|
+
export interface AgentVerticalClient {
|
|
104
|
+
/**
|
|
105
|
+
* List all registered domain templates, optionally filtered by domain.
|
|
106
|
+
*
|
|
107
|
+
* @param options - Optional domain filter.
|
|
108
|
+
* @returns Array of DomainTemplate records sorted by full name.
|
|
109
|
+
*/
|
|
110
|
+
getTemplates(options?: {
|
|
111
|
+
domain?: string;
|
|
112
|
+
limit?: number;
|
|
113
|
+
}): Promise<ApiResult<readonly DomainTemplate[]>>;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Apply a named template to an agent deployment configuration.
|
|
117
|
+
*
|
|
118
|
+
* @param config - Template name and optional parameter overrides.
|
|
119
|
+
* @returns The resolved DomainTemplate with applied configuration.
|
|
120
|
+
*/
|
|
121
|
+
applyTemplate(config: TemplateConfig): Promise<ApiResult<DomainTemplate>>;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Validate a domain template for compliance and structural correctness.
|
|
125
|
+
*
|
|
126
|
+
* @param templateName - The machine-readable template name to validate.
|
|
127
|
+
* @returns A TemplateValidationResult with any warnings found.
|
|
128
|
+
*/
|
|
129
|
+
validateTemplate(
|
|
130
|
+
templateName: string,
|
|
131
|
+
): Promise<ApiResult<TemplateValidationResult>>;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Get the tool collection for a specific domain or template.
|
|
135
|
+
*
|
|
136
|
+
* @param options - Domain or template name to retrieve tools for.
|
|
137
|
+
* @returns A ToolCollection with all available tool configs.
|
|
138
|
+
*/
|
|
139
|
+
getToolCollection(options: {
|
|
140
|
+
domain?: string;
|
|
141
|
+
template_name?: string;
|
|
142
|
+
}): Promise<ApiResult<ToolCollection>>;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Get the domain configuration including templates and compliance rules.
|
|
146
|
+
*
|
|
147
|
+
* @param domain - The domain identifier (e.g. "healthcare", "finance").
|
|
148
|
+
* @returns A DomainConfig with templates and compliance rules.
|
|
149
|
+
*/
|
|
150
|
+
getDomainConfig(domain: string): Promise<ApiResult<DomainConfig>>;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Get the compliance prompt patterns (rules) for a domain.
|
|
154
|
+
*
|
|
155
|
+
* @param domain - The domain identifier.
|
|
156
|
+
* @returns A PromptPattern with all ComplianceRule records for that domain.
|
|
157
|
+
*/
|
|
158
|
+
getPromptPattern(domain: string): Promise<ApiResult<PromptPattern>>;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* List all registered domains.
|
|
162
|
+
*
|
|
163
|
+
* @returns Array of domain identifier strings.
|
|
164
|
+
*/
|
|
165
|
+
listDomains(): Promise<ApiResult<readonly string[]>>;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Retrieve a single template by name.
|
|
169
|
+
*
|
|
170
|
+
* @param templateName - The machine-readable template name.
|
|
171
|
+
* @returns The DomainTemplate record.
|
|
172
|
+
*/
|
|
173
|
+
getTemplate(templateName: string): Promise<ApiResult<DomainTemplate>>;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// ---------------------------------------------------------------------------
|
|
177
|
+
// Client factory
|
|
178
|
+
// ---------------------------------------------------------------------------
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Create a typed HTTP client for the agent-vertical server.
|
|
182
|
+
*
|
|
183
|
+
* @param config - Client configuration including base URL.
|
|
184
|
+
* @returns An AgentVerticalClient instance.
|
|
185
|
+
*/
|
|
186
|
+
export function createAgentVerticalClient(
|
|
187
|
+
config: AgentVerticalClientConfig,
|
|
188
|
+
): AgentVerticalClient {
|
|
189
|
+
const { baseUrl, timeoutMs = 30_000, headers: extraHeaders } = config;
|
|
190
|
+
const baseHeaders = buildHeaders(extraHeaders);
|
|
191
|
+
|
|
192
|
+
return {
|
|
193
|
+
async getTemplates(options?: {
|
|
194
|
+
domain?: string;
|
|
195
|
+
limit?: number;
|
|
196
|
+
}): Promise<ApiResult<readonly DomainTemplate[]>> {
|
|
197
|
+
const params = new URLSearchParams();
|
|
198
|
+
if (options?.domain !== undefined) {
|
|
199
|
+
params.set("domain", options.domain);
|
|
200
|
+
}
|
|
201
|
+
if (options?.limit !== undefined) {
|
|
202
|
+
params.set("limit", String(options.limit));
|
|
203
|
+
}
|
|
204
|
+
const query = params.toString();
|
|
205
|
+
return fetchJson<readonly DomainTemplate[]>(
|
|
206
|
+
`${baseUrl}/vertical/templates${query ? `?${query}` : ""}`,
|
|
207
|
+
{ method: "GET", headers: baseHeaders },
|
|
208
|
+
timeoutMs,
|
|
209
|
+
);
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
async applyTemplate(
|
|
213
|
+
templateConfig: TemplateConfig,
|
|
214
|
+
): Promise<ApiResult<DomainTemplate>> {
|
|
215
|
+
return fetchJson<DomainTemplate>(
|
|
216
|
+
`${baseUrl}/vertical/templates/apply`,
|
|
217
|
+
{
|
|
218
|
+
method: "POST",
|
|
219
|
+
headers: baseHeaders,
|
|
220
|
+
body: JSON.stringify(templateConfig),
|
|
221
|
+
},
|
|
222
|
+
timeoutMs,
|
|
223
|
+
);
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
async validateTemplate(
|
|
227
|
+
templateName: string,
|
|
228
|
+
): Promise<ApiResult<TemplateValidationResult>> {
|
|
229
|
+
return fetchJson<TemplateValidationResult>(
|
|
230
|
+
`${baseUrl}/vertical/templates/${encodeURIComponent(templateName)}/validate`,
|
|
231
|
+
{ method: "GET", headers: baseHeaders },
|
|
232
|
+
timeoutMs,
|
|
233
|
+
);
|
|
234
|
+
},
|
|
235
|
+
|
|
236
|
+
async getToolCollection(options: {
|
|
237
|
+
domain?: string;
|
|
238
|
+
template_name?: string;
|
|
239
|
+
}): Promise<ApiResult<ToolCollection>> {
|
|
240
|
+
const params = new URLSearchParams();
|
|
241
|
+
if (options.domain !== undefined) {
|
|
242
|
+
params.set("domain", options.domain);
|
|
243
|
+
}
|
|
244
|
+
if (options.template_name !== undefined) {
|
|
245
|
+
params.set("template_name", options.template_name);
|
|
246
|
+
}
|
|
247
|
+
return fetchJson<ToolCollection>(
|
|
248
|
+
`${baseUrl}/vertical/tools?${params.toString()}`,
|
|
249
|
+
{ method: "GET", headers: baseHeaders },
|
|
250
|
+
timeoutMs,
|
|
251
|
+
);
|
|
252
|
+
},
|
|
253
|
+
|
|
254
|
+
async getDomainConfig(domain: string): Promise<ApiResult<DomainConfig>> {
|
|
255
|
+
return fetchJson<DomainConfig>(
|
|
256
|
+
`${baseUrl}/vertical/domains/${encodeURIComponent(domain)}/config`,
|
|
257
|
+
{ method: "GET", headers: baseHeaders },
|
|
258
|
+
timeoutMs,
|
|
259
|
+
);
|
|
260
|
+
},
|
|
261
|
+
|
|
262
|
+
async getPromptPattern(domain: string): Promise<ApiResult<PromptPattern>> {
|
|
263
|
+
return fetchJson<PromptPattern>(
|
|
264
|
+
`${baseUrl}/vertical/domains/${encodeURIComponent(domain)}/rules`,
|
|
265
|
+
{ method: "GET", headers: baseHeaders },
|
|
266
|
+
timeoutMs,
|
|
267
|
+
);
|
|
268
|
+
},
|
|
269
|
+
|
|
270
|
+
async listDomains(): Promise<ApiResult<readonly string[]>> {
|
|
271
|
+
return fetchJson<readonly string[]>(
|
|
272
|
+
`${baseUrl}/vertical/domains`,
|
|
273
|
+
{ method: "GET", headers: baseHeaders },
|
|
274
|
+
timeoutMs,
|
|
275
|
+
);
|
|
276
|
+
},
|
|
277
|
+
|
|
278
|
+
async getTemplate(templateName: string): Promise<ApiResult<DomainTemplate>> {
|
|
279
|
+
return fetchJson<DomainTemplate>(
|
|
280
|
+
`${baseUrl}/vertical/templates/${encodeURIComponent(templateName)}`,
|
|
281
|
+
{ method: "GET", headers: baseHeaders },
|
|
282
|
+
timeoutMs,
|
|
283
|
+
);
|
|
284
|
+
},
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @aumos/agent-vertical
|
|
3
|
+
*
|
|
4
|
+
* TypeScript client for the AumOS agent-vertical domain template system.
|
|
5
|
+
* Provides HTTP client, certified domain templates, safety rules, tool collections,
|
|
6
|
+
* compliance rules, and evaluation metric type definitions.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// Client and configuration
|
|
10
|
+
export type { AgentVerticalClient, AgentVerticalClientConfig } from "./client.js";
|
|
11
|
+
export { createAgentVerticalClient } from "./client.js";
|
|
12
|
+
|
|
13
|
+
// Core types
|
|
14
|
+
export type {
|
|
15
|
+
ApiError,
|
|
16
|
+
ApiResult,
|
|
17
|
+
ComplianceFramework,
|
|
18
|
+
ComplianceRule,
|
|
19
|
+
DomainConfig,
|
|
20
|
+
DomainTemplate,
|
|
21
|
+
EvaluationMetric,
|
|
22
|
+
PromptPattern,
|
|
23
|
+
RiskLevel,
|
|
24
|
+
RuleType,
|
|
25
|
+
SafetyRule,
|
|
26
|
+
TemplateConfig,
|
|
27
|
+
TemplateMetadata,
|
|
28
|
+
TemplateValidationResult,
|
|
29
|
+
ToolCollection,
|
|
30
|
+
ToolConfig,
|
|
31
|
+
} from "./types.js";
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript interfaces for the agent-vertical domain template system.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the Python dataclasses and Pydantic models defined in:
|
|
5
|
+
* agent_vertical.templates.base (DomainTemplate, TemplateRegistry)
|
|
6
|
+
* agent_vertical.certified.schema (SafetyRule, ToolConfig, EvalBenchmark, TemplateMetadata, DomainTemplate)
|
|
7
|
+
* agent_vertical.compliance.domain_rules (RuleType, ComplianceRule, DomainComplianceRules)
|
|
8
|
+
* agent_vertical.certification.risk_tier (RiskTier)
|
|
9
|
+
*
|
|
10
|
+
* All interfaces use readonly fields to match Python frozen dataclasses.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
// Risk and compliance enums
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Risk classification tiers for domain templates.
|
|
19
|
+
* Maps to RiskTier / RiskLevel enums in Python.
|
|
20
|
+
*/
|
|
21
|
+
export type RiskLevel = "LOW" | "MEDIUM" | "HIGH" | "CRITICAL";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Recognised compliance and regulatory frameworks.
|
|
25
|
+
* Maps to ComplianceFramework enum in Python.
|
|
26
|
+
*/
|
|
27
|
+
export type ComplianceFramework =
|
|
28
|
+
| "HIPAA"
|
|
29
|
+
| "SOX"
|
|
30
|
+
| "GDPR"
|
|
31
|
+
| "SOC2"
|
|
32
|
+
| "PCI_DSS"
|
|
33
|
+
| "NONE";
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The type of compliance rule.
|
|
37
|
+
* Maps to RuleType enum in Python.
|
|
38
|
+
*/
|
|
39
|
+
export type RuleType =
|
|
40
|
+
| "PROHIBITED_PHRASE"
|
|
41
|
+
| "REQUIRED_DISCLAIMER"
|
|
42
|
+
| "PROHIBITED_PATTERN"
|
|
43
|
+
| "REQUIRED_PATTERN";
|
|
44
|
+
|
|
45
|
+
// ---------------------------------------------------------------------------
|
|
46
|
+
// Safety rule
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* A single safety constraint applied to agent output at runtime.
|
|
51
|
+
* Maps to SafetyRule frozen dataclass in Python.
|
|
52
|
+
*/
|
|
53
|
+
export interface SafetyRule {
|
|
54
|
+
/** Unique dot-notation identifier (e.g. "hipaa.no_phi_exposure"). */
|
|
55
|
+
readonly rule_id: string;
|
|
56
|
+
/** Human-readable description of the constraint. */
|
|
57
|
+
readonly description: string;
|
|
58
|
+
/** Impact level: "warning", "error", or "critical". */
|
|
59
|
+
readonly severity: string;
|
|
60
|
+
/** Python regex pattern used to test agent output. */
|
|
61
|
+
readonly check_pattern: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
// Tool collection / config
|
|
66
|
+
// ---------------------------------------------------------------------------
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Configuration for a single tool available to the agent.
|
|
70
|
+
* Maps to ToolConfig frozen dataclass in Python.
|
|
71
|
+
*/
|
|
72
|
+
export interface ToolConfig {
|
|
73
|
+
/** Machine-readable tool name (e.g. "audit_logger"). */
|
|
74
|
+
readonly name: string;
|
|
75
|
+
/** Human-readable description of what the tool does. */
|
|
76
|
+
readonly description: string;
|
|
77
|
+
/** When true, the tool must be wired up before the template is deployable. */
|
|
78
|
+
readonly required: boolean;
|
|
79
|
+
/** Parameter schema for the tool. */
|
|
80
|
+
readonly parameters: Readonly<Record<string, unknown>>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* A named collection of tool configurations for a domain.
|
|
85
|
+
* Corresponds to the tools tuple on DomainTemplate in Python.
|
|
86
|
+
*/
|
|
87
|
+
export interface ToolCollection {
|
|
88
|
+
/** Name of this tool collection (typically matching the template domain). */
|
|
89
|
+
readonly collection_name: string;
|
|
90
|
+
/** The tool configurations in this collection. */
|
|
91
|
+
readonly tools: readonly ToolConfig[];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// ---------------------------------------------------------------------------
|
|
95
|
+
// Evaluation metric
|
|
96
|
+
// ---------------------------------------------------------------------------
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* A single evaluation benchmark specification.
|
|
100
|
+
* Maps to EvalBenchmark frozen dataclass in Python.
|
|
101
|
+
*/
|
|
102
|
+
export interface EvaluationMetric {
|
|
103
|
+
/** Short identifier for the benchmark (e.g. "phi_redaction_rate"). */
|
|
104
|
+
readonly name: string;
|
|
105
|
+
/** The measurement being tracked (e.g. "precision", "recall"). */
|
|
106
|
+
readonly metric: string;
|
|
107
|
+
/** Minimum acceptable value on a 0.0–1.0 scale. */
|
|
108
|
+
readonly threshold: number;
|
|
109
|
+
/** Human-readable description of what this benchmark verifies. */
|
|
110
|
+
readonly description: string;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// ---------------------------------------------------------------------------
|
|
114
|
+
// Template metadata
|
|
115
|
+
// ---------------------------------------------------------------------------
|
|
116
|
+
|
|
117
|
+
/** Provenance and classification metadata for a DomainTemplate. */
|
|
118
|
+
export interface TemplateMetadata {
|
|
119
|
+
/** Unique machine-readable template name. */
|
|
120
|
+
readonly name: string;
|
|
121
|
+
/** Semantic version string (e.g. "1.0.0"). */
|
|
122
|
+
readonly version: string;
|
|
123
|
+
/** Domain this template belongs to (e.g. "healthcare"). */
|
|
124
|
+
readonly domain: string;
|
|
125
|
+
/** Compliance frameworks the template is designed to satisfy. */
|
|
126
|
+
readonly compliance_frameworks: readonly ComplianceFramework[];
|
|
127
|
+
/** Risk classification for this template. */
|
|
128
|
+
readonly risk_level: RiskLevel;
|
|
129
|
+
/** Human-readable description of the template's purpose. */
|
|
130
|
+
readonly description: string;
|
|
131
|
+
/** Author or team identifier. */
|
|
132
|
+
readonly author: string;
|
|
133
|
+
/** ISO-8601 UTC datetime of initial template creation. */
|
|
134
|
+
readonly created_at: string;
|
|
135
|
+
/** Free-form tags for search and filtering. */
|
|
136
|
+
readonly tags: readonly string[];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// ---------------------------------------------------------------------------
|
|
140
|
+
// Domain template (the central entity)
|
|
141
|
+
// ---------------------------------------------------------------------------
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* A compliance-certified, self-describing agent template.
|
|
145
|
+
* Maps to DomainTemplate Pydantic model in Python (certified.schema).
|
|
146
|
+
*/
|
|
147
|
+
export interface DomainTemplate {
|
|
148
|
+
/** Provenance and classification metadata. */
|
|
149
|
+
readonly metadata: TemplateMetadata;
|
|
150
|
+
/** Full system prompt for the LLM context. */
|
|
151
|
+
readonly system_prompt: string;
|
|
152
|
+
/** Tool declarations with required/optional flags. */
|
|
153
|
+
readonly tool_configs: readonly ToolConfig[];
|
|
154
|
+
/** Runtime safety constraints with regex patterns. */
|
|
155
|
+
readonly safety_rules: readonly SafetyRule[];
|
|
156
|
+
/** Free-form governance policies (key/value). */
|
|
157
|
+
readonly governance_policies: Readonly<Record<string, unknown>>;
|
|
158
|
+
/** Evaluation benchmarks with numeric thresholds. */
|
|
159
|
+
readonly eval_benchmarks: readonly EvaluationMetric[];
|
|
160
|
+
/** Mapping of framework name to compliance evidence description. */
|
|
161
|
+
readonly compliance_evidence: Readonly<Record<string, string>>;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/** Configuration options for applying a template to an agent. */
|
|
165
|
+
export interface TemplateConfig {
|
|
166
|
+
/** The template name to apply. */
|
|
167
|
+
readonly template_name: string;
|
|
168
|
+
/** Optional parameter overrides for this deployment. */
|
|
169
|
+
readonly parameter_overrides?: Readonly<Record<string, unknown>>;
|
|
170
|
+
/** Whether to perform pre-apply validation. */
|
|
171
|
+
readonly validate_before_apply?: boolean;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// ---------------------------------------------------------------------------
|
|
175
|
+
// Compliance rule
|
|
176
|
+
// ---------------------------------------------------------------------------
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* A single domain compliance rule.
|
|
180
|
+
* Maps to ComplianceRule frozen dataclass in Python.
|
|
181
|
+
*/
|
|
182
|
+
export interface ComplianceRule {
|
|
183
|
+
/** Unique identifier in dot notation (e.g. "hipaa.no_diagnosis"). */
|
|
184
|
+
readonly rule_id: string;
|
|
185
|
+
/** Whether this rule prohibits or requires content. */
|
|
186
|
+
readonly rule_type: RuleType;
|
|
187
|
+
/** The phrase or regex pattern to test against agent responses. */
|
|
188
|
+
readonly pattern: string;
|
|
189
|
+
/** Human-readable description of what this rule enforces. */
|
|
190
|
+
readonly description: string;
|
|
191
|
+
/** Impact level: "critical", "high", "medium", or "low". */
|
|
192
|
+
readonly severity: string;
|
|
193
|
+
/** Suggested fix when this rule is violated. */
|
|
194
|
+
readonly remediation: string;
|
|
195
|
+
/** When true, pattern is treated as a regular expression. */
|
|
196
|
+
readonly is_regex: boolean;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/** A collection of compliance rules for a specific domain. */
|
|
200
|
+
export interface PromptPattern {
|
|
201
|
+
/** Domain identifier (e.g. "healthcare"). */
|
|
202
|
+
readonly domain: string;
|
|
203
|
+
/** Ordered list of rules to enforce. */
|
|
204
|
+
readonly rules: readonly ComplianceRule[];
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// ---------------------------------------------------------------------------
|
|
208
|
+
// Template validation result
|
|
209
|
+
// ---------------------------------------------------------------------------
|
|
210
|
+
|
|
211
|
+
/** Result of validating a domain template. */
|
|
212
|
+
export interface TemplateValidationResult {
|
|
213
|
+
/** Whether the template passed all validation checks. */
|
|
214
|
+
readonly valid: boolean;
|
|
215
|
+
/** Human-readable warning messages (non-empty means issues found). */
|
|
216
|
+
readonly warnings: readonly string[];
|
|
217
|
+
/** The template name that was validated. */
|
|
218
|
+
readonly template_name: string;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// ---------------------------------------------------------------------------
|
|
222
|
+
// Domain config summary
|
|
223
|
+
// ---------------------------------------------------------------------------
|
|
224
|
+
|
|
225
|
+
/** Summary configuration for a specific domain. */
|
|
226
|
+
export interface DomainConfig {
|
|
227
|
+
/** Domain identifier. */
|
|
228
|
+
readonly domain: string;
|
|
229
|
+
/** Available templates in this domain. */
|
|
230
|
+
readonly templates: readonly string[];
|
|
231
|
+
/** Compliance rules applicable to this domain. */
|
|
232
|
+
readonly compliance_rules: readonly ComplianceRule[];
|
|
233
|
+
/** Supported compliance frameworks for this domain. */
|
|
234
|
+
readonly supported_frameworks: readonly ComplianceFramework[];
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// ---------------------------------------------------------------------------
|
|
238
|
+
// API result wrapper (shared pattern)
|
|
239
|
+
// ---------------------------------------------------------------------------
|
|
240
|
+
|
|
241
|
+
/** Standard error payload returned by the agent-vertical API. */
|
|
242
|
+
export interface ApiError {
|
|
243
|
+
readonly error: string;
|
|
244
|
+
readonly detail: string;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/** Result type for all client operations. */
|
|
248
|
+
export type ApiResult<T> =
|
|
249
|
+
| { readonly ok: true; readonly data: T }
|
|
250
|
+
| { readonly ok: false; readonly error: ApiError; readonly status: number };
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"lib": ["ES2022", "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
|
+
}
|