@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,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Drumbeat D5 — append-only decision log. One record per consulted finding, so
|
|
3
|
-
* the operator can audit WHY the watchdog did what it did. `decided` is the
|
|
4
|
-
* decider's verdict; `applied` is what the watch actually did (advisory default
|
|
5
|
-
* or the enforced action after guards). Same dir + file style as `registry.ts`.
|
|
6
|
-
*/
|
|
7
|
-
import { appendFileSync, existsSync, mkdirSync, readFileSync } from "node:fs";
|
|
8
|
-
import { join } from "node:path";
|
|
9
|
-
import { localStorePaths } from "../local-files/paths.js";
|
|
10
|
-
function decisionsFile(root) {
|
|
11
|
-
return join(localStorePaths(root).drumbeat, "decisions.jsonl");
|
|
12
|
-
}
|
|
13
|
-
export function recordDrumbeatDecision(root, record) {
|
|
14
|
-
mkdirSync(localStorePaths(root).drumbeat, { recursive: true });
|
|
15
|
-
appendFileSync(decisionsFile(root), `${JSON.stringify(record)}\n`, "utf8");
|
|
16
|
-
}
|
|
17
|
-
export function listDrumbeatDecisions(root) {
|
|
18
|
-
const file = decisionsFile(root);
|
|
19
|
-
if (!existsSync(file))
|
|
20
|
-
return [];
|
|
21
|
-
const out = [];
|
|
22
|
-
for (const line of readFileSync(file, "utf8").split("\n")) {
|
|
23
|
-
if (!line.trim())
|
|
24
|
-
continue;
|
|
25
|
-
try {
|
|
26
|
-
out.push(JSON.parse(line));
|
|
27
|
-
}
|
|
28
|
-
catch {
|
|
29
|
-
// skip malformed
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return out;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=decisions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decisions.js","sourceRoot":"","sources":["../../../src/runtime/drumbeat/decisions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAY1D,SAAS,aAAa,CAAC,IAAY;IACjC,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,IAAY,EAAE,MAAiC;IACpF,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/D,cAAc,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IACjC,MAAM,GAAG,GAAgC,EAAE,CAAC;IAC5C,KAAK,MAAM,IAAI,IAAI,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1D,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YAAE,SAAS;QAC3B,IAAI,CAAC;YACH,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAA8B,CAAC,CAAC;QAC1D,CAAC;QAAC,MAAM,CAAC;YACP,iBAAiB;QACnB,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* D4 receive side. A remote relance request is just an inbox envelope; this
|
|
3
|
-
* consumer turns `drumbeat.resume` messages into local relauncher calls.
|
|
4
|
-
*/
|
|
5
|
-
import { type LocalStore } from "../local-files/store.js";
|
|
6
|
-
import type { H2ARelauncher } from "./watch.js";
|
|
7
|
-
export type H2ARelanceInboxSkipReason = "malformed" | "target-mismatch" | "requester-mismatch" | "no-entry" | "done" | "terminal" | "declined" | "failed";
|
|
8
|
-
export interface H2ARelanceInboxSkip {
|
|
9
|
-
readonly envelopeId: string;
|
|
10
|
-
readonly reason: H2ARelanceInboxSkipReason;
|
|
11
|
-
readonly target?: string;
|
|
12
|
-
}
|
|
13
|
-
export interface H2ARelanceInboxResult {
|
|
14
|
-
readonly relanced: readonly string[];
|
|
15
|
-
readonly skipped: readonly H2ARelanceInboxSkip[];
|
|
16
|
-
}
|
|
17
|
-
export interface RelanceFromInboxOptions {
|
|
18
|
-
readonly instances?: readonly string[];
|
|
19
|
-
readonly relauncher: H2ARelauncher;
|
|
20
|
-
readonly store?: LocalStore;
|
|
21
|
-
readonly now?: number;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Drain `drumbeat.resume` envelopes from local inboxes. Non-D4 inbox mail is
|
|
25
|
-
* left untouched; malformed or stale D4 messages are popped so they do not
|
|
26
|
-
* poison every future consume pass.
|
|
27
|
-
*/
|
|
28
|
-
export declare function relanceFromInbox(root: string, options: RelanceFromInboxOptions): Promise<H2ARelanceInboxResult>;
|
|
29
|
-
//# sourceMappingURL=inbox-relance.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inbox-relance.d.ts","sourceRoot":"","sources":["../../../src/runtime/drumbeat/inbox-relance.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAEL,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAMjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,MAAM,yBAAyB,GACjC,WAAW,GACX,iBAAiB,GACjB,oBAAoB,GACpB,UAAU,GACV,MAAM,GACN,UAAU,GACV,UAAU,GACV,QAAQ,CAAC;AAEb,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC;IAC3C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,SAAS,mBAAmB,EAAE,CAAC;CAClD;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB;AAqBD;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,qBAAqB,CAAC,CA4EhC"}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* D4 receive side. A remote relance request is just an inbox envelope; this
|
|
3
|
-
* consumer turns `drumbeat.resume` messages into local relauncher calls.
|
|
4
|
-
*/
|
|
5
|
-
import { H2A_DRUMBEAT_RESUME_BODY_KIND, parseDrumbeatResumeBody } from "@sentropic/h2a";
|
|
6
|
-
import { createLocalStore } from "../local-files/store.js";
|
|
7
|
-
import { markRelanced, readDrumbeatEntry } from "./registry.js";
|
|
8
|
-
function hasResumeKind(envelope) {
|
|
9
|
-
const body = envelope.body;
|
|
10
|
-
return (typeof body === "object" &&
|
|
11
|
-
body !== null &&
|
|
12
|
-
body.kind === H2A_DRUMBEAT_RESUME_BODY_KIND);
|
|
13
|
-
}
|
|
14
|
-
function findingFromEntry(entry) {
|
|
15
|
-
return {
|
|
16
|
-
instance: entry.instance,
|
|
17
|
-
reason: entry.workStatus === "out-of-tokens" ? "out-of-tokens" : "stopped",
|
|
18
|
-
workStatus: entry.workStatus,
|
|
19
|
-
...(entry.launchContext ? { launchContext: entry.launchContext } : {}),
|
|
20
|
-
relanceCount: entry.relanceCount
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Drain `drumbeat.resume` envelopes from local inboxes. Non-D4 inbox mail is
|
|
25
|
-
* left untouched; malformed or stale D4 messages are popped so they do not
|
|
26
|
-
* poison every future consume pass.
|
|
27
|
-
*/
|
|
28
|
-
export async function relanceFromInbox(root, options) {
|
|
29
|
-
const store = options.store ?? createLocalStore({ root });
|
|
30
|
-
const instances = options.instances ?? store.listInstances().map((r) => r.instance);
|
|
31
|
-
const relanced = [];
|
|
32
|
-
const skipped = [];
|
|
33
|
-
for (const inboxInstance of instances) {
|
|
34
|
-
for (const envelope of store.readInbox(inboxInstance)) {
|
|
35
|
-
const body = parseDrumbeatResumeBody(envelope.body);
|
|
36
|
-
if (!body) {
|
|
37
|
-
if (hasResumeKind(envelope)) {
|
|
38
|
-
store.popInboxMessage(inboxInstance, envelope.id);
|
|
39
|
-
skipped.push({ envelopeId: envelope.id, reason: "malformed" });
|
|
40
|
-
}
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
if (body.target !== inboxInstance) {
|
|
44
|
-
store.popInboxMessage(inboxInstance, envelope.id);
|
|
45
|
-
skipped.push({ envelopeId: envelope.id, reason: "target-mismatch", target: body.target });
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
// Log-integrity / hygiene (DEC-117 authentication-only model): the
|
|
49
|
-
// resume's claimed `requestedBy` must equal the cryptographically
|
|
50
|
-
// verified signer (`acceptRemoteEnvelope` checks the signature against
|
|
51
|
-
// the registry before delivery). A mismatch is a forged/relabelled
|
|
52
|
-
// attribution — drop it so a relance is never recorded under a false
|
|
53
|
-
// requester. Security is already enforced at ingestion; this guards
|
|
54
|
-
// accountability only. (Skipped when no actor is present.)
|
|
55
|
-
const signer = envelope.actor?.instance;
|
|
56
|
-
if (signer && body.requestedBy !== signer) {
|
|
57
|
-
store.popInboxMessage(inboxInstance, envelope.id);
|
|
58
|
-
skipped.push({ envelopeId: envelope.id, reason: "requester-mismatch", target: body.target });
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
const entry = readDrumbeatEntry(root, body.target);
|
|
62
|
-
if (!entry) {
|
|
63
|
-
store.popInboxMessage(inboxInstance, envelope.id);
|
|
64
|
-
skipped.push({ envelopeId: envelope.id, reason: "no-entry", target: body.target });
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
if (entry.workStatus === "done") {
|
|
68
|
-
store.popInboxMessage(inboxInstance, envelope.id);
|
|
69
|
-
skipped.push({ envelopeId: envelope.id, reason: "done", target: body.target });
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
if (entry.terminal) {
|
|
73
|
-
store.popInboxMessage(inboxInstance, envelope.id);
|
|
74
|
-
skipped.push({ envelopeId: envelope.id, reason: "terminal", target: body.target });
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
|
-
let issued = false;
|
|
78
|
-
let failed = false;
|
|
79
|
-
try {
|
|
80
|
-
issued = await options.relauncher.relance(findingFromEntry(entry));
|
|
81
|
-
}
|
|
82
|
-
catch {
|
|
83
|
-
failed = true;
|
|
84
|
-
}
|
|
85
|
-
store.popInboxMessage(inboxInstance, envelope.id);
|
|
86
|
-
if (issued) {
|
|
87
|
-
markRelanced(root, body.target, options.now);
|
|
88
|
-
relanced.push(body.target);
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
skipped.push({
|
|
92
|
-
envelopeId: envelope.id,
|
|
93
|
-
reason: failed ? "failed" : "declined",
|
|
94
|
-
target: body.target
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return { relanced, skipped };
|
|
100
|
-
}
|
|
101
|
-
//# sourceMappingURL=inbox-relance.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inbox-relance.js","sourceRoot":"","sources":["../../../src/runtime/drumbeat/inbox-relance.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,6BAA6B,EAC7B,uBAAuB,EAExB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,gBAAgB,EAEjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,YAAY,EACZ,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAgCvB,SAAS,aAAa,CAAC,QAAqB;IAC1C,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;IAC3B,OAAO,CACL,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACZ,IAA2B,CAAC,IAAI,KAAK,6BAA6B,CACpE,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAwD;IAChF,OAAO;QACL,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,MAAM,EAAE,KAAK,CAAC,UAAU,KAAK,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS;QAC1E,UAAU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,0 @@
|
|
|
1
|
-
export { recordStop, readDrumbeatEntry, listDrumbeat, clearDrumbeatEntry, markRelanced, markDrumbeatTerminal, type H2ADrumbeatEntry, type RecordStopInput } from "./registry.js";
|
|
2
|
-
export { loggingDecider, subagentDecider, type ReflexiveDecider, type DeciderRuntime, type SubagentDeciderOptions } from "./deciders.js";
|
|
3
|
-
export { recordDrumbeatDecision, listDrumbeatDecisions, type H2ADrumbeatDecisionRecord } from "./decisions.js";
|
|
4
|
-
export { scanDrumbeat, H2A_DEFAULT_MAX_RELANCES, type H2ADrumbeatFinding, type H2ADrumbeatReason, type H2ADrumbeatScanResult, type ScanDrumbeatOptions } from "./scan.js";
|
|
5
|
-
export { drumbeatTick, runDrumbeatWatch, loggingRelauncher, type H2ARelauncher, type DrumbeatTickOptions, type DrumbeatTickResult, type DrumbeatWatchOptions } from "./watch.js";
|
|
6
|
-
export { localTmuxRelauncher, headlessRelauncher, remoteRelauncher, chainRelauncher, tmuxTarget, tmuxSendSubmit, paneHasRecentHumanActivity, H2A_WAKE_DEFER_ACTIVITY_DEFAULT_MS, defaultRelauncherRuntime, type RelauncherRuntime, type RemoteEndpointResolver, type RemoteEnvelopeSender, type RemoteRelauncherOptions, type H2ARelauncherKind } from "./relaunchers.js";
|
|
7
|
-
export { relanceFromInbox, type H2ARelanceInboxResult, type H2ARelanceInboxSkip, type H2ARelanceInboxSkipReason, type RelanceFromInboxOptions } from "./inbox-relance.js";
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/drumbeat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,oBAAoB,EACpB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,cAAc,EACd,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC5B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,KAAK,yBAAyB,EAC/B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,YAAY,EACZ,wBAAwB,EACxB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,cAAc,EACd,0BAA0B,EAC1B,kCAAkC,EAClC,wBAAwB,EACxB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC7B,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { recordStop, readDrumbeatEntry, listDrumbeat, clearDrumbeatEntry, markRelanced, markDrumbeatTerminal } from "./registry.js";
|
|
2
|
-
export { loggingDecider, subagentDecider } from "./deciders.js";
|
|
3
|
-
export { recordDrumbeatDecision, listDrumbeatDecisions } from "./decisions.js";
|
|
4
|
-
export { scanDrumbeat, H2A_DEFAULT_MAX_RELANCES } from "./scan.js";
|
|
5
|
-
export { drumbeatTick, runDrumbeatWatch, loggingRelauncher } from "./watch.js";
|
|
6
|
-
export { localTmuxRelauncher, headlessRelauncher, remoteRelauncher, chainRelauncher, tmuxTarget, tmuxSendSubmit, paneHasRecentHumanActivity, H2A_WAKE_DEFER_ACTIVITY_DEFAULT_MS, defaultRelauncherRuntime } from "./relaunchers.js";
|
|
7
|
-
export { relanceFromInbox } from "./inbox-relance.js";
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/drumbeat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,oBAAoB,EAGrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,cAAc,EACd,eAAe,EAIhB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EAEtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,YAAY,EACZ,wBAAwB,EAKzB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EAKlB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,cAAc,EACd,0BAA0B,EAC1B,kCAAkC,EAClC,wBAAwB,EAMzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,gBAAgB,EAKjB,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Durable drumbeat registry (DEC-086, slice D2).
|
|
3
|
-
*
|
|
4
|
-
* The ephemeral presence files (DEC-051) are swept ~15s after the last
|
|
5
|
-
* heartbeat, so a genuinely *stopped* agent leaves no trace there — yet the
|
|
6
|
-
* stopped agent is exactly what the drumbeat must relance. The host plugin
|
|
7
|
-
* therefore records a **durable** stop entry here, under
|
|
8
|
-
* `<root>/.h2a/drumbeat/<safe-instance>.json`, which survives the presence
|
|
9
|
-
* sweep until the agent is cleanly resumed or finished.
|
|
10
|
-
*
|
|
11
|
-
* The presence `workStatus`/`inferStall` (D1) still cover the running-but-idle
|
|
12
|
-
* case; this registry covers the stopped case.
|
|
13
|
-
*/
|
|
14
|
-
import type { H2ALaunchContext, H2AReflexiveAction, H2AWorkStatus } from "@sentropic/h2a";
|
|
15
|
-
export interface H2ADrumbeatEntry {
|
|
16
|
-
readonly instance: string;
|
|
17
|
-
/** Status the agent reported when it stopped. */
|
|
18
|
-
readonly workStatus: H2AWorkStatus;
|
|
19
|
-
/** ISO timestamp of the stop. */
|
|
20
|
-
readonly stoppedAt: string;
|
|
21
|
-
/** Launch context captured at start, for the relauncher (DEC-084). */
|
|
22
|
-
readonly launchContext?: H2ALaunchContext;
|
|
23
|
-
/** How many relances have been issued for this stop. */
|
|
24
|
-
readonly relanceCount: number;
|
|
25
|
-
/** ISO timestamp of the last relance, if any. */
|
|
26
|
-
readonly lastRelanceAt?: string;
|
|
27
|
-
/**
|
|
28
|
-
* D5: set when a reflexive-watchdog terminal action (escalate/reroute) resolved
|
|
29
|
-
* this stop. `scanDrumbeat` skips terminal entries so they are not re-decided;
|
|
30
|
-
* a genuine fresh `recordStop` overwrites the entry (a new relance budget).
|
|
31
|
-
*/
|
|
32
|
-
readonly terminal?: {
|
|
33
|
-
readonly action: H2AReflexiveAction;
|
|
34
|
-
readonly at: string;
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
export interface RecordStopInput {
|
|
38
|
-
readonly instance: string;
|
|
39
|
-
readonly workStatus: H2AWorkStatus;
|
|
40
|
-
readonly launchContext?: H2ALaunchContext;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Record (upsert) that an agent stopped. Resets `relanceCount` to 0 — a fresh
|
|
44
|
-
* stop is a fresh relance budget. The host plugin calls this on exit.
|
|
45
|
-
*/
|
|
46
|
-
export declare function recordStop(root: string, input: RecordStopInput, now?: number): H2ADrumbeatEntry;
|
|
47
|
-
export declare function readDrumbeatEntry(root: string, instance: string): H2ADrumbeatEntry | undefined;
|
|
48
|
-
export declare function listDrumbeat(root: string): H2ADrumbeatEntry[];
|
|
49
|
-
/** Remove an entry — call when the agent is cleanly resumed or finished. */
|
|
50
|
-
export declare function clearDrumbeatEntry(root: string, instance: string): void;
|
|
51
|
-
/** Increment the relance counter after a relance was issued. */
|
|
52
|
-
export declare function markRelanced(root: string, instance: string, now?: number): H2ADrumbeatEntry | undefined;
|
|
53
|
-
/**
|
|
54
|
-
* D5: mark an entry terminal (a reflexive-watchdog escalate/reroute resolved it).
|
|
55
|
-
* `scanDrumbeat` skips terminal entries, so the watchdog does not re-decide it
|
|
56
|
-
* each beat — without the destructive delete that a later `recordStop` (which
|
|
57
|
-
* resets `relanceCount`) would re-arm into a slow loop.
|
|
58
|
-
*/
|
|
59
|
-
export declare function markDrumbeatTerminal(root: string, instance: string, action: H2AReflexiveAction, now?: number): H2ADrumbeatEntry | undefined;
|
|
60
|
-
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/runtime/drumbeat/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAI1F,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,iDAAiD;IACjD,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC;IACnC,iCAAiC;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,sEAAsE;IACtE,QAAQ,CAAC,aAAa,CAAC,EAAE,gBAAgB,CAAC;IAC1C,wDAAwD;IACxD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,iDAAiD;IACjD,QAAQ,CAAC,aAAa,CAAC,EAA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
* heartbeat, so a genuinely *stopped* agent leaves no trace there — yet the
|
|
6
|
-
* stopped agent is exactly what the drumbeat must relance. The host plugin
|
|
7
|
-
* therefore records a **durable** stop entry here, under
|
|
8
|
-
* `<root>/.h2a/drumbeat/<safe-instance>.json`, which survives the presence
|
|
9
|
-
* sweep until the agent is cleanly resumed or finished.
|
|
10
|
-
*
|
|
11
|
-
* The presence `workStatus`/`inferStall` (D1) still cover the running-but-idle
|
|
12
|
-
* case; this registry covers the stopped case.
|
|
13
|
-
*/
|
|
14
|
-
import { existsSync, mkdirSync, readFileSync, readdirSync, unlinkSync, writeFileSync } from "node:fs";
|
|
15
|
-
import { join } from "node:path";
|
|
16
|
-
import { localStorePaths, safePathSegment } from "../local-files/paths.js";
|
|
17
|
-
function entryFile(root, instance) {
|
|
18
|
-
return join(localStorePaths(root).drumbeat, `${safePathSegment(instance)}.json`);
|
|
19
|
-
}
|
|
20
|
-
function ensureDir(root) {
|
|
21
|
-
mkdirSync(localStorePaths(root).drumbeat, { recursive: true });
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Record (upsert) that an agent stopped. Resets `relanceCount` to 0 — a fresh
|
|
25
|
-
* stop is a fresh relance budget. The host plugin calls this on exit.
|
|
26
|
-
*/
|
|
27
|
-
export function recordStop(root, input, now = Date.now()) {
|
|
28
|
-
ensureDir(root);
|
|
29
|
-
const entry = {
|
|
30
|
-
instance: input.instance,
|
|
31
|
-
workStatus: input.workStatus,
|
|
32
|
-
stoppedAt: new Date(now).toISOString(),
|
|
33
|
-
...(input.launchContext ? { launchContext: input.launchContext } : {}),
|
|
34
|
-
relanceCount: 0
|
|
35
|
-
};
|
|
36
|
-
writeFileSync(entryFile(root, input.instance), `${JSON.stringify(entry, null, 2)}\n`, "utf8");
|
|
37
|
-
return entry;
|
|
38
|
-
}
|
|
39
|
-
export function readDrumbeatEntry(root, instance) {
|
|
40
|
-
const file = entryFile(root, instance);
|
|
41
|
-
if (!existsSync(file))
|
|
42
|
-
return undefined;
|
|
43
|
-
try {
|
|
44
|
-
return JSON.parse(readFileSync(file, "utf8"));
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
return undefined;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
export function listDrumbeat(root) {
|
|
51
|
-
const dir = localStorePaths(root).drumbeat;
|
|
52
|
-
let entries;
|
|
53
|
-
try {
|
|
54
|
-
entries = readdirSync(dir);
|
|
55
|
-
}
|
|
56
|
-
catch (err) {
|
|
57
|
-
if (err.code === "ENOENT")
|
|
58
|
-
return [];
|
|
59
|
-
throw err;
|
|
60
|
-
}
|
|
61
|
-
const out = [];
|
|
62
|
-
for (const name of entries) {
|
|
63
|
-
if (!name.endsWith(".json"))
|
|
64
|
-
continue;
|
|
65
|
-
try {
|
|
66
|
-
out.push(JSON.parse(readFileSync(join(dir, name), "utf8")));
|
|
67
|
-
}
|
|
68
|
-
catch {
|
|
69
|
-
// skip malformed
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return out;
|
|
73
|
-
}
|
|
74
|
-
/** Remove an entry — call when the agent is cleanly resumed or finished. */
|
|
75
|
-
export function clearDrumbeatEntry(root, instance) {
|
|
76
|
-
const file = entryFile(root, instance);
|
|
77
|
-
try {
|
|
78
|
-
unlinkSync(file);
|
|
79
|
-
}
|
|
80
|
-
catch (err) {
|
|
81
|
-
if (err.code !== "ENOENT")
|
|
82
|
-
throw err;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
/** Increment the relance counter after a relance was issued. */
|
|
86
|
-
export function markRelanced(root, instance, now = Date.now()) {
|
|
87
|
-
const existing = readDrumbeatEntry(root, instance);
|
|
88
|
-
if (!existing)
|
|
89
|
-
return undefined;
|
|
90
|
-
const next = {
|
|
91
|
-
...existing,
|
|
92
|
-
relanceCount: existing.relanceCount + 1,
|
|
93
|
-
lastRelanceAt: new Date(now).toISOString()
|
|
94
|
-
};
|
|
95
|
-
writeFileSync(entryFile(root, instance), `${JSON.stringify(next, null, 2)}\n`, "utf8");
|
|
96
|
-
return next;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* D5: mark an entry terminal (a reflexive-watchdog escalate/reroute resolved it).
|
|
100
|
-
* `scanDrumbeat` skips terminal entries, so the watchdog does not re-decide it
|
|
101
|
-
* each beat — without the destructive delete that a later `recordStop` (which
|
|
102
|
-
* resets `relanceCount`) would re-arm into a slow loop.
|
|
103
|
-
*/
|
|
104
|
-
export function markDrumbeatTerminal(root, instance, action, now = Date.now()) {
|
|
105
|
-
const existing = readDrumbeatEntry(root, instance);
|
|
106
|
-
if (!existing)
|
|
107
|
-
return undefined;
|
|
108
|
-
const next = {
|
|
109
|
-
...existing,
|
|
110
|
-
terminal: { action, at: new Date(now).toISOString() }
|
|
111
|
-
};
|
|
112
|
-
writeFileSync(entryFile(root, instance), `${JSON.stringify(next, null, 2)}\n`, "utf8");
|
|
113
|
-
return next;
|
|
114
|
-
}
|
|
115
|
-
//# sourceMappingURL=registry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/runtime/drumbeat/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtG,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAsB3E,SAAS,SAAS,CAAC,IAAY,EAAE,QAAgB;IAC/C,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,GAAG,eAAe,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACnF,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,QAAQ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AY,GAAG,CAAC;QACvC,aAAa,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE;KAC3C,CAAC;IACF,aAAa,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACvF,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAY,EACZ,QAAgB,EAChB,MAA0B,EAC1B,MAAc,IAAI,CAAC,GAAG,EAAE;IAExB,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACnD,IAAI,CAAC,QAAQ;QAAE,OAAO,SAAS,CAAC;IAChC,MAAM,IAAI,GAAqB;QAC7B,GAAG,QAAQ;QACX,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE;KACtD,CAAC;IACF,aAAa,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACvF,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Drumbeat relauncher adapters (DEC-091, slice D3). D2 shipped the dumb daemon
|
|
3
|
-
* + the `H2ARelauncher` interface with only a logging adapter; D3 supplies the
|
|
4
|
-
* two **local** adapters that actually revive a stalled agent:
|
|
5
|
-
*
|
|
6
|
-
* - **local-tmux**: `tmux send-keys` the resume/launch command into the pane
|
|
7
|
-
* captured at launch (DEC-085 `launchContext.tmux`). The natural revive for a
|
|
8
|
-
* user-local agent — it lands back in its original terminal.
|
|
9
|
-
* - **headless**: detached background respawn of the captured command + a
|
|
10
|
-
* notification (the PRINCIPAL escalation is wired fully in D7).
|
|
11
|
-
*
|
|
12
|
-
* `chainRelauncher` composes them (try tmux, fall back to headless) — the
|
|
13
|
-
* "local-tmux adapter + headless fallback" of D3. The actual process I/O is
|
|
14
|
-
* behind an injectable `RelauncherRuntime` so the adapters are unit-testable
|
|
15
|
-
* with no real tmux or child processes. The remote adapter is D4.
|
|
16
|
-
*/
|
|
17
|
-
import { type H2AActorRef, type H2ADrumbeatResumeBody, type H2AEnvelope } from "@sentropic/h2a";
|
|
18
|
-
import { type SendRemoteOptions, type SendRemoteResult } from "../remote/client.js";
|
|
19
|
-
import type { H2ARelauncher } from "./watch.js";
|
|
20
|
-
/** Process I/O the adapters need — injected so tests supply a fake. */
|
|
21
|
-
export interface RelauncherRuntime {
|
|
22
|
-
/** Run a foreground command; return true on exit code 0. */
|
|
23
|
-
run(file: string, args: readonly string[]): boolean;
|
|
24
|
-
/** Spawn a detached background process; return true if it started. */
|
|
25
|
-
spawnDetached(command: string | {
|
|
26
|
-
file: string;
|
|
27
|
-
args: readonly string[];
|
|
28
|
-
cwd?: string;
|
|
29
|
-
}, options: {
|
|
30
|
-
cwd?: string;
|
|
31
|
-
}): boolean;
|
|
32
|
-
/** Run a command and return its stdout (undefined on failure). For probes. */
|
|
33
|
-
capture?(file: string, args: readonly string[]): string | undefined;
|
|
34
|
-
/** Optional side-channel note (relances are observable). */
|
|
35
|
-
notify?(line: string): void;
|
|
36
|
-
}
|
|
37
|
-
export declare const defaultRelauncherRuntime: RelauncherRuntime;
|
|
38
|
-
interface RelauncherCommonOptions {
|
|
39
|
-
runtime?: RelauncherRuntime;
|
|
40
|
-
log?: (line: string) => void;
|
|
41
|
-
}
|
|
42
|
-
export type RemoteEndpointResolver = (instance: string) => string | undefined | Promise<string | undefined>;
|
|
43
|
-
export type RemoteEnvelopeSender = (url: string, envelope: H2AEnvelope<H2ADrumbeatResumeBody>, options: SendRemoteOptions) => Promise<SendRemoteResult>;
|
|
44
|
-
export interface RemoteRelauncherOptions {
|
|
45
|
-
/** Store root used by the default endpoint resolver. */
|
|
46
|
-
root?: string;
|
|
47
|
-
/** Actor placed on the resume envelope and used as the signature signer. */
|
|
48
|
-
actor: H2AActorRef;
|
|
49
|
-
/** Signer's ed25519 private-key PEM. */
|
|
50
|
-
privateKeyPem: string;
|
|
51
|
-
/** Resolve the target instance to its remote endpoint. Defaults to registry lookup. */
|
|
52
|
-
resolveEndpoint?: RemoteEndpointResolver;
|
|
53
|
-
/** Transport override for tests. Defaults to sendRemoteEnvelope. */
|
|
54
|
-
sendImpl?: RemoteEnvelopeSender;
|
|
55
|
-
/** Clock source for deterministic tests. */
|
|
56
|
-
now?: () => number;
|
|
57
|
-
log?: (line: string) => void;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Build a tmux target-pane spec from a captured `launchContext.tmux`. With a
|
|
61
|
-
* window it is `session:window.pane`; otherwise the pane is assumed to be a
|
|
62
|
-
* unique tmux pane id (`%N`, captured via `#{pane_id}` by the D6 plugins) and
|
|
63
|
-
* targeted directly.
|
|
64
|
-
*/
|
|
65
|
-
export declare function tmuxTarget(t: {
|
|
66
|
-
session: string;
|
|
67
|
-
window?: string;
|
|
68
|
-
pane: string;
|
|
69
|
-
}): string;
|
|
70
|
-
/**
|
|
71
|
-
* Type `text` into a tmux pane AND submit it. Sends the text literally (`-l`, so
|
|
72
|
-
* spaces / special chars aren't interpreted as tmux key names) then Enter as a
|
|
73
|
-
* SEPARATE send-keys. A combined `send-keys "text" Enter` (or one without `-l`)
|
|
74
|
-
* leaves the line in the input but **never commits** on modern TUIs
|
|
75
|
-
* (codex/claude) — the bug behind "the line is written but no Enter fires". A
|
|
76
|
-
* second Enter covers TUIs that buffer the first. The single shared submit path
|
|
77
|
-
* for both the drumbeat relauncher and the EVO-1 wake/drive local-tmux driver.
|
|
78
|
-
*/
|
|
79
|
-
export declare function tmuxSendSubmit(runtime: Pick<RelauncherRuntime, "run">, target: string, text: string): boolean;
|
|
80
|
-
/**
|
|
81
|
-
* Default window (ms): if a tmux client attached to the pane's session was
|
|
82
|
-
* active within this window, a wake/relance is DEFERRED so it does not clobber
|
|
83
|
-
* a human typing in the pane. Override via `H2A_WAKE_DEFER_ACTIVITY_MS` (0 = off).
|
|
84
|
-
*/
|
|
85
|
-
export declare const H2A_WAKE_DEFER_ACTIVITY_DEFAULT_MS = 4000;
|
|
86
|
-
/**
|
|
87
|
-
* True iff a tmux CLIENT attached to `target`'s session had activity within the
|
|
88
|
-
* defer window — i.e. a human is (probably) typing/looking RIGHT NOW, so a wake
|
|
89
|
-
* that types into the pane would clobber their in-progress input. TUI-agnostic
|
|
90
|
-
* (uses tmux `client_activity`, not any TUI's composer state). Fail-OPEN: if the
|
|
91
|
-
* probe can't be read (no `capture`, no tmux, detached/no client), returns false
|
|
92
|
-
* so waking still works — the guard only fires on a POSITIVE recent-activity read.
|
|
93
|
-
*/
|
|
94
|
-
export declare function paneHasRecentHumanActivity(runtime: Pick<RelauncherRuntime, "capture">, target: string, opts?: {
|
|
95
|
-
now?: number;
|
|
96
|
-
windowMs?: number;
|
|
97
|
-
}): boolean;
|
|
98
|
-
/** Revive a stalled agent by sending its resume/launch command into its pane. */
|
|
99
|
-
export declare function localTmuxRelauncher(options?: RelauncherCommonOptions): H2ARelauncher;
|
|
100
|
-
/** Fallback: detached background respawn of the captured command + notify. */
|
|
101
|
-
export declare function headlessRelauncher(options?: RelauncherCommonOptions): H2ARelauncher;
|
|
102
|
-
/** Try each adapter in order; the first to issue a relance wins (D3 fallback). */
|
|
103
|
-
export declare function chainRelauncher(...relaunchers: readonly H2ARelauncher[]): H2ARelauncher;
|
|
104
|
-
/**
|
|
105
|
-
* D4 remote adapter: sign a `drumbeat.resume` envelope and deliver it to the
|
|
106
|
-
* target instance's declared remote endpoint. It never executes remote code.
|
|
107
|
-
*/
|
|
108
|
-
export declare function remoteRelauncher(options: RemoteRelauncherOptions): H2ARelauncher;
|
|
109
|
-
export type H2ARelauncherKind = "logging" | "local-tmux" | "headless" | "remote" | "auto";
|
|
110
|
-
export {};
|
|
111
|
-
//# sourceMappingURL=relaunchers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"relaunchers.d.ts","sourceRoot":"","sources":["../../../src/runtime/drumbeat/relaunchers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EACjB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,uEAAuE;AACvE,MAAM,WAAW,iBAAiB;IAChC,4DAA4D;IAC5D,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC;IACpD,sEAAsE;IACtE,aAAa,CACX,OAAO,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,EACzE,OAAO,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,GACxB,OAAO,CAAC;IACX,8EAA8E;IAC9E,OAAO,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAAC;IACpE,4DAA4D;IAC5D,MAAM,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,eAAO,MAAM,wBAAwB,EAAE,iBAqCtC,CAAC;AAEF,UAAU,uBAAuB;IAC/B,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,GAAG,CAAC,EAAE,CAA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