@agentshouse/mdruntime-adapter 0.1.0-ca5b2f7fcb9d1 → 0.1.0-ca764edcceec6
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/AGENTS.md +238 -235
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +2 -0
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +32 -13
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/read.d.ts +3 -0
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +10 -0
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +32 -15
- package/dist/stream.d.ts +2 -2
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +10 -5
- package/dist/transport.d.ts +12 -2
- package/dist/transport.d.ts.map +1 -1
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +3 -2
- package/package.json +2 -2
package/AGENTS.md
CHANGED
|
@@ -1,296 +1,299 @@
|
|
|
1
1
|
# Instructions for the App Creator's agent
|
|
2
2
|
|
|
3
|
-
These instructions address an agent in an environment with Git
|
|
4
|
-
|
|
3
|
+
These instructions address an agent in an environment with Git: obtain the App Repository,
|
|
4
|
+
change it, build, and push. They are documentation, not enforcement.
|
|
5
5
|
|
|
6
6
|
## The MD Runtime API
|
|
7
7
|
|
|
8
8
|
App code reaches the MD Runtime through the remote client. The surfaces are Rooms,
|
|
9
9
|
Query, Search, Observe, Types, Room Draft, Save, History, the binary file reads, Call,
|
|
10
10
|
Reached, Log, the reported persistence answer, reauthorization, conversation, the chat
|
|
11
|
-
draft, and Presentation State. Sync Status, the Service Mode, the storage-loss
|
|
11
|
+
draft, and Presentation State. Sync Status, readiness, the Service Mode, the storage-loss
|
|
12
12
|
statement, the deployment facts and the signed-in member are observations only.
|
|
13
13
|
|
|
14
14
|
The host attaches each port with its reach, and every member and observation answers
|
|
15
15
|
within it: a Room outside it answers as one the replica does not hold, Rooms lists only
|
|
16
|
-
the Rooms reached whole, a Room reached for single Documents shows only
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
returns its unsubscribe, and `close()` ends the observation. Closing the port ends every
|
|
25
|
-
handle and rejects every pending call and observation; a client that reconnects observes
|
|
26
|
-
again.
|
|
16
|
+
the Rooms reached whole, a Room reached for single Documents shows only them and their
|
|
17
|
+
models' Types, and without conversations the conversation members, chat draft and
|
|
18
|
+
observation hold none. A changed reach reaches every open observation as its new value.
|
|
19
|
+
|
|
20
|
+
Every `observe` resolves, once its first value arrived, to a handle: `current()` is the
|
|
21
|
+
latest complete value, `subscribe(listener)` hears each later value whole and returns its
|
|
22
|
+
unsubscribe, and `close()` ends it. Closing the port ends every handle and rejects every
|
|
23
|
+
pending call and observation; a reconnected client observes again.
|
|
27
24
|
|
|
28
25
|
`observe('agents')` answers every Agent a new conversation can go to, each `{ identity,
|
|
29
|
-
name }`,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
App Creator composes; sending it is a Provider Action that needs the Provider
|
|
42
|
-
and is never queued.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
Provider
|
|
59
|
-
|
|
26
|
+
name }`, with a conversation yet or not. Each conversation the Provider lists is held
|
|
27
|
+
complete in the browser. `conversation.list()` and `observe('conversations')` answer each
|
|
28
|
+
with its Agent's identity and name, its name, created and finished times, last outcome,
|
|
29
|
+
live `state` (`asking` while a question waits, `working` while a turn runs, else `idle`)
|
|
30
|
+
and `started`, when the running turn began, or `null`. `observe('conversation', id, {
|
|
31
|
+
limit, total: true })` holds its latest `limit` messages, at most 1,000, oldest first,
|
|
32
|
+
`total` their count, and `next` while older ones exist, which `after` takes, there or in
|
|
33
|
+
`conversation.read(id, { limit, after })`, for the window before; its chat draft; and,
|
|
34
|
+
only in memory, what the Provider streams whether or not anything views it: the running
|
|
35
|
+
`turn` with its parts and its context in use and window, which the message accepted under
|
|
36
|
+
the turn's id replaces, the open questions, the process state, and the CLI's commands and
|
|
37
|
+
options, none stored or searchable. `chatDraft.write` and `chatDraft.discard` keep what
|
|
38
|
+
the App Creator composes; sending it is a Provider Action that needs the Provider
|
|
39
|
+
reachable and is never queued. A new conversation's chat draft is keyed `new:<Agent
|
|
40
|
+
identity>`: no conversation list removes it, a retired Agent's goes, and the first answer
|
|
41
|
+
to `conversation.create({ agent_id, operation_id })` moves it to the created conversation,
|
|
42
|
+
where `conversation.send(conversation)` sends it; a replay of that create moves nothing.
|
|
43
|
+
|
|
44
|
+
Presentation State is one value per App, kept in the browser and shared by its tabs:
|
|
45
|
+
`presentation.read()` answers it, `null` before anything is kept,
|
|
46
|
+
`observe('presentation')` hears it whole, `presentation.write(value)` replaces it whole,
|
|
47
|
+
and `presentation.edit(members)` sets each member named, or removes one named `null`, in
|
|
48
|
+
the state as it stands, so tabs changing different members never lose each other's change:
|
|
49
|
+
never write back a value read before. Each rejects when the browser does not keep the
|
|
50
|
+
change, and no tab sees it then.
|
|
51
|
+
|
|
52
|
+
A binary file at a Path is a binary Path entry. Query lists it by `path`, and History each
|
|
53
|
+
of its revisions, with its `binaryFile` record and never its bytes: `{ state: 'accepted',
|
|
54
|
+
revision, path, fileRef, byteLength, mediaType, sha256 }`, or, from a Save until the
|
|
55
|
+
Provider accepts it, `{ state: 'pending', localId, path, byteLength, mediaType, sha256 }`.
|
|
56
|
+
Write one with a Room Draft whose only part is `file: { blob }`, the `Blob`'s `type` its
|
|
57
|
+
media type: Save keeps the bytes in its Pending Change, offline too, and acceptance gives
|
|
58
|
+
the record the Provider's revision. Move or remove one as a Document, a pending one too,
|
|
59
|
+
its bytes following; once its Pending Change has gone to the Provider, Save refuses that
|
|
60
|
+
as `unknown-revision` until it is accepted. `binaryFile.read(room, path, revision?)`
|
|
61
|
+
answers a pending record's saved bytes, or asks the Provider on every read of an accepted
|
|
62
|
+
one or a History revision, a removed file's last included, keeping nothing. Text, a Record
|
|
63
|
+
attachment or a conversation message may name a file by its `fileRef`; read it with
|
|
64
|
+
`binaryFile.readReference({ fileRef, referrer })`, the `referrer` the Provider gave beside
|
|
65
|
+
it, or `{ room, path }` of the document whose text names it. Both answer
|
|
66
|
+
`{ kind: 'binary', blob }` or a refusal or failure.
|
|
60
67
|
|
|
61
68
|
Rooms, Query, Search, Observe, Types, Room Draft, Save, and Reached never touch the
|
|
62
|
-
network
|
|
63
|
-
Call takes the Action names the Adapter declares
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
the Room
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
authorization, performs a request the App's code composes, or exposes the browser store.
|
|
69
|
+
network; History, the binary file reads and Call go to the Provider through the Adapter.
|
|
70
|
+
Call takes the Action names the Adapter declares, any other answering `undeclared`. A Call
|
|
71
|
+
result whose effect the Provider places in a Room carries `at`, that Room and Room
|
|
72
|
+
Version: `reached(room, roomVersion)` answers whether the Room's confirmed state has
|
|
73
|
+
reached it, refreshing the Room until it has, and `reached(room, roomVersion, path)`
|
|
74
|
+
whether the held copy of that document was written later. A History revision names its
|
|
75
|
+
author, `{ kind: 'user', id }` or `{ kind: 'site', id, name }`; History of a Path no
|
|
76
|
+
document holds answers the removed document's revisions, newest first, with `deleted:
|
|
77
|
+
true`, which a link to the Path opens. Every member is asynchronous and every result a
|
|
78
|
+
detached snapshot; nothing returns the authorization, performs a request the App's code
|
|
79
|
+
composes, or exposes the browser store.
|
|
74
80
|
|
|
75
81
|
Every refusal and failure carries `code` and `retryable`: each Call and History answer
|
|
76
|
-
other than its result, a refused Save or Room Draft write, a returned Room Draft's
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
`
|
|
82
|
+
other than its result, a refused Save or Room Draft write, a returned Room Draft's reason,
|
|
83
|
+
a Room's refusal, the Connection Refusal and every error a member rejects with, beside its
|
|
84
|
+
message, a Provider refusal with the Provider's own `retryable`. Every code and value is
|
|
85
|
+
open: handle one you do not know by its `code` and `retryable`. Only a tag telling which
|
|
86
|
+
fields a value carries, such as `kind`, is closed: keep a branch for one you do not know.
|
|
87
|
+
A model with no usable types answers `types: null`.
|
|
81
88
|
|
|
82
89
|
Read the deployment facts with `observe('deployment-facts')`, an opaque value the host's
|
|
83
|
-
contract interprets. `observe('member')` answers who uses the App
|
|
84
|
-
signed in, `{ kind: 'user', id, name }`
|
|
85
|
-
Document whose `change.author.id`
|
|
86
|
-
the Provider first names one, and where it names none, such as a Site.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
observation with the authorization. It is the only way App code learns who uses it.
|
|
90
|
+
contract interprets. `observe('member')` answers who uses the App, the only way App code
|
|
91
|
+
learns it: the User the Provider signed in, `{ kind: 'user', id, name }` like a change's
|
|
92
|
+
`author`, so a Document whose `change.author.id` is its `id` is that User's own; `null`
|
|
93
|
+
until the Provider first names one, and where it names none, such as a Site. It is kept
|
|
94
|
+
with the Local Replicas, answers offline once known, and every port hears the next member
|
|
95
|
+
named; signing out answers `null`, then ends the observation with the authorization.
|
|
90
96
|
|
|
91
97
|
## Local Query rules
|
|
92
98
|
|
|
93
|
-
`query(q)` answers once from local state; `observe('query', q)` holds the whole result
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
observe the query to hear the complete one. A query is data:
|
|
99
|
+
`query(q)` answers once from local state; `observe('query', q)` holds the whole result and
|
|
100
|
+
hears it again only when it changes, keeping every unchanged Document the same object, so
|
|
101
|
+
a component can tell what changed by identity. `{ documents, coverage }` or `{ groups,
|
|
102
|
+
coverage }` is complete for the Rooms its `coverage` names, and `{ pending }` names each
|
|
103
|
+
Room not yet acquired or prepared, `[{ room, awaits }]`: never read it as empty, draw it
|
|
104
|
+
as loading and observe the query to hear the complete answer. A query is data:
|
|
100
105
|
|
|
101
106
|
- **Filter.** `rooms` names Room locators and defaults to every Room. `types` names MD
|
|
102
|
-
Types, and `any` names untyped Markdown Documents. `pathPrefix` is a directory:
|
|
103
|
-
|
|
107
|
+
Types, and `any` names untyped Markdown Documents. `pathPrefix` is a directory: `notes`
|
|
108
|
+
keeps `notes/a.md` and not `notes2/a.md`; `folder` keeps only what lies directly in it.
|
|
109
|
+
`paths` keeps only the Paths it names: read named Documents so, never from a list.
|
|
104
110
|
- **Fields.** Every frontmatter value is named by JSON Pointer: `/status`,
|
|
105
111
|
`/shipping/city`, `~1` for a `/` and `~0` for a `~` in a key. A segment that meets a
|
|
106
112
|
list applies to every item and a number names one item. `where` names pointers, ANDs
|
|
107
|
-
them, and nests `$and` and `$or`; a pointer through a list holds
|
|
108
|
-
|
|
109
|
-
`$
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
expression.
|
|
113
|
+
them, and nests `$and` and `$or`; a pointer through a list holds if any item satisfies
|
|
114
|
+
it. A bare value is equality; the operators are `$eq`, `$ne`, `$in`, `$nin`, `$gt`,
|
|
115
|
+
`$gte`, `$lt`, `$lte`, `$all`, `$size` and `$exists`. Equality on a list asks if it
|
|
116
|
+
contains the value. Missing, null and empty differ: `$exists: false` keeps a missing
|
|
117
|
+
field, `null` an explicit null, `''` empty text and `$size: 0` an empty list. A date
|
|
118
|
+
compares in calendar order and never with a date-time. A reference compares by the
|
|
119
|
+
Room Path it resolves to. Untyped frontmatter, and a value under `oneOf` or a
|
|
120
|
+
conditional, is plain values. There is no text containment or regular expression.
|
|
116
121
|
- **Relations.** `hop: { field, types, where, pathPrefix }` keeps Documents whose
|
|
117
122
|
reference at pointer `field`, at any depth, points to a matching Document of the same
|
|
118
123
|
Room. `backlinks: { field, types, where, pathPrefix }` keeps Documents that a matching
|
|
119
124
|
Document of the same Room references. Each keeps a Document once.
|
|
120
125
|
- **Parts.** A Document query must `select`: `'all'`, or `fields`, `sections`,
|
|
121
|
-
`preamble`, `markdown`, `backlinks` and `
|
|
122
|
-
of pointers and `sections` `'all'` or a list of names. Selected pointers
|
|
123
|
-
frontmatter holding only them, nested as written. A backlink names the
|
|
124
|
-
MD Type and the pointer it came from as `field`. Room and Path always
|
|
125
|
-
Markdown Document also returns its MD Type
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
126
|
+
`preamble`, `markdown`, `backlinks`, `change` and `fileId`, where `fields` is `'all'`
|
|
127
|
+
or a list of pointers and `sections` `'all'` or a list of names. Selected pointers
|
|
128
|
+
return the frontmatter holding only them, nested as written. A backlink names the
|
|
129
|
+
referring Path, MD Type and the pointer it came from as `field`. Room and Path always
|
|
130
|
+
return; a Markdown Document also returns its MD Type, and at most its first 1,000
|
|
131
|
+
backlinks: a query on the referring field reads the rest. A non-Markdown Document
|
|
132
|
+
returns only Room, Path and a selected `fileId`, and a binary Path entry its
|
|
133
|
+
`binaryFile` record too. An unselected part is absent. Select only what a screen shows:
|
|
134
|
+
a list that selects the Markdown hears every edit of it.
|
|
135
|
+
- **Change and file ID.** `change` is `{ author, time }` of the Document's head revision
|
|
136
|
+
as the Provider last delivered it: `author` is `{ kind: 'user' | 'site', id, name }`, or
|
|
137
|
+
`null` for a write the Provider made itself, and `time` its ISO 8601 change time, or the
|
|
138
|
+
whole change `null` where it delivered no time, as at a Site. `fileId` is the Provider's
|
|
139
|
+
Stable File ID of the file at the Path, or `null`. An unsent edit keeps both, an unsent
|
|
140
|
+
move keeps the change and carries the file ID to the new Path, so a file ID that leaves
|
|
141
|
+
one Path for another is the same file moved, and an unsent creation has neither until it
|
|
142
|
+
is Accepted. A Room's last change is its Document with the latest `time`.
|
|
143
|
+
- **Order and groups.** `orderBy` sorts by `room`, `path`, `type`, `folder` or `{ field }`
|
|
144
|
+
with TanStack DB's own options; ties end with Room, then Path. `groupBy` by `room`,
|
|
145
|
+
`type`, `folder` or `{ field }` answers `{ groups: [{ key, count }] }`, counted over every
|
|
146
|
+
match and ordered by `count` or a key. A sort or group takes only a single-value pointer.
|
|
147
|
+
`limit`, at most 1,000 whatever a query names, bounds the Documents or the groups, and a
|
|
148
|
+
result it cuts short names `next`: the same query with it as `after` reads the next
|
|
149
|
+
window, in the same order, ties included. `total: true` adds `total`, every match's
|
|
150
|
+
count. An observed window hears rows entering, leaving or changing, and `next`, `total`.
|
|
151
|
+
- **Results and errors.** A result carries no Room Version: read freshness from Rooms and
|
|
152
|
+
Sync Status. `coverage` names each Room read as `{ room, generation, current }`,
|
|
153
|
+
`current` false while a newer copy of that Room is being fetched, and the queued changes
|
|
154
|
+
it includes as `overlay`, which a Save in the Room changes. An invalid query fails with
|
|
155
|
+
`invalid-query`, `unknown-type`, `unknown-field` or `wrong-kind`, never an empty answer.
|
|
148
156
|
|
|
149
157
|
## Local Search rules
|
|
150
158
|
|
|
151
|
-
`search({ text, documents, conversations, limit })` answers
|
|
152
|
-
state, with MiniSearch's defaults. There is no observed search.
|
|
153
|
-
|
|
154
|
-
- **
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
- **
|
|
162
|
-
|
|
159
|
+
`search({ text, documents, collection, conversations, limit, after, total })` answers
|
|
160
|
+
once, by words, from local state, with MiniSearch's defaults. There is no observed search.
|
|
161
|
+
|
|
162
|
+
- **Declaration.** Only an App whose release declares Local Search searches, its first
|
|
163
|
+
readiness waiting for its index; any other App's `search` answers the never retryable
|
|
164
|
+
`undeclared` refusal `search-undeclared`, its `fields` naming `local_search`.
|
|
165
|
+
- **What is found.** A Document by its field values, its sections' headings and text, its
|
|
166
|
+
preamble and its Path, and a message by its text, never a frontmatter key, a Room Draft,
|
|
167
|
+
a chat draft or a running turn's parts, with no phrases, word forms, typo tolerance or
|
|
168
|
+
prefix matching.
|
|
169
|
+
- **Narrowing.** `documents` is a Local Query filter, and `collection: true` leaves out
|
|
170
|
+
what each Room's `typedSelection` roots hold; `conversations` names conversations. All
|
|
171
|
+
apply before `limit`, which bounds each list, at most 1,000 whatever a search names. A
|
|
172
|
+
complete answer it cuts short names `next`, which `after` takes for the next window of
|
|
173
|
+
both lists. `total: true` adds `total`, each list's count.
|
|
174
|
+
- **Results.** `{ documents, messages, coverage }`, or the same with `pending` naming each
|
|
175
|
+
Room or conversation the search still waits for: show its hits, ask again, and never
|
|
163
176
|
read pending as no hits. `coverage` names the Rooms and conversations searched. Each
|
|
164
|
-
list is ranked by `score`,
|
|
165
|
-
|
|
166
|
-
`
|
|
167
|
-
`sections`, `preamble
|
|
168
|
-
|
|
177
|
+
list is ranked by `score`, comparable only within it; ties come by `room`, then `path`,
|
|
178
|
+
or by `conversation`, then `identity`. A Document hit names its `room`, `path` and
|
|
179
|
+
`type`, a message hit its `conversation` and `identity`; `matches` maps each matched
|
|
180
|
+
word to the parts it matched in: `fields`, `sections`, `preamble`, `path` or `text`. A
|
|
181
|
+
hit carries no position: mark the words you show. A bad filter fails as a query does.
|
|
169
182
|
|
|
170
183
|
## Room Draft, Save, and outcome rules
|
|
171
184
|
|
|
172
|
-
The MD Runtime owns one Room Draft per Room and Path, shared by every App and tab
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
an older revision is refused as `stale` with the current Room Draft; read it and write
|
|
181
|
-
again.
|
|
185
|
+
The MD Runtime owns one durable Room Draft per Room and Path, shared by every App and tab
|
|
186
|
+
across reloads; a Room the Provider reports lost takes its Room Drafts and queue with it.
|
|
187
|
+
Write one with `roomDraft.write(room, path, revision, parts)`, naming the revision you
|
|
188
|
+
read or `null`, and every part it now changes: fields, sections and the preamble, or the
|
|
189
|
+
whole Markdown, a creation, a move or a removal. A new part names its base, the value you
|
|
190
|
+
showed when it was opened, a field's as `{ value }` or `null` for no such field, and keeps
|
|
191
|
+
its first base; a binary Path entry's move or removal takes `null`. A write or discard
|
|
192
|
+
from an older revision is refused as `stale` with the current Room Draft.
|
|
182
193
|
|
|
183
194
|
Save takes one Room and the Room Drafts of it to save, each with its revision, validates
|
|
184
195
|
locally, and on success appends one Change Batch to that Room's queue and removes those
|
|
185
|
-
Room Drafts.
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
and do not infer a rejection. A refusal the Provider marks retryable stays Pending until
|
|
202
|
-
the reset it names; the MD Runtime retries the same Change Batch identity and payload
|
|
203
|
-
and never infers an outcome from transport uncertainty. The MD Runtime never combines,
|
|
196
|
+
Room Drafts. Refused as `stale`, `changed-underneath` naming each part whose base no
|
|
197
|
+
longer matches the visible state, or a local validation rule, it creates nothing and
|
|
198
|
+
leaves every Room Draft. A directory move or removal is that part on each Document and
|
|
199
|
+
binary Path entry beneath it, saved together.
|
|
200
|
+
|
|
201
|
+
Outcomes follow the Provider's answer. An Accepted Change Batch stays in the queue, drawn
|
|
202
|
+
over the confirmed layer, until that layer reaches the Room Version it was accepted at.
|
|
203
|
+
Conflicted and Rejected, an expired operation, and a change that no longer applies each
|
|
204
|
+
leave the queue and return as Room Drafts on their Documents, marked with why: the
|
|
205
|
+
Provider's structured refusal code and fields as returned, not known to have applied, or
|
|
206
|
+
withdrawn locally. The rest of the queue keeps synchronizing, and Sync Status requires
|
|
207
|
+
attention until each returned Room Draft is saved or discarded. `observe('queue', room)`
|
|
208
|
+
shows each Pending Change Batch, which keeps no outcome once it leaves. Transport failure,
|
|
209
|
+
Provider unavailability and a refusal the Provider marks retryable, until the reset it
|
|
210
|
+
names, keep work Pending; the MD Runtime retries the same Change Batch identity and
|
|
211
|
+
payload, never infers an outcome from transport uncertainty, and never combines,
|
|
204
212
|
reorders, or rebases.
|
|
205
213
|
|
|
206
|
-
On a Site, every Save stays in the visitor's browser
|
|
214
|
+
On a Site, every Save stays in the visitor's browser: write grants and revisions do not
|
|
207
215
|
refuse it, and its Pending Change shows in every query and across reloads until the
|
|
208
|
-
browser's storage is cleared. It is never sent: `observe('queue', room)` shows it
|
|
209
|
-
|
|
210
|
-
|
|
216
|
+
browser's storage is cleared. It is never sent: `observe('queue', room)` shows it `local`,
|
|
217
|
+
Sync Status never waits on it, and once the Room no longer lets it apply it leaves the
|
|
218
|
+
queue and returns no Room Draft.
|
|
211
219
|
|
|
212
220
|
`observe('service-mode')` answers the Provider's Service Mode, `open` or `write-halted`.
|
|
213
|
-
While writes are halted, Save
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
renders raw HTML only for the details and summary elements, and loads images and other
|
|
230
|
-
resources only from origins the Provider's policy allows.
|
|
231
|
-
|
|
232
|
-
## Launch promises MD UI keeps
|
|
221
|
+
While writes are halted, Save succeeds, its Change Batch waits unsent and the queue is
|
|
222
|
+
submitted in order once writes reopen; an Action is never held, and one the halt refuses
|
|
223
|
+
returns that refusal: show the Provider as read-only instead of retrying.
|
|
224
|
+
`observe('readiness')` tells whether the App's code and bound Rooms are held locally
|
|
225
|
+
(`ready`), each Room's state, each refused Room's file and rule, the persistence answer
|
|
226
|
+
and a paused preparation's `capacity` cause; `retry()` resumes a paused preparation.
|
|
227
|
+
|
|
228
|
+
## Content safety and launch promises
|
|
229
|
+
|
|
230
|
+
The Provider authorization belongs to the Runtime host and is never readable by the App's
|
|
231
|
+
code. The App's code reaches the network only at the external origins its manifest
|
|
232
|
+
declares, empty by default, and the Provider enforces that set. Rendered Markdown never
|
|
233
|
+
executes scripts, renders raw HTML only for the details and summary elements, and loads
|
|
234
|
+
images and other resources only from origins the Provider's policy allows. An agent must
|
|
235
|
+
never read the authorization, load code from a Room, call the Provider directly, or rebase
|
|
236
|
+
a refused Change Batch.
|
|
233
237
|
|
|
234
238
|
MD UI uses semantic HTML, is fully operable from a keyboard with visible focus and
|
|
235
239
|
labelled controls, and lays out from a 360 pixel wide viewport to a desktop. Its strings
|
|
236
240
|
are English only, dates and numbers follow the browser locale, and content is never
|
|
237
|
-
translated. Light and dark themes come from CSS custom properties
|
|
238
|
-
preference
|
|
239
|
-
|
|
240
|
-
wait for the network. Data lives only in the App Creator's browser and with the
|
|
241
|
-
Provider.
|
|
241
|
+
translated. Light and dark themes come from CSS custom properties, defaulting to the
|
|
242
|
+
browser's preference and respecting an App's override. What an agent adds carries none of
|
|
243
|
+
these promises by itself. Data lives only in the App Creator's browser and the Provider.
|
|
242
244
|
|
|
243
245
|
## App code takes the client its host hands it and never constructs a Runtime
|
|
244
246
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
`@agentshouse/mdruntime/entry`, as
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
247
|
+
No module outside an Adapter package imports, names, or special-cases a Provider, and
|
|
248
|
+
every App and MD UI reach data only through the client entry. In House,
|
|
249
|
+
`houseBridge().runtime` from `@agentshouse/app-bridge` resolves to the client House built
|
|
250
|
+
into the page. App code imports only types from `@agentshouse/mdruntime/client`, never
|
|
251
|
+
calls `connectMdRuntime` or `serveMdRuntime`, and never imports the package main, the host
|
|
252
|
+
entry or the Adapter package; the in-memory Adapter at `@agentshouse/mdruntime/memory` is
|
|
253
|
+
for tests and ships in no bundle. A Site's page fills its Entry Data Contract's
|
|
254
|
+
`{"$param": name}` arguments with `boundQuery` from `@agentshouse/mdruntime/entry`, as
|
|
255
|
+
House did for its HTML. While the Site prepares, a query a route's `interaction` names
|
|
256
|
+
answers from the entry's result when the page observes that descriptor, and every other
|
|
257
|
+
stays pending. House replaces its HTML with the page once its document changed after those
|
|
258
|
+
answers, or readiness is `ready`, and then held still for two animation frames, unless the
|
|
259
|
+
visitor uses the HTML: draw the route at once, never behind a placeholder. Before
|
|
260
|
+
readiness is `ready`, `push` loads a new page.
|
|
261
|
+
|
|
262
|
+
A React App may observe and save through `@agentshouse/mdruntime/react`, with React as a
|
|
263
|
+
peer dependency. `useObserve(client, topic, ...input)` takes the arguments of `observe`
|
|
264
|
+
and returns `{ state: 'loading' }` until the topic's first value arrives, then `{ state:
|
|
265
|
+
'ready', value }`, re-rendering on each change; a `null` client stays loading.
|
|
266
|
+
`useSave(client)` returns `busy`, the last `outcome` or `failure`, and `save(room,
|
|
267
|
+
roomDrafts)`, which writes each Path's parts onto its Room Draft, keeping their bases, and
|
|
268
|
+
saves them together: a refused Save leaves the Room Drafts to save again or discard, and a
|
|
269
|
+
failure is recorded and rejects; `saveRoomDrafts(client, room, roomDrafts)` is that save
|
|
270
|
+
outside a component. `saveWritten(room, roomDrafts)` saves Room Drafts the App wrote
|
|
271
|
+
itself, each named with the revision its last write returned: one another tab wrote since
|
|
272
|
+
is refused as `stale`, and nothing is saved. A react-admin or Refine App uses the data
|
|
273
|
+
providers of `@agentshouse/mdruntime-families`.
|
|
265
274
|
|
|
266
275
|
## The Chat
|
|
267
276
|
|
|
268
|
-
`@agentshouse/mdruntime/chat` holds the Chat, one data layer for every App; add React as
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
`--chat-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
unset one keeps House's light or dark look. `mountChat(element, { client })` places it
|
|
282
|
-
outside React and returns `update(props)` and `unmount()`.
|
|
277
|
+
`@agentshouse/mdruntime/chat` holds the Chat, one data layer for every App; add React as a
|
|
278
|
+
dependency in any App, with React DOM and `@assistant-ui/react`. Place the ready chat with
|
|
279
|
+
`<Chat client={runtime} conversation={id} agent={agent} width="1/3" showChats />`:
|
|
280
|
+
`conversation` opens one, `null` for a new chat, `agent` is the Agent a new chat goes to,
|
|
281
|
+
`onOpen` hears each one it opens, and `width` is `full` (the place you give it), or `3/4`,
|
|
282
|
+
`1/2` or `1/3` of the window docked at its right edge, whole on a narrow window.
|
|
283
|
+
`showChats` adds its conversation list; or draw your own inside a `ChatProvider` around a
|
|
284
|
+
`<Chat />` with no `client`. Theme its own styles with CSS custom properties on it or an
|
|
285
|
+
ancestor: `--chat-background`, `--chat-surface`, `--chat-text`, `--chat-text-muted`,
|
|
286
|
+
`--chat-accent`, `--chat-line`, `--chat-attention`, `--chat-danger`, `--chat-font`,
|
|
287
|
+
`--chat-font-mono`, `--chat-font-size`, `--chat-radius` and `--chat-density` (a factor for
|
|
288
|
+
spacing); an unset one keeps House's light or dark look. `mountChat(element, { client })`
|
|
289
|
+
places it outside React, with `update(props)` and `unmount()`.
|
|
283
290
|
|
|
284
291
|
Mix `ChatMessageList` (`components` takes your `UserMessage` and `AssistantMessage`),
|
|
285
292
|
`ChatInput` and `ChatQuestionCard` with your own design inside a `ChatProvider`, or
|
|
286
|
-
compose assistant-ui's primitives there; `useChat()` gives `send`, the conversations,
|
|
287
|
-
|
|
288
|
-
`
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
## What an agent must never do
|
|
294
|
-
|
|
295
|
-
An agent must never read the authorization, load code from a Room, call the Provider
|
|
296
|
-
directly, or rebase a refused Change Batch.
|
|
293
|
+
compose assistant-ui's primitives there; `useChat()` gives `send`, the conversations, the
|
|
294
|
+
Agents, questions to `answer`, `options` to `choose`, `commands`, the queue to `edit` or
|
|
295
|
+
`unqueue`, `stop`, `kill` and outcomes; never replace its messages, sending or store. It
|
|
296
|
+
shows a conversation's latest 50 messages, and assistant-ui's `loadEarlier()` the 50
|
|
297
|
+
before, which `ChatMessageList` calls as the reader scrolls back. A secret question is
|
|
298
|
+
never answered here; typed answers live in the Presentation State members named `typed:…`:
|
|
299
|
+
leave them. `Markdown` draws Markdown safely.
|
package/dist/actions.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAE1B,KAAK,0BAA0B,EAC/B,KAAK,eAAe,EACrB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAQtE,KAAK,QAAQ,GAAG;IAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnD,KAAK,mBAAmB,GAAG,QAAQ,GAAG;IAAE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE,KAAK,QAAQ,GAAG,eAAe,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC;AAE1D,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,qBAAqB,EAAE,mBAAmB,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CAQvB;AA6ED,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CAQjF;AAuKD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAiBtE"}
|
package/dist/actions.js
CHANGED
|
@@ -140,6 +140,8 @@ export function actionOutcome(answer, name) {
|
|
|
140
140
|
if (answer.status === 401)
|
|
141
141
|
return { kind: 'revoked-authorization' };
|
|
142
142
|
const refusal = doorRefusal(answer.body);
|
|
143
|
+
if (refusal?.code === 'operation_contended')
|
|
144
|
+
return { kind: 'transport-uncertainty' };
|
|
143
145
|
if (refusal !== null)
|
|
144
146
|
return { kind: 'rejected', ...refusal };
|
|
145
147
|
if (answer.status === 404)
|
package/dist/adapter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKV,OAAO,EACP,aAAa,EAkBd,MAAM,wBAAwB,CAAC;AA4ChC,OAAO,EASL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAyBxB,MAAM,MAAM,yBAAyB,GACjC;IACE,SAAS,EAAE,cAAc,CAAC;IAC1B,SAAS,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;CACrC,GACD;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAsErD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAyiBpF"}
|
package/dist/adapter.js
CHANGED
|
@@ -134,7 +134,7 @@ export function createAgentsHouseAdapter(options) {
|
|
|
134
134
|
const models = await streamedModels(advanced.schemas, entry, 'credential');
|
|
135
135
|
return models === undefined ? advanced.page : { ...advanced.page, models };
|
|
136
136
|
}
|
|
137
|
-
function held(rooms) {
|
|
137
|
+
function held(rooms, demand) {
|
|
138
138
|
const kept = rooms.flatMap((room) => {
|
|
139
139
|
const entry = tracked.get(room.locator);
|
|
140
140
|
const at = logPosition(room.roomVersion);
|
|
@@ -144,7 +144,7 @@ export function createAgentsHouseAdapter(options) {
|
|
|
144
144
|
notifications.reach(entry.authority, at);
|
|
145
145
|
return [presented(entry.authority, at)];
|
|
146
146
|
});
|
|
147
|
-
notifications.send(kept);
|
|
147
|
+
notifications.send(kept, demand === null ? null : { rooms: [...demand.rooms], conversations: demand.conversations });
|
|
148
148
|
}
|
|
149
149
|
function adopted(entry, outcome) {
|
|
150
150
|
if (outcome.kind !== 'accepted')
|
|
@@ -352,7 +352,7 @@ export function createAgentsHouseAdapter(options) {
|
|
|
352
352
|
return UNCERTAIN;
|
|
353
353
|
return mutationOutcome(settled.status, settled.body, entry.locator, entry.handle);
|
|
354
354
|
}
|
|
355
|
-
|
|
355
|
+
function granted(answer, locator) {
|
|
356
356
|
const failure = classifyDoor(answer.status, answer.body, locator);
|
|
357
357
|
if (failure !== null) {
|
|
358
358
|
return failure.kind === 'scoped-refusal'
|
|
@@ -365,13 +365,31 @@ export function createAgentsHouseAdapter(options) {
|
|
|
365
365
|
: failure;
|
|
366
366
|
}
|
|
367
367
|
const grant = parseGrant(answer.body);
|
|
368
|
-
|
|
368
|
+
const name = answer.body.name;
|
|
369
|
+
if (grant === null || grant.method !== 'GET' || typeof name !== 'string') {
|
|
369
370
|
return UNCERTAIN_READ;
|
|
370
|
-
|
|
371
|
+
}
|
|
372
|
+
return { kind: 'link', url: grant.url, name };
|
|
373
|
+
}
|
|
374
|
+
async function downloaded(answer, locator) {
|
|
375
|
+
const link = granted(answer, locator);
|
|
376
|
+
if (link.kind !== 'link')
|
|
377
|
+
return link;
|
|
378
|
+
const read = await transport.download(link.url);
|
|
371
379
|
if (read.status !== 200 || read.blob === null)
|
|
372
380
|
return UNCERTAIN_READ;
|
|
373
381
|
return { kind: 'binary', blob: read.blob };
|
|
374
382
|
}
|
|
383
|
+
function pathGrant(request) {
|
|
384
|
+
const entry = authorityFor(request.locator);
|
|
385
|
+
if (entry === undefined)
|
|
386
|
+
return null;
|
|
387
|
+
return transport.door(DOOR_FILES_GET, {
|
|
388
|
+
room_ref: entry.authority,
|
|
389
|
+
path: request.path,
|
|
390
|
+
revision: request.revision,
|
|
391
|
+
});
|
|
392
|
+
}
|
|
375
393
|
return {
|
|
376
394
|
async authorize() {
|
|
377
395
|
return options.authorize();
|
|
@@ -456,15 +474,10 @@ export function createAgentsHouseAdapter(options) {
|
|
|
456
474
|
},
|
|
457
475
|
async binary(_authorization, request) {
|
|
458
476
|
if (request.kind === 'path') {
|
|
459
|
-
const
|
|
460
|
-
if (
|
|
477
|
+
const asked = pathGrant(request);
|
|
478
|
+
if (asked === null)
|
|
461
479
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
462
|
-
|
|
463
|
-
room_ref: entry.authority,
|
|
464
|
-
path: request.path,
|
|
465
|
-
revision: request.revision,
|
|
466
|
-
});
|
|
467
|
-
return downloaded(answer, request.locator);
|
|
480
|
+
return downloaded(await asked, request.locator);
|
|
468
481
|
}
|
|
469
482
|
const referrer = houseReferrer(request.referrer, tracked);
|
|
470
483
|
if (referrer === null) {
|
|
@@ -476,6 +489,12 @@ export function createAgentsHouseAdapter(options) {
|
|
|
476
489
|
});
|
|
477
490
|
return downloaded(answer, referrer.locator);
|
|
478
491
|
},
|
|
492
|
+
async link(_authorization, request) {
|
|
493
|
+
const asked = pathGrant(request);
|
|
494
|
+
if (asked === null)
|
|
495
|
+
return { kind: 'room-not-readable', locator: request.locator };
|
|
496
|
+
return granted(await asked, request.locator);
|
|
497
|
+
},
|
|
479
498
|
referrerScope(referrer) {
|
|
480
499
|
const held = houseReferrer(referrer, tracked);
|
|
481
500
|
if (held === null)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { createAgentsHouseAdapter, type AgentsHouseAdapterOptions } from './adapter.js';
|
|
2
2
|
export { HOUSE_APP_ACTS, HOUSE_APP_BATCHES, HOUSE_SITE_ACTS } from './actions.js';
|
|
3
|
-
export type { HouseByteAct, HouseByteTransfer, HouseBytesAnswer, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
|
|
3
|
+
export type { HouseByteAct, HouseByteTransfer, HouseBytesAnswer, HouseClosing, HouseDemand, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,KAAK,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAClF,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,KAAK,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAClF,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
|
package/dist/read.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ import type { TrackedAuthority } from './discovery.js';
|
|
|
3
3
|
import type { HouseMode } from './transport.js';
|
|
4
4
|
import { type LogPosition } from './version.js';
|
|
5
5
|
export type HeadChange = BootstrapPage['changes'][string];
|
|
6
|
+
export declare function identities(revisions: Readonly<Record<string, string>>): {
|
|
7
|
+
fileIds?: Record<string, string>;
|
|
8
|
+
};
|
|
6
9
|
export type HouseManifestFile = {
|
|
7
10
|
path: string;
|
|
8
11
|
revision: string | undefined;
|
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,KAAK,EACV,cAAc,EACd,UAAU,EACV,aAAa,EAEb,aAAa,EACd,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAsC,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAEpF,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../src/read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EACV,aAAa,EAEb,aAAa,EACd,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAA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,UAAU,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAElF;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,aAAa,CAsB5D;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAO9E;AAED,wBAAgB,MAAM,CACpB,WAAW,EAAE,gBAAgB,EAC7B,OAAO,EAAE,gBAAgB,GACxB,SAAS,GAAG,SAAS,CAEvB;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,GAAG,aAAa,CA2BnF"}
|
package/dist/read.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { DECIMAL, readPosition, roomVersion } from './version.js';
|
|
2
|
+
const REVISION_FILE = /^fr_([0-9a-z]+)\.[0-9a-z]+\.[0-9a-z]$/u;
|
|
3
|
+
export function identities(revisions) {
|
|
4
|
+
const fileIds = Object.fromEntries(Object.entries(revisions).flatMap(([path, revision]) => {
|
|
5
|
+
const file = REVISION_FILE.exec(revision)?.[1];
|
|
6
|
+
return file === undefined ? [] : [[path, file]];
|
|
7
|
+
}));
|
|
8
|
+
return Object.keys(fileIds).length === 0 ? {} : { fileIds };
|
|
9
|
+
}
|
|
2
10
|
export function authorityRoot(handle) {
|
|
3
11
|
return `/rooms/${handle}`;
|
|
4
12
|
}
|
|
@@ -353,6 +361,7 @@ export function bootstrapOf(scope) {
|
|
|
353
361
|
roomVersion: roomVersion(scope),
|
|
354
362
|
documents,
|
|
355
363
|
revisions,
|
|
364
|
+
...identities(revisions),
|
|
356
365
|
changes,
|
|
357
366
|
binaryFiles,
|
|
358
367
|
};
|
|
@@ -396,6 +405,7 @@ export function refreshFrom(view, fromRoomVersion) {
|
|
|
396
405
|
roomVersion: roomVersion(view),
|
|
397
406
|
documents,
|
|
398
407
|
revisions,
|
|
408
|
+
...identities(revisions),
|
|
399
409
|
changes,
|
|
400
410
|
binaryFiles,
|
|
401
411
|
removals: removals.sort(),
|
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,
|
|
1
|
+
{"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAUR,MAAM,wBAAwB,CAAC;AA2BhC,OAAO,EAOL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAyCxB,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,EAAE,QAAQ,UAAQ,GAAG,OAAO,CAyR1F"}
|
package/dist/site.js
CHANGED
|
@@ -9,6 +9,9 @@ import { SITE_DOOR_BOOTSTRAP, SITE_DOOR_DISCOVER, SITE_DOOR_ENUMERATE, SITE_DOOR
|
|
|
9
9
|
import { houseReferrer } from './referrer.js';
|
|
10
10
|
import { followsVersion, logPosition, presented, reachedVersion, roomVersion, } from './version.js';
|
|
11
11
|
const UNCERTAIN = { kind: 'transport-uncertainty' };
|
|
12
|
+
function unfound() {
|
|
13
|
+
return { kind: 'rejected', code: 'file_not_found', fields: {}, retryable: false };
|
|
14
|
+
}
|
|
12
15
|
function siteRoom(tracked) {
|
|
13
16
|
return {
|
|
14
17
|
name: tracked.handle,
|
|
@@ -30,6 +33,18 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
30
33
|
const named = houseReferrer(referrer, tracked);
|
|
31
34
|
return named === null || !tracked.has(named.locator) ? null : named;
|
|
32
35
|
}
|
|
36
|
+
function fileRoute(request) {
|
|
37
|
+
const named = published(request.kind === 'path' ? { room: request.locator, path: request.path } : request.referrer);
|
|
38
|
+
if (named === null) {
|
|
39
|
+
return { kind: 'rejected', code: 'referrer_unknown', fields: {}, retryable: false };
|
|
40
|
+
}
|
|
41
|
+
if (request.fileRef === undefined)
|
|
42
|
+
return unfound();
|
|
43
|
+
const { room_ref, path, record } = named.referrer;
|
|
44
|
+
return `${SITE_FILES}${room_ref}/${encodeURIComponent(request.fileRef)}/${path === undefined
|
|
45
|
+
? `${SITE_FILE_RECORD}/${encodeURIComponent(record)}`
|
|
46
|
+
: encodeURIComponent(path)}`;
|
|
47
|
+
}
|
|
33
48
|
async function enumerated(entry, from, page) {
|
|
34
49
|
const answer = await transport.door(SITE_DOOR_ENUMERATE, {
|
|
35
50
|
positions: [
|
|
@@ -198,24 +213,26 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
198
213
|
return { kind: 'no-history' };
|
|
199
214
|
},
|
|
200
215
|
async binary(_authorization, request) {
|
|
201
|
-
const
|
|
202
|
-
if (
|
|
203
|
-
return
|
|
204
|
-
|
|
205
|
-
if (
|
|
206
|
-
return
|
|
207
|
-
}
|
|
208
|
-
const { room_ref, path, record } = named.referrer;
|
|
209
|
-
const read = await transport.download(`${SITE_FILES}${room_ref}/${encodeURIComponent(request.fileRef)}/${path === undefined
|
|
210
|
-
? `${SITE_FILE_RECORD}/${encodeURIComponent(record)}`
|
|
211
|
-
: encodeURIComponent(path)}`);
|
|
212
|
-
if (read.status === 404) {
|
|
213
|
-
return { kind: 'rejected', code: 'file_not_found', fields: {}, retryable: false };
|
|
214
|
-
}
|
|
216
|
+
const route = fileRoute(request);
|
|
217
|
+
if (typeof route !== 'string')
|
|
218
|
+
return route;
|
|
219
|
+
const read = await transport.download(route);
|
|
220
|
+
if (read.status === 404)
|
|
221
|
+
return unfound();
|
|
215
222
|
return read.status === 200 && read.blob !== null
|
|
216
223
|
? { kind: 'binary', blob: read.blob }
|
|
217
224
|
: UNCERTAIN;
|
|
218
225
|
},
|
|
226
|
+
async link(_authorization, request) {
|
|
227
|
+
const route = fileRoute(request);
|
|
228
|
+
if (typeof route !== 'string')
|
|
229
|
+
return route;
|
|
230
|
+
return {
|
|
231
|
+
kind: 'link',
|
|
232
|
+
url: route,
|
|
233
|
+
name: request.path.slice(request.path.lastIndexOf('/') + 1),
|
|
234
|
+
};
|
|
235
|
+
},
|
|
219
236
|
referrerScope(referrer) {
|
|
220
237
|
const named = published(referrer);
|
|
221
238
|
if (named === null)
|
|
@@ -253,7 +270,7 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
253
270
|
return [];
|
|
254
271
|
notifications.reach(entry.authority, at);
|
|
255
272
|
return [presented(entry.authority, at)];
|
|
256
|
-
}));
|
|
273
|
+
}), null);
|
|
257
274
|
},
|
|
258
275
|
reopen: notifications.reopen,
|
|
259
276
|
observe: notifications.observe,
|
package/dist/stream.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ConversationStream, RefreshPage, RoomStreamEvent, ServiceModeSignal, StreamReceipts } from '@agentshouse/mdruntime';
|
|
2
2
|
import type { TrackedAuthority } from './discovery.js';
|
|
3
|
-
import type { HouseDoor, HouseHeldRoom, HouseMode, HouseStreamEntry } from './transport.js';
|
|
3
|
+
import type { HouseDemand, HouseDoor, HouseHeldRoom, HouseMode, HouseStreamEntry } from './transport.js';
|
|
4
4
|
import { type LogPosition } from './version.js';
|
|
5
5
|
export type HeldRevision = (path: string, revision: string) => boolean;
|
|
6
6
|
export type StreamedAdvancement = {
|
|
@@ -11,7 +11,7 @@ export type StreamedAdvancement = {
|
|
|
11
11
|
export type HouseNotifications = {
|
|
12
12
|
runtime: string;
|
|
13
13
|
observe(notify: (event: RoomStreamEvent) => void, receipts: StreamReceipts): () => void;
|
|
14
|
-
send(rooms: readonly HouseHeldRoom[]): void;
|
|
14
|
+
send(rooms: readonly HouseHeldRoom[], demand: HouseDemand | null): void;
|
|
15
15
|
published(locator: string, at: LogPosition): void;
|
|
16
16
|
reopen(): void;
|
|
17
17
|
track(authorities: readonly TrackedAuthority[]): void;
|
package/dist/stream.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,kBAAkB,EAElB,WAAW,EACX,eAAe,EAEf,iBAAiB,EACjB,cAAc,EAEf,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EAEb,SAAS,EAET,gBAAgB,EAEjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AA0C7D,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;AAEvE,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACrC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,EAAE,QAAQ,EAAE,cAAc,GAAG,MAAM,IAAI,CAAC;IACxF,IAAI,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,kBAAkB,EAElB,WAAW,EACX,eAAe,EAEf,iBAAiB,EACjB,cAAc,EAEf,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE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BAAkB,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,GAAG,kBAAkB,CAwhB5F"}
|
package/dist/stream.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { acceptedMessage } from './actions.js';
|
|
2
2
|
import { sha256Hex } from './digest.js';
|
|
3
|
-
import { binaryFileOf, headChange } from './read.js';
|
|
3
|
+
import { binaryFileOf, headChange, identities } from './read.js';
|
|
4
4
|
import { roomVersion } from './version.js';
|
|
5
5
|
const HELD_FRAMES_MAX = 256;
|
|
6
6
|
function turnOperation(frame) {
|
|
@@ -352,6 +352,10 @@ export function houseNotifications(transport, mode) {
|
|
|
352
352
|
});
|
|
353
353
|
return;
|
|
354
354
|
}
|
|
355
|
+
if (frame.type === 'authority_changed') {
|
|
356
|
+
emit({ kind: 'authority-changed' });
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
355
359
|
if (frame.type === 'conversations') {
|
|
356
360
|
emitConversation({ kind: 'list', entries: frame.conversations.map(listedConversation) });
|
|
357
361
|
return;
|
|
@@ -421,10 +425,10 @@ export function houseNotifications(transport, mode) {
|
|
|
421
425
|
});
|
|
422
426
|
});
|
|
423
427
|
stream.opened(reopened);
|
|
424
|
-
stream.closed((revoked) => {
|
|
428
|
+
stream.closed(({ revoked, lost }) => {
|
|
425
429
|
opening = null;
|
|
426
430
|
acknowledging = null;
|
|
427
|
-
emit({ kind: 'closed', revoked });
|
|
431
|
+
emit({ kind: 'closed', revoked, lost });
|
|
428
432
|
});
|
|
429
433
|
return {
|
|
430
434
|
runtime,
|
|
@@ -463,7 +467,7 @@ export function houseNotifications(transport, mode) {
|
|
|
463
467
|
observers.delete(notify);
|
|
464
468
|
};
|
|
465
469
|
},
|
|
466
|
-
send(rooms) {
|
|
470
|
+
send(rooms, demand) {
|
|
467
471
|
for (const room of rooms) {
|
|
468
472
|
const line = lines.get(room.authority);
|
|
469
473
|
const held = position(room.position);
|
|
@@ -478,7 +482,7 @@ export function houseNotifications(transport, mode) {
|
|
|
478
482
|
void loaded
|
|
479
483
|
.then(() => Promise.all(rooms.map(restored)))
|
|
480
484
|
.then((presented) => {
|
|
481
|
-
current.hold(presented, runtime);
|
|
485
|
+
current.hold(presented, runtime, demand);
|
|
482
486
|
for (const [index, room] of presented.entries()) {
|
|
483
487
|
if (room.position === rooms[index].position)
|
|
484
488
|
continue;
|
|
@@ -601,6 +605,7 @@ export function houseNotifications(transport, mode) {
|
|
|
601
605
|
roomVersion: roomVersion({ position: last.position.toString(), logEpoch: line.logEpoch }),
|
|
602
606
|
documents,
|
|
603
607
|
revisions,
|
|
608
|
+
...identities(revisions),
|
|
604
609
|
changes,
|
|
605
610
|
binaryFiles,
|
|
606
611
|
removals: removals.sort(),
|
package/dist/transport.d.ts
CHANGED
|
@@ -80,6 +80,8 @@ export type HouseStreamFrame = {
|
|
|
80
80
|
} | {
|
|
81
81
|
type: 'opening';
|
|
82
82
|
expired: readonly string[];
|
|
83
|
+
} | {
|
|
84
|
+
type: 'authority_changed';
|
|
83
85
|
} | ({
|
|
84
86
|
type: 'turn';
|
|
85
87
|
conversation_id: string;
|
|
@@ -134,15 +136,23 @@ export type HouseHeldRoom = {
|
|
|
134
136
|
log_epoch: string;
|
|
135
137
|
carry?: HouseHeldCarry;
|
|
136
138
|
};
|
|
139
|
+
export type HouseDemand = {
|
|
140
|
+
rooms: readonly string[];
|
|
141
|
+
conversations: boolean;
|
|
142
|
+
};
|
|
137
143
|
export type HouseOpening = {
|
|
138
|
-
hold(rooms: readonly HouseHeldRoom[], runtime: string): void;
|
|
144
|
+
hold(rooms: readonly HouseHeldRoom[], runtime: string, demand: HouseDemand | null): void;
|
|
139
145
|
received(authority: string, carry: string, index: number): void;
|
|
140
146
|
close(): void;
|
|
141
147
|
};
|
|
148
|
+
export type HouseClosing = {
|
|
149
|
+
revoked: boolean;
|
|
150
|
+
lost: boolean;
|
|
151
|
+
};
|
|
142
152
|
export type HouseStream = {
|
|
143
153
|
observe(receive: (frame: HouseStreamFrame) => void): () => void;
|
|
144
154
|
opened(notify: (opening: HouseOpening) => void): () => void;
|
|
145
|
-
closed(notify: (
|
|
155
|
+
closed(notify: (closing: HouseClosing) => void): () => void;
|
|
146
156
|
};
|
|
147
157
|
export type HouseDoor = {
|
|
148
158
|
door(route: string, body: unknown): Promise<HouseDoorAnswer>;
|
package/dist/transport.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE/E,eAAO,MAAM,aAAa,mBAAmB,CAAC;AAE9C,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,UAAU,gBAAgB,CAAC;AAExC,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AAEtD,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAE1D,eAAO,MAAM,mBAAmB,4BAA4B,CAAC;AAE7D,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAE5D,eAAO,MAAM,gBAAgB,wBAAwB,CAAC;AAEtD,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,MAAM,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,UAAU,mBAAmB,CAAC;AAE3C,eAAO,MAAM,gBAAgB,WAAW,CAAC;AAEzC,MAAM,MAAM,YAAY,GAAG,uBAAuB,GAAG,0BAA0B,GAAG,cAAc,CAAC;AAEjG,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,IAAI,CA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CAAC,CAE1D;AAiDD,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,cAAc,CAmFhB;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC;IAEjF,IAAI,EAAE,UAAU;IAChB,QAAQ;IACR,IAAI;IACJ,MAAM;QAAI,IAAI;;IACd,SAAS;EAEZ;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAM1B;AA4BD,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3C,aAAa,CAyDf"}
|
package/dist/write.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { departure, } from '@agentshouse/mdruntime';
|
|
2
|
-
import { binaryFileOf, headChange } from './read.js';
|
|
2
|
+
import { binaryFileOf, headChange, identities } from './read.js';
|
|
3
3
|
import { sha256Hex, textBytes } from './digest.js';
|
|
4
4
|
import { nativePath, roomLocalPath } from './map.js';
|
|
5
5
|
import { classifyDoor, doorRefusal, scopedRefusal } from './refusal.js';
|
|
@@ -272,6 +272,7 @@ export function mutationOutcome(status, body, locator, handle) {
|
|
|
272
272
|
roomVersion: roomVersion(at),
|
|
273
273
|
documents,
|
|
274
274
|
revisions,
|
|
275
|
+
...identities(revisions),
|
|
275
276
|
changes,
|
|
276
277
|
removals: removals.sort(),
|
|
277
278
|
...(Object.keys(binaryFiles).length === 0 ? {} : { binaryFiles }),
|
|
@@ -340,7 +341,7 @@ export function historyOutcome(status, body, locator, request) {
|
|
|
340
341
|
return {
|
|
341
342
|
kind: 'scoped-refusal',
|
|
342
343
|
locator,
|
|
343
|
-
scope: '
|
|
344
|
+
scope: 'operation',
|
|
344
345
|
code: 'retained_history_unavailable',
|
|
345
346
|
fields: { path: request.path, revision: request.revision },
|
|
346
347
|
retryable: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentshouse/mdruntime-adapter",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-ca764edcceec6",
|
|
4
4
|
"description": "Agents House Adapter for the MD Runtime",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
"LICENSE"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@agentshouse/mdruntime": "0.1.0-
|
|
28
|
+
"@agentshouse/mdruntime": "0.1.0-c6fd2cbbff187"
|
|
29
29
|
}
|
|
30
30
|
}
|