@ekanos/harness 0.1.5 → 0.2.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 (42) hide show
  1. package/README.md +175 -79
  2. package/dist/api.d.ts +42 -0
  3. package/dist/api.js +17 -0
  4. package/dist/internal/components/dev-toolbar.js +4 -2
  5. package/dist/internal/components/harness-providers.js +1 -0
  6. package/dist/internal/components/local-oauth-panel.d.ts +29 -0
  7. package/dist/internal/components/local-oauth-panel.js +355 -0
  8. package/dist/internal/lib/harness-fetch-interceptor.d.ts +33 -13
  9. package/dist/internal/lib/harness-fetch-interceptor.js +10 -0
  10. package/dist/internal/lib/oauth-setup-guide.d.ts +43 -0
  11. package/dist/internal/lib/oauth-setup-guide.js +28 -0
  12. package/dist/internal/lib/original-fetch.d.ts +36 -0
  13. package/dist/internal/lib/original-fetch.js +23 -0
  14. package/dist/internal/lib/run-activation-hook.d.ts +2 -8
  15. package/dist/internal/lib/toolbar-context.d.ts +7 -3
  16. package/dist/internal/lib/toolbar-context.js +10 -5
  17. package/dist/internal/lib/trigger-contract.d.ts +99 -0
  18. package/dist/internal/lib/trigger-contract.js +25 -0
  19. package/dist/internal/lib/trigger-runner.d.ts +55 -0
  20. package/dist/internal/lib/trigger-runner.js +153 -0
  21. package/dist/internal/routes/activation-page.js +42 -28
  22. package/dist/internal/routes/integration-layout.js +5 -1
  23. package/dist/internal/routes/triggers-page.js +121 -147
  24. package/dist/internal/server/api-router.d.ts +42 -0
  25. package/dist/internal/server/api-router.js +465 -0
  26. package/dist/internal/server/live-context.d.ts +93 -0
  27. package/dist/internal/server/live-context.js +93 -0
  28. package/dist/internal/server/local-secrets.d.ts +84 -0
  29. package/dist/internal/server/local-secrets.js +144 -0
  30. package/dist/internal/server/loopback-guard.d.ts +33 -0
  31. package/dist/internal/server/loopback-guard.js +38 -0
  32. package/dist/internal/server/nonce-store.d.ts +38 -0
  33. package/dist/internal/server/nonce-store.js +40 -0
  34. package/dist/internal/server/oauth-loop.d.ts +114 -0
  35. package/dist/internal/server/oauth-loop.js +141 -0
  36. package/dist/internal/server/project-root.d.ts +29 -0
  37. package/dist/internal/server/project-root.js +31 -0
  38. package/dist/internal/server/storage-read.d.ts +34 -0
  39. package/dist/internal/server/storage-read.js +53 -0
  40. package/dist/registry.d.ts +73 -1
  41. package/dist/registry.js +21 -1
  42. package/package.json +10 -3
@@ -0,0 +1,99 @@
1
+ /**
2
+ * The wire and render contract shared by the Triggers/Activation surfaces and
3
+ * the harness's own `POST /api/integrations/[slug]/trigger` route.
4
+ *
5
+ * In FIXTURES mode the pages run handlers in the browser against a per-mount
6
+ * mock context and build these shapes locally. In LIVE mode they post to the
7
+ * route, which runs the same helpers against the server-held live context —
8
+ * the one `onTokens` stored real tokens in — and answers with the same shapes.
9
+ * One contract, so a panel cannot render one mode differently from the other.
10
+ *
11
+ * Directive-free: imported by client pages and by the server route.
12
+ */
13
+ export interface HandlerLog {
14
+ level: string;
15
+ message: string;
16
+ }
17
+ export interface StorageDump {
18
+ account: Record<string, unknown>;
19
+ user: Record<string, unknown>;
20
+ }
21
+ /** The outcome of one webhook delivery or schedule run. */
22
+ export interface InvocationOutcome {
23
+ ok: boolean;
24
+ summary: string;
25
+ detail?: string;
26
+ logs: readonly HandlerLog[];
27
+ /**
28
+ * BOTH scopes. `ctx.dumpStorage()` returns `{ account, user }`, and this
29
+ * panel used to render only `account` — so a handler writing to user scope
30
+ * looked like a handler that had written nothing.
31
+ */
32
+ storage: StorageDump;
33
+ }
34
+ /** The outcome of one `onActivate` run — see `run-activation-hook.ts`. */
35
+ export type OnActivateOutcome = {
36
+ status: 'skipped';
37
+ } | {
38
+ status: 'ran';
39
+ } | {
40
+ status: 'threw';
41
+ message: string;
42
+ };
43
+ export type TriggerRequest = {
44
+ kind: 'webhook';
45
+ id: string;
46
+ payload: unknown;
47
+ /** Delivery headers. Defaults to the local transport's unverified marker. */
48
+ headers?: Record<string, string>;
49
+ } | {
50
+ kind: 'schedule';
51
+ id: string;
52
+ } | {
53
+ kind: 'activate';
54
+ };
55
+ export type TriggerResponse = {
56
+ kind: 'webhook' | 'schedule';
57
+ outcome: InvocationOutcome;
58
+ /** Names only — never values. */
59
+ secretNames: string[];
60
+ } | {
61
+ kind: 'activate';
62
+ outcome: OnActivateOutcome;
63
+ logs: readonly HandlerLog[];
64
+ storage: StorageDump;
65
+ secretNames: string[];
66
+ };
67
+ /** The setup readout behind `GET /api/integrations/[slug]/local-setup`. */
68
+ export interface LocalSetupResponse {
69
+ slug: string;
70
+ /** The credentials file, relative to the project root. */
71
+ file: string;
72
+ /** Absolute, for copying into an editor. */
73
+ absolutePath: string;
74
+ /** `null` when the definition declares no `oauth`. */
75
+ redirectUri: string | null;
76
+ keys: {
77
+ name: string;
78
+ filled: boolean;
79
+ }[];
80
+ connected: boolean;
81
+ connection: {
82
+ obtainedAt: string;
83
+ expiresAt: string | null;
84
+ scope: string | null;
85
+ } | null;
86
+ /** Always true today: the connection lives in server memory only. */
87
+ volatile: true;
88
+ }
89
+ /**
90
+ * `PUT /api/integrations/[slug]/local-setup` — the Local OAuth panel's Save.
91
+ * Values travel browser → dev server over loopback ONCE, are written to
92
+ * `.ekanos/local-secrets.json`, and never come back: the response is the same
93
+ * `LocalSetupResponse` the GET returns, filled/missing only.
94
+ */
95
+ export interface LocalSetupWriteRequest {
96
+ values: Record<string, string>;
97
+ }
98
+ export declare function isLocalSetupWriteRequest(value: unknown): value is LocalSetupWriteRequest;
99
+ export declare function isTriggerRequest(value: unknown): value is TriggerRequest;
@@ -0,0 +1,25 @@
1
+ function isLocalSetupWriteRequest(value) {
2
+ if (typeof value !== "object" || value === null) return false;
3
+ const values = value.values;
4
+ return typeof values === "object" && values !== null && !Array.isArray(values) && Object.values(values).every(
5
+ (v) => typeof v === "string"
6
+ );
7
+ }
8
+ function isTriggerRequest(value) {
9
+ if (typeof value !== "object" || value === null) return false;
10
+ const record = value;
11
+ switch (record.kind) {
12
+ case "webhook":
13
+ return typeof record.id === "string" && (record.headers === void 0 || typeof record.headers === "object" && record.headers !== null);
14
+ case "schedule":
15
+ return typeof record.id === "string";
16
+ case "activate":
17
+ return true;
18
+ default:
19
+ return false;
20
+ }
21
+ }
22
+ export {
23
+ isLocalSetupWriteRequest,
24
+ isTriggerRequest
25
+ };
@@ -0,0 +1,55 @@
1
+ import type { IntegrationDefinition } from '@ekanos/sdk/integration';
2
+ import { type MockIntegrationContext } from '@ekanos/sdk/testing';
3
+ import type { InvocationOutcome, LocalSetupResponse, LocalSetupWriteRequest, OnActivateOutcome } from './trigger-contract.js';
4
+ /**
5
+ * ─────────────────────────────────────────────────────────────────────────────
6
+ * ONE WAY TO RUN A HANDLER, TWO PLACES IT CAN RUN
7
+ * ─────────────────────────────────────────────────────────────────────────────
8
+ *
9
+ * The Triggers and Activation surfaces used to hold a per-mount mock context
10
+ * and call `invokeWebhook`/`invokeSchedule`/`invokeActivate` on it directly.
11
+ * That is still exactly right for FIXTURES mode. It is wrong for LIVE mode,
12
+ * where the context that holds the real tokens lives on the SERVER
13
+ * (`internal/server/live-context.ts`) — a browser-side context would run the
14
+ * partner's schedule with no credentials and report a confident "skipped".
15
+ *
16
+ * So the pages ask a `TriggerRunner` and never touch a context themselves:
17
+ *
18
+ * createLocalTriggerRunner(definition, ctx) fixtures — in the browser
19
+ * createServerTriggerRunner(slug) live — POST …/trigger
20
+ *
21
+ * Both return the SAME outcome shapes (`trigger-contract.ts`), so the panels
22
+ * render identically whichever ran.
23
+ */
24
+ export interface TriggerRunner {
25
+ webhook(id: string, payload: unknown, headers?: Record<string, string>): Promise<InvocationOutcome>;
26
+ schedule(id: string): Promise<InvocationOutcome>;
27
+ activate(): Promise<OnActivateOutcome>;
28
+ }
29
+ /** Fixtures mode: run against the per-mount browser context. */
30
+ export declare function createLocalTriggerRunner(definition: IntegrationDefinition, ctx: MockIntegrationContext): TriggerRunner;
31
+ export declare function triggerUrl(slug: string): string;
32
+ export declare function localSetupUrl(slug: string): string;
33
+ /**
34
+ * A harness API error, with the server's own message when it sent one — the
35
+ * loopback refusal and the project-root failure both explain themselves, and
36
+ * that explanation must reach the panel rather than a bare status code.
37
+ */
38
+ export declare class HarnessApiError extends Error {
39
+ readonly status: number;
40
+ constructor(status: number, message: string);
41
+ }
42
+ /**
43
+ * Live mode: run on the server-held live context. The request goes through
44
+ * `globalThis.fetch`, which the interceptor passes through for the active
45
+ * integration's `/api/integrations/<slug>/` paths in live mode.
46
+ */
47
+ export declare function createServerTriggerRunner(slug: string, fetchImpl?: typeof globalThis.fetch): TriggerRunner;
48
+ /** The setup readout for the Local OAuth panel. Live mode only. */
49
+ export declare function fetchLocalSetup(slug: string, fetchImpl?: typeof globalThis.fetch): Promise<LocalSetupResponse>;
50
+ /**
51
+ * The Local OAuth panel's Save: write declared secret values into
52
+ * `.ekanos/local-secrets.json` through the dev server. The values leave the
53
+ * browser exactly once, to loopback; the response reports filled/missing.
54
+ */
55
+ export declare function saveLocalSetup(slug: string, request: LocalSetupWriteRequest, fetchImpl?: typeof globalThis.fetch): Promise<LocalSetupResponse>;
@@ -0,0 +1,153 @@
1
+ import {
2
+ invokeSchedule,
3
+ invokeWebhook
4
+ } from "@ekanos/sdk/testing";
5
+ import { runOnActivateHook } from "./run-activation-hook.js";
6
+ function describeError(error) {
7
+ return error instanceof Error ? error.message : String(error);
8
+ }
9
+ function createLocalTriggerRunner(definition, ctx) {
10
+ const run = async (invoke) => {
11
+ const logsBefore = ctx.logs.length;
12
+ try {
13
+ const result = await invoke();
14
+ return {
15
+ ok: true,
16
+ summary: result.status,
17
+ ...result.detail ? { detail: result.detail } : {},
18
+ logs: ctx.logs.slice(logsBefore),
19
+ storage: ctx.dumpStorage()
20
+ };
21
+ } catch (error) {
22
+ console.error("[harness] handler invocation failed:", error);
23
+ return {
24
+ ok: false,
25
+ summary: "failed",
26
+ detail: describeError(error),
27
+ logs: ctx.logs.slice(logsBefore),
28
+ storage: ctx.dumpStorage()
29
+ };
30
+ }
31
+ };
32
+ return {
33
+ webhook: (id, payload, headers) => run(async () => {
34
+ const webhook = definition.webhooks?.find((w) => w.id === id);
35
+ const { result } = await invokeWebhook(definition, id, payload, {
36
+ context: ctx,
37
+ headers: headers ?? (!webhook || webhook.signature === "none" ? {} : {
38
+ [webhook.signature.header]: "(unverified \u2014 local transport)"
39
+ })
40
+ });
41
+ return result;
42
+ }),
43
+ schedule: (id) => run(async () => {
44
+ const { result } = await invokeSchedule(definition, id, {
45
+ context: ctx
46
+ });
47
+ return result;
48
+ }),
49
+ activate: () => runOnActivateHook(definition, ctx)
50
+ };
51
+ }
52
+ function triggerUrl(slug) {
53
+ return `/api/integrations/${slug}/trigger`;
54
+ }
55
+ function localSetupUrl(slug) {
56
+ return `/api/integrations/${slug}/local-setup`;
57
+ }
58
+ class HarnessApiError extends Error {
59
+ constructor(status, message) {
60
+ super(message);
61
+ this.status = status;
62
+ this.name = "HarnessApiError";
63
+ }
64
+ }
65
+ async function readError(response) {
66
+ let message = `${response.status} ${response.statusText}`;
67
+ try {
68
+ const body = await response.json();
69
+ const detail = [body.message, body.hint].filter((part) => typeof part === "string").join(" ");
70
+ if (detail) message = `${message} \u2014 ${detail}`;
71
+ else if (typeof body.error === "string")
72
+ message = `${message} \u2014 ${body.error}`;
73
+ } catch {
74
+ }
75
+ return new HarnessApiError(response.status, message);
76
+ }
77
+ function createServerTriggerRunner(slug, fetchImpl = (input, init) => globalThis.fetch(input, init)) {
78
+ const post = async (request) => {
79
+ const response = await fetchImpl(triggerUrl(slug), {
80
+ method: "POST",
81
+ headers: {
82
+ "content-type": "application/json",
83
+ accept: "application/json"
84
+ },
85
+ body: JSON.stringify(request)
86
+ });
87
+ if (!response.ok) throw await readError(response);
88
+ return await response.json();
89
+ };
90
+ const invocation = async (request) => {
91
+ try {
92
+ const result = await post(request);
93
+ if (result.kind === "activate") {
94
+ throw new Error("trigger route answered the wrong kind");
95
+ }
96
+ return result.outcome;
97
+ } catch (error) {
98
+ console.error("[harness] server trigger failed:", error);
99
+ return {
100
+ ok: false,
101
+ summary: "failed",
102
+ detail: describeError(error),
103
+ logs: [],
104
+ storage: { account: {}, user: {} }
105
+ };
106
+ }
107
+ };
108
+ return {
109
+ webhook: (id, payload, headers) => invocation({
110
+ kind: "webhook",
111
+ id,
112
+ payload,
113
+ ...headers ? { headers } : {}
114
+ }),
115
+ schedule: (id) => invocation({ kind: "schedule", id }),
116
+ activate: async () => {
117
+ try {
118
+ const result = await post({ kind: "activate" });
119
+ return result.kind === "activate" ? result.outcome : {
120
+ status: "threw",
121
+ message: "trigger route answered the wrong kind"
122
+ };
123
+ } catch (error) {
124
+ return { status: "threw", message: describeError(error) };
125
+ }
126
+ }
127
+ };
128
+ }
129
+ async function fetchLocalSetup(slug, fetchImpl = (input, init) => globalThis.fetch(input, init)) {
130
+ const response = await fetchImpl(localSetupUrl(slug), {
131
+ headers: { accept: "application/json" }
132
+ });
133
+ if (!response.ok) throw await readError(response);
134
+ return await response.json();
135
+ }
136
+ async function saveLocalSetup(slug, request, fetchImpl = (input, init) => globalThis.fetch(input, init)) {
137
+ const response = await fetchImpl(localSetupUrl(slug), {
138
+ method: "PUT",
139
+ headers: { "content-type": "application/json", accept: "application/json" },
140
+ body: JSON.stringify(request)
141
+ });
142
+ if (!response.ok) throw await readError(response);
143
+ return await response.json();
144
+ }
145
+ export {
146
+ HarnessApiError,
147
+ createLocalTriggerRunner,
148
+ createServerTriggerRunner,
149
+ fetchLocalSetup,
150
+ localSetupUrl,
151
+ saveLocalSetup,
152
+ triggerUrl
153
+ };
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { useState } from "react";
3
+ import { useMemo, useState } from "react";
4
4
  import { notFound } from "next/navigation";
5
5
  import { Alert, AlertDescription, AlertTitle } from "@ekanos/ui/alert";
6
6
  import { Badge } from "@ekanos/ui/badge";
@@ -13,6 +13,7 @@ import {
13
13
  DialogTitle
14
14
  } from "@ekanos/ui/dialog";
15
15
  import { HARNESS_ACCOUNT_ID } from "../../registry.js";
16
+ import { LocalOAuthPanel } from "../components/local-oauth-panel.js";
16
17
  import { useDefinitionMockContext } from "../lib/definition-mock-context.js";
17
18
  import {
18
19
  useHarnessDataMode,
@@ -20,20 +21,25 @@ import {
20
21
  } from "../lib/harness-hooks.js";
21
22
  import { clearLiveActivationData } from "../lib/live-activation-store.js";
22
23
  import { hasSensitiveValues, redactSensitive } from "../lib/redact.js";
23
- import {
24
- runOnActivateHook
25
- } from "../lib/run-activation-hook.js";
26
24
  import { useToolbar } from "../lib/toolbar-context.js";
25
+ import {
26
+ createLocalTriggerRunner,
27
+ createServerTriggerRunner
28
+ } from "../lib/trigger-runner.js";
27
29
  import { useHarnessIntegration } from "../registry-context.js";
28
30
  function ActivationPage() {
29
- const [flow, setFlow] = useState({
30
- open: true,
31
+ const integration = useHarnessIntegration();
32
+ const [flow, setFlow] = useState(() => ({
33
+ // An OAuth integration starts with the dialog CLOSED: its Connect button
34
+ // needs the Local OAuth credentials saved first, and the panel that takes
35
+ // them sits on this page — under a modal backdrop if the dialog opened
36
+ // on top of it. Everything else opens straight into the connect flow.
37
+ open: !integration?.definition?.oauth,
31
38
  connected: false,
32
39
  result: null,
33
40
  revealed: false,
34
41
  activationHook: null
35
- });
36
- const integration = useHarnessIntegration();
42
+ }));
37
43
  const { state: toolbar } = useToolbar();
38
44
  const mode = useHarnessDataMode();
39
45
  const activationData = useLiveActivationData();
@@ -41,9 +47,14 @@ function ActivationPage() {
41
47
  integration ?? { slug: "", name: "", description: "", widgets: [] },
42
48
  toolbar.variant
43
49
  );
50
+ const definition = integration?.definition;
51
+ const runner = useMemo(() => {
52
+ if (!integration || !definition) return null;
53
+ if (mode === "live") return createServerTriggerRunner(integration.slug);
54
+ return ctx ? createLocalTriggerRunner(definition, ctx) : null;
55
+ }, [integration, definition, mode, ctx]);
44
56
  if (!integration) notFound();
45
57
  const ActivationForm = integration.activationForm;
46
- const definition = integration.definition;
47
58
  const capabilities = definition?.capabilities ?? [];
48
59
  const permissions = definition?.permissions ?? [];
49
60
  const summary = definition?.description ?? integration.description;
@@ -54,30 +65,24 @@ function ActivationPage() {
54
65
  "data-test": "activation",
55
66
  children: [
56
67
  /* @__PURE__ */ jsxs(Alert, { children: [
57
- /* @__PURE__ */ jsx(AlertTitle, { children: "Submissions go nowhere" }),
68
+ /* @__PURE__ */ jsx(AlertTitle, { children: mode === "live" ? "Submissions run onActivate on the dev server" : "Submissions go nowhere" }),
58
69
  /* @__PURE__ */ jsxs(AlertDescription, { children: [
59
70
  /* @__PURE__ */ jsxs("p", { children: [
60
- "The harness has no backend. Submitting shows you the",
71
+ "The harness has no Fusion backend. Submitting shows you the",
61
72
  " ",
62
73
  /* @__PURE__ */ jsx("code", { children: "ActivationResult" }),
63
- " your form handed back instead of posting it \u2014 which is the part worth checking, since that payload is what the real activation action would persist. The dialog, the capability and permission sections and the connected state are the real ones, rendered from your ",
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 ",
64
75
  /* @__PURE__ */ jsx("code", { children: "defineIntegration()" }),
65
76
  " ",
66
77
  "declaration."
67
78
  ] }),
68
- /* @__PURE__ */ jsxs("p", { children: [
69
- /* @__PURE__ */ jsx("code", { children: "onActivate" }),
70
- " below always runs against this mock context, live toggle or not \u2014 its network calls never leave your machine here. A widget on this integration is different: it already reaches real vendors through",
71
- " ",
72
- /* @__PURE__ */ jsx("code", { children: "useIntegrationFetch()" }),
73
- " once you flip the toolbar to Live API. Both reach real systems for real only after you publish to the dev host."
74
- ] })
79
+ /* @__PURE__ */ jsx("p", { "data-test": "activation-mode-notice-top", children: mode === "live" ? "Live API: an OAuth form\u2019s Connect runs the real loop through the generated shell (see Local OAuth below), onActivate runs on the server-held context that loop stored tokens in, and widgets reach real vendors through useIntegrationFetch(). The host runs the same declarations, with real enforcement, after you publish." : "Fixtures: an OAuth form reads its connection status from oauth.connected in your harness entry, onActivate runs in this browser against a context seeded from triggerMocks, and nothing leaves your machine." })
75
80
  ] })
76
81
  ] }),
77
82
  /* @__PURE__ */ jsxs("div", { className: "bg-card flex flex-wrap items-center justify-between gap-3 rounded-lg border p-5", children: [
78
83
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
79
84
  /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: flow.connected ? "Connected" : "Not connected" }),
80
- /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-sm", children: flow.connected ? "The dialog now shows the manage view, whose only action is Disconnect." : "The dialog shows the scope disclosure and your activation form." })
85
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-sm", children: flow.connected ? "The dialog now shows the manage view, whose only action is Disconnect." : definition?.oauth ? "Save your local OAuth credentials below, then open the connect dialog and click Connect." : "The dialog shows the scope disclosure and your activation form." })
81
86
  ] }),
82
87
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
83
88
  /* @__PURE__ */ jsx(
@@ -110,6 +115,15 @@ function ActivationPage() {
110
115
  )
111
116
  ] })
112
117
  ] }),
118
+ definition ? /* @__PURE__ */ jsx(
119
+ LocalOAuthPanel,
120
+ {
121
+ integration,
122
+ definition,
123
+ mode,
124
+ variant: toolbar.variant
125
+ }
126
+ ) : null,
113
127
  ActivationForm ? /* @__PURE__ */ jsx(
114
128
  Dialog,
115
129
  {
@@ -156,10 +170,7 @@ function ActivationPage() {
156
170
  productSlug: integration.slug,
157
171
  inline: true,
158
172
  onSuccess: async (result) => {
159
- const activationHook = await runOnActivateHook(
160
- definition,
161
- ctx
162
- );
173
+ const activationHook = runner ? await runner.activate() : { status: "skipped" };
163
174
  setFlow({
164
175
  open: false,
165
176
  connected: true,
@@ -224,12 +235,15 @@ function ActivationPage() {
224
235
  2
225
236
  ) })
226
237
  ] }) : null,
227
- flow.activationHook ? /* @__PURE__ */ jsx(OnActivatePanel, { outcome: flow.activationHook }) : null
238
+ flow.activationHook ? /* @__PURE__ */ jsx(OnActivatePanel, { outcome: flow.activationHook, mode }) : null
228
239
  ]
229
240
  }
230
241
  );
231
242
  }
232
- function OnActivatePanel({ outcome }) {
243
+ function OnActivatePanel({
244
+ outcome,
245
+ mode
246
+ }) {
233
247
  const badge = outcome.status === "ran" ? { variant: "default", label: "onActivate ran" } : outcome.status === "skipped" ? {
234
248
  variant: "secondary",
235
249
  label: "onActivate skipped \u2014 not declared"
@@ -250,7 +264,7 @@ function OnActivatePanel({ outcome }) {
250
264
  ] }) : outcome.status === "threw" ? /* @__PURE__ */ jsxs(Fragment, { children: [
251
265
  /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "In production this is NON-FATAL: the throw is logged and shown to the user as a warning, and the activation stays connected \u2014 this hook is for cache seeding and eager validation, not a connect gate." }),
252
266
  /* @__PURE__ */ jsx("pre", { className: "bg-muted overflow-x-auto rounded-md p-3 text-xs", children: outcome.message })
253
- ] }) : /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Ran against the same kind of capability context (storage, secrets, egress) your schedules and webhooks run against." })
267
+ ] }) : /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: mode === "live" ? "Ran on the dev server against the live context \u2014 the same storage and secrets the OAuth loop and your schedules use, with ctx.fetch reaching your vendor under the declared egress." : "Ran against the same kind of capability context (storage, secrets, egress) your schedules and webhooks run against." })
254
268
  ]
255
269
  }
256
270
  );
@@ -308,7 +322,7 @@ function ConnectedState({
308
322
  {
309
323
  className: "text-muted-foreground text-sm",
310
324
  "data-test": "activation-mode-notice",
311
- 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, but this activation submitted no data for live-mode widgets to authenticate with." : "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 Fusion-mocked; widgets read fixtures \u2014 switch the toolbar to Live API to exercise real requests."
312
326
  }
313
327
  ),
314
328
  /* @__PURE__ */ jsx(
@@ -5,6 +5,7 @@ import { notFound } from "next/navigation";
5
5
  import { Alert, AlertDescription, AlertTitle } from "@ekanos/ui/alert";
6
6
  import {
7
7
  findEgressMismatch,
8
+ oauthStatusFixtures,
8
9
  resolveEffectiveDataMode,
9
10
  resolveEgress,
10
11
  seedsForMode
@@ -32,7 +33,10 @@ function IntegrationLayout({ children }) {
32
33
  );
33
34
  const httpFixtures = useMemo(() => {
34
35
  if (!integration) return [];
35
- const declared = integration.fixtures?.[state.variant] ?? [];
36
+ const declared = [
37
+ ...integration.fixtures?.[state.variant] ?? [],
38
+ ...oauthStatusFixtures(integration, state.variant)
39
+ ];
36
40
  const selfOrigin = globalThis.location?.origin;
37
41
  if (selfOrigin !== void 0) {
38
42
  return compileFixtures(declared, egress, selfOrigin);