@rizom/site-rizom-ai 0.2.0-alpha.259 → 0.2.0-alpha.261

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -474,6 +474,20 @@ type AssetRecord = z.output<typeof assetRecordSchema>;
474
474
  type EntityIdPath = [string, ...string[]];
475
475
  type EntityIdPathInput = readonly [string, ...string[]];
476
476
  //#endregion
477
+ //#region ../../shared/contracts/src/ask-box.d.ts
478
+ /**
479
+ * Dispatched on the host (bubbling) once an answer completes: which public
480
+ * sources it drew on, keyed `entityType:entityId`. A host page may use it,
481
+ * for example to show where those sources sit; it never affects the box.
482
+ * Each source the mounted box lists carries ASK_SOURCE_ATTRIBUTE with the
483
+ * same key, so a host can point at it.
484
+ */
485
+ /** The brain whose published memory a source came from: its name, and its address when it has one. */
486
+ declare const sourceBrainSchema: z.ZodObject<{
487
+ name: z.ZodString;
488
+ url: z.ZodOptional<z.ZodString>;
489
+ }>;
490
+ //#endregion
477
491
  //#region ../../shared/contracts/src/guest-execution.d.ts
478
492
  type Strict$1<Shape extends z.ZodRawShape> = z.ZodObject<Shape, z.core.$strict>;
479
493
  /** Server-owned limits, not a browser's requested model settings. */
@@ -515,6 +529,38 @@ declare const guestTurnSettlementSchema: Strict$1<{
515
529
  usage: typeof guestTurnUsageSchema;
516
530
  cost: typeof guestTurnCostSchema;
517
531
  }>;
532
+ /**
533
+ * What a guest turn screens a visitor's question against, passed in by the
534
+ * box's host beside its execution limits: the brain's public topics and the
535
+ * owner's introduction as the site's scope, and the refusal a screened-out
536
+ * visitor reads, in the site's words.
537
+ */
538
+ declare const guestScreeningSchema: Strict$1<{
539
+ topics: z.ZodArray<z.ZodString>;
540
+ introduction: z.ZodOptional<z.ZodString>;
541
+ refusal: z.ZodOptional<z.ZodString>;
542
+ }>;
543
+ type GuestScreening = z.output<typeof guestScreeningSchema>;
544
+ /** The categories that refuse a question. */
545
+ declare const guestRefusalCategorySchema: z.ZodEnum<{
546
+ "off-topic": "off-topic";
547
+ abusive: "abusive";
548
+ injection: "injection";
549
+ harmful: "harmful";
550
+ }>;
551
+ /**
552
+ * What screening did with a guest turn: answered after an in-scope judgment,
553
+ * refused with the category it was judged, or answered unscreened because
554
+ * the judgment failed.
555
+ */
556
+ declare const guestScreeningOutcomeSchema: z.ZodDiscriminatedUnion<[Strict$1<{
557
+ outcome: z.ZodLiteral<"answered">;
558
+ }>, Strict$1<{
559
+ outcome: z.ZodLiteral<"refused">;
560
+ category: typeof guestRefusalCategorySchema;
561
+ }>, Strict$1<{
562
+ outcome: z.ZodLiteral<"unscreened">;
563
+ }>], "outcome">;
518
564
  //#endregion
519
565
  //#region ../../shared/contracts/src/agent-response.d.ts
520
566
  type PendingConfirmationSchema = z.ZodObject<{
@@ -583,6 +629,7 @@ type SourceCitationSchema = z.ZodObject<{
583
629
  entityId: z.ZodOptional<z.ZodString>;
584
630
  excerpt: z.ZodOptional<z.ZodString>;
585
631
  provenance: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
632
+ brain: z.ZodOptional<typeof sourceBrainSchema>;
586
633
  }>;
587
634
  declare const SourceCitationSchema: SourceCitationSchema;
588
635
  type SourcesCardSchema = z.ZodObject<{
@@ -646,6 +693,11 @@ type AgentResponseSchema = z.ZodObject<{
646
693
  pendingConfirmations: z.ZodOptional<z.ZodArray<PendingConfirmationSchema>>;
647
694
  usage: AgentResponseUsageSchema;
648
695
  guestSettlement: z.ZodOptional<typeof guestTurnSettlementSchema>;
696
+ guestScreening: z.ZodOptional<typeof guestScreeningOutcomeSchema>;
697
+ askedBefore: z.ZodOptional<AskedBeforeSchema>;
698
+ }>;
699
+ type AskedBeforeSchema = z.ZodObject<{
700
+ faqId: z.ZodString;
649
701
  }>;
650
702
  declare const AgentResponseSchema: AgentResponseSchema;
651
703
  type AgentResponse = z.output<typeof AgentResponseSchema>;
@@ -1173,6 +1225,8 @@ declare class ProjectionStore {
1173
1225
  transferEntityAuthority<TResult>(input: ProjectionOwnedEntityInput, mutation: (transaction: EntityTransaction) => Promise<TResult>): Promise<TResult>;
1174
1226
  markDirty(input: MarkProjectionDirtyInput): Promise<number>;
1175
1227
  withDirtyInput<TResult>(input: MarkProjectionDirtyInput, mutation: (transaction: EntityTransaction) => Promise<TResult>): Promise<TResult>;
1228
+ /** Commit all dirty inputs with their mutation in one batch-owned transaction. */
1229
+ withDirtyInputs<TResult>(inputs: readonly MarkProjectionDirtyInput[], mutation: (transaction: EntityTransaction) => Promise<TResult>): Promise<TResult>;
1176
1230
  listPendingInputs(): Promise<ProjectionDirtyInput[]>;
1177
1231
  hasActiveProjectionBatch(): Promise<boolean>;
1178
1232
  claimPendingWave(input: ClaimProjectionWaveInput): Promise<ProjectionWave | null>;
@@ -1198,6 +1252,20 @@ interface EntityWriteCondition {
1198
1252
  expectedRevision: string | null;
1199
1253
  }
1200
1254
  //#endregion
1255
+ //#region ../../shell/entity-service/src/entity-mutation-receipt.d.ts
1256
+ /** Native-only durable mutation identity, scoped by the admitted caller. */
1257
+ interface EntityMutationReceiptKey {
1258
+ namespace: string;
1259
+ key: string;
1260
+ }
1261
+ type EntityMutationReceipt = {
1262
+ operation: "none";
1263
+ } | {
1264
+ operation: "create" | "update";
1265
+ entityType: string;
1266
+ entityId: string;
1267
+ };
1268
+ //#endregion
1201
1269
  //#region ../../shell/entity-service/src/types.d.ts
1202
1270
  /**
1203
1271
  * Options for entity mutation operations (create, update, upsert)
@@ -1210,6 +1278,22 @@ interface EntityMutationEventContext {
1210
1278
  actor?: ActorRef;
1211
1279
  interfaceType?: string;
1212
1280
  }
1281
+ /** First committed result wins, even if retries choose a different destination.
1282
+ * Receipts survive destination edits, folds and deletion. Transaction retries
1283
+ * never replay callbacks; validation can still run in separate attempts.
1284
+ * A content conflict does not consume the identity. This is not an author SDK API.
1285
+ */
1286
+ type ApplyEntityMutationOnceRequest = {
1287
+ receipt: EntityMutationReceiptKey;
1288
+ } & ({
1289
+ operation: "none";
1290
+ } | {
1291
+ operation: "create";
1292
+ request: CreateEntityRequest<BaseEntity>;
1293
+ } | {
1294
+ operation: "update";
1295
+ request: UpdateEntityRequest<BaseEntity>;
1296
+ });
1213
1297
  interface EntityWriteSnapshot {
1214
1298
  entity: BaseEntity;
1215
1299
  revision: string;
@@ -1492,6 +1576,8 @@ interface SortField {
1492
1576
  direction: "asc" | "desc";
1493
1577
  /** Sort NULL values before non-NULL values (default: false / SQLite default) */
1494
1578
  nullsFirst?: boolean;
1579
+ /** Sort NULL values after non-NULL values, whatever the direction */
1580
+ nullsLast?: boolean;
1495
1581
  }
1496
1582
  /**
1497
1583
  * List entities options
@@ -1552,6 +1638,11 @@ interface EntityTypeConfig {
1552
1638
  /** Whether to index serialized content in full-text search (default: true).
1553
1639
  * Set to false for binary entity types. Mutations remove stale FTS rows. */
1554
1640
  fullTextSearchable?: boolean;
1641
+ /** Whether a search that names no entity types includes this type (default: true).
1642
+ * Set to false for entities derived from the brain's own answers, so they are
1643
+ * not retrieved as sources; a search naming the type still finds them, and
1644
+ * raw-distance search is unaffected. */
1645
+ includeInBroadSearch?: boolean;
1555
1646
  /** Binary storage policy. Absence means text content. */
1556
1647
  binaryStorage?: "data-url" | "asset";
1557
1648
  /** Default system_list order, applied by the entity service before pagination. */
@@ -1655,10 +1746,27 @@ interface UpdateEntityRequest<T extends BaseEntity> {
1655
1746
  preparedAsset?: PreparedAsset | undefined;
1656
1747
  options?: UpdateEntityOptions | undefined;
1657
1748
  }
1749
+ /** Native-only atomic same-type, same-visibility update and removal.
1750
+ * Both revisions must come from admitted write snapshots. The source is
1751
+ * removed only when the destination and both journals commit with it.
1752
+ */
1753
+ interface FoldEntityRequest<T extends BaseEntity = BaseEntity> {
1754
+ source: {
1755
+ entityType: string;
1756
+ id: string;
1757
+ expectedRevision: string;
1758
+ };
1759
+ targetRevision: string;
1760
+ entity: T;
1761
+ options?: Omit<UpdateEntityOptions, "conditionalWrite" | "expectedContentHash">;
1762
+ }
1658
1763
  interface DeleteEntityRequest {
1659
1764
  entityType: string;
1660
1765
  id: string;
1661
- options?: Pick<EntityJobOptions, "eventContext" | "persistenceOrigin"> | undefined;
1766
+ options?: (Pick<EntityJobOptions, "eventContext" | "persistenceOrigin"> & {
1767
+ /** Delete only while the stored entity still has this content hash; false otherwise. */
1768
+ expectedContentHash?: string | undefined;
1769
+ }) | undefined;
1662
1770
  }
1663
1771
  interface UpsertEntityRequest<T extends BaseEntity> {
1664
1772
  entity: T;
@@ -1675,6 +1783,10 @@ interface EntitySearchRequest {
1675
1783
  }
1676
1784
  interface SearchWithDistancesRequest {
1677
1785
  query: string;
1786
+ /** Only these entity types; empty or omitted includes all types. */
1787
+ types?: string[] | undefined;
1788
+ /** Only results at most this cosine distance from the query. */
1789
+ maxDistance?: number | undefined;
1678
1790
  }
1679
1791
  interface SemanticEntityReference {
1680
1792
  entityId: string;
@@ -1897,6 +2009,9 @@ interface EntityServiceClient extends ICoreEntityService {
1897
2009
  createEntityFromMarkdown(request: CreateEntityFromMarkdownRequest): Promise<EntityMutationResult>;
1898
2010
  updateEntity<T extends BaseEntity>(request: UpdateEntityRequest<T>): Promise<EntityMutationResult>;
1899
2011
  deleteEntity(request: DeleteEntityRequest): Promise<boolean>;
2012
+ foldEntity(request: FoldEntityRequest): Promise<EntityMutationResult>;
2013
+ getEntityMutationReceipt(key: EntityMutationReceiptKey): Promise<EntityMutationReceipt | null>;
2014
+ applyEntityMutationOnce(request: ApplyEntityMutationOnceRequest): Promise<EntityMutationReceipt>;
1900
2015
  upsertEntity<T extends BaseEntity>(request: UpsertEntityRequest<T>): Promise<EntityMutationResult & {
1901
2016
  created: boolean;
1902
2017
  }>;
@@ -2385,7 +2500,10 @@ interface IJobQueueService {
2385
2500
  getDiagnostics(now?: number): Promise<JobQueueDiagnostics>;
2386
2501
  /** Settle once nothing is in flight and nothing new has arrived. */
2387
2502
  waitForIdle(options?: JobQueueIdleOptions): Promise<void>;
2388
- /** Read durable processing and terminal updates for web-owned publication. */
2503
+ /**
2504
+ * Read one durable update page after the cursor for web-owned publication.
2505
+ * Limit must be an integer from 0 to 1,000 (default 1,000); zero returns no rows.
2506
+ */
2389
2507
  getRuntimeUpdates(cursor: JobRuntimeUpdateCursor, limit?: number): Promise<JobRuntimeUpdate[]>;
2390
2508
  /**
2391
2509
  * Clean up old completed jobs
@@ -3639,6 +3757,8 @@ type ChatAttachment = TextChatAttachment | FileChatAttachment;
3639
3757
  interface ChatContext {
3640
3758
  /** Server-owned limits bound to the already-reserved guest execution. */
3641
3759
  guestExecution?: GuestExecutionPolicy;
3760
+ /** The site's scope and refusal copy a guest question is screened against. */
3761
+ guestScreening?: GuestScreening;
3642
3762
  userPermissionLevel?: UserPermissionLevel;
3643
3763
  /** Whether the authenticated caller is the brain's configured Anchor. */
3644
3764
  isAnchor?: boolean;