happy-imou-cloud 2.0.6 → 2.0.7
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/{BaseReasoningProcessor-1EzrE03x.mjs → BaseReasoningProcessor-ClrT-x-H.mjs} +2 -2
- package/dist/{BaseReasoningProcessor-BMyfwx3p.cjs → BaseReasoningProcessor-DphULXS-.cjs} +2 -2
- package/dist/{api-DccDghmF.cjs → api-Dwkm7s_E.cjs} +2 -2
- package/dist/{api-Emo3rSZH.mjs → api-dwwHBzLc.mjs} +2 -2
- package/dist/{command-D8Zz6B4t.mjs → command-Cfq3Uc0S.mjs} +3 -3
- package/dist/{command-C2v0VkPq.cjs → command-DiAVIsxX.cjs} +3 -3
- package/dist/{index-Buq7nurH.cjs → index-CfqxEoyl.cjs} +10 -11
- package/dist/{index-Dh8UTgm4.mjs → index-HyqLXzw-.mjs} +8 -9
- 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/{persistence-Blm1hTQA.mjs → persistence-Dg-rxY2a.mjs} +1 -1
- package/dist/{persistence-BrTyBuT7.cjs → persistence-hbhwAYIV.cjs} +1 -1
- package/dist/{registerKillSessionHandler-Bm7E-03E.mjs → registerKillSessionHandler-BAvk4GYO.mjs} +26 -2
- package/dist/{registerKillSessionHandler-EFAsOnR_.cjs → registerKillSessionHandler-D1ouN10n.cjs} +26 -2
- package/dist/{runClaude-COy1pLhn.cjs → runClaude-CZmJ7qEP.cjs} +5 -5
- package/dist/{runClaude-CwA5UCO-.mjs → runClaude-OxYbt3ZQ.mjs} +4 -4
- package/dist/{runCodex-DTPmqCyS.mjs → runCodex-ByVTEbSY.mjs} +35 -62
- package/dist/{runCodex-BRMOT2dJ.cjs → runCodex-CtncAgso.cjs} +34 -62
- package/dist/{runGemini-DDSR8BtO.mjs → runGemini-BRO6A2jm.mjs} +5 -5
- package/dist/{runGemini-BVPmTGxQ.cjs → runGemini-ChwjLmhI.cjs} +5 -5
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import os from 'node:os';
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
|
-
import { c as configuration, p as packageJson, s as startOfflineReconnection, l as logger } from './api-
|
|
4
|
-
import { p as projectPath } from './index-
|
|
3
|
+
import { c as configuration, p as packageJson, s as startOfflineReconnection, l as logger } from './api-dwwHBzLc.mjs';
|
|
4
|
+
import { p as projectPath } from './index-HyqLXzw-.mjs';
|
|
5
5
|
import { EventEmitter } from 'node:events';
|
|
6
6
|
import { randomUUID } from 'node:crypto';
|
|
7
7
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var os = require('node:os');
|
|
4
4
|
var node_path = require('node:path');
|
|
5
|
-
var api = require('./api-
|
|
6
|
-
var index = require('./index-
|
|
5
|
+
var api = require('./api-Dwkm7s_E.cjs');
|
|
6
|
+
var index = require('./index-CfqxEoyl.cjs');
|
|
7
7
|
var node_events = require('node:events');
|
|
8
8
|
var node_crypto = require('node:crypto');
|
|
9
9
|
|
|
@@ -19,7 +19,7 @@ var path = require('path');
|
|
|
19
19
|
var expoServerSdk = require('expo-server-sdk');
|
|
20
20
|
|
|
21
21
|
var name = "happy-imou-cloud";
|
|
22
|
-
var version = "2.0.
|
|
22
|
+
var version = "2.0.7";
|
|
23
23
|
var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
|
|
24
24
|
var author = "long.zhu";
|
|
25
25
|
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-hbhwAYIV.cjs'); });
|
|
437
437
|
const state = await readDaemonState();
|
|
438
438
|
if (!state) {
|
|
439
439
|
return logs;
|
|
@@ -17,7 +17,7 @@ import { resolve, join as join$1 } from 'path';
|
|
|
17
17
|
import { Expo } from 'expo-server-sdk';
|
|
18
18
|
|
|
19
19
|
var name = "happy-imou-cloud";
|
|
20
|
-
var version = "2.0.
|
|
20
|
+
var version = "2.0.7";
|
|
21
21
|
var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
|
|
22
22
|
var author = "long.zhu";
|
|
23
23
|
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-Dg-rxY2a.mjs');
|
|
435
435
|
const state = await readDaemonState();
|
|
436
436
|
if (!state) {
|
|
437
437
|
return logs;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as createDefaultRuntimeShell } from './index-
|
|
1
|
+
import { c as createDefaultRuntimeShell } from './index-HyqLXzw-.mjs';
|
|
2
2
|
import 'chalk';
|
|
3
|
-
import './api-
|
|
3
|
+
import './api-dwwHBzLc.mjs';
|
|
4
4
|
import 'axios';
|
|
5
5
|
import 'fs';
|
|
6
6
|
import 'node:fs';
|
|
@@ -17,7 +17,7 @@ import 'fs/promises';
|
|
|
17
17
|
import 'crypto';
|
|
18
18
|
import 'path';
|
|
19
19
|
import 'expo-server-sdk';
|
|
20
|
-
import './persistence-
|
|
20
|
+
import './persistence-Dg-rxY2a.mjs';
|
|
21
21
|
import 'node:fs/promises';
|
|
22
22
|
import 'os';
|
|
23
23
|
import 'tmp';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-CfqxEoyl.cjs');
|
|
4
4
|
require('chalk');
|
|
5
|
-
require('./api-
|
|
5
|
+
require('./api-Dwkm7s_E.cjs');
|
|
6
6
|
require('axios');
|
|
7
7
|
require('fs');
|
|
8
8
|
require('node:fs');
|
|
@@ -19,7 +19,7 @@ require('fs/promises');
|
|
|
19
19
|
require('crypto');
|
|
20
20
|
require('path');
|
|
21
21
|
require('expo-server-sdk');
|
|
22
|
-
require('./persistence-
|
|
22
|
+
require('./persistence-hbhwAYIV.cjs');
|
|
23
23
|
require('node:fs/promises');
|
|
24
24
|
require('os');
|
|
25
25
|
require('tmp');
|
|
@@ -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-Dwkm7s_E.cjs');
|
|
5
|
+
var persistence = require('./persistence-hbhwAYIV.cjs');
|
|
6
6
|
var z = require('zod');
|
|
7
7
|
var fs$1 = require('fs/promises');
|
|
8
8
|
var os$1 = require('os');
|
|
@@ -70,7 +70,7 @@ async function openBrowser(url) {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
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-
|
|
73
|
+
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-CfqxEoyl.cjs', document.baseURI).href)));
|
|
74
74
|
const QRCode = require$1("qrcode-terminal/vendor/QRCode");
|
|
75
75
|
const QRErrorCorrectLevel = require$1("qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel");
|
|
76
76
|
const pendingTempFiles = /* @__PURE__ */ new Set();
|
|
@@ -693,7 +693,7 @@ function setupCleanupHandlers() {
|
|
|
693
693
|
});
|
|
694
694
|
}
|
|
695
695
|
|
|
696
|
-
const __dirname$1 = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-
|
|
696
|
+
const __dirname$1 = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-CfqxEoyl.cjs', document.baseURI).href))));
|
|
697
697
|
function projectPath() {
|
|
698
698
|
const path$1 = path.resolve(__dirname$1, "..");
|
|
699
699
|
return path$1;
|
|
@@ -6560,7 +6560,6 @@ function createCodexBackend(options) {
|
|
|
6560
6560
|
...options.env,
|
|
6561
6561
|
NODE_ENV: "production"
|
|
6562
6562
|
},
|
|
6563
|
-
mcpServers: options.mcpServers,
|
|
6564
6563
|
permissionHandler: options.permissionHandler,
|
|
6565
6564
|
selectionHandler: options.selectionHandler,
|
|
6566
6565
|
transportHandler: resolveCodexTransport(spawn.command)
|
|
@@ -6768,12 +6767,12 @@ async function ensureUnifiedDaemonStarted() {
|
|
|
6768
6767
|
async function executeUnifiedProvider(opts) {
|
|
6769
6768
|
const credentials = await ensureUnifiedRuntimePrerequisites(opts.credentials);
|
|
6770
6769
|
if (opts.provider === "claude") {
|
|
6771
|
-
const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-
|
|
6770
|
+
const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-CZmJ7qEP.cjs'); });
|
|
6772
6771
|
await runClaude(credentials, opts.claudeOptions ?? {});
|
|
6773
6772
|
return;
|
|
6774
6773
|
}
|
|
6775
6774
|
if (opts.provider === "codex") {
|
|
6776
|
-
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-
|
|
6775
|
+
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-CtncAgso.cjs'); });
|
|
6777
6776
|
await runCodex({
|
|
6778
6777
|
credentials,
|
|
6779
6778
|
startedBy: opts.startedBy,
|
|
@@ -6783,7 +6782,7 @@ async function executeUnifiedProvider(opts) {
|
|
|
6783
6782
|
return;
|
|
6784
6783
|
}
|
|
6785
6784
|
if (opts.provider === "gemini") {
|
|
6786
|
-
const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-
|
|
6785
|
+
const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-ChwjLmhI.cjs'); });
|
|
6787
6786
|
await runGemini({
|
|
6788
6787
|
credentials,
|
|
6789
6788
|
startedBy: opts.startedBy
|
|
@@ -6825,7 +6824,7 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
6825
6824
|
return;
|
|
6826
6825
|
} else if (subcommand === "runtime") {
|
|
6827
6826
|
if (args[1] === "providers") {
|
|
6828
|
-
const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-
|
|
6827
|
+
const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-DiAVIsxX.cjs'); });
|
|
6829
6828
|
console.log(renderRuntimeProviders());
|
|
6830
6829
|
return;
|
|
6831
6830
|
}
|
|
@@ -7003,8 +7002,8 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
7003
7002
|
const projectId = args[3];
|
|
7004
7003
|
try {
|
|
7005
7004
|
const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
|
|
7006
|
-
const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-
|
|
7007
|
-
const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-
|
|
7005
|
+
const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-hbhwAYIV.cjs'); });
|
|
7006
|
+
const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-Dwkm7s_E.cjs'); }).then(function (n) { return n.api; });
|
|
7008
7007
|
let userEmail = void 0;
|
|
7009
7008
|
try {
|
|
7010
7009
|
const credentials = await readCredentials2();
|
|
@@ -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, h as buildAuthenticatedHeaders, S as SigningBootstrapRequiredError, j as SIGNING_BOOTSTRAP_REQUIRED_MESSAGE, k as encodeBase64Url, f as delay, m as buildClientHeaders, n as decodeBase64, H as HAPPY_CLOUD_DAEMON_PORT, p as packageJson, A as ApiClient, o 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, h as buildAuthenticatedHeaders, S as SigningBootstrapRequiredError, j as SIGNING_BOOTSTRAP_REQUIRED_MESSAGE, k as encodeBase64Url, f as delay, m as buildClientHeaders, n as decodeBase64, H as HAPPY_CLOUD_DAEMON_PORT, p as packageJson, A as ApiClient, o as getLatestDaemonLog } from './api-dwwHBzLc.mjs';
|
|
3
|
+
import { writeCredentialsLegacy, writeCredentialsDataKey, readCredentials, readSettings, updateSettings, readDaemonState, clearDaemonState, acquireDaemonLock, writeDaemonState, releaseDaemonLock, validateProfileForAgent, getProfileEnvironmentVariables, clearCredentials, clearMachineId } from './persistence-Dg-rxY2a.mjs';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import fs from 'fs/promises';
|
|
6
6
|
import os, { homedir } from 'os';
|
|
@@ -6538,7 +6538,6 @@ function createCodexBackend(options) {
|
|
|
6538
6538
|
...options.env,
|
|
6539
6539
|
NODE_ENV: "production"
|
|
6540
6540
|
},
|
|
6541
|
-
mcpServers: options.mcpServers,
|
|
6542
6541
|
permissionHandler: options.permissionHandler,
|
|
6543
6542
|
selectionHandler: options.selectionHandler,
|
|
6544
6543
|
transportHandler: resolveCodexTransport(spawn.command)
|
|
@@ -6746,12 +6745,12 @@ async function ensureUnifiedDaemonStarted() {
|
|
|
6746
6745
|
async function executeUnifiedProvider(opts) {
|
|
6747
6746
|
const credentials = await ensureUnifiedRuntimePrerequisites(opts.credentials);
|
|
6748
6747
|
if (opts.provider === "claude") {
|
|
6749
|
-
const { runClaude } = await import('./runClaude-
|
|
6748
|
+
const { runClaude } = await import('./runClaude-OxYbt3ZQ.mjs');
|
|
6750
6749
|
await runClaude(credentials, opts.claudeOptions ?? {});
|
|
6751
6750
|
return;
|
|
6752
6751
|
}
|
|
6753
6752
|
if (opts.provider === "codex") {
|
|
6754
|
-
const { runCodex } = await import('./runCodex-
|
|
6753
|
+
const { runCodex } = await import('./runCodex-ByVTEbSY.mjs');
|
|
6755
6754
|
await runCodex({
|
|
6756
6755
|
credentials,
|
|
6757
6756
|
startedBy: opts.startedBy,
|
|
@@ -6761,7 +6760,7 @@ async function executeUnifiedProvider(opts) {
|
|
|
6761
6760
|
return;
|
|
6762
6761
|
}
|
|
6763
6762
|
if (opts.provider === "gemini") {
|
|
6764
|
-
const { runGemini } = await import('./runGemini-
|
|
6763
|
+
const { runGemini } = await import('./runGemini-BRO6A2jm.mjs');
|
|
6765
6764
|
await runGemini({
|
|
6766
6765
|
credentials,
|
|
6767
6766
|
startedBy: opts.startedBy
|
|
@@ -6803,7 +6802,7 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
6803
6802
|
return;
|
|
6804
6803
|
} else if (subcommand === "runtime") {
|
|
6805
6804
|
if (args[1] === "providers") {
|
|
6806
|
-
const { renderRuntimeProviders } = await import('./command-
|
|
6805
|
+
const { renderRuntimeProviders } = await import('./command-Cfq3Uc0S.mjs');
|
|
6807
6806
|
console.log(renderRuntimeProviders());
|
|
6808
6807
|
return;
|
|
6809
6808
|
}
|
|
@@ -6981,8 +6980,8 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
6981
6980
|
const projectId = args[3];
|
|
6982
6981
|
try {
|
|
6983
6982
|
const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
|
|
6984
|
-
const { readCredentials: readCredentials2 } = await import('./persistence-
|
|
6985
|
-
const { ApiClient: ApiClient2 } = await import('./api-
|
|
6983
|
+
const { readCredentials: readCredentials2 } = await import('./persistence-Dg-rxY2a.mjs');
|
|
6984
|
+
const { ApiClient: ApiClient2 } = await import('./api-dwwHBzLc.mjs').then(function (n) { return n.q; });
|
|
6986
6985
|
let userEmail = void 0;
|
|
6987
6986
|
try {
|
|
6988
6987
|
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-Dwkm7s_E.cjs');
|
|
5
|
+
require('./persistence-hbhwAYIV.cjs');
|
|
6
6
|
require('zod');
|
|
7
|
-
require('./index-
|
|
7
|
+
require('./index-CfqxEoyl.cjs');
|
|
8
8
|
require('node:child_process');
|
|
9
9
|
require('node:fs');
|
|
10
10
|
require('cross-spawn');
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'chalk';
|
|
2
|
-
import './api-
|
|
3
|
-
import './persistence-
|
|
2
|
+
import './api-dwwHBzLc.mjs';
|
|
3
|
+
import './persistence-Dg-rxY2a.mjs';
|
|
4
4
|
import 'zod';
|
|
5
|
-
import './index-
|
|
5
|
+
import './index-HyqLXzw-.mjs';
|
|
6
6
|
import 'node:child_process';
|
|
7
7
|
import 'node:fs';
|
|
8
8
|
import 'cross-spawn';
|
package/dist/lib.cjs
CHANGED
package/dist/lib.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as ApiClient, a as ApiSessionClient, c as configuration, l as logger } from './api-
|
|
1
|
+
export { A as ApiClient, a as ApiSessionClient, c as configuration, l as logger } from './api-dwwHBzLc.mjs';
|
|
2
2
|
export { R as RawJSONLinesSchema } from './types-CiliQpqS.mjs';
|
|
3
3
|
import 'axios';
|
|
4
4
|
import 'chalk';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFile, unlink, mkdir, open, stat, writeFile, rename } from 'node:fs/promises';
|
|
2
2
|
import { existsSync, unlinkSync, writeFileSync, readdirSync, readFileSync, constants } 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-dwwHBzLc.mjs';
|
|
5
5
|
import * as z from 'zod';
|
|
6
6
|
import 'axios';
|
|
7
7
|
import 'chalk';
|
|
@@ -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-Dwkm7s_E.cjs');
|
|
7
7
|
var z = require('zod');
|
|
8
8
|
require('axios');
|
|
9
9
|
require('chalk');
|
package/dist/{registerKillSessionHandler-Bm7E-03E.mjs → registerKillSessionHandler-BAvk4GYO.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-HyqLXzw-.mjs';
|
|
2
|
+
import { l as logger } from './api-dwwHBzLc.mjs';
|
|
3
3
|
import { createHash } from 'crypto';
|
|
4
4
|
import 'axios';
|
|
5
5
|
import 'node:events';
|
|
@@ -23,6 +23,30 @@ class MessageBuffer {
|
|
|
23
23
|
};
|
|
24
24
|
this.messages.push(message);
|
|
25
25
|
this.notifyListeners();
|
|
26
|
+
return message.id;
|
|
27
|
+
}
|
|
28
|
+
updateMessage(id, content, options = {}) {
|
|
29
|
+
const index = this.messages.findIndex((message) => message.id === id);
|
|
30
|
+
if (index === -1) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
const normalizedContent = formatDisplayMessage(content);
|
|
34
|
+
const previous = this.messages[index];
|
|
35
|
+
this.messages[index] = {
|
|
36
|
+
...previous,
|
|
37
|
+
content: options.mode === "replace" ? normalizedContent : previous.content + normalizedContent
|
|
38
|
+
};
|
|
39
|
+
this.notifyListeners();
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
removeMessage(id) {
|
|
43
|
+
const index = this.messages.findIndex((message) => message.id === id);
|
|
44
|
+
if (index === -1) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
this.messages.splice(index, 1);
|
|
48
|
+
this.notifyListeners();
|
|
49
|
+
return true;
|
|
26
50
|
}
|
|
27
51
|
/**
|
|
28
52
|
* Update the last message of a specific type by appending content to it
|
package/dist/{registerKillSessionHandler-EFAsOnR_.cjs → registerKillSessionHandler-D1ouN10n.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-CfqxEoyl.cjs');
|
|
4
|
+
var api = require('./api-Dwkm7s_E.cjs');
|
|
5
5
|
var crypto = require('crypto');
|
|
6
6
|
require('axios');
|
|
7
7
|
require('node:events');
|
|
@@ -25,6 +25,30 @@ class MessageBuffer {
|
|
|
25
25
|
};
|
|
26
26
|
this.messages.push(message);
|
|
27
27
|
this.notifyListeners();
|
|
28
|
+
return message.id;
|
|
29
|
+
}
|
|
30
|
+
updateMessage(id, content, options = {}) {
|
|
31
|
+
const index$1 = this.messages.findIndex((message) => message.id === id);
|
|
32
|
+
if (index$1 === -1) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
const normalizedContent = index.formatDisplayMessage(content);
|
|
36
|
+
const previous = this.messages[index$1];
|
|
37
|
+
this.messages[index$1] = {
|
|
38
|
+
...previous,
|
|
39
|
+
content: options.mode === "replace" ? normalizedContent : previous.content + normalizedContent
|
|
40
|
+
};
|
|
41
|
+
this.notifyListeners();
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
removeMessage(id) {
|
|
45
|
+
const index = this.messages.findIndex((message) => message.id === id);
|
|
46
|
+
if (index === -1) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
this.messages.splice(index, 1);
|
|
50
|
+
this.notifyListeners();
|
|
51
|
+
return true;
|
|
28
52
|
}
|
|
29
53
|
/**
|
|
30
54
|
* Update the last message of a specific type by appending content to it
|
|
@@ -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-Dwkm7s_E.cjs');
|
|
6
|
+
var index = require('./index-CfqxEoyl.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-D1ouN10n.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-hbhwAYIV.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-CZmJ7qEP.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-dwwHBzLc.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-HyqLXzw-.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-BAvk4GYO.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-Dg-rxY2a.mjs';
|
|
24
24
|
import { createServer } from 'node:http';
|
|
25
25
|
import 'fs';
|
|
26
26
|
import 'zod';
|
|
@@ -1,9 +1,9 @@
|
|
|
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, b as INTERACTION_TIMED_OUT_ERROR, a as BaseReasoningProcessor, c as createSessionMetadata, s as setupOfflineReconnection } from './BaseReasoningProcessor-
|
|
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-dwwHBzLc.mjs';
|
|
3
|
+
import { readSettings } from './persistence-Dg-rxY2a.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-HyqLXzw-.mjs';
|
|
5
|
+
import { B as BasePermissionHandler, g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, b as INTERACTION_TIMED_OUT_ERROR, a as BaseReasoningProcessor, c as createSessionMetadata, s as setupOfflineReconnection } from './BaseReasoningProcessor-ClrT-x-H.mjs';
|
|
6
|
+
import { h as hashObject, a as MessageBuffer, r as registerKillSessionHandler, M as MessageQueue2 } from './registerKillSessionHandler-BAvk4GYO.mjs';
|
|
7
7
|
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
8
8
|
import { useStdout, useInput, Box, Text, render } from 'ink';
|
|
9
9
|
import { attachToolHappierMetaV2, resolveCanonicalToolNameV2, inferToolResultError } from 'happy-protocol';
|
|
@@ -131,7 +131,6 @@ class CodexSession {
|
|
|
131
131
|
keepAliveInterval;
|
|
132
132
|
onModeChangeCallback;
|
|
133
133
|
clientSwapCallbacks = [];
|
|
134
|
-
supersedePendingInteractionsCallback = null;
|
|
135
134
|
constructor(opts) {
|
|
136
135
|
this.path = opts.path;
|
|
137
136
|
this.api = opts.api;
|
|
@@ -172,12 +171,6 @@ class CodexSession {
|
|
|
172
171
|
this.clientSwapCallbacks.splice(index, 1);
|
|
173
172
|
}
|
|
174
173
|
};
|
|
175
|
-
setPendingInteractionSuperseder = (callback) => {
|
|
176
|
-
this.supersedePendingInteractionsCallback = callback;
|
|
177
|
-
};
|
|
178
|
-
supersedePendingInteractions = (reason) => {
|
|
179
|
-
return this.supersedePendingInteractionsCallback?.(reason) ?? false;
|
|
180
|
-
};
|
|
181
174
|
onThinkingChange = (thinking) => {
|
|
182
175
|
this.thinking = thinking;
|
|
183
176
|
this.client.keepAlive(thinking, this.mode);
|
|
@@ -782,21 +775,6 @@ function registerCodexRemoteRpcHandlers(clientSession, handlers) {
|
|
|
782
775
|
clientSession.rpcHandlerManager.registerHandler("switch", handlers.handleSwitchToLocal);
|
|
783
776
|
registerKillSessionHandler(clientSession.rpcHandlerManager, handlers.handleKillSession);
|
|
784
777
|
}
|
|
785
|
-
function handleIncomingCodexMessageDuringRemoteTurn(opts) {
|
|
786
|
-
const reason = opts.reason ?? INTERACTION_SUPERSEDED_ERROR;
|
|
787
|
-
const supersededPermissions = opts.supersedePermissions(reason);
|
|
788
|
-
const supersededSelections = opts.supersedeSelections(reason);
|
|
789
|
-
const interruptedTurn = opts.turnInFlight;
|
|
790
|
-
const total = supersededPermissions + supersededSelections;
|
|
791
|
-
if (interruptedTurn) {
|
|
792
|
-
opts.abortActiveTurn();
|
|
793
|
-
}
|
|
794
|
-
if (total > 0 || interruptedTurn) {
|
|
795
|
-
const message = interruptedTurn ? "Current Codex task was canceled because a new user message arrived. Processing the latest message instead." : "Previous pending interaction was canceled because a new user message arrived. Processing the latest message instead.";
|
|
796
|
-
opts.onInterrupted(message);
|
|
797
|
-
}
|
|
798
|
-
return total > 0 || interruptedTurn;
|
|
799
|
-
}
|
|
800
778
|
async function codexRemoteLauncher(session) {
|
|
801
779
|
const messageBuffer = new MessageBuffer();
|
|
802
780
|
const hasTTY = process.stdout.isTTY && process.stdin.isTTY;
|
|
@@ -814,6 +792,9 @@ async function codexRemoteLauncher(session) {
|
|
|
814
792
|
let isResponseInProgress = false;
|
|
815
793
|
let taskStartedSent = false;
|
|
816
794
|
let shouldInjectHistoryOnNextSession = false;
|
|
795
|
+
let shouldCommitAccumulatedResponse = false;
|
|
796
|
+
let currentAssistantMessageId = null;
|
|
797
|
+
let currentThinkingMessageId = null;
|
|
817
798
|
const permissionHandler = new CodexPermissionHandler(session.client);
|
|
818
799
|
const selectionHandler = new CodexSelectionHandler(session.client);
|
|
819
800
|
const conversationHistory = new ConversationHistory({ maxMessages: 20, maxCharacters: 5e4 });
|
|
@@ -842,6 +823,9 @@ async function codexRemoteLauncher(session) {
|
|
|
842
823
|
accumulatedResponse = "";
|
|
843
824
|
isResponseInProgress = false;
|
|
844
825
|
taskStartedSent = false;
|
|
826
|
+
shouldCommitAccumulatedResponse = false;
|
|
827
|
+
currentAssistantMessageId = null;
|
|
828
|
+
currentThinkingMessageId = null;
|
|
845
829
|
session.onThinkingChange(false);
|
|
846
830
|
};
|
|
847
831
|
const abortActiveTurn = () => {
|
|
@@ -914,11 +898,17 @@ async function codexRemoteLauncher(session) {
|
|
|
914
898
|
return;
|
|
915
899
|
}
|
|
916
900
|
if (!isResponseInProgress) {
|
|
917
|
-
|
|
918
|
-
|
|
901
|
+
if (currentThinkingMessageId) {
|
|
902
|
+
messageBuffer.removeMessage(currentThinkingMessageId);
|
|
903
|
+
currentThinkingMessageId = null;
|
|
904
|
+
}
|
|
905
|
+
currentAssistantMessageId = messageBuffer.addMessage(text, "assistant");
|
|
919
906
|
isResponseInProgress = true;
|
|
920
907
|
} else {
|
|
921
|
-
messageBuffer.
|
|
908
|
+
const updated = currentAssistantMessageId ? messageBuffer.updateMessage(currentAssistantMessageId, text) : false;
|
|
909
|
+
if (!updated) {
|
|
910
|
+
currentAssistantMessageId = messageBuffer.addMessage(text, "assistant");
|
|
911
|
+
}
|
|
922
912
|
}
|
|
923
913
|
accumulatedResponse += text;
|
|
924
914
|
return;
|
|
@@ -933,8 +923,8 @@ async function codexRemoteLauncher(session) {
|
|
|
933
923
|
});
|
|
934
924
|
taskStartedSent = true;
|
|
935
925
|
}
|
|
936
|
-
if (!isResponseInProgress) {
|
|
937
|
-
messageBuffer.addMessage("Thinking...", "system");
|
|
926
|
+
if (!isResponseInProgress && !currentThinkingMessageId) {
|
|
927
|
+
currentThinkingMessageId = messageBuffer.addMessage("Thinking...", "system");
|
|
938
928
|
}
|
|
939
929
|
return;
|
|
940
930
|
}
|
|
@@ -1107,8 +1097,13 @@ async function codexRemoteLauncher(session) {
|
|
|
1107
1097
|
const thinkingText = typeof thinkingPayload?.text === "string" ? thinkingPayload.text : "";
|
|
1108
1098
|
if (thinkingText) {
|
|
1109
1099
|
reasoningProcessor.processDelta(thinkingText);
|
|
1110
|
-
if (!thinkingText.startsWith("**")) {
|
|
1111
|
-
|
|
1100
|
+
if (!thinkingText.startsWith("**") && !isResponseInProgress) {
|
|
1101
|
+
const preview = `[Thinking] ${thinkingText.substring(0, 100)}...`;
|
|
1102
|
+
if (currentThinkingMessageId) {
|
|
1103
|
+
messageBuffer.updateMessage(currentThinkingMessageId, preview, { mode: "replace" });
|
|
1104
|
+
} else {
|
|
1105
|
+
currentThinkingMessageId = messageBuffer.addMessage(preview, "system");
|
|
1106
|
+
}
|
|
1112
1107
|
}
|
|
1113
1108
|
}
|
|
1114
1109
|
}
|
|
@@ -1137,7 +1132,6 @@ async function codexRemoteLauncher(session) {
|
|
|
1137
1132
|
model: executionMode.model,
|
|
1138
1133
|
sandbox: executionMode.sandbox,
|
|
1139
1134
|
approvalPolicy: executionMode.approvalPolicy,
|
|
1140
|
-
mcpServers: {},
|
|
1141
1135
|
permissionHandler,
|
|
1142
1136
|
selectionHandler: {
|
|
1143
1137
|
handleSelection: (request) => selectionHandler.requestSelection(request)
|
|
@@ -1152,20 +1146,6 @@ async function codexRemoteLauncher(session) {
|
|
|
1152
1146
|
logger.debug("[Codex] Ignoring legacy switch request because Codex is ACP-only");
|
|
1153
1147
|
emitStatusMessage(message);
|
|
1154
1148
|
};
|
|
1155
|
-
session.setPendingInteractionSuperseder((reason = INTERACTION_SUPERSEDED_ERROR) => {
|
|
1156
|
-
return handleIncomingCodexMessageDuringRemoteTurn({
|
|
1157
|
-
reason,
|
|
1158
|
-
supersedePermissions: (value) => permissionHandler.supersedePendingRequests(value),
|
|
1159
|
-
supersedeSelections: (value) => selectionHandler.supersedePendingRequests(value),
|
|
1160
|
-
turnInFlight,
|
|
1161
|
-
abortActiveTurn,
|
|
1162
|
-
onInterrupted: (message) => {
|
|
1163
|
-
logger.debug("[Codex] Incoming user message interrupted ACP remote turn");
|
|
1164
|
-
messageBuffer.addMessage(message, "status");
|
|
1165
|
-
session.runtimeSession.sendSessionEvent({ type: "message", message });
|
|
1166
|
-
}
|
|
1167
|
-
});
|
|
1168
|
-
});
|
|
1169
1149
|
async function handleAbort() {
|
|
1170
1150
|
logger.debug("[Codex] Abort requested - stopping current task");
|
|
1171
1151
|
try {
|
|
@@ -1269,6 +1249,7 @@ async function codexRemoteLauncher(session) {
|
|
|
1269
1249
|
const turnSignal = abortController.signal;
|
|
1270
1250
|
try {
|
|
1271
1251
|
turnInFlight = true;
|
|
1252
|
+
shouldCommitAccumulatedResponse = false;
|
|
1272
1253
|
const activeBackend = backend ?? createBackend(message.mode);
|
|
1273
1254
|
if (!activeBackend) {
|
|
1274
1255
|
throw new Error("Failed to create Codex ACP backend");
|
|
@@ -1290,6 +1271,7 @@ async function codexRemoteLauncher(session) {
|
|
|
1290
1271
|
await activeBackend.sendPrompt(acpSessionId, promptToSend);
|
|
1291
1272
|
await waitForResponseCompleteWithAbort(activeBackend, turnSignal);
|
|
1292
1273
|
reasoningProcessor.completeCurrent();
|
|
1274
|
+
shouldCommitAccumulatedResponse = true;
|
|
1293
1275
|
shouldInjectHistoryOnNextSession = false;
|
|
1294
1276
|
} catch (error) {
|
|
1295
1277
|
logger.warn("Error in codex ACP session:", error);
|
|
@@ -1312,7 +1294,9 @@ async function codexRemoteLauncher(session) {
|
|
|
1312
1294
|
}
|
|
1313
1295
|
} finally {
|
|
1314
1296
|
turnInFlight = false;
|
|
1315
|
-
|
|
1297
|
+
if (shouldCommitAccumulatedResponse) {
|
|
1298
|
+
emitFinalAssistantMessage();
|
|
1299
|
+
}
|
|
1316
1300
|
if (!shouldExit) {
|
|
1317
1301
|
session.runtimeSession.sendCodexMessage({
|
|
1318
1302
|
type: "task_complete",
|
|
@@ -1337,7 +1321,6 @@ async function codexRemoteLauncher(session) {
|
|
|
1337
1321
|
await disposeBackend();
|
|
1338
1322
|
permissionHandler.reset();
|
|
1339
1323
|
selectionHandler.reset();
|
|
1340
|
-
session.setPendingInteractionSuperseder(null);
|
|
1341
1324
|
session.removeClientSwapCallback(handleClientSwap);
|
|
1342
1325
|
if (process.stdin.isTTY) {
|
|
1343
1326
|
try {
|
|
@@ -1409,9 +1392,6 @@ async function syncControlledByUserState(sessionClient, controlledByUser) {
|
|
|
1409
1392
|
}));
|
|
1410
1393
|
});
|
|
1411
1394
|
}
|
|
1412
|
-
function shouldSupersedeCodexPendingInteractions(opts) {
|
|
1413
|
-
return true;
|
|
1414
|
-
}
|
|
1415
1395
|
function resolveInitialCodexPermissionMode(opts) {
|
|
1416
1396
|
if (opts.permissionMode) {
|
|
1417
1397
|
return opts.permissionMode;
|
|
@@ -1518,13 +1498,6 @@ async function runCodex(opts) {
|
|
|
1518
1498
|
messageModel = message.meta.model || void 0;
|
|
1519
1499
|
currentModel = messageModel;
|
|
1520
1500
|
}
|
|
1521
|
-
if (shouldSupersedeCodexPendingInteractions({
|
|
1522
|
-
startingMode: opts.startingMode,
|
|
1523
|
-
currentMode: codexSession?.mode
|
|
1524
|
-
})) {
|
|
1525
|
-
logger.debug("[codex] Incoming user message superseding active remote interaction");
|
|
1526
|
-
codexSession?.supersedePendingInteractions(INTERACTION_SUPERSEDED_ERROR);
|
|
1527
|
-
}
|
|
1528
1501
|
messageQueue.push(message.content.text, {
|
|
1529
1502
|
permissionMode: permissionResolution.resolvedPermissionMode,
|
|
1530
1503
|
model: messageModel
|
|
@@ -1560,4 +1533,4 @@ async function runCodex(opts) {
|
|
|
1560
1533
|
}
|
|
1561
1534
|
}
|
|
1562
1535
|
|
|
1563
|
-
export { resolveIncomingCodexPermissionMode, resolveInitialCodexPermissionMode, resolveQueuedCodexPermissionMode, runCodex,
|
|
1536
|
+
export { resolveIncomingCodexPermissionMode, resolveInitialCodexPermissionMode, resolveQueuedCodexPermissionMode, runCodex, supportsAgentStateUpdateEvents, syncControlledByUserState };
|
|
@@ -1,11 +1,11 @@
|
|
|
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 BaseReasoningProcessor = require('./BaseReasoningProcessor-
|
|
8
|
-
var registerKillSessionHandler = require('./registerKillSessionHandler-
|
|
4
|
+
var api = require('./api-Dwkm7s_E.cjs');
|
|
5
|
+
var persistence = require('./persistence-hbhwAYIV.cjs');
|
|
6
|
+
var index = require('./index-CfqxEoyl.cjs');
|
|
7
|
+
var BaseReasoningProcessor = require('./BaseReasoningProcessor-DphULXS-.cjs');
|
|
8
|
+
var registerKillSessionHandler = require('./registerKillSessionHandler-D1ouN10n.cjs');
|
|
9
9
|
var React = require('react');
|
|
10
10
|
var ink = require('ink');
|
|
11
11
|
var happyProtocol = require('happy-protocol');
|
|
@@ -133,7 +133,6 @@ class CodexSession {
|
|
|
133
133
|
keepAliveInterval;
|
|
134
134
|
onModeChangeCallback;
|
|
135
135
|
clientSwapCallbacks = [];
|
|
136
|
-
supersedePendingInteractionsCallback = null;
|
|
137
136
|
constructor(opts) {
|
|
138
137
|
this.path = opts.path;
|
|
139
138
|
this.api = opts.api;
|
|
@@ -174,12 +173,6 @@ class CodexSession {
|
|
|
174
173
|
this.clientSwapCallbacks.splice(index, 1);
|
|
175
174
|
}
|
|
176
175
|
};
|
|
177
|
-
setPendingInteractionSuperseder = (callback) => {
|
|
178
|
-
this.supersedePendingInteractionsCallback = callback;
|
|
179
|
-
};
|
|
180
|
-
supersedePendingInteractions = (reason) => {
|
|
181
|
-
return this.supersedePendingInteractionsCallback?.(reason) ?? false;
|
|
182
|
-
};
|
|
183
176
|
onThinkingChange = (thinking) => {
|
|
184
177
|
this.thinking = thinking;
|
|
185
178
|
this.client.keepAlive(thinking, this.mode);
|
|
@@ -784,21 +777,6 @@ function registerCodexRemoteRpcHandlers(clientSession, handlers) {
|
|
|
784
777
|
clientSession.rpcHandlerManager.registerHandler("switch", handlers.handleSwitchToLocal);
|
|
785
778
|
registerKillSessionHandler.registerKillSessionHandler(clientSession.rpcHandlerManager, handlers.handleKillSession);
|
|
786
779
|
}
|
|
787
|
-
function handleIncomingCodexMessageDuringRemoteTurn(opts) {
|
|
788
|
-
const reason = opts.reason ?? BaseReasoningProcessor.INTERACTION_SUPERSEDED_ERROR;
|
|
789
|
-
const supersededPermissions = opts.supersedePermissions(reason);
|
|
790
|
-
const supersededSelections = opts.supersedeSelections(reason);
|
|
791
|
-
const interruptedTurn = opts.turnInFlight;
|
|
792
|
-
const total = supersededPermissions + supersededSelections;
|
|
793
|
-
if (interruptedTurn) {
|
|
794
|
-
opts.abortActiveTurn();
|
|
795
|
-
}
|
|
796
|
-
if (total > 0 || interruptedTurn) {
|
|
797
|
-
const message = interruptedTurn ? "Current Codex task was canceled because a new user message arrived. Processing the latest message instead." : "Previous pending interaction was canceled because a new user message arrived. Processing the latest message instead.";
|
|
798
|
-
opts.onInterrupted(message);
|
|
799
|
-
}
|
|
800
|
-
return total > 0 || interruptedTurn;
|
|
801
|
-
}
|
|
802
780
|
async function codexRemoteLauncher(session) {
|
|
803
781
|
const messageBuffer = new registerKillSessionHandler.MessageBuffer();
|
|
804
782
|
const hasTTY = process.stdout.isTTY && process.stdin.isTTY;
|
|
@@ -816,6 +794,9 @@ async function codexRemoteLauncher(session) {
|
|
|
816
794
|
let isResponseInProgress = false;
|
|
817
795
|
let taskStartedSent = false;
|
|
818
796
|
let shouldInjectHistoryOnNextSession = false;
|
|
797
|
+
let shouldCommitAccumulatedResponse = false;
|
|
798
|
+
let currentAssistantMessageId = null;
|
|
799
|
+
let currentThinkingMessageId = null;
|
|
819
800
|
const permissionHandler = new CodexPermissionHandler(session.client);
|
|
820
801
|
const selectionHandler = new CodexSelectionHandler(session.client);
|
|
821
802
|
const conversationHistory = new ConversationHistory({ maxMessages: 20, maxCharacters: 5e4 });
|
|
@@ -844,6 +825,9 @@ async function codexRemoteLauncher(session) {
|
|
|
844
825
|
accumulatedResponse = "";
|
|
845
826
|
isResponseInProgress = false;
|
|
846
827
|
taskStartedSent = false;
|
|
828
|
+
shouldCommitAccumulatedResponse = false;
|
|
829
|
+
currentAssistantMessageId = null;
|
|
830
|
+
currentThinkingMessageId = null;
|
|
847
831
|
session.onThinkingChange(false);
|
|
848
832
|
};
|
|
849
833
|
const abortActiveTurn = () => {
|
|
@@ -916,11 +900,17 @@ async function codexRemoteLauncher(session) {
|
|
|
916
900
|
return;
|
|
917
901
|
}
|
|
918
902
|
if (!isResponseInProgress) {
|
|
919
|
-
|
|
920
|
-
|
|
903
|
+
if (currentThinkingMessageId) {
|
|
904
|
+
messageBuffer.removeMessage(currentThinkingMessageId);
|
|
905
|
+
currentThinkingMessageId = null;
|
|
906
|
+
}
|
|
907
|
+
currentAssistantMessageId = messageBuffer.addMessage(text, "assistant");
|
|
921
908
|
isResponseInProgress = true;
|
|
922
909
|
} else {
|
|
923
|
-
messageBuffer.
|
|
910
|
+
const updated = currentAssistantMessageId ? messageBuffer.updateMessage(currentAssistantMessageId, text) : false;
|
|
911
|
+
if (!updated) {
|
|
912
|
+
currentAssistantMessageId = messageBuffer.addMessage(text, "assistant");
|
|
913
|
+
}
|
|
924
914
|
}
|
|
925
915
|
accumulatedResponse += text;
|
|
926
916
|
return;
|
|
@@ -935,8 +925,8 @@ async function codexRemoteLauncher(session) {
|
|
|
935
925
|
});
|
|
936
926
|
taskStartedSent = true;
|
|
937
927
|
}
|
|
938
|
-
if (!isResponseInProgress) {
|
|
939
|
-
messageBuffer.addMessage("Thinking...", "system");
|
|
928
|
+
if (!isResponseInProgress && !currentThinkingMessageId) {
|
|
929
|
+
currentThinkingMessageId = messageBuffer.addMessage("Thinking...", "system");
|
|
940
930
|
}
|
|
941
931
|
return;
|
|
942
932
|
}
|
|
@@ -1109,8 +1099,13 @@ async function codexRemoteLauncher(session) {
|
|
|
1109
1099
|
const thinkingText = typeof thinkingPayload?.text === "string" ? thinkingPayload.text : "";
|
|
1110
1100
|
if (thinkingText) {
|
|
1111
1101
|
reasoningProcessor.processDelta(thinkingText);
|
|
1112
|
-
if (!thinkingText.startsWith("**")) {
|
|
1113
|
-
|
|
1102
|
+
if (!thinkingText.startsWith("**") && !isResponseInProgress) {
|
|
1103
|
+
const preview = `[Thinking] ${thinkingText.substring(0, 100)}...`;
|
|
1104
|
+
if (currentThinkingMessageId) {
|
|
1105
|
+
messageBuffer.updateMessage(currentThinkingMessageId, preview, { mode: "replace" });
|
|
1106
|
+
} else {
|
|
1107
|
+
currentThinkingMessageId = messageBuffer.addMessage(preview, "system");
|
|
1108
|
+
}
|
|
1114
1109
|
}
|
|
1115
1110
|
}
|
|
1116
1111
|
}
|
|
@@ -1139,7 +1134,6 @@ async function codexRemoteLauncher(session) {
|
|
|
1139
1134
|
model: executionMode.model,
|
|
1140
1135
|
sandbox: executionMode.sandbox,
|
|
1141
1136
|
approvalPolicy: executionMode.approvalPolicy,
|
|
1142
|
-
mcpServers: {},
|
|
1143
1137
|
permissionHandler,
|
|
1144
1138
|
selectionHandler: {
|
|
1145
1139
|
handleSelection: (request) => selectionHandler.requestSelection(request)
|
|
@@ -1154,20 +1148,6 @@ async function codexRemoteLauncher(session) {
|
|
|
1154
1148
|
api.logger.debug("[Codex] Ignoring legacy switch request because Codex is ACP-only");
|
|
1155
1149
|
emitStatusMessage(message);
|
|
1156
1150
|
};
|
|
1157
|
-
session.setPendingInteractionSuperseder((reason = BaseReasoningProcessor.INTERACTION_SUPERSEDED_ERROR) => {
|
|
1158
|
-
return handleIncomingCodexMessageDuringRemoteTurn({
|
|
1159
|
-
reason,
|
|
1160
|
-
supersedePermissions: (value) => permissionHandler.supersedePendingRequests(value),
|
|
1161
|
-
supersedeSelections: (value) => selectionHandler.supersedePendingRequests(value),
|
|
1162
|
-
turnInFlight,
|
|
1163
|
-
abortActiveTurn,
|
|
1164
|
-
onInterrupted: (message) => {
|
|
1165
|
-
api.logger.debug("[Codex] Incoming user message interrupted ACP remote turn");
|
|
1166
|
-
messageBuffer.addMessage(message, "status");
|
|
1167
|
-
session.runtimeSession.sendSessionEvent({ type: "message", message });
|
|
1168
|
-
}
|
|
1169
|
-
});
|
|
1170
|
-
});
|
|
1171
1151
|
async function handleAbort() {
|
|
1172
1152
|
api.logger.debug("[Codex] Abort requested - stopping current task");
|
|
1173
1153
|
try {
|
|
@@ -1271,6 +1251,7 @@ async function codexRemoteLauncher(session) {
|
|
|
1271
1251
|
const turnSignal = abortController.signal;
|
|
1272
1252
|
try {
|
|
1273
1253
|
turnInFlight = true;
|
|
1254
|
+
shouldCommitAccumulatedResponse = false;
|
|
1274
1255
|
const activeBackend = backend ?? createBackend(message.mode);
|
|
1275
1256
|
if (!activeBackend) {
|
|
1276
1257
|
throw new Error("Failed to create Codex ACP backend");
|
|
@@ -1292,6 +1273,7 @@ async function codexRemoteLauncher(session) {
|
|
|
1292
1273
|
await activeBackend.sendPrompt(acpSessionId, promptToSend);
|
|
1293
1274
|
await waitForResponseCompleteWithAbort(activeBackend, turnSignal);
|
|
1294
1275
|
reasoningProcessor.completeCurrent();
|
|
1276
|
+
shouldCommitAccumulatedResponse = true;
|
|
1295
1277
|
shouldInjectHistoryOnNextSession = false;
|
|
1296
1278
|
} catch (error) {
|
|
1297
1279
|
api.logger.warn("Error in codex ACP session:", error);
|
|
@@ -1314,7 +1296,9 @@ async function codexRemoteLauncher(session) {
|
|
|
1314
1296
|
}
|
|
1315
1297
|
} finally {
|
|
1316
1298
|
turnInFlight = false;
|
|
1317
|
-
|
|
1299
|
+
if (shouldCommitAccumulatedResponse) {
|
|
1300
|
+
emitFinalAssistantMessage();
|
|
1301
|
+
}
|
|
1318
1302
|
if (!shouldExit) {
|
|
1319
1303
|
session.runtimeSession.sendCodexMessage({
|
|
1320
1304
|
type: "task_complete",
|
|
@@ -1339,7 +1323,6 @@ async function codexRemoteLauncher(session) {
|
|
|
1339
1323
|
await disposeBackend();
|
|
1340
1324
|
permissionHandler.reset();
|
|
1341
1325
|
selectionHandler.reset();
|
|
1342
|
-
session.setPendingInteractionSuperseder(null);
|
|
1343
1326
|
session.removeClientSwapCallback(handleClientSwap);
|
|
1344
1327
|
if (process.stdin.isTTY) {
|
|
1345
1328
|
try {
|
|
@@ -1411,9 +1394,6 @@ async function syncControlledByUserState(sessionClient, controlledByUser) {
|
|
|
1411
1394
|
}));
|
|
1412
1395
|
});
|
|
1413
1396
|
}
|
|
1414
|
-
function shouldSupersedeCodexPendingInteractions(opts) {
|
|
1415
|
-
return true;
|
|
1416
|
-
}
|
|
1417
1397
|
function resolveInitialCodexPermissionMode(opts) {
|
|
1418
1398
|
if (opts.permissionMode) {
|
|
1419
1399
|
return opts.permissionMode;
|
|
@@ -1520,13 +1500,6 @@ async function runCodex(opts) {
|
|
|
1520
1500
|
messageModel = message.meta.model || void 0;
|
|
1521
1501
|
currentModel = messageModel;
|
|
1522
1502
|
}
|
|
1523
|
-
if (shouldSupersedeCodexPendingInteractions({
|
|
1524
|
-
startingMode: opts.startingMode,
|
|
1525
|
-
currentMode: codexSession?.mode
|
|
1526
|
-
})) {
|
|
1527
|
-
api.logger.debug("[codex] Incoming user message superseding active remote interaction");
|
|
1528
|
-
codexSession?.supersedePendingInteractions(BaseReasoningProcessor.INTERACTION_SUPERSEDED_ERROR);
|
|
1529
|
-
}
|
|
1530
1503
|
messageQueue.push(message.content.text, {
|
|
1531
1504
|
permissionMode: permissionResolution.resolvedPermissionMode,
|
|
1532
1505
|
model: messageModel
|
|
@@ -1566,6 +1539,5 @@ exports.resolveIncomingCodexPermissionMode = resolveIncomingCodexPermissionMode;
|
|
|
1566
1539
|
exports.resolveInitialCodexPermissionMode = resolveInitialCodexPermissionMode;
|
|
1567
1540
|
exports.resolveQueuedCodexPermissionMode = resolveQueuedCodexPermissionMode;
|
|
1568
1541
|
exports.runCodex = runCodex;
|
|
1569
|
-
exports.shouldSupersedeCodexPendingInteractions = shouldSupersedeCodexPendingInteractions;
|
|
1570
1542
|
exports.supportsAgentStateUpdateEvents = supportsAgentStateUpdateEvents;
|
|
1571
1543
|
exports.syncControlledByUserState = syncControlledByUserState;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useStdout, useInput, Box, Text, render } from 'ink';
|
|
2
2
|
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
3
3
|
import { randomUUID } from 'node:crypto';
|
|
4
|
-
import { l as logger, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-
|
|
5
|
-
import { readSettings } from './persistence-
|
|
6
|
-
import { B as BasePermissionHandler, a as BaseReasoningProcessor, c as createSessionMetadata, s as setupOfflineReconnection } from './BaseReasoningProcessor-
|
|
7
|
-
import { i as initialMachineMetadata, n as notifyDaemonSessionStarted, g as getInitialGeminiModel, r as readGeminiLocalConfig, G as GEMINI_MODEL_ENV, s as saveGeminiModelToConfig, a as createGeminiBackend, b as stopCaffeinate } from './index-
|
|
8
|
-
import { M as MessageQueue2, h as hashObject, a as MessageBuffer, r as registerKillSessionHandler } from './registerKillSessionHandler-
|
|
4
|
+
import { l as logger, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-dwwHBzLc.mjs';
|
|
5
|
+
import { readSettings } from './persistence-Dg-rxY2a.mjs';
|
|
6
|
+
import { B as BasePermissionHandler, a as BaseReasoningProcessor, c as createSessionMetadata, s as setupOfflineReconnection } from './BaseReasoningProcessor-ClrT-x-H.mjs';
|
|
7
|
+
import { i as initialMachineMetadata, n as notifyDaemonSessionStarted, g as getInitialGeminiModel, r as readGeminiLocalConfig, G as GEMINI_MODEL_ENV, s as saveGeminiModelToConfig, a as createGeminiBackend, b as stopCaffeinate } from './index-HyqLXzw-.mjs';
|
|
8
|
+
import { M as MessageQueue2, h as hashObject, a as MessageBuffer, r as registerKillSessionHandler } from './registerKillSessionHandler-BAvk4GYO.mjs';
|
|
9
9
|
import { attachToolHappierMetaV2, resolveCanonicalToolNameV2, inferToolResultError } from 'happy-protocol';
|
|
10
10
|
import 'axios';
|
|
11
11
|
import 'chalk';
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
var ink = require('ink');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var node_crypto = require('node:crypto');
|
|
6
|
-
var api = require('./api-
|
|
7
|
-
var persistence = require('./persistence-
|
|
8
|
-
var BaseReasoningProcessor = require('./BaseReasoningProcessor-
|
|
9
|
-
var index = require('./index-
|
|
10
|
-
var registerKillSessionHandler = require('./registerKillSessionHandler-
|
|
6
|
+
var api = require('./api-Dwkm7s_E.cjs');
|
|
7
|
+
var persistence = require('./persistence-hbhwAYIV.cjs');
|
|
8
|
+
var BaseReasoningProcessor = require('./BaseReasoningProcessor-DphULXS-.cjs');
|
|
9
|
+
var index = require('./index-CfqxEoyl.cjs');
|
|
10
|
+
var registerKillSessionHandler = require('./registerKillSessionHandler-D1ouN10n.cjs');
|
|
11
11
|
var happyProtocol = require('happy-protocol');
|
|
12
12
|
require('axios');
|
|
13
13
|
require('chalk');
|