@tangle-network/agent-eval 0.187.2 → 0.188.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 +55 -0
- package/dist/adapters/http.d.ts +2 -2
- package/dist/{agent-profile-uAIQK3Nr.d.ts → agent-profile-CfbuZk8b.d.ts} +4 -4
- package/dist/{agent-profile-uAIQK3Nr.d.ts.map → agent-profile-CfbuZk8b.d.ts.map} +1 -1
- package/dist/analyst/index.d.ts +12 -12
- package/dist/analyst/index.d.ts.map +1 -1
- package/dist/analyst/index.js +6 -6
- package/dist/{analyze-runs-DapYZz02.d.ts → analyze-runs-CLz5O01x.d.ts} +5 -5
- package/dist/{analyze-runs-DapYZz02.d.ts.map → analyze-runs-CLz5O01x.d.ts.map} +1 -1
- package/dist/{benchmark-command-DGokT8zd.js → benchmark-command-CdUGku3W.js} +12 -12
- package/dist/benchmark-command-CdUGku3W.js.map +1 -0
- package/dist/benchmarks/index.d.ts +4 -4
- package/dist/benchmarks/index.js +3 -3
- package/dist/builder-eval/index.d.ts +3 -3
- package/dist/builder-eval/index.js +1 -1
- package/dist/campaign/index.d.ts +5 -5
- package/dist/campaign/index.js +5 -5
- package/dist/{campaign-DlxdTOvw.js → campaign-DZuysBbS.js} +6 -6
- package/dist/{campaign-DlxdTOvw.js.map → campaign-DZuysBbS.js.map} +1 -1
- package/dist/{chat-client-DqPqWzVV.js → chat-client-C4dg7Ng_.js} +2 -2
- package/dist/{chat-client-DqPqWzVV.js.map → chat-client-C4dg7Ng_.js.map} +1 -1
- package/dist/{chat-json-call-C-DnDxEy.js → chat-json-call-JVGbfx95.js} +2 -2
- package/dist/{chat-json-call-C-DnDxEy.js.map → chat-json-call-JVGbfx95.js.map} +1 -1
- package/dist/cli.js +4 -4
- package/dist/{client-DCc7a8ZC.d.ts → client-CFj9dfcn.d.ts} +4 -4
- package/dist/{client-DCc7a8ZC.d.ts.map → client-CFj9dfcn.d.ts.map} +1 -1
- package/dist/contract/index.d.ts +11 -11
- package/dist/contract/index.js +6 -6
- package/dist/{counterfactual-CLgrwhkY.d.ts → counterfactual-CPaWN99-.d.ts} +4 -4
- package/dist/{counterfactual-CLgrwhkY.d.ts.map → counterfactual-CPaWN99-.d.ts.map} +1 -1
- package/dist/{counterfactual-Bjq1mlUu.js → counterfactual-DtMWvn7D.js} +2 -2
- package/dist/{counterfactual-Bjq1mlUu.js.map → counterfactual-DtMWvn7D.js.map} +1 -1
- package/dist/{default-registry-DMxeb4GD.d.ts → default-registry-BLsGfnoO.d.ts} +6 -6
- package/dist/{default-registry-DMxeb4GD.d.ts.map → default-registry-BLsGfnoO.d.ts.map} +1 -1
- package/dist/{default-registry-Ca2IWH1X.js → default-registry-BtZ_t-9b.js} +2 -2
- package/dist/{default-registry-Ca2IWH1X.js.map → default-registry-BtZ_t-9b.js.map} +1 -1
- package/dist/{define-agent-eval-C0EqJ9Gz.js → define-agent-eval-ChtddasD.js} +3 -3
- package/dist/{define-agent-eval-C0EqJ9Gz.js.map → define-agent-eval-ChtddasD.js.map} +1 -1
- package/dist/{define-agent-eval-CGBwPPaq.d.ts → define-agent-eval-CsicmDxt.d.ts} +7 -7
- package/dist/{define-agent-eval-CGBwPPaq.d.ts.map → define-agent-eval-CsicmDxt.d.ts.map} +1 -1
- package/dist/diagnosis/index.d.ts +38 -96
- package/dist/diagnosis/index.d.ts.map +1 -1
- package/dist/diagnosis/index.js +83 -134
- package/dist/diagnosis/index.js.map +1 -1
- package/dist/{dspy-rlm-engine-BE9lCzzL.js → dspy-rlm-engine-sPX7B5ac.js} +3 -3
- package/dist/{dspy-rlm-engine-BE9lCzzL.js.map → dspy-rlm-engine-sPX7B5ac.js.map} +1 -1
- package/dist/emitter-DbMXUIVP.js +334 -0
- package/dist/emitter-DbMXUIVP.js.map +1 -0
- package/dist/{emitter-Cs0egaFd.d.ts → emitter-HcCmFQl_.d.ts} +37 -6
- package/dist/emitter-HcCmFQl_.d.ts.map +1 -0
- package/dist/{engine-DNlKhIm0.d.ts → engine-Gw2n1irt.d.ts} +15 -5
- package/dist/engine-Gw2n1irt.d.ts.map +1 -0
- package/dist/{eval-campaign-XFHEpN86.js → eval-campaign-CeotQ1ZR.js} +7 -4
- package/dist/{eval-campaign-XFHEpN86.js.map → eval-campaign-CeotQ1ZR.js.map} +1 -1
- package/dist/evaluation.d.ts +2 -2
- package/dist/{exact-types-BEHN7tnq.d.ts → exact-types-CrhPoDp8.d.ts} +2 -2
- package/dist/{exact-types-BEHN7tnq.d.ts.map → exact-types-CrhPoDp8.d.ts.map} +1 -1
- package/dist/experiment/index.d.ts +3 -3
- package/dist/experiment/index.js +1 -2
- package/dist/experiment/index.js.map +1 -1
- package/dist/{external-optimizer-process-BbhvXTFx.js → external-optimizer-process-D3BLpZyR.js} +2 -2
- package/dist/{external-optimizer-process-BbhvXTFx.js.map → external-optimizer-process-D3BLpZyR.js.map} +1 -1
- package/dist/{external-optimizer-subprocess-DMgmqTB6.js → external-optimizer-subprocess-BrfsgL92.js} +2 -2
- package/dist/{external-optimizer-subprocess-DMgmqTB6.js.map → external-optimizer-subprocess-BrfsgL92.js.map} +1 -1
- package/dist/{failure-cluster-OldNRoAt.d.ts → failure-cluster-CbgEDcFJ.d.ts} +3 -3
- package/dist/{failure-cluster-OldNRoAt.d.ts.map → failure-cluster-CbgEDcFJ.d.ts.map} +1 -1
- package/dist/failure-taxonomy-CjabTATj.js +538 -0
- package/dist/failure-taxonomy-CjabTATj.js.map +1 -0
- package/dist/{feedback-trajectory-CytTR7u4.d.ts → feedback-trajectory-BJi4t3Vf.d.ts} +6 -6
- package/dist/{feedback-trajectory-CytTR7u4.d.ts.map → feedback-trajectory-BJi4t3Vf.d.ts.map} +1 -1
- package/dist/hosted/index.d.ts +2 -2
- package/dist/{index-CKZa_rnt.d.ts → index-B-s8qDRJ.d.ts} +2 -2
- package/dist/{index-CKZa_rnt.d.ts.map → index-B-s8qDRJ.d.ts.map} +1 -1
- package/dist/{index-YZrbnBSV.d.ts → index-BD1oSbHr.d.ts} +11 -11
- package/dist/{index-YZrbnBSV.d.ts.map → index-BD1oSbHr.d.ts.map} +1 -1
- package/dist/{index-vYNHCV2G.d.ts → index-Ca0_IjFu.d.ts} +7 -7
- package/dist/{index-vYNHCV2G.d.ts.map → index-Ca0_IjFu.d.ts.map} +1 -1
- package/dist/{index-BRsrfSHT.d.ts → index-eTTnPe3r.d.ts} +9 -9
- package/dist/{index-BRsrfSHT.d.ts.map → index-eTTnPe3r.d.ts.map} +1 -1
- package/dist/index.d.ts +383 -68
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1482 -207
- package/dist/index.js.map +1 -1
- package/dist/{insight-report-DpOo-3iL.d.ts → insight-report-DeE1solA.d.ts} +4 -4
- package/dist/{insight-report-DpOo-3iL.d.ts.map → insight-report-DeE1solA.d.ts.map} +1 -1
- package/dist/{integrity-Cy9WHAtb.js → integrity-BFP4kjGj.js} +6 -1
- package/dist/integrity-BFP4kjGj.js.map +1 -0
- package/dist/{integrity-rGOfSUle.d.ts → integrity-CaeNeusS.d.ts} +4 -4
- package/dist/integrity-CaeNeusS.d.ts.map +1 -0
- package/dist/jev.d.ts +2 -2
- package/dist/{kind-factory-V79Hw0AU.js → kind-factory-g1ROw67A.js} +15 -4
- package/dist/{kind-factory-V79Hw0AU.js.map → kind-factory-g1ROw67A.js.map} +1 -1
- package/dist/{llm-client-DDhZ29Vm.js → llm-client-DF9bPNYA.js} +2 -2
- package/dist/{llm-client-DDhZ29Vm.js.map → llm-client-DF9bPNYA.js.map} +1 -1
- package/dist/{llm-judge-BVso5x-u.js → llm-judge-DF18J3CR.js} +9 -9
- package/dist/llm-judge-DF18J3CR.js.map +1 -0
- package/dist/{matrix-CPKsRY8Y.d.ts → matrix-BvA1WUpj.d.ts} +2 -2
- package/dist/{matrix-CPKsRY8Y.d.ts.map → matrix-BvA1WUpj.d.ts.map} +1 -1
- package/dist/meta-eval/index.d.ts +4 -4
- package/dist/{mint-BI14xehJ.d.ts → mint-CJFSYBIU.d.ts} +3 -3
- package/dist/{mint-BI14xehJ.d.ts.map → mint-CJFSYBIU.d.ts.map} +1 -1
- package/dist/multishot/golden/index.d.ts +1 -1
- package/dist/multishot/index.d.ts +2 -2
- package/dist/openapi.json +1 -1
- package/dist/pipelines/index.d.ts +67 -12
- package/dist/pipelines/index.d.ts.map +1 -1
- package/dist/pipelines/index.js +178 -41
- package/dist/pipelines/index.js.map +1 -1
- package/dist/{prime-protocol-CDBcL9NM.d.ts → prime-protocol-CF8Z43Fj.d.ts} +2 -2
- package/dist/{prime-protocol-CDBcL9NM.d.ts.map → prime-protocol-CF8Z43Fj.d.ts.map} +1 -1
- package/dist/{produced-state-Cn9ECr4v.js → produced-state-xsMMjYVc.js} +3 -3
- package/dist/{produced-state-Cn9ECr4v.js.map → produced-state-xsMMjYVc.js.map} +1 -1
- package/dist/{query-D6W6MaGx.d.ts → query-DBUQhehH.d.ts} +3 -3
- package/dist/{query-D6W6MaGx.d.ts.map → query-DBUQhehH.d.ts.map} +1 -1
- package/dist/random-DGEyr3zG.d.ts +83 -0
- package/dist/random-DGEyr3zG.d.ts.map +1 -0
- package/dist/{raw-provider-sink-BQd7mzyT.js → raw-provider-sink-C96CcqeG.js} +19 -56
- package/dist/raw-provider-sink-C96CcqeG.js.map +1 -0
- package/dist/redact-DPoH1-OW.d.ts +158 -0
- package/dist/redact-DPoH1-OW.d.ts.map +1 -0
- package/dist/redact-DxwlUAvh.js +824 -0
- package/dist/redact-DxwlUAvh.js.map +1 -0
- package/dist/{registry-D5Ly3GRV.d.ts → registry-BM2Kdk8T.d.ts} +4 -4
- package/dist/{registry-D5Ly3GRV.d.ts.map → registry-BM2Kdk8T.d.ts.map} +1 -1
- package/dist/{release-confidence-CSp3MsU4.d.ts → release-confidence-CG4Z9QLB.d.ts} +4 -4
- package/dist/{release-confidence-CSp3MsU4.d.ts.map → release-confidence-CG4Z9QLB.d.ts.map} +1 -1
- package/dist/{report-command-CSTjzFGY.js → report-command-DKJ_yAIj.js} +21 -12
- package/dist/{report-command-CSTjzFGY.js.map → report-command-DKJ_yAIj.js.map} +1 -1
- package/dist/reporting.d.ts +3 -3
- package/dist/{researcher-D7E92STT.d.ts → researcher-Bjcd_8T_.d.ts} +7 -7
- package/dist/{researcher-D7E92STT.d.ts.map → researcher-Bjcd_8T_.d.ts.map} +1 -1
- package/dist/{reward-hacking-BIQ2BWLG.d.ts → reward-hacking-DrKXJtgH.d.ts} +2 -2
- package/dist/{reward-hacking-BIQ2BWLG.d.ts.map → reward-hacking-DrKXJtgH.d.ts.map} +1 -1
- package/dist/rl.d.ts +8 -8
- package/dist/rl.js +1 -1
- package/dist/rollout/index.d.ts +2 -2
- package/dist/{rubric-predictive-validity-CTU8y8Cv.d.ts → rubric-predictive-validity-B14yBAmM.d.ts} +2 -2
- package/dist/{rubric-predictive-validity-CTU8y8Cv.d.ts.map → rubric-predictive-validity-B14yBAmM.d.ts.map} +1 -1
- package/dist/{run-record-D9wS35fK.d.ts → run-record-xEULpgML.d.ts} +2 -2
- package/dist/{run-record-D9wS35fK.d.ts.map → run-record-xEULpgML.d.ts.map} +1 -1
- package/dist/{schema-CR5cpjQ3.d.ts → schema-2g7trUwH.d.ts} +17 -2
- package/dist/schema-2g7trUwH.d.ts.map +1 -0
- package/dist/schema-CSf6qWgZ.js.map +1 -1
- package/dist/{semantic-concept-judge-Cnt0TWp0.js → semantic-concept-judge-70LxrCSL.js} +5 -5
- package/dist/{semantic-concept-judge-Cnt0TWp0.js.map → semantic-concept-judge-70LxrCSL.js.map} +1 -1
- package/dist/{series-convergence-BnMs_uAr.d.ts → series-convergence-DY7ha0kx.d.ts} +2 -2
- package/dist/{series-convergence-BnMs_uAr.d.ts.map → series-convergence-DY7ha0kx.d.ts.map} +1 -1
- package/dist/{server-DmpcFiVK.js → server-C8XvqCg8.js} +2 -2
- package/dist/{server-DmpcFiVK.js.map → server-C8XvqCg8.js.map} +1 -1
- package/dist/{skillopt-optimization-method-Cc9SVLqi.js → skillopt-optimization-method-C60h0Got.js} +5 -5
- package/dist/{skillopt-optimization-method-Cc9SVLqi.js.map → skillopt-optimization-method-C60h0Got.js.map} +1 -1
- package/dist/spans-W0o8pbEg.d.ts +60 -0
- package/dist/spans-W0o8pbEg.d.ts.map +1 -0
- package/dist/{statistical-heldout-DTmhTW8P.d.ts → statistical-heldout-CPv-y6sK.d.ts} +3 -3
- package/dist/{statistical-heldout-DTmhTW8P.d.ts.map → statistical-heldout-CPv-y6sK.d.ts.map} +1 -1
- package/dist/{store-BErPvYBr.d.ts → store-C4avFjIi.d.ts} +2 -2
- package/dist/{store-BErPvYBr.d.ts.map → store-C4avFjIi.d.ts.map} +1 -1
- package/dist/{store-otlp-2gYCy-v0.js → store-otlp-DPgzSQKS.js} +2 -2
- package/dist/{store-otlp-2gYCy-v0.js.map → store-otlp-DPgzSQKS.js.map} +1 -1
- package/dist/{store-tool-spans-B3bX9yqn.d.ts → store-tool-spans-C2lLwDzg.d.ts} +9 -54
- package/dist/store-tool-spans-C2lLwDzg.d.ts.map +1 -0
- package/dist/{store-tool-spans-B1e6Auc2.js → store-tool-spans-ClPxcvh2.js} +4 -4
- package/dist/{store-tool-spans-B1e6Auc2.js.map → store-tool-spans-ClPxcvh2.js.map} +1 -1
- package/dist/storyboard/index.d.ts +1 -1
- package/dist/{summary-report-Iy6kXo8x.d.ts → summary-report-SNvJoAvD.d.ts} +3 -3
- package/dist/{summary-report-Iy6kXo8x.d.ts.map → summary-report-SNvJoAvD.d.ts.map} +1 -1
- package/dist/supervisor-run/index.d.ts.map +1 -1
- package/dist/supervisor-run/index.js +1 -1
- package/dist/{tool-groups-veQYPiTy.d.ts → tool-groups-CCQqAa16.d.ts} +3 -3
- package/dist/tool-groups-CCQqAa16.d.ts.map +1 -0
- package/dist/{tool-waste-nbHPAxei.js → tool-waste-CJDfxH45.js} +3 -537
- package/dist/tool-waste-CJDfxH45.js.map +1 -0
- package/dist/{tool-waste-D23I0zWm.d.ts → tool-waste-CP5DO383.d.ts} +4 -4
- package/dist/{tool-waste-D23I0zWm.d.ts.map → tool-waste-CP5DO383.d.ts.map} +1 -1
- package/dist/trace-repair/index.d.ts +2 -2
- package/dist/traces.d.ts +12 -11
- package/dist/traces.d.ts.map +1 -1
- package/dist/traces.js +8 -8
- package/dist/{trajectory-D7qrNvaN.d.ts → trajectory-Y1fmdlw7.d.ts} +3 -3
- package/dist/{trajectory-D7qrNvaN.d.ts.map → trajectory-Y1fmdlw7.d.ts.map} +1 -1
- package/dist/trajectory-replay/index.d.ts +3 -3
- package/dist/trajectory-replay/index.js +2 -2
- package/dist/{types--18oHwVF.d.ts → types-5ak2PqnJ.d.ts} +3 -3
- package/dist/{types--18oHwVF.d.ts.map → types-5ak2PqnJ.d.ts.map} +1 -1
- package/dist/{types-BTRcIqFr.d.ts → types-B1vDZ694.d.ts} +4 -4
- package/dist/{types-BTRcIqFr.d.ts.map → types-B1vDZ694.d.ts.map} +1 -1
- package/dist/{types-CBbLtr2J.d.ts → types-C0bWoSKC.d.ts} +10 -11
- package/dist/types-C0bWoSKC.d.ts.map +1 -0
- package/dist/{types-BjB2wZM9.d.ts → types-DDp2Mb8Y.d.ts} +3 -3
- package/dist/{types-BjB2wZM9.d.ts.map → types-DDp2Mb8Y.d.ts.map} +1 -1
- package/dist/wire/index.d.ts +3 -3
- package/dist/wire/index.js +1 -1
- package/docs/diagnosis.md +2 -3
- package/docs/eval-surface-map.md +1 -1
- package/docs/experiment.md +0 -1
- package/docs/redaction.md +59 -0
- package/docs/trace-contracts.md +102 -0
- package/docs/verdicts.md +1 -1
- package/package.json +3 -2
- package/dist/benchmark-command-DGokT8zd.js.map +0 -1
- package/dist/emitter-Cs0egaFd.d.ts.map +0 -1
- package/dist/emitter-DeQHiDMm.js +0 -257
- package/dist/emitter-DeQHiDMm.js.map +0 -1
- package/dist/engine-DNlKhIm0.d.ts.map +0 -1
- package/dist/experiment-tracker-BKEumQug.js +0 -280
- package/dist/experiment-tracker-BKEumQug.js.map +0 -1
- package/dist/experiment-tracker-URRGP9ek.d.ts +0 -237
- package/dist/experiment-tracker-URRGP9ek.d.ts.map +0 -1
- package/dist/integrity-Cy9WHAtb.js.map +0 -1
- package/dist/integrity-rGOfSUle.d.ts.map +0 -1
- package/dist/llm-judge-BVso5x-u.js.map +0 -1
- package/dist/raw-provider-sink-BQd7mzyT.js.map +0 -1
- package/dist/redact-7Aq1ukl-.js +0 -107
- package/dist/redact-7Aq1ukl-.js.map +0 -1
- package/dist/schema-CR5cpjQ3.d.ts.map +0 -1
- package/dist/store-tool-spans-B3bX9yqn.d.ts.map +0 -1
- package/dist/tool-groups-veQYPiTy.d.ts.map +0 -1
- package/dist/tool-waste-nbHPAxei.js.map +0 -1
- package/dist/types-CBbLtr2J.d.ts.map +0 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { o as FailureBlame, s as FailureClassification } from "../failure-cluster-CbgEDcFJ.js";
|
|
2
|
+
import { n as ExecutionReport } from "../analyze-runs-CLz5O01x.js";
|
|
3
|
+
import { l as PrimeRawUsage } from "../prime-protocol-CF8Z43Fj.js";
|
|
3
4
|
import { i as nodeHttpPrimeBridgeTransport, n as PrimeBridgeTransportRequest, r as PrimeBridgeTransportResult, t as PrimeBridgeTransport } from "../prime-bridge-transport-6feEglLf.js";
|
|
5
|
+
import { a as isContentAttribute, i as ingestSpans, n as IngestReport, r as epochMillis, t as DiagnosisSpan } from "../spans-W0o8pbEg.js";
|
|
4
6
|
import { SpanKind, TraceValidation } from "@tangle-network/agent-trace-contract";
|
|
5
7
|
//#region src/diagnosis/findings.d.ts
|
|
6
8
|
/**
|
|
@@ -72,105 +74,43 @@ declare function validateDiagnosisFindings(document: unknown, options?: {
|
|
|
72
74
|
spanIds?: ReadonlySet<string>;
|
|
73
75
|
}): string[];
|
|
74
76
|
//#endregion
|
|
75
|
-
//#region src/diagnosis/
|
|
76
|
-
/**
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
* - `secret-assignment` is the line-anchored credential-assignment pattern
|
|
82
|
-
* trace-archive uses to keep plaintext-secret files out of the archive
|
|
83
|
-
* (`holds_secret` in tangle-tools trace-archive/archive.py). It is ported
|
|
84
|
-
* here verbatim so both the archive and the miner refuse the same lines.
|
|
85
|
-
* That pattern is line-anchored on purpose, so a secret quoted inside a
|
|
86
|
-
* JSON record or a prose line passes it;
|
|
87
|
-
* - the token-shape rules close that gap: they match the credential itself
|
|
88
|
-
* wherever it appears (`sk-`, `sk-ant-`, GitHub, Slack, AWS, Google, JWT,
|
|
89
|
-
* bearer headers, URL passwords, PEM blocks, and JSON `"...key": "..."`).
|
|
90
|
-
*
|
|
91
|
-
* A redacted value becomes `[REDACTED:<rule id>]`, so a report can state what
|
|
92
|
-
* was removed by class without carrying any of it. The filter never throws on
|
|
93
|
-
* input shape: non-string leaves pass through unchanged.
|
|
94
|
-
*/
|
|
95
|
-
interface SecretRule {
|
|
96
|
-
id: string;
|
|
97
|
-
pattern: RegExp;
|
|
98
|
-
/** Rebuilds the match with the secret replaced; receives the regex groups. */
|
|
99
|
-
replace: (match: string, ...groups: string[]) => string;
|
|
100
|
-
}
|
|
101
|
-
interface SecretFilterReport {
|
|
102
|
-
redactionCount: number;
|
|
103
|
-
byRule: Record<string, number>;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* The trace-archive `SECRET_ASSIGNMENT` pattern (tangle-tools
|
|
107
|
-
* trace-archive/archive.py), with the prefix captured so the key name survives
|
|
108
|
-
* and only the value is replaced.
|
|
109
|
-
*/
|
|
110
|
-
declare const SECRET_ASSIGNMENT_PATTERN: RegExp;
|
|
111
|
-
declare const DIAGNOSIS_SECRET_RULES: readonly SecretRule[];
|
|
112
|
-
/** Redact one string, adding the per-rule counts to `report`. */
|
|
113
|
-
declare function redactSecrets(input: string, report?: SecretFilterReport, rules?: readonly SecretRule[]): string;
|
|
114
|
-
/** Whether any rule matches: the miner's equivalent of trace-archive `holds_secret`. */
|
|
115
|
-
declare function holdsSecret(input: string, rules?: readonly SecretRule[]): boolean;
|
|
116
|
-
/** Redact every string leaf of a JSON-like value. Keys are kept; values are filtered. */
|
|
117
|
-
declare function redactSecretsDeep(value: unknown, report: SecretFilterReport): unknown;
|
|
118
|
-
//#endregion
|
|
119
|
-
//#region src/diagnosis/spans.d.ts
|
|
120
|
-
type DiagnosisSpanStatus = 'OK' | 'ERROR' | 'UNSET';
|
|
121
|
-
interface DiagnosisSpan {
|
|
77
|
+
//#region src/diagnosis/first-failure.d.ts
|
|
78
|
+
/** Span ids listed beside a result; the count carries the rest. */
|
|
79
|
+
declare const MAX_FIRST_FAILURE_IDS = 8;
|
|
80
|
+
type FirstFailureStage = 'error-span' | 'failed-outcome';
|
|
81
|
+
interface FirstFailureFound {
|
|
82
|
+
status: 'found';
|
|
122
83
|
traceId: string;
|
|
84
|
+
stage: FirstFailureStage;
|
|
123
85
|
spanId: string;
|
|
124
|
-
parentSpanId: string | null;
|
|
125
86
|
name: string;
|
|
126
87
|
kind: SpanKind;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
* that differ only in secret material stay distinct. The key is random per
|
|
136
|
-
* ingest, so the fingerprint cannot be matched against a guessed payload or
|
|
137
|
-
* joined across diagnoses. Null when the span carries no input.
|
|
138
|
-
*/
|
|
139
|
-
inputDigest: string | null;
|
|
140
|
-
attributes: Record<string, unknown>;
|
|
88
|
+
/** The span's status message after secret filtering; null when absent or withheld. */
|
|
89
|
+
message: string | null;
|
|
90
|
+
/** The taxonomy's reading of `message`; null for a failed outcome, which has none. */
|
|
91
|
+
classification: FailureClassification | null;
|
|
92
|
+
blame: FailureBlame;
|
|
93
|
+
/** Other candidates at the same stage, in rank order, capped at {@link MAX_FIRST_FAILURE_IDS}. */
|
|
94
|
+
later: string[];
|
|
95
|
+
laterCount: number;
|
|
141
96
|
}
|
|
142
|
-
interface
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
ambiguousSpanIds: string[];
|
|
151
|
-
secrets: SecretFilterReport;
|
|
152
|
-
/** Attribute keys removed because content was not included. */
|
|
153
|
-
droppedAttributes: string[];
|
|
97
|
+
interface FirstFailureAmbiguous {
|
|
98
|
+
status: 'ambiguous';
|
|
99
|
+
traceId: string;
|
|
100
|
+
stage: FirstFailureStage;
|
|
101
|
+
/** The candidates the rank could not order, capped at {@link MAX_FIRST_FAILURE_IDS}. */
|
|
102
|
+
candidates: string[];
|
|
103
|
+
candidateCount: number;
|
|
104
|
+
reason: string;
|
|
154
105
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
*/
|
|
162
|
-
declare function
|
|
163
|
-
contentIncluded: boolean;
|
|
164
|
-
}): {
|
|
165
|
-
spans: DiagnosisSpan[];
|
|
166
|
-
report: IngestReport;
|
|
167
|
-
};
|
|
168
|
-
/**
|
|
169
|
-
* Epoch milliseconds from OTLP nanoseconds, epoch milliseconds, epoch seconds,
|
|
170
|
-
* or ISO-8601. Digit strings are classified by length: 17 or more digits are
|
|
171
|
-
* nanoseconds, 15-16 microseconds, 12-14 milliseconds, and fewer are seconds.
|
|
172
|
-
*/
|
|
173
|
-
declare function epochMillis(value: unknown): number | null;
|
|
106
|
+
interface FirstFailureNone {
|
|
107
|
+
status: 'none';
|
|
108
|
+
traceId: string;
|
|
109
|
+
reason: string;
|
|
110
|
+
}
|
|
111
|
+
type FirstFailure = FirstFailureFound | FirstFailureAmbiguous | FirstFailureNone;
|
|
112
|
+
/** Rank the first failure of one trace. Throws when the spans belong to more than one trace. */
|
|
113
|
+
declare function rankFirstFailure(spans: readonly DiagnosisSpan[]): FirstFailure;
|
|
174
114
|
//#endregion
|
|
175
115
|
//#region src/diagnosis/deterministic.d.ts
|
|
176
116
|
interface ExecutionFacts {
|
|
@@ -180,6 +120,8 @@ interface ExecutionFacts {
|
|
|
180
120
|
errorSpans: number;
|
|
181
121
|
toolCalls: number;
|
|
182
122
|
models: string[];
|
|
123
|
+
/** The first failure of each run, in trace id order. See `rankFirstFailure`. */
|
|
124
|
+
firstFailures: FirstFailure[];
|
|
183
125
|
/** agent-eval execution summary; null with a reason when it could not be computed. */
|
|
184
126
|
execution: ExecutionReport | null;
|
|
185
127
|
executionError?: string;
|
|
@@ -315,5 +257,5 @@ interface DiagnosisResult {
|
|
|
315
257
|
declare const DEFAULT_MAX_MODEL_TRACES = 6;
|
|
316
258
|
declare function diagnoseSpans(spans: readonly unknown[], context: DiagnosisContext, options: DiagnosisOptions): Promise<DiagnosisResult>;
|
|
317
259
|
//#endregion
|
|
318
|
-
export { DEFAULT_MAX_MODEL_TRACES, DIAGNOSIS_FINDINGS_SCHEMA_ID,
|
|
260
|
+
export { DEFAULT_MAX_MODEL_TRACES, DIAGNOSIS_FINDINGS_SCHEMA_ID, type DiagnosisCapability, type DiagnosisConfidence, type DiagnosisContext, type DiagnosisFinding, type DiagnosisFindingsDocument, type DiagnosisMeasure, type DiagnosisModelOptions, type DiagnosisOptions, type DiagnosisRedaction, type DiagnosisResult, type DiagnosisSeverity, type DiagnosisSkippedAnalysis, type DiagnosisSpan, type DiagnosisUsage, type ExecutionFacts, type FirstFailure, type FirstFailureAmbiguous, type FirstFailureFound, type FirstFailureNone, type FirstFailureStage, type IngestReport, MAX_FIRST_FAILURE_IDS, type ModelQuestion, type ModelRejection, type ModelRowNote, type ModelRunRecord, type PrimeBridgeTransport, type PrimeBridgeTransportRequest, type PrimeBridgeTransportResult, diagnoseSpans, epochMillis, ingestSpans, isContentAttribute, nodeHttpPrimeBridgeTransport, rankFirstFailure, validateDiagnosisFindings };
|
|
319
261
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/diagnosis/findings.ts","../../src/diagnosis/
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/diagnosis/findings.ts","../../src/diagnosis/first-failure.ts","../../src/diagnosis/deterministic.ts","../../src/diagnosis/model-pass.ts","../../src/diagnosis/engine.ts"],"mappings":";;;;;;;;;;;;;;;cASa;KAGD;;KAGA;UAEK;EACf;EACA;EACA;;EAEA;;UAGe;EACf;EACA,UAAU;EACV;EACA;EACA,UAAU;;EAEV;EACA;EACA,YAAY;EACZ;;UAGe;EACf;EACA;;UAGe;EACf;EACA;;UAGe;EACf;EACA,QAAQ;EACR;;UAGe;EACf;EACA;IACE;IACA;IACA;IACA;;EAEF;IACE,cAAc,eAAe;IAC7B,SAAS;IACT,YAAY;;EAEd,UAAU;;;;;;;;iBAiBI,0BACd,mBACA;EAAW,UAAU;;;;;cCnDV;KAID;UAEK;EACf;EACA;EACA,OAAO;EACP;EACA;EACA,MAAM;;EAEN;;EAEA,gBAAgB;EAChB,OAAO;;EAEP;EACA;;UAGe;EACf;EACA;EACA,OAAO;;EAEP;EACA;EACA;;UAGe;EACf;EACA;EACA;;KAGU,eAAe,oBAAoB,wBAAwB;;iBAGvD,iBAAiB,gBAAgB,kBAAkB;;;UCvBlD;EACf;EACA;EACA,aAAa;EACb;EACA;EACA;;EAEA,eAAe;;EAEf,WAAW;EACX;;UAGe;EACf,YAAY;EACZ,cAAc,eAAe;EAC7B,SAAS;EACT,OAAO;EACP,UAAU;EACV;;;;UClDe;;EAEf,WAAW;;EAEX;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;IAAY;IAA4B;;;UAGzB;EACf;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA;IAAa;IAAiB;IAAkB;;EAChD,OAAO;EACP;;;;UC/Be;;EAEf;;EAEA;;EAEA;;;;;EAKA;;EAEA;;EAEA;IAAa,MAAM;MAAQ;QAAe;MAA6B;;KAG7D;EACN;EAAuB;EAAiB,SAAS;;EACjD;EAAe,OAAO;EAAuB,SAAS;;UAE3C;EACf;EACA;EACA;EACA;;UAGe;;EAEf,UAAU;;EAEV,WAAW;;EAEX,OAAO;;EAEP,WAAW;IAAQ;IAAiB;;EACpC,OAAO;EACP,aAAa;EACb,QAAQ;;EAER,UAAU;EACV;IACE;IACA;IACA,MAAM;IACN;IACA,OAAO;;EAET;IAAU;IAA8B;;;cAG7B;iBAIS,cACpB,2BACA,SAAS,kBACT,SAAS,mBACR,QAAQ"}
|
package/dist/diagnosis/index.js
CHANGED
|
@@ -1,137 +1,88 @@
|
|
|
1
1
|
import { n as summarizeExecution } from "../analyze-runs-DCY7LMt4.js";
|
|
2
|
+
import { c as emptyRedactionReport, f as redactText, u as redact } from "../redact-DxwlUAvh.js";
|
|
2
3
|
import { t as packageVersion } from "../package-version-D7lQHt_-.js";
|
|
4
|
+
import { o as classifyFailureReason } from "../failure-taxonomy-CjabTATj.js";
|
|
3
5
|
import { c as primeProtocolSha256, d as runPrimeExchange, n as buildPrimePrompt } from "../prime-protocol-DcAK9pC8.js";
|
|
4
6
|
import { t as nodeHttpPrimeBridgeTransport } from "../prime-bridge-transport-Z3cpKGoV.js";
|
|
5
7
|
import { t as fromOtelSpans } from "../otel-spans-CQY1pNiN.js";
|
|
6
8
|
import { createHash, createHmac, randomBytes } from "node:crypto";
|
|
7
9
|
import { MODEL_ATTR_KEYS, SPAN_KINDS, TOOL_NAME_ATTR_KEYS, resolveSpanKind, validateTraceSpans } from "@tangle-network/agent-trace-contract";
|
|
8
|
-
//#region src/diagnosis/
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
id: "secret-assignment",
|
|
25
|
-
pattern: SECRET_ASSIGNMENT_PATTERN,
|
|
26
|
-
replace: (_match, prefix, suffix) => `${prefix}${marker("secret-assignment")}${suffix}`
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
id: "json-secret",
|
|
30
|
-
pattern: /("[A-Za-z0-9_.-]*(?:key|token|secret|password|passwd|passphrase|credentials?)[A-Za-z0-9_]*"[ \t]*:[ \t]*")(?!encrypted:)(?![$`])(?=[^"\s]*[0-9])(?=[^"\s]*[A-Za-z])[^"\s]{16,}(")/gi,
|
|
31
|
-
replace: (_match, prefix, suffix) => `${prefix}${marker("json-secret")}${suffix}`
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
id: "inline-assignment",
|
|
35
|
-
pattern: /\b([A-Za-z0-9_.-]*(?:key|token|secret|password|passwd|passphrase|credentials?)[A-Za-z0-9_]*["']?[ \t]*[=:][ \t]*["']?)(?!encrypted:)(?![$`[])(?=[^\s"'#,&;]*[0-9])(?=[^\s"'#,&;]*[A-Za-z])[^\s"'#,&;]{16,}/gi,
|
|
36
|
-
replace: (_match, prefix) => `${prefix}${marker("inline-assignment")}`
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
id: "anthropic-key",
|
|
40
|
-
pattern: /\bsk-ant-[A-Za-z0-9_-]{20,}/g,
|
|
41
|
-
replace: whole("anthropic-key")
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
id: "openai-key",
|
|
45
|
-
pattern: /\bsk-[A-Za-z0-9_-]{20,}/g,
|
|
46
|
-
replace: whole("openai-key")
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
id: "github-token",
|
|
50
|
-
pattern: /\b(?:gh[pousr]_[A-Za-z0-9]{30,}|github_pat_[A-Za-z0-9_]{30,})/g,
|
|
51
|
-
replace: whole("github-token")
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
id: "slack-token",
|
|
55
|
-
pattern: /\bxox[abeoprs]-[A-Za-z0-9-]{10,}/g,
|
|
56
|
-
replace: whole("slack-token")
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
id: "aws-access-key",
|
|
60
|
-
pattern: /\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g,
|
|
61
|
-
replace: whole("aws-access-key")
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
id: "google-api-key",
|
|
65
|
-
pattern: /\bAIza[0-9A-Za-z_-]{35}/g,
|
|
66
|
-
replace: whole("google-api-key")
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
id: "jwt",
|
|
70
|
-
pattern: /\beyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g,
|
|
71
|
-
replace: whole("jwt")
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
id: "bearer",
|
|
75
|
-
pattern: /\b(Bearer)[ \t]+[A-Za-z0-9._~+/=-]{16,}/gi,
|
|
76
|
-
replace: (_match, word) => `${word} ${marker("bearer")}`
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
id: "url-credentials",
|
|
80
|
-
pattern: /\b([a-z][a-z0-9+.-]*:\/\/[^\s:/@]+:)[^\s@/]+@/gi,
|
|
81
|
-
replace: (_match, prefix) => `${prefix}${marker("url-credentials")}@`
|
|
10
|
+
//#region src/diagnosis/first-failure.ts
|
|
11
|
+
/** Span ids listed beside a result; the count carries the rest. */
|
|
12
|
+
const MAX_FIRST_FAILURE_IDS = 8;
|
|
13
|
+
const OUTCOME_ATTR = "agent.outcome";
|
|
14
|
+
/** Rank the first failure of one trace. Throws when the spans belong to more than one trace. */
|
|
15
|
+
function rankFirstFailure(spans) {
|
|
16
|
+
const traceId = spans[0]?.traceId;
|
|
17
|
+
if (traceId === void 0) throw new TypeError("rankFirstFailure: no spans");
|
|
18
|
+
if (spans.some((span) => span.traceId !== traceId)) throw new TypeError("rankFirstFailure: spans belong to more than one trace");
|
|
19
|
+
const errors = spans.filter(isErrorSpan);
|
|
20
|
+
if (errors.length > 0) {
|
|
21
|
+
const innermost = withoutFailingDescendants(spans, errors);
|
|
22
|
+
if (innermost.length === 0) return ambiguous(traceId, "error-span", errors, "every failing span contains another failing span, so containment is cyclic");
|
|
23
|
+
return rank(traceId, "error-span", innermost);
|
|
82
24
|
}
|
|
83
|
-
];
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
output = output.replace(rule.pattern, (match, ...rest) => {
|
|
91
|
-
hits += 1;
|
|
92
|
-
const captured = rest.slice(0, countGroups(rule.pattern)).map((value) => typeof value === "string" ? value : "");
|
|
93
|
-
return rule.replace(match, ...captured);
|
|
94
|
-
});
|
|
95
|
-
if (hits > 0) {
|
|
96
|
-
report.redactionCount += hits;
|
|
97
|
-
report.byRule[rule.id] = (report.byRule[rule.id] ?? 0) + hits;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return output;
|
|
25
|
+
const failed = spans.filter((span) => span.attributes[OUTCOME_ATTR] === "fail");
|
|
26
|
+
if (failed.length > 0) return rank(traceId, "failed-outcome", failed);
|
|
27
|
+
return {
|
|
28
|
+
status: "none",
|
|
29
|
+
traceId,
|
|
30
|
+
reason: `none of ${spans.length} spans has status ERROR or an agent.outcome of error or fail`
|
|
31
|
+
};
|
|
101
32
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return rules.some((rule) => {
|
|
105
|
-
rule.pattern.lastIndex = 0;
|
|
106
|
-
const found = rule.pattern.test(input);
|
|
107
|
-
rule.pattern.lastIndex = 0;
|
|
108
|
-
return found;
|
|
109
|
-
});
|
|
33
|
+
function isErrorSpan(span) {
|
|
34
|
+
return span.status === "ERROR" || span.attributes[OUTCOME_ATTR] === "error";
|
|
110
35
|
}
|
|
111
|
-
/**
|
|
112
|
-
function
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
36
|
+
/** The failing spans with no failing span beneath them. */
|
|
37
|
+
function withoutFailingDescendants(spans, failing) {
|
|
38
|
+
const parentOf = new Map(spans.map((span) => [span.spanId, span.parentSpanId]));
|
|
39
|
+
const explained = /* @__PURE__ */ new Set();
|
|
40
|
+
for (const span of failing) {
|
|
41
|
+
const seen = /* @__PURE__ */ new Set([span.spanId]);
|
|
42
|
+
let parent = span.parentSpanId;
|
|
43
|
+
while (parent !== null && parentOf.has(parent) && !seen.has(parent)) {
|
|
44
|
+
explained.add(parent);
|
|
45
|
+
seen.add(parent);
|
|
46
|
+
parent = parentOf.get(parent) ?? null;
|
|
47
|
+
}
|
|
119
48
|
}
|
|
120
|
-
return
|
|
49
|
+
return failing.filter((span) => !explained.has(span.spanId));
|
|
121
50
|
}
|
|
122
|
-
function
|
|
51
|
+
function rank(traceId, stage, candidates) {
|
|
52
|
+
if (candidates.length > 1) {
|
|
53
|
+
const untimed = candidates.filter((span) => span.endMs === null);
|
|
54
|
+
if (untimed.length > 0) return ambiguous(traceId, stage, candidates, `${untimed.length} of ${candidates.length} candidates have no end time, so their order is unknown`);
|
|
55
|
+
}
|
|
56
|
+
const ordered = [...candidates].sort((a, b) => (a.endMs ?? 0) - (b.endMs ?? 0) || a.spanId.localeCompare(b.spanId));
|
|
57
|
+
const first = ordered[0];
|
|
58
|
+
const tied = ordered.filter((span) => span.endMs === first.endMs);
|
|
59
|
+
if (tied.length > 1) return ambiguous(traceId, stage, tied, `${tied.length} candidates ended at the same instant, so none ranks first`);
|
|
60
|
+
const classification = stage === "error-span" ? classifyFailureReason(first.statusMessage) : null;
|
|
61
|
+
const later = ordered.slice(1);
|
|
123
62
|
return {
|
|
124
|
-
|
|
125
|
-
|
|
63
|
+
status: "found",
|
|
64
|
+
traceId,
|
|
65
|
+
stage,
|
|
66
|
+
spanId: first.spanId,
|
|
67
|
+
name: first.name,
|
|
68
|
+
kind: first.kind,
|
|
69
|
+
message: first.statusMessage,
|
|
70
|
+
classification,
|
|
71
|
+
blame: classification?.blame ?? "agent",
|
|
72
|
+
later: later.slice(0, 8).map((span) => span.spanId),
|
|
73
|
+
laterCount: later.length
|
|
126
74
|
};
|
|
127
75
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
76
|
+
function ambiguous(traceId, stage, candidates, reason) {
|
|
77
|
+
const ids = candidates.map((span) => span.spanId).sort();
|
|
78
|
+
return {
|
|
79
|
+
status: "ambiguous",
|
|
80
|
+
traceId,
|
|
81
|
+
stage,
|
|
82
|
+
candidates: ids.slice(0, 8),
|
|
83
|
+
candidateCount: ids.length,
|
|
84
|
+
reason
|
|
85
|
+
};
|
|
135
86
|
}
|
|
136
87
|
//#endregion
|
|
137
88
|
//#region src/diagnosis/spans.ts
|
|
@@ -175,10 +126,7 @@ function isContentAttribute(key) {
|
|
|
175
126
|
* detection works on metadata-only runs without the payload itself surviving.
|
|
176
127
|
*/
|
|
177
128
|
function ingestSpans(raw, options) {
|
|
178
|
-
const secrets =
|
|
179
|
-
redactionCount: 0,
|
|
180
|
-
byRule: {}
|
|
181
|
-
};
|
|
129
|
+
const secrets = emptyRedactionReport();
|
|
182
130
|
const dropped = /* @__PURE__ */ new Set();
|
|
183
131
|
const seen = /* @__PURE__ */ new Set();
|
|
184
132
|
const spans = [];
|
|
@@ -210,7 +158,7 @@ function ingestSpans(raw, options) {
|
|
|
210
158
|
else if (firstTrace !== traceId) ambiguous.add(spanId);
|
|
211
159
|
const merged = mergedAttributes(record);
|
|
212
160
|
const inputDigest = digestInput(merged, digestKey);
|
|
213
|
-
const attributes =
|
|
161
|
+
const attributes = redact(merged, { report: secrets }).value;
|
|
214
162
|
if (!options.contentIncluded) {
|
|
215
163
|
for (const [key, value] of Object.entries(attributes)) if (isContentAttribute(key) || value !== null && typeof value === "object") {
|
|
216
164
|
delete attributes[key];
|
|
@@ -218,10 +166,10 @@ function ingestSpans(raw, options) {
|
|
|
218
166
|
}
|
|
219
167
|
}
|
|
220
168
|
const status = readStatus(record);
|
|
221
|
-
const statusMessage = status.message === null ? null :
|
|
169
|
+
const statusMessage = status.message === null ? null : redactText(status.message, { report: secrets });
|
|
222
170
|
const toolName = firstString(attributes, TOOL_NAME_ATTR_KEYS);
|
|
223
171
|
const model = firstString(attributes, MODEL_ATTR_KEYS);
|
|
224
|
-
const name =
|
|
172
|
+
const name = redactText(stringOr(record.name, "unknown"), { report: secrets });
|
|
225
173
|
spans.push({
|
|
226
174
|
traceId,
|
|
227
175
|
spanId,
|
|
@@ -413,7 +361,7 @@ function runDeterministicPass(spans) {
|
|
|
413
361
|
validation,
|
|
414
362
|
capabilities,
|
|
415
363
|
skipped,
|
|
416
|
-
facts: executionFacts(spans, traces
|
|
364
|
+
facts: executionFacts(spans, traces),
|
|
417
365
|
findings,
|
|
418
366
|
window: timeWindow(spans)
|
|
419
367
|
};
|
|
@@ -524,7 +472,7 @@ function failedRunFindings(traces) {
|
|
|
524
472
|
recommendation: "Group the failed runs by their root status message and fix the largest group first."
|
|
525
473
|
}];
|
|
526
474
|
}
|
|
527
|
-
function executionFacts(spans,
|
|
475
|
+
function executionFacts(spans, traces) {
|
|
528
476
|
const spansByKind = {};
|
|
529
477
|
const models = /* @__PURE__ */ new Set();
|
|
530
478
|
let errorSpans = 0;
|
|
@@ -536,12 +484,13 @@ function executionFacts(spans, runs) {
|
|
|
536
484
|
if (span.model) models.add(span.model);
|
|
537
485
|
}
|
|
538
486
|
const facts = {
|
|
539
|
-
runs,
|
|
487
|
+
runs: traces.size,
|
|
540
488
|
spans: spans.length,
|
|
541
489
|
spansByKind,
|
|
542
490
|
errorSpans,
|
|
543
491
|
toolCalls,
|
|
544
492
|
models: [...models].sort(),
|
|
493
|
+
firstFailures: [...traces.keys()].sort().map((traceId) => rankFirstFailure(traces.get(traceId))),
|
|
545
494
|
execution: null
|
|
546
495
|
};
|
|
547
496
|
try {
|
|
@@ -1169,7 +1118,7 @@ async function diagnoseSpans(spans, context, options) {
|
|
|
1169
1118
|
if (context.subject === "customer" && context.topology !== void 0) throw new TypeError("diagnoseSpans: topology analysis is internal only; a customer context must not carry one");
|
|
1170
1119
|
const contentIncluded = context.contentIncluded === true;
|
|
1171
1120
|
const { spans: filtered, report: ingest } = ingestSpans(spans, { contentIncluded });
|
|
1172
|
-
const focus = context.focus === void 0 ? void 0 :
|
|
1121
|
+
const focus = context.focus === void 0 ? void 0 : redactText(context.focus, { report: ingest.secrets });
|
|
1173
1122
|
const deterministic = runDeterministicPass(filtered);
|
|
1174
1123
|
const skipped = [...deterministic.skipped];
|
|
1175
1124
|
const ambiguous = new Set(ingest.ambiguousSpanIds);
|
|
@@ -1224,7 +1173,7 @@ async function diagnoseSpans(spans, context, options) {
|
|
|
1224
1173
|
reason: run.failure ?? "failed"
|
|
1225
1174
|
});
|
|
1226
1175
|
if (context.subject === "internal" && context.topology) {
|
|
1227
|
-
const topology =
|
|
1176
|
+
const topology = redact(context.topology, { report: ingest.secrets }).value;
|
|
1228
1177
|
const reading = await runTopologyPass(topology, new Set((topology.runs ?? []).map((run) => run.id).filter((id) => typeof id === "string")), options.model, options.signal);
|
|
1229
1178
|
notes.push(...reading.notes);
|
|
1230
1179
|
questions.push(...reading.questions);
|
|
@@ -1241,7 +1190,7 @@ async function diagnoseSpans(spans, context, options) {
|
|
|
1241
1190
|
const document = {
|
|
1242
1191
|
schemaVersion: 1,
|
|
1243
1192
|
subject: {
|
|
1244
|
-
label:
|
|
1193
|
+
label: redactText(context.label, { report: ingest.secrets }),
|
|
1245
1194
|
runCount: traces.size,
|
|
1246
1195
|
window: deterministic.window,
|
|
1247
1196
|
contentIncluded
|
|
@@ -1251,7 +1200,7 @@ async function diagnoseSpans(spans, context, options) {
|
|
|
1251
1200
|
skipped,
|
|
1252
1201
|
redaction: {
|
|
1253
1202
|
redactionCount: ingest.secrets.redactionCount,
|
|
1254
|
-
byRule: { ...ingest.secrets.
|
|
1203
|
+
byRule: { ...ingest.secrets.byDetector },
|
|
1255
1204
|
droppedAttributes: ingest.droppedAttributes
|
|
1256
1205
|
}
|
|
1257
1206
|
},
|
|
@@ -1328,6 +1277,6 @@ function totalUsage(runs, pricing) {
|
|
|
1328
1277
|
};
|
|
1329
1278
|
}
|
|
1330
1279
|
//#endregion
|
|
1331
|
-
export { DEFAULT_MAX_MODEL_TRACES, DIAGNOSIS_FINDINGS_SCHEMA_ID,
|
|
1280
|
+
export { DEFAULT_MAX_MODEL_TRACES, DIAGNOSIS_FINDINGS_SCHEMA_ID, MAX_FIRST_FAILURE_IDS, diagnoseSpans, epochMillis, ingestSpans, isContentAttribute, nodeHttpPrimeBridgeTransport, rankFirstFailure, validateDiagnosisFindings };
|
|
1332
1281
|
|
|
1333
1282
|
//# sourceMappingURL=index.js.map
|