@novalabai/adk 2.13.0 → 2.15.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.
Files changed (76) hide show
  1. package/README.md +78 -3
  2. package/dist/client.d.ts +9 -0
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +13 -1
  5. package/dist/client.js.map +1 -1
  6. package/dist/core/errors.d.ts +8 -0
  7. package/dist/core/errors.d.ts.map +1 -1
  8. package/dist/core/errors.js +13 -1
  9. package/dist/core/errors.js.map +1 -1
  10. package/dist/core/http.d.ts +2 -0
  11. package/dist/core/http.d.ts.map +1 -1
  12. package/dist/core/http.js +50 -7
  13. package/dist/core/http.js.map +1 -1
  14. package/dist/index.d.ts +8 -3
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +9 -2
  17. package/dist/index.js.map +1 -1
  18. package/dist/models.d.ts +20 -15
  19. package/dist/models.d.ts.map +1 -1
  20. package/dist/models.js +25 -30
  21. package/dist/models.js.map +1 -1
  22. package/dist/resources/agent.d.ts +35 -0
  23. package/dist/resources/agent.d.ts.map +1 -0
  24. package/dist/resources/agent.js +51 -0
  25. package/dist/resources/agent.js.map +1 -0
  26. package/dist/resources/agents.d.ts.map +1 -1
  27. package/dist/resources/agents.js +19 -2
  28. package/dist/resources/agents.js.map +1 -1
  29. package/dist/resources/chat.d.ts +19 -17
  30. package/dist/resources/chat.d.ts.map +1 -1
  31. package/dist/resources/chat.js +30 -18
  32. package/dist/resources/chat.js.map +1 -1
  33. package/dist/resources/conversations.d.ts +49 -0
  34. package/dist/resources/conversations.d.ts.map +1 -0
  35. package/dist/resources/conversations.js +77 -0
  36. package/dist/resources/conversations.js.map +1 -0
  37. package/dist/resources/creative.d.ts +4 -0
  38. package/dist/resources/creative.d.ts.map +1 -1
  39. package/dist/resources/creative.js +1 -0
  40. package/dist/resources/creative.js.map +1 -1
  41. package/dist/resources/rag.d.ts.map +1 -1
  42. package/dist/resources/rag.js +8 -1
  43. package/dist/resources/rag.js.map +1 -1
  44. package/dist/resources/team.d.ts +26 -0
  45. package/dist/resources/team.d.ts.map +1 -0
  46. package/dist/resources/team.js +39 -0
  47. package/dist/resources/team.js.map +1 -0
  48. package/dist/resources/terminal.d.ts +17 -7
  49. package/dist/resources/terminal.d.ts.map +1 -1
  50. package/dist/resources/terminal.js +19 -11
  51. package/dist/resources/terminal.js.map +1 -1
  52. package/dist/resources/usage.d.ts +8 -1
  53. package/dist/resources/usage.d.ts.map +1 -1
  54. package/dist/resources/usage.js +10 -0
  55. package/dist/resources/usage.js.map +1 -1
  56. package/dist/resources/websocket.d.ts +6 -1
  57. package/dist/resources/websocket.d.ts.map +1 -1
  58. package/dist/resources/websocket.js +8 -2
  59. package/dist/resources/websocket.js.map +1 -1
  60. package/dist/types/agents.d.ts +6 -0
  61. package/dist/types/agents.d.ts.map +1 -1
  62. package/dist/types/chat-stream.d.ts +133 -6
  63. package/dist/types/chat-stream.d.ts.map +1 -1
  64. package/dist/types/chat-stream.js +14 -30
  65. package/dist/types/chat-stream.js.map +1 -1
  66. package/dist/types/conversations.d.ts +98 -0
  67. package/dist/types/conversations.d.ts.map +1 -0
  68. package/dist/types/conversations.js +8 -0
  69. package/dist/types/conversations.js.map +1 -0
  70. package/dist/types/team.d.ts +55 -0
  71. package/dist/types/team.d.ts.map +1 -0
  72. package/dist/types/team.js +4 -0
  73. package/dist/types/team.js.map +1 -0
  74. package/dist/types/usage.d.ts +34 -0
  75. package/dist/types/usage.d.ts.map +1 -1
  76. package/package.json +1 -1
package/dist/models.d.ts CHANGED
@@ -20,23 +20,28 @@
20
20
  * - python/novalab_adk/models.py
21
21
  * - dashboard/src/lib/models.ts
22
22
  */
23
- export type ModelTier = 'flagship' | 'strong' | 'premium';
23
+ export type ModelTier = 'quality' | 'fast';
24
24
  /** The default. Nova's smart router picks the best model per request. */
25
25
  export declare const DEFAULT_MODEL = "auto";
26
- /** Model id constants for the `model` parameter. `NovaModel.Auto` is default. */
26
+ /** Model id constants for the `model` parameter. `NovaModel.Auto` is default.
27
+ * Nova tiers are vendor-agnostic; all run on Nova's premium EU engine. */
27
28
  export declare const NovaModel: {
28
29
  readonly Auto: "auto";
29
- readonly Qwen3_30B: "ollama-qwen3:30b";
30
- readonly Devstral: "ollama-devstral";
31
- readonly Codestral: "ollama-codestral";
32
- readonly Qwen3: "ollama-qwen3";
33
- readonly DeepSeekR1: "ollama-deepseek-r1:14b";
34
- readonly DeepSeekCoderV2: "ollama-deepseek-coder-v2:16b";
35
- readonly Qwen2_5_14B: "ollama-qwen2.5:14b";
36
- readonly GLM4: "ollama-glm4";
37
- readonly Claude: "claude";
38
- readonly GPT4o: "gpt-4o";
39
- readonly Gemini: "gemini";
30
+ readonly Max: "nova-max";
31
+ readonly Flagship: "nova-flagship";
32
+ readonly Reasoning: "nova-reasoning";
33
+ readonly Fast: "nova-fast";
34
+ readonly Qwen3_30B: "nova-flagship";
35
+ readonly Devstral: "nova-flagship";
36
+ readonly Codestral: "nova-flagship";
37
+ readonly Qwen3: "nova-fast";
38
+ readonly DeepSeekR1: "nova-reasoning";
39
+ readonly DeepSeekCoderV2: "nova-flagship";
40
+ readonly Qwen2_5_14B: "nova-fast";
41
+ readonly GLM4: "nova-fast";
42
+ readonly Claude: "nova-flagship";
43
+ readonly GPT4o: "nova-flagship";
44
+ readonly Gemini: "nova-reasoning";
40
45
  };
41
46
  export type NovaModelId = (typeof NovaModel)[keyof typeof NovaModel];
42
47
  export interface NovaModelInfo {
@@ -46,8 +51,8 @@ export interface NovaModelInfo {
46
51
  }
47
52
  /** Full catalog in display order (excludes Auto, the implicit default). */
48
53
  export declare const MODEL_CATALOG: readonly NovaModelInfo[];
49
- /** True if `value` is a premium (paid-plan) model. */
50
- export declare function isPremiumModel(value: string): boolean;
54
+ /** Nova tiers aren't plan-gated client-side; the server enforces limits. */
55
+ export declare function isPremiumModel(_value: string): boolean;
51
56
  /** True if `value` is `"auto"` or a model in the catalog. */
52
57
  export declare function isKnownModel(value: string): boolean;
53
58
  /** All catalog models in a tier. */
@@ -1 +1 @@
1
- {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE1D,yEAAyE;AACzE,eAAO,MAAM,aAAa,SAAS,CAAC;AAEpC,iFAAiF;AACjF,eAAO,MAAM,SAAS;;;;;;;;;;;;;CAmBZ,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAErE,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,2EAA2E;AAC3E,eAAO,MAAM,aAAa,EAAE,SAAS,aAAa,EAYjD,CAAC;AAKF,sDAAsD;AACtD,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAErD;AAED,6DAA6D;AAC7D,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED,oCAAoC;AACpC,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,GAAG,aAAa,EAAE,CAE9D"}
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;AAE3C,yEAAyE;AACzE,eAAO,MAAM,aAAa,SAAS,CAAC;AAEpC;2EAC2E;AAC3E,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;CAqBZ,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAErE,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,2EAA2E;AAC3E,eAAO,MAAM,aAAa,EAAE,SAAS,aAAa,EAIjD,CAAC;AAIF,4EAA4E;AAC5E,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED,6DAA6D;AAC7D,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED,oCAAoC;AACpC,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,GAAG,aAAa,EAAE,CAE9D"}
package/dist/models.js CHANGED
@@ -28,43 +28,38 @@ exports.isKnownModel = isKnownModel;
28
28
  exports.modelsForTier = modelsForTier;
29
29
  /** The default. Nova's smart router picks the best model per request. */
30
30
  exports.DEFAULT_MODEL = 'auto';
31
- /** Model id constants for the `model` parameter. `NovaModel.Auto` is default. */
31
+ /** Model id constants for the `model` parameter. `NovaModel.Auto` is default.
32
+ * Nova tiers are vendor-agnostic; all run on Nova's premium EU engine. */
32
33
  exports.NovaModel = {
33
34
  Auto: exports.DEFAULT_MODEL,
34
- // 🚀 Flagship — best general + coding models.
35
- Qwen3_30B: 'ollama-qwen3:30b',
36
- Devstral: 'ollama-devstral',
37
- Codestral: 'ollama-codestral',
38
- // ⚡ Strong — fast, capable everyday models.
39
- Qwen3: 'ollama-qwen3',
40
- DeepSeekR1: 'ollama-deepseek-r1:14b',
41
- DeepSeekCoderV2: 'ollama-deepseek-coder-v2:16b',
42
- Qwen2_5_14B: 'ollama-qwen2.5:14b',
43
- GLM4: 'ollama-glm4',
44
- // 💎 Premium — hosted frontier models. Require a paid plan.
45
- Claude: 'claude',
46
- GPT4o: 'gpt-4o',
47
- Gemini: 'gemini',
35
+ // Nova capability tiers.
36
+ Max: 'nova-max', // highest quality (top model) — costs more
37
+ Flagship: 'nova-flagship',
38
+ Reasoning: 'nova-reasoning',
39
+ Fast: 'nova-fast',
40
+ // Deprecated aliases — kept for back-compat, resolve to Nova tiers.
41
+ Qwen3_30B: 'nova-flagship',
42
+ Devstral: 'nova-flagship',
43
+ Codestral: 'nova-flagship',
44
+ Qwen3: 'nova-fast',
45
+ DeepSeekR1: 'nova-reasoning',
46
+ DeepSeekCoderV2: 'nova-flagship',
47
+ Qwen2_5_14B: 'nova-fast',
48
+ GLM4: 'nova-fast',
49
+ Claude: 'nova-flagship',
50
+ GPT4o: 'nova-flagship',
51
+ Gemini: 'nova-reasoning',
48
52
  };
49
53
  /** Full catalog in display order (excludes Auto, the implicit default). */
50
54
  exports.MODEL_CATALOG = [
51
- { value: exports.NovaModel.Qwen3_30B, label: 'Qwen 3 30B (Best Overall)', tier: 'flagship' },
52
- { value: exports.NovaModel.Devstral, label: 'Devstral (Coding Agent)', tier: 'flagship' },
53
- { value: exports.NovaModel.Codestral, label: 'Codestral (Code Expert)', tier: 'flagship' },
54
- { value: exports.NovaModel.Qwen3, label: 'Qwen 3 (Fast + Smart)', tier: 'strong' },
55
- { value: exports.NovaModel.DeepSeekR1, label: 'DeepSeek R1 (Reasoning)', tier: 'strong' },
56
- { value: exports.NovaModel.DeepSeekCoderV2, label: 'DeepSeek Coder V2', tier: 'strong' },
57
- { value: exports.NovaModel.Qwen2_5_14B, label: 'Qwen 2.5 14B', tier: 'strong' },
58
- { value: exports.NovaModel.GLM4, label: 'GLM-4 (Fast)', tier: 'strong' },
59
- { value: exports.NovaModel.Claude, label: 'Claude (Anthropic)', tier: 'premium' },
60
- { value: exports.NovaModel.GPT4o, label: 'GPT-4o (OpenAI)', tier: 'premium' },
61
- { value: exports.NovaModel.Gemini, label: 'Gemini (Google)', tier: 'premium' },
55
+ { value: exports.NovaModel.Flagship, label: 'Nova Flagship — highest quality', tier: 'quality' },
56
+ { value: exports.NovaModel.Reasoning, label: 'Nova Reasoning — deep analysis', tier: 'quality' },
57
+ { value: exports.NovaModel.Fast, label: 'Nova Fast — quick & efficient', tier: 'fast' },
62
58
  ];
63
- const PREMIUM = new Set(exports.MODEL_CATALOG.filter((m) => m.tier === 'premium').map((m) => m.value));
64
59
  const KNOWN = new Set([...exports.MODEL_CATALOG.map((m) => m.value), exports.DEFAULT_MODEL]);
65
- /** True if `value` is a premium (paid-plan) model. */
66
- function isPremiumModel(value) {
67
- return PREMIUM.has(value);
60
+ /** Nova tiers aren't plan-gated client-side; the server enforces limits. */
61
+ function isPremiumModel(_value) {
62
+ return false;
68
63
  }
69
64
  /** True if `value` is `"auto"` or a model in the catalog. */
70
65
  function isKnownModel(value) {
@@ -1 +1 @@
1
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AAwDH,wCAEC;AAGD,oCAEC;AAGD,sCAEC;AAhED,yEAAyE;AAC5D,QAAA,aAAa,GAAG,MAAM,CAAC;AAEpC,iFAAiF;AACpE,QAAA,SAAS,GAAG;IACvB,IAAI,EAAE,qBAAa;IAEnB,8CAA8C;IAC9C,SAAS,EAAE,kBAAkB;IAC7B,QAAQ,EAAE,iBAAiB;IAC3B,SAAS,EAAE,kBAAkB;IAE7B,4CAA4C;IAC5C,KAAK,EAAE,cAAc;IACrB,UAAU,EAAE,wBAAwB;IACpC,eAAe,EAAE,8BAA8B;IAC/C,WAAW,EAAE,oBAAoB;IACjC,IAAI,EAAE,aAAa;IAEnB,4DAA4D;IAC5D,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,QAAQ;CACR,CAAC;AAUX,2EAA2E;AAC9D,QAAA,aAAa,GAA6B;IACrD,EAAE,KAAK,EAAE,iBAAS,CAAC,SAAS,EAAE,KAAK,EAAE,2BAA2B,EAAE,IAAI,EAAE,UAAU,EAAE;IACpF,EAAE,KAAK,EAAE,iBAAS,CAAC,QAAQ,EAAE,KAAK,EAAE,yBAAyB,EAAE,IAAI,EAAE,UAAU,EAA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AAC,QAAQ,EAAE,KAAK,EAAE,iCAAiC,EAAE,IAAI,EAAE,SAAS,EAAE;IACxF,EAAE,KAAK,EAAE,iBAAS,CAAC,SAAS,EAAE,KAAK,EAAE,gCAAgC,EAAE,IAAI,EAAE,SAAS,EAAE;IACxF,EAAE,KAAK,EAAE,iBAAS,CAAC,IAAI,EAAE,KAAK,EAAE,+BAA+B,EAAE,IAAI,EAAE,MAAM,EAAE;CAChF,CAAC;AAEF,MAAM,KAAK,GAAG,IAAI,GAAG,CAAS,CAAC,GAAG,qBAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,qBAAa,CAAC,CAAC,CAAC;AAErF,4EAA4E;AAC5E,SAAgB,cAAc,CAAC,MAAc;IAC3C,OAAO,KAAK,CAAC;AACf,CAAC;AAED,6DAA6D;AAC7D,SAAgB,YAAY,CAAC,KAAa;IACxC,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC;AAED,oCAAoC;AACpC,SAAgB,aAAa,CAAC,IAAe;IAC3C,OAAO,qBAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACtD,CAAC"}
@@ -0,0 +1,35 @@
1
+ import type { HttpClient } from '../core/http.js';
2
+ import type { AgentApproval, AgentSettings, AgentSettingsResponse } from '../types/team.js';
3
+ /**
4
+ * Chat-agent settings and tool-call approvals (/v1/agent/*).
5
+ *
6
+ * In agent mode Nova runs a tool loop inside `nova.chat.stream()`. Tools with
7
+ * side effects pause the loop and emit an `approval_request` event; decide it
8
+ * here and the stream continues. Not to be confused with `nova.agents`
9
+ * (custom agents) or `nova.approvals` (governed-pipeline queue).
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * await nova.agent.updateSettings({ agent_mode: true });
14
+ * for await (const ev of nova.chat.stream({ message: 'email Kari the summary' })) {
15
+ * if (ev.type === 'approval_request') await nova.agent.approve(ev.id);
16
+ * }
17
+ * ```
18
+ */
19
+ export declare class AgentResource {
20
+ private readonly http;
21
+ constructor(http: HttpClient);
22
+ /** Your account's agent settings, plus the defaults. */
23
+ getSettings(): Promise<AgentSettingsResponse>;
24
+ /** Change settings, e.g. `{ agent_mode: true, company_name: 'Acme' }`. Invalid values throw (code `invalid_setting`). */
25
+ updateSettings(changes: Partial<AgentSettings>): Promise<AgentSettingsResponse>;
26
+ /** One approval request and its status. */
27
+ getApproval(approvalId: string): Promise<AgentApproval>;
28
+ /** Decide a paused tool call. A second decision throws (409 `already_decided`). */
29
+ decide(approvalId: string, decision: 'approve' | 'reject'): Promise<AgentApproval>;
30
+ /** Let the paused tool call run. */
31
+ approve(approvalId: string): Promise<AgentApproval>;
32
+ /** Skip the paused tool call; the agent is told it was declined. */
33
+ reject(approvalId: string): Promise<AgentApproval>;
34
+ }
35
+ //# sourceMappingURL=agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/resources/agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE5F;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;gBAEtB,IAAI,EAAE,UAAU;IAI5B,wDAAwD;IAClD,WAAW,IAAI,OAAO,CAAC,qBAAqB,CAAC;IAInD,yHAAyH;IACnH,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAIrF,2CAA2C;IACrC,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAI7D,mFAAmF;IAC7E,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC;IAIxF,oCAAoC;IAC9B,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIzD,oEAAoE;IAC9D,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CAGzD"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AgentResource = void 0;
4
+ /**
5
+ * Chat-agent settings and tool-call approvals (/v1/agent/*).
6
+ *
7
+ * In agent mode Nova runs a tool loop inside `nova.chat.stream()`. Tools with
8
+ * side effects pause the loop and emit an `approval_request` event; decide it
9
+ * here and the stream continues. Not to be confused with `nova.agents`
10
+ * (custom agents) or `nova.approvals` (governed-pipeline queue).
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * await nova.agent.updateSettings({ agent_mode: true });
15
+ * for await (const ev of nova.chat.stream({ message: 'email Kari the summary' })) {
16
+ * if (ev.type === 'approval_request') await nova.agent.approve(ev.id);
17
+ * }
18
+ * ```
19
+ */
20
+ class AgentResource {
21
+ http;
22
+ constructor(http) {
23
+ this.http = http;
24
+ }
25
+ /** Your account's agent settings, plus the defaults. */
26
+ async getSettings() {
27
+ return this.http.get('/agent/settings');
28
+ }
29
+ /** Change settings, e.g. `{ agent_mode: true, company_name: 'Acme' }`. Invalid values throw (code `invalid_setting`). */
30
+ async updateSettings(changes) {
31
+ return this.http.put('/agent/settings', { settings: changes });
32
+ }
33
+ /** One approval request and its status. */
34
+ async getApproval(approvalId) {
35
+ return this.http.get(`/agent/approvals/${encodeURIComponent(approvalId)}`);
36
+ }
37
+ /** Decide a paused tool call. A second decision throws (409 `already_decided`). */
38
+ async decide(approvalId, decision) {
39
+ return this.http.post(`/agent/approvals/${encodeURIComponent(approvalId)}`, { decision });
40
+ }
41
+ /** Let the paused tool call run. */
42
+ async approve(approvalId) {
43
+ return this.decide(approvalId, 'approve');
44
+ }
45
+ /** Skip the paused tool call; the agent is told it was declined. */
46
+ async reject(approvalId) {
47
+ return this.decide(approvalId, 'reject');
48
+ }
49
+ }
50
+ exports.AgentResource = AgentResource;
51
+ //# sourceMappingURL=agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/resources/agent.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;;;GAeG;AACH,MAAa,aAAa;IACP,IAAI,CAAa;IAElC,YAAY,IAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,wDAAwD;IACxD,KAAK,CAAC,WAAW;QACf,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAC1C,CAAC;IAED,yHAAyH;IACzH,KAAK,CAAC,cAAc,CAAC,OAA+B;QAClD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;IAED,2CAA2C;IAC3C,KAAK,CAAC,WAAW,CAAC,UAAkB;QAClC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,oBAAoB,kBAAkB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED,mFAAmF;IACnF,KAAK,CAAC,MAAM,CAAC,UAAkB,EAAE,QAA8B;QAC7D,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,kBAAkB,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC5F,CAAC;IAED,oCAAoC;IACpC,KAAK,CAAC,OAAO,CAAC,UAAkB;QAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAC5C,CAAC;IAED,oEAAoE;IACpE,KAAK,CAAC,MAAM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K,CAAC;IAIrC,0BAA0B;IACpB,MAAM,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC;IAIvD,gCAAgC;IAC1B,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC;IAInE,uBAAuB;IACjB,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvC,+CAA+C;IACzC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC;IAIpE,kCAAkC;IAC5B,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;IAItE,0CAA0C;IACpC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;IAKrF,qCAAqC;IAC/B,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAIjD,uCAAuC;IACjC,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI5C,kDAAkD;IAC5C,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAG5F"}
@@ -2,6 +2,23 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AgentsResource = void 0;
4
4
  const streaming_js_1 = require("../utils/streaming.js");
5
+ /** The API reads snake_case; camelCase run options were silently ignored. */
6
+ function runBody(params) {
7
+ return {
8
+ input: params.input,
9
+ context: params.context,
10
+ memory: params.memory,
11
+ session_id: params.sessionId,
12
+ learning: params.learning,
13
+ rag: params.rag,
14
+ rag_document_ids: params.ragDocumentIds,
15
+ rag_top_k: params.ragTopK,
16
+ rag_threshold: params.ragThreshold,
17
+ allow_training: params.allowTraining,
18
+ tools: params.tools,
19
+ allowed_agents: params.allowedAgents,
20
+ };
21
+ }
5
22
  class AgentsResource {
6
23
  http;
7
24
  constructor(http) {
@@ -33,11 +50,11 @@ class AgentsResource {
33
50
  }
34
51
  /** Run an agent synchronously. */
35
52
  async run(id, params) {
36
- return this.http.post(`/agents/${id}/run`, { ...params, stream: false });
53
+ return this.http.post(`/agents/${id}/run`, { ...runBody(params), stream: false });
37
54
  }
38
55
  /** Run an agent with streaming output. */
39
56
  async stream(id, params) {
40
- const response = await this.http.stream(`/agents/${id}/run`, { ...params, stream: true });
57
+ const response = await this.http.stream(`/agents/${id}/run`, { ...runBody(params), stream: true });
41
58
  return new streaming_js_1.NovaStream(response);
42
59
  }
43
60
  /** Get agent conversation memory. */
@@ -1 +1 @@
1
- {"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/resources/agents.ts"],"names":[],"mappings":";;;AAYA,wDAAmD;AAEnD,MAAa,cAAc;IACR,IAAI,CAAa;IAElC,YAAY,IAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,uBAAuB;IACvB,KAAK,CAAC,IAAI,CAAC,MAA6D;QACtE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAU,SAAS,EAAE,MAA+D,CAAC,CAAC;IAC5G,CAAC;IAED,gCAAgC;IAChC,KAAK,CAAC,GAAG,CAAC,EAAU;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAQ,WAAW,EAAE,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED,0BAA0B;IAC1B,KAAK,CAAC,MAAM,CAAC,MAAyB;QACpC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAQ,SAAS,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;IAED,gCAAgC;IAChC,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,MAAyB;QAChD,OAAO,I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AU;QAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IAClD,CAAC;IAED,kDAAkD;IAClD,KAAK,CAAC,UAAU,CAAC,OAAe,EAAE,MAA2B;QAC3D,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAqB,WAAW,OAAO,UAAU,EAAE,MAA+D,CAAC,CAAC;IAC1I,CAAC;CACF;AA9DD,wCA8DC"}
@@ -5,7 +5,7 @@ import type { ChatStreamEvent, ChatStreamParams } from '../types/chat-stream.js'
5
5
  * Conversational chat powered by Nova's full AI pipeline.
6
6
  *
7
7
  * Features:
8
- * - Automatic model fallback (if Claude fails → tries GPT → Gemini → Ollama)
8
+ * - Automatic model fallback (if the primary model fails, the next one in the chain is tried)
9
9
  * - Conversation memory maintained server-side
10
10
  * - Smart model routing based on intent
11
11
  * - Trust evaluation and guardrails
@@ -20,9 +20,9 @@ import type { ChatStreamEvent, ChatStreamParams } from '../types/chat-stream.js'
20
20
  * // Chat with auto-fallback if primary model fails
21
21
  * const reply = await nova.chat.sendWithFallback({
22
22
  * message: 'Write a REST API',
23
- * model: 'claude',
23
+ * model: 'nova-flagship',
24
24
  * });
25
- * // If Claude hits 429, automatically tries GPT → Gemini → Ollama
25
+ * // On 429 / 5xx / timeout, the next model in the backup chain is tried
26
26
  * ```
27
27
  */
28
28
  export declare class ChatResource {
@@ -40,7 +40,7 @@ export declare class ChatResource {
40
40
  *
41
41
  * If the primary model fails (429 rate limit, 500 error, timeout),
42
42
  * automatically retries with the next model in the chain:
43
- * Claude → GPT-4o → Gemini → Ollama (qwen2.5:14b)
43
+ * (the built-in backup chain, or `fallbackModels`)
44
44
  *
45
45
  * @param params - Chat message parameters
46
46
  * @param fallbackModels - Custom fallback chain (optional)
@@ -57,23 +57,25 @@ export declare class ChatResource {
57
57
  * Stream chat events from /v1/chat/stream as they arrive.
58
58
  *
59
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`.
60
+ * `pipeline` (per-step status), `meta` (session / conversation ids),
61
+ * `artifact` (versioned doc / sheet / slides), `design` / `document` /
62
+ * `pdf` / `pptx` / `image` / `audio` (legacy artifacts), agent-mode
63
+ * events (`tool_start`, `tool_result`, `approval_request`,
64
+ * `approval_resolved`, `task_list`, `usage`, `model_fallback`), `plan`,
65
+ * and a final `done`. Unknown types arrive as `{ type: 'unknown', event_type, raw }`.
66
+ *
67
+ * Throws `NovaInsufficientCreditsError` when the account is out of
68
+ * credits — as an HTTP 402 or as a `done` event with `quota_exceeded`.
63
69
  *
64
70
  * @example
65
71
  * ```typescript
66
- * let full = '';
67
- * for await (const ev of nova.chat.stream({ message: 'create a 10-slide deck for Acme AI' })) {
72
+ * for await (const ev of nova.chat.stream({ message: 'write a project brief', agent_mode: true })) {
68
73
  * 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;
74
+ * case 'token': process.stdout.write(ev.content); break;
75
+ * case 'task_list': console.log(ev.tasks); break;
76
+ * case 'approval_request': await nova.agent.approve(ev.id); break;
77
+ * case 'artifact': console.log(ev.artifact.title, ev.artifact.formats); break;
78
+ * case 'done': console.log(`\\nconfidence ${ev.confidence}`); break;
77
79
  * }
78
80
  * }
79
81
  * ```
@@ -1 +1 @@
1
- {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/resources/chat.ts"],"names":[],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;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACI,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,qBAAqB,CAAC,eAAe,CAAC;CAchF"}
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ChatResource = void 0;
4
4
  const chat_stream_js_1 = require("../types/chat-stream.js");
5
5
  const fallback_js_1 = require("../core/fallback.js");
6
+ const errors_js_1 = require("../core/errors.js");
6
7
  /**
7
8
  * Conversational chat powered by Nova's full AI pipeline.
8
9
  *
9
10
  * Features:
10
- * - Automatic model fallback (if Claude fails → tries GPT → Gemini → Ollama)
11
+ * - Automatic model fallback (if the primary model fails, the next one in the chain is tried)
11
12
  * - Conversation memory maintained server-side
12
13
  * - Smart model routing based on intent
13
14
  * - Trust evaluation and guardrails
@@ -22,9 +23,9 @@ const fallback_js_1 = require("../core/fallback.js");
22
23
  * // Chat with auto-fallback if primary model fails
23
24
  * const reply = await nova.chat.sendWithFallback({
24
25
  * message: 'Write a REST API',
25
- * model: 'claude',
26
+ * model: 'nova-flagship',
26
27
  * });
27
- * // If Claude hits 429, automatically tries GPT → Gemini → Ollama
28
+ * // On 429 / 5xx / timeout, the next model in the backup chain is tried
28
29
  * ```
29
30
  */
30
31
  class ChatResource {
@@ -46,7 +47,7 @@ class ChatResource {
46
47
  *
47
48
  * If the primary model fails (429 rate limit, 500 error, timeout),
48
49
  * automatically retries with the next model in the chain:
49
- * Claude → GPT-4o → Gemini → Ollama (qwen2.5:14b)
50
+ * (the built-in backup chain, or `fallbackModels`)
50
51
  *
51
52
  * @param params - Chat message parameters
52
53
  * @param fallbackModels - Custom fallback chain (optional)
@@ -73,30 +74,41 @@ class ChatResource {
73
74
  * Stream chat events from /v1/chat/stream as they arrive.
74
75
  *
75
76
  * 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`.
77
+ * `pipeline` (per-step status), `meta` (session / conversation ids),
78
+ * `artifact` (versioned doc / sheet / slides), `design` / `document` /
79
+ * `pdf` / `pptx` / `image` / `audio` (legacy artifacts), agent-mode
80
+ * events (`tool_start`, `tool_result`, `approval_request`,
81
+ * `approval_resolved`, `task_list`, `usage`, `model_fallback`), `plan`,
82
+ * and a final `done`. Unknown types arrive as `{ type: 'unknown', event_type, raw }`.
83
+ *
84
+ * Throws `NovaInsufficientCreditsError` when the account is out of
85
+ * credits — as an HTTP 402 or as a `done` event with `quota_exceeded`.
79
86
  *
80
87
  * @example
81
88
  * ```typescript
82
- * let full = '';
83
- * for await (const ev of nova.chat.stream({ message: 'create a 10-slide deck for Acme AI' })) {
89
+ * for await (const ev of nova.chat.stream({ message: 'write a project brief', agent_mode: true })) {
84
90
  * 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;
91
+ * case 'token': process.stdout.write(ev.content); break;
92
+ * case 'task_list': console.log(ev.tasks); break;
93
+ * case 'approval_request': await nova.agent.approve(ev.id); break;
94
+ * case 'artifact': console.log(ev.artifact.title, ev.artifact.formats); break;
95
+ * case 'done': console.log(`\\nconfidence ${ev.confidence}`); break;
93
96
  * }
94
97
  * }
95
98
  * ```
96
99
  */
97
100
  async *stream(params) {
98
101
  for await (const raw of this.http.postStream('/chat/stream', params)) {
99
- yield (0, chat_stream_js_1.parseChatEvent)(raw);
102
+ const event = (0, chat_stream_js_1.parseChatEvent)(raw);
103
+ if (event.type === 'done' && event.quota_exceeded) {
104
+ throw new errors_js_1.NovaInsufficientCreditsError({
105
+ operation: 'chat',
106
+ balance: 0,
107
+ cost: 0,
108
+ message: event.full_response || 'Not enough credits to run this chat turn.',
109
+ });
110
+ }
111
+ yield event;
100
112
  }
101
113
  }
102
114
  }
@@ -1 +1 @@
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,IAAI,CAAe,OAAO,EAAE,MAAM,CAAC,CAAC;IACvD,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,gBAAgB,CACpB,MAAyB,EACzB,cAAyB;QAEzB,MAAM,OAAO,GAAG,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,CAAC,cAAc,EAAE,MAAM,CAAC,EAAE,CAAC;YACrE,MAAM,KAAK,GAAG,IAAA,+BAAc,EAAC,GAAG,CAAC,CAAC;YAClC,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;gBAClD,MAAM,IAAI,wCAA4B,CAAC;oBACrC,SAAS,EAAE,MAAM;oBACjB,OAAO,EAAE,CAAC;oBACV,IAAI,EAAE,CAAC;oBACP,OAAO,EAAE,KAAK,CAAC,aAAa,IAAI,2CAA2C;iBAC5E,CAAC,CAAC;YACL,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAnGD,oCAmGC"}
@@ -0,0 +1,49 @@
1
+ import type { HttpClient } from '../core/http.js';
2
+ import type { Artifact, ArtifactListItem, ArtifactVersionParams, Conversation, ConversationCreateParams, ConversationDetail, ConversationList, ConversationSettings, ConversationSummary, ConversationUpdateParams } from '../types/conversations.js';
3
+ /**
4
+ * Server-side conversations and their artifacts (documents, sheets, decks).
5
+ * Every call only sees the caller's own conversations (another account's
6
+ * id answers 404).
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const { conversations } = await nova.conversations.list({ limit: 20 });
11
+ * const conv = await nova.conversations.get(conversations[0].id);
12
+ * const [first] = await nova.conversations.artifacts(conv.id);
13
+ * const pdf = await nova.conversations.exportArtifact(conv.id, first.artifact_id, 'pdf');
14
+ * ```
15
+ */
16
+ export declare class ConversationsResource {
17
+ private readonly http;
18
+ constructor(http: HttpClient);
19
+ /** Newest first. Pass `next` from the previous page as `before`. */
20
+ list(params?: {
21
+ limit?: number;
22
+ before?: string;
23
+ }): Promise<ConversationList>;
24
+ /** Create a conversation; `messages` imports an existing chat. */
25
+ create(params?: ConversationCreateParams): Promise<Conversation>;
26
+ /** The conversation with all its messages. */
27
+ get(conversationId: string): Promise<ConversationDetail>;
28
+ /** Rename and/or change `memory_mode`. */
29
+ update(conversationId: string, params: ConversationUpdateParams): Promise<Conversation>;
30
+ /** Delete the conversation, its messages, files and artifacts. */
31
+ delete(conversationId: string): Promise<void>;
32
+ /** The rolling summary Nova keeps for long conversations. */
33
+ summary(conversationId: string): Promise<ConversationSummary>;
34
+ /** Account-wide conversation settings. */
35
+ getSettings(): Promise<ConversationSettings>;
36
+ /** `'session_only'` turns long-term memory off for the whole account. */
37
+ updateSettings(memoryModeDefault: string): Promise<ConversationSettings>;
38
+ /** Bytes of a file Nova generated in this conversation. */
39
+ downloadFile(conversationId: string, fileId: string): Promise<ArrayBuffer>;
40
+ /** Documents, sheets and decks of this conversation, with their versions. */
41
+ artifacts(conversationId: string): Promise<ArtifactListItem[]>;
42
+ /** One version (default: the latest) with its content and formats. */
43
+ getArtifact(conversationId: string, artifactId: string, version?: number): Promise<Artifact>;
44
+ /** Save edited `content` as a new version, or restore an old one. Earlier versions are kept. */
45
+ addArtifactVersion(conversationId: string, artifactId: string, params: ArtifactVersionParams): Promise<Artifact>;
46
+ /** The artifact as a file: docx / pdf / html (doc), xlsx / csv (sheet), pdf / pptx (slides). */
47
+ exportArtifact(conversationId: string, artifactId: string, format: string, version?: number): Promise<ArrayBuffer>;
48
+ }
49
+ //# sourceMappingURL=conversations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../src/resources/conversations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EACV,QAAQ,EACR,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EACZ,wBAAwB,EACxB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,2BAA2B,CAAC;AAEnC;;;;;;;;;;;;GAYG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;gBAEtB,IAAI,EAAE,UAAU;IAI5B,oEAAoE;IAC9D,I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Ac,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,WAAW,CAAC;CAMxB"}
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConversationsResource = void 0;
4
+ /**
5
+ * Server-side conversations and their artifacts (documents, sheets, decks).
6
+ * Every call only sees the caller's own conversations (another account's
7
+ * id answers 404).
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const { conversations } = await nova.conversations.list({ limit: 20 });
12
+ * const conv = await nova.conversations.get(conversations[0].id);
13
+ * const [first] = await nova.conversations.artifacts(conv.id);
14
+ * const pdf = await nova.conversations.exportArtifact(conv.id, first.artifact_id, 'pdf');
15
+ * ```
16
+ */
17
+ class ConversationsResource {
18
+ http;
19
+ constructor(http) {
20
+ this.http = http;
21
+ }
22
+ /** Newest first. Pass `next` from the previous page as `before`. */
23
+ async list(params = {}) {
24
+ return this.http.get('/conversations', { limit: params.limit ?? 50, before: params.before });
25
+ }
26
+ /** Create a conversation; `messages` imports an existing chat. */
27
+ async create(params = {}) {
28
+ return this.http.post('/conversations', { title: params.title ?? '', ...params });
29
+ }
30
+ /** The conversation with all its messages. */
31
+ async get(conversationId) {
32
+ return this.http.get(`/conversations/${encodeURIComponent(conversationId)}`);
33
+ }
34
+ /** Rename and/or change `memory_mode`. */
35
+ async update(conversationId, params) {
36
+ return this.http.patch(`/conversations/${encodeURIComponent(conversationId)}`, params);
37
+ }
38
+ /** Delete the conversation, its messages, files and artifacts. */
39
+ async delete(conversationId) {
40
+ await this.http.delete(`/conversations/${encodeURIComponent(conversationId)}`);
41
+ }
42
+ /** The rolling summary Nova keeps for long conversations. */
43
+ async summary(conversationId) {
44
+ return this.http.get(`/conversations/${encodeURIComponent(conversationId)}/summary`);
45
+ }
46
+ /** Account-wide conversation settings. */
47
+ async getSettings() {
48
+ return this.http.get('/conversations/settings');
49
+ }
50
+ /** `'session_only'` turns long-term memory off for the whole account. */
51
+ async updateSettings(memoryModeDefault) {
52
+ return this.http.put('/conversations/settings', { memory_mode_default: memoryModeDefault });
53
+ }
54
+ /** Bytes of a file Nova generated in this conversation. */
55
+ async downloadFile(conversationId, fileId) {
56
+ return this.http.getRaw(`/conversations/${encodeURIComponent(conversationId)}/files/${encodeURIComponent(fileId)}`);
57
+ }
58
+ /** Documents, sheets and decks of this conversation, with their versions. */
59
+ async artifacts(conversationId) {
60
+ const res = await this.http.get(`/conversations/${encodeURIComponent(conversationId)}/artifacts`);
61
+ return res?.artifacts ?? [];
62
+ }
63
+ /** One version (default: the latest) with its content and formats. */
64
+ async getArtifact(conversationId, artifactId, version) {
65
+ return this.http.get(`/conversations/${encodeURIComponent(conversationId)}/artifacts/${encodeURIComponent(artifactId)}`, { version });
66
+ }
67
+ /** Save edited `content` as a new version, or restore an old one. Earlier versions are kept. */
68
+ async addArtifactVersion(conversationId, artifactId, params) {
69
+ return this.http.post(`/conversations/${encodeURIComponent(conversationId)}/artifacts/${encodeURIComponent(artifactId)}/versions`, params);
70
+ }
71
+ /** The artifact as a file: docx / pdf / html (doc), xlsx / csv (sheet), pdf / pptx (slides). */
72
+ async exportArtifact(conversationId, artifactId, format, version) {
73
+ return this.http.getRaw(`/conversations/${encodeURIComponent(conversationId)}/artifacts/${encodeURIComponent(artifactId)}/export`, { format, version });
74
+ }
75
+ }
76
+ exports.ConversationsResource = ConversationsResource;
77
+ //# sourceMappingURL=conversations.js.map