carrick 0.3.124 → 0.3.126

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 (29) hide show
  1. package/package.json +6 -6
  2. package/plugin/.claude-plugin/plugin.json +1 -1
  3. package/sidecar/dist/src/capture/api.d.ts +5 -1
  4. package/sidecar/dist/src/capture/check-classify.js +11 -5
  5. package/sidecar/dist/src/capture/check.js +8 -1
  6. package/sidecar/dist/src/capture/deep-walk.d.ts +31 -0
  7. package/sidecar/dist/src/capture/deep-walk.js +43 -1
  8. package/sidecar/dist/src/capture/deno-project.d.ts +7 -0
  9. package/sidecar/dist/src/capture/deno-project.js +7 -0
  10. package/sidecar/dist/src/capture/index.d.ts +1 -1
  11. package/sidecar/dist/src/capture/index.js +1 -1
  12. package/sidecar/dist/src/capture/service-config.d.ts +11 -0
  13. package/sidecar/dist/src/capture/service-config.js +40 -0
  14. package/sidecar/dist/src/declaration-attribution.d.ts +11 -0
  15. package/sidecar/dist/src/declaration-attribution.js +16 -0
  16. package/sidecar/dist/src/implementations.d.ts +43 -0
  17. package/sidecar/dist/src/implementations.js +224 -0
  18. package/sidecar/dist/src/index.js +35 -1
  19. package/sidecar/dist/src/library-claims.d.ts +17 -2
  20. package/sidecar/dist/src/library-claims.js +242 -47
  21. package/sidecar/dist/src/position-rows.d.ts +119 -1
  22. package/sidecar/dist/src/position-rows.js +163 -9
  23. package/sidecar/dist/src/project-loader.d.ts +31 -0
  24. package/sidecar/dist/src/project-loader.js +67 -4
  25. package/sidecar/dist/src/type-inferrer.d.ts +150 -16
  26. package/sidecar/dist/src/type-inferrer.js +651 -94
  27. package/sidecar/dist/src/types.d.ts +46 -2
  28. package/sidecar/dist/src/validators.d.ts +73 -0
  29. package/sidecar/dist/src/validators.js +10 -0
@@ -271,6 +271,43 @@ export interface PositionRowsRequest extends BaseRequest {
271
271
  /** The service the rows are for, written in the header. */
272
272
  service: string;
273
273
  }
274
+ /**
275
+ * The implementations of the bodyless declarations some calls go through
276
+ * (carrick#2432 slice B), asked of the analysis process: one batch per
277
+ * service.
278
+ */
279
+ export interface ImplementationsRequest extends BaseRequest {
280
+ action: 'implementations';
281
+ /** One question per call, each the span of its `call` (or `member`) position row. */
282
+ queries: ImplementationsQuery[];
283
+ /** The scanned repo's root: every name in an answer is relative to it. */
284
+ scan_root: string;
285
+ }
286
+ export interface ImplementationsQuery {
287
+ /** Absolute path of the file holding the call. */
288
+ file: string;
289
+ /** The row's span: UTF-16 code units from the start of the file. */
290
+ start: number;
291
+ end: number;
292
+ }
293
+ /** A declaration as a position row names one. */
294
+ export interface NamedDeclaration {
295
+ symbol: string | null;
296
+ decl_file: string | null;
297
+ decl_line: number | null;
298
+ decl_package: string | null;
299
+ }
300
+ /** Why an answer names no implementation, where it is not because there is none. */
301
+ export type ImplementationsReason = 'not_in_program' | 'no_call' | 'no_symbol' | 'no_declaration' | 'has_body' | 'checker_threw';
302
+ export interface ImplementationsAnswer {
303
+ /** The declaration the call goes through, as its row names it. */
304
+ declaration: NamedDeclaration | null;
305
+ /** By file, then position; empty when `too_many`. */
306
+ implementations: NamedDeclaration[];
307
+ /** More than the cap (16) were found, and none is listed. */
308
+ too_many: boolean;
309
+ reason?: ImplementationsReason;
310
+ }
274
311
  /**
275
312
  * Request to resolve type definitions from a v2 capture stub package.
276
313
  * Returns both the original declaration and the compiler-expanded form for
@@ -585,7 +622,7 @@ export interface ListLibrarySurfaceRequest extends BaseRequest {
585
622
  /**
586
623
  * Union type for all possible sidecar requests
587
624
  */
588
- export type SidecarRequest = RetypeCheckRequest | VerifyClientSemanticsRequest | VerifyLibraryClaimsRequest | ListLibrarySurfaceRequest | InitRequest | BundleRequest | CaptureV2Request | CheckV2Request | InferRequest | ResolveDefinitionsRequest | HealthRequest | ShutdownRequest | ListProgramFilesRequest | AddProgramFilesRequest | PositionRowsRequest;
625
+ export type SidecarRequest = RetypeCheckRequest | VerifyClientSemanticsRequest | VerifyLibraryClaimsRequest | ListLibrarySurfaceRequest | InitRequest | BundleRequest | CaptureV2Request | CheckV2Request | InferRequest | ResolveDefinitionsRequest | HealthRequest | ShutdownRequest | ListProgramFilesRequest | AddProgramFilesRequest | PositionRowsRequest | ImplementationsRequest;
589
626
  /**
590
627
  * Request for a specific symbol to be bundled
591
628
  */
@@ -775,6 +812,13 @@ export interface HealthResponse extends BaseResponse {
775
812
  export interface ShutdownResponse extends BaseResponse {
776
813
  status: 'success';
777
814
  }
815
+ /** Response for implementations: one answer per question, in request order. */
816
+ export interface ImplementationsResponse extends BaseResponse {
817
+ result?: {
818
+ answers: ImplementationsAnswer[];
819
+ };
820
+ errors?: string[];
821
+ }
778
822
  /** Response for position_rows: what was written, counted. */
779
823
  export interface PositionRowsResponse extends BaseResponse {
780
824
  result?: PositionRowsCounts;
@@ -962,7 +1006,7 @@ export interface ListLibrarySurfaceResponse extends BaseResponse {
962
1006
  /**
963
1007
  * Union type for all possible sidecar responses
964
1008
  */
965
- export type SidecarResponse = RetypeCheckResponse | VerifyClientSemanticsResponse | VerifyLibraryClaimsResponse | ListLibrarySurfaceResponse | InitResponse | BundleResponse | CaptureV2Response | CheckV2Response | InferResponse | ResolveDefinitionsResponse | HealthResponse | ShutdownResponse | ListProgramFilesResponse | AddProgramFilesResponse | PositionRowsResponse | ErrorResponse;
1009
+ export type SidecarResponse = RetypeCheckResponse | VerifyClientSemanticsResponse | VerifyLibraryClaimsResponse | ListLibrarySurfaceResponse | InitResponse | BundleResponse | CaptureV2Response | CheckV2Response | InferResponse | ResolveDefinitionsResponse | HealthResponse | ShutdownResponse | ListProgramFilesResponse | AddProgramFilesResponse | PositionRowsResponse | ImplementationsResponse | ErrorResponse;
966
1010
  /**
967
1011
  * An entry in the type manifest
968
1012
  */
@@ -848,6 +848,43 @@ export declare const PositionRowsRequestSchema: z.ZodObject<{
848
848
  scan_root: string;
849
849
  out_path: string;
850
850
  }>;
851
+ export declare const ImplementationsRequestSchema: z.ZodObject<{
852
+ request_id: z.ZodString;
853
+ } & {
854
+ action: z.ZodLiteral<"implementations">;
855
+ queries: z.ZodArray<z.ZodObject<{
856
+ file: z.ZodString;
857
+ start: z.ZodNumber;
858
+ end: z.ZodNumber;
859
+ }, "strip", z.ZodTypeAny, {
860
+ file: string;
861
+ end: number;
862
+ start: number;
863
+ }, {
864
+ file: string;
865
+ end: number;
866
+ start: number;
867
+ }>, "many">;
868
+ scan_root: z.ZodString;
869
+ }, "strip", z.ZodTypeAny, {
870
+ queries: {
871
+ file: string;
872
+ end: number;
873
+ start: number;
874
+ }[];
875
+ request_id: string;
876
+ action: "implementations";
877
+ scan_root: string;
878
+ }, {
879
+ queries: {
880
+ file: string;
881
+ end: number;
882
+ start: number;
883
+ }[];
884
+ request_id: string;
885
+ action: "implementations";
886
+ scan_root: string;
887
+ }>;
851
888
  export declare const ResolveDefinitionsRequestSchema: z.ZodObject<{
852
889
  request_id: z.ZodString;
853
890
  } & {
@@ -4506,6 +4543,42 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
4506
4543
  action: "position_rows";
4507
4544
  scan_root: string;
4508
4545
  out_path: string;
4546
+ }>, z.ZodObject<{
4547
+ request_id: z.ZodString;
4548
+ } & {
4549
+ action: z.ZodLiteral<"implementations">;
4550
+ queries: z.ZodArray<z.ZodObject<{
4551
+ file: z.ZodString;
4552
+ start: z.ZodNumber;
4553
+ end: z.ZodNumber;
4554
+ }, "strip", z.ZodTypeAny, {
4555
+ file: string;
4556
+ end: number;
4557
+ start: number;
4558
+ }, {
4559
+ file: string;
4560
+ end: number;
4561
+ start: number;
4562
+ }>, "many">;
4563
+ scan_root: z.ZodString;
4564
+ }, "strip", z.ZodTypeAny, {
4565
+ queries: {
4566
+ file: string;
4567
+ end: number;
4568
+ start: number;
4569
+ }[];
4570
+ request_id: string;
4571
+ action: "implementations";
4572
+ scan_root: string;
4573
+ }, {
4574
+ queries: {
4575
+ file: string;
4576
+ end: number;
4577
+ start: number;
4578
+ }[];
4579
+ request_id: string;
4580
+ action: "implementations";
4581
+ scan_root: string;
4509
4582
  }>]>;
4510
4583
  /**
4511
4584
  * Result type for parseRequest
@@ -277,6 +277,15 @@ export const PositionRowsRequestSchema = BaseRequestSchema.extend({
277
277
  out_path: z.string().min(1, 'Out path cannot be empty'),
278
278
  service: z.string(),
279
279
  });
280
+ export const ImplementationsRequestSchema = BaseRequestSchema.extend({
281
+ action: z.literal('implementations'),
282
+ queries: z.array(z.object({
283
+ file: z.string().min(1, 'File path cannot be empty'),
284
+ start: z.number().int().nonnegative(),
285
+ end: z.number().int().nonnegative(),
286
+ })),
287
+ scan_root: z.string().min(1, 'Scan root cannot be empty'),
288
+ });
280
289
  export const ResolveDefinitionsRequestSchema = BaseRequestSchema.extend({
281
290
  action: z.literal('resolve_definitions'),
282
291
  stub_dir: z.string().min(1, 'Stub dir cannot be empty'),
@@ -522,6 +531,7 @@ export const SidecarRequestSchema = z.discriminatedUnion('action', [
522
531
  ListProgramFilesRequestSchema,
523
532
  AddProgramFilesRequestSchema,
524
533
  PositionRowsRequestSchema,
534
+ ImplementationsRequestSchema,
525
535
  ]);
526
536
  /**
527
537
  * Validates and parses incoming JSON into a typed SidecarRequest