@sentropic/h2a-cli 0.74.0 → 0.78.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 -36
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -40
- 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 -729
- 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 -4530
- 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 -242
- 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/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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/escalation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,eAAe,EACf,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC3B,MAAM,eAAe,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/escalation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,eAAe,EAIhB,MAAM,eAAe,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Durable escalation registry (DEC-095, Drumbeat D7). When an agent exhausts its
|
|
3
|
-
* relance budget (DEC-086 `scanDrumbeat` → `exhausted`), the daemon must stop
|
|
4
|
-
* looping and **escalate to the PRINCIPAL** (DEC-084: the engagement owner, not
|
|
5
|
-
* EXECUTIF) over the `alert` channel (DEC-040). The relance cap is the anti-loop
|
|
6
|
-
* guard; this registry is the escalation that replaces further relances.
|
|
7
|
-
*
|
|
8
|
-
* Parallel to the drumbeat/blockage registries: `<root>/.h2a/escalation/<safe-instance>.json`.
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Why the escalation fired. `relance-exhausted` (D7, relance budget spent);
|
|
12
|
-
* `watchdog-escalate` / `reroute-suggested` (D5, the reflexive watchdog decided
|
|
13
|
-
* a human must look, or that the work should be reassigned).
|
|
14
|
-
*/
|
|
15
|
-
export type H2AEscalationReason = "relance-exhausted" | "watchdog-escalate" | "reroute-suggested";
|
|
16
|
-
export interface H2AEscalationRecord {
|
|
17
|
-
readonly instance: string;
|
|
18
|
-
readonly reason: H2AEscalationReason;
|
|
19
|
-
/** Relance count at the time the budget was exhausted. */
|
|
20
|
-
readonly relanceCount: number;
|
|
21
|
-
/** Escalation channel (DEC-040). Defaults to `alert`. */
|
|
22
|
-
readonly channel: string;
|
|
23
|
-
/** Symbolic target — the scope's competent authority. Defaults to `PRINCIPAL` (DEC-084). */
|
|
24
|
-
readonly to: string;
|
|
25
|
-
readonly at: string;
|
|
26
|
-
}
|
|
27
|
-
export interface RecordEscalationInput {
|
|
28
|
-
readonly instance: string;
|
|
29
|
-
readonly reason: H2AEscalationReason;
|
|
30
|
-
readonly relanceCount: number;
|
|
31
|
-
readonly channel?: string;
|
|
32
|
-
readonly to?: string;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Record (upsert) an escalation. Idempotent per instance: a repeated escalation
|
|
36
|
-
* for the same exhausted instance overwrites with the latest count/time rather
|
|
37
|
-
* than piling up — the PRINCIPAL needs one open alert per agent, not a flood.
|
|
38
|
-
*/
|
|
39
|
-
export declare function recordEscalation(root: string, input: RecordEscalationInput, now?: number): H2AEscalationRecord;
|
|
40
|
-
export declare function readEscalation(root: string, instance: string): H2AEscalationRecord | undefined;
|
|
41
|
-
export declare function listEscalations(root: string): H2AEscalationRecord[];
|
|
42
|
-
/** Clear an escalation — call when the agent is cleanly resumed/finished. */
|
|
43
|
-
export declare function clearEscalation(root: string, instance: string): void;
|
|
44
|
-
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|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 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Durable escalation registry (DEC-095, Drumbeat D7). When an agent exhausts its
|
|
3
|
-
* relance budget (DEC-086 `scanDrumbeat` → `exhausted`), the daemon must stop
|
|
4
|
-
* looping and **escalate to the PRINCIPAL** (DEC-084: the engagement owner, not
|
|
5
|
-
* EXECUTIF) over the `alert` channel (DEC-040). The relance cap is the anti-loop
|
|
6
|
-
* guard; this registry is the escalation that replaces further relances.
|
|
7
|
-
*
|
|
8
|
-
* Parallel to the drumbeat/blockage registries: `<root>/.h2a/escalation/<safe-instance>.json`.
|
|
9
|
-
*/
|
|
10
|
-
import { existsSync, mkdirSync, readFileSync, readdirSync, unlinkSync, writeFileSync } from "node:fs";
|
|
11
|
-
import { join } from "node:path";
|
|
12
|
-
import { localStorePaths, safePathSegment } from "../local-files/paths.js";
|
|
13
|
-
function entryFile(root, instance) {
|
|
14
|
-
return join(localStorePaths(root).escalation, `${safePathSegment(instance)}.json`);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Record (upsert) an escalation. Idempotent per instance: a repeated escalation
|
|
18
|
-
* for the same exhausted instance overwrites with the latest count/time rather
|
|
19
|
-
* than piling up — the PRINCIPAL needs one open alert per agent, not a flood.
|
|
20
|
-
*/
|
|
21
|
-
export function recordEscalation(root, input, now = Date.now()) {
|
|
22
|
-
mkdirSync(localStorePaths(root).escalation, { recursive: true });
|
|
23
|
-
const record = {
|
|
24
|
-
instance: input.instance,
|
|
25
|
-
reason: input.reason,
|
|
26
|
-
relanceCount: input.relanceCount,
|
|
27
|
-
channel: input.channel ?? "alert",
|
|
28
|
-
to: input.to ?? "PRINCIPAL",
|
|
29
|
-
at: new Date(now).toISOString()
|
|
30
|
-
};
|
|
31
|
-
writeFileSync(entryFile(root, input.instance), `${JSON.stringify(record, null, 2)}\n`, "utf8");
|
|
32
|
-
return record;
|
|
33
|
-
}
|
|
34
|
-
export function readEscalation(root, instance) {
|
|
35
|
-
const file = entryFile(root, instance);
|
|
36
|
-
if (!existsSync(file))
|
|
37
|
-
return undefined;
|
|
38
|
-
try {
|
|
39
|
-
return JSON.parse(readFileSync(file, "utf8"));
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
export function listEscalations(root) {
|
|
46
|
-
const dir = localStorePaths(root).escalation;
|
|
47
|
-
let names;
|
|
48
|
-
try {
|
|
49
|
-
names = readdirSync(dir);
|
|
50
|
-
}
|
|
51
|
-
catch (err) {
|
|
52
|
-
if (err.code === "ENOENT")
|
|
53
|
-
return [];
|
|
54
|
-
throw err;
|
|
55
|
-
}
|
|
56
|
-
const out = [];
|
|
57
|
-
for (const name of names) {
|
|
58
|
-
if (!name.endsWith(".json"))
|
|
59
|
-
continue;
|
|
60
|
-
try {
|
|
61
|
-
out.push(JSON.parse(readFileSync(join(dir, name), "utf8")));
|
|
62
|
-
}
|
|
63
|
-
catch {
|
|
64
|
-
// skip malformed
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return out;
|
|
68
|
-
}
|
|
69
|
-
/** Clear an escalation — call when the agent is cleanly resumed/finished. */
|
|
70
|
-
export function clearEscalation(root, instance) {
|
|
71
|
-
try {
|
|
72
|
-
unlinkSync(entryFile(root, instance));
|
|
73
|
-
}
|
|
74
|
-
catch (err) {
|
|
75
|
-
if (err.code !== "ENOENT")
|
|
76
|
-
throw err;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
//# sourceMappingURL=registry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/runtime/escalation/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtG,OAAO,EAAE,IAAI,EAAE,MAAM,WAA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|
|
4
|
-
* A claim event signals that an instance is asserting the conductor role for
|
|
5
|
-
* a workspace; a release event cancels it. The store is a plain JSONL file at
|
|
6
|
-
* `<root>/.h2a/governance/conductor-claims.jsonl`. The fold over events is
|
|
7
|
-
* `activeConductorClaims`: an instance has an active claim iff its latest event
|
|
8
|
-
* (by `at`) for (workspaceId, instance) is a `claim` (a `release` cancels it).
|
|
9
|
-
*
|
|
10
|
-
* This is additive/reversible — append-only, no deletion, no enforcement.
|
|
11
|
-
*/
|
|
12
|
-
export interface ConductorClaimEvent {
|
|
13
|
-
readonly type: "claim" | "release";
|
|
14
|
-
readonly workspaceId: string;
|
|
15
|
-
readonly instance: string;
|
|
16
|
-
/** ISO 8601 timestamp of the event. */
|
|
17
|
-
readonly at: string;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Append a conductor claim or release event to the JSONL store.
|
|
21
|
-
* Creates the governance directory if it does not exist.
|
|
22
|
-
*/
|
|
23
|
-
export declare function appendConductorClaim(root: string, event: ConductorClaimEvent): void;
|
|
24
|
-
/**
|
|
25
|
-
* Read all conductor claim/release events from the store.
|
|
26
|
-
* Returns an empty array if the file does not exist. Skips malformed lines.
|
|
27
|
-
*/
|
|
28
|
-
export declare function listConductorClaims(root: string): ConductorClaimEvent[];
|
|
29
|
-
/**
|
|
30
|
-
* Fold the claim/release log to find active claimants for a workspace.
|
|
31
|
-
*
|
|
32
|
-
* An instance has an **active** claim for `workspaceId` iff its latest event
|
|
33
|
-
* (by `at`) for the pair `(workspaceId, instance)` is a `claim` (a subsequent
|
|
34
|
-
* `release` cancels it).
|
|
35
|
-
*
|
|
36
|
-
* Returns active claimants sorted by their claim `at` ASCENDING (earliest
|
|
37
|
-
* claimant first — the tiebreaker for the conductor election).
|
|
38
|
-
*/
|
|
39
|
-
export declare function activeConductorClaims(root: string, workspaceId: string): Array<{
|
|
40
|
-
instance: string;
|
|
41
|
-
at: string;
|
|
42
|
-
}>;
|
|
43
|
-
//# sourceMappingURL=claims.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"claims.d.ts","sourceRoot":"","sources":["../../../src/runtime/governance/claims.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAWH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,uCAAuC;IACvC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAkBD;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,mBAAmB,GACzB,IAAI,CAIN;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAavE;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB,KAAK,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CA4BzC"}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Governance primitive: append-only conductor-claims store (WP-G1b).
|
|
3
|
-
*
|
|
4
|
-
* A claim event signals that an instance is asserting the conductor role for
|
|
5
|
-
* a workspace; a release event cancels it. The store is a plain JSONL file at
|
|
6
|
-
* `<root>/.h2a/governance/conductor-claims.jsonl`. The fold over events is
|
|
7
|
-
* `activeConductorClaims`: an instance has an active claim iff its latest event
|
|
8
|
-
* (by `at`) for (workspaceId, instance) is a `claim` (a `release` cancels it).
|
|
9
|
-
*
|
|
10
|
-
* This is additive/reversible — append-only, no deletion, no enforcement.
|
|
11
|
-
*/
|
|
12
|
-
import { appendFileSync, existsSync, mkdirSync, readFileSync } from "node:fs";
|
|
13
|
-
import { join } from "node:path";
|
|
14
|
-
import { canonicalAddress, localStorePaths } from "../local-files/index.js";
|
|
15
|
-
// ---------------------------------------------------------------------------
|
|
16
|
-
// Paths
|
|
17
|
-
// ---------------------------------------------------------------------------
|
|
18
|
-
function governanceDir(root) {
|
|
19
|
-
return join(localStorePaths(root).root, "governance");
|
|
20
|
-
}
|
|
21
|
-
function claimsFile(root) {
|
|
22
|
-
return join(governanceDir(root), "conductor-claims.jsonl");
|
|
23
|
-
}
|
|
24
|
-
// ---------------------------------------------------------------------------
|
|
25
|
-
// Store operations
|
|
26
|
-
// ---------------------------------------------------------------------------
|
|
27
|
-
/**
|
|
28
|
-
* Append a conductor claim or release event to the JSONL store.
|
|
29
|
-
* Creates the governance directory if it does not exist.
|
|
30
|
-
*/
|
|
31
|
-
export function appendConductorClaim(root, event) {
|
|
32
|
-
const dir = governanceDir(root);
|
|
33
|
-
mkdirSync(dir, { recursive: true });
|
|
34
|
-
appendFileSync(claimsFile(root), `${JSON.stringify(event)}\n`, "utf8");
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Read all conductor claim/release events from the store.
|
|
38
|
-
* Returns an empty array if the file does not exist. Skips malformed lines.
|
|
39
|
-
*/
|
|
40
|
-
export function listConductorClaims(root) {
|
|
41
|
-
const file = claimsFile(root);
|
|
42
|
-
if (!existsSync(file))
|
|
43
|
-
return [];
|
|
44
|
-
const out = [];
|
|
45
|
-
for (const line of readFileSync(file, "utf8").split("\n")) {
|
|
46
|
-
if (!line.trim())
|
|
47
|
-
continue;
|
|
48
|
-
try {
|
|
49
|
-
out.push(JSON.parse(line));
|
|
50
|
-
}
|
|
51
|
-
catch {
|
|
52
|
-
// skip malformed line
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return out;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Fold the claim/release log to find active claimants for a workspace.
|
|
59
|
-
*
|
|
60
|
-
* An instance has an **active** claim for `workspaceId` iff its latest event
|
|
61
|
-
* (by `at`) for the pair `(workspaceId, instance)` is a `claim` (a subsequent
|
|
62
|
-
* `release` cancels it).
|
|
63
|
-
*
|
|
64
|
-
* Returns active claimants sorted by their claim `at` ASCENDING (earliest
|
|
65
|
-
* claimant first — the tiebreaker for the conductor election).
|
|
66
|
-
*/
|
|
67
|
-
export function activeConductorClaims(root, workspaceId) {
|
|
68
|
-
const events = listConductorClaims(root);
|
|
69
|
-
// Compare workspace ids CANONICALLY so a claim stored raw still matches a
|
|
70
|
-
// canonicalized lookup (conductorFor passes canonicalAddress(workspaceId)).
|
|
71
|
-
const wantWs = canonicalAddress(workspaceId);
|
|
72
|
-
// Build a map: instance → { type, at } of the LATEST event for this workspaceId.
|
|
73
|
-
const latest = new Map();
|
|
74
|
-
for (const ev of events) {
|
|
75
|
-
if (canonicalAddress(ev.workspaceId) !== wantWs)
|
|
76
|
-
continue;
|
|
77
|
-
const prev = latest.get(ev.instance);
|
|
78
|
-
if (!prev || ev.at >= prev.at) {
|
|
79
|
-
latest.set(ev.instance, { type: ev.type, at: ev.at });
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
// Retain only instances whose latest event is a `claim`.
|
|
83
|
-
const active = [];
|
|
84
|
-
for (const [instance, { type, at }] of latest) {
|
|
85
|
-
if (type === "claim") {
|
|
86
|
-
active.push({ instance, at });
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
// Sort ascending by `at` so the earliest claimant is first.
|
|
90
|
-
active.sort((a, b) => a.at.localeCompare(b.at));
|
|
91
|
-
return active;
|
|
92
|
-
}
|
|
93
|
-
//# sourceMappingURL=claims.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"claims.js","sourceRoot":"","sources":["../../../src/runtime/governance/claims.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE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C,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAChD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Governance primitive: conductor/owner resolver for a workspace.
|
|
3
|
-
*
|
|
4
|
-
* WP-G1 — Read-only, pure over presence + registry + claims. No writes.
|
|
5
|
-
*
|
|
6
|
-
* The "CONDUCTOR of workspace W" is resolved in precedence order:
|
|
7
|
-
* 1. The EARLIEST active-claim instance (from activeConductorClaims) that is
|
|
8
|
-
* also a live in-workspace candidate (WP-G1b — claim-based election).
|
|
9
|
-
* 2. (back-compat) A live candidate whose registration roles include
|
|
10
|
-
* "CONDUCTOR" (WP-G1a — role-based).
|
|
11
|
-
* 3. null (the common state: agents auto-register as AGENTS).
|
|
12
|
-
*/
|
|
13
|
-
/** One live in-workspace agent. */
|
|
14
|
-
export interface ConductorCandidate {
|
|
15
|
-
/** Perennial instance id (host:slug:uuid12). */
|
|
16
|
-
readonly instance: string;
|
|
17
|
-
/** Host (claude, codex, gemini, agy, remote, …). */
|
|
18
|
-
readonly host?: string;
|
|
19
|
-
/** Display name, if set on the session. */
|
|
20
|
-
readonly name?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Roles from the registry registration. Empty array if the instance has no
|
|
23
|
-
* registration (unregistered presence).
|
|
24
|
-
*/
|
|
25
|
-
readonly roles: string[];
|
|
26
|
-
/** ISO timestamp when the session was opened. */
|
|
27
|
-
readonly startedAt: string;
|
|
28
|
-
/** ISO timestamp of the last heartbeat. */
|
|
29
|
-
readonly heartbeatAt: string;
|
|
30
|
-
}
|
|
31
|
-
export interface ConductorResolution {
|
|
32
|
-
/** The workspace id that was resolved (canonical form). */
|
|
33
|
-
readonly workspaceId: string;
|
|
34
|
-
/**
|
|
35
|
-
* The live CONDUCTOR: resolved in precedence order (claim > role > null).
|
|
36
|
-
* null if no live in-workspace candidate holds either a claim or the role.
|
|
37
|
-
*/
|
|
38
|
-
readonly conductor: string | null;
|
|
39
|
-
/**
|
|
40
|
-
* The instance that holds an active claim and is live in-workspace, or null
|
|
41
|
-
* if the conductor was resolved by role or is null. Exposes claim provenance.
|
|
42
|
-
*/
|
|
43
|
-
readonly claimedBy: string | null;
|
|
44
|
-
/**
|
|
45
|
-
* All live sessions whose workspace.id matches (canonical-compared) the
|
|
46
|
-
* requested workspaceId. The conductor (if any) is also in this list.
|
|
47
|
-
*/
|
|
48
|
-
readonly candidates: ConductorCandidate[];
|
|
49
|
-
/** true if at least one candidate is live (candidates.length > 0). */
|
|
50
|
-
readonly live: boolean;
|
|
51
|
-
}
|
|
52
|
-
export interface ConductorForOptions {
|
|
53
|
-
readonly root: string;
|
|
54
|
-
readonly workspaceId: string;
|
|
55
|
-
/** Optional: override the freshness expiry window in ms (default 90000). */
|
|
56
|
-
readonly expiryMs?: number;
|
|
57
|
-
/** Optional: reference instant for freshness (default Date.now()). */
|
|
58
|
-
readonly now?: number;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Resolve the live conductor/owner of a workspace.
|
|
62
|
-
*
|
|
63
|
-
* Algorithm:
|
|
64
|
-
* 1. List all fresh presence records (90s freshness by default).
|
|
65
|
-
* 2. Retain sessions whose `workspace.id` matches the requested workspaceId
|
|
66
|
-
* (case-insensitive / slug-stable via canonicalAddress on both sides).
|
|
67
|
-
* 3. For each candidate, look up the registry to read its roles.
|
|
68
|
-
* 4. Read active conductor claims for the workspace.
|
|
69
|
-
* 5. conductor =
|
|
70
|
-
* a. The EARLIEST active-claim instance (by claim `at`) that is also a
|
|
71
|
-
* live in-workspace candidate (claim-based election, WP-G1b); OR
|
|
72
|
-
* b. (back-compat) the FIRST (by startedAt) live candidate whose roles
|
|
73
|
-
* include "CONDUCTOR" (role-based, WP-G1a); OR
|
|
74
|
-
* c. null.
|
|
75
|
-
* 6. claimedBy = the instance resolved via path (a), or null.
|
|
76
|
-
* 7. live = candidates.length > 0.
|
|
77
|
-
*/
|
|
78
|
-
export declare function conductorFor(opts: ConductorForOptions): ConductorResolution;
|
|
79
|
-
//# sourceMappingURL=conductor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conductor.d.ts","sourceRoot":"","sources":["../../../src/runtime/governance/conductor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,mCAAmC;AACnC,MAAM,WAAW,kBAAkB;IACjC,gDAAgD;IAChD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,oDAAoD;IACpD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,2CAA2C;IAC3C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IACzB,iDAAiD;IACjD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,2CAA2C;IAC3C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,mBAAmB;IAClC,2DAA2D;IAC3D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,kBAAkB,EAAE,CAAC;IAC1C,sEAAsE;IACtE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,4EAA4E;IAC5E,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,sEAAsE;IACtE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,mBAAmB,GAAG,mBAAmB,CA4E3E"}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Governance primitive: conductor/owner resolver for a workspace.
|
|
3
|
-
*
|
|
4
|
-
* WP-G1 — Read-only, pure over presence + registry + claims. No writes.
|
|
5
|
-
*
|
|
6
|
-
* The "CONDUCTOR of workspace W" is resolved in precedence order:
|
|
7
|
-
* 1. The EARLIEST active-claim instance (from activeConductorClaims) that is
|
|
8
|
-
* also a live in-workspace candidate (WP-G1b — claim-based election).
|
|
9
|
-
* 2. (back-compat) A live candidate whose registration roles include
|
|
10
|
-
* "CONDUCTOR" (WP-G1a — role-based).
|
|
11
|
-
* 3. null (the common state: agents auto-register as AGENTS).
|
|
12
|
-
*/
|
|
13
|
-
import { canonicalAddress, listPresence } from "../local-files/index.js";
|
|
14
|
-
import { createLocalStore } from "../local-files/store.js";
|
|
15
|
-
import { activeConductorClaims } from "./claims.js";
|
|
16
|
-
/**
|
|
17
|
-
* Resolve the live conductor/owner of a workspace.
|
|
18
|
-
*
|
|
19
|
-
* Algorithm:
|
|
20
|
-
* 1. List all fresh presence records (90s freshness by default).
|
|
21
|
-
* 2. Retain sessions whose `workspace.id` matches the requested workspaceId
|
|
22
|
-
* (case-insensitive / slug-stable via canonicalAddress on both sides).
|
|
23
|
-
* 3. For each candidate, look up the registry to read its roles.
|
|
24
|
-
* 4. Read active conductor claims for the workspace.
|
|
25
|
-
* 5. conductor =
|
|
26
|
-
* a. The EARLIEST active-claim instance (by claim `at`) that is also a
|
|
27
|
-
* live in-workspace candidate (claim-based election, WP-G1b); OR
|
|
28
|
-
* b. (back-compat) the FIRST (by startedAt) live candidate whose roles
|
|
29
|
-
* include "CONDUCTOR" (role-based, WP-G1a); OR
|
|
30
|
-
* c. null.
|
|
31
|
-
* 6. claimedBy = the instance resolved via path (a), or null.
|
|
32
|
-
* 7. live = candidates.length > 0.
|
|
33
|
-
*/
|
|
34
|
-
export function conductorFor(opts) {
|
|
35
|
-
const { root, expiryMs, now } = opts;
|
|
36
|
-
const targetId = canonicalAddress(opts.workspaceId);
|
|
37
|
-
// Read live sessions
|
|
38
|
-
const sessions = listPresence(root, {
|
|
39
|
-
...(expiryMs !== undefined ? { expiryMs } : {}),
|
|
40
|
-
...(now !== undefined ? { now } : {})
|
|
41
|
-
});
|
|
42
|
-
// Filter to sessions in the target workspace
|
|
43
|
-
const inWorkspace = sessions.filter((s) => {
|
|
44
|
-
if (!s.workspace?.id)
|
|
45
|
-
return false;
|
|
46
|
-
return canonicalAddress(s.workspace.id) === targetId;
|
|
47
|
-
});
|
|
48
|
-
// Read registry lazily (only if there are candidates; avoids I/O on empty)
|
|
49
|
-
// Build a map: canonical(instance) → roles[]
|
|
50
|
-
const rolesMap = new Map();
|
|
51
|
-
if (inWorkspace.length > 0) {
|
|
52
|
-
try {
|
|
53
|
-
const store = createLocalStore({ root, allowVersionMismatch: true });
|
|
54
|
-
for (const reg of store.listInstances()) {
|
|
55
|
-
rolesMap.set(canonicalAddress(reg.id), reg.roles ?? []);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
catch {
|
|
59
|
-
// If the store is unreadable, proceed with empty roles
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
// Build candidates
|
|
63
|
-
const candidates = inWorkspace.map((s) => ({
|
|
64
|
-
instance: s.instance,
|
|
65
|
-
...(s.host !== undefined ? { host: s.host } : {}),
|
|
66
|
-
...(s.name !== undefined ? { name: s.name } : {}),
|
|
67
|
-
roles: rolesMap.get(canonicalAddress(s.instance)) ?? [],
|
|
68
|
-
startedAt: s.startedAt,
|
|
69
|
-
heartbeatAt: s.heartbeatAt
|
|
70
|
-
}));
|
|
71
|
-
// Build a set of live in-workspace instance canonical ids for quick lookup.
|
|
72
|
-
const liveSet = new Set(candidates.map((c) => canonicalAddress(c.instance)));
|
|
73
|
-
// 5a. Claim-based election: earliest active claim from a live candidate.
|
|
74
|
-
let conductor = null;
|
|
75
|
-
let claimedBy = null;
|
|
76
|
-
try {
|
|
77
|
-
const claims = activeConductorClaims(root, targetId);
|
|
78
|
-
for (const claim of claims) {
|
|
79
|
-
if (liveSet.has(canonicalAddress(claim.instance))) {
|
|
80
|
-
conductor = claim.instance;
|
|
81
|
-
claimedBy = claim.instance;
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
catch {
|
|
87
|
-
// If claims are unreadable, fall through to role-based resolution
|
|
88
|
-
}
|
|
89
|
-
// 5b. Role-based election (back-compat): earliest-startedAt with role CONDUCTOR.
|
|
90
|
-
if (conductor === null) {
|
|
91
|
-
const conductorCandidates = candidates
|
|
92
|
-
.filter((c) => c.roles.includes("CONDUCTOR"))
|
|
93
|
-
.sort((a, b) => a.startedAt.localeCompare(b.startedAt));
|
|
94
|
-
if (conductorCandidates.length > 0) {
|
|
95
|
-
conductor = conductorCandidates[0].instance;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return {
|
|
99
|
-
workspaceId: targetId,
|
|
100
|
-
conductor,
|
|
101
|
-
claimedBy,
|
|
102
|
-
candidates,
|
|
103
|
-
live: candidates.length > 0
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
//# sourceMappingURL=conductor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conductor.js","sourceRoot":"","sources":["../../../src/runtime/governance/conductor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAoDpD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,YAAY,CAAC,IAAyB;I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AM,CAAC;QACP,kEAAkE;IACpE,CAAC;IAED,iFAAiF;IACjF,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACvB,MAAM,mBAAmB,GAAG,UAAU;aACnC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;aAC5C,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;QAC1D,IAAI,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnC,SAAS,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC9C,CAAC;IACH,CAAC;IAED,OAAO;QACL,WAAW,EAAE,QAAQ;QACrB,SAAS;QACT,SAAS;QACT,UAAU;QACV,IAAI,EAAE,UAAU,CAAC,MAAM,GAAG,CAAC;KAC5B,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { conductorFor, type ConductorCandidate, type ConductorForOptions, type ConductorResolution } from "./conductor.js";
|
|
2
|
-
export { appendConductorClaim, listConductorClaims, activeConductorClaims, type ConductorClaimEvent } from "./claims.js";
|
|
3
|
-
export { recommendConductorLaunch, conductorLaunchCheck, type ConductorLaunchRecommendation, type ConductorLaunchCheckOpts, type ConductorLaunchCheckResult, type RecommendConductorLaunchOpts, type StalledItem } from "./launch-check.js";
|
|
4
|
-
export { recordSpawnRequest, lastSpawnRequestAt, spawnAllowed, type SpawnRequestEvent, type SpawnAllowedOpts } from "./spawns.js";
|
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/governance/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,mBAAmB,EACzB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,KAAK,6BAA6B,EAClC,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,4BAA4B,EACjC,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,EACZ,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACtB,MAAM,aAAa,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { conductorFor } from "./conductor.js";
|
|
2
|
-
export { appendConductorClaim, listConductorClaims, activeConductorClaims } from "./claims.js";
|
|
3
|
-
export { recommendConductorLaunch, conductorLaunchCheck } from "./launch-check.js";
|
|
4
|
-
export { recordSpawnRequest, lastSpawnRequestAt, spawnAllowed } from "./spawns.js";
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/governance/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAIb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EAEtB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EAMrB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,EAGb,MAAM,aAAa,CAAC"}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Governance D3 — Conductor Launch Check (DRY-RUN, read-only).
|
|
3
|
-
*
|
|
4
|
-
* h2a polls `track workspace-activity` and RECOMMENDS launching a conductor
|
|
5
|
-
* where work is durably stalled and no conductor is live.
|
|
6
|
-
*
|
|
7
|
-
* The module has two layers:
|
|
8
|
-
*
|
|
9
|
-
* 1. `recommendConductorLaunch` — pure function, no I/O. Derives the
|
|
10
|
-
* recommendation from two booleans: whether a conductor is already live and
|
|
11
|
-
* how many stalled items were found.
|
|
12
|
-
*
|
|
13
|
-
* 2. `conductorLaunchCheck` — the I/O gatherer. Calls `track
|
|
14
|
-
* workspace-activity`, calls `conductorFor`, computes the recommendation,
|
|
15
|
-
* and returns a single result object. Never writes, never spawns.
|
|
16
|
-
*
|
|
17
|
-
* IMPORTANT — DRY-RUN policy
|
|
18
|
-
* --------------------------
|
|
19
|
-
* h2a does NOT spawn anything. A `recommendation === "launch"` output is
|
|
20
|
-
* purely advisory. The actual conductor launch is **parked** pending a
|
|
21
|
-
* spawn-policy decision and remote-trigger support.
|
|
22
|
-
*/
|
|
23
|
-
export interface RecommendConductorLaunchOpts {
|
|
24
|
-
/** true when conductorFor returned a non-null conductor that is live. */
|
|
25
|
-
readonly conductorLive: boolean;
|
|
26
|
-
/** Number of stalled items returned by track workspace-activity. */
|
|
27
|
-
readonly stalledCount: number;
|
|
28
|
-
}
|
|
29
|
-
export interface ConductorLaunchRecommendation {
|
|
30
|
-
/** "launch" = h2a recommends someone starts a conductor; "none" = no action needed. */
|
|
31
|
-
readonly recommendation: "launch" | "none";
|
|
32
|
-
/** Human-readable reason behind the recommendation. */
|
|
33
|
-
readonly reason: string;
|
|
34
|
-
/** Preferred host order for the launch (only present when recommendation === "launch"). */
|
|
35
|
-
readonly suggestedHosts?: string[];
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Pure function: derive a conductor-launch recommendation from pre-gathered
|
|
39
|
-
* facts. No I/O.
|
|
40
|
-
*
|
|
41
|
-
* Rules (in precedence order):
|
|
42
|
-
* 1. conductorLive === true → none (a live conductor already owns the workspace).
|
|
43
|
-
* 2. conductorLive === false AND stalledCount > 0 → launch.
|
|
44
|
-
* 3. else → none (no stalled work detected).
|
|
45
|
-
*/
|
|
46
|
-
export declare function recommendConductorLaunch(opts: RecommendConductorLaunchOpts): ConductorLaunchRecommendation;
|
|
47
|
-
export interface StalledItem {
|
|
48
|
-
readonly id?: string;
|
|
49
|
-
readonly title?: string;
|
|
50
|
-
readonly reason?: string;
|
|
51
|
-
readonly since?: string;
|
|
52
|
-
}
|
|
53
|
-
export interface ConductorLaunchCheckOpts {
|
|
54
|
-
/** h2a store root (the `.h2a` directory). */
|
|
55
|
-
readonly root: string;
|
|
56
|
-
/** Workspace id in `ws:<uuid>` form. */
|
|
57
|
-
readonly workspaceId: string;
|
|
58
|
-
/** Idle threshold passed to `track workspace-activity --idle-ms`. Default 86400000 (24h). */
|
|
59
|
-
readonly idleMs?: number;
|
|
60
|
-
/** Override `Date.now()` for test determinism. */
|
|
61
|
-
readonly now?: () => number;
|
|
62
|
-
/**
|
|
63
|
-
* Injectable replacement for the real `track workspace-activity` call.
|
|
64
|
-
* When absent, the default implementation runs the `track` binary.
|
|
65
|
-
* Return `undefined` to signal that track is unavailable / errored.
|
|
66
|
-
*/
|
|
67
|
-
readonly runTrackActivity?: (workspaceId: string, idleMs: number) => {
|
|
68
|
-
pending: number;
|
|
69
|
-
stalled: StalledItem[];
|
|
70
|
-
latestEventAt?: string;
|
|
71
|
-
} | undefined;
|
|
72
|
-
}
|
|
73
|
-
export interface ConductorLaunchCheckResult {
|
|
74
|
-
readonly workspaceId: string;
|
|
75
|
-
/** false when track is absent or errored (graceful degradation). */
|
|
76
|
-
readonly trackAvailable: boolean;
|
|
77
|
-
/** The live conductor instance id, or null. */
|
|
78
|
-
readonly conductor: string | null;
|
|
79
|
-
readonly conductorLive: boolean;
|
|
80
|
-
readonly pending: number;
|
|
81
|
-
readonly stalled: StalledItem[];
|
|
82
|
-
readonly latestEventAt?: string;
|
|
83
|
-
readonly recommendation: "launch" | "none";
|
|
84
|
-
readonly reason: string;
|
|
85
|
-
readonly suggestedHosts?: string[];
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Gather all facts and derive a conductor-launch recommendation.
|
|
89
|
-
*
|
|
90
|
-
* Read-only: no writes, no spawns.
|
|
91
|
-
*/
|
|
92
|
-
export declare function conductorLaunchCheck(opts: ConductorLaunchCheckOpts): ConductorLaunchCheckResult;
|
|
93
|
-
//# sourceMappingURL=launch-check.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"launch-check.d.ts","sourceRoot":"","sources":["../../../src/runtime/governance/launch-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AASH,MAAM,WAAW,4BAA4B;IAC3C,yEAAyE;IACzE,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,oEAAoE;IACpE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,6BAA6B;IAC5C,uFAAuF;IACvF,QAAQ,CAAC,cAAc,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC3C,uDAAuD;IACvD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,2FAA2F;IAC3F,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CACpC;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,4BAA4B,GACjC,6BAA6B,CAsB/B;AAMD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAMD,MAAM,WAAW,wBAAwB;IACvC,6CAA6C;IAC7C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,wCAAwC;IACxC,QAAQ,CAAC,WAA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