mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-25 17:45:53 +01:00
When reusing a Codex sandbox, the workspace-restore step now performs an auth-merge check before adopting the sandbox's auth.json. The merge fails closed when: - host or sandbox Codex auth is unusable (missing token or account) - the subscription payload shapes differ between host and sandbox - subscription account identities do not match Additional hardening: node absence on PATH during the embedded decision script now exits non-zero instead of silently falling through. Co-change comments link parseAuth (the embedded script) to hasUsableAuthPayload (codex-home.ts) so a future auth-format change cannot silently diverge between the two implementations. Co-Authored-By: Paperclip <noreply@paperclip.ing>
45 lines
1.5 KiB
JavaScript
45 lines
1.5 KiB
JavaScript
#!/usr/bin/env -S node --import tsx
|
|
import { listLocalServiceRegistryRecords, removeLocalServiceRegistryRecord, terminateLocalService } from "../server/src/services/local-service-supervisor.ts";
|
|
import { repoRoot } from "./dev-service-profile.ts";
|
|
|
|
function toDisplayLines(records: Awaited<ReturnType<typeof listLocalServiceRegistryRecords>>) {
|
|
return records.map((record) => {
|
|
const childPid = typeof record.metadata?.childPid === "number" ? ` child=${record.metadata.childPid}` : "";
|
|
const url = typeof record.metadata?.url === "string" ? ` url=${record.metadata.url}` : "";
|
|
return `${record.serviceName} pid=${record.pid}${childPid} cwd=${record.cwd}${url}`;
|
|
});
|
|
}
|
|
|
|
const command = process.argv[2] ?? "list";
|
|
const records = await listLocalServiceRegistryRecords({
|
|
profileKind: "paperclip-dev",
|
|
metadata: { repoRoot },
|
|
});
|
|
|
|
if (command === "list") {
|
|
if (records.length === 0) {
|
|
console.log("No Paperclip dev services registered for this repo.");
|
|
process.exit(0);
|
|
}
|
|
for (const line of toDisplayLines(records)) {
|
|
console.log(line);
|
|
}
|
|
process.exit(0);
|
|
}
|
|
|
|
if (command === "stop") {
|
|
if (records.length === 0) {
|
|
console.log("No Paperclip dev services registered for this repo.");
|
|
process.exit(0);
|
|
}
|
|
for (const record of records) {
|
|
await terminateLocalService(record);
|
|
await removeLocalServiceRegistryRecord(record.serviceKey);
|
|
console.log(`Stopped ${record.serviceName} (pid ${record.pid})`);
|
|
}
|
|
process.exit(0);
|
|
}
|
|
|
|
console.error(`Unknown dev-service command: ${command}`);
|
|
process.exit(1);
|