@horizon36596/zenith-schema 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +18 -0
  3. package/README.md +24 -0
  4. package/dist/auto.d.ts +1882 -0
  5. package/dist/auto.d.ts.map +1 -0
  6. package/dist/auto.js +236 -0
  7. package/dist/auto.js.map +1 -0
  8. package/dist/common.d.ts +76 -0
  9. package/dist/common.d.ts.map +1 -0
  10. package/dist/common.js +30 -0
  11. package/dist/common.js.map +1 -0
  12. package/dist/expr.d.ts +56 -0
  13. package/dist/expr.d.ts.map +1 -0
  14. package/dist/expr.js +245 -0
  15. package/dist/expr.js.map +1 -0
  16. package/dist/field.d.ts +719 -0
  17. package/dist/field.d.ts.map +1 -0
  18. package/dist/field.js +158 -0
  19. package/dist/field.js.map +1 -0
  20. package/dist/ids.d.ts +62 -0
  21. package/dist/ids.d.ts.map +1 -0
  22. package/dist/ids.js +79 -0
  23. package/dist/ids.js.map +1 -0
  24. package/dist/index.d.ts +17 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +17 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/jsonschema.d.ts +14 -0
  29. package/dist/jsonschema.d.ts.map +1 -0
  30. package/dist/jsonschema.js +31 -0
  31. package/dist/jsonschema.js.map +1 -0
  32. package/dist/link.d.ts +117 -0
  33. package/dist/link.d.ts.map +1 -0
  34. package/dist/link.js +58 -0
  35. package/dist/link.js.map +1 -0
  36. package/dist/migrate.d.ts +2699 -0
  37. package/dist/migrate.d.ts.map +1 -0
  38. package/dist/migrate.js +109 -0
  39. package/dist/migrate.js.map +1 -0
  40. package/dist/parse.d.ts +28 -0
  41. package/dist/parse.d.ts.map +1 -0
  42. package/dist/parse.js +46 -0
  43. package/dist/parse.js.map +1 -0
  44. package/dist/robot.d.ts +2935 -0
  45. package/dist/robot.d.ts.map +1 -0
  46. package/dist/robot.js +231 -0
  47. package/dist/robot.js.map +1 -0
  48. package/dist/waypoints.d.ts +63 -0
  49. package/dist/waypoints.d.ts.map +1 -0
  50. package/dist/waypoints.js +20 -0
  51. package/dist/waypoints.js.map +1 -0
  52. package/json/auto.json +683 -0
  53. package/json/field.json +457 -0
  54. package/json/link.json +110 -0
  55. package/json/robot.json +664 -0
  56. package/json/waypoints.json +50 -0
  57. package/package.json +65 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auto.d.ts","sourceRoot":"","sources":["../src/auto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI5B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK9B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAyE,CAAC;AAapG;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAM7B,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBrB,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC1C,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAClD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAClD,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
package/dist/auto.js ADDED
@@ -0,0 +1,236 @@
1
+ import { z } from "zod";
2
+ import { poseSchema, poseSourceSchema } from "./common.js";
3
+ import { formatVersionFor, schemaIdField } from "./ids.js";
4
+ /**
5
+ * The highest number of Bezier control points a v1 auto file may carry, so the highest degree is
6
+ * four (start, three controls, end).
7
+ *
8
+ * Read off the pinned Pedro snapshot: `Paths.curve(Pose...)` is variadic,
9
+ * `BezierCurve(List<Vector2D>)` accepts any control polygon of three points or more, and the
10
+ * runtime hands every pose in `control[]` straight to `Paths.curve`. The owner's ruling was
11
+ * "whatever Pedro allows", so the file format allows one to three control points. Changing this
12
+ * number changes the file format, not just the code.
13
+ */
14
+ export const MAX_BEZIER_CONTROL_POINTS = 3;
15
+ export const lineSegmentSchema = z.object({
16
+ kind: z.literal("line"),
17
+ from: poseSourceSchema,
18
+ to: poseSourceSchema,
19
+ });
20
+ export const bezierSegmentSchema = z.object({
21
+ kind: z.literal("bezier"),
22
+ from: poseSourceSchema,
23
+ control: z.array(poseSchema).min(1).max(MAX_BEZIER_CONTROL_POINTS),
24
+ to: poseSourceSchema,
25
+ });
26
+ export const segmentSchema = z.discriminatedUnion("kind", [lineSegmentSchema, bezierSegmentSchema]);
27
+ const tangentHeadingSchema = z.object({ mode: z.literal("tangent") });
28
+ const tangentReversedHeadingSchema = z.object({ mode: z.literal("tangentReversed") });
29
+ const constantHeadingSchema = z.object({ mode: z.literal("constant"), headingRad: z.number() });
30
+ const linearHeadingSchema = z.object({ mode: z.literal("linear"), fromRad: z.number(), toRad: z.number() });
31
+ const facePointHeadingSchema = z.object({
32
+ mode: z.literal("facePoint"),
33
+ xIn: z.number(),
34
+ yIn: z.number(),
35
+ offsetRad: z.number().optional(),
36
+ });
37
+ /**
38
+ * The heading one range of a `piecewise` heading carries: any mode but `piecewise` itself. Inside a
39
+ * range, `linear` turns from `fromRad` at the range's start to `toRad` at its end.
40
+ */
41
+ export const rangeHeadingSchema = z.discriminatedUnion("mode", [
42
+ tangentHeadingSchema,
43
+ tangentReversedHeadingSchema,
44
+ constantHeadingSchema,
45
+ linearHeadingSchema,
46
+ facePointHeadingSchema,
47
+ ]);
48
+ /**
49
+ * One stretch of a `piecewise` heading (format version 3): from `startT` to `endT` along the step,
50
+ * as fractions of its arc length (no unit), with its own heading. Pedro's
51
+ * `Interpolator.piecewise().until(t, ...)` needs the ranges to run from 0 to exactly 1, in order,
52
+ * with no gap and no overlap; the schema only bounds each number and `HEADING_RANGES` checks the
53
+ * rest, so a half-edited file still loads and says what is wrong with it.
54
+ */
55
+ export const headingRangeSchema = z.object({
56
+ startT: z.number().min(0).max(1),
57
+ endT: z.number().min(0).max(1),
58
+ heading: rangeHeadingSchema,
59
+ });
60
+ /** The heading modes of site/docs/file-format.md, as h(t). */
61
+ export const headingSchema = z.discriminatedUnion("mode", [
62
+ tangentHeadingSchema,
63
+ tangentReversedHeadingSchema,
64
+ constantHeadingSchema,
65
+ linearHeadingSchema,
66
+ facePointHeadingSchema,
67
+ z.object({ mode: z.literal("piecewise"), ranges: z.array(headingRangeSchema).min(1) }),
68
+ ]);
69
+ export const markerAtSchema = z.union([
70
+ z.object({ t: z.number().min(0).max(1) }),
71
+ z.object({ distanceIn: z.number().nonnegative() }),
72
+ z.object({ distanceFromEndIn: z.number().nonnegative() }),
73
+ ]);
74
+ export const commandCallSchema = z.object({
75
+ name: z.string().min(1),
76
+ args: z.record(z.string(), z.union([z.string(), z.number(), z.boolean()])).optional(),
77
+ });
78
+ export const markerSchema = z.object({
79
+ at: markerAtSchema,
80
+ command: commandCallSchema,
81
+ });
82
+ export const conditionRefSchema = z.object({
83
+ condition: z.string().min(1),
84
+ });
85
+ /** Planner-only annotations; the runtime ignores them (site/docs/file-format.md, `expect`). */
86
+ export const expectSchema = z.object({
87
+ collectFrom: z.string().min(1).optional(),
88
+ count: z.number().optional(),
89
+ launchesInto: z.string().min(1).optional(),
90
+ tip: z.enum(["own", "opponent"]).optional(),
91
+ });
92
+ export const pathStepSchema = z.object({
93
+ id: z.string().min(1).optional(),
94
+ kind: z.literal("path"),
95
+ timeoutS: z.number().positive().optional(),
96
+ segments: z.array(segmentSchema).min(1),
97
+ heading: headingSchema.optional(),
98
+ speedFraction: z.number().positive().max(1).optional(),
99
+ markers: z.array(markerSchema).optional(),
100
+ endCondition: conditionRefSchema.optional(),
101
+ expect: expectSchema.optional(),
102
+ notes: z.string().optional(),
103
+ });
104
+ export const commandStepSchema = z.object({
105
+ id: z.string().min(1).optional(),
106
+ kind: z.literal("command"),
107
+ name: z.string().min(1),
108
+ args: z.record(z.string(), z.union([z.string(), z.number(), z.boolean()])).optional(),
109
+ timeoutS: z.number().positive().optional(),
110
+ expect: expectSchema.optional(),
111
+ notes: z.string().optional(),
112
+ });
113
+ /** How a wait step is named in a schema message, which is all the refinements can see of it. */
114
+ const waitName = (step) => step.id === undefined ? "a wait step" : `the wait step ${JSON.stringify(step.id)}`;
115
+ /**
116
+ * A wait ends one way or the other: after `seconds`, or when `until` reads true. Carrying both is
117
+ * refused rather than resolved, because the two readings disagree by the whole of `seconds` — the
118
+ * estimator would budget the number and the generated Java would emit a `WaitUntilCommand` and
119
+ * ignore it.
120
+ */
121
+ export const waitStepSchema = z
122
+ .object({
123
+ id: z.string().min(1).optional(),
124
+ kind: z.literal("wait"),
125
+ seconds: z.number().nonnegative().optional(),
126
+ until: z.string().min(1).optional(),
127
+ timeoutS: z.number().positive().optional(),
128
+ notes: z.string().optional(),
129
+ })
130
+ .refine((step) => step.seconds !== undefined || step.until !== undefined, (step) => ({
131
+ message: `${waitName(step)} needs either seconds or until`,
132
+ }))
133
+ .refine((step) => step.seconds === undefined || step.until === undefined, (step) => ({
134
+ message: `${waitName(step)} has both seconds and until; a wait ends either after a time or on a condition, not both`,
135
+ }));
136
+ /** Every step kind, in the order the editor's insert menu lists them. */
137
+ export const STEP_KINDS = ["path", "command", "wait", "sequence", "parallel", "branch"];
138
+ /**
139
+ * The lists of steps a step holds, in document order: none for a leaf, one for a sequence or a
140
+ * parallel group, `then` and (when present) `else` for a branch. Every walk over the step tree
141
+ * goes through this and `withChildLists`, so a new group kind is one change here and not one in
142
+ * every walker.
143
+ */
144
+ export function childLists(step) {
145
+ switch (step.kind) {
146
+ case "sequence":
147
+ case "parallel":
148
+ return [step.steps];
149
+ case "branch":
150
+ return step.else === undefined ? [step.then] : [step.then, step.else];
151
+ default:
152
+ return [];
153
+ }
154
+ }
155
+ /**
156
+ * The same step with its child lists replaced, in the order `childLists` returned them. The
157
+ * input is not mutated. A leaf is returned as it is.
158
+ */
159
+ export function withChildLists(step, lists) {
160
+ switch (step.kind) {
161
+ case "sequence":
162
+ case "parallel":
163
+ return { ...step, steps: lists[0] ?? step.steps };
164
+ case "branch": {
165
+ const updated = { ...step, then: lists[0] ?? step.then };
166
+ if (step.else !== undefined)
167
+ updated.else = lists[1] ?? step.else;
168
+ return updated;
169
+ }
170
+ default:
171
+ return step;
172
+ }
173
+ }
174
+ /** True for the step kinds that hold other steps. */
175
+ export const isGroupStep = (step) => step.kind === "sequence" || step.kind === "parallel" || step.kind === "branch";
176
+ /**
177
+ * A `sequence` runs its steps one after another and ends when the last one does (format version
178
+ * 2). On its own at the top level it changes nothing; its point is inside a `parallel` group or a
179
+ * branch arm, where it lets several steps act as one member, such as intake on, wait, intake off
180
+ * running alongside a drive.
181
+ */
182
+ export const sequenceStepSchema = z.object({
183
+ id: z.string().min(1).optional(),
184
+ kind: z.literal("sequence"),
185
+ // At least one member, for the same reason as a parallel group.
186
+ steps: z.array(z.lazy(() => stepSchema)).min(1),
187
+ notes: z.string().optional(),
188
+ });
189
+ export const parallelStepSchema = z.object({
190
+ id: z.string().min(1).optional(),
191
+ kind: z.literal("parallel"),
192
+ mode: z.enum(["all", "race", "deadline"]),
193
+ deadline: z.string().min(1).optional(),
194
+ // At least one member: an empty group has no meaning, and both the estimator and the generated
195
+ // Java reach for a first member that would not be there.
196
+ steps: z.array(z.lazy(() => stepSchema)).min(1),
197
+ notes: z.string().optional(),
198
+ });
199
+ export const branchStepSchema = z.object({
200
+ id: z.string().min(1).optional(),
201
+ kind: z.literal("branch"),
202
+ condition: z.string().min(1),
203
+ then: z.array(z.lazy(() => stepSchema)),
204
+ else: z.array(z.lazy(() => stepSchema)).optional(),
205
+ notes: z.string().optional(),
206
+ });
207
+ export const stepSchema = z.lazy(() => z.union([
208
+ pathStepSchema,
209
+ commandStepSchema,
210
+ waitStepSchema,
211
+ sequenceStepSchema,
212
+ parallelStepSchema,
213
+ branchStepSchema,
214
+ ]));
215
+ /**
216
+ * `*.auto.json`: one routine. Steps run in sequence (site/docs/file-format.md).
217
+ * Key declaration order is the canonical file order.
218
+ */
219
+ export const autoSchema = z.object({
220
+ $schema: schemaIdField("auto"),
221
+ formatVersion: formatVersionFor("auto"),
222
+ name: z.string().min(1),
223
+ title: z.string().optional(),
224
+ description: z.string().optional(),
225
+ robot: z.string().min(1).optional(),
226
+ field: z.string().min(1).optional(),
227
+ alliance: z.enum(["RED", "BLUE"]),
228
+ authors: z.array(z.string().min(1)).optional(),
229
+ created: z.string().optional(),
230
+ start: z.object({
231
+ pose: z.union([z.object({ ref: z.string().min(1) }), poseSchema]),
232
+ holds: z.record(z.string(), z.number()).optional(),
233
+ }),
234
+ steps: z.array(stepSchema).min(1),
235
+ });
236
+ //# sourceMappingURL=auto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auto.js","sourceRoot":"","sources":["../src/auto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE3D;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAE3C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACvB,IAAI,EAAE,gBAAgB;IACtB,EAAE,EAAE,gBAAgB;CACrB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;IACzB,IAAI,EAAE,gBAAgB;IACtB,OAAO,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AAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACnC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACnC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC9C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC;QACjE,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;KACnD,CAAC;IACF,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;CAClC,CAAC,CAAC"}
@@ -0,0 +1,76 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Provenance is a plain string, using the biobuzz vocabulary (MEASURED, SET BY HAND, SPEC, NEEDS
4
+ * MEASUREMENT, CARRIED OVER, PLACEHOLDER, APPROX, SET FROM SIM, SET FROM EDITOR, CALIBRATED FROM
5
+ * SIM, CALIBRATED FROM ROBOT). It is not an enum: the label is followed by the reason, and the
6
+ * rule that matters (CLAUDE.md rule 4) is that a number carries one at all.
7
+ */
8
+ export declare const provenanceSchema: z.ZodString;
9
+ /** A number that came from somewhere, with the label saying where. */
10
+ export declare const valuedNumberSchema: z.ZodObject<{
11
+ value: z.ZodNumber;
12
+ provenance: z.ZodOptional<z.ZodString>;
13
+ }, "strip", z.ZodTypeAny, {
14
+ value: number;
15
+ provenance?: string | undefined;
16
+ }, {
17
+ value: number;
18
+ provenance?: string | undefined;
19
+ }>;
20
+ /** A pose in the field frame. `headingRad` is optional where a heading mode supplies it. */
21
+ export declare const poseSchema: z.ZodObject<{
22
+ xIn: z.ZodNumber;
23
+ yIn: z.ZodNumber;
24
+ headingRad: z.ZodOptional<z.ZodNumber>;
25
+ provenance: z.ZodOptional<z.ZodString>;
26
+ }, "strip", z.ZodTypeAny, {
27
+ xIn: number;
28
+ yIn: number;
29
+ provenance?: string | undefined;
30
+ headingRad?: number | undefined;
31
+ }, {
32
+ xIn: number;
33
+ yIn: number;
34
+ provenance?: string | undefined;
35
+ headingRad?: number | undefined;
36
+ }>;
37
+ /** A reference to a named pose in `waypoints.json`. */
38
+ export declare const poseRefSchema: z.ZodObject<{
39
+ ref: z.ZodString;
40
+ }, "strip", z.ZodTypeAny, {
41
+ ref: string;
42
+ }, {
43
+ ref: string;
44
+ }>;
45
+ /**
46
+ * Where a segment starts or ends: an inline pose, a waypoint reference, or the string `"current"`,
47
+ * meaning the pose the previous step ended at.
48
+ */
49
+ export declare const poseSourceSchema: z.ZodUnion<[z.ZodLiteral<"current">, z.ZodObject<{
50
+ ref: z.ZodString;
51
+ }, "strip", z.ZodTypeAny, {
52
+ ref: string;
53
+ }, {
54
+ ref: string;
55
+ }>, z.ZodObject<{
56
+ xIn: z.ZodNumber;
57
+ yIn: z.ZodNumber;
58
+ headingRad: z.ZodOptional<z.ZodNumber>;
59
+ provenance: z.ZodOptional<z.ZodString>;
60
+ }, "strip", z.ZodTypeAny, {
61
+ xIn: number;
62
+ yIn: number;
63
+ provenance?: string | undefined;
64
+ headingRad?: number | undefined;
65
+ }, {
66
+ xIn: number;
67
+ yIn: number;
68
+ provenance?: string | undefined;
69
+ headingRad?: number | undefined;
70
+ }>]>;
71
+ export type Provenance = z.infer<typeof provenanceSchema>;
72
+ export type ValuedNumber = z.infer<typeof valuedNumberSchema>;
73
+ export type Pose = z.infer<typeof poseSchema>;
74
+ export type PoseRef = z.infer<typeof poseRefSchema>;
75
+ export type PoseSource = z.infer<typeof poseSourceSchema>;
76
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,aAAoB,CAAC;AAElD,sEAAsE;AACtE,eAAO,MAAM,kBAAkB;;;;;;;;;EAG7B,CAAC;AAEH,4FAA4F;AAC5F,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;EAKrB,CAAC;AAEH,uDAAuD;AACvD,eAAO,MAAM,aAAa;;;;;;EAExB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;IAA6D,CAAC;AAE3F,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAC9C,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
package/dist/common.js ADDED
@@ -0,0 +1,30 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Provenance is a plain string, using the biobuzz vocabulary (MEASURED, SET BY HAND, SPEC, NEEDS
4
+ * MEASUREMENT, CARRIED OVER, PLACEHOLDER, APPROX, SET FROM SIM, SET FROM EDITOR, CALIBRATED FROM
5
+ * SIM, CALIBRATED FROM ROBOT). It is not an enum: the label is followed by the reason, and the
6
+ * rule that matters (CLAUDE.md rule 4) is that a number carries one at all.
7
+ */
8
+ export const provenanceSchema = z.string().min(1);
9
+ /** A number that came from somewhere, with the label saying where. */
10
+ export const valuedNumberSchema = z.object({
11
+ value: z.number(),
12
+ provenance: provenanceSchema.optional(),
13
+ });
14
+ /** A pose in the field frame. `headingRad` is optional where a heading mode supplies it. */
15
+ export const poseSchema = z.object({
16
+ xIn: z.number(),
17
+ yIn: z.number(),
18
+ headingRad: z.number().optional(),
19
+ provenance: provenanceSchema.optional(),
20
+ });
21
+ /** A reference to a named pose in `waypoints.json`. */
22
+ export const poseRefSchema = z.object({
23
+ ref: z.string().min(1),
24
+ });
25
+ /**
26
+ * Where a segment starts or ends: an inline pose, a waypoint reference, or the string `"current"`,
27
+ * meaning the pose the previous step ended at.
28
+ */
29
+ export const poseSourceSchema = z.union([z.literal("current"), poseRefSchema, poseSchema]);
30
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAElD,sEAAsE;AACtE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,UAAU,EAAE,gBAAgB,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC;AAEH,4FAA4F;AAC5F,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,UAAU,EAAE,gBAAgB,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC;AAEH,uDAAuD;AACvD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACvB,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC"}
package/dist/expr.d.ts ADDED
@@ -0,0 +1,56 @@
1
+ /**
2
+ * The `estimateS` expression grammar (site/docs/file-format.md, robot.json rules).
3
+ *
4
+ * expr := term (('+' | '-') term)*
5
+ * term := factor (('*' | '/') factor)*
6
+ * factor := '-'? primary
7
+ * primary := number | name | 'max' '(' expr ',' expr ')' | 'min' '(' expr ',' expr ')'
8
+ * | '(' expr ')'
9
+ *
10
+ * Or the whole string is the literal `"unknown"`, which means the timeline shows a hatched block
11
+ * and the total is a lower bound. Parsing and evaluation are pure: no clock, no randomness.
12
+ */
13
+ /** The string that means "this command's duration cannot be predicted". */
14
+ export declare const UNKNOWN_ESTIMATE = "unknown";
15
+ export type EstimateExpr = {
16
+ kind: "unknown";
17
+ } | {
18
+ kind: "number";
19
+ value: number;
20
+ } | {
21
+ kind: "name";
22
+ name: string;
23
+ } | {
24
+ kind: "unary";
25
+ op: "-";
26
+ operand: EstimateExpr;
27
+ } | {
28
+ kind: "binary";
29
+ op: "+" | "-" | "*" | "/";
30
+ left: EstimateExpr;
31
+ right: EstimateExpr;
32
+ } | {
33
+ kind: "call";
34
+ name: "max" | "min";
35
+ args: [EstimateExpr, EstimateExpr];
36
+ };
37
+ export declare class EstimateExprError extends Error {
38
+ readonly source: string;
39
+ readonly position: number;
40
+ constructor(message: string, source: string, position: number);
41
+ }
42
+ /** Parses an `estimateS` string. Throws EstimateExprError on anything outside the grammar. */
43
+ export declare function parseEstimateExpression(source: string): EstimateExpr;
44
+ /** True when the string is a legal `estimateS` value. Used by the robot schema. */
45
+ export declare function isEstimateExpression(source: string): boolean;
46
+ /** The parameter names an expression reads, so the caller can check them against the registry. */
47
+ export declare function estimateExpressionNames(expr: EstimateExpr): string[];
48
+ /**
49
+ * Evaluates an expression against a scope of parameter values. Returns null for `"unknown"`, for a
50
+ * name the scope does not define, and for division by zero: all three mean "no number here", which
51
+ * the timeline draws as a hatched block rather than a wrong answer.
52
+ */
53
+ export declare function evaluateEstimateExpression(expr: EstimateExpr, scope?: Readonly<Record<string, number>>): number | null;
54
+ /** Parse and evaluate in one call. Throws on a syntax error, returns null on an unknown value. */
55
+ export declare function evaluateEstimate(source: string, scope?: Readonly<Record<string, number>>): number | null;
56
+ //# sourceMappingURL=expr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expr.d.ts","sourceRoot":"","sources":["../src/expr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,2EAA2E;AAC3E,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAE1C,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,EAAE,EAAE,GAAG,CAAC;IAAC,OAAO,EAAE,YAAY,CAAA;CAAE,GACjD;IAAE,IAAI,EAAE,QAAQ,CA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