subconscious-cli 4.0.18 → 4.1.0

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
@@ -35,7 +35,7 @@ subc <agent> uninstall
35
35
  Running `subc` with no arguments in a terminal opens the native Go TUI. Use
36
36
  the arrow keys and Enter to launch agents or manage the active profile, `p` to
37
37
  switch profiles, and `q` to quit. The menu includes dedicated **Usage**,
38
- **Create profile**, **Set default model**, **Set subagent model**,
38
+ **Create profile**, **Coding sessions**, **Set default model**, **Set subagent model**,
39
39
  **Update base URL**, and **Update platform URL** actions.
40
40
  Model and URL changes are validated and saved to the active profile without
41
41
  leaving the TUI.
@@ -76,6 +76,76 @@ subc pi
76
76
  subc dsh
77
77
  ```
78
78
 
79
+ ## Native Windows support
80
+
81
+ Windows has its own implementation in `cli/bin/windows/`, selected only when
82
+ Node runs on Windows. macOS/Linux continue to use the existing, unchanged shell
83
+ runbooks. WSL continues to use the Linux implementation.
84
+
85
+ Use Node.js 22 or 24 and Windows PowerShell 5.1+ (included with Windows), from either
86
+ PowerShell or Command Prompt. The Windows CLI integrations do not require Bash,
87
+ `jq`, `curl`, or WSL. The agents themselves must support your Windows version;
88
+ their own dependencies still apply.
89
+
90
+ ```powershell
91
+ npm.cmd install -g subconscious-cli@latest
92
+ subc.cmd login
93
+ subc.cmd claude
94
+ subc codex
95
+ subc opencode
96
+ subc dsh
97
+ subc cursor install
98
+ subc copilot install
99
+ subc pi
100
+ subc config edit notepad
101
+ ```
102
+
103
+ Native Windows support is included in the stable CLI starting with 4.1.0.
104
+ Update with `npm.cmd install -g subconscious-cli@latest` or `subc.cmd upgrade --latest`.
105
+
106
+ If PowerShell's execution policy blocks npm-generated `.ps1` entry points, use
107
+ `npm.cmd` and `subc.cmd` or run the same commands in Command Prompt. No policy
108
+ change is required. Pi must already be installed; other terminal agents offer
109
+ their Windows installer when missing in an interactive terminal.
110
+
111
+ Native executables and standard npm `.cmd` shims are supported. The launcher
112
+ invokes the underlying executable or Node entry point directly, preserving
113
+ JSON, quotes, Unicode, and multiline arguments. It checks the user's `.local\bin`,
114
+ npm globals, WinGet links, and the system-profile `.local\bin` location reported
115
+ by some elevated Claude installations. It does not change your global PATH.
116
+ Custom batch wrappers are rejected with guidance to use a native executable or
117
+ standard npm package.
118
+
119
+ Login, saved profiles, model discovery, session browsing/resume, self-update,
120
+ and the native TUI use Windows paths and processes. Profile editing defaults to
121
+ Notepad, honors `VISUAL`/`EDITOR`, and supports `code`/`code-insiders` with `--wait`.
122
+ The existing profile location remains `%USERPROFILE%\.subconscious`.
123
+
124
+ Cursor, Copilot, Codex, and Pi setup use native JSON merges and Node hooks. Other
125
+ providers and hooks are preserved; malformed configuration is left unchanged.
126
+ Hook credentials are stored in `subconscious-windows.json` within the agent's
127
+ user directory; treat that file as a secret. Copilot's model provider still uses
128
+ VS Code's secret store and prompts for its key. Its configuration goes under
129
+ `%APPDATA%\Code\User` (or Code - Insiders/VSCodium). Rerun install after moving
130
+ your Node installation, because hooks record the absolute Node executable path.
131
+
132
+ To install the native x64 `sc.exe` (stable releases starting with 0.1.4), clear
133
+ any preview version pin from the current PowerShell session:
134
+
135
+ ```powershell
136
+ Remove-Item Env:SC_CODE_VERSION -ErrorAction SilentlyContinue
137
+ subc.cmd sc install
138
+ subc.cmd sc
139
+ ```
140
+
141
+ The installer requires the selected release's Windows asset and SHA-256
142
+ checksum; it reports a clear error if unavailable and never downloads a Unix
143
+ binary as a fallback. Windows ARM64 binaries are not currently published.
144
+
145
+ Run `npm run test:windows` from `cli/` for the separate Windows suite. The
146
+ Windows CI job also builds/tests the Go TUI. Existing Unix tests and runbooks
147
+ remain separate and unchanged.
148
+
79
149
  ## Supported agents
80
150
 
81
151
  The packaged integrations live in `cli/bin/runbook`.
@@ -91,6 +161,35 @@ The packaged integrations live in `cli/bin/runbook`.
91
161
  | `subc pi` | Refresh the Pi provider from the live catalog, then launch |
92
162
  | `subc dsh` | Launch the DeepSeek Harness Web UI with a temporary provider populated from the live catalog |
93
163
 
164
+ ## Sessions and cross-harness handoff
165
+
166
+ Run `subc` and choose **Coding sessions**, or list the same local catalog from
167
+ the shell:
168
+
169
+ ```bash
170
+ subc sessions
171
+ subc sessions resume claude:SESSION_ID
172
+ subc sessions resume claude:SESSION_ID --harness codex
173
+ subc sessions resume codex:SESSION_ID --harness opencode
174
+ ```
175
+
176
+ The catalog discovers recent sessions written locally by Claude Code, Codex,
177
+ OpenCode, Pi, and Subconscious Code. It shows each session's originating
178
+ harness, title, last activity, project directory, and model when the harness
179
+ records one. Selecting the original harness uses its native resume mechanism.
180
+
181
+ Selecting Claude Code, Codex, OpenCode, or Pi as a different destination starts
182
+ a new session in the original project directory with a portable handoff. The
183
+ handoff is limited to the newest 24 user/assistant text messages and 24,000
184
+ characters. Tool payloads, tool results, system prompts, and hidden reasoning
185
+ are not copied. Source transcripts remain owned by their original harness and
186
+ are never rewritten.
187
+
188
+ Cursor and GitHub Copilot sessions are not listed because their IDE-owned
189
+ conversation stores do not expose a stable local resume interface. A session
190
+ whose local transcript is missing remains available for native resume but does
191
+ not offer cross-harness destinations.
192
+
94
193
  If Subconscious Code, Claude Code, Codex, OpenCode, or DeepSeek Harness is missing, an interactive terminal offers
95
194
  to install it before launching. Pi refreshes its Subconscious provider on every
96
195
  `subc pi` launch while preserving all other providers in `models.json`; its
package/bin/agents.js CHANGED
@@ -19,6 +19,7 @@ import path from 'node:path';
19
19
  import readline from 'node:readline';
20
20
  import { fileURLToPath } from 'node:url';
21
21
  import { c } from './colors.js';
22
+ import { runWindowsAgent } from './windows/agents.js';
22
23
  import { getApiKey } from './auth.js';
23
24
  import {
24
25
  isUnsetSetting,
@@ -170,7 +171,7 @@ const AGENT_HELP = {
170
171
  'Launches the native Subconscious coding agent with the selected profile gateway, credential, and model.',
171
172
  options: [
172
173
  ['help', 'Show this help'],
173
- ['install', 'Install the latest precompiled Linux or macOS release'],
174
+ ['install', process.platform === 'win32' ? 'Install a verified Windows release, when published upstream' : 'Install the latest precompiled Linux or macOS release'],
174
175
  ['--model MODEL', 'Override the profile model for this launch'],
175
176
  ['ARGS...', 'Pass arguments directly to Subconscious Code'],
176
177
  ],
@@ -976,6 +977,14 @@ export async function runAgent(agent, argv, options = {}) {
976
977
  return 0;
977
978
  }
978
979
 
980
+ if (process.platform === 'win32') {
981
+ return runWindowsAgent(agent, argv, {
982
+ profile, parseAgentAction, extractModel, requireApiKey,
983
+ resolvedModelsForLaunch, selectLaunchModel, runbookEnv,
984
+ minimumClaudeVersion: MIN_CLAUDE_CODE_VERSION, parseClaudeVersion, claudeVersionNeedsUpgrade,
985
+ });
986
+ }
987
+
979
988
  const parsed = parseAgentAction(agent, argv);
980
989
  if (parsed.action !== 'launch') {
981
990
  if (!agent.runbook?.setupScript) {
package/bin/auth.js CHANGED
@@ -18,6 +18,7 @@
18
18
  import http from 'node:http';
19
19
  import crypto from 'node:crypto';
20
20
  import { exec } from 'node:child_process';
21
+ import { openWindowsBrowser } from './windows/process.js';
21
22
  import fs from 'node:fs/promises';
22
23
  import os from 'node:os';
23
24
  import path from 'node:path';
@@ -135,6 +136,12 @@ export function isLoginMissing(status) {
135
136
  // ── Browser opener ──────────────────────────────────────────────────────
136
137
 
137
138
  function openBrowser(url) {
139
+ if (process.platform === 'win32') {
140
+ void openWindowsBrowser(url).then(code => {
141
+ if (code) throw new Error('Browser could not be opened');
142
+ }).catch(() => console.log(`Please open this URL manually:\n\n ${url}\n`));
143
+ return;
144
+ }
138
145
  const cmd =
139
146
  process.platform === 'darwin'
140
147
  ? `open "${url}"`
package/bin/cli.js CHANGED
@@ -44,6 +44,7 @@ import {
44
44
  import { resolveModelCatalog } from './models.js';
45
45
  import { showUpdateNotice } from './update-check.js';
46
46
  import { runTui } from './tui.js';
47
+ import { sessionsCommand } from './sessions.js';
47
48
  import { printUsageHelp, usageCommand } from './usage.js';
48
49
 
49
50
  function isHelpArg(arg) {
@@ -75,6 +76,9 @@ function printHelp() {
75
76
  ${c.cyan}config${c.reset} List profiles, or show/edit one with ${c.dim}-p${c.reset}
76
77
  ${c.cyan}models${c.reset} List available Subconscious models
77
78
 
79
+ ${c.bold}Sessions${c.reset}
80
+ ${c.cyan}sessions${c.reset} Browse and resume local coding sessions across harnesses
81
+
78
82
  ${c.bold}Coding agents${c.reset}
79
83
  ${agents}
80
84
 
@@ -92,6 +96,8 @@ ${agents}
92
96
  ${c.dim}$${c.reset} subc config help
93
97
  ${c.dim}$${c.reset} subc -p staging config
94
98
  ${c.dim}$${c.reset} subc config edit vim
99
+ ${c.dim}$${c.reset} subc sessions
100
+ ${c.dim}$${c.reset} subc sessions resume claude:SESSION_ID --harness codex
95
101
  ${c.dim}$${c.reset} subc usage
96
102
  ${c.dim}$${c.reset} subc usage --json
97
103
  ${c.dim}$${c.reset} subc claude
@@ -179,6 +185,17 @@ Usage:
179
185
 
180
186
  List available Subconscious models. The default is the profile MODEL,
181
187
  or the first live catalog model if MODEL is UNSET.
188
+ `,
189
+ sessions: `
190
+ Usage:
191
+ subc sessions
192
+ subc sessions resume <session-key>
193
+ subc sessions resume <session-key> --harness <claude|codex|opencode|pi>
194
+ subc sessions help
195
+
196
+ List locally stored sessions from supported coding harnesses. Resuming with the
197
+ original harness uses its native session. Choosing another harness starts a new
198
+ session with a bounded, text-only handoff from the source conversation.
182
199
  `,
183
200
  };
184
201
 
@@ -355,6 +372,17 @@ async function main() {
355
372
  return;
356
373
  }
357
374
 
375
+ if (command === 'sessions') {
376
+ if (isHelpArg(args[1])) {
377
+ console.log(COMMAND_HELP.sessions);
378
+ return;
379
+ }
380
+ const profile = await loadProfile(profileName);
381
+ requireNamedProfile(profile);
382
+ await sessionsCommand(args.slice(1), { profile });
383
+ return;
384
+ }
385
+
358
386
  if (command === 'upgrade') {
359
387
  if (isHelpArg(args[1])) {
360
388
  console.log(COMMAND_HELP.upgrade);
Binary file
Binary file
Binary file
Binary file
package/bin/profiles.js CHANGED
@@ -7,6 +7,7 @@
7
7
  */
8
8
 
9
9
  import { spawn, execFileSync } from 'node:child_process';
10
+ import { windowsEditor, runWindows } from './windows/process.js';
10
11
  import fs from 'node:fs/promises';
11
12
  import os from 'node:os';
12
13
  import path from 'node:path';
@@ -658,7 +659,7 @@ export function validateSettingValue(setting, value) {
658
659
  return null;
659
660
  }
660
661
 
661
- const ALLOWED_EDITORS = new Set(['vim', 'nano']);
662
+ const ALLOWED_EDITORS = new Set(process.platform === 'win32' ? ['notepad', 'code', 'code-insiders', 'vim', 'nano'] : ['vim', 'nano']);
662
663
 
663
664
  function commandExists(bin) {
664
665
  try {
@@ -695,6 +696,12 @@ async function editProfile(profileName, requestedEditor) {
695
696
  }
696
697
 
697
698
  const profile = await ensureProfile(profileName);
699
+ if (process.platform === 'win32') {
700
+ const { command, args } = windowsEditor(requestedEditor);
701
+ const code = await runWindows(command, [...args, profile.path]);
702
+ if (code) process.exitCode = code;
703
+ return;
704
+ }
698
705
  const { cmd, args } = resolveEditor(requestedEditor);
699
706
  await new Promise((resolve, reject) => {
700
707
  const child = spawn(cmd, [...args, profile.path], { stdio: 'inherit' });
@@ -714,8 +721,8 @@ Usage:
714
721
  subc config
715
722
  subc config help
716
723
  subc -p NAME config
717
- subc config edit [vim|nano]
718
- subc -p NAME config edit [vim|nano]
724
+ subc config edit [${process.platform === 'win32' ? 'notepad|code|code-insiders|vim|nano' : 'vim|nano'}]
725
+ subc -p NAME config edit [${process.platform === 'win32' ? 'notepad|code|code-insiders|vim|nano' : 'vim|nano'}]
719
726
  subc config [show|path|list|create|delete]
720
727
  [--gateway-url URL] [--platform-url URL] [--api-key KEY]
721
728
  [--model MODEL|UNSET]
@@ -723,7 +730,7 @@ Usage:
723
730
 
724
731
  subc config List every profile and its file path
725
732
  subc -p NAME config Print that profile's path and env file
726
- subc config edit Open the selected profile in $VISUAL, $EDITOR, vim, or nano
733
+ subc config edit Open the selected profile in ${process.platform === 'win32' ? 'VISUAL, EDITOR, or Notepad' : '$VISUAL, $EDITOR, vim, or nano'}
727
734
  subc config edit vim Open the selected profile in vim
728
735
  subc config edit nano Open the selected profile in nano
729
736
  subc config path Print the selected profile path
@@ -35,7 +35,8 @@
35
35
  "bin": "sc",
36
36
  "install": {
37
37
  "darwin": "subc sc install",
38
- "linux": "subc sc install"
38
+ "linux": "subc sc install",
39
+ "win32": "subc sc install"
39
40
  },
40
41
  "runbook": {
41
42
  "mode": "launch",