@novalabai/adk 2.6.0 → 2.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +15 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +20 -0
- package/dist/client.js.map +1 -1
- package/dist/core/errors.d.ts +18 -0
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +21 -1
- package/dist/core/errors.js.map +1 -1
- package/dist/core/http.d.ts +15 -0
- package/dist/core/http.d.ts.map +1 -1
- package/dist/core/http.js +93 -3
- package/dist/core/http.js.map +1 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/dist/resources/auto-agent.d.ts +53 -0
- package/dist/resources/auto-agent.d.ts.map +1 -0
- package/dist/resources/auto-agent.js +61 -0
- package/dist/resources/auto-agent.js.map +1 -0
- package/dist/resources/billing.d.ts +14 -2
- package/dist/resources/billing.d.ts.map +1 -1
- package/dist/resources/billing.js +15 -1
- package/dist/resources/billing.js.map +1 -1
- package/dist/resources/chat.d.ts +27 -0
- package/dist/resources/chat.d.ts.map +1 -1
- package/dist/resources/chat.js +31 -0
- package/dist/resources/chat.js.map +1 -1
- package/dist/resources/files.d.ts +59 -0
- package/dist/resources/files.d.ts.map +1 -0
- package/dist/resources/files.js +59 -0
- package/dist/resources/files.js.map +1 -0
- package/dist/resources/history.d.ts +33 -1
- package/dist/resources/history.d.ts.map +1 -1
- package/dist/resources/history.js +43 -3
- package/dist/resources/history.js.map +1 -1
- package/dist/resources/planner.d.ts +66 -0
- package/dist/resources/planner.d.ts.map +1 -0
- package/dist/resources/planner.js +80 -0
- package/dist/resources/planner.js.map +1 -0
- package/dist/resources/repair.d.ts +73 -0
- package/dist/resources/repair.d.ts.map +1 -0
- package/dist/resources/repair.js +100 -0
- package/dist/resources/repair.js.map +1 -0
- package/dist/resources/voice.d.ts +47 -0
- package/dist/resources/voice.d.ts.map +1 -0
- package/dist/resources/voice.js +64 -0
- package/dist/resources/voice.js.map +1 -0
- package/dist/types/auto-agent.d.ts +64 -0
- package/dist/types/auto-agent.d.ts.map +1 -0
- package/dist/types/auto-agent.js +10 -0
- package/dist/types/auto-agent.js.map +1 -0
- package/dist/types/billing.d.ts +17 -0
- package/dist/types/billing.d.ts.map +1 -1
- package/dist/types/chat-stream.d.ts +166 -0
- package/dist/types/chat-stream.d.ts.map +1 -0
- package/dist/types/chat-stream.js +48 -0
- package/dist/types/chat-stream.js.map +1 -0
- package/dist/types/files.d.ts +18 -0
- package/dist/types/files.d.ts.map +1 -0
- package/dist/types/files.js +4 -0
- package/dist/types/files.js.map +1 -0
- package/dist/types/planner.d.ts +68 -0
- package/dist/types/planner.d.ts.map +1 -0
- package/dist/types/planner.js +11 -0
- package/dist/types/planner.js.map +1 -0
- package/dist/types/repair.d.ts +79 -0
- package/dist/types/repair.d.ts.map +1 -0
- package/dist/types/repair.js +16 -0
- package/dist/types/repair.js.map +1 -0
- package/dist/types/voice.d.ts +16 -0
- package/dist/types/voice.d.ts.map +1 -0
- package/dist/types/voice.js +4 -0
- package/dist/types/voice.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AutoAgentResource = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Synthesize-and-run a specialist for off-the-beaten-path requests.
|
|
6
|
+
*
|
|
7
|
+
* The Auto-Agent invents a fit-for-purpose specialist on demand. When a
|
|
8
|
+
* user's request doesn't match any registered specialist (intent router
|
|
9
|
+
* returns `unknown` or low-confidence), call `run()` and Nova will
|
|
10
|
+
* synthesize a one-shot agent + execute it for the turn.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const nova = new NovaClient({ apiKey: 'nova_xxx' });
|
|
15
|
+
*
|
|
16
|
+
* // Synth + run in one call
|
|
17
|
+
* const result = await nova.autoAgent.run({
|
|
18
|
+
* message: 'help me plan a wedding seating chart for 80 guests',
|
|
19
|
+
* });
|
|
20
|
+
* console.log(result.spec.display_name); // "Wedding Seating Planner"
|
|
21
|
+
* console.log(result.response); // domain-quality reply
|
|
22
|
+
*
|
|
23
|
+
* // Or just see the spec without running it (e.g. "save this agent?" UX)
|
|
24
|
+
* const synth = await nova.autoAgent.synthesize({
|
|
25
|
+
* message: 'help me plan a wedding seating chart',
|
|
26
|
+
* });
|
|
27
|
+
* if (synth.spec.confidence > 0.7) {
|
|
28
|
+
* // save into custom agents for re-use
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
class AutoAgentResource {
|
|
33
|
+
http;
|
|
34
|
+
constructor(http) {
|
|
35
|
+
this.http = http;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Generate a specialist spec for the request without executing it.
|
|
39
|
+
*
|
|
40
|
+
* Costs one Haiku call (~$0.0001). The returned `spec` includes a
|
|
41
|
+
* `confidence` value — values below 0.45 mean the synthesizer
|
|
42
|
+
* couldn't pin down a clear specialty and you should fall back to
|
|
43
|
+
* plain chat.
|
|
44
|
+
*/
|
|
45
|
+
async synthesize(params) {
|
|
46
|
+
return this.http.post('/auto-agent/synthesize', params);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Synthesize a specialist and run it against the user's message.
|
|
50
|
+
*
|
|
51
|
+
* Costs two Haiku calls — one for synthesis, one for execution. Always
|
|
52
|
+
* returns a usable response: when the LLM path fails, both `used_llm`
|
|
53
|
+
* values flip to `false` and `response` carries a graceful stub
|
|
54
|
+
* message instead of throwing.
|
|
55
|
+
*/
|
|
56
|
+
async run(params) {
|
|
57
|
+
return this.http.post('/auto-agent/run', params);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.AutoAgentResource = AutoAgentResource;
|
|
61
|
+
//# sourceMappingURL=auto-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-agent.js","sourceRoot":"","sources":["../../src/resources/auto-agent.ts"],"names":[],"mappings":";;;AAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAa,iBAAiB;IACX,IAAI,CAAa;IAElC,YAAY,IAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,UAAU,CAAC,MAAwB;QACvC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CACnB,wBAAwB,EACxB,MAAM,CACP,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,GAAG,CAAC,MAAwB;QAChC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAuB,iBAAiB,EAAE,MAAM,CAAC,CAAC;IACzE,CAAC;CACF;AAjCD,8CAiCC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HttpClient } from '../core/http.js';
|
|
2
|
-
import type { Plan, BillingSummary, UsageInfo, Invoice, CheckoutSessionParams, CheckoutSessionResult, PortalSessionResult, VolumeDiscountTier, AuditEntry, EnterpriseContract, EnterpriseContractParams, SSOConfig } from '../types/billing.js';
|
|
2
|
+
import type { Plan, GroupedPlans, BillingSummary, UsageInfo, Invoice, CheckoutSessionParams, CheckoutSessionResult, PortalSessionResult, VolumeDiscountTier, AuditEntry, EnterpriseContract, EnterpriseContractParams, SSOConfig } from '../types/billing.js';
|
|
3
3
|
/**
|
|
4
4
|
* Billing resource — manage subscriptions, usage, Stripe checkout, invoices, and enterprise features.
|
|
5
5
|
*
|
|
@@ -23,8 +23,20 @@ import type { Plan, BillingSummary, UsageInfo, Invoice, CheckoutSessionParams, C
|
|
|
23
23
|
export declare class BillingResource {
|
|
24
24
|
private readonly http;
|
|
25
25
|
constructor(http: HttpClient);
|
|
26
|
-
/** List available plans with pricing. */
|
|
26
|
+
/** List available plans with pricing (flat list). */
|
|
27
27
|
plans(): Promise<Plan[]>;
|
|
28
|
+
/**
|
|
29
|
+
* List plans grouped by product line (api / app / all-access).
|
|
30
|
+
*
|
|
31
|
+
* Returns three lists:
|
|
32
|
+
* - api_plans: pure API access (developers, SDK)
|
|
33
|
+
* - app_plans: Workspace dashboard plans (end-users)
|
|
34
|
+
* - all_access_plans: legacy combined plans (back-compat)
|
|
35
|
+
*
|
|
36
|
+
* Each plan includes the new dual-pricing fields: product, tagline,
|
|
37
|
+
* billing_unit. Use this when rendering a tabbed pricing page.
|
|
38
|
+
*/
|
|
39
|
+
plansGrouped(): Promise<GroupedPlans>;
|
|
28
40
|
/** Full billing summary — plan, usage, limits, cycle, enterprise contract. */
|
|
29
41
|
subscription(): Promise<BillingSummary>;
|
|
30
42
|
/** Current month usage breakdown. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../src/resources/billing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EACV,IAAI,EACJ,cAAc,EACd,SAAS,EACT,OAAO,EACP,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,EACV,kBAAkB,EAClB,wBAAwB,EACxB,SAAS,EACV,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;gBAEtB,IAAI,EAAE,UAAU;IAI5B,
|
|
1
|
+
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../src/resources/billing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EACV,IAAI,EACJ,YAAY,EACZ,cAAc,EACd,SAAS,EACT,OAAO,EACP,qBAAqB,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
|
29
|
-
/** List available plans with pricing. */
|
|
29
|
+
/** List available plans with pricing (flat list). */
|
|
30
30
|
async plans() {
|
|
31
31
|
const result = await this.http.get('/billing/plans');
|
|
32
32
|
return result.plans;
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* List plans grouped by product line (api / app / all-access).
|
|
36
|
+
*
|
|
37
|
+
* Returns three lists:
|
|
38
|
+
* - api_plans: pure API access (developers, SDK)
|
|
39
|
+
* - app_plans: Workspace dashboard plans (end-users)
|
|
40
|
+
* - all_access_plans: legacy combined plans (back-compat)
|
|
41
|
+
*
|
|
42
|
+
* Each plan includes the new dual-pricing fields: product, tagline,
|
|
43
|
+
* billing_unit. Use this when rendering a tabbed pricing page.
|
|
44
|
+
*/
|
|
45
|
+
async plansGrouped() {
|
|
46
|
+
return this.http.get('/billing/plans?grouped=true');
|
|
47
|
+
}
|
|
34
48
|
/** Full billing summary — plan, usage, limits, cycle, enterprise contract. */
|
|
35
49
|
async subscription() {
|
|
36
50
|
return this.http.get('/billing/subscription');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../src/resources/billing.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../src/resources/billing.ts"],"names":[],"mappings":";;;AAiBA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAa,eAAe;IACT,IAAI,CAAa;IAElC,YAAY,IAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,qDAAqD;IACrD,KAAK,CAAC,KAAK;QACT,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAoB,gBAAgB,CAAC,CAAC;QACxE,OAAO,MAAM,CAAC,KAAK,CAAC;IACtB,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,YAAY;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAe,6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BAA8B,EAAE,MAAM,CAAC,CAAC;IACpF,CAAC;IAED,uCAAuC;IACvC,KAAK,CAAC,qBAAqB;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAqB,8BAA8B,CAAC,CAAC;IAC3E,CAAC;IAED,sDAAsD;IACtD,KAAK,CAAC,YAAY,CAAC,QAAgB,EAAE,MAAc;QACjD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAY,yBAAyB,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IACpF,CAAC;CACF;AApFD,0CAoFC"}
|
package/dist/resources/chat.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { HttpClient } from '../core/http.js';
|
|
2
2
|
import type { ChatMessageParams, ChatResponse, ChatSessionList, ChatHistory } from '../types/chat.js';
|
|
3
|
+
import type { ChatStreamEvent, ChatStreamParams } from '../types/chat-stream.js';
|
|
3
4
|
/**
|
|
4
5
|
* Conversational chat powered by Nova's full AI pipeline.
|
|
5
6
|
*
|
|
@@ -52,5 +53,31 @@ export declare class ChatResource {
|
|
|
52
53
|
history(sessionId: string): Promise<ChatHistory>;
|
|
53
54
|
/** Delete a chat session and its conversation history. */
|
|
54
55
|
deleteSession(sessionId: string): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Stream chat events from /v1/chat/stream as they arrive.
|
|
58
|
+
*
|
|
59
|
+
* Yields a discriminated-union of events: `token` (per-token text),
|
|
60
|
+
* `pipeline` (per-step status), `design` / `document` / `pdf` /
|
|
61
|
+
* `pptx` / `pptx_visual` / `image` / `audio` (artifacts),
|
|
62
|
+
* `guardian` (credential redaction), and a final `done`.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* let full = '';
|
|
67
|
+
* for await (const ev of nova.chat.stream({ message: 'create a 10-slide deck for Acme AI' })) {
|
|
68
|
+
* switch (ev.type) {
|
|
69
|
+
* case 'token': full += ev.content; process.stdout.write(ev.content); break;
|
|
70
|
+
* case 'pdf': await fs.writeFile('deck.pdf', Buffer.from(ev.pdf_base64, 'base64')); break;
|
|
71
|
+
* case 'pptx': if (ev.variant === 'editable') {
|
|
72
|
+
* await fs.writeFile(ev.filename, Buffer.from(ev.pptx_base64, 'base64'));
|
|
73
|
+
* } break;
|
|
74
|
+
* case 'pptx_visual':
|
|
75
|
+
* await fs.writeFile(ev.filename, Buffer.from(ev.pptx_base64, 'base64')); break;
|
|
76
|
+
* case 'done': console.log(`\\nDone — ${ev.model_used}, ${ev.agents_used} agents`); break;
|
|
77
|
+
* }
|
|
78
|
+
* }
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
stream(params: ChatStreamParams): AsyncIterableIterator<ChatStreamEvent>;
|
|
55
82
|
}
|
|
56
83
|
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/resources/chat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EAEZ,eAAe,EACf,WAAW,EACZ,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/resources/chat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EAEZ,eAAe,EACf,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAIjF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;gBAEtB,IAAI,EAAE,UAAU;IAI5B;;;;;OAKG;IACG,IAAI,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;IAI5D;;;;;;;;;;OAUG;IACG,gBAAgB,CACpB,MAAM,EAAE,iBAAiB,EACzB,cAAc,CAAC,EAAE,MAAM,EAAE,GACxB,OAAO,CAAC,YAAY,CAAC;IAYxB,qCAAqC;IAC/B,QAAQ,IAAI,OAAO,CAAC,eAAe,CAAC;IAI1C,8CAA8C;IACxC,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAItD,0DAA0D;IACpD,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrD;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACI,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,qBAAqB,CAAC,eAAe,CAAC;CAKhF"}
|
package/dist/resources/chat.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ChatResource = void 0;
|
|
4
|
+
const chat_stream_js_1 = require("../types/chat-stream.js");
|
|
4
5
|
const fallback_js_1 = require("../core/fallback.js");
|
|
5
6
|
/**
|
|
6
7
|
* Conversational chat powered by Nova's full AI pipeline.
|
|
@@ -68,6 +69,36 @@ class ChatResource {
|
|
|
68
69
|
async deleteSession(sessionId) {
|
|
69
70
|
return this.http.delete(`/chat/sessions/${sessionId}`);
|
|
70
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Stream chat events from /v1/chat/stream as they arrive.
|
|
74
|
+
*
|
|
75
|
+
* Yields a discriminated-union of events: `token` (per-token text),
|
|
76
|
+
* `pipeline` (per-step status), `design` / `document` / `pdf` /
|
|
77
|
+
* `pptx` / `pptx_visual` / `image` / `audio` (artifacts),
|
|
78
|
+
* `guardian` (credential redaction), and a final `done`.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* let full = '';
|
|
83
|
+
* for await (const ev of nova.chat.stream({ message: 'create a 10-slide deck for Acme AI' })) {
|
|
84
|
+
* switch (ev.type) {
|
|
85
|
+
* case 'token': full += ev.content; process.stdout.write(ev.content); break;
|
|
86
|
+
* case 'pdf': await fs.writeFile('deck.pdf', Buffer.from(ev.pdf_base64, 'base64')); break;
|
|
87
|
+
* case 'pptx': if (ev.variant === 'editable') {
|
|
88
|
+
* await fs.writeFile(ev.filename, Buffer.from(ev.pptx_base64, 'base64'));
|
|
89
|
+
* } break;
|
|
90
|
+
* case 'pptx_visual':
|
|
91
|
+
* await fs.writeFile(ev.filename, Buffer.from(ev.pptx_base64, 'base64')); break;
|
|
92
|
+
* case 'done': console.log(`\\nDone — ${ev.model_used}, ${ev.agents_used} agents`); break;
|
|
93
|
+
* }
|
|
94
|
+
* }
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
async *stream(params) {
|
|
98
|
+
for await (const raw of this.http.postStream('/chat/stream', params)) {
|
|
99
|
+
yield (0, chat_stream_js_1.parseChatEvent)(raw);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
71
102
|
}
|
|
72
103
|
exports.ChatResource = ChatResource;
|
|
73
104
|
//# sourceMappingURL=chat.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/resources/chat.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/resources/chat.ts"],"names":[],"mappings":";;;AASA,4DAAyD;AACzD,qDAAgF;AAEhF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAa,YAAY;IACN,IAAI,CAAa;IAElC,YAAY,IAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CAAC,MAAyB;QAClC,OAAO,IAAI,CAAC,IAAI,CAAC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|
1
|
+
import type { HttpClient } from '../core/http.js';
|
|
2
|
+
import type { FileUploadResponse } from '../types/files.js';
|
|
3
|
+
export interface FileUploadParams {
|
|
4
|
+
/** The file blob to upload (Browser File or a Buffer/Uint8Array on Node) */
|
|
5
|
+
content: Blob | Uint8Array;
|
|
6
|
+
/** Filename — used for extension-based type detection on the server */
|
|
7
|
+
filename: string;
|
|
8
|
+
/** Optional MIME type override */
|
|
9
|
+
contentType?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Existing chat session id. When omitted, the backend bootstraps a
|
|
12
|
+
* fresh session and returns its id — pass that id to subsequent
|
|
13
|
+
* chat calls to keep the conversation tied to the upload.
|
|
14
|
+
*/
|
|
15
|
+
sessionId?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Upload + manage chat attachments (.pptx, .pdf, .docx, images).
|
|
19
|
+
*
|
|
20
|
+
* Once uploaded, every chat / planner step in the same session sees the
|
|
21
|
+
* file's extracted text automatically. The deck_builder specialist edits
|
|
22
|
+
* .pptx files natively (preserving every untouched slide), the vision
|
|
23
|
+
* agent reads images, etc.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import { readFile } from 'node:fs/promises';
|
|
28
|
+
*
|
|
29
|
+
* const nova = new NovaClient({ apiKey: 'nova_xxx' });
|
|
30
|
+
*
|
|
31
|
+
* // Node: read the file from disk
|
|
32
|
+
* const bytes = await readFile('./my-deck.pptx');
|
|
33
|
+
* const result = await nova.files.upload({
|
|
34
|
+
* content: bytes,
|
|
35
|
+
* filename: 'my-deck.pptx',
|
|
36
|
+
* });
|
|
37
|
+
*
|
|
38
|
+
* // Now reference it in a chat turn — backend pulls extracted text
|
|
39
|
+
* // into the prompt automatically
|
|
40
|
+
* const reply = await nova.chat.send({
|
|
41
|
+
* message: "add a slide titled 'Why Choose Us' with three bullets",
|
|
42
|
+
* session_id: result.session_id,
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare class FilesResource {
|
|
47
|
+
private readonly http;
|
|
48
|
+
constructor(http: HttpClient);
|
|
49
|
+
/**
|
|
50
|
+
* Upload a file as an attachment on a chat session.
|
|
51
|
+
*
|
|
52
|
+
* Allowed types (server-enforced): .pptx, .pdf, .docx, .txt, .md,
|
|
53
|
+
* .csv, .html, .htm, .png, .jpg, .jpeg, .webp, .gif. Cap is 25MB.
|
|
54
|
+
*/
|
|
55
|
+
upload(params: FileUploadParams): Promise<FileUploadResponse>;
|
|
56
|
+
/** Detach + delete a file from its session and from backend storage. */
|
|
57
|
+
delete(fileId: string): Promise<void>;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/resources/files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,MAAM,WAAW,gBAAgB;IAC/B,4EAA4E;IAC5E,OAAO,EAAE,IAAI,GAAG,UAAU,CAAC;IAC3B,uEAAuE;IACvE,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;gBAEtB,IAAI,EAAE,UAAU;IAI5B;;;;;OAKG;IACG,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAUnE,wEAAwE;IAClE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG5C"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FilesResource = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Upload + manage chat attachments (.pptx, .pdf, .docx, images).
|
|
6
|
+
*
|
|
7
|
+
* Once uploaded, every chat / planner step in the same session sees the
|
|
8
|
+
* file's extracted text automatically. The deck_builder specialist edits
|
|
9
|
+
* .pptx files natively (preserving every untouched slide), the vision
|
|
10
|
+
* agent reads images, etc.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import { readFile } from 'node:fs/promises';
|
|
15
|
+
*
|
|
16
|
+
* const nova = new NovaClient({ apiKey: 'nova_xxx' });
|
|
17
|
+
*
|
|
18
|
+
* // Node: read the file from disk
|
|
19
|
+
* const bytes = await readFile('./my-deck.pptx');
|
|
20
|
+
* const result = await nova.files.upload({
|
|
21
|
+
* content: bytes,
|
|
22
|
+
* filename: 'my-deck.pptx',
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // Now reference it in a chat turn — backend pulls extracted text
|
|
26
|
+
* // into the prompt automatically
|
|
27
|
+
* const reply = await nova.chat.send({
|
|
28
|
+
* message: "add a slide titled 'Why Choose Us' with three bullets",
|
|
29
|
+
* session_id: result.session_id,
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
class FilesResource {
|
|
34
|
+
http;
|
|
35
|
+
constructor(http) {
|
|
36
|
+
this.http = http;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Upload a file as an attachment on a chat session.
|
|
40
|
+
*
|
|
41
|
+
* Allowed types (server-enforced): .pptx, .pdf, .docx, .txt, .md,
|
|
42
|
+
* .csv, .html, .htm, .png, .jpg, .jpeg, .webp, .gif. Cap is 25MB.
|
|
43
|
+
*/
|
|
44
|
+
async upload(params) {
|
|
45
|
+
const form = new FormData();
|
|
46
|
+
const blob = params.content instanceof Blob
|
|
47
|
+
? params.content
|
|
48
|
+
: new Blob([params.content], { type: params.contentType ?? 'application/octet-stream' });
|
|
49
|
+
form.append('file', blob, params.filename);
|
|
50
|
+
form.append('session_id', params.sessionId ?? '');
|
|
51
|
+
return this.http.postMultipart('/files/upload', form);
|
|
52
|
+
}
|
|
53
|
+
/** Detach + delete a file from its session and from backend storage. */
|
|
54
|
+
async delete(fileId) {
|
|
55
|
+
await this.http.delete(`/files/${fileId}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.FilesResource = FilesResource;
|
|
59
|
+
//# sourceMappingURL=files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/resources/files.ts"],"names":[],"mappings":";;;AAkBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAa,aAAa;IACP,IAAI,CAAa;IAElC,YAAY,IAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CAAC,MAAwB;QACnC,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC5B,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,YAAY,IAAI;YACzC,CAAC,CAAC,MAAM,CAAC,OAAO;YAChB,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,CAAC,OAAqB,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,WAAW,IAAI,0BAA0B,EAAE,CAAC,CAAC;QACzG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC3C,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,CAAqB,eAAe,EAAE,IAAI,CAAC,CAAC;IAC5E,CAAC;IAED,wEAAwE;IACxE,KAAK,CAAC,MAAM,CAAC,MAAc;QACzB,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,MAAM,EAAE,CAAC,CAAC;IAC7C,CAAC;CACF;AA3BD,sCA2BC"}
|
|
@@ -4,7 +4,14 @@ import type { AgentRunResult } from '../types/agents.js';
|
|
|
4
4
|
export declare class HistoryResource {
|
|
5
5
|
private readonly http;
|
|
6
6
|
constructor(http: HttpClient);
|
|
7
|
-
/** List history entries with optional filters.
|
|
7
|
+
/** List history entries with optional filters.
|
|
8
|
+
*
|
|
9
|
+
* The server returns a paginated envelope `{total, page, per_page, entries}`,
|
|
10
|
+
* not a bare array. Older versions of this SDK declared the return type as
|
|
11
|
+
* `HistoryEntry[]` and downstream code that did `for (const e of data)`
|
|
12
|
+
* iterated nothing useful. Now we unwrap `entries` if present and still
|
|
13
|
+
* tolerate a bare-array response from older API builds.
|
|
14
|
+
*/
|
|
8
15
|
list(params?: HistoryQueryParams): Promise<HistoryEntry[]>;
|
|
9
16
|
/** Get a single history entry by ID. */
|
|
10
17
|
get(id: string): Promise<HistoryEntry>;
|
|
@@ -14,6 +21,31 @@ export declare class HistoryResource {
|
|
|
14
21
|
replay(id: string): Promise<AgentRunResult>;
|
|
15
22
|
/** Get aggregated history statistics. */
|
|
16
23
|
stats(): Promise<HistoryStats>;
|
|
24
|
+
/** Approve the action linked to a history entry (status='approval_needed').
|
|
25
|
+
*
|
|
26
|
+
* Returns the executed approval result. Throws NovaAPIError 404 with
|
|
27
|
+
* code='no_approval' when the entry doesn't have a paired pending
|
|
28
|
+
* approval (already decided, or never required one).
|
|
29
|
+
*/
|
|
30
|
+
approve(entryId: string, opts?: {
|
|
31
|
+
note?: string;
|
|
32
|
+
}): Promise<unknown>;
|
|
33
|
+
/** Reject the action linked to a history entry. Same shape as approve(). */
|
|
34
|
+
reject(entryId: string, opts?: {
|
|
35
|
+
note?: string;
|
|
36
|
+
}): Promise<unknown>;
|
|
37
|
+
/** Get the approval state for a history entry.
|
|
38
|
+
*
|
|
39
|
+
* Returns `{status, approval, history_id}`. `status` is one of:
|
|
40
|
+
* 'pending' | 'approved' | 'rejected' | 'expired' | 'not_required'
|
|
41
|
+
* `not_required` means the entry never had a paired approval —
|
|
42
|
+
* useful to disambiguate from a missing entry (which would be 404).
|
|
43
|
+
*/
|
|
44
|
+
approvalStatus(entryId: string): Promise<{
|
|
45
|
+
status: 'pending' | 'approved' | 'rejected' | 'expired' | 'not_required';
|
|
46
|
+
approval: Record<string, unknown> | null;
|
|
47
|
+
history_id: string;
|
|
48
|
+
}>;
|
|
17
49
|
/** Export history entries (same filters as list, returns raw array). */
|
|
18
50
|
export(params?: HistoryExportParams): Promise<HistoryEntry[]>;
|
|
19
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/resources/history.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;gBAEtB,IAAI,EAAE,UAAU;IAI5B
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/resources/history.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,qBAAa,eAAe;I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
|
}
|
|
9
|
-
/** List history entries with optional filters.
|
|
9
|
+
/** List history entries with optional filters.
|
|
10
|
+
*
|
|
11
|
+
* The server returns a paginated envelope `{total, page, per_page, entries}`,
|
|
12
|
+
* not a bare array. Older versions of this SDK declared the return type as
|
|
13
|
+
* `HistoryEntry[]` and downstream code that did `for (const e of data)`
|
|
14
|
+
* iterated nothing useful. Now we unwrap `entries` if present and still
|
|
15
|
+
* tolerate a bare-array response from older API builds.
|
|
16
|
+
*/
|
|
10
17
|
async list(params) {
|
|
11
|
-
|
|
18
|
+
const data = await this.http.get('/history', params);
|
|
19
|
+
if (Array.isArray(data))
|
|
20
|
+
return data;
|
|
21
|
+
return data?.entries ?? [];
|
|
12
22
|
}
|
|
13
23
|
/** Get a single history entry by ID. */
|
|
14
24
|
async get(id) {
|
|
@@ -26,9 +36,39 @@ class HistoryResource {
|
|
|
26
36
|
async stats() {
|
|
27
37
|
return this.http.get('/history/stats');
|
|
28
38
|
}
|
|
39
|
+
/** Approve the action linked to a history entry (status='approval_needed').
|
|
40
|
+
*
|
|
41
|
+
* Returns the executed approval result. Throws NovaAPIError 404 with
|
|
42
|
+
* code='no_approval' when the entry doesn't have a paired pending
|
|
43
|
+
* approval (already decided, or never required one).
|
|
44
|
+
*/
|
|
45
|
+
async approve(entryId, opts) {
|
|
46
|
+
return this.http.post(`/history/${encodeURIComponent(entryId)}/approve`, {
|
|
47
|
+
note: opts?.note ?? null,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/** Reject the action linked to a history entry. Same shape as approve(). */
|
|
51
|
+
async reject(entryId, opts) {
|
|
52
|
+
return this.http.post(`/history/${encodeURIComponent(entryId)}/reject`, {
|
|
53
|
+
note: opts?.note ?? null,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/** Get the approval state for a history entry.
|
|
57
|
+
*
|
|
58
|
+
* Returns `{status, approval, history_id}`. `status` is one of:
|
|
59
|
+
* 'pending' | 'approved' | 'rejected' | 'expired' | 'not_required'
|
|
60
|
+
* `not_required` means the entry never had a paired approval —
|
|
61
|
+
* useful to disambiguate from a missing entry (which would be 404).
|
|
62
|
+
*/
|
|
63
|
+
async approvalStatus(entryId) {
|
|
64
|
+
return this.http.get(`/history/${encodeURIComponent(entryId)}/approval-status`);
|
|
65
|
+
}
|
|
29
66
|
/** Export history entries (same filters as list, returns raw array). */
|
|
30
67
|
async export(params) {
|
|
31
|
-
|
|
68
|
+
const data = await this.http.get('/history/export', params);
|
|
69
|
+
if (Array.isArray(data))
|
|
70
|
+
return data;
|
|
71
|
+
return data?.entries ?? [];
|
|
32
72
|
}
|
|
33
73
|
}
|
|
34
74
|
exports.HistoryResource = HistoryResource;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/resources/history.ts"],"names":[],"mappings":";;;AAUA,MAAa,eAAe;IACT,IAAI,CAAa;IAElC,YAAY,IAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/resources/history.ts"],"names":[],"mappings":";;;AAUA,MAAa,eAAe;IACT,IAAI,CAAa;IAElC,YAAY,IAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,IAAI,CAAC,MAA2B;QACpC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAC9B,UAAU,EACV,MAA+D,CAChE,CAAC;QACF,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QACrC,OAAO,IAAI,EAAE,OAAO,IAAI,EAAE,CAAC;IAC7B,CAAC;IAED,wCAAwC;IACxC,KAAK,CAAC,GAAG,CAAC,EAAU;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAe,YAAY,EAAE,EAAE,CAAC,CA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C,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QACrC,OAAO,IAAI,EAAE,OAAO,IAAI,EAAE,CAAC;IAC7B,CAAC;CACF;AAvFD,0CAuFC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { HttpClient } from '../core/http.js';
|
|
2
|
+
import type { AgentList, Plan, PlanCreateRequest, PlanList } from '../types/planner.js';
|
|
3
|
+
/**
|
|
4
|
+
* Decompose a goal into a DAG and run each step against the right specialist.
|
|
5
|
+
*
|
|
6
|
+
* Take a plain-English goal, decompose it into a DAG of specialist steps,
|
|
7
|
+
* execute. Each step's full artifact (deck HTML, document body, image URL)
|
|
8
|
+
* is returned in `result_full` so callers can render or download.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const nova = new NovaClient({ apiKey: 'nova_xxx' });
|
|
13
|
+
*
|
|
14
|
+
* // Decompose a goal into a plan
|
|
15
|
+
* const plan = await nova.planner.create({
|
|
16
|
+
* goal: 'Build a marketing plan for Acme AI and a 10-slide deck for the seed pitch',
|
|
17
|
+
* });
|
|
18
|
+
* for (const step of plan.steps) {
|
|
19
|
+
* console.log(`${step.agent}: ${step.action}`);
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
* // Kick off execution
|
|
23
|
+
* await nova.planner.execute(plan.id);
|
|
24
|
+
*
|
|
25
|
+
* // Poll until done
|
|
26
|
+
* let current: Plan;
|
|
27
|
+
* while (true) {
|
|
28
|
+
* current = await nova.planner.get(plan.id);
|
|
29
|
+
* if (['done', 'failed', 'cancelled'].includes(current.status)) break;
|
|
30
|
+
* await new Promise((r) => setTimeout(r, 2000));
|
|
31
|
+
* }
|
|
32
|
+
*
|
|
33
|
+
* // Read each step's full output
|
|
34
|
+
* for (const step of current.steps) {
|
|
35
|
+
* if (step.result_full) {
|
|
36
|
+
* // e.g. deck HTML — render or persist
|
|
37
|
+
* }
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare class PlannerResource {
|
|
42
|
+
private readonly http;
|
|
43
|
+
constructor(http: HttpClient);
|
|
44
|
+
/** Every specialist the planner can call (registry-backed). */
|
|
45
|
+
listAgents(): Promise<AgentList>;
|
|
46
|
+
/**
|
|
47
|
+
* Decompose a goal into a plan. Doesn't execute — call `execute()` next.
|
|
48
|
+
*
|
|
49
|
+
* When `use_memory` is true (default), the planner pulls relevant memory
|
|
50
|
+
* snippets to inform decomposition (e.g. user's tone, prior product names).
|
|
51
|
+
*/
|
|
52
|
+
create(params: PlanCreateRequest): Promise<Plan>;
|
|
53
|
+
/** List the caller's plans (newest first). */
|
|
54
|
+
listPlans(): Promise<PlanList>;
|
|
55
|
+
/**
|
|
56
|
+
* Read a plan by id, including current step statuses + result_full bodies.
|
|
57
|
+
* Use this to poll while a plan is executing.
|
|
58
|
+
*/
|
|
59
|
+
get(planId: string): Promise<Plan>;
|
|
60
|
+
/**
|
|
61
|
+
* Kick off execution. Returns immediately with status flipped to "running";
|
|
62
|
+
* steps execute in the background. Poll `get(planId)` for progress.
|
|
63
|
+
*/
|
|
64
|
+
execute(planId: string): Promise<Plan>;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=planner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner.d.ts","sourceRoot":"","sources":["../../src/resources/planner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EACV,SAAS,EACT,IAAI,EACJ,iBAAiB,EACjB,QAAQ,EACT,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;gBAEtB,IAAI,EAAE,UAAU;IAI5B,+DAA+D;IACzD,UAAU,IAAI,OAAO,CAAC,SAAS,CAAC;IAItC;;;;;OAKG;IACG,MAAM,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAItD,8CAA8C;IACxC,SAAS,IAAI,OAAO,CAAC,QAAQ,CAAC;IAIpC;;;OAGG;IACG,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxC;;;OAGG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG7C"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlannerResource = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Decompose a goal into a DAG and run each step against the right specialist.
|
|
6
|
+
*
|
|
7
|
+
* Take a plain-English goal, decompose it into a DAG of specialist steps,
|
|
8
|
+
* execute. Each step's full artifact (deck HTML, document body, image URL)
|
|
9
|
+
* is returned in `result_full` so callers can render or download.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const nova = new NovaClient({ apiKey: 'nova_xxx' });
|
|
14
|
+
*
|
|
15
|
+
* // Decompose a goal into a plan
|
|
16
|
+
* const plan = await nova.planner.create({
|
|
17
|
+
* goal: 'Build a marketing plan for Acme AI and a 10-slide deck for the seed pitch',
|
|
18
|
+
* });
|
|
19
|
+
* for (const step of plan.steps) {
|
|
20
|
+
* console.log(`${step.agent}: ${step.action}`);
|
|
21
|
+
* }
|
|
22
|
+
*
|
|
23
|
+
* // Kick off execution
|
|
24
|
+
* await nova.planner.execute(plan.id);
|
|
25
|
+
*
|
|
26
|
+
* // Poll until done
|
|
27
|
+
* let current: Plan;
|
|
28
|
+
* while (true) {
|
|
29
|
+
* current = await nova.planner.get(plan.id);
|
|
30
|
+
* if (['done', 'failed', 'cancelled'].includes(current.status)) break;
|
|
31
|
+
* await new Promise((r) => setTimeout(r, 2000));
|
|
32
|
+
* }
|
|
33
|
+
*
|
|
34
|
+
* // Read each step's full output
|
|
35
|
+
* for (const step of current.steps) {
|
|
36
|
+
* if (step.result_full) {
|
|
37
|
+
* // e.g. deck HTML — render or persist
|
|
38
|
+
* }
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
class PlannerResource {
|
|
43
|
+
http;
|
|
44
|
+
constructor(http) {
|
|
45
|
+
this.http = http;
|
|
46
|
+
}
|
|
47
|
+
/** Every specialist the planner can call (registry-backed). */
|
|
48
|
+
async listAgents() {
|
|
49
|
+
return this.http.get('/planner/agents');
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Decompose a goal into a plan. Doesn't execute — call `execute()` next.
|
|
53
|
+
*
|
|
54
|
+
* When `use_memory` is true (default), the planner pulls relevant memory
|
|
55
|
+
* snippets to inform decomposition (e.g. user's tone, prior product names).
|
|
56
|
+
*/
|
|
57
|
+
async create(params) {
|
|
58
|
+
return this.http.post('/planner/plan', params);
|
|
59
|
+
}
|
|
60
|
+
/** List the caller's plans (newest first). */
|
|
61
|
+
async listPlans() {
|
|
62
|
+
return this.http.get('/planner/plans');
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Read a plan by id, including current step statuses + result_full bodies.
|
|
66
|
+
* Use this to poll while a plan is executing.
|
|
67
|
+
*/
|
|
68
|
+
async get(planId) {
|
|
69
|
+
return this.http.get(`/planner/plans/${planId}`);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Kick off execution. Returns immediately with status flipped to "running";
|
|
73
|
+
* steps execute in the background. Poll `get(planId)` for progress.
|
|
74
|
+
*/
|
|
75
|
+
async execute(planId) {
|
|
76
|
+
return this.http.post(`/planner/plans/${planId}/execute`, {});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.PlannerResource = PlannerResource;
|
|
80
|
+
//# sourceMappingURL=planner.js.map
|