happy-imou-cloud 2.0.7 → 2.0.8
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/{api-Dwkm7s_E.cjs → api-CN-WqYd_.cjs} +3 -4
- package/dist/{api-dwwHBzLc.mjs → api-D-uiH_TF.mjs} +3 -4
- package/dist/{command-Cfq3Uc0S.mjs → command-DGFsZx58.mjs} +3 -3
- package/dist/{command-DiAVIsxX.cjs → command-DjIfRZQS.cjs} +3 -3
- package/dist/{index-CfqxEoyl.cjs → index-DM6z3aeG.cjs} +189 -26
- package/dist/{index-HyqLXzw-.mjs → index-DhheEtRl.mjs} +187 -24
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +3 -3
- package/dist/lib.cjs +1 -1
- package/dist/lib.mjs +1 -1
- package/dist/{BaseReasoningProcessor-ClrT-x-H.mjs → names-BjEof0E2.mjs} +98 -3
- package/dist/{BaseReasoningProcessor-DphULXS-.cjs → names-BnV67N_O.cjs} +100 -2
- package/dist/{persistence-hbhwAYIV.cjs → persistence-DBGkO8gB.cjs} +110 -1
- package/dist/{persistence-Dg-rxY2a.mjs → persistence-DiNg1DPF.mjs} +100 -4
- package/dist/{registerKillSessionHandler-D1ouN10n.cjs → registerKillSessionHandler-CYc0SIjF.cjs} +2 -2
- package/dist/{registerKillSessionHandler-BAvk4GYO.mjs → registerKillSessionHandler-Cu9rHGsI.mjs} +2 -2
- package/dist/{runClaude-CZmJ7qEP.cjs → runClaude-CPhWaFrX.cjs} +5 -5
- package/dist/{runClaude-OxYbt3ZQ.mjs → runClaude-DAR_hw3C.mjs} +4 -4
- package/dist/{runCodex-CtncAgso.cjs → runCodex--QLrOs8X.cjs} +24 -25
- package/dist/{runCodex-ByVTEbSY.mjs → runCodex-B4QAb-Go.mjs} +5 -6
- package/dist/{runGemini-ChwjLmhI.cjs → runGemini-CDyhCucw.cjs} +20 -21
- package/dist/{runGemini-BRO6A2jm.mjs → runGemini-DqowSR2w.mjs} +5 -6
- package/package.json +3 -4
- package/scripts/build.mjs +66 -0
- package/scripts/release-smoke.mjs +166 -30
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var promises = require('node:fs/promises');
|
|
4
4
|
var node_fs = require('node:fs');
|
|
5
5
|
var node_path = require('node:path');
|
|
6
|
-
var api = require('./api-
|
|
6
|
+
var api = require('./api-CN-WqYd_.cjs');
|
|
7
7
|
var z = require('zod');
|
|
8
8
|
require('axios');
|
|
9
9
|
require('chalk');
|
|
@@ -148,7 +148,24 @@ function getProfileEnvironmentVariables(profile) {
|
|
|
148
148
|
}
|
|
149
149
|
return envVars;
|
|
150
150
|
}
|
|
151
|
+
function validateProfile(profile) {
|
|
152
|
+
const result = AIBackendProfileSchema.safeParse(profile);
|
|
153
|
+
if (!result.success) {
|
|
154
|
+
throw new Error(`Invalid profile data: ${result.error.message}`);
|
|
155
|
+
}
|
|
156
|
+
return result.data;
|
|
157
|
+
}
|
|
158
|
+
const CURRENT_PROFILE_VERSION = "1.0.0";
|
|
151
159
|
const SUPPORTED_SCHEMA_VERSION = 2;
|
|
160
|
+
function validateProfileVersion(profile) {
|
|
161
|
+
const semverRegex = /^\d+\.\d+\.\d+$/;
|
|
162
|
+
return semverRegex.test(profile.version || "");
|
|
163
|
+
}
|
|
164
|
+
function isProfileVersionCompatible(profileVersion, requiredVersion = CURRENT_PROFILE_VERSION) {
|
|
165
|
+
const [major] = profileVersion.split(".");
|
|
166
|
+
const [requiredMajor] = requiredVersion.split(".");
|
|
167
|
+
return major === requiredMajor;
|
|
168
|
+
}
|
|
152
169
|
const defaultSettings = {
|
|
153
170
|
schemaVersion: SUPPORTED_SCHEMA_VERSION,
|
|
154
171
|
onboardingCompleted: false,
|
|
@@ -202,6 +219,16 @@ async function readSettings() {
|
|
|
202
219
|
return { ...defaultSettings };
|
|
203
220
|
}
|
|
204
221
|
}
|
|
222
|
+
async function writeSettings(settings) {
|
|
223
|
+
if (!node_fs.existsSync(api.configuration.happyCloudHomeDir)) {
|
|
224
|
+
await promises.mkdir(api.configuration.happyCloudHomeDir, { recursive: true });
|
|
225
|
+
}
|
|
226
|
+
const settingsWithVersion = {
|
|
227
|
+
...settings,
|
|
228
|
+
schemaVersion: settings.schemaVersion ?? SUPPORTED_SCHEMA_VERSION
|
|
229
|
+
};
|
|
230
|
+
await promises.writeFile(api.configuration.settingsFile, JSON.stringify(settingsWithVersion, null, 2));
|
|
231
|
+
}
|
|
205
232
|
async function updateSettings(updater) {
|
|
206
233
|
const LOCK_RETRY_INTERVAL_MS = 100;
|
|
207
234
|
const MAX_LOCK_ATTEMPTS = 50;
|
|
@@ -491,20 +518,102 @@ async function releaseDaemonLock(lockHandle) {
|
|
|
491
518
|
} catch {
|
|
492
519
|
}
|
|
493
520
|
}
|
|
521
|
+
async function getProfiles() {
|
|
522
|
+
const settings = await readSettings();
|
|
523
|
+
return settings.profiles || [];
|
|
524
|
+
}
|
|
525
|
+
async function getProfile(profileId) {
|
|
526
|
+
const settings = await readSettings();
|
|
527
|
+
return settings.profiles.find((p) => p.id === profileId) || null;
|
|
528
|
+
}
|
|
529
|
+
async function getActiveProfile() {
|
|
530
|
+
const settings = await readSettings();
|
|
531
|
+
if (!settings.activeProfileId) return null;
|
|
532
|
+
return settings.profiles.find((p) => p.id === settings.activeProfileId) || null;
|
|
533
|
+
}
|
|
534
|
+
async function setActiveProfile(profileId) {
|
|
535
|
+
await updateSettings((settings) => ({
|
|
536
|
+
...settings,
|
|
537
|
+
activeProfileId: profileId
|
|
538
|
+
}));
|
|
539
|
+
}
|
|
540
|
+
async function updateProfiles(profiles) {
|
|
541
|
+
const validatedProfiles = profiles.map((profile) => validateProfile(profile));
|
|
542
|
+
await updateSettings((settings) => {
|
|
543
|
+
const activeProfileId = settings.activeProfileId;
|
|
544
|
+
const activeProfileStillExists = activeProfileId && validatedProfiles.some((p) => p.id === activeProfileId);
|
|
545
|
+
return {
|
|
546
|
+
...settings,
|
|
547
|
+
profiles: validatedProfiles,
|
|
548
|
+
activeProfileId: activeProfileStillExists ? activeProfileId : void 0
|
|
549
|
+
};
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
async function getEnvironmentVariables(profileId) {
|
|
553
|
+
const settings = await readSettings();
|
|
554
|
+
const profile = settings.profiles.find((p) => p.id === profileId);
|
|
555
|
+
if (!profile) return {};
|
|
556
|
+
const envVars = {};
|
|
557
|
+
if (profile.environmentVariables) {
|
|
558
|
+
profile.environmentVariables.forEach((envVar) => {
|
|
559
|
+
envVars[envVar.name] = envVar.value;
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
const localEnvVars = settings.localEnvironmentVariables[profileId] || {};
|
|
563
|
+
Object.assign(envVars, localEnvVars);
|
|
564
|
+
return envVars;
|
|
565
|
+
}
|
|
566
|
+
async function setEnvironmentVariables(profileId, envVars) {
|
|
567
|
+
await updateSettings((settings) => ({
|
|
568
|
+
...settings,
|
|
569
|
+
localEnvironmentVariables: {
|
|
570
|
+
...settings.localEnvironmentVariables,
|
|
571
|
+
[profileId]: envVars
|
|
572
|
+
}
|
|
573
|
+
}));
|
|
574
|
+
}
|
|
575
|
+
async function getEnvironmentVariable(profileId, key) {
|
|
576
|
+
const settings = await readSettings();
|
|
577
|
+
const localEnvVars = settings.localEnvironmentVariables[profileId] || {};
|
|
578
|
+
if (localEnvVars[key] !== void 0) {
|
|
579
|
+
return localEnvVars[key];
|
|
580
|
+
}
|
|
581
|
+
const profile = settings.profiles.find((p) => p.id === profileId);
|
|
582
|
+
if (profile?.environmentVariables) {
|
|
583
|
+
const envVar = profile.environmentVariables.find((env) => env.name === key);
|
|
584
|
+
if (envVar) {
|
|
585
|
+
return envVar.value;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
return void 0;
|
|
589
|
+
}
|
|
494
590
|
|
|
495
591
|
exports.AIBackendProfileSchema = AIBackendProfileSchema;
|
|
592
|
+
exports.CURRENT_PROFILE_VERSION = CURRENT_PROFILE_VERSION;
|
|
496
593
|
exports.SUPPORTED_SCHEMA_VERSION = SUPPORTED_SCHEMA_VERSION;
|
|
497
594
|
exports.acquireDaemonLock = acquireDaemonLock;
|
|
498
595
|
exports.clearCredentials = clearCredentials;
|
|
499
596
|
exports.clearDaemonState = clearDaemonState;
|
|
500
597
|
exports.clearMachineId = clearMachineId;
|
|
598
|
+
exports.getActiveProfile = getActiveProfile;
|
|
599
|
+
exports.getEnvironmentVariable = getEnvironmentVariable;
|
|
600
|
+
exports.getEnvironmentVariables = getEnvironmentVariables;
|
|
601
|
+
exports.getProfile = getProfile;
|
|
501
602
|
exports.getProfileEnvironmentVariables = getProfileEnvironmentVariables;
|
|
603
|
+
exports.getProfiles = getProfiles;
|
|
604
|
+
exports.isProfileVersionCompatible = isProfileVersionCompatible;
|
|
502
605
|
exports.readCredentials = readCredentials;
|
|
503
606
|
exports.readDaemonState = readDaemonState;
|
|
504
607
|
exports.readSettings = readSettings;
|
|
505
608
|
exports.releaseDaemonLock = releaseDaemonLock;
|
|
609
|
+
exports.setActiveProfile = setActiveProfile;
|
|
610
|
+
exports.setEnvironmentVariables = setEnvironmentVariables;
|
|
611
|
+
exports.updateProfiles = updateProfiles;
|
|
506
612
|
exports.updateSettings = updateSettings;
|
|
613
|
+
exports.validateProfile = validateProfile;
|
|
507
614
|
exports.validateProfileForAgent = validateProfileForAgent;
|
|
615
|
+
exports.validateProfileVersion = validateProfileVersion;
|
|
508
616
|
exports.writeCredentialsDataKey = writeCredentialsDataKey;
|
|
509
617
|
exports.writeCredentialsLegacy = writeCredentialsLegacy;
|
|
510
618
|
exports.writeDaemonState = writeDaemonState;
|
|
619
|
+
exports.writeSettings = writeSettings;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { existsSync, unlinkSync,
|
|
1
|
+
import { unlink, readFile, mkdir, open, stat, writeFile, rename } from 'node:fs/promises';
|
|
2
|
+
import { existsSync, unlinkSync, readdirSync, constants, writeFileSync, readFileSync } from 'node:fs';
|
|
3
3
|
import { join, dirname } from 'node:path';
|
|
4
|
-
import { c as configuration, l as logger, e as encodeBase64 } from './api-
|
|
4
|
+
import { c as configuration, l as logger, e as encodeBase64 } from './api-D-uiH_TF.mjs';
|
|
5
5
|
import * as z from 'zod';
|
|
6
6
|
import 'axios';
|
|
7
7
|
import 'chalk';
|
|
@@ -127,7 +127,24 @@ function getProfileEnvironmentVariables(profile) {
|
|
|
127
127
|
}
|
|
128
128
|
return envVars;
|
|
129
129
|
}
|
|
130
|
+
function validateProfile(profile) {
|
|
131
|
+
const result = AIBackendProfileSchema.safeParse(profile);
|
|
132
|
+
if (!result.success) {
|
|
133
|
+
throw new Error(`Invalid profile data: ${result.error.message}`);
|
|
134
|
+
}
|
|
135
|
+
return result.data;
|
|
136
|
+
}
|
|
137
|
+
const CURRENT_PROFILE_VERSION = "1.0.0";
|
|
130
138
|
const SUPPORTED_SCHEMA_VERSION = 2;
|
|
139
|
+
function validateProfileVersion(profile) {
|
|
140
|
+
const semverRegex = /^\d+\.\d+\.\d+$/;
|
|
141
|
+
return semverRegex.test(profile.version || "");
|
|
142
|
+
}
|
|
143
|
+
function isProfileVersionCompatible(profileVersion, requiredVersion = CURRENT_PROFILE_VERSION) {
|
|
144
|
+
const [major] = profileVersion.split(".");
|
|
145
|
+
const [requiredMajor] = requiredVersion.split(".");
|
|
146
|
+
return major === requiredMajor;
|
|
147
|
+
}
|
|
131
148
|
const defaultSettings = {
|
|
132
149
|
schemaVersion: SUPPORTED_SCHEMA_VERSION,
|
|
133
150
|
onboardingCompleted: false,
|
|
@@ -181,6 +198,16 @@ async function readSettings() {
|
|
|
181
198
|
return { ...defaultSettings };
|
|
182
199
|
}
|
|
183
200
|
}
|
|
201
|
+
async function writeSettings(settings) {
|
|
202
|
+
if (!existsSync(configuration.happyCloudHomeDir)) {
|
|
203
|
+
await mkdir(configuration.happyCloudHomeDir, { recursive: true });
|
|
204
|
+
}
|
|
205
|
+
const settingsWithVersion = {
|
|
206
|
+
...settings,
|
|
207
|
+
schemaVersion: settings.schemaVersion ?? SUPPORTED_SCHEMA_VERSION
|
|
208
|
+
};
|
|
209
|
+
await writeFile(configuration.settingsFile, JSON.stringify(settingsWithVersion, null, 2));
|
|
210
|
+
}
|
|
184
211
|
async function updateSettings(updater) {
|
|
185
212
|
const LOCK_RETRY_INTERVAL_MS = 100;
|
|
186
213
|
const MAX_LOCK_ATTEMPTS = 50;
|
|
@@ -470,5 +497,74 @@ async function releaseDaemonLock(lockHandle) {
|
|
|
470
497
|
} catch {
|
|
471
498
|
}
|
|
472
499
|
}
|
|
500
|
+
async function getProfiles() {
|
|
501
|
+
const settings = await readSettings();
|
|
502
|
+
return settings.profiles || [];
|
|
503
|
+
}
|
|
504
|
+
async function getProfile(profileId) {
|
|
505
|
+
const settings = await readSettings();
|
|
506
|
+
return settings.profiles.find((p) => p.id === profileId) || null;
|
|
507
|
+
}
|
|
508
|
+
async function getActiveProfile() {
|
|
509
|
+
const settings = await readSettings();
|
|
510
|
+
if (!settings.activeProfileId) return null;
|
|
511
|
+
return settings.profiles.find((p) => p.id === settings.activeProfileId) || null;
|
|
512
|
+
}
|
|
513
|
+
async function setActiveProfile(profileId) {
|
|
514
|
+
await updateSettings((settings) => ({
|
|
515
|
+
...settings,
|
|
516
|
+
activeProfileId: profileId
|
|
517
|
+
}));
|
|
518
|
+
}
|
|
519
|
+
async function updateProfiles(profiles) {
|
|
520
|
+
const validatedProfiles = profiles.map((profile) => validateProfile(profile));
|
|
521
|
+
await updateSettings((settings) => {
|
|
522
|
+
const activeProfileId = settings.activeProfileId;
|
|
523
|
+
const activeProfileStillExists = activeProfileId && validatedProfiles.some((p) => p.id === activeProfileId);
|
|
524
|
+
return {
|
|
525
|
+
...settings,
|
|
526
|
+
profiles: validatedProfiles,
|
|
527
|
+
activeProfileId: activeProfileStillExists ? activeProfileId : void 0
|
|
528
|
+
};
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
async function getEnvironmentVariables(profileId) {
|
|
532
|
+
const settings = await readSettings();
|
|
533
|
+
const profile = settings.profiles.find((p) => p.id === profileId);
|
|
534
|
+
if (!profile) return {};
|
|
535
|
+
const envVars = {};
|
|
536
|
+
if (profile.environmentVariables) {
|
|
537
|
+
profile.environmentVariables.forEach((envVar) => {
|
|
538
|
+
envVars[envVar.name] = envVar.value;
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
const localEnvVars = settings.localEnvironmentVariables[profileId] || {};
|
|
542
|
+
Object.assign(envVars, localEnvVars);
|
|
543
|
+
return envVars;
|
|
544
|
+
}
|
|
545
|
+
async function setEnvironmentVariables(profileId, envVars) {
|
|
546
|
+
await updateSettings((settings) => ({
|
|
547
|
+
...settings,
|
|
548
|
+
localEnvironmentVariables: {
|
|
549
|
+
...settings.localEnvironmentVariables,
|
|
550
|
+
[profileId]: envVars
|
|
551
|
+
}
|
|
552
|
+
}));
|
|
553
|
+
}
|
|
554
|
+
async function getEnvironmentVariable(profileId, key) {
|
|
555
|
+
const settings = await readSettings();
|
|
556
|
+
const localEnvVars = settings.localEnvironmentVariables[profileId] || {};
|
|
557
|
+
if (localEnvVars[key] !== void 0) {
|
|
558
|
+
return localEnvVars[key];
|
|
559
|
+
}
|
|
560
|
+
const profile = settings.profiles.find((p) => p.id === profileId);
|
|
561
|
+
if (profile?.environmentVariables) {
|
|
562
|
+
const envVar = profile.environmentVariables.find((env) => env.name === key);
|
|
563
|
+
if (envVar) {
|
|
564
|
+
return envVar.value;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
return void 0;
|
|
568
|
+
}
|
|
473
569
|
|
|
474
|
-
export { AIBackendProfileSchema, SUPPORTED_SCHEMA_VERSION, acquireDaemonLock, clearCredentials, clearDaemonState, clearMachineId, getProfileEnvironmentVariables, readCredentials, readDaemonState, readSettings, releaseDaemonLock, updateSettings, validateProfileForAgent, writeCredentialsDataKey, writeCredentialsLegacy, writeDaemonState };
|
|
570
|
+
export { AIBackendProfileSchema, CURRENT_PROFILE_VERSION, SUPPORTED_SCHEMA_VERSION, acquireDaemonLock, clearCredentials, clearDaemonState, clearMachineId, getActiveProfile, getEnvironmentVariable, getEnvironmentVariables, getProfile, getProfileEnvironmentVariables, getProfiles, isProfileVersionCompatible, readCredentials, readDaemonState, readSettings, releaseDaemonLock, setActiveProfile, setEnvironmentVariables, updateProfiles, updateSettings, validateProfile, validateProfileForAgent, validateProfileVersion, writeCredentialsDataKey, writeCredentialsLegacy, writeDaemonState, writeSettings };
|
package/dist/{registerKillSessionHandler-D1ouN10n.cjs → registerKillSessionHandler-CYc0SIjF.cjs}
RENAMED
|
@@ -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-DM6z3aeG.cjs');
|
|
4
|
+
var api = require('./api-CN-WqYd_.cjs');
|
|
5
5
|
var crypto = require('crypto');
|
|
6
6
|
require('axios');
|
|
7
7
|
require('node:events');
|
package/dist/{registerKillSessionHandler-BAvk4GYO.mjs → registerKillSessionHandler-Cu9rHGsI.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { f as formatDisplayMessage } from './index-
|
|
2
|
-
import { l as logger } from './api-
|
|
1
|
+
import { f as formatDisplayMessage } from './index-DhheEtRl.mjs';
|
|
2
|
+
import { l as logger } from './api-D-uiH_TF.mjs';
|
|
3
3
|
import { createHash } from 'crypto';
|
|
4
4
|
import 'axios';
|
|
5
5
|
import 'node:events';
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
var os = require('node:os');
|
|
4
4
|
var node_crypto = require('node:crypto');
|
|
5
|
-
var api = require('./api-
|
|
6
|
-
var index = require('./index-
|
|
5
|
+
var api = require('./api-CN-WqYd_.cjs');
|
|
6
|
+
var index = require('./index-DM6z3aeG.cjs');
|
|
7
7
|
var types = require('./types-DVk3crez.cjs');
|
|
8
8
|
var node_path = require('node:path');
|
|
9
9
|
var promises = require('node:fs/promises');
|
|
10
10
|
var fs = require('fs/promises');
|
|
11
11
|
var ink = require('ink');
|
|
12
|
-
var registerKillSessionHandler = require('./registerKillSessionHandler-
|
|
12
|
+
var registerKillSessionHandler = require('./registerKillSessionHandler-CYc0SIjF.cjs');
|
|
13
13
|
var React = require('react');
|
|
14
14
|
var node_child_process = require('node:child_process');
|
|
15
15
|
var node_readline = require('node:readline');
|
|
@@ -22,7 +22,7 @@ require('tweetnacl');
|
|
|
22
22
|
require('expo-server-sdk');
|
|
23
23
|
require('chalk');
|
|
24
24
|
var node_util = require('node:util');
|
|
25
|
-
var persistence = require('./persistence-
|
|
25
|
+
var persistence = require('./persistence-DBGkO8gB.cjs');
|
|
26
26
|
var node_http = require('node:http');
|
|
27
27
|
require('fs');
|
|
28
28
|
require('zod');
|
|
@@ -937,7 +937,7 @@ class AbortError extends Error {
|
|
|
937
937
|
}
|
|
938
938
|
}
|
|
939
939
|
|
|
940
|
-
const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('runClaude-
|
|
940
|
+
const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('runClaude-CPhWaFrX.cjs', document.baseURI).href)));
|
|
941
941
|
const __dirname$1 = node_path.join(__filename$1, "..");
|
|
942
942
|
function getGlobalClaudeVersion() {
|
|
943
943
|
try {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import os, { homedir } from 'node:os';
|
|
2
2
|
import { randomUUID } from 'node:crypto';
|
|
3
|
-
import { l as logger, d as backoff, f as delay, g as AsyncLock, c as configuration, b as connectionState, A as ApiClient, p as packageJson, i as isAuthenticationRequiredError, s as startOfflineReconnection } from './api-
|
|
4
|
-
import { e as getProjectPath, h as claudeLocal, E as ExitCodeError, j as isBun, k as trimIdent, l as claudeCheckSession, p as projectPath, m as getEnvironmentInfo, i as initialMachineMetadata, b as stopCaffeinate, n as notifyDaemonSessionStarted, o as startCaffeinate } from './index-
|
|
3
|
+
import { l as logger, d as backoff, f as delay, g as AsyncLock, c as configuration, b as connectionState, A as ApiClient, p as packageJson, i as isAuthenticationRequiredError, s as startOfflineReconnection } from './api-D-uiH_TF.mjs';
|
|
4
|
+
import { e as getProjectPath, h as claudeLocal, E as ExitCodeError, j as isBun, k as trimIdent, l as claudeCheckSession, p as projectPath, m as getEnvironmentInfo, i as initialMachineMetadata, b as stopCaffeinate, n as notifyDaemonSessionStarted, o as startCaffeinate } from './index-DhheEtRl.mjs';
|
|
5
5
|
import { R as RawJSONLinesSchema } from './types-CiliQpqS.mjs';
|
|
6
6
|
import { dirname, basename, join, resolve } from 'node:path';
|
|
7
7
|
import { readFile } from 'node:fs/promises';
|
|
8
8
|
import { stat, watch, access } from 'fs/promises';
|
|
9
9
|
import { useStdout, useInput, Box, Text, render } from 'ink';
|
|
10
|
-
import { a as MessageBuffer, M as MessageQueue2, h as hashObject, r as registerKillSessionHandler } from './registerKillSessionHandler-
|
|
10
|
+
import { a as MessageBuffer, M as MessageQueue2, h as hashObject, r as registerKillSessionHandler } from './registerKillSessionHandler-Cu9rHGsI.mjs';
|
|
11
11
|
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
12
12
|
import { execSync, spawn } from 'node:child_process';
|
|
13
13
|
import { createInterface } from 'node:readline';
|
|
@@ -20,7 +20,7 @@ import 'tweetnacl';
|
|
|
20
20
|
import 'expo-server-sdk';
|
|
21
21
|
import 'chalk';
|
|
22
22
|
import { isDeepStrictEqual } from 'node:util';
|
|
23
|
-
import { readSettings } from './persistence-
|
|
23
|
+
import { readSettings } from './persistence-DiNg1DPF.mjs';
|
|
24
24
|
import { createServer } from 'node:http';
|
|
25
25
|
import 'fs';
|
|
26
26
|
import 'zod';
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var node_crypto = require('node:crypto');
|
|
4
|
-
var api = require('./api-
|
|
5
|
-
var persistence = require('./persistence-
|
|
6
|
-
var index = require('./index-
|
|
7
|
-
var
|
|
8
|
-
var registerKillSessionHandler = require('./registerKillSessionHandler-
|
|
4
|
+
var api = require('./api-CN-WqYd_.cjs');
|
|
5
|
+
var persistence = require('./persistence-DBGkO8gB.cjs');
|
|
6
|
+
var index = require('./index-DM6z3aeG.cjs');
|
|
7
|
+
var names = require('./names-BnV67N_O.cjs');
|
|
8
|
+
var registerKillSessionHandler = require('./registerKillSessionHandler-CYc0SIjF.cjs');
|
|
9
9
|
var React = require('react');
|
|
10
10
|
var ink = require('ink');
|
|
11
|
-
var happyProtocol = require('happy-protocol');
|
|
12
11
|
require('axios');
|
|
13
12
|
require('chalk');
|
|
14
13
|
require('fs');
|
|
@@ -313,7 +312,7 @@ const CodexDisplay = ({ messageBuffer, logPath, onExit, title }) => {
|
|
|
313
312
|
));
|
|
314
313
|
};
|
|
315
314
|
|
|
316
|
-
class CodexPermissionHandler extends
|
|
315
|
+
class CodexPermissionHandler extends names.BasePermissionHandler {
|
|
317
316
|
constructor(session) {
|
|
318
317
|
super(session);
|
|
319
318
|
}
|
|
@@ -352,7 +351,7 @@ class CodexSelectionHandler {
|
|
|
352
351
|
};
|
|
353
352
|
pending.timeoutHandle = setTimeout(() => {
|
|
354
353
|
this.handleSelectionTimeout(request.id, pending);
|
|
355
|
-
},
|
|
354
|
+
}, names.getPendingInteractionTimeoutMs());
|
|
356
355
|
this.pendingRequests.set(request.id, pending);
|
|
357
356
|
this.session.updateAgentState((currentState) => ({
|
|
358
357
|
...currentState,
|
|
@@ -388,7 +387,7 @@ class CodexSelectionHandler {
|
|
|
388
387
|
hasPendingRequests() {
|
|
389
388
|
return this.pendingRequests.size > 0;
|
|
390
389
|
}
|
|
391
|
-
supersedePendingRequests(reason =
|
|
390
|
+
supersedePendingRequests(reason = names.INTERACTION_SUPERSEDED_ERROR) {
|
|
392
391
|
const pendingSnapshot = Array.from(this.pendingRequests.entries());
|
|
393
392
|
if (pendingSnapshot.length === 0) {
|
|
394
393
|
return 0;
|
|
@@ -500,7 +499,7 @@ class CodexSelectionHandler {
|
|
|
500
499
|
}
|
|
501
500
|
this.pendingRequests.delete(requestId);
|
|
502
501
|
this.clearPendingRequestTimeout(active);
|
|
503
|
-
active.reject(new Error(
|
|
502
|
+
active.reject(new Error(names.INTERACTION_TIMED_OUT_ERROR));
|
|
504
503
|
this.session.updateAgentState((currentState) => {
|
|
505
504
|
const request = currentState.requests?.[requestId] || {
|
|
506
505
|
tool: "AskUserQuestion",
|
|
@@ -523,7 +522,7 @@ class CodexSelectionHandler {
|
|
|
523
522
|
...request,
|
|
524
523
|
completedAt: Date.now(),
|
|
525
524
|
status: "canceled",
|
|
526
|
-
reason:
|
|
525
|
+
reason: names.INTERACTION_TIMED_OUT_ERROR,
|
|
527
526
|
requestKind: "selection"
|
|
528
527
|
}
|
|
529
528
|
}
|
|
@@ -537,7 +536,7 @@ class CodexSelectionHandler {
|
|
|
537
536
|
}
|
|
538
537
|
}
|
|
539
538
|
|
|
540
|
-
class ReasoningProcessor extends
|
|
539
|
+
class ReasoningProcessor extends names.BaseReasoningProcessor {
|
|
541
540
|
getToolName() {
|
|
542
541
|
return "CodexReasoning";
|
|
543
542
|
}
|
|
@@ -943,7 +942,7 @@ async function codexRemoteLauncher(session) {
|
|
|
943
942
|
}
|
|
944
943
|
case "tool-call": {
|
|
945
944
|
const toolArgs = msg.args ? index.truncateDisplayMessage(msg.args, 100) : "";
|
|
946
|
-
const canonicalToolName =
|
|
945
|
+
const canonicalToolName = names.resolveCanonicalToolNameV2(msg.toolName);
|
|
947
946
|
messageBuffer.addMessage(
|
|
948
947
|
`Executing: ${msg.toolName}${toolArgs ? ` ${toolArgs}` : ""}`,
|
|
949
948
|
"tool"
|
|
@@ -952,7 +951,7 @@ async function codexRemoteLauncher(session) {
|
|
|
952
951
|
type: "tool-call",
|
|
953
952
|
name: canonicalToolName,
|
|
954
953
|
callId: msg.callId,
|
|
955
|
-
input:
|
|
954
|
+
input: names.attachToolHappierMetaV2(msg.args, {
|
|
956
955
|
v: 2,
|
|
957
956
|
protocol: "acp",
|
|
958
957
|
provider: "codex",
|
|
@@ -964,7 +963,7 @@ async function codexRemoteLauncher(session) {
|
|
|
964
963
|
return;
|
|
965
964
|
}
|
|
966
965
|
case "tool-result": {
|
|
967
|
-
const isError =
|
|
966
|
+
const isError = names.inferToolResultError(msg.result);
|
|
968
967
|
const resultText = index.truncateDisplayMessage(msg.result, 200) || (isError ? "Unknown error" : "");
|
|
969
968
|
messageBuffer.addMessage(
|
|
970
969
|
`${isError ? "Error:" : "Result:"} ${resultText}`.trim(),
|
|
@@ -973,12 +972,12 @@ async function codexRemoteLauncher(session) {
|
|
|
973
972
|
session.runtimeSession.sendCodexMessage({
|
|
974
973
|
type: "tool-call-result",
|
|
975
974
|
callId: msg.callId,
|
|
976
|
-
output:
|
|
975
|
+
output: names.attachToolHappierMetaV2(msg.result, {
|
|
977
976
|
v: 2,
|
|
978
977
|
protocol: "acp",
|
|
979
978
|
provider: "codex",
|
|
980
979
|
rawToolName: msg.toolName,
|
|
981
|
-
canonicalToolName:
|
|
980
|
+
canonicalToolName: names.resolveCanonicalToolNameV2(msg.toolName)
|
|
982
981
|
}),
|
|
983
982
|
id: node_crypto.randomUUID(),
|
|
984
983
|
isError
|
|
@@ -1021,12 +1020,12 @@ async function codexRemoteLauncher(session) {
|
|
|
1021
1020
|
const { call_id, type, ...inputs } = msg;
|
|
1022
1021
|
messageBuffer.addMessage(`Exec approval requested: ${call_id}`, "tool");
|
|
1023
1022
|
const rawToolName = "CodexBash";
|
|
1024
|
-
const canonicalToolName =
|
|
1023
|
+
const canonicalToolName = names.resolveCanonicalToolNameV2(rawToolName);
|
|
1025
1024
|
session.runtimeSession.sendCodexMessage({
|
|
1026
1025
|
type: "tool-call",
|
|
1027
1026
|
name: canonicalToolName,
|
|
1028
1027
|
callId: call_id,
|
|
1029
|
-
input:
|
|
1028
|
+
input: names.attachToolHappierMetaV2(inputs, {
|
|
1030
1029
|
v: 2,
|
|
1031
1030
|
protocol: "acp",
|
|
1032
1031
|
provider: "codex",
|
|
@@ -1042,12 +1041,12 @@ async function codexRemoteLauncher(session) {
|
|
|
1042
1041
|
const filesMsg = changeCount === 1 ? "1 file" : `${changeCount} files`;
|
|
1043
1042
|
messageBuffer.addMessage(`Modifying ${filesMsg}...`, "tool");
|
|
1044
1043
|
const rawToolName = "CodexPatch";
|
|
1045
|
-
const canonicalToolName =
|
|
1044
|
+
const canonicalToolName = names.resolveCanonicalToolNameV2(rawToolName);
|
|
1046
1045
|
session.runtimeSession.sendCodexMessage({
|
|
1047
1046
|
type: "tool-call",
|
|
1048
1047
|
name: canonicalToolName,
|
|
1049
1048
|
callId: msg.call_id,
|
|
1050
|
-
input:
|
|
1049
|
+
input: names.attachToolHappierMetaV2({
|
|
1051
1050
|
auto_approved: msg.auto_approved,
|
|
1052
1051
|
changes: msg.changes
|
|
1053
1052
|
}, {
|
|
@@ -1070,7 +1069,7 @@ async function codexRemoteLauncher(session) {
|
|
|
1070
1069
|
session.runtimeSession.sendCodexMessage({
|
|
1071
1070
|
type: "tool-call-result",
|
|
1072
1071
|
callId: msg.call_id,
|
|
1073
|
-
output:
|
|
1072
|
+
output: names.attachToolHappierMetaV2({
|
|
1074
1073
|
stdout: msg.stdout,
|
|
1075
1074
|
stderr: msg.stderr,
|
|
1076
1075
|
success: msg.success
|
|
@@ -1079,7 +1078,7 @@ async function codexRemoteLauncher(session) {
|
|
|
1079
1078
|
protocol: "acp",
|
|
1080
1079
|
provider: "codex",
|
|
1081
1080
|
rawToolName: "CodexPatch",
|
|
1082
|
-
canonicalToolName:
|
|
1081
|
+
canonicalToolName: names.resolveCanonicalToolNameV2("CodexPatch")
|
|
1083
1082
|
}),
|
|
1084
1083
|
id: node_crypto.randomUUID(),
|
|
1085
1084
|
isError: !msg.success
|
|
@@ -1442,7 +1441,7 @@ async function runCodex(opts) {
|
|
|
1442
1441
|
machineId,
|
|
1443
1442
|
metadata: index.initialMachineMetadata
|
|
1444
1443
|
});
|
|
1445
|
-
const { state, metadata } =
|
|
1444
|
+
const { state, metadata } = names.createSessionMetadata({
|
|
1446
1445
|
flavor: "codex",
|
|
1447
1446
|
machineId,
|
|
1448
1447
|
startedBy: opts.startedBy
|
|
@@ -1458,7 +1457,7 @@ async function runCodex(opts) {
|
|
|
1458
1457
|
}
|
|
1459
1458
|
let sessionClient;
|
|
1460
1459
|
let codexSession = null;
|
|
1461
|
-
const { session: initialSession, reconnectionHandle } =
|
|
1460
|
+
const { session: initialSession, reconnectionHandle } = names.setupOfflineReconnection({
|
|
1462
1461
|
api: api$1,
|
|
1463
1462
|
sessionTag,
|
|
1464
1463
|
metadata,
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import { l as logger, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-
|
|
3
|
-
import { readSettings } from './persistence-
|
|
4
|
-
import { f as formatDisplayMessage, v as validateCodexAcpSpawn, d as createCodexBackend, t as truncateDisplayMessage, b as stopCaffeinate, i as initialMachineMetadata, n as notifyDaemonSessionStarted } from './index-
|
|
5
|
-
import { B as BasePermissionHandler, g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR,
|
|
6
|
-
import { h as hashObject, a as MessageBuffer, r as registerKillSessionHandler, M as MessageQueue2 } from './registerKillSessionHandler-
|
|
2
|
+
import { l as logger, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-D-uiH_TF.mjs';
|
|
3
|
+
import { readSettings } from './persistence-DiNg1DPF.mjs';
|
|
4
|
+
import { f as formatDisplayMessage, v as validateCodexAcpSpawn, d as createCodexBackend, t as truncateDisplayMessage, b as stopCaffeinate, i as initialMachineMetadata, n as notifyDaemonSessionStarted } from './index-DhheEtRl.mjs';
|
|
5
|
+
import { B as BasePermissionHandler, g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, d as INTERACTION_TIMED_OUT_ERROR, a as BaseReasoningProcessor, b as attachToolHappierMetaV2, r as resolveCanonicalToolNameV2, i as inferToolResultError, c as createSessionMetadata, s as setupOfflineReconnection } from './names-BjEof0E2.mjs';
|
|
6
|
+
import { h as hashObject, a as MessageBuffer, r as registerKillSessionHandler, M as MessageQueue2 } from './registerKillSessionHandler-Cu9rHGsI.mjs';
|
|
7
7
|
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
8
8
|
import { useStdout, useInput, Box, Text, render } from 'ink';
|
|
9
|
-
import { attachToolHappierMetaV2, resolveCanonicalToolNameV2, inferToolResultError } from 'happy-protocol';
|
|
10
9
|
import 'axios';
|
|
11
10
|
import 'chalk';
|
|
12
11
|
import 'fs';
|