@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.
Files changed (187) hide show
  1. package/dist/api-types.d.ts +490 -0
  2. package/dist/api-types.js +6 -0
  3. package/dist/api.d.ts +33 -0
  4. package/dist/api.js +36 -1
  5. package/dist/app.js +6 -1
  6. package/dist/internal/components/approvals-tray.d.ts +17 -0
  7. package/dist/internal/components/approvals-tray.js +116 -0
  8. package/dist/internal/components/ask-assistant-bridge.js +1 -1
  9. package/dist/internal/components/connect-controls.d.ts +12 -0
  10. package/dist/internal/components/connect-controls.js +69 -0
  11. package/dist/internal/components/connect-dialog.d.ts +19 -0
  12. package/dist/internal/components/connect-dialog.js +61 -0
  13. package/dist/internal/components/connect-panel.d.ts +25 -0
  14. package/dist/internal/components/connect-panel.js +292 -0
  15. package/dist/internal/components/connection-chip.d.ts +14 -0
  16. package/dist/internal/components/connection-chip.js +75 -0
  17. package/dist/internal/components/dashboard-grid.js +38 -24
  18. package/dist/internal/components/dev-toolbar.js +176 -103
  19. package/dist/internal/components/events-panel.d.ts +10 -0
  20. package/dist/internal/components/events-panel.js +111 -0
  21. package/dist/internal/components/health-panel.d.ts +4 -0
  22. package/dist/internal/components/health-panel.js +56 -0
  23. package/dist/internal/components/integration-badge.d.ts +29 -0
  24. package/dist/internal/components/integration-badge.js +105 -0
  25. package/dist/internal/components/local-oauth-panel.js +21 -1
  26. package/dist/internal/components/operation-runner-panel.d.ts +12 -0
  27. package/dist/internal/components/operation-runner-panel.js +331 -0
  28. package/dist/internal/components/provenance-banner.d.ts +12 -0
  29. package/dist/internal/components/provenance-banner.js +107 -0
  30. package/dist/internal/components/repo-connection.d.ts +10 -0
  31. package/dist/internal/components/repo-connection.js +32 -0
  32. package/dist/internal/components/run-log.d.ts +9 -0
  33. package/dist/internal/components/run-log.js +228 -0
  34. package/dist/internal/components/runtime-strip.d.ts +12 -0
  35. package/dist/internal/components/runtime-strip.js +158 -0
  36. package/dist/internal/components/schema-form.d.ts +13 -0
  37. package/dist/internal/components/schema-form.js +382 -0
  38. package/dist/internal/components/scrollable-nav.d.ts +12 -0
  39. package/dist/internal/components/scrollable-nav.js +68 -0
  40. package/dist/internal/components/surface-nav.d.ts +31 -1
  41. package/dist/internal/components/surface-nav.js +244 -31
  42. package/dist/internal/components/workflow-runner.d.ts +14 -0
  43. package/dist/internal/components/workflow-runner.js +104 -0
  44. package/dist/internal/lib/bundled-secrets.d.ts +9 -0
  45. package/dist/internal/lib/bundled-secrets.js +24 -0
  46. package/dist/internal/lib/chrome-slot.d.ts +2 -0
  47. package/dist/internal/lib/chrome-slot.js +25 -0
  48. package/dist/internal/lib/connection-facts.d.ts +44 -0
  49. package/dist/internal/lib/connection-facts.js +116 -0
  50. package/dist/internal/lib/console-client.d.ts +55 -0
  51. package/dist/internal/lib/console-client.js +295 -0
  52. package/dist/internal/lib/console-context.d.ts +56 -0
  53. package/dist/internal/lib/console-context.js +67 -0
  54. package/dist/internal/lib/console-hooks.d.ts +33 -0
  55. package/dist/internal/lib/console-hooks.js +118 -0
  56. package/dist/internal/lib/console-types.d.ts +279 -0
  57. package/dist/internal/lib/console-types.js +0 -0
  58. package/dist/internal/lib/experience-runtime.d.ts +8 -0
  59. package/dist/internal/lib/experience-runtime.js +22 -0
  60. package/dist/internal/lib/preview-sections.d.ts +13 -0
  61. package/dist/internal/lib/preview-sections.js +32 -0
  62. package/dist/internal/lib/repo-context.d.ts +20 -0
  63. package/dist/internal/lib/repo-context.js +64 -0
  64. package/dist/internal/lib/run-log-view.d.ts +24 -0
  65. package/dist/internal/lib/run-log-view.js +57 -0
  66. package/dist/internal/lib/schema-form-model.d.ts +34 -0
  67. package/dist/internal/lib/schema-form-model.js +272 -0
  68. package/dist/internal/lib/toolbar-context.d.ts +9 -1
  69. package/dist/internal/lib/toolbar-context.js +13 -3
  70. package/dist/internal/lib/toolbar-visibility.d.ts +16 -0
  71. package/dist/internal/lib/toolbar-visibility.js +31 -0
  72. package/dist/internal/registry-context.d.ts +2 -0
  73. package/dist/internal/registry-context.js +11 -9
  74. package/dist/internal/routes/activation-page.js +44 -20
  75. package/dist/internal/routes/console-home-page.d.ts +5 -0
  76. package/dist/internal/routes/console-home-page.js +18 -0
  77. package/dist/internal/routes/experience-connect-page.d.ts +6 -0
  78. package/dist/internal/routes/experience-connect-page.js +127 -0
  79. package/dist/internal/routes/experience-layout-page.d.ts +8 -0
  80. package/dist/internal/routes/experience-layout-page.js +126 -0
  81. package/dist/internal/routes/experience-page-host.d.ts +7 -0
  82. package/dist/internal/routes/experience-page-host.js +79 -0
  83. package/dist/internal/routes/experience-review-queue-page.d.ts +2 -0
  84. package/dist/internal/routes/experience-review-queue-page.js +60 -0
  85. package/dist/internal/routes/experience-runs-page.d.ts +1 -0
  86. package/dist/internal/routes/experience-runs-page.js +13 -0
  87. package/dist/internal/routes/experience-summary-page.d.ts +1 -0
  88. package/dist/internal/routes/experience-summary-page.js +101 -0
  89. package/dist/internal/routes/experience-widget-page.d.ts +1 -0
  90. package/dist/internal/routes/experience-widget-page.js +26 -0
  91. package/dist/internal/routes/experience-widgets-page.d.ts +6 -0
  92. package/dist/internal/routes/experience-widgets-page.js +22 -0
  93. package/dist/internal/routes/experience-workflow-page.d.ts +1 -0
  94. package/dist/internal/routes/experience-workflow-page.js +24 -0
  95. package/dist/internal/routes/experience-workflows-page.d.ts +1 -0
  96. package/dist/internal/routes/experience-workflows-page.js +44 -0
  97. package/dist/internal/routes/index-page.d.ts +10 -9
  98. package/dist/internal/routes/index-page.js +3 -68
  99. package/dist/internal/routes/integration-layout.d.ts +12 -1
  100. package/dist/internal/routes/integration-layout.js +20 -6
  101. package/dist/internal/routes/integrations-connect-page.d.ts +1 -0
  102. package/dist/internal/routes/integrations-connect-page.js +19 -0
  103. package/dist/internal/routes/integrations-events-page.d.ts +1 -0
  104. package/dist/internal/routes/integrations-events-page.js +10 -0
  105. package/dist/internal/routes/integrations-health-page.d.ts +1 -0
  106. package/dist/internal/routes/integrations-health-page.js +10 -0
  107. package/dist/internal/routes/integrations-layout.d.ts +17 -0
  108. package/dist/internal/routes/integrations-layout.js +106 -0
  109. package/dist/internal/routes/integrations-list-page.d.ts +2 -0
  110. package/dist/internal/routes/integrations-list-page.js +94 -0
  111. package/dist/internal/routes/integrations-operation-page.d.ts +1 -0
  112. package/dist/internal/routes/integrations-operation-page.js +29 -0
  113. package/dist/internal/routes/integrations-operations-page.d.ts +1 -0
  114. package/dist/internal/routes/integrations-operations-page.js +61 -0
  115. package/dist/internal/routes/integrations-overview-page.d.ts +1 -0
  116. package/dist/internal/routes/integrations-overview-page.js +90 -0
  117. package/dist/internal/routes/integrations-runs-page.d.ts +1 -0
  118. package/dist/internal/routes/integrations-runs-page.js +14 -0
  119. package/dist/internal/routes/integrations-scope.d.ts +12 -0
  120. package/dist/internal/routes/integrations-scope.js +39 -0
  121. package/dist/internal/routes/legacy-preview-redirect.d.ts +6 -0
  122. package/dist/internal/routes/legacy-preview-redirect.js +12 -0
  123. package/dist/internal/routes/preview-index-page.d.ts +2 -0
  124. package/dist/internal/routes/preview-index-page.js +14 -0
  125. package/dist/internal/routes/repo-connections-page.d.ts +6 -0
  126. package/dist/internal/routes/repo-connections-page.js +8 -0
  127. package/dist/internal/routes/repo-home-page.d.ts +2 -0
  128. package/dist/internal/routes/repo-home-page.js +320 -0
  129. package/dist/internal/routes/repo-layout.d.ts +7 -0
  130. package/dist/internal/routes/repo-layout.js +76 -0
  131. package/dist/internal/routes/repo-package-layouts.d.ts +20 -0
  132. package/dist/internal/routes/repo-package-layouts.js +104 -0
  133. package/dist/internal/routes/root-layout.d.ts +3 -1
  134. package/dist/internal/routes/root-layout.js +13 -3
  135. package/dist/internal/routes/single-widget-page.js +5 -12
  136. package/dist/internal/routes/tile-page.js +20 -41
  137. package/dist/internal/routes/triggers-page.js +55 -62
  138. package/dist/internal/routes/widgets-page.js +1 -1
  139. package/dist/internal/server/api-router.js +46 -4
  140. package/dist/internal/server/approvals.d.ts +44 -0
  141. package/dist/internal/server/approvals.js +76 -0
  142. package/dist/internal/server/contract-sources.d.ts +28 -0
  143. package/dist/internal/server/contract-sources.js +83 -0
  144. package/dist/internal/server/definition-loader.d.ts +22 -0
  145. package/dist/internal/server/definition-loader.js +125 -0
  146. package/dist/internal/server/ekanos-api-router.d.ts +34 -0
  147. package/dist/internal/server/ekanos-api-router.js +835 -0
  148. package/dist/internal/server/experience-loader.d.ts +57 -0
  149. package/dist/internal/server/experience-loader.js +146 -0
  150. package/dist/internal/server/integration-lookup.d.ts +29 -0
  151. package/dist/internal/server/integration-lookup.js +33 -0
  152. package/dist/internal/server/integration-resolver.d.ts +121 -0
  153. package/dist/internal/server/integration-resolver.js +605 -0
  154. package/dist/internal/server/live-invoker.d.ts +11 -0
  155. package/dist/internal/server/live-invoker.js +106 -0
  156. package/dist/internal/server/local-secrets.d.ts +82 -1
  157. package/dist/internal/server/local-secrets.js +112 -1
  158. package/dist/internal/server/local-state.d.ts +12 -0
  159. package/dist/internal/server/local-state.js +45 -0
  160. package/dist/internal/server/oauth-persistence.d.ts +19 -0
  161. package/dist/internal/server/oauth-persistence.js +76 -0
  162. package/dist/internal/server/operation-runner.d.ts +95 -0
  163. package/dist/internal/server/operation-runner.js +231 -0
  164. package/dist/internal/server/project-manifest.d.ts +71 -0
  165. package/dist/internal/server/project-manifest.js +215 -0
  166. package/dist/internal/server/registry-cache.d.ts +68 -0
  167. package/dist/internal/server/registry-cache.js +328 -0
  168. package/dist/internal/server/repo-api-router.d.ts +33 -0
  169. package/dist/internal/server/repo-api-router.js +391 -0
  170. package/dist/internal/server/run-log.d.ts +22 -0
  171. package/dist/internal/server/run-log.js +32 -0
  172. package/dist/internal/server/semantics.d.ts +28 -0
  173. package/dist/internal/server/semantics.js +67 -0
  174. package/dist/internal/server/session-catalog.d.ts +67 -0
  175. package/dist/internal/server/session-catalog.js +18 -0
  176. package/dist/internal/server/workflow-runner.d.ts +36 -0
  177. package/dist/internal/server/workflow-runner.js +183 -0
  178. package/dist/registry.d.ts +7 -0
  179. package/dist/resolver.d.ts +145 -0
  180. package/dist/resolver.js +211 -0
  181. package/dist/routes.d.ts +66 -2
  182. package/dist/routes.js +61 -3
  183. package/dist/runtime.d.ts +46 -0
  184. package/dist/runtime.js +60 -0
  185. package/package.json +23 -9
  186. package/dist/internal/routes/integration-index-page.d.ts +0 -13
  187. package/dist/internal/routes/integration-index-page.js +0 -17
@@ -0,0 +1,183 @@
1
+ import * as fs from "node:fs";
2
+ import * as path from "node:path";
3
+ function getPath(context, ref) {
4
+ let current = context;
5
+ for (const part of ref.split(".")) {
6
+ if (current === null || typeof current !== "object") return void 0;
7
+ current = current[part];
8
+ }
9
+ return current;
10
+ }
11
+ function resolveArgs(value, context) {
12
+ if (typeof value === "string") {
13
+ return value.replace(/\{\{\s*([\w.]+)\s*\}\}/g, (_, ref) => {
14
+ const found = getPath(context, ref);
15
+ return typeof found === "string" ? found : JSON.stringify(found ?? "");
16
+ });
17
+ }
18
+ if (Array.isArray(value))
19
+ return value.map((item) => resolveArgs(item, context));
20
+ if (value !== null && typeof value === "object") {
21
+ const record = value;
22
+ if (typeof record.ref === "string" && Object.keys(record).length === 1) {
23
+ return getPath(context, record.ref);
24
+ }
25
+ return Object.fromEntries(
26
+ Object.entries(record).map(([key, item]) => [
27
+ key,
28
+ resolveArgs(item, context)
29
+ ])
30
+ );
31
+ }
32
+ return value;
33
+ }
34
+ function orderSteps(workflow) {
35
+ const byId = new Map(workflow.steps.map((step) => [step.id, step]));
36
+ const incoming = new Map(
37
+ workflow.steps.map((step) => [step.id, 0])
38
+ );
39
+ for (const edge of workflow.edges) {
40
+ incoming.set(edge.to, (incoming.get(edge.to) ?? 0) + 1);
41
+ }
42
+ const ready = workflow.steps.filter(
43
+ (step) => (incoming.get(step.id) ?? 0) === 0
44
+ );
45
+ const ordered = [];
46
+ while (ready.length > 0) {
47
+ const next = ready.shift();
48
+ ordered.push(next);
49
+ for (const edge of workflow.edges.filter((e) => e.from === next.id)) {
50
+ const left = (incoming.get(edge.to) ?? 1) - 1;
51
+ incoming.set(edge.to, left);
52
+ const target = byId.get(edge.to);
53
+ if (left === 0 && target) ready.push(target);
54
+ }
55
+ }
56
+ return ordered;
57
+ }
58
+ function aiFixture(projectRoot, ref) {
59
+ if (!/^[A-Za-z0-9_-]+$/.test(ref)) return { found: false };
60
+ try {
61
+ return {
62
+ found: true,
63
+ value: JSON.parse(
64
+ fs.readFileSync(
65
+ path.join(projectRoot, "fixtures", "ai", `${ref}.json`),
66
+ "utf8"
67
+ )
68
+ )
69
+ };
70
+ } catch {
71
+ return { found: false };
72
+ }
73
+ }
74
+ async function runWorkflow(workflow, deps) {
75
+ const steps = [];
76
+ const context = {};
77
+ let gate = null;
78
+ let completed = true;
79
+ for (const step of orderSteps(workflow)) {
80
+ if (step.type === "fusion_tool") {
81
+ const integration = typeof step.slot === "string" ? step.slot : "";
82
+ const op = typeof step.tool === "string" ? step.tool : "";
83
+ const effect = deps.effectOf?.(integration, op) ?? step.effect;
84
+ const isWrite = effect === "write";
85
+ const covering = isWrite && gate && (gate.integration === null || gate.integration === integration) ? gate : null;
86
+ const useGate = covering ? { stepId: covering.stepId } : void 0;
87
+ const outcome = await deps.run(
88
+ {
89
+ integration,
90
+ op,
91
+ input: resolveArgs(step.args ?? {}, context),
92
+ channel: "workflow",
93
+ origin: `workflow:${workflow.id}/${step.id}`
94
+ },
95
+ useGate
96
+ );
97
+ if (isWrite)
98
+ gate = covering ? { stepId: covering.stepId, integration } : null;
99
+ if (outcome.result.ok) {
100
+ context[step.id] = outcome.result.data;
101
+ steps.push({
102
+ id: step.id,
103
+ type: step.type,
104
+ status: "ok",
105
+ output: outcome.result.data,
106
+ runId: outcome.run.id
107
+ });
108
+ } else {
109
+ steps.push({
110
+ id: step.id,
111
+ type: step.type,
112
+ status: outcome.result.reason === "write_not_approved" ? "rejected" : "refused",
113
+ detail: `${outcome.result.reason}: ${outcome.result.message}`,
114
+ runId: outcome.run.id
115
+ });
116
+ completed = false;
117
+ break;
118
+ }
119
+ } else if (step.type === "approval_gate") {
120
+ const summary = String(
121
+ resolveArgs(
122
+ typeof step.summaryTemplate === "string" ? step.summaryTemplate : step.id,
123
+ context
124
+ )
125
+ );
126
+ const pending = deps.approvals.request(
127
+ { kind: "gate", summary, workflowId: workflow.id, stepId: step.id },
128
+ deps.approvalTimeoutMs
129
+ );
130
+ const decision = await pending.decision;
131
+ if (decision === "approved") {
132
+ gate = { stepId: step.id, integration: null };
133
+ steps.push({
134
+ id: step.id,
135
+ type: step.type,
136
+ status: "ok",
137
+ detail: summary
138
+ });
139
+ } else {
140
+ steps.push({
141
+ id: step.id,
142
+ type: step.type,
143
+ status: "rejected",
144
+ detail: decision === "rejected" ? "rejected in the approvals tray" : "the approval expired"
145
+ });
146
+ completed = false;
147
+ break;
148
+ }
149
+ } else if (step.type === "ai_step") {
150
+ const ref = typeof step.outputSchemaRef === "string" ? step.outputSchemaRef : "";
151
+ const fixture = aiFixture(deps.projectRoot, ref);
152
+ if (!fixture.found) {
153
+ steps.push({
154
+ id: step.id,
155
+ type: step.type,
156
+ status: "error",
157
+ detail: `no fixture for outputSchemaRef "${ref}": add fixtures/ai/${ref}.json`
158
+ });
159
+ completed = false;
160
+ break;
161
+ }
162
+ context[step.id] = fixture.value;
163
+ steps.push({
164
+ id: step.id,
165
+ type: step.type,
166
+ status: "ok",
167
+ output: fixture.value
168
+ });
169
+ } else {
170
+ steps.push({
171
+ id: step.id,
172
+ type: step.type,
173
+ status: "not-simulated",
174
+ detail: `step type "${step.type}" is not simulated locally`
175
+ });
176
+ }
177
+ }
178
+ return { workflowId: workflow.id, steps, completed };
179
+ }
180
+ export {
181
+ resolveArgs,
182
+ runWorkflow
183
+ };
@@ -336,6 +336,13 @@ export interface HarnessIntegration {
336
336
  slug: string;
337
337
  name: string;
338
338
  description: string;
339
+ /**
340
+ * `'integration'` (default) or `'experience'`, mirroring `ekanos.json`
341
+ * `kind`. An integration-only entry carries no widgets (`widgets: []`) and
342
+ * lands on the Integration console; the harness reads the project's own
343
+ * `ekanos.json` for the real answer, so this is a hint for the registry.
344
+ */
345
+ kind?: 'integration' | 'experience';
339
346
  widgets: HarnessWidget[];
340
347
  /**
341
348
  * Recorded HTTP exchanges per variant — the documented default.
@@ -0,0 +1,145 @@
1
+ /**
2
+ * `@ekanos/harness/resolver` — the integration resolver, importable WITHOUT React or
3
+ * Next, for `ekanos add` / `ekanos sync` / `ekanos check` (lane B) and the CLI.
4
+ * Node only. It reads the project's static files and contract sources; it
5
+ * executes integration code only for a local override or a published package
6
+ * the dev's Source owns (decision O1).
7
+ */
8
+ export { type ResolveIntegrationsOptions, type ResolvedIntegration, type RegistryInstaller, type IntegrationResolution, formatProvenanceLines, resolveIntegrations, } from './internal/server/integration-resolver.js';
9
+ export { type Availability, type RepoDiscovery, type RepoManifest, type RepoPackage, type RepoProblem, type RepoPublishPlan, RepoManifestError, RepoManifestSchema, discoverRepo, findRepoRoot, isRepoRoot, packageContaining, planRepoOrder, } from '@ekanos/integration-schema/repo';
10
+ export { type ProjectManifest, type ProjectOverrides, type IntegrationOverride, type IntegrationEntry, OVERRIDES_FILENAME, ProjectFileError, INTEGRATION_OVERRIDE_ENV_PREFIX, readLockfile, readProjectKind, readProjectManifest, readProjectOverrides, } from './internal/server/project-manifest.js';
11
+ export { type EnsureResult, ensurePublishedIntegration, integrationPackageName, registryTokenEnvName, } from './internal/server/registry-cache.js';
12
+ import { type IntegrationOverride } from './internal/server/project-manifest.js';
13
+ /**
14
+ * Overrides currently in force for a project (`ekanos.local.json` plus
15
+ * `EKANOS_INTEGRATION_OVERRIDE_<INTEGRATION>`), for `ekanos publish` to refuse on.
16
+ * Never throws for a missing manifest: no manifest, no overrides.
17
+ */
18
+ export declare function activeOverrides(projectRoot: string, env?: Readonly<Record<string, string | undefined>>): IntegrationOverride[];
19
+ /**
20
+ * Adapter for the integration-pins check stage's `createIntegrationPinsStage({ resolve })`: resolves
21
+ * every integration once (async), then answers the stage's synchronous lookup from
22
+ * the result. An integration the resolver could not resolve returns null, so the stage
23
+ * falls back to the committed snapshot and reports its own pin problem.
24
+ */
25
+ export declare function createPinsResolver(options: import('./internal/server/integration-resolver.js').ResolveIntegrationsOptions): Promise<(integration: {
26
+ name: string;
27
+ version: string;
28
+ }) => {
29
+ contract: {
30
+ schemaVersion: 1;
31
+ integration: string;
32
+ packageVersion: string;
33
+ contractVersion: string;
34
+ compatLine: string;
35
+ connection: {
36
+ levels: ("source" | "team" | "user")[];
37
+ auth: "api_key" | "none" | "oauth2";
38
+ scopes: string[];
39
+ };
40
+ health?: boolean | undefined;
41
+ operations: {
42
+ id: string;
43
+ kind: "action" | "tool";
44
+ name: string;
45
+ description: string;
46
+ effect: "read" | "write";
47
+ sensitivity: "financial" | "internal" | "pii" | "public";
48
+ input: Record<string, unknown>;
49
+ output: Record<string, unknown>;
50
+ opaque: {
51
+ input: boolean;
52
+ output: boolean;
53
+ };
54
+ opaqueReason?: string | undefined;
55
+ outputExample?: unknown;
56
+ since?: string | undefined;
57
+ }[];
58
+ events: {
59
+ name: string;
60
+ payload: Record<string, unknown>;
61
+ opaque: boolean;
62
+ payloadExample?: unknown;
63
+ }[];
64
+ digest: string;
65
+ };
66
+ lines: string[];
67
+ } | null>;
68
+ /**
69
+ * A pluggable contract source for `ekanos add` / `ekanos sync` (the CLI's
70
+ * `ContractSource` interface): answers `<integration>@<version>` through the
71
+ * registry chain — session catalog availability, the published-package cache
72
+ * for an integration the dev's Source owns (O1), then the contracts directory.
73
+ * Local overrides are ignored: they describe what you RUN, not what you pin.
74
+ */
75
+ export declare function createRegistryContractSource(options: {
76
+ projectRoot: string;
77
+ env?: Readonly<Record<string, string | undefined>>;
78
+ contractsDir?: string;
79
+ registry?: import('./internal/server/integration-resolver.js').RegistryInstaller | false;
80
+ }): {
81
+ name: string;
82
+ resolve(name: string, version: string): Promise<{
83
+ contract: {
84
+ schemaVersion: 1;
85
+ integration: string;
86
+ packageVersion: string;
87
+ contractVersion: string;
88
+ compatLine: string;
89
+ connection: {
90
+ levels: ("source" | "team" | "user")[];
91
+ auth: "api_key" | "none" | "oauth2";
92
+ scopes: string[];
93
+ };
94
+ health?: boolean | undefined;
95
+ operations: {
96
+ id: string;
97
+ kind: "action" | "tool";
98
+ name: string;
99
+ description: string;
100
+ effect: "read" | "write";
101
+ sensitivity: "financial" | "internal" | "pii" | "public";
102
+ input: Record<string, unknown>;
103
+ output: Record<string, unknown>;
104
+ opaque: {
105
+ input: boolean;
106
+ output: boolean;
107
+ };
108
+ opaqueReason?: string | undefined;
109
+ outputExample?: unknown;
110
+ since?: string | undefined;
111
+ }[];
112
+ events: {
113
+ name: string;
114
+ payload: Record<string, unknown>;
115
+ opaque: boolean;
116
+ payloadExample?: unknown;
117
+ }[];
118
+ digest: string;
119
+ };
120
+ origin: string;
121
+ kind: 'dir';
122
+ } | null>;
123
+ };
124
+ /**
125
+ * Run ONE operation of a project through the harness runner (the same
126
+ * executor order and refusal reasons the console and the API use), for
127
+ * `ekanos contract --record`. A write is refused on this channel
128
+ * (`httpWrites: 'refuse'`), never held for an approval nobody is there to give
129
+ * — except in fixtures mode with an authored `default` scenario fixture, which
130
+ * only reads a file. Live, a write is never run.
131
+ * An integration project's integration is its own slug; `deriveContract` lets the
132
+ * caller hand over the contract it just derived instead of a committed one.
133
+ */
134
+ export declare function runOperationOnce(options: {
135
+ projectRoot: string;
136
+ /** Relative key, `tool/get_headlines`. */
137
+ op: string;
138
+ input?: unknown;
139
+ mode?: import('./api-types.js').RunMode;
140
+ /** The integration to run; defaults to the project's own integration. */
141
+ integration?: string;
142
+ env?: Readonly<Record<string, string | undefined>>;
143
+ contractsDir?: string;
144
+ deriveContract?: import('./internal/server/integration-resolver.js').ResolveIntegrationsOptions['deriveContract'];
145
+ }): Promise<import('./api-types.js').OperationResult>;
@@ -0,0 +1,211 @@
1
+ import {
2
+ formatProvenanceLines,
3
+ resolveIntegrations
4
+ } from "./internal/server/integration-resolver.js";
5
+ import {
6
+ RepoManifestError,
7
+ RepoManifestSchema,
8
+ discoverRepo,
9
+ findRepoRoot,
10
+ isRepoRoot,
11
+ packageContaining,
12
+ planRepoOrder
13
+ } from "@ekanos/integration-schema/repo";
14
+ import {
15
+ OVERRIDES_FILENAME,
16
+ ProjectFileError,
17
+ INTEGRATION_OVERRIDE_ENV_PREFIX,
18
+ readLockfile,
19
+ readProjectKind,
20
+ readProjectManifest,
21
+ readProjectOverrides
22
+ } from "./internal/server/project-manifest.js";
23
+ import {
24
+ ensurePublishedIntegration,
25
+ integrationPackageName,
26
+ registryTokenEnvName
27
+ } from "./internal/server/registry-cache.js";
28
+ import {
29
+ repoOf,
30
+ sameRepoPackage
31
+ } from "./internal/server/integration-resolver.js";
32
+ import {
33
+ ProjectFileError as ProjectFileError2,
34
+ readProjectManifest as readProjectManifest2,
35
+ readProjectOverrides as readProjectOverrides2
36
+ } from "./internal/server/project-manifest.js";
37
+ function activeOverrides(projectRoot, env = process.env) {
38
+ let names = [];
39
+ let renames = {};
40
+ try {
41
+ const manifest = readProjectManifest2(projectRoot);
42
+ names = manifest.integrations.map((u) => u.name);
43
+ renames = manifest.renames;
44
+ } catch {
45
+ names = [];
46
+ }
47
+ try {
48
+ const info = readProjectOverrides2(
49
+ projectRoot,
50
+ env,
51
+ names,
52
+ renames
53
+ );
54
+ const repo = repoOf(projectRoot);
55
+ return info.overrides.filter((override) => {
56
+ const pkg = sameRepoPackage(repo, projectRoot, override.integration);
57
+ return !(pkg && pkg.dir === override.path);
58
+ });
59
+ } catch (error) {
60
+ if (!(error instanceof ProjectFileError2)) throw error;
61
+ return [
62
+ {
63
+ integration: "(ekanos.local.json)",
64
+ path: "unreadable file",
65
+ mode: "fixtures",
66
+ via: "file"
67
+ }
68
+ ];
69
+ }
70
+ }
71
+ async function createPinsResolver(options) {
72
+ const { resolveIntegrations: resolveIntegrations2 } = await import("./internal/server/integration-resolver.js");
73
+ const { readSessionCatalog } = await import("./internal/server/session-catalog.js");
74
+ const resolution = await resolveIntegrations2({
75
+ ignoreOverrides: true,
76
+ ...options,
77
+ ...options.catalog === void 0 ? { catalog: readSessionCatalog(options.projectRoot) } : {}
78
+ });
79
+ return (integration) => {
80
+ const resolved = resolution.integrations.find(
81
+ (s) => s.integration === integration.name
82
+ );
83
+ return resolved ? { contract: resolved.contract, lines: [resolved.contract.compatLine] } : null;
84
+ };
85
+ }
86
+ function createRegistryContractSource(options) {
87
+ return {
88
+ name: "harness registry resolver",
89
+ async resolve(name, version) {
90
+ const { resolveIntegrations: resolveIntegrations2 } = await import("./internal/server/integration-resolver.js");
91
+ const { readSessionCatalog } = await import("./internal/server/session-catalog.js");
92
+ const resolution = await resolveIntegrations2({
93
+ projectRoot: options.projectRoot,
94
+ ...options.env ? { env: options.env } : {},
95
+ ...options.contractsDir ? { contractsDir: options.contractsDir } : {},
96
+ ...options.registry !== void 0 ? { registry: options.registry } : {},
97
+ catalog: readSessionCatalog(options.projectRoot),
98
+ ignoreOverrides: true,
99
+ manifest: {
100
+ kind: "experience",
101
+ slug: null,
102
+ slugs: [],
103
+ entry: null,
104
+ contractsDir: "contracts",
105
+ deprecatedUses: false,
106
+ renames: {},
107
+ integrations: [
108
+ {
109
+ name,
110
+ version,
111
+ operations: [],
112
+ required: "optional",
113
+ modes: ["team"]
114
+ }
115
+ ]
116
+ }
117
+ });
118
+ const resolved = resolution.integrations[0];
119
+ if (!resolved) return null;
120
+ const p = resolved.provenance;
121
+ return {
122
+ contract: resolved.contract,
123
+ origin: p.kind === "registry" ? `${p.source} ${p.origin}` : `local ${p.path}`,
124
+ kind: "dir"
125
+ };
126
+ }
127
+ };
128
+ }
129
+ async function runOperationOnce(options) {
130
+ const { resolveIntegrations: resolveIntegrations2 } = await import("./internal/server/integration-resolver.js");
131
+ const { readSessionCatalog } = await import("./internal/server/session-catalog.js");
132
+ const { runOperation, createFileFixtureSource } = await import("./internal/server/operation-runner.js");
133
+ const { createApprovalsTray } = await import("./internal/server/approvals.js");
134
+ const { createRunLog } = await import("./internal/server/run-log.js");
135
+ const { createLiveInvoker } = await import("./internal/server/live-invoker.js");
136
+ const resolution = await resolveIntegrations2({
137
+ projectRoot: options.projectRoot,
138
+ ...options.env ? { env: options.env } : {},
139
+ ...options.contractsDir ? { contractsDir: options.contractsDir } : {},
140
+ ...options.deriveContract ? { deriveContract: options.deriveContract } : {},
141
+ catalog: readSessionCatalog(options.projectRoot)
142
+ });
143
+ const integration = options.integration ? resolution.integrations.find(
144
+ (candidate) => candidate.integration === options.integration
145
+ ) : resolution.integrations.find((candidate) => candidate.self) ?? resolution.integrations[0];
146
+ if (!integration) {
147
+ const problem = resolution.errors[0]?.message;
148
+ return {
149
+ ok: false,
150
+ reason: "slot_unknown",
151
+ message: "No such integration.",
152
+ ...problem ? { detail: problem } : {}
153
+ };
154
+ }
155
+ const fixtures = createFileFixtureSource(options.projectRoot);
156
+ const mode = options.mode ?? integration.defaultMode;
157
+ const operation = integration.contract.operations.find(
158
+ (candidate) => candidate.id.endsWith(`/${options.op}`)
159
+ );
160
+ let gate;
161
+ if (operation?.effect === "write" && mode === "fixtures") {
162
+ if (fixtures.read(integration.integration, options.op, "default").found) {
163
+ gate = { stepId: "contract-record" };
164
+ }
165
+ }
166
+ const outcome = await runOperation(
167
+ {
168
+ integration: integration.integration,
169
+ op: options.op,
170
+ input: options.input ?? {},
171
+ channel: "http",
172
+ ...options.mode ? { mode: options.mode } : {},
173
+ origin: "contract --record",
174
+ ...gate ? { gate } : {}
175
+ },
176
+ {
177
+ integrations: resolution.integrations,
178
+ channels: { httpWrites: "refuse" },
179
+ approvals: createApprovalsTray(),
180
+ runLog: createRunLog(),
181
+ fixtures,
182
+ live: createLiveInvoker()
183
+ }
184
+ );
185
+ return outcome.result;
186
+ }
187
+ export {
188
+ INTEGRATION_OVERRIDE_ENV_PREFIX,
189
+ OVERRIDES_FILENAME,
190
+ ProjectFileError,
191
+ RepoManifestError,
192
+ RepoManifestSchema,
193
+ activeOverrides,
194
+ createPinsResolver,
195
+ createRegistryContractSource,
196
+ discoverRepo,
197
+ ensurePublishedIntegration,
198
+ findRepoRoot,
199
+ formatProvenanceLines,
200
+ integrationPackageName,
201
+ isRepoRoot,
202
+ packageContaining,
203
+ planRepoOrder,
204
+ readLockfile,
205
+ readProjectKind,
206
+ readProjectManifest,
207
+ readProjectOverrides,
208
+ registryTokenEnvName,
209
+ resolveIntegrations,
210
+ runOperationOnce
211
+ };
package/dist/routes.d.ts CHANGED
@@ -17,10 +17,74 @@
17
17
  * the six route modules being bundled together rather than per route; for a
18
18
  * local dev tool that is not a real cost.
19
19
  */
20
- export { IntegrationLayout } from './internal/routes/integration-layout.js';
21
- export { IntegrationIndexPage } from './internal/routes/integration-index-page.js';
20
+ export { IntegrationLayout, PreviewLayout, } from './internal/routes/integration-layout.js';
21
+ export { LegacyPreviewRedirect } from './internal/routes/legacy-preview-redirect.js';
22
+ export { PreviewIndexPage } from './internal/routes/preview-index-page.js';
22
23
  export { WidgetsPage } from './internal/routes/widgets-page.js';
23
24
  export { SingleWidgetPage } from './internal/routes/single-widget-page.js';
24
25
  export { TilePage } from './internal/routes/tile-page.js';
25
26
  export { ActivationPage } from './internal/routes/activation-page.js';
26
27
  export { TriggersPage } from './internal/routes/triggers-page.js';
28
+ /**
29
+ * The Integration console (`/integrations/…`) and the Experience view
30
+ * (`/experience/…`). Mount `ConsoleLayout` in the shell's
31
+ * `app/integrations/layout.tsx` and `app/experience/layout.tsx`; the pages
32
+ * map one-to-one onto the route files:
33
+ *
34
+ * /integrations IntegrationsListPage
35
+ * /integrations/[slug] IntegrationOverviewPage
36
+ * /integrations/[slug]/connect IntegrationConnectPage
37
+ * /integrations/[slug]/operations IntegrationOperationsPage
38
+ * /integrations/[slug]/operations/[kind]/[name] IntegrationOperationPage
39
+ * /integrations/[slug]/events IntegrationEventsPage
40
+ * /integrations/[slug]/health IntegrationHealthPage
41
+ * /integrations/[slug]/runs IntegrationRunsPage
42
+ * /integrations/[slug]/preview/… PreviewLayout + the Preview surfaces
43
+ * /experience ExperienceSummaryPage
44
+ * /experience/widgets ExperienceWidgetsPage
45
+ * /experience/widgets/[id] ExperienceWidgetPage
46
+ * /experience/pages/[id]/[...path] ExperiencePageHost
47
+ * /experience/layout ExperienceLayoutPage
48
+ * /experience/workflows ExperienceWorkflowsPage
49
+ * /experience/workflows/[id] ExperienceWorkflowPage
50
+ * /experience/review-queue ExperienceReviewQueuePage
51
+ * /experience/runs ExperienceRunsPage
52
+ * / (mode-aware home) ConsoleHomePage
53
+ */
54
+ export { ConsoleLayout } from './internal/routes/integrations-layout.js';
55
+ export { ConsoleHomePage } from './internal/routes/console-home-page.js';
56
+ export { IntegrationsListPage } from './internal/routes/integrations-list-page.js';
57
+ export { IntegrationOverviewPage } from './internal/routes/integrations-overview-page.js';
58
+ export { IntegrationConnectPage } from './internal/routes/integrations-connect-page.js';
59
+ export { IntegrationOperationsPage } from './internal/routes/integrations-operations-page.js';
60
+ export { IntegrationOperationPage } from './internal/routes/integrations-operation-page.js';
61
+ export { IntegrationEventsPage } from './internal/routes/integrations-events-page.js';
62
+ export { IntegrationHealthPage } from './internal/routes/integrations-health-page.js';
63
+ export { IntegrationRunsPage } from './internal/routes/integrations-runs-page.js';
64
+ export { ExperienceSummaryPage } from './internal/routes/experience-summary-page.js';
65
+ export { ExperienceWidgetsPage } from './internal/routes/experience-widgets-page.js';
66
+ export { ExperienceWidgetPage } from './internal/routes/experience-widget-page.js';
67
+ export { ExperiencePageHost } from './internal/routes/experience-page-host.js';
68
+ export { ExperienceLayoutPage } from './internal/routes/experience-layout-page.js';
69
+ export { ExperienceWorkflowsPage } from './internal/routes/experience-workflows-page.js';
70
+ export { ExperienceWorkflowPage } from './internal/routes/experience-workflow-page.js';
71
+ export { ExperienceReviewQueuePage } from './internal/routes/experience-review-queue-page.js';
72
+ export { ExperienceRunsPage } from './internal/routes/experience-runs-page.js';
73
+ export type { ExperienceSurfacePage, ExperienceSurfaces, } from './internal/lib/console-context.js';
74
+ export type { ConsoleClient } from './internal/lib/console-client.js';
75
+ /**
76
+ * The repo shell (`ekanos dev` at a repo root): the repo home, the
77
+ * Connections page, the per-experience Connect checklist, and the layouts
78
+ * that mount each package's existing console under its own namespace.
79
+ *
80
+ * / RepoHomePage
81
+ * /connections RepoConnectionsPage
82
+ * /integrations/[slug]/… RepoIntegrationLayout + the console pages
83
+ * /experiences/[name]/… RepoExperienceLayout + the experience pages
84
+ * /experiences/[name]/connect ExperienceConnectPage
85
+ */
86
+ export { RepoLayout } from './internal/routes/repo-layout.js';
87
+ export { RepoHomePage } from './internal/routes/repo-home-page.js';
88
+ export { RepoConnectionsPage } from './internal/routes/repo-connections-page.js';
89
+ export { ExperienceConnectPage } from './internal/routes/experience-connect-page.js';
90
+ export { RepoExperienceLayout, RepoIntegrationLayout, } from './internal/routes/repo-package-layouts.js';