@agentshouse/mdruntime 0.1.0-c014edb0e9d9b → 0.1.0-c01d4615bfe46

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 (149) hide show
  1. package/README.md +16 -15
  2. package/dist/acceptance.d.ts.map +1 -1
  3. package/dist/acceptance.js +1 -20
  4. package/dist/act-lanes.d.ts +11 -14
  5. package/dist/act-lanes.d.ts.map +1 -1
  6. package/dist/act-lanes.js +53 -5
  7. package/dist/actions.d.ts +1 -0
  8. package/dist/actions.d.ts.map +1 -1
  9. package/dist/actions.js +88 -47
  10. package/dist/adapter.d.ts +20 -12
  11. package/dist/adapter.d.ts.map +1 -1
  12. package/dist/attached-model.d.ts +0 -1
  13. package/dist/attached-model.d.ts.map +1 -1
  14. package/dist/attached-model.js +0 -5
  15. package/dist/chat-types.d.ts +0 -2
  16. package/dist/chat-types.d.ts.map +1 -1
  17. package/dist/chat-types.js +0 -2
  18. package/dist/client.d.ts +6 -9
  19. package/dist/client.d.ts.map +1 -1
  20. package/dist/client.js +6 -5
  21. package/dist/compile.d.ts +2 -0
  22. package/dist/compile.d.ts.map +1 -1
  23. package/dist/compile.js +17 -4
  24. package/dist/connection.d.ts.map +1 -1
  25. package/dist/connection.js +5 -10
  26. package/dist/conversation-live.d.ts +13 -4
  27. package/dist/conversation-live.d.ts.map +1 -1
  28. package/dist/conversation-live.js +15 -6
  29. package/dist/conversation.d.ts +11 -3
  30. package/dist/conversation.d.ts.map +1 -1
  31. package/dist/conversation.js +201 -154
  32. package/dist/discovery.d.ts.map +1 -1
  33. package/dist/discovery.js +1 -4
  34. package/dist/durability.d.ts +1 -0
  35. package/dist/durability.d.ts.map +1 -1
  36. package/dist/durability.js +4 -0
  37. package/dist/entry.js +1 -1
  38. package/dist/expectation.d.ts +25 -14
  39. package/dist/expectation.d.ts.map +1 -1
  40. package/dist/expectation.js +51 -20
  41. package/dist/file.d.ts.map +1 -1
  42. package/dist/file.js +2 -1
  43. package/dist/host.d.ts +1 -0
  44. package/dist/host.d.ts.map +1 -1
  45. package/dist/host.js +8 -3
  46. package/dist/index.d.ts +5 -4
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +5 -4
  49. package/dist/install.d.ts +1 -1
  50. package/dist/install.d.ts.map +1 -1
  51. package/dist/install.js +4 -13
  52. package/dist/lifecycle.d.ts.map +1 -1
  53. package/dist/lifecycle.js +3 -5
  54. package/dist/locks.d.ts.map +1 -1
  55. package/dist/locks.js +0 -1
  56. package/dist/lost.d.ts.map +1 -1
  57. package/dist/lost.js +1 -2
  58. package/dist/media.d.ts.map +1 -1
  59. package/dist/media.js +6 -9
  60. package/dist/memory.d.ts +3 -1
  61. package/dist/memory.d.ts.map +1 -1
  62. package/dist/memory.js +20 -7
  63. package/dist/messages.d.ts +9 -2
  64. package/dist/messages.d.ts.map +1 -1
  65. package/dist/messages.js +15 -7
  66. package/dist/models.d.ts.map +1 -1
  67. package/dist/models.js +2 -5
  68. package/dist/observation.d.ts +3 -2
  69. package/dist/observation.d.ts.map +1 -1
  70. package/dist/observation.js +11 -5
  71. package/dist/opening.d.ts.map +1 -1
  72. package/dist/opening.js +3 -9
  73. package/dist/outcome.d.ts +4 -0
  74. package/dist/outcome.d.ts.map +1 -1
  75. package/dist/outcome.js +8 -2
  76. package/dist/overlay.d.ts +3 -0
  77. package/dist/overlay.d.ts.map +1 -1
  78. package/dist/overlay.js +8 -4
  79. package/dist/parts.d.ts +2 -9
  80. package/dist/parts.d.ts.map +1 -1
  81. package/dist/parts.js +6 -14
  82. package/dist/preparation.d.ts.map +1 -1
  83. package/dist/preparation.js +6 -12
  84. package/dist/queries.d.ts.map +1 -1
  85. package/dist/queries.js +19 -7
  86. package/dist/questions.d.ts +0 -5
  87. package/dist/questions.d.ts.map +1 -1
  88. package/dist/questions.js +0 -7
  89. package/dist/queue.d.ts +2 -2
  90. package/dist/queue.d.ts.map +1 -1
  91. package/dist/queue.js +25 -30
  92. package/dist/reach.d.ts.map +1 -1
  93. package/dist/reach.js +41 -15
  94. package/dist/react.d.ts +6 -11
  95. package/dist/react.d.ts.map +1 -1
  96. package/dist/react.js +22 -4
  97. package/dist/readiness.d.ts +1 -1
  98. package/dist/readiness.d.ts.map +1 -1
  99. package/dist/recovery.d.ts +3 -1
  100. package/dist/recovery.d.ts.map +1 -1
  101. package/dist/recovery.js +29 -7
  102. package/dist/refusal.d.ts.map +1 -1
  103. package/dist/refusal.js +1 -3
  104. package/dist/room-draft.d.ts +2 -2
  105. package/dist/room-draft.d.ts.map +1 -1
  106. package/dist/room-draft.js +26 -21
  107. package/dist/runtime.d.ts +0 -2
  108. package/dist/runtime.d.ts.map +1 -1
  109. package/dist/save.d.ts +1 -0
  110. package/dist/save.d.ts.map +1 -1
  111. package/dist/save.js +105 -55
  112. package/dist/saves.d.ts.map +1 -1
  113. package/dist/saves.js +3 -6
  114. package/dist/shown.d.ts +2 -1
  115. package/dist/shown.d.ts.map +1 -1
  116. package/dist/shown.js +18 -6
  117. package/dist/socket/lanes.d.ts +10 -3
  118. package/dist/socket/lanes.d.ts.map +1 -1
  119. package/dist/socket/lanes.js +29 -6
  120. package/dist/socket.d.ts +2 -3
  121. package/dist/socket.d.ts.map +1 -1
  122. package/dist/socket.js +2 -9
  123. package/dist/source.d.ts +0 -7
  124. package/dist/source.d.ts.map +1 -1
  125. package/dist/store/records.d.ts +8 -5
  126. package/dist/store/records.d.ts.map +1 -1
  127. package/dist/store/records.js +12 -3
  128. package/dist/store.d.ts +1 -1
  129. package/dist/store.d.ts.map +1 -1
  130. package/dist/stored.d.ts +1 -0
  131. package/dist/stored.d.ts.map +1 -1
  132. package/dist/stored.js +5 -5
  133. package/dist/surface.d.ts +4 -3
  134. package/dist/surface.d.ts.map +1 -1
  135. package/dist/surface.js +11 -12
  136. package/dist/sync.d.ts.map +1 -1
  137. package/dist/sync.js +5 -10
  138. package/dist/tables.d.ts +6 -3
  139. package/dist/tables.d.ts.map +1 -1
  140. package/dist/tables.js +34 -10
  141. package/dist/tallies.d.ts.map +1 -1
  142. package/dist/tallies.js +1 -2
  143. package/dist/wire.d.ts +12 -3
  144. package/dist/wire.d.ts.map +1 -1
  145. package/dist/wire.js +4 -1
  146. package/package.json +3 -3
  147. package/dist/log.d.ts +0 -6
  148. package/dist/log.d.ts.map +0 -1
  149. package/dist/log.js +0 -14
package/README.md CHANGED
@@ -12,14 +12,14 @@ npm install @agentshouse/mdruntime
12
12
 
13
13
  ## Entries
14
14
 
15
- | Entry | For |
16
- | ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
17
- | `@agentshouse/mdruntime/client` | The host's client: `connectMdRuntime(port)` |
18
- | `@agentshouse/mdruntime/host` | The host that serves a Runtime: `serveMdRuntime` |
19
- | `@agentshouse/mdruntime` | Shared types |
20
- | `@agentshouse/mdruntime/memory` | Tests: `createMemoryAdapter`, an in-memory Adapter |
21
- | `@agentshouse/mdruntime/tables` | The host's database: the Authored store's and opened files' tables, `answerRuntime` |
22
- | `@agentshouse/mdruntime/react` | React over the client: `useObserve`, `useSave`; `useReading`, a reader of an expectation store; `useLane`, a reader of an act lane |
15
+ | Entry | For |
16
+ | ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
17
+ | `@agentshouse/mdruntime/client` | The host's client: `connectMdRuntime(port)` |
18
+ | `@agentshouse/mdruntime/host` | The host that serves a Runtime: `serveMdRuntime` |
19
+ | `@agentshouse/mdruntime` | Shared types |
20
+ | `@agentshouse/mdruntime/memory` | Tests: `createMemoryAdapter`, an in-memory Adapter |
21
+ | `@agentshouse/mdruntime/tables` | The host's database: the Authored store's and opened files' tables, `answerRuntime` |
22
+ | `@agentshouse/mdruntime/react` | React over the client: `useObserve`, `useSave`; `useExpected`, a reader of an expectation store; `useLane`, a reader of an act lane |
23
23
 
24
24
  ## Usage
25
25
 
@@ -33,18 +33,19 @@ const rooms = await runtime.rooms();
33
33
  const notes = await runtime.query({ types: ['note'], select: 'all', limit: 20 });
34
34
  ```
35
35
 
36
- `observe('storage-loss')` reports `null` or the stable code
37
- `storage-loss` when unsynchronized Room Drafts and Pending Changes were lost.
38
- The host supplies the user-facing wording.
36
+ `observe('storage-loss')` reports `null`, the stable code `storage-loss` when
37
+ unsynchronized Room Drafts and Pending Changes were lost, or `visit` while the host holds
38
+ the database in memory, which ends with the visit; the readiness `persistence` answer is then
39
+ `memory`. The host supplies the user-facing wording.
39
40
 
40
41
  In House the bridge object the page holds as `window.houseBridge` places the Chat, which
41
- House serves with the page: install and bundle nothing for it. Mount it in an element,
42
- themed by CSS custom properties on that element, docked at a third of the window:
42
+ House serves with the page: install and bundle nothing for it. Mount it in an element it
43
+ fills, on one chat, themed by CSS custom properties on that element:
43
44
 
44
45
  ```ts
45
- const chat = await window.houseBridge.chat.mount(element, { width: '1/3', showChats: true });
46
+ const chat = await window.houseBridge.chat.mount(element, { conversation });
46
47
  element.style.setProperty('--chat-accent', '#2a6cf0');
47
- chat.update({ width: 'full', showChats: true });
48
+ chat.update({ conversation: null, agent });
48
49
  chat.unmount();
49
50
  ```
50
51
 
@@ -1 +1 @@
1
- {"version":3,"file":"acceptance.d.ts","sourceRoot":"","sources":["../src/acceptance.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAyX5C,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,QAK5D"}
1
+ {"version":3,"file":"acceptance.d.ts","sourceRoot":"","sources":["../src/acceptance.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AA0V5C,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,QAK5D"}
@@ -39,11 +39,6 @@ async function keepUpload({ socket, presence }, local, locator, identifier, uplo
39
39
  if (!socket.continuing())
40
40
  throw new Error();
41
41
  }
42
- function logAccepted({ journal }, locator, submitted, accepted) {
43
- journal.record(`outcome ${locator} ${submitted.id} accepted ${accepted.roomVersion}` +
44
- (accepted.author === undefined ? '' : ` author ${accepted.author}`) +
45
- (accepted.time === undefined ? '' : ` time ${accepted.time}`));
46
- }
47
42
  function restands(adoptions) {
48
43
  return adoptions.flatMap((one) => (one === null || !('record' in one) ? [] : [one]));
49
44
  }
@@ -55,7 +50,6 @@ async function adoption(runtime, room, current, local, submitted, accepted) {
55
50
  return null;
56
51
  }
57
52
  const held = current.record.roomVersion;
58
- logAccepted(runtime, room.locator, submitted, accepted);
59
53
  let record = current.record;
60
54
  let adopted;
61
55
  if (!socket.reads.reached(room.locator, held, accepted.roomVersion) &&
@@ -119,7 +113,7 @@ async function behindIn({ store }, locator, batch) {
119
113
  return room ? order.indexOf(batch.id) > 0 : order.length > 0;
120
114
  }
121
115
  async function submitRoom(runtime, room, local, authorized, progress, signal) {
122
- const { store, socket, presence, journal } = runtime;
116
+ const { store, socket, presence } = runtime;
123
117
  while (socket.continuing() &&
124
118
  socket.session.now().authorization !== undefined &&
125
119
  !signal.aborted) {
@@ -152,12 +146,10 @@ async function submitRoom(runtime, room, local, authorized, progress, signal) {
152
146
  }
153
147
  if (socket.writesHeld()) {
154
148
  progress.complete = false;
155
- journal.record(`submission ${room.locator} ${head.id} held`);
156
149
  return 'done';
157
150
  }
158
151
  const lost = earlier || submission.state === 'submitted';
159
152
  let result;
160
- journal.record(`submission ${room.locator} ${head.id}`);
161
153
  await store.exclusive(() => mark(runtime, local, room.locator, head, { state: 'submitted' }, lost));
162
154
  if (socket.session.now().paused || presence.lost(room.locator))
163
155
  return 'done';
@@ -166,7 +158,6 @@ async function submitRoom(runtime, room, local, authorized, progress, signal) {
166
158
  if (signal.aborted)
167
159
  return 'done';
168
160
  progress.complete = false;
169
- journal.record(`submission ${room.locator} ${head.id} held`);
170
161
  return 'done';
171
162
  }
172
163
  const opensBefore = socket.session.now().openSignals;
@@ -223,7 +214,6 @@ async function submitRoom(runtime, room, local, authorized, progress, signal) {
223
214
  return 'done';
224
215
  }
225
216
  if (result.kind === 'write-halted') {
226
- journal.record(`outcome ${room.locator} ${head.id} write-halted`);
227
217
  await store.exclusive(() => mark(runtime, local, room.locator, head, { state: 'waiting' }, lost));
228
218
  if (!socket.haltedSince(opensBefore))
229
219
  continue;
@@ -231,15 +221,6 @@ async function submitRoom(runtime, room, local, authorized, progress, signal) {
231
221
  return 'done';
232
222
  }
233
223
  const other = partner === null ? undefined : presence.room(partner);
234
- if (result.kind === 'conflicted' ||
235
- result.kind === 'rejected' ||
236
- result.kind === 'retryable-refusal') {
237
- journal.record(`outcome ${room.locator} ${head.id} ${result.kind}` +
238
- (result.kind === 'conflicted' && result.roomVersion !== undefined
239
- ? ` ${result.roomVersion}`
240
- : ''));
241
- journal.record(`refusal ${result.kind} ${result.code}`);
242
- }
243
224
  if (result.kind === 'retryable-refusal') {
244
225
  runtime.retries.failed('sending', submitting(room.locator), refusalError(result));
245
226
  const reset = result.reset;
@@ -1,33 +1,30 @@
1
- import { type ExpectedOf, type Expecting } from './expectation.js';
1
+ import { type Expected, type Expecting } from './expectation.js';
2
2
  export type Ended = 'accepted' | 'refused' | 'unanswered' | 'unsent';
3
- type Keyed = {
4
- readonly key: string;
5
- };
6
- export type Send<O, E extends Keyed> = {
3
+ export type Send<O> = {
7
4
  (name: string, input: unknown, sending: (operation: string) => Promise<O>): Promise<O>;
8
- expect(expected: ExpectedOf<E>): void;
5
+ expect(expected: Expected): void;
9
6
  };
10
7
  export type LaneShown<O> = {
11
8
  readonly busy: boolean;
12
9
  readonly drawn: boolean;
13
10
  readonly ended: O | null;
14
11
  };
15
- export type Lane<O, E extends Keyed> = {
16
- run(steps: (send: Send<O, E>) => Promise<O>, expected?: ExpectedOf<E>): Promise<O>;
12
+ export type Lane<O> = {
13
+ run(steps: (send: Send<O>) => Promise<O>, expected?: Expected): Promise<O>;
17
14
  shown(): LaneShown<O>;
18
15
  subscribe(listener: () => void): () => void;
19
16
  forget(): void;
20
17
  };
21
- export type Acting<O, E extends Keyed> = {
22
- open(): Lane<O, E>;
18
+ export type Acting<O> = {
19
+ open(): Lane<O>;
23
20
  };
24
- export type ActingRules<O, E extends Keyed> = {
25
- readonly store: Pick<Expecting<E>, 'begin' | 'expect' | 'drop'>;
21
+ export type ActingRules<O> = {
22
+ readonly store: Pick<Expecting, 'begin' | 'expect' | 'drop'>;
26
23
  readonly uncertain: O;
27
24
  ending(outcome: O): Ended;
28
25
  acted?(): void;
29
26
  mint?(): string;
27
+ settles?(operation: string): Promise<boolean>;
30
28
  };
31
- export declare function acting<O, E extends Keyed>(rules: ActingRules<O, E>): Acting<O, E>;
32
- export {};
29
+ export declare function acting<O>(rules: ActingRules<O>): Acting<O>;
33
30
  //# sourceMappingURL=act-lanes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"act-lanes.d.ts","sourceRoot":"","sources":["../src/act-lanes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGjF,MAAM,MAAM,KAAK,GAAG,UAAU,GAAG,SAAS,GAAG,YAAY,GAAG,QAAQ,CAAC;AAErE,KAAK,KAAK,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtC,MAAM,MAAM,IAAI,CAAC,CAAC,EAAE,CAAC,SAAS,KAAK,IAAI;IACrC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACvF,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI;IACzB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,Q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AC,CAAC;IAC7D,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;IACtB,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC;IAC1B,KAAK,CAAC,IAAI,IAAI,CAAC;IACf,IAAI,CAAC,IAAI,MAAM,CAAC;IAChB,OAAO,CAAC,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC/C,CAAC;AAUF,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CA6N1D"}
package/dist/act-lanes.js CHANGED
@@ -2,10 +2,11 @@ import { expectedList } from './expectation.js';
2
2
  import { changeBatchIdentity } from './identity.js';
3
3
  const IDLE = { busy: false, drawn: false, ended: null };
4
4
  export function acting(rules) {
5
- const { store, uncertain, ending } = rules;
5
+ const { store, uncertain, ending, settles } = rules;
6
6
  const mint = rules.mint ?? (() => changeBatchIdentity());
7
7
  const identities = new Map();
8
8
  const waiting = new Map();
9
+ const settling = new Map();
9
10
  const blobs = new WeakMap();
10
11
  let counted = 0;
11
12
  let touches = 0;
@@ -78,6 +79,8 @@ export function acting(rules) {
78
79
  let pressed = 0;
79
80
  let drawing = 0;
80
81
  let ended = null;
82
+ let held = null;
83
+ let presses = 0;
81
84
  let shown = IDLE;
82
85
  const show = () => {
83
86
  const busy = pressed > 0;
@@ -88,7 +91,38 @@ export function acting(rules) {
88
91
  for (const listener of listeners)
89
92
  listener();
90
93
  };
91
- const run = (steps, expected = null) => {
94
+ const awaiting = (outcome, operations, heard, again) => new Promise((resolve) => {
95
+ const forgotten = () => {
96
+ for (const operation of operations)
97
+ if (settling.get(operation) === record)
98
+ settling.delete(operation);
99
+ };
100
+ const record = {
101
+ supersede() {
102
+ if (held !== record)
103
+ return;
104
+ held = null;
105
+ forgotten();
106
+ resolve(outcome);
107
+ },
108
+ };
109
+ held = record;
110
+ for (const operation of operations)
111
+ settling.set(operation, record);
112
+ const answers = operations.map((operation) => heard(operation).then((answered) => {
113
+ if (!answered)
114
+ record.supersede();
115
+ return answered;
116
+ }));
117
+ void Promise.all(answers).then(() => {
118
+ if (held !== record)
119
+ return;
120
+ held = null;
121
+ forgotten();
122
+ resolve(again());
123
+ }, () => record.supersede());
124
+ });
125
+ const attempt = (steps, expected, press) => {
92
126
  const act = store.begin();
93
127
  let drew = false;
94
128
  const expect = (more) => {
@@ -108,6 +142,7 @@ export function acting(rules) {
108
142
  const send = Object.assign(async (name, input, sending) => {
109
143
  const request = requestOf(name, input);
110
144
  const identity = identityOf(request);
145
+ settling.get(identity.operation)?.supersede();
111
146
  const called = { request, identity, ended: null };
112
147
  calls.push(called);
113
148
  touches += 1;
@@ -150,11 +185,24 @@ export function acting(rules) {
150
185
  end(uncertain, 'unanswered');
151
186
  throw error;
152
187
  }
153
- end(outcome, ending(outcome));
154
- return outcome;
188
+ const how = ending(outcome);
189
+ end(outcome, how);
190
+ return { outcome, how };
155
191
  });
156
192
  tail = turn.catch(() => undefined);
157
- return turn;
193
+ return turn.then(({ outcome, how }) => {
194
+ const lost = calls.flatMap(({ identity, ended: answered }) => answered === 'unanswered' ? [identity.operation] : []);
195
+ if (how !== 'unanswered' || lost.length === 0 || settles === undefined)
196
+ return outcome;
197
+ if (press !== presses)
198
+ return outcome;
199
+ return awaiting(outcome, lost, settles, () => attempt(steps, expected, press));
200
+ });
201
+ };
202
+ const run = (steps, expected = null) => {
203
+ held?.supersede();
204
+ presses += 1;
205
+ return attempt(steps, expected, presses);
158
206
  };
159
207
  return {
160
208
  run,
package/dist/actions.d.ts CHANGED
@@ -20,6 +20,7 @@ export type Invoked = {
20
20
  export declare function invokeAction(runtime: Runtime, name: string, input: unknown, { dispatching, attempt }?: Invoked): Promise<CallResult>;
21
21
  export declare function readConversationHistory(runtime: Runtime, request: ConversationHistoryRequest): Promise<CallResult>;
22
22
  export declare function called(runtime: Runtime, name: string, input: unknown, attempt?: Attempt): Promise<CallResult>;
23
+ export declare function answeredCall(runtime: Runtime, operation: string): Promise<boolean>;
23
24
  export declare function resendCalls(runtime: Runtime, signal: AbortSignal): Promise<Attempted>;
24
25
  export declare function resendLater(runtime: Runtime): void;
25
26
  //# sourceMappingURL=actions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAK/D,OAAO,EAWL,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,UAAU,EAChB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAG5C,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAOF,wBAAsB,WAAW,CAC/B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,YAAiB,GACvB,OAAO,CAAC,aAAa,CAAC,CAqCxB;AAED,wBAAsB,OAAO,CAC3B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAShD;AAED,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,UAAU,CAAC,CAuBrB;AAwBD,MAAM,MAAM,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S,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAaxF;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,CAe3F;AAiBD,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,QAG3C"}
package/dist/actions.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { roomTarget, target } from '@agentshouse/mdmodel';
2
- import { CATCHING_UP, resendConversations } from './conversation.js';
2
+ import { CATCHING_UP, holdsSubmission, resendConversations } from './conversation.js';
3
3
  import { listingNow } from './listing.js';
4
4
  import { locked, lockedRooms } from './locks.js';
5
5
  import { scoped } from './models.js';
@@ -10,7 +10,7 @@ function operationOf(input) {
10
10
  return typeof operation === 'string' ? operation : null;
11
11
  }
12
12
  export async function readHistory(runtime, locator, path, query = {}) {
13
- const { store, socket, presence, journal } = runtime;
13
+ const { store, socket, presence } = runtime;
14
14
  const { session } = socket;
15
15
  if (socket.closed() || session.now().refusal !== null)
16
16
  return UNCERTAIN;
@@ -27,12 +27,6 @@ export async function readHistory(runtime, locator, path, query = {}) {
27
27
  if (closed || authorization === undefined || refusal !== null)
28
28
  return UNCERTAIN;
29
29
  const since = presence.losses();
30
- const transfer = ['transfer', 'history', locator, path];
31
- if (query.revision !== undefined)
32
- transfer.push(query.revision);
33
- if (query.pageToken !== undefined)
34
- transfer.push(query.pageToken);
35
- journal.record(transfer.join(' '));
36
30
  try {
37
31
  const result = await socket.history(authorization, {
38
32
  locator,
@@ -40,7 +34,6 @@ export async function readHistory(runtime, locator, path, query = {}) {
40
34
  ...(query.revision === undefined ? {} : { revision: query.revision }),
41
35
  ...(query.pageToken === undefined ? {} : { pageToken: query.pageToken }),
42
36
  });
43
- journal.record(`outcome history ${result.kind}`);
44
37
  if (presence.lostSince(locator, since))
45
38
  return failure({ kind: 'room-not-readable', locator });
46
39
  if (result.kind === 'scoped-refusal') {
@@ -53,7 +46,6 @@ export async function readHistory(runtime, locator, path, query = {}) {
53
46
  return historyAnswer(result);
54
47
  }
55
48
  catch {
56
- journal.record('outcome history transport-uncertainty');
57
49
  return UNCERTAIN;
58
50
  }
59
51
  }
@@ -111,7 +103,7 @@ async function calledRooms(runtime, name, input) {
111
103
  return (Array.isArray(named) ? named : [named]).filter((room) => typeof room === 'string');
112
104
  }
113
105
  export async function invokeAction(runtime, name, input, { dispatching, attempt } = {}) {
114
- const { store, socket, journal, retries } = runtime;
106
+ const { store, socket, retries } = runtime;
115
107
  const { session } = socket;
116
108
  await socket.ready;
117
109
  if (socket.closed() || session.now().refusal !== null) {
@@ -130,7 +122,6 @@ export async function invokeAction(runtime, name, input, { dispatching, attempt
130
122
  return handedOutcome(retries, attempt, UNANSWERED);
131
123
  }
132
124
  await dispatching?.();
133
- journal.record(`transfer action ${name}`);
134
125
  try {
135
126
  const result = await socket.action(authorization, { name, input });
136
127
  if (result.kind === 'scoped-refusal') {
@@ -140,34 +131,27 @@ export async function invokeAction(runtime, name, input, { dispatching, attempt
140
131
  }
141
132
  if (result.kind === 'revoked-authorization')
142
133
  await refuse(runtime, 'revoked-authorization');
143
- journal.record(`outcome action ${result.kind}`);
144
- if (result.kind === 'rejected')
145
- journal.record(`refusal rejected ${result.code}`);
146
134
  return handedOutcome(retries, attempt, result);
147
135
  }
148
136
  catch (error) {
149
- journal.record('outcome action transport-uncertainty');
150
137
  return handedOutcome(retries, attempt, { kind: 'transport-uncertainty', failure: error });
151
138
  }
152
139
  }
153
140
  export async function readConversationHistory(runtime, request) {
154
- const { socket, journal, retries } = runtime;
141
+ const { socket, retries } = runtime;
155
142
  const caught = { step: 'conversations', instance: CATCHING_UP };
156
143
  await socket.ready;
157
144
  const stream = socket.conversations();
158
145
  if (socket.closed() || socket.session.now().refusal !== null || stream?.history === undefined) {
159
146
  return handedOutcome(retries, caught, UNANSWERED);
160
147
  }
161
- journal.record('transfer conversation history');
162
148
  try {
163
149
  const result = await stream.history(request);
164
150
  if (result.kind === 'revoked-authorization')
165
151
  await refuse(runtime, 'revoked-authorization');
166
- journal.record(`outcome conversation history ${result.kind}`);
167
152
  return handedOutcome(retries, caught, result);
168
153
  }
169
154
  catch (error) {
170
- journal.record('outcome conversation history transport-uncertainty');
171
155
  return handedOutcome(retries, caught, { kind: 'transport-uncertainty', failure: error });
172
156
  }
173
157
  }
@@ -182,33 +166,79 @@ function numberedCall(runtime, name, input, operation, dispatching) {
182
166
  attempt: { step: 'sending', instance: `action ${operation}` },
183
167
  });
184
168
  }
185
- async function recoveredAction(runtime, name, input, attempt) {
186
- const { store, socket, recovery } = runtime;
169
+ function keptSender(runtime, name, input, operation, resent = false) {
170
+ const { store, socket } = runtime;
187
171
  const { lanes } = socket;
172
+ const dispatching = async () => (await store.open()).keepCall({ operation, name, input });
173
+ let waiting = [];
174
+ let last = UNCERTAIN;
175
+ let lost = resent;
176
+ const tell = (result) => {
177
+ last = result;
178
+ const told = waiting;
179
+ waiting = [];
180
+ for (const answer of told)
181
+ answer(result);
182
+ };
183
+ const sender = {
184
+ next: () => new Promise((answer) => waiting.push(answer)),
185
+ async send() {
186
+ let result;
187
+ try {
188
+ result = await numberedCall(runtime, name, input, operation, dispatching);
189
+ }
190
+ catch (error) {
191
+ tell(last);
192
+ throw error;
193
+ }
194
+ if (unsettled(result))
195
+ lost = true;
196
+ else {
197
+ await (await store.open()).dropCall(operation);
198
+ lanes.settle(operation, lost);
199
+ }
200
+ tell(result);
201
+ return result;
202
+ },
203
+ release() {
204
+ lanes.sent(operation, sender);
205
+ tell(last);
206
+ },
207
+ };
208
+ lanes.sending(operation, sender);
209
+ return sender;
210
+ }
211
+ async function recoveredAction(runtime, name, input, attempt) {
212
+ const { socket, recovery } = runtime;
188
213
  const operation = operationOf(input);
189
214
  if (operation === null)
190
215
  return invokeAction(runtime, name, input, { attempt });
191
- const dispatching = async () => (await store.open()).keepCall({ operation, name, input });
192
- lanes.call(operation);
216
+ const held = socket.lanes.sender(operation);
217
+ if (held !== undefined)
218
+ return held.next();
219
+ const sender = keptSender(runtime, name, input, operation);
220
+ let first;
193
221
  try {
194
- let result = await numberedCall(runtime, name, input, operation, dispatching);
195
- if (unsettled(result)) {
196
- await recovery.attempt(`action ${operation}`, async () => {
197
- if (socket.closed() || socket.session.now().refusal !== null)
198
- return 'done';
199
- if (!socket.isOpen())
200
- return 'again';
201
- result = await numberedCall(runtime, name, input, operation, dispatching);
202
- return unsettled(result) ? 'again' : 'done';
203
- }, { again: true });
204
- }
205
- if (!unsettled(result))
206
- await (await store.open()).dropCall(operation);
207
- return result;
222
+ first = await sender.send();
223
+ }
224
+ catch (error) {
225
+ sender.release();
226
+ throw error;
208
227
  }
209
- finally {
210
- lanes.called(operation);
228
+ if (!unsettled(first)) {
229
+ sender.release();
230
+ return first;
211
231
  }
232
+ void recovery
233
+ .attempt(`action ${operation}`, async () => {
234
+ if (socket.closed() || socket.session.now().refusal !== null)
235
+ return 'done';
236
+ if (!socket.isOpen())
237
+ return 'again';
238
+ return unsettled(await sender.send()) ? 'again' : 'done';
239
+ }, { again: true })
240
+ .finally(() => sender.release());
241
+ return first;
212
242
  }
213
243
  export async function called(runtime, name, input, attempt) {
214
244
  await runtime.socket.ready;
@@ -216,26 +246,37 @@ export async function called(runtime, name, input, attempt) {
216
246
  const room = (await calledRooms(runtime, name, input)).find((one) => lockedNow.includes(one));
217
247
  return room === undefined ? recoveredAction(runtime, name, input, attempt) : lockedRoom(room);
218
248
  }
219
- export async function resendCalls(runtime, signal) {
249
+ export async function answeredCall(runtime, operation) {
220
250
  const { store, socket } = runtime;
221
251
  const { lanes } = socket;
252
+ const held = () => lanes.sender(operation) !== undefined || lanes.unclaimed(operation);
253
+ if (!held()) {
254
+ const calls = await (await store.open()).calls();
255
+ const kept = calls.some((one) => one.operation === operation) ||
256
+ (await holdsSubmission(runtime.conversations, operation));
257
+ if (!held() && !kept)
258
+ return false;
259
+ }
260
+ await lanes.settled(operation);
261
+ return true;
262
+ }
263
+ export async function resendCalls(runtime, signal) {
264
+ const { store, socket } = runtime;
222
265
  if (!socket.isOpen() || socket.closed() || socket.stopping())
223
266
  return 'done';
224
267
  const local = await store.open();
225
268
  for (const held of await local.calls()) {
226
- if (lanes.calling(held.operation))
269
+ if (socket.lanes.sender(held.operation) !== undefined)
227
270
  continue;
228
271
  if (socket.closed() || signal.aborted)
229
272
  return 'done';
230
- lanes.call(held.operation);
273
+ const sender = keptSender(runtime, held.name, held.input, held.operation, true);
231
274
  try {
232
- if (unsettled(await numberedCall(runtime, held.name, held.input, held.operation))) {
275
+ if (unsettled(await sender.send()))
233
276
  return 'again';
234
- }
235
- await local.dropCall(held.operation);
236
277
  }
237
278
  finally {
238
- lanes.called(held.operation);
279
+ sender.release();
239
280
  }
240
281
  }
241
282
  return 'done';
package/dist/adapter.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { SavedFacts, TypedPath } from '@agentshouse/mdmodel';
1
+ import type { SavedFacts, TypedPath, VerifiedModel } from '@agentshouse/mdmodel';
2
2
  import type { Operation, SessionState } from '@agentshouse/session-content';
3
3
  import type { ModelResult } from './model.js';
4
4
  export type { SavedFacts, TypedPath };
@@ -42,8 +42,6 @@ export type Capability = {
42
42
  export type ListedConversation = {
43
43
  conversation: string;
44
44
  agent: string;
45
- agentName: string;
46
- agentRetired: boolean;
47
45
  name: string;
48
46
  created: string;
49
47
  finished: string | null;
@@ -51,6 +49,7 @@ export type ListedConversation = {
51
49
  waiting: boolean;
52
50
  newest: string | null;
53
51
  processEnded: string | null;
52
+ subject: string | null;
54
53
  };
55
54
  export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete' | 'conversations/take-out' | 'conversations/rename' | 'conversations/option/set' | 'conversations/retry' | 'agent-functions/decide';
56
55
  export type ConversationMessage = {
@@ -164,6 +163,7 @@ export type ConversationEvent = {
164
163
  conversation: string;
165
164
  } | {
166
165
  kind: 'list';
166
+ agents: readonly ListedAgent[];
167
167
  entries: readonly ListedConversation[];
168
168
  whole: boolean;
169
169
  more: boolean;
@@ -171,6 +171,9 @@ export type ConversationEvent = {
171
171
  } | {
172
172
  kind: 'listed';
173
173
  entry: ListedConversation;
174
+ } | {
175
+ kind: 'agent';
176
+ agent: ListedAgent;
174
177
  } | {
175
178
  kind: 'unlisted';
176
179
  conversation: string;
@@ -181,17 +184,26 @@ export type AgentEnvironment = {
181
184
  state: 'online' | 'offline';
182
185
  };
183
186
  export type ListedAgent = {
184
- agent: string;
187
+ id: string;
185
188
  name: string;
186
- retired: boolean;
189
+ revision: number;
190
+ environment: string;
191
+ environment_name: string;
192
+ environment_connected: boolean;
193
+ launch_directory: string;
187
194
  cli: string;
188
- environment: AgentEnvironment;
195
+ model: string | null;
196
+ effort: string | null;
197
+ mode: string | null;
198
+ base_instructions: string;
199
+ in_telegram: boolean;
200
+ created: string;
201
+ retired_at: string | null;
189
202
  };
190
203
  export type ConversationStream = {
191
204
  replicate(conversations: readonly string[]): void;
192
205
  hold(cursor: string | null): void;
193
206
  observe(notify: (event: ConversationEvent) => void): () => void;
194
- agents?(): Promise<readonly ListedAgent[] | null>;
195
207
  history?(request: ConversationHistoryRequest): Promise<ActionResult>;
196
208
  };
197
209
  export type ActionDeclaration = {
@@ -359,12 +371,9 @@ export type AcceptedRoom = {
359
371
  };
360
372
  export type MutationResult = (AcceptedRoom & {
361
373
  kind: 'accepted';
362
- author?: string;
363
- time?: string;
364
374
  destination?: AcceptedRoom;
365
375
  }) | (ProviderRefusal & {
366
376
  kind: 'conflicted';
367
- roomVersion?: string;
368
377
  affected: Readonly<Record<string, string>>;
369
378
  }) | (ProviderRefusal & {
370
379
  kind: 'rejected';
@@ -507,8 +516,7 @@ export type RoomStream = {
507
516
  export type PathRule = (path: string) => boolean;
508
517
  export type Adapter = {
509
518
  readonly localSaves?: true;
510
- readonly roomTypes?: string;
511
- readonly nameableRoomTypes?: readonly string[];
519
+ readonly roomTypes?: VerifiedModel;
512
520
  readonly typedPaths?: readonly TypedPath[];
513
521
  readonly pathRule?: PathRule;
514
522
  readonly unkeptReads?: readonly string[];