@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
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the seven browser tools share.
|
|
3
|
+
*
|
|
4
|
+
* Kept in one place because the parts that repeat are the parts that must not
|
|
5
|
+
* drift: how a dead session is reported, how consent is checked, and how a
|
|
6
|
+
* reply is stamped. Seven copies of a refusal is seven chances for one of
|
|
7
|
+
* them to say something slightly different about the same state.
|
|
8
|
+
*/
|
|
9
|
+
import { answer } from "../tools/kit.js";
|
|
10
|
+
import { evidenceNotes, evidenceReport } from "./evidence.js";
|
|
11
|
+
import { graphWriteNotes, writeBrowserObservations, NO_GRAPH_WRITE } from "./graph-write.js";
|
|
12
|
+
export function browserStamp(ctx) {
|
|
13
|
+
try {
|
|
14
|
+
const stamp = ctx.session.provider().baseStamp();
|
|
15
|
+
return {
|
|
16
|
+
commitSha: stamp.commitSha,
|
|
17
|
+
graphBuiltAt: stamp.graphBuiltAt,
|
|
18
|
+
irSchemaVersion: stamp.irSchemaVersion,
|
|
19
|
+
commitSpread: stamp.commitSpread,
|
|
20
|
+
note: null,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return {
|
|
25
|
+
commitSha: null,
|
|
26
|
+
graphBuiltAt: null,
|
|
27
|
+
irSchemaVersion: 0,
|
|
28
|
+
commitSpread: 0,
|
|
29
|
+
note: "This repository has no graph, so the reply carries no commit stamp. What the browser observed is " +
|
|
30
|
+
"still real; nothing here has been related to your code. Run analyze to connect the two.",
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Every browser reply, stamped identically.
|
|
36
|
+
*
|
|
37
|
+
* `resolutionFloor: 4` on a successful observation, and that is not
|
|
38
|
+
* generosity: R4 is "observed at runtime", and a page element this call
|
|
39
|
+
* actually saw is the definition of it. A refusal or a failure observed
|
|
40
|
+
* nothing, so it stamps R0 — the floor has to describe the evidence behind
|
|
41
|
+
* *this* reply, not the tool's best case.
|
|
42
|
+
*/
|
|
43
|
+
export function browserAnswer(options) {
|
|
44
|
+
const stamp = browserStamp(options.ctx);
|
|
45
|
+
const observed = (options.state ?? "ok") === "ok";
|
|
46
|
+
const notes = stamp.note === null ? [...options.notes] : [...options.notes, stamp.note];
|
|
47
|
+
return answer({
|
|
48
|
+
headline: options.headline,
|
|
49
|
+
data: options.data,
|
|
50
|
+
resolutionFloor: observed ? 4 : 0,
|
|
51
|
+
commitSha: stamp.commitSha,
|
|
52
|
+
graphBuiltAt: stamp.graphBuiltAt,
|
|
53
|
+
irSchemaVersion: stamp.irSchemaVersion,
|
|
54
|
+
commitSpread: stamp.commitSpread,
|
|
55
|
+
notes,
|
|
56
|
+
// A browser observation is a fact about names and structure on a page —
|
|
57
|
+
// "a button called Delete is here" — not about a program's types.
|
|
58
|
+
nameLevel: true,
|
|
59
|
+
...(options.state === undefined || options.state === "ok" ? {} : { state: options.state }),
|
|
60
|
+
...(options.fitToBudget === undefined ? {} : { fitToBudget: options.fitToBudget }),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Look a session up, or describe exactly why it cannot be used.
|
|
65
|
+
*
|
|
66
|
+
* The three dead states are deliberately not collapsed into one. "You never
|
|
67
|
+
* had this session", "it timed out five minutes ago, here is what it saw" and
|
|
68
|
+
* "the browser crashed" are three different things for a caller to do next,
|
|
69
|
+
* and only the last of them is a `failed`.
|
|
70
|
+
*/
|
|
71
|
+
export async function useSession(registry, sessionId) {
|
|
72
|
+
const used = await registry.use(sessionId);
|
|
73
|
+
if (used.ok)
|
|
74
|
+
return { ok: true, entry: used.entry };
|
|
75
|
+
if (used.kind === "unknown") {
|
|
76
|
+
return { ok: false, dead: { state: "refused", headline: `No browser session "${sessionId}".`, notes: [used.reason], evidence: emptyEvidence() } };
|
|
77
|
+
}
|
|
78
|
+
const evidence = evidenceReport(used.reaped.observation);
|
|
79
|
+
const carried = evidence.consoleErrors.length + evidence.failedRequests.length > 0
|
|
80
|
+
? ["Everything the session had observed but not yet reported is included here rather than discarded."]
|
|
81
|
+
: [];
|
|
82
|
+
return {
|
|
83
|
+
ok: false,
|
|
84
|
+
dead: {
|
|
85
|
+
// A crash is something breaking; a reap is Descry having tidied up. The
|
|
86
|
+
// five states exist to keep those apart.
|
|
87
|
+
state: used.kind === "crashed" ? "failed" : "refused",
|
|
88
|
+
headline: used.kind === "crashed" ? `Browser session ${sessionId} crashed.` : `Browser session ${sessionId} is gone.`,
|
|
89
|
+
notes: [used.reason, ...carried],
|
|
90
|
+
evidence,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Drain what the page has said, relate it to the graph, and produce both the
|
|
96
|
+
* payload and the disclosures in one place.
|
|
97
|
+
*
|
|
98
|
+
* Every evidence-bearing browser tool goes through this rather than draining
|
|
99
|
+
* for itself. Two reasons, and the second is the one that matters: a tool
|
|
100
|
+
* that drained without correlating would be a tool through which the R4 write
|
|
101
|
+
* silently does not happen, and nothing about its reply would look different.
|
|
102
|
+
*
|
|
103
|
+
* A repository with no graph correlates nothing and says so. That is a real
|
|
104
|
+
* state — a developer can drive a browser against an app they have never
|
|
105
|
+
* analysed — and it must not look like "we looked and found no connection".
|
|
106
|
+
*/
|
|
107
|
+
export async function observeAndCorrelate(ctx, entry) {
|
|
108
|
+
const observation = await entry.page.drainEvidence();
|
|
109
|
+
const evidence = evidenceReport(observation);
|
|
110
|
+
let graph = NO_GRAPH_WRITE;
|
|
111
|
+
const notes = [];
|
|
112
|
+
if (observation.requests.length > 0) {
|
|
113
|
+
try {
|
|
114
|
+
const commitSha = ctx.session.provider().baseStamp().commitSha;
|
|
115
|
+
graph = writeBrowserObservations({
|
|
116
|
+
driver: ctx.session.store().driver,
|
|
117
|
+
repo: ctx.session.config.repo,
|
|
118
|
+
runId: entry.runId,
|
|
119
|
+
// An edge records the commit the observed application was built from,
|
|
120
|
+
// so a later reader can tell whether the code moved under the
|
|
121
|
+
// observation. Absent that, the observation is still real but cannot
|
|
122
|
+
// be dated against the source, so it is not written at all.
|
|
123
|
+
commitSha: commitSha ?? "",
|
|
124
|
+
repoRoot: ctx.session.repoPath,
|
|
125
|
+
requests: observation.requests,
|
|
126
|
+
});
|
|
127
|
+
notes.push(...graphWriteNotes(graph, observation.requests));
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
notes.push("This repository has no graph open, so nothing the browser observed was related to your code. The " +
|
|
131
|
+
"observations below are real; they are simply unconnected. Run analyze to connect them.");
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return { evidence, graph, notes: [...evidenceNotes(evidence), ...notes] };
|
|
135
|
+
}
|
|
136
|
+
export function emptyEvidence() {
|
|
137
|
+
return { consoleErrors: [], failedRequests: [], totalRequests: 0, actions: [] };
|
|
138
|
+
}
|
|
139
|
+
export function reportOf(observation) {
|
|
140
|
+
return evidenceReport(observation);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Is `url` inside the origin this session was consented for?
|
|
144
|
+
*
|
|
145
|
+
* The consent ruling's one hard bound. Checked here rather than in each verb
|
|
146
|
+
* so that a future eighth tool cannot forget it.
|
|
147
|
+
*/
|
|
148
|
+
/**
|
|
149
|
+
* Does this session's environment profile permit changing the application?
|
|
150
|
+
*
|
|
151
|
+
* Read off the profile the session was opened under — DEC-270's
|
|
152
|
+
* `safetyLevel`, the same field `observe_runtime` consults. Deliberately not
|
|
153
|
+
* a per-tool flag: two independent notions of "safe" is how a runtime run and
|
|
154
|
+
* a browser run end up disagreeing about the same environment.
|
|
155
|
+
*
|
|
156
|
+
* A session opened with no profile returns null here, and the session's own
|
|
157
|
+
* consent is then the only authorization — which is a real authorization,
|
|
158
|
+
* granted explicitly at `browser_start_session` against a named origin. The
|
|
159
|
+
* two are independent and both must pass: consent answers *may Descry drive a
|
|
160
|
+
* browser against this target at all*, the profile answers *may it mutate*,
|
|
161
|
+
* and neither excuses the other.
|
|
162
|
+
*/
|
|
163
|
+
export function mutationRefusal(entry) {
|
|
164
|
+
if (entry.profile === null)
|
|
165
|
+
return null;
|
|
166
|
+
if (entry.profile.safetyLevel !== "readOnly")
|
|
167
|
+
return null;
|
|
168
|
+
return (`Environment profile "${entry.profile.name}" declares safetyLevel "readOnly", which does not permit ` +
|
|
169
|
+
"changing the application. Clicking, typing and filling can all change data, so they are refused; " +
|
|
170
|
+
"browser_navigate and browser_snapshot read the page and remain available. This is a fact about the " +
|
|
171
|
+
"profile you supplied, not about the page — the session's own consent is intact and does not override it.");
|
|
172
|
+
}
|
|
173
|
+
export function withinConsent(entry, url) {
|
|
174
|
+
try {
|
|
175
|
+
return new URL(url).origin === entry.consentedOrigin;
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=tool-support.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-support.js","sourceRoot":"","sources":["../../src/browser/tool-support.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAoB,MAAM,iBAAiB,CAAC;AAG3D,OAAO,EAAE,aAAa,EAAE,cAAc,EAA8B,MAAM,eAAe,CAAC;AAE1F,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,cAAc,EAA0B,MAAM,kBAAkB,CAAC;AAkBrH,MAAM,UAAU,YAAY,CAAC,GAAgB;IAC3C,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,CAAC;QACjD,OAAO;YACL,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,eAAe,EAAE,KAAK,CAAC,eAAe;YACtC,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,IAAI,EAAE,IAAI;SACX,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO;YACL,SAAS,EAAE,IAAI;YACf,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,CAAC;YAClB,YAAY,EAAE,CAAC;YACf,IAAI,EACF,mGAAmG;gBACnG,yFAAyF;SAC5F,CAAC;IACJ,CAAC;AACH,CAAC;AAWD;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAI,OAA+B;IAC9D,MAAM,KAAK,GAAG,YAAY,CAAC,OAA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O,cAAc,CAAC,WAAW,CAAC,CAAC;AACrC,CAAC;AAED;;;;;GAKG;AACH;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,eAAe,CAAC,KAA0B;IACxD,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACxC,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC;IAC1D,OAAO,CACL,wBAAwB,KAAK,CAAC,OAAO,CAAC,IAAI,2DAA2D;QACrG,mGAAmG;QACnG,qGAAqG;QACrG,0GAA0G,CAC3G,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAA0B,EAAE,GAAW;IACnE,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,KAAK,CAAC,eAAe,CAAC;IACvD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which standing disclosures this connection has already been given in full.
|
|
3
|
+
*
|
|
4
|
+
* The tax it removes was measured, not supposed: the R0/class-C reliability
|
|
5
|
+
* sentence is 354 characters — ~88 tokens — and appeared byte-for-byte
|
|
6
|
+
* identical on the large majority of one session's thirty-odd tool calls.
|
|
7
|
+
* Nothing about it was wrong; it was simply the same paragraph, re-billed to
|
|
8
|
+
* the caller's context window every call, and the loop this server is built
|
|
9
|
+
* for (edit, re-check, edit again) is the one that pays it most.
|
|
10
|
+
*
|
|
11
|
+
* ## What the ledger is allowed to shorten, and what it is not
|
|
12
|
+
*
|
|
13
|
+
* Only the *argument* for a cap. The floor and the class it caps to stay on
|
|
14
|
+
* every reply, first or fiftieth, in `graph.resolutionFloor` /
|
|
15
|
+
* `graph.reliabilityCap` and in the short disclosure itself. Rule 7 is about
|
|
16
|
+
* what reaches the user, and a reply that stopped naming its own cap after
|
|
17
|
+
* the first call would be a reply that silently does less.
|
|
18
|
+
*
|
|
19
|
+
* ## Per connection, deliberately not per process
|
|
20
|
+
*
|
|
21
|
+
* "Already disclosed" is a fact about one conversation. A ledger shared across
|
|
22
|
+
* connections would let the *second* client's first call inherit the first
|
|
23
|
+
* client's history — that client would receive the short form of a sentence it
|
|
24
|
+
* has never seen, which is the exact failure this is supposed to avoid, only
|
|
25
|
+
* harder to notice. So one ledger is created per `createMcpServer`, and it
|
|
26
|
+
* lives as long as that server does.
|
|
27
|
+
*/
|
|
28
|
+
export interface DisclosureLedger {
|
|
29
|
+
/**
|
|
30
|
+
* `true` the first time this key is seen on this connection, `false` after.
|
|
31
|
+
* Records the sighting — calling it is what marks the key as disclosed.
|
|
32
|
+
*/
|
|
33
|
+
firstSighting(key: string): boolean;
|
|
34
|
+
/** Keys disclosed in full so far. For tests and diagnostics. */
|
|
35
|
+
disclosed(): readonly string[];
|
|
36
|
+
}
|
|
37
|
+
export declare function createDisclosureLedger(): DisclosureLedger;
|
|
38
|
+
//# sourceMappingURL=disclosure-ledger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disclosure-ledger.d.ts","sourceRoot":"","sources":["../src/disclosure-ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACpC,gEAAgE;IAChE,SAAS,IAAI,SAAS,MAAM,EAAE,CAAC;CAChC;AAED,wBAAgB,sBAAsB,IAAI,gBAAgB,CAUzD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which standing disclosures this connection has already been given in full.
|
|
3
|
+
*
|
|
4
|
+
* The tax it removes was measured, not supposed: the R0/class-C reliability
|
|
5
|
+
* sentence is 354 characters — ~88 tokens — and appeared byte-for-byte
|
|
6
|
+
* identical on the large majority of one session's thirty-odd tool calls.
|
|
7
|
+
* Nothing about it was wrong; it was simply the same paragraph, re-billed to
|
|
8
|
+
* the caller's context window every call, and the loop this server is built
|
|
9
|
+
* for (edit, re-check, edit again) is the one that pays it most.
|
|
10
|
+
*
|
|
11
|
+
* ## What the ledger is allowed to shorten, and what it is not
|
|
12
|
+
*
|
|
13
|
+
* Only the *argument* for a cap. The floor and the class it caps to stay on
|
|
14
|
+
* every reply, first or fiftieth, in `graph.resolutionFloor` /
|
|
15
|
+
* `graph.reliabilityCap` and in the short disclosure itself. Rule 7 is about
|
|
16
|
+
* what reaches the user, and a reply that stopped naming its own cap after
|
|
17
|
+
* the first call would be a reply that silently does less.
|
|
18
|
+
*
|
|
19
|
+
* ## Per connection, deliberately not per process
|
|
20
|
+
*
|
|
21
|
+
* "Already disclosed" is a fact about one conversation. A ledger shared across
|
|
22
|
+
* connections would let the *second* client's first call inherit the first
|
|
23
|
+
* client's history — that client would receive the short form of a sentence it
|
|
24
|
+
* has never seen, which is the exact failure this is supposed to avoid, only
|
|
25
|
+
* harder to notice. So one ledger is created per `createMcpServer`, and it
|
|
26
|
+
* lives as long as that server does.
|
|
27
|
+
*/
|
|
28
|
+
export function createDisclosureLedger() {
|
|
29
|
+
const seen = new Set();
|
|
30
|
+
return {
|
|
31
|
+
firstSighting(key) {
|
|
32
|
+
if (seen.has(key))
|
|
33
|
+
return false;
|
|
34
|
+
seen.add(key);
|
|
35
|
+
return true;
|
|
36
|
+
},
|
|
37
|
+
disclosed: () => [...seen],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=disclosure-ledger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disclosure-ledger.js","sourceRoot":"","sources":["../src/disclosure-ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAYH,MAAM,UAAU,sBAAsB;IACpC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,OAAO;QACL,aAAa,CAAC,GAAG;YACf,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,OAAO,KAAK,CAAC;YAChC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACd,OAAO,IAAI,CAAC;QACd,CAAC;QACD,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;KAC3B,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -24,9 +24,20 @@ export type { BriefNode, NodeCandidates, Progress, ToolContext, ToolDefinition,
|
|
|
24
24
|
* **today**; where a tool's payload is genuinely conditional the type is a
|
|
25
25
|
* union that says so rather than a widening to `unknown`.
|
|
26
26
|
*/
|
|
27
|
-
export type {
|
|
27
|
+
export type { AffectedRef, AnalyzeData, BlockedCheck, CoChangedFile, ConfigDependencyReport, ContractPathFinding, ContractShapeMismatchReport, ContractShapeStatus, ContractsData, CrossPrData, CrossPrEmptyDiff, CrossPrGitFailure, CrossPrReport, EnvFindingReport, HiddenDependencyCheck, HiddenDependencyFinding, HistoryData, HistoryFile, HistoryFileResolved, HistoryFileUnresolved, HistoryReport, ImpactData, ImpactReport, ImpactedNode, LinkWorkspaceData, MarkIncidentData, LinkedRepo, OverlapCheck, OverlapReportChecked, PrAnalysisData, PrAnalysisEmptyDiff, PrAnalysisGitFailure, PrAnalysisLists, PrAnalysisRange, PrAnalysisReport, PrAnalysisUnresolved, PropagationData, PropagationReport, QuestionsData, ReachedNode, RelatedNode, ScopeData, ScopeNotSeeded, ScopeReport, ScopeTierCount, ScopedNodeReport, SimilarIncidentReport, SimilarIncidentSignalReport, SimilarIncidentsData, SourceRun, SupersededCheck, TracedPath, ValidateData, } from "./tools/index.ts";
|
|
28
28
|
export { serveStdio, guardStdout, createLineReader } from "./transport.ts";
|
|
29
29
|
export type { Transport, StdioOptions } from "./transport.ts";
|
|
30
30
|
export { PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, negotiateVersion, parseMessage, ProtocolError, } from "./protocol.ts";
|
|
31
31
|
export type { RpcRequest, RpcNotification, RpcResponse, RpcMessage, RpcId } from "./protocol.ts";
|
|
32
|
+
/**
|
|
33
|
+
* The scenario format — storage, schema and the refusals.
|
|
34
|
+
*
|
|
35
|
+
* Re-exported here because `descry check` reads saved scenarios through this
|
|
36
|
+
* module and must not reach past the package boundary to do it. A CLI that
|
|
37
|
+
* imported `./scenarios/storage.ts` by relative path would be a second reader
|
|
38
|
+
* of the format, free to drift from this one the day the schema changes; the
|
|
39
|
+
* whole argument for a format module is that there is exactly one.
|
|
40
|
+
*/
|
|
41
|
+
export { SCENARIO_SCHEMA_VERSION, isUnverifying, parseScenario, serializeScenario, scenariosDirectory, scenarioPath, listScenarios, readScenario, writeScenario, } from "./scenarios/index.ts";
|
|
42
|
+
export type { Scenario, ScenarioStep, ScenarioAssertion, ScenarioAssertionKind, ScenarioActionKind, ScenarioParseResult, TargetDescriptor, } from "./scenarios/index.ts";
|
|
32
43
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/D,OAAO,EACL,OAAO,EACP,UAAU,EACV,WAAW,EACX,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE9E,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC1E,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,iBAA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AAW,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjG;;;;;;;;GAQG;AACH,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,QAAQ,EACR,YAAY,EACZ,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -12,4 +12,14 @@ export { renderAnswer, renderFailed, renderHandshake, renderTimedOut, renderTool
|
|
|
12
12
|
export { TOOLS, TOOLS_BY_NAME, ToolInputError, resolveOneNode } from "./tools/index.js";
|
|
13
13
|
export { serveStdio, guardStdout, createLineReader } from "./transport.js";
|
|
14
14
|
export { PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, negotiateVersion, parseMessage, ProtocolError, } from "./protocol.js";
|
|
15
|
+
/**
|
|
16
|
+
* The scenario format — storage, schema and the refusals.
|
|
17
|
+
*
|
|
18
|
+
* Re-exported here because `descry check` reads saved scenarios through this
|
|
19
|
+
* module and must not reach past the package boundary to do it. A CLI that
|
|
20
|
+
* imported `./scenarios/storage.ts` by relative path would be a second reader
|
|
21
|
+
* of the format, free to drift from this one the day the schema changes; the
|
|
22
|
+
* whole argument for a format module is that there is exactly one.
|
|
23
|
+
*/
|
|
24
|
+
export { SCENARIO_SCHEMA_VERSION, isUnverifying, parseScenario, serializeScenario, scenariosDirectory, scenarioPath, listScenarios, readScenario, writeScenario, } from "./scenarios/index.js";
|
|
15
25
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE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kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,GACd,MAAM,sBAAsB,CAAC"}
|
package/dist/protocol.d.ts
CHANGED
|
@@ -15,9 +15,18 @@
|
|
|
15
15
|
* over `better-sqlite3`, `node --test` over a test runner, `tsc` over a bundler,
|
|
16
16
|
* `git` invoked directly over a git library — every time on the same grounds:
|
|
17
17
|
* this is a **locally installed developer tool**, and a dependency tree is a
|
|
18
|
-
* distribution problem before it is anything else.
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* distribution problem before it is anything else. Seventeen
|
|
19
|
+
* transitively-hundreds is a large price for newline-delimited JSON.
|
|
20
|
+
*
|
|
21
|
+
* This package no longer has zero runtime dependencies — `observe_runtime`
|
|
22
|
+
* composes `descry-runtime`'s execution and correlation packages, ruled in
|
|
23
|
+
* `DEC-NEXT-mcp-runtime-dependency-boundary-for-r4-evidence` — and the
|
|
24
|
+
* argument above is unaffected, because it was never a vow of zero. It is a
|
|
25
|
+
* cost/benefit about *this* dependency: every package `@descryy/mcp` depends
|
|
26
|
+
* on is one of Descry's own, versioned and published alongside it, and each
|
|
27
|
+
* one is there because a stage of a real run happens inside it. That is a
|
|
28
|
+
* different trade from adding a stack of HTTP and OAuth packages to serve a
|
|
29
|
+
* transport this server will never open a socket for.
|
|
21
30
|
*
|
|
22
31
|
* **The cost is named, not waved away.** Hand-rolling means spec drift is
|
|
23
32
|
* silent: the wire format changes, the client stops working, and nothing in this
|
package/dist/protocol.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,mEAAmE;AACnE,MAAM,MAAM,KAAK,GAAG,MAAM,GAA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BAAgB,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM,CAI3D;AAMD;;;;;;GAMG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,EAAE,KAAK,GAAG,IAAI,CAAC;gBAEd,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,GAAG,IAAI;CAM5D;AAMD,+EAA+E;AAC/E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAsCrD;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,IAAI,UAAU,CAEpE;AAED,wBAAgB,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,GAAG,WAAW,CAE1D;AAED,wBAAgB,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,WAAW,CAM1F"}
|
package/dist/protocol.js
CHANGED
|
@@ -15,9 +15,18 @@
|
|
|
15
15
|
* over `better-sqlite3`, `node --test` over a test runner, `tsc` over a bundler,
|
|
16
16
|
* `git` invoked directly over a git library — every time on the same grounds:
|
|
17
17
|
* this is a **locally installed developer tool**, and a dependency tree is a
|
|
18
|
-
* distribution problem before it is anything else.
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* distribution problem before it is anything else. Seventeen
|
|
19
|
+
* transitively-hundreds is a large price for newline-delimited JSON.
|
|
20
|
+
*
|
|
21
|
+
* This package no longer has zero runtime dependencies — `observe_runtime`
|
|
22
|
+
* composes `descry-runtime`'s execution and correlation packages, ruled in
|
|
23
|
+
* `DEC-NEXT-mcp-runtime-dependency-boundary-for-r4-evidence` — and the
|
|
24
|
+
* argument above is unaffected, because it was never a vow of zero. It is a
|
|
25
|
+
* cost/benefit about *this* dependency: every package `@descryy/mcp` depends
|
|
26
|
+
* on is one of Descry's own, versioned and published alongside it, and each
|
|
27
|
+
* one is there because a stage of a real run happens inside it. That is a
|
|
28
|
+
* different trade from adding a stack of HTTP and OAuth packages to serve a
|
|
29
|
+
* transport this server will never open a socket for.
|
|
21
30
|
*
|
|
22
31
|
* **The cost is named, not waved away.** Hand-rolling means spec drift is
|
|
23
32
|
* silent: the wire format changes, the client stops working, and nothing in this
|
package/dist/protocol.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAiCH,uEAAuE;AACvE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAK,CAAC;AACtC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAK,CAAC;AAC1C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAK,CAAC;AAC3C,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAK,CAAC;AACzC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAK,CAAC;AAEzC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAC7C,MAAM,CAAC,MAAM,2BAA2B,GAAsB;IAC5D,YAAY;IACZ,YAAY;IACZ,YAAY;CACb,CAAC;AAEF,MAAM,UAAU,gBAAgB,CAAC,SAAkB;IACjD,OAAO,OAAO,SAAS,KAAK,QAAQ,IAAI,2BAA2B,CAAC,QAAQ,CAAC,SAAS,CAAC;QACrF,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,gBAAgB,CAAC;AACvB,CAAC;AAED,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E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CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE;KAClE,CAAC;AACJ,CAAC"}
|
package/dist/render.d.ts
CHANGED
|
@@ -37,8 +37,9 @@
|
|
|
37
37
|
* `server.ts`, not here: this module never sees a mint, only a redeemed run.
|
|
38
38
|
*/
|
|
39
39
|
import { type ReliabilityClass, type ReportCategory } from "@descryy/ir";
|
|
40
|
-
import type { ResultState, ToolClass } from "@descryy/ir";
|
|
40
|
+
import type { ResultState, SignalTypeCount, ToolClass } from "@descryy/ir";
|
|
41
41
|
import type { QueryResult } from "@descryy/core";
|
|
42
|
+
import type { DisclosureLedger } from "./disclosure-ledger.ts";
|
|
42
43
|
export type { ResultState } from "@descryy/ir";
|
|
43
44
|
/**
|
|
44
45
|
* MK-5 — which of the sixteen tools states a conclusion about the user's code
|
|
@@ -85,8 +86,38 @@ export interface TruncationDetail {
|
|
|
85
86
|
/** A cursor to fetch the rest. `null` until pagination exists to redeem one. */
|
|
86
87
|
readonly more: string | null;
|
|
87
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* What a tool that actually watched a running application declares about what
|
|
91
|
+
* it saw — G4's `E`, and by its presence G3's precondition.
|
|
92
|
+
*
|
|
93
|
+
* **Presence is the claim, not the count.** A tool constructs this only on a
|
|
94
|
+
* path where an execution really ran and evidence really came back; omitting
|
|
95
|
+
* it is how every other tool says "nothing was witnessed here", which is the
|
|
96
|
+
* safe default and the one twenty-eight of the thirty tools take. The two
|
|
97
|
+
* that declare it are `observe_runtime` and `observe_tests` — the two that
|
|
98
|
+
* run something.
|
|
99
|
+
*
|
|
100
|
+
* `E` is a count of *channels*, not of records: six console messages are one
|
|
101
|
+
* signal type, a console message plus a network response are two
|
|
102
|
+
* (`@descryy/ir`'s {@link RUNTIME_SIGNAL_TYPES}). Compute it with that
|
|
103
|
+
* package's `independentSignalTypes` rather than counting here — the clamp to
|
|
104
|
+
* the six declared channels is its job, and a second implementation of it is a
|
|
105
|
+
* second place for the vocabulary to drift.
|
|
106
|
+
*
|
|
107
|
+
* There is deliberately no `M` field — see `deriveEnvelopeCategory`.
|
|
108
|
+
*/
|
|
109
|
+
export interface WitnessedEvidence {
|
|
110
|
+
readonly independentSignalTypes: SignalTypeCount;
|
|
111
|
+
}
|
|
88
112
|
export interface ToolAnswer<T> {
|
|
89
113
|
readonly result: QueryResult<T>;
|
|
114
|
+
/**
|
|
115
|
+
* Present only on a path that observed a real running application. Absent
|
|
116
|
+
* everywhere else, which is what makes `unconfirmed` the default for a
|
|
117
|
+
* graph-only answer rather than something each tool must remember to ask
|
|
118
|
+
* for. See {@link WitnessedEvidence} and `AnswerEnvelope.reportCategory`.
|
|
119
|
+
*/
|
|
120
|
+
readonly runtimeEvidence?: WitnessedEvidence;
|
|
90
121
|
/**
|
|
91
122
|
* One of the five result states (§1). Omitted means `"ok"` — the common
|
|
92
123
|
* case, and the one that needs no tool-author ceremony.
|
|
@@ -127,6 +158,55 @@ export interface ToolAnswer<T> {
|
|
|
127
158
|
readonly exemplar: string;
|
|
128
159
|
readonly handle: string;
|
|
129
160
|
};
|
|
161
|
+
/**
|
|
162
|
+
* How this tool shrinks its own reply when the rendered result would exceed
|
|
163
|
+
* `MAX_REPLY_BYTES`. Called with the bytes available for `data` alone, every
|
|
164
|
+
* other cost already subtracted; called again with a corrected figure if the
|
|
165
|
+
* first attempt still comes in over.
|
|
166
|
+
*
|
|
167
|
+
* Optional, and absent means today's behaviour — the reply is rendered at
|
|
168
|
+
* whatever size it comes to. A tool whose payload is already bounded (a node
|
|
169
|
+
* `limit`, a single verdict) needs no hook; a tool whose reply grows with the
|
|
170
|
+
* user's repository does, and `get_git_diff` is the one that proved it.
|
|
171
|
+
*/
|
|
172
|
+
readonly fitToBudget?: (budgetBytes: number) => ReplyFit<T>;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The ceiling on one rendered tool result, serialized — `content` frame and
|
|
176
|
+
* `structuredContent` envelope together, which is what a host actually
|
|
177
|
+
* receives and counts.
|
|
178
|
+
*
|
|
179
|
+
* A starting value, not a measurement, in this repo's usual sense: the one
|
|
180
|
+
* hard number behind it is a real failure, `get_git_diff` on an ordinary
|
|
181
|
+
* 48-file branch diff returning 84,516 characters and being rejected outright
|
|
182
|
+
* by the host before the caller saw any of it. 60,000 sits well under the
|
|
183
|
+
* smallest size observed to fail, with room for the narrated frame that
|
|
184
|
+
* repeats the disclosures alongside the envelope.
|
|
185
|
+
*
|
|
186
|
+
* Shared rather than per-tool on purpose: `get_git_diff` is the tool that hit
|
|
187
|
+
* this, twice, but nothing about the failure was specific to diffs. Any tool
|
|
188
|
+
* adopts the ceiling by implementing `ToolAnswer.fitToBudget`.
|
|
189
|
+
*/
|
|
190
|
+
export declare const MAX_REPLY_BYTES = 60000;
|
|
191
|
+
/**
|
|
192
|
+
* A tool's own answer to "make this fit in `budgetBytes`".
|
|
193
|
+
*
|
|
194
|
+
* Only the tool can shrink its payload honestly — which field is droppable,
|
|
195
|
+
* what the caller must be told about the drop, and what re-request would
|
|
196
|
+
* recover it are all facts about that tool. So the ceiling is enforced here
|
|
197
|
+
* and the shrinking is delegated, rather than this module truncating a shape
|
|
198
|
+
* it does not understand.
|
|
199
|
+
*/
|
|
200
|
+
export interface ReplyFit<T> {
|
|
201
|
+
readonly data: T;
|
|
202
|
+
/**
|
|
203
|
+
* Disclosures naming exactly what the budget withheld — appended to the
|
|
204
|
+
* tool's own notes. Must be non-empty whenever anything was withheld or
|
|
205
|
+
* dropped: a reply shrunk in silence is the failure rule 7 exists to stop.
|
|
206
|
+
*/
|
|
207
|
+
readonly notes: readonly string[];
|
|
208
|
+
/** Set when items left the reply entirely, not merely lost their payload. */
|
|
209
|
+
readonly truncatedDetail?: TruncationDetail;
|
|
130
210
|
}
|
|
131
211
|
export interface McpContent {
|
|
132
212
|
readonly type: "text";
|
|
@@ -185,15 +265,31 @@ export interface AnswerEnvelope<T = unknown> {
|
|
|
185
265
|
* MK-8/MK-11 — §19's five categories, settled for this surface: a
|
|
186
266
|
* `conclusion`-tier tool states its verdict in `headline`'s own plain words
|
|
187
267
|
* rather than through this apparatus (it is a fact, not a hypothesis), so
|
|
188
|
-
* this is `null` there.
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
268
|
+
* this is `null` there. For an `evidence`-tier tool: `refused` maps to the
|
|
269
|
+
* direct equivalent, `not analysable` ("could not look" vs. "cannot
|
|
270
|
+
* establish this here" are the same statement); `failed`/`timed_out` carry
|
|
271
|
+
* no claim at all, so `null`; `ok`/`empty` go through G3/G4.
|
|
272
|
+
*
|
|
273
|
+
* **A graph-only answer short-circuits at G3 and is `unconfirmed`** — a
|
|
274
|
+
* structural fact with no runtime corroboration is never `confirmed` by
|
|
275
|
+
* construction, whatever its resolution.
|
|
276
|
+
*
|
|
277
|
+
* **An answer that watched a running application does not.** MK-8 was
|
|
278
|
+
* written when nothing in this surface could witness anything, and its
|
|
279
|
+
* "descry-runtime's loop does not run inside an MCP call" was true then;
|
|
280
|
+
* `observe_runtime` composes descry-runtime, boots or attaches to a real
|
|
281
|
+
* application and writes R4 edges, so it is now false for exactly the tools
|
|
282
|
+
* that do. Such a tool declares {@link ToolAnswer.runtimeEvidence} and G4
|
|
283
|
+
* runs on what it actually saw. Reporting a witnessed result more weakly
|
|
284
|
+
* than the evidence under it inverts rule 2's whole purpose, which is why
|
|
285
|
+
* this is a defect rather than conservatism.
|
|
286
|
+
*
|
|
287
|
+
* `confirmed` stays unreachable from here regardless — DEC-334 reserves it
|
|
288
|
+
* for a result that passed the full governance pipeline, "on every surface,
|
|
289
|
+
* meaning the same thing everywhere", and that pipeline does not run in an
|
|
290
|
+
* MCP call (`provenance.governancePipeline` says so on every reply). So
|
|
291
|
+
* `strongly supported` is this surface's ceiling, and it is reached by
|
|
292
|
+
* evidence rather than granted.
|
|
197
293
|
*/
|
|
198
294
|
readonly reportCategory: ReportCategory | null;
|
|
199
295
|
/** MK-6. Constant for this server — see `Provenance`'s own doc. */
|
|
@@ -209,6 +305,21 @@ export interface RenderOptions {
|
|
|
209
305
|
readonly toolTier: ToolTier;
|
|
210
306
|
readonly elapsedMs: number;
|
|
211
307
|
readonly limitMs: number;
|
|
308
|
+
/**
|
|
309
|
+
* This connection's record of which standing disclosures it has already been
|
|
310
|
+
* given in full. Optional: a caller with no session to dedupe within (every
|
|
311
|
+
* direct `renderAnswer` in a test, every non-server consumer) gets the full
|
|
312
|
+
* sentence every time, which is the safe default — a short reference to a
|
|
313
|
+
* paragraph nobody was shown is worse than the repetition.
|
|
314
|
+
*/
|
|
315
|
+
readonly disclosureLedger?: DisclosureLedger;
|
|
316
|
+
/**
|
|
317
|
+
* Overrides `MAX_REPLY_BYTES`. Exists so a test can prove the fitting
|
|
318
|
+
* behaviour against a small, deterministic ceiling rather than by generating
|
|
319
|
+
* 60KB of real data — the ceiling's *value* is a starting number, but the
|
|
320
|
+
* mechanism reacting to it must be checkable exactly.
|
|
321
|
+
*/
|
|
322
|
+
readonly maxReplyBytes?: number;
|
|
212
323
|
}
|
|
213
324
|
/**
|
|
214
325
|
* A refusal's reason must be the specific, verbatim thing that blocked it —
|
package/dist/render.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAmB,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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