@agentshouse/mdruntime-adapter 0.1.0-c57d433251ca5 → 0.1.0-c5a778fb66fff

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 (54) hide show
  1. package/README.md +2 -2
  2. package/dist/actions.d.ts +3 -27
  3. package/dist/actions.d.ts.map +1 -1
  4. package/dist/actions.js +14 -108
  5. package/dist/adapter.d.ts.map +1 -1
  6. package/dist/adapter.js +162 -127
  7. package/dist/app-reference.d.ts +2 -0
  8. package/dist/app-reference.d.ts.map +1 -0
  9. package/dist/app-reference.js +2 -0
  10. package/dist/crockford.d.ts +4 -0
  11. package/dist/crockford.d.ts.map +1 -0
  12. package/dist/crockford.js +3 -0
  13. package/dist/discovery.d.ts +3 -8
  14. package/dist/discovery.d.ts.map +1 -1
  15. package/dist/discovery.js +13 -27
  16. package/dist/house-model.d.ts +2 -0
  17. package/dist/house-model.d.ts.map +1 -0
  18. package/dist/house-model.js +484 -0
  19. package/dist/index.d.ts +6 -1
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +6 -1
  22. package/dist/model.d.ts +5 -1
  23. package/dist/model.d.ts.map +1 -1
  24. package/dist/model.js +11 -13
  25. package/dist/part.d.ts +4 -2
  26. package/dist/part.d.ts.map +1 -1
  27. package/dist/part.js +15 -13
  28. package/dist/read.d.ts +28 -7
  29. package/dist/read.d.ts.map +1 -1
  30. package/dist/read.js +172 -95
  31. package/dist/room-types.d.ts +7 -0
  32. package/dist/room-types.d.ts.map +1 -0
  33. package/dist/room-types.js +125 -0
  34. package/dist/site.d.ts.map +1 -1
  35. package/dist/site.js +48 -55
  36. package/dist/stream.d.ts +1 -0
  37. package/dist/stream.d.ts.map +1 -1
  38. package/dist/stream.js +17 -2
  39. package/dist/transport.d.ts +11 -10
  40. package/dist/transport.d.ts.map +1 -1
  41. package/dist/transport.js +2 -1
  42. package/dist/upload.d.ts +12 -0
  43. package/dist/upload.d.ts.map +1 -0
  44. package/dist/upload.js +63 -0
  45. package/dist/write.d.ts.map +1 -1
  46. package/dist/write.js +13 -17
  47. package/package.json +8 -4
  48. package/AGENTS.md +0 -304
  49. package/dist/handed.d.ts +0 -15
  50. package/dist/handed.d.ts.map +0 -1
  51. package/dist/handed.js +0 -45
  52. package/dist/referrer.d.ts +0 -7
  53. package/dist/referrer.d.ts.map +0 -1
  54. package/dist/referrer.js +0 -33
package/README.md CHANGED
@@ -24,8 +24,8 @@ host.attach(port, '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 `open_guide` opens.
29
29
 
30
30
  ## License
31
31
 
package/dist/actions.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { type AcceptedMessage, type ActionDeclaration, type ActionRequest, type ActionResult, type ConversationAgents, type ConversationHistories, type ConversationHistoryRequest, type FileDeclaration } from '@agentshouse/mdruntime';
1
+ import { type AcceptedMessage, type ActionDeclaration, type ActionRequest, type ActionResult, type ConversationAgents, type ConversationHistories, type ConversationHistoryRequest } from '@agentshouse/mdruntime';
2
2
  import type { HouseDoorAnswer, HouseTransport } from './transport.js';
3
+ export declare const HISTORY_PAGE = 100;
3
4
  type Operated = {
4
5
  readonly operation_id?: string;
5
6
  };
@@ -7,10 +8,6 @@ type ConversationControl = Operated & {
7
8
  readonly conversation: string;
8
9
  };
9
10
  export type AppInputs = {
10
- readonly 'conversation.attach': FileDeclaration & {
11
- readonly room: string;
12
- readonly blob: Blob;
13
- };
14
11
  readonly 'conversation.answer': ConversationControl & {
15
12
  readonly answer: {
16
13
  readonly interaction_id: string;
@@ -19,6 +16,7 @@ export type AppInputs = {
19
16
  };
20
17
  readonly 'conversation.create': Operated & {
21
18
  readonly agent_id: string;
19
+ readonly replaces?: string;
22
20
  };
23
21
  readonly 'conversation.delete': ConversationControl;
24
22
  readonly 'conversation.history': ConversationHistoryRequest;
@@ -28,14 +26,8 @@ export type AppInputs = {
28
26
  readonly operation_id: string;
29
27
  readonly text: string;
30
28
  };
31
- readonly 'trigger.list': {
32
- readonly room_refs: readonly string[];
33
- };
34
29
  };
35
30
  export type AppAnswers = {
36
- readonly 'conversation.attach': {
37
- readonly path: string;
38
- };
39
31
  readonly 'conversation.history': ConversationHistories;
40
32
  };
41
33
  export type AppAnswerAdditions = {
@@ -45,22 +37,6 @@ export type AppAnswerAdditions = {
45
37
  readonly 'conversation.send': {
46
38
  readonly turn: string;
47
39
  };
48
- readonly 'record.list': {
49
- readonly attachments: readonly {
50
- readonly referrer: {
51
- readonly room_ref: string;
52
- readonly record: string;
53
- };
54
- }[];
55
- readonly records: readonly {
56
- readonly attachments: readonly {
57
- readonly referrer: {
58
- readonly room_ref: string;
59
- readonly record: string;
60
- };
61
- }[];
62
- }[];
63
- };
64
40
  };
65
41
  export declare const HOUSE_APP_ACTS: Readonly<Record<string, string>>;
66
42
  export declare const SITE_SUBMIT = "submit";
@@ -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;AAUtE,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,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,qBAAqB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changeBatchIdentity, } from '@agentshouse/mdruntime';
1
+ import { changeBatchIdentity, HISTORY_CONVERSATIONS, } from '@agentshouse/mdruntime';
2
2
  import { doorRefusal } from './refusal.js';
3
- const HISTORY_PAGE = 100;
4
- const HISTORY_CONVERSATIONS = 64;
5
- const TRIGGER_ROOMS = 100;
6
- const OCTET_STREAM = 'application/octet-stream';
3
+ export const HISTORY_PAGE = 100;
7
4
  function mapped(door, input = (given) => given) {
8
5
  return {
9
6
  door,
@@ -12,18 +9,16 @@ function mapped(door, input = (given) => given) {
12
9
  },
13
10
  };
14
11
  }
15
- function carried(door, carry, batched, room) {
12
+ function carried(door, carry, batched) {
16
13
  return {
17
14
  door,
18
15
  ...(batched === undefined ? {} : { batched }),
19
- ...(room === undefined ? {} : { room }),
20
16
  carry: (transport, input, name) => carry(transport, `/door/${door}`, input, name),
21
17
  };
22
18
  }
23
19
  const APP_ACTS = {
24
20
  'access.read': mapped('rooms/access/read'),
25
21
  'conversation.answer': mapped('conversations/interaction/answer', answerBody),
26
- 'conversation.attach': carried('conversations/attach', attachAction, undefined, 'room'),
27
22
  'conversation.create': carried('conversations/create', createAction),
28
23
  'conversation.delete': mapped('conversations/delete', controlBody),
29
24
  'conversation.history': carried('conversations/history', historyAction, ['conversations']),
@@ -37,17 +32,19 @@ const APP_ACTS = {
37
32
  'feature.list': mapped('apps/features/read'),
38
33
  'holder.list': mapped('apps/holders'),
39
34
  'holder.ring': mapped('apps/ring'),
35
+ 'inboxChat.assign': mapped('chats/assign'),
36
+ 'inboxChat.return': mapped('chats/return'),
37
+ 'inboxChat.takeControl': mapped('chats/take-control'),
40
38
  'member.list': mapped('rooms/members'),
41
39
  'message.send': mapped('apps/messages/send'),
42
40
  'processing.read': mapped('rooms/settings/processing/read'),
43
- 'record.list': carried('records/read', recordsAction),
41
+ 'record.list': mapped('records/read'),
44
42
  'relay.read': mapped('apps/relay'),
45
43
  'routine.list': mapped('routines/access'),
46
44
  'routineAccess.list': mapped('routines/granted'),
47
45
  'routineAllowance.list': mapped('routines/allowance'),
48
46
  'routineRequest.list': mapped('routines/requests'),
49
47
  'storage.read': mapped('storage/inventory'),
50
- 'trigger.list': carried('triggers/read', triggersAction, ['room_refs'], 'room_refs'),
51
48
  'triggerOccurrence.list': mapped('triggers/fired'),
52
49
  };
53
50
  export const HOUSE_APP_ACTS = Object.fromEntries(Object.entries(APP_ACTS).map(([name, act]) => [name, act.door]));
@@ -57,14 +54,13 @@ export const HOUSE_SITE_ACTS = {
57
54
  };
58
55
  export const HOUSE_APP_BATCHES = Object.fromEntries(Object.entries(APP_ACTS).flatMap(([name, act]) => act.batched === undefined ? [] : [[name, act.batched]]));
59
56
  const APP_NAMES = new Map(Object.entries(APP_ACTS).map(([name, act]) => [act.door, name]));
60
- const APP_ROOMS = new Map(Object.entries(APP_ACTS).flatMap(([name, act]) => act.room === undefined ? [] : [[name, act.room]]));
61
57
  export function houseConversationAgents(locator) {
62
58
  return { locator, type: 'house-agent', identity: 'agent', name: 'name', retired: 'retired' };
63
59
  }
64
60
  export function declaredActions(routes) {
65
61
  return routes.map((route) => {
66
62
  const name = APP_NAMES.get(route) ?? route;
67
- return { name, inputShape: {}, resultKind: 'house', room: APP_ROOMS.get(name) ?? 'room_ref' };
63
+ return { name, inputShape: {}, resultKind: 'house', room: 'room_ref' };
68
64
  });
69
65
  }
70
66
  export function houseAction(transport, request) {
@@ -106,7 +102,12 @@ function unimplemented(name) {
106
102
  return { kind: 'rejected', code: 'action-unimplemented', fields: { name }, retryable: false };
107
103
  }
108
104
  function createBody(input) {
109
- return { agent_id: text(input, 'agent_id'), operation_id: operationId(input) };
105
+ const replaces = text(input, 'replaces');
106
+ return {
107
+ agent_id: text(input, 'agent_id'),
108
+ operation_id: operationId(input),
109
+ ...(replaces === undefined ? {} : { replaces }),
110
+ };
110
111
  }
111
112
  function controlBody(input) {
112
113
  return { conversation_id: text(input, 'conversation'), operation_id: operationId(input) };
@@ -154,32 +155,6 @@ export function actionOutcome(answer, name) {
154
155
  return { kind: 'transport-uncertainty' };
155
156
  return { kind: 'action', result: answer.body };
156
157
  }
157
- function referredRecord(view, roomRef) {
158
- const held = record(view);
159
- if (roomRef === undefined || typeof held.record !== 'string' || !Array.isArray(held.attachments))
160
- return view;
161
- const referrer = {
162
- room_ref: roomRef,
163
- record: held.record,
164
- };
165
- return {
166
- ...held,
167
- attachments: held.attachments.map((attachment) => ({ ...record(attachment), referrer })),
168
- };
169
- }
170
- async function recordsAction(transport, route, input, name) {
171
- const outcome = actionOutcome(await transport.door(route, input), name);
172
- if (outcome.kind !== 'action')
173
- return outcome;
174
- const roomRef = text(input, 'room_ref');
175
- const read = record(outcome.result);
176
- return {
177
- ...outcome,
178
- result: Array.isArray(read.records)
179
- ? { ...read, records: read.records.map((view) => referredRecord(view, roomRef)) }
180
- : referredRecord(outcome.result, roomRef),
181
- };
182
- }
183
158
  async function carry(transport, route, name, input) {
184
159
  return actionOutcome(await transport.door(route, input), name);
185
160
  }
@@ -199,59 +174,6 @@ async function sendAction(transport, route, input, name) {
199
174
  return outcome;
200
175
  return { ...outcome, result: withTurn(outcome.result) };
201
176
  }
202
- function attachBody(input) {
203
- const room = text(input, 'room');
204
- const name = text(input, 'name');
205
- const sha256 = text(input, 'contentHash');
206
- const bytes = record(input).byteLength;
207
- if (room === undefined || name === undefined || sha256 === undefined)
208
- return null;
209
- if (typeof bytes !== 'number')
210
- return null;
211
- const mediaType = text(input, 'mediaType');
212
- return {
213
- room_ref: room,
214
- name,
215
- bytes,
216
- sha256,
217
- media_type: mediaType !== undefined && mediaType.length > 0 ? mediaType : OCTET_STREAM,
218
- };
219
- }
220
- function uploadGrant(answer) {
221
- const upload = record(record(answer).upload);
222
- if (upload.method !== 'POST')
223
- return null;
224
- if (typeof upload.operation !== 'string' || typeof upload.url !== 'string')
225
- return null;
226
- return { operation: upload.operation, url: upload.url };
227
- }
228
- async function attachAction(transport, route, input, name) {
229
- const body = attachBody(input);
230
- const blob = record(input).blob;
231
- if (body === null || !(blob instanceof Blob))
232
- return malformed();
233
- const outcome = actionOutcome(await transport.door(route, body), name);
234
- if (outcome.kind !== 'action')
235
- return outcome;
236
- const grant = uploadGrant(outcome.result);
237
- if (grant === null)
238
- return { kind: 'transport-uncertainty' };
239
- const sent = await transport.transfer({
240
- act: 'file_upload',
241
- url: grant.url,
242
- body: new Uint8Array(await blob.arrayBuffer()),
243
- operation: grant.operation,
244
- });
245
- if (sent.status !== 200) {
246
- const refusal = doorRefusal(sent.body);
247
- return refusal === null ? { kind: 'transport-uncertainty' } : { kind: 'rejected', ...refusal };
248
- }
249
- const path = text(sent.body, 'path');
250
- if (path === undefined)
251
- return { kind: 'transport-uncertainty' };
252
- const result = { path };
253
- return { kind: 'action', result };
254
- }
255
177
  function historyCursor(value) {
256
178
  const acceptedAt = text(value, 'accepted_at');
257
179
  const messageId = text(value, 'message_id');
@@ -316,22 +238,6 @@ function historyAsks(input) {
316
238
  }
317
239
  return asks;
318
240
  }
319
- async function triggersAction(transport, route, input, name) {
320
- const asked = record(input).room_refs;
321
- if (!Array.isArray(asked) || asked.length === 0)
322
- return malformed();
323
- const rooms = [];
324
- for (let at = 0; at < asked.length; at += TRIGGER_ROOMS) {
325
- const outcome = actionOutcome(await transport.door(route, { room_refs: asked.slice(at, at + TRIGGER_ROOMS) }), name);
326
- if (outcome.kind !== 'action')
327
- return outcome;
328
- const answered = record(outcome.result).rooms;
329
- if (!Array.isArray(answered))
330
- return { kind: 'transport-uncertainty' };
331
- rooms.push(...answered);
332
- }
333
- return { kind: 'action', result: { rooms } };
334
- }
335
241
  async function historyAction(transport, route, input, name) {
336
242
  const asks = historyAsks(input);
337
243
  if (asks === null)
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,OAAO,EACP,aAAa,EAkBd,MAAM,wBAAwB,CAAC;AA6ChC,OAAO,EASL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AA0BxB,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;AAuFrD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CA8mBpF"}
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,OAAO,EAGP,aAAa,EAkBd,MAAM,wBAAwB,CAAC;AA0ChC,OAAO,EAUL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AA0BxB,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;AAgFrD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAyqBpF"}