@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 @@
|
|
|
1
|
+
{"version":3,"file":"planner.js","sourceRoot":"","sources":["../../src/resources/planner.ts"],"names":[],"mappings":";;;AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAa,eAAe;IACT,IAAI,CAAa;IAElC,YAAY,IAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,+DAA+D;IAC/D,KAAK,CAAC,UAAU;QACd,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAY,iBAAiB,CAAC,CAAC;IACrD,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CAAC,MAAyB;QACpC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAO,eAAe,EAAE,MAAM,CAAC,CAAC;IACvD,CAAC;IAED,8CAA8C;IAC9C,KAAK,CAAC,SAAS;QACb,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAW,gBAAgB,CAAC,CAAC;IACnD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,GAAG,CAAC,MAAc;QACtB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAO,kBAAkB,MAAM,EAAE,CAAC,CAAC;IACzD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,OAAO,CAAC,MAAc;QAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAO,kBAAkB,MAAM,UAAU,EAAE,EAAE,CAAC,CAAC;IACtE,CAAC;CACF;AA1CD,0CA0CC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { HttpClient } from '../core/http.js';
|
|
2
|
+
import type { ApplyFixResponse, ProposeFixResponse, RepairCase, RepairCaseListResponse } from '../types/repair.js';
|
|
3
|
+
/**
|
|
4
|
+
* Read + drive the Repair Agent's case queue.
|
|
5
|
+
*
|
|
6
|
+
* The Repair Agent self-diagnoses chat-pipeline failures and can open
|
|
7
|
+
* autonomous draft PRs via the GitHub REST API. Four phases:
|
|
8
|
+
*
|
|
9
|
+
* R1 narrative diagnosis (Sonnet writes 4-section markdown)
|
|
10
|
+
* R2 tool-using diagnosis (the agent reads files, greps the codebase)
|
|
11
|
+
* R3 propose a unified-diff fix
|
|
12
|
+
* R4 apply the fix as a GitHub draft PR
|
|
13
|
+
*
|
|
14
|
+
* Most callers only need to *read* cases (list + detail). Triggering R3/R4
|
|
15
|
+
* is reserved for operators / dashboard UI.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const nova = new NovaClient({ apiKey: 'nova_xxx' });
|
|
20
|
+
*
|
|
21
|
+
* // List recent cases
|
|
22
|
+
* const list = await nova.repair.listCases(10);
|
|
23
|
+
* for (const caseDict of list.cases) {
|
|
24
|
+
* console.log(caseDict.case_id, caseDict.error_class);
|
|
25
|
+
* }
|
|
26
|
+
*
|
|
27
|
+
* // Drill into one case
|
|
28
|
+
* const c = await nova.repair.getCase('case_abc');
|
|
29
|
+
* console.log((c.diagnosis_md ?? '').slice(0, 500));
|
|
30
|
+
*
|
|
31
|
+
* // R3 — propose a fix
|
|
32
|
+
* const proposal = await nova.repair.proposeFix('case_abc');
|
|
33
|
+
* if (!proposal.no_fix_proposed) console.log(proposal.fix_md);
|
|
34
|
+
*
|
|
35
|
+
* // R4 — open autonomous PR (requires GITHUB_AUTOFIX_TOKEN on the API)
|
|
36
|
+
* const applied = await nova.repair.applyFix('case_abc');
|
|
37
|
+
* if (applied.ok) console.log('Draft PR:', applied.pr_url);
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare class RepairResource {
|
|
41
|
+
private readonly http;
|
|
42
|
+
constructor(http: HttpClient);
|
|
43
|
+
/**
|
|
44
|
+
* Return the most recent repair cases (newest first). Each entry
|
|
45
|
+
* includes the failure context, markdown diagnosis, chosen action,
|
|
46
|
+
* and whether the case was escalated.
|
|
47
|
+
*/
|
|
48
|
+
listCases(limit?: number): Promise<RepairCaseListResponse>;
|
|
49
|
+
/**
|
|
50
|
+
* Full detail for one case.
|
|
51
|
+
*
|
|
52
|
+
* Includes the traceback head, attachments summary, pipeline tail,
|
|
53
|
+
* any R1 diagnosis, and any R3 fix proposal that's been generated.
|
|
54
|
+
*/
|
|
55
|
+
getCase(caseId: string): Promise<RepairCase>;
|
|
56
|
+
/**
|
|
57
|
+
* R3 — re-run the propose_fix Claude tool loop on an already-
|
|
58
|
+
* diagnosed case. Returns markdown describing the proposed unified
|
|
59
|
+
* diff (or `no_fix_proposed: true` when the agent isn't confident in
|
|
60
|
+
* any fix).
|
|
61
|
+
*/
|
|
62
|
+
proposeFix(caseId: string): Promise<ProposeFixResponse>;
|
|
63
|
+
/**
|
|
64
|
+
* R4 — open an autonomous draft PR for the case's proposed fix.
|
|
65
|
+
*
|
|
66
|
+
* Requires `GITHUB_AUTOFIX_TOKEN` to be set on the API container (via
|
|
67
|
+
* Secrets Manager). When the token is missing the call returns 503
|
|
68
|
+
* with `code: autofix_disabled` — your HttpClient will surface this
|
|
69
|
+
* as a NovaAPIError.
|
|
70
|
+
*/
|
|
71
|
+
applyFix(caseId: string): Promise<ApplyFixResponse>;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=repair.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repair.d.ts","sourceRoot":"","sources":["../../src/resources/repair.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,EACV,sBAAsB,EACvB,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;gBAEtB,IAAI,EAAE,UAAU;IAI5B;;;;OAIG;IACG,SAAS,CAAC,KAAK,GAAE,MAAW,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAMpE;;;;;OAKG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAmBlD;;;;;OAKG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAO7D;;;;;;;OAOG;IACG,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAM1D"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RepairResource = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Read + drive the Repair Agent's case queue.
|
|
6
|
+
*
|
|
7
|
+
* The Repair Agent self-diagnoses chat-pipeline failures and can open
|
|
8
|
+
* autonomous draft PRs via the GitHub REST API. Four phases:
|
|
9
|
+
*
|
|
10
|
+
* R1 narrative diagnosis (Sonnet writes 4-section markdown)
|
|
11
|
+
* R2 tool-using diagnosis (the agent reads files, greps the codebase)
|
|
12
|
+
* R3 propose a unified-diff fix
|
|
13
|
+
* R4 apply the fix as a GitHub draft PR
|
|
14
|
+
*
|
|
15
|
+
* Most callers only need to *read* cases (list + detail). Triggering R3/R4
|
|
16
|
+
* is reserved for operators / dashboard UI.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const nova = new NovaClient({ apiKey: 'nova_xxx' });
|
|
21
|
+
*
|
|
22
|
+
* // List recent cases
|
|
23
|
+
* const list = await nova.repair.listCases(10);
|
|
24
|
+
* for (const caseDict of list.cases) {
|
|
25
|
+
* console.log(caseDict.case_id, caseDict.error_class);
|
|
26
|
+
* }
|
|
27
|
+
*
|
|
28
|
+
* // Drill into one case
|
|
29
|
+
* const c = await nova.repair.getCase('case_abc');
|
|
30
|
+
* console.log((c.diagnosis_md ?? '').slice(0, 500));
|
|
31
|
+
*
|
|
32
|
+
* // R3 — propose a fix
|
|
33
|
+
* const proposal = await nova.repair.proposeFix('case_abc');
|
|
34
|
+
* if (!proposal.no_fix_proposed) console.log(proposal.fix_md);
|
|
35
|
+
*
|
|
36
|
+
* // R4 — open autonomous PR (requires GITHUB_AUTOFIX_TOKEN on the API)
|
|
37
|
+
* const applied = await nova.repair.applyFix('case_abc');
|
|
38
|
+
* if (applied.ok) console.log('Draft PR:', applied.pr_url);
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
class RepairResource {
|
|
42
|
+
http;
|
|
43
|
+
constructor(http) {
|
|
44
|
+
this.http = http;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Return the most recent repair cases (newest first). Each entry
|
|
48
|
+
* includes the failure context, markdown diagnosis, chosen action,
|
|
49
|
+
* and whether the case was escalated.
|
|
50
|
+
*/
|
|
51
|
+
async listCases(limit = 50) {
|
|
52
|
+
return this.http.get(`/repair/cases?limit=${Math.max(1, Math.min(Math.floor(limit), 200))}`);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Full detail for one case.
|
|
56
|
+
*
|
|
57
|
+
* Includes the traceback head, attachments summary, pipeline tail,
|
|
58
|
+
* any R1 diagnosis, and any R3 fix proposal that's been generated.
|
|
59
|
+
*/
|
|
60
|
+
async getCase(caseId) {
|
|
61
|
+
const data = await this.http.get(`/repair/cases/${caseId}`);
|
|
62
|
+
return {
|
|
63
|
+
case_id: data.case_id ?? caseId,
|
|
64
|
+
agent_id: data.agent_id ?? null,
|
|
65
|
+
task_id: data.task_id ?? null,
|
|
66
|
+
error_class: data.error_class ?? null,
|
|
67
|
+
error_message: data.error_message ?? null,
|
|
68
|
+
traceback_head: data.traceback_head ?? null,
|
|
69
|
+
pipeline_tail: data.pipeline_tail ?? null,
|
|
70
|
+
diagnosis_md: data.diagnosis_md ?? null,
|
|
71
|
+
fix_md: data.fix_md ?? null,
|
|
72
|
+
pr_url: data.pr_url ?? null,
|
|
73
|
+
status: data.status ?? '',
|
|
74
|
+
created_at: data.created_at ?? 0,
|
|
75
|
+
raw: data,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* R3 — re-run the propose_fix Claude tool loop on an already-
|
|
80
|
+
* diagnosed case. Returns markdown describing the proposed unified
|
|
81
|
+
* diff (or `no_fix_proposed: true` when the agent isn't confident in
|
|
82
|
+
* any fix).
|
|
83
|
+
*/
|
|
84
|
+
async proposeFix(caseId) {
|
|
85
|
+
return this.http.post(`/repair/cases/${caseId}/propose-fix`, {});
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* R4 — open an autonomous draft PR for the case's proposed fix.
|
|
89
|
+
*
|
|
90
|
+
* Requires `GITHUB_AUTOFIX_TOKEN` to be set on the API container (via
|
|
91
|
+
* Secrets Manager). When the token is missing the call returns 503
|
|
92
|
+
* with `code: autofix_disabled` — your HttpClient will surface this
|
|
93
|
+
* as a NovaAPIError.
|
|
94
|
+
*/
|
|
95
|
+
async applyFix(caseId) {
|
|
96
|
+
return this.http.post(`/repair/cases/${caseId}/apply-fix`, {});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.RepairResource = RepairResource;
|
|
100
|
+
//# sourceMappingURL=repair.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repair.js","sourceRoot":"","sources":["../../src/resources/repair.ts"],"names":[],"mappings":";;;AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAa,cAAc;IACR,IAAI,CAAa;IAElC,YAAY,IAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,SAAS,CAAC,QAAgB,EAAE;QAChC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAClB,uBAAuB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CACvE,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,OAAO,CAAC,MAAc;QAC1B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAsB,iBAAiB,MAAM,EAAE,CAAC,CAAC;QACjF,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,MAAM;YAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI;YAC/B,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,IAAI;YAC7B,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,IAAI;YACrC,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,IAAI;YACzC,cAAc,EAAE,IAAI,CAAC,cAAc,IAAI,IAAI;YAC3C,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,IAAI;YACzC,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,IAAI;YACvC,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,IAAI;YAC3B,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,IAAI;YAC3B,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,EAAE;YACzB,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,CAAC;YAChC,GAAG,EAAE,IAAI;SACV,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,UAAU,CAAC,MAAc;QAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CACnB,iBAAiB,MAAM,cAAc,EACrC,EAAE,CACH,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,QAAQ,CAAC,MAAc;QAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CACnB,iBAAiB,MAAM,YAAY,EACnC,EAAE,CACH,CAAC;IACJ,CAAC;CACF;AAtED,wCAsEC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { HttpClient } from '../core/http.js';
|
|
2
|
+
import type { TranscribeResponse } from '../types/voice.js';
|
|
3
|
+
export interface TranscribeParams {
|
|
4
|
+
/** The audio blob to transcribe (browser File / Blob / Node Buffer / Uint8Array) */
|
|
5
|
+
content: Blob | Uint8Array;
|
|
6
|
+
/** Filename — used for extension-based MIME detection if contentType isn't set */
|
|
7
|
+
filename: string;
|
|
8
|
+
/** Optional MIME type override */
|
|
9
|
+
contentType?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Speech-to-text via Whisper (V1).
|
|
13
|
+
*
|
|
14
|
+
* Audio is NOT persisted server-side — only the transcript text is
|
|
15
|
+
* retained downstream (typically in chat history when the user submits
|
|
16
|
+
* the resulting message).
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* // Browser
|
|
21
|
+
* const blob = audioRecorder.stop();
|
|
22
|
+
* const result = await nova.voice.transcribe({
|
|
23
|
+
* content: blob,
|
|
24
|
+
* filename: 'recording.webm',
|
|
25
|
+
* contentType: 'audio/webm',
|
|
26
|
+
* });
|
|
27
|
+
* if (result.error) {
|
|
28
|
+
* showToast(`Transcription failed: ${result.error}`);
|
|
29
|
+
* } else {
|
|
30
|
+
* composer.value = result.text;
|
|
31
|
+
* }
|
|
32
|
+
*
|
|
33
|
+
* // Node
|
|
34
|
+
* import { readFile } from 'node:fs/promises';
|
|
35
|
+
* const bytes = await readFile('./recording.webm');
|
|
36
|
+
* const result = await nova.voice.transcribe({
|
|
37
|
+
* content: bytes,
|
|
38
|
+
* filename: 'recording.webm',
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare class VoiceResource {
|
|
43
|
+
private readonly http;
|
|
44
|
+
constructor(http: HttpClient);
|
|
45
|
+
transcribe(params: TranscribeParams): Promise<TranscribeResponse>;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=voice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voice.d.ts","sourceRoot":"","sources":["../../src/resources/voice.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,oFAAoF;IACpF,OAAO,EAAE,IAAI,GAAG,UAAU,CAAC;IAC3B,kFAAkF;IAClF,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;gBAEtB,IAAI,EAAE,UAAU;IAItB,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CASxE"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VoiceResource = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Speech-to-text via Whisper (V1).
|
|
6
|
+
*
|
|
7
|
+
* Audio is NOT persisted server-side — only the transcript text is
|
|
8
|
+
* retained downstream (typically in chat history when the user submits
|
|
9
|
+
* the resulting message).
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Browser
|
|
14
|
+
* const blob = audioRecorder.stop();
|
|
15
|
+
* const result = await nova.voice.transcribe({
|
|
16
|
+
* content: blob,
|
|
17
|
+
* filename: 'recording.webm',
|
|
18
|
+
* contentType: 'audio/webm',
|
|
19
|
+
* });
|
|
20
|
+
* if (result.error) {
|
|
21
|
+
* showToast(`Transcription failed: ${result.error}`);
|
|
22
|
+
* } else {
|
|
23
|
+
* composer.value = result.text;
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
26
|
+
* // Node
|
|
27
|
+
* import { readFile } from 'node:fs/promises';
|
|
28
|
+
* const bytes = await readFile('./recording.webm');
|
|
29
|
+
* const result = await nova.voice.transcribe({
|
|
30
|
+
* content: bytes,
|
|
31
|
+
* filename: 'recording.webm',
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
class VoiceResource {
|
|
36
|
+
http;
|
|
37
|
+
constructor(http) {
|
|
38
|
+
this.http = http;
|
|
39
|
+
}
|
|
40
|
+
async transcribe(params) {
|
|
41
|
+
const form = new FormData();
|
|
42
|
+
const ctype = params.contentType ?? guessAudioMime(params.filename);
|
|
43
|
+
const blob = params.content instanceof Blob
|
|
44
|
+
? params.content
|
|
45
|
+
: new Blob([params.content], { type: ctype });
|
|
46
|
+
form.append('file', blob, params.filename);
|
|
47
|
+
return this.http.postMultipart('/voice/transcribe', form);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.VoiceResource = VoiceResource;
|
|
51
|
+
function guessAudioMime(filename) {
|
|
52
|
+
const dot = filename.lastIndexOf('.');
|
|
53
|
+
const ext = dot >= 0 ? filename.slice(dot + 1).toLowerCase() : '';
|
|
54
|
+
const map = {
|
|
55
|
+
webm: 'audio/webm',
|
|
56
|
+
mp4: 'audio/mp4',
|
|
57
|
+
m4a: 'audio/m4a',
|
|
58
|
+
mp3: 'audio/mpeg',
|
|
59
|
+
wav: 'audio/wav',
|
|
60
|
+
ogg: 'audio/ogg',
|
|
61
|
+
};
|
|
62
|
+
return map[ext] ?? 'application/octet-stream';
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=voice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voice.js","sourceRoot":"","sources":["../../src/resources/voice.ts"],"names":[],"mappings":";;;AAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAa,aAAa;IACP,IAAI,CAAa;IAElC,YAAY,IAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,MAAwB;QACvC,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC5B,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,IAAI,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACpE,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,KAAK,EAAE,CAAC,CAAC;QAC9D,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,CAAqB,mBAAmB,EAAE,IAAI,CAAC,CAAC;IAChF,CAAC;CACF;AAhBD,sCAgBC;AAED,SAAS,cAAc,CAAC,QAAgB;IACtC,MAAM,GAAG,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACtC,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAClE,MAAM,GAAG,GAA2B;QAClC,IAAI,EAAE,YAAY;QAClB,GAAG,EAAE,WAAW;QAChB,GAAG,EAAE,WAAW;QAChB,GAAG,EAAE,YAAY;QACjB,GAAG,EAAE,WAAW;QAChB,GAAG,EAAE,WAAW;KACjB,CAAC;IACF,OAAO,GAAG,CAAC,GAAG,CAAC,IAAI,0BAA0B,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for Nova's Auto-Agent API.
|
|
3
|
+
*
|
|
4
|
+
* Auto-Agent synthesizes a fit-for-purpose specialist on demand. When
|
|
5
|
+
* the user's request doesn't fit any registered specialist, Haiku drafts
|
|
6
|
+
* a fresh system prompt + capabilities for the task and runs it.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Request body for /v1/auto-agent/synthesize and /v1/auto-agent/run.
|
|
10
|
+
*/
|
|
11
|
+
export interface AutoAgentRequest {
|
|
12
|
+
/** The user's request — synthesizer reads this to invent a specialist */
|
|
13
|
+
message: string;
|
|
14
|
+
/**
|
|
15
|
+
* Optional last few chat turns ([{role, content}, ...]) for context.
|
|
16
|
+
* When provided, the synthesized agent sees them as conversation history.
|
|
17
|
+
*/
|
|
18
|
+
history?: Array<{
|
|
19
|
+
role: string;
|
|
20
|
+
content: string;
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The synthesized specialist spec.
|
|
25
|
+
*
|
|
26
|
+
* Save this into nova_custom_agents to make a one-off into a reusable
|
|
27
|
+
* specialist; otherwise it's ephemeral (lives for one turn).
|
|
28
|
+
*/
|
|
29
|
+
export interface AutoAgentSpec {
|
|
30
|
+
/** Lowercase slug, max 30 chars */
|
|
31
|
+
name: string;
|
|
32
|
+
/** Title-case, max 40 chars */
|
|
33
|
+
display_name: string;
|
|
34
|
+
/** One sentence — what this agent does */
|
|
35
|
+
description: string;
|
|
36
|
+
/** Full system message used when running the agent */
|
|
37
|
+
system_prompt: string;
|
|
38
|
+
/** Verb phrases describing what it can do */
|
|
39
|
+
capabilities: string[];
|
|
40
|
+
/** Synth's self-rated fit, 0.0 to 1.0. Below 0.45 = fall back to chat */
|
|
41
|
+
confidence: number;
|
|
42
|
+
/** One sentence — why these choices fit */
|
|
43
|
+
rationale: string;
|
|
44
|
+
/** False when synthesis fell back to a generic stub (no API key, parse error) */
|
|
45
|
+
used_llm: boolean;
|
|
46
|
+
}
|
|
47
|
+
/** Response from /v1/auto-agent/synthesize — spec only, no execution. */
|
|
48
|
+
export interface AutoAgentSynthesizeResponse {
|
|
49
|
+
spec: AutoAgentSpec;
|
|
50
|
+
}
|
|
51
|
+
/** Response from /v1/auto-agent/run — spec + executed reply. */
|
|
52
|
+
export interface AutoAgentRunResponse {
|
|
53
|
+
spec: AutoAgentSpec;
|
|
54
|
+
/** The synthesized agent's reply to the user's message */
|
|
55
|
+
response: string;
|
|
56
|
+
/** False when run path fell back to a stub reply */
|
|
57
|
+
used_llm: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Set when the run hit a recoverable error (e.g. 'no_api_key', 'http_429').
|
|
60
|
+
* The `response` field will still carry a usable stub.
|
|
61
|
+
*/
|
|
62
|
+
error: string | null;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=auto-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-agent.d.ts","sourceRoot":"","sources":["../../src/types/auto-agent.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpD;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,aAAa,EAAE,MAAM,CAAC;IACtB,6CAA6C;IAC7C,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,yEAAyE;IACzE,UAAU,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,yEAAyE;AACzE,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,gEAAgE;AAChE,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,aAAa,CAAC;IACpB,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAC;IACjB,oDAAoD;IACpD,QAAQ,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Types for Nova's Auto-Agent API.
|
|
4
|
+
*
|
|
5
|
+
* Auto-Agent synthesizes a fit-for-purpose specialist on demand. When
|
|
6
|
+
* the user's request doesn't fit any registered specialist, Haiku drafts
|
|
7
|
+
* a fresh system prompt + capabilities for the task and runs it.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
//# sourceMappingURL=auto-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-agent.js","sourceRoot":"","sources":["../../src/types/auto-agent.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG"}
|
package/dist/types/billing.d.ts
CHANGED
|
@@ -24,6 +24,23 @@ export interface Plan {
|
|
|
24
24
|
overage_allowed: boolean;
|
|
25
25
|
overage_per_call_cents: number;
|
|
26
26
|
features: PlanFeatures;
|
|
27
|
+
/**
|
|
28
|
+
* Which product line this plan belongs to (PR #91 dual-pricing).
|
|
29
|
+
* - 'api' → API-only plans for developers/SDK callers
|
|
30
|
+
* - 'app' → Workspace plans for dashboard end-users
|
|
31
|
+
* - 'all' → Legacy combined plans (still honored for existing subscribers)
|
|
32
|
+
*/
|
|
33
|
+
product?: 'api' | 'app' | 'all';
|
|
34
|
+
/** One-line marketing tagline shown under the plan name */
|
|
35
|
+
tagline?: string;
|
|
36
|
+
/** 'account' (flat) or 'seat' (per-user) — affects price-period display */
|
|
37
|
+
billing_unit?: 'account' | 'seat';
|
|
38
|
+
}
|
|
39
|
+
/** Plans split by product line — returned by /v1/billing/plans?grouped=true */
|
|
40
|
+
export interface GroupedPlans {
|
|
41
|
+
api_plans: Plan[];
|
|
42
|
+
app_plans: Plan[];
|
|
43
|
+
all_access_plans: Plan[];
|
|
27
44
|
}
|
|
28
45
|
export interface SubscriptionInfo {
|
|
29
46
|
plan: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../src/types/billing.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC,MAAM,WAAW,YAAY;IAC3B,cAAc,EAAE,OAAO,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O,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for Nova's streaming chat API (POST /v1/chat/stream).
|
|
3
|
+
*
|
|
4
|
+
* Server emits a series of SSE events as the chat pipeline progresses.
|
|
5
|
+
* Token chunks stream first, then artifacts (design HTML, PDF, PPT,
|
|
6
|
+
* etc.) land as discrete events, then a terminal `done` event closes
|
|
7
|
+
* the turn. Each event is a discriminated union member keyed on `type`.
|
|
8
|
+
*/
|
|
9
|
+
/** Body for POST /v1/chat/stream. */
|
|
10
|
+
export interface ChatStreamParams {
|
|
11
|
+
message: string;
|
|
12
|
+
/** auto / claude / gpt-4o / gemini / ollama-* / etc. */
|
|
13
|
+
model?: string;
|
|
14
|
+
session_id?: string;
|
|
15
|
+
history?: Array<{
|
|
16
|
+
role: string;
|
|
17
|
+
content: string;
|
|
18
|
+
}>;
|
|
19
|
+
/** Last design HTML for follow-up modifications */
|
|
20
|
+
previous_design_html?: string;
|
|
21
|
+
/** Last tool HTML for follow-up modifications */
|
|
22
|
+
previous_tool_html?: string;
|
|
23
|
+
/** 'deck' / 'web' / 'component' — narrows follow-up routing */
|
|
24
|
+
previous_artifact_type?: string;
|
|
25
|
+
/** File IDs from /v1/files/upload to reference this turn */
|
|
26
|
+
attachment_ids?: string[];
|
|
27
|
+
}
|
|
28
|
+
export interface TokenEvent {
|
|
29
|
+
type: 'token';
|
|
30
|
+
content: string;
|
|
31
|
+
}
|
|
32
|
+
export interface PipelineEvent {
|
|
33
|
+
type: 'pipeline';
|
|
34
|
+
step: Record<string, unknown>;
|
|
35
|
+
}
|
|
36
|
+
export interface MetaEvent {
|
|
37
|
+
type: 'meta';
|
|
38
|
+
session_id?: string;
|
|
39
|
+
turn?: number;
|
|
40
|
+
model?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface DesignEvent {
|
|
43
|
+
type: 'design';
|
|
44
|
+
design: Record<string, unknown>;
|
|
45
|
+
artifact_type?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface DesignChunkEvent {
|
|
48
|
+
type: 'design_chunk';
|
|
49
|
+
chunk: string;
|
|
50
|
+
}
|
|
51
|
+
export interface DocumentEvent {
|
|
52
|
+
type: 'document';
|
|
53
|
+
document: Record<string, unknown>;
|
|
54
|
+
}
|
|
55
|
+
export interface ProgressEvent {
|
|
56
|
+
type: 'progress';
|
|
57
|
+
progress?: Record<string, unknown>;
|
|
58
|
+
}
|
|
59
|
+
export interface ImageEvent {
|
|
60
|
+
type: 'image';
|
|
61
|
+
image: unknown;
|
|
62
|
+
}
|
|
63
|
+
export interface VideoEvent {
|
|
64
|
+
type: 'video';
|
|
65
|
+
video: unknown;
|
|
66
|
+
}
|
|
67
|
+
export interface AudioEvent {
|
|
68
|
+
type: 'audio';
|
|
69
|
+
/** Usually a `data:audio/mpeg;base64,...` URL playable in <audio> */
|
|
70
|
+
audio: string;
|
|
71
|
+
voice?: string;
|
|
72
|
+
model?: string;
|
|
73
|
+
}
|
|
74
|
+
export interface FilesEvent {
|
|
75
|
+
type: 'files';
|
|
76
|
+
files: Array<{
|
|
77
|
+
path: string;
|
|
78
|
+
content: string;
|
|
79
|
+
}>;
|
|
80
|
+
stack?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface PdfEvent {
|
|
83
|
+
type: 'pdf';
|
|
84
|
+
pdf_base64: string;
|
|
85
|
+
filename: string;
|
|
86
|
+
}
|
|
87
|
+
export interface PptxEvent {
|
|
88
|
+
type: 'pptx';
|
|
89
|
+
pptx_base64: string;
|
|
90
|
+
filename: string;
|
|
91
|
+
/** 'editable' = native python-pptx, real text boxes; 'visual' = image-based */
|
|
92
|
+
variant: 'editable' | 'visual';
|
|
93
|
+
}
|
|
94
|
+
export interface PptxVisualEvent {
|
|
95
|
+
type: 'pptx_visual';
|
|
96
|
+
pptx_base64: string;
|
|
97
|
+
filename: string;
|
|
98
|
+
}
|
|
99
|
+
export interface GuardianEvent {
|
|
100
|
+
type: 'guardian';
|
|
101
|
+
severity: 'low' | 'medium' | 'high';
|
|
102
|
+
kinds: string[];
|
|
103
|
+
content: string;
|
|
104
|
+
}
|
|
105
|
+
export interface AgentHealthEvent {
|
|
106
|
+
type: 'agent_health';
|
|
107
|
+
/** One entry per tracked agent: { agent_id, status, last_event_at, ... } */
|
|
108
|
+
agents: Array<Record<string, unknown>>;
|
|
109
|
+
/** Aggregate system state: redis_status, phase, etc. */
|
|
110
|
+
system: Record<string, unknown>;
|
|
111
|
+
/** Number of open Repair Agent cases at the moment of emission */
|
|
112
|
+
open_cases: number;
|
|
113
|
+
}
|
|
114
|
+
export interface A2AEvent {
|
|
115
|
+
type: 'a2a';
|
|
116
|
+
/** Calling agent (usually 'chat') */
|
|
117
|
+
from: string;
|
|
118
|
+
/** Target specialist agent name */
|
|
119
|
+
to: string;
|
|
120
|
+
/** The sub-task that was delegated */
|
|
121
|
+
request: string;
|
|
122
|
+
/** The specialist's reply */
|
|
123
|
+
response: string;
|
|
124
|
+
}
|
|
125
|
+
export interface DoneEvent {
|
|
126
|
+
type: 'done';
|
|
127
|
+
full_response: string;
|
|
128
|
+
model_used?: string;
|
|
129
|
+
pipeline?: Array<Record<string, unknown>>;
|
|
130
|
+
agents_used?: number;
|
|
131
|
+
turn?: number;
|
|
132
|
+
/** Set when the auto-agent fallback fired this turn */
|
|
133
|
+
auto_agent_spec?: Record<string, unknown>;
|
|
134
|
+
}
|
|
135
|
+
export interface ErrorEvent {
|
|
136
|
+
type: 'error';
|
|
137
|
+
message: string;
|
|
138
|
+
code?: string;
|
|
139
|
+
}
|
|
140
|
+
/** Per-conversation voice override — fired when the user says
|
|
141
|
+
* "switch to my Spanish voice" / "use the alloy voice". The dashboard
|
|
142
|
+
* mirrors the choice into local storage so the next Talk-to-Nova
|
|
143
|
+
* session uses it. */
|
|
144
|
+
export interface VoiceSetEvent {
|
|
145
|
+
type: 'voice_set';
|
|
146
|
+
/** Resolved voice name (stock voice or clone display name) */
|
|
147
|
+
voice: string;
|
|
148
|
+
/** Clone identifier when the resolved voice is a user clone */
|
|
149
|
+
clone_id: string | null;
|
|
150
|
+
}
|
|
151
|
+
/** Server-side keep-alive emitted every ~15s of idle time. No-op for callers
|
|
152
|
+
* — its purpose is just to keep the TCP connection alive across iOS Safari /
|
|
153
|
+
* cellular NAT / corporate proxies that drop idle SSE streams. */
|
|
154
|
+
export interface HeartbeatEvent {
|
|
155
|
+
type: 'heartbeat';
|
|
156
|
+
}
|
|
157
|
+
export type ChatStreamEvent = TokenEvent | PipelineEvent | MetaEvent | DesignEvent | DesignChunkEvent | DocumentEvent | ProgressEvent | ImageEvent | VideoEvent | AudioEvent | FilesEvent | PdfEvent | PptxEvent | PptxVisualEvent | GuardianEvent | AgentHealthEvent | A2AEvent | VoiceSetEvent | HeartbeatEvent | DoneEvent | ErrorEvent;
|
|
158
|
+
/** Parse a raw SSE payload object into a typed event.
|
|
159
|
+
*
|
|
160
|
+
* Unknown event types fall through to a synthetic MetaEvent so callers
|
|
161
|
+
* don't crash on new server-emitted variants they haven't pulled the
|
|
162
|
+
* SDK update for. Callers can always check `event.type` in a
|
|
163
|
+
* `switch (event.type) { ... default: ... }` to handle the unknown case.
|
|
164
|
+
*/
|
|
165
|
+
export declare function parseChatEvent(raw: Record<string, any>): ChatStreamEvent;
|
|
166
|
+
//# sourceMappingURL=chat-stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-stream.d.ts","sourceRoot":"","sources":["../../src/types/chat-stream.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,qCAAqC;AACrC,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnD,mDAAmD;IACnD,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,iDAAiD;IACjD,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,+DAA+D;IAC/D,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,4DAA4D;IAC5D,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/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AAED;;;uBAGuB;AACvB,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,WAAW,CAAC;IAClB,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED;;mEAEmE;AACnE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,MAAM,MAAM,eAAe,GACvB,UAAU,GACV,aAAa,GACb,SAAS,GACT,WAAW,GACX,gBAAgB,GAChB,aAAa,GACb,aAAa,GACb,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,QAAQ,GACR,SAAS,GACT,eAAe,GACf,aAAa,GACb,gBAAgB,GAChB,QAAQ,GACR,aAAa,GACb,cAAc,GACd,SAAS,GACT,UAAU,CAAC;AAEf;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,eAAe,CA4BxE"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Types for Nova's streaming chat API (POST /v1/chat/stream).
|
|
4
|
+
*
|
|
5
|
+
* Server emits a series of SSE events as the chat pipeline progresses.
|
|
6
|
+
* Token chunks stream first, then artifacts (design HTML, PDF, PPT,
|
|
7
|
+
* etc.) land as discrete events, then a terminal `done` event closes
|
|
8
|
+
* the turn. Each event is a discriminated union member keyed on `type`.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.parseChatEvent = parseChatEvent;
|
|
12
|
+
/** Parse a raw SSE payload object into a typed event.
|
|
13
|
+
*
|
|
14
|
+
* Unknown event types fall through to a synthetic MetaEvent so callers
|
|
15
|
+
* don't crash on new server-emitted variants they haven't pulled the
|
|
16
|
+
* SDK update for. Callers can always check `event.type` in a
|
|
17
|
+
* `switch (event.type) { ... default: ... }` to handle the unknown case.
|
|
18
|
+
*/
|
|
19
|
+
function parseChatEvent(raw) {
|
|
20
|
+
const t = (raw.type ?? '');
|
|
21
|
+
switch (t) {
|
|
22
|
+
case 'token':
|
|
23
|
+
case 'pipeline':
|
|
24
|
+
case 'meta':
|
|
25
|
+
case 'design':
|
|
26
|
+
case 'design_chunk':
|
|
27
|
+
case 'document':
|
|
28
|
+
case 'progress':
|
|
29
|
+
case 'image':
|
|
30
|
+
case 'video':
|
|
31
|
+
case 'audio':
|
|
32
|
+
case 'files':
|
|
33
|
+
case 'pdf':
|
|
34
|
+
case 'pptx':
|
|
35
|
+
case 'pptx_visual':
|
|
36
|
+
case 'guardian':
|
|
37
|
+
case 'agent_health':
|
|
38
|
+
case 'a2a':
|
|
39
|
+
case 'voice_set':
|
|
40
|
+
case 'heartbeat':
|
|
41
|
+
case 'done':
|
|
42
|
+
case 'error':
|
|
43
|
+
return raw;
|
|
44
|
+
default:
|
|
45
|
+
return { type: 'meta', ...raw };
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=chat-stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-stream.js","sourceRoot":"","sources":["../../src/types/chat-stream.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAoMH,wCA4BC;AAnCD;;;;;;GAMG;AACH,SAAgB,cAAc,CAAC,GAAwB;IACrD,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAA4B,CAAC;IACtD,QAAQ,CAAC,EAAE,CAAC;QACV,KAAK,OAAO,CAAC;QACb,KAAK,UAAU,CAAC;QAChB,KAAK,MAAM,CAAC;QACZ,KAAK,QAAQ,CAAC;QACd,KAAK,cAAc,CAAC;QACpB,KAAK,UAAU,CAAC;QAChB,KAAK,UAAU,CAAC;QAChB,KAAK,OAAO,CAAC;QACb,KAAK,OAAO,CAAC;QACb,KAAK,OAAO,CAAC;QACb,KAAK,OAAO,CAAC;QACb,KAAK,KAAK,CAAC;QACX,KAAK,MAAM,CAAC;QACZ,KAAK,aAAa,CAAC;QACnB,KAAK,UAAU,CAAC;QAChB,KAAK,cAAc,CAAC;QACpB,KAAK,KAAK,CAAC;QACX,KAAK,WAAW,CAAC;QACjB,KAAK,WAAW,CAAC;QACjB,KAAK,MAAM,CAAC;QACZ,KAAK,OAAO;YACV,OAAO,GAAsB,CAAC;QAChC;YACE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,EAAe,CAAC;IACjD,CAAC;AACH,CAAC"}
|