@spotpatch/shared 1.8.0 → 1.9.0
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/chunk-K2UAPG7T.js +55 -0
- package/dist/chunk-K2UAPG7T.js.map +1 -0
- package/dist/data-flow-runtime-zwbvImvl.d.cts +672 -0
- package/dist/data-flow-runtime-zwbvImvl.d.ts +672 -0
- package/dist/data-flow-runtime.cjs +74 -0
- package/dist/data-flow-runtime.cjs.map +1 -0
- package/dist/data-flow-runtime.d.cts +2 -0
- package/dist/data-flow-runtime.d.ts +2 -0
- package/dist/data-flow-runtime.js +11 -0
- package/dist/data-flow-runtime.js.map +1 -0
- package/dist/index.cjs +700 -153
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +82 -14
- package/dist/index.d.ts +82 -14
- package/dist/index.js +655 -166
- package/dist/index.js.map +1 -1
- package/package.json +19 -2
package/dist/index.cjs
CHANGED
|
@@ -27,7 +27,22 @@ __export(index_exports, {
|
|
|
27
27
|
AGENT_JOB_STATUSES: () => AGENT_JOB_STATUSES,
|
|
28
28
|
AGENT_WORKSPACE_SNAPSHOT_LIMITS: () => AGENT_WORKSPACE_SNAPSHOT_LIMITS,
|
|
29
29
|
AGENT_WORKSPACE_STATES: () => AGENT_WORKSPACE_STATES,
|
|
30
|
+
DATA_FLOW_ASSOCIATION_KINDS: () => DATA_FLOW_ASSOCIATION_KINDS,
|
|
31
|
+
DATA_FLOW_DIAGNOSTIC_CODES: () => DATA_FLOW_DIAGNOSTIC_CODES,
|
|
32
|
+
DATA_FLOW_EXECUTION_STATES: () => DATA_FLOW_EXECUTION_STATES,
|
|
33
|
+
DATA_FLOW_FRESHNESS_STATES: () => DATA_FLOW_FRESHNESS_STATES,
|
|
34
|
+
DATA_FLOW_PROOF_STATES: () => DATA_FLOW_PROOF_STATES,
|
|
35
|
+
DATA_FLOW_QUERY_ADAPTER_MODULES: () => DATA_FLOW_QUERY_ADAPTER_MODULES,
|
|
36
|
+
DATA_FLOW_QUERY_HOOK_NAMES: () => DATA_FLOW_QUERY_HOOK_NAMES,
|
|
37
|
+
DATA_FLOW_SCHEMA_VERSION: () => DATA_FLOW_SCHEMA_VERSION,
|
|
38
|
+
DATA_FLOW_TRPC_CLIENT_FACTORY_NAMES: () => DATA_FLOW_TRPC_CLIENT_FACTORY_NAMES,
|
|
39
|
+
DATA_FLOW_TRPC_PROXY_FACTORY_NAMES: () => DATA_FLOW_TRPC_PROXY_FACTORY_NAMES,
|
|
40
|
+
DATA_FLOW_TRPC_REQUEST_METHODS: () => DATA_FLOW_TRPC_REQUEST_METHODS,
|
|
41
|
+
DATA_FLOW_TRPC_ROOT_FACTORY_NAMES: () => DATA_FLOW_TRPC_ROOT_FACTORY_NAMES,
|
|
42
|
+
DATA_FLOW_URL_QUERY_KEY_LIMIT: () => DATA_FLOW_URL_QUERY_KEY_LIMIT,
|
|
30
43
|
DEFAULT_AGENT_LIMITS: () => DEFAULT_AGENT_LIMITS,
|
|
44
|
+
DEFAULT_DATA_FLOW_LIMITS: () => DEFAULT_DATA_FLOW_LIMITS,
|
|
45
|
+
DEFAULT_RUNTIME_DATA_FLOW_LIMITS: () => DEFAULT_RUNTIME_DATA_FLOW_LIMITS,
|
|
31
46
|
ERROR_CODES: () => ERROR_CODES,
|
|
32
47
|
MAX_ANNOTATION_INSTRUCTION_CHARACTERS: () => MAX_ANNOTATION_INSTRUCTION_CHARACTERS,
|
|
33
48
|
MAX_ANNOTATION_TARGETS: () => MAX_ANNOTATION_TARGETS,
|
|
@@ -55,14 +70,22 @@ __export(index_exports, {
|
|
|
55
70
|
agentJobSnapshotSchema: () => agentJobSnapshotSchema,
|
|
56
71
|
agentWorkspaceHealthRequestSchema: () => agentWorkspaceHealthRequestSchema,
|
|
57
72
|
agentWorkspaceHealthSnapshotSchema: () => agentWorkspaceHealthSnapshotSchema,
|
|
73
|
+
componentDataFlowReportSchema: () => componentDataFlowReportSchema,
|
|
74
|
+
dataDependencySchema: () => dataDependencySchema,
|
|
75
|
+
dataFlowComponentReportRequestSchema: () => dataFlowComponentReportRequestSchema,
|
|
76
|
+
dataFlowPageReportRequestSchema: () => dataFlowPageReportRequestSchema,
|
|
58
77
|
formatSourceMarker: () => formatSourceMarker,
|
|
59
78
|
getAgentJobEndpoint: () => getAgentJobEndpoint,
|
|
60
79
|
isSensitiveName: () => isSensitiveName,
|
|
80
|
+
limitDataFlowReportCollections: () => limitDataFlowReportCollections,
|
|
81
|
+
networkObservationSchema: () => networkObservationSchema,
|
|
61
82
|
openEditorRequestSchema: () => openEditorRequestSchema,
|
|
83
|
+
pageDataFlowReportSchema: () => pageDataFlowReportSchema,
|
|
62
84
|
parseSourceMarker: () => parseSourceMarker,
|
|
63
85
|
redactSensitiveText: () => redactSensitiveText,
|
|
64
86
|
runtimeBootstrapRequestSchema: () => runtimeBootstrapRequestSchema,
|
|
65
87
|
runtimeConfigSchema: () => runtimeConfigSchema,
|
|
88
|
+
runtimeDataFlowConfigSchema: () => runtimeDataFlowConfigSchema,
|
|
66
89
|
sanitizeUrl: () => sanitizeUrl,
|
|
67
90
|
sourceContextRequestSchema: () => sourceContextRequestSchema,
|
|
68
91
|
spotAnnotationRequestSchema: () => spotAnnotationRequestSchema,
|
|
@@ -89,6 +112,9 @@ var ERROR_CODES = {
|
|
|
89
112
|
SOURCE_OUTSIDE_ROOT: "SOURCE_OUTSIDE_ROOT",
|
|
90
113
|
SOURCE_TOO_LARGE: "SOURCE_TOO_LARGE",
|
|
91
114
|
EDITOR_OPEN_FAILED: "EDITOR_OPEN_FAILED",
|
|
115
|
+
DATA_FLOW_DISABLED: "DATA_FLOW_DISABLED",
|
|
116
|
+
DATA_FLOW_SOURCE_STALE: "DATA_FLOW_SOURCE_STALE",
|
|
117
|
+
DATA_FLOW_ANALYSIS_CANCELLED: "DATA_FLOW_ANALYSIS_CANCELLED",
|
|
92
118
|
AI_DISABLED: "AI_DISABLED",
|
|
93
119
|
PROVIDER_NOT_CONFIGURED: "PROVIDER_NOT_CONFIGURED",
|
|
94
120
|
PROVIDER_AUTH_FAILED: "PROVIDER_AUTH_FAILED",
|
|
@@ -196,9 +222,485 @@ var SPOTPATCH_LOCALE_PREFERENCES = Object.freeze([
|
|
|
196
222
|
...SPOTPATCH_LOCALES
|
|
197
223
|
]);
|
|
198
224
|
|
|
199
|
-
// src/model/
|
|
225
|
+
// src/model/data-flow-adapters.ts
|
|
226
|
+
var DATA_FLOW_QUERY_ADAPTER_MODULES = Object.freeze([
|
|
227
|
+
"@tanstack/react-query",
|
|
228
|
+
"react-query"
|
|
229
|
+
]);
|
|
230
|
+
var DATA_FLOW_QUERY_HOOK_NAMES = Object.freeze([
|
|
231
|
+
"useInfiniteQuery",
|
|
232
|
+
"useMutation",
|
|
233
|
+
"useQuery"
|
|
234
|
+
]);
|
|
235
|
+
var DATA_FLOW_TRPC_CLIENT_FACTORY_NAMES = Object.freeze([
|
|
236
|
+
"createTRPCClient",
|
|
237
|
+
"createTRPCProxyClient"
|
|
238
|
+
]);
|
|
239
|
+
var DATA_FLOW_TRPC_PROXY_FACTORY_NAMES = Object.freeze([
|
|
240
|
+
"createTRPCNext",
|
|
241
|
+
"createTRPCReact"
|
|
242
|
+
]);
|
|
243
|
+
var DATA_FLOW_TRPC_ROOT_FACTORY_NAMES = Object.freeze([
|
|
244
|
+
...DATA_FLOW_TRPC_CLIENT_FACTORY_NAMES,
|
|
245
|
+
...DATA_FLOW_TRPC_PROXY_FACTORY_NAMES,
|
|
246
|
+
"createTRPCContext",
|
|
247
|
+
"createTRPCOptionsProxy"
|
|
248
|
+
]);
|
|
249
|
+
var DATA_FLOW_TRPC_REQUEST_METHODS = Object.freeze([
|
|
250
|
+
"infiniteQueryOptions",
|
|
251
|
+
"mutate",
|
|
252
|
+
"mutateAsync",
|
|
253
|
+
"mutationOptions",
|
|
254
|
+
"query",
|
|
255
|
+
"queryOptions",
|
|
256
|
+
"refetch",
|
|
257
|
+
"subscribe",
|
|
258
|
+
"subscriptionOptions",
|
|
259
|
+
"useInfiniteQuery",
|
|
260
|
+
"useMutation",
|
|
261
|
+
"useQuery",
|
|
262
|
+
"useSubscription",
|
|
263
|
+
"useSuspenseInfiniteQuery",
|
|
264
|
+
"useSuspenseQuery"
|
|
265
|
+
]);
|
|
266
|
+
|
|
267
|
+
// src/model/data-flow.ts
|
|
200
268
|
var import_zod = require("zod");
|
|
201
269
|
|
|
270
|
+
// src/model/data-flow-limits.ts
|
|
271
|
+
var DEFAULT_DATA_FLOW_LIMITS = Object.freeze({
|
|
272
|
+
observationMaxEntries: 100,
|
|
273
|
+
observationMaxBytes: 256 * 1024,
|
|
274
|
+
observationTtlMs: 3e5,
|
|
275
|
+
protocolRequestMaxBytes: 32 * 1024,
|
|
276
|
+
reportMaxBytes: 128 * 1024,
|
|
277
|
+
reportMaxEvidence: 200,
|
|
278
|
+
reportMaxDiagnostics: 256,
|
|
279
|
+
capabilityMaxReasons: 64,
|
|
280
|
+
graphMaxDepth: 5,
|
|
281
|
+
graphMaxModules: 50,
|
|
282
|
+
graphMaxCallsites: 100,
|
|
283
|
+
analysisTimeoutMs: 2e3,
|
|
284
|
+
reportMaxFields: 100
|
|
285
|
+
});
|
|
286
|
+
var DATA_FLOW_URL_QUERY_KEY_LIMIT = DEFAULT_DATA_FLOW_LIMITS.reportMaxFields;
|
|
287
|
+
var DEFAULT_RUNTIME_DATA_FLOW_LIMITS = Object.freeze({
|
|
288
|
+
observationMaxEntries: DEFAULT_DATA_FLOW_LIMITS.observationMaxEntries,
|
|
289
|
+
observationMaxBytes: DEFAULT_DATA_FLOW_LIMITS.observationMaxBytes,
|
|
290
|
+
observationTtlMs: DEFAULT_DATA_FLOW_LIMITS.observationTtlMs,
|
|
291
|
+
reportMaxBytes: DEFAULT_DATA_FLOW_LIMITS.reportMaxBytes
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
// src/model/data-flow-version.ts
|
|
295
|
+
var DATA_FLOW_SCHEMA_VERSION = 1;
|
|
296
|
+
|
|
297
|
+
// src/model/data-flow.ts
|
|
298
|
+
var DATA_FLOW_EXECUTION_STATES = Object.freeze([
|
|
299
|
+
"observed",
|
|
300
|
+
"declared-not-observed",
|
|
301
|
+
"not-applicable",
|
|
302
|
+
"unknown"
|
|
303
|
+
]);
|
|
304
|
+
var DATA_FLOW_PROOF_STATES = Object.freeze([
|
|
305
|
+
"proven",
|
|
306
|
+
"candidate",
|
|
307
|
+
"unavailable",
|
|
308
|
+
"conflict"
|
|
309
|
+
]);
|
|
310
|
+
var DATA_FLOW_ASSOCIATION_KINDS = Object.freeze([
|
|
311
|
+
"direct",
|
|
312
|
+
"transitive",
|
|
313
|
+
"upstream",
|
|
314
|
+
"possible",
|
|
315
|
+
"unassigned",
|
|
316
|
+
"unknown"
|
|
317
|
+
]);
|
|
318
|
+
var DATA_FLOW_FRESHNESS_STATES = Object.freeze([
|
|
319
|
+
"current",
|
|
320
|
+
"stale-source",
|
|
321
|
+
"stale-route",
|
|
322
|
+
"expired"
|
|
323
|
+
]);
|
|
324
|
+
var DATA_FLOW_DIAGNOSTIC_CODES = Object.freeze([
|
|
325
|
+
"DATA_FLOW_CAPABILITY_DISABLED",
|
|
326
|
+
"DATA_FLOW_CAPABILITY_PRELUDE_UNAVAILABLE",
|
|
327
|
+
"DATA_FLOW_CAPABILITY_UNSUPPORTED_FRAMEWORK",
|
|
328
|
+
"DATA_FLOW_SOURCE_UNAVAILABLE",
|
|
329
|
+
"DATA_FLOW_SOURCE_STALE",
|
|
330
|
+
"DATA_FLOW_ANALYSIS_TIMEOUT",
|
|
331
|
+
"DATA_FLOW_ANALYSIS_TRUNCATED",
|
|
332
|
+
"DATA_FLOW_ANALYSIS_UNRESOLVED_CALL",
|
|
333
|
+
"DATA_FLOW_OBSERVATION_UNASSIGNED",
|
|
334
|
+
"DATA_FLOW_OBSERVATION_DROPPED",
|
|
335
|
+
"DATA_FLOW_REDACTION_APPLIED",
|
|
336
|
+
"DATA_FLOW_AI_DISABLED"
|
|
337
|
+
]);
|
|
338
|
+
var boundedText = (maximum) => import_zod.z.string().trim().min(1).max(maximum);
|
|
339
|
+
var opaqueIdSchema = boundedText(128).regex(/^[A-Za-z0-9_-]+$/u);
|
|
340
|
+
var diagnosticCodeSchema = import_zod.z.enum(DATA_FLOW_DIAGNOSTIC_CODES);
|
|
341
|
+
var evidenceSourceSchema = import_zod.z.strictObject({
|
|
342
|
+
fileId: opaqueIdSchema,
|
|
343
|
+
displayPath: boundedText(1024),
|
|
344
|
+
line: import_zod.z.number().int().positive(),
|
|
345
|
+
column: import_zod.z.number().int().positive(),
|
|
346
|
+
sourceVersion: opaqueIdSchema
|
|
347
|
+
});
|
|
348
|
+
var sanitizedObservedUrlSchema = import_zod.z.strictObject({
|
|
349
|
+
origin: boundedText(512).optional(),
|
|
350
|
+
pathname: boundedText(2048),
|
|
351
|
+
queryKeys: import_zod.z.array(boundedText(256)).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxFields)
|
|
352
|
+
});
|
|
353
|
+
var dataParameterSchema = import_zod.z.strictObject({
|
|
354
|
+
path: boundedText(1024),
|
|
355
|
+
position: import_zod.z.enum([
|
|
356
|
+
"path",
|
|
357
|
+
"query",
|
|
358
|
+
"body",
|
|
359
|
+
"header",
|
|
360
|
+
"cookie",
|
|
361
|
+
"variable",
|
|
362
|
+
"form",
|
|
363
|
+
"unknown"
|
|
364
|
+
]),
|
|
365
|
+
type: boundedText(512).optional(),
|
|
366
|
+
source: boundedText(1024).optional(),
|
|
367
|
+
condition: boundedText(1024).optional(),
|
|
368
|
+
sensitive: import_zod.z.boolean(),
|
|
369
|
+
valueState: import_zod.z.literal("not-collected"),
|
|
370
|
+
evidenceIds: import_zod.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence)
|
|
371
|
+
});
|
|
372
|
+
var dataResponseSchema = import_zod.z.strictObject({
|
|
373
|
+
consumedFields: import_zod.z.array(boundedText(1024)).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxFields)
|
|
374
|
+
});
|
|
375
|
+
var requestOriginSchema = import_zod.z.strictObject({
|
|
376
|
+
componentSourceId: opaqueIdSchema.optional(),
|
|
377
|
+
triggerCallsiteId: opaqueIdSchema.optional(),
|
|
378
|
+
requestCallsiteId: opaqueIdSchema,
|
|
379
|
+
sourceVersion: opaqueIdSchema
|
|
380
|
+
});
|
|
381
|
+
var capabilityReasonSchema = import_zod.z.strictObject({
|
|
382
|
+
code: diagnosticCodeSchema,
|
|
383
|
+
retryable: import_zod.z.boolean()
|
|
384
|
+
});
|
|
385
|
+
var capabilitySchema = import_zod.z.strictObject({
|
|
386
|
+
enabled: import_zod.z.boolean(),
|
|
387
|
+
staticAnalysis: import_zod.z.enum(["available", "partial", "unavailable"]),
|
|
388
|
+
runtimeObservation: import_zod.z.literal("dispatch-only"),
|
|
389
|
+
responseShape: import_zod.z.literal("consumed-fields-only"),
|
|
390
|
+
aiAssistance: import_zod.z.literal("disabled"),
|
|
391
|
+
reasons: import_zod.z.array(capabilityReasonSchema).max(DEFAULT_DATA_FLOW_LIMITS.capabilityMaxReasons)
|
|
392
|
+
});
|
|
393
|
+
var evidenceSchema = import_zod.z.strictObject({
|
|
394
|
+
id: opaqueIdSchema,
|
|
395
|
+
kind: import_zod.z.enum([
|
|
396
|
+
"source-anchor",
|
|
397
|
+
"import-resolution",
|
|
398
|
+
"symbol-edge",
|
|
399
|
+
"trigger-edge",
|
|
400
|
+
"call-edge",
|
|
401
|
+
"data-binding",
|
|
402
|
+
"adapter-rule",
|
|
403
|
+
"runtime-observation",
|
|
404
|
+
"runtime-reference",
|
|
405
|
+
"diagnostic"
|
|
406
|
+
]),
|
|
407
|
+
source: evidenceSourceSchema.optional(),
|
|
408
|
+
adapter: import_zod.z.strictObject({ id: boundedText(128), version: boundedText(64) }).optional(),
|
|
409
|
+
summaryKey: boundedText(256)
|
|
410
|
+
});
|
|
411
|
+
var diagnosticSchema = import_zod.z.strictObject({
|
|
412
|
+
id: opaqueIdSchema,
|
|
413
|
+
code: diagnosticCodeSchema,
|
|
414
|
+
severity: import_zod.z.enum(["info", "warning", "error"]),
|
|
415
|
+
retryable: import_zod.z.boolean(),
|
|
416
|
+
evidenceIds: import_zod.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence)
|
|
417
|
+
});
|
|
418
|
+
var baselineSchema = import_zod.z.strictObject({
|
|
419
|
+
registryEpoch: opaqueIdSchema,
|
|
420
|
+
analyzerVersion: boundedText(64),
|
|
421
|
+
adapterSetHash: boundedText(128),
|
|
422
|
+
analyzedSourceVersions: import_zod.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.graphMaxModules)
|
|
423
|
+
});
|
|
424
|
+
var completenessSchema = import_zod.z.strictObject({
|
|
425
|
+
complete: import_zod.z.boolean(),
|
|
426
|
+
visitedModules: import_zod.z.number().int().nonnegative(),
|
|
427
|
+
visitedCallsites: import_zod.z.number().int().nonnegative(),
|
|
428
|
+
frontierCount: import_zod.z.number().int().nonnegative(),
|
|
429
|
+
truncatedBy: import_zod.z.enum(["depth", "modules", "callsites", "bytes", "timeout"]).optional()
|
|
430
|
+
});
|
|
431
|
+
var dataDependencySchema = import_zod.z.strictObject({
|
|
432
|
+
id: opaqueIdSchema,
|
|
433
|
+
kind: import_zod.z.enum(["http", "graphql", "rpc", "server-action", "unknown"]),
|
|
434
|
+
direction: import_zod.z.enum(["read", "write", "read-write", "unknown"]),
|
|
435
|
+
execution: import_zod.z.enum(DATA_FLOW_EXECUTION_STATES),
|
|
436
|
+
proof: import_zod.z.enum(DATA_FLOW_PROOF_STATES),
|
|
437
|
+
association: import_zod.z.enum(DATA_FLOW_ASSOCIATION_KINDS),
|
|
438
|
+
method: boundedText(32).optional(),
|
|
439
|
+
operation: boundedText(512).optional(),
|
|
440
|
+
url: sanitizedObservedUrlSchema.optional(),
|
|
441
|
+
parameters: import_zod.z.array(dataParameterSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxFields),
|
|
442
|
+
response: dataResponseSchema,
|
|
443
|
+
origin: requestOriginSchema.optional(),
|
|
444
|
+
suppliedBindings: import_zod.z.array(boundedText(1024)).max(DEFAULT_DATA_FLOW_LIMITS.graphMaxCallsites),
|
|
445
|
+
locationIds: import_zod.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.graphMaxCallsites),
|
|
446
|
+
evidenceIds: import_zod.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence),
|
|
447
|
+
observationIds: import_zod.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.observationMaxEntries)
|
|
448
|
+
});
|
|
449
|
+
var networkObservationSchema = import_zod.z.strictObject({
|
|
450
|
+
schemaVersion: import_zod.z.literal(DATA_FLOW_SCHEMA_VERSION),
|
|
451
|
+
id: opaqueIdSchema,
|
|
452
|
+
pageEpoch: opaqueIdSchema,
|
|
453
|
+
routeEpoch: opaqueIdSchema,
|
|
454
|
+
requestCallsiteId: opaqueIdSchema.optional(),
|
|
455
|
+
invocationId: opaqueIdSchema.optional(),
|
|
456
|
+
componentSourceId: opaqueIdSchema.optional(),
|
|
457
|
+
triggerCallsiteId: opaqueIdSchema.optional(),
|
|
458
|
+
sourceVersion: opaqueIdSchema.optional(),
|
|
459
|
+
transport: import_zod.z.enum(["fetch", "trpc", "xhr"]),
|
|
460
|
+
method: boundedText(32),
|
|
461
|
+
operation: boundedText(512).optional(),
|
|
462
|
+
url: sanitizedObservedUrlSchema,
|
|
463
|
+
outcome: import_zod.z.literal("dispatched"),
|
|
464
|
+
freshness: import_zod.z.enum(DATA_FLOW_FRESHNESS_STATES),
|
|
465
|
+
diagnosticIds: import_zod.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence)
|
|
466
|
+
});
|
|
467
|
+
var componentIdentitySchema = import_zod.z.strictObject({
|
|
468
|
+
componentSourceId: opaqueIdSchema.optional(),
|
|
469
|
+
displayName: boundedText(256).optional(),
|
|
470
|
+
source: evidenceSourceSchema
|
|
471
|
+
});
|
|
472
|
+
var componentDataFlowReportSchema = import_zod.z.strictObject({
|
|
473
|
+
schemaVersion: import_zod.z.literal(DATA_FLOW_SCHEMA_VERSION),
|
|
474
|
+
reportId: opaqueIdSchema,
|
|
475
|
+
baseline: baselineSchema,
|
|
476
|
+
capability: capabilitySchema,
|
|
477
|
+
component: componentIdentitySchema,
|
|
478
|
+
dependencies: import_zod.z.array(dataDependencySchema).max(DEFAULT_DATA_FLOW_LIMITS.graphMaxCallsites),
|
|
479
|
+
evidence: import_zod.z.array(evidenceSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence),
|
|
480
|
+
diagnostics: import_zod.z.array(diagnosticSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxDiagnostics),
|
|
481
|
+
completeness: completenessSchema
|
|
482
|
+
});
|
|
483
|
+
var pageDataFlowReportSchema = import_zod.z.strictObject({
|
|
484
|
+
schemaVersion: import_zod.z.literal(DATA_FLOW_SCHEMA_VERSION),
|
|
485
|
+
reportId: opaqueIdSchema,
|
|
486
|
+
baseline: baselineSchema,
|
|
487
|
+
capability: capabilitySchema,
|
|
488
|
+
dependencies: import_zod.z.array(dataDependencySchema).max(DEFAULT_DATA_FLOW_LIMITS.graphMaxCallsites),
|
|
489
|
+
evidence: import_zod.z.array(evidenceSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence),
|
|
490
|
+
diagnostics: import_zod.z.array(diagnosticSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxDiagnostics),
|
|
491
|
+
completeness: completenessSchema
|
|
492
|
+
});
|
|
493
|
+
var runtimeDataFlowConfigSchema = import_zod.z.strictObject({
|
|
494
|
+
enabled: import_zod.z.boolean(),
|
|
495
|
+
runtime: import_zod.z.literal("dispatch"),
|
|
496
|
+
limits: import_zod.z.strictObject({
|
|
497
|
+
observationMaxEntries: import_zod.z.number().int().positive(),
|
|
498
|
+
observationMaxBytes: import_zod.z.number().int().positive(),
|
|
499
|
+
observationTtlMs: import_zod.z.number().int().positive(),
|
|
500
|
+
reportMaxBytes: import_zod.z.number().int().positive()
|
|
501
|
+
})
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
// src/model/data-flow-budget.ts
|
|
505
|
+
function prefix(values, maximum) {
|
|
506
|
+
return Object.freeze(values.slice(0, Math.max(0, maximum)));
|
|
507
|
+
}
|
|
508
|
+
function limitDependency(dependency) {
|
|
509
|
+
const queryKeys = dependency.url === void 0 ? void 0 : prefix(dependency.url.queryKeys, DEFAULT_DATA_FLOW_LIMITS.reportMaxFields);
|
|
510
|
+
const parameters = prefix(
|
|
511
|
+
dependency.parameters,
|
|
512
|
+
DEFAULT_DATA_FLOW_LIMITS.reportMaxFields
|
|
513
|
+
).map(
|
|
514
|
+
(parameter) => Object.freeze({
|
|
515
|
+
...parameter,
|
|
516
|
+
evidenceIds: prefix(
|
|
517
|
+
parameter.evidenceIds,
|
|
518
|
+
DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence
|
|
519
|
+
)
|
|
520
|
+
})
|
|
521
|
+
);
|
|
522
|
+
const consumedFields = prefix(
|
|
523
|
+
dependency.response.consumedFields,
|
|
524
|
+
DEFAULT_DATA_FLOW_LIMITS.reportMaxFields
|
|
525
|
+
);
|
|
526
|
+
const suppliedBindings = prefix(
|
|
527
|
+
dependency.suppliedBindings,
|
|
528
|
+
DEFAULT_DATA_FLOW_LIMITS.graphMaxCallsites
|
|
529
|
+
);
|
|
530
|
+
const locationIds = prefix(
|
|
531
|
+
dependency.locationIds,
|
|
532
|
+
DEFAULT_DATA_FLOW_LIMITS.graphMaxCallsites
|
|
533
|
+
);
|
|
534
|
+
const evidenceIds = prefix(
|
|
535
|
+
dependency.evidenceIds,
|
|
536
|
+
DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence
|
|
537
|
+
);
|
|
538
|
+
const observationIds = prefix(
|
|
539
|
+
dependency.observationIds,
|
|
540
|
+
DEFAULT_DATA_FLOW_LIMITS.observationMaxEntries
|
|
541
|
+
);
|
|
542
|
+
const trimmed = queryKeys?.length !== dependency.url?.queryKeys.length || parameters.length !== dependency.parameters.length || parameters.some(
|
|
543
|
+
(parameter, index) => parameter.evidenceIds.length !== dependency.parameters[index]?.evidenceIds.length
|
|
544
|
+
) || consumedFields.length !== dependency.response.consumedFields.length || suppliedBindings.length !== dependency.suppliedBindings.length || locationIds.length !== dependency.locationIds.length || evidenceIds.length !== dependency.evidenceIds.length || observationIds.length !== dependency.observationIds.length;
|
|
545
|
+
if (!trimmed) return Object.freeze({ dependency, trimmed: false });
|
|
546
|
+
return Object.freeze({
|
|
547
|
+
dependency: Object.freeze({
|
|
548
|
+
...dependency,
|
|
549
|
+
...dependency.url === void 0 ? {} : {
|
|
550
|
+
url: Object.freeze({
|
|
551
|
+
...dependency.url,
|
|
552
|
+
queryKeys: queryKeys ?? Object.freeze([])
|
|
553
|
+
})
|
|
554
|
+
},
|
|
555
|
+
parameters: Object.freeze(parameters),
|
|
556
|
+
response: Object.freeze({ consumedFields }),
|
|
557
|
+
suppliedBindings,
|
|
558
|
+
locationIds,
|
|
559
|
+
evidenceIds,
|
|
560
|
+
observationIds
|
|
561
|
+
}),
|
|
562
|
+
trimmed: true
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
function referencedEvidenceIds(dependencies, diagnostics) {
|
|
566
|
+
return Object.freeze([
|
|
567
|
+
.../* @__PURE__ */ new Set([
|
|
568
|
+
...dependencies.flatMap((dependency) => [
|
|
569
|
+
...dependency.evidenceIds,
|
|
570
|
+
...dependency.parameters.flatMap((parameter) => parameter.evidenceIds)
|
|
571
|
+
]),
|
|
572
|
+
...diagnostics.flatMap((diagnostic) => diagnostic.evidenceIds)
|
|
573
|
+
])
|
|
574
|
+
]);
|
|
575
|
+
}
|
|
576
|
+
function prioritizeEvidence(evidence, referencedIds, retainUnreferenced) {
|
|
577
|
+
const byId = new Map(evidence.map((entry) => [entry.id, entry]));
|
|
578
|
+
const ordered = [];
|
|
579
|
+
const retained = /* @__PURE__ */ new Set();
|
|
580
|
+
for (const id of referencedIds) {
|
|
581
|
+
const entry = byId.get(id);
|
|
582
|
+
if (entry !== void 0 && !retained.has(id)) {
|
|
583
|
+
ordered.push(entry);
|
|
584
|
+
retained.add(id);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
if (retainUnreferenced) {
|
|
588
|
+
for (const entry of evidence) {
|
|
589
|
+
if (!retained.has(entry.id)) ordered.push(entry);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
return prefix(ordered, DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence);
|
|
593
|
+
}
|
|
594
|
+
function pruneEvidenceReferences(dependency, retainedIds) {
|
|
595
|
+
return Object.freeze({
|
|
596
|
+
...dependency,
|
|
597
|
+
parameters: Object.freeze(
|
|
598
|
+
dependency.parameters.map(
|
|
599
|
+
(parameter) => Object.freeze({
|
|
600
|
+
...parameter,
|
|
601
|
+
evidenceIds: Object.freeze(
|
|
602
|
+
parameter.evidenceIds.filter((id) => retainedIds.has(id))
|
|
603
|
+
)
|
|
604
|
+
})
|
|
605
|
+
)
|
|
606
|
+
),
|
|
607
|
+
evidenceIds: Object.freeze(
|
|
608
|
+
dependency.evidenceIds.filter((id) => retainedIds.has(id))
|
|
609
|
+
)
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
function truncationCode(mode) {
|
|
613
|
+
return mode === "analysis" ? "DATA_FLOW_ANALYSIS_TRUNCATED" : "DATA_FLOW_OBSERVATION_DROPPED";
|
|
614
|
+
}
|
|
615
|
+
function limitDataFlowReportCollections(report, options = {}) {
|
|
616
|
+
const maximumDependencies = Math.min(
|
|
617
|
+
Math.max(
|
|
618
|
+
0,
|
|
619
|
+
options.maximumDependencies ?? DEFAULT_DATA_FLOW_LIMITS.graphMaxCallsites
|
|
620
|
+
),
|
|
621
|
+
DEFAULT_DATA_FLOW_LIMITS.graphMaxCallsites
|
|
622
|
+
);
|
|
623
|
+
const dependencyResults = prefix(report.dependencies, maximumDependencies).map(
|
|
624
|
+
limitDependency
|
|
625
|
+
);
|
|
626
|
+
const dependencies = dependencyResults.map(({ dependency }) => dependency);
|
|
627
|
+
const analyzedSourceVersions = prefix(
|
|
628
|
+
report.baseline.analyzedSourceVersions,
|
|
629
|
+
DEFAULT_DATA_FLOW_LIMITS.graphMaxModules
|
|
630
|
+
);
|
|
631
|
+
const collectionTrimmed = report.dependencies.length > dependencies.length || dependencyResults.some(({ trimmed }) => trimmed) || report.baseline.analyzedSourceVersions.length > analyzedSourceVersions.length || report.capability.reasons.length > DEFAULT_DATA_FLOW_LIMITS.capabilityMaxReasons || report.evidence.length > DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence || report.diagnostics.length > DEFAULT_DATA_FLOW_LIMITS.reportMaxDiagnostics;
|
|
632
|
+
const truncated = options.forceTruncation === true || collectionTrimmed;
|
|
633
|
+
if (!truncated) return report;
|
|
634
|
+
const mode = options.mode ?? "analysis";
|
|
635
|
+
const code = truncationCode(mode);
|
|
636
|
+
const diagnosticId = `${report.reportId}_collection_${mode}`;
|
|
637
|
+
const reasons = Object.freeze([
|
|
638
|
+
...report.capability.reasons.filter((reason) => reason.code !== code).slice(0, DEFAULT_DATA_FLOW_LIMITS.capabilityMaxReasons - 1),
|
|
639
|
+
Object.freeze({ code, retryable: false })
|
|
640
|
+
]);
|
|
641
|
+
const diagnostics = Object.freeze([
|
|
642
|
+
...report.diagnostics.filter((diagnostic) => diagnostic.id !== diagnosticId).slice(0, DEFAULT_DATA_FLOW_LIMITS.reportMaxDiagnostics - 1),
|
|
643
|
+
Object.freeze({
|
|
644
|
+
id: diagnosticId,
|
|
645
|
+
code,
|
|
646
|
+
severity: "warning",
|
|
647
|
+
retryable: false,
|
|
648
|
+
evidenceIds: Object.freeze([])
|
|
649
|
+
})
|
|
650
|
+
]);
|
|
651
|
+
const referencedIds = referencedEvidenceIds(dependencies, diagnostics);
|
|
652
|
+
const evidence = prioritizeEvidence(
|
|
653
|
+
report.evidence,
|
|
654
|
+
referencedIds,
|
|
655
|
+
report.dependencies.length === dependencies.length
|
|
656
|
+
);
|
|
657
|
+
const retainedEvidenceIds = new Set(evidence.map(({ id }) => id));
|
|
658
|
+
const prunedDependencies = Object.freeze(
|
|
659
|
+
dependencies.map(
|
|
660
|
+
(dependency) => pruneEvidenceReferences(dependency, retainedEvidenceIds)
|
|
661
|
+
)
|
|
662
|
+
);
|
|
663
|
+
const prunedDiagnostics = Object.freeze(
|
|
664
|
+
diagnostics.map(
|
|
665
|
+
(diagnostic) => Object.freeze({
|
|
666
|
+
...diagnostic,
|
|
667
|
+
evidenceIds: Object.freeze(
|
|
668
|
+
diagnostic.evidenceIds.filter((id) => retainedEvidenceIds.has(id))
|
|
669
|
+
)
|
|
670
|
+
})
|
|
671
|
+
)
|
|
672
|
+
);
|
|
673
|
+
const removedDependencies = report.dependencies.length - dependencies.length;
|
|
674
|
+
const removedModules = report.baseline.analyzedSourceVersions.length - analyzedSourceVersions.length;
|
|
675
|
+
const derivedTruncation = removedModules > 0 && removedDependencies === 0 ? "modules" : "callsites";
|
|
676
|
+
return Object.freeze({
|
|
677
|
+
...report,
|
|
678
|
+
baseline: Object.freeze({
|
|
679
|
+
...report.baseline,
|
|
680
|
+
analyzedSourceVersions
|
|
681
|
+
}),
|
|
682
|
+
capability: Object.freeze({
|
|
683
|
+
...report.capability,
|
|
684
|
+
...mode === "analysis" && report.capability.staticAnalysis === "available" ? { staticAnalysis: "partial" } : {},
|
|
685
|
+
reasons
|
|
686
|
+
}),
|
|
687
|
+
dependencies: prunedDependencies,
|
|
688
|
+
evidence,
|
|
689
|
+
diagnostics: prunedDiagnostics,
|
|
690
|
+
...mode === "analysis" ? {
|
|
691
|
+
completeness: Object.freeze({
|
|
692
|
+
...report.completeness,
|
|
693
|
+
complete: false,
|
|
694
|
+
frontierCount: report.completeness.frontierCount + removedDependencies + removedModules + (collectionTrimmed && removedDependencies === 0 && removedModules === 0 ? 1 : 0),
|
|
695
|
+
truncatedBy: options.truncatedBy ?? report.completeness.truncatedBy ?? derivedTruncation
|
|
696
|
+
})
|
|
697
|
+
} : {}
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
// src/model/runtime-config.ts
|
|
702
|
+
var import_zod2 = require("zod");
|
|
703
|
+
|
|
202
704
|
// src/protocol/endpoints.ts
|
|
203
705
|
var SPOTPATCH_API_BASE = "/__spotpatch/v1";
|
|
204
706
|
var SPOTPATCH_TOKEN_HEADER = "X-SpotPatch-Token";
|
|
@@ -206,6 +708,8 @@ var SPOTPATCH_ENDPOINTS = Object.freeze({
|
|
|
206
708
|
bootstrap: `${SPOTPATCH_API_BASE}/bootstrap`,
|
|
207
709
|
sourceContext: `${SPOTPATCH_API_BASE}/source-context`,
|
|
208
710
|
openEditor: `${SPOTPATCH_API_BASE}/open-editor`,
|
|
711
|
+
dataFlowComponentReport: `${SPOTPATCH_API_BASE}/data-flow/component-report`,
|
|
712
|
+
dataFlowPageReport: `${SPOTPATCH_API_BASE}/data-flow/page-report`,
|
|
209
713
|
agentCapability: `${SPOTPATCH_API_BASE}/agent/capability`,
|
|
210
714
|
agentWorkspaceHealth: `${SPOTPATCH_API_BASE}/agent/workspace-health`,
|
|
211
715
|
agentJobs: `${SPOTPATCH_API_BASE}/agent/jobs`
|
|
@@ -287,39 +791,39 @@ var SPOTPATCH_NEXT_ROUTER_KINDS = Object.freeze([
|
|
|
287
791
|
"pages",
|
|
288
792
|
"hybrid"
|
|
289
793
|
]);
|
|
290
|
-
var
|
|
291
|
-
var profileIdSchema =
|
|
292
|
-
var runtimeAiModelSchema =
|
|
794
|
+
var boundedText2 = (maximum) => import_zod2.z.string().trim().min(1).max(maximum);
|
|
795
|
+
var profileIdSchema = import_zod2.z.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/u);
|
|
796
|
+
var runtimeAiModelSchema = import_zod2.z.strictObject({
|
|
293
797
|
id: profileIdSchema,
|
|
294
|
-
label:
|
|
798
|
+
label: boundedText2(100)
|
|
295
799
|
});
|
|
296
|
-
var runtimeAiProviderSchema =
|
|
800
|
+
var runtimeAiProviderSchema = import_zod2.z.strictObject({
|
|
297
801
|
id: profileIdSchema,
|
|
298
|
-
label:
|
|
299
|
-
protocol:
|
|
300
|
-
models:
|
|
802
|
+
label: boundedText2(100),
|
|
803
|
+
protocol: import_zod2.z.enum(["responses", "chat-completions"]),
|
|
804
|
+
models: import_zod2.z.array(runtimeAiModelSchema).min(1).max(64),
|
|
301
805
|
defaultModel: profileIdSchema
|
|
302
806
|
}).refine(
|
|
303
807
|
({ defaultModel, models }) => models.some(({ id }) => id === defaultModel) && new Set(models.map(({ id }) => id)).size === models.length,
|
|
304
808
|
{ message: "Runtime AI model profiles are inconsistent." }
|
|
305
809
|
);
|
|
306
|
-
var runtimeAiConfigSchema =
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
enabled:
|
|
310
|
-
providers:
|
|
810
|
+
var runtimeAiConfigSchema = import_zod2.z.discriminatedUnion("enabled", [
|
|
811
|
+
import_zod2.z.strictObject({ enabled: import_zod2.z.literal(false) }),
|
|
812
|
+
import_zod2.z.strictObject({
|
|
813
|
+
enabled: import_zod2.z.literal(true),
|
|
814
|
+
providers: import_zod2.z.array(runtimeAiProviderSchema).min(1).max(32),
|
|
311
815
|
defaultProvider: profileIdSchema,
|
|
312
|
-
applyMode:
|
|
816
|
+
applyMode: import_zod2.z.enum(AGENT_APPLY_MODES)
|
|
313
817
|
}).refine(
|
|
314
818
|
({ defaultProvider, providers }) => providers.some(({ id }) => id === defaultProvider) && new Set(providers.map(({ id }) => id)).size === providers.length,
|
|
315
819
|
{ message: "Runtime AI provider profiles are inconsistent." }
|
|
316
820
|
)
|
|
317
821
|
]);
|
|
318
|
-
var positiveInteger =
|
|
822
|
+
var positiveInteger = import_zod2.z.number().int().positive();
|
|
319
823
|
var runtimeConfigBaseShape = {
|
|
320
|
-
apiBase:
|
|
824
|
+
apiBase: import_zod2.z.literal(SPOTPATCH_API_BASE),
|
|
321
825
|
ai: runtimeAiConfigSchema,
|
|
322
|
-
budget:
|
|
826
|
+
budget: import_zod2.z.strictObject({
|
|
323
827
|
totalCharacters: positiveInteger,
|
|
324
828
|
domCharacters: positiveInteger,
|
|
325
829
|
cssCharacters: positiveInteger,
|
|
@@ -327,27 +831,28 @@ var runtimeConfigBaseShape = {
|
|
|
327
831
|
maxCodeLines: positiveInteger,
|
|
328
832
|
maxComponentDepth: positiveInteger
|
|
329
833
|
}),
|
|
330
|
-
debug:
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
834
|
+
debug: import_zod2.z.boolean(),
|
|
835
|
+
dataFlow: runtimeDataFlowConfigSchema,
|
|
836
|
+
editor: import_zod2.z.enum(SPOTPATCH_EDITOR_PREFERENCES),
|
|
837
|
+
frameworkVersion: boundedText2(64),
|
|
838
|
+
locale: import_zod2.z.enum(SPOTPATCH_LOCALE_PREFERENCES),
|
|
839
|
+
maxTargets: import_zod2.z.number().int().min(1).max(MAX_ANNOTATION_TARGETS),
|
|
840
|
+
redact: import_zod2.z.boolean(),
|
|
841
|
+
sessionId: import_zod2.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/u),
|
|
842
|
+
sessionToken: import_zod2.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/u),
|
|
843
|
+
shortcut: boundedText2(128),
|
|
844
|
+
spotPatchVersion: boundedText2(64)
|
|
340
845
|
};
|
|
341
|
-
var runtimeConfigSchema =
|
|
342
|
-
|
|
846
|
+
var runtimeConfigSchema = import_zod2.z.discriminatedUnion("framework", [
|
|
847
|
+
import_zod2.z.strictObject({
|
|
343
848
|
...runtimeConfigBaseShape,
|
|
344
|
-
framework:
|
|
849
|
+
framework: import_zod2.z.literal("vite")
|
|
345
850
|
}),
|
|
346
|
-
|
|
851
|
+
import_zod2.z.strictObject({
|
|
347
852
|
...runtimeConfigBaseShape,
|
|
348
|
-
bundler:
|
|
349
|
-
framework:
|
|
350
|
-
routerKind:
|
|
853
|
+
bundler: import_zod2.z.enum(SPOTPATCH_NEXT_BUNDLERS),
|
|
854
|
+
framework: import_zod2.z.literal("next"),
|
|
855
|
+
routerKind: import_zod2.z.enum(SPOTPATCH_NEXT_ROUTER_KINDS)
|
|
351
856
|
})
|
|
352
857
|
]);
|
|
353
858
|
|
|
@@ -375,90 +880,109 @@ function parseSourceMarker(value) {
|
|
|
375
880
|
}
|
|
376
881
|
|
|
377
882
|
// src/protocol/requests.ts
|
|
378
|
-
var
|
|
379
|
-
var runtimeBootstrapRequestSchema =
|
|
380
|
-
var sourceCoordinatesSchema =
|
|
381
|
-
fileId:
|
|
382
|
-
line:
|
|
383
|
-
column:
|
|
883
|
+
var import_zod3 = require("zod");
|
|
884
|
+
var runtimeBootstrapRequestSchema = import_zod3.z.strictObject({});
|
|
885
|
+
var sourceCoordinatesSchema = import_zod3.z.strictObject({
|
|
886
|
+
fileId: import_zod3.z.string().min(1).max(128),
|
|
887
|
+
line: import_zod3.z.number().int().positive(),
|
|
888
|
+
column: import_zod3.z.number().int().positive()
|
|
384
889
|
});
|
|
385
890
|
var sourceContextRequestSchema = sourceCoordinatesSchema.extend({
|
|
386
|
-
maxLines:
|
|
891
|
+
maxLines: import_zod3.z.number().int().positive()
|
|
387
892
|
}).strict();
|
|
388
893
|
var openEditorRequestSchema = sourceCoordinatesSchema.strict();
|
|
389
|
-
var
|
|
390
|
-
|
|
391
|
-
|
|
894
|
+
var dataFlowSourceCoordinatesRequestSchema = sourceCoordinatesSchema.extend({
|
|
895
|
+
schemaVersion: import_zod3.z.literal(1),
|
|
896
|
+
sourceVersion: import_zod3.z.string().min(1).max(128).optional()
|
|
897
|
+
}).strict();
|
|
898
|
+
var dataFlowComponentIdentityRequestSchema = import_zod3.z.strictObject({
|
|
899
|
+
schemaVersion: import_zod3.z.literal(1),
|
|
900
|
+
componentSourceId: import_zod3.z.string().min(1).max(128),
|
|
901
|
+
sourceVersion: import_zod3.z.string().min(1).max(128)
|
|
902
|
+
});
|
|
903
|
+
var dataFlowComponentReportRequestSchema = import_zod3.z.union([
|
|
904
|
+
dataFlowSourceCoordinatesRequestSchema,
|
|
905
|
+
dataFlowComponentIdentityRequestSchema
|
|
906
|
+
]);
|
|
907
|
+
var dataFlowPageReportRequestSchema = import_zod3.z.strictObject({
|
|
908
|
+
schemaVersion: import_zod3.z.literal(1),
|
|
909
|
+
targets: import_zod3.z.array(dataFlowComponentReportRequestSchema).min(1).max(MAX_ANNOTATION_TARGETS)
|
|
910
|
+
});
|
|
911
|
+
var profileIdSchema2 = import_zod3.z.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/);
|
|
912
|
+
var boundedString = (maximum) => import_zod3.z.string().max(maximum);
|
|
913
|
+
var sourceRefSchema = import_zod3.z.strictObject({
|
|
392
914
|
fileId: boundedString(128).optional(),
|
|
393
915
|
relativePath: boundedString(1024).optional(),
|
|
394
|
-
line:
|
|
395
|
-
column:
|
|
396
|
-
origin:
|
|
397
|
-
confidence:
|
|
916
|
+
line: import_zod3.z.number().int().positive().optional(),
|
|
917
|
+
column: import_zod3.z.number().int().positive().optional(),
|
|
918
|
+
origin: import_zod3.z.enum(["jsx-host", "react-fiber", "dom-ancestor", "none"]),
|
|
919
|
+
confidence: import_zod3.z.enum(["exact", "probable", "approximate", "unknown"])
|
|
398
920
|
});
|
|
399
|
-
var matchedStyleRuleSchema =
|
|
921
|
+
var matchedStyleRuleSchema = import_zod3.z.strictObject({
|
|
400
922
|
selector: boundedString(2048),
|
|
401
923
|
declarations: boundedString(8192),
|
|
402
924
|
source: boundedString(1024).optional(),
|
|
403
925
|
media: boundedString(1024).optional()
|
|
404
926
|
});
|
|
405
|
-
var codeContextSchema =
|
|
927
|
+
var codeContextSchema = import_zod3.z.strictObject({
|
|
406
928
|
relativePath: boundedString(1024),
|
|
407
|
-
language:
|
|
408
|
-
startLine:
|
|
409
|
-
endLine:
|
|
929
|
+
language: import_zod3.z.enum(["tsx", "jsx"]),
|
|
930
|
+
startLine: import_zod3.z.number().int().positive(),
|
|
931
|
+
endLine: import_zod3.z.number().int().positive(),
|
|
410
932
|
excerpt: boundedString(16e3),
|
|
411
|
-
boundary:
|
|
933
|
+
boundary: import_zod3.z.enum(["component", "nearby-lines"])
|
|
412
934
|
});
|
|
413
|
-
var pageContextSchema =
|
|
935
|
+
var pageContextSchema = import_zod3.z.strictObject({
|
|
414
936
|
url: boundedString(2048),
|
|
415
937
|
pathname: boundedString(2048),
|
|
416
938
|
title: boundedString(1024),
|
|
417
|
-
viewportWidth:
|
|
418
|
-
viewportHeight:
|
|
419
|
-
devicePixelRatio:
|
|
939
|
+
viewportWidth: import_zod3.z.number().nonnegative(),
|
|
940
|
+
viewportHeight: import_zod3.z.number().nonnegative(),
|
|
941
|
+
devicePixelRatio: import_zod3.z.number().positive()
|
|
420
942
|
});
|
|
421
|
-
var spotTargetContextRequestSchema =
|
|
422
|
-
instruction:
|
|
943
|
+
var spotTargetContextRequestSchema = import_zod3.z.strictObject({
|
|
944
|
+
instruction: import_zod3.z.string().trim().min(1).max(MAX_TARGET_INSTRUCTION_CHARACTERS),
|
|
423
945
|
page: pageContextSchema.optional(),
|
|
424
946
|
source: sourceRefSchema,
|
|
425
|
-
react:
|
|
426
|
-
supported:
|
|
947
|
+
react: import_zod3.z.strictObject({
|
|
948
|
+
supported: import_zod3.z.boolean(),
|
|
427
949
|
version: boundedString(64).optional(),
|
|
428
950
|
componentName: boundedString(256).optional(),
|
|
429
|
-
|
|
951
|
+
componentSourceId: boundedString(128).optional(),
|
|
952
|
+
sourceVersion: boundedString(128).optional(),
|
|
953
|
+
componentStack: import_zod3.z.array(boundedString(256)).max(64),
|
|
430
954
|
source: sourceRefSchema.optional()
|
|
431
955
|
}),
|
|
432
|
-
element:
|
|
956
|
+
element: import_zod3.z.strictObject({
|
|
433
957
|
tagName: boundedString(128),
|
|
434
958
|
selector: boundedString(2048),
|
|
435
959
|
sanitizedHtml: boundedString(8192),
|
|
436
960
|
textPreview: boundedString(2048).optional(),
|
|
437
961
|
role: boundedString(256).optional(),
|
|
438
|
-
rect:
|
|
439
|
-
x:
|
|
440
|
-
y:
|
|
441
|
-
width:
|
|
442
|
-
height:
|
|
962
|
+
rect: import_zod3.z.strictObject({
|
|
963
|
+
x: import_zod3.z.number(),
|
|
964
|
+
y: import_zod3.z.number(),
|
|
965
|
+
width: import_zod3.z.number().nonnegative(),
|
|
966
|
+
height: import_zod3.z.number().nonnegative()
|
|
443
967
|
})
|
|
444
968
|
}),
|
|
445
|
-
styles:
|
|
446
|
-
classNames:
|
|
969
|
+
styles: import_zod3.z.strictObject({
|
|
970
|
+
classNames: import_zod3.z.array(boundedString(512)).max(256),
|
|
447
971
|
inlineStyle: boundedString(8192).optional(),
|
|
448
|
-
matchedRules:
|
|
449
|
-
computed:
|
|
450
|
-
warnings:
|
|
972
|
+
matchedRules: import_zod3.z.array(matchedStyleRuleSchema).max(256),
|
|
973
|
+
computed: import_zod3.z.record(boundedString(256), boundedString(2048)),
|
|
974
|
+
warnings: import_zod3.z.array(boundedString(1024)).max(64)
|
|
451
975
|
}),
|
|
452
976
|
code: codeContextSchema.optional(),
|
|
453
|
-
warnings:
|
|
977
|
+
warnings: import_zod3.z.array(boundedString(1024)).max(64)
|
|
454
978
|
});
|
|
455
|
-
var spotAnnotationRequestSchema =
|
|
456
|
-
schemaVersion:
|
|
979
|
+
var spotAnnotationRequestSchema = import_zod3.z.strictObject({
|
|
980
|
+
schemaVersion: import_zod3.z.literal(3),
|
|
457
981
|
id: boundedString(128),
|
|
458
|
-
locale:
|
|
982
|
+
locale: import_zod3.z.enum(SPOTPATCH_LOCALES),
|
|
459
983
|
page: pageContextSchema,
|
|
460
|
-
targets:
|
|
461
|
-
createdAt:
|
|
984
|
+
targets: import_zod3.z.array(spotTargetContextRequestSchema).min(1).max(MAX_ANNOTATION_TARGETS),
|
|
985
|
+
createdAt: import_zod3.z.iso.datetime()
|
|
462
986
|
}).superRefine((annotation, context) => {
|
|
463
987
|
const total = annotation.targets.reduce(
|
|
464
988
|
(characters, target) => characters + target.instruction.length,
|
|
@@ -472,53 +996,53 @@ var spotAnnotationRequestSchema = import_zod2.z.strictObject({
|
|
|
472
996
|
});
|
|
473
997
|
}
|
|
474
998
|
});
|
|
475
|
-
var agentCapabilityRequestSchema =
|
|
999
|
+
var agentCapabilityRequestSchema = import_zod3.z.strictObject({
|
|
476
1000
|
providerProfileId: profileIdSchema2,
|
|
477
1001
|
modelProfileId: profileIdSchema2
|
|
478
1002
|
});
|
|
479
|
-
var agentWorkspaceHealthRequestSchema =
|
|
480
|
-
var agentJobCreateRequestSchema =
|
|
1003
|
+
var agentWorkspaceHealthRequestSchema = import_zod3.z.strictObject({});
|
|
1004
|
+
var agentJobCreateRequestSchema = import_zod3.z.strictObject({
|
|
481
1005
|
annotation: spotAnnotationRequestSchema,
|
|
482
|
-
applyMode:
|
|
1006
|
+
applyMode: import_zod3.z.enum(AGENT_APPLY_MODES).optional(),
|
|
483
1007
|
providerProfileId: profileIdSchema2,
|
|
484
1008
|
modelProfileId: profileIdSchema2,
|
|
485
|
-
providerDataConsent:
|
|
486
|
-
trustedFastModeConsent:
|
|
487
|
-
workingTreeMode:
|
|
1009
|
+
providerDataConsent: import_zod3.z.literal(true),
|
|
1010
|
+
trustedFastModeConsent: import_zod3.z.literal(true).optional(),
|
|
1011
|
+
workingTreeMode: import_zod3.z.enum(["require-clean", "include-local-changes"]).default("require-clean")
|
|
488
1012
|
});
|
|
489
|
-
var agentJobActionRequestSchema =
|
|
1013
|
+
var agentJobActionRequestSchema = import_zod3.z.strictObject({});
|
|
490
1014
|
|
|
491
1015
|
// src/protocol/agent-schemas.ts
|
|
492
|
-
var
|
|
493
|
-
var profileIdSchema3 =
|
|
494
|
-
var boundedString2 = (maximum) =>
|
|
495
|
-
var errorCodeSchema =
|
|
496
|
-
var agentCapabilitySnapshotSchema =
|
|
1016
|
+
var import_zod4 = require("zod");
|
|
1017
|
+
var profileIdSchema3 = import_zod4.z.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/);
|
|
1018
|
+
var boundedString2 = (maximum) => import_zod4.z.string().max(maximum);
|
|
1019
|
+
var errorCodeSchema = import_zod4.z.enum(ERROR_CODES);
|
|
1020
|
+
var agentCapabilitySnapshotSchema = import_zod4.z.strictObject({
|
|
497
1021
|
providerProfileId: profileIdSchema3,
|
|
498
1022
|
providerLabel: boundedString2(100),
|
|
499
1023
|
modelProfileId: profileIdSchema3,
|
|
500
1024
|
modelLabel: boundedString2(100),
|
|
501
|
-
protocol:
|
|
502
|
-
state:
|
|
503
|
-
authenticated:
|
|
504
|
-
modelAvailable:
|
|
505
|
-
toolCalling:
|
|
506
|
-
toolResultContinuation:
|
|
507
|
-
streaming:
|
|
508
|
-
checkedAt:
|
|
1025
|
+
protocol: import_zod4.z.enum(["responses", "chat-completions"]),
|
|
1026
|
+
state: import_zod4.z.enum(AGENT_CAPABILITY_STATES),
|
|
1027
|
+
authenticated: import_zod4.z.boolean(),
|
|
1028
|
+
modelAvailable: import_zod4.z.boolean(),
|
|
1029
|
+
toolCalling: import_zod4.z.boolean(),
|
|
1030
|
+
toolResultContinuation: import_zod4.z.boolean(),
|
|
1031
|
+
streaming: import_zod4.z.boolean(),
|
|
1032
|
+
checkedAt: import_zod4.z.iso.datetime().optional(),
|
|
509
1033
|
errorCode: errorCodeSchema.optional()
|
|
510
1034
|
});
|
|
511
|
-
var agentWorkspaceHealthSnapshotSchema =
|
|
512
|
-
state:
|
|
513
|
-
checkedAt:
|
|
514
|
-
changes:
|
|
515
|
-
staged:
|
|
516
|
-
unstaged:
|
|
517
|
-
untracked:
|
|
518
|
-
conflicted:
|
|
519
|
-
total:
|
|
1035
|
+
var agentWorkspaceHealthSnapshotSchema = import_zod4.z.strictObject({
|
|
1036
|
+
state: import_zod4.z.enum(AGENT_WORKSPACE_STATES),
|
|
1037
|
+
checkedAt: import_zod4.z.iso.datetime(),
|
|
1038
|
+
changes: import_zod4.z.strictObject({
|
|
1039
|
+
staged: import_zod4.z.number().int().nonnegative(),
|
|
1040
|
+
unstaged: import_zod4.z.number().int().nonnegative(),
|
|
1041
|
+
untracked: import_zod4.z.number().int().nonnegative(),
|
|
1042
|
+
conflicted: import_zod4.z.number().int().nonnegative(),
|
|
1043
|
+
total: import_zod4.z.number().int().nonnegative()
|
|
520
1044
|
}),
|
|
521
|
-
canIncludeLocalChanges:
|
|
1045
|
+
canIncludeLocalChanges: import_zod4.z.boolean(),
|
|
522
1046
|
errorCode: errorCodeSchema.optional()
|
|
523
1047
|
}).refine(
|
|
524
1048
|
({ state, changes, canIncludeLocalChanges, errorCode }) => {
|
|
@@ -536,42 +1060,42 @@ var agentWorkspaceHealthSnapshotSchema = import_zod3.z.strictObject({
|
|
|
536
1060
|
},
|
|
537
1061
|
{ message: "Agent workspace health fields are inconsistent." }
|
|
538
1062
|
);
|
|
539
|
-
var agentChangedFileSchema =
|
|
1063
|
+
var agentChangedFileSchema = import_zod4.z.strictObject({
|
|
540
1064
|
relativePath: boundedString2(1024),
|
|
541
|
-
kind:
|
|
542
|
-
additions:
|
|
543
|
-
deletions:
|
|
1065
|
+
kind: import_zod4.z.enum(AGENT_FILE_CHANGE_KINDS),
|
|
1066
|
+
additions: import_zod4.z.number().int().nonnegative(),
|
|
1067
|
+
deletions: import_zod4.z.number().int().nonnegative()
|
|
544
1068
|
});
|
|
545
|
-
var agentCheckResultSchema =
|
|
1069
|
+
var agentCheckResultSchema = import_zod4.z.strictObject({
|
|
546
1070
|
checkId: profileIdSchema3,
|
|
547
1071
|
label: boundedString2(100),
|
|
548
|
-
status:
|
|
549
|
-
durationMs:
|
|
1072
|
+
status: import_zod4.z.enum(AGENT_CHECK_STATUSES),
|
|
1073
|
+
durationMs: import_zod4.z.number().int().nonnegative(),
|
|
550
1074
|
output: boundedString2(8e4)
|
|
551
1075
|
});
|
|
552
|
-
var agentJobSnapshotSchema =
|
|
553
|
-
jobId:
|
|
554
|
-
status:
|
|
1076
|
+
var agentJobSnapshotSchema = import_zod4.z.strictObject({
|
|
1077
|
+
jobId: import_zod4.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
|
|
1078
|
+
status: import_zod4.z.enum(AGENT_JOB_STATUSES),
|
|
555
1079
|
providerProfileId: profileIdSchema3,
|
|
556
1080
|
providerLabel: boundedString2(100),
|
|
557
1081
|
modelProfileId: profileIdSchema3,
|
|
558
1082
|
modelLabel: boundedString2(100),
|
|
559
1083
|
phaseMessage: boundedString2(1024),
|
|
560
|
-
createdAt:
|
|
561
|
-
updatedAt:
|
|
562
|
-
canCancel:
|
|
563
|
-
canApply:
|
|
564
|
-
canRevert:
|
|
1084
|
+
createdAt: import_zod4.z.iso.datetime(),
|
|
1085
|
+
updatedAt: import_zod4.z.iso.datetime(),
|
|
1086
|
+
canCancel: import_zod4.z.boolean(),
|
|
1087
|
+
canApply: import_zod4.z.boolean(),
|
|
1088
|
+
canRevert: import_zod4.z.boolean(),
|
|
565
1089
|
errorCode: errorCodeSchema.optional()
|
|
566
1090
|
});
|
|
567
|
-
var agentJobResultSchema =
|
|
568
|
-
jobId:
|
|
1091
|
+
var agentJobResultSchema = import_zod4.z.strictObject({
|
|
1092
|
+
jobId: import_zod4.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
|
|
569
1093
|
summary: boundedString2(8e4),
|
|
570
1094
|
diff: boundedString2(1e6),
|
|
571
|
-
files:
|
|
572
|
-
checks:
|
|
1095
|
+
files: import_zod4.z.array(agentChangedFileSchema).max(100),
|
|
1096
|
+
checks: import_zod4.z.array(agentCheckResultSchema).max(100)
|
|
573
1097
|
});
|
|
574
|
-
var agentJobResultResponseSchema =
|
|
1098
|
+
var agentJobResultResponseSchema = import_zod4.z.strictObject({
|
|
575
1099
|
snapshot: agentJobSnapshotSchema,
|
|
576
1100
|
result: agentJobResultSchema.optional()
|
|
577
1101
|
}).superRefine((value, context) => {
|
|
@@ -583,44 +1107,44 @@ var agentJobResultResponseSchema = import_zod3.z.strictObject({
|
|
|
583
1107
|
});
|
|
584
1108
|
}
|
|
585
1109
|
});
|
|
586
|
-
var agentJobEventBaseSchema =
|
|
587
|
-
schemaVersion:
|
|
588
|
-
sequence:
|
|
589
|
-
jobId:
|
|
590
|
-
status:
|
|
591
|
-
timestamp:
|
|
1110
|
+
var agentJobEventBaseSchema = import_zod4.z.strictObject({
|
|
1111
|
+
schemaVersion: import_zod4.z.literal(2),
|
|
1112
|
+
sequence: import_zod4.z.number().int().positive(),
|
|
1113
|
+
jobId: import_zod4.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
|
|
1114
|
+
status: import_zod4.z.enum(AGENT_JOB_STATUSES),
|
|
1115
|
+
timestamp: import_zod4.z.iso.datetime()
|
|
592
1116
|
});
|
|
593
|
-
var agentJobEventSchema =
|
|
1117
|
+
var agentJobEventSchema = import_zod4.z.discriminatedUnion("type", [
|
|
594
1118
|
agentJobEventBaseSchema.extend({
|
|
595
|
-
type:
|
|
596
|
-
data:
|
|
1119
|
+
type: import_zod4.z.literal("snapshot"),
|
|
1120
|
+
data: import_zod4.z.strictObject({ snapshot: agentJobSnapshotSchema })
|
|
597
1121
|
}),
|
|
598
1122
|
agentJobEventBaseSchema.extend({
|
|
599
|
-
type:
|
|
600
|
-
data:
|
|
1123
|
+
type: import_zod4.z.literal("phase"),
|
|
1124
|
+
data: import_zod4.z.strictObject({ message: boundedString2(1024) })
|
|
601
1125
|
}),
|
|
602
1126
|
agentJobEventBaseSchema.extend({
|
|
603
|
-
type:
|
|
604
|
-
data:
|
|
605
|
-
turn:
|
|
1127
|
+
type: import_zod4.z.literal("tool"),
|
|
1128
|
+
data: import_zod4.z.strictObject({
|
|
1129
|
+
turn: import_zod4.z.number().int().positive(),
|
|
606
1130
|
toolCallId: boundedString2(256),
|
|
607
1131
|
toolName: boundedString2(100),
|
|
608
|
-
state:
|
|
1132
|
+
state: import_zod4.z.enum(["started", "succeeded", "failed"]),
|
|
609
1133
|
relativePath: boundedString2(1024).optional(),
|
|
610
1134
|
checkLabel: boundedString2(100).optional()
|
|
611
1135
|
})
|
|
612
1136
|
}),
|
|
613
1137
|
agentJobEventBaseSchema.extend({
|
|
614
|
-
type:
|
|
615
|
-
data:
|
|
1138
|
+
type: import_zod4.z.literal("check"),
|
|
1139
|
+
data: import_zod4.z.strictObject({ result: agentCheckResultSchema })
|
|
616
1140
|
}),
|
|
617
1141
|
agentJobEventBaseSchema.extend({
|
|
618
|
-
type:
|
|
619
|
-
data:
|
|
1142
|
+
type: import_zod4.z.literal("result-ready"),
|
|
1143
|
+
data: import_zod4.z.strictObject({ hasResult: import_zod4.z.literal(true) })
|
|
620
1144
|
}),
|
|
621
1145
|
agentJobEventBaseSchema.extend({
|
|
622
|
-
type:
|
|
623
|
-
data:
|
|
1146
|
+
type: import_zod4.z.literal("error"),
|
|
1147
|
+
data: import_zod4.z.strictObject({
|
|
624
1148
|
code: errorCodeSchema,
|
|
625
1149
|
message: boundedString2(1024)
|
|
626
1150
|
})
|
|
@@ -656,7 +1180,22 @@ var SPOTPATCH_REPOSITORY_URL = "https://github.com/huanglvjing/spotpatch";
|
|
|
656
1180
|
AGENT_JOB_STATUSES,
|
|
657
1181
|
AGENT_WORKSPACE_SNAPSHOT_LIMITS,
|
|
658
1182
|
AGENT_WORKSPACE_STATES,
|
|
1183
|
+
DATA_FLOW_ASSOCIATION_KINDS,
|
|
1184
|
+
DATA_FLOW_DIAGNOSTIC_CODES,
|
|
1185
|
+
DATA_FLOW_EXECUTION_STATES,
|
|
1186
|
+
DATA_FLOW_FRESHNESS_STATES,
|
|
1187
|
+
DATA_FLOW_PROOF_STATES,
|
|
1188
|
+
DATA_FLOW_QUERY_ADAPTER_MODULES,
|
|
1189
|
+
DATA_FLOW_QUERY_HOOK_NAMES,
|
|
1190
|
+
DATA_FLOW_SCHEMA_VERSION,
|
|
1191
|
+
DATA_FLOW_TRPC_CLIENT_FACTORY_NAMES,
|
|
1192
|
+
DATA_FLOW_TRPC_PROXY_FACTORY_NAMES,
|
|
1193
|
+
DATA_FLOW_TRPC_REQUEST_METHODS,
|
|
1194
|
+
DATA_FLOW_TRPC_ROOT_FACTORY_NAMES,
|
|
1195
|
+
DATA_FLOW_URL_QUERY_KEY_LIMIT,
|
|
659
1196
|
DEFAULT_AGENT_LIMITS,
|
|
1197
|
+
DEFAULT_DATA_FLOW_LIMITS,
|
|
1198
|
+
DEFAULT_RUNTIME_DATA_FLOW_LIMITS,
|
|
660
1199
|
ERROR_CODES,
|
|
661
1200
|
MAX_ANNOTATION_INSTRUCTION_CHARACTERS,
|
|
662
1201
|
MAX_ANNOTATION_TARGETS,
|
|
@@ -684,14 +1223,22 @@ var SPOTPATCH_REPOSITORY_URL = "https://github.com/huanglvjing/spotpatch";
|
|
|
684
1223
|
agentJobSnapshotSchema,
|
|
685
1224
|
agentWorkspaceHealthRequestSchema,
|
|
686
1225
|
agentWorkspaceHealthSnapshotSchema,
|
|
1226
|
+
componentDataFlowReportSchema,
|
|
1227
|
+
dataDependencySchema,
|
|
1228
|
+
dataFlowComponentReportRequestSchema,
|
|
1229
|
+
dataFlowPageReportRequestSchema,
|
|
687
1230
|
formatSourceMarker,
|
|
688
1231
|
getAgentJobEndpoint,
|
|
689
1232
|
isSensitiveName,
|
|
1233
|
+
limitDataFlowReportCollections,
|
|
1234
|
+
networkObservationSchema,
|
|
690
1235
|
openEditorRequestSchema,
|
|
1236
|
+
pageDataFlowReportSchema,
|
|
691
1237
|
parseSourceMarker,
|
|
692
1238
|
redactSensitiveText,
|
|
693
1239
|
runtimeBootstrapRequestSchema,
|
|
694
1240
|
runtimeConfigSchema,
|
|
1241
|
+
runtimeDataFlowConfigSchema,
|
|
695
1242
|
sanitizeUrl,
|
|
696
1243
|
sourceContextRequestSchema,
|
|
697
1244
|
spotAnnotationRequestSchema,
|