@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
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
*/
|
|
39
39
|
import { existsSync, statSync } from "node:fs";
|
|
40
40
|
import { resolve } from "node:path";
|
|
41
|
-
import { writeConfig } from "../session.js";
|
|
41
|
+
import { writeConfig, writeWorkspaceRepos } from "../session.js";
|
|
42
42
|
import { answer, requiredString, ToolInputError } from "./kit.js";
|
|
43
43
|
const SCHEMA = {
|
|
44
44
|
type: "object",
|
|
@@ -113,6 +113,17 @@ async function run(args, ctx) {
|
|
|
113
113
|
notes.push(`${entry.repo}: replaced previous workspace "${result.previousWorkspace}" with "${workspace}".`);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
+
// The membership list, written into every repository that took the workspace
|
|
117
|
+
// id — and only after the loop, so it names the repositories the link
|
|
118
|
+
// actually reached rather than the ones it was asked about. A workspace name
|
|
119
|
+
// alone tells a session nothing about where its siblings live on disk, and a
|
|
120
|
+
// workspace-scoped confirmed fact lives in whichever repository recorded it
|
|
121
|
+
// (DEC-NEXT-workspace-scoped-confirmed-facts). Still nothing inferred: this
|
|
122
|
+
// is the caller's own list, resolved to absolute paths and written back.
|
|
123
|
+
const members = written.map((w) => ({ path: w.path, repo: w.repo }));
|
|
124
|
+
for (const member of members) {
|
|
125
|
+
await writeWorkspaceRepos(member.path, members);
|
|
126
|
+
}
|
|
116
127
|
if (written.length < repos.length) {
|
|
117
128
|
notes.push(`${repos.length - written.length} of ${repos.length} repositories were skipped. The workspace ` +
|
|
118
129
|
"id is only byte-identical where it was actually written — re-run for the skipped paths " +
|
|
@@ -134,6 +145,7 @@ async function run(args, ctx) {
|
|
|
134
145
|
commitSha: null,
|
|
135
146
|
graphBuiltAt: null,
|
|
136
147
|
irSchemaVersion: ctx.session.provider().baseStamp().irSchemaVersion,
|
|
148
|
+
commitSpread: ctx.session.provider().baseStamp().commitSpread,
|
|
137
149
|
notes,
|
|
138
150
|
data: { workspace, written, requested: repos.length },
|
|
139
151
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link-workspace.js","sourceRoot":"","sources":["../../src/tools/link-workspace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,O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AAC,MAAM,iBAAiB,GAAmB;IAC/C,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE,eAAe;IACtB,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,8CAA8C;IACrD,WAAW,EACT,0FAA0F;QAC1F,2FAA2F;QAC3F,8FAA8F;QAC9F,wFAAwF;QACxF,oFAAoF;QACpF,8BAA8B;IAChC,WAAW,EAAE,MAA4C;IACzD,GAAG;CACJ,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mark_incident` — "that was a bug, and I just fixed it."
|
|
3
|
+
*
|
|
4
|
+
* The mechanism that lets an incident corpus grow during ordinary work, and the
|
|
5
|
+
* only one with precision 1.0 by construction: a person is asserting it.
|
|
6
|
+
*
|
|
7
|
+
* ## Why this exists
|
|
8
|
+
*
|
|
9
|
+
* `similar_incidents` is built, tested and correct, and starved. Until now one
|
|
10
|
+
* thing in the whole system minted an `INCIDENT` — a commit body carrying
|
|
11
|
+
* `This reverts commit <sha>` — which produced **zero** incidents across three
|
|
12
|
+
* measured repositories and two in a real product repository. Widening the
|
|
13
|
+
* automatic detection helps (`incidents.ts` now reads manual reverts and
|
|
14
|
+
* `Fixes #123` too), but every automatic mechanism can only read what somebody
|
|
15
|
+
* already wrote down. Most bugs are fixed forward with a commit message that
|
|
16
|
+
* says what the code now does, not what it used to do wrong.
|
|
17
|
+
*
|
|
18
|
+
* The heuristic that would close that gap was built and measured and refused:
|
|
19
|
+
* `bench/incident-fix-forward.mjs` scored **25%** against a 90% threshold
|
|
20
|
+
* declared before it ran. So the remaining route is to ask, once, cheaply, at
|
|
21
|
+
* the moment the developer already knows the answer.
|
|
22
|
+
*
|
|
23
|
+
* ## Where the record lives, and why not in the graph
|
|
24
|
+
*
|
|
25
|
+
* `.descry/config.json`, beside `confirmedFacts` — DEC-223's storage decision
|
|
26
|
+
* for exactly this class of data. A store is derived data (DEC-017) and every
|
|
27
|
+
* derived table is dropped on a schema bump; a fact a person asserted, which
|
|
28
|
+
* exists nowhere else, must not be. The graph holds a *projection*
|
|
29
|
+
* (`createConfirmedIncidentSource`), re-derived by every `analyze`, and this
|
|
30
|
+
* tool writes both so the incident is visible in the same conversation that
|
|
31
|
+
* recorded it rather than after the next rebuild.
|
|
32
|
+
*
|
|
33
|
+
* ## Reliability
|
|
34
|
+
*
|
|
35
|
+
* DEC-223's rule, unchanged: an edge resting on testimony is capped at class B
|
|
36
|
+
* however much structure surrounds it. One unaudited assertion is one unaudited
|
|
37
|
+
* assertion. This tool asserts a defect existed; it asserts nothing about why,
|
|
38
|
+
* and nothing here may promote it.
|
|
39
|
+
*
|
|
40
|
+
* ## Class
|
|
41
|
+
*
|
|
42
|
+
* `action` — DEC-278's test is *"can this call's effect change a later finding
|
|
43
|
+
* without the developer having said so"*, and an `INCIDENT_CORRELATED` edge
|
|
44
|
+
* biases diff-scoping traversal toward the files it names on every later run.
|
|
45
|
+
* Gated by the same two-call `confirmToken` handshake `questions` uses.
|
|
46
|
+
*
|
|
47
|
+
* See `DEC-NEXT-incident-minting-beyond-explicit-reverts`.
|
|
48
|
+
*/
|
|
49
|
+
import type { ConfirmedIncident } from "@descryy/ir";
|
|
50
|
+
import { type ToolDefinition } from "./kit.ts";
|
|
51
|
+
export interface MarkIncidentData {
|
|
52
|
+
/** The record as written. Read it back to see exactly what was stored. */
|
|
53
|
+
readonly recorded: ConfirmedIncident;
|
|
54
|
+
/** The `INCIDENT` node id, so a caller can query it immediately. */
|
|
55
|
+
readonly incidentNodeId: string;
|
|
56
|
+
/** Where the durable record lives — a file a person can read and correct. */
|
|
57
|
+
readonly configPath: string;
|
|
58
|
+
/** How many confirmed incidents this repository now has on record. */
|
|
59
|
+
readonly totalConfirmed: number;
|
|
60
|
+
/**
|
|
61
|
+
* Paths named that the graph has no node for.
|
|
62
|
+
*
|
|
63
|
+
* The incident is still recorded and still correlated — a developer naming a
|
|
64
|
+
* file Descry cannot read is a gap in Descry, not a mistake by the developer.
|
|
65
|
+
*/
|
|
66
|
+
readonly filesNotInGraph: readonly string[];
|
|
67
|
+
}
|
|
68
|
+
export declare const markIncidentTool: ToolDefinition;
|
|
69
|
+
//# sourceMappingURL=mark-incident.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mark-incident.d.ts","sourceRoot":"","sources":["../../src/tools/mark-incident.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AASH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrD,OAAO,EAOL,KAAK,cAAc,EACpB,MAAM,UAAU,CAAC;AAGlB,MAAM,WAAW,gBAAgB;IAC/B,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACrC,oEAAoE;IACpE,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,6EAA6E;IAC7E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,sEAAsE;IACtE,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC;;;;;OAKG;IACH,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7C;AA0KD,eAAO,MAAM,gBAAgB,EAAE,cAkB9B,CAAC"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mark_incident` — "that was a bug, and I just fixed it."
|
|
3
|
+
*
|
|
4
|
+
* The mechanism that lets an incident corpus grow during ordinary work, and the
|
|
5
|
+
* only one with precision 1.0 by construction: a person is asserting it.
|
|
6
|
+
*
|
|
7
|
+
* ## Why this exists
|
|
8
|
+
*
|
|
9
|
+
* `similar_incidents` is built, tested and correct, and starved. Until now one
|
|
10
|
+
* thing in the whole system minted an `INCIDENT` — a commit body carrying
|
|
11
|
+
* `This reverts commit <sha>` — which produced **zero** incidents across three
|
|
12
|
+
* measured repositories and two in a real product repository. Widening the
|
|
13
|
+
* automatic detection helps (`incidents.ts` now reads manual reverts and
|
|
14
|
+
* `Fixes #123` too), but every automatic mechanism can only read what somebody
|
|
15
|
+
* already wrote down. Most bugs are fixed forward with a commit message that
|
|
16
|
+
* says what the code now does, not what it used to do wrong.
|
|
17
|
+
*
|
|
18
|
+
* The heuristic that would close that gap was built and measured and refused:
|
|
19
|
+
* `bench/incident-fix-forward.mjs` scored **25%** against a 90% threshold
|
|
20
|
+
* declared before it ran. So the remaining route is to ask, once, cheaply, at
|
|
21
|
+
* the moment the developer already knows the answer.
|
|
22
|
+
*
|
|
23
|
+
* ## Where the record lives, and why not in the graph
|
|
24
|
+
*
|
|
25
|
+
* `.descry/config.json`, beside `confirmedFacts` — DEC-223's storage decision
|
|
26
|
+
* for exactly this class of data. A store is derived data (DEC-017) and every
|
|
27
|
+
* derived table is dropped on a schema bump; a fact a person asserted, which
|
|
28
|
+
* exists nowhere else, must not be. The graph holds a *projection*
|
|
29
|
+
* (`createConfirmedIncidentSource`), re-derived by every `analyze`, and this
|
|
30
|
+
* tool writes both so the incident is visible in the same conversation that
|
|
31
|
+
* recorded it rather than after the next rebuild.
|
|
32
|
+
*
|
|
33
|
+
* ## Reliability
|
|
34
|
+
*
|
|
35
|
+
* DEC-223's rule, unchanged: an edge resting on testimony is capped at class B
|
|
36
|
+
* however much structure surrounds it. One unaudited assertion is one unaudited
|
|
37
|
+
* assertion. This tool asserts a defect existed; it asserts nothing about why,
|
|
38
|
+
* and nothing here may promote it.
|
|
39
|
+
*
|
|
40
|
+
* ## Class
|
|
41
|
+
*
|
|
42
|
+
* `action` — DEC-278's test is *"can this call's effect change a later finding
|
|
43
|
+
* without the developer having said so"*, and an `INCIDENT_CORRELATED` edge
|
|
44
|
+
* biases diff-scoping traversal toward the files it names on every later run.
|
|
45
|
+
* Gated by the same two-call `confirmToken` handshake `questions` uses.
|
|
46
|
+
*
|
|
47
|
+
* See `DEC-NEXT-incident-minting-beyond-explicit-reverts`.
|
|
48
|
+
*/
|
|
49
|
+
import { buildGraph, confirmedIncidentId, createConfirmedIncidentSource, nodesInFiles, persistGraph, } from "@descryy/core";
|
|
50
|
+
import { writeConfirmedIncident } from "../session.js";
|
|
51
|
+
import { answer, optionalString, optionalStringArray, requiredString, ToolInputError, } from "./kit.js";
|
|
52
|
+
const SCHEMA = {
|
|
53
|
+
type: "object",
|
|
54
|
+
properties: {
|
|
55
|
+
summary: {
|
|
56
|
+
type: "string",
|
|
57
|
+
description: "What broke, in your own words — one sentence. This becomes the incident's name and is " +
|
|
58
|
+
"matched against future failures, so describe the symptom rather than the fix " +
|
|
59
|
+
"(\"invoice totals doubled for multi-currency orders\", not \"corrected the rate lookup\").",
|
|
60
|
+
},
|
|
61
|
+
files: {
|
|
62
|
+
type: "array",
|
|
63
|
+
items: { type: "string" },
|
|
64
|
+
minItems: 1,
|
|
65
|
+
description: "Repo-relative paths the defect lived in. At least one. These are what make the incident " +
|
|
66
|
+
"findable later and what biases future blast radii toward this area, so name where the " +
|
|
67
|
+
"bug was, not every file the fix happened to touch.",
|
|
68
|
+
},
|
|
69
|
+
errorText: {
|
|
70
|
+
type: "string",
|
|
71
|
+
description: "The error or exception text as you saw it, if there was one. Optional, and worth giving: " +
|
|
72
|
+
"matching a future failure against real error text is what this corpus is for, and a " +
|
|
73
|
+
"commit subject line is a thin substitute.",
|
|
74
|
+
},
|
|
75
|
+
fixedAtCommit: {
|
|
76
|
+
type: "string",
|
|
77
|
+
description: "The commit that fixed it, if it is already committed. Optional — omit it rather than " +
|
|
78
|
+
"guessing, since recording a commit that did not fix this claims something you did not.",
|
|
79
|
+
},
|
|
80
|
+
confirmedBy: {
|
|
81
|
+
type: "string",
|
|
82
|
+
description: "Free text — who is asserting this. Defaults to \"user\".",
|
|
83
|
+
},
|
|
84
|
+
confirmToken: {
|
|
85
|
+
type: "string",
|
|
86
|
+
description: "The token returned by a previous call. Recording an incident takes two calls: the first " +
|
|
87
|
+
"returns a token and writes nothing, the second redeems it. A token is single-use, " +
|
|
88
|
+
"expires, and is only valid for this tool.",
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
required: ["summary", "files"],
|
|
92
|
+
additionalProperties: false,
|
|
93
|
+
};
|
|
94
|
+
async function run(args, ctx) {
|
|
95
|
+
const { session } = ctx;
|
|
96
|
+
const summary = requiredString(args, "summary");
|
|
97
|
+
const files = optionalStringArray(args, "files");
|
|
98
|
+
if (files === undefined || files.length === 0) {
|
|
99
|
+
throw new ToolInputError('"files" must name at least one repo-relative path — an incident naming no file has nothing ' +
|
|
100
|
+
"to attach it to, and would be invisible to every query that looks for one");
|
|
101
|
+
}
|
|
102
|
+
const errorText = optionalString(args, "errorText");
|
|
103
|
+
const fixedAtCommit = optionalString(args, "fixedAtCommit");
|
|
104
|
+
const confirmedBy = optionalString(args, "confirmedBy") ?? "user";
|
|
105
|
+
const root = await session.root();
|
|
106
|
+
const recorded = {
|
|
107
|
+
repo: session.config.repo,
|
|
108
|
+
summary,
|
|
109
|
+
files: [...new Set(files)].sort(),
|
|
110
|
+
...(errorText === undefined ? {} : { errorText }),
|
|
111
|
+
...(fixedAtCommit === undefined ? {} : { fixedAtCommit }),
|
|
112
|
+
confirmedBy,
|
|
113
|
+
confirmedAt: new Date().toISOString(),
|
|
114
|
+
};
|
|
115
|
+
const driver = session.store().driver;
|
|
116
|
+
// Measured **before** the projection runs. The projection mints a `FILE` node
|
|
117
|
+
// for every path the record names — the same thing the git source does for a
|
|
118
|
+
// reverted commit's files — so asking afterwards would always answer "all of
|
|
119
|
+
// them are in the graph" and the disclosure would be a tautology.
|
|
120
|
+
const { missing: filesNotInGraph } = nodesInFiles(driver, recorded.files);
|
|
121
|
+
ctx.progress(`Recording an incident in ${session.config.repo}`);
|
|
122
|
+
const written = await writeConfirmedIncident(session.repoPath, recorded);
|
|
123
|
+
// Projected into the store now, not at the next `analyze`, so the incident is
|
|
124
|
+
// visible in the conversation that recorded it — the same reason `questions`
|
|
125
|
+
// merges its just-written fact into the response it is about to return.
|
|
126
|
+
ctx.progress("Projecting it into the graph");
|
|
127
|
+
const batch = await createConfirmedIncidentSource({
|
|
128
|
+
repo: session.config.repo,
|
|
129
|
+
// Every record, not just this one: the projection is of the whole file, and
|
|
130
|
+
// a batch carrying only the newest would invalidate the rest of them.
|
|
131
|
+
incidents: [...(session.config.confirmedIncidents ?? []), recorded],
|
|
132
|
+
}).emit({ root });
|
|
133
|
+
const built = buildGraph([batch], { nodeExists: (id) => session.provider().node(id) !== undefined });
|
|
134
|
+
persistGraph(driver, [batch], built);
|
|
135
|
+
const stamp = session.provider().baseStamp();
|
|
136
|
+
const notes = [
|
|
137
|
+
"Recorded as testimony, not as a reading of the repository. An edge resting on it is capped at " +
|
|
138
|
+
"reliability class B (DEC-223) however much structure surrounds it — one unaudited assertion " +
|
|
139
|
+
"is one unaudited assertion.",
|
|
140
|
+
`The durable record is ${written.path}, which is a file you can read and correct. The graph ` +
|
|
141
|
+
"holds a projection of it, re-derived by every analyze, so a rebuild never loses it.",
|
|
142
|
+
];
|
|
143
|
+
if (fixedAtCommit === undefined) {
|
|
144
|
+
notes.push("No fixing commit was named, so no FIX_PATTERN was minted and no FIXED_BY edge exists. " +
|
|
145
|
+
'"A defect existed" and "this commit fixed it" are separate claims and only the second ' +
|
|
146
|
+
"licenses that edge.");
|
|
147
|
+
}
|
|
148
|
+
if (filesNotInGraph.length > 0) {
|
|
149
|
+
notes.push(`${filesNotInGraph.length} of the named path(s) have no node in the graph ` +
|
|
150
|
+
`(${filesNotInGraph.slice(0, 5).join(", ")}). The incident is recorded and correlated to ` +
|
|
151
|
+
"them anyway — a developer naming a file Descry cannot read is a gap in Descry, not a " +
|
|
152
|
+
"mistake to discard. Run analyze if the graph predates them.");
|
|
153
|
+
}
|
|
154
|
+
return answer({
|
|
155
|
+
headline: `Recorded an incident in ${session.config.repo}, correlated to ${recorded.files.length} file(s). ` +
|
|
156
|
+
`${written.total} confirmed incident(s) now on record.`,
|
|
157
|
+
// A name-level fact: this defect existed and touched these paths. It makes
|
|
158
|
+
// no claim about program shape.
|
|
159
|
+
nameLevel: true,
|
|
160
|
+
// R0, and honestly so. Testimony is not a point on the R0-R4 ladder at all —
|
|
161
|
+
// that ladder measures how much tooling ran — so the honest floor is the
|
|
162
|
+
// bottom of it, with the real ceiling expressed by `humanAsserted` where a
|
|
163
|
+
// finding is actually classified.
|
|
164
|
+
resolutionFloor: 0,
|
|
165
|
+
commitSha: stamp.commitSha,
|
|
166
|
+
graphBuiltAt: stamp.graphBuiltAt,
|
|
167
|
+
irSchemaVersion: stamp.irSchemaVersion,
|
|
168
|
+
commitSpread: stamp.commitSpread,
|
|
169
|
+
notes,
|
|
170
|
+
data: {
|
|
171
|
+
recorded,
|
|
172
|
+
incidentNodeId: confirmedIncidentId({ repo: session.config.repo, ...(root.workspace === undefined ? {} : { workspace: root.workspace }) }, recorded),
|
|
173
|
+
configPath: written.path,
|
|
174
|
+
totalConfirmed: written.total,
|
|
175
|
+
filesNotInGraph,
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Always returns a sentence: unlike `questions`, whose unconfirmed shape is a
|
|
181
|
+
* genuine read of the open-question queue, there is no argument to this tool
|
|
182
|
+
* that makes it not write.
|
|
183
|
+
*/
|
|
184
|
+
function describeAction(args) {
|
|
185
|
+
const summary = args["summary"];
|
|
186
|
+
const files = args["files"];
|
|
187
|
+
if (typeof summary !== "string" || !Array.isArray(files) || files.length === 0)
|
|
188
|
+
return undefined;
|
|
189
|
+
return (`record a confirmed incident — "${summary}" — correlated to ${files.length} file(s) ` +
|
|
190
|
+
`(${files.slice(0, 3).join(", ")}${files.length > 3 ? ", …" : ""}). It is written to ` +
|
|
191
|
+
".descry/config.json and projected into the graph, where it will bias future blast radii " +
|
|
192
|
+
"toward those files and can be matched against future failures. Capped at reliability class B.");
|
|
193
|
+
}
|
|
194
|
+
export const markIncidentTool = {
|
|
195
|
+
name: "mark_incident",
|
|
196
|
+
class: "action",
|
|
197
|
+
tier: "evidence",
|
|
198
|
+
version: "1.0.0",
|
|
199
|
+
title: "Record a bug you just fixed, so a future failure can match against it",
|
|
200
|
+
description: "Record that a defect existed in this repository and which files it lived in, so " +
|
|
201
|
+
"\"similar_incidents\" can match a future failure against it. This is the mechanism that lets " +
|
|
202
|
+
"an incident corpus grow during ordinary work: git history only yields an incident when " +
|
|
203
|
+
"somebody wrote a revert or a \"Fixes #123\", and most bugs are fixed forward with a message " +
|
|
204
|
+
"that says what the code now does rather than what it did wrong. Recorded as testimony — an " +
|
|
205
|
+
"edge resting on it is capped at reliability class B regardless of anything else about it " +
|
|
206
|
+
"(DEC-223). Takes a two-call confirmation: the first call performs nothing and returns a " +
|
|
207
|
+
"token; call again with \"confirmToken\" to actually record it.",
|
|
208
|
+
inputSchema: SCHEMA,
|
|
209
|
+
run,
|
|
210
|
+
describeAction,
|
|
211
|
+
};
|
|
212
|
+
//# sourceMappingURL=mark-incident.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mark-incident.js","sourceRoot":"","sources":["../../src/tools/mark-incident.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,6BAA6B,EAC7B,YAAY,EACZ,YAAY,GACb,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EACL,MAAM,EACN,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,cAAc,GAGf,MAAM,UAAU,CAAC;AAqBlB,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,wFAAwF;gBACxF,+EAA+E;gBAC/E,4FAA4F;SAC/F;QACD,KAAK,EAAE;YACL,IAAI,EAAE,O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,QAAQ;IACf,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,uEAAuE;IAC9E,WAAW,EACT,kFAAkF;QAClF,+FAA+F;QAC/F,yFAAyF;QACzF,8FAA8F;QAC9F,6FAA6F;QAC7F,2FAA2F;QAC3F,0FAA0F;QAC1F,gEAAgE;IAClE,WAAW,EAAE,MAA4C;IACzD,GAAG;IACH,cAAc;CACf,CAAC"}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `observe_runtime` — boot or attach to a real application, watch it, and write
|
|
3
|
+
* what was witnessed into the graph as R4 facts.
|
|
4
|
+
*
|
|
5
|
+
* **The second tool that writes, and the first that writes something no
|
|
6
|
+
* re-index can reproduce.** `analyze` re-derives the graph from source already
|
|
7
|
+
* on disk, so nothing it writes is a new claim about the world. This one runs
|
|
8
|
+
* a real process and records what it saw happen, which is the one accuracy
|
|
9
|
+
* source architecture §11B.3 calls *"the core technical moat"* and the one a
|
|
10
|
+
* purely static tool is structurally unable to reach: *"a purely static
|
|
11
|
+
* code-graph tool is capped at R3 permanently. It has no runtime."*
|
|
12
|
+
*
|
|
13
|
+
* ## What this composes, and what it invents
|
|
14
|
+
*
|
|
15
|
+
* It invents no mechanism. Every stage already existed, gate-verified, in
|
|
16
|
+
* `descry-runtime`, and every one of them was dormant — the whole point of
|
|
17
|
+
* `DEC-NEXT-mcp-runtime-dependency-boundary-for-r4-evidence`, which measured
|
|
18
|
+
* that `applyRuntimeObservations` had **zero production callers anywhere**,
|
|
19
|
+
* not in `descry-desktop` and not in `descry-runtime`'s own pipeline. Four
|
|
20
|
+
* shipped components in a row, and this tool is the wire between them:
|
|
21
|
+
*
|
|
22
|
+
* 1. `runInstrumentedExecution` (`@descryy/runtime-orchestrator`) spawns or
|
|
23
|
+
* attaches the declared services, starts the adapter's collectors, drains
|
|
24
|
+
* them for a stated window, and writes every item through `EvidenceStore`.
|
|
25
|
+
* 2. `correlateExecution` (`@descryy/runtime-evidence-correlation`) resolves
|
|
26
|
+
* each evidence item to the graph node it is *about* — the resolve-then-
|
|
27
|
+
* attribute pass. This answers identity, not edges.
|
|
28
|
+
* 3. `confirmObservedFrontendCaller` (`@descryy/runtime-graph-correlator`)
|
|
29
|
+
* turns a captured call-site stack plus a resolved endpoint into a
|
|
30
|
+
* `RuntimeEdgeObservation`, and
|
|
31
|
+
* 4. calls `applyRuntimeObservations` (`@descryy/core`) with it, which
|
|
32
|
+
* promotes, mints or contradicts the edge and writes the EARNED ledger.
|
|
33
|
+
*
|
|
34
|
+
* ## Why stage 3 exists rather than deriving edges from stage 2 directly
|
|
35
|
+
*
|
|
36
|
+
* `uat-phase-1-bug-fixes.md` Phase 2 describes step 2 as producing
|
|
37
|
+
* `RuntimeEdgeObservation[]`. It does not, and the difference is load-bearing
|
|
38
|
+
* rather than pedantic: `correlateExecution` returns
|
|
39
|
+
* `CorrelationAttribution`s — *(evidenceId, graphNodeId)* pairs saying which
|
|
40
|
+
* single node an observation is about. An edge needs **two** endpoints and a
|
|
41
|
+
* witnessed relationship between them, and manufacturing one by pairing up
|
|
42
|
+
* attributions that happen to co-occur in the same run would mint edges from
|
|
43
|
+
* temporal coincidence. That is precisely the wrong-direction failure rule 2
|
|
44
|
+
* exists to prevent, arriving through the one mechanism built to make the
|
|
45
|
+
* graph *more* trustworthy.
|
|
46
|
+
*
|
|
47
|
+
* So the observation comes from the one shipped producer that can honestly
|
|
48
|
+
* make one: a captured stack naming the caller, against an endpoint the same
|
|
49
|
+
* observation named. Both endpoints come from the observation itself. Every
|
|
50
|
+
* other correlated item is reported in the counts and produces no edge, which
|
|
51
|
+
* is a disclosed gap rather than a silent one.
|
|
52
|
+
*
|
|
53
|
+
* ## What this closure can actually witness today — measured, not assumed
|
|
54
|
+
*
|
|
55
|
+
* The wire is complete, and what it can carry changed when the runtime packages
|
|
56
|
+
* were published at 0.1.0 and pinned here — so this paragraph is the record of
|
|
57
|
+
* a limit that was real and is now lifted, kept rather than deleted because the
|
|
58
|
+
* shape of it recurs.
|
|
59
|
+
*
|
|
60
|
+
* **It used to be that no producer of the required pair — HTTP evidence
|
|
61
|
+
* carrying a call-site stack — was in this server's closure.** The browser
|
|
62
|
+
* network collector never has been. The outbound-fetch instrumentation in
|
|
63
|
+
* `@descryy/runtime-external-service-observation` existed, was proven in
|
|
64
|
+
* `descry-runtime`, and was not installed here at all. So a run resolved both
|
|
65
|
+
* kinds of node and wrote no edge, and `STANDING_NOTES` said so on every call
|
|
66
|
+
* because "no edge was written" and "nothing here could have written one" are
|
|
67
|
+
* different statements.
|
|
68
|
+
*
|
|
69
|
+
* **That second producer is now in the closure**, transitively through
|
|
70
|
+
* `@descryy/runtime-orchestrator`, which applies the adapter's
|
|
71
|
+
* `outboundHttpLaunch()` between the interpreter and the script so the client
|
|
72
|
+
* is patched before any application code can capture an unpatched one. Measured
|
|
73
|
+
* end to end in `observe-runtime-outbound.conformance.test.ts`: two real
|
|
74
|
+
* processes, 17 `EXTERNAL_REQUEST` items alongside 18 `BACKEND_LOG`, one
|
|
75
|
+
* `USES_API` edge minted at R4, and the first `strongly supported` reply this
|
|
76
|
+
* server has produced.
|
|
77
|
+
*
|
|
78
|
+
* **Two limits remain, and they are stated rather than inferred from a zero.**
|
|
79
|
+
* An *attached* service is not launched by Descry, so the instrumentation
|
|
80
|
+
* cannot be installed into it and its outbound calls carry no stack. And
|
|
81
|
+
* browser-side traffic still needs `@descryy/runtime-browser`, which is not
|
|
82
|
+
* here. Both are in `STANDING_NOTES`.
|
|
83
|
+
*
|
|
84
|
+
* The rule that outlives all of it: a disclosure about the closure is a fact
|
|
85
|
+
* about *this build*, not about what `descry-runtime` can do. The two came
|
|
86
|
+
* apart once already, when the cross-boundary lane landed and this file still
|
|
87
|
+
* claimed the capability was absent. Re-check it against the installed tree
|
|
88
|
+
* when the pins move, not against the source repository.
|
|
89
|
+
* Descry.
|
|
90
|
+
*
|
|
91
|
+
* ## Why no denial is ever emitted
|
|
92
|
+
*
|
|
93
|
+
* `applyRuntimeObservations` accepts `held: false`. Nothing here ever sends
|
|
94
|
+
* one, and `confirmObservedFrontendCaller`'s own header explains why: a run
|
|
95
|
+
* establishes that a call *happened*; it cannot establish that one did not,
|
|
96
|
+
* because a run exercises the paths it happens to take. Demoting a correct
|
|
97
|
+
* edge on the strength of a route this run did not visit would be worse than
|
|
98
|
+
* never running.
|
|
99
|
+
*
|
|
100
|
+
* ## Class and tier
|
|
101
|
+
*
|
|
102
|
+
* `action` — DEC-278's own test is *"can this call's effect change a later
|
|
103
|
+
* finding without the developer having said so"*, and this one spawns
|
|
104
|
+
* processes and writes R4 edges that cap every later reliability class
|
|
105
|
+
* differently. It is gated by the same two-call `confirmToken` handshake
|
|
106
|
+
* `questions` uses, and additionally by the environment profile's declared
|
|
107
|
+
* `safetyLevel` (DEC-270): booting a service is a **write** against the
|
|
108
|
+
* target, so a `readOnly` profile refuses. An all-attach run is genuinely
|
|
109
|
+
* read-only — `ServiceConfiguration.attach`'s own contract is that Descry
|
|
110
|
+
* never executes code in, or applies limits to, a process it did not spawn —
|
|
111
|
+
* so it is allowed under `readOnly`, and that distinction is stated in the
|
|
112
|
+
* disclosures rather than inferred silently.
|
|
113
|
+
*
|
|
114
|
+
* `evidence` — it reports what was witnessed and what was written. It draws no
|
|
115
|
+
* conclusion about the user's code; nothing here reads or writes a finding, a
|
|
116
|
+
* hypothesis or a category (RT-027).
|
|
117
|
+
*
|
|
118
|
+
* ## No new query tools
|
|
119
|
+
*
|
|
120
|
+
* None are needed and none are added. `impact`, `propagation` and the rest
|
|
121
|
+
* already read the `resolution` field, so an edge this tool promotes to R4
|
|
122
|
+
* becomes visible through every one of them on the next call, with no change
|
|
123
|
+
* to any of them.
|
|
124
|
+
*/
|
|
125
|
+
import type { SignalTypeCount } from "@descryy/ir";
|
|
126
|
+
import type { Evidence, ServiceConfiguration } from "@descryy/runtime-contracts";
|
|
127
|
+
import type { RunOptions } from "@descryy/runtime-controller";
|
|
128
|
+
import type { EnvironmentProfile } from "@descryy/runtime-environment-profile";
|
|
129
|
+
import { type ToolDefinition } from "./kit.ts";
|
|
130
|
+
import { type RuntimeAdapterSpec } from "../runtime-registry.ts";
|
|
131
|
+
/**
|
|
132
|
+
* One service's readiness declaration, derived from `RunOptions` rather than
|
|
133
|
+
* imported by name.
|
|
134
|
+
*
|
|
135
|
+
* `@descryy/runtime-controller` declares `ServiceReadinessSpec` and does not
|
|
136
|
+
* export it from its index — a real gap in that package, but fixing it there
|
|
137
|
+
* would mean a republish and a version bump across everything that pins the
|
|
138
|
+
* controller, to obtain a type this file can derive exactly. Deriving is also
|
|
139
|
+
* the more durable of the two: this cannot drift from what `run()` actually
|
|
140
|
+
* accepts, because it *is* what `run()` accepts.
|
|
141
|
+
*/
|
|
142
|
+
type ServiceReadinessSpec = RunOptions["readiness"][string];
|
|
143
|
+
/** Where evidence lands when the call does not say. Beside the graph, not inside it. */
|
|
144
|
+
export declare const DEFAULT_EVIDENCE_RELATIVE_PATH: string;
|
|
145
|
+
/**
|
|
146
|
+
* What one declared service did, reported from the one source that survives the
|
|
147
|
+
* call: `Execution.processes`.
|
|
148
|
+
*
|
|
149
|
+
* **Deliberately not the controller's `ServiceStartResult`**, which carries a
|
|
150
|
+
* per-service `stage`/`readiness.reason` and would be the better answer.
|
|
151
|
+
* `runInstrumentedExecution` does not return it — `serviceStartResults` is a
|
|
152
|
+
* property of `ExecutionController`, which that function creates, uses and
|
|
153
|
+
* drops, so it is genuinely unavailable to a caller rather than merely
|
|
154
|
+
* unplumbed here. What is knowable is reported and nothing is invented to fill
|
|
155
|
+
* the gap: a service with no `ProcessHandle` did not start, and the
|
|
156
|
+
* execution-level `executionState` (`FAILED_START` in particular) is what says
|
|
157
|
+
* a readiness check is why.
|
|
158
|
+
*
|
|
159
|
+
* A `null` `exitCode` with a `null` `signal` on a process that has not exited
|
|
160
|
+
* is the healthy case, not a missing value — POSIX only sets an exit code on a
|
|
161
|
+
* normal `exit()`, so `signal` is what distinguishes a crash from a clean exit.
|
|
162
|
+
*/
|
|
163
|
+
export interface ObservedService {
|
|
164
|
+
readonly service: string;
|
|
165
|
+
/** False when no process handle exists for it at all — it never started. */
|
|
166
|
+
readonly started: boolean;
|
|
167
|
+
/** True when this service was attached to rather than spawned. Governs the safety gate — see the header. */
|
|
168
|
+
readonly attached: boolean;
|
|
169
|
+
/** The port it actually bound, when it listens on one. Null for a non-network process or before the port is known. */
|
|
170
|
+
readonly port: number | null;
|
|
171
|
+
/** Null while still running. Set once it exited and was reaped. */
|
|
172
|
+
readonly exitedAt: string | null;
|
|
173
|
+
readonly exitCode: number | null;
|
|
174
|
+
/** Non-null means killed by this signal, whatever `exitCode` says. */
|
|
175
|
+
readonly signal: string | null;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* What the correlation pass resolved, by family. Counts rather than rows: a
|
|
179
|
+
* long run produces thousands of evidence items and this reply is read by an
|
|
180
|
+
* agent, not archived. The rows themselves are in the evidence store, keyed by
|
|
181
|
+
* `executionId`, which is returned so they can be found.
|
|
182
|
+
*/
|
|
183
|
+
export interface CorrelationSummary {
|
|
184
|
+
readonly considered: number;
|
|
185
|
+
readonly skipped: number;
|
|
186
|
+
readonly attributed: number;
|
|
187
|
+
readonly refused: number;
|
|
188
|
+
/** Service names carrying symbol evidence no scope named a repository for. Named, never guessed at. */
|
|
189
|
+
readonly unscopedServices: readonly string[];
|
|
190
|
+
/** Non-empty means the correlation machinery itself broke, not that it looked and found nothing. */
|
|
191
|
+
readonly harnessErrors: readonly string[];
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* The R4 write, reported in `applyRuntimeObservations`'s own six-way
|
|
195
|
+
* vocabulary so a reader can account for every observation without inspecting
|
|
196
|
+
* the store.
|
|
197
|
+
*/
|
|
198
|
+
export interface RuntimeWriteSummary {
|
|
199
|
+
/** Edges the graph already held below R4, now witnessed and raised to R4. */
|
|
200
|
+
readonly promoted: readonly string[];
|
|
201
|
+
/** Edges no static producer found, minted at R4 — §11B.3's "recall gap closed". */
|
|
202
|
+
readonly created: readonly string[];
|
|
203
|
+
/** Already at R4 and observed again. Reported, never silently dropped. */
|
|
204
|
+
readonly confirmed: readonly string[];
|
|
205
|
+
/** Observations the graph declined to act on, with the resolver's own reason. */
|
|
206
|
+
readonly refused: readonly string[];
|
|
207
|
+
/**
|
|
208
|
+
* Always empty today, and present so that stays visible rather than
|
|
209
|
+
* unstated. This tool emits no denial — see the header.
|
|
210
|
+
*/
|
|
211
|
+
readonly contradictions: readonly string[];
|
|
212
|
+
/** A denial aimed at an edge already at R4. Out of scope by construction; reported, not laundered. */
|
|
213
|
+
readonly staleR4: readonly string[];
|
|
214
|
+
}
|
|
215
|
+
export interface ObserveRuntimeData {
|
|
216
|
+
/** Null when the run never started — see `services` and the disclosures for why. */
|
|
217
|
+
readonly executionId: string | null;
|
|
218
|
+
/** The controller's own terminal state for this execution. */
|
|
219
|
+
readonly executionState: string | null;
|
|
220
|
+
/** `RuntimeAdapter.language`, passed through verbatim. Nothing here branches on it (rule 1). */
|
|
221
|
+
readonly adapterLanguage: string | null;
|
|
222
|
+
readonly evidencePath: string;
|
|
223
|
+
readonly services: readonly ObservedService[];
|
|
224
|
+
/** Every evidence item this run wrote, by `eventType`. */
|
|
225
|
+
readonly evidenceByType: Readonly<Record<string, number>>;
|
|
226
|
+
readonly correlation: CorrelationSummary | null;
|
|
227
|
+
readonly wrote: RuntimeWriteSummary;
|
|
228
|
+
}
|
|
229
|
+
/** One service's declaration, resolved against the repository root. */
|
|
230
|
+
interface DeclaredService {
|
|
231
|
+
readonly name: string;
|
|
232
|
+
readonly configuration: ServiceConfiguration;
|
|
233
|
+
readonly readiness: ServiceReadinessSpec;
|
|
234
|
+
readonly attached: boolean;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Every argument this tool takes, read and validated in one place.
|
|
238
|
+
*
|
|
239
|
+
* Extracted from `run` so that `describeAction` can call it too. That is the
|
|
240
|
+
* whole point of the extraction: an `action` tool's first call is the one a
|
|
241
|
+
* caller makes *before* it has a token, and therefore the only cheap place to
|
|
242
|
+
* learn its arguments are wrong. Minting a token, and a paragraph describing
|
|
243
|
+
* an action, for a declaration that cannot possibly run asks a developer to
|
|
244
|
+
* confirm something that was never going to happen — and delivers the real
|
|
245
|
+
* refusal on the second call, after the confirmation.
|
|
246
|
+
*
|
|
247
|
+
* Nothing here touches the filesystem, spawns anything or reads the graph: it
|
|
248
|
+
* is argument reading and nothing else, which is what makes it safe to run at
|
|
249
|
+
* mint time, outside the call budget.
|
|
250
|
+
*
|
|
251
|
+
* Ruled in `documents/decisions-inbox/DEC-387.md`.
|
|
252
|
+
*
|
|
253
|
+
* Exported for its own test: several of the argument rules are conditional and
|
|
254
|
+
* cheaper to assert directly than through a full run.
|
|
255
|
+
*/
|
|
256
|
+
export declare function readArguments(args: Record<string, unknown>, repoPath: string): {
|
|
257
|
+
readonly profile: EnvironmentProfile;
|
|
258
|
+
readonly adapterSpec: RuntimeAdapterSpec;
|
|
259
|
+
readonly declared: readonly DeclaredService[];
|
|
260
|
+
readonly observeForMs: number;
|
|
261
|
+
readonly timeoutMs: number;
|
|
262
|
+
readonly fidelityRaw: number;
|
|
263
|
+
readonly environmentTier: string;
|
|
264
|
+
readonly evidencePath: string;
|
|
265
|
+
};
|
|
266
|
+
/**
|
|
267
|
+
* The two fields the channel mapping actually reads.
|
|
268
|
+
*
|
|
269
|
+
* Narrower than `Evidence` on purpose: `observe_tests` counts its channels
|
|
270
|
+
* before its evidence has been through `EvidenceStore.write()`, so its items
|
|
271
|
+
* have no `evidenceId` or `executionId` yet. Widening the parameter is how
|
|
272
|
+
* both tools share one implementation of the count; the alternative was a cast
|
|
273
|
+
* at one call site, which buys nothing and hides that the extra fields were
|
|
274
|
+
* never used.
|
|
275
|
+
*/
|
|
276
|
+
type WitnessableEvidence = Pick<Evidence, "eventType" | "source">;
|
|
277
|
+
/**
|
|
278
|
+
* `E` for this run — how many of the six channels it actually saw.
|
|
279
|
+
*
|
|
280
|
+
* The count itself is `@descryy/ir`'s `independentSignalTypes`, deliberately:
|
|
281
|
+
* the clamp to six and the drop of `null` signals are that function's rules,
|
|
282
|
+
* and a second implementation of them here is a second place for the
|
|
283
|
+
* vocabulary to drift. This function's only job is the translation above.
|
|
284
|
+
*
|
|
285
|
+
* Exported for its own test — the mapping decides whether a witnessed answer
|
|
286
|
+
* reads `strongly supported` or `unconfirmed`, which is too load-bearing to be
|
|
287
|
+
* asserted only through a category two layers downstream.
|
|
288
|
+
*/
|
|
289
|
+
export declare function witnessedSignalTypes(evidence: readonly WitnessableEvidence[]): SignalTypeCount;
|
|
290
|
+
export declare const observeRuntimeTool: ToolDefinition;
|
|
291
|
+
export {};
|
|
292
|
+
//# sourceMappingURL=observe-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observe-runtime.d.ts","sourceRoot":"","sources":["../../src/tools/observe-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2HG;AAKH,OAAO,KAAK,EAAsC,eAAe,EAAE,MAAM,aAAa,CAAC;AASvF,OAAO,KAAK,EACV,QAAQ,EAGR,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,KAAK,EAAE,kBAAkB,EAAkB,MAAM,sCAAsC,CAAC;AAO/F,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,UAAU,CAAC;AAElB,OAAO,EAA+C,KAAK,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAI9G;;;;;;;;;;GAUG;AACH,KAAK,oBAAoB,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5D,wFAAwF;AACx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