In the development host mode, protected checks and dependency installations ran directly as the operator. They run the agent's code: a test it wrote could read the home directory's secrets, reach the network, or plant Git configuration that the trusted Git commands after it would execute. With WF_HOST_CHECK_SANDBOX=true they run under Seatbelt instead. File contents in the home directory are unreadable except the command's own directory and the paths the operator lists; it may write only there, in the caches the operator lists and in a temporary directory of its own, never in a .git directory. Only installations reach the network; checks may use loopback ports by opt-in, for test suites that start local servers. The platform's own ports (control plane, Temporal and its web UI, database, object storage, provisioner, Git service, IDE, console) stay blocked in any case: the local start lists them from their configured addresses. Checks get no answer from the keychain, and a command whose home is the executor's (holding its credentials) gets a private one. A sandbox that cannot start leaves the run waiting on infrastructure; verification evidence records checkSandbox. scripts/check-host-check-sandbox.ts checks all of this on the target Mac, from outside the sandbox, then runs the POC's installation and checks sandboxed on a recent droboticflow source. Enabled on the local POC, a real wish passed through both, including a repair round for the agent's own failing tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
88 lines
3.1 KiB
JavaScript
88 lines
3.1 KiB
JavaScript
import { resolve } from 'node:path';
|
|
import { environment, loadLocalEnvironment, platformPorts, startServices, webListener } from './local-services.mjs';
|
|
|
|
loadLocalEnvironment();
|
|
const root = process.cwd();
|
|
const productionWeb = process.env.WF_WEB_SERVE_MODE === 'production';
|
|
if (process.env.WF_WEB_SERVE_MODE && !['production', 'development'].includes(process.env.WF_WEB_SERVE_MODE))
|
|
throw new Error('WF_WEB_SERVE_MODE must be production or development.');
|
|
const web = webListener();
|
|
const worker = (role, token) => ({
|
|
name: role,
|
|
cwd: root,
|
|
args: ['--import', 'tsx', 'apps/worker/src/main.ts'],
|
|
env: environment([/^TEMPORAL_/, /^WF_CONTROL_PLANE_URL$/, /^WF_DISPATCH_TENANTS$/], {
|
|
WF_WORKER_ROLE: role,
|
|
[token]: process.env[token],
|
|
}),
|
|
});
|
|
await startServices(
|
|
[
|
|
{
|
|
name: 'git',
|
|
cwd: root,
|
|
args: ['--import', 'tsx', 'apps/git-service/src/main.ts'],
|
|
env: environment([/^WF_GIT_/]),
|
|
url: 'http://127.0.0.1:4504/health',
|
|
identity: 'git-storage',
|
|
},
|
|
{
|
|
name: 'api',
|
|
cwd: resolve(root, 'apps/api'),
|
|
args: ['--import', 'tsx', 'src/main.ts'],
|
|
env: environment([/^DATABASE_URL$/, /^WF_/, /^S3_/, /^OIDC_/, /^TEMPORAL_/, /^VAULT_/, /^PORT$/, /^HOST$/]),
|
|
url: 'http://127.0.0.1:4000/health',
|
|
identity: 'wishforge-control-plane',
|
|
},
|
|
{
|
|
name: 'provisioner',
|
|
cwd: root,
|
|
args: ['apps/provisioner/main.mjs'],
|
|
env: environment(
|
|
[
|
|
/^WF_PROVISIONER_/,
|
|
/^WF_LOCAL_/,
|
|
/^WF_TENANT_ID$/,
|
|
/^WF_RESOURCE_GRANT_SECRET$/,
|
|
/^WF_CONTROL_PLANE_URL$/,
|
|
/^TEMPORAL_/,
|
|
/^WF_GIT_ALLOW_LOCAL_HTTP$/,
|
|
/^WF_CODEBUDDY_BIN$/,
|
|
/^WF_CLAUDE_BIN$/,
|
|
/^WF_CLAUDE_LOCAL_AUTH_HOME$/,
|
|
/^WF_CLAUDE_COMMAND_(SANDBOX|READ_PATHS|ENV)$/,
|
|
/^WF_HOST_CHECK_(SANDBOX|READ_PATHS|WRITE_PATHS|LOOPBACK)$/,
|
|
],
|
|
{
|
|
// Sandboxed checks never reach the platform's own services, whatever the operator listed.
|
|
WF_HOST_CHECK_BLOCKED_PORTS: platformPorts().join(','),
|
|
},
|
|
),
|
|
url: 'http://127.0.0.1:4450/healthz',
|
|
identity: 'wishforge-provisioner',
|
|
},
|
|
worker('coordinator', 'WF_WORKER_TOKEN'),
|
|
worker('deployer', 'WF_DEPLOYER_TOKEN'),
|
|
{
|
|
name: 'web',
|
|
cwd: resolve(root, 'apps/web'),
|
|
args: [
|
|
resolve(root, 'node_modules/next/dist/bin/next'),
|
|
productionWeb ? 'start' : 'dev',
|
|
'--hostname',
|
|
web.host,
|
|
'--port',
|
|
String(web.port),
|
|
],
|
|
env: environment(
|
|
[/^WF_LOCAL_ACCESS$/, /^WF_LOCAL_ACCESS_FILE$/, /^WF_LOCAL_ALLOWED_ORIGINS$/, /^WF_LOCAL_API_TOKEN$/],
|
|
{ NODE_ENV: productionWeb ? 'production' : 'development' },
|
|
),
|
|
url: `http://${web.probe}:${web.port}${process.env.WF_LOCAL_ACCESS === 'true' ? '/login' : '/api/session'}`,
|
|
},
|
|
],
|
|
`WishForge console: http://localhost:${web.port} · API: http://127.0.0.1:4000 · Temporal: http://127.0.0.1:8233`,
|
|
// The LaunchAgent supervisor starts every service itself; one already answering is a leftover.
|
|
{ reuse: process.env.WF_LOCAL_REUSE_SERVICES !== 'false' },
|
|
);
|