@design.estate/dees-catalog 21.35.0 → 21.36.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.
- package/dist_bundle/bundle.js +614 -66
- package/dist_bundle/bundle.js.map +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-5CNZ4UM3.js → chunk-3YTKY5IS.js} +6 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-5CNZ4UM3.js.map → chunk-3YTKY5IS.js.map} +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-PHFZ5EZN.js → chunk-5UGXWLMH.js} +3 -3
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-KY5Z6Y6T.js → chunk-ZCZ72OW4.js} +2 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{de-AGABQ27E.js → de-PERXVUIS.js} +6 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{de-AGABQ27E.js.map → de-PERXVUIS.js.map} +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-QBFEQURL.js → dees-modal-4QORKLGX.js} +3 -3
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-UYSWDBV4.js → dees-workspace-terminal-7SYZG2AB.js} +4 -4
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/elements/00group-harness/dees-harness-chat/dees-harness-chat.d.ts +5 -1
- package/dist_ts_web/elements/00group-harness/dees-harness-chat/dees-harness-chat.js +11 -1
- package/dist_ts_web/elements/00group-harness/dees-harness-message-list/dees-harness-message-list.d.ts +28 -1
- package/dist_ts_web/elements/00group-harness/dees-harness-message-list/dees-harness-message-list.js +78 -1
- package/dist_ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.d.ts +75 -3
- package/dist_ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.demo.js +140 -44
- package/dist_ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.js +502 -16
- package/dist_ts_web/elements/00group-harness/interfaces.d.ts +72 -0
- package/dist_ts_web/i18n/de.d.ts +16 -0
- package/dist_ts_web/i18n/de.js +5 -1
- package/dist_ts_web/i18n/messages.d.ts +16 -0
- package/dist_ts_web/i18n/messages.js +5 -1
- package/package.json +1 -1
- package/readme.md +38 -1
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements/00group-harness/dees-harness-chat/dees-harness-chat.ts +17 -0
- package/ts_web/elements/00group-harness/dees-harness-message-list/dees-harness-message-list.ts +83 -0
- package/ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.demo.ts +106 -2
- package/ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.ts +486 -14
- package/ts_web/elements/00group-harness/interfaces.ts +77 -0
- package/ts_web/i18n/de.ts +4 -0
- package/ts_web/i18n/messages.ts +4 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-PHFZ5EZN.js.map → chunk-5UGXWLMH.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-KY5Z6Y6T.js.map → chunk-ZCZ72OW4.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-QBFEQURL.js.map → dees-modal-4QORKLGX.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-UYSWDBV4.js.map → dees-workspace-terminal-7SYZG2AB.js.map} +0 -0
package/readme.md
CHANGED
|
@@ -5555,7 +5555,7 @@ Light-DOM content assigned to `slot="composer-status"` renders between the trans
|
|
|
5555
5555
|
|
|
5556
5556
|
After mutating canonical message objects in place, call `refreshMessages(ids?)`. Pass IDs for targeted content corrections, omit them after structural mutations, and pass an empty array for a no-op. `DeesHarnessChat.refreshMessages(ids?)` uses the list semantics and, except for `[]`, also recomputes transcript-derived sidebar state. The list and individual message components expose the corresponding `refreshMessages(ids?)` and `refreshMessage()` methods.
|
|
5557
5557
|
|
|
5558
|
-
A **session side panel** shows Tasks, Tools & Subagents, Tokens, Session Scratchpad, and Session Intelligence next to the transcript. Its sections form a single-open accordion: opening one collapses the others, clicking the open heading collapses all, and each expanded section owns its scrolling while every heading remains visible. Collapsed sections retain their region wrapper but omit the content subtree until expansion; sidebar-owned scratchpad and intelligence drafts survive that lazy remount. Tools & Subagents separates active calls from terminal history and derives both directly from top-level tool messages still present in the host's retained transcript window; evicted calls are not cached. Ordinary tool activity rows open `DeesHarnessToolFullscreen` over the canonical call and follow in-place updates through `refreshMessages()`; subagent rows first emit `harness-subtask-open`. The inspector closes when the call is evicted, the session changes, or the sidebar disconnects, then restores the row's focus. An unhandled subagent request opens the same fullscreen inspector. Long activity labels use an ellipsis while descriptions use the 40px right-edge fade and reveal behavior. Session Intelligence keeps its exchange history scrollable above a docked, chat-style question composer. Set `.todos` explicitly, or leave it empty and the chat derives tasks from the newest todo tool call in `messages`; `showTodosPanel={false}` hides only that section. Unknown token metrics remain absent. The toolbar controls the session panel; host-owned navigation controls belong outside the chat component. In narrow containers the session panel becomes an accessible overlay; when the toolbar is disabled, an inline Session details control keeps it reachable. `showSessionSidebar={false}` disables the complete panel. Methods: `applyDelta()`, `refreshMessages(ids?)`, `focusComposer()`, `clearComposer()`, `scrollToBottom()`, `openSessionSidebar(section?)`, `openModelSelector()`, `openAttachmentPicker()`, and `
|
|
5558
|
+
A **session side panel** shows Tasks, Tools & Subagents, Tokens, Session Scratchpad, and Session Intelligence next to the transcript. Its sections form a single-open accordion: opening one collapses the others, clicking the open heading collapses all, and each expanded section owns its scrolling while every heading remains visible. Collapsed sections retain their region wrapper but omit the content subtree until expansion; sidebar-owned scratchpad and intelligence drafts survive that lazy remount. Tools & Subagents separates active calls from terminal history and derives both directly from top-level tool messages still present in the host's retained transcript window; evicted calls are not cached. Ordinary tool activity rows open `DeesHarnessToolFullscreen` over the canonical call and follow in-place updates through `refreshMessages()`; subagent rows first emit `harness-subtask-open`. The inspector closes when the call is evicted, the session changes, or the sidebar disconnects, then restores the row's focus. An unhandled subagent request opens the same fullscreen inspector. Long activity labels use an ellipsis while descriptions use the 40px right-edge fade and reveal behavior. Session Intelligence keeps its exchange history scrollable above a docked, chat-style question composer. Set `.todos` explicitly, or leave it empty and the chat derives tasks from the newest todo tool call in `messages`; `showTodosPanel={false}` hides only that section. Unknown token metrics remain absent. The toolbar controls the session panel; host-owned navigation controls belong outside the chat component. In narrow containers the session panel becomes an accessible overlay; when the toolbar is disabled, an inline Session details control keeps it reachable. `showSessionSidebar={false}` disables the complete panel. Methods: `applyDelta()`, `refreshMessages(ids?)`, `focusComposer()`, `clearComposer()`, `scrollToBottom()`, `openSessionSidebar(section?)`, `openModelSelector()`, `openAttachmentPicker()`, `focusPendingPermission()`, `showQuestionPersonResults(questionId, results)`, and `rejectQuestionResponse(questionId, rejection?)`. Section names use the exported `THarnessSessionSidebarSection` union. Capability launchers return false when their target is unavailable or locked, so command palettes can remain outside the shadow DOM. Events (also from children, all composed): `harness-send`, `harness-command`, `harness-starter-prompt`, `harness-abort`, `harness-held-resend`, `harness-held-discard`, `harness-input`, `harness-attachments-change`, `harness-attachment-error`, `harness-account-change`, `harness-model-change`, `harness-mode-change`, `harness-permission-response`, `harness-permission-link`, `harness-question-response`, `harness-question-link`, `harness-subtask-open`, `harness-scratchpad-save`, `harness-session-intelligence-ask`, `harness-session-intelligence-availability-action`.
|
|
5559
5559
|
|
|
5560
5560
|
Set `.todosAuthoritative=${true}` when an empty host-owned task list must suppress transcript-derived fallback. A changed `transcriptKey` also clears the previous session's unsent Session Intelligence question while preserving the existing scratchpad revision handling.
|
|
5561
5561
|
|
|
@@ -5695,6 +5695,12 @@ A decided proposal is read-only: the footer gives way to its state and the host'
|
|
|
5695
5695
|
|
|
5696
5696
|
A change that issued a secret, such as a new API key, carries it as `credential` (`IHarnessProposalCredential`, `{ label, value, note? }`). It is for the reader only. The card shows it masked, with the value not in the page, until the reader presses Show. Copy puts it on the clipboard and says so. Under it stands `note`, or by default that only the reader sees it and the agent does not. Revealing it is not kept in the view state. No event the card emits carries a `credential`. Pass a request through `harnessWithoutCredentials(request)` before it goes anywhere else, such as a log or the model's context.
|
|
5697
5697
|
|
|
5698
|
+
A change that needs a value from the reader and from nobody else, such as the password of the mail account it connects, asks for it in `personFields` (`IHarnessQuestionPersonField[]`, `{ id, itemId, label, input: 'text' | 'secret', required?, multiline?, maxLength, hint? }`). Each field stands under its change, empty: the host gives no initial value. A `secret` field, multiline or not, is masked until the reader presses Show and takes `autocomplete="new-password"`, so no browser or password manager fills the reader's own saved login into it; a `text` field takes `autocomplete="off"`. Confirm waits while a required field of an included change is empty or blank, or while any field holds more than its `maxLength` (UTF-16 code units, as `String.length` counts them); a value is never cut, the field says how long it is. A field of a change left out is neither required nor sent. Confirm adds `personValues` (`IHarnessQuestionPersonValue[]`, `{ itemId, fieldId, value }`, the filled fields of the included changes) to the response detail; a decline never carries any, nor do the answer, the request or the view state. They are for the host's own confirmation: keep them out of any session history, log or storage. The card forgets what was entered once it answers, when its request changes to another `id` and when it leaves the page, so a remount never shows a value again.
|
|
5699
|
+
|
|
5700
|
+
Where the host cannot carry out a confirmation as sent, such as a password the mail server refused, `rejectQuestionResponse(questionId, rejection?)` on the chat or the message list (`rejectResponse(rejection?)` on the card) asks again. The request must carry no `response`. The card waits once more with the fields empty and the changes the reader left out still left out, says `rejection.message` (by default that nothing was carried out) and shows each of `rejection.fieldErrors` (`{ itemId, fieldId, message }`) at its field until the reader edits it. The view state keeps the refusal (`IHarnessQuestionViewState.rejection`), never a value, so a card the transcript remounts still shows it until the next answer. The list mounts the card where the transcript had scrolled it away and brings it into view. It returns false for an unknown question, for a question that is not a proposal, and for one already answered, expired or failed.
|
|
5701
|
+
|
|
5702
|
+
What a carried-out change returns to the reader alone, such as a DNS record to add or a webhook's signing key, goes to its card with `showQuestionPersonResults(questionId, results)` on the chat or the message list (`IHarnessQuestionPersonResult[]`, `{ id, itemId, label, value, display: 'text' | 'secret' | 'link' }`), never in the request. Each stands under its change, and one for a change the card does not list after the changes: a `secret` masked with Show and Copy like a credential, a `link` opened on a click only and only for an http or https address (anything else shows as text). The list keeps them outside the view state while the question stays in the transcript; `[]` takes them away, and so does another transcript. On a card of its own, set its `personResults` property; another request `id` clears it.
|
|
5703
|
+
|
|
5698
5704
|
```ts
|
|
5699
5705
|
chat.questions = [{
|
|
5700
5706
|
id: 'proposal-12',
|
|
@@ -5725,6 +5731,37 @@ request.items[0].credential = { label: 'API key', value: issuedKey };
|
|
|
5725
5731
|
const forTheModel = harnessWithoutCredentials(request);
|
|
5726
5732
|
```
|
|
5727
5733
|
|
|
5734
|
+
```ts
|
|
5735
|
+
// values only the person gives, sent with the confirmation alone
|
|
5736
|
+
const request = {
|
|
5737
|
+
id: 'proposal-13',
|
|
5738
|
+
kind: 'proposal',
|
|
5739
|
+
question: 'Send invoices through your own mail server?',
|
|
5740
|
+
items: [{ id: 'smtp', summary: 'Sends invoices through smtp.nordwind.de' }],
|
|
5741
|
+
personFields: [
|
|
5742
|
+
{ id: 'user', itemId: 'smtp', label: 'User name', input: 'text', required: true, maxLength: 128 },
|
|
5743
|
+
{ id: 'password', itemId: 'smtp', label: 'Password', input: 'secret', required: true, maxLength: 128 },
|
|
5744
|
+
],
|
|
5745
|
+
};
|
|
5746
|
+
chat.questions = [request];
|
|
5747
|
+
chat.addEventListener('harness-question-response', async (event) => {
|
|
5748
|
+
const { requestId, answers, personValues } = event.detail;
|
|
5749
|
+
if (answers[0] !== 'confirm') return; // a decline carries no values
|
|
5750
|
+
const result = await connectMailServer(personValues); // never into history, logs or the model
|
|
5751
|
+
if (!result.ok) {
|
|
5752
|
+
await chat.rejectQuestionResponse(requestId, {
|
|
5753
|
+
message: 'The mail server refused the sign-in. Nothing was changed.',
|
|
5754
|
+
fieldErrors: [{ itemId: 'smtp', fieldId: 'password', message: 'The mail server refused this password.' }],
|
|
5755
|
+
});
|
|
5756
|
+
return;
|
|
5757
|
+
}
|
|
5758
|
+
chat.questions = [{ ...request, response: answers, respondedAt: Date.now(), outcome: { tone: 'success', text: 'Mail server connected' } }];
|
|
5759
|
+
await chat.showQuestionPersonResults(requestId, [
|
|
5760
|
+
{ id: 'record', itemId: 'smtp', label: 'DNS record', value: result.spfRecord, display: 'text' },
|
|
5761
|
+
]);
|
|
5762
|
+
});
|
|
5763
|
+
```
|
|
5764
|
+
|
|
5728
5765
|
#### `DeesHarnessComposer`
|
|
5729
5766
|
|
|
5730
5767
|
An `uncertain` pending prompt says “Delivery unconfirmed”: the host has attempted dispatch but cannot confirm whether the harness took it. Keep that prompt with `pendingActionAvailable: false` until the host reconciles the outcome; it cannot be resent or withdrawn meanwhile. Consecutive assistant messages containing only reasoning share the first row's role, model, and time range while each message keeps its own collapsible reasoning trace and stable ID. User messages, tool calls, model changes, or assistant text break the run.
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@design.estate/dees-catalog',
|
|
6
|
-
version: '21.
|
|
6
|
+
version: '21.36.1',
|
|
7
7
|
description: 'A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.'
|
|
8
8
|
}
|
|
@@ -21,6 +21,8 @@ import type {
|
|
|
21
21
|
IHarnessComposerOption,
|
|
22
22
|
IHarnessMessage,
|
|
23
23
|
IHarnessPermissionRequest,
|
|
24
|
+
IHarnessQuestionPersonResult,
|
|
25
|
+
IHarnessQuestionRejection,
|
|
24
26
|
IHarnessQuestionRequest,
|
|
25
27
|
IHarnessIntelligenceAvailabilityAction,
|
|
26
28
|
IHarnessIntelligenceExchange,
|
|
@@ -639,6 +641,21 @@ export class DeesHarnessChat extends DeesElement {
|
|
|
639
641
|
return this.listElement?.focusPendingPermission() ?? false;
|
|
640
642
|
}
|
|
641
643
|
|
|
644
|
+
/** Hands a question card what its confirmed changes returned to the person; see the message list's `showQuestionPersonResults()`. */
|
|
645
|
+
public async showQuestionPersonResults(
|
|
646
|
+
questionIdArg: string,
|
|
647
|
+
resultsArg: readonly IHarnessQuestionPersonResult[],
|
|
648
|
+
): Promise<boolean> {
|
|
649
|
+
await this.updateComplete;
|
|
650
|
+
return (await this.listElement?.showQuestionPersonResults(questionIdArg, resultsArg)) ?? false;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
/** Asks a question card again after the host refused its answer; see the message list's `rejectQuestionResponse()`. */
|
|
654
|
+
public async rejectQuestionResponse(questionIdArg: string, rejectionArg?: IHarnessQuestionRejection): Promise<boolean> {
|
|
655
|
+
await this.updateComplete;
|
|
656
|
+
return (await this.listElement?.rejectQuestionResponse(questionIdArg, rejectionArg)) ?? false;
|
|
657
|
+
}
|
|
658
|
+
|
|
642
659
|
public scrollToBottom(force = false): void {
|
|
643
660
|
this.listElement?.scrollToBottom(force);
|
|
644
661
|
}
|
package/ts_web/elements/00group-harness/dees-harness-message-list/dees-harness-message-list.ts
CHANGED
|
@@ -18,6 +18,8 @@ import type {
|
|
|
18
18
|
IHarnessMessageViewState,
|
|
19
19
|
IHarnessPermissionRequest,
|
|
20
20
|
IHarnessPermissionViewState,
|
|
21
|
+
IHarnessQuestionPersonResult,
|
|
22
|
+
IHarnessQuestionRejection,
|
|
21
23
|
IHarnessQuestionRequest,
|
|
22
24
|
IHarnessQuestionViewState,
|
|
23
25
|
IHarnessStarterPrompt,
|
|
@@ -35,6 +37,7 @@ import { harnessApplyMessageDelta, harnessQuestionPending, harnessRendersToolRow
|
|
|
35
37
|
import { harnessArrivalStyles } from '../harness.styles.js';
|
|
36
38
|
import { byTimelineOrder, HarnessQueueController, harnessQueueStyles } from './harness-queue.js';
|
|
37
39
|
import '../dees-harness-status/dees-harness-status.js';
|
|
40
|
+
import type { DeesHarnessQuestionCard } from '../dees-harness-question-card/dees-harness-question-card.js';
|
|
38
41
|
import '../dees-harness-question-card/dees-harness-question-card.js';
|
|
39
42
|
import '../../00group-utility/dees-icon/dees-icon.js';
|
|
40
43
|
|
|
@@ -55,6 +58,8 @@ const virtualGapPx = 8;
|
|
|
55
58
|
const toolRowHeightPx = 28;
|
|
56
59
|
const toolRowGapPx = 2;
|
|
57
60
|
const thinkingRowGapPx = 2;
|
|
61
|
+
const NO_PERSON_RESULTS: readonly IHarnessQuestionPersonResult[] = [];
|
|
62
|
+
|
|
58
63
|
/** The timeline time of a request still waiting for an answer: it pins the request to the end. */
|
|
59
64
|
const pinnedRequestTime = Number.MAX_SAFE_INTEGER;
|
|
60
65
|
const messageKeyOf = (messageIdArg: string): string => `message:${messageIdArg}`;
|
|
@@ -107,6 +112,11 @@ type TTimelineItem =
|
|
|
107
112
|
* DOM; long transcripts mount a bounded, measured window and retain row state
|
|
108
113
|
* by id. `applyDelta()` targets a mounted row or updates its offscreen model.
|
|
109
114
|
* Auto-follow stays at the bottom until the user intentionally scrolls away.
|
|
115
|
+
*
|
|
116
|
+
* The host reaches a question card by its question id:
|
|
117
|
+
* `showQuestionPersonResults()` hands it what its confirmed changes returned
|
|
118
|
+
* to the person, and `rejectQuestionResponse()` asks again after the host
|
|
119
|
+
* refused its answer.
|
|
110
120
|
*/
|
|
111
121
|
@customElement('dees-harness-message-list')
|
|
112
122
|
export class DeesHarnessMessageList extends DeesElement {
|
|
@@ -241,6 +251,14 @@ export class DeesHarnessMessageList extends DeesElement {
|
|
|
241
251
|
rangeCount: number;
|
|
242
252
|
} | undefined;
|
|
243
253
|
private explicitRetainedVirtualKey: string | undefined;
|
|
254
|
+
/** question rows kept mounted while the host's rejection reaches their card */
|
|
255
|
+
private readonly heldQuestionKeys = new Set<string>();
|
|
256
|
+
/**
|
|
257
|
+
* What confirmed changes returned to the person, by question id: kept here rather than in the
|
|
258
|
+
* view state, so a card mounted anew shows them again, and only while the question stays in
|
|
259
|
+
* this transcript.
|
|
260
|
+
*/
|
|
261
|
+
private readonly questionPersonResults = new Map<string, readonly IHarnessQuestionPersonResult[]>();
|
|
244
262
|
private virtualRowResizeObserver: ResizeObserver | null = null;
|
|
245
263
|
private virtualViewportResizeObserver: ResizeObserver | null = null;
|
|
246
264
|
private virtualMeasureFrame: number | null = null;
|
|
@@ -734,6 +752,9 @@ export class DeesHarnessMessageList extends DeesElement {
|
|
|
734
752
|
for (const key of Object.keys(effectiveViewState.questions)) {
|
|
735
753
|
if (!questionIds.has(key)) delete effectiveViewState.questions[key];
|
|
736
754
|
}
|
|
755
|
+
for (const key of this.questionPersonResults.keys()) {
|
|
756
|
+
if (!questionIds.has(key)) this.questionPersonResults.delete(key);
|
|
757
|
+
}
|
|
737
758
|
for (const message of this.messages) effectiveViewState.messages[message.id] ??= {};
|
|
738
759
|
for (const request of this.permissions) effectiveViewState.permissions[request.id] ??= {};
|
|
739
760
|
for (const request of this.questions) effectiveViewState.questions[request.id] ??= {};
|
|
@@ -1222,6 +1243,7 @@ export class DeesHarnessMessageList extends DeesElement {
|
|
|
1222
1243
|
.request=${itemArg.question}
|
|
1223
1244
|
.busy=${this.permissionsBusy}
|
|
1224
1245
|
.viewState=${this.questionViewState(itemArg.question.id)}
|
|
1246
|
+
.personResults=${this.questionPersonResults.get(itemArg.question.id) ?? NO_PERSON_RESULTS}
|
|
1225
1247
|
></dees-harness-question-card>
|
|
1226
1248
|
`;
|
|
1227
1249
|
}
|
|
@@ -1608,6 +1630,8 @@ export class DeesHarnessMessageList extends DeesElement {
|
|
|
1608
1630
|
this.virtualEndIndex = 0;
|
|
1609
1631
|
this.retainedVirtualKeys.clear();
|
|
1610
1632
|
this.explicitRetainedVirtualKey = undefined;
|
|
1633
|
+
this.heldQuestionKeys.clear();
|
|
1634
|
+
this.questionPersonResults.clear();
|
|
1611
1635
|
this.measuredVirtualHeights.clear();
|
|
1612
1636
|
this.virtualOffsets = [];
|
|
1613
1637
|
this.virtualTotalHeight = 0;
|
|
@@ -1675,6 +1699,59 @@ export class DeesHarnessMessageList extends DeesElement {
|
|
|
1675
1699
|
return card.focusFirstAction();
|
|
1676
1700
|
}
|
|
1677
1701
|
|
|
1702
|
+
/**
|
|
1703
|
+
* Hands the card of question `questionIdArg` what its confirmed changes returned to the person
|
|
1704
|
+
* (`IHarnessQuestionPersonResult`), after the host's own confirmation: shown under their changes,
|
|
1705
|
+
* kept by the list (never in the view state) while the question stays in this transcript, and
|
|
1706
|
+
* taken away with `[]`. `false` when this transcript has no such question.
|
|
1707
|
+
*/
|
|
1708
|
+
public async showQuestionPersonResults(
|
|
1709
|
+
questionIdArg: string,
|
|
1710
|
+
resultsArg: readonly IHarnessQuestionPersonResult[],
|
|
1711
|
+
): Promise<boolean> {
|
|
1712
|
+
if (!this.questions.some((request) => request.id === questionIdArg)) return false;
|
|
1713
|
+
if (resultsArg.length) this.questionPersonResults.set(questionIdArg, resultsArg);
|
|
1714
|
+
else this.questionPersonResults.delete(questionIdArg);
|
|
1715
|
+
this.requestUpdate();
|
|
1716
|
+
await this.updateComplete;
|
|
1717
|
+
return true;
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1720
|
+
/**
|
|
1721
|
+
* The host refused the answer the card of question `questionIdArg` sent, such as a confirmation
|
|
1722
|
+
* its server turned down: the card waits for an answer again with the changes the reader left
|
|
1723
|
+
* out, and shows why (`IHarnessQuestionRejection`), brought into view. Its request carries no
|
|
1724
|
+
* `response`. `false` when this transcript has no such question or the card cannot ask again.
|
|
1725
|
+
*/
|
|
1726
|
+
public async rejectQuestionResponse(
|
|
1727
|
+
questionIdArg: string,
|
|
1728
|
+
rejectionArg: IHarnessQuestionRejection = {},
|
|
1729
|
+
): Promise<boolean> {
|
|
1730
|
+
if (!this.questions.some((request) => request.id === questionIdArg)) return false;
|
|
1731
|
+
const key = `question:${questionIdArg}`;
|
|
1732
|
+
// a virtual transcript mounts the row for the card to take the rejection
|
|
1733
|
+
this.heldQuestionKeys.add(key);
|
|
1734
|
+
this.retainedVirtualKeys = new Set(this.activeVirtualKeys());
|
|
1735
|
+
this.requestUpdate();
|
|
1736
|
+
try {
|
|
1737
|
+
await this.updateComplete;
|
|
1738
|
+
const card = Array.from(
|
|
1739
|
+
this.shadowRoot?.querySelectorAll<DeesHarnessQuestionCard>('dees-harness-question-card[data-timeline-key]') ?? [],
|
|
1740
|
+
).find((candidate) => candidate.dataset.timelineKey === key);
|
|
1741
|
+
if (!card) return false;
|
|
1742
|
+
const asked = card.rejectResponse(rejectionArg);
|
|
1743
|
+
if (asked) {
|
|
1744
|
+
await card.updateComplete;
|
|
1745
|
+
card.scrollIntoView({ block: 'nearest' });
|
|
1746
|
+
}
|
|
1747
|
+
return asked;
|
|
1748
|
+
} finally {
|
|
1749
|
+
this.heldQuestionKeys.delete(key);
|
|
1750
|
+
this.retainedVirtualKeys = new Set(this.activeVirtualKeys());
|
|
1751
|
+
this.scheduleVirtualRangeUpdate();
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1678
1755
|
private handleScroll = (): void => {
|
|
1679
1756
|
const container = this.scrollContainer;
|
|
1680
1757
|
if (!container) return;
|
|
@@ -2140,6 +2217,7 @@ export class DeesHarnessMessageList extends DeesElement {
|
|
|
2140
2217
|
...(this.explicitRetainedVirtualKey ? [this.explicitRetainedVirtualKey] : []),
|
|
2141
2218
|
...(focusKey ? [focusKey] : []),
|
|
2142
2219
|
...this.activeSelectionKeys(),
|
|
2220
|
+
...this.heldQuestionKeys,
|
|
2143
2221
|
].filter((key, index, keys) => keys.indexOf(key) === index);
|
|
2144
2222
|
}
|
|
2145
2223
|
|
|
@@ -2376,6 +2454,11 @@ export class DeesHarnessMessageList extends DeesElement {
|
|
|
2376
2454
|
this.pendingVirtualRepin = false;
|
|
2377
2455
|
this.explicitRetainedVirtualKey = undefined;
|
|
2378
2456
|
this.retainedVirtualKeys.clear();
|
|
2457
|
+
this.heldQuestionKeys.clear();
|
|
2458
|
+
// a list a host moves is connected again before this runs, and keeps what its cards show the person
|
|
2459
|
+
queueMicrotask(() => {
|
|
2460
|
+
if (!this.isConnected) this.questionPersonResults.clear();
|
|
2461
|
+
});
|
|
2379
2462
|
// An unmounted row owes no entrance: it arrives again as an ordinary row. The queue settles its
|
|
2380
2463
|
// own motion as the host disconnects (`HarnessQueueController.hostDisconnected`).
|
|
2381
2464
|
for (const key of [...this.enteringKeys]) this.endRowEntrance(key);
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { html } from '@design.estate/dees-element';
|
|
2
2
|
import { demoPage, demoSection, demoOutput, showDemoResult } from '../../../demos/templates.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
IHarnessQuestionPersonResult,
|
|
5
|
+
IHarnessQuestionRequest,
|
|
6
|
+
IHarnessQuestionResponseDetail,
|
|
7
|
+
} from '../interfaces.js';
|
|
4
8
|
|
|
5
9
|
type TQuestionCard = HTMLElementTagNameMap['dees-harness-question-card'];
|
|
6
10
|
|
|
@@ -187,7 +191,98 @@ const decided: IHarnessQuestionRequest[] = [
|
|
|
187
191
|
},
|
|
188
192
|
];
|
|
189
193
|
|
|
190
|
-
|
|
194
|
+
/** The password the demo's mail server refuses, to show a host turning a confirmation down. */
|
|
195
|
+
const REFUSED_PASSWORD = 'refused';
|
|
196
|
+
|
|
197
|
+
const personProposal = (idArg: string): IHarnessQuestionRequest => ({
|
|
198
|
+
id: idArg,
|
|
199
|
+
kind: 'proposal',
|
|
200
|
+
severity: 'warning',
|
|
201
|
+
question: 'Send invoices through your own mail server?',
|
|
202
|
+
itemsDeclinable: true,
|
|
203
|
+
items: [
|
|
204
|
+
{
|
|
205
|
+
id: 'smtp',
|
|
206
|
+
summary: 'Sends invoices from invoices@nordwind.de through your mail server',
|
|
207
|
+
label: 'Mail settings',
|
|
208
|
+
href: '#',
|
|
209
|
+
changes: [{ label: 'Server', before: 'Built-in', after: 'smtp.nordwind.de:587' }],
|
|
210
|
+
},
|
|
211
|
+
{ id: 'dkim', summary: 'Signs outgoing invoices with your DKIM key' },
|
|
212
|
+
{ id: 'webhook', summary: 'Issues a key for the delivery report webhook' },
|
|
213
|
+
],
|
|
214
|
+
personFields: [
|
|
215
|
+
{ id: 'user', itemId: 'smtp', label: 'User name', input: 'text', required: true, maxLength: 128 },
|
|
216
|
+
{ id: 'password', itemId: 'smtp', label: 'Password', input: 'secret', required: true, maxLength: 128 },
|
|
217
|
+
{
|
|
218
|
+
id: 'key',
|
|
219
|
+
itemId: 'dkim',
|
|
220
|
+
label: 'Private key',
|
|
221
|
+
input: 'secret',
|
|
222
|
+
multiline: true,
|
|
223
|
+
required: true,
|
|
224
|
+
maxLength: 4096,
|
|
225
|
+
hint: 'The PEM block, from -----BEGIN to -----END.',
|
|
226
|
+
},
|
|
227
|
+
],
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
/** What the confirmed changes return to the person, by the change they belong to. */
|
|
231
|
+
const personResults: IHarnessQuestionPersonResult[] = [
|
|
232
|
+
{ id: 'dkim-record', itemId: 'dkim', label: 'DNS record', value: 'nm2026._domainkey.nordwind.de', display: 'text' },
|
|
233
|
+
{ id: 'webhook-key', itemId: 'webhook', label: 'Webhook key', value: 'whsec_demo_5Jk2-Qp8r-Tx3v-Lm7w', display: 'secret' },
|
|
234
|
+
{ id: 'webhook-guide', itemId: 'webhook', label: 'Set-up guide', value: 'https://example.com/docs/delivery-reports', display: 'link' },
|
|
235
|
+
];
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* A host carries a confirmation with person values out on its own server: it refuses the demo's
|
|
239
|
+
* refused password, and otherwise hands the card what the changes returned. It shows which values
|
|
240
|
+
* came, never what they are.
|
|
241
|
+
*/
|
|
242
|
+
const runPersonProposal = (event: CustomEvent<IHarnessQuestionResponseDetail>) => {
|
|
243
|
+
const card = event.target as TQuestionCard;
|
|
244
|
+
const { requestId, answers, declinedItemIds, personValues } = event.detail;
|
|
245
|
+
showDemoResult(event.currentTarget as Element, {
|
|
246
|
+
requestId,
|
|
247
|
+
answers,
|
|
248
|
+
declinedItemIds,
|
|
249
|
+
personValues: personValues?.map(({ itemId, fieldId }) => ({ itemId, fieldId, value: '(not shown)' })),
|
|
250
|
+
});
|
|
251
|
+
if (answers[0] !== 'confirm') {
|
|
252
|
+
card.request = { ...card.request, response: answers, respondedAt: Date.now() };
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
const password = personValues?.find((entry) => entry.itemId === 'smtp' && entry.fieldId === 'password')?.value;
|
|
256
|
+
setTimeout(() => {
|
|
257
|
+
if (password === REFUSED_PASSWORD) {
|
|
258
|
+
card.rejectResponse({
|
|
259
|
+
message: 'The mail server refused the sign-in. Nothing was changed.',
|
|
260
|
+
fieldErrors: [{ itemId: 'smtp', fieldId: 'password', message: 'The mail server refused this password.' }],
|
|
261
|
+
});
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
card.request = { ...card.request, response: answers, respondedAt: Date.now(), declinedItemIds, outcome: { tone: 'success', text: 'Mail server connected' } };
|
|
265
|
+
card.personResults = personResults.filter((result) => !declinedItemIds?.includes(result.itemId));
|
|
266
|
+
}, 800);
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
export const demoFunc = () => {
|
|
270
|
+
// a confirmation the host turned down, as the card shows it until the person answers again
|
|
271
|
+
const refused = document.createElement('dees-harness-question-card');
|
|
272
|
+
refused.request = personProposal('p-person-refused');
|
|
273
|
+
void refused.updateComplete.then(() => refused.rejectResponse({
|
|
274
|
+
message: 'The mail server refused the sign-in. Nothing was changed.',
|
|
275
|
+
fieldErrors: [{ itemId: 'smtp', fieldId: 'password', message: 'The mail server refused this password.' }],
|
|
276
|
+
}));
|
|
277
|
+
// a confirmed one, with what its changes returned to the person
|
|
278
|
+
const returned = document.createElement('dees-harness-question-card');
|
|
279
|
+
returned.request = {
|
|
280
|
+
...personProposal('p-person-done'),
|
|
281
|
+
response: ['confirm'],
|
|
282
|
+
outcome: { tone: 'success', text: 'Mail server connected' },
|
|
283
|
+
};
|
|
284
|
+
returned.personResults = personResults;
|
|
285
|
+
return demoPage('Questions', 'Questions the agent asks, and changes it proposes that wait for a confirmation.', html`
|
|
191
286
|
${demoSection('Questions', 'Single choices, multiple choices and written answers.', html`
|
|
192
287
|
<div class="questionDemo dees-demo-stack" @harness-question-response=${logResponse}>
|
|
193
288
|
<dees-harness-question-card
|
|
@@ -260,6 +355,14 @@ export const demoFunc = () => demoPage('Questions', 'Questions the agent asks, a
|
|
|
260
355
|
</div>
|
|
261
356
|
${demoOutput()}
|
|
262
357
|
`)}
|
|
358
|
+
${demoSection('Values only the person gives', `A change may need values from the person alone: entered under it, a secret masked until shown, and sent with the confirmation only. What the changes return to the person shows under them. Enter the password "${REFUSED_PASSWORD}" to see the host turn the confirmation down.`, html`
|
|
359
|
+
<div class="dees-demo-stack" @harness-question-response=${runPersonProposal} @harness-question-link=${routeLink}>
|
|
360
|
+
<dees-harness-question-card .request=${personProposal('p-person')}></dees-harness-question-card>
|
|
361
|
+
${refused}
|
|
362
|
+
${returned}
|
|
363
|
+
</div>
|
|
364
|
+
${demoOutput()}
|
|
365
|
+
`)}
|
|
263
366
|
${demoSection('Decided proposals', 'Read-only once decided: confirmed and under way, confirmed with a change left out, confirmed with a secret only the reader sees, declined, expired, failed.', html`
|
|
264
367
|
<div class="dees-demo-stack" @harness-question-link=${routeLink}>
|
|
265
368
|
${decided.map((request) => html`<dees-harness-question-card .request=${request}></dees-harness-question-card>`)}
|
|
@@ -267,3 +370,4 @@ export const demoFunc = () => demoPage('Questions', 'Questions the agent asks, a
|
|
|
267
370
|
${demoOutput()}
|
|
268
371
|
`)}
|
|
269
372
|
`);
|
|
373
|
+
};
|