@ekanos/harness 0.26.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/api-types.d.ts +4 -0
- 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 +115 -10
- 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 -3
- package/dist/internal/components/surface-nav.js +72 -83
- 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/experience-runtime.d.ts +2 -1
- package/dist/internal/lib/experience-runtime.js +5 -3
- 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 +15 -0
- package/dist/internal/lib/integration-console-href.js +16 -0
- 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 +51 -22
- 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 +219 -62
- 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/internal/server/ekanos-api-router.js +20 -5
- package/dist/internal/server/repo-api-router.js +20 -7
- 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
package/README.md
CHANGED
|
@@ -122,7 +122,6 @@ nothing else.
|
|
|
122
122
|
| `title` | yes | Rendered in the widget header chrome |
|
|
123
123
|
| `component` | yes | `ComponentType<IntegrationComponentProps>` |
|
|
124
124
|
| `width` | no | `'compact'`, `'half'` (default) or `'full'`. `size` and `layouts` are read first, as on the dashboard. Runs of `half` balance across two columns |
|
|
125
|
-
| `isCollapsible` | no | Renders the collapse button. Off unless set |
|
|
126
125
|
| `isPinnable` | no | Reaches `WidgetContext`; nothing draws a pin — see below |
|
|
127
126
|
| `aiFooterEnabled` | no | Renders the "Ask about this" AI footer bar. Off unless set |
|
|
128
127
|
| `seeds` | no | `Partial<Record<FixtureVariant, FixtureSeed[]>>` — react-query cache seeds for this widget, per variant. The fast path, not the default; see [Fixtures](#fixtures) |
|
|
@@ -156,7 +155,7 @@ const ctx = use(WidgetContext);
|
|
|
156
155
|
|
|
157
156
|
### Derive the widget list — don't write it twice
|
|
158
157
|
|
|
159
|
-
`HarnessWidget` repeats `id`, `component`, `
|
|
158
|
+
`HarnessWidget` repeats `id`, `component`, `isPinnable` and
|
|
160
159
|
`aiFooterEnabled` from `components.widgets[]` in your `defineIntegration()`
|
|
161
160
|
output, renaming `name` to `title`. Writing both by hand is two declarations of
|
|
162
161
|
the same thing with nothing detecting drift, so don't:
|
|
@@ -1153,7 +1152,7 @@ pnpm --filter @ekanos/harness build
|
|
|
1153
1152
|
The build compiles **per file** rather than bundling (`bundle: false` in
|
|
1154
1153
|
`tsup.config.ts`), and that is load-bearing in three separate ways: the
|
|
1155
1154
|
server/client boundary runs _through_ the `/app` entry rather than around it,
|
|
1156
|
-
`next/font/
|
|
1155
|
+
`next/font/local` requires its call to survive as a `const` (esbuild's bundler
|
|
1157
1156
|
rewrites top-level `const` to `var`, which Next rejects outright), and there is
|
|
1158
1157
|
nothing to inline in the first place. Each of those is a bug we have already
|
|
1159
1158
|
shipped once; the build config in the source tree carries the long version.
|
|
@@ -1164,4 +1163,7 @@ published tarball, in a clean room outside the workspace.
|
|
|
1164
1163
|
## Licence
|
|
1165
1164
|
|
|
1166
1165
|
MIT. Icons are [Phosphor](https://phosphoricons.com) (MIT), whose fonts ship
|
|
1167
|
-
inside `@ekanos/ui
|
|
1166
|
+
inside `@ekanos/ui`. The chrome's typefaces, [Figtree](https://github.com/erikdkennedy/figtree)
|
|
1167
|
+
and [Bricolage Grotesque](https://github.com/ateliertriay/bricolage), ship in
|
|
1168
|
+
`dist/internal/lib/font-files/` under the SIL Open Font License 1.1, whose text sits
|
|
1169
|
+
beside each file.
|
package/dist/api-types.d.ts
CHANGED
|
@@ -549,6 +549,8 @@ export interface RepoExperienceIntegration {
|
|
|
549
549
|
modes: BindingMode[];
|
|
550
550
|
/** The integration is a package of this repo. */
|
|
551
551
|
sameRepo: boolean;
|
|
552
|
+
/** That package's name (its bare slug), which its own API is keyed by. */
|
|
553
|
+
packageName: string | null;
|
|
552
554
|
connection: RepoConnection | null;
|
|
553
555
|
/** Levels this experience will ask for once published, within what the integration supports. */
|
|
554
556
|
levels: RepoConnectLevel[];
|
|
@@ -556,6 +558,8 @@ export interface RepoExperienceIntegration {
|
|
|
556
558
|
levelProblem?: string;
|
|
557
559
|
/** Link to connect it (the integration's console), when it is a package of this repo. */
|
|
558
560
|
connectHref: string | null;
|
|
561
|
+
/** The integration's console, when it is a package of this repo. */
|
|
562
|
+
consoleHref: string | null;
|
|
559
563
|
}
|
|
560
564
|
export interface RepoExperienceRow {
|
|
561
565
|
name: string;
|
|
@@ -3,15 +3,53 @@ import type { ApprovalDecision, PendingApproval } from '../lib/console-types.js'
|
|
|
3
3
|
export declare function approvalOperationName(opKey: string): string;
|
|
4
4
|
/** The one-line summary of the waiting writes, e.g. `1 write waiting for approval: linkedin draft_post`. */
|
|
5
5
|
export declare function approvalsSummary(approvals: readonly Pick<PendingApproval, 'integration' | 'opKey'>[]): string;
|
|
6
|
-
/**
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* A gate's summary, kept as its author wrote it: one paragraph per line, and
|
|
8
|
+
* numbered or bulleted lines as a real list, so a long proposal scans.
|
|
9
|
+
*/
|
|
10
|
+
export declare function ProposalText({ text, className, }: {
|
|
11
|
+
text: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
14
|
+
/**
|
|
15
|
+
* One pending decision. A workflow approval gate reads as its own summary
|
|
16
|
+
* (what approving will let the workflow do); a held write reads as the
|
|
17
|
+
* operation and its arguments.
|
|
18
|
+
*
|
|
19
|
+
* Neither button asks again: the card IS the confirmation step, and Reject
|
|
20
|
+
* only stops the run, writing nothing.
|
|
21
|
+
*/
|
|
22
|
+
export declare function ApprovalCard({ approval, pending, onDecide, workflowTitle, }: {
|
|
8
23
|
approval: PendingApproval;
|
|
9
|
-
|
|
24
|
+
/** The decision being sent for this card, while it is sent. */
|
|
25
|
+
pending?: ApprovalDecision | boolean | null;
|
|
10
26
|
onDecide: (decision: ApprovalDecision) => void;
|
|
27
|
+
/** The workflow's name, when the caller knows it. */
|
|
28
|
+
workflowTitle?: string;
|
|
29
|
+
}): import("react").JSX.Element;
|
|
30
|
+
/**
|
|
31
|
+
* The decisions made in this session, newest first: what was decided and
|
|
32
|
+
* what it did. `workflowId` narrows to one workflow's; `since` to decisions
|
|
33
|
+
* made after a moment (a run's start).
|
|
34
|
+
*/
|
|
35
|
+
export declare function DecisionLog({ workflowId, since, limit, }: {
|
|
36
|
+
workflowId?: string;
|
|
37
|
+
since?: number;
|
|
38
|
+
limit?: number;
|
|
39
|
+
}): import("react").JSX.Element | null;
|
|
40
|
+
/** Every pending approval as decidable cards, for the review queue and a workflow run. */
|
|
41
|
+
export declare function ApprovalList({ approvals, workflowTitles, workflowId, }: {
|
|
42
|
+
approvals: readonly PendingApproval[];
|
|
43
|
+
workflowTitles?: Readonly<Record<string, string>>;
|
|
44
|
+
/** Every approval here belongs to this workflow's run. */
|
|
45
|
+
workflowId?: string;
|
|
11
46
|
}): import("react").JSX.Element;
|
|
12
47
|
/**
|
|
13
48
|
* Every write waiting on a decision, from the console, a widget or a workflow
|
|
14
|
-
* run. Renders nothing when the queue is empty
|
|
15
|
-
*
|
|
49
|
+
* run. Renders nothing when the queue is empty. With `reviewHref` (an
|
|
50
|
+
* experience, whose review queue holds the decisions) it is one line pointing
|
|
51
|
+
* there; otherwise the decisions themselves, first thing on the page.
|
|
16
52
|
*/
|
|
17
|
-
export declare function ApprovalsTray(
|
|
53
|
+
export declare function ApprovalsTray({ reviewHref }?: {
|
|
54
|
+
reviewHref?: string;
|
|
55
|
+
}): import("react").JSX.Element | null;
|
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
|
+
import Link from "next/link";
|
|
4
5
|
import { Alert, AlertDescription, AlertTitle } from "@ekanos/ui/alert";
|
|
5
6
|
import { Button } from "@ekanos/ui/button";
|
|
6
7
|
import { Card } from "@ekanos/ui/card";
|
|
7
8
|
import { Icon } from "@ekanos/ui/icon";
|
|
8
|
-
import {
|
|
9
|
+
import { StatusBadge } from "@ekanos/ui/status-badge";
|
|
10
|
+
import { cn } from "@ekanos/ui/utils";
|
|
11
|
+
import {
|
|
12
|
+
useMutation,
|
|
13
|
+
useMutationState,
|
|
14
|
+
useQueryClient
|
|
15
|
+
} from "@tanstack/react-query";
|
|
16
|
+
import { useConsoleClient } from "../lib/console-context.js";
|
|
17
|
+
import { consoleKeys, useApprovals } from "../lib/console-hooks.js";
|
|
18
|
+
import { shortName } from "../lib/setup-checklist.js";
|
|
19
|
+
import {
|
|
20
|
+
gateStepId,
|
|
21
|
+
humanizeStepLabel,
|
|
22
|
+
proposalBlocks
|
|
23
|
+
} from "../lib/workflow-summary.js";
|
|
24
|
+
import { FOCUS_RING } from "./scrollable-nav.js";
|
|
9
25
|
function approvalOperationName(opKey) {
|
|
10
26
|
return opKey.split("/").pop() ?? opKey;
|
|
11
27
|
}
|
|
@@ -14,12 +30,74 @@ function approvalsSummary(approvals) {
|
|
|
14
30
|
const count = `${approvals.length} write${approvals.length === 1 ? "" : "s"} waiting for approval`;
|
|
15
31
|
return only && approvals.length === 1 ? `${count}: ${only.integration} ${approvalOperationName(only.opKey)}` : count;
|
|
16
32
|
}
|
|
33
|
+
function gateSummary(approval) {
|
|
34
|
+
const args = approval.args;
|
|
35
|
+
if (typeof args === "object" && args !== null && "summary" in args) {
|
|
36
|
+
const summary = args.summary;
|
|
37
|
+
return typeof summary === "string" ? summary : null;
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
function approvalLabel(approval, workflowTitle) {
|
|
42
|
+
const gate = gateStepId(approval.opKey);
|
|
43
|
+
return gate ? `${workflowTitle ?? approval.integration}: ${humanizeStepLabel(gate)}` : `${shortName(approval.integration)} ${approvalOperationName(approval.opKey)}`;
|
|
44
|
+
}
|
|
45
|
+
function ProposalText({
|
|
46
|
+
text,
|
|
47
|
+
className
|
|
48
|
+
}) {
|
|
49
|
+
return /* @__PURE__ */ jsx(
|
|
50
|
+
"div",
|
|
51
|
+
{
|
|
52
|
+
className: cn(
|
|
53
|
+
"flex min-w-0 flex-col gap-2 text-sm break-words",
|
|
54
|
+
className
|
|
55
|
+
),
|
|
56
|
+
"data-test": "approval-summary",
|
|
57
|
+
children: proposalBlocks(text).map((block, index) => {
|
|
58
|
+
if (block.kind === "text") {
|
|
59
|
+
return /* @__PURE__ */ jsx("p", { children: block.text }, index);
|
|
60
|
+
}
|
|
61
|
+
if (block.kind === "bulleted") {
|
|
62
|
+
return /* @__PURE__ */ jsx("ul", { className: "flex list-disc flex-col gap-1.5 pl-5", children: block.items.map((item, itemIndex) => /* @__PURE__ */ jsx("li", { children: item }, itemIndex)) }, index);
|
|
63
|
+
}
|
|
64
|
+
return /* @__PURE__ */ jsx(
|
|
65
|
+
"ol",
|
|
66
|
+
{
|
|
67
|
+
className: "bg-secondary flex flex-col divide-y rounded-md border",
|
|
68
|
+
"data-test": "approval-summary-list",
|
|
69
|
+
children: block.items.map((item) => /* @__PURE__ */ jsxs(
|
|
70
|
+
"li",
|
|
71
|
+
{
|
|
72
|
+
value: item.number,
|
|
73
|
+
className: "flex min-w-0 gap-3 px-3 py-2",
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground min-w-6 shrink-0 text-right whitespace-nowrap tabular-nums", children: [
|
|
76
|
+
item.number,
|
|
77
|
+
"."
|
|
78
|
+
] }),
|
|
79
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0", children: item.text })
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
item.number
|
|
83
|
+
))
|
|
84
|
+
},
|
|
85
|
+
index
|
|
86
|
+
);
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}
|
|
17
91
|
function ApprovalCard({
|
|
18
92
|
approval,
|
|
19
93
|
pending,
|
|
20
|
-
onDecide
|
|
94
|
+
onDecide,
|
|
95
|
+
workflowTitle
|
|
21
96
|
}) {
|
|
22
97
|
const [open, setOpen] = useState(false);
|
|
98
|
+
const gate = gateStepId(approval.opKey);
|
|
99
|
+
const summary = gate ? gateSummary(approval) : null;
|
|
100
|
+
const busy = Boolean(pending);
|
|
23
101
|
return /* @__PURE__ */ jsxs(
|
|
24
102
|
Card,
|
|
25
103
|
{
|
|
@@ -27,19 +105,36 @@ function ApprovalCard({
|
|
|
27
105
|
className: "flex min-w-0 flex-col gap-3 p-4",
|
|
28
106
|
"data-test": "approval-card",
|
|
29
107
|
"data-approval-id": approval.id,
|
|
108
|
+
"data-kind": gate ? "gate" : "operation",
|
|
30
109
|
children: [
|
|
31
|
-
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-
|
|
32
|
-
/* @__PURE__ */ jsxs("
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
110
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-2", children: [
|
|
111
|
+
/* @__PURE__ */ jsxs("p", { className: "text-muted-foreground flex flex-wrap items-center gap-x-2 text-xs", children: [
|
|
112
|
+
/* @__PURE__ */ jsx(
|
|
113
|
+
Icon,
|
|
114
|
+
{
|
|
115
|
+
name: gate ? "hand" : "pencil-simple",
|
|
116
|
+
className: "h-3.5 w-3.5"
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
gate ? /* @__PURE__ */ jsxs("span", { children: [
|
|
120
|
+
"Approval gate \xB7 ",
|
|
121
|
+
workflowTitle ?? approval.integration,
|
|
122
|
+
" \xB7",
|
|
123
|
+
" ",
|
|
124
|
+
humanizeStepLabel(gate)
|
|
125
|
+
] }) : /* @__PURE__ */ jsxs("span", { children: [
|
|
126
|
+
"Write \xB7 ",
|
|
127
|
+
approval.channel,
|
|
128
|
+
" channel \xB7 ",
|
|
129
|
+
approval.mode
|
|
130
|
+
] })
|
|
36
131
|
] }),
|
|
37
|
-
/* @__PURE__ */
|
|
38
|
-
approval.
|
|
39
|
-
"
|
|
40
|
-
approval.
|
|
132
|
+
gate ? summary ? /* @__PURE__ */ jsx(ProposalText, { text: summary }) : /* @__PURE__ */ jsx("p", { className: "text-sm", children: "This workflow is waiting for your decision." }) : /* @__PURE__ */ jsxs("p", { className: "text-sm font-medium break-all", children: [
|
|
133
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: shortName(approval.integration) }),
|
|
134
|
+
" ",
|
|
135
|
+
/* @__PURE__ */ jsx("code", { children: approvalOperationName(approval.opKey) })
|
|
41
136
|
] }),
|
|
42
|
-
approval.args === void 0 ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
137
|
+
gate || approval.args === void 0 ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
43
138
|
/* @__PURE__ */ jsx(
|
|
44
139
|
Button,
|
|
45
140
|
{
|
|
@@ -50,7 +145,7 @@ function ApprovalCard({
|
|
|
50
145
|
"aria-expanded": open,
|
|
51
146
|
onClick: () => setOpen((value) => !value),
|
|
52
147
|
"data-test": "approval-details-toggle",
|
|
53
|
-
children: open ? "Hide
|
|
148
|
+
children: open ? "Hide arguments" : "Show arguments"
|
|
54
149
|
}
|
|
55
150
|
),
|
|
56
151
|
open ? /* @__PURE__ */ jsxs("div", { className: "min-w-0", "data-test": "approval-details", children: [
|
|
@@ -62,55 +157,182 @@ function ApprovalCard({
|
|
|
62
157
|
] }) : null
|
|
63
158
|
] })
|
|
64
159
|
] }),
|
|
65
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
160
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
66
161
|
/* @__PURE__ */ jsx(
|
|
67
162
|
Button,
|
|
68
163
|
{
|
|
69
164
|
type: "button",
|
|
70
|
-
|
|
165
|
+
size: "sm",
|
|
166
|
+
disabled: busy,
|
|
71
167
|
onClick: () => onDecide("approve"),
|
|
72
168
|
"data-test": "approval-approve",
|
|
73
|
-
children: "Approve"
|
|
169
|
+
children: pending === "approve" ? "Approving\u2026" : "Approve"
|
|
74
170
|
}
|
|
75
171
|
),
|
|
76
172
|
/* @__PURE__ */ jsx(
|
|
77
173
|
Button,
|
|
78
174
|
{
|
|
79
175
|
type: "button",
|
|
176
|
+
size: "sm",
|
|
80
177
|
variant: "outline",
|
|
81
|
-
disabled:
|
|
178
|
+
disabled: busy,
|
|
82
179
|
onClick: () => onDecide("reject"),
|
|
83
180
|
"data-test": "approval-reject",
|
|
84
|
-
children: "Reject"
|
|
181
|
+
children: pending === "reject" ? "Rejecting\u2026" : "Reject"
|
|
85
182
|
}
|
|
86
|
-
)
|
|
183
|
+
),
|
|
184
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: gate ? "Approve lets the run go on; Reject stops it here and writes nothing." : "Approve makes this write; Reject skips it." })
|
|
87
185
|
] })
|
|
88
186
|
]
|
|
89
187
|
}
|
|
90
188
|
);
|
|
91
189
|
}
|
|
92
|
-
|
|
190
|
+
const DECISION_KEY = ["console", "approval-decision"];
|
|
191
|
+
function useApprovalDecision() {
|
|
192
|
+
const client = useConsoleClient();
|
|
193
|
+
const queryClient = useQueryClient();
|
|
194
|
+
return useMutation({
|
|
195
|
+
mutationKey: DECISION_KEY,
|
|
196
|
+
gcTime: 60 * 6e4,
|
|
197
|
+
mutationFn: (input) => client.decideApproval(input.id, input.decision),
|
|
198
|
+
onSettled: () => Promise.all([
|
|
199
|
+
queryClient.invalidateQueries({ queryKey: consoleKeys.runs }),
|
|
200
|
+
queryClient.invalidateQueries({ queryKey: consoleKeys.approvals })
|
|
201
|
+
])
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
function isDecisionInput(value) {
|
|
205
|
+
return typeof value === "object" && value !== null && "id" in value && "decision" in value && "label" in value;
|
|
206
|
+
}
|
|
207
|
+
function decisionOutcome(input) {
|
|
208
|
+
if (input.gate) {
|
|
209
|
+
return input.decision === "approve" ? "The run went on past this gate." : "The run stopped at this gate; nothing was written.";
|
|
210
|
+
}
|
|
211
|
+
return input.decision === "approve" ? "The write was made." : "The write was skipped.";
|
|
212
|
+
}
|
|
213
|
+
function DecisionLog({
|
|
214
|
+
workflowId,
|
|
215
|
+
since = 0,
|
|
216
|
+
limit = 3
|
|
217
|
+
}) {
|
|
218
|
+
const decisions = useMutationState({
|
|
219
|
+
filters: { mutationKey: DECISION_KEY },
|
|
220
|
+
select: (mutation) => ({
|
|
221
|
+
input: mutation.state.variables,
|
|
222
|
+
status: mutation.state.status,
|
|
223
|
+
error: mutation.state.error?.message ?? null,
|
|
224
|
+
at: mutation.state.submittedAt
|
|
225
|
+
})
|
|
226
|
+
});
|
|
227
|
+
const shown = decisions.flatMap(
|
|
228
|
+
(entry) => isDecisionInput(entry.input) && entry.status !== "pending" && entry.status !== "idle" && entry.at >= since && (workflowId === void 0 || entry.input.workflowId === workflowId) ? [{ ...entry, input: entry.input }] : []
|
|
229
|
+
).reverse().slice(0, limit);
|
|
230
|
+
if (shown.length === 0) return null;
|
|
231
|
+
return /* @__PURE__ */ jsx(
|
|
232
|
+
"ul",
|
|
233
|
+
{
|
|
234
|
+
className: "flex flex-col gap-2",
|
|
235
|
+
"aria-live": "polite",
|
|
236
|
+
"data-test": "decision-log",
|
|
237
|
+
children: shown.map(({ input, status, error, at }) => /* @__PURE__ */ jsx(
|
|
238
|
+
Card,
|
|
239
|
+
{
|
|
240
|
+
layout: "bleed",
|
|
241
|
+
render: /* @__PURE__ */ jsx("li", {}),
|
|
242
|
+
className: "flex min-w-0 flex-row flex-wrap items-center gap-x-3 gap-y-1 px-3 py-2 text-sm",
|
|
243
|
+
"data-test": "decision",
|
|
244
|
+
"data-decision": status === "error" ? "error" : input.decision,
|
|
245
|
+
children: status === "error" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
246
|
+
/* @__PURE__ */ jsx(StatusBadge, { tone: "destructive", children: "Not recorded" }),
|
|
247
|
+
/* @__PURE__ */ jsxs("span", { className: "min-w-0", children: [
|
|
248
|
+
"Could not ",
|
|
249
|
+
input.decision,
|
|
250
|
+
" ",
|
|
251
|
+
input.label,
|
|
252
|
+
": ",
|
|
253
|
+
error
|
|
254
|
+
] })
|
|
255
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
256
|
+
/* @__PURE__ */ jsx(
|
|
257
|
+
StatusBadge,
|
|
258
|
+
{
|
|
259
|
+
tone: input.decision === "approve" ? "success" : "neutral",
|
|
260
|
+
children: input.decision === "approve" ? "Approved" : "Rejected"
|
|
261
|
+
}
|
|
262
|
+
),
|
|
263
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 font-medium break-words", children: input.label }),
|
|
264
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: decisionOutcome(input) })
|
|
265
|
+
] })
|
|
266
|
+
},
|
|
267
|
+
`${input.id}-${at}`
|
|
268
|
+
))
|
|
269
|
+
}
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
function ApprovalList({
|
|
273
|
+
approvals,
|
|
274
|
+
workflowTitles = {},
|
|
275
|
+
workflowId
|
|
276
|
+
}) {
|
|
277
|
+
const decide = useApprovalDecision();
|
|
278
|
+
const sending = decide.isPending ? decide.variables : void 0;
|
|
279
|
+
return /* @__PURE__ */ jsx("ul", { className: "flex min-w-0 flex-col gap-3", "data-test": "approval-list", children: approvals.map((approval) => {
|
|
280
|
+
const title = workflowTitles[approval.integration];
|
|
281
|
+
const owner = workflowId ?? (title !== void 0 ? approval.integration : null);
|
|
282
|
+
return /* @__PURE__ */ jsx("li", { className: "min-w-0", children: /* @__PURE__ */ jsx(
|
|
283
|
+
ApprovalCard,
|
|
284
|
+
{
|
|
285
|
+
approval,
|
|
286
|
+
pending: sending ? sending.id === approval.id ? sending.decision : true : null,
|
|
287
|
+
onDecide: (decision) => decide.mutate({
|
|
288
|
+
id: approval.id,
|
|
289
|
+
decision,
|
|
290
|
+
label: approvalLabel(approval, title),
|
|
291
|
+
gate: gateStepId(approval.opKey) !== null,
|
|
292
|
+
...owner ? { workflowId: owner } : {}
|
|
293
|
+
}),
|
|
294
|
+
...title ? { workflowTitle: title } : {}
|
|
295
|
+
}
|
|
296
|
+
) }, approval.id);
|
|
297
|
+
}) });
|
|
298
|
+
}
|
|
299
|
+
function ApprovalsTray({ reviewHref } = {}) {
|
|
93
300
|
const approvals = useApprovals();
|
|
94
|
-
const decide = useDecideApproval();
|
|
95
301
|
const list = approvals.data ?? [];
|
|
96
302
|
if (list.length === 0) return null;
|
|
303
|
+
if (reviewHref) {
|
|
304
|
+
return /* @__PURE__ */ jsxs(
|
|
305
|
+
Link,
|
|
306
|
+
{
|
|
307
|
+
href: reviewHref,
|
|
308
|
+
className: cn(
|
|
309
|
+
"border-warning bg-warning-surface text-warning flex items-center gap-2 rounded-md border px-3 py-2 text-sm font-medium hover:underline",
|
|
310
|
+
FOCUS_RING
|
|
311
|
+
),
|
|
312
|
+
"data-test": "approvals-notice",
|
|
313
|
+
children: [
|
|
314
|
+
/* @__PURE__ */ jsx(Icon, { name: "hand", className: "h-4 w-4" }),
|
|
315
|
+
list.length,
|
|
316
|
+
" approval",
|
|
317
|
+
list.length === 1 ? "" : "s",
|
|
318
|
+
" waiting in the review queue",
|
|
319
|
+
/* @__PURE__ */ jsx(Icon, { name: "arrow-right", className: "ml-auto h-4 w-4" })
|
|
320
|
+
]
|
|
321
|
+
}
|
|
322
|
+
);
|
|
323
|
+
}
|
|
97
324
|
return /* @__PURE__ */ jsxs(Alert, { variant: "warning", className: "*:min-w-0", "data-test": "approvals-tray", children: [
|
|
98
325
|
/* @__PURE__ */ jsx(Icon, { name: "hand", className: "h-4 w-4" }),
|
|
99
326
|
/* @__PURE__ */ jsx(AlertTitle, { "data-test": "approvals-summary", children: approvalsSummary(list) }),
|
|
100
|
-
/* @__PURE__ */ jsx(AlertDescription, { children: /* @__PURE__ */ jsx("div", { className: "mt-2
|
|
101
|
-
ApprovalCard,
|
|
102
|
-
{
|
|
103
|
-
approval,
|
|
104
|
-
pending: decide.isPending,
|
|
105
|
-
onDecide: (decision) => decide.mutate({ id: approval.id, decision })
|
|
106
|
-
},
|
|
107
|
-
approval.id
|
|
108
|
-
)) }) })
|
|
327
|
+
/* @__PURE__ */ jsx(AlertDescription, { children: /* @__PURE__ */ jsx("div", { className: "mt-2 min-w-0", children: /* @__PURE__ */ jsx(ApprovalList, { approvals: list }) }) })
|
|
109
328
|
] });
|
|
110
329
|
}
|
|
111
330
|
export {
|
|
112
331
|
ApprovalCard,
|
|
332
|
+
ApprovalList,
|
|
113
333
|
ApprovalsTray,
|
|
334
|
+
DecisionLog,
|
|
335
|
+
ProposalText,
|
|
114
336
|
approvalOperationName,
|
|
115
337
|
approvalsSummary
|
|
116
338
|
};
|
|
@@ -14,9 +14,10 @@ function ConnectControls({
|
|
|
14
14
|
onChanged
|
|
15
15
|
}) {
|
|
16
16
|
const disconnect = useDisconnect();
|
|
17
|
+
const apiBase = packageApiBase("integration", name);
|
|
17
18
|
const client = useMemo(
|
|
18
|
-
() => createHttpConsoleClient(void 0,
|
|
19
|
-
[
|
|
19
|
+
() => createHttpConsoleClient(void 0, apiBase),
|
|
20
|
+
[apiBase]
|
|
20
21
|
);
|
|
21
22
|
const facts = connection?.facts ?? null;
|
|
22
23
|
if (!connection || !isConnectable(facts)) return null;
|
|
@@ -27,6 +28,7 @@ function ConnectControls({
|
|
|
27
28
|
{
|
|
28
29
|
integration: name,
|
|
29
30
|
client,
|
|
31
|
+
apiBase,
|
|
30
32
|
oauth: connection.type === "oauth",
|
|
31
33
|
returnPath,
|
|
32
34
|
...onChanged ? { onChanged: () => void onChanged() } : {},
|
|
@@ -6,10 +6,17 @@ import { type ConsoleClient } from '../lib/console-client.js';
|
|
|
6
6
|
* that integration package's local credentials through `client`, and tells
|
|
7
7
|
* the page via `onChanged` so the status next to it flips.
|
|
8
8
|
*/
|
|
9
|
-
export declare function ConnectDialog({ integration, client, oauth, returnPath, onChanged, label, connected, }: {
|
|
9
|
+
export declare function ConnectDialog({ integration, client, apiBase, oauth, returnPath, onChanged, label, connected, }: {
|
|
10
10
|
integration: string;
|
|
11
11
|
/** The API that serves this integration's credentials. */
|
|
12
12
|
client: ConsoleClient;
|
|
13
|
+
/**
|
|
14
|
+
* Where `client` is served, when it is not the console this dialog sits in
|
|
15
|
+
* (a repo home row: one package's router). The dialog's own providers
|
|
16
|
+
* read the package's integrations from there, never from a route the repo
|
|
17
|
+
* root does not serve.
|
|
18
|
+
*/
|
|
19
|
+
apiBase?: string;
|
|
13
20
|
oauth?: boolean;
|
|
14
21
|
returnPath?: string;
|
|
15
22
|
onChanged?: () => void;
|
|
@@ -9,12 +9,16 @@ import {
|
|
|
9
9
|
DialogHeader,
|
|
10
10
|
DialogTitle
|
|
11
11
|
} from "@ekanos/ui/dialog";
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
ConsoleProviders,
|
|
14
|
+
useOptionalConsoleClient
|
|
15
|
+
} from "../lib/console-context.js";
|
|
13
16
|
import { useOptionalHarnessRegistry } from "../registry-context.js";
|
|
14
17
|
import { ConnectPanel } from "./connect-panel.js";
|
|
15
18
|
function ConnectDialog({
|
|
16
19
|
integration,
|
|
17
20
|
client,
|
|
21
|
+
apiBase,
|
|
18
22
|
oauth = false,
|
|
19
23
|
returnPath,
|
|
20
24
|
onChanged,
|
|
@@ -22,10 +26,22 @@ function ConnectDialog({
|
|
|
22
26
|
connected = false
|
|
23
27
|
}) {
|
|
24
28
|
const [open, setOpen] = useState(false);
|
|
29
|
+
const ambient = useOptionalConsoleClient();
|
|
25
30
|
const registry = useOptionalHarnessRegistry();
|
|
26
31
|
const activationForm = registry.find(
|
|
27
32
|
(entry) => entry.slug === integration
|
|
28
33
|
)?.activationForm;
|
|
34
|
+
const panel = /* @__PURE__ */ jsx(
|
|
35
|
+
ConnectPanel,
|
|
36
|
+
{
|
|
37
|
+
surface: "dialog",
|
|
38
|
+
integration: { integration },
|
|
39
|
+
oauth,
|
|
40
|
+
...activationForm ? { activationForm } : {},
|
|
41
|
+
...returnPath ? { returnPath } : {},
|
|
42
|
+
...onChanged ? { onChanged } : {}
|
|
43
|
+
}
|
|
44
|
+
);
|
|
29
45
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
30
46
|
/* @__PURE__ */ jsx(
|
|
31
47
|
Button,
|
|
@@ -42,17 +58,14 @@ function ConnectDialog({
|
|
|
42
58
|
/* @__PURE__ */ jsx(DialogTitle, { children: connected ? `Edit ${integration} connection` : `Connect ${integration}` }),
|
|
43
59
|
/* @__PURE__ */ jsx(DialogDescription, { children: "Saved on this machine, in the integration's own folder." })
|
|
44
60
|
] }),
|
|
45
|
-
/* @__PURE__ */ jsx("div", { className: "flex max-h-[70vh] flex-col gap-4 overflow-y-auto", children:
|
|
46
|
-
|
|
61
|
+
/* @__PURE__ */ jsx("div", { className: "flex max-h-[70vh] flex-col gap-4 overflow-y-auto", children: ambient === client ? panel : /* @__PURE__ */ jsx(
|
|
62
|
+
ConsoleProviders,
|
|
47
63
|
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
...activationForm ? { activationForm } : {},
|
|
52
|
-
...returnPath ? { returnPath } : {},
|
|
53
|
-
...onChanged ? { onChanged } : {}
|
|
64
|
+
client,
|
|
65
|
+
...apiBase ? { apiBase } : {},
|
|
66
|
+
children: panel
|
|
54
67
|
}
|
|
55
|
-
) })
|
|
68
|
+
) })
|
|
56
69
|
] }) })
|
|
57
70
|
] });
|
|
58
71
|
}
|
|
@@ -2,8 +2,9 @@ import { type ComponentType } from 'react';
|
|
|
2
2
|
import type { ActivationFormProps } from '@ekanos/sdk';
|
|
3
3
|
import type { ConsoleIntegration } from '../lib/console-types.js';
|
|
4
4
|
/**
|
|
5
|
-
* Keys and OAuth for one integration
|
|
6
|
-
*
|
|
5
|
+
* Keys and OAuth for one integration, as numbered steps: add the keys, then
|
|
6
|
+
* (OAuth) authorize. A registry integration has no credential UI: its
|
|
7
|
+
* connection is managed by Ekanos. Values are write-only: the page shows
|
|
7
8
|
* which keys are set, never what they are.
|
|
8
9
|
*/
|
|
9
10
|
export declare function ConnectPanel({ integration, oauth, activationForm, onChanged, returnPath, surface, }: {
|