@novalabai/adk 1.0.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/LICENSE +21 -0
- package/README.md +129 -0
- package/dist/client.d.ts +29 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +47 -0
- package/dist/client.js.map +1 -0
- package/dist/core/confidence.d.ts +32 -0
- package/dist/core/confidence.d.ts.map +1 -0
- package/dist/core/confidence.js +65 -0
- package/dist/core/confidence.js.map +1 -0
- package/dist/core/errors.d.ts +27 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +64 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/http.d.ts +45 -0
- package/dist/core/http.d.ts.map +1 -0
- package/dist/core/http.js +207 -0
- package/dist/core/http.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/resources/agents.d.ts +32 -0
- package/dist/resources/agents.d.ts.map +1 -0
- package/dist/resources/agents.js +53 -0
- package/dist/resources/agents.js.map +1 -0
- package/dist/resources/automations.d.ts +40 -0
- package/dist/resources/automations.d.ts.map +1 -0
- package/dist/resources/automations.js +59 -0
- package/dist/resources/automations.js.map +1 -0
- package/dist/resources/connections.d.ts +33 -0
- package/dist/resources/connections.d.ts.map +1 -0
- package/dist/resources/connections.js +43 -0
- package/dist/resources/connections.js.map +1 -0
- package/dist/resources/data.d.ts +27 -0
- package/dist/resources/data.d.ts.map +1 -0
- package/dist/resources/data.js +44 -0
- package/dist/resources/data.js.map +1 -0
- package/dist/resources/history.d.ts +16 -0
- package/dist/resources/history.d.ts.map +1 -0
- package/dist/resources/history.js +27 -0
- package/dist/resources/history.js.map +1 -0
- package/dist/resources/signals.d.ts +43 -0
- package/dist/resources/signals.d.ts.map +1 -0
- package/dist/resources/signals.js +65 -0
- package/dist/resources/signals.js.map +1 -0
- package/dist/resources/trust.d.ts +16 -0
- package/dist/resources/trust.d.ts.map +1 -0
- package/dist/resources/trust.js +22 -0
- package/dist/resources/trust.js.map +1 -0
- package/dist/resources/webhooks.d.ts +27 -0
- package/dist/resources/webhooks.d.ts.map +1 -0
- package/dist/resources/webhooks.js +40 -0
- package/dist/resources/webhooks.js.map +1 -0
- package/dist/resources/workflows.d.ts +31 -0
- package/dist/resources/workflows.d.ts.map +1 -0
- package/dist/resources/workflows.js +51 -0
- package/dist/resources/workflows.js.map +1 -0
- package/dist/types/agents.d.ts +81 -0
- package/dist/types/agents.d.ts.map +1 -0
- package/dist/types/agents.js +3 -0
- package/dist/types/agents.js.map +1 -0
- package/dist/types/automations.d.ts +48 -0
- package/dist/types/automations.d.ts.map +1 -0
- package/dist/types/automations.js +3 -0
- package/dist/types/automations.js.map +1 -0
- package/dist/types/connections.d.ts +37 -0
- package/dist/types/connections.d.ts.map +1 -0
- package/dist/types/connections.js +3 -0
- package/dist/types/connections.js.map +1 -0
- package/dist/types/data.d.ts +34 -0
- package/dist/types/data.d.ts.map +1 -0
- package/dist/types/data.js +3 -0
- package/dist/types/data.js.map +1 -0
- package/dist/types/history.d.ts +33 -0
- package/dist/types/history.d.ts.map +1 -0
- package/dist/types/history.js +3 -0
- package/dist/types/history.js.map +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/signals.d.ts +51 -0
- package/dist/types/signals.d.ts.map +1 -0
- package/dist/types/signals.js +3 -0
- package/dist/types/signals.js.map +1 -0
- package/dist/types/trust.d.ts +26 -0
- package/dist/types/trust.d.ts.map +1 -0
- package/dist/types/trust.js +3 -0
- package/dist/types/trust.js.map +1 -0
- package/dist/types/webhooks.d.ts +27 -0
- package/dist/types/webhooks.d.ts.map +1 -0
- package/dist/types/webhooks.js +3 -0
- package/dist/types/webhooks.js.map +1 -0
- package/dist/types/workflows.d.ts +54 -0
- package/dist/types/workflows.d.ts.map +1 -0
- package/dist/types/workflows.js +3 -0
- package/dist/types/workflows.js.map +1 -0
- package/dist/utils/hmac.d.ts +5 -0
- package/dist/utils/hmac.d.ts.map +1 -0
- package/dist/utils/hmac.js +23 -0
- package/dist/utils/hmac.js.map +1 -0
- package/dist/utils/streaming.d.ts +22 -0
- package/dist/utils/streaming.d.ts.map +1 -0
- package/dist/utils/streaming.js +92 -0
- package/dist/utils/streaming.js.map +1 -0
- package/package.json +65 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 NovaLab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# @novalabai/adk
|
|
2
|
+
|
|
3
|
+
The official **TypeScript Agent Development Kit** for the [NovaLab](https://novalab.build) AI orchestration platform.
|
|
4
|
+
|
|
5
|
+
Build, test, and deploy autonomous AI agents with smart model routing, enterprise-grade trust scoring, confidence layers, and full auditability.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @novalabai/adk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { NovaClient } from '@novalabai/adk';
|
|
17
|
+
|
|
18
|
+
const nova = new NovaClient({
|
|
19
|
+
apiKey: process.env.NOVA_API_KEY!,
|
|
20
|
+
region: 'eu-west-1', // optional, defaults to eu-west-1
|
|
21
|
+
baseUrl: 'http://localhost:4300/v1', // optional, for local dev
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// Create an agent
|
|
25
|
+
const agent = await nova.agents.create({
|
|
26
|
+
name: 'my-assistant',
|
|
27
|
+
description: 'A helpful coding assistant',
|
|
28
|
+
model: 'auto',
|
|
29
|
+
systemPrompt: 'You are a helpful assistant.',
|
|
30
|
+
temperature: 0.7,
|
|
31
|
+
maxTokens: 2048,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Deploy it
|
|
35
|
+
await nova.agents.deploy(agent.agentId);
|
|
36
|
+
|
|
37
|
+
// Run a task
|
|
38
|
+
const result = await nova.agents.run(agent.agentId, {
|
|
39
|
+
task: 'Explain the security risks of storing JWT tokens in localStorage',
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
console.log(result.output); // AI response
|
|
43
|
+
console.log(result.confidence); // 0-100 confidence score
|
|
44
|
+
console.log(result.trust); // Trust evaluation (accuracy, safety, relevance, completeness)
|
|
45
|
+
console.log(result.autonomyLevel); // AUTONOMOUS | NOTIFY | APPROVAL_REQUIRED | BLOCKED
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
- **Smart Model Routing** — Auto-routes tasks to the best model (Claude for analytical, Gemini for creative)
|
|
51
|
+
- **Trust Layer** — Claude evaluates any model's output for accuracy, safety, relevance, and completeness
|
|
52
|
+
- **Confidence Scoring** — Blended pipeline + trust scores with autonomy level determination
|
|
53
|
+
- **Agent Lifecycle** — Create, deploy, run, pause, and manage AI agents
|
|
54
|
+
- **Workflow Pipelines** — Multi-step agent workflows with confidence gates
|
|
55
|
+
- **Signal Monitoring** — Real-time telemetry ingestion with anomaly detection
|
|
56
|
+
- **Automations** — Rule-based triggers and scheduled actions
|
|
57
|
+
- **Connections Hub** — Third-party integrations (Slack, GitHub, Jira, etc.)
|
|
58
|
+
- **Audit History** — Full decision trail with trust data and explanations
|
|
59
|
+
- **Webhook Verification** — HMAC-SHA256 payload signing and verification
|
|
60
|
+
- **Streaming** — Server-Sent Events for real-time agent output
|
|
61
|
+
- **Full TypeScript** — Complete type definitions with strict mode
|
|
62
|
+
|
|
63
|
+
## API Resources
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
const nova = new NovaClient({ apiKey: '...' });
|
|
67
|
+
|
|
68
|
+
nova.agents // Create, deploy, run, and manage AI agents
|
|
69
|
+
nova.trust // Evaluate any AI output for trust and safety
|
|
70
|
+
nova.workflows // Build and execute multi-step pipelines
|
|
71
|
+
nova.signals // Ingest and stream real-time telemetry
|
|
72
|
+
nova.automations // Manage rule-based automations
|
|
73
|
+
nova.connections // Third-party integrations
|
|
74
|
+
nova.data // Upload and query datasets
|
|
75
|
+
nova.history // Audit trail and decision replay
|
|
76
|
+
nova.webhooks // Event subscriptions
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Trust Evaluation
|
|
80
|
+
|
|
81
|
+
Evaluate any AI output independently:
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
const result = await nova.trust.evaluate({
|
|
85
|
+
input: 'What is the capital of France?',
|
|
86
|
+
output: 'The capital of France is Paris.',
|
|
87
|
+
model: 'gpt-4',
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
console.log(result.trust.overallScore); // 97
|
|
91
|
+
console.log(result.trust.trustLevel); // "high"
|
|
92
|
+
console.log(result.trust.accuracyScore); // 100
|
|
93
|
+
console.log(result.trust.safetyScore); // 95
|
|
94
|
+
console.log(result.trust.concerns); // []
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Webhook Verification
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
import { verifyWebhookSignature } from '@novalabai/adk';
|
|
101
|
+
|
|
102
|
+
const isValid = await verifyWebhookSignature(
|
|
103
|
+
rawBody,
|
|
104
|
+
signatureHeader,
|
|
105
|
+
webhookSecret,
|
|
106
|
+
);
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Streaming
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
const stream = await nova.agents.run(agentId, {
|
|
113
|
+
task: 'Write a story',
|
|
114
|
+
stream: true,
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
for await (const chunk of stream) {
|
|
118
|
+
process.stdout.write(chunk.text);
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Requirements
|
|
123
|
+
|
|
124
|
+
- Node.js >= 18
|
|
125
|
+
- A NovaLab API key ([get one at novalab.build](https://novalab.build))
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
[MIT](./LICENSE)
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AgentsResource } from './resources/agents.js';
|
|
2
|
+
import { WorkflowsResource } from './resources/workflows.js';
|
|
3
|
+
import { SignalsResource } from './resources/signals.js';
|
|
4
|
+
import { AutomationsResource } from './resources/automations.js';
|
|
5
|
+
import { ConnectionsResource } from './resources/connections.js';
|
|
6
|
+
import { DataResource } from './resources/data.js';
|
|
7
|
+
import { HistoryResource } from './resources/history.js';
|
|
8
|
+
import { TrustResource } from './resources/trust.js';
|
|
9
|
+
import { WebhooksResource } from './resources/webhooks.js';
|
|
10
|
+
export interface NovaClientOptions {
|
|
11
|
+
apiKey: string;
|
|
12
|
+
region?: string;
|
|
13
|
+
baseUrl?: string;
|
|
14
|
+
timeout?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare class NovaClient {
|
|
17
|
+
readonly agents: AgentsResource;
|
|
18
|
+
readonly workflows: WorkflowsResource;
|
|
19
|
+
readonly signals: SignalsResource;
|
|
20
|
+
readonly automations: AutomationsResource;
|
|
21
|
+
readonly connections: ConnectionsResource;
|
|
22
|
+
readonly data: DataResource;
|
|
23
|
+
readonly history: HistoryResource;
|
|
24
|
+
readonly trust: TrustResource;
|
|
25
|
+
readonly webhooks: WebhooksResource;
|
|
26
|
+
private readonly http;
|
|
27
|
+
constructor(options: NovaClientOptions);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAID,qBAAa,UAAU;IACrB,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC;IAC1C,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC;IAC1C,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IAEpC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;gBAEtB,OAAO,EAAE,iBAAiB;CAqBvC"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NovaClient = void 0;
|
|
4
|
+
const http_js_1 = require("./core/http.js");
|
|
5
|
+
const agents_js_1 = require("./resources/agents.js");
|
|
6
|
+
const workflows_js_1 = require("./resources/workflows.js");
|
|
7
|
+
const signals_js_1 = require("./resources/signals.js");
|
|
8
|
+
const automations_js_1 = require("./resources/automations.js");
|
|
9
|
+
const connections_js_1 = require("./resources/connections.js");
|
|
10
|
+
const data_js_1 = require("./resources/data.js");
|
|
11
|
+
const history_js_1 = require("./resources/history.js");
|
|
12
|
+
const trust_js_1 = require("./resources/trust.js");
|
|
13
|
+
const webhooks_js_1 = require("./resources/webhooks.js");
|
|
14
|
+
const DEFAULT_REGION = 'eu-west-1';
|
|
15
|
+
class NovaClient {
|
|
16
|
+
agents;
|
|
17
|
+
workflows;
|
|
18
|
+
signals;
|
|
19
|
+
automations;
|
|
20
|
+
connections;
|
|
21
|
+
data;
|
|
22
|
+
history;
|
|
23
|
+
trust;
|
|
24
|
+
webhooks;
|
|
25
|
+
http;
|
|
26
|
+
constructor(options) {
|
|
27
|
+
const region = options.region ?? DEFAULT_REGION;
|
|
28
|
+
const baseURL = options.baseUrl ?? `https://${region}.api.novalab.build/v1`;
|
|
29
|
+
this.http = new http_js_1.HttpClient({
|
|
30
|
+
baseURL,
|
|
31
|
+
apiKey: options.apiKey,
|
|
32
|
+
region,
|
|
33
|
+
timeout: options.timeout,
|
|
34
|
+
});
|
|
35
|
+
this.agents = new agents_js_1.AgentsResource(this.http);
|
|
36
|
+
this.workflows = new workflows_js_1.WorkflowsResource(this.http);
|
|
37
|
+
this.signals = new signals_js_1.SignalsResource(this.http);
|
|
38
|
+
this.automations = new automations_js_1.AutomationsResource(this.http);
|
|
39
|
+
this.connections = new connections_js_1.ConnectionsResource(this.http);
|
|
40
|
+
this.data = new data_js_1.DataResource(this.http);
|
|
41
|
+
this.history = new history_js_1.HistoryResource(this.http);
|
|
42
|
+
this.trust = new trust_js_1.TrustResource(this.http);
|
|
43
|
+
this.webhooks = new webhooks_js_1.WebhooksResource(this.http);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.NovaClient = NovaClient;
|
|
47
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAC5C,qDAAuD;AACvD,2DAA6D;AAC7D,uDAAyD;AACzD,+DAAiE;AACjE,+DAAiE;AACjE,iDAAmD;AACnD,uDAAyD;AACzD,mDAAqD;AACrD,yDAA2D;AAS3D,MAAM,cAAc,GAAG,WAAW,CAAC;AAEnC,MAAa,UAAU;IACZ,MAAM,CAAiB;IACvB,SAAS,CAAoB;IAC7B,OAAO,CAAkB;IACzB,WAAW,CAAsB;IACjC,WAAW,CAAsB;IACjC,IA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+
AUTONOMOUS = "AUTONOMOUS",
|
|
3
|
+
NOTIFY = "NOTIFY",
|
|
4
|
+
APPROVAL_REQUIRED = "APPROVAL_REQUIRED",
|
|
5
|
+
BLOCKED = "BLOCKED"
|
|
6
|
+
}
|
|
7
|
+
export interface ConfidenceThresholds {
|
|
8
|
+
autonomous: number;
|
|
9
|
+
notify: number;
|
|
10
|
+
approvalRequired: number;
|
|
11
|
+
}
|
|
12
|
+
/** Evaluate a confidence score (0-100) against thresholds and return the corresponding level. */
|
|
13
|
+
export declare function evaluateConfidence(score: number, thresholds?: ConfidenceThresholds): ConfidenceLevel;
|
|
14
|
+
export declare class ConfidenceGate {
|
|
15
|
+
private readonly thresholds;
|
|
16
|
+
private readonly blockBelowApproval;
|
|
17
|
+
constructor(options?: {
|
|
18
|
+
thresholds?: Partial<ConfidenceThresholds>;
|
|
19
|
+
blockBelowApproval?: boolean;
|
|
20
|
+
});
|
|
21
|
+
/** Evaluate and return the confidence level. */
|
|
22
|
+
evaluate(score: number): ConfidenceLevel;
|
|
23
|
+
/** Check if the score passes the gate. Throws NovaConfidenceError if blocked. */
|
|
24
|
+
enforce(score: number): ConfidenceLevel;
|
|
25
|
+
/** Return true if the score allows autonomous execution. */
|
|
26
|
+
isAutonomous(score: number): boolean;
|
|
27
|
+
/** Return true if the score requires human approval. */
|
|
28
|
+
requiresApproval(score: number): boolean;
|
|
29
|
+
/** Return the current thresholds. */
|
|
30
|
+
getThresholds(): Readonly<ConfidenceThresholds>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=confidence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confidence.d.ts","sourceRoot":"","sources":["../../src/core/confidence.ts"],"names":[],"mappings":"AAEA,oBAAY,eAAe;IACzB,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,iBAAiB,sBAAsB;IACvC,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAQD,iGAAiG;AACjG,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,UAAU,GAAE,oBAAyC,GACpD,eAAe,CASjB;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAuB;IAClD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAU;gBAEjC,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;QAAC,kBAAkB,CAAC,EAAE,OAAO,CAAA;KAAE;IAKlG,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe;IAIxC,iFAAiF;IACjF,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe;IAavC,4DAA4D;IAC5D,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAIpC,wDAAwD;IACxD,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAKxC,qCAAqC;IACrC,aAAa,IAAI,QAAQ,CAAC,oBAAoB,CAAC;CAGhD"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfidenceGate = exports.ConfidenceLevel = void 0;
|
|
4
|
+
exports.evaluateConfidence = evaluateConfidence;
|
|
5
|
+
const errors_js_1 = require("./errors.js");
|
|
6
|
+
var ConfidenceLevel;
|
|
7
|
+
(function (ConfidenceLevel) {
|
|
8
|
+
ConfidenceLevel["AUTONOMOUS"] = "AUTONOMOUS";
|
|
9
|
+
ConfidenceLevel["NOTIFY"] = "NOTIFY";
|
|
10
|
+
ConfidenceLevel["APPROVAL_REQUIRED"] = "APPROVAL_REQUIRED";
|
|
11
|
+
ConfidenceLevel["BLOCKED"] = "BLOCKED";
|
|
12
|
+
})(ConfidenceLevel || (exports.ConfidenceLevel = ConfidenceLevel = {}));
|
|
13
|
+
const DEFAULT_THRESHOLDS = {
|
|
14
|
+
autonomous: 90,
|
|
15
|
+
notify: 70,
|
|
16
|
+
approvalRequired: 50,
|
|
17
|
+
};
|
|
18
|
+
/** Evaluate a confidence score (0-100) against thresholds and return the corresponding level. */
|
|
19
|
+
function evaluateConfidence(score, thresholds = DEFAULT_THRESHOLDS) {
|
|
20
|
+
if (score < 0 || score > 100) {
|
|
21
|
+
throw new errors_js_1.NovaConfidenceError(score, 'Confidence score must be between 0 and 100');
|
|
22
|
+
}
|
|
23
|
+
if (score >= thresholds.autonomous)
|
|
24
|
+
return ConfidenceLevel.AUTONOMOUS;
|
|
25
|
+
if (score >= thresholds.notify)
|
|
26
|
+
return ConfidenceLevel.NOTIFY;
|
|
27
|
+
if (score >= thresholds.approvalRequired)
|
|
28
|
+
return ConfidenceLevel.APPROVAL_REQUIRED;
|
|
29
|
+
return ConfidenceLevel.BLOCKED;
|
|
30
|
+
}
|
|
31
|
+
class ConfidenceGate {
|
|
32
|
+
thresholds;
|
|
33
|
+
blockBelowApproval;
|
|
34
|
+
constructor(options) {
|
|
35
|
+
this.thresholds = { ...DEFAULT_THRESHOLDS, ...options?.thresholds };
|
|
36
|
+
this.blockBelowApproval = options?.blockBelowApproval ?? true;
|
|
37
|
+
}
|
|
38
|
+
/** Evaluate and return the confidence level. */
|
|
39
|
+
evaluate(score) {
|
|
40
|
+
return evaluateConfidence(score, this.thresholds);
|
|
41
|
+
}
|
|
42
|
+
/** Check if the score passes the gate. Throws NovaConfidenceError if blocked. */
|
|
43
|
+
enforce(score) {
|
|
44
|
+
const level = this.evaluate(score);
|
|
45
|
+
if (level === ConfidenceLevel.BLOCKED && this.blockBelowApproval) {
|
|
46
|
+
throw new errors_js_1.NovaConfidenceError(score, `Confidence score ${score} is blocked (below ${this.thresholds.approvalRequired})`);
|
|
47
|
+
}
|
|
48
|
+
return level;
|
|
49
|
+
}
|
|
50
|
+
/** Return true if the score allows autonomous execution. */
|
|
51
|
+
isAutonomous(score) {
|
|
52
|
+
return this.evaluate(score) === ConfidenceLevel.AUTONOMOUS;
|
|
53
|
+
}
|
|
54
|
+
/** Return true if the score requires human approval. */
|
|
55
|
+
requiresApproval(score) {
|
|
56
|
+
const level = this.evaluate(score);
|
|
57
|
+
return level === ConfidenceLevel.APPROVAL_REQUIRED || level === ConfidenceLevel.BLOCKED;
|
|
58
|
+
}
|
|
59
|
+
/** Return the current thresholds. */
|
|
60
|
+
getThresholds() {
|
|
61
|
+
return { ...this.thresholds };
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.ConfidenceGate = ConfidenceGate;
|
|
65
|
+
//# sourceMappingURL=confidence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confidence.js","sourceRoot":"","sources":["../../src/core/confidence.ts"],"names":[],"mappings":";;;AAsBA,gDAYC;AAlCD,2CAAkD;AAElD,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,4CAAyB,CAAA;IACzB,oCAAiB,CAAA;IACjB,0DAAuC,CAAA;IACvC,sCAAmB,CAAA;AACrB,CAAC,EALW,eAAe,+BAAf,eAAe,QAK1B;AAQD,MAAM,kBAAkB,GAAyB;IAC/C,UAAU,EAAE,EAAE;IACd,MAAM,EAAE,EAAE;IACV,gBAAgB,EAAE,EAAE;CACrB,CAAC;AAEF,iGAAiG;AACjG,SAAgB,kBAAkB,CAChC,KAAa,EACb,aAAmC,kBAAkB;IAErD,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,GAAG,EAAE,CAAC;QAC7B,MAAM,IAAI,+BAAmB,CAAC,KAAK,EAAE,4CAA4C,CAAC,CAAC;IACrF,CAAC;IAED,IAAI,KAAK,IAAI,UAAU,CAAC,UAAU;QAAE,OAAO,eAAe,CAAC,UAAU,CAAC;IACtE,IAAI,KAAK,IAAI,UAAU,CAAC,MAAM;QAAE,OAAO,eAAe,CAAC,MAAM,C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,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;IAChC,CAAC;CACF;AA3CD,wCA2CC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare class NovaError extends Error {
|
|
2
|
+
constructor(message: string);
|
|
3
|
+
}
|
|
4
|
+
export declare class NovaAPIError extends NovaError {
|
|
5
|
+
readonly status: number;
|
|
6
|
+
readonly code: string;
|
|
7
|
+
readonly requestId: string | undefined;
|
|
8
|
+
constructor(status: number, code: string, message: string, requestId?: string);
|
|
9
|
+
}
|
|
10
|
+
export declare class NovaAuthError extends NovaAPIError {
|
|
11
|
+
constructor(message?: string, requestId?: string);
|
|
12
|
+
}
|
|
13
|
+
export declare class NovaRateLimitError extends NovaAPIError {
|
|
14
|
+
readonly retryAfter: number;
|
|
15
|
+
constructor(retryAfter: number, message?: string, requestId?: string);
|
|
16
|
+
}
|
|
17
|
+
export declare class NovaValidationError extends NovaError {
|
|
18
|
+
constructor(message: string);
|
|
19
|
+
}
|
|
20
|
+
export declare class NovaTimeoutError extends NovaError {
|
|
21
|
+
constructor(message?: string);
|
|
22
|
+
}
|
|
23
|
+
export declare class NovaConfidenceError extends NovaError {
|
|
24
|
+
readonly confidence: number;
|
|
25
|
+
constructor(confidence: number, message?: string);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,SAAU,SAAQ,KAAK;gBACtB,OAAO,EAAE,MAAM;CAK5B;AAED,qBAAa,YAAa,SAAQ,SAAS;IACzC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;gBAE3B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;CAO9E;AAED,qBAAa,aAAc,SAAQ,YAAY;gBACjC,OAAO,GAAE,MAAgC,EAAE,SAAS,CAAC,EAAE,MAAM;CAI1E;AAED,qBAAa,kBAAmB,SAAQ,YAAY;IAClD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEhB,UAAU,EAAE,MAAM,EAAE,OAAO,GAAE,MAA8B,EAAE,SAAS,CAAC,EAAE,MAAM;CAK5F;AAED,qBAAa,mBAAoB,SAAQ,SAAS;gBACpC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,gBAAiB,SAAQ,SAAS;gBACjC,OAAO,GAAE,MAA4B;CAIlD;AAED,qBAAa,mBAAoB,SAAQ,SAAS;IAChD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEhB,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;CAKjD"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NovaConfidenceError = exports.NovaTimeoutError = exports.NovaValidationError = exports.NovaRateLimitError = exports.NovaAuthError = exports.NovaAPIError = exports.NovaError = void 0;
|
|
4
|
+
class NovaError extends Error {
|
|
5
|
+
constructor(message) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = 'NovaError';
|
|
8
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.NovaError = NovaError;
|
|
12
|
+
class NovaAPIError extends NovaError {
|
|
13
|
+
status;
|
|
14
|
+
code;
|
|
15
|
+
requestId;
|
|
16
|
+
constructor(status, code, message, requestId) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.name = 'NovaAPIError';
|
|
19
|
+
this.status = status;
|
|
20
|
+
this.code = code;
|
|
21
|
+
this.requestId = requestId;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.NovaAPIError = NovaAPIError;
|
|
25
|
+
class NovaAuthError extends NovaAPIError {
|
|
26
|
+
constructor(message = 'Authentication failed', requestId) {
|
|
27
|
+
super(401, 'auth_error', message, requestId);
|
|
28
|
+
this.name = 'NovaAuthError';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.NovaAuthError = NovaAuthError;
|
|
32
|
+
class NovaRateLimitError extends NovaAPIError {
|
|
33
|
+
retryAfter;
|
|
34
|
+
constructor(retryAfter, message = 'Rate limit exceeded', requestId) {
|
|
35
|
+
super(429, 'rate_limit_exceeded', message, requestId);
|
|
36
|
+
this.name = 'NovaRateLimitError';
|
|
37
|
+
this.retryAfter = retryAfter;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.NovaRateLimitError = NovaRateLimitError;
|
|
41
|
+
class NovaValidationError extends NovaError {
|
|
42
|
+
constructor(message) {
|
|
43
|
+
super(message);
|
|
44
|
+
this.name = 'NovaValidationError';
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.NovaValidationError = NovaValidationError;
|
|
48
|
+
class NovaTimeoutError extends NovaError {
|
|
49
|
+
constructor(message = 'Request timed out') {
|
|
50
|
+
super(message);
|
|
51
|
+
this.name = 'NovaTimeoutError';
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.NovaTimeoutError = NovaTimeoutError;
|
|
55
|
+
class NovaConfidenceError extends NovaError {
|
|
56
|
+
confidence;
|
|
57
|
+
constructor(confidence, message) {
|
|
58
|
+
super(message ?? `Confidence score ${confidence} is below the required threshold`);
|
|
59
|
+
this.name = 'NovaConfidenceError';
|
|
60
|
+
this.confidence = confidence;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.NovaConfidenceError = NovaConfidenceError;
|
|
64
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src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,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AALD,kDAKC;AAED,MAAa,gBAAiB,SAAQ,SAAS;IAC7C,YAAY,UAAkB,mBAAmB;QAC/C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AALD,4CAKC;AAED,MAAa,mBAAoB,SAAQ,SAAS;IACvC,UAAU,CAAS;IAE5B,YAAY,UAAkB,EAAE,OAAgB;QAC9C,KAAK,CAAC,OAAO,IAAI,oBAAoB,UAAU,kCAAkC,CAAC,CAAC;QACnF,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF;AARD,kDAQC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export type RequestInterceptor = (config: RequestConfig) => RequestConfig | Promise<RequestConfig>;
|
|
2
|
+
export type ResponseInterceptor = (response: HttpResponse<unknown>) => HttpResponse<unknown> | Promise<HttpResponse<unknown>>;
|
|
3
|
+
export interface HttpClientOptions {
|
|
4
|
+
baseURL: string;
|
|
5
|
+
apiKey: string;
|
|
6
|
+
region: string;
|
|
7
|
+
timeout?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface RequestConfig {
|
|
10
|
+
method: string;
|
|
11
|
+
url: string;
|
|
12
|
+
headers: Record<string, string>;
|
|
13
|
+
body?: string | Buffer;
|
|
14
|
+
timeout: number;
|
|
15
|
+
}
|
|
16
|
+
export interface HttpResponse<T> {
|
|
17
|
+
status: number;
|
|
18
|
+
headers: Record<string, string>;
|
|
19
|
+
data: T;
|
|
20
|
+
requestId: string;
|
|
21
|
+
}
|
|
22
|
+
export declare class HttpClient {
|
|
23
|
+
private readonly baseURL;
|
|
24
|
+
private readonly apiKey;
|
|
25
|
+
private readonly timeout;
|
|
26
|
+
private readonly requestInterceptors;
|
|
27
|
+
private readonly responseInterceptors;
|
|
28
|
+
constructor(options: HttpClientOptions);
|
|
29
|
+
/** Register a request interceptor. */
|
|
30
|
+
onRequest(interceptor: RequestInterceptor): void;
|
|
31
|
+
/** Register a response interceptor. */
|
|
32
|
+
onResponse(interceptor: ResponseInterceptor): void;
|
|
33
|
+
get<T>(path: string, query?: Record<string, string | number | boolean | undefined>): Promise<T>;
|
|
34
|
+
post<T>(path: string, body?: unknown): Promise<T>;
|
|
35
|
+
put<T>(path: string, body?: unknown): Promise<T>;
|
|
36
|
+
patch<T>(path: string, body?: unknown): Promise<T>;
|
|
37
|
+
delete<T = void>(path: string): Promise<T>;
|
|
38
|
+
/** Return the raw fetch Response (used for SSE streaming). */
|
|
39
|
+
stream(path: string, body?: unknown): Promise<Response>;
|
|
40
|
+
private buildURL;
|
|
41
|
+
private request;
|
|
42
|
+
private handleErrorResponse;
|
|
43
|
+
private buildErrorFromResponse;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/core/http.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,aAAa,KAAK,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACnG,MAAM,MAAM,mBAAmB,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,OAAO,CAAC,KAAK,YAAY,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;AAE9H,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,O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