carrick 0.3.107 → 0.3.109

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 (40) hide show
  1. package/package.json +9 -10
  2. package/plugin/.claude-plugin/plugin.json +1 -1
  3. package/sidecar/dist/src/capture/api.d.ts +15 -0
  4. package/sidecar/dist/src/capture/check-classify.d.ts +9 -0
  5. package/sidecar/dist/src/capture/check-classify.js +20 -0
  6. package/sidecar/dist/src/capture/check-deep.js +2 -1
  7. package/sidecar/dist/src/capture/check-fields.d.ts +24 -0
  8. package/sidecar/dist/src/capture/check-fields.js +54 -36
  9. package/sidecar/dist/src/capture/check-union.d.ts +40 -0
  10. package/sidecar/dist/src/capture/check-union.js +92 -0
  11. package/sidecar/dist/src/capture/check-workspace.d.ts +1 -0
  12. package/sidecar/dist/src/capture/check-workspace.js +13 -2
  13. package/sidecar/dist/src/capture/check.js +5 -0
  14. package/sidecar/dist/src/capture/compiler-options.d.ts +39 -0
  15. package/sidecar/dist/src/capture/compiler-options.js +100 -0
  16. package/sidecar/dist/src/capture/deno-project.js +3 -2
  17. package/sidecar/dist/src/capture/index.d.ts +1 -0
  18. package/sidecar/dist/src/capture/index.js +90 -48
  19. package/sidecar/dist/src/capture/installed-package.js +3 -2
  20. package/sidecar/dist/src/capture/self-check.js +3 -2
  21. package/sidecar/dist/src/definition-resolver.d.ts +5 -8
  22. package/sidecar/dist/src/definition-resolver.js +8 -9
  23. package/sidecar/dist/src/index.js +124 -11
  24. package/sidecar/dist/src/infer-timing.d.ts +54 -0
  25. package/sidecar/dist/src/infer-timing.js +124 -0
  26. package/sidecar/dist/src/print-type.d.ts +48 -0
  27. package/sidecar/dist/src/print-type.js +71 -0
  28. package/sidecar/dist/src/printed-names.js +2 -1
  29. package/sidecar/dist/src/program-files.d.ts +44 -0
  30. package/sidecar/dist/src/program-files.js +64 -0
  31. package/sidecar/dist/src/project-loader.d.ts +5 -0
  32. package/sidecar/dist/src/project-loader.js +14 -5
  33. package/sidecar/dist/src/retype.d.ts +4 -2
  34. package/sidecar/dist/src/retype.js +16 -5
  35. package/sidecar/dist/src/type-inferrer.d.ts +157 -1
  36. package/sidecar/dist/src/type-inferrer.js +444 -20
  37. package/sidecar/dist/src/types.d.ts +104 -2
  38. package/sidecar/dist/src/validators.d.ts +166 -80
  39. package/sidecar/dist/src/validators.js +13 -0
  40. package/templates/skills/carrick-reuse.md +6 -5
@@ -206,6 +206,22 @@ export interface HealthRequest extends BaseRequest {
206
206
  export interface ShutdownRequest extends BaseRequest {
207
207
  action: 'shutdown';
208
208
  }
209
+ /**
210
+ * List the root files the init'd project's program was built from, in order
211
+ * (carrick#2027).
212
+ */
213
+ export interface ListProgramFilesRequest extends BaseRequest {
214
+ action: 'list_program_files';
215
+ }
216
+ /**
217
+ * Add files to the programs that type them, in the given order
218
+ * (carrick#2027).
219
+ */
220
+ export interface AddProgramFilesRequest extends BaseRequest {
221
+ action: 'add_program_files';
222
+ /** Absolute paths, or relative to the init'd root. */
223
+ files: string[];
224
+ }
209
225
  /**
210
226
  * Request to resolve type definitions from a v2 capture stub package.
211
227
  * Returns both the original declaration and the compiler-expanded form for
@@ -461,7 +477,7 @@ export interface ListLibrarySurfaceRequest extends BaseRequest {
461
477
  /**
462
478
  * Union type for all possible sidecar requests
463
479
  */
464
- export type SidecarRequest = RetypeCheckRequest | VerifyClientSemanticsRequest | VerifyLibraryClaimsRequest | ListLibrarySurfaceRequest | InitRequest | BundleRequest | CaptureV2Request | CheckV2Request | InferRequest | ResolveDefinitionsRequest | HealthRequest | ShutdownRequest;
480
+ export type SidecarRequest = RetypeCheckRequest | VerifyClientSemanticsRequest | VerifyLibraryClaimsRequest | ListLibrarySurfaceRequest | InitRequest | BundleRequest | CaptureV2Request | CheckV2Request | InferRequest | ResolveDefinitionsRequest | HealthRequest | ShutdownRequest | ListProgramFilesRequest | AddProgramFilesRequest;
465
481
  /**
466
482
  * Request for a specific symbol to be bundled
467
483
  */
@@ -542,9 +558,77 @@ export interface BundleResponse extends BaseResponse {
542
558
  export interface InferResponse extends BaseResponse {
543
559
  /** Successfully inferred types */
544
560
  inferred_types?: InferredType[];
561
+ /** How long the requests took, and which were slowest (carrick#1985) */
562
+ infer_timing?: InferTiming;
545
563
  /** General errors */
546
564
  errors?: string[];
547
565
  }
566
+ /**
567
+ * How long one request of an `infer` batch took (carrick#1985).
568
+ *
569
+ * It names the request and measures its answer. It never holds the answer:
570
+ * the type a request printed is here as a length only.
571
+ */
572
+ export interface InferSlotTiming {
573
+ /** The alias the request carried, when it carried one */
574
+ alias?: string;
575
+ /** The file the request named, as it named it */
576
+ file_path: string;
577
+ /** The line the request named */
578
+ line_number: number;
579
+ /** The kind of inference the request asked for */
580
+ infer_kind: InferKind;
581
+ /**
582
+ * Wall time, in milliseconds, from the batch taking the request up to it
583
+ * keeping the request's answer or its error.
584
+ */
585
+ ms: number;
586
+ /**
587
+ * Of `ms`, the time in the compiler call that computes the type: a
588
+ * function's `getReturnType()`, a parameter's `getType()`. It is told
589
+ * apart for `signature_return` and `function_param`, and is 0 for the
590
+ * other kinds, whose time in the compiler stays in `ms` alone.
591
+ */
592
+ type_ms: number;
593
+ /**
594
+ * Of `ms`, the time in the inferrer's print of a type to text. Truncation
595
+ * is off, so a type is printed at its whole length. For
596
+ * `signature_return` and `function_param` this is every print the request
597
+ * makes; the other kinds also print through the structural expander, and
598
+ * that time stays in `ms` alone.
599
+ */
600
+ print_ms: number;
601
+ /** Characters in the `type_string` the request printed; 0 when it printed none */
602
+ printed_length: number;
603
+ /**
604
+ * No earlier request named this file to the project that answered. Such a
605
+ * request does the work the file's later ones reuse: the index of the
606
+ * file's functions, and every type the checker resolves on the way that it
607
+ * had not resolved before.
608
+ */
609
+ first_in_file: boolean;
610
+ }
611
+ /**
612
+ * The timing of the requests of one `infer` batch (carrick#1985).
613
+ */
614
+ export interface InferTiming {
615
+ /** Requests the batch was done with: answered, refused, skipped or failed */
616
+ slots: number;
617
+ /** Their wall times, added up, in milliseconds */
618
+ slots_ms: number;
619
+ /** Of `slots_ms`, the time computing types (each request's `type_ms`) */
620
+ type_ms: number;
621
+ /** Of `slots_ms`, the time printing types (each request's `print_ms`) */
622
+ print_ms: number;
623
+ /** How many of them were the first asked of their file */
624
+ first_in_file_slots: number;
625
+ /** The wall times of those, added up, in milliseconds */
626
+ first_in_file_ms: number;
627
+ /** The slowest requests, slowest first: `SLOWEST_SLOTS` of them at most */
628
+ slowest: InferSlotTiming[];
629
+ /** The request that printed the longest type; absent when none printed one */
630
+ longest_printed?: InferSlotTiming;
631
+ }
548
632
  /**
549
633
  * Response for resolve_definitions action
550
634
  */
@@ -577,6 +661,22 @@ export interface HealthResponse extends BaseResponse {
577
661
  export interface ShutdownResponse extends BaseResponse {
578
662
  status: 'success';
579
663
  }
664
+ /**
665
+ * Response for list_program_files action
666
+ */
667
+ export interface ListProgramFilesResponse extends BaseResponse {
668
+ /** The program's root files, as absolute paths, in order. */
669
+ files?: string[];
670
+ errors?: string[];
671
+ }
672
+ /**
673
+ * Response for add_program_files action
674
+ */
675
+ export interface AddProgramFilesResponse extends BaseResponse {
676
+ /** How many of the given files were added. */
677
+ added?: number;
678
+ errors?: string[];
679
+ }
580
680
  /**
581
681
  * Error response
582
682
  */
@@ -717,7 +817,7 @@ export interface ListLibrarySurfaceResponse extends BaseResponse {
717
817
  /**
718
818
  * Union type for all possible sidecar responses
719
819
  */
720
- export type SidecarResponse = RetypeCheckResponse | VerifyClientSemanticsResponse | VerifyLibraryClaimsResponse | ListLibrarySurfaceResponse | InitResponse | BundleResponse | CaptureV2Response | CheckV2Response | InferResponse | ResolveDefinitionsResponse | HealthResponse | ShutdownResponse | ErrorResponse;
820
+ export type SidecarResponse = RetypeCheckResponse | VerifyClientSemanticsResponse | VerifyLibraryClaimsResponse | ListLibrarySurfaceResponse | InitResponse | BundleResponse | CaptureV2Response | CheckV2Response | InferResponse | ResolveDefinitionsResponse | HealthResponse | ShutdownResponse | ListProgramFilesResponse | AddProgramFilesResponse | ErrorResponse;
721
821
  /**
722
822
  * An entry in the type manifest
723
823
  */
@@ -934,6 +1034,8 @@ export interface InferResult {
934
1034
  success: boolean;
935
1035
  /** Successfully inferred types */
936
1036
  inferred_types?: InferredType[];
1037
+ /** How long each request took, summed up (carrick#1985) */
1038
+ timing: InferTiming;
937
1039
  /** General error messages */
938
1040
  errors?: string[];
939
1041
  }