@sumicom/quicksave 0.8.0 → 0.8.2
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 +4 -0
- package/dist/ai/cardBuilder.d.ts +2 -0
- package/dist/ai/cardBuilder.d.ts.map +1 -1
- package/dist/ai/cardBuilder.js +62 -0
- package/dist/ai/cardBuilder.js.map +1 -1
- package/dist/ai/claudeCliProvider.d.ts +25 -1
- package/dist/ai/claudeCliProvider.d.ts.map +1 -1
- package/dist/ai/claudeCliProvider.js +77 -53
- package/dist/ai/claudeCliProvider.js.map +1 -1
- package/dist/ai/codexLogin.d.ts +57 -0
- package/dist/ai/codexLogin.d.ts.map +1 -0
- package/dist/ai/codexLogin.js +240 -0
- package/dist/ai/codexLogin.js.map +1 -0
- package/dist/ai/codexSdkProvider.d.ts.map +1 -1
- package/dist/ai/codexSdkProvider.js +66 -5
- package/dist/ai/codexSdkProvider.js.map +1 -1
- package/dist/ai/provider.d.ts +5 -0
- package/dist/ai/provider.d.ts.map +1 -1
- package/dist/ai/sessionManager.d.ts +6 -0
- package/dist/ai/sessionManager.d.ts.map +1 -1
- package/dist/ai/sessionManager.js +90 -4
- package/dist/ai/sessionManager.js.map +1 -1
- package/dist/files/fileBrowser.d.ts +25 -0
- package/dist/files/fileBrowser.d.ts.map +1 -0
- package/dist/files/fileBrowser.js +186 -0
- package/dist/files/fileBrowser.js.map +1 -0
- package/dist/handlers/messageHandler.d.ts +88 -8
- package/dist/handlers/messageHandler.d.ts.map +1 -1
- package/dist/handlers/messageHandler.js +411 -52
- package/dist/handlers/messageHandler.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/service/ipcClient.js +1 -1
- package/dist/service/run.d.ts.map +1 -1
- package/dist/service/run.js +57 -4
- package/dist/service/run.js.map +1 -1
- package/dist/service/types.js +1 -1
- package/dist/terminal/terminalManager.d.ts +48 -0
- package/dist/terminal/terminalManager.d.ts.map +1 -0
- package/dist/terminal/terminalManager.js +244 -0
- package/dist/terminal/terminalManager.js.map +1 -0
- package/package.json +4 -3
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Message, License, Repository, SessionRegistryEntry } from '@sumicom/quicksave-shared';
|
|
1
|
+
import { Message, License, Repository, SessionRegistryEntry, CodexModelInfo } from '@sumicom/quicksave-shared';
|
|
2
2
|
import type { PushClient } from '../service/pushClient.js';
|
|
3
3
|
import { CommitSummaryStateStore } from '../ai/commitSummaryStore.js';
|
|
4
4
|
import { SessionManager } from '../ai/sessionManager.js';
|
|
5
|
+
import { CodexLoginManager } from '../ai/codexLogin.js';
|
|
5
6
|
export declare class MessageHandler {
|
|
6
7
|
private repos;
|
|
7
8
|
private agentVersion;
|
|
@@ -21,20 +22,74 @@ export declare class MessageHandler {
|
|
|
21
22
|
private versionCheckInFlight;
|
|
22
23
|
private codexModelsCache;
|
|
23
24
|
private codexModelsCheckInFlight;
|
|
25
|
+
private codexModelsUpdateHandler;
|
|
26
|
+
private codexModelsWatcher;
|
|
27
|
+
private codexModelsWatchDebounce;
|
|
28
|
+
/** Override for tests; defaults to `~/.codex`. */
|
|
29
|
+
private readonly codexCacheDir;
|
|
30
|
+
private codexLoginManager;
|
|
24
31
|
onHistoryUpdated?: (cwd: string, entry: SessionRegistryEntry, action: 'upsert' | 'delete') => void;
|
|
25
32
|
private productionBuild;
|
|
26
|
-
constructor(repos: Repository[], _license?: License, codingPaths?: string[], productionBuild?: boolean
|
|
33
|
+
constructor(repos: Repository[], _license?: License, codingPaths?: string[], productionBuild?: boolean, options?: {
|
|
34
|
+
codexCacheDir?: string;
|
|
35
|
+
});
|
|
27
36
|
/**
|
|
28
37
|
* Check npm registry for latest version. Deduped: returns cached value
|
|
29
38
|
* if checked within the last 12 hours. Only runs in production builds.
|
|
30
39
|
*/
|
|
31
40
|
private checkLatestVersion;
|
|
32
41
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
42
|
+
* Resolve the Codex model list for the current user.
|
|
43
|
+
*
|
|
44
|
+
* Priority:
|
|
45
|
+
* 1. `~/.codex/models_cache.json` — the Codex CLI's own cache of
|
|
46
|
+
* models the signed-in account can actually use. This is the
|
|
47
|
+
* authoritative list for ChatGPT-OAuth logins (the common case)
|
|
48
|
+
* and is kept fresh by the CLI itself. Reads are essentially free,
|
|
49
|
+
* so we use a short 5min in-memory TTL — and `startCodexModelsWatcher`
|
|
50
|
+
* invalidates the cache the moment the file is rewritten.
|
|
51
|
+
* 2. `OPENAI_API_KEY` env var + OpenAI `/v1/models` — fallback for
|
|
52
|
+
* API-key users, who are rare but still supported. Held to a 1h
|
|
53
|
+
* sub-TTL so we don't hammer OpenAI when the local cache is absent.
|
|
54
|
+
*
|
|
55
|
+
* Returns `null` when neither source is available (not logged in and no
|
|
56
|
+
* API key set). Concurrent calls are deduped.
|
|
36
57
|
*/
|
|
37
58
|
private fetchCodexModels;
|
|
59
|
+
/** Snapshot accessor for the bus `/codex/models` subscription. */
|
|
60
|
+
getCachedCodexModels(): CodexModelInfo[];
|
|
61
|
+
/**
|
|
62
|
+
* Wire the daemon's bus broadcast for unsolicited model-list pushes.
|
|
63
|
+
* Called once during daemon boot; the watcher invokes this on cache change.
|
|
64
|
+
*/
|
|
65
|
+
setCodexModelsUpdateHandler(handler: (models: CodexModelInfo[]) => void): void;
|
|
66
|
+
/**
|
|
67
|
+
* Watch the Codex CLI cache directory and refresh the in-memory model list
|
|
68
|
+
* the moment the CLI rewrites it (typically after a `codex` startup or
|
|
69
|
+
* upgrade). Tolerant of a missing `~/.codex` directory — falls back to TTL
|
|
70
|
+
* alone if the watch can't be set up. Idempotent.
|
|
71
|
+
*/
|
|
72
|
+
startCodexModelsWatcher(): void;
|
|
73
|
+
/** Tear down the fs.watch handle (test cleanup). */
|
|
74
|
+
stopCodexModelsWatcher(): void;
|
|
75
|
+
private scheduleCodexModelsRefresh;
|
|
76
|
+
private refreshCodexModelsAndPublish;
|
|
77
|
+
/**
|
|
78
|
+
* Read models from the Codex CLI's local cache. File shape (as of codex
|
|
79
|
+
* CLI v0.125): `{ models: [{ slug, display_name, visibility, supported_in_api, ... }] }`.
|
|
80
|
+
* We surface only entries that are listable and API-supported, so hidden
|
|
81
|
+
* internal models (e.g. `codex-auto-review`) don't leak into the picker.
|
|
82
|
+
*/
|
|
83
|
+
private readCodexModelsCacheFile;
|
|
84
|
+
/** Fallback for API-key users (no ChatGPT OAuth). */
|
|
85
|
+
private fetchCodexModelsFromOpenAI;
|
|
86
|
+
/**
|
|
87
|
+
* Best-effort check for whether the local Codex CLI has valid auth.
|
|
88
|
+
* Matches how `fetchCodexModels` resolves credentials, so the PWA can
|
|
89
|
+
* prompt for login when this returns false. Does not validate the
|
|
90
|
+
* token — just checks that a credential source exists.
|
|
91
|
+
*/
|
|
92
|
+
private getCodexLoginStatus;
|
|
38
93
|
addRepo(repo: Repository): void;
|
|
39
94
|
removeRepo(path: string): void;
|
|
40
95
|
private getClientRepoPath;
|
|
@@ -106,6 +161,16 @@ export declare class MessageHandler {
|
|
|
106
161
|
private handleAgentUpdate;
|
|
107
162
|
private handleAgentRestart;
|
|
108
163
|
private handleCodexListModels;
|
|
164
|
+
/**
|
|
165
|
+
* Kick off the Codex device-auth OAuth flow on the daemon. Returns the
|
|
166
|
+
* one-time verification URL + user code so the PWA can display them — the
|
|
167
|
+
* user typically completes this on a different device (e.g. phone).
|
|
168
|
+
*/
|
|
169
|
+
private handleCodexLoginStart;
|
|
170
|
+
private handleCodexLoginStatus;
|
|
171
|
+
private handleCodexLoginCancel;
|
|
172
|
+
/** Expose for the daemon to wire login-state updates into bus broadcasts. */
|
|
173
|
+
getCodexLoginManager(): CodexLoginManager;
|
|
109
174
|
private handleClaudeStart;
|
|
110
175
|
private handleClaudeResume;
|
|
111
176
|
private handleClaudeCancel;
|
|
@@ -122,16 +187,31 @@ export declare class MessageHandler {
|
|
|
122
187
|
private handleListProjectSummaries;
|
|
123
188
|
private handleListProjectRepos;
|
|
124
189
|
/**
|
|
125
|
-
* Hide a project without touching the filesystem.
|
|
126
|
-
* session under `cwd` (
|
|
127
|
-
*
|
|
190
|
+
* Hide a project without touching the filesystem. Closes every live
|
|
191
|
+
* Claude session under `cwd` (so a stray resume can't re-materialize an
|
|
192
|
+
* active registry entry — see note below), archives every registry entry
|
|
193
|
+
* under `cwd` (each archive fires `/sessions/history` so PWAs drop the
|
|
194
|
+
* sessions from their live view), and removes the cwd from managed
|
|
128
195
|
* coding paths so it stops surfacing as an empty workspace. Archived
|
|
129
196
|
* session JSON stays on disk and can be restored individually.
|
|
197
|
+
*
|
|
198
|
+
* Why close live sessions first: `handleClaudeResume` builds a fresh
|
|
199
|
+
* active registry entry when `getEntry` returns undefined (archived
|
|
200
|
+
* entries aren't in memory). Without this step, any subsequent resume
|
|
201
|
+
* of a still-running session re-creates the active entry and the
|
|
202
|
+
* project reappears on the next project:list-summaries.
|
|
130
203
|
*/
|
|
131
204
|
private handleDeleteProject;
|
|
132
205
|
private getGitBranchQuiet;
|
|
133
206
|
private getGitDirtyQuiet;
|
|
134
207
|
private handlePushSubscriptionOffer;
|
|
208
|
+
private handleTerminalCreate;
|
|
209
|
+
private handleTerminalInput;
|
|
210
|
+
private handleTerminalResize;
|
|
211
|
+
private handleTerminalClose;
|
|
212
|
+
private handleTerminalRename;
|
|
213
|
+
private handleFilesList;
|
|
214
|
+
private handleFilesRead;
|
|
135
215
|
private createErrorResponse;
|
|
136
216
|
}
|
|
137
217
|
//# sourceMappingURL=messageHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/messageHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAqCP,OAAO,EAQP,UAAU,EA0CV,oBAAoB,
|
|
1
|
+
{"version":3,"file":"messageHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/messageHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAqCP,OAAO,EAQP,UAAU,EA0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