@tsplc/tmp-debug 0.0.0-stage → 0.6.2

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 (78) hide show
  1. package/README.md +38 -2
  2. package/dist/api.js +744 -0
  3. package/dist/api.js.map +12 -0
  4. package/dist/constant.js +33 -0
  5. package/dist/constant.js.map +10 -0
  6. package/dist/explain-file.js +468 -0
  7. package/dist/explain-file.js.map +11 -0
  8. package/dist/explain.js +1310 -0
  9. package/dist/explain.js.map +19 -0
  10. package/dist/format.js +214 -0
  11. package/dist/format.js.map +12 -0
  12. package/dist/index.js +4066 -0
  13. package/dist/index.js.map +44 -0
  14. package/dist/manifest.js +240 -0
  15. package/dist/manifest.js.map +10 -0
  16. package/dist/paths.js +242 -0
  17. package/dist/paths.js.map +10 -0
  18. package/package.json +72 -4
  19. package/src/adapter.ts +77 -0
  20. package/src/api.ts +446 -0
  21. package/src/app-server.ts +151 -0
  22. package/src/build-files.ts +46 -0
  23. package/src/constant.ts +41 -0
  24. package/src/debugger.ts +237 -0
  25. package/src/errors.ts +13 -0
  26. package/src/explain-expressions.ts +484 -0
  27. package/src/explain-file.ts +325 -0
  28. package/src/explain-frames.ts +155 -0
  29. package/src/explain-loops.ts +151 -0
  30. package/src/explain-operations.ts +232 -0
  31. package/src/explain-tables.ts +345 -0
  32. package/src/explain-value.ts +203 -0
  33. package/src/explain-verdicts.ts +548 -0
  34. package/src/explain.ts +82 -0
  35. package/src/hardware.ts +159 -0
  36. package/src/http.ts +218 -0
  37. package/src/index.ts +44 -0
  38. package/src/jobs.ts +139 -0
  39. package/src/login-value.ts +165 -0
  40. package/src/login.ts +315 -0
  41. package/src/manifest.ts +328 -0
  42. package/src/opcua.ts +80 -0
  43. package/src/paths.ts +363 -0
  44. package/src/requests.ts +99 -0
  45. package/src/server-cursor.ts +22 -0
  46. package/src/shown.ts +229 -0
  47. package/src/telemetry.ts +125 -0
  48. package/src/timeline.ts +148 -0
  49. package/src/trace.ts +62 -0
  50. package/src/ui/bits.ts +48 -0
  51. package/src/ui/client.ts +87 -0
  52. package/src/ui/dom.ts +61 -0
  53. package/src/ui/explain-read.ts +105 -0
  54. package/src/ui/format.ts +261 -0
  55. package/src/ui/hardware.ts +425 -0
  56. package/src/ui/header.ts +207 -0
  57. package/src/ui/health.ts +64 -0
  58. package/src/ui/index.ts +27 -0
  59. package/src/ui/jobs.ts +263 -0
  60. package/src/ui/links.ts +59 -0
  61. package/src/ui/live-value.ts +85 -0
  62. package/src/ui/main.ts +76 -0
  63. package/src/ui/overview.ts +178 -0
  64. package/src/ui/page.ts +286 -0
  65. package/src/ui/pages.ts +64 -0
  66. package/src/ui/recent-window.ts +49 -0
  67. package/src/ui/recent.ts +355 -0
  68. package/src/ui/request-trace.ts +38 -0
  69. package/src/ui/requests.ts +80 -0
  70. package/src/ui/routes.ts +98 -0
  71. package/src/ui/store.ts +295 -0
  72. package/src/ui/success-cache.ts +11 -0
  73. package/src/ui/tree.ts +162 -0
  74. package/src/ui/variables.ts +597 -0
  75. package/src/ui/why-watch.ts +11 -0
  76. package/src/ui/why.ts +694 -0
  77. package/src/values.ts +170 -0
  78. package/src/watch.ts +32 -0
@@ -0,0 +1,12 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/api.ts", "../src/explain-file.ts", "../src/manifest.ts"],
4
+ "sourcesContent": [
5
+ "import { qualitySchema } from \"@tsplc/opcua/contract\";\nimport { serviceCall } from \"@tsplc/server/requests\";\nimport { type AppRecord, appRecord } from \"@tsplc/server/telemetry\";\nimport { z } from \"zod\";\nimport { explainFile, explainFlags } from \"./explain-file\";\nimport { debugIo, debugManifest, sourceRange } from \"./manifest\";\n\n/**\n * The debugger API's response shapes, shared by the host, the browser UI and the VS Code extension,\n * which validate what they receive against them. Routes are listed in `createDebugHandler` (http.ts);\n * streams are Server-Sent Events whose event names are the keys of `streamEventSchemas`.\n */\n\n/**\n * The header the debugger's and the agent dashboard's pages send on anything but `GET`. Another site\n * can make a browser send a cookie, but not a custom header, so the agent refuses a change signed in\n * by cookie, Tailscale or from its own PC without it.\n */\nexport const dashboardHeader = \"x-tsplc-dashboard\";\n\n/** The query parameter that carries a page's token to the API, since EventSource cannot send headers. */\nexport const tokenQueryParameter = \"token\";\n\n/** The body of every 4xx and 5xx reply. */\nexport const errorBodySchema = z.object({ error: z.string() });\nexport type ErrorBody = z.infer<typeof errorBodySchema>;\n\nexport { type Quality, qualitySchema } from \"@tsplc/opcua/contract\";\n\n/** One value as read. Values of different paths may come from different scans. */\nexport const sampleSchema = z.object({\n\tpath: z.string(),\n\tvalue: z.unknown(),\n\tquality: qualitySchema,\n\tstatus: z.string(),\n\t/** When the debugger host received it; the controller reports no time of its own. */\n\treceivedAt: z.string(),\n\t/** The controller read that returned it; samples with the same `read` were read together. */\n\tread: z.number().int().optional(),\n});\nexport type Sample = z.infer<typeof sampleSchema>;\n\n/** `unavailable`: nothing to read through, such as no engineering login open. */\nexport const connectionStateSchema = z.enum([\n\t\"connecting\",\n\t\"connected\",\n\t\"lost\",\n\t\"failed\",\n\t\"unavailable\",\n]);\nexport type ConnectionState = z.infer<typeof connectionStateSchema>;\n\nexport const sessionSchema = z.object({\n\tbuild: z.object({\n\t\tmanifest: z.string().nullable(),\n\t\tcontroller: z.string().nullable(),\n\t\tmatches: z.boolean(),\n\t}),\n\tconnection: z.object({\n\t\tstate: connectionStateSchema,\n\t\tsince: z.string(),\n\t\tendpoint: z.string(),\n\t\terror: z.string().optional(),\n\t}),\n\t/** How live values are read, such as \"engineering login\", and how often. */\n\treading: z.object({ method: z.string(), intervalMs: z.number() }),\n\t/** From the tasks' telemetry batches; `dropped` counts records overwritten before they were sent. */\n\ttasks: z.array(\n\t\tz.object({\n\t\t\tname: z.string(),\n\t\t\tscan: z.number().nullable(),\n\t\t\tscansPerSecond: z.number().nullable(),\n\t\t\tdropped: z.number(),\n\t\t}),\n\t),\n\t/** PLC clock minus the app server's clock, estimated from telemetry batches. */\n\tclock: z\n\t\t.object({ offsetMs: z.number(), uncertaintyMs: z.number() })\n\t\t.nullable(),\n\trelease: z\n\t\t.object({ id: z.string(), deployedAt: z.string(), operation: z.string() })\n\t\t.optional(),\n\t/** The project directory on the host, when served by `tsplc debug`. */\n\tprojectRoot: z.string().optional(),\n});\nexport type Session = z.infer<typeof sessionSchema>;\n\n/** A trace record, decoded through the manifest's event sites. */\nexport const traceEventSchema = z.object({\n\tsequence: z.number(),\n\ttask: z.string(),\n\tscan: z.number(),\n\tplcTime: z.number(),\n\tsite: z.number(),\n\tvalue: z.unknown(),\n\t/** The site's guard operands, in the site's order. */\n\toperands: z.array(\n\t\tz.object({\n\t\t\ttext: z.string(),\n\t\t\tpath: z.string().optional(),\n\t\t\tstable: z.boolean(),\n\t\t\tvalue: z.unknown(),\n\t\t}),\n\t),\n});\nexport type TraceEvent = z.infer<typeof traceEventSchema>;\n\nexport type { AppRecord };\n\n/** One PLC service call, as the app server traced it. */\nexport const requestTraceSchema = serviceCall;\nexport type RequestTrace = z.infer<typeof requestTraceSchema>;\n\n/**\n * A job as last seen. `busy` is null until it is known: from the trace's start and finish\n * records, or read through the login while a page shows the job. The rest is read only while it\n * is busy and shown.\n */\nexport const jobStateSchema = z.object({\n\tid: z.number(),\n\t/** Of the `busy` reading; a traced job's is good. */\n\tquality: qualitySchema,\n\tbusy: z.boolean().nullable(),\n\tcancelling: z.boolean().optional(),\n\tstep: z.number().optional(),\n\tcurrent: z\n\t\t.object({ kind: z.string(), range: sourceRange, text: z.string() })\n\t\t.optional(),\n\tstartedAt: z.string().optional(),\n\telapsedMs: z.number().optional(),\n\trequest: z\n\t\t.object({\n\t\t\tservice: z.string(),\n\t\t\tsequence: z.number(),\n\t\t\ttrace: requestTraceSchema.optional(),\n\t\t})\n\t\t.optional(),\n\t/** Busy, but over the number of jobs whose details are read on each poll. */\n\tunread: z.literal(true).optional(),\n\t/** The last failure nothing caught, from the program's `exception` records. */\n\tfailure: z\n\t\t.object({\n\t\t\tat: z.string(),\n\t\t\tcode: z.number(),\n\t\t\tname: z.string().optional(),\n\t\t\tsource: z.string(),\n\t\t})\n\t\t.optional(),\n});\nexport type JobState = z.infer<typeof jobStateSchema>;\n\n/** \"unknown\" unless the driver's own state was read. */\nexport const healthStateSchema = z.enum([\"unknown\", \"ok\", \"fault\", \"stale\"]);\nexport type HealthState = z.infer<typeof healthStateSchema>;\n\nexport const deviceStateSchema = z.object({\n\tid: z.string(),\n\thealth: z.object({\n\t\tstate: healthStateSchema,\n\t\tvalue: z.number().optional(),\n\t\tname: z.string().optional(),\n\t\tdiagnostic: z.boolean().optional(),\n\t\tmessage: z.string().optional(),\n\t\tquality: qualitySchema,\n\t}),\n\tassemblies: z.array(\n\t\tz.object({\n\t\t\tdirection: z.enum([\"input\", \"output\"]),\n\t\t\taddress: z.string().optional(),\n\t\t\tbytes: z.array(z.number()).nullable(),\n\t\t\tquality: qualitySchema,\n\t\t}),\n\t),\n\t/** Channels bound to TypeScript I/O paths, by channel id. */\n\tchannels: z.array(\n\t\tz.object({\n\t\t\tid: z.string(),\n\t\t\tpath: z.string(),\n\t\t\tvalue: z.unknown(),\n\t\t\tquality: qualitySchema,\n\t\t}),\n\t),\n\t/** The device's hand-configured status symbols, by label. */\n\tstatus: z.record(\n\t\tz.string(),\n\t\tz.object({ value: z.unknown(), quality: qualitySchema }),\n\t),\n});\nexport type DeviceState = z.infer<typeof deviceStateSchema>;\n\nexport const timelineSourceSchema = z.enum([\n\t\"plc\",\n\t\"server\",\n\t\"agent\",\n\t\"debugger\",\n]);\nexport type TimelineSource = z.infer<typeof timelineSourceSchema>;\n\nconst timelinePlacement = {\n\tat: z.string(),\n\t/** Placed through another clock (the PLC's, or the app server's), so its order is approximate. */\n\tapproximate: z.boolean(),\n\tsource: timelineSourceSchema,\n\t/**\n\t * Where a client resumes, with `GET /api/timeline?after=<cursor>` rather than `since`: entries\n\t * arrive late and are placed by `at`, so the timeline is in time order, not cursor order. A\n\t * client resumes from the cursor on the entry it received last. An entry that changes, such as\n\t * a call that ends, takes a new cursor and is served again. A host started since the cursor was\n\t * issued, such as by a deploy, answers it with its whole timeline.\n\t */\n\tcursor: z.string().optional(),\n};\n\n/** An entry of the \"Recent\" view: the server's recent window, merged with the agent's logs. */\nexport const timelineEntrySchema = z.discriminatedUnion(\"kind\", [\n\tz.object({\n\t\t...timelinePlacement,\n\t\tkind: z.literal(\"app\"),\n\t\ttask: z.string(),\n\t\tsequence: z.number(),\n\t\trecord: appRecord,\n\t}),\n\tz.object({\n\t\t...timelinePlacement,\n\t\tkind: z.literal(\"trace\"),\n\t\ttrace: traceEventSchema,\n\t}),\n\tz.object({\n\t\t...timelinePlacement,\n\t\tkind: z.literal(\"request\"),\n\t\trequest: requestTraceSchema,\n\t}),\n\tz.object({\n\t\t...timelinePlacement,\n\t\tkind: z.literal(\"deploy\"),\n\t\trelease: z.string(),\n\t\toperation: z.string(),\n\t\tbuild: z.string().optional(),\n\t\tuser: z.string().optional(),\n\t\thost: z.string().optional(),\n\t}),\n\tz.object({\n\t\t...timelinePlacement,\n\t\tkind: z.literal(\"audit\"),\n\t\t/** As typed after `tsplc`, such as `force` or `reset cold`. */\n\t\tcommand: z.string(),\n\t\t/** Expressions written or forced, with their values; unforced expressions map to \"\". */\n\t\tvalues: z.record(z.string(), z.string()),\n\t\t/** The values read just before a write or force. */\n\t\tprevious: z.record(z.string(), z.string()).optional(),\n\t\tuser: z.string().optional(),\n\t\thost: z.string().optional(),\n\t\trelease: z.string().optional(),\n\t\terror: z.string().optional(),\n\t}),\n\tz.object({\n\t\t...timelinePlacement,\n\t\tkind: z.literal(\"connection\"),\n\t\tstate: connectionStateSchema,\n\t\terror: z.string().optional(),\n\t}),\n]);\nexport type TimelineEntry = z.infer<typeof timelineEntrySchema>;\n\nexport const watchGroupsSchema = z.strictObject({\n\tgroups: z.record(z.string().nonempty(), z.array(z.string().nonempty())),\n});\nexport type WatchGroups = z.infer<typeof watchGroupsSchema>;\n\n/**\n * What a page shows, so the host reads only that: `watch` paths, `jobs` by id, the health of\n * `health` devices, and everything of `devices`. Stream query parameters, comma-separated.\n */\nexport interface Interest {\n\twatch: string[];\n\tjobs: number[];\n\thealth: string[];\n\tdevices: string[];\n\t/** Tasks whose PLC clock to read with the watched values, as `clockSample(task)` samples. */\n\tclocks: string[];\n\t/** `writers` entries whose last-writer slot to read with the watched values, as `slotSample(index)` samples. */\n\tslots: number[];\n}\n\n/**\n * The sample path of a task's PLC clock and of a last-writer slot. TypeScript paths never contain\n * a colon, so these can't name a variable.\n */\nexport const clockSample = (task: string) => `tsplc:clock/${task}`;\nexport const slotSample = (writer: number) => `tsplc:writer/${writer}`;\n\n/** A stream's query for `interest`: each non-empty list, deduplicated, sorted and comma-separated. */\nexport const interestQuery = (\n\tinterest: Partial<Interest>,\n): Record<string, string> =>\n\tObject.fromEntries(\n\t\tObject.entries(interest).flatMap(([name, values]) => {\n\t\t\tconst list = [...new Set(values.map(String))].sort().join(\",\");\n\t\t\treturn list ? [[name, list]] : [];\n\t\t}),\n\t);\n\n/** Each stream event's data, by event name. Clients ignore names not listed here. */\nexport const streamEventSchemas = {\n\tsession: sessionSchema,\n\tsample: sampleSchema,\n\tjob: jobStateSchema,\n\trequest: requestTraceSchema,\n\tdevice: deviceStateSchema,\n\ttimeline: timelineEntrySchema,\n};\nexport type StreamEvents = {\n\t[Name in keyof typeof streamEventSchemas]: z.infer<\n\t\t(typeof streamEventSchemas)[Name]\n\t>;\n};\n\ntype NamedStreamEvent<Name extends keyof StreamEvents> = {\n\t[Event in Name]: { name: Event; data: StreamEvents[Event] };\n}[Name];\nexport type StreamEvent = NamedStreamEvent<keyof StreamEvents>;\n\nconst isStreamEventName = (name: string): name is keyof StreamEvents =>\n\tObject.hasOwn(streamEventSchemas, name);\n\nconst decodeNamed = <Name extends keyof StreamEvents>(\n\tname: Name,\n\tdata: string,\n): NamedStreamEvent<Name> => {\n\t// Typed per event, so `schemas[name]` stays paired with `Name` rather than widening to every schema.\n\tconst schemas: {\n\t\t[Event in keyof StreamEvents]: z.ZodType<StreamEvents[Event]>;\n\t} = streamEventSchemas;\n\tconst parsed = schemas[name].safeParse(JSON.parse(data));\n\tif (!parsed.success) {\n\t\tthrow new Error(\n\t\t\t`The debugger sent a malformed ${name} event: ${z.prettifyError(parsed.error)}`,\n\t\t);\n\t}\n\treturn { name, data: parsed.data };\n};\n\n/**\n * Decodes one stream event's data, or returns undefined for an event this client doesn't know,\n * so a newer host's events are ignored. Data that doesn't match a known event's shape throws.\n */\nexport const decodeStreamEvent = (\n\tname: string,\n\tdata: string,\n): StreamEvent | undefined =>\n\tisStreamEventName(name) ? decodeNamed(name, data) : undefined;\n\n/** The statements that can write a path, with the chains of calls each runs through. */\nexport const explanationSchema = z.object({\n\tpath: z.string(),\n\ttype: z.string(),\n\twriters: z.array(\n\t\tz.object({\n\t\t\tassignment: z.number().int(),\n\t\t\t/** The path's index for each `[*]` of the writer's pattern. */\n\t\t\tindexes: z.array(z.number().int()),\n\t\t\tchains: z.array(\n\t\t\t\tz.object({\n\t\t\t\t\ttask: z.string(),\n\t\t\t\t\tentry: z.number().int(),\n\t\t\t\t\tcalls: z.array(z.number().int()),\n\t\t\t\t}),\n\t\t\t),\n\t\t}),\n\t),\n\tflags: explainFlags.omit({ path: true }),\n\tio: debugIo.nullable(),\n});\nexport type ExplanationResponse = z.infer<typeof explanationSchema>;\n\n/** The paths the controller forces, or null when the forced state isn't known, as of `at`. */\nexport const forcedSchema = z.object({\n\tforced: z.array(z.string()).nullable(),\n\tat: z.string(),\n});\nexport type Forced = z.infer<typeof forcedSchema>;\n\n/** Response bodies by route; errors are `errorBodySchema`. */\nexport const apiResponseSchemas = {\n\t\"GET /api/session\": sessionSchema,\n\t\"GET /api/manifest\": debugManifest,\n\t\"GET /api/values\": z.array(sampleSchema),\n\t\"GET /api/jobs\": z.array(jobStateSchema),\n\t\"GET /api/hardware\": z.array(deviceStateSchema),\n\t\"GET /api/timeline\": z.array(timelineEntrySchema),\n\t\"GET /api/watch\": watchGroupsSchema,\n\t\"PUT /api/watch\": watchGroupsSchema,\n\t\"GET /api/explain\": explanationSchema,\n\t\"GET /api/explain-file\": explainFile,\n\t\"GET /api/forced\": forcedSchema,\n};\nexport type ApiResponses = {\n\t[Route in keyof typeof apiResponseSchemas]: z.infer<\n\t\t(typeof apiResponseSchemas)[Route]\n\t>;\n};\n\nexport interface ServerSentEvent {\n\tevent: string;\n\tdata: string;\n}\n\n/**\n * Parses a `text/event-stream` body by the HTML field rules, with lines ended by CR, LF or CRLF.\n * Comments, `id` and `retry` are skipped.\n */\nexport async function* parseEventStream(\n\tchunks: AsyncIterable<string>,\n): AsyncGenerator<ServerSentEvent> {\n\tlet buffer = \"\";\n\tlet event = \"\";\n\tlet data: string[] = [];\n\tfor await (const chunk of chunks) {\n\t\tbuffer += chunk;\n\t\t// A trailing CR may be the first half of a CRLF split across chunks.\n\t\tconst end = buffer.endsWith(\"\\r\") ? buffer.length - 1 : buffer.length;\n\t\tconst lines = buffer.slice(0, end).split(/\\r\\n|\\r|\\n/);\n\t\tbuffer = lines.splice(-1).join(\"\") + buffer.slice(end);\n\t\tfor (const line of lines) {\n\t\t\tif (!line) {\n\t\t\t\tif (data.length) {\n\t\t\t\t\tyield { event: event || \"message\", data: data.join(\"\\n\") };\n\t\t\t\t}\n\t\t\t\tevent = \"\";\n\t\t\t\tdata = [];\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (line.startsWith(\":\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst colon = line.indexOf(\":\");\n\t\t\tconst field = colon < 0 ? line : line.slice(0, colon);\n\t\t\tconst value = colon < 0 ? \"\" : line.slice(colon + 1).replace(/^ /, \"\");\n\t\t\tif (field === \"event\") {\n\t\t\t\tevent = value;\n\t\t\t} else if (field === \"data\") {\n\t\t\t\tdata.push(value);\n\t\t\t}\n\t\t}\n\t}\n}\n",
6
+ "import {\n\tvalueBinaryOperators,\n\tvalueUnaryOperators,\n} from \"@tsplc/iec/arithmetic\";\nimport { z } from \"zod\";\nimport { json, sourceRange } from \"./manifest\";\n\n/**\n * Why each stored value is what it is: every statement that writes it, the conditions it runs\n * under and the expressions it evaluates, rebuilt from the compiler's per-instance model. Written\n * beside `debug.json`, whose `explain.sha256` binds it to the build, as `explainFile`.\n */\nexport const explainFileName = \"explain.json\";\n\n/** An index into one of this file's tables. */\nconst tableIndex = z.number().int().nonnegative();\n/** A pre-order statement index within a routine. */\nconst position = z.number().int().nonnegative();\n\nexport const explainExpression = z.discriminatedUnion(\"kind\", [\n\t/** Stored state, captured at `capturedAt`; `path` is a slot of its routine row's `paths`. */\n\tz.object({\n\t\tkind: z.literal(\"read\"),\n\t\tpath: tableIndex,\n\t\tcapturedAt: position,\n\t\t/** A call runs between the read and its use, and may have changed what was read. */\n\t\tinterleaved: z.literal(true).optional(),\n\t\ttype: z.string(),\n\t}),\n\t/** An element at runtime indexes: `path` has a `[*]` for each of `indexes`. */\n\tz.object({\n\t\tkind: z.literal(\"pattern\"),\n\t\tpath: tableIndex,\n\t\tindexes: z.array(tableIndex),\n\t\tcapturedAt: position,\n\t\tinterleaved: z.literal(true).optional(),\n\t\ttype: z.string(),\n\t}),\n\tz.object({ kind: z.literal(\"constant\"), value: json, type: z.string() }),\n\tz.object({\n\t\tkind: z.literal(\"record\"),\n\t\tfields: z.record(z.string(), tableIndex),\n\t\ttype: z.string(),\n\t}),\n\tz.object({\n\t\tkind: z.literal(\"array\"),\n\t\tlower: z.number().int(),\n\t\titems: z.array(tableIndex),\n\t\ttype: z.string(),\n\t}),\n\t/** A local, by its slot in its routine row's `locals`, read at `at`. */\n\tz.object({\n\t\tkind: z.literal(\"local\"),\n\t\tlocal: tableIndex,\n\t\tpath: z.array(z.string()),\n\t\tat: position,\n\t\ttype: z.string(),\n\t}),\n\t/** The routine's parameter: the call site's argument, or its `locals` slot when the routine writes it. */\n\tz.object({\n\t\tkind: z.literal(\"parameter\"),\n\t\tparameter: z.number().int().nonnegative(),\n\t\tpath: z.array(z.string()),\n\t\tat: position,\n\t\tlocal: tableIndex.nullable(),\n\t\ttype: z.string(),\n\t}),\n\t/** A call's result: `call` is a slot of its routine row's `calls`. */\n\tz.object({\n\t\tkind: z.literal(\"call\"),\n\t\tcall: tableIndex,\n\t\tpath: z.array(z.string()),\n\t\ttype: z.string(),\n\t}),\n\t/** The PLC's millisecond clock as a DINT. */\n\tz.object({ kind: z.literal(\"clock\"), type: z.string() }),\n\t/** An object reference: its operand holds a setup object's id, listed in `references`. */\n\tz.object({ kind: z.literal(\"reference\"), operand: tableIndex }),\n\tz.object({\n\t\tkind: z.literal(\"unary\"),\n\t\toperator: z.enum(valueUnaryOperators),\n\t\toperand: tableIndex,\n\t\ttype: z.string(),\n\t}),\n\tz.object({\n\t\tkind: z.literal(\"binary\"),\n\t\toperator: z.enum(valueBinaryOperators),\n\t\tpolicy: z.enum([\"wrap\", \"saturate\"]).optional(),\n\t\tleft: tableIndex,\n\t\tright: tableIndex,\n\t\ttype: z.string(),\n\t}),\n\tz.object({\n\t\tkind: z.literal(\"convert\"),\n\t\tpolicy: z.enum([\"exact\", \"wrap\", \"saturate\"]),\n\t\toperand: tableIndex,\n\t\ttype: z.string(),\n\t}),\n\tz.object({\n\t\tkind: z.literal(\"logical\"),\n\t\toperator: z.enum([\"and\", \"or\"]),\n\t\tleft: tableIndex,\n\t\tright: tableIndex,\n\t}),\n\tz.object({\n\t\tkind: z.literal(\"select\"),\n\t\tcondition: tableIndex,\n\t\t// biome-ignore lint/suspicious/noThenProperty: a `?:` branch is data, not a thenable.\n\t\tthen: tableIndex,\n\t\telse: tableIndex,\n\t\ttype: z.string(),\n\t}),\n\t/** Not traced: `text` says why, and `reads` lists the stored values it depends on. */\n\tz.object({\n\t\tkind: z.literal(\"opaque\"),\n\t\ttext: tableIndex,\n\t\treads: z.array(tableIndex),\n\t\ttype: z.string(),\n\t}),\n]);\nexport type ExplainExpression = z.infer<typeof explainExpression>;\n\n/** Holds when none of the conjunctions holds: no earlier statement left. */\nconst exitsCondition = z.object({\n\tkind: z.literal(\"exits\"),\n\tget any(): z.ZodArray<z.ZodArray<typeof explainCondition>> {\n\t\treturn z.array(z.array(explainCondition));\n\t},\n});\n\n// A union rather than a discriminated one: TypeScript can't infer a discriminated union that contains itself.\nexport const explainCondition = z.union([\n\tz.object({\n\t\tkind: z.literal(\"test\"),\n\t\ttest: tableIndex,\n\t\tholds: z.boolean(),\n\t\tat: position,\n\t\ttext: tableIndex.nullable(),\n\t}),\n\tz.object({\n\t\tkind: z.literal(\"cases\"),\n\t\ttest: tableIndex,\n\t\tvalues: z.array(json),\n\t\tmember: z.boolean(),\n\t\tat: position,\n\t\ttext: tableIndex.nullable(),\n\t}),\n\texitsCondition,\n\t/** `loop` is a slot of the routine row's `loops`. */\n\tz.object({ kind: z.literal(\"loop\"), loop: tableIndex }),\n\t/** Holds when no iteration of the loop returned. */\n\tz.object({ kind: z.literal(\"loopReturns\"), loop: tableIndex }),\n\t/** The routine row's job is at `step`. */\n\tz.object({ kind: z.literal(\"job\"), step: z.number().int() }),\n\t/** Code outside the job's step switch, which runs while the job is busy. */\n\tz.object({ kind: z.literal(\"jobBusy\") }),\n]);\nexport type ExplainCondition = z.infer<typeof explainCondition>;\n\nconst record = {\n\troutine: tableIndex,\n\tposition,\n\t/** The innermost `conditions` entry the statement runs under; its parents are the outer ones. Null for none. */\n\tconditions: tableIndex.nullable(),\n\t/** The `sites` entry for where the statement is; null when it has no source in the project. */\n\tsite: tableIndex.nullable(),\n};\n\nconst written = z.discriminatedUnion(\"kind\", [\n\tz.object({ kind: z.literal(\"path\"), path: tableIndex }),\n\tz.object({\n\t\tkind: z.literal(\"pattern\"),\n\t\tpath: tableIndex,\n\t\tindexes: z.array(tableIndex),\n\t}),\n]);\n\nexport const explainAssignment = z.object({\n\t...record,\n\tkind: z.enum([\"assign\", \"call\", \"block\", \"input\", \"return\", \"counter\"]),\n\twrites: written,\n\t/** A record or array written as a whole, so it writes every path below `writes`. */\n\twhole: z.boolean(),\n\tvalue: tableIndex.nullable(),\n\t/** A standard block's update: its kind, inputs and elapsed-time output. */\n\tblock: z\n\t\t.object({\n\t\t\tkind: z.string(),\n\t\t\tinputs: z.record(z.string(), tableIndex),\n\t\t\telapsed: tableIndex.nullable(),\n\t\t})\n\t\t.nullable(),\n\t/**\n\t * For a write through a by-reference parameter, the calls from the writer up to where the place\n\t * is named, innermost first. The write reaches the path only through these calls, and the\n\t * indexes of a pattern it writes are evaluated in the outermost one's caller.\n\t */\n\tvia: z.array(tableIndex),\n\tloop: tableIndex.nullable(),\n});\nexport type ExplainAssignment = z.infer<typeof explainAssignment>;\n\nexport const explainLocal = z.object({\n\troutine: tableIndex,\n\tname: z.string(),\n\tparameter: z.boolean(),\n\treference: z.boolean(),\n\tdefinitions: z.array(\n\t\tz.object({\n\t\t\t...record,\n\t\t\tkind: z.enum([\"assign\", \"borrowed\", \"counter\"]),\n\t\t\tpath: z.array(z.string()),\n\t\t\tvalue: tableIndex.nullable(),\n\t\t\tcall: tableIndex.nullable(),\n\t\t\tloop: tableIndex.nullable(),\n\t\t}),\n\t),\n});\nexport type ExplainLocal = z.infer<typeof explainLocal>;\n\nexport const explainCall = z.object({\n\t...record,\n\t/** The callee's `routines[].key`; the receiver picks the instance row. */\n\tcallee: z.string(),\n\treceiver: z.discriminatedUnion(\"kind\", [\n\t\tz.object({ kind: z.literal(\"none\") }),\n\t\tz.object({ kind: z.literal(\"path\"), path: tableIndex }),\n\t\tz.object({\n\t\t\tkind: z.literal(\"pattern\"),\n\t\t\tpath: tableIndex,\n\t\t\tindexes: z.array(tableIndex),\n\t\t}),\n\t]),\n\t/** One expression per parameter; a by-reference argument is the place it borrows. */\n\targuments: z.array(tableIndex),\n\tloop: tableIndex.nullable(),\n});\nexport type ExplainCall = z.infer<typeof explainCall>;\n\nexport const explainFlags = z.object({\n\tpath: tableIndex,\n\t/** The manifest `io` row the path is bound to. */\n\tinput: z.number().int().nullable(),\n\tclientWritable: z.boolean(),\n\t/** The label of the HMI control that writes the path. */\n\thmiControl: z.string().nullable(),\n\tretained: z.boolean(),\n\tconstantTable: z.boolean(),\n\t/** Every task that writes the path, when that isn't only the task that reads it. */\n\twriterTasks: z.array(z.string()),\n\t/** The manifest job and service whose response the path holds. */\n\tservice: z.object({ job: z.number().int(), service: z.string() }).nullable(),\n\tinitial: json.nullable(),\n\treference: z.boolean(),\n});\nexport type ExplainFlags = z.infer<typeof explainFlags>;\n\nexport const explainFile = z.object({\n\tkind: z.literal(\"tsplc-explain\"),\n\tversion: z.literal(1),\n\tpaths: z.array(z.string()),\n\ttexts: z.array(z.string()),\n\texpressions: z.array(explainExpression),\n\t/**\n\t * Conditions as a tree: each entry holds under its parent, so a statement's conditions are its\n\t * entry and every parent, outermost last. Statements in one branch share the outer entries.\n\t */\n\tconditions: z.array(\n\t\tz.object({ parent: tableIndex.nullable(), condition: explainCondition }),\n\t),\n\t/** Source locations, with the source text there. */\n\tsites: z.array(z.object({ range: sourceRange, text: tableIndex.nullable() })),\n\troutines: z.array(\n\t\tz.object({\n\t\t\tkey: z.string(),\n\t\t\t/** The manifest's function id, when the manifest lists the routine. */\n\t\t\tfunction: z.number().int().nullable(),\n\t\t\tinstance: tableIndex.nullable(),\n\t\t\tname: z.string(),\n\t\t\tdeclaration: sourceRange.nullable(),\n\t\t\t/** The manifest job the instance is. */\n\t\t\tjob: z.number().int().nullable(),\n\t\t\t/**\n\t\t\t * What its expressions and conditions name, by slot: instances of one routine share those\n\t\t\t * and differ only here. `paths` index `paths`, `locals` index `locals`, `calls` index\n\t\t\t * `calls` and `loops` index `loops`.\n\t\t\t */\n\t\t\tpaths: z.array(tableIndex),\n\t\t\tlocals: z.array(tableIndex),\n\t\t\tcalls: z.array(tableIndex),\n\t\t\tloops: z.array(tableIndex),\n\t\t}),\n\t),\n\tloops: z.array(\n\t\tz.object({\n\t\t\troutine: tableIndex,\n\t\t\tposition,\n\t\t\tcounter: tableIndex,\n\t\t\tfirst: tableIndex,\n\t\t\tlimit: tableIndex,\n\t\t\texclusive: z.boolean(),\n\t\t\tstep: tableIndex,\n\t\t\tmaxIterations: z.number().int().nonnegative(),\n\t\t\tbreaks: z.array(z.array(explainCondition)),\n\t\t\tparent: tableIndex.nullable(),\n\t\t\tsite: tableIndex.nullable(),\n\t\t}),\n\t),\n\tassignments: z.array(explainAssignment),\n\tlocals: z.array(explainLocal),\n\treturns: z.array(z.object({ ...record, value: tableIndex.nullable() })),\n\tcalls: z.array(explainCall),\n\t/** The routines each task runs directly, in the order it runs them. */\n\tentries: z.array(\n\t\tz.object({\n\t\t\troutine: tableIndex,\n\t\t\ttask: z.string(),\n\t\t\torder: z.number().int().nonnegative(),\n\t\t}),\n\t),\n\tflags: z.array(explainFlags),\n\t/** Object id → `paths` index; −1 is `undefined`. */\n\treferences: z.record(z.string(), tableIndex),\n});\nexport type ExplainFile = z.infer<typeof explainFile>;\n",
7
+ "import { z } from \"zod\";\n\n/**\n * What a build tells the debugger: every TypeScript identity it can show, and the target symbol each one reads.\n * TypeScript paths (`bench.instruments[10].phase`) are the identity; `target` strings are opaque to\n * everything except the target's adapter (for CODESYS, IEC symbol paths such as `Bench.instruments…`).\n * Written by the compiler beside its emitted ST and shipped with each release, as `debugManifestFile`.\n */\nexport const debugManifestFile = \"debug.json\";\n\n/** A location in the project's own sources: `file` indexes `sources`; lines and columns are 1-based. */\nexport const sourceRange = z.object({\n\tfile: z.number().int(),\n\tline: z.number().int(),\n\tcolumn: z.number().int(),\n\tendLine: z.number().int(),\n\tendColumn: z.number().int(),\n});\n\n/** Any JSON value. */\nexport const json: z.ZodType<unknown> = z.lazy(() =>\n\tz.union([\n\t\tz.string(),\n\t\tz.number(),\n\t\tz.boolean(),\n\t\tz.null(),\n\t\tz.array(json),\n\t\tz.record(z.string(), json),\n\t]),\n);\n\nexport const debugField = z.object({\n\tname: z.string(),\n\ttarget: z.string(),\n\ttype: z.string(),\n\tdeclaration: sourceRange.optional(),\n\t/** Compiler-made storage, such as an async job's `step`; hidden unless asked for. */\n\tgenerated: z.literal(true).optional(),\n});\n\n/** Keys of `types` are opaque ids; scalars use their IEC name, such as `BOOL`. */\nexport const debugType = z.discriminatedUnion(\"kind\", [\n\tz.object({\n\t\tkind: z.literal(\"scalar\"),\n\t\tiec: z.string(),\n\t\t/** A STRING's or WSTRING's capacity in characters. */\n\t\tcapacity: z.number().int().optional(),\n\t}),\n\tz.object({\n\t\tkind: z.literal(\"enum\"),\n\t\tname: z.string(),\n\t\tmembers: z.record(z.string(), z.number().int()),\n\t\t/** For a plain TypeScript program's string-literal union, the string each member stands for. */\n\t\ttexts: z.record(z.string(), z.string()).optional(),\n\t}),\n\tz.object({\n\t\tkind: z.literal(\"record\"),\n\t\tname: z.string(),\n\t\tdeclaration: sourceRange.optional(),\n\t\tfields: z.array(debugField),\n\t}),\n\tz.object({\n\t\tkind: z.literal(\"array\"),\n\t\telement: z.string(),\n\t\tlength: z.number().int(),\n\t\t/** The first index; TypeScript paths use the target's own indexes, `lower` to `lower + length - 1`. */\n\t\tlower: z.number().int(),\n\t\t/** For `Record<Enum, T>`, the enum whose member values are the indexes. */\n\t\tindex: z.string().optional(),\n\t}),\n]);\n\nexport const debugRoot = z.object({\n\tpath: z.string(),\n\ttarget: z.string(),\n\ttype: z.string(),\n\tdeclaration: sourceRange.optional(),\n\t/** Readable at runtime through the target's adapter; for CODESYS, all stored state is. */\n\treadable: z.boolean(),\n\tgenerated: z.literal(true).optional(),\n});\n\n/** A field the compiler folded away: it has no runtime storage, but its value is known. */\nexport const debugConstant = z.object({\n\tpath: z.string(),\n\ttype: z.string(),\n\t/** Integers and durations as `encodeConstant` writes them. */\n\tvalue: json,\n\tdeclaration: sourceRange.optional(),\n});\n\nexport const debugIo = z.object({\n\tpath: z.string(),\n\ttarget: z.string(),\n\tdirection: z.enum([\"input\", \"output\"]),\n\ttype: z.string(),\n\tdevice: z.string().optional(),\n\tchannel: z.string().optional(),\n\taddress: z.string().optional(),\n\tinverted: z.literal(true).optional(),\n\tshared: z.literal(true).optional(),\n});\n\nexport const debugChannel = z.object({\n\tid: z.string(),\n\tname: z.string(),\n\tdirection: z.enum([\"input\", \"output\"]),\n\ttype: z.string(),\n\toffsetBits: z.number().int(),\n\tbits: z.number().int(),\n\taddress: z.string().optional(),\n\tunit: z.string().optional(),\n\tdescription: z.string().optional(),\n});\n\nexport const debugDevice = z.object({\n\tid: z.string(),\n\tproduct: z.string().optional(),\n\tvendor: z.string().optional(),\n\tproductCode: z.string().optional(),\n\tnetwork: z\n\t\t.object({ address: z.string(), rpiMs: z.number().optional() })\n\t\t.optional(),\n\tconnection: z.string().optional(),\n\tassemblies: z.array(\n\t\tz.object({\n\t\t\tdirection: z.enum([\"input\", \"output\"]),\n\t\t\tbytes: z.number().int(),\n\t\t\taddress: z.string().optional(),\n\t\t\t/** A byte array over the whole assembly, mapped or not. */\n\t\t\traw: z.string().optional(),\n\t\t}),\n\t),\n\t/**\n\t * Target paths of the driver's own state, such as a generated adapter's `eState`; absent means\n\t * the device's health is unknown.\n\t */\n\thealth: z\n\t\t.object({\n\t\t\tstate: z.string().optional(),\n\t\t\tstates: z.record(z.string(), z.number().int()).optional(),\n\t\t\tdiagnostic: z.string().optional(),\n\t\t\tmessage: z.string().optional(),\n\t\t})\n\t\t.optional(),\n\t/** Status symbols by label: hand-configured ones, and a generated Modbus server's error. */\n\tstatus: z.record(z.string(), z.string()).optional(),\n\tchannels: z.array(debugChannel),\n});\n\n/** A specialized function: one per method per instance, so `reads` resolve to concrete paths. */\nexport const debugFunction = z.object({\n\tid: z.number().int(),\n\tname: z.string(),\n\tdeclaration: sourceRange,\n\t/** The TypeScript path of `this`, for a method specialized to one instance. */\n\tinstance: z.string().optional(),\n\ttask: z.string().optional(),\n\ttarget: z.string(),\n\t/** Member reads in the body whose runtime path is static in this specialization. */\n\treads: z.array(z.object({ range: sourceRange, path: z.string() })),\n});\n\n/** The fields of a job's state, by name, with the IEC type the generated job block declares. */\nexport const jobStateFields = {\n\tstep: \"UINT\",\n\tcancelling: \"BOOL\",\n\tbusy: \"BOOL\",\n\tdone: \"BOOL\",\n\terror: \"UDINT\",\n} as const;\n\n/**\n * The fields the compiler adds to a block for the debugger, by key, with their IEC types: copies\n * of a job's `busy` and `step` for its trace, when it last started, and a service call's job and\n * request counter.\n */\nexport const instrumentationFields = {\n\tbusy: jobStateFields.busy,\n\tstep: jobStateFields.step,\n\tstartedAt: \"UDINT\",\n\tjob: \"UDINT\",\n\tsequence: \"UDINT\",\n} as const;\n\nexport const debugJob = z.object({\n\tid: z.number().int(),\n\tname: z.string(),\n\tdeclaration: sourceRange,\n\tinstance: z.string().optional(),\n\t/** The job's state, with the fields of `jobStateFields`. */\n\ttarget: z.string(),\n\tsteps: z.array(\n\t\tz.object({\n\t\t\tstep: z.number().int(),\n\t\t\tkind: z.enum([\"await\", \"return\", \"throw\", \"statement\"]),\n\t\t\trange: sourceRange,\n\t\t\ttext: z.string(),\n\t\t}),\n\t),\n\t/**\n\t * The PLC clock in milliseconds when the job last started: the clock of telemetry records'\n\t * `time` and a batch's `now`.\n\t */\n\tstartedAt: z.string().optional(),\n\t/**\n\t * Service calls the job awaits, its nested jobs' included; `sequence` is the request counter sent\n\t * as `x-tsplc-request`, with `job`'s id when a nested job makes the call.\n\t */\n\trequests: z.array(\n\t\tz.object({\n\t\t\tservice: z.string(),\n\t\t\ttarget: z.string(),\n\t\t\tsequence: z.string(),\n\t\t\tjob: z.number().int().optional(),\n\t\t}),\n\t),\n\t/** Made by the compiler, such as a service call's own job; hidden unless asked for. */\n\tgenerated: z.literal(true).optional(),\n});\n\n/**\n * Where `debug.trace` records: an enum state field changing, a decision function returning a\n * different value, or a job starting or finishing. Trace records name their site by `id`.\n */\nexport const debugEventSite = z.object({\n\tid: z.number().int(),\n\tkind: z.enum([\"state\", \"decision\", \"job\"]),\n\t/** For `kind: \"job\"`: the job, and whether it starts or finishes at this site. */\n\tjob: z.number().int().optional(),\n\tphase: z.enum([\"started\", \"finished\"]).optional(),\n\t/** The TypeScript path written, or of the job. */\n\tpath: z.string(),\n\tfunction: z.number().int().optional(),\n\ttype: z.string(),\n\trange: sourceRange,\n\ttext: z.string(),\n\ttask: z.string(),\n\t/**\n\t * Guard values captured in the same scan, at the write: each `if` condition leaf enclosing it.\n\t * `stable` is false when the body between the guard and the write can change the leaf.\n\t */\n\toperands: z.array(\n\t\tz.object({\n\t\t\ttext: z.string(),\n\t\t\trange: sourceRange,\n\t\t\ttype: z.string(),\n\t\t\tpath: z.string().optional(),\n\t\t\tstable: z.boolean(),\n\t\t}),\n\t),\n});\n\n/** A writer slot's value before any site writes it; site ids count from 1. */\nexport const neverWrittenSlot = 0;\n\n/** The IEC type of a writer slot, which holds the id of the site that last wrote its output. */\nexport const writerSlotType = \"UINT\";\n\n/** The statement that last wrote each output, per scan. */\nexport const debugWriter = z.object({\n\toutput: z.string(),\n\ttarget: z.string(),\n\t/** Every statement that can write `output` is probed, so the slot names its last writer exactly. */\n\texact: z.boolean().optional(),\n\tsites: z.array(\n\t\tz.object({\n\t\t\tid: z.number().int(),\n\t\t\trange: sourceRange,\n\t\t\tfunction: z.number().int(),\n\t\t\t/** The `explain.json` assignments this site is, one per instance that runs it. */\n\t\t\tassignments: z.array(z.number().int()).optional(),\n\t\t}),\n\t),\n});\n\n/** The IEC type of a task's scan clock. */\nexport const scanClockType = \"DINT\";\n\nexport const debugTask = z.object({\n\tname: z.string(),\n\tintervalMs: z.number(),\n\tpriority: z.number().int(),\n\t/** The PLC clock in milliseconds, of type `scanClockType`, as the task's first program read it this scan. */\n\tclock: z.string().optional(),\n});\n\nexport const debugManifest = z.object({\n\tkind: z.literal(\"tsplc-debug\"),\n\tversion: z.literal(1),\n\tbuild: z.object({\n\t\tid: z.string(),\n\t\t/** A variable holding `id`, to tell which build the controller runs. */\n\t\ttarget: z.string(),\n\t\tcompiler: z.string(),\n\t}),\n\t/** Project-relative paths. */\n\tsources: z.array(z.string()),\n\ttypes: z.record(z.string(), debugType),\n\troots: z.array(debugRoot),\n\tconstants: z.array(debugConstant),\n\tio: z.array(debugIo),\n\tdevices: z.array(debugDevice),\n\tfunctions: z.array(debugFunction),\n\tjobs: z.array(debugJob),\n\tevents: z.array(debugEventSite),\n\twriters: z.array(debugWriter),\n\ttasks: z.array(debugTask),\n\t/** Job error codes by number: 1 cancelled, 2 timeout… */\n\terrors: z.record(z.string(), z.string()),\n\t/** The digest of the build's `explain.json`; absent when the build has no explanations. */\n\texplain: z.object({ sha256: z.string() }).optional(),\n});\n\nexport type SourceRange = z.infer<typeof sourceRange>;\nexport type DebugType = z.infer<typeof debugType>;\nexport type DebugField = z.infer<typeof debugField>;\nexport type DebugRoot = z.infer<typeof debugRoot>;\nexport type DebugConstant = z.infer<typeof debugConstant>;\nexport type DebugIo = z.infer<typeof debugIo>;\nexport type DebugDevice = z.infer<typeof debugDevice>;\nexport type DebugChannel = z.infer<typeof debugChannel>;\nexport type DebugFunction = z.infer<typeof debugFunction>;\nexport type DebugJob = z.infer<typeof debugJob>;\nexport type DebugEventSite = z.infer<typeof debugEventSite>;\nexport type DebugWriter = z.infer<typeof debugWriter>;\nexport type DebugTask = z.infer<typeof debugTask>;\nexport type DebugManifest = z.infer<typeof debugManifest>;\n"
8
+ ],
9
+ "mappings": ";AAAA;AACA;AACA;AACA,cAAS;;;ACHT;AAAA;AAAA;AAAA;AAIA,cAAS;;;ACJT;AAWO,IAAM,cAAc,EAAE,OAAO;AAAA,EACnC,MAAM,EAAE,OAAO,EAAE,IAAI;AAAA,EACrB,MAAM,EAAE,OAAO,EAAE,IAAI;AAAA,EACrB,QAAQ,EAAE,OAAO,EAAE,IAAI;AAAA,EACvB,SAAS,EAAE,OAAO,EAAE,IAAI;AAAA,EACxB,WAAW,EAAE,OAAO,EAAE,IAAI;AAC3B,CAAC;AAGM,IAAM,OAA2B,EAAE,KAAK,MAC9C,EAAE,MAAM;AAAA,EACP,EAAE,OAAO;AAAA,EACT,EAAE,OAAO;AAAA,EACT,EAAE,QAAQ;AAAA,EACV,EAAE,KAAK;AAAA,EACP,EAAE,MAAM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AK,EAAE,IAAI,OAAO,MAAM,GAAG;AAAA,IACrD,WAAW,QAAQ,OAAO;AAAA,MACzB,IAAI,CAAC,MAAM;AAAA,QACV,IAAI,KAAK,QAAQ;AAAA,UAChB,MAAM,EAAE,OAAO,SAAS,WAAW,MAAM,KAAK,KAAK;AAAA,CAAI,EAAE;AAAA,QAC1D;AAAA,QACA,QAAQ;AAAA,QACR,OAAO,CAAC;AAAA,QACR;AAAA,MACD;AAAA,MACA,IAAI,KAAK,WAAW,GAAG,GAAG;AAAA,QACzB;AAAA,MACD;AAAA,MACA,MAAM,QAAQ,KAAK,QAAQ,GAAG;AAAA,MAC9B,MAAM,QAAQ,QAAQ,IAAI,OAAO,KAAK,MAAM,GAAG,KAAK;AAAA,MACpD,MAAM,QAAQ,QAAQ,IAAI,KAAK,KAAK,MAAM,QAAQ,CAAC,EAAE,QAAQ,MAAM,EAAE;AAAA,MACrE,IAAI,UAAU,SAAS;AAAA,QACtB,QAAQ;AAAA,MACT,EAAE,KAAK,IAAI,UAAU,QAAQ;AAAA,QAC5B,KAAK,KAAK,KAAK;AAAA,MAChB;AAAA,IACD;AAAA,EACD;AAAA;",
10
+ "debugId": "650A4E87AEF6248164756E2164756E21",
11
+ "names": []
12
+ }
@@ -0,0 +1,33 @@
1
+ // packages/debug/src/constant.ts
2
+ import { nanosecondsPerMillisecond } from "@tsplc/iec";
3
+ var encodeConstant = (scalar) => {
4
+ switch (scalar.kind) {
5
+ case "integer":
6
+ return Number.isSafeInteger(Number(scalar.value)) ? Number(scalar.value) : String(scalar.value);
7
+ case "duration":
8
+ return `${scalar.nanoseconds / nanosecondsPerMillisecond}ms`;
9
+ }
10
+ };
11
+ var decodeConstant = (value) => {
12
+ if (typeof value === "number" && Number.isInteger(value)) {
13
+ return { kind: "integer", value: BigInt(value) };
14
+ }
15
+ if (typeof value !== "string") {
16
+ return;
17
+ }
18
+ if (/^-?\d+$/.test(value)) {
19
+ return { kind: "integer", value: BigInt(value) };
20
+ }
21
+ const milliseconds = /^(-?\d+)ms$/.exec(value)?.[1];
22
+ return milliseconds === undefined ? undefined : {
23
+ kind: "duration",
24
+ nanoseconds: BigInt(milliseconds) * nanosecondsPerMillisecond
25
+ };
26
+ };
27
+ export {
28
+ decodeConstant,
29
+ encodeConstant
30
+ };
31
+
32
+ //# debugId=0481BA8CEEE833BE64756E2164756E21
33
+ //# sourceMappingURL=constant.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/constant.ts"],
4
+ "sourcesContent": [
5
+ "import { nanosecondsPerMillisecond } from \"@tsplc/iec\";\n\n/** A constant's scalar that JSON can't hold as itself: a whole number, or a duration. */\nexport type ConstantScalar =\n\t| { kind: \"integer\"; value: bigint }\n\t| { kind: \"duration\"; nanoseconds: bigint };\n\n/**\n * How `debug.json` and `explain.json` write a constant's scalar: an integer as a number while\n * doubles hold it exactly, else as its decimal text; a duration as whole milliseconds, `250ms`.\n */\nexport const encodeConstant = (scalar: ConstantScalar): number | string => {\n\tswitch (scalar.kind) {\n\t\tcase \"integer\":\n\t\t\treturn Number.isSafeInteger(Number(scalar.value))\n\t\t\t\t? Number(scalar.value)\n\t\t\t\t: String(scalar.value);\n\t\tcase \"duration\":\n\t\t\treturn `${scalar.nanoseconds / nanosecondsPerMillisecond}ms`;\n\t}\n};\n\n/** What `encodeConstant` wrote, or undefined for any other JSON value. */\nexport const decodeConstant = (value: unknown): ConstantScalar | undefined => {\n\tif (typeof value === \"number\" && Number.isInteger(value)) {\n\t\treturn { kind: \"integer\", value: BigInt(value) };\n\t}\n\tif (typeof value !== \"string\") {\n\t\treturn undefined;\n\t}\n\tif (/^-?\\d+$/.test(value)) {\n\t\treturn { kind: \"integer\", value: BigInt(value) };\n\t}\n\tconst milliseconds = /^(-?\\d+)ms$/.exec(value)?.[1];\n\treturn milliseconds === undefined\n\t\t? undefined\n\t\t: {\n\t\t\t\tkind: \"duration\",\n\t\t\t\tnanoseconds: BigInt(milliseconds) * nanosecondsPerMillisecond,\n\t\t\t};\n};\n"
6
+ ],
7
+ "mappings": ";AAAA;AAWO,IAAM,iBAAiB,CAAC,WAA4C;AAAA,EAC1E,QAAQ,OAAO;AAAA,IACd,KAAK;AAAA,MACJ,OAAO,OAAO,cAAc,OAAO,OAAO,KAAK,CAAC,IAC7C,OAAO,OAAO,KAAK,IACnB,OAAO,OAAO,KAAK;AAAA,IACvB,KAAK;AAAA,MACJ,OAAO,GAAG,OAAO,cAAc;AAAA;AAAA;AAK3B,IAAM,iBAAiB,CAAC,UAA+C;AAAA,EAC7E,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,KAAK,GAAG;AAAA,IACzD,OAAO,EAAE,MAAM,WAAW,OAAO,OAAO,KAAK,EAAE;AAAA,EAChD;AAAA,EACA,IAAI,OAAO,UAAU,UAAU;AAAA,IAC9B;AAAA,EACD;AAAA,EACA,IAAI,UAAU,KAAK,KAAK,GAAG;AAAA,IAC1B,OAAO,EAAE,MAAM,WAAW,OAAO,OAAO,KAAK,EAAE;AAAA,EAChD;AAAA,EACA,MAAM,eAAe,cAAc,KAAK,KAAK,IAAI;AAAA,EACjD,OAAO,iBAAiB,YACrB,YACA;AAAA,IACA,MAAM;AAAA,IACN,aAAa,OAAO,YAAY,IAAI;AAAA,EACrC;AAAA;",
8
+ "debugId": "0481BA8CEEE833BE64756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,468 @@
1
+ // packages/debug/src/explain-file.ts
2
+ import {
3
+ valueBinaryOperators,
4
+ valueUnaryOperators
5
+ } from "@tsplc/iec/arithmetic";
6
+ import { z as z2 } from "zod";
7
+
8
+ // packages/debug/src/manifest.ts
9
+ import { z } from "zod";
10
+ var sourceRange = z.object({
11
+ file: z.number().int(),
12
+ line: z.number().int(),
13
+ column: z.number().int(),
14
+ endLine: z.number().int(),
15
+ endColumn: z.number().int()
16
+ });
17
+ var json = z.lazy(() => z.union([
18
+ z.string(),
19
+ z.number(),
20
+ z.boolean(),
21
+ z.null(),
22
+ z.array(json),
23
+ z.record(z.string(), json)
24
+ ]));
25
+ var debugField = z.object({
26
+ name: z.string(),
27
+ target: z.string(),
28
+ type: z.string(),
29
+ declaration: sourceRange.optional(),
30
+ generated: z.literal(true).optional()
31
+ });
32
+ var debugType = z.discriminatedUnion("kind", [
33
+ z.object({
34
+ kind: z.literal("scalar"),
35
+ iec: z.string(),
36
+ capacity: z.number().int().optional()
37
+ }),
38
+ z.object({
39
+ kind: z.literal("enum"),
40
+ name: z.string(),
41
+ members: z.record(z.string(), z.number().int()),
42
+ texts: z.record(z.string(), z.string()).optional()
43
+ }),
44
+ z.object({
45
+ kind: z.literal("record"),
46
+ name: z.string(),
47
+ declaration: sourceRange.optional(),
48
+ fields: z.array(debugField)
49
+ }),
50
+ z.object({
51
+ kind: z.literal("array"),
52
+ element: z.string(),
53
+ length: z.number().int(),
54
+ lower: z.number().int(),
55
+ index: z.string().optional()
56
+ })
57
+ ]);
58
+ var debugRoot = z.object({
59
+ path: z.string(),
60
+ target: z.string(),
61
+ type: z.string(),
62
+ declaration: sourceRange.optional(),
63
+ readable: z.boolean(),
64
+ generated: z.literal(true).optional()
65
+ });
66
+ var debugConstant = z.object({
67
+ path: z.string(),
68
+ type: z.string(),
69
+ value: json,
70
+ declaration: sourceRange.optional()
71
+ });
72
+ var debugIo = z.object({
73
+ path: z.string(),
74
+ target: z.string(),
75
+ direction: z.enum(["input", "output"]),
76
+ type: z.string(),
77
+ device: z.string().optional(),
78
+ channel: z.string().optional(),
79
+ address: z.string().optional(),
80
+ inverted: z.literal(true).optional(),
81
+ shared: z.literal(true).optional()
82
+ });
83
+ var debugChannel = z.object({
84
+ id: z.string(),
85
+ name: z.string(),
86
+ direction: z.enum(["input", "output"]),
87
+ type: z.string(),
88
+ offsetBits: z.number().int(),
89
+ bits: z.number().int(),
90
+ address: z.string().optional(),
91
+ unit: z.string().optional(),
92
+ description: z.string().optional()
93
+ });
94
+ var debugDevice = z.object({
95
+ id: z.string(),
96
+ product: z.string().optional(),
97
+ vendor: z.string().optional(),
98
+ productCode: z.string().optional(),
99
+ network: z.object({ address: z.string(), rpiMs: z.number().optional() }).optional(),
100
+ connection: z.string().optional(),
101
+ assemblies: z.array(z.object({
102
+ direction: z.enum(["input", "output"]),
103
+ bytes: z.number().int(),
104
+ address: z.string().optional(),
105
+ raw: z.string().optional()
106
+ })),
107
+ health: z.object({
108
+ state: z.string().optional(),
109
+ states: z.record(z.string(), z.number().int()).optional(),
110
+ diagnostic: z.string().optional(),
111
+ message: z.string().optional()
112
+ }).optional(),
113
+ status: z.record(z.string(), z.string()).optional(),
114
+ channels: z.array(debugChannel)
115
+ });
116
+ var debugFunction = z.object({
117
+ id: z.number().int(),
118
+ name: z.string(),
119
+ declaration: sourceRange,
120
+ instance: z.string().optional(),
121
+ task: z.string().optional(),
122
+ target: z.string(),
123
+ reads: z.array(z.object({ range: sourceRange, path: z.string() }))
124
+ });
125
+ var jobStateFields = {
126
+ step: "UINT",
127
+ cancelling: "BOOL",
128
+ busy: "BOOL",
129
+ done: "BOOL",
130
+ error: "UDINT"
131
+ };
132
+ var instrumentationFields = {
133
+ busy: jobStateFields.busy,
134
+ step: jobStateFields.step,
135
+ startedAt: "UDINT",
136
+ job: "UDINT",
137
+ sequence: "UDINT"
138
+ };
139
+ var debugJob = z.object({
140
+ id: z.number().int(),
141
+ name: z.string(),
142
+ declaration: sourceRange,
143
+ instance: z.string().optional(),
144
+ target: z.string(),
145
+ steps: z.array(z.object({
146
+ step: z.number().int(),
147
+ kind: z.enum(["await", "return", "throw", "statement"]),
148
+ range: sourceRange,
149
+ text: z.string()
150
+ })),
151
+ startedAt: z.string().optional(),
152
+ requests: z.array(z.object({
153
+ service: z.string(),
154
+ target: z.string(),
155
+ sequence: z.string(),
156
+ job: z.number().int().optional()
157
+ })),
158
+ generated: z.literal(true).optional()
159
+ });
160
+ var debugEventSite = z.object({
161
+ id: z.number().int(),
162
+ kind: z.enum(["state", "decision", "job"]),
163
+ job: z.number().int().optional(),
164
+ phase: z.enum(["started", "finished"]).optional(),
165
+ path: z.string(),
166
+ function: z.number().int().optional(),
167
+ type: z.string(),
168
+ range: sourceRange,
169
+ text: z.string(),
170
+ task: z.string(),
171
+ operands: z.array(z.object({
172
+ text: z.string(),
173
+ range: sourceRange,
174
+ type: z.string(),
175
+ path: z.string().optional(),
176
+ stable: z.boolean()
177
+ }))
178
+ });
179
+ var debugWriter = z.object({
180
+ output: z.string(),
181
+ target: z.string(),
182
+ exact: z.boolean().optional(),
183
+ sites: z.array(z.object({
184
+ id: z.number().int(),
185
+ range: sourceRange,
186
+ function: z.number().int(),
187
+ assignments: z.array(z.number().int()).optional()
188
+ }))
189
+ });
190
+ var debugTask = z.object({
191
+ name: z.string(),
192
+ intervalMs: z.number(),
193
+ priority: z.number().int(),
194
+ clock: z.string().optional()
195
+ });
196
+ var debugManifest = z.object({
197
+ kind: z.literal("tsplc-debug"),
198
+ version: z.literal(1),
199
+ build: z.object({
200
+ id: z.string(),
201
+ target: z.string(),
202
+ compiler: z.string()
203
+ }),
204
+ sources: z.array(z.string()),
205
+ types: z.record(z.string(), debugType),
206
+ roots: z.array(debugRoot),
207
+ constants: z.array(debugConstant),
208
+ io: z.array(debugIo),
209
+ devices: z.array(debugDevice),
210
+ functions: z.array(debugFunction),
211
+ jobs: z.array(debugJob),
212
+ events: z.array(debugEventSite),
213
+ writers: z.array(debugWriter),
214
+ tasks: z.array(debugTask),
215
+ errors: z.record(z.string(), z.string()),
216
+ explain: z.object({ sha256: z.string() }).optional()
217
+ });
218
+
219
+ // packages/debug/src/explain-file.ts
220
+ var explainFileName = "explain.json";
221
+ var tableIndex = z2.number().int().nonnegative();
222
+ var position = z2.number().int().nonnegative();
223
+ var explainExpression = z2.discriminatedUnion("kind", [
224
+ z2.object({
225
+ kind: z2.literal("read"),
226
+ path: tableIndex,
227
+ capturedAt: position,
228
+ interleaved: z2.literal(true).optional(),
229
+ type: z2.string()
230
+ }),
231
+ z2.object({
232
+ kind: z2.literal("pattern"),
233
+ path: tableIndex,
234
+ indexes: z2.array(tableIndex),
235
+ capturedAt: position,
236
+ interleaved: z2.literal(true).optional(),
237
+ type: z2.string()
238
+ }),
239
+ z2.object({ kind: z2.literal("constant"), value: json, type: z2.string() }),
240
+ z2.object({
241
+ kind: z2.literal("record"),
242
+ fields: z2.record(z2.string(), tableIndex),
243
+ type: z2.string()
244
+ }),
245
+ z2.object({
246
+ kind: z2.literal("array"),
247
+ lower: z2.number().int(),
248
+ items: z2.array(tableIndex),
249
+ type: z2.string()
250
+ }),
251
+ z2.object({
252
+ kind: z2.literal("local"),
253
+ local: tableIndex,
254
+ path: z2.array(z2.string()),
255
+ at: position,
256
+ type: z2.string()
257
+ }),
258
+ z2.object({
259
+ kind: z2.literal("parameter"),
260
+ parameter: z2.number().int().nonnegative(),
261
+ path: z2.array(z2.string()),
262
+ at: position,
263
+ local: tableIndex.nullable(),
264
+ type: z2.string()
265
+ }),
266
+ z2.object({
267
+ kind: z2.literal("call"),
268
+ call: tableIndex,
269
+ path: z2.array(z2.string()),
270
+ type: z2.string()
271
+ }),
272
+ z2.object({ kind: z2.literal("clock"), type: z2.string() }),
273
+ z2.object({ kind: z2.literal("reference"), operand: tableIndex }),
274
+ z2.object({
275
+ kind: z2.literal("unary"),
276
+ operator: z2.enum(valueUnaryOperators),
277
+ operand: tableIndex,
278
+ type: z2.string()
279
+ }),
280
+ z2.object({
281
+ kind: z2.literal("binary"),
282
+ operator: z2.enum(valueBinaryOperators),
283
+ policy: z2.enum(["wrap", "saturate"]).optional(),
284
+ left: tableIndex,
285
+ right: tableIndex,
286
+ type: z2.string()
287
+ }),
288
+ z2.object({
289
+ kind: z2.literal("convert"),
290
+ policy: z2.enum(["exact", "wrap", "saturate"]),
291
+ operand: tableIndex,
292
+ type: z2.string()
293
+ }),
294
+ z2.object({
295
+ kind: z2.literal("logical"),
296
+ operator: z2.enum(["and", "or"]),
297
+ left: tableIndex,
298
+ right: tableIndex
299
+ }),
300
+ z2.object({
301
+ kind: z2.literal("select"),
302
+ condition: tableIndex,
303
+ then: tableIndex,
304
+ else: tableIndex,
305
+ type: z2.string()
306
+ }),
307
+ z2.object({
308
+ kind: z2.literal("opaque"),
309
+ text: tableIndex,
310
+ reads: z2.array(tableIndex),
311
+ type: z2.string()
312
+ })
313
+ ]);
314
+ var exitsCondition = z2.object({
315
+ kind: z2.literal("exits"),
316
+ get any() {
317
+ return z2.array(z2.array(explainCondition));
318
+ }
319
+ });
320
+ var explainCondition = z2.union([
321
+ z2.object({
322
+ kind: z2.literal("test"),
323
+ test: tableIndex,
324
+ holds: z2.boolean(),
325
+ at: position,
326
+ text: tableIndex.nullable()
327
+ }),
328
+ z2.object({
329
+ kind: z2.literal("cases"),
330
+ test: tableIndex,
331
+ values: z2.array(json),
332
+ member: z2.boolean(),
333
+ at: position,
334
+ text: tableIndex.nullable()
335
+ }),
336
+ exitsCondition,
337
+ z2.object({ kind: z2.literal("loop"), loop: tableIndex }),
338
+ z2.object({ kind: z2.literal("loopReturns"), loop: tableIndex }),
339
+ z2.object({ kind: z2.literal("job"), step: z2.number().int() }),
340
+ z2.object({ kind: z2.literal("jobBusy") })
341
+ ]);
342
+ var record = {
343
+ routine: tableIndex,
344
+ position,
345
+ conditions: tableIndex.nullable(),
346
+ site: tableIndex.nullable()
347
+ };
348
+ var written = z2.discriminatedUnion("kind", [
349
+ z2.object({ kind: z2.literal("path"), path: tableIndex }),
350
+ z2.object({
351
+ kind: z2.literal("pattern"),
352
+ path: tableIndex,
353
+ indexes: z2.array(tableIndex)
354
+ })
355
+ ]);
356
+ var explainAssignment = z2.object({
357
+ ...record,
358
+ kind: z2.enum(["assign", "call", "block", "input", "return", "counter"]),
359
+ writes: written,
360
+ whole: z2.boolean(),
361
+ value: tableIndex.nullable(),
362
+ block: z2.object({
363
+ kind: z2.string(),
364
+ inputs: z2.record(z2.string(), tableIndex),
365
+ elapsed: tableIndex.nullable()
366
+ }).nullable(),
367
+ via: z2.array(tableIndex),
368
+ loop: tableIndex.nullable()
369
+ });
370
+ var explainLocal = z2.object({
371
+ routine: tableIndex,
372
+ name: z2.string(),
373
+ parameter: z2.boolean(),
374
+ reference: z2.boolean(),
375
+ definitions: z2.array(z2.object({
376
+ ...record,
377
+ kind: z2.enum(["assign", "borrowed", "counter"]),
378
+ path: z2.array(z2.string()),
379
+ value: tableIndex.nullable(),
380
+ call: tableIndex.nullable(),
381
+ loop: tableIndex.nullable()
382
+ }))
383
+ });
384
+ var explainCall = z2.object({
385
+ ...record,
386
+ callee: z2.string(),
387
+ receiver: z2.discriminatedUnion("kind", [
388
+ z2.object({ kind: z2.literal("none") }),
389
+ z2.object({ kind: z2.literal("path"), path: tableIndex }),
390
+ z2.object({
391
+ kind: z2.literal("pattern"),
392
+ path: tableIndex,
393
+ indexes: z2.array(tableIndex)
394
+ })
395
+ ]),
396
+ arguments: z2.array(tableIndex),
397
+ loop: tableIndex.nullable()
398
+ });
399
+ var explainFlags = z2.object({
400
+ path: tableIndex,
401
+ input: z2.number().int().nullable(),
402
+ clientWritable: z2.boolean(),
403
+ hmiControl: z2.string().nullable(),
404
+ retained: z2.boolean(),
405
+ constantTable: z2.boolean(),
406
+ writerTasks: z2.array(z2.string()),
407
+ service: z2.object({ job: z2.number().int(), service: z2.string() }).nullable(),
408
+ initial: json.nullable(),
409
+ reference: z2.boolean()
410
+ });
411
+ var explainFile = z2.object({
412
+ kind: z2.literal("tsplc-explain"),
413
+ version: z2.literal(1),
414
+ paths: z2.array(z2.string()),
415
+ texts: z2.array(z2.string()),
416
+ expressions: z2.array(explainExpression),
417
+ conditions: z2.array(z2.object({ parent: tableIndex.nullable(), condition: explainCondition })),
418
+ sites: z2.array(z2.object({ range: sourceRange, text: tableIndex.nullable() })),
419
+ routines: z2.array(z2.object({
420
+ key: z2.string(),
421
+ function: z2.number().int().nullable(),
422
+ instance: tableIndex.nullable(),
423
+ name: z2.string(),
424
+ declaration: sourceRange.nullable(),
425
+ job: z2.number().int().nullable(),
426
+ paths: z2.array(tableIndex),
427
+ locals: z2.array(tableIndex),
428
+ calls: z2.array(tableIndex),
429
+ loops: z2.array(tableIndex)
430
+ })),
431
+ loops: z2.array(z2.object({
432
+ routine: tableIndex,
433
+ position,
434
+ counter: tableIndex,
435
+ first: tableIndex,
436
+ limit: tableIndex,
437
+ exclusive: z2.boolean(),
438
+ step: tableIndex,
439
+ maxIterations: z2.number().int().nonnegative(),
440
+ breaks: z2.array(z2.array(explainCondition)),
441
+ parent: tableIndex.nullable(),
442
+ site: tableIndex.nullable()
443
+ })),
444
+ assignments: z2.array(explainAssignment),
445
+ locals: z2.array(explainLocal),
446
+ returns: z2.array(z2.object({ ...record, value: tableIndex.nullable() })),
447
+ calls: z2.array(explainCall),
448
+ entries: z2.array(z2.object({
449
+ routine: tableIndex,
450
+ task: z2.string(),
451
+ order: z2.number().int().nonnegative()
452
+ })),
453
+ flags: z2.array(explainFlags),
454
+ references: z2.record(z2.string(), tableIndex)
455
+ });
456
+ export {
457
+ explainAssignment,
458
+ explainCall,
459
+ explainCondition,
460
+ explainExpression,
461
+ explainFile,
462
+ explainFileName,
463
+ explainFlags,
464
+ explainLocal
465
+ };
466
+
467
+ //# debugId=3694749EE1C9A42864756E2164756E21
468
+ //# sourceMappingURL=explain-file.js.map