agl 43.13.0 → 44.0.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 +28 -0
- package/dist_serve/bundle.js +4473 -4235
- package/dist_serve/bundle.js.map +2 -2
- package/dist_serve/bundle.js.third-party-notices.json +29 -29
- package/dist_serve/bundle.js.third-party-notices.txt +29 -29
- package/dist_ts/00_commitinfo_data.js +2 -2
- package/dist_ts/aglapi/aglapisurface.document.js +37 -4
- package/dist_ts/classes.authstore.d.ts +60 -3
- package/dist_ts/classes.authstore.js +161 -13
- package/dist_ts/classes.controller.d.ts +63 -0
- package/dist_ts/classes.controller.js +502 -43
- package/dist_ts/classes.embeddeddb.js +7 -2
- package/dist_ts/classes.flexmodels.private.d.ts +39 -0
- package/dist_ts/classes.flexmodels.private.js +127 -1
- package/dist_ts/classes.flexprojectpreparation.d.ts +21 -0
- package/dist_ts/classes.flexprojectpreparation.js +69 -0
- package/dist_ts/classes.flexpromptqueue.d.ts +21 -1
- package/dist_ts/classes.flexpromptqueue.js +67 -7
- package/dist_ts/classes.flexrequestqueue.d.ts +11 -0
- package/dist_ts/classes.flexrequestqueue.js +40 -0
- package/dist_ts/classes.flexservice.d.ts +46 -14
- package/dist_ts/classes.flexservice.js +179 -55
- package/dist_ts/classes.flexstore.d.ts +68 -3
- package/dist_ts/classes.flexstore.js +277 -11
- package/dist_ts/classes.flexsubmissionmodels.d.ts +58 -0
- package/dist_ts/classes.flexsubmissionmodels.js +162 -0
- package/dist_ts/classes.flexsubmissionstore.d.ts +70 -0
- package/dist_ts/classes.flexsubmissionstore.js +323 -0
- package/dist_ts/classes.flexsupervisor.d.ts +10 -0
- package/dist_ts/classes.flexsupervisor.js +27 -1
- package/dist_ts/classes.harnessoperationmanager.d.ts +31 -0
- package/dist_ts/classes.harnessoperationmanager.js +69 -7
- package/dist_ts/classes.mcpclient.js +4 -3
- package/dist_ts/classes.mcpcontrollerhost.js +3 -2
- package/dist_ts/classes.pendingpromptstore.d.ts +11 -3
- package/dist_ts/classes.pendingpromptstore.js +66 -10
- package/dist_ts/classes.sessionidentityservice.d.ts +18 -1
- package/dist_ts/classes.sessionidentityservice.js +34 -4
- package/dist_ts/classes.ticketstore.d.ts +5 -3
- package/dist_ts/classes.ticketstore.js +7 -2
- package/dist_ts/classes.validation.d.ts +3 -0
- package/dist_ts/classes.validation.js +50 -1
- package/dist_ts/functions.deviceapi.js +7 -3
- package/dist_ts/interfaces.auth.d.ts +3 -1
- package/dist_ts/interfaces.auth.js +1 -1
- package/dist_ts/interfaces.flexipc.d.ts +29 -5
- package/dist_ts/interfaces.flexipc.js +13 -4
- package/dist_ts_authswitch/classes.authoritydatabase.d.ts +1 -0
- package/dist_ts_authswitch/classes.authoritydatabase.js +17 -5
- package/dist_ts_interfaces/flexadmission.d.ts +69 -0
- package/dist_ts_interfaces/flexadmission.js +2 -0
- package/dist_ts_interfaces/index.d.ts +1 -0
- package/dist_ts_interfaces/index.js +2 -1
- package/dist_ts_interfaces/interfaces.d.ts +10 -1
- package/dist_ts_interfaces/interfaces.js +2 -2
- package/dist_ts_interfaces/requests.d.ts +2 -1
- package/dist_ts_interfaces/requests.js +1 -1
- package/dist_ts_interfaces/tickets.d.ts +9 -1
- package/dist_ts_interfaces/tickets.js +11 -2
- package/dist_ts_migration/v10_flexharnessv3migration.js +4 -1
- package/docs/nosqldb11-migration.md +59 -0
- package/package.json +10 -9
- package/readme.md +5 -1
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/aglapi/aglapisurface.document.ts +36 -3
- package/ts/classes.authstore.ts +179 -11
- package/ts/classes.controller.ts +498 -40
- package/ts/classes.embeddeddb.ts +6 -1
- package/ts/classes.flexmodels.private.ts +109 -0
- package/ts/classes.flexprojectpreparation.ts +69 -0
- package/ts/classes.flexpromptqueue.ts +69 -6
- package/ts/classes.flexrequestqueue.ts +47 -0
- package/ts/classes.flexservice.ts +187 -51
- package/ts/classes.flexstore.ts +352 -10
- package/ts/classes.flexsubmissionmodels.ts +89 -0
- package/ts/classes.flexsubmissionstore.ts +312 -0
- package/ts/classes.flexsupervisor.ts +26 -0
- package/ts/classes.harnessoperationmanager.ts +79 -6
- package/ts/classes.mcpclient.ts +3 -2
- package/ts/classes.mcpcontrollerhost.ts +2 -1
- package/ts/classes.pendingpromptstore.ts +55 -6
- package/ts/classes.sessionidentityservice.ts +33 -2
- package/ts/classes.ticketstore.ts +11 -4
- package/ts/classes.validation.ts +42 -0
- package/ts/functions.deviceapi.ts +6 -2
- package/ts/interfaces.auth.ts +3 -1
- package/ts/interfaces.flexipc.ts +38 -4
- package/ts_authswitch/classes.authoritydatabase.ts +19 -5
- package/ts_interfaces/flexadmission.ts +52 -0
- package/ts_interfaces/index.ts +2 -0
- package/ts_interfaces/interfaces.ts +10 -1
- package/ts_interfaces/requests.ts +3 -0
- package/ts_interfaces/tickets.ts +12 -2
- package/ts_migration/v10_flexharnessv3migration.ts +3 -0
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/classes.browsersubmissions.ts +279 -0
- package/ts_web/classes.sessiondraftsync.ts +64 -1
- package/ts_web/elements.harnesscontrollerapp.ts +340 -5
- package/ts_web/functions.flexsubmissions.ts +88 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { BrowserSubmissions } from './classes.browsersubmissions.js';
|
|
2
|
+
import { checkedFlexSubmissionReceipt, flexSubmissionFailure, flexSubmissionMessage, type TFlexBrowserSubmission } from './functions.flexsubmissions.js';
|
|
1
3
|
import { AglFlexCompaction, harnessSessionMetrics } from './elements.flexcompaction.js';
|
|
2
4
|
import { BrowserDialogPresenter } from './classes.browserdialogpresenter.js';
|
|
3
5
|
import { BrowserDevToolsClient } from './classes.browserdevtools.js';
|
|
@@ -165,6 +167,26 @@ interface IFormDataEventDetail {
|
|
|
165
167
|
data?: Record<string, unknown>;
|
|
166
168
|
}
|
|
167
169
|
|
|
170
|
+
interface IFlexBrowserConversationIntent {
|
|
171
|
+
projectId: string;
|
|
172
|
+
draftGeneration: number;
|
|
173
|
+
clientConversationId: string;
|
|
174
|
+
scratchpad: string;
|
|
175
|
+
sessionId?: interfaces.IControllerRuntimeId & { harnessId: 'flex' };
|
|
176
|
+
attaching?: boolean;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
interface IFlexBrowserComposerResume {
|
|
180
|
+
projectId: string;
|
|
181
|
+
sessionId?: TBrowserSessionId;
|
|
182
|
+
clientConversationId?: string;
|
|
183
|
+
text: string;
|
|
184
|
+
attachments: interfaces.IControllerDraftAttachment[];
|
|
185
|
+
model: string;
|
|
186
|
+
account: string;
|
|
187
|
+
effort: string;
|
|
188
|
+
}
|
|
189
|
+
|
|
168
190
|
interface ILocalSessionTurnMarker {
|
|
169
191
|
projectId: string;
|
|
170
192
|
sessionId: TBrowserSessionId;
|
|
@@ -2044,6 +2066,34 @@ export class HarnessControllerApp extends plugins.deesElement.DeesElement {
|
|
|
2044
2066
|
),
|
|
2045
2067
|
};
|
|
2046
2068
|
private readonly sessionDraftSync: SessionDraftSync;
|
|
2069
|
+
private readonly flexConversationIntents = new Map<string, IFlexBrowserConversationIntent>();
|
|
2070
|
+
private readonly flexBrowserSubmissions = new BrowserSubmissions<
|
|
2071
|
+
interfaces.IControllerFlexSubmissionInput, interfaces.IControllerFlexSubmissionReceipt
|
|
2072
|
+
>({
|
|
2073
|
+
admit: async (entry) => checkedFlexSubmissionReceipt(await this.socketClient.fire<interfaces.IReq_ControllerFlexSubmissionAdmit>(
|
|
2074
|
+
'controller.flex.submission.admit', entry.snapshot, { maxRetries: 0 },
|
|
2075
|
+
), entry.snapshot),
|
|
2076
|
+
lookup: async (entry) => {
|
|
2077
|
+
const answer = await this.socketClient.fire<interfaces.IReq_ControllerFlexSubmissionGet>(
|
|
2078
|
+
'controller.flex.submission.get',
|
|
2079
|
+
{ version: 1, projectId: entry.snapshot.projectId, clientMessageId: entry.id },
|
|
2080
|
+
{ maxRetries: 0, timeoutMs: 10_000 },
|
|
2081
|
+
);
|
|
2082
|
+
if (!answer || answer.version !== 1) throw new Error('The controller returned an invalid submission lookup.');
|
|
2083
|
+
return answer.receipt === null ? undefined : checkedFlexSubmissionReceipt(answer.receipt, entry.snapshot);
|
|
2084
|
+
},
|
|
2085
|
+
failure: flexSubmissionFailure,
|
|
2086
|
+
canContinue: (receipt) => receipt.creation === 'pending' || receipt.creation === 'ready',
|
|
2087
|
+
changed: () => {
|
|
2088
|
+
this.canonicalChatProjectionDirty = true;
|
|
2089
|
+
this.requestUpdate();
|
|
2090
|
+
if (this.flexBrowserMessagesModal?.isConnected) this.flexBrowserMessagesModal.content = this.renderFlexBrowserMessages();
|
|
2091
|
+
},
|
|
2092
|
+
admitted: (entry) => this.acceptFlexBrowserSubmission(entry),
|
|
2093
|
+
});
|
|
2094
|
+
private flexBrowserComposerResume?: IFlexBrowserComposerResume;
|
|
2095
|
+
private flexBrowserMessagesModal?: InstanceType<typeof plugins.deesCatalog.DeesModal>;
|
|
2096
|
+
private flexBrowserMessagesOpening = false;
|
|
2047
2097
|
private componentConnected = false;
|
|
2048
2098
|
private lifecycleGeneration = 0;
|
|
2049
2099
|
private connectionGeneration = 0;
|
|
@@ -4469,6 +4519,23 @@ export class HarnessControllerApp extends plugins.deesElement.DeesElement {
|
|
|
4469
4519
|
}
|
|
4470
4520
|
|
|
4471
4521
|
private invalidateAuthenticatedWorkspace(): void {
|
|
4522
|
+
if (this.authenticated && this.flexBrowserSubmissions.current.length > 0
|
|
4523
|
+
&& (this.selectedSessionId?.harnessId ?? this.draftHarnessId) === 'flex') {
|
|
4524
|
+
const sessionId = this.selectedSessionId;
|
|
4525
|
+
const intent = [...this.flexConversationIntents.values()].find((candidate) => candidate.projectId === this.selectedProjectId
|
|
4526
|
+
&& candidate.draftGeneration === this.draftSessionGeneration && this.draftSessionActive);
|
|
4527
|
+
const state = sessionId ? this.selectedDraftState(sessionId) : undefined;
|
|
4528
|
+
this.flexBrowserComposerResume = {
|
|
4529
|
+
projectId: this.selectedProjectId, sessionId, clientConversationId: intent?.clientConversationId,
|
|
4530
|
+
text: state?.text ?? this.localDraftText,
|
|
4531
|
+
attachments: structuredClone(state?.attachments ?? this.localDraftAttachments),
|
|
4532
|
+
model: this.resolveSessionModelString(sessionId), account: this.resolveSessionAccount(sessionId),
|
|
4533
|
+
effort: this.resolveSessionEffortString(sessionId),
|
|
4534
|
+
};
|
|
4535
|
+
}
|
|
4536
|
+
this.flexBrowserSubmissions.disconnect();
|
|
4537
|
+
void this.flexBrowserMessagesModal?.destroy();
|
|
4538
|
+
this.flexBrowserMessagesModal = undefined;
|
|
4472
4539
|
this.cancelComposerFocus();
|
|
4473
4540
|
this.sessionDraftSync.deactivate();
|
|
4474
4541
|
void this.closeBrowserView();
|
|
@@ -5192,9 +5259,11 @@ export class HarnessControllerApp extends plugins.deesElement.DeesElement {
|
|
|
5192
5259
|
* nothing back. It resolves once every read has settled.
|
|
5193
5260
|
*/
|
|
5194
5261
|
private async loadWorkspaceData(): Promise<void> {
|
|
5262
|
+
void this.flexBrowserSubmissions.reconnect();
|
|
5195
5263
|
this.scheduleSystemMetricsRefresh(0);
|
|
5196
5264
|
await Promise.all([
|
|
5197
5265
|
this.refreshProjects().then(async () => {
|
|
5266
|
+
this.restoreFlexBrowserComposer();
|
|
5198
5267
|
void this.retryStaleDraftSessionCleanup();
|
|
5199
5268
|
void this.refreshModelCatalog();
|
|
5200
5269
|
await this.refreshSessions();
|
|
@@ -6194,8 +6263,12 @@ export class HarnessControllerApp extends plugins.deesElement.DeesElement {
|
|
|
6194
6263
|
if (
|
|
6195
6264
|
changedPropertiesArg.has('selectedProjectId')
|
|
6196
6265
|
|| changedPropertiesArg.has('selectedSessionId')
|
|
6197
|
-
)
|
|
6266
|
+
) {
|
|
6267
|
+
this.forgetAcceptedFirstMessagesOffScreen();
|
|
6268
|
+
this.readFlexSubmissionReceiptsOnSelection(changedPropertiesArg);
|
|
6269
|
+
}
|
|
6198
6270
|
if (changedPropertiesArg.has('sessionDetail')) {
|
|
6271
|
+
this.reconcileFlexBrowserSubmissions();
|
|
6199
6272
|
this.reloadSlashCatalogOnRunStateChange(
|
|
6200
6273
|
changedPropertiesArg.get('sessionDetail') as IControllerSessionRenderDetail | undefined,
|
|
6201
6274
|
);
|
|
@@ -6896,6 +6969,7 @@ export class HarnessControllerApp extends plugins.deesElement.DeesElement {
|
|
|
6896
6969
|
if (firstMessage && !this.transcriptCarriesFirstMessage(messages, firstMessage)) {
|
|
6897
6970
|
messages.push(firstMessageHarnessMessage(firstMessage));
|
|
6898
6971
|
}
|
|
6972
|
+
messages.push(...this.flexSubmissionMessages(projectIdArg, sessionIdArg, detailArg));
|
|
6899
6973
|
this.mergeLiveReasoningMessages(messages, projectIdArg, sessionIdArg);
|
|
6900
6974
|
this.mergeLiveTextMessages(messages, projectIdArg, sessionIdArg);
|
|
6901
6975
|
this.mergeLiveToolMessages(messages, projectIdArg, sessionIdArg);
|
|
@@ -8682,6 +8756,7 @@ export class HarnessControllerApp extends plugins.deesElement.DeesElement {
|
|
|
8682
8756
|
for (const attention of reconciledDetail.childAttention ?? []) {
|
|
8683
8757
|
this.applyPendingChildEvent(attention.scopeGeneration, attention.sequence);
|
|
8684
8758
|
}
|
|
8759
|
+
this.reconcileFlexBrowserSubmissions();
|
|
8685
8760
|
this.ensureCanonicalChatProjection(reconciledDetail, projectId, sessionIdArg);
|
|
8686
8761
|
this.reconcileSubtaskStatuses(projectId, sessionIdArg);
|
|
8687
8762
|
// A draft that materialized keeps its placeholder view until this first
|
|
@@ -12185,6 +12260,10 @@ export class HarnessControllerApp extends plugins.deesElement.DeesElement {
|
|
|
12185
12260
|
this.requestCurrentComposerFocus();
|
|
12186
12261
|
return;
|
|
12187
12262
|
}
|
|
12263
|
+
if (targetHarnessId === 'flex' && slashInput.type === 'ordinary') {
|
|
12264
|
+
this.submitFlexBrowserMessage({ text, attachments: draftAttachments }, delivery ?? 'steer');
|
|
12265
|
+
return;
|
|
12266
|
+
}
|
|
12188
12267
|
if (this.draftSessionActive && this.selectedSessionId === undefined) {
|
|
12189
12268
|
if (slashInput.type === 'ordinary') {
|
|
12190
12269
|
void this.sendFirstMessage({ text, attachments: draftAttachments });
|
|
@@ -12217,6 +12296,256 @@ export class HarnessControllerApp extends plugins.deesElement.DeesElement {
|
|
|
12217
12296
|
});
|
|
12218
12297
|
}
|
|
12219
12298
|
|
|
12299
|
+
/** Captures before the first await. A message owns its body, files, account and model forever. */
|
|
12300
|
+
private submitFlexBrowserMessage(contentArg: IComposerContent, deliveryArg: interfaces.TControllerPromptDelivery): void {
|
|
12301
|
+
const projectId = this.selectedProjectId;
|
|
12302
|
+
const sessionId = this.selectedSessionId;
|
|
12303
|
+
const model = this.resolveComposerModelChoice(sessionId);
|
|
12304
|
+
const providerConnectionId = this.resolveSessionAccount(sessionId);
|
|
12305
|
+
if (!projectId || model?.harnessId !== 'flex' || !providerConnectionId
|
|
12306
|
+
|| !this.authenticated || !this.socketClient.isConnected) return;
|
|
12307
|
+
let conversation: interfaces.TControllerFlexAdmissionConversation;
|
|
12308
|
+
let scope: string;
|
|
12309
|
+
// A provisional new intent remains the address even if its receipt already names a native ID.
|
|
12310
|
+
const intent = [...this.flexConversationIntents.values()].find((candidate) => (
|
|
12311
|
+
candidate.projectId === projectId && candidate.draftGeneration === this.draftSessionGeneration
|
|
12312
|
+
&& this.draftSessionActive && (!sessionId || controllerRuntimeIdsEqual(candidate.sessionId, sessionId))
|
|
12313
|
+
));
|
|
12314
|
+
if (intent || (!sessionId && this.draftSessionActive)) {
|
|
12315
|
+
const current = intent ?? {
|
|
12316
|
+
projectId, draftGeneration: this.draftSessionGeneration, clientConversationId: crypto.randomUUID(),
|
|
12317
|
+
scratchpad: this.currentDraftScratchpad()?.text ?? '',
|
|
12318
|
+
};
|
|
12319
|
+
this.flexConversationIntents.set(current.clientConversationId, current);
|
|
12320
|
+
conversation = { kind: 'new', clientConversationId: current.clientConversationId,
|
|
12321
|
+
scratchpad: current.scratchpad };
|
|
12322
|
+
scope = `${projectId}\u0000intent:${current.clientConversationId}`;
|
|
12323
|
+
} else {
|
|
12324
|
+
if (sessionId?.harnessId !== 'flex') return;
|
|
12325
|
+
const identity = controllerRuntimeIdsEqual(this.sessionDetail?.session.id, sessionId)
|
|
12326
|
+
? this.sessionDetail?.session.sessionIdentityId : undefined;
|
|
12327
|
+
if (!identity) {
|
|
12328
|
+
this.noteComposer('The exact Flex conversation identity is not loaded. Reload its detail before sending.');
|
|
12329
|
+
return;
|
|
12330
|
+
}
|
|
12331
|
+
conversation = { kind: 'existing', sessionId: { ...sessionId, harnessId: 'flex' }, sessionIdentityId: identity };
|
|
12332
|
+
const nativeIntent = [...this.flexConversationIntents.values()].find((candidate) => candidate.projectId === projectId
|
|
12333
|
+
&& controllerRuntimeIdsEqual(candidate.sessionId, sessionId));
|
|
12334
|
+
scope = nativeIntent ? `${projectId}\u0000intent:${nativeIntent.clientConversationId}` : `${projectId}\u0000session:${identity}`;
|
|
12335
|
+
}
|
|
12336
|
+
const clientMessageId = crypto.randomUUID();
|
|
12337
|
+
const capturedRevision = sessionId ? this.sessionDraftSync.submittedSnapshotRevision(contentArg.text, contentArg.attachments) : undefined;
|
|
12338
|
+
this.flexBrowserSubmissions.capture(clientMessageId, scope, {
|
|
12339
|
+
version: 1, projectId, clientMessageId, conversation, text: contentArg.text,
|
|
12340
|
+
attachments: contentArg.attachments, model, providerConnectionId, delivery: deliveryArg,
|
|
12341
|
+
...(capturedRevision === undefined ? {} : { capturedDraft: { revision: capturedRevision } }),
|
|
12342
|
+
});
|
|
12343
|
+
if (this.draftSessionActive && !sessionId) {
|
|
12344
|
+
if (this.localDraftText === contentArg.text) this.localDraftText = '';
|
|
12345
|
+
// The send event carries the live composer's files; each payload is cloned by capture.
|
|
12346
|
+
if (controllerJsonValuesEqual(this.localDraftAttachments, contentArg.attachments)) this.localDraftAttachments = [];
|
|
12347
|
+
} else {
|
|
12348
|
+
this.sessionDraftSync.clearSubmittedSnapshot(contentArg.text, contentArg.attachments);
|
|
12349
|
+
}
|
|
12350
|
+
this.requestCurrentComposerFocus();
|
|
12351
|
+
}
|
|
12352
|
+
|
|
12353
|
+
private acceptFlexBrowserSubmission(entryArg: TFlexBrowserSubmission): void {
|
|
12354
|
+
const receipt = entryArg.receipt;
|
|
12355
|
+
if (!receipt) return;
|
|
12356
|
+
if (receipt.clientConversationId) {
|
|
12357
|
+
const intent = this.flexConversationIntents.get(receipt.clientConversationId);
|
|
12358
|
+
if (intent) {
|
|
12359
|
+
intent.sessionId = receipt.sessionId;
|
|
12360
|
+
if (receipt.creation === 'ready') void this.attachFlexBrowserConversation(intent);
|
|
12361
|
+
}
|
|
12362
|
+
}
|
|
12363
|
+
this.reconcileFlexBrowserSubmissions();
|
|
12364
|
+
this.scheduleRefresh();
|
|
12365
|
+
}
|
|
12366
|
+
|
|
12367
|
+
/** Keep the mounted draft editable through native creation and its draft/detail reads. */
|
|
12368
|
+
private async attachFlexBrowserConversation(intentArg: IFlexBrowserConversationIntent): Promise<void> {
|
|
12369
|
+
if (intentArg.attaching || !intentArg.sessionId
|
|
12370
|
+
|| !this.draftIsCurrent(intentArg.projectId, intentArg.draftGeneration)) return;
|
|
12371
|
+
intentArg.attaching = true;
|
|
12372
|
+
const sessionId = intentArg.sessionId;
|
|
12373
|
+
const generation = this.connectionGeneration;
|
|
12374
|
+
try {
|
|
12375
|
+
// Hydrate off screen first; onState cannot overwrite the still-local next-message draft.
|
|
12376
|
+
await this.sessionDraftSync.activate(intentArg.projectId, sessionId);
|
|
12377
|
+
if (!this.isCurrentConnection(generation) || !this.draftIsCurrent(intentArg.projectId, intentArg.draftGeneration)) return;
|
|
12378
|
+
this.sessionDraftSync.setText(this.localDraftText);
|
|
12379
|
+
this.sessionDraftSync.setAttachments(this.localDraftAttachments);
|
|
12380
|
+
this.adoptDraftComposerChoices(intentArg.projectId, 'flex', sessionId);
|
|
12381
|
+
this.attachDraftConversation(sessionId);
|
|
12382
|
+
void this.refreshSelectedSessionDetail();
|
|
12383
|
+
this.requestCurrentComposerFocus();
|
|
12384
|
+
} catch (errorArg) {
|
|
12385
|
+
this.reportWorkspaceError('Open the admitted Flex conversation', errorArg);
|
|
12386
|
+
} finally {
|
|
12387
|
+
intentArg.attaching = false;
|
|
12388
|
+
}
|
|
12389
|
+
}
|
|
12390
|
+
|
|
12391
|
+
/**
|
|
12392
|
+
* Selecting a project reads its admitted rows, selecting a conversation reads that conversation's;
|
|
12393
|
+
* a selection that names the same project and conversation again reads nothing.
|
|
12394
|
+
*/
|
|
12395
|
+
private readFlexSubmissionReceiptsOnSelection(changedPropertiesArg: Map<PropertyKey, unknown>): void {
|
|
12396
|
+
const previousProjectId = changedPropertiesArg.has('selectedProjectId')
|
|
12397
|
+
? changedPropertiesArg.get('selectedProjectId') as string | undefined
|
|
12398
|
+
: this.selectedProjectId;
|
|
12399
|
+
const previousSessionId = changedPropertiesArg.has('selectedSessionId')
|
|
12400
|
+
? changedPropertiesArg.get('selectedSessionId') as TBrowserSessionId | undefined
|
|
12401
|
+
: this.selectedSessionId;
|
|
12402
|
+
if (!isNonEmptyString(this.selectedProjectId)) return;
|
|
12403
|
+
if (previousProjectId !== this.selectedProjectId) {
|
|
12404
|
+
this.readFlexSubmissionReceipts(this.selectedProjectId);
|
|
12405
|
+
} else if (!controllerRuntimeIdsEqual(previousSessionId, this.selectedSessionId)) {
|
|
12406
|
+
this.readFlexSubmissionReceipts(this.selectedProjectId, this.selectedSessionId);
|
|
12407
|
+
}
|
|
12408
|
+
}
|
|
12409
|
+
|
|
12410
|
+
private flexSubmissionBelongsTo(entryArg: TFlexBrowserSubmission, projectIdArg: string, sessionIdArg?: TBrowserSessionId): boolean {
|
|
12411
|
+
if (entryArg.snapshot.projectId !== projectIdArg) return false;
|
|
12412
|
+
const target = entryArg.snapshot.conversation;
|
|
12413
|
+
if (sessionIdArg) return controllerRuntimeIdsEqual(entryArg.receipt?.sessionId, sessionIdArg)
|
|
12414
|
+
|| (target.kind === 'existing' && controllerRuntimeIdsEqual(target.sessionId, sessionIdArg))
|
|
12415
|
+
|| (target.kind === 'new' && controllerRuntimeIdsEqual(this.flexConversationIntents.get(target.clientConversationId)?.sessionId, sessionIdArg));
|
|
12416
|
+
return target.kind === 'new'
|
|
12417
|
+
&& this.flexConversationIntents.get(target.clientConversationId)?.draftGeneration === this.draftSessionGeneration;
|
|
12418
|
+
}
|
|
12419
|
+
|
|
12420
|
+
private flexSubmissionCarried(entryArg: TFlexBrowserSubmission, detailArg: IControllerSessionRenderDetail): boolean {
|
|
12421
|
+
const receipt = entryArg.receipt;
|
|
12422
|
+
if (!receipt || !controllerRuntimeIdsEqual(receipt.sessionId, detailArg.session.id)) return false;
|
|
12423
|
+
const exact = (idArg: interfaces.IControllerRuntimeId | undefined): boolean => (
|
|
12424
|
+
idArg?.harnessId === 'flex' && idArg.nativeId === receipt.operationId
|
|
12425
|
+
);
|
|
12426
|
+
return detailArg.pendingPrompts.some((prompt) => exact(prompt.id))
|
|
12427
|
+
|| detailArg.messages.some((message) => message.role === 'user' && exact(message.promptId));
|
|
12428
|
+
}
|
|
12429
|
+
|
|
12430
|
+
private reconcileFlexBrowserSubmissions(): void {
|
|
12431
|
+
const detail = this.sessionDetail;
|
|
12432
|
+
if (!detail || detail.session.id.harnessId !== 'flex') return;
|
|
12433
|
+
this.flexBrowserSubmissions.reconcile((entry) => entry.snapshot.projectId === this.selectedProjectId
|
|
12434
|
+
&& this.flexSubmissionCarried(entry, detail));
|
|
12435
|
+
}
|
|
12436
|
+
|
|
12437
|
+
private flexSubmissionMessages(projectIdArg: string, sessionIdArg?: TBrowserSessionId, detailArg?: IControllerSessionRenderDetail): plugins.deesCatalog.IHarnessMessage[] {
|
|
12438
|
+
return this.flexBrowserSubmissions.current
|
|
12439
|
+
.filter((entry) => this.flexSubmissionBelongsTo(entry, projectIdArg, sessionIdArg)
|
|
12440
|
+
&& (!detailArg || !this.flexSubmissionCarried(entry, detailArg)))
|
|
12441
|
+
.map(flexSubmissionMessage);
|
|
12442
|
+
}
|
|
12443
|
+
|
|
12444
|
+
private renderFlexSubmissionChecks(): plugins.deesElement.TemplateResult | '' {
|
|
12445
|
+
const entries = this.flexBrowserSubmissions.current.filter((entry) => entry.snapshot.projectId === this.selectedProjectId
|
|
12446
|
+
&& (entry.state === 'unknown' || entry.receipt?.creation === 'uncertain' || entry.receipt?.state === 'settled'));
|
|
12447
|
+
if (entries.length === 0) return '';
|
|
12448
|
+
return plugins.deesElement.html`<div class="composerNotice notice" role="status">
|
|
12449
|
+
<span>Admission or creation is unconfirmed. Checking never resends a message.</span>
|
|
12450
|
+
<dees-button @clicked=${() => { void Promise.all(entries.map((entry) => this.flexBrowserSubmissions.check(entry.id))).then(() => this.refreshSelectedSessionDetail()); }}>Check receipts</dees-button>
|
|
12451
|
+
</div>`;
|
|
12452
|
+
}
|
|
12453
|
+
|
|
12454
|
+
/** Local failures and orphaned provisional intents stay inspectable after navigation/reconnect. */
|
|
12455
|
+
private renderFlexBrowserMessages(): plugins.deesElement.TemplateResult {
|
|
12456
|
+
return plugins.deesElement.html`<div>
|
|
12457
|
+
<p>Captured in this page only. Unconfirmed messages are never resent automatically. Keep this page open until their outcomes are known.</p>
|
|
12458
|
+
${this.flexBrowserSubmissions.current.map((entry) => plugins.deesElement.html`<section>
|
|
12459
|
+
<p>${this.projects.find((project) => project.id === entry.snapshot.projectId)?.name ?? entry.snapshot.projectId}
|
|
12460
|
+
· ${entry.id}</p>
|
|
12461
|
+
<dees-harness-message .message=${flexSubmissionMessage(entry)}></dees-harness-message>
|
|
12462
|
+
${entry.state === 'unknown' || entry.state === 'admitted' ? plugins.deesElement.html`
|
|
12463
|
+
<dees-button type="ghost" size="sm" .text=${'Check receipt'}
|
|
12464
|
+
@clicked=${() => void this.flexBrowserSubmissions.check(entry.id)}></dees-button>` : ''}
|
|
12465
|
+
</section>`)}
|
|
12466
|
+
</div>`;
|
|
12467
|
+
}
|
|
12468
|
+
|
|
12469
|
+
private async openFlexBrowserMessages(): Promise<void> {
|
|
12470
|
+
if (this.flexBrowserMessagesOpening || this.flexBrowserMessagesModal?.isConnected) return;
|
|
12471
|
+
this.flexBrowserMessagesOpening = true;
|
|
12472
|
+
const generation = this.connectionGeneration;
|
|
12473
|
+
try {
|
|
12474
|
+
const modal = await plugins.deesCatalog.DeesModal.createAndShow({
|
|
12475
|
+
heading: 'Browser messages', subheading: 'Immutable messages awaiting an exact durable or native owner.',
|
|
12476
|
+
width: 'large', content: this.renderFlexBrowserMessages(),
|
|
12477
|
+
menuOptions: [{ name: 'Close', action: async (modalArg) => { await modalArg?.destroy(); } }],
|
|
12478
|
+
});
|
|
12479
|
+
if (!modal) return;
|
|
12480
|
+
if (!this.componentConnected || !this.isCurrentConnection(generation)) { await modal.destroy(); return; }
|
|
12481
|
+
this.flexBrowserMessagesModal = modal;
|
|
12482
|
+
modal.content = this.renderFlexBrowserMessages();
|
|
12483
|
+
} catch (errorArg) {
|
|
12484
|
+
this.reportWorkspaceError('Review browser messages', errorArg);
|
|
12485
|
+
} finally {
|
|
12486
|
+
this.flexBrowserMessagesOpening = false;
|
|
12487
|
+
}
|
|
12488
|
+
}
|
|
12489
|
+
|
|
12490
|
+
/** Reconnection restores this page's next draft and the same intent, never an attempted send. */
|
|
12491
|
+
private restoreFlexBrowserComposer(): void {
|
|
12492
|
+
const resume = this.flexBrowserComposerResume;
|
|
12493
|
+
if (!resume || !this.projects.some((project) => project.id === resume.projectId)) return;
|
|
12494
|
+
this.flexBrowserComposerResume = undefined;
|
|
12495
|
+
this.selectedProjectId = resume.projectId;
|
|
12496
|
+
const intent = resume.clientConversationId ? this.flexConversationIntents.get(resume.clientConversationId) : undefined;
|
|
12497
|
+
if (intent) {
|
|
12498
|
+
intent.draftGeneration = this.draftSessionGeneration;
|
|
12499
|
+
this.draftSessionActive = true;
|
|
12500
|
+
this.draftHarnessId = 'flex';
|
|
12501
|
+
this.selectedSessionId = undefined;
|
|
12502
|
+
this.localDraftText = resume.text;
|
|
12503
|
+
this.localDraftAttachments = resume.attachments;
|
|
12504
|
+
} else if (resume.sessionId) {
|
|
12505
|
+
this.selectedSessionId = resume.sessionId;
|
|
12506
|
+
const generation = this.connectionGeneration;
|
|
12507
|
+
void this.sessionDraftSync.activate(resume.projectId, resume.sessionId).then(() => {
|
|
12508
|
+
if (!this.isCurrentConnection(generation) || !this.isSelectedConversation(resume.projectId, resume.sessionId!)) return;
|
|
12509
|
+
this.sessionDraftSync.setText(resume.text);
|
|
12510
|
+
this.sessionDraftSync.setAttachments(resume.attachments);
|
|
12511
|
+
}).catch((errorArg) => this.reportWorkspaceError('Restore the next Flex draft', errorArg));
|
|
12512
|
+
}
|
|
12513
|
+
const key = intent ? draftSessionKey('flex') : resume.sessionId ? this.sessionOperationKey(resume.projectId, resume.sessionId) : undefined;
|
|
12514
|
+
if (key) {
|
|
12515
|
+
if (resume.model) this.sessionModelOverrides.set(key, resume.model);
|
|
12516
|
+
if (resume.account) this.sessionAccountOverrides.set(key, resume.account);
|
|
12517
|
+
this.sessionEffortOverrides.set(key, resume.effort);
|
|
12518
|
+
}
|
|
12519
|
+
void this.flexBrowserSubmissions.reconnect();
|
|
12520
|
+
}
|
|
12521
|
+
|
|
12522
|
+
/**
|
|
12523
|
+
* Reads the receipts of the admitted rows of a project, or of one of its conversations. It runs
|
|
12524
|
+
* on events only, never on a timer: a push of the controller for that conversation (it follows
|
|
12525
|
+
* every change of what a receipt reports: hand-over, hold, release, creation), a selection of the
|
|
12526
|
+
* project or conversation, a reconnection (`BrowserSubmissions.reconnect`) and Check receipts.
|
|
12527
|
+
* Reads only: neither a missing receipt nor a read failure authorizes another admission.
|
|
12528
|
+
*/
|
|
12529
|
+
private readFlexSubmissionReceipts(projectIdArg: string, sessionIdArg?: IControllerBrowserRuntimeId): void {
|
|
12530
|
+
if (!this.componentConnected || !this.authenticated || !this.socketClient.isConnected) return;
|
|
12531
|
+
for (const entry of this.flexBrowserSubmissions.current) {
|
|
12532
|
+
if (entry.state !== 'admitted' || entry.snapshot.projectId !== projectIdArg
|
|
12533
|
+
|| (sessionIdArg !== undefined && !controllerRuntimeIdsEqual(entry.receipt?.sessionId, sessionIdArg))) continue;
|
|
12534
|
+
void this.flexBrowserSubmissions.check(entry.id);
|
|
12535
|
+
}
|
|
12536
|
+
}
|
|
12537
|
+
|
|
12538
|
+
/** A Flex conversation or conversation-list push of the controller reads that conversation's rows. */
|
|
12539
|
+
private readFlexSubmissionReceiptsAfterPush(eventArg: interfaces.IControllerEvent): void {
|
|
12540
|
+
if (eventArg.type !== 'session.changed' && eventArg.type !== 'sessions.changed'
|
|
12541
|
+
&& eventArg.type !== 'session.history.changed') return;
|
|
12542
|
+
const sessionId = isSessionRuntimeId(eventArg.sessionId) ? eventArg.sessionId : undefined;
|
|
12543
|
+
const harnessId = sessionId?.harnessId ?? eventArg.harnessId;
|
|
12544
|
+
if (harnessId !== undefined && harnessId !== 'flex') return;
|
|
12545
|
+
const projectId = eventArg.projectId ?? this.selectedProjectId;
|
|
12546
|
+
if (isNonEmptyString(projectId)) this.readFlexSubmissionReceipts(projectId, sessionId);
|
|
12547
|
+
}
|
|
12548
|
+
|
|
12220
12549
|
private async submitCodexSteer(
|
|
12221
12550
|
chatArg: plugins.deesCatalog.DeesHarnessChat,
|
|
12222
12551
|
textArg: string,
|
|
@@ -17011,6 +17340,7 @@ ${entry.detail.stack}`}</pre>`}
|
|
|
17011
17340
|
if (!this.authenticated) {
|
|
17012
17341
|
return;
|
|
17013
17342
|
}
|
|
17343
|
+
this.readFlexSubmissionReceiptsAfterPush(eventArg);
|
|
17014
17344
|
if (eventArg.type === 'driver.changed' && eventArg.driverStatus) {
|
|
17015
17345
|
this.applyDriverStatus(eventArg.driverStatus);
|
|
17016
17346
|
return;
|
|
@@ -20129,6 +20459,10 @@ ${entry.detail.stack}`}</pre>`}
|
|
|
20129
20459
|
</dees-button>
|
|
20130
20460
|
</div>
|
|
20131
20461
|
${this.renderSidebarNotice()}
|
|
20462
|
+
${this.flexBrowserSubmissions.current.length > 0 ? plugins.deesElement.html`
|
|
20463
|
+
<dees-button class="flexBrowserMessagesButton" type="ghost" size="sm"
|
|
20464
|
+
.text=${`Browser messages (${this.flexBrowserSubmissions.current.length})`}
|
|
20465
|
+
@clicked=${() => void this.openFlexBrowserMessages()}></dees-button>` : ''}
|
|
20132
20466
|
${this.renderBlockedRemovals()}
|
|
20133
20467
|
<dees-harness-session-list
|
|
20134
20468
|
class="conversationList"
|
|
@@ -21863,7 +22197,7 @@ ${entry.detail.stack}`}</pre>`}
|
|
|
21863
22197
|
historyNotice: '',
|
|
21864
22198
|
messages: this.stableRenderValue(
|
|
21865
22199
|
'draft.messages',
|
|
21866
|
-
firstMessage ? [firstMessageHarnessMessage(firstMessage)] :
|
|
22200
|
+
firstMessage ? [firstMessageHarnessMessage(firstMessage)] : this.flexSubmissionMessages(this.selectedProjectId),
|
|
21867
22201
|
),
|
|
21868
22202
|
history: emptyHarnessHistory,
|
|
21869
22203
|
hasEarlierHistory: false,
|
|
@@ -21919,7 +22253,7 @@ ${entry.detail.stack}`}</pre>`}
|
|
|
21919
22253
|
subheading: directory
|
|
21920
22254
|
? `${harnessLabel} creates this session on first send · starts in ${directory}`
|
|
21921
22255
|
: `${harnessLabel} creates this session on first send`,
|
|
21922
|
-
strips: [this.draftHarnessId === 'codex' ? this.renderCodexConnectionStrip() : ''],
|
|
22256
|
+
strips: [this.draftHarnessId === 'codex' ? this.renderCodexConnectionStrip() : '', this.renderFlexSubmissionChecks()],
|
|
21923
22257
|
});
|
|
21924
22258
|
}
|
|
21925
22259
|
|
|
@@ -22264,9 +22598,9 @@ ${entry.detail.stack}`}</pre>`}
|
|
|
22264
22598
|
: codexExternalWriter
|
|
22265
22599
|
? 'This Codex turn cannot be stopped from AGL.'
|
|
22266
22600
|
: 'This Codex turn is no longer interruptible.',
|
|
22267
|
-
disabled: this.detailLoading
|
|
22601
|
+
disabled: (this.detailLoading && sessionId.harnessId !== 'flex')
|
|
22268
22602
|
|| (this.composerMutationPending() && !this.codexSteerPending)
|
|
22269
|
-
|| this.sessionModelPending
|
|
22603
|
+
|| (this.sessionModelPending && sessionId.harnessId !== 'flex')
|
|
22270
22604
|
|| draftState?.loading === true
|
|
22271
22605
|
|| readOnly,
|
|
22272
22606
|
composerValue: this.selectedComposerText(),
|
|
@@ -22299,6 +22633,7 @@ ${entry.detail.stack}`}</pre>`}
|
|
|
22299
22633
|
sessionId.harnessId === 'codex' ? this.renderCodexActivity(detailArg) : '',
|
|
22300
22634
|
sessionId.harnessId === 'codex' ? this.renderCodexUsageLimitNotice(detailArg) : '',
|
|
22301
22635
|
sessionId.harnessId === 'flex' ? this.renderFlexLimitStrip(detailArg, sessionId) : '',
|
|
22636
|
+
this.renderFlexSubmissionChecks(),
|
|
22302
22637
|
],
|
|
22303
22638
|
});
|
|
22304
22639
|
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
import type * as interfaces from '../ts_interfaces/index.js';
|
|
3
|
+
import type { IBrowserSubmission } from './classes.browsersubmissions.js';
|
|
4
|
+
|
|
5
|
+
export type TFlexBrowserSubmission = IBrowserSubmission<
|
|
6
|
+
interfaces.IControllerFlexSubmissionInput,
|
|
7
|
+
interfaces.IControllerFlexSubmissionReceipt
|
|
8
|
+
>;
|
|
9
|
+
|
|
10
|
+
/** A receipt changes routing and releases ordered followers: never trust a malformed readback. */
|
|
11
|
+
export const checkedFlexSubmissionReceipt = (
|
|
12
|
+
valueArg: unknown,
|
|
13
|
+
inputArg: interfaces.IControllerFlexSubmissionInput,
|
|
14
|
+
): interfaces.IControllerFlexSubmissionReceipt => {
|
|
15
|
+
const receipt = valueArg as Partial<interfaces.IControllerFlexSubmissionReceipt> | null;
|
|
16
|
+
const text = (value: unknown): value is string => typeof value === 'string' && value.length > 0;
|
|
17
|
+
const integer = (value: unknown): boolean => Number.isSafeInteger(value) && (value as number) >= 0;
|
|
18
|
+
if (!receipt || receipt.version !== 1 || receipt.projectId !== inputArg.projectId
|
|
19
|
+
|| receipt.clientMessageId !== inputArg.clientMessageId || !text(receipt.operationId)
|
|
20
|
+
|| receipt.sessionId?.harnessId !== 'flex' || !text(receipt.sessionId.nativeId)
|
|
21
|
+
|| !text(receipt.sessionGenerationId) || !integer(receipt.serverSequence) || !integer(receipt.acceptedAt)
|
|
22
|
+
|| (receipt.sessionGenerationSequence !== undefined && !integer(receipt.sessionGenerationSequence))
|
|
23
|
+
|| !['waiting', 'handedOver', 'held', 'settled'].includes(receipt.state ?? '')
|
|
24
|
+
|| !['pending', 'ready', 'uncertain', 'retired'].includes(receipt.creation ?? '')
|
|
25
|
+
|| (receipt.sessionIdentityId !== undefined && !text(receipt.sessionIdentityId))
|
|
26
|
+
|| (inputArg.conversation.kind === 'new' && receipt.clientConversationId !== inputArg.conversation.clientConversationId)
|
|
27
|
+
|| (inputArg.conversation.kind === 'existing' && (
|
|
28
|
+
receipt.sessionId.nativeId !== inputArg.conversation.sessionId.nativeId
|
|
29
|
+
|| receipt.sessionIdentityId !== inputArg.conversation.sessionIdentityId
|
|
30
|
+
))) throw new Error('The controller returned an unverifiable submission receipt. Admission remains unconfirmed; this message will not be resent.');
|
|
31
|
+
return structuredClone(receipt as interfaces.IControllerFlexSubmissionReceipt);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** Refusals the controller raises before its admission transaction for a state that passes. */
|
|
35
|
+
const transientFlexSubmissionCodes: ReadonlySet<string> = new Set(['flex_not_ready', 'operation_limit']);
|
|
36
|
+
|
|
37
|
+
export const flexSubmissionFailure = (errorArg: unknown): { definite: boolean; transient: boolean; message: string } => {
|
|
38
|
+
const code = errorArg instanceof plugins.typedrequest.TypedResponseError ? errorArg.errorData?.code : undefined;
|
|
39
|
+
// Only a named controller refusal proves non-admission. A fault, timeout, malformed answer or
|
|
40
|
+
// lost transport may follow the commit and must keep the exact ID fenced for readback.
|
|
41
|
+
const definite = typeof code === 'string' && new Set([
|
|
42
|
+
'invalid_request', 'concurrent_change', 'session_not_found', 'project_not_found',
|
|
43
|
+
'session_read_only', 'operation_limit', 'controller_upgrading', 'flex_not_ready',
|
|
44
|
+
'provider_reauth_required', 'provider_unavailable', 'model_unavailable', 'delivery_unsupported',
|
|
45
|
+
'attachments_unsupported', 'attachment_limit', 'message_rate_limited',
|
|
46
|
+
]).has(code);
|
|
47
|
+
return {
|
|
48
|
+
definite,
|
|
49
|
+
// `concurrent_change` and `outcome_unknown` are never sent again; an unknown outcome is read back.
|
|
50
|
+
transient: definite && typeof code === 'string' && transientFlexSubmissionCodes.has(code),
|
|
51
|
+
message: definite
|
|
52
|
+
? `${errorArg instanceof Error ? errorArg.message : 'The controller refused the message.'} Nothing was admitted. The captured message stays here; your next draft is unchanged.`
|
|
53
|
+
: 'Admission unconfirmed. Check its receipt after reconnecting; this message will not be resent.',
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/** Local feedback stays distinct from durable acceptance and from native context retention. */
|
|
58
|
+
export const flexSubmissionMessage = (entryArg: TFlexBrowserSubmission): plugins.deesCatalog.IHarnessMessage => {
|
|
59
|
+
const receipt = entryArg.receipt;
|
|
60
|
+
let pending: plugins.deesCatalog.THarnessPendingState = 'submitting';
|
|
61
|
+
let error = entryArg.error;
|
|
62
|
+
if (entryArg.state === 'unknown') pending = 'uncertain';
|
|
63
|
+
if (entryArg.state === 'blocked') {
|
|
64
|
+
pending = 'held';
|
|
65
|
+
error = 'Not submitted. Waiting for the preceding message’s admission or conversation creation to be confirmed.';
|
|
66
|
+
}
|
|
67
|
+
if (entryArg.state === 'refused') pending = 'held';
|
|
68
|
+
if (receipt) {
|
|
69
|
+
if (receipt.creation === 'uncertain' || receipt.state === 'settled') {
|
|
70
|
+
pending = 'uncertain';
|
|
71
|
+
error = receipt.creation === 'uncertain'
|
|
72
|
+
? 'Admission acknowledged; conversation creation is unconfirmed. This message will not be resent.'
|
|
73
|
+
: 'Admission acknowledged; awaiting the exact native message. Native acceptance alone does not prove retention in context.';
|
|
74
|
+
} else if (receipt.state === 'held' || receipt.creation === 'retired') {
|
|
75
|
+
pending = receipt.heldReason === 'uncertain' || receipt.heldReason === 'interrupted' ? 'uncertain' : 'held';
|
|
76
|
+
error = 'Admission acknowledged. The controller holds this message; open its conversation to inspect its durable state.';
|
|
77
|
+
} else {
|
|
78
|
+
pending = receipt.state === 'handedOver' && entryArg.snapshot.delivery === 'steer' ? 'steering' : 'queued';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
id: receipt ? JSON.stringify(['flex', receipt.operationId]) : entryArg.id,
|
|
83
|
+
role: 'user', text: entryArg.snapshot.text, createdAt: entryArg.createdAt, markdown: false,
|
|
84
|
+
attachments: entryArg.snapshot.attachments.map((attachment) => ({ ...attachment })),
|
|
85
|
+
pending, heldActions: [], pendingActionAvailable: false,
|
|
86
|
+
...(error ? { error } : {}),
|
|
87
|
+
};
|
|
88
|
+
};
|