@pdpp/local-collector 0.1.0-beta.5 → 0.1.0-beta.6
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.
|
@@ -1,12 +1,37 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
3
|
import { basename, dirname, extname, join } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { ALLOW_CUSTOM_COMMAND_ENV, CollectorCustomCommandRefusedError, CollectorUsageError, } from "../src/errors.js";
|
|
6
6
|
import { BUNDLED_CONNECTOR_IDS, COLLECTOR_PROTOCOL_VERSION, COLLECTOR_RUNTIME_CAPABILITIES, LocalDeviceOutbox, enrollCollector, getBundledConnector, isMainModule, runCollectorConnector, } from "../src/runner.js";
|
|
7
7
|
const DEFAULT_QUEUE_PATH = join(dirname(fileURLToPath(import.meta.url)), "..", ".pdpp-data", "collector-runner-queue.json");
|
|
8
8
|
const LOCAL_COLLECTOR_PACKAGE_NAME = "@pdpp/local-collector";
|
|
9
|
-
const
|
|
9
|
+
const LOCAL_COLLECTOR_PACKAGE_VERSION_FALLBACK = "0.0.0";
|
|
10
|
+
export function resolveLocalCollectorPackageVersion(startUrl = import.meta.url) {
|
|
11
|
+
let current = typeof startUrl === "string" && !startUrl.startsWith("file:")
|
|
12
|
+
? dirname(startUrl)
|
|
13
|
+
: dirname(fileURLToPath(startUrl));
|
|
14
|
+
for (;;) {
|
|
15
|
+
const manifestPath = join(current, "package.json");
|
|
16
|
+
if (existsSync(manifestPath)) {
|
|
17
|
+
try {
|
|
18
|
+
const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
19
|
+
if (manifest.name === LOCAL_COLLECTOR_PACKAGE_NAME &&
|
|
20
|
+
typeof manifest.version === "string" &&
|
|
21
|
+
manifest.version) {
|
|
22
|
+
return manifest.version;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const parent = dirname(current);
|
|
29
|
+
if (parent === current) {
|
|
30
|
+
return LOCAL_COLLECTOR_PACKAGE_VERSION_FALLBACK;
|
|
31
|
+
}
|
|
32
|
+
current = parent;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
10
35
|
const HELP_TEXT = `pdpp-local-collector — PDPP local collector runner.
|
|
11
36
|
|
|
12
37
|
Ownership: the local device/host supervisor decides when filesystem-class
|
|
@@ -153,7 +178,7 @@ export function inspectLocalOutboxStatus(options) {
|
|
|
153
178
|
},
|
|
154
179
|
package: {
|
|
155
180
|
name: LOCAL_COLLECTOR_PACKAGE_NAME,
|
|
156
|
-
version:
|
|
181
|
+
version: resolveLocalCollectorPackageVersion(),
|
|
157
182
|
},
|
|
158
183
|
source: {
|
|
159
184
|
connection_id: options.sourceInstanceId ?? null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pdpp/local-collector",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.6",
|
|
4
4
|
"description": "Publishable local collector runtime for PDPP: filesystem-class connectors (Claude Code, Codex) plus the device-exporter ingest client.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|