@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
package/README.md
CHANGED
|
@@ -1108,7 +1108,7 @@ API token predictably appears on screen.
|
|
|
1108
1108
|
| `@ekanos/harness/routes` | `IntegrationLayout`, `WidgetsPage`, `SingleWidgetPage`, `TilePage`, `ActivationPage`, `TriggersPage`. |
|
|
1109
1109
|
| `@ekanos/harness/hooks` | `useHarnessDataMode()`, `useLiveActivationData()` — see "Knowing the mode, and the activation-data channel" above. Prefer `FetchProvider`'s own `mode`/`activationData` props where you can; reach for these only from code that runs nowhere but inside the dev harness. |
|
|
1110
1110
|
| `@ekanos/harness/api` | `createHarnessApiHandlers(registry)` — the SERVER entry the shell's one API route injects your registry into. Serves `oauth/{connect,callback,status}`, `storage`, `trigger` and `local-setup` per integration in live mode. Never import it from a `'use client'` module. |
|
|
1111
|
-
| `@ekanos/harness/styles.css` | The harness's Tailwind layer: the Tailwind entry, the `@ekanos/ui` token preset
|
|
1111
|
+
| `@ekanos/harness/styles.css` | The harness's Tailwind layer: the Tailwind entry, the `@ekanos/ui` token preset (with the Phosphor icon fonts), and the `@source` globs covering everything the chrome renders. |
|
|
1112
1112
|
| `@ekanos/harness/mocks/team-account-workspace` | The stand-in for the host's `useTeamAccountWorkspace()`. The generated `next.config.mjs` aliases `@kit/team-accounts/hooks/use-team-account-workspace` onto it, so unmodified widget source runs unchanged. |
|
|
1113
1113
|
|
|
1114
1114
|
## The shell contract
|
|
@@ -1163,6 +1163,5 @@ published tarball, in a clean room outside the workspace.
|
|
|
1163
1163
|
|
|
1164
1164
|
## Licence
|
|
1165
1165
|
|
|
1166
|
-
MIT.
|
|
1167
|
-
|
|
1168
|
-
Ekanos's own Pro webfonts are commercially licensed and cannot be redistributed.
|
|
1166
|
+
MIT. Icons are [Phosphor](https://phosphoricons.com) (MIT), whose fonts ship
|
|
1167
|
+
inside `@ekanos/ui`; this package ships no font data of its own.
|
package/dist/api-types.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ import type { Contract, ExecutionChannel, OperationRefusalReason } from '@ekanos
|
|
|
26
26
|
* PUT /__ekanos/api/integrations/:integration/mode -> IntegrationRuntime (body: SetRuntimeModeRequest)
|
|
27
27
|
* PUT /__ekanos/api/credentials/:integration/activation -> CredentialsResponse (body: SaveActivationRequest)
|
|
28
28
|
* POST /__ekanos/api/credentials/:integration/disconnect -> CredentialsResponse (body: DisconnectCredentialsRequest)
|
|
29
|
+
* PUT /__ekanos/api/credentials/:integration/switches -> CredentialsResponse (body: SetSwitchesRequest)
|
|
29
30
|
*/
|
|
30
31
|
export declare const HARNESS_API_PREFIX = "/__ekanos/api";
|
|
31
32
|
/** Next treats a leading `_` folder as private; the shell mounts the route under this encoded segment. */
|
|
@@ -374,15 +375,84 @@ export interface CredentialsResponse {
|
|
|
374
375
|
displayRoot?: string;
|
|
375
376
|
/** The integration's code connects through an OAuth loop. */
|
|
376
377
|
oauth?: boolean;
|
|
378
|
+
/**
|
|
379
|
+
* Every OAuth connection the definition declares — the main `oauth`
|
|
380
|
+
* (`default`) first, then each `oauthConnections` entry — with its own
|
|
381
|
+
* keys and status, so each gets its own Connect and Disconnect.
|
|
382
|
+
*/
|
|
383
|
+
oauthConnections?: OAuthConnectionStatus[];
|
|
384
|
+
/**
|
|
385
|
+
* The secret `activation.fields`, grouped by the credential each belongs
|
|
386
|
+
* to (`activation.credentials`; the ungrouped secrets are one team
|
|
387
|
+
* credential). Absent when the definition declares no secret field.
|
|
388
|
+
*/
|
|
389
|
+
activationCredentials?: ActivationCredentialStatus[];
|
|
390
|
+
/** Who calls the harness runs act as; `me` unless the switch says otherwise. */
|
|
391
|
+
runAs?: HarnessRunAs;
|
|
377
392
|
/** Connection status and live/fixtures answer, from the one function. */
|
|
378
393
|
facts: IntegrationConnectionFacts;
|
|
379
394
|
}
|
|
395
|
+
/** One declared activation credential and its fields. Never a value. */
|
|
396
|
+
export interface ActivationCredentialStatus {
|
|
397
|
+
/** The `activation.credentials` id; `activation` for the ungrouped secret fields. */
|
|
398
|
+
id: string;
|
|
399
|
+
label: string;
|
|
400
|
+
level: RepoConnectLevel;
|
|
401
|
+
/** Which tier Save writes to: the declared level unless the switch says otherwise. */
|
|
402
|
+
connectAs?: HarnessConnectAs;
|
|
403
|
+
/** Each field's `set` describes the tier `connectAs` names. */
|
|
404
|
+
fields: Array<{
|
|
405
|
+
name: string;
|
|
406
|
+
label: string;
|
|
407
|
+
required: boolean;
|
|
408
|
+
set: boolean;
|
|
409
|
+
}>;
|
|
410
|
+
}
|
|
411
|
+
/** One declared OAuth connection, as the Connect surfaces show it. Never a value. */
|
|
412
|
+
export interface OAuthConnectionStatus {
|
|
413
|
+
/** `default` for the main `oauth`, otherwise its `oauthConnections` key. */
|
|
414
|
+
id: string;
|
|
415
|
+
/** `Main connection`, or the connection's declared `label`. */
|
|
416
|
+
label: string;
|
|
417
|
+
description?: string;
|
|
418
|
+
/** The team brings its own app for this connection (`teamApp`). */
|
|
419
|
+
teamApp: boolean;
|
|
420
|
+
/** The secret names this connection needs; `label` is the teamApp field's. */
|
|
421
|
+
keys: Array<{
|
|
422
|
+
name: string;
|
|
423
|
+
label: string;
|
|
424
|
+
secret: boolean;
|
|
425
|
+
set: boolean;
|
|
426
|
+
}>;
|
|
427
|
+
/** Declared extra authorize parameters (Linear's `actor=app`). */
|
|
428
|
+
authorizationParams?: Record<string, string>;
|
|
429
|
+
/** The connection's declared level (`oauth.level`); `team` when unstated. */
|
|
430
|
+
level?: RepoConnectLevel;
|
|
431
|
+
/** Which tier Connect writes to: the declared level unless the switch says otherwise. */
|
|
432
|
+
connectAs?: HarnessConnectAs;
|
|
433
|
+
/** `connected` and `obtainedAt` describe the tier `connectAs` names. */
|
|
434
|
+
connected: boolean;
|
|
435
|
+
obtainedAt: string | null;
|
|
436
|
+
}
|
|
380
437
|
/** One non-sensitive field of the local credentials, shown beside "Connected". */
|
|
381
438
|
export interface ConnectionTargetField {
|
|
382
439
|
key: string;
|
|
383
440
|
label: string;
|
|
384
441
|
value: string;
|
|
385
442
|
}
|
|
443
|
+
/** The two Connect/Run switches (plan 261 R6); each part is optional. */
|
|
444
|
+
export interface SetSwitchesRequest {
|
|
445
|
+
/** Who calls the harness runs act as. */
|
|
446
|
+
runAs?: HarnessRunAs;
|
|
447
|
+
/**
|
|
448
|
+
* Override which tier one credential connects into: `credential` is
|
|
449
|
+
* `oauth:<connection id>` or `activation:<credential id>`.
|
|
450
|
+
*/
|
|
451
|
+
connectAs?: {
|
|
452
|
+
credential: string;
|
|
453
|
+
as: HarnessConnectAs;
|
|
454
|
+
};
|
|
455
|
+
}
|
|
386
456
|
export interface DisconnectCredentialsRequest {
|
|
387
457
|
/**
|
|
388
458
|
* Also blank the declared secret names. An API-key integration's keys ARE
|
|
@@ -390,6 +460,14 @@ export interface DisconnectCredentialsRequest {
|
|
|
390
460
|
* credentials, which a disconnect keeps.
|
|
391
461
|
*/
|
|
392
462
|
clearKeys?: boolean;
|
|
463
|
+
/**
|
|
464
|
+
* Forget only this OAuth connection's tokens (`default`, or an
|
|
465
|
+
* `oauthConnections` id): its app keys, the other connections and the
|
|
466
|
+
* activation fields stay. Ignores `clearKeys`.
|
|
467
|
+
*/
|
|
468
|
+
connection?: string;
|
|
469
|
+
/** Forget the person's own tokens for `connection` instead of the team's. */
|
|
470
|
+
as?: HarnessConnectAs;
|
|
393
471
|
}
|
|
394
472
|
export interface SaveCredentialsRequest {
|
|
395
473
|
/** Declared secret name -> value. Empty string clears. Only declared names are accepted. */
|
|
@@ -402,6 +480,14 @@ export interface SaveActivationRequest {
|
|
|
402
480
|
* replace whatever was stored before.
|
|
403
481
|
*/
|
|
404
482
|
activationData: Record<string, unknown>;
|
|
483
|
+
/**
|
|
484
|
+
* Keep the stored fields and set only the non-empty ones given, which must
|
|
485
|
+
* be declared `activation.fields`: one credential saved from the Connect
|
|
486
|
+
* tab. Without it the given fields replace the stored ones.
|
|
487
|
+
*/
|
|
488
|
+
merge?: boolean;
|
|
489
|
+
/** Whose tier the fields are stored in. Defaults to the team's. */
|
|
490
|
+
as?: HarnessConnectAs;
|
|
405
491
|
}
|
|
406
492
|
export type ApiErrorBody = {
|
|
407
493
|
error: {
|
|
@@ -419,6 +505,18 @@ export type RepoConnectionType = 'keys' | 'oauth' | 'shipped';
|
|
|
419
505
|
export type RepoConnectionStatus = 'connected' | 'not_connected' | 'not_needed' | 'managed';
|
|
420
506
|
/** Who connects once published: the Source, a team, or each person. */
|
|
421
507
|
export type RepoConnectLevel = 'source' | 'team' | 'user';
|
|
508
|
+
/**
|
|
509
|
+
* Whose tier a credential is connected into: `me` is the local person's own
|
|
510
|
+
* tier, `team` the team's (the existing local account tier). Defaults to the
|
|
511
|
+
* credential's declared level: `user` is `me`, anything else `team`.
|
|
512
|
+
*/
|
|
513
|
+
export type HarnessConnectAs = 'me' | 'team';
|
|
514
|
+
/**
|
|
515
|
+
* Who a call the harness runs acts as: `me` is the local person (a user
|
|
516
|
+
* principal, with `ctx.identity` once they have connected a personal
|
|
517
|
+
* credential), `machine` a call nobody is behind (never any `ctx.identity`).
|
|
518
|
+
*/
|
|
519
|
+
export type HarnessRunAs = 'me' | 'machine';
|
|
422
520
|
export interface RepoConnection {
|
|
423
521
|
type: RepoConnectionType;
|
|
424
522
|
status: RepoConnectionStatus;
|
|
@@ -451,6 +549,8 @@ export interface RepoExperienceIntegration {
|
|
|
451
549
|
modes: BindingMode[];
|
|
452
550
|
/** The integration is a package of this repo. */
|
|
453
551
|
sameRepo: boolean;
|
|
552
|
+
/** That package's name (its bare slug), which its own API is keyed by. */
|
|
553
|
+
packageName: string | null;
|
|
454
554
|
connection: RepoConnection | null;
|
|
455
555
|
/** Levels this experience will ask for once published, within what the integration supports. */
|
|
456
556
|
levels: RepoConnectLevel[];
|
|
@@ -458,6 +558,8 @@ export interface RepoExperienceIntegration {
|
|
|
458
558
|
levelProblem?: string;
|
|
459
559
|
/** Link to connect it (the integration's console), when it is a package of this repo. */
|
|
460
560
|
connectHref: string | null;
|
|
561
|
+
/** The integration's console, when it is a package of this repo. */
|
|
562
|
+
consoleHref: string | null;
|
|
461
563
|
}
|
|
462
564
|
export interface RepoExperienceRow {
|
|
463
565
|
name: string;
|
|
@@ -95,7 +95,7 @@ function ApprovalsTray() {
|
|
|
95
95
|
const list = approvals.data ?? [];
|
|
96
96
|
if (list.length === 0) return null;
|
|
97
97
|
return /* @__PURE__ */ jsxs(Alert, { variant: "warning", className: "*:min-w-0", "data-test": "approvals-tray", children: [
|
|
98
|
-
/* @__PURE__ */ jsx(Icon, { name: "
|
|
98
|
+
/* @__PURE__ */ jsx(Icon, { name: "hand", className: "h-4 w-4" }),
|
|
99
99
|
/* @__PURE__ */ jsx(AlertTitle, { "data-test": "approvals-summary", children: approvalsSummary(list) }),
|
|
100
100
|
/* @__PURE__ */ jsx(AlertDescription, { children: /* @__PURE__ */ jsx("div", { className: "mt-2 flex min-w-0 flex-col gap-3", children: list.map((approval) => /* @__PURE__ */ jsx(
|
|
101
101
|
ApprovalCard,
|
|
@@ -13,13 +13,7 @@ function AskAssistantBridge() {
|
|
|
13
13
|
if (!asked) return null;
|
|
14
14
|
return /* @__PURE__ */ jsxs("div", { className: "fixed right-6 bottom-24 z-50 flex max-h-[60vh] w-[min(28rem,calc(100vw-3rem))] flex-col overflow-hidden rounded-lg border", children: [
|
|
15
15
|
/* @__PURE__ */ jsxs("div", { className: "bg-card flex items-center gap-3 border-b px-5 py-3", children: [
|
|
16
|
-
/* @__PURE__ */ jsx(
|
|
17
|
-
Icon,
|
|
18
|
-
{
|
|
19
|
-
name: "fa-wand-magic-sparkles",
|
|
20
|
-
className: "text-muted-foreground h-5 w-5"
|
|
21
|
-
}
|
|
22
|
-
),
|
|
16
|
+
/* @__PURE__ */ jsx(Icon, { name: "magic-wand", className: "text-muted-foreground h-5 w-5" }),
|
|
23
17
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
24
18
|
/* @__PURE__ */ jsx("p", { className: "truncate text-sm font-medium", children: "Ask payload" }),
|
|
25
19
|
/* @__PURE__ */ jsxs("p", { className: "text-muted-foreground truncate text-xs", children: [
|
|
@@ -35,7 +29,7 @@ function AskAssistantBridge() {
|
|
|
35
29
|
size: "icon",
|
|
36
30
|
onClick: () => setAsked(null),
|
|
37
31
|
"aria-label": "Close ask payload",
|
|
38
|
-
children: /* @__PURE__ */ jsx(Icon, { name: "
|
|
32
|
+
children: /* @__PURE__ */ jsx(Icon, { name: "x", className: "h-4 w-4" })
|
|
39
33
|
}
|
|
40
34
|
)
|
|
41
35
|
] }),
|