@volter/supercode-orchestrator 0.5.204 → 0.5.205
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/apply/doors.mjs +25 -2
- package/package.json +1 -1
package/apply/doors.mjs
CHANGED
|
@@ -18,11 +18,14 @@ import { existsSync, readFileSync } from 'node:fs';
|
|
|
18
18
|
import { createConnection } from 'node:net';
|
|
19
19
|
import { dirname, join, resolve } from 'node:path';
|
|
20
20
|
import { fileURLToPath } from 'node:url';
|
|
21
|
+
import { redactText } from '@volter/teams/redact';
|
|
21
22
|
|
|
22
23
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
23
24
|
const MARK = '@@supercode-apply@@';
|
|
24
25
|
/** A door call's ceiling: Hermes's own functions answer in well under this. */
|
|
25
26
|
const DOOR_TIMEOUT_MS = 60_000;
|
|
27
|
+
// Redact the complete text before truncation: a length bound must not split a token before its detector sees it.
|
|
28
|
+
const diagnostic = text => redactText(String(text ?? '')).slice(0, 2000);
|
|
26
29
|
|
|
27
30
|
/** Hermes's schedule string for a declared schedule. */
|
|
28
31
|
export function hermesSchedule(schedule) {
|
|
@@ -223,8 +226,28 @@ export async function orchestratorDoor({ root, profile = 'default', load, socket
|
|
|
223
226
|
const op = async (name, args) => {
|
|
224
227
|
const live = await viaSocket(socket ?? join(root, 'orchestrator.sock'), { op: name, args, profile });
|
|
225
228
|
const answer = live ?? (() => {
|
|
226
|
-
|
|
227
|
-
|
|
229
|
+
// The applier may be imported by Bun (the install's keeper). The operator CLI needs Node's runtime,
|
|
230
|
+
// including node:sqlite; a caller's executable is not necessarily the CLI's interpreter.
|
|
231
|
+
const node = process.env.SUPERCODE_NODE_BIN?.trim()
|
|
232
|
+
|| (process.versions.bun || process.versions.deno ? 'node' : process.execPath);
|
|
233
|
+
const run = spawnSync(node, [bin, name, '--root', root, '--profile', profile, '--json', JSON.stringify(args)], { encoding: 'utf8', timeout: DOOR_TIMEOUT_MS });
|
|
234
|
+
let parsed;
|
|
235
|
+
try { parsed = JSON.parse((run.stdout ?? '').trim().split('\n').pop()); } catch { /* retained below */ }
|
|
236
|
+
if (run.error || run.signal || run.status !== 0 || typeof parsed?.ok !== 'boolean' || !parsed.ok) {
|
|
237
|
+
const details = [
|
|
238
|
+
run.error?.message && `spawn: ${diagnostic(run.error.message)}`,
|
|
239
|
+
run.signal && `signal ${run.signal}`,
|
|
240
|
+
parsed?.error && `refusal: ${diagnostic(typeof parsed.error === 'string' ? parsed.error : JSON.stringify(parsed.error))}`,
|
|
241
|
+
typeof parsed?.ok !== 'boolean' && 'no readable operator response',
|
|
242
|
+
typeof parsed?.ok !== 'boolean' && run.stdout?.trim() && `stdout: ${diagnostic(run.stdout)}`,
|
|
243
|
+
run.stderr?.trim() && `stderr: ${diagnostic(run.stderr)}`,
|
|
244
|
+
].filter(Boolean).join('; ');
|
|
245
|
+
throw Object.assign(new Error(`${name} via cold Node ${diagnostic(node)} failed (exit ${run.status ?? 'unknown'}): ${details}`), {
|
|
246
|
+
code: run.error?.code ?? (run.status || (parsed?.ok === false ? 'OPERATOR_REFUSED' : 'BAD_OPERATOR_RESPONSE')),
|
|
247
|
+
exitCode: run.status, signal: run.signal,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
return parsed;
|
|
228
251
|
})();
|
|
229
252
|
if (!answer.ok) throw new Error(answer.error);
|
|
230
253
|
return answer.result;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/supercode-orchestrator",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.205",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The orchestrator runtime over the Volter Harness ontology: one typed operational model whose folder is its serialization, read and written through the harness orchestration doors (docs/ORCHESTRATOR-IR.md)",
|
|
6
6
|
"exports": {
|