@ekanos/harness 0.25.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -4
- package/dist/api-types.d.ts +102 -0
- package/dist/internal/components/approvals-tray.js +1 -1
- package/dist/internal/components/ask-assistant-bridge.js +2 -8
- package/dist/internal/components/connect-panel.js +414 -20
- package/dist/internal/components/dev-toolbar.js +3 -3
- package/dist/internal/components/docs-link.js +1 -1
- package/dist/internal/components/integration-badge.js +2 -2
- package/dist/internal/components/local-oauth-panel.js +28 -2
- package/dist/internal/components/provenance-banner.js +2 -2
- package/dist/internal/components/runtime-strip.js +33 -5
- package/dist/internal/components/schema-form.js +1 -1
- package/dist/internal/components/surface-nav.d.ts +3 -2
- package/dist/internal/components/surface-nav.js +41 -52
- package/dist/internal/components/widget-boundary.js +1 -7
- package/dist/internal/lib/console-client.d.ts +22 -5
- package/dist/internal/lib/console-client.js +32 -6
- package/dist/internal/lib/console-context.js +14 -2
- package/dist/internal/lib/console-types.d.ts +11 -1
- package/dist/internal/lib/experience-runtime.d.ts +21 -0
- package/dist/internal/lib/experience-runtime.js +18 -1
- package/dist/internal/lib/integration-console-href.d.ts +10 -0
- package/dist/internal/lib/integration-console-href.js +10 -0
- package/dist/internal/lib/oauth-connect-href.d.ts +9 -0
- package/dist/internal/lib/oauth-connect-href.js +14 -0
- package/dist/internal/lib/run-log-view.js +1 -0
- package/dist/internal/lib/trigger-contract.d.ts +19 -0
- package/dist/internal/lib/trigger-runner.js +4 -1
- package/dist/internal/routes/experience-connect-page.js +5 -5
- package/dist/internal/routes/experience-page-host.d.ts +5 -1
- package/dist/internal/routes/experience-page-host.js +8 -7
- package/dist/internal/routes/experience-summary-page.js +9 -12
- package/dist/internal/routes/repo-home-page.js +1 -1
- package/dist/internal/routes/repo-layout.js +2 -4
- package/dist/internal/routes/root-layout.d.ts +0 -1
- package/dist/internal/routes/root-layout.js +2 -4
- package/dist/internal/routes/tile-page.js +1 -1
- package/dist/internal/routes/triggers-page.js +30 -2
- package/dist/internal/server/activation-credentials.d.ts +26 -0
- package/dist/internal/server/activation-credentials.js +56 -0
- package/dist/internal/server/api-router.js +63 -5
- package/dist/internal/server/console-state.d.ts +25 -0
- package/dist/internal/server/console-state.js +44 -0
- package/dist/internal/server/ekanos-api-router.js +188 -9
- package/dist/internal/server/live-context.js +2 -1
- package/dist/internal/server/live-invoker.js +10 -2
- package/dist/internal/server/local-secrets.d.ts +47 -0
- package/dist/internal/server/local-secrets.js +111 -2
- package/dist/internal/server/local-state.d.ts +8 -2
- package/dist/internal/server/local-state.js +26 -9
- package/dist/internal/server/nonce-store.d.ts +2 -0
- package/dist/internal/server/oauth-connections.d.ts +45 -0
- package/dist/internal/server/oauth-connections.js +69 -0
- package/dist/internal/server/oauth-loop.d.ts +1 -1
- package/dist/internal/server/oauth-loop.js +4 -1
- package/dist/internal/server/oauth-persistence.d.ts +13 -0
- package/dist/internal/server/oauth-persistence.js +28 -0
- package/dist/internal/server/operation-runner.js +21 -1
- package/dist/internal/server/person-context.d.ts +35 -0
- package/dist/internal/server/person-context.js +115 -0
- package/dist/internal/server/repo-api-router.js +20 -7
- package/dist/internal/server/semantics.d.ts +1 -1
- package/dist/internal/surfaces.d.ts +1 -1
- package/dist/internal/surfaces.js +4 -4
- package/dist/registry.d.ts +7 -0
- package/dist/registry.js +4 -0
- package/dist/styles.css +3 -8
- package/package.json +11 -11
|
@@ -20,7 +20,121 @@ import {
|
|
|
20
20
|
useConnection,
|
|
21
21
|
useConsoleMutation
|
|
22
22
|
} from "../lib/console-hooks.js";
|
|
23
|
+
import { oauthConnectHref } from "../lib/oauth-connect-href.js";
|
|
23
24
|
import { ConnectionChip } from "./connection-chip.js";
|
|
25
|
+
const LEVEL_LABEL = {
|
|
26
|
+
source: "For the Source",
|
|
27
|
+
team: "For the team",
|
|
28
|
+
user: "For you"
|
|
29
|
+
};
|
|
30
|
+
function LevelBadge({
|
|
31
|
+
level,
|
|
32
|
+
testId
|
|
33
|
+
}) {
|
|
34
|
+
return /* @__PURE__ */ jsx(StatusBadge, { tone: "neutral", "data-test": testId, children: LEVEL_LABEL[level] });
|
|
35
|
+
}
|
|
36
|
+
function TierSwitch({
|
|
37
|
+
label,
|
|
38
|
+
value,
|
|
39
|
+
options,
|
|
40
|
+
testId,
|
|
41
|
+
disabled,
|
|
42
|
+
onChange
|
|
43
|
+
}) {
|
|
44
|
+
return /* @__PURE__ */ jsxs(
|
|
45
|
+
"div",
|
|
46
|
+
{
|
|
47
|
+
className: "flex flex-wrap items-center gap-2",
|
|
48
|
+
role: "group",
|
|
49
|
+
"aria-label": label,
|
|
50
|
+
"data-test": testId,
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: label }),
|
|
53
|
+
options.map((option) => /* @__PURE__ */ jsx(
|
|
54
|
+
Button,
|
|
55
|
+
{
|
|
56
|
+
type: "button",
|
|
57
|
+
size: "sm",
|
|
58
|
+
variant: option.value === value ? "secondary" : "ghost",
|
|
59
|
+
"aria-pressed": option.value === value,
|
|
60
|
+
disabled,
|
|
61
|
+
"data-test": `${testId}-${option.value}`,
|
|
62
|
+
onClick: () => {
|
|
63
|
+
if (option.value !== value) onChange(option.value);
|
|
64
|
+
},
|
|
65
|
+
children: option.label
|
|
66
|
+
},
|
|
67
|
+
option.value
|
|
68
|
+
))
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
const CONNECT_AS_OPTIONS = [
|
|
74
|
+
{ value: "me", label: "Me" },
|
|
75
|
+
{ value: "team", label: "The team" }
|
|
76
|
+
];
|
|
77
|
+
const RUN_AS_OPTIONS = [
|
|
78
|
+
{ value: "me", label: "Me" },
|
|
79
|
+
{ value: "machine", label: "Machine" }
|
|
80
|
+
];
|
|
81
|
+
function ConnectAsSwitch({
|
|
82
|
+
integration,
|
|
83
|
+
credential,
|
|
84
|
+
value,
|
|
85
|
+
testId
|
|
86
|
+
}) {
|
|
87
|
+
const queryClient = useQueryClient();
|
|
88
|
+
const change = useConsoleMutation(
|
|
89
|
+
(c, as) => c.setSwitches(integration, { connectAs: { credential, as } })
|
|
90
|
+
);
|
|
91
|
+
return /* @__PURE__ */ jsx(
|
|
92
|
+
TierSwitch,
|
|
93
|
+
{
|
|
94
|
+
label: "Connect as",
|
|
95
|
+
value,
|
|
96
|
+
options: CONNECT_AS_OPTIONS,
|
|
97
|
+
testId,
|
|
98
|
+
disabled: change.isPending,
|
|
99
|
+
onChange: (as) => change.mutate(as, {
|
|
100
|
+
onSuccess: () => queryClient.invalidateQueries({
|
|
101
|
+
queryKey: consoleKeys.connection(integration)
|
|
102
|
+
})
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
function RunAsSwitch({
|
|
108
|
+
integration,
|
|
109
|
+
value
|
|
110
|
+
}) {
|
|
111
|
+
const queryClient = useQueryClient();
|
|
112
|
+
const change = useConsoleMutation(
|
|
113
|
+
(c, runAs) => c.setSwitches(integration, { runAs })
|
|
114
|
+
);
|
|
115
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex max-w-xl flex-col gap-1", "data-test": "run-as", children: [
|
|
116
|
+
/* @__PURE__ */ jsx(
|
|
117
|
+
TierSwitch,
|
|
118
|
+
{
|
|
119
|
+
label: "Run as",
|
|
120
|
+
value,
|
|
121
|
+
options: RUN_AS_OPTIONS,
|
|
122
|
+
testId: "run-as-switch",
|
|
123
|
+
disabled: change.isPending,
|
|
124
|
+
onChange: (runAs) => change.mutate(runAs, {
|
|
125
|
+
onSuccess: () => queryClient.invalidateQueries({
|
|
126
|
+
queryKey: consoleKeys.connection(integration)
|
|
127
|
+
})
|
|
128
|
+
})
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
/* @__PURE__ */ jsxs("p", { className: "text-muted-foreground text-xs", children: [
|
|
132
|
+
value === "me" ? "Calls act as you, with ctx.identity holding only what you connected as yourself." : "Calls act as a machine: no person, and never a ctx.identity.",
|
|
133
|
+
" ",
|
|
134
|
+
"ctx.secrets stays the team's either way."
|
|
135
|
+
] })
|
|
136
|
+
] });
|
|
137
|
+
}
|
|
24
138
|
function ConnectPanel({
|
|
25
139
|
integration,
|
|
26
140
|
oauth = false,
|
|
@@ -57,6 +171,7 @@ function ConnectPanel({
|
|
|
57
171
|
const noConnectionNeeded = state.facts.state === "no_connection_needed";
|
|
58
172
|
const inDialog = surface === "dialog";
|
|
59
173
|
const dirty = Object.values(drafts).some((value) => value !== "");
|
|
174
|
+
const showActivationForm = state.fields.length === 0 && activationForm;
|
|
60
175
|
return /* @__PURE__ */ jsxs(
|
|
61
176
|
"div",
|
|
62
177
|
{
|
|
@@ -115,6 +230,13 @@ function ConnectPanel({
|
|
|
115
230
|
}
|
|
116
231
|
),
|
|
117
232
|
disconnect.isError ? /* @__PURE__ */ jsx(Alert, { variant: "destructive", children: /* @__PURE__ */ jsx(AlertDescription, { children: disconnect.error.message }) }) : null,
|
|
233
|
+
state.runAs ? /* @__PURE__ */ jsx(
|
|
234
|
+
RunAsSwitch,
|
|
235
|
+
{
|
|
236
|
+
integration: integration.integration,
|
|
237
|
+
value: state.runAs
|
|
238
|
+
}
|
|
239
|
+
) : null,
|
|
118
240
|
/* @__PURE__ */ jsxs(
|
|
119
241
|
"form",
|
|
120
242
|
{
|
|
@@ -140,7 +262,7 @@ function ConnectPanel({
|
|
|
140
262
|
" ",
|
|
141
263
|
/* @__PURE__ */ jsx("code", { title: state.root, children: state.displayRoot ?? state.root })
|
|
142
264
|
] }) : null,
|
|
143
|
-
state.fields.length === 0 && !activationForm ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "This integration declares no keys." }) : null,
|
|
265
|
+
state.fields.length === 0 && !activationForm && (state.activationCredentials ?? []).length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "This integration declares no keys." }) : null,
|
|
144
266
|
state.fields.map((field) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
145
267
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
146
268
|
/* @__PURE__ */ jsx(
|
|
@@ -179,35 +301,307 @@ function ConnectPanel({
|
|
|
179
301
|
]
|
|
180
302
|
}
|
|
181
303
|
),
|
|
182
|
-
|
|
304
|
+
showActivationForm ? /* @__PURE__ */ jsx(
|
|
183
305
|
ActivationConnect,
|
|
184
306
|
{
|
|
185
307
|
integration: integration.integration,
|
|
186
|
-
Form:
|
|
308
|
+
Form: showActivationForm,
|
|
187
309
|
saveLabel: noConnectionNeeded,
|
|
188
310
|
...onChanged ? { onChanged } : {}
|
|
189
311
|
}
|
|
190
312
|
) : null,
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
{
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
313
|
+
!showActivationForm && (state.activationCredentials ?? []).length > 0 ? /* @__PURE__ */ jsx(
|
|
314
|
+
ActivationCredentials,
|
|
315
|
+
{
|
|
316
|
+
integration: integration.integration,
|
|
317
|
+
credentials: state.activationCredentials ?? [],
|
|
318
|
+
...onChanged ? { onChanged } : {}
|
|
319
|
+
}
|
|
320
|
+
) : null,
|
|
321
|
+
oauth ? /* @__PURE__ */ jsx(
|
|
322
|
+
OAuthConnections,
|
|
323
|
+
{
|
|
324
|
+
integration: integration.integration,
|
|
325
|
+
connections: state.oauthConnections ?? [],
|
|
326
|
+
disconnectable: !inDialog,
|
|
327
|
+
...returnPath ? { returnPath } : {},
|
|
328
|
+
...onChanged ? { onChanged } : {}
|
|
329
|
+
}
|
|
330
|
+
) : null
|
|
331
|
+
]
|
|
332
|
+
}
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
function OAuthConnections({
|
|
336
|
+
integration,
|
|
337
|
+
connections,
|
|
338
|
+
disconnectable,
|
|
339
|
+
returnPath,
|
|
340
|
+
onChanged
|
|
341
|
+
}) {
|
|
342
|
+
const queryClient = useQueryClient();
|
|
343
|
+
const disconnect = useConsoleMutation(
|
|
344
|
+
(c, target) => c.disconnect(integration, false, target.connection, target.as)
|
|
345
|
+
);
|
|
346
|
+
const rows = connections.length > 0 ? connections : [
|
|
347
|
+
{
|
|
348
|
+
id: "default",
|
|
349
|
+
label: "Main connection",
|
|
350
|
+
teamApp: false,
|
|
351
|
+
keys: [],
|
|
352
|
+
connected: false,
|
|
353
|
+
obtainedAt: null
|
|
354
|
+
}
|
|
355
|
+
];
|
|
356
|
+
const single = connections.length === 0;
|
|
357
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", "data-test": "oauth-block", children: [
|
|
358
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-medium", children: "OAuth" }),
|
|
359
|
+
/* @__PURE__ */ jsxs("p", { className: "text-muted-foreground text-xs", children: [
|
|
360
|
+
"Runs the real authorize and callback loop on localhost, with your own provider app credentials (save them above first).",
|
|
361
|
+
rows.length > 1 ? " Each connection has its own app, consent and tokens." : ""
|
|
362
|
+
] }),
|
|
363
|
+
disconnect.isError ? /* @__PURE__ */ jsx(Alert, { variant: "destructive", children: /* @__PURE__ */ jsx(AlertDescription, { children: disconnect.error.message }) }) : null,
|
|
364
|
+
rows.map((connection) => {
|
|
365
|
+
const missing = connection.keys.filter((key) => !key.set);
|
|
366
|
+
const params = Object.entries(connection.authorizationParams ?? {});
|
|
367
|
+
return /* @__PURE__ */ jsxs(
|
|
368
|
+
"div",
|
|
369
|
+
{
|
|
370
|
+
className: "flex max-w-xl flex-col gap-2 rounded-md border p-3",
|
|
371
|
+
"data-test": `oauth-connection-${connection.id}`,
|
|
372
|
+
children: [
|
|
373
|
+
single ? null : /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
374
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: connection.label }),
|
|
375
|
+
/* @__PURE__ */ jsx("code", { className: "text-muted-foreground text-xs", children: connection.id }),
|
|
376
|
+
/* @__PURE__ */ jsx(
|
|
377
|
+
StatusBadge,
|
|
378
|
+
{
|
|
379
|
+
tone: connection.connected ? "success" : "neutral",
|
|
380
|
+
children: connection.connected ? "connected" : "not connected"
|
|
381
|
+
}
|
|
382
|
+
),
|
|
383
|
+
/* @__PURE__ */ jsx(
|
|
384
|
+
LevelBadge,
|
|
385
|
+
{
|
|
386
|
+
level: connection.level ?? "team",
|
|
387
|
+
testId: `oauth-connection-level-${connection.id}`
|
|
388
|
+
}
|
|
389
|
+
)
|
|
390
|
+
] }),
|
|
391
|
+
connection.description ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: connection.description }) : null,
|
|
392
|
+
connection.teamApp ? /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground text-xs", children: [
|
|
393
|
+
"The team brings its own app for this connection. Here, its fields are the keys above:",
|
|
394
|
+
" ",
|
|
395
|
+
connection.keys.map((key) => key.label).join(", "),
|
|
396
|
+
"."
|
|
397
|
+
] }) : null,
|
|
398
|
+
params.length > 0 ? /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground text-xs", children: [
|
|
399
|
+
"Sends",
|
|
400
|
+
" ",
|
|
401
|
+
params.map(([key, value]) => /* @__PURE__ */ jsxs("code", { className: "mr-1", children: [
|
|
402
|
+
key,
|
|
403
|
+
"=",
|
|
404
|
+
value
|
|
405
|
+
] }, key)),
|
|
406
|
+
"to the provider."
|
|
407
|
+
] }) : null,
|
|
408
|
+
connection.connectAs ? /* @__PURE__ */ jsx(
|
|
409
|
+
ConnectAsSwitch,
|
|
410
|
+
{
|
|
411
|
+
integration,
|
|
412
|
+
credential: `oauth:${connection.id}`,
|
|
413
|
+
value: connection.connectAs,
|
|
414
|
+
testId: `oauth-connect-as-${connection.id}`
|
|
415
|
+
}
|
|
416
|
+
) : null,
|
|
417
|
+
missing.length > 0 ? /* @__PURE__ */ jsxs(
|
|
418
|
+
"p",
|
|
419
|
+
{
|
|
420
|
+
className: "text-muted-foreground text-xs",
|
|
421
|
+
"data-test": `oauth-connection-missing-${connection.id}`,
|
|
422
|
+
children: [
|
|
423
|
+
"Save ",
|
|
424
|
+
missing.map((key) => key.label).join(", "),
|
|
425
|
+
" first."
|
|
426
|
+
]
|
|
427
|
+
}
|
|
428
|
+
) : null,
|
|
429
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
430
|
+
/* @__PURE__ */ jsx(
|
|
431
|
+
Button,
|
|
203
432
|
{
|
|
204
|
-
|
|
433
|
+
variant: "outline",
|
|
434
|
+
className: "self-start",
|
|
435
|
+
"data-test": connection.id === "default" ? "start-oauth" : `start-oauth-${connection.id}`,
|
|
436
|
+
nativeButton: false,
|
|
437
|
+
render: /* @__PURE__ */ jsx(
|
|
438
|
+
"a",
|
|
439
|
+
{
|
|
440
|
+
href: oauthConnectHref(
|
|
441
|
+
integration,
|
|
442
|
+
connection.id,
|
|
443
|
+
returnPath,
|
|
444
|
+
connection.connectAs
|
|
445
|
+
)
|
|
446
|
+
}
|
|
447
|
+
),
|
|
448
|
+
children: single ? "Connect with OAuth" : connection.connected ? `Reconnect ${connection.label}` : `Connect ${connection.label}`
|
|
205
449
|
}
|
|
206
450
|
),
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
451
|
+
disconnectable && connection.connected ? /* @__PURE__ */ jsx(
|
|
452
|
+
Button,
|
|
453
|
+
{
|
|
454
|
+
variant: "ghost",
|
|
455
|
+
size: "sm",
|
|
456
|
+
disabled: disconnect.isPending,
|
|
457
|
+
"data-test": `disconnect-oauth-${connection.id}`,
|
|
458
|
+
onClick: () => disconnect.mutate(
|
|
459
|
+
{ connection: connection.id, as: connection.connectAs },
|
|
460
|
+
{
|
|
461
|
+
onSuccess: async () => {
|
|
462
|
+
await queryClient.invalidateQueries({
|
|
463
|
+
queryKey: consoleKeys.connection(integration)
|
|
464
|
+
});
|
|
465
|
+
onChanged?.();
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
),
|
|
469
|
+
children: "Disconnect"
|
|
470
|
+
}
|
|
471
|
+
) : null
|
|
472
|
+
] })
|
|
473
|
+
]
|
|
474
|
+
},
|
|
475
|
+
connection.id
|
|
476
|
+
);
|
|
477
|
+
})
|
|
478
|
+
] });
|
|
479
|
+
}
|
|
480
|
+
function ActivationCredentials({
|
|
481
|
+
integration,
|
|
482
|
+
credentials,
|
|
483
|
+
onChanged
|
|
484
|
+
}) {
|
|
485
|
+
const queryClient = useQueryClient();
|
|
486
|
+
const [drafts, setDrafts] = useState({});
|
|
487
|
+
const save = useConsoleMutation(
|
|
488
|
+
async (c, groups) => {
|
|
489
|
+
for (const [as, values] of groups) {
|
|
490
|
+
await c.saveActivation(integration, values, {
|
|
491
|
+
merge: true,
|
|
492
|
+
...as ? { as } : {}
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
);
|
|
497
|
+
const dirty = Object.values(drafts).some((value) => value !== "");
|
|
498
|
+
const perPerson = credentials.some(
|
|
499
|
+
(credential) => credential.level === "user" && !credential.connectAs
|
|
500
|
+
);
|
|
501
|
+
return /* @__PURE__ */ jsxs(
|
|
502
|
+
"form",
|
|
503
|
+
{
|
|
504
|
+
className: "flex w-full max-w-xl min-w-0 flex-col gap-3",
|
|
505
|
+
"data-test": "activation-credentials",
|
|
506
|
+
onSubmit: (event) => {
|
|
507
|
+
event.preventDefault();
|
|
508
|
+
const typed = Object.fromEntries(
|
|
509
|
+
Object.entries(drafts).filter(([, value]) => value !== "")
|
|
510
|
+
);
|
|
511
|
+
const groups = /* @__PURE__ */ new Map();
|
|
512
|
+
for (const credential of credentials) {
|
|
513
|
+
for (const field of credential.fields) {
|
|
514
|
+
const value = typed[field.name];
|
|
515
|
+
if (value === void 0) continue;
|
|
516
|
+
groups.set(credential.connectAs, {
|
|
517
|
+
...groups.get(credential.connectAs),
|
|
518
|
+
[field.name]: value
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
save.mutate([...groups], {
|
|
523
|
+
onSuccess: () => {
|
|
524
|
+
setDrafts({});
|
|
525
|
+
onChanged?.();
|
|
526
|
+
return queryClient.invalidateQueries({
|
|
527
|
+
queryKey: consoleKeys.connection(integration)
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
},
|
|
532
|
+
children: [
|
|
533
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-medium", children: "Activation credentials" }),
|
|
534
|
+
perPerson ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: "The harness keeps one local store, so a credential for you is stored beside the team's and every call can read it." }) : null,
|
|
535
|
+
credentials.map((credential) => /* @__PURE__ */ jsxs(
|
|
536
|
+
"div",
|
|
537
|
+
{
|
|
538
|
+
className: "flex flex-col gap-2 rounded-md border p-3",
|
|
539
|
+
"data-test": `activation-credential-${credential.id}`,
|
|
540
|
+
children: [
|
|
541
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
542
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: credential.label }),
|
|
543
|
+
/* @__PURE__ */ jsx(
|
|
544
|
+
LevelBadge,
|
|
545
|
+
{
|
|
546
|
+
level: credential.level,
|
|
547
|
+
testId: `activation-credential-level-${credential.id}`
|
|
548
|
+
}
|
|
549
|
+
)
|
|
550
|
+
] }),
|
|
551
|
+
credential.connectAs ? /* @__PURE__ */ jsx(
|
|
552
|
+
ConnectAsSwitch,
|
|
553
|
+
{
|
|
554
|
+
integration,
|
|
555
|
+
credential: `activation:${credential.id}`,
|
|
556
|
+
value: credential.connectAs,
|
|
557
|
+
testId: `activation-connect-as-${credential.id}`
|
|
558
|
+
}
|
|
559
|
+
) : null,
|
|
560
|
+
credential.fields.map((field) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
561
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
562
|
+
/* @__PURE__ */ jsxs(
|
|
563
|
+
Label,
|
|
564
|
+
{
|
|
565
|
+
htmlFor: `activation-${field.name}`,
|
|
566
|
+
className: "text-sm font-medium",
|
|
567
|
+
children: [
|
|
568
|
+
field.label,
|
|
569
|
+
field.required ? null : /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground font-normal", children: [
|
|
570
|
+
" ",
|
|
571
|
+
"(optional)"
|
|
572
|
+
] })
|
|
573
|
+
]
|
|
574
|
+
}
|
|
575
|
+
),
|
|
576
|
+
/* @__PURE__ */ jsx(StatusBadge, { tone: field.set ? "success" : "neutral", children: field.set ? "set" : "not set" })
|
|
577
|
+
] }),
|
|
578
|
+
/* @__PURE__ */ jsx(
|
|
579
|
+
Input,
|
|
580
|
+
{
|
|
581
|
+
id: `activation-${field.name}`,
|
|
582
|
+
type: "password",
|
|
583
|
+
autoComplete: "off",
|
|
584
|
+
placeholder: field.set ? "Set" : "",
|
|
585
|
+
value: drafts[field.name] ?? "",
|
|
586
|
+
onChange: (event) => setDrafts({ ...drafts, [field.name]: event.target.value })
|
|
587
|
+
}
|
|
588
|
+
)
|
|
589
|
+
] }, field.name))
|
|
590
|
+
]
|
|
591
|
+
},
|
|
592
|
+
credential.id
|
|
593
|
+
)),
|
|
594
|
+
save.isError ? /* @__PURE__ */ jsx(Alert, { variant: "destructive", children: /* @__PURE__ */ jsx(AlertDescription, { children: save.error.message }) }) : null,
|
|
595
|
+
/* @__PURE__ */ jsx(
|
|
596
|
+
Button,
|
|
597
|
+
{
|
|
598
|
+
type: "submit",
|
|
599
|
+
className: "self-start",
|
|
600
|
+
disabled: !dirty || save.isPending,
|
|
601
|
+
"data-test": "save-activation-credentials",
|
|
602
|
+
children: save.isPending ? "Saving\u2026" : "Save credentials"
|
|
603
|
+
}
|
|
604
|
+
)
|
|
211
605
|
]
|
|
212
606
|
}
|
|
213
607
|
);
|
|
@@ -197,7 +197,7 @@ function DevToolbar() {
|
|
|
197
197
|
className: "text-primary flex items-center gap-2 text-sm font-medium",
|
|
198
198
|
"data-test": "toolbar-live-badge",
|
|
199
199
|
children: [
|
|
200
|
-
/* @__PURE__ */ jsx(Icon, { name: "
|
|
200
|
+
/* @__PURE__ */ jsx(Icon, { name: "broadcast", className: "h-4 w-4" }),
|
|
201
201
|
"Reaching ",
|
|
202
202
|
resolveEgress(integration).join(", ")
|
|
203
203
|
]
|
|
@@ -217,7 +217,7 @@ function DevToolbar() {
|
|
|
217
217
|
"aria-hidden": "true",
|
|
218
218
|
className: cn("flex items-center dark:hidden"),
|
|
219
219
|
children: [
|
|
220
|
-
/* @__PURE__ */ jsx(Icon, { name: "
|
|
220
|
+
/* @__PURE__ */ jsx(Icon, { name: "moon", className: "mr-2 h-4 w-4" }),
|
|
221
221
|
"Dark"
|
|
222
222
|
]
|
|
223
223
|
}
|
|
@@ -228,7 +228,7 @@ function DevToolbar() {
|
|
|
228
228
|
"aria-hidden": "true",
|
|
229
229
|
className: cn("hidden items-center dark:flex"),
|
|
230
230
|
children: [
|
|
231
|
-
/* @__PURE__ */ jsx(Icon, { name: "
|
|
231
|
+
/* @__PURE__ */ jsx(Icon, { name: "sun", className: "mr-2 h-4 w-4" }),
|
|
232
232
|
"Light"
|
|
233
233
|
]
|
|
234
234
|
}
|
|
@@ -46,7 +46,7 @@ function ProvenanceBadge({
|
|
|
46
46
|
/* @__PURE__ */ jsx(
|
|
47
47
|
Icon,
|
|
48
48
|
{
|
|
49
|
-
name: override ? "
|
|
49
|
+
name: override ? "warning" : thisRepo || own ? "git-branch" : "cloud",
|
|
50
50
|
className: "h-3 w-3"
|
|
51
51
|
}
|
|
52
52
|
),
|
|
@@ -60,10 +60,10 @@ function RunModeBadge({ mode }) {
|
|
|
60
60
|
return /* @__PURE__ */ jsx(
|
|
61
61
|
Badge,
|
|
62
62
|
{
|
|
63
|
+
size: "lg",
|
|
63
64
|
variant: "secondary",
|
|
64
65
|
"data-test": "run-mode-badge",
|
|
65
66
|
"data-mode": mode,
|
|
66
|
-
className: "h-6",
|
|
67
67
|
children: mode === "live" ? "Live" : "Fixtures"
|
|
68
68
|
}
|
|
69
69
|
);
|
|
@@ -117,7 +117,10 @@ function LocalOAuthPanel({
|
|
|
117
117
|
] })
|
|
118
118
|
] }),
|
|
119
119
|
/* @__PURE__ */ jsxs("li", { className: "flex flex-col gap-1", children: [
|
|
120
|
-
/* @__PURE__ */
|
|
120
|
+
/* @__PURE__ */ jsxs("span", { className: "font-medium", children: [
|
|
121
|
+
"3. Open the connect dialog (above) and click Connect",
|
|
122
|
+
setup.data.connections && setup.data.connections.length > 1 ? " for each connection" : ""
|
|
123
|
+
] }),
|
|
121
124
|
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground text-xs", children: [
|
|
122
125
|
"The browser goes to the provider, comes back to the redirect URI above, the shell exchanges the code through your declared egress and calls ",
|
|
123
126
|
/* @__PURE__ */ jsx("code", { children: "onTokens" }),
|
|
@@ -135,7 +138,30 @@ function LocalOAuthPanel({
|
|
|
135
138
|
"The connection lives in the dev server's memory only \u2014 a restart forgets it, and you Connect again."
|
|
136
139
|
]
|
|
137
140
|
}
|
|
138
|
-
) :
|
|
141
|
+
) : null,
|
|
142
|
+
live && setup.data.connections && setup.data.connections.length > 1 ? /* @__PURE__ */ jsx(
|
|
143
|
+
"ul",
|
|
144
|
+
{
|
|
145
|
+
className: "text-muted-foreground flex flex-col gap-1 text-xs",
|
|
146
|
+
"data-test": "local-oauth-connections",
|
|
147
|
+
children: setup.data.connections.map((connection) => /* @__PURE__ */ jsxs(
|
|
148
|
+
"li",
|
|
149
|
+
{
|
|
150
|
+
"data-test": `local-oauth-connection-${connection.id}`,
|
|
151
|
+
children: [
|
|
152
|
+
connection.label,
|
|
153
|
+
" (",
|
|
154
|
+
/* @__PURE__ */ jsx("code", { children: connection.id }),
|
|
155
|
+
"):",
|
|
156
|
+
" ",
|
|
157
|
+
connection.connected && connection.obtainedAt ? `connected since ${connection.obtainedAt}` : "not connected"
|
|
158
|
+
]
|
|
159
|
+
},
|
|
160
|
+
connection.id
|
|
161
|
+
))
|
|
162
|
+
}
|
|
163
|
+
) : null,
|
|
164
|
+
live ? null : /* @__PURE__ */ jsx(
|
|
139
165
|
FixturesModeNotice,
|
|
140
166
|
{
|
|
141
167
|
integration,
|
|
@@ -42,7 +42,7 @@ function BannerBody({
|
|
|
42
42
|
"data-test": "provenance-banner",
|
|
43
43
|
"data-state": "published",
|
|
44
44
|
children: [
|
|
45
|
-
/* @__PURE__ */ jsx(Icon, { name: "
|
|
45
|
+
/* @__PURE__ */ jsx(Icon, { name: "cloud", className: "h-3 w-3" }),
|
|
46
46
|
publishedSummary(integrations)
|
|
47
47
|
]
|
|
48
48
|
}
|
|
@@ -56,7 +56,7 @@ function BannerBody({
|
|
|
56
56
|
"data-test": "provenance-banner",
|
|
57
57
|
"data-state": "unpublishable",
|
|
58
58
|
children: [
|
|
59
|
-
/* @__PURE__ */ jsx(Icon, { name: "
|
|
59
|
+
/* @__PURE__ */ jsx(Icon, { name: "warning", className: "h-4 w-4" }),
|
|
60
60
|
/* @__PURE__ */ jsxs(AlertTitle, { children: [
|
|
61
61
|
locals.length,
|
|
62
62
|
" local override",
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import Link from "next/link";
|
|
3
4
|
import { usePathname } from "next/navigation";
|
|
4
5
|
import { Button } from "@ekanos/ui/button";
|
|
5
6
|
import { ConfirmDialog } from "@ekanos/ui/confirm-dialog";
|
|
7
|
+
import { cn } from "@ekanos/ui/utils";
|
|
6
8
|
import { answerLabel } from "../lib/connection-facts.js";
|
|
7
9
|
import { useConsoleClient } from "../lib/console-context.js";
|
|
8
10
|
import {
|
|
@@ -10,13 +12,39 @@ import {
|
|
|
10
12
|
useProject,
|
|
11
13
|
useRefreshRuntime
|
|
12
14
|
} from "../lib/console-hooks.js";
|
|
15
|
+
import { integrationConsoleHref } from "../lib/integration-console-href.js";
|
|
13
16
|
import { ConnectDialog } from "./connect-dialog.js";
|
|
14
17
|
import { ConnectionChip } from "./connection-chip.js";
|
|
18
|
+
import { FOCUS_RING } from "./scrollable-nav.js";
|
|
15
19
|
function runtimeChipText(integration) {
|
|
16
20
|
const facts = integration.runtime?.facts;
|
|
17
21
|
if (!facts) return null;
|
|
18
22
|
return `${integration.integration} \xB7 ${answerLabel(facts)}`;
|
|
19
23
|
}
|
|
24
|
+
function IntegrationName({
|
|
25
|
+
integration
|
|
26
|
+
}) {
|
|
27
|
+
const id = integration.integration;
|
|
28
|
+
const slash = id.lastIndexOf("/");
|
|
29
|
+
const namespace = slash === -1 ? null : id.slice(0, slash + 1);
|
|
30
|
+
const name = slash === -1 ? id : id.slice(slash + 1);
|
|
31
|
+
const href = integrationConsoleHref(integration);
|
|
32
|
+
const parts = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
33
|
+
namespace ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground min-w-0 truncate", children: namespace }) : null,
|
|
34
|
+
/* @__PURE__ */ jsx("span", { className: "shrink-0", children: name })
|
|
35
|
+
] });
|
|
36
|
+
const className = "flex min-w-0 items-baseline rounded-sm font-mono text-sm font-medium";
|
|
37
|
+
return href ? /* @__PURE__ */ jsx(
|
|
38
|
+
Link,
|
|
39
|
+
{
|
|
40
|
+
href,
|
|
41
|
+
className: cn(className, "hover:underline", FOCUS_RING),
|
|
42
|
+
title: `Open the ${id} console`,
|
|
43
|
+
"data-test": "runtime-integration-name",
|
|
44
|
+
children: parts
|
|
45
|
+
}
|
|
46
|
+
) : /* @__PURE__ */ jsx("span", { className, title: id, "data-test": "runtime-integration-name", children: parts });
|
|
47
|
+
}
|
|
20
48
|
function onConnectTab(pathname) {
|
|
21
49
|
return Boolean(pathname && /\/connect\/?$/.test(pathname));
|
|
22
50
|
}
|
|
@@ -41,7 +69,7 @@ function RuntimeStrip() {
|
|
|
41
69
|
const list = /* @__PURE__ */ jsx(
|
|
42
70
|
"ul",
|
|
43
71
|
{
|
|
44
|
-
className: "flex flex-col gap-2",
|
|
72
|
+
className: "flex flex-col gap-2 sm:grid sm:grid-cols-[max-content_minmax(0,1fr)_auto] sm:gap-x-3",
|
|
45
73
|
"data-test": "runtime-strip",
|
|
46
74
|
"aria-label": "Where each integration gets its answers",
|
|
47
75
|
children: rows.map((integration) => {
|
|
@@ -53,14 +81,14 @@ function RuntimeStrip() {
|
|
|
53
81
|
return /* @__PURE__ */ jsxs(
|
|
54
82
|
"li",
|
|
55
83
|
{
|
|
56
|
-
className: "flex flex-wrap items-center gap-x-3 gap-y-2",
|
|
84
|
+
className: "flex flex-wrap items-center gap-x-3 gap-y-2 sm:col-span-3 sm:grid sm:grid-cols-subgrid",
|
|
57
85
|
"data-test": `runtime-${integration.integration}`,
|
|
58
86
|
"data-mode": runtime.mode,
|
|
59
87
|
"data-reason": runtime.reason,
|
|
60
88
|
children: [
|
|
61
|
-
/* @__PURE__ */ jsx(
|
|
89
|
+
/* @__PURE__ */ jsx(IntegrationName, { integration }),
|
|
62
90
|
/* @__PURE__ */ jsx("span", { className: "flex min-w-48 flex-1 flex-wrap items-center gap-x-3 gap-y-1", children: /* @__PURE__ */ jsx(ConnectionChip, { facts, variant: "answer" }) }),
|
|
63
|
-
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
91
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2 sm:justify-end", children: [
|
|
64
92
|
connectable && facts.state === "not_connected" ? /* @__PURE__ */ jsx(
|
|
65
93
|
ConnectDialog,
|
|
66
94
|
{
|