@sentropic/h2a-cli 0.75.0 → 0.79.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/index.d.ts +1 -37
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -41
- package/dist/index.js.map +1 -1
- package/package.json +4 -15
- package/dist/bin.d.ts +0 -3
- package/dist/bin.d.ts.map +0 -1
- package/dist/bin.js +0 -83
- package/dist/bin.js.map +0 -1
- package/dist/cli-contract.d.ts +0 -62
- package/dist/cli-contract.d.ts.map +0 -1
- package/dist/cli-contract.js +0 -794
- package/dist/cli-contract.js.map +0 -1
- package/dist/cli.d.ts +0 -254
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -4672
- package/dist/cli.js.map +0 -1
- package/dist/hosts/agy.d.ts +0 -14
- package/dist/hosts/agy.d.ts.map +0 -1
- package/dist/hosts/agy.js +0 -47
- package/dist/hosts/agy.js.map +0 -1
- package/dist/hosts/claude.d.ts +0 -12
- package/dist/hosts/claude.d.ts.map +0 -1
- package/dist/hosts/claude.js +0 -46
- package/dist/hosts/claude.js.map +0 -1
- package/dist/hosts/codex.d.ts +0 -65
- package/dist/hosts/codex.d.ts.map +0 -1
- package/dist/hosts/codex.js +0 -45
- package/dist/hosts/codex.js.map +0 -1
- package/dist/hosts/gemini.d.ts +0 -12
- package/dist/hosts/gemini.d.ts.map +0 -1
- package/dist/hosts/gemini.js +0 -46
- package/dist/hosts/gemini.js.map +0 -1
- package/dist/hosts/plugin.d.ts +0 -151
- package/dist/hosts/plugin.d.ts.map +0 -1
- package/dist/hosts/plugin.js +0 -188
- package/dist/hosts/plugin.js.map +0 -1
- package/dist/mcp.d.ts +0 -2
- package/dist/mcp.d.ts.map +0 -1
- package/dist/mcp.js +0 -32
- package/dist/mcp.js.map +0 -1
- package/dist/runtime/blockage/index.d.ts +0 -3
- package/dist/runtime/blockage/index.d.ts.map +0 -1
- package/dist/runtime/blockage/index.js +0 -3
- package/dist/runtime/blockage/index.js.map +0 -1
- package/dist/runtime/blockage/notifiers.d.ts +0 -52
- package/dist/runtime/blockage/notifiers.d.ts.map +0 -1
- package/dist/runtime/blockage/notifiers.js +0 -74
- package/dist/runtime/blockage/notifiers.js.map +0 -1
- package/dist/runtime/blockage/registry.d.ts +0 -30
- package/dist/runtime/blockage/registry.d.ts.map +0 -1
- package/dist/runtime/blockage/registry.js +0 -86
- package/dist/runtime/blockage/registry.js.map +0 -1
- package/dist/runtime/deploy/k8s-sidecar.d.ts +0 -92
- package/dist/runtime/deploy/k8s-sidecar.d.ts.map +0 -1
- package/dist/runtime/deploy/k8s-sidecar.js +0 -166
- package/dist/runtime/deploy/k8s-sidecar.js.map +0 -1
- package/dist/runtime/deploy/k8s-tenant.d.ts +0 -86
- package/dist/runtime/deploy/k8s-tenant.d.ts.map +0 -1
- package/dist/runtime/deploy/k8s-tenant.js +0 -255
- package/dist/runtime/deploy/k8s-tenant.js.map +0 -1
- package/dist/runtime/drive/inbox-wake.d.ts +0 -36
- package/dist/runtime/drive/inbox-wake.d.ts.map +0 -1
- package/dist/runtime/drive/inbox-wake.js +0 -50
- package/dist/runtime/drive/inbox-wake.js.map +0 -1
- package/dist/runtime/drive/index.d.ts +0 -173
- package/dist/runtime/drive/index.d.ts.map +0 -1
- package/dist/runtime/drive/index.js +0 -503
- package/dist/runtime/drive/index.js.map +0 -1
- package/dist/runtime/drumbeat/deciders.d.ts +0 -32
- package/dist/runtime/drumbeat/deciders.d.ts.map +0 -1
- package/dist/runtime/drumbeat/deciders.js +0 -65
- package/dist/runtime/drumbeat/deciders.js.map +0 -1
- package/dist/runtime/drumbeat/decisions.d.ts +0 -19
- package/dist/runtime/drumbeat/decisions.d.ts.map +0 -1
- package/dist/runtime/drumbeat/decisions.js +0 -34
- package/dist/runtime/drumbeat/decisions.js.map +0 -1
- package/dist/runtime/drumbeat/inbox-relance.d.ts +0 -29
- package/dist/runtime/drumbeat/inbox-relance.d.ts.map +0 -1
- package/dist/runtime/drumbeat/inbox-relance.js +0 -101
- package/dist/runtime/drumbeat/inbox-relance.js.map +0 -1
- package/dist/runtime/drumbeat/index.d.ts +0 -8
- package/dist/runtime/drumbeat/index.d.ts.map +0 -1
- package/dist/runtime/drumbeat/index.js +0 -8
- package/dist/runtime/drumbeat/index.js.map +0 -1
- package/dist/runtime/drumbeat/registry.d.ts +0 -60
- package/dist/runtime/drumbeat/registry.d.ts.map +0 -1
- package/dist/runtime/drumbeat/registry.js +0 -115
- package/dist/runtime/drumbeat/registry.js.map +0 -1
- package/dist/runtime/drumbeat/relaunchers.d.ts +0 -111
- package/dist/runtime/drumbeat/relaunchers.d.ts.map +0 -1
- package/dist/runtime/drumbeat/relaunchers.js +0 -260
- package/dist/runtime/drumbeat/relaunchers.js.map +0 -1
- package/dist/runtime/drumbeat/scan.d.ts +0 -36
- package/dist/runtime/drumbeat/scan.d.ts.map +0 -1
- package/dist/runtime/drumbeat/scan.js +0 -41
- package/dist/runtime/drumbeat/scan.js.map +0 -1
- package/dist/runtime/drumbeat/watch.d.ts +0 -74
- package/dist/runtime/drumbeat/watch.d.ts.map +0 -1
- package/dist/runtime/drumbeat/watch.js +0 -216
- package/dist/runtime/drumbeat/watch.js.map +0 -1
- package/dist/runtime/escalation/index.d.ts +0 -2
- package/dist/runtime/escalation/index.d.ts.map +0 -1
- package/dist/runtime/escalation/index.js +0 -2
- package/dist/runtime/escalation/index.js.map +0 -1
- package/dist/runtime/escalation/registry.d.ts +0 -44
- package/dist/runtime/escalation/registry.d.ts.map +0 -1
- package/dist/runtime/escalation/registry.js +0 -79
- package/dist/runtime/escalation/registry.js.map +0 -1
- package/dist/runtime/governance/claims.d.ts +0 -43
- package/dist/runtime/governance/claims.d.ts.map +0 -1
- package/dist/runtime/governance/claims.js +0 -93
- package/dist/runtime/governance/claims.js.map +0 -1
- package/dist/runtime/governance/conductor.d.ts +0 -79
- package/dist/runtime/governance/conductor.d.ts.map +0 -1
- package/dist/runtime/governance/conductor.js +0 -106
- package/dist/runtime/governance/conductor.js.map +0 -1
- package/dist/runtime/governance/index.d.ts +0 -5
- package/dist/runtime/governance/index.d.ts.map +0 -1
- package/dist/runtime/governance/index.js +0 -5
- package/dist/runtime/governance/index.js.map +0 -1
- package/dist/runtime/governance/launch-check.d.ts +0 -93
- package/dist/runtime/governance/launch-check.d.ts.map +0 -1
- package/dist/runtime/governance/launch-check.js +0 -113
- package/dist/runtime/governance/launch-check.js.map +0 -1
- package/dist/runtime/governance/spawns.d.ts +0 -50
- package/dist/runtime/governance/spawns.d.ts.map +0 -1
- package/dist/runtime/governance/spawns.js +0 -91
- package/dist/runtime/governance/spawns.js.map +0 -1
- package/dist/runtime/identity/bindings.d.ts +0 -84
- package/dist/runtime/identity/bindings.d.ts.map +0 -1
- package/dist/runtime/identity/bindings.js +0 -112
- package/dist/runtime/identity/bindings.js.map +0 -1
- package/dist/runtime/identity/index.d.ts +0 -11
- package/dist/runtime/identity/index.d.ts.map +0 -1
- package/dist/runtime/identity/index.js +0 -6
- package/dist/runtime/identity/index.js.map +0 -1
- package/dist/runtime/identity/live.d.ts +0 -26
- package/dist/runtime/identity/live.d.ts.map +0 -1
- package/dist/runtime/identity/live.js +0 -232
- package/dist/runtime/identity/live.js.map +0 -1
- package/dist/runtime/identity/migration.d.ts +0 -55
- package/dist/runtime/identity/migration.d.ts.map +0 -1
- package/dist/runtime/identity/migration.js +0 -100
- package/dist/runtime/identity/migration.js.map +0 -1
- package/dist/runtime/identity/readers.d.ts +0 -42
- package/dist/runtime/identity/readers.d.ts.map +0 -1
- package/dist/runtime/identity/readers.js +0 -248
- package/dist/runtime/identity/readers.js.map +0 -1
- package/dist/runtime/identity/resolver.d.ts +0 -50
- package/dist/runtime/identity/resolver.d.ts.map +0 -1
- package/dist/runtime/identity/resolver.js +0 -61
- package/dist/runtime/identity/resolver.js.map +0 -1
- package/dist/runtime/identity/workspace-id.d.ts +0 -43
- package/dist/runtime/identity/workspace-id.d.ts.map +0 -1
- package/dist/runtime/identity/workspace-id.js +0 -138
- package/dist/runtime/identity/workspace-id.js.map +0 -1
- package/dist/runtime/local-files/index.d.ts +0 -8
- package/dist/runtime/local-files/index.d.ts.map +0 -1
- package/dist/runtime/local-files/index.js +0 -8
- package/dist/runtime/local-files/index.js.map +0 -1
- package/dist/runtime/local-files/lease.d.ts +0 -62
- package/dist/runtime/local-files/lease.d.ts.map +0 -1
- package/dist/runtime/local-files/lease.js +0 -249
- package/dist/runtime/local-files/lease.js.map +0 -1
- package/dist/runtime/local-files/locks.d.ts +0 -43
- package/dist/runtime/local-files/locks.d.ts.map +0 -1
- package/dist/runtime/local-files/locks.js +0 -197
- package/dist/runtime/local-files/locks.js.map +0 -1
- package/dist/runtime/local-files/migrate.d.ts +0 -31
- package/dist/runtime/local-files/migrate.d.ts.map +0 -1
- package/dist/runtime/local-files/migrate.js +0 -104
- package/dist/runtime/local-files/migrate.js.map +0 -1
- package/dist/runtime/local-files/paths.d.ts +0 -146
- package/dist/runtime/local-files/paths.d.ts.map +0 -1
- package/dist/runtime/local-files/paths.js +0 -233
- package/dist/runtime/local-files/paths.js.map +0 -1
- package/dist/runtime/local-files/presence.d.ts +0 -80
- package/dist/runtime/local-files/presence.d.ts.map +0 -1
- package/dist/runtime/local-files/presence.js +0 -250
- package/dist/runtime/local-files/presence.js.map +0 -1
- package/dist/runtime/local-files/schema.d.ts +0 -47
- package/dist/runtime/local-files/schema.d.ts.map +0 -1
- package/dist/runtime/local-files/schema.js +0 -77
- package/dist/runtime/local-files/schema.js.map +0 -1
- package/dist/runtime/local-files/store.d.ts +0 -132
- package/dist/runtime/local-files/store.d.ts.map +0 -1
- package/dist/runtime/local-files/store.js +0 -997
- package/dist/runtime/local-files/store.js.map +0 -1
- package/dist/runtime/loop/index.d.ts +0 -73
- package/dist/runtime/loop/index.d.ts.map +0 -1
- package/dist/runtime/loop/index.js +0 -107
- package/dist/runtime/loop/index.js.map +0 -1
- package/dist/runtime/mcp/handlers.d.ts +0 -196
- package/dist/runtime/mcp/handlers.d.ts.map +0 -1
- package/dist/runtime/mcp/handlers.js +0 -1025
- package/dist/runtime/mcp/handlers.js.map +0 -1
- package/dist/runtime/mcp/index.d.ts +0 -7
- package/dist/runtime/mcp/index.d.ts.map +0 -1
- package/dist/runtime/mcp/index.js +0 -7
- package/dist/runtime/mcp/index.js.map +0 -1
- package/dist/runtime/mcp/notifications.d.ts +0 -47
- package/dist/runtime/mcp/notifications.d.ts.map +0 -1
- package/dist/runtime/mcp/notifications.js +0 -204
- package/dist/runtime/mcp/notifications.js.map +0 -1
- package/dist/runtime/mcp/server.d.ts +0 -45
- package/dist/runtime/mcp/server.d.ts.map +0 -1
- package/dist/runtime/mcp/server.js +0 -94
- package/dist/runtime/mcp/server.js.map +0 -1
- package/dist/runtime/mcp/sessions.d.ts +0 -68
- package/dist/runtime/mcp/sessions.d.ts.map +0 -1
- package/dist/runtime/mcp/sessions.js +0 -152
- package/dist/runtime/mcp/sessions.js.map +0 -1
- package/dist/runtime/mcp/stdio.d.ts +0 -72
- package/dist/runtime/mcp/stdio.d.ts.map +0 -1
- package/dist/runtime/mcp/stdio.js +0 -274
- package/dist/runtime/mcp/stdio.js.map +0 -1
- package/dist/runtime/mcp/tools.d.ts +0 -19
- package/dist/runtime/mcp/tools.d.ts.map +0 -1
- package/dist/runtime/mcp/tools.js +0 -525
- package/dist/runtime/mcp/tools.js.map +0 -1
- package/dist/runtime/mcp-http/app.d.ts +0 -33
- package/dist/runtime/mcp-http/app.d.ts.map +0 -1
- package/dist/runtime/mcp-http/app.js +0 -162
- package/dist/runtime/mcp-http/app.js.map +0 -1
- package/dist/runtime/mcp-http/hosted-mcp-server.d.ts +0 -14
- package/dist/runtime/mcp-http/hosted-mcp-server.d.ts.map +0 -1
- package/dist/runtime/mcp-http/hosted-mcp-server.js +0 -38
- package/dist/runtime/mcp-http/hosted-mcp-server.js.map +0 -1
- package/dist/runtime/mcp-http/index.d.ts +0 -18
- package/dist/runtime/mcp-http/index.d.ts.map +0 -1
- package/dist/runtime/mcp-http/index.js +0 -18
- package/dist/runtime/mcp-http/index.js.map +0 -1
- package/dist/runtime/mcp-http/main.d.ts +0 -2
- package/dist/runtime/mcp-http/main.d.ts.map +0 -1
- package/dist/runtime/mcp-http/main.js +0 -14
- package/dist/runtime/mcp-http/main.js.map +0 -1
- package/dist/runtime/mcp-http/oauth/broker-login.d.ts +0 -50
- package/dist/runtime/mcp-http/oauth/broker-login.d.ts.map +0 -1
- package/dist/runtime/mcp-http/oauth/broker-login.js +0 -41
- package/dist/runtime/mcp-http/oauth/broker-login.js.map +0 -1
- package/dist/runtime/mcp-http/oauth/broker-routes.d.ts +0 -45
- package/dist/runtime/mcp-http/oauth/broker-routes.d.ts.map +0 -1
- package/dist/runtime/mcp-http/oauth/broker-routes.js +0 -54
- package/dist/runtime/mcp-http/oauth/broker-routes.js.map +0 -1
- package/dist/runtime/mcp-http/oauth/config.d.ts +0 -49
- package/dist/runtime/mcp-http/oauth/config.d.ts.map +0 -1
- package/dist/runtime/mcp-http/oauth/config.js +0 -69
- package/dist/runtime/mcp-http/oauth/config.js.map +0 -1
- package/dist/runtime/mcp-http/oauth/crypto.d.ts +0 -14
- package/dist/runtime/mcp-http/oauth/crypto.d.ts.map +0 -1
- package/dist/runtime/mcp-http/oauth/crypto.js +0 -29
- package/dist/runtime/mcp-http/oauth/crypto.js.map +0 -1
- package/dist/runtime/mcp-http/oauth/file-store.d.ts +0 -48
- package/dist/runtime/mcp-http/oauth/file-store.d.ts.map +0 -1
- package/dist/runtime/mcp-http/oauth/file-store.js +0 -101
- package/dist/runtime/mcp-http/oauth/file-store.js.map +0 -1
- package/dist/runtime/mcp-http/oauth/hono-oauth-router.d.ts +0 -5
- package/dist/runtime/mcp-http/oauth/hono-oauth-router.d.ts.map +0 -1
- package/dist/runtime/mcp-http/oauth/hono-oauth-router.js +0 -92
- package/dist/runtime/mcp-http/oauth/hono-oauth-router.js.map +0 -1
- package/dist/runtime/mcp-http/oauth/oidc-rp.d.ts +0 -56
- package/dist/runtime/mcp-http/oauth/oidc-rp.d.ts.map +0 -1
- package/dist/runtime/mcp-http/oauth/oidc-rp.js +0 -63
- package/dist/runtime/mcp-http/oauth/oidc-rp.js.map +0 -1
- package/dist/runtime/mcp-http/oauth/redirect-uri.d.ts +0 -11
- package/dist/runtime/mcp-http/oauth/redirect-uri.d.ts.map +0 -1
- package/dist/runtime/mcp-http/oauth/redirect-uri.js +0 -29
- package/dist/runtime/mcp-http/oauth/redirect-uri.js.map +0 -1
- package/dist/runtime/mcp-http/oauth/single-tenant-provider.d.ts +0 -70
- package/dist/runtime/mcp-http/oauth/single-tenant-provider.d.ts.map +0 -1
- package/dist/runtime/mcp-http/oauth/single-tenant-provider.js +0 -247
- package/dist/runtime/mcp-http/oauth/single-tenant-provider.js.map +0 -1
- package/dist/runtime/mcp-http/oauth/tenancy.d.ts +0 -3
- package/dist/runtime/mcp-http/oauth/tenancy.d.ts.map +0 -1
- package/dist/runtime/mcp-http/oauth/tenancy.js +0 -18
- package/dist/runtime/mcp-http/oauth/tenancy.js.map +0 -1
- package/dist/runtime/mcp-http/readonly-allowlist.d.ts +0 -24
- package/dist/runtime/mcp-http/readonly-allowlist.d.ts.map +0 -1
- package/dist/runtime/mcp-http/readonly-allowlist.js +0 -43
- package/dist/runtime/mcp-http/readonly-allowlist.js.map +0 -1
- package/dist/runtime/mcp-http/serve.d.ts +0 -39
- package/dist/runtime/mcp-http/serve.d.ts.map +0 -1
- package/dist/runtime/mcp-http/serve.js +0 -100
- package/dist/runtime/mcp-http/serve.js.map +0 -1
- package/dist/runtime/mirror/accept.d.ts +0 -57
- package/dist/runtime/mirror/accept.d.ts.map +0 -1
- package/dist/runtime/mirror/accept.js +0 -70
- package/dist/runtime/mirror/accept.js.map +0 -1
- package/dist/runtime/mirror/build.d.ts +0 -44
- package/dist/runtime/mirror/build.d.ts.map +0 -1
- package/dist/runtime/mirror/build.js +0 -37
- package/dist/runtime/mirror/build.js.map +0 -1
- package/dist/runtime/mirror/index.d.ts +0 -9
- package/dist/runtime/mirror/index.d.ts.map +0 -1
- package/dist/runtime/mirror/index.js +0 -9
- package/dist/runtime/mirror/index.js.map +0 -1
- package/dist/runtime/mirror/serve.d.ts +0 -21
- package/dist/runtime/mirror/serve.d.ts.map +0 -1
- package/dist/runtime/mirror/serve.js +0 -141
- package/dist/runtime/mirror/serve.js.map +0 -1
- package/dist/runtime/nhi.d.ts +0 -15
- package/dist/runtime/nhi.d.ts.map +0 -1
- package/dist/runtime/nhi.js +0 -26
- package/dist/runtime/nhi.js.map +0 -1
- package/dist/runtime/remote/accept.d.ts +0 -50
- package/dist/runtime/remote/accept.d.ts.map +0 -1
- package/dist/runtime/remote/accept.js +0 -54
- package/dist/runtime/remote/accept.js.map +0 -1
- package/dist/runtime/remote/client.d.ts +0 -27
- package/dist/runtime/remote/client.d.ts.map +0 -1
- package/dist/runtime/remote/client.js +0 -34
- package/dist/runtime/remote/client.js.map +0 -1
- package/dist/runtime/remote/index.d.ts +0 -5
- package/dist/runtime/remote/index.d.ts.map +0 -1
- package/dist/runtime/remote/index.js +0 -5
- package/dist/runtime/remote/index.js.map +0 -1
- package/dist/runtime/remote/serve.d.ts +0 -27
- package/dist/runtime/remote/serve.d.ts.map +0 -1
- package/dist/runtime/remote/serve.js +0 -26
- package/dist/runtime/remote/serve.js.map +0 -1
- package/dist/runtime/remote/server.d.ts +0 -36
- package/dist/runtime/remote/server.d.ts.map +0 -1
- package/dist/runtime/remote/server.js +0 -100
- package/dist/runtime/remote/server.js.map +0 -1
- package/dist/runtime/sysml/client.d.ts +0 -44
- package/dist/runtime/sysml/client.d.ts.map +0 -1
- package/dist/runtime/sysml/client.js +0 -52
- package/dist/runtime/sysml/client.js.map +0 -1
- package/dist/runtime/sysml/disclosure.d.ts +0 -23
- package/dist/runtime/sysml/disclosure.d.ts.map +0 -1
- package/dist/runtime/sysml/disclosure.js +0 -53
- package/dist/runtime/sysml/disclosure.js.map +0 -1
- package/dist/runtime/sysml/index.d.ts +0 -4
- package/dist/runtime/sysml/index.d.ts.map +0 -1
- package/dist/runtime/sysml/index.js +0 -4
- package/dist/runtime/sysml/index.js.map +0 -1
- package/dist/runtime/sysml/verify.d.ts +0 -32
- package/dist/runtime/sysml/verify.d.ts.map +0 -1
- package/dist/runtime/sysml/verify.js +0 -67
- package/dist/runtime/sysml/verify.js.map +0 -1
- package/dist/runtime/upgrade/index.d.ts +0 -96
- package/dist/runtime/upgrade/index.d.ts.map +0 -1
- package/dist/runtime/upgrade/index.js +0 -185
- package/dist/runtime/upgrade/index.js.map +0 -1
- package/dist/runtime/version/agent-version.d.ts +0 -15
- package/dist/runtime/version/agent-version.d.ts.map +0 -1
- package/dist/runtime/version/agent-version.js +0 -53
- package/dist/runtime/version/agent-version.js.map +0 -1
- package/skills/h2a/SKILL.md +0 -345
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import { randomBytes } from "node:crypto";
|
|
2
|
-
import { H2A_SESSION_DEFAULT_EXPIRY_MS, H2A_SESSION_DEFAULT_HEARTBEAT_INTERVAL_MS, H2A_SESSION_NOTIFICATION_TOPICS } from "@sentropic/h2a";
|
|
3
|
-
import { deletePresence, listPresence, updatePresence, writePresence } from "../local-files/presence.js";
|
|
4
|
-
function nowIso() {
|
|
5
|
-
return new Date().toISOString();
|
|
6
|
-
}
|
|
7
|
-
function generateSessionId() {
|
|
8
|
-
return `sess:${randomBytes(8).toString("hex")}`;
|
|
9
|
-
}
|
|
10
|
-
function normalizeTopics(raw) {
|
|
11
|
-
if (!raw)
|
|
12
|
-
return H2A_SESSION_NOTIFICATION_TOPICS;
|
|
13
|
-
const seen = new Set();
|
|
14
|
-
for (const topic of raw) {
|
|
15
|
-
if (typeof topic === "string" &&
|
|
16
|
-
H2A_SESSION_NOTIFICATION_TOPICS.includes(topic)) {
|
|
17
|
-
seen.add(topic);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return Array.from(seen);
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Per-process registry of MCP sessions. Owns the in-memory map and the
|
|
24
|
-
* heartbeat timers. Each session corresponds to one client connection
|
|
25
|
-
* (one mcp-serve subprocess attachment). The registry writes a presence
|
|
26
|
-
* file under `<root>/.h2a/presence/<sessionId>.json` and keeps it fresh.
|
|
27
|
-
*/
|
|
28
|
-
export class SessionRegistry {
|
|
29
|
-
root;
|
|
30
|
-
entries = new Map();
|
|
31
|
-
heartbeatIntervalMs;
|
|
32
|
-
expiryMs;
|
|
33
|
-
autoHeartbeat;
|
|
34
|
-
constructor(root, options = {}) {
|
|
35
|
-
this.root = root;
|
|
36
|
-
this.heartbeatIntervalMs =
|
|
37
|
-
options.heartbeatIntervalMs ?? H2A_SESSION_DEFAULT_HEARTBEAT_INTERVAL_MS;
|
|
38
|
-
this.expiryMs = options.expiryMs ?? H2A_SESSION_DEFAULT_EXPIRY_MS;
|
|
39
|
-
this.autoHeartbeat = options.autoHeartbeat ?? true;
|
|
40
|
-
}
|
|
41
|
-
open(request) {
|
|
42
|
-
if (typeof request.instance !== "string" || request.instance.length === 0) {
|
|
43
|
-
throw new TypeError("SessionRegistry.open: 'instance' is required");
|
|
44
|
-
}
|
|
45
|
-
const sessionId = request.sessionId ?? generateSessionId();
|
|
46
|
-
if (this.entries.has(sessionId)) {
|
|
47
|
-
throw new Error(`SessionRegistry.open: session ${sessionId} already open`);
|
|
48
|
-
}
|
|
49
|
-
const now = nowIso();
|
|
50
|
-
const session = {
|
|
51
|
-
sessionId,
|
|
52
|
-
instance: request.instance,
|
|
53
|
-
...(request.host !== undefined ? { host: request.host } : {}),
|
|
54
|
-
...(request.workspace !== undefined ? { workspace: request.workspace } : {}),
|
|
55
|
-
...(request.name !== undefined ? { name: request.name } : {}),
|
|
56
|
-
...(request.version !== undefined ? { version: request.version } : {}),
|
|
57
|
-
...(request.launchContext !== undefined ? { launchContext: request.launchContext } : {}),
|
|
58
|
-
pid: request.pid ?? process.pid,
|
|
59
|
-
startedAt: now,
|
|
60
|
-
heartbeatAt: now,
|
|
61
|
-
// WP-F: boot = a live MCP channel (the initialize handshake just landed).
|
|
62
|
-
lastMcpActivityAt: now,
|
|
63
|
-
state: "live",
|
|
64
|
-
interests: {
|
|
65
|
-
scopes: request.interests?.scopes ?? [],
|
|
66
|
-
negotiations: request.interests?.negotiations ?? []
|
|
67
|
-
},
|
|
68
|
-
subscribedTopics: normalizeTopics(request.subscribedTopics)
|
|
69
|
-
};
|
|
70
|
-
writePresence(this.root, session);
|
|
71
|
-
const entry = { session, lastActivityAt: now };
|
|
72
|
-
if (this.autoHeartbeat) {
|
|
73
|
-
entry.heartbeatHandle = setInterval(() => this.touch(sessionId), this.heartbeatIntervalMs);
|
|
74
|
-
// Keep the timer from holding the event loop open when stdin closes.
|
|
75
|
-
entry.heartbeatHandle.unref?.();
|
|
76
|
-
}
|
|
77
|
-
this.entries.set(sessionId, entry);
|
|
78
|
-
return session;
|
|
79
|
-
}
|
|
80
|
-
close(sessionId, finalState = "closed") {
|
|
81
|
-
const entry = this.entries.get(sessionId);
|
|
82
|
-
if (entry?.heartbeatHandle) {
|
|
83
|
-
clearInterval(entry.heartbeatHandle);
|
|
84
|
-
}
|
|
85
|
-
const updated = updatePresence(this.root, sessionId, {
|
|
86
|
-
state: finalState,
|
|
87
|
-
heartbeatAt: nowIso()
|
|
88
|
-
});
|
|
89
|
-
this.entries.delete(sessionId);
|
|
90
|
-
if (finalState === "closed" || finalState === "expired") {
|
|
91
|
-
deletePresence(this.root, sessionId);
|
|
92
|
-
}
|
|
93
|
-
return updated;
|
|
94
|
-
}
|
|
95
|
-
/** Mark heartbeat on disk for a known session. Idempotent on unknown ids. */
|
|
96
|
-
touch(sessionId) {
|
|
97
|
-
const entry = this.entries.get(sessionId);
|
|
98
|
-
if (!entry)
|
|
99
|
-
return undefined;
|
|
100
|
-
let updated = updatePresence(this.root, sessionId, {
|
|
101
|
-
heartbeatAt: nowIso(),
|
|
102
|
-
// WP-F: flush the latest in-memory MCP-activity timestamp alongside the
|
|
103
|
-
// blind heartbeat. Unlike heartbeatAt (which the external keepalive prober
|
|
104
|
-
// can also refresh), this only advances on real inbound MCP traffic.
|
|
105
|
-
...(entry.lastActivityAt ? { lastMcpActivityAt: entry.lastActivityAt } : {})
|
|
106
|
-
});
|
|
107
|
-
if (!updated) {
|
|
108
|
-
updated = {
|
|
109
|
-
...entry.session,
|
|
110
|
-
heartbeatAt: nowIso(),
|
|
111
|
-
...(entry.lastActivityAt ? { lastMcpActivityAt: entry.lastActivityAt } : {})
|
|
112
|
-
};
|
|
113
|
-
writePresence(this.root, updated);
|
|
114
|
-
}
|
|
115
|
-
if (updated)
|
|
116
|
-
entry.session = updated;
|
|
117
|
-
return updated;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* WP-F: record that the MCP channel carried an inbound line right now. Cheap
|
|
121
|
-
* (in-memory only); flushed to the presence file by the next heartbeat
|
|
122
|
-
* `touch()`. No-op on an unknown session id.
|
|
123
|
-
*/
|
|
124
|
-
markActivity(sessionId) {
|
|
125
|
-
const entry = this.entries.get(sessionId);
|
|
126
|
-
if (entry)
|
|
127
|
-
entry.lastActivityAt = nowIso();
|
|
128
|
-
}
|
|
129
|
-
/** Snapshot of in-memory sessions held by this process. */
|
|
130
|
-
list() {
|
|
131
|
-
return Array.from(this.entries.values(), (entry) => entry.session);
|
|
132
|
-
}
|
|
133
|
-
/** Scan all presence files under root (own + peers), filtered by freshness. */
|
|
134
|
-
scanFresh(now = Date.now()) {
|
|
135
|
-
return listPresence(this.root, { now, expiryMs: this.expiryMs });
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Close every live session held by this process. Idempotent. Used by
|
|
139
|
-
* mcp-serve's shutdown hook when stdin reaches EOF or a signal lands.
|
|
140
|
-
*/
|
|
141
|
-
closeAll(finalState = "closed") {
|
|
142
|
-
for (const sessionId of Array.from(this.entries.keys())) {
|
|
143
|
-
try {
|
|
144
|
-
this.close(sessionId, finalState);
|
|
145
|
-
}
|
|
146
|
-
catch {
|
|
147
|
-
// best-effort cleanup
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
//# sourceMappingURL=sessions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sessions.js","sourceRoot":"","sources":["../../../src/runtime/mcp/sessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EACL,6BAA6B,EAC7B,yCAAyC,EACzC,+BAA+B,EAQhC,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,cAAc,EACd,YAAY,EACZ,cAAc,EACd,aAAa,EACd,MAAM,4BAA4B,CAAC;AAiDpC,SAAS,MAAM;IACb,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAClC,CAAC;AAED,SAAS,iBAAiB;IACxB,OAAO,QAAQ,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;AAClD,CAAC;AAED,SAAS,eAAe,CACtB,GAAkC;IAElC,IAAI,CAAC,GAAG;QAAE,OAAO,+BAA+B,CAAC;IACjD,MAAM,IAAI,GAAG,IAAI,GAAG,EAA+B,CAAC;IACpD,KAAK,MAAM,KAAK,IAAI,GAAG,EAAE,CAAC;QACxB,IACE,OAAO,KAAK,KAAK,QAAQ;YACxB,+BAAqD,CAAC,QAAQ,CAAC,KAAK,CAAC,EACtE,CAAC;YACD,IAAI,CAAC,GAAG,CAAC,KAAoC,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IAOP;IANF,OAAO,GAAG,IAAI,GAAG,EAAwB,CAAC;IAC1C,mBAAmB,CAAS;IAC5B,QAAQ,CAAS;IACjB,aAAa,CAAU;IAExC,YACmB,IAAY,EAC7B,UAA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;aAC7E,CAAC;YACF,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACpC,CAAC;QACD,IAAI,OAAO;YAAE,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;QACrC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,SAAiB;QAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAI,KAAK;YAAE,KAAK,CAAC,cAAc,GAAG,MAAM,EAAE,CAAC;IAC7C,CAAC;IAED,2DAA2D;IAC3D,IAAI;QACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACrE,CAAC;IAED,+EAA+E;IAC/E,SAAS,CAAC,MAAc,IAAI,CAAC,GAAG,EAAE;QAChC,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IACnE,CAAC;IAED;;;OAGG;IACH,QAAQ,CAAC,aAA8B,QAAQ;QAC7C,KAAK,MAAM,SAAS,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;YACxD,IAAI,CAAC;gBACH,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;YACpC,CAAC;YAAC,MAAM,CAAC;gBACP,sBAAsB;YACxB,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import type { Readable, Writable } from "node:stream";
|
|
2
|
-
import type { H2AWorkspaceRef } from "@sentropic/h2a";
|
|
3
|
-
import { type H2ADriver } from "../drive/index.js";
|
|
4
|
-
export interface RunMcpStdioOptions {
|
|
5
|
-
/** Filesystem root for the local-files store. */
|
|
6
|
-
root: string;
|
|
7
|
-
/** Readable stream of newline-delimited JSON-RPC requests. */
|
|
8
|
-
stdin: Readable;
|
|
9
|
-
/** Writable stream for newline-delimited JSON-RPC responses. */
|
|
10
|
-
stdout: Writable;
|
|
11
|
-
/** Writable stream for diagnostics (never used for protocol traffic). */
|
|
12
|
-
stderr: Writable;
|
|
13
|
-
/**
|
|
14
|
-
* Optional override for the SessionRegistry heartbeat interval in ms.
|
|
15
|
-
* Defaults to H2A_SESSION_DEFAULT_HEARTBEAT_INTERVAL_MS or, if set, the
|
|
16
|
-
* H2A_HEARTBEAT_INTERVAL_MS environment variable.
|
|
17
|
-
*/
|
|
18
|
-
heartbeatIntervalMs?: number;
|
|
19
|
-
/**
|
|
20
|
-
* Optional override for the NotificationDispatcher poll interval in ms.
|
|
21
|
-
* Defaults to the heartbeat interval or, if set, the
|
|
22
|
-
* H2A_NOTIFY_INTERVAL_MS environment variable.
|
|
23
|
-
*/
|
|
24
|
-
notifyIntervalMs?: number;
|
|
25
|
-
/**
|
|
26
|
-
* Optional override for session expiry in ms. Defaults to
|
|
27
|
-
* H2A_SESSION_DEFAULT_EXPIRY_MS or, if set, H2A_SESSION_EXPIRY_MS.
|
|
28
|
-
*/
|
|
29
|
-
expiryMs?: number;
|
|
30
|
-
/**
|
|
31
|
-
* DEC-105 (EVO-6): open a presence session automatically when the server
|
|
32
|
-
* boots, so the host is on the bus at startup without an explicit
|
|
33
|
-
* `/h2a connect`. The session auto-closes on shutdown (DEC-051); the agent
|
|
34
|
-
* can still close it early with `h2a_session_close` (`/h2a disconnect`).
|
|
35
|
-
*/
|
|
36
|
-
autoOpen?: {
|
|
37
|
-
readonly instance: string;
|
|
38
|
-
readonly host?: string;
|
|
39
|
-
readonly workspace?: H2AWorkspaceRef;
|
|
40
|
-
readonly name?: string;
|
|
41
|
-
readonly scopes?: readonly string[];
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* EVO-1 inbox wake (bug #3): when set (with `autoOpen`), inject a signed,
|
|
45
|
-
* h2a-tagged wake line into the host via `driver` whenever a new inbox
|
|
46
|
-
* envelope arrives for the auto-opened instance. The host is woken to run
|
|
47
|
-
* `/h2a receive`. Driver-injected so it's testable; `nativeBackchannelDriver`
|
|
48
|
-
* is the real wake.
|
|
49
|
-
*/
|
|
50
|
-
wake?: {
|
|
51
|
-
readonly driver: H2ADriver;
|
|
52
|
-
readonly privateKeyPem: string;
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* Optional abort signal for graceful shutdown. When it aborts, the server
|
|
56
|
-
* closes its sessions (presence → `closed`, so peers no longer see a
|
|
57
|
-
* false-live) and resolves. The real entry (bin.ts) wires SIGTERM/SIGINT/
|
|
58
|
-
* SIGHUP to an AbortController so a host kill cleans presence immediately
|
|
59
|
-
* instead of leaving it to expire. Tests omit it (no process listeners).
|
|
60
|
-
*/
|
|
61
|
-
signal?: AbortSignal;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Run the MCP server over a JSON-RPC 2.0 newline-delimited stdio transport.
|
|
65
|
-
*
|
|
66
|
-
* Reads requests from `stdin`, writes responses to `stdout` (one per line),
|
|
67
|
-
* uses `stderr` for diagnostics only. Resolves once `stdin` reaches EOF.
|
|
68
|
-
* A malformed line or a tool-dispatch throw never crashes the loop: each
|
|
69
|
-
* is reported as a structured JSON-RPC error response.
|
|
70
|
-
*/
|
|
71
|
-
export declare function runMcpStdio(options: RunMcpStdioOptions): Promise<void>;
|
|
72
|
-
//# sourceMappingURL=stdio.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../../../src/runtime/mcp/stdio.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,OAAO,EAA2B,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAgC5E,MAAM,WAAW,kBAAkB;IACjC,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,KAAK,EAAE,QAAQ,CAAC;IAChB,gEAAgE;IAChE,MAAM,EAAE,QAAQ,CAAC;IACjB,yEAAyE;IACzE,MAAM,EAAE,QAAQ,CAAC;IACjB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE;QACT,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC;QACrC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;KACrC,CAAC;IACF;;;;;;OAMG;IACH,IAAI,CAAC,EAAE;QACL,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;QAC3B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;KAChC,CAAC;IACF;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AA0ED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoOtE"}
|
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import { createInterface } from "node:readline";
|
|
2
|
-
import { createInboxWakeHandler } from "../drive/inbox-wake.js";
|
|
3
|
-
import { detectTmuxLaunchContext } from "../drive/index.js";
|
|
4
|
-
import { createLocalStore } from "../local-files/index.js";
|
|
5
|
-
import { reapDeadInstancePresence } from "../local-files/presence.js";
|
|
6
|
-
import { agentVersion } from "../version/agent-version.js";
|
|
7
|
-
import { createMcpServer } from "./server.js";
|
|
8
|
-
function envInt(name) {
|
|
9
|
-
const raw = process.env[name];
|
|
10
|
-
if (!raw)
|
|
11
|
-
return undefined;
|
|
12
|
-
const parsed = Number.parseInt(raw, 10);
|
|
13
|
-
return Number.isFinite(parsed) && parsed > 0 ? parsed : undefined;
|
|
14
|
-
}
|
|
15
|
-
const PROTOCOL_VERSION = "2025-06-18";
|
|
16
|
-
const SERVER_NAME = "@sentropic/h2a-cli";
|
|
17
|
-
const SERVER_VERSION = "0.1.1";
|
|
18
|
-
function writeResponse(stdout, response) {
|
|
19
|
-
stdout.write(`${JSON.stringify(response)}\n`);
|
|
20
|
-
}
|
|
21
|
-
function errorResponse(id, code, message, data) {
|
|
22
|
-
const error = { code, message };
|
|
23
|
-
if (data !== undefined)
|
|
24
|
-
error.data = data;
|
|
25
|
-
return { jsonrpc: "2.0", id, error };
|
|
26
|
-
}
|
|
27
|
-
function successResponse(id, result) {
|
|
28
|
-
return { jsonrpc: "2.0", id, result };
|
|
29
|
-
}
|
|
30
|
-
function handleMethod(server, method, params) {
|
|
31
|
-
if (method === "initialize") {
|
|
32
|
-
return {
|
|
33
|
-
protocolVersion: PROTOCOL_VERSION,
|
|
34
|
-
serverInfo: { name: SERVER_NAME, version: SERVER_VERSION },
|
|
35
|
-
capabilities: { tools: {} }
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
if (method === "tools/list") {
|
|
39
|
-
return { tools: server.listTools() };
|
|
40
|
-
}
|
|
41
|
-
if (method === "tools/call") {
|
|
42
|
-
const p = (params ?? {});
|
|
43
|
-
const name = typeof p.name === "string" ? p.name : "";
|
|
44
|
-
const args = p.arguments && typeof p.arguments === "object"
|
|
45
|
-
? p.arguments
|
|
46
|
-
: {};
|
|
47
|
-
const result = server.callTool(name, args);
|
|
48
|
-
const isError = Boolean(result && typeof result === "object" && "error" in result);
|
|
49
|
-
return {
|
|
50
|
-
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
51
|
-
isError
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
// Sentinel: the caller will map this to JSON-RPC -32601.
|
|
55
|
-
throw new MethodNotFoundError(method);
|
|
56
|
-
}
|
|
57
|
-
class MethodNotFoundError extends Error {
|
|
58
|
-
method;
|
|
59
|
-
constructor(method) {
|
|
60
|
-
super(`Method not found: ${method}`);
|
|
61
|
-
this.method = method;
|
|
62
|
-
this.name = "MethodNotFoundError";
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Run the MCP server over a JSON-RPC 2.0 newline-delimited stdio transport.
|
|
67
|
-
*
|
|
68
|
-
* Reads requests from `stdin`, writes responses to `stdout` (one per line),
|
|
69
|
-
* uses `stderr` for diagnostics only. Resolves once `stdin` reaches EOF.
|
|
70
|
-
* A malformed line or a tool-dispatch throw never crashes the loop: each
|
|
71
|
-
* is reported as a structured JSON-RPC error response.
|
|
72
|
-
*/
|
|
73
|
-
export function runMcpStdio(options) {
|
|
74
|
-
const { root, stdin, stdout, stderr } = options;
|
|
75
|
-
const heartbeatIntervalMs = options.heartbeatIntervalMs ?? envInt("H2A_HEARTBEAT_INTERVAL_MS");
|
|
76
|
-
const notifyIntervalMs = options.notifyIntervalMs ??
|
|
77
|
-
envInt("H2A_NOTIFY_INTERVAL_MS") ??
|
|
78
|
-
heartbeatIntervalMs;
|
|
79
|
-
const expiryMs = options.expiryMs ?? envInt("H2A_SESSION_EXPIRY_MS");
|
|
80
|
-
// The stdio transport carries live agent sessions; enable autoHeartbeat so
|
|
81
|
-
// the presence file stays fresh while this mcp-serve process is alive.
|
|
82
|
-
const server = createMcpServer({
|
|
83
|
-
root,
|
|
84
|
-
sessions: {
|
|
85
|
-
autoHeartbeat: true,
|
|
86
|
-
...(heartbeatIntervalMs !== undefined ? { heartbeatIntervalMs } : {}),
|
|
87
|
-
...(expiryMs !== undefined ? { expiryMs } : {})
|
|
88
|
-
},
|
|
89
|
-
notifications: {
|
|
90
|
-
...(notifyIntervalMs !== undefined ? { intervalMs: notifyIntervalMs } : {}),
|
|
91
|
-
sink: (notification) => {
|
|
92
|
-
stdout.write(`${JSON.stringify(notification)}\n`);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
// DEC-052: start the periodic diff scan so subscribed sessions receive
|
|
97
|
-
// pushed presence/inbox/negotiation notifications.
|
|
98
|
-
server.notifications.start();
|
|
99
|
-
// WP-F: the auto-opened session id, so the line loop can mark MCP activity on
|
|
100
|
-
// it (presence-honesty — proof the host→server channel is carrying traffic).
|
|
101
|
-
let autoOpenedSessionId;
|
|
102
|
-
// DEC-105 (EVO-6): auto-open a presence session at boot when requested, so
|
|
103
|
-
// the host joins the bus at startup. Best-effort: a failure here must not
|
|
104
|
-
// crash the transport (diagnostics to stderr only — stdout is protocol).
|
|
105
|
-
if (options.autoOpen) {
|
|
106
|
-
try {
|
|
107
|
-
const opened = server.sessions.open({
|
|
108
|
-
instance: options.autoOpen.instance,
|
|
109
|
-
...(options.autoOpen.host !== undefined ? { host: options.autoOpen.host } : {}),
|
|
110
|
-
...(options.autoOpen.workspace !== undefined
|
|
111
|
-
? { workspace: options.autoOpen.workspace }
|
|
112
|
-
: {}),
|
|
113
|
-
...(options.autoOpen.name !== undefined ? { name: options.autoOpen.name } : {}),
|
|
114
|
-
version: agentVersion(options.autoOpen.host),
|
|
115
|
-
// Auto-capture our tmux pane (inherited $TMUX_PANE) so the local-tmux
|
|
116
|
-
// wake driver can target this agent — no launcher config needed.
|
|
117
|
-
...((() => {
|
|
118
|
-
const lc = detectTmuxLaunchContext(process.env, undefined, `h2a mcp-serve --host ${options.autoOpen.host ?? ""}`.trim());
|
|
119
|
-
return lc ? { launchContext: lc } : {};
|
|
120
|
-
})()),
|
|
121
|
-
interests: {
|
|
122
|
-
scopes: [...(options.autoOpen.scopes ?? ["scope:default"])],
|
|
123
|
-
negotiations: []
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
autoOpenedSessionId = opened.sessionId;
|
|
127
|
-
stderr.write(`h2a mcp-serve: auto-opened session for ${options.autoOpen.instance}\n`);
|
|
128
|
-
// Reap the false-live presence left by a previous connection of THIS
|
|
129
|
-
// agent that the host dropped without signalling (process lingered,
|
|
130
|
-
// blind heartbeat kept presence "live"). Best-effort, same-instance only.
|
|
131
|
-
try {
|
|
132
|
-
const reaped = reapDeadInstancePresence(root, options.autoOpen.instance, opened.sessionId);
|
|
133
|
-
if (reaped.length > 0) {
|
|
134
|
-
stderr.write(`h2a mcp-serve: reaped ${reaped.length} stale presence file(s) for ${options.autoOpen.instance}\n`);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
catch {
|
|
138
|
-
// best-effort
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
catch (err) {
|
|
142
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
143
|
-
stderr.write(`h2a mcp-serve: auto-open failed: ${message}\n`);
|
|
144
|
-
}
|
|
145
|
-
// EVO-1 wake (bug #3): wake the idle host when a new inbox envelope arrives.
|
|
146
|
-
if (options.wake) {
|
|
147
|
-
const wakeInstance = options.autoOpen.instance;
|
|
148
|
-
const wakeStore = createLocalStore({ root });
|
|
149
|
-
const wake = createInboxWakeHandler({
|
|
150
|
-
instance: wakeInstance,
|
|
151
|
-
readInbox: () => wakeStore.readInbox(wakeInstance),
|
|
152
|
-
privateKeyPem: options.wake.privateKeyPem,
|
|
153
|
-
driver: options.wake.driver,
|
|
154
|
-
...(options.autoOpen.host !== undefined ? { host: options.autoOpen.host } : {}),
|
|
155
|
-
// Self-wake targets THIS process's OWN tmux pane (inherited $TMUX_PANE),
|
|
156
|
-
// NOT latestLaunchContext(instance) — with concurrent sessions sharing one
|
|
157
|
-
// perennial id (durable bug #1), an instance lookup could inject keystrokes
|
|
158
|
-
// into a DIFFERENT agent's terminal. The waking process is the one in the pane.
|
|
159
|
-
resolveLaunchContext: () => detectTmuxLaunchContext(process.env, undefined, `h2a mcp-serve --host ${options.autoOpen?.host ?? ""}`.trim()),
|
|
160
|
-
log: (line) => stderr.write(`h2a mcp-serve: ${line}\n`)
|
|
161
|
-
});
|
|
162
|
-
server.notifications.setOnInboxArrival((instance) => {
|
|
163
|
-
if (instance === wakeInstance)
|
|
164
|
-
void wake();
|
|
165
|
-
});
|
|
166
|
-
stderr.write(`h2a mcp-serve: inbox-wake armed for ${wakeInstance}\n`);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
const rl = createInterface({ input: stdin, crlfDelay: Infinity });
|
|
170
|
-
stdin.ref?.();
|
|
171
|
-
stdin.resume();
|
|
172
|
-
let didShutdown = false;
|
|
173
|
-
function shutdown() {
|
|
174
|
-
if (didShutdown)
|
|
175
|
-
return;
|
|
176
|
-
didShutdown = true;
|
|
177
|
-
try {
|
|
178
|
-
server.notifications.stop();
|
|
179
|
-
server.sessions.closeAll("closed");
|
|
180
|
-
}
|
|
181
|
-
catch (err) {
|
|
182
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
183
|
-
stderr.write(`h2a mcp-serve: shutdown error: ${message}\n`);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
return new Promise((resolve, reject) => {
|
|
187
|
-
// Graceful shutdown on abort (SIGTERM/SIGINT/SIGHUP, wired by bin.ts): close
|
|
188
|
-
// sessions so presence is marked `closed` immediately rather than lingering
|
|
189
|
-
// as false-live until expiry. Idempotent with the rl `close` path below.
|
|
190
|
-
const onAbort = () => {
|
|
191
|
-
shutdown();
|
|
192
|
-
try {
|
|
193
|
-
rl.close();
|
|
194
|
-
}
|
|
195
|
-
catch {
|
|
196
|
-
// ignore
|
|
197
|
-
}
|
|
198
|
-
resolve();
|
|
199
|
-
};
|
|
200
|
-
if (options.signal) {
|
|
201
|
-
if (options.signal.aborted) {
|
|
202
|
-
onAbort();
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
options.signal.addEventListener("abort", onAbort, { once: true });
|
|
206
|
-
}
|
|
207
|
-
rl.on("line", (line) => {
|
|
208
|
-
const trimmed = line.trim();
|
|
209
|
-
if (trimmed.length === 0)
|
|
210
|
-
return;
|
|
211
|
-
// WP-F: any non-empty inbound line proves the host→server MCP channel is
|
|
212
|
-
// carrying traffic right now — record it (in-memory; flushed by heartbeat).
|
|
213
|
-
if (autoOpenedSessionId)
|
|
214
|
-
server.sessions.markActivity(autoOpenedSessionId);
|
|
215
|
-
let request;
|
|
216
|
-
try {
|
|
217
|
-
request = JSON.parse(trimmed);
|
|
218
|
-
}
|
|
219
|
-
catch (err) {
|
|
220
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
221
|
-
writeResponse(stdout, errorResponse(null, -32700, "Parse error", message));
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
// JSON-RPC 2.0: a message with NO `id` member is a NOTIFICATION — the
|
|
225
|
-
// server MUST NOT reply to it (not even an error). Previously every line
|
|
226
|
-
// got a response with `id: request.id ?? null`, so a notification such as
|
|
227
|
-
// the standard `notifications/initialized` drew back an `id:null` error
|
|
228
|
-
// response, which strict clients (codex's rmcp) reject with "data did not
|
|
229
|
-
// match any variant of untagged enum JsonRpcMessage" — breaking the stream
|
|
230
|
-
// at startup. Gate every stdout write on the message actually being a
|
|
231
|
-
// request (DEC-115).
|
|
232
|
-
const isNotification = !("id" in request);
|
|
233
|
-
if (request.jsonrpc !== "2.0" || typeof request.method !== "string") {
|
|
234
|
-
if (!isNotification) {
|
|
235
|
-
writeResponse(stdout, errorResponse(request.id ?? null, -32600, "Invalid Request"));
|
|
236
|
-
}
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
try {
|
|
240
|
-
const result = handleMethod(server, request.method, request.params);
|
|
241
|
-
if (!isNotification) {
|
|
242
|
-
writeResponse(stdout, successResponse(request.id ?? null, result));
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
catch (err) {
|
|
246
|
-
if (isNotification) {
|
|
247
|
-
// An unhandled notification (e.g. `notifications/initialized`) is a
|
|
248
|
-
// silent no-op; surface only genuine internal errors on stderr.
|
|
249
|
-
if (!(err instanceof MethodNotFoundError)) {
|
|
250
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
251
|
-
stderr.write(`h2a mcp-serve: internal error (notification ${request.method}): ${message}\n`);
|
|
252
|
-
}
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
if (err instanceof MethodNotFoundError) {
|
|
256
|
-
writeResponse(stdout, errorResponse(request.id ?? null, -32601, `Method not found: ${err.method}`));
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
260
|
-
stderr.write(`h2a mcp-serve: internal error: ${message}\n`);
|
|
261
|
-
writeResponse(stdout, errorResponse(request.id ?? null, -32603, `Internal error: ${message}`));
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
rl.on("close", () => {
|
|
265
|
-
shutdown();
|
|
266
|
-
resolve();
|
|
267
|
-
});
|
|
268
|
-
rl.on("error", (err) => {
|
|
269
|
-
shutdown();
|
|
270
|
-
reject(err);
|
|
271
|
-
});
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
//# sourceMappingURL=stdio.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../../../src/runtime/mcp/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAKhD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAkB,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC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
|
|
2
|
-
export type McpToolName = (typeof H2A_CLI_MCP_TOOL_NAMES)[number];
|
|
3
|
-
export interface McpToolDescriptor {
|
|
4
|
-
name: McpToolName;
|
|
5
|
-
description: string;
|
|
6
|
-
inputSchema: {
|
|
7
|
-
type: "object";
|
|
8
|
-
properties: Record<string, unknown>;
|
|
9
|
-
required?: string[];
|
|
10
|
-
additionalProperties?: boolean;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Canonical tool descriptors for the in-process MCP server. Schemas are
|
|
15
|
-
* intentionally permissive — wire-level validation lives in the store /
|
|
16
|
-
* @sentropic/h2a invariants, not in the MCP shim.
|
|
17
|
-
*/
|
|
18
|
-
export declare const H2A_CLI_MCP_TOOL_DESCRIPTORS: McpToolDescriptor[];
|
|
19
|
-
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/runtime/mcp/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEtD,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ,CAAC;QACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACpC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;KAChC,CAAC;CACH;AAED;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAAE,iBAAiB,EAoiB3D,CAAC"}
|