carrick 0.3.157 → 0.3.158

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.
Files changed (142) hide show
  1. package/dist/cli.d.ts +7 -0
  2. package/dist/cli.js +4 -0
  3. package/dist/cli.js.map +1 -1
  4. package/dist/contract.d.ts +8 -1
  5. package/dist/contract.js.map +1 -1
  6. package/dist/engine-ask.d.ts +21 -0
  7. package/dist/engine-ask.js +50 -0
  8. package/dist/engine-ask.js.map +1 -0
  9. package/dist/facts/diff.d.ts +14 -1
  10. package/dist/facts/diff.js +21 -8
  11. package/dist/facts/diff.js.map +1 -1
  12. package/dist/facts/fetch.d.ts +7 -0
  13. package/dist/facts/fetch.js +22 -1
  14. package/dist/facts/fetch.js.map +1 -1
  15. package/dist/facts/lines.d.ts +22 -4
  16. package/dist/facts/lines.js +31 -9
  17. package/dist/facts/lines.js.map +1 -1
  18. package/dist/facts/peers.d.ts +13 -4
  19. package/dist/facts/peers.js +17 -15
  20. package/dist/facts/peers.js.map +1 -1
  21. package/dist/facts/rules/packages.js +3 -1
  22. package/dist/facts/rules/packages.js.map +1 -1
  23. package/dist/facts/rules/same-name.js +1 -1
  24. package/dist/facts/rules/same-name.js.map +1 -1
  25. package/dist/facts/store.d.ts +15 -0
  26. package/dist/facts/store.js +30 -0
  27. package/dist/facts/store.js.map +1 -1
  28. package/dist/held/backoff.d.ts +8 -0
  29. package/dist/held/backoff.js +43 -0
  30. package/dist/held/backoff.js.map +1 -0
  31. package/dist/held/build.d.ts +17 -0
  32. package/dist/held/build.js +62 -0
  33. package/dist/held/build.js.map +1 -0
  34. package/dist/held/client.d.ts +12 -3
  35. package/dist/held/client.js +123 -8
  36. package/dist/held/client.js.map +1 -1
  37. package/dist/held/daemon.d.ts +47 -2
  38. package/dist/held/daemon.js +115 -23
  39. package/dist/held/daemon.js.map +1 -1
  40. package/dist/held/early.d.ts +28 -0
  41. package/dist/held/early.js +115 -0
  42. package/dist/held/early.js.map +1 -0
  43. package/dist/held/paths.d.ts +6 -0
  44. package/dist/held/paths.js +17 -0
  45. package/dist/held/paths.js.map +1 -1
  46. package/dist/held/place.d.ts +76 -30
  47. package/dist/held/place.js +121 -83
  48. package/dist/held/place.js.map +1 -1
  49. package/dist/held/run.js +24 -6
  50. package/dist/held/run.js.map +1 -1
  51. package/dist/held/runtime.d.ts +22 -0
  52. package/dist/held/runtime.js +612 -0
  53. package/dist/held/runtime.js.map +1 -0
  54. package/dist/held/shadow.d.ts +33 -0
  55. package/dist/held/shadow.js +68 -0
  56. package/dist/held/shadow.js.map +1 -0
  57. package/dist/held/steps.d.ts +11 -0
  58. package/dist/held/steps.js +29 -0
  59. package/dist/held/steps.js.map +1 -0
  60. package/dist/hook/confirm.d.ts +79 -0
  61. package/dist/hook/confirm.js +220 -0
  62. package/dist/hook/confirm.js.map +1 -0
  63. package/dist/hook/edit-flow.d.ts +14 -3
  64. package/dist/hook/edit-flow.js +113 -33
  65. package/dist/hook/edit-flow.js.map +1 -1
  66. package/dist/hook/generation.d.ts +19 -0
  67. package/dist/hook/generation.js +75 -0
  68. package/dist/hook/generation.js.map +1 -0
  69. package/dist/hook/late.d.ts +50 -9
  70. package/dist/hook/late.js +104 -24
  71. package/dist/hook/late.js.map +1 -1
  72. package/dist/hook/post-bash.js +3 -3
  73. package/dist/hook/post-bash.js.map +1 -1
  74. package/dist/hook/post-edit.js +2 -2
  75. package/dist/hook/post-edit.js.map +1 -1
  76. package/dist/hook/post-read.js +25 -3
  77. package/dist/hook/post-read.js.map +1 -1
  78. package/dist/hook/post-search.js +1 -1
  79. package/dist/hook/post-search.js.map +1 -1
  80. package/dist/hook/probe.js +1 -0
  81. package/dist/hook/probe.js.map +1 -1
  82. package/dist/hook/read-answer.d.ts +5 -0
  83. package/dist/hook/read-answer.js +8 -4
  84. package/dist/hook/read-answer.js.map +1 -1
  85. package/dist/hook/rechecks.d.ts +58 -2
  86. package/dist/hook/rechecks.js +132 -9
  87. package/dist/hook/rechecks.js.map +1 -1
  88. package/dist/hook/session-start.d.ts +1 -1
  89. package/dist/hook/session-start.js +19 -5
  90. package/dist/hook/session-start.js.map +1 -1
  91. package/dist/hook/similar.d.ts +1 -1
  92. package/dist/hook/similar.js +21 -8
  93. package/dist/hook/similar.js.map +1 -1
  94. package/dist/hook/stop-wait.js +35 -16
  95. package/dist/hook/stop-wait.js.map +1 -1
  96. package/dist/hook/timings.d.ts +29 -1
  97. package/dist/hook/timings.js +7 -1
  98. package/dist/hook/timings.js.map +1 -1
  99. package/dist/hook/user-prompt.js +2 -2
  100. package/dist/hook/user-prompt.js.map +1 -1
  101. package/dist/hosted-snapshot.d.ts +27 -0
  102. package/dist/hosted-snapshot.js +32 -0
  103. package/dist/hosted-snapshot.js.map +1 -1
  104. package/dist/init/hosted.js +2 -9
  105. package/dist/init/hosted.js.map +1 -1
  106. package/dist/render.d.ts +15 -1
  107. package/dist/render.js +50 -4
  108. package/dist/render.js.map +1 -1
  109. package/dist/server.js +1 -1
  110. package/dist/server.js.map +1 -1
  111. package/package.json +6 -6
  112. package/plugin/.claude-plugin/plugin.json +1 -1
  113. package/sidecar/dist/src/capture/anchors.d.ts +8 -0
  114. package/sidecar/dist/src/capture/anchors.js +3 -2
  115. package/sidecar/dist/src/capture/api.d.ts +70 -3
  116. package/sidecar/dist/src/capture/check-classify.d.ts +7 -0
  117. package/sidecar/dist/src/capture/check-classify.js +24 -0
  118. package/sidecar/dist/src/capture/check-probe.d.ts +76 -7
  119. package/sidecar/dist/src/capture/check-probe.js +147 -19
  120. package/sidecar/dist/src/capture/check.js +13 -1
  121. package/sidecar/dist/src/capture/graphql-leaves.d.ts +46 -0
  122. package/sidecar/dist/src/capture/graphql-leaves.js +142 -0
  123. package/sidecar/dist/src/capture/index.d.ts +4 -1
  124. package/sidecar/dist/src/capture/index.js +3 -1
  125. package/sidecar/dist/src/definition-resolver.d.ts +2 -1
  126. package/sidecar/dist/src/definition-resolver.js +15 -9
  127. package/sidecar/dist/src/engine-stamp.json +1 -1
  128. package/sidecar/dist/src/held-shadow.d.ts +12 -2
  129. package/sidecar/dist/src/held-shadow.js +9 -9
  130. package/sidecar/dist/src/index.js +18 -1
  131. package/sidecar/dist/src/library-claims.js +26 -3
  132. package/sidecar/dist/src/retype.d.ts +47 -0
  133. package/sidecar/dist/src/retype.js +274 -18
  134. package/sidecar/dist/src/site-find.d.ts +27 -0
  135. package/sidecar/dist/src/site-find.js +109 -0
  136. package/sidecar/dist/src/type-inferrer.d.ts +5 -0
  137. package/sidecar/dist/src/type-inferrer.js +8 -4
  138. package/sidecar/dist/src/type-structural-expander.d.ts +10 -0
  139. package/sidecar/dist/src/type-structural-expander.js +73 -4
  140. package/sidecar/dist/src/types.d.ts +50 -2
  141. package/sidecar/dist/src/validators.d.ts +328 -8
  142. package/sidecar/dist/src/validators.js +29 -0
@@ -1,28 +1,56 @@
1
- import ts from "typescript";
2
- import type { ContractGroup, ContractRow } from "../facts/store.ts";
3
- /** What the placer reads of a contract row (a subset of the fact store's row). */
4
- export type PlaceRow = Pick<ContractRow, "label" | "locator"> & {
5
- id: number;
6
- site: string | null;
7
- line: number | null;
8
- groups: Array<Pick<ContractGroup, "type">>;
1
+ /** One value's position: `[start, end)` in UTF-16 code units, never counting a leading BOM. */
2
+ export type Value = {
3
+ file: string;
4
+ start: number;
5
+ end: number;
6
+ };
7
+ /** Why a value has no check. */
8
+ export type ValueReason = "value_not_a_node" | "not_wrappable" | "value_edited";
9
+ export type UnplacedReason = ValueReason | "javascript_file";
10
+ /** One changed stretch of text: the old and the new bounds (BOM not counted). */
11
+ export type Region = {
12
+ oldStart: number;
13
+ oldEnd: number;
14
+ newStart: number;
15
+ newEnd: number;
16
+ };
17
+ /** What the compiler engine is asked: the node the old span named, in the new text. */
18
+ export type SiteQuery = {
19
+ file: string;
20
+ oldText: string;
21
+ newText: string;
22
+ start: number;
23
+ end: number;
9
24
  };
25
+ export type SiteAnswer = {
26
+ start: number;
27
+ end: number;
28
+ } | {
29
+ reason: ValueReason;
30
+ };
31
+ /** The compiler engine's site finder (the engine action beside `site-node.ts`); a fake in tests. */
32
+ export type SiteFinder = (query: SiteQuery) => Promise<SiteAnswer>;
10
33
  /** A compiler diagnostic: its start offset in the checked text, its code, its message. */
11
34
  export type Diag = {
12
35
  start: number;
13
36
  code: number;
14
37
  message: string;
15
38
  };
16
- export type UnplacedReason = "not_registration" | "dispatch_case" | "javascript_file" | "no_site_found" | "site_not_unique";
17
- export type UnarmedReason = "twin_passes" | "decl_error" | "no_hono" | `clean_check_fails:TS${number}`;
18
- /** `no_hono` is a row's own reason too (the clean check names a non-route object). */
19
- export type RowReason = UnplacedReason | UnarmedReason;
39
+ export type UnarmedReason = "twin_passes" | "decl_error" | `clean_check_fails:TS${number}`;
40
+ /** One (row, position) pair, numbered across the overlay, with one stated type per group. */
41
+ export type CheckInput = {
42
+ n: number;
43
+ value: Value;
44
+ groups: Array<{
45
+ type: string;
46
+ }>;
47
+ };
20
48
  export type Check = {
21
- id: number;
49
+ n: number;
22
50
  group: number;
23
- /** `<id>_<group>`; the check's alias is `O<k>`. */
51
+ /** `<n>_<group>`; the check's alias is `O<k>`. */
24
52
  k: string;
25
- /** The whole check expression: `__C.reg<k>(` through `, (o) => o)`. */
53
+ /** The whole check expression: `__C.send<k>(` through `, (o) => o)`. */
26
54
  span: [number, number];
27
55
  /** The check's two declaration lines in the appended namespace. */
28
56
  declSpan: [number, number];
@@ -31,32 +59,50 @@ export type Overlay = {
31
59
  text: string;
32
60
  checks: Check[];
33
61
  unplaced: Array<{
34
- id: number;
62
+ n: number;
35
63
  reason: UnplacedReason;
36
64
  }>;
37
65
  /** Offset where the appended namespace starts. */
38
66
  bodyEnd: number;
39
67
  };
68
+ /** One region, from the common prefix and suffix of the two texts. */
69
+ export declare function regionOfEdit(oldText: string, newText: string): Region;
40
70
  /**
41
- * D7. The call that starts on the row's line, whose callee is the label's
42
- * method and whose first argument is the row's site literal. With none on that
43
- * line, the unique such call in the file. Two or more is never a guess.
71
+ * `git diff -U0` line hunks turned into character regions, each narrowed by
72
+ * common prefix and suffix inside its hunk (a hunk replaces whole lines; the
73
+ * change is usually a few characters of them).
44
74
  */
45
- export declare function findSite(sf: ts.SourceFile, row: Pick<PlaceRow, "label" | "site" | "line">): {
46
- node: ts.CallExpression;
47
- } | {
48
- reason: UnplacedReason;
49
- };
75
+ export declare function regionsFromHunks(oldText: string, newText: string, diffU0: string): Region[];
76
+ /**
77
+ * The text a check appends: the engine's wire declarations and its tolerance
78
+ * helpers (K-a: a receiver declared void states no contract; an absent body
79
+ * the receiver admits is dropped), composed into the one type a check's
80
+ * callback receives. Nothing here restates a rule: it only names the order
81
+ * the judge applies them in. The literal-widened tolerance reads an export
82
+ * of a scan's stub, so it cannot apply here.
83
+ */
84
+ export declare function checkWire(wire: string[], tolerances: string[]): string[];
85
+ /**
86
+ * V5, the two arithmetic cases. A region meets the value when it touches
87
+ * `[start, end]`. None does: the value shifts by the regions before it. Every
88
+ * one that does lies strictly inside: the value keeps its bounds and grows or
89
+ * shrinks with them. Any other edit (one across a bound) is the engine's to
90
+ * place again: `"needs_site"`.
91
+ */
92
+ export declare function mapValue(value: Value, regions: Region[]): Value | "needs_site";
93
+ /** `mapValue`, and for an edit across a bound the compiler engine's site finder on both texts. */
94
+ export declare function resolveValue(value: Value, regions: Region[], oldText: string, newText: string, find: SiteFinder): Promise<Value | ValueReason>;
50
95
  /**
51
- * The file with every placeable row's registration wrapped. `clean` states the
52
- * row's type; `twin` states it intersected with a property no reply has, so it
53
- * must fail where the check can see the reply at all.
96
+ * The file with every placeable value wrapped. `wire` is `checkWire`'s text (it holds
97
+ * `__carrick_Sent<S, E>`). `clean` states each
98
+ * group's type; `twin` states it intersected with a property no value has, so
99
+ * it must fail where the check can see the value at all.
54
100
  */
55
- export declare function overlay(file: string, text: string, rows: PlaceRow[], mode: "clean" | "twin"): Overlay;
101
+ export declare function overlay(file: string, text: string, checks: CheckInput[], wire: string[], mode: "clean" | "twin"): Overlay;
56
102
  /**
57
103
  * R3. A diagnostic is a check's own line only when its start lies in the
58
104
  * check's whole expression AND its message names the check's alias. Several
59
- * checks can share an expression (two groups of one row, a chain): the
105
+ * checks can share an expression (two groups of one value, a nest): the
60
106
  * narrowest that the message names wins. A diagnostic in a check's declaration
61
107
  * lines is that check's `decl_error`. Everything else is `outside`, and never
62
108
  * a line.
@@ -77,7 +123,7 @@ export declare function arm(ov: Overlay, clean: Diag[], twin: Diag[]): {
77
123
  armed: string[];
78
124
  unarmed: Array<{
79
125
  k: string;
80
- id: number;
126
+ n: number;
81
127
  group: number;
82
128
  reason: UnarmedReason;
83
129
  }>;
@@ -1,106 +1,144 @@
1
- // Part 3, T4: place, arm and attribute. Pure functions, no engine and no disk.
1
+ // Part 3, L1: place, map, arm and attribute. Pure functions, no engine and no disk.
2
2
  //
3
- // A producer response row says "this route's 2xx reply has type T". To ask the
4
- // compiler whether an edit breaks that, the registration call is wrapped in a
5
- // check, `__C.reg<k>(<call>, (o) => o)`, where `o` is the route framework's own
6
- // record of the handler's reply and the callback must return `O<k>`, the row's
7
- // stated type. The check text is appended to the file's end (`declare
8
- // namespace __C`), so no line moves.
3
+ // A producer response row stores where each reply is sent from (the value
4
+ // positions of its entry). To ask the compiler whether an edit breaks that, the
5
+ // value is wrapped in place, `__C.send<n>_<g>(<value>, (o) => o)`: the call
6
+ // returns the value, so the code around it types as before, and `o` is the
7
+ // value on the wire (the judge's own wire rule, pasted from the compiler
8
+ // engine) which the callback must return as `O<n>_<g>`, the stated type. `o`
9
+ // is no fresh literal, so there is no excess-property check. The check text is
10
+ // appended to the file's end (`declare namespace __C`), so no line moves.
9
11
  //
10
- // Three decisions live here:
11
- // place (D7) which call is the row's site, on the CURRENT text
12
+ // Four decisions live here:
13
+ // map (V5) where a stored value is on the CURRENT text
14
+ // place the file with every value wrapped
12
15
  // arm (D6) which checks may speak: clean passes, its twin fails
13
16
  // attribute (R3) which diagnostics are a check's own, and so may be a line
17
+ //
18
+ // Finding a node again after an edit that crosses its bounds is the compiler
19
+ // engine's site finder, behind `SiteFinder`; nothing here parses a value.
14
20
  import ts from "typescript";
15
- const POST = ", (o) => o)";
16
- const OK = "200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226";
17
- const PREAMBLE = [
18
- ` type Ok = ${OK};`,
19
- " type Pick2xx<E> = E extends { status: infer St; output: infer O } ? ([Extract<St, Ok>] extends [never] ? never : O) : never;",
20
- ' type Out<R, P extends string, M extends string> = R extends import("hono").Hono<any, infer S extends import("hono").Schema, any>',
21
- " ? (P extends keyof S ? (`$${M}` extends keyof S[P] ? Pick2xx<S[P][`$${M}`]> : { readonly __carrick_no_method_in_route_schema: M })",
22
- " : { readonly __carrick_no_site_in_route_schema: P }) : { readonly __carrick_not_a_route_object: R };",
23
- ];
24
- const methodOf = (label) => label.split(" ")[0].toLowerCase();
25
- const scriptKind = (file) => (file.endsWith("x") ? ts.ScriptKind.TSX : ts.ScriptKind.TS);
26
- function memberCalls(sf) {
21
+ import { hunksOf } from "../facts/diff.js";
22
+ const BOM = 0xfeff;
23
+ const stripBom = (text) => (text.charCodeAt(0) === BOM ? text.slice(1) : text);
24
+ /** One region, from the common prefix and suffix of the two texts. */
25
+ export function regionOfEdit(oldText, newText) {
26
+ const a = stripBom(oldText);
27
+ const b = stripBom(newText);
28
+ const limit = Math.min(a.length, b.length);
29
+ let prefix = 0;
30
+ while (prefix < limit && a.charCodeAt(prefix) === b.charCodeAt(prefix))
31
+ prefix += 1;
32
+ let suffix = 0;
33
+ while (suffix < limit - prefix && a.charCodeAt(a.length - 1 - suffix) === b.charCodeAt(b.length - 1 - suffix))
34
+ suffix += 1;
35
+ return { oldStart: prefix, oldEnd: a.length - suffix, newStart: prefix, newEnd: b.length - suffix };
36
+ }
37
+ /** Where line `index` (0-based) starts; one past the last line is the text's end. TypeScript's own line map. */
38
+ function lineStarts(text) {
39
+ const sf = ts.createSourceFile("lines.ts", text, ts.ScriptTarget.Latest, false);
40
+ const last = sf.getLineAndCharacterOfPosition(text.length).line;
41
+ return (index) => (index > last ? text.length : sf.getPositionOfLineAndCharacter(index, 0));
42
+ }
43
+ /**
44
+ * `git diff -U0` line hunks turned into character regions, each narrowed by
45
+ * common prefix and suffix inside its hunk (a hunk replaces whole lines; the
46
+ * change is usually a few characters of them).
47
+ */
48
+ export function regionsFromHunks(oldText, newText, diffU0) {
49
+ const a = stripBom(oldText);
50
+ const b = stripBom(newText);
51
+ const oldAt = lineStarts(a);
52
+ const newAt = lineStarts(b);
27
53
  const out = [];
28
- const visit = (n) => {
29
- if (ts.isCallExpression(n) && ts.isPropertyAccessExpression(n.expression)) {
30
- const a0 = n.arguments[0];
31
- const literal = a0 && (ts.isStringLiteral(a0) || ts.isNoSubstitutionTemplateLiteral(a0)) ? a0.text : undefined;
32
- out.push({ node: n, name: n.expression.name.text, literal, line: sf.getLineAndCharacterOfPosition(n.getStart(sf)).line + 1 });
33
- }
34
- ts.forEachChild(n, visit);
35
- };
36
- visit(sf);
54
+ for (const { oldStart: oldAt1, oldCount, newStart: newAt1, newCount } of hunksOf(diffU0)) {
55
+ // With nothing on a side, its start is the line BEFORE the change point.
56
+ const oldFirst = oldAt1 - 1 + (oldCount === 0 ? 1 : 0);
57
+ const newFirst = newAt1 - 1 + (newCount === 0 ? 1 : 0);
58
+ const oldStart = oldAt(oldFirst);
59
+ const oldEnd = oldAt(oldFirst + oldCount);
60
+ const newStart = newAt(newFirst);
61
+ const newEnd = newAt(newFirst + newCount);
62
+ const inner = regionOfEdit(a.slice(oldStart, oldEnd), b.slice(newStart, newEnd));
63
+ out.push({ oldStart: oldStart + inner.oldStart, oldEnd: oldStart + inner.oldEnd, newStart: newStart + inner.newStart, newEnd: newStart + inner.newEnd });
64
+ }
37
65
  return out;
38
66
  }
39
67
  /**
40
- * D7. The call that starts on the row's line, whose callee is the label's
41
- * method and whose first argument is the row's site literal. With none on that
42
- * line, the unique such call in the file. Two or more is never a guess.
68
+ * The text a check appends: the engine's wire declarations and its tolerance
69
+ * helpers (K-a: a receiver declared void states no contract; an absent body
70
+ * the receiver admits is dropped), composed into the one type a check's
71
+ * callback receives. Nothing here restates a rule: it only names the order
72
+ * the judge applies them in. The literal-widened tolerance reads an export
73
+ * of a scan's stub, so it cannot apply here.
43
74
  */
44
- export function findSite(sf, row) {
45
- if (row.site === null)
46
- return { reason: "no_site_found" };
47
- const method = methodOf(row.label);
48
- const same = memberCalls(sf).filter((c) => c.name === method && c.literal === row.site);
49
- const onLine = same.filter((c) => c.line === row.line);
50
- if (onLine.length === 1)
51
- return { node: onLine[0].node };
52
- if (onLine.length > 1)
53
- return { reason: "site_not_unique" };
54
- if (same.length === 1)
55
- return { node: same[0].node };
56
- return { reason: same.length === 0 ? "no_site_found" : "site_not_unique" };
75
+ export function checkWire(wire, tolerances) {
76
+ return [
77
+ ...wire,
78
+ ...tolerances,
79
+ "type __carrick_Sent<S, E> = __carrick_IsVoid<E> extends true ? E : __carrick_Wire<__carrick_AbsentBody<S, E>, E>;",
80
+ ];
57
81
  }
82
+ const delta = (r) => r.newEnd - r.newStart - (r.oldEnd - r.oldStart);
58
83
  /**
59
- * The file with every placeable row's registration wrapped. `clean` states the
60
- * row's type; `twin` states it intersected with a property no reply has, so it
61
- * must fail where the check can see the reply at all.
84
+ * V5, the two arithmetic cases. A region meets the value when it touches
85
+ * `[start, end]`. None does: the value shifts by the regions before it. Every
86
+ * one that does lies strictly inside: the value keeps its bounds and grows or
87
+ * shrinks with them. Any other edit (one across a bound) is the engine's to
88
+ * place again: `"needs_site"`.
62
89
  */
63
- export function overlay(file, text, rows, mode) {
90
+ export function mapValue(value, regions) {
91
+ const meeting = regions.filter((r) => r.oldStart <= value.end && r.oldEnd >= value.start);
92
+ const before = regions.filter((r) => r.oldEnd < value.start).reduce((sum, r) => sum + delta(r), 0);
93
+ if (meeting.length === 0)
94
+ return { file: value.file, start: value.start + before, end: value.end + before };
95
+ if (meeting.some((r) => r.oldStart <= value.start || r.oldEnd >= value.end))
96
+ return "needs_site";
97
+ const within = meeting.reduce((sum, r) => sum + delta(r), 0);
98
+ return { file: value.file, start: value.start + before, end: value.end + before + within };
99
+ }
100
+ /** `mapValue`, and for an edit across a bound the compiler engine's site finder on both texts. */
101
+ export async function resolveValue(value, regions, oldText, newText, find) {
102
+ const mapped = mapValue(value, regions);
103
+ if (mapped !== "needs_site")
104
+ return mapped;
105
+ const answer = await find({ file: value.file, oldText, newText, start: value.start, end: value.end });
106
+ return "reason" in answer ? answer.reason : { file: value.file, start: answer.start, end: answer.end };
107
+ }
108
+ const POST = ", (o) => o)";
109
+ /**
110
+ * The file with every placeable value wrapped. `wire` is `checkWire`'s text (it holds
111
+ * `__carrick_Sent<S, E>`). `clean` states each
112
+ * group's type; `twin` states it intersected with a property no value has, so
113
+ * it must fail where the check can see the value at all.
114
+ */
115
+ export function overlay(file, text, checks, wire, mode) {
64
116
  const unplaced = [];
65
117
  const js = /\.(?:[mc]?js|jsx)$/.test(file);
66
- const sf = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, scriptKind(file));
118
+ const bom = text.charCodeAt(0) === BOM ? 1 : 0;
67
119
  const ops = [];
68
- const checks = [];
120
+ const made = [];
69
121
  const decls = [];
70
122
  let seq = 0;
71
- for (const row of rows) {
72
- if (row.locator !== "registration") {
73
- unplaced.push({ id: row.id, reason: "not_registration" });
74
- continue;
75
- }
76
- if (row.label.includes("{")) {
77
- unplaced.push({ id: row.id, reason: "dispatch_case" });
78
- continue;
79
- }
123
+ for (const input of checks) {
80
124
  if (js) {
81
- unplaced.push({ id: row.id, reason: "javascript_file" });
82
- continue;
83
- }
84
- const found = findSite(sf, row);
85
- if (!("node" in found)) {
86
- unplaced.push({ id: row.id, reason: found.reason });
125
+ unplaced.push({ n: input.n, reason: "javascript_file" });
87
126
  continue;
88
127
  }
89
- const start = found.node.getStart(sf);
90
- const end = found.node.end;
91
- const method = methodOf(row.label);
92
- row.groups.forEach((g, group) => {
93
- const k = `${row.id}_${group}`;
128
+ const start = input.value.start + bom;
129
+ const end = input.value.end + bom;
130
+ input.groups.forEach((g, group) => {
131
+ const k = `${input.n}_${group}`;
94
132
  const stated = mode === "twin" ? `(${g.type}) & { readonly __carrick_never: true }` : `(${g.type})`;
95
133
  decls.push(` type O${k} = ${stated};`);
96
- decls.push(` function reg${k}<R>(r: R, c: (o: Out<R, ${JSON.stringify(row.site)}, ${JSON.stringify(method)}>) => O${k}): R;`);
97
- ops.push({ at: start, s: `__C.reg${k}(`, side: "pre", seq, start, end });
134
+ decls.push(` function send${k}<V>(v: V, c: (o: __carrick_Sent<V, O${k}>) => O${k}): V;`);
135
+ ops.push({ at: start, s: `__C.send${k}(`, side: "pre", seq, start, end });
98
136
  ops.push({ at: end, s: POST, side: "post", seq, start, end });
99
137
  seq += 1;
100
- checks.push({ id: row.id, group, k, span: [0, 0], declSpan: [0, 0] });
138
+ made.push({ n: input.n, group, k, span: [0, 0], declSpan: [0, 0] });
101
139
  });
102
140
  }
103
- // Wraps at one offset must nest. Opening: the wider call first, later group outside.
141
+ // Wraps at one offset must nest. Opening: the wider value first, later group outside.
104
142
  // Closing: the mirror image. A close at an offset comes before an open there.
105
143
  ops.sort((a, b) => {
106
144
  if (a.at !== b.at)
@@ -122,20 +160,20 @@ export function overlay(file, text, rows, mode) {
122
160
  }
123
161
  out += text.slice(last);
124
162
  const bodyEnd = out.length;
125
- out += "\n" + ["declare namespace __C {", ...PREAMBLE, ...decls, "}"].join("\n") + "\n";
126
- checks.forEach((c, i) => {
163
+ out += "\n" + ["declare namespace __C {", ...wire.map((l) => ` ${l}`), ...decls, "}"].join("\n") + "\n";
164
+ made.forEach((c, i) => {
127
165
  c.span = [pos.get(`${i}:pre`), pos.get(`${i}:post`) + POST.length];
128
166
  const declAt = out.indexOf(` type O${c.k} = `, bodyEnd);
129
- c.declSpan = [declAt, out.indexOf("\n", out.indexOf(`function reg${c.k}<`, declAt))];
167
+ c.declSpan = [declAt, out.indexOf("\n", out.indexOf(`function send${c.k}<`, declAt))];
130
168
  });
131
- return { text: out, checks, unplaced, bodyEnd };
169
+ return { text: out, checks: made, unplaced, bodyEnd };
132
170
  }
133
171
  const inside = (p, s) => p >= s[0] && p <= s[1];
134
172
  const names = (message, k) => new RegExp(`\\bO${k}\\b`).test(message);
135
173
  /**
136
174
  * R3. A diagnostic is a check's own line only when its start lies in the
137
175
  * check's whole expression AND its message names the check's alias. Several
138
- * checks can share an expression (two groups of one row, a chain): the
176
+ * checks can share an expression (two groups of one value, a nest): the
139
177
  * narrowest that the message names wins. A diagnostic in a check's declaration
140
178
  * lines is that check's `decl_error`. Everything else is `outside`, and never
141
179
  * a line.
@@ -177,14 +215,14 @@ export function arm(ov, clean, twin) {
177
215
  const armed = [];
178
216
  const unarmed = [];
179
217
  for (const c of ov.checks) {
180
- const no = (reason) => { unarmed.push({ k: c.k, id: c.id, group: c.group, reason }); };
218
+ const no = (reason) => { unarmed.push({ k: c.k, n: c.n, group: c.group, reason }); };
181
219
  if (clean.some((d) => inside(d.start, c.declSpan))) {
182
220
  no("decl_error");
183
221
  continue;
184
222
  }
185
223
  const bad = speaks(c, clean);
186
224
  if (bad) {
187
- no(bad.message.includes("__carrick_not_a_route_object") ? "no_hono" : `clean_check_fails:TS${bad.code}`);
225
+ no(`clean_check_fails:TS${bad.code}`);
188
226
  continue;
189
227
  }
190
228
  if (!speaks(c, twin)) {
@@ -1 +1 @@
1
- {"version":3,"file":"place.js","sourceRoot":"","sources":["../../src/held/place.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,EAAE;AACF,+EAA+E;AAC/E,8EAA8E;AAC9E,gFAAgF;AAChF,+EAA+E;AAC/E,sEAAsE;AACtE,qCAAqC;AACrC,EAAE;AACF,6BAA6B;AAC7B,sEAAsE;AACtE,yEAAyE;AACzE,8EAA8E;AAE9E,OAAO,EAAE,MAAM,YAAY,CAAC;AA6C5B,MAAM,IAAI,GAAG,aAAa,CAAC;AAC3B,MAAM,EAAE,GAAG,2DAA2D,CAAC;AACvE,MAAM,QAAQ,GAAG;IACf,eA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E,GAAG,CAAC,MAAqB,EAAQ,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1G,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;YAAC,EAAE,CAAC,YAAY,CAAC,CAAC;YAAC,SAAS;QAAC,CAAC;QACnF,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QAC7B,IAAI,GAAG,EAAE,CAAC;YAAC,EAAE,CAAC,uBAAuB,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;YAAC,SAAS;QAAC,CAAC;QAC7D,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC;YAAC,EAAE,CAAC,aAAa,CAAC,CAAC;YAAC,SAAS;QAAC,CAAC;QACtD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC5B,CAAC"}
package/dist/held/run.js CHANGED
@@ -8,7 +8,10 @@ import { execFile } from "node:child_process";
8
8
  import { compilerLinesEnabled } from "../facts/enabled.js";
9
9
  import { binary } from "../cli.js";
10
10
  import { createLogger } from "../log.js";
11
+ import { recordCrash } from "./backoff.js";
12
+ import { heldBuildId } from "./build.js";
11
13
  import { serve } from "./daemon.js";
14
+ import { createRuntime } from "./runtime.js";
12
15
  const log = createLogger("carrick-held-run");
13
16
  const HELD_PROGRAMS_SCHEMA = "carrick.held-programs/0";
14
17
  /** Every indexed service's program init, as the scanner loads it (`carrick held-programs --json`). */
@@ -30,10 +33,14 @@ function readPrograms(root, env) {
30
33
  });
31
34
  });
32
35
  }
33
- /** Until the request path is wired in, no service has an engine. */
34
- const runtime = {
35
- start: async () => ({ state: "error", reason: "the engine for a service is not wired in yet" }),
36
- };
36
+ let rootForCrash = null;
37
+ let idForCrash = null;
38
+ /** A daemon that dies is recorded under its build, so a build that keeps dying is not started on every edit. */
39
+ function crashed(error) {
40
+ log("daemon failed", String(error));
41
+ if (rootForCrash !== null && idForCrash !== null)
42
+ recordCrash(rootForCrash, idForCrash);
43
+ }
37
44
  async function main() {
38
45
  const root = process.argv.slice(2)[0];
39
46
  if (!root) {
@@ -43,18 +50,29 @@ async function main() {
43
50
  const env = process.env;
44
51
  if (!compilerLinesEnabled(env))
45
52
  return;
46
- const deps = { root, env, programs: () => readPrograms(root, env), runtime };
53
+ rootForCrash = root;
54
+ const buildId = heldBuildId();
55
+ idForCrash = buildId;
56
+ const deps = { root, env, buildId, programs: () => readPrograms(root, env), runtime: createRuntime({ root, env }) };
47
57
  const stop = new AbortController();
48
58
  process.once("SIGTERM", () => stop.abort());
49
59
  process.once("SIGINT", () => stop.abort());
50
60
  const spawner = Number.parseInt(env["CARRICK_HELD_SPAWNER"] ?? "", 10);
51
61
  await serve(deps, { signal: stop.signal, ...(Number.isFinite(spawner) ? { spawner } : {}) });
52
62
  }
63
+ process.on("uncaughtException", (error) => {
64
+ crashed(error);
65
+ process.exit(0);
66
+ });
67
+ process.on("unhandledRejection", (error) => {
68
+ crashed(error);
69
+ process.exit(0);
70
+ });
53
71
  try {
54
72
  await main();
55
73
  }
56
74
  catch (error) {
57
- log("daemon failed", String(error));
75
+ crashed(error);
58
76
  }
59
77
  process.exit(0);
60
78
  //# sourceMappingURL=run.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/held/run.ts"],"names":[],"mappings":";AACA,mEAAmE;AACnE,EAAE;AACF,4EAA4E;AAC5E,4EAA4E;AAC5E,oBAAoB;AA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IAAI,EAAE,CAAC;AACf,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACf,OAAO,CAAC,KAAK,CAAC,CAAC;AACjB,CAAC;AACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { type ContractRow } from "../facts/store.ts";
2
+ import type { ServiceRuntime } from "./daemon.ts";
3
+ import { type Engine } from "./engine.ts";
4
+ import { type SiteFinder } from "./place.ts";
5
+ export type RuntimeDeps = {
6
+ root: string;
7
+ home?: string;
8
+ env?: NodeJS.ProcessEnv;
9
+ /** The built compiler engine's entry; found from the environment when unset. */
10
+ entry?: string | null;
11
+ /** The producer response rows now. Default: the fact file's. */
12
+ rows?: () => Promise<ContractRow[]>;
13
+ /** Each repo's index commit, as the fact file's header names it. Default: the fact file's. */
14
+ commits?: () => Promise<Record<string, string> | null>;
15
+ /** Changes when the rows may have: the fact file's size and mtime by default. */
16
+ stamp?: () => string;
17
+ /** The held compiler over a shadow's `w` directory. */
18
+ makeEngine?: (command: string, cwd: string) => Engine;
19
+ /** The compiler engine's site finder; the engine's `find_site` action by default. */
20
+ site?: SiteFinder;
21
+ };
22
+ export declare function createRuntime(options: RuntimeDeps): ServiceRuntime;