@leitwerk-dev/ui 0.1.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/LICENSE +13 -0
- package/dist/assets/ChronicleMarkdown-BLgtHeEE.js +16 -0
- package/dist/assets/ChronicleMarkdown-D6hFzERy.css +1 -0
- package/dist/assets/FutureLaunchDetailPage-KrXSGzHM.js +1 -0
- package/dist/assets/FutureLaunchDetailPage-VPMBtpYc.css +1 -0
- package/dist/assets/GenericLauncher-Cv38FByt.js +1 -0
- package/dist/assets/GenericLauncher-D_GMtsQ5.css +1 -0
- package/dist/assets/HomePage-Cd3lEtwZ.js +1 -0
- package/dist/assets/HomePage-DYh_QHXv.css +1 -0
- package/dist/assets/PageHeader-6PdvYODN.css +1 -0
- package/dist/assets/PageHeader-D6pP4hIh.js +1 -0
- package/dist/assets/ProcessActionsMenu-1QySGNy9.js +1 -0
- package/dist/assets/ProcessActionsMenu-BT2r9vO8.css +1 -0
- package/dist/assets/ProcessDetailPage-BLuc7sjV.js +12 -0
- package/dist/assets/ProcessDetailPage-CSrjzajF.css +1 -0
- package/dist/assets/ProcessFlowDiagram-BAh_M_rb.js +2 -0
- package/dist/assets/ProcessFlowDiagram-Cz8wNicU.css +1 -0
- package/dist/assets/ProcessesPage-BcM38HMs.css +1 -0
- package/dist/assets/ProcessesPage-DtPweRU-.js +1 -0
- package/dist/assets/ScheduleDateTimePicker-CQGvY-Rc.js +1 -0
- package/dist/assets/ScheduleDateTimePicker-CadXN9z7.css +1 -0
- package/dist/assets/SkillsPage-B30FAFia.css +1 -0
- package/dist/assets/SkillsPage-bXuv0kEE.js +2 -0
- package/dist/assets/WatchersPage-DNyUsU1y.js +1 -0
- package/dist/assets/WatchersPage-Dnfi1zUK.css +1 -0
- package/dist/assets/api-CqECFdii.js +1 -0
- package/dist/assets/browser-storage-LbKCyf_w.js +1 -0
- package/dist/assets/dist-B7WNbObw.js +2 -0
- package/dist/assets/index-66T4Gmbl.css +1 -0
- package/dist/assets/index-C8qCggeq.js +7 -0
- package/dist/assets/index-client-BqF3_t3P.js +2 -0
- package/dist/assets/mermaid-render.worker-DAVgiVRG.js +6393 -0
- package/dist/assets/retry-config.svelte-DFKCJtCe.js +1 -0
- package/dist/assets/router.svelte-COr45o9R.js +1 -0
- package/dist/fonts/OFL-Public-Sans.txt +115 -0
- package/dist/fonts/OFL-Spectral.txt +93 -0
- package/dist/fonts/README.md +38 -0
- package/dist/fonts/fonts.css +85 -0
- package/dist/fonts/public-sans-latin-cd00287f.woff2 +0 -0
- package/dist/fonts/public-sans-latin-ext-d025d4ba.woff2 +0 -0
- package/dist/fonts/spectral-latin-89d48951.woff2 +0 -0
- package/dist/fonts/spectral-latin-b7578f14.woff2 +0 -0
- package/dist/fonts/spectral-latin-c4e0a00d.woff2 +0 -0
- package/dist/fonts/spectral-latin-ext-260738f4.woff2 +0 -0
- package/dist/fonts/spectral-latin-ext-ab18ac17.woff2 +0 -0
- package/dist/fonts/spectral-latin-ext-f58c1db3.woff2 +0 -0
- package/dist/index.html +32 -0
- package/package.json +47 -0
- package/src/App.svelte +257 -0
- package/src/chronicle/components/ChronicleActionSection.svelte +1035 -0
- package/src/chronicle/components/ChronicleExpandButton.svelte +70 -0
- package/src/chronicle/components/ChronicleFlow.svelte +289 -0
- package/src/chronicle/components/ChronicleLeafOutcomePlaceholder.svelte +44 -0
- package/src/chronicle/components/ChronicleLeafOutcomeRendererHost.svelte +408 -0
- package/src/chronicle/components/ChronicleLeafOutcomeSection.svelte +253 -0
- package/src/chronicle/components/ChronicleLiveChip.svelte +96 -0
- package/src/chronicle/components/ChronicleLiveTail.svelte +376 -0
- package/src/chronicle/components/ChronicleMarkdown.svelte +168 -0
- package/src/chronicle/components/ChronicleOperatorInputSection.svelte +41 -0
- package/src/chronicle/components/ChronicleProcessErrorSection.svelte +131 -0
- package/src/chronicle/components/ChroniclePromptSection.svelte +54 -0
- package/src/chronicle/components/ChronicleQuestionRequest.svelte +167 -0
- package/src/chronicle/components/ChronicleReasoningDetailsOverlay.svelte +893 -0
- package/src/chronicle/components/ChronicleRecoverySection.svelte +338 -0
- package/src/chronicle/components/ChronicleScheduledActionSection.svelte +192 -0
- package/src/chronicle/components/ChronicleSectionHeader.svelte +135 -0
- package/src/chronicle/components/ChronicleStartupRecoverySection.svelte +138 -0
- package/src/chronicle/components/ChronicleTerminalSummary.svelte +127 -0
- package/src/chronicle/components/ChronicleThinkingSection.svelte +191 -0
- package/src/chronicle/components/ChronicleThinkingText.svelte +46 -0
- package/src/chronicle/components/ChronicleToolCallItem.svelte +477 -0
- package/src/chronicle/components/ChronicleTurnCluster.svelte +325 -0
- package/src/chronicle/components/ChronicleTurnRail.svelte +584 -0
- package/src/chronicle/components/ChronicleUsageStats.svelte +107 -0
- package/src/chronicle/components/CompactActionComposer.svelte +417 -0
- package/src/chronicle/components/ModelProfileOptions.svelte +20 -0
- package/src/chronicle/components/ProviderOptionsEditor.svelte +171 -0
- package/src/chronicle/components/RecoveryModelControl.svelte +95 -0
- package/src/chronicle/lib/action-bindings.ts +90 -0
- package/src/chronicle/lib/action-model-display.ts +133 -0
- package/src/chronicle/lib/action-preview.ts +16 -0
- package/src/chronicle/lib/chronicle-projection.ts +1342 -0
- package/src/chronicle/lib/chronicle-selectable-items.ts +352 -0
- package/src/chronicle/lib/chronicle-view-model.ts +121 -0
- package/src/chronicle/lib/formatting.ts +18 -0
- package/src/chronicle/lib/leaf-outcome-loader.ts +214 -0
- package/src/chronicle/lib/leaf-outcome-runtime.ts +37 -0
- package/src/chronicle/lib/prompt-highlighting.ts +78 -0
- package/src/chronicle/lib/scroll-sync.ts +88 -0
- package/src/chronicle/lib/tool-call-summary.ts +64 -0
- package/src/components/BrowserUiExtensionIndicatorHost.svelte +34 -0
- package/src/components/ConversationTreeDiagram.svelte +393 -0
- package/src/components/FormFieldRenderer.svelte +359 -0
- package/src/components/GenericLauncher.svelte +1970 -0
- package/src/components/KeyboardShortcutsModal.svelte +52 -0
- package/src/components/ModalShell.svelte +105 -0
- package/src/components/PageHeader.svelte +146 -0
- package/src/components/ProcessActionsMenu.svelte +514 -0
- package/src/components/ProcessInfoOverlay.svelte +1229 -0
- package/src/components/ScheduleDateTimePicker.svelte +155 -0
- package/src/components/SkillSelector.svelte +45 -0
- package/src/components/ToastContainer.svelte +192 -0
- package/src/components/launcher-form-copy.ts +172 -0
- package/src/components/launcher-model-config.ts +263 -0
- package/src/components/launcher-schedule.ts +127 -0
- package/src/extension-ui-dev-server.ts +98 -0
- package/src/lib/api.ts +970 -0
- package/src/lib/beautiful-mermaid-elk-instance.ts +54 -0
- package/src/lib/browser-storage.ts +11 -0
- package/src/lib/cost-estimates.ts +41 -0
- package/src/lib/elk-bundled-worker.ts +41 -0
- package/src/lib/flow-layout.ts +326 -0
- package/src/lib/format.ts +96 -0
- package/src/lib/future-executions-logic.ts +12 -0
- package/src/lib/future-launch-detail.ts +145 -0
- package/src/lib/instance-tree-layout.ts +158 -0
- package/src/lib/keyboard-shortcuts-help.ts +20 -0
- package/src/lib/keyboard.ts +40 -0
- package/src/lib/launcher-recent-values.ts +68 -0
- package/src/lib/markdown.ts +94 -0
- package/src/lib/mermaid-render.worker.ts +36 -0
- package/src/lib/pi-stream.ts +3 -0
- package/src/lib/primary-path-detail.ts +337 -0
- package/src/lib/primary-path-replay.ts +27 -0
- package/src/lib/process-browser.ts +179 -0
- package/src/lib/process-initial-prompt.ts +7 -0
- package/src/lib/process-launch-notices.svelte.ts +25 -0
- package/src/lib/process-row-view.ts +60 -0
- package/src/lib/process-terminal-display.ts +17 -0
- package/src/lib/process-toast-focus.svelte.ts +18 -0
- package/src/lib/processes-logic.ts +2 -0
- package/src/lib/processes.svelte.ts +334 -0
- package/src/lib/request-guard.ts +20 -0
- package/src/lib/retry-config.svelte.ts +19 -0
- package/src/lib/rich-markdown-elements.ts +173 -0
- package/src/lib/router-logic.ts +190 -0
- package/src/lib/router.svelte.ts +56 -0
- package/src/lib/runtime-config.ts +96 -0
- package/src/lib/test-fixtures.ts +13 -0
- package/src/lib/toasts.svelte.ts +104 -0
- package/src/lib/tool-call-rendering.ts +66 -0
- package/src/lib/ui-extensions.svelte.ts +381 -0
- package/src/lib/usage-snapshot.ts +9 -0
- package/src/lib/ws-classifier.ts +80 -0
- package/src/lib/ws.svelte.ts +281 -0
- package/src/main.ts +8 -0
- package/src/pages/FutureLaunchDetailPage.svelte +479 -0
- package/src/pages/HomePage.svelte +306 -0
- package/src/pages/ProcessCard.svelte +99 -0
- package/src/pages/ProcessDetailPage.svelte +599 -0
- package/src/pages/ProcessFlowDiagram.svelte +696 -0
- package/src/pages/ProcessGallery.svelte +252 -0
- package/src/pages/ProcessesPage.svelte +994 -0
- package/src/pages/SkillsPage.svelte +665 -0
- package/src/pages/WatchersPage.svelte +330 -0
- package/src/pages/process-detail/OverlayFrame.svelte +58 -0
- package/src/pages/process-detail/ProcessDetailChronicle.svelte +460 -0
- package/src/pages/process-detail/ProcessDetailHeader.svelte +167 -0
- package/src/pages/process-detail/process-detail-action-drafts.svelte.ts +211 -0
- package/src/pages/process-detail/process-detail-actions.svelte.ts +548 -0
- package/src/pages/process-detail/process-detail-chronicle-dom.ts +102 -0
- package/src/pages/process-detail/process-detail-chronicle-scroll.svelte.ts +711 -0
- package/src/pages/process-detail/process-detail-mutations.svelte.ts +91 -0
- package/src/pages/process-detail/process-detail-view-model.ts +149 -0
- package/src/shell/AppShell.svelte +249 -0
- package/src/shell/RouteLoadBoundary.svelte +43 -0
- package/src/shell/Sidebar.svelte +1358 -0
- package/src/shell/test-fixtures/RouteLoadTestComponent.svelte +5 -0
- package/src/vite-env.d.ts +2 -0
- package/src/vite-server-config.ts +27 -0
|
@@ -0,0 +1,665 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount, tick, untrack } from "svelte";
|
|
3
|
+
import ChronicleMarkdown from "../chronicle/components/ChronicleMarkdown.svelte";
|
|
4
|
+
import ModalShell from "../components/ModalShell.svelte";
|
|
5
|
+
import PageHeader from "../components/PageHeader.svelte";
|
|
6
|
+
import {
|
|
7
|
+
fetchInstalledSkillDetail,
|
|
8
|
+
fetchSkillDetail,
|
|
9
|
+
fetchSkills,
|
|
10
|
+
type InstalledSkillCatalogDetail,
|
|
11
|
+
type InstalledSkillCatalogItem,
|
|
12
|
+
refreshSkills,
|
|
13
|
+
registerSkill,
|
|
14
|
+
removeSkill,
|
|
15
|
+
type SkillCatalogDetail,
|
|
16
|
+
type SkillCatalogItem,
|
|
17
|
+
type SkillRepositorySummary,
|
|
18
|
+
} from "../lib/api.js";
|
|
19
|
+
import { formatLocalDateTime } from "../lib/format.js";
|
|
20
|
+
import {
|
|
21
|
+
buildAvailableSkillPath,
|
|
22
|
+
buildInstalledSkillPath,
|
|
23
|
+
buildProcessPath,
|
|
24
|
+
buildSkillsPath,
|
|
25
|
+
followLink,
|
|
26
|
+
navigate,
|
|
27
|
+
} from "../lib/router.svelte";
|
|
28
|
+
|
|
29
|
+
interface Props {
|
|
30
|
+
detailKind?: string | null;
|
|
31
|
+
repositoryId?: string | null;
|
|
32
|
+
skillId?: string | null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
type CatalogView = "installed" | "available";
|
|
36
|
+
type RemoteFilter = "all" | "available" | "updates" | "invoked" | "stale";
|
|
37
|
+
type DetailSection = "overview" | "instructions";
|
|
38
|
+
type SkillDetail =
|
|
39
|
+
| { kind: "available"; value: SkillCatalogDetail }
|
|
40
|
+
| { kind: "installed"; value: InstalledSkillCatalogDetail };
|
|
41
|
+
type SkillRowItem =
|
|
42
|
+
| { kind: "available"; value: SkillCatalogItem }
|
|
43
|
+
| { kind: "installed"; value: InstalledSkillCatalogItem };
|
|
44
|
+
|
|
45
|
+
let { detailKind = null, repositoryId = null, skillId = null }: Props = $props();
|
|
46
|
+
let repositories = $state.raw<SkillRepositorySummary[]>([]);
|
|
47
|
+
let availableSkills = $state.raw<SkillCatalogItem[]>([]);
|
|
48
|
+
let installedSkills = $state.raw<InstalledSkillCatalogItem[]>([]);
|
|
49
|
+
let detail = $state.raw<SkillDetail | null>(null);
|
|
50
|
+
let selectedView = $state<CatalogView>("installed");
|
|
51
|
+
let loading = $state(true);
|
|
52
|
+
let refreshing = $state(false);
|
|
53
|
+
let detailLoading = $state(false);
|
|
54
|
+
let error = $state<string | null>(null);
|
|
55
|
+
let detailError = $state<string | null>(null);
|
|
56
|
+
let actionError = $state<string | null>(null);
|
|
57
|
+
let actionSuccess = $state<string | null>(null);
|
|
58
|
+
let actionPending = $state(false);
|
|
59
|
+
let confirmRemove = $state(false);
|
|
60
|
+
let detailSection = $state<DetailSection>("overview");
|
|
61
|
+
let showRepositoriesModal = $state(false);
|
|
62
|
+
let query = $state("");
|
|
63
|
+
let repositoryFilter = $state("all");
|
|
64
|
+
let remoteFilter = $state<RemoteFilter>("available");
|
|
65
|
+
let detailRequestToken = 0;
|
|
66
|
+
let searchInputEl: HTMLInputElement | null = null;
|
|
67
|
+
let removeButtonEl = $state<HTMLButtonElement | null>(null);
|
|
68
|
+
let confirmRemoveButtonEl = $state<HTMLButtonElement | null>(null);
|
|
69
|
+
|
|
70
|
+
function handleGlobalKeydown(event: KeyboardEvent) {
|
|
71
|
+
const activeElement = document.activeElement;
|
|
72
|
+
const isInputActive =
|
|
73
|
+
activeElement &&
|
|
74
|
+
(activeElement.tagName === "INPUT" ||
|
|
75
|
+
activeElement.tagName === "SELECT" ||
|
|
76
|
+
activeElement.tagName === "TEXTAREA");
|
|
77
|
+
|
|
78
|
+
if (event.key === "/" && !isInputActive) {
|
|
79
|
+
event.preventDefault();
|
|
80
|
+
searchInputEl?.focus();
|
|
81
|
+
} else if (event.key === "Escape") {
|
|
82
|
+
if (showRepositoriesModal) {
|
|
83
|
+
showRepositoriesModal = false;
|
|
84
|
+
} else if (confirmRemove) {
|
|
85
|
+
cancelRemove();
|
|
86
|
+
} else if (selectedKey) {
|
|
87
|
+
navigate(buildSkillsPath());
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const routeView = $derived<CatalogView | null>(
|
|
93
|
+
detailKind === "available" ? "available" : detailKind === "installed" ? "installed" : null,
|
|
94
|
+
);
|
|
95
|
+
const activeView = $derived(routeView ?? selectedView);
|
|
96
|
+
const repositoryLabels = $derived(new Map(repositories.map((repo) => [repo.id, repo.label])));
|
|
97
|
+
const repositoriesById = $derived(new Map(repositories.map((repo) => [repo.id, repo])));
|
|
98
|
+
const uninstalledAvailableSkills = $derived(availableSkills.filter((skill) => !skill.registered));
|
|
99
|
+
const selectedKey = $derived(
|
|
100
|
+
skillId
|
|
101
|
+
? detailKind === "available" && repositoryId
|
|
102
|
+
? `available/${repositoryId}/${skillId}`
|
|
103
|
+
: detailKind === "installed"
|
|
104
|
+
? `installed/${skillId}`
|
|
105
|
+
: null
|
|
106
|
+
: null,
|
|
107
|
+
);
|
|
108
|
+
const filteredInstalled = $derived.by(() => {
|
|
109
|
+
const needle = query.trim().toLocaleLowerCase();
|
|
110
|
+
return installedSkills.filter((skill) =>
|
|
111
|
+
needle
|
|
112
|
+
? [skill.label, skill.id, skill.description ?? ""]
|
|
113
|
+
.join(" ")
|
|
114
|
+
.toLocaleLowerCase()
|
|
115
|
+
.includes(needle)
|
|
116
|
+
: true,
|
|
117
|
+
);
|
|
118
|
+
});
|
|
119
|
+
const filteredAvailable = $derived.by(() => {
|
|
120
|
+
const needle = query.trim().toLocaleLowerCase();
|
|
121
|
+
return availableSkills.filter((skill) => {
|
|
122
|
+
if (repositoryFilter !== "all" && skill.repositoryId !== repositoryFilter) return false;
|
|
123
|
+
if (remoteFilter === "available" && skill.registered) return false;
|
|
124
|
+
if (remoteFilter === "updates" && !skill.updateAvailable) return false;
|
|
125
|
+
if (remoteFilter === "invoked" && skill.usage.invokedLast30Days === 0) return false;
|
|
126
|
+
if (remoteFilter === "stale" && !skill.stale) return false;
|
|
127
|
+
if (!needle) return true;
|
|
128
|
+
return [
|
|
129
|
+
skill.label,
|
|
130
|
+
skill.id,
|
|
131
|
+
skill.description ?? "",
|
|
132
|
+
repositoryLabels.get(skill.repositoryId) ?? "",
|
|
133
|
+
skill.repositoryId,
|
|
134
|
+
]
|
|
135
|
+
.join(" ")
|
|
136
|
+
.toLocaleLowerCase()
|
|
137
|
+
.includes(needle);
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
const visibleCount = $derived(
|
|
141
|
+
activeView === "installed" ? filteredInstalled.length : filteredAvailable.length,
|
|
142
|
+
);
|
|
143
|
+
function skillStatus(skill: SkillCatalogItem | InstalledSkillCatalogItem) {
|
|
144
|
+
if ("stale" in skill && skill.stale) {
|
|
145
|
+
return { label: "No longer available", className: "stale" };
|
|
146
|
+
}
|
|
147
|
+
if (skill.updateAvailable) return { label: "Update available", className: "update" };
|
|
148
|
+
if (!("registered" in skill) || skill.registered) {
|
|
149
|
+
return { label: "Installed", className: "registered" };
|
|
150
|
+
}
|
|
151
|
+
return { label: "Available", className: "" };
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const detailStatus = $derived(detail ? skillStatus(detail.value) : { label: "", className: "" });
|
|
155
|
+
|
|
156
|
+
function applyCatalog(catalog: Awaited<ReturnType<typeof fetchSkills>>) {
|
|
157
|
+
repositories = catalog.repositories;
|
|
158
|
+
availableSkills = catalog.availableSkills;
|
|
159
|
+
installedSkills = catalog.installedSkills;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
async function loadCatalog() {
|
|
163
|
+
loading = installedSkills.length === 0 && availableSkills.length === 0;
|
|
164
|
+
error = null;
|
|
165
|
+
try {
|
|
166
|
+
applyCatalog(await fetchSkills());
|
|
167
|
+
} catch (loadError) {
|
|
168
|
+
error =
|
|
169
|
+
loadError instanceof Error ? loadError.message : "The skill catalog could not be loaded.";
|
|
170
|
+
} finally {
|
|
171
|
+
loading = false;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
async function refreshCatalog() {
|
|
176
|
+
refreshing = true;
|
|
177
|
+
error = null;
|
|
178
|
+
actionSuccess = null;
|
|
179
|
+
try {
|
|
180
|
+
applyCatalog(await refreshSkills());
|
|
181
|
+
await reloadSelectedDetail();
|
|
182
|
+
actionSuccess =
|
|
183
|
+
repositories.length === 1
|
|
184
|
+
? "Repository refresh complete."
|
|
185
|
+
: `${repositories.length} repository refreshes complete.`;
|
|
186
|
+
} catch (refreshError) {
|
|
187
|
+
error =
|
|
188
|
+
refreshError instanceof Error
|
|
189
|
+
? refreshError.message
|
|
190
|
+
: "Skill repositories could not be refreshed.";
|
|
191
|
+
} finally {
|
|
192
|
+
refreshing = false;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
async function loadDetail(kind: string, nextRepositoryId: string | null, nextSkillId: string) {
|
|
197
|
+
const token = ++detailRequestToken;
|
|
198
|
+
detailLoading = true;
|
|
199
|
+
detailError = null;
|
|
200
|
+
actionError = null;
|
|
201
|
+
confirmRemove = false;
|
|
202
|
+
detailSection = "overview";
|
|
203
|
+
detail = null;
|
|
204
|
+
try {
|
|
205
|
+
if (kind === "available" && nextRepositoryId) {
|
|
206
|
+
const value = await fetchSkillDetail(nextRepositoryId, nextSkillId);
|
|
207
|
+
if (token === detailRequestToken) detail = { kind: "available", value };
|
|
208
|
+
} else if (kind === "installed") {
|
|
209
|
+
const value = await fetchInstalledSkillDetail(nextSkillId);
|
|
210
|
+
if (token === detailRequestToken) detail = { kind: "installed", value };
|
|
211
|
+
}
|
|
212
|
+
} catch (loadError) {
|
|
213
|
+
if (token !== detailRequestToken) return;
|
|
214
|
+
detailError =
|
|
215
|
+
loadError instanceof Error ? loadError.message : "Skill details could not be loaded.";
|
|
216
|
+
} finally {
|
|
217
|
+
if (token === detailRequestToken) detailLoading = false;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
async function reloadSelectedDetail() {
|
|
222
|
+
if (detailKind && skillId) await loadDetail(detailKind, repositoryId, skillId);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
async function activateSkill(sourceRepositoryId?: string | null) {
|
|
226
|
+
const targetRepository = sourceRepositoryId ?? repositoryId;
|
|
227
|
+
if (!targetRepository || !skillId) return;
|
|
228
|
+
const updated = Boolean(detail?.value.updateAvailable);
|
|
229
|
+
actionPending = true;
|
|
230
|
+
actionError = null;
|
|
231
|
+
actionSuccess = null;
|
|
232
|
+
try {
|
|
233
|
+
await registerSkill(targetRepository, skillId);
|
|
234
|
+
await loadCatalog();
|
|
235
|
+
if (detailKind === "installed") {
|
|
236
|
+
await loadDetail("installed", null, skillId);
|
|
237
|
+
} else {
|
|
238
|
+
navigate(buildInstalledSkillPath(skillId));
|
|
239
|
+
}
|
|
240
|
+
actionSuccess = updated ? "Skill updated." : "Skill installed.";
|
|
241
|
+
} catch (actionFailure) {
|
|
242
|
+
actionError =
|
|
243
|
+
actionFailure instanceof Error ? actionFailure.message : "The skill could not be registered.";
|
|
244
|
+
} finally {
|
|
245
|
+
actionPending = false;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
async function requestRemove() {
|
|
250
|
+
confirmRemove = true;
|
|
251
|
+
await tick();
|
|
252
|
+
confirmRemoveButtonEl?.focus();
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
async function cancelRemove() {
|
|
256
|
+
confirmRemove = false;
|
|
257
|
+
await tick();
|
|
258
|
+
removeButtonEl?.focus();
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
async function deactivateSkill() {
|
|
262
|
+
if (!skillId) return;
|
|
263
|
+
const removedLabel = detail?.value.label ?? skillId;
|
|
264
|
+
actionPending = true;
|
|
265
|
+
actionError = null;
|
|
266
|
+
actionSuccess = null;
|
|
267
|
+
try {
|
|
268
|
+
await removeSkill(skillId);
|
|
269
|
+
confirmRemove = false;
|
|
270
|
+
await loadCatalog();
|
|
271
|
+
navigate(buildSkillsPath());
|
|
272
|
+
actionSuccess = `${removedLabel} removed from future runs.`;
|
|
273
|
+
} catch (actionFailure) {
|
|
274
|
+
actionError =
|
|
275
|
+
actionFailure instanceof Error ? actionFailure.message : "The skill could not be removed.";
|
|
276
|
+
} finally {
|
|
277
|
+
actionPending = false;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function instructionMarkdown(markdown: string): string {
|
|
282
|
+
if (!markdown.startsWith("---")) return markdown;
|
|
283
|
+
const end = markdown.indexOf("\n---", 3);
|
|
284
|
+
return end < 0 ? markdown : markdown.slice(end + 4).trimStart();
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function switchView(view: CatalogView) {
|
|
288
|
+
selectedView = view;
|
|
289
|
+
if (selectedKey) navigate(buildSkillsPath());
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function handleDetailTabKeydown(event: KeyboardEvent) {
|
|
293
|
+
if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
|
|
294
|
+
event.preventDefault();
|
|
295
|
+
detailSection = detailSection === "overview" ? "instructions" : "overview";
|
|
296
|
+
const tabs = (
|
|
297
|
+
event.currentTarget as HTMLElement
|
|
298
|
+
).parentElement?.querySelectorAll<HTMLButtonElement>('[role="tab"]');
|
|
299
|
+
void tick().then(() => tabs?.[detailSection === "overview" ? 0 : 1]?.focus());
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
onMount(() => {
|
|
303
|
+
void loadCatalog();
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
$effect(() => {
|
|
307
|
+
const kind = detailKind;
|
|
308
|
+
const id = skillId;
|
|
309
|
+
const repo = repositoryId;
|
|
310
|
+
if (kind && id) {
|
|
311
|
+
void untrack(() => loadDetail(kind, repo, id));
|
|
312
|
+
} else {
|
|
313
|
+
detailRequestToken += 1;
|
|
314
|
+
detail = null;
|
|
315
|
+
detailLoading = false;
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
</script>
|
|
319
|
+
|
|
320
|
+
<svelte:window onkeydown={handleGlobalKeydown} />
|
|
321
|
+
|
|
322
|
+
{#snippet skillRow(item: SkillRowItem)}
|
|
323
|
+
{@const skill = item.value}
|
|
324
|
+
{@const available = item.kind === "available"}
|
|
325
|
+
{@const repositoryId = available ? item.value.repositoryId : item.value.sourceRepositoryId}
|
|
326
|
+
{@const registrationKind = available ? null : item.value.registrationKind}
|
|
327
|
+
{@const revision = available ? item.value.sourceRevision : item.value.activeSourceRevision}
|
|
328
|
+
{@const href = available ? buildAvailableSkillPath(item.value.repositoryId, skill.id) : buildInstalledSkillPath(skill.id)}
|
|
329
|
+
{@const selected = selectedKey === `${item.kind}/${available ? `${item.value.repositoryId}/` : ""}${skill.id}`}
|
|
330
|
+
{@const status = skillStatus(skill)}
|
|
331
|
+
{@const repoLabel = registrationKind === "configuration" ? "Configuration" : repositoryLabels.get(repositoryId ?? "") ?? repositoryId ?? "Repository"}
|
|
332
|
+
<tr
|
|
333
|
+
class:selected
|
|
334
|
+
onclick={(event) => {
|
|
335
|
+
const target = event.target as HTMLElement | null;
|
|
336
|
+
if (target?.closest("a, button, select, input")) return;
|
|
337
|
+
followLink(event, href);
|
|
338
|
+
}}
|
|
339
|
+
>
|
|
340
|
+
<td>
|
|
341
|
+
<a {href} onclick={(event) => followLink(event, href)}>
|
|
342
|
+
<strong>{skill.label}</strong>
|
|
343
|
+
<span>{skill.description ?? skill.id}</span>
|
|
344
|
+
</a>
|
|
345
|
+
</td>
|
|
346
|
+
<td>
|
|
347
|
+
<span>{repoLabel}</span>
|
|
348
|
+
<code>
|
|
349
|
+
{repositoryId && repositoryLabels.get(repositoryId) && repositoryLabels.get(repositoryId) !== repositoryId
|
|
350
|
+
? `${repositoryId} · `
|
|
351
|
+
: ""}{revision?.slice(0, 8) ?? "local"}
|
|
352
|
+
</code>
|
|
353
|
+
</td>
|
|
354
|
+
<td>
|
|
355
|
+
<span class={`status-chip ${status.className}`}>{status.label}</span>
|
|
356
|
+
{#if available && item.value.conflict}<span class="conflict">ID conflict</span>{/if}
|
|
357
|
+
</td>
|
|
358
|
+
<td><strong>{skill.usage.attachedLast30Days}</strong><span>30d · {skill.usage.attachedAllTime} total</span></td>
|
|
359
|
+
<td><strong>{skill.usage.invokedLast30Days}</strong><span>30d · {skill.usage.invokedAllTime} total</span></td>
|
|
360
|
+
</tr>
|
|
361
|
+
{/snippet}
|
|
362
|
+
|
|
363
|
+
<div class="skills-page" data-page="skills">
|
|
364
|
+
<section class="catalog-pane" class:with-detail={Boolean(selectedKey)}>
|
|
365
|
+
<PageHeader
|
|
366
|
+
title="Skills"
|
|
367
|
+
subtitle="Manage skills imported into Leitwerk and discover new ones from configured repositories."
|
|
368
|
+
>
|
|
369
|
+
{#snippet actions()}
|
|
370
|
+
{#if repositories.length > 0}
|
|
371
|
+
<button class="page-header-button" type="button" onclick={() => (showRepositoriesModal = true)}>
|
|
372
|
+
Repositories ({repositories.length})
|
|
373
|
+
</button>
|
|
374
|
+
{/if}
|
|
375
|
+
{/snippet}
|
|
376
|
+
</PageHeader>
|
|
377
|
+
|
|
378
|
+
{#if actionSuccess && !selectedKey}
|
|
379
|
+
<div class="status-banner success" role="status">{actionSuccess}</div>
|
|
380
|
+
{/if}
|
|
381
|
+
|
|
382
|
+
<div class="catalog-tabs" role="group" aria-label="Skill catalog view">
|
|
383
|
+
<button
|
|
384
|
+
type="button"
|
|
385
|
+
data-catalog-view="installed"
|
|
386
|
+
aria-pressed={activeView === "installed"}
|
|
387
|
+
onclick={() => switchView("installed")}
|
|
388
|
+
>
|
|
389
|
+
Installed <span>{installedSkills.length}</span>
|
|
390
|
+
</button>
|
|
391
|
+
<button
|
|
392
|
+
type="button"
|
|
393
|
+
data-catalog-view="available"
|
|
394
|
+
aria-pressed={activeView === "available"}
|
|
395
|
+
onclick={() => switchView("available")}
|
|
396
|
+
>
|
|
397
|
+
Available remotely <span>{uninstalledAvailableSkills.length}</span>
|
|
398
|
+
</button>
|
|
399
|
+
</div>
|
|
400
|
+
<p class="view-explanation">
|
|
401
|
+
{activeView === "installed"
|
|
402
|
+
? "Installed skills are available to attach to new process launches."
|
|
403
|
+
: "Remote skills must be installed before they can be attached to a process."}
|
|
404
|
+
</p>
|
|
405
|
+
|
|
406
|
+
<div class="catalog-controls">
|
|
407
|
+
<label class="search-field">
|
|
408
|
+
<span class="sr-only">Search skills</span>
|
|
409
|
+
<svg viewBox="0 0 20 20" aria-hidden="true"><circle cx="8.5" cy="8.5" r="5.5"></circle><path d="m13 13 4 4"></path></svg>
|
|
410
|
+
<input bind:this={searchInputEl} bind:value={query} type="search" placeholder={activeView === "installed" ? "Search installed skills" : "Search remote skills"} />
|
|
411
|
+
</label>
|
|
412
|
+
{#if activeView === "available"}
|
|
413
|
+
<label><span class="sr-only">Repository</span><select bind:value={repositoryFilter}><option value="all">All repositories</option>{#each repositories as repository (repository.id)}<option value={repository.id}>{repository.label !== repository.id ? `${repository.label} (${repository.id})` : repository.label}</option>{/each}</select></label>
|
|
414
|
+
<label><span class="sr-only">Remote skill state</span><select bind:value={remoteFilter}><option value="available">Not installed</option><option value="all">All states</option><option value="updates">Updates available</option><option value="invoked">Invoked in 30 days</option><option value="stale">No longer available</option></select></label>
|
|
415
|
+
{/if}
|
|
416
|
+
<span class="result-count">{visibleCount} {visibleCount === 1 ? "skill" : "skills"}</span>
|
|
417
|
+
</div>
|
|
418
|
+
|
|
419
|
+
{#if loading}
|
|
420
|
+
<div class="catalog-state" role="status">Loading the skill catalog…</div>
|
|
421
|
+
{:else if error && installedSkills.length === 0 && availableSkills.length === 0}
|
|
422
|
+
<div class="catalog-state error" role="alert"><strong>We couldn't load the skill catalog.</strong><span>{error}</span></div>
|
|
423
|
+
{:else if activeView === "installed" && installedSkills.length === 0}
|
|
424
|
+
<div class="catalog-state"><strong>No skills are installed.</strong><span>Open Available remotely to pull a skill, or configure a direct skill in <code>leitwerk.yaml</code>.</span></div>
|
|
425
|
+
{:else if activeView === "available" && repositories.length === 0}
|
|
426
|
+
<div class="catalog-state"><strong>No skill repositories are configured.</strong><span>Add <code>skill_repositories</code> to <code>leitwerk.yaml</code>, then restart Leitwerk.</span></div>
|
|
427
|
+
{:else if activeView === "available" && availableSkills.length === 0}
|
|
428
|
+
<div class="catalog-state"><strong>No remote skills were discovered.</strong><span>Check repository paths and ensure each skill contains a root <code>SKILL.md</code>.</span></div>
|
|
429
|
+
{:else if visibleCount === 0}
|
|
430
|
+
<div class="catalog-state"><strong>No skills match these filters.</strong><span>Clear the search or broaden the selected state.</span></div>
|
|
431
|
+
{:else}
|
|
432
|
+
{#if error}<p class="inline-error" role="status">{error} Showing the last catalog we loaded.</p>{/if}
|
|
433
|
+
<div class="skill-table-wrap">
|
|
434
|
+
<table class="skill-table">
|
|
435
|
+
<thead><tr><th>Skill</th><th>{activeView === "installed" ? "Managed by" : "Repository"}</th><th>Status</th><th>Attached</th><th>Invoked</th></tr></thead>
|
|
436
|
+
<tbody>
|
|
437
|
+
{#if activeView === "installed"}
|
|
438
|
+
{#each filteredInstalled as skill (skill.id)}
|
|
439
|
+
{@render skillRow({ kind: "installed", value: skill })}
|
|
440
|
+
{/each}
|
|
441
|
+
{:else}
|
|
442
|
+
{#each filteredAvailable as skill (`${skill.repositoryId}/${skill.id}`)}
|
|
443
|
+
{@render skillRow({ kind: "available", value: skill })}
|
|
444
|
+
{/each}
|
|
445
|
+
{/if}
|
|
446
|
+
</tbody>
|
|
447
|
+
</table>
|
|
448
|
+
</div>
|
|
449
|
+
{/if}
|
|
450
|
+
</section>
|
|
451
|
+
|
|
452
|
+
{#if selectedKey}
|
|
453
|
+
<aside class="detail-pane" aria-label="Skill details">
|
|
454
|
+
<div class="mobile-detail-nav">
|
|
455
|
+
<a
|
|
456
|
+
class="mobile-back-button"
|
|
457
|
+
href={buildSkillsPath()}
|
|
458
|
+
onclick={(event) => followLink(event, buildSkillsPath())}
|
|
459
|
+
>
|
|
460
|
+
<svg viewBox="0 0 20 20" aria-hidden="true"><path d="m13 15-5-5 5-5"></path></svg>
|
|
461
|
+
<span>Back to Skills list</span>
|
|
462
|
+
</a>
|
|
463
|
+
</div>
|
|
464
|
+
<a class="detail-close" href={buildSkillsPath()} onclick={(event) => followLink(event, buildSkillsPath())} aria-label="Close skill details"><svg viewBox="0 0 20 20" aria-hidden="true"><path d="m5 5 10 10M15 5 5 15"></path></svg></a>
|
|
465
|
+
{#if detailLoading}
|
|
466
|
+
<div class="detail-state" role="status">Loading skill details…</div>
|
|
467
|
+
{:else if detailError || !detail}
|
|
468
|
+
<div class="detail-state error" aria-live="polite">{detailError ?? "Skill details are unavailable."}</div>
|
|
469
|
+
{:else}
|
|
470
|
+
<header class="detail-header"><div><h2>{detail.value.label}</h2><p>{detail.value.description ?? detail.value.id}</p></div><span class={`status-chip ${detailStatus.className}`}>{detailStatus.label}</span></header>
|
|
471
|
+
{#if actionSuccess}<div class="status-banner success detail-feedback" role="status">{actionSuccess}</div>{/if}
|
|
472
|
+
{#if detail.kind === "available"}
|
|
473
|
+
<div class="detail-actions"><button class="primary-action" type="button" disabled={actionPending || detail.value.stale || detail.value.conflict || (detail.value.registered && !detail.value.updateAvailable)} onclick={() => void activateSkill()}>{actionPending ? "Working…" : detail.value.updateAvailable ? "Update skill" : detail.value.registered ? "Already installed" : "Install skill"}</button></div>
|
|
474
|
+
{#if detail.value.stale}<p class="action-note warning">This revision was not found during the latest successful repository refresh. It remains visible for history but cannot be installed or updated.</p>{/if}
|
|
475
|
+
{#if detail.value.conflict}<p class="action-note warning">This skill ID conflicts with another repository or a configuration-managed skill. Resolve the conflict before installing it.</p>{/if}
|
|
476
|
+
{:else}
|
|
477
|
+
<div class="detail-actions">
|
|
478
|
+
{#if detail.value.updateAvailable && detail.value.sourceRepositoryId}<button class="primary-action" type="button" disabled={actionPending} onclick={() => void activateSkill(detail.value.sourceRepositoryId)}>{actionPending ? "Updating…" : "Update skill"}</button>{/if}
|
|
479
|
+
{#if detail.value.registrationKind === "catalog"}<button bind:this={removeButtonEl} class="secondary-action danger" type="button" disabled={actionPending} onclick={() => void requestRemove()}>Remove</button>{/if}
|
|
480
|
+
</div>
|
|
481
|
+
{#if detail.value.registrationKind === "configuration"}<p class="action-note">This skill is managed by <code>leitwerk.yaml</code>. Change configuration to remove or update it.</p>{/if}
|
|
482
|
+
{#if confirmRemove}<div class="remove-confirmation" role="group" aria-label={`Remove ${detail.value.label}`}><strong>Remove {detail.value.label} from future runs?</strong><p>Existing processes and schedules keep their pinned revision.</p><div><button bind:this={confirmRemoveButtonEl} class="danger-action" type="button" disabled={actionPending} onclick={() => void deactivateSkill()}>{actionPending ? "Removing…" : "Confirm removal"}</button><button class="secondary-action" type="button" disabled={actionPending} onclick={() => void cancelRemove()}>Cancel</button></div></div>{/if}
|
|
483
|
+
{/if}
|
|
484
|
+
{#if actionError}<p class="action-note error" role="alert">{actionError} Try again.</p>{/if}
|
|
485
|
+
|
|
486
|
+
<div class="detail-tabs" role="tablist" aria-label="Skill detail sections">
|
|
487
|
+
<button type="button" role="tab" aria-selected={detailSection === "overview"} aria-controls="skill-overview" tabindex={detailSection === "overview" ? 0 : -1} onclick={() => (detailSection = "overview")} onkeydown={handleDetailTabKeydown}>Overview</button>
|
|
488
|
+
<button type="button" role="tab" aria-selected={detailSection === "instructions"} aria-controls="skill-instructions" tabindex={detailSection === "instructions" ? 0 : -1} onclick={() => (detailSection = "instructions")} onkeydown={handleDetailTabKeydown}>Instructions</button>
|
|
489
|
+
</div>
|
|
490
|
+
{#if detailSection === "overview"}
|
|
491
|
+
<div id="skill-overview" role="tabpanel">
|
|
492
|
+
{#if detail.kind === "available"}
|
|
493
|
+
{@render sourceMetadata(detail.value)}
|
|
494
|
+
{:else}
|
|
495
|
+
<dl class="detail-meta"><div><dt>Managed by</dt><dd>{detail.value.registrationKind === "configuration" ? "Configuration" : repositoryLabels.get(detail.value.sourceRepositoryId ?? "") ?? detail.value.sourceRepositoryId ?? "Repository"}</dd></div><div><dt>Active revision</dt><dd><code>{detail.value.activeSourceRevision ?? detail.value.activeRevisionId}</code></dd></div><div><dt>Usage</dt><dd>{detail.value.usage.attachedAllTime} attached · {detail.value.usage.invokedAllTime} invoked</dd></div></dl>
|
|
496
|
+
<section class="revision-section"><h3>Revision history</h3><div class="revision-list">{#each detail.value.revisions as revision (revision.id)}<div><span><code>{revision.sourceRevision ?? revision.id}</code><small>Imported {formatLocalDateTime(revision.importedAt)}</small></span>{#if revision.active}<span class="status-chip registered">Active</span>{/if}</div>{/each}</div></section>
|
|
497
|
+
{/if}
|
|
498
|
+
{@render processUsage(detail.value.processes)}
|
|
499
|
+
</div>
|
|
500
|
+
{:else}
|
|
501
|
+
<section id="skill-instructions" class="instructions-section" role="tabpanel"><h3>Instructions</h3><ChronicleMarkdown markdown={instructionMarkdown(detail.value.skillMarkdown)} /></section>
|
|
502
|
+
{/if}
|
|
503
|
+
{/if}
|
|
504
|
+
</aside>
|
|
505
|
+
{/if}
|
|
506
|
+
</div>
|
|
507
|
+
|
|
508
|
+
<ModalShell
|
|
509
|
+
open={showRepositoriesModal}
|
|
510
|
+
titleId="repository-modal-title"
|
|
511
|
+
closeLabel="Close configured repositories"
|
|
512
|
+
onClose={() => (showRepositoriesModal = false)}
|
|
513
|
+
dataSection="repository-modal"
|
|
514
|
+
>
|
|
515
|
+
<header class="repository-modal-header">
|
|
516
|
+
<h2 id="repository-modal-title">Configured repositories</h2>
|
|
517
|
+
<p>Skill repositories configured in <code>leitwerk.yaml</code>.</p>
|
|
518
|
+
</header>
|
|
519
|
+
|
|
520
|
+
{#if actionSuccess}<div class="status-banner success" role="status">{actionSuccess}</div>{/if}
|
|
521
|
+
{#if error}<div class="status-banner error" role="alert">{error} Check the repository configuration and try again.</div>{/if}
|
|
522
|
+
|
|
523
|
+
<div class="repository-modal-list">
|
|
524
|
+
{#each repositories as repository (repository.id)}
|
|
525
|
+
<div class:error={Boolean(repository.error)} class:refreshing class="repository-card">
|
|
526
|
+
<div class="repository-card-header">
|
|
527
|
+
<strong>{repository.label !== repository.id ? `${repository.label} (${repository.id})` : repository.label}</strong>
|
|
528
|
+
<span class:error-chip={Boolean(repository.error)} class="repository-sync-chip">
|
|
529
|
+
{refreshing ? "Refreshing…" : repository.error ? "Refresh failed" : repository.lastRefreshedAt ? `Synced ${formatLocalDateTime(repository.lastRefreshedAt)}` : "Not refreshed"}
|
|
530
|
+
</span>
|
|
531
|
+
</div>
|
|
532
|
+
<dl class="repository-card-meta">
|
|
533
|
+
<div><dt>Repository URL</dt><dd><code>{repository.url}</code></dd></div>
|
|
534
|
+
<div><dt>Ref</dt><dd><code>{repository.ref}</code></dd></div>
|
|
535
|
+
<div><dt>Path</dt><dd><code>{repository.path}</code></dd></div>
|
|
536
|
+
</dl>
|
|
537
|
+
{#if repository.error}<p class="repository-card-error" role="alert">{repository.error}</p>{/if}
|
|
538
|
+
</div>
|
|
539
|
+
{/each}
|
|
540
|
+
</div>
|
|
541
|
+
|
|
542
|
+
<footer class="repository-modal-footer">
|
|
543
|
+
<button class="secondary-action" type="button" disabled={refreshing || repositories.length === 0} onclick={() => void refreshCatalog()}>{refreshing ? "Refreshing…" : "Refresh all"}</button>
|
|
544
|
+
<button class="primary-action" type="button" onclick={() => (showRepositoriesModal = false)}>Done</button>
|
|
545
|
+
</footer>
|
|
546
|
+
</ModalShell>
|
|
547
|
+
|
|
548
|
+
{#snippet sourceMetadata(skill: SkillCatalogDetail)}
|
|
549
|
+
{@const repository = repositoriesById.get(skill.repositoryId)}
|
|
550
|
+
<dl class="detail-meta"><div><dt>Repository</dt><dd>{repository?.label ?? skill.repositoryId}</dd></div><div><dt>Configured ref</dt><dd><code>{repository?.ref ?? "—"}</code></dd></div><div class="full"><dt>Repository URL</dt><dd><code>{repository?.url ?? "—"}</code></dd></div><div><dt>Source path</dt><dd><code>{skill.sourcePath}</code></dd></div><div><dt>Discovered revision</dt><dd><code>{skill.sourceRevision}</code></dd></div><div><dt>Usage</dt><dd>{skill.usage.attachedAllTime} attached · {skill.usage.invokedAllTime} invoked</dd></div></dl>
|
|
551
|
+
{/snippet}
|
|
552
|
+
|
|
553
|
+
{#snippet processUsage(processes: SkillCatalogDetail["processes"])}
|
|
554
|
+
<section class="usage-section"><h3>Process usage</h3>{#if processes.length === 0}<p>No process has attached this skill yet.</p>{:else}<div class="process-usage-list">{#each processes as process (process.instanceId)}<a href={buildProcessPath(process.instanceId)} onclick={(event) => followLink(event, buildProcessPath(process.instanceId))}><span><strong>{process.title}</strong><small>Attached {formatLocalDateTime(process.attachedAt)}</small></span><span class="invocation-count">{process.invocationCount} {process.invocationCount === 1 ? "invocation" : "invocations"}</span></a>{/each}</div>{/if}</section>
|
|
555
|
+
{/snippet}
|
|
556
|
+
|
|
557
|
+
<style>
|
|
558
|
+
.skills-page { display: grid; grid-template-columns: minmax(0, 1fr) auto; min-height: 0; height: 100%; gap: var(--space-lg); }
|
|
559
|
+
.catalog-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: var(--space-md); padding: var(--space-2xs) 2px var(--space-xl); overflow-y: auto; }
|
|
560
|
+
.catalog-tabs { display: flex; gap: var(--space-2xs); padding: 4px; width: fit-content; border-radius: var(--radius-md); background: var(--chronicle-panel-muted); }
|
|
561
|
+
.catalog-tabs button { min-height: 36px; padding: 0 13px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--chronicle-text-muted); font-weight: 620; cursor: pointer; }
|
|
562
|
+
.catalog-tabs button[aria-pressed="true"] { background: white; color: var(--chronicle-text); box-shadow: 0 3px 10px rgba(24, 33, 43, 0.07); }
|
|
563
|
+
.catalog-tabs span { margin-left: 5px; color: var(--chronicle-text-faint); font-size: var(--type-caption); }
|
|
564
|
+
.view-explanation { margin: calc(-1 * var(--space-xs)) 0 0; color: var(--chronicle-text-muted); font-size: var(--type-body-sm); }
|
|
565
|
+
.status-banner { padding: 10px 12px; border-radius: var(--radius-sm); font-size: var(--type-body-sm); }
|
|
566
|
+
.status-banner.success { background: var(--chronicle-success-surface); color: var(--chronicle-success); }
|
|
567
|
+
.status-banner.error { background: var(--chronicle-danger-surface-soft); color: var(--chronicle-danger-text); }
|
|
568
|
+
|
|
569
|
+
.catalog-controls { display: flex; gap: var(--space-xs); align-items: center; }
|
|
570
|
+
.search-field { position: relative; min-width: 220px; flex: 1 1 300px; }
|
|
571
|
+
.search-field svg { position: absolute; left: 12px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); stroke: var(--chronicle-text-faint); stroke-width: 1.6; fill: none; pointer-events: none; }
|
|
572
|
+
input, select { width: 100%; min-height: 40px; border: 1px solid var(--chronicle-border); border-radius: var(--radius-sm); background: var(--chronicle-bg); color: var(--chronicle-text); padding: 8px 12px; }
|
|
573
|
+
input { padding-left: 38px; }
|
|
574
|
+
.result-count { color: var(--chronicle-text-muted); font-size: var(--type-body-sm); white-space: nowrap; }
|
|
575
|
+
.catalog-state { display: grid; gap: 4px; padding: var(--space-lg); border-radius: var(--radius-md); background: var(--chronicle-panel-muted); color: var(--chronicle-text-muted); }
|
|
576
|
+
.catalog-state strong { color: var(--chronicle-text); }
|
|
577
|
+
.catalog-state.error, .inline-error, .action-note.error { background: var(--chronicle-danger-surface-soft); color: var(--chronicle-danger-text); }
|
|
578
|
+
.inline-error, .action-note { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--chronicle-panel-muted); font-size: var(--type-body-sm); }
|
|
579
|
+
.skill-table-wrap { min-width: 0; overflow-x: clip; }
|
|
580
|
+
.skill-table { width: 100%; border-collapse: collapse; table-layout: fixed; text-align: left; }
|
|
581
|
+
.skill-table th:first-child { width: 31%; }
|
|
582
|
+
.skill-table th:nth-child(2) { width: 22%; }
|
|
583
|
+
.skill-table th:nth-child(3) { width: 19%; }
|
|
584
|
+
.skill-table th:nth-child(4), .skill-table th:nth-child(5) { width: 14%; }
|
|
585
|
+
.skill-table th { padding: 9px 12px; border-bottom: 1px solid var(--chronicle-border); color: var(--chronicle-text-faint); font-size: var(--type-caption); font-weight: 620; }
|
|
586
|
+
.skill-table td { padding: 13px 12px; border-bottom: 1px solid color-mix(in srgb, var(--chronicle-border) 75%, white 25%); vertical-align: middle; color: var(--chronicle-text-muted); font-size: var(--type-body-sm); }
|
|
587
|
+
.skill-table tbody tr { cursor: pointer; transition: background-color 0.15s ease; }
|
|
588
|
+
.skill-table tbody tr:hover { background: var(--chronicle-panel-muted); }
|
|
589
|
+
.skill-table tbody tr:focus-visible { outline: 2px solid var(--chronicle-accent); outline-offset: -2px; }
|
|
590
|
+
.skill-table tr.selected td { background: var(--chronicle-accent-soft); }
|
|
591
|
+
.skill-table td:first-child { min-width: 230px; }
|
|
592
|
+
.skill-table a { display: grid; gap: 3px; color: inherit; text-decoration: none; }
|
|
593
|
+
.skill-table a:hover strong { color: var(--chronicle-accent); }
|
|
594
|
+
.skill-table td strong { color: var(--chronicle-text); font-size: var(--type-body); font-weight: 650; }
|
|
595
|
+
.skill-table td span, .skill-table td code { display: block; }
|
|
596
|
+
.skill-table code, .detail-meta code, .revision-list code { font-family: var(--font-mono); font-size: var(--type-caption); overflow-wrap: anywhere; }
|
|
597
|
+
.status-chip { display: inline-flex !important; width: fit-content; padding: 5px 9px; border-radius: 999px; background: var(--chronicle-panel-muted); color: var(--chronicle-text-muted); font-size: var(--type-caption); font-weight: 650; white-space: nowrap; }
|
|
598
|
+
.status-chip.registered { background: var(--chronicle-success-surface); color: var(--chronicle-success); }
|
|
599
|
+
.status-chip.update { background: color-mix(in srgb, white 88%, var(--chronicle-attention) 12%); color: var(--chronicle-attention); }
|
|
600
|
+
.status-chip.stale { background: color-mix(in srgb, white 88%, var(--chronicle-danger) 12%); color: var(--chronicle-danger-text); }
|
|
601
|
+
.conflict { margin-top: 5px; color: var(--chronicle-danger-text); font-size: var(--type-caption); }
|
|
602
|
+
.detail-pane { position: relative; width: min(500px, 38vw); min-width: 400px; height: 100%; min-height: 0; padding: var(--space-xl); overflow-y: auto; border-radius: var(--radius-lg); background: var(--chronicle-card-surface-strong); box-shadow: var(--chronicle-shadow); }
|
|
603
|
+
.mobile-detail-nav { display: none; margin-bottom: var(--space-md); }
|
|
604
|
+
.mobile-back-button { display: inline-flex; align-items: center; gap: var(--space-2xs); padding: 6px 12px; border-radius: var(--radius-sm); background: var(--chronicle-panel-muted); color: var(--chronicle-text); font-size: var(--type-body-sm); font-weight: 620; text-decoration: none; }
|
|
605
|
+
.mobile-back-button:hover { background: var(--chronicle-border); }
|
|
606
|
+
.mobile-back-button svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; }
|
|
607
|
+
.detail-close { position: absolute; right: var(--space-md); top: var(--space-md); display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-sm); color: var(--chronicle-text-muted); }
|
|
608
|
+
.detail-close:hover { background: var(--chronicle-panel-muted); color: var(--chronicle-text); }
|
|
609
|
+
.detail-close svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.7; fill: none; }
|
|
610
|
+
.detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-md); padding-right: 38px; }
|
|
611
|
+
.detail-header h2 { margin: 0; font-size: var(--type-title-md); line-height: 1.2; }
|
|
612
|
+
.detail-header p { margin: 5px 0 0; color: var(--chronicle-text-muted); }
|
|
613
|
+
.detail-actions { display: flex; gap: var(--space-xs); margin-top: var(--space-lg); }
|
|
614
|
+
.primary-action, .secondary-action, .danger-action { min-height: 40px; padding: 0 14px; border-radius: 999px; font-weight: 620; cursor: pointer; }
|
|
615
|
+
.primary-action { border: 1px solid var(--chronicle-text); background: var(--chronicle-text); color: white; }
|
|
616
|
+
.secondary-action { border: 1px solid var(--chronicle-border); background: white; color: var(--chronicle-text); }
|
|
617
|
+
.secondary-action.danger, .danger-action { color: var(--chronicle-danger-text); border-color: var(--chronicle-danger-border); }
|
|
618
|
+
.danger-action { background: var(--chronicle-danger); color: white; border: 1px solid var(--chronicle-danger); }
|
|
619
|
+
button:disabled { cursor: default; opacity: 0.56; }
|
|
620
|
+
.detail-feedback { margin-top: var(--space-md); }
|
|
621
|
+
.action-note { margin-top: var(--space-sm); }
|
|
622
|
+
.action-note.warning { background: color-mix(in srgb, white 90%, var(--chronicle-attention) 10%); color: var(--chronicle-attention); }
|
|
623
|
+
.remove-confirmation { display: grid; gap: 7px; margin-top: var(--space-md); padding: var(--space-md); border-radius: var(--radius-md); background: var(--chronicle-danger-surface-soft); color: var(--chronicle-danger-text); }
|
|
624
|
+
.remove-confirmation p { margin: 0; }
|
|
625
|
+
.remove-confirmation > div { display: flex; gap: var(--space-xs); margin-top: 4px; }
|
|
626
|
+
.detail-tabs { display: flex; gap: var(--space-lg); margin-top: var(--space-xl); border-bottom: 1px solid var(--chronicle-border); }
|
|
627
|
+
.detail-tabs button { min-height: 42px; padding: 0 2px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--chronicle-text-muted); font-weight: 650; cursor: pointer; }
|
|
628
|
+
.detail-tabs button[aria-selected="true"] { border-bottom-color: var(--chronicle-accent); color: var(--chronicle-text); }
|
|
629
|
+
.detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); margin: var(--space-lg) 0; padding: var(--space-md) 0; border-bottom: 1px solid var(--chronicle-border); }
|
|
630
|
+
.detail-meta .full { grid-column: 1 / -1; }
|
|
631
|
+
.detail-meta div { min-width: 0; }
|
|
632
|
+
.detail-meta dt { color: var(--chronicle-text-faint); font-size: var(--type-caption); }
|
|
633
|
+
.detail-meta dd { margin: 3px 0 0; color: var(--chronicle-text); font-size: var(--type-body-sm); }
|
|
634
|
+
.usage-section, .revision-section { margin-top: var(--space-xl); }
|
|
635
|
+
.instructions-section { margin-top: var(--space-lg); max-width: 75ch; }
|
|
636
|
+
.usage-section h3, .instructions-section h3, .revision-section h3 { margin: 0 0 var(--space-sm); font-size: var(--type-title-sm); }
|
|
637
|
+
.usage-section > p { color: var(--chronicle-text-muted); }
|
|
638
|
+
.process-usage-list, .revision-list { display: grid; }
|
|
639
|
+
.process-usage-list a, .revision-list > div { display: flex; justify-content: space-between; gap: var(--space-md); padding: 11px 0; border-bottom: 1px solid var(--chronicle-border); color: inherit; text-decoration: none; }
|
|
640
|
+
.process-usage-list a:hover strong { color: var(--chronicle-accent); }
|
|
641
|
+
.process-usage-list span:first-child, .revision-list span:first-child { display: grid; gap: 2px; }
|
|
642
|
+
.process-usage-list strong { color: var(--chronicle-text); font-size: var(--type-body-sm); }
|
|
643
|
+
.process-usage-list small, .revision-list small, .invocation-count { color: var(--chronicle-text-muted); font-size: var(--type-caption); }
|
|
644
|
+
.invocation-count { flex: 0 0 auto; }
|
|
645
|
+
.detail-state { padding: var(--space-xl); color: var(--chronicle-text-muted); }
|
|
646
|
+
.detail-state.error { color: var(--chronicle-danger-text); }
|
|
647
|
+
.repository-modal-header h2 { margin: 0; font-size: var(--type-title-md); }
|
|
648
|
+
.repository-modal-header p { margin: 4px 0 0; color: var(--chronicle-text-muted); font-size: var(--type-body-sm); }
|
|
649
|
+
.repository-modal-list { flex: 1 1 auto; overflow-y: auto; display: grid; gap: var(--space-sm); padding-right: 2px; }
|
|
650
|
+
.repository-card { display: grid; gap: var(--space-xs); padding: var(--space-md); border: 1px solid var(--chronicle-border); border-radius: var(--radius-md); background: var(--chronicle-panel-muted); }
|
|
651
|
+
.repository-card.error { border-color: var(--chronicle-danger-border); background: var(--chronicle-danger-surface-soft); }
|
|
652
|
+
.repository-card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }
|
|
653
|
+
.repository-card-header strong { color: var(--chronicle-text); font-size: var(--type-body); font-weight: 650; }
|
|
654
|
+
.repository-sync-chip { font-size: var(--type-caption); color: var(--chronicle-text-muted); font-weight: 600; }
|
|
655
|
+
.repository-sync-chip.error-chip { color: var(--chronicle-danger-text); }
|
|
656
|
+
.repository-card-meta { display: grid; grid-template-columns: 1fr auto auto; gap: var(--space-xs) var(--space-md); margin: 0; }
|
|
657
|
+
.repository-card-meta dt { color: var(--chronicle-text-faint); font-size: var(--type-caption); }
|
|
658
|
+
.repository-card-meta dd { margin: 2px 0 0; font-size: var(--type-body-sm); color: var(--chronicle-text); }
|
|
659
|
+
.repository-card-error { margin: 0; color: var(--chronicle-danger-text); font-size: var(--type-body-sm); word-break: break-word; }
|
|
660
|
+
.repository-modal-footer { display: flex; justify-content: flex-end; gap: var(--space-xs); padding-top: var(--space-sm); border-top: 1px solid var(--chronicle-border); }
|
|
661
|
+
@media (max-width: 1320px) { .skills-page { display: block; height: auto; min-height: 100%; } .catalog-pane.with-detail { display: none; } .detail-pane { width: 100%; min-width: 0; min-height: calc(100dvh - 2 * var(--space-lg)); height: auto; overflow: visible; border-radius: var(--radius-lg); box-shadow: none; } .mobile-detail-nav { display: flex; } }
|
|
662
|
+
@media (max-width: 960px) { .detail-pane { min-height: calc(100dvh - 28px); border-radius: 0; } }
|
|
663
|
+
@media (max-width: 760px) { .catalog-controls { display: grid; grid-template-columns: 1fr 1fr; } .search-field, .result-count { grid-column: 1 / -1; } .result-count { justify-self: start; } .catalog-tabs { width: 100%; } .catalog-tabs button { flex: 1 1 50%; } .skill-table { table-layout: auto; } .skill-table th:first-child { width: auto; } .skill-table th:nth-child(3) { width: 132px; } .skill-table th:nth-child(2), .skill-table td:nth-child(2), .skill-table th:nth-child(4), .skill-table td:nth-child(4), .skill-table th:nth-child(5), .skill-table td:nth-child(5) { display: none; } .skill-table td:first-child { min-width: 0; } .detail-pane { padding: var(--space-lg); } .detail-close { display: none; } .detail-meta { grid-template-columns: 1fr; } .detail-meta .full { grid-column: auto; } }
|
|
664
|
+
@media (max-width: 430px) { .catalog-controls { grid-template-columns: 1fr; } .catalog-controls > * { grid-column: 1; } .skill-table th, .skill-table td { padding-left: 8px; padding-right: 8px; } .skill-table th:nth-child(3) { width: 116px; } .detail-actions, .remove-confirmation > div, .repository-modal-footer { flex-wrap: wrap; } }
|
|
665
|
+
</style>
|