@steipete/oracle 0.18.0 → 0.20.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.
Files changed (169) hide show
  1. package/README.md +1 -1
  2. package/dist/bin/oracle-cli.js +76 -76
  3. package/dist/bin/oracle-mcp.js +0 -0
  4. package/dist/src/browser/actions/archiveConversation.js +31 -7
  5. package/dist/src/browser/actions/assistantResponse.js +43 -1
  6. package/dist/src/browser/actions/attachmentContext.js +239 -0
  7. package/dist/src/browser/actions/attachmentDataTransfer.js +19 -1
  8. package/dist/src/browser/actions/attachmentEvidence.js +78 -0
  9. package/dist/src/browser/actions/attachmentProgress.js +41 -0
  10. package/dist/src/browser/actions/attachmentPrompt.js +130 -0
  11. package/dist/src/browser/actions/attachments.js +306 -355
  12. package/dist/src/browser/actions/deepResearch.js +170 -45
  13. package/dist/src/browser/actions/modelSelection.js +91 -4
  14. package/dist/src/browser/actions/navigation.js +1 -1
  15. package/dist/src/browser/actions/promptComposer.js +364 -186
  16. package/dist/src/browser/actions/remoteFileTransfer.js +4 -2
  17. package/dist/src/browser/actions/thinkingStatus.js +2 -5
  18. package/dist/src/browser/actions/thinkingTime.js +156 -16
  19. package/dist/src/browser/actions/webSearch.js +96 -0
  20. package/dist/src/browser/attachRunning.js +46 -2
  21. package/dist/src/browser/attachmentValidation.js +53 -0
  22. package/dist/src/browser/cancellation.js +105 -0
  23. package/dist/src/browser/chatgptImages.js +2 -0
  24. package/dist/src/browser/chatgptThrottle.js +104 -0
  25. package/dist/src/browser/chromeLifecycle.js +272 -47
  26. package/dist/src/browser/config.js +14 -1
  27. package/dist/src/browser/detect.js +1 -1
  28. package/dist/src/browser/index.js +525 -274
  29. package/dist/src/browser/liveTabs.js +3 -4
  30. package/dist/src/browser/modelDisplay.js +9 -0
  31. package/dist/src/browser/pageActions.js +2 -2
  32. package/dist/src/browser/profileState.js +114 -9
  33. package/dist/src/browser/projectSourcesRunner.js +83 -15
  34. package/dist/src/browser/prompt.js +272 -113
  35. package/dist/src/browser/providers/chatgptDomProvider.js +3 -0
  36. package/dist/src/browser/reattach.js +31 -4
  37. package/dist/src/browser/recoveryTarget.js +131 -0
  38. package/dist/src/browser/sessionRunner.js +73 -11
  39. package/dist/src/browser/tabLeaseRegistry.js +434 -38
  40. package/dist/src/browser/targetClaim.js +54 -0
  41. package/dist/src/browser/utils.js +20 -2
  42. package/dist/src/cli/browserConfig.js +36 -4
  43. package/dist/src/cli/browserDefaults.js +10 -0
  44. package/dist/src/cli/browserTabs.js +15 -29
  45. package/dist/src/cli/detachedSession.js +69 -0
  46. package/dist/src/cli/dryRun.js +58 -48
  47. package/dist/src/cli/harvestIntegrity.js +140 -0
  48. package/dist/src/cli/options.js +15 -0
  49. package/dist/src/cli/recoveredBrowserHarvest.js +50 -0
  50. package/dist/src/cli/runOptions.js +19 -4
  51. package/dist/src/cli/serveBrowserConfig.js +24 -0
  52. package/dist/src/cli/sessionDisplay.js +13 -7
  53. package/dist/src/cli/sessionRunner.js +95 -12
  54. package/dist/src/config.js +1 -0
  55. package/dist/src/gemini-web/client.js +67 -21
  56. package/dist/src/gemini-web/executor.js +4 -0
  57. package/dist/src/gemini-web/http.js +15 -0
  58. package/dist/src/gemini-web/models.js +15 -11
  59. package/dist/src/mcp/server.js +11 -14
  60. package/dist/src/mcp/tools/chatgptImage.js +4 -4
  61. package/dist/src/mcp/tools/consult.js +86 -24
  62. package/dist/src/mcp/tools/projectSources.js +4 -6
  63. package/dist/src/mcp/tools/sessionResources.js +1 -1
  64. package/dist/src/mcp/tools/sessions.js +2 -2
  65. package/dist/src/mcp/tools/wait.js +182 -0
  66. package/dist/src/mcp/types.js +8 -1
  67. package/dist/src/oracle/config.js +14 -0
  68. package/dist/src/oracle/errors.js +11 -0
  69. package/dist/src/oracle/geminiModels.js +1 -0
  70. package/dist/src/oracle/providerRoutePlan.js +3 -2
  71. package/dist/src/oracle/run.js +27 -4
  72. package/dist/src/remote/client.js +73 -6
  73. package/dist/src/remote/health.js +6 -2
  74. package/dist/src/remote/runSlots.js +83 -0
  75. package/dist/src/remote/server.js +346 -71
  76. package/dist/src/sessionManager.js +36 -1
  77. package/dist/vendor/oracle-notifier/OracleNotifier.app/Contents/CodeResources +0 -0
  78. package/dist/vendor/oracle-notifier/OracleNotifier.app/Contents/MacOS/OracleNotifier +0 -0
  79. package/package.json +25 -23
  80. package/vendor/oracle-notifier/OracleNotifier.app/Contents/CodeResources +0 -0
  81. package/vendor/oracle-notifier/OracleNotifier.app/Contents/MacOS/OracleNotifier +0 -0
  82. package/dist/bin/oracle.js +0 -683
  83. package/dist/docs-site/.nojekyll +0 -0
  84. package/dist/docs-site/CNAME +0 -1
  85. package/dist/docs-site/RELEASING.html +0 -410
  86. package/dist/docs-site/agents.html +0 -374
  87. package/dist/docs-site/anthropic.html +0 -368
  88. package/dist/docs-site/bridge.html +0 -400
  89. package/dist/docs-site/browser-mode.html +0 -588
  90. package/dist/docs-site/chromium-forks.html +0 -347
  91. package/dist/docs-site/cli-reference.html +0 -346
  92. package/dist/docs-site/configuration.html +0 -436
  93. package/dist/docs-site/favicon.svg +0 -14
  94. package/dist/docs-site/followup.html +0 -368
  95. package/dist/docs-site/gemini.html +0 -379
  96. package/dist/docs-site/grok.html +0 -325
  97. package/dist/docs-site/index.html +0 -360
  98. package/dist/docs-site/install.html +0 -335
  99. package/dist/docs-site/linux.html +0 -321
  100. package/dist/docs-site/llms.txt +0 -43
  101. package/dist/docs-site/manual-tests.html +0 -595
  102. package/dist/docs-site/mcp.html +0 -368
  103. package/dist/docs-site/multimodel.html +0 -364
  104. package/dist/docs-site/mythical-pro-agents.html +0 -360
  105. package/dist/docs-site/notifier.html +0 -338
  106. package/dist/docs-site/openai-endpoints.html +0 -387
  107. package/dist/docs-site/openrouter.html +0 -344
  108. package/dist/docs-site/quickstart.html +0 -369
  109. package/dist/docs-site/refactor/ux.html +0 -532
  110. package/dist/docs-site/sessions.html +0 -388
  111. package/dist/docs-site/social-card.png +0 -0
  112. package/dist/docs-site/social-card.svg +0 -79
  113. package/dist/docs-site/spec.html +0 -363
  114. package/dist/docs-site/testing.html +0 -320
  115. package/dist/docs-site/tui-debug.html +0 -326
  116. package/dist/docs-site/windows-work.html +0 -323
  117. package/dist/docs-site/windows.html +0 -320
  118. package/dist/markdansi/types/index.js +0 -4
  119. package/dist/oracle/bin/oracle-cli.js +0 -472
  120. package/dist/oracle/src/browser/actions/assistantResponse.js +0 -471
  121. package/dist/oracle/src/browser/actions/attachments.js +0 -82
  122. package/dist/oracle/src/browser/actions/modelSelection.js +0 -190
  123. package/dist/oracle/src/browser/actions/navigation.js +0 -75
  124. package/dist/oracle/src/browser/actions/promptComposer.js +0 -167
  125. package/dist/oracle/src/browser/chromeLifecycle.js +0 -104
  126. package/dist/oracle/src/browser/config.js +0 -33
  127. package/dist/oracle/src/browser/constants.js +0 -40
  128. package/dist/oracle/src/browser/cookies.js +0 -210
  129. package/dist/oracle/src/browser/domDebug.js +0 -36
  130. package/dist/oracle/src/browser/index.js +0 -331
  131. package/dist/oracle/src/browser/pageActions.js +0 -5
  132. package/dist/oracle/src/browser/prompt.js +0 -88
  133. package/dist/oracle/src/browser/promptSummary.js +0 -20
  134. package/dist/oracle/src/browser/sessionRunner.js +0 -80
  135. package/dist/oracle/src/browser/types.js +0 -1
  136. package/dist/oracle/src/browser/utils.js +0 -62
  137. package/dist/oracle/src/browserMode.js +0 -1
  138. package/dist/oracle/src/cli/browserConfig.js +0 -44
  139. package/dist/oracle/src/cli/dryRun.js +0 -59
  140. package/dist/oracle/src/cli/engine.js +0 -17
  141. package/dist/oracle/src/cli/errorUtils.js +0 -9
  142. package/dist/oracle/src/cli/help.js +0 -70
  143. package/dist/oracle/src/cli/markdownRenderer.js +0 -15
  144. package/dist/oracle/src/cli/options.js +0 -103
  145. package/dist/oracle/src/cli/promptRequirement.js +0 -14
  146. package/dist/oracle/src/cli/rootAlias.js +0 -30
  147. package/dist/oracle/src/cli/sessionCommand.js +0 -77
  148. package/dist/oracle/src/cli/sessionDisplay.js +0 -270
  149. package/dist/oracle/src/cli/sessionRunner.js +0 -94
  150. package/dist/oracle/src/heartbeat.js +0 -43
  151. package/dist/oracle/src/oracle/client.js +0 -48
  152. package/dist/oracle/src/oracle/config.js +0 -29
  153. package/dist/oracle/src/oracle/errors.js +0 -101
  154. package/dist/oracle/src/oracle/files.js +0 -220
  155. package/dist/oracle/src/oracle/format.js +0 -33
  156. package/dist/oracle/src/oracle/fsAdapter.js +0 -7
  157. package/dist/oracle/src/oracle/oscProgress.js +0 -60
  158. package/dist/oracle/src/oracle/request.js +0 -48
  159. package/dist/oracle/src/oracle/run.js +0 -444
  160. package/dist/oracle/src/oracle/tokenStats.js +0 -39
  161. package/dist/oracle/src/oracle/types.js +0 -1
  162. package/dist/oracle/src/oracle.js +0 -9
  163. package/dist/oracle/src/sessionManager.js +0 -205
  164. package/dist/oracle/src/version.js +0 -39
  165. package/dist/scripts/chrome/browser-tools.js +0 -295
  166. package/dist/src/browser/chromeCookies.js +0 -312
  167. package/dist/src/browser/keytarShim.js +0 -56
  168. package/dist/src/browser/profileSync.js +0 -141
  169. package/dist/src/browser/windowsCookies.js +0 -219
@@ -1,219 +0,0 @@
1
- import crypto from 'node:crypto';
2
- import fs from 'node:fs/promises';
3
- import { existsSync, promises as fsp } from 'node:fs';
4
- import os from 'node:os';
5
- import path from 'node:path';
6
- import sqlite3 from 'sqlite3';
7
- import { createRequire } from 'node:module';
8
- import { spawnSync } from 'node:child_process';
9
- let cachedUnprotect = null;
10
- function getUnprotectData() {
11
- if (cachedUnprotect) {
12
- return cachedUnprotect;
13
- }
14
- try {
15
- // win-dpapi is CommonJS; require it explicitly and support both named/default shapes.
16
- const dpapiModule = createRequire(import.meta.url)('win-dpapi');
17
- const unprotect = dpapiModule?.Dpapi?.unprotectData ??
18
- dpapiModule?.default?.unprotectData ??
19
- ((_) => {
20
- throw new Error('win-dpapi unprotectData not available');
21
- });
22
- cachedUnprotect = unprotect;
23
- return unprotect;
24
- }
25
- catch (error) {
26
- if (process.platform !== 'win32') {
27
- // On macOS/Linux we don't need DPAPI; return a function that makes misuse obvious.
28
- cachedUnprotect = () => {
29
- throw new Error('win-dpapi is unavailable on non-Windows platforms');
30
- };
31
- return cachedUnprotect;
32
- }
33
- throw error;
34
- }
35
- }
36
- export async function loadWindowsCookies(dbPath, filterNames) {
37
- if (process.platform !== 'win32') {
38
- throw new Error('loadWindowsCookies is only supported on Windows');
39
- }
40
- const localStatePath = await locateLocalState(dbPath);
41
- const cookiesCopy = await copyLockedFile(dbPath, 'Cookies'); // name the copy exactly "Cookies"
42
- const cookiesDirForFallback = await ensureCookiesDirForFallback(cookiesCopy);
43
- const localStateCopy = await copyLockedFile(localStatePath, 'Local State');
44
- const aesKey = await extractWindowsAesKey(localStateCopy);
45
- const rows = await readChromeCookiesDb(cookiesCopy, filterNames);
46
- const cookies = [];
47
- for (const row of rows) {
48
- const enc = row.encrypted_value && row.encrypted_value.length > 0 ? row.encrypted_value : Buffer.from(row.value ?? '', 'utf8');
49
- const decrypted = enc.length > 0 ? decryptCookie(enc, aesKey) : '';
50
- cookies.push({
51
- name: row.name,
52
- value: decrypted,
53
- domain: row.host_key?.startsWith('.') ? row.host_key.slice(1) : row.host_key,
54
- path: row.path ?? '/',
55
- expires: normalizeExpiration(row.expires_utc),
56
- secure: Boolean(row.is_secure),
57
- httpOnly: Boolean(row.is_httponly),
58
- });
59
- }
60
- if (process.env.ORACLE_DEBUG_COOKIES === '1') {
61
- // eslint-disable-next-line no-console
62
- console.log(`[cookies] windows decrypt decoded ${cookies.length} cookies from ${cookiesCopy} (fallback dir ${cookiesDirForFallback})`);
63
- }
64
- return cookies.filter((c) => c.value);
65
- }
66
- function decryptCookie(value, aesKey) {
67
- const prefix = value.slice(0, 3).toString();
68
- // Chrome prefixes AES-GCM encrypted cookies with version markers like v10/v11/v20; treat all v** the same.
69
- if (/^v\d{2}$/u.test(prefix)) {
70
- const iv = value.slice(3, 15);
71
- const tag = value.slice(value.length - 16);
72
- const data = value.slice(15, value.length - 16);
73
- const decipher = crypto.createDecipheriv('aes-256-gcm', aesKey, iv);
74
- decipher.setAuthTag(tag);
75
- const decrypted = Buffer.concat([decipher.update(data), decipher.final()]);
76
- return decrypted.toString('utf8');
77
- }
78
- const unprotectData = getUnprotectData();
79
- const unprotected = unprotectData(value, undefined, 'CurrentUser');
80
- return Buffer.from(unprotected).toString('utf8');
81
- }
82
- async function locateLocalState(dbPath) {
83
- // Prefer sibling Local State near the profile path; fall back to default location.
84
- const guess = path.resolve(path.join(path.dirname(dbPath), '..', 'Local State'));
85
- if (existsSync(guess))
86
- return guess;
87
- const localState = path.join(os.homedir(), 'AppData', 'Local', 'Google', 'Chrome', 'User Data', 'Local State');
88
- if (existsSync(localState))
89
- return localState;
90
- throw new Error('Chrome Local State not found for AES key');
91
- }
92
- async function extractWindowsAesKey(localStatePath) {
93
- const raw = await fs.readFile(localStatePath, 'utf8');
94
- const state = JSON.parse(raw);
95
- const encKeyB64 = state?.os_crypt?.encrypted_key;
96
- if (!encKeyB64)
97
- throw new Error('encrypted_key missing in Local State');
98
- const encKey = Buffer.from(encKeyB64, 'base64');
99
- const dpapiBlob = encKey.slice(5); // strip "DPAPI"
100
- const unprotectData = getUnprotectData();
101
- const unprotected = unprotectData(dpapiBlob, undefined, 'CurrentUser');
102
- return Buffer.from(unprotected);
103
- }
104
- async function readChromeCookiesDb(dbPath, filterNames) {
105
- const db = await openSqlite(dbPath);
106
- const placeholders = filterNames && filterNames.size > 0 ? `AND name IN (${Array.from(filterNames).map(() => '?').join(',')})` : '';
107
- const params = filterNames ? Array.from(filterNames) : [];
108
- const sql = `SELECT name,value,encrypted_value,host_key,path,expires_utc,is_secure,is_httponly FROM cookies WHERE host_key LIKE '%chatgpt.com%' ${placeholders}`;
109
- try {
110
- return await allSqlite(db, sql, params);
111
- }
112
- finally {
113
- db.close();
114
- }
115
- }
116
- function openSqlite(dbPath) {
117
- return new Promise((resolve, reject) => {
118
- const db = new sqlite3.Database(dbPath, sqlite3.OPEN_READONLY, (err) => {
119
- if (err)
120
- reject(err);
121
- else
122
- resolve(db);
123
- });
124
- });
125
- }
126
- async function copyLockedFile(sourcePath, targetName) {
127
- const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'oracle-cookie-'));
128
- const tempPath = targetName ? path.join(tempDir, targetName) : path.join(tempDir, path.basename(sourcePath));
129
- const psScript = `
130
- $src = '${sourcePath.replace(/'/g, "''")}'
131
- $dst = '${tempPath.replace(/'/g, "''")}'
132
- try {
133
- $fs = [System.IO.File]::Open($src, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite)
134
- $bytes = New-Object byte[] $fs.Length
135
- $null = $fs.Read($bytes, 0, $fs.Length)
136
- $fs.Close()
137
- [System.IO.File]::WriteAllBytes($dst, $bytes)
138
- exit 0
139
- } catch {
140
- exit 1
141
- }
142
- `;
143
- const encoded = Buffer.from(psScript, 'utf16le').toString('base64');
144
- const result = spawnSync('powershell.exe', ['-NoProfile', '-NonInteractive', '-EncodedCommand', encoded], {
145
- timeout: 15000,
146
- encoding: 'utf8',
147
- });
148
- if (result.status !== 0) {
149
- // Fallback: best-effort normal copy
150
- await fs.copyFile(sourcePath, tempPath);
151
- }
152
- if (process.env.ORACLE_DEBUG_COOKIES === '1') {
153
- // eslint-disable-next-line no-console
154
- console.log(`[cookies] copied locked file ${sourcePath} -> ${tempPath}`);
155
- }
156
- return tempPath;
157
- }
158
- // Create a directory containing a file named "Cookies" for chrome-cookies-secure fallback
159
- export async function ensureCookiesDirForFallback(cookieFile) {
160
- const dir = await fs.mkdtemp(path.join(os.tmpdir(), 'oracle-cookies-secure-'));
161
- const target = path.join(dir, 'Cookies');
162
- await fs.copyFile(cookieFile, target);
163
- return dir;
164
- }
165
- function allSqlite(db, sql, params) {
166
- return new Promise((resolve, reject) => {
167
- db.all(sql, params, (err, rows) => {
168
- if (err)
169
- reject(err);
170
- else
171
- resolve((rows ?? []));
172
- });
173
- });
174
- }
175
- function normalizeExpiration(expires) {
176
- if (!expires || Number.isNaN(expires)) {
177
- return undefined;
178
- }
179
- const value = Number(expires);
180
- if (value <= 0)
181
- return undefined;
182
- if (value > 1_000_000_000_000) {
183
- return Math.round(value / 1_000_000 - 11644473600);
184
- }
185
- if (value > 1_000_000_000) {
186
- return Math.round(value / 1000);
187
- }
188
- return Math.round(value);
189
- }
190
- export async function materializeCookieFile(sourcePath) {
191
- if (process.platform !== 'win32')
192
- return sourcePath;
193
- const resolved = await resolveDirectoryCandidate(sourcePath);
194
- const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'oracle-cookies-'));
195
- const tempPath = path.join(tempDir, 'Cookies');
196
- await fs.copyFile(resolved, tempPath);
197
- return tempPath;
198
- }
199
- async function resolveDirectoryCandidate(inputPath) {
200
- const stat = await fs.stat(inputPath).catch(() => null);
201
- if (!stat?.isDirectory())
202
- return inputPath;
203
- const network = path.join(inputPath, 'Network', 'Cookies');
204
- const direct = path.join(inputPath, 'Cookies');
205
- if (await fileExists(network))
206
- return network;
207
- if (await fileExists(direct))
208
- return direct;
209
- return inputPath;
210
- }
211
- async function fileExists(candidate) {
212
- try {
213
- const stat = await fsp.stat(candidate);
214
- return stat.isFile();
215
- }
216
- catch {
217
- return false;
218
- }
219
- }