@agentshouse/app-bridge 0.1.0-c3aff7d33e077 → 0.1.0-c3ee7fcd01608

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 (103) hide show
  1. package/README.md +2 -2
  2. package/dist/index.d.ts +173 -422
  3. package/dist/mdmodel/body.d.ts +84 -0
  4. package/dist/mdmodel/built-in.d.ts +3 -0
  5. package/dist/mdmodel/definition.d.ts +23 -10
  6. package/dist/mdmodel/document.d.ts +14 -8
  7. package/dist/mdmodel/event.d.ts +1 -2
  8. package/dist/mdmodel/fields.d.ts +1 -1
  9. package/dist/mdmodel/house-model.d.ts +869 -0
  10. package/dist/mdmodel/house-references/crockford.d.ts +3 -0
  11. package/dist/mdmodel/house-references/patterns.d.ts +8 -0
  12. package/dist/mdmodel/index.d.ts +31 -15
  13. package/dist/mdmodel/indexed.d.ts +8 -0
  14. package/dist/mdmodel/kinds.d.ts +4 -2
  15. package/dist/mdmodel/markdown.d.ts +74 -0
  16. package/dist/mdmodel/media-type.d.ts +71 -0
  17. package/dist/mdmodel/moment.d.ts +6 -0
  18. package/dist/mdmodel/not-ready.d.ts +1 -0
  19. package/dist/mdmodel/paths.d.ts +15 -1
  20. package/dist/mdmodel/query/language.d.ts +2 -1
  21. package/dist/mdmodel/query/match.d.ts +1 -1
  22. package/dist/mdmodel/query/rows.d.ts +1 -1
  23. package/dist/mdmodel/query/sql.d.ts +5 -1
  24. package/dist/mdmodel/query/walk.d.ts +62 -0
  25. package/dist/mdmodel/references.d.ts +2 -2
  26. package/dist/mdmodel/reserved.d.ts +1 -0
  27. package/dist/mdmodel/room-types.d.ts +6 -0
  28. package/dist/mdmodel/types.d.ts +11 -17
  29. package/dist/mdmodel/validate.d.ts +6 -2
  30. package/dist/mdmodel/yaml.d.ts +4 -4
  31. package/dist/mdruntime/actions.d.ts +8 -2
  32. package/dist/mdruntime/adapter.d.ts +120 -57
  33. package/dist/mdruntime/attached-model.d.ts +0 -1
  34. package/dist/mdruntime/authored.d.ts +87 -0
  35. package/dist/mdruntime/bootstrap.d.ts +1 -1
  36. package/dist/mdruntime/change-set.d.ts +4 -0
  37. package/dist/mdruntime/change.d.ts +4 -0
  38. package/dist/mdruntime/client.d.ts +19 -21
  39. package/dist/mdruntime/collection.d.ts +26 -4
  40. package/dist/mdruntime/compile.d.ts +2 -0
  41. package/dist/mdruntime/conversation-live.d.ts +28 -12
  42. package/dist/mdruntime/conversation-row.d.ts +8 -1
  43. package/dist/mdruntime/conversation.d.ts +37 -12
  44. package/dist/mdruntime/declaration.d.ts +9 -0
  45. package/dist/mdruntime/durability.d.ts +5 -0
  46. package/dist/mdruntime/failure.d.ts +3 -0
  47. package/dist/mdruntime/figures.d.ts +1 -0
  48. package/dist/mdruntime/house-query.d.ts +14 -0
  49. package/dist/mdruntime/install.d.ts +10 -6
  50. package/dist/mdruntime/listing.d.ts +29 -22
  51. package/dist/mdruntime/live.d.ts +5 -3
  52. package/dist/mdruntime/media.d.ts +19 -2
  53. package/dist/mdruntime/messages.d.ts +12 -6
  54. package/dist/mdruntime/modal.d.ts +1 -0
  55. package/dist/mdruntime/model.d.ts +4 -3
  56. package/dist/mdruntime/observation.d.ts +29 -12
  57. package/dist/mdruntime/opened.d.ts +1 -1
  58. package/dist/mdruntime/outcome.d.ts +13 -1
  59. package/dist/mdruntime/overlay.d.ts +6 -2
  60. package/dist/mdruntime/preparation.d.ts +33 -7
  61. package/dist/mdruntime/presence.d.ts +57 -0
  62. package/dist/mdruntime/query.d.ts +0 -1
  63. package/dist/mdruntime/reach.d.ts +15 -6
  64. package/dist/mdruntime/readiness.d.ts +20 -5
  65. package/dist/mdruntime/reads.d.ts +4 -2
  66. package/dist/mdruntime/recovery.d.ts +4 -1
  67. package/dist/mdruntime/replica.d.ts +5 -10
  68. package/dist/mdruntime/retried.d.ts +29 -0
  69. package/dist/mdruntime/room-draft.d.ts +31 -8
  70. package/dist/mdruntime/runtime.d.ts +11 -19
  71. package/dist/mdruntime/save.d.ts +42 -88
  72. package/dist/mdruntime/saves.d.ts +4 -40
  73. package/dist/mdruntime/socket/lanes.d.ts +12 -4
  74. package/dist/mdruntime/socket/session.d.ts +4 -2
  75. package/dist/mdruntime/socket.d.ts +4 -6
  76. package/dist/mdruntime/source.d.ts +5 -7
  77. package/dist/mdruntime/store/installs.d.ts +2 -2
  78. package/dist/mdruntime/store/readiness.d.ts +5 -4
  79. package/dist/mdruntime/store/records.d.ts +23 -8
  80. package/dist/mdruntime/store/rooms-shown.d.ts +7 -0
  81. package/dist/mdruntime/store/space.d.ts +1 -1
  82. package/dist/mdruntime/store.d.ts +26 -16
  83. package/dist/mdruntime/stored.d.ts +33 -15
  84. package/dist/mdruntime/surface.d.ts +12 -6
  85. package/dist/mdruntime/tables.d.ts +19 -58
  86. package/dist/mdruntime/wire.d.ts +66 -7
  87. package/dist/session-content/check.d.ts +17 -0
  88. package/dist/session-content/index.d.ts +6 -0
  89. package/dist/session-content/parts.d.ts +30 -0
  90. package/dist/session-content/state.d.ts +59 -0
  91. package/dist/session-content/turn.d.ts +137 -0
  92. package/dist/test-host.d.ts +8 -1
  93. package/dist/test-host.js +44 -1
  94. package/docs/families.md +61 -33
  95. package/package.json +2 -2
  96. package/dist/mdmodel/blocks.d.ts +0 -10
  97. package/dist/mdmodel/links.d.ts +0 -28
  98. package/dist/mdmodel/profile.d.ts +0 -5
  99. package/dist/mdruntime/job.d.ts +0 -32
  100. package/dist/mdruntime/log.d.ts +0 -5
  101. package/dist/mdruntime/socket/rooms.d.ts +0 -42
  102. package/dist/mdruntime/store/fences.d.ts +0 -15
  103. package/dist/mdruntime/turn.d.ts +0 -8
@@ -1,104 +1,58 @@
1
1
  import { type Validation } from '../mdmodel/index.js';
2
- import type { OperationScopes, PathRule, ProviderLimit } from './adapter.js';
3
- import { type Change, type ChangeBatch, type Precondition, type WrittenBy } from './change.js';
2
+ import type { ProviderLimit } from './adapter.js';
3
+ import { type ChangeBatch, type WrittenBy } from './change.js';
4
4
  import { type Composition } from './collection.js';
5
+ import type { WriteRule } from './declaration.js';
5
6
  import { type Layer } from './overlay.js';
6
- import type { VisibleLayer } from './replica.js';
7
- import type { ChangedPart } from './room-draft.js';
7
+ import type { ReplicaRecord, VisibleLayer } from './replica.js';
8
+ import { type ChangedPart, type RoomDraftRecord, type SavedDraft } from './room-draft.js';
8
9
  export type SaveRefusal = {
9
10
  code: string;
10
11
  retryable: boolean;
11
12
  file?: string;
12
13
  location?: string;
14
+ line?: number;
13
15
  referrers?: readonly string[];
14
16
  parts?: readonly ChangedPart[];
15
17
  };
16
- export type SaveInput = {
17
- local: boolean;
18
- composition: Composition;
19
- baseRoomVersion: string;
20
- operations: import('./adapter.js').OperationScopes;
21
- providerOwnedPaths: readonly string[];
22
- providerLimits: readonly ProviderLimit[];
23
- pathRule: PathRule;
24
- visible: VisibleLayer;
25
- folders: ReadonlySet<string>;
26
- handle: string;
27
- changes: readonly Change[];
28
- bases: readonly Precondition[];
29
- queued?: ReadonlySet<string>;
30
- writtenBy?: WrittenBy;
31
- unmodeled: boolean;
32
- validate: Validator;
18
+ export type SaveAsk = {
19
+ readonly saved: readonly SavedDraft[];
20
+ readonly consumed: ReadonlySet<string>;
21
+ readonly writtenBy?: WrittenBy;
22
+ readonly local: boolean;
23
+ readonly providerLimits: readonly ProviderLimit[];
33
24
  };
34
- export type Validator = (resulting: Layer, touched: readonly string[]) => Promise<Validation>;
35
- type Refusing = {
36
- kind: 'refused';
37
- refusal: SaveRefusal;
25
+ export type SavingRoom = {
26
+ readonly record: ReplicaRecord;
27
+ readonly rule: WriteRule;
28
+ readonly composition: Composition;
29
+ readonly queue: readonly ChangeBatch[];
30
+ readonly changeable: ReadonlySet<string>;
31
+ readonly saved: ReadonlyMap<string, readonly SavedDraft[]>;
32
+ readonly replay: (queue: readonly ChangeBatch[]) => Generator<number, VisibleLayer, void>;
33
+ readonly folders: ReadonlySet<string>;
34
+ readonly modelled: boolean;
35
+ readonly drafts: ReadonlyMap<string, RoomDraftRecord>;
36
+ readonly validate: Validator;
38
37
  };
39
- export type BatchResult = {
40
- kind: 'batch';
41
- batch: ChangeBatch;
42
- } | Refusing;
43
- export declare function providerRewritten(batch: ChangeBatch, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
44
- export declare function leavingRewritten(batch: ChangeBatch, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
45
- export declare function rewriting(batch: ChangeBatch, locator: string): boolean;
46
- export declare function effectiveIn(batch: ChangeBatch, locator: string, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
47
- export declare function queuedDocuments(queue: readonly ChangeBatch[]): ReadonlySet<string>;
48
- export type Requeued = {
49
- kind: 'requeued';
50
- queue: readonly ChangeBatch[];
51
- changes: readonly Change[];
52
- queued: ReadonlySet<string>;
53
- withdrawn: ReadonlyMap<string, ChangeBatch | null>;
54
- owners: ReadonlySet<string>;
55
- } | {
56
- kind: 'refused';
57
- refusal: SaveRefusal;
38
+ export type PlannedRoom = {
39
+ readonly locator: string;
40
+ readonly queue: readonly ChangeBatch[];
41
+ readonly saved: ReadonlyMap<string, readonly SavedDraft[]>;
42
+ readonly consumed: readonly string[];
43
+ readonly carried: readonly RoomDraftRecord[];
58
44
  };
59
- export type Joining = {
60
- kind: 'joined';
61
- batch: ChangeBatch;
62
- queue: readonly ChangeBatch[];
45
+ export type SavePlan = {
46
+ readonly kind: 'refused';
47
+ readonly refusal: SaveRefusal;
63
48
  } | {
64
- kind: 'refused';
65
- refusal: SaveRefusal;
66
- };
67
- type VisibleOver = (queue: readonly ChangeBatch[]) => Generator<number, VisibleLayer, void>;
68
- export declare function requeuing(queue: readonly ChangeBatch[], changes: readonly Change[], visible: VisibleLayer, changeable: (batch: ChangeBatch) => boolean, state: VisibleOver): Generator<number, Requeued, void>;
69
- export declare function joined(queue: readonly ChangeBatch[], owner: ChangeBatch, extra: ChangeBatch): Joining;
70
- export declare function limiting(queue: readonly ChangeBatch[], batch: ChangeBatch, limits: readonly ProviderLimit[], state: VisibleOver): Generator<number, SaveRefusal | null, void>;
71
- export declare const MOVE_DOCUMENTS = "move-documents";
72
- export type MoveSide = {
73
- room: string;
74
- handle: string;
75
- baseRoomVersion: string;
76
- composition: Composition;
77
- operations: OperationScopes;
78
- providerOwnedPaths: readonly string[];
79
- visible: VisibleLayer;
80
- folders: ReadonlySet<string>;
81
- queued: ReadonlySet<string>;
82
- unmodeled: boolean;
83
- validate: Validator;
49
+ readonly kind: 'planned';
50
+ readonly identifier: string;
51
+ readonly rooms: readonly PlannedRoom[];
84
52
  };
85
- export type MoveInput = {
86
- source: MoveSide;
87
- destination: MoveSide;
88
- moves: readonly {
89
- readonly path: string;
90
- readonly to: string;
91
- }[];
92
- providerLimits: readonly ProviderLimit[];
93
- pathRule: PathRule;
94
- local: boolean;
95
- writtenBy?: WrittenBy;
96
- };
97
- export type MoveResult = {
98
- kind: 'moved';
99
- leaving: ChangeBatch;
100
- arriving: ChangeBatch;
101
- } | Refusing;
102
- export declare function buildMove(input: MoveInput): Promise<MoveResult>;
103
- export declare function buildBatch(input: SaveInput): Promise<BatchResult>;
104
- export {};
53
+ export type Validator = (resulting: Layer, touched: readonly string[]) => Promise<Validation>;
54
+ export declare function providerRewritten(batch: ChangeBatch, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
55
+ export declare function rewriting(batch: ChangeBatch, locator: string): boolean;
56
+ export declare function effectiveIn(batch: ChangeBatch, locator: string, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
57
+ export declare function destination(locator: string, saved: readonly SavedDraft[]): string | null;
58
+ export declare function planSave(ask: SaveAsk, room: SavingRoom, into?: SavingRoom): Promise<SavePlan>;
@@ -1,11 +1,10 @@
1
- import { type ChangeSet } from './change-set.js';
2
1
  import { type ChangeBatch, type WrittenBy } from './change.js';
2
+ import type { ConversationFiles } from './conversation.js';
3
3
  import { type AttachAnswer, type BinaryLinkAnswer, type HeldBinaryAnswer, type HeldShownAnswer } from './outcome.js';
4
- import { type HeldReplica, type ReplicaRecord, type Slice, type VisibleLayer } from './replica.js';
5
- import { type ReturnReason, type RoomDraftParts } from './room-draft.js';
4
+ import { type RoomDraftParts } from './room-draft.js';
6
5
  import type { Runtime } from './runtime.js';
7
6
  import { type SaveRefusal } from './save.js';
8
- import type { AuthoredWrite, CommittedWrite, PendingState, RoomCommit, RuntimeStore, Store, StoredEntry, View, Work } from './store.js';
7
+ import type { Store } from './store.js';
9
8
  export type SaveResult = {
10
9
  outcome: 'saved';
11
10
  identifier: string;
@@ -27,43 +26,8 @@ export type BinaryFileSurface = {
27
26
  attach(room: string, file: File): Promise<AttachAnswer>;
28
27
  part(file: string, part: number): Promise<Uint8Array | null>;
29
28
  };
30
- export type Leaving = {
31
- batch: ChangeBatch;
32
- returned: ReturnReason | null;
33
- };
34
- export declare function withdrawable(states: ReadonlyMap<string, PendingState>): (batch: ChangeBatch) => boolean;
35
- export declare function sliceAt(store: Store, record: ReplicaRecord, view: View, queue: readonly ChangeBatch[], extra?: Iterable<string>, moved?: Iterable<string>): Promise<Slice>;
36
- export declare function landedWhole(store: Store, locator: string, batch: ChangeBatch, confirmedLayer: Slice, current?: Readonly<Record<string, string>>): Promise<boolean>;
37
- export type Settling = {
38
- leaving?: readonly Leaving[];
39
- room?: boolean;
40
- view?: View;
41
- commit?: Pick<RoomCommit, 'published' | 'refreshed'>;
42
- changes?: {
43
- readonly set: readonly StoredEntry[];
44
- readonly removed: readonly string[];
45
- };
46
- };
47
- export declare function preparedAfter(runtime: Runtime, locator: string, answer: CommittedWrite): void;
48
- export declare function replayed(store: Store, record: ReplicaRecord, confirmedLayer: Slice, queue: readonly ChangeBatch[]): import("./turn.js").Later<import("./replica.js").Replayed>;
49
- export declare function overlayDiff(record: ReplicaRecord, before: HeldReplica | undefined, visible: VisibleLayer, touched: ReadonlySet<string>): Promise<{
50
- overlay: NonNullable<RoomCommit['overlay']>;
51
- touched: ReadonlySet<string>;
52
- }>;
53
- export type Settlement = {
54
- readonly locator: string;
55
- readonly left: readonly ChangeBatch[];
56
- readonly commit: {
57
- readonly rooms: readonly RoomCommit[];
58
- readonly writes: readonly AuthoredWrite[];
59
- };
60
- apply(answer: CommittedWrite): ChangeSet;
61
- };
62
- export declare function settle(runtime: Runtime, local: RuntimeStore, locator: string, work: Work, record: ReplicaRecord, queue: readonly ChangeBatch[], settling?: Settling): Promise<ChangeSet>;
63
- export declare function together(runtime: Runtime, local: RuntimeStore, settlements: readonly Settlement[]): Promise<ChangeSet>;
64
- export declare function settlement(runtime: Runtime, local: RuntimeStore, locator: string, work: Work, record: ReplicaRecord, queue: readonly ChangeBatch[], settling?: Settling): Promise<Settlement>;
65
- export declare function unpairing(runtime: Runtime, local: RuntimeStore, locator: string, batches: readonly ChangeBatch[]): Promise<Settlement>;
66
29
  export declare function saveRoomDrafts(runtime: Runtime, locator: string, named: readonly SavedRoomDraft[], writtenBy: WrittenBy | undefined): Promise<SaveResult>;
67
30
  export declare function saveParts(runtime: Runtime, locator: string, named: readonly SavedParts[], writtenBy: WrittenBy | undefined): Promise<SaveResult>;
68
31
  export declare function batchFile(store: Store, batch: ChangeBatch): (localId: string) => Promise<Blob>;
32
+ export declare function conversationFiles(runtime: Runtime): ConversationFiles;
69
33
  export declare function binaryFileSurface(runtime: Runtime): BinaryFileSurface;
@@ -1,8 +1,13 @@
1
+ import type { CallResult } from '../outcome.js';
1
2
  export type Live = () => boolean;
3
+ export type KeptSender = {
4
+ next(): Promise<CallResult>;
5
+ };
2
6
  type LaneRules = {
3
7
  generation(): number;
4
8
  continuing(): boolean;
5
9
  stopping(): boolean;
10
+ failed(locator: string, error: unknown): void;
6
11
  };
7
12
  export type Lanes = {
8
13
  task(lane: string, work: (live: Live) => Promise<void>): Promise<void>;
@@ -11,9 +16,12 @@ export type Lanes = {
11
16
  roomWork(): number;
12
17
  current(): Promise<unknown>;
13
18
  finished(): Promise<unknown>;
14
- calling(operation: string): boolean;
15
- call(operation: string): void;
16
- called(operation: string): void;
19
+ sender(operation: string): KeptSender | undefined;
20
+ sending(operation: string, sender: KeptSender): void;
21
+ sent(operation: string, sender: KeptSender): void;
22
+ settled(operation: string): Promise<void>;
23
+ settle(operation: string, lost: boolean): void;
24
+ unclaimed(operation: string): boolean;
17
25
  };
18
- export declare function createLanes({ generation, continuing, stopping }: LaneRules): Lanes;
26
+ export declare function createLanes({ generation, continuing, stopping, failed }: LaneRules): Lanes;
19
27
  export {};
@@ -1,4 +1,4 @@
1
- import type { Authorization, ProviderRefusal, ServiceMode } from '../adapter.js';
1
+ import type { Authorization, Discovery, ProviderRefusal, QueriedRoom, ServiceMode } from '../adapter.js';
2
2
  import { type Cell } from '../cell.js';
3
3
  import type { Open } from '../open.js';
4
4
  import type { CycleProgress, SyncStatus } from '../status.js';
@@ -6,7 +6,6 @@ export type RefusalReason = 'missing-required-guarantee' | 'revoked-authorizatio
6
6
  export type ConnectionRefusalCode = Open<RefusalReason>;
7
7
  export type ConnectionRefusal = {
8
8
  code: ConnectionRefusalCode;
9
- retryable: boolean;
10
9
  reauthorizationOffered: boolean;
11
10
  refusal: ProviderRefusal | null;
12
11
  };
@@ -24,6 +23,9 @@ export type Session = {
24
23
  readonly discoveries: number;
25
24
  readonly roomsNamed: boolean;
26
25
  readonly roomsListed: boolean;
26
+ readonly queriesOnly: readonly QueriedRoom[];
27
+ readonly unstored: Discovery | null;
28
+ readonly lastCompleted: string | null;
27
29
  readonly serviceMode: ServiceMode;
28
30
  readonly haltedRefusal: boolean;
29
31
  readonly openSignals: number;
@@ -1,14 +1,12 @@
1
1
  import type { Adapter, Authorization, ConversationEvent, Discovery, HeldRoom, RoomStreamEvent, ServiceMode } from './adapter.js';
2
2
  import type { Reads } from './bootstrap.js';
3
3
  import type { Cell } from './cell.js';
4
- import type { Log } from './log.js';
4
+ import type { Retries } from './retried.js';
5
5
  import { type Admission } from './socket/admission.js';
6
6
  import { type Answers } from './socket/answers.js';
7
7
  import { type Lanes } from './socket/lanes.js';
8
- import { type Rooms } from './socket/rooms.js';
9
8
  import { type Session } from './socket/session.js';
10
- export type { Live } from './socket/lanes.js';
11
- export type { Declared, RoomDeclaration } from './socket/rooms.js';
9
+ export type { KeptSender, Live } from './socket/lanes.js';
12
10
  export type { ConnectionRefusal, ConnectionRefusalCode, Moving, RefusalReason, } from './socket/session.js';
13
11
  type SocketEvent = {
14
12
  readonly kind: 'opened';
@@ -28,12 +26,12 @@ export type RuntimeSocket = Admission & Answers & {
28
26
  readonly reads: Reads;
29
27
  readonly streamed: boolean;
30
28
  readonly session: Cell<Session>;
31
- readonly rooms: Rooms;
32
29
  readonly lanes: Lanes;
33
30
  readonly ready: Promise<void>;
34
31
  readonly firstDiscovery: Promise<void>;
35
32
  conversations(): Adapter['conversations'];
36
33
  search(): Adapter['search'];
34
+ queryHouse(): Adapter['queryHouse'];
37
35
  discover(authorized: Authorization): ReturnType<NonNullable<Adapter['discover']>> | undefined;
38
36
  follows: Adapter['follows'];
39
37
  mutate: Adapter['mutate'];
@@ -66,4 +64,4 @@ export type RuntimeSocket = Admission & Answers & {
66
64
  abortReads(): void;
67
65
  stopReads(): void;
68
66
  };
69
- export declare function createSocket(adapter: Adapter, journal: Log, authorization: Authorization | undefined): RuntimeSocket;
67
+ export declare function createSocket(adapter: Adapter, retries: Retries, authorization: Authorization | undefined): RuntimeSocket;
@@ -1,3 +1,4 @@
1
+ export type RequestAnswer = 'at_once' | 'ask_me' | 'off';
1
2
  export type HouseSource = {
2
3
  readonly kind: 'request';
3
4
  readonly request: string;
@@ -8,8 +9,12 @@ export type HouseSource = {
8
9
  };
9
10
  readonly room: {
10
11
  readonly ref: string;
12
+ readonly handle: string;
11
13
  readonly name: string;
12
14
  };
15
+ readonly sent: string;
16
+ readonly instruction: string | null;
17
+ readonly answer: RequestAnswer | null;
13
18
  readonly approved: string | null;
14
19
  } | {
15
20
  readonly kind: 'mail';
@@ -45,13 +50,6 @@ export type ChatRequest = {
45
50
  readonly room: string;
46
51
  readonly message?: string;
47
52
  };
48
- export type ChatRoomRequest = {
49
- readonly request: string;
50
- readonly room: {
51
- readonly ref: string;
52
- readonly name: string;
53
- };
54
- };
55
53
  type RequestAgentFunction = {
56
54
  readonly name: string;
57
55
  readonly version: number;
@@ -21,9 +21,9 @@ export declare const NO_INSTALL: RoomInstall;
21
21
  export type Installs = {
22
22
  of(locator: string): RoomInstall;
23
23
  change(locator: string, next: (held: RoomInstall) => RoomInstall): void;
24
- underway(): ReadonlySet<string>;
24
+ underway(among: readonly string[] | null): ReadonlySet<string>;
25
25
  transferring(): readonly string[];
26
- arrivalDue(now: number, everyMs: number): boolean;
26
+ arrivalsDue(locator: string, now: number, everyMs: number): readonly string[];
27
27
  };
28
28
  export declare function createInstalls(): Installs;
29
29
  export {};
@@ -1,9 +1,10 @@
1
- export type ReadinessQueue<W> = {
1
+ export type ReadinessQueue<W, S> = {
2
2
  add(watch: W): () => void;
3
3
  held(watch: W): boolean;
4
- changed(watch: W, reading: string): boolean;
4
+ kept(watch: W): S | undefined;
5
+ keep(watch: W, shown: S): void;
5
6
  owe(watches: readonly W[]): void;
6
- queue(): void;
7
+ queue(rooms?: readonly string[]): void;
7
8
  close(): void;
8
9
  };
9
- export declare function createReadinessQueue<W>(deliver: (owed: readonly W[]) => Promise<void>, unpublished: (error: unknown) => void): ReadinessQueue<W>;
10
+ export declare function createReadinessQueue<W, S>(deliver: (owed: readonly W[], rooms: ReadonlySet<string> | null) => Promise<void>, unpublished: (error: unknown) => void): ReadinessQueue<W, S>;
@@ -1,4 +1,4 @@
1
- import type { BootstrapInventory, Capability, ListedConversation, Member, ProviderLimit } from '../adapter.js';
1
+ import type { BootstrapInventory, Capability, ListedAgent, ListedConversation, Member, ProviderLimit, QueriedRoom, RoomList } from '../adapter.js';
2
2
  import type { ChangeBatch } from '../change.js';
3
3
  import { type Composition } from '../collection.js';
4
4
  import type { Plan } from '../query.js';
@@ -6,9 +6,9 @@ import type { ReplicaRecord } from '../replica.js';
6
6
  import type { Submission } from '../outcome.js';
7
7
  import type { RoomDraftRecord, SavedDraft } from '../room-draft.js';
8
8
  import type { ModelState, StoredModel } from '../model.js';
9
- import type { CommittedWrite, ConversationWrite, HeldConversation, HeldRow, HeldEntry, MessageWindow, QueryAnswer, QueryRoom, Referrer, ReplicaOpened, RoomCommit, RuntimeDatabase, StoredEntry, StoredFile, TypedEntry, View } from '../tables.js';
10
- import type { JobMarker } from '../job.js';
11
- export type { ConversationWrite, HeldConversation, MessageWindow } from '../tables.js';
9
+ import type { CommittedWrite, ConversationWrite, HeldConversation, HeldFact, HeldRow, HeldEntry, MessageWindow, QueryAnswer, QueryRoom, Referrer, ReplicaOpened, RoomCommit, RuntimeDatabase, StoredEntry, StoredFile, TypedEntry, View } from '../tables.js';
10
+ export type { ConversationFact, ConversationWrite, HeldConversation, MessageWindow, } from '../tables.js';
11
+ declare const FILE = "\0file";
12
12
  export type TransferRecord = {
13
13
  readonly locator: string;
14
14
  readonly transfer: string;
@@ -93,6 +93,7 @@ export type HeldWork = {
93
93
  readonly queue: readonly QueuedChange[];
94
94
  };
95
95
  export type CoveredRoom = {
96
+ readonly handle: string;
96
97
  readonly key: number;
97
98
  readonly transfer: string;
98
99
  readonly roomVersion: string;
@@ -103,6 +104,7 @@ export type CoveredRoom = {
103
104
  };
104
105
  export type HeldCover = {
105
106
  readonly rooms: ReadonlyMap<string, CoveredRoom>;
107
+ readonly locking: ReadonlySet<string>;
106
108
  readonly queues: ReadonlyMap<string, readonly string[]>;
107
109
  };
108
110
  export type HeldStatus = {
@@ -123,9 +125,15 @@ export type Facts = {
123
125
  readonly providerLimits: readonly ProviderLimit[];
124
126
  readonly capabilities: readonly Capability[];
125
127
  readonly member: Member | null;
128
+ readonly timeZone: string | null;
126
129
  readonly targets: Readonly<Record<string, TargetRecord>>;
127
130
  readonly conversationList: readonly ListedConversation[] | null;
131
+ readonly agentList: readonly ListedAgent[] | null;
128
132
  readonly conversationCursor: string | null;
133
+ readonly chatPins: readonly string[];
134
+ readonly readUntil: string | null;
135
+ readonly roomList: RoomList | null;
136
+ readonly queriesOnly: readonly QueriedRoom[];
129
137
  };
130
138
  export type Commit = {
131
139
  readonly rooms: readonly RoomCommit[];
@@ -158,6 +166,7 @@ export type RuntimeStore = {
158
166
  readonly room: boolean;
159
167
  }>;
160
168
  facts(): Promise<Facts>;
169
+ facts<K extends keyof Facts>(names: readonly K[]): Promise<Pick<Facts, K>>;
161
170
  presentation(app: string): Promise<unknown>;
162
171
  demote(): Promise<void>;
163
172
  query(plan: Plan, rooms: readonly QueryRoom[], budget: number | null): Promise<QueryAnswer>;
@@ -165,7 +174,7 @@ export type RuntimeStore = {
165
174
  entries(key: number, view: View, paths: readonly string[]): Promise<readonly HeldEntry[]>;
166
175
  typed(key: number, view: View, paths: readonly string[]): Promise<readonly TypedEntry[]>;
167
176
  referrers(key: number, view: View, targets: readonly string[]): Promise<readonly Referrer[]>;
168
- folders(key: number, view: View, paths: readonly string[]): Promise<readonly string[]>;
177
+ folders(key: number, paths: readonly string[]): Promise<readonly string[]>;
169
178
  typedWithin(key: number, view: View, roots: readonly string[], within: boolean): Promise<boolean>;
170
179
  stage(record: TransferRecord, composition: Composition, page: StagedPage): Promise<number | null>;
171
180
  resume(record: TransferRecord, composition: Composition, parts: readonly string[], published: number | null): Promise<ResumedTransfer | null>;
@@ -192,8 +201,10 @@ export type RuntimeStore = {
192
201
  messageCount(conversation: string, phrase?: string | null): Promise<number>;
193
202
  turnArrived(conversation: string, turn: string): Promise<boolean>;
194
203
  conversationRows(conversations: readonly string[]): Promise<readonly HeldRow[]>;
195
- jobMarkers(conversation: string): Promise<readonly JobMarker[]>;
196
- dropConversations(conversations: readonly string[]): Promise<void>;
204
+ conversationFacts(): Promise<readonly HeldFact[]>;
205
+ keepConversationFact(fact: HeldFact): Promise<void>;
206
+ storedConversations(): Promise<readonly string[]>;
207
+ dropConversations(conversations: readonly string[]): Promise<readonly string[]>;
197
208
  chatDrafts(): Promise<readonly ChatDraftRecord[]>;
198
209
  chatDraft(conversation: string): Promise<ChatDraftRecord | null>;
199
210
  keepChatDrafts(records: readonly ChatDraftRecord[]): Promise<void>;
@@ -208,4 +219,8 @@ export type RuntimeStore = {
208
219
  rememberGeneration(value: string): Promise<void>;
209
220
  file(key: string, type: string): Promise<Blob>;
210
221
  };
211
- export declare function openRuntimeStore(authored: RuntimeDatabase): RuntimeStore;
222
+ export type FileMark = {
223
+ readonly [FILE]: string;
224
+ readonly type: string;
225
+ };
226
+ export declare function openRuntimeStore(database: RuntimeDatabase): RuntimeStore;
@@ -0,0 +1,7 @@
1
+ import type { ListedEntry, Listing } from '../listing.js';
2
+ export type RoomsShown = {
3
+ now(): Listing | null;
4
+ show(listing: Listing | null): void;
5
+ patch(entries: readonly ListedEntry[]): void;
6
+ };
7
+ export declare function createRoomsShown(): RoomsShown;
@@ -4,7 +4,7 @@ export type Space = {
4
4
  fill(): boolean;
5
5
  probing(): boolean;
6
6
  probeEachMinute(): void;
7
- probe(): Promise<boolean>;
7
+ probe(): Promise<void>;
8
8
  stop(): void;
9
9
  };
10
10
  export declare function createSpace(database: RuntimeDatabase, freed: () => void): Space;
@@ -4,26 +4,26 @@ import { type Cell } from './cell.js';
4
4
  import type { ChangeBatch } from './change.js';
5
5
  import type { ChangeSet } from './change-set.js';
6
6
  import type { Composition } from './collection.js';
7
- import type { ReadinessWatch } from './preparation.js';
7
+ import type { ReadinessShowing, ReadinessWatch } from './preparation.js';
8
8
  import type { Persistence } from './readiness.js';
9
- import type { Listing } from './listing.js';
9
+ import type { Retries } from './retried.js';
10
10
  import type { Seeded } from './seed.js';
11
11
  import type { ModelState } from './model.js';
12
12
  import { type OpenedFiles } from './opened.js';
13
13
  import { type HeldReplica, type ReplicaRecord } from './replica.js';
14
- import type { RoomDraftRecord } from './room-draft.js';
14
+ import type { ReturnReason, RoomDraftRecord } from './room-draft.js';
15
15
  import { type SyncStatus } from './status.js';
16
16
  import type { RuntimeDatabase } from './tables.js';
17
- import { type Fences } from './store/fences.js';
18
17
  import { type Installs } from './store/installs.js';
19
- import { type HeldCover, type PendingState, type RuntimeStore } from './store/records.js';
18
+ import { type HeldCover, type HeldStatus, type PendingState, type RuntimeStore } from './store/records.js';
20
19
  import { type ReadinessQueue } from './store/readiness.js';
21
20
  import { type RoomHeld } from './store/room-held.js';
21
+ import { type RoomsShown } from './store/rooms-shown.js';
22
22
  import { type Space } from './store/space.js';
23
23
  import { type Watcher, type Watching } from './store/watchers.js';
24
24
  import { createWrites, type InstallHold } from './store/writes.js';
25
- export { NO_INSTALL, type RoomInstall } from './store/installs.js';
26
- export type { AuthoredWrite, ChatDraftRecord, ChatSubmission, CoveredRoom, Facts, HeldConversation, HeldCover, PendingState, RefreshedPage, RuntimeStore, StagedPage, TransferRecord, } from './store/records.js';
25
+ export type { RoomInstall } from './store/installs.js';
26
+ export type { AuthoredWrite, ChatDraftRecord, ChatSubmission, ConversationFact, CoveredRoom, Facts, HeldConversation, HeldCover, PendingState, RefreshedPage, RuntimeStore, StagedPage, TransferRecord, } from './store/records.js';
27
27
  export type { InstallHold } from './store/writes.js';
28
28
  export type { CommittedWrite, QueryRoom, RoomCommit, RuntimeDatabase, StoredEntry, StoredFile, View, } from './tables.js';
29
29
  export type Stored = {
@@ -39,7 +39,10 @@ export type Work = {
39
39
  readonly queue: readonly ChangeBatch[];
40
40
  readonly states: ReadonlyMap<string, PendingState>;
41
41
  };
42
- type LandedAhead = Readonly<Record<string, string | undefined>>;
42
+ type HeldConflict = {
43
+ readonly revisions: Readonly<Record<string, string | undefined>>;
44
+ readonly returned: ReturnReason | null;
45
+ };
43
46
  type AttachedFile = {
44
47
  readonly revision: string;
45
48
  readonly mediaType: string;
@@ -49,16 +52,16 @@ type Seeds = {
49
52
  keep(key: string, seed: Seeded): void;
50
53
  drop(key: string): void;
51
54
  };
52
- export type Device = {
55
+ type Device = {
53
56
  readonly persistence: Persistence;
54
57
  readonly storageLoss: string | null;
55
- readonly heldWhenOpened: boolean;
58
+ readonly completedWhenOpened: boolean;
56
59
  readonly preparing: boolean;
57
60
  readonly sweeping: boolean;
58
61
  readonly unpreparedDemand: ReadonlySet<string>;
62
+ readonly unpreparable: ReadonlySet<string>;
59
63
  readonly establishing: ReadonlySet<string>;
60
64
  readonly status: SyncStatus;
61
- readonly roomsShown: Listing | null;
62
65
  };
63
66
  type StoreOptions = {
64
67
  readonly database: RuntimeDatabase;
@@ -66,19 +69,24 @@ type StoreOptions = {
66
69
  readonly builtIn: ModelState;
67
70
  readonly typedPaths: readonly TypedPath[];
68
71
  readonly persistence: Persistence;
72
+ readonly retries: Retries;
73
+ lost(locator: string): boolean;
74
+ losing(): boolean;
69
75
  opening(records: RuntimeStore): Promise<RuntimeStore>;
70
76
  unpublished(error: unknown): void;
71
77
  changed(set: ChangeSet): Promise<void>;
72
- deliverReadiness(owed: readonly ReadinessWatch[]): Promise<void>;
78
+ deliverReadiness(owed: readonly ReadinessWatch[], rooms: ReadonlySet<string> | null): Promise<void>;
73
79
  spaceFreed(): void;
74
80
  };
75
81
  export type Store = {
76
82
  readonly device: Cell<Device>;
83
+ readonly roomsShown: RoomsShown;
77
84
  readonly space: Space;
78
- readonly readiness: ReadinessQueue<ReadinessWatch>;
85
+ readonly readiness: ReadinessQueue<ReadinessWatch, ReadinessShowing>;
79
86
  ask: RuntimeDatabase['ask'];
80
87
  changed(set: ChangeSet): Promise<void>;
81
88
  open(): Promise<RuntimeStore>;
89
+ needed(): boolean;
82
90
  durably<T>(work: (local: RuntimeStore) => Promise<T>): Promise<T>;
83
91
  exclusive<T>(work: () => Promise<T>): Promise<T>;
84
92
  gathered<I, T>(key: string, input: I, merge: (earlier: I, later: I) => I | null, work: (input: I) => Promise<T>): Promise<T>;
@@ -95,21 +103,23 @@ export type Store = {
95
103
  work(locator: string): Promise<Work>;
96
104
  replica(locator: string): Promise<Held | undefined>;
97
105
  covering(): Promise<HeldCover>;
106
+ status(): Promise<HeldStatus>;
107
+ queued(): Promise<readonly string[]>;
98
108
  drafts(locator?: string, paths?: readonly string[]): Promise<readonly RoomDraftRecord[]>;
99
109
  draft(locator: string, path: string): Promise<RoomDraftRecord | undefined>;
100
- composed(record: Pick<ReplicaRecord, 'model' | 'typedSelection'>): Composition;
110
+ composed(record: Pick<ReplicaRecord, 'model' | 'declaration'>): Composition;
101
111
  publication(work: () => Promise<void>): Promise<void>;
102
112
  owing<T>(topic: string, add: (owed: T | undefined) => T, work: (owed: T) => Promise<void>): Promise<void>;
103
113
  watch(topic: string, notify: (value: unknown) => void): Watcher;
104
114
  watching(topic: string, which?: Watching): readonly Watcher[];
105
115
  tell(topic: string, value: unknown): void;
106
- readonly fences: Fences;
107
116
  readonly installs: Installs;
108
117
  readonly seeds: Seeds;
109
- readonly landed: RoomHeld<LandedAhead>;
118
+ readonly conflicted: RoomHeld<HeldConflict>;
110
119
  readonly attached: RoomHeld<AttachedFile>;
111
120
  readonly opened: OpenedFiles;
112
121
  part(file: string, part: number): Promise<Uint8Array | null>;
122
+ prepareAgain(locator?: string): void;
113
123
  forget(locator: string): void;
114
124
  close(): void;
115
125
  };