@segmentstream/ontology 0.131.0 → 0.133.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.
@@ -252,9 +252,9 @@ function runActionOf(backend, plan, hooks, connections, replicate, chatDelivery)
252
252
  });
253
253
  }
254
254
  const requestId = yield* RequestId;
255
- const delivery = (planned.name === "agent_chat" &&
256
- (name === "post_message" || name === "preview_message")) ||
257
- (planned.name === "agent_review" && name === "approve")
255
+ // Every action of the chat registry and of held replies reaches chats through the service:
256
+ // posts, takeovers, imports, approvals and redrafts.
257
+ const delivery = planned.name === "agent_chat" || planned.name === "agent_review"
258
258
  ? chatDelivery?.({
259
259
  backend,
260
260
  principal,
@@ -463,7 +463,9 @@ export declare const Catalog: Schema.decodeTo<Schema.Struct<{
463
463
  readonly origins: Schema.$Array<Schema.String>;
464
464
  readonly botCheck: Schema.optionalKey<Schema.Struct<{
465
465
  readonly scheme: Schema.String;
466
- readonly secret: Schema.String;
466
+ readonly connection: Schema.optionalKey<Schema.String>;
467
+ readonly input: Schema.optionalKey<Schema.String>;
468
+ readonly secret: Schema.optionalKey<Schema.String>;
467
469
  }>>;
468
470
  readonly confirmations: Schema.optionalKey<Schema.Boolean>;
469
471
  }>, {
@@ -823,7 +825,9 @@ export declare const Catalog: Schema.decodeTo<Schema.Struct<{
823
825
  readonly origins: Schema.$Array<Schema.String>;
824
826
  readonly botCheck: Schema.optionalKey<Schema.Struct<{
825
827
  readonly scheme: Schema.String;
826
- readonly secret: Schema.String;
828
+ readonly connection: Schema.optionalKey<Schema.String>;
829
+ readonly input: Schema.optionalKey<Schema.String>;
830
+ readonly secret: Schema.optionalKey<Schema.String>;
827
831
  }>>;
828
832
  readonly confirmations: Schema.optionalKey<Schema.Boolean>;
829
833
  }>, {
@@ -23,6 +23,7 @@ import { platformChatArchive } from "./agent/chat-archive.js";
23
23
  import { archiveRoutes } from "./agent/archive-routes.js";
24
24
  import { makeChatDelivery } from "./chat/delivery.js";
25
25
  import { platformDeliveryArchive } from "./chat/archive.js";
26
+ import { platformHistoryArchive } from "./chat/history-import.js";
26
27
  import { chatRoutes } from "./chat/routes.js";
27
28
  import { agentLayer } from "./agent/server.js";
28
29
  import { agentTasksLayer } from "./agent/tasks.js";
@@ -348,7 +349,7 @@ export function createOntologyService(ontology, config) {
348
349
  {
349
350
  origin: config.agentOrigin,
350
351
  ...(config.agentTaskTransport === undefined ? {} : { fetch: config.agentTaskTransport }),
351
- });
352
+ }, config.chatHistoryArchive ?? platformHistoryArchive(config));
352
353
  const chatHistory = config.runtimeIdentity === undefined ? undefined : platformChatArchive(config);
353
354
  const metricQueries = makeMetricQueries({
354
355
  ontology,
package/dist/sign-in.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { AnyConnectionHandle } from "./connection.js";
1
2
  /**
2
3
  * Who may become a member by signing in. `invited`: only a person whose email a member row already
3
4
  * holds, created by an invitation or a role grant; anyone else is refused. `open`: anyone who signs
@@ -77,8 +78,9 @@ export interface GuestOptions<P = unknown> {
77
78
  /**
78
79
  * A bot check before a guest exists: the website shows a challenge, and a new guest's agent token
79
80
  * is issued only for a token from it that the challenge's provider accepts. `scheme` names the
80
- * provider; `secret` names the workspace secret holding the provider's secret key, which only the
81
- * platform reads. Absent, no challenge is asked for.
81
+ * provider; `connection` and `input` the connection's verification value holding the provider's
82
+ * secret key, such as a `TurnstileConnection`'s `secret_key`, which only the platform reads.
83
+ * Absent, no challenge is asked for.
82
84
  */
83
85
  readonly botCheck?: GuestBotCheck;
84
86
  /**
@@ -89,23 +91,44 @@ export interface GuestOptions<P = unknown> {
89
91
  }
90
92
  /**
91
93
  * The challenge providers a guest's bot check can verify. `turnstile` is Cloudflare Turnstile: the
92
- * website renders its widget with the site key, and the workspace secret holds its secret key.
94
+ * website renders its widget with the site key, and a connection holds its secret key.
93
95
  */
94
96
  export declare const GUEST_BOT_CHECK_SCHEMES: readonly ["turnstile"];
95
97
  export type GuestBotCheckScheme = (typeof GUEST_BOT_CHECK_SCHEMES)[number];
96
98
  export declare function isGuestBotCheckScheme(value: unknown): value is GuestBotCheckScheme;
97
99
  /** The challenge a website's visitor passes before they become a guest. */
98
- export interface GuestBotCheck {
100
+ export type GuestBotCheck = {
99
101
  readonly scheme: GuestBotCheckScheme;
100
- /** The workspace secret holding the provider's secret key, such as `turnstile-secret-key`. */
102
+ /** The connection holding the provider's secret key, listed in `defineOntology({ connections })`. */
103
+ readonly connection: AnyConnectionHandle;
104
+ /** Its verification value, such as a `TurnstileConnection`'s `secret_key`. */
105
+ readonly input: string;
106
+ readonly secret?: undefined;
107
+ } | {
108
+ readonly scheme: GuestBotCheckScheme;
109
+ /** The workspace secret holding the provider's secret key: the older form. */
101
110
  readonly secret: string;
102
- }
111
+ readonly connection?: undefined;
112
+ readonly input?: undefined;
113
+ };
114
+ /** A bot check as the manifest carries it: the connection by its key. */
115
+ export type ResolvedGuestBotCheck = {
116
+ readonly scheme: GuestBotCheckScheme;
117
+ readonly connection: string;
118
+ readonly input: string;
119
+ readonly secret?: undefined;
120
+ } | {
121
+ readonly scheme: GuestBotCheckScheme;
122
+ readonly secret: string;
123
+ readonly connection?: undefined;
124
+ readonly input?: undefined;
125
+ };
103
126
  /** Guests as the manifest carries them; the built-in role `guest` holds their permissions. */
104
127
  export interface ResolvedGuest {
105
128
  readonly channels: ReadonlyArray<GuestChannel>;
106
129
  readonly origins: ReadonlyArray<string>;
107
130
  /** The challenge a new guest passes, when declared. */
108
- readonly botCheck?: GuestBotCheck;
131
+ readonly botCheck?: ResolvedGuestBotCheck;
109
132
  /** Present when guests may confirm actions that need a confirmation. */
110
133
  readonly confirmations?: true;
111
134
  }
package/dist/sign-in.js CHANGED
@@ -30,7 +30,7 @@ export function isGuestChannel(value) {
30
30
  }
31
31
  /**
32
32
  * The challenge providers a guest's bot check can verify. `turnstile` is Cloudflare Turnstile: the
33
- * website renders its widget with the site key, and the workspace secret holds its secret key.
33
+ * website renders its widget with the site key, and a connection holds its secret key.
34
34
  */
35
35
  export const GUEST_BOT_CHECK_SCHEMES = ["turnstile"];
36
36
  export function isGuestBotCheckScheme(value) {
@@ -29,7 +29,7 @@ export declare const UserIdentity: import("./entity.js").DraftEntity<"user_ident
29
29
  readonly subject: import("./property.js").Property<string, false, false>;
30
30
  readonly username: import("effect/Schema").optionalKey<import("./property.js").Property<string, false, false>>;
31
31
  readonly display: import("effect/Schema").optionalKey<import("./property.js").Property<string, false, false>>;
32
- readonly origin: import("./property.js").Property<"link" | "invite" | "attach" | "sign_in" | "channel" | "pairing", false, false>;
32
+ readonly origin: import("./property.js").Property<"link" | "invite" | "attach" | "channel" | "sign_in" | "pairing", false, false>;
33
33
  readonly revokedAt: import("effect/Schema").optionalKey<import("./property.js").Property<string, false, false>>;
34
34
  readonly accountKey: import("effect/Schema").optionalKey<import("./property.js").Property<string, false, true>>;
35
35
  readonly memberKey: import("effect/Schema").optionalKey<import("./property.js").Property<string, false, true>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@segmentstream/ontology",
3
- "version": "0.131.0",
3
+ "version": "0.133.0",
4
4
  "description": "Define a SegmentStream workspace app's ontology: entities, relationships, roles and actions, written with Effect.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "SegmentStream",