deepline 0.3.195 → 0.3.197

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 (29) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +13 -0
  2. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  3. package/dist/bundling-sources/sdk/src/types.ts +18 -0
  4. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +18 -0
  5. package/dist/bundling-sources/shared_libs/observability/scheduled-work-manual.ts +1 -0
  6. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +10 -2
  7. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +145 -29
  8. package/dist/bundling-sources/shared_libs/plays/docflow-binding-owner.ts +138 -14
  9. package/dist/bundling-sources/shared_libs/plays/docflow.ts +57 -3
  10. package/dist/bundling-sources/shared_libs/plays/share/static-pipeline-summary.ts +3 -0
  11. package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +21 -0
  12. package/dist/bundling-sources/shared_libs/plays/workspace-bundle.ts +651 -0
  13. package/dist/cli/index.js +48 -2
  14. package/dist/cli/index.mjs +48 -2
  15. package/dist/{compiler-manifest-4bYusxBr.d.mts → compiler-manifest-Dpd2hEet.d.mts} +28 -0
  16. package/dist/{compiler-manifest-4bYusxBr.d.ts → compiler-manifest-Dpd2hEet.d.ts} +28 -0
  17. package/dist/index.d.mts +27 -2
  18. package/dist/index.d.ts +27 -2
  19. package/dist/index.js +7 -1
  20. package/dist/index.mjs +7 -1
  21. package/dist/install-integrity.json +3 -2
  22. package/dist/plays/bundle-play-file.d.mts +2 -2
  23. package/dist/plays/bundle-play-file.d.ts +2 -2
  24. package/dist/plays/bundle-play-file.mjs +24 -3
  25. package/dist/release.d.mts +1 -1
  26. package/dist/release.d.ts +1 -1
  27. package/dist/release.js +1 -1
  28. package/dist/release.mjs +1 -1
  29. package/package.json +1 -1
@@ -102,6 +102,16 @@ export type PlayDocflowSubgraph = {
102
102
  export type PlayDocflowBinding = {
103
103
  nodeId: string;
104
104
  line: number;
105
+ /**
106
+ * The file this annotation was written in, when it did not come from the play
107
+ * entry file. A play whose step program lives in a `-core` module has no
108
+ * statement in its `.play.ts` to annotate, so its boxes could only ever be
109
+ * sketches; annotations are read from the entry's import closure to fix that.
110
+ *
111
+ * `line` is only meaningful together with this: two files both have a line
112
+ * 42, so any positional comparison must agree on the path first.
113
+ */
114
+ sourcePath?: string;
105
115
  label?: string;
106
116
  kind?: PlayDocflowNodeKind;
107
117
  /** Symbolic values read by this business node. Never an arbitrary JS expression. */
@@ -153,6 +163,12 @@ export type ParsePlayDocflowOptions = {
153
163
  * both `scalar` and `default`.
154
164
  */
155
165
  exportName?: string | null;
166
+ /**
167
+ * Source of every module the entry imports, keyed by path. Annotations found
168
+ * here bind to the entry's diagrams exactly like the entry's own — routing is
169
+ * by node id, which never depended on which file the annotation sat in.
170
+ */
171
+ moduleSources?: ReadonlyMap<string, string> | null;
156
172
  };
157
173
 
158
174
  /** One `@mermaid` block, already bound to the export it describes. */
@@ -233,6 +249,8 @@ export function docflowLabelCountFragment(label: string): string | null {
233
249
 
234
250
  const FLOW_START = /^\s*(?:flowchart|graph)\s+(LR|RL|TB|TD|BT)\s*$/i;
235
251
  const MERMAID_NODE = /^\s*\/\/\s*@mermaid-node\s+([A-Za-z][\w-]*)(?:\s+(.*))?$/;
252
+ /** Whole-file pre-filter for {@link MERMAID_NODE}; skips splitting clean files. */
253
+ const MERMAID_NODE_HINT = /@mermaid-node/;
236
254
  const ATTRIBUTE = /([A-Za-z][\w-]*)\s*:\s*"([^"\n]*)"/y;
237
255
  const MERMAID_NODE_ATTRIBUTES = ['label', 'type', 'in', 'out', 'arm'] as const;
238
256
  const MERMAID_NODE_ID = /^[A-Za-z][\w-]*/;
@@ -929,6 +947,7 @@ function materializeDocflow(block: ParsedDocflowBlock): PlayDocflow {
929
947
  */
930
948
  export function parsePlayDocflowFile(
931
949
  sourceCode: string,
950
+ moduleSources?: ReadonlyMap<string, string> | null,
932
951
  ): PlayDocflowFileParseResult {
933
952
  const errors: string[] = [];
934
953
  const rawBlocks: Array<{
@@ -948,7 +967,19 @@ export function parsePlayDocflowFile(
948
967
  // the author already has one actionable error about them, and telling them to
949
968
  // "bind it" on the next line is telling them to do what they just did.
950
969
  const rejectedNodeIds = new Set<string>();
951
- const bindings = parseDocflowBindings(sourceCode, errors, rejectedNodeIds);
970
+ // The entry first, then the modules it imports. Only files that actually
971
+ // contain an annotation are split into lines: a play's closure is mostly
972
+ // helpers and types, and this runs on every publish.
973
+ const annotationSources: DocflowAnnotationSource[] = [{ sourceCode }];
974
+ for (const [sourcePath, moduleCode] of moduleSources ?? []) {
975
+ if (!MERMAID_NODE_HINT.test(moduleCode)) continue;
976
+ annotationSources.push({ sourceCode: moduleCode, sourcePath });
977
+ }
978
+ const bindings = parseDocflowBindings(
979
+ annotationSources,
980
+ errors,
981
+ rejectedNodeIds,
982
+ );
952
983
 
953
984
  const parsedBlocks: ParsedDocflowBlock[] = [];
954
985
  for (const raw of rawBlocks) {
@@ -1326,7 +1357,7 @@ export function parsePlayDocflow(
1326
1357
  sourceCode: string,
1327
1358
  options: ParsePlayDocflowOptions = {},
1328
1359
  ): PlayDocflowParseResult {
1329
- const parsed = parsePlayDocflowFile(sourceCode);
1360
+ const parsed = parsePlayDocflowFile(sourceCode, options.moduleSources);
1330
1361
  const requested = options.exportName?.trim() || PLAY_DEFAULT_EXPORT;
1331
1362
  const selected =
1332
1363
  parsed.blocks.find((block) => block.exportName === requested) ??
@@ -1354,10 +1385,32 @@ export function parsePlayDocflow(
1354
1385
  * to themselves afterwards; the annotations themselves are file-scoped text.
1355
1386
  */
1356
1387
  function parseDocflowBindings(
1357
- sourceCode: string,
1388
+ sources: readonly DocflowAnnotationSource[],
1389
+ errors: string[],
1390
+ rejectedNodeIds: Set<string>,
1391
+ ): PlayDocflowBinding[] {
1392
+ const bindings: PlayDocflowBinding[] = [];
1393
+ for (const source of sources) {
1394
+ bindings.push(
1395
+ ...parseDocflowBindingsInSource(source, errors, rejectedNodeIds),
1396
+ );
1397
+ }
1398
+ return bindings;
1399
+ }
1400
+
1401
+ /** One file that may carry `// @mermaid-node` annotations. */
1402
+ type DocflowAnnotationSource = {
1403
+ sourceCode: string;
1404
+ /** Omitted for the entry file, whose paths readers already know. */
1405
+ sourcePath?: string;
1406
+ };
1407
+
1408
+ function parseDocflowBindingsInSource(
1409
+ source: DocflowAnnotationSource,
1358
1410
  errors: string[],
1359
1411
  rejectedNodeIds: Set<string>,
1360
1412
  ): PlayDocflowBinding[] {
1413
+ const { sourceCode, sourcePath } = source;
1361
1414
  const lines = sourceCode.split(/\r?\n/);
1362
1415
  const bindings: PlayDocflowBinding[] = [];
1363
1416
 
@@ -1440,6 +1493,7 @@ function parseDocflowBindings(
1440
1493
  bindings.push({
1441
1494
  nodeId: id,
1442
1495
  line: nextLine + 1,
1496
+ ...(sourcePath ? { sourcePath } : {}),
1443
1497
  ...(attributes.label ? { label: attributes.label } : {}),
1444
1498
  ...(kind ? { kind } : {}),
1445
1499
  // Spread, never `arm: arm ?? undefined` — see `PlayDocflowEdge.arm`. An
@@ -438,6 +438,9 @@ export function buildStaticPipelineSummary(
438
438
  // param sources never need to cross the public boundary.
439
439
  const SUBSTEP_STRIP_KEYS = new Set([
440
440
  'sourceRange',
441
+ // Same reason as `sourceRange`, and the same shape: it carries the absolute
442
+ // path of the file the call was made from, which is an author's machine.
443
+ 'callSiteRange',
441
444
  'sourcePath',
442
445
  'callPath',
443
446
  'callDepth',
@@ -757,6 +757,9 @@ function storageSafeNodeValue(
757
757
  if (asStaticRecord(value.sourceRange)) {
758
758
  out.sourceRange = { ...(value.sourceRange as Record<string, unknown>) };
759
759
  }
760
+ if (asStaticRecord(value.callSiteRange)) {
761
+ out.callSiteRange = { ...(value.callSiteRange as Record<string, unknown>) };
762
+ }
760
763
  if (asStaticRecord(value.sheetContract)) {
761
764
  out.sheetContract = cloneStorageSafeSheetContract(
762
765
  value.sheetContract as PlaySheetContract,
@@ -1224,6 +1227,24 @@ export interface PlayStaticSourceRange {
1224
1227
  type PlayStaticSubstepMetadata = {
1225
1228
  conditional?: boolean;
1226
1229
  disabled?: boolean;
1230
+ /**
1231
+ * Where this substep was REACHED FROM, when the extractor resolved it by
1232
+ * following a call into another function — the range of the call expression
1233
+ * itself, in the file that made the call.
1234
+ *
1235
+ * The extractor hops through `resolveLocalCallable`, which is TypeScript
1236
+ * symbol resolution (`getSymbol()` / `getAliasedSymbol()`), so the callee may
1237
+ * live anywhere in the import closure. Its `sourceRange` then points at the
1238
+ * helper's body, which no annotation in the CALLING file can ever contain.
1239
+ * That is why a binding on `const identity = await resolveCompanyIdentity(…)`
1240
+ * could not reach the `ctx.tools.execute` inside it.
1241
+ *
1242
+ * Recorded as the OUTERMOST hop: unwinding stamps each level, so a tool three
1243
+ * helpers deep ends up carrying the call site in the annotated function
1244
+ * rather than an intermediate one. Absent whenever the substep was found
1245
+ * directly in the function being analyzed.
1246
+ */
1247
+ callSiteRange?: PlayStaticSourceRange;
1227
1248
  };
1228
1249
 
1229
1250
  /**