@volter/supercode-orchestrator 0.4.10 → 0.4.11

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 CHANGED
@@ -6,6 +6,7 @@ import { join, relative, resolve } from 'node:path';
6
6
  import { homedir } from 'node:os';
7
7
  import { mkdirSync, readFileSync, readdirSync, lstatSync, rmSync, writeFileSync, existsSync } from 'node:fs';
8
8
  import { CLAUDE_BRIDGE, linkTo, skillSources } from './hermes-home.mjs';
9
+ import { ownLogin } from './worker-route.mjs';
9
10
 
10
11
  /** Which env var each harness reads its config home from (supercode registry evidence). */
11
12
  export const HOME_ENV = Object.freeze({
@@ -44,7 +45,8 @@ export function activationEnv({ root, profile, surfaceKey, vault }) {
44
45
  // `home: user` keeps the user's own harness home (their CLAUDE.md, skills, hooks, plugins, MCP servers and login);
45
46
  // the profile's persona and skills come in beside it through the launch (userHomeArguments).
46
47
  if (worker.home === 'user') env.HOME = homedir();
47
- else if (homeVar) env[homeVar] = join(profile.dir, worker.harness);
48
+ // a worker on its user's own login keeps that user's config home (worker-route.mjs `ownLogin`)
49
+ else if (homeVar && !ownLogin(profile)) env[homeVar] = join(profile.dir, worker.harness);
48
50
  for (const [k, v] of Object.entries(worker.env ?? {})) env[k] = resolveRef(v, vault);
49
51
  env[ORCH_ENV.root] = root;
50
52
  env[ORCH_ENV.profile] = profile.name;
@@ -131,10 +133,15 @@ export function materializeSkills(profile) {
131
133
  mkdirSync(join(profile.dir, worker.harness, '.claude-plugin'), { recursive: true });
132
134
  if (!existsSync(manifest) || readFileSync(manifest, 'utf8') !== text) writeFileSync(manifest, text);
133
135
  }
134
- for (const [name, from] of sources) linkTo(join(into, name), relative(into, from));
135
- for (const entry of readdirSync(into)) {
136
- const path = join(into, entry);
137
- if (lstatSync(path).isSymbolicLink() && !sources.has(entry) && !existsSync(path)) rmSync(path, { force: true });
136
+ // A worker on its user's own login reads them from the `--add-dir`ed Claude home's `.claude/skills` (worker-route.mjs
137
+ // `ownLogin`), linked beside `skills/`, which the orchestrator's own skill lookup still reads.
138
+ for (const folder of [into, ...(ownLogin(profile) ? [join(profile.dir, worker.harness, '.claude', 'skills')] : [])]) {
139
+ mkdirSync(folder, { recursive: true });
140
+ for (const [name, from] of sources) linkTo(join(folder, name), relative(folder, from));
141
+ for (const entry of readdirSync(folder)) {
142
+ const path = join(folder, entry);
143
+ if (lstatSync(path).isSymbolicLink() && !sources.has(entry) && !existsSync(path)) rmSync(path, { force: true });
144
+ }
138
145
  }
139
146
  return into;
140
147
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-orchestrator",
3
- "version": "0.4.10",
3
+ "version": "0.4.11",
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": {
package/worker-route.mjs CHANGED
@@ -91,9 +91,27 @@ export function workerRoute(profile, worker, vault) {
91
91
  return { model, args: ['-c', `model_provider=${JSON.stringify(id)}`], env };
92
92
  }
93
93
 
94
- /** Claude Code's route: its own environment and the endpoint's Messages wire. */
94
+ /**
95
+ * Whether a Claude Code worker runs on its user's own Claude login: `provider: anthropic` with no endpoint and no key,
96
+ * in the profile's home (a `home: user` worker is in that user's home already). The runhuman lobby managers run so.
97
+ * Claude Code finds its login through its config home, and a `CLAUDE_CONFIG_DIR` of the profile's own reports "Not
98
+ * logged in" (measured, claude 2.1.280), so the worker keeps its user's config home and the profile's reaches it by
99
+ * flag: `--add-dir` the profile's Claude home (its `CLAUDE.md`, read there under
100
+ * `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD`, and its `.claude/skills`), `--setting-sources project,local` so that
101
+ * user's own settings, hooks and `CLAUDE.md` stay out, and `--strict-mcp-config` so only the MCP door's servers mount.
102
+ */
103
+ export function ownLogin(profile, worker = profile?.worker) {
104
+ const route = hermesModel(profile);
105
+ return worker?.harness === 'claude-code' && worker?.home !== 'user' && route?.provider === 'anthropic' && !route.base_url && !route.api_key;
106
+ }
107
+
108
+ /** Claude Code's route: its own environment, the endpoint's Messages wire, or its user's own login (`ownLogin`). */
95
109
  function claudeRoute(profile, route, model, vault) {
96
110
  if (!['custom', 'anthropic'].includes(route.provider)) throw new Error(`model.provider ${route.provider} has no Claude Code route in this orchestrator yet; refused rather than run on Claude Code's default`);
111
+ if (ownLogin(profile, { ...profile.worker, harness: 'claude-code' })) {
112
+ const env = { CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD: '1', ...(model ? { ANTHROPIC_MODEL: model } : {}) };
113
+ return { model, args: ['--add-dir', join(profile.dir, 'claude-code'), '--setting-sources', 'project,local', '--strict-mcp-config'], env };
114
+ }
97
115
  if (!route.base_url) throw new Error('Claude Code runs on a model with an endpoint (model.base_url); refused rather than run on Claude Code\'s default');
98
116
  const env = { CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: '1' };
99
117
  if (route.base_url) env.ANTHROPIC_BASE_URL = String(resolve(route.base_url, vault).value).replace(/\/v1\/?$/, '').replace(/\/$/, '');