@rse/ase 0.0.62 → 0.9.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/dst/ase-mcp.js +19 -21
- package/package.json +5 -5
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/.github/plugin/plugin.json +1 -1
- package/plugin/package.json +1 -1
- package/dst/ase-hello.js +0 -27
package/dst/ase-mcp.js
CHANGED
|
@@ -22,10 +22,8 @@ export default class MCPCommand {
|
|
|
22
22
|
cfg.read();
|
|
23
23
|
const svc = new Config("service", serviceSchema, this.log);
|
|
24
24
|
svc.read();
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const rawPort = svc.get("port");
|
|
28
|
-
const port = rawPort ?? null;
|
|
25
|
+
const projectId = cfg.get("project.id") ?? path.basename(process.cwd());
|
|
26
|
+
const port = svc.get("port") ?? null;
|
|
29
27
|
return { projectId, port };
|
|
30
28
|
}
|
|
31
29
|
/* run "ase service start" and wait for the service to come up */
|
|
@@ -59,7 +57,7 @@ export default class MCPCommand {
|
|
|
59
57
|
/* bridge stdio to a Streamable HTTP MCP endpoint on the local service */
|
|
60
58
|
async runBridge() {
|
|
61
59
|
/* ensure the service is running */
|
|
62
|
-
let { port } = await this.ensureService();
|
|
60
|
+
let { projectId, port } = await this.ensureService();
|
|
63
61
|
/* create MCP STDIO server (lives for the entire bridge lifetime) */
|
|
64
62
|
const server = new StdioServerTransport();
|
|
65
63
|
/* track active client and bridge-level closed state */
|
|
@@ -96,19 +94,17 @@ export default class MCPCommand {
|
|
|
96
94
|
next.onclose = () => {
|
|
97
95
|
if (client !== next || closedByUs || bridgeDone || reconnecting)
|
|
98
96
|
return;
|
|
99
|
-
|
|
100
|
-
this.log.write("warning", "mcp: http connection lost — reconnecting");
|
|
101
|
-
reconnect(0, () => { reconnecting = false; }).catch(() => { });
|
|
97
|
+
triggerReconnect("http connection lost");
|
|
102
98
|
};
|
|
103
99
|
await next.start();
|
|
104
100
|
client = next;
|
|
105
101
|
};
|
|
106
102
|
/* reconnect loop: restart service if needed, then reconnect client */
|
|
107
|
-
const reconnect = async (attempt = 0
|
|
103
|
+
const reconnect = async (attempt = 0) => {
|
|
108
104
|
const delay = Math.min(500 * 2 ** attempt, 10000);
|
|
109
105
|
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
110
106
|
if (bridgeDone) {
|
|
111
|
-
|
|
107
|
+
reconnecting = false;
|
|
112
108
|
return;
|
|
113
109
|
}
|
|
114
110
|
try {
|
|
@@ -118,15 +114,21 @@ export default class MCPCommand {
|
|
|
118
114
|
await client?.close();
|
|
119
115
|
await connectClient();
|
|
120
116
|
closedByUs = false;
|
|
117
|
+
reconnecting = false;
|
|
121
118
|
this.log.write("info", "mcp: reconnected to service");
|
|
122
|
-
done?.();
|
|
123
119
|
}
|
|
124
120
|
catch (err) {
|
|
125
121
|
closedByUs = false;
|
|
126
122
|
this.log.write("error", `mcp: reconnect failed: ${this.asError(err).message}`);
|
|
127
|
-
reconnect(attempt + 1
|
|
123
|
+
reconnect(attempt + 1).catch(() => { });
|
|
128
124
|
}
|
|
129
125
|
};
|
|
126
|
+
/* trigger a reconnect chain (idempotent while one is active) */
|
|
127
|
+
const triggerReconnect = (reason) => {
|
|
128
|
+
reconnecting = true;
|
|
129
|
+
this.log.write("warning", `mcp: ${reason} — reconnecting`);
|
|
130
|
+
reconnect(0).catch(() => { });
|
|
131
|
+
};
|
|
130
132
|
/* wire stdio server */
|
|
131
133
|
server.onmessage = (msg) => {
|
|
132
134
|
client?.send(msg).catch((err) => {
|
|
@@ -148,16 +150,12 @@ export default class MCPCommand {
|
|
|
148
150
|
if (bridgeDone || reconnecting)
|
|
149
151
|
return;
|
|
150
152
|
try {
|
|
151
|
-
const { projectId } = this.loadContext();
|
|
152
153
|
const match = await probe(port, projectId);
|
|
153
|
-
if (match !== true)
|
|
154
|
-
|
|
155
|
-
this.log.write("warning", "mcp: health check failed — reconnecting");
|
|
156
|
-
reconnect(0, () => { reconnecting = false; }).catch(() => { });
|
|
157
|
-
}
|
|
154
|
+
if (match !== true)
|
|
155
|
+
triggerReconnect("health check failed");
|
|
158
156
|
}
|
|
159
157
|
catch (err) {
|
|
160
|
-
/* ignore transient probe
|
|
158
|
+
/* ignore transient probe errors but record them */
|
|
161
159
|
this.log.write("debug", `mcp: health check error: ${this.asError(err).message}`);
|
|
162
160
|
}
|
|
163
161
|
}, HEALTH_INTERVAL_MS);
|
|
@@ -171,7 +169,6 @@ export default class MCPCommand {
|
|
|
171
169
|
/* shutdown services */
|
|
172
170
|
clearInterval(healthTimer);
|
|
173
171
|
await shutdown();
|
|
174
|
-
return 0; /* unreachable, kept only to satisfy the Promise<number> return type */
|
|
175
172
|
}
|
|
176
173
|
/* register commands */
|
|
177
174
|
register(program) {
|
|
@@ -179,7 +176,8 @@ export default class MCPCommand {
|
|
|
179
176
|
.command("mcp")
|
|
180
177
|
.description("Bridge stdio MCP to the per-project background service over Streamable HTTP")
|
|
181
178
|
.action(async () => {
|
|
182
|
-
|
|
179
|
+
await this.runBridge();
|
|
180
|
+
process.exit(0);
|
|
183
181
|
});
|
|
184
182
|
}
|
|
185
183
|
}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"homepage": "http://github.com/rse/ase",
|
|
7
7
|
"repository": { "url": "git+https://github.com/rse/ase.git", "type": "git" },
|
|
8
8
|
"bugs": { "url": "http://github.com/rse/ase/issues" },
|
|
9
|
-
"version": "0.0
|
|
9
|
+
"version": "0.9.0",
|
|
10
10
|
"license": "GPL-3.0-only",
|
|
11
11
|
"author": {
|
|
12
12
|
"name": "Dr. Ralf S. Engelschall",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"eslint": "9.39.4",
|
|
20
20
|
"@eslint/js": "9.39.4",
|
|
21
|
-
"@typescript-eslint/parser": "8.60.
|
|
22
|
-
"@typescript-eslint/eslint-plugin": "8.60.
|
|
21
|
+
"@typescript-eslint/parser": "8.60.1",
|
|
22
|
+
"@typescript-eslint/eslint-plugin": "8.60.1",
|
|
23
23
|
"eslint-plugin-promise": "7.3.0",
|
|
24
24
|
"eslint-plugin-import": "2.32.0",
|
|
25
25
|
"neostandard": "0.13.0",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"@types/pacote": "11.1.8"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"commander": "
|
|
44
|
-
"@dotenvx/dotenvx": "1.
|
|
43
|
+
"commander": "15.0.0",
|
|
44
|
+
"@dotenvx/dotenvx": "1.71.0",
|
|
45
45
|
"yaml": "2.9.0",
|
|
46
46
|
"valibot": "1.4.1",
|
|
47
47
|
"execa": "9.6.1",
|
package/plugin/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"homepage": "http://github.com/rse/ase",
|
|
7
7
|
"repository": { "url": "git+https://github.com/rse/ase.git", "type": "git" },
|
|
8
8
|
"bugs": { "url": "http://github.com/rse/ase/issues" },
|
|
9
|
-
"version": "0.0
|
|
9
|
+
"version": "0.9.0",
|
|
10
10
|
"license": "GPL-3.0-only",
|
|
11
11
|
"author": {
|
|
12
12
|
"name": "Dr. Ralf S. Engelschall",
|
package/dst/ase-hello.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
** Agentic Software Engineering (ASE)
|
|
3
|
-
** Copyright (c) 2025-2026 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
4
|
-
** Licensed under GPL 3.0 <https://spdx.org/licenses/GPL-3.0-only>
|
|
5
|
-
*/
|
|
6
|
-
import { Chalk } from "chalk";
|
|
7
|
-
/* forced-color chalk instance: stdout is a pipe under Claude Code,
|
|
8
|
-
so chalk auto-detection would yield level 0; force level 1 to keep
|
|
9
|
-
emitting ANSI sequences as the original implementation did */
|
|
10
|
-
const c = new Chalk({ level: 1 });
|
|
11
|
-
/* command-line handling */
|
|
12
|
-
export default class HelloCommand {
|
|
13
|
-
log;
|
|
14
|
-
constructor(log) {
|
|
15
|
-
this.log = log;
|
|
16
|
-
}
|
|
17
|
-
/* register commands */
|
|
18
|
-
register(program) {
|
|
19
|
-
program
|
|
20
|
-
.command("hello")
|
|
21
|
-
.description("Show a greeting message")
|
|
22
|
-
.option("-s, --subject <subject>", "subject to greet", "Universe")
|
|
23
|
-
.action(async (opts) => {
|
|
24
|
-
process.stdout.write(c.red(`${opts.subject} World!`) + "\n");
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|