agl 43.0.0 → 43.0.1

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.
@@ -245,9 +245,15 @@ interface IObservedCleanupOperation {
245
245
  waiters: Set<(outcomeArg: TCleanupOperationOutcome) => void>;
246
246
  }
247
247
 
248
+ interface IBrowserCapabilityResource {
249
+ projectId: string;
250
+ browserResourceId: string;
251
+ }
252
+
248
253
  interface ICapabilityRevocationOperation extends IObservedCleanupOperation {
249
254
  runtime: plugins.browserRuntime.BrowserRuntime;
250
255
  owner: TBrowserCapabilityOwner;
256
+ resource?: IBrowserCapabilityResource;
251
257
  onFulfilled: Set<() => void>;
252
258
  }
253
259
 
@@ -626,7 +632,7 @@ export class ControllerBrowserResourceHost implements IControllerResourceRuntime
626
632
  let result: TControllerMcpBrowserActionResult | undefined;
627
633
  try {
628
634
  await this.retryPendingCapabilityRevocations(
629
- Date.now() + browserCapabilityAuthorizationTimeoutMs, admission.abortController.signal,
635
+ Date.now() + browserCapabilityAuthorizationTimeoutMs, admission.abortController.signal, undefined, binding,
630
636
  );
631
637
  if (this.lateCapabilityIssuanceTasks.size >= maximumPendingFlexCapabilityIssuances) {
632
638
  throw new Error('Browser capability issuance capacity was reached.');
@@ -678,9 +684,9 @@ export class ControllerBrowserResourceHost implements IControllerResourceRuntime
678
684
  const cleanupErrors: unknown[] = [];
679
685
  try {
680
686
  if (issuance) {
681
- this.trackLateCapabilityIssuance(runtime, issuance, 'mcp');
687
+ this.trackLateCapabilityIssuance(runtime, issuance, 'mcp', binding);
682
688
  } else if (capabilityId) {
683
- this.trackCapabilityRevocation(runtime, capabilityId, 'mcp');
689
+ this.trackCapabilityRevocation(runtime, capabilityId, 'mcp', undefined, binding);
684
690
  await this.awaitCapabilityRevocation(capabilityId, Date.now() + this.cleanupTimeoutMs);
685
691
  }
686
692
  } catch (errorArg) { cleanupErrors.push(errorArg); }
@@ -827,6 +833,8 @@ export class ControllerBrowserResourceHost implements IControllerResourceRuntime
827
833
  await this.retryPendingCapabilityRevocations(
828
834
  Date.now() + browserCapabilityAuthorizationTimeoutMs,
829
835
  admission.abortController.signal,
836
+ undefined,
837
+ binding,
830
838
  );
831
839
  if (this.lateCapabilityIssuanceTasks.size >= maximumPendingFlexCapabilityIssuances) {
832
840
  throw new Error('Browser capability issuance capacity was reached.');
@@ -866,7 +874,7 @@ export class ControllerBrowserResourceHost implements IControllerResourceRuntime
866
874
  } catch (errorArg) {
867
875
  const cleanupErrors: unknown[] = [];
868
876
  if (issuancePromise) {
869
- this.trackLateCapabilityIssuance(runtime, issuancePromise, 'flex');
877
+ this.trackLateCapabilityIssuance(runtime, issuancePromise, 'flex', binding);
870
878
  issuancePromise = undefined;
871
879
  }
872
880
  if (channelRegistered) {
@@ -883,7 +891,7 @@ export class ControllerBrowserResourceHost implements IControllerResourceRuntime
883
891
  inbound.destroy();
884
892
  outbound.destroy();
885
893
  if (capabilityId) {
886
- this.trackCapabilityRevocation(runtime, capabilityId, 'flex');
894
+ this.trackCapabilityRevocation(runtime, capabilityId, 'flex', undefined, binding);
887
895
  await this.awaitCapabilityRevocation(
888
896
  capabilityId,
889
897
  Date.now() + this.cleanupTimeoutMs,
@@ -965,6 +973,7 @@ export class ControllerBrowserResourceHost implements IControllerResourceRuntime
965
973
  channel.capabilityId,
966
974
  'flex',
967
975
  () => { channel.capabilityRevoked = true; },
976
+ channel.binding,
968
977
  );
969
978
  await this.awaitCapabilityRevocation(channel.capabilityId, deadlineAtArg);
970
979
  channel.capabilityRevoked = true;
@@ -1199,6 +1208,8 @@ export class ControllerBrowserResourceHost implements IControllerResourceRuntime
1199
1208
  await this.retryPendingCapabilityRevocations(
1200
1209
  Date.now() + browserCapabilityAuthorizationTimeoutMs,
1201
1210
  admission.abortController.signal,
1211
+ undefined,
1212
+ binding,
1202
1213
  );
1203
1214
  if (this.lateCapabilityIssuanceTasks.size >= maximumPendingFlexCapabilityIssuances) {
1204
1215
  throw new Error('Browser capability issuance capacity was reached.');
@@ -1291,6 +1302,7 @@ export class ControllerBrowserResourceHost implements IControllerResourceRuntime
1291
1302
  capabilityId,
1292
1303
  'human',
1293
1304
  () => { capabilityRevoked = true; },
1305
+ binding,
1294
1306
  );
1295
1307
  await this.awaitCapabilityRevocation(capabilityId, deadlineAt).then(
1296
1308
  () => { capabilityRevoked = true; },
@@ -1307,9 +1319,9 @@ export class ControllerBrowserResourceHost implements IControllerResourceRuntime
1307
1319
  } catch (errorArg) {
1308
1320
  const cleanupErrors: unknown[] = [];
1309
1321
  if (issuancePromise) {
1310
- this.trackLateCapabilityIssuance(runtime, issuancePromise, 'human');
1322
+ this.trackLateCapabilityIssuance(runtime, issuancePromise, 'human', binding);
1311
1323
  } else if (capabilityId && !capabilityRevoked) {
1312
- this.trackCapabilityRevocation(runtime, capabilityId, 'human');
1324
+ this.trackCapabilityRevocation(runtime, capabilityId, 'human', undefined, binding);
1313
1325
  await this.awaitCapabilityRevocation(
1314
1326
  capabilityId,
1315
1327
  Date.now() + this.cleanupTimeoutMs,
@@ -1474,9 +1486,12 @@ export class ControllerBrowserResourceHost implements IControllerResourceRuntime
1474
1486
  capabilityIdArg: string,
1475
1487
  ownerArg: TBrowserCapabilityOwner,
1476
1488
  onFulfilledArg?: () => void,
1489
+ resourceArg?: IBrowserCapabilityResource,
1477
1490
  ): void {
1478
1491
  const existing = this.capabilityRevocationOperations.get(capabilityIdArg);
1479
- if (existing && existing.owner !== ownerArg) {
1492
+ if (existing && (existing.owner !== ownerArg || (existing.resource && resourceArg
1493
+ && (existing.resource.projectId !== resourceArg.projectId
1494
+ || existing.resource.browserResourceId !== resourceArg.browserResourceId)))) {
1480
1495
  throw new Error('Browser capability cleanup ownership changed unexpectedly.');
1481
1496
  }
1482
1497
  if (existing && existing.outcome?.status !== 'rejected') {
@@ -1503,6 +1518,8 @@ export class ControllerBrowserResourceHost implements IControllerResourceRuntime
1503
1518
  ) as ICapabilityRevocationOperation;
1504
1519
  operation.runtime = runtimeArg;
1505
1520
  operation.owner = ownerArg;
1521
+ const resource = resourceArg ?? existing?.resource;
1522
+ if (resource) operation.resource = { projectId: resource.projectId, browserResourceId: resource.browserResourceId };
1506
1523
  operation.onFulfilled = onFulfilled;
1507
1524
  this.capabilityRevocationOperations.set(capabilityIdArg, operation);
1508
1525
  }
@@ -1527,10 +1544,11 @@ export class ControllerBrowserResourceHost implements IControllerResourceRuntime
1527
1544
  runtimeArg: plugins.browserRuntime.BrowserRuntime,
1528
1545
  issuancePromiseArg: ReturnType<plugins.browserRuntime.BrowserRuntime['issueCapability']>,
1529
1546
  ownerArg: TBrowserCapabilityOwner,
1547
+ resourceArg?: IBrowserCapabilityResource,
1530
1548
  ): void {
1531
1549
  const task = (async () => {
1532
1550
  const issued = await issuancePromiseArg;
1533
- this.trackCapabilityRevocation(runtimeArg, issued.capabilityId, ownerArg);
1551
+ this.trackCapabilityRevocation(runtimeArg, issued.capabilityId, ownerArg, undefined, resourceArg);
1534
1552
  await this.awaitCapabilityRevocation(
1535
1553
  issued.capabilityId,
1536
1554
  Date.now() + this.cleanupTimeoutMs,
@@ -1560,18 +1578,24 @@ export class ControllerBrowserResourceHost implements IControllerResourceRuntime
1560
1578
  deadlineAtArg: number,
1561
1579
  signalArg?: AbortSignal,
1562
1580
  ownerArg?: TBrowserCapabilityOwner,
1581
+ resourceArg?: IBrowserCapabilityResource,
1563
1582
  ): Promise<void> {
1564
- const entries = [...this.capabilityRevocationOperations.entries()].filter(([, operation]) => (
1565
- ownerArg === undefined || operation.owner === ownerArg
1566
- ));
1583
+ // Unknown scope remains a global fence; shutdown omits the scope and drains every resource.
1584
+ const matches = (operationArg: ICapabilityRevocationOperation): boolean => (
1585
+ (ownerArg === undefined || operationArg.owner === ownerArg)
1586
+ && (resourceArg === undefined || operationArg.resource === undefined
1587
+ || (operationArg.resource.projectId === resourceArg.projectId
1588
+ && operationArg.resource.browserResourceId === resourceArg.browserResourceId))
1589
+ );
1590
+ const entries = [...this.capabilityRevocationOperations.entries()].filter(([, operation]) => matches(operation));
1567
1591
  for (const [capabilityId, operation] of entries) {
1568
1592
  if (operation.outcome?.status === 'rejected') {
1569
- this.trackCapabilityRevocation(operation.runtime, capabilityId, operation.owner);
1593
+ this.trackCapabilityRevocation(operation.runtime, capabilityId, operation.owner, undefined, operation.resource);
1570
1594
  }
1571
1595
  }
1572
1596
  const results = await Promise.allSettled(
1573
1597
  [...this.capabilityRevocationOperations.entries()]
1574
- .filter(([, operation]) => ownerArg === undefined || operation.owner === ownerArg)
1598
+ .filter(([, operation]) => matches(operation))
1575
1599
  .map(([capabilityId]) => (
1576
1600
  this.awaitCapabilityRevocation(capabilityId, deadlineAtArg, signalArg)
1577
1601
  )),
@@ -33258,10 +33258,12 @@ export class OpenCodeController {
33258
33258
  || transportPeer.id !== peerArg.id
33259
33259
  || transportPeer !== peerArg
33260
33260
  || transportPeer.context.state[authenticatedPeerStateKey] !== credentialId
33261
- || this.resourceCoordinator?.isResourceRetiring(resource.projectId, resource.id)
33262
33261
  ) {
33263
33262
  throw new ControllerResourceUnavailableError('The browser peer is no longer authenticated.');
33264
33263
  }
33264
+ if (this.resourceCoordinator?.isResourceRetiring(resource.projectId, resource.id)) {
33265
+ throw new ControllerResourceUnavailableError('The browser resource is being retired; its cleanup has not finished.');
33266
+ }
33265
33267
  const viewId = plugins.crypto.randomBytes(18).toString('base64url');
33266
33268
  let view: IControllerBrowserView | undefined;
33267
33269
  let handle: IControllerBrowserView['handle'] | undefined;
@@ -33309,12 +33311,14 @@ export class OpenCodeController {
33309
33311
  || !this.authenticatedPeerIds.has(peerArg.id)
33310
33312
  || transportPeer.context.state[authenticatedPeerStateKey] !== credentialId
33311
33313
  || this.authenticatedPeerGenerations.get(transportPeer) !== authenticationGeneration
33312
- || this.resourceCoordinator?.isResourceRetiring(resource.projectId, resource.id)
33313
33314
  ) {
33314
33315
  throw new ControllerResourceUnavailableError(
33315
33316
  'The browser peer disconnected before the view was published.',
33316
33317
  );
33317
33318
  }
33319
+ if (this.resourceCoordinator?.isResourceRetiring(resource.projectId, resource.id)) {
33320
+ throw new ControllerResourceUnavailableError('The browser resource is being retired; its cleanup has not finished.');
33321
+ }
33318
33322
  this.browserViews.set(view.id, view);
33319
33323
  const transport = await this.createBrowserViewTransport(view, 1);
33320
33324
  this.beginBrowserViewTransportOpening(view, transport);
@@ -395,7 +395,9 @@ export class ControllerMcpHost {
395
395
  port: 0,
396
396
  listenHostname: '127.0.0.1',
397
397
  cors: false,
398
- connectionTimeout: 30_000,
398
+ // A local deploy CLI may legitimately wait up to two minutes for joined Git/probe reads.
399
+ // Body and header admission stay short; each caller still owns its request deadline.
400
+ connectionTimeout: 125_000,
399
401
  headersTimeout: 5_000,
400
402
  requestTimeout: 30_000,
401
403
  cleanupTimeoutMs: 5_000,
@@ -1,3 +1,4 @@
1
+ import { compareFleetVersions, fleetVersion } from '../../ts_interfaces/functions.fleetversion.js';
1
2
  import * as plugins from '../plugins.js';
2
3
  import type { IFleetRepository } from '../../ts_interfaces/fleet.js';
3
4
  import type { TTicketData, TTicketLink } from '../../ts_interfaces/tickets.js';
@@ -58,25 +59,7 @@ export const findFleetRepository = <TRepo extends Pick<IFleetRepository, 'id' |
58
59
 
59
60
  export type TFleetGitRunner = (commandArg: string, argsArg: string[], cwdArg: string) => Promise<{ code: number; stdout: string; stderr: string }>;
60
61
 
61
- const versionPattern = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/u;
62
- /** A release version as a tag or probe gives it, without a leading `v`; undefined when it is no semantic version. */
63
- export const fleetVersion = (valueArg: string): string | undefined => {
64
- const match = versionPattern.exec(valueArg.trim());
65
- return match ? valueArg.trim().replace(/^v/u, '') : undefined;
66
- };
67
- /** Semantic version order; a prerelease sorts before its release. */
68
- export const compareFleetVersions = (leftArg: string, rightArg: string): number => {
69
- const left = versionPattern.exec(leftArg), right = versionPattern.exec(rightArg);
70
- if (!left || !right) return leftArg.localeCompare(rightArg);
71
- for (const index of [1, 2, 3]) {
72
- const difference = Number(left[index]) - Number(right[index]);
73
- if (difference) return difference;
74
- }
75
- if (left[4] === right[4]) return 0;
76
- if (left[4] === undefined) return 1;
77
- if (right[4] === undefined) return -1;
78
- return left[4].localeCompare(right[4], 'en', { numeric: true });
79
- };
62
+ export { compareFleetVersions, fleetVersion } from '../../ts_interfaces/functions.fleetversion.js';
80
63
 
81
64
  /** Whether a release link names this repository: by its repository when it carries one, else by a package the repository publishes. */
82
65
  export const fleetReleaseLinkMatches = (
@@ -1,4 +1,4 @@
1
- import { ControllerMcpClient } from './classes.mcpclient.js';
1
+ import { ControllerMcpClient, type IControllerMcpClientOptions } from './classes.mcpclient.js';
2
2
  import { withLocalConfigurationOwner } from './functions.configurationowner.js';
3
3
  import { withCliDiagnostics } from './functions.clidiagnostics.js';
4
4
  import { defaultControllerPort } from './classes.config.js';
@@ -130,10 +130,15 @@ export const releaseStatusLines = (statusArg: IFleetReleaseStatus): string[] =>
130
130
  ...repoArg.landedAfterLatest.map((ticketArg) => ` ${ticketArg.key} ${ticketArg.title}`),
131
131
  ]);
132
132
 
133
+ /** Fleet discovery, Git reads and joined probes can outlast the general 30-second private request budget. */
134
+ export const createDeployCliClient = (
135
+ optionsArg: Pick<IControllerMcpClientOptions, 'controllerPort' | 'paths'>,
136
+ ): ControllerMcpClient => new ControllerMcpClient({ ...optionsArg, requestTimeoutMs: 120_000 });
137
+
133
138
  export const runDeployCli = async (commandArg: 'deploy' | 'release', argsArg: string[]): Promise<void> => {
134
139
  if (argsArg.includes('--help') || argsArg.includes('-h')) { process.stdout.write(deployCliHelp); return; }
135
140
  try {
136
- const parsed = parseDeployCliArguments(commandArg, argsArg), client = new ControllerMcpClient({ controllerPort: parsed.port });
141
+ const parsed = parseDeployCliArguments(commandArg, argsArg), client = createDeployCliClient({ controllerPort: parsed.port });
137
142
  await withCliDiagnostics(async () => withLocalConfigurationOwner(client, parsed.port, async (ownerToken) => {
138
143
  const result = await client.deploy(parsed.operation, { ...parsed.request, ownerToken } as never);
139
144
  if (parsed.json) { process.stdout.write(`${JSON.stringify(result)}\n`); return; }
@@ -0,0 +1,20 @@
1
+ const versionPattern = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/u;
2
+ /** A release version as a tag or probe gives it, without a leading `v`; undefined when it is no semantic version. */
3
+ export const fleetVersion = (valueArg: string): string | undefined => {
4
+ const match = versionPattern.exec(valueArg.trim());
5
+ return match ? valueArg.trim().replace(/^v/u, '') : undefined;
6
+ };
7
+ /** Semantic version order; a prerelease sorts before its release. */
8
+ export const compareFleetVersions = (leftArg: string, rightArg: string): number => {
9
+ const left = versionPattern.exec(leftArg), right = versionPattern.exec(rightArg);
10
+ if (!left || !right) return leftArg.localeCompare(rightArg);
11
+ for (const index of [1, 2, 3]) {
12
+ const difference = Number(left[index]) - Number(right[index]);
13
+ if (difference) return difference;
14
+ }
15
+ if (left[4] === right[4]) return 0;
16
+ if (left[4] === undefined) return 1;
17
+ if (right[4] === undefined) return -1;
18
+ return left[4].localeCompare(right[4], 'en', { numeric: true });
19
+ };
20
+
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: 'agl',
6
- version: '43.0.0',
6
+ version: '43.0.1',
7
7
  description: 'Agent Gateway Layer for OpenCode, FlexHarness, and Codex sessions'
8
8
  }
@@ -1,3 +1,4 @@
1
+ import { compareFleetVersions } from '../ts_interfaces/functions.fleetversion.js';
1
2
  import type * as interfaces from '../ts_interfaces/index.js';
2
3
  import type { IKanbanDetailSection, IKanbanFact, TTone } from '@design.estate/dees-catalog';
3
4
 
@@ -25,8 +26,12 @@ const byPriority = <T extends { key: string; priority: interfaces.TTicketPriorit
25
26
  priorityRank[leftArg.priority] - priorityRank[rightArg.priority] || leftArg.key.localeCompare(rightArg.key, 'en', { numeric: true })
26
27
  );
27
28
 
29
+ /** Missing ancestry in an older tag is historical evidence, never an implicit rollback proposal. */
30
+ const newerDeployReleases = (targetArg: interfaces.IFleetDeployTargetStatus) => targetArg.notRunning.releases.filter((releaseArg) =>
31
+ !targetArg.running || compareFleetVersions(releaseArg.version, targetArg.running.version) > 0);
32
+
28
33
  export const isDeployTargetBehind = (targetArg: interfaces.IFleetDeployTargetStatus): boolean => (
29
- targetArg.notRunning.releases.length > 0 || targetArg.running?.rolledBack === true
34
+ newerDeployReleases(targetArg).length > 0 || targetArg.running?.rolledBack === true
30
35
  );
31
36
 
32
37
  export const summarizeDeployments = (statusArg: interfaces.IFleetDeployStatus): IDeploymentsSummary => {
@@ -175,7 +180,8 @@ export const deployNextStep = (targetArg: interfaces.IFleetDeployTargetStatus):
175
180
  if (hotfix) return { kind: 'hotfix', bug: hotfix };
176
181
  if (targetArg.deployPlans[0]) return { kind: 'deployPlan', plan: targetArg.deployPlans[0] };
177
182
  if (targetArg.plans[0]) return { kind: 'plan', plan: targetArg.plans[0] };
178
- if (targetArg.notRunning.releases[0]) return { kind: 'deploy', version: targetArg.notRunning.releases[0].version };
183
+ const next = newerDeployReleases(targetArg)[0];
184
+ if (next) return { kind: 'deploy', version: next.version };
179
185
  return { kind: 'none' };
180
186
  };
181
187