@tangle-network/agent-eval 0.111.0 → 0.112.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/CHANGELOG.md +11 -0
- package/dist/analyst/index.d.ts +3 -3
- package/dist/analyst/index.js +8 -4
- package/dist/analyst/index.js.map +1 -1
- package/dist/benchmarks/index.js +3 -3
- package/dist/campaign/index.d.ts +1 -1
- package/dist/campaign/index.js +3 -3
- package/dist/{chunk-XRGOKCMO.js → chunk-4FRTXH2M.js} +3 -3
- package/dist/{chunk-7NX6ZSBG.js → chunk-DWLIGZBX.js} +145 -42
- package/dist/chunk-DWLIGZBX.js.map +1 -0
- package/dist/{chunk-2IY4ILP4.js → chunk-HJWNHCD5.js} +57 -2
- package/dist/chunk-HJWNHCD5.js.map +1 -0
- package/dist/{chunk-OW47B5WA.js → chunk-LVTGFSHF.js} +2 -2
- package/dist/{chunk-D2XDWRFX.js → chunk-QQVYMBCZ.js} +3 -3
- package/dist/contract/index.js +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -5
- package/dist/openapi.json +1 -1
- package/dist/{policy-edit-D2bBDZDf.d.ts → policy-edit-az2qRmvN.d.ts} +1 -1
- package/dist/{semantic-concept-judge-D7z6JCLZ.d.ts → semantic-concept-judge-CpzbtwD0.d.ts} +29 -1
- package/package.json +2 -2
- package/dist/chunk-2IY4ILP4.js.map +0 -1
- package/dist/chunk-7NX6ZSBG.js.map +0 -1
- /package/dist/{chunk-XRGOKCMO.js.map → chunk-4FRTXH2M.js.map} +0 -0
- /package/dist/{chunk-OW47B5WA.js.map → chunk-LVTGFSHF.js.map} +0 -0
- /package/dist/{chunk-D2XDWRFX.js.map → chunk-QQVYMBCZ.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@ All notable changes to `@tangle-network/agent-eval` and its sibling `agent-eval-
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
## [0.112.0] — 2026-07-10 — complete agent-surface findings
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Added typed finding subjects for skills, MCP servers and tools, hooks, subagents, workflows, rollout policy, generic agent-profile fields, and code paths.
|
|
12
|
+
- Routed every new subject into a typed policy edit so products do not need local string classifiers.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- Updated the direct `@tangle-network/agent-interface` dependency from `^0.10.0` to `^0.22.0`.
|
|
17
|
+
|
|
7
18
|
## [0.111.0] — 2026-07-09 — repository-clustered paired inference
|
|
8
19
|
|
|
9
20
|
### Added
|
package/dist/analyst/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { M as MultiLayerVerifier, V as VerifyOptions, S as Severity } from '../multi-layer-verifier-BsqKuLyN.js';
|
|
2
|
-
import { R as RunCritic, S as SemanticConceptJudgeOptions, a as RunTrace, b as SemanticConceptJudgeInput, B as BehavioralMetrics } from '../semantic-concept-judge-
|
|
3
|
-
export { C as CreateAnalystAiConfig, D as DEFAULT_TRACE_ANALYST_KINDS, c as DiffPolicy, F as FAILURE_MODE_KIND_SPEC, d as FINDING_SUBJECT_GRAMMAR_PROMPT, e as FINDING_SUBJECT_KINDS, f as
|
|
2
|
+
import { R as RunCritic, S as SemanticConceptJudgeOptions, a as RunTrace, b as SemanticConceptJudgeInput, B as BehavioralMetrics } from '../semantic-concept-judge-CpzbtwD0.js';
|
|
3
|
+
export { C as CreateAnalystAiConfig, D as DEFAULT_TRACE_ANALYST_KINDS, c as DiffPolicy, F as FAILURE_MODE_KIND_SPEC, d as FINDING_SUBJECT_GRAMMAR_PROMPT, e as FINDING_SUBJECT_KINDS, f as FINDING_SUBJECT_SYNTAX, g as FindingSubject, h as FindingSubjectKind, i as FindingSubjectStringSchema, j as FindingsDiff, k as FindingsStore, I as IMPROVEMENT_KIND_SPEC, K as KIND_EXPECTED_SUBJECTS, l as KNOWLEDGE_GAP_KIND_SPEC, m as KNOWLEDGE_POISONING_KIND_SPEC, P as PersistedFinding, n as SKILL_USAGE_ANALYST, o as SkillUsageAnalyst, p as SkillUsageRecord, q as SkillUsageReport, r as SkillUsageScanConfig, s as buildSkillUsageReport, t as createAnalystAi, u as defaultIsMaterial, v as diffFindings, w as emitSkillUsageFindings, x as findingSubjectGrammarPromptFor, y as parseFindingSubject, z as renderFindingSubject } from '../semantic-concept-judge-CpzbtwD0.js';
|
|
4
4
|
import { b as JudgeFn, a as JudgeInput } from '../types-C7DGg5ex.js';
|
|
5
5
|
import { a as Analyst, g as AnalystSeverity, A as AnalystFinding } from '../kind-factory-20hcaYpf.js';
|
|
6
6
|
export { h as ANALYST_SEVERITIES, b as AnalystContext, i as AnalystCost, j as AnalystInputKind, k as AnalystRequirements, f as AnalystRunEvent, e as AnalystRunInputs, d as AnalystRunResult, c as AnalystRunSummary, l as ChatCallOpts, C as ChatClient, m as ChatRequest, n as ChatResponse, o as ChatTransport, p as CliBridgeTransportOpts, q as CreateChatClientOpts, r as CreateTraceAnalystKindOpts, D as DirectProviderTransportOpts, E as EvidenceRef, M as MockTransportOpts, R as RAW_FINDING_SCHEMA_PROMPT, s as RawAnalystFinding, t as RawAnalystFindingSchema, u as RouterTransportOpts, S as SandboxSdkTransportOpts, v as TraceAnalystGolden, T as TraceAnalystKindSpec, w as computeFindingId, x as createChatClient, y as createTraceAnalystKind, z as makeFinding, B as parseRawFinding, F as renderPriorFindings } from '../kind-factory-20hcaYpf.js';
|
|
7
7
|
import { TCloud } from '@tangle-network/tcloud';
|
|
8
8
|
import { T as TraceAnalysisStore } from '../store-C1YxJDEK.js';
|
|
9
9
|
export { a as AnalystHooks, A as AnalystRegistry, b as AnalystRegistryOptions, B as BudgetPolicy, D as DefaultAnalystRegistryOptions, R as RegistryRunOpts, c as buildDefaultAnalystRegistry } from '../default-registry-Bcf1uKVI.js';
|
|
10
|
-
export { F as FindingToPolicyEditOptions, P as POLICY_EDIT_AXES, a as POLICY_EDIT_TARGET_SURFACES, b as PolicyEdit, c as PolicyEditAdmission, d as PolicyEditAdmissionOptions, e as PolicyEditAxis, f as PolicyEditChange, g as PolicyEditExpectedGain, h as PolicyEditGainDirection, i as PolicyEditGainUnit, j as PolicyEditInit, k as PolicyEditRisk, l as PolicyEditSchemaVersion, m as PolicyEditSource, n as PolicyEditTarget, o as PolicyEditTargetSurface, p as PolicyEditValidationError, q as admitPolicyEdit, r as applyPolicyEditToSurface, s as computePolicyEditId, t as isPolicyEdit, u as makePolicyEdit, v as policyEditFromFinding, w as policyEditsFromFindings, x as scorePolicyEditReadiness, y as validatePolicyEdit } from '../policy-edit-
|
|
10
|
+
export { F as FindingToPolicyEditOptions, P as POLICY_EDIT_AXES, a as POLICY_EDIT_TARGET_SURFACES, b as PolicyEdit, c as PolicyEditAdmission, d as PolicyEditAdmissionOptions, e as PolicyEditAxis, f as PolicyEditChange, g as PolicyEditExpectedGain, h as PolicyEditGainDirection, i as PolicyEditGainUnit, j as PolicyEditInit, k as PolicyEditRisk, l as PolicyEditSchemaVersion, m as PolicyEditSource, n as PolicyEditTarget, o as PolicyEditTargetSurface, p as PolicyEditValidationError, q as admitPolicyEdit, r as applyPolicyEditToSurface, s as computePolicyEditId, t as isPolicyEdit, u as makePolicyEdit, v as policyEditFromFinding, w as policyEditsFromFindings, x as scorePolicyEditReadiness, y as validatePolicyEdit } from '../policy-edit-az2qRmvN.js';
|
|
11
11
|
import { L as LlmClientOptions } from '../llm-client-DyqEH4jH.js';
|
|
12
12
|
import { AxFunction } from '@ax-llm/ax';
|
|
13
13
|
import '../verdict-C9MlYujm.js';
|
package/dist/analyst/index.js
CHANGED
|
@@ -11,12 +11,12 @@ import {
|
|
|
11
11
|
diffFindings,
|
|
12
12
|
emitSkillUsageFindings,
|
|
13
13
|
runSemanticConceptJudge
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-4FRTXH2M.js";
|
|
15
15
|
import {
|
|
16
16
|
behavioralAnalyst,
|
|
17
17
|
buildDefaultAnalystRegistry,
|
|
18
18
|
deriveEfficiencyFindings
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-LVTGFSHF.js";
|
|
20
20
|
import {
|
|
21
21
|
POLICY_EDIT_AXES,
|
|
22
22
|
POLICY_EDIT_TARGET_SURFACES,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
policyEditsFromFindings,
|
|
34
34
|
scorePolicyEditReadiness,
|
|
35
35
|
validatePolicyEdit
|
|
36
|
-
} from "../chunk-
|
|
36
|
+
} from "../chunk-HJWNHCD5.js";
|
|
37
37
|
import {
|
|
38
38
|
ANALYST_SEVERITIES,
|
|
39
39
|
AnalystRegistry,
|
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
FAILURE_MODE_KIND_SPEC,
|
|
42
42
|
FINDING_SUBJECT_GRAMMAR_PROMPT,
|
|
43
43
|
FINDING_SUBJECT_KINDS,
|
|
44
|
+
FINDING_SUBJECT_SYNTAX,
|
|
44
45
|
FindingSubjectStringSchema,
|
|
45
46
|
IMPROVEMENT_KIND_SPEC,
|
|
46
47
|
KIND_EXPECTED_SUBJECTS,
|
|
@@ -53,6 +54,7 @@ import {
|
|
|
53
54
|
coerceToFindingRows,
|
|
54
55
|
computeFindingId,
|
|
55
56
|
createTraceAnalystKind,
|
|
57
|
+
findingSubjectGrammarPromptFor,
|
|
56
58
|
makeFinding,
|
|
57
59
|
parseFindingSubject,
|
|
58
60
|
parseRawFinding,
|
|
@@ -60,7 +62,7 @@ import {
|
|
|
60
62
|
renderPriorFindings,
|
|
61
63
|
stripCodeFences,
|
|
62
64
|
structureFindings
|
|
63
|
-
} from "../chunk-
|
|
65
|
+
} from "../chunk-DWLIGZBX.js";
|
|
64
66
|
import "../chunk-LNQEP766.js";
|
|
65
67
|
import "../chunk-XJYR7XFV.js";
|
|
66
68
|
import "../chunk-VSMTAMNK.js";
|
|
@@ -297,6 +299,7 @@ export {
|
|
|
297
299
|
FAILURE_MODE_KIND_SPEC,
|
|
298
300
|
FINDING_SUBJECT_GRAMMAR_PROMPT,
|
|
299
301
|
FINDING_SUBJECT_KINDS,
|
|
302
|
+
FINDING_SUBJECT_SYNTAX,
|
|
300
303
|
FindingSubjectStringSchema,
|
|
301
304
|
FindingsStore,
|
|
302
305
|
IMPROVEMENT_KIND_SPEC,
|
|
@@ -332,6 +335,7 @@ export {
|
|
|
332
335
|
deriveEfficiencyFindings,
|
|
333
336
|
diffFindings,
|
|
334
337
|
emitSkillUsageFindings,
|
|
338
|
+
findingSubjectGrammarPromptFor,
|
|
335
339
|
isJudgeVerdict,
|
|
336
340
|
isPolicyEdit,
|
|
337
341
|
isTraceObservable,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/analyst/adapters.ts"],"sourcesContent":["/**\n * Adapter factories — lift each existing agent-eval primitive into the\n * Analyst contract without re-implementing it.\n *\n * Five primitives, five factories. Each one:\n * - Builds an Analyst with a stable id (caller chooses; defaults\n * given), a sensible default `inputKind`, a version derived from\n * the wrapped primitive's version + an adapter revision, and an\n * `analyze()` that calls the primitive and lifts its output to\n * AnalystFinding[] using `makeFinding()`.\n * - Maps severities: the existing `Severity` ('critical' | 'major' |\n * 'minor' | 'info') projects onto AnalystSeverity ('critical' |\n * 'high' | 'medium' | 'low' | 'info'); 'major' → 'high', 'minor' →\n * 'medium'. Domain analysts that want finer-grained mapping override.\n *\n * Adapters never own state. Calling the same factory twice with the\n * same primitive instance is safe.\n */\n\nimport type {\n Finding as LayerFinding,\n Severity as LayerSeverity,\n MultiLayerVerifier,\n VerifyOptions,\n} from '../multi-layer-verifier'\nimport { RunCritic, type RunTrace } from '../run-critic'\nimport {\n runSemanticConceptJudge,\n SEMANTIC_CONCEPT_JUDGE_VERSION,\n type SemanticConceptJudgeInput,\n type SemanticConceptJudgeOptions,\n} from '../semantic-concept-judge'\nimport type { JudgeFn, JudgeInput, JudgeScore, TCloud } from '../types'\nimport type { Analyst, AnalystFinding, AnalystSeverity } from './types'\nimport { makeFinding } from './types'\n\nconst ADAPTER_REV = '1'\n\n// ── Severity bridges ───────────────────────────────────────────────\n\nexport function liftSeverity(s: LayerSeverity): AnalystSeverity {\n switch (s) {\n case 'critical':\n return 'critical'\n case 'major':\n return 'high'\n case 'minor':\n return 'medium'\n case 'info':\n return 'info'\n }\n}\n\n// ── 1. MultiLayerVerifier → Analyst ─────────────────────────────────\n\nexport interface VerifierAdapterOpts<Env> {\n id?: string\n area?: string\n verifier: MultiLayerVerifier<Env>\n /**\n * The verifier expects an `env` per run. Adapters take it from\n * `AnalystRunInputs.custom[<id>]` via the registry's 'custom' routing.\n */\n options?: Omit<VerifyOptions<Env>, 'env'>\n}\n\nexport function createVerifierAdapter<Env>(opts: VerifierAdapterOpts<Env>): Analyst<Env> {\n const id = opts.id ?? 'multi-layer-verifier'\n const area = opts.area ?? 'verification'\n return {\n id,\n description:\n \"Runs a MultiLayerVerifier and lifts each layer's findings into the analyst envelope.\",\n inputKind: 'custom',\n cost: { kind: 'deterministic' },\n version: `verifier-${ADAPTER_REV}`,\n async analyze(env, ctx) {\n const report = await opts.verifier.run({ env, ...opts.options })\n const out: AnalystFinding[] = []\n for (const layer of report.layers) {\n for (const finding of layer.findings) {\n out.push(liftLayerFinding(id, area, layer.layer, finding))\n }\n // Layer-level signal: a failed/error layer is itself a finding\n // even if it didn't emit per-finding rows.\n if (layer.status === 'fail' || layer.status === 'error' || layer.status === 'timeout') {\n out.push(\n makeFinding({\n analyst_id: id,\n area,\n subject: layer.layer,\n claim: `layer \"${layer.layer}\" ${layer.status}: ${layer.reason ?? 'no reason given'}`,\n severity:\n layer.status === 'error' ? 'high' : layer.status === 'timeout' ? 'medium' : 'high',\n confidence: 1,\n evidence_refs: [],\n metadata: {\n layer_status: layer.status,\n duration_ms: layer.durationMs,\n score: layer.score,\n diagnostics: layer.diagnostics,\n },\n }),\n )\n }\n }\n ctx.log?.('verifier complete', {\n layers: report.layers.length,\n blended: report.blendedScore,\n all_pass: report.allPass,\n })\n return out\n },\n }\n}\n\nfunction liftLayerFinding(\n analyst_id: string,\n area: string,\n layer: string,\n f: LayerFinding,\n): AnalystFinding {\n return makeFinding({\n analyst_id,\n area,\n subject: f.layer ?? layer,\n claim: f.message,\n severity: liftSeverity(f.severity),\n confidence: 0.85,\n evidence_refs: f.evidence\n ? [{ kind: 'artifact', uri: 'inline:evidence', excerpt: f.evidence }]\n : [],\n metadata: f.detail,\n })\n}\n\n// ── 2. RunCritic → Analyst ──────────────────────────────────────────\n\nexport interface RunCriticAdapterOpts {\n id?: string\n area?: string\n critic?: RunCritic\n /** Optional threshold below which a dimension is reported as a finding. Default 0.5. */\n threshold?: number\n}\n\nexport function createRunCriticAdapter(opts: RunCriticAdapterOpts = {}): Analyst<RunTrace> {\n const id = opts.id ?? 'run-critic'\n const area = opts.area ?? 'run-quality'\n const critic = opts.critic ?? new RunCritic()\n const threshold = opts.threshold ?? 0.5\n return {\n id,\n description:\n 'Scores a single run across success / grounding / drift / tool-quality and surfaces below-threshold dimensions.',\n inputKind: 'custom',\n cost: { kind: 'deterministic' },\n version: `run-critic-${ADAPTER_REV}`,\n async analyze(trace) {\n const score = critic.scoreTrace(trace)\n const out: AnalystFinding[] = []\n const dims: Array<[keyof typeof score, AnalystSeverity, string]> = [\n ['success', 'critical', 'run did not complete successfully'],\n ['goalProgress', 'high', 'goal progress is low'],\n ['repoGroundedness', 'high', 'output is poorly grounded in the repository'],\n ['toolUseQuality', 'medium', 'tool use quality is low'],\n ['patchQuality', 'medium', 'no real patch/edit evidence'],\n ['testReality', 'high', 'no real test/build evidence'],\n ['finalGate', 'critical', 'final gate is blocking'],\n ]\n for (const [dim, sev, msg] of dims) {\n const value = score[dim] as number\n if (typeof value === 'number' && value < threshold) {\n out.push(\n makeFinding({\n analyst_id: id,\n area,\n subject: dim,\n claim: msg,\n rationale: `${dim}=${value.toFixed(2)} below threshold ${threshold}`,\n severity: sev,\n confidence: 1,\n evidence_refs: [],\n metadata: { dimension: dim, value, threshold, run_id: trace.run.runId },\n }),\n )\n }\n }\n // Drift penalty is high → surface as a finding (inverse threshold).\n if (score.driftPenalty > 1 - threshold) {\n out.push(\n makeFinding({\n analyst_id: id,\n area,\n subject: 'drift',\n claim: 'agent output drifted from repository signal',\n rationale: `driftPenalty=${score.driftPenalty.toFixed(2)}`,\n severity: 'medium',\n confidence: 0.9,\n evidence_refs: [],\n metadata: { drift_penalty: score.driftPenalty, notes: score.notes },\n }),\n )\n }\n return out\n },\n }\n}\n\n// ── 3. JudgeFn → Analyst ────────────────────────────────────────────\n\nexport interface JudgeAdapterOpts {\n id?: string\n area?: string\n judge: JudgeFn\n /** TCloud handle the JudgeFn calls. */\n tcloud: TCloud\n /** Optional cost classification — most judges call an LLM. */\n cost?: Analyst['cost']\n /** Optional threshold below which a JudgeScore becomes a finding. Default 6 (on 0-10 scale). */\n threshold?: number\n}\n\nexport function createJudgeAdapter(opts: JudgeAdapterOpts): Analyst<JudgeInput> {\n const id = opts.id ?? 'judge'\n const area = opts.area ?? 'judge'\n const threshold = opts.threshold ?? 6\n return {\n id,\n description:\n 'Wraps an agent-eval JudgeFn into an analyst; below-threshold dimensions surface as findings.',\n inputKind: 'judge-input',\n cost: opts.cost ?? { kind: 'llm' },\n version: `judge-${ADAPTER_REV}`,\n async analyze(input) {\n const scores = await opts.judge(opts.tcloud, input)\n return scores\n .filter((s) => normalize10(s.score) < threshold)\n .map((s) => liftJudgeScore(id, area, s))\n },\n }\n}\n\nfunction normalize10(s: number): number {\n // JudgeScore convention is 0-10 but some judges emit 0-1. Coerce to 0-10.\n return s <= 1 ? s * 10 : s\n}\n\nfunction liftJudgeScore(analyst_id: string, area: string, s: JudgeScore): AnalystFinding {\n const score10 = normalize10(s.score)\n const severity: AnalystSeverity =\n score10 < 3 ? 'critical' : score10 < 5 ? 'high' : score10 < 7 ? 'medium' : 'low'\n return makeFinding({\n analyst_id,\n area,\n subject: s.dimension,\n claim: `${s.judgeName}/${s.dimension} scored ${score10.toFixed(1)}/10`,\n rationale: s.reasoning,\n severity,\n confidence: 0.8,\n evidence_refs: s.evidence\n ? [{ kind: 'artifact', uri: 'inline:evidence', excerpt: s.evidence }]\n : [],\n // Provenance: this finding IS a judge verdict (an acceptance score), not an\n // observation of behavior. The steer firewall (assertNoJudgeVerdict) rejects\n // it from steering — even when it cites an artifact above — because letting a\n // verdict steer the next attempt is the held-out judge leaking into the loop.\n derived_from_judge: true,\n metadata: { judge_name: s.judgeName, dimension: s.dimension, score_10: score10 },\n })\n}\n\n// ── 4. SemanticConceptJudge → Analyst ──────────────────────────────\n\nexport interface SemanticConceptJudgeAdapterOpts {\n id?: string\n area?: string\n options?: SemanticConceptJudgeOptions\n}\n\nexport function createSemanticConceptJudgeAdapter(\n opts: SemanticConceptJudgeAdapterOpts = {},\n): Analyst<SemanticConceptJudgeInput> {\n const id = opts.id ?? 'semantic-concept-judge'\n const area = opts.area ?? 'concept-coverage'\n return {\n id,\n description:\n 'Runs the semantic-concept judge and surfaces missing / weak concepts as findings.',\n inputKind: 'custom',\n cost: { kind: 'llm', models: opts.options?.model ? [opts.options.model] : undefined },\n version: `${SEMANTIC_CONCEPT_JUDGE_VERSION}-adapter-${ADAPTER_REV}`,\n async analyze(input) {\n const result = await runSemanticConceptJudge(input, opts.options)\n if (!result.available) {\n return [\n makeFinding({\n analyst_id: id,\n area,\n claim: 'semantic-concept judge unavailable',\n rationale: result.error,\n severity: 'info',\n confidence: 1,\n evidence_refs: [],\n metadata: { reason: result.error },\n }),\n ]\n }\n const out: AnalystFinding[] = []\n for (const f of result.findings) {\n // Only surface gaps: missing concepts or low scores. Concepts at\n // 7+/10 with present=true are not findings — they're successes.\n if (f.present && f.score >= 7) continue\n out.push(\n makeFinding({\n analyst_id: id,\n area,\n subject: f.concept,\n claim: f.present\n ? `concept \"${f.concept}\" is weak (${f.score}/10)`\n : `concept \"${f.concept}\" is missing`,\n rationale: f.evidence,\n severity: liftSeverity(f.severity),\n confidence: 0.85,\n evidence_refs: [{ kind: 'artifact', uri: 'inline:evidence', excerpt: f.evidence }],\n metadata: {\n concept: f.concept,\n present: f.present,\n score_10: f.score,\n cost_usd: result.costUsd ?? undefined,\n },\n }),\n )\n }\n return out\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,IAAM,cAAc;AAIb,SAAS,aAAa,GAAmC;AAC9D,UAAQ,GAAG;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,EACX;AACF;AAeO,SAAS,sBAA2B,MAA8C;AACvF,QAAM,KAAK,KAAK,MAAM;AACtB,QAAM,OAAO,KAAK,QAAQ;AAC1B,SAAO;AAAA,IACL;AAAA,IACA,aACE;AAAA,IACF,WAAW;AAAA,IACX,MAAM,EAAE,MAAM,gBAAgB;AAAA,IAC9B,SAAS,YAAY,WAAW;AAAA,IAChC,MAAM,QAAQ,KAAK,KAAK;AACtB,YAAM,SAAS,MAAM,KAAK,SAAS,IAAI,EAAE,KAAK,GAAG,KAAK,QAAQ,CAAC;AAC/D,YAAM,MAAwB,CAAC;AAC/B,iBAAW,SAAS,OAAO,QAAQ;AACjC,mBAAW,WAAW,MAAM,UAAU;AACpC,cAAI,KAAK,iBAAiB,IAAI,MAAM,MAAM,OAAO,OAAO,CAAC;AAAA,QAC3D;AAGA,YAAI,MAAM,WAAW,UAAU,MAAM,WAAW,WAAW,MAAM,WAAW,WAAW;AACrF,cAAI;AAAA,YACF,YAAY;AAAA,cACV,YAAY;AAAA,cACZ;AAAA,cACA,SAAS,MAAM;AAAA,cACf,OAAO,UAAU,MAAM,KAAK,KAAK,MAAM,MAAM,KAAK,MAAM,UAAU,iBAAiB;AAAA,cACnF,UACE,MAAM,WAAW,UAAU,SAAS,MAAM,WAAW,YAAY,WAAW;AAAA,cAC9E,YAAY;AAAA,cACZ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YAAY,WAAW;AAAA,IACjE,MAAM,QAAQ,OAAO;AACnB,YAAM,SAAS,MAAM,wBAAwB,OAAO,KAAK,OAAO;AAChE,UAAI,CAAC,OAAO,WAAW;AACrB,eAAO;AAAA,UACL,YAAY;AAAA,YACV,YAAY;AAAA,YACZ;AAAA,YACA,OAAO;AAAA,YACP,WAAW,OAAO;AAAA,YAClB,UAAU;AAAA,YACV,YAAY;AAAA,YACZ,eAAe,CAAC;AAAA,YAChB,UAAU,EAAE,QAAQ,OAAO,MAAM;AAAA,UACnC,CAAC;AAAA,QACH;AAAA,MACF;AACA,YAAM,MAAwB,CAAC;AAC/B,iBAAW,KAAK,OAAO,UAAU;AAG/B,YAAI,EAAE,WAAW,EAAE,SAAS,EAAG;AAC/B,YAAI;AAAA,UACF,YAAY;AAAA,YACV,YAAY;AAAA,YACZ;AAAA,YACA,SAAS,EAAE;AAAA,YACX,OAAO,EAAE,UACL,YAAY,EAAE,OAAO,cAAc,EAAE,KAAK,SAC1C,YAAY,EAAE,OAAO;AAAA,YACzB,WAAW,EAAE;AAAA,YACb,UAAU,aAAa,EAAE,QAAQ;AAAA,YACjC,YAAY;AAAA,YACZ,eAAe,CAAC,EAAE,MAAM,YAAY,KAAK,mBAAmB,SAAS,EAAE,SAAS,CAAC;AAAA,YACjF,UAAU;AAAA,cACR,SAAS,EAAE;AAAA,cACX,SAAS,EAAE;AAAA,cACX,UAAU,EAAE;AAAA,cACZ,UAAU,OAAO,WAAW;AAAA,YAC9B;AAAA,UACF,CAAC;AAAA,QACH;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/analyst/adapters.ts"],"sourcesContent":["/**\n * Adapter factories — lift each existing agent-eval primitive into the\n * Analyst contract without re-implementing it.\n *\n * Five primitives, five factories. Each one:\n * - Builds an Analyst with a stable id (caller chooses; defaults\n * given), a sensible default `inputKind`, a version derived from\n * the wrapped primitive's version + an adapter revision, and an\n * `analyze()` that calls the primitive and lifts its output to\n * AnalystFinding[] using `makeFinding()`.\n * - Maps severities: the existing `Severity` ('critical' | 'major' |\n * 'minor' | 'info') projects onto AnalystSeverity ('critical' |\n * 'high' | 'medium' | 'low' | 'info'); 'major' → 'high', 'minor' →\n * 'medium'. Domain analysts that want finer-grained mapping override.\n *\n * Adapters never own state. Calling the same factory twice with the\n * same primitive instance is safe.\n */\n\nimport type {\n Finding as LayerFinding,\n Severity as LayerSeverity,\n MultiLayerVerifier,\n VerifyOptions,\n} from '../multi-layer-verifier'\nimport { RunCritic, type RunTrace } from '../run-critic'\nimport {\n runSemanticConceptJudge,\n SEMANTIC_CONCEPT_JUDGE_VERSION,\n type SemanticConceptJudgeInput,\n type SemanticConceptJudgeOptions,\n} from '../semantic-concept-judge'\nimport type { JudgeFn, JudgeInput, JudgeScore, TCloud } from '../types'\nimport type { Analyst, AnalystFinding, AnalystSeverity } from './types'\nimport { makeFinding } from './types'\n\nconst ADAPTER_REV = '1'\n\n// ── Severity bridges ───────────────────────────────────────────────\n\nexport function liftSeverity(s: LayerSeverity): AnalystSeverity {\n switch (s) {\n case 'critical':\n return 'critical'\n case 'major':\n return 'high'\n case 'minor':\n return 'medium'\n case 'info':\n return 'info'\n }\n}\n\n// ── 1. MultiLayerVerifier → Analyst ─────────────────────────────────\n\nexport interface VerifierAdapterOpts<Env> {\n id?: string\n area?: string\n verifier: MultiLayerVerifier<Env>\n /**\n * The verifier expects an `env` per run. Adapters take it from\n * `AnalystRunInputs.custom[<id>]` via the registry's 'custom' routing.\n */\n options?: Omit<VerifyOptions<Env>, 'env'>\n}\n\nexport function createVerifierAdapter<Env>(opts: VerifierAdapterOpts<Env>): Analyst<Env> {\n const id = opts.id ?? 'multi-layer-verifier'\n const area = opts.area ?? 'verification'\n return {\n id,\n description:\n \"Runs a MultiLayerVerifier and lifts each layer's findings into the analyst envelope.\",\n inputKind: 'custom',\n cost: { kind: 'deterministic' },\n version: `verifier-${ADAPTER_REV}`,\n async analyze(env, ctx) {\n const report = await opts.verifier.run({ env, ...opts.options })\n const out: AnalystFinding[] = []\n for (const layer of report.layers) {\n for (const finding of layer.findings) {\n out.push(liftLayerFinding(id, area, layer.layer, finding))\n }\n // Layer-level signal: a failed/error layer is itself a finding\n // even if it didn't emit per-finding rows.\n if (layer.status === 'fail' || layer.status === 'error' || layer.status === 'timeout') {\n out.push(\n makeFinding({\n analyst_id: id,\n area,\n subject: layer.layer,\n claim: `layer \"${layer.layer}\" ${layer.status}: ${layer.reason ?? 'no reason given'}`,\n severity:\n layer.status === 'error' ? 'high' : layer.status === 'timeout' ? 'medium' : 'high',\n confidence: 1,\n evidence_refs: [],\n metadata: {\n layer_status: layer.status,\n duration_ms: layer.durationMs,\n score: layer.score,\n diagnostics: layer.diagnostics,\n },\n }),\n )\n }\n }\n ctx.log?.('verifier complete', {\n layers: report.layers.length,\n blended: report.blendedScore,\n all_pass: report.allPass,\n })\n return out\n },\n }\n}\n\nfunction liftLayerFinding(\n analyst_id: string,\n area: string,\n layer: string,\n f: LayerFinding,\n): AnalystFinding {\n return makeFinding({\n analyst_id,\n area,\n subject: f.layer ?? layer,\n claim: f.message,\n severity: liftSeverity(f.severity),\n confidence: 0.85,\n evidence_refs: f.evidence\n ? [{ kind: 'artifact', uri: 'inline:evidence', excerpt: f.evidence }]\n : [],\n metadata: f.detail,\n })\n}\n\n// ── 2. RunCritic → Analyst ──────────────────────────────────────────\n\nexport interface RunCriticAdapterOpts {\n id?: string\n area?: string\n critic?: RunCritic\n /** Optional threshold below which a dimension is reported as a finding. Default 0.5. */\n threshold?: number\n}\n\nexport function createRunCriticAdapter(opts: RunCriticAdapterOpts = {}): Analyst<RunTrace> {\n const id = opts.id ?? 'run-critic'\n const area = opts.area ?? 'run-quality'\n const critic = opts.critic ?? new RunCritic()\n const threshold = opts.threshold ?? 0.5\n return {\n id,\n description:\n 'Scores a single run across success / grounding / drift / tool-quality and surfaces below-threshold dimensions.',\n inputKind: 'custom',\n cost: { kind: 'deterministic' },\n version: `run-critic-${ADAPTER_REV}`,\n async analyze(trace) {\n const score = critic.scoreTrace(trace)\n const out: AnalystFinding[] = []\n const dims: Array<[keyof typeof score, AnalystSeverity, string]> = [\n ['success', 'critical', 'run did not complete successfully'],\n ['goalProgress', 'high', 'goal progress is low'],\n ['repoGroundedness', 'high', 'output is poorly grounded in the repository'],\n ['toolUseQuality', 'medium', 'tool use quality is low'],\n ['patchQuality', 'medium', 'no real patch/edit evidence'],\n ['testReality', 'high', 'no real test/build evidence'],\n ['finalGate', 'critical', 'final gate is blocking'],\n ]\n for (const [dim, sev, msg] of dims) {\n const value = score[dim] as number\n if (typeof value === 'number' && value < threshold) {\n out.push(\n makeFinding({\n analyst_id: id,\n area,\n subject: dim,\n claim: msg,\n rationale: `${dim}=${value.toFixed(2)} below threshold ${threshold}`,\n severity: sev,\n confidence: 1,\n evidence_refs: [],\n metadata: { dimension: dim, value, threshold, run_id: trace.run.runId },\n }),\n )\n }\n }\n // Drift penalty is high → surface as a finding (inverse threshold).\n if (score.driftPenalty > 1 - threshold) {\n out.push(\n makeFinding({\n analyst_id: id,\n area,\n subject: 'drift',\n claim: 'agent output drifted from repository signal',\n rationale: `driftPenalty=${score.driftPenalty.toFixed(2)}`,\n severity: 'medium',\n confidence: 0.9,\n evidence_refs: [],\n metadata: { drift_penalty: score.driftPenalty, notes: score.notes },\n }),\n )\n }\n return out\n },\n }\n}\n\n// ── 3. JudgeFn → Analyst ────────────────────────────────────────────\n\nexport interface JudgeAdapterOpts {\n id?: string\n area?: string\n judge: JudgeFn\n /** TCloud handle the JudgeFn calls. */\n tcloud: TCloud\n /** Optional cost classification — most judges call an LLM. */\n cost?: Analyst['cost']\n /** Optional threshold below which a JudgeScore becomes a finding. Default 6 (on 0-10 scale). */\n threshold?: number\n}\n\nexport function createJudgeAdapter(opts: JudgeAdapterOpts): Analyst<JudgeInput> {\n const id = opts.id ?? 'judge'\n const area = opts.area ?? 'judge'\n const threshold = opts.threshold ?? 6\n return {\n id,\n description:\n 'Wraps an agent-eval JudgeFn into an analyst; below-threshold dimensions surface as findings.',\n inputKind: 'judge-input',\n cost: opts.cost ?? { kind: 'llm' },\n version: `judge-${ADAPTER_REV}`,\n async analyze(input) {\n const scores = await opts.judge(opts.tcloud, input)\n return scores\n .filter((s) => normalize10(s.score) < threshold)\n .map((s) => liftJudgeScore(id, area, s))\n },\n }\n}\n\nfunction normalize10(s: number): number {\n // JudgeScore convention is 0-10 but some judges emit 0-1. Coerce to 0-10.\n return s <= 1 ? s * 10 : s\n}\n\nfunction liftJudgeScore(analyst_id: string, area: string, s: JudgeScore): AnalystFinding {\n const score10 = normalize10(s.score)\n const severity: AnalystSeverity =\n score10 < 3 ? 'critical' : score10 < 5 ? 'high' : score10 < 7 ? 'medium' : 'low'\n return makeFinding({\n analyst_id,\n area,\n subject: s.dimension,\n claim: `${s.judgeName}/${s.dimension} scored ${score10.toFixed(1)}/10`,\n rationale: s.reasoning,\n severity,\n confidence: 0.8,\n evidence_refs: s.evidence\n ? [{ kind: 'artifact', uri: 'inline:evidence', excerpt: s.evidence }]\n : [],\n // Provenance: this finding IS a judge verdict (an acceptance score), not an\n // observation of behavior. The steer firewall (assertNoJudgeVerdict) rejects\n // it from steering — even when it cites an artifact above — because letting a\n // verdict steer the next attempt is the held-out judge leaking into the loop.\n derived_from_judge: true,\n metadata: { judge_name: s.judgeName, dimension: s.dimension, score_10: score10 },\n })\n}\n\n// ── 4. SemanticConceptJudge → Analyst ──────────────────────────────\n\nexport interface SemanticConceptJudgeAdapterOpts {\n id?: string\n area?: string\n options?: SemanticConceptJudgeOptions\n}\n\nexport function createSemanticConceptJudgeAdapter(\n opts: SemanticConceptJudgeAdapterOpts = {},\n): Analyst<SemanticConceptJudgeInput> {\n const id = opts.id ?? 'semantic-concept-judge'\n const area = opts.area ?? 'concept-coverage'\n return {\n id,\n description:\n 'Runs the semantic-concept judge and surfaces missing / weak concepts as findings.',\n inputKind: 'custom',\n cost: { kind: 'llm', models: opts.options?.model ? [opts.options.model] : undefined },\n version: `${SEMANTIC_CONCEPT_JUDGE_VERSION}-adapter-${ADAPTER_REV}`,\n async analyze(input) {\n const result = await runSemanticConceptJudge(input, opts.options)\n if (!result.available) {\n return [\n makeFinding({\n analyst_id: id,\n area,\n claim: 'semantic-concept judge unavailable',\n rationale: result.error,\n severity: 'info',\n confidence: 1,\n evidence_refs: [],\n metadata: { reason: result.error },\n }),\n ]\n }\n const out: AnalystFinding[] = []\n for (const f of result.findings) {\n // Only surface gaps: missing concepts or low scores. Concepts at\n // 7+/10 with present=true are not findings — they're successes.\n if (f.present && f.score >= 7) continue\n out.push(\n makeFinding({\n analyst_id: id,\n area,\n subject: f.concept,\n claim: f.present\n ? `concept \"${f.concept}\" is weak (${f.score}/10)`\n : `concept \"${f.concept}\" is missing`,\n rationale: f.evidence,\n severity: liftSeverity(f.severity),\n confidence: 0.85,\n evidence_refs: [{ kind: 'artifact', uri: 'inline:evidence', excerpt: f.evidence }],\n metadata: {\n concept: f.concept,\n present: f.present,\n score_10: f.score,\n cost_usd: result.costUsd ?? undefined,\n },\n }),\n )\n }\n return out\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,IAAM,cAAc;AAIb,SAAS,aAAa,GAAmC;AAC9D,UAAQ,GAAG;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,EACX;AACF;AAeO,SAAS,sBAA2B,MAA8C;AACvF,QAAM,KAAK,KAAK,MAAM;AACtB,QAAM,OAAO,KAAK,QAAQ;AAC1B,SAAO;AAAA,IACL;AAAA,IACA,aACE;AAAA,IACF,WAAW;AAAA,IACX,MAAM,EAAE,MAAM,gBAAgB;AAAA,IAC9B,SAAS,YAAY,WAAW;AAAA,IAChC,MAAM,QAAQ,KAAK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AAAA,YACb,UAAU,aAAa,EAAE,QAAQ;AAAA,YACjC,YAAY;AAAA,YACZ,eAAe,CAAC,EAAE,MAAM,YAAY,KAAK,mBAAmB,SAAS,EAAE,SAAS,CAAC;AAAA,YACjF,UAAU;AAAA,cACR,SAAS,EAAE;AAAA,cACX,SAAS,EAAE;AAAA,cACX,UAAU,EAAE;AAAA,cACZ,UAAU,OAAO,WAAW;AAAA,YAC9B;AAAA,UACF,CAAC;AAAA,QACH;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
|
package/dist/benchmarks/index.js
CHANGED
|
@@ -17,12 +17,12 @@ import {
|
|
|
17
17
|
runBenchmarkAdapter,
|
|
18
18
|
summarizeBenchmarkCampaign
|
|
19
19
|
} from "../chunk-VLNGPUJJ.js";
|
|
20
|
-
import "../chunk-
|
|
20
|
+
import "../chunk-QQVYMBCZ.js";
|
|
21
21
|
import "../chunk-RCXMWGRY.js";
|
|
22
22
|
import "../chunk-VI2UW6B6.js";
|
|
23
23
|
import "../chunk-XNCF3JU3.js";
|
|
24
|
-
import "../chunk-
|
|
25
|
-
import "../chunk-
|
|
24
|
+
import "../chunk-HJWNHCD5.js";
|
|
25
|
+
import "../chunk-DWLIGZBX.js";
|
|
26
26
|
import "../chunk-7QPK6W7R.js";
|
|
27
27
|
import "../chunk-VC43KQCK.js";
|
|
28
28
|
import "../chunk-RPDDVKI7.js";
|
package/dist/campaign/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { L as LlmClientOptions } from '../llm-client-DyqEH4jH.js';
|
|
|
13
13
|
import { AgentProfile } from '@tangle-network/agent-interface';
|
|
14
14
|
import { A as AgentEvalError } from '../errors-oeQrLqXC.js';
|
|
15
15
|
import { b as RunSplitTag, R as RunRecord } from '../run-record-DksGsfgv.js';
|
|
16
|
-
import { b as PolicyEdit, F as FindingToPolicyEditOptions, d as PolicyEditAdmissionOptions, c as PolicyEditAdmission } from '../policy-edit-
|
|
16
|
+
import { b as PolicyEdit, F as FindingToPolicyEditOptions, d as PolicyEditAdmissionOptions, c as PolicyEditAdmission } from '../policy-edit-az2qRmvN.js';
|
|
17
17
|
import { T as TraceAnalystKindSpec, A as AnalystFinding } from '../kind-factory-20hcaYpf.js';
|
|
18
18
|
import '@tangle-network/tcloud';
|
|
19
19
|
import '../raw-provider-sink-C46HDghv.js';
|
package/dist/campaign/index.js
CHANGED
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
skillOptProposer,
|
|
57
57
|
traceAnalystProposer,
|
|
58
58
|
userStoryScoreboard
|
|
59
|
-
} from "../chunk-
|
|
59
|
+
} from "../chunk-QQVYMBCZ.js";
|
|
60
60
|
import {
|
|
61
61
|
buildEvidenceVector,
|
|
62
62
|
buildLoopProvenanceRecord,
|
|
@@ -99,8 +99,8 @@ import {
|
|
|
99
99
|
runCampaign,
|
|
100
100
|
tangleTracesRoot
|
|
101
101
|
} from "../chunk-XNCF3JU3.js";
|
|
102
|
-
import "../chunk-
|
|
103
|
-
import "../chunk-
|
|
102
|
+
import "../chunk-HJWNHCD5.js";
|
|
103
|
+
import "../chunk-DWLIGZBX.js";
|
|
104
104
|
import "../chunk-7QPK6W7R.js";
|
|
105
105
|
import "../chunk-VC43KQCK.js";
|
|
106
106
|
import "../chunk-RPDDVKI7.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
aggregateRunScore,
|
|
3
3
|
clamp01
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-HJWNHCD5.js";
|
|
5
5
|
import {
|
|
6
6
|
computeFindingId
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DWLIGZBX.js";
|
|
8
8
|
import {
|
|
9
9
|
LlmClient,
|
|
10
10
|
callLlmJson
|
|
@@ -861,4 +861,4 @@ export {
|
|
|
861
861
|
runSemanticConceptJudge,
|
|
862
862
|
createSemanticConceptJudge
|
|
863
863
|
};
|
|
864
|
-
//# sourceMappingURL=chunk-
|
|
864
|
+
//# sourceMappingURL=chunk-4FRTXH2M.js.map
|
|
@@ -44,8 +44,16 @@ var FINDING_SUBJECT_KINDS = [
|
|
|
44
44
|
"knowledge.raw",
|
|
45
45
|
"knowledge.stale",
|
|
46
46
|
"system-prompt",
|
|
47
|
+
"skill",
|
|
47
48
|
"tool-doc",
|
|
48
49
|
"new-tool",
|
|
50
|
+
"mcp",
|
|
51
|
+
"hook",
|
|
52
|
+
"subagent",
|
|
53
|
+
"workflow",
|
|
54
|
+
"rollout-policy",
|
|
55
|
+
"agent-profile",
|
|
56
|
+
"code",
|
|
49
57
|
"rag",
|
|
50
58
|
"memory",
|
|
51
59
|
"scaffolding",
|
|
@@ -73,6 +81,8 @@ function parseFindingSubject(raw) {
|
|
|
73
81
|
if (stale) return { kind: "knowledge.stale", slug: stale[1] };
|
|
74
82
|
const sp = trimmed.match(/^system-prompt:(.+)$/);
|
|
75
83
|
if (sp && sp[1].trim().length > 0) return { kind: "system-prompt", section: sp[1].trim() };
|
|
84
|
+
const skill = trimmed.match(/^skill:([a-z0-9][a-z0-9_.-]*)$/);
|
|
85
|
+
if (skill) return { kind: "skill", name: skill[1] };
|
|
76
86
|
const tdAspect = trimmed.match(/^tool-doc:([a-z0-9][a-z0-9_-]*):(.+)$/);
|
|
77
87
|
if (tdAspect && tdAspect[2].trim().length > 0) {
|
|
78
88
|
return { kind: "tool-doc", tool: tdAspect[1], aspect: tdAspect[2].trim() };
|
|
@@ -81,6 +91,26 @@ function parseFindingSubject(raw) {
|
|
|
81
91
|
if (td) return { kind: "tool-doc", tool: td[1] };
|
|
82
92
|
const nt = trimmed.match(/^new-tool:([a-z0-9][a-z0-9_-]*)$/);
|
|
83
93
|
if (nt) return { kind: "new-tool", name: nt[1] };
|
|
94
|
+
const mcp = trimmed.match(/^mcp:([a-z0-9][a-z0-9_.-]*)(?::([a-z0-9][a-z0-9_.-]*))?$/);
|
|
95
|
+
if (mcp) {
|
|
96
|
+
return { kind: "mcp", server: mcp[1], ...mcp[2] ? { tool: mcp[2] } : {} };
|
|
97
|
+
}
|
|
98
|
+
const hook = trimmed.match(/^hook:([a-z0-9][a-z0-9_.-]*)$/);
|
|
99
|
+
if (hook) return { kind: "hook", name: hook[1] };
|
|
100
|
+
const subagent = trimmed.match(/^subagent:([a-z0-9][a-z0-9_.-]*)$/);
|
|
101
|
+
if (subagent) return { kind: "subagent", name: subagent[1] };
|
|
102
|
+
const workflow = trimmed.match(/^workflow:([a-z0-9][a-z0-9_.-]*)$/);
|
|
103
|
+
if (workflow) return { kind: "workflow", name: workflow[1] };
|
|
104
|
+
const rolloutPolicy = trimmed.match(/^rollout-policy:(.+)$/);
|
|
105
|
+
if (rolloutPolicy && rolloutPolicy[1].trim().length > 0) {
|
|
106
|
+
return { kind: "rollout-policy", field: rolloutPolicy[1].trim() };
|
|
107
|
+
}
|
|
108
|
+
const agentProfile = trimmed.match(/^agent-profile:(.+)$/);
|
|
109
|
+
if (agentProfile && agentProfile[1].trim().length > 0) {
|
|
110
|
+
return { kind: "agent-profile", field: agentProfile[1].trim() };
|
|
111
|
+
}
|
|
112
|
+
const code = trimmed.match(/^code:(.+)$/);
|
|
113
|
+
if (code && code[1].trim().length > 0) return { kind: "code", path: code[1].trim() };
|
|
84
114
|
const rag = trimmed.match(/^rag:([a-z0-9][a-z0-9_-]*):(.+)$/);
|
|
85
115
|
if (rag && rag[2].trim().length > 0) {
|
|
86
116
|
return { kind: "rag", corpus: rag[1], docId: rag[2].trim() };
|
|
@@ -112,10 +142,26 @@ function renderFindingSubject(s) {
|
|
|
112
142
|
return `agent-knowledge:stale:${s.slug}`;
|
|
113
143
|
case "system-prompt":
|
|
114
144
|
return `system-prompt:${s.section}`;
|
|
145
|
+
case "skill":
|
|
146
|
+
return `skill:${s.name}`;
|
|
115
147
|
case "tool-doc":
|
|
116
148
|
return s.aspect ? `tool-doc:${s.tool}:${s.aspect}` : `tool-doc:${s.tool}`;
|
|
117
149
|
case "new-tool":
|
|
118
150
|
return `new-tool:${s.name}`;
|
|
151
|
+
case "mcp":
|
|
152
|
+
return s.tool ? `mcp:${s.server}:${s.tool}` : `mcp:${s.server}`;
|
|
153
|
+
case "hook":
|
|
154
|
+
return `hook:${s.name}`;
|
|
155
|
+
case "subagent":
|
|
156
|
+
return `subagent:${s.name}`;
|
|
157
|
+
case "workflow":
|
|
158
|
+
return `workflow:${s.name}`;
|
|
159
|
+
case "rollout-policy":
|
|
160
|
+
return `rollout-policy:${s.field}`;
|
|
161
|
+
case "agent-profile":
|
|
162
|
+
return `agent-profile:${s.field}`;
|
|
163
|
+
case "code":
|
|
164
|
+
return `code:${s.path}`;
|
|
119
165
|
case "rag":
|
|
120
166
|
return `rag:${s.corpus}:${s.docId}`;
|
|
121
167
|
case "memory":
|
|
@@ -132,33 +178,62 @@ function renderFindingSubject(s) {
|
|
|
132
178
|
return s.label;
|
|
133
179
|
}
|
|
134
180
|
}
|
|
135
|
-
var
|
|
136
|
-
"
|
|
137
|
-
"",
|
|
138
|
-
"
|
|
139
|
-
"
|
|
140
|
-
"
|
|
141
|
-
"
|
|
142
|
-
"
|
|
143
|
-
"",
|
|
144
|
-
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
"
|
|
150
|
-
"
|
|
151
|
-
"
|
|
152
|
-
"",
|
|
153
|
-
|
|
154
|
-
"
|
|
155
|
-
"
|
|
156
|
-
"",
|
|
157
|
-
"
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
"
|
|
161
|
-
|
|
181
|
+
var FINDING_SUBJECT_SYNTAX = {
|
|
182
|
+
"knowledge.wiki": "agent-knowledge:wiki:<slug>[#<heading>]",
|
|
183
|
+
"knowledge.claim": "agent-knowledge:claim:<topic>",
|
|
184
|
+
"knowledge.raw": "agent-knowledge:raw:<source-id>",
|
|
185
|
+
"knowledge.stale": "agent-knowledge:stale:<slug>",
|
|
186
|
+
"system-prompt": "system-prompt:<section>",
|
|
187
|
+
skill: "skill:<name>",
|
|
188
|
+
"tool-doc": "tool-doc:<tool>[:<aspect>]",
|
|
189
|
+
"new-tool": "new-tool:<name>",
|
|
190
|
+
mcp: "mcp:<server>[:<tool>]",
|
|
191
|
+
hook: "hook:<name>",
|
|
192
|
+
subagent: "subagent:<name>",
|
|
193
|
+
workflow: "workflow:<name>",
|
|
194
|
+
"rollout-policy": "rollout-policy:<field>",
|
|
195
|
+
"agent-profile": "agent-profile:<field>",
|
|
196
|
+
code: "code:<path>",
|
|
197
|
+
rag: "rag:<corpus>:<doc-id>",
|
|
198
|
+
memory: "memory:<key>",
|
|
199
|
+
scaffolding: "scaffolding:<concern>",
|
|
200
|
+
"output-schema": "output-schema:<field>",
|
|
201
|
+
"websearch.outdated": "websearch:outdated:<topic>",
|
|
202
|
+
"prior-run-summary": "prior-run-summary:<topic>",
|
|
203
|
+
cluster: "<lowercase-cluster-label>"
|
|
204
|
+
};
|
|
205
|
+
var FINDING_SUBJECT_PURPOSE = {
|
|
206
|
+
"knowledge.wiki": "create or update a wiki page",
|
|
207
|
+
"knowledge.claim": "draft a claim or relation",
|
|
208
|
+
"knowledge.raw": "curate a raw source",
|
|
209
|
+
"knowledge.stale": "mark a stale page",
|
|
210
|
+
"system-prompt": "revise a system-prompt section",
|
|
211
|
+
skill: "create or revise a skill",
|
|
212
|
+
"tool-doc": "revise a tool contract",
|
|
213
|
+
"new-tool": "propose a new tool",
|
|
214
|
+
mcp: "revise an MCP server or tool",
|
|
215
|
+
hook: "revise a lifecycle hook",
|
|
216
|
+
subagent: "revise a delegated agent",
|
|
217
|
+
workflow: "revise an orchestration workflow",
|
|
218
|
+
"rollout-policy": "revise budget, sampling, or stop policy",
|
|
219
|
+
"agent-profile": "revise another AgentProfile field",
|
|
220
|
+
code: "revise an implementation path",
|
|
221
|
+
rag: "ingest or correct a RAG document",
|
|
222
|
+
memory: "invalidate or set memory",
|
|
223
|
+
scaffolding: "revise preconditions, retries, or verification",
|
|
224
|
+
"output-schema": "constrain the output shape",
|
|
225
|
+
"websearch.outdated": "identify a stale web result",
|
|
226
|
+
"prior-run-summary": "identify a stale prior-run summary",
|
|
227
|
+
cluster: "name one failure cluster"
|
|
228
|
+
};
|
|
229
|
+
function renderFindingSubjectGrammar(kinds) {
|
|
230
|
+
return [
|
|
231
|
+
"Subjects MUST match one of these forms \u2014 anything else is rejected at parse time:",
|
|
232
|
+
...kinds.map((kind) => ` ${FINDING_SUBJECT_SYNTAX[kind]} \u2014 ${FINDING_SUBJECT_PURPOSE[kind]}`),
|
|
233
|
+
"Runtime ids are lowercase [a-z0-9_.-]+. Topics, keys, paths, and sections are free-form and trimmed."
|
|
234
|
+
].join("\n");
|
|
235
|
+
}
|
|
236
|
+
var FINDING_SUBJECT_GRAMMAR_PROMPT = renderFindingSubjectGrammar(FINDING_SUBJECT_KINDS);
|
|
162
237
|
var KIND_EXPECTED_SUBJECTS = {
|
|
163
238
|
"failure-mode": ["cluster"],
|
|
164
239
|
"knowledge-gap": [
|
|
@@ -168,6 +243,10 @@ var KIND_EXPECTED_SUBJECTS = {
|
|
|
168
243
|
"knowledge.stale",
|
|
169
244
|
"tool-doc",
|
|
170
245
|
"system-prompt",
|
|
246
|
+
"skill",
|
|
247
|
+
"mcp",
|
|
248
|
+
"subagent",
|
|
249
|
+
"workflow",
|
|
171
250
|
"memory",
|
|
172
251
|
"websearch.outdated",
|
|
173
252
|
"prior-run-summary"
|
|
@@ -178,14 +257,25 @@ var KIND_EXPECTED_SUBJECTS = {
|
|
|
178
257
|
"knowledge.raw",
|
|
179
258
|
"tool-doc",
|
|
180
259
|
"system-prompt",
|
|
260
|
+
"skill",
|
|
261
|
+
"mcp",
|
|
262
|
+
"hook",
|
|
181
263
|
"memory",
|
|
182
264
|
"websearch.outdated",
|
|
183
265
|
"prior-run-summary"
|
|
184
266
|
],
|
|
185
267
|
improvement: [
|
|
186
268
|
"system-prompt",
|
|
269
|
+
"skill",
|
|
187
270
|
"tool-doc",
|
|
188
271
|
"new-tool",
|
|
272
|
+
"mcp",
|
|
273
|
+
"hook",
|
|
274
|
+
"subagent",
|
|
275
|
+
"workflow",
|
|
276
|
+
"rollout-policy",
|
|
277
|
+
"agent-profile",
|
|
278
|
+
"code",
|
|
189
279
|
"rag",
|
|
190
280
|
"memory",
|
|
191
281
|
"scaffolding",
|
|
@@ -194,6 +284,11 @@ var KIND_EXPECTED_SUBJECTS = {
|
|
|
194
284
|
"knowledge.claim"
|
|
195
285
|
]
|
|
196
286
|
};
|
|
287
|
+
function findingSubjectGrammarPromptFor(kindId) {
|
|
288
|
+
const kinds = KIND_EXPECTED_SUBJECTS[kindId];
|
|
289
|
+
if (!kinds) throw new Error(`unknown analyst kind: ${kindId}`);
|
|
290
|
+
return renderFindingSubjectGrammar(kinds);
|
|
291
|
+
}
|
|
197
292
|
var FindingSubjectStringSchema = z.string().refine((s) => parseFindingSubject(s) !== null, {
|
|
198
293
|
message: "subject does not match the finding-subject grammar"
|
|
199
294
|
});
|
|
@@ -580,8 +675,11 @@ function buildTraceToolsForGroup(group, store) {
|
|
|
580
675
|
}
|
|
581
676
|
|
|
582
677
|
// src/analyst/kinds/failure-mode.ts
|
|
678
|
+
var subjectGrammar = findingSubjectGrammarPromptFor("failure-mode");
|
|
583
679
|
var ACTOR_PROMPT = `You are a failure-mode classifier for an OTLP trace dataset. Your job is to identify the **distinct ways agents failed** in this dataset, not to grade individual runs.
|
|
584
680
|
|
|
681
|
+
${subjectGrammar}
|
|
682
|
+
|
|
585
683
|
DISCOVERY \u2192 CLUSTER \u2192 CITE protocol:
|
|
586
684
|
|
|
587
685
|
1. Call \`traces.getDatasetOverview({})\` first. Use \`has_errors\`, \`models\`, \`agent_names\`, \`tools\`, and \`sample_trace_ids\` to size the failure surface.
|
|
@@ -590,7 +688,7 @@ DISCOVERY \u2192 CLUSTER \u2192 CITE protocol:
|
|
|
590
688
|
4. **Cluster, do not enumerate.** Two failures with the same root cause should be ONE finding citing both traces, not two findings. The point of this analyst is to compress N runs into K modes.
|
|
591
689
|
5. For each cluster you can defend with evidence, emit ONE finding with:
|
|
592
690
|
- \`area\` = "failure-mode"
|
|
593
|
-
- \`subject\` = a
|
|
691
|
+
- \`subject\` = a lowercase cluster label matching the subject grammar above ("tool-call-loop", "auth-revoked-mid-run", ...)
|
|
594
692
|
- \`claim\` = one sentence stating the mode
|
|
595
693
|
- \`severity\` = "critical" when it blocks the run, "high" when the run finished degraded, "medium" when it slowed convergence
|
|
596
694
|
- \`evidence_uri\` = \`span://<trace_id>/<span_id>\` of the most representative span
|
|
@@ -623,10 +721,13 @@ var FAILURE_MODE_KIND_SPEC = {
|
|
|
623
721
|
};
|
|
624
722
|
|
|
625
723
|
// src/analyst/kinds/improvement.ts
|
|
724
|
+
var subjectGrammar2 = findingSubjectGrammarPromptFor("improvement");
|
|
626
725
|
var ACTOR_PROMPT2 = `You are a recursive-self-improvement analyst. Your job is to propose **concrete, locus-named edits** the agent's runtime should adopt to fix the failure modes, knowledge gaps, and poisonings present in this dataset.
|
|
627
726
|
|
|
628
727
|
Upstream analysts have already classified the problems. Your job is to convert each problem into a *change to make* and grade its expected leverage. Each finding is one proposed edit.
|
|
629
728
|
|
|
729
|
+
${subjectGrammar2}
|
|
730
|
+
|
|
630
731
|
DISCOVERY \u2192 CANDIDATE-FIXES \u2192 COMPETE \u2192 CITE protocol:
|
|
631
732
|
|
|
632
733
|
1. \`traces.getDatasetOverview({})\` first. Note the agents, tools, and any system-prompt fingerprints (look for the prompt text echoed in early spans).
|
|
@@ -638,13 +739,16 @@ DISCOVERY \u2192 CANDIDATE-FIXES \u2192 COMPETE \u2192 CITE protocol:
|
|
|
638
739
|
- **Memory invalidation** \u2014 clear cached prior-run decisions that no longer apply
|
|
639
740
|
- **Scaffolding** \u2014 add a precondition check, a retry policy, a turn budget, a verification step
|
|
640
741
|
- **Output schema** \u2014 narrow the agent's output to forbid the failure shape
|
|
742
|
+
- **Skill / MCP / hook / subagent** \u2014 change the reusable profile component responsible for the behavior
|
|
743
|
+
- **Workflow / rollout policy** \u2014 change orchestration, budget, sampling, or stopping behavior
|
|
744
|
+
- **Code** \u2014 change an implementation path when profile edits cannot repair the behavior
|
|
641
745
|
3. **Compete candidate fixes via subagents.** For each failure cluster, spawn one \`llmQuery\` per candidate-fix axis you want to evaluate. Each subagent's job: simulate the fix on the cited traces and report (i) likely effect, (ii) side effects, (iii) implementation cost as small/medium/large. Pass the cluster's failing trace_ids and the candidate axis as context.
|
|
642
746
|
4. After subagents return, **pick the winning candidate per cluster** based on (effect / cost) and emit ONE finding. Discard the losing candidates \u2014 the output is the recommendation, not the candidate set.
|
|
643
747
|
5. **Cross-reference upstream findings.** If a finding cites a prior failure-mode or knowledge-gap finding, use \`evidence_uri = "finding://<prior-finding-id>"\` (the registry supports this kind). This builds the dependency graph that lets the dashboard show "fix #X resolves failure modes A, B, C."
|
|
644
748
|
|
|
645
749
|
For each winning recommendation, emit ONE finding with:
|
|
646
750
|
- \`area\` = "improvement"
|
|
647
|
-
- \`subject\` =
|
|
751
|
+
- \`subject\` = one exact locus form from the subject grammar above
|
|
648
752
|
- \`claim\` = one sentence stating the edit ("Add a precondition check to refuse tool X calls without arg Y")
|
|
649
753
|
- \`severity\` = leverage rating: "critical" when fix resolves a critical failure mode; "high" when it resolves a high; "medium" when it's a quality-of-life win; "info" when it's a cleanup with no behavioral effect
|
|
650
754
|
- \`evidence_uri\` = the failure-mode finding id this fix targets (\`finding://<id>\`) when it exists; else the most representative span
|
|
@@ -674,10 +778,13 @@ var IMPROVEMENT_KIND_SPEC = {
|
|
|
674
778
|
};
|
|
675
779
|
|
|
676
780
|
// src/analyst/kinds/knowledge-gap.ts
|
|
781
|
+
var subjectGrammar3 = findingSubjectGrammarPromptFor("knowledge-gap");
|
|
677
782
|
var ACTOR_PROMPT3 = `You are a knowledge-gap analyst for an OTLP trace dataset. Your job is to identify the **specific pieces of information the agent lacked, or that were stale**, that caused poor decisions.
|
|
678
783
|
|
|
679
784
|
The agent under analysis maintains a curated knowledge base via \`@tangle-network/agent-knowledge\` \u2014 a wiki of \`KnowledgePage\`s with raw source anchors, claims, and relations. The primary expected store of agent-knowable facts IS that wiki. A "knowledge gap" is anything the agent had to discover or guess at run-time that the wiki should have held \u2014 or an outdated/contradictory fact the agent picked up from a non-wiki source.
|
|
680
785
|
|
|
786
|
+
${subjectGrammar3}
|
|
787
|
+
|
|
681
788
|
DISCOVERY \u2192 ATTRIBUTE-TO-LAYER \u2192 CITE protocol:
|
|
682
789
|
|
|
683
790
|
1. \`traces.getDatasetOverview({})\` first. Note which agents, tools, and models appear.
|
|
@@ -690,19 +797,10 @@ DISCOVERY \u2192 ATTRIBUTE-TO-LAYER \u2192 CITE protocol:
|
|
|
690
797
|
- Agent quoting a tool's docs / system prompt incorrectly because the actual text was insufficient
|
|
691
798
|
- Fabricated identifiers that don't appear in dataset \`sample_trace_ids\`
|
|
692
799
|
Use \`traces.searchTrace\` with patterns like \`I (don.?t|do not) know\`, \`assumed\`, \`unclear\`, \`could you (clarify|tell me|provide)\`, \`not found\`, \`undefined\`, \`unknown\`, \`null\`, dates older than the analysis window, or the agent's specific clarification phrases.
|
|
693
|
-
3. For each gap, identify the **layer of the runtime that should have prevented it
|
|
694
|
-
- \`agent-knowledge:wiki:<page-slug>\` \u2014 the wiki page that should exist but doesn't, or exists but lacks the claim
|
|
695
|
-
- \`agent-knowledge:wiki:<page-slug>#<heading>\` \u2014 wiki page exists but a specific section is missing
|
|
696
|
-
- \`agent-knowledge:claim:<topic>\` \u2014 a specific claim/relation triple that should be in the wiki
|
|
697
|
-
- \`agent-knowledge:raw:<source-id>\` \u2014 raw source captured but never lifted into a curated page
|
|
698
|
-
- \`agent-knowledge:stale:<page-slug>\` \u2014 wiki page exists but contradicts ground-truth evidence in this trace (the wiki itself drifted)
|
|
699
|
-
- \`websearch:outdated:<topic>\` \u2014 agent relied on a web result that was stale; wiki should have superseded it
|
|
700
|
-
- \`tool-doc:<tool-name>:<aspect>\` \u2014 tool description missed a behavior aspect (return shape, failure modes, side effects)
|
|
701
|
-
- \`system-prompt:<section>\` \u2014 system prompt should have stated the rule directly
|
|
702
|
-
- \`memory:<key>\` \u2014 prior-run memory should have surfaced an earlier decision
|
|
800
|
+
3. For each gap, identify the **layer of the runtime that should have prevented it** and use its exact locus from the subject grammar above.
|
|
703
801
|
4. For each gap you can defend with evidence, emit ONE finding with:
|
|
704
802
|
- \`area\` = "knowledge-gap"
|
|
705
|
-
- \`subject\` =
|
|
803
|
+
- \`subject\` = one exact locus form from the subject grammar above
|
|
706
804
|
- \`claim\` = a sentence naming the missing or stale knowledge ("wiki has no page on invoice line-item shape, agent had to re-derive it from raw spans")
|
|
707
805
|
- \`severity\` = "high" when the gap caused a failure or a clarifying question; "medium" when it caused unnecessary turns; "low" when it caused minor inefficiency
|
|
708
806
|
- \`evidence_uri\` = \`span://<trace_id>/<span_id>\` of the moment the gap surfaced (the question, the self-correction, the retrieval miss, the stale web result)
|
|
@@ -730,8 +828,11 @@ var KNOWLEDGE_GAP_KIND_SPEC = {
|
|
|
730
828
|
};
|
|
731
829
|
|
|
732
830
|
// src/analyst/kinds/knowledge-poisoning.ts
|
|
831
|
+
var subjectGrammar4 = findingSubjectGrammarPromptFor("knowledge-poisoning");
|
|
733
832
|
var ACTOR_PROMPT4 = `You are a knowledge-poisoning analyst for an OTLP trace dataset. Your job is to identify cases where the agent **confidently used wrong information** \u2014 not where it lacked information (that's the knowledge-gap analyst).
|
|
734
833
|
|
|
834
|
+
${subjectGrammar4}
|
|
835
|
+
|
|
735
836
|
DISCOVERY \u2192 DUAL-VERIFY \u2192 CITE protocol:
|
|
736
837
|
|
|
737
838
|
1. \`traces.getDatasetOverview({})\` first. Identify the agents, models, and tools.
|
|
@@ -752,7 +853,7 @@ DISCOVERY \u2192 DUAL-VERIFY \u2192 CITE protocol:
|
|
|
752
853
|
|
|
753
854
|
For each confirmed poisoning, emit ONE finding with:
|
|
754
855
|
- \`area\` = "knowledge-poisoning"
|
|
755
|
-
- \`subject\` = the source of the false belief
|
|
856
|
+
- \`subject\` = the source of the false belief using one exact form from the subject grammar above
|
|
756
857
|
- \`claim\` = one sentence: "agent believed X (from source S); evidence in trace shows X is false"
|
|
757
858
|
- \`severity\` = "critical" when poisoning caused a wrong user-visible action; "high" when caught internally but wasted significant work; "medium" for inefficiency only
|
|
758
859
|
- \`evidence_uri\` = \`span://<trace_id>/<span_id>\` of the action span (the moment the agent acted on the false belief)
|
|
@@ -1024,8 +1125,10 @@ export {
|
|
|
1024
1125
|
FINDING_SUBJECT_KINDS,
|
|
1025
1126
|
parseFindingSubject,
|
|
1026
1127
|
renderFindingSubject,
|
|
1128
|
+
FINDING_SUBJECT_SYNTAX,
|
|
1027
1129
|
FINDING_SUBJECT_GRAMMAR_PROMPT,
|
|
1028
1130
|
KIND_EXPECTED_SUBJECTS,
|
|
1131
|
+
findingSubjectGrammarPromptFor,
|
|
1029
1132
|
FindingSubjectStringSchema,
|
|
1030
1133
|
stripCodeFences,
|
|
1031
1134
|
coerceJson,
|
|
@@ -1045,4 +1148,4 @@ export {
|
|
|
1045
1148
|
DEFAULT_TRACE_ANALYST_KINDS,
|
|
1046
1149
|
AnalystRegistry
|
|
1047
1150
|
};
|
|
1048
|
-
//# sourceMappingURL=chunk-
|
|
1151
|
+
//# sourceMappingURL=chunk-DWLIGZBX.js.map
|