@segmentstream/ontology 0.148.0 → 0.149.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/CHANGELOG.md +29 -0
- package/README.md +24 -15
- package/dist/analyze.d.ts +11 -3
- package/dist/analyze.js +21 -4
- package/dist/diagnostics.d.ts +3 -3
- package/dist/diagnostics.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/manifest.d.ts +53 -5
- package/dist/manifest.js +34 -2
- package/dist/migrate/model.d.ts +14 -2
- package/dist/migrate/plan.js +1 -1
- package/dist/migrate/preview.js +4 -1
- package/dist/migrate/storage.d.ts +15 -3
- package/dist/migrate/storage.js +86 -3
- package/dist/runtime/agents.js +2 -0
- package/dist/runtime/chat-messages.d.ts +233 -0
- package/dist/runtime/chat-messages.js +523 -0
- package/dist/service/agent/archive-routes.d.ts +2 -0
- package/dist/service/agent/archive-routes.js +2 -1
- package/dist/service/agent/chat-archive.d.ts +12 -3
- package/dist/service/agent/chat-archive.js +5 -1
- package/dist/service/agent/chat-message-routes.d.ts +124 -0
- package/dist/service/agent/chat-message-routes.js +235 -0
- package/dist/service/agent/server.d.ts +5 -1
- package/dist/service/agent/server.js +15 -0
- package/dist/service/chat/local-reads.d.ts +71 -0
- package/dist/service/chat/local-reads.js +148 -0
- package/dist/service/chat/reads.js +7 -0
- package/dist/service/chat/routes.js +4 -1
- package/dist/service/chat/schemas.d.ts +5 -0
- package/dist/service/chat/schemas.js +5 -0
- package/dist/service/cron-secret.d.ts +6 -0
- package/dist/service/cron-secret.js +14 -0
- package/dist/service/mcp/server.js +4 -2
- package/dist/service/runtime-contract.d.ts +2 -0
- package/dist/service/schemas.d.ts +8 -2
- package/dist/service/service.js +4 -1
- package/dist/service/workflows.js +2 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.149.0
|
|
4
|
+
|
|
5
|
+
The ontology keeps the chats' messages in the workspace's own database: the system table
|
|
6
|
+
`_chat_messages`, beside `agent_chat`, one row per message with its latest state. Deploying creates
|
|
7
|
+
it, also with an unchanged ontology, and a preview starts with it empty. The agent records into it
|
|
8
|
+
from the agent SDK release that uses it; until then nothing changes, and chats stay in the
|
|
9
|
+
platform's chat archive.
|
|
10
|
+
|
|
11
|
+
`chat_history`, `chat_search` and `POST /api/ontology/chat/history` read a chat from the
|
|
12
|
+
workspace's database once it holds the chat's messages, and from the platform's chat archive
|
|
13
|
+
before, with the same readers: a group's for members with `agent_chat:read` or in the group, a
|
|
14
|
+
private message for the people it was written to, and an inbox chat for staff within
|
|
15
|
+
`agent_chat:read`'s scope. The page keeps its shape; each message read from the workspace's
|
|
16
|
+
database also carries `id`, `direction`, `author`, `sender`, `parts`, `files`, `reply_to`,
|
|
17
|
+
`reactions`, `edited`, `deleted`, `delivery`, `disposition` and `reason`, and its `sequence` is its
|
|
18
|
+
revision. `chat_history` takes `after`, a revision, and answers the chat's messages changed since,
|
|
19
|
+
oldest change first, for a page that polls.
|
|
20
|
+
|
|
21
|
+
`defineOntology({ chat: { retentionDays } })` declares how many days the workspace keeps its chats'
|
|
22
|
+
messages: whole days from 1 to 3650, 365 by default, written into the manifest only when declared,
|
|
23
|
+
also without a chat channel. `check` reports `invalid-chat` for any other value. The service
|
|
24
|
+
deletes older messages from the workspace's database once a day; a sent message keeps only its
|
|
25
|
+
idempotency key and outcome, so a replay of the key never sends twice. The manifest is version 16,
|
|
26
|
+
which tells Cloud to schedule that purge as one of the project's cron jobs, with or without
|
|
27
|
+
workflows.
|
|
28
|
+
|
|
29
|
+
The agent's runtime records, changes and reads messages through new routes under
|
|
30
|
+
`/api/ontology/agent/chats/messages`, with the deployment's runtime token, as it reports chats.
|
|
31
|
+
|
|
3
32
|
## 0.148.0
|
|
4
33
|
|
|
5
34
|
A connection request in an action or workflow step can send a stored file as its body: pass
|
package/README.md
CHANGED
|
@@ -1394,18 +1394,22 @@ task header on any other route are a 403.
|
|
|
1394
1394
|
|
|
1395
1395
|
Without either header the agent may call only the agent routes:
|
|
1396
1396
|
|
|
1397
|
-
| Route | Caller | Does
|
|
1398
|
-
| ------------------------------------------------------------- | ------ |
|
|
1399
|
-
| `POST /api/ontology/agent/pairings` | agent | `{ provider, external_id, display? }` → `{ code, expires_at }`
|
|
1400
|
-
| `GET /api/ontology/agent/pairings/{code}` | member | `{ provider, display, expires_at }`, for the connect page
|
|
1401
|
-
| `POST /api/ontology/agent/pairings/{code}/approve` | member | Pairs the account with the member → `{ identity }`
|
|
1402
|
-
| `POST /api/ontology/agent/identities/resolve` | agent | Admission and turn limits; see below
|
|
1403
|
-
| `POST /api/ontology/agent/identities/notice` | agent | `{ provider, external_id, sha256, version? }` acknowledges notice delivery: 204
|
|
1404
|
-
| `GET /api/ontology/agent/identities/{provider}/{external_id}` | agent | `{ user: { id, name }, roles, agent_tools }`; 404 unpaired, 403 revoked, inactive
|
|
1405
|
-
| `GET /api/ontology/agent/identities` | member | `{ identities }`: the member's live identities
|
|
1406
|
-
| `DELETE /api/ontology/agent/identities/{id}` | member | Revokes one of them: 204
|
|
1407
|
-
| `POST /api/ontology/agent/chats/seen` | agent | `{ provider, externalId, title, memberId?, leftMemberId?, agentLeft?, migratedFrom? }` → `{ id, title, purpose, whenToUse, handled? }`
|
|
1408
|
-
| `POST /api/ontology/agent/chats/handoff` | agent | `{ provider, externalId, memberId, reason }` → `{ id, handoffAt, handled? }`; 404 for a chat staff do not take over
|
|
1397
|
+
| Route | Caller | Does |
|
|
1398
|
+
| ------------------------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1399
|
+
| `POST /api/ontology/agent/pairings` | agent | `{ provider, external_id, display? }` → `{ code, expires_at }` |
|
|
1400
|
+
| `GET /api/ontology/agent/pairings/{code}` | member | `{ provider, display, expires_at }`, for the connect page |
|
|
1401
|
+
| `POST /api/ontology/agent/pairings/{code}/approve` | member | Pairs the account with the member → `{ identity }` |
|
|
1402
|
+
| `POST /api/ontology/agent/identities/resolve` | agent | Admission and turn limits; see below |
|
|
1403
|
+
| `POST /api/ontology/agent/identities/notice` | agent | `{ provider, external_id, sha256, version? }` acknowledges notice delivery: 204 |
|
|
1404
|
+
| `GET /api/ontology/agent/identities/{provider}/{external_id}` | agent | `{ user: { id, name }, roles, agent_tools }`; 404 unpaired, 403 revoked, inactive |
|
|
1405
|
+
| `GET /api/ontology/agent/identities` | member | `{ identities }`: the member's live identities |
|
|
1406
|
+
| `DELETE /api/ontology/agent/identities/{id}` | member | Revokes one of them: 204 |
|
|
1407
|
+
| `POST /api/ontology/agent/chats/seen` | agent | `{ provider, externalId, title, memberId?, leftMemberId?, agentLeft?, migratedFrom? }` → `{ id, title, purpose, whenToUse, handled? }` |
|
|
1408
|
+
| `POST /api/ontology/agent/chats/handoff` | agent | `{ provider, externalId, memberId, reason }` → `{ id, handoffAt, handled? }`; 404 for a chat staff do not take over |
|
|
1409
|
+
| `POST /api/ontology/agent/chats/messages` | agent | Records one message in `_chat_messages`, once by `(channel, chatId, messageId)` and by `operation` → `{ id, first }`; 409 `operation_conflict` for a replay with another `fingerprint` |
|
|
1410
|
+
| `POST /api/ontology/agent/chats/messages/change` | agent | One change to a message: `edit`, `delete`, `reaction`, `status`, `disposition`, `sent` (by `operation`) or `meta` → `{ applied }` |
|
|
1411
|
+
| `POST /api/ontology/agent/chats/messages/read` | agent | A chat's messages before a cursor, after a `revision`, by `messageId`, or the `pending` sends → `{ messages, nextCursor }` |
|
|
1412
|
+
| `GET /api/ontology/agent/chats/purge` | cron | With the project's cron secret, deletes the messages older than `chat.retentionDays` → `{ deleted, scrubbed, more }` |
|
|
1409
1413
|
|
|
1410
1414
|
A pairing code is eight characters without look-alikes (no 0, O, 1, I or L), stored as its
|
|
1411
1415
|
SHA-256, valid ten minutes and used once. Each instance allows a client address 60 new
|
|
@@ -1625,10 +1629,15 @@ history_recorded }`; private chats may have no URL. A receipt-write failure leav
|
|
|
1625
1629
|
`history_recorded: false` without sending again. An older archive lacking the claim protocol
|
|
1626
1630
|
cannot authorize delivery. Local provider proxies alone cannot replace the production archive.
|
|
1627
1631
|
|
|
1628
|
-
`chat_history({ chat, before?, limit? })` and `chat_search` read
|
|
1632
|
+
`chat_history({ chat, before?, after?, limit? })` and `chat_search` read a chat with independent
|
|
1629
1633
|
chat authorization: a member reads the group chats they are in (the chat's `members`,
|
|
1630
|
-
like its attachments), `agent_chat:read` reads every group, and a private
|
|
1631
|
-
|
|
1634
|
+
like its attachments), `agent_chat:read` reads every group, and a private message is read by the
|
|
1635
|
+
participants it names. A posting service cannot read member chats. They read the workspace's
|
|
1636
|
+
`_chat_messages` once it holds the chat, with each message's `direction`, `author`, `sender`,
|
|
1637
|
+
`parts`, `files`, `reply_to`, `reactions`, `edited`, `deleted`, `delivery`, `disposition` and
|
|
1638
|
+
`reason` beside the archive's fields, and the platform's chat archive before; `after`, a revision,
|
|
1639
|
+
reads the chat's changes since. `chat.retentionDays` (1–3650, 365 by default) sets how long the
|
|
1640
|
+
workspace keeps them. The canonical
|
|
1632
1641
|
REST facade is `/api/ontology/chat/{list,history,search,actions/post_message}`; the post action
|
|
1633
1642
|
uses the standard `{ input, options?: { validate_only? } }` envelope and action response.
|
|
1634
1643
|
Validation checks eligibility and exact text without reserving or sending.
|
package/dist/analyze.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChatAttributionSettings, InboxOptions } from "./chat.js";
|
|
2
2
|
import { type ChatKind } from "./chat-channel.js";
|
|
3
|
-
import type
|
|
3
|
+
import { type ChatManifestInput } from "./manifest.js";
|
|
4
4
|
import { Schema } from "effect";
|
|
5
5
|
import { type Action, type ActionHints } from "./action.js";
|
|
6
6
|
import { type AnyConnectionHandle } from "./connection.js";
|
|
@@ -266,7 +266,10 @@ export interface ChatChannelConfig {
|
|
|
266
266
|
readonly kind?: ChatKind;
|
|
267
267
|
readonly connection?: AnyConnectionHandle;
|
|
268
268
|
}
|
|
269
|
-
/**
|
|
269
|
+
/**
|
|
270
|
+
* `chat` of {@link OntologyConfig}: the agent's channels by name, the post attribution, and how
|
|
271
|
+
* long the workspace keeps its chats' messages.
|
|
272
|
+
*/
|
|
270
273
|
export interface ChatConfig {
|
|
271
274
|
readonly telegram?: {
|
|
272
275
|
readonly connection: AnyConnectionHandle;
|
|
@@ -281,8 +284,13 @@ export interface ChatConfig {
|
|
|
281
284
|
readonly connection: AnyConnectionHandle;
|
|
282
285
|
};
|
|
283
286
|
readonly attribution?: ChatAttributionSettings;
|
|
287
|
+
/**
|
|
288
|
+
* How many days the workspace keeps its chats' messages, from 1 to 3650; 365 when absent. Older
|
|
289
|
+
* messages are deleted from the workspace's database, and a send's row keeps only its key.
|
|
290
|
+
*/
|
|
291
|
+
readonly retentionDays?: number;
|
|
284
292
|
/** A channel of another name, such as `sales_whatsapp`, with its `kind`. */
|
|
285
|
-
readonly [name: string]: ChatChannelConfig | ChatAttributionSettings | undefined;
|
|
293
|
+
readonly [name: string]: ChatChannelConfig | ChatAttributionSettings | number | undefined;
|
|
286
294
|
}
|
|
287
295
|
/**
|
|
288
296
|
* Resolves an ontology definition and checks it. It never throws: every problem, including a thunk
|
package/dist/analyze.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { validateBrowserSignIn } from "./sign-in.js";
|
|
2
2
|
import { CHAT_CHANNEL_KINDS, CHAT_CHANNEL_NAME, CHAT_KINDS, chatChannelKind, isChatKind, WORKSPACE_CHANNEL_KIND, workspaceChannelOf, } from "./chat-channel.js";
|
|
3
|
+
import { CHAT_RETENTION_DAYS } from "./manifest.js";
|
|
3
4
|
import { checkWarehouseSource } from "./warehouse-backed.js";
|
|
4
5
|
import { Result, Schema } from "effect";
|
|
5
6
|
import { BLOB_UPLOAD_ANNOTATION } from "./blob.js";
|
|
@@ -43,10 +44,12 @@ const REVIEW_ONLY_CHAT_PROVIDERS = new Set(["email"]);
|
|
|
43
44
|
* workspace channel, which always has a name of its own.
|
|
44
45
|
*/
|
|
45
46
|
const RESERVED_CHAT_NAMES = new Set(["web", "task", WORKSPACE_CHANNEL_KIND]);
|
|
47
|
+
/** The keys of `chat` that are settings, not channels. */
|
|
48
|
+
const CHAT_SETTINGS = new Set(["attribution", "retentionDays"]);
|
|
46
49
|
/** Whether `chat` declares a channel of `kind`: the one named after it, or another of the kind. */
|
|
47
50
|
function declaresChatKind(chat, kind) {
|
|
48
51
|
return (isPlainObject(chat) &&
|
|
49
|
-
Object.entries(chat).some(([name, value]) => name
|
|
52
|
+
Object.entries(chat).some(([name, value]) => !CHAT_SETTINGS.has(name) &&
|
|
50
53
|
value !== undefined &&
|
|
51
54
|
chatChannelKind(chat, name) === kind));
|
|
52
55
|
}
|
|
@@ -104,7 +107,7 @@ export function analyze(config, options = {}) {
|
|
|
104
107
|
};
|
|
105
108
|
const inbox = inboxOptions(config.inbox, declaredRoles, guest !== undefined, isPlainObject(config.chat)
|
|
106
109
|
? Object.entries(config.chat)
|
|
107
|
-
.filter(([name, channel]) => name
|
|
110
|
+
.filter(([name, channel]) => !CHAT_SETTINGS.has(name) && channel !== undefined)
|
|
108
111
|
.map(([name]) => name)
|
|
109
112
|
: [], report);
|
|
110
113
|
const discovery = config.discovery;
|
|
@@ -171,7 +174,7 @@ export function analyze(config, options = {}) {
|
|
|
171
174
|
let chat;
|
|
172
175
|
if (config.chat !== undefined) {
|
|
173
176
|
const entries = isPlainObject(config.chat)
|
|
174
|
-
? Object.entries(config.chat).filter(([name, value]) => name
|
|
177
|
+
? Object.entries(config.chat).filter(([name, value]) => !CHAT_SETTINGS.has(name) && value !== undefined)
|
|
175
178
|
: [];
|
|
176
179
|
const unknown = isPlainObject(config.chat)
|
|
177
180
|
? entries.find(([name]) => !CHAT_CHANNEL_NAME.test(name) || RESERVED_CHAT_NAMES.has(name))?.[0]
|
|
@@ -198,7 +201,7 @@ export function analyze(config, options = {}) {
|
|
|
198
201
|
const unlisted = handles.find(([, handle]) => !(config.connections ?? []).includes(handle));
|
|
199
202
|
const shared = handles.find(([, handle], index) => handles.findIndex(([, other]) => other === handle) !== index);
|
|
200
203
|
if (unknown !== undefined) {
|
|
201
|
-
report("invalid-connection", "chat", `chat accepts attribution and channels by the agent's names for them: ` +
|
|
204
|
+
report("invalid-connection", "chat", `chat accepts attribution, retentionDays and channels by the agent's names for them: ` +
|
|
202
205
|
`${CHAT_PROVIDER_KEYS.join(", ")}, or another lower-case name with its kind; ` +
|
|
203
206
|
`web and task are the agent's own, and ${WORKSPACE_CHANNEL_KIND} is a kind.`);
|
|
204
207
|
}
|
|
@@ -271,6 +274,20 @@ export function analyze(config, options = {}) {
|
|
|
271
274
|
report("invalid-connection", "chat.attribution", "Attribution requires a template containing {name} (at most 512 characters) " +
|
|
272
275
|
"and a separator of at most 100 characters.");
|
|
273
276
|
}
|
|
277
|
+
const retentionDays = isPlainObject(config.chat) ? config.chat.retentionDays : undefined;
|
|
278
|
+
if (retentionDays !== undefined) {
|
|
279
|
+
if (typeof retentionDays !== "number" ||
|
|
280
|
+
!Number.isInteger(retentionDays) ||
|
|
281
|
+
retentionDays < CHAT_RETENTION_DAYS.minimum ||
|
|
282
|
+
retentionDays > CHAT_RETENTION_DAYS.maximum) {
|
|
283
|
+
report("invalid-chat", "chat.retentionDays", `chat.retentionDays takes whole days from ${CHAT_RETENTION_DAYS.minimum} to ` +
|
|
284
|
+
`${CHAT_RETENTION_DAYS.maximum}.`);
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
// Written only when declared, also without channels: the messages are kept whatever they are.
|
|
288
|
+
chat = { ...chat, retentionDays };
|
|
289
|
+
}
|
|
290
|
+
}
|
|
274
291
|
checkEntityIdentities(resolved, report);
|
|
275
292
|
checkMemberNames(resolved, report);
|
|
276
293
|
const toolsets = resolveToolsets(original.toolsets, resolved, connections, report);
|
package/dist/diagnostics.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
export declare const DIAGNOSTIC_CODES: readonly ["invalid-source", "missing-column", "invalid-column", "invalid-scope", "invalid-scope-path", "scope-reads-all", "scope-unused", "scope-member-overlap", "source-with-actions", "source-with-index", "invalid-metric", "unknown-metric", "circular-metric", "invalid-join", "missing-join", "invalid-entity", "invalid-property", "invalid-relationship", "invalid-actions", "invalid-action", "invalid-action-input", "invalid-role", "invalid-name", "reserved-name", "duplicate-name", "invalid-entity-id", "duplicate-entity-id", "missing-label", "missing-description", "invalid-title", "invalid-options", "invalid-default", "invalid-constraint", "unknown-relationship-target", "inverse-collision", "invalid-on-delete", "invalid-phrase", "invalid-index", "unknown-reference", "invalid-renamed-from", "earlier-name", "invalid-guide", "invalid-writes", "generated-update-empty", "managed-without-effect", "missing-permissions", "invalid-permission", "unknown-permission", "removed-allow", "unreachable-action", "wildcard-permission", "invalid-sign-in", "invalid-inbox", "invalid-connection", "invalid-feedback", "invalid-discovery", "invalid-email", "feedback-unanswerable", "feedback-unreportable", "agent-tools-implicit", "named-secret-deprecated", "unknown-connection", "unused-connection", "invalid-prepare", "invalid-tool-name", "invalid-toolset", "toolset-lock-mismatch", "invalid-alignment", "single-entity-model-metric", "invalid-workflow", "workflow_role_unknown", "workflow_role_is_member", "workflow_role_grants_nothing", "workflow_role_wildcard", "workflow_role_scoped", "workflow_cron_never_fires", "workflow_input_invalid", "workflow_cron_invalid", "workflow_run_missing", "invalid-trigger", "trigger_action_unknown", "trigger_function_async", "trigger_runs_invalid", "workflow_trigger_limit_exceeded", "workflow_webhook_duplicate", "workflow_webhook_input_invalid", "workflow_webhook_mixed_triggers", "workflow_webhook_signature_invalid", "workflow_webhook_verification_invalid", "workflow_webhook_headers_invalid", "workflow_webhook_limit_exceeded"];
|
|
2
|
+
export declare const DIAGNOSTIC_CODES: readonly ["invalid-source", "missing-column", "invalid-column", "invalid-scope", "invalid-scope-path", "scope-reads-all", "scope-unused", "scope-member-overlap", "source-with-actions", "source-with-index", "invalid-metric", "unknown-metric", "circular-metric", "invalid-join", "missing-join", "invalid-entity", "invalid-property", "invalid-relationship", "invalid-actions", "invalid-action", "invalid-action-input", "invalid-role", "invalid-name", "reserved-name", "duplicate-name", "invalid-entity-id", "duplicate-entity-id", "missing-label", "missing-description", "invalid-title", "invalid-options", "invalid-default", "invalid-constraint", "unknown-relationship-target", "inverse-collision", "invalid-on-delete", "invalid-phrase", "invalid-index", "unknown-reference", "invalid-renamed-from", "earlier-name", "invalid-guide", "invalid-writes", "generated-update-empty", "managed-without-effect", "missing-permissions", "invalid-permission", "unknown-permission", "removed-allow", "unreachable-action", "wildcard-permission", "invalid-sign-in", "invalid-inbox", "invalid-chat", "invalid-connection", "invalid-feedback", "invalid-discovery", "invalid-email", "feedback-unanswerable", "feedback-unreportable", "agent-tools-implicit", "named-secret-deprecated", "unknown-connection", "unused-connection", "invalid-prepare", "invalid-tool-name", "invalid-toolset", "toolset-lock-mismatch", "invalid-alignment", "single-entity-model-metric", "invalid-workflow", "workflow_role_unknown", "workflow_role_is_member", "workflow_role_grants_nothing", "workflow_role_wildcard", "workflow_role_scoped", "workflow_cron_never_fires", "workflow_input_invalid", "workflow_cron_invalid", "workflow_run_missing", "invalid-trigger", "trigger_action_unknown", "trigger_function_async", "trigger_runs_invalid", "workflow_trigger_limit_exceeded", "workflow_webhook_duplicate", "workflow_webhook_input_invalid", "workflow_webhook_mixed_triggers", "workflow_webhook_signature_invalid", "workflow_webhook_verification_invalid", "workflow_webhook_headers_invalid", "workflow_webhook_limit_exceeded"];
|
|
3
3
|
export type DiagnosticCode = (typeof DIAGNOSTIC_CODES)[number];
|
|
4
4
|
/** A problem `check` found in an ontology definition. */
|
|
5
5
|
export declare const Diagnostic: Schema.Struct<{
|
|
6
6
|
readonly severity: Schema.Literals<readonly ["error", "warning", "info"]>;
|
|
7
|
-
readonly code: Schema.Literals<readonly ["invalid-source", "missing-column", "invalid-column", "invalid-scope", "invalid-scope-path", "scope-reads-all", "scope-unused", "scope-member-overlap", "source-with-actions", "source-with-index", "invalid-metric", "unknown-metric", "circular-metric", "invalid-join", "missing-join", "invalid-entity", "invalid-property", "invalid-relationship", "invalid-actions", "invalid-action", "invalid-action-input", "invalid-role", "invalid-name", "reserved-name", "duplicate-name", "invalid-entity-id", "duplicate-entity-id", "missing-label", "missing-description", "invalid-title", "invalid-options", "invalid-default", "invalid-constraint", "unknown-relationship-target", "inverse-collision", "invalid-on-delete", "invalid-phrase", "invalid-index", "unknown-reference", "invalid-renamed-from", "earlier-name", "invalid-guide", "invalid-writes", "generated-update-empty", "managed-without-effect", "missing-permissions", "invalid-permission", "unknown-permission", "removed-allow", "unreachable-action", "wildcard-permission", "invalid-sign-in", "invalid-inbox", "invalid-connection", "invalid-feedback", "invalid-discovery", "invalid-email", "feedback-unanswerable", "feedback-unreportable", "agent-tools-implicit", "named-secret-deprecated", "unknown-connection", "unused-connection", "invalid-prepare", "invalid-tool-name", "invalid-toolset", "toolset-lock-mismatch", "invalid-alignment", "single-entity-model-metric", "invalid-workflow", "workflow_role_unknown", "workflow_role_is_member", "workflow_role_grants_nothing", "workflow_role_wildcard", "workflow_role_scoped", "workflow_cron_never_fires", "workflow_input_invalid", "workflow_cron_invalid", "workflow_run_missing", "invalid-trigger", "trigger_action_unknown", "trigger_function_async", "trigger_runs_invalid", "workflow_trigger_limit_exceeded", "workflow_webhook_duplicate", "workflow_webhook_input_invalid", "workflow_webhook_mixed_triggers", "workflow_webhook_signature_invalid", "workflow_webhook_verification_invalid", "workflow_webhook_headers_invalid", "workflow_webhook_limit_exceeded"]>;
|
|
7
|
+
readonly code: Schema.Literals<readonly ["invalid-source", "missing-column", "invalid-column", "invalid-scope", "invalid-scope-path", "scope-reads-all", "scope-unused", "scope-member-overlap", "source-with-actions", "source-with-index", "invalid-metric", "unknown-metric", "circular-metric", "invalid-join", "missing-join", "invalid-entity", "invalid-property", "invalid-relationship", "invalid-actions", "invalid-action", "invalid-action-input", "invalid-role", "invalid-name", "reserved-name", "duplicate-name", "invalid-entity-id", "duplicate-entity-id", "missing-label", "missing-description", "invalid-title", "invalid-options", "invalid-default", "invalid-constraint", "unknown-relationship-target", "inverse-collision", "invalid-on-delete", "invalid-phrase", "invalid-index", "unknown-reference", "invalid-renamed-from", "earlier-name", "invalid-guide", "invalid-writes", "generated-update-empty", "managed-without-effect", "missing-permissions", "invalid-permission", "unknown-permission", "removed-allow", "unreachable-action", "wildcard-permission", "invalid-sign-in", "invalid-inbox", "invalid-chat", "invalid-connection", "invalid-feedback", "invalid-discovery", "invalid-email", "feedback-unanswerable", "feedback-unreportable", "agent-tools-implicit", "named-secret-deprecated", "unknown-connection", "unused-connection", "invalid-prepare", "invalid-tool-name", "invalid-toolset", "toolset-lock-mismatch", "invalid-alignment", "single-entity-model-metric", "invalid-workflow", "workflow_role_unknown", "workflow_role_is_member", "workflow_role_grants_nothing", "workflow_role_wildcard", "workflow_role_scoped", "workflow_cron_never_fires", "workflow_input_invalid", "workflow_cron_invalid", "workflow_run_missing", "invalid-trigger", "trigger_action_unknown", "trigger_function_async", "trigger_runs_invalid", "workflow_trigger_limit_exceeded", "workflow_webhook_duplicate", "workflow_webhook_input_invalid", "workflow_webhook_mixed_triggers", "workflow_webhook_signature_invalid", "workflow_webhook_verification_invalid", "workflow_webhook_headers_invalid", "workflow_webhook_limit_exceeded"]>;
|
|
8
8
|
/** Where the problem is, for example `lead.properties.status.options[1]`. */
|
|
9
9
|
readonly path: Schema.String;
|
|
10
10
|
readonly message: Schema.String;
|
|
@@ -14,7 +14,7 @@ declare const InvalidOntology_base: Schema.Class<InvalidOntology, Schema.TaggedS
|
|
|
14
14
|
readonly message: Schema.String;
|
|
15
15
|
readonly diagnostics: Schema.$Array<Schema.Struct<{
|
|
16
16
|
readonly severity: Schema.Literals<readonly ["error", "warning", "info"]>;
|
|
17
|
-
readonly code: Schema.Literals<readonly ["invalid-source", "missing-column", "invalid-column", "invalid-scope", "invalid-scope-path", "scope-reads-all", "scope-unused", "scope-member-overlap", "source-with-actions", "source-with-index", "invalid-metric", "unknown-metric", "circular-metric", "invalid-join", "missing-join", "invalid-entity", "invalid-property", "invalid-relationship", "invalid-actions", "invalid-action", "invalid-action-input", "invalid-role", "invalid-name", "reserved-name", "duplicate-name", "invalid-entity-id", "duplicate-entity-id", "missing-label", "missing-description", "invalid-title", "invalid-options", "invalid-default", "invalid-constraint", "unknown-relationship-target", "inverse-collision", "invalid-on-delete", "invalid-phrase", "invalid-index", "unknown-reference", "invalid-renamed-from", "earlier-name", "invalid-guide", "invalid-writes", "generated-update-empty", "managed-without-effect", "missing-permissions", "invalid-permission", "unknown-permission", "removed-allow", "unreachable-action", "wildcard-permission", "invalid-sign-in", "invalid-inbox", "invalid-connection", "invalid-feedback", "invalid-discovery", "invalid-email", "feedback-unanswerable", "feedback-unreportable", "agent-tools-implicit", "named-secret-deprecated", "unknown-connection", "unused-connection", "invalid-prepare", "invalid-tool-name", "invalid-toolset", "toolset-lock-mismatch", "invalid-alignment", "single-entity-model-metric", "invalid-workflow", "workflow_role_unknown", "workflow_role_is_member", "workflow_role_grants_nothing", "workflow_role_wildcard", "workflow_role_scoped", "workflow_cron_never_fires", "workflow_input_invalid", "workflow_cron_invalid", "workflow_run_missing", "invalid-trigger", "trigger_action_unknown", "trigger_function_async", "trigger_runs_invalid", "workflow_trigger_limit_exceeded", "workflow_webhook_duplicate", "workflow_webhook_input_invalid", "workflow_webhook_mixed_triggers", "workflow_webhook_signature_invalid", "workflow_webhook_verification_invalid", "workflow_webhook_headers_invalid", "workflow_webhook_limit_exceeded"]>;
|
|
17
|
+
readonly code: Schema.Literals<readonly ["invalid-source", "missing-column", "invalid-column", "invalid-scope", "invalid-scope-path", "scope-reads-all", "scope-unused", "scope-member-overlap", "source-with-actions", "source-with-index", "invalid-metric", "unknown-metric", "circular-metric", "invalid-join", "missing-join", "invalid-entity", "invalid-property", "invalid-relationship", "invalid-actions", "invalid-action", "invalid-action-input", "invalid-role", "invalid-name", "reserved-name", "duplicate-name", "invalid-entity-id", "duplicate-entity-id", "missing-label", "missing-description", "invalid-title", "invalid-options", "invalid-default", "invalid-constraint", "unknown-relationship-target", "inverse-collision", "invalid-on-delete", "invalid-phrase", "invalid-index", "unknown-reference", "invalid-renamed-from", "earlier-name", "invalid-guide", "invalid-writes", "generated-update-empty", "managed-without-effect", "missing-permissions", "invalid-permission", "unknown-permission", "removed-allow", "unreachable-action", "wildcard-permission", "invalid-sign-in", "invalid-inbox", "invalid-chat", "invalid-connection", "invalid-feedback", "invalid-discovery", "invalid-email", "feedback-unanswerable", "feedback-unreportable", "agent-tools-implicit", "named-secret-deprecated", "unknown-connection", "unused-connection", "invalid-prepare", "invalid-tool-name", "invalid-toolset", "toolset-lock-mismatch", "invalid-alignment", "single-entity-model-metric", "invalid-workflow", "workflow_role_unknown", "workflow_role_is_member", "workflow_role_grants_nothing", "workflow_role_wildcard", "workflow_role_scoped", "workflow_cron_never_fires", "workflow_input_invalid", "workflow_cron_invalid", "workflow_run_missing", "invalid-trigger", "trigger_action_unknown", "trigger_function_async", "trigger_runs_invalid", "workflow_trigger_limit_exceeded", "workflow_webhook_duplicate", "workflow_webhook_input_invalid", "workflow_webhook_mixed_triggers", "workflow_webhook_signature_invalid", "workflow_webhook_verification_invalid", "workflow_webhook_headers_invalid", "workflow_webhook_limit_exceeded"]>;
|
|
18
18
|
/** Where the problem is, for example `lead.properties.status.options[1]`. */
|
|
19
19
|
readonly path: Schema.String;
|
|
20
20
|
readonly message: Schema.String;
|
package/dist/diagnostics.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export type { ActionsBuilder, AnyEntity, ActionHandle, ActionInvoker, MetricQuer
|
|
|
24
24
|
export { ActionRejected, BatchErrorDetails, Conflict, DeploymentInterrupted, DeploymentSwitching, LimitErrorDetails, NotFound, PermissionDenied, ScopeViolated, } from "./errors.js";
|
|
25
25
|
export type { ActionError } from "./errors.js";
|
|
26
26
|
export { browserAuthenticationCompatible } from "./manifest-compatibility.js";
|
|
27
|
-
export { ActionManifest, actionConnectionKeys, canonicalJson, ConnectionManifest, EntityManifest, EntityPermissionsManifest, decodeManifestDocument, encodeManifest, formatManifest, IndexManifest, isValueMatched, MANIFEST_VERSION, manifestHash, ModelMetricManifest, OntologyManifest, OntologyManifestWire, PropertyManifest, RelationshipManifest, RoleManifest, ActionTriggerManifest, ScopeManifest, CronTriggerManifest, isActionTrigger, isCronTrigger, isWebhookTrigger, OtherTriggerManifest, WebhookTriggerManifest, WorkflowManifest, WorkflowTriggerManifest, SelectOptionManifest, SignInManifest, GuestManifest, guestOf, signInPolicyOf, channelPolicyOf, signUpOriginsOf, inboxRolesOf, takeoverChannelsOf, signUpRolesOf, } from "./manifest.js";
|
|
27
|
+
export { ActionManifest, actionConnectionKeys, canonicalJson, ConnectionManifest, EntityManifest, EntityPermissionsManifest, decodeManifestDocument, encodeManifest, formatManifest, IndexManifest, isValueMatched, MANIFEST_VERSION, manifestHash, ModelMetricManifest, OntologyManifest, OntologyManifestWire, PropertyManifest, RelationshipManifest, RoleManifest, ActionTriggerManifest, ScopeManifest, CronTriggerManifest, isActionTrigger, isCronTrigger, isWebhookTrigger, OtherTriggerManifest, WebhookTriggerManifest, WorkflowManifest, WorkflowTriggerManifest, SelectOptionManifest, SignInManifest, GuestManifest, guestOf, signInPolicyOf, channelPolicyOf, signUpOriginsOf, inboxRolesOf, takeoverChannelsOf, signUpRolesOf, CHAT_RETENTION_DAYS, chatRetentionDaysOf, } from "./manifest.js";
|
|
28
28
|
export { SYSTEM_PROPERTIES } from "./names.js";
|
|
29
29
|
export type { SystemProperty } from "./names.js";
|
|
30
30
|
export { isMe, isMeMarker, MAX_ME_HOPS, me, ME_KEY, MeMarker, mePathOf, meToWire, MeTypeId, } from "./me.js";
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ export { entity, isEntity } from "./entity.js";
|
|
|
13
13
|
export { isToolset, MCP_TOOL_NAME, TOOLSET_LOCK_VERSION, toolset, ToolsetLock, ToolsetLockTool, } from "./toolset.js";
|
|
14
14
|
export { ActionRejected, BatchErrorDetails, Conflict, DeploymentInterrupted, DeploymentSwitching, LimitErrorDetails, NotFound, PermissionDenied, ScopeViolated, } from "./errors.js";
|
|
15
15
|
export { browserAuthenticationCompatible } from "./manifest-compatibility.js";
|
|
16
|
-
export { ActionManifest, actionConnectionKeys, canonicalJson, ConnectionManifest, EntityManifest, EntityPermissionsManifest, decodeManifestDocument, encodeManifest, formatManifest, IndexManifest, isValueMatched, MANIFEST_VERSION, manifestHash, ModelMetricManifest, OntologyManifest, OntologyManifestWire, PropertyManifest, RelationshipManifest, RoleManifest, ActionTriggerManifest, ScopeManifest, CronTriggerManifest, isActionTrigger, isCronTrigger, isWebhookTrigger, OtherTriggerManifest, WebhookTriggerManifest, WorkflowManifest, WorkflowTriggerManifest, SelectOptionManifest, SignInManifest, GuestManifest, guestOf, signInPolicyOf, channelPolicyOf, signUpOriginsOf, inboxRolesOf, takeoverChannelsOf, signUpRolesOf, } from "./manifest.js";
|
|
16
|
+
export { ActionManifest, actionConnectionKeys, canonicalJson, ConnectionManifest, EntityManifest, EntityPermissionsManifest, decodeManifestDocument, encodeManifest, formatManifest, IndexManifest, isValueMatched, MANIFEST_VERSION, manifestHash, ModelMetricManifest, OntologyManifest, OntologyManifestWire, PropertyManifest, RelationshipManifest, RoleManifest, ActionTriggerManifest, ScopeManifest, CronTriggerManifest, isActionTrigger, isCronTrigger, isWebhookTrigger, OtherTriggerManifest, WebhookTriggerManifest, WorkflowManifest, WorkflowTriggerManifest, SelectOptionManifest, SignInManifest, GuestManifest, guestOf, signInPolicyOf, channelPolicyOf, signUpOriginsOf, inboxRolesOf, takeoverChannelsOf, signUpRolesOf, CHAT_RETENTION_DAYS, chatRetentionDaysOf, } from "./manifest.js";
|
|
17
17
|
export { SYSTEM_PROPERTIES } from "./names.js";
|
|
18
18
|
export { isMe, isMeMarker, MAX_ME_HOPS, me, ME_KEY, MeMarker, mePathOf, meToWire, MeTypeId, } from "./me.js";
|
|
19
19
|
export { check, defineOntology } from "./ontology.js";
|
package/dist/manifest.d.ts
CHANGED
|
@@ -100,8 +100,13 @@ import { type ResolvedGuest, type ResolvedSignInOptions, type SignInPolicy } fro
|
|
|
100
100
|
* older publication check refuses the scheme. A signature may carry `generated: true` instead of
|
|
101
101
|
* `secret`: the platform derives the webhook's secret. Older readers find no secret name; an older
|
|
102
102
|
* publication check refuses it.
|
|
103
|
+
* Version 16 changes no other field: it marks an SDK whose service keeps the chats' messages in
|
|
104
|
+
* the workspace's own database and purges them at `/api/ontology/agent/chats/purge`, so
|
|
105
|
+
* publication adds a daily cron for that route. Within version 16, `chat` may carry
|
|
106
|
+
* `retention_days`, written only when declared, and then also without a channel: how many days
|
|
107
|
+
* the workspace keeps its chats' messages. Older readers ignore it and keep them 365 days.
|
|
103
108
|
*/
|
|
104
|
-
export declare const MANIFEST_VERSION =
|
|
109
|
+
export declare const MANIFEST_VERSION = 16;
|
|
105
110
|
/** The phrase used for a direction the author did not phrase. */
|
|
106
111
|
export declare const DEFAULT_PHRASE = "has";
|
|
107
112
|
export declare const SelectOptionManifest: Schema.Struct<{
|
|
@@ -1291,7 +1296,7 @@ export declare const OntologyManifestWire: Schema.encodeKeys<Schema.Struct<{
|
|
|
1291
1296
|
* with their kinds. `email`, within version 15, is the mailbox reviewed replies to mail leave
|
|
1292
1297
|
* from; no chat post goes to it, nor to another channel of its kind.
|
|
1293
1298
|
*/
|
|
1294
|
-
readonly chat: Schema.optionalKey<Schema.Struct<{
|
|
1299
|
+
readonly chat: Schema.optionalKey<Schema.encodeKeys<Schema.Struct<{
|
|
1295
1300
|
readonly telegram: Schema.optionalKey<Schema.Struct<{
|
|
1296
1301
|
readonly connection: Schema.String;
|
|
1297
1302
|
}>>;
|
|
@@ -1312,6 +1317,10 @@ export declare const OntologyManifestWire: Schema.encodeKeys<Schema.Struct<{
|
|
|
1312
1317
|
readonly template: Schema.optionalKey<Schema.String>;
|
|
1313
1318
|
readonly separator: Schema.optionalKey<Schema.String>;
|
|
1314
1319
|
}>>;
|
|
1320
|
+
/** How many days the workspace keeps its chats' messages; absent keeps them 365. */
|
|
1321
|
+
readonly retentionDays: Schema.optionalKey<Schema.Int>;
|
|
1322
|
+
}>, {
|
|
1323
|
+
readonly retentionDays: "retention_days";
|
|
1315
1324
|
}>>;
|
|
1316
1325
|
/**
|
|
1317
1326
|
* Whose private chats join the inbox, within version 15: the wire names of their roles, the
|
|
@@ -1631,6 +1640,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
|
|
|
1631
1640
|
readonly template?: string | undefined;
|
|
1632
1641
|
readonly separator?: string | undefined;
|
|
1633
1642
|
} | undefined;
|
|
1643
|
+
readonly retentionDays?: number | undefined;
|
|
1634
1644
|
} | undefined;
|
|
1635
1645
|
readonly workflows?: readonly {
|
|
1636
1646
|
readonly description: string;
|
|
@@ -1986,6 +1996,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
|
|
|
1986
1996
|
readonly template?: string | undefined;
|
|
1987
1997
|
readonly separator?: string | undefined;
|
|
1988
1998
|
} | undefined;
|
|
1999
|
+
readonly retentionDays?: number | undefined;
|
|
1989
2000
|
} | undefined;
|
|
1990
2001
|
readonly workflows?: readonly {
|
|
1991
2002
|
readonly description: string;
|
|
@@ -2341,6 +2352,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
|
|
|
2341
2352
|
readonly template?: string | undefined;
|
|
2342
2353
|
readonly separator?: string | undefined;
|
|
2343
2354
|
} | undefined;
|
|
2355
|
+
readonly retention_days?: number | undefined;
|
|
2344
2356
|
} | undefined;
|
|
2345
2357
|
readonly workflows?: readonly {
|
|
2346
2358
|
readonly description: string;
|
|
@@ -2696,6 +2708,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
|
|
|
2696
2708
|
readonly template?: string | undefined;
|
|
2697
2709
|
readonly separator?: string | undefined;
|
|
2698
2710
|
} | undefined;
|
|
2711
|
+
readonly retention_days?: number | undefined;
|
|
2699
2712
|
} | undefined;
|
|
2700
2713
|
readonly workflows?: readonly {
|
|
2701
2714
|
readonly description: string;
|
|
@@ -3204,7 +3217,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
|
|
|
3204
3217
|
* with their kinds. `email`, within version 15, is the mailbox reviewed replies to mail leave
|
|
3205
3218
|
* from; no chat post goes to it, nor to another channel of its kind.
|
|
3206
3219
|
*/
|
|
3207
|
-
readonly chat: Schema.optionalKey<Schema.Struct<{
|
|
3220
|
+
readonly chat: Schema.optionalKey<Schema.encodeKeys<Schema.Struct<{
|
|
3208
3221
|
readonly telegram: Schema.optionalKey<Schema.Struct<{
|
|
3209
3222
|
readonly connection: Schema.String;
|
|
3210
3223
|
}>>;
|
|
@@ -3225,6 +3238,10 @@ export declare const OntologyManifest: Schema.declareConstructor<{
|
|
|
3225
3238
|
readonly template: Schema.optionalKey<Schema.String>;
|
|
3226
3239
|
readonly separator: Schema.optionalKey<Schema.String>;
|
|
3227
3240
|
}>>;
|
|
3241
|
+
/** How many days the workspace keeps its chats' messages; absent keeps them 365. */
|
|
3242
|
+
readonly retentionDays: Schema.optionalKey<Schema.Int>;
|
|
3243
|
+
}>, {
|
|
3244
|
+
readonly retentionDays: "retention_days";
|
|
3228
3245
|
}>>;
|
|
3229
3246
|
/**
|
|
3230
3247
|
* Whose private chats join the inbox, within version 15: the wire names of their roles, the
|
|
@@ -3683,7 +3700,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
|
|
|
3683
3700
|
* with their kinds. `email`, within version 15, is the mailbox reviewed replies to mail leave
|
|
3684
3701
|
* from; no chat post goes to it, nor to another channel of its kind.
|
|
3685
3702
|
*/
|
|
3686
|
-
readonly chat: Schema.optionalKey<Schema.Struct<{
|
|
3703
|
+
readonly chat: Schema.optionalKey<Schema.encodeKeys<Schema.Struct<{
|
|
3687
3704
|
readonly telegram: Schema.optionalKey<Schema.Struct<{
|
|
3688
3705
|
readonly connection: Schema.String;
|
|
3689
3706
|
}>>;
|
|
@@ -3704,6 +3721,10 @@ export declare const OntologyManifest: Schema.declareConstructor<{
|
|
|
3704
3721
|
readonly template: Schema.optionalKey<Schema.String>;
|
|
3705
3722
|
readonly separator: Schema.optionalKey<Schema.String>;
|
|
3706
3723
|
}>>;
|
|
3724
|
+
/** How many days the workspace keeps its chats' messages; absent keeps them 365. */
|
|
3725
|
+
readonly retentionDays: Schema.optionalKey<Schema.Int>;
|
|
3726
|
+
}>, {
|
|
3727
|
+
readonly retentionDays: "retention_days";
|
|
3707
3728
|
}>>;
|
|
3708
3729
|
/**
|
|
3709
3730
|
* Whose private chats join the inbox, within version 15: the wire names of their roles, the
|
|
@@ -4015,6 +4036,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
|
|
|
4015
4036
|
readonly template?: string | undefined;
|
|
4016
4037
|
readonly separator?: string | undefined;
|
|
4017
4038
|
} | undefined;
|
|
4039
|
+
readonly retentionDays?: number | undefined;
|
|
4018
4040
|
} | undefined;
|
|
4019
4041
|
readonly workflows?: readonly {
|
|
4020
4042
|
readonly description: string;
|
|
@@ -4370,6 +4392,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
|
|
|
4370
4392
|
readonly template?: string | undefined;
|
|
4371
4393
|
readonly separator?: string | undefined;
|
|
4372
4394
|
} | undefined;
|
|
4395
|
+
readonly retentionDays?: number | undefined;
|
|
4373
4396
|
} | undefined;
|
|
4374
4397
|
readonly workflows?: readonly {
|
|
4375
4398
|
readonly description: string;
|
|
@@ -4731,6 +4754,7 @@ export declare const decodeManifestDocument: (value: unknown) => Effect.Effect<{
|
|
|
4731
4754
|
readonly template?: string | undefined;
|
|
4732
4755
|
readonly separator?: string | undefined;
|
|
4733
4756
|
} | undefined;
|
|
4757
|
+
readonly retentionDays?: number | undefined;
|
|
4734
4758
|
} | undefined;
|
|
4735
4759
|
readonly workflows?: readonly {
|
|
4736
4760
|
readonly description: string;
|
|
@@ -5086,6 +5110,7 @@ export declare const decodeManifestDocument: (value: unknown) => Effect.Effect<{
|
|
|
5086
5110
|
readonly template?: string | undefined;
|
|
5087
5111
|
readonly separator?: string | undefined;
|
|
5088
5112
|
} | undefined;
|
|
5113
|
+
readonly retentionDays?: number | undefined;
|
|
5089
5114
|
} | undefined;
|
|
5090
5115
|
readonly workflows?: readonly {
|
|
5091
5116
|
readonly description: string;
|
|
@@ -5315,6 +5340,25 @@ export declare function signInPolicyOf(manifest: Pick<OntologyManifest, "signIn"
|
|
|
5315
5340
|
* the channel is closed to sign-up: not a channel this reader knows, or no well-formed entry.
|
|
5316
5341
|
*/
|
|
5317
5342
|
export declare function signUpRolesOf(manifest: Pick<OntologyManifest, "signIn">, channel: string): ReadonlyArray<string> | undefined;
|
|
5343
|
+
/**
|
|
5344
|
+
* `chat.retentionDays` of `defineOntology`: how many days the workspace keeps its chats' messages,
|
|
5345
|
+
* a whole number in this range; 365 when the ontology declares none.
|
|
5346
|
+
*/
|
|
5347
|
+
export declare const CHAT_RETENTION_DAYS: {
|
|
5348
|
+
readonly default: 365;
|
|
5349
|
+
readonly minimum: 1;
|
|
5350
|
+
readonly maximum: 3650;
|
|
5351
|
+
};
|
|
5352
|
+
/**
|
|
5353
|
+
* The days the ontology declares it keeps its chats' messages, as {@link chatRetentionDaysOf}
|
|
5354
|
+
* reads them; `undefined` when it declares none.
|
|
5355
|
+
*/
|
|
5356
|
+
export declare function declaredChatRetentionDaysOf(manifest: Pick<OntologyManifest, "chat">): number | undefined;
|
|
5357
|
+
/**
|
|
5358
|
+
* How many days the workspace keeps its chats' messages: `chat.retentionDays` where it is a whole
|
|
5359
|
+
* number in range, else the default.
|
|
5360
|
+
*/
|
|
5361
|
+
export declare function chatRetentionDaysOf(manifest: Pick<OntologyManifest, "chat">): number;
|
|
5318
5362
|
/** The wire names of the roles whose people's private chats join the inbox; empty without one. */
|
|
5319
5363
|
export declare function inboxRolesOf(manifest: Pick<OntologyManifest, "inbox">): ReadonlySet<string>;
|
|
5320
5364
|
/** The channels whose private chats staff may take over from the agent; empty without any. */
|
|
@@ -5355,7 +5399,10 @@ export declare function manifestHash(manifest: Readonly<Record<string, unknown>>
|
|
|
5355
5399
|
* aggregates, top-level or inside arithmetic: `check` lets them name one property at most.
|
|
5356
5400
|
*/
|
|
5357
5401
|
export declare function metricsManifest(resolved: ResolvedEntity): ReadonlyArray<MetricManifest>;
|
|
5358
|
-
/**
|
|
5402
|
+
/**
|
|
5403
|
+
* `chat` as the manifest writes it: the channel of each kind, the other channels, attribution, and
|
|
5404
|
+
* how long the chats' messages are kept.
|
|
5405
|
+
*/
|
|
5359
5406
|
export interface ChatManifestInput {
|
|
5360
5407
|
readonly telegram?: {
|
|
5361
5408
|
readonly connection: string;
|
|
@@ -5374,6 +5421,7 @@ export interface ChatManifestInput {
|
|
|
5374
5421
|
readonly connection?: string;
|
|
5375
5422
|
}>>;
|
|
5376
5423
|
readonly attribution?: ChatAttributionSettings;
|
|
5424
|
+
readonly retentionDays?: number;
|
|
5377
5425
|
}
|
|
5378
5426
|
/** Builds the manifest of a resolved ontology that passed `check`. */
|
|
5379
5427
|
export declare function buildManifest(input: {
|
package/dist/manifest.js
CHANGED
|
@@ -101,8 +101,13 @@ import { CHANNEL_PROVIDERS, DEFAULT_SIGN_IN_POLICY, isGuestBotCheckScheme, isGue
|
|
|
101
101
|
* older publication check refuses the scheme. A signature may carry `generated: true` instead of
|
|
102
102
|
* `secret`: the platform derives the webhook's secret. Older readers find no secret name; an older
|
|
103
103
|
* publication check refuses it.
|
|
104
|
+
* Version 16 changes no other field: it marks an SDK whose service keeps the chats' messages in
|
|
105
|
+
* the workspace's own database and purges them at `/api/ontology/agent/chats/purge`, so
|
|
106
|
+
* publication adds a daily cron for that route. Within version 16, `chat` may carry
|
|
107
|
+
* `retention_days`, written only when declared, and then also without a channel: how many days
|
|
108
|
+
* the workspace keeps its chats' messages. Older readers ignore it and keep them 365 days.
|
|
104
109
|
*/
|
|
105
|
-
export const MANIFEST_VERSION =
|
|
110
|
+
export const MANIFEST_VERSION = 16;
|
|
106
111
|
/** The first version whose documents use snake_case names on the wire. */
|
|
107
112
|
const WIRE_MANIFEST_VERSION = 4;
|
|
108
113
|
/** The first version whose documents name metrics as this SDK does; earlier ones keep theirs. */
|
|
@@ -611,7 +616,9 @@ const OntologyManifestModel = Schema.Struct({
|
|
|
611
616
|
template: Schema.optionalKey(Schema.String),
|
|
612
617
|
separator: Schema.optionalKey(Schema.String),
|
|
613
618
|
})),
|
|
614
|
-
|
|
619
|
+
/** How many days the workspace keeps its chats' messages; absent keeps them 365. */
|
|
620
|
+
retentionDays: Schema.optionalKey(Schema.Int),
|
|
621
|
+
}).pipe(Schema.encodeKeys({ retentionDays: "retention_days" }))),
|
|
615
622
|
/**
|
|
616
623
|
* Whose private chats join the inbox, within version 15: the wire names of their roles, the
|
|
617
624
|
* channels whose chats staff may take over from the agent, and `attribution: "none"` when a
|
|
@@ -719,6 +726,31 @@ export function signUpRolesOf(manifest, channel) {
|
|
|
719
726
|
? roles
|
|
720
727
|
: undefined;
|
|
721
728
|
}
|
|
729
|
+
/**
|
|
730
|
+
* `chat.retentionDays` of `defineOntology`: how many days the workspace keeps its chats' messages,
|
|
731
|
+
* a whole number in this range; 365 when the ontology declares none.
|
|
732
|
+
*/
|
|
733
|
+
export const CHAT_RETENTION_DAYS = { default: 365, minimum: 1, maximum: 3650 };
|
|
734
|
+
/**
|
|
735
|
+
* The days the ontology declares it keeps its chats' messages, as {@link chatRetentionDaysOf}
|
|
736
|
+
* reads them; `undefined` when it declares none.
|
|
737
|
+
*/
|
|
738
|
+
export function declaredChatRetentionDaysOf(manifest) {
|
|
739
|
+
return manifest.chat?.retentionDays === undefined ? undefined : chatRetentionDaysOf(manifest);
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* How many days the workspace keeps its chats' messages: `chat.retentionDays` where it is a whole
|
|
743
|
+
* number in range, else the default.
|
|
744
|
+
*/
|
|
745
|
+
export function chatRetentionDaysOf(manifest) {
|
|
746
|
+
const days = manifest.chat?.retentionDays;
|
|
747
|
+
return typeof days === "number" &&
|
|
748
|
+
Number.isInteger(days) &&
|
|
749
|
+
days >= CHAT_RETENTION_DAYS.minimum &&
|
|
750
|
+
days <= CHAT_RETENTION_DAYS.maximum
|
|
751
|
+
? days
|
|
752
|
+
: CHAT_RETENTION_DAYS.default;
|
|
753
|
+
}
|
|
722
754
|
/** The wire names of the roles whose people's private chats join the inbox; empty without one. */
|
|
723
755
|
export function inboxRolesOf(manifest) {
|
|
724
756
|
return new Set(manifest.inbox?.roles ?? []);
|
package/dist/migrate/model.d.ts
CHANGED
|
@@ -428,6 +428,7 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
428
428
|
readonly template?: string | undefined;
|
|
429
429
|
readonly separator?: string | undefined;
|
|
430
430
|
} | undefined;
|
|
431
|
+
readonly retentionDays?: number | undefined;
|
|
431
432
|
} | undefined;
|
|
432
433
|
readonly workflows?: readonly {
|
|
433
434
|
readonly description: string;
|
|
@@ -783,6 +784,7 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
783
784
|
readonly template?: string | undefined;
|
|
784
785
|
readonly separator?: string | undefined;
|
|
785
786
|
} | undefined;
|
|
787
|
+
readonly retentionDays?: number | undefined;
|
|
786
788
|
} | undefined;
|
|
787
789
|
readonly workflows?: readonly {
|
|
788
790
|
readonly description: string;
|
|
@@ -1138,6 +1140,7 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
1138
1140
|
readonly template?: string | undefined;
|
|
1139
1141
|
readonly separator?: string | undefined;
|
|
1140
1142
|
} | undefined;
|
|
1143
|
+
readonly retention_days?: number | undefined;
|
|
1141
1144
|
} | undefined;
|
|
1142
1145
|
readonly workflows?: readonly {
|
|
1143
1146
|
readonly description: string;
|
|
@@ -1493,6 +1496,7 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
1493
1496
|
readonly template?: string | undefined;
|
|
1494
1497
|
readonly separator?: string | undefined;
|
|
1495
1498
|
} | undefined;
|
|
1499
|
+
readonly retention_days?: number | undefined;
|
|
1496
1500
|
} | undefined;
|
|
1497
1501
|
readonly workflows?: readonly {
|
|
1498
1502
|
readonly description: string;
|
|
@@ -1935,7 +1939,7 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
1935
1939
|
readonly description: Schema.String;
|
|
1936
1940
|
readonly delivers: Schema.optionalKey<Schema.Literal<true>>;
|
|
1937
1941
|
}>>>;
|
|
1938
|
-
readonly chat: Schema.optionalKey<Schema.Struct<{
|
|
1942
|
+
readonly chat: Schema.optionalKey<Schema.encodeKeys<Schema.Struct<{
|
|
1939
1943
|
readonly telegram: Schema.optionalKey<Schema.Struct<{
|
|
1940
1944
|
readonly connection: Schema.String;
|
|
1941
1945
|
}>>;
|
|
@@ -1956,6 +1960,9 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
1956
1960
|
readonly template: Schema.optionalKey<Schema.String>;
|
|
1957
1961
|
readonly separator: Schema.optionalKey<Schema.String>;
|
|
1958
1962
|
}>>;
|
|
1963
|
+
readonly retentionDays: Schema.optionalKey<Schema.Int>;
|
|
1964
|
+
}>, {
|
|
1965
|
+
readonly retentionDays: "retention_days";
|
|
1959
1966
|
}>>;
|
|
1960
1967
|
readonly inbox: Schema.optionalKey<Schema.Struct<{
|
|
1961
1968
|
readonly roles: Schema.$Array<Schema.String>;
|
|
@@ -2286,7 +2293,7 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
2286
2293
|
readonly description: Schema.String;
|
|
2287
2294
|
readonly delivers: Schema.optionalKey<Schema.Literal<true>>;
|
|
2288
2295
|
}>>>;
|
|
2289
|
-
readonly chat: Schema.optionalKey<Schema.Struct<{
|
|
2296
|
+
readonly chat: Schema.optionalKey<Schema.encodeKeys<Schema.Struct<{
|
|
2290
2297
|
readonly telegram: Schema.optionalKey<Schema.Struct<{
|
|
2291
2298
|
readonly connection: Schema.String;
|
|
2292
2299
|
}>>;
|
|
@@ -2307,6 +2314,9 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
2307
2314
|
readonly template: Schema.optionalKey<Schema.String>;
|
|
2308
2315
|
readonly separator: Schema.optionalKey<Schema.String>;
|
|
2309
2316
|
}>>;
|
|
2317
|
+
readonly retentionDays: Schema.optionalKey<Schema.Int>;
|
|
2318
|
+
}>, {
|
|
2319
|
+
readonly retentionDays: "retention_days";
|
|
2310
2320
|
}>>;
|
|
2311
2321
|
readonly inbox: Schema.optionalKey<Schema.Struct<{
|
|
2312
2322
|
readonly roles: Schema.$Array<Schema.String>;
|
|
@@ -2564,6 +2574,7 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
2564
2574
|
readonly template?: string | undefined;
|
|
2565
2575
|
readonly separator?: string | undefined;
|
|
2566
2576
|
} | undefined;
|
|
2577
|
+
readonly retentionDays?: number | undefined;
|
|
2567
2578
|
} | undefined;
|
|
2568
2579
|
readonly workflows?: readonly {
|
|
2569
2580
|
readonly description: string;
|
|
@@ -2919,6 +2930,7 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
2919
2930
|
readonly template?: string | undefined;
|
|
2920
2931
|
readonly separator?: string | undefined;
|
|
2921
2932
|
} | undefined;
|
|
2933
|
+
readonly retentionDays?: number | undefined;
|
|
2922
2934
|
} | undefined;
|
|
2923
2935
|
readonly workflows?: readonly {
|
|
2924
2936
|
readonly description: string;
|
package/dist/migrate/plan.js
CHANGED
|
@@ -213,7 +213,7 @@ export function planMigration(input) {
|
|
|
213
213
|
draft.runtimeTables.push(step({
|
|
214
214
|
kind: "createCatalog",
|
|
215
215
|
classification: "additive",
|
|
216
|
-
description: "Create the runtime's agent tables, which pair channel accounts with members.",
|
|
216
|
+
description: "Create the runtime's agent tables, which pair channel accounts with members and keep chats' messages.",
|
|
217
217
|
sql: AGENT_TABLES_DDL,
|
|
218
218
|
}));
|
|
219
219
|
}
|