vana-cli 0.24.5 → 0.25.0
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/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +91 -12
- package/dist/cli/index.js.map +1 -1
- package/dist/connectors/registry.d.ts +2 -0
- package/dist/connectors/registry.d.ts.map +1 -1
- package/dist/connectors/registry.js +18 -2
- package/dist/connectors/registry.js.map +1 -1
- package/dist/core/cli-types.d.ts +44 -0
- package/dist/core/cli-types.d.ts.map +1 -1
- package/dist/core/cli-types.js +14 -0
- package/dist/core/cli-types.js.map +1 -1
- package/dist/core/state-store.d.ts +6 -0
- package/dist/core/state-store.d.ts.map +1 -1
- package/dist/core/state-store.js.map +1 -1
- package/dist/pdpp/host.d.ts +66 -0
- package/dist/pdpp/host.d.ts.map +1 -0
- package/dist/pdpp/host.js +283 -0
- package/dist/pdpp/host.js.map +1 -0
- package/dist/pdpp/installer.d.ts +17 -0
- package/dist/pdpp/installer.d.ts.map +1 -0
- package/dist/pdpp/installer.js +117 -0
- package/dist/pdpp/installer.js.map +1 -0
- package/dist/pdpp/local.d.ts +14 -0
- package/dist/pdpp/local.d.ts.map +1 -0
- package/dist/pdpp/local.js +76 -0
- package/dist/pdpp/local.js.map +1 -0
- package/dist/pdpp/pins.d.ts +23 -0
- package/dist/pdpp/pins.d.ts.map +1 -0
- package/dist/pdpp/pins.js +18 -0
- package/dist/pdpp/pins.js.map +1 -0
- package/dist/pdpp/profile.d.ts +49 -0
- package/dist/pdpp/profile.d.ts.map +1 -0
- package/dist/pdpp/profile.js +17 -0
- package/dist/pdpp/profile.js.map +1 -0
- package/dist/pdpp/protocol.d.ts +79 -0
- package/dist/pdpp/protocol.d.ts.map +1 -0
- package/dist/pdpp/protocol.js +372 -0
- package/dist/pdpp/protocol.js.map +1 -0
- package/dist/pdpp/runtime.d.ts +43 -0
- package/dist/pdpp/runtime.d.ts.map +1 -0
- package/dist/pdpp/runtime.js +387 -0
- package/dist/pdpp/runtime.js.map +1 -0
- package/dist/pdpp/store.d.ts +43 -0
- package/dist/pdpp/store.d.ts.map +1 -0
- package/dist/pdpp/store.js +100 -0
- package/dist/pdpp/store.js.map +1 -0
- package/dist/runtime/core/contracts.d.ts +2 -0
- package/dist/runtime/core/contracts.d.ts.map +1 -1
- package/dist/runtime/managed-playwright.d.ts +7 -0
- package/dist/runtime/managed-playwright.d.ts.map +1 -1
- package/dist/runtime/managed-playwright.js +7 -0
- package/dist/runtime/managed-playwright.js.map +1 -1
- package/dist/vendor/pdpp-connector-manager/LICENSE +202 -0
- package/dist/vendor/pdpp-connector-manager/NOTICE +2 -0
- package/dist/vendor/pdpp-connector-manager/VENDOR.md +27 -0
- package/dist/vendor/pdpp-connector-manager/catalog-schema-data.mjs +168 -0
- package/dist/vendor/pdpp-connector-manager/catalog-schema.mjs +62 -0
- package/dist/vendor/pdpp-connector-manager/index.d.mts +49 -0
- package/dist/vendor/pdpp-connector-manager/index.mjs +1646 -0
- package/dist/vendor/pdpp-connector-manager/oci-catalog.mjs +93 -0
- package/dist/vendor/pdpp-connector-manager/oci-registry.mjs +1002 -0
- package/dist/vendor/pdpp-connector-manager/oci-verify.mjs +515 -0
- package/dist/vendor/pdpp-connector-manager/package.json +51 -0
- package/dist/vendor/pdpp-connector-manager/retry.mjs +142 -0
- package/dist/vendor/pdpp-connector-manager/tar-stream.mjs +685 -0
- package/package.json +7 -2
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import fsp from "node:fs/promises";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { execFile, execFileSync } from "node:child_process";
|
|
7
|
+
import { createRequire } from "node:module";
|
|
8
|
+
import { promisify } from "node:util";
|
|
9
|
+
import * as tar from "tar";
|
|
10
|
+
import { getVanaHome } from "../core/paths.js";
|
|
11
|
+
import { getSystemChromePath } from "../runtime/playwright/index.js";
|
|
12
|
+
const execFileAsync = promisify(execFile);
|
|
13
|
+
const require = createRequire(import.meta.url);
|
|
14
|
+
/** Everything the CLI keeps for Collection Profile connectors. */
|
|
15
|
+
export function getPdppHome() {
|
|
16
|
+
return path.join(getVanaHome(), "pdpp");
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The Node release installed when no compatible one is found. It matches the
|
|
20
|
+
* runtime Vana Desktop bundles, and the checksums are the official
|
|
21
|
+
* SHASUMS256.txt values, so a download is checked against a hash that
|
|
22
|
+
* shipped with the CLI rather than one fetched next to the tarball.
|
|
23
|
+
*/
|
|
24
|
+
export const PDPP_NODE_VERSION = "24.21.0";
|
|
25
|
+
const PDPP_NODE_SHA256 = {
|
|
26
|
+
"darwin-arm64": "bed7eea5325e1108f32ce5228ddd6a5f0f08a499ee42aa7442aea583702f6057",
|
|
27
|
+
"darwin-x64": "1462cb3b3046b815cf8ea436d3da450ec1a9f11dac7e5a46b0ada5305d7e8097",
|
|
28
|
+
"linux-arm64": "724282c3b43aec998aa9527380465b45d229e021b58035f5f4f63095eabfe5d5",
|
|
29
|
+
"linux-x64": "6e1db87ef58b8819e5d5402eff1536491b18edd8eb7bee5ef7897876e88dc5ff",
|
|
30
|
+
};
|
|
31
|
+
function parseVersion(value) {
|
|
32
|
+
const match = /^v?(\d+)(?:\.(\d+))?(?:\.(\d+))?$/.exec(value.trim());
|
|
33
|
+
if (!match)
|
|
34
|
+
return null;
|
|
35
|
+
return [Number(match[1]), Number(match[2] ?? 0), Number(match[3] ?? 0)];
|
|
36
|
+
}
|
|
37
|
+
function compareVersions(left, right) {
|
|
38
|
+
for (let index = 0; index < 3; index += 1) {
|
|
39
|
+
const difference = left[index] - right[index];
|
|
40
|
+
if (difference !== 0)
|
|
41
|
+
return difference;
|
|
42
|
+
}
|
|
43
|
+
return 0;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Whether `version` satisfies a space-separated comparator range such as
|
|
47
|
+
* `>=24.15.0 <25`, the only form artifact provenance uses. Anything the
|
|
48
|
+
* parser does not understand fails closed.
|
|
49
|
+
*/
|
|
50
|
+
export function satisfiesNodeRange(version, range) {
|
|
51
|
+
const actual = parseVersion(version);
|
|
52
|
+
if (!actual)
|
|
53
|
+
return false;
|
|
54
|
+
const comparators = range.trim().split(/\s+/).filter(Boolean);
|
|
55
|
+
if (comparators.length === 0)
|
|
56
|
+
return false;
|
|
57
|
+
return comparators.every((comparator) => {
|
|
58
|
+
const match = /^(>=|<=|>|<|=)?(.+)$/.exec(comparator);
|
|
59
|
+
const bound = match ? parseVersion(match[2]) : null;
|
|
60
|
+
if (!match || !bound)
|
|
61
|
+
return false;
|
|
62
|
+
const order = compareVersions(actual, bound);
|
|
63
|
+
switch (match[1] ?? "=") {
|
|
64
|
+
case ">=":
|
|
65
|
+
return order >= 0;
|
|
66
|
+
case "<=":
|
|
67
|
+
return order <= 0;
|
|
68
|
+
case ">":
|
|
69
|
+
return order > 0;
|
|
70
|
+
case "<":
|
|
71
|
+
return order < 0;
|
|
72
|
+
default:
|
|
73
|
+
return order === 0;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
async function readNodeVersion(binary) {
|
|
78
|
+
try {
|
|
79
|
+
const { stdout } = await execFileAsync(binary, ["--version"], {
|
|
80
|
+
timeout: 10_000,
|
|
81
|
+
windowsHide: true,
|
|
82
|
+
});
|
|
83
|
+
// A standalone vana binary answers --version with its own version, which
|
|
84
|
+
// parses but is not a Node release; only a `v`-prefixed line is Node.
|
|
85
|
+
const line = stdout.trim();
|
|
86
|
+
return /^v\d+\.\d+\.\d+$/.test(line) ? line.slice(1) : null;
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function nodeBinaryName() {
|
|
93
|
+
return process.platform === "win32" ? "node.exe" : "node";
|
|
94
|
+
}
|
|
95
|
+
function managedNodeDir() {
|
|
96
|
+
return path.join(getPdppHome(), "node", PDPP_NODE_VERSION);
|
|
97
|
+
}
|
|
98
|
+
function managedNodeBinary() {
|
|
99
|
+
return process.platform === "win32"
|
|
100
|
+
? path.join(managedNodeDir(), nodeBinaryName())
|
|
101
|
+
: path.join(managedNodeDir(), "bin", nodeBinaryName());
|
|
102
|
+
}
|
|
103
|
+
function candidateNodeBinaries() {
|
|
104
|
+
const candidates = [];
|
|
105
|
+
if (process.env.VANA_PDPP_NODE)
|
|
106
|
+
candidates.push(process.env.VANA_PDPP_NODE);
|
|
107
|
+
candidates.push(managedNodeBinary());
|
|
108
|
+
candidates.push(process.execPath);
|
|
109
|
+
for (const dir of (process.env.PATH ?? "").split(path.delimiter)) {
|
|
110
|
+
if (dir)
|
|
111
|
+
candidates.push(path.join(dir, nodeBinaryName()));
|
|
112
|
+
}
|
|
113
|
+
// nvm installs are usually not on PATH for a version other than the
|
|
114
|
+
// current default, which is exactly the version a connector may need.
|
|
115
|
+
const nvmVersions = path.join(process.env.NVM_DIR ?? path.join(os.homedir(), ".nvm"), "versions", "node");
|
|
116
|
+
try {
|
|
117
|
+
for (const entry of fs.readdirSync(nvmVersions).sort().reverse()) {
|
|
118
|
+
candidates.push(path.join(nvmVersions, entry, "bin", nodeBinaryName()));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
// No nvm.
|
|
123
|
+
}
|
|
124
|
+
return [...new Set(candidates.map((candidate) => path.resolve(candidate)))];
|
|
125
|
+
}
|
|
126
|
+
function readNodeVersionSync(binary) {
|
|
127
|
+
try {
|
|
128
|
+
const line = execFileSync(binary, ["--version"], {
|
|
129
|
+
encoding: "utf8",
|
|
130
|
+
timeout: 5_000,
|
|
131
|
+
windowsHide: true,
|
|
132
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
133
|
+
}).trim();
|
|
134
|
+
return /^v\d+\.\d+\.\d+$/.test(line) ? line.slice(1) : null;
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
/** Synchronous {@link findCompatibleNode}, for status checks that cannot await. */
|
|
141
|
+
export function findCompatibleNodeSync(range) {
|
|
142
|
+
for (const candidate of candidateNodeBinaries()) {
|
|
143
|
+
if (!fs.existsSync(candidate))
|
|
144
|
+
continue;
|
|
145
|
+
const version = readNodeVersionSync(candidate);
|
|
146
|
+
if (version && satisfiesNodeRange(version, range)) {
|
|
147
|
+
return { path: candidate, version };
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* A Node binary on this machine that satisfies `range`, or null.
|
|
154
|
+
*
|
|
155
|
+
* `VANA_PDPP_NODE` wins when it satisfies the range; a standalone vana
|
|
156
|
+
* binary's own Node cannot run a script, so every candidate is asked for its
|
|
157
|
+
* version rather than trusted from `process.version`.
|
|
158
|
+
*/
|
|
159
|
+
export async function findCompatibleNode(range) {
|
|
160
|
+
for (const candidate of candidateNodeBinaries()) {
|
|
161
|
+
if (!fs.existsSync(candidate))
|
|
162
|
+
continue;
|
|
163
|
+
const version = await readNodeVersion(candidate);
|
|
164
|
+
if (version && satisfiesNodeRange(version, range)) {
|
|
165
|
+
return { path: candidate, version };
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
/** Whether the pinned Node release this CLI can install satisfies `range`. */
|
|
171
|
+
export function canInstallNodeFor(range) {
|
|
172
|
+
return (satisfiesNodeRange(PDPP_NODE_VERSION, range) &&
|
|
173
|
+
Boolean(PDPP_NODE_SHA256[`${process.platform}-${process.arch}`]));
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Download the pinned Node release into ~/.vana/pdpp/node and check it
|
|
177
|
+
* against the checksum compiled into the CLI before anything is unpacked.
|
|
178
|
+
*/
|
|
179
|
+
export async function installManagedNode(logPath) {
|
|
180
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
181
|
+
const expected = PDPP_NODE_SHA256[platformKey];
|
|
182
|
+
if (!expected) {
|
|
183
|
+
throw new Error(`No Node ${PDPP_NODE_VERSION} build is pinned for ${platformKey}. Install Node 24 yourself and set VANA_PDPP_NODE to its path.`);
|
|
184
|
+
}
|
|
185
|
+
const archiveName = `node-v${PDPP_NODE_VERSION}-${platformKey}.tar.gz`;
|
|
186
|
+
const url = `https://nodejs.org/dist/v${PDPP_NODE_VERSION}/${archiveName}`;
|
|
187
|
+
await fsp.appendFile(logPath, `Downloading ${url}\n`, "utf8");
|
|
188
|
+
const response = await fetch(url, { headers: { "User-Agent": "vana-cli" } });
|
|
189
|
+
if (!response.ok) {
|
|
190
|
+
throw new Error(`Could not download Node ${PDPP_NODE_VERSION}: ${response.status}`);
|
|
191
|
+
}
|
|
192
|
+
const archive = Buffer.from(await response.arrayBuffer());
|
|
193
|
+
const actual = crypto.createHash("sha256").update(archive).digest("hex");
|
|
194
|
+
if (actual !== expected) {
|
|
195
|
+
throw new Error(`Node ${PDPP_NODE_VERSION} download failed its checksum (expected ${expected}, got ${actual}).`);
|
|
196
|
+
}
|
|
197
|
+
const parent = path.dirname(managedNodeDir());
|
|
198
|
+
await fsp.mkdir(parent, { recursive: true });
|
|
199
|
+
const staging = await fsp.mkdtemp(path.join(parent, ".staging-"));
|
|
200
|
+
try {
|
|
201
|
+
const archivePath = path.join(staging, archiveName);
|
|
202
|
+
await fsp.writeFile(archivePath, archive);
|
|
203
|
+
await tar.x({ file: archivePath, cwd: staging, strip: 1 });
|
|
204
|
+
await fsp.rm(archivePath, { force: true });
|
|
205
|
+
await fsp.rm(managedNodeDir(), { recursive: true, force: true });
|
|
206
|
+
await fsp.rename(staging, managedNodeDir());
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
await fsp.rm(staging, { recursive: true, force: true });
|
|
210
|
+
throw error;
|
|
211
|
+
}
|
|
212
|
+
await fsp.appendFile(logPath, `Installed Node into ${managedNodeDir()}\n`, "utf8");
|
|
213
|
+
const version = await readNodeVersion(managedNodeBinary());
|
|
214
|
+
if (!version) {
|
|
215
|
+
throw new Error(`Installed Node at ${managedNodeBinary()} does not run.`);
|
|
216
|
+
}
|
|
217
|
+
return { path: managedNodeBinary(), version };
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Make each host package an artifact declares resolvable from its install
|
|
221
|
+
* root, at exactly the declared version.
|
|
222
|
+
*
|
|
223
|
+
* A signed artifact leaves its browser driver out and loads it by dynamic
|
|
224
|
+
* import, and ESM resolution ignores NODE_PATH, so the package has to sit in
|
|
225
|
+
* a `node_modules` directory above the artifact. The CLI ships the pinned
|
|
226
|
+
* version and links it there rather than installing a second copy.
|
|
227
|
+
*/
|
|
228
|
+
export async function linkHostPackages(installRoot, contract) {
|
|
229
|
+
const nodeModules = path.join(installRoot, "node_modules");
|
|
230
|
+
await fsp.mkdir(nodeModules, { recursive: true });
|
|
231
|
+
for (const declared of contract.packages) {
|
|
232
|
+
let packageRoot;
|
|
233
|
+
try {
|
|
234
|
+
packageRoot = path.dirname(require.resolve(`${declared.package}/package.json`));
|
|
235
|
+
}
|
|
236
|
+
catch {
|
|
237
|
+
throw new Error(`This connector needs ${declared.package} ${declared.declared_version}, which this build of vana does not include.`);
|
|
238
|
+
}
|
|
239
|
+
const { version } = JSON.parse(await fsp.readFile(path.join(packageRoot, "package.json"), "utf8"));
|
|
240
|
+
if (version !== declared.declared_version) {
|
|
241
|
+
throw new Error(`This connector needs ${declared.package} ${declared.declared_version}, but vana includes ${version}. Update vana.`);
|
|
242
|
+
}
|
|
243
|
+
const link = path.join(nodeModules, declared.package);
|
|
244
|
+
await fsp.rm(link, { recursive: true, force: true });
|
|
245
|
+
await fsp.symlink(packageRoot, link, process.platform === "win32" ? "junction" : "dir");
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
/** Where connector browser profiles live; owned by the CLI, never shared. */
|
|
249
|
+
export function getPdppProfileRoot() {
|
|
250
|
+
return path.join(getPdppHome(), "profiles");
|
|
251
|
+
}
|
|
252
|
+
function patchrightBrowsersDir() {
|
|
253
|
+
return path.join(getPdppHome(), "browsers");
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Environment that decides which browser a connector launches.
|
|
257
|
+
*
|
|
258
|
+
* System Chrome is preferred for the same reason the legacy runtime prefers
|
|
259
|
+
* it: sites treat it as a normal browser. Without it the connector's own
|
|
260
|
+
* patchright Chromium is used, installed once under ~/.vana/pdpp/browsers.
|
|
261
|
+
*/
|
|
262
|
+
export function browserEnvironment() {
|
|
263
|
+
if (getSystemChromePath()) {
|
|
264
|
+
return { PDPP_BROWSER_CHANNEL: "chrome" };
|
|
265
|
+
}
|
|
266
|
+
return { PLAYWRIGHT_BROWSERS_PATH: patchrightBrowsersDir() };
|
|
267
|
+
}
|
|
268
|
+
export async function ensureConnectorBrowser(node, logPath) {
|
|
269
|
+
if (getSystemChromePath())
|
|
270
|
+
return;
|
|
271
|
+
const cliPath = path.join(path.dirname(require.resolve("patchright/package.json")), "cli.js");
|
|
272
|
+
await fsp.appendFile(logPath, "Installing Chromium for patchright\n", "utf8");
|
|
273
|
+
const { stdout, stderr } = await execFileAsync(node.path, [cliPath, "install", "chromium"], {
|
|
274
|
+
env: {
|
|
275
|
+
...process.env,
|
|
276
|
+
PLAYWRIGHT_BROWSERS_PATH: patchrightBrowsersDir(),
|
|
277
|
+
},
|
|
278
|
+
windowsHide: true,
|
|
279
|
+
maxBuffer: 16 * 1024 * 1024,
|
|
280
|
+
});
|
|
281
|
+
await fsp.appendFile(logPath, `${stdout}${stderr}`, "utf8");
|
|
282
|
+
}
|
|
283
|
+
//# sourceMappingURL=host.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.js","sourceRoot":"","sources":["../../src/pdpp/host.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MA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GAAG,IAAI,CAAC,IAAI,CACvB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC,EACxD,QAAQ,CACT,CAAC;IACF,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,EAAE,sCAAsC,EAAE,MAAM,CAAC,CAAC;IAC9E,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CAC5C,IAAI,CAAC,IAAI,EACT,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,EAChC;QACE,GAAG,EAAE;YACH,GAAG,OAAO,CAAC,GAAG;YACd,wBAAwB,EAAE,qBAAqB,EAAE;SAClD;QACD,WAAW,EAAE,IAAI;QACjB,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI;KAC5B,CACF,CAAC;IACF,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,MAAM,GAAG,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type PdppPin } from "./pins.js";
|
|
2
|
+
import { type PdppLaunch } from "./profile.js";
|
|
3
|
+
export declare function artifactRootFor(pin: PdppPin, installRoot?: string): string;
|
|
4
|
+
/**
|
|
5
|
+
* Read an installed artifact into a launch, refusing one whose manifest does
|
|
6
|
+
* not describe the pinned connector.
|
|
7
|
+
*/
|
|
8
|
+
export declare function readInstalledLaunch(pin: PdppPin, artifactRoot: string, installRoot: string): Promise<PdppLaunch>;
|
|
9
|
+
/**
|
|
10
|
+
* Install the pinned artifact if needed and verify it, returning how to run
|
|
11
|
+
* it. Nothing unverified is ever returned: an existing install is re-checked
|
|
12
|
+
* against the registry's signed digest on every call, and a fresh one is
|
|
13
|
+
* unpacked into a staging directory and moved into place only after the
|
|
14
|
+
* installer has checked its signature and every file digest.
|
|
15
|
+
*/
|
|
16
|
+
export declare function ensurePinnedArtifact(pin: PdppPin, logPath: string, installRoot?: string): Promise<PdppLaunch>;
|
|
17
|
+
//# sourceMappingURL=installer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../../src/pdpp/installer.ts"],"names":[],"mappings":"AAKA,OAAO,EAAmB,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAA0B,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAgBvE,wBAAgB,eAAe,CAC7B,GAAG,EAAE,OAAO,EACZ,WAAW,SAAgB,GAC1B,MAAM,CAER;AA6BD;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,OAAO,EACZ,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,UAAU,CAAC,CAiCrB;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,MAAM,EACf,WAAW,SAAgB,GAC1B,OAAO,CAAC,UAAU,CAAC,CAiDrB"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import fsp from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { getPdppHome } from "./host.js";
|
|
5
|
+
import { pinOciReference } from "./pins.js";
|
|
6
|
+
import { parseCollectionProfile } from "./profile.js";
|
|
7
|
+
// Loaded on first use: sigstore and its dependencies are not worth paying for
|
|
8
|
+
// on every CLI start, and legacy sources never need them.
|
|
9
|
+
async function loadInstallerCore() {
|
|
10
|
+
return (await import("../vendor/pdpp-connector-manager/index.mjs"));
|
|
11
|
+
}
|
|
12
|
+
const PROFILE_PATH = "profile/collection-profile.json";
|
|
13
|
+
const ENTRYPOINT_PATH = "dist/collection-profile.mjs";
|
|
14
|
+
const PROVENANCE_PATH = "provenance.json";
|
|
15
|
+
export function artifactRootFor(pin, installRoot = getPdppHome()) {
|
|
16
|
+
return path.join(installRoot, "collection-profiles", pin.id);
|
|
17
|
+
}
|
|
18
|
+
function lockFor(core, pin) {
|
|
19
|
+
const reference = core.parseConnectorOciReference(pinOciReference(pin));
|
|
20
|
+
return {
|
|
21
|
+
lockVersion: "2.0",
|
|
22
|
+
connectors: [
|
|
23
|
+
{
|
|
24
|
+
connectorId: pin.id,
|
|
25
|
+
connectorKey: reference.connectorKey,
|
|
26
|
+
version: pin.version,
|
|
27
|
+
artifactKind: "pdpp-collection-profile",
|
|
28
|
+
manifestPath: PROFILE_PATH,
|
|
29
|
+
entrypointPath: ENTRYPOINT_PATH,
|
|
30
|
+
provenancePath: PROVENANCE_PATH,
|
|
31
|
+
oci: {
|
|
32
|
+
registry: reference.registry,
|
|
33
|
+
repository: reference.repository,
|
|
34
|
+
digest: reference.digest,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
async function readJson(file) {
|
|
41
|
+
return JSON.parse(await fsp.readFile(file, "utf8"));
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Read an installed artifact into a launch, refusing one whose manifest does
|
|
45
|
+
* not describe the pinned connector.
|
|
46
|
+
*/
|
|
47
|
+
export async function readInstalledLaunch(pin, artifactRoot, installRoot) {
|
|
48
|
+
const profile = parseCollectionProfile(await readJson(path.join(artifactRoot, PROFILE_PATH)), `${pin.name} profile`);
|
|
49
|
+
if (profile.connector_key !== pin.id || profile.version !== pin.version) {
|
|
50
|
+
throw new Error(`The installed ${pin.name} connector is ${profile.connector_key} ${profile.version}, not the pinned ${pin.id} ${pin.version}.`);
|
|
51
|
+
}
|
|
52
|
+
const provenance = (await readJson(path.join(artifactRoot, PROVENANCE_PATH)));
|
|
53
|
+
const contract = provenance.host_runtime_contract;
|
|
54
|
+
if (!contract || typeof contract.node !== "string") {
|
|
55
|
+
throw new Error(`The ${pin.name} connector does not say which Node it needs.`);
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
source: pin.id,
|
|
59
|
+
displayName: profile.display_name ?? pin.name,
|
|
60
|
+
version: profile.version,
|
|
61
|
+
profile,
|
|
62
|
+
args: [path.join(artifactRoot, ENTRYPOINT_PATH)],
|
|
63
|
+
cwd: artifactRoot,
|
|
64
|
+
nodeRange: contract.node,
|
|
65
|
+
installRoot,
|
|
66
|
+
hostPackages: Array.isArray(contract.packages) ? contract.packages : [],
|
|
67
|
+
origin: "pinned",
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Install the pinned artifact if needed and verify it, returning how to run
|
|
72
|
+
* it. Nothing unverified is ever returned: an existing install is re-checked
|
|
73
|
+
* against the registry's signed digest on every call, and a fresh one is
|
|
74
|
+
* unpacked into a staging directory and moved into place only after the
|
|
75
|
+
* installer has checked its signature and every file digest.
|
|
76
|
+
*/
|
|
77
|
+
export async function ensurePinnedArtifact(pin, logPath, installRoot = getPdppHome()) {
|
|
78
|
+
const core = await loadInstallerCore();
|
|
79
|
+
const lock = lockFor(core, pin);
|
|
80
|
+
const artifactRoot = artifactRootFor(pin, installRoot);
|
|
81
|
+
await fsp.mkdir(installRoot, { recursive: true });
|
|
82
|
+
if (fs.existsSync(artifactRoot)) {
|
|
83
|
+
const verified = await core.verifyInstalled({
|
|
84
|
+
lock,
|
|
85
|
+
source: null,
|
|
86
|
+
installRoot,
|
|
87
|
+
layout: "snapshot",
|
|
88
|
+
});
|
|
89
|
+
if (verified.ok) {
|
|
90
|
+
await fsp.appendFile(logPath, `Verified ${pinOciReference(pin)}\n`, "utf8");
|
|
91
|
+
return readInstalledLaunch(pin, artifactRoot, installRoot);
|
|
92
|
+
}
|
|
93
|
+
await fsp.appendFile(logPath, `Installed ${pin.id} failed verification (missing: ${verified.missing.join(", ") || "none"}; changed: ${verified.mismatched.join(", ") || "none"}); reinstalling.\n`, "utf8");
|
|
94
|
+
}
|
|
95
|
+
const staging = await fsp.mkdtemp(path.join(installRoot, ".staging-"));
|
|
96
|
+
try {
|
|
97
|
+
await core.installFromLock({
|
|
98
|
+
lock,
|
|
99
|
+
source: null,
|
|
100
|
+
installRoot: staging,
|
|
101
|
+
layout: "snapshot",
|
|
102
|
+
allowTagResolution: false,
|
|
103
|
+
});
|
|
104
|
+
const stagedArtifact = artifactRootFor(pin, staging);
|
|
105
|
+
// Validate before the swap so a bad artifact never replaces a good one.
|
|
106
|
+
await readInstalledLaunch(pin, stagedArtifact, installRoot);
|
|
107
|
+
await fsp.mkdir(path.dirname(artifactRoot), { recursive: true });
|
|
108
|
+
await fsp.rm(artifactRoot, { recursive: true, force: true });
|
|
109
|
+
await fsp.rename(stagedArtifact, artifactRoot);
|
|
110
|
+
}
|
|
111
|
+
finally {
|
|
112
|
+
await fsp.rm(staging, { recursive: true, force: true });
|
|
113
|
+
}
|
|
114
|
+
await fsp.appendFile(logPath, `Installed ${pinOciReference(pin)}\n`, "utf8");
|
|
115
|
+
return readInstalledLaunch(pin, artifactRoot, installRoot);
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=installer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installer.js","sourceRoot":"","sources":["../../src/pdpp/installer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,GAAG,MAAM,kBAAkB,CAAC;AACnC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,WAAW,EAA4B,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,eAAe,EAAgB,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAmB,MAAM,cAAc,CAAC;AAMvE,8EAA8E;AAC9E,0DAA0D;AAC1D,KAAK,UAAU,iBAAiB;IAC9B,OAAO,CAAC,MAAM,MAAM,CAAC,4CAA4C,CAAC,CAAkB,CAAC;AACvF,CAAC;AAED,MAAM,YAAY,GAAG,iCAAiC,CAAC;AACvD,MAAM,eAAe,GAAG,6BAA6B,CAAC;AACtD,MAAM,eA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,GAAG,EAAE,OAAO,CAAC,CAAC;QACrD,wEAAwE;QACxE,MAAM,mBAAmB,CAAC,GAAG,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC;QAE5D,MAAM,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACjE,MAAM,GAAG,CAAC,EAAE,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7D,MAAM,GAAG,CAAC,MAAM,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;IACjD,CAAC;YAAS,CAAC;QACT,MAAM,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1D,CAAC;IACD,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,EAAE,aAAa,eAAe,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7E,OAAO,mBAAmB,CAAC,GAAG,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type PdppLaunch } from "./profile.js";
|
|
2
|
+
/**
|
|
3
|
+
* Run a connector from a data-connectors checkout instead of a signed
|
|
4
|
+
* artifact, the way `connector-dev` does, so an author can test it before it
|
|
5
|
+
* is published.
|
|
6
|
+
*
|
|
7
|
+
* Both layouts are accepted: connectors at the repository root
|
|
8
|
+
* (`connectors/<key>/index.ts` with `connectors/<key>/manifest.json`), and
|
|
9
|
+
* the earlier `packages/polyfill-connectors/connectors/<key>/index.ts` with
|
|
10
|
+
* `manifests/<key>.json`. The checkout's own `node_modules` supplies tsx and
|
|
11
|
+
* the browser driver.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveLocalLaunch(checkout: string, source: string): Promise<PdppLaunch>;
|
|
14
|
+
//# sourceMappingURL=local.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../src/pdpp/local.ts"],"names":[],"mappings":"AAIA,OAAO,EAA0B,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAqBvE;;;;;;;;;;GAUG;AACH,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,UAAU,CAAC,CAsDrB"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import fsp from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { parseCollectionProfile } from "./profile.js";
|
|
5
|
+
/** The published artifacts' range, used when a checkout declares none. */
|
|
6
|
+
const DEFAULT_NODE_RANGE = ">=24.15.0 <25";
|
|
7
|
+
function firstExisting(candidates) {
|
|
8
|
+
return candidates.find((candidate) => fs.existsSync(candidate)) ?? null;
|
|
9
|
+
}
|
|
10
|
+
/** Nearest directory at or above `start`, up to `stop`, with tsx installed. */
|
|
11
|
+
function findToolRoot(start, stop) {
|
|
12
|
+
let current = start;
|
|
13
|
+
while (true) {
|
|
14
|
+
if (fs.existsSync(path.join(current, "node_modules", "tsx"))) {
|
|
15
|
+
return current;
|
|
16
|
+
}
|
|
17
|
+
if (current === stop || path.dirname(current) === current)
|
|
18
|
+
return null;
|
|
19
|
+
current = path.dirname(current);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Run a connector from a data-connectors checkout instead of a signed
|
|
24
|
+
* artifact, the way `connector-dev` does, so an author can test it before it
|
|
25
|
+
* is published.
|
|
26
|
+
*
|
|
27
|
+
* Both layouts are accepted: connectors at the repository root
|
|
28
|
+
* (`connectors/<key>/index.ts` with `connectors/<key>/manifest.json`), and
|
|
29
|
+
* the earlier `packages/polyfill-connectors/connectors/<key>/index.ts` with
|
|
30
|
+
* `manifests/<key>.json`. The checkout's own `node_modules` supplies tsx and
|
|
31
|
+
* the browser driver.
|
|
32
|
+
*/
|
|
33
|
+
export async function resolveLocalLaunch(checkout, source) {
|
|
34
|
+
const root = path.resolve(checkout);
|
|
35
|
+
const key = source.toLowerCase();
|
|
36
|
+
const bases = [root, path.join(root, "packages", "polyfill-connectors")];
|
|
37
|
+
for (const base of bases) {
|
|
38
|
+
const entry = path.join(base, "connectors", key, "index.ts");
|
|
39
|
+
if (!fs.existsSync(entry))
|
|
40
|
+
continue;
|
|
41
|
+
const manifestPath = firstExisting([
|
|
42
|
+
path.join(base, "connectors", key, "manifest.json"),
|
|
43
|
+
path.join(base, "manifests", `${key}.json`),
|
|
44
|
+
]);
|
|
45
|
+
if (!manifestPath) {
|
|
46
|
+
throw new Error(`Found ${entry} but no manifest for ${key}.`);
|
|
47
|
+
}
|
|
48
|
+
const profile = parseCollectionProfile(JSON.parse(await fsp.readFile(manifestPath, "utf8")), manifestPath);
|
|
49
|
+
const cwd = findToolRoot(path.dirname(entry), root);
|
|
50
|
+
if (!cwd) {
|
|
51
|
+
throw new Error(`tsx is not installed in ${root}. Run npm install there first.`);
|
|
52
|
+
}
|
|
53
|
+
let nodeRange = DEFAULT_NODE_RANGE;
|
|
54
|
+
try {
|
|
55
|
+
const pkg = JSON.parse(await fsp.readFile(path.join(cwd, "package.json"), "utf8"));
|
|
56
|
+
nodeRange = pkg.engines?.node ?? DEFAULT_NODE_RANGE;
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
// No package.json at the tool root; keep the default.
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
source: key,
|
|
63
|
+
displayName: profile.display_name ?? key,
|
|
64
|
+
version: profile.version,
|
|
65
|
+
profile,
|
|
66
|
+
args: ["--import", "tsx", entry],
|
|
67
|
+
cwd,
|
|
68
|
+
nodeRange,
|
|
69
|
+
installRoot: null,
|
|
70
|
+
hostPackages: [],
|
|
71
|
+
origin: "local",
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
throw new Error(`No connector named ${key} in ${root}. Looked for connectors/${key}/index.ts at the root and under packages/polyfill-connectors.`);
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=local.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local.js","sourceRoot":"","sources":["../../src/pdpp/local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,GAAG,MAAM,kBAAkB,CAAC;AACnC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,sBAAsB,EAAmB,MAAM,cAAc,CAAC;AAEvE,0EAA0E;AAC1E,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAE3C,SAAS,aAAa,CAAC,UAAoB;IACzC,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,IAAI,IAAI,CAAC;AAC1E,CAAC;AAED,+EAA+E;AAC/E,SAAS,YAAY,CAAC,KAAa,EAAE,IAAY;IAC/C,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,OAAO,IAAI,EAAE,CAAC;QACZ,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;YAC7D,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,IAAI,OAAO,KAAK,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,OAAO;YAAE,OAAO,IAAI,CAAC;QACvE,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;AACH,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,QAAgB,EAChB,MAAc;IAEd,MAAM,IAAI,GAAG,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G,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CACxB,CAAC;YACrC,SAAS,GAAG,GAAG,CAAC,OAAO,EAAE,IAAI,IAAI,kBAAkB,CAAC;QACtD,CAAC;QAAC,MAAM,CAAC;YACP,sDAAsD;QACxD,CAAC;QAED,OAAO;YACL,MAAM,EAAE,GAAG;YACX,WAAW,EAAE,OAAO,CAAC,YAAY,IAAI,GAAG;YACxC,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,OAAO;YACP,IAAI,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC;YAChC,GAAG;YACH,SAAS;YACT,WAAW,EAAE,IAAI;YACjB,YAAY,EAAE,EAAE;YAChB,MAAM,EAAE,OAAO;SAChB,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,KAAK,CACb,sBAAsB,GAAG,OAAO,IAAI,2BAA2B,GAAG,+DAA+D,CAClI,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collection Profile connectors this CLI will install, each pinned to one
|
|
3
|
+
* signed artifact digest.
|
|
4
|
+
*
|
|
5
|
+
* The published catalog lists every connector the data-connectors repo
|
|
6
|
+
* builds, most of them untested against a real account and many sharing an
|
|
7
|
+
* id with a legacy connector. Pinning follows Vana Desktop's admission list:
|
|
8
|
+
* a connector appears here once it has been proven end to end, and the digest
|
|
9
|
+
* is what gets verified, so a catalog update cannot change what runs.
|
|
10
|
+
*/
|
|
11
|
+
export interface PdppPin {
|
|
12
|
+
/** Source id in `vana sources`, and the connector key in the registry. */
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
company: string;
|
|
16
|
+
description: string;
|
|
17
|
+
version: string;
|
|
18
|
+
digest: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const PDPP_PINS: readonly PdppPin[];
|
|
21
|
+
export declare function findPdppPin(source: string): PdppPin | null;
|
|
22
|
+
export declare function pinOciReference(pin: PdppPin): string;
|
|
23
|
+
//# sourceMappingURL=pins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pins.d.ts","sourceRoot":"","sources":["../../src/pdpp/pins.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,WAAW,OAAO;IACtB,0EAA0E;IAC1E,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,SAAS,EAAE,SAAS,OAAO,EAWvC,CAAC;AAEF,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAG1D;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAEpD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const PDPP_PINS = [
|
|
2
|
+
{
|
|
3
|
+
id: "whoop",
|
|
4
|
+
name: "WHOOP",
|
|
5
|
+
company: "WHOOP",
|
|
6
|
+
description: "Exports your WHOOP profile, body measurements, cycles, recoveries, sleeps and workouts.",
|
|
7
|
+
version: "0.1.0",
|
|
8
|
+
digest: "sha256:daafcf17033be65aac5acd6e106a3d25df370be09b8a6fdda5932ec069b0d114",
|
|
9
|
+
},
|
|
10
|
+
];
|
|
11
|
+
export function findPdppPin(source) {
|
|
12
|
+
const id = source.toLowerCase();
|
|
13
|
+
return PDPP_PINS.find((pin) => pin.id === id) ?? null;
|
|
14
|
+
}
|
|
15
|
+
export function pinOciReference(pin) {
|
|
16
|
+
return `ghcr.io/pdp-connect/connector/${pin.id}@${pin.digest}`;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=pins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pins.js","sourceRoot":"","sources":["../../src/pdpp/pins.ts"],"names":[],"mappings":"AAoBA,MAAM,CAAC,MAAM,SAAS,GAAuB;IAC3C;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,OAAO;QAChB,WAAW,EACT,yFAAyF;QAC3F,OAAO,EAAE,OAAO;QAChB,MAAM,EACJ,yEAAyE;KAC5E;CACF,CAAC;AAEF,MAAM,UAAU,WAAW,CAAC,MAAc;IACxC,MAAM,EAAE,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IAChC,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,IAAI,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,GAAY;IAC1C,OAAO,iCAAiC,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** The parts of a Collection Profile manifest a host reads. */
|
|
2
|
+
export interface CollectionProfileStream {
|
|
3
|
+
name: string;
|
|
4
|
+
required?: boolean;
|
|
5
|
+
incremental?: boolean;
|
|
6
|
+
display?: {
|
|
7
|
+
label?: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface CollectionProfile {
|
|
11
|
+
connector_key: string;
|
|
12
|
+
version: string;
|
|
13
|
+
display_name?: string;
|
|
14
|
+
streams: CollectionProfileStream[];
|
|
15
|
+
capabilities?: {
|
|
16
|
+
human_interaction?: string[];
|
|
17
|
+
};
|
|
18
|
+
runtime_requirements?: {
|
|
19
|
+
bindings?: {
|
|
20
|
+
browser?: {
|
|
21
|
+
required?: boolean;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* How to start one connector: the program arguments after `node`, where to
|
|
28
|
+
* run them, and what the host has to provide first.
|
|
29
|
+
*/
|
|
30
|
+
export interface PdppLaunch {
|
|
31
|
+
source: string;
|
|
32
|
+
displayName: string;
|
|
33
|
+
version: string;
|
|
34
|
+
profile: CollectionProfile;
|
|
35
|
+
args: string[];
|
|
36
|
+
cwd: string;
|
|
37
|
+
/** Node range from provenance; the connector refuses to run outside it. */
|
|
38
|
+
nodeRange: string;
|
|
39
|
+
/** Where host packages get linked, or null when the source tree has its own. */
|
|
40
|
+
installRoot: string | null;
|
|
41
|
+
hostPackages: Array<{
|
|
42
|
+
package: string;
|
|
43
|
+
declared_version: string;
|
|
44
|
+
}>;
|
|
45
|
+
/** `pinned` runs a verified artifact; `local` runs a checkout's source. */
|
|
46
|
+
origin: "pinned" | "local";
|
|
47
|
+
}
|
|
48
|
+
export declare function parseCollectionProfile(raw: unknown, where: string): CollectionProfile;
|
|
49
|
+
//# sourceMappingURL=profile.d.ts.map
|