@agentshouse/mdruntime-adapter 0.1.0-cacce09fc82c6 → 0.1.0-cc2458c857b25
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 +44 -7
- package/dist/actions.d.ts +39 -1
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +103 -117
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +65 -41
- package/dist/gather.d.ts +1 -0
- package/dist/gather.d.ts.map +1 -1
- package/dist/gather.js +11 -6
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/model.d.ts +1 -0
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +8 -1
- package/dist/read.d.ts +5 -1
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +13 -32
- package/dist/refusal.d.ts +2 -5
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +4 -8
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +8 -2
- package/dist/transport.d.ts +2 -5
- package/dist/transport.d.ts.map +1 -1
- package/dist/write.d.ts +1 -0
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +25 -8
- package/package.json +4 -4
package/AGENTS.md
CHANGED
|
@@ -27,6 +27,8 @@ value whole and returns its unsubscribe, and `close()` ends the observation.
|
|
|
27
27
|
Closing the port ends every handle and rejects every pending call and
|
|
28
28
|
observation; a client that reconnects observes again.
|
|
29
29
|
|
|
30
|
+
`observe('agents')` answers every Agent a new conversation can go to, each
|
|
31
|
+
`{ identity, name }`, whether or not it has a conversation yet.
|
|
30
32
|
Each conversation the Provider's conversation list names is held complete in the
|
|
31
33
|
browser. `conversation.list()` and `observe('conversations')` answer each with its
|
|
32
34
|
Agent's identity and name, its name, created and finished times, last outcome and live
|
|
@@ -51,7 +53,9 @@ open one through the Provider Action that serves it.
|
|
|
51
53
|
|
|
52
54
|
Rooms, Query, Search, Observe, Types, Room Draft, Save, and Reached never
|
|
53
55
|
touch the network.
|
|
54
|
-
History and Call go to the Provider through the Adapter.
|
|
56
|
+
History and Call go to the Provider through the Adapter. Call takes the Action names
|
|
57
|
+
the Adapter declares; any other name answers `undeclared` without reaching the
|
|
58
|
+
Provider. A Call result whose
|
|
55
59
|
effect the Provider places in a Room carries `at`, that Room and Room Version;
|
|
56
60
|
`reached(room, roomVersion)` answers whether the Room's confirmed state has
|
|
57
61
|
reached it, and the MD Runtime keeps refreshing that Room until it has;
|
|
@@ -66,6 +70,13 @@ client is asynchronous. Results are detached snapshots. Nothing in this
|
|
|
66
70
|
surface returns the authorization, performs a request the App's code
|
|
67
71
|
composes, or exposes the browser store.
|
|
68
72
|
|
|
73
|
+
Every refusal and failure carries `code` and `retryable`: each Call and History answer
|
|
74
|
+
other than its result, a refused Save or Room Draft write, a returned Room Draft's
|
|
75
|
+
reason, a Room's refusal and the Connection Refusal, and every error a member rejects
|
|
76
|
+
with, beside its message. A Provider refusal carries the Provider's own `retryable`.
|
|
77
|
+
Every code and every value the API answers is open: handle one you do not know by its
|
|
78
|
+
`code` and `retryable`.
|
|
79
|
+
|
|
69
80
|
Read the deployment facts with `observe('deployment-facts')`. Interpret the
|
|
70
81
|
opaque value using the host's contract.
|
|
71
82
|
|
|
@@ -129,9 +140,9 @@ data:
|
|
|
129
140
|
over every match and ordered by `count` or a key. A sort or group takes only a
|
|
130
141
|
pointer that holds one value. `limit` bounds the Documents or the groups.
|
|
131
142
|
- **Results and errors.** A result carries no Room Version: read freshness from
|
|
132
|
-
Rooms and Sync Status. An invalid query fails with `
|
|
133
|
-
`unknown-type`, `unknown-field` or `wrong-kind`, naming where,
|
|
134
|
-
answers an empty result in its place.
|
|
143
|
+
Rooms and Sync Status. An invalid query fails with the `code`
|
|
144
|
+
`invalid-query`, `unknown-type`, `unknown-field` or `wrong-kind`, naming where,
|
|
145
|
+
and never answers an empty result in its place.
|
|
135
146
|
|
|
136
147
|
## Local Search rules
|
|
137
148
|
|
|
@@ -169,9 +180,9 @@ the current Room Draft; read it and write again.
|
|
|
169
180
|
|
|
170
181
|
Save takes one Room and the Room Drafts of it to save, each with its revision,
|
|
171
182
|
validates locally, and on success appends one Change Batch to that Room's
|
|
172
|
-
queue and removes those Room Drafts. It is refused
|
|
183
|
+
queue and removes those Room Drafts. It is refused with the `code` `stale`,
|
|
173
184
|
`changed-underneath` naming each part whose base no longer matches the visible
|
|
174
|
-
state, or
|
|
185
|
+
state, or a local validation rule, and then creates nothing and leaves every
|
|
175
186
|
Room Draft in place. A directory move or removal is a move or removal part on
|
|
176
187
|
each Document and binary link target beneath it, saved together.
|
|
177
188
|
|
|
@@ -191,6 +202,13 @@ it names; the MD Runtime retries the same Change Batch identity and payload and
|
|
|
191
202
|
never infers an outcome from transport uncertainty. The MD Runtime never
|
|
192
203
|
combines, reorders, or rebases.
|
|
193
204
|
|
|
205
|
+
On a Site, every Save stays in the visitor's browser. Write grants and
|
|
206
|
+
revisions do not refuse it, and its Pending Change shows in every query and
|
|
207
|
+
across reloads until the browser's storage is cleared. It is never sent:
|
|
208
|
+
`observe('queue', room)` shows it `local`, and Sync Status never waits on it.
|
|
209
|
+
Once the Room changes so that it no longer applies, it leaves the queue and
|
|
210
|
+
returns no Room Draft.
|
|
211
|
+
|
|
194
212
|
`observe('service-mode')` answers the Provider's Service
|
|
195
213
|
Mode, `open` or `write-halted`. While writes are halted, Save still succeeds,
|
|
196
214
|
its Change Batch waits unsent, and the queue is submitted in order once the
|
|
@@ -227,7 +245,7 @@ the network. Data lives only in the App Creator's browser and with the Provider.
|
|
|
227
245
|
## App code takes the client its host hands it and never constructs a Runtime
|
|
228
246
|
|
|
229
247
|
App code takes the client its host hands it: in House,
|
|
230
|
-
`
|
|
248
|
+
`houseBridge().runtime` from `@agentshouse/app-bridge` resolves to the
|
|
231
249
|
client House built into the page. It never constructs a Runtime or a client.
|
|
232
250
|
It imports only types from `@agentshouse/mdruntime/client`, does not call
|
|
233
251
|
`connectMdRuntime` or `serveMdRuntime`, and does not import the package main,
|
|
@@ -247,6 +265,25 @@ roomDrafts)` is that save outside a component. A react-admin or Refine App
|
|
|
247
265
|
reads and writes its Rooms through the data providers of
|
|
248
266
|
`@agentshouse/mdruntime-families`.
|
|
249
267
|
|
|
268
|
+
## The Chat
|
|
269
|
+
|
|
270
|
+
`@agentshouse/mdruntime/chat` holds the Chat: one data layer over the
|
|
271
|
+
conversations, the same for every App. React and `@assistant-ui/react` are
|
|
272
|
+
required peers of this entry, so every App that uses it adds React as a
|
|
273
|
+
dependency, also an App not written in React. Wrap your own assistant-ui
|
|
274
|
+
primitives in `<ChatProvider client={runtime} conversation={id} agent={agent}>`:
|
|
275
|
+
`conversation` is the one it opens, `null` for a new chat, `agent` the Agent a
|
|
276
|
+
new chat goes to, and `onOpen` hears each conversation it opens. Thread, Messages,
|
|
277
|
+
Composer, its attachments and the thread list run on it: sending with files, a
|
|
278
|
+
message sent mid-turn waiting in the queue, Stop, rename, Done as archive and
|
|
279
|
+
delete. `useChat()` gives the rest: `send`, through the same queue, the
|
|
280
|
+
conversations, the Agents, the open
|
|
281
|
+
questions to `answer`, the CLI's `options` to `choose` and `commands`, the queue
|
|
282
|
+
to `edit` or `unqueue`, `kill`, and each act's outcome. A sent message shows at
|
|
283
|
+
once until House keeps it, and the unsent text stays in the chat draft, the same
|
|
284
|
+
in every composer over that conversation. A secret
|
|
285
|
+
question is never answered here. Never replace its messages, sending or store.
|
|
286
|
+
|
|
250
287
|
## What an agent must never do
|
|
251
288
|
|
|
252
289
|
An agent must never read the authorization, load code from a Room, call the
|
package/dist/actions.d.ts
CHANGED
|
@@ -1,8 +1,46 @@
|
|
|
1
|
-
import { type AcceptedMessage, type ActionDeclaration, type ActionRequest, type ActionResult, type ConversationAgents } from '@agentshouse/mdruntime';
|
|
1
|
+
import { type AcceptedMessage, type ActionDeclaration, type ActionRequest, type ActionResult, type ConversationAgents, type ConversationHistories, type ConversationHistoryRequest, type FileDeclaration } from '@agentshouse/mdruntime';
|
|
2
2
|
import type { HouseDoorAnswer, HouseTransport } from './transport.js';
|
|
3
|
+
type Operated = {
|
|
4
|
+
readonly operation_id?: string;
|
|
5
|
+
};
|
|
6
|
+
type ConversationControl = Operated & {
|
|
7
|
+
readonly conversation: string;
|
|
8
|
+
};
|
|
9
|
+
type SentFile = FileDeclaration & {
|
|
10
|
+
readonly blob: Blob;
|
|
11
|
+
};
|
|
12
|
+
export type AppInputs = {
|
|
13
|
+
readonly 'conversation.answer': ConversationControl & {
|
|
14
|
+
readonly answer: {
|
|
15
|
+
readonly interaction_id: string;
|
|
16
|
+
readonly response: unknown;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
readonly 'conversation.create': Operated & {
|
|
20
|
+
readonly agent_id: string;
|
|
21
|
+
};
|
|
22
|
+
readonly 'conversation.delete': ConversationControl;
|
|
23
|
+
readonly 'conversation.history': ConversationHistoryRequest;
|
|
24
|
+
readonly 'conversation.interrupt': ConversationControl;
|
|
25
|
+
readonly 'conversation.kill': ConversationControl;
|
|
26
|
+
readonly 'conversation.send': ConversationControl & {
|
|
27
|
+
readonly text?: string;
|
|
28
|
+
readonly files?: readonly SentFile[];
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export type AppAnswers = {
|
|
32
|
+
readonly 'conversation.history': ConversationHistories;
|
|
33
|
+
};
|
|
34
|
+
export type AppAnswerAdditions = {
|
|
35
|
+
readonly 'conversation.send': {
|
|
36
|
+
readonly turn: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export declare const HOUSE_APP_ACTS: Readonly<Record<string, string>>;
|
|
3
40
|
export declare function houseConversationAgents(locator: string): ConversationAgents;
|
|
4
41
|
export declare function declaredActions(routes: readonly string[]): readonly ActionDeclaration[];
|
|
5
42
|
export declare function houseAction(transport: HouseTransport, request: ActionRequest): Promise<ActionResult>;
|
|
6
43
|
export declare function actionOutcome(answer: HouseDoorAnswer, name: string): ActionResult;
|
|
7
44
|
export declare function acceptedMessage(entry: unknown): AcceptedMessage | null;
|
|
45
|
+
export {};
|
|
8
46
|
//# sourceMappingURL=actions.d.ts.map
|
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,
|
|
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;KAA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|
|
4
4
|
const HISTORY_CONVERSATIONS = 64;
|
|
5
5
|
const OCTET_STREAM = 'application/octet-stream';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
function mapped(door, input = (given) => given) {
|
|
7
|
+
return {
|
|
8
|
+
door,
|
|
9
|
+
async carry(transport, given, name) {
|
|
10
|
+
return actionOutcome(await transport.door(`/door/${door}`, input(given)), name);
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function carried(door, carry) {
|
|
15
|
+
return {
|
|
16
|
+
door,
|
|
17
|
+
carry: (transport, input, name) => carry(transport, `/door/${door}`, input, name),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const APP_ACTS = {
|
|
21
|
+
'access.read': mapped('rooms/access/read'),
|
|
22
|
+
'conversation.answer': mapped('conversations/interaction/answer', answerBody),
|
|
23
|
+
'conversation.create': carried('conversations/create', createAction),
|
|
24
|
+
'conversation.delete': mapped('conversations/delete', controlBody),
|
|
25
|
+
'conversation.history': carried('conversations/history', historyAction),
|
|
26
|
+
'conversation.interrupt': mapped('conversations/interrupt', controlBody),
|
|
27
|
+
'conversation.kill': mapped('conversations/kill', controlBody),
|
|
28
|
+
'conversation.markDone': mapped('conversations/done'),
|
|
29
|
+
'conversation.rename': mapped('conversations/rename'),
|
|
30
|
+
'conversation.send': carried('conversations/send', sendAction),
|
|
31
|
+
'conversation.setOption': mapped('conversations/option'),
|
|
32
|
+
'feature.list': mapped('apps/features/read'),
|
|
33
|
+
'holder.list': mapped('apps/holders'),
|
|
34
|
+
'holder.ring': mapped('apps/ring'),
|
|
35
|
+
'member.list': mapped('rooms/members'),
|
|
36
|
+
'message.send': mapped('apps/messages/send'),
|
|
37
|
+
'processing.read': mapped('rooms/settings/processing/read'),
|
|
38
|
+
'record.list': mapped('records/read'),
|
|
39
|
+
'relay.read': mapped('apps/relay'),
|
|
40
|
+
'routine.list': mapped('routines/access'),
|
|
41
|
+
'routineAccess.list': mapped('routines/granted'),
|
|
42
|
+
'routineAllowance.list': mapped('routines/allowance'),
|
|
43
|
+
'routineRequest.list': mapped('routines/requests'),
|
|
44
|
+
'storage.read': mapped('storage/inventory'),
|
|
45
|
+
'trigger.list': mapped('triggers/read'),
|
|
46
|
+
'triggerOccurrence.list': mapped('triggers/fired'),
|
|
47
|
+
};
|
|
48
|
+
export const HOUSE_APP_ACTS = Object.fromEntries(Object.entries(APP_ACTS).map(([name, act]) => [name, act.door]));
|
|
49
|
+
const APP_NAMES = new Map(Object.entries(APP_ACTS).map(([name, act]) => [act.door, name]));
|
|
15
50
|
export function houseConversationAgents(locator) {
|
|
16
|
-
return { locator, type: 'house-agent', identity: 'agent', name: 'name' };
|
|
51
|
+
return { locator, type: 'house-agent', identity: 'agent', name: 'name', retired: 'retired' };
|
|
17
52
|
}
|
|
18
53
|
export function declaredActions(routes) {
|
|
19
|
-
const mapped = new Map([...CONVERSATION_ROUTES].map(([name, route]) => [route.slice('/door/'.length), name]));
|
|
20
54
|
return routes.map((route) => ({
|
|
21
|
-
name:
|
|
55
|
+
name: APP_NAMES.get(route) ?? route,
|
|
22
56
|
inputShape: {},
|
|
23
57
|
resultKind: 'house',
|
|
24
58
|
}));
|
|
25
59
|
}
|
|
26
60
|
export function houseAction(transport, request) {
|
|
27
|
-
if (request.name
|
|
28
|
-
return
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return attachAction(transport, request.input);
|
|
33
|
-
if (request.name === 'attachments/get')
|
|
34
|
-
return openAction(transport, request.input);
|
|
61
|
+
if (Object.hasOwn(APP_ACTS, request.name)) {
|
|
62
|
+
return APP_ACTS[request.name].carry(transport, request.input, request.name);
|
|
63
|
+
}
|
|
64
|
+
if (APP_NAMES.has(request.name))
|
|
65
|
+
return Promise.resolve(unimplemented(request.name));
|
|
35
66
|
const route = routeOf(request.name);
|
|
36
67
|
if (route === null)
|
|
37
68
|
return Promise.resolve(malformed());
|
|
38
69
|
return carry(transport, route, request.name, request.input);
|
|
39
70
|
}
|
|
40
71
|
function routeOf(name) {
|
|
41
|
-
const mapped = CONVERSATION_ROUTES.get(name);
|
|
42
|
-
if (mapped !== undefined)
|
|
43
|
-
return mapped;
|
|
44
72
|
const parts = name.split('/');
|
|
45
73
|
if (parts.some((part) => part === '.' || part === '..'))
|
|
46
74
|
return null;
|
|
@@ -62,51 +90,55 @@ function operationId(input) {
|
|
|
62
90
|
return text(input, 'operation_id') ?? changeBatchIdentity();
|
|
63
91
|
}
|
|
64
92
|
function malformed() {
|
|
65
|
-
return { kind: 'rejected', code: 'invalid_request', fields: {} };
|
|
93
|
+
return { kind: 'rejected', code: 'invalid_request', fields: {}, retryable: false };
|
|
66
94
|
}
|
|
67
|
-
function
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
95
|
+
function unimplemented(name) {
|
|
96
|
+
return { kind: 'rejected', code: 'action-unimplemented', fields: { name }, retryable: false };
|
|
97
|
+
}
|
|
98
|
+
function createBody(input) {
|
|
99
|
+
return { agent_id: text(input, 'agent_id'), operation_id: operationId(input) };
|
|
100
|
+
}
|
|
101
|
+
function controlBody(input) {
|
|
102
|
+
return { conversation_id: text(input, 'conversation'), operation_id: operationId(input) };
|
|
103
|
+
}
|
|
104
|
+
function answerBody(input) {
|
|
105
|
+
const nested = record(record(input).answer);
|
|
106
|
+
return {
|
|
107
|
+
conversation_id: text(input, 'conversation'),
|
|
108
|
+
operation_id: operationId(input),
|
|
109
|
+
interaction_id: text(nested, 'interaction_id'),
|
|
110
|
+
response: nested.response,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
async function createAction(transport, route, input, name) {
|
|
114
|
+
const outcome = actionOutcome(await transport.door(route, createBody(input)), name);
|
|
115
|
+
if (outcome.kind !== 'action')
|
|
116
|
+
return outcome;
|
|
117
|
+
const held = record(outcome.result);
|
|
118
|
+
const conversation = text(held, 'conversation_id');
|
|
119
|
+
return conversation === undefined ? outcome : { ...outcome, result: { ...held, conversation } };
|
|
86
120
|
}
|
|
87
121
|
function withTurn(body) {
|
|
88
122
|
const held = record(body);
|
|
89
123
|
const turn = text(held, 'message_id');
|
|
90
|
-
return turn === undefined
|
|
124
|
+
return turn === undefined
|
|
125
|
+
? body
|
|
126
|
+
: { ...held, turn };
|
|
91
127
|
}
|
|
92
128
|
export function actionOutcome(answer, name) {
|
|
93
129
|
if (answer.status === 401)
|
|
94
130
|
return { kind: 'revoked-authorization' };
|
|
95
131
|
const refusal = doorRefusal(answer.body);
|
|
96
|
-
if (refusal !== null)
|
|
97
|
-
return { kind: 'rejected',
|
|
98
|
-
}
|
|
132
|
+
if (refusal !== null)
|
|
133
|
+
return { kind: 'rejected', ...refusal };
|
|
99
134
|
if (answer.status === 404)
|
|
100
|
-
return
|
|
135
|
+
return unimplemented(name);
|
|
101
136
|
if (answer.status === 0 || answer.status >= 400)
|
|
102
137
|
return { kind: 'transport-uncertainty' };
|
|
103
|
-
if (name === 'conversation.send')
|
|
104
|
-
return { kind: 'action', result: withTurn(answer.body) };
|
|
105
138
|
return { kind: 'action', result: answer.body };
|
|
106
139
|
}
|
|
107
140
|
async function carry(transport, route, name, input) {
|
|
108
|
-
|
|
109
|
-
return actionOutcome(answer, name);
|
|
141
|
+
return actionOutcome(await transport.door(route, input), name);
|
|
110
142
|
}
|
|
111
143
|
function sendFile(entry) {
|
|
112
144
|
const file = record(entry);
|
|
@@ -176,12 +208,12 @@ function uploadGrant(entry) {
|
|
|
176
208
|
return null;
|
|
177
209
|
return { method: 'POST', operation: upload.operation, url: upload.url };
|
|
178
210
|
}
|
|
179
|
-
async function
|
|
180
|
-
const
|
|
181
|
-
if (!Array.isArray(
|
|
211
|
+
async function uploadFiles(transport, input, result, name) {
|
|
212
|
+
const sent = record(result).files;
|
|
213
|
+
if (!Array.isArray(sent) || sent.length === 0)
|
|
182
214
|
return null;
|
|
183
215
|
const files = Array.isArray(record(input).files) ? record(input).files : [];
|
|
184
|
-
for (const [index, entry] of
|
|
216
|
+
for (const [index, entry] of sent.entries()) {
|
|
185
217
|
const grant = uploadGrant(entry);
|
|
186
218
|
if (grant === 'absent')
|
|
187
219
|
continue;
|
|
@@ -189,81 +221,35 @@ async function uploadOriginals(transport, input, result) {
|
|
|
189
221
|
return malformed();
|
|
190
222
|
const bytes = index < files.length ? await fileBytes(files[index]) : null;
|
|
191
223
|
if (bytes === null) {
|
|
192
|
-
return {
|
|
224
|
+
return {
|
|
225
|
+
kind: 'rejected',
|
|
226
|
+
code: 'conversation_file_descriptor_required',
|
|
227
|
+
fields: {},
|
|
228
|
+
retryable: false,
|
|
229
|
+
};
|
|
193
230
|
}
|
|
194
231
|
const failed = delivered(await transport.transfer({
|
|
195
|
-
act: '
|
|
196
|
-
method: 'POST',
|
|
232
|
+
act: 'conversation_file_upload',
|
|
197
233
|
url: grant.url,
|
|
198
|
-
answer: 'json',
|
|
199
234
|
body: bytes,
|
|
200
235
|
operation: grant.operation,
|
|
201
|
-
}),
|
|
236
|
+
}), name);
|
|
202
237
|
if (failed !== null)
|
|
203
238
|
return failed;
|
|
204
239
|
}
|
|
205
240
|
return null;
|
|
206
241
|
}
|
|
207
|
-
async function
|
|
208
|
-
const { blob, ...descriptor } = record(input);
|
|
209
|
-
const bytes = await fileBytes({ blob });
|
|
210
|
-
if (bytes === null)
|
|
211
|
-
return malformed();
|
|
212
|
-
const answer = await transport.door('/door/attachments/upload', descriptor);
|
|
213
|
-
const outcome = actionOutcome(answer, 'attachments/upload');
|
|
214
|
-
if (outcome.kind !== 'action')
|
|
215
|
-
return outcome;
|
|
216
|
-
const grant = uploadGrant(outcome.result);
|
|
217
|
-
if (grant === 'absent')
|
|
218
|
-
return outcome;
|
|
219
|
-
if (grant === null)
|
|
220
|
-
return malformed();
|
|
221
|
-
const stored = await transport.transfer({
|
|
222
|
-
act: 'original_upload',
|
|
223
|
-
method: 'POST',
|
|
224
|
-
url: grant.url,
|
|
225
|
-
answer: 'json',
|
|
226
|
-
body: bytes,
|
|
227
|
-
operation: grant.operation,
|
|
228
|
-
});
|
|
229
|
-
return delivered(stored, 'attachments/upload') ?? { kind: 'action', result: stored.body };
|
|
230
|
-
}
|
|
231
|
-
async function openAction(transport, input) {
|
|
232
|
-
const answer = await transport.door('/door/attachments/get', input);
|
|
233
|
-
const outcome = actionOutcome(answer, 'attachments/get');
|
|
234
|
-
if (outcome.kind !== 'action')
|
|
235
|
-
return outcome;
|
|
236
|
-
const { download, ...opened } = record(outcome.result);
|
|
237
|
-
if (download === undefined)
|
|
238
|
-
return outcome;
|
|
239
|
-
const grant = record(download);
|
|
240
|
-
if (grant.method !== 'GET' || typeof grant.url !== 'string')
|
|
241
|
-
return malformed();
|
|
242
|
-
const read = await transport.transfer({
|
|
243
|
-
act: 'original_download',
|
|
244
|
-
method: 'GET',
|
|
245
|
-
url: grant.url,
|
|
246
|
-
answer: 'bytes',
|
|
247
|
-
});
|
|
248
|
-
const failed = delivered(read, 'attachments/get');
|
|
249
|
-
if (failed !== null)
|
|
250
|
-
return failed;
|
|
251
|
-
if (!(read.body instanceof Blob))
|
|
252
|
-
return { kind: 'transport-uncertainty' };
|
|
253
|
-
return { kind: 'action', result: { ...opened, blob: read.body } };
|
|
254
|
-
}
|
|
255
|
-
async function sendAction(transport, input) {
|
|
242
|
+
async function sendAction(transport, route, input, name) {
|
|
256
243
|
const body = sendBody(input);
|
|
257
244
|
if (body === null)
|
|
258
245
|
return malformed();
|
|
259
|
-
const
|
|
260
|
-
const outcome = actionOutcome(answer, 'conversation.send');
|
|
246
|
+
const outcome = actionOutcome(await transport.door(route, body), name);
|
|
261
247
|
if (outcome.kind !== 'action')
|
|
262
248
|
return outcome;
|
|
263
|
-
const uploaded = await
|
|
249
|
+
const uploaded = await uploadFiles(transport, input, outcome.result, name);
|
|
264
250
|
if (uploaded !== null)
|
|
265
251
|
return uploaded;
|
|
266
|
-
return outcome;
|
|
252
|
+
return { ...outcome, result: withTurn(outcome.result) };
|
|
267
253
|
}
|
|
268
254
|
function historyCursor(value) {
|
|
269
255
|
const acceptedAt = text(value, 'accepted_at');
|
|
@@ -329,17 +315,17 @@ function historyAsks(input) {
|
|
|
329
315
|
}
|
|
330
316
|
return asks;
|
|
331
317
|
}
|
|
332
|
-
async function historyAction(transport, input) {
|
|
318
|
+
async function historyAction(transport, route, input, name) {
|
|
333
319
|
const asks = historyAsks(input);
|
|
334
320
|
if (asks === null)
|
|
335
321
|
return malformed();
|
|
336
322
|
const histories = [];
|
|
337
323
|
for (let at = 0; at < asks.length; at += HISTORY_CONVERSATIONS) {
|
|
338
|
-
const answer = await transport.door(
|
|
324
|
+
const answer = await transport.door(route, {
|
|
339
325
|
conversations: asks.slice(at, at + HISTORY_CONVERSATIONS),
|
|
340
326
|
limit: HISTORY_PAGE,
|
|
341
327
|
});
|
|
342
|
-
const outcome = actionOutcome(answer,
|
|
328
|
+
const outcome = actionOutcome(answer, name);
|
|
343
329
|
if (outcome.kind !== 'action')
|
|
344
330
|
return outcome;
|
|
345
331
|
const answered = record(outcome.result).histories;
|
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,EAGV,OAAO,EACP,aAAa,EAWd,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,OAAO,EACP,aAAa,EAWd,MAAM,wBAAwB,CAAC;AAuChC,OAAO,EAOL,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,CAAA;CAAE,CAAC;AAwBjC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAuYpF"}
|
package/dist/adapter.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DISCOVER_PREFIXES, capabilities, discoveredRoom, mapDiscovery, parseDiscovery, trackedFrom, } from './discovery.js';
|
|
2
|
-
import {
|
|
3
|
-
import { gathered, selections } from './gather.js';
|
|
2
|
+
import { partModels, streamedModels, viewModels } from './model.js';
|
|
3
|
+
import { gathered, gatheredEach, selections } from './gather.js';
|
|
4
4
|
import { createSiteAdapter } from './site.js';
|
|
5
5
|
import { bootstrapOf, contentPrefixes, matchesScope, parseEnumeration, parseEnvelope, parseGrant, refreshFrom, viewOf, } from './read.js';
|
|
6
6
|
import { acceptedLinks, enumeratedLinks, heldLinks, scopeLinks, streamedLinks, } from './links.js';
|
|
@@ -28,14 +28,26 @@ export function createAgentsHouseAdapter(options) {
|
|
|
28
28
|
throw new Error('no Discovery declared the bounds');
|
|
29
29
|
return bounds;
|
|
30
30
|
}
|
|
31
|
-
async function bootstrappedRoom(envelope, entry) {
|
|
32
|
-
const scope = envelope.scopes.find((candidate) => matchesScope(candidate, entry));
|
|
31
|
+
async function bootstrappedRoom(envelope, scope, entry, continued) {
|
|
33
32
|
if (scope === undefined)
|
|
34
33
|
return { kind: 'room-not-readable', locator: entry.locator };
|
|
35
|
-
|
|
34
|
+
const next = envelope.next?.room === entry.authority ? envelope.next.path : null;
|
|
35
|
+
if (continued === null && next === null)
|
|
36
|
+
handed.set(entry.locator, scopeLinks(scope));
|
|
37
|
+
else
|
|
38
|
+
handed.delete(entry.locator);
|
|
36
39
|
notifications.reach(entry.authority, scope);
|
|
37
|
-
const
|
|
38
|
-
|
|
40
|
+
const seen = [
|
|
41
|
+
...(continued?.seen ?? []),
|
|
42
|
+
...entry.schemas.filter((schema) => scope.files.some((file) => file.path === schema)),
|
|
43
|
+
];
|
|
44
|
+
const models = await partModels(scope, entry, new Set(seen), next === null);
|
|
45
|
+
const continuation = next === null ? null : { after: next, seen };
|
|
46
|
+
return {
|
|
47
|
+
...bootstrapOf(scope),
|
|
48
|
+
...(models === undefined ? {} : { models }),
|
|
49
|
+
...(continuation === null ? {} : { pageToken: JSON.stringify(continuation) }),
|
|
50
|
+
};
|
|
39
51
|
}
|
|
40
52
|
async function enumeratedRoom(enumeration, ask) {
|
|
41
53
|
const view = viewOf(enumeration, ask.entry);
|
|
@@ -109,41 +121,54 @@ export function createAgentsHouseAdapter(options) {
|
|
|
109
121
|
return result;
|
|
110
122
|
return { ...result, at: { locator, roomVersion: roomVersion({ position, logEpoch }) } };
|
|
111
123
|
}
|
|
112
|
-
async function bundled(body) {
|
|
113
|
-
const grant = parseGrant(body);
|
|
114
|
-
if (grant === null)
|
|
115
|
-
return body;
|
|
116
|
-
if (grant.method !== 'GET')
|
|
117
|
-
return null;
|
|
118
|
-
const answer = await transport.transfer({
|
|
119
|
-
act: 'local_copy_bundle',
|
|
120
|
-
method: 'GET',
|
|
121
|
-
url: grant.url,
|
|
122
|
-
answer: 'json',
|
|
123
|
-
});
|
|
124
|
-
return answer.status === 200 ? answer.body : null;
|
|
125
|
-
}
|
|
126
124
|
function weight(entry) {
|
|
127
125
|
return contentPrefixes(entry).length;
|
|
128
126
|
}
|
|
129
|
-
async function bootstrapped(entries) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
127
|
+
async function bootstrapped(entries, answer) {
|
|
128
|
+
let open = entries.map((entry, ask) => ({ entry, ask }));
|
|
129
|
+
while (open.length > 0) {
|
|
130
|
+
const unreached = [];
|
|
131
|
+
for (const part of selections(open, ({ entry }) => weight(entry), declared().max_prefixes)) {
|
|
132
|
+
const answered = await transport.door(DOOR_BOOTSTRAP, {
|
|
133
|
+
prefixes: part.flatMap(({ entry }) => contentPrefixes(entry)),
|
|
134
|
+
});
|
|
135
|
+
const classified = part.map(({ entry }) => classifyDoor(answered.status, answered.body, entry.locator));
|
|
136
|
+
const envelope = classified[0] === null ? parseEnvelope(answered.body) : null;
|
|
137
|
+
for (const [index, asked] of part.entries()) {
|
|
138
|
+
const failure = classified[index];
|
|
139
|
+
if (failure !== null && failure !== undefined) {
|
|
140
|
+
answer(asked.ask, failure);
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
if (envelope === null) {
|
|
144
|
+
answer(asked.ask, UNCERTAIN_READ);
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
const scope = envelope.scopes.find((candidate) => matchesScope(candidate, asked.entry));
|
|
148
|
+
if (scope === undefined && envelope.next !== undefined) {
|
|
149
|
+
unreached.push(asked);
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
answer(asked.ask, await bootstrappedRoom(envelope, scope, asked.entry, null));
|
|
142
153
|
}
|
|
143
|
-
answers.push(failure);
|
|
144
154
|
}
|
|
155
|
+
open = unreached;
|
|
145
156
|
}
|
|
146
|
-
|
|
157
|
+
}
|
|
158
|
+
async function continuedBootstrap(entry, continued) {
|
|
159
|
+
const after = { room: entry.authority, path: continued.after };
|
|
160
|
+
const answered = await transport.door(DOOR_BOOTSTRAP, {
|
|
161
|
+
prefixes: contentPrefixes(entry),
|
|
162
|
+
after,
|
|
163
|
+
});
|
|
164
|
+
const failure = classifyDoor(answered.status, answered.body, entry.locator);
|
|
165
|
+
if (failure !== null)
|
|
166
|
+
return failure;
|
|
167
|
+
const envelope = parseEnvelope(answered.body);
|
|
168
|
+
if (envelope === null)
|
|
169
|
+
return UNCERTAIN_READ;
|
|
170
|
+
const scope = envelope.scopes.find((candidate) => matchesScope(candidate, entry));
|
|
171
|
+
return bootstrappedRoom(envelope, scope, entry, continued);
|
|
147
172
|
}
|
|
148
173
|
function layered(asks) {
|
|
149
174
|
const depths = new Map();
|
|
@@ -190,7 +215,7 @@ export function createAgentsHouseAdapter(options) {
|
|
|
190
215
|
}
|
|
191
216
|
return asks.map((ask) => answers.get(ask) ?? UNCERTAIN_READ);
|
|
192
217
|
}
|
|
193
|
-
const bootstrapTogether =
|
|
218
|
+
const bootstrapTogether = gatheredEach(bootstrapped);
|
|
194
219
|
const enumerateTogether = gathered(enumerated);
|
|
195
220
|
async function uploaded(head, changes, delta, bytes, entry, handed, keep) {
|
|
196
221
|
const paths = batchPaths(changes);
|
|
@@ -207,9 +232,7 @@ export function createAgentsHouseAdapter(options) {
|
|
|
207
232
|
return { outcome: UNCERTAIN };
|
|
208
233
|
const delivered = await transport.transfer({
|
|
209
234
|
act: 'authored_batch_upload',
|
|
210
|
-
method: 'POST',
|
|
211
235
|
url: grant.url,
|
|
212
|
-
answer: 'json',
|
|
213
236
|
body: `${grant.operation}\n${delta}`,
|
|
214
237
|
});
|
|
215
238
|
if (delivered.status !== 200)
|
|
@@ -261,8 +284,9 @@ export function createAgentsHouseAdapter(options) {
|
|
|
261
284
|
const entry = authorityFor(request.locator);
|
|
262
285
|
if (entry === undefined)
|
|
263
286
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
264
|
-
if (request.pageToken !== undefined)
|
|
265
|
-
return
|
|
287
|
+
if (request.pageToken !== undefined) {
|
|
288
|
+
return continuedBootstrap(entry, JSON.parse(request.pageToken));
|
|
289
|
+
}
|
|
266
290
|
return bootstrapTogether(entry);
|
|
267
291
|
},
|
|
268
292
|
async refresh(_authorization, request) {
|
package/dist/gather.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare function gatheredEach<A, R>(send: (asks: readonly A[], answer: (ask: number, result: R) => void) => Promise<void>): (ask: A) => Promise<R>;
|
|
1
2
|
export declare function gathered<A, R>(send: (asks: readonly A[]) => Promise<readonly R[]>): (ask: A) => Promise<R>;
|
|
2
3
|
export declare function selections<T>(items: readonly T[], weight: (item: T) => number, limit: number): readonly (readonly T[])[];
|
|
3
4
|
//# sourceMappingURL=gather.d.ts.map
|
package/dist/gather.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gather.d.ts","sourceRoot":"","sources":["../src/gather.ts"],"names":[],"mappings":"AAMA,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAC3B,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,KAAK,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,GAClD,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"gather.d.ts","sourceRoot":"","sources":["../src/gather.ts"],"names":[],"mappings":"AAMA,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,EAC/B,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,KAAK,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,GACpF,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAwBxB;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAC3B,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,KAAK,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,GAClD,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAMxB;AAED,wBAAgB,UAAU,CAAC,CAAC,EAC1B,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,EAC3B,KAAK,EAAE,MAAM,GACZ,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAgB3B"}
|
package/dist/gather.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
export function
|
|
1
|
+
export function gatheredEach(send) {
|
|
2
2
|
let held = [];
|
|
3
3
|
function flush() {
|
|
4
4
|
const taken = held;
|
|
5
5
|
held = [];
|
|
6
|
-
send(taken.map((entry) => entry.ask)
|
|
7
|
-
taken
|
|
8
|
-
|
|
9
|
-
});
|
|
10
|
-
}, (reason) => {
|
|
6
|
+
send(taken.map((entry) => entry.ask), (ask, result) => {
|
|
7
|
+
taken[ask]?.resolve(result);
|
|
8
|
+
}).catch((reason) => {
|
|
11
9
|
for (const entry of taken)
|
|
12
10
|
entry.reject(reason);
|
|
13
11
|
});
|
|
@@ -20,6 +18,13 @@ export function gathered(send) {
|
|
|
20
18
|
held.push({ ask, resolve, reject });
|
|
21
19
|
});
|
|
22
20
|
}
|
|
21
|
+
export function gathered(send) {
|
|
22
|
+
return gatheredEach(async (asks, answer) => {
|
|
23
|
+
(await send(asks)).forEach((result, ask) => {
|
|
24
|
+
answer(ask, result);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
23
28
|
export function selections(items, weight, limit) {
|
|
24
29
|
const parts = [];
|
|
25
30
|
let part = [];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { createAgentsHouseAdapter, type AgentsHouseAdapterOptions } from './adapter.js';
|
|
2
|
-
export
|
|
2
|
+
export { HOUSE_APP_ACTS } from './actions.js';
|
|
3
|
+
export type { HouseByteAct, HouseByteTransfer, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
|
|
3
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,YAAY,EACV,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,MAAM,cAAc,CAAC;AAC9C,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/model.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { RoomModels } from '@agentshouse/mdruntime';
|
|
|
2
2
|
import type { TrackedAuthority } from './discovery.js';
|
|
3
3
|
import { type HouseScope, type HouseView } from './read.js';
|
|
4
4
|
import type { HouseMode, HouseStreamEntry } from './transport.js';
|
|
5
|
+
export declare function partModels(scope: HouseScope, tracked: TrackedAuthority, seen: ReadonlySet<string>, final: boolean): Promise<RoomModels | undefined>;
|
|
5
6
|
export declare function scopeModels(scope: HouseScope, tracked: TrackedAuthority): Promise<RoomModels | undefined>;
|
|
6
7
|
export declare function viewModels(view: HouseView, tracked: TrackedAuthority): Promise<RoomModels | undefined>;
|
|
7
8
|
export declare function streamedModels(schemas: ReadonlyMap<string, HouseStreamEntry>, tracked: TrackedAuthority, mode: HouseMode): Promise<RoomModels | undefined>;
|
package/dist/model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE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,GAAG,SAAS,CAAC,CAEjC;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAcjC;AAED,wBAAgB,cAAc,CAC5B,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAC9C,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAWjC"}
|
package/dist/model.js
CHANGED
|
@@ -26,8 +26,15 @@ async function modelsOf(tracked, read) {
|
|
|
26
26
|
}
|
|
27
27
|
return models.collection === undefined && models.selection === undefined ? undefined : models;
|
|
28
28
|
}
|
|
29
|
+
export function partModels(scope, tracked, seen, final) {
|
|
30
|
+
return modelsOf(tracked, (schema) => {
|
|
31
|
+
if (scope.files.some((file) => file.path === schema))
|
|
32
|
+
return schemaOf(scope, schema);
|
|
33
|
+
return final && !seen.has(schema) ? ABSENT_SCHEMA : undefined;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
29
36
|
export function scopeModels(scope, tracked) {
|
|
30
|
-
return
|
|
37
|
+
return partModels(scope, tracked, new Set(), true);
|
|
31
38
|
}
|
|
32
39
|
export function viewModels(view, tracked) {
|
|
33
40
|
return modelsOf(tracked, (schema) => {
|
package/dist/read.d.ts
CHANGED
|
@@ -19,8 +19,13 @@ export type HouseScope = LogPosition & {
|
|
|
19
19
|
contents: readonly HouseContent[];
|
|
20
20
|
attachments?: readonly RoomAttachment[];
|
|
21
21
|
};
|
|
22
|
+
export type HouseCursor = {
|
|
23
|
+
room: string;
|
|
24
|
+
path: string | null;
|
|
25
|
+
};
|
|
22
26
|
export type HouseEnvelope = {
|
|
23
27
|
scopes: readonly HouseScope[];
|
|
28
|
+
next?: HouseCursor;
|
|
24
29
|
};
|
|
25
30
|
export type HouseGrant = {
|
|
26
31
|
method: 'GET';
|
|
@@ -61,7 +66,6 @@ export declare function headChange(held: {
|
|
|
61
66
|
readonly author?: unknown;
|
|
62
67
|
readonly created_at?: unknown;
|
|
63
68
|
}): HeadChange | undefined | null;
|
|
64
|
-
export declare function parseOriginals(value: unknown): readonly RoomAttachment[] | null;
|
|
65
69
|
export declare function parseEnvelope(body: unknown): HouseEnvelope | null;
|
|
66
70
|
export declare function parseSiteBootstrap(body: unknown): HouseScope | null;
|
|
67
71
|
export declare function parseEnumeration(body: unknown, mode: HouseMode): HouseEnumeration | null;
|
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,aAAa,EAEb,aAAa,EACb,cAAc,EACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAA6B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3E,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACpC,QAAQ,EAAE,SAAS,YAAY,EAAE,CAAC;IAClC,WAAW,CAAC,EAAE,SAAS,cAAc,EA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CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CAC/B,GAAG,UAAU,GAAG,SAAS,GAAG,IAAI,CAMhC;AA4DD,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,aAAa,GAAG,IAAI,CAYjE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAEnE;AAoCD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,GAAG,gBAAgB,GAAG,IAAI,CAuBxF;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,GAAG,UAAU,CA2B5E;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,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,CA+BnF"}
|
package/dist/read.js
CHANGED
|
@@ -51,30 +51,6 @@ export function headChange(held) {
|
|
|
51
51
|
function headed(head) {
|
|
52
52
|
return head === undefined ? {} : { head };
|
|
53
53
|
}
|
|
54
|
-
function parseOriginal(value) {
|
|
55
|
-
if (typeof value !== 'object' || value === null)
|
|
56
|
-
return null;
|
|
57
|
-
const { attachment, name, bytes, media_type: mediaType } = value;
|
|
58
|
-
if (typeof attachment !== 'string' || typeof name !== 'string')
|
|
59
|
-
return null;
|
|
60
|
-
if (typeof bytes !== 'number' || !Number.isSafeInteger(bytes) || bytes < 0)
|
|
61
|
-
return null;
|
|
62
|
-
if (mediaType !== null && typeof mediaType !== 'string')
|
|
63
|
-
return null;
|
|
64
|
-
return { reference: attachment, name, byteLength: bytes, mediaType, entry: value };
|
|
65
|
-
}
|
|
66
|
-
export function parseOriginals(value) {
|
|
67
|
-
if (!Array.isArray(value))
|
|
68
|
-
return null;
|
|
69
|
-
const attachments = [];
|
|
70
|
-
for (const entry of value) {
|
|
71
|
-
const attachment = parseOriginal(entry);
|
|
72
|
-
if (attachment === null)
|
|
73
|
-
return null;
|
|
74
|
-
attachments.push(attachment);
|
|
75
|
-
}
|
|
76
|
-
return attachments;
|
|
77
|
-
}
|
|
78
54
|
function declared(attachments) {
|
|
79
55
|
return attachments === undefined ? {} : { attachments };
|
|
80
56
|
}
|
|
@@ -132,10 +108,15 @@ function parseScope(value, mode) {
|
|
|
132
108
|
}
|
|
133
109
|
if (mode === 'site')
|
|
134
110
|
return { anchor: manifest.anchor, ...at, files, contents };
|
|
135
|
-
|
|
136
|
-
|
|
111
|
+
return { anchor: manifest.anchor, ...at, files, contents, attachments: [] };
|
|
112
|
+
}
|
|
113
|
+
function parseCursor(value) {
|
|
114
|
+
if (typeof value !== 'object' || value === null)
|
|
115
|
+
return null;
|
|
116
|
+
const { room, path } = value;
|
|
117
|
+
if (typeof room !== 'string' || (path !== null && typeof path !== 'string'))
|
|
137
118
|
return null;
|
|
138
|
-
return {
|
|
119
|
+
return { room, path };
|
|
139
120
|
}
|
|
140
121
|
export function parseEnvelope(body) {
|
|
141
122
|
if (typeof body !== 'object' || body === null)
|
|
@@ -149,7 +130,10 @@ export function parseEnvelope(body) {
|
|
|
149
130
|
return null;
|
|
150
131
|
scopes.push(scope);
|
|
151
132
|
}
|
|
152
|
-
|
|
133
|
+
if (!('next' in body) || body.next === undefined)
|
|
134
|
+
return { scopes };
|
|
135
|
+
const next = parseCursor(body.next);
|
|
136
|
+
return next === null ? null : { scopes, next };
|
|
153
137
|
}
|
|
154
138
|
export function parseSiteBootstrap(body) {
|
|
155
139
|
return parseScope(body, 'site');
|
|
@@ -219,10 +203,7 @@ export function parseEnumeration(body, mode) {
|
|
|
219
203
|
authorities.push({ authority: held.authority, ...at, changes });
|
|
220
204
|
continue;
|
|
221
205
|
}
|
|
222
|
-
|
|
223
|
-
if (attachments === null)
|
|
224
|
-
return null;
|
|
225
|
-
authorities.push({ authority: held.authority, ...at, changes, attachments });
|
|
206
|
+
authorities.push({ authority: held.authority, ...at, changes, attachments: [] });
|
|
226
207
|
}
|
|
227
208
|
return { authorities };
|
|
228
209
|
}
|
package/dist/refusal.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { AdapterFailure, DiscoverResult, ProviderRefusal, ScopedRefusal } from '@agentshouse/mdruntime';
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
export declare function doorRefusal(body: unknown): DoorRefusal | null;
|
|
6
|
-
export declare function scopedRefusal(locator: string, scope: ScopedRefusal['scope'], refusal: DoorRefusal): ScopedRefusal;
|
|
2
|
+
export declare function doorRefusal(body: unknown): ProviderRefusal | null;
|
|
3
|
+
export declare function scopedRefusal(locator: string, scope: ScopedRefusal['scope'], refusal: ProviderRefusal): ScopedRefusal;
|
|
7
4
|
export declare function classifyDoor(status: number, body: unknown, locator: string): AdapterFailure | null;
|
|
8
5
|
export declare function classifyRead(status: number, body: unknown, locator: string): AdapterFailure | {
|
|
9
6
|
kind: 'beyond-horizon';
|
package/dist/refusal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refusal.d.ts","sourceRoot":"","sources":["../src/refusal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,aAAa,EACd,MAAM,wBAAwB,CAAC;AAEhC,
|
|
1
|
+
{"version":3,"file":"refusal.d.ts","sourceRoot":"","sources":["../src/refusal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,aAAa,EACd,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAOjE;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,EAC7B,OAAO,EAAE,eAAe,GACvB,aAAa,CAEf;AAmBD,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,GACd,cAAc,GAAG,IAAI,CAMvB;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,GACd,cAAc,GAAG;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GAAG,IAAI,CAGpD;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAQrF"}
|
package/dist/refusal.js
CHANGED
|
@@ -6,11 +6,11 @@ export function doorRefusal(body) {
|
|
|
6
6
|
const error = body.error;
|
|
7
7
|
if (typeof error.code !== 'string')
|
|
8
8
|
return null;
|
|
9
|
-
const { code, ...fields } = error;
|
|
10
|
-
return { code, fields, retryable:
|
|
9
|
+
const { code, retryable, ...fields } = error;
|
|
10
|
+
return { code, fields, retryable: retryable === true };
|
|
11
11
|
}
|
|
12
12
|
export function scopedRefusal(locator, scope, refusal) {
|
|
13
|
-
return { kind: 'scoped-refusal', locator, scope,
|
|
13
|
+
return { kind: 'scoped-refusal', locator, scope, ...refusal };
|
|
14
14
|
}
|
|
15
15
|
function doorFailure(status, body) {
|
|
16
16
|
if (status === 0)
|
|
@@ -50,11 +50,7 @@ export function discoveryFailure(status, body) {
|
|
|
50
50
|
if (failure.kind === 'revoked-authorization')
|
|
51
51
|
return failure;
|
|
52
52
|
if (failure.kind === 'refused') {
|
|
53
|
-
return {
|
|
54
|
-
kind: 'contract-unavailable',
|
|
55
|
-
code: failure.refusal.code,
|
|
56
|
-
fields: failure.refusal.fields,
|
|
57
|
-
};
|
|
53
|
+
return { kind: 'contract-unavailable', ...failure.refusal };
|
|
58
54
|
}
|
|
59
55
|
return { kind: 'transport-uncertainty' };
|
|
60
56
|
}
|
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,EAMR,MAAM,wBAAwB,CAAC;AAsBhC,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAgCxB,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAMR,MAAM,wBAAwB,CAAC;AAsBhC,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAgCxB,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,GAAG,OAAO,CAwIxE"}
|
package/dist/site.js
CHANGED
|
@@ -74,6 +74,7 @@ export function createSiteAdapter(transport) {
|
|
|
74
74
|
return models === undefined ? answer : { ...answer, models };
|
|
75
75
|
}
|
|
76
76
|
return {
|
|
77
|
+
localSaves: true,
|
|
77
78
|
async authorize() {
|
|
78
79
|
return {};
|
|
79
80
|
},
|
|
@@ -114,7 +115,7 @@ export function createSiteAdapter(transport) {
|
|
|
114
115
|
return refreshed(entry, request.fromRoomVersion);
|
|
115
116
|
},
|
|
116
117
|
async mutate() {
|
|
117
|
-
return { kind: 'rejected', affected: {}, code: 'write-grant', fields: {} };
|
|
118
|
+
return { kind: 'rejected', affected: {}, code: 'write-grant', fields: {}, retryable: false };
|
|
118
119
|
},
|
|
119
120
|
async history() {
|
|
120
121
|
return { kind: 'no-history' };
|
|
@@ -127,7 +128,12 @@ export function createSiteAdapter(transport) {
|
|
|
127
128
|
},
|
|
128
129
|
async action(_authorization, request) {
|
|
129
130
|
if (request.name !== 'submit') {
|
|
130
|
-
return {
|
|
131
|
+
return {
|
|
132
|
+
kind: 'rejected',
|
|
133
|
+
code: 'action-unimplemented',
|
|
134
|
+
fields: { name: request.name },
|
|
135
|
+
retryable: false,
|
|
136
|
+
};
|
|
131
137
|
}
|
|
132
138
|
if (!transport.online())
|
|
133
139
|
return UNCERTAIN;
|
package/dist/transport.d.ts
CHANGED
|
@@ -14,15 +14,12 @@ export type HouseDoorAnswer = {
|
|
|
14
14
|
status: number;
|
|
15
15
|
body: unknown;
|
|
16
16
|
};
|
|
17
|
-
export type HouseByteAct = '
|
|
17
|
+
export type HouseByteAct = 'authored_batch_upload' | 'conversation_file_upload';
|
|
18
18
|
export type HouseByteBody = string | ArrayBuffer | Uint8Array;
|
|
19
|
-
export type HouseByteAnswer = 'json' | 'bytes';
|
|
20
19
|
export type HouseByteTransfer = {
|
|
21
20
|
act: HouseByteAct;
|
|
22
|
-
method: 'GET' | 'POST';
|
|
23
21
|
url: string;
|
|
24
|
-
|
|
25
|
-
body?: HouseByteBody;
|
|
22
|
+
body: HouseByteBody;
|
|
26
23
|
operation?: string;
|
|
27
24
|
};
|
|
28
25
|
export type HouseStreamEntry = {
|
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,K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EjF,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;AAeD,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,CAiDf"}
|
package/dist/write.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { headChange
|
|
1
|
+
import { headChange } from './read.js';
|
|
2
2
|
import { sha256Hex, textBytes } from './digest.js';
|
|
3
3
|
import { nativePath, roomLocalPath } from './map.js';
|
|
4
4
|
import { classifyDoor, doorRefusal, scopedRefusal } from './refusal.js';
|
|
@@ -175,7 +175,13 @@ export function mutationOutcome(status, body, locator, handle) {
|
|
|
175
175
|
if (refusal !== null && refusal.code === 'edit_conflict') {
|
|
176
176
|
const { current, ...fields } = refusal.fields;
|
|
177
177
|
const held = material(current, handle) ?? [];
|
|
178
|
-
return {
|
|
178
|
+
return {
|
|
179
|
+
kind: 'conflicted',
|
|
180
|
+
affected: affectedOf(held),
|
|
181
|
+
code: refusal.code,
|
|
182
|
+
fields,
|
|
183
|
+
retryable: refusal.retryable,
|
|
184
|
+
};
|
|
179
185
|
}
|
|
180
186
|
if (refusal !== null && status === 404) {
|
|
181
187
|
return scopedRefusal(locator, 'undisclosed', refusal);
|
|
@@ -185,14 +191,26 @@ export function mutationOutcome(status, body, locator, handle) {
|
|
|
185
191
|
if (refusal?.retryable === true &&
|
|
186
192
|
typeof reset === 'string' &&
|
|
187
193
|
classified?.kind === 'transport-uncertainty') {
|
|
188
|
-
return {
|
|
194
|
+
return {
|
|
195
|
+
kind: 'retryable-refusal',
|
|
196
|
+
code: refusal.code,
|
|
197
|
+
fields: refusal.fields,
|
|
198
|
+
retryable: true,
|
|
199
|
+
reset,
|
|
200
|
+
};
|
|
189
201
|
}
|
|
190
202
|
if (classified !== null && classified.kind !== 'scoped-refusal')
|
|
191
203
|
return classified;
|
|
192
204
|
if (classified !== null && status === 403)
|
|
193
205
|
return classified;
|
|
194
206
|
if (refusal !== null && status >= 400) {
|
|
195
|
-
return {
|
|
207
|
+
return {
|
|
208
|
+
kind: 'rejected',
|
|
209
|
+
affected: {},
|
|
210
|
+
code: refusal.code,
|
|
211
|
+
fields: refusal.fields,
|
|
212
|
+
retryable: refusal.retryable,
|
|
213
|
+
};
|
|
196
214
|
}
|
|
197
215
|
if (status !== 200 || typeof body !== 'object' || body === null) {
|
|
198
216
|
return { kind: 'transport-uncertainty' };
|
|
@@ -204,9 +222,6 @@ export function mutationOutcome(status, body, locator, handle) {
|
|
|
204
222
|
const contents = material(held.contents, handle);
|
|
205
223
|
if (contents === null)
|
|
206
224
|
return { kind: 'transport-uncertainty' };
|
|
207
|
-
const originals = parseOriginals(held.originals);
|
|
208
|
-
if (originals === null)
|
|
209
|
-
return { kind: 'transport-uncertainty' };
|
|
210
225
|
const documents = {};
|
|
211
226
|
const revisions = {};
|
|
212
227
|
const changes = {};
|
|
@@ -228,7 +243,7 @@ export function mutationOutcome(status, body, locator, handle) {
|
|
|
228
243
|
revisions,
|
|
229
244
|
changes,
|
|
230
245
|
removals: removals.sort(),
|
|
231
|
-
originals,
|
|
246
|
+
originals: [],
|
|
232
247
|
};
|
|
233
248
|
}
|
|
234
249
|
export function rejectedMapping(mapping) {
|
|
@@ -237,6 +252,7 @@ export function rejectedMapping(mapping) {
|
|
|
237
252
|
affected: {},
|
|
238
253
|
code: mapping.rule,
|
|
239
254
|
fields: { path: mapping.path },
|
|
255
|
+
retryable: false,
|
|
240
256
|
};
|
|
241
257
|
}
|
|
242
258
|
export function revisionBody(input) {
|
|
@@ -285,6 +301,7 @@ export function historyOutcome(status, body, locator, request) {
|
|
|
285
301
|
scope: 'content',
|
|
286
302
|
code: 'retained_history_unavailable',
|
|
287
303
|
fields: { path: request.path, revision: request.revision },
|
|
304
|
+
retryable: false,
|
|
288
305
|
};
|
|
289
306
|
}
|
|
290
307
|
if (typeof named.content !== 'string')
|
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-cc2458c857b25",
|
|
4
4
|
"description": "Agents House Adapter for the MD Runtime",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
16
|
"types": "./dist/index.d.ts",
|
|
17
|
-
"
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
18
|
},
|
|
19
19
|
"./package.json": "./package.json"
|
|
20
20
|
},
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"LICENSE"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@agentshouse/mdmodel": "0.1.0-
|
|
29
|
-
"@agentshouse/mdruntime": "0.1.0-
|
|
28
|
+
"@agentshouse/mdmodel": "0.1.0-c4d2418e88679",
|
|
29
|
+
"@agentshouse/mdruntime": "0.1.0-cf24798931067"
|
|
30
30
|
}
|
|
31
31
|
}
|