carrick 0.3.139 → 0.3.141

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 (31) hide show
  1. package/package.json +6 -6
  2. package/plugin/.claude-plugin/plugin.json +1 -1
  3. package/sidecar/dist/src/argument-modes.d.ts +56 -0
  4. package/sidecar/dist/src/argument-modes.js +448 -0
  5. package/sidecar/dist/src/capture/api.d.ts +11 -0
  6. package/sidecar/dist/src/capture/self-check.js +131 -1
  7. package/sidecar/dist/src/index.js +13 -20
  8. package/sidecar/dist/src/infer-cache.d.ts +0 -8
  9. package/sidecar/dist/src/infer-cache.js +0 -14
  10. package/sidecar/dist/src/library-claims.js +4 -3
  11. package/sidecar/dist/src/loop-element.d.ts +58 -0
  12. package/sidecar/dist/src/loop-element.js +307 -0
  13. package/sidecar/dist/src/origin.d.ts +10 -7
  14. package/sidecar/dist/src/origin.js +10 -7
  15. package/sidecar/dist/src/program-files.d.ts +34 -11
  16. package/sidecar/dist/src/program-files.js +52 -10
  17. package/sidecar/dist/src/project-loader.js +9 -0
  18. package/sidecar/dist/src/response-modes.d.ts +7 -2
  19. package/sidecar/dist/src/response-modes.js +1 -1
  20. package/sidecar/dist/src/retype-deferred.d.ts +34 -0
  21. package/sidecar/dist/src/retype-deferred.js +326 -0
  22. package/sidecar/dist/src/retype-selector.d.ts +43 -0
  23. package/sidecar/dist/src/retype-selector.js +217 -0
  24. package/sidecar/dist/src/retype.d.ts +11 -2
  25. package/sidecar/dist/src/retype.js +39 -14
  26. package/sidecar/dist/src/type-inferrer.d.ts +43 -7
  27. package/sidecar/dist/src/type-inferrer.js +232 -11
  28. package/sidecar/dist/src/types.d.ts +21 -1
  29. package/sidecar/dist/src/validators.d.ts +25 -12
  30. package/sidecar/dist/src/validators.js +2 -0
  31. package/templates/skills/carrick-reuse.md +1 -1
@@ -27,6 +27,7 @@ import { notePrintedType, PrintedTypes } from './printed-names.js';
27
27
  import { externalImportsOf, isExternalOrigin } from './origin.js';
28
28
  import { reachedOnlyOnFailure } from './failure-path.js';
29
29
  import { readResponseModes } from './response-modes.js';
30
+ import { callInto, calledFunction, narrowByArguments } from './argument-modes.js';
30
31
  import { functionAtLine } from './function-line-index.js';
31
32
  import { attributedDeclaration, installedPackageOf } from './declaration-attribution.js';
32
33
  import { endLineOf, startLineOf } from './line-index.js';
@@ -34,6 +35,8 @@ import { callsOf, descendantsOf, descendantsOnLine, descendantsOnLines, wrap, }
34
35
  import { elapsedMs, inferTiming, phaseClock, timedPhase } from './infer-timing.js';
35
36
  import { StatedParams } from './stated-params.js';
36
37
  import { bindingToleratesAbsence, handlerToleratesAbsentBody } from './absent-body.js';
38
+ import { replaceFileText } from './program-files.js';
39
+ import { loopElementPick } from './loop-element.js';
37
40
  import { classifyStatusCodes, constituents, httpStatus, statesNoBody, statesNoShape, statusKeyCode, statusTableOf, successEntries, } from './capture/index.js';
38
41
  import { addedDiagnostics, applyInsertions, fileDiagnostics, literalInsertions, mapBack, mapForward, normalise, pathOf, } from './unwidened.js';
39
42
  import { expandTypeStructural, jsonWireType, } from './type-structural-expander.js';
@@ -421,6 +424,12 @@ const UNWIDENED_BACKSTOP_MS = 30 * 60_000;
421
424
  * const inferrer = new TypeInferrer({ project });
422
425
  * const result = inferrer.infer(requests, extractionConfig);
423
426
  */
427
+ /**
428
+ * The kinds a route row's request is asked as, and so the kinds a loop
429
+ * element is read for (carrick#1029): a response read at the send or as the
430
+ * handler's return, and a request body.
431
+ */
432
+ const LOOP_ROW_KINDS = new Set(['response_body', 'function_return', 'request_body']);
424
433
  export class TypeInferrer {
425
434
  project;
426
435
  packageOf;
@@ -483,6 +492,12 @@ export class TypeInferrer {
483
492
  const bodies = [];
484
493
  /** How long each request took, in the order they were done (carrick#1985). */
485
494
  const timings = [];
495
+ /**
496
+ * Requests for a route registered once per loop element (carrick#1029),
497
+ * read after everything else, with where each answer goes in the answer
498
+ * order.
499
+ */
500
+ const loopRows = [];
486
501
  for (const request of requests) {
487
502
  const slotStarted = performance.now();
488
503
  const phasesStarted = phaseClock();
@@ -508,11 +523,16 @@ export class TypeInferrer {
508
523
  // while the program the prints were made in is still the project's.
509
524
  // The unwidened re-read below records nothing: it prints the same
510
525
  // node, and its reading has a budget.
511
- const prints = new PrintedTypes();
512
- const result = prints.during(() => this.inferSingle(request, extractionConfig));
526
+ // carrick#1029: a route registered once per loop element is read
527
+ // last. Its reading rewrites its file, and a rewrite forgets every
528
+ // node of the file that the readings below still hold.
529
+ if (this.loopPickFor(request)) {
530
+ loopRows.push({ request, at: inferredTypes.length });
531
+ continue;
532
+ }
533
+ const result = this.inferRecordingNames(request, extractionConfig);
513
534
  if (result) {
514
535
  printedLength = result.type_string.length;
515
- this.recordPrintedNames(result, request, prints);
516
536
  inferredTypes.push(result);
517
537
  if (request.infer_kind === 'response_body' || request.infer_kind === 'function_return') {
518
538
  responses.push({ request, result });
@@ -600,6 +620,32 @@ export class TypeInferrer {
600
620
  catch (err) {
601
621
  this.logError(`Unwidened reading failed: ${err instanceof Error ? err.message : String(err)}`);
602
622
  }
623
+ // The loop rows, each typed for its own element. Not re-read unwidened:
624
+ // that re-read rewrites the original file, where the element is not
625
+ // fixed. Placed back in request order, last first so earlier places hold.
626
+ const loopAnswers = [];
627
+ // Each was counted done, and timed, where it was deferred.
628
+ for (const { request, at } of loopRows) {
629
+ const loc = this.formatRequestLocation(request);
630
+ try {
631
+ const pick = this.loopPickFor(request);
632
+ const result = pick
633
+ ? this.inferForLoopElement(request, pick, extractionConfig)
634
+ : this.inferRecordingNames(request, extractionConfig);
635
+ if (result) {
636
+ loopAnswers.push({ at, result });
637
+ }
638
+ else {
639
+ errors.push(`Could not infer type at ${request.file_path}:${loc} (${request.infer_kind})`);
640
+ }
641
+ }
642
+ catch (err) {
643
+ const error = err instanceof Error ? err.message : String(err);
644
+ errors.push(`Error inferring type at ${request.file_path}:${loc}: ${error}`);
645
+ }
646
+ }
647
+ for (const { at, result } of loopAnswers.reverse())
648
+ inferredTypes.splice(at, 0, result);
603
649
  return {
604
650
  success: errors.length === 0 || inferredTypes.length > 0,
605
651
  inferred_types: inferredTypes.length > 0 ? inferredTypes : undefined,
@@ -685,6 +731,67 @@ export class TypeInferrer {
685
731
  * carrick#1836: list on `result` the declarations behind the names its text
686
732
  * prints that the request's file cannot resolve (`PrintedTypes.namesIn`).
687
733
  */
734
+ /** `inferSingle`, with what the names it prints meant (carrick#1836). */
735
+ inferRecordingNames(request, extractionConfig) {
736
+ const prints = new PrintedTypes();
737
+ const result = prints.during(() => this.inferSingle(request, extractionConfig));
738
+ if (result)
739
+ this.recordPrintedNames(result, request, prints);
740
+ return result;
741
+ }
742
+ /**
743
+ * carrick#1029: the loop element a route row's path names, when its
744
+ * registration is made once per element of a constant list
745
+ * (`loop-element.ts`). Only a route row that states its path is read.
746
+ */
747
+ loopPickFor(request) {
748
+ if (!request.route_path)
749
+ return undefined;
750
+ if (!LOOP_ROW_KINDS.has(request.infer_kind))
751
+ return undefined;
752
+ const sourceFile = this.getSourceFile(request.file_path);
753
+ if (!sourceFile)
754
+ return undefined;
755
+ // Every call on the line, outermost first: on `LIST.forEach((x) =>
756
+ // app.get(…))` the loop's own call is the line's first registration-shaped
757
+ // call, and the registration is inside it.
758
+ for (const entry of descendantsOnLine(sourceFile, request.line_number)) {
759
+ if (entry.kind !== SyntaxKind.CallExpression)
760
+ continue;
761
+ const pick = loopElementPick(wrap(sourceFile, entry), request.route_path);
762
+ if (pick)
763
+ return pick;
764
+ }
765
+ return undefined;
766
+ }
767
+ /**
768
+ * The request inferred with the loop's list rewritten to the one element
769
+ * `pick` names, so the compiler types the handler for that element. The
770
+ * file is restored before returning, and the names the reading prints are
771
+ * recorded while the rewritten program is still the project's. Lines do not
772
+ * move (the rewrite is padded); a span after the list moves by the length
773
+ * the rewrite changed.
774
+ */
775
+ inferForLoopElement(request, pick, extractionConfig) {
776
+ const original = pick.file.getFullText();
777
+ const delta = pick.text.length - (pick.end - pick.start);
778
+ const moved = (at) => (at !== undefined && at >= pick.end ? at + delta : at);
779
+ const mapped = {
780
+ ...request,
781
+ span_start: moved(request.span_start),
782
+ span_end: moved(request.span_end),
783
+ };
784
+ replaceFileText(pick.file, original.slice(0, pick.start) + pick.text + original.slice(pick.end));
785
+ try {
786
+ const result = this.inferRecordingNames(mapped, extractionConfig);
787
+ this.log(`Typed ${request.file_path}:${request.line_number} (${request.infer_kind}) for loop element ` +
788
+ `${pick.index + 1} of ${pick.of}: ${request.route_path}`);
789
+ return result;
790
+ }
791
+ finally {
792
+ replaceFileText(pick.file, original);
793
+ }
794
+ }
688
795
  recordPrintedNames(result, request, prints) {
689
796
  const sourceFile = this.getSourceFile(request.file_path);
690
797
  if (!sourceFile)
@@ -828,7 +935,7 @@ export class TypeInferrer {
828
935
  originals.set(file, file.getFullText());
829
936
  try {
830
937
  for (const [file, list] of insertions) {
831
- file.replaceWithText(applyInsertions(originals.get(file), list));
938
+ replaceFileText(file, applyInsertions(originals.get(file), list));
832
939
  }
833
940
  // A diagnostic the marking added sits in a function on some request's
834
941
  // path (or elsewhere in that function's file): every request whose path
@@ -891,7 +998,7 @@ export class TypeInferrer {
891
998
  }
892
999
  finally {
893
1000
  for (const [file, text] of originals)
894
- file.replaceWithText(text);
1001
+ replaceFileText(file, text);
895
1002
  }
896
1003
  }
897
1004
  /**
@@ -1075,6 +1182,11 @@ export class TypeInferrer {
1075
1182
  const returnTypeNode = func.getReturnTypeNode();
1076
1183
  const isExplicit = returnTypeNode !== undefined;
1077
1184
  let returnType = func.getReturnType();
1185
+ // carrick#2372: a handler that returns its executor's result answers only
1186
+ // the executor's returns its own arguments leave reachable.
1187
+ const byArguments = this.returnNarrowedByArguments(func, this.unwrapPromiseType(returnType));
1188
+ if (byArguments?.type)
1189
+ returnType = byArguments.type;
1078
1190
  let typeString = typeText(returnType, func);
1079
1191
  /** Reasons for any `any`/`unknown` this inference ends up publishing. */
1080
1192
  let provenance;
@@ -1216,6 +1328,9 @@ export class TypeInferrer {
1216
1328
  if (provenance && provenance.length > 0) {
1217
1329
  inferred.any_provenance = provenance;
1218
1330
  }
1331
+ if (byArguments && !byArguments.type && byArguments.tested.length > 0) {
1332
+ this.addArgumentReads(inferred, byArguments.tested);
1333
+ }
1219
1334
  // The relation is asked only of the function the row's own line names.
1220
1335
  // A locator that binds inside a callback of the handler (`user` in
1221
1336
  // `this.users.find((user) => user.id === id)`) reaches this with that
@@ -1538,7 +1653,12 @@ export class TypeInferrer {
1538
1653
  'the framework handed the handler; it states no body');
1539
1654
  return null;
1540
1655
  }
1541
- const payloadType = payloadNode.getType();
1656
+ // carrick#2372: a located call into an executor the route shares answers
1657
+ // only the executor's returns this call's arguments leave reachable.
1658
+ const byArguments = Node.isCallExpression(payloadNode)
1659
+ ? this.callNarrowedByArguments(payloadNode, this.unwrapPromiseType(payloadNode.getType()))
1660
+ : undefined;
1661
+ const payloadType = byArguments?.type ?? payloadNode.getType();
1542
1662
  let typeString = typeText(payloadType, payloadNode);
1543
1663
  const unwrapResult = this.unwrapTypeWithConfig(payloadType, payloadNode, extractionConfig);
1544
1664
  if (unwrapResult.wasUnwrapped) {
@@ -1571,6 +1691,9 @@ export class TypeInferrer {
1571
1691
  this.relateModelSymbol(request, inferred, [
1572
1692
  unwrapResult.wasUnwrapped ? unwrapResult.payloadType : this.unwrapPromiseType(payloadType),
1573
1693
  ]);
1694
+ if (byArguments && !byArguments.type && byArguments.tested.length > 0) {
1695
+ this.addArgumentReads(inferred, byArguments.tested);
1696
+ }
1574
1697
  return inferred;
1575
1698
  }
1576
1699
  /**
@@ -1956,7 +2079,7 @@ export class TypeInferrer {
1956
2079
  return undefined;
1957
2080
  branches = returnedBranches;
1958
2081
  }
1959
- const survivors = [];
2082
+ let survivors = [];
1960
2083
  for (const branch of branches) {
1961
2084
  const status = branch === locatedBranch ? siteStatus : this.responseSiteStatus(branch, true);
1962
2085
  if (status === 'variable') {
@@ -1969,12 +2092,29 @@ export class TypeInferrer {
1969
2092
  continue;
1970
2093
  survivors.push(branch);
1971
2094
  }
2095
+ // carrick#2372: the sends sit in an executor the route's handler calls,
2096
+ // and other routes may call it with other arguments. Keep only the sends
2097
+ // this route's arguments leave reachable.
2098
+ const registered = this.registrationAtLine(sourceFile, request.line_number)?.handler;
2099
+ const routeCall = registered && registered !== func ? callInto(registered, func) : undefined;
2100
+ let argumentReads = [];
2101
+ let narrowed = false;
2102
+ if (routeCall && survivors.length >= 2) {
2103
+ const narrowing = narrowByArguments(func, routeCall, survivors);
2104
+ argumentReads = narrowing.tested;
2105
+ if (narrowing.kept.length > 0 && narrowing.kept.length < survivors.length) {
2106
+ this.log(`Response sends at ${request.file_path}:${request.line_number} narrowed by the ` +
2107
+ `arguments the route passes its executor: ${narrowing.kept.length} of ${survivors.length} kept`);
2108
+ survivors = narrowing.kept;
2109
+ narrowed = true;
2110
+ }
2111
+ }
1972
2112
  // carrick#2463 (D2): an untied row claims "no success payload" only when
1973
2113
  // the function it reads keeps a send after the error sends are dropped.
1974
2114
  if (!tied && survivors.length === 0)
1975
2115
  return undefined;
1976
2116
  const locatedDropped = dropped(siteStatus);
1977
- if (!locatedDropped && survivors.length <= 1)
2117
+ if (!locatedDropped && survivors.length <= 1 && !narrowed)
1978
2118
  return undefined;
1979
2119
  const recovered = survivors.length > 0
1980
2120
  ? this.recoverPayloadFromResponseExpressions(survivors, false, this.wireFormatFor(request))
@@ -1983,7 +2123,7 @@ export class TypeInferrer {
1983
2123
  if (recovered) {
1984
2124
  this.log(`Response locator at ${request.file_path}:${request.line_number} names an error ` +
1985
2125
  'or redirect send; publishing the success sends of its handler instead');
1986
- return this.inferredFromRecoveredPayload(request, recovered);
2126
+ return this.withArgumentReads(this.inferredFromRecoveredPayload(request, recovered), recovered, argumentReads);
1987
2127
  }
1988
2128
  this.log(`Response locator at ${request.file_path}:${request.line_number} names an error ` +
1989
2129
  'or redirect send and its handler sends no success body; abstaining');
@@ -1995,11 +2135,92 @@ export class TypeInferrer {
1995
2135
  'or carries no body a JSON contract can describe, so it publishes no success body',
1996
2136
  });
1997
2137
  }
1998
- if (recovered && recovered.nodes.some((node) => contains(site, node))) {
1999
- return this.inferredFromRecoveredPayload(request, recovered);
2138
+ if (recovered && (narrowed || recovered.nodes.some((node) => contains(site, node)))) {
2139
+ return this.withArgumentReads(this.inferredFromRecoveredPayload(request, recovered), recovered, argumentReads);
2000
2140
  }
2001
2141
  return undefined;
2002
2142
  }
2143
+ /**
2144
+ * carrick#2372: what `func` returns when it returns one call into a
2145
+ * function of the program: see `callNarrowedByArguments`.
2146
+ */
2147
+ returnNarrowedByArguments(func, awaited) {
2148
+ const returned = this.returnedExpressions(func);
2149
+ if (returned.length !== 1)
2150
+ return undefined;
2151
+ let expression = this.peelTransparentExpression(returned[0]);
2152
+ if (Node.isAwaitExpression(expression))
2153
+ expression = this.peelTransparentExpression(expression.getExpression());
2154
+ if (!Node.isCallExpression(expression))
2155
+ return undefined;
2156
+ return this.callNarrowedByArguments(expression, awaited, func);
2157
+ }
2158
+ /**
2159
+ * carrick#2372: the one member of `awaited` (the awaited result type of
2160
+ * `call`) the called function's returns can give for the arguments `call`
2161
+ * passes, and the parameters the callee tests that those arguments state.
2162
+ * `undefined` when `call` runs no function of the program (or runs
2163
+ * `caller` itself), or its result is not a union.
2164
+ *
2165
+ * Each kept return is matched to the union members it is assignable to; a
2166
+ * return that matches none (another union, a call) keeps every member, as
2167
+ * does a narrowing that leaves more than one member.
2168
+ */
2169
+ callNarrowedByArguments(call, awaited, caller) {
2170
+ if (!awaited.isUnion())
2171
+ return undefined;
2172
+ const callee = calledFunction(call);
2173
+ if (!callee || callee === caller)
2174
+ return undefined;
2175
+ const bodies = this.returnedExpressions(callee).flatMap((body) => this.expandResponseBranches(body, 0));
2176
+ if (bodies.length === 0)
2177
+ return undefined;
2178
+ const narrowing = narrowByArguments(callee, call, bodies);
2179
+ const unchanged = { tested: narrowing.tested };
2180
+ if (narrowing.kept.length === 0 || narrowing.kept.length === bodies.length)
2181
+ return unchanged;
2182
+ const checker = this.project.getTypeChecker().compilerObject;
2183
+ const members = awaited.getUnionTypes();
2184
+ const kept = new Set();
2185
+ for (const body of narrowing.kept) {
2186
+ const bodyType = this.unwrapPromiseType(body.getType());
2187
+ const matches = members.filter((member) => checker.isTypeAssignableTo(bodyType.compilerType, member.compilerType));
2188
+ if (matches.length === 0)
2189
+ return unchanged;
2190
+ for (const member of matches)
2191
+ kept.add(member);
2192
+ }
2193
+ if (kept.size !== 1)
2194
+ return unchanged;
2195
+ const [type] = kept;
2196
+ this.log(`Call at ${call.getSourceFile().getFilePath()}:${call.getStartLineNumber()} narrowed by the ` +
2197
+ `arguments it passes: ${narrowing.kept.length} of ${bodies.length} returns kept`);
2198
+ return { type, tested: narrowing.tested };
2199
+ }
2200
+ /**
2201
+ * carrick#2372: a union read from an executor whose bodies depend on
2202
+ * arguments the route passes, where those arguments could not tell the
2203
+ * bodies apart. Each such parameter is listed as an `argument` read, so a
2204
+ * mismatch against the union is not reported as this route's: no call can
2205
+ * say which body the route sends.
2206
+ */
2207
+ withArgumentReads(inferred, recovered, reads) {
2208
+ if (reads.length === 0 || (recovered?.readTypes?.length ?? 0) < 2)
2209
+ return inferred;
2210
+ return this.addArgumentReads(inferred, reads);
2211
+ }
2212
+ addArgumentReads(inferred, reads) {
2213
+ const merged = new Map();
2214
+ for (const read of inferred.response_modes?.reads ?? [])
2215
+ merged.set(`${read.location}\u0000${read.field}`, read);
2216
+ for (const field of reads)
2217
+ merged.set(`argument\u0000${field}`, { location: 'argument', field });
2218
+ const sorted = [...merged.values()].sort((a, b) => a.location === b.location ? a.field.localeCompare(b.field) : a.location.localeCompare(b.location));
2219
+ // Cases read off the incoming message no longer pick one body: an
2220
+ // argument the route passes also decides it.
2221
+ inferred.response_modes = { reads: sorted };
2222
+ return inferred;
2223
+ }
2003
2224
  /**
2004
2225
  * The response sends `func` makes as statements (`res.status(409).json(e);`),
2005
2226
  * for a handler that sends through a parameter and returns nothing. Only the
@@ -439,10 +439,22 @@ export interface RetypePrescreenRequest extends BaseRequest {
439
439
  action: 'retype_prescreen';
440
440
  items: RetypeLocatorItem[];
441
441
  }
442
- /** One call's prescreen: `reason` when the retype abstains before any rewrite. */
442
+ /**
443
+ * One call's prescreen: `reason` when the retype abstains before any rewrite.
444
+ * `fresh_type_reason` (carrick#3158) is the retype's "does not reach" reason
445
+ * for any stated type that is a new object type: the type argument it fills
446
+ * appears in the result only as a conditional's selector. The caller applies
447
+ * it only when the producer's type is such a type; it is never set beside
448
+ * `reason`.
449
+ * `undefined_free_reason` (carrick#3165) is the same sentence for a call whose
450
+ * result is deferred: it holds for any stated type with no top-level
451
+ * `undefined`, and quotes the call's own result. Never set beside either.
452
+ */
443
453
  export interface RetypePrescreen {
444
454
  item_id: string;
445
455
  reason?: string;
456
+ fresh_type_reason?: string;
457
+ undefined_free_reason?: string;
446
458
  }
447
459
  export interface RetypePrescreenResponse extends BaseResponse {
448
460
  /** One per item, in request order. */
@@ -870,6 +882,14 @@ export interface InferRequestItem {
870
882
  * part that holds the response body. Read for `call_result`.
871
883
  */
872
884
  result?: ResultLabel;
885
+ /**
886
+ * carrick#1029: the route row's own path, sent on a `response_body`,
887
+ * `function_return` or `request_body` request when the row's line serves
888
+ * more than one route. A
889
+ * handler registered once per element of a constant list is typed for the
890
+ * element this path names (`loop-element.ts`).
891
+ */
892
+ route_path?: string;
873
893
  }
874
894
  /**
875
895
  * Response status
@@ -77,6 +77,7 @@ export declare const InferRequestItemSchema: z.ZodObject<{
77
77
  }, {
78
78
  parse: string;
79
79
  }>]>>;
80
+ route_path: z.ZodOptional<z.ZodString>;
80
81
  }, "strip", z.ZodTypeAny, {
81
82
  file_path: string;
82
83
  line_number: number;
@@ -95,6 +96,7 @@ export declare const InferRequestItemSchema: z.ZodObject<{
95
96
  span_end?: number | undefined;
96
97
  expression_text?: string | undefined;
97
98
  expression_line?: number | undefined;
99
+ route_path?: string | undefined;
98
100
  }, {
99
101
  file_path: string;
100
102
  line_number: number;
@@ -113,6 +115,7 @@ export declare const InferRequestItemSchema: z.ZodObject<{
113
115
  span_end?: number | undefined;
114
116
  expression_text?: string | undefined;
115
117
  expression_line?: number | undefined;
118
+ route_path?: string | undefined;
116
119
  }>;
117
120
  /**
118
121
  * Per-item locator validation for infer requests.
@@ -778,6 +781,7 @@ export declare const InferRequestSchema: z.ZodObject<{
778
781
  }, {
779
782
  parse: string;
780
783
  }>]>>;
784
+ route_path: z.ZodOptional<z.ZodString>;
781
785
  }, "strip", z.ZodTypeAny, {
782
786
  file_path: string;
783
787
  line_number: number;
@@ -796,6 +800,7 @@ export declare const InferRequestSchema: z.ZodObject<{
796
800
  span_end?: number | undefined;
797
801
  expression_text?: string | undefined;
798
802
  expression_line?: number | undefined;
803
+ route_path?: string | undefined;
799
804
  }, {
800
805
  file_path: string;
801
806
  line_number: number;
@@ -814,6 +819,7 @@ export declare const InferRequestSchema: z.ZodObject<{
814
819
  span_end?: number | undefined;
815
820
  expression_text?: string | undefined;
816
821
  expression_line?: number | undefined;
822
+ route_path?: string | undefined;
817
823
  }>, "many">;
818
824
  extraction_config: z.ZodOptional<z.ZodObject<{
819
825
  rules: z.ZodArray<z.ZodObject<{
@@ -912,6 +918,7 @@ export declare const InferRequestSchema: z.ZodObject<{
912
918
  span_end?: number | undefined;
913
919
  expression_text?: string | undefined;
914
920
  expression_line?: number | undefined;
921
+ route_path?: string | undefined;
915
922
  }[];
916
923
  extraction_config?: {
917
924
  rules: {
@@ -956,6 +963,7 @@ export declare const InferRequestSchema: z.ZodObject<{
956
963
  span_end?: number | undefined;
957
964
  expression_text?: string | undefined;
958
965
  expression_line?: number | undefined;
966
+ route_path?: string | undefined;
959
967
  }[];
960
968
  extraction_config?: {
961
969
  rules: {
@@ -1043,8 +1051,8 @@ export declare const ReachRequestSchema: z.ZodObject<{
1043
1051
  w: z.ZodArray<z.ZodNumber, "many">;
1044
1052
  s: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodArray<z.ZodNumber, "many">, z.ZodArray<z.ZodNumber, "many">], null>, "many">;
1045
1053
  }, "strip", z.ZodTypeAny, {
1046
- s: [number, number[], number[]][];
1047
1054
  b: [number, number, number[]][];
1055
+ s: [number, number[], number[]][];
1048
1056
  p: number;
1049
1057
  g: 0 | 1;
1050
1058
  d: number[];
@@ -1054,8 +1062,8 @@ export declare const ReachRequestSchema: z.ZodObject<{
1054
1062
  t: number[][];
1055
1063
  w: number[];
1056
1064
  }, {
1057
- s: [number, number[], number[]][];
1058
1065
  b: [number, number, number[]][];
1066
+ s: [number, number[], number[]][];
1059
1067
  p: number;
1060
1068
  g: 0 | 1;
1061
1069
  d: number[];
@@ -1068,8 +1076,8 @@ export declare const ReachRequestSchema: z.ZodObject<{
1068
1076
  }, "strip", z.ZodTypeAny, {
1069
1077
  version: 1;
1070
1078
  files: {
1071
- s: [number, number[], number[]][];
1072
1079
  b: [number, number, number[]][];
1080
+ s: [number, number[], number[]][];
1073
1081
  p: number;
1074
1082
  g: 0 | 1;
1075
1083
  d: number[];
@@ -1083,8 +1091,8 @@ export declare const ReachRequestSchema: z.ZodObject<{
1083
1091
  }, {
1084
1092
  version: 1;
1085
1093
  files: {
1086
- s: [number, number[], number[]][];
1087
1094
  b: [number, number, number[]][];
1095
+ s: [number, number[], number[]][];
1088
1096
  p: number;
1089
1097
  g: 0 | 1;
1090
1098
  d: number[];
@@ -1115,8 +1123,8 @@ export declare const ReachRequestSchema: z.ZodObject<{
1115
1123
  graph: {
1116
1124
  version: 1;
1117
1125
  files: {
1118
- s: [number, number[], number[]][];
1119
1126
  b: [number, number, number[]][];
1127
+ s: [number, number[], number[]][];
1120
1128
  p: number;
1121
1129
  g: 0 | 1;
1122
1130
  d: number[];
@@ -1139,8 +1147,8 @@ export declare const ReachRequestSchema: z.ZodObject<{
1139
1147
  graph: {
1140
1148
  version: 1;
1141
1149
  files: {
1142
- s: [number, number[], number[]][];
1143
1150
  b: [number, number, number[]][];
1151
+ s: [number, number[], number[]][];
1144
1152
  p: number;
1145
1153
  g: 0 | 1;
1146
1154
  d: number[];
@@ -4322,6 +4330,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
4322
4330
  }, {
4323
4331
  parse: string;
4324
4332
  }>]>>;
4333
+ route_path: z.ZodOptional<z.ZodString>;
4325
4334
  }, "strip", z.ZodTypeAny, {
4326
4335
  file_path: string;
4327
4336
  line_number: number;
@@ -4340,6 +4349,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
4340
4349
  span_end?: number | undefined;
4341
4350
  expression_text?: string | undefined;
4342
4351
  expression_line?: number | undefined;
4352
+ route_path?: string | undefined;
4343
4353
  }, {
4344
4354
  file_path: string;
4345
4355
  line_number: number;
@@ -4358,6 +4368,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
4358
4368
  span_end?: number | undefined;
4359
4369
  expression_text?: string | undefined;
4360
4370
  expression_line?: number | undefined;
4371
+ route_path?: string | undefined;
4361
4372
  }>, "many">;
4362
4373
  extraction_config: z.ZodOptional<z.ZodObject<{
4363
4374
  rules: z.ZodArray<z.ZodObject<{
@@ -4456,6 +4467,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
4456
4467
  span_end?: number | undefined;
4457
4468
  expression_text?: string | undefined;
4458
4469
  expression_line?: number | undefined;
4470
+ route_path?: string | undefined;
4459
4471
  }[];
4460
4472
  extraction_config?: {
4461
4473
  rules: {
@@ -4500,6 +4512,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
4500
4512
  span_end?: number | undefined;
4501
4513
  expression_text?: string | undefined;
4502
4514
  expression_line?: number | undefined;
4515
+ route_path?: string | undefined;
4503
4516
  }[];
4504
4517
  extraction_config?: {
4505
4518
  rules: {
@@ -7005,8 +7018,8 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
7005
7018
  w: z.ZodArray<z.ZodNumber, "many">;
7006
7019
  s: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodArray<z.ZodNumber, "many">, z.ZodArray<z.ZodNumber, "many">], null>, "many">;
7007
7020
  }, "strip", z.ZodTypeAny, {
7008
- s: [number, number[], number[]][];
7009
7021
  b: [number, number, number[]][];
7022
+ s: [number, number[], number[]][];
7010
7023
  p: number;
7011
7024
  g: 0 | 1;
7012
7025
  d: number[];
@@ -7016,8 +7029,8 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
7016
7029
  t: number[][];
7017
7030
  w: number[];
7018
7031
  }, {
7019
- s: [number, number[], number[]][];
7020
7032
  b: [number, number, number[]][];
7033
+ s: [number, number[], number[]][];
7021
7034
  p: number;
7022
7035
  g: 0 | 1;
7023
7036
  d: number[];
@@ -7030,8 +7043,8 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
7030
7043
  }, "strip", z.ZodTypeAny, {
7031
7044
  version: 1;
7032
7045
  files: {
7033
- s: [number, number[], number[]][];
7034
7046
  b: [number, number, number[]][];
7047
+ s: [number, number[], number[]][];
7035
7048
  p: number;
7036
7049
  g: 0 | 1;
7037
7050
  d: number[];
@@ -7045,8 +7058,8 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
7045
7058
  }, {
7046
7059
  version: 1;
7047
7060
  files: {
7048
- s: [number, number[], number[]][];
7049
7061
  b: [number, number, number[]][];
7062
+ s: [number, number[], number[]][];
7050
7063
  p: number;
7051
7064
  g: 0 | 1;
7052
7065
  d: number[];
@@ -7077,8 +7090,8 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
7077
7090
  graph: {
7078
7091
  version: 1;
7079
7092
  files: {
7080
- s: [number, number[], number[]][];
7081
7093
  b: [number, number, number[]][];
7094
+ s: [number, number[], number[]][];
7082
7095
  p: number;
7083
7096
  g: 0 | 1;
7084
7097
  d: number[];
@@ -7101,8 +7114,8 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
7101
7114
  graph: {
7102
7115
  version: 1;
7103
7116
  files: {
7104
- s: [number, number[], number[]][];
7105
7117
  b: [number, number, number[]][];
7118
+ s: [number, number[], number[]][];
7106
7119
  p: number;
7107
7120
  g: 0 | 1;
7108
7121
  d: number[];
@@ -106,6 +106,8 @@ export const InferRequestItemSchema = z.object({
106
106
  member: z.string().optional(),
107
107
  // The library store's label for the call's result (carrick#2818).
108
108
  result: ResultLabelSchema.optional(),
109
+ // The route row's own path, sent where its line serves several (carrick#1029).
110
+ route_path: z.string().min(1).optional(),
109
111
  });
110
112
  /**
111
113
  * Per-item locator validation for infer requests.
@@ -48,7 +48,7 @@ floor and the basis in the answer you got.
48
48
  ## Audit: the whole project
49
49
 
50
50
  ```
51
- find_similar({{SCOPE}})
51
+ find_similar({{SCOPE}}, audit: true)
52
52
  ```
53
53
 
54
54
  `clusters` groups functions that describe the same behaviour, ordered by size.