happy-imou-cloud 2.1.47 → 2.1.49
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-KXIi0QF_.mjs → BaseReasoningProcessor-CAVeOdyo.mjs} +2 -2
- package/dist/{BaseReasoningProcessor-CBbzF7oj.cjs → BaseReasoningProcessor-Dn9NcoHz.cjs} +2 -2
- package/dist/{ProviderSelectionHandler-CJLlwlAu.cjs → ProviderSelectionHandler-BJJc7qOR.cjs} +2 -2
- package/dist/{ProviderSelectionHandler-DzYObYrV.mjs → ProviderSelectionHandler-DIYidT13.mjs} +2 -2
- package/dist/{api-CVuTajTL.cjs → api-D7nAeZi7.cjs} +3 -3
- package/dist/{api-D3vYIva3.mjs → api-DnqaNvyV.mjs} +3 -3
- package/dist/{command-fcJ-4Yq3.mjs → command-CzfRRhVe.mjs} +2 -2
- package/dist/{command-BZRQuZsh.cjs → command-VcH4hbhi.cjs} +2 -2
- package/dist/{index-Cp1I5I3U.mjs → index-7Z93BoVn.mjs} +378 -33
- package/dist/{index-CyW9A7hx.cjs → index-xa1kwZoj.cjs} +377 -32
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.cts +88 -86
- package/dist/lib.d.mts +88 -86
- package/dist/lib.mjs +1 -1
- package/dist/{registerKillSessionHandler-8C_Wrgor.cjs → registerKillSessionHandler-CfCya6si.cjs} +2 -2
- package/dist/{registerKillSessionHandler-OhhMUuCQ.mjs → registerKillSessionHandler-DLDg2EES.mjs} +2 -2
- package/dist/{runClaude-CfdT_ccS.cjs → runClaude-BBGNmGj6.cjs} +4 -4
- package/dist/{runClaude-BviM1Wl5.mjs → runClaude-zCwRhpOw.mjs} +4 -4
- package/dist/{runCodex-Dx3osc7U.mjs → runCodex-BbgLVjb9.mjs} +80 -11
- package/dist/{runCodex-B-t0yy4k.cjs → runCodex-jUU6U2tZ.cjs} +80 -11
- package/dist/{runGemini-DZ5-uzB9.cjs → runGemini-C0NT8MHK.cjs} +4 -4
- package/dist/{runGemini-CnJ75Q--.mjs → runGemini-DcwNsudA.mjs} +4 -4
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { p as preserveSessionRuntimeMetadata, l as logger, h as hashObject, d as AssistantMessageStream, b as connectionState, A as ApiClient } from './api-
|
|
2
|
-
import { B as BasePermissionHandler, d as MessageBuffer, C as ConversationHistory$1, f as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, h as finalizeHappyOrgTurnWithBusinessAck, i as buildTurnResultPushNotification, c as registerKillSessionHandler, j as buildReadyPushNotification, l as launchRuntimeHandleWithFactoryResult, t as createSessionTranscriptInkRenderer, k as extractPermissionRequestPushContext, m as buildPermissionPushNotification, n as renderTerminalOutputPreview, p as prepareTerminalOutputForForwarding, o as inferToolResultError, q as forwardAgentMessageToProviderSession, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, r as resolveHappyOrgQueuedTurn, s as syncControlledByUserState } from './registerKillSessionHandler-
|
|
3
|
-
import { f as formatDisplayMessage, v as validateCodexAcpSpawn, h as createCodexBackend, A as AcpBackend, t as truncateDisplayMessage, b as closeProviderSession, e as stopCaffeinate, i as resolveCodexExecutable, j as shouldUseShellForCodex, F as Future, k as readManagedSessionTag, l as resolveManagedSessionTag } from './index-
|
|
1
|
+
import { p as preserveSessionRuntimeMetadata, l as logger, h as hashObject, d as AssistantMessageStream, b as connectionState, A as ApiClient } from './api-DnqaNvyV.mjs';
|
|
2
|
+
import { B as BasePermissionHandler, d as MessageBuffer, C as ConversationHistory$1, f as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, h as finalizeHappyOrgTurnWithBusinessAck, i as buildTurnResultPushNotification, c as registerKillSessionHandler, j as buildReadyPushNotification, l as launchRuntimeHandleWithFactoryResult, t as createSessionTranscriptInkRenderer, k as extractPermissionRequestPushContext, m as buildPermissionPushNotification, n as renderTerminalOutputPreview, p as prepareTerminalOutputForForwarding, o as inferToolResultError, q as forwardAgentMessageToProviderSession, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, r as resolveHappyOrgQueuedTurn, s as syncControlledByUserState } from './registerKillSessionHandler-DLDg2EES.mjs';
|
|
3
|
+
import { f as formatDisplayMessage, v as validateCodexAcpSpawn, h as createCodexBackend, A as AcpBackend, t as truncateDisplayMessage, b as closeProviderSession, e as stopCaffeinate, i as resolveCodexExecutable, j as shouldUseShellForCodex, F as Future, k as readManagedSessionTag, l as resolveManagedSessionTag } from './index-7Z93BoVn.mjs';
|
|
4
4
|
import 'cross-spawn';
|
|
5
5
|
import '@agentclientprotocol/sdk';
|
|
6
6
|
import { randomUUID } from 'node:crypto';
|
|
@@ -24,8 +24,8 @@ import 'tweetnacl';
|
|
|
24
24
|
import 'open';
|
|
25
25
|
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
26
26
|
import { useStdout, useInput, Box, Text, render } from 'ink';
|
|
27
|
-
import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-
|
|
28
|
-
import { B as BaseReasoningProcessor, b as bootstrapManagedProviderSession } from './BaseReasoningProcessor-
|
|
27
|
+
import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-DIYidT13.mjs';
|
|
28
|
+
import { B as BaseReasoningProcessor, b as bootstrapManagedProviderSession } from './BaseReasoningProcessor-CAVeOdyo.mjs';
|
|
29
29
|
import 'zod';
|
|
30
30
|
import 'socket.io-client';
|
|
31
31
|
import 'expo-server-sdk';
|
|
@@ -610,7 +610,13 @@ function extractFirstRelevantStderrLine(stderrText) {
|
|
|
610
610
|
return lines[0] ?? null;
|
|
611
611
|
}
|
|
612
612
|
function looksLikeUpstreamApiError(searchableLower) {
|
|
613
|
-
return searchableLower.includes("upstream") || searchableLower.includes("rate limit") || searchableLower.includes("429") || searchableLower.includes("quota") || searchableLower.includes("insufficient_quota") || searchableLower.includes("unauthorized") || searchableLower.includes("forbidden");
|
|
613
|
+
return searchableLower.includes("upstream") || searchableLower.includes("rate limit") || searchableLower.includes("429") || searchableLower.includes("503") || searchableLower.includes("service unavailable") || searchableLower.includes("temporarily unavailable") || searchableLower.includes("quota") || searchableLower.includes("insufficient_quota") || searchableLower.includes("unauthorized") || searchableLower.includes("forbidden");
|
|
614
|
+
}
|
|
615
|
+
function appendCodexAuthScopeHint(message, searchableLower) {
|
|
616
|
+
if (!searchableLower.includes("api.responses.write") && !searchableLower.includes("missing scopes") && !searchableLower.includes("insufficient permissions")) {
|
|
617
|
+
return message;
|
|
618
|
+
}
|
|
619
|
+
return `${message} Happy hint: the Codex credential used by this process cannot call the OpenAI Responses API. Use an OpenAI key/OAuth login with api.responses.write, or remove restricted OPENAI_API_KEY values from the daemon/profile environment and restart the Happy daemon.`;
|
|
614
620
|
}
|
|
615
621
|
function extractLocalProcessExit(error) {
|
|
616
622
|
const record = typeof error === "object" && error !== null ? error : null;
|
|
@@ -711,12 +717,14 @@ function normalizeCodexBackendError(error) {
|
|
|
711
717
|
}
|
|
712
718
|
if (typeof record?.message === "string" && record.message.trim().toLowerCase() === "internal error" && dataText) {
|
|
713
719
|
if (looksLikeUpstreamApiError(dataText.toLowerCase())) {
|
|
714
|
-
|
|
720
|
+
const message = prefix ? `Codex upstream API error ${prefix} ${dataText}` : `Codex upstream API error: ${dataText}`;
|
|
721
|
+
return appendCodexAuthScopeHint(message, dataText.toLowerCase());
|
|
715
722
|
}
|
|
716
723
|
return prefix ? `${prefix} ${dataText}` : dataText;
|
|
717
724
|
}
|
|
718
725
|
if (looksLikeUpstreamApiError(searchableLower) && text) {
|
|
719
|
-
|
|
726
|
+
const message = prefix ? `Codex upstream API error ${prefix} ${text}` : `Codex upstream API error: ${text}`;
|
|
727
|
+
return appendCodexAuthScopeHint(message, searchableLower);
|
|
720
728
|
}
|
|
721
729
|
if (error instanceof Error && text) {
|
|
722
730
|
return text;
|
|
@@ -753,6 +761,12 @@ function hasRenderableToolPayload(value) {
|
|
|
753
761
|
}
|
|
754
762
|
return true;
|
|
755
763
|
}
|
|
764
|
+
function isUserCancellationStop(detail) {
|
|
765
|
+
if (typeof detail !== "string") {
|
|
766
|
+
return false;
|
|
767
|
+
}
|
|
768
|
+
return /cancelled by user|canceled by user/i.test(detail);
|
|
769
|
+
}
|
|
756
770
|
function getCodexSwitchToLocalUnavailableMessage() {
|
|
757
771
|
return "Codex local mode requires an attached interactive terminal. Staying in remote mode.";
|
|
758
772
|
}
|
|
@@ -1029,6 +1043,9 @@ async function codexRemoteLauncher(session) {
|
|
|
1029
1043
|
}
|
|
1030
1044
|
if (msg.status === "idle" || msg.status === "stopped") {
|
|
1031
1045
|
reasoningProcessor.completeCurrent();
|
|
1046
|
+
if (msg.status === "stopped" && isUserCancellationStop(msg.detail)) {
|
|
1047
|
+
return;
|
|
1048
|
+
}
|
|
1032
1049
|
if (msg.status === "stopped" && !turnInFlight && !shouldSwitchToLocal) {
|
|
1033
1050
|
void recoverUnexpectedRuntimeStop(msg.detail);
|
|
1034
1051
|
}
|
|
@@ -1204,6 +1221,10 @@ async function codexRemoteLauncher(session) {
|
|
|
1204
1221
|
};
|
|
1205
1222
|
async function handleAbort() {
|
|
1206
1223
|
logger.debug("[Codex] Abort requested - stopping current task");
|
|
1224
|
+
if (!turnInFlight) {
|
|
1225
|
+
logger.debug("[Codex] Abort requested while no Codex turn is active; ignoring");
|
|
1226
|
+
return;
|
|
1227
|
+
}
|
|
1207
1228
|
try {
|
|
1208
1229
|
abortActiveTurn();
|
|
1209
1230
|
} catch (error) {
|
|
@@ -1892,6 +1913,50 @@ function installFatalProcessHandlers(options) {
|
|
|
1892
1913
|
};
|
|
1893
1914
|
}
|
|
1894
1915
|
|
|
1916
|
+
function normalizeResumeSessionId(value) {
|
|
1917
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
|
|
1918
|
+
}
|
|
1919
|
+
function normalizeCodexArgsForHappy(options) {
|
|
1920
|
+
const sourceArgs = options.codexArgs ?? [];
|
|
1921
|
+
const codexArgs = [];
|
|
1922
|
+
let resumeSessionId = normalizeResumeSessionId(options.resumeSessionId);
|
|
1923
|
+
for (let index = 0; index < sourceArgs.length; index += 1) {
|
|
1924
|
+
const arg = sourceArgs[index];
|
|
1925
|
+
if (arg === "--resume") {
|
|
1926
|
+
const nextArg = sourceArgs[index + 1];
|
|
1927
|
+
const normalizedNextArg = normalizeResumeSessionId(nextArg);
|
|
1928
|
+
if (!normalizedNextArg || nextArg?.startsWith("-")) {
|
|
1929
|
+
throw new Error("Codex --resume requires a provider session id when used through Happy.");
|
|
1930
|
+
}
|
|
1931
|
+
resumeSessionId ??= normalizedNextArg;
|
|
1932
|
+
index += 1;
|
|
1933
|
+
continue;
|
|
1934
|
+
}
|
|
1935
|
+
if (arg.startsWith("--resume=")) {
|
|
1936
|
+
const normalizedValue = normalizeResumeSessionId(arg.slice("--resume=".length));
|
|
1937
|
+
if (!normalizedValue) {
|
|
1938
|
+
throw new Error("Codex --resume requires a provider session id when used through Happy.");
|
|
1939
|
+
}
|
|
1940
|
+
resumeSessionId ??= normalizedValue;
|
|
1941
|
+
continue;
|
|
1942
|
+
}
|
|
1943
|
+
if (index === 0 && arg === "resume") {
|
|
1944
|
+
const nextArg = sourceArgs[index + 1];
|
|
1945
|
+
const normalizedNextArg = normalizeResumeSessionId(nextArg);
|
|
1946
|
+
if (normalizedNextArg && !nextArg?.startsWith("-")) {
|
|
1947
|
+
resumeSessionId ??= normalizedNextArg;
|
|
1948
|
+
index += 1;
|
|
1949
|
+
continue;
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
codexArgs.push(arg);
|
|
1953
|
+
}
|
|
1954
|
+
return {
|
|
1955
|
+
codexArgs,
|
|
1956
|
+
resumeSessionId
|
|
1957
|
+
};
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1895
1960
|
function resolveInitialCodexPermissionMode(opts) {
|
|
1896
1961
|
if (opts.permissionMode) {
|
|
1897
1962
|
return opts.permissionMode;
|
|
@@ -1927,6 +1992,10 @@ function resolveIncomingCodexPermissionMode(opts) {
|
|
|
1927
1992
|
};
|
|
1928
1993
|
}
|
|
1929
1994
|
async function runCodex(opts) {
|
|
1995
|
+
const normalizedArgs = normalizeCodexArgsForHappy({
|
|
1996
|
+
codexArgs: opts.codexArgs,
|
|
1997
|
+
resumeSessionId: opts.resumeSessionId
|
|
1998
|
+
});
|
|
1930
1999
|
const managedSessionTag = opts.startedBy === "daemon" ? readManagedSessionTag() : null;
|
|
1931
2000
|
const sessionTag = managedSessionTag ?? resolveManagedSessionTag(
|
|
1932
2001
|
opts.startedBy === "daemon" ? process.env : {}
|
|
@@ -1937,7 +2006,7 @@ async function runCodex(opts) {
|
|
|
1937
2006
|
permissionMode: opts.permissionMode,
|
|
1938
2007
|
startedBy: opts.startedBy,
|
|
1939
2008
|
startingMode: requestedStartingMode,
|
|
1940
|
-
codexArgs:
|
|
2009
|
+
codexArgs: normalizedArgs.codexArgs
|
|
1941
2010
|
});
|
|
1942
2011
|
const preserveCurrentPermissionModeForRemoteDefault = opts.startedBy === "daemon" && requestedStartingMode === "remote";
|
|
1943
2012
|
if (opts.startedBy === "daemon" && requestedStartingMode === "local") {
|
|
@@ -2033,10 +2102,10 @@ async function runCodex(opts) {
|
|
|
2033
2102
|
path: metadata.path,
|
|
2034
2103
|
logPath: logger.logFilePath,
|
|
2035
2104
|
startupRolePrompt: happyOrgStartupBinding?.identityPrompt ?? null,
|
|
2036
|
-
sessionId:
|
|
2105
|
+
sessionId: normalizedArgs.resumeSessionId,
|
|
2037
2106
|
mode: requestedStartingMode,
|
|
2038
2107
|
messageQueue,
|
|
2039
|
-
codexArgs:
|
|
2108
|
+
codexArgs: normalizedArgs.codexArgs,
|
|
2040
2109
|
protocolDescriptor,
|
|
2041
2110
|
protocolStateSources: userScopedObserver ? [userScopedObserver] : [],
|
|
2042
2111
|
userObserver: userScopedObserver,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var persistence = require('./api-
|
|
4
|
-
var registerKillSessionHandler = require('./registerKillSessionHandler-
|
|
5
|
-
var index = require('./index-
|
|
3
|
+
var persistence = require('./api-D7nAeZi7.cjs');
|
|
4
|
+
var registerKillSessionHandler = require('./registerKillSessionHandler-CfCya6si.cjs');
|
|
5
|
+
var index = require('./index-xa1kwZoj.cjs');
|
|
6
6
|
require('cross-spawn');
|
|
7
7
|
require('@agentclientprotocol/sdk');
|
|
8
8
|
var node_crypto = require('node:crypto');
|
|
@@ -26,8 +26,8 @@ require('tweetnacl');
|
|
|
26
26
|
require('open');
|
|
27
27
|
var React = require('react');
|
|
28
28
|
var ink = require('ink');
|
|
29
|
-
var ProviderSelectionHandler = require('./ProviderSelectionHandler-
|
|
30
|
-
var BaseReasoningProcessor = require('./BaseReasoningProcessor-
|
|
29
|
+
var ProviderSelectionHandler = require('./ProviderSelectionHandler-BJJc7qOR.cjs');
|
|
30
|
+
var BaseReasoningProcessor = require('./BaseReasoningProcessor-Dn9NcoHz.cjs');
|
|
31
31
|
require('zod');
|
|
32
32
|
require('socket.io-client');
|
|
33
33
|
require('expo-server-sdk');
|
|
@@ -612,7 +612,13 @@ function extractFirstRelevantStderrLine(stderrText) {
|
|
|
612
612
|
return lines[0] ?? null;
|
|
613
613
|
}
|
|
614
614
|
function looksLikeUpstreamApiError(searchableLower) {
|
|
615
|
-
return searchableLower.includes("upstream") || searchableLower.includes("rate limit") || searchableLower.includes("429") || searchableLower.includes("quota") || searchableLower.includes("insufficient_quota") || searchableLower.includes("unauthorized") || searchableLower.includes("forbidden");
|
|
615
|
+
return searchableLower.includes("upstream") || searchableLower.includes("rate limit") || searchableLower.includes("429") || searchableLower.includes("503") || searchableLower.includes("service unavailable") || searchableLower.includes("temporarily unavailable") || searchableLower.includes("quota") || searchableLower.includes("insufficient_quota") || searchableLower.includes("unauthorized") || searchableLower.includes("forbidden");
|
|
616
|
+
}
|
|
617
|
+
function appendCodexAuthScopeHint(message, searchableLower) {
|
|
618
|
+
if (!searchableLower.includes("api.responses.write") && !searchableLower.includes("missing scopes") && !searchableLower.includes("insufficient permissions")) {
|
|
619
|
+
return message;
|
|
620
|
+
}
|
|
621
|
+
return `${message} Happy hint: the Codex credential used by this process cannot call the OpenAI Responses API. Use an OpenAI key/OAuth login with api.responses.write, or remove restricted OPENAI_API_KEY values from the daemon/profile environment and restart the Happy daemon.`;
|
|
616
622
|
}
|
|
617
623
|
function extractLocalProcessExit(error) {
|
|
618
624
|
const record = typeof error === "object" && error !== null ? error : null;
|
|
@@ -713,12 +719,14 @@ function normalizeCodexBackendError(error) {
|
|
|
713
719
|
}
|
|
714
720
|
if (typeof record?.message === "string" && record.message.trim().toLowerCase() === "internal error" && dataText) {
|
|
715
721
|
if (looksLikeUpstreamApiError(dataText.toLowerCase())) {
|
|
716
|
-
|
|
722
|
+
const message = prefix ? `Codex upstream API error ${prefix} ${dataText}` : `Codex upstream API error: ${dataText}`;
|
|
723
|
+
return appendCodexAuthScopeHint(message, dataText.toLowerCase());
|
|
717
724
|
}
|
|
718
725
|
return prefix ? `${prefix} ${dataText}` : dataText;
|
|
719
726
|
}
|
|
720
727
|
if (looksLikeUpstreamApiError(searchableLower) && text) {
|
|
721
|
-
|
|
728
|
+
const message = prefix ? `Codex upstream API error ${prefix} ${text}` : `Codex upstream API error: ${text}`;
|
|
729
|
+
return appendCodexAuthScopeHint(message, searchableLower);
|
|
722
730
|
}
|
|
723
731
|
if (error instanceof Error && text) {
|
|
724
732
|
return text;
|
|
@@ -755,6 +763,12 @@ function hasRenderableToolPayload(value) {
|
|
|
755
763
|
}
|
|
756
764
|
return true;
|
|
757
765
|
}
|
|
766
|
+
function isUserCancellationStop(detail) {
|
|
767
|
+
if (typeof detail !== "string") {
|
|
768
|
+
return false;
|
|
769
|
+
}
|
|
770
|
+
return /cancelled by user|canceled by user/i.test(detail);
|
|
771
|
+
}
|
|
758
772
|
function getCodexSwitchToLocalUnavailableMessage() {
|
|
759
773
|
return "Codex local mode requires an attached interactive terminal. Staying in remote mode.";
|
|
760
774
|
}
|
|
@@ -1031,6 +1045,9 @@ async function codexRemoteLauncher(session) {
|
|
|
1031
1045
|
}
|
|
1032
1046
|
if (msg.status === "idle" || msg.status === "stopped") {
|
|
1033
1047
|
reasoningProcessor.completeCurrent();
|
|
1048
|
+
if (msg.status === "stopped" && isUserCancellationStop(msg.detail)) {
|
|
1049
|
+
return;
|
|
1050
|
+
}
|
|
1034
1051
|
if (msg.status === "stopped" && !turnInFlight && !shouldSwitchToLocal) {
|
|
1035
1052
|
void recoverUnexpectedRuntimeStop(msg.detail);
|
|
1036
1053
|
}
|
|
@@ -1206,6 +1223,10 @@ async function codexRemoteLauncher(session) {
|
|
|
1206
1223
|
};
|
|
1207
1224
|
async function handleAbort() {
|
|
1208
1225
|
persistence.logger.debug("[Codex] Abort requested - stopping current task");
|
|
1226
|
+
if (!turnInFlight) {
|
|
1227
|
+
persistence.logger.debug("[Codex] Abort requested while no Codex turn is active; ignoring");
|
|
1228
|
+
return;
|
|
1229
|
+
}
|
|
1209
1230
|
try {
|
|
1210
1231
|
abortActiveTurn();
|
|
1211
1232
|
} catch (error) {
|
|
@@ -1894,6 +1915,50 @@ function installFatalProcessHandlers(options) {
|
|
|
1894
1915
|
};
|
|
1895
1916
|
}
|
|
1896
1917
|
|
|
1918
|
+
function normalizeResumeSessionId(value) {
|
|
1919
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
|
|
1920
|
+
}
|
|
1921
|
+
function normalizeCodexArgsForHappy(options) {
|
|
1922
|
+
const sourceArgs = options.codexArgs ?? [];
|
|
1923
|
+
const codexArgs = [];
|
|
1924
|
+
let resumeSessionId = normalizeResumeSessionId(options.resumeSessionId);
|
|
1925
|
+
for (let index = 0; index < sourceArgs.length; index += 1) {
|
|
1926
|
+
const arg = sourceArgs[index];
|
|
1927
|
+
if (arg === "--resume") {
|
|
1928
|
+
const nextArg = sourceArgs[index + 1];
|
|
1929
|
+
const normalizedNextArg = normalizeResumeSessionId(nextArg);
|
|
1930
|
+
if (!normalizedNextArg || nextArg?.startsWith("-")) {
|
|
1931
|
+
throw new Error("Codex --resume requires a provider session id when used through Happy.");
|
|
1932
|
+
}
|
|
1933
|
+
resumeSessionId ??= normalizedNextArg;
|
|
1934
|
+
index += 1;
|
|
1935
|
+
continue;
|
|
1936
|
+
}
|
|
1937
|
+
if (arg.startsWith("--resume=")) {
|
|
1938
|
+
const normalizedValue = normalizeResumeSessionId(arg.slice("--resume=".length));
|
|
1939
|
+
if (!normalizedValue) {
|
|
1940
|
+
throw new Error("Codex --resume requires a provider session id when used through Happy.");
|
|
1941
|
+
}
|
|
1942
|
+
resumeSessionId ??= normalizedValue;
|
|
1943
|
+
continue;
|
|
1944
|
+
}
|
|
1945
|
+
if (index === 0 && arg === "resume") {
|
|
1946
|
+
const nextArg = sourceArgs[index + 1];
|
|
1947
|
+
const normalizedNextArg = normalizeResumeSessionId(nextArg);
|
|
1948
|
+
if (normalizedNextArg && !nextArg?.startsWith("-")) {
|
|
1949
|
+
resumeSessionId ??= normalizedNextArg;
|
|
1950
|
+
index += 1;
|
|
1951
|
+
continue;
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
codexArgs.push(arg);
|
|
1955
|
+
}
|
|
1956
|
+
return {
|
|
1957
|
+
codexArgs,
|
|
1958
|
+
resumeSessionId
|
|
1959
|
+
};
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1897
1962
|
function resolveInitialCodexPermissionMode(opts) {
|
|
1898
1963
|
if (opts.permissionMode) {
|
|
1899
1964
|
return opts.permissionMode;
|
|
@@ -1929,6 +1994,10 @@ function resolveIncomingCodexPermissionMode(opts) {
|
|
|
1929
1994
|
};
|
|
1930
1995
|
}
|
|
1931
1996
|
async function runCodex(opts) {
|
|
1997
|
+
const normalizedArgs = normalizeCodexArgsForHappy({
|
|
1998
|
+
codexArgs: opts.codexArgs,
|
|
1999
|
+
resumeSessionId: opts.resumeSessionId
|
|
2000
|
+
});
|
|
1932
2001
|
const managedSessionTag = opts.startedBy === "daemon" ? index.readManagedSessionTag() : null;
|
|
1933
2002
|
const sessionTag = managedSessionTag ?? index.resolveManagedSessionTag(
|
|
1934
2003
|
opts.startedBy === "daemon" ? process.env : {}
|
|
@@ -1939,7 +2008,7 @@ async function runCodex(opts) {
|
|
|
1939
2008
|
permissionMode: opts.permissionMode,
|
|
1940
2009
|
startedBy: opts.startedBy,
|
|
1941
2010
|
startingMode: requestedStartingMode,
|
|
1942
|
-
codexArgs:
|
|
2011
|
+
codexArgs: normalizedArgs.codexArgs
|
|
1943
2012
|
});
|
|
1944
2013
|
const preserveCurrentPermissionModeForRemoteDefault = opts.startedBy === "daemon" && requestedStartingMode === "remote";
|
|
1945
2014
|
if (opts.startedBy === "daemon" && requestedStartingMode === "local") {
|
|
@@ -2035,10 +2104,10 @@ async function runCodex(opts) {
|
|
|
2035
2104
|
path: metadata.path,
|
|
2036
2105
|
logPath: persistence.logger.logFilePath,
|
|
2037
2106
|
startupRolePrompt: happyOrgStartupBinding?.identityPrompt ?? null,
|
|
2038
|
-
sessionId:
|
|
2107
|
+
sessionId: normalizedArgs.resumeSessionId,
|
|
2039
2108
|
mode: requestedStartingMode,
|
|
2040
2109
|
messageQueue,
|
|
2041
|
-
codexArgs:
|
|
2110
|
+
codexArgs: normalizedArgs.codexArgs,
|
|
2042
2111
|
protocolDescriptor,
|
|
2043
2112
|
protocolStateSources: userScopedObserver ? [userScopedObserver] : [],
|
|
2044
2113
|
userObserver: userScopedObserver,
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
var ink = require('ink');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var node_crypto = require('node:crypto');
|
|
6
|
-
var persistence = require('./api-
|
|
7
|
-
var registerKillSessionHandler = require('./registerKillSessionHandler-
|
|
8
|
-
var index = require('./index-
|
|
9
|
-
var BaseReasoningProcessor = require('./BaseReasoningProcessor-
|
|
6
|
+
var persistence = require('./api-D7nAeZi7.cjs');
|
|
7
|
+
var registerKillSessionHandler = require('./registerKillSessionHandler-CfCya6si.cjs');
|
|
8
|
+
var index = require('./index-xa1kwZoj.cjs');
|
|
9
|
+
var BaseReasoningProcessor = require('./BaseReasoningProcessor-Dn9NcoHz.cjs');
|
|
10
10
|
require('cross-spawn');
|
|
11
11
|
require('@agentclientprotocol/sdk');
|
|
12
12
|
require('ps-list');
|
|
@@ -1,10 +1,10 @@
|
|
|
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, h as hashObject, d as AssistantMessageStream } from './api-
|
|
5
|
-
import { B as BasePermissionHandler, C as ConversationHistory$1, r as resolveHappyOrgQueuedTurn, e as ensureManagedProviderMachine, M as MissingMachineIdError, s as syncControlledByUserState, b as MessageQueue2, c as registerKillSessionHandler, d as MessageBuffer, f as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, h as finalizeHappyOrgTurnWithBusinessAck, i as buildTurnResultPushNotification, j as buildReadyPushNotification, l as launchRuntimeHandleWithFactoryResult, k as extractPermissionRequestPushContext, m as buildPermissionPushNotification, n as renderTerminalOutputPreview, p as prepareTerminalOutputForForwarding, o as inferToolResultError, q as forwardAgentMessageToProviderSession, t as createSessionTranscriptInkRenderer } from './registerKillSessionHandler-
|
|
6
|
-
import { g as getInitialGeminiModel, r as readGeminiLocalConfig, G as GEMINI_MODEL_ENV, b as closeProviderSession, s as saveGeminiModelToConfig, d as createGeminiBackend, e as stopCaffeinate } from './index-
|
|
7
|
-
import { B as BaseReasoningProcessor, b as bootstrapManagedProviderSession } from './BaseReasoningProcessor-
|
|
4
|
+
import { l as logger, b as connectionState, A as ApiClient, h as hashObject, d as AssistantMessageStream } from './api-DnqaNvyV.mjs';
|
|
5
|
+
import { B as BasePermissionHandler, C as ConversationHistory$1, r as resolveHappyOrgQueuedTurn, e as ensureManagedProviderMachine, M as MissingMachineIdError, s as syncControlledByUserState, b as MessageQueue2, c as registerKillSessionHandler, d as MessageBuffer, f as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, h as finalizeHappyOrgTurnWithBusinessAck, i as buildTurnResultPushNotification, j as buildReadyPushNotification, l as launchRuntimeHandleWithFactoryResult, k as extractPermissionRequestPushContext, m as buildPermissionPushNotification, n as renderTerminalOutputPreview, p as prepareTerminalOutputForForwarding, o as inferToolResultError, q as forwardAgentMessageToProviderSession, t as createSessionTranscriptInkRenderer } from './registerKillSessionHandler-DLDg2EES.mjs';
|
|
6
|
+
import { g as getInitialGeminiModel, r as readGeminiLocalConfig, G as GEMINI_MODEL_ENV, b as closeProviderSession, s as saveGeminiModelToConfig, d as createGeminiBackend, e as stopCaffeinate } from './index-7Z93BoVn.mjs';
|
|
7
|
+
import { B as BaseReasoningProcessor, b as bootstrapManagedProviderSession } from './BaseReasoningProcessor-CAVeOdyo.mjs';
|
|
8
8
|
import 'cross-spawn';
|
|
9
9
|
import '@agentclientprotocol/sdk';
|
|
10
10
|
import 'ps-list';
|