@descryy/mcp 0.1.2 → 0.3.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/dist/bin/descry-mcp.js +30 -2
- package/dist/bin/descry-mcp.js.map +1 -1
- package/dist/browser/driver.d.ts +236 -0
- package/dist/browser/driver.d.ts.map +1 -0
- package/dist/browser/driver.js +70 -0
- package/dist/browser/driver.js.map +1 -0
- package/dist/browser/evidence.d.ts +47 -0
- package/dist/browser/evidence.d.ts.map +1 -0
- package/dist/browser/evidence.js +55 -0
- package/dist/browser/evidence.js.map +1 -0
- package/dist/browser/fake-driver.d.ts +58 -0
- package/dist/browser/fake-driver.d.ts.map +1 -0
- package/dist/browser/fake-driver.js +161 -0
- package/dist/browser/fake-driver.js.map +1 -0
- package/dist/browser/graph-write.d.ts +86 -0
- package/dist/browser/graph-write.d.ts.map +1 -0
- package/dist/browser/graph-write.js +135 -0
- package/dist/browser/graph-write.js.map +1 -0
- package/dist/browser/playwright-driver.d.ts +65 -0
- package/dist/browser/playwright-driver.d.ts.map +1 -0
- package/dist/browser/playwright-driver.js +359 -0
- package/dist/browser/playwright-driver.js.map +1 -0
- package/dist/browser/provider.d.ts +49 -0
- package/dist/browser/provider.d.ts.map +1 -0
- package/dist/browser/provider.js +28 -0
- package/dist/browser/provider.js.map +1 -0
- package/dist/browser/registry.d.ts +182 -0
- package/dist/browser/registry.d.ts.map +1 -0
- package/dist/browser/registry.js +215 -0
- package/dist/browser/registry.js.map +1 -0
- package/dist/browser/scenario-resolve.d.ts +62 -0
- package/dist/browser/scenario-resolve.d.ts.map +1 -0
- package/dist/browser/scenario-resolve.js +127 -0
- package/dist/browser/scenario-resolve.js.map +1 -0
- package/dist/browser/scenario-runner.d.ts +113 -0
- package/dist/browser/scenario-runner.d.ts.map +1 -0
- package/dist/browser/scenario-runner.js +315 -0
- package/dist/browser/scenario-runner.js.map +1 -0
- package/dist/browser/stack-parser.d.ts +43 -0
- package/dist/browser/stack-parser.d.ts.map +1 -0
- package/dist/browser/stack-parser.js +112 -0
- package/dist/browser/stack-parser.js.map +1 -0
- package/dist/browser/tool-support.d.ts +113 -0
- package/dist/browser/tool-support.d.ts.map +1 -0
- package/dist/browser/tool-support.js +181 -0
- package/dist/browser/tool-support.js.map +1 -0
- package/dist/disclosure-ledger.d.ts +38 -0
- package/dist/disclosure-ledger.d.ts.map +1 -0
- package/dist/disclosure-ledger.js +40 -0
- package/dist/disclosure-ledger.js.map +1 -0
- package/dist/index.d.ts +12 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/protocol.d.ts +12 -3
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +12 -3
- package/dist/protocol.js.map +1 -1
- package/dist/render.d.ts +121 -10
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +96 -15
- package/dist/render.js.map +1 -1
- package/dist/runtime-registry.d.ts +63 -0
- package/dist/runtime-registry.d.ts.map +1 -0
- package/dist/runtime-registry.js +131 -0
- package/dist/runtime-registry.js.map +1 -0
- package/dist/scenarios/index.d.ts +4 -0
- package/dist/scenarios/index.d.ts.map +1 -0
- package/dist/scenarios/index.js +4 -0
- package/dist/scenarios/index.js.map +1 -0
- package/dist/scenarios/parse.d.ts +32 -0
- package/dist/scenarios/parse.d.ts.map +1 -0
- package/dist/scenarios/parse.js +199 -0
- package/dist/scenarios/parse.js.map +1 -0
- package/dist/scenarios/scenario.d.ts +115 -0
- package/dist/scenarios/scenario.d.ts.map +1 -0
- package/dist/scenarios/scenario.js +41 -0
- package/dist/scenarios/scenario.js.map +1 -0
- package/dist/scenarios/storage.d.ts +51 -0
- package/dist/scenarios/storage.d.ts.map +1 -0
- package/dist/scenarios/storage.js +93 -0
- package/dist/scenarios/storage.js.map +1 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +11 -3
- package/dist/server.js.map +1 -1
- package/dist/session.d.ts +142 -2
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +266 -4
- package/dist/session.js.map +1 -1
- package/dist/tools/analyze.d.ts +41 -1
- package/dist/tools/analyze.d.ts.map +1 -1
- package/dist/tools/analyze.js +111 -9
- package/dist/tools/analyze.js.map +1 -1
- package/dist/tools/browser-click.d.ts +36 -0
- package/dist/tools/browser-click.d.ts.map +1 -0
- package/dist/tools/browser-click.js +117 -0
- package/dist/tools/browser-click.js.map +1 -0
- package/dist/tools/browser-close-session.d.ts +24 -0
- package/dist/tools/browser-close-session.d.ts.map +1 -0
- package/dist/tools/browser-close-session.js +63 -0
- package/dist/tools/browser-close-session.js.map +1 -0
- package/dist/tools/browser-fill.d.ts +49 -0
- package/dist/tools/browser-fill.d.ts.map +1 -0
- package/dist/tools/browser-fill.js +138 -0
- package/dist/tools/browser-fill.js.map +1 -0
- package/dist/tools/browser-navigate.d.ts +32 -0
- package/dist/tools/browser-navigate.d.ts.map +1 -0
- package/dist/tools/browser-navigate.js +103 -0
- package/dist/tools/browser-navigate.js.map +1 -0
- package/dist/tools/browser-run-scenario.d.ts +54 -0
- package/dist/tools/browser-run-scenario.d.ts.map +1 -0
- package/dist/tools/browser-run-scenario.js +228 -0
- package/dist/tools/browser-run-scenario.js.map +1 -0
- package/dist/tools/browser-save-scenario.d.ts +44 -0
- package/dist/tools/browser-save-scenario.d.ts.map +1 -0
- package/dist/tools/browser-save-scenario.js +298 -0
- package/dist/tools/browser-save-scenario.js.map +1 -0
- package/dist/tools/browser-snapshot.d.ts +60 -0
- package/dist/tools/browser-snapshot.d.ts.map +1 -0
- package/dist/tools/browser-snapshot.js +139 -0
- package/dist/tools/browser-snapshot.js.map +1 -0
- package/dist/tools/browser-start-session.d.ts +43 -0
- package/dist/tools/browser-start-session.d.ts.map +1 -0
- package/dist/tools/browser-start-session.js +272 -0
- package/dist/tools/browser-start-session.js.map +1 -0
- package/dist/tools/browser-type.d.ts +48 -0
- package/dist/tools/browser-type.d.ts.map +1 -0
- package/dist/tools/browser-type.js +136 -0
- package/dist/tools/browser-type.js.map +1 -0
- package/dist/tools/contracts.d.ts +15 -0
- package/dist/tools/contracts.d.ts.map +1 -1
- package/dist/tools/contracts.js +14 -3
- package/dist/tools/contracts.js.map +1 -1
- package/dist/tools/cross-pr.d.ts.map +1 -1
- package/dist/tools/cross-pr.js +1 -0
- package/dist/tools/cross-pr.js.map +1 -1
- package/dist/tools/git-diff.d.ts.map +1 -1
- package/dist/tools/git-diff.js +104 -4
- package/dist/tools/git-diff.js.map +1 -1
- package/dist/tools/git-history.d.ts.map +1 -1
- package/dist/tools/git-history.js +1 -0
- package/dist/tools/git-history.js.map +1 -1
- package/dist/tools/history.js +1 -1
- package/dist/tools/history.js.map +1 -1
- package/dist/tools/impact.d.ts +9 -0
- package/dist/tools/impact.d.ts.map +1 -1
- package/dist/tools/impact.js +4 -4
- package/dist/tools/impact.js.map +1 -1
- package/dist/tools/index.d.ts +12 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +31 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/kit.d.ts +11 -1
- package/dist/tools/kit.d.ts.map +1 -1
- package/dist/tools/kit.js +3 -0
- package/dist/tools/kit.js.map +1 -1
- package/dist/tools/link-workspace.d.ts.map +1 -1
- package/dist/tools/link-workspace.js +13 -1
- package/dist/tools/link-workspace.js.map +1 -1
- package/dist/tools/mark-incident.d.ts +69 -0
- package/dist/tools/mark-incident.d.ts.map +1 -0
- package/dist/tools/mark-incident.js +212 -0
- package/dist/tools/mark-incident.js.map +1 -0
- package/dist/tools/observe-runtime.d.ts +292 -0
- package/dist/tools/observe-runtime.d.ts.map +1 -0
- package/dist/tools/observe-runtime.js +1192 -0
- package/dist/tools/observe-runtime.js.map +1 -0
- package/dist/tools/observe-tests.d.ts +125 -0
- package/dist/tools/observe-tests.d.ts.map +1 -0
- package/dist/tools/observe-tests.js +313 -0
- package/dist/tools/observe-tests.js.map +1 -0
- package/dist/tools/pr-analysis.d.ts +71 -13
- package/dist/tools/pr-analysis.d.ts.map +1 -1
- package/dist/tools/pr-analysis.js +55 -12
- package/dist/tools/pr-analysis.js.map +1 -1
- package/dist/tools/pre-push.d.ts +77 -0
- package/dist/tools/pre-push.d.ts.map +1 -0
- package/dist/tools/pre-push.js +250 -0
- package/dist/tools/pre-push.js.map +1 -0
- package/dist/tools/propagation.d.ts.map +1 -1
- package/dist/tools/propagation.js +1 -0
- package/dist/tools/propagation.js.map +1 -1
- package/dist/tools/questions.d.ts.map +1 -1
- package/dist/tools/questions.js +101 -14
- package/dist/tools/questions.js.map +1 -1
- package/dist/tools/refusal-fetch.d.ts.map +1 -1
- package/dist/tools/refusal-fetch.js +1 -0
- package/dist/tools/refusal-fetch.js.map +1 -1
- package/dist/tools/runtime-incident.d.ts +92 -0
- package/dist/tools/runtime-incident.d.ts.map +1 -0
- package/dist/tools/runtime-incident.js +144 -0
- package/dist/tools/runtime-incident.js.map +1 -0
- package/dist/tools/scope.d.ts.map +1 -1
- package/dist/tools/scope.js +1 -0
- package/dist/tools/scope.js.map +1 -1
- package/dist/tools/similar-incidents.d.ts +13 -0
- package/dist/tools/similar-incidents.d.ts.map +1 -1
- package/dist/tools/similar-incidents.js +22 -8
- package/dist/tools/similar-incidents.js.map +1 -1
- package/dist/tools/verification-status.d.ts +22 -0
- package/dist/tools/verification-status.d.ts.map +1 -1
- package/dist/tools/verification-status.js +52 -5
- package/dist/tools/verification-status.js.map +1 -1
- package/dist/tools/verify-claim.d.ts.map +1 -1
- package/dist/tools/verify-claim.js +5 -0
- package/dist/tools/verify-claim.js.map +1 -1
- package/package.json +16 -4
package/dist/render.js
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
* the first call → throw (§7) — enforced in `action-handshake.ts` and
|
|
37
37
|
* `server.ts`, not here: this module never sees a mint, only a redeemed run.
|
|
38
38
|
*/
|
|
39
|
-
import { reliabilityCap,
|
|
39
|
+
import { reliabilityCap, reliabilityDisclosure, reportCategory as deriveReportCategory, } from "@descryy/ir";
|
|
40
40
|
/**
|
|
41
41
|
* MK-5 — which of the sixteen tools states a conclusion about the user's code
|
|
42
42
|
* versus which reports a fact about the graph.
|
|
@@ -65,6 +65,23 @@ const PROVENANCE = {
|
|
|
65
65
|
presentedBy: "host-agent",
|
|
66
66
|
governancePipeline: false,
|
|
67
67
|
};
|
|
68
|
+
/**
|
|
69
|
+
* The ceiling on one rendered tool result, serialized — `content` frame and
|
|
70
|
+
* `structuredContent` envelope together, which is what a host actually
|
|
71
|
+
* receives and counts.
|
|
72
|
+
*
|
|
73
|
+
* A starting value, not a measurement, in this repo's usual sense: the one
|
|
74
|
+
* hard number behind it is a real failure, `get_git_diff` on an ordinary
|
|
75
|
+
* 48-file branch diff returning 84,516 characters and being rejected outright
|
|
76
|
+
* by the host before the caller saw any of it. 60,000 sits well under the
|
|
77
|
+
* smallest size observed to fail, with room for the narrated frame that
|
|
78
|
+
* repeats the disclosures alongside the envelope.
|
|
79
|
+
*
|
|
80
|
+
* Shared rather than per-tool on purpose: `get_git_diff` is the tool that hit
|
|
81
|
+
* this, twice, but nothing about the failure was specific to diffs. Any tool
|
|
82
|
+
* adopts the ceiling by implementing `ToolAnswer.fitToBudget`.
|
|
83
|
+
*/
|
|
84
|
+
export const MAX_REPLY_BYTES = 60_000;
|
|
68
85
|
export class DisclosureError extends Error {
|
|
69
86
|
constructor(message) {
|
|
70
87
|
super(message);
|
|
@@ -75,7 +92,7 @@ export class DisclosureError extends Error {
|
|
|
75
92
|
* MK-8's derivation, shared by every envelope-producing function below so the
|
|
76
93
|
* rule lives in one place rather than four.
|
|
77
94
|
*/
|
|
78
|
-
function deriveEnvelopeCategory(tier, state, resolutionFloor, nameLevel) {
|
|
95
|
+
function deriveEnvelopeCategory(tier, state, resolutionFloor, nameLevel, witnessed) {
|
|
79
96
|
if (tier === "conclusion")
|
|
80
97
|
return null;
|
|
81
98
|
if (state === "failed" || state === "timed_out")
|
|
@@ -83,9 +100,19 @@ function deriveEnvelopeCategory(tier, state, resolutionFloor, nameLevel) {
|
|
|
83
100
|
if (state === "refused")
|
|
84
101
|
return "not analysable";
|
|
85
102
|
return deriveReportCategory({
|
|
86
|
-
|
|
103
|
+
// G3's precondition, answered by the tool rather than assumed: a tool that
|
|
104
|
+
// ran nothing declares nothing here and short-circuits to `unconfirmed`,
|
|
105
|
+
// exactly as before. A tool that watched a real application declares what
|
|
106
|
+
// it watched.
|
|
107
|
+
hasRuntimeEvidence: witnessed !== undefined,
|
|
108
|
+
// Pinned false, and deliberately not something a tool may declare. `M` is
|
|
109
|
+
// G4's one route to `confirmed`, and DEC-334 reserves that category for a
|
|
110
|
+
// result that passed the full governance pipeline — which does not run in
|
|
111
|
+
// this surface. Accepting `M` here would let a tool mint the one label the
|
|
112
|
+
// ruling holds back, so the field is not offered rather than offered and
|
|
113
|
+
// then clamped: a clamp is a silent downgrade, and rule 7 forbids those.
|
|
87
114
|
directMechanismEvidence: false,
|
|
88
|
-
independentSignalTypes: 0,
|
|
115
|
+
independentSignalTypes: witnessed?.independentSignalTypes ?? 0,
|
|
89
116
|
// `renderAnswer`'s own `state`/`disclosures` invariants guarantee a real
|
|
90
117
|
// graph was consulted whenever state is ok/empty, so this is never the
|
|
91
118
|
// null-graph sentinel — cast is safe, not asserted blind.
|
|
@@ -120,14 +147,29 @@ export function renderAnswer(tool, answer, options) {
|
|
|
120
147
|
}
|
|
121
148
|
const resolutionFloor = result.stamp.resolutionFloor;
|
|
122
149
|
const cap = reliabilityCap(resolutionFloor, nameLevel);
|
|
123
|
-
|
|
124
|
-
|
|
150
|
+
// Full the first time this connection meets this category, a short reference
|
|
151
|
+
// to it after — see `disclosure-ledger.ts`. The floor and the class are on
|
|
152
|
+
// every reply either way; only the argument for them collapses.
|
|
153
|
+
const reliability = reliabilityDisclosure(resolutionFloor, nameLevel);
|
|
154
|
+
const disclosures = [
|
|
155
|
+
...result.notes,
|
|
156
|
+
options.disclosureLedger?.firstSighting(reliability.key) === false
|
|
157
|
+
? reliability.brief
|
|
158
|
+
: reliability.full,
|
|
159
|
+
...(result.stamp.commitSpread > 1
|
|
160
|
+
? [
|
|
161
|
+
`the stored graph spans ${result.stamp.commitSpread} distinct commits; part of it may ` +
|
|
162
|
+
"describe code that is no longer current",
|
|
163
|
+
]
|
|
164
|
+
: []),
|
|
165
|
+
];
|
|
166
|
+
const build = (data, extraNotes, fitTruncation) => ({
|
|
125
167
|
tool,
|
|
126
168
|
toolVersion: options.toolVersion,
|
|
127
169
|
state,
|
|
128
170
|
class: options.toolClass,
|
|
129
171
|
headline: answer.headline,
|
|
130
|
-
data
|
|
172
|
+
data,
|
|
131
173
|
graph: {
|
|
132
174
|
commitSha: result.stamp.commitSha,
|
|
133
175
|
builtAt: result.stamp.graphBuiltAt === null
|
|
@@ -137,19 +179,58 @@ export function renderAnswer(tool, answer, options) {
|
|
|
137
179
|
resolutionFloor,
|
|
138
180
|
reliabilityCap: cap,
|
|
139
181
|
},
|
|
140
|
-
truncated:
|
|
141
|
-
|
|
142
|
-
|
|
182
|
+
truncated: fitTruncation ??
|
|
183
|
+
(!result.truncated
|
|
184
|
+
? null
|
|
185
|
+
: (answer.truncatedDetail ?? { shown: -1, total: -1, more: null })),
|
|
143
186
|
refusals: answer.refusalSummary ?? null,
|
|
144
187
|
budget: { elapsedMs: options.elapsedMs, limitMs: options.limitMs },
|
|
145
|
-
disclosures,
|
|
146
|
-
|
|
188
|
+
// The fit's own notes go first among the disclosures it added, ahead of
|
|
189
|
+
// the standing reliability sentence, for the same reason `narrate` puts
|
|
190
|
+
// disclosures last: what is specific to this call must not be buried
|
|
191
|
+
// under what is true of every call.
|
|
192
|
+
disclosures: extraNotes.length === 0 ? disclosures : [...result.notes, ...extraNotes, ...disclosures.slice(result.notes.length)],
|
|
193
|
+
reportCategory: deriveEnvelopeCategory(options.toolTier, state, resolutionFloor, nameLevel, answer.runtimeEvidence),
|
|
147
194
|
provenance: PROVENANCE,
|
|
148
|
-
};
|
|
149
|
-
|
|
195
|
+
});
|
|
196
|
+
const frame = (envelope) => ({
|
|
150
197
|
content: [{ type: "text", text: narrate(envelope) }],
|
|
151
198
|
structuredContent: envelope,
|
|
152
|
-
};
|
|
199
|
+
});
|
|
200
|
+
const rendered = frame(build(result.data, [], null));
|
|
201
|
+
const ceiling = options.maxReplyBytes ?? MAX_REPLY_BYTES;
|
|
202
|
+
if (answer.fitToBudget === undefined || sizeOf(rendered) <= ceiling)
|
|
203
|
+
return rendered;
|
|
204
|
+
// The tool is asked for a payload that fits in what is left once everything
|
|
205
|
+
// else is paid for. Its own disclosures cost bytes too, so the first budget
|
|
206
|
+
// can be slightly optimistic — the loop re-measures and asks again with the
|
|
207
|
+
// corrected figure rather than assuming one pass converges. Two passes is
|
|
208
|
+
// the observed cost; the third exists so a pathological oscillation ends.
|
|
209
|
+
let fitted = rendered;
|
|
210
|
+
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
211
|
+
const payloadBytes = Buffer.byteLength(JSON.stringify(dataOf(fitted)) ?? "null", "utf8");
|
|
212
|
+
const budget = ceiling - (sizeOf(fitted) - payloadBytes);
|
|
213
|
+
const fit = answer.fitToBudget(Math.max(budget, 0));
|
|
214
|
+
if (fit.truncatedDetail !== undefined && fit.notes.length === 0) {
|
|
215
|
+
throw new DisclosureError(`${tool} dropped items to fit the reply's size budget without saying so. A reply shrunk in ` +
|
|
216
|
+
"silence reads as a complete one — the same failure invariant 1 covers for a query's own " +
|
|
217
|
+
"truncation, arriving by a different route.");
|
|
218
|
+
}
|
|
219
|
+
fitted = frame(build(fit.data, fit.notes, fit.truncatedDetail ?? null));
|
|
220
|
+
if (sizeOf(fitted) <= ceiling)
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
// Returned even if the last pass is still over: a tool that cannot shrink
|
|
224
|
+
// below the ceiling has an oversized answer either way, and an oversized
|
|
225
|
+
// answer beats a fabricated small one.
|
|
226
|
+
return fitted;
|
|
227
|
+
}
|
|
228
|
+
function sizeOf(rendered) {
|
|
229
|
+
return Buffer.byteLength(JSON.stringify(rendered), "utf8");
|
|
230
|
+
}
|
|
231
|
+
/** The `data` inside a rendered frame, for measuring its share of the total. */
|
|
232
|
+
function dataOf(rendered) {
|
|
233
|
+
return rendered.structuredContent.data;
|
|
153
234
|
}
|
|
154
235
|
/**
|
|
155
236
|
* The text an agent actually reads.
|
package/dist/render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EACL,cAAc,EACd,
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,cAAc,IAAI,oBAAoB,GAGvC,MAAM,aAAa,CAAC;AAQrB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,YAAY,EAAE,UAAU,CAAU,CAAC;AAkB9D,MAAM,UAAU,GAAe;IAC7B,OAAO,EAAE,KAAK;IACd,aAAa,EAAE,QAAQ;IACvB,WAAW,EAAE,YAAY;IACzB,kBAAkB,EAAE,KAAK;CAC1B,CAAC;AA8FF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC;AA0GtC,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AA0BD;;;GAGG;AACH,SAAS,sBAAsB,CAC7B,IAAc,EACd,KAAkB,EAClB,eAA8B,EAC9B,SAAkB,EAClB,SAAwC;IAExC,IAAI,IAAI,KAAK,YAAY;QAAE,OAAO,IAAI,CAAC;IACvC,I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EAAE,QAA8C;KAClE,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,OAAsB;IACjE,MAAM,QAAQ,GAAyB;QACrC,IAAI;QACJ,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,KAAK,EAAE,WAAW;QAClB,KAAK,EAAE,OAAO,CAAC,SAAS;QACxB,QAAQ,EAAE,GAAG,IAAI,aAAa;QAC9B,IAAI,EAAE,IAAI;QACV,KAAK,EAAE;YACL,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,IAAI;YACb,eAAe,EAAE,CAAC;YAClB,eAAe,EAAE,IAAI;YACrB,cAAc,EAAE,GAAG;SACpB;QACD,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE;QAClE,WAAW,EAAE;YACX,GAAG,IAAI,8BAA8B,OAAO,CAAC,OAAO,2CAA2C;gBAC7F,oEAAoE;SACvE;QACD,8DAA8D;QAC9D,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE,UAAU;KACvB,CAAC;IACF,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpD,iBAAiB,EAAE,QAA8C;QACjE,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How `observe_runtime` reaches a **runtime** adapter without naming a language.
|
|
3
|
+
*
|
|
4
|
+
* This is `registry.ts`'s argument applied one layer over: that module exists
|
|
5
|
+
* because "descry-core must not import descry-adapters — the IR boundary is a
|
|
6
|
+
* dependency-direction fact", and the identical fact holds for
|
|
7
|
+
* `descry-runtime`'s per-language adapters. `@descryy/mcp` now depends on the
|
|
8
|
+
* runtime's *language-neutral* packages (orchestrator, evidence store,
|
|
9
|
+
* correlation, graph correlator) and on none of its nine language adapters,
|
|
10
|
+
* because an `import { createTypeScriptRuntimeAdapter } from
|
|
11
|
+
* "@descryy/runtime-adapter-typescript"` in a tool file would put the word
|
|
12
|
+
* "typescript" above the IR boundary in the one process that runs everything
|
|
13
|
+
* — rule 1, which the repository's own CLAUDE.md calls a design bug rather
|
|
14
|
+
* than a style preference.
|
|
15
|
+
*
|
|
16
|
+
* `uat-phase-1-bug-fixes.md`'s Phase 1 listed `runtime-adapter-typescript`
|
|
17
|
+
* among the packages to add as a real dependency. It is deliberately **not**
|
|
18
|
+
* one, and that is the only narrowing this integration makes to that list: the
|
|
19
|
+
* adapter is named in the call as a module specifier and imported at run time,
|
|
20
|
+
* exactly as every static source already is. The engine knows `RuntimeAdapter`;
|
|
21
|
+
* it never knows the word "typescript". Nothing about the plan's direction
|
|
22
|
+
* changes — one language ships first either way, it just ships as a
|
|
23
|
+
* configured specifier rather than as a compiled-in import.
|
|
24
|
+
*
|
|
25
|
+
* ## The factory convention
|
|
26
|
+
*
|
|
27
|
+
* `descry-runtime`'s nine language adapters each export a factory named
|
|
28
|
+
* `create<Something>RuntimeAdapter` — `createTypeScriptRuntimeAdapter`,
|
|
29
|
+
* `createPythonRuntimeAdapter`, `createJavaRuntimeAdapter`. Same shape as
|
|
30
|
+
* `registry.ts`'s `create*Adapter` convention and resolved the same way: an
|
|
31
|
+
* explicit `export` in the call wins; failing that, the single export matching
|
|
32
|
+
* the pattern is used; **two matches is an error, not a coin toss.**
|
|
33
|
+
*
|
|
34
|
+
* ## Failing to load is a disclosure, never a shrug
|
|
35
|
+
*
|
|
36
|
+
* A runtime adapter that will not import is the difference between "we
|
|
37
|
+
* observed your service and saw nothing" and "we could not observe your
|
|
38
|
+
* service at all" — §20.2's distinction, and the one `observe_runtime` turns
|
|
39
|
+
* into a `refused` state rather than an `ok` with an empty evidence list.
|
|
40
|
+
* Every failure leaves here as a thrown `RuntimeAdapterLoadError` carrying the
|
|
41
|
+
* specifier and the reason, so the caller cannot take an adapter without also
|
|
42
|
+
* having to handle not getting one.
|
|
43
|
+
*/
|
|
44
|
+
import type { RuntimeAdapter } from "@descryy/runtime-backend-observation";
|
|
45
|
+
/** A runtime adapter named the way `SourceSpec` names a static one. */
|
|
46
|
+
export interface RuntimeAdapterSpec {
|
|
47
|
+
readonly module: string;
|
|
48
|
+
/** Named export to call. Defaults to the `create*RuntimeAdapter` convention. */
|
|
49
|
+
readonly export?: string;
|
|
50
|
+
/** Passed to the factory. Adapter-specific and opaque here. */
|
|
51
|
+
readonly options?: Record<string, unknown>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Distinct from a generic `Error` so the tool can tell "the adapter would not
|
|
55
|
+
* load" (a refusal it must disclose) apart from "the run itself broke" (a
|
|
56
|
+
* failure). Both are honest; they are not the same statement.
|
|
57
|
+
*/
|
|
58
|
+
export declare class RuntimeAdapterLoadError extends Error {
|
|
59
|
+
readonly spec: RuntimeAdapterSpec;
|
|
60
|
+
constructor(spec: RuntimeAdapterSpec, reason: string);
|
|
61
|
+
}
|
|
62
|
+
export declare function loadRuntimeAdapter(spec: RuntimeAdapterSpec): Promise<RuntimeAdapter>;
|
|
63
|
+
//# sourceMappingURL=runtime-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-registry.d.ts","sourceRoot":"","sources":["../src/runtime-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAE3E,uEAAuE;AACvE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,gFAAgF;IAChF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5C;AAED;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;gBAEtB,IAAI,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM;CAKrD;AAmCD,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAAC,CAmD1F"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How `observe_runtime` reaches a **runtime** adapter without naming a language.
|
|
3
|
+
*
|
|
4
|
+
* This is `registry.ts`'s argument applied one layer over: that module exists
|
|
5
|
+
* because "descry-core must not import descry-adapters — the IR boundary is a
|
|
6
|
+
* dependency-direction fact", and the identical fact holds for
|
|
7
|
+
* `descry-runtime`'s per-language adapters. `@descryy/mcp` now depends on the
|
|
8
|
+
* runtime's *language-neutral* packages (orchestrator, evidence store,
|
|
9
|
+
* correlation, graph correlator) and on none of its nine language adapters,
|
|
10
|
+
* because an `import { createTypeScriptRuntimeAdapter } from
|
|
11
|
+
* "@descryy/runtime-adapter-typescript"` in a tool file would put the word
|
|
12
|
+
* "typescript" above the IR boundary in the one process that runs everything
|
|
13
|
+
* — rule 1, which the repository's own CLAUDE.md calls a design bug rather
|
|
14
|
+
* than a style preference.
|
|
15
|
+
*
|
|
16
|
+
* `uat-phase-1-bug-fixes.md`'s Phase 1 listed `runtime-adapter-typescript`
|
|
17
|
+
* among the packages to add as a real dependency. It is deliberately **not**
|
|
18
|
+
* one, and that is the only narrowing this integration makes to that list: the
|
|
19
|
+
* adapter is named in the call as a module specifier and imported at run time,
|
|
20
|
+
* exactly as every static source already is. The engine knows `RuntimeAdapter`;
|
|
21
|
+
* it never knows the word "typescript". Nothing about the plan's direction
|
|
22
|
+
* changes — one language ships first either way, it just ships as a
|
|
23
|
+
* configured specifier rather than as a compiled-in import.
|
|
24
|
+
*
|
|
25
|
+
* ## The factory convention
|
|
26
|
+
*
|
|
27
|
+
* `descry-runtime`'s nine language adapters each export a factory named
|
|
28
|
+
* `create<Something>RuntimeAdapter` — `createTypeScriptRuntimeAdapter`,
|
|
29
|
+
* `createPythonRuntimeAdapter`, `createJavaRuntimeAdapter`. Same shape as
|
|
30
|
+
* `registry.ts`'s `create*Adapter` convention and resolved the same way: an
|
|
31
|
+
* explicit `export` in the call wins; failing that, the single export matching
|
|
32
|
+
* the pattern is used; **two matches is an error, not a coin toss.**
|
|
33
|
+
*
|
|
34
|
+
* ## Failing to load is a disclosure, never a shrug
|
|
35
|
+
*
|
|
36
|
+
* A runtime adapter that will not import is the difference between "we
|
|
37
|
+
* observed your service and saw nothing" and "we could not observe your
|
|
38
|
+
* service at all" — §20.2's distinction, and the one `observe_runtime` turns
|
|
39
|
+
* into a `refused` state rather than an `ok` with an empty evidence list.
|
|
40
|
+
* Every failure leaves here as a thrown `RuntimeAdapterLoadError` carrying the
|
|
41
|
+
* specifier and the reason, so the caller cannot take an adapter without also
|
|
42
|
+
* having to handle not getting one.
|
|
43
|
+
*/
|
|
44
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
45
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
46
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
47
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return path;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Distinct from a generic `Error` so the tool can tell "the adapter would not
|
|
54
|
+
* load" (a refusal it must disclose) apart from "the run itself broke" (a
|
|
55
|
+
* failure). Both are honest; they are not the same statement.
|
|
56
|
+
*/
|
|
57
|
+
export class RuntimeAdapterLoadError extends Error {
|
|
58
|
+
spec;
|
|
59
|
+
constructor(spec, reason) {
|
|
60
|
+
super(`runtime adapter "${spec.module}" could not be loaded — ${reason}`);
|
|
61
|
+
this.name = "RuntimeAdapterLoadError";
|
|
62
|
+
this.spec = spec;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const FACTORY_PATTERN = /^create[A-Za-z0-9]*RuntimeAdapter$/;
|
|
66
|
+
function describe(error) {
|
|
67
|
+
if (error instanceof Error) {
|
|
68
|
+
const code = error.code;
|
|
69
|
+
return code === undefined ? error.message : `${code}: ${error.message}`;
|
|
70
|
+
}
|
|
71
|
+
return String(error);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Duck-typed on the four members `runInstrumentedExecution` actually reaches
|
|
75
|
+
* for, rather than on a marker or `instanceof`.
|
|
76
|
+
*
|
|
77
|
+
* The adapters are compiled separately and published as their own packages, so
|
|
78
|
+
* an `instanceof` across that boundary is a well-known way to be wrong —
|
|
79
|
+
* `registry.ts`'s `asAdapter` says the same thing about `LanguageAdapter`, for
|
|
80
|
+
* the same reason. A module that exports a matching factory returning
|
|
81
|
+
* something without these is a broken adapter, and saying so here beats a
|
|
82
|
+
* `TypeError` thrown from inside a collector three layers down.
|
|
83
|
+
*/
|
|
84
|
+
function isRuntimeAdapter(value) {
|
|
85
|
+
const candidate = value;
|
|
86
|
+
return (typeof candidate === "object" &&
|
|
87
|
+
candidate !== null &&
|
|
88
|
+
typeof candidate.language === "string" &&
|
|
89
|
+
typeof candidate.createBackendCollectors === "function" &&
|
|
90
|
+
typeof candidate.stackTraceParser === "object" &&
|
|
91
|
+
typeof candidate.sourceLocationResolver === "object");
|
|
92
|
+
}
|
|
93
|
+
export async function loadRuntimeAdapter(spec) {
|
|
94
|
+
let module;
|
|
95
|
+
try {
|
|
96
|
+
module = (await import(__rewriteRelativeImportExtension(spec.module)));
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
throw new RuntimeAdapterLoadError(spec, describe(error));
|
|
100
|
+
}
|
|
101
|
+
let factoryName = spec.export;
|
|
102
|
+
if (factoryName === undefined) {
|
|
103
|
+
const candidates = Object.keys(module).filter((key) => FACTORY_PATTERN.test(key) && typeof module[key] === "function");
|
|
104
|
+
if (candidates.length === 0) {
|
|
105
|
+
throw new RuntimeAdapterLoadError(spec, "no export matching create*RuntimeAdapter. Name one explicitly with " +
|
|
106
|
+
`{ "module": "${spec.module}", "export": "..." }.`);
|
|
107
|
+
}
|
|
108
|
+
if (candidates.length > 1) {
|
|
109
|
+
throw new RuntimeAdapterLoadError(spec, `${candidates.length} exports match create*RuntimeAdapter (${candidates.sort().join(", ")}). ` +
|
|
110
|
+
"Name the one to use explicitly rather than letting the choice depend on export order.");
|
|
111
|
+
}
|
|
112
|
+
factoryName = candidates[0];
|
|
113
|
+
}
|
|
114
|
+
const factory = module[factoryName];
|
|
115
|
+
if (typeof factory !== "function") {
|
|
116
|
+
throw new RuntimeAdapterLoadError(spec, `export "${factoryName}" is not a function`);
|
|
117
|
+
}
|
|
118
|
+
let adapter;
|
|
119
|
+
try {
|
|
120
|
+
adapter = factory(spec.options);
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
throw new RuntimeAdapterLoadError(spec, `"${factoryName}" threw — ${describe(error)}`);
|
|
124
|
+
}
|
|
125
|
+
if (!isRuntimeAdapter(adapter)) {
|
|
126
|
+
throw new RuntimeAdapterLoadError(spec, `"${factoryName}" did not return a RuntimeAdapter (needs \`language\`, \`stackTraceParser\`, ` +
|
|
127
|
+
"`sourceLocationResolver` and `createBackendCollectors`)");
|
|
128
|
+
}
|
|
129
|
+
return adapter;
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=runtime-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-registry.js","sourceRoot":"","sources":["../src/runtime-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;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AC;QACf,MAAM,IAAI,uBAAuB,CAAC,IAAI,EAAE,IAAI,WAAW,aAAa,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACzF,CAAC;IAED,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,uBAAuB,CAC/B,IAAI,EACJ,IAAI,WAAW,+EAA+E;YAC5F,yDAAyD,CAC5D,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { SCENARIO_SCHEMA_VERSION, isUnverifying, type Scenario, type ScenarioStep, type ScenarioAssertion, type ScenarioAssertionKind, type ScenarioActionKind, type TargetDescriptor, } from "./scenario.ts";
|
|
2
|
+
export { parseScenario, serializeScenario, type ScenarioParseResult } from "./parse.ts";
|
|
3
|
+
export { scenariosDirectory, scenarioPath, listScenarios, readScenario, writeScenario } from "./storage.ts";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scenarios/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { SCENARIO_SCHEMA_VERSION, isUnverifying, } from "./scenario.js";
|
|
2
|
+
export { parseScenario, serializeScenario } from "./parse.js";
|
|
3
|
+
export { scenariosDirectory, scenarioPath, listScenarios, readScenario, writeScenario } from "./storage.js";
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/scenarios/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,aAAa,GAOd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAA4B,MAAM,YAAY,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading a stored scenario — validation, and the refusals that are the point.
|
|
3
|
+
*
|
|
4
|
+
* Everything here refuses rather than repairs. A format that quietly coerced a
|
|
5
|
+
* missing field into a default would let a scenario keep loading after it had
|
|
6
|
+
* stopped describing the application, which is the exact rot both scenario
|
|
7
|
+
* rulings exist to prevent — and it would do it at the one moment nobody is
|
|
8
|
+
* watching, a replay in CI.
|
|
9
|
+
*
|
|
10
|
+
* Problems are collected rather than thrown one at a time, so a person fixing a
|
|
11
|
+
* hand-edited file sees everything wrong with it in one pass instead of
|
|
12
|
+
* discovering the next fault on the next run.
|
|
13
|
+
*/
|
|
14
|
+
import { type Scenario } from "./scenario.ts";
|
|
15
|
+
export type ScenarioParseResult = {
|
|
16
|
+
readonly valid: true;
|
|
17
|
+
readonly scenario: Scenario;
|
|
18
|
+
} | {
|
|
19
|
+
readonly valid: false;
|
|
20
|
+
readonly problems: readonly string[];
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Validate an already-JSON-decoded value as a scenario.
|
|
24
|
+
*
|
|
25
|
+
* The version check runs first and short-circuits: reporting field problems
|
|
26
|
+
* against a schema this reader does not understand would be noise about a
|
|
27
|
+
* shape that was never meant to satisfy it.
|
|
28
|
+
*/
|
|
29
|
+
export declare function parseScenario(raw: unknown): ScenarioParseResult;
|
|
30
|
+
/** Newline-terminated and two-space indented, so a saved scenario reads as a reviewable diff rather than one long line. */
|
|
31
|
+
export declare function serializeScenario(scenario: Scenario): string;
|
|
32
|
+
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/scenarios/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAEL,KAAK,QAAQ,EAMd,MAAM,eAAe,CAAC;AAEvB,MAAM,MAAM,mBAAmB,GAC3B;IAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,GACrD;IAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AA2HpE;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,mBAAmB,CAoE/D;AAED,2HAA2H;AAC3H,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAE5D"}
|