@aumos/agent-sovereign 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.
@@ -0,0 +1,106 @@
1
+ /**
2
+ * HTTP client for the agent-sovereign deployment management 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 { createAgentSovereignClient } from "@aumos/agent-sovereign";
10
+ *
11
+ * const client = createAgentSovereignClient({ baseUrl: "http://localhost:8092" });
12
+ *
13
+ * const status = await client.getSovereigntyStatus("my-edge-node");
14
+ *
15
+ * if (status.ok) {
16
+ * console.log("Sovereignty level:", status.data.sovereignty_level);
17
+ * }
18
+ * ```
19
+ */
20
+ import type { ApiResult, DeploymentBundle, EdgeRuntime, OfflineCapability, PackagerConfig, PerformanceEstimate, ResourceValidationResult, SovereigntyLevel, SovereigntyStatus, SyncConfig, SyncStateRequest, SyncTask } from "./types.js";
21
+ /** Configuration options for the AgentSovereignClient. */
22
+ export interface AgentSovereignClientConfig {
23
+ /** Base URL of the agent-sovereign server (e.g. "http://localhost:8092"). */
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-sovereign server. */
31
+ export interface AgentSovereignClient {
32
+ /**
33
+ * Create a signed deployment bundle for a sovereign agent.
34
+ *
35
+ * @param config - Packager configuration including sovereignty level and file sources.
36
+ * @returns The assembled DeploymentBundle with manifest and checksum.
37
+ */
38
+ createBundle(config: PackagerConfig): Promise<ApiResult<DeploymentBundle>>;
39
+ /**
40
+ * Deploy an agent bundle to an edge runtime.
41
+ *
42
+ * @param options - Bundle checksum, target edge node ID, and optional runtime overrides.
43
+ * @returns The EdgeRuntime configuration that was applied.
44
+ */
45
+ deployEdge(options: {
46
+ bundle_checksum: string;
47
+ edge_node_id: string;
48
+ sovereignty_level: SovereigntyLevel;
49
+ runtime_overrides?: Partial<EdgeRuntime>;
50
+ }): Promise<ApiResult<EdgeRuntime>>;
51
+ /**
52
+ * Get the current sovereignty status of an edge node.
53
+ *
54
+ * @param edgeNodeId - The edge node identifier.
55
+ * @returns A SovereigntyStatus with current level, connectivity, and pending tasks.
56
+ */
57
+ getSovereigntyStatus(edgeNodeId: string): Promise<ApiResult<SovereigntyStatus>>;
58
+ /**
59
+ * Queue a state synchronisation task for an edge node.
60
+ *
61
+ * @param edgeNodeId - The edge node to sync.
62
+ * @param request - Sync task specification.
63
+ * @returns The created SyncTask record.
64
+ */
65
+ syncState(edgeNodeId: string, request: SyncStateRequest): Promise<ApiResult<SyncTask>>;
66
+ /**
67
+ * Get the offline capabilities of an edge deployment.
68
+ *
69
+ * @param edgeNodeId - The edge node identifier.
70
+ * @returns The OfflineCapability descriptor for this deployment.
71
+ */
72
+ getOfflineCapabilities(edgeNodeId: string): Promise<ApiResult<OfflineCapability>>;
73
+ /**
74
+ * Validate resources for an edge runtime configuration.
75
+ *
76
+ * @param runtime - The EdgeRuntime configuration to validate.
77
+ * @returns A ResourceValidationResult with errors and warnings.
78
+ */
79
+ validateResources(runtime: EdgeRuntime): Promise<ApiResult<ResourceValidationResult>>;
80
+ /**
81
+ * Estimate inference performance for a model on an edge runtime.
82
+ *
83
+ * @param options - Edge runtime config and model size in billions of parameters.
84
+ * @returns A PerformanceEstimate with tokens/sec and latency projections.
85
+ */
86
+ estimatePerformance(options: {
87
+ runtime: EdgeRuntime;
88
+ model_parameter_count_billions: number;
89
+ }): Promise<ApiResult<PerformanceEstimate>>;
90
+ /**
91
+ * Update the synchronisation policy for an edge node.
92
+ *
93
+ * @param edgeNodeId - The edge node identifier.
94
+ * @param policy - The new SyncConfig to apply.
95
+ * @returns The updated SyncConfig.
96
+ */
97
+ updateSyncPolicy(edgeNodeId: string, policy: SyncConfig): Promise<ApiResult<SyncConfig>>;
98
+ }
99
+ /**
100
+ * Create a typed HTTP client for the agent-sovereign server.
101
+ *
102
+ * @param config - Client configuration including base URL.
103
+ * @returns An AgentSovereignClient instance.
104
+ */
105
+ export declare function createAgentSovereignClient(config: AgentSovereignClientConfig): AgentSovereignClient;
106
+ //# 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,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,wBAAwB,EACxB,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACT,MAAM,YAAY,CAAC;AAMpB,0DAA0D;AAC1D,MAAM,WAAW,0BAA0B;IACzC,6EAA6E;IAC7E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,iEAAiE;IACjE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,2DAA2D;IAC3D,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACrD;AA0DD,wDAAwD;AACxD,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAE3E;;;;;OAKG;IACH,UAAU,CAAC,OAAO,EAAE;QAClB,eAAe,EAAE,MAAM,CAAC;QACxB,YAAY,EAAE,MAAM,CAAC;QACrB,iBAAiB,EAAE,gBAAgB,CAAC;QACpC,iBAAiB,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;KAC1C,GAAG,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;IAEpC;;;;;OAKG;IACH,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAEhF;;;;;;OAMG;IACH,SAAS,CACP,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEhC;;;;;OAKG;IACH,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAElF;;;;;OAKG;IACH,iBAAiB,CACf,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC,CAAC;IAEhD;;;;;OAKG;IACH,mBAAmB,CAAC,OAAO,EAAE;QAC3B,OAAO,EAAE,WAAW,CAAC;QACrB,8BAA8B,EAAE,MAAM,CAAC;KACxC,GAAG,OAAO,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAE5C;;;;;;OAMG;IACH,gBAAgB,CACd,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;CACnC;AAMD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,0BAA0B,GACjC,oBAAoB,CAmHtB"}
package/dist/client.js ADDED
@@ -0,0 +1,123 @@
1
+ /**
2
+ * HTTP client for the agent-sovereign deployment management 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 { createAgentSovereignClient } from "@aumos/agent-sovereign";
10
+ *
11
+ * const client = createAgentSovereignClient({ baseUrl: "http://localhost:8092" });
12
+ *
13
+ * const status = await client.getSovereigntyStatus("my-edge-node");
14
+ *
15
+ * if (status.ok) {
16
+ * console.log("Sovereignty level:", status.data.sovereignty_level);
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-sovereign server.
65
+ *
66
+ * @param config - Client configuration including base URL.
67
+ * @returns An AgentSovereignClient instance.
68
+ */
69
+ export function createAgentSovereignClient(config) {
70
+ const { baseUrl, timeoutMs = 30_000, headers: extraHeaders } = config;
71
+ const baseHeaders = buildHeaders(extraHeaders);
72
+ return {
73
+ async createBundle(packagerConfig) {
74
+ return fetchJson(`${baseUrl}/sovereign/bundles`, {
75
+ method: "POST",
76
+ headers: baseHeaders,
77
+ body: JSON.stringify(packagerConfig),
78
+ }, timeoutMs);
79
+ },
80
+ async deployEdge(options) {
81
+ return fetchJson(`${baseUrl}/sovereign/edge/deploy`, {
82
+ method: "POST",
83
+ headers: baseHeaders,
84
+ body: JSON.stringify(options),
85
+ }, timeoutMs);
86
+ },
87
+ async getSovereigntyStatus(edgeNodeId) {
88
+ return fetchJson(`${baseUrl}/sovereign/edge/${encodeURIComponent(edgeNodeId)}/status`, { method: "GET", headers: baseHeaders }, timeoutMs);
89
+ },
90
+ async syncState(edgeNodeId, request) {
91
+ return fetchJson(`${baseUrl}/sovereign/edge/${encodeURIComponent(edgeNodeId)}/sync`, {
92
+ method: "POST",
93
+ headers: baseHeaders,
94
+ body: JSON.stringify(request),
95
+ }, timeoutMs);
96
+ },
97
+ async getOfflineCapabilities(edgeNodeId) {
98
+ return fetchJson(`${baseUrl}/sovereign/edge/${encodeURIComponent(edgeNodeId)}/offline`, { method: "GET", headers: baseHeaders }, timeoutMs);
99
+ },
100
+ async validateResources(runtime) {
101
+ return fetchJson(`${baseUrl}/sovereign/edge/validate-resources`, {
102
+ method: "POST",
103
+ headers: baseHeaders,
104
+ body: JSON.stringify(runtime),
105
+ }, timeoutMs);
106
+ },
107
+ async estimatePerformance(options) {
108
+ return fetchJson(`${baseUrl}/sovereign/edge/estimate-performance`, {
109
+ method: "POST",
110
+ headers: baseHeaders,
111
+ body: JSON.stringify(options),
112
+ }, timeoutMs);
113
+ },
114
+ async updateSyncPolicy(edgeNodeId, policy) {
115
+ return fetchJson(`${baseUrl}/sovereign/edge/${encodeURIComponent(edgeNodeId)}/sync-policy`, {
116
+ method: "PUT",
117
+ headers: baseHeaders,
118
+ body: JSON.stringify(policy),
119
+ }, timeoutMs);
120
+ },
121
+ };
122
+ }
123
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAgCH,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E,KAAK,UAAU,SAAS,CACtB,GAAW,EACX,IAAiB,EACjB,SAAiB;IAEjB,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,MAAM,SAAS,GAAG,U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OAAO,SAAS,CACd,GAAG,OAAO,mBAAmB,kBAAkB,CAAC,UAAU,CAAC,UAAU,EACrE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,EACvC,SAAS,CACV,CAAC;QACJ,CAAC;QAED,KAAK,CAAC,iBAAiB,CACrB,OAAoB;YAEpB,OAAO,SAAS,CACd,GAAG,OAAO,oCAAoC,EAC9C;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE,WAAW;gBACpB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;aAC9B,EACD,SAAS,CACV,CAAC;QACJ,CAAC;QAED,KAAK,CAAC,mBAAmB,CAAC,OAGzB;YACC,OAAO,SAAS,CACd,GAAG,OAAO,sCAAsC,EAChD;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE,WAAW;gBACpB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;aAC9B,EACD,SAAS,CACV,CAAC;QACJ,CAAC;QAED,KAAK,CAAC,gBAAgB,CACpB,UAAkB,EAClB,MAAkB;YAElB,OAAO,SAAS,CACd,GAAG,OAAO,mBAAmB,kBAAkB,CAAC,UAAU,CAAC,cAAc,EACzE;gBACE,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE,WAAW;gBACpB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;aAC7B,EACD,SAAS,CACV,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @aumos/agent-sovereign
3
+ *
4
+ * TypeScript client for the AumOS agent-sovereign deployment manager.
5
+ * Provides HTTP client, sovereignty level types, edge runtime configuration,
6
+ * offline capabilities, and state synchronisation type definitions.
7
+ */
8
+ export type { AgentSovereignClient, AgentSovereignClientConfig } from "./client.js";
9
+ export { createAgentSovereignClient } from "./client.js";
10
+ export type { ApiError, ApiResult, DeploymentBundle, DeploymentManifest, EdgeRuntime, OfflineCapability, OfflineStatus, PackagerConfig, PerformanceEstimate, QuantizationLevel, ResourceValidationResult, SovereigntyLevel, SovereigntyLevelValue, SovereigntyStatus, SyncConfig, SyncPriority, SyncStateRequest, SyncTask, SyncTaskStatus, } 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,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAGzD,YAAY,EACV,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,wBAAwB,EACxB,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,QAAQ,EACR,cAAc,GACf,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @aumos/agent-sovereign
3
+ *
4
+ * TypeScript client for the AumOS agent-sovereign deployment manager.
5
+ * Provides HTTP client, sovereignty level types, edge runtime configuration,
6
+ * offline capabilities, and state synchronisation type definitions.
7
+ */
8
+ export { createAgentSovereignClient } 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,0BAA0B,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,223 @@
1
+ /**
2
+ * TypeScript interfaces for the agent-sovereign deployment manager.
3
+ *
4
+ * Mirrors the Python dataclasses and enums defined in:
5
+ * agent_sovereign.classifier.levels (SovereigntyLevel)
6
+ * agent_sovereign.edge.runtime (QuantizationLevel, EdgeConfig, ResourceValidationResult, PerformanceEstimate)
7
+ * agent_sovereign.edge.sync (SyncPriority, SyncTaskStatus, SyncPolicy, SyncTask)
8
+ * agent_sovereign.edge.offline (OfflineStatus, OfflineCapability, CachedResponse)
9
+ * agent_sovereign.deployment.packager (DeploymentManifest, DeploymentBundle)
10
+ *
11
+ * All interfaces use readonly fields to match Python frozen dataclasses.
12
+ */
13
+ /**
14
+ * Sovereignty levels from least (cloud) to most (air-gapped) sovereign.
15
+ * Maps to SovereigntyLevel IntEnum in Python.
16
+ */
17
+ export type SovereigntyLevel = "L1_CLOUD" | "L2_CLOUD_DEDICATED" | "L3_HYBRID" | "L4_LOCAL_AUGMENTED" | "L5_FULLY_LOCAL" | "L6_CLASSIFIED" | "L7_AIRGAPPED";
18
+ /** Numeric value (1–7) associated with a sovereignty level. */
19
+ export type SovereigntyLevelValue = 1 | 2 | 3 | 4 | 5 | 6 | 7;
20
+ /**
21
+ * Supported model quantization levels for edge inference.
22
+ * Maps to QuantizationLevel enum in Python.
23
+ */
24
+ export type QuantizationLevel = "none" | "int8" | "int4" | "gguf_q4_k_m" | "gguf_q5_k_m" | "gguf_q8_0";
25
+ /** Configuration for an edge runtime environment. */
26
+ export interface EdgeRuntime {
27
+ /** Maximum RAM available for model and inference (MiB). */
28
+ readonly max_memory_mb: number;
29
+ /** Maximum CPU utilisation percentage (0–100) allowed. */
30
+ readonly max_cpu_percent: number;
31
+ /** Quantization level to apply to loaded models. */
32
+ readonly model_quantization: QuantizationLevel;
33
+ /** Whether this edge node can operate without network connectivity. */
34
+ readonly offline_capable: boolean;
35
+ /** Maximum number of simultaneous inference requests. */
36
+ readonly max_concurrent_requests: number;
37
+ /** Path to the directory where model weights are cached locally. */
38
+ readonly model_cache_dir: string;
39
+ /** GPU memory available in MiB (0 if no GPU present). */
40
+ readonly gpu_memory_mb: number;
41
+ /** Whether to cache model activations across requests. */
42
+ readonly enable_model_caching: boolean;
43
+ /** How often the edge node sends a heartbeat in seconds. */
44
+ readonly heartbeat_interval_seconds: number;
45
+ }
46
+ /** Result of a resource validation check for an EdgeRuntime. */
47
+ export interface ResourceValidationResult {
48
+ /** True if all resource requirements are met. */
49
+ readonly is_valid: boolean;
50
+ /** Non-fatal issues detected during validation. */
51
+ readonly warnings: readonly string[];
52
+ /** Fatal issues that prevent the runtime from operating correctly. */
53
+ readonly errors: readonly string[];
54
+ /** Detected available system memory in MiB. */
55
+ readonly available_memory_mb: number;
56
+ /** Detected logical CPU count. */
57
+ readonly available_cpu_count: number;
58
+ }
59
+ /** Estimated inference performance for an edge configuration. */
60
+ export interface PerformanceEstimate {
61
+ /** Estimated token generation rate (tokens/second). */
62
+ readonly tokens_per_second: number;
63
+ /** Estimated latency to the first output token in milliseconds. */
64
+ readonly time_to_first_token_ms: number;
65
+ /** Estimated maximum context length supported given memory constraints. */
66
+ readonly max_context_tokens: number;
67
+ /** Estimated throughput multiplier from quantization (1.0 = no speedup). */
68
+ readonly quantization_speedup_factor: number;
69
+ /** Explanatory notes about the estimate. */
70
+ readonly notes: readonly string[];
71
+ }
72
+ /** Structured manifest describing a deployment package. */
73
+ export interface DeploymentManifest {
74
+ /** Unique identifier for this package. */
75
+ readonly package_id: string;
76
+ /** ISO-8601 timestamp of package creation. */
77
+ readonly created_at: string;
78
+ /** The sovereignty level this package targets. */
79
+ readonly sovereignty_level: string;
80
+ /** Name of the deployment template used. */
81
+ readonly template_name: string;
82
+ /** List of relative file paths included in the bundle. */
83
+ readonly files: readonly string[];
84
+ /** Additional key/value metadata attached to this package. */
85
+ readonly metadata: Readonly<Record<string, string>>;
86
+ }
87
+ /** A complete deployment bundle ready for transfer or installation. */
88
+ export interface DeploymentBundle {
89
+ /** Structured manifest document for the package. */
90
+ readonly manifest: DeploymentManifest;
91
+ /** Resolved list of file paths included. */
92
+ readonly files_list: readonly string[];
93
+ /** SHA-256 hex digest of the serialised manifest. */
94
+ readonly checksum: string;
95
+ /** The sovereignty level this package targets. */
96
+ readonly sovereignty_level: SovereigntyLevel;
97
+ /** The raw YAML string of the manifest. */
98
+ readonly manifest_yaml: string;
99
+ }
100
+ /** Configuration for creating a deployment bundle. */
101
+ export interface PackagerConfig {
102
+ /** The target sovereignty level for the deployment. */
103
+ readonly sovereignty_level: SovereigntyLevel;
104
+ /** Optional explicit package identifier. */
105
+ readonly package_id?: string;
106
+ /** Optional additional key/value pairs to embed in the manifest. */
107
+ readonly metadata?: Readonly<Record<string, string>>;
108
+ /** Optional source directory path to scan for files. */
109
+ readonly source_directory?: string;
110
+ /** Optional explicit list of file paths to include. */
111
+ readonly explicit_files?: readonly string[];
112
+ }
113
+ /**
114
+ * Priority level for a sync task.
115
+ * Maps to SyncPriority enum in Python.
116
+ */
117
+ export type SyncPriority = "critical" | "high" | "normal" | "low";
118
+ /**
119
+ * Lifecycle state of a sync task.
120
+ * Maps to SyncTaskStatus enum in Python.
121
+ */
122
+ export type SyncTaskStatus = "pending" | "in_progress" | "completed" | "failed" | "skipped";
123
+ /** Policy governing when and how synchronisation may occur. */
124
+ export interface SyncConfig {
125
+ /** Whether sync tasks may run in the background. */
126
+ readonly allow_background_sync: boolean;
127
+ /** Maximum number of retry attempts for a failed sync task. */
128
+ readonly max_retry_attempts: number;
129
+ /** Base backoff interval in seconds between retry attempts. */
130
+ readonly retry_backoff_seconds: number;
131
+ /** UTC hour (0–23) at which the sync window opens. -1 means any time. */
132
+ readonly sync_window_start_hour: number;
133
+ /** UTC hour (0–23) at which the sync window closes. -1 means any time. */
134
+ readonly sync_window_end_hour: number;
135
+ /** Whether sync must only proceed over an encrypted channel. */
136
+ readonly require_encrypted_channel: boolean;
137
+ /** Maximum size of a single sync payload in MiB. */
138
+ readonly max_payload_size_mb: number;
139
+ /** If non-empty, only sync tasks with a type in this list are allowed. */
140
+ readonly allowed_sync_types: readonly string[];
141
+ }
142
+ /** A single unit of work to synchronise. */
143
+ export interface SyncTask {
144
+ /** Unique identifier for this sync task. */
145
+ readonly task_id: string;
146
+ /** Category of sync (e.g. "model_update", "audit_log"). */
147
+ readonly sync_type: string;
148
+ /** Human-readable description of what this task syncs. */
149
+ readonly payload_description: string;
150
+ /** Task priority affecting processing order. */
151
+ readonly priority: SyncPriority;
152
+ /** Current lifecycle state. */
153
+ readonly status: SyncTaskStatus;
154
+ /** ISO-8601 UTC timestamp of task creation. */
155
+ readonly created_at: string;
156
+ /** ISO-8601 UTC timestamp of last status change. */
157
+ readonly updated_at: string;
158
+ /** Number of retry attempts made so far. */
159
+ readonly retry_count: number;
160
+ /** Last error message if the task failed. */
161
+ readonly error_message: string;
162
+ /** Arbitrary key/value metadata attached to this task. */
163
+ readonly metadata: Readonly<Record<string, string>>;
164
+ }
165
+ /** Request payload for queueing a sync task. */
166
+ export interface SyncStateRequest {
167
+ /** Category of the sync task. */
168
+ readonly sync_type: string;
169
+ /** Human-readable description of what will be synced. */
170
+ readonly payload_description: string;
171
+ /** Task priority. */
172
+ readonly priority?: SyncPriority;
173
+ /** Optional metadata key/value pairs. */
174
+ readonly metadata?: Readonly<Record<string, string>>;
175
+ }
176
+ /**
177
+ * Current connectivity status of the edge node.
178
+ * Maps to OfflineStatus enum in Python.
179
+ */
180
+ export type OfflineStatus = "online" | "offline" | "degraded";
181
+ /** Describes the offline operation capabilities of an edge deployment. */
182
+ export interface OfflineCapability {
183
+ /** Whether the node can return cached responses when offline. */
184
+ readonly can_serve_cached_responses: boolean;
185
+ /** Whether local model inference is available without network. */
186
+ readonly can_run_local_inference: boolean;
187
+ /** Whether write operations can be queued for later sync. */
188
+ readonly can_queue_writes: boolean;
189
+ /** Maximum hours the node should operate offline. -1 = indefinite. */
190
+ readonly max_offline_duration_hours: number;
191
+ /** Time-to-live for cached responses in hours. */
192
+ readonly cache_ttl_hours: number;
193
+ /** Operation types available in degraded/offline mode. */
194
+ readonly supported_degraded_operations: readonly string[];
195
+ }
196
+ /** Current sovereignty status of an edge deployment. */
197
+ export interface SovereigntyStatus {
198
+ /** The sovereignty level currently in effect. */
199
+ readonly sovereignty_level: SovereigntyLevel;
200
+ /** Current connectivity status. */
201
+ readonly offline_status: OfflineStatus;
202
+ /** Number of sync tasks currently pending. */
203
+ readonly pending_sync_tasks: number;
204
+ /** Whether resource validation has passed. */
205
+ readonly resources_valid: boolean;
206
+ /** ISO-8601 UTC timestamp of the last status check. */
207
+ readonly checked_at: string;
208
+ }
209
+ /** Standard error payload returned by the agent-sovereign API. */
210
+ export interface ApiError {
211
+ readonly error: string;
212
+ readonly detail: string;
213
+ }
214
+ /** Result type for all client operations. */
215
+ export type ApiResult<T> = {
216
+ readonly ok: true;
217
+ readonly data: T;
218
+ } | {
219
+ readonly ok: false;
220
+ readonly error: ApiError;
221
+ readonly status: number;
222
+ };
223
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GACxB,UAAU,GACV,oBAAoB,GACpB,WAAW,GACX,oBAAoB,GACpB,gBAAgB,GAChB,eAAe,GACf,cAAc,CAAC;AAEnB,+DAA+D;AAC/D,MAAM,MAAM,qBAAqB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAM9D;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,MAAM,GACN,MAAM,GACN,aAAa,GACb,aAAa,GACb,WAAW,CAAC;AAEhB,qDAAqD;AACrD,MAAM,WAAW,WAAW;IAC1B,2DAA2D;IAC3D,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,0DAA0D;IAC1D,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,oDAAoD;IACpD,QAAQ,CAAC,kBAAkB,EAAE,iBAAiB,CAAC;IAC/C,uEAAuE;IACvE,QAAQ,CAAC,eAAe,EAAE,OAAO,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CAC7B;AAMD,kEAAkE;AAClE,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,14 @@
1
+ /**
2
+ * TypeScript interfaces for the agent-sovereign deployment manager.
3
+ *
4
+ * Mirrors the Python dataclasses and enums defined in:
5
+ * agent_sovereign.classifier.levels (SovereigntyLevel)
6
+ * agent_sovereign.edge.runtime (QuantizationLevel, EdgeConfig, ResourceValidationResult, PerformanceEstimate)
7
+ * agent_sovereign.edge.sync (SyncPriority, SyncTaskStatus, SyncPolicy, SyncTask)
8
+ * agent_sovereign.edge.offline (OfflineStatus, OfflineCapability, CachedResponse)
9
+ * agent_sovereign.deployment.packager (DeploymentManifest, DeploymentBundle)
10
+ *
11
+ * All interfaces use readonly fields to match Python frozen dataclasses.
12
+ */
13
+ export {};
14
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@aumos/agent-sovereign",
3
+ "version": "0.1.0",
4
+ "description": "TypeScript client for the AumOS agent-sovereign deployment manager — sovereignty levels, edge runtimes, offline capabilities, and state synchronisation",
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-sovereign",
25
+ "sovereignty",
26
+ "edge",
27
+ "offline",
28
+ "deployment",
29
+ "typescript"
30
+ ],
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/aumos-ai/agent-sovereign"
34
+ }
35
+ }
package/src/client.ts ADDED
@@ -0,0 +1,320 @@
1
+ /**
2
+ * HTTP client for the agent-sovereign deployment management 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 { createAgentSovereignClient } from "@aumos/agent-sovereign";
10
+ *
11
+ * const client = createAgentSovereignClient({ baseUrl: "http://localhost:8092" });
12
+ *
13
+ * const status = await client.getSovereigntyStatus("my-edge-node");
14
+ *
15
+ * if (status.ok) {
16
+ * console.log("Sovereignty level:", status.data.sovereignty_level);
17
+ * }
18
+ * ```
19
+ */
20
+
21
+ import type {
22
+ ApiError,
23
+ ApiResult,
24
+ DeploymentBundle,
25
+ EdgeRuntime,
26
+ OfflineCapability,
27
+ PackagerConfig,
28
+ PerformanceEstimate,
29
+ ResourceValidationResult,
30
+ SovereigntyLevel,
31
+ SovereigntyStatus,
32
+ SyncConfig,
33
+ SyncStateRequest,
34
+ SyncTask,
35
+ } from "./types.js";
36
+
37
+ // ---------------------------------------------------------------------------
38
+ // Client configuration
39
+ // ---------------------------------------------------------------------------
40
+
41
+ /** Configuration options for the AgentSovereignClient. */
42
+ export interface AgentSovereignClientConfig {
43
+ /** Base URL of the agent-sovereign server (e.g. "http://localhost:8092"). */
44
+ readonly baseUrl: string;
45
+ /** Optional request timeout in milliseconds (default: 30000). */
46
+ readonly timeoutMs?: number;
47
+ /** Optional extra HTTP headers sent with every request. */
48
+ readonly headers?: Readonly<Record<string, string>>;
49
+ }
50
+
51
+ // ---------------------------------------------------------------------------
52
+ // Internal helpers
53
+ // ---------------------------------------------------------------------------
54
+
55
+ async function fetchJson<T>(
56
+ url: string,
57
+ init: RequestInit,
58
+ timeoutMs: number,
59
+ ): Promise<ApiResult<T>> {
60
+ const controller = new AbortController();
61
+ const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
62
+
63
+ try {
64
+ const response = await fetch(url, { ...init, signal: controller.signal });
65
+ clearTimeout(timeoutId);
66
+
67
+ const body = await response.json() as unknown;
68
+
69
+ if (!response.ok) {
70
+ const errorBody = body as Partial<ApiError>;
71
+ return {
72
+ ok: false,
73
+ error: {
74
+ error: errorBody.error ?? "Unknown error",
75
+ detail: errorBody.detail ?? "",
76
+ },
77
+ status: response.status,
78
+ };
79
+ }
80
+
81
+ return { ok: true, data: body as T };
82
+ } catch (err: unknown) {
83
+ clearTimeout(timeoutId);
84
+ const message = err instanceof Error ? err.message : String(err);
85
+ return {
86
+ ok: false,
87
+ error: { error: "Network error", detail: message },
88
+ status: 0,
89
+ };
90
+ }
91
+ }
92
+
93
+ function buildHeaders(
94
+ extraHeaders: Readonly<Record<string, string>> | undefined,
95
+ ): Record<string, string> {
96
+ return {
97
+ "Content-Type": "application/json",
98
+ Accept: "application/json",
99
+ ...extraHeaders,
100
+ };
101
+ }
102
+
103
+ // ---------------------------------------------------------------------------
104
+ // Client interface
105
+ // ---------------------------------------------------------------------------
106
+
107
+ /** Typed HTTP client for the agent-sovereign server. */
108
+ export interface AgentSovereignClient {
109
+ /**
110
+ * Create a signed deployment bundle for a sovereign agent.
111
+ *
112
+ * @param config - Packager configuration including sovereignty level and file sources.
113
+ * @returns The assembled DeploymentBundle with manifest and checksum.
114
+ */
115
+ createBundle(config: PackagerConfig): Promise<ApiResult<DeploymentBundle>>;
116
+
117
+ /**
118
+ * Deploy an agent bundle to an edge runtime.
119
+ *
120
+ * @param options - Bundle checksum, target edge node ID, and optional runtime overrides.
121
+ * @returns The EdgeRuntime configuration that was applied.
122
+ */
123
+ deployEdge(options: {
124
+ bundle_checksum: string;
125
+ edge_node_id: string;
126
+ sovereignty_level: SovereigntyLevel;
127
+ runtime_overrides?: Partial<EdgeRuntime>;
128
+ }): Promise<ApiResult<EdgeRuntime>>;
129
+
130
+ /**
131
+ * Get the current sovereignty status of an edge node.
132
+ *
133
+ * @param edgeNodeId - The edge node identifier.
134
+ * @returns A SovereigntyStatus with current level, connectivity, and pending tasks.
135
+ */
136
+ getSovereigntyStatus(edgeNodeId: string): Promise<ApiResult<SovereigntyStatus>>;
137
+
138
+ /**
139
+ * Queue a state synchronisation task for an edge node.
140
+ *
141
+ * @param edgeNodeId - The edge node to sync.
142
+ * @param request - Sync task specification.
143
+ * @returns The created SyncTask record.
144
+ */
145
+ syncState(
146
+ edgeNodeId: string,
147
+ request: SyncStateRequest,
148
+ ): Promise<ApiResult<SyncTask>>;
149
+
150
+ /**
151
+ * Get the offline capabilities of an edge deployment.
152
+ *
153
+ * @param edgeNodeId - The edge node identifier.
154
+ * @returns The OfflineCapability descriptor for this deployment.
155
+ */
156
+ getOfflineCapabilities(edgeNodeId: string): Promise<ApiResult<OfflineCapability>>;
157
+
158
+ /**
159
+ * Validate resources for an edge runtime configuration.
160
+ *
161
+ * @param runtime - The EdgeRuntime configuration to validate.
162
+ * @returns A ResourceValidationResult with errors and warnings.
163
+ */
164
+ validateResources(
165
+ runtime: EdgeRuntime,
166
+ ): Promise<ApiResult<ResourceValidationResult>>;
167
+
168
+ /**
169
+ * Estimate inference performance for a model on an edge runtime.
170
+ *
171
+ * @param options - Edge runtime config and model size in billions of parameters.
172
+ * @returns A PerformanceEstimate with tokens/sec and latency projections.
173
+ */
174
+ estimatePerformance(options: {
175
+ runtime: EdgeRuntime;
176
+ model_parameter_count_billions: number;
177
+ }): Promise<ApiResult<PerformanceEstimate>>;
178
+
179
+ /**
180
+ * Update the synchronisation policy for an edge node.
181
+ *
182
+ * @param edgeNodeId - The edge node identifier.
183
+ * @param policy - The new SyncConfig to apply.
184
+ * @returns The updated SyncConfig.
185
+ */
186
+ updateSyncPolicy(
187
+ edgeNodeId: string,
188
+ policy: SyncConfig,
189
+ ): Promise<ApiResult<SyncConfig>>;
190
+ }
191
+
192
+ // ---------------------------------------------------------------------------
193
+ // Client factory
194
+ // ---------------------------------------------------------------------------
195
+
196
+ /**
197
+ * Create a typed HTTP client for the agent-sovereign server.
198
+ *
199
+ * @param config - Client configuration including base URL.
200
+ * @returns An AgentSovereignClient instance.
201
+ */
202
+ export function createAgentSovereignClient(
203
+ config: AgentSovereignClientConfig,
204
+ ): AgentSovereignClient {
205
+ const { baseUrl, timeoutMs = 30_000, headers: extraHeaders } = config;
206
+ const baseHeaders = buildHeaders(extraHeaders);
207
+
208
+ return {
209
+ async createBundle(
210
+ packagerConfig: PackagerConfig,
211
+ ): Promise<ApiResult<DeploymentBundle>> {
212
+ return fetchJson<DeploymentBundle>(
213
+ `${baseUrl}/sovereign/bundles`,
214
+ {
215
+ method: "POST",
216
+ headers: baseHeaders,
217
+ body: JSON.stringify(packagerConfig),
218
+ },
219
+ timeoutMs,
220
+ );
221
+ },
222
+
223
+ async deployEdge(options: {
224
+ bundle_checksum: string;
225
+ edge_node_id: string;
226
+ sovereignty_level: SovereigntyLevel;
227
+ runtime_overrides?: Partial<EdgeRuntime>;
228
+ }): Promise<ApiResult<EdgeRuntime>> {
229
+ return fetchJson<EdgeRuntime>(
230
+ `${baseUrl}/sovereign/edge/deploy`,
231
+ {
232
+ method: "POST",
233
+ headers: baseHeaders,
234
+ body: JSON.stringify(options),
235
+ },
236
+ timeoutMs,
237
+ );
238
+ },
239
+
240
+ async getSovereigntyStatus(
241
+ edgeNodeId: string,
242
+ ): Promise<ApiResult<SovereigntyStatus>> {
243
+ return fetchJson<SovereigntyStatus>(
244
+ `${baseUrl}/sovereign/edge/${encodeURIComponent(edgeNodeId)}/status`,
245
+ { method: "GET", headers: baseHeaders },
246
+ timeoutMs,
247
+ );
248
+ },
249
+
250
+ async syncState(
251
+ edgeNodeId: string,
252
+ request: SyncStateRequest,
253
+ ): Promise<ApiResult<SyncTask>> {
254
+ return fetchJson<SyncTask>(
255
+ `${baseUrl}/sovereign/edge/${encodeURIComponent(edgeNodeId)}/sync`,
256
+ {
257
+ method: "POST",
258
+ headers: baseHeaders,
259
+ body: JSON.stringify(request),
260
+ },
261
+ timeoutMs,
262
+ );
263
+ },
264
+
265
+ async getOfflineCapabilities(
266
+ edgeNodeId: string,
267
+ ): Promise<ApiResult<OfflineCapability>> {
268
+ return fetchJson<OfflineCapability>(
269
+ `${baseUrl}/sovereign/edge/${encodeURIComponent(edgeNodeId)}/offline`,
270
+ { method: "GET", headers: baseHeaders },
271
+ timeoutMs,
272
+ );
273
+ },
274
+
275
+ async validateResources(
276
+ runtime: EdgeRuntime,
277
+ ): Promise<ApiResult<ResourceValidationResult>> {
278
+ return fetchJson<ResourceValidationResult>(
279
+ `${baseUrl}/sovereign/edge/validate-resources`,
280
+ {
281
+ method: "POST",
282
+ headers: baseHeaders,
283
+ body: JSON.stringify(runtime),
284
+ },
285
+ timeoutMs,
286
+ );
287
+ },
288
+
289
+ async estimatePerformance(options: {
290
+ runtime: EdgeRuntime;
291
+ model_parameter_count_billions: number;
292
+ }): Promise<ApiResult<PerformanceEstimate>> {
293
+ return fetchJson<PerformanceEstimate>(
294
+ `${baseUrl}/sovereign/edge/estimate-performance`,
295
+ {
296
+ method: "POST",
297
+ headers: baseHeaders,
298
+ body: JSON.stringify(options),
299
+ },
300
+ timeoutMs,
301
+ );
302
+ },
303
+
304
+ async updateSyncPolicy(
305
+ edgeNodeId: string,
306
+ policy: SyncConfig,
307
+ ): Promise<ApiResult<SyncConfig>> {
308
+ return fetchJson<SyncConfig>(
309
+ `${baseUrl}/sovereign/edge/${encodeURIComponent(edgeNodeId)}/sync-policy`,
310
+ {
311
+ method: "PUT",
312
+ headers: baseHeaders,
313
+ body: JSON.stringify(policy),
314
+ },
315
+ timeoutMs,
316
+ );
317
+ },
318
+ };
319
+ }
320
+
package/src/index.ts ADDED
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @aumos/agent-sovereign
3
+ *
4
+ * TypeScript client for the AumOS agent-sovereign deployment manager.
5
+ * Provides HTTP client, sovereignty level types, edge runtime configuration,
6
+ * offline capabilities, and state synchronisation type definitions.
7
+ */
8
+
9
+ // Client and configuration
10
+ export type { AgentSovereignClient, AgentSovereignClientConfig } from "./client.js";
11
+ export { createAgentSovereignClient } from "./client.js";
12
+
13
+ // Core types
14
+ export type {
15
+ ApiError,
16
+ ApiResult,
17
+ DeploymentBundle,
18
+ DeploymentManifest,
19
+ EdgeRuntime,
20
+ OfflineCapability,
21
+ OfflineStatus,
22
+ PackagerConfig,
23
+ PerformanceEstimate,
24
+ QuantizationLevel,
25
+ ResourceValidationResult,
26
+ SovereigntyLevel,
27
+ SovereigntyLevelValue,
28
+ SovereigntyStatus,
29
+ SyncConfig,
30
+ SyncPriority,
31
+ SyncStateRequest,
32
+ SyncTask,
33
+ SyncTaskStatus,
34
+ } from "./types.js";
package/src/types.ts ADDED
@@ -0,0 +1,278 @@
1
+ /**
2
+ * TypeScript interfaces for the agent-sovereign deployment manager.
3
+ *
4
+ * Mirrors the Python dataclasses and enums defined in:
5
+ * agent_sovereign.classifier.levels (SovereigntyLevel)
6
+ * agent_sovereign.edge.runtime (QuantizationLevel, EdgeConfig, ResourceValidationResult, PerformanceEstimate)
7
+ * agent_sovereign.edge.sync (SyncPriority, SyncTaskStatus, SyncPolicy, SyncTask)
8
+ * agent_sovereign.edge.offline (OfflineStatus, OfflineCapability, CachedResponse)
9
+ * agent_sovereign.deployment.packager (DeploymentManifest, DeploymentBundle)
10
+ *
11
+ * All interfaces use readonly fields to match Python frozen dataclasses.
12
+ */
13
+
14
+ // ---------------------------------------------------------------------------
15
+ // Sovereignty level
16
+ // ---------------------------------------------------------------------------
17
+
18
+ /**
19
+ * Sovereignty levels from least (cloud) to most (air-gapped) sovereign.
20
+ * Maps to SovereigntyLevel IntEnum in Python.
21
+ */
22
+ export type SovereigntyLevel =
23
+ | "L1_CLOUD"
24
+ | "L2_CLOUD_DEDICATED"
25
+ | "L3_HYBRID"
26
+ | "L4_LOCAL_AUGMENTED"
27
+ | "L5_FULLY_LOCAL"
28
+ | "L6_CLASSIFIED"
29
+ | "L7_AIRGAPPED";
30
+
31
+ /** Numeric value (1–7) associated with a sovereignty level. */
32
+ export type SovereigntyLevelValue = 1 | 2 | 3 | 4 | 5 | 6 | 7;
33
+
34
+ // ---------------------------------------------------------------------------
35
+ // Edge runtime types
36
+ // ---------------------------------------------------------------------------
37
+
38
+ /**
39
+ * Supported model quantization levels for edge inference.
40
+ * Maps to QuantizationLevel enum in Python.
41
+ */
42
+ export type QuantizationLevel =
43
+ | "none"
44
+ | "int8"
45
+ | "int4"
46
+ | "gguf_q4_k_m"
47
+ | "gguf_q5_k_m"
48
+ | "gguf_q8_0";
49
+
50
+ /** Configuration for an edge runtime environment. */
51
+ export interface EdgeRuntime {
52
+ /** Maximum RAM available for model and inference (MiB). */
53
+ readonly max_memory_mb: number;
54
+ /** Maximum CPU utilisation percentage (0–100) allowed. */
55
+ readonly max_cpu_percent: number;
56
+ /** Quantization level to apply to loaded models. */
57
+ readonly model_quantization: QuantizationLevel;
58
+ /** Whether this edge node can operate without network connectivity. */
59
+ readonly offline_capable: boolean;
60
+ /** Maximum number of simultaneous inference requests. */
61
+ readonly max_concurrent_requests: number;
62
+ /** Path to the directory where model weights are cached locally. */
63
+ readonly model_cache_dir: string;
64
+ /** GPU memory available in MiB (0 if no GPU present). */
65
+ readonly gpu_memory_mb: number;
66
+ /** Whether to cache model activations across requests. */
67
+ readonly enable_model_caching: boolean;
68
+ /** How often the edge node sends a heartbeat in seconds. */
69
+ readonly heartbeat_interval_seconds: number;
70
+ }
71
+
72
+ /** Result of a resource validation check for an EdgeRuntime. */
73
+ export interface ResourceValidationResult {
74
+ /** True if all resource requirements are met. */
75
+ readonly is_valid: boolean;
76
+ /** Non-fatal issues detected during validation. */
77
+ readonly warnings: readonly string[];
78
+ /** Fatal issues that prevent the runtime from operating correctly. */
79
+ readonly errors: readonly string[];
80
+ /** Detected available system memory in MiB. */
81
+ readonly available_memory_mb: number;
82
+ /** Detected logical CPU count. */
83
+ readonly available_cpu_count: number;
84
+ }
85
+
86
+ /** Estimated inference performance for an edge configuration. */
87
+ export interface PerformanceEstimate {
88
+ /** Estimated token generation rate (tokens/second). */
89
+ readonly tokens_per_second: number;
90
+ /** Estimated latency to the first output token in milliseconds. */
91
+ readonly time_to_first_token_ms: number;
92
+ /** Estimated maximum context length supported given memory constraints. */
93
+ readonly max_context_tokens: number;
94
+ /** Estimated throughput multiplier from quantization (1.0 = no speedup). */
95
+ readonly quantization_speedup_factor: number;
96
+ /** Explanatory notes about the estimate. */
97
+ readonly notes: readonly string[];
98
+ }
99
+
100
+ // ---------------------------------------------------------------------------
101
+ // Deployment bundle types
102
+ // ---------------------------------------------------------------------------
103
+
104
+ /** Structured manifest describing a deployment package. */
105
+ export interface DeploymentManifest {
106
+ /** Unique identifier for this package. */
107
+ readonly package_id: string;
108
+ /** ISO-8601 timestamp of package creation. */
109
+ readonly created_at: string;
110
+ /** The sovereignty level this package targets. */
111
+ readonly sovereignty_level: string;
112
+ /** Name of the deployment template used. */
113
+ readonly template_name: string;
114
+ /** List of relative file paths included in the bundle. */
115
+ readonly files: readonly string[];
116
+ /** Additional key/value metadata attached to this package. */
117
+ readonly metadata: Readonly<Record<string, string>>;
118
+ }
119
+
120
+ /** A complete deployment bundle ready for transfer or installation. */
121
+ export interface DeploymentBundle {
122
+ /** Structured manifest document for the package. */
123
+ readonly manifest: DeploymentManifest;
124
+ /** Resolved list of file paths included. */
125
+ readonly files_list: readonly string[];
126
+ /** SHA-256 hex digest of the serialised manifest. */
127
+ readonly checksum: string;
128
+ /** The sovereignty level this package targets. */
129
+ readonly sovereignty_level: SovereigntyLevel;
130
+ /** The raw YAML string of the manifest. */
131
+ readonly manifest_yaml: string;
132
+ }
133
+
134
+ /** Configuration for creating a deployment bundle. */
135
+ export interface PackagerConfig {
136
+ /** The target sovereignty level for the deployment. */
137
+ readonly sovereignty_level: SovereigntyLevel;
138
+ /** Optional explicit package identifier. */
139
+ readonly package_id?: string;
140
+ /** Optional additional key/value pairs to embed in the manifest. */
141
+ readonly metadata?: Readonly<Record<string, string>>;
142
+ /** Optional source directory path to scan for files. */
143
+ readonly source_directory?: string;
144
+ /** Optional explicit list of file paths to include. */
145
+ readonly explicit_files?: readonly string[];
146
+ }
147
+
148
+ // ---------------------------------------------------------------------------
149
+ // Synchronisation types
150
+ // ---------------------------------------------------------------------------
151
+
152
+ /**
153
+ * Priority level for a sync task.
154
+ * Maps to SyncPriority enum in Python.
155
+ */
156
+ export type SyncPriority = "critical" | "high" | "normal" | "low";
157
+
158
+ /**
159
+ * Lifecycle state of a sync task.
160
+ * Maps to SyncTaskStatus enum in Python.
161
+ */
162
+ export type SyncTaskStatus =
163
+ | "pending"
164
+ | "in_progress"
165
+ | "completed"
166
+ | "failed"
167
+ | "skipped";
168
+
169
+ /** Policy governing when and how synchronisation may occur. */
170
+ export interface SyncConfig {
171
+ /** Whether sync tasks may run in the background. */
172
+ readonly allow_background_sync: boolean;
173
+ /** Maximum number of retry attempts for a failed sync task. */
174
+ readonly max_retry_attempts: number;
175
+ /** Base backoff interval in seconds between retry attempts. */
176
+ readonly retry_backoff_seconds: number;
177
+ /** UTC hour (0–23) at which the sync window opens. -1 means any time. */
178
+ readonly sync_window_start_hour: number;
179
+ /** UTC hour (0–23) at which the sync window closes. -1 means any time. */
180
+ readonly sync_window_end_hour: number;
181
+ /** Whether sync must only proceed over an encrypted channel. */
182
+ readonly require_encrypted_channel: boolean;
183
+ /** Maximum size of a single sync payload in MiB. */
184
+ readonly max_payload_size_mb: number;
185
+ /** If non-empty, only sync tasks with a type in this list are allowed. */
186
+ readonly allowed_sync_types: readonly string[];
187
+ }
188
+
189
+ /** A single unit of work to synchronise. */
190
+ export interface SyncTask {
191
+ /** Unique identifier for this sync task. */
192
+ readonly task_id: string;
193
+ /** Category of sync (e.g. "model_update", "audit_log"). */
194
+ readonly sync_type: string;
195
+ /** Human-readable description of what this task syncs. */
196
+ readonly payload_description: string;
197
+ /** Task priority affecting processing order. */
198
+ readonly priority: SyncPriority;
199
+ /** Current lifecycle state. */
200
+ readonly status: SyncTaskStatus;
201
+ /** ISO-8601 UTC timestamp of task creation. */
202
+ readonly created_at: string;
203
+ /** ISO-8601 UTC timestamp of last status change. */
204
+ readonly updated_at: string;
205
+ /** Number of retry attempts made so far. */
206
+ readonly retry_count: number;
207
+ /** Last error message if the task failed. */
208
+ readonly error_message: string;
209
+ /** Arbitrary key/value metadata attached to this task. */
210
+ readonly metadata: Readonly<Record<string, string>>;
211
+ }
212
+
213
+ /** Request payload for queueing a sync task. */
214
+ export interface SyncStateRequest {
215
+ /** Category of the sync task. */
216
+ readonly sync_type: string;
217
+ /** Human-readable description of what will be synced. */
218
+ readonly payload_description: string;
219
+ /** Task priority. */
220
+ readonly priority?: SyncPriority;
221
+ /** Optional metadata key/value pairs. */
222
+ readonly metadata?: Readonly<Record<string, string>>;
223
+ }
224
+
225
+ // ---------------------------------------------------------------------------
226
+ // Offline capability types
227
+ // ---------------------------------------------------------------------------
228
+
229
+ /**
230
+ * Current connectivity status of the edge node.
231
+ * Maps to OfflineStatus enum in Python.
232
+ */
233
+ export type OfflineStatus = "online" | "offline" | "degraded";
234
+
235
+ /** Describes the offline operation capabilities of an edge deployment. */
236
+ export interface OfflineCapability {
237
+ /** Whether the node can return cached responses when offline. */
238
+ readonly can_serve_cached_responses: boolean;
239
+ /** Whether local model inference is available without network. */
240
+ readonly can_run_local_inference: boolean;
241
+ /** Whether write operations can be queued for later sync. */
242
+ readonly can_queue_writes: boolean;
243
+ /** Maximum hours the node should operate offline. -1 = indefinite. */
244
+ readonly max_offline_duration_hours: number;
245
+ /** Time-to-live for cached responses in hours. */
246
+ readonly cache_ttl_hours: number;
247
+ /** Operation types available in degraded/offline mode. */
248
+ readonly supported_degraded_operations: readonly string[];
249
+ }
250
+
251
+ /** Current sovereignty status of an edge deployment. */
252
+ export interface SovereigntyStatus {
253
+ /** The sovereignty level currently in effect. */
254
+ readonly sovereignty_level: SovereigntyLevel;
255
+ /** Current connectivity status. */
256
+ readonly offline_status: OfflineStatus;
257
+ /** Number of sync tasks currently pending. */
258
+ readonly pending_sync_tasks: number;
259
+ /** Whether resource validation has passed. */
260
+ readonly resources_valid: boolean;
261
+ /** ISO-8601 UTC timestamp of the last status check. */
262
+ readonly checked_at: string;
263
+ }
264
+
265
+ // ---------------------------------------------------------------------------
266
+ // API result wrapper (shared pattern)
267
+ // ---------------------------------------------------------------------------
268
+
269
+ /** Standard error payload returned by the agent-sovereign API. */
270
+ export interface ApiError {
271
+ readonly error: string;
272
+ readonly detail: string;
273
+ }
274
+
275
+ /** Result type for all client operations. */
276
+ export type ApiResult<T> =
277
+ | { readonly ok: true; readonly data: T }
278
+ | { 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
+ }