happy-imou-cloud 2.1.8 → 2.1.10
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/bin/happy-cloud.mjs +1 -1
- package/dist/{BaseReasoningProcessor-CbqNgi4p.cjs → BaseReasoningProcessor-8GjgD9Nk.cjs} +4 -3
- package/dist/{BaseReasoningProcessor-DJ9zxAdt.mjs → BaseReasoningProcessor-DbV-vhFy.mjs} +4 -3
- package/dist/{ProviderSelectionHandler-BZVtGMAn.cjs → ProviderSelectionHandler-DWeq9rG2.cjs} +2 -2
- package/dist/{ProviderSelectionHandler-BleheBks.mjs → ProviderSelectionHandler-DXgu2zND.mjs} +2 -2
- package/dist/{api-CeIpGPqs.cjs → api-8p1d7M3Z.cjs} +57 -5
- package/dist/{api-DRdn4-dL.mjs → api-Dp5_DJo0.mjs} +57 -5
- package/dist/{command-CTad-7bA.cjs → command-BtjeL-Z7.cjs} +3 -3
- package/dist/{command-mDMWVdh5.mjs → command-DRtgCMGi.mjs} +3 -3
- package/dist/{index-C4S85XB7.mjs → index-C_MTvw5p.mjs} +67 -10
- package/dist/{index-D68EOBHW.cjs → index-Dz1Zo1-d.cjs} +70 -13
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +3 -3
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.cts +1 -0
- package/dist/lib.d.mts +1 -0
- package/dist/lib.mjs +1 -1
- package/dist/{persistence-Czyd-Uei.cjs → persistence-De7JoaQp.cjs} +1 -1
- package/dist/{persistence-DgpGouOO.mjs → persistence-Ds1cKgQ_.mjs} +1 -1
- package/dist/{registerKillSessionHandler-Dg0DFPae.mjs → registerKillSessionHandler-Bqd1W5ZT.mjs} +3 -3
- package/dist/{registerKillSessionHandler-DECzSYvQ.cjs → registerKillSessionHandler-DL07DW1o.cjs} +3 -3
- package/dist/{runClaude-OWT6ZYiP.mjs → runClaude-BtMjqmaI.mjs} +5 -5
- package/dist/{runClaude-DtCH-nx-.cjs → runClaude-DF_hjle_.cjs} +5 -5
- package/dist/{runCodex-BU3BA1l8.mjs → runCodex-CxtZTXtC.mjs} +6 -6
- package/dist/{runCodex-reARLjN0.cjs → runCodex-MtvDLX7s.cjs} +6 -6
- package/dist/{runGemini-BvJUvOvj.cjs → runGemini-Bf8tmYeU.cjs} +5 -5
- package/dist/{runGemini-DeLxSapY.mjs → runGemini-CmRPi60L.mjs} +5 -5
- package/package.json +1 -1
- package/scripts/devtools/README.md +9 -9
- package/scripts/e2e/fake-codex-acp-agent.mjs +139 -139
- package/scripts/e2e/local-server-session-roundtrip.mjs +1063 -1063
- package/scripts/ensureAcpSdkCompat.mjs +1 -1
package/bin/happy-cloud.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var api = require('./api-
|
|
3
|
+
var index = require('./index-Dz1Zo1-d.cjs');
|
|
4
|
+
var api = require('./api-8p1d7M3Z.cjs');
|
|
5
5
|
var node_events = require('node:events');
|
|
6
6
|
var node_crypto = require('node:crypto');
|
|
7
7
|
|
|
@@ -105,7 +105,8 @@ async function bootstrapManagedProviderSession(opts) {
|
|
|
105
105
|
response = await opts.api.getOrCreateSession({
|
|
106
106
|
tag: opts.sessionTag,
|
|
107
107
|
metadata,
|
|
108
|
-
state
|
|
108
|
+
state,
|
|
109
|
+
stableDataKeyPath: ["managed-session-tag", opts.sessionTag]
|
|
109
110
|
});
|
|
110
111
|
} catch (error) {
|
|
111
112
|
if (!api.isAuthenticationRequiredError(error)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as createSessionMetadata, p as publishSessionRegistration } from './index-
|
|
2
|
-
import { s as startOfflineReconnection, c as configuration, i as isAuthenticationRequiredError, l as logger } from './api-
|
|
1
|
+
import { a as createSessionMetadata, p as publishSessionRegistration } from './index-C_MTvw5p.mjs';
|
|
2
|
+
import { s as startOfflineReconnection, c as configuration, i as isAuthenticationRequiredError, l as logger } from './api-Dp5_DJo0.mjs';
|
|
3
3
|
import { EventEmitter } from 'node:events';
|
|
4
4
|
import { randomUUID } from 'node:crypto';
|
|
5
5
|
|
|
@@ -103,7 +103,8 @@ async function bootstrapManagedProviderSession(opts) {
|
|
|
103
103
|
response = await opts.api.getOrCreateSession({
|
|
104
104
|
tag: opts.sessionTag,
|
|
105
105
|
metadata,
|
|
106
|
-
state
|
|
106
|
+
state,
|
|
107
|
+
stableDataKeyPath: ["managed-session-tag", opts.sessionTag]
|
|
107
108
|
});
|
|
108
109
|
} catch (error) {
|
|
109
110
|
if (!isAuthenticationRequiredError(error)) {
|
package/dist/{ProviderSelectionHandler-BZVtGMAn.cjs → ProviderSelectionHandler-DWeq9rG2.cjs}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var api = require('./api-
|
|
4
|
-
var registerKillSessionHandler = require('./registerKillSessionHandler-
|
|
3
|
+
var api = require('./api-8p1d7M3Z.cjs');
|
|
4
|
+
var registerKillSessionHandler = require('./registerKillSessionHandler-DL07DW1o.cjs');
|
|
5
5
|
|
|
6
6
|
async function runModeLoop(opts) {
|
|
7
7
|
let currentMode = opts.startingMode;
|
package/dist/{ProviderSelectionHandler-BleheBks.mjs → ProviderSelectionHandler-DXgu2zND.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as logger } from './api-
|
|
2
|
-
import { g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, a as INTERACTION_TIMED_OUT_ERROR } from './registerKillSessionHandler-
|
|
1
|
+
import { l as logger } from './api-Dp5_DJo0.mjs';
|
|
2
|
+
import { g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, a as INTERACTION_TIMED_OUT_ERROR } from './registerKillSessionHandler-Bqd1W5ZT.mjs';
|
|
3
3
|
|
|
4
4
|
async function runModeLoop(opts) {
|
|
5
5
|
let currentMode = opts.startingMode;
|
|
@@ -18,7 +18,7 @@ var node_child_process = require('node:child_process');
|
|
|
18
18
|
var expoServerSdk = require('expo-server-sdk');
|
|
19
19
|
|
|
20
20
|
var name = "happy-imou-cloud";
|
|
21
|
-
var version = "2.1.
|
|
21
|
+
var version = "2.1.10";
|
|
22
22
|
var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
|
|
23
23
|
var author = "long.zhu";
|
|
24
24
|
var license = "MIT";
|
|
@@ -433,7 +433,7 @@ async function listDaemonLogFiles(limit = 50) {
|
|
|
433
433
|
return { file, path: fullPath, modified: stats.mtime };
|
|
434
434
|
}).sort((a, b) => b.modified.getTime() - a.modified.getTime());
|
|
435
435
|
try {
|
|
436
|
-
const { readDaemonState } = await Promise.resolve().then(function () { return require('./persistence-
|
|
436
|
+
const { readDaemonState } = await Promise.resolve().then(function () { return require('./persistence-De7JoaQp.cjs'); });
|
|
437
437
|
const state = await readDaemonState();
|
|
438
438
|
if (!state) {
|
|
439
439
|
return logs;
|
|
@@ -1784,7 +1784,14 @@ class ApiSessionClient extends node_events.EventEmitter {
|
|
|
1784
1784
|
encryptionVariant: this.encryptionVariant,
|
|
1785
1785
|
logger: (msg, data) => logger.debug(msg, data)
|
|
1786
1786
|
});
|
|
1787
|
-
|
|
1787
|
+
const workingDirectory = this.metadata?.path ?? process.cwd();
|
|
1788
|
+
if (!this.metadata?.path) {
|
|
1789
|
+
logger.debug("[API] Session metadata missing path during client initialization, falling back to process.cwd()", {
|
|
1790
|
+
sessionId: this.sessionId,
|
|
1791
|
+
workingDirectory
|
|
1792
|
+
});
|
|
1793
|
+
}
|
|
1794
|
+
registerCommonHandlers(this.rpcHandlerManager, workingDirectory);
|
|
1788
1795
|
this.socket = socket_ioClient.io(configuration.serverUrl, {
|
|
1789
1796
|
auth: (cb) => cb(buildSocketAuth({
|
|
1790
1797
|
credentials: this.credentials,
|
|
@@ -3259,6 +3266,39 @@ class OfflineState {
|
|
|
3259
3266
|
}
|
|
3260
3267
|
const connectionState = new OfflineState();
|
|
3261
3268
|
|
|
3269
|
+
async function hmac_sha512(key, data) {
|
|
3270
|
+
const hmac = node_crypto.createHmac("sha512", key);
|
|
3271
|
+
hmac.update(data);
|
|
3272
|
+
return new Uint8Array(hmac.digest());
|
|
3273
|
+
}
|
|
3274
|
+
|
|
3275
|
+
async function deriveSecretKeyTreeRoot(seed, usage) {
|
|
3276
|
+
const I = await hmac_sha512(new TextEncoder().encode(usage + " Master Seed"), seed);
|
|
3277
|
+
return {
|
|
3278
|
+
key: I.slice(0, 32),
|
|
3279
|
+
chainCode: I.slice(32)
|
|
3280
|
+
};
|
|
3281
|
+
}
|
|
3282
|
+
async function deriveSecretKeyTreeChild(chainCode, index) {
|
|
3283
|
+
const data = new Uint8Array([0, ...new TextEncoder().encode(index)]);
|
|
3284
|
+
const I = await hmac_sha512(chainCode, data);
|
|
3285
|
+
return {
|
|
3286
|
+
key: I.subarray(0, 32),
|
|
3287
|
+
chainCode: I.subarray(32)
|
|
3288
|
+
};
|
|
3289
|
+
}
|
|
3290
|
+
async function deriveKey(master, usage, path) {
|
|
3291
|
+
let state = await deriveSecretKeyTreeRoot(master, usage);
|
|
3292
|
+
let remaining = [...path];
|
|
3293
|
+
while (remaining.length > 0) {
|
|
3294
|
+
let index = remaining[0];
|
|
3295
|
+
remaining = remaining.slice(1);
|
|
3296
|
+
state = await deriveSecretKeyTreeChild(state.chainCode, index);
|
|
3297
|
+
}
|
|
3298
|
+
return state.key;
|
|
3299
|
+
}
|
|
3300
|
+
|
|
3301
|
+
const SESSION_DATA_KEY_USAGE = "Happy Session Data Key";
|
|
3262
3302
|
class ApiClient {
|
|
3263
3303
|
static async create(credential) {
|
|
3264
3304
|
return new ApiClient(credential);
|
|
@@ -3400,7 +3440,15 @@ class ApiClient {
|
|
|
3400
3440
|
let encryptionKey;
|
|
3401
3441
|
let encryptionVariant;
|
|
3402
3442
|
if (this.credential.encryption.type === "dataKey") {
|
|
3403
|
-
|
|
3443
|
+
if (opts.stableDataKeyPath && opts.stableDataKeyPath.length > 0) {
|
|
3444
|
+
encryptionKey = await deriveKey(
|
|
3445
|
+
this.credential.encryption.machineKey,
|
|
3446
|
+
SESSION_DATA_KEY_USAGE,
|
|
3447
|
+
opts.stableDataKeyPath
|
|
3448
|
+
);
|
|
3449
|
+
} else {
|
|
3450
|
+
encryptionKey = getRandomBytes(32);
|
|
3451
|
+
}
|
|
3404
3452
|
encryptionVariant = "dataKey";
|
|
3405
3453
|
let encryptedDataKey = libsodiumEncryptForPublicKey(encryptionKey, this.credential.encryption.publicKey);
|
|
3406
3454
|
dataEncryptionKey = new Uint8Array(encryptedDataKey.length + 1);
|
|
@@ -3426,10 +3474,14 @@ class ApiClient {
|
|
|
3426
3474
|
});
|
|
3427
3475
|
logger.debug(`Session created/loaded: ${response.data.session.id} (tag: ${opts.tag})`);
|
|
3428
3476
|
let raw = response.data.session;
|
|
3477
|
+
const metadata = decrypt(encryptionKey, encryptionVariant, decodeBase64(raw.metadata));
|
|
3478
|
+
if (metadata === null) {
|
|
3479
|
+
throw new Error(`Failed to decrypt session metadata for tag ${opts.tag}`);
|
|
3480
|
+
}
|
|
3429
3481
|
let session = {
|
|
3430
3482
|
id: raw.id,
|
|
3431
3483
|
seq: raw.seq,
|
|
3432
|
-
metadata
|
|
3484
|
+
metadata,
|
|
3433
3485
|
metadataVersion: raw.metadataVersion,
|
|
3434
3486
|
agentState: raw.agentState ? decrypt(encryptionKey, encryptionVariant, decodeBase64(raw.agentState)) : null,
|
|
3435
3487
|
agentStateVersion: raw.agentStateVersion,
|
|
@@ -16,7 +16,7 @@ import { spawn } from 'node:child_process';
|
|
|
16
16
|
import { Expo } from 'expo-server-sdk';
|
|
17
17
|
|
|
18
18
|
var name = "happy-imou-cloud";
|
|
19
|
-
var version = "2.1.
|
|
19
|
+
var version = "2.1.10";
|
|
20
20
|
var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
|
|
21
21
|
var author = "long.zhu";
|
|
22
22
|
var license = "MIT";
|
|
@@ -431,7 +431,7 @@ async function listDaemonLogFiles(limit = 50) {
|
|
|
431
431
|
return { file, path: fullPath, modified: stats.mtime };
|
|
432
432
|
}).sort((a, b) => b.modified.getTime() - a.modified.getTime());
|
|
433
433
|
try {
|
|
434
|
-
const { readDaemonState } = await import('./persistence-
|
|
434
|
+
const { readDaemonState } = await import('./persistence-Ds1cKgQ_.mjs');
|
|
435
435
|
const state = await readDaemonState();
|
|
436
436
|
if (!state) {
|
|
437
437
|
return logs;
|
|
@@ -1782,7 +1782,14 @@ class ApiSessionClient extends EventEmitter {
|
|
|
1782
1782
|
encryptionVariant: this.encryptionVariant,
|
|
1783
1783
|
logger: (msg, data) => logger.debug(msg, data)
|
|
1784
1784
|
});
|
|
1785
|
-
|
|
1785
|
+
const workingDirectory = this.metadata?.path ?? process.cwd();
|
|
1786
|
+
if (!this.metadata?.path) {
|
|
1787
|
+
logger.debug("[API] Session metadata missing path during client initialization, falling back to process.cwd()", {
|
|
1788
|
+
sessionId: this.sessionId,
|
|
1789
|
+
workingDirectory
|
|
1790
|
+
});
|
|
1791
|
+
}
|
|
1792
|
+
registerCommonHandlers(this.rpcHandlerManager, workingDirectory);
|
|
1786
1793
|
this.socket = io(configuration.serverUrl, {
|
|
1787
1794
|
auth: (cb) => cb(buildSocketAuth({
|
|
1788
1795
|
credentials: this.credentials,
|
|
@@ -3257,6 +3264,39 @@ class OfflineState {
|
|
|
3257
3264
|
}
|
|
3258
3265
|
const connectionState = new OfflineState();
|
|
3259
3266
|
|
|
3267
|
+
async function hmac_sha512(key, data) {
|
|
3268
|
+
const hmac = createHmac("sha512", key);
|
|
3269
|
+
hmac.update(data);
|
|
3270
|
+
return new Uint8Array(hmac.digest());
|
|
3271
|
+
}
|
|
3272
|
+
|
|
3273
|
+
async function deriveSecretKeyTreeRoot(seed, usage) {
|
|
3274
|
+
const I = await hmac_sha512(new TextEncoder().encode(usage + " Master Seed"), seed);
|
|
3275
|
+
return {
|
|
3276
|
+
key: I.slice(0, 32),
|
|
3277
|
+
chainCode: I.slice(32)
|
|
3278
|
+
};
|
|
3279
|
+
}
|
|
3280
|
+
async function deriveSecretKeyTreeChild(chainCode, index) {
|
|
3281
|
+
const data = new Uint8Array([0, ...new TextEncoder().encode(index)]);
|
|
3282
|
+
const I = await hmac_sha512(chainCode, data);
|
|
3283
|
+
return {
|
|
3284
|
+
key: I.subarray(0, 32),
|
|
3285
|
+
chainCode: I.subarray(32)
|
|
3286
|
+
};
|
|
3287
|
+
}
|
|
3288
|
+
async function deriveKey(master, usage, path) {
|
|
3289
|
+
let state = await deriveSecretKeyTreeRoot(master, usage);
|
|
3290
|
+
let remaining = [...path];
|
|
3291
|
+
while (remaining.length > 0) {
|
|
3292
|
+
let index = remaining[0];
|
|
3293
|
+
remaining = remaining.slice(1);
|
|
3294
|
+
state = await deriveSecretKeyTreeChild(state.chainCode, index);
|
|
3295
|
+
}
|
|
3296
|
+
return state.key;
|
|
3297
|
+
}
|
|
3298
|
+
|
|
3299
|
+
const SESSION_DATA_KEY_USAGE = "Happy Session Data Key";
|
|
3260
3300
|
class ApiClient {
|
|
3261
3301
|
static async create(credential) {
|
|
3262
3302
|
return new ApiClient(credential);
|
|
@@ -3398,7 +3438,15 @@ class ApiClient {
|
|
|
3398
3438
|
let encryptionKey;
|
|
3399
3439
|
let encryptionVariant;
|
|
3400
3440
|
if (this.credential.encryption.type === "dataKey") {
|
|
3401
|
-
|
|
3441
|
+
if (opts.stableDataKeyPath && opts.stableDataKeyPath.length > 0) {
|
|
3442
|
+
encryptionKey = await deriveKey(
|
|
3443
|
+
this.credential.encryption.machineKey,
|
|
3444
|
+
SESSION_DATA_KEY_USAGE,
|
|
3445
|
+
opts.stableDataKeyPath
|
|
3446
|
+
);
|
|
3447
|
+
} else {
|
|
3448
|
+
encryptionKey = getRandomBytes(32);
|
|
3449
|
+
}
|
|
3402
3450
|
encryptionVariant = "dataKey";
|
|
3403
3451
|
let encryptedDataKey = libsodiumEncryptForPublicKey(encryptionKey, this.credential.encryption.publicKey);
|
|
3404
3452
|
dataEncryptionKey = new Uint8Array(encryptedDataKey.length + 1);
|
|
@@ -3424,10 +3472,14 @@ class ApiClient {
|
|
|
3424
3472
|
});
|
|
3425
3473
|
logger.debug(`Session created/loaded: ${response.data.session.id} (tag: ${opts.tag})`);
|
|
3426
3474
|
let raw = response.data.session;
|
|
3475
|
+
const metadata = decrypt(encryptionKey, encryptionVariant, decodeBase64(raw.metadata));
|
|
3476
|
+
if (metadata === null) {
|
|
3477
|
+
throw new Error(`Failed to decrypt session metadata for tag ${opts.tag}`);
|
|
3478
|
+
}
|
|
3427
3479
|
let session = {
|
|
3428
3480
|
id: raw.id,
|
|
3429
3481
|
seq: raw.seq,
|
|
3430
|
-
metadata
|
|
3482
|
+
metadata,
|
|
3431
3483
|
metadataVersion: raw.metadataVersion,
|
|
3432
3484
|
agentState: raw.agentState ? decrypt(encryptionKey, encryptionVariant, decodeBase64(raw.agentState)) : null,
|
|
3433
3485
|
agentStateVersion: raw.agentStateVersion,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-Dz1Zo1-d.cjs');
|
|
4
4
|
require('chalk');
|
|
5
|
-
require('./api-
|
|
5
|
+
require('./api-8p1d7M3Z.cjs');
|
|
6
6
|
require('axios');
|
|
7
7
|
require('fs');
|
|
8
8
|
require('node:fs');
|
|
@@ -18,7 +18,7 @@ require('crypto');
|
|
|
18
18
|
require('path');
|
|
19
19
|
require('node:child_process');
|
|
20
20
|
require('expo-server-sdk');
|
|
21
|
-
require('./persistence-
|
|
21
|
+
require('./persistence-De7JoaQp.cjs');
|
|
22
22
|
require('node:fs/promises');
|
|
23
23
|
require('os');
|
|
24
24
|
require('tmp');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as createDefaultRuntimeShell } from './index-
|
|
1
|
+
import { c as createDefaultRuntimeShell } from './index-C_MTvw5p.mjs';
|
|
2
2
|
import 'chalk';
|
|
3
|
-
import './api-
|
|
3
|
+
import './api-Dp5_DJo0.mjs';
|
|
4
4
|
import 'axios';
|
|
5
5
|
import 'fs';
|
|
6
6
|
import 'node:fs';
|
|
@@ -16,7 +16,7 @@ import 'crypto';
|
|
|
16
16
|
import 'path';
|
|
17
17
|
import 'node:child_process';
|
|
18
18
|
import 'expo-server-sdk';
|
|
19
|
-
import './persistence-
|
|
19
|
+
import './persistence-Ds1cKgQ_.mjs';
|
|
20
20
|
import 'node:fs/promises';
|
|
21
21
|
import 'os';
|
|
22
22
|
import 'tmp';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(import.meta.url);import chalk from 'chalk';
|
|
2
|
-
import { l as logger, e as encodeBase64, c as configuration, k as buildAuthenticatedHeaders, S as SigningBootstrapRequiredError, m as SIGNING_BOOTSTRAP_REQUIRED_MESSAGE, n as encodeBase64Url, h as delay, o as buildClientHeaders, p as decodeBase64, q as HAPPY_CLOUD_DAEMON_PORT, r as packageJson, A as ApiClient, t as HeadTailPreviewBuffer, u as getLatestDaemonLog } from './api-
|
|
3
|
-
import { writeCredentialsLegacy, writeCredentialsDataKey, readCredentials, readSettings, updateSettings, readDaemonState, clearDaemonState, acquireDaemonLock, writeDaemonState, releaseDaemonLock, validateProfileForAgent, getProfileEnvironmentVariables, clearCredentials, clearMachineId } from './persistence-
|
|
2
|
+
import { l as logger, e as encodeBase64, c as configuration, k as buildAuthenticatedHeaders, S as SigningBootstrapRequiredError, m as SIGNING_BOOTSTRAP_REQUIRED_MESSAGE, n as encodeBase64Url, h as delay, o as buildClientHeaders, p as decodeBase64, q as HAPPY_CLOUD_DAEMON_PORT, r as packageJson, A as ApiClient, t as HeadTailPreviewBuffer, u as getLatestDaemonLog } from './api-Dp5_DJo0.mjs';
|
|
3
|
+
import { writeCredentialsLegacy, writeCredentialsDataKey, readCredentials, readSettings, updateSettings, readDaemonState, clearDaemonState, acquireDaemonLock, writeDaemonState, releaseDaemonLock, validateProfileForAgent, getProfileEnvironmentVariables, clearCredentials, clearMachineId } from './persistence-Ds1cKgQ_.mjs';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import fs, { writeFile as writeFile$1, rename, unlink as unlink$1 } from 'fs/promises';
|
|
6
6
|
import os$1, { homedir } from 'os';
|
|
@@ -2604,7 +2604,8 @@ async function precreateDaemonManagedSession(opts) {
|
|
|
2604
2604
|
return await opts.api.getOrCreateSession({
|
|
2605
2605
|
tag: opts.sessionTag,
|
|
2606
2606
|
metadata,
|
|
2607
|
-
state
|
|
2607
|
+
state,
|
|
2608
|
+
stableDataKeyPath: ["managed-session-tag", opts.sessionTag]
|
|
2608
2609
|
});
|
|
2609
2610
|
} catch (error) {
|
|
2610
2611
|
logger.debug(`[DAEMON RUN] Failed to precreate ${opts.flavor} session for tag ${opts.sessionTag}`, error);
|
|
@@ -5879,6 +5880,25 @@ function formatToolCallTimeoutLimit(timeoutMs) {
|
|
|
5879
5880
|
function isRecord$1(value) {
|
|
5880
5881
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5881
5882
|
}
|
|
5883
|
+
function extractNestedToolContentText(value) {
|
|
5884
|
+
if (typeof value === "string") {
|
|
5885
|
+
return value.length > 0 ? value : null;
|
|
5886
|
+
}
|
|
5887
|
+
if (Array.isArray(value)) {
|
|
5888
|
+
const parts = value.map((item) => extractNestedToolContentText(item)).filter((item) => Boolean(item));
|
|
5889
|
+
return parts.length > 0 ? parts.join("") : null;
|
|
5890
|
+
}
|
|
5891
|
+
if (!isRecord$1(value)) {
|
|
5892
|
+
return null;
|
|
5893
|
+
}
|
|
5894
|
+
if (typeof value.text === "string" && value.text.length > 0) {
|
|
5895
|
+
return value.text;
|
|
5896
|
+
}
|
|
5897
|
+
if ("content" in value) {
|
|
5898
|
+
return extractNestedToolContentText(value.content);
|
|
5899
|
+
}
|
|
5900
|
+
return null;
|
|
5901
|
+
}
|
|
5882
5902
|
function hasMeaningfulContent(value) {
|
|
5883
5903
|
if (value === null || value === void 0) {
|
|
5884
5904
|
return false;
|
|
@@ -5939,11 +5959,19 @@ function extractToolOutputChunk(content) {
|
|
|
5939
5959
|
continue;
|
|
5940
5960
|
}
|
|
5941
5961
|
const value = content[key];
|
|
5962
|
+
const nestedText2 = extractNestedToolContentText(value);
|
|
5963
|
+
if (nestedText2 && nestedText2.length > 0) {
|
|
5964
|
+
return nestedText2;
|
|
5965
|
+
}
|
|
5942
5966
|
const formatted2 = typeof value === "string" ? value : formatDisplayMessage(value);
|
|
5943
5967
|
if (formatted2.length > 0) {
|
|
5944
5968
|
return formatted2;
|
|
5945
5969
|
}
|
|
5946
5970
|
}
|
|
5971
|
+
const nestedText = extractNestedToolContentText(content);
|
|
5972
|
+
if (nestedText && nestedText.length > 0) {
|
|
5973
|
+
return nestedText;
|
|
5974
|
+
}
|
|
5947
5975
|
const formatted = formatDisplayMessage(content);
|
|
5948
5976
|
return formatted.length > 0 ? formatted : null;
|
|
5949
5977
|
}
|
|
@@ -9179,6 +9207,35 @@ function normalizeClaudeBackendError(error) {
|
|
|
9179
9207
|
function isRecord(value) {
|
|
9180
9208
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9181
9209
|
}
|
|
9210
|
+
function extractClaudeToolResultText(value) {
|
|
9211
|
+
if (typeof value === "string") {
|
|
9212
|
+
return value.length > 0 ? value : null;
|
|
9213
|
+
}
|
|
9214
|
+
if (Array.isArray(value)) {
|
|
9215
|
+
const parts = value.map((item) => extractClaudeToolResultText(item)).filter((item) => Boolean(item));
|
|
9216
|
+
return parts.length > 0 ? parts.join("") : null;
|
|
9217
|
+
}
|
|
9218
|
+
if (!isRecord(value)) {
|
|
9219
|
+
return null;
|
|
9220
|
+
}
|
|
9221
|
+
if (typeof value.text === "string" && value.text.length > 0) {
|
|
9222
|
+
return value.text;
|
|
9223
|
+
}
|
|
9224
|
+
if ("content" in value) {
|
|
9225
|
+
return extractClaudeToolResultText(value.content);
|
|
9226
|
+
}
|
|
9227
|
+
return null;
|
|
9228
|
+
}
|
|
9229
|
+
function normalizeClaudeToolResultContent(value) {
|
|
9230
|
+
if (typeof value === "string") {
|
|
9231
|
+
return value;
|
|
9232
|
+
}
|
|
9233
|
+
const extractedText = extractClaudeToolResultText(value);
|
|
9234
|
+
if (extractedText) {
|
|
9235
|
+
return extractedText;
|
|
9236
|
+
}
|
|
9237
|
+
return value;
|
|
9238
|
+
}
|
|
9182
9239
|
function createTimeoutError(timeoutMs) {
|
|
9183
9240
|
return new Error(`Claude response did not complete within ${timeoutMs}ms`);
|
|
9184
9241
|
}
|
|
@@ -9477,7 +9534,7 @@ class ClaudeCodeBackend {
|
|
|
9477
9534
|
this.emit({
|
|
9478
9535
|
type: "tool-result",
|
|
9479
9536
|
toolName,
|
|
9480
|
-
result: block.content,
|
|
9537
|
+
result: normalizeClaudeToolResultContent(block.content),
|
|
9481
9538
|
callId: block.tool_use_id
|
|
9482
9539
|
});
|
|
9483
9540
|
if (toolName === "Bash" && isRecord(message.tool_use_result)) {
|
|
@@ -9838,11 +9895,11 @@ var launch = /*#__PURE__*/Object.freeze({
|
|
|
9838
9895
|
|
|
9839
9896
|
const unifiedProviderExecutors = {
|
|
9840
9897
|
claude: async (opts) => {
|
|
9841
|
-
const { runClaude } = await import('./runClaude-
|
|
9898
|
+
const { runClaude } = await import('./runClaude-BtMjqmaI.mjs');
|
|
9842
9899
|
await runClaude(opts.credentials, opts.claudeOptions ?? {});
|
|
9843
9900
|
},
|
|
9844
9901
|
codex: async (opts) => {
|
|
9845
|
-
const { runCodex } = await import('./runCodex-
|
|
9902
|
+
const { runCodex } = await import('./runCodex-CxtZTXtC.mjs');
|
|
9846
9903
|
await runCodex({
|
|
9847
9904
|
credentials: opts.credentials,
|
|
9848
9905
|
startedBy: opts.startedBy,
|
|
@@ -9851,7 +9908,7 @@ const unifiedProviderExecutors = {
|
|
|
9851
9908
|
});
|
|
9852
9909
|
},
|
|
9853
9910
|
gemini: async (opts) => {
|
|
9854
|
-
const { runGemini } = await import('./runGemini-
|
|
9911
|
+
const { runGemini } = await import('./runGemini-CmRPi60L.mjs');
|
|
9855
9912
|
await runGemini({
|
|
9856
9913
|
credentials: opts.credentials,
|
|
9857
9914
|
startedBy: opts.startedBy
|
|
@@ -9934,7 +9991,7 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
9934
9991
|
return;
|
|
9935
9992
|
} else if (subcommand === "runtime") {
|
|
9936
9993
|
if (args[1] === "providers") {
|
|
9937
|
-
const { renderRuntimeProviders } = await import('./command-
|
|
9994
|
+
const { renderRuntimeProviders } = await import('./command-DRtgCMGi.mjs');
|
|
9938
9995
|
console.log(renderRuntimeProviders());
|
|
9939
9996
|
return;
|
|
9940
9997
|
}
|
|
@@ -10112,8 +10169,8 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
10112
10169
|
const projectId = args[3];
|
|
10113
10170
|
try {
|
|
10114
10171
|
const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
|
|
10115
|
-
const { readCredentials: readCredentials2 } = await import('./persistence-
|
|
10116
|
-
const { ApiClient: ApiClient2 } = await import('./api-
|
|
10172
|
+
const { readCredentials: readCredentials2 } = await import('./persistence-Ds1cKgQ_.mjs');
|
|
10173
|
+
const { ApiClient: ApiClient2 } = await import('./api-Dp5_DJo0.mjs').then(function (n) { return n.v; });
|
|
10117
10174
|
let userEmail = void 0;
|
|
10118
10175
|
try {
|
|
10119
10176
|
const credentials = await readCredentials2();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chalk = require('chalk');
|
|
4
|
-
var api = require('./api-
|
|
5
|
-
var persistence = require('./persistence-
|
|
4
|
+
var api = require('./api-8p1d7M3Z.cjs');
|
|
5
|
+
var persistence = require('./persistence-De7JoaQp.cjs');
|
|
6
6
|
var z = require('zod');
|
|
7
7
|
var fs$2 = require('fs/promises');
|
|
8
8
|
var os$1 = require('os');
|
|
@@ -72,7 +72,7 @@ async function openBrowser(url) {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-
|
|
75
|
+
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-Dz1Zo1-d.cjs', document.baseURI).href)));
|
|
76
76
|
const QRCode = require$1("qrcode-terminal/vendor/QRCode");
|
|
77
77
|
const QRErrorCorrectLevel = require$1("qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel");
|
|
78
78
|
const pendingTempFiles = /* @__PURE__ */ new Set();
|
|
@@ -695,7 +695,7 @@ function setupCleanupHandlers() {
|
|
|
695
695
|
});
|
|
696
696
|
}
|
|
697
697
|
|
|
698
|
-
const __dirname$2 = path$1.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-
|
|
698
|
+
const __dirname$2 = path$1.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-Dz1Zo1-d.cjs', document.baseURI).href))));
|
|
699
699
|
function projectPath() {
|
|
700
700
|
const path = path$1.resolve(__dirname$2, "..");
|
|
701
701
|
return path;
|
|
@@ -2626,7 +2626,8 @@ async function precreateDaemonManagedSession(opts) {
|
|
|
2626
2626
|
return await opts.api.getOrCreateSession({
|
|
2627
2627
|
tag: opts.sessionTag,
|
|
2628
2628
|
metadata,
|
|
2629
|
-
state
|
|
2629
|
+
state,
|
|
2630
|
+
stableDataKeyPath: ["managed-session-tag", opts.sessionTag]
|
|
2630
2631
|
});
|
|
2631
2632
|
} catch (error) {
|
|
2632
2633
|
api.logger.debug(`[DAEMON RUN] Failed to precreate ${opts.flavor} session for tag ${opts.sessionTag}`, error);
|
|
@@ -5901,6 +5902,25 @@ function formatToolCallTimeoutLimit(timeoutMs) {
|
|
|
5901
5902
|
function isRecord$1(value) {
|
|
5902
5903
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5903
5904
|
}
|
|
5905
|
+
function extractNestedToolContentText(value) {
|
|
5906
|
+
if (typeof value === "string") {
|
|
5907
|
+
return value.length > 0 ? value : null;
|
|
5908
|
+
}
|
|
5909
|
+
if (Array.isArray(value)) {
|
|
5910
|
+
const parts = value.map((item) => extractNestedToolContentText(item)).filter((item) => Boolean(item));
|
|
5911
|
+
return parts.length > 0 ? parts.join("") : null;
|
|
5912
|
+
}
|
|
5913
|
+
if (!isRecord$1(value)) {
|
|
5914
|
+
return null;
|
|
5915
|
+
}
|
|
5916
|
+
if (typeof value.text === "string" && value.text.length > 0) {
|
|
5917
|
+
return value.text;
|
|
5918
|
+
}
|
|
5919
|
+
if ("content" in value) {
|
|
5920
|
+
return extractNestedToolContentText(value.content);
|
|
5921
|
+
}
|
|
5922
|
+
return null;
|
|
5923
|
+
}
|
|
5904
5924
|
function hasMeaningfulContent(value) {
|
|
5905
5925
|
if (value === null || value === void 0) {
|
|
5906
5926
|
return false;
|
|
@@ -5961,11 +5981,19 @@ function extractToolOutputChunk(content) {
|
|
|
5961
5981
|
continue;
|
|
5962
5982
|
}
|
|
5963
5983
|
const value = content[key];
|
|
5984
|
+
const nestedText2 = extractNestedToolContentText(value);
|
|
5985
|
+
if (nestedText2 && nestedText2.length > 0) {
|
|
5986
|
+
return nestedText2;
|
|
5987
|
+
}
|
|
5964
5988
|
const formatted2 = typeof value === "string" ? value : formatDisplayMessage(value);
|
|
5965
5989
|
if (formatted2.length > 0) {
|
|
5966
5990
|
return formatted2;
|
|
5967
5991
|
}
|
|
5968
5992
|
}
|
|
5993
|
+
const nestedText = extractNestedToolContentText(content);
|
|
5994
|
+
if (nestedText && nestedText.length > 0) {
|
|
5995
|
+
return nestedText;
|
|
5996
|
+
}
|
|
5969
5997
|
const formatted = formatDisplayMessage(content);
|
|
5970
5998
|
return formatted.length > 0 ? formatted : null;
|
|
5971
5999
|
}
|
|
@@ -8590,7 +8618,7 @@ class AbortError extends Error {
|
|
|
8590
8618
|
}
|
|
8591
8619
|
}
|
|
8592
8620
|
|
|
8593
|
-
const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-
|
|
8621
|
+
const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-Dz1Zo1-d.cjs', document.baseURI).href)));
|
|
8594
8622
|
const __dirname$1 = path.join(__filename$1, "..");
|
|
8595
8623
|
function getGlobalClaudeVersion() {
|
|
8596
8624
|
try {
|
|
@@ -9201,6 +9229,35 @@ function normalizeClaudeBackendError(error) {
|
|
|
9201
9229
|
function isRecord(value) {
|
|
9202
9230
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9203
9231
|
}
|
|
9232
|
+
function extractClaudeToolResultText(value) {
|
|
9233
|
+
if (typeof value === "string") {
|
|
9234
|
+
return value.length > 0 ? value : null;
|
|
9235
|
+
}
|
|
9236
|
+
if (Array.isArray(value)) {
|
|
9237
|
+
const parts = value.map((item) => extractClaudeToolResultText(item)).filter((item) => Boolean(item));
|
|
9238
|
+
return parts.length > 0 ? parts.join("") : null;
|
|
9239
|
+
}
|
|
9240
|
+
if (!isRecord(value)) {
|
|
9241
|
+
return null;
|
|
9242
|
+
}
|
|
9243
|
+
if (typeof value.text === "string" && value.text.length > 0) {
|
|
9244
|
+
return value.text;
|
|
9245
|
+
}
|
|
9246
|
+
if ("content" in value) {
|
|
9247
|
+
return extractClaudeToolResultText(value.content);
|
|
9248
|
+
}
|
|
9249
|
+
return null;
|
|
9250
|
+
}
|
|
9251
|
+
function normalizeClaudeToolResultContent(value) {
|
|
9252
|
+
if (typeof value === "string") {
|
|
9253
|
+
return value;
|
|
9254
|
+
}
|
|
9255
|
+
const extractedText = extractClaudeToolResultText(value);
|
|
9256
|
+
if (extractedText) {
|
|
9257
|
+
return extractedText;
|
|
9258
|
+
}
|
|
9259
|
+
return value;
|
|
9260
|
+
}
|
|
9204
9261
|
function createTimeoutError(timeoutMs) {
|
|
9205
9262
|
return new Error(`Claude response did not complete within ${timeoutMs}ms`);
|
|
9206
9263
|
}
|
|
@@ -9499,7 +9556,7 @@ class ClaudeCodeBackend {
|
|
|
9499
9556
|
this.emit({
|
|
9500
9557
|
type: "tool-result",
|
|
9501
9558
|
toolName,
|
|
9502
|
-
result: block.content,
|
|
9559
|
+
result: normalizeClaudeToolResultContent(block.content),
|
|
9503
9560
|
callId: block.tool_use_id
|
|
9504
9561
|
});
|
|
9505
9562
|
if (toolName === "Bash" && isRecord(message.tool_use_result)) {
|
|
@@ -9860,11 +9917,11 @@ var launch = /*#__PURE__*/Object.freeze({
|
|
|
9860
9917
|
|
|
9861
9918
|
const unifiedProviderExecutors = {
|
|
9862
9919
|
claude: async (opts) => {
|
|
9863
|
-
const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-
|
|
9920
|
+
const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-DF_hjle_.cjs'); });
|
|
9864
9921
|
await runClaude(opts.credentials, opts.claudeOptions ?? {});
|
|
9865
9922
|
},
|
|
9866
9923
|
codex: async (opts) => {
|
|
9867
|
-
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-
|
|
9924
|
+
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-MtvDLX7s.cjs'); });
|
|
9868
9925
|
await runCodex({
|
|
9869
9926
|
credentials: opts.credentials,
|
|
9870
9927
|
startedBy: opts.startedBy,
|
|
@@ -9873,7 +9930,7 @@ const unifiedProviderExecutors = {
|
|
|
9873
9930
|
});
|
|
9874
9931
|
},
|
|
9875
9932
|
gemini: async (opts) => {
|
|
9876
|
-
const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-
|
|
9933
|
+
const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-Bf8tmYeU.cjs'); });
|
|
9877
9934
|
await runGemini({
|
|
9878
9935
|
credentials: opts.credentials,
|
|
9879
9936
|
startedBy: opts.startedBy
|
|
@@ -9956,7 +10013,7 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
9956
10013
|
return;
|
|
9957
10014
|
} else if (subcommand === "runtime") {
|
|
9958
10015
|
if (args[1] === "providers") {
|
|
9959
|
-
const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-
|
|
10016
|
+
const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-BtjeL-Z7.cjs'); });
|
|
9960
10017
|
console.log(renderRuntimeProviders());
|
|
9961
10018
|
return;
|
|
9962
10019
|
}
|
|
@@ -10134,8 +10191,8 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
10134
10191
|
const projectId = args[3];
|
|
10135
10192
|
try {
|
|
10136
10193
|
const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
|
|
10137
|
-
const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-
|
|
10138
|
-
const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-
|
|
10194
|
+
const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-De7JoaQp.cjs'); });
|
|
10195
|
+
const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-8p1d7M3Z.cjs'); }).then(function (n) { return n.api; });
|
|
10139
10196
|
let userEmail = void 0;
|
|
10140
10197
|
try {
|
|
10141
10198
|
const credentials = await readCredentials2();
|
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('chalk');
|
|
4
|
-
require('./api-
|
|
5
|
-
require('./persistence-
|
|
4
|
+
require('./api-8p1d7M3Z.cjs');
|
|
5
|
+
require('./persistence-De7JoaQp.cjs');
|
|
6
6
|
require('zod');
|
|
7
|
-
require('./index-
|
|
7
|
+
require('./index-Dz1Zo1-d.cjs');
|
|
8
8
|
require('node:child_process');
|
|
9
9
|
require('node:fs');
|
|
10
10
|
require('cross-spawn');
|