@steipete/oracle 0.9.0 → 0.10.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/LICENSE +1 -1
- package/README.md +61 -48
- package/dist/bin/oracle-cli.js +455 -402
- package/dist/bin/oracle-mcp.js +2 -2
- package/dist/bin/oracle.js +165 -279
- package/dist/scripts/agent-send.js +31 -31
- package/dist/scripts/check.js +6 -6
- package/dist/scripts/debug/extract-chatgpt-response.js +10 -10
- package/dist/scripts/docs-list.js +30 -30
- package/dist/scripts/git-policy.js +25 -23
- package/dist/scripts/run-cli.js +8 -8
- package/dist/scripts/runner.js +203 -195
- package/dist/scripts/test-browser.js +21 -18
- package/dist/scripts/test-remote-chrome.js +20 -20
- package/dist/src/bridge/connection.js +18 -18
- package/dist/src/bridge/userConfigFile.js +7 -7
- package/dist/src/browser/actions/assistantResponse.js +149 -101
- package/dist/src/browser/actions/attachmentDataTransfer.js +49 -47
- package/dist/src/browser/actions/attachments.js +246 -150
- package/dist/src/browser/actions/domEvents.js +2 -2
- package/dist/src/browser/actions/modelSelection.js +275 -117
- package/dist/src/browser/actions/navigation.js +161 -137
- package/dist/src/browser/actions/promptComposer.js +100 -64
- package/dist/src/browser/actions/remoteFileTransfer.js +10 -10
- package/dist/src/browser/actions/thinkingTime.js +207 -110
- package/dist/src/browser/chromeLifecycle.js +62 -60
- package/dist/src/browser/config.js +34 -15
- package/dist/src/browser/constants.js +17 -12
- package/dist/src/browser/cookies.js +19 -19
- package/dist/src/browser/detect.js +62 -62
- package/dist/src/browser/domDebug.js +1 -1
- package/dist/src/browser/index.js +390 -295
- package/dist/src/browser/modelStrategy.js +1 -1
- package/dist/src/browser/pageActions.js +5 -5
- package/dist/src/browser/policies.js +16 -13
- package/dist/src/browser/profileState.js +44 -39
- package/dist/src/browser/prompt.js +72 -42
- package/dist/src/browser/promptSummary.js +5 -5
- package/dist/src/browser/providerDomFlow.js +1 -1
- package/dist/src/browser/providers/chatgptDomProvider.js +9 -9
- package/dist/src/browser/providers/geminiDeepThinkDomProvider.js +51 -42
- package/dist/src/browser/providers/index.js +2 -2
- package/dist/src/browser/reattach.js +67 -34
- package/dist/src/browser/reattachHelpers.js +31 -26
- package/dist/src/browser/sessionRunner.js +37 -25
- package/dist/src/browser/utils.js +9 -9
- package/dist/src/browserMode.js +1 -1
- package/dist/src/cli/bridge/claudeConfig.js +16 -16
- package/dist/src/cli/bridge/client.js +28 -20
- package/dist/src/cli/bridge/codexConfig.js +16 -16
- package/dist/src/cli/bridge/doctor.js +47 -39
- package/dist/src/cli/bridge/host.js +58 -56
- package/dist/src/cli/browserConfig.js +62 -48
- package/dist/src/cli/browserDefaults.js +27 -26
- package/dist/src/cli/bundleWarnings.js +1 -1
- package/dist/src/cli/clipboard.js +11 -2
- package/dist/src/cli/detach.js +2 -2
- package/dist/src/cli/dryRun.js +29 -25
- package/dist/src/cli/duplicatePromptGuard.js +3 -3
- package/dist/src/cli/engine.js +9 -9
- package/dist/src/cli/errorUtils.js +1 -1
- package/dist/src/cli/fileSize.js +3 -3
- package/dist/src/cli/format.js +2 -2
- package/dist/src/cli/help.js +28 -28
- package/dist/src/cli/hiddenAliases.js +3 -3
- package/dist/src/cli/markdownBundle.js +7 -7
- package/dist/src/cli/markdownRenderer.js +15 -15
- package/dist/src/cli/notifier.js +77 -67
- package/dist/src/cli/options.js +127 -106
- package/dist/src/cli/oscUtils.js +1 -1
- package/dist/src/cli/promptRequirement.js +2 -2
- package/dist/src/cli/renderOutput.js +1 -1
- package/dist/src/cli/rootAlias.js +1 -1
- package/dist/src/cli/runOptions.js +32 -28
- package/dist/src/cli/sessionCommand.js +31 -21
- package/dist/src/cli/sessionDisplay.js +95 -81
- package/dist/src/cli/sessionLineage.js +6 -2
- package/dist/src/cli/sessionRunner.js +103 -93
- package/dist/src/cli/sessionTable.js +26 -23
- package/dist/src/cli/stdin.js +22 -0
- package/dist/src/cli/tagline.js +121 -124
- package/dist/src/cli/tui/index.js +139 -128
- package/dist/src/cli/writeOutputPath.js +5 -5
- package/dist/src/config.js +7 -7
- package/dist/src/gemini-web/browserSessionManager.js +19 -15
- package/dist/src/gemini-web/client.js +76 -70
- package/dist/src/gemini-web/executionMode.js +6 -8
- package/dist/src/gemini-web/executor.js +98 -93
- package/dist/src/gemini-web/index.js +1 -1
- package/dist/src/mcp/server.js +16 -12
- package/dist/src/mcp/tools/consult.js +51 -47
- package/dist/src/mcp/tools/sessionResources.js +12 -12
- package/dist/src/mcp/tools/sessions.js +26 -17
- package/dist/src/mcp/types.js +5 -5
- package/dist/src/mcp/utils.js +15 -7
- package/dist/src/oracle/background.js +15 -15
- package/dist/src/oracle/claude.js +53 -25
- package/dist/src/oracle/client.js +50 -41
- package/dist/src/oracle/config.js +96 -66
- package/dist/src/oracle/errors.js +38 -38
- package/dist/src/oracle/files.js +55 -46
- package/dist/src/oracle/finishLine.js +10 -8
- package/dist/src/oracle/format.js +3 -3
- package/dist/src/oracle/gemini.js +37 -33
- package/dist/src/oracle/logging.js +7 -7
- package/dist/src/oracle/markdown.js +28 -28
- package/dist/src/oracle/modelResolver.js +16 -16
- package/dist/src/oracle/multiModelRunner.js +12 -12
- package/dist/src/oracle/oscProgress.js +8 -8
- package/dist/src/oracle/promptAssembly.js +6 -3
- package/dist/src/oracle/request.js +16 -13
- package/dist/src/oracle/run.js +156 -134
- package/dist/src/oracle/runUtils.js +8 -5
- package/dist/src/oracle/tokenEstimate.js +6 -6
- package/dist/src/oracle/tokenStats.js +5 -5
- package/dist/src/oracle/tokenStringifier.js +5 -5
- package/dist/src/oracle.js +12 -12
- package/dist/src/oracleHome.js +3 -3
- package/dist/src/remote/client.js +25 -25
- package/dist/src/remote/health.js +20 -20
- package/dist/src/remote/remoteServiceConfig.js +9 -9
- package/dist/src/remote/server.js +129 -118
- package/dist/src/sessionManager.js +77 -75
- package/dist/src/sessionStore.js +3 -3
- package/dist/src/version.js +10 -10
- package/dist/vendor/oracle-notifier/README.md +2 -0
- package/package.json +66 -62
- package/vendor/oracle-notifier/README.md +2 -0
- package/dist/markdansi/types/index.js +0 -4
- package/dist/oracle/bin/oracle-cli.js +0 -472
- package/dist/oracle/src/browser/actions/assistantResponse.js +0 -471
- package/dist/oracle/src/browser/actions/attachments.js +0 -82
- package/dist/oracle/src/browser/actions/modelSelection.js +0 -190
- package/dist/oracle/src/browser/actions/navigation.js +0 -75
- package/dist/oracle/src/browser/actions/promptComposer.js +0 -167
- package/dist/oracle/src/browser/chromeLifecycle.js +0 -104
- package/dist/oracle/src/browser/config.js +0 -33
- package/dist/oracle/src/browser/constants.js +0 -40
- package/dist/oracle/src/browser/cookies.js +0 -210
- package/dist/oracle/src/browser/domDebug.js +0 -36
- package/dist/oracle/src/browser/index.js +0 -331
- package/dist/oracle/src/browser/pageActions.js +0 -5
- package/dist/oracle/src/browser/prompt.js +0 -88
- package/dist/oracle/src/browser/promptSummary.js +0 -20
- package/dist/oracle/src/browser/sessionRunner.js +0 -80
- package/dist/oracle/src/browser/types.js +0 -1
- package/dist/oracle/src/browser/utils.js +0 -62
- package/dist/oracle/src/browserMode.js +0 -1
- package/dist/oracle/src/cli/browserConfig.js +0 -44
- package/dist/oracle/src/cli/dryRun.js +0 -59
- package/dist/oracle/src/cli/engine.js +0 -17
- package/dist/oracle/src/cli/errorUtils.js +0 -9
- package/dist/oracle/src/cli/help.js +0 -70
- package/dist/oracle/src/cli/markdownRenderer.js +0 -15
- package/dist/oracle/src/cli/options.js +0 -103
- package/dist/oracle/src/cli/promptRequirement.js +0 -14
- package/dist/oracle/src/cli/rootAlias.js +0 -30
- package/dist/oracle/src/cli/sessionCommand.js +0 -77
- package/dist/oracle/src/cli/sessionDisplay.js +0 -270
- package/dist/oracle/src/cli/sessionRunner.js +0 -94
- package/dist/oracle/src/heartbeat.js +0 -43
- package/dist/oracle/src/oracle/client.js +0 -48
- package/dist/oracle/src/oracle/config.js +0 -29
- package/dist/oracle/src/oracle/errors.js +0 -101
- package/dist/oracle/src/oracle/files.js +0 -220
- package/dist/oracle/src/oracle/format.js +0 -33
- package/dist/oracle/src/oracle/fsAdapter.js +0 -7
- package/dist/oracle/src/oracle/oscProgress.js +0 -60
- package/dist/oracle/src/oracle/request.js +0 -48
- package/dist/oracle/src/oracle/run.js +0 -444
- package/dist/oracle/src/oracle/tokenStats.js +0 -39
- package/dist/oracle/src/oracle/types.js +0 -1
- package/dist/oracle/src/oracle.js +0 -9
- package/dist/oracle/src/sessionManager.js +0 -205
- package/dist/oracle/src/version.js +0 -39
- package/dist/scripts/chrome/browser-tools.js +0 -295
- package/dist/src/browser/profileSync.js +0 -141
package/dist/src/cli/notifier.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import notifier from
|
|
2
|
-
import { spawn } from
|
|
3
|
-
import { formatUSD, formatNumber } from
|
|
4
|
-
import { MODEL_CONFIGS } from
|
|
5
|
-
import { estimateUsdCost } from
|
|
6
|
-
import fs from
|
|
7
|
-
import path from
|
|
8
|
-
import { createRequire } from
|
|
9
|
-
import { fileURLToPath } from
|
|
10
|
-
const ORACLE_EMOJI =
|
|
1
|
+
import notifier from "toasted-notifier";
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
import { formatUSD, formatNumber } from "../oracle/format.js";
|
|
4
|
+
import { MODEL_CONFIGS } from "../oracle/config.js";
|
|
5
|
+
import { estimateUsdCost } from "tokentally";
|
|
6
|
+
import fs from "node:fs/promises";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import { createRequire } from "node:module";
|
|
9
|
+
import { fileURLToPath } from "node:url";
|
|
10
|
+
const ORACLE_EMOJI = "🧿";
|
|
11
11
|
export function resolveNotificationSettings({ cliNotify, cliNotifySound, env, config, }) {
|
|
12
12
|
const defaultEnabled = !(bool(env.CI) || bool(env.SSH_CONNECTION) || muteByConfig(env, config));
|
|
13
13
|
const envNotify = parseToggle(env.ORACLE_NOTIFY);
|
|
@@ -20,7 +20,12 @@ export function deriveNotificationSettingsFromMetadata(metadata, env, config) {
|
|
|
20
20
|
if (metadata?.notifications) {
|
|
21
21
|
return metadata.notifications;
|
|
22
22
|
}
|
|
23
|
-
return resolveNotificationSettings({
|
|
23
|
+
return resolveNotificationSettings({
|
|
24
|
+
cliNotify: undefined,
|
|
25
|
+
cliNotifySound: undefined,
|
|
26
|
+
env,
|
|
27
|
+
config,
|
|
28
|
+
});
|
|
24
29
|
}
|
|
25
30
|
export async function sendSessionNotification(payload, settings, log, answerPreview) {
|
|
26
31
|
if (!settings.enabled || isTestEnv(process.env)) {
|
|
@@ -47,7 +52,7 @@ export async function sendSessionNotification(payload, settings, log, answerPrev
|
|
|
47
52
|
const repaired = await repairMacNotifier(log);
|
|
48
53
|
if (repaired) {
|
|
49
54
|
try {
|
|
50
|
-
await notifier.notify({ title, message, sound: settings.sound, ...
|
|
55
|
+
await notifier.notify({ title, message, sound: settings.sound, ...macAppIconOption() });
|
|
51
56
|
return;
|
|
52
57
|
}
|
|
53
58
|
catch (retryError) {
|
|
@@ -66,7 +71,7 @@ export async function sendSessionNotification(payload, settings, log, answerPrev
|
|
|
66
71
|
log(`(notify skipped: ${reason})`);
|
|
67
72
|
}
|
|
68
73
|
// Last-resort macOS fallback: AppleScript alert (simple, noisy, but works when helpers are blocked).
|
|
69
|
-
if (process.platform ===
|
|
74
|
+
if (process.platform === "darwin") {
|
|
70
75
|
try {
|
|
71
76
|
await sendOsascriptAlert(title, message, log);
|
|
72
77
|
return;
|
|
@@ -82,7 +87,7 @@ function buildMessage(payload, answerPreview) {
|
|
|
82
87
|
const sessionLabel = payload.sessionName || payload.sessionId;
|
|
83
88
|
parts.push(sessionLabel);
|
|
84
89
|
// Show cost only for API runs.
|
|
85
|
-
if (payload.mode ===
|
|
90
|
+
if (payload.mode === "api") {
|
|
86
91
|
const cost = payload.costUsd ?? inferCost(payload);
|
|
87
92
|
if (cost !== undefined) {
|
|
88
93
|
// Round to $0.00 for a concise toast.
|
|
@@ -95,26 +100,26 @@ function buildMessage(payload, answerPreview) {
|
|
|
95
100
|
if (answerPreview) {
|
|
96
101
|
parts.push(answerPreview);
|
|
97
102
|
}
|
|
98
|
-
return parts.join(
|
|
103
|
+
return parts.join(" · ");
|
|
99
104
|
}
|
|
100
105
|
function sanitizePreview(preview) {
|
|
101
106
|
if (!preview)
|
|
102
107
|
return undefined;
|
|
103
108
|
let text = preview;
|
|
104
109
|
// Strip code fences and inline code markers.
|
|
105
|
-
text = text.replace(/```[\s\S]*?```/g,
|
|
106
|
-
text = text.replace(/`([^`]+)`/g,
|
|
110
|
+
text = text.replace(/```[\s\S]*?```/g, " ");
|
|
111
|
+
text = text.replace(/`([^`]+)`/g, "$1");
|
|
107
112
|
// Convert markdown links and images to their visible text.
|
|
108
|
-
text = text.replace(/!\[([^\]]*)\]\([^)]+\)/g,
|
|
109
|
-
text = text.replace(/\[([^\]]+)\]\([^)]+\)/g,
|
|
113
|
+
text = text.replace(/!\[([^\]]*)\]\([^)]+\)/g, "$1");
|
|
114
|
+
text = text.replace(/\[([^\]]+)\]\([^)]+\)/g, "$1");
|
|
110
115
|
// Drop bold/italic markers.
|
|
111
|
-
text = text.replace(/(\*\*|__|\*|_)/g,
|
|
116
|
+
text = text.replace(/(\*\*|__|\*|_)/g, "");
|
|
112
117
|
// Remove headings / list markers / blockquotes.
|
|
113
|
-
text = text.replace(/^\s*#+\s*/gm,
|
|
114
|
-
text = text.replace(/^\s*[-*+]\s+/gm,
|
|
115
|
-
text = text.replace(/^\s*>\s+/gm,
|
|
118
|
+
text = text.replace(/^\s*#+\s*/gm, "");
|
|
119
|
+
text = text.replace(/^\s*[-*+]\s+/gm, "");
|
|
120
|
+
text = text.replace(/^\s*>\s+/gm, "");
|
|
116
121
|
// Collapse whitespace and trim.
|
|
117
|
-
text = text.replace(/\s+/g,
|
|
122
|
+
text = text.replace(/\s+/g, " ").trim();
|
|
118
123
|
// Limit length to keep notifications short.
|
|
119
124
|
const max = 200;
|
|
120
125
|
if (text.length > max) {
|
|
@@ -144,9 +149,9 @@ function parseToggle(value) {
|
|
|
144
149
|
if (value == null)
|
|
145
150
|
return undefined;
|
|
146
151
|
const normalized = value.trim().toLowerCase();
|
|
147
|
-
if ([
|
|
152
|
+
if (["1", "true", "yes", "on"].includes(normalized))
|
|
148
153
|
return true;
|
|
149
|
-
if ([
|
|
154
|
+
if (["0", "false", "no", "off"].includes(normalized))
|
|
150
155
|
return false;
|
|
151
156
|
return undefined;
|
|
152
157
|
}
|
|
@@ -154,17 +159,17 @@ function bool(value) {
|
|
|
154
159
|
return Boolean(value && String(value).length > 0);
|
|
155
160
|
}
|
|
156
161
|
function isMacExecError(error) {
|
|
157
|
-
return Boolean(process.platform ===
|
|
162
|
+
return Boolean(process.platform === "darwin" &&
|
|
158
163
|
error &&
|
|
159
|
-
typeof error ===
|
|
160
|
-
|
|
161
|
-
error.code ===
|
|
164
|
+
typeof error === "object" &&
|
|
165
|
+
"code" in error &&
|
|
166
|
+
error.code === "EACCES");
|
|
162
167
|
}
|
|
163
168
|
function isMacBadCpuError(error) {
|
|
164
|
-
return Boolean(process.platform ===
|
|
169
|
+
return Boolean(process.platform === "darwin" &&
|
|
165
170
|
error &&
|
|
166
|
-
typeof error ===
|
|
167
|
-
|
|
171
|
+
typeof error === "object" &&
|
|
172
|
+
"errno" in error &&
|
|
168
173
|
error.errno === -86);
|
|
169
174
|
}
|
|
170
175
|
async function repairMacNotifier(log) {
|
|
@@ -182,40 +187,45 @@ async function repairMacNotifier(log) {
|
|
|
182
187
|
}
|
|
183
188
|
}
|
|
184
189
|
function macNotifierPath() {
|
|
185
|
-
if (process.platform !==
|
|
190
|
+
if (process.platform !== "darwin")
|
|
186
191
|
return null;
|
|
187
192
|
try {
|
|
188
193
|
const req = createRequire(import.meta.url);
|
|
189
|
-
const modPath = req.resolve(
|
|
194
|
+
const modPath = req.resolve("toasted-notifier");
|
|
190
195
|
const base = path.dirname(modPath);
|
|
191
|
-
return path.join(base,
|
|
196
|
+
return path.join(base, "vendor", "mac.noindex", "terminal-notifier.app", "Contents", "MacOS", "terminal-notifier");
|
|
192
197
|
}
|
|
193
198
|
catch {
|
|
194
199
|
return null;
|
|
195
200
|
}
|
|
196
201
|
}
|
|
197
202
|
async function shouldSkipToastedNotifier() {
|
|
198
|
-
if (process.platform !==
|
|
203
|
+
if (process.platform !== "darwin")
|
|
199
204
|
return false;
|
|
200
205
|
// On Apple Silicon without Rosetta, prefer the native helper and skip x86-only fallback.
|
|
201
206
|
const arch = process.arch;
|
|
202
|
-
if (arch !==
|
|
207
|
+
if (arch !== "arm64")
|
|
203
208
|
return false;
|
|
204
209
|
return !(await hasRosetta());
|
|
205
210
|
}
|
|
206
211
|
async function hasRosetta() {
|
|
207
212
|
return new Promise((resolve) => {
|
|
208
|
-
const child = spawn(
|
|
209
|
-
|
|
210
|
-
|
|
213
|
+
const child = spawn("pkgutil", ["--files", "com.apple.pkg.RosettaUpdateAuto"], {
|
|
214
|
+
stdio: "ignore",
|
|
215
|
+
});
|
|
216
|
+
child.on("exit", (code) => resolve(code === 0));
|
|
217
|
+
child.on("error", () => resolve(false));
|
|
211
218
|
});
|
|
212
219
|
}
|
|
213
220
|
async function sendOsascriptAlert(title, message, _log) {
|
|
214
221
|
return new Promise((resolve, reject) => {
|
|
215
|
-
const child = spawn(
|
|
216
|
-
|
|
222
|
+
const child = spawn("osascript", [
|
|
223
|
+
"-e",
|
|
224
|
+
`display notification "${escapeAppleScript(message)}" with title "${escapeAppleScript(title)}"`,
|
|
225
|
+
], {
|
|
226
|
+
stdio: "ignore",
|
|
217
227
|
});
|
|
218
|
-
child.on(
|
|
228
|
+
child.on("exit", (code) => {
|
|
219
229
|
if (code === 0) {
|
|
220
230
|
resolve();
|
|
221
231
|
}
|
|
@@ -223,18 +233,18 @@ async function sendOsascriptAlert(title, message, _log) {
|
|
|
223
233
|
reject(new Error(`osascript exited with code ${code ?? -1}`));
|
|
224
234
|
}
|
|
225
235
|
});
|
|
226
|
-
child.on(
|
|
236
|
+
child.on("error", reject);
|
|
227
237
|
});
|
|
228
238
|
}
|
|
229
239
|
function escapeAppleScript(value) {
|
|
230
|
-
return value.replace(/\\/g,
|
|
240
|
+
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
231
241
|
}
|
|
232
242
|
function macAppIconOption() {
|
|
233
|
-
if (process.platform !==
|
|
243
|
+
if (process.platform !== "darwin")
|
|
234
244
|
return {};
|
|
235
245
|
const iconPaths = [
|
|
236
|
-
path.resolve(path.dirname(fileURLToPath(import.meta.url)),
|
|
237
|
-
path.resolve(process.cwd(),
|
|
246
|
+
path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../assets-oracle-icon.png"),
|
|
247
|
+
path.resolve(process.cwd(), "assets-oracle-icon.png"),
|
|
238
248
|
];
|
|
239
249
|
for (const candidate of iconPaths) {
|
|
240
250
|
if (candidate && fsExistsSync(candidate)) {
|
|
@@ -245,7 +255,7 @@ function macAppIconOption() {
|
|
|
245
255
|
}
|
|
246
256
|
function fsExistsSync(target) {
|
|
247
257
|
try {
|
|
248
|
-
return Boolean(require(
|
|
258
|
+
return Boolean(require("node:fs").statSync(target));
|
|
249
259
|
}
|
|
250
260
|
catch {
|
|
251
261
|
return false;
|
|
@@ -256,19 +266,19 @@ async function tryMacNativeNotifier(title, message, settings) {
|
|
|
256
266
|
if (!binary)
|
|
257
267
|
return false;
|
|
258
268
|
return new Promise((resolve) => {
|
|
259
|
-
const child = spawn(binary, [title, message, settings.sound ?
|
|
260
|
-
stdio:
|
|
269
|
+
const child = spawn(binary, [title, message, settings.sound ? "Glass" : ""], {
|
|
270
|
+
stdio: "ignore",
|
|
261
271
|
});
|
|
262
|
-
child.on(
|
|
263
|
-
child.on(
|
|
272
|
+
child.on("error", () => resolve(false));
|
|
273
|
+
child.on("exit", (code) => resolve(code === 0));
|
|
264
274
|
});
|
|
265
275
|
}
|
|
266
276
|
function macNativeNotifierPath() {
|
|
267
|
-
if (process.platform !==
|
|
277
|
+
if (process.platform !== "darwin")
|
|
268
278
|
return null;
|
|
269
279
|
const candidates = [
|
|
270
|
-
path.resolve(path.dirname(fileURLToPath(import.meta.url)),
|
|
271
|
-
path.resolve(process.cwd(),
|
|
280
|
+
path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../vendor/oracle-notifier/OracleNotifier.app/Contents/MacOS/OracleNotifier"),
|
|
281
|
+
path.resolve(process.cwd(), "vendor/oracle-notifier/OracleNotifier.app/Contents/MacOS/OracleNotifier"),
|
|
272
282
|
];
|
|
273
283
|
for (const candidate of candidates) {
|
|
274
284
|
if (fsExistsSync(candidate)) {
|
|
@@ -280,27 +290,27 @@ function macNativeNotifierPath() {
|
|
|
280
290
|
function muteByConfig(env, config) {
|
|
281
291
|
if (!config?.muteIn)
|
|
282
292
|
return false;
|
|
283
|
-
return ((config.muteIn.includes(
|
|
284
|
-
(config.muteIn.includes(
|
|
293
|
+
return ((config.muteIn.includes("CI") && bool(env.CI)) ||
|
|
294
|
+
(config.muteIn.includes("SSH") && bool(env.SSH_CONNECTION)));
|
|
285
295
|
}
|
|
286
296
|
function isTestEnv(env) {
|
|
287
|
-
return (env.ORACLE_DISABLE_NOTIFICATIONS ===
|
|
288
|
-
env.NODE_ENV ===
|
|
297
|
+
return (env.ORACLE_DISABLE_NOTIFICATIONS === "1" ||
|
|
298
|
+
env.NODE_ENV === "test" ||
|
|
289
299
|
Boolean(env.VITEST || env.VITEST_WORKER_ID || env.JEST_WORKER_ID));
|
|
290
300
|
}
|
|
291
301
|
function describeNotifierError(error) {
|
|
292
|
-
if (error && typeof error ===
|
|
302
|
+
if (error && typeof error === "object") {
|
|
293
303
|
const err = error;
|
|
294
|
-
if (typeof err.errno ===
|
|
295
|
-
const errno = typeof err.errno ===
|
|
304
|
+
if (typeof err.errno === "number" || typeof err.code === "string") {
|
|
305
|
+
const errno = typeof err.errno === "number" ? err.errno : undefined;
|
|
296
306
|
// macOS returns errno -86 for “Bad CPU type in executable” (e.g., wrong arch or quarantined binary).
|
|
297
307
|
if (errno === -86) {
|
|
298
|
-
return
|
|
308
|
+
return "notifier binary failed to launch (Bad CPU type/quarantine); try xattr -dr com.apple.quarantine vendor/oracle-notifier && ./vendor/oracle-notifier/build-notifier.sh";
|
|
299
309
|
}
|
|
300
310
|
}
|
|
301
|
-
if (typeof err.message ===
|
|
311
|
+
if (typeof err.message === "string") {
|
|
302
312
|
return err.message;
|
|
303
313
|
}
|
|
304
314
|
}
|
|
305
|
-
return typeof error ===
|
|
315
|
+
return typeof error === "string" ? error : String(error);
|
|
306
316
|
}
|