@agentshouse/mdruntime-adapter 0.1.0-c819869684b89 → 0.1.0-c82ec25e72f2f
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/adapter.d.ts.map +1 -1
- package/dist/adapter.js +75 -67
- package/dist/chunks.d.ts +28 -0
- package/dist/chunks.d.ts.map +1 -0
- package/dist/chunks.js +206 -0
- package/dist/discovery.d.ts +1 -2
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +2 -3
- package/dist/house-model.d.ts +38 -308
- package/dist/house-model.d.ts.map +1 -1
- package/dist/house-model.js +26 -166
- package/dist/model.d.ts +4 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +29 -7
- package/dist/read.d.ts +12 -1
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +24 -2
- package/dist/room-stream.d.ts +2 -1
- package/dist/room-stream.d.ts.map +1 -1
- package/dist/room-stream.js +2 -2
- package/dist/room-types.d.ts.map +1 -1
- package/dist/room-types.js +0 -2
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +7 -11
- package/dist/space-schema.d.ts +7 -0
- package/dist/space-schema.d.ts.map +1 -0
- package/dist/space-schema.js +18 -0
- package/dist/stream.d.ts +6 -4
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +83 -14
- package/dist/transport.d.ts +4 -3
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +1 -0
- package/dist/write.js +1 -1
- package/package.json +2 -2
package/dist/house-model.js
CHANGED
|
@@ -26,27 +26,6 @@ export const HOUSE_MODEL_DECLARATION = {
|
|
|
26
26
|
maxLength: 512,
|
|
27
27
|
pattern: '^(?:a_[A-Za-z0-9._-]+(?:\\/source)?|r_[A-Za-z0-9._-]+(?:\\/(?:settings|settings\\/schema|settings\\/model|settings\\/indexing|content))?)$',
|
|
28
28
|
},
|
|
29
|
-
trigger_test: {
|
|
30
|
-
description: 'One test of a Trigger condition as the Trigger reference page writes one, a value compared at a `path` or `all`, `any` or `not` of tests.',
|
|
31
|
-
type: 'object',
|
|
32
|
-
additionalProperties: true,
|
|
33
|
-
},
|
|
34
|
-
trigger_values: {
|
|
35
|
-
type: 'array',
|
|
36
|
-
items: { anyOf: [{ type: 'string' }, { type: 'number' }, { type: 'boolean' }] },
|
|
37
|
-
},
|
|
38
|
-
trigger_scope: {
|
|
39
|
-
description: 'The documents a Trigger condition watches, by `type`, by `folder` or one document at its `path`, which `create_trigger` takes as `document`.',
|
|
40
|
-
type: 'object',
|
|
41
|
-
additionalProperties: false,
|
|
42
|
-
properties: {
|
|
43
|
-
type: { type: 'string' },
|
|
44
|
-
folder: { type: 'string' },
|
|
45
|
-
path: { type: 'string' },
|
|
46
|
-
},
|
|
47
|
-
minProperties: 1,
|
|
48
|
-
maxProperties: 1,
|
|
49
|
-
},
|
|
50
29
|
},
|
|
51
30
|
'house-app-preferences': {
|
|
52
31
|
description: "An App's preferences. Its own vocabulary is in the body.",
|
|
@@ -54,7 +33,7 @@ export const HOUSE_MODEL_DECLARATION = {
|
|
|
54
33
|
required: ['app'],
|
|
55
34
|
},
|
|
56
35
|
'house-notification': {
|
|
57
|
-
description: "One kept
|
|
36
|
+
description: "One kept Notification for this User: its kind, when it was sent as `created`, its way in, its email's subject and each fact of its value that is not sealed, named in snake_case. An entity a fact names is an object holding its identifier under the key of its kind, when the notification carries it, and its `name`, `email` and other facts beside it; a fact holding null is absent. `way_in` is either the House `path` it opens or the entity it is about, by its identifier under the key of its kind, a Trigger with its `room`. Its body is its email's words in Markdown. Both were worded once, in the User's language when it was delivered; an App may show them or word it itself from its kind and value. `read` is when the User opened it or marked it read, on any device: the one field House adds after delivery.",
|
|
58
37
|
properties: {
|
|
59
38
|
notification: { $ref: '#/$defs/id' },
|
|
60
39
|
kind: {
|
|
@@ -63,34 +42,27 @@ export const HOUSE_MODEL_DECLARATION = {
|
|
|
63
42
|
'share-offer',
|
|
64
43
|
'join-request',
|
|
65
44
|
'join-request-approved',
|
|
66
|
-
'app-room-binding-incompatible',
|
|
67
|
-
'app-call',
|
|
68
45
|
'room-ownership-offer',
|
|
69
46
|
'managed-environment-retention-opened',
|
|
70
|
-
'managed-environment-placement-intervention',
|
|
71
47
|
'storage-full',
|
|
72
48
|
'sandbox-budget-spent',
|
|
49
|
+
'trigger-failed',
|
|
73
50
|
'break-glass-owner-disclosure',
|
|
74
|
-
'agent-function-start-approval-request',
|
|
75
51
|
'export-ready',
|
|
76
52
|
'export-failed',
|
|
77
|
-
'site-disabled',
|
|
78
|
-
'site-binding-incompatible',
|
|
79
|
-
'site-images-full',
|
|
80
53
|
'custom',
|
|
81
54
|
],
|
|
82
55
|
},
|
|
83
56
|
created: { type: 'string', format: 'date-time' },
|
|
57
|
+
read: { type: 'string', format: 'date-time' },
|
|
84
58
|
way_in: {
|
|
85
59
|
type: 'object',
|
|
86
60
|
additionalProperties: false,
|
|
87
61
|
properties: {
|
|
88
62
|
path: { type: 'string', pattern: '^\\/' },
|
|
89
63
|
room: { $ref: '#/$defs/room' },
|
|
90
|
-
app: { $ref: '#/$defs/app' },
|
|
91
64
|
environment: { $ref: '#/$defs/id' },
|
|
92
65
|
trigger: { $ref: '#/$defs/id' },
|
|
93
|
-
site: { $ref: '#/$defs/id' },
|
|
94
66
|
},
|
|
95
67
|
minProperties: 1,
|
|
96
68
|
},
|
|
@@ -141,18 +113,8 @@ export const HOUSE_MODEL_DECLARATION = {
|
|
|
141
113
|
app: {
|
|
142
114
|
type: 'object',
|
|
143
115
|
additionalProperties: false,
|
|
144
|
-
properties: { app: { $ref: '#/$defs/app' }
|
|
145
|
-
|
|
146
|
-
},
|
|
147
|
-
release: { type: 'integer', minimum: 1 },
|
|
148
|
-
binding: { $ref: '#/$defs/id' },
|
|
149
|
-
slot: { type: 'string' },
|
|
150
|
-
findings: { type: 'array', items: { type: 'string' } },
|
|
151
|
-
caller: {
|
|
152
|
-
type: 'object',
|
|
153
|
-
additionalProperties: false,
|
|
154
|
-
properties: { user: { $ref: '#/$defs/id' }, name: { type: 'string' } },
|
|
155
|
-
required: ['user', 'name'],
|
|
116
|
+
properties: { app: { $ref: '#/$defs/app' } },
|
|
117
|
+
required: ['app'],
|
|
156
118
|
},
|
|
157
119
|
ownership_offer: { $ref: '#/$defs/id' },
|
|
158
120
|
offerer: {
|
|
@@ -173,7 +135,6 @@ export const HOUSE_MODEL_DECLARATION = {
|
|
|
173
135
|
},
|
|
174
136
|
reason: { type: 'string' },
|
|
175
137
|
deadline: { type: 'string', format: 'date-time' },
|
|
176
|
-
operation_kind: { type: 'string' },
|
|
177
138
|
free: {
|
|
178
139
|
type: 'object',
|
|
179
140
|
additionalProperties: false,
|
|
@@ -192,40 +153,8 @@ export const HOUSE_MODEL_DECLARATION = {
|
|
|
192
153
|
access_ended_at: { type: 'string', format: 'date-time' },
|
|
193
154
|
systems: { type: 'array', items: { type: 'string' } },
|
|
194
155
|
case_reference: { type: 'string' },
|
|
195
|
-
agent_function_request: { $ref: '#/$defs/id' },
|
|
196
|
-
requester: {
|
|
197
|
-
type: 'object',
|
|
198
|
-
additionalProperties: false,
|
|
199
|
-
properties: { name: { type: 'string' } },
|
|
200
|
-
required: ['name'],
|
|
201
|
-
},
|
|
202
|
-
agent: {
|
|
203
|
-
type: 'object',
|
|
204
|
-
additionalProperties: false,
|
|
205
|
-
properties: { agent: { $ref: '#/$defs/id' }, name: { type: 'string' } },
|
|
206
|
-
required: ['name'],
|
|
207
|
-
},
|
|
208
|
-
conversation: { $ref: '#/$defs/id' },
|
|
209
|
-
agent_function: {
|
|
210
|
-
type: 'object',
|
|
211
|
-
additionalProperties: false,
|
|
212
|
-
properties: {
|
|
213
|
-
name: { type: 'string' },
|
|
214
|
-
version: { type: 'integer', minimum: 1 },
|
|
215
|
-
},
|
|
216
|
-
required: ['name'],
|
|
217
|
-
},
|
|
218
156
|
export: { $ref: '#/$defs/id' },
|
|
219
157
|
size_bytes: { type: 'integer', minimum: 0 },
|
|
220
|
-
site: {
|
|
221
|
-
type: 'object',
|
|
222
|
-
additionalProperties: false,
|
|
223
|
-
properties: { site: { $ref: '#/$defs/id' }, name: { type: 'string' } },
|
|
224
|
-
required: ['site', 'name'],
|
|
225
|
-
},
|
|
226
|
-
address: { type: 'string', maxLength: 300, format: 'uri' },
|
|
227
|
-
copies: { type: 'integer', minimum: 0 },
|
|
228
|
-
bound: { type: 'integer', minimum: 0 },
|
|
229
158
|
title: { type: 'string' },
|
|
230
159
|
body: { type: 'string' },
|
|
231
160
|
authorship: {
|
|
@@ -239,6 +168,24 @@ export const HOUSE_MODEL_DECLARATION = {
|
|
|
239
168
|
required: ['kind', 'trigger', 'position'],
|
|
240
169
|
},
|
|
241
170
|
path: { type: 'string', maxLength: 4096, pattern: '^\\/.*' },
|
|
171
|
+
trigger: {
|
|
172
|
+
type: 'object',
|
|
173
|
+
additionalProperties: false,
|
|
174
|
+
properties: { trigger: { $ref: '#/$defs/id' }, description: { type: 'string' } },
|
|
175
|
+
required: ['trigger', 'description'],
|
|
176
|
+
},
|
|
177
|
+
code: {
|
|
178
|
+
type: 'string',
|
|
179
|
+
enum: [
|
|
180
|
+
'failed',
|
|
181
|
+
'function_failed',
|
|
182
|
+
'function_not_started',
|
|
183
|
+
'agent_function_request_not_started',
|
|
184
|
+
],
|
|
185
|
+
},
|
|
186
|
+
action: { type: 'integer', minimum: 0 },
|
|
187
|
+
moment: { type: 'string', format: 'date-time' },
|
|
188
|
+
error: { type: 'string' },
|
|
242
189
|
},
|
|
243
190
|
required: ['notification', 'kind', 'created', 'way_in', 'subject'],
|
|
244
191
|
},
|
|
@@ -278,96 +225,9 @@ export const HOUSE_MODEL_DECLARATION = {
|
|
|
278
225
|
trigger: { $ref: '#/$defs/id' },
|
|
279
226
|
description: { type: 'string' },
|
|
280
227
|
condition: {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
additionalProperties: false,
|
|
285
|
-
properties: {
|
|
286
|
-
on: { const: 'documents' },
|
|
287
|
-
scope: { $ref: '#/$defs/trigger_scope' },
|
|
288
|
-
mode: { const: 'starts_matching' },
|
|
289
|
-
new_documents: { type: 'boolean' },
|
|
290
|
-
match: { $ref: '#/$defs/trigger_test' },
|
|
291
|
-
by: { $ref: '#/$defs/trigger_test' },
|
|
292
|
-
moved_between_rooms: { type: 'boolean' },
|
|
293
|
-
},
|
|
294
|
-
required: ['on', 'scope', 'mode', 'new_documents', 'match'],
|
|
295
|
-
},
|
|
296
|
-
{
|
|
297
|
-
type: 'object',
|
|
298
|
-
additionalProperties: false,
|
|
299
|
-
properties: {
|
|
300
|
-
on: { const: 'documents' },
|
|
301
|
-
scope: { $ref: '#/$defs/trigger_scope' },
|
|
302
|
-
mode: { const: 'field_changes' },
|
|
303
|
-
field: { type: 'string' },
|
|
304
|
-
from: { anyOf: [{ $ref: '#/$defs/trigger_values' }, { const: 'new' }] },
|
|
305
|
-
to: { anyOf: [{ $ref: '#/$defs/trigger_values' }, { const: 'deleted' }] },
|
|
306
|
-
match: { $ref: '#/$defs/trigger_test' },
|
|
307
|
-
by: { $ref: '#/$defs/trigger_test' },
|
|
308
|
-
moved_between_rooms: { type: 'boolean' },
|
|
309
|
-
},
|
|
310
|
-
required: ['on', 'scope', 'mode', 'field'],
|
|
311
|
-
},
|
|
312
|
-
{
|
|
313
|
-
type: 'object',
|
|
314
|
-
additionalProperties: false,
|
|
315
|
-
properties: {
|
|
316
|
-
on: { const: 'items' },
|
|
317
|
-
source: { type: 'string' },
|
|
318
|
-
address: { type: 'string' },
|
|
319
|
-
match: { $ref: '#/$defs/trigger_test' },
|
|
320
|
-
},
|
|
321
|
-
required: ['on'],
|
|
322
|
-
},
|
|
323
|
-
{
|
|
324
|
-
type: 'object',
|
|
325
|
-
additionalProperties: false,
|
|
326
|
-
properties: {
|
|
327
|
-
on: { const: 'notifications' },
|
|
328
|
-
match: { $ref: '#/$defs/trigger_test' },
|
|
329
|
-
},
|
|
330
|
-
required: ['on'],
|
|
331
|
-
},
|
|
332
|
-
{
|
|
333
|
-
type: 'object',
|
|
334
|
-
additionalProperties: false,
|
|
335
|
-
properties: {
|
|
336
|
-
on: { const: 'messages' },
|
|
337
|
-
match: { $ref: '#/$defs/trigger_test' },
|
|
338
|
-
},
|
|
339
|
-
required: ['on'],
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
type: 'object',
|
|
343
|
-
additionalProperties: false,
|
|
344
|
-
properties: {
|
|
345
|
-
on: { const: 'clock' },
|
|
346
|
-
cron: { type: 'string' },
|
|
347
|
-
time_zone: { type: 'string' },
|
|
348
|
-
},
|
|
349
|
-
required: ['on', 'cron', 'time_zone'],
|
|
350
|
-
},
|
|
351
|
-
{
|
|
352
|
-
type: 'object',
|
|
353
|
-
additionalProperties: false,
|
|
354
|
-
properties: {
|
|
355
|
-
on: { const: 'clock' },
|
|
356
|
-
scope: {
|
|
357
|
-
type: 'object',
|
|
358
|
-
additionalProperties: false,
|
|
359
|
-
properties: { type: { type: 'string' } },
|
|
360
|
-
required: ['type'],
|
|
361
|
-
},
|
|
362
|
-
date: { type: 'string' },
|
|
363
|
-
days: { type: 'integer' },
|
|
364
|
-
at: { type: 'string' },
|
|
365
|
-
time_zone: { type: 'string' },
|
|
366
|
-
match: { $ref: '#/$defs/trigger_test' },
|
|
367
|
-
},
|
|
368
|
-
required: ['on', 'scope', 'date', 'days', 'at', 'time_zone'],
|
|
369
|
-
},
|
|
370
|
-
],
|
|
228
|
+
description: 'When it fires, as the Trigger reference page writes it, a document it names at its current path.',
|
|
229
|
+
type: 'object',
|
|
230
|
+
additionalProperties: true,
|
|
371
231
|
},
|
|
372
232
|
actions: {
|
|
373
233
|
type: 'array',
|
package/dist/model.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { RoomModels } from '@agentshouse/mdruntime';
|
|
2
2
|
import type { TrackedAuthority } from './discovery.js';
|
|
3
3
|
import { type HouseRoomHead, type HouseScope } from './read.js';
|
|
4
|
+
import { type SpaceSchemas } from './space-schema.js';
|
|
4
5
|
import type { HouseMode, HouseStreamEntry } from './transport.js';
|
|
5
6
|
export declare function partModels(scope: HouseScope, tracked: TrackedAuthority, seen: ReadonlySet<string>, final: boolean): Promise<RoomModels | undefined>;
|
|
6
|
-
export declare function manifestedModels(room: HouseRoomHead, tracked: TrackedAuthority): Promise<{
|
|
7
|
+
export declare function manifestedModels(room: HouseRoomHead, tracked: TrackedAuthority, spaces: SpaceSchemas): Promise<{
|
|
7
8
|
readonly models: RoomModels | undefined;
|
|
8
9
|
readonly seen: string[];
|
|
9
10
|
}>;
|
|
10
|
-
export declare function
|
|
11
|
+
export declare function keptSpaceSchemas(entries: readonly HouseStreamEntry[], spaces: SpaceSchemas): void;
|
|
12
|
+
export declare function streamedModels(schemas: ReadonlyMap<string, HouseStreamEntry>, tracked: TrackedAuthority, mode: HouseMode, spaces: SpaceSchemas, whole: boolean): Promise<RoomModels | undefined>;
|
|
11
13
|
//# sourceMappingURL=model.d.ts.map
|
package/dist/model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAIL,KAAK,aAAa,EAElB,KAAK,UAAU,EAChB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAIL,KAAK,aAAa,EAElB,KAAK,UAAU,EAChB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AA+BlE,wBAAgB,UAAU,CACxB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,EACzB,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAKjC;AAED,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC;IAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAS/E;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAKjG;AAQD,wBAAgB,cAAc,CAC5B,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAC9C,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAajC"}
|
package/dist/model.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { sha256Hex } from './digest.js';
|
|
2
2
|
import { modelScope, schemaOf, schemaPath, } from './read.js';
|
|
3
|
+
import { spaceIdentity } from './space-schema.js';
|
|
3
4
|
const MODEL_ABSENT = { kind: 'model-unavailable', reason: 'not-readable' };
|
|
4
5
|
const ABSENT_SCHEMA = { schema: null, version: null, revision: null };
|
|
5
6
|
async function heldModel(read, identity) {
|
|
@@ -8,7 +9,12 @@ async function heldModel(read, identity) {
|
|
|
8
9
|
const version = await sha256Hex(JSON.stringify(read.version));
|
|
9
10
|
return {
|
|
10
11
|
kind: 'model',
|
|
11
|
-
snapshot: {
|
|
12
|
+
snapshot: {
|
|
13
|
+
identity: read.space === undefined ? identity : spaceIdentity(read.space),
|
|
14
|
+
version,
|
|
15
|
+
schema: read.schema,
|
|
16
|
+
revision: read.revision,
|
|
17
|
+
},
|
|
12
18
|
};
|
|
13
19
|
}
|
|
14
20
|
async function modelsOf(tracked, read) {
|
|
@@ -24,25 +30,41 @@ export function partModels(scope, tracked, seen, final) {
|
|
|
24
30
|
return final && !seen.has(schema) ? ABSENT_SCHEMA : undefined;
|
|
25
31
|
});
|
|
26
32
|
}
|
|
27
|
-
export async function manifestedModels(room, tracked) {
|
|
33
|
+
export async function manifestedModels(room, tracked, spaces) {
|
|
28
34
|
const scope = modelScope(room);
|
|
35
|
+
const held = schemaOf(scope, tracked.schema);
|
|
36
|
+
if (held?.space !== undefined && held.schema !== null && held.revision !== null)
|
|
37
|
+
spaces.keep(held.space, held.revision, held.schema);
|
|
29
38
|
return {
|
|
30
39
|
models: await partModels(scope, tracked, new Set(), true),
|
|
31
40
|
seen: scope.files.some((file) => file.path === tracked.schema) ? [tracked.schema] : [],
|
|
32
41
|
};
|
|
33
42
|
}
|
|
34
|
-
export function
|
|
43
|
+
export function keptSpaceSchemas(entries, spaces) {
|
|
44
|
+
for (const entry of entries) {
|
|
45
|
+
if (entry.space !== undefined && entry.text !== undefined && entry.revision !== undefined)
|
|
46
|
+
spaces.keep(entry.space, entry.revision, entry.text);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function streamedText(entry, spaces) {
|
|
50
|
+
if (entry.text !== undefined || entry.space === undefined || entry.revision === undefined)
|
|
51
|
+
return entry.text;
|
|
52
|
+
return spaces.held(entry.space, entry.revision);
|
|
53
|
+
}
|
|
54
|
+
export function streamedModels(schemas, tracked, mode, spaces, whole) {
|
|
35
55
|
return modelsOf(tracked, (schema) => {
|
|
36
56
|
const entry = schemas.get(schema);
|
|
37
57
|
if (entry === undefined)
|
|
38
|
-
return undefined;
|
|
58
|
+
return whole ? ABSENT_SCHEMA : undefined;
|
|
59
|
+
const space = entry.space === undefined ? {} : { space: entry.space };
|
|
39
60
|
if (entry.kind === 'removed')
|
|
40
|
-
return ABSENT_SCHEMA;
|
|
41
|
-
|
|
61
|
+
return { ...ABSENT_SCHEMA, ...space };
|
|
62
|
+
const text = streamedText(entry, spaces);
|
|
63
|
+
if (text === undefined)
|
|
42
64
|
return null;
|
|
43
65
|
const version = mode === 'site' ? entry.sha256 : entry.revision;
|
|
44
66
|
return version === undefined
|
|
45
67
|
? null
|
|
46
|
-
: { schema:
|
|
68
|
+
: { schema: text, version, revision: mode === 'site' ? null : version, ...space };
|
|
47
69
|
});
|
|
48
70
|
}
|
package/dist/read.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { type BinaryFile, type BootstrapPage, type RoomModels, type TransportUncertainty } from '@agentshouse/mdruntime';
|
|
1
|
+
import { type BinaryFile, type BootstrapPage, type SavedFacts, type RoomModels, type TransportUncertainty } from '@agentshouse/mdruntime';
|
|
2
2
|
import type { HouseMode } from './transport.js';
|
|
3
3
|
import { type LogPosition } from './version.js';
|
|
4
4
|
export type HeadChange = BootstrapPage['changes'][string];
|
|
5
5
|
export type Answered = {
|
|
6
6
|
readonly documents: Map<string, string>;
|
|
7
|
+
readonly facts: Map<string, SavedFacts>;
|
|
7
8
|
readonly revisions: Map<string, string>;
|
|
8
9
|
readonly fileIds: Map<string, string>;
|
|
9
10
|
readonly changes: Map<string, HeadChange>;
|
|
@@ -18,6 +19,7 @@ export declare function forgotten(answer: Answered, path: string): void;
|
|
|
18
19
|
export declare function folded(answer: Answered, path: string, removed: boolean): void;
|
|
19
20
|
export declare function answered(answer: Answered): Generator<number, {
|
|
20
21
|
documents: Readonly<Record<string, string>>;
|
|
22
|
+
facts: Readonly<Record<string, SavedFacts>>;
|
|
21
23
|
revisions: Readonly<Record<string, string>>;
|
|
22
24
|
fileIds?: Readonly<Record<string, string>>;
|
|
23
25
|
changes: Readonly<Record<string, HeadChange>>;
|
|
@@ -33,6 +35,8 @@ export type HouseManifestFile = {
|
|
|
33
35
|
sha256?: string;
|
|
34
36
|
head?: HeadChange;
|
|
35
37
|
binary?: BinaryFile;
|
|
38
|
+
facts?: SavedFacts;
|
|
39
|
+
space?: string;
|
|
36
40
|
};
|
|
37
41
|
export type HouseContent = {
|
|
38
42
|
path: string;
|
|
@@ -71,6 +75,12 @@ export declare function headChange(held: {
|
|
|
71
75
|
readonly created_at?: unknown;
|
|
72
76
|
}): HeadChange | undefined | null;
|
|
73
77
|
export declare function binaryFileOf(held: Readonly<Record<string, unknown>>): BinaryFile | undefined | null;
|
|
78
|
+
export declare function carriedFacts(held: Readonly<Record<string, unknown>>): {
|
|
79
|
+
facts?: undefined;
|
|
80
|
+
} | {
|
|
81
|
+
facts: SavedFacts;
|
|
82
|
+
};
|
|
83
|
+
export declare function parseFile(value: unknown, mode: HouseMode): HouseManifestFile | null;
|
|
74
84
|
export declare function roomHead(payload: Uint8Array<ArrayBuffer>, mode: HouseMode): Promise<HouseRoomHead | null>;
|
|
75
85
|
export declare function manifested(room: HouseRoomHead, pageToken: string, models: RoomModels | undefined): BootstrapPage;
|
|
76
86
|
export declare function modelScope(room: HouseRoomHead): HouseScope;
|
|
@@ -84,6 +94,7 @@ export type HouseSchema = {
|
|
|
84
94
|
schema: string | null;
|
|
85
95
|
version: string | null;
|
|
86
96
|
revision: string | null;
|
|
97
|
+
space?: string;
|
|
87
98
|
};
|
|
88
99
|
export declare function schemaOf(scope: HouseScope, schema: string): HouseSchema | null;
|
|
89
100
|
//# sourceMappingURL=read.d.ts.map
|
package/dist/read.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../src/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,aAAa,EAElB,KAAK,UA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
9
|
return {
|
|
10
10
|
documents: new Map(),
|
|
11
|
+
facts: new Map(),
|
|
11
12
|
revisions: new Map(),
|
|
12
13
|
fileIds: new Map(),
|
|
13
14
|
changes: new Map(),
|
|
@@ -25,6 +26,7 @@ export function revised(answer, path, revision) {
|
|
|
25
26
|
}
|
|
26
27
|
export function forgotten(answer, path) {
|
|
27
28
|
answer.documents.delete(path);
|
|
29
|
+
answer.facts.delete(path);
|
|
28
30
|
answer.revisions.delete(path);
|
|
29
31
|
answer.fileIds.delete(path);
|
|
30
32
|
answer.changes.delete(path);
|
|
@@ -53,6 +55,7 @@ export function* answered(answer) {
|
|
|
53
55
|
const removals = yield* pathsOf(answer.removals);
|
|
54
56
|
return {
|
|
55
57
|
documents: yield* patching({}, answer.documents),
|
|
58
|
+
facts: yield* patching({}, answer.facts),
|
|
56
59
|
revisions: yield* patching({}, answer.revisions),
|
|
57
60
|
...(answer.fileIds.size === 0 ? {} : { fileIds: yield* patching({}, answer.fileIds) }),
|
|
58
61
|
changes: yield* patching({}, answer.changes),
|
|
@@ -138,7 +141,13 @@ export function binaryFileOf(held) {
|
|
|
138
141
|
function binaried(binary) {
|
|
139
142
|
return binary === undefined ? {} : { binary };
|
|
140
143
|
}
|
|
141
|
-
function
|
|
144
|
+
export function carriedFacts(held) {
|
|
145
|
+
return held.facts === undefined ? {} : { facts: held.facts };
|
|
146
|
+
}
|
|
147
|
+
function carriedSpace(held) {
|
|
148
|
+
return typeof held.space === 'string' ? { space: held.space } : {};
|
|
149
|
+
}
|
|
150
|
+
export function parseFile(value, mode) {
|
|
142
151
|
if (typeof value !== 'object' || value === null)
|
|
143
152
|
return null;
|
|
144
153
|
const file = value;
|
|
@@ -157,6 +166,7 @@ function parseFile(value, mode) {
|
|
|
157
166
|
version: file.sha256,
|
|
158
167
|
...headed(head),
|
|
159
168
|
...binaried(binary),
|
|
169
|
+
...carriedFacts(file),
|
|
160
170
|
};
|
|
161
171
|
}
|
|
162
172
|
if (typeof file.revision !== 'string')
|
|
@@ -168,6 +178,8 @@ function parseFile(value, mode) {
|
|
|
168
178
|
...(typeof file.sha256 === 'string' ? { sha256: file.sha256 } : {}),
|
|
169
179
|
...headed(head),
|
|
170
180
|
...binaried(binary),
|
|
181
|
+
...carriedFacts(file),
|
|
182
|
+
...carriedSpace(file),
|
|
171
183
|
};
|
|
172
184
|
}
|
|
173
185
|
function parseModels(value, mode) {
|
|
@@ -222,6 +234,7 @@ export function manifested(room, pageToken, models) {
|
|
|
222
234
|
kind: 'bootstrap',
|
|
223
235
|
roomVersion: roomVersion(room),
|
|
224
236
|
documents: {},
|
|
237
|
+
facts: {},
|
|
225
238
|
revisions: {},
|
|
226
239
|
changes: {},
|
|
227
240
|
binaryFiles: {},
|
|
@@ -320,6 +333,8 @@ export function* bootstrapping(scope) {
|
|
|
320
333
|
const answer = answering();
|
|
321
334
|
for (const file of scope.files) {
|
|
322
335
|
yield ROW_WEIGHT;
|
|
336
|
+
if (file.space !== undefined)
|
|
337
|
+
continue;
|
|
323
338
|
if (file.head !== undefined)
|
|
324
339
|
answer.changes.set(file.path, file.head);
|
|
325
340
|
const content = contents.get(file.path);
|
|
@@ -327,6 +342,8 @@ export function* bootstrapping(scope) {
|
|
|
327
342
|
answer.binaryFiles.set(file.path, file.binary);
|
|
328
343
|
else if (content !== undefined)
|
|
329
344
|
answer.documents.set(file.path, content);
|
|
345
|
+
if (file.binary === undefined && file.facts !== undefined)
|
|
346
|
+
answer.facts.set(file.path, file.facts);
|
|
330
347
|
if (file.revision !== undefined)
|
|
331
348
|
revised(answer, file.path, file.revision);
|
|
332
349
|
}
|
|
@@ -342,5 +359,10 @@ export function schemaOf(scope, schema) {
|
|
|
342
359
|
const content = scope.contents.find((entry) => entry.path === schema);
|
|
343
360
|
return content === undefined
|
|
344
361
|
? null
|
|
345
|
-
: {
|
|
362
|
+
: {
|
|
363
|
+
schema: content.content,
|
|
364
|
+
version: file.version,
|
|
365
|
+
revision: file.revision ?? null,
|
|
366
|
+
...(file.space === undefined ? {} : { space: file.space }),
|
|
367
|
+
};
|
|
346
368
|
}
|
package/dist/room-stream.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BootstrapResult, RoomModels } from '@agentshouse/mdruntime';
|
|
2
2
|
import type { TrackedAuthority } from './discovery.js';
|
|
3
3
|
import { type HouseScope } from './read.js';
|
|
4
|
+
import type { SpaceSchemas } from './space-schema.js';
|
|
4
5
|
import type { HouseMode } from './transport.js';
|
|
5
6
|
export type StreamedPart = {
|
|
6
7
|
readonly scope: HouseScope;
|
|
@@ -10,7 +11,7 @@ export type StreamedPart = {
|
|
|
10
11
|
readonly pageToken: string | undefined;
|
|
11
12
|
readonly bytes: number;
|
|
12
13
|
};
|
|
13
|
-
export declare function roomStreams(mode: HouseMode): {
|
|
14
|
+
export declare function roomStreams(mode: HouseMode, spaces: SpaceSchemas): {
|
|
14
15
|
head: (entry: TrackedAuthority, room: ReadableStream<Uint8Array>, arriving: ((bytes: number) => void) | undefined, signal: AbortSignal | undefined) => Promise<BootstrapResult>;
|
|
15
16
|
part: (entry: TrackedAuthority, token: string) => Promise<StreamedPart | Exclude<BootstrapResult, {
|
|
16
17
|
kind: 'bootstrap';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"room-stream.d.ts","sourceRoot":"","sources":["../src/room-stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,OAAO,EAAuD,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AACjG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAYhD,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,KAA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,OAAO,CAAC,eAAe,EAAE;QAAE,IAAI,EAAE,WAAW,CAAA;KAAE,CAAC,CAAC;EAkC3E"}
|
package/dist/room-stream.js
CHANGED
|
@@ -2,7 +2,7 @@ import { manifestedModels, partModels } from './model.js';
|
|
|
2
2
|
import { roomFrames } from './part.js';
|
|
3
3
|
import { housePart, manifested, roomHead } from './read.js';
|
|
4
4
|
const UNCERTAIN = { kind: 'transport-uncertainty' };
|
|
5
|
-
export function roomStreams(mode) {
|
|
5
|
+
export function roomStreams(mode, spaces) {
|
|
6
6
|
const open = new Map();
|
|
7
7
|
let opened = 0;
|
|
8
8
|
async function head(entry, room, arriving, signal) {
|
|
@@ -13,7 +13,7 @@ export function roomStreams(mode) {
|
|
|
13
13
|
const held = await roomHead(first.payload, mode);
|
|
14
14
|
if (held === null || held.anchor !== entry.authority)
|
|
15
15
|
return UNCERTAIN;
|
|
16
|
-
const { models, seen } = await manifestedModels(held, entry);
|
|
16
|
+
const { models, seen } = await manifestedModels(held, entry, spaces);
|
|
17
17
|
opened += 1;
|
|
18
18
|
const id = String(opened);
|
|
19
19
|
open.set(id, { entry, head: held, frames, next: 1, seen });
|
package/dist/room-types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"room-types.d.ts","sourceRoot":"","sources":["../src/room-types.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB,YAC9B,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,WAAW,EACX,OAAO,EACP,QAAQ,CACA,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,eAAO,MAAM,SAAS,SAAS,CAAC;AAEhC,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,eAAO,MAAM,yBAAyB,UAAiC,CAAC;AAyBxE,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"room-types.d.ts","sourceRoot":"","sources":["../src/room-types.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB,YAC9B,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,WAAW,EACX,OAAO,EACP,QAAQ,CACA,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,eAAO,MAAM,SAAS,SAAS,CAAC;AAEhC,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,eAAO,MAAM,yBAAyB,UAAiC,CAAC;AAyBxE,eAAO,MAAM,gBAAgB,QA2FjB,CAAC"}
|
package/dist/room-types.js
CHANGED
|
@@ -58,8 +58,6 @@ export const HOUSE_ROOM_TYPES = [
|
|
|
58
58
|
` username: ${IDENTITY}`,
|
|
59
59
|
' sent_at: { type: string, format: date-time }',
|
|
60
60
|
` channel_message: ${IDENTITY}`,
|
|
61
|
-
' state: { enum: [sending, sent, failed] }',
|
|
62
|
-
' reason: { type: string }',
|
|
63
61
|
' labelled: { const: true }',
|
|
64
62
|
' reactions:',
|
|
65
63
|
' type: array',
|
package/dist/site.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAQR,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAQR,MAAM,wBAAwB,CAAC;AAiBhC,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAuBxB,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,EAAE,QAAQ,UAAQ,GAAG,OAAO,CAqK1F"}
|
package/dist/site.js
CHANGED
|
@@ -3,12 +3,13 @@ import { actionOutcome } from './actions.js';
|
|
|
3
3
|
import { mapDiscovery, parseSiteDiscovery, siteCapabilities, siteTracked, } from './discovery.js';
|
|
4
4
|
import { bootstrapping } from './read.js';
|
|
5
5
|
import { roomStreams } from './room-stream.js';
|
|
6
|
+
import { spaceSchemas } from './space-schema.js';
|
|
6
7
|
import { classifyDoor, discoveryFailure } from './refusal.js';
|
|
7
8
|
import { HOUSE_TYPED_PATHS } from './house-model.js';
|
|
8
9
|
import { HOUSE_NAMEABLE_ROOM_TYPES, HOUSE_ROOM_TYPES } from './room-types.js';
|
|
9
10
|
import { houseNotifications } from './stream.js';
|
|
10
11
|
import { houseSiteRoute, SITE_DOOR_SUBMIT, SITE_FILES, SITE_SUBMISSION, } from './transport.js';
|
|
11
|
-
import { followsVersion, logPosition,
|
|
12
|
+
import { followsVersion, logPosition, reachedVersion, roomVersion } from './version.js';
|
|
12
13
|
const UNCERTAIN = { kind: 'transport-uncertainty' };
|
|
13
14
|
function unfound() {
|
|
14
15
|
return { kind: 'rejected', code: 'file_not_found', fields: {}, retryable: false };
|
|
@@ -19,22 +20,23 @@ function siteRoom(tracked) {
|
|
|
19
20
|
locator: tracked.locator,
|
|
20
21
|
handle: tracked.handle,
|
|
21
22
|
roomVersion: roomVersion(tracked),
|
|
22
|
-
operations: { write: [],
|
|
23
|
+
operations: { write: [], erase: [] },
|
|
23
24
|
replica: { selection: tracked.locator, admission: 'admitted', offline: 'open' },
|
|
24
25
|
providerOwnedPaths: [],
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
28
|
export function createSiteAdapter(transport, snapshot = false) {
|
|
29
|
+
const spaces = spaceSchemas();
|
|
28
30
|
const notifications = houseNotifications(transport, 'site', {
|
|
29
31
|
opened: async () => {
|
|
30
32
|
const found = await discovered();
|
|
31
33
|
return found.kind === 'discovery' ? found : null;
|
|
32
34
|
},
|
|
33
35
|
changed: () => null,
|
|
34
|
-
});
|
|
36
|
+
}, spaces);
|
|
35
37
|
const tracked = new Map();
|
|
36
38
|
const read = new Map();
|
|
37
|
-
const rooms = roomStreams('site');
|
|
39
|
+
const rooms = roomStreams('site', spaces);
|
|
38
40
|
function fileRoute(request) {
|
|
39
41
|
const entry = tracked.get(request.locator);
|
|
40
42
|
if (entry === undefined)
|
|
@@ -162,13 +164,7 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
162
164
|
roomStream: snapshot
|
|
163
165
|
? undefined
|
|
164
166
|
: {
|
|
165
|
-
hold
|
|
166
|
-
notifications.send(rooms.flatMap((room) => {
|
|
167
|
-
const entry = tracked.get(room.locator);
|
|
168
|
-
const at = logPosition(room.roomVersion);
|
|
169
|
-
return entry === undefined || at === null ? [] : [presented(entry.authority, at)];
|
|
170
|
-
}));
|
|
171
|
-
},
|
|
167
|
+
hold: notifications.send,
|
|
172
168
|
observe: notifications.observe,
|
|
173
169
|
},
|
|
174
170
|
serviceMode: notifications.serviceMode,
|