@agentshouse/mdruntime-adapter 0.1.0-c258826147319 → 0.1.0-c26778ef7ace3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/README.md +3 -3
  2. package/dist/actions.d.ts +8 -6
  3. package/dist/actions.d.ts.map +1 -1
  4. package/dist/actions.js +54 -327
  5. package/dist/adapter.d.ts +1 -1
  6. package/dist/adapter.d.ts.map +1 -1
  7. package/dist/adapter.js +305 -228
  8. package/dist/authored-path.d.ts +66 -0
  9. package/dist/authored-path.d.ts.map +1 -0
  10. package/dist/authored-path.js +166 -0
  11. package/dist/chunks.d.ts +36 -0
  12. package/dist/chunks.d.ts.map +1 -0
  13. package/dist/chunks.js +281 -0
  14. package/dist/digest.d.ts +0 -1
  15. package/dist/discovery.d.ts +46 -20
  16. package/dist/discovery.d.ts.map +1 -1
  17. package/dist/discovery.js +265 -67
  18. package/dist/history.d.ts +6 -0
  19. package/dist/history.d.ts.map +1 -0
  20. package/dist/history.js +85 -0
  21. package/dist/index.d.ts +10 -3
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +9 -1
  24. package/dist/map.d.ts +0 -1
  25. package/dist/model.d.ts +6 -6
  26. package/dist/model.d.ts.map +1 -1
  27. package/dist/model.js +35 -38
  28. package/dist/read.d.ts +55 -48
  29. package/dist/read.d.ts.map +1 -1
  30. package/dist/read.js +209 -265
  31. package/dist/refusal.d.ts +9 -11
  32. package/dist/refusal.d.ts.map +1 -1
  33. package/dist/refusal.js +54 -27
  34. package/dist/renamed.d.ts +10 -0
  35. package/dist/renamed.d.ts.map +1 -0
  36. package/dist/renamed.js +29 -0
  37. package/dist/room-query.d.ts +4 -0
  38. package/dist/room-query.d.ts.map +1 -0
  39. package/dist/room-query.js +58 -0
  40. package/dist/search.d.ts +4 -0
  41. package/dist/search.d.ts.map +1 -0
  42. package/dist/search.js +47 -0
  43. package/dist/session-content/check.d.ts +17 -0
  44. package/dist/session-content/index.d.ts +6 -0
  45. package/dist/session-content/parts.d.ts +30 -0
  46. package/dist/session-content/state.d.ts +59 -0
  47. package/dist/session-content/turn.d.ts +137 -0
  48. package/dist/site.d.ts +1 -2
  49. package/dist/site.d.ts.map +1 -1
  50. package/dist/site.js +152 -107
  51. package/dist/space-schema.d.ts +6 -0
  52. package/dist/space-schema.d.ts.map +1 -0
  53. package/dist/space-schema.js +11 -0
  54. package/dist/stream.d.ts +14 -13
  55. package/dist/stream.d.ts.map +1 -1
  56. package/dist/stream.js +277 -149
  57. package/dist/transport.d.ts +125 -31
  58. package/dist/transport.d.ts.map +1 -1
  59. package/dist/transport.js +91 -10
  60. package/dist/uncertain.d.ts +5 -0
  61. package/dist/uncertain.d.ts.map +1 -0
  62. package/dist/uncertain.js +11 -0
  63. package/dist/upload.d.ts +17 -0
  64. package/dist/upload.d.ts.map +1 -0
  65. package/dist/upload.js +106 -0
  66. package/dist/version.d.ts +1 -1
  67. package/dist/version.d.ts.map +1 -1
  68. package/dist/version.js +1 -1
  69. package/dist/write.d.ts +18 -11
  70. package/dist/write.d.ts.map +1 -1
  71. package/dist/write.js +178 -71
  72. package/package.json +11 -7
  73. package/AGENTS.md +0 -232
  74. package/dist/gather.d.ts +0 -3
  75. package/dist/gather.d.ts.map +0 -1
  76. package/dist/gather.js +0 -40
  77. package/dist/links.d.ts +0 -20
  78. package/dist/links.d.ts.map +0 -1
  79. package/dist/links.js +0 -104
package/README.md CHANGED
@@ -20,12 +20,12 @@ import { createAgentsHouseAdapter } from '@agentshouse/mdruntime-adapter';
20
20
 
21
21
  const adapter = createAgentsHouseAdapter({ transport, authorize });
22
22
  const host = serveMdRuntime({ adapter, shell });
23
- host.attach(port, 'my-app');
23
+ host.attach(port, { app: 'my-app' });
24
24
  ```
25
25
 
26
26
  App code never imports this package; it reaches the Runtime only through the
27
- client its host hands it. The rules an App's agent follows are in the
28
- package's `AGENTS.md`.
27
+ client its host hands it. The rules an App's agent follows are the `apps/` pages
28
+ of House's Guide, which House's `guide` tool opens.
29
29
 
30
30
  ## License
31
31
 
package/dist/actions.d.ts CHANGED
@@ -1,8 +1,10 @@
1
- import { type AcceptedMessage, type ActionDeclaration, type ActionRequest, type ActionResult, type ConversationAgents } from '@agentshouse/mdruntime';
1
+ import type { ActionDeclaration, ActionRequest, ActionResult } from '@agentshouse/mdruntime';
2
2
  import type { HouseDoorAnswer, HouseTransport } from './transport.js';
3
- export declare const HOUSE_CONVERSATION_AGENTS: ConversationAgents;
3
+ export type HouseActDoor = Pick<HouseTransport, 'door'>;
4
+ export declare const HOUSE_UNKEPT_READS: readonly string[];
5
+ export declare const HOUSE_LEADING_READS: readonly string[];
6
+ export declare const HOUSE_RENAMED_UNTIL_2026_12_18: ReadonlyMap<string, string>;
7
+ export declare const HOUSE_REWRITTEN_UNTIL_2026_12_19: ReadonlyMap<string, (input: unknown) => unknown>;
4
8
  export declare function declaredActions(routes: readonly string[]): readonly ActionDeclaration[];
5
- export declare function houseAction(transport: HouseTransport, request: ActionRequest): Promise<ActionResult>;
6
- export declare function actionOutcome(answer: HouseDoorAnswer, name: string): ActionResult;
7
- export declare function acceptedMessage(entry: unknown): AcceptedMessage | null;
8
- //# sourceMappingURL=actions.d.ts.map
9
+ export declare function houseAction(transport: HouseActDoor, request: ActionRequest): Promise<ActionResult>;
10
+ export declare function actionOutcome(answer: HouseDoorAnswer, name: string, input: unknown): ActionResult;
@@ -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,EAGxB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAkBtE,eAAO,MAAM,yBAAyB,EAAE,kBAKvC,CAAC;AAEF,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,iBAAiB,EAAE,CASvF;AAED,wBAAgB,WAAW,CACzB,SAAS,EAAE,cAAc,EACzB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,CAQvB;AA4DD,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CAWjF;AAuLD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAUtE"}
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAI7F,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEtE,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;AAExD,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAI/C,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAIhD,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAErE,CAAC;AAQH,eAAO,MAAM,gCAAgC,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CACvD,CAAC;AAMxC,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,iBAAiB,EAAE,CAUvF;AAED,wBAAgB,WAAW,CACzB,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,CAIvB;AAwBD,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,YAAY,CAajG"}
package/dist/actions.js CHANGED
@@ -1,50 +1,47 @@
1
- import { changeBatchIdentity, } from '@agentshouse/mdruntime';
2
- import { doorRefusal } from './refusal.js';
3
- import { PRIVATE_LOCATOR } from './transport.js';
4
- const HISTORY_PAGE = 100;
5
- const HISTORY_CONVERSATIONS = 64;
6
- const OCTET_STREAM = 'application/octet-stream';
7
- const CONVERSATION_ROUTES = new Map([
8
- ['conversation.create', '/door/conversations/create'],
9
- ['conversation.send', '/door/conversations/send'],
10
- ['conversation.answer', '/door/conversations/interaction/answer'],
11
- ['conversation.interrupt', '/door/conversations/interrupt'],
12
- ['conversation.kill', '/door/conversations/kill'],
13
- ['conversation.delete', '/door/conversations/delete'],
14
- ['conversation.history', '/door/conversations/history'],
1
+ import { answeredFailure, doorRefusal, resetOf } from './refusal.js';
2
+ import { movedPaths, renamedHandle } from './renamed.js';
3
+ import { refusedFor } from './uncertain.js';
4
+ export const HOUSE_UNKEPT_READS = [
5
+ 'account/security/read',
6
+ 'billing/read',
7
+ 'clients/last-use/list',
8
+ ];
9
+ export const HOUSE_LEADING_READS = [
10
+ 'apps/list',
11
+ 'sites/list',
12
+ 'rooms/members/list',
13
+ ];
14
+ export const HOUSE_RENAMED_UNTIL_2026_12_18 = new Map([
15
+ ['files/batch', 'update'],
16
+ ]);
17
+ function withoutRoomRef(input) {
18
+ if (typeof input !== 'object' || input === null || !('room_ref' in input))
19
+ return input;
20
+ const { room_ref: _room, ...paths } = input;
21
+ return paths;
22
+ }
23
+ export const HOUSE_REWRITTEN_UNTIL_2026_12_19 = new Map([['update', withoutRoomRef]]);
24
+ const ROOM_PATHS = new Map([
25
+ ['update', ['changes.path', 'changes.to', 'paths', 'mount']],
15
26
  ]);
16
- export const HOUSE_CONVERSATION_AGENTS = {
17
- locator: PRIVATE_LOCATOR,
18
- type: 'house-agent',
19
- identity: 'agent',
20
- name: 'name',
21
- };
22
27
  export function declaredActions(routes) {
23
- const mapped = new Map([...CONVERSATION_ROUTES].map(([name, route]) => [route.slice('/door/'.length), name]));
24
- return routes.map((route) => ({
25
- name: mapped.get(route) ?? route,
26
- inputShape: {},
27
- resultKind: 'house',
28
- }));
28
+ return routes.map((name) => {
29
+ const roomPaths = ROOM_PATHS.get(name);
30
+ return {
31
+ name,
32
+ inputShape: {},
33
+ resultKind: 'house',
34
+ ...(roomPaths === undefined ? { room: 'room_ref' } : { roomPaths }),
35
+ };
36
+ });
29
37
  }
30
38
  export function houseAction(transport, request) {
31
- if (request.name === 'conversation.send')
32
- return sendAction(transport, request.input);
33
- if (request.name === 'conversation.history')
34
- return historyAction(transport, request.input);
35
- if (request.name === 'attachments/upload')
36
- return attachAction(transport, request.input);
37
- if (request.name === 'attachments/get')
38
- return openAction(transport, request.input);
39
39
  const route = routeOf(request.name);
40
40
  if (route === null)
41
41
  return Promise.resolve(malformed());
42
42
  return carry(transport, route, request.name, request.input);
43
43
  }
44
44
  function routeOf(name) {
45
- const mapped = CONVERSATION_ROUTES.get(name);
46
- if (mapped !== undefined)
47
- return mapped;
48
45
  const parts = name.split('/');
49
46
  if (parts.some((part) => part === '.' || part === '..'))
50
47
  return null;
@@ -55,307 +52,37 @@ function routeOf(name) {
55
52
  return null;
56
53
  }
57
54
  }
58
- function record(value) {
59
- return typeof value === 'object' && value !== null ? value : {};
60
- }
61
- function text(value, name) {
62
- const held = record(value)[name];
63
- return typeof held === 'string' ? held : undefined;
64
- }
65
- function operationId(input) {
66
- return text(input, 'operation_id') ?? changeBatchIdentity();
67
- }
68
55
  function malformed() {
69
- return { kind: 'rejected', code: 'invalid_request', fields: {} };
56
+ return { kind: 'rejected', code: 'invalid_request', fields: {}, retryable: false };
70
57
  }
71
- function bodyOf(name, input) {
72
- if (name === 'conversation.create') {
73
- return { agent_id: text(input, 'agent_id'), operation_id: operationId(input) };
74
- }
75
- if (name === 'conversation.interrupt' ||
76
- name === 'conversation.kill' ||
77
- name === 'conversation.delete') {
78
- return { conversation_id: text(input, 'conversation'), operation_id: operationId(input) };
79
- }
80
- if (name === 'conversation.answer') {
81
- const nested = record(record(input).answer);
82
- return {
83
- conversation_id: text(input, 'conversation'),
84
- operation_id: operationId(input),
85
- interaction_id: text(nested, 'interaction_id'),
86
- response: nested.response,
87
- };
88
- }
89
- return input;
58
+ function unimplemented(name) {
59
+ return { kind: 'rejected', code: 'action-unimplemented', fields: { name }, retryable: false };
90
60
  }
91
- function withTurn(body) {
92
- const held = record(body);
93
- const turn = text(held, 'message_id');
94
- return turn === undefined ? body : { ...held, turn };
61
+ function numbered(input) {
62
+ return typeof input?.operation_id === 'string';
95
63
  }
96
- export function actionOutcome(answer, name) {
64
+ export function actionOutcome(answer, name, input) {
97
65
  if (answer.status === 401)
98
66
  return { kind: 'revoked-authorization' };
99
67
  const refusal = doorRefusal(answer.body);
68
+ if (refusal?.code === 'operation_contended' && numbered(input))
69
+ return refusedFor(refusal);
100
70
  if (refusal !== null) {
101
- return { kind: 'rejected', code: refusal.code, fields: refusal.fields };
71
+ const reset = resetOf(refusal);
72
+ return { kind: 'rejected', ...refusal, ...(reset === undefined ? {} : { reset }) };
102
73
  }
103
74
  if (answer.status === 404)
104
- return { kind: 'rejected', code: 'action-unimplemented', fields: { name } };
105
- if (answer.status === 0 || answer.status >= 400)
106
- return { kind: 'transport-uncertainty' };
107
- if (name === 'conversation.send')
108
- return { kind: 'action', result: withTurn(answer.body) };
75
+ return unimplemented(name);
76
+ if (answer.status === 0 || answer.status >= 400) {
77
+ return answeredFailure(answer.status, answer.body);
78
+ }
109
79
  return { kind: 'action', result: answer.body };
110
80
  }
111
81
  async function carry(transport, route, name, input) {
112
- const answer = await transport.door(route, bodyOf(name, input));
113
- return actionOutcome(answer, name);
114
- }
115
- function sendFile(entry) {
116
- const file = record(entry);
117
- const name = text(file, 'name');
118
- const bytes = file.byteLength;
119
- const sha256 = text(file, 'contentHash');
120
- if (name === undefined || typeof bytes !== 'number' || sha256 === undefined)
121
- return null;
122
- const mediaType = text(file, 'mediaType');
123
- const width = file.width;
124
- const height = file.height;
125
- return {
126
- name,
127
- media_type: mediaType !== undefined && mediaType.length > 0 ? mediaType : OCTET_STREAM,
128
- bytes,
129
- sha256,
130
- ...(typeof width === 'number' && typeof height === 'number'
131
- ? { dimensions: { width, height } }
132
- : {}),
133
- };
134
- }
135
- function sendFiles(input) {
136
- const files = record(input).files;
137
- if (files === undefined)
138
- return [];
139
- if (!Array.isArray(files))
140
- return null;
141
- const declared = [];
142
- for (const entry of files) {
143
- const file = sendFile(entry);
144
- if (file === null)
145
- return null;
146
- declared.push(file);
147
- }
148
- return declared;
149
- }
150
- function sendBody(input) {
151
- const files = sendFiles(input);
152
- if (files === null)
153
- return null;
154
- const textValue = text(input, 'text');
155
- return {
156
- conversation_id: text(input, 'conversation'),
157
- operation_id: operationId(input),
158
- ...(textValue !== undefined && textValue.length > 0 ? { text: textValue } : {}),
159
- ...(files.length === 0 ? {} : { files }),
160
- };
161
- }
162
- async function fileBytes(file) {
163
- const blob = record(file).blob;
164
- if (blob === undefined || typeof blob !== 'object' || blob === null)
165
- return null;
166
- if (!('arrayBuffer' in blob) || typeof blob.arrayBuffer !== 'function')
167
- return null;
168
- return new Uint8Array(await blob.arrayBuffer());
169
- }
170
- function delivered(answer, name) {
171
- return answer.status === 200 ? null : actionOutcome(answer, name);
172
- }
173
- function uploadGrant(entry) {
174
- if (!('upload' in record(entry)))
175
- return 'absent';
176
- const upload = record(record(entry).upload);
177
- if (upload.method !== 'POST')
178
- return null;
179
- if (typeof upload.operation !== 'string' || typeof upload.url !== 'string')
180
- return null;
181
- return { method: 'POST', operation: upload.operation, url: upload.url };
182
- }
183
- async function uploadOriginals(transport, input, result) {
184
- const originals = record(result).originals;
185
- if (!Array.isArray(originals) || originals.length === 0)
186
- return null;
187
- const files = Array.isArray(record(input).files) ? record(input).files : [];
188
- for (const [index, entry] of originals.entries()) {
189
- const grant = uploadGrant(entry);
190
- if (grant === 'absent')
191
- continue;
192
- if (grant === null)
193
- return malformed();
194
- const bytes = index < files.length ? await fileBytes(files[index]) : null;
195
- if (bytes === null) {
196
- return { kind: 'rejected', code: 'conversation_original_descriptor_required', fields: {} };
197
- }
198
- const failed = delivered(await transport.transfer({
199
- act: 'conversation_original_upload',
200
- method: 'POST',
201
- url: grant.url,
202
- answer: 'json',
203
- body: bytes,
204
- operation: grant.operation,
205
- }), 'conversation.send');
206
- if (failed !== null)
207
- return failed;
208
- }
209
- return null;
210
- }
211
- async function attachAction(transport, input) {
212
- const { blob, ...descriptor } = record(input);
213
- const bytes = await fileBytes({ blob });
214
- if (bytes === null)
215
- return malformed();
216
- const answer = await transport.door('/door/attachments/upload', descriptor);
217
- const outcome = actionOutcome(answer, 'attachments/upload');
218
- if (outcome.kind !== 'action')
219
- return outcome;
220
- const grant = uploadGrant(outcome.result);
221
- if (grant === 'absent')
222
- return outcome;
223
- if (grant === null)
224
- return malformed();
225
- const stored = await transport.transfer({
226
- act: 'original_upload',
227
- method: 'POST',
228
- url: grant.url,
229
- answer: 'json',
230
- body: bytes,
231
- operation: grant.operation,
232
- });
233
- return delivered(stored, 'attachments/upload') ?? { kind: 'action', result: stored.body };
234
- }
235
- async function openAction(transport, input) {
236
- const answer = await transport.door('/door/attachments/get', input);
237
- const outcome = actionOutcome(answer, 'attachments/get');
238
- if (outcome.kind !== 'action')
239
- return outcome;
240
- const { download, ...opened } = record(outcome.result);
241
- if (download === undefined)
242
- return outcome;
243
- const grant = record(download);
244
- if (grant.method !== 'GET' || typeof grant.url !== 'string')
245
- return malformed();
246
- const read = await transport.transfer({
247
- act: 'original_download',
248
- method: 'GET',
249
- url: grant.url,
250
- answer: 'bytes',
251
- });
252
- const failed = delivered(read, 'attachments/get');
253
- if (failed !== null)
254
- return failed;
255
- if (!(read.body instanceof Blob))
256
- return { kind: 'transport-uncertainty' };
257
- return { kind: 'action', result: { ...opened, blob: read.body } };
258
- }
259
- async function sendAction(transport, input) {
260
- const body = sendBody(input);
261
- if (body === null)
262
- return malformed();
263
- const answer = await transport.door('/door/conversations/send', body);
264
- const outcome = actionOutcome(answer, 'conversation.send');
265
- if (outcome.kind !== 'action')
266
- return outcome;
267
- const uploaded = await uploadOriginals(transport, input, outcome.result);
268
- if (uploaded !== null)
269
- return uploaded;
270
- return outcome;
271
- }
272
- function historyCursor(value) {
273
- const acceptedAt = text(value, 'accepted_at');
274
- const messageId = text(value, 'message_id');
275
- if (acceptedAt === undefined || messageId === undefined)
276
- return null;
277
- return { accepted_at: acceptedAt, message_id: messageId };
278
- }
279
- function position(cursor) {
280
- return JSON.stringify({ accepted_at: cursor.accepted_at, message_id: cursor.message_id });
281
- }
282
- function positionCursor(value) {
283
- try {
284
- return historyCursor(JSON.parse(value));
285
- }
286
- catch {
287
- return null;
288
- }
289
- }
290
- export function acceptedMessage(entry) {
291
- const cursor = historyCursor(entry);
292
- if (cursor === null)
293
- return null;
294
- return {
295
- identity: cursor.message_id,
296
- turn: text(entry, 'turn_id') ?? cursor.message_id,
297
- position: position(cursor),
298
- text: text(entry, 'text') ?? '',
299
- message: structuredClone(entry),
300
- };
301
- }
302
- function historyPage(entry) {
303
- const held = record(entry);
304
- const conversation = text(held, 'conversation_id');
305
- if (conversation === undefined || !Array.isArray(held.messages))
306
- return null;
307
- const messages = [];
308
- for (const one of held.messages) {
309
- const message = acceptedMessage(one);
310
- if (message === null)
311
- return null;
312
- messages.push(message);
313
- }
314
- const next = held.next === null || held.next === undefined ? undefined : historyCursor(held.next);
315
- if (next === null)
316
- return null;
317
- return { conversation, messages, ...(next === undefined ? {} : { next: position(next) }) };
318
- }
319
- function historyAsks(input) {
320
- const asked = record(input).conversations;
321
- if (!Array.isArray(asked) || asked.length === 0)
322
- return null;
323
- const asks = [];
324
- for (const entry of asked) {
325
- const conversationId = text(entry, 'conversation');
326
- if (conversationId === undefined)
327
- return null;
328
- const afterValue = text(entry, 'after');
329
- const after = afterValue === undefined ? undefined : positionCursor(afterValue);
330
- if (after === null)
331
- return null;
332
- asks.push({ conversation_id: conversationId, ...(after === undefined ? {} : { after }) });
333
- }
334
- return asks;
335
- }
336
- async function historyAction(transport, input) {
337
- const asks = historyAsks(input);
338
- if (asks === null)
339
- return malformed();
340
- const histories = [];
341
- for (let at = 0; at < asks.length; at += HISTORY_CONVERSATIONS) {
342
- const answer = await transport.door('/door/conversations/history', {
343
- conversations: asks.slice(at, at + HISTORY_CONVERSATIONS),
344
- limit: HISTORY_PAGE,
345
- });
346
- const outcome = actionOutcome(answer, 'conversation.history');
347
- if (outcome.kind !== 'action')
348
- return outcome;
349
- const answered = record(outcome.result).histories;
350
- if (!Array.isArray(answered))
351
- return { kind: 'transport-uncertainty' };
352
- for (const entry of answered) {
353
- const page = historyPage(entry);
354
- if (page === null)
355
- return { kind: 'transport-uncertainty' };
356
- histories.push(page);
357
- }
358
- }
359
- const result = { histories };
360
- return { kind: 'action', result };
82
+ const answered = actionOutcome(await transport.door(route, input), name, input);
83
+ const renamed = renamedHandle(answered);
84
+ if (renamed === null)
85
+ return answered;
86
+ const moved = movedPaths(input, renamed);
87
+ return actionOutcome(await transport.door(route, moved), name, moved);
361
88
  }
package/dist/adapter.d.ts CHANGED
@@ -5,6 +5,6 @@ export type AgentsHouseAdapterOptions = {
5
5
  authorize(): Promise<Authorization>;
6
6
  } | {
7
7
  site: HouseSiteTransport;
8
+ snapshot?: boolean;
8
9
  };
9
10
  export declare function createAgentsHouseAdapter(options: AgentsHouseAdapterOptions): Adapter;
10
- //# sourceMappingURL=adapter.d.ts.map
@@ -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;AAqChC,OAAO,EAQL,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;AAsBjC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CA0WpF"}
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,OAAO,EAIP,aAAa,EAkBd,MAAM,wBAAwB,CAAC;AAgChC,OAAO,EAIL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAoBxB,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;AAcrD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAwcpF"}