@volter/supercode-orchestrator 0.4.8 → 0.4.9
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/activation.mjs +34 -1
- package/index.d.ts +6 -0
- package/index.mjs +1 -1
- package/kanban-worker.mjs +3 -3
- package/loop.mjs +5 -3
- package/package.json +1 -1
package/activation.mjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// subfolder named by its id, pointed at through the harness's own env var.
|
|
4
4
|
|
|
5
5
|
import { join, relative, resolve } from 'node:path';
|
|
6
|
+
import { homedir } from 'node:os';
|
|
6
7
|
import { mkdirSync, readFileSync, readdirSync, lstatSync, rmSync, writeFileSync, existsSync } from 'node:fs';
|
|
7
8
|
import { CLAUDE_BRIDGE, linkTo, skillSources } from './hermes-home.mjs';
|
|
8
9
|
|
|
@@ -40,7 +41,10 @@ export function activationEnv({ root, profile, surfaceKey, vault }) {
|
|
|
40
41
|
const env = {};
|
|
41
42
|
const worker = profile.worker;
|
|
42
43
|
const homeVar = HOME_ENV[worker.harness];
|
|
43
|
-
|
|
44
|
+
// `home: user` keeps the user's own harness home (their CLAUDE.md, skills, hooks, plugins, MCP servers and login);
|
|
45
|
+
// the profile's persona and skills come in beside it through the launch (userHomeArguments).
|
|
46
|
+
if (worker.home === 'user') env.HOME = homedir();
|
|
47
|
+
else if (homeVar) env[homeVar] = join(profile.dir, worker.harness);
|
|
44
48
|
for (const [k, v] of Object.entries(worker.env ?? {})) env[k] = resolveRef(v, vault);
|
|
45
49
|
env[ORCH_ENV.root] = root;
|
|
46
50
|
env[ORCH_ENV.profile] = profile.name;
|
|
@@ -91,6 +95,28 @@ export function materializePersona(profile) {
|
|
|
91
95
|
*/
|
|
92
96
|
export const HOME_SKILLS = Object.freeze({ codex: 'skills', 'claude-code': 'skills' });
|
|
93
97
|
|
|
98
|
+
/** The harnesses a worker can run in the user's own home, with the profile brought in beside it. */
|
|
99
|
+
export const USER_HOME_HARNESSES = Object.freeze(new Set(['claude-code']));
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* The launch arguments that bring a profile's skills in beside the user's own Claude home (`home: user`): its
|
|
103
|
+
* skills folder as a session plugin (Claude Code's `--plugin-dir`; the folder carries the plugin manifest
|
|
104
|
+
* materializeSkills writes). Nothing for a worker in the profile's home.
|
|
105
|
+
*/
|
|
106
|
+
export function userHomeArguments(profile) {
|
|
107
|
+
const worker = profile.worker;
|
|
108
|
+
if (worker?.home !== 'user') return [];
|
|
109
|
+
if (!USER_HOME_HARNESSES.has(worker.harness)) throw new Error(`worker.home: user is not available for ${worker.harness} workers`);
|
|
110
|
+
return ['--plugin-dir', join(profile.dir, worker.harness)];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** The persona a worker in the user's own home carries in its system prompt (its home's CLAUDE.md is the user's). */
|
|
114
|
+
export function userHomePersona(profile) {
|
|
115
|
+
if (profile.worker?.home !== 'user') return '';
|
|
116
|
+
const persona = join(profile.dir, 'AGENTS.md');
|
|
117
|
+
return existsSync(persona) ? readFileSync(persona, 'utf8').trim() : '';
|
|
118
|
+
}
|
|
119
|
+
|
|
94
120
|
export function materializeSkills(profile) {
|
|
95
121
|
const worker = profile.worker;
|
|
96
122
|
const sub = worker && HOME_SKILLS[worker.harness];
|
|
@@ -98,6 +124,13 @@ export function materializeSkills(profile) {
|
|
|
98
124
|
const sources = skillSources(profile.dir);
|
|
99
125
|
const into = join(profile.dir, worker.harness, sub);
|
|
100
126
|
mkdirSync(into, { recursive: true });
|
|
127
|
+
// In the user's own home the folder is loaded as a session plugin, which needs its manifest.
|
|
128
|
+
if (worker.home === 'user') {
|
|
129
|
+
const manifest = join(profile.dir, worker.harness, '.claude-plugin', 'plugin.json');
|
|
130
|
+
const text = `${JSON.stringify({ name: profile.name, description: `The ${profile.name} profile's skills` }, null, 2)}\n`;
|
|
131
|
+
mkdirSync(join(profile.dir, worker.harness, '.claude-plugin'), { recursive: true });
|
|
132
|
+
if (!existsSync(manifest) || readFileSync(manifest, 'utf8') !== text) writeFileSync(manifest, text);
|
|
133
|
+
}
|
|
101
134
|
for (const [name, from] of sources) linkTo(join(into, name), relative(into, from));
|
|
102
135
|
for (const entry of readdirSync(into)) {
|
|
103
136
|
const path = join(into, entry);
|
package/index.d.ts
CHANGED
|
@@ -195,6 +195,12 @@ export function materializePersona(profile: Profile): Path | null;
|
|
|
195
195
|
export const HOME_ENV: Readonly<Record<HarnessId, string>>;
|
|
196
196
|
/** Links each skill the profile has into the worker's config home `skills/` (Codex, Claude Code); answers that folder, or null. */
|
|
197
197
|
export function materializeSkills(profile: Profile): Path | null;
|
|
198
|
+
/** Harnesses whose worker can run in the user's own home (`worker.home: user`). */
|
|
199
|
+
export const USER_HOME_HARNESSES: ReadonlySet<string>;
|
|
200
|
+
/** `--plugin-dir <profile>/<harness>` for a worker in the user's own home; nothing otherwise. */
|
|
201
|
+
export function userHomeArguments(profile: { dir: string; worker?: { harness: string; home?: 'profile' | 'user' } }): string[];
|
|
202
|
+
/** The profile's persona text for a worker in the user's own home; empty otherwise. */
|
|
203
|
+
export function userHomePersona(profile: { dir: string; worker?: { harness: string; home?: 'profile' | 'user' } }): string;
|
|
198
204
|
export const HOME_SKILLS: Readonly<Record<HarnessId, string>>;
|
|
199
205
|
export const HOME_PERSONA: Readonly<Record<HarnessId, Readonly<Record<string, 'link' | 'bridge'>>>>;
|
|
200
206
|
export const ORCH_ENV: Readonly<{ root: string; profile: string; surface: string }>;
|
package/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ export { load, save, compile, importFrom, exportTo, closeWorld, retainWorld, rel
|
|
|
7
7
|
export { step, expired, leaseId, accessPolicy, dmBehavior } from './reducer.mjs';
|
|
8
8
|
export * as events from './events.mjs';
|
|
9
9
|
export { parseCommand, frame, COMMANDS, REPLY } from './commands.mjs';
|
|
10
|
-
export { activationEnv, activationCwd, materializePersona, materializeSkills, HOME_ENV, HOME_PERSONA, HOME_SKILLS, ORCH_ENV } from './activation.mjs';
|
|
10
|
+
export { activationEnv, activationCwd, materializePersona, materializeSkills, HOME_ENV, HOME_PERSONA, HOME_SKILLS, ORCH_ENV, USER_HOME_HARNESSES, userHomeArguments, userHomePersona } from './activation.mjs';
|
|
11
11
|
export { Orchestrator, normalizeWorkerEvent, webhookPort, TICK_MS } from './loop.mjs';
|
|
12
12
|
export {
|
|
13
13
|
cronTick, dueJobs, nextRunAt, parseCron, scheduleError, claimFire, finishFire, advanceSchedule, resolveTarget,
|
package/kanban-worker.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import { existsSync, statSync } from 'node:fs';
|
|
|
12
12
|
import { basename, dirname, join, resolve } from 'node:path';
|
|
13
13
|
import { SupercodeHarnessClient } from '@volter/supercode-harness-sdk';
|
|
14
14
|
import { load } from './orchestration.mjs';
|
|
15
|
-
import { INSTRUCTION_ARGUMENTS, activationCwd, activationEnv, sandboxArguments, approvalPolicy, limitArguments, materializePersona, materializeSkills, modelArguments, turnCounter } from './activation.mjs';
|
|
15
|
+
import { INSTRUCTION_ARGUMENTS, activationCwd, activationEnv, sandboxArguments, approvalPolicy, limitArguments, materializePersona, materializeSkills, modelArguments, turnCounter, userHomeArguments, userHomePersona } from './activation.mjs';
|
|
16
16
|
import { workerRoute } from './worker-route.mjs';
|
|
17
17
|
import { KANBAN_ENV, untrustedServerVerdict, hermesApproval, hermesInstall, hermesToolEnv, kanbanPrompt, memorySnapshot, mirrorSession } from './hermes-cli.mjs';
|
|
18
18
|
import { mountOrchestratorMcp } from './mcp/mount.mjs';
|
|
@@ -68,7 +68,7 @@ export async function runKanbanWorker(argv, env = process.env) {
|
|
|
68
68
|
// Hermes's system prompt for a dispatched worker: the home's memory, the task protocol, the task's skills
|
|
69
69
|
const memory = await memorySnapshot(profile.dir).catch(() => '');
|
|
70
70
|
const board = await kanbanPrompt(profile.dir, { skills: args.skills, task: taskId, env: task });
|
|
71
|
-
const instructions = [memory, board.guidance, board.skills].filter(Boolean).join('\n\n');
|
|
71
|
+
const instructions = [userHomePersona(profile), memory, board.guidance, board.skills].filter(Boolean).join('\n\n');
|
|
72
72
|
|
|
73
73
|
const client = new SupercodeHarnessClient(env.SUPERCODE_BIN ? { command: env.SUPERCODE_BIN } : {});
|
|
74
74
|
try {
|
|
@@ -85,7 +85,7 @@ async function runTurn({ client, profile, harness, worker, route, root, vault, s
|
|
|
85
85
|
const reasoning = args.reasoning && harness === 'codex' ? ['-c', `model_reasoning_effort=${JSON.stringify(args.reasoning)}`] : [];
|
|
86
86
|
const launch = {
|
|
87
87
|
program: base.program,
|
|
88
|
-
arguments: [...(base.arguments ?? []), ...modelArguments(worker), ...route.args, ...(instructions && INSTRUCTION_ARGUMENTS[harness] ? INSTRUCTION_ARGUMENTS[harness](instructions) : []), ...reasoning, ...sandboxArguments(profile, harness), ...limitArguments(profile, worker, (level, line) => say(line))],
|
|
88
|
+
arguments: [...(base.arguments ?? []), ...modelArguments(worker), ...route.args, ...(instructions && INSTRUCTION_ARGUMENTS[harness] ? INSTRUCTION_ARGUMENTS[harness](instructions) : []), ...userHomeArguments(profile), ...reasoning, ...sandboxArguments(profile, harness), ...limitArguments(profile, worker, (level, line) => say(line))],
|
|
89
89
|
env: { ...(base.env ?? {}), ...runEnv },
|
|
90
90
|
};
|
|
91
91
|
const mount = mountOrchestratorMcp({ root, profile, harness, surfaceKey, launch, vault, task });
|
package/loop.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { basename, join, dirname } from 'node:path';
|
|
|
9
9
|
import { step, leaseId } from './reducer.mjs';
|
|
10
10
|
import * as events from './events.mjs';
|
|
11
11
|
import { save, retainWorld, releaseWorld } from './orchestration.mjs';
|
|
12
|
-
import { INSTRUCTION_ARGUMENTS, NAME_ARGUMENTS, activationEnv, activationCwd, approvalPolicy, sandboxArguments, limitArguments, materializePersona, materializeSkills, modelArguments, turnCounter } from './activation.mjs';
|
|
12
|
+
import { INSTRUCTION_ARGUMENTS, NAME_ARGUMENTS, activationEnv, activationCwd, approvalPolicy, sandboxArguments, limitArguments, materializePersona, materializeSkills, modelArguments, turnCounter, userHomeArguments, userHomePersona } from './activation.mjs';
|
|
13
13
|
import { workerRoute } from './worker-route.mjs';
|
|
14
14
|
import { hermesAccess, hermesApproval, untrustedServerVerdict, hermesToolEnv, memorySnapshot, mirrorSession, mirrorState, recordIncident, sealMirror } from './hermes-cli.mjs';
|
|
15
15
|
import { hermesSessionKey } from './ir.mjs';
|
|
@@ -323,9 +323,11 @@ export class Orchestrator {
|
|
|
323
323
|
const env = { ...tools, ...activationEnv({ root: this.state.root, profile, surfaceKey: keyString, vault: this.vault }), ...route.env };
|
|
324
324
|
// the home's memory, as Hermes's agent carries it into a session (row 13)
|
|
325
325
|
const memory = INSTRUCTION_ARGUMENTS[worker.harness] ? await memorySnapshot(profile.dir).catch((error) => { this.log('warn', `memory ${keyString}: ${error.message}`); return ''; }) : '';
|
|
326
|
-
|
|
326
|
+
// a worker in the user's own home carries its persona there too (its config home's CLAUDE.md is the user's)
|
|
327
|
+
const instructionText = [userHomePersona(profile), memory].filter(Boolean).join('\n\n');
|
|
328
|
+
const instructions = instructionText && INSTRUCTION_ARGUMENTS[worker.harness] ? INSTRUCTION_ARGUMENTS[worker.harness](instructionText) : [];
|
|
327
329
|
const naming = NAME_ARGUMENTS[worker.harness]?.(basename(this.state.root)) ?? [];
|
|
328
|
-
launch = await this.resolveLaunch(profile, { ...worker, model: route.model }, env, [...route.args, ...instructions, ...naming]);
|
|
330
|
+
launch = await this.resolveLaunch(profile, { ...worker, model: route.model }, env, [...route.args, ...instructions, ...naming, ...userHomeArguments(profile)]);
|
|
329
331
|
} catch (error) {
|
|
330
332
|
this.enqueue(events.worker({ profile: profileName, keyString, runtime_id: null, ev: { kind: 'error', message: `start failed: ${error.message}` }, at: this.clock() }));
|
|
331
333
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/supercode-orchestrator",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
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": {
|