carrick 0.3.155 → 0.3.157

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 (125) hide show
  1. package/dist/contract.d.ts +22 -23
  2. package/dist/contract.js.map +1 -1
  3. package/dist/facts/enabled.d.ts +28 -0
  4. package/dist/facts/enabled.js +36 -0
  5. package/dist/facts/enabled.js.map +1 -1
  6. package/dist/facts/fetch.js +20 -8
  7. package/dist/facts/fetch.js.map +1 -1
  8. package/dist/facts/lines.d.ts +75 -2
  9. package/dist/facts/lines.js +302 -46
  10. package/dist/facts/lines.js.map +1 -1
  11. package/dist/facts/match.d.ts +2 -0
  12. package/dist/facts/match.js +189 -28
  13. package/dist/facts/match.js.map +1 -1
  14. package/dist/facts/peers.d.ts +2 -0
  15. package/dist/facts/peers.js +7 -2
  16. package/dist/facts/peers.js.map +1 -1
  17. package/dist/facts/store.d.ts +98 -2
  18. package/dist/facts/store.js +110 -12
  19. package/dist/facts/store.js.map +1 -1
  20. package/dist/held/client.d.ts +34 -0
  21. package/dist/held/client.js +85 -0
  22. package/dist/held/client.js.map +1 -0
  23. package/dist/held/daemon.d.ts +106 -0
  24. package/dist/held/daemon.js +307 -0
  25. package/dist/held/daemon.js.map +1 -0
  26. package/dist/held/engine.d.ts +50 -0
  27. package/dist/held/engine.js +166 -0
  28. package/dist/held/engine.js.map +1 -0
  29. package/dist/held/paths.d.ts +9 -0
  30. package/dist/held/paths.js +27 -0
  31. package/dist/held/paths.js.map +1 -0
  32. package/dist/held/place.d.ts +84 -0
  33. package/dist/held/place.js +198 -0
  34. package/dist/held/place.js.map +1 -0
  35. package/dist/held/registry.d.ts +22 -0
  36. package/dist/held/registry.js +72 -0
  37. package/dist/held/registry.js.map +1 -0
  38. package/dist/held/run.d.ts +2 -0
  39. package/dist/held/run.js +60 -0
  40. package/dist/held/run.js.map +1 -0
  41. package/dist/hook/bash-targets.d.ts +7 -2
  42. package/dist/hook/bash-targets.js +82 -27
  43. package/dist/hook/bash-targets.js.map +1 -1
  44. package/dist/hook/edit-flow.js +11 -7
  45. package/dist/hook/edit-flow.js.map +1 -1
  46. package/dist/hook/late.d.ts +1 -1
  47. package/dist/hook/late.js +3 -3
  48. package/dist/hook/late.js.map +1 -1
  49. package/dist/hook/lock.d.ts +26 -0
  50. package/dist/hook/lock.js +122 -0
  51. package/dist/hook/lock.js.map +1 -0
  52. package/dist/hook/post-bash.js +22 -7
  53. package/dist/hook/post-bash.js.map +1 -1
  54. package/dist/hook/post-read.js +9 -4
  55. package/dist/hook/post-read.js.map +1 -1
  56. package/dist/hook/probe.js +4 -2
  57. package/dist/hook/probe.js.map +1 -1
  58. package/dist/hook/read-answer.d.ts +23 -4
  59. package/dist/hook/read-answer.js +74 -19
  60. package/dist/hook/read-answer.js.map +1 -1
  61. package/dist/hook/rechecks.d.ts +2 -5
  62. package/dist/hook/rechecks.js +23 -130
  63. package/dist/hook/rechecks.js.map +1 -1
  64. package/dist/hook/similar.d.ts +13 -0
  65. package/dist/hook/similar.js +60 -0
  66. package/dist/hook/similar.js.map +1 -0
  67. package/dist/hook/stop-wait.d.ts +1 -0
  68. package/dist/hook/stop-wait.js +19 -24
  69. package/dist/hook/stop-wait.js.map +1 -1
  70. package/dist/hook/timings.d.ts +17 -3
  71. package/dist/hook/timings.js +10 -2
  72. package/dist/hook/timings.js.map +1 -1
  73. package/dist/lsp-frame.d.ts +20 -0
  74. package/dist/lsp-frame.js +47 -0
  75. package/dist/lsp-frame.js.map +1 -0
  76. package/dist/render.js +9 -3
  77. package/dist/render.js.map +1 -1
  78. package/dist/scan.d.ts +9 -0
  79. package/dist/scan.js +39 -8
  80. package/dist/scan.js.map +1 -1
  81. package/dist/server.js +4 -28
  82. package/dist/server.js.map +1 -1
  83. package/package.json +6 -6
  84. package/plugin/.claude-plugin/plugin.json +1 -1
  85. package/sidecar/dist/src/bundler.d.ts +5 -0
  86. package/sidecar/dist/src/bundler.js +20 -0
  87. package/sidecar/dist/src/capture/anchors.js +19 -4
  88. package/sidecar/dist/src/capture/api.d.ts +52 -4
  89. package/sidecar/dist/src/capture/check-probe.d.ts +17 -1
  90. package/sidecar/dist/src/capture/check-probe.js +39 -2
  91. package/sidecar/dist/src/capture/index.d.ts +12 -4
  92. package/sidecar/dist/src/capture/index.js +19 -3
  93. package/sidecar/dist/src/capture/result-label.js +3 -1
  94. package/sidecar/dist/src/capture/self-check.js +12 -31
  95. package/sidecar/dist/src/capture/serialised-arms.d.ts +27 -0
  96. package/sidecar/dist/src/capture/serialised-arms.js +76 -0
  97. package/sidecar/dist/src/capture/site-node.d.ts +17 -0
  98. package/sidecar/dist/src/capture/site-node.js +36 -0
  99. package/sidecar/dist/src/capture/stub-resolution.d.ts +63 -0
  100. package/sidecar/dist/src/capture/stub-resolution.js +102 -0
  101. package/sidecar/dist/src/capture/type-reasons.json +78 -0
  102. package/sidecar/dist/src/capture/unresolved.js +8 -1
  103. package/sidecar/dist/src/definition-resolver.d.ts +18 -9
  104. package/sidecar/dist/src/definition-resolver.js +66 -42
  105. package/sidecar/dist/src/engine-stamp.json +1 -0
  106. package/sidecar/dist/src/held-shadow.d.ts +60 -0
  107. package/sidecar/dist/src/held-shadow.js +222 -0
  108. package/sidecar/dist/src/index.js +47 -1
  109. package/sidecar/dist/src/library-claims.d.ts +3 -1
  110. package/sidecar/dist/src/library-claims.js +79 -3
  111. package/sidecar/dist/src/retype.js +1 -61
  112. package/sidecar/dist/src/type-home.d.ts +42 -0
  113. package/sidecar/dist/src/type-home.js +94 -0
  114. package/sidecar/dist/src/type-inferrer.d.ts +245 -28
  115. package/sidecar/dist/src/type-inferrer.js +938 -192
  116. package/sidecar/dist/src/type-parameters.d.ts +41 -0
  117. package/sidecar/dist/src/type-parameters.js +126 -0
  118. package/sidecar/dist/src/type-structural-expander.d.ts +1 -11
  119. package/sidecar/dist/src/type-structural-expander.js +9 -1
  120. package/sidecar/dist/src/types.d.ts +132 -20
  121. package/sidecar/dist/src/validators.d.ts +450 -244
  122. package/sidecar/dist/src/validators.js +27 -1
  123. package/dist/hook/lead.d.ts +0 -13
  124. package/dist/hook/lead.js +0 -39
  125. package/dist/hook/lead.js.map +0 -1
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Type parameters a read type still holds open, and the type a call
3
+ * instantiates (carrick#3897, carrick#4128). A type read inside a generic
4
+ * function names that function's type parameters; printed into a contract
5
+ * they name nothing. Its callers say what they are.
6
+ */
7
+ import { ts } from 'ts-morph';
8
+ /**
9
+ * The name of a type parameter in `type` that a declaration enclosing `at`
10
+ * declares (a function, a method, a class), or `undefined`. Reads union and
11
+ * intersection members, type arguments, indexed accesses, conditional
12
+ * branches and the properties of an anonymous object type, to a fixed depth.
13
+ * A polymorphic `this` is not one: a call can hold it without passing a
14
+ * response through.
15
+ */
16
+ export declare function enclosingTypeParameterIn(checker: ts.TypeChecker, type: ts.Type, at: ts.Node): string | undefined;
17
+ /**
18
+ * How `call` reads the type `type` takes at `value` (carrick#4128):
19
+ *
20
+ * - `as_read`: `type` holds no type parameter of a declaration around
21
+ * `value`, so there is nothing to instantiate;
22
+ * - `instantiated`: a symbol whose type is `type` with the type arguments
23
+ * of `call`'s resolved signature put in, where `value` sits in the
24
+ * function `call` resolves to and the result holds no open parameter of
25
+ * either side;
26
+ * - `open`: the name of a type parameter left open, where `call` does not
27
+ * reach the function `value` is in, or binds the parameter only to one
28
+ * of its own caller's (`<U>(u: U) => place(u)`).
29
+ *
30
+ * The symbol is handed back rather than its type so that a reader holding
31
+ * its own wrapper over the checker reads it there.
32
+ */
33
+ export declare function instantiatedAtCall(checker: ts.TypeChecker, type: ts.Type, value: ts.Node, call: ts.CallLikeExpression): {
34
+ kind: 'as_read';
35
+ } | {
36
+ kind: 'instantiated';
37
+ symbol: ts.Symbol;
38
+ } | {
39
+ kind: 'open';
40
+ name: string;
41
+ };
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Type parameters a read type still holds open, and the type a call
3
+ * instantiates (carrick#3897, carrick#4128). A type read inside a generic
4
+ * function names that function's type parameters; printed into a contract
5
+ * they name nothing. Its callers say what they are.
6
+ */
7
+ import { ts } from 'ts-morph';
8
+ /** How deep {@link enclosingTypeParameterIn} reads into a type. */
9
+ const TYPE_PARAMETER_DEPTH = 4;
10
+ /**
11
+ * The name of a type parameter in `type` that a declaration enclosing `at`
12
+ * declares (a function, a method, a class), or `undefined`. Reads union and
13
+ * intersection members, type arguments, indexed accesses, conditional
14
+ * branches and the properties of an anonymous object type, to a fixed depth.
15
+ * A polymorphic `this` is not one: a call can hold it without passing a
16
+ * response through.
17
+ */
18
+ export function enclosingTypeParameterIn(checker, type, at) {
19
+ const seen = new Set();
20
+ const encloses = (declaring) => {
21
+ for (let node = at.parent; node; node = node.parent) {
22
+ if (node === declaring)
23
+ return true;
24
+ }
25
+ return false;
26
+ };
27
+ const visit = (current, depth) => {
28
+ if (depth > TYPE_PARAMETER_DEPTH || seen.has(current))
29
+ return undefined;
30
+ seen.add(current);
31
+ if (current.flags & ts.TypeFlags.TypeParameter) {
32
+ if (current.isThisType)
33
+ return undefined;
34
+ const declared = current.symbol?.declarations?.some((decl) => ts.isTypeParameterDeclaration(decl) && encloses(decl.parent));
35
+ if (declared)
36
+ return current.symbol.getName();
37
+ }
38
+ const parts = [...(current.aliasTypeArguments ?? [])];
39
+ if (current.isUnionOrIntersection())
40
+ parts.push(...current.types);
41
+ if (current.flags & ts.TypeFlags.IndexedAccess) {
42
+ const access = current;
43
+ parts.push(access.objectType, access.indexType);
44
+ }
45
+ if (current.flags & ts.TypeFlags.Conditional) {
46
+ const conditional = current;
47
+ parts.push(conditional.checkType, conditional.extendsType);
48
+ }
49
+ if (current.flags & ts.TypeFlags.Object) {
50
+ const flags = current.objectFlags;
51
+ if (flags & ts.ObjectFlags.Reference) {
52
+ parts.push(...checker.getTypeArguments(current));
53
+ }
54
+ if (flags & ts.ObjectFlags.Anonymous) {
55
+ for (const property of current.getProperties()) {
56
+ parts.push(checker.getTypeOfSymbolAtLocation(property, at));
57
+ }
58
+ }
59
+ }
60
+ for (const part of parts) {
61
+ const found = visit(part, depth + 1);
62
+ if (found !== undefined)
63
+ return found;
64
+ }
65
+ return undefined;
66
+ };
67
+ return visit(type, 0);
68
+ }
69
+ /** `node` sits inside `declaration`. */
70
+ function sitsIn(node, declaration) {
71
+ for (let at = node.parent; at; at = at.parent) {
72
+ if (at === declaration)
73
+ return true;
74
+ }
75
+ return false;
76
+ }
77
+ /** The checker's `CheckFlags.Instantiated`: a symbol whose type is its target's, mapped. */
78
+ const INSTANTIATED = 1;
79
+ /**
80
+ * How `call` reads the type `type` takes at `value` (carrick#4128):
81
+ *
82
+ * - `as_read`: `type` holds no type parameter of a declaration around
83
+ * `value`, so there is nothing to instantiate;
84
+ * - `instantiated`: a symbol whose type is `type` with the type arguments
85
+ * of `call`'s resolved signature put in, where `value` sits in the
86
+ * function `call` resolves to and the result holds no open parameter of
87
+ * either side;
88
+ * - `open`: the name of a type parameter left open, where `call` does not
89
+ * reach the function `value` is in, or binds the parameter only to one
90
+ * of its own caller's (`<U>(u: U) => place(u)`).
91
+ *
92
+ * The symbol is handed back rather than its type so that a reader holding
93
+ * its own wrapper over the checker reads it there.
94
+ */
95
+ export function instantiatedAtCall(checker, type, value, call) {
96
+ const open = enclosingTypeParameterIn(checker, type, value);
97
+ if (open === undefined)
98
+ return { kind: 'as_read' };
99
+ const signature = checker.getResolvedSignature(call);
100
+ const mapper = signature?.mapper;
101
+ const declaration = signature?.getDeclaration();
102
+ if (mapper === undefined || !declaration || !sitsIn(value, declaration)) {
103
+ return { kind: 'open', name: open };
104
+ }
105
+ let symbol;
106
+ let instantiated;
107
+ try {
108
+ // The checker's public surface has no `instantiateType`: a transient
109
+ // symbol marked instantiated, whose target holds `type` and whose mapper
110
+ // is the call's, is read through `getTypeOfSymbol`, which instantiates it.
111
+ const internal = checker;
112
+ const carrier = internal.createSymbol(ts.SymbolFlags.Property, '__read');
113
+ carrier.links.type = type;
114
+ symbol = internal.createSymbol(ts.SymbolFlags.Property, '__instantiated', INSTANTIATED);
115
+ const links = symbol.links;
116
+ links.target = carrier;
117
+ links.mapper = mapper;
118
+ instantiated = checker.getTypeOfSymbol(symbol);
119
+ }
120
+ catch {
121
+ return { kind: 'open', name: open };
122
+ }
123
+ const still = enclosingTypeParameterIn(checker, instantiated, value) ??
124
+ enclosingTypeParameterIn(checker, instantiated, call);
125
+ return still === undefined ? { kind: 'instantiated', symbol } : { kind: 'open', name: still };
126
+ }
@@ -30,6 +30,7 @@
30
30
  */
31
31
  import { type Node, type Type, ts } from 'ts-morph';
32
32
  import { type ExternalImports } from './origin.js';
33
+ import type { WireFormat } from './types.js';
33
34
  /**
34
35
  * Bound on the structural-expansion recursion. Deep enough for every realistic
35
36
  * request/response shape; a backstop against pathological/recursive types the
@@ -63,17 +64,6 @@ export interface MemberOverrides {
63
64
  readonly applied: Set<string>;
64
65
  readonly at: Node;
65
66
  }
66
- /**
67
- * The representation a type is printed in.
68
- *
69
- * `'declared'` prints the type the source declares. `'json'` prints what a
70
- * JSON serialiser puts on the wire for a value of that type (carrick#1163):
71
- * `JSON.stringify` calls a value's `toJSON()` and serialises its RESULT, so a
72
- * `Date` travels as the string its `toJSON` returns, and so does any other
73
- * type that declares one. The mapping is read from the compiler's own
74
- * signature, never from a list of type names.
75
- */
76
- export type WireFormat = 'declared' | 'json';
77
67
  /**
78
68
  * The program the walked type belongs to, and the service root inside it.
79
69
  *
@@ -339,7 +339,15 @@ function memberTypeWithoutDeclaration(prop, owner) {
339
339
  function renderPropertyName(prop, decl) {
340
340
  const node = decl;
341
341
  const text = node?.getNameNode?.()?.getText();
342
- return text && text.length > 0 ? text : prop.getName();
342
+ if (text && text.length > 0)
343
+ return text;
344
+ // No name node (a checker-synthesised member): the bare symbol name is not
345
+ // valid text for a key that is not an identifier (`a-b`, `1st`).
346
+ const name = prop.getName();
347
+ // `isIdentifierText` is TypeScript's own check; it is exported at runtime
348
+ // but absent from the public typings.
349
+ const isIdentifierText = ts.isIdentifierText;
350
+ return isIdentifierText(name, ts.ScriptTarget.Latest) ? name : JSON.stringify(name);
343
351
  }
344
352
  /** True for tuple types (`[a, b]`), which must not be walked as objects. */
345
353
  function isTuple(type) {
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import type { ResponseModes } from './response-modes.js';
6
6
  import type { ResultLabel } from './capture/api.js';
7
+ import type { ShadowResult } from './held-shadow.js';
7
8
  /**
8
9
  * The kind of type inference to perform
9
10
  */
@@ -294,6 +295,14 @@ export interface ShutdownRequest extends BaseRequest {
294
295
  export interface ListProgramFilesRequest extends BaseRequest {
295
296
  action: 'list_program_files';
296
297
  }
298
+ /**
299
+ * Write the init'd service's program as a shadow tree a held-open TypeScript 7
300
+ * compiler reads (see held-shadow.ts). `out_dir` must lie outside the checkout.
301
+ */
302
+ export interface WriteShadowRequest extends BaseRequest {
303
+ action: 'write_shadow';
304
+ out_dir: string;
305
+ }
297
306
  /**
298
307
  * The import graph without statement texts. Every name and path is an index
299
308
  * into `strings`. Per file: its path, whether it is a script, its declared
@@ -436,8 +445,29 @@ export interface ResolveDefinitionsRequest extends BaseRequest {
436
445
  action: 'resolve_definitions';
437
446
  /** Absolute path to the capture stub dir (package.json + types/ tree). */
438
447
  stub_dir: string;
439
- /** Surface type alias names to resolve */
440
- aliases: string[];
448
+ /** Surface type aliases to resolve, each with the payload it types. */
449
+ aliases: DefinitionAlias[];
450
+ }
451
+ /**
452
+ * One surface alias to resolve, and the payload it types: which protocol,
453
+ * which kind of payload, and which side of the operation the entry is on.
454
+ * The resolver prints the alias's structural form in JSON wire form exactly
455
+ * where the judge compares that form (`wireFormFor`, carrick-cloud#3503,
456
+ * carrick#4275): the sending side of an `http` payload and a GraphQL producer
457
+ * response. A derived alias
458
+ * (an unwidened reading, a response-mode case) carries its base entry's facts.
459
+ */
460
+ export interface DefinitionAlias {
461
+ alias: string;
462
+ protocol: import('./capture/api.js').ProbeProtocol;
463
+ type_kind: 'request' | 'response';
464
+ side: 'producer' | 'consumer';
465
+ /**
466
+ * The entry is a procedure of an RPC router (tRPC and similar). Its wire
467
+ * form is its router's transformer's, which may keep a `Date` a `Date`
468
+ * (carrick#4275), so it prints as declared until that is a known fact.
469
+ */
470
+ procedure: boolean;
441
471
  }
442
472
  /**
443
473
  * One consumer call to retype with the producer's response type (carrick#1491).
@@ -720,6 +750,14 @@ export type LibraryClaim = {
720
750
  kind: 'make';
721
751
  form: 'call' | 'new';
722
752
  member: string | null;
753
+ /**
754
+ * Amendment 12: one maker receiver id the export lists (`instance:new`).
755
+ * The member is read on that receiver's type, as an op's `of` is, and its
756
+ * declared return is the made object. Needs `form: 'call'`, a `member`
757
+ * and a `name` at an argument; `base`, `prefix`, `handler`, `runs`,
758
+ * `protocol` and `result` beside it are `claim_invalid`.
759
+ */
760
+ of?: string;
723
761
  /** An HTTP base URL, or a broker's address. */
724
762
  base?: ClaimSlot;
725
763
  /** A prefix every name the instance sends gets. */
@@ -884,6 +922,13 @@ export interface VerifyLibraryClaimsRequest extends BaseRequest {
884
922
  checks: LibraryCheck[];
885
923
  /** Checks not reached in time come back `unchecked` with reason `budget`; null or absent is the default. */
886
924
  budget_ms?: number | null;
925
+ /**
926
+ * Another service's tsconfig (absolute, or relative to the process's repo
927
+ * root): the checks are judged in a program built from its compiler options
928
+ * with only the probe file, released after the request. Absent: judged in
929
+ * this process's own program (carrick#4472).
930
+ */
931
+ tsconfig_path?: string;
887
932
  }
888
933
  /**
889
934
  * List each package's declared surface the way the verifier reads it
@@ -913,7 +958,7 @@ export interface ListLibrarySurfaceRequest extends BaseRequest {
913
958
  /**
914
959
  * Union type for all possible sidecar requests
915
960
  */
916
- export type SidecarRequest = RetypeCheckRequest | RetypePrescreenRequest | VerifyClientSemanticsRequest | VerifyLibraryClaimsRequest | ListLibrarySurfaceRequest | InitRequest | BundleRequest | CaptureV2Request | CheckV2Request | InferRequest | ResolveDefinitionsRequest | HealthRequest | ShutdownRequest | ListProgramFilesRequest | ReachGraphRequest | ReachRequest | AddProgramFilesRequest | PositionRowsRequest | ImplementationsRequest;
961
+ export type SidecarRequest = RetypeCheckRequest | RetypePrescreenRequest | VerifyClientSemanticsRequest | VerifyLibraryClaimsRequest | ListLibrarySurfaceRequest | InitRequest | BundleRequest | CaptureV2Request | CheckV2Request | InferRequest | ResolveDefinitionsRequest | HealthRequest | ShutdownRequest | ListProgramFilesRequest | WriteShadowRequest | ReachGraphRequest | ReachRequest | AddProgramFilesRequest | PositionRowsRequest | ImplementationsRequest;
917
962
  /**
918
963
  * Request for a specific symbol to be bundled
919
964
  */
@@ -939,6 +984,12 @@ export interface SymbolRequest {
939
984
  */
940
985
  consumer_response?: boolean;
941
986
  }
987
+ /** A call's place in its file: where a request's {@link InferRequestItem.through_call} is. */
988
+ export interface ThroughCall {
989
+ file_path: string;
990
+ span_start: number;
991
+ span_end: number;
992
+ }
942
993
  /**
943
994
  * Request for type inference at a specific location
944
995
  */
@@ -976,6 +1027,13 @@ export interface InferRequestItem {
976
1027
  * element this path names (`loop-element.ts`).
977
1028
  */
978
1029
  route_path?: string;
1030
+ /**
1031
+ * carrick#4128: the call that reaches the function this request's
1032
+ * expression sits in, where the scanner reads a caller's payload in the
1033
+ * wrapper that builds it. A type parameter of that function is read as
1034
+ * this call instantiates it; one it leaves open is never published.
1035
+ */
1036
+ through_call?: ThroughCall;
979
1037
  }
980
1038
  /**
981
1039
  * Response status
@@ -1157,6 +1215,12 @@ export interface ListProgramFilesResponse extends BaseResponse {
1157
1215
  files?: string[];
1158
1216
  errors?: string[];
1159
1217
  }
1218
+ /**
1219
+ * Response for write_shadow action: the fields of `ShadowResult`.
1220
+ */
1221
+ export interface WriteShadowResponse extends BaseResponse, Partial<ShadowResult> {
1222
+ errors?: string[];
1223
+ }
1160
1224
  /**
1161
1225
  * Response for reach_graph action
1162
1226
  */
@@ -1241,7 +1305,7 @@ export interface SemanticsResult {
1241
1305
  verdict: 'verified' | 'failed' | 'unchecked';
1242
1306
  /** Absent exactly when verified. */
1243
1307
  reason?: string;
1244
- /** Verified op verdicts only: the declarations its member resolves to on the receiver. */
1308
+ /** Verified op verdicts, and a verified `of`-make's (amendment 12): the declarations its member resolves to on the receiver. */
1245
1309
  declarations?: SemanticsDeclaration[];
1246
1310
  /**
1247
1311
  * Verified receive op verdicts only: the op verified but its `request`
@@ -1513,10 +1577,24 @@ export interface ListLibrarySurfaceResponse extends BaseResponse {
1513
1577
  /**
1514
1578
  * Union type for all possible sidecar responses
1515
1579
  */
1516
- export type SidecarResponse = RetypeCheckResponse | RetypePrescreenResponse | VerifyClientSemanticsResponse | VerifyLibraryClaimsResponse | ListLibrarySurfaceResponse | InitResponse | BundleResponse | CaptureV2Response | CheckV2Response | InferResponse | ResolveDefinitionsResponse | HealthResponse | ShutdownResponse | ListProgramFilesResponse | ReachGraphResponse | ReachResponse | AddProgramFilesResponse | PositionRowsResponse | ImplementationsResponse | ErrorResponse;
1580
+ export type SidecarResponse = RetypeCheckResponse | RetypePrescreenResponse | VerifyClientSemanticsResponse | VerifyLibraryClaimsResponse | ListLibrarySurfaceResponse | InitResponse | BundleResponse | CaptureV2Response | CheckV2Response | InferResponse | ResolveDefinitionsResponse | HealthResponse | ShutdownResponse | ListProgramFilesResponse | WriteShadowResponse | ReachGraphResponse | ReachResponse | AddProgramFilesResponse | PositionRowsResponse | ImplementationsResponse | ErrorResponse;
1517
1581
  /**
1518
1582
  * An entry in the type manifest
1519
1583
  */
1584
+ /**
1585
+ * carrick#2148: where a named type is declared: its name, the declaring file
1586
+ * (absolute) and the 1-based line of the declaration's name.
1587
+ */
1588
+ export interface TypeHome {
1589
+ symbol: string;
1590
+ file_path: string;
1591
+ line: number;
1592
+ /**
1593
+ * carrick#2148 H3: `schema` where the home is the `const` of a schema value
1594
+ * the contract was read off, not a type declaration. Absent for a type.
1595
+ */
1596
+ kind?: 'schema';
1597
+ }
1520
1598
  export interface ManifestEntry {
1521
1599
  /** The alias or original name of the type */
1522
1600
  alias: string;
@@ -1528,6 +1606,8 @@ export interface ManifestEntry {
1528
1606
  type_string: string;
1529
1607
  /** Whether this was an explicit annotation or inferred */
1530
1608
  is_explicit: boolean;
1609
+ /** carrick#2148: where the bundled declaration is, past any barrel. */
1610
+ home?: TypeHome;
1531
1611
  }
1532
1612
  /**
1533
1613
  * An inferred type result
@@ -1541,6 +1621,16 @@ export interface InferredType {
1541
1621
  is_explicit: boolean;
1542
1622
  /** Source location information */
1543
1623
  source_location: SourceLocation;
1624
+ /**
1625
+ * carrick#4244: the nodes the published `type_string` was built from, in
1626
+ * source order of the reader that built it: each success send or returned
1627
+ * expression a response joined, the annotation or schema a declared
1628
+ * contract came from, or the one body read a request was taken from.
1629
+ * `source_location` still names the one node the answer is located at (on
1630
+ * a producer, usually the handler). Absent on a decided abstain and on an
1631
+ * answer whose text is bare `any` or `unknown`: there is no value to place.
1632
+ */
1633
+ read_spans?: ReadSpan[];
1544
1634
  /** The kind of inference that was performed */
1545
1635
  infer_kind: InferKind;
1546
1636
  /** The unwrapped/extracted payload type (if different from type_string) */
@@ -1581,21 +1671,21 @@ export interface InferredType {
1581
1671
  */
1582
1672
  array_depth?: number;
1583
1673
  /**
1584
- * Declaration file of `primary_type_symbol` (absolute path), when the
1585
- * anchor symbol has a resolvable source declaration. Reported by every
1586
- * infer kind that reports the symbol (carrick#1819): it is where a reader
1587
- * finds the type an anchor names, and the scanner writes an anchor's home
1588
- * from it. The file is the one that declares the symbol the type resolves
1589
- * to, never a barrel that re-exports it.
1674
+ * carrick#2148: where the type `type_string` was printed from is declared.
1675
+ * Where `primary_type_symbol` is reported, the home is that symbol's (its
1676
+ * `symbol` equals it); otherwise it is the printed type's, with array levels
1677
+ * and a `| null`/`| undefined` around exactly one named type peeled. The
1678
+ * file is the one that declares the type, never a barrel that re-exports
1679
+ * it, and the line is the declaration's name. Absent for a shape nobody
1680
+ * named, a TypeScript lib type, framework machinery, a type declared inside
1681
+ * an ambient `declare module "<specifier>"` block (a package's type,
1682
+ * wherever the stub sits) and a decided abstain.
1590
1683
  *
1591
- * The scanner's pub/sub two-anchor arbitration (carrick#413) also reads it,
1592
- * for a borrowed-anchor request only, to re-aim a demoted explicit
1593
- * `SymbolRequest` at the tsc-witnessed payload type: the bundler requires
1594
- * the symbol to be declared in, or re-exported by, the request's
1595
- * `source_file`, and the inference is the only party that knows where that
1596
- * is.
1684
+ * The scanner's pub/sub two-anchor arbitration (carrick#413) reads its file
1685
+ * to re-aim a demoted explicit `SymbolRequest` at the tsc-witnessed payload
1686
+ * type.
1597
1687
  */
1598
- primary_type_symbol_source?: string;
1688
+ type_home?: TypeHome;
1599
1689
  /**
1600
1690
  * Blueprint row N8: the type `type_string` prints is framework machinery,
1601
1691
  * decided by where it is declared (a library or installed package with the
@@ -1624,6 +1714,14 @@ export interface InferredType {
1624
1714
  * Sorted by `path`; absent (not empty) when the type carries no top type.
1625
1715
  */
1626
1716
  any_provenance?: TypeProvenance[];
1717
+ /**
1718
+ * carrick#4196: the member of the call's value this answer read as the
1719
+ * response body, set only where the call's function hands back an object
1720
+ * holding the transport response beside the body it read (carrick#4185).
1721
+ * The scanner keeps an answer at a caller row the request summaries own
1722
+ * only when it carries this; every other answer is absent of it.
1723
+ */
1724
+ body_member?: string;
1627
1725
  /**
1628
1726
  * carrick#1516, response inferences only: the same inference re-read with
1629
1727
  * every literal on the handler's path kept at its literal type
@@ -1709,8 +1807,8 @@ export interface StatedBody {
1709
1807
  * is not a named type (an object literal type, a union of several types).
1710
1808
  */
1711
1809
  root?: string;
1712
- /** Declaration file (absolute path) of `root`, when it resolves to one. */
1713
- root_source?: string;
1810
+ /** Where `root` is declared (carrick#2148), by `InferredType.type_home`'s rule. */
1811
+ root_home?: TypeHome;
1714
1812
  /** Array levels peeled on the way to `root`. Omitted when 0. */
1715
1813
  array_depth?: number;
1716
1814
  /**
@@ -1743,9 +1841,23 @@ export type TypeProvenance = import('./capture/api.js').TypeProvenance;
1743
1841
  /** carrick#1836: declared in the capture bundle, which reads it on a literal anchor. */
1744
1842
  export type PrintedName = import('./capture/api.js').PrintedName;
1745
1843
  export type TypeProvenanceReason = import('./capture/api.js').TypeProvenanceReason;
1844
+ /** carrick#4275: declared in the capture bundle, where `wireFormFor` answers it. */
1845
+ export type WireFormat = import('./capture/api.js').WireFormat;
1746
1846
  /**
1747
1847
  * Source location information for a type
1748
1848
  */
1849
+ /**
1850
+ * One node an answer read (carrick#4244), in the compiler's positions:
1851
+ * `start`/`end` are `node.getStart()`/`getEnd()`, UTF-16 code units from the
1852
+ * start of the file, end exclusive. `file_path` is absolute, as
1853
+ * `source_location.file_path` is: an imported handler's values sit in
1854
+ * another file than the ask.
1855
+ */
1856
+ export interface ReadSpan {
1857
+ file_path: string;
1858
+ start: number;
1859
+ end: number;
1860
+ }
1749
1861
  export interface SourceLocation {
1750
1862
  /** File path relative to repo root */
1751
1863
  file_path: string;