agentic-relay 3.8.5 → 4.1.0

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/bin/lib/pool.mjs DELETED
@@ -1,26 +0,0 @@
1
- /**
2
- * Minimal promise pool — runs `worker(item)` over `items` with at most
3
- * `concurrency` in flight. Resolves to results in input order. A worker that
4
- * rejects yields `{ error }` in that slot so one failure never sinks the batch
5
- * (consult-batch turns these into `failures[]` entries).
6
- */
7
- export async function pool(items, concurrency, worker) {
8
- const results = new Array(items.length);
9
- let next = 0;
10
-
11
- async function run() {
12
- for (;;) {
13
- const i = next++;
14
- if (i >= items.length) return;
15
- try {
16
- results[i] = { ok: true, value: await worker(items[i], i) };
17
- } catch (error) {
18
- results[i] = { ok: false, error };
19
- }
20
- }
21
- }
22
-
23
- const n = Math.max(1, Math.min(concurrency || 1, items.length || 1));
24
- await Promise.all(Array.from({ length: n }, run));
25
- return results;
26
- }
@@ -1,49 +0,0 @@
1
- /**
2
- * Tests for the completion logic in the conversation driver (spec §6/§10).
3
- * Pure functions only — no network. Run: `node --test bin/test/driver.test.mjs`.
4
- */
5
- import { test } from "node:test";
6
- import assert from "node:assert/strict";
7
- import { turnAwaitsInput, assessTurn } from "../lib/driver.mjs";
8
-
9
- test("backend flag deliverable_complete wins over prose", () => {
10
- // Message ends in a question, but the backend says it's complete.
11
- const turn = { message: "Anything else?", deliverable_complete: true };
12
- assert.equal(turnAwaitsInput(turn), false);
13
- assert.deepEqual(assessTurn(turn, false).complete, true);
14
- });
15
-
16
- test("backend flag awaiting_input forces another turn", () => {
17
- const turn = { message: "Here is everything you need.", awaiting_input: true };
18
- assert.equal(turnAwaitsInput(turn), true);
19
- assert.equal(assessTurn(turn, true).complete, false);
20
- });
21
-
22
- test("heuristic: non-empty pending_fields means awaiting", () => {
23
- const turn = { message: "Got it.", pending_fields: ["api_key"] };
24
- assert.equal(turnAwaitsInput(turn), true);
25
- });
26
-
27
- test("heuristic: a question mark means awaiting (no flags)", () => {
28
- const turn = { message: "Which framework — Next.js or Remix?" };
29
- assert.equal(turnAwaitsInput(turn), true);
30
- assert.equal(assessTurn(turn, false).complete, false);
31
- });
32
-
33
- test("heuristic: offer phrase means awaiting", () => {
34
- const turn = { message: "I can do that. Let me know if you want the proxy too." };
35
- assert.equal(turnAwaitsInput(turn), true);
36
- });
37
-
38
- test("complete when a substantive deliverable exists and not awaiting", () => {
39
- const turn = { message: "Here is the typed fetcher and endpoints." };
40
- assert.equal(turnAwaitsInput(turn), false);
41
- assert.equal(assessTurn(turn, true).complete, true);
42
- });
43
-
44
- test("not complete when not awaiting but no deliverable yet", () => {
45
- const turn = { message: "Sure, I can help with that." };
46
- const a = assessTurn(turn, false);
47
- assert.equal(a.complete, false);
48
- assert.equal(a.reason, "no-deliverable");
49
- });