@forwardimpact/libeval 0.1.43 → 0.1.45
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/README.md +212 -13
- package/bin/fit-benchmark.js +2 -2
- package/bin/fit-eval.js +101 -21
- package/bin/fit-trace.js +14 -0
- package/package.json +1 -1
- package/src/agent-runner.js +45 -181
- package/src/benchmark/runner.js +2 -2
- package/src/commands/benchmark-run.js +1 -1
- package/src/commands/by-discussion.js +84 -0
- package/src/commands/callback.js +104 -0
- package/src/commands/discuss.js +116 -0
- package/src/commands/facilitate.js +2 -2
- package/src/commands/supervise.js +6 -4
- package/src/discuss-tools.js +135 -0
- package/src/discusser.js +315 -0
- package/src/facilitator.js +46 -357
- package/src/index.js +12 -0
- package/src/judge.js +1 -1
- package/src/message-bus.js +27 -81
- package/src/orchestration-loop.js +316 -0
- package/src/orchestration-toolkit.js +272 -303
- package/src/orchestrator-helpers.js +9 -45
- package/src/redaction.js +12 -0
- package/src/render/orchestrator-filter.js +1 -8
- package/src/supervisor.js +79 -465
- package/src/trace-collector.js +4 -0
|
@@ -1,44 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/** Create a promise-based async queue for serializing event delivery to the facilitator loop. */
|
|
9
|
-
export function createAsyncQueue() {
|
|
10
|
-
const items = [];
|
|
11
|
-
let waiter = null;
|
|
12
|
-
let closed = false;
|
|
13
|
-
return {
|
|
14
|
-
enqueue(item) {
|
|
15
|
-
items.push(item);
|
|
16
|
-
if (waiter) {
|
|
17
|
-
waiter();
|
|
18
|
-
waiter = null;
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
async dequeue() {
|
|
22
|
-
if (items.length > 0) return items.shift();
|
|
23
|
-
if (closed) return null;
|
|
24
|
-
await new Promise((resolve) => {
|
|
25
|
-
waiter = resolve;
|
|
26
|
-
});
|
|
27
|
-
return items.length > 0 ? items.shift() : null;
|
|
28
|
-
},
|
|
29
|
-
close() {
|
|
30
|
-
closed = true;
|
|
31
|
-
if (waiter) {
|
|
32
|
-
waiter();
|
|
33
|
-
waiter = null;
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Render a drained batch of bus messages as tagged text lines.
|
|
41
|
-
* @param {Array<{from: string, text: string, kind?: string, direct?: boolean}>} messages
|
|
2
|
+
* Render a drained batch of bus messages as tagged text lines so the
|
|
3
|
+
* LLM can read its inbox at a glance. Asks and answers include the
|
|
4
|
+
* `askId` in the tag (`[ask#42] facilitator: …`, `[answer#42] agent: …`)
|
|
5
|
+
* so the addressee can quote it back via Answer's `askId` field.
|
|
6
|
+
*
|
|
7
|
+
* @param {Array<{from: string, text: string, kind?: string, askId?: number}>} messages
|
|
42
8
|
* @returns {string}
|
|
43
9
|
*/
|
|
44
10
|
export function formatMessages(messages) {
|
|
@@ -50,10 +16,8 @@ function formatMessage(m) {
|
|
|
50
16
|
}
|
|
51
17
|
|
|
52
18
|
function tagFor(m) {
|
|
53
|
-
if (m.kind === "ask") return
|
|
54
|
-
if (m.kind === "answer") return
|
|
55
|
-
if (m.kind === "announce") return "[shared]";
|
|
19
|
+
if (m.kind === "ask") return `[ask#${m.askId}]`;
|
|
20
|
+
if (m.kind === "answer") return `[answer#${m.askId}]`;
|
|
56
21
|
if (m.kind === "synthetic") return "[system]";
|
|
57
|
-
|
|
58
|
-
return m.direct ? "[direct]" : "[shared]";
|
|
22
|
+
return "[shared]";
|
|
59
23
|
}
|
package/src/redaction.js
CHANGED
|
@@ -10,8 +10,20 @@
|
|
|
10
10
|
|
|
11
11
|
export const DEFAULT_ENV_ALLOWLIST = Object.freeze([
|
|
12
12
|
"ANTHROPIC_API_KEY",
|
|
13
|
+
"AWS_ACCESS_KEY_ID",
|
|
14
|
+
"AWS_SECRET_ACCESS_KEY",
|
|
15
|
+
"DATABASE_PASSWORD",
|
|
13
16
|
"GH_TOKEN",
|
|
14
17
|
"GITHUB_TOKEN",
|
|
18
|
+
"MCP_TOKEN",
|
|
19
|
+
"MICROSOFT_APP_ID",
|
|
20
|
+
"MICROSOFT_APP_PASSWORD",
|
|
21
|
+
"MICROSOFT_APP_TENANT_ID",
|
|
22
|
+
"PRODUCT_LANDMARK_TOKEN",
|
|
23
|
+
"SERVICE_SECRET",
|
|
24
|
+
"SUPABASE_ANON_KEY",
|
|
25
|
+
"SUPABASE_JWT_SECRET",
|
|
26
|
+
"SUPABASE_SERVICE_ROLE_KEY",
|
|
15
27
|
]);
|
|
16
28
|
|
|
17
29
|
// Anchored prefixes per
|
|
@@ -6,14 +6,7 @@
|
|
|
6
6
|
* controls what the live `textStream` and offline `toText()` show.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
const SUPPRESSED = new Set([
|
|
10
|
-
"session_start",
|
|
11
|
-
"agent_start",
|
|
12
|
-
"ask_received",
|
|
13
|
-
"ask_answered",
|
|
14
|
-
"redirect",
|
|
15
|
-
"summary",
|
|
16
|
-
]);
|
|
9
|
+
const SUPPRESSED = new Set(["session_start", "agent_start", "summary", "meta"]);
|
|
17
10
|
|
|
18
11
|
/**
|
|
19
12
|
* @param {{type?: string}|null|undefined} event
|