@vellumai/cli 0.12.1-dev.202609161913.e2258d9 → 0.12.1-dev.202609162115.4edf01d
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/package.json
CHANGED
|
@@ -83,6 +83,7 @@ describe("buildServiceRunArgs — assistant", () => {
|
|
|
83
83
|
const args = buildAssistantArgs();
|
|
84
84
|
expect(args).toContain("IS_CONTAINERIZED=true");
|
|
85
85
|
expect(args).toContain("VELLUM_WORKSPACE_DIR=/workspace");
|
|
86
|
+
expect(args).toContain("CES_BOOTSTRAP_SOCKET_DIR=/run/ces-bootstrap");
|
|
86
87
|
expect(args).toContain(`VELLUM_ASSISTANT_NAME=${instanceName}`);
|
|
87
88
|
});
|
|
88
89
|
|
|
@@ -9,6 +9,8 @@ import { tmpdir } from "node:os";
|
|
|
9
9
|
import { join } from "node:path";
|
|
10
10
|
import { afterAll, beforeAll, describe, expect, mock, test } from "bun:test";
|
|
11
11
|
|
|
12
|
+
import { resolveIpcEndpoint } from "@vellumai/ipc-server-utils";
|
|
13
|
+
|
|
12
14
|
import { resolveCesSocketPath, startCes } from "../local.js";
|
|
13
15
|
|
|
14
16
|
// ---------------------------------------------------------------------------
|
|
@@ -106,7 +108,7 @@ describe("startCes", () => {
|
|
|
106
108
|
// startCes unlinks the stale socket, then polls for it. We create it with
|
|
107
109
|
// a slight delay so the poll catches it.
|
|
108
110
|
setTimeout(() => {
|
|
109
|
-
const socketDir = join(vellumDir, "
|
|
111
|
+
const socketDir = join(vellumDir, "protected", "credential-executor");
|
|
110
112
|
mkdirSync(socketDir, { recursive: true });
|
|
111
113
|
writeFileSync(join(socketDir, "ces.sock"), "");
|
|
112
114
|
}, 50);
|
|
@@ -126,7 +128,9 @@ describe("startCes", () => {
|
|
|
126
128
|
|
|
127
129
|
// Verify env vars
|
|
128
130
|
const env = lastSpawnCall!.options.env!;
|
|
129
|
-
expect(env["
|
|
131
|
+
expect(env["CES_BOOTSTRAP_SOCKET_DIR"]).toBe(
|
|
132
|
+
join(tempDir, ".vellum", "protected", "credential-executor"),
|
|
133
|
+
);
|
|
130
134
|
expect(env["CREDENTIAL_SECURITY_DIR"]).toBeDefined();
|
|
131
135
|
expect(env["VELLUM_WORKSPACE_DIR"]).toBeDefined();
|
|
132
136
|
|
|
@@ -143,4 +147,23 @@ describe("startCes", () => {
|
|
|
143
147
|
expect(socketPath.startsWith("\\\\.\\pipe\\vellum-ces-")).toBe(true);
|
|
144
148
|
expect(socketPath).not.toContain("Example");
|
|
145
149
|
});
|
|
150
|
+
|
|
151
|
+
test("POSIX local CES seam matches resolveIpcEndpoint", () => {
|
|
152
|
+
const resources = {
|
|
153
|
+
instanceDir: "/tmp/assistant-123",
|
|
154
|
+
} as Parameters<typeof resolveCesSocketPath>[0];
|
|
155
|
+
|
|
156
|
+
const socketPath = resolveCesSocketPath(resources, "linux");
|
|
157
|
+
expect(socketPath).toBe(
|
|
158
|
+
resolveIpcEndpoint("ces", {
|
|
159
|
+
workspaceDir: join(
|
|
160
|
+
"/tmp/assistant-123",
|
|
161
|
+
".vellum",
|
|
162
|
+
"protected",
|
|
163
|
+
"credential-executor",
|
|
164
|
+
),
|
|
165
|
+
platform: "linux",
|
|
166
|
+
}).path,
|
|
167
|
+
);
|
|
168
|
+
});
|
|
146
169
|
});
|
package/src/lib/local.ts
CHANGED
|
@@ -606,6 +606,24 @@ type DaemonStartOptions = {
|
|
|
606
606
|
signingKey?: string;
|
|
607
607
|
};
|
|
608
608
|
|
|
609
|
+
/**
|
|
610
|
+
* Directory that holds the local CES Unix socket (`ces.sock`).
|
|
611
|
+
*
|
|
612
|
+
* Matches CES's local data root: `{CREDENTIAL_SECURITY_DIR}/credential-executor`.
|
|
613
|
+
* Local CLI and managed sidecars share `CES_BOOTSTRAP_SOCKET_DIR`; this is the
|
|
614
|
+
* writable per-instance directory used outside containers.
|
|
615
|
+
*/
|
|
616
|
+
function resolveCesBootstrapSocketDir(
|
|
617
|
+
resources?: LocalInstanceResources,
|
|
618
|
+
env?: Record<string, string | undefined>,
|
|
619
|
+
): string {
|
|
620
|
+
const securityDir = resources
|
|
621
|
+
? join(resources.instanceDir, ".vellum", "protected")
|
|
622
|
+
: env?.CREDENTIAL_SECURITY_DIR?.trim() ||
|
|
623
|
+
join(homedir(), ".vellum", "protected");
|
|
624
|
+
return join(securityDir, "credential-executor");
|
|
625
|
+
}
|
|
626
|
+
|
|
609
627
|
/**
|
|
610
628
|
* Apply per-instance resource overrides and shared daemon options to an
|
|
611
629
|
* environment object. Called from all daemon spawn paths (source, watch,
|
|
@@ -644,11 +662,10 @@ function applyDaemonEnvOverrides(
|
|
|
644
662
|
env.VELLUM_DEFAULT_WORKSPACE_CONFIG_PATH =
|
|
645
663
|
options.defaultWorkspaceConfigPath;
|
|
646
664
|
}
|
|
647
|
-
//
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
env.CES_LOCAL_SOCKET = resolveCesSocketPath(resources);
|
|
665
|
+
// CES and the assistant resolve the socket from CES_BOOTSTRAP_SOCKET_DIR.
|
|
666
|
+
const bootstrapDir = resolveCesBootstrapSocketDir(resources, env);
|
|
667
|
+
env.CES_BOOTSTRAP_SOCKET_DIR = bootstrapDir;
|
|
668
|
+
mkdirSync(bootstrapDir, { recursive: true });
|
|
652
669
|
applyIpcSocketDirOverride(env);
|
|
653
670
|
}
|
|
654
671
|
|
|
@@ -1022,26 +1039,18 @@ function resolveCesDir(resources?: LocalInstanceResources): string {
|
|
|
1022
1039
|
|
|
1023
1040
|
/**
|
|
1024
1041
|
* Resolve the local IPC endpoint shared by the CLI-launched CES sibling and
|
|
1025
|
-
* assistant.
|
|
1026
|
-
*
|
|
1042
|
+
* assistant. CES binds this path from `CES_BOOTSTRAP_SOCKET_DIR` via the same
|
|
1043
|
+
* `resolveIpcEndpoint("ces")` helper. Windows uses a named pipe. POSIX uses
|
|
1044
|
+
* a Unix socket, including the shared macOS AF_UNIX fallback.
|
|
1027
1045
|
*/
|
|
1028
1046
|
export function resolveCesSocketPath(
|
|
1029
1047
|
resources?: LocalInstanceResources,
|
|
1030
1048
|
hostPlatform: NodeJS.Platform = platform(),
|
|
1031
1049
|
): string {
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
:
|
|
1035
|
-
|
|
1036
|
-
return resolveIpcEndpoint("ces", {
|
|
1037
|
-
workspaceDir,
|
|
1038
|
-
platform: hostPlatform,
|
|
1039
|
-
}).path;
|
|
1040
|
-
}
|
|
1041
|
-
const override = computeIpcSocketDirOverride(workspaceDir);
|
|
1042
|
-
const socketDir = override ?? workspaceDir;
|
|
1043
|
-
mkdirSync(socketDir, { recursive: true });
|
|
1044
|
-
return join(socketDir, "ces.sock");
|
|
1050
|
+
return resolveIpcEndpoint("ces", {
|
|
1051
|
+
workspaceDir: resolveCesBootstrapSocketDir(resources),
|
|
1052
|
+
platform: hostPlatform,
|
|
1053
|
+
}).path;
|
|
1045
1054
|
}
|
|
1046
1055
|
|
|
1047
1056
|
async function isIpcEndpointReady(endpointPath: string): Promise<boolean> {
|
|
@@ -1101,13 +1110,15 @@ export async function startCes(
|
|
|
1101
1110
|
const workspaceDir = resources
|
|
1102
1111
|
? join(resources.instanceDir, ".vellum", "workspace")
|
|
1103
1112
|
: join(homedir(), ".vellum", "workspace");
|
|
1113
|
+
const bootstrapDir = resolveCesBootstrapSocketDir(resources);
|
|
1104
1114
|
mkdirSync(securityDir, { recursive: true });
|
|
1115
|
+
mkdirSync(bootstrapDir, { recursive: true });
|
|
1105
1116
|
|
|
1106
1117
|
const cesEnv: Record<string, string | undefined> = {
|
|
1107
1118
|
...process.env,
|
|
1108
|
-
CES_LOCAL_SOCKET: socketPath,
|
|
1109
1119
|
CREDENTIAL_SECURITY_DIR: securityDir,
|
|
1110
1120
|
VELLUM_WORKSPACE_DIR: workspaceDir,
|
|
1121
|
+
CES_BOOTSTRAP_SOCKET_DIR: bootstrapDir,
|
|
1111
1122
|
};
|
|
1112
1123
|
|
|
1113
1124
|
let ces;
|
package/src/lib/statefulset.ts
CHANGED
|
@@ -187,6 +187,7 @@ export const DOCKER_STATEFUL_SET_SPEC: DockerStatefulSetSpec = {
|
|
|
187
187
|
{ kind: "static", name: "VELLUM_BACKUP_DIR", value: "/workspace/.backups" },
|
|
188
188
|
{ kind: "static", name: "VELLUM_BACKUP_KEY_PATH", value: "/workspace/.backup.key" },
|
|
189
189
|
{ kind: "static", name: "CES_CREDENTIAL_URL", value: "http://localhost:8090" },
|
|
190
|
+
{ kind: "static", name: "CES_BOOTSTRAP_SOCKET_DIR", value: "/run/ces-bootstrap" },
|
|
190
191
|
{ kind: "static", name: "GATEWAY_IPC_SOCKET_DIR", value: "/run/gateway-ipc" },
|
|
191
192
|
{ kind: "static", name: "ASSISTANT_IPC_SOCKET_DIR", value: "/run/assistant-ipc" },
|
|
192
193
|
{ kind: "secret", name: "CES_SERVICE_TOKEN", secret: "cesServiceToken" },
|