@rizom/site-rizom-ai 0.2.0-alpha.260 → 0.2.0-alpha.262
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 +91 -4
- package/dist/index.js +13251 -547
- package/dist/index.js.map +104 -18
- package/package.json +1 -1
- package/src/asked-datasource.ts +72 -0
- package/src/asked.tsx +198 -0
- package/src/opening.tsx +12 -2
- package/src/routes.ts +4 -1
- package/src/site.ts +22 -5
- package/src/story/living-organism.tsx +10 -0
- package/src/story/runtime.ts +208 -1
- package/src/story.css +331 -3
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. */
|
|
@@ -517,11 +531,13 @@ declare const guestTurnSettlementSchema: Strict$1<{
|
|
|
517
531
|
}>;
|
|
518
532
|
/**
|
|
519
533
|
* What a guest turn screens a visitor's question against, passed in by the
|
|
520
|
-
* box's host beside its execution limits: the
|
|
521
|
-
* scope, and the refusal a screened-out
|
|
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.
|
|
522
537
|
*/
|
|
523
538
|
declare const guestScreeningSchema: Strict$1<{
|
|
524
539
|
topics: z.ZodArray<z.ZodString>;
|
|
540
|
+
introduction: z.ZodOptional<z.ZodString>;
|
|
525
541
|
refusal: z.ZodOptional<z.ZodString>;
|
|
526
542
|
}>;
|
|
527
543
|
type GuestScreening = z.output<typeof guestScreeningSchema>;
|
|
@@ -613,6 +629,7 @@ type SourceCitationSchema = z.ZodObject<{
|
|
|
613
629
|
entityId: z.ZodOptional<z.ZodString>;
|
|
614
630
|
excerpt: z.ZodOptional<z.ZodString>;
|
|
615
631
|
provenance: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
632
|
+
brain: z.ZodOptional<typeof sourceBrainSchema>;
|
|
616
633
|
}>;
|
|
617
634
|
declare const SourceCitationSchema: SourceCitationSchema;
|
|
618
635
|
type SourcesCardSchema = z.ZodObject<{
|
|
@@ -677,6 +694,10 @@ type AgentResponseSchema = z.ZodObject<{
|
|
|
677
694
|
usage: AgentResponseUsageSchema;
|
|
678
695
|
guestSettlement: z.ZodOptional<typeof guestTurnSettlementSchema>;
|
|
679
696
|
guestScreening: z.ZodOptional<typeof guestScreeningOutcomeSchema>;
|
|
697
|
+
askedBefore: z.ZodOptional<AskedBeforeSchema>;
|
|
698
|
+
}>;
|
|
699
|
+
type AskedBeforeSchema = z.ZodObject<{
|
|
700
|
+
faqId: z.ZodString;
|
|
680
701
|
}>;
|
|
681
702
|
declare const AgentResponseSchema: AgentResponseSchema;
|
|
682
703
|
type AgentResponse = z.output<typeof AgentResponseSchema>;
|
|
@@ -1204,6 +1225,8 @@ declare class ProjectionStore {
|
|
|
1204
1225
|
transferEntityAuthority<TResult>(input: ProjectionOwnedEntityInput, mutation: (transaction: EntityTransaction) => Promise<TResult>): Promise<TResult>;
|
|
1205
1226
|
markDirty(input: MarkProjectionDirtyInput): Promise<number>;
|
|
1206
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>;
|
|
1207
1230
|
listPendingInputs(): Promise<ProjectionDirtyInput[]>;
|
|
1208
1231
|
hasActiveProjectionBatch(): Promise<boolean>;
|
|
1209
1232
|
claimPendingWave(input: ClaimProjectionWaveInput): Promise<ProjectionWave | null>;
|
|
@@ -1229,6 +1252,20 @@ interface EntityWriteCondition {
|
|
|
1229
1252
|
expectedRevision: string | null;
|
|
1230
1253
|
}
|
|
1231
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
|
|
1232
1269
|
//#region ../../shell/entity-service/src/types.d.ts
|
|
1233
1270
|
/**
|
|
1234
1271
|
* Options for entity mutation operations (create, update, upsert)
|
|
@@ -1241,6 +1278,22 @@ interface EntityMutationEventContext {
|
|
|
1241
1278
|
actor?: ActorRef;
|
|
1242
1279
|
interfaceType?: string;
|
|
1243
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
|
+
});
|
|
1244
1297
|
interface EntityWriteSnapshot {
|
|
1245
1298
|
entity: BaseEntity;
|
|
1246
1299
|
revision: string;
|
|
@@ -1523,6 +1576,8 @@ interface SortField {
|
|
|
1523
1576
|
direction: "asc" | "desc";
|
|
1524
1577
|
/** Sort NULL values before non-NULL values (default: false / SQLite default) */
|
|
1525
1578
|
nullsFirst?: boolean;
|
|
1579
|
+
/** Sort NULL values after non-NULL values, whatever the direction */
|
|
1580
|
+
nullsLast?: boolean;
|
|
1526
1581
|
}
|
|
1527
1582
|
/**
|
|
1528
1583
|
* List entities options
|
|
@@ -1583,6 +1638,11 @@ interface EntityTypeConfig {
|
|
|
1583
1638
|
/** Whether to index serialized content in full-text search (default: true).
|
|
1584
1639
|
* Set to false for binary entity types. Mutations remove stale FTS rows. */
|
|
1585
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;
|
|
1586
1646
|
/** Binary storage policy. Absence means text content. */
|
|
1587
1647
|
binaryStorage?: "data-url" | "asset";
|
|
1588
1648
|
/** Default system_list order, applied by the entity service before pagination. */
|
|
@@ -1686,10 +1746,27 @@ interface UpdateEntityRequest<T extends BaseEntity> {
|
|
|
1686
1746
|
preparedAsset?: PreparedAsset | undefined;
|
|
1687
1747
|
options?: UpdateEntityOptions | undefined;
|
|
1688
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
|
+
}
|
|
1689
1763
|
interface DeleteEntityRequest {
|
|
1690
1764
|
entityType: string;
|
|
1691
1765
|
id: string;
|
|
1692
|
-
options?: Pick<EntityJobOptions, "eventContext" | "persistenceOrigin">
|
|
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;
|
|
1693
1770
|
}
|
|
1694
1771
|
interface UpsertEntityRequest<T extends BaseEntity> {
|
|
1695
1772
|
entity: T;
|
|
@@ -1706,6 +1783,10 @@ interface EntitySearchRequest {
|
|
|
1706
1783
|
}
|
|
1707
1784
|
interface SearchWithDistancesRequest {
|
|
1708
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;
|
|
1709
1790
|
}
|
|
1710
1791
|
interface SemanticEntityReference {
|
|
1711
1792
|
entityId: string;
|
|
@@ -1928,6 +2009,9 @@ interface EntityServiceClient extends ICoreEntityService {
|
|
|
1928
2009
|
createEntityFromMarkdown(request: CreateEntityFromMarkdownRequest): Promise<EntityMutationResult>;
|
|
1929
2010
|
updateEntity<T extends BaseEntity>(request: UpdateEntityRequest<T>): Promise<EntityMutationResult>;
|
|
1930
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>;
|
|
1931
2015
|
upsertEntity<T extends BaseEntity>(request: UpsertEntityRequest<T>): Promise<EntityMutationResult & {
|
|
1932
2016
|
created: boolean;
|
|
1933
2017
|
}>;
|
|
@@ -2416,7 +2500,10 @@ interface IJobQueueService {
|
|
|
2416
2500
|
getDiagnostics(now?: number): Promise<JobQueueDiagnostics>;
|
|
2417
2501
|
/** Settle once nothing is in flight and nothing new has arrived. */
|
|
2418
2502
|
waitForIdle(options?: JobQueueIdleOptions): Promise<void>;
|
|
2419
|
-
/**
|
|
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
|
+
*/
|
|
2420
2507
|
getRuntimeUpdates(cursor: JobRuntimeUpdateCursor, limit?: number): Promise<JobRuntimeUpdate[]>;
|
|
2421
2508
|
/**
|
|
2422
2509
|
* Clean up old completed jobs
|