@duetso/agent 0.1.101 → 0.1.102

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/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duetso/agent",
3
- "version": "0.1.101",
3
+ "version": "0.1.102",
4
4
  "description": "An opinionated full-stack agent turn runner with native memories, interrupts, and multi-agent orchestration",
5
5
  "keywords": [
6
6
  "agent",
@@ -7,9 +7,42 @@ export interface EmbeddingBackfillWorkerOptions {
7
7
  embed: EmbedFn;
8
8
  /** Path to append progress lines to. Optional; when omitted the worker logs nothing. */
9
9
  logPath?: string;
10
+ /**
11
+ * Idle delay between outer drain ticks in milliseconds. Defaults to
12
+ * 10s, which gives a peer duet CLI room to acquire the lock between
13
+ * drains. Tests override this to drive several ticks per second.
14
+ */
15
+ idleSleepMs?: number;
16
+ /**
17
+ * Backoff after a failed drain in milliseconds. Defaults to 60s.
18
+ * Tests override this so a transient-error case does not block the
19
+ * suite for a full minute.
20
+ */
21
+ errorSleepMs?: number;
22
+ /**
23
+ * Minimum time between re-embed attempts for the same observation
24
+ * id, in milliseconds. Defaults to 5 minutes. Caps unbounded
25
+ * re-embedding when something (typically the reflector's
26
+ * delete-and-reinsert cycle) keeps wiping a row's embedding behind
27
+ * the worker's back.
28
+ */
29
+ attemptCooldownMs?: number;
30
+ /**
31
+ * Maximum size of the live log file in bytes before it is rotated
32
+ * to `<logPath>.1` (replacing any prior rotation). Defaults to 1 MB.
33
+ * Each call to `log` checks the current size first and rotates
34
+ * before appending, so a chronic failure cannot grow the log without
35
+ * bound.
36
+ */
37
+ logMaxBytes?: number;
10
38
  }
11
39
  export declare class EmbeddingBackfillWorker {
12
40
  private readonly options;
41
+ private readonly idleSleepMs;
42
+ private readonly errorSleepMs;
43
+ private readonly attemptCooldownMs;
44
+ private readonly logMaxBytes;
45
+ private readonly recentAttempts;
13
46
  private abortController?;
14
47
  private runningPromise?;
15
48
  constructor(options: EmbeddingBackfillWorkerOptions);
@@ -23,6 +56,11 @@ export declare class EmbeddingBackfillWorker {
23
56
  stop(): Promise<void>;
24
57
  private run;
25
58
  private selectBatch;
59
+ /**
60
+ * Return the ids currently inside the attempt-cooldown window and
61
+ * forget anything older so the map cannot grow unbounded.
62
+ */
63
+ private collectCooledIds;
26
64
  private persistBatch;
27
65
  private log;
28
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"embedding-worker.d.ts","sourceRoot":"","sources":["../../../src/memory/embedding-worker.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AA2BlD,MAAM,WAAW,8BAA8B;IAC7C,sEAAsE;IACtE,OAAO,EAAE,aAAa,CAAC;IACvB,+EAA+E;IAC/E,KAAK,EAAE,OAAO,CAAC;IACf,wFAAwF;IACxF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,uBAAuB;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiC;IACzD,OAAO,CAAC,eAAe,CAAC,CAAkB;IAC1C,OAAO,CAAC,cAAc,CAAC,CAAgB;gBAE3B,OAAO,EAAE,8BAA8B;IAInD,wEAAwE;IACxE,KAAK,IAAI,IAAI;IAMb;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;YAOb,GAAG;YAkCH,WAAW;YAmBX,YAAY;IAuC1B,OAAO,CAAC,GAAG;CAUZ"}
1
+ {"version":3,"file":"embedding-worker.d.ts","sourceRoot":"","sources":["../../../src/memory/embedding-worker.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAuClD,MAAM,WAAW,8BAA8B;IAC7C,sEAAsE;IACtE,OAAO,EAAE,aAAa,CAAC;IACvB,+EAA+E;IAC/E,KAAK,EAAE,OAAO,CAAC;IACf,wFAAwF;IACxF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID,qBAAa,uBAAuB;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiC;IACzD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;IAC3C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IAKrC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA6B;IAC5D,OAAO,CAAC,eAAe,CAAC,CAAkB;IAC1C,OAAO,CAAC,cAAc,CAAC,CAAgB;gBAE3B,OAAO,EAAE,8BAA8B;IAQnD,wEAAwE;IACxE,KAAK,IAAI,IAAI;IAMb;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;YAOb,GAAG;YAsCH,WAAW;IAyBzB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;YAcV,YAAY;IAuC1B,OAAO,CAAC,GAAG;CA+BZ"}
@@ -1,4 +1,4 @@
1
- import { appendFileSync, mkdirSync } from "node:fs";
1
+ import { appendFileSync, mkdirSync, renameSync, statSync } from "node:fs";
2
2
  import { dirname } from "node:path";
3
3
  /**
4
4
  * Background worker that fills missing embeddings while the CLI is
@@ -22,14 +22,40 @@ import { dirname } from "node:path";
22
22
  * after a backoff. The worker never throws to the caller.
23
23
  */
24
24
  const BATCH_SIZE = 50;
25
- const IDLE_SLEEP_MS = 10_000;
26
- const ERROR_SLEEP_MS = 60_000;
25
+ const DEFAULT_IDLE_SLEEP_MS = 10_000;
26
+ const DEFAULT_ERROR_SLEEP_MS = 60_000;
27
+ // Cap how often a single observation may be re-embedded. The production
28
+ // memory store can churn rows (the reflector deletes and re-inserts a
29
+ // session's observations, which cascade-deletes their embeddings). If
30
+ // the embedding row vanishes between drains we should re-embed at
31
+ // most once per cooldown rather than running an unbounded hot loop
32
+ // over the same ids.
33
+ const DEFAULT_ATTEMPT_COOLDOWN_MS = 5 * 60_000;
34
+ // Snippet length for embedding-failure log lines. The remote endpoint
35
+ // occasionally responds with a full HTML page when misrouted (404 from
36
+ // the marketing site) and dumping the whole body fills the log with
37
+ // tens of kilobytes per failure.
38
+ const ERROR_BODY_LOG_MAX = 200;
39
+ const DEFAULT_LOG_MAX_BYTES = 1024 * 1024;
27
40
  export class EmbeddingBackfillWorker {
28
41
  options;
42
+ idleSleepMs;
43
+ errorSleepMs;
44
+ attemptCooldownMs;
45
+ logMaxBytes;
46
+ // Per-id record of the last attempt timestamp. selectBatch filters
47
+ // out ids attempted within the cooldown, breaking the hot loop when
48
+ // a row's embedding keeps disappearing between drains. Entries are
49
+ // purged lazily as they expire.
50
+ recentAttempts = new Map();
29
51
  abortController;
30
52
  runningPromise;
31
53
  constructor(options) {
32
54
  this.options = options;
55
+ this.idleSleepMs = options.idleSleepMs ?? DEFAULT_IDLE_SLEEP_MS;
56
+ this.errorSleepMs = options.errorSleepMs ?? DEFAULT_ERROR_SLEEP_MS;
57
+ this.attemptCooldownMs = options.attemptCooldownMs ?? DEFAULT_ATTEMPT_COOLDOWN_MS;
58
+ this.logMaxBytes = options.logMaxBytes ?? DEFAULT_LOG_MAX_BYTES;
33
59
  }
34
60
  /** Start the background loop. Idempotent — a second call is a no-op. */
35
61
  start() {
@@ -63,6 +89,12 @@ export class EmbeddingBackfillWorker {
63
89
  const batch = await this.selectBatch(db);
64
90
  if (batch.length === 0)
65
91
  return;
92
+ // Stamp the attempt before we await the embedding so a
93
+ // failure mid-call still counts as an attempt and the same
94
+ // ids do not get retried in a tight loop on the next drain.
95
+ const attemptAt = Date.now();
96
+ for (const row of batch)
97
+ this.recentAttempts.set(row.id, attemptAt);
66
98
  const result = await this.options.embed(batch.map((row) => row.content));
67
99
  if (result.embeddings.length !== batch.length) {
68
100
  throw new Error(`Embedding response length (${result.embeddings.length}) did not match batch size (${batch.length})`);
@@ -73,14 +105,13 @@ export class EmbeddingBackfillWorker {
73
105
  });
74
106
  if (signal.aborted)
75
107
  return;
76
- await sleep(IDLE_SLEEP_MS, signal);
108
+ await sleep(this.idleSleepMs, signal);
77
109
  }
78
110
  catch (error) {
79
111
  if (signal.aborted)
80
112
  return;
81
- const reason = error instanceof Error ? error.message : String(error);
82
- this.log(`Embedding batch failed: ${reason}`);
83
- await sleep(ERROR_SLEEP_MS, signal);
113
+ this.log(`Embedding batch failed: ${summarizeError(error)}`);
114
+ await sleep(this.errorSleepMs, signal);
84
115
  }
85
116
  }
86
117
  }
@@ -89,16 +120,39 @@ export class EmbeddingBackfillWorker {
89
120
  // rows with no embedding yet. The composite index on
90
121
  // (kind, priority, created_at DESC) carries the ORDER BY without a
91
122
  // separate sort.
123
+ //
124
+ // The exclusion list comes from `recentAttempts` and caps how
125
+ // often the worker may retry the same id, even if its embedding
126
+ // row keeps being cascade-deleted between drains.
127
+ const excludedIds = this.collectCooledIds();
92
128
  const result = await db.query(`SELECT o.id, o.content
93
129
  FROM observations o
94
130
  LEFT JOIN observation_embeddings e ON e.observation_id = o.id
95
131
  WHERE e.observation_id IS NULL
132
+ AND NOT (o.id = ANY($2::text[]))
96
133
  ORDER BY
97
134
  CASE o.priority WHEN 'high' THEN 3 WHEN 'medium' THEN 2 ELSE 1 END DESC,
98
135
  o.created_at DESC
99
- LIMIT $1`, [BATCH_SIZE]);
136
+ LIMIT $1`, [BATCH_SIZE, excludedIds]);
100
137
  return result.rows;
101
138
  }
139
+ /**
140
+ * Return the ids currently inside the attempt-cooldown window and
141
+ * forget anything older so the map cannot grow unbounded.
142
+ */
143
+ collectCooledIds() {
144
+ const now = Date.now();
145
+ const cutoff = now - this.attemptCooldownMs;
146
+ const active = [];
147
+ for (const [id, at] of this.recentAttempts) {
148
+ if (at < cutoff) {
149
+ this.recentAttempts.delete(id);
150
+ continue;
151
+ }
152
+ active.push(id);
153
+ }
154
+ return active;
155
+ }
102
156
  async persistBatch(db, batch, vectors, model) {
103
157
  // One transaction so a partial network or write failure does not
104
158
  // leave the embeddings table half-populated relative to the
@@ -130,11 +184,29 @@ export class EmbeddingBackfillWorker {
130
184
  });
131
185
  }
132
186
  log(message) {
133
- if (!this.options.logPath)
187
+ const logPath = this.options.logPath;
188
+ if (!logPath)
134
189
  return;
135
190
  try {
136
- mkdirSync(dirname(this.options.logPath), { recursive: true });
137
- appendFileSync(this.options.logPath, `[${new Date().toISOString()}] ${message}\n`, "utf8");
191
+ mkdirSync(dirname(logPath), { recursive: true });
192
+ // Rotate before appending so the live file never exceeds the
193
+ // cap by more than one line. The single `.1` rotation keeps the
194
+ // most recent overflow available for post-mortem without
195
+ // accumulating an unbounded ring of files.
196
+ try {
197
+ if (statSync(logPath).size >= this.logMaxBytes) {
198
+ renameSync(logPath, `${logPath}.1`);
199
+ }
200
+ }
201
+ catch {
202
+ // No existing file or stat failed; appendFileSync will create.
203
+ }
204
+ // Include the pid so multi-CLI runs (which share the log file
205
+ // via the same HOME-backed `.duet/logs/` path) can be
206
+ // disambiguated. Each appendFileSync call writes a single line
207
+ // well under PIPE_BUF, so O_APPEND keeps lines from different
208
+ // processes intact even when they interleave.
209
+ appendFileSync(logPath, `[${new Date().toISOString()} pid=${process.pid}] ${message}\n`, "utf8");
138
210
  }
139
211
  catch {
140
212
  // Logging is best-effort; failures here must not bring the worker
@@ -150,6 +222,22 @@ export class EmbeddingBackfillWorker {
150
222
  function formatVector(values) {
151
223
  return `[${values.join(",")}]`;
152
224
  }
225
+ /**
226
+ * Render an error for the worker log without dumping multi-kilobyte
227
+ * HTML bodies. The embedding endpoint can respond with a full Next.js
228
+ * 404 page (over 50KB) when misrouted, and the raw message would
229
+ * otherwise be appended verbatim on every retry.
230
+ */
231
+ function summarizeError(error) {
232
+ const raw = error instanceof Error ? error.message : String(error);
233
+ const collapsed = raw
234
+ .replace(/<[^>]+>/g, " ")
235
+ .replace(/\s+/g, " ")
236
+ .trim();
237
+ if (collapsed.length <= ERROR_BODY_LOG_MAX)
238
+ return collapsed;
239
+ return `${collapsed.slice(0, ERROR_BODY_LOG_MAX)}… (truncated ${collapsed.length - ERROR_BODY_LOG_MAX} chars)`;
240
+ }
153
241
  function sleep(ms, signal) {
154
242
  return new Promise((resolve) => {
155
243
  if (signal.aborted) {
@@ -1 +1 @@
1
- {"version":3,"file":"embedding-worker.js","sourceRoot":"","sources":["../../../src/memory/embedding-worker.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,MAAM,aAAa,GAAG,MAAM,CAAC;AAC7B,MAAM,cAAc,GAAG,MAAM,CAAC;AAW9B,MAAM,OAAO,uBAAuB;IACjB,OAAO,CAAiC;IACjD,eAAe,CAAmB;IAClC,cAAc,CAAiB;IAEvC,YAAY,OAAuC;QACjD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,wEAAwE;IACxE,KAAK;QACH,IAAI,IAAI,CAAC,cAAc;YAAE,OAAO;QAChC,IAAI,CAAC,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;QAC7C,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC9D,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,eAAe,EAAE,KAAK,EAAE,CAAC;QAC9B,MA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AAC,CAAC;YACpB,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC7C,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC;QACF,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"embedding-worker.js","sourceRoot":"","sources":["../../../src/memory/embedding-worker.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,MAAM,qBAAqB,GAAG,MAAM,CAAC;AACrC,MAAM,sBAAsB,GAAG,MAAM,CAAC;AACtC,wEAAwE;AACxE,sEAAsE;AACtE,sEAAsE;AACtE,kEAAkE;AAClE,mEAAmE;AACnE,qBAAqB;AACrB,MAAM,2BAA2B,GAAG,CAAC,GAAG,MAAM,CAAC;AAC/C,sEAAsE;AACtE,uEAAuE;AACvE,oEAAoE;AACpE,iCAAiC;AACjC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAuC/B,MAAM,qBAAqB,GAAG,IAAI,GAAG,IAAI,CAAC;AAE1C,MAAM,OAAO,uBAAuB;IACjB,OAAO,CAAiC;IACxC,WAAW,CAAS;IACpB,YAAY,CAAS;IACrB,iBAAiB,CAAS;IAC1B,WAAW,CAAS;IACrC,mEAAmE;IACnE,oEAAoE;IACpE,mEAAmE;IACnE,gCAAgC;IACf,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAC;IACpD,eAAe,CAAmB;IAClC,cAAc,CAAiB;IAEvC,YAAY,OAAuC;QACjD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,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,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duetso/agent",
3
- "version": "0.1.101",
3
+ "version": "0.1.102",
4
4
  "description": "An opinionated full-stack agent turn runner with native memories, interrupts, and multi-agent orchestration",
5
5
  "keywords": [
6
6
  "agent",