@enhance-eng/enhance 0.1.22 → 0.1.33

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enhance-eng/enhance",
3
- "version": "0.1.22",
3
+ "version": "0.1.33",
4
4
  "private": false,
5
5
  "description": "Agent-first command-line interface for Enhance.",
6
6
  "keywords": [
@@ -31,12 +31,14 @@
31
31
  "!dist/*.map"
32
32
  ],
33
33
  "scripts": {
34
- "build": "tsdown",
34
+ "build": "pnpm --filter @enhance-eng/sdk build && tsdown",
35
+ "build:desktop": "ENHANCE3_DESKTOP_RUNTIME=1 tsdown",
35
36
  "prepack": "pnpm run build",
36
- "test": "pnpm run test:e2e",
37
+ "test": "pnpm run test:unit && pnpm run test:e2e",
37
38
  "test:e2e": "pnpm run build && node e2e/e2e-runner.ts",
38
39
  "test:e2e:browser": "pnpm run build && playwright test",
39
- "typecheck": "tsc --noEmit"
40
+ "test:unit": "vitest run --config vitest.config.ts",
41
+ "typecheck": "pnpm --filter @enhance-eng/sdk build && tsc --noEmit"
40
42
  },
41
43
  "dependencies": {
42
44
  "@modelcontextprotocol/core": "2.0.0",
@@ -45,18 +47,23 @@
45
47
  "@trpc/client": "11.18.0",
46
48
  "@trpc/server": "11.18.0",
47
49
  "commander": "^14.0.0",
50
+ "css-tree": "3.2.1",
48
51
  "fractional-indexing": "^4.0.0",
52
+ "parse5": "8.0.1",
49
53
  "trpc-cli": "0.16.0",
54
+ "yauzl": "3.4.0",
50
55
  "yazl": "3.3.1",
51
56
  "zod": "^4.4.3"
52
57
  },
53
58
  "devDependencies": {
54
59
  "@bcoe/v8-coverage": "1.0.2",
60
+ "@enhance-eng/sdk": "workspace:*",
55
61
  "@enhance3/api": "workspace:*",
56
62
  "@enhance3/contract": "workspace:*",
57
63
  "@enhance3/tsconfig": "workspace:*",
58
64
  "@modelcontextprotocol/client": "2.0.0",
59
65
  "@playwright/test": "^1.62.0",
66
+ "@types/css-tree": "2.3.11",
60
67
  "@types/yauzl": "3.4.0",
61
68
  "@types/yazl": "3.3.1",
62
69
  "@vitest/coverage-v8": "catalog:",
@@ -65,8 +72,7 @@
65
72
  "istanbul-lib-coverage": "3.2.2",
66
73
  "tsdown": "^0.22.14",
67
74
  "tsx": "^4.23.1",
68
- "vitest": "catalog:",
69
- "yauzl": "3.4.0"
75
+ "vitest": "catalog:"
70
76
  },
71
77
  "engines": {
72
78
  "node": ">=24"
@@ -1,119 +0,0 @@
1
- #!/usr/bin/env node
2
- import { o as toFailurePayload } from "./cli-output-identity.lib-a1wTreJ6.mjs";
3
- import { a as createOauthLoopbackAdapter, m as createAuthUseCase, n as createHttpRemoteAdapter, o as createCapabilityInvocationAdapter, t as createMutationKeyAdapter } from "./mutation-key.adapter-B3ugNA3r.mjs";
4
- import { z } from "zod";
5
-
6
- //#region src/infrastructure/mcp-auth.adapter.ts
7
- const loginInputSchema = z.object({ openBrowser: z.boolean() });
8
- const createMcpAuthAdapter = (credentials, remote) => {
9
- const auth = createAuthUseCase(credentials, remote, createOauthLoopbackAdapter(remote));
10
- let active = null;
11
- let state = null;
12
- return {
13
- login: async (offered) => {
14
- if (active !== null) return active.ready;
15
- const input = loginInputSchema.parse(offered);
16
- const controller = new AbortController();
17
- const ready = Promise.withResolvers();
18
- state = null;
19
- const complete = async () => {
20
- try {
21
- await auth.loginWithBrowser({
22
- label: "Agent plugin",
23
- openBrowser: input.openBrowser,
24
- signal: controller.signal,
25
- onReady: (url) => {
26
- state = {
27
- authenticated: false,
28
- status: "waiting_for_browser",
29
- url
30
- };
31
- ready.resolve(state);
32
- }
33
- });
34
- state = null;
35
- } catch (error) {
36
- state = {
37
- authenticated: false,
38
- status: "failed",
39
- error: toFailurePayload(error, null)
40
- };
41
- ready.reject(error);
42
- } finally {
43
- active = null;
44
- }
45
- };
46
- const completion = complete();
47
- active = {
48
- controller,
49
- ready: ready.promise,
50
- completion
51
- };
52
- return ready.promise;
53
- },
54
- status: async () => {
55
- if (state !== null) return state;
56
- if (await credentials.read() === null) return { authenticated: false };
57
- return auth.status();
58
- },
59
- logout: async () => {
60
- active?.controller.abort();
61
- await active?.completion;
62
- state = null;
63
- return auth.logout();
64
- }
65
- };
66
- };
67
-
68
- //#endregion
69
- //#region src/infrastructure/mcp-invocation.adapter.ts
70
- const TRANSPORT_CAPABILITIES = /* @__PURE__ */ new Set([
71
- "auth.login",
72
- "auth.logout",
73
- "auth.status",
74
- "doctor"
75
- ]);
76
- const invokeTransport = async (input) => {
77
- switch (input.capability) {
78
- case "auth.login": return input.auth.login(input.arguments);
79
- case "auth.logout": return input.auth.logout();
80
- case "auth.status": return input.auth.status();
81
- case "doctor": {
82
- const [api, credential] = await Promise.all([input.remote.health(), input.credentials.read()]);
83
- return {
84
- status: credential !== null && api.reachable ? "ok" : "degraded",
85
- runtimeVersion: input.version,
86
- api: {
87
- reachable: api.reachable,
88
- status: api.status,
89
- ...api.error !== void 0 && { error: api.error }
90
- },
91
- credential: { present: credential !== null }
92
- };
93
- }
94
- default: throw new TypeError(`${input.capability} has no MCP transport execution`);
95
- }
96
- };
97
- const createMcpInvocationAdapter = (apiUrl, credentials, configDirectory, version) => {
98
- const transportRemote = createHttpRemoteAdapter(apiUrl, credentials, createMutationKeyAdapter());
99
- const auth = createMcpAuthAdapter(credentials, transportRemote);
100
- return { invoke: async (request) => {
101
- if (TRANSPORT_CAPABILITIES.has(request.capability.id)) return invokeTransport({
102
- capability: request.capability.id,
103
- arguments: request.arguments,
104
- credentials,
105
- remote: transportRemote,
106
- version,
107
- auth
108
- });
109
- const mutationKey = createMutationKeyAdapter();
110
- return createCapabilityInvocationAdapter({
111
- remote: createHttpRemoteAdapter(apiUrl, credentials, mutationKey),
112
- mutationKey,
113
- configDirectory
114
- }).invoke(request);
115
- } };
116
- };
117
-
118
- //#endregion
119
- export { createMcpInvocationAdapter as t };