happy-imou-cloud 2.0.13 → 2.0.14

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.
Files changed (30) hide show
  1. package/dist/BaseReasoningProcessor-CB7luAdI.mjs +320 -0
  2. package/dist/BaseReasoningProcessor-Cwhs4PwS.cjs +323 -0
  3. package/dist/ProviderSelectionHandler-CmDe9yDh.cjs +265 -0
  4. package/dist/ProviderSelectionHandler-DnnCwXqU.mjs +261 -0
  5. package/dist/{api-D1meoL-9.mjs → api-Bad69WzY.mjs} +2 -2
  6. package/dist/{api-DH5-IqeM.cjs → api-CaqY_2x_.cjs} +2 -2
  7. package/dist/{command-CMvWClny.mjs → command-D9ZaQZQN.mjs} +4 -3
  8. package/dist/{command-Ch8Dgidj.cjs → command-DkVbAV9p.cjs} +4 -3
  9. package/dist/{index-Cxrx9m5D.mjs → index-naa51zV7.mjs} +1102 -50
  10. package/dist/{index-CryJfCh5.cjs → index-oxTpdQx2.cjs} +1106 -50
  11. package/dist/index.cjs +5 -4
  12. package/dist/index.mjs +5 -4
  13. package/dist/lib.cjs +1 -1
  14. package/dist/lib.mjs +1 -1
  15. package/dist/{persistence-9Iu0wGNM.mjs → persistence-4BmGePWc.mjs} +1 -1
  16. package/dist/{persistence-Bl3FYvwd.cjs → persistence-Byr0hWCR.cjs} +1 -1
  17. package/dist/{registerKillSessionHandler-BjkY-oUn.cjs → registerKillSessionHandler-CodtiIoq.cjs} +549 -4
  18. package/dist/{registerKillSessionHandler-BElGmD1E.mjs → registerKillSessionHandler-HO4ql8g-.mjs} +541 -5
  19. package/dist/{runClaude-CDZxAF3l.cjs → runClaude-C3UNcGqk.cjs} +583 -747
  20. package/dist/{runClaude-D7dF4RDM.mjs → runClaude-Ev-A-kLN.mjs} +575 -738
  21. package/dist/{runCodex-DnGz1XES.mjs → runCodex-BwFOTxMW.mjs} +9 -215
  22. package/dist/{runCodex-Cik8VzFs.cjs → runCodex-CNM6wz69.cjs} +20 -226
  23. package/dist/{runGemini-B8tXMHeL.mjs → runGemini-CXctVflO.mjs} +8 -7
  24. package/dist/{runGemini-BM2BQ4I7.cjs → runGemini-DqfqSBsP.cjs} +16 -15
  25. package/package.json +1 -1
  26. package/scripts/release-smoke.mjs +6 -5
  27. package/dist/ConversationHistory-V3VLmjJf.cjs +0 -868
  28. package/dist/ConversationHistory-_ciJNIgH.mjs +0 -856
  29. package/dist/createKeepAliveController-C5cQlDRr.mjs +0 -51
  30. package/dist/createKeepAliveController-DO8H6d5E.cjs +0 -54
@@ -1,7 +1,7 @@
1
1
  import { randomUUID } from 'node:crypto';
2
- import { l as logger, b as connectionState, A as ApiClient } from './api-D1meoL-9.mjs';
3
- import { h as hashObject, b as MessageBuffer, r as registerKillSessionHandler, c as closeProviderSession, e as ensureManagedProviderMachine, M as MissingMachineIdError, a as MessageQueue2, s as syncControlledByUserState } from './registerKillSessionHandler-BElGmD1E.mjs';
4
- import { f as formatDisplayMessage, v as validateCodexAcpSpawn, d as createCodexBackend, t as truncateDisplayMessage, b as stopCaffeinate } from './index-Cxrx9m5D.mjs';
2
+ import { l as logger, b as connectionState, A as ApiClient } from './api-Bad69WzY.mjs';
3
+ import { B as BasePermissionHandler, h as hashObject, d as MessageBuffer, C as ConversationHistory$1, w as waitForResponseCompleteWithAbort, r as registerKillSessionHandler, l as launchRuntimeHandleWithFactoryResult, i as inferToolResultError, j as forwardAgentMessageToProviderSession, f as closeProviderSession, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, s as syncControlledByUserState } from './registerKillSessionHandler-HO4ql8g-.mjs';
4
+ import { f as formatDisplayMessage, v as validateCodexAcpSpawn, d as createCodexBackend, t as truncateDisplayMessage, b as stopCaffeinate } from './index-naa51zV7.mjs';
5
5
  import 'cross-spawn';
6
6
  import '@agentclientprotocol/sdk';
7
7
  import 'ps-list';
@@ -12,11 +12,12 @@ import 'child_process';
12
12
  import 'node:fs';
13
13
  import 'node:path';
14
14
  import 'node:os';
15
- import './persistence-9Iu0wGNM.mjs';
15
+ import 'node:child_process';
16
+ import 'node:readline';
17
+ import './persistence-4BmGePWc.mjs';
16
18
  import 'node:fs/promises';
17
19
  import 'fs/promises';
18
20
  import 'crypto';
19
- import 'node:child_process';
20
21
  import 'chalk';
21
22
  import 'node:events';
22
23
  import 'axios';
@@ -24,8 +25,8 @@ import 'tweetnacl';
24
25
  import 'open';
25
26
  import React, { useState, useRef, useEffect, useCallback } from 'react';
26
27
  import { useStdout, useInput, Box, Text, render } from 'ink';
27
- import { c as createKeepAliveController, r as runModeLoop } from './createKeepAliveController-C5cQlDRr.mjs';
28
- import { B as BasePermissionHandler, g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, c as INTERACTION_TIMED_OUT_ERROR, a as BaseReasoningProcessor, C as ConversationHistory$1, w as waitForResponseCompleteWithAbort, l as launchRuntimeHandleWithFactoryResult, i as inferToolResultError, f as forwardAgentMessageToProviderSession, b as bootstrapManagedProviderSession } from './ConversationHistory-_ciJNIgH.mjs';
28
+ import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-DnnCwXqU.mjs';
29
+ import { B as BaseReasoningProcessor, b as bootstrapManagedProviderSession } from './BaseReasoningProcessor-CB7luAdI.mjs';
29
30
  import 'socket.io-client';
30
31
  import 'zod';
31
32
  import 'expo-server-sdk';
@@ -36,9 +37,9 @@ import 'node:module';
36
37
  import 'url';
37
38
  import 'fastify';
38
39
  import 'fastify-type-provider-zod';
39
- import 'node:readline';
40
40
  import 'http';
41
41
  import 'util';
42
+ import 'node:url';
42
43
 
43
44
  const DEFAULT_CAPABILITIES = {
44
45
  committedMessageAcks: false,
@@ -333,213 +334,6 @@ class CodexPermissionHandler extends BasePermissionHandler {
333
334
  }
334
335
  }
335
336
 
336
- class ProviderSelectionHandler {
337
- pendingRequests = /* @__PURE__ */ new Map();
338
- session;
339
- providerLabel;
340
- constructor(session, providerLabel) {
341
- this.session = session;
342
- this.providerLabel = providerLabel;
343
- this.setupRpcHandler();
344
- }
345
- updateSession(newSession) {
346
- this.session = newSession;
347
- this.setupRpcHandler();
348
- }
349
- async requestSelection(request) {
350
- return new Promise((resolve, reject) => {
351
- const pending = {
352
- resolve,
353
- reject,
354
- request
355
- };
356
- pending.timeoutHandle = setTimeout(() => {
357
- this.handleSelectionTimeout(request.id, pending);
358
- }, getPendingInteractionTimeoutMs());
359
- this.pendingRequests.set(request.id, pending);
360
- this.session.updateAgentState((currentState) => ({
361
- ...currentState,
362
- requests: {
363
- ...currentState.requests,
364
- [request.id]: {
365
- tool: "AskUserQuestion",
366
- arguments: {
367
- requestKind: "selection",
368
- questions: [
369
- {
370
- header: this.providerLabel,
371
- question: request.message,
372
- multiSelect: false,
373
- options: request.options.map((option) => ({
374
- label: option.label,
375
- description: option.description || option.optionId,
376
- optionId: option.optionId
377
- }))
378
- }
379
- ]
380
- },
381
- createdAt: Date.now(),
382
- requestKind: "selection",
383
- options: request.options,
384
- defaultOptionId: request.defaultOptionId
385
- }
386
- }
387
- }));
388
- logger.debug(`[${this.providerLabel}] Selection request sent (${request.id}) with ${request.options.length} options`);
389
- });
390
- }
391
- hasPendingRequests() {
392
- return this.pendingRequests.size > 0;
393
- }
394
- supersedePendingRequests(reason = INTERACTION_SUPERSEDED_ERROR) {
395
- const pendingSnapshot = Array.from(this.pendingRequests.entries());
396
- if (pendingSnapshot.length === 0) {
397
- return 0;
398
- }
399
- this.pendingRequests.clear();
400
- const completedAt = Date.now();
401
- for (const [, pending] of pendingSnapshot) {
402
- this.clearPendingRequestTimeout(pending);
403
- pending.reject(new Error(reason));
404
- }
405
- this.session.updateAgentState((currentState) => {
406
- const requests = { ...currentState.requests || {} };
407
- const completedRequests = { ...currentState.completedRequests || {} };
408
- for (const [id, request] of Object.entries(requests)) {
409
- if (request.requestKind !== "selection") {
410
- continue;
411
- }
412
- completedRequests[id] = {
413
- ...request,
414
- completedAt,
415
- status: "canceled",
416
- reason,
417
- requestKind: "selection"
418
- };
419
- delete requests[id];
420
- }
421
- return {
422
- ...currentState,
423
- requests,
424
- completedRequests
425
- };
426
- });
427
- logger.debug(`[${this.providerLabel}] Superseded ${pendingSnapshot.length} pending selection request(s)`);
428
- return pendingSnapshot.length;
429
- }
430
- reset(reason = "Session reset") {
431
- const pendingSnapshot = Array.from(this.pendingRequests.entries());
432
- this.pendingRequests.clear();
433
- for (const [, pending] of pendingSnapshot) {
434
- this.clearPendingRequestTimeout(pending);
435
- pending.reject(new Error(reason));
436
- }
437
- this.session.updateAgentState((currentState) => {
438
- const requests = { ...currentState.requests || {} };
439
- const completedRequests = { ...currentState.completedRequests || {} };
440
- for (const [id, request] of Object.entries(requests)) {
441
- if (request.requestKind !== "selection") {
442
- continue;
443
- }
444
- completedRequests[id] = {
445
- ...request,
446
- completedAt: Date.now(),
447
- status: "canceled",
448
- reason,
449
- requestKind: "selection"
450
- };
451
- delete requests[id];
452
- }
453
- return {
454
- ...currentState,
455
- requests,
456
- completedRequests
457
- };
458
- });
459
- }
460
- setupRpcHandler() {
461
- this.session.rpcHandlerManager.registerHandler("selection", async (response) => {
462
- const pending = this.pendingRequests.get(response.id);
463
- if (!pending) {
464
- logger.debug(`[${this.providerLabel}] Selection request not found or already resolved`);
465
- return;
466
- }
467
- this.pendingRequests.delete(response.id);
468
- this.clearPendingRequestTimeout(pending);
469
- pending.resolve(response);
470
- this.session.updateAgentState((currentState) => {
471
- const request = currentState.requests?.[response.id];
472
- if (!request) {
473
- return currentState;
474
- }
475
- const { [response.id]: _, ...remainingRequests } = currentState.requests || {};
476
- return {
477
- ...currentState,
478
- requests: remainingRequests,
479
- completedRequests: {
480
- ...currentState.completedRequests,
481
- [response.id]: {
482
- ...request,
483
- completedAt: Date.now(),
484
- status: "approved",
485
- requestKind: "selection",
486
- selectedOptionId: response.optionId
487
- }
488
- }
489
- };
490
- });
491
- });
492
- }
493
- clearPendingRequestTimeout(pending) {
494
- if (pending?.timeoutHandle) {
495
- clearTimeout(pending.timeoutHandle);
496
- pending.timeoutHandle = void 0;
497
- }
498
- }
499
- handleSelectionTimeout(requestId, pending) {
500
- const active = this.pendingRequests.get(requestId);
501
- if (!active || active !== pending) {
502
- return;
503
- }
504
- this.pendingRequests.delete(requestId);
505
- this.clearPendingRequestTimeout(active);
506
- active.reject(new Error(INTERACTION_TIMED_OUT_ERROR));
507
- this.session.updateAgentState((currentState) => {
508
- const request = currentState.requests?.[requestId] || {
509
- tool: "AskUserQuestion",
510
- arguments: {
511
- requestKind: "selection",
512
- questions: []
513
- },
514
- createdAt: Date.now(),
515
- requestKind: "selection",
516
- options: active.request.options,
517
- defaultOptionId: active.request.defaultOptionId
518
- };
519
- const { [requestId]: _, ...remainingRequests } = currentState.requests || {};
520
- return {
521
- ...currentState,
522
- requests: remainingRequests,
523
- completedRequests: {
524
- ...currentState.completedRequests,
525
- [requestId]: {
526
- ...request,
527
- completedAt: Date.now(),
528
- status: "canceled",
529
- reason: INTERACTION_TIMED_OUT_ERROR,
530
- requestKind: "selection"
531
- }
532
- }
533
- };
534
- });
535
- this.session.sendSessionEvent({
536
- type: "message",
537
- message: "Pending interaction timed out waiting for a response. Send a new message to continue."
538
- });
539
- logger.debug(`[${this.providerLabel}] Selection request timed out (${requestId})`);
540
- }
541
- }
542
-
543
337
  class CodexSelectionHandler extends ProviderSelectionHandler {
544
338
  constructor(session) {
545
339
  super(session, "Codex");
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  var node_crypto = require('node:crypto');
4
- var api = require('./api-DH5-IqeM.cjs');
5
- var registerKillSessionHandler = require('./registerKillSessionHandler-BjkY-oUn.cjs');
6
- var index = require('./index-CryJfCh5.cjs');
4
+ var api = require('./api-CaqY_2x_.cjs');
5
+ var registerKillSessionHandler = require('./registerKillSessionHandler-CodtiIoq.cjs');
6
+ var index = require('./index-oxTpdQx2.cjs');
7
7
  require('cross-spawn');
8
8
  require('@agentclientprotocol/sdk');
9
9
  require('ps-list');
@@ -14,11 +14,12 @@ require('child_process');
14
14
  require('node:fs');
15
15
  require('node:path');
16
16
  require('node:os');
17
- require('./persistence-Bl3FYvwd.cjs');
17
+ require('node:child_process');
18
+ require('node:readline');
19
+ require('./persistence-Byr0hWCR.cjs');
18
20
  require('node:fs/promises');
19
21
  require('fs/promises');
20
22
  require('crypto');
21
- require('node:child_process');
22
23
  require('chalk');
23
24
  require('node:events');
24
25
  require('axios');
@@ -26,8 +27,8 @@ require('tweetnacl');
26
27
  require('open');
27
28
  var React = require('react');
28
29
  var ink = require('ink');
29
- var createKeepAliveController = require('./createKeepAliveController-DO8H6d5E.cjs');
30
- var ConversationHistory = require('./ConversationHistory-V3VLmjJf.cjs');
30
+ var ProviderSelectionHandler = require('./ProviderSelectionHandler-CmDe9yDh.cjs');
31
+ var BaseReasoningProcessor = require('./BaseReasoningProcessor-Cwhs4PwS.cjs');
31
32
  require('socket.io-client');
32
33
  require('zod');
33
34
  require('expo-server-sdk');
@@ -38,9 +39,9 @@ require('node:module');
38
39
  require('url');
39
40
  require('fastify');
40
41
  require('fastify-type-provider-zod');
41
- require('node:readline');
42
42
  require('http');
43
43
  require('util');
44
+ require('node:url');
44
45
 
45
46
  const DEFAULT_CAPABILITIES = {
46
47
  committedMessageAcks: false,
@@ -146,7 +147,7 @@ class CodexSession {
146
147
  this.queue = opts.messageQueue;
147
148
  this.codexArgs = opts.codexArgs;
148
149
  this.onModeChangeCallback = opts.onModeChange;
149
- this.keepAliveController = createKeepAliveController.createKeepAliveController({
150
+ this.keepAliveController = ProviderSelectionHandler.createKeepAliveController({
150
151
  initialMode: this.mode,
151
152
  initialThinking: this.thinking,
152
153
  send: (thinking, mode) => {
@@ -316,7 +317,7 @@ const CodexDisplay = ({ messageBuffer, logPath, onExit, title }) => {
316
317
  ));
317
318
  };
318
319
 
319
- class CodexPermissionHandler extends ConversationHistory.BasePermissionHandler {
320
+ class CodexPermissionHandler extends registerKillSessionHandler.BasePermissionHandler {
320
321
  constructor(session) {
321
322
  super(session);
322
323
  }
@@ -335,220 +336,13 @@ class CodexPermissionHandler extends ConversationHistory.BasePermissionHandler {
335
336
  }
336
337
  }
337
338
 
338
- class ProviderSelectionHandler {
339
- pendingRequests = /* @__PURE__ */ new Map();
340
- session;
341
- providerLabel;
342
- constructor(session, providerLabel) {
343
- this.session = session;
344
- this.providerLabel = providerLabel;
345
- this.setupRpcHandler();
346
- }
347
- updateSession(newSession) {
348
- this.session = newSession;
349
- this.setupRpcHandler();
350
- }
351
- async requestSelection(request) {
352
- return new Promise((resolve, reject) => {
353
- const pending = {
354
- resolve,
355
- reject,
356
- request
357
- };
358
- pending.timeoutHandle = setTimeout(() => {
359
- this.handleSelectionTimeout(request.id, pending);
360
- }, ConversationHistory.getPendingInteractionTimeoutMs());
361
- this.pendingRequests.set(request.id, pending);
362
- this.session.updateAgentState((currentState) => ({
363
- ...currentState,
364
- requests: {
365
- ...currentState.requests,
366
- [request.id]: {
367
- tool: "AskUserQuestion",
368
- arguments: {
369
- requestKind: "selection",
370
- questions: [
371
- {
372
- header: this.providerLabel,
373
- question: request.message,
374
- multiSelect: false,
375
- options: request.options.map((option) => ({
376
- label: option.label,
377
- description: option.description || option.optionId,
378
- optionId: option.optionId
379
- }))
380
- }
381
- ]
382
- },
383
- createdAt: Date.now(),
384
- requestKind: "selection",
385
- options: request.options,
386
- defaultOptionId: request.defaultOptionId
387
- }
388
- }
389
- }));
390
- api.logger.debug(`[${this.providerLabel}] Selection request sent (${request.id}) with ${request.options.length} options`);
391
- });
392
- }
393
- hasPendingRequests() {
394
- return this.pendingRequests.size > 0;
395
- }
396
- supersedePendingRequests(reason = ConversationHistory.INTERACTION_SUPERSEDED_ERROR) {
397
- const pendingSnapshot = Array.from(this.pendingRequests.entries());
398
- if (pendingSnapshot.length === 0) {
399
- return 0;
400
- }
401
- this.pendingRequests.clear();
402
- const completedAt = Date.now();
403
- for (const [, pending] of pendingSnapshot) {
404
- this.clearPendingRequestTimeout(pending);
405
- pending.reject(new Error(reason));
406
- }
407
- this.session.updateAgentState((currentState) => {
408
- const requests = { ...currentState.requests || {} };
409
- const completedRequests = { ...currentState.completedRequests || {} };
410
- for (const [id, request] of Object.entries(requests)) {
411
- if (request.requestKind !== "selection") {
412
- continue;
413
- }
414
- completedRequests[id] = {
415
- ...request,
416
- completedAt,
417
- status: "canceled",
418
- reason,
419
- requestKind: "selection"
420
- };
421
- delete requests[id];
422
- }
423
- return {
424
- ...currentState,
425
- requests,
426
- completedRequests
427
- };
428
- });
429
- api.logger.debug(`[${this.providerLabel}] Superseded ${pendingSnapshot.length} pending selection request(s)`);
430
- return pendingSnapshot.length;
431
- }
432
- reset(reason = "Session reset") {
433
- const pendingSnapshot = Array.from(this.pendingRequests.entries());
434
- this.pendingRequests.clear();
435
- for (const [, pending] of pendingSnapshot) {
436
- this.clearPendingRequestTimeout(pending);
437
- pending.reject(new Error(reason));
438
- }
439
- this.session.updateAgentState((currentState) => {
440
- const requests = { ...currentState.requests || {} };
441
- const completedRequests = { ...currentState.completedRequests || {} };
442
- for (const [id, request] of Object.entries(requests)) {
443
- if (request.requestKind !== "selection") {
444
- continue;
445
- }
446
- completedRequests[id] = {
447
- ...request,
448
- completedAt: Date.now(),
449
- status: "canceled",
450
- reason,
451
- requestKind: "selection"
452
- };
453
- delete requests[id];
454
- }
455
- return {
456
- ...currentState,
457
- requests,
458
- completedRequests
459
- };
460
- });
461
- }
462
- setupRpcHandler() {
463
- this.session.rpcHandlerManager.registerHandler("selection", async (response) => {
464
- const pending = this.pendingRequests.get(response.id);
465
- if (!pending) {
466
- api.logger.debug(`[${this.providerLabel}] Selection request not found or already resolved`);
467
- return;
468
- }
469
- this.pendingRequests.delete(response.id);
470
- this.clearPendingRequestTimeout(pending);
471
- pending.resolve(response);
472
- this.session.updateAgentState((currentState) => {
473
- const request = currentState.requests?.[response.id];
474
- if (!request) {
475
- return currentState;
476
- }
477
- const { [response.id]: _, ...remainingRequests } = currentState.requests || {};
478
- return {
479
- ...currentState,
480
- requests: remainingRequests,
481
- completedRequests: {
482
- ...currentState.completedRequests,
483
- [response.id]: {
484
- ...request,
485
- completedAt: Date.now(),
486
- status: "approved",
487
- requestKind: "selection",
488
- selectedOptionId: response.optionId
489
- }
490
- }
491
- };
492
- });
493
- });
494
- }
495
- clearPendingRequestTimeout(pending) {
496
- if (pending?.timeoutHandle) {
497
- clearTimeout(pending.timeoutHandle);
498
- pending.timeoutHandle = void 0;
499
- }
500
- }
501
- handleSelectionTimeout(requestId, pending) {
502
- const active = this.pendingRequests.get(requestId);
503
- if (!active || active !== pending) {
504
- return;
505
- }
506
- this.pendingRequests.delete(requestId);
507
- this.clearPendingRequestTimeout(active);
508
- active.reject(new Error(ConversationHistory.INTERACTION_TIMED_OUT_ERROR));
509
- this.session.updateAgentState((currentState) => {
510
- const request = currentState.requests?.[requestId] || {
511
- tool: "AskUserQuestion",
512
- arguments: {
513
- requestKind: "selection",
514
- questions: []
515
- },
516
- createdAt: Date.now(),
517
- requestKind: "selection",
518
- options: active.request.options,
519
- defaultOptionId: active.request.defaultOptionId
520
- };
521
- const { [requestId]: _, ...remainingRequests } = currentState.requests || {};
522
- return {
523
- ...currentState,
524
- requests: remainingRequests,
525
- completedRequests: {
526
- ...currentState.completedRequests,
527
- [requestId]: {
528
- ...request,
529
- completedAt: Date.now(),
530
- status: "canceled",
531
- reason: ConversationHistory.INTERACTION_TIMED_OUT_ERROR,
532
- requestKind: "selection"
533
- }
534
- }
535
- };
536
- });
537
- this.session.sendSessionEvent({
538
- type: "message",
539
- message: "Pending interaction timed out waiting for a response. Send a new message to continue."
540
- });
541
- api.logger.debug(`[${this.providerLabel}] Selection request timed out (${requestId})`);
542
- }
543
- }
544
-
545
- class CodexSelectionHandler extends ProviderSelectionHandler {
339
+ class CodexSelectionHandler extends ProviderSelectionHandler.ProviderSelectionHandler {
546
340
  constructor(session) {
547
341
  super(session, "Codex");
548
342
  }
549
343
  }
550
344
 
551
- class ReasoningProcessor extends ConversationHistory.BaseReasoningProcessor {
345
+ class ReasoningProcessor extends BaseReasoningProcessor.BaseReasoningProcessor {
552
346
  getToolName() {
553
347
  return "CodexReasoning";
554
348
  }
@@ -699,7 +493,7 @@ async function codexRemoteLauncher(session) {
699
493
  let currentThinkingMessageId = null;
700
494
  const permissionHandler = new CodexPermissionHandler(session.client);
701
495
  const selectionHandler = new CodexSelectionHandler(session.client);
702
- const conversationHistory = new ConversationHistory.ConversationHistory({ maxMessages: 20, maxCharacters: 5e4 });
496
+ const conversationHistory = new registerKillSessionHandler.ConversationHistory({ maxMessages: 20, maxCharacters: 5e4 });
703
497
  const reasoningProcessor = new ReasoningProcessor((message) => {
704
498
  session.runtimeSession.sendCodexMessage(message);
705
499
  });
@@ -793,7 +587,7 @@ async function codexRemoteLauncher(session) {
793
587
  };
794
588
  const setupRuntimeMessageHandler = (activeRuntimeHandle) => {
795
589
  const forwardAgentMessage = (agentMessage) => {
796
- ConversationHistory.forwardAgentMessageToProviderSession(agentMessage, {
590
+ registerKillSessionHandler.forwardAgentMessageToProviderSession(agentMessage, {
797
591
  provider: "codex",
798
592
  send: (body) => session.runtimeSession.sendCodexMessage(body),
799
593
  toolResultType: "tool-call-result"
@@ -859,7 +653,7 @@ async function codexRemoteLauncher(session) {
859
653
  return;
860
654
  }
861
655
  case "tool-result": {
862
- const isError = ConversationHistory.inferToolResultError(msg.result);
656
+ const isError = registerKillSessionHandler.inferToolResultError(msg.result);
863
657
  const resultText = index.truncateDisplayMessage(msg.result, 200) || (isError ? "Unknown error" : "");
864
658
  messageBuffer.addMessage(
865
659
  `${isError ? "Error:" : "Result:"} ${resultText}`.trim(),
@@ -946,7 +740,7 @@ async function codexRemoteLauncher(session) {
946
740
  if (!validation.ok) {
947
741
  throw new Error(validation.errorMessage);
948
742
  }
949
- const { session: nextRuntimeHandle } = await ConversationHistory.launchRuntimeHandleWithFactoryResult({
743
+ const { session: nextRuntimeHandle } = await registerKillSessionHandler.launchRuntimeHandleWithFactoryResult({
950
744
  provider: "codex",
951
745
  cwd: session.path,
952
746
  createBackendResult: (opts) => index.createCodexBackend({
@@ -1081,7 +875,7 @@ async function codexRemoteLauncher(session) {
1081
875
  }
1082
876
  conversationHistory.addUserMessage(message.message);
1083
877
  await activeRuntimeHandle.sendPrompt(promptToSend);
1084
- await ConversationHistory.waitForResponseCompleteWithAbort(activeRuntimeHandle.backend, turnSignal);
878
+ await registerKillSessionHandler.waitForResponseCompleteWithAbort(activeRuntimeHandle.backend, turnSignal);
1085
879
  reasoningProcessor.completeCurrent();
1086
880
  shouldCommitAccumulatedResponse = true;
1087
881
  shouldInjectHistoryOnNextSession = false;
@@ -1166,7 +960,7 @@ async function codexLoop(opts) {
1166
960
  await codexRemoteLauncher(opts.session);
1167
961
  return { type: "exit", value: 0 };
1168
962
  };
1169
- return await createKeepAliveController.runModeLoop({
963
+ return await ProviderSelectionHandler.runModeLoop({
1170
964
  startingMode: displayMode,
1171
965
  notifyInitialMode: true,
1172
966
  onModeChange: async (mode) => {
@@ -1232,7 +1026,7 @@ async function runCodex(opts) {
1232
1026
  }
1233
1027
  let sessionClient;
1234
1028
  let codexSession = null;
1235
- const { metadata, session: initialSession, reconnectionHandle } = await ConversationHistory.bootstrapManagedProviderSession({
1029
+ const { metadata, session: initialSession, reconnectionHandle } = await BaseReasoningProcessor.bootstrapManagedProviderSession({
1236
1030
  api: api$1,
1237
1031
  sessionTag,
1238
1032
  flavor: "codex",
@@ -1,24 +1,25 @@
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 } from './api-D1meoL-9.mjs';
5
- import { e as ensureManagedProviderMachine, M as MissingMachineIdError, s as syncControlledByUserState, a as MessageQueue2, h as hashObject, b as MessageBuffer, r as registerKillSessionHandler, c as closeProviderSession } from './registerKillSessionHandler-BElGmD1E.mjs';
6
- import { g as getInitialGeminiModel, r as readGeminiLocalConfig, G as GEMINI_MODEL_ENV, s as saveGeminiModelToConfig, a as createGeminiBackend, b as stopCaffeinate } from './index-Cxrx9m5D.mjs';
7
- import { B as BasePermissionHandler, a as BaseReasoningProcessor, C as ConversationHistory$1, b as bootstrapManagedProviderSession, w as waitForResponseCompleteWithAbort, l as launchRuntimeHandleWithFactoryResult, i as inferToolResultError, f as forwardAgentMessageToProviderSession } from './ConversationHistory-_ciJNIgH.mjs';
4
+ import { l as logger, b as connectionState, A as ApiClient } from './api-Bad69WzY.mjs';
5
+ import { B as BasePermissionHandler, C as ConversationHistory$1, e as ensureManagedProviderMachine, M as MissingMachineIdError, s as syncControlledByUserState, b as MessageQueue2, h as hashObject, d as MessageBuffer, r as registerKillSessionHandler, w as waitForResponseCompleteWithAbort, f as closeProviderSession, l as launchRuntimeHandleWithFactoryResult, i as inferToolResultError, j as forwardAgentMessageToProviderSession } from './registerKillSessionHandler-HO4ql8g-.mjs';
6
+ import { g as getInitialGeminiModel, r as readGeminiLocalConfig, G as GEMINI_MODEL_ENV, s as saveGeminiModelToConfig, a as createGeminiBackend, b as stopCaffeinate } from './index-naa51zV7.mjs';
7
+ import { B as BaseReasoningProcessor, b as bootstrapManagedProviderSession } from './BaseReasoningProcessor-CB7luAdI.mjs';
8
8
  import 'cross-spawn';
9
9
  import '@agentclientprotocol/sdk';
10
10
  import 'ps-list';
11
11
  import 'node:fs';
12
12
  import 'node:path';
13
13
  import 'node:os';
14
+ import 'node:child_process';
15
+ import 'node:readline';
14
16
  import 'tweetnacl';
15
17
  import 'axios';
16
- import './persistence-9Iu0wGNM.mjs';
18
+ import './persistence-4BmGePWc.mjs';
17
19
  import 'open';
18
20
  import 'chalk';
19
21
  import 'fs';
20
22
  import 'path';
21
- import 'node:child_process';
22
23
  import 'child_process';
23
24
  import 'node:events';
24
25
  import 'socket.io-client';
@@ -35,9 +36,9 @@ import 'node:module';
35
36
  import 'url';
36
37
  import 'fastify';
37
38
  import 'fastify-type-provider-zod';
38
- import 'node:readline';
39
39
  import 'http';
40
40
  import 'util';
41
+ import 'node:url';
41
42
 
42
43
  const GeminiDisplay = ({ messageBuffer, logPath, currentModel, onExit }) => {
43
44
  const [messages, setMessages] = useState([]);