@lumavox/server 0.32.0 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@ export type * from "./gen/index.js";
10
10
  export type { Page } from "./paging.js";
11
11
  export type { AgentKnowledge, AgentSettings, Agents, AgentTools, } from "./resources/agents.js";
12
12
  export type { AssetListParams, Assets, AssetUploadFields, FolderListParams, Folders, } from "./resources/assets.js";
13
- export type { EndUserCreated, EndUserExport, EndUserListParams, EndUserMemories, EndUserMemoryListParams, EndUsers, } from "./resources/end-users.js";
13
+ export type { EndUserCreated, EndUserExport, EndUserListParams, EndUserMemories, EndUserMemoryListParams, EndUserScheduledMessages, EndUsers, } from "./resources/end-users.js";
14
14
  export type { EphemeralKeyCreateOptions, EphemeralKeyListParams, EphemeralKeyRevokeOptions, EphemeralKeys, } from "./resources/ephemeral-keys.js";
15
15
  export type { GenerationListParams, Generations, Images, Jobs, Skybox, } from "./resources/generations.js";
16
16
  export type { Knowledge, KnowledgeInsightsParams, KnowledgeListParams, KnowledgeUploadFields, } from "./resources/knowledge.js";
@@ -5,7 +5,10 @@
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
- * - **`settings`** are the organisation's, for every agent;
8
+ * - **`settings`** are the organisation's, for every agent —
9
+ * **`settings.rotateWebhookSecret`** makes the one secret its webhook
10
+ * posts are signed with, shown once; **`testWebhook`** posts an agent's
11
+ * address a made-up report;
9
12
  * **`knowledge.set`** replaces the entries one agent may look up, and
10
13
  * **`tools.set`** the tools it can call.
11
14
  * - **`create` is a 409 at the plan's maximum agents**; `delete` answers
@@ -13,13 +16,15 @@
13
16
  * - **`list()` reads one page**: an organisation's agents are few, and the
14
17
  * route answers them all with `next_cursor` `null` (`paging.ts`).
15
18
  */
16
- import type { AgentCreateRequest, AgentInfo, AgentKnowledgeUpdate, AgentPage, AgentSettingsInfo, AgentSettingsUpdate, AgentSummary, AgentToolsUpdate, AgentUpdate, KnowledgeAssigned, KnowledgeInfo, ToolInfo, ToolsAssigned } from "../gen/index.js";
19
+ import type { AgentCreateRequest, AgentInfo, AgentKnowledgeUpdate, AgentPage, AgentSettingsInfo, AgentSettingsUpdate, AgentSummary, AgentToolsUpdate, AgentUpdate, KnowledgeAssigned, KnowledgeInfo, ToolInfo, ToolsAssigned, WebhookSecret, WebhookTestResult } from "../gen/index.js";
17
20
  import type { RequestOptions, Transport } from "../transport.js";
18
21
  import { Library } from "./resource.js";
19
22
  /** `agents.settings`: the organisation's, for every agent. */
20
23
  export interface AgentSettings {
21
24
  get(options?: RequestOptions): Promise<AgentSettingsInfo>;
22
25
  update(body: AgentSettingsUpdate, options?: RequestOptions): Promise<AgentSettingsInfo>;
26
+ /** Makes or replaces the organisation's webhook secret: shown this once. */
27
+ rotateWebhookSecret(options?: RequestOptions): Promise<WebhookSecret>;
23
28
  }
24
29
  /** `agents.knowledge`: the entries one agent may look up. */
25
30
  export interface AgentKnowledge {
@@ -40,6 +45,8 @@ export declare class Agents extends Library<AgentInfo, AgentUpdate, AgentSummary
40
45
  readonly knowledge: AgentKnowledge;
41
46
  readonly tools: AgentTools;
42
47
  constructor(api: Transport, base: string);
48
+ /** Posts the agent's webhook a made-up report, signed; what its server answered. */
49
+ testWebhook(agentId: string, options?: RequestOptions): Promise<WebhookTestResult>;
43
50
  /** An agent's links to what the organisation has: its knowledge, its tools. */
44
51
  protected links<T extends AgentKnowledge | AgentTools>(rest: string): T;
45
52
  }
@@ -5,7 +5,10 @@
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
- * - **`settings`** are the organisation's, for every agent;
8
+ * - **`settings`** are the organisation's, for every agent —
9
+ * **`settings.rotateWebhookSecret`** makes the one secret its webhook
10
+ * posts are signed with, shown once; **`testWebhook`** posts an agent's
11
+ * address a made-up report;
9
12
  * **`knowledge.set`** replaces the entries one agent may look up, and
10
13
  * **`tools.set`** the tools it can call.
11
14
  * - **`create` is a 409 at the plan's maximum agents**; `delete` answers
@@ -20,10 +23,15 @@ export class Agents extends Library {
20
23
  this.settings = {
21
24
  get: (options) => this.send("GET", "/settings", options),
22
25
  update: (body, options) => this.send("PUT", "/settings", options, body),
26
+ rotateWebhookSecret: (options) => this.send("POST", "/settings/webhook-secret", options),
23
27
  };
24
28
  this.knowledge = this.links("/knowledge");
25
29
  this.tools = this.links("/tools");
26
30
  }
31
+ /** Posts the agent's webhook a made-up report, signed; what its server answered. */
32
+ testWebhook(agentId, options) {
33
+ return this.send("POST", this.at(agentId, "/webhook-test"), options);
34
+ }
27
35
  /** An agent's links to what the organisation has: its knowledge, its tools. */
28
36
  links(rest) {
29
37
  return {
@@ -34,12 +34,13 @@
34
34
  * read fails with a 401; its one micro-credit is set aside like any key's,
35
35
  * so an organisation with no balance cannot export (402).
36
36
  */
37
- import type { EndUserCreateRequest, EndUserDeleted, EndUserInfo, EndUserPage, EndUserPersonalization, EndUserPersonalizationUpdate, EndUserUpdateRequest, FactCreateRequest, FactInfo, FactUpdateRequest, ListEndUserMemoriesData, ListEndUsersData, MemoriesDeleted, MemoryInfo, MemoryPage, NoteCreateRequest, NoteTaken, SessionDetail, ToolResultRequest, ToolResultTaken } from "../gen/index.js";
37
+ import type { ConversationReport, ConversationReportPage, EndUserCreateRequest, EndUserDeleted, EndUserInfo, EndUserPage, EndUserPersonalization, EndUserPersonalizationUpdate, EndUserUpdateRequest, FactCreateRequest, FactInfo, FactUpdateRequest, ListEndUserMemoriesData, ListEndUserReportsData, ListEndUsersData, MemoriesDeleted, MemoryInfo, MemoryPage, NoteCreateRequest, NoteTaken, ScheduledMessage, ScheduledMessageCreateRequest, SessionDetail, ToolResultRequest, ToolResultTaken } from "../gen/index.js";
38
38
  import { type RequestOptions, type Transport } from "../transport.js";
39
39
  import type { EphemeralKeys } from "./ephemeral-keys.js";
40
40
  import { Editable } from "./resource.js";
41
41
  export type EndUserListParams = NonNullable<ListEndUsersData["query"]>;
42
42
  export type EndUserMemoryListParams = NonNullable<ListEndUserMemoriesData["query"]>;
43
+ export type EndUserReportListParams = NonNullable<ListEndUserReportsData["query"]>;
43
44
  /** An end user `create` answered, and whether this call made them. */
44
45
  export type EndUserCreated = EndUserInfo & {
45
46
  /**
@@ -121,11 +122,50 @@ export interface EndUserPersonalizations {
121
122
  */
122
123
  update(id: string, body: EndUserPersonalizationUpdate, options?: RequestOptions): Promise<EndUserPersonalization>;
123
124
  }
125
+ /**
126
+ * `endUsers.reports`: what an agent with `report_enabled` wrote after each
127
+ * of one person's conversations — a summary, your fields, success by your
128
+ * rule — `/v1/end-users/{id}/reports`. Only an API key reads them.
129
+ */
130
+ export interface EndUserReports {
131
+ /** Every report, newest first, page after page; `session_id` keeps one conversation's. */
132
+ list(id: string, params?: Omit<EndUserReportListParams, "cursor">, options?: RequestOptions): AsyncGenerator<ConversationReport, void, undefined>;
133
+ /** One page, with the `next_cursor` of the next. */
134
+ page(id: string, params?: EndUserReportListParams, options?: RequestOptions): Promise<ConversationReportPage>;
135
+ /** One report. A `NotFoundError` when there is none, or no such person. */
136
+ get(id: string, reportId: string, options?: RequestOptions): Promise<ConversationReport>;
137
+ }
138
+ /**
139
+ * `endUsers.scheduledMessages`: messages an agent writes to one person
140
+ * first, at a set time, while they are away —
141
+ * `/v1/end-users/{id}/scheduled-messages`. The agent needs
142
+ * `outreach_enabled`; each message is one model call, paid from your
143
+ * balance; your webhook is sent it to show as a notification.
144
+ */
145
+ export interface EndUserScheduledMessages {
146
+ /**
147
+ * Schedules one: the agent writes about `note`, in character, at
148
+ * `send_at`. 409 when the agent does not write first or the person's day
149
+ * or queue is full; 402 when your balance cannot set its reserve aside.
150
+ */
151
+ create(id: string, body: ScheduledMessageCreateRequest, options?: RequestOptions): Promise<ScheduledMessage>;
152
+ /** Every message, newest `send_at` first; `status` to filter. */
153
+ list(id: string, params?: {
154
+ status?: ScheduledMessage["status"];
155
+ }, options?: RequestOptions): AsyncGenerator<ScheduledMessage, void, undefined>;
156
+ /** One message. */
157
+ get(id: string, messageId: string, options?: RequestOptions): Promise<ScheduledMessage>;
158
+ /** Cancels one still waiting; 409 one no longer waiting. */
159
+ cancel(id: string, messageId: string, options?: RequestOptions): Promise<ScheduledMessage>;
160
+ }
124
161
  export declare class EndUsers extends Editable<EndUserInfo, EndUserUpdateRequest, EndUserInfo, EndUserDeleted | null> {
125
162
  private readonly keys;
126
163
  readonly facts: EndUserFacts;
127
164
  readonly memories: EndUserMemories;
128
165
  readonly personalization: EndUserPersonalizations;
166
+ /** Messages an agent writes to the person first: `endUsers.scheduledMessages`. */
167
+ readonly scheduledMessages: EndUserScheduledMessages;
168
+ readonly reports: EndUserReports;
129
169
  constructor(api: Transport, base: string, keys: EphemeralKeys);
130
170
  /**
131
171
  * Makes a person, or finds the one your `external_id` already names.
@@ -94,6 +94,19 @@ export class EndUsers extends Editable {
94
94
  get: (id, options) => this.send("GET", this.at(id, "/personalization"), options),
95
95
  update: (id, body, options) => this.send("PATCH", this.at(id, "/personalization"), options, body),
96
96
  };
97
+ const reports = (id, rest = "") => this.at(id, `/reports${rest}`);
98
+ this.reports = {
99
+ list: (id, params = {}, options) => this.each(reports(id), params, options, MEMORY_PAGE),
100
+ page: (id, params = {}, options) => this.send("GET", reports(id), options, params),
101
+ get: (id, reportId, options) => this.send("GET", reports(id, `/${segment(reportId)}`), options),
102
+ };
103
+ const message = (id, messageId) => this.at(id, `/scheduled-messages/${segment(messageId)}`);
104
+ this.scheduledMessages = {
105
+ create: (id, body, options) => this.send("POST", this.at(id, "/scheduled-messages"), options, body),
106
+ list: (id, params = {}, options) => this.each(this.at(id, "/scheduled-messages"), params, options, PAGE),
107
+ get: (id, messageId, options) => this.send("GET", message(id, messageId), options),
108
+ cancel: (id, messageId, options) => this.send("DELETE", message(id, messageId), options),
109
+ };
97
110
  }
98
111
  /**
99
112
  * Makes a person, or finds the one your `external_id` already names.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumavox/server",
3
- "version": "0.32.0",
3
+ "version": "0.37.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",