推进 SDK API surface exports and smoke

This commit is contained in:
2026-06-15 22:24:17 +08:00
parent b771ee4141
commit f3d8955fd7
7 changed files with 425 additions and 9 deletions

View File

@@ -24,10 +24,40 @@ Use `src/index.js` for stable imports:
```js
import {
analyzeIniRuntimeBoundaries,
createIniPanelLaunchApiManifest,
createIniPanelShellViewModel,
createIniPanelShellWorkflowOverviewEmbeddingMountDomContract,
createIniPanelShellWorkflowOverviewEmbeddingMountDomReadiness,
createLinuxCncIniSdk,
createLinuxCncInterpSdk,
createMachineSessionSnapshotPayload,
createSessionSnapshot,
defaultMachinePaths,
gcodeFilenameFromProgramPath,
gcodeProgramPath,
getOpfsRoot,
isSupportedIniPanelLaunchApiManifest,
loadMachineSessionFromOpfs,
loadMachineSessionSnapshot,
loadMachineTextFiles,
loadMachineToolTableFromOpfs,
loadTextFile,
machineFilePaths,
machineIniPath,
mountIniPanelShellWorkflowOverviewEmbeddingMountState,
normalizeOpfsPath,
parameterFilePath,
planIniFileContextStaging,
planSimConfigStaging,
renderIniPanelShellWorkflowOverviewEmbeddingMountState,
restoreMachineParametersFromOpfs,
saveMachineSessionSnapshot,
saveMachineTextFiles,
saveSessionSnapshot,
saveTextFile,
sessionSnapshotPath,
toolTablePath,
validateSessionSnapshot,
} from "./src/index.js";
```
@@ -123,3 +153,49 @@ change interpreter semantics.
path but keeps the runner loop going after LinuxCNC reports an error, matching
upstream `rs274 -n 0` regression tests such as `tests/interp/oword-unwind`.
It does not implement or reinterpret LinuxCNC error semantics.
## OPFS/session persistence exports
The SDK entrypoint re-exports the OPFS/session persistence helpers used by the
browser panel so external callers can stage the same files without importing
private module paths:
- `getOpfsRoot()`, `saveTextFile()`, and `loadTextFile()` for browser OPFS text
persistence.
- `machineIniPath()`, `toolTablePath()`, `parameterFilePath()`,
`gcodeProgramPath()`, `sessionSnapshotPath()`, `defaultMachinePaths()`, and
`normalizeOpfsPath()` for stable OPFS path construction.
- `createMachineSessionSnapshotPayload()`, `createSessionSnapshot()`,
`saveSessionSnapshot()`, `saveMachineSessionSnapshot()`,
`loadMachineSessionSnapshot()`, and `validateSessionSnapshot()` for session
snapshot persistence.
- `machineFilePaths()`, `saveMachineTextFiles()`, `loadMachineTextFiles()`, and
`gcodeFilenameFromProgramPath()` for machine-file and G-code file helpers.
- `restoreMachineParametersFromOpfs()`, `loadMachineToolTableFromOpfs()`, and
`loadMachineSessionFromOpfs()` for loading OPFS machine state into the
LinuxCNC-backed interpreter SDK.
These helpers only move and validate host files. Parameter and tool-table
effects still come from the LinuxCNC-backed interpreter SDK methods they call.
## INI panel shell handoff exports
The SDK entrypoint also re-exports the stable INI panel shell handoff surface
for external browser shells:
- `createIniPanelLaunchApiManifest()` and
`isSupportedIniPanelLaunchApiManifest()` for launch API negotiation.
- `createIniPanelShellViewModel()` for a complete read-only shell integration
bundle.
- `createIniPanelShellWorkflowOverviewEmbeddingMountDomContract()` and
`createIniPanelShellWorkflowOverviewEmbeddingMountDomReadiness()` for
workflow overview embedding mount DOM checks.
- `renderIniPanelShellWorkflowOverviewEmbeddingMountState()` for rendering a
mount render-state into caller-owned DOM.
- `mountIniPanelShellWorkflowOverviewEmbeddingMountState()` for a non-throwing
workflow overview embedding mount wrapper that returns structured blocked
results when DOM nodes are missing.
The workflow overview embedding helpers are UI/runtime boundary helpers only.
They render status and rows already produced by the shell view-model; they do
not parse G-code, execute action plans, or implement CNC semantics.

View File

@@ -5,3 +5,91 @@ export {
planIniFileContextStaging,
planSimConfigStaging,
} from "./sim-config-staging.js";
export {
defaultMachinePaths,
gcodeProgramPath,
machineIniPath,
machineRoot,
normalizeOpfsPath,
opfsPath,
parameterFilePath,
previewCachePath,
sessionSnapshotPath,
splitOpfsPath,
toolTablePath,
} from "../../opfs/path-model.js";
export {
ensureParentDir,
getOpfsRoot,
loadTextFile,
saveTextFile,
} from "../../opfs/file-service.js";
export {
createMachineSessionSnapshotPayload,
createSessionSnapshot,
loadMachineSessionSnapshot,
loadSessionSnapshot,
saveMachineSessionSnapshot,
saveSessionSnapshot,
validateSessionSnapshot,
} from "../../opfs/snapshot-store.js";
export {
gcodeFilenameFromProgramPath,
loadGcodeProgram,
loadMachineTextFiles,
machineFilePaths,
saveGcodeProgram,
saveMachineTextFiles,
} from "../../opfs/machine-file-store.js";
export {
restoreMachineParametersFromOpfs,
saveMachineParametersToOpfs,
} from "../../opfs/linuxcnc-parameter-bridge.js";
export {
loadMachineToolTableFromOpfs,
saveMachineToolTableToOpfs,
} from "../../opfs/linuxcnc-tool-table-bridge.js";
export { loadMachineSessionFromOpfs } from "../../opfs/linuxcnc-machine-session-bridge.js";
export {
createIniPanelLaunchApiManifest,
createIniPanelLaunchApiSchema,
createIniPanelShellIntegrationManifest,
createIniPanelShellIntegrationReadiness,
createIniPanelShellIntegrationSchema,
createIniPanelShellIntegrationWorkflowPlan,
createIniPanelShellSessionHandoffCompatibilityReport,
createIniPanelShellSessionHandoffPackage,
createIniPanelShellSessionHandoffPackageMountDisplayViewModel,
createIniPanelShellSessionHandoffPackageMountRenderState,
createIniPanelShellSessionHandoffPackageMountState,
createIniPanelShellSessionHandoffPackageReport,
createIniPanelShellSessionHandoffPackageRenderState,
createIniPanelShellSessionHandoffPackageSchema,
createIniPanelShellSessionHandoffSummary,
createIniPanelShellSessionHandoffSummarySchema,
createIniPanelShellViewModel,
createIniPanelShellWorkflowOverviewContract,
createIniPanelShellWorkflowOverviewEmbeddingDisplayViewModel,
createIniPanelShellWorkflowOverviewEmbeddingDomContract,
createIniPanelShellWorkflowOverviewEmbeddingDomReadiness,
createIniPanelShellWorkflowOverviewEmbeddingMountDisplayViewModel,
createIniPanelShellWorkflowOverviewEmbeddingMountDomContract,
createIniPanelShellWorkflowOverviewEmbeddingMountDomReadiness,
createIniPanelShellWorkflowOverviewEmbeddingMountRenderState,
createIniPanelShellWorkflowOverviewEmbeddingRenderState,
createIniPanelShellWorkflowOverviewEmbeddingReport,
createIniPanelShellWorkflowOverviewReadiness,
isSupportedIniPanelLaunchApiManifest,
isSupportedIniPanelShellIntegrationManifest,
isSupportedIniPanelShellSessionHandoffPackage,
isSupportedIniPanelShellSessionHandoffSummary,
mountIniPanelShellSessionHandoff,
mountIniPanelShellWorkflowOverviewEmbedding,
mountIniPanelShellWorkflowOverviewEmbeddingMountState,
mountIniPanelShellWorkflowOverviewEmbeddingState,
renderIniPanelShellSessionHandoffMountState,
renderIniPanelShellWorkflowOverviewEmbeddingMountState,
renderIniPanelShellWorkflowOverviewEmbeddingState,
} from "../../ui/ini-panel/ui-shell.js";