@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
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_CREDENTIAL_LEVEL,
|
|
3
|
+
DEFAULT_OAUTH_CONNECTION_ID,
|
|
4
|
+
oauthProviderPlaceholders
|
|
5
|
+
} from "@ekanos/sdk/integration";
|
|
6
|
+
import { resolveConnectAs } from "./console-state.js";
|
|
7
|
+
import { oauthClientKey } from "./local-secrets.js";
|
|
8
|
+
const MAIN_CONNECTION_LABEL = "Main connection";
|
|
9
|
+
function declaredOAuthConnections(definition) {
|
|
10
|
+
return [
|
|
11
|
+
...definition.oauth ? [
|
|
12
|
+
[DEFAULT_OAUTH_CONNECTION_ID, definition.oauth]
|
|
13
|
+
] : [],
|
|
14
|
+
...Object.entries(definition.oauthConnections ?? {})
|
|
15
|
+
];
|
|
16
|
+
}
|
|
17
|
+
function connectionKeys(oauth, filled) {
|
|
18
|
+
const keys = /* @__PURE__ */ new Map();
|
|
19
|
+
const add = (name, label = name, secret = true) => {
|
|
20
|
+
if (!keys.has(name)) {
|
|
21
|
+
keys.set(name, { name, label, secret, set: filled.has(name) });
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
for (const field of oauth.teamApp?.fields ?? []) {
|
|
25
|
+
add(field.secretName, field.label, field.sensitive !== false);
|
|
26
|
+
}
|
|
27
|
+
add(oauth.credentials.clientIdSecretName);
|
|
28
|
+
add(oauth.credentials.clientSecretSecretName);
|
|
29
|
+
for (const name of oauthProviderPlaceholders(oauth.provider)) {
|
|
30
|
+
add(name, name, false);
|
|
31
|
+
}
|
|
32
|
+
return [...keys.values()];
|
|
33
|
+
}
|
|
34
|
+
function describeOAuthConnections(input) {
|
|
35
|
+
const filled = new Set(input.filled);
|
|
36
|
+
return declaredOAuthConnections(input.definition).map(([id, oauth]) => {
|
|
37
|
+
const live = id === DEFAULT_OAUTH_CONNECTION_ID ? input.held?.connection ?? null : input.held?.connections[id] ?? null;
|
|
38
|
+
const clientId = input.values[oauth.credentials.clientIdSecretName];
|
|
39
|
+
const kept = input.stored[id];
|
|
40
|
+
const storedValid = kept && clientId && kept.clientKey === oauthClientKey(clientId) ? kept : null;
|
|
41
|
+
const level = oauth.level ?? DEFAULT_CREDENTIAL_LEVEL;
|
|
42
|
+
const connectAs = input.personal ? resolveConnectAs({
|
|
43
|
+
switches: input.personal.switches,
|
|
44
|
+
slug: input.personal.slug,
|
|
45
|
+
credential: `oauth:${id}`,
|
|
46
|
+
level
|
|
47
|
+
}) : void 0;
|
|
48
|
+
const mine = input.personal?.stored[id];
|
|
49
|
+
const mineValid = mine && clientId && mine.clientKey === oauthClientKey(clientId) ? mine : null;
|
|
50
|
+
const obtainedAt = connectAs === "me" ? mineValid?.obtainedAt ?? null : live?.obtainedAt ?? storedValid?.obtainedAt ?? null;
|
|
51
|
+
return {
|
|
52
|
+
id,
|
|
53
|
+
label: id === DEFAULT_OAUTH_CONNECTION_ID ? MAIN_CONNECTION_LABEL : oauth.label ?? id,
|
|
54
|
+
...oauth.description ? { description: oauth.description } : {},
|
|
55
|
+
teamApp: oauth.teamApp !== void 0,
|
|
56
|
+
keys: connectionKeys(oauth, filled),
|
|
57
|
+
...oauth.provider.authorizationParams && Object.keys(oauth.provider.authorizationParams).length > 0 ? { authorizationParams: { ...oauth.provider.authorizationParams } } : {},
|
|
58
|
+
level,
|
|
59
|
+
...connectAs ? { connectAs } : {},
|
|
60
|
+
connected: obtainedAt !== null,
|
|
61
|
+
obtainedAt
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
MAIN_CONNECTION_LABEL,
|
|
67
|
+
declaredOAuthConnections,
|
|
68
|
+
describeOAuthConnections
|
|
69
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IntegrationContext } from '@ekanos/sdk';
|
|
2
|
-
import type
|
|
2
|
+
import { type OAuthProviderDeclaration, type OAuthTokens } from '@ekanos/sdk/integration';
|
|
3
3
|
/**
|
|
4
4
|
* ─────────────────────────────────────────────────────────────────────────────
|
|
5
5
|
* THE LOCALHOST OAUTH LOOP — pure helpers
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
joinOAuthScopes
|
|
3
|
+
} from "@ekanos/sdk/integration";
|
|
1
4
|
import { createHash, randomBytes } from "node:crypto";
|
|
2
5
|
function generateCodeVerifier() {
|
|
3
6
|
return randomBytes(32).toString("base64url");
|
|
@@ -40,7 +43,7 @@ function buildAuthorizeUrl(input) {
|
|
|
40
43
|
url.searchParams.set("response_type", "code");
|
|
41
44
|
url.searchParams.set("client_id", input.clientId);
|
|
42
45
|
url.searchParams.set("redirect_uri", input.redirectUri);
|
|
43
|
-
url.searchParams.set("scope", input.provider
|
|
46
|
+
url.searchParams.set("scope", joinOAuthScopes(input.provider));
|
|
44
47
|
url.searchParams.set("state", input.state);
|
|
45
48
|
if (input.codeChallenge) {
|
|
46
49
|
url.searchParams.set("code_challenge", input.codeChallenge);
|
|
@@ -8,6 +8,19 @@ export declare function persistOauthConnection(args: {
|
|
|
8
8
|
tokens: OAuthTokens;
|
|
9
9
|
fact: LiveConnection;
|
|
10
10
|
}): void;
|
|
11
|
+
/**
|
|
12
|
+
* Keep the OAuth connection the local person made as themselves, in their own
|
|
13
|
+
* tier. It is never replayed: `onTokens` already wrote what it writes into
|
|
14
|
+
* that tier, so the tier alone is the connection.
|
|
15
|
+
*/
|
|
16
|
+
export declare function persistPersonOauthConnection(args: {
|
|
17
|
+
projectRoot: string;
|
|
18
|
+
slug: string;
|
|
19
|
+
connectionId: string;
|
|
20
|
+
clientId: string;
|
|
21
|
+
tokens: OAuthTokens;
|
|
22
|
+
fact: LiveConnection;
|
|
23
|
+
}): void;
|
|
11
24
|
/** Whether tokens are stored for `slug`, whether or not a live context holds them. */
|
|
12
25
|
export declare function hasStoredOauthConnection(projectRoot: string, slug: string): boolean;
|
|
13
26
|
/** Replay stored tokens into a freshly built live context, once per context. */
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_OAUTH_CONNECTION_ID
|
|
3
3
|
} from "@ekanos/sdk/integration";
|
|
4
|
+
import { HARNESS_USER_ID } from "../../registry.js";
|
|
4
5
|
import {
|
|
5
6
|
oauthClientKey,
|
|
6
7
|
readOauthConnections,
|
|
8
|
+
updatePersonTier,
|
|
7
9
|
writeOauthConnection
|
|
8
10
|
} from "./local-secrets.js";
|
|
9
11
|
function oauthFor(definition, connectionId) {
|
|
@@ -30,6 +32,31 @@ function persistOauthConnection(args) {
|
|
|
30
32
|
);
|
|
31
33
|
}
|
|
32
34
|
}
|
|
35
|
+
function persistPersonOauthConnection(args) {
|
|
36
|
+
const written = updatePersonTier({
|
|
37
|
+
projectRoot: args.projectRoot,
|
|
38
|
+
slug: args.slug,
|
|
39
|
+
userId: HARNESS_USER_ID,
|
|
40
|
+
update: (tier) => ({
|
|
41
|
+
...tier,
|
|
42
|
+
oauth: {
|
|
43
|
+
...tier.oauth,
|
|
44
|
+
[args.connectionId]: {
|
|
45
|
+
tokens: args.tokens,
|
|
46
|
+
obtainedAt: args.fact.obtainedAt,
|
|
47
|
+
expiresAt: args.fact.expiresAt,
|
|
48
|
+
scope: args.fact.scope,
|
|
49
|
+
clientKey: oauthClientKey(args.clientId)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
if (!written.ok) {
|
|
55
|
+
console.error(
|
|
56
|
+
`[harness:${args.slug}] could not keep the personal OAuth connection: ${written.message}`
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
33
60
|
function hasStoredOauthConnection(projectRoot, slug) {
|
|
34
61
|
return Object.keys(readOauthConnections({ projectRoot, slug })).length > 0;
|
|
35
62
|
}
|
|
@@ -72,5 +99,6 @@ async function restoreOauthConnections(args) {
|
|
|
72
99
|
export {
|
|
73
100
|
hasStoredOauthConnection,
|
|
74
101
|
persistOauthConnection,
|
|
102
|
+
persistPersonOauthConnection,
|
|
75
103
|
restoreOauthConnections
|
|
76
104
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
interpretErrorFixture,
|
|
2
3
|
isConfirmed,
|
|
3
4
|
requiresConfirmation
|
|
4
5
|
} from "@ekanos/integration-schema";
|
|
@@ -23,6 +24,14 @@ function servesBindingMode(integration, channel) {
|
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
const OP_KEY = /^(tool|action)\/([a-z][a-z0-9_-]*)$/;
|
|
27
|
+
class FixtureRefusal extends Error {
|
|
28
|
+
constructor(reason, detail) {
|
|
29
|
+
super(detail ?? reason);
|
|
30
|
+
this.name = "FixtureRefusal";
|
|
31
|
+
this.reason = reason;
|
|
32
|
+
if (detail !== void 0) this.detail = detail;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
26
35
|
class DeadlineError extends Error {
|
|
27
36
|
constructor() {
|
|
28
37
|
super("operation deadline exceeded");
|
|
@@ -199,6 +208,9 @@ async function runOperation(request, deps) {
|
|
|
199
208
|
if (error instanceof DeadlineError) {
|
|
200
209
|
return refuse("deadline_exceeded", void 0, "error");
|
|
201
210
|
}
|
|
211
|
+
if (error instanceof FixtureRefusal) {
|
|
212
|
+
return refuse(error.reason, error.detail, "error");
|
|
213
|
+
}
|
|
202
214
|
return refuse(
|
|
203
215
|
"execution_failed",
|
|
204
216
|
error instanceof Error ? error.message : String(error),
|
|
@@ -239,8 +251,16 @@ async function runOperation(request, deps) {
|
|
|
239
251
|
function fixtureOutput(fixtures, integration, opKey, scenario, _contract, operation) {
|
|
240
252
|
if (scenario === "error") {
|
|
241
253
|
const authored2 = fixtures.read(integration, opKey, "error");
|
|
254
|
+
if (!authored2.found) throw new Error("error scenario");
|
|
255
|
+
const error = interpretErrorFixture(authored2.value);
|
|
256
|
+
if (error.kind === "refusal") {
|
|
257
|
+
throw new FixtureRefusal(error.reason, error.message);
|
|
258
|
+
}
|
|
259
|
+
if (error.kind === "invalid") {
|
|
260
|
+
throw new Error(`error fixture is invalid: ${error.problem}`);
|
|
261
|
+
}
|
|
242
262
|
throw new Error(
|
|
243
|
-
|
|
263
|
+
`error scenario: ${typeof error.value === "string" ? error.value : JSON.stringify(redactSensitive(error.value))}`
|
|
244
264
|
);
|
|
245
265
|
}
|
|
246
266
|
const authored = fixtures.read(integration, opKey, scenario);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { IntegrationSecrets } from '@ekanos/sdk';
|
|
2
|
+
import type { MockIntegrationContext } from '@ekanos/sdk/testing';
|
|
3
|
+
import type { HarnessRunAs } from '../../api-types.js';
|
|
4
|
+
/** The local person's tier, read from and written through to disk. */
|
|
5
|
+
export declare function createPersonSecrets(args: {
|
|
6
|
+
projectRoot: string;
|
|
7
|
+
slug: string;
|
|
8
|
+
userId?: string;
|
|
9
|
+
}): IntegrationSecrets;
|
|
10
|
+
/** The live context as `runAs` calls it. Never mutates `base`. */
|
|
11
|
+
/**
|
|
12
|
+
* The context a machine call runs with — what the host gives an
|
|
13
|
+
* integration's declared schedules and webhooks (plan 261): a machine actor
|
|
14
|
+
* and principal, no `ctx.identity` ever, and `ctx.storage.user` refused.
|
|
15
|
+
* `ctx.secrets` stays the team tier.
|
|
16
|
+
*/
|
|
17
|
+
export declare function machineContext(base: MockIntegrationContext): MockIntegrationContext;
|
|
18
|
+
export declare function contextAs(args: {
|
|
19
|
+
base: MockIntegrationContext;
|
|
20
|
+
runAs: HarnessRunAs;
|
|
21
|
+
projectRoot: string;
|
|
22
|
+
slug: string;
|
|
23
|
+
}): MockIntegrationContext;
|
|
24
|
+
/**
|
|
25
|
+
* The context `onTokens` / `onActivate` run with when a credential is being
|
|
26
|
+
* connected as the person: a `user` connection whose `ctx.secrets` IS the
|
|
27
|
+
* person's tier (over the app credentials the operator filled in) and whose
|
|
28
|
+
* `ctx.identity.secrets` is the same store.
|
|
29
|
+
*/
|
|
30
|
+
export declare function personConnectContext(args: {
|
|
31
|
+
base: MockIntegrationContext;
|
|
32
|
+
projectRoot: string;
|
|
33
|
+
slug: string;
|
|
34
|
+
adminSecrets: Readonly<Record<string, string>>;
|
|
35
|
+
}): MockIntegrationContext;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { HARNESS_USER_ID, HARNESS_USER_NAME } from "../../registry.js";
|
|
2
|
+
import { readPersonTier, updatePersonTier } from "./local-secrets.js";
|
|
3
|
+
const MACHINE_ACTOR = {
|
|
4
|
+
kind: "machine",
|
|
5
|
+
tokenId: "harness-machine",
|
|
6
|
+
createdBy: null
|
|
7
|
+
};
|
|
8
|
+
function createPersonSecrets(args) {
|
|
9
|
+
const userId = args.userId ?? HARNESS_USER_ID;
|
|
10
|
+
const where = { projectRoot: args.projectRoot, slug: args.slug, userId };
|
|
11
|
+
const values = () => {
|
|
12
|
+
const tier = readPersonTier(where);
|
|
13
|
+
return { ...tier.activation, ...tier.secrets };
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
async get(name) {
|
|
17
|
+
return values()[name] ?? null;
|
|
18
|
+
},
|
|
19
|
+
async names() {
|
|
20
|
+
return Object.keys(values()).sort();
|
|
21
|
+
},
|
|
22
|
+
async set(name, value) {
|
|
23
|
+
const written = updatePersonTier({
|
|
24
|
+
...where,
|
|
25
|
+
update: (tier) => ({
|
|
26
|
+
...tier,
|
|
27
|
+
secrets: { ...tier.secrets, [name]: value }
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
if (!written.ok) throw new Error(written.message);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function hasPersonValues(args) {
|
|
35
|
+
const tier = readPersonTier({ ...args, userId: HARNESS_USER_ID });
|
|
36
|
+
return Object.keys(tier.activation).length > 0 || Object.keys(tier.secrets).length > 0;
|
|
37
|
+
}
|
|
38
|
+
const userPrincipal = {
|
|
39
|
+
kind: "user",
|
|
40
|
+
userId: HARNESS_USER_ID,
|
|
41
|
+
displayName: HARNESS_USER_NAME,
|
|
42
|
+
avatarUrl: null
|
|
43
|
+
};
|
|
44
|
+
const userActor = {
|
|
45
|
+
kind: "user",
|
|
46
|
+
userId: HARNESS_USER_ID,
|
|
47
|
+
role: { name: "owner", hierarchyLevel: 1 }
|
|
48
|
+
};
|
|
49
|
+
function machineUserStore() {
|
|
50
|
+
const refuse = () => {
|
|
51
|
+
throw new Error(
|
|
52
|
+
'ctx.storage.user is unavailable for machine actors: there is no user to scope the row to. Switch Run as to "me" to test a person.'
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
get: async () => refuse(),
|
|
57
|
+
set: async () => refuse(),
|
|
58
|
+
delete: async () => refuse()
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function machineContext(base) {
|
|
62
|
+
const storage = {
|
|
63
|
+
...base.storage,
|
|
64
|
+
user: machineUserStore()
|
|
65
|
+
};
|
|
66
|
+
return {
|
|
67
|
+
...base,
|
|
68
|
+
userId: null,
|
|
69
|
+
actor: MACHINE_ACTOR,
|
|
70
|
+
principal: { kind: "machine" },
|
|
71
|
+
identity: void 0,
|
|
72
|
+
storage
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function contextAs(args) {
|
|
76
|
+
const { base, runAs } = args;
|
|
77
|
+
if (runAs === "machine") return machineContext(base);
|
|
78
|
+
const identity = hasPersonValues(args) ? { userId: HARNESS_USER_ID, secrets: createPersonSecrets(args) } : void 0;
|
|
79
|
+
return {
|
|
80
|
+
...base,
|
|
81
|
+
userId: HARNESS_USER_ID,
|
|
82
|
+
actor: userActor,
|
|
83
|
+
principal: userPrincipal,
|
|
84
|
+
identity
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function personConnectContext(args) {
|
|
88
|
+
const own = createPersonSecrets(args);
|
|
89
|
+
const secrets = {
|
|
90
|
+
async get(name) {
|
|
91
|
+
return await own.get(name) ?? args.adminSecrets[name] ?? null;
|
|
92
|
+
},
|
|
93
|
+
async names() {
|
|
94
|
+
return [
|
|
95
|
+
.../* @__PURE__ */ new Set([...await own.names(), ...Object.keys(args.adminSecrets)])
|
|
96
|
+
].sort();
|
|
97
|
+
},
|
|
98
|
+
set: (name, value) => own.set(name, value)
|
|
99
|
+
};
|
|
100
|
+
return {
|
|
101
|
+
...args.base,
|
|
102
|
+
connection: { owner: "user" },
|
|
103
|
+
userId: HARNESS_USER_ID,
|
|
104
|
+
actor: userActor,
|
|
105
|
+
principal: userPrincipal,
|
|
106
|
+
identity: { userId: HARNESS_USER_ID, secrets: own },
|
|
107
|
+
secrets
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
export {
|
|
111
|
+
contextAs,
|
|
112
|
+
createPersonSecrets,
|
|
113
|
+
machineContext,
|
|
114
|
+
personConnectContext
|
|
115
|
+
};
|
|
@@ -120,7 +120,10 @@ function createRepoApiRouter(partial) {
|
|
|
120
120
|
declared: data?.declared ?? [],
|
|
121
121
|
missing: data?.missing ?? [],
|
|
122
122
|
activationFieldsSet: data?.activationFieldsSet ?? [],
|
|
123
|
-
|
|
123
|
+
// The package reports each OAuth connection in the tier it connects
|
|
124
|
+
// into (a `level: 'user'` one is the person's); fall back to any held
|
|
125
|
+
// token only for a package that does not report them.
|
|
126
|
+
oauthHeld: manageable && (data?.oauth ?? contractAuth === "oauth2") && (data?.oauthConnections ? data.oauthConnections.some((connection) => connection.connected) : hasOauthConnection(pkg.name, pkg.dir)),
|
|
124
127
|
manageable,
|
|
125
128
|
target: data?.target ?? [],
|
|
126
129
|
supportsLive: manageable,
|
|
@@ -177,7 +180,7 @@ function createRepoApiRouter(partial) {
|
|
|
177
180
|
return failed(error instanceof Error ? error.message : String(error));
|
|
178
181
|
}
|
|
179
182
|
}
|
|
180
|
-
async function experienceRow(request, pkg, connections,
|
|
183
|
+
async function experienceRow(request, pkg, connections, repoPackageName) {
|
|
181
184
|
const row = {
|
|
182
185
|
name: pkg.name,
|
|
183
186
|
version: pkg.version,
|
|
@@ -192,10 +195,11 @@ function createRepoApiRouter(partial) {
|
|
|
192
195
|
}
|
|
193
196
|
const integrations = [];
|
|
194
197
|
for (const view of resolved.data.integrations) {
|
|
195
|
-
const
|
|
198
|
+
const local = repoPackageName(view.integration);
|
|
199
|
+
const sameRepo = local !== null;
|
|
196
200
|
let connection = null;
|
|
197
201
|
if (sameRepo) {
|
|
198
|
-
connection = connections.get(
|
|
202
|
+
connection = connections.get(local) ?? null;
|
|
199
203
|
} else {
|
|
200
204
|
const contract = await call(request, pkg, [
|
|
201
205
|
"contract",
|
|
@@ -233,7 +237,9 @@ function createRepoApiRouter(partial) {
|
|
|
233
237
|
...unsupported.length > 0 ? {
|
|
234
238
|
levelProblem: `Asks for ${unsupported.join(", ")} but ${view.integration} supports ${supported.join(", ") || "no level"}.`
|
|
235
239
|
} : {},
|
|
236
|
-
connectHref: sameRepo ? `/integrations/${
|
|
240
|
+
connectHref: sameRepo ? `/integrations/${local}/connect` : null,
|
|
241
|
+
consoleHref: sameRepo ? `/integrations/${local}` : null,
|
|
242
|
+
packageName: local
|
|
237
243
|
});
|
|
238
244
|
}
|
|
239
245
|
return { ...row, integrations };
|
|
@@ -247,6 +253,11 @@ function createRepoApiRouter(partial) {
|
|
|
247
253
|
(p) => p.kind === "experience"
|
|
248
254
|
);
|
|
249
255
|
const repoNames = new Set(integrationPackages.map((p) => p.name));
|
|
256
|
+
const repoPackageName = (integration) => {
|
|
257
|
+
const slash = integration.lastIndexOf("/");
|
|
258
|
+
const name = slash === -1 ? integration : integration.slice(0, slash) === repo.namespace ? integration.slice(slash + 1) : null;
|
|
259
|
+
return name !== null && repoNames.has(name) ? name : null;
|
|
260
|
+
};
|
|
250
261
|
const connections = /* @__PURE__ */ new Map();
|
|
251
262
|
const integrations = [];
|
|
252
263
|
for (const pkg of integrationPackages) {
|
|
@@ -257,12 +268,14 @@ function createRepoApiRouter(partial) {
|
|
|
257
268
|
const experiences = [];
|
|
258
269
|
for (const pkg of experiencePackages) {
|
|
259
270
|
experiences.push(
|
|
260
|
-
await experienceRow(request, pkg, connections,
|
|
271
|
+
await experienceRow(request, pkg, connections, repoPackageName)
|
|
261
272
|
);
|
|
262
273
|
}
|
|
263
274
|
for (const experience of experiences) {
|
|
264
275
|
for (const used of experience.integrations) {
|
|
265
|
-
|
|
276
|
+
if (!used.sameRepo) continue;
|
|
277
|
+
const local = repoPackageName(used.name);
|
|
278
|
+
integrations.find((row) => row.name === local)?.usedBy.push(experience.name);
|
|
266
279
|
}
|
|
267
280
|
}
|
|
268
281
|
const connectable = integrations.filter(
|
|
@@ -14,7 +14,7 @@ export type ExecutorLimits = {
|
|
|
14
14
|
maxOutputBytes: number;
|
|
15
15
|
deadlineMs: number;
|
|
16
16
|
};
|
|
17
|
-
export declare const REFUSAL_MESSAGES: Record<"binding_missing" | "confirmation_required" | "deadline_exceeded" | "execution_failed" | "input_too_large" | "invalid_input" | "mode_not_permitted" | "operation_not_declared" | "operation_not_in_contract" | "output_invalid" | "output_too_large" | "product_unavailable" | "rate_limited" | "slot_unknown" | "write_not_approved" | "write_refused_on_channel", string>;
|
|
17
|
+
export declare const REFUSAL_MESSAGES: Record<"binding_missing" | "confirmation_required" | "deadline_exceeded" | "execution_failed" | "input_too_large" | "invalid_input" | "mode_not_permitted" | "not_connected" | "operation_not_declared" | "operation_not_in_contract" | "output_invalid" | "output_too_large" | "product_unavailable" | "rate_limited" | "slot_unknown" | "write_not_approved" | "write_refused_on_channel", string>;
|
|
18
18
|
export type ValidationOutcome = {
|
|
19
19
|
valid: true;
|
|
20
20
|
} | {
|
|
@@ -19,7 +19,7 @@ export interface HarnessSurface {
|
|
|
19
19
|
label: string;
|
|
20
20
|
/** Shorter label for the landing page's link row, where space is tight. */
|
|
21
21
|
shortLabel: string;
|
|
22
|
-
/**
|
|
22
|
+
/** Phosphor icon name (phosphoricons.com). */
|
|
23
23
|
icon: string;
|
|
24
24
|
}
|
|
25
25
|
export declare const HARNESS_SURFACES: readonly HarnessSurface[];
|
|
@@ -3,25 +3,25 @@ const HARNESS_SURFACES = [
|
|
|
3
3
|
segment: "widgets",
|
|
4
4
|
label: "Widgets",
|
|
5
5
|
shortLabel: "Widgets",
|
|
6
|
-
icon: "
|
|
6
|
+
icon: "grid-four"
|
|
7
7
|
},
|
|
8
8
|
{
|
|
9
9
|
segment: "tile",
|
|
10
10
|
label: "Marketplace tile",
|
|
11
11
|
shortLabel: "Tile",
|
|
12
|
-
icon: "
|
|
12
|
+
icon: "storefront"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
segment: "activation",
|
|
16
16
|
label: "Activation",
|
|
17
17
|
shortLabel: "Activation",
|
|
18
|
-
icon: "
|
|
18
|
+
icon: "plug"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
segment: "triggers",
|
|
22
22
|
label: "Triggers",
|
|
23
23
|
shortLabel: "Triggers",
|
|
24
|
-
icon: "
|
|
24
|
+
icon: "lightning"
|
|
25
25
|
}
|
|
26
26
|
];
|
|
27
27
|
export {
|
package/dist/registry.d.ts
CHANGED
|
@@ -431,6 +431,13 @@ export type DataMode = (typeof DATA_MODES)[number];
|
|
|
431
431
|
* there is no database.
|
|
432
432
|
*/
|
|
433
433
|
export declare const HARNESS_ACCOUNT_ID = "00000000-0000-4000-8000-000000000001";
|
|
434
|
+
/**
|
|
435
|
+
* The one local person the harness acts as when a call runs "as me"
|
|
436
|
+
* (plan 261 R6): `ctx.principal.userId` and the key of the per-person
|
|
437
|
+
* credential tier in `.ekanos/local-secrets.json`.
|
|
438
|
+
*/
|
|
439
|
+
export declare const HARNESS_USER_ID = "00000000-0000-4000-8000-000000000003";
|
|
440
|
+
export declare const HARNESS_USER_NAME = "Local developer";
|
|
434
441
|
export declare const HARNESS_SOURCE_ID = "00000000-0000-4000-8000-000000000002";
|
|
435
442
|
export declare const HARNESS_ACCOUNT_SLUG = "harness-team";
|
|
436
443
|
/**
|
package/dist/registry.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const FIXTURE_VARIANTS = ["default", "empty", "error"];
|
|
2
2
|
const DATA_MODES = ["fixtures", "live"];
|
|
3
3
|
const HARNESS_ACCOUNT_ID = "00000000-0000-4000-8000-000000000001";
|
|
4
|
+
const HARNESS_USER_ID = "00000000-0000-4000-8000-000000000003";
|
|
5
|
+
const HARNESS_USER_NAME = "Local developer";
|
|
4
6
|
const HARNESS_SOURCE_ID = "00000000-0000-4000-8000-000000000002";
|
|
5
7
|
const HARNESS_ACCOUNT_SLUG = "harness-team";
|
|
6
8
|
function asHarnessDefinition(definition) {
|
|
@@ -93,6 +95,8 @@ export {
|
|
|
93
95
|
HARNESS_ACCOUNT_ID,
|
|
94
96
|
HARNESS_ACCOUNT_SLUG,
|
|
95
97
|
HARNESS_SOURCE_ID,
|
|
98
|
+
HARNESS_USER_ID,
|
|
99
|
+
HARNESS_USER_NAME,
|
|
96
100
|
asHarnessDefinition,
|
|
97
101
|
collectSeeds,
|
|
98
102
|
findEgressMismatch,
|
package/dist/styles.css
CHANGED
|
@@ -60,14 +60,9 @@
|
|
|
60
60
|
--font-heading: var(--font-heading-fallback), var(--font-sans);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
/*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* commercially licensed and cannot ship in a partner's scaffold).
|
|
67
|
-
* `@ekanos/ui`'s `Icon` draws each glyph as an <svg> from Free's own name
|
|
68
|
-
* table, so a Pro-only name draws `fa-circle-question` and a few known ones
|
|
69
|
-
* draw their nearest Free glyph (`@ekanos/ui` `_impl/fa-free-codepoints.ts`).
|
|
70
|
-
* Nothing here needs to patch the icon font. */
|
|
63
|
+
/* Icons are Phosphor (MIT): `@ekanos/ui/theme.css` declares the fonts, which
|
|
64
|
+
* ship inside `@ekanos/ui`, and draws every icon. Nothing here needs to patch
|
|
65
|
+
* the icon font. */
|
|
71
66
|
|
|
72
67
|
@layer base {
|
|
73
68
|
body {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ekanos/harness",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Ekanos integration dev harness — every surface of an integration rendered in real Ekanos chrome, from fixtures, with no Supabase or auth; and, in live mode, a real localhost OAuth loop over your own dev-app credentials.",
|
|
6
6
|
"homepage": "https://sdk.ekanos.dev/harness/overview",
|
|
@@ -72,15 +72,13 @@
|
|
|
72
72
|
"access": "public"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@ekanos/integration-schema": "0.
|
|
76
|
-
"@fortawesome/fontawesome-free": "^7.3.1",
|
|
75
|
+
"@ekanos/integration-schema": "0.27.0",
|
|
77
76
|
"next-themes": "0.4.6",
|
|
78
|
-
"tw-animate-css": "1.4.0"
|
|
79
|
-
"zod": "4.6.7"
|
|
77
|
+
"tw-animate-css": "1.4.0"
|
|
80
78
|
},
|
|
81
79
|
"devDependencies": {
|
|
82
|
-
"@ekanos/sdk": "0.
|
|
83
|
-
"@ekanos/ui": "0.
|
|
80
|
+
"@ekanos/sdk": "0.27.0",
|
|
81
|
+
"@ekanos/ui": "0.27.0",
|
|
84
82
|
"@kit/tsconfig": "0.1.0",
|
|
85
83
|
"@tailwindcss/postcss": "4.3.4",
|
|
86
84
|
"@tanstack/react-query": "5.106.1",
|
|
@@ -96,18 +94,20 @@
|
|
|
96
94
|
"tailwindcss": "4.3.4",
|
|
97
95
|
"tsup": "9.0.0",
|
|
98
96
|
"typescript": "^7.0.2",
|
|
99
|
-
"vitest": "5.1.0"
|
|
97
|
+
"vitest": "5.1.0",
|
|
98
|
+
"zod": "4.6.7"
|
|
100
99
|
},
|
|
101
100
|
"peerDependencies": {
|
|
102
|
-
"@ekanos/sdk": "^0.
|
|
103
|
-
"@ekanos/ui": "^0.
|
|
101
|
+
"@ekanos/sdk": "^0.27.0",
|
|
102
|
+
"@ekanos/ui": "^0.27.0",
|
|
104
103
|
"@tanstack/react-query": "^5.101.4",
|
|
105
104
|
"next": "^16.0.0",
|
|
106
105
|
"next-intl": "^4.14.7",
|
|
107
106
|
"react": "^19.2.8",
|
|
108
107
|
"react-dom": "^19.2.8",
|
|
109
108
|
"react-hook-form": "^7.68.0",
|
|
110
|
-
"tailwindcss": "^4.0.0"
|
|
109
|
+
"tailwindcss": "^4.0.0",
|
|
110
|
+
"zod": "^3.25.76 || ^4.0.0"
|
|
111
111
|
},
|
|
112
112
|
"ekanos": {
|
|
113
113
|
"shellContract": 5
|