@agentshouse/mdruntime-adapter 0.1.0-c5984663346b5 → 0.1.0-c5c5ff2bcc92c
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 +194 -202
- 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 +25 -7
- package/dist/discovery.d.ts +3 -3
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +18 -9
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +3 -3
- package/dist/stream.d.ts +2 -2
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +23 -4
- package/dist/transport.d.ts +15 -5
- package/dist/transport.d.ts.map +1 -1
- package/package.json +2 -2
package/AGENTS.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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
|
|
|
@@ -13,104 +13,101 @@ 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 them and
|
|
17
|
-
|
|
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
18
|
observation hold none. A changed reach reaches every open observation as its new value.
|
|
19
19
|
|
|
20
|
-
Every `observe` resolves, once its first value
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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.
|
|
24
24
|
|
|
25
25
|
`observe('agents')` answers every Agent a new conversation can go to, each `{ identity,
|
|
26
|
-
name }`,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
App Creator composes
|
|
39
|
-
|
|
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, and `chatDraft.prepend(conversation, draft)` puts a returned
|
|
39
|
+
message ahead of it as it stands. Sending it is a Provider Action that needs the Provider
|
|
40
|
+
reachable and is never queued. A new conversation's chat draft is keyed `new:<Agent
|
|
40
41
|
identity>`: no conversation list removes it, a retired Agent's goes, and the first answer
|
|
41
42
|
to `conversation.create({ agent_id, operation_id })` moves it to the created conversation,
|
|
42
43
|
where `conversation.send(conversation)` sends it; a replay of that create moves nothing.
|
|
43
44
|
|
|
44
|
-
Presentation State is one value per App, kept in the browser and shared by
|
|
45
|
-
|
|
46
|
-
`observe('presentation')` hears it whole
|
|
47
|
-
`presentation.edit(members)` sets each member
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
'
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
whose text names it. Both answer `{ kind: 'binary', blob }` or a refusal or failure.
|
|
45
|
+
Presentation State is one value per App, kept in the browser and shared by its tabs:
|
|
46
|
+
`presentation.read()` answers it, `null` before anything is kept,
|
|
47
|
+
`observe('presentation')` hears it whole, `presentation.write(value)` replaces it whole,
|
|
48
|
+
and `presentation.edit(members)` sets each member named, or removes one named `null`, in
|
|
49
|
+
the state as it stands, so tabs changing different members never lose each other's change:
|
|
50
|
+
never write back a value read before. Each rejects when the browser does not keep the
|
|
51
|
+
change, and no tab sees it then.
|
|
52
|
+
|
|
53
|
+
A binary file at a Path is a binary Path entry. Query lists it by `path`, and History each
|
|
54
|
+
of its revisions, with its `binaryFile` record and never its bytes: `{ state: 'accepted',
|
|
55
|
+
revision, path, fileRef, byteLength, mediaType, sha256 }`, or, from a Save until the
|
|
56
|
+
Provider accepts it, `{ state: 'pending', localId, path, byteLength, mediaType, sha256 }`.
|
|
57
|
+
Write one with a Room Draft whose only part is `file: { blob }`, the `Blob`'s `type` its
|
|
58
|
+
media type: Save keeps the bytes in its Pending Change, offline too, and acceptance gives
|
|
59
|
+
the record the Provider's revision. Move or remove one as a Document, a pending one too,
|
|
60
|
+
its bytes following; once its Pending Change has gone to the Provider, Save refuses that
|
|
61
|
+
as `unknown-revision` until it is accepted. `binaryFile.read(room, path, revision?)`
|
|
62
|
+
answers a pending record's saved bytes, or asks the Provider on every read of an accepted
|
|
63
|
+
one or a History revision, a removed file's last included, keeping nothing. Text, a Record
|
|
64
|
+
attachment or a conversation message may name a file by its `fileRef`; read it with
|
|
65
|
+
`binaryFile.readReference({ fileRef, referrer })`, the `referrer` the Provider gave beside
|
|
66
|
+
it, or `{ room, path }` of the document whose text names it. Both answer
|
|
67
|
+
`{ kind: 'binary', blob }` or a refusal or failure.
|
|
68
68
|
|
|
69
69
|
Rooms, Query, Search, Observe, Types, Room Draft, Save, and Reached never touch the
|
|
70
|
-
network
|
|
71
|
-
Call takes the Action names the Adapter declares
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
the Room
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
authorization, performs a request the App's code composes, or exposes the browser store.
|
|
70
|
+
network; History, the binary file reads and Call go to the Provider through the Adapter.
|
|
71
|
+
Call takes the Action names the Adapter declares, any other answering `undeclared`. A Call
|
|
72
|
+
result whose effect the Provider places in a Room carries `at`, that Room and Room
|
|
73
|
+
Version: `reached(room, roomVersion)` answers whether the Room's confirmed state has
|
|
74
|
+
reached it, refreshing the Room until it has, and `reached(room, roomVersion, path)`
|
|
75
|
+
whether the held copy of that document was written later. A History revision names its
|
|
76
|
+
author, `{ kind: 'user', id }` or `{ kind: 'site', id, name }`; History of a Path no
|
|
77
|
+
document holds answers the removed document's revisions, newest first, with `deleted:
|
|
78
|
+
true`, which a link to the Path opens. Every member is asynchronous and every result a
|
|
79
|
+
detached snapshot; nothing returns the authorization, performs a request the App's code
|
|
80
|
+
composes, or exposes the browser store. A Room `rooms` names `locked` shows only online.
|
|
82
81
|
|
|
83
82
|
Every refusal and failure carries `code` and `retryable`: each Call and History answer
|
|
84
|
-
other than its result, a refused Save or Room Draft write, a returned Room Draft's
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
model with no usable types answers `types: null`, whatever its `status`.
|
|
83
|
+
other than its result, a refused Save or Room Draft write, a returned Room Draft's reason,
|
|
84
|
+
a Room's refusal, the Connection Refusal and every error a member rejects with, beside its
|
|
85
|
+
message, a Provider refusal with the Provider's own `retryable`. Every code and value is
|
|
86
|
+
open: handle one you do not know by its `code` and `retryable`. Only a tag telling which
|
|
87
|
+
fields a value carries, such as `kind`, is closed: keep a branch for one you do not know.
|
|
88
|
+
A model with no usable types answers `types: null`.
|
|
91
89
|
|
|
92
90
|
Read the deployment facts with `observe('deployment-facts')`, an opaque value the host's
|
|
93
|
-
contract interprets. `observe('member')` answers who uses the App
|
|
94
|
-
signed in, `{ kind: 'user', id, name }`
|
|
95
|
-
Document whose `change.author.id`
|
|
96
|
-
the Provider first names one, and where it names none, such as a Site.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
observation with the authorization. It is the only way App code learns who uses it.
|
|
91
|
+
contract interprets. `observe('member')` answers who uses the App, the only way App code
|
|
92
|
+
learns it: the User the Provider signed in, `{ kind: 'user', id, name }` like a change's
|
|
93
|
+
`author`, so a Document whose `change.author.id` is its `id` is that User's own; `null`
|
|
94
|
+
until the Provider first names one, and where it names none, such as a Site. It is kept
|
|
95
|
+
with the Local Replicas, answers offline once known, and every port hears the next member
|
|
96
|
+
named; signing out answers `null`, then ends the observation with the authorization.
|
|
100
97
|
|
|
101
98
|
## Local Query rules
|
|
102
99
|
|
|
103
|
-
`query(q)` answers once from local state; `observe('query', q)` holds the whole result
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
observe the query to hear the complete one. A query is data:
|
|
100
|
+
`query(q)` answers once from local state; `observe('query', q)` holds the whole result and
|
|
101
|
+
hears it again only when it changes, keeping every unchanged Document the same object, so
|
|
102
|
+
a component can tell what changed by identity. `{ documents, coverage }` or `{ groups,
|
|
103
|
+
coverage }` is complete for the Rooms its `coverage` names, and `{ pending }` names each
|
|
104
|
+
Room not yet acquired, prepared or unlocked, `[{ room, awaits }]`: never read it as empty,
|
|
105
|
+
draw it as loading and observe the query to hear the complete answer. A query is data:
|
|
110
106
|
|
|
111
107
|
- **Filter.** `rooms` names Room locators and defaults to every Room. `types` names MD
|
|
112
|
-
Types, and `any` names untyped Markdown Documents. `pathPrefix` is a directory:
|
|
113
|
-
|
|
108
|
+
Types, and `any` names untyped Markdown Documents. `pathPrefix` is a directory: `notes`
|
|
109
|
+
keeps `notes/a.md` and not `notes2/a.md`; `folder` keeps only what lies directly in it.
|
|
110
|
+
`paths` keeps only the Paths it names: read named Documents so, never from a list.
|
|
114
111
|
- **Fields.** Every frontmatter value is named by JSON Pointer: `/status`,
|
|
115
112
|
`/shipping/city`, `~1` for a `/` and `~0` for a `~` in a key. A segment that meets a
|
|
116
113
|
list applies to every item and a number names one item. `where` names pointers, ANDs
|
|
@@ -131,111 +128,115 @@ observe the query to hear the complete one. A query is data:
|
|
|
131
128
|
or a list of pointers and `sections` `'all'` or a list of names. Selected pointers
|
|
132
129
|
return the frontmatter holding only them, nested as written. A backlink names the
|
|
133
130
|
referring Path, MD Type and the pointer it came from as `field`. Room and Path always
|
|
134
|
-
return; a Markdown Document also returns its MD Type
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
131
|
+
return; a Markdown Document also returns its MD Type, and at most its first 1,000
|
|
132
|
+
backlinks: a query on the referring field reads the rest. A non-Markdown Document
|
|
133
|
+
returns only Room, Path and a selected `fileId`, and a binary Path entry its
|
|
134
|
+
`binaryFile` record too. An unselected part is absent. Select only what a screen shows:
|
|
135
|
+
a list that selects the Markdown hears every edit of it.
|
|
136
|
+
- **Change and file ID.** `change` is `{ author, time }` of the Document's head revision
|
|
137
|
+
as the Provider last delivered it: `author` is `{ kind: 'user' | 'site', id, name }`, or
|
|
138
|
+
`null` for a write the Provider made itself, and `time` its ISO 8601 change time, or the
|
|
139
|
+
whole change `null` where it delivered no time, as at a Site. `fileId` is the Provider's
|
|
140
|
+
Stable File ID of the file at the Path, or `null`. An unsent edit keeps both, an unsent
|
|
141
|
+
move keeps the change and carries the file ID to the new Path, so a file ID that leaves
|
|
142
|
+
one Path for another is the same file moved, and an unsent creation has neither until it
|
|
143
|
+
is Accepted. A Room's last change is its Document with the latest `time`.
|
|
144
|
+
- **Order and groups.** `orderBy` sorts by `room`, `path`, `type`, `folder` or `{ field }`
|
|
145
|
+
with TanStack DB's own options; ties end with Room, then Path. `groupBy` by `room`,
|
|
146
|
+
`type`, `folder` or `{ field }` answers `{ groups: [{ key, count }] }`, counted over every
|
|
147
|
+
match and ordered by `count` or a key. A sort or group takes only a single-value pointer.
|
|
148
|
+
`limit`, at most 1,000 whatever a query names, bounds the Documents or the groups, and a
|
|
149
|
+
result it cuts short names `next`: the same query with it as `after` reads the next
|
|
150
|
+
window, in the same order, ties included. `total: true` adds `total`, every match's
|
|
151
|
+
count. An observed window hears rows entering, leaving or changing, and `next`, `total`.
|
|
152
|
+
- **Results and errors.** A result carries no Room Version: read freshness from Rooms and
|
|
153
|
+
Sync Status. `coverage` names each Room read as `{ room, generation, current }`,
|
|
154
|
+
`current` false while a newer copy of that Room is being fetched, and the queued changes
|
|
155
|
+
it includes as `overlay`, which a Save in the Room changes. An invalid query fails with
|
|
156
|
+
`invalid-query`, `unknown-type`, `unknown-field` or `wrong-kind`, never an empty answer.
|
|
159
157
|
|
|
160
158
|
## Local Search rules
|
|
161
159
|
|
|
162
|
-
`search({ text, documents, collection, conversations, limit })` answers
|
|
163
|
-
from local state, with MiniSearch's defaults. There is no observed search.
|
|
160
|
+
`search({ text, documents, collection, conversations, limit, after, total })` answers
|
|
161
|
+
once, by words, from local state, with MiniSearch's defaults. There is no observed search.
|
|
164
162
|
|
|
165
163
|
- **Declaration.** Only an App whose release declares Local Search searches, its first
|
|
166
164
|
readiness waiting for its index; any other App's `search` answers the never retryable
|
|
167
165
|
`undeclared` refusal `search-undeclared`, its `fields` naming `local_search`.
|
|
168
|
-
- **What is found.** A Document by its field values, its sections' headings and text,
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
166
|
+
- **What is found.** A Document by its field values, its sections' headings and text, its
|
|
167
|
+
preamble and its Path, and a message by its text, never a frontmatter key, a Room Draft,
|
|
168
|
+
a chat draft or a running turn's parts, with no phrases, word forms, typo tolerance or
|
|
169
|
+
prefix matching.
|
|
172
170
|
- **Narrowing.** `documents` is a Local Query filter, and `collection: true` leaves out
|
|
173
171
|
what each Room's `typedSelection` roots hold; `conversations` names conversations. All
|
|
174
|
-
apply before `limit`, which bounds each list
|
|
172
|
+
apply before `limit`, which bounds each list, at most 1,000 whatever a search names. A
|
|
173
|
+
complete answer it cuts short names `next`, which `after` takes for the next window of
|
|
174
|
+
both lists. `total: true` adds `total`, each list's count.
|
|
175
175
|
- **Results.** `{ documents, messages, coverage }`, or the same with `pending` naming each
|
|
176
176
|
Room or conversation the search still waits for: show its hits, ask again, and never
|
|
177
177
|
read pending as no hits. `coverage` names the Rooms and conversations searched. Each
|
|
178
|
-
list is ranked by `score`, comparable only within it;
|
|
179
|
-
then `
|
|
180
|
-
`conversation` and `identity`; `matches` maps each matched
|
|
181
|
-
in: `fields`, `sections`, `preamble`, `path` or `text`. A
|
|
182
|
-
|
|
178
|
+
list is ranked by `score`, comparable only within it; ties come by `room`, then `path`,
|
|
179
|
+
or by `conversation`, then `identity`. A Document hit names its `room`, `path` and
|
|
180
|
+
`type`, a message hit its `conversation` and `identity`; `matches` maps each matched
|
|
181
|
+
word to the parts it matched in: `fields`, `sections`, `preamble`, `path` or `text`. A
|
|
182
|
+
hit carries no position: mark the words you show. A bad filter fails as a query does.
|
|
183
183
|
|
|
184
184
|
## Room Draft, Save, and outcome rules
|
|
185
185
|
|
|
186
|
-
The MD Runtime owns one Room Draft per Room and Path, shared by every App and tab
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
revision is refused as `stale` with the current Room Draft; read it and write again.
|
|
186
|
+
The MD Runtime owns one durable Room Draft per Room and Path, shared by every App and tab
|
|
187
|
+
across reloads; a Room the Provider reports lost takes its Room Drafts and queue with it.
|
|
188
|
+
Write one with `roomDraft.write(room, path, revision, parts)`, naming the revision you
|
|
189
|
+
read or `null`, and every part it now changes: fields, sections and the preamble, or the
|
|
190
|
+
whole Markdown, a creation, a move or a removal. A new part names its base, the value you
|
|
191
|
+
showed when it was opened, a field's as `{ value }` or `null` for no such field, and keeps
|
|
192
|
+
its first base; a binary Path entry's move or removal takes `null`. A write or discard
|
|
193
|
+
from an older revision is refused as `stale` with the current Room Draft.
|
|
195
194
|
|
|
196
195
|
Save takes one Room and the Room Drafts of it to save, each with its revision, validates
|
|
197
196
|
locally, and on success appends one Change Batch to that Room's queue and removes those
|
|
198
|
-
Room Drafts.
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
197
|
+
Room Drafts. Refused as `stale`, `changed-underneath` naming each part whose base no
|
|
198
|
+
longer matches the visible state, or a local validation rule, it creates nothing and
|
|
199
|
+
leaves every Room Draft. A directory move or removal is that part on each Document and
|
|
200
|
+
binary Path entry beneath it, saved together. `saveParts(room, [{ path, parts }])` saves
|
|
201
|
+
parts, each Path once and each new part with its base, the same way but writes no Room
|
|
202
|
+
Draft: one held at a saved Path stays, one at a moved Path moves with it to a destination
|
|
203
|
+
that holds none. Never save by writing back a Room Draft read before.
|
|
202
204
|
|
|
203
205
|
Outcomes follow the Provider's answer. An Accepted Change Batch stays in the queue, drawn
|
|
204
|
-
over the confirmed layer, until that layer reaches the Room Version it was accepted at
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
Pending
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
On a Site, every Save stays in the visitor's browser. Write grants and revisions do not
|
|
206
|
+
over the confirmed layer, until that layer reaches the Room Version it was accepted at.
|
|
207
|
+
Conflicted and Rejected, an expired operation, and a change that no longer applies each
|
|
208
|
+
leave the queue and return as Room Drafts on their Documents, marked with why: the
|
|
209
|
+
Provider's structured refusal code and fields as returned, not known to have applied, or
|
|
210
|
+
withdrawn locally. The rest of the queue keeps synchronizing, and Sync Status requires
|
|
211
|
+
attention until each returned Room Draft is saved or discarded. `observe('queue', room)`
|
|
212
|
+
shows each Pending Change Batch, which keeps no outcome once it leaves. Transport failure,
|
|
213
|
+
Provider unavailability and a refusal marked retryable, until the reset it names, keep
|
|
214
|
+
work Pending; the MD Runtime retries the same Change Batch identity and payload, never
|
|
215
|
+
infers an outcome from transport uncertainty, and never combines, reorders, or rebases.
|
|
216
|
+
|
|
217
|
+
On a Site, every Save stays in the visitor's browser: write grants and revisions do not
|
|
217
218
|
refuse it, and its Pending Change shows in every query and across reloads until the
|
|
218
|
-
browser's storage is cleared. It is never sent: `observe('queue', room)` shows it
|
|
219
|
-
|
|
220
|
-
|
|
219
|
+
browser's storage is cleared. It is never sent: `observe('queue', room)` shows it `local`,
|
|
220
|
+
Sync Status never waits on it, and once the Room no longer lets it apply it leaves the
|
|
221
|
+
queue and returns no Room Draft.
|
|
221
222
|
|
|
222
223
|
`observe('service-mode')` answers the Provider's Service Mode, `open` or `write-halted`.
|
|
223
|
-
While writes are halted, Save
|
|
224
|
-
|
|
225
|
-
returns that refusal
|
|
224
|
+
While writes are halted, Save succeeds, its Change Batch waits unsent and the queue is
|
|
225
|
+
submitted in order once writes reopen; an Action is never held, and one the halt refuses
|
|
226
|
+
returns that refusal: show the Provider as read-only instead of retrying.
|
|
226
227
|
`observe('readiness')` tells whether the App's code and bound Rooms are held locally
|
|
227
228
|
(`ready`), each Room's state, each refused Room's file and rule, the persistence answer
|
|
228
229
|
and a paused preparation's `capacity` cause; `retry()` resumes a paused preparation.
|
|
229
230
|
|
|
230
|
-
## Content
|
|
231
|
+
## Content safety and launch promises
|
|
231
232
|
|
|
232
233
|
The Provider authorization belongs to the Runtime host and is never readable by the App's
|
|
233
234
|
code. The App's code reaches the network only at the external origins its manifest
|
|
234
235
|
declares, empty by default, and the Provider enforces that set. Rendered Markdown never
|
|
235
236
|
executes scripts, renders raw HTML only for the details and summary elements, and loads
|
|
236
|
-
images and other resources only from origins the Provider's policy allows.
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
images and other resources only from origins the Provider's policy allows. An agent must
|
|
238
|
+
never read the authorization, load code from a Room, call the Provider directly, or rebase
|
|
239
|
+
a refused Change Batch.
|
|
239
240
|
|
|
240
241
|
MD UI uses semantic HTML, is fully operable from a keyboard with visible focus and
|
|
241
242
|
labelled controls, and lays out from a 360 pixel wide viewport to a desktop. Its strings
|
|
@@ -251,57 +252,48 @@ every App and MD UI reach data only through the client entry. In House,
|
|
|
251
252
|
`houseBridge().runtime` from `@agentshouse/app-bridge` resolves to the client House built
|
|
252
253
|
into the page. App code imports only types from `@agentshouse/mdruntime/client`, never
|
|
253
254
|
calls `connectMdRuntime` or `serveMdRuntime`, and never imports the package main, the host
|
|
254
|
-
entry or the Adapter package
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
A React App may observe and save through `@agentshouse/mdruntime/react`,
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
outside a component. An App that writes its Room Drafts itself saves them with
|
|
274
|
-
`saveWritten(room, roomDrafts)`, each named with the revision its last write returned: one
|
|
275
|
-
another tab wrote since is refused as `stale`, and nothing is saved. A react-admin or
|
|
276
|
-
Refine App uses the data providers of `@agentshouse/mdruntime-families`.
|
|
255
|
+
entry or the Adapter package; the in-memory Adapter at `@agentshouse/mdruntime/memory` is
|
|
256
|
+
for tests and ships in no bundle. A Site's page fills its Entry Data Contract's
|
|
257
|
+
`{"$param": name}` arguments with `boundQuery` from `@agentshouse/mdruntime/entry`, as
|
|
258
|
+
House did for its HTML. While the Site prepares, a query a route's `interaction` names
|
|
259
|
+
answers from the entry's result when the page observes that descriptor, and every other
|
|
260
|
+
stays pending. House replaces its HTML with the page once its document changed after those
|
|
261
|
+
answers, or readiness is `ready`, and then held still for two animation frames, unless the
|
|
262
|
+
visitor uses the HTML: draw the route at once, never behind a placeholder. Before
|
|
263
|
+
readiness is `ready`, `push` loads a new page.
|
|
264
|
+
|
|
265
|
+
A React App may observe and save through `@agentshouse/mdruntime/react`, with React as a
|
|
266
|
+
peer dependency. `useObserve(client, topic, ...input)` takes the arguments of `observe`
|
|
267
|
+
and returns `{ state: 'loading' }` until the topic's first value arrives, then `{ state:
|
|
268
|
+
'ready', value }`, re-rendering on each change; a `null` client stays loading.
|
|
269
|
+
`useSave(client)` returns `busy`, the last `outcome` or `failure`, and `save(room,
|
|
270
|
+
parts)`, which saves through `saveParts` and rejects with a recorded failure.
|
|
271
|
+
`saveWritten(room, roomDrafts)` saves Room Drafts the App wrote, each named with the
|
|
272
|
+
revision its last write returned: one another tab wrote since is refused as `stale`, and
|
|
273
|
+
nothing is saved. React-admin and Refine Apps use `@agentshouse/mdruntime-families`.
|
|
277
274
|
|
|
278
275
|
## The Chat
|
|
279
276
|
|
|
280
|
-
`@agentshouse/mdruntime/chat` holds the Chat, one data layer for every App; add React as
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
`--chat-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
unset one keeps House's light or dark look. `mountChat(element, { client })` places it
|
|
294
|
-
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()`.
|
|
295
290
|
|
|
296
291
|
Mix `ChatMessageList` (`components` takes your `UserMessage` and `AssistantMessage`),
|
|
297
292
|
`ChatInput` and `ChatQuestionCard` with your own design inside a `ChatProvider`, or
|
|
298
|
-
compose assistant-ui's primitives there; `useChat()` gives `send`, the conversations,
|
|
299
|
-
|
|
300
|
-
`
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
An agent must never read the authorization, load code from a Room, call the Provider
|
|
307
|
-
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,GAAG;QACpD,QAAQ,CAAC,MAAM,EAAE;YAAE,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;SAAE,CAAC;KAClF,CAAC;IACF,QAAQ,CAAC,qBAAqB,EAAE,QAAQ,GAAG;QAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IACzE,QAAQ,CAAC,qB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F,CAAC;AAMJ,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,CAE3E;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,iBAAiB,EAAE,CAOvF;AAED,wBAAgB,WAAW,CACzB,SAAS,EAAE,cAAc,EACzB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,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
|
@@ -28,6 +28,7 @@ const APP_ACTS = {
|
|
|
28
28
|
'conversation.kill': mapped('conversations/kill', controlBody),
|
|
29
29
|
'conversation.markDone': mapped('conversations/done'),
|
|
30
30
|
'conversation.rename': mapped('conversations/rename'),
|
|
31
|
+
'conversation.retry': mapped('conversations/retry'),
|
|
31
32
|
'conversation.send': carried('conversations/send', sendAction),
|
|
32
33
|
'conversation.setOption': mapped('conversations/option'),
|
|
33
34
|
'feature.list': mapped('apps/features/read'),
|
|
@@ -61,6 +62,7 @@ export function declaredActions(routes) {
|
|
|
61
62
|
name: APP_NAMES.get(route) ?? route,
|
|
62
63
|
inputShape: {},
|
|
63
64
|
resultKind: 'house',
|
|
65
|
+
room: 'room_ref',
|
|
64
66
|
}));
|
|
65
67
|
}
|
|
66
68
|
export function houseAction(transport, request) {
|
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,EAIV,OAAO,EACP,aAAa,EAmBd,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,CAsjBpF"}
|
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) {
|
|
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);
|
|
148
148
|
}
|
|
149
149
|
function adopted(entry, outcome) {
|
|
150
150
|
if (outcome.kind !== 'accepted')
|
|
@@ -394,8 +394,11 @@ export function createAgentsHouseAdapter(options) {
|
|
|
394
394
|
async authorize() {
|
|
395
395
|
return options.authorize();
|
|
396
396
|
},
|
|
397
|
-
async discover(_authorization) {
|
|
398
|
-
const answer = await transport.door(DOOR_DISCOVER, {
|
|
397
|
+
async discover(_authorization, scope) {
|
|
398
|
+
const answer = await transport.door(DOOR_DISCOVER, {
|
|
399
|
+
prefixes: [...DISCOVER_PREFIXES],
|
|
400
|
+
...(scope === undefined ? {} : { rooms: scope.authorities }),
|
|
401
|
+
});
|
|
399
402
|
const failed = discoveryFailure(answer.status, answer.body);
|
|
400
403
|
if (failed !== null)
|
|
401
404
|
return failed;
|
|
@@ -404,16 +407,31 @@ export function createAgentsHouseAdapter(options) {
|
|
|
404
407
|
return { kind: 'transport-uncertainty' };
|
|
405
408
|
bounds = document.bounds;
|
|
406
409
|
const entries = trackedFrom(document);
|
|
407
|
-
|
|
410
|
+
const covered = scope === undefined
|
|
411
|
+
? null
|
|
412
|
+
: [
|
|
413
|
+
...new Set([
|
|
414
|
+
...[...tracked.values()]
|
|
415
|
+
.filter((entry) => scope.authorities.includes(entry.authority))
|
|
416
|
+
.map((entry) => entry.locator),
|
|
417
|
+
...entries.map((entry) => entry.locator),
|
|
418
|
+
]),
|
|
419
|
+
];
|
|
420
|
+
if (covered === null)
|
|
421
|
+
tracked.clear();
|
|
422
|
+
else
|
|
423
|
+
for (const locator of covered)
|
|
424
|
+
tracked.delete(locator);
|
|
408
425
|
for (const entry of entries)
|
|
409
426
|
tracked.set(entry.locator, entry);
|
|
410
427
|
for (const locator of handed.keys())
|
|
411
428
|
if (!tracked.has(locator))
|
|
412
429
|
handed.delete(locator);
|
|
413
|
-
notifications.track(
|
|
430
|
+
notifications.track([...tracked.values()]);
|
|
414
431
|
return {
|
|
415
|
-
...mapDiscovery(document, document.authorities.map((authority) => discoveredRoom(authority)), capabilities(document)),
|
|
432
|
+
...mapDiscovery(document, document.authorities.map((authority) => discoveredRoom(authority)), capabilities(document.actions, [...tracked.values()])),
|
|
416
433
|
member: document.member,
|
|
434
|
+
...(covered === null ? {} : { covered }),
|
|
417
435
|
};
|
|
418
436
|
},
|
|
419
437
|
async bootstrap(_authorization, request) {
|
package/dist/discovery.d.ts
CHANGED
|
@@ -18,11 +18,10 @@ export type HouseBounds = {
|
|
|
18
18
|
operation_retention_seconds: number;
|
|
19
19
|
};
|
|
20
20
|
export type HouseOperations = {
|
|
21
|
-
read: readonly string[];
|
|
22
|
-
sync: readonly string[];
|
|
23
21
|
write: readonly string[];
|
|
24
22
|
delete: readonly string[];
|
|
25
23
|
};
|
|
24
|
+
export type HouseReadLevel = 'mcp' | 'online' | 'local';
|
|
26
25
|
export type HouseModel = {
|
|
27
26
|
root: string;
|
|
28
27
|
paths: readonly string[];
|
|
@@ -35,6 +34,7 @@ export type HouseAuthority = LogPosition & {
|
|
|
35
34
|
houseModel: HouseModel | null;
|
|
36
35
|
managedReplication: 'admitted' | 'unavailable';
|
|
37
36
|
protectedPaths: readonly string[];
|
|
37
|
+
read: HouseReadLevel;
|
|
38
38
|
operations: HouseOperations;
|
|
39
39
|
};
|
|
40
40
|
export type HouseDiscoveryDocument = {
|
|
@@ -66,7 +66,7 @@ export declare function siteTracked(document: HouseSiteDiscovery): TrackedAuthor
|
|
|
66
66
|
export declare function trackedFrom(document: HouseDiscoveryDocument): TrackedAuthority[];
|
|
67
67
|
export declare function providerLimits(bounds: HouseBounds): readonly ProviderLimit[];
|
|
68
68
|
export declare function declaredRetention(bounds: HouseBounds): Retention;
|
|
69
|
-
export declare function capabilities(
|
|
69
|
+
export declare function capabilities(actions: HouseDiscoveryDocument['actions'], rooms: readonly Pick<TrackedAuthority, 'authority' | 'houseModel'>[]): readonly Capability[];
|
|
70
70
|
export declare function siteCapabilities(): readonly Capability[];
|
|
71
71
|
export declare function discoveredRoom(authority: HouseAuthority): DiscoveredRoom;
|
|
72
72
|
export declare function mapDiscovery(document: Pick<HouseDiscoveryDocument, 'bounds'>, rooms: readonly DiscoveredRoom[], declared: readonly Capability[]): Discovery;
|
package/dist/discovery.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,SAAS,EACT,MAAM,EACN,aAAa,EACb,SAAS,EACV,MAAM,wBAAwB,CAAC;AAEhC,OA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AChC,QAAQ,EAAE,SAAS,UAAU,EAAE,GAC9B,SAAS,CAQX"}
|
package/dist/discovery.js
CHANGED
|
@@ -17,7 +17,8 @@ const BOUND_KEYS = [
|
|
|
17
17
|
'change_retention_seconds',
|
|
18
18
|
'operation_retention_seconds',
|
|
19
19
|
];
|
|
20
|
-
const OPERATION_KEYS = ['
|
|
20
|
+
const OPERATION_KEYS = ['write', 'delete'];
|
|
21
|
+
const READ_LEVELS = ['mcp', 'online', 'local'];
|
|
21
22
|
function stringList(value) {
|
|
22
23
|
if (!Array.isArray(value))
|
|
23
24
|
return null;
|
|
@@ -85,7 +86,12 @@ function parseAuthority(value) {
|
|
|
85
86
|
const houseModel = parseHouseModel(held.house_model);
|
|
86
87
|
const protectedPaths = stringList(held.protected_paths);
|
|
87
88
|
const operations = parseOperations(held.operations);
|
|
88
|
-
|
|
89
|
+
const read = READ_LEVELS.find((level) => level === held.read);
|
|
90
|
+
if (at === null ||
|
|
91
|
+
houseModel === undefined ||
|
|
92
|
+
protectedPaths === null ||
|
|
93
|
+
read === undefined ||
|
|
94
|
+
operations === null)
|
|
89
95
|
return null;
|
|
90
96
|
if (typeof held.room_ref !== 'string' || held.room_ref.length === 0)
|
|
91
97
|
return null;
|
|
@@ -99,6 +105,7 @@ function parseAuthority(value) {
|
|
|
99
105
|
houseModel,
|
|
100
106
|
managedReplication: held.managed_replication,
|
|
101
107
|
protectedPaths,
|
|
108
|
+
read,
|
|
102
109
|
operations,
|
|
103
110
|
...at,
|
|
104
111
|
};
|
|
@@ -216,15 +223,15 @@ export function declaredRetention(bounds) {
|
|
|
216
223
|
refreshHorizon: bounds.change_retention_seconds,
|
|
217
224
|
};
|
|
218
225
|
}
|
|
219
|
-
export function capabilities(
|
|
220
|
-
const house =
|
|
226
|
+
export function capabilities(actions, rooms) {
|
|
227
|
+
const house = rooms.find((room) => room.houseModel !== null);
|
|
221
228
|
return [
|
|
222
229
|
{
|
|
223
230
|
name: PROVIDER_ACTIONS,
|
|
224
|
-
actions: declaredActions(
|
|
231
|
+
actions: declaredActions(actions),
|
|
225
232
|
...(house === undefined
|
|
226
233
|
? {}
|
|
227
|
-
: { conversationAgents: houseConversationAgents(house.
|
|
234
|
+
: { conversationAgents: houseConversationAgents(house.authority) }),
|
|
228
235
|
},
|
|
229
236
|
];
|
|
230
237
|
}
|
|
@@ -244,12 +251,14 @@ export function discoveredRoom(authority) {
|
|
|
244
251
|
handle: authority.roomHandle,
|
|
245
252
|
roomVersion: roomVersion(authority),
|
|
246
253
|
operations: {
|
|
247
|
-
read: [...authority.operations.read],
|
|
248
|
-
sync: [...authority.operations.sync],
|
|
249
254
|
write: [...authority.operations.write],
|
|
250
255
|
delete: [...authority.operations.delete],
|
|
251
256
|
},
|
|
252
|
-
replica: {
|
|
257
|
+
replica: {
|
|
258
|
+
selection: locator,
|
|
259
|
+
admission: authority.managedReplication,
|
|
260
|
+
offline: authority.read === 'online' ? 'locked' : 'open',
|
|
261
|
+
},
|
|
253
262
|
...(authority.houseModel === null
|
|
254
263
|
? {}
|
|
255
264
|
: { typedSelection: { roots: [...authority.houseModel.paths] } }),
|
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, HouseClosing,
|
|
3
|
+
export type { HouseByteAct, HouseByteTransfer, HouseBytesAnswer, HouseClosing, 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,YAAY,EACZ,
|
|
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,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
|
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,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,
|
|
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,CAwR1F"}
|
package/dist/site.js
CHANGED
|
@@ -18,8 +18,8 @@ function siteRoom(tracked) {
|
|
|
18
18
|
locator: tracked.locator,
|
|
19
19
|
handle: tracked.handle,
|
|
20
20
|
roomVersion: roomVersion(tracked),
|
|
21
|
-
operations: {
|
|
22
|
-
replica: { selection: tracked.locator, admission: 'admitted' },
|
|
21
|
+
operations: { write: [], delete: [] },
|
|
22
|
+
replica: { selection: tracked.locator, admission: 'admitted', offline: 'open' },
|
|
23
23
|
providerOwnedPaths: [],
|
|
24
24
|
};
|
|
25
25
|
}
|
|
@@ -270,7 +270,7 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
270
270
|
return [];
|
|
271
271
|
notifications.reach(entry.authority, at);
|
|
272
272
|
return [presented(entry.authority, at)];
|
|
273
|
-
})
|
|
273
|
+
}));
|
|
274
274
|
},
|
|
275
275
|
reopen: notifications.reopen,
|
|
276
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 {
|
|
3
|
+
import type { 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[]
|
|
14
|
+
send(rooms: readonly HouseHeldRoom[]): 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,
|
|
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;IAC5C,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,IAAI,CAAC;IAClD,MAAM,IAAI,IAAI,CAAC;IACf,KAAK,CAAC,WAAW,EAAE,SAAS,gBAAgB,EAAE,GAAG,IAAI,CAAC;IACtD,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,IAAI,CAAC;IAChD,OAAO,CACL,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,WAAW,EACjB,KAAK,CAAC,EAAE,YAAY,GACnB,mBAAmB,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,kBAAkB,CAAC;IAClC,WAAW,EAAE,iBAAiB,CAAC;CAChC,CAAC;AAmFF,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,GAAG,kBAAkB,CAqjB5F"}
|
package/dist/stream.js
CHANGED
|
@@ -15,6 +15,7 @@ function listedConversation(listed) {
|
|
|
15
15
|
created: listed.created_at,
|
|
16
16
|
finished: listed.finished_at,
|
|
17
17
|
outcome: listed.outcome,
|
|
18
|
+
waiting: listed.waiting,
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
21
|
function position(value) {
|
|
@@ -111,7 +112,10 @@ export function houseNotifications(transport, mode) {
|
|
|
111
112
|
event.kind === 'questions' ||
|
|
112
113
|
event.kind === 'process' ||
|
|
113
114
|
event.kind === 'commands' ||
|
|
114
|
-
event.kind === 'options'
|
|
115
|
+
event.kind === 'options' ||
|
|
116
|
+
event.kind === 'starting' ||
|
|
117
|
+
event.kind === 'link' ||
|
|
118
|
+
event.kind === 'deliveries') {
|
|
115
119
|
live.add(event.conversation);
|
|
116
120
|
}
|
|
117
121
|
for (const observer of conversationObservers)
|
|
@@ -157,6 +161,18 @@ export function houseNotifications(transport, mode) {
|
|
|
157
161
|
emitConversation({ kind: 'options', conversation, options: structuredClone(frame.options) });
|
|
158
162
|
return;
|
|
159
163
|
}
|
|
164
|
+
if (frame.type === 'starting') {
|
|
165
|
+
emitConversation({ kind: 'starting', conversation, step: frame.step });
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (frame.type === 'link') {
|
|
169
|
+
emitConversation({ kind: 'link', conversation, connected: frame.connected });
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (frame.type === 'deliveries') {
|
|
173
|
+
emitConversation({ kind: 'deliveries', conversation, unknown: [...frame.unknown] });
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
160
176
|
if (frame.type === 'interactions') {
|
|
161
177
|
emitConversation({
|
|
162
178
|
kind: 'questions',
|
|
@@ -353,7 +369,7 @@ export function houseNotifications(transport, mode) {
|
|
|
353
369
|
return;
|
|
354
370
|
}
|
|
355
371
|
if (frame.type === 'authority_changed') {
|
|
356
|
-
emit({ kind: 'authority-changed' });
|
|
372
|
+
emit({ kind: 'authority-changed', scope: { authorities: frame.rooms } });
|
|
357
373
|
return;
|
|
358
374
|
}
|
|
359
375
|
if (frame.type === 'conversations') {
|
|
@@ -372,6 +388,9 @@ export function houseNotifications(transport, mode) {
|
|
|
372
388
|
frame.type === 'process' ||
|
|
373
389
|
frame.type === 'commands' ||
|
|
374
390
|
frame.type === 'options' ||
|
|
391
|
+
frame.type === 'starting' ||
|
|
392
|
+
frame.type === 'link' ||
|
|
393
|
+
frame.type === 'deliveries' ||
|
|
375
394
|
frame.type === 'interactions' ||
|
|
376
395
|
frame.type === 'message') {
|
|
377
396
|
converse(frame);
|
|
@@ -467,7 +486,7 @@ export function houseNotifications(transport, mode) {
|
|
|
467
486
|
observers.delete(notify);
|
|
468
487
|
};
|
|
469
488
|
},
|
|
470
|
-
send(rooms
|
|
489
|
+
send(rooms) {
|
|
471
490
|
for (const room of rooms) {
|
|
472
491
|
const line = lines.get(room.authority);
|
|
473
492
|
const held = position(room.position);
|
|
@@ -482,7 +501,7 @@ export function houseNotifications(transport, mode) {
|
|
|
482
501
|
void loaded
|
|
483
502
|
.then(() => Promise.all(rooms.map(restored)))
|
|
484
503
|
.then((presented) => {
|
|
485
|
-
current.hold(presented, runtime
|
|
504
|
+
current.hold(presented, runtime);
|
|
486
505
|
for (const [index, room] of presented.entries()) {
|
|
487
506
|
if (room.position === rooms[index].position)
|
|
488
507
|
continue;
|
package/dist/transport.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ export type HouseListedConversation = {
|
|
|
58
58
|
created_at: string;
|
|
59
59
|
finished_at: string | null;
|
|
60
60
|
outcome: string | null;
|
|
61
|
+
waiting: boolean;
|
|
61
62
|
};
|
|
62
63
|
export type HouseStreamFrame = {
|
|
63
64
|
type: 'part';
|
|
@@ -82,6 +83,7 @@ export type HouseStreamFrame = {
|
|
|
82
83
|
expired: readonly string[];
|
|
83
84
|
} | {
|
|
84
85
|
type: 'authority_changed';
|
|
86
|
+
rooms: readonly string[];
|
|
85
87
|
} | ({
|
|
86
88
|
type: 'turn';
|
|
87
89
|
conversation_id: string;
|
|
@@ -94,6 +96,10 @@ export type HouseStreamFrame = {
|
|
|
94
96
|
type: 'interactions';
|
|
95
97
|
conversation_id: string;
|
|
96
98
|
interactions: readonly unknown[];
|
|
99
|
+
} | {
|
|
100
|
+
type: 'deliveries';
|
|
101
|
+
conversation_id: string;
|
|
102
|
+
unknown: readonly string[];
|
|
97
103
|
} | {
|
|
98
104
|
type: 'process';
|
|
99
105
|
conversation_id: string;
|
|
@@ -106,6 +112,14 @@ export type HouseStreamFrame = {
|
|
|
106
112
|
type: 'options';
|
|
107
113
|
conversation_id: string;
|
|
108
114
|
options: LiveFact<'options'>['options'];
|
|
115
|
+
} | {
|
|
116
|
+
type: 'starting';
|
|
117
|
+
conversation_id: string;
|
|
118
|
+
step: string | null;
|
|
119
|
+
} | {
|
|
120
|
+
type: 'link';
|
|
121
|
+
conversation_id: string;
|
|
122
|
+
connected: boolean;
|
|
109
123
|
} | {
|
|
110
124
|
type: 'conversations';
|
|
111
125
|
conversations: readonly HouseListedConversation[];
|
|
@@ -136,12 +150,8 @@ export type HouseHeldRoom = {
|
|
|
136
150
|
log_epoch: string;
|
|
137
151
|
carry?: HouseHeldCarry;
|
|
138
152
|
};
|
|
139
|
-
export type HouseDemand = {
|
|
140
|
-
rooms: readonly string[];
|
|
141
|
-
conversations: boolean;
|
|
142
|
-
};
|
|
143
153
|
export type HouseOpening = {
|
|
144
|
-
hold(rooms: readonly HouseHeldRoom[], runtime: string
|
|
154
|
+
hold(rooms: readonly HouseHeldRoom[], runtime: string): void;
|
|
145
155
|
received(authority: string, carry: string, index: number): void;
|
|
146
156
|
close(): void;
|
|
147
157
|
};
|
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,CAA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AM,IAAI,OAAO,CAAC;IAClB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC9C,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACpD,CAAC"}
|
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-c5c5ff2bcc92c",
|
|
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-c6636685d0c4b"
|
|
29
29
|
}
|
|
30
30
|
}
|