agl 43.3.1 → 43.4.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.
Files changed (85) hide show
  1. package/changelog.md +22 -0
  2. package/dist_serve/bundle.js +1377 -1375
  3. package/dist_serve/bundle.js.map +2 -2
  4. package/dist_ts/00_commitinfo_data.js +1 -1
  5. package/dist_ts/aglapi/interfaces.d.ts +5 -0
  6. package/dist_ts/aglapi/interfaces.js +2 -1
  7. package/dist_ts/classes.authstore.js +5 -2
  8. package/dist_ts/classes.claudeharness.js +4 -3
  9. package/dist_ts/classes.codexclientadapter.d.ts +5 -0
  10. package/dist_ts/classes.codexclientadapter.js +12 -6
  11. package/dist_ts/classes.controller.d.ts +33 -9
  12. package/dist_ts/classes.controller.js +173 -113
  13. package/dist_ts/classes.flexservice.d.ts +12 -1
  14. package/dist_ts/classes.flexservice.js +44 -13
  15. package/dist_ts/classes.flexstore.d.ts +20 -0
  16. package/dist_ts/classes.flexstore.js +30 -1
  17. package/dist_ts/classes.mcpclient.d.ts +2 -2
  18. package/dist_ts/classes.mcpclient.js +14 -9
  19. package/dist_ts/classes.mcptools.d.ts +1 -1
  20. package/dist_ts/classes.mcptools.js +2 -1
  21. package/dist_ts/classes.opencodeclient.js +20 -4
  22. package/dist_ts/driver/functions.driverinstructions.d.ts +1 -1
  23. package/dist_ts/driver/functions.driverinstructions.js +2 -1
  24. package/dist_ts/fleet/classes.deploymodels.d.ts +58 -1
  25. package/dist_ts/fleet/classes.deploymodels.js +121 -2
  26. package/dist_ts/fleet/classes.deploymonitor.d.ts +193 -47
  27. package/dist_ts/fleet/classes.deploymonitor.js +548 -180
  28. package/dist_ts/fleet/classes.gitfacts.d.ts +4 -1
  29. package/dist_ts/fleet/classes.gitfacts.js +13 -10
  30. package/dist_ts/fleet/classes.service.d.ts +2 -0
  31. package/dist_ts/fleet/classes.service.js +6 -3
  32. package/dist_ts/fleet/functions.deployprobes.js +21 -2
  33. package/dist_ts/fleet/functions.deploystatus.d.ts +26 -0
  34. package/dist_ts/fleet/functions.deploystatus.js +33 -0
  35. package/dist_ts/fleet/functions.deployvalidation.d.ts +1 -0
  36. package/dist_ts/fleet/functions.deployvalidation.js +5 -2
  37. package/dist_ts/functions.deploycli.js +3 -2
  38. package/dist_ts/functions.deviceapi.d.ts +7 -6
  39. package/dist_ts/functions.deviceapi.js +13 -5
  40. package/dist_ts/functions.mcpdeploytools.js +3 -1
  41. package/dist_ts/functions.promptreply.d.ts +13 -0
  42. package/dist_ts/functions.promptreply.js +17 -0
  43. package/dist_ts/interfaces.flexipc.d.ts +17 -9
  44. package/dist_ts/interfaces.flexipc.js +19 -20
  45. package/dist_ts_interfaces/deployments.d.ts +38 -6
  46. package/dist_ts_interfaces/deployments.js +7 -3
  47. package/dist_ts_interfaces/devices.d.ts +2 -1
  48. package/dist_ts_interfaces/devices.js +1 -1
  49. package/dist_ts_interfaces/inbox.d.ts +10 -1
  50. package/dist_ts_interfaces/inbox.js +1 -1
  51. package/dist_ts_interfaces/mcprequests.d.ts +1 -1
  52. package/package.json +5 -5
  53. package/readme.md +30 -12
  54. package/ts/00_commitinfo_data.ts +1 -1
  55. package/ts/aglapi/interfaces.ts +1 -0
  56. package/ts/classes.authstore.ts +4 -1
  57. package/ts/classes.claudeharness.ts +3 -2
  58. package/ts/classes.codexclientadapter.ts +11 -5
  59. package/ts/classes.controller.ts +188 -128
  60. package/ts/classes.flexservice.ts +57 -14
  61. package/ts/classes.flexstore.ts +40 -0
  62. package/ts/classes.mcpclient.ts +14 -5
  63. package/ts/classes.mcptools.ts +1 -0
  64. package/ts/classes.opencodeclient.ts +23 -3
  65. package/ts/driver/functions.driverinstructions.ts +1 -0
  66. package/ts/fleet/classes.deploymodels.ts +113 -1
  67. package/ts/fleet/classes.deploymonitor.ts +565 -179
  68. package/ts/fleet/classes.gitfacts.ts +10 -8
  69. package/ts/fleet/classes.service.ts +7 -1
  70. package/ts/fleet/functions.deployprobes.ts +16 -1
  71. package/ts/fleet/functions.deploystatus.ts +56 -0
  72. package/ts/fleet/functions.deployvalidation.ts +4 -1
  73. package/ts/functions.deploycli.ts +2 -1
  74. package/ts/functions.deviceapi.ts +19 -9
  75. package/ts/functions.mcpdeploytools.ts +2 -0
  76. package/ts/functions.promptreply.ts +20 -0
  77. package/ts/interfaces.flexipc.ts +43 -27
  78. package/ts_interfaces/deployments.ts +39 -6
  79. package/ts_interfaces/devices.schema.json +1 -1
  80. package/ts_interfaces/devices.ts +2 -1
  81. package/ts_interfaces/inbox.ts +8 -1
  82. package/ts_web/00_commitinfo_data.ts +1 -1
  83. package/ts_web/elements.deployments.ts +20 -4
  84. package/ts_web/elements.harnesscontrollerapp.ts +43 -13
  85. package/ts_web/elements.inbox.ts +3 -3
@@ -12,15 +12,22 @@ export interface IDeploymentsSender {
12
12
  fire<TRequest extends interfaces.TControllerRequest>(
13
13
  methodArg: TRequest['method'],
14
14
  requestArg: TRequest['request'],
15
- optionsArg?: { abortSignal?: AbortSignal },
15
+ optionsArg?: { abortSignal?: AbortSignal; timeoutMs?: number; maxRetries?: number },
16
16
  ): Promise<TRequest['response']>;
17
17
  }
18
18
 
19
19
  const deploy = <TOperation extends interfaces.TFleetDeployOperation>(senderArg: IDeploymentsSender, operationArg: TOperation,
20
- requestArg: interfaces.IFleetDeployOperations[TOperation]['request']): Promise<interfaces.IFleetDeployOperations[TOperation]['response']> => (
21
- senderArg.fire<interfaces.TControllerDeployTypedRequest>(`controller.deploy.${operationArg}`, requestArg as never) as Promise<
20
+ requestArg: interfaces.IFleetDeployOperations[TOperation]['request'], optionsArg?: { timeoutMs?: number; maxRetries?: number },
21
+ ): Promise<interfaces.IFleetDeployOperations[TOperation]['response']> => (
22
+ senderArg.fire<interfaces.TControllerDeployTypedRequest>(`controller.deploy.${operationArg}`, requestArg as never, optionsArg) as Promise<
22
23
  interfaces.IFleetDeployOperations[TOperation]['response']>
23
24
  );
25
+ /** A full check now (`controller.deploy.refresh`): the controller answers within `fleetDeployRefreshWaitMs`, so the request waits longer, and it is never resent. */
26
+ const refreshDeployments = (senderArg: IDeploymentsSender): Promise<interfaces.IFleetDeployRefreshResult> => (
27
+ deploy(senderArg, 'refresh', {}, {
28
+ timeoutMs: interfaces.fleetDeployRefreshWaitMs + interfaces.fleetDeployRefreshClientMarginMs, maxRetries: 0,
29
+ })
30
+ );
24
31
  const ticket = <TMethod extends interfaces.TTicketOperation>(senderArg: IDeploymentsSender, operationArg: TMethod,
25
32
  requestArg: interfaces.TTicketRequest<TMethod>): Promise<interfaces.TTicketResponse<TMethod>> => (
26
33
  senderArg.fire<interfaces.TControllerTicketTypedRequest>(`controller.ticket.${operationArg}`, requestArg as never) as Promise<interfaces.TTicketResponse<TMethod>>
@@ -124,9 +131,15 @@ export class AglDeployments extends plugins.deesElement.DeesElement {
124
131
  `,
125
132
  ];
126
133
 
134
+ /**
135
+ * Opening the view shows the stored status at once and asks the controller for a full check in the background
136
+ * (AGL-1704); its end comes back as `deployments.changed`, which reads again. A failed check shows as the status's
137
+ * failure, so the request's own answer is not waited for.
138
+ */
127
139
  public async connectedCallback(): Promise<void> {
128
140
  await super.connectedCallback();
129
141
  void this.refresh();
142
+ if (this.sender) void refreshDeployments(this.sender).catch(() => undefined);
130
143
  }
131
144
 
132
145
  public async disconnectedCallback(): Promise<void> {
@@ -184,6 +197,8 @@ export class AglDeployments extends plugins.deesElement.DeesElement {
184
197
  </div>
185
198
  </div>
186
199
  ${this.error ? html`<p class="error" role="alert">${this.error}</p>` : ''}
200
+ ${status?.failure ? html`<p class="checkFailed error" role="status">The last check failed at ${deployClock(status.failure.at)}: ${status.failure.message}
201
+ What is shown is from ${deployClock(status.checkedAt)}. (ref ${status.failure.reference})</p>` : ''}
187
202
  <dees-statsgrid density="compact" .minTileWidth=${220} .tiles=${summary ? this.tiles(summary) : []}></dees-statsgrid>
188
203
  ${this.renderTargets(summary)}
189
204
  <div class="lower">
@@ -372,12 +387,13 @@ export class AglDeployments extends plugins.deesElement.DeesElement {
372
387
  this.dispatchEvent(new CustomEvent('deploy-open-ticket', { detail: { key: keyArg }, bubbles: true, composed: true }));
373
388
  }
374
389
 
390
+ /** "Probe all": one full check (`refresh`), waited for as long as the controller waits; then the view reads again. */
375
391
  private async probeAll(): Promise<void> {
376
392
  const sender = this.sender;
377
393
  if (!sender || !this.status) return;
378
394
  this.probing = true;
379
395
  try {
380
- for (const target of this.status.targets) await deploy(sender, 'probe', { targetId: target.target.id });
396
+ await refreshDeployments(sender);
381
397
  } catch (errorArg) {
382
398
  this.error = errorArg instanceof Error ? errorArg.message : String(errorArg);
383
399
  } finally {
@@ -1308,6 +1308,13 @@ const concatBytes = (chunksArg: readonly Uint8Array[]): Uint8Array => {
1308
1308
  const isElicitationRefusal = (errorArg: unknown): boolean => errorArg instanceof plugins.typedrequest.TypedResponseError
1309
1309
  && (errorArg.errorData?.code === 'invalid_request' || errorArg.errorData?.code === 'not_found');
1310
1310
 
1311
+ /**
1312
+ * The controller refused an answer because the permission or question was answered or changed meanwhile: nothing was
1313
+ * sent, and the conversation is read again.
1314
+ */
1315
+ const isConcurrentChange = (errorArg: unknown): boolean => errorArg instanceof plugins.typedrequest.TypedResponseError
1316
+ && errorArg.errorData?.code === 'concurrent_change';
1317
+
1311
1318
  const errorMessage = (errorArg: unknown): string => {
1312
1319
  if (errorArg instanceof Error && errorArg.message) {
1313
1320
  return errorArg.message;
@@ -5178,10 +5185,24 @@ export class HarnessControllerApp extends plugins.deesElement.DeesElement {
5178
5185
  }
5179
5186
  }
5180
5187
 
5188
+ /**
5189
+ * Loads the workspace after sign-in. Only the projects gate the conversations, terminals and
5190
+ * resources, which read the selected project; every other read runs beside them and holds
5191
+ * nothing back. It resolves once every read has settled.
5192
+ */
5181
5193
  private async loadWorkspaceData(): Promise<void> {
5182
5194
  this.scheduleSystemMetricsRefresh(0);
5183
5195
  await Promise.all([
5184
- this.refreshProjects(),
5196
+ this.refreshProjects().then(async () => {
5197
+ void this.retryStaleDraftSessionCleanup();
5198
+ void this.refreshModelCatalog();
5199
+ await this.refreshSessions();
5200
+ // A link to the Deployments view, as the board's "Open in Deployments" opens in a new tab, shows it once.
5201
+ if (globalThis.location?.hash === deploymentsHref) {
5202
+ globalThis.history.replaceState(globalThis.history.state, '', `${globalThis.location.pathname}${globalThis.location.search}`);
5203
+ await this.openDeployments();
5204
+ }
5205
+ }),
5185
5206
  this.refreshProviderManagement(),
5186
5207
  this.reconcileControllerStatus(),
5187
5208
  this.refreshDriverStatus(),
@@ -5190,14 +5211,6 @@ export class HarnessControllerApp extends plugins.deesElement.DeesElement {
5190
5211
  this.refreshSessionFeed(),
5191
5212
  this.inboxFeed.refresh(),
5192
5213
  ]);
5193
- void this.retryStaleDraftSessionCleanup();
5194
- void this.refreshModelCatalog();
5195
- await this.refreshSessions();
5196
- // A link to the Deployments view, as the board's "Open in Deployments" opens in a new tab, shows it once.
5197
- if (globalThis.location?.hash === deploymentsHref) {
5198
- globalThis.history.replaceState(globalThis.history.state, '', `${globalThis.location.pathname}${globalThis.location.search}`);
5199
- await this.openDeployments();
5200
- }
5201
5214
  }
5202
5215
 
5203
5216
  private scheduleSystemMetricsRefresh(delayMsArg: number): void {
@@ -13779,7 +13792,14 @@ ${entry.detail.stack}`}</pre>`}
13779
13792
  }
13780
13793
  } catch (error) {
13781
13794
  if (this.isCurrentMutation(mutationId, generation, sessionId)) {
13782
- this.reportWorkspaceError('Answer the permission request', error);
13795
+ if (isConcurrentChange(error) && sessionId) {
13796
+ // Nothing was sent: the card drops the answer it showed and the conversation is read again.
13797
+ this.answeredPermissionCards.delete(controllerRuntimeIdToUiKey(requestIdArg));
13798
+ this.noteComposer(errorMessage(error));
13799
+ await this.loadSessionDetail(sessionId);
13800
+ } else {
13801
+ this.reportWorkspaceError('Answer the permission request', error);
13802
+ }
13783
13803
  }
13784
13804
  } finally {
13785
13805
  this.finishMutation(mutationId);
@@ -14720,7 +14740,17 @@ ${entry.detail.stack}`}</pre>`}
14720
14740
  }
14721
14741
  } catch (error) {
14722
14742
  if (this.isCurrentMutation(mutationId, generation, sessionId)) {
14723
- this.reportWorkspaceError('Answer the question', error);
14743
+ if (isConcurrentChange(error) && sessionId) {
14744
+ // Nothing was sent: the cards drop the answers they showed and the conversation is read again.
14745
+ const requestKey = controllerRuntimeIdToUiKey(requestIdArg);
14746
+ answersArg.forEach((_answersArg, indexArg) => {
14747
+ this.answeredQuestionCards.delete(questionCardId(requestKey, answersArg.length, indexArg));
14748
+ });
14749
+ this.noteComposer(errorMessage(error));
14750
+ await this.loadSessionDetail(sessionId);
14751
+ } else {
14752
+ this.reportWorkspaceError('Answer the question', error);
14753
+ }
14724
14754
  }
14725
14755
  } finally {
14726
14756
  this.finishMutation(mutationId);
@@ -16992,10 +17022,10 @@ ${entry.detail.stack}`}</pre>`}
16992
17022
  }
16993
17023
  return;
16994
17024
  }
16995
- // Tickets change only an open board and the open questions of the direct reports the driver lists.
17025
+ // Tickets change only an open board and the open questions of the direct reports the driver lists. What a board
17026
+ // change does to the Deployments view the controller computes, and tells with `deployments.changed` (AGL-1704).
16996
17027
  if (eventArg.type === 'tickets.changed') {
16997
17028
  void this.ticketBoard()?.refresh();
16998
- void this.deploymentsView()?.refresh();
16999
17029
  if (this.driverShown()) void this.refreshDirectReports();
17000
17030
  return;
17001
17031
  }
@@ -49,7 +49,7 @@ const answeredHere = (itemArg: TInboxItem): boolean => {
49
49
  switch (itemArg.kind) {
50
50
  case 'permission': return itemArg.permission !== undefined;
51
51
  case 'question': return itemArg.question !== undefined;
52
- case 'elicitation': return itemArg.elicitation !== undefined && itemArg.answer !== 'child';
52
+ case 'elicitation': return itemArg.elicitation !== undefined;
53
53
  case 'ticket_question': case 'deploy_go': case 'window_go': return itemArg.question !== undefined;
54
54
  case 'native_wait': case 'driver': return false;
55
55
  }
@@ -607,8 +607,6 @@ export class AglInbox extends plugins.deesElement.DeesElement {
607
607
  await senderArg.fire<interfaces.IReq_ControllerNativeSessionElicitationReply>('controller.nativesession.elicitation.reply',
608
608
  { session: where.session, requestId: elicitation.id, reply });
609
609
  return;
610
- case 'child':
611
- throw new InboxNotSentError('A subagent\'s MCP form is answered in its session view, so nothing was sent.');
612
610
  }
613
611
  });
614
612
  }
@@ -691,6 +689,8 @@ export class AglInbox extends plugins.deesElement.DeesElement {
691
689
  return;
692
690
  }
693
691
  this.refuse(stateArg, failureArg.message);
692
+ // Answered or changed meanwhile: nothing was done, and the Inbox reads again.
693
+ if (failureArg.code === 'concurrent_change') void this.feed!.refresh();
694
694
  }
695
695
 
696
696
  /** A refusal: nothing was stored, and the card takes an answer again with the owner's draft. */