@hasna/switcher 0.2.10 → 0.2.12

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
@@ -112,9 +112,9 @@ every provider. See the [browser extension guide](https://learn.chatgpt.com/docs
112
112
  and [DeepSeek compatibility details](https://api-docs.deepseek.com/guides/responses_api/).
113
113
 
114
114
  Switcher starts a separate app instance with private login and Electron state.
115
- That private overlay remains provider/profile-scoped. `--share-native-state` (or
116
- an explicit shared-state marker below) projects only the allowlisted native corpus
117
- into that overlay, so local conversations and instructions can remain available
115
+ That private overlay remains provider/profile-scoped. For Codex, `--share-native-state`
116
+ (or an explicit shared-state marker below) projects only the allowlisted native corpus
117
+ into that overlay, so local conversations, skills and instructions can remain available
118
118
  without reusing another provider/account's cookies, settings or authentication.
119
119
  The canonical Codex corpus is normally `~/.codex`. Your regular ChatGPT app's
120
120
  signed-in state is preserved; authentication and cookies are not copied. A second
@@ -131,32 +131,60 @@ installation with `--app-path /absolute/path/ChatGPT.app`; native CLI arguments,
131
131
 
132
132
  ### Shared native conversations
133
133
 
134
- Sharing is opt-in. Pass `--share-native-state`, set
135
- `HASNA_CODEX_STATE_HOME`/`HASNA_CLAUDE_STATE_HOME`, or set the compatible
134
+ Claude CLI and desktop share their canonical sessions, skills and instructions by
135
+ default. `--no-share-native-state` explicitly disables this projection, even when
136
+ a state marker is inherited. For CLI launches without a configured native home,
137
+ it selects a persistent private home for that Switcher profile. Existing shared
138
+ links, canonical-home overlap or redirected Codex databases refuse isolation;
139
+ Switcher never unlinks them or rewrites their configuration. Select a separate
140
+ profile to keep isolated state. Ori refuses explicit isolation until its native
141
+ state contract is verified; use the direct backend.
142
+ The existing `--share-native-state` flag remains supported; passing both flags is
143
+ an error. Programmatic callers use `shareNativeState: false` for the same opt-out.
144
+
145
+ Codex CLI and ChatGPT default sharing remains pending native writer/artifact
146
+ admission for the private-authentication/shared-corpus contract. Their existing
147
+ `--share-native-state` and marker paths remain available with all current version,
148
+ instruction, collision and adapter checks; a version string alone does not establish
149
+ that broader compatibility. This is a remaining implementation prerequisite.
150
+
151
+ The default corpus is `~/.codex` or `~/.claude`. To select another canonical corpus,
152
+ set `HASNA_CODEX_STATE_HOME`/`HASNA_CLAUDE_STATE_HOME`, or the compatible
136
153
  `SUBSCRIPTIONS_SHARED_HOME_CODEX`/`SUBSCRIPTIONS_SHARED_HOME_CLAUDE` marker.
137
- Without one of those signals, Switcher keeps its historical provider/account state
138
- layout and creates no shared links. The command flag selects `~/.codex` or
139
- `~/.claude`; a custom canonical corpus must be named by a marker. Ambient
140
- `CODEX_HOME`/`CLAUDE_CONFIG_DIR` is treated only as the current private overlay,
141
- never silently promoted into the cross-account identity. If both marker forms are
142
- present they must resolve to the same directory. Markers are consumed by Switcher
143
- and are not forwarded to provider processes or nested launchers. Directories must
144
- be absolute, owned and free of writable/symlink redirection. This contract is
145
- currently supported on Linux and macOS; Windows refuses before creating state.
146
-
147
- Codex overlays share sessions, archived sessions and `thread-writer-locks`. Native
148
- skill directories are deliberately excluded: Skills-owned migration and hook
149
- controls remain authoritative and account-synced skill copies must not enter a
150
- cross-account corpus. The entire SQLite store uses the canonical
154
+ Ambient `CODEX_HOME`/`CLAUDE_CONFIG_DIR` selects the current private overlay, never
155
+ the cross-account identity. If both marker forms are present they must resolve
156
+ to the same directory. Markers are consumed by Switcher and are not forwarded to
157
+ provider processes or nested launchers. Directories must be absolute, owned and
158
+ free of writable/symlink redirection. Shared projection is supported on Linux
159
+ and macOS; Windows refuses before creating state. An explicit opt-out validates
160
+ corpus identities to reject overlap, without creating a canonical corpus.
161
+
162
+ Codex overlays share sessions, archived sessions, `thread-writer-locks` and
163
+ `skills`. Skill directories use the same guarded projection as sessions: edits
164
+ and deletions remain visible across overlays, and no account copy is merged over
165
+ the canonical Skills projection. Skills-owned authoring, migration and hooks
166
+ remain authoritative. The entire SQLite store uses the canonical
151
167
  configuration's `sqlite_home`, or the canonical root; inherited account-specific
152
168
  `CODEX_SQLITE_HOME` is ignored. There are no per-database or WAL symlinks.
153
169
  `session_index.jsonl` stays an overlay-local native index; legacy index-only names
154
170
  remain pending explicit migration. Authentication,
155
171
  Electron cookies, `.codex-global-state.json`, plugin caches and worktree metadata
156
- are not projected between homes. Claude's projects, todos, history and explicit `CLAUDE.md`/`.hasna/instructions`
157
- policy roots use its common corpus. Commands, agents, rules, credentials, settings,
158
- native skills and plugin state remain private. Skills continue through the
159
- reviewed Skills bridge.
172
+ are not projected between homes. Claude's projects (including their native
173
+ project memories), todos, skills, history and explicit `CLAUDE.md`/`.hasna/instructions`
174
+ policy roots use its common corpus. Commands, agents, rules, credentials, settings
175
+ and plugin state remain private. Skills continue through the reviewed Skills bridge.
176
+ For a new Claude private home, Switcher seeds supported user settings from the
177
+ effective `CLAUDE_CONFIG_DIR` (or `~/.claude`), including permissions, sandbox policy,
178
+ language, output style, thinking/effort and display preferences. The copy stays at
179
+ user-settings scope, so native project/local and managed precedence is preserved.
180
+ Existing private settings and later native edits are retained without overwrite;
181
+ later changes to the original user file are not automatically merged. The selected
182
+ Switcher profile owns model/picker routing. Environment, credential helpers,
183
+ hooks/plugins and other unsupported settings refuse before launch instead of
184
+ silently dropping policy or copying credentials. Authentication files are never copied.
185
+ Existing private skill directories and unsafe links fail before any projection.
186
+ Legacy `state import` still excludes skills: it must not resurrect removed
187
+ Skills-owned entries from an old account copy.
160
188
 
161
189
  Both tools share only `.hasna/instructions`, never the rest of `.hasna`. Codex's
162
190
  optional `AGENTS.override.md` takes native precedence over `AGENTS.md`; Switcher
@@ -719,7 +747,7 @@ Grok uses a per-launch authenticated loopback bridge because its environment ove
719
747
 
720
748
  Hermes uses the same loopback boundary with its documented `custom` provider. The bridge exposes only the Switcher catalog, translates the selected provider's Bearer, `x-api-key` or literal `api-key` credential, and forwards deployment prefixes unchanged. Hermes `state.db` and `sessions/` are linked to a profile-owned stable directory for resume; generated config and bridge credentials remain per-launch. Focused bridge tests cover all three native protocol routes and auth styles, including cleanup of an active stream without caller cancellation. Run `bun scripts/test-native-hermes.ts` with `SWITCHER_TEST_HERMES_EXECUTABLE` for the installed native CLI fixture proof, which performs a real `read_file` loop and deleted-file resume against a generic preset.
721
749
 
722
- Codex and Claude can use their [shared native corpus](#shared-native-conversations) only after explicit command or environment consent. Sessions and reviewed instruction roots may cross provider/account overlays; authentication, native skills, settings, plugins and broader capability trees remain private. Other harnesses retain their documented native storage and resume restrictions; cross-provider conversion of incompatible reasoning or session formats is not provided. Temporary nonsecret picker/config files are removed when the child exits. Run records contain launch/end metadata and initial model, not transcripts or a claim about later native picker selections.
750
+ Claude uses its [shared native corpus](#shared-native-conversations) by default, with explicit isolation available. Codex default sharing awaits native writer admission; its existing command/marker selection remains supported. Sessions, skills and reviewed instruction roots may cross provider/account overlays; authentication, settings, plugins and broader capability trees remain private. Other harnesses retain their documented native storage and resume restrictions; cross-provider conversion of incompatible reasoning or session formats is not provided. Temporary nonsecret picker/config files are removed when the child exits. Run records contain launch/end metadata and initial model, not transcripts or a claim about later native picker selections.
723
751
 
724
752
  ## SDK and API
725
753
 
@@ -0,0 +1,30 @@
1
+ import { type ClaudeDesktopInstallation } from "./desktop-apps";
2
+ export type ClaudeDesktopGatewayInput = {
3
+ gateway: {
4
+ url: string;
5
+ token: string;
6
+ };
7
+ codeConfigDir: string;
8
+ label: string;
9
+ };
10
+ export type ClaudeDesktopGatewayLaunch = {
11
+ executable: string;
12
+ args: readonly string[];
13
+ env: Record<string, string>;
14
+ beforeLaunch(): Promise<void>;
15
+ cleanup(): Promise<void>;
16
+ };
17
+ type System = {
18
+ userData: string;
19
+ detect(): Promise<ClaudeDesktopInstallation>;
20
+ available(): Promise<void>;
21
+ fetch: typeof fetch;
22
+ };
23
+ /** Internal fixture seam. The public subpath exposes only the default methods. */
24
+ export declare function createClaudeDesktopGatewayApi(system?: System): {
25
+ preflightClaudeDesktopGateway(input: {
26
+ codeConfigDir: string;
27
+ }): Promise<void>;
28
+ prepareClaudeDesktopGatewayLaunch(input: ClaudeDesktopGatewayInput): Promise<ClaudeDesktopGatewayLaunch>;
29
+ };
30
+ export {};
@@ -1,6 +1,6 @@
1
- import type { ClaudeDesktopInstallation } from "./desktop-apps";
1
+ import { type ClaudeDesktopInstallation } from "./desktop-apps";
2
+ export { claudeDesktopDataDirectory } from "./desktop-apps";
2
3
  import type { HarnessLaunchInput, PreparedLaunch } from "./harness-types";
3
- export declare const claudeDesktopDataDirectory: () => string;
4
4
  type DesktopSystem = {
5
5
  userData: string;
6
6
  assertAvailable: () => Promise<void>;
@@ -8,4 +8,3 @@ type DesktopSystem = {
8
8
  /** Use the vendor-supported local configuration library, preserving the prior
9
9
  * selection. The signed app rejects custom userData development overrides. */
10
10
  export declare function prepareClaudeDesktopLaunch(input: HarnessLaunchInput, app: ClaudeDesktopInstallation, sessionDir: string, system?: DesktopSystem): Promise<PreparedLaunch>;
11
- export {};
@@ -0,0 +1,2 @@
1
+ /** Read the same authenticated discovery path as native third-party Chat/Code. */
2
+ export declare function discoverClaudeDesktopModels(base: URL, token: string, fetcher: typeof fetch): Promise<void>;
@@ -0,0 +1,6 @@
1
+ import { type ClaudeDesktopGatewayInput, type ClaudeDesktopGatewayLaunch } from "./claude-desktop-gateway";
2
+ export type { ClaudeDesktopGatewayInput, ClaudeDesktopGatewayLaunch } from "./claude-desktop-gateway";
3
+ export declare function preflightClaudeDesktopGateway(input: {
4
+ codeConfigDir: string;
5
+ }): Promise<void>;
6
+ export declare function prepareClaudeDesktopGatewayLaunch(input: ClaudeDesktopGatewayInput): Promise<ClaudeDesktopGatewayLaunch>;