@telora/daemon 0.19.35 → 0.19.37

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 (56) hide show
  1. package/build-info.json +4 -3
  2. package/dist/queries/code-metrics.d.ts +4 -0
  3. package/dist/queries/code-metrics.d.ts.map +1 -1
  4. package/dist/queries/code-metrics.js.map +1 -1
  5. package/dist/resolvers/compose/focus-injections-compose.d.ts +61 -0
  6. package/dist/resolvers/compose/focus-injections-compose.d.ts.map +1 -0
  7. package/dist/resolvers/compose/focus-injections-compose.js +72 -0
  8. package/dist/resolvers/compose/focus-injections-compose.js.map +1 -0
  9. package/dist/resolvers/compose/loop-context-compose.d.ts +51 -0
  10. package/dist/resolvers/compose/loop-context-compose.d.ts.map +1 -0
  11. package/dist/resolvers/compose/loop-context-compose.js +66 -0
  12. package/dist/resolvers/compose/loop-context-compose.js.map +1 -0
  13. package/dist/resolvers/compose/loop-frt-statement-compose.d.ts +24 -0
  14. package/dist/resolvers/compose/loop-frt-statement-compose.d.ts.map +1 -0
  15. package/dist/resolvers/compose/loop-frt-statement-compose.js +30 -0
  16. package/dist/resolvers/compose/loop-frt-statement-compose.js.map +1 -0
  17. package/dist/resolvers/compose/loop-injection-compose.d.ts +30 -0
  18. package/dist/resolvers/compose/loop-injection-compose.d.ts.map +1 -0
  19. package/dist/resolvers/compose/loop-injection-compose.js +40 -0
  20. package/dist/resolvers/compose/loop-injection-compose.js.map +1 -0
  21. package/dist/resolvers/compose/loop-persona-compose.d.ts +24 -0
  22. package/dist/resolvers/compose/loop-persona-compose.d.ts.map +1 -0
  23. package/dist/resolvers/compose/loop-persona-compose.js +24 -0
  24. package/dist/resolvers/compose/loop-persona-compose.js.map +1 -0
  25. package/dist/resolvers/compose/loop-upstream-udes-compose.d.ts +44 -0
  26. package/dist/resolvers/compose/loop-upstream-udes-compose.d.ts.map +1 -0
  27. package/dist/resolvers/compose/loop-upstream-udes-compose.js +75 -0
  28. package/dist/resolvers/compose/loop-upstream-udes-compose.js.map +1 -0
  29. package/dist/resolvers/focus-injections.d.ts +4 -0
  30. package/dist/resolvers/focus-injections.d.ts.map +1 -1
  31. package/dist/resolvers/focus-injections.js +6 -50
  32. package/dist/resolvers/focus-injections.js.map +1 -1
  33. package/dist/resolvers/loop-context.d.ts +12 -9
  34. package/dist/resolvers/loop-context.d.ts.map +1 -1
  35. package/dist/resolvers/loop-context.js +87 -102
  36. package/dist/resolvers/loop-context.js.map +1 -1
  37. package/dist/resolvers/loop-frt-statement.d.ts +3 -0
  38. package/dist/resolvers/loop-frt-statement.d.ts.map +1 -1
  39. package/dist/resolvers/loop-frt-statement.js +7 -8
  40. package/dist/resolvers/loop-frt-statement.js.map +1 -1
  41. package/dist/resolvers/loop-injection.d.ts +4 -0
  42. package/dist/resolvers/loop-injection.d.ts.map +1 -1
  43. package/dist/resolvers/loop-injection.js +8 -18
  44. package/dist/resolvers/loop-injection.js.map +1 -1
  45. package/dist/resolvers/loop-persona.d.ts.map +1 -1
  46. package/dist/resolvers/loop-persona.js +2 -3
  47. package/dist/resolvers/loop-persona.js.map +1 -1
  48. package/dist/resolvers/loop-upstream-udes.d.ts +5 -0
  49. package/dist/resolvers/loop-upstream-udes.d.ts.map +1 -1
  50. package/dist/resolvers/loop-upstream-udes.js +14 -51
  51. package/dist/resolvers/loop-upstream-udes.js.map +1 -1
  52. package/dist/sensor-sweep.d.ts +58 -6
  53. package/dist/sensor-sweep.d.ts.map +1 -1
  54. package/dist/sensor-sweep.js +95 -9
  55. package/dist/sensor-sweep.js.map +1 -1
  56. package/package.json +1 -1
package/build-info.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "commitSha": "031df9d85",
3
- "builtAt": "2026-07-03T11:21:08.385Z",
2
+ "commitSha": "9d8f78c49",
3
+ "builtAt": "2026-07-03T16:16:35.169Z",
4
4
  "expectedMigrations": [
5
5
  "20250829113330_create_org_nodes_table.sql",
6
6
  "20250829113402_fix_function_security_search_path.sql",
@@ -702,6 +702,7 @@
702
702
  "20260630230112_reality_trees_realtime_full_identity.sql",
703
703
  "20260702182627_create_code_observations.sql",
704
704
  "20260702182805_create_code_metrics.sql",
705
- "20260702183805_station_distillation_directives.sql"
705
+ "20260702183805_station_distillation_directives.sql",
706
+ "20260703154029_code_metrics_intent_aligned_churn.sql"
706
707
  ]
707
708
  }
@@ -25,6 +25,10 @@ export interface CodeMetricsSnapshotInput {
25
25
  areas: unknown[];
26
26
  ratchetDetail: Record<string, unknown>;
27
27
  dependencyDetail: Record<string, unknown>;
28
+ /** Lines of window churn on paths inside the active-intent footprint. */
29
+ intentAlignedChurn?: number;
30
+ /** intentAlignedChurn / totalChurn, bounded 0-1. */
31
+ intentAlignedRatio?: number;
28
32
  }
29
33
  /** The subset of a persisted snapshot the drift-skip check reads back. */
30
34
  export interface LatestCodeMetrics {
@@ -1 +1 @@
1
- {"version":3,"file":"code-metrics.d.ts","sourceRoot":"","sources":["../../src/queries/code-metrics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,oDAAoD;AACpD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C;AAED,0EAA0E;AAC1E,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,M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B,GAAG,IAAI,CAAC,CAM/F;AAED,wBAAsB,yBAAyB,CAC7C,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAMzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"code-metrics.js","sourceRoot":"","sources":["../../src/queries/code-metrics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAyBtC,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,SAAiB;IAC1D,MAAM,QAAQ,GAAG,MAAM,OAAO,CAC5B,qBAAqB,EACrB,EAAE,SAAS,EAAE,CACd,CAAC;IACF,OAAO,QAAQ,CAAC,WAAW,IAAI,IAAI,CAAC;AACtC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,SAAiB,EACjB,MAAgC;IAEhC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAC5B,qBAAqB,EACrB,EAAE,SAAS,EAAE,MAAM,EAAE,MAA4C,EAAE,CACpE,CAAC;IACF,OAAO,QAAQ,CAAC,WAAW,CAAC;AAC9B,CAAC"}
1
+ {"version":3,"file":"code-metrics.js","sourceRoot":"","sources":["../../src/queries/code-metrics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AA6BtC,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,SAAiB;IAC1D,MAAM,QAAQ,GAAG,MAAM,OAAO,CAC5B,qBAAqB,EACrB,EAAE,SAAS,EAAE,CACd,CAAC;IACF,OAAO,QAAQ,CAAC,WAAW,IAAI,IAAI,CAAC;AACtC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,SAAiB,EACjB,MAAgC;IAEhC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAC5B,qBAAqB,EACrB,EAAE,SAAS,EAAE,MAAM,EAAE,MAA4C,EAAE,CACpE,CAAC;IACF,OAAO,QAAQ,CAAC,WAAW,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * GENERATED FILE -- DO NOT EDIT.
3
+ *
4
+ * Deno edge-function copy of src/lib/context-assembly/resolvers/focus-injections-compose.ts, produced by
5
+ * `npm run gen:shared-mirrors`. The canonical source is the ONLY hand-edited
6
+ * copy of this algorithm; edit it there and regenerate. The drift gate
7
+ * (`npm run lint:shared-mirrors`) fails CI when this file differs from what
8
+ * generation would produce, so the same algorithm runs in both runtimes.
9
+ *
10
+ * @module resolvers/compose/focus-injections-compose
11
+ */
12
+ /** The assembly source-reference this module composes. */
13
+ export declare const REF = "focus.injections";
14
+ /** An injection node as returned by reality_tree_focus_injections (camelCase). */
15
+ export interface FocusInjectionNode {
16
+ statement: string;
17
+ injectionStatus: string | null;
18
+ seq: number;
19
+ }
20
+ /** One-line Now->Target per targeted UDE (from the coordination map). */
21
+ export interface FocusInjectionNowTarget {
22
+ seq: number;
23
+ now: string;
24
+ target: string | null;
25
+ }
26
+ /** One focus-injection item: the injection plus its per-UDE Now->Target lines. */
27
+ export interface FocusInjectionItem {
28
+ injection: FocusInjectionNode;
29
+ nowTargets?: FocusInjectionNowTarget[];
30
+ }
31
+ /** Cross-injection coordination structure for the focus map. */
32
+ export interface FocusInjectionStructure {
33
+ dependencyOrder: {
34
+ seq: number;
35
+ statement: string;
36
+ }[];
37
+ sharedTargetCollisions: {
38
+ targetSeq: number;
39
+ targetStatement: string;
40
+ injectionSeqs: number[];
41
+ }[];
42
+ rootCauseClusters: {
43
+ rootSeq: number;
44
+ rootStatement: string;
45
+ rootNodeType: string;
46
+ udeSeqs: number[];
47
+ }[];
48
+ }
49
+ /** Full input to the focus.injections composer. */
50
+ export interface FocusInjectionsInput {
51
+ items: FocusInjectionItem[];
52
+ structure?: FocusInjectionStructure;
53
+ }
54
+ /**
55
+ * Render the focus's reality-tree structure as the LEAD COORDINATION MAP: per
56
+ * injection a one-line Now->Target, the dependency order to sequence deliveries,
57
+ * shared-target collisions, and root-cause clusters. Returns '' when there are
58
+ * no injections.
59
+ */
60
+ export declare function composeFocusInjections(input: FocusInjectionsInput): string;
61
+ //# sourceMappingURL=focus-injections-compose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus-injections-compose.d.ts","sourceRoot":"","sources":["../../../src/resolvers/compose/focus-injections-compose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,0DAA0D;AAC1D,eAAO,MAAM,GAAG,qBAAqB,CAAC;AAEtC,kFAAkF;AAClF,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,yEAAyE;AACzE,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,kFAAkF;AAClF,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,kBAAkB,CAAC;IAC9B,UAAU,CAAC,EAAE,uBAAuB,EAAE,CAAC;CACxC;AAED,gEAAgE;AAChE,MAAM,WAAW,uBAAuB;IACtC,eAAe,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACtD,sBAAsB,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;IAClG,iBAAiB,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;CAC1G;AAED,mDAAmD;AACnD,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,uBAAuB,CAAC;CACrC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,CAyD1E"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * GENERATED FILE -- DO NOT EDIT.
3
+ *
4
+ * Deno edge-function copy of src/lib/context-assembly/resolvers/focus-injections-compose.ts, produced by
5
+ * `npm run gen:shared-mirrors`. The canonical source is the ONLY hand-edited
6
+ * copy of this algorithm; edit it there and regenerate. The drift gate
7
+ * (`npm run lint:shared-mirrors`) fails CI when this file differs from what
8
+ * generation would produce, so the same algorithm runs in both runtimes.
9
+ *
10
+ * @module resolvers/compose/focus-injections-compose
11
+ */
12
+ /** The assembly source-reference this module composes. */
13
+ export const REF = 'focus.injections';
14
+ /**
15
+ * Render the focus's reality-tree structure as the LEAD COORDINATION MAP: per
16
+ * injection a one-line Now->Target, the dependency order to sequence deliveries,
17
+ * shared-target collisions, and root-cause clusters. Returns '' when there are
18
+ * no injections.
19
+ */
20
+ export function composeFocusInjections(input) {
21
+ if (!input.items || input.items.length === 0)
22
+ return '';
23
+ const structure = input.structure ?? {
24
+ dependencyOrder: [],
25
+ sharedTargetCollisions: [],
26
+ rootCauseClusters: [],
27
+ };
28
+ const lines = [
29
+ '## Focus Coordination Map',
30
+ '',
31
+ 'The focus reality-tree structure -- your planning surface. Each injection moves a',
32
+ 'Now (a current UDE) to a Target (its future desired effect). Use the dependency',
33
+ 'order to sequence deliveries, the collisions to avoid two workers changing the same',
34
+ 'node, and the clusters to see which root causes drive which problems. Pull a',
35
+ "delivery's full differential on demand with telora_reality_tree_injection_context",
36
+ '(by injection seq).',
37
+ '',
38
+ '### Injections (Now -> Target)',
39
+ '',
40
+ ];
41
+ for (const item of input.items) {
42
+ const inj = item.injection;
43
+ const statusTag = inj.injectionStatus ? ` [${inj.injectionStatus}]` : '';
44
+ lines.push(`- #${inj.seq} ${inj.statement}${statusTag}`);
45
+ for (const nt of item.nowTargets ?? []) {
46
+ const target = nt.target && nt.target.trim().length > 0 ? nt.target : '(no FRT overlay yet)';
47
+ lines.push(` - Now: #${nt.seq} ${nt.now} -> Target: ${target}`);
48
+ }
49
+ }
50
+ if (structure.dependencyOrder.length > 0) {
51
+ lines.push('', '### Dependency Order (sequence deliveries this way)', '');
52
+ structure.dependencyOrder.forEach((d, i) => {
53
+ lines.push(`${i + 1}. #${d.seq} ${d.statement}`);
54
+ });
55
+ }
56
+ if (structure.sharedTargetCollisions.length > 0) {
57
+ lines.push('', '### Shared-Target Collisions (avoid two workers changing the same node)', '');
58
+ for (const c of structure.sharedTargetCollisions) {
59
+ const injList = c.injectionSeqs.map((s) => `#${s}`).join(', ');
60
+ lines.push(`- #${c.targetSeq} "${c.targetStatement}" <- injections ${injList}`);
61
+ }
62
+ }
63
+ if (structure.rootCauseClusters.length > 0) {
64
+ lines.push('', '### Root-Cause Clusters (which roots drive which UDEs)', '');
65
+ for (const cl of structure.rootCauseClusters) {
66
+ const udeList = cl.udeSeqs.map((s) => `#${s}`).join(', ');
67
+ lines.push(`- #${cl.rootSeq} ${cl.rootStatement} (${cl.rootNodeType}) drives UDEs: ${udeList}`);
68
+ }
69
+ }
70
+ return lines.join('\n');
71
+ }
72
+ //# sourceMappingURL=focus-injections-compose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus-injections-compose.js","sourceRoot":"","sources":["../../../src/resolvers/compose/focus-injections-compose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,0DAA0D;AAC1D,MAAM,CAAC,MAAM,GAAG,GAAG,kBAAkB,CAAC;AAmCtC;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAA2B;IAChE,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,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,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * GENERATED FILE -- DO NOT EDIT.
3
+ *
4
+ * Deno edge-function copy of src/lib/context-assembly/resolvers/loop-context-compose.ts, produced by
5
+ * `npm run gen:shared-mirrors`. The canonical source is the ONLY hand-edited
6
+ * copy of this algorithm; edit it there and regenerate. The drift gate
7
+ * (`npm run lint:shared-mirrors`) fails CI when this file differs from what
8
+ * generation would produce, so the same algorithm runs in both runtimes.
9
+ *
10
+ * @module resolvers/compose/loop-context-compose
11
+ */
12
+ /** The assembly source-reference this module composes. */
13
+ export declare const REF = "loop.context";
14
+ /**
15
+ * Reorder documents by a semantic-rank id ordering. Documents whose id appears
16
+ * in `rankedIds` are ordered by that rank; documents absent from the ranking
17
+ * (no text/embedding match) keep their original relative order AFTER the ranked
18
+ * ones (sort_order is the floor). Pure -- exported for reuse and tests.
19
+ */
20
+ export declare function reorderDocsByRank<T extends {
21
+ id: string;
22
+ }>(docs: T[], rankedIds: string[]): T[];
23
+ /** A loop document (already fetched, full content). */
24
+ export interface LoopContextDoc {
25
+ id: string;
26
+ title: string;
27
+ content: string;
28
+ }
29
+ /** A question paired with its (already batch-fetched) answer content. */
30
+ export interface LoopContextQA {
31
+ question: string;
32
+ /** The answer content, or null/empty when unanswered. */
33
+ answer: string | null;
34
+ }
35
+ /** One loop layer's already-fetched context. */
36
+ export interface LoopContextLayer {
37
+ label: string;
38
+ persona: string | null;
39
+ docs: LoopContextDoc[];
40
+ /** Semantic-search doc-id ranking; empty keeps sort_order (the floor). */
41
+ rankedDocIds: string[];
42
+ fixedQuestions: LoopContextQA[];
43
+ generatedQuestions: LoopContextQA[];
44
+ }
45
+ /**
46
+ * Render the loop context (persona + force-/semantic-ranked documents + Q&A)
47
+ * for one or more loop layers. Layers with no data are skipped; returns '' when
48
+ * nothing is present.
49
+ */
50
+ export declare function composeLoopContext(layers: LoopContextLayer[]): string;
51
+ //# sourceMappingURL=loop-context-compose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loop-context-compose.d.ts","sourceRoot":"","sources":["../../../src/resolvers/compose/loop-context-compose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,0DAA0D;AAC1D,eAAO,MAAM,GAAG,iBAAiB,CAAC;AAElC;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EACxD,IAAI,EAAE,CAAC,EAAE,EACT,SAAS,EAAE,MAAM,EAAE,GAClB,CAAC,EAAE,CAQL;AAED,uDAAuD;AACvD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,yEAAyE;AACzE,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,yDAAyD;IACzD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,gDAAgD;AAChD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB,0EAA0E;IAC1E,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,kBAAkB,EAAE,aAAa,EAAE,CAAC;CACrC;AAmCD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAIrE"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * GENERATED FILE -- DO NOT EDIT.
3
+ *
4
+ * Deno edge-function copy of src/lib/context-assembly/resolvers/loop-context-compose.ts, produced by
5
+ * `npm run gen:shared-mirrors`. The canonical source is the ONLY hand-edited
6
+ * copy of this algorithm; edit it there and regenerate. The drift gate
7
+ * (`npm run lint:shared-mirrors`) fails CI when this file differs from what
8
+ * generation would produce, so the same algorithm runs in both runtimes.
9
+ *
10
+ * @module resolvers/compose/loop-context-compose
11
+ */
12
+ /** The assembly source-reference this module composes. */
13
+ export const REF = 'loop.context';
14
+ /**
15
+ * Reorder documents by a semantic-rank id ordering. Documents whose id appears
16
+ * in `rankedIds` are ordered by that rank; documents absent from the ranking
17
+ * (no text/embedding match) keep their original relative order AFTER the ranked
18
+ * ones (sort_order is the floor). Pure -- exported for reuse and tests.
19
+ */
20
+ export function reorderDocsByRank(docs, rankedIds) {
21
+ if (rankedIds.length === 0)
22
+ return docs;
23
+ const rankOf = new Map(rankedIds.map((id, i) => [id, i]));
24
+ return [...docs].sort((a, b) => (rankOf.get(a.id) ?? Number.MAX_SAFE_INTEGER) -
25
+ (rankOf.get(b.id) ?? Number.MAX_SAFE_INTEGER));
26
+ }
27
+ function formatQA(qa) {
28
+ const answer = qa.answer && qa.answer.length > 0 ? qa.answer : '_No answer yet._';
29
+ return `**Q:** ${qa.question}\n**A:** ${answer}`;
30
+ }
31
+ function composeLayer(layer) {
32
+ const parts = [];
33
+ if (layer.persona && layer.persona.length > 0) {
34
+ parts.push(`**Persona:** ${layer.persona}`);
35
+ }
36
+ const docs = reorderDocsByRank(layer.docs, layer.rankedDocIds);
37
+ if (docs.length > 0) {
38
+ const docLines = docs.map((doc, i) => `#### ${i + 1}. ${doc.title}\n\n${doc.content}`);
39
+ parts.push(`### Documents\n\n${docLines.join('\n\n')}`);
40
+ }
41
+ const qParts = [];
42
+ if (layer.fixedQuestions.length > 0) {
43
+ qParts.push(`#### Fixed Questions\n\n${layer.fixedQuestions.map(formatQA).join('\n\n')}`);
44
+ }
45
+ if (layer.generatedQuestions.length > 0) {
46
+ qParts.push(`#### Agent-Generated Questions\n\n${layer.generatedQuestions.map(formatQA).join('\n\n')}`);
47
+ }
48
+ if (qParts.length > 0) {
49
+ parts.push(`### Questions & Answers\n\n${qParts.join('\n\n')}`);
50
+ }
51
+ if (parts.length === 0)
52
+ return '';
53
+ return `## ${layer.label} Loop\n\n${parts.join('\n\n')}`;
54
+ }
55
+ /**
56
+ * Render the loop context (persona + force-/semantic-ranked documents + Q&A)
57
+ * for one or more loop layers. Layers with no data are skipped; returns '' when
58
+ * nothing is present.
59
+ */
60
+ export function composeLoopContext(layers) {
61
+ const sections = layers.map(composeLayer).filter((s) => s.trim());
62
+ if (sections.length === 0)
63
+ return '';
64
+ return sections.join('\n\n');
65
+ }
66
+ //# sourceMappingURL=loop-context-compose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loop-context-compose.js","sourceRoot":"","sources":["../../../src/resolvers/compose/loop-context-compose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,0DAA0D;AAC1D,MAAM,CAAC,MAAM,GAAG,GAAG,cAAc,CAAC;AAElC;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAC/B,IAAS,EACT,SAAmB;IAEnB,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACxC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CACnB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACP,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,gBAAgB,CAAC;QAC7C,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,gBAAgB,CAAC,CAChD,CAAC;AACJ,CAAC;AA2BD,SAAS,QAAQ,CAAC,EAAiB;IACjC,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,IAA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K,CAAC,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC1G,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,KAAK,CAAC,IAAI,CAAC,8BAA8B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAClE,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAClC,OAAO,MAAM,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;AAC3D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAA0B;IAC3D,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAClE,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACrC,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * GENERATED FILE -- DO NOT EDIT.
3
+ *
4
+ * Deno edge-function copy of src/lib/context-assembly/resolvers/loop-frt-statement-compose.ts, produced by
5
+ * `npm run gen:shared-mirrors`. The canonical source is the ONLY hand-edited
6
+ * copy of this algorithm; edit it there and regenerate. The drift gate
7
+ * (`npm run lint:shared-mirrors`) fails CI when this file differs from what
8
+ * generation would produce, so the same algorithm runs in both runtimes.
9
+ *
10
+ * @module resolvers/compose/loop-frt-statement-compose
11
+ */
12
+ /** The assembly source-reference this module composes. */
13
+ export declare const REF = "loop.frt_statement";
14
+ /** Per-delivery injection frt_statement (null when unset). */
15
+ export interface LoopFrtStatementEntry {
16
+ frtStatement: string | null;
17
+ }
18
+ /**
19
+ * Return the linked injections' frt_statement fields as plain text (no markdown
20
+ * headers), one per delivery in scope, joined with blank lines. Empty string
21
+ * when no injection has an FRT statement set.
22
+ */
23
+ export declare function composeLoopFrtStatement(entries: LoopFrtStatementEntry[]): string;
24
+ //# sourceMappingURL=loop-frt-statement-compose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loop-frt-statement-compose.d.ts","sourceRoot":"","sources":["../../../src/resolvers/compose/loop-frt-statement-compose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,0DAA0D;AAC1D,eAAO,MAAM,GAAG,uBAAuB,CAAC;AAExC,8DAA8D;AAC9D,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,qBAAqB,EAAE,GAAG,MAAM,CAQhF"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * GENERATED FILE -- DO NOT EDIT.
3
+ *
4
+ * Deno edge-function copy of src/lib/context-assembly/resolvers/loop-frt-statement-compose.ts, produced by
5
+ * `npm run gen:shared-mirrors`. The canonical source is the ONLY hand-edited
6
+ * copy of this algorithm; edit it there and regenerate. The drift gate
7
+ * (`npm run lint:shared-mirrors`) fails CI when this file differs from what
8
+ * generation would produce, so the same algorithm runs in both runtimes.
9
+ *
10
+ * @module resolvers/compose/loop-frt-statement-compose
11
+ */
12
+ /** The assembly source-reference this module composes. */
13
+ export const REF = 'loop.frt_statement';
14
+ /**
15
+ * Return the linked injections' frt_statement fields as plain text (no markdown
16
+ * headers), one per delivery in scope, joined with blank lines. Empty string
17
+ * when no injection has an FRT statement set.
18
+ */
19
+ export function composeLoopFrtStatement(entries) {
20
+ const lines = [];
21
+ for (const { frtStatement } of entries) {
22
+ if (typeof frtStatement !== 'string' || frtStatement.trim().length === 0)
23
+ continue;
24
+ lines.push(frtStatement.trim());
25
+ }
26
+ if (lines.length === 0)
27
+ return '';
28
+ return lines.join('\n\n');
29
+ }
30
+ //# sourceMappingURL=loop-frt-statement-compose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loop-frt-statement-compose.js","sourceRoot":"","sources":["../../../src/resolvers/compose/loop-frt-statement-compose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,0DAA0D;AAC1D,MAAM,CAAC,MAAM,GAAG,GAAG,oBAAoB,CAAC;AAOxC;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAgC;IACtE,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,EAAE,YAAY,EAAE,IAAI,OAAO,EAAE,CAAC;QACvC,IAAI,OAAO,YAAY,KAAK,QAAQ,IAAI,YAAY,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QACnF,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;IAClC,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAClC,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * GENERATED FILE -- DO NOT EDIT.
3
+ *
4
+ * Deno edge-function copy of src/lib/context-assembly/resolvers/loop-injection-compose.ts, produced by
5
+ * `npm run gen:shared-mirrors`. The canonical source is the ONLY hand-edited
6
+ * copy of this algorithm; edit it there and regenerate. The drift gate
7
+ * (`npm run lint:shared-mirrors`) fails CI when this file differs from what
8
+ * generation would produce, so the same algorithm runs in both runtimes.
9
+ *
10
+ * @module resolvers/compose/loop-injection-compose
11
+ */
12
+ /** The assembly source-reference this module composes. */
13
+ export declare const REF = "loop.injection";
14
+ /** The fields of a linked injection node loop.injection renders. */
15
+ export interface LoopInjectionNode {
16
+ statement: string;
17
+ injectionStatus: string | null;
18
+ dissolvesObstacle: string | null;
19
+ }
20
+ /** One delivery + its linked injection node. */
21
+ export interface LoopInjectionEntry {
22
+ deliveryName: string;
23
+ injection: LoopInjectionNode;
24
+ }
25
+ /**
26
+ * Render, per delivery, the linked injection node: statement, lifecycle status,
27
+ * and the obstacle it dissolves. Returns '' when there is nothing to render.
28
+ */
29
+ export declare function composeLoopInjection(entries: LoopInjectionEntry[]): string;
30
+ //# sourceMappingURL=loop-injection-compose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loop-injection-compose.d.ts","sourceRoot":"","sources":["../../../src/resolvers/compose/loop-injection-compose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,0DAA0D;AAC1D,eAAO,MAAM,GAAG,mBAAmB,CAAC;AAEpC,oEAAoE;AACpE,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAED,gDAAgD;AAChD,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,iBAAiB,CAAC;CAC9B;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAqB1E"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * GENERATED FILE -- DO NOT EDIT.
3
+ *
4
+ * Deno edge-function copy of src/lib/context-assembly/resolvers/loop-injection-compose.ts, produced by
5
+ * `npm run gen:shared-mirrors`. The canonical source is the ONLY hand-edited
6
+ * copy of this algorithm; edit it there and regenerate. The drift gate
7
+ * (`npm run lint:shared-mirrors`) fails CI when this file differs from what
8
+ * generation would produce, so the same algorithm runs in both runtimes.
9
+ *
10
+ * @module resolvers/compose/loop-injection-compose
11
+ */
12
+ /** The assembly source-reference this module composes. */
13
+ export const REF = 'loop.injection';
14
+ /**
15
+ * Render, per delivery, the linked injection node: statement, lifecycle status,
16
+ * and the obstacle it dissolves. Returns '' when there is nothing to render.
17
+ */
18
+ export function composeLoopInjection(entries) {
19
+ const sections = [];
20
+ for (const { deliveryName, injection } of entries) {
21
+ const inj = injection;
22
+ const statusTag = inj.injectionStatus ? ` [${inj.injectionStatus}]` : '';
23
+ const dissolvesLine = inj.dissolvesObstacle
24
+ ? `- **Dissolves obstacle:** ${inj.dissolvesObstacle}`
25
+ : null;
26
+ const lines = [
27
+ `### ${deliveryName}`,
28
+ '',
29
+ `- **Injection:** ${inj.statement}${statusTag}`,
30
+ `- **Injection status:** ${inj.injectionStatus ?? '_not set_'}`,
31
+ ];
32
+ if (dissolvesLine)
33
+ lines.push(dissolvesLine);
34
+ sections.push(lines.join('\n'));
35
+ }
36
+ if (sections.length === 0)
37
+ return '';
38
+ return `## Loop Injection (per delivery)\n\n${sections.join('\n\n')}`;
39
+ }
40
+ //# sourceMappingURL=loop-injection-compose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loop-injection-compose.js","sourceRoot":"","sources":["../../../src/resolvers/compose/loop-injection-compose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,0DAA0D;AAC1D,MAAM,CAAC,MAAM,GAAG,GAAG,gBAAgB,CAAC;AAepC;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAA6B;IAChE,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,KAAK,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,OAAO,EAAE,CAAC;QAClD,MAAM,GAAG,GAAG,SAAS,CAAC;QACtB,MAAM,SAAS,GAAG,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,eAAe,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACzE,MAAM,aAAa,GAAG,GAAG,CAAC,iBAAiB;YACzC,CAAC,CAAC,6BAA6B,GAAG,CAAC,iBAAiB,EAAE;YACtD,CAAC,CAAC,IAAI,CAAC;QAET,MAAM,KAAK,GAAa;YACtB,OAAO,YAAY,EAAE;YACrB,EAAE;YACF,oBAAoB,GAAG,CAAC,SAAS,GAAG,SAAS,EAAE;YAC/C,2BAA2B,GAAG,CAAC,eAAe,IAAI,WAAW,EAAE;SAChE,CAAC;QACF,IAAI,aAAa;YAAE,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC7C,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACrC,OAAO,uCAAuC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;AACxE,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * GENERATED FILE -- DO NOT EDIT.
3
+ *
4
+ * Deno edge-function copy of src/lib/context-assembly/resolvers/loop-persona-compose.ts, produced by
5
+ * `npm run gen:shared-mirrors`. The canonical source is the ONLY hand-edited
6
+ * copy of this algorithm; edit it there and regenerate. The drift gate
7
+ * (`npm run lint:shared-mirrors`) fails CI when this file differs from what
8
+ * generation would produce, so the same algorithm runs in both runtimes.
9
+ *
10
+ * @module resolvers/compose/loop-persona-compose
11
+ */
12
+ /** The assembly source-reference this module composes. */
13
+ export declare const REF = "loop.persona";
14
+ /** The stored loop persona, or null when none is set for the entity. */
15
+ export interface LoopPersona {
16
+ content: string | null;
17
+ }
18
+ /**
19
+ * Return the human-authored persona prompt text stored on the entity's loop
20
+ * layer, or '' when none is set. The no-variant loop.persona resolves to the
21
+ * raw "You are..." content verbatim.
22
+ */
23
+ export declare function composeLoopPersona(persona: LoopPersona | null): string;
24
+ //# sourceMappingURL=loop-persona-compose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loop-persona-compose.d.ts","sourceRoot":"","sources":["../../../src/resolvers/compose/loop-persona-compose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,0DAA0D;AAC1D,eAAO,MAAM,GAAG,iBAAiB,CAAC;AAElC,wEAAwE;AACxE,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,MAAM,CAGtE"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * GENERATED FILE -- DO NOT EDIT.
3
+ *
4
+ * Deno edge-function copy of src/lib/context-assembly/resolvers/loop-persona-compose.ts, produced by
5
+ * `npm run gen:shared-mirrors`. The canonical source is the ONLY hand-edited
6
+ * copy of this algorithm; edit it there and regenerate. The drift gate
7
+ * (`npm run lint:shared-mirrors`) fails CI when this file differs from what
8
+ * generation would produce, so the same algorithm runs in both runtimes.
9
+ *
10
+ * @module resolvers/compose/loop-persona-compose
11
+ */
12
+ /** The assembly source-reference this module composes. */
13
+ export const REF = 'loop.persona';
14
+ /**
15
+ * Return the human-authored persona prompt text stored on the entity's loop
16
+ * layer, or '' when none is set. The no-variant loop.persona resolves to the
17
+ * raw "You are..." content verbatim.
18
+ */
19
+ export function composeLoopPersona(persona) {
20
+ if (!persona || !persona.content)
21
+ return '';
22
+ return persona.content;
23
+ }
24
+ //# sourceMappingURL=loop-persona-compose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loop-persona-compose.js","sourceRoot":"","sources":["../../../src/resolvers/compose/loop-persona-compose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,0DAA0D;AAC1D,MAAM,CAAC,MAAM,GAAG,GAAG,cAAc,CAAC;AAOlC;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAA2B;IAC5D,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IAC5C,OAAO,OAAO,CAAC,OAAO,CAAC;AACzB,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * GENERATED FILE -- DO NOT EDIT.
3
+ *
4
+ * Deno edge-function copy of src/lib/context-assembly/resolvers/loop-upstream-udes-compose.ts, produced by
5
+ * `npm run gen:shared-mirrors`. The canonical source is the ONLY hand-edited
6
+ * copy of this algorithm; edit it there and regenerate. The drift gate
7
+ * (`npm run lint:shared-mirrors`) fails CI when this file differs from what
8
+ * generation would produce, so the same algorithm runs in both runtimes.
9
+ *
10
+ * @module resolvers/compose/loop-upstream-udes-compose
11
+ */
12
+ /** The assembly source-reference this module composes. */
13
+ export declare const REF = "loop.upstream_udes";
14
+ /** Maximum BFS depth for the upstream UDE walk. */
15
+ export declare const MAX_UPSTREAM_DEPTH = 3;
16
+ /** A reality-tree node (camelCase, as returned by reality_tree_node_list). */
17
+ export interface UpstreamNode {
18
+ id: string;
19
+ seq: number;
20
+ statement: string;
21
+ nodeType: string;
22
+ }
23
+ /** A reality-tree edge (camelCase, as returned by reality_tree_edge_list). */
24
+ export interface UpstreamEdge {
25
+ edgeType: string;
26
+ fromNodeId: string;
27
+ toNodeId: string;
28
+ }
29
+ /** Per-delivery already-fetched fetch inputs for the upstream walk. */
30
+ export interface LoopUpstreamUdesEntry {
31
+ deliveryName: string;
32
+ injectionId: string;
33
+ nodes: UpstreamNode[];
34
+ edges: UpstreamEdge[];
35
+ }
36
+ /**
37
+ * For each delivery's injection, seed from the nodes it targets (via 'targets'
38
+ * edges) and BFS upstream along causal edges ('sufficient' and 'and') up to
39
+ * MAX_UPSTREAM_DEPTH hops, returning a markdown list of the upstream UDE/entity
40
+ * nodes the injection indirectly addresses. Cycle-safe; seeds excluded from
41
+ * output. Returns '' when nothing upstream is found.
42
+ */
43
+ export declare function composeLoopUpstreamUdes(entries: LoopUpstreamUdesEntry[]): string;
44
+ //# sourceMappingURL=loop-upstream-udes-compose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loop-upstream-udes-compose.d.ts","sourceRoot":"","sources":["../../../src/resolvers/compose/loop-upstream-udes-compose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,0DAA0D;AAC1D,eAAO,MAAM,GAAG,uBAAuB,CAAC;AAExC,mDAAmD;AACnD,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC,8EAA8E;AAC9E,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,8EAA8E;AAC9E,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,uEAAuE;AACvE,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,KAAK,EAAE,YAAY,EAAE,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,qBAAqB,EAAE,GAAG,MAAM,CAmDhF"}