carrick 0.3.115 → 0.3.116

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.
@@ -194,6 +194,38 @@ export interface InferRequest extends BaseRequest {
194
194
  requests: InferRequestItem[];
195
195
  /** Agent-generated extraction config for machinery unwrapping */
196
196
  extraction_config?: ExtractionConfig;
197
+ /**
198
+ * carrick#2111: the type the model named for a producer's response, by the
199
+ * alias of the request that reads the same response. The inferrer answers
200
+ * how each relates to what it read (`InferredType.model_symbol_relation`).
201
+ */
202
+ model_symbols?: ModelSymbol[];
203
+ }
204
+ /** A type the model named for the row `alias` is for (carrick#2111). */
205
+ export interface ModelSymbol {
206
+ alias: string;
207
+ symbol_name: string;
208
+ /** The file the model says declares or exports it. */
209
+ source_file: string;
210
+ }
211
+ /**
212
+ * carrick#2111: how the type the model named for a producer's response
213
+ * relates to the compiler's type of what the handler sends. The compiler
214
+ * decides, by assignability both ways (`symbol-relation.ts`).
215
+ *
216
+ * Reported only where both resolve and the read holds no `any` or `unknown`.
217
+ * No entry means nothing was compared, and the model's symbol stands.
218
+ */
219
+ export interface ModelSymbolRelation {
220
+ /**
221
+ * `same`: one type. `list`: the read is a list of the symbol, `depth`
222
+ * levels. `member`: the symbol is one member of the read's union.
223
+ * `nullable`: the read is the symbol or `null`/`undefined`. `different`:
224
+ * anything else.
225
+ */
226
+ relation: 'same' | 'list' | 'member' | 'nullable' | 'different';
227
+ /** List levels of the read around the symbol; present for `list`. */
228
+ depth?: number;
197
229
  }
198
230
  /**
199
231
  * Health check request
@@ -940,6 +972,12 @@ export interface InferredType {
940
972
  * stated, or when the only annotation is further away than the read.
941
973
  */
942
974
  stated_body?: StatedBody;
975
+ /**
976
+ * carrick#2111, a producer's response read only: how the type the model
977
+ * named for this row relates to the type read here. Absent where the model
978
+ * named none, or nothing could be compared.
979
+ */
980
+ model_symbol_relation?: ModelSymbolRelation;
943
981
  /**
944
982
  * carrick#1836: the declarations behind the names `type_string` prints that
945
983
  * the request's file does not resolve. The printer writes names bare where
@@ -153,8 +153,30 @@ function isMarkableLiteral(node) {
153
153
  return false;
154
154
  if (Node.isTaggedTemplateExpression(parent))
155
155
  return false;
156
+ // Already kept narrow by the source (carrick#2343): marking it again writes
157
+ // `('warn' as const) as const`, which the compiler rejects (a const
158
+ // assertion applies to a literal only), and that one diagnostic would cost
159
+ // the whole reading.
160
+ if (isConstAssertionOperand(node))
161
+ return false;
156
162
  return !initialisesMutableBinding(node);
157
163
  }
164
+ /**
165
+ * Whether the literal, through any parentheses, is what a const assertion
166
+ * (`x as const`, `<const>x`) asserts. Any other assertion takes a marked
167
+ * literal: `('a' as const) as string` is valid.
168
+ */
169
+ function isConstAssertionOperand(literal) {
170
+ let node = literal;
171
+ let parent = node.getParent();
172
+ while (parent && Node.isParenthesizedExpression(parent)) {
173
+ node = parent;
174
+ parent = node.getParent();
175
+ }
176
+ if (!parent || !(Node.isAsExpression(parent) || Node.isTypeAssertion(parent)))
177
+ return false;
178
+ return parent.getTypeNode()?.getText() === 'const';
179
+ }
158
180
  /**
159
181
  * Whether the literal becomes the value of a `let`/`var` binding, which can
160
182
  * later hold another one, so its type really is the widened one. Reached
@@ -673,6 +673,19 @@ export declare const InferRequestSchema: z.ZodObject<{
673
673
  maxDepth?: number | undefined;
674
674
  }[];
675
675
  }>>;
676
+ model_symbols: z.ZodOptional<z.ZodArray<z.ZodObject<{
677
+ alias: z.ZodString;
678
+ symbol_name: z.ZodString;
679
+ source_file: z.ZodString;
680
+ }, "strip", z.ZodTypeAny, {
681
+ alias: string;
682
+ symbol_name: string;
683
+ source_file: string;
684
+ }, {
685
+ alias: string;
686
+ symbol_name: string;
687
+ source_file: string;
688
+ }>, "many">>;
676
689
  }, "strip", z.ZodTypeAny, {
677
690
  request_id: string;
678
691
  action: "infer";
@@ -698,6 +711,11 @@ export declare const InferRequestSchema: z.ZodObject<{
698
711
  maxDepth?: number | undefined;
699
712
  }[];
700
713
  } | undefined;
714
+ model_symbols?: {
715
+ alias: string;
716
+ symbol_name: string;
717
+ source_file: string;
718
+ }[] | undefined;
701
719
  }, {
702
720
  request_id: string;
703
721
  action: "infer";
@@ -723,6 +741,11 @@ export declare const InferRequestSchema: z.ZodObject<{
723
741
  maxDepth?: number | undefined;
724
742
  }[];
725
743
  } | undefined;
744
+ model_symbols?: {
745
+ alias: string;
746
+ symbol_name: string;
747
+ source_file: string;
748
+ }[] | undefined;
726
749
  }>;
727
750
  export declare const HealthRequestSchema: z.ZodObject<{
728
751
  request_id: z.ZodString;
@@ -1359,8 +1382,8 @@ export declare const VerifyLibraryClaimsRequestSchema: z.ZodObject<{
1359
1382
  }>>;
1360
1383
  }, "strict", z.ZodTypeAny, {
1361
1384
  kind: "op";
1362
- op: "request" | "send" | "receive" | "execute";
1363
1385
  member: string | null;
1386
+ op: "request" | "send" | "receive" | "execute";
1364
1387
  name?: {
1365
1388
  arg: number;
1366
1389
  key?: string | undefined;
@@ -1399,8 +1422,8 @@ export declare const VerifyLibraryClaimsRequestSchema: z.ZodObject<{
1399
1422
  } | undefined;
1400
1423
  }, {
1401
1424
  kind: "op";
1402
- op: "request" | "send" | "receive" | "execute";
1403
1425
  member: string | null;
1426
+ op: "request" | "send" | "receive" | "execute";
1404
1427
  name?: {
1405
1428
  arg: number;
1406
1429
  key?: string | undefined;
@@ -1511,8 +1534,8 @@ export declare const VerifyLibraryClaimsRequestSchema: z.ZodObject<{
1511
1534
  of?: string | undefined;
1512
1535
  } | {
1513
1536
  kind: "op";
1514
- op: "request" | "send" | "receive" | "execute";
1515
1537
  member: string | null;
1538
+ op: "request" | "send" | "receive" | "execute";
1516
1539
  name?: {
1517
1540
  arg: number;
1518
1541
  key?: string | undefined;
@@ -1608,8 +1631,8 @@ export declare const VerifyLibraryClaimsRequestSchema: z.ZodObject<{
1608
1631
  of?: string | undefined;
1609
1632
  } | {
1610
1633
  kind: "op";
1611
- op: "request" | "send" | "receive" | "execute";
1612
1634
  member: string | null;
1635
+ op: "request" | "send" | "receive" | "execute";
1613
1636
  name?: {
1614
1637
  arg: number;
1615
1638
  key?: string | undefined;
@@ -1711,8 +1734,8 @@ export declare const VerifyLibraryClaimsRequestSchema: z.ZodObject<{
1711
1734
  of?: string | undefined;
1712
1735
  } | {
1713
1736
  kind: "op";
1714
- op: "request" | "send" | "receive" | "execute";
1715
1737
  member: string | null;
1738
+ op: "request" | "send" | "receive" | "execute";
1716
1739
  name?: {
1717
1740
  arg: number;
1718
1741
  key?: string | undefined;
@@ -1814,8 +1837,8 @@ export declare const VerifyLibraryClaimsRequestSchema: z.ZodObject<{
1814
1837
  of?: string | undefined;
1815
1838
  } | {
1816
1839
  kind: "op";
1817
- op: "request" | "send" | "receive" | "execute";
1818
1840
  member: string | null;
1841
+ op: "request" | "send" | "receive" | "execute";
1819
1842
  name?: {
1820
1843
  arg: number;
1821
1844
  key?: string | undefined;
@@ -2494,6 +2517,19 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
2494
2517
  maxDepth?: number | undefined;
2495
2518
  }[];
2496
2519
  }>>;
2520
+ model_symbols: z.ZodOptional<z.ZodArray<z.ZodObject<{
2521
+ alias: z.ZodString;
2522
+ symbol_name: z.ZodString;
2523
+ source_file: z.ZodString;
2524
+ }, "strip", z.ZodTypeAny, {
2525
+ alias: string;
2526
+ symbol_name: string;
2527
+ source_file: string;
2528
+ }, {
2529
+ alias: string;
2530
+ symbol_name: string;
2531
+ source_file: string;
2532
+ }>, "many">>;
2497
2533
  }, "strip", z.ZodTypeAny, {
2498
2534
  request_id: string;
2499
2535
  action: "infer";
@@ -2519,6 +2555,11 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
2519
2555
  maxDepth?: number | undefined;
2520
2556
  }[];
2521
2557
  } | undefined;
2558
+ model_symbols?: {
2559
+ alias: string;
2560
+ symbol_name: string;
2561
+ source_file: string;
2562
+ }[] | undefined;
2522
2563
  }, {
2523
2564
  request_id: string;
2524
2565
  action: "infer";
@@ -2544,6 +2585,11 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
2544
2585
  maxDepth?: number | undefined;
2545
2586
  }[];
2546
2587
  } | undefined;
2588
+ model_symbols?: {
2589
+ alias: string;
2590
+ symbol_name: string;
2591
+ source_file: string;
2592
+ }[] | undefined;
2547
2593
  }>, z.ZodObject<{
2548
2594
  request_id: z.ZodString;
2549
2595
  } & {
@@ -3129,8 +3175,8 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
3129
3175
  }>>;
3130
3176
  }, "strict", z.ZodTypeAny, {
3131
3177
  kind: "op";
3132
- op: "request" | "send" | "receive" | "execute";
3133
3178
  member: string | null;
3179
+ op: "request" | "send" | "receive" | "execute";
3134
3180
  name?: {
3135
3181
  arg: number;
3136
3182
  key?: string | undefined;
@@ -3169,8 +3215,8 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
3169
3215
  } | undefined;
3170
3216
  }, {
3171
3217
  kind: "op";
3172
- op: "request" | "send" | "receive" | "execute";
3173
3218
  member: string | null;
3219
+ op: "request" | "send" | "receive" | "execute";
3174
3220
  name?: {
3175
3221
  arg: number;
3176
3222
  key?: string | undefined;
@@ -3281,8 +3327,8 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
3281
3327
  of?: string | undefined;
3282
3328
  } | {
3283
3329
  kind: "op";
3284
- op: "request" | "send" | "receive" | "execute";
3285
3330
  member: string | null;
3331
+ op: "request" | "send" | "receive" | "execute";
3286
3332
  name?: {
3287
3333
  arg: number;
3288
3334
  key?: string | undefined;
@@ -3378,8 +3424,8 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
3378
3424
  of?: string | undefined;
3379
3425
  } | {
3380
3426
  kind: "op";
3381
- op: "request" | "send" | "receive" | "execute";
3382
3427
  member: string | null;
3428
+ op: "request" | "send" | "receive" | "execute";
3383
3429
  name?: {
3384
3430
  arg: number;
3385
3431
  key?: string | undefined;
@@ -3481,8 +3527,8 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
3481
3527
  of?: string | undefined;
3482
3528
  } | {
3483
3529
  kind: "op";
3484
- op: "request" | "send" | "receive" | "execute";
3485
3530
  member: string | null;
3531
+ op: "request" | "send" | "receive" | "execute";
3486
3532
  name?: {
3487
3533
  arg: number;
3488
3534
  key?: string | undefined;
@@ -3584,8 +3630,8 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
3584
3630
  of?: string | undefined;
3585
3631
  } | {
3586
3632
  kind: "op";
3587
- op: "request" | "send" | "receive" | "execute";
3588
3633
  member: string | null;
3634
+ op: "request" | "send" | "receive" | "execute";
3589
3635
  name?: {
3590
3636
  arg: number;
3591
3637
  key?: string | undefined;
@@ -237,6 +237,13 @@ export const InferRequestSchema = BaseRequestSchema.extend({
237
237
  action: z.literal('infer'),
238
238
  requests: z.array(InferRequestItemSchema).min(1, 'At least one infer request is required'),
239
239
  extraction_config: ExtractionConfigSchema.optional(),
240
+ model_symbols: z
241
+ .array(z.object({
242
+ alias: z.string().min(1),
243
+ symbol_name: z.string().min(1),
244
+ source_file: z.string().min(1),
245
+ }))
246
+ .optional(),
240
247
  });
241
248
  export const HealthRequestSchema = BaseRequestSchema.extend({
242
249
  action: z.literal('health'),