@ekanos/harness 0.18.0 → 0.19.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/api-types.d.ts +490 -0
- package/dist/api-types.js +6 -0
- package/dist/api.d.ts +33 -0
- package/dist/api.js +36 -1
- package/dist/app.js +6 -1
- package/dist/internal/components/approvals-tray.d.ts +17 -0
- package/dist/internal/components/approvals-tray.js +116 -0
- package/dist/internal/components/connect-controls.d.ts +12 -0
- package/dist/internal/components/connect-controls.js +69 -0
- package/dist/internal/components/connect-dialog.d.ts +19 -0
- package/dist/internal/components/connect-dialog.js +61 -0
- package/dist/internal/components/connect-panel.d.ts +25 -0
- package/dist/internal/components/connect-panel.js +292 -0
- package/dist/internal/components/connection-chip.d.ts +14 -0
- package/dist/internal/components/connection-chip.js +75 -0
- package/dist/internal/components/dashboard-grid.js +38 -24
- package/dist/internal/components/dev-toolbar.js +176 -103
- package/dist/internal/components/events-panel.d.ts +10 -0
- package/dist/internal/components/events-panel.js +111 -0
- package/dist/internal/components/health-panel.d.ts +4 -0
- package/dist/internal/components/health-panel.js +56 -0
- package/dist/internal/components/integration-badge.d.ts +29 -0
- package/dist/internal/components/integration-badge.js +105 -0
- package/dist/internal/components/local-oauth-panel.js +21 -1
- package/dist/internal/components/operation-runner-panel.d.ts +12 -0
- package/dist/internal/components/operation-runner-panel.js +331 -0
- package/dist/internal/components/provenance-banner.d.ts +12 -0
- package/dist/internal/components/provenance-banner.js +107 -0
- package/dist/internal/components/repo-connection.d.ts +10 -0
- package/dist/internal/components/repo-connection.js +32 -0
- package/dist/internal/components/run-log.d.ts +9 -0
- package/dist/internal/components/run-log.js +228 -0
- package/dist/internal/components/runtime-strip.d.ts +12 -0
- package/dist/internal/components/runtime-strip.js +158 -0
- package/dist/internal/components/schema-form.d.ts +13 -0
- package/dist/internal/components/schema-form.js +382 -0
- package/dist/internal/components/scrollable-nav.d.ts +12 -0
- package/dist/internal/components/scrollable-nav.js +68 -0
- package/dist/internal/components/surface-nav.d.ts +31 -1
- package/dist/internal/components/surface-nav.js +238 -31
- package/dist/internal/components/workflow-runner.d.ts +14 -0
- package/dist/internal/components/workflow-runner.js +104 -0
- package/dist/internal/lib/bundled-secrets.d.ts +9 -0
- package/dist/internal/lib/bundled-secrets.js +24 -0
- package/dist/internal/lib/chrome-slot.d.ts +2 -0
- package/dist/internal/lib/chrome-slot.js +25 -0
- package/dist/internal/lib/connection-facts.d.ts +44 -0
- package/dist/internal/lib/connection-facts.js +116 -0
- package/dist/internal/lib/console-client.d.ts +55 -0
- package/dist/internal/lib/console-client.js +295 -0
- package/dist/internal/lib/console-context.d.ts +40 -0
- package/dist/internal/lib/console-context.js +67 -0
- package/dist/internal/lib/console-hooks.d.ts +33 -0
- package/dist/internal/lib/console-hooks.js +118 -0
- package/dist/internal/lib/console-types.d.ts +279 -0
- package/dist/internal/lib/console-types.js +0 -0
- package/dist/internal/lib/experience-runtime.d.ts +8 -0
- package/dist/internal/lib/experience-runtime.js +22 -0
- package/dist/internal/lib/preview-sections.d.ts +13 -0
- package/dist/internal/lib/preview-sections.js +32 -0
- package/dist/internal/lib/repo-context.d.ts +20 -0
- package/dist/internal/lib/repo-context.js +64 -0
- package/dist/internal/lib/run-log-view.d.ts +24 -0
- package/dist/internal/lib/run-log-view.js +57 -0
- package/dist/internal/lib/schema-form-model.d.ts +34 -0
- package/dist/internal/lib/schema-form-model.js +272 -0
- package/dist/internal/lib/toolbar-context.d.ts +9 -1
- package/dist/internal/lib/toolbar-context.js +13 -3
- package/dist/internal/lib/toolbar-visibility.d.ts +16 -0
- package/dist/internal/lib/toolbar-visibility.js +31 -0
- package/dist/internal/registry-context.d.ts +2 -0
- package/dist/internal/registry-context.js +11 -9
- package/dist/internal/routes/activation-page.js +44 -20
- package/dist/internal/routes/console-home-page.d.ts +5 -0
- package/dist/internal/routes/console-home-page.js +18 -0
- package/dist/internal/routes/experience-connect-page.d.ts +6 -0
- package/dist/internal/routes/experience-connect-page.js +127 -0
- package/dist/internal/routes/experience-page-host.d.ts +2 -0
- package/dist/internal/routes/experience-page-host.js +18 -0
- package/dist/internal/routes/experience-review-queue-page.d.ts +2 -0
- package/dist/internal/routes/experience-review-queue-page.js +60 -0
- package/dist/internal/routes/experience-runs-page.d.ts +1 -0
- package/dist/internal/routes/experience-runs-page.js +13 -0
- package/dist/internal/routes/experience-summary-page.d.ts +1 -0
- package/dist/internal/routes/experience-summary-page.js +101 -0
- package/dist/internal/routes/experience-widget-page.d.ts +1 -0
- package/dist/internal/routes/experience-widget-page.js +26 -0
- package/dist/internal/routes/experience-widgets-page.d.ts +6 -0
- package/dist/internal/routes/experience-widgets-page.js +22 -0
- package/dist/internal/routes/experience-workflow-page.d.ts +1 -0
- package/dist/internal/routes/experience-workflow-page.js +24 -0
- package/dist/internal/routes/experience-workflows-page.d.ts +1 -0
- package/dist/internal/routes/experience-workflows-page.js +44 -0
- package/dist/internal/routes/index-page.d.ts +10 -9
- package/dist/internal/routes/index-page.js +3 -68
- package/dist/internal/routes/integration-layout.d.ts +12 -1
- package/dist/internal/routes/integration-layout.js +20 -6
- package/dist/internal/routes/integrations-connect-page.d.ts +1 -0
- package/dist/internal/routes/integrations-connect-page.js +19 -0
- package/dist/internal/routes/integrations-events-page.d.ts +1 -0
- package/dist/internal/routes/integrations-events-page.js +10 -0
- package/dist/internal/routes/integrations-health-page.d.ts +1 -0
- package/dist/internal/routes/integrations-health-page.js +10 -0
- package/dist/internal/routes/integrations-layout.d.ts +17 -0
- package/dist/internal/routes/integrations-layout.js +106 -0
- package/dist/internal/routes/integrations-list-page.d.ts +2 -0
- package/dist/internal/routes/integrations-list-page.js +94 -0
- package/dist/internal/routes/integrations-operation-page.d.ts +1 -0
- package/dist/internal/routes/integrations-operation-page.js +29 -0
- package/dist/internal/routes/integrations-operations-page.d.ts +1 -0
- package/dist/internal/routes/integrations-operations-page.js +61 -0
- package/dist/internal/routes/integrations-overview-page.d.ts +1 -0
- package/dist/internal/routes/integrations-overview-page.js +90 -0
- package/dist/internal/routes/integrations-runs-page.d.ts +1 -0
- package/dist/internal/routes/integrations-runs-page.js +14 -0
- package/dist/internal/routes/integrations-scope.d.ts +12 -0
- package/dist/internal/routes/integrations-scope.js +39 -0
- package/dist/internal/routes/legacy-preview-redirect.d.ts +6 -0
- package/dist/internal/routes/legacy-preview-redirect.js +12 -0
- package/dist/internal/routes/preview-index-page.d.ts +2 -0
- package/dist/internal/routes/preview-index-page.js +14 -0
- package/dist/internal/routes/repo-connections-page.d.ts +6 -0
- package/dist/internal/routes/repo-connections-page.js +8 -0
- package/dist/internal/routes/repo-home-page.d.ts +2 -0
- package/dist/internal/routes/repo-home-page.js +320 -0
- package/dist/internal/routes/repo-layout.d.ts +7 -0
- package/dist/internal/routes/repo-layout.js +76 -0
- package/dist/internal/routes/repo-package-layouts.d.ts +20 -0
- package/dist/internal/routes/repo-package-layouts.js +104 -0
- package/dist/internal/routes/root-layout.d.ts +3 -1
- package/dist/internal/routes/root-layout.js +13 -3
- package/dist/internal/routes/single-widget-page.js +5 -12
- package/dist/internal/routes/tile-page.js +20 -41
- package/dist/internal/routes/triggers-page.js +55 -62
- package/dist/internal/routes/widgets-page.js +1 -1
- package/dist/internal/server/api-router.js +46 -4
- package/dist/internal/server/approvals.d.ts +44 -0
- package/dist/internal/server/approvals.js +76 -0
- package/dist/internal/server/contract-sources.d.ts +28 -0
- package/dist/internal/server/contract-sources.js +83 -0
- package/dist/internal/server/definition-loader.d.ts +22 -0
- package/dist/internal/server/definition-loader.js +125 -0
- package/dist/internal/server/ekanos-api-router.d.ts +34 -0
- package/dist/internal/server/ekanos-api-router.js +835 -0
- package/dist/internal/server/experience-loader.d.ts +57 -0
- package/dist/internal/server/experience-loader.js +146 -0
- package/dist/internal/server/integration-lookup.d.ts +29 -0
- package/dist/internal/server/integration-lookup.js +33 -0
- package/dist/internal/server/integration-resolver.d.ts +121 -0
- package/dist/internal/server/integration-resolver.js +605 -0
- package/dist/internal/server/live-invoker.d.ts +11 -0
- package/dist/internal/server/live-invoker.js +106 -0
- package/dist/internal/server/local-secrets.d.ts +82 -1
- package/dist/internal/server/local-secrets.js +112 -1
- package/dist/internal/server/local-state.d.ts +12 -0
- package/dist/internal/server/local-state.js +45 -0
- package/dist/internal/server/oauth-persistence.d.ts +19 -0
- package/dist/internal/server/oauth-persistence.js +76 -0
- package/dist/internal/server/operation-runner.d.ts +95 -0
- package/dist/internal/server/operation-runner.js +231 -0
- package/dist/internal/server/project-manifest.d.ts +71 -0
- package/dist/internal/server/project-manifest.js +215 -0
- package/dist/internal/server/registry-cache.d.ts +68 -0
- package/dist/internal/server/registry-cache.js +328 -0
- package/dist/internal/server/repo-api-router.d.ts +33 -0
- package/dist/internal/server/repo-api-router.js +391 -0
- package/dist/internal/server/run-log.d.ts +22 -0
- package/dist/internal/server/run-log.js +32 -0
- package/dist/internal/server/semantics.d.ts +28 -0
- package/dist/internal/server/semantics.js +67 -0
- package/dist/internal/server/session-catalog.d.ts +67 -0
- package/dist/internal/server/session-catalog.js +18 -0
- package/dist/internal/server/workflow-runner.d.ts +36 -0
- package/dist/internal/server/workflow-runner.js +183 -0
- package/dist/registry.d.ts +7 -0
- package/dist/resolver.d.ts +145 -0
- package/dist/resolver.js +211 -0
- package/dist/routes.d.ts +64 -2
- package/dist/routes.js +59 -3
- package/dist/runtime.d.ts +46 -0
- package/dist/runtime.js +60 -0
- package/package.json +23 -9
- package/dist/internal/routes/integration-index-page.d.ts +0 -13
- package/dist/internal/routes/integration-index-page.js +0 -17
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { notFound } from "next/navigation";
|
|
4
|
-
import { Alert, AlertDescription, AlertTitle } from "@ekanos/ui/alert";
|
|
5
4
|
import { Card } from "@ekanos/ui/card";
|
|
6
5
|
import { HARNESS_ACCOUNT_ID } from "../../registry.js";
|
|
7
6
|
import { ViewportFrame } from "../components/viewport-frame.js";
|
|
@@ -22,46 +21,26 @@ function TilePage() {
|
|
|
22
21
|
const integration = useHarnessIntegration();
|
|
23
22
|
if (!integration) notFound();
|
|
24
23
|
const Tile = integration.tile;
|
|
25
|
-
return /* @__PURE__ */ jsxs(
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
/* @__PURE__ */ jsx("h2", { className: "text-foreground heading-subhead-lg", children: "Available integrations" }),
|
|
46
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-meta tabular-nums", children: "3" })
|
|
47
|
-
] }),
|
|
48
|
-
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-meta mt-1 max-w-prose", children: "Your tile in the catalogue grid, with two inert neighbours for scale. Column width, gap and heading come from the real marketplace." })
|
|
49
|
-
] }),
|
|
50
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[repeat(auto-fill,minmax(17rem,1fr))] gap-4", children: [
|
|
51
|
-
/* @__PURE__ */ jsx(
|
|
52
|
-
Tile,
|
|
53
|
-
{
|
|
54
|
-
accountId: HARNESS_ACCOUNT_ID,
|
|
55
|
-
productSlug: integration.slug,
|
|
56
|
-
href: `/${integration.slug}/activation`
|
|
57
|
-
}
|
|
58
|
-
),
|
|
59
|
-
NEIGHBOURS.map((neighbour) => /* @__PURE__ */ jsx(NeighbourCard, { ...neighbour }, neighbour.name))
|
|
60
|
-
] })
|
|
61
|
-
] }) }) : /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-meta", children: "This integration registers no marketplace tile." })
|
|
62
|
-
]
|
|
63
|
-
}
|
|
64
|
-
);
|
|
24
|
+
return /* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-col gap-6", "data-test": "tile", children: Tile ? /* @__PURE__ */ jsx(ViewportFrame, { children: /* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-4", children: [
|
|
25
|
+
/* @__PURE__ */ jsxs("header", { children: [
|
|
26
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-baseline gap-2.5", children: [
|
|
27
|
+
/* @__PURE__ */ jsx("h2", { className: "text-foreground heading-subhead-lg", children: "Available integrations" }),
|
|
28
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-meta tabular-nums", children: "3" })
|
|
29
|
+
] }),
|
|
30
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-meta mt-1 max-w-prose", children: "Your tile in the catalogue grid, with two inert neighbours for scale. Column width, gap and heading come from the real marketplace." })
|
|
31
|
+
] }),
|
|
32
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[repeat(auto-fill,minmax(17rem,1fr))] gap-4", children: [
|
|
33
|
+
/* @__PURE__ */ jsx(
|
|
34
|
+
Tile,
|
|
35
|
+
{
|
|
36
|
+
accountId: HARNESS_ACCOUNT_ID,
|
|
37
|
+
productSlug: integration.slug,
|
|
38
|
+
href: `/integrations/${integration.slug}/preview/activation`
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
NEIGHBOURS.map((neighbour) => /* @__PURE__ */ jsx(NeighbourCard, { ...neighbour }, neighbour.name))
|
|
42
|
+
] })
|
|
43
|
+
] }) }) : /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-meta", children: "This integration registers no marketplace tile." }) });
|
|
65
44
|
}
|
|
66
45
|
function NeighbourCard({
|
|
67
46
|
name,
|
|
@@ -430,71 +430,64 @@ function TriggersPage() {
|
|
|
430
430
|
const webhooks = definition?.webhooks ?? [];
|
|
431
431
|
const schedules = definition?.schedules ?? [];
|
|
432
432
|
const declaresAnything = webhooks.length > 0 || schedules.length > 0 || Boolean(definition?.oauth) || (definition?.agentEvents?.length ?? 0) > 0;
|
|
433
|
-
return /* @__PURE__ */ jsxs(
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
/* @__PURE__ */ jsxs(AlertDescription, { children: [
|
|
442
|
-
/* @__PURE__ */ jsxs("p", { children: [
|
|
443
|
-
"Webhooks and schedules below run their REAL handlers against one context whose state accumulates like a real account's. Payloads are validated against each webhook's ",
|
|
444
|
-
/* @__PURE__ */ jsx("code", { children: "payloadSchema" }),
|
|
445
|
-
", signature checks are logged as skipped, and egress is enforced from the definition \u2014 the same declarations the host's ingress, scheduler, and hosted OAuth callback bind to later."
|
|
446
|
-
] }),
|
|
447
|
-
/* @__PURE__ */ jsx("p", { "data-test": "triggers-mode-notice", children: mode === "live" ? "Live API: handlers run on the dev server, against the context the OAuth loop stored tokens in, with ctx.fetch reaching your vendor under the declared egress." : "Fixtures: handlers run in this browser against an in-memory context seeded from triggerMocks; ctx.fetch answers from your fixtures and never touches the network." }),
|
|
448
|
-
/* @__PURE__ */ jsxs("p", { children: [
|
|
449
|
-
"Widgets on this integration reach real vendors through",
|
|
450
|
-
" ",
|
|
451
|
-
/* @__PURE__ */ jsx("code", { children: "useIntegrationFetch()" }),
|
|
452
|
-
" in Live API too \u2014 browser-side, with the egress check as a convenience rather than a guarantee. The host runs these same declarations, with real enforcement, after you publish."
|
|
453
|
-
] })
|
|
454
|
-
] })
|
|
433
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex max-w-3xl min-w-0 flex-col gap-6", "data-test": "triggers", children: [
|
|
434
|
+
/* @__PURE__ */ jsxs(Alert, { children: [
|
|
435
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: "The local transport for declared event surfaces" }),
|
|
436
|
+
/* @__PURE__ */ jsxs(AlertDescription, { children: [
|
|
437
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
438
|
+
"Webhooks and schedules below run their REAL handlers against one context whose state accumulates like a real account's. Payloads are validated against each webhook's ",
|
|
439
|
+
/* @__PURE__ */ jsx("code", { children: "payloadSchema" }),
|
|
440
|
+
", signature checks are logged as skipped, and egress is enforced from the definition \u2014 the same declarations the host's ingress, scheduler, and hosted OAuth callback bind to later."
|
|
455
441
|
] }),
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
442
|
+
/* @__PURE__ */ jsx("p", { "data-test": "triggers-mode-notice", children: mode === "live" ? "Live API: handlers run on the dev server, against the context the OAuth loop stored tokens in, with ctx.fetch reaching your vendor under the declared egress." : "Fixtures: handlers run in this browser against an in-memory context seeded from triggerMocks; ctx.fetch answers from your fixtures and never touches the network." }),
|
|
443
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
444
|
+
"Widgets on this integration reach real vendors through",
|
|
459
445
|
" ",
|
|
460
|
-
"
|
|
461
|
-
|
|
462
|
-
" to the entry in your harness config to light this surface up."
|
|
463
|
-
] }) : !declaresAnything ? /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground text-meta", children: [
|
|
464
|
-
/* @__PURE__ */ jsx("code", { children: definition.slug }),
|
|
465
|
-
" declares no webhooks, schedules, or OAuth \u2014 which is a perfectly good answer for an integration that only reads. The ",
|
|
466
|
-
/* @__PURE__ */ jsx("code", { children: "@ekanos/sdk" }),
|
|
467
|
-
" README has a worked example of each, under \u201CDeclarable surfaces\u201D."
|
|
468
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
469
|
-
runner ? webhooks.map((webhook) => /* @__PURE__ */ jsx(
|
|
470
|
-
WebhookCard,
|
|
471
|
-
{
|
|
472
|
-
webhook,
|
|
473
|
-
runner
|
|
474
|
-
},
|
|
475
|
-
webhook.id
|
|
476
|
-
)) : null,
|
|
477
|
-
runner ? schedules.map((schedule) => /* @__PURE__ */ jsx(
|
|
478
|
-
ScheduleCard,
|
|
479
|
-
{
|
|
480
|
-
schedule,
|
|
481
|
-
runner
|
|
482
|
-
},
|
|
483
|
-
schedule.id
|
|
484
|
-
)) : null,
|
|
485
|
-
/* @__PURE__ */ jsx(
|
|
486
|
-
OAuthCard,
|
|
487
|
-
{
|
|
488
|
-
integration,
|
|
489
|
-
definition,
|
|
490
|
-
mode
|
|
491
|
-
}
|
|
492
|
-
),
|
|
493
|
-
/* @__PURE__ */ jsx(AgentEventsCard, { definition })
|
|
446
|
+
/* @__PURE__ */ jsx("code", { children: "useIntegrationFetch()" }),
|
|
447
|
+
" in Live API too \u2014 browser-side, with the egress check as a convenience rather than a guarantee. The host runs these same declarations, with real enforcement, after you publish."
|
|
494
448
|
] })
|
|
495
|
-
]
|
|
496
|
-
}
|
|
497
|
-
|
|
449
|
+
] })
|
|
450
|
+
] }),
|
|
451
|
+
!definition ? /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground text-meta", children: [
|
|
452
|
+
"This harness entry does not link its ",
|
|
453
|
+
/* @__PURE__ */ jsx("code", { children: "defineIntegration()" }),
|
|
454
|
+
" ",
|
|
455
|
+
"output. Add ",
|
|
456
|
+
/* @__PURE__ */ jsx("code", { children: "definition: integration" }),
|
|
457
|
+
" to the entry in your harness config to light this surface up."
|
|
458
|
+
] }) : !declaresAnything ? /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground text-meta", children: [
|
|
459
|
+
/* @__PURE__ */ jsx("code", { children: definition.slug }),
|
|
460
|
+
" declares no webhooks, schedules, or OAuth \u2014 which is a perfectly good answer for an integration that only reads. The ",
|
|
461
|
+
/* @__PURE__ */ jsx("code", { children: "@ekanos/sdk" }),
|
|
462
|
+
" README has a worked example of each, under \u201CDeclarable surfaces\u201D."
|
|
463
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
464
|
+
runner ? webhooks.map((webhook) => /* @__PURE__ */ jsx(
|
|
465
|
+
WebhookCard,
|
|
466
|
+
{
|
|
467
|
+
webhook,
|
|
468
|
+
runner
|
|
469
|
+
},
|
|
470
|
+
webhook.id
|
|
471
|
+
)) : null,
|
|
472
|
+
runner ? schedules.map((schedule) => /* @__PURE__ */ jsx(
|
|
473
|
+
ScheduleCard,
|
|
474
|
+
{
|
|
475
|
+
schedule,
|
|
476
|
+
runner
|
|
477
|
+
},
|
|
478
|
+
schedule.id
|
|
479
|
+
)) : null,
|
|
480
|
+
/* @__PURE__ */ jsx(
|
|
481
|
+
OAuthCard,
|
|
482
|
+
{
|
|
483
|
+
integration,
|
|
484
|
+
definition,
|
|
485
|
+
mode
|
|
486
|
+
}
|
|
487
|
+
),
|
|
488
|
+
/* @__PURE__ */ jsx(AgentEventsCard, { definition })
|
|
489
|
+
] })
|
|
490
|
+
] });
|
|
498
491
|
}
|
|
499
492
|
export {
|
|
500
493
|
TriggersPage
|
|
@@ -6,7 +6,7 @@ import { useHarnessIntegration } from "../registry-context.js";
|
|
|
6
6
|
function WidgetsPage() {
|
|
7
7
|
const integration = useHarnessIntegration();
|
|
8
8
|
if (!integration) notFound();
|
|
9
|
-
return /* @__PURE__ */ jsx("
|
|
9
|
+
return /* @__PURE__ */ jsx("div", { className: "min-w-0", "data-test": "widgets", children: integration.widgets.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-meta", children: "This integration registers no widgets." }) : /* @__PURE__ */ jsx(
|
|
10
10
|
WidgetSurface,
|
|
11
11
|
{
|
|
12
12
|
widgets: integration.widgets,
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
isTriggerRequest
|
|
20
20
|
} from "../lib/trigger-contract.js";
|
|
21
21
|
import { getFixturesActionsState } from "./actions-fixtures-context.js";
|
|
22
|
+
import { lookupIntegrationIntegration } from "./integration-lookup.js";
|
|
22
23
|
import {
|
|
23
24
|
WARMUP_BUDGET_MS,
|
|
24
25
|
getLiveState,
|
|
@@ -42,6 +43,10 @@ import {
|
|
|
42
43
|
safeReturnPath,
|
|
43
44
|
successRedirectUrl
|
|
44
45
|
} from "./oauth-loop.js";
|
|
46
|
+
import {
|
|
47
|
+
persistOauthConnection,
|
|
48
|
+
restoreOauthConnections
|
|
49
|
+
} from "./oauth-persistence.js";
|
|
45
50
|
import { resolveProjectRoot } from "./project-root.js";
|
|
46
51
|
import { parseStorageQuery, readClientReadableStorage } from "./storage-read.js";
|
|
47
52
|
function asSafeParseSchema(schema) {
|
|
@@ -112,7 +117,18 @@ function createHarnessApiRouter(registry, deps = {}) {
|
|
|
112
117
|
{ status: 405, headers: { allow: route.methods.join(", ") } }
|
|
113
118
|
);
|
|
114
119
|
}
|
|
115
|
-
const
|
|
120
|
+
const registered = findIntegration([...registry], params.slug);
|
|
121
|
+
const looked = await lookupIntegrationIntegration(params.slug).catch(
|
|
122
|
+
(error) => {
|
|
123
|
+
console.error(
|
|
124
|
+
`[harness:${params.slug}] integration lookup failed`,
|
|
125
|
+
error
|
|
126
|
+
);
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
const fromIntegration = registered ? null : looked;
|
|
131
|
+
const integration = registered ?? fromIntegration?.integration;
|
|
116
132
|
if (!integration) {
|
|
117
133
|
return json(
|
|
118
134
|
{
|
|
@@ -123,7 +139,7 @@ function createHarnessApiRouter(registry, deps = {}) {
|
|
|
123
139
|
{ status: 404 }
|
|
124
140
|
);
|
|
125
141
|
}
|
|
126
|
-
const definition = integration.definition;
|
|
142
|
+
const definition = fromIntegration?.definition ?? integration.definition;
|
|
127
143
|
if (!definition) {
|
|
128
144
|
return json(
|
|
129
145
|
{
|
|
@@ -134,7 +150,7 @@ function createHarnessApiRouter(registry, deps = {}) {
|
|
|
134
150
|
{ status: 404 }
|
|
135
151
|
);
|
|
136
152
|
}
|
|
137
|
-
const root = resolveProjectRoot({ env, cwd });
|
|
153
|
+
const root = looked ? { ok: true, root: looked.projectRoot } : resolveProjectRoot({ env, cwd });
|
|
138
154
|
if (!root.ok) {
|
|
139
155
|
return json(
|
|
140
156
|
{
|
|
@@ -168,6 +184,12 @@ function createHarnessApiRouter(registry, deps = {}) {
|
|
|
168
184
|
accountSecrets: secrets.activation,
|
|
169
185
|
secretsFingerprint: secrets.fingerprint
|
|
170
186
|
});
|
|
187
|
+
await restoreOauthConnections({
|
|
188
|
+
state,
|
|
189
|
+
definition,
|
|
190
|
+
projectRoot: root.root,
|
|
191
|
+
adminSecrets: secrets.values
|
|
192
|
+
});
|
|
171
193
|
const url = new URL(request.url);
|
|
172
194
|
return route.handle({
|
|
173
195
|
request,
|
|
@@ -322,6 +344,14 @@ async function oauthCallback(ctx) {
|
|
|
322
344
|
};
|
|
323
345
|
if (connectionId === DEFAULT_OAUTH_CONNECTION_ID) ctx.state.connection = fact;
|
|
324
346
|
else ctx.state.connections[connectionId] = fact;
|
|
347
|
+
persistOauthConnection({
|
|
348
|
+
projectRoot: ctx.projectRoot,
|
|
349
|
+
slug: ctx.slug,
|
|
350
|
+
connectionId,
|
|
351
|
+
clientId: credentials.clientId,
|
|
352
|
+
tokens: exchange.tokens,
|
|
353
|
+
fact
|
|
354
|
+
});
|
|
325
355
|
return redirect(successRedirectUrl({ origin: ctx.origin, returnPath }));
|
|
326
356
|
}
|
|
327
357
|
function oauthStatus(ctx) {
|
|
@@ -628,6 +658,12 @@ async function localSetup(ctx) {
|
|
|
628
658
|
accountSecrets: reread.activation,
|
|
629
659
|
secretsFingerprint: reread.fingerprint
|
|
630
660
|
});
|
|
661
|
+
await restoreOauthConnections({
|
|
662
|
+
state,
|
|
663
|
+
definition: ctx.definition,
|
|
664
|
+
projectRoot: ctx.projectRoot,
|
|
665
|
+
adminSecrets: reread.values
|
|
666
|
+
});
|
|
631
667
|
return json(localSetupResponse(ctx, reread, state.connection !== null));
|
|
632
668
|
}
|
|
633
669
|
async function activation(ctx) {
|
|
@@ -686,13 +722,19 @@ async function activation(ctx) {
|
|
|
686
722
|
}
|
|
687
723
|
ctx.state.secretsFingerprint = reread.fingerprint;
|
|
688
724
|
}
|
|
689
|
-
getLiveState({
|
|
725
|
+
const rebuilt = getLiveState({
|
|
690
726
|
integration: ctx.integration,
|
|
691
727
|
definition: ctx.definition,
|
|
692
728
|
adminSecrets: reread.values,
|
|
693
729
|
accountSecrets: reread.activation,
|
|
694
730
|
secretsFingerprint: reread.fingerprint
|
|
695
731
|
});
|
|
732
|
+
await restoreOauthConnections({
|
|
733
|
+
state: rebuilt,
|
|
734
|
+
definition: ctx.definition,
|
|
735
|
+
projectRoot: ctx.projectRoot,
|
|
736
|
+
adminSecrets: reread.values
|
|
737
|
+
});
|
|
696
738
|
return json({ success: true, names: Object.keys(reread.activation).sort() });
|
|
697
739
|
}
|
|
698
740
|
export {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ApprovalView, ExecutionChannel, RunMode, IntegrationProvenance } from '../../api-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The approvals tray. A write on an approval-gated channel does not run until
|
|
4
|
+
* a person decides here; the calling request is HELD (a promise) until the
|
|
5
|
+
* decision, so a widget's `mutate()` simply resolves late. A decision that
|
|
6
|
+
* never comes expires the approval and the call is refused
|
|
7
|
+
* `write_not_approved`.
|
|
8
|
+
*
|
|
9
|
+
* Two kinds: an `operation` approval gates one call (its args hash is shown so
|
|
10
|
+
* the same payload is recognisable); a `gate` approval is a workflow
|
|
11
|
+
* `approval_gate` step, whose approval lets the writes downstream of it run.
|
|
12
|
+
*/
|
|
13
|
+
export declare const DEFAULT_APPROVAL_TIMEOUT_MS: number;
|
|
14
|
+
export type ApprovalDecision = 'approved' | 'rejected' | 'expired';
|
|
15
|
+
export interface NewOperationApproval {
|
|
16
|
+
kind: 'operation';
|
|
17
|
+
integration: string;
|
|
18
|
+
version: string;
|
|
19
|
+
opKey: string;
|
|
20
|
+
channel: ExecutionChannel;
|
|
21
|
+
mode: RunMode;
|
|
22
|
+
args: unknown;
|
|
23
|
+
provenance: IntegrationProvenance;
|
|
24
|
+
}
|
|
25
|
+
export interface NewGateApproval {
|
|
26
|
+
kind: 'gate';
|
|
27
|
+
summary: string;
|
|
28
|
+
workflowId: string;
|
|
29
|
+
stepId: string;
|
|
30
|
+
}
|
|
31
|
+
export interface ApprovalsTray {
|
|
32
|
+
/** Register a pending approval; resolves with the human's decision. */
|
|
33
|
+
request(input: NewOperationApproval | NewGateApproval, timeoutMs?: number): {
|
|
34
|
+
id: string;
|
|
35
|
+
decision: Promise<ApprovalDecision>;
|
|
36
|
+
};
|
|
37
|
+
decide(id: string, decision: 'approve' | 'reject'): ApprovalView | null;
|
|
38
|
+
list(): ApprovalView[];
|
|
39
|
+
get(id: string): ApprovalView | null;
|
|
40
|
+
}
|
|
41
|
+
export declare function createApprovalsTray(options?: {
|
|
42
|
+
now?: () => Date;
|
|
43
|
+
defaultTimeoutMs?: number;
|
|
44
|
+
}): ApprovalsTray;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { canonicalJson, sha256Hex } from "@ekanos/integration-schema";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
|
+
import { redactSensitive } from "../lib/redact.js";
|
|
4
|
+
const DEFAULT_APPROVAL_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
5
|
+
function createApprovalsTray(options = {}) {
|
|
6
|
+
const now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
7
|
+
const defaultTimeout = options.defaultTimeoutMs ?? DEFAULT_APPROVAL_TIMEOUT_MS;
|
|
8
|
+
const entries = /* @__PURE__ */ new Map();
|
|
9
|
+
function finish(entry, status) {
|
|
10
|
+
if (entry.view.status !== "pending") return;
|
|
11
|
+
clearTimeout(entry.timer);
|
|
12
|
+
entry.view = {
|
|
13
|
+
...entry.view,
|
|
14
|
+
status,
|
|
15
|
+
decidedAt: now().toISOString()
|
|
16
|
+
};
|
|
17
|
+
entry.settle(status);
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
request(input, timeoutMs = defaultTimeout) {
|
|
21
|
+
const id = randomUUID();
|
|
22
|
+
let settle;
|
|
23
|
+
const decision = new Promise((resolve) => {
|
|
24
|
+
settle = resolve;
|
|
25
|
+
});
|
|
26
|
+
const base = {
|
|
27
|
+
id,
|
|
28
|
+
createdAt: now().toISOString(),
|
|
29
|
+
status: "pending"
|
|
30
|
+
};
|
|
31
|
+
const view = input.kind === "operation" ? {
|
|
32
|
+
...base,
|
|
33
|
+
kind: "operation",
|
|
34
|
+
integration: input.integration,
|
|
35
|
+
version: input.version,
|
|
36
|
+
opKey: input.opKey,
|
|
37
|
+
channel: input.channel,
|
|
38
|
+
mode: input.mode,
|
|
39
|
+
argsHash: sha256Hex(canonicalJson(input.args ?? {})),
|
|
40
|
+
args: redactSensitive(input.args ?? {}),
|
|
41
|
+
provenance: input.provenance
|
|
42
|
+
} : {
|
|
43
|
+
...base,
|
|
44
|
+
kind: "gate",
|
|
45
|
+
summary: input.summary,
|
|
46
|
+
workflowId: input.workflowId,
|
|
47
|
+
stepId: input.stepId
|
|
48
|
+
};
|
|
49
|
+
const entry = {
|
|
50
|
+
view,
|
|
51
|
+
settle,
|
|
52
|
+
decision,
|
|
53
|
+
timer: setTimeout(() => finish(entry, "expired"), timeoutMs)
|
|
54
|
+
};
|
|
55
|
+
entry.timer.unref?.();
|
|
56
|
+
entries.set(id, entry);
|
|
57
|
+
return { id, decision };
|
|
58
|
+
},
|
|
59
|
+
decide(id, decision) {
|
|
60
|
+
const entry = entries.get(id);
|
|
61
|
+
if (!entry) return null;
|
|
62
|
+
finish(entry, decision === "approve" ? "approved" : "rejected");
|
|
63
|
+
return entry.view;
|
|
64
|
+
},
|
|
65
|
+
list() {
|
|
66
|
+
return [...entries.values()].map((entry) => entry.view);
|
|
67
|
+
},
|
|
68
|
+
get(id) {
|
|
69
|
+
return entries.get(id)?.view ?? null;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export {
|
|
74
|
+
DEFAULT_APPROVAL_TIMEOUT_MS,
|
|
75
|
+
createApprovalsTray
|
|
76
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type Contract } from '@ekanos/integration-schema';
|
|
2
|
+
/**
|
|
3
|
+
* Where an integration's contract can come from, one function per source. The
|
|
4
|
+
* resolver (`integration-resolver.ts`) decides the order; nothing here executes
|
|
5
|
+
* integration code.
|
|
6
|
+
*/
|
|
7
|
+
export interface LoadedContract {
|
|
8
|
+
contract: Contract;
|
|
9
|
+
file: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class ContractFileError extends Error {
|
|
12
|
+
readonly file: string;
|
|
13
|
+
constructor(file: string, message: string);
|
|
14
|
+
}
|
|
15
|
+
/** Read and fully verify one contract file. Throws on anything inadmissible. */
|
|
16
|
+
export declare function readContractFile(file: string): Contract;
|
|
17
|
+
/**
|
|
18
|
+
* Every contract in `dir` for `integration`. Two spellings are read: the
|
|
19
|
+
* monorepo registry's `<integration>.contract.json` and the experience
|
|
20
|
+
* snapshot's `<integration>@<line>.contract.json`. A file that fails
|
|
21
|
+
* verification throws — a corrupt registry must not look like "absent".
|
|
22
|
+
*/
|
|
23
|
+
export declare function listContractsInDir(dir: string, integration: string): LoadedContract[];
|
|
24
|
+
/** Highest contractVersion within `line`, or null when the line is absent. */
|
|
25
|
+
export declare function pickLine(candidates: readonly LoadedContract[], line: string): LoadedContract | null;
|
|
26
|
+
export declare function availableLines(candidates: readonly LoadedContract[]): string[];
|
|
27
|
+
/** A package's shipped `contract.json`, or null when it ships none. */
|
|
28
|
+
export declare function readShippedContract(packageDir: string): LoadedContract | null;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import {
|
|
2
|
+
compareSemver,
|
|
3
|
+
verifyContract
|
|
4
|
+
} from "@ekanos/integration-schema";
|
|
5
|
+
import * as fs from "node:fs";
|
|
6
|
+
import * as path from "node:path";
|
|
7
|
+
class ContractFileError extends Error {
|
|
8
|
+
constructor(file, message) {
|
|
9
|
+
super(`${file}: ${message}`);
|
|
10
|
+
this.file = file;
|
|
11
|
+
this.name = "ContractFileError";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function readContractFile(file) {
|
|
15
|
+
let parsed;
|
|
16
|
+
try {
|
|
17
|
+
parsed = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
18
|
+
} catch (error) {
|
|
19
|
+
throw new ContractFileError(
|
|
20
|
+
file,
|
|
21
|
+
`cannot be read as JSON (${error instanceof Error ? error.message : String(error)}).`
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
const verified = verifyContract(parsed);
|
|
25
|
+
if (!verified.contract || verified.problems.length > 0) {
|
|
26
|
+
const first = verified.problems[0];
|
|
27
|
+
throw new ContractFileError(
|
|
28
|
+
file,
|
|
29
|
+
`failed contract verification: ${first ? `${first.rule}: ${first.message}` : "unknown problem"}.`
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
return verified.contract;
|
|
33
|
+
}
|
|
34
|
+
function listContractsInDir(dir, integration) {
|
|
35
|
+
let names;
|
|
36
|
+
try {
|
|
37
|
+
names = fs.readdirSync(dir);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
if (error.code === "ENOENT") return [];
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
const out = [];
|
|
43
|
+
for (const name of names.sort()) {
|
|
44
|
+
const match = /^([a-z][a-z0-9-]*)(?:@(\d+(?:\.\d+)?))?\.contract\.json$/.exec(name);
|
|
45
|
+
if (!match || match[1] !== integration) continue;
|
|
46
|
+
const file = path.join(dir, name);
|
|
47
|
+
const contract = readContractFile(file);
|
|
48
|
+
if (contract.integration !== integration) {
|
|
49
|
+
throw new ContractFileError(
|
|
50
|
+
file,
|
|
51
|
+
`declares integration "${contract.integration}", not "${integration}".`
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
out.push({ contract, file });
|
|
55
|
+
}
|
|
56
|
+
return out;
|
|
57
|
+
}
|
|
58
|
+
function pickLine(candidates, line) {
|
|
59
|
+
const inLine = candidates.filter((c) => c.contract.compatLine === line);
|
|
60
|
+
if (inLine.length === 0) return null;
|
|
61
|
+
return inLine.reduce(
|
|
62
|
+
(best, next) => compareSemver(
|
|
63
|
+
next.contract.contractVersion,
|
|
64
|
+
best.contract.contractVersion
|
|
65
|
+
) > 0 ? next : best
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
function availableLines(candidates) {
|
|
69
|
+
return [...new Set(candidates.map((c) => c.contract.compatLine))].sort();
|
|
70
|
+
}
|
|
71
|
+
function readShippedContract(packageDir) {
|
|
72
|
+
const file = path.join(packageDir, "contract.json");
|
|
73
|
+
if (!fs.existsSync(file)) return null;
|
|
74
|
+
return { contract: readContractFile(file), file };
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
ContractFileError,
|
|
78
|
+
availableLines,
|
|
79
|
+
listContractsInDir,
|
|
80
|
+
pickLine,
|
|
81
|
+
readContractFile,
|
|
82
|
+
readShippedContract
|
|
83
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { IntegrationDefinition } from '@ekanos/sdk/integration';
|
|
2
|
+
/**
|
|
3
|
+
* Load an integration's `defineIntegration()` result from another directory,
|
|
4
|
+
* without the experience's bundler being involved.
|
|
5
|
+
*
|
|
6
|
+
* - From SOURCE (a local override): esbuild-bundle the entry named by that
|
|
7
|
+
* project's `ekanos.json`, externalising `@ekanos/*` so they resolve from
|
|
8
|
+
* THAT project's `node_modules`, then import the scratch file.
|
|
9
|
+
* - From a PUBLISHED package (the O1 cache): import its compiled entry.
|
|
10
|
+
*
|
|
11
|
+
* esbuild is resolved from the integration project itself (`@ekanos/cli`
|
|
12
|
+
* brings it); the harness declares no dependency on it.
|
|
13
|
+
*/
|
|
14
|
+
export type DefinitionLoader = (directory: string) => Promise<IntegrationDefinition>;
|
|
15
|
+
/**
|
|
16
|
+
* esbuild-bundle `<directory>/<entry>` and import the result, returning the
|
|
17
|
+
* module namespace. `@ekanos/*`, react and zod stay external so they resolve
|
|
18
|
+
* from THAT project's `node_modules`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function importEntryFromSource(directory: string, entry: string): Promise<Record<string, unknown>>;
|
|
21
|
+
export declare const loadDefinitionFromSource: DefinitionLoader;
|
|
22
|
+
export declare const loadDefinitionFromPackage: DefinitionLoader;
|