@dev.fast/whiteboard 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +146 -2
- package/THIRD_PARTY_NOTICES.md +93 -0
- package/dist/account-alias-DOHN1RSH.js +973 -0
- package/dist/agent-cli-ChOq0ZuO.js +117 -0
- package/dist/agent-cli-DzWfZr6G.js +2 -0
- package/dist/agent-client-CPQo7iTI.js +305 -0
- package/dist/authoring-tools-Cr6Kpjsx.js +234 -0
- package/dist/build-info.json +1 -0
- package/dist/cli-hVgHcdsv.js +47 -0
- package/dist/cli-runner-D8y2_luU.js +5095 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +128 -0
- package/dist/client-DFoh50W3.js +950 -0
- package/dist/desktop-discovery-DBO-PM2V.js +164 -0
- package/dist/error-message-OtiDonty.js +6 -0
- package/dist/fs-utils-BMPLt0cr.js +22 -0
- package/dist/fuzzy-match-BoAmcyak.js +30 -0
- package/dist/headless-host-BJxf4dUU.js +94 -0
- package/dist/input-error-OLgB_h31.js +11 -0
- package/dist/local-data-CxLk75rx.js +4491 -0
- package/dist/mcp-QeF8vkdf.js +140 -0
- package/dist/package-paths-B6-zxvIO.js +47 -0
- package/dist/process-error-telemetry-v9e5h6D7.js +3952 -0
- package/dist/profile-4ry2f3AM.js +76 -0
- package/dist/profile-Bh5FIrmf.js +2 -0
- package/dist/request-origin-D_4QIdoN.js +811 -0
- package/dist/review-agent-traces-DNJFYzc8.js +3866 -0
- package/dist/review-home-paths-6zZH-1c9.js +2560 -0
- package/dist/review-telemetry-DEFnQsQ2.js +1195 -0
- package/dist/runtime-CKiWhGrf.js +52 -0
- package/dist/runtime.d.ts +9 -0
- package/dist/runtime.js +2 -0
- package/dist/s3-SzLpeCG6.js +345 -0
- package/dist/s3-config-BgxkSoOy.js +2 -0
- package/dist/s3-config-CAxhO9u_.js +676 -0
- package/dist/server/desktop-host.d.ts +4 -0
- package/dist/server/desktop-host.js +1702 -0
- package/dist/server-discovery-Dbzn3w6Z.js +66 -0
- package/dist/sharing/index.d.ts +1977 -0
- package/dist/sharing/index.js +2 -0
- package/dist/src-CGP5ytbV.js +283 -0
- package/dist/src-CmdiBL20.js +3676 -0
- package/dist/src-DnwdaQ2r.js +865 -0
- package/dist/src-X9phtB2j.js +68 -0
- package/dist/stored-document-migration-DHeMpLMb.js +2671 -0
- package/dist/tool-failure-C8zB73HV.js +98 -0
- package/dist/tutorial-trace-DrBvkaeL.js +43 -0
- package/instructions/authoring.md +36 -0
- package/instructions/file-lenses.md +13 -0
- package/instructions/scratchpad.md +23 -0
- package/instructions/trace-archaeology.md +113 -0
- package/onboarding.md +8 -0
- package/package.json +106 -3
- package/src/agent-selection.ts +100 -0
- package/src/agent-session-ref.ts +80 -0
- package/src/ask/agents.ts +351 -0
- package/src/ask/checkout-files.ts +47 -0
- package/src/ask/file-refs.ts +111 -0
- package/src/ask/pi-mcp.ts +154 -0
- package/src/ask/protocol.ts +244 -0
- package/src/ask/thread-state.ts +350 -0
- package/src/ask/thread.ts +1400 -0
- package/src/ask/threads.ts +219 -0
- package/src/ask/watch.ts +79 -0
- package/src/cli-install.ts +1041 -0
- package/src/cli-runner.ts +1461 -0
- package/src/cli-runtime-info.ts +35 -0
- package/src/cli.ts +222 -0
- package/src/connect-prompts.ts +248 -0
- package/src/cursor-deeplink.ts +11 -0
- package/src/desktop-discovery.ts +355 -0
- package/src/diff-selection-migration.ts +63 -0
- package/src/embedded-posthog-key.ts +6 -0
- package/src/error-telemetry.ts +247 -0
- package/src/evidence.ts +14 -0
- package/src/exception-telemetry.ts +126 -0
- package/src/fixtures/blocks/call_stack_diff.json +27 -0
- package/src/fixtures/blocks/callout.json +11 -0
- package/src/fixtures/blocks/code.json +9 -0
- package/src/fixtures/blocks/code_peek.json +8 -0
- package/src/fixtures/blocks/database_lens.json +51 -0
- package/src/fixtures/blocks/divider.json +1 -0
- package/src/fixtures/blocks/fixtures.ts +33 -0
- package/src/fixtures/blocks/flow_diagram.json +36 -0
- package/src/fixtures/blocks/ids.ts +8 -0
- package/src/fixtures/blocks/image.json +9 -0
- package/src/fixtures/blocks/markdown.json +7 -0
- package/src/fixtures/blocks/section.json +11 -0
- package/src/fixtures/blocks/sequence.json +31 -0
- package/src/fixtures/blocks/software_map.json +7 -0
- package/src/fixtures/blocks/trace_quote.json +9 -0
- package/src/fixtures/blocks/tutorial.json +51 -0
- package/src/fs-utils.ts +32 -0
- package/src/fuzzy-match.ts +94 -0
- package/src/install.ts +29 -0
- package/src/legacy-skills.ts +133 -0
- package/src/lens-selection.ts +230 -0
- package/src/markdown-latex-math.ts +230 -0
- package/src/markdown.ts +81 -0
- package/src/package-paths.ts +53 -0
- package/src/posthog-capture-client.ts +610 -0
- package/src/review-api/README.md +295 -0
- package/src/review-api/activity.ts +340 -0
- package/src/review-api/agent-cli.ts +219 -0
- package/src/review-api/agent-client.ts +188 -0
- package/src/review-api/anchor-quotes.ts +88 -0
- package/src/review-api/ask-history.ts +242 -0
- package/src/review-api/authoring-tools.ts +211 -0
- package/src/review-api/blocks/call_stack_diff.ts +75 -0
- package/src/review-api/blocks/callout.ts +24 -0
- package/src/review-api/blocks/code.ts +9 -0
- package/src/review-api/blocks/code_peek.ts +13 -0
- package/src/review-api/blocks/database_lens.ts +150 -0
- package/src/review-api/blocks/definition.ts +40 -0
- package/src/review-api/blocks/divider.ts +6 -0
- package/src/review-api/blocks/flow_diagram.ts +111 -0
- package/src/review-api/blocks/image.ts +10 -0
- package/src/review-api/blocks/index.ts +90 -0
- package/src/review-api/blocks/markdown.ts +17 -0
- package/src/review-api/blocks/section.ts +24 -0
- package/src/review-api/blocks/sequence.ts +56 -0
- package/src/review-api/blocks/software_map.ts +9 -0
- package/src/review-api/blocks/trace_quote.ts +10 -0
- package/src/review-api/blocks/tutorial.ts +39 -0
- package/src/review-api/checkout-fs.ts +14 -0
- package/src/review-api/client.ts +1 -0
- package/src/review-api/comparison-coverage.ts +304 -0
- package/src/review-api/component-reference.ts +30 -0
- package/src/review-api/diff-lenses.ts +175 -0
- package/src/review-api/document-headings.ts +51 -0
- package/src/review-api/document-text.ts +200 -0
- package/src/review-api/document.ts +906 -0
- package/src/review-api/file-lenses.ts +100 -0
- package/src/review-api/http.ts +1877 -0
- package/src/review-api/image-decode.ts +29 -0
- package/src/review-api/input-error.ts +9 -0
- package/src/review-api/instructions.ts +89 -0
- package/src/review-api/lens-alignment.ts +52 -0
- package/src/review-api/local-data.ts +1837 -0
- package/src/review-api/map-input.ts +154 -0
- package/src/review-api/mcp-client-agent.ts +32 -0
- package/src/review-api/mcp.ts +240 -0
- package/src/review-api/origin.ts +43 -0
- package/src/review-api/profile.ts +146 -0
- package/src/review-api/public-tools.ts +102 -0
- package/src/review-api/pull-request.ts +389 -0
- package/src/review-api/read-schemas.ts +85 -0
- package/src/review-api/recovery.ts +2 -0
- package/src/review-api/request-origin.ts +33 -0
- package/src/review-api/review-progress.ts +382 -0
- package/src/review-api/status-tool.ts +10 -0
- package/src/review-api/store-schema.ts +22 -0
- package/src/review-api/store.ts +1647 -0
- package/src/review-api/tool-failure.ts +64 -0
- package/src/review-api/trace-schema.ts +13 -0
- package/src/review-api/traces.ts +119 -0
- package/src/review-api/unsupported-files.integration.ts +91 -0
- package/src/review-api/workspaces.ts +692 -0
- package/src/review-api/worktree-source.ts +170 -0
- package/src/review-api/worktree-structural.integration.ts +320 -0
- package/src/review-app-launcher.ts +432 -0
- package/src/review-app-picker.ts +168 -0
- package/src/review-app.ts +134 -0
- package/src/review-bundled-tools.ts +249 -0
- package/src/review-checkout-paths.ts +37 -0
- package/src/review-diff-files.ts +89 -0
- package/src/review-head-checkout.ts +300 -0
- package/src/review-home-paths.ts +73 -0
- package/src/review-info.ts +59 -0
- package/src/review-instances.ts +113 -0
- package/src/review-logger.ts +183 -0
- package/src/review-preferences.ts +88 -0
- package/src/review-prepare.ts +291 -0
- package/src/review-stack.ts +112 -0
- package/src/review-telemetry.ts +1066 -0
- package/src/runtime.ts +74 -0
- package/src/server/account-alias.ts +30 -0
- package/src/server/bounded-stream.ts +34 -0
- package/src/server/bug-report.ts +301 -0
- package/src/server/client-error-budget.ts +45 -0
- package/src/server/crash-report.ts +273 -0
- package/src/server/desktop-host-shutdown.ts +64 -0
- package/src/server/desktop-host.ts +190 -0
- package/src/server/desktop-server.ts +703 -0
- package/src/server/diffr-config.ts +509 -0
- package/src/server/diffr-languages.ts +97 -0
- package/src/server/global-verb-relay.ts +190 -0
- package/src/server/headless-host.ts +149 -0
- package/src/server/hono-http.ts +162 -0
- package/src/server/http-json.ts +24 -0
- package/src/server/json-review-reporting.ts +174 -0
- package/src/server/process-error-telemetry.ts +174 -0
- package/src/server/review-api-parsers.ts +90 -0
- package/src/server/review-lifecycle-telemetry.ts +73 -0
- package/src/server/review-open-watchdog.ts +46 -0
- package/src/server/review-server-core.ts +290 -0
- package/src/server/structural-comparisons.ts +153 -0
- package/src/server/structural-diff.ts +186 -0
- package/src/server/tutorial-service.ts +241 -0
- package/src/server/ui-telemetry.ts +198 -0
- package/src/server-discovery.ts +95 -0
- package/src/session-markers.ts +132 -0
- package/src/sharing/auth.ts +41 -0
- package/src/sharing/cli.ts +83 -0
- package/src/sharing/client.ts +334 -0
- package/src/sharing/export.ts +195 -0
- package/src/sharing/host.ts +316 -0
- package/src/sharing/import.ts +787 -0
- package/src/sharing/index.ts +16 -0
- package/src/sharing/repository.ts +145 -0
- package/src/sharing/routes.ts +34 -0
- package/src/slug.ts +23 -0
- package/src/software-map-diff-counts.ts +517 -0
- package/src/software-map-model.ts +1147 -0
- package/src/software-map-topology-diff.ts +260 -0
- package/src/source.ts +92 -0
- package/src/startup-trace.ts +232 -0
- package/src/stored-document-migration.ts +151 -0
- package/src/telemetry-clean-text.ts +257 -0
- package/src/telemetry-config.ts +298 -0
- package/src/telemetry-debug-sink.ts +38 -0
- package/src/telemetry.ts +13 -0
- package/src/trace-cli.ts +156 -0
- package/src/trace-storage-cli.ts +509 -0
- package/src/tutorial-conversation.ts +18 -0
- package/src/ui-telemetry-events.ts +765 -0
- package/src/unified-diff.ts +71 -0
- package/src/viewed-coverage.ts +259 -0
- package/src/windows-cli.ts +125 -0
- package/tutorial/document.json +275 -0
- package/tutorial/runtime-manifest.json +12 -0
- package/tutorial/sample-service/package.json +9 -0
- package/tutorial/sample-service/src/api/checkout-api.ts +17 -0
- package/tutorial/sample-service/src/app.ts +26 -0
- package/tutorial/sample-service/src/database/schema.ts +10 -0
- package/tutorial/sample-service/src/fulfillment/fulfillment-queue.ts +15 -0
- package/tutorial/sample-service/src/fulfillment/fulfillment-worker.ts +24 -0
- package/tutorial/sample-service/src/inventory/inventory-service.ts +11 -0
- package/tutorial/sample-service/src/orders/order-service.ts +34 -0
- package/tutorial/sample-service/src/orders/order.ts +21 -0
- package/tutorial/sample-service/src/orders/orders-repository.ts +24 -0
- package/tutorial/sample-service/src/payments/payment-gateway.ts +12 -0
- package/tutorial/sample-service/src/shipping/shipping-gateway.ts +15 -0
- package/tutorial/sample-service/tsconfig.json +12 -0
- package/tutorial/software-map.json +139 -0
- package/tutorial/trace.json +20 -0
|
@@ -0,0 +1,865 @@
|
|
|
1
|
+
import { n as isJsonObject } from "./src-X9phtB2j.js";
|
|
2
|
+
import { _ as ReviewAgentTraceEventSchema, v as ReviewAgentTraceSessionSchema } from "./src-CGP5ytbV.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region ../../node_modules/@dev.fast/diffr/dist/contract.js
|
|
5
|
+
/**
|
|
6
|
+
* Mirrors src/protocol/mod.rs and src/pairing.rs. See ../README.md for sync checks.
|
|
7
|
+
* Import only zod: Review embeds this file in generated source.
|
|
8
|
+
* Defaults are omitted, not null. Lines are zero-based, columns are UTF-8 bytes,
|
|
9
|
+
* and ranges are half-open.
|
|
10
|
+
*/
|
|
11
|
+
function structuralPairingSchema(value) {
|
|
12
|
+
return z.union([
|
|
13
|
+
z.object({
|
|
14
|
+
lhs: value,
|
|
15
|
+
rhs: value
|
|
16
|
+
}),
|
|
17
|
+
z.object({
|
|
18
|
+
lhs: value,
|
|
19
|
+
rhs: z.never().optional()
|
|
20
|
+
}),
|
|
21
|
+
z.object({
|
|
22
|
+
rhs: value,
|
|
23
|
+
lhs: z.never().optional()
|
|
24
|
+
})
|
|
25
|
+
]);
|
|
26
|
+
}
|
|
27
|
+
const structuralU32 = z.number().int().min(0).max(4294967295);
|
|
28
|
+
const StructuralDiffEventSchema = z.lazy(() => z.union([
|
|
29
|
+
z.object({
|
|
30
|
+
type: z.literal("start"),
|
|
31
|
+
version: structuralU32,
|
|
32
|
+
lhs: StructuralSnapshotSchema,
|
|
33
|
+
rhs: StructuralSnapshotSchema,
|
|
34
|
+
files: z.array(StructuralFileChangeSchema)
|
|
35
|
+
}),
|
|
36
|
+
z.object({
|
|
37
|
+
type: z.literal("file"),
|
|
38
|
+
file: structuralPairingSchema(StructuralFileRefSchema),
|
|
39
|
+
visibility: StructuralVisibilitySchema.optional()
|
|
40
|
+
}).and(StructuralOutcomeSchema),
|
|
41
|
+
z.object({
|
|
42
|
+
type: z.literal("annotations"),
|
|
43
|
+
file: structuralPairingSchema(StructuralFileRefSchema),
|
|
44
|
+
annotations: z.array(z.object({
|
|
45
|
+
region_id: structuralU32,
|
|
46
|
+
label: z.string()
|
|
47
|
+
})),
|
|
48
|
+
error: StructuralProblemSchema.optional()
|
|
49
|
+
}),
|
|
50
|
+
z.object({
|
|
51
|
+
type: z.literal("complete"),
|
|
52
|
+
succeeded: structuralU32,
|
|
53
|
+
failed: structuralU32,
|
|
54
|
+
aborted: StructuralProblemSchema.optional()
|
|
55
|
+
})
|
|
56
|
+
]));
|
|
57
|
+
const StructuralOutcomeSchema = z.lazy(() => z.union([z.object({
|
|
58
|
+
diff: StructuralDiffSchema,
|
|
59
|
+
error: z.never().optional()
|
|
60
|
+
}), z.object({
|
|
61
|
+
error: StructuralProblemSchema,
|
|
62
|
+
diff: z.never().optional()
|
|
63
|
+
})]));
|
|
64
|
+
const StructuralSnapshotSchema = z.lazy(() => z.union([
|
|
65
|
+
z.object({
|
|
66
|
+
type: z.literal("revision"),
|
|
67
|
+
rev: z.string()
|
|
68
|
+
}),
|
|
69
|
+
z.object({ type: z.literal("index") }),
|
|
70
|
+
z.object({ type: z.literal("working_tree") }),
|
|
71
|
+
z.object({ type: z.literal("empty_tree") }),
|
|
72
|
+
z.object({
|
|
73
|
+
type: z.literal("path"),
|
|
74
|
+
path: z.string()
|
|
75
|
+
})
|
|
76
|
+
]));
|
|
77
|
+
const StructuralProblemSchema = z.lazy(() => z.object({
|
|
78
|
+
code: z.string(),
|
|
79
|
+
message: z.string()
|
|
80
|
+
}));
|
|
81
|
+
const StructuralFileChangeSchema = z.lazy(() => z.object({
|
|
82
|
+
file: structuralPairingSchema(StructuralFileRefSchema),
|
|
83
|
+
status: StructuralFileStatusSchema,
|
|
84
|
+
tags: z.array(z.string()).optional()
|
|
85
|
+
}));
|
|
86
|
+
const StructuralFileStatusSchema = z.lazy(() => z.union([
|
|
87
|
+
z.literal("added"),
|
|
88
|
+
z.literal("deleted"),
|
|
89
|
+
z.literal("modified"),
|
|
90
|
+
z.literal("renamed"),
|
|
91
|
+
z.literal("copied"),
|
|
92
|
+
z.literal("type_changed")
|
|
93
|
+
]));
|
|
94
|
+
const StructuralFileRefSchema = z.lazy(() => z.object({
|
|
95
|
+
path: z.string(),
|
|
96
|
+
oid: z.string(),
|
|
97
|
+
mode: z.string()
|
|
98
|
+
}));
|
|
99
|
+
const StructuralVisibilitySchema = z.lazy(() => z.object({
|
|
100
|
+
collapsed: z.boolean().optional(),
|
|
101
|
+
label: z.string().optional()
|
|
102
|
+
}));
|
|
103
|
+
const structuralRangesSchema = z.array(z.tuple([structuralU32, structuralU32])).refine((ranges) => ranges.every(([start, end], index) => start < end && (index === 0 || ranges[index - 1][1] < start)), "Expected sorted, coalesced, nonempty half-open ranges");
|
|
104
|
+
const StructuralChangesSchema = z.object({
|
|
105
|
+
base: structuralRangesSchema,
|
|
106
|
+
head: structuralRangesSchema
|
|
107
|
+
});
|
|
108
|
+
function structuralChangeCounts(changes) {
|
|
109
|
+
const count = (ranges) => ranges.reduce((sum, [start, end]) => sum + end - start, 0);
|
|
110
|
+
return {
|
|
111
|
+
added: count(changes.head),
|
|
112
|
+
removed: count(changes.base)
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
const StructuralDiffSchema = z.lazy(() => z.union([z.object({
|
|
116
|
+
type: z.literal("text"),
|
|
117
|
+
stats: StructuralStatsSchema,
|
|
118
|
+
structural_changes: StructuralChangesSchema
|
|
119
|
+
}).and(structuralPairingSchema(StructuralSourceSchema)), z.object({ type: z.literal("binary") }).and(structuralPairingSchema(StructuralBinaryRefSchema))]));
|
|
120
|
+
const StructuralSourceSchema = z.lazy(() => z.object({
|
|
121
|
+
text: z.string(),
|
|
122
|
+
syntax: z.array(StructuralSyntaxSpanSchema).optional(),
|
|
123
|
+
regions: z.array(StructuralRegionSchema).optional()
|
|
124
|
+
}));
|
|
125
|
+
const StructuralBinaryRefSchema = z.lazy(() => z.object({ size: z.number().int().nonnegative() }));
|
|
126
|
+
const StructuralSyntaxSpanSchema = z.lazy(() => z.object({
|
|
127
|
+
line: structuralU32,
|
|
128
|
+
start_column: structuralU32,
|
|
129
|
+
end_column: structuralU32,
|
|
130
|
+
capture: z.string()
|
|
131
|
+
}));
|
|
132
|
+
const StructuralRegionSchema = z.lazy(() => z.object({
|
|
133
|
+
id: structuralU32,
|
|
134
|
+
fold_state_id: structuralU32,
|
|
135
|
+
tags: z.array(z.string()).optional(),
|
|
136
|
+
visibility: StructuralVisibilitySchema.optional()
|
|
137
|
+
}).and(StructuralSourceRangeSchema).and(StructuralNodeSchema));
|
|
138
|
+
const StructuralNodeSchema = z.lazy(() => z.union([z.object({
|
|
139
|
+
kind: z.literal("leaf"),
|
|
140
|
+
alignment_id: structuralU32,
|
|
141
|
+
changed: z.array(StructuralSpanSchema).optional()
|
|
142
|
+
}), z.object({
|
|
143
|
+
kind: z.literal("fold"),
|
|
144
|
+
children: z.array(StructuralRegionSchema)
|
|
145
|
+
})]));
|
|
146
|
+
const StructuralSpanSchema = z.lazy(() => z.object({
|
|
147
|
+
line: structuralU32,
|
|
148
|
+
start_column: structuralU32,
|
|
149
|
+
end_column: structuralU32
|
|
150
|
+
}));
|
|
151
|
+
const StructuralSourceRangeSchema = z.lazy(() => z.object({
|
|
152
|
+
start: StructuralPosSchema,
|
|
153
|
+
end: StructuralPosSchema
|
|
154
|
+
}));
|
|
155
|
+
const StructuralPosSchema = z.lazy(() => z.object({
|
|
156
|
+
line: structuralU32,
|
|
157
|
+
column: structuralU32
|
|
158
|
+
}));
|
|
159
|
+
const StructuralStatsSchema = z.lazy(() => z.object({
|
|
160
|
+
textual: StructuralLineCountsSchema,
|
|
161
|
+
visible: StructuralLineCountsSchema,
|
|
162
|
+
fallback: StructuralProblemSchema.optional()
|
|
163
|
+
}));
|
|
164
|
+
const StructuralLineCountsSchema = z.lazy(() => z.object({
|
|
165
|
+
added: structuralU32,
|
|
166
|
+
removed: structuralU32
|
|
167
|
+
}));
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region ../../node_modules/@dev.fast/diffr/dist/stream.js
|
|
170
|
+
function decodeStructuralDiffEvent(line) {
|
|
171
|
+
try {
|
|
172
|
+
return StructuralDiffEventSchema.parse(JSON.parse(line));
|
|
173
|
+
} catch (cause) {
|
|
174
|
+
throw new Error("Malformed diffr protocol record.", { cause });
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region ../review-protocol/src/structural-diff.ts
|
|
179
|
+
const ReviewStructuralDiffErrorSchema = z.object({
|
|
180
|
+
type: z.literal("error"),
|
|
181
|
+
message: z.string()
|
|
182
|
+
});
|
|
183
|
+
z.union([StructuralDiffEventSchema, ReviewStructuralDiffErrorSchema]);
|
|
184
|
+
const REVIEW_CLIENT_HEADER = "x-review-client";
|
|
185
|
+
const REVIEW_CLIENT_REMOTE = "remote";
|
|
186
|
+
const requiredString$1 = z.string({ error: "must be a string" }).refine((value) => value.trim().length > 0, "must be a string");
|
|
187
|
+
const stringAllowEmpty = z.string({ error: "must be a string" });
|
|
188
|
+
const positiveInteger = z.number({ error: "must be a positive integer" }).int("must be a positive integer").positive("must be a positive integer");
|
|
189
|
+
const nonNegativeInteger = z.number({ error: "must be a non-negative integer" }).int("must be a non-negative integer").nonnegative("must be a non-negative integer");
|
|
190
|
+
const reviewDiffSideSchema = z.enum(["base", "head"], { error: "must be base or head" });
|
|
191
|
+
const reviewViewSchema = z.enum([
|
|
192
|
+
"review",
|
|
193
|
+
"commits",
|
|
194
|
+
"diff",
|
|
195
|
+
"map",
|
|
196
|
+
"trace"
|
|
197
|
+
]);
|
|
198
|
+
const reviewThemeSchema = z.enum(["light", "dark"], { error: "must be light or dark" });
|
|
199
|
+
function urlSchema(output, constraint) {
|
|
200
|
+
return requiredString$1.transform((value, context) => {
|
|
201
|
+
let url;
|
|
202
|
+
try {
|
|
203
|
+
url = new URL(value);
|
|
204
|
+
} catch {
|
|
205
|
+
context.addIssue({
|
|
206
|
+
code: "custom",
|
|
207
|
+
message: "must be an absolute URL"
|
|
208
|
+
});
|
|
209
|
+
return z.NEVER;
|
|
210
|
+
}
|
|
211
|
+
const error = constraint?.(url);
|
|
212
|
+
if (error) {
|
|
213
|
+
context.addIssue({
|
|
214
|
+
code: "custom",
|
|
215
|
+
message: error
|
|
216
|
+
});
|
|
217
|
+
return z.NEVER;
|
|
218
|
+
}
|
|
219
|
+
return output === "origin" ? url.origin : url.href;
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
const absoluteUrlSchema = urlSchema("href");
|
|
223
|
+
const loopbackOriginSchema = urlSchema("origin", (url) => url.protocol === "http:" && url.hostname === "127.0.0.1" && url.port ? null : "must use http://127.0.0.1:<port>");
|
|
224
|
+
z.strictObject({
|
|
225
|
+
serverUrl: loopbackOriginSchema,
|
|
226
|
+
reviewId: requiredString$1,
|
|
227
|
+
token: stringAllowEmpty,
|
|
228
|
+
wasmUrl: absoluteUrlSchema,
|
|
229
|
+
appVersion: requiredString$1.max(100),
|
|
230
|
+
theme: reviewThemeSchema,
|
|
231
|
+
host: z.literal("desktop")
|
|
232
|
+
});
|
|
233
|
+
/** How embedded diffs lay out: base and head side by side, or one column. */
|
|
234
|
+
const REVIEW_DIFF_LAYOUTS = ["split", "unified"];
|
|
235
|
+
const REVIEW_THEME_CHOICES = [
|
|
236
|
+
"dark",
|
|
237
|
+
"light",
|
|
238
|
+
"system"
|
|
239
|
+
];
|
|
240
|
+
const reviewDiffrSummarizerInputSchema = z.object({
|
|
241
|
+
enabled: z.boolean(),
|
|
242
|
+
provider: z.string().min(1),
|
|
243
|
+
model: z.string().trim().min(1),
|
|
244
|
+
endpoint: z.string().trim(),
|
|
245
|
+
systemPrompt: z.string(),
|
|
246
|
+
tests: z.boolean(),
|
|
247
|
+
apiKey: z.string().optional()
|
|
248
|
+
});
|
|
249
|
+
z.object({
|
|
250
|
+
values: z.custom(isJsonObject),
|
|
251
|
+
credentialSource: z.enum([
|
|
252
|
+
"config",
|
|
253
|
+
"environment",
|
|
254
|
+
"missing"
|
|
255
|
+
]),
|
|
256
|
+
providers: z.array(z.object({
|
|
257
|
+
id: z.string(),
|
|
258
|
+
title: z.string(),
|
|
259
|
+
model: z.string(),
|
|
260
|
+
endpoint: z.string(),
|
|
261
|
+
keyVariables: z.array(z.string()),
|
|
262
|
+
keylessCustomEndpoint: z.boolean()
|
|
263
|
+
})).optional(),
|
|
264
|
+
defaultPrompt: z.string().optional(),
|
|
265
|
+
changed: z.boolean().optional(),
|
|
266
|
+
error: z.string().optional()
|
|
267
|
+
});
|
|
268
|
+
const ReviewDesktopDiscoverySchema = z.object({
|
|
269
|
+
version: z.literal(3, { error: "Unsupported Whiteboard Desktop discovery version" }),
|
|
270
|
+
instanceId: requiredString$1,
|
|
271
|
+
url: loopbackOriginSchema,
|
|
272
|
+
appPid: positiveInteger,
|
|
273
|
+
serverPid: positiveInteger,
|
|
274
|
+
token: requiredString$1,
|
|
275
|
+
startedAt: positiveInteger,
|
|
276
|
+
cliPath: requiredString$1.optional(),
|
|
277
|
+
cliVersion: requiredString$1.optional(),
|
|
278
|
+
cliRuntimePath: requiredString$1.optional(),
|
|
279
|
+
key: requiredString$1.optional(),
|
|
280
|
+
channel: z.enum([
|
|
281
|
+
"stable",
|
|
282
|
+
"preview",
|
|
283
|
+
"dev"
|
|
284
|
+
]).optional(),
|
|
285
|
+
checkout: requiredString$1.optional(),
|
|
286
|
+
appPath: requiredString$1.optional(),
|
|
287
|
+
appVersion: requiredString$1.optional()
|
|
288
|
+
});
|
|
289
|
+
z.strictObject({
|
|
290
|
+
kind: z.enum([
|
|
291
|
+
"git",
|
|
292
|
+
"jj",
|
|
293
|
+
"none"
|
|
294
|
+
], { error: "must be git, jj, or none" }),
|
|
295
|
+
repositoryId: requiredString$1,
|
|
296
|
+
repositoryPath: requiredString$1,
|
|
297
|
+
worktreeRoot: requiredString$1
|
|
298
|
+
});
|
|
299
|
+
z.enum([
|
|
300
|
+
"draft",
|
|
301
|
+
"awaiting-review",
|
|
302
|
+
"awaiting-agent-updates",
|
|
303
|
+
"accepted",
|
|
304
|
+
"rejected"
|
|
305
|
+
]);
|
|
306
|
+
z.strictObject({
|
|
307
|
+
kind: z.enum([
|
|
308
|
+
"git-branch",
|
|
309
|
+
"git-commit",
|
|
310
|
+
"jj-bookmark",
|
|
311
|
+
"jj-change"
|
|
312
|
+
]),
|
|
313
|
+
name: requiredString$1
|
|
314
|
+
});
|
|
315
|
+
const ReviewAgentSessionRoleSchema = z.enum([
|
|
316
|
+
"author",
|
|
317
|
+
"map-worker",
|
|
318
|
+
"publisher",
|
|
319
|
+
"updater",
|
|
320
|
+
"question"
|
|
321
|
+
]);
|
|
322
|
+
z.strictObject({
|
|
323
|
+
roles: z.array(ReviewAgentSessionRoleSchema),
|
|
324
|
+
firstSeenAt: requiredString$1,
|
|
325
|
+
lastSeenAt: requiredString$1
|
|
326
|
+
});
|
|
327
|
+
z.strictObject({
|
|
328
|
+
commit: z.string({ error: "must be a 40-hex revision" }).regex(/^[0-9a-f]{40}$/i, "must be a 40-hex revision"),
|
|
329
|
+
parentCommit: z.string({ error: "must be a 40-hex revision" }).regex(/^[0-9a-f]{40}$/i, "must be a 40-hex revision"),
|
|
330
|
+
subject: stringAllowEmpty,
|
|
331
|
+
author: stringAllowEmpty,
|
|
332
|
+
authoredAt: requiredString$1,
|
|
333
|
+
fileCount: z.number().int().nonnegative(),
|
|
334
|
+
additions: z.number().int().nonnegative(),
|
|
335
|
+
deletions: z.number().int().nonnegative()
|
|
336
|
+
});
|
|
337
|
+
z.strictObject({
|
|
338
|
+
harness: z.enum([
|
|
339
|
+
"claude-code",
|
|
340
|
+
"codex",
|
|
341
|
+
"opencode",
|
|
342
|
+
"pi"
|
|
343
|
+
]),
|
|
344
|
+
sessionId: requiredString$1
|
|
345
|
+
});
|
|
346
|
+
const ReviewErrorResponseSchema = z.strictObject({
|
|
347
|
+
ok: z.literal(false),
|
|
348
|
+
error: requiredString$1,
|
|
349
|
+
code: requiredString$1.optional(),
|
|
350
|
+
retryable: z.boolean().optional()
|
|
351
|
+
});
|
|
352
|
+
z.strictObject({
|
|
353
|
+
kind: z.literal("api"),
|
|
354
|
+
reviewUuid: z.uuid({ error: "must be a UUID" }),
|
|
355
|
+
title: stringAllowEmpty
|
|
356
|
+
});
|
|
357
|
+
const ReviewStackLayerSchema = z.strictObject({
|
|
358
|
+
branch: requiredString$1,
|
|
359
|
+
pullRequestNumber: positiveInteger,
|
|
360
|
+
pullRequestUrl: absoluteUrlSchema.nullable(),
|
|
361
|
+
reviewUuid: z.uuid({ error: "must be a UUID" }).nullable(),
|
|
362
|
+
reviewTitle: stringAllowEmpty.nullable(),
|
|
363
|
+
relation: z.enum([
|
|
364
|
+
"earlier",
|
|
365
|
+
"current",
|
|
366
|
+
"later"
|
|
367
|
+
])
|
|
368
|
+
});
|
|
369
|
+
z.strictObject({ layers: z.array(ReviewStackLayerSchema) });
|
|
370
|
+
const ReviewCliInstallTargetSchema = z.enum([
|
|
371
|
+
"claude",
|
|
372
|
+
"codex",
|
|
373
|
+
"cursor",
|
|
374
|
+
"opencode",
|
|
375
|
+
"pi",
|
|
376
|
+
"omp",
|
|
377
|
+
"copilot"
|
|
378
|
+
], { error: "must be claude, codex, cursor, opencode, pi, omp, or copilot" });
|
|
379
|
+
const ReviewCliInstallStampSchema = z.object({
|
|
380
|
+
consent: z.enum([
|
|
381
|
+
"granted",
|
|
382
|
+
"declined",
|
|
383
|
+
"skipped"
|
|
384
|
+
], { error: "must be granted, declined, or skipped" }),
|
|
385
|
+
fingerprint: requiredString$1.optional(),
|
|
386
|
+
shimPath: requiredString$1.optional(),
|
|
387
|
+
/** The user removed the review command; the shim resync must not reinstall it. */
|
|
388
|
+
commandDisabled: z.literal(true).optional(),
|
|
389
|
+
traceManaged: z.boolean().optional(),
|
|
390
|
+
/** Windows: the directory the install put on the saved user PATH. A running
|
|
391
|
+
* process keeps its startup PATH, so this is what says new terminals will
|
|
392
|
+
* find the command. */
|
|
393
|
+
userPath: requiredString$1.optional(),
|
|
394
|
+
updatedAt: requiredString$1
|
|
395
|
+
});
|
|
396
|
+
z.strictObject({
|
|
397
|
+
fingerprint: requiredString$1,
|
|
398
|
+
stamp: ReviewCliInstallStampSchema.nullable(),
|
|
399
|
+
/** The stamp fingerprint differs from the running package: rewrite the shim. */
|
|
400
|
+
stale: z.boolean(),
|
|
401
|
+
/** A granted stamp without this build's update marker: show the update screen. */
|
|
402
|
+
updateNeeded: z.boolean(),
|
|
403
|
+
error: requiredString$1.optional(),
|
|
404
|
+
shim: z.strictObject({
|
|
405
|
+
path: requiredString$1,
|
|
406
|
+
installed: z.boolean(),
|
|
407
|
+
profileConfigured: z.boolean(),
|
|
408
|
+
onPath: z.boolean(),
|
|
409
|
+
/** The Windows installer put this command on PATH; uninstalling Whiteboard removes it. */
|
|
410
|
+
installer: z.literal(true).optional()
|
|
411
|
+
}),
|
|
412
|
+
trace: z.strictObject({
|
|
413
|
+
enabled: z.boolean(),
|
|
414
|
+
configured: z.boolean(),
|
|
415
|
+
autoActivateRepositories: z.boolean(),
|
|
416
|
+
envPath: requiredString$1,
|
|
417
|
+
settingsPath: requiredString$1,
|
|
418
|
+
endpoint: requiredString$1.optional(),
|
|
419
|
+
bucket: requiredString$1.optional(),
|
|
420
|
+
region: requiredString$1.optional(),
|
|
421
|
+
accessKeyIdPrefix: requiredString$1.optional(),
|
|
422
|
+
verifiedAt: requiredString$1.optional(),
|
|
423
|
+
error: requiredString$1.optional(),
|
|
424
|
+
configPath: requiredString$1.optional(),
|
|
425
|
+
storageMode: z.enum([
|
|
426
|
+
"s3",
|
|
427
|
+
"hosted",
|
|
428
|
+
"none"
|
|
429
|
+
]).optional(),
|
|
430
|
+
credentialsSource: z.enum([
|
|
431
|
+
"profile",
|
|
432
|
+
"legacy-file",
|
|
433
|
+
"process-env",
|
|
434
|
+
"none"
|
|
435
|
+
]).optional(),
|
|
436
|
+
captureSource: z.enum(["profile", "settings"]).optional()
|
|
437
|
+
}),
|
|
438
|
+
cli: z.strictObject({
|
|
439
|
+
path: requiredString$1,
|
|
440
|
+
version: requiredString$1
|
|
441
|
+
}).nullable(),
|
|
442
|
+
connect: z.strictObject({
|
|
443
|
+
command: requiredString$1,
|
|
444
|
+
args: z.array(z.string()),
|
|
445
|
+
prompts: z.record(ReviewCliInstallTargetSchema, requiredString$1),
|
|
446
|
+
plugins: z.record(ReviewCliInstallTargetSchema, z.strictObject({
|
|
447
|
+
label: requiredString$1,
|
|
448
|
+
command: requiredString$1.optional(),
|
|
449
|
+
url: requiredString$1.optional()
|
|
450
|
+
}))
|
|
451
|
+
}),
|
|
452
|
+
legacySkills: z.array(z.strictObject({ path: requiredString$1 }))
|
|
453
|
+
});
|
|
454
|
+
const ReviewCliInstallApplyRequestSchema = z.strictObject({
|
|
455
|
+
shim: z.boolean().optional(),
|
|
456
|
+
autoUpdate: z.boolean().optional(),
|
|
457
|
+
trace: z.union([z.literal(true), z.strictObject({
|
|
458
|
+
endpoint: requiredString$1.optional(),
|
|
459
|
+
bucket: requiredString$1.optional(),
|
|
460
|
+
key: requiredString$1.optional(),
|
|
461
|
+
secret: requiredString$1.optional(),
|
|
462
|
+
region: requiredString$1.optional()
|
|
463
|
+
})]).optional()
|
|
464
|
+
});
|
|
465
|
+
z.strictObject({
|
|
466
|
+
ok: z.boolean(),
|
|
467
|
+
output: stringAllowEmpty,
|
|
468
|
+
shimPath: requiredString$1.optional()
|
|
469
|
+
});
|
|
470
|
+
const ReviewDiffFileSchema = z.strictObject({
|
|
471
|
+
path: requiredString$1,
|
|
472
|
+
previousPath: requiredString$1.optional(),
|
|
473
|
+
status: z.enum([
|
|
474
|
+
"added",
|
|
475
|
+
"modified",
|
|
476
|
+
"deleted",
|
|
477
|
+
"renamed",
|
|
478
|
+
"unchanged"
|
|
479
|
+
]),
|
|
480
|
+
additions: nonNegativeInteger,
|
|
481
|
+
deletions: nonNegativeInteger,
|
|
482
|
+
/** Git reports no line counts: the file's contents are binary. */
|
|
483
|
+
binary: z.literal(true).optional(),
|
|
484
|
+
patch: requiredString$1.optional()
|
|
485
|
+
});
|
|
486
|
+
z.strictObject({
|
|
487
|
+
includePatch: z.boolean().optional(),
|
|
488
|
+
paths: z.array(z.string()).optional(),
|
|
489
|
+
commit: z.string({ error: "must be a 40-hex revision" }).regex(/^[0-9a-f]{40}$/i, "must be a 40-hex revision").optional()
|
|
490
|
+
});
|
|
491
|
+
z.discriminatedUnion("ok", [z.strictObject({
|
|
492
|
+
ok: z.literal(true),
|
|
493
|
+
baseRef: requiredString$1.optional(),
|
|
494
|
+
headRef: requiredString$1.optional(),
|
|
495
|
+
files: z.array(ReviewDiffFileSchema)
|
|
496
|
+
}), ReviewErrorResponseSchema]);
|
|
497
|
+
z.strictObject({
|
|
498
|
+
path: requiredString$1,
|
|
499
|
+
side: reviewDiffSideSchema,
|
|
500
|
+
commit: z.string({ error: "must be a 40-hex revision" }).regex(/^[0-9a-f]{40}$/i, "must be a 40-hex revision").optional()
|
|
501
|
+
});
|
|
502
|
+
z.union([
|
|
503
|
+
z.strictObject({
|
|
504
|
+
ok: z.literal(true),
|
|
505
|
+
content: stringAllowEmpty,
|
|
506
|
+
truncated: z.boolean().optional()
|
|
507
|
+
}),
|
|
508
|
+
z.strictObject({
|
|
509
|
+
ok: z.literal(true),
|
|
510
|
+
absent: z.literal(true)
|
|
511
|
+
}),
|
|
512
|
+
z.strictObject({
|
|
513
|
+
ok: z.literal(true),
|
|
514
|
+
binary: z.literal(true)
|
|
515
|
+
}),
|
|
516
|
+
ReviewErrorResponseSchema
|
|
517
|
+
]);
|
|
518
|
+
const ReviewRangeSchema = z.strictObject({
|
|
519
|
+
fromLine: positiveInteger,
|
|
520
|
+
toLine: positiveInteger
|
|
521
|
+
}).superRefine((range, context) => {
|
|
522
|
+
if (range.toLine < range.fromLine) context.addIssue({
|
|
523
|
+
code: "custom",
|
|
524
|
+
message: "must be >= fromLine",
|
|
525
|
+
path: ["toLine"]
|
|
526
|
+
});
|
|
527
|
+
});
|
|
528
|
+
const ReviewOpenEditorSchema = z.strictObject({
|
|
529
|
+
path: requiredString$1,
|
|
530
|
+
scheme: requiredString$1
|
|
531
|
+
});
|
|
532
|
+
const ReviewEditorSelectionSchema = z.strictObject({
|
|
533
|
+
path: requiredString$1,
|
|
534
|
+
startLine: positiveInteger,
|
|
535
|
+
startColumn: positiveInteger,
|
|
536
|
+
endLine: positiveInteger,
|
|
537
|
+
endColumn: positiveInteger
|
|
538
|
+
});
|
|
539
|
+
z.strictObject({
|
|
540
|
+
openEditors: z.array(ReviewOpenEditorSchema),
|
|
541
|
+
activeEditor: ReviewOpenEditorSchema.nullable(),
|
|
542
|
+
selection: ReviewEditorSelectionSchema.nullable()
|
|
543
|
+
});
|
|
544
|
+
const revealArgsSchema = z.strictObject({
|
|
545
|
+
path: requiredString$1,
|
|
546
|
+
startLine: positiveInteger,
|
|
547
|
+
endLine: positiveInteger,
|
|
548
|
+
side: reviewDiffSideSchema.optional(),
|
|
549
|
+
pins: z.strictObject({
|
|
550
|
+
repositoryId: requiredString$1,
|
|
551
|
+
head: requiredString$1,
|
|
552
|
+
base: requiredString$1.optional()
|
|
553
|
+
}).optional(),
|
|
554
|
+
highlight: z.boolean().optional(),
|
|
555
|
+
preserveFocus: z.boolean().optional()
|
|
556
|
+
}).superRefine((args, context) => {
|
|
557
|
+
if (args.endLine < args.startLine) context.addIssue({
|
|
558
|
+
code: "custom",
|
|
559
|
+
message: "must be >= args.startLine",
|
|
560
|
+
path: ["endLine"]
|
|
561
|
+
});
|
|
562
|
+
});
|
|
563
|
+
/** The one scratchpad's fixed review id. */
|
|
564
|
+
const SCRATCHPAD_REVIEW_ID = "scratchpad";
|
|
565
|
+
const apiReviewIdSchema = z.union([
|
|
566
|
+
z.uuid(),
|
|
567
|
+
z.string().regex(/^shared-[a-f0-9]{64}$/),
|
|
568
|
+
z.literal(SCRATCHPAD_REVIEW_ID)
|
|
569
|
+
]);
|
|
570
|
+
const ReviewVerbRequestSchema = z.discriminatedUnion("name", [
|
|
571
|
+
z.strictObject({
|
|
572
|
+
name: z.literal("authoringCapabilities"),
|
|
573
|
+
args: z.strictObject({})
|
|
574
|
+
}),
|
|
575
|
+
z.strictObject({
|
|
576
|
+
name: z.literal("joinDiscord"),
|
|
577
|
+
args: z.strictObject({})
|
|
578
|
+
}),
|
|
579
|
+
z.strictObject({
|
|
580
|
+
name: z.literal("showReviewView"),
|
|
581
|
+
args: z.strictObject({ view: reviewViewSchema })
|
|
582
|
+
}),
|
|
583
|
+
z.strictObject({
|
|
584
|
+
name: z.literal("openSourceTree"),
|
|
585
|
+
args: z.strictObject({})
|
|
586
|
+
}),
|
|
587
|
+
z.strictObject({
|
|
588
|
+
name: z.literal("openDiff"),
|
|
589
|
+
args: z.strictObject({
|
|
590
|
+
path: requiredString$1,
|
|
591
|
+
previousPath: requiredString$1.optional()
|
|
592
|
+
})
|
|
593
|
+
}),
|
|
594
|
+
z.strictObject({
|
|
595
|
+
name: z.literal("reveal"),
|
|
596
|
+
args: revealArgsSchema
|
|
597
|
+
}),
|
|
598
|
+
z.strictObject({
|
|
599
|
+
name: z.literal("focusWindow"),
|
|
600
|
+
args: z.strictObject({})
|
|
601
|
+
}),
|
|
602
|
+
z.strictObject({
|
|
603
|
+
name: z.literal("captureScreenshot"),
|
|
604
|
+
args: z.strictObject({})
|
|
605
|
+
}),
|
|
606
|
+
z.strictObject({
|
|
607
|
+
name: z.literal("openReviewRevision"),
|
|
608
|
+
args: z.strictObject({
|
|
609
|
+
revision: z.string().regex(/^[0-9a-f]{40}$/).optional(),
|
|
610
|
+
sealedAt: positiveInteger.optional()
|
|
611
|
+
})
|
|
612
|
+
}),
|
|
613
|
+
z.strictObject({
|
|
614
|
+
name: z.literal("openReview"),
|
|
615
|
+
args: z.strictObject({
|
|
616
|
+
reviewUuid: apiReviewIdSchema,
|
|
617
|
+
active: z.boolean()
|
|
618
|
+
})
|
|
619
|
+
}),
|
|
620
|
+
z.strictObject({
|
|
621
|
+
name: z.literal("openApiReview"),
|
|
622
|
+
args: z.strictObject({
|
|
623
|
+
reviewId: apiReviewIdSchema,
|
|
624
|
+
title: requiredString$1
|
|
625
|
+
})
|
|
626
|
+
})
|
|
627
|
+
]);
|
|
628
|
+
const ReviewVerbResponseSchema = z.discriminatedUnion("ok", [z.strictObject({
|
|
629
|
+
ok: z.literal(true),
|
|
630
|
+
result: z.unknown().optional()
|
|
631
|
+
}), ReviewErrorResponseSchema]);
|
|
632
|
+
z.strictObject({
|
|
633
|
+
event: z.literal("desktop-verb"),
|
|
634
|
+
id: requiredString$1,
|
|
635
|
+
request: ReviewVerbRequestSchema
|
|
636
|
+
});
|
|
637
|
+
const ReviewDesktopVerbResultSchema = z.strictObject({
|
|
638
|
+
id: requiredString$1,
|
|
639
|
+
response: ReviewVerbResponseSchema
|
|
640
|
+
});
|
|
641
|
+
const ReviewSelectedDiffSchema = z.strictObject({
|
|
642
|
+
oldPath: z.string(),
|
|
643
|
+
newPath: z.string(),
|
|
644
|
+
oldStart: z.number().int().nonnegative(),
|
|
645
|
+
newStart: z.number().int().nonnegative(),
|
|
646
|
+
rows: z.array(z.strictObject({
|
|
647
|
+
kind: z.enum([
|
|
648
|
+
"unchanged",
|
|
649
|
+
"added",
|
|
650
|
+
"deleted"
|
|
651
|
+
]),
|
|
652
|
+
text: z.string()
|
|
653
|
+
}))
|
|
654
|
+
});
|
|
655
|
+
const ReviewApiSelectionSourceSchema = z.strictObject({
|
|
656
|
+
reviewId: requiredString$1,
|
|
657
|
+
version: z.number().int().nonnegative(),
|
|
658
|
+
commit: requiredString$1.optional(),
|
|
659
|
+
pins: z.strictObject({
|
|
660
|
+
repositoryId: requiredString$1,
|
|
661
|
+
head: requiredString$1,
|
|
662
|
+
base: requiredString$1.optional()
|
|
663
|
+
}).optional()
|
|
664
|
+
});
|
|
665
|
+
z.discriminatedUnion("event", [
|
|
666
|
+
z.strictObject({
|
|
667
|
+
event: z.literal("editorSelectionChanged"),
|
|
668
|
+
reviewId: requiredString$1,
|
|
669
|
+
apiSource: ReviewApiSelectionSourceSchema.optional(),
|
|
670
|
+
anchor: z.object({
|
|
671
|
+
x: z.number(),
|
|
672
|
+
y: z.number()
|
|
673
|
+
}).optional(),
|
|
674
|
+
path: requiredString$1,
|
|
675
|
+
range: ReviewRangeSchema,
|
|
676
|
+
sideContext: reviewDiffSideSchema,
|
|
677
|
+
isEmpty: z.boolean(),
|
|
678
|
+
selectedDiff: ReviewSelectedDiffSchema.optional()
|
|
679
|
+
}),
|
|
680
|
+
z.strictObject({
|
|
681
|
+
event: z.literal("themeChanged"),
|
|
682
|
+
theme: reviewThemeSchema
|
|
683
|
+
}),
|
|
684
|
+
z.strictObject({
|
|
685
|
+
event: z.literal("showReviewView"),
|
|
686
|
+
view: reviewViewSchema
|
|
687
|
+
})
|
|
688
|
+
]);
|
|
689
|
+
z.discriminatedUnion("ok", [z.strictObject({
|
|
690
|
+
ok: z.literal(true),
|
|
691
|
+
configured: z.boolean().default(true),
|
|
692
|
+
storage: z.enum([
|
|
693
|
+
"s3",
|
|
694
|
+
"hosted",
|
|
695
|
+
"none"
|
|
696
|
+
]).optional(),
|
|
697
|
+
sources: z.array(z.enum(["s3", "hosted"])).optional(),
|
|
698
|
+
storageError: requiredString$1.optional(),
|
|
699
|
+
sessions: z.array(ReviewAgentTraceSessionSchema)
|
|
700
|
+
}), ReviewErrorResponseSchema]);
|
|
701
|
+
z.discriminatedUnion("ok", [z.strictObject({
|
|
702
|
+
ok: z.literal(true),
|
|
703
|
+
parserVersion: requiredString$1,
|
|
704
|
+
session: ReviewAgentTraceSessionSchema,
|
|
705
|
+
trace: stringAllowEmpty.nullable().optional(),
|
|
706
|
+
cacheStatus: z.enum([
|
|
707
|
+
"current",
|
|
708
|
+
"offline",
|
|
709
|
+
"stale"
|
|
710
|
+
]).optional(),
|
|
711
|
+
subagents: z.array(requiredString$1).default([]),
|
|
712
|
+
title: z.string().nullable(),
|
|
713
|
+
startedAt: z.string().nullable(),
|
|
714
|
+
endedAt: z.string().nullable(),
|
|
715
|
+
activeMs: z.number().nullable(),
|
|
716
|
+
userTurns: z.number(),
|
|
717
|
+
toolCalls: z.number(),
|
|
718
|
+
events: z.array(ReviewAgentTraceEventSchema)
|
|
719
|
+
}), ReviewErrorResponseSchema]);
|
|
720
|
+
//#endregion
|
|
721
|
+
//#region ../review-protocol/src/bug-report.ts
|
|
722
|
+
const requiredString = z.string({ error: "must be a string" }).refine((value) => value.trim().length > 0, "must be a string");
|
|
723
|
+
const ReviewBugReportRequestSchema = z.strictObject({
|
|
724
|
+
description: z.string(),
|
|
725
|
+
include_review: z.boolean(),
|
|
726
|
+
include_map: z.boolean(),
|
|
727
|
+
include_diff: z.boolean(),
|
|
728
|
+
/** @deprecated Ignored: reports never attach an agent trace. */
|
|
729
|
+
include_trace: z.boolean().optional(),
|
|
730
|
+
screenshot: z.strictObject({
|
|
731
|
+
mime: z.literal("image/jpeg"),
|
|
732
|
+
base64: z.string()
|
|
733
|
+
}).optional(),
|
|
734
|
+
app_session_id: requiredString.min(16).max(128).regex(/^[A-Za-z0-9_-][A-Za-z0-9_.-]*$/),
|
|
735
|
+
app_version: requiredString.max(100)
|
|
736
|
+
});
|
|
737
|
+
const compressedPartBytes = z.number().int().positive().max(1e8);
|
|
738
|
+
const compressedSha256 = z.string().regex(/^[a-f0-9]{64}$/);
|
|
739
|
+
const ReviewBugReportPartSchema = z.discriminatedUnion("field", [z.strictObject({
|
|
740
|
+
field: z.literal("payload"),
|
|
741
|
+
filename: z.literal("payload.json.gz"),
|
|
742
|
+
bytes: compressedPartBytes,
|
|
743
|
+
sha256: compressedSha256
|
|
744
|
+
}), z.strictObject({
|
|
745
|
+
field: z.literal("trace"),
|
|
746
|
+
filename: z.string().regex(/^trace-(0|[1-9]\d?)\.jsonl\.gz$/),
|
|
747
|
+
bytes: compressedPartBytes,
|
|
748
|
+
sha256: compressedSha256,
|
|
749
|
+
session_id: requiredString.max(128)
|
|
750
|
+
})]);
|
|
751
|
+
const ReviewBugReportMetaV2Schema = z.strictObject({
|
|
752
|
+
schema_version: z.literal(2),
|
|
753
|
+
description_length: z.number().int().nonnegative().max(65536),
|
|
754
|
+
description: z.string().refine((value) => new TextEncoder().encode(value).byteLength <= 65536, "must not exceed 65,536 UTF-8 bytes").optional(),
|
|
755
|
+
has_review: z.boolean(),
|
|
756
|
+
has_map: z.boolean(),
|
|
757
|
+
has_diff: z.boolean(),
|
|
758
|
+
has_screenshot: z.boolean(),
|
|
759
|
+
has_trace: z.boolean(),
|
|
760
|
+
trace_harness: z.enum([
|
|
761
|
+
"claude-code",
|
|
762
|
+
"codex",
|
|
763
|
+
"opencode",
|
|
764
|
+
"pi"
|
|
765
|
+
]).optional(),
|
|
766
|
+
payload_bytes: z.number().int().positive().max(10485760),
|
|
767
|
+
app_version: requiredString.max(100),
|
|
768
|
+
cli_version: requiredString.max(100),
|
|
769
|
+
platform: z.enum([
|
|
770
|
+
"aix",
|
|
771
|
+
"android",
|
|
772
|
+
"darwin",
|
|
773
|
+
"freebsd",
|
|
774
|
+
"haiku",
|
|
775
|
+
"linux",
|
|
776
|
+
"openbsd",
|
|
777
|
+
"sunos",
|
|
778
|
+
"win32",
|
|
779
|
+
"cygwin",
|
|
780
|
+
"netbsd"
|
|
781
|
+
]),
|
|
782
|
+
truncated_diff: z.boolean(),
|
|
783
|
+
truncated_map: z.boolean(),
|
|
784
|
+
truncated_screenshot: z.boolean(),
|
|
785
|
+
truncated_trace: z.boolean(),
|
|
786
|
+
parts: z.array(ReviewBugReportPartSchema).min(1).max(34)
|
|
787
|
+
}).superRefine((meta, context) => {
|
|
788
|
+
if (meta.description !== void 0 && new TextEncoder().encode(meta.description).byteLength !== meta.description_length) context.addIssue({
|
|
789
|
+
code: "custom",
|
|
790
|
+
path: ["description_length"],
|
|
791
|
+
message: "must match the description UTF-8 byte length"
|
|
792
|
+
});
|
|
793
|
+
const [first, ...traces] = meta.parts;
|
|
794
|
+
const validOrder = first?.field === "payload" && traces.every((part, index) => part.field === "trace" && part.filename === `trace-${index}.jsonl.gz`);
|
|
795
|
+
const sessionIds = traces.map((part) => part.field === "trace" ? part.session_id : "");
|
|
796
|
+
if (!validOrder || new Set(sessionIds).size !== sessionIds.length) context.addIssue({
|
|
797
|
+
code: "custom",
|
|
798
|
+
path: ["parts"],
|
|
799
|
+
message: "must list the payload then trace-<n> parts in order"
|
|
800
|
+
});
|
|
801
|
+
if (meta.has_trace !== traces.length > 0) context.addIssue({
|
|
802
|
+
code: "custom",
|
|
803
|
+
path: ["has_trace"],
|
|
804
|
+
message: "must match the presence of trace parts"
|
|
805
|
+
});
|
|
806
|
+
if (meta.has_trace !== (meta.trace_harness !== void 0)) context.addIssue({
|
|
807
|
+
code: "custom",
|
|
808
|
+
path: ["trace_harness"],
|
|
809
|
+
message: "must be present only when the report has a trace"
|
|
810
|
+
});
|
|
811
|
+
if (!meta.has_trace && meta.truncated_trace) context.addIssue({
|
|
812
|
+
code: "custom",
|
|
813
|
+
path: ["truncated_trace"],
|
|
814
|
+
message: "must be false when the report has no trace"
|
|
815
|
+
});
|
|
816
|
+
if (meta.parts[0]?.bytes !== meta.payload_bytes) context.addIssue({
|
|
817
|
+
code: "custom",
|
|
818
|
+
path: ["payload_bytes"],
|
|
819
|
+
message: "must match the payload part size"
|
|
820
|
+
});
|
|
821
|
+
});
|
|
822
|
+
const ReviewBugReportResponseSchema = z.discriminatedUnion("ok", [z.strictObject({
|
|
823
|
+
ok: z.literal(true),
|
|
824
|
+
report_id: z.uuid(),
|
|
825
|
+
short_id: requiredString.length(12)
|
|
826
|
+
}), z.strictObject({
|
|
827
|
+
ok: z.literal(false),
|
|
828
|
+
error: requiredString
|
|
829
|
+
})]);
|
|
830
|
+
function parseReviewBugReportResponse(value) {
|
|
831
|
+
return ReviewBugReportResponseSchema.parse(value);
|
|
832
|
+
}
|
|
833
|
+
//#endregion
|
|
834
|
+
//#region ../review-protocol/src/index.ts
|
|
835
|
+
function parseReviewDesktopDiscovery(value) {
|
|
836
|
+
return parseZod(ReviewDesktopDiscoverySchema, value);
|
|
837
|
+
}
|
|
838
|
+
function parseReviewCliInstallApplyRequest(value) {
|
|
839
|
+
return parseZod(ReviewCliInstallApplyRequestSchema, value);
|
|
840
|
+
}
|
|
841
|
+
function parseReviewDesktopVerbResult(value) {
|
|
842
|
+
return parseZod(ReviewDesktopVerbResultSchema, value);
|
|
843
|
+
}
|
|
844
|
+
function parseReviewVerbRequest(value) {
|
|
845
|
+
return parseZod(ReviewVerbRequestSchema, value);
|
|
846
|
+
}
|
|
847
|
+
function parseReviewVerbResponse(value) {
|
|
848
|
+
return parseZod(ReviewVerbResponseSchema, value);
|
|
849
|
+
}
|
|
850
|
+
function parseZod(schema, value, label, prefixPath = false) {
|
|
851
|
+
const result = schema.safeParse(value);
|
|
852
|
+
if (result.success) return result.data;
|
|
853
|
+
const issue = result.error.issues[0];
|
|
854
|
+
const issuePath = formatIssuePath(issue?.path ?? []);
|
|
855
|
+
const path = prefixPath && label ? issuePath ? `${label}.${issuePath}` : label : issuePath || label;
|
|
856
|
+
throw new Error(`${path ? `${path} ` : ""}${issue?.message ?? "Invalid input"}`);
|
|
857
|
+
}
|
|
858
|
+
function formatIssuePath(path) {
|
|
859
|
+
let output = "";
|
|
860
|
+
for (const segment of path) if (Number.isInteger(segment)) output += `[${String(segment)}]`;
|
|
861
|
+
else output += `${output ? "." : ""}${String(segment)}`;
|
|
862
|
+
return output;
|
|
863
|
+
}
|
|
864
|
+
//#endregion
|
|
865
|
+
export { SCRATCHPAD_REVIEW_ID as _, parseReviewVerbResponse as a, structuralChangeCounts as b, ReviewBugReportRequestSchema as c, REVIEW_CLIENT_REMOTE as d, REVIEW_DIFF_LAYOUTS as f, ReviewSelectedDiffSchema as g, ReviewCliInstallStampSchema as h, parseReviewVerbRequest as i, parseReviewBugReportResponse as l, ReviewApiSelectionSourceSchema as m, parseReviewDesktopDiscovery as n, parseZod as o, REVIEW_THEME_CHOICES as p, parseReviewDesktopVerbResult as r, ReviewBugReportMetaV2Schema as s, parseReviewCliInstallApplyRequest as t, REVIEW_CLIENT_HEADER as u, reviewDiffrSummarizerInputSchema as v, decodeStructuralDiffEvent as y };
|