@cotal-ai/workspace 0.100.2 → 0.101.1
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/build/Release/darwin-arm64/build.json +21 -0
- package/build/Release/darwin-arm64/process.node +0 -0
- package/build/Release/darwin-x64/build.json +21 -0
- package/build/Release/darwin-x64/process.node +0 -0
- package/build/Release/win32-arm64/build.json +7 -5
- package/build/Release/win32-arm64/creation.node +0 -0
- package/build/Release/win32-x64/build.json +7 -5
- package/build/Release/win32-x64/creation.node +0 -0
- package/dist/agent-grants.d.ts +21 -0
- package/dist/agent-grants.d.ts.map +1 -0
- package/dist/agent-grants.js +21 -0
- package/dist/agent-grants.js.map +1 -0
- package/dist/auth-paths.d.ts +34 -0
- package/dist/auth-paths.d.ts.map +1 -1
- package/dist/auth-paths.js +99 -3
- package/dist/auth-paths.js.map +1 -1
- package/dist/broker-display.d.ts +12 -0
- package/dist/broker-display.d.ts.map +1 -1
- package/dist/broker-display.js +14 -0
- package/dist/broker-display.js.map +1 -1
- package/dist/connect.d.ts +21 -7
- package/dist/connect.d.ts.map +1 -1
- package/dist/connect.js +152 -22
- package/dist/connect.js.map +1 -1
- package/dist/control-target.d.ts.map +1 -1
- package/dist/control-target.js +12 -10
- package/dist/control-target.js.map +1 -1
- package/dist/cotal-config.d.ts +7 -0
- package/dist/cotal-config.d.ts.map +1 -1
- package/dist/cotal-config.js +29 -2
- package/dist/cotal-config.js.map +1 -1
- package/dist/cotal-home.d.ts +23 -0
- package/dist/cotal-home.d.ts.map +1 -0
- package/dist/cotal-home.js +36 -0
- package/dist/cotal-home.js.map +1 -0
- package/dist/credential-actions.d.ts +17 -3
- package/dist/credential-actions.d.ts.map +1 -1
- package/dist/credential-actions.js +62 -10
- package/dist/credential-actions.js.map +1 -1
- package/dist/darwin-process.d.ts +20 -0
- package/dist/darwin-process.d.ts.map +1 -0
- package/dist/darwin-process.js +24 -0
- package/dist/darwin-process.js.map +1 -0
- package/dist/deprecated-daemon-entries.d.ts +3 -0
- package/dist/deprecated-daemon-entries.d.ts.map +1 -1
- package/dist/deprecated-daemon-entries.js +6 -1
- package/dist/deprecated-daemon-entries.js.map +1 -1
- package/dist/extensions.d.ts +4 -2
- package/dist/extensions.d.ts.map +1 -1
- package/dist/extensions.js +7 -2
- package/dist/extensions.js.map +1 -1
- package/dist/flags.d.ts +2 -0
- package/dist/flags.d.ts.map +1 -1
- package/dist/flags.js +1 -1
- package/dist/flags.js.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/join-target.d.ts +3 -1
- package/dist/join-target.d.ts.map +1 -1
- package/dist/join-target.js +15 -3
- package/dist/join-target.js.map +1 -1
- package/dist/maintenance.d.ts +61 -2
- package/dist/maintenance.d.ts.map +1 -1
- package/dist/maintenance.js +153 -14
- package/dist/maintenance.js.map +1 -1
- package/dist/manager-name.d.ts +15 -0
- package/dist/manager-name.d.ts.map +1 -0
- package/dist/manager-name.js +54 -0
- package/dist/manager-name.js.map +1 -0
- package/dist/mesh-registry.d.ts +39 -35
- package/dist/mesh-registry.d.ts.map +1 -1
- package/dist/mesh-registry.js +57 -36
- package/dist/mesh-registry.js.map +1 -1
- package/dist/mesh-target.d.ts +120 -3
- package/dist/mesh-target.d.ts.map +1 -1
- package/dist/mesh-target.js +319 -48
- package/dist/mesh-target.js.map +1 -1
- package/dist/official-connectors.d.ts +3 -0
- package/dist/official-connectors.d.ts.map +1 -1
- package/dist/official-connectors.js +5 -0
- package/dist/official-connectors.js.map +1 -1
- package/dist/output.d.ts +34 -6
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +38 -5
- package/dist/output.js.map +1 -1
- package/dist/pid.d.ts +42 -7
- package/dist/pid.d.ts.map +1 -1
- package/dist/pid.js +196 -27
- package/dist/pid.js.map +1 -1
- package/dist/preferences.d.ts +25 -3
- package/dist/preferences.d.ts.map +1 -1
- package/dist/preferences.js +77 -14
- package/dist/preferences.js.map +1 -1
- package/dist/preflight.d.ts +17 -5
- package/dist/preflight.d.ts.map +1 -1
- package/dist/preflight.js +22 -32
- package/dist/preflight.js.map +1 -1
- package/dist/prepared-spaces.d.ts +20 -2
- package/dist/prepared-spaces.d.ts.map +1 -1
- package/dist/prepared-spaces.js +90 -15
- package/dist/prepared-spaces.js.map +1 -1
- package/dist/present.d.ts +2 -12
- package/dist/present.d.ts.map +1 -1
- package/dist/present.js +24 -40
- package/dist/present.js.map +1 -1
- package/dist/protected-records.d.ts +22 -3
- package/dist/protected-records.d.ts.map +1 -1
- package/dist/protected-records.js +198 -27
- package/dist/protected-records.js.map +1 -1
- package/dist/registration-policy.d.ts +2 -1
- package/dist/registration-policy.d.ts.map +1 -1
- package/dist/render.d.ts +2 -1
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +42 -11
- package/dist/render.js.map +1 -1
- package/dist/renewal.d.ts +4 -0
- package/dist/renewal.d.ts.map +1 -1
- package/dist/renewal.js +20 -1
- package/dist/renewal.js.map +1 -1
- package/dist/service-adapter.d.ts +1 -2
- package/dist/service-adapter.d.ts.map +1 -1
- package/dist/service-adapter.js +9 -4
- package/dist/service-adapter.js.map +1 -1
- package/dist/service-custody.js +2 -2
- package/dist/service-custody.js.map +1 -1
- package/dist/service-definition.d.ts +3 -0
- package/dist/service-definition.d.ts.map +1 -1
- package/dist/service-definition.js +56 -2
- package/dist/service-definition.js.map +1 -1
- package/dist/service-definition.schema.json +2 -1
- package/dist/service-identity.js +4 -4
- package/dist/service-identity.js.map +1 -1
- package/dist/service-stop.js +3 -3
- package/dist/service-stop.js.map +1 -1
- package/dist/service-target.d.ts.map +1 -1
- package/dist/service-target.js +9 -2
- package/dist/service-target.js.map +1 -1
- package/dist/signer-export.d.ts +1 -0
- package/dist/signer-export.d.ts.map +1 -1
- package/dist/signer-export.js +20 -4
- package/dist/signer-export.js.map +1 -1
- package/dist/space-streams.d.ts +18 -0
- package/dist/space-streams.d.ts.map +1 -0
- package/dist/space-streams.js +41 -0
- package/dist/space-streams.js.map +1 -0
- package/dist/space.d.ts +5 -0
- package/dist/space.d.ts.map +1 -1
- package/dist/space.js +5 -0
- package/dist/space.js.map +1 -1
- package/dist/store-entries.d.ts +6 -0
- package/dist/store-entries.d.ts.map +1 -0
- package/dist/store-entries.js +17 -0
- package/dist/store-entries.js.map +1 -0
- package/dist/system-rotation.d.ts +3 -1
- package/dist/system-rotation.d.ts.map +1 -1
- package/dist/system-rotation.js +19 -4
- package/dist/system-rotation.js.map +1 -1
- package/dist/text-wrap.d.ts +18 -0
- package/dist/text-wrap.d.ts.map +1 -0
- package/dist/text-wrap.js +60 -0
- package/dist/text-wrap.js.map +1 -0
- package/dist/win32-custodian.d.ts +2 -0
- package/dist/win32-custodian.d.ts.map +1 -0
- package/dist/win32-custodian.js +85 -0
- package/dist/win32-custodian.js.map +1 -0
- package/dist/win32-custody.d.ts +57 -0
- package/dist/win32-custody.d.ts.map +1 -0
- package/dist/win32-custody.js +220 -0
- package/dist/win32-custody.js.map +1 -0
- package/dist/win32-process.d.ts +38 -0
- package/dist/win32-process.d.ts.map +1 -1
- package/dist/win32-process.js +63 -5
- package/dist/win32-process.js.map +1 -1
- package/native/README.md +6 -4
- package/native/darwin-process.c +173 -0
- package/native/win32-process.c +317 -14
- package/native/win32-system-id.cpp +32 -0
- package/package.json +2 -2
- package/scripts/assert-shipped-natives.mjs +3 -3
- package/scripts/build-native.mjs +46 -26
- package/scripts/native-contract.mjs +36 -16
package/scripts/build-native.mjs
CHANGED
|
@@ -4,19 +4,21 @@ import { execFileSync } from "node:child_process";
|
|
|
4
4
|
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { tmpdir } from "node:os";
|
|
6
6
|
import { join } from "node:path";
|
|
7
|
-
import { root, sdk, sha256, sourceHashes, verifyNative } from "./native-contract.mjs";
|
|
7
|
+
import { darwinTarget, nativeDir, nativeFile, root, sdk, sha256, sourceHashes, verifyNative } from "./native-contract.mjs";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
const platform = process.platform;
|
|
10
|
+
if (platform !== "win32" && platform !== "darwin") process.exit(0);
|
|
10
11
|
const arch = process.arch;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const name = platform === "win32" ? "Windows creation identity" : "macOS process identity";
|
|
13
|
+
assert(arch === "x64" || arch === "arm64", `unsupported ${name} architecture: ${arch}`);
|
|
14
|
+
const dest = nativeDir(platform, arch);
|
|
15
|
+
if (existsSync(join(dest, nativeFile(platform))) || existsSync(join(dest, "build.json"))) {
|
|
14
16
|
// A verified prebuilt needs no compiler. Stale or damaged artifacts are not silently rebuilt.
|
|
15
|
-
verifyNative(arch, dest);
|
|
17
|
+
verifyNative(platform, arch, dest);
|
|
16
18
|
process.exit(0);
|
|
17
19
|
}
|
|
18
|
-
assert(process.env.VCToolsVersion && process.env.WindowsSDKVersion, "build Windows identity in the matching MSVC Developer Command Prompt");
|
|
19
|
-
const temp = mkdtempSync(join(tmpdir(),
|
|
20
|
+
if (platform === "win32") assert(process.env.VCToolsVersion && process.env.WindowsSDKVersion && process.env.WindowsSdkDir, "build Windows identity in the matching MSVC Developer Command Prompt");
|
|
21
|
+
const temp = mkdtempSync(join(tmpdir(), `cotal-${platform}-native-`));
|
|
20
22
|
try {
|
|
21
23
|
const download = async (path, expected, output) => {
|
|
22
24
|
const response = await fetch(`https://nodejs.org/dist/v${sdk.version}/${path}`, { signal: AbortSignal.timeout(60_000) });
|
|
@@ -31,34 +33,52 @@ try {
|
|
|
31
33
|
mkdirSync(buildDir);
|
|
32
34
|
const headers = join(sdkDir, "headers.tar.gz");
|
|
33
35
|
const library = join(sdkDir, "node.lib");
|
|
36
|
+
// A macOS bundle resolves Node-API symbols from the loading node at runtime, so it needs no import library.
|
|
34
37
|
await Promise.all([
|
|
35
38
|
download(`node-v${sdk.version}-headers.tar.gz`, sdk.headers, headers),
|
|
36
|
-
download(`win-${arch}/node.lib`, sdk.libraries[arch], library),
|
|
39
|
+
...(platform === "win32" ? [download(`win-${arch}/node.lib`, sdk.libraries[arch], library)] : []),
|
|
37
40
|
]);
|
|
38
|
-
execFileSync("tar.exe", ["-xzf", headers, "-C", sdkDir], { stdio: "inherit" });
|
|
41
|
+
execFileSync(platform === "win32" ? "tar.exe" : "tar", ["-xzf", headers, "-C", sdkDir], { stdio: "inherit" });
|
|
39
42
|
const include = join(sdkDir, `node-v${sdk.version}`, "include/node");
|
|
40
|
-
const output = join(buildDir,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
execFileSync("cl.exe", [
|
|
48
|
-
`/
|
|
49
|
-
|
|
43
|
+
const output = join(buildDir, nativeFile(platform));
|
|
44
|
+
if (platform === "win32") {
|
|
45
|
+
// The system ID reader is C++/WinRT, whose headers ship in the Windows SDK off the default include path.
|
|
46
|
+
const cppwinrt = join(process.env.WindowsSdkDir, "Include", process.env.WindowsSDKVersion, "cppwinrt");
|
|
47
|
+
assert(existsSync(join(cppwinrt, "winrt", "base.h")), `C++/WinRT headers not found at ${cppwinrt}`);
|
|
48
|
+
const compile = ["/nologo", "/c", "/O2", "/MT", "/W4", "/WX"];
|
|
49
|
+
execFileSync("cl.exe", [...compile, "/std:c11", `/I${include}`, `/Fo${join(buildDir, "creation.obj")}`, join(root, "native/win32-process.c")], { cwd: buildDir, stdio: "inherit" });
|
|
50
|
+
execFileSync("cl.exe", [...compile, "/std:c++20", "/EHsc", "/permissive-", "/external:anglebrackets", "/external:W0", `/I${cppwinrt}`,
|
|
51
|
+
`/Fo${join(buildDir, "system-id.obj")}`, join(root, "native/win32-system-id.cpp")], { cwd: buildDir, stdio: "inherit" });
|
|
52
|
+
execFileSync("link.exe", ["/nologo", "/DLL", "/Brepro", `/OUT:${output}`, join(buildDir, "creation.obj"), join(buildDir, "system-id.obj"),
|
|
53
|
+
library, "kernel32.lib", "advapi32.lib", "windowsapp.lib"], { cwd: buildDir, stdio: "inherit" });
|
|
54
|
+
if (process.argv.includes("--test-controls")) {
|
|
55
|
+
const testDir = join(root, "build/test", `win32-${arch}`);
|
|
56
|
+
mkdirSync(testDir, { recursive: true });
|
|
57
|
+
execFileSync("cl.exe", ["/nologo", "/LD", "/O2", "/MT", "/W4", "/WX", "/std:c11",
|
|
58
|
+
`/I${include}`, `/Fo${join(buildDir, "query-denied.obj")}`, join(root, "smoke/fixtures/win32-query-denied.c"),
|
|
59
|
+
"/link", "/Brepro", `/OUT:${join(testDir, "query-denied.node")}`, library, "advapi32.lib"], { cwd: buildDir, stdio: "inherit" });
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
// The node-gyp shape of a macOS addon: a bundle whose Node-API symbols resolve at load. On arm64 the
|
|
63
|
+
// linker signs it ad hoc, as macOS requires of native code there.
|
|
64
|
+
execFileSync("xcrun", ["clang", "-bundle", "-undefined", "dynamic_lookup", "-arch", arch === "x64" ? "x86_64" : "arm64",
|
|
65
|
+
`-mmacosx-version-min=${darwinTarget}`, "-O2", "-std=c11", "-Wall", "-Wextra", "-Werror",
|
|
66
|
+
`-I${include}`, "-o", output, join(root, "native/darwin-process.c")], { cwd: buildDir, stdio: "inherit" });
|
|
50
67
|
}
|
|
51
68
|
const bytes = readFileSync(output);
|
|
52
|
-
const
|
|
69
|
+
const tool = (args) => execFileSync("xcrun", args, { encoding: "utf8" }).trim();
|
|
70
|
+
const receipt = { version: 1, platform, arch, nodeApi: 8,
|
|
53
71
|
source: execFileSync("git", ["rev-parse", "HEAD"], { cwd: root, encoding: "utf8" }).trim(),
|
|
54
72
|
sourceHashes: sourceHashes(), nodeHeaders: sdk.version, headersSha256: sdk.headers,
|
|
55
|
-
|
|
56
|
-
|
|
73
|
+
...(platform === "win32"
|
|
74
|
+
? { librarySha256: sdk.libraries[arch], compiler: process.env.VCToolsVersion.trim(), windowsSdk: process.env.WindowsSDKVersion.trim() }
|
|
75
|
+
: { compiler: tool(["clang", "--version"]).split("\n")[0], macosSdk: tool(["--show-sdk-version"]), deploymentTarget: darwinTarget }),
|
|
76
|
+
sha256: sha256(bytes) };
|
|
57
77
|
mkdirSync(dest, { recursive: true });
|
|
58
|
-
writeFileSync(join(dest,
|
|
78
|
+
writeFileSync(join(dest, nativeFile(platform)), bytes, { flag: "wx" });
|
|
59
79
|
writeFileSync(join(dest, "build.json"), JSON.stringify(receipt, null, 2) + "\n", { flag: "wx" });
|
|
60
|
-
verifyNative(arch, dest);
|
|
61
|
-
console.log(
|
|
80
|
+
verifyNative(platform, arch, dest);
|
|
81
|
+
console.log(`${name} built and verified (${arch}, Node-API 8)`);
|
|
62
82
|
} finally {
|
|
63
83
|
rmSync(temp, { recursive: true, force: true });
|
|
64
84
|
}
|
|
@@ -5,35 +5,55 @@ import { join } from "node:path";
|
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
|
|
7
7
|
export const root = fileURLToPath(new URL("..", import.meta.url));
|
|
8
|
-
export const sourceFiles = ["native/win32-process.c", "native/node-sdk.json", "scripts/build-native.mjs", "scripts/native-contract.mjs"];
|
|
8
|
+
export const sourceFiles = ["native/win32-process.c", "native/win32-system-id.cpp", "native/darwin-process.c", "native/node-sdk.json", "scripts/build-native.mjs", "scripts/native-contract.mjs"];
|
|
9
9
|
export const sha256 = (bytes) => createHash("sha256").update(bytes).digest("hex");
|
|
10
10
|
export const sourceHashes = () => Object.fromEntries(sourceFiles.map((path) => [path, sha256(readFileSync(join(root, path)))]));
|
|
11
11
|
export const sdk = JSON.parse(readFileSync(join(root, "native/node-sdk.json"), "utf8"));
|
|
12
|
+
/** The oldest macOS the binding loads on: Node 22's own macOS floor. */
|
|
13
|
+
export const darwinTarget = "11.0";
|
|
14
|
+
/** The binding file each platform ships, under `build/Release/<platform>-<arch>`. */
|
|
15
|
+
export const nativeFile = (platform) => (platform === "win32" ? "creation.node" : "process.node");
|
|
16
|
+
export const nativeDir = (platform, arch) => join(root, "build/Release", `${platform}-${arch}`);
|
|
17
|
+
const label = (platform) => (platform === "win32" ? "Windows identity" : "macOS process identity");
|
|
12
18
|
|
|
13
19
|
/** Verify bytes and their native build receipt before reuse, assembly or publication. */
|
|
14
|
-
export function verifyNative(arch, dir =
|
|
15
|
-
assert(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
export function verifyNative(platform, arch, dir = nativeDir(platform, arch), expectedSource) {
|
|
21
|
+
assert(platform === "win32" || platform === "darwin", `unsupported native platform: ${platform}`);
|
|
22
|
+
assert(arch === "x64" || arch === "arm64", `unsupported ${label(platform)} architecture: ${arch}`);
|
|
23
|
+
const bytes = readFileSync(join(dir, nativeFile(platform)));
|
|
24
|
+
if (platform === "win32") {
|
|
25
|
+
assert(bytes.length >= 64 && bytes.toString("ascii", 0, 2) === "MZ", "Windows identity binding is not a PE binary");
|
|
26
|
+
const offset = bytes.readUInt32LE(60);
|
|
27
|
+
assert(offset + 24 <= bytes.length && bytes.toString("ascii", offset, offset + 4) === "PE\0\0", "invalid Windows identity PE header");
|
|
28
|
+
assert.equal(bytes.readUInt16LE(offset + 4), arch === "x64" ? 0x8664 : 0xaa64, "Windows identity binding architecture mismatch");
|
|
29
|
+
assert(bytes.readUInt16LE(offset + 22) & 0x2000, "Windows identity binding is not a DLL");
|
|
30
|
+
} else {
|
|
31
|
+
// mach_header_64: MH_MAGIC_64, then cputype (CPU_TYPE_X86_64 or CPU_TYPE_ARM64) and, at 12, filetype MH_BUNDLE.
|
|
32
|
+
assert(bytes.length >= 32 && bytes.readUInt32LE(0) === 0xfeedfacf, "macOS process identity binding is not a 64-bit Mach-O binary");
|
|
33
|
+
assert.equal(bytes.readUInt32LE(4), arch === "x64" ? 0x01000007 : 0x0100000c, "macOS process identity binding architecture mismatch");
|
|
34
|
+
assert.equal(bytes.readUInt32LE(12), 8, "macOS process identity binding is not a loadable bundle");
|
|
35
|
+
}
|
|
22
36
|
const receipt = JSON.parse(readFileSync(join(dir, "build.json"), "utf8"));
|
|
23
37
|
assert.equal(receipt.version, 1);
|
|
24
|
-
assert.equal(receipt.platform,
|
|
38
|
+
assert.equal(receipt.platform, platform);
|
|
25
39
|
assert.equal(receipt.arch, arch);
|
|
26
40
|
assert.equal(receipt.nodeApi, 8);
|
|
27
41
|
assert.match(receipt.source, /^[a-f0-9]{40}$/);
|
|
28
|
-
if (expectedSource !== undefined) assert.equal(receipt.source, expectedSource,
|
|
29
|
-
assert.deepEqual(receipt.sourceHashes, sourceHashes(),
|
|
42
|
+
if (expectedSource !== undefined) assert.equal(receipt.source, expectedSource, `${label(platform)} native checkout provenance mismatch`);
|
|
43
|
+
assert.deepEqual(receipt.sourceHashes, sourceHashes(), `${label(platform)} native source provenance mismatch`);
|
|
30
44
|
assert.equal(receipt.nodeHeaders, sdk.version);
|
|
31
45
|
assert.equal(typeof receipt.compiler, "string");
|
|
32
46
|
assert(receipt.compiler.length > 0);
|
|
33
|
-
assert.equal(typeof receipt.windowsSdk, "string");
|
|
34
|
-
assert(receipt.windowsSdk.length > 0);
|
|
35
47
|
assert.equal(receipt.headersSha256, sdk.headers);
|
|
36
|
-
|
|
37
|
-
|
|
48
|
+
if (platform === "win32") {
|
|
49
|
+
assert.equal(typeof receipt.windowsSdk, "string");
|
|
50
|
+
assert(receipt.windowsSdk.length > 0);
|
|
51
|
+
assert.equal(receipt.librarySha256, sdk.libraries[arch]);
|
|
52
|
+
} else {
|
|
53
|
+
assert.equal(typeof receipt.macosSdk, "string");
|
|
54
|
+
assert(receipt.macosSdk.length > 0);
|
|
55
|
+
assert.equal(receipt.deploymentTarget, darwinTarget);
|
|
56
|
+
}
|
|
57
|
+
assert.equal(receipt.sha256, sha256(bytes), `${label(platform)} binary hash mismatch`);
|
|
38
58
|
return receipt;
|
|
39
59
|
}
|