@adecore/agents 0.24.2 → 0.25.1

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.
@@ -27,8 +27,9 @@ export interface DeliverMessageDeps {
27
27
  * Opens the turn a message earns a chat. The messages wait in the notice store and the turn's preamble
28
28
  * takes them (`NoticeNotes`), as a person's own prompt does, so a message is heard once either way.
29
29
  *
30
- * One attempt, never `wait`: a chat already in a turn reads the message in front of its next one, and
31
- * holding the entry would start turns nobody asked for long after the news mattered.
30
+ * One attempt: a chat already in a turn reads the message in front of its next one, and holding the
31
+ * entry would start turns nobody asked for long after the news mattered. The one exception is a chat
32
+ * being moved to another folder, which has no turn and turns every wake away until the move ends.
32
33
  */
33
34
  export function deliverMessageHandler(deps: DeliverMessageDeps) {
34
35
  return async (entry: DeliverMessageEntry): Promise<OutboxOutcome> => {
@@ -44,6 +45,9 @@ export function deliverMessageHandler(deps: DeliverMessageDeps) {
44
45
  if (chat === null) {
45
46
  return;
46
47
  }
48
+ if (chat.relocating?.() === true) {
49
+ return 'wait';
50
+ }
47
51
  // No note and no preamble on the thread: a person read the message as it landed (`showNotices`),
48
52
  // and the label on the turn names who it came from.
49
53
  chat.wake({
@@ -122,9 +122,12 @@ export class RecordDirectory<T> {
122
122
  }
123
123
 
124
124
  async prune(drop: (record: T) => boolean): Promise<void> {
125
- for (const record of this.all()) {
126
- if (drop(record)) {
127
- await this.remove(this.idOf(record));
125
+ for (const listed of this.all()) {
126
+ const id = this.idOf(listed);
127
+ // Read again after each await: a record written meanwhile may no longer be one to drop.
128
+ const current = this.records.get(id);
129
+ if (current !== undefined && drop(current)) {
130
+ await this.remove(id);
128
131
  }
129
132
  }
130
133
  }
@@ -2,6 +2,6 @@
2
2
  export { type FakeIo, type FakeProgram, type FakeCli, type StartedFake, type InProcessCli, inProcess, runOverStdio } from './fake-cli.ts';
3
3
  export { fakeClaude, claudeStoppingOnResume } from './fake-claude.ts';
4
4
  export { FAKE_CHILD_STEPS, fakeCodexForks, type FakeCodexOptions, fakeCodexWith, fakeCodex } from './fake-codex.ts';
5
- export { memorySecrets, testAccounts } from './accounts.ts';
5
+ export { testAccounts } from './accounts.ts';
6
6
  export { ManualClock } from './manual-clock.ts';
7
- export { FakeDirectoryWatcher, FakeWatch, EventLog } from './watch.ts';
7
+ export { FakeWatch, EventLog } from './watch.ts';