@segmentstream/ontology 0.147.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +24 -15
  3. package/dist/analyze.d.ts +11 -3
  4. package/dist/analyze.js +21 -4
  5. package/dist/connection.d.ts +20 -3
  6. package/dist/connection.js +36 -8
  7. package/dist/diagnostics.d.ts +3 -3
  8. package/dist/diagnostics.js +1 -0
  9. package/dist/files.d.ts +21 -0
  10. package/dist/index.d.ts +3 -3
  11. package/dist/index.js +2 -2
  12. package/dist/internal/diagnostics.js +3 -0
  13. package/dist/manifest.d.ts +125 -77
  14. package/dist/manifest.js +34 -2
  15. package/dist/migrate/model.d.ts +68 -56
  16. package/dist/migrate/plan.js +1 -1
  17. package/dist/migrate/preview.js +4 -1
  18. package/dist/migrate/storage.d.ts +15 -3
  19. package/dist/migrate/storage.js +86 -3
  20. package/dist/runtime/agents.js +2 -0
  21. package/dist/runtime/chat-messages.d.ts +233 -0
  22. package/dist/runtime/chat-messages.js +523 -0
  23. package/dist/runtime/pipeline.js +1 -0
  24. package/dist/service/agent/archive-routes.d.ts +2 -0
  25. package/dist/service/agent/archive-routes.js +2 -1
  26. package/dist/service/agent/chat-archive.d.ts +12 -3
  27. package/dist/service/agent/chat-archive.js +5 -1
  28. package/dist/service/agent/chat-message-routes.d.ts +124 -0
  29. package/dist/service/agent/chat-message-routes.js +235 -0
  30. package/dist/service/agent/server.d.ts +5 -1
  31. package/dist/service/agent/server.js +15 -0
  32. package/dist/service/chat/local-reads.d.ts +71 -0
  33. package/dist/service/chat/local-reads.js +148 -0
  34. package/dist/service/chat/reads.js +7 -0
  35. package/dist/service/chat/routes.js +4 -1
  36. package/dist/service/chat/schemas.d.ts +5 -0
  37. package/dist/service/chat/schemas.js +5 -0
  38. package/dist/service/connection-stream.d.ts +7 -0
  39. package/dist/service/connection-stream.js +9 -1
  40. package/dist/service/connections.js +56 -5
  41. package/dist/service/cron-secret.d.ts +6 -0
  42. package/dist/service/cron-secret.js +14 -0
  43. package/dist/service/discovery-search.d.ts +1 -1
  44. package/dist/service/mcp/server.js +4 -2
  45. package/dist/service/runtime-contract.d.ts +2 -0
  46. package/dist/service/schemas.d.ts +8 -2
  47. package/dist/service/service.js +4 -1
  48. package/dist/service/workflows.js +6 -12
  49. package/dist/storage/sessions.js +26 -0
  50. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,44 @@
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
+
32
+ ## 0.148.0
33
+
34
+ A connection request in an action or workflow step can send a stored file as its body: pass
35
+ `file: { entity, id, property, start?, end? }` instead of `body`. The action's file access
36
+ checks that its principal may read the record, and SegmentStream reads the byte range from the
37
+ workspace's file storage, up to 64 MiB per request, so large uploads such as a video's parts no
38
+ longer need to fit the 2 MiB request body. `content-type` defaults to the file's. It needs the
39
+ workspace's file storage, which exists once the ontology declares a file property. Run locally
40
+ with `segmentstream exec`, the range is sent inline, up to 2 MiB.
41
+
3
42
  ## 0.147.0
4
43
 
5
44
  A member whom only SegmentStream app tokens signed in, such as the CLI's, can now sign in to the app
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 the archive with independent
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 chat is read by its
1631
- participant. A posting service cannot read member chats. The canonical
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 { ChatManifestInput } from "./manifest.js";
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
- /** `chat` of {@link OntologyConfig}: the agent's channels by name, and the post attribution. */
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 !== "attribution" &&
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 !== "attribution" && channel !== undefined)
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 !== "attribution" && value !== undefined)
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);
@@ -1,11 +1,14 @@
1
1
  import { Context, Effect, Layer, Schema, Stream, type Scope } from "effect";
2
+ import type { FileRange, Files, FileSource } from "./files.js";
2
3
  export declare const ConnectionTypeId: unique symbol;
3
4
  /** A connection key, as `connections/connections.py` declares it. */
4
5
  export declare const CONNECTION_KEY: RegExp;
5
6
  export declare const CONNECTION_METHODS: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"];
6
7
  export type ConnectionMethod = (typeof CONNECTION_METHODS)[number];
7
- /** The largest request body. */
8
+ /** The largest request body, except a `file`, which SegmentStream reads from file storage. */
8
9
  export declare const MAXIMUM_CONNECTION_BODY_BYTES: number;
10
+ /** The largest byte range of a file one request may send as its body. */
11
+ export declare const MAXIMUM_CONNECTION_FILE_BYTES: number;
9
12
  /**
10
13
  * The largest response body `get`, `post` and `request` collect. A larger response fails with
11
14
  * `invalid_response`; `stream` reads a response of any size.
@@ -51,6 +54,10 @@ export interface ConnectionCall {
51
54
  readonly path: string;
52
55
  readonly headers: ReadonlyArray<readonly [string, string]>;
53
56
  readonly body: Uint8Array;
57
+ /** A file revision's byte range to send as the body instead of `body`, which is then empty. */
58
+ readonly file?: FileRange;
59
+ /** The signed read of `file` the proxy fetches, once the action's file access resolved it. */
60
+ readonly source?: FileSource;
54
61
  }
55
62
  /** What the proxy answered: the provider's status, headers and buffered body. */
56
63
  export interface ConnectionReply {
@@ -123,8 +130,15 @@ export interface ConnectionRequestOptions {
123
130
  readonly json?: unknown;
124
131
  /** A form body, sent with `content-type: application/x-www-form-urlencoded`. */
125
132
  readonly form?: Readonly<Record<string, string>>;
126
- /** A raw body. Set at most one of `json`, `form` and `body`. */
133
+ /** A raw body. Set at most one of `json`, `form`, `body` and `file`. */
127
134
  readonly body?: string | Uint8Array;
135
+ /**
136
+ * A byte range of a record's file to send as the body, such as one part of a chunked video
137
+ * upload. SegmentStream reads it from the workspace's file storage, so it is not held to the
138
+ * 2 MiB body limit: one request sends up to 64 MiB. The action's principal must be able to read
139
+ * the record. `content-type` defaults to the file's.
140
+ */
141
+ readonly file?: FileRange;
128
142
  }
129
143
  export interface ConnectionRequest extends ConnectionRequestOptions {
130
144
  readonly method: ConnectionMethod;
@@ -182,10 +196,13 @@ export declare function isConnection(value: unknown): value is AnyConnectionHand
182
196
  export declare function bufferedStream(reply: ConnectionReply): ConnectionStreamReply;
183
197
  /**
184
198
  * The clients of the given handles over one transport: what `prepare` runs with. Only these
185
- * connections can be called; the transport is never exposed to the action.
199
+ * connections can be called; the transport is never exposed to the action. `files` is the
200
+ * action's file access, which signs the read of a request's `file` after checking the principal
201
+ * may read the record; without it, the call reaches the transport with its `file` unresolved.
186
202
  */
187
203
  export declare function connectionContext<const C extends ReadonlyArray<AnyConnectionHandle>>(handles: C, transport: ConnectionTransport["Service"], options?: {
188
204
  readonly readOnly?: boolean;
205
+ readonly files?: Files["Service"];
189
206
  }): Context.Context<ConnectionsOf<C>>;
190
207
  /** A stubbed response for {@link Connections.test}. */
191
208
  export interface StubResponse {
@@ -11,8 +11,10 @@ export const CONNECTION_METHODS = [
11
11
  "HEAD",
12
12
  "OPTIONS",
13
13
  ];
14
- /** The largest request body. */
14
+ /** The largest request body, except a `file`, which SegmentStream reads from file storage. */
15
15
  export const MAXIMUM_CONNECTION_BODY_BYTES = 2 * 1024 * 1024;
16
+ /** The largest byte range of a file one request may send as its body. */
17
+ export const MAXIMUM_CONNECTION_FILE_BYTES = 64 * 1024 * 1024;
16
18
  /**
17
19
  * The largest response body `get`, `post` and `request` collect. A larger response fails with
18
20
  * `invalid_response`; `stream` reads a response of any size.
@@ -106,9 +108,16 @@ function hasHeader(headers, name) {
106
108
  }
107
109
  /** The call a request describes: query appended, body encoded and its content type set. */
108
110
  export function connectionCall(key, request) {
109
- const bodies = [request.json, request.form, request.body].filter((body) => body !== undefined);
111
+ const bodies = [request.json, request.form, request.body, request.file].filter((body) => body !== undefined);
110
112
  if (bodies.length > 1) {
111
- throw connectionFailure(key, "invalid_request", "Set at most one of json, form and body.");
113
+ throw connectionFailure(key, "invalid_request", "Set at most one of json, form, body and file.");
114
+ }
115
+ if (request.file !== undefined) {
116
+ const { start, end } = request.file;
117
+ if ((start !== undefined && (!Number.isSafeInteger(start) || start < 0)) ||
118
+ (end !== undefined && (!Number.isSafeInteger(end) || end < (start ?? 0)))) {
119
+ throw connectionFailure(key, "invalid_request", "file_range_invalid");
120
+ }
112
121
  }
113
122
  const headers = headerPairs(request.headers);
114
123
  let body = new Uint8Array();
@@ -139,6 +148,7 @@ export function connectionCall(key, request) {
139
148
  path: withQuery(request.path, request.query),
140
149
  headers,
141
150
  body,
151
+ ...(request.file === undefined ? {} : { file: request.file }),
142
152
  };
143
153
  }
144
154
  /** A buffered response over what the proxy answered. */
@@ -220,11 +230,28 @@ export function bufferedStream(reply) {
220
230
  }
221
231
  /**
222
232
  * The clients of the given handles over one transport: what `prepare` runs with. Only these
223
- * connections can be called; the transport is never exposed to the action.
233
+ * connections can be called; the transport is never exposed to the action. `files` is the
234
+ * action's file access, which signs the read of a request's `file` after checking the principal
235
+ * may read the record; without it, the call reaches the transport with its `file` unresolved.
224
236
  */
225
237
  export function connectionContext(handles, transport, options = {}) {
226
238
  let context = Context.empty();
227
239
  for (const handle of handles) {
240
+ const resolve = (call) => {
241
+ const sign = options.files?.source;
242
+ if (call.file === undefined || call.source !== undefined || sign === undefined) {
243
+ return Effect.succeed(call);
244
+ }
245
+ return sign(call.file).pipe(Effect.mapError((cause) => connectionFailure(handle.key, "invalid_request", "file_unreadable", cause)), Effect.flatMap((source) => source.end - source.start + 1 > MAXIMUM_CONNECTION_FILE_BYTES
246
+ ? Effect.fail(connectionFailure(handle.key, "invalid_request", "file_range_too_large"))
247
+ : Effect.succeed({
248
+ ...call,
249
+ headers: hasHeader(call.headers, "content-type")
250
+ ? call.headers
251
+ : [...call.headers, ["content-type", source.contentType]],
252
+ source,
253
+ })));
254
+ };
228
255
  const admit = (call) => {
229
256
  if (options.readOnly !== true) {
230
257
  return Effect.void;
@@ -236,6 +263,7 @@ export function connectionContext(handles, transport, options = {}) {
236
263
  // Match the proxy's policy, including attempts to tunnel writes through GET.
237
264
  if (!["GET", "HEAD", "OPTIONS"].includes(call.method) ||
238
265
  call.body.byteLength > 0 ||
266
+ call.file !== undefined ||
239
267
  call.headers.some(([name]) => name.toLowerCase().includes("method")) ||
240
268
  [...url.searchParams.keys()].some((name) => ["method", "_method"].includes(name.toLowerCase()))) {
241
269
  return Effect.fail(connectionFailure(handle.key, "invalid_request", "This action's connections are read-only."));
@@ -244,11 +272,11 @@ export function connectionContext(handles, transport, options = {}) {
244
272
  }));
245
273
  };
246
274
  context = Context.add(context, handle.service, {
247
- request: (call) => admit(call).pipe(Effect.andThen(() => transport.request({ ...call, connection: handle.key }))),
248
- stream: (call) => admit(call).pipe(Effect.andThen(() => transport.stream
249
- ? transport.stream({ ...call, connection: handle.key })
275
+ request: (call) => admit(call).pipe(Effect.andThen(() => resolve(call)), Effect.flatMap((resolved) => transport.request({ ...resolved, connection: handle.key }))),
276
+ stream: (call) => admit(call).pipe(Effect.andThen(() => resolve(call)), Effect.flatMap((resolved) => transport.stream
277
+ ? transport.stream({ ...resolved, connection: handle.key })
250
278
  : transport
251
- .request({ ...call, connection: handle.key })
279
+ .request({ ...resolved, connection: handle.key })
252
280
  .pipe(Effect.map(bufferedStream)))),
253
281
  });
254
282
  }
@@ -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;
@@ -53,6 +53,7 @@ export const DIAGNOSTIC_CODES = [
53
53
  "wildcard-permission",
54
54
  "invalid-sign-in",
55
55
  "invalid-inbox",
56
+ "invalid-chat",
56
57
  "invalid-connection",
57
58
  "invalid-feedback",
58
59
  "invalid-discovery",
package/dist/files.d.ts CHANGED
@@ -26,12 +26,33 @@ export interface OpenFile {
26
26
  readonly property: string;
27
27
  readonly revisionId?: string;
28
28
  }
29
+ /** A byte range of a file revision: from `start` to `end` inclusive, the whole file by default. */
30
+ export interface FileRange extends OpenFile {
31
+ readonly start?: number;
32
+ readonly end?: number;
33
+ }
34
+ /**
35
+ * A short-lived signed read of a byte range of a file revision, which SegmentStream's connection
36
+ * proxy fetches from the workspace's file storage when a connection request sends the file.
37
+ */
38
+ export interface FileSource {
39
+ readonly url: string;
40
+ readonly headers: Readonly<Record<string, string>>;
41
+ readonly start: number;
42
+ readonly end: number;
43
+ readonly contentType: string;
44
+ }
29
45
  declare const Files_base: Context.ServiceClass<Files, "@segmentstream/ontology/Files", {
30
46
  readonly stage: <E, R>(input: StageFile<E, R>) => Effect.Effect<BlobUpload, E | ActionError, R>;
31
47
  readonly open: (input: OpenFile) => Effect.Effect<{
32
48
  readonly file: BlobValue;
33
49
  readonly body: Stream.Stream<Uint8Array, ActionError>;
34
50
  }, ActionError, Scope.Scope>;
51
+ /**
52
+ * Signs a read of a file's byte range after checking the principal may read the record, for
53
+ * a connection request's `file`. Authoring code passes `file` to the request instead.
54
+ */
55
+ readonly source?: (input: FileRange) => Effect.Effect<FileSource, ActionError>;
35
56
  }>;
36
57
  /** File I/O outside transactions, bound to the current action or workflow principal. */
37
58
  export declare class Files extends Files_base {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { BlobValue, BlobUpload, uploads, BLOB_CONTENT_TYPES, MAX_BLOB_BYTES } from "./blob.js";
2
2
  export { Files } from "./files.js";
3
- export type { FileTarget, StageFile, OpenFile } from "./files.js";
3
+ export type { FileRange, FileSource, FileTarget, StageFile, OpenFile } from "./files.js";
4
4
  export { warehouse, compatibleWarehouseColumn, warehouseColumnType, validateWarehouseSource, } from "./source.js";
5
5
  export type { WarehouseSource } from "./source.js";
6
6
  export { m } from "./metric.js";
@@ -12,7 +12,7 @@ export { action, isAction } from "./action.js";
12
12
  export { ActionConfirmation, ConfirmationFact } from "./confirmation.js";
13
13
  export type { ConfirmContext } from "./confirmation.js";
14
14
  export type { Action, ActionConfig, ActionConfigWithConnections, ActionContext, ActionIdentity, ActionEncodedInput, ActionHints, ActionInput, ActionResult, ActionWriteTarget, Actions, AnyAction, PrepareContext, PrepareError, } from "./action.js";
15
- export { CONNECTION_ERROR_REASONS, CONNECTION_KEY, CONNECTION_METHODS, connection, ConnectionError, Connections, ConnectionTransport, isConnection, MAXIMUM_CONNECTION_BODY_BYTES, MAXIMUM_CONNECTION_RESPONSE_BYTES, } from "./connection.js";
15
+ export { CONNECTION_ERROR_REASONS, CONNECTION_KEY, CONNECTION_METHODS, connection, ConnectionError, Connections, ConnectionTransport, isConnection, MAXIMUM_CONNECTION_BODY_BYTES, MAXIMUM_CONNECTION_FILE_BYTES, MAXIMUM_CONNECTION_RESPONSE_BYTES, } from "./connection.js";
16
16
  export type { AnyConnectionHandle, Connection, ConnectionCall, ConnectionClient, ConnectionErrorReason, ConnectionHandle, ConnectionHeaders, ConnectionMethod, ConnectionOptions, ConnectionReply, ConnectionRequest, ConnectionRequestOptions, ConnectionResponse, ConnectionStreamReply, ConnectionStreamResponse, ConnectionsOf, ConnectionStub, StubRequest, StubResponse, } from "./connection.js";
17
17
  export type { ChatChannelConfig, ChatConfig, DiscoveryOptions, EntityPermissions, JsonSchemaObject, MemberOptions, OntologyConfig, ResolvedAction, ResolvedConnection, ResolvedEntity, ResolvedIndex, ResolvedProperty, ResolvedRelationship, } from "./analyze.js";
18
18
  export { Diagnostic, DIAGNOSTIC_CODES, formatDiagnostics, InvalidOntology } from "./diagnostics.js";
@@ -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
@@ -7,13 +7,13 @@ export { METRIC_CONDITION_OPERATORS } from "./metric-filters.js";
7
7
  export * from "./legacy.js";
8
8
  export { action, isAction } from "./action.js";
9
9
  export { ActionConfirmation, ConfirmationFact } from "./confirmation.js";
10
- export { CONNECTION_ERROR_REASONS, CONNECTION_KEY, CONNECTION_METHODS, connection, ConnectionError, Connections, ConnectionTransport, isConnection, MAXIMUM_CONNECTION_BODY_BYTES, MAXIMUM_CONNECTION_RESPONSE_BYTES, } from "./connection.js";
10
+ export { CONNECTION_ERROR_REASONS, CONNECTION_KEY, CONNECTION_METHODS, connection, ConnectionError, Connections, ConnectionTransport, isConnection, MAXIMUM_CONNECTION_BODY_BYTES, MAXIMUM_CONNECTION_FILE_BYTES, MAXIMUM_CONNECTION_RESPONSE_BYTES, } from "./connection.js";
11
11
  export { Diagnostic, DIAGNOSTIC_CODES, formatDiagnostics, InvalidOntology } from "./diagnostics.js";
12
12
  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";
@@ -13,6 +13,9 @@ function makeRedactor(values = []) {
13
13
  let text = input;
14
14
  for (const value of secrets) text = text.replaceAll(value, "[REDACTED]");
15
15
  return redactCopyContext(redactPrivateKeys(text)).replace(
16
+ /https:\/\/(?:checkout\.stripe\.com\/|pay\.stripe\.com\/receipts\/)[^\s"'<>]+/gi,
17
+ "[REDACTED PAYMENT URL]"
18
+ ).replace(
16
19
  /\b(?:postgres(?:ql)?|mysql|mongodb(?:\+srv)?):\/\/\S+/gi,
17
20
  "[REDACTED CONNECTION URI]"
18
21
  ).replace(