carrick 0.3.159 → 0.3.161

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 (63) hide show
  1. package/dist/cli.d.ts +10 -0
  2. package/dist/cli.js +9 -0
  3. package/dist/cli.js.map +1 -1
  4. package/dist/contract.d.ts +25 -9
  5. package/dist/contract.js +12 -15
  6. package/dist/contract.js.map +1 -1
  7. package/dist/diagnostics.d.ts +13 -0
  8. package/dist/diagnostics.js +18 -2
  9. package/dist/diagnostics.js.map +1 -1
  10. package/dist/facts/enabled.d.ts +4 -4
  11. package/dist/facts/enabled.js +6 -6
  12. package/dist/facts/store.d.ts +21 -1
  13. package/dist/facts/store.js +44 -3
  14. package/dist/facts/store.js.map +1 -1
  15. package/dist/held/early.d.ts +3 -1
  16. package/dist/held/early.js +63 -7
  17. package/dist/held/early.js.map +1 -1
  18. package/dist/held/place.d.ts +26 -2
  19. package/dist/held/place.js +40 -3
  20. package/dist/held/place.js.map +1 -1
  21. package/dist/held/runtime.d.ts +4 -2
  22. package/dist/held/runtime.js +121 -18
  23. package/dist/held/runtime.js.map +1 -1
  24. package/dist/held/shadow.d.ts +18 -1
  25. package/dist/held/shadow.js +2 -2
  26. package/dist/held/shadow.js.map +1 -1
  27. package/dist/hook/confirm.js +12 -6
  28. package/dist/hook/confirm.js.map +1 -1
  29. package/dist/hook/rechecks.d.ts +16 -0
  30. package/dist/hook/rechecks.js +95 -2
  31. package/dist/hook/rechecks.js.map +1 -1
  32. package/dist/hook/refresh.d.ts +3 -3
  33. package/dist/hook/refresh.js +15 -15
  34. package/dist/hook/refresh.js.map +1 -1
  35. package/dist/lens.js +1 -6
  36. package/dist/lens.js.map +1 -1
  37. package/dist/render.d.ts +3 -3
  38. package/dist/render.js +15 -14
  39. package/dist/render.js.map +1 -1
  40. package/package.json +7 -7
  41. package/plugin/.claude-plugin/plugin.json +1 -1
  42. package/sidecar/dist/src/capture/anchors.js +41 -8
  43. package/sidecar/dist/src/capture/api.d.ts +4 -0
  44. package/sidecar/dist/src/capture/check-classify.d.ts +6 -0
  45. package/sidecar/dist/src/capture/check-classify.js +23 -0
  46. package/sidecar/dist/src/capture/check-fields.d.ts +11 -0
  47. package/sidecar/dist/src/capture/check-fields.js +107 -0
  48. package/sidecar/dist/src/capture/check-probe.d.ts +65 -1
  49. package/sidecar/dist/src/capture/check-probe.js +129 -22
  50. package/sidecar/dist/src/capture/index.d.ts +2 -2
  51. package/sidecar/dist/src/capture/index.js +2 -2
  52. package/sidecar/dist/src/capture/type-reasons.json +4 -0
  53. package/sidecar/dist/src/engine-stamp.json +1 -1
  54. package/sidecar/dist/src/held-shadow.d.ts +41 -2
  55. package/sidecar/dist/src/held-shadow.js +68 -2
  56. package/sidecar/dist/src/index.js +25 -8
  57. package/sidecar/dist/src/stated-params.d.ts +9 -1
  58. package/sidecar/dist/src/stated-params.js +19 -0
  59. package/sidecar/dist/src/type-inferrer.d.ts +14 -0
  60. package/sidecar/dist/src/type-inferrer.js +92 -40
  61. package/sidecar/dist/src/types.d.ts +9 -0
  62. package/sidecar/dist/src/validators.d.ts +152 -18
  63. package/sidecar/dist/src/validators.js +1 -0
@@ -3654,6 +3654,27 @@ export class TypeInferrer {
3654
3654
  'body its handler parses, and the source states no type at that read; leaving unresolved');
3655
3655
  return null;
3656
3656
  }
3657
+ // carrick#4690: the locator named a member of the server's reply object
3658
+ // (`res.locals`). That is state the server's own code keeps on the reply,
3659
+ // not what a caller sends, so publishing its type states the whole
3660
+ // locals as the request. The reply object is the one whose type holds a
3661
+ // member the server labels name as a send or a set; a member those labels
3662
+ // name as the body is the body and is read as before. Without labels the
3663
+ // read is unchanged. A decided abstain, never a bare null: capture would
3664
+ // re-read the same text and publish the locals.
3665
+ const replyStateRead = this.unwrapExpressionNode(located);
3666
+ if (Node.isPropertyAccessExpression(replyStateRead) &&
3667
+ this.statedParams.holdsReplyMember(replyStateRead.getExpression().getType()) &&
3668
+ !this.statedParams.isBodyMember(replyStateRead.getNameNode().getSymbol())) {
3669
+ this.log(`Request locator at ${request.file_path}:${request.line_number} names a member of the ` +
3670
+ "server's reply object; the state the server keeps there is not a request body");
3671
+ return this.decidedAbstain(request, this.getNodeLocation(located), {
3672
+ path: '',
3673
+ kind: 'unknown',
3674
+ reason: 'reply_state',
3675
+ detail: `\`${replyStateRead.getText()}\` is a member of the reply object`,
3676
+ });
3677
+ }
3657
3678
  // Mirror inferCallResult: strip `await`/`as`/parens/`!` so the inner
3658
3679
  // expression's type (not the surrounding `Promise<any>`) is read.
3659
3680
  let unwrapped = this.unwrapExpressionNode(located);
@@ -5710,25 +5731,6 @@ export class TypeInferrer {
5710
5731
  payloadType: payloadArg,
5711
5732
  };
5712
5733
  }
5713
- // Try "first useful generic" heuristic. It is a guess about a type's
5714
- // own arguments and is not extended to an alias's (carrick#1843): the
5715
- // alias this reaches most often is a result carrier, `Outcome<A, E>`,
5716
- // whose next argument after an open payload is the error side.
5717
- for (let i = 0; !reading.viaAlias && i < typeArgs.length; i++) {
5718
- const argType = typeArgs[i];
5719
- const text = typeText(argType, node);
5720
- if (!this.isUselessType(text)) {
5721
- if (rule.unwrapRecursively) {
5722
- return recurse(argType);
5723
- }
5724
- return {
5725
- typeString: text,
5726
- isExplicit: true,
5727
- wasUnwrapped: true,
5728
- payloadType: argType,
5729
- };
5730
- }
5731
- }
5732
5734
  }
5733
5735
  // 2. Try payloadPropertyPath
5734
5736
  if (rule.payloadPropertyPath && rule.payloadPropertyPath.length > 0) {
@@ -8178,11 +8180,18 @@ export class TypeInferrer {
8178
8180
  // B. an `as T` cast (`req.body as TrackRequest`) or a typed binding
8179
8181
  // (`const b: TrackRequest = …`). Read the annotation/cast target.
8180
8182
  if (Node.isAsExpression(descendant)) {
8183
+ // carrick#4709: a cast is a request read only where it casts what the
8184
+ // handler was handed. A cast of any other value (a tuple built and
8185
+ // asserted `as const` in a `.map` callback, a result) types that
8186
+ // value, not the body.
8187
+ if (!this.rootedAtParameterOf(func, descendant.getExpression(), true)) {
8188
+ return;
8189
+ }
8190
+ const typeNode = descendant.getTypeNode();
8181
8191
  // A member read off the cast (`(req as unknown as { body: T }).body`)
8182
8192
  // reads that member: the cast's whole object is one level too many
8183
8193
  // (carrick#4212). The checker types the member access itself.
8184
8194
  const member = this.memberReadOffCast(descendant);
8185
- const typeNode = descendant.getTypeNode();
8186
8195
  const resolved = member
8187
8196
  ? this.structuralTextFromType(member.getType(), member)
8188
8197
  : typeNode
@@ -8197,6 +8206,68 @@ export class TypeInferrer {
8197
8206
  });
8198
8207
  return found;
8199
8208
  }
8209
+ /**
8210
+ * Whether `expression` is a value read off one of `handler`'s own
8211
+ * parameters, named or destructured: the parameter itself, or a member of
8212
+ * it, through parentheses and `!`.
8213
+ *
8214
+ * With `throughReads` (carrick#4709), also a value the handler reads on from
8215
+ * one: through `await`, element access and a cast; a call made on such a
8216
+ * value or handed one (`c.req.json()`, `JSON.parse(raw)`,
8217
+ * `Schema.parse(request.body)`); and one hop through a local the handler
8218
+ * binds from such a read (`const raw = await request.json()`). A literal
8219
+ * the handler builds, or a value made from a local twice removed, is not
8220
+ * one.
8221
+ */
8222
+ rootedAtParameterOf(handler, expression, throughReads = false) {
8223
+ const parameters = new Set(handler.getParameters());
8224
+ const rooted = (start, hops) => {
8225
+ let root = start;
8226
+ for (;;) {
8227
+ if (Node.isPropertyAccessExpression(root) ||
8228
+ Node.isNonNullExpression(root) ||
8229
+ Node.isParenthesizedExpression(root)) {
8230
+ root = root.getExpression();
8231
+ }
8232
+ else if (throughReads &&
8233
+ (Node.isAwaitExpression(root) || Node.isAsExpression(root) || Node.isElementAccessExpression(root))) {
8234
+ root = root.getExpression();
8235
+ }
8236
+ else if (throughReads && Node.isCallExpression(root)) {
8237
+ const callee = root.getExpression();
8238
+ return ((Node.isPropertyAccessExpression(callee) && rooted(callee.getExpression(), hops)) ||
8239
+ root.getArguments().some((argument) => rooted(argument, hops)));
8240
+ }
8241
+ else {
8242
+ break;
8243
+ }
8244
+ }
8245
+ if (!Node.isIdentifier(root))
8246
+ return false;
8247
+ return (root.getSymbol()?.getDeclarations() ?? []).some((declaration) => {
8248
+ const parameter = Node.isParameterDeclaration(declaration)
8249
+ ? declaration
8250
+ : Node.isBindingElement(declaration)
8251
+ ? declaration.getFirstAncestorByKind(SyntaxKind.Parameter)
8252
+ : undefined;
8253
+ if (parameter !== undefined)
8254
+ return parameters.has(parameter);
8255
+ if (!throughReads || hops === 0)
8256
+ return false;
8257
+ // `const raw = …` or `const { body } = …`: the binding's initialiser.
8258
+ const binding = Node.isBindingElement(declaration)
8259
+ ? declaration.getFirstAncestorByKind(SyntaxKind.VariableDeclaration)
8260
+ : declaration;
8261
+ if (!binding || !Node.isVariableDeclaration(binding))
8262
+ return false;
8263
+ const initializer = binding.getInitializer();
8264
+ return (initializer !== undefined &&
8265
+ handler.containsRange(binding.getPos(), binding.getEnd()) &&
8266
+ rooted(initializer, hops - 1));
8267
+ });
8268
+ };
8269
+ return rooted(expression, 1);
8270
+ }
8200
8271
  /**
8201
8272
  * The call in a handler that reads the request's body off the platform
8202
8273
  * request the handler was handed, or `undefined` (carrick#807).
@@ -8218,25 +8289,6 @@ export class TypeInferrer {
8218
8289
  * The first such call in source order: a body is read once.
8219
8290
  */
8220
8291
  platformBodyReadIn(handler) {
8221
- const parameters = new Set(handler.getParameters());
8222
- const rootedAtParameter = (expression) => {
8223
- let root = expression;
8224
- while (Node.isPropertyAccessExpression(root) ||
8225
- Node.isNonNullExpression(root) ||
8226
- Node.isParenthesizedExpression(root)) {
8227
- root = root.getExpression();
8228
- }
8229
- if (!Node.isIdentifier(root))
8230
- return false;
8231
- return (root.getSymbol()?.getDeclarations() ?? []).some((declaration) => {
8232
- const parameter = Node.isParameterDeclaration(declaration)
8233
- ? declaration
8234
- : Node.isBindingElement(declaration)
8235
- ? declaration.getFirstAncestorByKind(SyntaxKind.Parameter)
8236
- : undefined;
8237
- return parameter !== undefined && parameters.has(parameter);
8238
- });
8239
- };
8240
8292
  for (const call of handler.getDescendantsOfKind(SyntaxKind.CallExpression)) {
8241
8293
  if (call.getArguments().length > 0)
8242
8294
  continue;
@@ -8244,7 +8296,7 @@ export class TypeInferrer {
8244
8296
  if (!Node.isPropertyAccessExpression(callee))
8245
8297
  continue;
8246
8298
  const receiver = callee.getExpression();
8247
- if (!rootedAtParameter(receiver))
8299
+ if (!this.rootedAtParameterOf(handler, receiver))
8248
8300
  continue;
8249
8301
  const yielded = this.unwrapPromiseType(call.getType());
8250
8302
  if (!yielded.isAny() && !yielded.isUnknown())
@@ -302,6 +302,15 @@ export interface ListProgramFilesRequest extends BaseRequest {
302
302
  export interface WriteShadowRequest extends BaseRequest {
303
303
  action: 'write_shadow';
304
304
  out_dir: string;
305
+ /**
306
+ * The service's SDL output types and the root fields its GraphQL producer
307
+ * rows answer. With it the answer carries the judge's GraphQL rules and a
308
+ * scalar-form leaf per root whose form the judge reads that way.
309
+ */
310
+ graphql?: {
311
+ types: import('./capture/api.js').GraphqlTypes;
312
+ roots: import('./capture/api.js').GraphqlRoot[];
313
+ };
305
314
  }
306
315
  /**
307
316
  * Find again, in a file's new text, the node the old text's span `[start, end)`
@@ -92,7 +92,7 @@ export declare const InferRequestItemSchema: z.ZodObject<{
92
92
  span_end: number;
93
93
  }>>;
94
94
  }, "strip", z.ZodTypeAny, {
95
- infer_kind: "call_result" | "function_return" | "expression" | "variable" | "response_body" | "request_body" | "signature_return" | "function_param" | "receiver_type" | "request_config";
95
+ infer_kind: "request_body" | "call_result" | "function_return" | "expression" | "variable" | "response_body" | "signature_return" | "function_param" | "receiver_type" | "request_config";
96
96
  file_path: string;
97
97
  line_number: number;
98
98
  member?: string | undefined;
@@ -116,7 +116,7 @@ export declare const InferRequestItemSchema: z.ZodObject<{
116
116
  span_end: number;
117
117
  } | undefined;
118
118
  }, {
119
- infer_kind: "call_result" | "function_return" | "expression" | "variable" | "response_body" | "request_body" | "signature_return" | "function_param" | "receiver_type" | "request_config";
119
+ infer_kind: "request_body" | "call_result" | "function_return" | "expression" | "variable" | "response_body" | "signature_return" | "function_param" | "receiver_type" | "request_config";
120
120
  file_path: string;
121
121
  line_number: number;
122
122
  member?: string | undefined;
@@ -435,7 +435,7 @@ export declare const CaptureV2RequestSchema: z.ZodObject<{
435
435
  source_file: string;
436
436
  anchor_origin: "llm-symbol" | "deterministic-infer" | "anchor-backfill" | "manifest-placeholder";
437
437
  param_name?: string | undefined;
438
- infer_kind?: "call_result" | "function_return" | "expression" | "variable" | "response_body" | "request_body" | "signature_return" | "function_param" | "receiver_type" | "request_config" | undefined;
438
+ infer_kind?: "request_body" | "call_result" | "function_return" | "expression" | "variable" | "response_body" | "signature_return" | "function_param" | "receiver_type" | "request_config" | undefined;
439
439
  result?: {
440
440
  whole: true;
441
441
  } | {
@@ -454,7 +454,7 @@ export declare const CaptureV2RequestSchema: z.ZodObject<{
454
454
  source_file: string;
455
455
  anchor_origin: "llm-symbol" | "deterministic-infer" | "anchor-backfill" | "manifest-placeholder";
456
456
  param_name?: string | undefined;
457
- infer_kind?: "call_result" | "function_return" | "expression" | "variable" | "response_body" | "request_body" | "signature_return" | "function_param" | "receiver_type" | "request_config" | undefined;
457
+ infer_kind?: "request_body" | "call_result" | "function_return" | "expression" | "variable" | "response_body" | "signature_return" | "function_param" | "receiver_type" | "request_config" | undefined;
458
458
  result?: {
459
459
  whole: true;
460
460
  } | {
@@ -545,7 +545,7 @@ export declare const CaptureV2RequestSchema: z.ZodObject<{
545
545
  source_file: string;
546
546
  anchor_origin: "llm-symbol" | "deterministic-infer" | "anchor-backfill" | "manifest-placeholder";
547
547
  param_name?: string | undefined;
548
- infer_kind?: "call_result" | "function_return" | "expression" | "variable" | "response_body" | "request_body" | "signature_return" | "function_param" | "receiver_type" | "request_config" | undefined;
548
+ infer_kind?: "request_body" | "call_result" | "function_return" | "expression" | "variable" | "response_body" | "signature_return" | "function_param" | "receiver_type" | "request_config" | undefined;
549
549
  result?: {
550
550
  whole: true;
551
551
  } | {
@@ -604,7 +604,7 @@ export declare const CaptureV2RequestSchema: z.ZodObject<{
604
604
  source_file: string;
605
605
  anchor_origin: "llm-symbol" | "deterministic-infer" | "anchor-backfill" | "manifest-placeholder";
606
606
  param_name?: string | undefined;
607
- infer_kind?: "call_result" | "function_return" | "expression" | "variable" | "response_body" | "request_body" | "signature_return" | "function_param" | "receiver_type" | "request_config" | undefined;
607
+ infer_kind?: "request_body" | "call_result" | "function_return" | "expression" | "variable" | "response_body" | "signature_return" | "function_param" | "receiver_type" | "request_config" | undefined;
608
608
  result?: {
609
609
  whole: true;
610
610
  } | {
@@ -918,7 +918,7 @@ export declare const InferRequestSchema: z.ZodObject<{
918
918
  span_end: number;
919
919
  }>>;
920
920
  }, "strip", z.ZodTypeAny, {
921
- infer_kind: "call_result" | "function_return" | "expression" | "variable" | "response_body" | "request_body" | "signature_return" | "function_param" | "receiver_type" | "request_config";
921
+ infer_kind: "request_body" | "call_result" | "function_return" | "expression" | "variable" | "response_body" | "signature_return" | "function_param" | "receiver_type" | "request_config";
922
922
  file_path: string;
923
923
  line_number: number;
924
924
  member?: string | undefined;
@@ -942,7 +942,7 @@ export declare const InferRequestSchema: z.ZodObject<{
942
942
  span_end: number;
943
943
  } | undefined;
944
944
  }, {
945
- infer_kind: "call_result" | "function_return" | "expression" | "variable" | "response_body" | "request_body" | "signature_return" | "function_param" | "receiver_type" | "request_config";
945
+ infer_kind: "request_body" | "call_result" | "function_return" | "expression" | "variable" | "response_body" | "signature_return" | "function_param" | "receiver_type" | "request_config";
946
946
  file_path: string;
947
947
  line_number: number;
948
948
  member?: string | undefined;
@@ -1047,7 +1047,7 @@ export declare const InferRequestSchema: z.ZodObject<{
1047
1047
  request_id: string;
1048
1048
  action: "infer";
1049
1049
  requests: {
1050
- infer_kind: "call_result" | "function_return" | "expression" | "variable" | "response_body" | "request_body" | "signature_return" | "function_param" | "receiver_type" | "request_config";
1050
+ infer_kind: "request_body" | "call_result" | "function_return" | "expression" | "variable" | "response_body" | "signature_return" | "function_param" | "receiver_type" | "request_config";
1051
1051
  file_path: string;
1052
1052
  line_number: number;
1053
1053
  member?: string | undefined;
@@ -1098,7 +1098,7 @@ export declare const InferRequestSchema: z.ZodObject<{
1098
1098
  request_id: string;
1099
1099
  action: "infer";
1100
1100
  requests: {
1101
- infer_kind: "call_result" | "function_return" | "expression" | "variable" | "response_body" | "request_body" | "signature_return" | "function_param" | "receiver_type" | "request_config";
1101
+ infer_kind: "request_body" | "call_result" | "function_return" | "expression" | "variable" | "response_body" | "signature_return" | "function_param" | "receiver_type" | "request_config";
1102
1102
  file_path: string;
1103
1103
  line_number: number;
1104
1104
  member?: string | undefined;
@@ -1184,14 +1184,81 @@ export declare const WriteShadowRequestSchema: z.ZodObject<{
1184
1184
  } & {
1185
1185
  action: z.ZodLiteral<"write_shadow">;
1186
1186
  out_dir: z.ZodString;
1187
+ graphql: z.ZodOptional<z.ZodObject<{
1188
+ types: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
1189
+ fields: z.ZodRecord<z.ZodString, z.ZodType<GraphqlLeafInput, z.ZodTypeDef, GraphqlLeafInput>>;
1190
+ }, "strict", z.ZodTypeAny, {
1191
+ fields: Record<string, GraphqlLeafInput>;
1192
+ }, {
1193
+ fields: Record<string, GraphqlLeafInput>;
1194
+ }>, z.ZodObject<{
1195
+ members: z.ZodArray<z.ZodString, "many">;
1196
+ }, "strict", z.ZodTypeAny, {
1197
+ members: string[];
1198
+ }, {
1199
+ members: string[];
1200
+ }>]>>;
1201
+ roots: z.ZodArray<z.ZodObject<{
1202
+ type: z.ZodString;
1203
+ field: z.ZodString;
1204
+ }, "strip", z.ZodTypeAny, {
1205
+ field: string;
1206
+ type: string;
1207
+ }, {
1208
+ field: string;
1209
+ type: string;
1210
+ }>, "many">;
1211
+ }, "strip", z.ZodTypeAny, {
1212
+ types: Record<string, {
1213
+ fields: Record<string, GraphqlLeafInput>;
1214
+ } | {
1215
+ members: string[];
1216
+ }>;
1217
+ roots: {
1218
+ field: string;
1219
+ type: string;
1220
+ }[];
1221
+ }, {
1222
+ types: Record<string, {
1223
+ fields: Record<string, GraphqlLeafInput>;
1224
+ } | {
1225
+ members: string[];
1226
+ }>;
1227
+ roots: {
1228
+ field: string;
1229
+ type: string;
1230
+ }[];
1231
+ }>>;
1187
1232
  }, "strip", z.ZodTypeAny, {
1188
1233
  request_id: string;
1189
1234
  action: "write_shadow";
1190
1235
  out_dir: string;
1236
+ graphql?: {
1237
+ types: Record<string, {
1238
+ fields: Record<string, GraphqlLeafInput>;
1239
+ } | {
1240
+ members: string[];
1241
+ }>;
1242
+ roots: {
1243
+ field: string;
1244
+ type: string;
1245
+ }[];
1246
+ } | undefined;
1191
1247
  }, {
1192
1248
  request_id: string;
1193
1249
  action: "write_shadow";
1194
1250
  out_dir: string;
1251
+ graphql?: {
1252
+ types: Record<string, {
1253
+ fields: Record<string, GraphqlLeafInput>;
1254
+ } | {
1255
+ members: string[];
1256
+ }>;
1257
+ roots: {
1258
+ field: string;
1259
+ type: string;
1260
+ }[];
1261
+ } | undefined;
1195
1262
  }>;
1196
1263
  export declare const FindSiteRequestSchema: z.ZodObject<{
1197
1264
  request_id: z.ZodString;
@@ -4707,7 +4774,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
4707
4774
  source_file: string;
4708
4775
  anchor_origin: "llm-symbol" | "deterministic-infer" | "anchor-backfill" | "manifest-placeholder";
4709
4776
  param_name?: string | undefined;
4710
- infer_kind?: "call_result" | "function_return" | "expression" | "variable" | "response_body" | "request_body" | "signature_return" | "function_param" | "receiver_type" | "request_config" | undefined;
4777
+ infer_kind?: "request_body" | "call_result" | "function_return" | "expression" | "variable" | "response_body" | "signature_return" | "function_param" | "receiver_type" | "request_config" | undefined;
4711
4778
  result?: {
4712
4779
  whole: true;
4713
4780
  } | {
@@ -4726,7 +4793,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
4726
4793
  source_file: string;
4727
4794
  anchor_origin: "llm-symbol" | "deterministic-infer" | "anchor-backfill" | "manifest-placeholder";
4728
4795
  param_name?: string | undefined;
4729
- infer_kind?: "call_result" | "function_return" | "expression" | "variable" | "response_body" | "request_body" | "signature_return" | "function_param" | "receiver_type" | "request_config" | undefined;
4796
+ infer_kind?: "request_body" | "call_result" | "function_return" | "expression" | "variable" | "response_body" | "signature_return" | "function_param" | "receiver_type" | "request_config" | undefined;
4730
4797
  result?: {
4731
4798
  whole: true;
4732
4799
  } | {
@@ -4817,7 +4884,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
4817
4884
  source_file: string;
4818
4885
  anchor_origin: "llm-symbol" | "deterministic-infer" | "anchor-backfill" | "manifest-placeholder";
4819
4886
  param_name?: string | undefined;
4820
- infer_kind?: "call_result" | "function_return" | "expression" | "variable" | "response_body" | "request_body" | "signature_return" | "function_param" | "receiver_type" | "request_config" | undefined;
4887
+ infer_kind?: "request_body" | "call_result" | "function_return" | "expression" | "variable" | "response_body" | "signature_return" | "function_param" | "receiver_type" | "request_config" | undefined;
4821
4888
  result?: {
4822
4889
  whole: true;
4823
4890
  } | {
@@ -4876,7 +4943,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
4876
4943
  source_file: string;
4877
4944
  anchor_origin: "llm-symbol" | "deterministic-infer" | "anchor-backfill" | "manifest-placeholder";
4878
4945
  param_name?: string | undefined;
4879
- infer_kind?: "call_result" | "function_return" | "expression" | "variable" | "response_body" | "request_body" | "signature_return" | "function_param" | "receiver_type" | "request_config" | undefined;
4946
+ infer_kind?: "request_body" | "call_result" | "function_return" | "expression" | "variable" | "response_body" | "signature_return" | "function_param" | "receiver_type" | "request_config" | undefined;
4880
4947
  result?: {
4881
4948
  whole: true;
4882
4949
  } | {
@@ -5176,7 +5243,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
5176
5243
  span_end: number;
5177
5244
  }>>;
5178
5245
  }, "strip", z.ZodTypeAny, {
5179
- infer_kind: "call_result" | "function_return" | "expression" | "variable" | "response_body" | "request_body" | "signature_return" | "function_param" | "receiver_type" | "request_config";
5246
+ infer_kind: "request_body" | "call_result" | "function_return" | "expression" | "variable" | "response_body" | "signature_return" | "function_param" | "receiver_type" | "request_config";
5180
5247
  file_path: string;
5181
5248
  line_number: number;
5182
5249
  member?: string | undefined;
@@ -5200,7 +5267,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
5200
5267
  span_end: number;
5201
5268
  } | undefined;
5202
5269
  }, {
5203
- infer_kind: "call_result" | "function_return" | "expression" | "variable" | "response_body" | "request_body" | "signature_return" | "function_param" | "receiver_type" | "request_config";
5270
+ infer_kind: "request_body" | "call_result" | "function_return" | "expression" | "variable" | "response_body" | "signature_return" | "function_param" | "receiver_type" | "request_config";
5204
5271
  file_path: string;
5205
5272
  line_number: number;
5206
5273
  member?: string | undefined;
@@ -5305,7 +5372,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
5305
5372
  request_id: string;
5306
5373
  action: "infer";
5307
5374
  requests: {
5308
- infer_kind: "call_result" | "function_return" | "expression" | "variable" | "response_body" | "request_body" | "signature_return" | "function_param" | "receiver_type" | "request_config";
5375
+ infer_kind: "request_body" | "call_result" | "function_return" | "expression" | "variable" | "response_body" | "signature_return" | "function_param" | "receiver_type" | "request_config";
5309
5376
  file_path: string;
5310
5377
  line_number: number;
5311
5378
  member?: string | undefined;
@@ -5356,7 +5423,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
5356
5423
  request_id: string;
5357
5424
  action: "infer";
5358
5425
  requests: {
5359
- infer_kind: "call_result" | "function_return" | "expression" | "variable" | "response_body" | "request_body" | "signature_return" | "function_param" | "receiver_type" | "request_config";
5426
+ infer_kind: "request_body" | "call_result" | "function_return" | "expression" | "variable" | "response_body" | "signature_return" | "function_param" | "receiver_type" | "request_config";
5360
5427
  file_path: string;
5361
5428
  line_number: number;
5362
5429
  member?: string | undefined;
@@ -8407,14 +8474,81 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
8407
8474
  } & {
8408
8475
  action: z.ZodLiteral<"write_shadow">;
8409
8476
  out_dir: z.ZodString;
8477
+ graphql: z.ZodOptional<z.ZodObject<{
8478
+ types: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
8479
+ fields: z.ZodRecord<z.ZodString, z.ZodType<GraphqlLeafInput, z.ZodTypeDef, GraphqlLeafInput>>;
8480
+ }, "strict", z.ZodTypeAny, {
8481
+ fields: Record<string, GraphqlLeafInput>;
8482
+ }, {
8483
+ fields: Record<string, GraphqlLeafInput>;
8484
+ }>, z.ZodObject<{
8485
+ members: z.ZodArray<z.ZodString, "many">;
8486
+ }, "strict", z.ZodTypeAny, {
8487
+ members: string[];
8488
+ }, {
8489
+ members: string[];
8490
+ }>]>>;
8491
+ roots: z.ZodArray<z.ZodObject<{
8492
+ type: z.ZodString;
8493
+ field: z.ZodString;
8494
+ }, "strip", z.ZodTypeAny, {
8495
+ field: string;
8496
+ type: string;
8497
+ }, {
8498
+ field: string;
8499
+ type: string;
8500
+ }>, "many">;
8501
+ }, "strip", z.ZodTypeAny, {
8502
+ types: Record<string, {
8503
+ fields: Record<string, GraphqlLeafInput>;
8504
+ } | {
8505
+ members: string[];
8506
+ }>;
8507
+ roots: {
8508
+ field: string;
8509
+ type: string;
8510
+ }[];
8511
+ }, {
8512
+ types: Record<string, {
8513
+ fields: Record<string, GraphqlLeafInput>;
8514
+ } | {
8515
+ members: string[];
8516
+ }>;
8517
+ roots: {
8518
+ field: string;
8519
+ type: string;
8520
+ }[];
8521
+ }>>;
8410
8522
  }, "strip", z.ZodTypeAny, {
8411
8523
  request_id: string;
8412
8524
  action: "write_shadow";
8413
8525
  out_dir: string;
8526
+ graphql?: {
8527
+ types: Record<string, {
8528
+ fields: Record<string, GraphqlLeafInput>;
8529
+ } | {
8530
+ members: string[];
8531
+ }>;
8532
+ roots: {
8533
+ field: string;
8534
+ type: string;
8535
+ }[];
8536
+ } | undefined;
8414
8537
  }, {
8415
8538
  request_id: string;
8416
8539
  action: "write_shadow";
8417
8540
  out_dir: string;
8541
+ graphql?: {
8542
+ types: Record<string, {
8543
+ fields: Record<string, GraphqlLeafInput>;
8544
+ } | {
8545
+ members: string[];
8546
+ }>;
8547
+ roots: {
8548
+ field: string;
8549
+ type: string;
8550
+ }[];
8551
+ } | undefined;
8418
8552
  }>, z.ZodObject<{
8419
8553
  request_id: z.ZodString;
8420
8554
  } & {
@@ -323,6 +323,7 @@ export const ListProgramFilesRequestSchema = BaseRequestSchema.extend({
323
323
  export const WriteShadowRequestSchema = BaseRequestSchema.extend({
324
324
  action: z.literal('write_shadow'),
325
325
  out_dir: z.string().min(1),
326
+ graphql: z.object({ types: GraphqlTypesSchema, roots: z.array(GraphqlRootSchema) }).optional(),
326
327
  });
327
328
  export const FindSiteRequestSchema = BaseRequestSchema.extend({
328
329
  action: z.literal('find_site'),