@chengxianglibra/dsh-data-analysis 0.1.1 → 0.1.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 (195) hide show
  1. package/README.md +83 -34
  2. package/lib/bin/environment.js +1 -1
  3. package/lib/bin/presentation-lint.js +21 -0
  4. package/lib/bridges.js +2 -2
  5. package/lib/client/credentials/create-datasource.js +67 -0
  6. package/lib/client/credentials/install.js +191 -0
  7. package/lib/client/credentials/model.js +494 -0
  8. package/lib/client/credentials/styles.js +17 -0
  9. package/lib/client/workspace-header-action.js +11 -0
  10. package/lib/client.js +1133 -736
  11. package/lib/compatibility.js +1 -1
  12. package/lib/datasource/authoring.js +70 -0
  13. package/lib/datasource/bridge-programs.js +30 -18
  14. package/lib/datasource/bridge.js +100 -8
  15. package/lib/datasource/index.js +3 -2
  16. package/lib/datasource/python.js +115 -0
  17. package/lib/datasource/resolver-program.js +112 -0
  18. package/lib/datasource/rpc.js +88 -0
  19. package/lib/datasource/service.js +687 -0
  20. package/lib/datasource/shell-env.js +2 -333
  21. package/lib/datasource/test.js +24 -51
  22. package/lib/environment/binding.js +54 -9
  23. package/lib/environment/runtime.js +89 -78
  24. package/lib/environment/subprocess.js +6 -1
  25. package/lib/environment/summary.js +3 -3
  26. package/lib/environment/workspace.js +5 -0
  27. package/lib/index.js +1 -1
  28. package/lib/plugin.js +168 -51
  29. package/lib/presentation/assets/portable.js +606 -0
  30. package/lib/presentation/assets/static.js +945 -0
  31. package/lib/presentation/build/index.js +71 -0
  32. package/lib/presentation/commit.js +156 -0
  33. package/lib/presentation/contracts/charts.js +476 -0
  34. package/lib/presentation/contracts/editing.js +58 -0
  35. package/lib/presentation/contracts/index.js +651 -0
  36. package/lib/presentation/contracts/interaction.js +62 -0
  37. package/lib/presentation/contracts/types.js +15 -0
  38. package/lib/presentation/contracts/values.js +28 -0
  39. package/lib/presentation/delivery.js +56 -0
  40. package/lib/presentation/files.js +83 -0
  41. package/lib/presentation/index.js +6 -0
  42. package/lib/presentation/lint.js +46 -0
  43. package/lib/presentation/projection/files.js +85 -0
  44. package/lib/presentation/projection/index.js +195 -0
  45. package/lib/presentation/projection/program.js +144 -0
  46. package/lib/presentation/projection/sql-code.js +79 -0
  47. package/lib/presentation/receipt.js +34 -0
  48. package/lib/presentation/reports.js +122 -0
  49. package/lib/presentation/rpc.js +148 -0
  50. package/lib/presentation/tool.js +122 -0
  51. package/lib/python-execution-contracts.js +1 -0
  52. package/lib/python-execution.js +232 -0
  53. package/lib/semantic-browser/contracts.js +80 -0
  54. package/lib/semantic-browser/definition.js +64 -0
  55. package/lib/semantic-browser/program.js +119 -0
  56. package/lib/semantic-browser/service.js +72 -0
  57. package/lib/semantic-reference/bridge.js +118 -0
  58. package/lib/semantic-reference/contracts.js +113 -0
  59. package/lib/semantic-reference/index.js +3 -0
  60. package/lib/semantic-reference/rpc.js +122 -0
  61. package/lib/semantic-reference/search.js +94 -0
  62. package/lib/semantic-reference/usage.js +143 -0
  63. package/lib/types/bridges.d.ts +2 -2
  64. package/lib/types/client/credentials/create-datasource.d.ts +5 -0
  65. package/lib/types/client/credentials/install.d.ts +1 -0
  66. package/lib/types/client/credentials/model.d.ts +59 -0
  67. package/lib/types/client/credentials/styles.d.ts +1 -0
  68. package/lib/types/client/presentation/ask-dsh.d.ts +9 -0
  69. package/lib/types/client/presentation/chart-explorer.d.ts +12 -0
  70. package/lib/types/client/presentation/chart-geometry.d.ts +30 -0
  71. package/lib/types/client/presentation/chart-renderer.d.ts +10 -0
  72. package/lib/types/client/presentation/chart-specials.d.ts +10 -0
  73. package/lib/types/client/presentation/chart-styles.d.ts +1 -0
  74. package/lib/types/client/presentation/chart-tooltip.d.ts +13 -0
  75. package/lib/types/client/presentation/chart-view.d.ts +23 -0
  76. package/lib/types/client/presentation/copy-context.d.ts +5 -0
  77. package/lib/types/client/presentation/delivery-model.d.ts +54 -0
  78. package/lib/types/client/presentation/delivery.d.ts +77 -0
  79. package/lib/types/client/presentation/editor-controls.d.ts +12 -0
  80. package/lib/types/client/presentation/global-filters.d.ts +6 -0
  81. package/lib/types/client/presentation/host-entry.d.ts +12 -0
  82. package/lib/types/client/presentation/icons.d.ts +4 -0
  83. package/lib/types/client/presentation/install.d.ts +15 -0
  84. package/lib/types/client/presentation/markdown.d.ts +5 -0
  85. package/lib/types/client/presentation/model.d.ts +62 -0
  86. package/lib/types/client/presentation/reader.d.ts +11 -0
  87. package/lib/types/client/presentation/source-code-model.d.ts +16 -0
  88. package/lib/types/client/presentation/source-code.d.ts +11 -0
  89. package/lib/types/client/presentation/source-dialog.d.ts +13 -0
  90. package/lib/types/client/presentation/source-facts.d.ts +20 -0
  91. package/lib/types/client/presentation/source-format.d.ts +5 -0
  92. package/lib/types/client/presentation/source-highlight.d.ts +7 -0
  93. package/lib/types/client/presentation/sources.d.ts +13 -0
  94. package/lib/types/client/presentation/styles.d.ts +1 -0
  95. package/lib/types/client/presentation/table.d.ts +12 -0
  96. package/lib/types/client/presentation/use-element-width.d.ts +5 -0
  97. package/lib/types/client/workspace-header-action.d.ts +7 -0
  98. package/lib/types/client.d.ts +4 -122
  99. package/lib/types/compatibility.d.ts +2 -2
  100. package/lib/types/datasource/authoring.d.ts +25 -0
  101. package/lib/types/datasource/bridge.d.ts +21 -3
  102. package/lib/types/datasource/index.d.ts +3 -5
  103. package/lib/types/datasource/python.d.ts +4 -0
  104. package/lib/types/datasource/resolver-program.d.ts +6 -0
  105. package/lib/types/datasource/rpc.d.ts +4 -0
  106. package/lib/types/datasource/service.d.ts +112 -0
  107. package/lib/types/datasource/shell-env.d.ts +0 -29
  108. package/lib/types/datasource/test.d.ts +6 -29
  109. package/lib/types/environment/binding.d.ts +5 -1
  110. package/lib/types/environment/errors.d.ts +1 -1
  111. package/lib/types/environment/runtime.d.ts +5 -5
  112. package/lib/types/environment/types.d.ts +13 -2
  113. package/lib/types/index.d.ts +1 -1
  114. package/lib/types/plugin.d.ts +11 -5
  115. package/lib/types/presentation/build/index.d.ts +11 -0
  116. package/lib/types/presentation/commit.d.ts +4 -0
  117. package/lib/types/presentation/contracts/charts.d.ts +13 -0
  118. package/lib/types/presentation/contracts/editing.d.ts +8 -0
  119. package/lib/types/presentation/contracts/index.d.ts +11 -0
  120. package/lib/types/presentation/contracts/interaction.d.ts +8 -0
  121. package/lib/types/presentation/contracts/types.d.ts +252 -0
  122. package/lib/types/presentation/contracts/values.d.ts +9 -0
  123. package/lib/types/presentation/delivery.d.ts +3 -0
  124. package/lib/types/presentation/files.d.ts +7 -0
  125. package/lib/types/presentation/index.d.ts +6 -0
  126. package/lib/types/presentation/lint.d.ts +13 -0
  127. package/lib/types/presentation/projection/files.d.ts +2 -0
  128. package/lib/types/presentation/projection/index.d.ts +20 -0
  129. package/lib/types/presentation/projection/program.d.ts +2 -0
  130. package/lib/types/presentation/projection/sql-code.d.ts +2 -0
  131. package/lib/types/presentation/receipt.d.ts +14 -0
  132. package/lib/types/presentation/reports.d.ts +5 -0
  133. package/lib/types/presentation/rpc.d.ts +24 -0
  134. package/lib/types/presentation/tool.d.ts +12 -0
  135. package/lib/types/python-execution-contracts.d.ts +10 -0
  136. package/lib/types/python-execution.d.ts +10 -0
  137. package/lib/types/semantic-browser/contracts.d.ts +40 -0
  138. package/lib/types/semantic-browser/definition.d.ts +20 -0
  139. package/lib/types/semantic-browser/program.d.ts +2 -0
  140. package/lib/types/semantic-browser/service.d.ts +20 -0
  141. package/lib/types/semantic-reference/bridge.d.ts +11 -0
  142. package/lib/types/semantic-reference/contracts.d.ts +51 -0
  143. package/lib/types/semantic-reference/index.d.ts +3 -0
  144. package/lib/types/semantic-reference/rpc.d.ts +15 -0
  145. package/lib/types/semantic-reference/search.d.ts +10 -0
  146. package/lib/types/semantic-reference/usage.d.ts +43 -0
  147. package/package.json +43 -19
  148. package/python/presentation-kit/dist/dsh_data_analysis_presentation_kit-1.1.0-py3-none-any.whl +0 -0
  149. package/skills/dsh-data-analysis-presentation/SKILL.md +24 -0
  150. package/skills/dsh-data-analysis-presentation/references/chart-examples.md +18 -0
  151. package/skills/dsh-data-analysis-presentation/references/charts.md +55 -0
  152. package/skills/dsh-data-analysis-presentation/references/examples/artifact.draft.json +27 -0
  153. package/skills/dsh-data-analysis-presentation/references/examples/charts-bins.dataset.json +33 -0
  154. package/skills/dsh-data-analysis-presentation/references/examples/charts-boxes.dataset.json +45 -0
  155. package/skills/dsh-data-analysis-presentation/references/examples/charts-composition.dataset.json +33 -0
  156. package/skills/dsh-data-analysis-presentation/references/examples/charts-funnel.dataset.json +27 -0
  157. package/skills/dsh-data-analysis-presentation/references/examples/charts-precision.dataset.json +21 -0
  158. package/skills/dsh-data-analysis-presentation/references/examples/charts-series.dataset.json +58 -0
  159. package/skills/dsh-data-analysis-presentation/references/examples/charts-shares.dataset.json +33 -0
  160. package/skills/dsh-data-analysis-presentation/references/examples/charts-waterfall.dataset.json +44 -0
  161. package/skills/dsh-data-analysis-presentation/references/examples/charts.draft.json +392 -0
  162. package/skills/dsh-data-analysis-presentation/references/examples/comparison-selected.dataset.json +24 -0
  163. package/skills/dsh-data-analysis-presentation/references/examples/comparison-summary.dataset.json +22 -0
  164. package/skills/dsh-data-analysis-presentation/references/examples/comparison.dataset.json +18 -0
  165. package/skills/dsh-data-analysis-presentation/references/examples/comparison.draft.json +79 -0
  166. package/skills/dsh-data-analysis-presentation/references/examples/computed-sources.draft.json +35 -0
  167. package/skills/dsh-data-analysis-presentation/references/examples/computed.dataset.json +12 -0
  168. package/skills/dsh-data-analysis-presentation/references/examples/computed.draft.json +57 -0
  169. package/skills/dsh-data-analysis-presentation/references/examples/interaction-detail.dataset.json +30 -0
  170. package/skills/dsh-data-analysis-presentation/references/examples/interaction-summary.dataset.json +22 -0
  171. package/skills/dsh-data-analysis-presentation/references/examples/interaction.draft.json +278 -0
  172. package/skills/dsh-data-analysis-presentation/references/examples/source-only.draft.json +19 -0
  173. package/skills/dsh-data-analysis-presentation/references/examples/write-charts.py +73 -0
  174. package/skills/dsh-data-analysis-presentation/references/examples/write-comparison.py +42 -0
  175. package/skills/dsh-data-analysis-presentation/references/examples/write-computed.py +21 -0
  176. package/skills/dsh-data-analysis-presentation/references/examples/write-interaction.py +33 -0
  177. package/skills/dsh-data-analysis-presentation/references/examples.md +42 -0
  178. package/skills/dsh-data-analysis-presentation/references/interaction.md +56 -0
  179. package/skills/dsh-data-analysis-presentation/references/narrative.md +37 -0
  180. package/skills/dsh-data-analysis-presentation/references/schema.md +138 -0
  181. package/lib/datasource/access.js +0 -60
  182. package/lib/datasource/credentials.js +0 -24
  183. package/lib/evidence/bridge-program.js +0 -153
  184. package/lib/evidence/bridge.js +0 -166
  185. package/lib/evidence/index.js +0 -2
  186. package/lib/evidence/sources.js +0 -263
  187. package/lib/types/datasource/access.d.ts +0 -27
  188. package/lib/types/evidence/bridge.d.ts +0 -40
  189. package/lib/types/evidence/index.d.ts +0 -4
  190. package/lib/types/evidence/sources.d.ts +0 -57
  191. package/python/report-kit/dist/dsh_data_analysis_report_kit-3.0.0-py3-none-any.whl +0 -0
  192. package/skills/dsh-data-analysis-report/SKILL.md +0 -57
  193. package/skills/dsh-data-analysis-report/assets/marivo-artifact.js +0 -113
  194. package/skills/dsh-data-analysis-report/assets/marivo-session-dag.js +0 -1201
  195. package/skills/dsh-data-analysis-report/assets/report-data.js +0 -449
@@ -11,38 +11,41 @@ import { FixedSubprocessPolicy } from "./subprocess.js";
11
11
  export const SHARED_PYTHON_SPEC = '3.10';
12
12
  const PINNED_MARIVO_VERSION = MARIVO_VERSION;
13
13
  export const SHARED_MARIVO_PACKAGE_SPEC = MARIVO_PACKAGE_SPEC;
14
- export const REPORT_KIT_DISTRIBUTION = 'dsh-data-analysis-report-kit';
15
- export const REPORT_KIT_VERSION = '3.0.0';
16
- export const REPORT_KIT_PANDAS_RANGE = '>=2.2.0,<3.0.0';
17
- export const REPORT_KIT_WHEEL_FILENAME = 'dsh_data_analysis_report_kit-3.0.0-py3-none-any.whl';
14
+ export const PRESENTATION_KIT_DISTRIBUTION = 'dsh-data-analysis-presentation-kit';
15
+ export const PRESENTATION_KIT_VERSION = '1.1.0';
16
+ export const PRESENTATION_KIT_PANDAS_RANGE = '>=2.2.0,<3.0.0';
17
+ export const PRESENTATION_KIT_WHEEL_FILENAME = 'dsh_data_analysis_presentation_kit-1.1.0-py3-none-any.whl';
18
18
  export const DEFAULT_SHARED_RUNTIME_INSTALL_TIMEOUT_MS = 600_000;
19
19
  const INSTALLATION_SCHEMA = RUNTIME_INSTALLATION_VERSION;
20
20
  const INSTALLATION_FILENAME = 'installation.json';
21
21
  const SKILL_NAMES = ['marivo-analysis', 'marivo-semantic'];
22
- const REPORT_ADAPTER_KIND = 'dsh-data-analysis-report-transport-adapter';
23
22
  const PROBE_SCRIPT = String.raw `
24
23
  import json
25
24
  import os
26
25
  import sys
26
+ from importlib.metadata import distribution
27
27
  import marivo
28
+ from marivo.semantic.definition import SemanticDefinition
28
29
  import pandas
29
- import dsh_data_analysis_report
30
+ import dsh_data_analysis_presentation
30
31
  from packaging.specifiers import SpecifierSet
31
32
  from packaging.version import Version
32
33
 
34
+ presentation_distribution = distribution("dsh-data-analysis-presentation-kit")
35
+
33
36
  print(json.dumps({
34
37
  "python_executable": os.path.abspath(sys.executable),
35
38
  "marivo_version": marivo.__version__,
36
39
  "package_path": os.path.abspath(marivo.__file__ or ""),
37
40
  "pandas_version": pandas.__version__,
38
41
  "pandas_supported": Version(pandas.__version__) in SpecifierSet(">=2.2.0,<3.0.0"),
39
- "report_kit_version": dsh_data_analysis_report.__version__,
40
- "report_kit_package_path": os.path.abspath(dsh_data_analysis_report.__file__ or ""),
41
- "report_kit_public_imports": all(callable(value) for value in (
42
- dsh_data_analysis_report.emit_computed,
43
- dsh_data_analysis_report.emit_dataset,
44
- dsh_data_analysis_report.emit_session_trace,
45
- )),
42
+ "presentation_kit_version": dsh_data_analysis_presentation.__version__,
43
+ "presentation_kit_distribution_version": presentation_distribution.version,
44
+ "presentation_kit_package_path": os.path.abspath(dsh_data_analysis_presentation.__file__ or ""),
45
+ "presentation_kit_import_identity": os.path.realpath(dsh_data_analysis_presentation.__file__ or "") == os.path.realpath(
46
+ presentation_distribution.locate_file("dsh_data_analysis_presentation/__init__.py")
47
+ ),
48
+ "presentation_kit_public_imports": callable(dsh_data_analysis_presentation.write_dataset),
46
49
  }, sort_keys=True))
47
50
  `.trim();
48
51
  const PYTHON_VERSION_SCRIPT = String.raw `
@@ -56,8 +59,8 @@ print(json.dumps({
56
59
  "prefix": os.path.abspath(sys.prefix),
57
60
  }, sort_keys=True))
58
61
  `.trim();
59
- function administratorRepair(executable, reportKitWheel) {
60
- const dependencies = [SHARED_MARIVO_PACKAGE_SPEC, `pandas${REPORT_KIT_PANDAS_RANGE}`];
62
+ function administratorRepair(executable, presentationKitWheel) {
63
+ const dependencies = [SHARED_MARIVO_PACKAGE_SPEC, `pandas${PRESENTATION_KIT_PANDAS_RANGE}`];
61
64
  const commands = [
62
65
  {
63
66
  executable,
@@ -65,7 +68,7 @@ function administratorRepair(executable, reportKitWheel) {
65
68
  },
66
69
  {
67
70
  executable,
68
- args: ['-m', 'pip', 'install', '--no-deps', reportKitWheel],
71
+ args: ['-m', 'pip', 'install', '--no-deps', presentationKitWheel],
69
72
  },
70
73
  ];
71
74
  const commandText = (command) => [command.executable, ...command.args].map((value) => JSON.stringify(value)).join(' ');
@@ -90,22 +93,22 @@ function normalizeAbsolute(name, value) {
90
93
  function defaultRuntimeRoot() {
91
94
  return path.join(resolveDshHome(), 'dsh-data-analysis', 'runtimes', 'marivo');
92
95
  }
93
- function bundledReportKitWheel() {
94
- return fileURLToPath(new URL(`../../python/report-kit/dist/${REPORT_KIT_WHEEL_FILENAME}`, import.meta.url));
96
+ function bundledPresentationKitWheel() {
97
+ return fileURLToPath(new URL(`../../python/presentation-kit/dist/${PRESENTATION_KIT_WHEEL_FILENAME}`, import.meta.url));
95
98
  }
96
- async function assertReportKitWheel(filename) {
99
+ async function assertPresentationKitWheel(filename) {
97
100
  const selected = path.normalize(path.resolve(filename));
98
- if (path.basename(selected) !== REPORT_KIT_WHEEL_FILENAME) {
99
- throw new MarivoEnvironmentError('shared-runtime-report-kit-wheel-invalid', `Bundled report-kit wheel must be named ${REPORT_KIT_WHEEL_FILENAME}`, { expectedWheel: REPORT_KIT_WHEEL_FILENAME, actualWheel: path.basename(selected) });
101
+ if (path.basename(selected) !== PRESENTATION_KIT_WHEEL_FILENAME) {
102
+ throw new MarivoEnvironmentError('shared-runtime-presentation-kit-wheel-invalid', `Bundled presentation-kit wheel must be named ${PRESENTATION_KIT_WHEEL_FILENAME}`, { expectedWheel: PRESENTATION_KIT_WHEEL_FILENAME, actualWheel: path.basename(selected) });
100
103
  }
101
104
  try {
102
105
  if (!(await stat(selected)).isFile())
103
106
  throw new Error('not a file');
104
107
  }
105
108
  catch (cause) {
106
- throw new MarivoEnvironmentError('shared-runtime-report-kit-wheel-unavailable', `Bundled report-kit wheel is unavailable: ${selected}`, {
107
- distribution: REPORT_KIT_DISTRIBUTION,
108
- version: REPORT_KIT_VERSION,
109
+ throw new MarivoEnvironmentError('shared-runtime-presentation-kit-wheel-unavailable', `Bundled presentation-kit wheel is unavailable: ${selected}`, {
110
+ distribution: PRESENTATION_KIT_DISTRIBUTION,
111
+ version: PRESENTATION_KIT_VERSION,
109
112
  wheel: selected,
110
113
  }, { cause });
111
114
  }
@@ -153,7 +156,7 @@ function parseJsonObject(stage, result) {
153
156
  throw new MarivoEnvironmentError('shared-runtime-install-failed', `Shared Marivo runtime stage returned invalid JSON: ${stage}`, { stage, stdout: boundedText(result.stdout), stderr: boundedText(result.stderr) }, { cause });
154
157
  }
155
158
  }
156
- async function probeRuntime(runtimeRoot, executable, environment, timeoutMs, reportKitWheel, administrator, expectedMarivoVersion) {
159
+ async function probeRuntime(runtimeRoot, executable, environment, timeoutMs, presentationKitWheel, administrator, expectedMarivoVersion) {
157
160
  const canonical = await assertExecutable(executable);
158
161
  const policy = new FixedSubprocessPolicy(runtimeRoot, environment);
159
162
  const result = await policy.run({
@@ -161,15 +164,15 @@ async function probeRuntime(runtimeRoot, executable, environment, timeoutMs, rep
161
164
  args: ['-c', PROBE_SCRIPT],
162
165
  limits: { timeoutMs, stdoutMaxBytes: 16_384, stderrMaxBytes: 16_384 },
163
166
  });
164
- const repair = administrator ? administratorRepair(canonical, reportKitWheel) : undefined;
167
+ const repair = administrator ? administratorRepair(canonical, presentationKitWheel) : undefined;
165
168
  if (administrator && result.exitCode !== 0) {
166
- throw new MarivoEnvironmentError('shared-runtime-package-unavailable', `Administrator Python must provide Marivo ${PINNED_MARIVO_VERSION}, pandas ${REPORT_KIT_PANDAS_RANGE}, and ${REPORT_KIT_DISTRIBUTION} ${REPORT_KIT_VERSION}. ${repair.message}`, {
169
+ throw new MarivoEnvironmentError('shared-runtime-package-unavailable', `Administrator Python must provide Marivo ${PINNED_MARIVO_VERSION}, pandas ${PRESENTATION_KIT_PANDAS_RANGE}, and ${PRESENTATION_KIT_DISTRIBUTION} ${PRESENTATION_KIT_VERSION}. ${repair.message}`, {
167
170
  pythonExecutable: canonical,
168
171
  marivoVersion: PINNED_MARIVO_VERSION,
169
- pandasRange: REPORT_KIT_PANDAS_RANGE,
170
- reportKitDistribution: REPORT_KIT_DISTRIBUTION,
171
- reportKitVersion: REPORT_KIT_VERSION,
172
- reportKitWheel: reportKitWheel,
172
+ pandasRange: PRESENTATION_KIT_PANDAS_RANGE,
173
+ presentationKitDistribution: PRESENTATION_KIT_DISTRIBUTION,
174
+ presentationKitVersion: PRESENTATION_KIT_VERSION,
175
+ presentationKitWheel: presentationKitWheel,
173
176
  exitCode: result.exitCode,
174
177
  stderr: boundedText(result.stderr),
175
178
  repairCommands: repair.commands,
@@ -184,12 +187,15 @@ async function probeRuntime(runtimeRoot, executable, environment, timeoutMs, rep
184
187
  typeof probe.pandas_version !== 'string' ||
185
188
  probe.pandas_version.length === 0 ||
186
189
  typeof probe.pandas_supported !== 'boolean' ||
187
- typeof probe.report_kit_version !== 'string' ||
188
- probe.report_kit_version.length === 0 ||
189
- typeof probe.report_kit_package_path !== 'string' ||
190
- probe.report_kit_package_path.length === 0 ||
191
- probe.report_kit_public_imports !== true) {
192
- throw new MarivoEnvironmentError('shared-runtime-identity-mismatch', 'Shared Runtime returned an incomplete package identity', { probe });
190
+ typeof probe.presentation_kit_version !== 'string' ||
191
+ probe.presentation_kit_version.length === 0 ||
192
+ typeof probe.presentation_kit_distribution_version !== 'string' ||
193
+ probe.presentation_kit_distribution_version.length === 0 ||
194
+ typeof probe.presentation_kit_package_path !== 'string' ||
195
+ probe.presentation_kit_package_path.length === 0 ||
196
+ probe.presentation_kit_import_identity !== true ||
197
+ probe.presentation_kit_public_imports !== true) {
198
+ throw new MarivoEnvironmentError('shared-runtime-identity-mismatch', 'Shared Runtime returned an incomplete or mismatched package identity', { probe, ...(repair === undefined ? {} : { repairCommands: repair.commands }) });
193
199
  }
194
200
  const actualPython = await realpath(path.resolve(probe.python_executable));
195
201
  const selectedPython = await realpath(canonical);
@@ -202,18 +208,20 @@ async function probeRuntime(runtimeRoot, executable, environment, timeoutMs, rep
202
208
  });
203
209
  }
204
210
  if (!probe.pandas_supported) {
205
- throw new MarivoEnvironmentError('shared-runtime-pandas-unsupported', `Shared Runtime pandas ${probe.pandas_version} is unsupported; install ${REPORT_KIT_PANDAS_RANGE}.${repair === undefined ? '' : ` ${repair.message}`}`, {
206
- supportedPandasRange: REPORT_KIT_PANDAS_RANGE,
211
+ throw new MarivoEnvironmentError('shared-runtime-pandas-unsupported', `Shared Runtime pandas ${probe.pandas_version} is unsupported; install ${PRESENTATION_KIT_PANDAS_RANGE}.${repair === undefined ? '' : ` ${repair.message}`}`, {
212
+ supportedPandasRange: PRESENTATION_KIT_PANDAS_RANGE,
207
213
  actualPandasVersion: probe.pandas_version,
208
214
  ...(repair === undefined ? {} : { repairCommands: repair.commands }),
209
215
  });
210
216
  }
211
- if (probe.report_kit_version !== REPORT_KIT_VERSION) {
212
- throw new MarivoEnvironmentError('shared-runtime-report-kit-unsupported', `Shared Runtime report kit ${probe.report_kit_version} is unsupported; install ${REPORT_KIT_VERSION} from ${reportKitWheel}.${repair === undefined ? '' : ` ${repair.message}`}`, {
213
- supportedReportKitVersion: REPORT_KIT_VERSION,
214
- actualReportKitVersion: probe.report_kit_version,
215
- reportKitPackagePath: probe.report_kit_package_path,
216
- reportKitWheel,
217
+ if (probe.presentation_kit_version !== PRESENTATION_KIT_VERSION ||
218
+ probe.presentation_kit_distribution_version !== PRESENTATION_KIT_VERSION) {
219
+ throw new MarivoEnvironmentError('shared-runtime-presentation-kit-unsupported', `Shared Runtime presentation kit module ${probe.presentation_kit_version} and distribution ${probe.presentation_kit_distribution_version} must both be ${PRESENTATION_KIT_VERSION}; install from ${presentationKitWheel}.${repair === undefined ? '' : ` ${repair.message}`}`, {
220
+ supportedPresentationKitVersion: PRESENTATION_KIT_VERSION,
221
+ actualPresentationKitVersion: probe.presentation_kit_version,
222
+ actualPresentationKitDistributionVersion: probe.presentation_kit_distribution_version,
223
+ presentationKitPackagePath: probe.presentation_kit_package_path,
224
+ presentationKitWheel,
217
225
  ...(repair === undefined ? {} : { repairCommands: repair.commands }),
218
226
  });
219
227
  }
@@ -230,9 +238,11 @@ async function probeRuntime(runtimeRoot, executable, environment, timeoutMs, rep
230
238
  package_path: path.resolve(probe.package_path),
231
239
  pandas_version: probe.pandas_version,
232
240
  pandas_supported: probe.pandas_supported,
233
- report_kit_version: probe.report_kit_version,
234
- report_kit_package_path: path.resolve(probe.report_kit_package_path),
235
- report_kit_public_imports: true,
241
+ presentation_kit_version: probe.presentation_kit_version,
242
+ presentation_kit_distribution_version: probe.presentation_kit_distribution_version,
243
+ presentation_kit_package_path: path.resolve(probe.presentation_kit_package_path),
244
+ presentation_kit_import_identity: true,
245
+ presentation_kit_public_imports: true,
236
246
  };
237
247
  }
238
248
  async function validateSkills(skillsRoot) {
@@ -308,12 +318,12 @@ async function readInstallation(runtimeRoot) {
308
318
  'marivoVersion',
309
319
  'packagePath',
310
320
  'pythonExecutable',
311
- 'reportAdapterKind',
312
- 'reportKitPackagePath',
313
- 'reportKitVersion',
321
+ 'presentationKitDistribution',
322
+ 'presentationKitPackagePath',
323
+ 'presentationKitVersion',
314
324
  'schema',
315
325
  'skillsRoot',
316
- ];
326
+ ].sort();
317
327
  if (fields.length !== expectedFields.length ||
318
328
  fields.some((field, index) => field !== expectedFields[index]) ||
319
329
  record.schema !== INSTALLATION_SCHEMA ||
@@ -323,11 +333,11 @@ async function readInstallation(runtimeRoot) {
323
333
  record.pythonExecutable.length === 0 ||
324
334
  typeof record.packagePath !== 'string' ||
325
335
  record.packagePath.length === 0 ||
326
- record.reportAdapterKind !== REPORT_ADAPTER_KIND ||
327
- typeof record.reportKitVersion !== 'string' ||
328
- record.reportKitVersion.length === 0 ||
329
- typeof record.reportKitPackagePath !== 'string' ||
330
- record.reportKitPackagePath.length === 0 ||
336
+ record.presentationKitDistribution !== PRESENTATION_KIT_DISTRIBUTION ||
337
+ typeof record.presentationKitVersion !== 'string' ||
338
+ record.presentationKitVersion.length === 0 ||
339
+ typeof record.presentationKitPackagePath !== 'string' ||
340
+ record.presentationKitPackagePath.length === 0 ||
331
341
  typeof record.skillsRoot !== 'string' ||
332
342
  record.skillsRoot.length === 0)
333
343
  return undefined;
@@ -349,13 +359,13 @@ async function writeInstallation(runtimeRoot, record) {
349
359
  await rename(temporary, installationPath);
350
360
  return installationPath;
351
361
  }
352
- async function validatedExisting(runtimeRoot, configuredPython, environment, timeoutMs, reportKitWheel) {
362
+ async function validatedExisting(runtimeRoot, configuredPython, environment, timeoutMs, presentationKitWheel) {
353
363
  const record = await readInstallation(runtimeRoot);
354
364
  if (record === undefined)
355
365
  return undefined;
356
366
  if (record.marivoVersion !== PINNED_MARIVO_VERSION)
357
367
  return undefined;
358
- if (record.reportKitVersion !== REPORT_KIT_VERSION)
368
+ if (record.presentationKitVersion !== PRESENTATION_KIT_VERSION)
359
369
  return undefined;
360
370
  const expectedPython = configuredPython ?? venvPython(runtimeRoot);
361
371
  const expectedSkillsRoot = path.join(runtimeRoot, 'skills');
@@ -365,10 +375,11 @@ async function validatedExisting(runtimeRoot, configuredPython, environment, tim
365
375
  const selectedPython = await assertExecutable(expectedPython);
366
376
  if (path.normalize(record.pythonExecutable) !== selectedPython)
367
377
  return undefined;
368
- const probe = await probeRuntime(runtimeRoot, selectedPython, environment, timeoutMs, reportKitWheel, configuredPython !== undefined, record.marivoVersion);
378
+ const probe = await probeRuntime(runtimeRoot, selectedPython, environment, timeoutMs, presentationKitWheel, configuredPython !== undefined, record.marivoVersion);
369
379
  if (path.normalize(probe.package_path) !== path.normalize(record.packagePath))
370
380
  return undefined;
371
- if (path.normalize(probe.report_kit_package_path) !== path.normalize(record.reportKitPackagePath))
381
+ if (path.normalize(probe.presentation_kit_package_path) !==
382
+ path.normalize(record.presentationKitPackagePath))
372
383
  return undefined;
373
384
  await validateSkills(record.skillsRoot);
374
385
  return {
@@ -376,8 +387,8 @@ async function validatedExisting(runtimeRoot, configuredPython, environment, tim
376
387
  pythonExecutable: probe.python_executable,
377
388
  marivoVersion: probe.marivo_version,
378
389
  packagePath: probe.package_path,
379
- reportKitVersion: probe.report_kit_version,
380
- reportKitPackagePath: probe.report_kit_package_path,
390
+ presentationKitVersion: probe.presentation_kit_version,
391
+ presentationKitPackagePath: probe.presentation_kit_package_path,
381
392
  skillsRoot: record.skillsRoot,
382
393
  installationPath: path.join(runtimeRoot, INSTALLATION_FILENAME),
383
394
  };
@@ -451,7 +462,7 @@ async function backupInvalidRuntime(runtimeRoot) {
451
462
  }
452
463
  await rename(runtimeRoot, `${runtimeRoot}.invalid-${Date.now()}-${randomUUID()}`);
453
464
  }
454
- async function installManagedRuntime(runtimeRoot, uvExecutable, reportKitWheel, environment, timeoutMs) {
465
+ async function installManagedRuntime(runtimeRoot, uvExecutable, presentationKitWheel, environment, timeoutMs) {
455
466
  const policy = new FixedSubprocessPolicy(runtimeRoot, environment);
456
467
  const limits = { timeoutMs, stdoutMaxBytes: 1_048_576, stderrMaxBytes: 1_048_576 };
457
468
  requireSuccess('install managed Python', await policy.run({
@@ -492,12 +503,12 @@ async function installManagedRuntime(runtimeRoot, uvExecutable, reportKitWheel,
492
503
  args: ['pip', 'install', '--python', executable, '--upgrade', SHARED_MARIVO_PACKAGE_SPEC],
493
504
  limits,
494
505
  }));
495
- requireSuccess(`install report kit ${REPORT_KIT_VERSION}`, await policy.run({
506
+ requireSuccess(`install presentation kit ${PRESENTATION_KIT_VERSION}`, await policy.run({
496
507
  executable: uvExecutable,
497
- args: ['pip', 'install', '--python', executable, '--no-deps', reportKitWheel],
508
+ args: ['pip', 'install', '--python', executable, '--no-deps', presentationKitWheel],
498
509
  limits,
499
510
  }));
500
- return probeRuntime(runtimeRoot, executable, environment, timeoutMs, reportKitWheel, false, PINNED_MARIVO_VERSION);
511
+ return probeRuntime(runtimeRoot, executable, environment, timeoutMs, presentationKitWheel, false, PINNED_MARIVO_VERSION);
501
512
  }
502
513
  /** Ensure and validate the one DSH-home-owned Marivo installation. */
503
514
  export async function ensureSharedMarivoRuntime(config = {}, options = {}) {
@@ -511,33 +522,33 @@ export async function ensureSharedMarivoRuntime(config = {}, options = {}) {
511
522
  ? 'uv'
512
523
  : normalizeAbsolute('uvExecutable', config.uvExecutable);
513
524
  const timeoutMs = positiveTimeout(config.installTimeoutMs);
514
- const reportKitWheel = path.normalize(path.resolve(options.reportKitWheelPath ?? bundledReportKitWheel()));
515
- const existing = await validatedExisting(runtimeRoot, configuredPython, options.environment, timeoutMs, reportKitWheel);
525
+ const presentationKitWheel = path.normalize(path.resolve(options.presentationKitWheelPath ?? bundledPresentationKitWheel()));
526
+ const existing = await validatedExisting(runtimeRoot, configuredPython, options.environment, timeoutMs, presentationKitWheel);
516
527
  if (existing !== undefined)
517
528
  return existing;
518
529
  await mkdir(path.dirname(runtimeRoot), { recursive: true });
519
530
  const lockPath = `${runtimeRoot}.install-lock`;
520
531
  const release = await acquireLock(lockPath, timeoutMs, options.waitIntervalMs ?? 100);
521
532
  try {
522
- const afterLock = await validatedExisting(runtimeRoot, configuredPython, options.environment, timeoutMs, reportKitWheel);
533
+ const afterLock = await validatedExisting(runtimeRoot, configuredPython, options.environment, timeoutMs, presentationKitWheel);
523
534
  if (afterLock !== undefined)
524
535
  return afterLock;
525
536
  if (configuredPython === undefined)
526
- await assertReportKitWheel(reportKitWheel);
537
+ await assertPresentationKitWheel(presentationKitWheel);
527
538
  await backupInvalidRuntime(runtimeRoot);
528
539
  await mkdir(runtimeRoot, { recursive: true });
529
540
  const probe = configuredPython === undefined
530
- ? await installManagedRuntime(runtimeRoot, uvExecutable, reportKitWheel, options.environment, timeoutMs)
531
- : await probeRuntime(runtimeRoot, configuredPython, options.environment, timeoutMs, reportKitWheel, true, PINNED_MARIVO_VERSION);
541
+ ? await installManagedRuntime(runtimeRoot, uvExecutable, presentationKitWheel, options.environment, timeoutMs)
542
+ : await probeRuntime(runtimeRoot, configuredPython, options.environment, timeoutMs, presentationKitWheel, true, PINNED_MARIVO_VERSION);
532
543
  const skillsRoot = await syncSkills(runtimeRoot, probe.package_path);
533
544
  const record = {
534
545
  schema: INSTALLATION_SCHEMA,
535
546
  marivoVersion: probe.marivo_version,
536
547
  pythonExecutable: probe.python_executable,
537
548
  packagePath: probe.package_path,
538
- reportAdapterKind: REPORT_ADAPTER_KIND,
539
- reportKitVersion: probe.report_kit_version,
540
- reportKitPackagePath: probe.report_kit_package_path,
549
+ presentationKitDistribution: PRESENTATION_KIT_DISTRIBUTION,
550
+ presentationKitVersion: probe.presentation_kit_version,
551
+ presentationKitPackagePath: probe.presentation_kit_package_path,
541
552
  skillsRoot,
542
553
  };
543
554
  const installationPath = await writeInstallation(runtimeRoot, record);
@@ -546,8 +557,8 @@ export async function ensureSharedMarivoRuntime(config = {}, options = {}) {
546
557
  pythonExecutable: probe.python_executable,
547
558
  marivoVersion: probe.marivo_version,
548
559
  packagePath: probe.package_path,
549
- reportKitVersion: probe.report_kit_version,
550
- reportKitPackagePath: probe.report_kit_package_path,
560
+ presentationKitVersion: probe.presentation_kit_version,
561
+ presentationKitPackagePath: probe.presentation_kit_package_path,
551
562
  skillsRoot,
552
563
  installationPath,
553
564
  };
@@ -71,7 +71,7 @@ export class FixedSubprocessPolicy {
71
71
  shell: false,
72
72
  windowsHide: true,
73
73
  detached: process.platform !== 'win32',
74
- stdio: ['ignore', 'pipe', 'pipe'],
74
+ stdio: ['pipe', 'pipe', 'pipe'],
75
75
  });
76
76
  let child;
77
77
  try {
@@ -84,6 +84,9 @@ export class FixedSubprocessPolicy {
84
84
  }));
85
85
  return;
86
86
  }
87
+ // A child may reject its input before all bytes are written. Do not log payloads.
88
+ child.stdin.on('error', () => { });
89
+ child.stdin.end(request.stdin);
87
90
  const stdout = [];
88
91
  const stderr = [];
89
92
  let stdoutBytes = 0;
@@ -127,6 +130,8 @@ export class FixedSubprocessPolicy {
127
130
  timeout.unref();
128
131
  const onAbort = () => terminate(new MarivoEnvironmentError('subprocess-cancelled', 'Marivo subprocess was cancelled'));
129
132
  request.signal?.addEventListener('abort', onAbort, { once: true });
133
+ if (request.signal?.aborted)
134
+ onAbort();
130
135
  child.stdout.on('data', (chunk) => {
131
136
  stdoutBytes += chunk.byteLength;
132
137
  if (stdoutBytes > limits.stdoutMaxBytes) {
@@ -10,9 +10,9 @@ export function environmentPayload(runtime, environment) {
10
10
  version: environment.binding.marivoVersion,
11
11
  packagePath: environment.binding.packagePath,
12
12
  },
13
- reportKit: {
14
- version: runtime.reportKitVersion,
15
- packagePath: runtime.reportKitPackagePath,
13
+ presentationKit: {
14
+ version: runtime.presentationKitVersion,
15
+ packagePath: runtime.presentationKitPackagePath,
16
16
  },
17
17
  fingerprint: environment.binding.fingerprint,
18
18
  };
@@ -38,6 +38,11 @@ export class MarivoWorkspaceEnvironmentManager {
38
38
  binding = bindMarivoEnvironment({
39
39
  projectRoot: canonicalRoot,
40
40
  pythonExecutable: this.runtime.pythonExecutable,
41
+ }, {
42
+ presentationKit: {
43
+ version: this.runtime.presentationKitVersion,
44
+ packagePath: this.runtime.presentationKitPackagePath,
45
+ },
41
46
  });
42
47
  this.#bindings.set(canonicalRoot, binding);
43
48
  }
package/lib/index.js CHANGED
@@ -3,5 +3,5 @@ export * from "./compatibility.js";
3
3
  export * from "./datasource/index.js";
4
4
  export * from "./disclosure/index.js";
5
5
  export * from "./environment/index.js";
6
- export * from "./evidence/index.js";
7
6
  export { apply, Config, inject, installMarivoPlugin, name } from "./plugin.js";
7
+ export * from "./presentation/index.js";