@tangle-network/agent-eval 0.124.0 → 0.126.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.
Files changed (97) hide show
  1. package/CHANGELOG.md +60 -35
  2. package/README.md +270 -189
  3. package/dist/analyst/index.d.ts +15 -145
  4. package/dist/analyst/index.js +33 -47
  5. package/dist/analyst/index.js.map +1 -1
  6. package/dist/benchmarks/index.d.ts +45 -162
  7. package/dist/benchmarks/index.js +8 -9
  8. package/dist/campaign/index.d.ts +3655 -5365
  9. package/dist/campaign/index.js +21 -95
  10. package/dist/{chunk-R226UZOI.js → chunk-474LBSOX.js} +2 -2
  11. package/dist/{chunk-W5B3ZGP3.js → chunk-4B7ZZHPX.js} +8 -6
  12. package/dist/{chunk-W5B3ZGP3.js.map → chunk-4B7ZZHPX.js.map} +1 -1
  13. package/dist/{chunk-DT7OXY3C.js → chunk-CM4OILD2.js} +535 -846
  14. package/dist/chunk-CM4OILD2.js.map +1 -0
  15. package/dist/{chunk-HM6V7F3M.js → chunk-FO7HEH76.js} +3 -3
  16. package/dist/chunk-IILEIWGW.js +635 -0
  17. package/dist/chunk-IILEIWGW.js.map +1 -0
  18. package/dist/{chunk-EQUK3RFS.js → chunk-J5SQWP6Y.js} +8 -5
  19. package/dist/chunk-J5SQWP6Y.js.map +1 -0
  20. package/dist/chunk-KO2PZOGP.js +4637 -0
  21. package/dist/chunk-KO2PZOGP.js.map +1 -0
  22. package/dist/{chunk-4Y7AAATF.js → chunk-LKKT3IVV.js} +574 -81
  23. package/dist/chunk-LKKT3IVV.js.map +1 -0
  24. package/dist/chunk-M7AH34KV.js +155 -0
  25. package/dist/chunk-M7AH34KV.js.map +1 -0
  26. package/dist/chunk-NTOV7RU5.js +7152 -0
  27. package/dist/chunk-NTOV7RU5.js.map +1 -0
  28. package/dist/{chunk-QFQZ3U3X.js → chunk-OCFJACJU.js} +2 -2
  29. package/dist/{chunk-GID26AN4.js → chunk-P22LJ3Y2.js} +4 -6
  30. package/dist/{chunk-GID26AN4.js.map → chunk-P22LJ3Y2.js.map} +1 -1
  31. package/dist/{chunk-SJT4OBVL.js → chunk-SDPM6554.js} +3 -3
  32. package/dist/{chunk-D5JZ7UDZ.js → chunk-UCLVDLCH.js} +136 -50
  33. package/dist/chunk-UCLVDLCH.js.map +1 -0
  34. package/dist/chunk-UI4YMIN2.js +105 -0
  35. package/dist/chunk-UI4YMIN2.js.map +1 -0
  36. package/dist/chunk-VBQ3CRKH.js +291 -0
  37. package/dist/chunk-VBQ3CRKH.js.map +1 -0
  38. package/dist/{chunk-JKDNAOF5.js → chunk-W4L6C2XT.js} +2 -2
  39. package/dist/{chunk-GRCDRKII.js → chunk-WS3NZZQQ.js} +58 -20
  40. package/dist/chunk-WS3NZZQQ.js.map +1 -0
  41. package/dist/cli.js +3 -3
  42. package/dist/contract/index.d.ts +3221 -3094
  43. package/dist/contract/index.js +173 -42
  44. package/dist/contract/index.js.map +1 -1
  45. package/dist/control.js +2 -3
  46. package/dist/fuzz.d.ts +14 -1
  47. package/dist/fuzz.js +1 -1
  48. package/dist/hosted/index.d.ts +8 -1
  49. package/dist/index.d.ts +208 -690
  50. package/dist/index.js +185 -500
  51. package/dist/index.js.map +1 -1
  52. package/dist/openapi.json +1 -1
  53. package/dist/rl.d.ts +5 -100
  54. package/dist/rl.js +4 -5
  55. package/dist/rl.js.map +1 -1
  56. package/dist/rollout/index.d.ts +9 -1
  57. package/dist/rollout/index.js +6 -6
  58. package/dist/{run-campaign-I3JXKVAK.js → run-campaign-LVFKZCEU.js} +3 -3
  59. package/dist/supervisor-run/index.d.ts +156 -4
  60. package/dist/supervisor-run/index.js +14 -2
  61. package/dist/traces.js +2 -3
  62. package/dist/wire/index.d.ts +14 -1
  63. package/dist/wire/index.js +3 -3
  64. package/docs/campaign-proposers.md +363 -168
  65. package/docs/design/loop-taxonomy.md +142 -190
  66. package/docs/design.md +1 -1
  67. package/docs/distributed-driver.md +8 -11
  68. package/docs/feature-guide.md +20 -19
  69. package/docs/knowledge-readiness.md +2 -5
  70. package/docs/multi-shot-optimization.md +35 -27
  71. package/docs/rollout.md +5 -5
  72. package/package.json +4 -4
  73. package/dist/chunk-4Y7AAATF.js.map +0 -1
  74. package/dist/chunk-5PVZVCZB.js +0 -9190
  75. package/dist/chunk-5PVZVCZB.js.map +0 -1
  76. package/dist/chunk-A6GT67HT.js +0 -550
  77. package/dist/chunk-A6GT67HT.js.map +0 -1
  78. package/dist/chunk-D5JZ7UDZ.js.map +0 -1
  79. package/dist/chunk-DT7OXY3C.js.map +0 -1
  80. package/dist/chunk-EQUK3RFS.js.map +0 -1
  81. package/dist/chunk-GC4ATIKK.js +0 -317
  82. package/dist/chunk-GC4ATIKK.js.map +0 -1
  83. package/dist/chunk-GRCDRKII.js.map +0 -1
  84. package/dist/chunk-LOW3U7JZ.js +0 -328
  85. package/dist/chunk-LOW3U7JZ.js.map +0 -1
  86. package/dist/chunk-MGGFVCJ7.js +0 -288
  87. package/dist/chunk-MGGFVCJ7.js.map +0 -1
  88. package/dist/chunk-PMITBABE.js +0 -3841
  89. package/dist/chunk-PMITBABE.js.map +0 -1
  90. package/dist/chunk-R7ZRE2KV.js +0 -138
  91. package/dist/chunk-R7ZRE2KV.js.map +0 -1
  92. /package/dist/{chunk-R226UZOI.js.map → chunk-474LBSOX.js.map} +0 -0
  93. /package/dist/{chunk-HM6V7F3M.js.map → chunk-FO7HEH76.js.map} +0 -0
  94. /package/dist/{chunk-QFQZ3U3X.js.map → chunk-OCFJACJU.js.map} +0 -0
  95. /package/dist/{chunk-SJT4OBVL.js.map → chunk-SDPM6554.js.map} +0 -0
  96. /package/dist/{chunk-JKDNAOF5.js.map → chunk-W4L6C2XT.js.map} +0 -0
  97. /package/dist/{run-campaign-I3JXKVAK.js.map → run-campaign-LVFKZCEU.js.map} +0 -0
@@ -1,138 +0,0 @@
1
- // src/rollout/readers/opencode-sqlite.ts
2
- import { homedir } from "os";
3
- import { join } from "path";
4
- var DEFAULT_OPENCODE_DB = join(homedir(), ".local", "share", "opencode", "opencode.db");
5
- var NODE_SQLITE_SPECIFIER = ["node", "sqlite"].join(":");
6
- async function openOpencodeDb(path = DEFAULT_OPENCODE_DB) {
7
- try {
8
- const { DatabaseSync } = await import(
9
- /* @vite-ignore */
10
- NODE_SQLITE_SPECIFIER
11
- );
12
- const db = new DatabaseSync(path, { readOnly: true });
13
- db.prepare("SELECT id FROM session LIMIT 1").get();
14
- return db;
15
- } catch {
16
- return null;
17
- }
18
- }
19
- var isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
20
- function parseSessionRow(row) {
21
- let model = null;
22
- if (typeof row.model === "string" && row.model.length > 0) {
23
- try {
24
- const parsed = JSON.parse(row.model);
25
- if (isRecord(parsed)) model = parsed;
26
- } catch {
27
- model = null;
28
- }
29
- }
30
- return {
31
- id: String(row.id),
32
- parentId: row.parent_id === null || row.parent_id === void 0 ? null : String(row.parent_id),
33
- directory: String(row.directory),
34
- agent: row.agent === null || row.agent === void 0 ? null : String(row.agent),
35
- model,
36
- costUsd: Number(row.cost ?? 0),
37
- tokensInput: Number(row.tokens_input ?? 0),
38
- tokensOutput: Number(row.tokens_output ?? 0),
39
- tokensReasoning: Number(row.tokens_reasoning ?? 0),
40
- tokensCacheRead: Number(row.tokens_cache_read ?? 0),
41
- tokensCacheWrite: Number(row.tokens_cache_write ?? 0),
42
- timeCreated: Number(row.time_created ?? 0),
43
- timeUpdated: Number(row.time_updated ?? 0)
44
- };
45
- }
46
- var SESSION_COLUMNS = "id, parent_id, directory, agent, model, cost, tokens_input, tokens_output, tokens_reasoning, tokens_cache_read, tokens_cache_write, time_created, time_updated";
47
- function findOpencodeSessionsByDirectory(db, directory) {
48
- const rows = db.prepare(`SELECT ${SESSION_COLUMNS} FROM session WHERE directory = ? ORDER BY time_created`).all(directory);
49
- return rows.map(parseSessionRow);
50
- }
51
- function findOpencodeSessionById(db, sessionId) {
52
- const row = db.prepare(`SELECT ${SESSION_COLUMNS} FROM session WHERE id = ?`).get(sessionId);
53
- return row === void 0 ? null : parseSessionRow(row);
54
- }
55
- function toolResultContent(output) {
56
- if (typeof output === "string") return output;
57
- if (output === null || output === void 0) return "";
58
- return JSON.stringify(output);
59
- }
60
- function readOpencodeSessionMessages(db, sessionId) {
61
- const messageRows = db.prepare("SELECT id, data FROM message WHERE session_id = ? ORDER BY time_created, id").all(sessionId);
62
- const partsStmt = db.prepare("SELECT data FROM part WHERE message_id = ? ORDER BY id");
63
- const messages = [];
64
- for (const messageRow of messageRows) {
65
- let data;
66
- try {
67
- const parsed = JSON.parse(messageRow.data);
68
- if (!isRecord(parsed)) continue;
69
- data = parsed;
70
- } catch {
71
- continue;
72
- }
73
- const parts = [];
74
- for (const row of partsStmt.all(messageRow.id)) {
75
- try {
76
- const parsed = JSON.parse(row.data);
77
- if (isRecord(parsed)) parts.push(parsed);
78
- } catch {
79
- }
80
- }
81
- if (data.role === "user") {
82
- const text = parts.filter((p) => p.type === "text" && typeof p.text === "string").map((p) => p.text).join("\n");
83
- messages.push({ role: "user", content: text });
84
- continue;
85
- }
86
- if (data.role !== "assistant") continue;
87
- const steps = [];
88
- let current = [];
89
- for (const part of parts) {
90
- if (part.type === "step-start") {
91
- if (current.length > 0) steps.push(current);
92
- current = [];
93
- continue;
94
- }
95
- if (part.type === "step-finish" || part.type === "snapshot" || part.type === "patch") continue;
96
- current.push(part);
97
- }
98
- if (current.length > 0) steps.push(current);
99
- for (const step of steps) {
100
- const reasoning = step.filter((p) => p.type === "reasoning" && typeof p.text === "string" && p.text.length > 0).map((p) => p.text).join("\n");
101
- const text = step.filter((p) => p.type === "text" && typeof p.text === "string").map((p) => p.text).join("\n");
102
- const toolParts = step.filter((p) => p.type === "tool" && typeof p.callID === "string");
103
- const toolCalls = toolParts.map((p) => ({
104
- id: p.callID,
105
- type: "function",
106
- function: {
107
- name: p.tool ?? "unknown",
108
- arguments: JSON.stringify(p.state?.input ?? {})
109
- }
110
- }));
111
- if (reasoning.length === 0 && text.length === 0 && toolCalls.length === 0) continue;
112
- messages.push({
113
- role: "assistant",
114
- content: text.length > 0 ? text : null,
115
- ...reasoning.length > 0 ? { reasoning_content: reasoning } : {},
116
- ...toolCalls.length > 0 ? { tool_calls: toolCalls } : {}
117
- });
118
- for (const p of toolParts) {
119
- messages.push({
120
- role: "tool",
121
- tool_call_id: p.callID,
122
- name: p.tool ?? "unknown",
123
- content: toolResultContent(p.state?.output)
124
- });
125
- }
126
- }
127
- }
128
- return messages;
129
- }
130
-
131
- export {
132
- DEFAULT_OPENCODE_DB,
133
- openOpencodeDb,
134
- findOpencodeSessionsByDirectory,
135
- findOpencodeSessionById,
136
- readOpencodeSessionMessages
137
- };
138
- //# sourceMappingURL=chunk-R7ZRE2KV.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/rollout/readers/opencode-sqlite.ts"],"sourcesContent":["/**\n * Read-only backfill reader over the opencode sqlite store\n * (~/.local/share/opencode/opencode.db) → canonical chat-with-tools messages.\n *\n * Schema consumed (observed, 2026-07): `session` rows carry directory /\n * parent_id / agent / model / cost / tokens_*; `message` rows carry a JSON\n * `data` blob ({role, modelID, providerID, tokens, cost, finish}); `part`\n * rows carry the actual content ({type: text|reasoning|tool|step-start|\n * step-finish|snapshot…}). Tool parts hold {callID, state:{input, output,\n * status}} — both the call and its result, which we split into an assistant\n * tool_call plus a role:\"tool\" result message.\n *\n * The store is mutable and can be corrupt (a `.corrupt-bak` sibling ships\n * next to it in the wild), so `openOpencodeDb` returns null instead of\n * throwing — callers record a gap line, never crash the backfill.\n */\n\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\nimport type { DatabaseSync } from 'node:sqlite'\nimport type { ChatMessage, ChatToolCall } from '../schema'\n\nexport const DEFAULT_OPENCODE_DB = join(homedir(), '.local', 'share', 'opencode', 'opencode.db')\n\nexport interface OpencodeSessionRow {\n id: string\n parentId: string | null\n directory: string\n agent: string | null\n /** Raw session.model JSON: {id, providerID, variant} where present. */\n model: { id?: string; providerID?: string } | null\n costUsd: number\n tokensInput: number\n tokensOutput: number\n tokensReasoning: number\n tokensCacheRead: number\n tokensCacheWrite: number\n timeCreated: number\n timeUpdated: number\n}\n\n// Opaque specifier: esbuild (bundling) and Vite (tests) both rewrite an\n// analyzable dynamic import and strip the `node:` prefix under an es20xx\n// target, which turns this builtin into a bogus \"sqlite\" package lookup.\n// Composing the string at runtime defeats that analysis in both.\nconst NODE_SQLITE_SPECIFIER = ['node', 'sqlite'].join(':')\n\n/** Open the store read-only; null = unavailable/corrupt (caller records a gap). */\nexport async function openOpencodeDb(\n path: string = DEFAULT_OPENCODE_DB,\n): Promise<DatabaseSync | null> {\n try {\n const { DatabaseSync } = (await import(\n /* @vite-ignore */ NODE_SQLITE_SPECIFIER\n )) as typeof import('node:sqlite')\n const db = new DatabaseSync(path, { readOnly: true })\n // Probe: a corrupt store can open() fine and fail on first page read.\n db.prepare('SELECT id FROM session LIMIT 1').get()\n return db\n } catch {\n return null\n }\n}\n\nconst isRecord = (v: unknown): v is Record<string, unknown> =>\n typeof v === 'object' && v !== null && !Array.isArray(v)\n\nfunction parseSessionRow(row: Record<string, unknown>): OpencodeSessionRow {\n let model: OpencodeSessionRow['model'] = null\n if (typeof row.model === 'string' && row.model.length > 0) {\n try {\n const parsed: unknown = JSON.parse(row.model)\n if (isRecord(parsed)) model = parsed as { id?: string; providerID?: string }\n } catch {\n model = null\n }\n }\n return {\n id: String(row.id),\n parentId: row.parent_id === null || row.parent_id === undefined ? null : String(row.parent_id),\n directory: String(row.directory),\n agent: row.agent === null || row.agent === undefined ? null : String(row.agent),\n model,\n costUsd: Number(row.cost ?? 0),\n tokensInput: Number(row.tokens_input ?? 0),\n tokensOutput: Number(row.tokens_output ?? 0),\n tokensReasoning: Number(row.tokens_reasoning ?? 0),\n tokensCacheRead: Number(row.tokens_cache_read ?? 0),\n tokensCacheWrite: Number(row.tokens_cache_write ?? 0),\n timeCreated: Number(row.time_created ?? 0),\n timeUpdated: Number(row.time_updated ?? 0),\n }\n}\n\nconst SESSION_COLUMNS =\n 'id, parent_id, directory, agent, model, cost, tokens_input, tokens_output, tokens_reasoning, tokens_cache_read, tokens_cache_write, time_created, time_updated'\n\n/** Sessions whose cwd is `directory` (the worker-clone join key). */\nexport function findOpencodeSessionsByDirectory(\n db: DatabaseSync,\n directory: string,\n): OpencodeSessionRow[] {\n const rows = db\n .prepare(`SELECT ${SESSION_COLUMNS} FROM session WHERE directory = ? ORDER BY time_created`)\n .all(directory) as Array<Record<string, unknown>>\n return rows.map(parseSessionRow)\n}\n\nexport function findOpencodeSessionById(\n db: DatabaseSync,\n sessionId: string,\n): OpencodeSessionRow | null {\n const row = db.prepare(`SELECT ${SESSION_COLUMNS} FROM session WHERE id = ?`).get(sessionId) as\n | Record<string, unknown>\n | undefined\n return row === undefined ? null : parseSessionRow(row)\n}\n\ninterface OpencodePart {\n type?: string\n text?: string\n tool?: string\n callID?: string\n state?: { status?: string; input?: unknown; output?: unknown }\n}\n\nfunction toolResultContent(output: unknown): string {\n if (typeof output === 'string') return output\n if (output === null || output === undefined) return ''\n return JSON.stringify(output)\n}\n\n/**\n * Convert one session's message+part rows into canonical messages.\n * An opencode assistant message row spans several model steps; each step's\n * parts (reasoning → text → tool …) become one assistant message followed by\n * the role:\"tool\" results of its calls, preserving order.\n */\nexport function readOpencodeSessionMessages(db: DatabaseSync, sessionId: string): ChatMessage[] {\n const messageRows = db\n .prepare('SELECT id, data FROM message WHERE session_id = ? ORDER BY time_created, id')\n .all(sessionId) as Array<{ id: string; data: string }>\n const partsStmt = db.prepare('SELECT data FROM part WHERE message_id = ? ORDER BY id')\n\n const messages: ChatMessage[] = []\n for (const messageRow of messageRows) {\n let data: Record<string, unknown>\n try {\n const parsed: unknown = JSON.parse(messageRow.data)\n if (!isRecord(parsed)) continue\n data = parsed\n } catch {\n continue\n }\n const parts: OpencodePart[] = []\n for (const row of partsStmt.all(messageRow.id) as Array<{ data: string }>) {\n try {\n const parsed: unknown = JSON.parse(row.data)\n if (isRecord(parsed)) parts.push(parsed as OpencodePart)\n } catch {\n // Malformed part payload: skip the part, keep the message.\n }\n }\n\n if (data.role === 'user') {\n const text = parts\n .filter((p) => p.type === 'text' && typeof p.text === 'string')\n .map((p) => p.text as string)\n .join('\\n')\n messages.push({ role: 'user', content: text })\n continue\n }\n if (data.role !== 'assistant') continue\n\n // Split the row into steps at step-start boundaries; parts before the\n // first step-start (none observed, but tolerated) form an implicit step.\n const steps: OpencodePart[][] = []\n let current: OpencodePart[] = []\n for (const part of parts) {\n if (part.type === 'step-start') {\n if (current.length > 0) steps.push(current)\n current = []\n continue\n }\n if (part.type === 'step-finish' || part.type === 'snapshot' || part.type === 'patch') continue\n current.push(part)\n }\n if (current.length > 0) steps.push(current)\n\n for (const step of steps) {\n const reasoning = step\n .filter((p) => p.type === 'reasoning' && typeof p.text === 'string' && p.text.length > 0)\n .map((p) => p.text as string)\n .join('\\n')\n const text = step\n .filter((p) => p.type === 'text' && typeof p.text === 'string')\n .map((p) => p.text as string)\n .join('\\n')\n const toolParts = step.filter((p) => p.type === 'tool' && typeof p.callID === 'string')\n const toolCalls: ChatToolCall[] = toolParts.map((p) => ({\n id: p.callID as string,\n type: 'function',\n function: {\n name: p.tool ?? 'unknown',\n arguments: JSON.stringify(p.state?.input ?? {}),\n },\n }))\n if (reasoning.length === 0 && text.length === 0 && toolCalls.length === 0) continue\n messages.push({\n role: 'assistant',\n content: text.length > 0 ? text : null,\n ...(reasoning.length > 0 ? { reasoning_content: reasoning } : {}),\n ...(toolCalls.length > 0 ? { tool_calls: toolCalls } : {}),\n })\n for (const p of toolParts) {\n messages.push({\n role: 'tool',\n tool_call_id: p.callID as string,\n name: p.tool ?? 'unknown',\n content: toolResultContent(p.state?.output),\n })\n }\n }\n }\n return messages\n}\n"],"mappings":";AAiBA,SAAS,eAAe;AACxB,SAAS,YAAY;AAId,IAAM,sBAAsB,KAAK,QAAQ,GAAG,UAAU,SAAS,YAAY,aAAa;AAuB/F,IAAM,wBAAwB,CA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