carrick 0.3.152 → 0.3.154
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.
- package/dist/contract.d.ts +27 -3
- package/dist/contract.js +8 -0
- package/dist/contract.js.map +1 -1
- package/dist/hook/edit-flow.js +25 -12
- package/dist/hook/edit-flow.js.map +1 -1
- package/dist/hook/late.d.ts +1 -1
- package/dist/hook/late.js +19 -15
- package/dist/hook/late.js.map +1 -1
- package/dist/hook/lead.d.ts +13 -0
- package/dist/hook/lead.js +39 -0
- package/dist/hook/lead.js.map +1 -0
- package/dist/hook/reuse.d.ts +9 -0
- package/dist/hook/reuse.js +15 -0
- package/dist/hook/reuse.js.map +1 -1
- package/dist/hook/stop-wait.js +3 -7
- package/dist/hook/stop-wait.js.map +1 -1
- package/dist/render.d.ts +5 -21
- package/dist/render.js +47 -66
- package/dist/render.js.map +1 -1
- package/package.json +6 -6
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/scripts/install-scanned-deps.sh +25 -2
- package/sidecar/dist/src/capture/index.d.ts +2 -1
- package/sidecar/dist/src/capture/index.js +1 -1
- package/sidecar/dist/src/capture/node-builder.d.ts +6 -0
- package/sidecar/dist/src/capture/reference-redirect.d.ts +16 -1
- package/sidecar/dist/src/capture/reference-redirect.js +137 -3
- package/sidecar/dist/src/default-library.d.ts +39 -0
- package/sidecar/dist/src/default-library.js +132 -0
- package/sidecar/dist/src/definition-resolver.js +2 -0
- package/sidecar/dist/src/index.js +2 -1
- package/sidecar/dist/src/library-claims.d.ts +2 -0
- package/sidecar/dist/src/library-claims.js +176 -17
- package/sidecar/dist/src/position-rows.d.ts +40 -4
- package/sidecar/dist/src/position-rows.js +111 -3
- package/sidecar/dist/src/project-loader.d.ts +11 -3
- package/sidecar/dist/src/project-loader.js +14 -6
- package/sidecar/dist/src/type-inferrer.d.ts +14 -0
- package/sidecar/dist/src/type-inferrer.js +34 -5
- package/sidecar/dist/src/types.d.ts +16 -0
- package/sidecar/dist/src/validators.d.ts +12 -0
- package/sidecar/dist/src/validators.js +2 -0
|
@@ -2664,6 +2664,10 @@ export class TypeInferrer {
|
|
|
2664
2664
|
// machinery. A wrapper rule that DID unwrap the envelope, or a type the
|
|
2665
2665
|
// source itself states, is a contract and keeps its answer.
|
|
2666
2666
|
//
|
|
2667
|
+
// carrick#3741: a one-argument result envelope read only for its own
|
|
2668
|
+
// members (`res.success`, `res.error`) is decided the same way. The site
|
|
2669
|
+
// never reads the payload, and the envelope is not the wire body.
|
|
2670
|
+
//
|
|
2667
2671
|
// A single explicit call generic (`client.get<Order[]>(url)`) is the
|
|
2668
2672
|
// caller's own payload claim and states the contract as plainly as an
|
|
2669
2673
|
// `as` does — it is what the anchor below falls back to on a checkout
|
|
@@ -2675,7 +2679,8 @@ export class TypeInferrer {
|
|
|
2675
2679
|
// engine/type_compat_v2.rs). No anchor and no depth go with it, so the
|
|
2676
2680
|
// row also reads as blind rather than as a sighted answer.
|
|
2677
2681
|
if (use.projectionOnly &&
|
|
2678
|
-
this.projectionReadsGenericPayload(callExpr, use.projections)
|
|
2682
|
+
(this.projectionReadsGenericPayload(callExpr, use.projections) ||
|
|
2683
|
+
this.isOneArgumentEnvelope(callExpr)) &&
|
|
2679
2684
|
!unwrapResult.wasUnwrapped &&
|
|
2680
2685
|
!explicitType &&
|
|
2681
2686
|
!carrierPayload &&
|
|
@@ -3845,6 +3850,26 @@ export class TypeInferrer {
|
|
|
3845
3850
|
return parts.some((part) => argTexts.has(part.getText()));
|
|
3846
3851
|
});
|
|
3847
3852
|
}
|
|
3853
|
+
/**
|
|
3854
|
+
* True when the call answers a ONE-ARGUMENT result envelope: a union whose
|
|
3855
|
+
* branches say whether the call worked and one of which holds the single
|
|
3856
|
+
* type argument as a member (`{ success: true; data: T } | { success: false;
|
|
3857
|
+
* error: string }`), carrick#3741. carrick#1376 needs two arguments to tell
|
|
3858
|
+
* the success side from the failure side; with one there is nothing to tell
|
|
3859
|
+
* apart, and the envelope is the client's bookkeeping around `T`.
|
|
3860
|
+
*
|
|
3861
|
+
* A site that reads only such an envelope's own members (its status, its
|
|
3862
|
+
* error) reads no payload, so the envelope is not a response contract. A
|
|
3863
|
+
* union with no type argument (`{ ok: true } | { ok: false; reason: string }`)
|
|
3864
|
+
* is not an envelope here and keeps its declared answer (carrick#1375).
|
|
3865
|
+
*/
|
|
3866
|
+
isOneArgumentEnvelope(callExpr) {
|
|
3867
|
+
const shape = this.resultCarrierArguments(callExpr.getType(), callExpr, [], 1);
|
|
3868
|
+
if (!shape || shape.readOffCall)
|
|
3869
|
+
return false;
|
|
3870
|
+
const own = [...shape.carrier.getAliasTypeArguments(), ...shape.carrier.getTypeArguments()];
|
|
3871
|
+
return own.length === 1 && shape.carried.length === 1;
|
|
3872
|
+
}
|
|
3848
3873
|
/**
|
|
3849
3874
|
* The payload a RESULT CARRIER carries, or `undefined` when `type` is not
|
|
3850
3875
|
* one or its success side cannot be told from its failure side
|
|
@@ -4089,13 +4114,13 @@ export class TypeInferrer {
|
|
|
4089
4114
|
* promise-like around it is peeled, and the type arguments a branch of it
|
|
4090
4115
|
* holds as a member. `undefined` when `type` is not a carrier.
|
|
4091
4116
|
*/
|
|
4092
|
-
resultCarrierArguments(type, at, callArgs = []) {
|
|
4117
|
+
resultCarrierArguments(type, at, callArgs = [], minArguments = 2) {
|
|
4093
4118
|
// carrick#1841: a conditional deferred on a type parameter is a carrier
|
|
4094
4119
|
// where one of its branches is.
|
|
4095
4120
|
const deferredBranches = this.deferredConditionalBranches(type);
|
|
4096
4121
|
if (deferredBranches) {
|
|
4097
4122
|
for (const branch of deferredBranches) {
|
|
4098
|
-
const shape = this.resultCarrierArguments(branch, at, callArgs);
|
|
4123
|
+
const shape = this.resultCarrierArguments(branch, at, callArgs, minArguments);
|
|
4099
4124
|
if (shape)
|
|
4100
4125
|
return shape;
|
|
4101
4126
|
}
|
|
@@ -4114,7 +4139,7 @@ export class TypeInferrer {
|
|
|
4114
4139
|
// arguments its call was built from (`callResultArguments`).
|
|
4115
4140
|
const readOffCall = own.length === 0;
|
|
4116
4141
|
const args = readOffCall ? callArgs : own;
|
|
4117
|
-
if (args.length <
|
|
4142
|
+
if (args.length < minArguments) {
|
|
4118
4143
|
return undefined;
|
|
4119
4144
|
}
|
|
4120
4145
|
// carrick#1841: on a carrier read off the call, a member every branch
|
|
@@ -5656,8 +5681,12 @@ export class TypeInferrer {
|
|
|
5656
5681
|
}
|
|
5657
5682
|
/** The annotation `extractExplicitTypeFromAncestor` prints, as a node. */
|
|
5658
5683
|
explicitTypeNodeFromAncestor(node) {
|
|
5684
|
+
// The walk stops at the first function boundary: past it, the annotation
|
|
5685
|
+
// describes the object or value the function sits in, not this read.
|
|
5659
5686
|
const varDecl = node.getFirstAncestorByKind(SyntaxKind.VariableDeclaration);
|
|
5660
|
-
|
|
5687
|
+
const boundary = this.findContainingFunctionForNode(node);
|
|
5688
|
+
const crossesBoundary = !!varDecl && !!boundary && boundary.getStart() > varDecl.getStart();
|
|
5689
|
+
if (varDecl && !crossesBoundary) {
|
|
5661
5690
|
const typeNode = varDecl.getTypeNode();
|
|
5662
5691
|
if (typeNode) {
|
|
5663
5692
|
return typeNode;
|
|
@@ -125,6 +125,13 @@ export interface InitRequest extends BaseRequest {
|
|
|
125
125
|
tsconfig_snapshot?: TsconfigSnapshot;
|
|
126
126
|
/** Optional pinned dependencies for this repo */
|
|
127
127
|
pinned_dependencies?: PinnedDependencySnapshot;
|
|
128
|
+
/**
|
|
129
|
+
* Set only on the position rows' process (carrick#1910): its programs read
|
|
130
|
+
* the workspace packages the install links into the checkout from their
|
|
131
|
+
* source. Every other process leaves it unset, so infer's text, which the
|
|
132
|
+
* compat judge anchors on, never moves with it.
|
|
133
|
+
*/
|
|
134
|
+
workspace_source?: boolean;
|
|
128
135
|
}
|
|
129
136
|
/**
|
|
130
137
|
* Request to bundle explicit types from source files
|
|
@@ -851,6 +858,8 @@ export interface ListLibrarySurfaceRequest extends BaseRequest {
|
|
|
851
858
|
types?: boolean;
|
|
852
859
|
/** The most handler-parameter members the whole listing lists; default 500000 (carrick#3016). */
|
|
853
860
|
max_handler_members?: number;
|
|
861
|
+
/** Estimated member makers of values typed by another package past which they list only `export`; default 160000 (carrick#3745). */
|
|
862
|
+
foreign_maker_budget?: number;
|
|
854
863
|
/** List each signature's `result_candidates` (carrick#2817); default false (carrick#2966). */
|
|
855
864
|
result_candidates?: boolean;
|
|
856
865
|
}
|
|
@@ -1422,6 +1431,13 @@ export interface LibrarySurface {
|
|
|
1422
1431
|
* `truncated` does not count them, and it is outside `surface_sha256`.
|
|
1423
1432
|
*/
|
|
1424
1433
|
properties_left_out?: number;
|
|
1434
|
+
/**
|
|
1435
|
+
* Member makers (`instance:<member>`, `instance:new:<member>`) left out on
|
|
1436
|
+
* values typed by another package, because the request's estimate passed
|
|
1437
|
+
* `foreign_maker_budget` (carrick#3745); absent when none. `truncated` does
|
|
1438
|
+
* not count them, and it is outside `surface_sha256`.
|
|
1439
|
+
*/
|
|
1440
|
+
makers_left_out?: number;
|
|
1425
1441
|
/**
|
|
1426
1442
|
* With `types: true`: per export, per receiver the surface lists, the
|
|
1427
1443
|
* `types` receiver ids its built type and base types are declared by
|
|
@@ -222,6 +222,7 @@ export declare const InitRequestSchema: z.ZodObject<{
|
|
|
222
222
|
};
|
|
223
223
|
}>>;
|
|
224
224
|
pinned_dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
225
|
+
workspace_source: z.ZodOptional<z.ZodBoolean>;
|
|
225
226
|
}, "strip", z.ZodTypeAny, {
|
|
226
227
|
request_id: string;
|
|
227
228
|
action: "init";
|
|
@@ -249,6 +250,7 @@ export declare const InitRequestSchema: z.ZodObject<{
|
|
|
249
250
|
};
|
|
250
251
|
} | undefined;
|
|
251
252
|
pinned_dependencies?: Record<string, string> | undefined;
|
|
253
|
+
workspace_source?: boolean | undefined;
|
|
252
254
|
}, {
|
|
253
255
|
request_id: string;
|
|
254
256
|
action: "init";
|
|
@@ -276,6 +278,7 @@ export declare const InitRequestSchema: z.ZodObject<{
|
|
|
276
278
|
};
|
|
277
279
|
} | undefined;
|
|
278
280
|
pinned_dependencies?: Record<string, string> | undefined;
|
|
281
|
+
workspace_source?: boolean | undefined;
|
|
279
282
|
}>;
|
|
280
283
|
export declare const BundleRequestSchema: z.ZodObject<{
|
|
281
284
|
request_id: z.ZodString;
|
|
@@ -3783,6 +3786,7 @@ export declare const ListLibrarySurfaceRequestSchema: z.ZodObject<{
|
|
|
3783
3786
|
types: z.ZodOptional<z.ZodBoolean>;
|
|
3784
3787
|
result_candidates: z.ZodOptional<z.ZodBoolean>;
|
|
3785
3788
|
max_handler_members: z.ZodOptional<z.ZodNumber>;
|
|
3789
|
+
foreign_maker_budget: z.ZodOptional<z.ZodNumber>;
|
|
3786
3790
|
}, "strip", z.ZodTypeAny, {
|
|
3787
3791
|
packages: string[];
|
|
3788
3792
|
request_id: string;
|
|
@@ -3794,6 +3798,7 @@ export declare const ListLibrarySurfaceRequestSchema: z.ZodObject<{
|
|
|
3794
3798
|
exports?: Record<string, string[]> | undefined;
|
|
3795
3799
|
max_entries?: number | undefined;
|
|
3796
3800
|
max_handler_members?: number | undefined;
|
|
3801
|
+
foreign_maker_budget?: number | undefined;
|
|
3797
3802
|
}, {
|
|
3798
3803
|
packages: string[];
|
|
3799
3804
|
request_id: string;
|
|
@@ -3805,6 +3810,7 @@ export declare const ListLibrarySurfaceRequestSchema: z.ZodObject<{
|
|
|
3805
3810
|
exports?: Record<string, string[]> | undefined;
|
|
3806
3811
|
max_entries?: number | undefined;
|
|
3807
3812
|
max_handler_members?: number | undefined;
|
|
3813
|
+
foreign_maker_budget?: number | undefined;
|
|
3808
3814
|
}>;
|
|
3809
3815
|
/**
|
|
3810
3816
|
* The main sidecar request schema - a discriminated union on the 'action' field
|
|
@@ -3903,6 +3909,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
|
|
|
3903
3909
|
};
|
|
3904
3910
|
}>>;
|
|
3905
3911
|
pinned_dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
3912
|
+
workspace_source: z.ZodOptional<z.ZodBoolean>;
|
|
3906
3913
|
}, "strip", z.ZodTypeAny, {
|
|
3907
3914
|
request_id: string;
|
|
3908
3915
|
action: "init";
|
|
@@ -3930,6 +3937,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
|
|
|
3930
3937
|
};
|
|
3931
3938
|
} | undefined;
|
|
3932
3939
|
pinned_dependencies?: Record<string, string> | undefined;
|
|
3940
|
+
workspace_source?: boolean | undefined;
|
|
3933
3941
|
}, {
|
|
3934
3942
|
request_id: string;
|
|
3935
3943
|
action: "init";
|
|
@@ -3957,6 +3965,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
|
|
|
3957
3965
|
};
|
|
3958
3966
|
} | undefined;
|
|
3959
3967
|
pinned_dependencies?: Record<string, string> | undefined;
|
|
3968
|
+
workspace_source?: boolean | undefined;
|
|
3960
3969
|
}>, z.ZodObject<{
|
|
3961
3970
|
request_id: z.ZodString;
|
|
3962
3971
|
} & {
|
|
@@ -7193,6 +7202,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
|
|
|
7193
7202
|
types: z.ZodOptional<z.ZodBoolean>;
|
|
7194
7203
|
result_candidates: z.ZodOptional<z.ZodBoolean>;
|
|
7195
7204
|
max_handler_members: z.ZodOptional<z.ZodNumber>;
|
|
7205
|
+
foreign_maker_budget: z.ZodOptional<z.ZodNumber>;
|
|
7196
7206
|
}, "strip", z.ZodTypeAny, {
|
|
7197
7207
|
packages: string[];
|
|
7198
7208
|
request_id: string;
|
|
@@ -7204,6 +7214,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
|
|
|
7204
7214
|
exports?: Record<string, string[]> | undefined;
|
|
7205
7215
|
max_entries?: number | undefined;
|
|
7206
7216
|
max_handler_members?: number | undefined;
|
|
7217
|
+
foreign_maker_budget?: number | undefined;
|
|
7207
7218
|
}, {
|
|
7208
7219
|
packages: string[];
|
|
7209
7220
|
request_id: string;
|
|
@@ -7215,6 +7226,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
|
|
|
7215
7226
|
exports?: Record<string, string[]> | undefined;
|
|
7216
7227
|
max_entries?: number | undefined;
|
|
7217
7228
|
max_handler_members?: number | undefined;
|
|
7229
|
+
foreign_maker_budget?: number | undefined;
|
|
7218
7230
|
}>, z.ZodObject<{
|
|
7219
7231
|
request_id: z.ZodString;
|
|
7220
7232
|
} & {
|
|
@@ -158,6 +158,7 @@ export const InitRequestSchema = BaseRequestSchema.extend({
|
|
|
158
158
|
scan_root: z.string().min(1).optional(),
|
|
159
159
|
tsconfig_snapshot: TsconfigSnapshotSchema.optional(),
|
|
160
160
|
pinned_dependencies: PinnedDependencySnapshotSchema.optional(),
|
|
161
|
+
workspace_source: z.boolean().optional(),
|
|
161
162
|
});
|
|
162
163
|
export const BundleRequestSchema = BaseRequestSchema.extend({
|
|
163
164
|
action: z.literal('bundle'),
|
|
@@ -682,6 +683,7 @@ export const ListLibrarySurfaceRequestSchema = BaseRequestSchema.extend({
|
|
|
682
683
|
types: z.boolean().optional(),
|
|
683
684
|
result_candidates: z.boolean().optional(),
|
|
684
685
|
max_handler_members: z.number().int().positive().optional(),
|
|
686
|
+
foreign_maker_budget: z.number().int().positive().optional(),
|
|
685
687
|
});
|
|
686
688
|
// ============================================================================
|
|
687
689
|
// Discriminated Union Schema
|