@lumavox/server 0.40.0 → 0.45.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.
@@ -5,6 +5,12 @@
5
5
  *
6
6
  * - **A save reaches running sessions within a minute**, not at once: an
7
7
  * agent's version travels through the platform's `STANDING` copy.
8
+ * - **Every change players see is a version** (`version` on the agent):
9
+ * **`versions.list`** its history, newest first, **`versions.get`** one
10
+ * whole, **`versions.restore`** puts one back as a new one.
11
+ * - **`draft`** holds changes players do not get until **`draft.publish`**
12
+ * makes them a version; **`draft.discard`** throws them away. A test
13
+ * chat runs the draft.
8
14
  * - **`settings`** are the organisation's, for every agent —
9
15
  * **`settings.rotateWebhookSecret`** makes the one secret its webhook
10
16
  * posts are signed with, shown once; **`testWebhook`** posts an agent's
@@ -16,7 +22,7 @@
16
22
  * - **`list()` reads one page**: an organisation's agents are few, and the
17
23
  * route answers them all with `next_cursor` `null` (`paging.ts`).
18
24
  */
19
- import type { AgentCreateRequest, AgentInfo, AgentKnowledgeUpdate, AgentPage, AgentSettingsInfo, AgentSettingsUpdate, AgentSummary, AgentToolsUpdate, AgentUpdate, KnowledgeAssigned, KnowledgeInfo, ToolInfo, ToolsAssigned, WebhookSecret, WebhookTestResult } from "../gen/index.js";
25
+ import type { AgentCreateRequest, AgentDraft, AgentDraftPublish, AgentDraftUpdate, AgentInfo, AgentKnowledgeUpdate, AgentPage, AgentRestored, AgentSettingsInfo, AgentSettingsUpdate, AgentSummary, AgentToolsUpdate, AgentUpdate, AgentVersion, AgentVersionRestore, AgentVersionSummary, KnowledgeAssigned, KnowledgeInfo, ToolInfo, ToolsAssigned, WebhookSecret, WebhookTestResult } from "../gen/index.js";
20
26
  import type { RequestOptions, Transport } from "../transport.js";
21
27
  import { Library } from "./resource.js";
22
28
  /** `agents.settings`: the organisation's, for every agent. */
@@ -40,10 +46,35 @@ export interface AgentTools {
40
46
  /** Replaces them all with these: the platform's `limits.agent.tools` at most (`limits()`). */
41
47
  set(agentId: string, body: AgentToolsUpdate, options?: RequestOptions): Promise<ToolsAssigned>;
42
48
  }
49
+ /** `agents.versions`: one agent's history — every change players saw. */
50
+ export interface AgentVersions {
51
+ /** Every version kept, newest first: who made it, when, its note, what changed. */
52
+ list(agentId: string, options?: RequestOptions): AsyncGenerator<AgentVersionSummary, void, undefined>;
53
+ /** One version whole: the agent as it made it. */
54
+ get(agentId: string, version: number, options?: RequestOptions): Promise<AgentVersion>;
55
+ /**
56
+ * Puts a version back as a new one; what it named that is gone since is
57
+ * left out, in `left_out`.
58
+ */
59
+ restore(agentId: string, version: number, body?: AgentVersionRestore, options?: RequestOptions): Promise<AgentRestored>;
60
+ }
61
+ /** `agents.draft`: changes players do not get until they are published. */
62
+ export interface AgentDrafts {
63
+ /** The draft as it stands; `pending` is `false` when it changes nothing. */
64
+ get(agentId: string, options?: RequestOptions): Promise<AgentDraft>;
65
+ /** Changes the draft, never what players have. */
66
+ update(agentId: string, body: AgentDraftUpdate, options?: RequestOptions): Promise<AgentDraft>;
67
+ /** Throws the draft away: `true`, and `true` again for none. */
68
+ discard(agentId: string, options?: RequestOptions): Promise<boolean>;
69
+ /** Makes the draft the version players have; the agent at that version. */
70
+ publish(agentId: string, body?: AgentDraftPublish, options?: RequestOptions): Promise<AgentInfo>;
71
+ }
43
72
  export declare class Agents extends Library<AgentInfo, AgentUpdate, AgentSummary, AgentPage, AgentCreateRequest> {
44
73
  readonly settings: AgentSettings;
45
74
  readonly knowledge: AgentKnowledge;
46
75
  readonly tools: AgentTools;
76
+ readonly versions: AgentVersions;
77
+ readonly draft: AgentDrafts;
47
78
  constructor(api: Transport, base: string);
48
79
  /** Posts the agent's webhook a made-up report, signed; what its server answered. */
49
80
  testWebhook(agentId: string, options?: RequestOptions): Promise<WebhookTestResult>;
@@ -5,6 +5,12 @@
5
5
  *
6
6
  * - **A save reaches running sessions within a minute**, not at once: an
7
7
  * agent's version travels through the platform's `STANDING` copy.
8
+ * - **Every change players see is a version** (`version` on the agent):
9
+ * **`versions.list`** its history, newest first, **`versions.get`** one
10
+ * whole, **`versions.restore`** puts one back as a new one.
11
+ * - **`draft`** holds changes players do not get until **`draft.publish`**
12
+ * makes them a version; **`draft.discard`** throws them away. A test
13
+ * chat runs the draft.
8
14
  * - **`settings`** are the organisation's, for every agent —
9
15
  * **`settings.rotateWebhookSecret`** makes the one secret its webhook
10
16
  * posts are signed with, shown once; **`testWebhook`** posts an agent's
@@ -16,6 +22,7 @@
16
22
  * - **`list()` reads one page**: an organisation's agents are few, and the
17
23
  * route answers them all with `next_cursor` `null` (`paging.ts`).
18
24
  */
25
+ import { segment } from "../transport.js";
19
26
  import { Library } from "./resource.js";
20
27
  export class Agents extends Library {
21
28
  constructor(api, base) {
@@ -27,6 +34,18 @@ export class Agents extends Library {
27
34
  };
28
35
  this.knowledge = this.links("/knowledge");
29
36
  this.tools = this.links("/tools");
37
+ const version = (id, n, rest = "") => this.at(id, `/versions/${segment(n)}${rest}`);
38
+ this.versions = {
39
+ list: (id, options) => this.each(this.at(id, "/versions"), {}, options),
40
+ get: (id, n, options) => this.send("GET", version(id, n), options),
41
+ restore: (id, n, body = {}, options) => this.send("POST", version(id, n, "/restore"), options, body),
42
+ };
43
+ this.draft = {
44
+ get: (id, options) => this.send("GET", this.at(id, "/draft"), options),
45
+ update: (id, body, options) => this.send("PATCH", this.at(id, "/draft"), options, body),
46
+ discard: (id, options) => this.send("DELETE", this.at(id, "/draft"), options).then(() => true),
47
+ publish: (id, body = {}, options) => this.send("POST", this.at(id, "/draft/publish"), options, body),
48
+ };
30
49
  }
31
50
  /** Posts the agent's webhook a made-up report, signed; what its server answered. */
32
51
  testWebhook(agentId, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumavox/server",
3
- "version": "0.40.0",
3
+ "version": "0.45.0",
4
4
  "description": "The Lumavox API from your server: end users, ephemeral keys and the rest, typed from the published OpenAPI document. Zero dependencies.",
5
5
  "license": "MIT",
6
6
  "type": "module",