@zonease/happy 0.6.37 → 0.6.39
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/dist/{types-DYCJXXdA.mjs → api-CIZKyfSn.mjs} +136 -1725
- package/dist/{types-BrTorNAy.cjs → api-CwOCQeLH.cjs} +317 -1961
- package/dist/auth-0VnlXT9f.mjs +181 -0
- package/dist/auth-BE8dD20T.mjs +270 -0
- package/dist/auth-BIleVCw0.cjs +274 -0
- package/dist/auth-Cas9DR3b.cjs +183 -0
- package/dist/browser-Cc08m7of.cjs +22 -0
- package/dist/browser-Dll5hxOV.mjs +20 -0
- package/dist/claudeLocal-CPT3zcIU.mjs +344 -0
- package/dist/claudeLocal-WkgLbl1a.cjs +352 -0
- package/dist/codex/happyMcpStdioBridge.cjs +4 -1
- package/dist/codex/happyMcpStdioBridge.mjs +4 -1
- package/dist/common-BdNgghUJ.mjs +75 -0
- package/dist/common-CZvSRU4p.cjs +83 -0
- package/dist/{config-D_g6ohaV.cjs → config-Draa-5XC.cjs} +21 -34
- package/dist/{config-DPn-cbpz.mjs → config-rTT4qTU5.mjs} +7 -20
- package/dist/connect-BfC1tYP_.mjs +679 -0
- package/dist/connect-CJZ73syK.cjs +681 -0
- package/dist/{constants-B4x1K7by.cjs → constants-E_UWYTo3.cjs} +2 -2
- package/dist/{constants-BO9OAFOT.mjs → constants-pmXZGibX.mjs} +1 -1
- package/dist/controlClient-CM_QcJnB.mjs +159 -0
- package/dist/controlClient-DZMIsKsT.cjs +168 -0
- package/dist/deviceExec-CU1R9CRb.cjs +84 -0
- package/dist/deviceExec-D93AOVV4.mjs +81 -0
- package/dist/diagnose-B3D1a_v0.cjs +60 -0
- package/dist/diagnose-CuRKXxt1.mjs +58 -0
- package/dist/doctor-C08m5Z9f.cjs +78 -0
- package/dist/doctor-Cya9YSA0.cjs +214 -0
- package/dist/doctor-DZYB6IVc.mjs +211 -0
- package/dist/doctor-ON7pN5G5.mjs +74 -0
- package/dist/downloadImage-DfSFLb-h.mjs +887 -0
- package/dist/downloadImage-MQMrUUxS.cjs +897 -0
- package/dist/enroll-BxlbVftP.cjs +115 -0
- package/dist/enroll-C52x8oly.mjs +113 -0
- package/dist/evidence-Ccd9iYcj.mjs +127 -0
- package/dist/evidence-CjWBG5rX.cjs +129 -0
- package/dist/formatImageMessage-B4lSxlk2.mjs +43 -0
- package/dist/formatImageMessage-DbyG8c2j.cjs +46 -0
- package/dist/github-DKcyF1zp.mjs +57 -0
- package/dist/github-h9GhJJ_C.cjs +59 -0
- package/dist/index-CDTNgfUf.cjs +578 -0
- package/dist/index-CPKdvi7J.mjs +554 -0
- package/dist/index.cjs +812 -40
- package/dist/index.mjs +813 -40
- package/dist/install-BokHRgFW.cjs +98 -0
- package/dist/install-C_cp8b2-.cjs +96 -0
- package/dist/install-DAeCn8ae.mjs +94 -0
- package/dist/install-oRAjVLjP.mjs +95 -0
- package/dist/lib.cjs +18 -12
- package/dist/lib.d.cts +16 -16
- package/dist/lib.d.mts +16 -16
- package/dist/lib.mjs +13 -7
- package/dist/{loadableToolOutput-lQH8Kb_w.mjs → loadableToolOutput-Cuygmd4K.mjs} +4 -2
- package/dist/{loadableToolOutput-CasonFIt.cjs → loadableToolOutput-DDCJjywt.cjs} +63 -61
- package/dist/mcpToolSchemas-CjeTfrAs.mjs +62 -0
- package/dist/mcpToolSchemas-DK42yoZ_.cjs +64 -0
- package/dist/persistence-BFjvtUad.mjs +944 -0
- package/dist/persistence-JLUn_Nou.cjs +996 -0
- package/dist/projectPath-BTBIMB57.mjs +10 -0
- package/dist/projectPath-ChLhdOyt.cjs +13 -0
- package/dist/prompt-BTWDZZO0.cjs +25 -0
- package/dist/prompt-BsAZsPbo.mjs +22 -0
- package/dist/release-BMEzNONE.mjs +168 -0
- package/dist/release-EhOJeAZe.cjs +171 -0
- package/dist/run-BDn2aE3Q.cjs +2152 -0
- package/dist/run-DBZqN6Kn.mjs +2128 -0
- package/dist/runClaude-DNHvERX0.mjs +3763 -0
- package/dist/runClaude-uaKxPZPm.cjs +3766 -0
- package/dist/{runCodex-BTt3fxG4.cjs → runCodex-82UrZLme.cjs} +169 -153
- package/dist/{runCodex-BXCB5trB.mjs → runCodex-C-RTM0wA.mjs} +36 -20
- package/dist/{runGemini-37HHbp9n.mjs → runGemini-Bm6-4Xm2.mjs} +34 -17
- package/dist/{runGemini-C-0nSFBv.cjs → runGemini-CXMr4Jwb.cjs} +212 -195
- package/dist/{runOneShot-CXhbFJ2j.cjs → runOneShot-1B6RMYT7.cjs} +31 -55
- package/dist/{runOneShot-USX8QPfE.mjs → runOneShot-ioARRHrx.mjs} +14 -38
- package/dist/{serve-DZAq-_1F.cjs → serve-BtdAhkIE.cjs} +35 -58
- package/dist/{serve-BRedJPzL.mjs → serve-CwibwU6N.mjs} +12 -35
- package/dist/session-2sU4Bu1R.mjs +108 -0
- package/dist/session-D--F87zL.cjs +110 -0
- package/dist/sessionKeyCache-4Tp8pJ3N.cjs +36 -0
- package/dist/sessionKeyCache-D2BwO91C.mjs +33 -0
- package/dist/sessionList-BCSw3qYt.mjs +51 -0
- package/dist/sessionList-ICJsjNtJ.cjs +54 -0
- package/dist/sessionSummary-Bkz52BPh.cjs +393 -0
- package/dist/sessionSummary-lHGBWQSb.mjs +387 -0
- package/dist/spawnHappyCLI-CoORX0YW.mjs +66 -0
- package/dist/spawnHappyCLI-D_V-AAoP.cjs +70 -0
- package/dist/ssh-BTOlhhxi.cjs +333 -0
- package/dist/ssh-DL_AkRAD.mjs +328 -0
- package/dist/systemdScope-BeOtAkhk.mjs +25 -0
- package/dist/systemdScope-DW3-UoKB.cjs +29 -0
- package/dist/task-CQzrHRZe.mjs +165 -0
- package/dist/task-CSpaC9HX.cjs +167 -0
- package/dist/time-Bj2HRkKH.cjs +33 -0
- package/dist/time-DgsBLJA_.mjs +29 -0
- package/dist/trimIdent-4gvk9Wk6.cjs +22 -0
- package/dist/trimIdent-BAjmv_TG.mjs +20 -0
- package/dist/types-BoJh4Qfv.mjs +57 -0
- package/dist/types-DWeB7aqh.cjs +59 -0
- package/dist/uninstall-BiKyRAb1.cjs +77 -0
- package/dist/uninstall-nFMFGUVM.mjs +75 -0
- package/dist/update-BcqRHXf2.mjs +109 -0
- package/dist/update-Dw8pgsAT.cjs +111 -0
- package/dist/workflowCommon-B0d01Y_a.mjs +56 -0
- package/dist/workflowCommon-Bl568-rt.cjs +62 -0
- package/dist/workflowReports-BEWuQesA.cjs +113 -0
- package/dist/workflowReports-Dd8-4-8f.mjs +108 -0
- package/package.json +1 -1
- package/dist/index-BlkHOkB3.cjs +0 -11312
- package/dist/index-DJ2VpGiR.mjs +0 -11272
- package/dist/mcpToolSchemas-CdPXJQmb.mjs +0 -175
- package/dist/mcpToolSchemas-f-kttjFw.cjs +0 -186
|
@@ -5,7 +5,10 @@ var stdio_js = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
|
5
5
|
var index_js = require('@modelcontextprotocol/sdk/client/index.js');
|
|
6
6
|
var streamableHttp_js = require('@modelcontextprotocol/sdk/client/streamableHttp.js');
|
|
7
7
|
var z = require('zod');
|
|
8
|
-
require('../
|
|
8
|
+
require('../prompt-BTWDZZO0.cjs');
|
|
9
|
+
require('../mcpToolSchemas-DK42yoZ_.cjs');
|
|
10
|
+
require('../trimIdent-4gvk9Wk6.cjs');
|
|
11
|
+
require('../common-CZvSRU4p.cjs');
|
|
9
12
|
|
|
10
13
|
function parseArgs(argv) {
|
|
11
14
|
let url = null;
|
|
@@ -3,7 +3,10 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
|
|
|
3
3
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
4
4
|
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
import '../
|
|
6
|
+
import '../prompt-BsAZsPbo.mjs';
|
|
7
|
+
import '../mcpToolSchemas-CjeTfrAs.mjs';
|
|
8
|
+
import '../trimIdent-BAjmv_TG.mjs';
|
|
9
|
+
import '../common-BdNgghUJ.mjs';
|
|
7
10
|
|
|
8
11
|
function parseArgs(argv) {
|
|
9
12
|
let url = null;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
const ORCHESTRATOR_PROVIDERS = ["claude", "codex", "gemini"];
|
|
2
|
+
const ORCHESTRATOR_ENV_KEYS = {
|
|
3
|
+
oneshot: "HAPPY_ORCH_ONESHOT",
|
|
4
|
+
executionId: "HAPPY_ORCH_EXECUTION_ID",
|
|
5
|
+
runId: "HAPPY_ORCH_RUN_ID",
|
|
6
|
+
taskId: "HAPPY_ORCH_TASK_ID",
|
|
7
|
+
executionType: "HAPPY_ORCH_EXECUTION_TYPE",
|
|
8
|
+
childSessionId: "HAPPY_ORCH_CHILD_SESSION_ID",
|
|
9
|
+
modelMode: "HAPPY_ORCH_MODEL_MODE",
|
|
10
|
+
promptB64: "HAPPY_ORCH_PROMPT_B64",
|
|
11
|
+
timeoutMs: "HAPPY_ORCH_TIMEOUT_MS",
|
|
12
|
+
workingDirectory: "HAPPY_ORCH_WORKING_DIRECTORY"
|
|
13
|
+
};
|
|
14
|
+
function isOrchestratorProvider(value) {
|
|
15
|
+
return typeof value === "string" && ORCHESTRATOR_PROVIDERS.includes(value);
|
|
16
|
+
}
|
|
17
|
+
function mapFinishStatus(reason) {
|
|
18
|
+
if (reason.watchdogTriggered) {
|
|
19
|
+
return "timeout";
|
|
20
|
+
}
|
|
21
|
+
if (reason.cancelRequested) {
|
|
22
|
+
return "cancelled";
|
|
23
|
+
}
|
|
24
|
+
if (reason.exitCode === 0) {
|
|
25
|
+
return "completed";
|
|
26
|
+
}
|
|
27
|
+
return "failed";
|
|
28
|
+
}
|
|
29
|
+
function encodePromptToBase64(prompt) {
|
|
30
|
+
return Buffer.from(prompt, "utf8").toString("base64");
|
|
31
|
+
}
|
|
32
|
+
function decodePromptFromBase64(promptB64) {
|
|
33
|
+
return Buffer.from(promptB64, "base64").toString("utf8");
|
|
34
|
+
}
|
|
35
|
+
function buildOrchestratorEnv(payload) {
|
|
36
|
+
const env = {
|
|
37
|
+
[ORCHESTRATOR_ENV_KEYS.oneshot]: "1",
|
|
38
|
+
[ORCHESTRATOR_ENV_KEYS.executionId]: payload.executionId,
|
|
39
|
+
[ORCHESTRATOR_ENV_KEYS.runId]: payload.runId,
|
|
40
|
+
[ORCHESTRATOR_ENV_KEYS.taskId]: payload.taskId,
|
|
41
|
+
[ORCHESTRATOR_ENV_KEYS.executionType]: payload.executionType,
|
|
42
|
+
[ORCHESTRATOR_ENV_KEYS.promptB64]: encodePromptToBase64(payload.prompt),
|
|
43
|
+
[ORCHESTRATOR_ENV_KEYS.timeoutMs]: String(payload.timeoutMs)
|
|
44
|
+
};
|
|
45
|
+
if (payload.childSessionId) {
|
|
46
|
+
env[ORCHESTRATOR_ENV_KEYS.childSessionId] = payload.childSessionId;
|
|
47
|
+
}
|
|
48
|
+
if (payload.workingDirectory) {
|
|
49
|
+
env[ORCHESTRATOR_ENV_KEYS.workingDirectory] = payload.workingDirectory;
|
|
50
|
+
}
|
|
51
|
+
if (payload.model) {
|
|
52
|
+
env[ORCHESTRATOR_ENV_KEYS.modelMode] = payload.model;
|
|
53
|
+
}
|
|
54
|
+
return env;
|
|
55
|
+
}
|
|
56
|
+
function appendOutputChunk(current, chunk, maxChars) {
|
|
57
|
+
const combined = `${current}${chunk}`;
|
|
58
|
+
if (combined.length <= maxChars) {
|
|
59
|
+
return combined;
|
|
60
|
+
}
|
|
61
|
+
return combined.slice(combined.length - maxChars);
|
|
62
|
+
}
|
|
63
|
+
function buildOutputSummary(stdout, stderr, maxChars = 400) {
|
|
64
|
+
const source = stdout.trim() ? stdout : stderr;
|
|
65
|
+
if (!source.trim()) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
const lastLine = source.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0).at(-1) ?? source.trim();
|
|
69
|
+
if (lastLine.length <= maxChars) {
|
|
70
|
+
return lastLine;
|
|
71
|
+
}
|
|
72
|
+
return `${lastLine.slice(0, maxChars - 3)}...`;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export { ORCHESTRATOR_ENV_KEYS as O, buildOrchestratorEnv as a, buildOutputSummary as b, appendOutputChunk as c, decodePromptFromBase64 as d, isOrchestratorProvider as i, mapFinishStatus as m };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const ORCHESTRATOR_PROVIDERS = ["claude", "codex", "gemini"];
|
|
4
|
+
const ORCHESTRATOR_ENV_KEYS = {
|
|
5
|
+
oneshot: "HAPPY_ORCH_ONESHOT",
|
|
6
|
+
executionId: "HAPPY_ORCH_EXECUTION_ID",
|
|
7
|
+
runId: "HAPPY_ORCH_RUN_ID",
|
|
8
|
+
taskId: "HAPPY_ORCH_TASK_ID",
|
|
9
|
+
executionType: "HAPPY_ORCH_EXECUTION_TYPE",
|
|
10
|
+
childSessionId: "HAPPY_ORCH_CHILD_SESSION_ID",
|
|
11
|
+
modelMode: "HAPPY_ORCH_MODEL_MODE",
|
|
12
|
+
promptB64: "HAPPY_ORCH_PROMPT_B64",
|
|
13
|
+
timeoutMs: "HAPPY_ORCH_TIMEOUT_MS",
|
|
14
|
+
workingDirectory: "HAPPY_ORCH_WORKING_DIRECTORY"
|
|
15
|
+
};
|
|
16
|
+
function isOrchestratorProvider(value) {
|
|
17
|
+
return typeof value === "string" && ORCHESTRATOR_PROVIDERS.includes(value);
|
|
18
|
+
}
|
|
19
|
+
function mapFinishStatus(reason) {
|
|
20
|
+
if (reason.watchdogTriggered) {
|
|
21
|
+
return "timeout";
|
|
22
|
+
}
|
|
23
|
+
if (reason.cancelRequested) {
|
|
24
|
+
return "cancelled";
|
|
25
|
+
}
|
|
26
|
+
if (reason.exitCode === 0) {
|
|
27
|
+
return "completed";
|
|
28
|
+
}
|
|
29
|
+
return "failed";
|
|
30
|
+
}
|
|
31
|
+
function encodePromptToBase64(prompt) {
|
|
32
|
+
return Buffer.from(prompt, "utf8").toString("base64");
|
|
33
|
+
}
|
|
34
|
+
function decodePromptFromBase64(promptB64) {
|
|
35
|
+
return Buffer.from(promptB64, "base64").toString("utf8");
|
|
36
|
+
}
|
|
37
|
+
function buildOrchestratorEnv(payload) {
|
|
38
|
+
const env = {
|
|
39
|
+
[ORCHESTRATOR_ENV_KEYS.oneshot]: "1",
|
|
40
|
+
[ORCHESTRATOR_ENV_KEYS.executionId]: payload.executionId,
|
|
41
|
+
[ORCHESTRATOR_ENV_KEYS.runId]: payload.runId,
|
|
42
|
+
[ORCHESTRATOR_ENV_KEYS.taskId]: payload.taskId,
|
|
43
|
+
[ORCHESTRATOR_ENV_KEYS.executionType]: payload.executionType,
|
|
44
|
+
[ORCHESTRATOR_ENV_KEYS.promptB64]: encodePromptToBase64(payload.prompt),
|
|
45
|
+
[ORCHESTRATOR_ENV_KEYS.timeoutMs]: String(payload.timeoutMs)
|
|
46
|
+
};
|
|
47
|
+
if (payload.childSessionId) {
|
|
48
|
+
env[ORCHESTRATOR_ENV_KEYS.childSessionId] = payload.childSessionId;
|
|
49
|
+
}
|
|
50
|
+
if (payload.workingDirectory) {
|
|
51
|
+
env[ORCHESTRATOR_ENV_KEYS.workingDirectory] = payload.workingDirectory;
|
|
52
|
+
}
|
|
53
|
+
if (payload.model) {
|
|
54
|
+
env[ORCHESTRATOR_ENV_KEYS.modelMode] = payload.model;
|
|
55
|
+
}
|
|
56
|
+
return env;
|
|
57
|
+
}
|
|
58
|
+
function appendOutputChunk(current, chunk, maxChars) {
|
|
59
|
+
const combined = `${current}${chunk}`;
|
|
60
|
+
if (combined.length <= maxChars) {
|
|
61
|
+
return combined;
|
|
62
|
+
}
|
|
63
|
+
return combined.slice(combined.length - maxChars);
|
|
64
|
+
}
|
|
65
|
+
function buildOutputSummary(stdout, stderr, maxChars = 400) {
|
|
66
|
+
const source = stdout.trim() ? stdout : stderr;
|
|
67
|
+
if (!source.trim()) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
const lastLine = source.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0).at(-1) ?? source.trim();
|
|
71
|
+
if (lastLine.length <= maxChars) {
|
|
72
|
+
return lastLine;
|
|
73
|
+
}
|
|
74
|
+
return `${lastLine.slice(0, maxChars - 3)}...`;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
exports.ORCHESTRATOR_ENV_KEYS = ORCHESTRATOR_ENV_KEYS;
|
|
78
|
+
exports.appendOutputChunk = appendOutputChunk;
|
|
79
|
+
exports.buildOrchestratorEnv = buildOrchestratorEnv;
|
|
80
|
+
exports.buildOutputSummary = buildOutputSummary;
|
|
81
|
+
exports.decodePromptFromBase64 = decodePromptFromBase64;
|
|
82
|
+
exports.isOrchestratorProvider = isOrchestratorProvider;
|
|
83
|
+
exports.mapFinishStatus = mapFinishStatus;
|
|
@@ -4,32 +4,19 @@ var fs = require('fs');
|
|
|
4
4
|
var path = require('path');
|
|
5
5
|
var os = require('os');
|
|
6
6
|
var child_process = require('child_process');
|
|
7
|
-
var
|
|
8
|
-
var constants = require('./constants-
|
|
9
|
-
require('
|
|
10
|
-
require('chalk');
|
|
7
|
+
var logger = require('./persistence-JLUn_Nou.cjs');
|
|
8
|
+
var constants = require('./constants-E_UWYTo3.cjs');
|
|
9
|
+
require('node:fs/promises');
|
|
11
10
|
require('node:fs');
|
|
12
11
|
require('node:os');
|
|
13
12
|
require('node:path');
|
|
14
|
-
require('node:events');
|
|
15
|
-
require('socket.io-client');
|
|
16
13
|
require('zod');
|
|
17
|
-
require('@paralleldrive/cuid2');
|
|
18
14
|
require('node:crypto');
|
|
19
15
|
require('tweetnacl');
|
|
20
|
-
require('
|
|
21
|
-
require('
|
|
22
|
-
require('
|
|
23
|
-
require('
|
|
24
|
-
require('fs/promises');
|
|
25
|
-
require('url');
|
|
26
|
-
require('node:module');
|
|
27
|
-
require('ws');
|
|
28
|
-
require('crypto');
|
|
29
|
-
require('@stablelib/base64');
|
|
30
|
-
require('node:readline');
|
|
31
|
-
require('expo-server-sdk');
|
|
32
|
-
require('./mcpToolSchemas-f-kttjFw.cjs');
|
|
16
|
+
require('chalk');
|
|
17
|
+
require('./prompt-BTWDZZO0.cjs');
|
|
18
|
+
require('./trimIdent-4gvk9Wk6.cjs');
|
|
19
|
+
require('./common-CZvSRU4p.cjs');
|
|
33
20
|
|
|
34
21
|
function readGeminiLocalConfig() {
|
|
35
22
|
let token = null;
|
|
@@ -52,14 +39,14 @@ function readGeminiLocalConfig() {
|
|
|
52
39
|
const foundToken = config.access_token || config.token || config.apiKey || config.GEMINI_API_KEY;
|
|
53
40
|
if (foundToken && typeof foundToken === "string") {
|
|
54
41
|
token = foundToken;
|
|
55
|
-
|
|
42
|
+
logger.logger.debug(`[Gemini] Found token in ${configPath}`);
|
|
56
43
|
}
|
|
57
44
|
}
|
|
58
45
|
if (!model) {
|
|
59
46
|
const foundModel = config.model || config.GEMINI_MODEL;
|
|
60
47
|
if (foundModel && typeof foundModel === "string") {
|
|
61
48
|
model = foundModel;
|
|
62
|
-
|
|
49
|
+
logger.logger.debug(`[Gemini] Found model in ${configPath}: ${model}`);
|
|
63
50
|
}
|
|
64
51
|
}
|
|
65
52
|
if (!googleCloudProject) {
|
|
@@ -69,11 +56,11 @@ function readGeminiLocalConfig() {
|
|
|
69
56
|
if (config.googleCloudProjectEmail && typeof config.googleCloudProjectEmail === "string") {
|
|
70
57
|
googleCloudProjectEmail = config.googleCloudProjectEmail;
|
|
71
58
|
}
|
|
72
|
-
|
|
59
|
+
logger.logger.debug(`[Gemini] Found Google Cloud Project in ${configPath}: ${googleCloudProject}${googleCloudProjectEmail ? ` (for ${googleCloudProjectEmail})` : ""}`);
|
|
73
60
|
}
|
|
74
61
|
}
|
|
75
62
|
} catch (error) {
|
|
76
|
-
|
|
63
|
+
logger.logger.debug(`[Gemini] Failed to read config from ${configPath}:`, error);
|
|
77
64
|
}
|
|
78
65
|
}
|
|
79
66
|
}
|
|
@@ -86,10 +73,10 @@ function readGeminiLocalConfig() {
|
|
|
86
73
|
}).trim();
|
|
87
74
|
if (gcloudToken && gcloudToken.length > 0) {
|
|
88
75
|
token = gcloudToken;
|
|
89
|
-
|
|
76
|
+
logger.logger.debug("[Gemini] Found token via gcloud Application Default Credentials");
|
|
90
77
|
}
|
|
91
78
|
} catch (error) {
|
|
92
|
-
|
|
79
|
+
logger.logger.debug("[Gemini] gcloud Application Default Credentials not available");
|
|
93
80
|
}
|
|
94
81
|
}
|
|
95
82
|
if (!googleCloudProject) {
|
|
@@ -97,7 +84,7 @@ function readGeminiLocalConfig() {
|
|
|
97
84
|
if (envProject) {
|
|
98
85
|
googleCloudProject = envProject;
|
|
99
86
|
googleCloudProjectEmail = null;
|
|
100
|
-
|
|
87
|
+
logger.logger.debug(`[Gemini] Found Google Cloud Project from env: ${googleCloudProject}`);
|
|
101
88
|
}
|
|
102
89
|
}
|
|
103
90
|
return { token, model, googleCloudProject, googleCloudProjectEmail };
|
|
@@ -111,9 +98,9 @@ function determineGeminiModel(explicitModel, localConfig) {
|
|
|
111
98
|
}
|
|
112
99
|
} else {
|
|
113
100
|
const envModel = process.env[constants.GEMINI_MODEL_ENV];
|
|
114
|
-
|
|
101
|
+
logger.logger.debug(`[Gemini] Model selection: env[GEMINI_MODEL_ENV]=${envModel}, localConfig.model=${localConfig.model}, DEFAULT=${constants.DEFAULT_GEMINI_MODEL}`);
|
|
115
102
|
const model = envModel || localConfig.model || constants.DEFAULT_GEMINI_MODEL;
|
|
116
|
-
|
|
103
|
+
logger.logger.debug(`[Gemini] Selected model: ${model}`);
|
|
117
104
|
return model;
|
|
118
105
|
}
|
|
119
106
|
}
|
|
@@ -129,15 +116,15 @@ function saveGeminiModelToConfig(model) {
|
|
|
129
116
|
try {
|
|
130
117
|
config = JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
131
118
|
} catch (error) {
|
|
132
|
-
|
|
119
|
+
logger.logger.debug(`[Gemini] Failed to read existing config, creating new one`);
|
|
133
120
|
config = {};
|
|
134
121
|
}
|
|
135
122
|
}
|
|
136
123
|
config.model = model;
|
|
137
124
|
fs.writeFileSync(configPath, JSON.stringify(config, null, 2), "utf-8");
|
|
138
|
-
|
|
125
|
+
logger.logger.debug(`[Gemini] Saved model "${model}" to ${configPath}`);
|
|
139
126
|
} catch (error) {
|
|
140
|
-
|
|
127
|
+
logger.logger.debug(`[Gemini] Failed to save model to config:`, error);
|
|
141
128
|
}
|
|
142
129
|
}
|
|
143
130
|
function saveGoogleCloudProjectToConfig(projectId, email) {
|
|
@@ -160,9 +147,9 @@ function saveGoogleCloudProjectToConfig(projectId, email) {
|
|
|
160
147
|
config.googleCloudProjectEmail = email;
|
|
161
148
|
}
|
|
162
149
|
fs.writeFileSync(configPath, JSON.stringify(config, null, 2), "utf-8");
|
|
163
|
-
|
|
150
|
+
logger.logger.debug(`[Gemini] Saved Google Cloud Project "${projectId}"${email ? ` for ${email}` : ""} to ${configPath}`);
|
|
164
151
|
} catch (error) {
|
|
165
|
-
|
|
152
|
+
logger.logger.debug(`[Gemini] Failed to save Google Cloud Project to config:`, error);
|
|
166
153
|
throw error;
|
|
167
154
|
}
|
|
168
155
|
}
|
|
@@ -2,32 +2,19 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
|
2
2
|
import { join } from 'path';
|
|
3
3
|
import { homedir } from 'os';
|
|
4
4
|
import { execSync } from 'child_process';
|
|
5
|
-
import { l as logger } from './
|
|
6
|
-
import { D as DEFAULT_GEMINI_MODEL, G as GEMINI_MODEL_ENV } from './constants-
|
|
7
|
-
import '
|
|
8
|
-
import 'chalk';
|
|
5
|
+
import { l as logger } from './persistence-BFjvtUad.mjs';
|
|
6
|
+
import { D as DEFAULT_GEMINI_MODEL, G as GEMINI_MODEL_ENV } from './constants-pmXZGibX.mjs';
|
|
7
|
+
import 'node:fs/promises';
|
|
9
8
|
import 'node:fs';
|
|
10
9
|
import 'node:os';
|
|
11
10
|
import 'node:path';
|
|
12
|
-
import 'node:events';
|
|
13
|
-
import 'socket.io-client';
|
|
14
11
|
import 'zod';
|
|
15
|
-
import '@paralleldrive/cuid2';
|
|
16
12
|
import 'node:crypto';
|
|
17
13
|
import 'tweetnacl';
|
|
18
|
-
import '
|
|
19
|
-
import '
|
|
20
|
-
import '
|
|
21
|
-
import '
|
|
22
|
-
import 'fs/promises';
|
|
23
|
-
import 'url';
|
|
24
|
-
import 'node:module';
|
|
25
|
-
import 'ws';
|
|
26
|
-
import 'crypto';
|
|
27
|
-
import '@stablelib/base64';
|
|
28
|
-
import 'node:readline';
|
|
29
|
-
import 'expo-server-sdk';
|
|
30
|
-
import './mcpToolSchemas-CdPXJQmb.mjs';
|
|
14
|
+
import 'chalk';
|
|
15
|
+
import './prompt-BsAZsPbo.mjs';
|
|
16
|
+
import './trimIdent-BAjmv_TG.mjs';
|
|
17
|
+
import './common-BdNgghUJ.mjs';
|
|
31
18
|
|
|
32
19
|
function readGeminiLocalConfig() {
|
|
33
20
|
let token = null;
|