pi-mega-compact 0.20.74 → 0.20.76
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.
- package/dist/config/vector-cortex-enc2c.js +9 -6
- package/dist/extensions/dashboard-server/api-contracts/setup-cortex-native-ort.js +5 -3
- package/dist/extensions/dashboard-server/routes-rag-settings-vector-cortex.js +1 -1
- package/dist/extensions/dashboard-server/setup-cortex-actions-native-ort.js +176 -49
- package/dist/src/config/vector-cortex-enc2c.js +9 -6
- package/dist/src/vector-cortex/encoder/native-qualify-retest.js +9 -5
- package/dist/src/vector-cortex/setup-cortex-blockers-compute.js +5 -3
- package/dist/vector-cortex/encoder/native-qualify-retest.js +9 -5
- package/dist/vector-cortex/setup-cortex-blockers-compute.js +5 -3
- package/extensions/dashboard-client/dist/assets/{AdminTab-CqhIxrlT.js → AdminTab-B8JqsA41.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{AdminTab-CqhIxrlT.js.map → AdminTab-B8JqsA41.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{AreaChart-D4EY7yiY.js → AreaChart-CeaexvWO.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{AreaChart-D4EY7yiY.js.map → AreaChart-CeaexvWO.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{BarChart-r_BFpd7a.js → BarChart-Bhyviy7_.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{BarChart-r_BFpd7a.js.map → BarChart-Bhyviy7_.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{CacheTab-Bf5rwce6.js → CacheTab-C6bFdEHq.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{CacheTab-Bf5rwce6.js.map → CacheTab-C6bFdEHq.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{ConfigTab-RFUXAUIP.js → ConfigTab-CbsdI5yj.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{ConfigTab-RFUXAUIP.js.map → ConfigTab-CbsdI5yj.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{EventsTab-DEqHbSHf.js → EventsTab-kvB5Znx2.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{EventsTab-DEqHbSHf.js.map → EventsTab-kvB5Znx2.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{HealthTab-WGEwtqmO.js → HealthTab-DqEUk5LW.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{HealthTab-WGEwtqmO.js.map → HealthTab-DqEUk5LW.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-ClT1D4P9.js → MaintenanceTab-CS5HqDkY.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-ClT1D4P9.js.map → MaintenanceTab-CS5HqDkY.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-DaAxLJ5x.js → MemoryMapTab-Oq-iqvUq.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-DaAxLJ5x.js.map → MemoryMapTab-Oq-iqvUq.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MetricsCards-CprVx2Yq.js → MetricsCards-36RVmtPj.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MetricsCards-CprVx2Yq.js.map → MetricsCards-36RVmtPj.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/MetricsTab-Clkcniuo.js +2 -0
- package/extensions/dashboard-client/dist/assets/{MetricsTab-8WBHRpRp.js.map → MetricsTab-Clkcniuo.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{OverviewTab-C5ClXheK.js → OverviewTab-Cl2Zx7r1.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{OverviewTab-C5ClXheK.js.map → OverviewTab-Cl2Zx7r1.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{ReposTab-BOX5sOBg.js → ReposTab-DUoDgjk-.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{ReposTab-BOX5sOBg.js.map → ReposTab-DUoDgjk-.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SessionsTab-DKUO5gCp.js → SessionsTab-hEQ_OAfB.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SessionsTab-DKUO5gCp.js.map → SessionsTab-hEQ_OAfB.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SetupTab-CeeRk5Rd.js → SetupTab-Bqibg0cD.js} +3 -3
- package/extensions/dashboard-client/dist/assets/SetupTab-Bqibg0cD.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-Dlhljae9.js → TimeSavedCard-9QMQUc7L.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-Dlhljae9.js.map → TimeSavedCard-9QMQUc7L.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TurnMemoryView-B8fWymMP.js → TurnMemoryView-DAfqhJqd.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TurnMemoryView-B8fWymMP.js.map → TurnMemoryView-DAfqhJqd.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/TurnsTab-C-uZNH2F.js +2 -0
- package/extensions/dashboard-client/dist/assets/{TurnsTab-kJ4sfWSd.js.map → TurnsTab-C-uZNH2F.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{VcStatusBadge-FJZlkrD7.js → VcStatusBadge-DyOagOVb.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{VcStatusBadge-FJZlkrD7.js.map → VcStatusBadge-DyOagOVb.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{VectorCortexTab-C1iE6z4c.js → VectorCortexTab-BxsbSUGv.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{VectorCortexTab-C1iE6z4c.js.map → VectorCortexTab-BxsbSUGv.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{WikiTab-BXqRiTbt.js → WikiTab-CjefloQb.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{WikiTab-BXqRiTbt.js.map → WikiTab-CjefloQb.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{button-CUeN3VyF.js → button-D-9nb4Bw.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{button-CUeN3VyF.js.map → button-D-9nb4Bw.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{card-DtOD33bZ.js → card-Dvl16_R5.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{card-DtOD33bZ.js.map → card-Dvl16_R5.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{client-extra-_tIKSPZ3.js → client-extra-BShDrG99.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{client-extra-_tIKSPZ3.js.map → client-extra-BShDrG99.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-8AyWGIrK.js → generateCategoricalChart-Q_V4fqVi.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-8AyWGIrK.js.map → generateCategoricalChart-Q_V4fqVi.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{index-BBJ8LglL.js → index-CL6Af_JZ.js} +3 -3
- package/extensions/dashboard-client/dist/assets/{index-BBJ8LglL.js.map → index-CL6Af_JZ.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{switch-Drm0yRgr.js → switch-0MNUTR9I.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{switch-Drm0yRgr.js.map → switch-0MNUTR9I.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{toggle-DnRtZDPW.js → toggle-DHbWo-CW.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{toggle-DnRtZDPW.js.map → toggle-DHbWo-CW.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{useSSE-l_bpRt_v.js → useSSE-DcBpzKtI.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{useSSE-l_bpRt_v.js.map → useSSE-DcBpzKtI.js.map} +1 -1
- package/extensions/dashboard-client/dist/index.html +1 -1
- package/extensions/dashboard-client/src/tabs/SetupTab/CortexActionsCard.tsx +15 -7
- package/extensions/dashboard-client/src/tabs/SetupTab/CortexRetestCard.tsx +11 -1
- package/extensions/dashboard-client/src/tabs/SetupTab/CortexRuntimeCard.tsx +1 -1
- package/extensions/dashboard-server/api-contracts/setup-cortex-native-ort.ts +5 -3
- package/extensions/dashboard-server/routes-rag-settings-vector-cortex.ts +1 -1
- package/extensions/dashboard-server/setup-cortex-actions-native-ort.ts +203 -51
- package/package.json +1 -1
- package/src/config/vector-cortex-enc2c.ts +9 -6
- package/src/vector-cortex/encoder/native-qualify-retest.ts +9 -5
- package/src/vector-cortex/setup-cortex-blockers-compute.ts +5 -3
- package/extensions/dashboard-client/dist/assets/MetricsTab-8WBHRpRp.js +0 -2
- package/extensions/dashboard-client/dist/assets/SetupTab-CeeRk5Rd.js.map +0 -1
- package/extensions/dashboard-client/dist/assets/TurnsTab-kJ4sfWSd.js +0 -2
|
@@ -5,48 +5,99 @@
|
|
|
5
5
|
* Sibling of setup-cortex-actions.ts (which stays under the 300-line source soft
|
|
6
6
|
* cap). Implements the mechanics behind the VC9B `install-native-ort` action:
|
|
7
7
|
*
|
|
8
|
-
* 1.
|
|
9
|
-
*
|
|
10
|
-
* 2.
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* 4.
|
|
15
|
-
*
|
|
16
|
-
*
|
|
8
|
+
* 1. compute the install root (`MEGACOMPACT_NATIVE_ORT_ROOT` override, else
|
|
9
|
+
* default ~/.pi/mega-compact/native-ort);
|
|
10
|
+
* 2. detect the host platform and reject non-installable hosts (ENC-0e);
|
|
11
|
+
* 3. fetch the pinned onnxruntime-node tarball via the operator's npm and
|
|
12
|
+
* verify its sha256 BEFORE install (the tarball never lands in the final
|
|
13
|
+
* prefix until the pinned sha matches);
|
|
14
|
+
* 4. `npm install --prefix <root> <tarball>` from the VERIFIED local tarball;
|
|
15
|
+
* 5. write a small `.enc2a-marker.json` marker ({platform, version, sha256})
|
|
16
|
+
* the ENC-2a version probe reads;
|
|
17
|
+
* 6. REGARDLESS of install exit code, re-qualify the binding via the ENC-2b
|
|
18
|
+
* retest path (`runNativeRetest`) and surface the fresh result + effective
|
|
19
|
+
* backend.
|
|
17
20
|
*
|
|
18
21
|
* PREVENT-PI-004 banner: this is an OPT-IN, confirm-gated, npm-delegated local
|
|
19
22
|
* subprocess of a committed repo script. It performs no network I/O in this
|
|
20
23
|
* module and carries NO URL literals (the codebase-wide no-URL-literal scan
|
|
21
24
|
* covers src/ + extensions/).
|
|
22
25
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
26
|
+
* In-process port of scripts/encoder/install-native-ort.mjs: the npm package
|
|
27
|
+
* ships src/ + dist/ + extensions/ but NOT scripts/, so the dashboard button on
|
|
28
|
+
* an installed device has no checkout script to spawn — porting the install
|
|
29
|
+
* logic here keeps the action working independent of the checkout layout.
|
|
30
|
+
*
|
|
31
|
+
* Guardrails: PREVENT-011 (no `any`); PREVENT-PI-004 (npm-delegated local
|
|
32
|
+
* subprocess; guardrails-allow below).
|
|
25
33
|
*/
|
|
26
34
|
|
|
27
|
-
import { spawnSync } from "node:child_process"; // guardrails-allow PREVENT-PI-004: opt-in, confirm-gated, npm-delegated install subprocess (local spawn of committed
|
|
28
|
-
import {
|
|
35
|
+
import { spawnSync } from "node:child_process"; // guardrails-allow PREVENT-PI-004: opt-in, confirm-gated, npm-delegated install subprocess (local spawn of committed npm tooling; no URL literals)
|
|
36
|
+
import { createHash } from "node:crypto";
|
|
37
|
+
import { mkdirSync, writeFileSync, existsSync, rmSync, readFileSync } from "node:fs";
|
|
29
38
|
import { join, dirname } from "node:path";
|
|
30
39
|
import { fileURLToPath } from "node:url";
|
|
31
40
|
import { runNativeRetest } from "../../src/vector-cortex/encoder/native-qualify-retest.js";
|
|
41
|
+
import {
|
|
42
|
+
NATIVE_ORT_PACKAGE,
|
|
43
|
+
NATIVE_ORT_TARBALL_SHA256,
|
|
44
|
+
NATIVE_ORT_VERSION,
|
|
45
|
+
NATIVE_ORT_INSTALLABLE_PLATFORMS,
|
|
46
|
+
type EncoderPlatform,
|
|
47
|
+
} from "../../src/vector-cortex/encoder/native-install-artifacts.js";
|
|
32
48
|
import type {
|
|
33
49
|
SetupCortexActionResultWithNativeOrt,
|
|
34
50
|
NativeOrtRetestResult,
|
|
35
51
|
} from "./api-contracts/setup-cortex-native-ort.js";
|
|
36
52
|
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
/** Candidate install roots: `MEGACOMPACT_NATIVE_ORT_ROOT` override first
|
|
54
|
+
* (ENC-2a parity + test isolation), else the default `~/.pi/mega-compact/
|
|
55
|
+
* native-ort/`. */
|
|
56
|
+
function nativeOrtDir(): string {
|
|
57
|
+
const override = process.env.MEGACOMPACT_NATIVE_ORT_ROOT;
|
|
58
|
+
if (override !== undefined && override.length > 0) return override;
|
|
59
|
+
return join(process.env.HOME ?? "", ".pi", "mega-compact", "native-ort");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Resolve the host to an installable EncoderPlatform string. darwin-x64 is
|
|
63
|
+
* UNSUPPORTED (no native binding upstream — arm64-only since 1.17) and
|
|
64
|
+
* unknown platforms also fail → the caller surfaces a clear failure. */
|
|
65
|
+
function hostPlatform(): EncoderPlatform | null {
|
|
66
|
+
const plat =
|
|
67
|
+
process.platform === "win32"
|
|
68
|
+
? "win32"
|
|
69
|
+
: process.platform === "darwin"
|
|
70
|
+
? "darwin"
|
|
71
|
+
: process.platform === "linux"
|
|
72
|
+
? "linux"
|
|
73
|
+
: "";
|
|
74
|
+
const arch = process.arch === "x64" ? "x64" : process.arch === "arm64" ? "arm64" : "";
|
|
75
|
+
const candidate = `${plat}-${arch}` as EncoderPlatform;
|
|
76
|
+
if (candidate === "darwin-x64") return null; // no native binding upstream
|
|
77
|
+
if (!NATIVE_ORT_INSTALLABLE_PLATFORMS.includes(candidate)) return null;
|
|
78
|
+
return candidate;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** sha256 digest of a file on disk. Local FS read (loopback). */
|
|
82
|
+
function sha256File(path: string): string {
|
|
83
|
+
// guardrails-allow PREVENT-PI-004: local file hash (loopback)
|
|
84
|
+
return createHash("sha256").update(readFileSync(path)).digest("hex");
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Write the small `.enc2a-marker.json` marker the ENC-2a version probe reads. */
|
|
88
|
+
function writeMarker(root: string, platform: EncoderPlatform): void {
|
|
89
|
+
const marker = {
|
|
90
|
+
platform,
|
|
91
|
+
version: NATIVE_ORT_VERSION,
|
|
92
|
+
installedAt: new Date().toISOString(),
|
|
93
|
+
sha256: NATIVE_ORT_TARBALL_SHA256,
|
|
94
|
+
};
|
|
95
|
+
// guardrails-allow PREVENT-PI-004: local marker write (loopback)
|
|
96
|
+
writeFileSync(
|
|
97
|
+
join(root, ".enc2a-marker.json"),
|
|
98
|
+
JSON.stringify(marker, null, 2) + "\n",
|
|
99
|
+
"utf8",
|
|
100
|
+
);
|
|
50
101
|
}
|
|
51
102
|
|
|
52
103
|
/** Ensure the vc9b log dir exists (mirrors setup-cortex-actions.ts). */
|
|
@@ -62,18 +113,38 @@ function writeLog(logPath: string, body: string): void {
|
|
|
62
113
|
writeFileSync(logPath, body, "utf8");
|
|
63
114
|
}
|
|
64
115
|
|
|
116
|
+
/** The original committed-install-script path lookup, kept for the unit test
|
|
117
|
+
* that proves the committed scripts/encoder/install-native-ort.mjs lives on
|
|
118
|
+
* disk in a checkout. The install action itself no longer spawns that script
|
|
119
|
+
* (in-process port), but the suite would otherwise need to lose that
|
|
120
|
+
* verification. */
|
|
121
|
+
export function installScriptPath(): string | null {
|
|
122
|
+
let dir = dirname(fileURLToPath(import.meta.url));
|
|
123
|
+
const rel = join("scripts", "encoder", "install-native-ort.mjs");
|
|
124
|
+
for (let i = 0; i < 8; i++) {
|
|
125
|
+
const candidate = join(dir, rel);
|
|
126
|
+
// guardrails-allow PREVENT-PI-004: local repo filesystem read (loopback)
|
|
127
|
+
if (existsSync(candidate)) return candidate;
|
|
128
|
+
const next = dirname(dir);
|
|
129
|
+
if (next === dir) break;
|
|
130
|
+
dir = next;
|
|
131
|
+
}
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
|
|
65
135
|
/**
|
|
66
|
-
* Run the ENC-2c lazy-download native onnxruntime INSTALL action.
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
136
|
+
* Run the ENC-2c lazy-download native onnxruntime INSTALL action. Fetches the
|
|
137
|
+
* pinned tarball via the operator's npm, verifies its sha256, installs into
|
|
138
|
+
* `nativeOrtDir()`, then ALWAYS runs the ENC-2b retest to re-qualify the
|
|
139
|
+
* binding and surfacing the fresh result.
|
|
70
140
|
*
|
|
71
|
-
* Never throws:
|
|
72
|
-
* result; the retest runs even on install failure
|
|
73
|
-
* post-install qualification state. Returns a
|
|
74
|
-
* with the ENC-2c additive fields (present
|
|
141
|
+
* Never throws: every failure (host platform, npm failure, hash mismatch)
|
|
142
|
+
* surfaces as ok=false on the result; the retest runs even on install failure
|
|
143
|
+
* so the operator sees the post-install qualification state. Returns a
|
|
144
|
+
* combined SetupCortexActionResult with the ENC-2c additive fields (present
|
|
145
|
+
* only for pendant actions).
|
|
75
146
|
*/
|
|
76
|
-
// guardrails-allow PREVENT-PI-004: opt-in, confirm-gated, npm-delegated install action (subprocess of committed
|
|
147
|
+
// guardrails-allow PREVENT-PI-004: opt-in, confirm-gated, npm-delegated install action (subprocess of committed npm tooling; no URL literals)
|
|
77
148
|
export async function runInstallNativeOrt(
|
|
78
149
|
stateDir: string,
|
|
79
150
|
): Promise<SetupCortexActionResultWithNativeOrt> {
|
|
@@ -81,41 +152,122 @@ export async function runInstallNativeOrt(
|
|
|
81
152
|
const logName = `install-native-ort-${ts}.log`;
|
|
82
153
|
const logPath = join(ensureLogDir(stateDir), logName);
|
|
83
154
|
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
155
|
+
const root = nativeOrtDir();
|
|
156
|
+
const platform = hostPlatform();
|
|
157
|
+
if (platform === null) {
|
|
158
|
+
writeLog(logPath, "install-native-ort: host platform has no native binding\n");
|
|
87
159
|
return {
|
|
88
160
|
action: "install-native-ort",
|
|
89
161
|
ok: false,
|
|
90
162
|
exitCode: null,
|
|
91
163
|
logPath,
|
|
92
164
|
logName,
|
|
165
|
+
spawned: false,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Step 1: derive the tarball URL + fetch the tarball via the operator's npm.
|
|
170
|
+
// (The tarball never lands in the final prefix until the pinned sha matches.)
|
|
171
|
+
mkdirSync(root, { recursive: true });
|
|
172
|
+
const packedName = `${NATIVE_ORT_PACKAGE}-${NATIVE_ORT_VERSION}.tgz`;
|
|
173
|
+
const packedPath = join(root, packedName);
|
|
174
|
+
let out = "";
|
|
175
|
+
const run = (argv: readonly string[]): { code: number; stdio: string } => {
|
|
176
|
+
const res = spawnSync("npm", argv, { encoding: "utf8", timeout: 60_000 });
|
|
177
|
+
out += [res.stdout, res.stderr].filter(Boolean).join("\n") + "\n";
|
|
178
|
+
return { code: res.status ?? 1, stdio: out };
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// npm pack <pkg>@<ver> --pack-destination <root>
|
|
182
|
+
// guardrails-allow PREVENT-PI-004: npm-delegated tarball fetch (opt-in
|
|
183
|
+
// confirm-gated install action; package@version come from the committed
|
|
184
|
+
// artifacts module, never a literal URL).
|
|
185
|
+
const pack = run([
|
|
186
|
+
"pack",
|
|
187
|
+
`${NATIVE_ORT_PACKAGE}@${NATIVE_ORT_VERSION}`,
|
|
188
|
+
"--pack-destination",
|
|
189
|
+
root,
|
|
190
|
+
]);
|
|
191
|
+
if (pack.code !== 0 || !existsSync(packedPath)) {
|
|
192
|
+
writeLog(logPath, `${out}npm pack failed — could not download tarball\n`);
|
|
193
|
+
const retest: NativeOrtRetestResult | null = await runNativeRetest(stateDir);
|
|
194
|
+
return {
|
|
195
|
+
action: "install-native-ort",
|
|
196
|
+
ok: false,
|
|
197
|
+
exitCode: pack.code,
|
|
198
|
+
logPath,
|
|
199
|
+
logName,
|
|
93
200
|
spawned: true,
|
|
201
|
+
nativeOrtRetestResult: retest,
|
|
202
|
+
nativeOrtBackendEffective:
|
|
203
|
+
retest !== null && retest.verdict === "qualified" ? "native" : "wasm",
|
|
94
204
|
};
|
|
95
205
|
}
|
|
96
206
|
|
|
97
|
-
//
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
207
|
+
// Step 2: verify sha256 BEFORE install.
|
|
208
|
+
const actual = sha256File(packedPath);
|
|
209
|
+
if (actual !== NATIVE_ORT_TARBALL_SHA256) {
|
|
210
|
+
writeLog(
|
|
211
|
+
logPath,
|
|
212
|
+
`${out}sha256 mismatch — expected ${NATIVE_ORT_TARBALL_SHA256}, got ${actual}\n`,
|
|
213
|
+
);
|
|
214
|
+
// guardrails-allow PREVENT-PI-004: removing a tarball we just wrote (local FS)
|
|
215
|
+
rmSync(packedPath, { force: true });
|
|
216
|
+
const retest: NativeOrtRetestResult | null = await runNativeRetest(stateDir);
|
|
217
|
+
return {
|
|
218
|
+
action: "install-native-ort",
|
|
219
|
+
ok: false,
|
|
220
|
+
exitCode: 1,
|
|
221
|
+
logPath,
|
|
222
|
+
logName,
|
|
223
|
+
spawned: true,
|
|
224
|
+
nativeOrtRetestResult: retest,
|
|
225
|
+
nativeOrtBackendEffective:
|
|
226
|
+
retest !== null && retest.verdict === "qualified" ? "native" : "wasm",
|
|
227
|
+
};
|
|
228
|
+
}
|
|
103
229
|
|
|
104
|
-
|
|
105
|
-
|
|
230
|
+
// Step 3: install from the VERIFIED local tarball (npm install --prefix).
|
|
231
|
+
// guardrails-allow PREVENT-PI-004: npm-delegated install from a local tarball
|
|
232
|
+
// (opt-in confirm-gated install action).
|
|
233
|
+
const install = run(["install", "--prefix", root, packedPath]);
|
|
234
|
+
// guardrails-allow PREVENT-PI-004: removing the local tarball after install
|
|
235
|
+
rmSync(packedPath, { force: true });
|
|
106
236
|
|
|
107
|
-
|
|
108
|
-
|
|
237
|
+
const installedPkg = join(root, "node_modules", NATIVE_ORT_PACKAGE, "package.json");
|
|
238
|
+
if (install.code !== 0 || !existsSync(installedPkg)) {
|
|
239
|
+
writeLog(logPath, `${out}npm install from verified tarball failed\n`);
|
|
240
|
+
const retest: NativeOrtRetestResult | null = await runNativeRetest(stateDir);
|
|
241
|
+
return {
|
|
242
|
+
action: "install-native-ort",
|
|
243
|
+
ok: false,
|
|
244
|
+
exitCode: install.code,
|
|
245
|
+
logPath,
|
|
246
|
+
logName,
|
|
247
|
+
spawned: true,
|
|
248
|
+
nativeOrtRetestResult: retest,
|
|
249
|
+
nativeOrtBackendEffective:
|
|
250
|
+
retest !== null && retest.verdict === "qualified" ? "native" : "wasm",
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// Step 4: success — write the marker, log, then retest.
|
|
255
|
+
writeMarker(root, platform);
|
|
256
|
+
writeLog(
|
|
257
|
+
logPath,
|
|
258
|
+
`${out}installed ${NATIVE_ORT_PACKAGE}@${NATIVE_ORT_VERSION} (${platform}); sha256 verified + marker written.\n`,
|
|
259
|
+
);
|
|
109
260
|
const retest: NativeOrtRetestResult | null = await runNativeRetest(stateDir);
|
|
110
261
|
|
|
111
262
|
return {
|
|
112
263
|
action: "install-native-ort",
|
|
113
|
-
ok:
|
|
114
|
-
exitCode:
|
|
264
|
+
ok: true,
|
|
265
|
+
exitCode: install.code,
|
|
115
266
|
logPath,
|
|
116
267
|
logName,
|
|
117
268
|
spawned: true,
|
|
118
269
|
nativeOrtRetestResult: retest,
|
|
119
|
-
nativeOrtBackendEffective:
|
|
270
|
+
nativeOrtBackendEffective:
|
|
271
|
+
retest !== null && retest.verdict === "qualified" ? "native" : "wasm",
|
|
120
272
|
};
|
|
121
273
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-mega-compact",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.76",
|
|
4
4
|
"description": "Layered, local, vector-backed context compressor for pi — supersede/collapse/cluster compaction with deduped inline recall.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
@@ -9,12 +9,15 @@
|
|
|
9
9
|
*
|
|
10
10
|
* ENC-2c turns ENC-2a's operator run-script assist into a dashboard action: the
|
|
11
11
|
* Setup Cortex sub-tab gains an "Install Native ORT" button that, when confirmed
|
|
12
|
-
* by the operator,
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
12
|
+
* by the operator, performs the pinned-tarball fetch + sha256 verify + npm
|
|
13
|
+
* install in-process (a TypeScript port of
|
|
14
|
+
* `scripts/encoder/install-native-ort.mjs` — the npm package ships
|
|
15
|
+
* src/dist/extensions but NOT scripts/, so an installed device has no checkout
|
|
16
|
+
* script to spawn), then re-qualifies the binding via the ENC-2b retest path.
|
|
17
|
+
* This is a PREVENT-PI-004 opt-in exemption: it is confirm-gated (never
|
|
18
|
+
* automatic), delegated to the operator's npm as a local subprocess, and carries
|
|
19
|
+
* NO URL literals in src/ or extensions/ (the registry URL + sha256 live only
|
|
20
|
+
* in the artifacts-module constants).
|
|
18
21
|
*
|
|
19
22
|
* `MEGACOMPACT_ENC_2C=0` disables: no install action branch, no UI button, no
|
|
20
23
|
* install-related result fields — byte-identical to the ENC-2b predecessor. The
|
|
@@ -39,12 +39,16 @@ import { NATIVE_ORT_PACKAGE, type EncoderPlatform } from "./native-install-artif
|
|
|
39
39
|
|
|
40
40
|
/** Candidate ONNX runtime native-ort prefixes. The ENC-2a guide installs to
|
|
41
41
|
* the global `~/.pi/mega-compact/native-ort/`; `stateDir` (per-repo) is a
|
|
42
|
-
* secondary probe root so the retest resolves either install location.
|
|
42
|
+
* secondary probe root so the retest resolves either install location.
|
|
43
|
+
* `MEGACOMPACT_NATIVE_ORT_ROOT` overrides the global root (ENC-2a parity +
|
|
44
|
+
* test isolation — honors the same override the enc2a probe and the ENC-2c
|
|
45
|
+
* in-process installer honor). */
|
|
43
46
|
function nativeOrtRootCandidates(stateDir: string): string[] {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
const override = process.env.MEGACOMPACT_NATIVE_ORT_ROOT;
|
|
48
|
+
const global = override !== undefined && override.length > 0
|
|
49
|
+
? override
|
|
50
|
+
: join(process.env.HOME ?? "", ".pi", "mega-compact", "native-ort");
|
|
51
|
+
return [global, join(stateDir, "native-ort")];
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
/** A single bounded inference pass on the fixed 512-token synthetic input;
|
|
@@ -261,9 +261,11 @@ const ACTION_GATE_CANDIDATES: Readonly<Record<SetupCortexActionKind, readonly st
|
|
|
261
261
|
// behavior change. HG-7 is training work (no action in this set).
|
|
262
262
|
bench: ["HG-1", "HG-3", "HG-6"],
|
|
263
263
|
"verify-asset": [],
|
|
264
|
-
//
|
|
265
|
-
//
|
|
266
|
-
|
|
264
|
+
// install-native-ort is NEVER gated by HG-3: the action's entire purpose is
|
|
265
|
+
// to install the binding that closes HG-3. Gating it would deadlock — you
|
|
266
|
+
// can't install the binding that closes the gate because the gate blocks the
|
|
267
|
+
// install. HG-3 closes when the install succeeds (the probe detects it).
|
|
268
|
+
"install-native-ort": [],
|
|
267
269
|
};
|
|
268
270
|
|
|
269
271
|
/**
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./index-BBJ8LglL.js";import{M as t}from"./MetricsCards-CprVx2Yq.js";import"./card-DtOD33bZ.js";import"./generateCategoricalChart-8AyWGIrK.js";import"./BarChart-r_BFpd7a.js";import"./AreaChart-D4EY7yiY.js";function e(){return r.jsx(t,{})}export{e as default};
|
|
2
|
-
//# sourceMappingURL=MetricsTab-8WBHRpRp.js.map
|