subconscious-cli 4.0.14 → 4.0.15

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/README.md CHANGED
@@ -7,6 +7,7 @@ Log in to Subconscious, then run coding agents against the Subconscious gateway.
7
7
  ```bash
8
8
  npm install -g subconscious-cli
9
9
  subc login
10
+ subc sc
10
11
  subc claude
11
12
  ```
12
13
 
@@ -21,7 +22,7 @@ never block the requested command. Set `SUBC_DISABLE_UPDATE_CHECK=1` to suppress
21
22
  the check in offline automation.
22
23
 
23
24
  Login creates both the saved credential and a ready-to-use `default` profile,
24
- so Claude Code, Codex, OpenCode, and DeepSeek Harness can launch immediately.
25
+ so Subconscious Code, Claude Code, Codex, OpenCode, and DeepSeek Harness can launch immediately.
25
26
  Persistent editor and Pi integrations are installed per agent:
26
27
 
27
28
  ```bash
@@ -52,6 +53,7 @@ profile; they do not authenticate, install, configure, or launch anything:
52
53
 
53
54
  ```bash
54
55
  subc claude help
56
+ subc sc help
55
57
  subc codex help
56
58
  subc cursor help
57
59
  subc config help
@@ -66,6 +68,7 @@ gateway environment applied for that process. Arguments pass through as usual:
66
68
 
67
69
  ```bash
68
70
  subc claude --continue
71
+ subc sc -- -p "fix the tests"
69
72
  subc codex exec "write a test"
70
73
  subc opencode
71
74
  subc pi
@@ -78,6 +81,7 @@ The packaged integrations live in `cli/bin/runbook`.
78
81
 
79
82
  | Command | Behavior |
80
83
  | --- | --- |
84
+ | `subc sc` | Launch Subconscious Code with the active gateway, key, model, and DLR transport |
81
85
  | `subc claude` | Launch Claude Code with the runbook environment, context limits, subagent limits, and OTEL usage reporting |
82
86
  | `subc codex` | Launch Codex with the runbook provider, temporary model catalog, and surgically merged compaction hooks |
83
87
  | `subc opencode` | Launch OpenCode with the runbook provider, client header, and context/output limits |
@@ -86,11 +90,16 @@ The packaged integrations live in `cli/bin/runbook`.
86
90
  | `subc pi` | Refresh the Pi provider from the live catalog, then launch |
87
91
  | `subc dsh` | Launch the DeepSeek Harness Web UI with a temporary provider populated from the live catalog |
88
92
 
89
- If Claude Code, Codex, OpenCode, or DeepSeek Harness is missing, an interactive terminal offers
93
+ If Subconscious Code, Claude Code, Codex, OpenCode, or DeepSeek Harness is missing, an interactive terminal offers
90
94
  to install it before launching. Pi refreshes its Subconscious provider on every
91
95
  `subc pi` launch while preserving all other providers in `models.json`; its
92
96
  executable must already be installed.
93
97
 
98
+ `subc sc install` downloads and checksum-verifies the latest static Linux release
99
+ from `subconscious-systems/subconscious-code`. The upstream release currently
100
+ publishes x86_64 and ARM64 Linux assets. On macOS, the installer uses Cargo to
101
+ build the tagged release until Darwin assets are published.
102
+
94
103
  `subc codex` disables Codex apps and plugin tools for that launch by default so
95
104
  requests remain below the gateway's 128-tool limit. Core coding tools remain
96
105
  available. Use `subc codex --external-tools` to opt back in when targeting a
@@ -145,7 +154,7 @@ rewritten. Run a one-shot task with `subc dsh headless "PROMPT"`.
145
154
  ```
146
155
 
147
156
  The file is mode `600` and contains the shared gateway URL, API key, model,
148
- optional per-agent key overrides, and all Claude/Codex/OpenCode/Pi/Copilot/
157
+ optional per-agent key overrides, and all Subconscious Code/Claude/Codex/OpenCode/Pi/Copilot/
149
158
  DeepSeek Harness context and output settings used by the packaged runbook scripts.
150
159
 
151
160
  ```bash
package/bin/agents.js CHANGED
@@ -164,6 +164,17 @@ export function parseAgentAction(agent, argv = []) {
164
164
  }
165
165
 
166
166
  const AGENT_HELP = {
167
+ 'subconscious-code': {
168
+ usage: 'subc [-p NAME] sc [help|install] [Subconscious Code arguments...]',
169
+ behavior:
170
+ 'Launches the native Subconscious coding agent with the selected profile gateway, credential, and model.',
171
+ options: [
172
+ ['help', 'Show this help'],
173
+ ['install', 'Install the latest Linux release, or build from source on macOS'],
174
+ ['--model MODEL', 'Override the profile model for this launch'],
175
+ ['ARGS...', 'Pass arguments directly to Subconscious Code'],
176
+ ],
177
+ },
167
178
  'claude-code': {
168
179
  usage: 'subc [-p NAME] claude [help|status|uninstall] [Claude arguments...]',
169
180
  behavior:
@@ -309,9 +320,10 @@ export function printAgentHelp(agent, profile) {
309
320
  );
310
321
  const actions = agentSetupActions(agent);
311
322
  if (actions.includes('install')) {
312
- console.log(
313
- ` Install the persistent integration with ${c.cyan}subc ${command} install${c.reset}.`,
314
- );
323
+ const installDescription = agent.runbook?.binaryInstallScript
324
+ ? 'Install the agent binary with'
325
+ : 'Install the persistent integration with';
326
+ console.log(` ${installDescription} ${c.cyan}subc ${command} install${c.reset}.`);
315
327
  }
316
328
  if (actions.includes('uninstall')) {
317
329
  console.log(
@@ -397,6 +409,7 @@ function candidateBinDirs() {
397
409
  if (home) dirs.push(path.join(home, '.local', 'bin'));
398
410
  } else {
399
411
  dirs.push(path.join(home, '.local', 'bin'));
412
+ dirs.push(path.join(home, '.cargo', 'bin'));
400
413
  dirs.push('/opt/homebrew/bin');
401
414
  dirs.push('/usr/local/bin');
402
415
  }
@@ -481,10 +494,15 @@ function waitForEnter(prompt) {
481
494
  });
482
495
  }
483
496
 
484
- /** Run the agent's install command (may contain `&&`, so shell:true). */
485
- function runInstaller(install) {
497
+ /** Run the agent's packaged binary installer, or its shell install command. */
498
+ function runInstaller(agent, install = agent.install, usePackagedScript = true) {
486
499
  return new Promise((resolve) => {
487
- const child = spawn(install, { shell: true, stdio: 'inherit' });
500
+ const installScript = usePackagedScript && agent.runbook?.binaryInstallScript;
501
+ const child = installScript
502
+ ? spawn('bash', [runbookScriptPath(agent, installScript), 'install'], {
503
+ stdio: 'inherit',
504
+ })
505
+ : spawn(install, { shell: true, stdio: 'inherit' });
488
506
  child.on('error', () => resolve(false));
489
507
  child.on('exit', (code) => resolve(code === 0));
490
508
  });
@@ -544,14 +562,14 @@ async function ensureInstalled(agent) {
544
562
  }
545
563
 
546
564
  console.error(`\n ${c.dim}Running ${c.reset}${c.cyan}${agent.install}${c.reset}\n`);
547
- let installed = await runInstaller(agent.install);
565
+ let installed = await runInstaller(agent);
548
566
 
549
567
  // Primary failed and a fallback exists — try it once.
550
568
  if (!installed && agent.installFallback) {
551
569
  console.error(
552
570
  `\n ${c.dim}That didn't work. Trying the fallback: ${c.reset}${c.cyan}${agent.installFallback}${c.reset}\n`,
553
571
  );
554
- installed = await runInstaller(agent.installFallback);
572
+ installed = await runInstaller(agent, agent.installFallback, false);
555
573
  }
556
574
 
557
575
  if (!installed) {
@@ -874,7 +892,7 @@ export function selectLaunchModel(requestedModel, modelSource, catalog) {
874
892
  }
875
893
 
876
894
  async function runRunbookSetup(agent, argv, profile, relativeScript = agent.runbook.script) {
877
- if (isSetupWithoutAuth(argv)) {
895
+ if (isSetupWithoutAuth(argv) || agent.runbook?.setupNeedsAuth === false) {
878
896
  return spawnRunbook(agent, argv, {
879
897
  ...(profile?.values || {}),
880
898
  ...process.env,
Binary file
Binary file
Binary file
Binary file
package/bin/profiles.js CHANGED
@@ -38,6 +38,7 @@ export const RUNBOOK_DEFAULTS = {
38
38
  GATEWAY_URL: registry.defaults.baseUrl,
39
39
  API_KEY: '',
40
40
  MODEL: registry.defaults.model,
41
+ SC_API_KEY: '',
41
42
  CLAUDE_CODE_SUBAGENT_MODEL: '',
42
43
  CLAUDE_GATEWAY_URL: '',
43
44
  CLAUDE_CODE_API_KEY: '',
@@ -89,6 +90,12 @@ const SETTINGS = {
89
90
  type: 'choice',
90
91
  choices: SUPPORTED_MODELS,
91
92
  },
93
+ SC_API_KEY: {
94
+ key: 'SC_API_KEY',
95
+ label: 'Subconscious Code API key',
96
+ description: 'Subconscious Code credential override; blank uses API_KEY.',
97
+ type: 'secret',
98
+ },
92
99
  CLAUDE_CODE_SUBAGENT_MODEL: {
93
100
  key: 'CLAUDE_CODE_SUBAGENT_MODEL',
94
101
  label: 'Subagent model',
@@ -274,6 +281,7 @@ const SETTINGS = {
274
281
  };
275
282
 
276
283
  const AGENT_SETTING_KEYS = {
284
+ 'subconscious-code': ['SC_API_KEY'],
277
285
  'claude-code': [
278
286
  'CLAUDE_GATEWAY_URL',
279
287
  'CLAUDE_CODE_API_KEY',
@@ -346,6 +354,7 @@ ${modelComments}
346
354
  MODEL={MODEL}
347
355
 
348
356
  # Optional per-agent keys. Leave blank to use API_KEY above.
357
+ SC_API_KEY={SC_API_KEY}
349
358
  CLAUDE_CODE_API_KEY={CLAUDE_CODE_API_KEY}
350
359
  CODEX_API_KEY={CODEX_API_KEY}
351
360
  OPENCODE_API_KEY={OPENCODE_API_KEY}
@@ -13,6 +13,49 @@
13
13
  "platformUrl": "https://subconscious.dev/platform"
14
14
  },
15
15
  "agents": [
16
+ {
17
+ "id": "subconscious-code",
18
+ "command": "sc",
19
+ "name": "Subconscious Code",
20
+ "aliases": [
21
+ "subconscious-code"
22
+ ],
23
+ "description": "Launch the native Subconscious coding agent with the active profile, gateway, and model.",
24
+ "framework": "Subconscious Code",
25
+ "language": "rust",
26
+ "category": "coding-agent",
27
+ "tags": [
28
+ "local",
29
+ "cli",
30
+ "agents"
31
+ ],
32
+ "protocol": "openai",
33
+ "homepage": "https://github.com/subconscious-systems/subconscious-code",
34
+ "bin": "sc",
35
+ "install": {
36
+ "darwin": "cargo install --locked --git https://github.com/subconscious-systems/subconscious-code --bin sc rc-cli",
37
+ "linux": "subc sc install",
38
+ "fallback": "cargo install --locked --git https://github.com/subconscious-systems/subconscious-code --bin sc rc-cli"
39
+ },
40
+ "runbook": {
41
+ "mode": "launch",
42
+ "script": "subconscious-code/run.sh",
43
+ "setupScript": "subconscious-code/install.sh",
44
+ "binaryInstallScript": "subconscious-code/install.sh",
45
+ "setupActions": [
46
+ "install"
47
+ ],
48
+ "setupNeedsAuth": false
49
+ },
50
+ "launch": "sc",
51
+ "env": {
52
+ "SC_BASE_URL": "{baseUrlV1}",
53
+ "SC_DLR_URL": "{baseUrl}",
54
+ "SC_DLR_ENABLED": "true",
55
+ "SC_API_KEY": "{apiKey}",
56
+ "SC_MODEL": "{model}"
57
+ }
58
+ },
16
59
  {
17
60
  "id": "claude-code",
18
61
  "command": "claude",
@@ -1,7 +1,7 @@
1
1
  # Coding-agent integrations
2
2
 
3
3
  These scripts are part of `subc`. They launch or surgically install Claude Code,
4
- Codex, OpenCode, DeepSeek Harness, Cursor, Copilot, and Pi against the
4
+ Subconscious Code, Codex, OpenCode, DeepSeek Harness, Cursor, Copilot, and Pi against the
5
5
  Subconscious gateway.
6
6
 
7
7
  `subc` reads `~/.subconscious/profiles/<name>.env` and injects those values into
@@ -10,6 +10,7 @@ directly, `SUBC_ENV_FILE` (or `cli/bin/runbook/.env`) can supply the same keys.
10
10
 
11
11
  Included integrations:
12
12
 
13
+ - `subconscious-code/install.sh` and `run.sh`
13
14
  - `claude-code/install.sh` and `run.sh`
14
15
  - `codex/install.sh`, `run.sh`, `hook.sh`, `hooks.json`, and `hooks-lib.sh`
15
16
  - `opencode/install.sh`, `run.sh`, and `subconscious-compaction.ts`
@@ -0,0 +1,147 @@
1
+ #!/usr/bin/env bash
2
+ # Install Subconscious Code. Tagged releases currently contain static Linux
3
+ # binaries; macOS builds from the tagged source until Darwin assets are added.
4
+
5
+ set -euo pipefail
6
+
7
+ REPOSITORY="subconscious-systems/subconscious-code"
8
+ REPOSITORY_URL="https://github.com/${REPOSITORY}"
9
+ INSTALL_DIR="${SC_INSTALL_DIR:-${HOME}/.local/bin}"
10
+
11
+ usage() {
12
+ cat <<'EOF'
13
+ Usage: subc sc install
14
+
15
+ Install the latest Subconscious Code release. Linux downloads and verifies the
16
+ published static binary. macOS builds the release from source with Cargo.
17
+ EOF
18
+ }
19
+
20
+ case "${1:-install}" in
21
+ install) ;;
22
+ help|-h|--help)
23
+ usage
24
+ exit 0
25
+ ;;
26
+ *)
27
+ echo "error: unsupported Subconscious Code setup action: $1" >&2
28
+ usage >&2
29
+ exit 2
30
+ ;;
31
+ esac
32
+
33
+ release_tag() {
34
+ if [[ -n "${SC_CODE_VERSION:-}" ]]; then
35
+ printf '%s\n' "${SC_CODE_VERSION#v}"
36
+ return
37
+ fi
38
+ if command -v gh >/dev/null 2>&1; then
39
+ local tag
40
+ tag="$(gh release view --repo "$REPOSITORY" --json tagName --jq '.tagName' 2>/dev/null || true)"
41
+ if [[ -n "$tag" ]]; then
42
+ printf '%s\n' "${tag#v}"
43
+ return
44
+ fi
45
+ fi
46
+ if command -v curl >/dev/null 2>&1; then
47
+ local tag
48
+ tag="$(curl -fsSL "https://api.github.com/repos/${REPOSITORY}/releases/latest" 2>/dev/null \
49
+ | sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' \
50
+ | head -n 1 || true)"
51
+ if [[ -n "$tag" ]]; then
52
+ printf '%s\n' "${tag#v}"
53
+ return
54
+ fi
55
+ fi
56
+ return 1
57
+ }
58
+
59
+ install_from_source() {
60
+ if ! command -v cargo >/dev/null 2>&1; then
61
+ echo "error: macOS installation currently requires Cargo (Rust 1.89 or newer)" >&2
62
+ echo "Install Rust from https://rustup.rs, then run: subc sc install" >&2
63
+ exit 1
64
+ fi
65
+
66
+ local version="${1:-}"
67
+ local args=(install --locked --git "$REPOSITORY_URL" --bin sc)
68
+ if [[ -n "$version" ]]; then
69
+ args+=(--tag "v${version}")
70
+ echo "Building Subconscious Code v${version} from source..."
71
+ else
72
+ echo "No published release is visible yet; building Subconscious Code from the default branch..."
73
+ fi
74
+ args+=(rc-cli)
75
+ CARGO_NET_GIT_FETCH_WITH_CLI=true cargo "${args[@]}"
76
+ }
77
+
78
+ platform="$(uname -s)"
79
+ version="$(release_tag || true)"
80
+
81
+ if [[ "$platform" == "Darwin" ]]; then
82
+ install_from_source "$version"
83
+ exit 0
84
+ fi
85
+
86
+ if [[ "$platform" != "Linux" ]]; then
87
+ echo "error: Subconscious Code automatic installation supports Linux and macOS" >&2
88
+ exit 1
89
+ fi
90
+
91
+ if [[ -z "$version" ]]; then
92
+ echo "error: no published Subconscious Code release is available yet" >&2
93
+ echo "The release may still be building. Retry subc sc install after it finishes." >&2
94
+ exit 1
95
+ fi
96
+
97
+ case "$(uname -m)" in
98
+ x86_64|amd64) target="x86_64-unknown-linux-musl" ;;
99
+ aarch64|arm64) target="aarch64-unknown-linux-musl" ;;
100
+ *)
101
+ echo "error: unsupported Linux architecture: $(uname -m)" >&2
102
+ exit 1
103
+ ;;
104
+ esac
105
+
106
+ asset="sc-${target}.tar.gz"
107
+ checksum="${asset}.sha256"
108
+ work_dir="$(mktemp -d "${TMPDIR:-/tmp}/subc-sc-install.XXXXXX")"
109
+ cleanup() {
110
+ rm -f "$work_dir/$asset" "$work_dir/$checksum" "$work_dir/sc"
111
+ rmdir "$work_dir" 2>/dev/null || true
112
+ }
113
+ trap cleanup EXIT HUP INT TERM
114
+
115
+ echo "Downloading Subconscious Code v${version} for ${target}..."
116
+ if command -v gh >/dev/null 2>&1 \
117
+ && gh release view "v${version}" --repo "$REPOSITORY" >/dev/null 2>&1; then
118
+ gh release download "v${version}" --repo "$REPOSITORY" \
119
+ --pattern "$asset" --pattern "$checksum" --dir "$work_dir"
120
+ else
121
+ command -v curl >/dev/null 2>&1 || {
122
+ echo "error: curl is required to download Subconscious Code" >&2
123
+ exit 1
124
+ }
125
+ release_url="${REPOSITORY_URL}/releases/download/v${version}"
126
+ curl -fL "${release_url}/${asset}" -o "$work_dir/$asset"
127
+ curl -fL "${release_url}/${checksum}" -o "$work_dir/$checksum"
128
+ fi
129
+
130
+ if command -v sha256sum >/dev/null 2>&1; then
131
+ (cd "$work_dir" && sha256sum --check "$checksum")
132
+ elif command -v shasum >/dev/null 2>&1; then
133
+ expected="$(awk '{print $1}' "$work_dir/$checksum")"
134
+ actual="$(shasum -a 256 "$work_dir/$asset" | awk '{print $1}')"
135
+ [[ "$actual" == "$expected" ]] || {
136
+ echo "error: Subconscious Code checksum verification failed" >&2
137
+ exit 1
138
+ }
139
+ else
140
+ echo "error: sha256sum or shasum is required to verify the download" >&2
141
+ exit 1
142
+ fi
143
+
144
+ tar -xzf "$work_dir/$asset" -C "$work_dir" sc
145
+ mkdir -p "$INSTALL_DIR"
146
+ install -m 0755 "$work_dir/sc" "$INSTALL_DIR/sc"
147
+ echo "Installed Subconscious Code v${version} to $INSTALL_DIR/sc"
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env bash
2
+ # Launch Subconscious Code without changing ~/.sc or project settings.
3
+
4
+ set -euo pipefail
5
+
6
+ GATEWAY_URL="${GATEWAY_URL:-}"
7
+ API_KEY="${SC_API_KEY:-${API_KEY:-}}"
8
+ MODEL="${MODEL:-subconscious/glm-5.2}"
9
+
10
+ if [[ -z "$GATEWAY_URL" || -z "$API_KEY" ]]; then
11
+ echo "error: GATEWAY_URL and API_KEY are required to launch Subconscious Code" >&2
12
+ exit 1
13
+ fi
14
+
15
+ export SC_API_KEY="$API_KEY"
16
+ export SC_BASE_URL="${GATEWAY_URL%/}/v1"
17
+ export SC_DLR_URL="${GATEWAY_URL%/}"
18
+ export SC_DLR_ENABLED=true
19
+ export SC_MODEL="$MODEL"
20
+
21
+ exec sc "$@"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "subconscious-cli",
3
- "version": "4.0.14",
4
- "description": "CLI for Subconscious — run Claude Code, Codex, OpenCode, DeepSeek Harness, Cursor, Copilot, and Pi",
3
+ "version": "4.0.15",
4
+ "description": "CLI for Subconscious — run Subconscious Code, Claude Code, Codex, OpenCode, DeepSeek Harness, Cursor, Copilot, and Pi",
5
5
  "bin": {
6
6
  "subc": "bin/cli.js"
7
7
  },
@@ -33,6 +33,7 @@
33
33
  "authentication",
34
34
  "profiles",
35
35
  "coding-agent",
36
+ "subconscious-code",
36
37
  "claude-code",
37
38
  "opencode",
38
39
  "codex",