@ekanos/harness 0.18.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-types.d.ts +490 -0
- package/dist/api-types.js +6 -0
- package/dist/api.d.ts +33 -0
- package/dist/api.js +36 -1
- package/dist/app.js +6 -1
- package/dist/internal/components/approvals-tray.d.ts +17 -0
- package/dist/internal/components/approvals-tray.js +116 -0
- package/dist/internal/components/ask-assistant-bridge.js +1 -1
- package/dist/internal/components/connect-controls.d.ts +12 -0
- package/dist/internal/components/connect-controls.js +69 -0
- package/dist/internal/components/connect-dialog.d.ts +19 -0
- package/dist/internal/components/connect-dialog.js +61 -0
- package/dist/internal/components/connect-panel.d.ts +25 -0
- package/dist/internal/components/connect-panel.js +292 -0
- package/dist/internal/components/connection-chip.d.ts +14 -0
- package/dist/internal/components/connection-chip.js +75 -0
- package/dist/internal/components/dashboard-grid.js +38 -24
- package/dist/internal/components/dev-toolbar.js +176 -103
- package/dist/internal/components/events-panel.d.ts +10 -0
- package/dist/internal/components/events-panel.js +111 -0
- package/dist/internal/components/health-panel.d.ts +4 -0
- package/dist/internal/components/health-panel.js +56 -0
- package/dist/internal/components/integration-badge.d.ts +29 -0
- package/dist/internal/components/integration-badge.js +105 -0
- package/dist/internal/components/local-oauth-panel.js +21 -1
- package/dist/internal/components/operation-runner-panel.d.ts +12 -0
- package/dist/internal/components/operation-runner-panel.js +331 -0
- package/dist/internal/components/provenance-banner.d.ts +12 -0
- package/dist/internal/components/provenance-banner.js +107 -0
- package/dist/internal/components/repo-connection.d.ts +10 -0
- package/dist/internal/components/repo-connection.js +32 -0
- package/dist/internal/components/run-log.d.ts +9 -0
- package/dist/internal/components/run-log.js +228 -0
- package/dist/internal/components/runtime-strip.d.ts +12 -0
- package/dist/internal/components/runtime-strip.js +158 -0
- package/dist/internal/components/schema-form.d.ts +13 -0
- package/dist/internal/components/schema-form.js +382 -0
- package/dist/internal/components/scrollable-nav.d.ts +12 -0
- package/dist/internal/components/scrollable-nav.js +68 -0
- package/dist/internal/components/surface-nav.d.ts +31 -1
- package/dist/internal/components/surface-nav.js +244 -31
- package/dist/internal/components/workflow-runner.d.ts +14 -0
- package/dist/internal/components/workflow-runner.js +104 -0
- package/dist/internal/lib/bundled-secrets.d.ts +9 -0
- package/dist/internal/lib/bundled-secrets.js +24 -0
- package/dist/internal/lib/chrome-slot.d.ts +2 -0
- package/dist/internal/lib/chrome-slot.js +25 -0
- package/dist/internal/lib/connection-facts.d.ts +44 -0
- package/dist/internal/lib/connection-facts.js +116 -0
- package/dist/internal/lib/console-client.d.ts +55 -0
- package/dist/internal/lib/console-client.js +295 -0
- package/dist/internal/lib/console-context.d.ts +56 -0
- package/dist/internal/lib/console-context.js +67 -0
- package/dist/internal/lib/console-hooks.d.ts +33 -0
- package/dist/internal/lib/console-hooks.js +118 -0
- package/dist/internal/lib/console-types.d.ts +279 -0
- package/dist/internal/lib/console-types.js +0 -0
- package/dist/internal/lib/experience-runtime.d.ts +8 -0
- package/dist/internal/lib/experience-runtime.js +22 -0
- package/dist/internal/lib/preview-sections.d.ts +13 -0
- package/dist/internal/lib/preview-sections.js +32 -0
- package/dist/internal/lib/repo-context.d.ts +20 -0
- package/dist/internal/lib/repo-context.js +64 -0
- package/dist/internal/lib/run-log-view.d.ts +24 -0
- package/dist/internal/lib/run-log-view.js +57 -0
- package/dist/internal/lib/schema-form-model.d.ts +34 -0
- package/dist/internal/lib/schema-form-model.js +272 -0
- package/dist/internal/lib/toolbar-context.d.ts +9 -1
- package/dist/internal/lib/toolbar-context.js +13 -3
- package/dist/internal/lib/toolbar-visibility.d.ts +16 -0
- package/dist/internal/lib/toolbar-visibility.js +31 -0
- package/dist/internal/registry-context.d.ts +2 -0
- package/dist/internal/registry-context.js +11 -9
- package/dist/internal/routes/activation-page.js +44 -20
- package/dist/internal/routes/console-home-page.d.ts +5 -0
- package/dist/internal/routes/console-home-page.js +18 -0
- package/dist/internal/routes/experience-connect-page.d.ts +6 -0
- package/dist/internal/routes/experience-connect-page.js +127 -0
- package/dist/internal/routes/experience-layout-page.d.ts +8 -0
- package/dist/internal/routes/experience-layout-page.js +126 -0
- package/dist/internal/routes/experience-page-host.d.ts +7 -0
- package/dist/internal/routes/experience-page-host.js +79 -0
- package/dist/internal/routes/experience-review-queue-page.d.ts +2 -0
- package/dist/internal/routes/experience-review-queue-page.js +60 -0
- package/dist/internal/routes/experience-runs-page.d.ts +1 -0
- package/dist/internal/routes/experience-runs-page.js +13 -0
- package/dist/internal/routes/experience-summary-page.d.ts +1 -0
- package/dist/internal/routes/experience-summary-page.js +101 -0
- package/dist/internal/routes/experience-widget-page.d.ts +1 -0
- package/dist/internal/routes/experience-widget-page.js +26 -0
- package/dist/internal/routes/experience-widgets-page.d.ts +6 -0
- package/dist/internal/routes/experience-widgets-page.js +22 -0
- package/dist/internal/routes/experience-workflow-page.d.ts +1 -0
- package/dist/internal/routes/experience-workflow-page.js +24 -0
- package/dist/internal/routes/experience-workflows-page.d.ts +1 -0
- package/dist/internal/routes/experience-workflows-page.js +44 -0
- package/dist/internal/routes/index-page.d.ts +10 -9
- package/dist/internal/routes/index-page.js +3 -68
- package/dist/internal/routes/integration-layout.d.ts +12 -1
- package/dist/internal/routes/integration-layout.js +20 -6
- package/dist/internal/routes/integrations-connect-page.d.ts +1 -0
- package/dist/internal/routes/integrations-connect-page.js +19 -0
- package/dist/internal/routes/integrations-events-page.d.ts +1 -0
- package/dist/internal/routes/integrations-events-page.js +10 -0
- package/dist/internal/routes/integrations-health-page.d.ts +1 -0
- package/dist/internal/routes/integrations-health-page.js +10 -0
- package/dist/internal/routes/integrations-layout.d.ts +17 -0
- package/dist/internal/routes/integrations-layout.js +106 -0
- package/dist/internal/routes/integrations-list-page.d.ts +2 -0
- package/dist/internal/routes/integrations-list-page.js +94 -0
- package/dist/internal/routes/integrations-operation-page.d.ts +1 -0
- package/dist/internal/routes/integrations-operation-page.js +29 -0
- package/dist/internal/routes/integrations-operations-page.d.ts +1 -0
- package/dist/internal/routes/integrations-operations-page.js +61 -0
- package/dist/internal/routes/integrations-overview-page.d.ts +1 -0
- package/dist/internal/routes/integrations-overview-page.js +90 -0
- package/dist/internal/routes/integrations-runs-page.d.ts +1 -0
- package/dist/internal/routes/integrations-runs-page.js +14 -0
- package/dist/internal/routes/integrations-scope.d.ts +12 -0
- package/dist/internal/routes/integrations-scope.js +39 -0
- package/dist/internal/routes/legacy-preview-redirect.d.ts +6 -0
- package/dist/internal/routes/legacy-preview-redirect.js +12 -0
- package/dist/internal/routes/preview-index-page.d.ts +2 -0
- package/dist/internal/routes/preview-index-page.js +14 -0
- package/dist/internal/routes/repo-connections-page.d.ts +6 -0
- package/dist/internal/routes/repo-connections-page.js +8 -0
- package/dist/internal/routes/repo-home-page.d.ts +2 -0
- package/dist/internal/routes/repo-home-page.js +320 -0
- package/dist/internal/routes/repo-layout.d.ts +7 -0
- package/dist/internal/routes/repo-layout.js +76 -0
- package/dist/internal/routes/repo-package-layouts.d.ts +20 -0
- package/dist/internal/routes/repo-package-layouts.js +104 -0
- package/dist/internal/routes/root-layout.d.ts +3 -1
- package/dist/internal/routes/root-layout.js +13 -3
- package/dist/internal/routes/single-widget-page.js +5 -12
- package/dist/internal/routes/tile-page.js +20 -41
- package/dist/internal/routes/triggers-page.js +55 -62
- package/dist/internal/routes/widgets-page.js +1 -1
- package/dist/internal/server/api-router.js +46 -4
- package/dist/internal/server/approvals.d.ts +44 -0
- package/dist/internal/server/approvals.js +76 -0
- package/dist/internal/server/contract-sources.d.ts +28 -0
- package/dist/internal/server/contract-sources.js +83 -0
- package/dist/internal/server/definition-loader.d.ts +22 -0
- package/dist/internal/server/definition-loader.js +125 -0
- package/dist/internal/server/ekanos-api-router.d.ts +34 -0
- package/dist/internal/server/ekanos-api-router.js +835 -0
- package/dist/internal/server/experience-loader.d.ts +57 -0
- package/dist/internal/server/experience-loader.js +146 -0
- package/dist/internal/server/integration-lookup.d.ts +29 -0
- package/dist/internal/server/integration-lookup.js +33 -0
- package/dist/internal/server/integration-resolver.d.ts +121 -0
- package/dist/internal/server/integration-resolver.js +605 -0
- package/dist/internal/server/live-invoker.d.ts +11 -0
- package/dist/internal/server/live-invoker.js +106 -0
- package/dist/internal/server/local-secrets.d.ts +82 -1
- package/dist/internal/server/local-secrets.js +112 -1
- package/dist/internal/server/local-state.d.ts +12 -0
- package/dist/internal/server/local-state.js +45 -0
- package/dist/internal/server/oauth-persistence.d.ts +19 -0
- package/dist/internal/server/oauth-persistence.js +76 -0
- package/dist/internal/server/operation-runner.d.ts +95 -0
- package/dist/internal/server/operation-runner.js +231 -0
- package/dist/internal/server/project-manifest.d.ts +71 -0
- package/dist/internal/server/project-manifest.js +215 -0
- package/dist/internal/server/registry-cache.d.ts +68 -0
- package/dist/internal/server/registry-cache.js +328 -0
- package/dist/internal/server/repo-api-router.d.ts +33 -0
- package/dist/internal/server/repo-api-router.js +391 -0
- package/dist/internal/server/run-log.d.ts +22 -0
- package/dist/internal/server/run-log.js +32 -0
- package/dist/internal/server/semantics.d.ts +28 -0
- package/dist/internal/server/semantics.js +67 -0
- package/dist/internal/server/session-catalog.d.ts +67 -0
- package/dist/internal/server/session-catalog.js +18 -0
- package/dist/internal/server/workflow-runner.d.ts +36 -0
- package/dist/internal/server/workflow-runner.js +183 -0
- package/dist/registry.d.ts +7 -0
- package/dist/resolver.d.ts +145 -0
- package/dist/resolver.js +211 -0
- package/dist/routes.d.ts +66 -2
- package/dist/routes.js +61 -3
- package/dist/runtime.d.ts +46 -0
- package/dist/runtime.js +60 -0
- package/package.json +23 -9
- package/dist/internal/routes/integration-index-page.d.ts +0 -13
- package/dist/internal/routes/integration-index-page.js +0 -17
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wire types the Integration console and Experience view render.
|
|
3
|
+
*
|
|
4
|
+
* These mirror the `/__ekanos/api/*` contract lane C owns (local-split design
|
|
5
|
+
* §3.1–3.5). They are deliberately structural and import nothing from lane C,
|
|
6
|
+
* so the UI builds and is tested against fakes; once `src/api.ts` publishes
|
|
7
|
+
* the real types, this file is the one place to re-point.
|
|
8
|
+
*/
|
|
9
|
+
import type { IntegrationConnectionFacts, IntegrationRuntime } from '../../api-types.js';
|
|
10
|
+
export type JsonSchema = {
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
};
|
|
13
|
+
export type RunMode = 'fixtures' | 'live';
|
|
14
|
+
export type ScenarioVariant = 'default' | 'empty' | 'error';
|
|
15
|
+
export type ProjectKind = 'integration' | 'experience';
|
|
16
|
+
export type ExecutionChannel = 'http' | 'rsc' | 'workflow';
|
|
17
|
+
export type IntegrationProvenance = {
|
|
18
|
+
kind: 'registry';
|
|
19
|
+
contractVersion: string;
|
|
20
|
+
digest: string;
|
|
21
|
+
source: 'catalog' | 'dir' | 'package' | 'snapshot';
|
|
22
|
+
origin: string;
|
|
23
|
+
/** The committed snapshot answered because no live source did. */
|
|
24
|
+
stale?: boolean;
|
|
25
|
+
/** The published package running live from the private cache. */
|
|
26
|
+
cachedPackage?: {
|
|
27
|
+
name: string;
|
|
28
|
+
version: string;
|
|
29
|
+
};
|
|
30
|
+
} | {
|
|
31
|
+
kind: 'local';
|
|
32
|
+
path: string;
|
|
33
|
+
packageVersion: string;
|
|
34
|
+
contractVersion: string;
|
|
35
|
+
digest: string;
|
|
36
|
+
/** `repo`: a package of the same repo, resolved automatically. */
|
|
37
|
+
scope?: 'override' | 'repo';
|
|
38
|
+
/** `path` relative to the repo root, when inside the repo. */
|
|
39
|
+
relPath?: string;
|
|
40
|
+
};
|
|
41
|
+
export type OperationEffect = 'read' | 'write';
|
|
42
|
+
export interface ConsoleOperation {
|
|
43
|
+
id: string;
|
|
44
|
+
kind: 'tool' | 'action';
|
|
45
|
+
name: string;
|
|
46
|
+
description: string;
|
|
47
|
+
effect: OperationEffect;
|
|
48
|
+
sensitivity: 'public' | 'internal' | 'pii' | 'financial';
|
|
49
|
+
input: JsonSchema;
|
|
50
|
+
output: JsonSchema;
|
|
51
|
+
opaque: {
|
|
52
|
+
input: boolean;
|
|
53
|
+
output: boolean;
|
|
54
|
+
};
|
|
55
|
+
opaqueReason?: string;
|
|
56
|
+
outputExample?: unknown;
|
|
57
|
+
since?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface ConsoleEvent {
|
|
60
|
+
name: string;
|
|
61
|
+
description?: string;
|
|
62
|
+
payloadSchema: JsonSchema;
|
|
63
|
+
payloadExample?: unknown;
|
|
64
|
+
}
|
|
65
|
+
/** What consumes an operation, by static analysis of the declarations. */
|
|
66
|
+
export interface UsedBy {
|
|
67
|
+
kind: 'widget' | 'page' | 'workflow' | 'review-queue';
|
|
68
|
+
id: string;
|
|
69
|
+
title: string;
|
|
70
|
+
}
|
|
71
|
+
export interface ConsoleContract {
|
|
72
|
+
integration: string;
|
|
73
|
+
/** The compat version the experience pins. */
|
|
74
|
+
version: string;
|
|
75
|
+
contractVersion: string;
|
|
76
|
+
digest: string;
|
|
77
|
+
connection: {
|
|
78
|
+
levels: ('source' | 'team' | 'user')[];
|
|
79
|
+
auth: 'none' | 'api_key' | 'oauth2';
|
|
80
|
+
scopes: string[];
|
|
81
|
+
};
|
|
82
|
+
operations: ConsoleOperation[];
|
|
83
|
+
events: ConsoleEvent[];
|
|
84
|
+
/** Keyed by `kind/name`. */
|
|
85
|
+
usedBy: Record<string, UsedBy[]>;
|
|
86
|
+
}
|
|
87
|
+
export interface ConsoleIntegration {
|
|
88
|
+
integration: string;
|
|
89
|
+
version: string;
|
|
90
|
+
/** `kind/name` keys the experience allows (`uses[integration].operations`). */
|
|
91
|
+
operations: string[];
|
|
92
|
+
runModes: RunMode[];
|
|
93
|
+
defaultMode: RunMode;
|
|
94
|
+
/** Why `live` is unavailable, when it is. */
|
|
95
|
+
fixturesOnlyReason?: string;
|
|
96
|
+
provenance: IntegrationProvenance;
|
|
97
|
+
/** This project's own integration: local provenance that is not an override. */
|
|
98
|
+
own?: boolean;
|
|
99
|
+
/** Harness binding mode (`team`/`invoker`/`user`). */
|
|
100
|
+
bindingMode?: string;
|
|
101
|
+
/** What a call that names no mode does now: live for a connected integration's reads. */
|
|
102
|
+
runtime?: IntegrationRuntime;
|
|
103
|
+
}
|
|
104
|
+
export type CheckStatus = 'ok' | 'failed' | 'unknown';
|
|
105
|
+
export interface ConsoleProject {
|
|
106
|
+
kind: ProjectKind;
|
|
107
|
+
name: string;
|
|
108
|
+
integrations: ConsoleIntegration[];
|
|
109
|
+
/** Resolution problems that did not stop startup. */
|
|
110
|
+
notices?: string[];
|
|
111
|
+
/** Hard per-integration errors: the harness refuses calls for these integrations. */
|
|
112
|
+
errors?: Array<{
|
|
113
|
+
integration: string;
|
|
114
|
+
message: string;
|
|
115
|
+
}>;
|
|
116
|
+
/** Integration-pin and experience-boundary check results, experiences only. */
|
|
117
|
+
checks?: {
|
|
118
|
+
pins: CheckStatus;
|
|
119
|
+
boundary: CheckStatus;
|
|
120
|
+
};
|
|
121
|
+
/** The repo's integration also registers widgets/tile/activation surfaces. */
|
|
122
|
+
legacySurfaces?: boolean;
|
|
123
|
+
}
|
|
124
|
+
export interface RunRecord {
|
|
125
|
+
id: string;
|
|
126
|
+
seq: number;
|
|
127
|
+
ts: string;
|
|
128
|
+
integration: string;
|
|
129
|
+
version: string;
|
|
130
|
+
opKey: string;
|
|
131
|
+
effect: OperationEffect | null;
|
|
132
|
+
channel: ExecutionChannel;
|
|
133
|
+
mode: RunMode | null;
|
|
134
|
+
provenance: IntegrationProvenance['kind'] | null;
|
|
135
|
+
status: 'ok' | 'refused' | 'error';
|
|
136
|
+
reason?: string;
|
|
137
|
+
durationMs: number;
|
|
138
|
+
inputBytes: number;
|
|
139
|
+
outputBytes: number;
|
|
140
|
+
origin?: string;
|
|
141
|
+
approvalId?: string;
|
|
142
|
+
}
|
|
143
|
+
export interface ValidationIssue {
|
|
144
|
+
path: string;
|
|
145
|
+
message: string;
|
|
146
|
+
}
|
|
147
|
+
export interface RunRequest {
|
|
148
|
+
integration: string;
|
|
149
|
+
/** Relative key: `tool/get_headlines`. */
|
|
150
|
+
opKey: string;
|
|
151
|
+
args: unknown;
|
|
152
|
+
mode: RunMode;
|
|
153
|
+
variant?: ScenarioVariant;
|
|
154
|
+
channel?: ExecutionChannel;
|
|
155
|
+
/** Free text recorded on the run row. */
|
|
156
|
+
origin?: string;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* A write on the http channel is held open until the approvals tray decides
|
|
160
|
+
* it, so the promise for a write resolves after the decision.
|
|
161
|
+
*/
|
|
162
|
+
export type RunResponse = {
|
|
163
|
+
status: 'ok';
|
|
164
|
+
output: unknown;
|
|
165
|
+
runId: string;
|
|
166
|
+
approvalId?: string;
|
|
167
|
+
} | {
|
|
168
|
+
status: 'refused';
|
|
169
|
+
reason: string;
|
|
170
|
+
message: string;
|
|
171
|
+
runId: string;
|
|
172
|
+
approvalId?: string;
|
|
173
|
+
issues?: ValidationIssue[];
|
|
174
|
+
};
|
|
175
|
+
export interface PendingApproval {
|
|
176
|
+
id: string;
|
|
177
|
+
createdAt: string;
|
|
178
|
+
integration: string;
|
|
179
|
+
opKey: string;
|
|
180
|
+
channel: ExecutionChannel;
|
|
181
|
+
mode: RunMode;
|
|
182
|
+
argsHash: string;
|
|
183
|
+
args?: unknown;
|
|
184
|
+
}
|
|
185
|
+
/** One non-sensitive field of the local credentials; never a secret. */
|
|
186
|
+
export interface ConnectionTargetField {
|
|
187
|
+
key: string;
|
|
188
|
+
label: string;
|
|
189
|
+
value: string;
|
|
190
|
+
}
|
|
191
|
+
export interface ConnectionField {
|
|
192
|
+
key: string;
|
|
193
|
+
label: string;
|
|
194
|
+
secret: boolean;
|
|
195
|
+
/** Whether a value is stored. The value itself never reaches the browser. */
|
|
196
|
+
set: boolean;
|
|
197
|
+
}
|
|
198
|
+
export interface ConnectionState {
|
|
199
|
+
/** True for a registry integration: "connection managed by Ekanos; fixtures only". */
|
|
200
|
+
managed: boolean;
|
|
201
|
+
/** Where the credential store lives (the integration's project). */
|
|
202
|
+
root?: string;
|
|
203
|
+
fields: ConnectionField[];
|
|
204
|
+
/** Non-sensitive fields of the local credentials: what they point at. */
|
|
205
|
+
target: ConnectionTargetField[];
|
|
206
|
+
/** Any local credential is stored for this integration (declared keys or activation fields). */
|
|
207
|
+
hasStored: boolean;
|
|
208
|
+
/** Where the store lives, relative to the repo when inside one. */
|
|
209
|
+
displayRoot?: string;
|
|
210
|
+
/** The one source of truth for status and live/fixtures. */
|
|
211
|
+
facts: IntegrationConnectionFacts;
|
|
212
|
+
}
|
|
213
|
+
export interface EmitEventRequest {
|
|
214
|
+
integration: string;
|
|
215
|
+
event: string;
|
|
216
|
+
payload: unknown;
|
|
217
|
+
/** Defaults to the integration's default mode; `live` dispatches to the handler. */
|
|
218
|
+
mode?: RunMode;
|
|
219
|
+
webhook?: string;
|
|
220
|
+
}
|
|
221
|
+
export interface EmitEventResponse {
|
|
222
|
+
valid: boolean;
|
|
223
|
+
issues: ValidationIssue[];
|
|
224
|
+
/** `ran`: the integration's handler ran; `validated-only`: fixtures integration. */
|
|
225
|
+
outcome: 'ran' | 'validated-only';
|
|
226
|
+
detail?: string;
|
|
227
|
+
/** Experience workflow ids whose trigger names this event. */
|
|
228
|
+
matchedTriggers: string[];
|
|
229
|
+
}
|
|
230
|
+
export type HealthStatus = 'healthy' | 'degraded' | 'unhealthy' | 'unknown';
|
|
231
|
+
export interface HealthResult {
|
|
232
|
+
status: HealthStatus;
|
|
233
|
+
message?: string;
|
|
234
|
+
}
|
|
235
|
+
export type WorkflowStepType = 'fusion_tool' | 'approval_gate' | 'ai_step' | (string & {});
|
|
236
|
+
export interface WorkflowStepDefinition {
|
|
237
|
+
id: string;
|
|
238
|
+
type: WorkflowStepType;
|
|
239
|
+
label: string;
|
|
240
|
+
integration?: string;
|
|
241
|
+
opKey?: string;
|
|
242
|
+
}
|
|
243
|
+
export interface WorkflowTemplateSummary {
|
|
244
|
+
id: string;
|
|
245
|
+
title: string;
|
|
246
|
+
description?: string;
|
|
247
|
+
steps: WorkflowStepDefinition[];
|
|
248
|
+
}
|
|
249
|
+
export type WorkflowStepStatus = 'pending' | 'running' | 'done' | 'rejected' | 'failed' | 'not_simulated';
|
|
250
|
+
export interface WorkflowStepState {
|
|
251
|
+
id: string;
|
|
252
|
+
status: WorkflowStepStatus;
|
|
253
|
+
output?: unknown;
|
|
254
|
+
detail?: string;
|
|
255
|
+
}
|
|
256
|
+
/** Resolves when the run finishes, approvals included. */
|
|
257
|
+
export interface WorkflowRunState {
|
|
258
|
+
workflowId: string;
|
|
259
|
+
steps: WorkflowStepState[];
|
|
260
|
+
completed: boolean;
|
|
261
|
+
}
|
|
262
|
+
export interface ReviewQueueSection {
|
|
263
|
+
id: string;
|
|
264
|
+
title: string;
|
|
265
|
+
integration: string;
|
|
266
|
+
opKey: string;
|
|
267
|
+
args: unknown;
|
|
268
|
+
}
|
|
269
|
+
/** The experience's own declarations (name, workflows, review queue). */
|
|
270
|
+
export interface ExperienceInfo {
|
|
271
|
+
name: string;
|
|
272
|
+
workflows: WorkflowTemplateSummary[];
|
|
273
|
+
reviewQueue: ReviewQueueSection[];
|
|
274
|
+
checks?: {
|
|
275
|
+
pins: CheckStatus;
|
|
276
|
+
boundary: CheckStatus;
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
export type ApprovalDecision = 'approve' | 'reject';
|
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ExperienceRuntime } from '@ekanos/sdk/experience/runtime';
|
|
2
|
+
/**
|
|
3
|
+
* The SDK's `ExperienceRuntime` over the harness API. `useOperation` and
|
|
4
|
+
* `useOperationMutation` read it from `ExperienceRuntimeProvider`, which the
|
|
5
|
+
* console mounts around every route, so an experience widget renders under
|
|
6
|
+
* the harness exactly as it will under the host.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createExperienceRuntime(apiPrefix?: string): ExperienceRuntime;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createHarnessRuntime } from "../../runtime.js";
|
|
2
|
+
function createExperienceRuntime(apiPrefix) {
|
|
3
|
+
const harness = createHarnessRuntime(apiPrefix ? { apiPrefix } : {});
|
|
4
|
+
void harness.refresh().catch(() => void 0);
|
|
5
|
+
return {
|
|
6
|
+
call: (request) => harness.call({
|
|
7
|
+
integration: request.integration,
|
|
8
|
+
op: request.op,
|
|
9
|
+
input: request.input,
|
|
10
|
+
channel: request.channel
|
|
11
|
+
}),
|
|
12
|
+
integrations: () => harness.integrations().map((integration) => ({
|
|
13
|
+
name: integration.integration,
|
|
14
|
+
version: integration.version,
|
|
15
|
+
provenance: integration.provenance.kind === "registry" ? "registry" : "local",
|
|
16
|
+
bindingMode: integration.bindingMode
|
|
17
|
+
}))
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
createExperienceRuntime
|
|
22
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HarnessIntegration } from '../../registry.js';
|
|
2
|
+
import { type HarnessSurface } from '../surfaces.js';
|
|
3
|
+
/**
|
|
4
|
+
* The Preview sub-sections an integration uses: Widgets, Marketplace tile,
|
|
5
|
+
* Activation form and Triggers, minus any it does not register.
|
|
6
|
+
*/
|
|
7
|
+
export declare function previewSections(integration: Pick<HarnessIntegration, 'widgets' | 'tile' | 'activationForm' | 'definition'>): HarnessSurface[];
|
|
8
|
+
export declare function previewHref(slug: string, segment?: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Where an old `/<slug>/widgets|tile|activation|triggers` address lands now,
|
|
11
|
+
* or null when the path is not one of them. `rest` keeps `/widgets/<id>`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function legacyPreviewTarget(pathname: string): string | null;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { HARNESS_SURFACES } from "../surfaces.js";
|
|
2
|
+
function previewSections(integration) {
|
|
3
|
+
const definition = integration.definition;
|
|
4
|
+
const uses = {
|
|
5
|
+
widgets: integration.widgets.length > 0,
|
|
6
|
+
tile: Boolean(integration.tile),
|
|
7
|
+
activation: Boolean(integration.activationForm),
|
|
8
|
+
triggers: Boolean(
|
|
9
|
+
definition && ((definition.webhooks?.length ?? 0) > 0 || (definition.schedules?.length ?? 0) > 0 || Boolean(definition.oauth) || (definition.agentEvents?.length ?? 0) > 0)
|
|
10
|
+
)
|
|
11
|
+
};
|
|
12
|
+
return HARNESS_SURFACES.filter((surface) => uses[surface.segment] ?? false);
|
|
13
|
+
}
|
|
14
|
+
function previewHref(slug, segment) {
|
|
15
|
+
const base = `/integrations/${slug}/preview`;
|
|
16
|
+
return segment ? `${base}/${segment}` : base;
|
|
17
|
+
}
|
|
18
|
+
function legacyPreviewTarget(pathname) {
|
|
19
|
+
const segments = pathname.split("/").filter(Boolean);
|
|
20
|
+
const [slug, segment, ...rest] = segments;
|
|
21
|
+
if (!slug) return null;
|
|
22
|
+
if (!segment) return previewHref(slug);
|
|
23
|
+
if (!HARNESS_SURFACES.some((surface) => surface.segment === segment)) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
return [previewHref(slug, segment), ...rest].join("/");
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
legacyPreviewTarget,
|
|
30
|
+
previewHref,
|
|
31
|
+
previewSections
|
|
32
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
3
|
+
import { type RepoClient } from './console-client.js';
|
|
4
|
+
export declare const repoKeys: {
|
|
5
|
+
repo: readonly ['repo', 'overview'];
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* The repo-root server's view for the repo home, Connections and the
|
|
9
|
+
* per-experience Connect checklist. Own QueryClient so it can sit beside (or
|
|
10
|
+
* inside) a package's console providers without sharing their cache.
|
|
11
|
+
*/
|
|
12
|
+
export declare function RepoProviders({ client, queryClient, children, }: {
|
|
13
|
+
client?: RepoClient;
|
|
14
|
+
queryClient?: QueryClient;
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
}): import("react").JSX.Element;
|
|
17
|
+
export declare function useRepoClient(): RepoClient;
|
|
18
|
+
export declare function useRepo(): import("@tanstack/react-query").UseQueryResult<import("../../api-types.js").RepoResponse, Error>;
|
|
19
|
+
export declare function useDisconnect(): import("@tanstack/react-query").UseMutationResult<import("../../api-types.js").RepoDisconnectResponse, Error, string, unknown>;
|
|
20
|
+
export declare function useRepoHealth(): import("@tanstack/react-query").UseMutationResult<import("./console-types.js").HealthResult, Error, string, unknown>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, use, useState } from "react";
|
|
4
|
+
import {
|
|
5
|
+
QueryClient,
|
|
6
|
+
QueryClientProvider,
|
|
7
|
+
useMutation,
|
|
8
|
+
useQuery,
|
|
9
|
+
useQueryClient
|
|
10
|
+
} from "@tanstack/react-query";
|
|
11
|
+
import { createHttpRepoClient } from "./console-client.js";
|
|
12
|
+
const RepoClientContext = createContext(null);
|
|
13
|
+
const repoKeys = { repo: ["repo", "overview"] };
|
|
14
|
+
function RepoProviders({
|
|
15
|
+
client,
|
|
16
|
+
queryClient,
|
|
17
|
+
children
|
|
18
|
+
}) {
|
|
19
|
+
const [defaults] = useState(() => ({
|
|
20
|
+
client: createHttpRepoClient(),
|
|
21
|
+
queryClient: new QueryClient({
|
|
22
|
+
defaultOptions: { queries: { retry: false, staleTime: 2e3 } }
|
|
23
|
+
})
|
|
24
|
+
}));
|
|
25
|
+
return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient ?? defaults.queryClient, children: /* @__PURE__ */ jsx(RepoClientContext, { value: client ?? defaults.client, children }) });
|
|
26
|
+
}
|
|
27
|
+
function useRepoClient() {
|
|
28
|
+
const client = use(RepoClientContext);
|
|
29
|
+
if (!client) {
|
|
30
|
+
throw new Error(
|
|
31
|
+
"useRepoClient() was called outside RepoProviders. Mount the repo pages under RepoLayout."
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
return client;
|
|
35
|
+
}
|
|
36
|
+
function useRepo() {
|
|
37
|
+
const client = useRepoClient();
|
|
38
|
+
return useQuery({
|
|
39
|
+
queryKey: repoKeys.repo,
|
|
40
|
+
queryFn: () => client.getRepo()
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function useDisconnect() {
|
|
44
|
+
const client = useRepoClient();
|
|
45
|
+
const queryClient = useQueryClient();
|
|
46
|
+
return useMutation({
|
|
47
|
+
mutationFn: (integration) => client.disconnect(integration),
|
|
48
|
+
onSettled: () => queryClient.invalidateQueries({ queryKey: repoKeys.repo })
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function useRepoHealth() {
|
|
52
|
+
const client = useRepoClient();
|
|
53
|
+
return useMutation({
|
|
54
|
+
mutationFn: (integration) => client.runHealth(integration)
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
RepoProviders,
|
|
59
|
+
repoKeys,
|
|
60
|
+
useDisconnect,
|
|
61
|
+
useRepo,
|
|
62
|
+
useRepoClient,
|
|
63
|
+
useRepoHealth
|
|
64
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { RunRecord } from './console-types.js';
|
|
2
|
+
/** Rows shown before "Show more". */
|
|
3
|
+
export declare const RUN_PAGE_SIZE = 50;
|
|
4
|
+
export type RunOutcome = 'ok' | 'refused' | 'failed' | 'held';
|
|
5
|
+
export declare const RUN_OUTCOMES: readonly RunOutcome[];
|
|
6
|
+
/**
|
|
7
|
+
* The outcome a person filters by: `ok`; `held` (a write waiting on, or denied,
|
|
8
|
+
* an approval); `refused` (the harness said no); `failed` (it ran and broke).
|
|
9
|
+
*/
|
|
10
|
+
export declare function runOutcome(run: Pick<RunRecord, 'status' | 'reason'>): RunOutcome;
|
|
11
|
+
/** A sentence for a refusal reason such as `operation_not_declared`, or null for an unknown one. */
|
|
12
|
+
export declare function explainRunReason(reason: string | undefined): string | null;
|
|
13
|
+
export interface RunFilter {
|
|
14
|
+
outcome: RunOutcome | 'all';
|
|
15
|
+
integration: string | 'all';
|
|
16
|
+
}
|
|
17
|
+
export declare const NO_RUN_FILTER: RunFilter;
|
|
18
|
+
/** Newest first, filtered. */
|
|
19
|
+
export declare function filterRuns(runs: readonly RunRecord[], filter: RunFilter): RunRecord[];
|
|
20
|
+
/** The first `limit` rows, and whether more follow. */
|
|
21
|
+
export declare function pageRuns<T>(rows: readonly T[], limit: number): {
|
|
22
|
+
shown: T[];
|
|
23
|
+
remaining: number;
|
|
24
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const RUN_PAGE_SIZE = 50;
|
|
2
|
+
const RUN_OUTCOMES = [
|
|
3
|
+
"ok",
|
|
4
|
+
"refused",
|
|
5
|
+
"failed",
|
|
6
|
+
"held"
|
|
7
|
+
];
|
|
8
|
+
const HELD_REASONS = /* @__PURE__ */ new Set([
|
|
9
|
+
"write_not_approved",
|
|
10
|
+
"write_refused_on_channel"
|
|
11
|
+
]);
|
|
12
|
+
function runOutcome(run) {
|
|
13
|
+
if (run.status === "ok") return "ok";
|
|
14
|
+
if (run.status === "error") return "failed";
|
|
15
|
+
return run.reason && HELD_REASONS.has(run.reason) ? "held" : "refused";
|
|
16
|
+
}
|
|
17
|
+
const REASON_EXPLANATIONS = {
|
|
18
|
+
slot_unknown: "This experience doesn't use that integration.",
|
|
19
|
+
operation_not_declared: "This experience didn't declare that operation in its integrations.",
|
|
20
|
+
operation_not_in_contract: "The integration's contract has no operation with that name.",
|
|
21
|
+
write_refused_on_channel: "This channel is not allowed to make changes, so the write was held back.",
|
|
22
|
+
write_not_approved: "A write needs approval first, and it was rejected or expired.",
|
|
23
|
+
mode_not_permitted: "The integration doesn't allow that run mode (live or fixtures) for this call.",
|
|
24
|
+
binding_missing: "The integration is not connected.",
|
|
25
|
+
invalid_input: "The input didn't match the operation's schema.",
|
|
26
|
+
input_too_large: "The input was larger than the executor allows.",
|
|
27
|
+
deadline_exceeded: "The operation took longer than the executor allows.",
|
|
28
|
+
execution_failed: "The operation ran and threw an error.",
|
|
29
|
+
output_invalid: "The response didn't match the operation's output schema.",
|
|
30
|
+
output_too_large: "The response was larger than the executor allows.",
|
|
31
|
+
rate_limited: "Too many calls in a short time.",
|
|
32
|
+
product_unavailable: "The integration is not available."
|
|
33
|
+
};
|
|
34
|
+
function explainRunReason(reason) {
|
|
35
|
+
return reason ? REASON_EXPLANATIONS[reason] ?? null : null;
|
|
36
|
+
}
|
|
37
|
+
const NO_RUN_FILTER = { outcome: "all", integration: "all" };
|
|
38
|
+
function filterRuns(runs, filter) {
|
|
39
|
+
return runs.filter(
|
|
40
|
+
(run) => (filter.outcome === "all" || runOutcome(run) === filter.outcome) && (filter.integration === "all" || run.integration === filter.integration)
|
|
41
|
+
).slice().reverse();
|
|
42
|
+
}
|
|
43
|
+
function pageRuns(rows, limit) {
|
|
44
|
+
return {
|
|
45
|
+
shown: rows.slice(0, limit),
|
|
46
|
+
remaining: Math.max(0, rows.length - limit)
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
NO_RUN_FILTER,
|
|
51
|
+
RUN_OUTCOMES,
|
|
52
|
+
RUN_PAGE_SIZE,
|
|
53
|
+
explainRunReason,
|
|
54
|
+
filterRuns,
|
|
55
|
+
pageRuns,
|
|
56
|
+
runOutcome
|
|
57
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { JsonSchema, ValidationIssue } from './console-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The pure half of the JSON-Schema form: which control a schema node gets,
|
|
4
|
+
* what an untouched node's value is, and a small instance validator for inline
|
|
5
|
+
* errors. The host-side validator (`validateAgainstSchema`) stays the
|
|
6
|
+
* authority; this one exists so a form can say "required" before a round trip.
|
|
7
|
+
*/
|
|
8
|
+
export type FieldKind = 'object' | 'array' | 'enum' | 'string' | 'number' | 'integer' | 'boolean' | 'unsupported';
|
|
9
|
+
export interface FieldShape {
|
|
10
|
+
kind: FieldKind;
|
|
11
|
+
nullable: boolean;
|
|
12
|
+
/** The node with `null` stripped from its type, for rendering. */
|
|
13
|
+
schema: JsonSchema;
|
|
14
|
+
}
|
|
15
|
+
export declare function classify(input: JsonSchema): FieldShape;
|
|
16
|
+
export declare function objectProperties(schema: JsonSchema): Array<{
|
|
17
|
+
key: string;
|
|
18
|
+
schema: JsonSchema;
|
|
19
|
+
required: boolean;
|
|
20
|
+
}>;
|
|
21
|
+
/** A starting value: schema default, first example, else a type skeleton. */
|
|
22
|
+
export declare function initialValue(input: JsonSchema): unknown;
|
|
23
|
+
/** Issues keyed by JSON-pointer path; `''` is the root. */
|
|
24
|
+
export declare function validateValue(schema: JsonSchema, value: unknown): ValidationIssue[];
|
|
25
|
+
export declare function issuesByPath(issues: readonly ValidationIssue[]): Map<string, string>;
|
|
26
|
+
/** Parse a raw-JSON editor's text: the value, or the parse error to show. */
|
|
27
|
+
export declare function parseJsonText(text: string): {
|
|
28
|
+
ok: true;
|
|
29
|
+
value: unknown;
|
|
30
|
+
} | {
|
|
31
|
+
ok: false;
|
|
32
|
+
error: string;
|
|
33
|
+
};
|
|
34
|
+
export declare function formatJson(value: unknown): string;
|