@ekanos/harness 0.27.0 → 0.28.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/README.md +6 -4
- package/dist/internal/components/approvals-tray.d.ts +44 -6
- package/dist/internal/components/approvals-tray.js +252 -30
- package/dist/internal/components/connect-controls.js +4 -2
- package/dist/internal/components/connect-dialog.d.ts +8 -1
- package/dist/internal/components/connect-dialog.js +23 -10
- package/dist/internal/components/connect-panel.d.ts +3 -2
- package/dist/internal/components/connect-panel.js +680 -340
- package/dist/internal/components/connect-steps.d.ts +72 -0
- package/dist/internal/components/connect-steps.js +341 -0
- package/dist/internal/components/console-not-found.d.ts +14 -0
- package/dist/internal/components/console-not-found.js +57 -0
- package/dist/internal/components/dashboard-grid.d.ts +10 -5
- package/dist/internal/components/dashboard-grid.js +8 -9
- package/dist/internal/components/dev-toolbar.d.ts +27 -5
- package/dist/internal/components/dev-toolbar.js +214 -176
- package/dist/internal/components/ekanos-logo.d.ts +18 -0
- package/dist/internal/components/ekanos-logo.js +74 -0
- package/dist/internal/components/events-panel.d.ts +13 -4
- package/dist/internal/components/events-panel.js +478 -81
- package/dist/internal/components/harness-widget-provider.d.ts +6 -8
- package/dist/internal/components/harness-widget-provider.js +5 -19
- package/dist/internal/components/health-panel.d.ts +8 -1
- package/dist/internal/components/health-panel.js +328 -31
- package/dist/internal/components/integration-badge.js +4 -2
- package/dist/internal/components/integration-tab-skeletons.d.ts +8 -0
- package/dist/internal/components/integration-tab-skeletons.js +76 -0
- package/dist/internal/components/not-found-state.d.ts +39 -0
- package/dist/internal/components/not-found-state.js +127 -0
- package/dist/internal/components/operation-runner-panel.d.ts +1 -1
- package/dist/internal/components/operation-runner-panel.js +624 -189
- package/dist/internal/components/operation-scope.d.ts +13 -0
- package/dist/internal/components/operation-scope.js +79 -0
- package/dist/internal/components/page-skeletons.d.ts +11 -0
- package/dist/internal/components/page-skeletons.js +61 -0
- package/dist/internal/components/provenance-banner.d.ts +13 -4
- package/dist/internal/components/provenance-banner.js +35 -10
- package/dist/internal/components/run-log-copy.d.ts +17 -0
- package/dist/internal/components/run-log-copy.js +67 -0
- package/dist/internal/components/run-log-detail.d.ts +22 -0
- package/dist/internal/components/run-log-detail.js +295 -0
- package/dist/internal/components/run-log-empty.d.ts +13 -0
- package/dist/internal/components/run-log-empty.js +46 -0
- package/dist/internal/components/run-log.d.ts +23 -3
- package/dist/internal/components/run-log.js +384 -130
- package/dist/internal/components/runtime-strip.d.ts +5 -1
- package/dist/internal/components/runtime-strip.js +82 -5
- package/dist/internal/components/schema-form.d.ts +2 -1
- package/dist/internal/components/schema-form.js +212 -79
- package/dist/internal/components/scrollable-nav.js +14 -2
- package/dist/internal/components/segmented-control.d.ts +19 -0
- package/dist/internal/components/segmented-control.js +46 -0
- package/dist/internal/components/shell-header.d.ts +25 -0
- package/dist/internal/components/shell-header.js +126 -0
- package/dist/internal/components/surface-nav.d.ts +12 -4
- package/dist/internal/components/surface-nav.js +77 -77
- package/dist/internal/components/widget-surface.d.ts +5 -1
- package/dist/internal/components/widget-surface.js +86 -14
- package/dist/internal/components/workflow-runner.d.ts +23 -10
- package/dist/internal/components/workflow-runner.js +451 -69
- package/dist/internal/lib/connect-model.d.ts +134 -0
- package/dist/internal/lib/connect-model.js +282 -0
- package/dist/internal/lib/connection-facts.js +2 -1
- package/dist/internal/lib/console-client.js +5 -2
- package/dist/internal/lib/console-hooks.d.ts +4 -1
- package/dist/internal/lib/console-hooks.js +3 -2
- package/dist/internal/lib/console-types.d.ts +6 -0
- package/dist/internal/lib/docs-links.d.ts +28 -0
- package/dist/internal/lib/docs-links.js +57 -1
- package/dist/internal/lib/event-delivery.d.ts +33 -0
- package/dist/internal/lib/event-delivery.js +66 -0
- package/dist/internal/lib/font-files/OFL-BricolageGrotesque.txt +93 -0
- package/dist/internal/lib/font-files/OFL-Figtree.txt +93 -0
- package/dist/internal/lib/font-files/bricolage-grotesque-latin-variable.woff2 +0 -0
- package/dist/internal/lib/font-files/figtree-latin-variable.woff2 +0 -0
- package/dist/internal/lib/fonts.js +13 -12
- package/dist/internal/lib/health-model.d.ts +58 -0
- package/dist/internal/lib/health-model.js +140 -0
- package/dist/internal/lib/integration-console-href.d.ts +5 -0
- package/dist/internal/lib/integration-console-href.js +7 -1
- package/dist/internal/lib/oauth-setup-guide.d.ts +28 -0
- package/dist/internal/lib/oauth-setup-guide.js +35 -1
- package/dist/internal/lib/operation-catalog.d.ts +70 -0
- package/dist/internal/lib/operation-catalog.js +261 -0
- package/dist/internal/lib/overview-model.d.ts +34 -0
- package/dist/internal/lib/overview-model.js +91 -0
- package/dist/internal/lib/registry-entry.d.ts +8 -0
- package/dist/internal/lib/registry-entry.js +11 -0
- package/dist/internal/lib/repo-name.d.ts +9 -0
- package/dist/internal/lib/repo-name.js +21 -0
- package/dist/internal/lib/run-log-view.d.ts +66 -1
- package/dist/internal/lib/run-log-view.js +183 -4
- package/dist/internal/lib/runner-view.d.ts +15 -0
- package/dist/internal/lib/runner-view.js +18 -0
- package/dist/internal/lib/schema-form-model.d.ts +17 -0
- package/dist/internal/lib/schema-form-model.js +50 -0
- package/dist/internal/lib/setup-checklist.d.ts +34 -0
- package/dist/internal/lib/setup-checklist.js +79 -0
- package/dist/internal/lib/toolbar-context.d.ts +0 -1
- package/dist/internal/lib/toolbar-context.js +0 -2
- package/dist/internal/lib/toolbar-visibility.d.ts +9 -2
- package/dist/internal/lib/toolbar-visibility.js +5 -0
- package/dist/internal/lib/use-operation-effects.d.ts +7 -0
- package/dist/internal/lib/use-operation-effects.js +28 -0
- package/dist/internal/lib/use-run-log-query.d.ts +9 -0
- package/dist/internal/lib/use-run-log-query.js +35 -0
- package/dist/internal/lib/widget-grid-gaps.d.ts +18 -0
- package/dist/internal/lib/widget-grid-gaps.js +41 -0
- package/dist/internal/lib/workflow-summary.d.ts +54 -0
- package/dist/internal/lib/workflow-summary.js +147 -0
- package/dist/internal/routes/console-home-page.js +2 -1
- package/dist/internal/routes/experience-connect-page.js +46 -17
- package/dist/internal/routes/experience-layout-page.js +75 -26
- package/dist/internal/routes/experience-page-host.js +63 -5
- package/dist/internal/routes/experience-review-queue-page.d.ts +4 -1
- package/dist/internal/routes/experience-review-queue-page.js +108 -12
- package/dist/internal/routes/experience-runs-page.js +57 -4
- package/dist/internal/routes/experience-summary-page.d.ts +19 -0
- package/dist/internal/routes/experience-summary-page.js +212 -52
- package/dist/internal/routes/experience-widget-page.js +58 -7
- package/dist/internal/routes/experience-widgets-page.d.ts +2 -3
- package/dist/internal/routes/experience-widgets-page.js +29 -4
- package/dist/internal/routes/experience-workflow-page.js +81 -9
- package/dist/internal/routes/experience-workflows-page.js +85 -21
- package/dist/internal/routes/integration-layout.js +28 -3
- package/dist/internal/routes/integrations-connect-page.js +16 -6
- package/dist/internal/routes/integrations-events-page.js +22 -1
- package/dist/internal/routes/integrations-health-page.js +16 -1
- package/dist/internal/routes/integrations-layout.js +28 -4
- package/dist/internal/routes/integrations-list-page.d.ts +0 -1
- package/dist/internal/routes/integrations-list-page.js +11 -9
- package/dist/internal/routes/integrations-operation-page.js +53 -17
- package/dist/internal/routes/integrations-operations-page.js +539 -49
- package/dist/internal/routes/integrations-overview-page.js +332 -69
- package/dist/internal/routes/integrations-runs-page.js +53 -3
- package/dist/internal/routes/integrations-scope.d.ts +15 -2
- package/dist/internal/routes/integrations-scope.js +66 -18
- package/dist/internal/routes/preview-index-page.js +2 -2
- package/dist/internal/routes/repo-home-page.d.ts +2 -2
- package/dist/internal/routes/repo-home-page.js +428 -236
- package/dist/internal/routes/repo-layout.d.ts +12 -0
- package/dist/internal/routes/repo-layout.js +50 -38
- package/dist/internal/routes/repo-package-layouts.js +22 -8
- package/dist/internal/routes/single-widget-page.d.ts +1 -1
- package/dist/internal/routes/single-widget-page.js +28 -5
- package/dist/internal/routes/tile-page.d.ts +1 -1
- package/dist/internal/routes/tile-page.js +1 -2
- package/dist/internal/routes/widgets-page.d.ts +1 -1
- package/dist/internal/routes/widgets-page.js +5 -3
- package/dist/registry.d.ts +4 -5
- package/dist/registry.js +0 -1
- package/dist/routes.d.ts +5 -0
- package/dist/routes.js +2 -0
- package/package.json +8 -8
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
const EMPTY_FILTERS = {
|
|
2
|
+
query: "",
|
|
3
|
+
effect: "all",
|
|
4
|
+
kind: "all"
|
|
5
|
+
};
|
|
6
|
+
const OTHER_GROUP = "other";
|
|
7
|
+
const VERB_PREFIX = "verb:";
|
|
8
|
+
const FILLER = /* @__PURE__ */ new Set(["all"]);
|
|
9
|
+
function verbOf(name) {
|
|
10
|
+
return name.toLowerCase().split(/[_\-.]+/)[0] ?? name;
|
|
11
|
+
}
|
|
12
|
+
function singular(token) {
|
|
13
|
+
if (token.endsWith("ies") && token.length > 4)
|
|
14
|
+
return `${token.slice(0, -3)}y`;
|
|
15
|
+
if (token.endsWith("uses") || token.endsWith("sses"))
|
|
16
|
+
return token.slice(0, -2);
|
|
17
|
+
if (/(us|ss|sis)$/.test(token)) return token;
|
|
18
|
+
if (token.endsWith("s") && token.length > 3) return token.slice(0, -1);
|
|
19
|
+
return token;
|
|
20
|
+
}
|
|
21
|
+
function plural(word) {
|
|
22
|
+
if (/(s|x|ch|sh)$/.test(word)) return `${word}es`;
|
|
23
|
+
if (/[^aeiou]y$/.test(word)) return `${word.slice(0, -1)}ies`;
|
|
24
|
+
return `${word}s`;
|
|
25
|
+
}
|
|
26
|
+
function nounTokens(name) {
|
|
27
|
+
const tokens = name.toLowerCase().split(/[_\-.]+/).filter(Boolean);
|
|
28
|
+
const verbLength = tokens[0] === "batch" && tokens.length > 2 ? 2 : 1;
|
|
29
|
+
const rest = tokens.slice(verbLength).filter((token) => !FILLER.has(token)).map(singular);
|
|
30
|
+
return rest.length > 0 ? rest : tokens.slice(0, 1);
|
|
31
|
+
}
|
|
32
|
+
function resourceKeyFor(nouns, tiers) {
|
|
33
|
+
for (let length = 1; length <= nouns.length; length += 1) {
|
|
34
|
+
for (const known of tiers) {
|
|
35
|
+
for (let start = 0; start + length <= nouns.length; start += 1) {
|
|
36
|
+
const candidate = nouns.slice(start, start + length).join("_");
|
|
37
|
+
if (known.has(candidate)) return candidate;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
function commonPrefix(lists) {
|
|
44
|
+
const [first, ...rest] = lists;
|
|
45
|
+
if (!first) return [];
|
|
46
|
+
let length = first.length;
|
|
47
|
+
for (const list of rest) {
|
|
48
|
+
let index = 0;
|
|
49
|
+
while (index < length && list[index] === first[index]) index += 1;
|
|
50
|
+
length = index;
|
|
51
|
+
}
|
|
52
|
+
return first.slice(0, length);
|
|
53
|
+
}
|
|
54
|
+
function capitalize(phrase) {
|
|
55
|
+
return phrase.charAt(0).toUpperCase() + phrase.slice(1);
|
|
56
|
+
}
|
|
57
|
+
function groupLabel(key, nouns, resources) {
|
|
58
|
+
if (key.startsWith(VERB_PREFIX))
|
|
59
|
+
return capitalize(key.slice(VERB_PREFIX.length));
|
|
60
|
+
const keyTokens = key.split("_");
|
|
61
|
+
const anchored = nouns.map((tokens) => {
|
|
62
|
+
const at = tokens.indexOf(keyTokens[0] ?? "");
|
|
63
|
+
return at === -1 ? tokens : tokens.slice(at);
|
|
64
|
+
}).filter((tokens) => tokens.length > 0);
|
|
65
|
+
const prefix = commonPrefix(anchored);
|
|
66
|
+
const words = prefix.length >= keyTokens.length ? prefix : keyTokens;
|
|
67
|
+
const last = words.length - 1;
|
|
68
|
+
const joined = words.join("_");
|
|
69
|
+
const countable = resources.has(joined) || nouns.some((tokens) => tokens.join("_") === joined);
|
|
70
|
+
return capitalize(
|
|
71
|
+
words.map((word, index) => countable && index === last ? plural(word) : word).join(" ")
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
function groupOperations(operations) {
|
|
75
|
+
const nouns = new Map(
|
|
76
|
+
operations.map((operation) => [operation.id, nounTokens(operation.name)])
|
|
77
|
+
);
|
|
78
|
+
const resources = /* @__PURE__ */ new Set();
|
|
79
|
+
const shared = /* @__PURE__ */ new Set();
|
|
80
|
+
const firstCounts = /* @__PURE__ */ new Map();
|
|
81
|
+
for (const operation of operations) {
|
|
82
|
+
const tokens = nouns.get(operation.id) ?? [];
|
|
83
|
+
if (operation.effect === "read") resources.add(tokens.join("_"));
|
|
84
|
+
const first = tokens[0];
|
|
85
|
+
if (first) firstCounts.set(first, (firstCounts.get(first) ?? 0) + 1);
|
|
86
|
+
}
|
|
87
|
+
for (const [first, count] of firstCounts) if (count > 1) shared.add(first);
|
|
88
|
+
const keys = new Map(
|
|
89
|
+
operations.map((operation) => {
|
|
90
|
+
const tokens = nouns.get(operation.id) ?? [];
|
|
91
|
+
return [
|
|
92
|
+
operation.id,
|
|
93
|
+
resourceKeyFor(tokens, [resources, shared])
|
|
94
|
+
];
|
|
95
|
+
})
|
|
96
|
+
);
|
|
97
|
+
const verbCounts = /* @__PURE__ */ new Map();
|
|
98
|
+
for (const operation of operations) {
|
|
99
|
+
if (keys.get(operation.id)) continue;
|
|
100
|
+
const verb = verbOf(operation.name);
|
|
101
|
+
verbCounts.set(verb, (verbCounts.get(verb) ?? 0) + 1);
|
|
102
|
+
}
|
|
103
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
104
|
+
for (const operation of operations) {
|
|
105
|
+
const verb = verbOf(operation.name);
|
|
106
|
+
const key = keys.get(operation.id) ?? ((verbCounts.get(verb) ?? 0) > 1 ? `${VERB_PREFIX}${verb}` : OTHER_GROUP);
|
|
107
|
+
byKey.set(key, [...byKey.get(key) ?? [], operation]);
|
|
108
|
+
}
|
|
109
|
+
const groups = [];
|
|
110
|
+
const other = [...byKey.get(OTHER_GROUP) ?? []];
|
|
111
|
+
for (const [key, members] of byKey) {
|
|
112
|
+
if (key === OTHER_GROUP) continue;
|
|
113
|
+
if (members.length < 2) {
|
|
114
|
+
other.push(...members);
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
groups.push({
|
|
118
|
+
key,
|
|
119
|
+
label: groupLabel(
|
|
120
|
+
key,
|
|
121
|
+
members.map((operation) => nouns.get(operation.id) ?? []),
|
|
122
|
+
resources
|
|
123
|
+
),
|
|
124
|
+
operations: members
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
if (groups.length === 0) {
|
|
128
|
+
return other.length > 0 ? [{ key: "all", label: "Operations", operations: [...operations] }] : [];
|
|
129
|
+
}
|
|
130
|
+
if (other.length > 0) {
|
|
131
|
+
const order = new Map(
|
|
132
|
+
operations.map((operation, index) => [operation.id, index])
|
|
133
|
+
);
|
|
134
|
+
other.sort((a, b) => (order.get(a.id) ?? 0) - (order.get(b.id) ?? 0));
|
|
135
|
+
groups.push({ key: OTHER_GROUP, label: "Other", operations: other });
|
|
136
|
+
}
|
|
137
|
+
return groups;
|
|
138
|
+
}
|
|
139
|
+
function matchesFilters(operation, filters) {
|
|
140
|
+
if (filters.effect !== "all" && operation.effect !== filters.effect) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
if (filters.kind !== "all" && operation.kind !== filters.kind) return false;
|
|
144
|
+
const terms = filters.query.trim().toLowerCase().split(/\s+/).filter(Boolean);
|
|
145
|
+
if (terms.length === 0) return true;
|
|
146
|
+
const haystack = `${operation.kind}/${operation.name} ${operation.name.replace(/_/g, " ")} ${operation.description}`.toLowerCase();
|
|
147
|
+
return terms.every((term) => haystack.includes(term));
|
|
148
|
+
}
|
|
149
|
+
function filterGroups(groups, filters) {
|
|
150
|
+
return groups.map((group) => ({
|
|
151
|
+
...group,
|
|
152
|
+
operations: group.operations.filter(
|
|
153
|
+
(operation) => matchesFilters(operation, filters)
|
|
154
|
+
)
|
|
155
|
+
})).filter((group) => group.operations.length > 0);
|
|
156
|
+
}
|
|
157
|
+
function isFiltered(filters) {
|
|
158
|
+
return filters.query.trim() !== "" || filters.effect !== "all" || filters.kind !== "all";
|
|
159
|
+
}
|
|
160
|
+
function readFilters(params) {
|
|
161
|
+
const effect = params.get("effect");
|
|
162
|
+
const kind = params.get("kind");
|
|
163
|
+
return {
|
|
164
|
+
query: params.get("q") ?? "",
|
|
165
|
+
effect: effect === "read" || effect === "write" ? effect : "all",
|
|
166
|
+
kind: kind === "tool" || kind === "action" ? kind : "all"
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function writeFilters(current, filters) {
|
|
170
|
+
const params = new URLSearchParams(current);
|
|
171
|
+
const set = (name, value, empty) => {
|
|
172
|
+
if (value === empty) params.delete(name);
|
|
173
|
+
else params.set(name, value);
|
|
174
|
+
};
|
|
175
|
+
set("q", filters.query, "");
|
|
176
|
+
set("effect", filters.effect, "all");
|
|
177
|
+
set("kind", filters.kind, "all");
|
|
178
|
+
const query = params.toString();
|
|
179
|
+
return query ? `?${query}` : "";
|
|
180
|
+
}
|
|
181
|
+
const COLLAPSE_ABOVE = 40;
|
|
182
|
+
function groupsOpenByDefault(total, filters) {
|
|
183
|
+
return isFiltered(filters) || total <= COLLAPSE_ABOVE;
|
|
184
|
+
}
|
|
185
|
+
function isGroupOpen(key, choices, byDefault) {
|
|
186
|
+
return choices.get(key) ?? byDefault;
|
|
187
|
+
}
|
|
188
|
+
function choicesAfterFilter(choices) {
|
|
189
|
+
return new Map([...choices].filter(([, open]) => open));
|
|
190
|
+
}
|
|
191
|
+
function effectSplit(operations) {
|
|
192
|
+
const reads = operations.filter(
|
|
193
|
+
(operation) => operation.effect === "read"
|
|
194
|
+
).length;
|
|
195
|
+
return { reads, writes: operations.length - reads };
|
|
196
|
+
}
|
|
197
|
+
function groupRuns(groups, isOpen) {
|
|
198
|
+
const runs = [];
|
|
199
|
+
for (const group of groups) {
|
|
200
|
+
if (isOpen(group.key)) {
|
|
201
|
+
runs.push({ open: true, group });
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
const last = runs.at(-1);
|
|
205
|
+
if (last && !last.open) last.groups.push(group);
|
|
206
|
+
else runs.push({ open: false, groups: [group] });
|
|
207
|
+
}
|
|
208
|
+
return runs;
|
|
209
|
+
}
|
|
210
|
+
function listKeyTarget(key, current, length) {
|
|
211
|
+
if (length === 0) return null;
|
|
212
|
+
switch (key) {
|
|
213
|
+
case "ArrowDown":
|
|
214
|
+
return Math.min(current + 1, length - 1);
|
|
215
|
+
case "ArrowUp":
|
|
216
|
+
return Math.max(current - 1, 0);
|
|
217
|
+
case "Home":
|
|
218
|
+
return 0;
|
|
219
|
+
case "End":
|
|
220
|
+
return length - 1;
|
|
221
|
+
default:
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
function commonSince(operations) {
|
|
226
|
+
const counts = /* @__PURE__ */ new Map();
|
|
227
|
+
for (const operation of operations) {
|
|
228
|
+
if (operation.since) {
|
|
229
|
+
counts.set(operation.since, (counts.get(operation.since) ?? 0) + 1);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
let best;
|
|
233
|
+
let bestCount = 0;
|
|
234
|
+
for (const [since, count] of counts) {
|
|
235
|
+
if (count > bestCount) {
|
|
236
|
+
best = since;
|
|
237
|
+
bestCount = count;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return best;
|
|
241
|
+
}
|
|
242
|
+
export {
|
|
243
|
+
COLLAPSE_ABOVE,
|
|
244
|
+
EMPTY_FILTERS,
|
|
245
|
+
OTHER_GROUP,
|
|
246
|
+
choicesAfterFilter,
|
|
247
|
+
commonSince,
|
|
248
|
+
effectSplit,
|
|
249
|
+
filterGroups,
|
|
250
|
+
groupOperations,
|
|
251
|
+
groupRuns,
|
|
252
|
+
groupsOpenByDefault,
|
|
253
|
+
isFiltered,
|
|
254
|
+
isGroupOpen,
|
|
255
|
+
listKeyTarget,
|
|
256
|
+
matchesFilters,
|
|
257
|
+
nounTokens,
|
|
258
|
+
readFilters,
|
|
259
|
+
singular,
|
|
260
|
+
writeFilters
|
|
261
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { IntegrationConnectionFacts } from '../../api-types.js';
|
|
2
|
+
import type { RunMode } from './console-types.js';
|
|
3
|
+
export interface OverviewNext {
|
|
4
|
+
id: 'connect' | 'run' | 'all-set' | 'fixtures';
|
|
5
|
+
eyebrow: string;
|
|
6
|
+
title: string;
|
|
7
|
+
detail: string;
|
|
8
|
+
/** The tab the primary action opens; `null` is the overview itself. */
|
|
9
|
+
segment: 'connect' | 'operations' | 'runs' | null;
|
|
10
|
+
action: string;
|
|
11
|
+
secondary: {
|
|
12
|
+
label: string;
|
|
13
|
+
segment: 'operations' | 'connect';
|
|
14
|
+
} | null;
|
|
15
|
+
checklist: Array<{
|
|
16
|
+
id: string;
|
|
17
|
+
label: string;
|
|
18
|
+
done: boolean;
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* What a developer should do next on this integration: connect it, run an
|
|
23
|
+
* operation, or nothing. Decided from the connection facts and whether this
|
|
24
|
+
* integration has any run on record.
|
|
25
|
+
*/
|
|
26
|
+
export declare function overviewNext(args: {
|
|
27
|
+
slug: string;
|
|
28
|
+
facts: IntegrationConnectionFacts;
|
|
29
|
+
operations: number;
|
|
30
|
+
ran: boolean;
|
|
31
|
+
}): OverviewNext;
|
|
32
|
+
export declare function runModesLine(modes: readonly RunMode[]): string;
|
|
33
|
+
/** `['team', 'user']` → `connects for the team or for each person`. */
|
|
34
|
+
export declare function levelsLine(levels: ReadonlyArray<'source' | 'team' | 'user'>): string;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
function overviewNext(args) {
|
|
2
|
+
const { slug, facts, operations, ran } = args;
|
|
3
|
+
const needsConnection = facts.state === "not_connected" || facts.state === "unreadable";
|
|
4
|
+
const connectable = facts.kind !== "none" && facts.state !== "managed";
|
|
5
|
+
const connected = !needsConnection;
|
|
6
|
+
const checklist = [
|
|
7
|
+
...connectable ? [
|
|
8
|
+
{
|
|
9
|
+
id: "connect",
|
|
10
|
+
label: facts.kind === "oauth" ? "Add app keys and authorize" : "Add your keys",
|
|
11
|
+
done: connected
|
|
12
|
+
}
|
|
13
|
+
] : [],
|
|
14
|
+
{
|
|
15
|
+
id: "run",
|
|
16
|
+
label: operations > 0 ? "Run an operation" : "Declare an operation",
|
|
17
|
+
done: ran
|
|
18
|
+
}
|
|
19
|
+
];
|
|
20
|
+
if (needsConnection && connectable) {
|
|
21
|
+
return {
|
|
22
|
+
id: "connect",
|
|
23
|
+
eyebrow: "Next step",
|
|
24
|
+
title: `Connect ${slug}`,
|
|
25
|
+
detail: facts.kind === "oauth" ? "Save the OAuth app keys, then authorize, so operations can run live. Fixtures answer in the meantime." : "Save the keys so operations can run live. Fixtures answer in the meantime.",
|
|
26
|
+
segment: "connect",
|
|
27
|
+
action: "Connect",
|
|
28
|
+
secondary: operations > 0 ? {
|
|
29
|
+
label: ran ? "Run another on fixtures" : "Try an operation on fixtures",
|
|
30
|
+
segment: "operations"
|
|
31
|
+
} : null,
|
|
32
|
+
checklist
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
if (facts.state === "managed") {
|
|
36
|
+
return {
|
|
37
|
+
id: "fixtures",
|
|
38
|
+
eyebrow: "Next step",
|
|
39
|
+
title: "Run an operation on fixtures",
|
|
40
|
+
detail: `${slug} is managed by Ekanos, so it answers from fixtures here.`,
|
|
41
|
+
segment: "operations",
|
|
42
|
+
action: "Open operations",
|
|
43
|
+
secondary: null,
|
|
44
|
+
checklist
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
if (!ran && operations > 0) {
|
|
48
|
+
return {
|
|
49
|
+
id: "run",
|
|
50
|
+
eyebrow: "Next step",
|
|
51
|
+
title: "Run an operation",
|
|
52
|
+
detail: facts.answers === "live" ? `${slug} is ready. Pick an operation and run it live or on fixtures.` : `Pick an operation and run it on fixtures.`,
|
|
53
|
+
segment: "operations",
|
|
54
|
+
action: "Open operations",
|
|
55
|
+
secondary: null,
|
|
56
|
+
checklist
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
id: "all-set",
|
|
61
|
+
eyebrow: "All set",
|
|
62
|
+
title: `${slug} is set up`,
|
|
63
|
+
detail: "Every step is done. The run log has what ran and how it answered.",
|
|
64
|
+
segment: "runs",
|
|
65
|
+
action: "Open the run log",
|
|
66
|
+
secondary: operations > 0 ? { label: "Operations", segment: "operations" } : null,
|
|
67
|
+
checklist
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function runModesLine(modes) {
|
|
71
|
+
const live = modes.includes("live");
|
|
72
|
+
const fixtures = modes.includes("fixtures");
|
|
73
|
+
if (live && fixtures) return "Fixtures and live";
|
|
74
|
+
if (live) return "Live only";
|
|
75
|
+
return "Fixtures only";
|
|
76
|
+
}
|
|
77
|
+
const LEVEL_WORDS = {
|
|
78
|
+
source: "once for every team",
|
|
79
|
+
team: "for the team",
|
|
80
|
+
user: "for each person"
|
|
81
|
+
};
|
|
82
|
+
function levelsLine(levels) {
|
|
83
|
+
const words = levels.map((level) => LEVEL_WORDS[level]);
|
|
84
|
+
if (words.length === 0) return "";
|
|
85
|
+
return `connects ${words.length === 1 ? words[0] : `${words.slice(0, -1).join(", ")} or ${words.at(-1)}`}`;
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
levelsLine,
|
|
89
|
+
overviewNext,
|
|
90
|
+
runModesLine
|
|
91
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The registry entry for an integration id: the exact slug, else the bare slug
|
|
3
|
+
* of a namespaced id (`vastly-dev/linear` → `linear`), which is how a repo
|
|
4
|
+
* package's entry is keyed when an experience names it by namespace.
|
|
5
|
+
*/
|
|
6
|
+
export declare function registryEntryFor<T extends {
|
|
7
|
+
slug: string;
|
|
8
|
+
}>(registry: readonly T[], id: string): T | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function registryEntryFor(registry, id) {
|
|
2
|
+
const exact = registry.find((entry) => entry.slug === id);
|
|
3
|
+
if (exact) return exact;
|
|
4
|
+
const slash = id.lastIndexOf("/");
|
|
5
|
+
if (slash === -1) return void 0;
|
|
6
|
+
const bare = id.slice(slash + 1);
|
|
7
|
+
return registry.find((entry) => entry.slug === bare);
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
registryEntryFor
|
|
11
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/** The repo folder's name, from its absolute root. */
|
|
3
|
+
export declare function repoName(root: string): string;
|
|
4
|
+
/** Set by a repo shell so a package's console can name the repo in its breadcrumb. */
|
|
5
|
+
export declare function RepoNameProvider({ name, children, }: {
|
|
6
|
+
name: string | null;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
9
|
+
export declare function useRepoName(): string | null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, use } from "react";
|
|
4
|
+
function repoName(root) {
|
|
5
|
+
return root.split(/[\\/]/).filter(Boolean).pop() ?? root;
|
|
6
|
+
}
|
|
7
|
+
const RepoNameContext = createContext(null);
|
|
8
|
+
function RepoNameProvider({
|
|
9
|
+
name,
|
|
10
|
+
children
|
|
11
|
+
}) {
|
|
12
|
+
return /* @__PURE__ */ jsx(RepoNameContext, { value: name, children });
|
|
13
|
+
}
|
|
14
|
+
function useRepoName() {
|
|
15
|
+
return use(RepoNameContext);
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
RepoNameProvider,
|
|
19
|
+
repoName,
|
|
20
|
+
useRepoName
|
|
21
|
+
};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import type { RunRecord } from './console-types.js';
|
|
1
|
+
import type { RunMode, RunRecord } from './console-types.js';
|
|
2
2
|
/** Rows shown before "Show more". */
|
|
3
3
|
export declare const RUN_PAGE_SIZE = 50;
|
|
4
|
+
/** What the dev server keeps (`RUN_LOG_CAPACITY` in `server/run-log.ts`). */
|
|
5
|
+
export declare const RUN_LOG_KEEPS = 200;
|
|
4
6
|
export type RunOutcome = 'ok' | 'refused' | 'failed' | 'held';
|
|
5
7
|
export declare const RUN_OUTCOMES: readonly RunOutcome[];
|
|
8
|
+
export declare const RUN_OUTCOME_LABELS: Readonly<Record<RunOutcome, string>>;
|
|
6
9
|
/**
|
|
7
10
|
* The outcome a person filters by: `ok`; `held` (a write waiting on, or denied,
|
|
8
11
|
* an approval); `refused` (the harness said no); `failed` (it ran and broke).
|
|
@@ -10,11 +13,40 @@ export declare const RUN_OUTCOMES: readonly RunOutcome[];
|
|
|
10
13
|
export declare function runOutcome(run: Pick<RunRecord, 'status' | 'reason'>): RunOutcome;
|
|
11
14
|
/** A sentence for a refusal reason such as `operation_not_declared`, or null for an unknown one. */
|
|
12
15
|
export declare function explainRunReason(reason: string | undefined): string | null;
|
|
16
|
+
/**
|
|
17
|
+
* Why a row that carries no reason code did not succeed. A test event is
|
|
18
|
+
* recorded `refused` with no code when its payload failed the contract.
|
|
19
|
+
*/
|
|
20
|
+
export declare function explainRun(run: RunRecord): string | null;
|
|
21
|
+
export type RunKind = 'operation' | 'event';
|
|
22
|
+
/** A test event is recorded with the key `event/<name>`. */
|
|
23
|
+
export declare function runKind(run: Pick<RunRecord, 'opKey'>): RunKind;
|
|
24
|
+
/** `tool/get_viewer` → `{ kind: 'tool', name: 'get_viewer' }`. */
|
|
25
|
+
export declare function splitOpKey(opKey: string): {
|
|
26
|
+
kind: string;
|
|
27
|
+
name: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Where to try this run again: the operation's runner, or the Events tab with
|
|
31
|
+
* the event chosen. Null without a console (`consoleHref` from
|
|
32
|
+
* `integrationConsoleHref`) or for a key no page serves (an approval gate).
|
|
33
|
+
*/
|
|
34
|
+
export declare function runTargetHref(consoleHref: string | null, opKey: string): string | null;
|
|
35
|
+
/** Where a run came from, in plain words, from its `origin` and `channel`. */
|
|
36
|
+
export declare function describeRunSource(run: Pick<RunRecord, 'origin' | 'channel'>): string;
|
|
37
|
+
export declare const MODE_WORDS: Readonly<Record<RunMode, string>>;
|
|
38
|
+
export declare function formatBytes(bytes: number): string;
|
|
39
|
+
export declare function formatDuration(ms: number): string;
|
|
13
40
|
export interface RunFilter {
|
|
14
41
|
outcome: RunOutcome | 'all';
|
|
15
42
|
integration: string | 'all';
|
|
43
|
+
mode?: RunMode | 'all';
|
|
44
|
+
kind?: RunKind | 'all';
|
|
45
|
+
/** Matches the operation key, case-insensitively. */
|
|
46
|
+
q?: string;
|
|
16
47
|
}
|
|
17
48
|
export declare const NO_RUN_FILTER: RunFilter;
|
|
49
|
+
export declare function isFiltered(filter: RunFilter): boolean;
|
|
18
50
|
/** Newest first, filtered. */
|
|
19
51
|
export declare function filterRuns(runs: readonly RunRecord[], filter: RunFilter): RunRecord[];
|
|
20
52
|
/** The first `limit` rows, and whether more follow. */
|
|
@@ -22,3 +54,36 @@ export declare function pageRuns<T>(rows: readonly T[], limit: number): {
|
|
|
22
54
|
shown: T[];
|
|
23
55
|
remaining: number;
|
|
24
56
|
};
|
|
57
|
+
/** How many rows each outcome holds, before the outcome filter applies. */
|
|
58
|
+
export declare function countOutcomes(runs: readonly RunRecord[]): Record<RunOutcome, number>;
|
|
59
|
+
export interface RunLogQuery {
|
|
60
|
+
filter: RunFilter;
|
|
61
|
+
/** The run whose detail is open. */
|
|
62
|
+
run: string | null;
|
|
63
|
+
}
|
|
64
|
+
/** Reads the run log's state from a query string; unknown values fall back to "all". */
|
|
65
|
+
export declare function parseRunQuery(params: {
|
|
66
|
+
get(name: string): string | null;
|
|
67
|
+
}): RunLogQuery;
|
|
68
|
+
/** The query string for a state, leaving defaults out; `''` when nothing is set. */
|
|
69
|
+
export declare function runQueryString(query: RunLogQuery): string;
|
|
70
|
+
/** A link into a run log: one run open, or narrowed to one event. */
|
|
71
|
+
export declare function runLogHref(base: string, options: {
|
|
72
|
+
run?: string;
|
|
73
|
+
event?: string;
|
|
74
|
+
}): string;
|
|
75
|
+
export interface RunDay<T> {
|
|
76
|
+
key: string;
|
|
77
|
+
label: string;
|
|
78
|
+
runs: T[];
|
|
79
|
+
}
|
|
80
|
+
/** Rows (already newest first) in runs by local day: Today, Yesterday, then dates. */
|
|
81
|
+
export declare function groupRunsByDay<T extends Pick<RunRecord, 'ts'>>(runs: readonly T[], now?: Date): RunDay<T>[];
|
|
82
|
+
/** The rows either side of `id` in the shown order (newest first). */
|
|
83
|
+
export declare function runNeighbours<T extends {
|
|
84
|
+
id: string;
|
|
85
|
+
}>(rows: readonly T[], id: string | null): {
|
|
86
|
+
index: number;
|
|
87
|
+
newer: T | null;
|
|
88
|
+
older: T | null;
|
|
89
|
+
};
|