@design.estate/dees-catalog 22.1.0 → 22.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist_bundle/bundle.js +2062 -1354
- package/dist_bundle/bundle.js.map +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-3SSZ4CDV.js → chunk-B6IKM3SA.js} +2 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-VIN4YGID.js → chunk-IASP6M5U.js} +3 -3
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-6I3PIV5F.js → chunk-ZPJBKBPH.js} +8 -6
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-6I3PIV5F.js.map → chunk-ZPJBKBPH.js.map} +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{de-STYNV6A3.js → de-3ZAD2XFI.js} +8 -6
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{de-STYNV6A3.js.map → de-3ZAD2XFI.js.map} +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-PULP7K3X.js → dees-modal-CPEH77LV.js} +3 -3
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-KEQHBOYE.js → dees-workspace-terminal-65M4HBRK.js} +4 -4
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/elements/00group-harness/dees-harness-resource-list/dees-harness-resource-list.d.ts +16 -2
- package/dist_ts_web/elements/00group-harness/dees-harness-resource-list/dees-harness-resource-list.demo.js +458 -57
- package/dist_ts_web/elements/00group-harness/dees-harness-resource-list/dees-harness-resource-list.js +67 -34
- package/dist_ts_web/elements/00group-harness/dees-harness-session-list/dees-harness-session-list.d.ts +22 -2
- package/dist_ts_web/elements/00group-harness/dees-harness-session-list/dees-harness-session-list.demo.js +61 -7
- package/dist_ts_web/elements/00group-harness/dees-harness-session-list/dees-harness-session-list.js +273 -27
- package/dist_ts_web/i18n/de.d.ts +16 -8
- package/dist_ts_web/i18n/de.js +7 -5
- package/dist_ts_web/i18n/messages.d.ts +16 -8
- package/dist_ts_web/i18n/messages.js +7 -5
- package/package.json +1 -1
- package/readme.md +4 -2
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements/00group-harness/dees-harness-resource-list/dees-harness-resource-list.demo.ts +504 -98
- package/ts_web/elements/00group-harness/dees-harness-resource-list/dees-harness-resource-list.ts +68 -33
- package/ts_web/elements/00group-harness/dees-harness-session-list/dees-harness-session-list.demo.ts +41 -2
- package/ts_web/elements/00group-harness/dees-harness-session-list/dees-harness-session-list.ts +271 -25
- package/ts_web/i18n/de.ts +6 -4
- package/ts_web/i18n/messages.ts +6 -4
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-3SSZ4CDV.js.map → chunk-B6IKM3SA.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-VIN4YGID.js.map → chunk-IASP6M5U.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-PULP7K3X.js.map → dees-modal-CPEH77LV.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-KEQHBOYE.js.map → dees-workspace-terminal-65M4HBRK.js.map} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DeesElement, css, customElement, directives, html, state } from '@design.estate/dees-element';
|
|
2
|
-
import {
|
|
2
|
+
import { demoOutput, demoPage, demoSection, demoStyles, showDemoResult } from '../../../demos/templates.js';
|
|
3
3
|
import { themeDefaultStyles } from '../../00theme.js';
|
|
4
4
|
import { harnessPillStyles } from '../harness.styles.js';
|
|
5
5
|
import { DeesHarnessConversationPicker } from '../dees-harness-conversation-picker/dees-harness-conversation-picker.js';
|
|
6
|
-
import { DeesContextmenu } from '../../00group-overlay/dees-contextmenu/dees-contextmenu.js';
|
|
6
|
+
import { DeesContextmenu, type TContextMenuItem } from '../../00group-overlay/dees-contextmenu/dees-contextmenu.js';
|
|
7
7
|
import '../dees-harness-question-card/dees-harness-question-card.js';
|
|
8
8
|
import '../dees-harness-permission-card/dees-harness-permission-card.js';
|
|
9
9
|
import type { DeesHarnessResourceList } from './dees-harness-resource-list.js';
|
|
@@ -58,15 +58,15 @@ const demoSessions = (): IDemoSession[] => [
|
|
|
58
58
|
preview: stages[session.stage].description,
|
|
59
59
|
}));
|
|
60
60
|
|
|
61
|
-
// Resources are peers of sessions: `terminal:
|
|
61
|
+
// Resources are peers of sessions: `terminal:dev-server` sits in Active while it
|
|
62
62
|
// stays attached to a session in Recent.
|
|
63
63
|
const demoGroups: IHarnessSessionGroup[] = [
|
|
64
64
|
{
|
|
65
65
|
id: 'active',
|
|
66
|
-
name: '
|
|
66
|
+
name: 'Active',
|
|
67
67
|
itemIds: [
|
|
68
68
|
{ kind: 'session', id: 'session-0' },
|
|
69
|
-
{ kind: 'resource', id: 'terminal:
|
|
69
|
+
{ kind: 'resource', id: 'terminal:dev-server' },
|
|
70
70
|
{ kind: 'session', id: 'session-1' },
|
|
71
71
|
{ kind: 'session', id: 'session-2' },
|
|
72
72
|
{ kind: 'session', id: 'session-6' },
|
|
@@ -93,40 +93,43 @@ const sameRef = (
|
|
|
93
93
|
|
|
94
94
|
const demoResources: IHarnessResourceMeta[] = [
|
|
95
95
|
{
|
|
96
|
-
id: 'terminal:
|
|
96
|
+
id: 'terminal:dev-server',
|
|
97
97
|
kind: 'terminal',
|
|
98
|
-
title: '
|
|
98
|
+
title: 'Dev server',
|
|
99
99
|
icon: 'lucide:Terminal',
|
|
100
|
-
preview: '
|
|
100
|
+
preview: '/workspace/storefront',
|
|
101
101
|
projectLabel: 'storefront',
|
|
102
102
|
updatedAt: Date.now() - 90_000,
|
|
103
|
-
state: '
|
|
103
|
+
state: 'running',
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
|
-
id: '
|
|
107
|
-
kind: '
|
|
108
|
-
title: '
|
|
109
|
-
icon: 'lucide:
|
|
110
|
-
preview: '
|
|
106
|
+
id: 'workspace:catalog',
|
|
107
|
+
kind: 'workspace',
|
|
108
|
+
title: 'dees-catalog',
|
|
109
|
+
icon: 'lucide:PanelsTopLeft',
|
|
110
|
+
preview: '/design.estate/dees-catalog',
|
|
111
111
|
projectLabel: 'catalog',
|
|
112
112
|
updatedAt: Date.now() - 180_000,
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
|
-
id: 'browser:
|
|
115
|
+
id: 'browser:storefront',
|
|
116
116
|
kind: 'browser',
|
|
117
|
-
title: '
|
|
118
|
-
icon: 'lucide:
|
|
119
|
-
preview: '
|
|
117
|
+
title: 'Storefront preview',
|
|
118
|
+
icon: 'lucide:Globe2',
|
|
119
|
+
preview: 'agent available',
|
|
120
|
+
projectLabel: 'storefront',
|
|
120
121
|
updatedAt: Date.now() - 240_000,
|
|
122
|
+
state: 'available',
|
|
121
123
|
},
|
|
122
|
-
//
|
|
124
|
+
// A browser opened for a quick look, closed from the list; the host removes it on `harness-resource-close`.
|
|
123
125
|
{
|
|
124
|
-
id: '
|
|
125
|
-
kind: '
|
|
126
|
-
title: '
|
|
127
|
-
icon: 'lucide:
|
|
128
|
-
preview: '
|
|
126
|
+
id: 'browser:pull-request',
|
|
127
|
+
kind: 'browser',
|
|
128
|
+
title: 'Pull request preview',
|
|
129
|
+
icon: 'lucide:Globe2',
|
|
130
|
+
preview: 'no agent attached',
|
|
129
131
|
updatedAt: Date.now() - 30_000,
|
|
132
|
+
state: 'available',
|
|
130
133
|
closeable: true,
|
|
131
134
|
},
|
|
132
135
|
];
|
|
@@ -135,27 +138,27 @@ const demoResources: IHarnessResourceMeta[] = [
|
|
|
135
138
|
// or a resource such as a terminal.
|
|
136
139
|
const demoResourceAssociations: IHarnessResourceAssociation[] = [
|
|
137
140
|
{
|
|
138
|
-
resourceId: 'terminal:
|
|
141
|
+
resourceId: 'terminal:dev-server',
|
|
139
142
|
targets: [{ kind: 'session', id: 'session-4' }, { kind: 'session', id: 'session-0' }],
|
|
140
143
|
},
|
|
141
|
-
{ resourceId: '
|
|
144
|
+
{ resourceId: 'workspace:catalog', targets: [{ kind: 'session', id: 'session-3' }] },
|
|
145
|
+
{ resourceId: 'browser:storefront', targets: [{ kind: 'resource', id: 'terminal:dev-server' }] },
|
|
142
146
|
];
|
|
143
147
|
|
|
144
148
|
const demoEligibleSessionTargets: IHarnessSessionListItemRef[] = [
|
|
145
149
|
{ kind: 'session', id: 'session-0' },
|
|
146
150
|
{ kind: 'session', id: 'session-1' },
|
|
147
151
|
{ kind: 'session', id: 'session-2' },
|
|
152
|
+
{ kind: 'session', id: 'session-3' },
|
|
148
153
|
{ kind: 'session', id: 'session-4' },
|
|
149
154
|
];
|
|
150
155
|
|
|
151
156
|
const demoResourceEligibleTargets: Record<string, IHarnessSessionListItemRef[]> = Object.fromEntries(
|
|
152
157
|
demoResources.map((resource) => [
|
|
153
158
|
resource.id,
|
|
154
|
-
resource.kind === '
|
|
155
|
-
?
|
|
156
|
-
:
|
|
157
|
-
? demoEligibleSessionTargets
|
|
158
|
-
: [...demoEligibleSessionTargets, { kind: 'resource' as const, id: 'terminal:build' }],
|
|
159
|
+
resource.kind === 'terminal'
|
|
160
|
+
? demoEligibleSessionTargets
|
|
161
|
+
: [...demoEligibleSessionTargets, { kind: 'resource' as const, id: 'terminal:dev-server' }],
|
|
159
162
|
]),
|
|
160
163
|
);
|
|
161
164
|
|
|
@@ -277,18 +280,21 @@ const handleResourceAssociation = (
|
|
|
277
280
|
list.resourceAssociations = next;
|
|
278
281
|
};
|
|
279
282
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
283
|
+
/**
|
|
284
|
+
* Attach, Move and Detach, as a host offers them in a resource's menu. The picker offers the
|
|
285
|
+
* conversations the list renders and those it only knows as attachment targets.
|
|
286
|
+
*/
|
|
287
|
+
const associationMenuItems = (
|
|
288
|
+
list: TDemoSessionList,
|
|
289
|
+
detail: IHarnessResourceContextDetail,
|
|
290
|
+
): TContextMenuItem[] => {
|
|
291
|
+
const { resource, targets: currentTargets } = detail;
|
|
292
|
+
const sessions = [...list.sessions, ...list.attachableSessions];
|
|
287
293
|
const pickerOptions = {
|
|
288
|
-
sessions
|
|
294
|
+
sessions,
|
|
289
295
|
groups: list.groups,
|
|
290
296
|
resources: list.resources.filter((candidate) => candidate.id !== resource.id),
|
|
291
|
-
eligibleTargets,
|
|
297
|
+
eligibleTargets: list.eligibleTargetsByResourceId[resource.id],
|
|
292
298
|
};
|
|
293
299
|
/** Which attachment did the user mean? Only asked when there is more than one. */
|
|
294
300
|
const pickAttachment = async (
|
|
@@ -296,7 +302,7 @@ const handleResourceContext = async (
|
|
|
296
302
|
): Promise<IHarnessSessionListItemRef | null> => {
|
|
297
303
|
if (currentTargets.length <= 1) return currentTargets[0] ?? null;
|
|
298
304
|
return DeesHarnessConversationPicker.pick({
|
|
299
|
-
sessions
|
|
305
|
+
sessions,
|
|
300
306
|
groups: list.groups,
|
|
301
307
|
resources: list.resources,
|
|
302
308
|
eligibleTargets: currentTargets,
|
|
@@ -304,65 +310,77 @@ const handleResourceContext = async (
|
|
|
304
310
|
emptyText: 'No attachment to choose.',
|
|
305
311
|
});
|
|
306
312
|
};
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
event.detail.requestAssociation(
|
|
325
|
-
target,
|
|
326
|
-
currentTargets.length ? 'attach-additional' : 'attach',
|
|
327
|
-
);
|
|
328
|
-
}
|
|
329
|
-
},
|
|
313
|
+
return [
|
|
314
|
+
{
|
|
315
|
+
name: currentTargets.length ? 'Additionally attach to…' : 'Attach to…',
|
|
316
|
+
iconName: 'lucide:Link',
|
|
317
|
+
action: async () => {
|
|
318
|
+
detail.close();
|
|
319
|
+
const target = await DeesHarnessConversationPicker.pick({
|
|
320
|
+
...pickerOptions,
|
|
321
|
+
excludeTargets: currentTargets,
|
|
322
|
+
heading: `Attach ${resource.title} to…`,
|
|
323
|
+
});
|
|
324
|
+
if (target) {
|
|
325
|
+
detail.requestAssociation(
|
|
326
|
+
target,
|
|
327
|
+
currentTargets.length ? 'attach-additional' : 'attach',
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
330
|
},
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
|
|
331
|
+
},
|
|
332
|
+
...(currentTargets.length
|
|
333
|
+
? [
|
|
334
|
+
{
|
|
335
|
+
name: 'Move to…',
|
|
336
|
+
iconName: 'lucide:MoveRight',
|
|
337
|
+
action: async () => {
|
|
338
|
+
detail.close();
|
|
339
|
+
const fromTarget = await pickAttachment(`Move which attachment of ${resource.title}?`);
|
|
340
|
+
if (!fromTarget) return;
|
|
341
|
+
const target = await DeesHarnessConversationPicker.pick({
|
|
342
|
+
...pickerOptions,
|
|
343
|
+
excludeTargets: currentTargets,
|
|
344
|
+
heading: `Move ${resource.title} to…`,
|
|
345
|
+
});
|
|
346
|
+
if (target) detail.requestAssociation(target, 'move', fromTarget);
|
|
347
347
|
},
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
name: 'Detach',
|
|
351
|
+
iconName: 'lucide:Unlink',
|
|
352
|
+
action: async () => {
|
|
353
|
+
detail.close();
|
|
354
|
+
const fromTarget = await pickAttachment(`Detach which attachment of ${resource.title}?`);
|
|
355
|
+
if (fromTarget) detail.requestAssociation(null, 'detach', fromTarget);
|
|
356
356
|
},
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
357
|
+
},
|
|
358
|
+
]
|
|
359
|
+
: []),
|
|
360
|
+
];
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
/** Opens a resource's menu where the list asked for it and tells the list once it is gone. */
|
|
364
|
+
const openResourceMenu = async (
|
|
365
|
+
detail: IHarnessResourceContextDetail,
|
|
366
|
+
itemsArg: TContextMenuItem[],
|
|
367
|
+
): Promise<void> => {
|
|
368
|
+
const menu = await DeesContextmenu.openContextMenuWithOptions(
|
|
369
|
+
new MouseEvent('contextmenu', { clientX: detail.clientX, clientY: detail.clientY }),
|
|
370
|
+
itemsArg,
|
|
360
371
|
);
|
|
361
372
|
if (!menu) {
|
|
362
|
-
|
|
373
|
+
detail.close();
|
|
363
374
|
} else {
|
|
364
|
-
menu.registerGarbageFunction(() =>
|
|
375
|
+
menu.registerGarbageFunction(() => detail.close());
|
|
365
376
|
}
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
const handleResourceContext = async (
|
|
380
|
+
event: CustomEvent<IHarnessResourceContextDetail>,
|
|
381
|
+
): Promise<void> => {
|
|
382
|
+
const list = event.currentTarget as TDemoSessionList;
|
|
383
|
+
await openResourceMenu(event.detail, associationMenuItems(list, event.detail));
|
|
366
384
|
list.selectedResourceId = event.detail.resource.id;
|
|
367
385
|
};
|
|
368
386
|
|
|
@@ -402,9 +420,7 @@ class DeesDemoResourceWorkspace extends DeesElement {
|
|
|
402
420
|
:host { display: flex; flex-direction: column; height: 100%; min-height: 0; gap: 16px; container-type: inline-size; }
|
|
403
421
|
* { box-sizing: border-box; }
|
|
404
422
|
.topbar, .toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
|
|
405
|
-
.topbar { justify-content:
|
|
406
|
-
h1 { margin: 0; font-size: 22px; font-weight: 620; letter-spacing: -.025em; }
|
|
407
|
-
.subtitle { margin: 4px 0 0; font-size: 12px; color: var(--dees-color-text-secondary); }
|
|
423
|
+
.topbar { justify-content: flex-end; }
|
|
408
424
|
.workspace { display: grid; grid-template-columns: minmax(330px, 39%) minmax(0, 1fr); flex: 1; min-height: 0; border: 1px solid var(--dees-color-border-subtle); border-radius: var(--dees-radius-2xl); overflow: hidden; background: var(--dees-color-bg-primary); }
|
|
409
425
|
.sidebar { display: flex; flex-direction: column; min-height: 0; min-width: 0; padding-top: 8px; border-right: 1px solid var(--dees-color-border-subtle); background: var(--dees-color-bg-canvas); }
|
|
410
426
|
.sidebarSummary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; font-size: 12px; font-weight: 600; }
|
|
@@ -502,7 +518,6 @@ class DeesDemoResourceWorkspace extends DeesElement {
|
|
|
502
518
|
const tone = { normal: 'default', working: 'running', external: 'warning', attention: 'warning', error: 'error', finished: 'success' }[current.state];
|
|
503
519
|
return html`
|
|
504
520
|
<header class="topbar">
|
|
505
|
-
<div><h1>Workspace</h1><p class="subtitle">Arrange conversations and resources: group them, reorder them, attach a resource where it is needed.</p></div>
|
|
506
521
|
<div class="toolbar">
|
|
507
522
|
<dees-button size="sm" @clicked=${() => openModal(this.sessions, this.groups)}>Open session browser</dees-button>
|
|
508
523
|
<dees-button size="sm" type="ghost" @clicked=${this.reset}>Reset demo</dees-button>
|
|
@@ -613,4 +628,395 @@ class DeesDemoResourceWorkspace extends DeesElement {
|
|
|
613
628
|
}
|
|
614
629
|
}
|
|
615
630
|
|
|
616
|
-
|
|
631
|
+
type TDemoResourceKind = 'terminal' | 'browser' | 'workspace';
|
|
632
|
+
type TDemoBrowserAgent = 'detached' | 'transitioning' | 'available' | 'dependencyUnavailable';
|
|
633
|
+
|
|
634
|
+
/** A host's own resource record; the list sees it only as `IHarnessResourceMeta`. */
|
|
635
|
+
type TDemoResource = {
|
|
636
|
+
id: string;
|
|
637
|
+
title: string;
|
|
638
|
+
updatedAt: number;
|
|
639
|
+
retiring?: boolean;
|
|
640
|
+
/** Conversations the resource is attached to. */
|
|
641
|
+
attachedTo: string[];
|
|
642
|
+
} & (
|
|
643
|
+
| { kind: 'terminal'; cwd: string; running: boolean; claude?: { failure?: string }; lines: string[] }
|
|
644
|
+
| { kind: 'browser'; url: string; runtimeAvailable: boolean; agent: TDemoBrowserAgent; page: string }
|
|
645
|
+
| { kind: 'workspace'; baseDir: string; files: string[] }
|
|
646
|
+
);
|
|
647
|
+
|
|
648
|
+
/** How the view names and shows each kind it lists. */
|
|
649
|
+
const resourceKinds: Record<TDemoResourceKind, { label: string; noun: string; plural: string; icon: string; emptyDescription: string }> = {
|
|
650
|
+
terminal: { label: 'Terminals', noun: 'terminal', plural: 'terminals', icon: 'lucide:Terminal', emptyDescription: 'Start a shell or a Claude terminal in this project.' },
|
|
651
|
+
browser: { label: 'Browsers', noun: 'browser', plural: 'browsers', icon: 'lucide:Globe2', emptyDescription: 'Start a browser for this project.' },
|
|
652
|
+
workspace: { label: 'Workspaces', noun: 'workspace', plural: 'workspaces', icon: 'lucide:PanelsTopLeft', emptyDescription: 'Open a workspace on this project\'s files.' },
|
|
653
|
+
};
|
|
654
|
+
|
|
655
|
+
const browserAgentLabels: Record<TDemoBrowserAgent, string> = {
|
|
656
|
+
detached: 'no agent attached',
|
|
657
|
+
transitioning: 'agent attaching',
|
|
658
|
+
available: 'agent available',
|
|
659
|
+
dependencyUnavailable: 'agent unavailable',
|
|
660
|
+
};
|
|
661
|
+
|
|
662
|
+
/** Conversations of the project. They live in another list; resources only attach to them. */
|
|
663
|
+
const demoConversations: IHarnessSessionMeta[] = ([
|
|
664
|
+
{ id: 'conv-release', title: 'Release dees-catalog 22.1', harness: { id: 'claude', name: 'Claude Code' }, state: 'working', statusLabel: 'Working' },
|
|
665
|
+
{ id: 'conv-demo', title: 'Update the resource list demo', harness: { id: 'codex', name: 'Codex' }, state: 'attention', statusLabel: 'Needs input' },
|
|
666
|
+
{ id: 'conv-checkout', title: 'Checkout flow regression', harness: { id: 'flexharness', name: 'FlexHarness' }, state: 'working', statusLabel: 'Working' },
|
|
667
|
+
{ id: 'conv-kanban', title: 'Kanban columns reach the bottom edge', harness: { id: 'opencode', name: 'OpenCode' }, state: 'finished', statusLabel: 'Completed' },
|
|
668
|
+
{ id: 'conv-docs', title: 'Document the resource views', harness: { id: 'claude', name: 'Claude Code' }, state: 'normal', statusLabel: 'Idle' },
|
|
669
|
+
] satisfies IHarnessSessionMeta[]).map((conversation, index) => ({ ...conversation, updatedAt: Date.now() - (index + 1) * 4 * 60_000 }));
|
|
670
|
+
|
|
671
|
+
const conversationTargets: IHarnessSessionListItemRef[] = demoConversations.map((conversation) => ({ kind: 'session', id: conversation.id }));
|
|
672
|
+
|
|
673
|
+
const demoProjectResources = (): TDemoResource[] => {
|
|
674
|
+
const minutesAgo = (minutes: number) => Date.now() - minutes * 60_000;
|
|
675
|
+
return [
|
|
676
|
+
{ id: 'term-dev', kind: 'terminal', title: 'Dev server', cwd: '/workspace/dees-catalog', running: true, updatedAt: minutesAgo(1), attachedTo: ['conv-demo'],
|
|
677
|
+
lines: ['$ pnpm watch', 'wcctools dev · serving the catalog on http://localhost:3010', 'tsbundle · ts_web rebuilt in 2.4 s', 'reload · 1 client'] },
|
|
678
|
+
{ id: 'term-claude', kind: 'terminal', title: 'Release review', cwd: '/workspace/dees-catalog', running: true, claude: {}, updatedAt: minutesAgo(3), attachedTo: ['conv-release', 'conv-docs'],
|
|
679
|
+
lines: ['> Review the 22.1.0 changelog against the diff', 'Reading changelog.md and 14 changed files…', 'The Pending entry names every changed element. Ready to release.'] },
|
|
680
|
+
{ id: 'term-tests', kind: 'terminal', title: 'Test watch', cwd: '/workspace/dees-catalog', running: true, updatedAt: minutesAgo(7), attachedTo: [],
|
|
681
|
+
lines: ['$ tstest test/ --web --watch', 'test.harness-resource-list.browser.ts · 41 passed', 'test.harness-session-list.browser.ts · 23 passed', 'watching for changes…'] },
|
|
682
|
+
{ id: 'term-triage', kind: 'terminal', title: 'Rate limit triage', cwd: '/workspace/gateway', running: false, claude: { failure: 'inference_lost' }, updatedAt: minutesAgo(26), attachedTo: [], lines: [] },
|
|
683
|
+
{ id: 'term-migration', kind: 'terminal', title: 'Migration shell', cwd: '/workspace/storefront', running: true, retiring: true, updatedAt: minutesAgo(48), attachedTo: [],
|
|
684
|
+
lines: ['$ pnpm run migrate', 'migration 0042 · applied'] },
|
|
685
|
+
{ id: 'browser-catalog', kind: 'browser', title: 'Catalog preview', url: 'http://localhost:3010/#dees-harness-resource-list', runtimeAvailable: true, agent: 'available', page: 'Resource list', updatedAt: minutesAgo(2), attachedTo: ['conv-demo'] },
|
|
686
|
+
{ id: 'browser-checkout', kind: 'browser', title: 'Checkout flow', url: 'https://staging.shop.example/checkout', runtimeAvailable: true, agent: 'transitioning', page: 'Checkout', updatedAt: minutesAgo(5), attachedTo: ['conv-checkout'] },
|
|
687
|
+
{ id: 'browser-docs', kind: 'browser', title: 'Docs site', url: 'https://code.foss.global/design.estate/dees-catalog', runtimeAvailable: true, agent: 'detached', page: 'dees-catalog', updatedAt: minutesAgo(19), attachedTo: [] },
|
|
688
|
+
{ id: 'browser-dashboard', kind: 'browser', title: 'Staging dashboard', url: 'https://dash.staging.example', runtimeAvailable: false, agent: 'dependencyUnavailable', page: 'Dashboard', updatedAt: minutesAgo(64), attachedTo: [] },
|
|
689
|
+
{ id: 'ws-catalog', kind: 'workspace', title: 'dees-catalog', baseDir: 'design.estate/dees-catalog', updatedAt: minutesAgo(1), attachedTo: ['conv-release', 'conv-demo', 'conv-docs'],
|
|
690
|
+
files: ['changelog.md', 'package.json', 'readme.md', 'ts_web/elements/00group-harness/', 'test/'] },
|
|
691
|
+
{ id: 'ws-agl', kind: 'workspace', title: 'AGL web app', baseDir: 'modelprofile.com/agl', updatedAt: minutesAgo(12), attachedTo: ['conv-kanban'],
|
|
692
|
+
files: ['ts_web/elements.harnesscontrollerapp.ts', 'ts_interfaces/', 'test/', 'readme.md'] },
|
|
693
|
+
{ id: 'ws-wcctools', kind: 'workspace', title: 'wcctools', baseDir: 'design.estate/dees-wcctools', updatedAt: minutesAgo(35), attachedTo: [],
|
|
694
|
+
files: ['ts_web/', 'readme.md'] },
|
|
695
|
+
{ id: 'ws-storefront', kind: 'workspace', title: 'Old storefront', baseDir: 'archive/storefront', retiring: true, updatedAt: minutesAgo(90), attachedTo: [],
|
|
696
|
+
files: ['readme.md'] },
|
|
697
|
+
];
|
|
698
|
+
};
|
|
699
|
+
|
|
700
|
+
/** A resource as a row, the way AGL builds its Terminals, Browsers and Workspaces lists. */
|
|
701
|
+
const resourceMeta = (resource: TDemoResource): IHarnessResourceMeta => {
|
|
702
|
+
const base = { id: resource.id, kind: resource.kind, title: resource.title, updatedAt: resource.updatedAt, draggable: false };
|
|
703
|
+
if (resource.kind === 'terminal') {
|
|
704
|
+
return {
|
|
705
|
+
...base,
|
|
706
|
+
icon: resource.claude ? 'lucide:Bot' : 'lucide:Terminal',
|
|
707
|
+
preview: resource.claude
|
|
708
|
+
? `Claude${resource.claude.failure ? ` · ${resource.claude.failure}` : ''} · ${resource.cwd}`
|
|
709
|
+
: resource.cwd,
|
|
710
|
+
state: resource.retiring ? 'retiring' : resource.running ? 'running' : 'stopped',
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
if (resource.kind === 'workspace') {
|
|
714
|
+
return { ...base, icon: 'lucide:PanelsTopLeft', preview: `/${resource.baseDir}`, ...(resource.retiring ? { state: 'retiring' } : {}) };
|
|
715
|
+
}
|
|
716
|
+
return {
|
|
717
|
+
...base,
|
|
718
|
+
icon: 'lucide:Globe2',
|
|
719
|
+
preview: browserAgentLabels[resource.agent],
|
|
720
|
+
state: resource.retiring ? 'retiring' : resource.runtimeAvailable ? 'available' : 'unavailable',
|
|
721
|
+
};
|
|
722
|
+
};
|
|
723
|
+
|
|
724
|
+
@customElement('dees-demo-resource-views')
|
|
725
|
+
class DeesDemoResourceViews extends DeesElement {
|
|
726
|
+
@state() private accessor kind: TDemoResourceKind = 'terminal';
|
|
727
|
+
@state() private accessor resources = demoProjectResources();
|
|
728
|
+
@state() private accessor selectedResourceId = 'term-dev';
|
|
729
|
+
@state() private accessor notice = 'Switch between Terminals, Browsers and Workspaces. Open a row’s Actions to start, stop, attach or retire it.';
|
|
730
|
+
private readonly retireTimers = new Set<ReturnType<typeof setTimeout>>();
|
|
731
|
+
private createdCount = 0;
|
|
732
|
+
|
|
733
|
+
public static styles = [themeDefaultStyles, demoStyles, harnessPillStyles, css`
|
|
734
|
+
:host { display: grid; gap: 12px; min-width: 0; container-type: inline-size; }
|
|
735
|
+
* { box-sizing: border-box; }
|
|
736
|
+
.kinds { display: flex; flex-wrap: wrap; gap: 4px; }
|
|
737
|
+
.view { display: grid; grid-template-columns: minmax(0, 1fr) 300px; height: 560px; border: 1px solid var(--dees-color-border-subtle); border-radius: var(--dees-radius-xl); overflow: hidden; background: var(--dees-color-bg-primary); }
|
|
738
|
+
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
|
|
739
|
+
.sidebar { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-left: 1px solid var(--dees-color-border-subtle); background: var(--dees-color-bg-canvas); }
|
|
740
|
+
.sidebarRow { display: flex; align-items: center; gap: 4px; padding: 8px 8px 4px 12px; }
|
|
741
|
+
.project { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--dees-color-text-secondary); }
|
|
742
|
+
dees-harness-resource-list { flex: 1; min-height: 0; }
|
|
743
|
+
.paneHeader { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--dees-color-border-subtle); min-width: 0; }
|
|
744
|
+
.paneTitle { font-size: 14px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
745
|
+
.paneSub { font-size: 12px; color: var(--dees-color-text-secondary); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
746
|
+
.paneHeader .harness-pill { margin-left: auto; text-transform: none; flex: none; }
|
|
747
|
+
.paneBody { flex: 1; min-height: 0; overflow: auto; padding: 16px 18px; display: grid; align-content: start; gap: 12px; }
|
|
748
|
+
.shell { margin: 0; padding: 14px 16px; border-radius: var(--dees-radius-lg); background: var(--dees-color-code-bg); color: var(--dees-color-text-primary); font: 12px/1.7 var(--dees-font-family-mono); white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
749
|
+
.address { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--dees-radius-md); border: 1px solid var(--dees-color-border-subtle); background: var(--dees-color-bg-secondary); font: 12px/1.5 var(--dees-font-family-mono); color: var(--dees-color-text-secondary); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
|
|
750
|
+
.page { display: grid; place-items: center; min-height: 260px; border-radius: var(--dees-radius-lg); border: 1px dashed var(--dees-color-border-subtle); color: var(--dees-color-text-muted); font-size: 13px; text-align: center; padding: 16px; }
|
|
751
|
+
.files { margin: 0; padding: 0; list-style: none; }
|
|
752
|
+
.files li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--dees-color-border-subtle); font: 12px/1.5 var(--dees-font-family-mono); color: var(--dees-color-text-secondary); }
|
|
753
|
+
.attached { font-size: 12px; color: var(--dees-color-text-secondary); }
|
|
754
|
+
.empty { flex: 1; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 24px; text-align: center; }
|
|
755
|
+
.empty h3 { margin: 0; font-size: 16px; font-weight: 600; }
|
|
756
|
+
.empty p { margin: 0; max-width: 340px; font-size: 13px; line-height: 1.6; color: var(--dees-color-text-secondary); }
|
|
757
|
+
.emptyIcon { color: var(--dees-color-text-muted); }
|
|
758
|
+
@container (max-width: 700px) {
|
|
759
|
+
.view { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(200px, 40%); }
|
|
760
|
+
.sidebar { border-left: 0; border-top: 1px solid var(--dees-color-border-subtle); }
|
|
761
|
+
}
|
|
762
|
+
`];
|
|
763
|
+
|
|
764
|
+
public async disconnectedCallback(): Promise<void> {
|
|
765
|
+
await super.disconnectedCallback();
|
|
766
|
+
for (const timer of this.retireTimers) clearTimeout(timer);
|
|
767
|
+
this.retireTimers.clear();
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
private get list(): DeesHarnessResourceList | null {
|
|
771
|
+
return this.shadowRoot?.querySelector('dees-harness-resource-list') ?? null;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
private ofKind(kindArg: TDemoResourceKind): TDemoResource[] {
|
|
775
|
+
return this.resources.filter((resource) => resource.kind === kindArg);
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
private showKind(kindArg: TDemoResourceKind): void {
|
|
779
|
+
this.kind = kindArg;
|
|
780
|
+
this.selectedResourceId = this.ofKind(kindArg).find((resource) => !resource.retiring)?.id ?? '';
|
|
781
|
+
this.notice = `${resourceKinds[kindArg].label} of design.estate/dees-catalog.`;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
private patch(idArg: string, changeArg: (resource: TDemoResource) => TDemoResource): void {
|
|
785
|
+
this.resources = this.resources.map((resource) => resource.id === idArg ? changeArg(resource) : resource);
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
private setRunning(resourceArg: TDemoResource, runningArg: boolean): void {
|
|
789
|
+
this.patch(resourceArg.id, (resource) => resource.kind !== 'terminal' ? resource : {
|
|
790
|
+
...resource,
|
|
791
|
+
running: runningArg,
|
|
792
|
+
updatedAt: Date.now(),
|
|
793
|
+
...(resource.claude ? { claude: {} } : {}),
|
|
794
|
+
lines: runningArg ? [`$ cd ${resource.cwd}`, resource.claude ? 'Claude resumed the conversation.' : 'A new shell is ready.'] : resource.lines,
|
|
795
|
+
});
|
|
796
|
+
this.notice = `${runningArg ? 'Started' : 'Stopped'} ${resourceArg.title}.`;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
/** Retiring is visible on the row until the host has removed the resource. */
|
|
800
|
+
private retire(resourceArg: TDemoResource): void {
|
|
801
|
+
this.patch(resourceArg.id, (resource) => ({ ...resource, retiring: true, updatedAt: Date.now() }));
|
|
802
|
+
this.notice = `Retiring ${resourceArg.title}…`;
|
|
803
|
+
const timer = setTimeout(() => {
|
|
804
|
+
this.retireTimers.delete(timer);
|
|
805
|
+
this.resources = this.resources.filter((resource) => resource.id !== resourceArg.id);
|
|
806
|
+
if (this.selectedResourceId === resourceArg.id) this.selectedResourceId = '';
|
|
807
|
+
this.notice = `Retired ${resourceArg.title}. Reset the example to bring it back.`;
|
|
808
|
+
}, 2500);
|
|
809
|
+
this.retireTimers.add(timer);
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
private create(kindArg: TDemoResourceKind, claudeArg = false): void {
|
|
813
|
+
this.createdCount += 1;
|
|
814
|
+
const id = `${kindArg}-new-${this.createdCount}`;
|
|
815
|
+
const base = { id, updatedAt: Date.now(), attachedTo: [] };
|
|
816
|
+
const resource: TDemoResource = kindArg === 'terminal'
|
|
817
|
+
? { ...base, kind: 'terminal', title: claudeArg ? 'Claude' : `Shell ${this.createdCount}`, cwd: '/workspace/dees-catalog', running: true,
|
|
818
|
+
...(claudeArg ? { claude: {} } : {}), lines: ['$ cd /workspace/dees-catalog', claudeArg ? 'Claude is ready.' : 'A new shell is ready.'] }
|
|
819
|
+
: kindArg === 'browser'
|
|
820
|
+
? { ...base, kind: 'browser', title: `Browser ${this.createdCount}`, url: 'about:blank', runtimeAvailable: true, agent: 'detached', page: 'New tab' }
|
|
821
|
+
: { ...base, kind: 'workspace', title: `Workspace ${this.createdCount}`, baseDir: 'design.estate/dees-catalog', files: ['changelog.md', 'readme.md', 'ts_web/'] };
|
|
822
|
+
this.resources = [...this.resources, resource];
|
|
823
|
+
this.selectedResourceId = id;
|
|
824
|
+
this.notice = `Started ${resource.title}.`;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
/** A browser or a workspace starts at once; a terminal asks which one. */
|
|
828
|
+
private openNew(event: Event): void {
|
|
829
|
+
if (this.kind !== 'terminal') {
|
|
830
|
+
this.create(this.kind);
|
|
831
|
+
return;
|
|
832
|
+
}
|
|
833
|
+
const button = event.currentTarget as HTMLElement;
|
|
834
|
+
const rect = button.getBoundingClientRect();
|
|
835
|
+
void DeesContextmenu.openContextMenuWithOptions(
|
|
836
|
+
new MouseEvent('click', { clientX: rect.left, clientY: rect.bottom + 6 }),
|
|
837
|
+
[
|
|
838
|
+
{ name: 'Shell', iconName: 'lucide:Terminal', action: async () => this.create('terminal') },
|
|
839
|
+
{ name: 'Claude terminal', iconName: 'lucide:Bot', action: async () => this.create('terminal', true) },
|
|
840
|
+
],
|
|
841
|
+
{ ownerElement: button },
|
|
842
|
+
);
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
private handleAssociate(event: CustomEvent<THarnessResourceAssociateDetail>): void {
|
|
846
|
+
const detail = event.detail;
|
|
847
|
+
// Only conversations are attach targets here, as in AGL.
|
|
848
|
+
const to = detail.mode === 'detach' ? undefined : detail.toTarget.id;
|
|
849
|
+
const from = detail.mode === 'detach' || detail.mode === 'move' ? detail.fromTarget.id : undefined;
|
|
850
|
+
this.patch(detail.resource.id, (resource) => ({
|
|
851
|
+
...resource,
|
|
852
|
+
attachedTo: [...resource.attachedTo.filter((id) => id !== from), ...(to ? [to] : [])],
|
|
853
|
+
}));
|
|
854
|
+
const name = (idArg?: string) => demoConversations.find((conversation) => conversation.id === idArg)?.title;
|
|
855
|
+
this.notice = detail.mode === 'detach'
|
|
856
|
+
? `Detached ${detail.resource.title} from ${name(from)}.`
|
|
857
|
+
: detail.mode === 'move'
|
|
858
|
+
? `Moved ${detail.resource.title} from ${name(from)} to ${name(to)}.`
|
|
859
|
+
: `Attached ${detail.resource.title} to ${name(to)}.`;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
private handleContext(event: CustomEvent<IHarnessResourceContextDetail>): void {
|
|
863
|
+
const list = event.currentTarget as DeesHarnessResourceList;
|
|
864
|
+
const resource = this.resources.find((candidate) => candidate.id === event.detail.resource.id);
|
|
865
|
+
if (!resource) return;
|
|
866
|
+
void openResourceMenu(event.detail, [
|
|
867
|
+
...(resource.kind === 'terminal'
|
|
868
|
+
? [{
|
|
869
|
+
name: resource.running ? 'Stop' : 'Start',
|
|
870
|
+
iconName: resource.running ? 'lucide:Square' : 'lucide:Play',
|
|
871
|
+
action: async () => this.setRunning(resource, !resource.running),
|
|
872
|
+
}, { divider: true as const }]
|
|
873
|
+
: []),
|
|
874
|
+
...associationMenuItems(list, event.detail),
|
|
875
|
+
{ divider: true },
|
|
876
|
+
{ name: 'Retire', iconName: 'lucide:Trash2', action: async () => this.retire(resource) },
|
|
877
|
+
]);
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
private reset(): void {
|
|
881
|
+
for (const timer of this.retireTimers) clearTimeout(timer);
|
|
882
|
+
this.retireTimers.clear();
|
|
883
|
+
this.resources = demoProjectResources();
|
|
884
|
+
this.kind = 'terminal';
|
|
885
|
+
this.selectedResourceId = 'term-dev';
|
|
886
|
+
this.notice = 'Example reset.';
|
|
887
|
+
if (this.list) this.list.search = '';
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
private renderPane(resourceArg: TDemoResource | undefined) {
|
|
891
|
+
const copy = resourceKinds[this.kind];
|
|
892
|
+
if (!resourceArg) {
|
|
893
|
+
const count = this.ofKind(this.kind).length;
|
|
894
|
+
return html`
|
|
895
|
+
<div class="empty">
|
|
896
|
+
<dees-icon class="emptyIcon" icon=${copy.icon} iconSize="23"></dees-icon>
|
|
897
|
+
<h3>${count ? `No ${copy.noun} open` : `No ${copy.plural} yet`}</h3>
|
|
898
|
+
<p>${count ? 'Open one from the list, or start a new one.' : copy.emptyDescription}</p>
|
|
899
|
+
<dees-button type="accent" @clicked=${(event: Event) => this.openNew(event)}>New ${copy.noun}</dees-button>
|
|
900
|
+
</div>
|
|
901
|
+
`;
|
|
902
|
+
}
|
|
903
|
+
const meta = resourceMeta(resourceArg);
|
|
904
|
+
const tone = meta.state === 'running' || meta.state === 'available' ? 'success'
|
|
905
|
+
: meta.state === 'retiring' || meta.state === 'unavailable' ? 'warning'
|
|
906
|
+
: 'default';
|
|
907
|
+
const attached = resourceArg.attachedTo
|
|
908
|
+
.map((id) => demoConversations.find((conversation) => conversation.id === id)?.title)
|
|
909
|
+
.filter(Boolean);
|
|
910
|
+
const header = html`
|
|
911
|
+
<header class="paneHeader">
|
|
912
|
+
<dees-icon icon=${meta.icon!} iconSize="16"></dees-icon>
|
|
913
|
+
<div style="min-width:0">
|
|
914
|
+
<div class="paneTitle">${resourceArg.title}</div>
|
|
915
|
+
<div class="paneSub">${meta.preview}</div>
|
|
916
|
+
</div>
|
|
917
|
+
${meta.state ? html`<span class="harness-pill tone-${tone}">${meta.state}</span>` : ''}
|
|
918
|
+
</header>
|
|
919
|
+
`;
|
|
920
|
+
const attachedLine = html`<div class="attached">${attached.length ? `Attached to ${attached.join(', ')}` : 'Not attached to a conversation.'}</div>`;
|
|
921
|
+
if (resourceArg.kind === 'terminal') {
|
|
922
|
+
return html`${header}<div class="paneBody">
|
|
923
|
+
${resourceArg.running
|
|
924
|
+
? html`<pre class="shell" aria-label="Terminal output">${resourceArg.lines.join('\n')}</pre>`
|
|
925
|
+
: html`<div class="empty">
|
|
926
|
+
<h3>${resourceArg.claude ? 'This Claude chat stopped' : 'This terminal is stopped'}</h3>
|
|
927
|
+
<p>${resourceArg.claude
|
|
928
|
+
? `${resourceArg.claude.failure === 'inference_lost' ? 'The model connection was lost. ' : ''}Its conversation is kept; restore it to continue.`
|
|
929
|
+
: 'Restore it to open a new shell in the same working directory.'}</p>
|
|
930
|
+
<dees-button type="accent" @clicked=${() => this.setRunning(resourceArg, true)}>Restore</dees-button>
|
|
931
|
+
</div>`}
|
|
932
|
+
${attachedLine}
|
|
933
|
+
</div>`;
|
|
934
|
+
}
|
|
935
|
+
if (resourceArg.kind === 'browser') {
|
|
936
|
+
return html`${header}<div class="paneBody">
|
|
937
|
+
<div class="address" title=${resourceArg.url}><dees-icon icon="lucide:Lock" iconSize="12"></dees-icon>${resourceArg.url}</div>
|
|
938
|
+
<div class="page">${resourceArg.runtimeAvailable
|
|
939
|
+
? resourceArg.page
|
|
940
|
+
: 'The browser runtime is unavailable. The page shows again once it is back.'}</div>
|
|
941
|
+
${attachedLine}
|
|
942
|
+
</div>`;
|
|
943
|
+
}
|
|
944
|
+
return html`${header}<div class="paneBody">
|
|
945
|
+
<ul class="files" aria-label="Files">
|
|
946
|
+
${resourceArg.files.map((file) => html`<li><dees-icon icon=${file.endsWith('/') ? 'lucide:Folder' : 'lucide:FileText'} iconSize="14"></dees-icon>${file}</li>`)}
|
|
947
|
+
</ul>
|
|
948
|
+
${attachedLine}
|
|
949
|
+
</div>`;
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
public render() {
|
|
953
|
+
const copy = resourceKinds[this.kind];
|
|
954
|
+
const resources = this.ofKind(this.kind);
|
|
955
|
+
const selected = resources.find((resource) => resource.id === this.selectedResourceId);
|
|
956
|
+
const associations: IHarnessResourceAssociation[] = resources
|
|
957
|
+
.filter((resource) => resource.attachedTo.length)
|
|
958
|
+
.map((resource) => ({ resourceId: resource.id, targets: resource.attachedTo.map((id) => ({ kind: 'session' as const, id })) }));
|
|
959
|
+
return html`
|
|
960
|
+
<div class="kinds" role="navigation" aria-label="Resource views">
|
|
961
|
+
${(['terminal', 'browser', 'workspace'] as const).map((kindArg) => html`
|
|
962
|
+
<dees-button
|
|
963
|
+
type="ghost"
|
|
964
|
+
size="sm"
|
|
965
|
+
data-kind=${kindArg}
|
|
966
|
+
.pressed=${this.kind === kindArg}
|
|
967
|
+
aria-current=${this.kind === kindArg ? 'page' : 'false'}
|
|
968
|
+
@clicked=${() => this.showKind(kindArg)}
|
|
969
|
+
><dees-icon icon=${resourceKinds[kindArg].icon} iconSize="14"></dees-icon>${resourceKinds[kindArg].label} · ${this.ofKind(kindArg).length}</dees-button>
|
|
970
|
+
`)}
|
|
971
|
+
<dees-button size="sm" type="ghost" @clicked=${this.reset}>Reset example</dees-button>
|
|
972
|
+
</div>
|
|
973
|
+
<div class="view">
|
|
974
|
+
<section class="main" aria-label=${`Open ${copy.noun}`}>${this.renderPane(selected)}</section>
|
|
975
|
+
<aside class="sidebar" aria-label=${copy.label}>
|
|
976
|
+
<div class="sidebarRow">
|
|
977
|
+
<div class="project">design.estate/dees-catalog</div>
|
|
978
|
+
<dees-button type="ghost" size="sm" title=${`Start a ${copy.noun} in this project`} @clicked=${(event: Event) => this.openNew(event)}>
|
|
979
|
+
<dees-icon icon="lucide:Plus" iconSize="14"></dees-icon>New ${copy.noun}
|
|
980
|
+
</dees-button>
|
|
981
|
+
</div>
|
|
982
|
+
<dees-harness-resource-list
|
|
983
|
+
.attachableSessions=${demoConversations}
|
|
984
|
+
.resources=${resources.map(resourceMeta)}
|
|
985
|
+
.resourceAssociations=${associations}
|
|
986
|
+
.eligibleTargetsByResourceId=${Object.fromEntries(resources.map((resource) => [resource.id, conversationTargets]))}
|
|
987
|
+
.selectedResourceId=${this.selectedResourceId}
|
|
988
|
+
resourceKind=${this.kind}
|
|
989
|
+
@harness-resource-select=${(event: CustomEvent<IHarnessResourceEventDetail>) => { this.selectedResourceId = event.detail.resource.id; }}
|
|
990
|
+
@harness-resource-open=${(event: CustomEvent<IHarnessResourceEventDetail>) => { this.selectedResourceId = event.detail.resource.id; }}
|
|
991
|
+
@harness-resource-context=${this.handleContext}
|
|
992
|
+
@harness-resource-associate=${this.handleAssociate}
|
|
993
|
+
></dees-harness-resource-list>
|
|
994
|
+
</aside>
|
|
995
|
+
</div>
|
|
996
|
+
${demoOutput(this.notice)}
|
|
997
|
+
`;
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
export const demoFunc = () => demoPage(
|
|
1002
|
+
'Resource list',
|
|
1003
|
+
'The terminals, browsers and workspaces of a project, each kind in its own view, with the conversations each resource is attached to. The same list also arranges resources beside conversations.',
|
|
1004
|
+
html`
|
|
1005
|
+
${demoSection('Terminals, browsers and workspaces', 'One kind per view, as AGL lists a project’s resources. Rows show the kind’s icon, what the resource is (working directory, agent or folder), its state and the conversations it is attached to. Actions start or stop a terminal, attach, move or detach a resource, and retire it.', html`
|
|
1006
|
+
<dees-demo-resource-views></dees-demo-resource-views>
|
|
1007
|
+
`)}
|
|
1008
|
+
${demoSection('Beside conversations', 'Resources and conversations as peers in one ordered list: group them, drag them, attach a terminal, a browser or a workspace to a conversation or to another resource. A resource the host marks closeable closes from its row.', html`
|
|
1009
|
+
<dees-demo-resource-workspace style="height: 760px"></dees-demo-resource-workspace>
|
|
1010
|
+
`)}
|
|
1011
|
+
${demoSection('Empty and loading', 'A view before its resources arrive, and a project without any of the kind. `resourceKind` names what the list shows, so it searches, loads and stays empty in that kind\'s words.', html`
|
|
1012
|
+
<style>
|
|
1013
|
+
.resource-list-frame { display: flex; height: 200px; border: 1px solid var(--dees-color-border-subtle); border-radius: var(--dees-radius-xl); overflow: hidden; background: var(--dees-color-bg-canvas); }
|
|
1014
|
+
.resource-list-frame dees-harness-resource-list { flex: 1; min-height: 0; }
|
|
1015
|
+
</style>
|
|
1016
|
+
<div class="dees-demo-grid">
|
|
1017
|
+
<div class="resource-list-frame"><dees-harness-resource-list loading resourceKind="terminal"></dees-harness-resource-list></div>
|
|
1018
|
+
<div class="resource-list-frame"><dees-harness-resource-list resourceKind="browser"></dees-harness-resource-list></div>
|
|
1019
|
+
</div>
|
|
1020
|
+
`)}
|
|
1021
|
+
`,
|
|
1022
|
+
);
|