agl 43.0.5 → 43.2.0
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/changelog.md +30 -0
- package/dist_serve/bundle.js +5996 -5280
- package/dist_serve/bundle.js.map +2 -2
- package/dist_serve/bundle.js.third-party-notices.json +30 -30
- package/dist_serve/bundle.js.third-party-notices.txt +30 -30
- package/dist_serve/third-party-notices.md +1 -1
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/aglapi/aglapisurface.document.js +805 -10
- package/dist_ts/aglapi/interfaces.d.ts +13 -0
- package/dist_ts/aglapi/interfaces.js +4 -1
- package/dist_ts/classes.authmodels.js +17 -4
- package/dist_ts/classes.authstore.js +16 -2
- package/dist_ts/classes.claudeharness.d.ts +14 -5
- package/dist_ts/classes.claudeharness.js +62 -2
- package/dist_ts/classes.cli.d.ts +4 -2
- package/dist_ts/classes.cli.js +6 -3
- package/dist_ts/classes.codexclientadapter.d.ts +7 -5
- package/dist_ts/classes.codexclientadapter.js +38 -3
- package/dist_ts/classes.controller.d.ts +19 -2
- package/dist_ts/classes.controller.js +234 -27
- package/dist_ts/classes.controllermanagement.d.ts +14 -4
- package/dist_ts/classes.controllermanagement.js +20 -2
- package/dist_ts/classes.gatewayclient.d.ts +115 -0
- package/dist_ts/classes.gatewayclient.js +336 -0
- package/dist_ts/classes.gatewayclientstore.d.ts +97 -0
- package/dist_ts/classes.gatewayclientstore.js +261 -0
- package/dist_ts/classes.inferencegateway.d.ts +8 -5
- package/dist_ts/classes.inferencegateway.js +62 -19
- package/dist_ts/classes.inferencerouter.d.ts +9 -0
- package/dist_ts/classes.inferencerouter.js +11 -1
- package/dist_ts/classes.inferenceservice.d.ts +9 -0
- package/dist_ts/classes.inferenceservice.js +27 -1
- package/dist_ts/classes.inferencespend.d.ts +9 -3
- package/dist_ts/classes.inferencespend.js +44 -16
- package/dist_ts/classes.mcpclient.d.ts +9 -4
- package/dist_ts/classes.mcpclient.js +24 -2
- package/dist_ts/classes.mcpcontrollerhost.d.ts +3 -1
- package/dist_ts/classes.mcpcontrollerhost.js +13 -1
- package/dist_ts/classes.mcptools.d.ts +3 -3
- package/dist_ts/classes.mcptools.js +42 -4
- package/dist_ts/classes.mcpvalidation.js +7 -1
- package/dist_ts/classes.opencodeclient.js +3 -1
- package/dist_ts/classes.proxycontrol.d.ts +33 -11
- package/dist_ts/classes.proxycontrol.js +12 -3
- package/dist_ts/classes.proxycontrolclient.d.ts +23 -5
- package/dist_ts/classes.proxycontrolclient.js +42 -6
- package/dist_ts/classes.proxydaemon.d.ts +8 -6
- package/dist_ts/classes.proxydaemon.js +42 -21
- package/dist_ts/classes.proxyleaseholder.d.ts +12 -4
- package/dist_ts/classes.proxyleaseholder.js +39 -9
- package/dist_ts/classes.proxymonitor.d.ts +7 -0
- package/dist_ts/classes.proxymonitor.js +13 -1
- package/dist_ts/classes.proxystore.d.ts +4 -3
- package/dist_ts/classes.proxystore.js +17 -7
- package/dist_ts/classes.sessionfeed.d.ts +1 -1
- package/dist_ts/classes.trustedproxysecrets.d.ts +2 -0
- package/dist_ts/classes.trustedproxysecrets.js +5 -1
- package/dist_ts/classes.validation.d.ts +7 -0
- package/dist_ts/classes.validation.js +49 -2
- package/dist_ts/driver/functions.drivertools.js +2 -2
- package/dist_ts/fleet/classes.codexworkers.d.ts +4 -11
- package/dist_ts/fleet/classes.codexworkers.js +6 -3
- package/dist_ts/fleet/classes.workers.d.ts +25 -13
- package/dist_ts/fleet/classes.workers.js +105 -9
- package/dist_ts/fleet/functions.workervalidation.d.ts +26 -1
- package/dist_ts/fleet/functions.workervalidation.js +40 -11
- package/dist_ts/fleet/interfaces.workers.d.ts +17 -11
- package/dist_ts/fleet/interfaces.workers.js +10 -1
- package/dist_ts/functions.confinedrelay.d.ts +21 -0
- package/dist_ts/functions.confinedrelay.js +65 -0
- package/dist_ts/functions.controllermanagementsurface.d.ts +4 -0
- package/dist_ts/functions.controllermanagementsurface.js +15 -1
- package/dist_ts/functions.deviceapi.d.ts +4 -2
- package/dist_ts/functions.deviceapi.js +20 -2
- package/dist_ts/functions.elicitation.d.ts +49 -0
- package/dist_ts/functions.elicitation.js +418 -0
- package/dist_ts/functions.gatewaycli.d.ts +24 -0
- package/dist_ts/functions.gatewaycli.js +395 -0
- package/dist_ts/functions.gatewayroute.d.ts +135 -0
- package/dist_ts/functions.gatewayroute.js +366 -0
- package/dist_ts/functions.inferencecli.d.ts +3 -3
- package/dist_ts/functions.inferencecli.js +62 -10
- package/dist_ts/functions.inferencecliarguments.d.ts +9 -2
- package/dist_ts/functions.inferencecliarguments.js +59 -10
- package/dist_ts/functions.inferencelaunch.d.ts +35 -7
- package/dist_ts/functions.inferencelaunch.js +143 -16
- package/dist_ts/functions.mcpfleetworkertools.d.ts +63 -70
- package/dist_ts/functions.mcpfleetworkertools.js +32 -4
- package/dist_ts/functions.proxycapacity.d.ts +50 -0
- package/dist_ts/functions.proxycapacity.js +142 -0
- package/dist_ts/functions.proxycapacitycli.d.ts +30 -0
- package/dist_ts/functions.proxycapacitycli.js +65 -0
- package/dist_ts/functions.proxycontract.d.ts +21 -4
- package/dist_ts/functions.proxycontract.js +12 -5
- package/dist_ts/functions.proxyharnessconfig.d.ts +7 -0
- package/dist_ts/functions.proxyharnessconfig.js +11 -1
- package/dist_ts/functions.remotecli.d.ts +30 -3
- package/dist_ts/functions.remotecli.js +44 -18
- package/dist_ts/interfaces.auth.d.ts +25 -4
- package/dist_ts/interfaces.auth.js +8 -1
- package/dist_ts/plugins.d.ts +2 -0
- package/dist_ts/plugins.js +4 -1
- package/dist_ts_authswitch/authority-placement.js +3 -17
- package/dist_ts_authswitch/authority-usagelimit.d.ts +29 -0
- package/dist_ts_authswitch/authority-usagelimit.js +66 -2
- package/dist_ts_authswitch/authority-usagewindows.d.ts +6 -0
- package/dist_ts_authswitch/authority-usagewindows.js +15 -1
- package/dist_ts_interfaces/devices.d.ts +133 -3
- package/dist_ts_interfaces/devices.js +3 -2
- package/dist_ts_interfaces/elicitations.d.ts +125 -0
- package/dist_ts_interfaces/elicitations.js +7 -0
- package/dist_ts_interfaces/fleetworkers.d.ts +119 -5
- package/dist_ts_interfaces/fleetworkers.js +14 -2
- package/dist_ts_interfaces/gateway.d.ts +151 -0
- package/dist_ts_interfaces/gateway.js +66 -0
- package/dist_ts_interfaces/index.d.ts +3 -0
- package/dist_ts_interfaces/index.js +4 -1
- package/dist_ts_interfaces/interfaces.d.ts +3 -1
- package/dist_ts_interfaces/interfaces.js +2 -2
- package/dist_ts_interfaces/management.d.ts +4 -4
- package/dist_ts_interfaces/management.js +3 -2
- package/dist_ts_interfaces/mcprequests.d.ts +18 -2
- package/dist_ts_interfaces/mcprequests.js +3 -1
- package/dist_ts_interfaces/nativesessions.d.ts +14 -0
- package/dist_ts_interfaces/proxycapacity.d.ts +99 -0
- package/dist_ts_interfaces/proxycapacity.js +74 -0
- package/dist_ts_interfaces/requests.d.ts +3 -3
- package/dist_ts_interfaces/requests.fleetworkers.js +2 -2
- package/dist_ts_interfaces/requests.js +1 -1
- package/dist_ts_interfaces/requests.promptreply.d.ts +18 -0
- package/dist_ts_interfaces/sessionfeed.d.ts +3 -2
- package/dist_ts_interfaces/sessionfeed.js +1 -1
- package/package.json +5 -4
- package/readme.md +267 -26
- package/third-party-notices.md +1 -1
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/aglapi/aglapisurface.document.ts +804 -9
- package/ts/aglapi/interfaces.ts +3 -0
- package/ts/classes.authmodels.ts +22 -3
- package/ts/classes.authstore.ts +15 -1
- package/ts/classes.claudeharness.ts +80 -9
- package/ts/classes.cli.ts +7 -3
- package/ts/classes.codexclientadapter.ts +41 -5
- package/ts/classes.controller.ts +276 -32
- package/ts/classes.controllermanagement.ts +40 -7
- package/ts/classes.gatewayclient.ts +401 -0
- package/ts/classes.gatewayclientstore.ts +272 -0
- package/ts/classes.inferencegateway.ts +69 -23
- package/ts/classes.inferencerouter.ts +12 -0
- package/ts/classes.inferenceservice.ts +27 -0
- package/ts/classes.inferencespend.ts +46 -13
- package/ts/classes.mcpclient.ts +26 -4
- package/ts/classes.mcpcontrollerhost.ts +17 -0
- package/ts/classes.mcptools.ts +47 -5
- package/ts/classes.mcpvalidation.ts +5 -0
- package/ts/classes.opencodeclient.ts +2 -0
- package/ts/classes.proxycontrol.ts +43 -13
- package/ts/classes.proxycontrolclient.ts +39 -6
- package/ts/classes.proxydaemon.ts +57 -27
- package/ts/classes.proxyleaseholder.ts +43 -11
- package/ts/classes.proxymonitor.ts +12 -0
- package/ts/classes.proxystore.ts +21 -8
- package/ts/classes.sessionfeed.ts +1 -1
- package/ts/classes.trustedproxysecrets.ts +5 -0
- package/ts/classes.validation.ts +52 -0
- package/ts/driver/functions.drivertools.ts +1 -1
- package/ts/fleet/classes.codexworkers.ts +8 -6
- package/ts/fleet/classes.workers.ts +101 -17
- package/ts/fleet/functions.workervalidation.ts +35 -9
- package/ts/fleet/interfaces.workers.ts +11 -4
- package/ts/functions.confinedrelay.ts +65 -0
- package/ts/functions.controllermanagementsurface.ts +15 -0
- package/ts/functions.deviceapi.ts +24 -1
- package/ts/functions.elicitation.ts +443 -0
- package/ts/functions.gatewaycli.ts +436 -0
- package/ts/functions.gatewayroute.ts +429 -0
- package/ts/functions.inferencecli.ts +62 -13
- package/ts/functions.inferencecliarguments.ts +56 -9
- package/ts/functions.inferencelaunch.ts +143 -16
- package/ts/functions.mcpfleetworkertools.ts +34 -4
- package/ts/functions.proxycapacity.ts +191 -0
- package/ts/functions.proxycapacitycli.ts +104 -0
- package/ts/functions.proxycontract.ts +17 -4
- package/ts/functions.proxyharnessconfig.ts +11 -0
- package/ts/functions.remotecli.ts +56 -20
- package/ts/interfaces.auth.ts +29 -4
- package/ts/plugins.ts +5 -0
- package/ts_authswitch/authority-placement.ts +2 -15
- package/ts_authswitch/authority-usagelimit.ts +84 -1
- package/ts_authswitch/authority-usagewindows.ts +13 -0
- package/ts_interfaces/devices.schema.json +476 -2
- package/ts_interfaces/devices.ts +146 -2
- package/ts_interfaces/elicitations.ts +148 -0
- package/ts_interfaces/fleetworkers.ts +96 -4
- package/ts_interfaces/gateway.ts +242 -0
- package/ts_interfaces/index.ts +3 -0
- package/ts_interfaces/interfaces.ts +3 -1
- package/ts_interfaces/management.ts +6 -4
- package/ts_interfaces/mcprequests.ts +19 -0
- package/ts_interfaces/nativesessions.ts +16 -0
- package/ts_interfaces/proxycapacity.ts +162 -0
- package/ts_interfaces/requests.fleetworkers.ts +1 -1
- package/ts_interfaces/requests.promptreply.ts +22 -0
- package/ts_interfaces/requests.ts +4 -0
- package/ts_interfaces/sessionfeed.ts +3 -2
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/classes.browserpresentation.ts +13 -5
- package/ts_web/classes.elicitationcards.ts +106 -0
- package/ts_web/classes.nativesessionstate.ts +38 -1
- package/ts_web/elements.accounts.ts +40 -113
- package/ts_web/elements.configurationpane.ts +24 -37
- package/ts_web/elements.devices.ts +4 -17
- package/ts_web/elements.fleetworker.ts +27 -2
- package/ts_web/elements.flexlimitstrip.ts +21 -70
- package/ts_web/elements.harnesscontrollerapp.ts +159 -186
- package/ts_web/functions.sessionchat.ts +5 -0
package/ts/aglapi/interfaces.ts
CHANGED
|
@@ -59,6 +59,7 @@ const tickets: readonly TAglApiRole[] = ['session'];
|
|
|
59
59
|
*/
|
|
60
60
|
export const aglApiMethods = {
|
|
61
61
|
'agl.mcp.controller.status': { use: 'read' },
|
|
62
|
+
'agl.mcp.proxy.capacity': { use: 'observe' },
|
|
62
63
|
'agl.mcp.projects.list': { use: 'read' },
|
|
63
64
|
'agl.mcp.sessions.list': { use: 'read' },
|
|
64
65
|
'agl.mcp.session.read': { use: 'observe' },
|
|
@@ -140,7 +141,9 @@ export const aglApiMethods = {
|
|
|
140
141
|
'agl.mcp.fleet.worker.refresh': { use: 'excluded', exclusion: 'person', reason: ownerToken },
|
|
141
142
|
'agl.mcp.fleet.worker.move': { use: 'excluded', exclusion: 'person', reason: ownerToken },
|
|
142
143
|
'agl.mcp.fleet.worker.list': { use: 'excluded', exclusion: 'person', reason: ownerToken },
|
|
144
|
+
'agl.mcp.fleet.worker.get': { use: 'excluded', exclusion: 'person', reason: ownerToken },
|
|
143
145
|
'agl.mcp.fleet.worker.status': { use: 'excluded', exclusion: 'person', reason: ownerToken },
|
|
146
|
+
'agl.mcp.fleet.worker.job-wait': { use: 'excluded', exclusion: 'person', reason: ownerToken },
|
|
144
147
|
'agl.mcp.fleet.worker.watch': { use: 'excluded', exclusion: 'person', reason: ownerToken },
|
|
145
148
|
'agl.mcp.fleet.worker.native-message': { use: 'excluded', exclusion: 'person', reason: ownerToken },
|
|
146
149
|
// A worker never hides its own failure: only a person acknowledges a failed session.
|
package/ts/classes.authmodels.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
controllerAuditEventTypes,
|
|
10
10
|
type IControllerAuditEvent,
|
|
11
11
|
type IControllerAuditRemoteEndpoint,
|
|
12
|
+
type IControllerAuditGateway,
|
|
12
13
|
type IControllerAuditRemoteMove,
|
|
13
14
|
type IControllerAuthDocument,
|
|
14
15
|
type IControllerTempPasswordDocument,
|
|
@@ -396,13 +397,31 @@ const isAuditRemoteMove = (valueArg: unknown): valueArg is IControllerAuditRemot
|
|
|
396
397
|
&& isAuditRemoteEndpoint(valueArg.previous)
|
|
397
398
|
&& isAuditRemoteEndpoint(valueArg.target);
|
|
398
399
|
|
|
400
|
+
const isAuditGatewayText = (valueArg: unknown, maximumArg: number): valueArg is string => (
|
|
401
|
+
isNonEmptyString(valueArg) && valueArg.length <= maximumArg && !/[\0\r\n]/u.test(valueArg)
|
|
402
|
+
);
|
|
403
|
+
|
|
404
|
+
const isAuditGateway = (typeArg: string, valueArg: unknown): valueArg is IControllerAuditGateway => isPlainObject(valueArg)
|
|
405
|
+
&& hasExactKeys(valueArg, ['gatewayUrl', 'gatewayClientId', 'appId', 'hostname', 'targetHost', 'targetPort', 'routeKey'],
|
|
406
|
+
typeArg === 'remote.gateway.sync' ? ['rotate'] : [])
|
|
407
|
+
&& isAuditGatewayText(valueArg.gatewayUrl, 2048)
|
|
408
|
+
&& isAuditGatewayText(valueArg.gatewayClientId, 128)
|
|
409
|
+
&& isAuditGatewayText(valueArg.appId, 128)
|
|
410
|
+
&& isAuditGatewayText(valueArg.hostname, 253)
|
|
411
|
+
&& isAuditGatewayText(valueArg.targetHost, 253)
|
|
412
|
+
&& isValidPort(valueArg.targetPort)
|
|
413
|
+
&& isAuditGatewayText(valueArg.routeKey, 1024)
|
|
414
|
+
&& (valueArg.rotate === undefined || typeof valueArg.rotate === 'boolean');
|
|
415
|
+
|
|
399
416
|
/**
|
|
400
417
|
* `details` on a type this release knows: only `remote.set` and `remote.unset` record a `remoteMove`, and only a move
|
|
401
|
-
* from one canonical origin and RP ID to another.
|
|
418
|
+
* from one canonical origin and RP ID to another; only `remote.gateway.*` records a `gateway`.
|
|
402
419
|
*/
|
|
403
420
|
const hasKnownAuditDetails = (typeArg: string, detailsArg: Record<string, unknown>): boolean =>
|
|
404
|
-
!Object.hasOwn(detailsArg, 'remoteMove')
|
|
405
|
-
|
|
421
|
+
(!Object.hasOwn(detailsArg, 'remoteMove')
|
|
422
|
+
|| ((typeArg === 'remote.set' || typeArg === 'remote.unset') && isAuditRemoteMove(detailsArg.remoteMove)))
|
|
423
|
+
&& (!Object.hasOwn(detailsArg, 'gateway')
|
|
424
|
+
|| (typeArg.startsWith('remote.gateway.') && isAuditGateway(typeArg, detailsArg.gateway)));
|
|
406
425
|
|
|
407
426
|
/**
|
|
408
427
|
* A stored audit event. The log is shared with later releases, so a type this release does not know (a later
|
package/ts/classes.authstore.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { ControllerCodexOriginMigrationModel } from '../ts_migration/v29_codexor
|
|
|
11
11
|
import { ControllerCodexConnectionStore } from './classes.codexconnectionstore.js';
|
|
12
12
|
import { ControllerTrustedProxySecretModel } from './classes.trustedproxysecrets.js';
|
|
13
13
|
import { ControllerDeviceModel, deleteControllerDevices } from './classes.controllerdevices.js';
|
|
14
|
+
import { ControllerGatewayClientModel } from './classes.gatewayclientstore.js';
|
|
14
15
|
import { ControllerClaudeSessionStore } from './classes.claudesessionstore.js';
|
|
15
16
|
import { ControllerClaudeSessionModel } from './classes.claudesessionmodels.js';
|
|
16
17
|
import { ControllerPendingPromptStore } from './classes.pendingpromptstore.js';
|
|
@@ -807,6 +808,7 @@ const setAuthStoreModelManager = (
|
|
|
807
808
|
plugins.nosqldb.setDefaultManagerForDoc(managerArg, ControllerTrackedConversationModel);
|
|
808
809
|
plugins.nosqldb.setDefaultManagerForDoc(managerArg, ControllerTrustedProxySecretModel);
|
|
809
810
|
plugins.nosqldb.setDefaultManagerForDoc(managerArg, ControllerDeviceModel);
|
|
811
|
+
plugins.nosqldb.setDefaultManagerForDoc(managerArg, ControllerGatewayClientModel);
|
|
810
812
|
plugins.nosqldb.setDefaultManagerForDoc(
|
|
811
813
|
managerArg,
|
|
812
814
|
ControllerLegacyManagedSessionMigrationModel,
|
|
@@ -1097,6 +1099,7 @@ export class SmartDataAuthStore implements IAuthStore, IAuthStoreSessionIdentity
|
|
|
1097
1099
|
await ControllerTrackedConversationModel.init();
|
|
1098
1100
|
await ControllerTrustedProxySecretModel.init();
|
|
1099
1101
|
await ControllerDeviceModel.init();
|
|
1102
|
+
await ControllerGatewayClientModel.init();
|
|
1100
1103
|
// `moveRuntimeConfig` changes the configuration and deletes the paired devices in one transaction.
|
|
1101
1104
|
await ControllerAuthModel.exact.prepare();
|
|
1102
1105
|
await ControllerDeviceModel.exact.prepare();
|
|
@@ -1932,7 +1935,7 @@ export class SmartDataAuthStore implements IAuthStore, IAuthStoreSessionIdentity
|
|
|
1932
1935
|
...(eventArg.senderLabel === undefined ? {} : { senderLabel: eventArg.senderLabel }),
|
|
1933
1936
|
...(eventArg.localCli === undefined ? {} : { localCli: { ...eventArg.localCli } }),
|
|
1934
1937
|
...(eventArg.details === undefined ? {} : {
|
|
1935
|
-
details: {
|
|
1938
|
+
details: 'remoteMove' in eventArg.details ? {
|
|
1936
1939
|
remoteMove: {
|
|
1937
1940
|
previous: {
|
|
1938
1941
|
publicOrigin: eventArg.details.remoteMove.previous.publicOrigin,
|
|
@@ -1943,6 +1946,17 @@ export class SmartDataAuthStore implements IAuthStore, IAuthStoreSessionIdentity
|
|
|
1943
1946
|
rpId: eventArg.details.remoteMove.target.rpId,
|
|
1944
1947
|
},
|
|
1945
1948
|
},
|
|
1949
|
+
} : {
|
|
1950
|
+
gateway: {
|
|
1951
|
+
gatewayUrl: eventArg.details.gateway.gatewayUrl,
|
|
1952
|
+
gatewayClientId: eventArg.details.gateway.gatewayClientId,
|
|
1953
|
+
appId: eventArg.details.gateway.appId,
|
|
1954
|
+
hostname: eventArg.details.gateway.hostname,
|
|
1955
|
+
targetHost: eventArg.details.gateway.targetHost,
|
|
1956
|
+
targetPort: eventArg.details.gateway.targetPort,
|
|
1957
|
+
routeKey: eventArg.details.gateway.routeKey,
|
|
1958
|
+
...(eventArg.details.gateway.rotate === undefined ? {} : { rotate: eventArg.details.gateway.rotate }),
|
|
1959
|
+
},
|
|
1946
1960
|
},
|
|
1947
1961
|
}),
|
|
1948
1962
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as plugins from './plugins.js';
|
|
2
2
|
import type {
|
|
3
|
-
IControllerClaudeModelChoice, IControllerEvent, IControllerMessage, IControllerMessageBundle,
|
|
4
|
-
IControllerPermission, IControllerQuestion, IControllerSession, IControllerSessionError,
|
|
5
|
-
TControllerModelRetryReason,
|
|
3
|
+
IControllerAttention, IControllerClaudeModelChoice, IControllerEvent, IControllerMessage, IControllerMessageBundle,
|
|
4
|
+
IControllerMessagePage, IControllerPermission, IControllerQuestion, IControllerSession, IControllerSessionError,
|
|
5
|
+
IControllerSessionRetrying, TControllerElicitation, TControllerElicitationReply, TControllerModelRetryReason,
|
|
6
6
|
} from '../ts_interfaces/index.js';
|
|
7
7
|
import { controllerMaxToolEventBytes } from '../ts_interfaces/index.js';
|
|
8
8
|
import { boundLiveToolExecution, boundToolText, type TLiveToolSnapshot } from './functions.livetoolbounding.js';
|
|
@@ -12,12 +12,15 @@ import {
|
|
|
12
12
|
type IClaudeProjectedTranscript, type IClaudeToolResult,
|
|
13
13
|
} from './classes.claudeprojection.js';
|
|
14
14
|
import { isClaudeSessionNativeId, type IControllerClaudeSessionDocument } from './classes.claudesessionmodels.js';
|
|
15
|
+
import { ControllerElicitationReplyError, controllerElicitation, controllerElicitationAnswer } from './functions.elicitation.js';
|
|
15
16
|
|
|
16
17
|
/** The SDK calls the harness makes; tests hand in a fake. */
|
|
17
18
|
export type TClaudeSdk = Pick<typeof plugins.claudeAgentSdk, 'query' | 'getSessionMessages' | 'getSessionInfo' | 'deleteSession'>;
|
|
18
19
|
type TClaudeQuery = plugins.claudeAgentSdk.Query;
|
|
19
20
|
type TClaudeUserMessage = plugins.claudeAgentSdk.SDKUserMessage;
|
|
20
21
|
type TClaudePermissionResult = plugins.claudeAgentSdk.PermissionResult;
|
|
22
|
+
type TClaudeElicitationRequest = plugins.claudeAgentSdk.ElicitationRequest;
|
|
23
|
+
type TClaudeElicitationResult = plugins.claudeAgentSdk.ElicitationResult;
|
|
21
24
|
type TClaudeEffort = plugins.claudeAgentSdk.EffortLevel;
|
|
22
25
|
type TClaudeToolContext = Parameters<plugins.claudeAgentSdk.CanUseTool>[2];
|
|
23
26
|
type TClaudeInterruptReceipt = plugins.claudeAgentSdk.SDKControlInterruptResponse;
|
|
@@ -183,18 +186,33 @@ interface IClaudeLivePart {
|
|
|
183
186
|
result?: IClaudeToolResult;
|
|
184
187
|
}
|
|
185
188
|
|
|
186
|
-
interface
|
|
189
|
+
interface IClaudePendingBase {
|
|
187
190
|
id: string;
|
|
188
191
|
nativeId: string;
|
|
189
192
|
runtime: IClaudeRuntime;
|
|
190
193
|
bytes: number;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** A tool call Claude Code asks about: a permission card, or a question card for `AskUserQuestion`. */
|
|
197
|
+
interface IClaudePendingTool extends IClaudePendingBase {
|
|
191
198
|
input: Record<string, unknown>;
|
|
192
199
|
resolve: (resultArg: TClaudePermissionResult) => void;
|
|
193
200
|
permission?: IControllerPermission;
|
|
194
201
|
question?: IControllerQuestion;
|
|
195
202
|
questionTexts?: string[];
|
|
203
|
+
elicitation?: never;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** An MCP server's elicitation; Claude Code waits for its answer until the owner gives one or the request is withdrawn. */
|
|
207
|
+
interface IClaudePendingElicitation extends IClaudePendingBase {
|
|
208
|
+
elicitation: TControllerElicitation;
|
|
209
|
+
resolve: (resultArg: TClaudeElicitationResult) => void;
|
|
210
|
+
permission?: never;
|
|
211
|
+
question?: never;
|
|
196
212
|
}
|
|
197
213
|
|
|
214
|
+
type IClaudePendingRequest = IClaudePendingTool | IClaudePendingElicitation;
|
|
215
|
+
|
|
198
216
|
/**
|
|
199
217
|
* What the harness keeps of a conversation. A native session AGL lists outside every project has no `projectId`: it
|
|
200
218
|
* is no AGL conversation record, so the harness reports none of its changes as project events.
|
|
@@ -476,12 +494,13 @@ export class ClaudeHarness {
|
|
|
476
494
|
return [...scopes.values()];
|
|
477
495
|
}
|
|
478
496
|
|
|
479
|
-
public attention(nativeIdArg: string):
|
|
497
|
+
public attention(nativeIdArg: string): IControllerAttention {
|
|
480
498
|
this.state(nativeIdArg);
|
|
481
499
|
const requests = this.requests(nativeIdArg);
|
|
482
500
|
return {
|
|
483
501
|
permissions: requests.flatMap((request) => request.permission ? [structuredClone(request.permission)] : []),
|
|
484
502
|
questions: requests.flatMap((request) => request.question ? [structuredClone(request.question)] : []),
|
|
503
|
+
elicitations: requests.flatMap((request) => request.elicitation ? [structuredClone(request.elicitation)] : []),
|
|
485
504
|
};
|
|
486
505
|
}
|
|
487
506
|
|
|
@@ -507,6 +526,22 @@ export class ClaudeHarness {
|
|
|
507
526
|
this.answer(request, { behavior: 'allow', updatedInput: { ...request.input, answers } });
|
|
508
527
|
}
|
|
509
528
|
|
|
529
|
+
/**
|
|
530
|
+
* Answers an MCP elicitation with the owner's reply, checked against its card first: a reply that does not fit is
|
|
531
|
+
* refused and Claude Code keeps waiting.
|
|
532
|
+
*/
|
|
533
|
+
public replyElicitation(nativeIdArg: string, idArg: string, replyArg: TControllerElicitationReply): void {
|
|
534
|
+
const request = this.pending.get(idArg);
|
|
535
|
+
if (!request?.elicitation || request.nativeId !== nativeIdArg) {
|
|
536
|
+
throw new ControllerElicitationReplyError('The MCP request is no longer pending in this conversation.', 'not_found');
|
|
537
|
+
}
|
|
538
|
+
const { action, content } = controllerElicitationAnswer(request.elicitation, replyArg);
|
|
539
|
+
this.pending.delete(request.id);
|
|
540
|
+
request.resolve(content === undefined ? { action } : { action, content });
|
|
541
|
+
const state = this.states.get(nativeIdArg);
|
|
542
|
+
if (state) this.changed(state, 'permissions.changed');
|
|
543
|
+
}
|
|
544
|
+
|
|
510
545
|
public async listMessagePage(nativeIdArg: string, optionsArg: { limit?: number; before?: string } = {}, signalArg?: AbortSignal): Promise<IControllerMessagePage> {
|
|
511
546
|
const state = this.state(nativeIdArg);
|
|
512
547
|
const projected = await this.transcript(state, signalArg);
|
|
@@ -727,6 +762,7 @@ export class ClaudeHarness {
|
|
|
727
762
|
settingSources: ['user', 'project', 'local'], permissionMode: 'default', includePartialMessages: true,
|
|
728
763
|
systemPrompt: { type: 'preset', preset: 'claude_code' },
|
|
729
764
|
canUseTool: (toolNameArg, toolInputArg, contextArg) => this.canUseTool(runtime, toolNameArg, toolInputArg, contextArg),
|
|
765
|
+
onElicitation: (requestArg, optionsArg) => this.onElicitation(runtime, requestArg, optionsArg.signal),
|
|
730
766
|
stderr: (dataArg) => { runtime.stderr = (runtime.stderr + dataArg).slice(-maxClaudeStderrChars); },
|
|
731
767
|
...(existingTranscript ? { resume: nativeIdArg } : { sessionId: nativeIdArg }),
|
|
732
768
|
...(modelArg ? { model: modelArg.modelID } : {}),
|
|
@@ -825,7 +861,8 @@ export class ClaudeHarness {
|
|
|
825
861
|
for (const request of [...this.pending.values()]) {
|
|
826
862
|
if (request.runtime !== runtimeArg) continue;
|
|
827
863
|
this.pending.delete(request.id);
|
|
828
|
-
request.resolve({
|
|
864
|
+
if (request.elicitation) request.resolve({ action: 'cancel' });
|
|
865
|
+
else request.resolve({ behavior: 'deny', message: 'The Claude Code process ended.' });
|
|
829
866
|
}
|
|
830
867
|
const state = this.states.get(runtimeArg.nativeId);
|
|
831
868
|
if (!state) return;
|
|
@@ -1041,7 +1078,7 @@ export class ClaudeHarness {
|
|
|
1041
1078
|
if (!state || runtimeArg.ended || this.closed) return { behavior: 'deny', message: 'The AGL conversation is closed.' };
|
|
1042
1079
|
const nativeId = runtimeArg.nativeId;
|
|
1043
1080
|
const id = plugins.crypto.randomBytes(24).toString('base64url');
|
|
1044
|
-
let request: Omit<
|
|
1081
|
+
let request: Omit<IClaudePendingTool, 'resolve'>;
|
|
1045
1082
|
try {
|
|
1046
1083
|
const bytes = Buffer.byteLength(JSON.stringify(inputArg ?? null), 'utf8');
|
|
1047
1084
|
if (bytes > 64 * 1024 || this.pending.size >= 128 || [...this.pending.values()].reduce((sum, entry) => sum + entry.bytes, bytes) > 256 * 1024) {
|
|
@@ -1092,7 +1129,7 @@ export class ClaudeHarness {
|
|
|
1092
1129
|
return { behavior: 'deny', message: 'AGL cannot show this request.' };
|
|
1093
1130
|
}
|
|
1094
1131
|
return new Promise<TClaudePermissionResult>((resolve) => {
|
|
1095
|
-
const entry:
|
|
1132
|
+
const entry: IClaudePendingTool = { ...request, resolve };
|
|
1096
1133
|
this.pending.set(id, entry);
|
|
1097
1134
|
const abort = () => {
|
|
1098
1135
|
if (this.pending.get(id) !== entry) return;
|
|
@@ -1106,7 +1143,7 @@ export class ClaudeHarness {
|
|
|
1106
1143
|
});
|
|
1107
1144
|
}
|
|
1108
1145
|
|
|
1109
|
-
private answer(requestArg:
|
|
1146
|
+
private answer(requestArg: IClaudePendingTool, resultArg: TClaudePermissionResult): void {
|
|
1110
1147
|
if (this.pending.get(requestArg.id) !== requestArg) throw new Error('Claude Code request expired before the reply.');
|
|
1111
1148
|
this.pending.delete(requestArg.id);
|
|
1112
1149
|
requestArg.resolve(resultArg);
|
|
@@ -1114,6 +1151,40 @@ export class ClaudeHarness {
|
|
|
1114
1151
|
if (state) this.changed(state, 'permissions.changed');
|
|
1115
1152
|
}
|
|
1116
1153
|
|
|
1154
|
+
/**
|
|
1155
|
+
* An MCP server asks the owner for input: the request becomes a card, and its answer waits for the owner alone. A
|
|
1156
|
+
* request outside what AGL collects is a card too, with its reason, which only decline or cancel answer; one AGL
|
|
1157
|
+
* cannot hold at all (the pending capacity permissions and questions share) is refused with an error, never
|
|
1158
|
+
* answered for the owner. Withdrawing the request (`signalArg`) removes the card, so a later reply is refused.
|
|
1159
|
+
*/
|
|
1160
|
+
private async onElicitation(runtimeArg: IClaudeRuntime, requestArg: TClaudeElicitationRequest, signalArg: AbortSignal): Promise<TClaudeElicitationResult> {
|
|
1161
|
+
const state = this.states.get(runtimeArg.nativeId);
|
|
1162
|
+
if (!state || runtimeArg.ended || this.closed) throw new Error('The AGL conversation is closed.');
|
|
1163
|
+
const nativeId = runtimeArg.nativeId;
|
|
1164
|
+
const id = plugins.crypto.randomBytes(24).toString('base64url');
|
|
1165
|
+
const bytes = Buffer.byteLength(JSON.stringify(requestArg ?? null), 'utf8');
|
|
1166
|
+
if (bytes > 64 * 1024 || this.pending.size >= 128 || [...this.pending.values()].reduce((sum, entry) => sum + entry.bytes, bytes) > 256 * 1024) {
|
|
1167
|
+
throw new Error('AGL cannot hold more requests right now.');
|
|
1168
|
+
}
|
|
1169
|
+
const elicitation = controllerElicitation({
|
|
1170
|
+
id: claudeRuntimeId(id), sessionId: claudeRuntimeId(nativeId), serverName: requestArg.serverName, message: requestArg.message,
|
|
1171
|
+
mode: requestArg.mode, url: requestArg.url, requestedSchema: requestArg.requestedSchema, createdAt: Date.now(),
|
|
1172
|
+
});
|
|
1173
|
+
return new Promise<TClaudeElicitationResult>((resolve) => {
|
|
1174
|
+
const entry: IClaudePendingElicitation = { id, nativeId, runtime: runtimeArg, bytes, elicitation, resolve };
|
|
1175
|
+
this.pending.set(id, entry);
|
|
1176
|
+
const abort = () => {
|
|
1177
|
+
if (this.pending.get(id) !== entry) return;
|
|
1178
|
+
this.pending.delete(id);
|
|
1179
|
+
resolve({ action: 'cancel' });
|
|
1180
|
+
this.changed(state, 'permissions.changed');
|
|
1181
|
+
};
|
|
1182
|
+
signalArg.addEventListener('abort', abort, { once: true });
|
|
1183
|
+
if (signalArg.aborted) { abort(); return; }
|
|
1184
|
+
this.changed(state, 'permissions.changed');
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1117
1188
|
private async transcript(stateArg: IClaudeSessionState, signalArg?: AbortSignal): Promise<IClaudeProjectedTranscript> {
|
|
1118
1189
|
signalArg?.throwIfAborted();
|
|
1119
1190
|
const nativeId = stateArg.document.nativeId;
|
package/ts/classes.cli.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
controllerManagementProtocolVersion,
|
|
10
10
|
configurationOwnerTokenEnvironmentVariable,
|
|
11
11
|
describeBrowserPaintAvailability,
|
|
12
|
+
type IControllerManagementStatus,
|
|
12
13
|
type IControllerStatus,
|
|
13
14
|
} from '../ts_interfaces/index.js';
|
|
14
15
|
import { defaultControllerPort } from './classes.config.js';
|
|
@@ -143,6 +144,7 @@ Usage:
|
|
|
143
144
|
${currentCliName} foreground [options]
|
|
144
145
|
${currentCliName} temp-password [--port 4097] [--ttl-hours 24]
|
|
145
146
|
${currentCliName} remote set|unset|secret import [--port 4097] [options]
|
|
147
|
+
${currentCliName} remote gateway enrol|status|sync|remove [--port 4097] [options]
|
|
146
148
|
${currentCliName} feed list [--state failed] [--json] | acknowledge <row-id> --updated-at <ms> [--json]
|
|
147
149
|
${currentCliName} deploy status [TARGET] | history TARGET | probe TARGET [--json]
|
|
148
150
|
${currentCliName} release status [REPO] [--json]
|
|
@@ -167,7 +169,8 @@ Commands:
|
|
|
167
169
|
foreground Run ${currentRuntimeName} attached to this terminal
|
|
168
170
|
temp-password Mint a temporary browser login password (max 24 hours)
|
|
169
171
|
remote Move a stopped controller between localhost and a public origin behind a TLS
|
|
170
|
-
reverse proxy, or import the proxy's secret (remote --help)
|
|
172
|
+
reverse proxy, or import the proxy's secret (remote --help); keep the
|
|
173
|
+
controller's own route on a dcrouter gateway (remote gateway --help)
|
|
171
174
|
help Show this help
|
|
172
175
|
|
|
173
176
|
Startup options:
|
|
@@ -432,13 +435,14 @@ const assertStatus = (statusArg: unknown): IControllerStatus => assertController
|
|
|
432
435
|
export const queryControllerStatus = async (
|
|
433
436
|
portArg: number,
|
|
434
437
|
timeoutMsArg = 2_500,
|
|
435
|
-
): Promise<
|
|
438
|
+
): Promise<IControllerManagementStatus> => queryManagedControllerStatus(
|
|
436
439
|
portArg,
|
|
437
440
|
currentStatusExpectation,
|
|
438
441
|
timeoutMsArg,
|
|
439
442
|
);
|
|
440
443
|
|
|
441
|
-
|
|
444
|
+
/** The status of this release's controller on `portArg`, with its management sections, or `undefined` when none answers. */
|
|
445
|
+
export const tryQueryControllerStatus = async (portArg: number): Promise<IControllerManagementStatus | undefined> => {
|
|
442
446
|
return tryQueryManagedControllerStatus(portArg, currentStatusExpectation);
|
|
443
447
|
};
|
|
444
448
|
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as plugins from './plugins.js';
|
|
2
|
-
import type { IControllerUsage, IControllerCodexActivity, IControllerCodexActivitySummary, IControllerCodexCollaborationMode, IControllerCodexModelChoice, IControllerCodexModelOption, IControllerEvent, IControllerMessagePage, IControllerMessageBundle, IControllerNativeWait, IControllerPermission, IControllerQuestion, IControllerSession, IControllerSessionError, TControllerCodexCollaborationMode, TControllerCodexCollaborationModeAuthority, TControllerSessionStatus } from '../ts_interfaces/index.js';
|
|
2
|
+
import type { IControllerAttention, IControllerUsage, IControllerCodexActivity, IControllerCodexActivitySummary, IControllerCodexCollaborationMode, IControllerCodexModelChoice, IControllerCodexModelOption, IControllerEvent, IControllerMessagePage, IControllerMessageBundle, IControllerNativeWait, IControllerPermission, IControllerQuestion, IControllerSession, IControllerSessionError, TControllerCodexCollaborationMode, TControllerCodexCollaborationModeAuthority, TControllerElicitation, TControllerElicitationReply, TControllerSessionStatus } from '../ts_interfaces/index.js';
|
|
3
3
|
import { controllerMaxToolEventBytes } from '../ts_interfaces/index.js';
|
|
4
4
|
import { CodexSupervisor } from './classes.codexsupervisor.js';
|
|
5
5
|
import { codexArray, codexBoundedText, codexNativeWait, codexNonnegativeInteger, codexItemBundle, codexRecord, codexRuntimeId, codexSession, codexSessionId, codexString, codexText, codexThreadId, codexTurnError, codexTurnErrorBundle, codexTurnUsage, codexUsageTotal, isCodexTerminalItemStatus, type ICodexUsageTotal, type TCodexAnswerMeta, type TCodexTerminalTurnStatus } from './classes.codexprojection.js';
|
|
6
6
|
import { codexPublicThreadId, codexQualifiedIdentity } from './functions.codexidentity.js';
|
|
7
|
+
import { ControllerElicitationReplyError, controllerElicitation, controllerElicitationAnswer } from './functions.elicitation.js';
|
|
7
8
|
import { maxCodexTurnPartialReplyBytes, maxCodexTurnRecordsPerSession, maxCodexTurnStopAnchors, type ICodexTurnRecord, type ICodexTurnRecordStore, type ICodexTurnStop } from './classes.codexturnstore.js';
|
|
8
9
|
|
|
9
10
|
interface ICodexSessionScope { projectId: string; directory: string; session: IControllerSession; revision: number; statusRevision: number; closedRevision: number }
|
|
10
11
|
interface ICodexLiveItem { turnId: string; item: Record<string, unknown>; completed: boolean; bytes: number; terminalTurnStatus?: TCodexTerminalTurnStatus }
|
|
11
|
-
interface ICodexPendingRequest { bytes: number; request: plugins.crossharness.ICodexAppServerRequest; permission?: IControllerPermission; question?: IControllerQuestion; questionIds?: string[] }
|
|
12
|
+
interface ICodexPendingRequest { bytes: number; request: plugins.crossharness.ICodexAppServerRequest; permission?: IControllerPermission; question?: IControllerQuestion; questionIds?: string[]; elicitation?: TControllerElicitation }
|
|
12
13
|
interface ICodexTurnAdmission { turnId?: string; clientMessageId: string; onUserMessage?: (idArg: string) => void; terminal: Set<string>; armed: boolean; complete: () => void }
|
|
13
14
|
/**
|
|
14
15
|
* What AGL observed of one turn for the line under its answer, and how a stopped turn ended.
|
|
@@ -116,6 +117,22 @@ export class CodexCollaborationModeOutcomeUnknownError extends Error {
|
|
|
116
117
|
}
|
|
117
118
|
}
|
|
118
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Codex's `mcpServer/elicitation/request` as AGL's card, read by the one normaliser: `form` and `url` as MCP defines
|
|
122
|
+
* them; every other mode Codex names (`openai/form`, `openaiForm`, `openai/userVerification`, any later one) is an
|
|
123
|
+
* unsupported card with the reason, which the owner declines or cancels. A mode without a message
|
|
124
|
+
* (`openai/userVerification`) says what it asks in its title and description; its `challenge` is opaque and is
|
|
125
|
+
* never read into the card.
|
|
126
|
+
*/
|
|
127
|
+
const codexElicitation = (idArg: string, threadIdArg: string, paramsArg: Record<string, unknown>): TControllerElicitation => controllerElicitation({
|
|
128
|
+
id: codexRuntimeId(idArg), sessionId: codexRuntimeId(threadIdArg), serverName: paramsArg.serverName,
|
|
129
|
+
message: typeof paramsArg.message === 'string'
|
|
130
|
+
? paramsArg.message
|
|
131
|
+
: [paramsArg.title, paramsArg.description].filter((entry): entry is string => typeof entry === 'string' && entry.length > 0).join('\n\n'),
|
|
132
|
+
// Codex names the mode on every request; MCP's absent mode (a form) is not Codex's to send.
|
|
133
|
+
mode: paramsArg.mode ?? null, url: paramsArg.url, requestedSchema: paramsArg.requestedSchema, createdAt: Date.now(),
|
|
134
|
+
});
|
|
135
|
+
|
|
119
136
|
/** Native app-server projection. Only explicitly admitted AGL threads may subscribe or answer requests. */
|
|
120
137
|
export class CodexClientAdapter {
|
|
121
138
|
private readonly scopes = new Map<string, ICodexSessionScope>();
|
|
@@ -1086,10 +1103,11 @@ export class CodexClientAdapter {
|
|
|
1086
1103
|
return [...result.values()];
|
|
1087
1104
|
}
|
|
1088
1105
|
|
|
1089
|
-
public attention(threadIdArg: string):
|
|
1106
|
+
public attention(threadIdArg: string): IControllerAttention {
|
|
1090
1107
|
this.scope(threadIdArg);
|
|
1091
1108
|
const requests = [...this.pending.values()].filter((entry) => entry.request.params.threadId === threadIdArg);
|
|
1092
|
-
return { permissions: requests.flatMap((entry) => entry.permission ? [entry.permission] : []), questions: requests.flatMap((entry) => entry.question ? [entry.question] : [])
|
|
1109
|
+
return { permissions: requests.flatMap((entry) => entry.permission ? [entry.permission] : []), questions: requests.flatMap((entry) => entry.question ? [entry.question] : []),
|
|
1110
|
+
elicitations: requests.flatMap((entry) => entry.elicitation ? [entry.elicitation] : []) };
|
|
1093
1111
|
}
|
|
1094
1112
|
|
|
1095
1113
|
public async startTurn(threadIdArg: string, textArg: string, clientMessageIdArg: string, modelArg: IControllerCodexModelChoice | undefined, beforeDispatchArg: () => Promise<void>, completeArg: () => void, signalArg?: AbortSignal, onUserMessageArg?: (idArg: string) => void, cancelUndispatchedArg?: () => Promise<void>, collaborationModeArg?: ICodexPreparedCollaborationMode): Promise<() => void> {
|
|
@@ -1874,8 +1892,10 @@ export class CodexClientAdapter {
|
|
|
1874
1892
|
questions: questions.map((question) => ({ question: codexString(question.question, 16 * 1024), header: codexString(question.header, 512),
|
|
1875
1893
|
custom: question.isOther === true || question.options === null,
|
|
1876
1894
|
options: question.options === null ? [] : codexArray(question.options, 64).map((option) => ({ label: codexString(codexRecord(option).label, 1024), description: codexString(codexRecord(option).description, 4096) })) })) };
|
|
1895
|
+
} else if (requestArg.method === 'mcpServer/elicitation/request') {
|
|
1896
|
+
pending.elicitation = codexElicitation(id, threadId, params);
|
|
1877
1897
|
} else { client.rejectRequest(requestArg.id, -32601, 'This Codex host request is not supported by AGL.'); return; }
|
|
1878
|
-
if (Buffer.byteLength(JSON.stringify(pending.permission ?? pending.question), 'utf8') > 64 * 1024) throw new Error('Codex attention request exceeds its display capacity.');
|
|
1898
|
+
if (Buffer.byteLength(JSON.stringify(pending.permission ?? pending.question ?? pending.elicitation), 'utf8') > 64 * 1024) throw new Error('Codex attention request exceeds its display capacity.');
|
|
1879
1899
|
this.pending.set(id, pending);
|
|
1880
1900
|
requestArg.signal.addEventListener('abort', () => { this.pending.delete(id); this.changed(threadId, 'permissions.changed'); }, { once: true });
|
|
1881
1901
|
if (requestArg.signal.aborted) { this.pending.delete(id); return; }
|
|
@@ -1908,6 +1928,22 @@ export class CodexClientAdapter {
|
|
|
1908
1928
|
if (!this.supervisor.requireClient().respond(pending.request.id, { answers })) throw new Error('Codex question expired before the reply.');
|
|
1909
1929
|
}
|
|
1910
1930
|
|
|
1931
|
+
/**
|
|
1932
|
+
* Answers an MCP elicitation on the JSON-RPC id Codex asked it with, once the owner's reply fits its card: a reply
|
|
1933
|
+
* that does not fit is refused and Codex keeps waiting.
|
|
1934
|
+
*/
|
|
1935
|
+
public replyElicitation(threadIdArg: string, idArg: string, replyArg: TControllerElicitationReply): void {
|
|
1936
|
+
this.scope(threadIdArg);
|
|
1937
|
+
const pending = this.pending.get(idArg);
|
|
1938
|
+
if (!pending?.elicitation || pending.request.params.threadId !== threadIdArg) {
|
|
1939
|
+
throw new ControllerElicitationReplyError('The MCP request is no longer pending in this conversation.', 'not_found');
|
|
1940
|
+
}
|
|
1941
|
+
const answer = controllerElicitationAnswer(pending.elicitation, replyArg);
|
|
1942
|
+
if (!this.supervisor.requireClient().respond(pending.request.id, { action: answer.action, content: answer.content ?? null, _meta: null })) {
|
|
1943
|
+
throw new ControllerElicitationReplyError('The MCP request expired before the reply.', 'not_found');
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1911
1947
|
/**
|
|
1912
1948
|
* A session change carries the live status with it, as OpenCode's status events do: the browser
|
|
1913
1949
|
* follows the turn from these events instead of waiting for its next conversation list.
|