@ekanos/harness 0.2.0 → 0.4.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.
Files changed (33) hide show
  1. package/README.md +74 -6
  2. package/dist/app.js +2 -2
  3. package/dist/internal/components/harness-providers.d.ts +8 -2
  4. package/dist/internal/components/harness-providers.js +3 -1
  5. package/dist/internal/components/harness-widget-provider.d.ts +1 -1
  6. package/dist/internal/components/i18n-provider.d.ts +3 -3
  7. package/dist/internal/components/i18n-provider.js +3 -3
  8. package/dist/internal/components/viewport-frame.js +2 -2
  9. package/dist/internal/components/widget-boundary.d.ts +1 -1
  10. package/dist/internal/components/widget-surface.js +2 -0
  11. package/dist/internal/lib/actions-transport.d.ts +30 -0
  12. package/dist/internal/lib/actions-transport.js +6 -0
  13. package/dist/internal/lib/harness-fetch-interceptor.d.ts +20 -1
  14. package/dist/internal/lib/harness-fetch-interceptor.js +87 -1
  15. package/dist/internal/lib/harness-live-fetch.d.ts +1 -1
  16. package/dist/internal/lib/harness-query-client.d.ts +1 -1
  17. package/dist/internal/lib/toolbar-context.d.ts +4 -4
  18. package/dist/internal/routes/activation-page.js +2 -2
  19. package/dist/internal/routes/index-page.js +1 -1
  20. package/dist/internal/routes/integration-layout.js +1 -0
  21. package/dist/internal/routes/root-layout.js +1 -1
  22. package/dist/internal/routes/triggers-page.js +24 -4
  23. package/dist/internal/server/actions-fixtures-context.d.ts +57 -0
  24. package/dist/internal/server/actions-fixtures-context.js +56 -0
  25. package/dist/internal/server/api-router.d.ts +14 -2
  26. package/dist/internal/server/api-router.js +116 -3
  27. package/dist/internal/server/oauth-loop.d.ts +1 -1
  28. package/dist/internal/server/storage-read.d.ts +1 -1
  29. package/dist/registry.d.ts +7 -7
  30. package/dist/styles.css +2 -2
  31. package/package.json +36 -42
  32. package/dist/internal/lib/i18n.d.ts +0 -2
  33. package/dist/internal/lib/i18n.js +0 -17
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # @ekanos/harness
2
2
 
3
3
  The Ekanos integration dev harness: every surface of an integration rendered in
4
- real Fusion chrome — the actual dashboard grid, the actual `Widget.*` compound
4
+ real Ekanos chrome — the actual dashboard grid, the actual `Widget.*` compound
5
5
  components, the actual design tokens — from fixtures, with no Supabase, no auth
6
6
  and no network.
7
7
 
@@ -589,7 +589,7 @@ on it to write a fixture.
589
589
 
590
590
  ## Live mode — real requests to your own API
591
591
 
592
- The harness mocks Fusion, not your vendor. Declare a `live` block and the
592
+ The harness mocks Ekanos, not your vendor. Declare a `live` block and the
593
593
  toolbar grows a fixtures ⇄ live switch: in live mode the harness stops seeding
594
594
  your data keys, your widgets' own query functions run, and their requests reach
595
595
  the real API. There is still no Supabase, no auth and no server actions in
@@ -642,11 +642,11 @@ work to do. A definition declaring more than live mode exercises is fine; the
642
642
  reverse is the fault, and while it stands the harness forces fixtures mode and
643
643
  says so on the surface.
644
644
 
645
- **`seeds` are the keys that stay mocked in live mode.** Fusion-side state your
645
+ **`seeds` are the keys that stay mocked in live mode.** Ekanos-side state your
646
646
  widgets read before they can call anything: a saved location, an account
647
647
  preference, whatever your own host route would have returned. Everything not
648
648
  listed runs its real query function. That one line is the whole boundary the
649
- design draws: Fusion mocked, vendor real.
649
+ design draws: Ekanos mocked, vendor real.
650
650
 
651
651
  An integration with no `live` block is fixtures-only; the toolbar control is
652
652
  disabled for it and says why. One WITH a `live` block still opens in fixtures
@@ -938,7 +938,7 @@ oauth: { connected: { empty: false } }, // show the Connect prompt on `empty`
938
938
 
939
939
  The mock context is derived from the definition — slug, storage schemas, egress
940
940
  — and from your `fixtures`, which answer `ctx.fetch` here exactly as they answer
941
- a widget. `triggerMocks` supplies the rest: whatever Fusion-side state your
941
+ a widget. `triggerMocks` supplies the rest: whatever Ekanos-side state your
942
942
  handlers need to run a happy path.
943
943
 
944
944
  **So do not re-author your vendor payloads as `fetchHandlers`.** That was the
@@ -980,6 +980,74 @@ triggerMocks: {
980
980
  There is no Supabase and no network in here either way. Keep the values fake —
981
981
  see the bundle note below.
982
982
 
983
+ ## Actions — invoking declared server handlers from a widget
984
+
985
+ `useIntegrationAction()` (`@ekanos/sdk/hooks`) is the write counterpart to
986
+ `useIntegrationFetch()`/`fetchIntegrationStorage()`: a widget's Save button
987
+ posts the user's own typed values straight to a declared `actions[name]`
988
+ handler — deterministic, no assistant, no natural-language round trip.
989
+ Unlike a widget's read path, there is no client-side mock to short-circuit —
990
+ the hook always makes a real `fetch()` — so the harness answers
991
+ `POST /api/integrations/<slug>/actions/<actionName>` itself, in BOTH modes,
992
+ over the same local API router that already serves storage, OAuth, webhooks
993
+ and schedules (`createHarnessApiHandlers`). What differs between modes is
994
+ which context resolves the call, exactly as it does for Triggers above:
995
+
996
+ - **Fixtures (default).** The route validates the posted input against the
997
+ action's declared `input` schema exactly like production, then runs
998
+ `handler(ctx, input)` against one `createMockContext()` — the identical
999
+ mechanism `invokeWebhook`/`invokeSchedule` already use. An action is
1000
+ executed the same way a trigger is; it's just invoked from a rendered
1001
+ widget's own Save button instead of the Triggers page's "Run now".
1002
+ - **Live (opt-in).** The route runs the handler against the same
1003
+ **server-held live context** per integration that OAuth and live schedules
1004
+ already use — its `ctx.fetch` reaches your real vendor under the
1005
+ definition's declared `egress`, with credentials from
1006
+ `.ekanos/local-secrets.json` or whatever `onTokens`/the activation form
1007
+ stored. Requires the entry's `live` block, same as every other live
1008
+ surface — an integration with no `live` block stays on fixtures for its
1009
+ actions exactly as it does for triggers.
1010
+
1011
+ ### The session confirm
1012
+
1013
+ An action is a write, and unlike Triggers' dedicated "Run now" button, it
1014
+ fires from **ordinary widget interaction** — a partner debugging an
1015
+ unrelated CSS issue on the same widget while the toolbar happens to be on
1016
+ Live could otherwise trigger a real vendor write without meaning to touch
1017
+ data at all. So the first `useIntegrationAction()` call in a dev-server
1018
+ session while the toolbar's **Data** mode is Live raises a confirmation
1019
+ ("This will run against real `<vendor>` data") before it reaches the live
1020
+ context; acknowledging it ("allow for this session") lets every subsequent
1021
+ action call that session proceed without asking again. Reloading the page or
1022
+ restarting the dev server resets it, same as the live connection itself.
1023
+
1024
+ **This is a harness convenience for accidental clicks during iteration, not
1025
+ a production security boundary.** Production runs exactly one mode — there
1026
+ is no fixtures/live toggle and no per-session confirmation to bypass — and
1027
+ enforces the real thing through `ctx.fetch`'s egress allowlist regardless of
1028
+ anything the toolbar or this confirm ever did. Do not describe the
1029
+ per-session confirm to a partner as protection that carries over once the
1030
+ integration is published.
1031
+
1032
+ ### Pinned error codes
1033
+
1034
+ The route answers the same fixed `code`s the production host route does, so
1035
+ a widget's error handling written against the harness behaves identically
1036
+ once it ships for real: `action_not_found` (404, unknown action name),
1037
+ `invalid_input` (400, with the partner's own zod `issues`), `rate_limited`
1038
+ (429), and `handler_error` (500 — a handler threw, or its result failed the
1039
+ optional `output` schema; opaque by default). A handler that throws
1040
+ `PublicActionError` (`@ekanos/sdk/integration`) gets its own `message` shown
1041
+ verbatim under that same `handler_error` code — the one escape hatch from
1042
+ the generic message. `useIntegrationAction()`'s rejected mutation always
1043
+ surfaces these as a typed `IntegrationActionError` (`status`, `code`,
1044
+ `issues?`), plus two transport-only codes the hook assigns itself —
1045
+ `network_error` / `invalid_response` — for a request that never reached a
1046
+ valid envelope at all. The harness does not itself enforce the production
1047
+ rate limiter (there is exactly one developer hitting this route locally);
1048
+ it recognizes and can answer `rate_limited` the same way, but nothing here
1049
+ exercises it under normal use.
1050
+
983
1051
  ## What ends up in the browser bundle
984
1052
 
985
1053
  **Everything in your registry does, including `triggerMocks.secrets`.**
@@ -1076,4 +1144,4 @@ published tarball, in a clean room outside the workspace.
1076
1144
 
1077
1145
  MIT. Font Awesome is the consuming app's responsibility: this package ships no
1078
1146
  icon-font data, and the generated shell loads Font Awesome **Free**, because
1079
- Fusion's own Pro webfonts are commercially licensed and cannot be redistributed.
1147
+ Ekanos's own Pro webfonts are commercially licensed and cannot be redistributed.
package/dist/app.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { RootLayout } from "./internal/routes/root-layout.js";
2
2
  import { IndexPage } from "./internal/routes/index-page.js";
3
3
  const harnessMetadata = {
4
- title: "Fusion Integration Harness",
5
- description: "Render integration widgets, marketplace tiles and activation forms in real Fusion chrome, from fixtures, with no Supabase, auth or network."
4
+ title: "Ekanos Integration Harness",
5
+ description: "Render integration widgets, marketplace tiles and activation forms in real Ekanos chrome, from fixtures, with no Supabase, auth or network."
6
6
  };
7
7
  export {
8
8
  IndexPage,
@@ -1,10 +1,16 @@
1
1
  import { type ReactNode } from 'react';
2
- import type { DataMode, FixtureSeed, HarnessLiveMode } from '../../registry.js';
2
+ import type { DataMode, FixtureSeed, FixtureVariant, HarnessLiveMode } from '../../registry.js';
3
3
  import type { CompiledFixture } from '../lib/http-fixtures.js';
4
- export declare function HarnessProviders({ seeds, mode, live, egress, httpFixtures, slug, children, }: {
4
+ export declare function HarnessProviders({ seeds, mode, variant, live, egress, httpFixtures, slug, children, }: {
5
5
  seeds: FixtureSeed[];
6
6
  /** `fixtures` (default) or `live`. See `lib/harness-query-client.ts`. */
7
7
  mode?: DataMode;
8
+ /**
9
+ * The active fixture variant — forwarded to the routing table so a
10
+ * server-reached `actions/` call (see `harness-fetch-interceptor.ts`) can
11
+ * read the SAME `HttpFixture[]` the rest of this render is using.
12
+ */
13
+ variant?: FixtureVariant;
8
14
  /** The integration's live-mode descriptor, when it declares one. */
9
15
  live?: HarnessLiveMode;
10
16
  /** Origins live mode may reach — resolved centrally, see `resolveEgress`. */
@@ -51,6 +51,7 @@ const fixtureActivationActions = {
51
51
  function HarnessProviders({
52
52
  seeds,
53
53
  mode = "fixtures",
54
+ variant = "default",
54
55
  live,
55
56
  egress,
56
57
  httpFixtures,
@@ -77,6 +78,7 @@ function HarnessProviders({
77
78
  publishHarnessRouting({
78
79
  mode,
79
80
  slug,
81
+ variant,
80
82
  fixtures: httpFixtures,
81
83
  egress: mode === "live" ? egress : [],
82
84
  onCall: ({ url, method, outcome }) => {
@@ -87,7 +89,7 @@ function HarnessProviders({
87
89
  console.info(`[harness:${slug}] ${outcome} ${method} ${url}`);
88
90
  }
89
91
  });
90
- }, [mode, httpFixtures, egress, slug]);
92
+ }, [mode, variant, httpFixtures, egress, slug]);
91
93
  const FetchProvider = live?.FetchProvider;
92
94
  const tree = /* @__PURE__ */ jsx(IntegrationFetchProvider, { fetch: harnessFetch, children: /* @__PURE__ */ jsx(IntegrationActivationDataProvider, { value: activationData, children: /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx(TeamAccountWorkspaceContextProvider, { children: /* @__PURE__ */ jsx(IntegrationActivationProvider, { actions: fixtureActivationActions, children: /* @__PURE__ */ jsx(WidgetEventProvider, { children: /* @__PURE__ */ jsxs(AskAssistantProvider, { children: [
93
95
  /* @__PURE__ */ jsx(AskAssistantBridge, {}),
@@ -12,7 +12,7 @@ import { type WidgetHealth, type WidgetRenderState } from '@ekanos/sdk/component
12
12
  * from `WidgetContext`, and something has to PROVIDE it. In the real app that is
13
13
  * `DashboardWidgetProvider`, which lives in the host's own package and is not
14
14
  * part of the published `@ekanos/sdk` surface — on purpose. It is coupled to
15
- * things that only exist inside Fusion: `'use server'` persistence callbacks
15
+ * things that only exist inside Ekanos: `'use server'` persistence callbacks
16
16
  * for the widget-config hierarchy, and the Supabase rows behind them. The SDK
17
17
  * inversion drew the line exactly there: the SDK exports the CONSUMER side
18
18
  * (`WidgetContext` plus `WidgetContextValue` / `WidgetState` / `WidgetActions` /
@@ -1,8 +1,8 @@
1
1
  import type { ReactNode } from 'react';
2
- import '../lib/i18n.js';
3
2
  /**
4
- * Initialization happens as a module side effect on import, so it runs once,
5
- * synchronously, before anything below renders.
3
+ * The next-intl provider `@ekanos/ui/trans` reads. The harness ships no
4
+ * translations: every SDK `<Trans>` carries `defaults`, which is what renders
5
+ * when a key is missing, so empty messages are all it needs.
6
6
  */
7
7
  export declare function I18nProvider({ children }: {
8
8
  children: ReactNode;
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import { Fragment, jsx } from "react/jsx-runtime";
3
- import "../lib/i18n.js";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { NextIntlClientProvider } from "next-intl";
4
4
  function I18nProvider({ children }) {
5
- return /* @__PURE__ */ jsx(Fragment, { children });
5
+ return /* @__PURE__ */ jsx(NextIntlClientProvider, { locale: "en", messages: {}, timeZone: "UTC", children });
6
6
  }
7
7
  export {
8
8
  I18nProvider
@@ -15,8 +15,8 @@ function ViewportFrame({ children }) {
15
15
  /* @__PURE__ */ jsx(
16
16
  "div",
17
17
  {
18
- className: "w-full overflow-hidden rounded-lg border p-5",
19
- style: { maxWidth: width },
18
+ className: "w-full max-w-(--viewport-width) overflow-hidden rounded-lg border p-5",
19
+ style: { "--viewport-width": `${width}px` },
20
20
  children
21
21
  }
22
22
  )
@@ -20,6 +20,6 @@ export declare class WidgetBoundary extends Component<Props, State> {
20
20
  static getDerivedStateFromError(error: Error): State;
21
21
  componentDidUpdate(previous: Props): void;
22
22
  componentDidCatch(error: Error): void;
23
- render(): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
23
+ render(): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
24
24
  }
25
25
  export {};
@@ -32,6 +32,8 @@ function toWidgetConfig(widget, productSlug, unhealthy) {
32
32
  integrationMetadata: {
33
33
  productId: productSlug,
34
34
  productSlug,
35
+ // The harness previews a partner package, which is always an integration.
36
+ kind: "integration",
35
37
  integrationName: productSlug,
36
38
  description: "",
37
39
  category: "harness",
@@ -0,0 +1,30 @@
1
+ /**
2
+ * ─────────────────────────────────────────────────────────────────────────────
3
+ * THE ONE THING THE BROWSER TELLS THE SERVER ABOUT ITSELF, FOR ACTIONS ONLY
4
+ * ─────────────────────────────────────────────────────────────────────────────
5
+ *
6
+ * Every other harness surface (`storage`, `trigger`, `oauth/*`) decides
7
+ * fixtures vs. live BEFORE it ever reaches the network: fixtures-mode
8
+ * triggers run entirely in the browser (`createLocalTriggerRunner` +
9
+ * `useDefinitionMockContext`), and the server route only exists for the
10
+ * live half of that split, so it never needed to ask which mode is active —
11
+ * being reached at all meant live.
12
+ *
13
+ * `useIntegrationAction` breaks that pattern on purpose (the widget-actions
14
+ * design decision): it always makes a real `fetch()`, in both modes, because a
15
+ * production widget has no browser-side execution path to fall back to —
16
+ * there is no admin-secret-bearing context in a browser tab. So the
17
+ * harness's actions route is reached in BOTH modes, and unlike every route
18
+ * before it, has to be told which one is live right now.
19
+ *
20
+ * These two headers are that seam. They are written by
21
+ * `harness-fetch-interceptor.ts`, which already holds `active.mode` and
22
+ * `active.variant` at the exact moment it decides to let an actions request
23
+ * through, and read by `internal/server/api-router.ts`'s action handler.
24
+ * Neither is a production concept — they never leave this process, an
25
+ * absent or garbled value on the server side falls back to fixtures (never
26
+ * to live), and no real Ekanos host route reads either header because a
27
+ * real host route has no "mode" to be told.
28
+ */
29
+ export declare const HARNESS_ACTIONS_MODE_HEADER = "x-ekanos-harness-data-mode";
30
+ export declare const HARNESS_ACTIONS_VARIANT_HEADER = "x-ekanos-harness-fixture-variant";
@@ -0,0 +1,6 @@
1
+ const HARNESS_ACTIONS_MODE_HEADER = "x-ekanos-harness-data-mode";
2
+ const HARNESS_ACTIONS_VARIANT_HEADER = "x-ekanos-harness-fixture-variant";
3
+ export {
4
+ HARNESS_ACTIONS_MODE_HEADER,
5
+ HARNESS_ACTIONS_VARIANT_HEADER
6
+ };
@@ -1,4 +1,4 @@
1
- import type { HttpFixture } from '../../registry.js';
1
+ import type { FixtureVariant, HttpFixture } from '../../registry.js';
2
2
  import { type CompiledFixture, NoRecordedResponseError } from './http-fixtures.js';
3
3
  /**
4
4
  * ─────────────────────────────────────────────────────────────────────────────
@@ -88,6 +88,13 @@ export interface HarnessRoutingTable {
88
88
  * absent (the fail-closed default), nothing passes.
89
89
  */
90
90
  slug?: string;
91
+ /**
92
+ * The active fixture variant. Forwarded to the server on an `actions/`
93
+ * call (see below) so the harness's fixtures-mode actions context reads
94
+ * the same `HttpFixture[]` the rest of the surface is rendering from.
95
+ * Meaningless outside that one path. Defaults to `'default'` when absent.
96
+ */
97
+ variant?: FixtureVariant;
91
98
  /** Compiled fixtures for the active variant. */
92
99
  fixtures: readonly CompiledFixture[];
93
100
  /** Origins live mode may reach. Empty in fixtures mode. */
@@ -98,6 +105,18 @@ export interface HarnessRoutingTable {
98
105
  method: string;
99
106
  outcome: 'fixture' | 'network' | 'refused';
100
107
  }) => void;
108
+ /**
109
+ * Test seam for the live-actions confirmation prompt (see
110
+ * `confirmLiveAction` below). Defaults to `globalThis.confirm`.
111
+ */
112
+ confirm?: (message: string) => boolean;
113
+ }
114
+ /** Test seam: forget every live-actions confirmation, as a fresh session would. */
115
+ export declare function resetLiveActionConfirmations(): void;
116
+ export declare class LiveActionNotConfirmedError extends Error {
117
+ readonly slug: string;
118
+ readonly actionName: string;
119
+ constructor(slug: string, actionName: string);
101
120
  }
102
121
  /**
103
122
  * Publish the table the interceptor answers from.
@@ -1,5 +1,9 @@
1
1
  "use client";
2
2
  import { EgressDeniedError, isEgressAllowed } from "@ekanos/sdk/context";
3
+ import {
4
+ HARNESS_ACTIONS_MODE_HEADER,
5
+ HARNESS_ACTIONS_VARIANT_HEADER
6
+ } from "./actions-transport.js";
3
7
  import {
4
8
  NoRecordedResponseError,
5
9
  fixtureResponse,
@@ -13,6 +17,62 @@ const CLOSED = {
13
17
  };
14
18
  let active = CLOSED;
15
19
  let installed = false;
20
+ const CONFIRMED_KEY_PREFIX = "ekanos-harness-live-action-confirmed:";
21
+ const confirmedInMemory = /* @__PURE__ */ new Set();
22
+ function readSessionStorage() {
23
+ try {
24
+ return globalThis.sessionStorage;
25
+ } catch {
26
+ return void 0;
27
+ }
28
+ }
29
+ function isLiveActionConfirmed(slug) {
30
+ if (confirmedInMemory.has(slug)) return true;
31
+ try {
32
+ return readSessionStorage()?.getItem(CONFIRMED_KEY_PREFIX + slug) === "1";
33
+ } catch {
34
+ return false;
35
+ }
36
+ }
37
+ function markLiveActionConfirmed(slug) {
38
+ confirmedInMemory.add(slug);
39
+ try {
40
+ readSessionStorage()?.setItem(CONFIRMED_KEY_PREFIX + slug, "1");
41
+ } catch {
42
+ }
43
+ }
44
+ function resetLiveActionConfirmations() {
45
+ confirmedInMemory.clear();
46
+ const storage = readSessionStorage();
47
+ if (!storage) return;
48
+ try {
49
+ for (let index = storage.length - 1; index >= 0; index--) {
50
+ const key = storage.key(index);
51
+ if (key?.startsWith(CONFIRMED_KEY_PREFIX)) storage.removeItem(key);
52
+ }
53
+ } catch {
54
+ }
55
+ }
56
+ class LiveActionNotConfirmedError extends Error {
57
+ constructor(slug, actionName) {
58
+ super(
59
+ `Live action "${actionName}" on "${slug}" was not confirmed, so the request was never sent. Run it again and accept the "this runs against real data" prompt \u2014 declining or dismissing it answers no.`
60
+ );
61
+ this.slug = slug;
62
+ this.actionName = actionName;
63
+ this.name = "LiveActionNotConfirmedError";
64
+ }
65
+ }
66
+ function confirmLiveAction(slug, actionName, ask) {
67
+ if (isLiveActionConfirmed(slug)) return true;
68
+ const accepted = ask(
69
+ `"${slug}" wants to run "${actionName}" against REAL, live ${slug} data \u2014 this is not a fixture.
70
+
71
+ Choose OK to allow this action, and every other action on this integration, for the rest of this browser session.`
72
+ );
73
+ if (accepted) markLiveActionConfirmed(slug);
74
+ return accepted;
75
+ }
16
76
  let originalFetch;
17
77
  let patchedFetch;
18
78
  function redact(url) {
@@ -57,8 +117,31 @@ function installHarnessFetch() {
57
117
  }
58
118
  if (isSameOrigin) {
59
119
  if (active.slug !== void 0) {
60
- const own = `/api/integrations/${active.slug}/`;
120
+ const slug = active.slug;
121
+ const own = `/api/integrations/${slug}/`;
61
122
  const isLocalSetup = url.pathname === `${own}local-setup`;
123
+ const actionsPrefix = `${own}actions/`;
124
+ const isActionsCall = url.pathname.startsWith(actionsPrefix);
125
+ if (isActionsCall) {
126
+ const actionName = url.pathname.slice(actionsPrefix.length);
127
+ if (active.mode === "live") {
128
+ const ask = active.confirm ?? ((message) => globalThis.confirm(message));
129
+ if (!confirmLiveAction(slug, actionName, ask)) {
130
+ notify(url, method, "refused");
131
+ throw new LiveActionNotConfirmedError(slug, actionName);
132
+ }
133
+ }
134
+ notify(url, method, "network");
135
+ const headers = new Headers(
136
+ init?.headers ?? (input instanceof Request ? input.headers : void 0)
137
+ );
138
+ headers.set(HARNESS_ACTIONS_MODE_HEADER, active.mode);
139
+ headers.set(
140
+ HARNESS_ACTIONS_VARIANT_HEADER,
141
+ active.variant ?? "default"
142
+ );
143
+ return original(input, { ...init, headers });
144
+ }
62
145
  if (isLocalSetup || active.mode === "live" && url.pathname.startsWith(own)) {
63
146
  notify(url, method, "network");
64
147
  return original(input, init);
@@ -111,11 +194,14 @@ function uninstallHarnessFetch(original) {
111
194
  originalFetch = void 0;
112
195
  patchedFetch = void 0;
113
196
  closeHarnessRouting();
197
+ resetLiveActionConfirmations();
114
198
  }
115
199
  export {
200
+ LiveActionNotConfirmedError,
116
201
  NoRecordedResponseError,
117
202
  closeHarnessRouting,
118
203
  installHarnessFetch,
119
204
  publishHarnessRouting,
205
+ resetLiveActionConfirmations,
120
206
  uninstallHarnessFetch
121
207
  };
@@ -4,7 +4,7 @@ import type { IntegrationFetch } from '@ekanos/sdk';
4
4
  * THE HARNESS'S `ctx.fetch`
5
5
  * ─────────────────────────────────────────────────────────────────────────────
6
6
  *
7
- * The harness mocks Fusion. It does NOT mock your vendor's API — and in live
7
+ * The harness mocks Ekanos. It does NOT mock your vendor's API — and in live
8
8
  * mode it stops standing between you and it. What it does instead is enforce
9
9
  * the one rule that matters: an integration may only reach the origins it
10
10
  * DECLARED in `defineIntegration({ egress })`.
@@ -33,7 +33,7 @@ export declare class MissingFixtureError extends Error {
33
33
  *
34
34
  * LIVE mode installs no override at all, so react-query falls through to each
35
35
  * widget's own `queryFn` — the real one, reaching the real vendor API through
36
- * the allowlisted fetch. Fusion-side keys are still pre-seeded, so a widget
36
+ * the allowlisted fetch. Ekanos-side keys are still pre-seeded, so a widget
37
37
  * that needs an account setting before it can call anything still gets one.
38
38
  *
39
39
  * `retry: false` matters as much as the rest: the default three retries with
@@ -4,19 +4,19 @@ import { type DataMode, type FixtureVariant } from '../../registry.js';
4
4
  export declare const RENDER_STATES: readonly ["active", "loading", "error", "inactive", "disabled"];
5
5
  export declare const VIEWPORTS: {
6
6
  readonly mobile: {
7
- readonly label: "Mobile";
7
+ readonly label: 'Mobile';
8
8
  readonly width: 390;
9
9
  };
10
10
  readonly tablet: {
11
- readonly label: "Tablet";
11
+ readonly label: 'Tablet';
12
12
  readonly width: 820;
13
13
  };
14
14
  readonly desktop: {
15
- readonly label: "Desktop";
15
+ readonly label: 'Desktop';
16
16
  readonly width: 1280;
17
17
  };
18
18
  readonly full: {
19
- readonly label: "Full";
19
+ readonly label: 'Full';
20
20
  readonly width: null;
21
21
  };
22
22
  };
@@ -68,7 +68,7 @@ function ActivationPage() {
68
68
  /* @__PURE__ */ jsx(AlertTitle, { children: mode === "live" ? "Submissions run onActivate on the dev server" : "Submissions go nowhere" }),
69
69
  /* @__PURE__ */ jsxs(AlertDescription, { children: [
70
70
  /* @__PURE__ */ jsxs("p", { children: [
71
- "The harness has no Fusion backend. Submitting shows you the",
71
+ "The harness has no Ekanos backend. Submitting shows you the",
72
72
  " ",
73
73
  /* @__PURE__ */ jsx("code", { children: "ActivationResult" }),
74
74
  " your form handed back instead of persisting it \u2014 which is the part worth checking, since that payload is what the real activation action would store. The dialog, the capability and permission sections and the connected state are the real ones, rendered from your ",
@@ -322,7 +322,7 @@ function ConnectedState({
322
322
  {
323
323
  className: "text-muted-foreground text-sm",
324
324
  "data-test": "activation-mode-notice",
325
- children: mode === "live" ? hasLiveActivationData ? "The toolbar is on Live API \u2014 this activation data is available to live-mode widgets on this visit." : "The toolbar is on Live API. This activation submitted no data of its own; an OAuth integration\u2019s credentials live on the dev server, where onTokens stored them." : "This surface is Fusion-mocked; widgets read fixtures \u2014 switch the toolbar to Live API to exercise real requests."
325
+ children: mode === "live" ? hasLiveActivationData ? "The toolbar is on Live API \u2014 this activation data is available to live-mode widgets on this visit." : "The toolbar is on Live API. This activation submitted no data of its own; an OAuth integration\u2019s credentials live on the dev server, where onTokens stored them." : "This surface is Ekanos-mocked; widgets read fixtures \u2014 switch the toolbar to Live API to exercise real requests."
326
326
  }
327
327
  ),
328
328
  /* @__PURE__ */ jsx(
@@ -8,7 +8,7 @@ function IndexPage({
8
8
  return /* @__PURE__ */ jsxs("main", { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 px-6 py-10", children: [
9
9
  /* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-2", children: [
10
10
  /* @__PURE__ */ jsx("h1", { className: "font-heading text-3xl tracking-tight", children: "Integration harness" }),
11
- /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Every registered integration, rendered in real Fusion chrome from fixtures. No Supabase, no auth, no network." })
11
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Every registered integration, rendered in real Ekanos chrome from fixtures. No Supabase, no auth, no network." })
12
12
  ] }),
13
13
  integrations.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "bg-card flex flex-col items-center gap-3 rounded-lg border p-6 text-center", children: [
14
14
  /* @__PURE__ */ jsx(
@@ -55,6 +55,7 @@ function IntegrationLayout({ children }) {
55
55
  {
56
56
  seeds,
57
57
  mode,
58
+ variant: state.variant,
58
59
  ...integration.live && !egressMismatch ? { live: integration.live } : {},
59
60
  egress,
60
61
  httpFixtures,
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
+ import "@fortawesome/fontawesome-free/css/all.min.css";
3
4
  import { IconStyleOverrideProvider } from "@ekanos/ui/icon";
4
5
  import { cn } from "@ekanos/ui/utils";
5
- import "@fortawesome/fontawesome-free/css/all.min.css";
6
6
  import { ThemeProvider } from "next-themes";
7
7
  import { DevToolbar } from "../components/dev-toolbar.js";
8
8
  import { I18nProvider } from "../components/i18n-provider.js";
@@ -3,6 +3,9 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useMemo, useState } from "react";
4
4
  import { notFound } from "next/navigation";
5
5
  import { isEgressAllowed } from "@ekanos/sdk/context";
6
+ import {
7
+ DEFAULT_SIGNATURE_TOLERANCE_SECONDS
8
+ } from "@ekanos/sdk/integration";
6
9
  import { Alert, AlertDescription, AlertTitle } from "@ekanos/ui/alert";
7
10
  import { Badge } from "@ekanos/ui/badge";
8
11
  import { Button } from "@ekanos/ui/button";
@@ -16,6 +19,22 @@ import {
16
19
  createServerTriggerRunner
17
20
  } from "../lib/trigger-runner.js";
18
21
  import { useHarnessIntegration } from "../registry-context.js";
22
+ function describeSignatureScheme(scheme) {
23
+ const parts = [`HMAC-${(scheme.algorithm ?? "sha256").toUpperCase()}`];
24
+ parts.push(`over ${scheme.signedPayload ?? "{body}"}`);
25
+ if (scheme.format === "keyed") {
26
+ parts.push(
27
+ `keyed (${scheme.digestKey}${scheme.timestampKey ? `, t=${scheme.timestampKey}` : ""})`
28
+ );
29
+ }
30
+ if (scheme.timestampHeader)
31
+ parts.push(`timestamp header ${scheme.timestampHeader}`);
32
+ if (scheme.timestampKey || scheme.timestampHeader) {
33
+ const tolerance = scheme.toleranceSeconds ?? DEFAULT_SIGNATURE_TOLERANCE_SECONDS;
34
+ parts.push(tolerance === 0 ? "no replay window" : `\xB1${tolerance}s`);
35
+ }
36
+ return parts.join(" \xB7 ");
37
+ }
19
38
  function OutcomePanel({ outcome }) {
20
39
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", "data-test": "trigger-outcome", children: [
21
40
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
@@ -77,7 +96,8 @@ function WebhookCard({
77
96
  ' \u21D0 secret "',
78
97
  webhook.signature.secretName,
79
98
  '"'
80
- ] })
99
+ ] }),
100
+ webhook.signature !== "none" && webhook.signature.scheme ? /* @__PURE__ */ jsx(Badge, { variant: "outline", "data-test": `webhook-${webhook.id}-scheme`, children: describeSignatureScheme(webhook.signature.scheme) }) : null
81
101
  ] }),
82
102
  /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: webhook.description }),
83
103
  webhook.signature !== "none" ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: "Signature verification is the transport's job \u2014 the harness skips it (and says so in the handler logs); the host ingress will enforce it before your handler ever runs." }) : null,
@@ -223,17 +243,17 @@ function OAuthCard({
223
243
  " via",
224
244
  " ",
225
245
  /* @__PURE__ */ jsx("code", { children: "ctx.secrets" }),
226
- ". The hosted transport runs it in Fusion; in live mode the generated shell runs the same loop here, on localhost, against your own developer app \u2014 see Local OAuth below."
246
+ ". The hosted transport runs it in Ekanos; in live mode the generated shell runs the same loop here, on localhost, against your own developer app \u2014 see Local OAuth below."
227
247
  ] }),
228
248
  /* @__PURE__ */ jsxs("p", { children: [
229
249
  /* @__PURE__ */ jsx("strong", { children: "Redirect URI \u2014 host-derived, and not something you declare." }),
230
250
  " ",
231
251
  "Whichever host runs the flow builds it from its own origin, so there is no field for it in ",
232
252
  /* @__PURE__ */ jsx("code", { children: "defineIntegration()" }),
233
- ". You register one per environment with your provider: the harness's (below, in live mode) and the Fusion host's,",
253
+ ". You register one per environment with your provider: the harness's (below, in live mode) and the Ekanos host's,",
234
254
  " ",
235
255
  /* @__PURE__ */ jsxs("code", { children: [
236
- "https://<your-fusion-host>/api/integrations/",
256
+ "https://<your-ekanos-host>/api/integrations/",
237
257
  definition.slug,
238
258
  "/oauth/callback"
239
259
  ] }),
@@ -0,0 +1,57 @@
1
+ import type { IntegrationDefinition } from '@ekanos/sdk/integration';
2
+ import { type MockIntegrationContext } from '@ekanos/sdk/testing';
3
+ import { type FixtureVariant, type HarnessIntegration } from '../../registry.js';
4
+ /**
5
+ * ─────────────────────────────────────────────────────────────────────────────
6
+ * THE FIXTURES-MODE ACTIONS CONTEXT — one per (slug, variant), held server-side
7
+ * ─────────────────────────────────────────────────────────────────────────────
8
+ *
9
+ * `useIntegrationAction` always makes a real `fetch()` (the widget-actions
10
+ * design decision) — there is no browser-side execution path the way
11
+ * fixtures-mode triggers have (`createLocalTriggerRunner` +
12
+ * `useDefinitionMockContext`, both browser-only, built from a `useState`
13
+ * initializer that never runs on the server). So fixtures-mode ACTIONS need
14
+ * a server-side mock context of their own, built the identical way — same
15
+ * `createMockContext`, same fetchHandlers dispatch order (a partner's own
16
+ * `triggerMocks.fetchHandlers` first, then the fixture-compiled catch-all)
17
+ * — just reachable from `api-router.ts`'s action handler instead of from a
18
+ * React hook.
19
+ *
20
+ * Kept on `globalThis` under a `Symbol.for` key, exactly like
21
+ * `live-context.ts`'s `LiveState` store, so a dev-server recompile of the
22
+ * route module does not drop storage a previous action call wrote in the
23
+ * same variant. Keyed by `slug:variant` rather than just `slug` —
24
+ * switching the toolbar's fixture variant is already a deliberate "start
25
+ * over" (`IntegrationLayout` keys its whole provider subtree on it), so the
26
+ * actions context resets with it too, rather than leaking state seeded
27
+ * under one variant into another.
28
+ *
29
+ * NEVER carries a network-passthrough handler — that is the entire
30
+ * difference from `live-context.ts`'s `LiveState`. An action's `ctx.fetch`
31
+ * in fixtures mode can only ever resolve to a partner's own
32
+ * `triggerMocks.fetchHandlers` or a compiled `HttpFixture`; anything else is
33
+ * `NoRecordedResponseError`, never the real network — fixtures mode's whole
34
+ * promise, held for actions exactly as it already is for widgets and
35
+ * triggers.
36
+ */
37
+ export interface FixturesActionsState {
38
+ key: string;
39
+ ctx: MockIntegrationContext;
40
+ }
41
+ /** Test seam: forget every fixtures-mode actions context. */
42
+ export declare function resetFixturesActionsStore(): void;
43
+ export interface FixturesActionsStateInput {
44
+ integration: HarnessIntegration;
45
+ definition: IntegrationDefinition;
46
+ variant: FixtureVariant;
47
+ }
48
+ /**
49
+ * One context per `slug:variant`, built on first use and reused after —
50
+ * state (storage, secrets, logs) accumulates across action calls within the
51
+ * same variant, like a real account across a visit.
52
+ *
53
+ * Can throw `FixtureRequestError` (from `compileFixtures`) when a declared
54
+ * `HttpFixture`'s request line is malformed — the caller's job to turn that
55
+ * into a clear response, not this function's.
56
+ */
57
+ export declare function getFixturesActionsState(input: FixturesActionsStateInput): FixturesActionsState;
@@ -0,0 +1,56 @@
1
+ import {
2
+ createMockContext
3
+ } from "@ekanos/sdk/testing";
4
+ import {
5
+ HARNESS_ACCOUNT_ID,
6
+ resolveEgress
7
+ } from "../../registry.js";
8
+ import {
9
+ compileFixtures,
10
+ fixturesToMockHandlers,
11
+ needsSelfOrigin
12
+ } from "../lib/http-fixtures.js";
13
+ const STORE = /* @__PURE__ */ Symbol.for("ekanos.harness.fixtures-actions-state");
14
+ function getStore() {
15
+ const carrier = globalThis;
16
+ carrier[STORE] ??= /* @__PURE__ */ new Map();
17
+ return carrier[STORE];
18
+ }
19
+ function resetFixturesActionsStore() {
20
+ getStore().clear();
21
+ }
22
+ function getFixturesActionsState(input) {
23
+ const key = `${input.integration.slug}:${input.variant}`;
24
+ const store = getStore();
25
+ const existing = store.get(key);
26
+ if (existing) return existing;
27
+ const definition = input.definition;
28
+ const mocks = input.integration.triggerMocks ?? {};
29
+ const egress = resolveEgress(input.integration);
30
+ const declaredFixtures = (input.integration.fixtures?.[input.variant] ?? []).filter((fixture) => !needsSelfOrigin(fixture));
31
+ const ctx = createMockContext({
32
+ accountId: HARNESS_ACCOUNT_ID,
33
+ integration: { slug: definition.slug },
34
+ ...definition.storage ? { storageSchemas: definition.storage } : {},
35
+ egress: definition.egress ?? [],
36
+ ...mocks.storage ? {
37
+ storage: mocks.storage
38
+ } : {},
39
+ ...mocks.secrets ? { secrets: mocks.secrets } : {},
40
+ fetchHandlers: [
41
+ ...mocks.fetchHandlers ?? [],
42
+ // No selfOrigin: an action handler's `ctx.fetch` calls the partner's
43
+ // OWN vendor, never the harness's own `/api/…` namespace, so the
44
+ // `/api/` host-route fixture shape (the only one that needs an
45
+ // origin to resolve against) never applies here.
46
+ ...fixturesToMockHandlers(compileFixtures(declaredFixtures, egress))
47
+ ]
48
+ });
49
+ const state = { key, ctx };
50
+ store.set(key, state);
51
+ return state;
52
+ }
53
+ export {
54
+ getFixturesActionsState,
55
+ resetFixturesActionsStore
56
+ };
@@ -4,7 +4,7 @@ import { type HarnessIntegration } from '../../registry.js';
4
4
  * THE HARNESS API — `/api/integrations/[slug]/…`, served by the shell
5
5
  * ─────────────────────────────────────────────────────────────────────────────
6
6
  *
7
- * Six routes per registered integration, behind one catch-all the CLI
7
+ * Seven routes per registered integration, behind one catch-all the CLI
8
8
  * scaffolds (`app/api/integrations/[slug]/[...path]/route.ts`):
9
9
  *
10
10
  * GET oauth/connect start the real authorize → callback → exchange loop
@@ -13,8 +13,20 @@ import { type HarnessIntegration } from '../../registry.js';
13
13
  * GET storage the SDK's generic storage bridge, over the live ctx
14
14
  * POST trigger run a webhook / schedule / onActivate on the live ctx
15
15
  * GET local-setup what to fill in and what to register — never values
16
+ * POST actions/:name run a declared `actions[name]` handler — see below
16
17
  *
17
- * Contracts mirror the Fusion host's own partner routes — the hosted OAuth
18
+ * `actions/:name` is the one route reached in BOTH fixtures and live mode
19
+ * (every other route only exists for live — fixtures-mode triggers run
20
+ * entirely in the browser). `useIntegrationAction` always makes a real
21
+ * `fetch()` (the widget-actions design), so
22
+ * `harness-fetch-interceptor.ts` lets it through unconditionally and tags
23
+ * the request with the active mode/variant via two harness-only headers
24
+ * (`internal/lib/actions-transport.ts`) — this router reads them to decide
25
+ * whether to run the handler against the live ctx (`getLiveState`, same as
26
+ * `trigger`) or a dedicated per-variant fixtures ctx
27
+ * (`getFixturesActionsState`, network-free).
28
+ *
29
+ * Contracts mirror the Ekanos host's own partner routes — the hosted OAuth
18
30
  * transport and the generic storage route — so the SDK's client
19
31
  * helpers (`createPartnerConnectionCheck`, `fetchIntegrationStorage`,
20
32
  * `partnerOAuthErrorParam`) work against either unchanged. Where the harness
@@ -1,10 +1,19 @@
1
1
  import { invokeSchedule, invokeWebhook } from "@ekanos/sdk/testing";
2
- import { findIntegration } from "../../registry.js";
2
+ import {
3
+ DATA_MODES,
4
+ FIXTURE_VARIANTS,
5
+ findIntegration
6
+ } from "../../registry.js";
7
+ import {
8
+ HARNESS_ACTIONS_MODE_HEADER,
9
+ HARNESS_ACTIONS_VARIANT_HEADER
10
+ } from "../lib/actions-transport.js";
3
11
  import { runOnActivateHook } from "../lib/run-activation-hook.js";
4
12
  import {
5
13
  isLocalSetupWriteRequest,
6
14
  isTriggerRequest
7
15
  } from "../lib/trigger-contract.js";
16
+ import { getFixturesActionsState } from "./actions-fixtures-context.js";
8
17
  import {
9
18
  WARMUP_BUDGET_MS,
10
19
  getLiveState,
@@ -29,6 +38,9 @@ import {
29
38
  } from "./oauth-loop.js";
30
39
  import { resolveProjectRoot } from "./project-root.js";
31
40
  import { parseStorageQuery, readClientReadableStorage } from "./storage-read.js";
41
+ function asSafeParseSchema(schema) {
42
+ return schema;
43
+ }
32
44
  function json(body, init = {}) {
33
45
  return new Response(JSON.stringify(body), {
34
46
  ...init,
@@ -65,7 +77,8 @@ function createHarnessApiRouter(registry, deps = {}) {
65
77
  const refusal = loopbackRefusal(request, env);
66
78
  if (refusal) return refusal;
67
79
  const routeKey = params.path.join("/");
68
- const route = ROUTES[routeKey];
80
+ const actionName = params.path.length === 2 && params.path[0] === "actions" ? params.path[1] : void 0;
81
+ const route = actionName !== void 0 ? { methods: ["POST"], handle: (ctx) => actionInvoke(ctx, actionName) } : ROUTES[routeKey];
69
82
  if (!route) {
70
83
  if (routeKey === "connect") {
71
84
  return json(
@@ -81,7 +94,7 @@ function createHarnessApiRouter(registry, deps = {}) {
81
94
  {
82
95
  error: "not_found",
83
96
  message: `No harness API route at /api/integrations/${params.slug}/${routeKey}.`,
84
- routes: Object.keys(ROUTES)
97
+ routes: [...Object.keys(ROUTES), "actions/:actionName"]
85
98
  },
86
99
  { status: 404 }
87
100
  );
@@ -393,6 +406,106 @@ async function trigger(ctx) {
393
406
  }
394
407
  }
395
408
  }
409
+ function isDataMode(value) {
410
+ return value !== null && DATA_MODES.includes(value);
411
+ }
412
+ function isFixtureVariant(value) {
413
+ return value !== null && FIXTURE_VARIANTS.includes(value);
414
+ }
415
+ async function actionInvoke(ctx, actionName) {
416
+ const action = ctx.definition.actions?.[actionName];
417
+ if (!action) {
418
+ return json(
419
+ {
420
+ success: false,
421
+ error: `"${ctx.slug}" declares no action named "${actionName}".`,
422
+ code: "action_not_found"
423
+ },
424
+ { status: 404 }
425
+ );
426
+ }
427
+ let body;
428
+ try {
429
+ body = await ctx.request.json();
430
+ } catch {
431
+ return json(
432
+ {
433
+ success: false,
434
+ error: "Request body must be JSON.",
435
+ code: "invalid_input"
436
+ },
437
+ { status: 400 }
438
+ );
439
+ }
440
+ const parsed = asSafeParseSchema(action.input).safeParse(
441
+ body?.input
442
+ );
443
+ if (!parsed.success) {
444
+ return json(
445
+ {
446
+ success: false,
447
+ error: "Input failed validation.",
448
+ code: "invalid_input",
449
+ issues: parsed.error.issues
450
+ },
451
+ { status: 400 }
452
+ );
453
+ }
454
+ const modeHeader = ctx.request.headers.get(HARNESS_ACTIONS_MODE_HEADER);
455
+ const mode = isDataMode(modeHeader) ? modeHeader : "fixtures";
456
+ try {
457
+ const executionCtx = mode === "live" ? ctx.state.ctx : getFixturesActionsState({
458
+ integration: ctx.integration,
459
+ definition: ctx.definition,
460
+ variant: resolveActionsVariant(ctx)
461
+ }).ctx;
462
+ const data = await action.handler(executionCtx, parsed.data);
463
+ if (action.output) {
464
+ const validated = asSafeParseSchema(action.output).safeParse(data);
465
+ if (!validated.success) {
466
+ console.error(
467
+ `[harness:${ctx.slug}] action "${actionName}" resolved a value that fails its own declared \`output\` schema:`,
468
+ validated.error.issues
469
+ );
470
+ return json(
471
+ {
472
+ success: false,
473
+ error: "Action failed.",
474
+ code: "handler_error",
475
+ devError: {
476
+ message: "The handler resolved successfully, but the value does not match the `output` schema declared alongside it. This is a dev-only field \u2014 production's host route never returns it.",
477
+ issues: validated.error.issues
478
+ }
479
+ },
480
+ { status: 500 }
481
+ );
482
+ }
483
+ return json({ success: true, data: validated.data });
484
+ }
485
+ return json({ success: true, data });
486
+ } catch (error) {
487
+ console.error(
488
+ `[harness:${ctx.slug}] action "${actionName}" handler threw (mode: ${mode}):`,
489
+ error
490
+ );
491
+ return json(
492
+ {
493
+ success: false,
494
+ error: "Action failed.",
495
+ code: "handler_error",
496
+ devError: {
497
+ message: describeError(error),
498
+ stack: error instanceof Error ? error.stack : void 0
499
+ }
500
+ },
501
+ { status: 500 }
502
+ );
503
+ }
504
+ }
505
+ function resolveActionsVariant(ctx) {
506
+ const variantHeader = ctx.request.headers.get(HARNESS_ACTIONS_VARIANT_HEADER);
507
+ return isFixtureVariant(variantHeader) ? variantHeader : "default";
508
+ }
396
509
  function localSetupResponse(ctx, secrets, connected) {
397
510
  const names = declaredSecretNames(ctx.definition);
398
511
  const missing = new Set(secrets.missing);
@@ -5,7 +5,7 @@ import type { OAuthProviderDeclaration, OAuthTokens } from '@ekanos/sdk/integrat
5
5
  * THE LOCALHOST OAUTH LOOP — pure helpers
6
6
  * ─────────────────────────────────────────────────────────────────────────────
7
7
  *
8
- * The REFERENCE implementation is the Fusion host's hosted OAuth transport
8
+ * The REFERENCE implementation is the Ekanos host's hosted OAuth transport
9
9
  * (its `oauth-transport` module). These helpers mirror its pure half — PKCE, the authorize URL, the return-path check, the
10
10
  * code exchange and its token mapping — so a flow that works here works
11
11
  * there. They are duplicated rather than shared because that module is host
@@ -2,7 +2,7 @@ import type { IntegrationContext } from '@ekanos/sdk';
2
2
  import type { IntegrationDefinition } from '@ekanos/sdk/integration';
3
3
  /**
4
4
  * The read half of `GET /api/integrations/[slug]/storage`, mirroring the
5
- * Fusion host's generic storage route so `fetchIntegrationStorage()` in `@ekanos/sdk` — and therefore every
5
+ * Ekanos host's generic storage route so `fetchIntegrationStorage()` in `@ekanos/sdk` — and therefore every
6
6
  * partner widget built on it — works against the harness unchanged:
7
7
  *
8
8
  * - `?accountId=…&keys=a,b`, at most 20 keys, 400 on a malformed request;
@@ -8,7 +8,7 @@ import type { MockFetchHandler } from '@ekanos/sdk/testing';
8
8
  * supply at least `default`; the others are optional and fall back to
9
9
  * "nothing seeded", which surfaces as the widget's own error state.
10
10
  */
11
- export declare const FIXTURE_VARIANTS: readonly ["default", "empty", "error"];
11
+ export declare const FIXTURE_VARIANTS: readonly ['default', 'empty', 'error'];
12
12
  export type FixtureVariant = (typeof FIXTURE_VARIANTS)[number];
13
13
  /**
14
14
  * One programmed outcome for one react-query key.
@@ -104,12 +104,12 @@ export interface HarnessWidget {
104
104
  * LIVE MODE — opting your integration into real third-party requests
105
105
  * ─────────────────────────────────────────────────────────────────────────────
106
106
  *
107
- * The harness mocks Fusion, not your vendor. Declare this and the toolbar grows
107
+ * The harness mocks Ekanos, not your vendor. Declare this and the toolbar grows
108
108
  * a fixtures ⇄ live switch for your integration: in live mode the harness stops
109
109
  * seeding your data keys, your widgets' own query functions run, and the
110
110
  * requests they make reach the real API.
111
111
  *
112
- * Fusion stays mocked either way. There is still no Supabase, no auth and no
112
+ * Ekanos stays mocked either way. There is still no Supabase, no auth and no
113
113
  * server action — which is what `seeds` below is for.
114
114
  *
115
115
  * What you write is three fields:
@@ -279,7 +279,7 @@ export interface HarnessLiveMode {
279
279
  children: ReactNode;
280
280
  }>;
281
281
  /**
282
- * Keys that stay MOCKED in live mode: Fusion-side state your widgets read
282
+ * Keys that stay MOCKED in live mode: Ekanos-side state your widgets read
283
283
  * before they can call anything — a saved location, an account preference,
284
284
  * whatever your own host route would have returned. Seeded exactly like a
285
285
  * fixture, and for exactly the same reason: the harness has no Supabase.
@@ -297,7 +297,7 @@ export interface HarnessLiveMode {
297
297
  * schedules against ONE `createMockContext()` per visit (state accumulates
298
298
  * across invocations, like a real account). The context is derived from the
299
299
  * definition itself — slug, storage schemas, egress — and these seeds are the
300
- * only extra input: whatever Fusion-side state your handlers need to run a
300
+ * only extra input: whatever Ekanos-side state your handlers need to run a
301
301
  * happy path (a stored config row, a seeded API key, a programmed response
302
302
  * for `ctx.fetch`). There is no Supabase and no network in here either way.
303
303
  */
@@ -398,7 +398,7 @@ export interface HarnessIntegration {
398
398
  };
399
399
  }
400
400
  /** The two data sources a surface can render from. */
401
- export declare const DATA_MODES: readonly ["fixtures", "live"];
401
+ export declare const DATA_MODES: readonly ['fixtures', 'live'];
402
402
  export type DataMode = (typeof DATA_MODES)[number];
403
403
  /**
404
404
  * The account/product identifiers every surface is rendered with. These are
@@ -469,7 +469,7 @@ export declare function collectSeeds(integration: HarnessIntegration, variant: F
469
469
  * The seeds for one integration in one mode.
470
470
  *
471
471
  * Fixtures mode seeds everything the widgets declare. Live mode seeds ONLY the
472
- * Fusion-side keys, so every other query function runs for real — that one
472
+ * Ekanos-side keys, so every other query function runs for real — that one
473
473
  * difference is the whole fixtures ⇄ live switch.
474
474
  */
475
475
  export declare function seedsForMode(integration: HarnessIntegration, variant: FixtureVariant, mode: DataMode): FixtureSeed[];
package/dist/styles.css CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
  @import 'tailwindcss';
18
18
 
19
- /* Fusion design tokens + the Tailwind v4 @theme preset, consumed from the
19
+ /* Ekanos design tokens + the Tailwind v4 @theme preset, consumed from the
20
20
  * published package instead of a hand-maintained fork. This single import
21
21
  * pulls in the token values, the base rules, the `dark:` variant and the full
22
22
  * semantic @theme map. Resolves to `@ekanos/ui/dist/theme.css`, so that
@@ -156,7 +156,7 @@ i:is(.fa-light, .fa-thin, .fa-duotone, .fa-sharp) {
156
156
  * Aliasing those by codepoint here is strictly better than the question mark
157
157
  * and strictly honest about what it is: an APPROXIMATION for the Free build.
158
158
  * `fa-cloud` is not `fa-clouds` and `fa-sun` is not `fa-sun-bright` — in
159
- * production, where Fusion loads Font Awesome Pro, the real Pro rule is (0,1,0)
159
+ * production, where Ekanos loads Font Awesome Pro, the real Pro rule is (0,1,0)
160
160
  * and lives in an unlayered vendor sheet, so it wins over the `i.fa-*` selectors
161
161
  * below and the authored Pro glyph renders exactly as designed. Nothing here
162
162
  * changes what a correctly licensed host shows.
package/package.json CHANGED
@@ -1,25 +1,28 @@
1
1
  {
2
2
  "name": "@ekanos/harness",
3
- "version": "0.2.0",
4
- "private": false,
5
- "type": "module",
6
- "description": "The Ekanos integration dev harness — every surface of an integration rendered in real Fusion chrome, from fixtures, with no Supabase or auth; and, in live mode, a real localhost OAuth loop over your own dev-app credentials.",
7
- "license": "MIT",
3
+ "version": "0.4.0",
4
+ "description": "The Ekanos integration dev harness — every surface of an integration rendered in real Ekanos chrome, from fixtures, with no Supabase or auth; and, in live mode, a real localhost OAuth loop over your own dev-app credentials.",
8
5
  "bugs": {
9
6
  "email": "npm@govastly.com"
10
7
  },
11
- "sideEffects": [
12
- "**/*.css",
13
- "**/i18n.js"
14
- ],
15
- "ekanos": {
16
- "shellContract": 2
17
- },
8
+ "license": "MIT",
18
9
  "files": [
19
10
  "dist",
20
11
  "README.md",
21
12
  "LICENSE"
22
13
  ],
14
+ "type": "module",
15
+ "sideEffects": [
16
+ "**/*.css",
17
+ "**/i18n.js"
18
+ ],
19
+ "typesVersions": {
20
+ "*": {
21
+ "*": [
22
+ "dist/*"
23
+ ]
24
+ }
25
+ },
23
26
  "exports": {
24
27
  "./registry": {
25
28
  "types": "./dist/registry.d.ts",
@@ -56,55 +59,46 @@
56
59
  },
57
60
  "dependencies": {
58
61
  "@fortawesome/fontawesome-free": "^7.3.1",
59
- "i18next": "^25.10.10",
60
62
  "next-themes": "0.4.6",
61
- "react-i18next": "^16.6.6",
62
63
  "tw-animate-css": "1.4.0"
63
64
  },
64
- "peerDependencies": {
65
- "@ekanos/sdk": "^0.2.0",
66
- "@ekanos/ui": "^0.2.0",
67
- "@tanstack/react-query": "^5.101.4",
68
- "next": "^16.0.0",
69
- "react": "^19.2.8",
70
- "react-dom": "^19.2.8",
71
- "react-hook-form": "^7.68.0",
72
- "tailwindcss": "^4.0.0"
73
- },
74
65
  "devDependencies": {
75
- "@ekanos/sdk": "0.2.0",
76
- "@ekanos/ui": "0.2.0",
77
- "@kit/eslint-config": "0.2.0",
78
- "@kit/prettier-config": "0.1.0",
66
+ "@ekanos/sdk": "0.4.0",
67
+ "@ekanos/ui": "0.4.0",
79
68
  "@kit/tsconfig": "0.1.0",
80
69
  "@tailwindcss/postcss": "4.3.3",
81
- "@tanstack/react-query": "5.102.8",
70
+ "@tanstack/react-query": "5.103.2",
82
71
  "@types/node": "25.0.1",
83
72
  "@types/react": "19.2.18",
84
73
  "@types/react-dom": "19.2.5",
85
- "next": "16.3.3",
74
+ "next": "16.3.6",
75
+ "next-intl": "^4.14.7",
86
76
  "react": "19.2.8",
87
77
  "react-dom": "19.2.8",
88
- "react-hook-form": "^7.87.0",
78
+ "react-hook-form": "^7.88.0",
89
79
  "tailwindcss": "4.3.3",
90
80
  "tsup": "8.5.1",
91
- "typescript": "^5.9.3",
81
+ "typescript": "^7.0.2",
92
82
  "vitest": "4.1.10",
93
- "zod": "3.25.76"
83
+ "zod": "4.6.5"
94
84
  },
95
- "prettier": "@kit/prettier-config",
96
- "typesVersions": {
97
- "*": {
98
- "*": [
99
- "dist/*"
100
- ]
101
- }
85
+ "peerDependencies": {
86
+ "@ekanos/sdk": "^0.4.0",
87
+ "@ekanos/ui": "^0.4.0",
88
+ "@tanstack/react-query": "^5.101.4",
89
+ "next": "^16.0.0",
90
+ "next-intl": "^4.14.7",
91
+ "react": "^19.2.8",
92
+ "react-dom": "^19.2.8",
93
+ "react-hook-form": "^7.68.0",
94
+ "tailwindcss": "^4.0.0"
95
+ },
96
+ "ekanos": {
97
+ "shellContract": 2
102
98
  },
103
99
  "scripts": {
104
100
  "build": "tsup && tsc -p tsconfig.build.json && node scripts/rewrite-esm-specifiers.mjs && node scripts/build-css.mjs",
105
101
  "clean": "git clean -xdf .turbo node_modules dist",
106
- "format": "prettier --check \"**/*.{ts,tsx,mjs}\"",
107
- "lint": "eslint .",
108
102
  "typecheck": "tsc --noEmit",
109
103
  "test": "vitest run --config vitest.config.ts",
110
104
  "pack:test": "node scripts/pack-test.mjs"
@@ -1,2 +0,0 @@
1
- import i18next from 'i18next';
2
- export default i18next;
@@ -1,17 +0,0 @@
1
- "use client";
2
- import i18next from "i18next";
3
- import { initReactI18next } from "react-i18next";
4
- if (!i18next.isInitialized) {
5
- void i18next.use(initReactI18next).init({
6
- lng: "en",
7
- fallbackLng: "en",
8
- supportedLngs: ["en"],
9
- resources: { en: {} },
10
- interpolation: { escapeValue: false },
11
- react: { useSuspense: false }
12
- });
13
- }
14
- var i18n_default = i18next;
15
- export {
16
- i18n_default as default
17
- };