@sentropic/h2a-cli 0.75.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 -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,248 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Default (real-filesystem) `ProviderSessionReaders` for the identity resolver
|
|
3
|
-
* (DEC-116). Every reader is **best-effort + total**: any missing file, format
|
|
4
|
-
* drift, or parse error yields `undefined`, so the resolver degrades to
|
|
5
|
-
* `{ source: "none" }` and the caller mints a keypair-anchored id (never throws,
|
|
6
|
-
* never blocks connect). The transcript layouts were live-verified 2026-05-30
|
|
7
|
-
* (gemini's path layout drifts across versions — we match on `.project_root`).
|
|
8
|
-
*/
|
|
9
|
-
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
10
|
-
import { homedir } from "node:os";
|
|
11
|
-
import { join } from "node:path";
|
|
12
|
-
/** First newline-delimited line of a (possibly large) file, decoded best-effort. */
|
|
13
|
-
function firstLine(path) {
|
|
14
|
-
return readFileSync(path, "utf8").split("\n", 1)[0] ?? "";
|
|
15
|
-
}
|
|
16
|
-
function newestFirst(paths) {
|
|
17
|
-
return paths
|
|
18
|
-
.map((p) => {
|
|
19
|
-
try {
|
|
20
|
-
return { p, m: statSync(p).mtimeMs };
|
|
21
|
-
}
|
|
22
|
-
catch {
|
|
23
|
-
return { p, m: 0 };
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
.sort((a, b) => b.m - a.m)
|
|
27
|
-
.map((x) => x.p);
|
|
28
|
-
}
|
|
29
|
-
function codexThreadForCwd(cwd) {
|
|
30
|
-
try {
|
|
31
|
-
const base = join(homedir(), ".codex", "sessions");
|
|
32
|
-
if (!existsSync(base))
|
|
33
|
-
return undefined;
|
|
34
|
-
const files = [];
|
|
35
|
-
const walk = (dir) => {
|
|
36
|
-
for (const e of readdirSync(dir, { withFileTypes: true })) {
|
|
37
|
-
const p = join(dir, e.name);
|
|
38
|
-
if (e.isDirectory())
|
|
39
|
-
walk(p);
|
|
40
|
-
else if (e.name.endsWith(".jsonl"))
|
|
41
|
-
files.push(p);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
walk(base);
|
|
45
|
-
for (const f of newestFirst(files).slice(0, 100)) {
|
|
46
|
-
try {
|
|
47
|
-
const rec = JSON.parse(firstLine(f));
|
|
48
|
-
const payload = rec.session_meta?.payload ?? rec.payload;
|
|
49
|
-
if (payload && payload.cwd === cwd && typeof payload.id === "string")
|
|
50
|
-
return payload.id;
|
|
51
|
-
}
|
|
52
|
-
catch {
|
|
53
|
-
// skip malformed rollout
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
58
|
-
catch {
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
function geminiSessionForCwd(cwd) {
|
|
63
|
-
try {
|
|
64
|
-
const base = join(homedir(), ".gemini", "tmp");
|
|
65
|
-
if (!existsSync(base))
|
|
66
|
-
return undefined;
|
|
67
|
-
for (const e of readdirSync(base, { withFileTypes: true })) {
|
|
68
|
-
if (!e.isDirectory())
|
|
69
|
-
continue;
|
|
70
|
-
const dir = join(base, e.name);
|
|
71
|
-
try {
|
|
72
|
-
if (readFileSync(join(dir, ".project_root"), "utf8").trim() !== cwd)
|
|
73
|
-
continue;
|
|
74
|
-
const chats = join(dir, "chats");
|
|
75
|
-
if (!existsSync(chats))
|
|
76
|
-
continue;
|
|
77
|
-
const sessions = readdirSync(chats).filter((n) => n.startsWith("session-") && n.endsWith(".jsonl"));
|
|
78
|
-
if (sessions.length === 0)
|
|
79
|
-
continue;
|
|
80
|
-
const newest = newestFirst(sessions.map((n) => join(chats, n)))[0];
|
|
81
|
-
const rec = JSON.parse(firstLine(newest));
|
|
82
|
-
if (typeof rec.sessionId === "string")
|
|
83
|
-
return rec.sessionId;
|
|
84
|
-
}
|
|
85
|
-
catch {
|
|
86
|
-
// try the next tmp dir
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return undefined;
|
|
90
|
-
}
|
|
91
|
-
catch {
|
|
92
|
-
return undefined;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
function agyConversationForCwd(cwd) {
|
|
96
|
-
try {
|
|
97
|
-
const f = join(homedir(), ".gemini", "antigravity-cli", "cache", "last_conversations.json");
|
|
98
|
-
if (!existsSync(f))
|
|
99
|
-
return undefined;
|
|
100
|
-
const map = JSON.parse(readFileSync(f, "utf8"));
|
|
101
|
-
const v = map && typeof map === "object" ? map[cwd] : undefined;
|
|
102
|
-
return typeof v === "string" ? v : undefined;
|
|
103
|
-
}
|
|
104
|
-
catch {
|
|
105
|
-
return undefined;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
export const defaultProviderSessionReaders = {
|
|
109
|
-
env: (name) => process.env[name],
|
|
110
|
-
codexThreadForCwd,
|
|
111
|
-
geminiSessionForCwd,
|
|
112
|
-
agyConversationForCwd
|
|
113
|
-
};
|
|
114
|
-
export const defaultHostNameReaders = {
|
|
115
|
-
readLines(path, maxLines) {
|
|
116
|
-
try {
|
|
117
|
-
const raw = readFileSync(path, "utf8");
|
|
118
|
-
return raw.split("\n").slice(0, maxLines);
|
|
119
|
-
}
|
|
120
|
-
catch {
|
|
121
|
-
return [];
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
readCodexSessionIndex() {
|
|
125
|
-
try {
|
|
126
|
-
const f = join(homedir(), ".codex", "session_index.jsonl");
|
|
127
|
-
const raw = readFileSync(f, "utf8");
|
|
128
|
-
return raw.split("\n");
|
|
129
|
-
}
|
|
130
|
-
catch {
|
|
131
|
-
return [];
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
homedir() {
|
|
135
|
-
return homedir();
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
/**
|
|
139
|
-
* Read the host-native session name for the given session.
|
|
140
|
-
*
|
|
141
|
-
* - **claude**: reads the transcript JSONL (located via the CLAUDE_CODE_SESSION_ID
|
|
142
|
-
* resolver); scans the first 40 lines for `customTitle` (user rename) first,
|
|
143
|
-
* then falls back to `agentName`. Never returns `aiTitle`.
|
|
144
|
-
* - **codex**: reads `~/.codex/session_index.jsonl`; returns `thread_name` for
|
|
145
|
-
* the entry whose `id === sessionId` (last-match wins).
|
|
146
|
-
* - Other hosts: returns undefined.
|
|
147
|
-
*
|
|
148
|
-
* Always best-effort (returns undefined on any parse/IO error).
|
|
149
|
-
*/
|
|
150
|
-
export function readHostSessionName(opts) {
|
|
151
|
-
const { host, cwd, sessionId } = opts;
|
|
152
|
-
const readers = opts.readers ?? defaultHostNameReaders;
|
|
153
|
-
try {
|
|
154
|
-
if (host === "claude") {
|
|
155
|
-
return readClaudeSessionName(cwd, sessionId, readers);
|
|
156
|
-
}
|
|
157
|
-
if (host === "codex") {
|
|
158
|
-
return readCodexSessionName(sessionId, readers);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
catch {
|
|
162
|
-
// best-effort
|
|
163
|
-
}
|
|
164
|
-
return undefined;
|
|
165
|
-
}
|
|
166
|
-
function findClaudeTranscript(cwd, sessionId, home = homedir()) {
|
|
167
|
-
// Claude Code transcript: ~/.claude/projects/<hash>/<session-id>.jsonl
|
|
168
|
-
// The resolver already locates it via CLAUDE_CODE_SESSION_ID → env reader.
|
|
169
|
-
// Here we use the same scan: look under ~/.claude/projects/ for a file named <sessionId>.jsonl
|
|
170
|
-
try {
|
|
171
|
-
const projectsBase = join(home, ".claude", "projects");
|
|
172
|
-
if (!existsSync(projectsBase))
|
|
173
|
-
return undefined;
|
|
174
|
-
const projectDirs = readdirSync(projectsBase);
|
|
175
|
-
for (const proj of projectDirs) {
|
|
176
|
-
const projDir = join(projectsBase, proj);
|
|
177
|
-
// Filter to directories to avoid stat issues
|
|
178
|
-
try {
|
|
179
|
-
const entries = readdirSync(projDir);
|
|
180
|
-
for (const entry of entries) {
|
|
181
|
-
if (sessionId && entry === `${sessionId}.jsonl`) {
|
|
182
|
-
return join(projDir, entry);
|
|
183
|
-
}
|
|
184
|
-
// Fallback: if no sessionId, look for the newest .jsonl in the project matching cwd
|
|
185
|
-
// We skip the fallback to keep things simple and correct.
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
catch {
|
|
189
|
-
// skip
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
return undefined;
|
|
193
|
-
}
|
|
194
|
-
catch {
|
|
195
|
-
return undefined;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
function readClaudeSessionName(cwd, sessionId, readers) {
|
|
199
|
-
if (!sessionId)
|
|
200
|
-
return undefined;
|
|
201
|
-
const transcriptPath = findClaudeTranscript(cwd, sessionId, readers.homedir());
|
|
202
|
-
if (!transcriptPath)
|
|
203
|
-
return undefined;
|
|
204
|
-
const lines = readers.readLines(transcriptPath, 40);
|
|
205
|
-
let customTitle;
|
|
206
|
-
let agentName;
|
|
207
|
-
for (const line of lines) {
|
|
208
|
-
const trimmed = line.trim();
|
|
209
|
-
if (!trimmed)
|
|
210
|
-
continue;
|
|
211
|
-
try {
|
|
212
|
-
const obj = JSON.parse(trimmed);
|
|
213
|
-
if (typeof obj.customTitle === "string" && obj.customTitle.length > 0) {
|
|
214
|
-
customTitle = obj.customTitle;
|
|
215
|
-
break; // prefer first customTitle found
|
|
216
|
-
}
|
|
217
|
-
if (!agentName && typeof obj.agentName === "string" && obj.agentName.length > 0) {
|
|
218
|
-
agentName = obj.agentName;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
catch {
|
|
222
|
-
// skip malformed lines
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
return customTitle ?? agentName;
|
|
226
|
-
}
|
|
227
|
-
function readCodexSessionName(sessionId, readers) {
|
|
228
|
-
if (!sessionId)
|
|
229
|
-
return undefined;
|
|
230
|
-
const lines = readers.readCodexSessionIndex();
|
|
231
|
-
let lastMatch;
|
|
232
|
-
for (const line of lines) {
|
|
233
|
-
const trimmed = line.trim();
|
|
234
|
-
if (!trimmed)
|
|
235
|
-
continue;
|
|
236
|
-
try {
|
|
237
|
-
const obj = JSON.parse(trimmed);
|
|
238
|
-
if (obj.id === sessionId && typeof obj.thread_name === "string" && obj.thread_name.length > 0) {
|
|
239
|
-
lastMatch = obj.thread_name;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
catch {
|
|
243
|
-
// skip
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
return lastMatch;
|
|
247
|
-
}
|
|
248
|
-
//# sourceMappingURL=readers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"readers.js","sourceRoot":"","sources":["../../../src/runtime/identity/readers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,oFAAoF;AACpF,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC5D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AAoB,CAC3B,SAA6B,EAC7B,OAAwB;IAExB,IAAI,CAAC,SAAS;QAAE,OAAO,SAAS,CAAC;IACjC,MAAM,KAAK,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAC9C,IAAI,SAA6B,CAAC;IAClC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,OAAO;YAAE,SAAS;QACvB,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAA4B,CAAC;YAC3D,IAAI,GAAG,CAAC,EAAE,KAAK,SAAS,IAAI,OAAO,GAAG,CAAC,WAAW,KAAK,QAAQ,IAAI,GAAG,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC9F,SAAS,GAAG,GAAG,CAAC,WAAW,CAAC;YAC9B,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;QACT,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent-identity fix (DEC-116) — provider session resolver.
|
|
3
|
-
*
|
|
4
|
-
* The reconnect de-collision binds `(host, providerSessionId, workspaceId)` →
|
|
5
|
-
* agentUuid. This module produces the **providerSessionId hint** for the host
|
|
6
|
-
* the agent runs under. It is only a *routing hint*; the authority anchor is the
|
|
7
|
-
* ed25519 key (proof-of-possession), not this string (see the spec, F1).
|
|
8
|
-
*
|
|
9
|
-
* Per-provider source (live-verified, 2026-05-30):
|
|
10
|
-
* - claude → `env.CLAUDE_CODE_SESSION_ID` (inherited by the spawned MCP server).
|
|
11
|
-
* - remote → the `@sentropic/remote` bridge injects `env.SESSION_ID` +
|
|
12
|
-
* `env.SESSION_WORKSPACE_ID` (authoritative, Pod-scoped).
|
|
13
|
-
* - codex / gemini / agy → NOT in the env; read the provider's on-disk
|
|
14
|
-
* transcript/cache, matched by cwd (codex rollout `payload.cwd`, gemini
|
|
15
|
-
* `.project_root`, agy `last_conversations.json`).
|
|
16
|
-
* - none found → `{ source: "none" }`; the caller mints a UUID keyed by the
|
|
17
|
-
* agent's keypair fingerprint (so reconnect-same-key reclaims, new-key mints).
|
|
18
|
-
*
|
|
19
|
-
* The per-host *dispatch* is pure and tested with injected `readers`; the real
|
|
20
|
-
* filesystem scans live in `defaultProviderSessionReaders`.
|
|
21
|
-
*/
|
|
22
|
-
export type ProviderSessionSource = "env" | "bridge" | "transcript" | "none";
|
|
23
|
-
export interface ProviderSession {
|
|
24
|
-
readonly providerSessionId?: string;
|
|
25
|
-
readonly source: ProviderSessionSource;
|
|
26
|
-
/** A workspace hint the host supplies authoritatively (only the bridge today). */
|
|
27
|
-
readonly workspaceHint?: string;
|
|
28
|
-
}
|
|
29
|
-
/** I/O the resolver needs — injected so the dispatch is testable without a real FS. */
|
|
30
|
-
export interface ProviderSessionReaders {
|
|
31
|
-
env(name: string): string | undefined;
|
|
32
|
-
/** codex: newest `~/.codex/sessions/**` rollout whose `payload.cwd === cwd` → `payload.id`. */
|
|
33
|
-
codexThreadForCwd(cwd: string): string | undefined;
|
|
34
|
-
/** gemini: `~/.gemini/tmp/<dir>/.project_root === cwd` → that session's `sessionId`. */
|
|
35
|
-
geminiSessionForCwd(cwd: string): string | undefined;
|
|
36
|
-
/** agy: `~/.gemini/antigravity-cli/cache/last_conversations.json` map `cwd → uuid`. */
|
|
37
|
-
agyConversationForCwd(cwd: string): string | undefined;
|
|
38
|
-
}
|
|
39
|
-
export interface ResolveProviderSessionInput {
|
|
40
|
-
readonly host: string;
|
|
41
|
-
readonly cwd: string;
|
|
42
|
-
readonly readers: ProviderSessionReaders;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Resolve the provider's native session id for `host` (a routing hint for
|
|
46
|
-
* de-collision). Total — never throws; an unknown host or an absent source
|
|
47
|
-
* yields `{ source: "none" }`.
|
|
48
|
-
*/
|
|
49
|
-
export declare function resolveProviderSession(input: ResolveProviderSessionInput): ProviderSession;
|
|
50
|
-
//# sourceMappingURL=resolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../../src/runtime/identity/resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,MAAM,qBAAqB,GAAG,KAAK,GAAG,QAAQ,GAAG,YAAY,GAAG,MAAM,CAAC;AAE7E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,kFAAkF;IAClF,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,uFAAuF;AACvF,MAAM,WAAW,sBAAsB;IACrC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACtC,+FAA+F;IAC/F,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACnD,wFAAwF;IACxF,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACrD,uFAAuF;IACvF,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACxD;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;CAC1C;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,GAAG,eAAe,CAgC1F"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent-identity fix (DEC-116) — provider session resolver.
|
|
3
|
-
*
|
|
4
|
-
* The reconnect de-collision binds `(host, providerSessionId, workspaceId)` →
|
|
5
|
-
* agentUuid. This module produces the **providerSessionId hint** for the host
|
|
6
|
-
* the agent runs under. It is only a *routing hint*; the authority anchor is the
|
|
7
|
-
* ed25519 key (proof-of-possession), not this string (see the spec, F1).
|
|
8
|
-
*
|
|
9
|
-
* Per-provider source (live-verified, 2026-05-30):
|
|
10
|
-
* - claude → `env.CLAUDE_CODE_SESSION_ID` (inherited by the spawned MCP server).
|
|
11
|
-
* - remote → the `@sentropic/remote` bridge injects `env.SESSION_ID` +
|
|
12
|
-
* `env.SESSION_WORKSPACE_ID` (authoritative, Pod-scoped).
|
|
13
|
-
* - codex / gemini / agy → NOT in the env; read the provider's on-disk
|
|
14
|
-
* transcript/cache, matched by cwd (codex rollout `payload.cwd`, gemini
|
|
15
|
-
* `.project_root`, agy `last_conversations.json`).
|
|
16
|
-
* - none found → `{ source: "none" }`; the caller mints a UUID keyed by the
|
|
17
|
-
* agent's keypair fingerprint (so reconnect-same-key reclaims, new-key mints).
|
|
18
|
-
*
|
|
19
|
-
* The per-host *dispatch* is pure and tested with injected `readers`; the real
|
|
20
|
-
* filesystem scans live in `defaultProviderSessionReaders`.
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* Resolve the provider's native session id for `host` (a routing hint for
|
|
24
|
-
* de-collision). Total — never throws; an unknown host or an absent source
|
|
25
|
-
* yields `{ source: "none" }`.
|
|
26
|
-
*/
|
|
27
|
-
export function resolveProviderSession(input) {
|
|
28
|
-
const { host, cwd, readers } = input;
|
|
29
|
-
switch (host) {
|
|
30
|
-
case "claude": {
|
|
31
|
-
const id = readers.env("CLAUDE_CODE_SESSION_ID");
|
|
32
|
-
return id ? { providerSessionId: id, source: "env" } : { source: "none" };
|
|
33
|
-
}
|
|
34
|
-
case "remote": {
|
|
35
|
-
const id = readers.env("SESSION_ID");
|
|
36
|
-
const ws = readers.env("SESSION_WORKSPACE_ID");
|
|
37
|
-
if (!id)
|
|
38
|
-
return { source: "none" };
|
|
39
|
-
return {
|
|
40
|
-
providerSessionId: id,
|
|
41
|
-
source: "bridge",
|
|
42
|
-
...(ws ? { workspaceHint: ws } : {})
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
case "codex": {
|
|
46
|
-
const id = readers.codexThreadForCwd(cwd);
|
|
47
|
-
return id ? { providerSessionId: id, source: "transcript" } : { source: "none" };
|
|
48
|
-
}
|
|
49
|
-
case "gemini": {
|
|
50
|
-
const id = readers.geminiSessionForCwd(cwd);
|
|
51
|
-
return id ? { providerSessionId: id, source: "transcript" } : { source: "none" };
|
|
52
|
-
}
|
|
53
|
-
case "agy": {
|
|
54
|
-
const id = readers.agyConversationForCwd(cwd);
|
|
55
|
-
return id ? { providerSessionId: id, source: "transcript" } : { source: "none" };
|
|
56
|
-
}
|
|
57
|
-
default:
|
|
58
|
-
return { source: "none" };
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=resolver.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../../src/runtime/identity/resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA4BH;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAkC;IACvE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IACrC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;YACjD,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAC5E,CAAC;QACD,KAAK,QAAQ,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M,EAAE,MAAM,EAAE,CAAC;IAC9B,CAAC;AACH,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Durable, path/machine-independent workspace id derived from git history.
|
|
3
|
-
*
|
|
4
|
-
* DESIGN:
|
|
5
|
-
* - The pure function `computeDurableWorkspaceId` is I/O-free and unit-testable
|
|
6
|
-
* with no filesystem dependency.
|
|
7
|
-
* - The I/O function `durableWorkspaceId` runs git commands (execFileSync) and
|
|
8
|
-
* returns undefined on any error (git absent / not a repo / command failure).
|
|
9
|
-
* - The core package (@sentropic/h2a) stays pure — no git/fs is added there.
|
|
10
|
-
*
|
|
11
|
-
* DERIVATION (pinned with track):
|
|
12
|
-
* workspaceId = "ws:" + sha256hex( rootCommitSHA + "\n" + worktreeRelPath )
|
|
13
|
-
*
|
|
14
|
-
* rootCommitSHA : all root commits from `git rev-list --max-parents=0 HEAD`,
|
|
15
|
-
* sorted ascending, joined with ",". Invariant across
|
|
16
|
-
* clones / paths / machines.
|
|
17
|
-
*
|
|
18
|
-
* worktreeRelPath: "" for the main worktree; the worktree NAME (basename of
|
|
19
|
-
* the .git/worktrees/<name> dir) for a linked worktree.
|
|
20
|
-
* Contains no absolute path.
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* Compute the durable workspace id from pre-fetched git values.
|
|
24
|
-
*
|
|
25
|
-
* @param rootCommitSHA All root commit SHAs, sorted ascending, joined with ","
|
|
26
|
-
* (single root is the single SHA).
|
|
27
|
-
* @param worktreeRelPath "" for the main worktree; the worktree name for a
|
|
28
|
-
* linked worktree.
|
|
29
|
-
* @returns "ws:" + sha256hex(rootCommitSHA + "\n" + worktreeRelPath)
|
|
30
|
-
*/
|
|
31
|
-
export declare function computeDurableWorkspaceId(rootCommitSHA: string, worktreeRelPath: string): string;
|
|
32
|
-
/**
|
|
33
|
-
* Run git commands to derive the durable workspace id for `cwd`.
|
|
34
|
-
*
|
|
35
|
-
* Returns `undefined` if:
|
|
36
|
-
* - git is unavailable (git not installed, PATH issue, Windows no-git)
|
|
37
|
-
* - `cwd` is not inside a git repository
|
|
38
|
-
* - any git command fails for any reason
|
|
39
|
-
*
|
|
40
|
-
* On success returns `computeDurableWorkspaceId(rootCommitSHA, worktreeRelPath)`.
|
|
41
|
-
*/
|
|
42
|
-
export declare function durableWorkspaceId(cwd: string): string | undefined;
|
|
43
|
-
//# sourceMappingURL=workspace-id.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-id.d.ts","sourceRoot":"","sources":["../../../src/runtime/identity/workspace-id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAWH;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,MAAM,EACrB,eAAe,EAAE,MAAM,GACtB,MAAM,CAIR;AAMD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAiGlE"}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Durable, path/machine-independent workspace id derived from git history.
|
|
3
|
-
*
|
|
4
|
-
* DESIGN:
|
|
5
|
-
* - The pure function `computeDurableWorkspaceId` is I/O-free and unit-testable
|
|
6
|
-
* with no filesystem dependency.
|
|
7
|
-
* - The I/O function `durableWorkspaceId` runs git commands (execFileSync) and
|
|
8
|
-
* returns undefined on any error (git absent / not a repo / command failure).
|
|
9
|
-
* - The core package (@sentropic/h2a) stays pure — no git/fs is added there.
|
|
10
|
-
*
|
|
11
|
-
* DERIVATION (pinned with track):
|
|
12
|
-
* workspaceId = "ws:" + sha256hex( rootCommitSHA + "\n" + worktreeRelPath )
|
|
13
|
-
*
|
|
14
|
-
* rootCommitSHA : all root commits from `git rev-list --max-parents=0 HEAD`,
|
|
15
|
-
* sorted ascending, joined with ",". Invariant across
|
|
16
|
-
* clones / paths / machines.
|
|
17
|
-
*
|
|
18
|
-
* worktreeRelPath: "" for the main worktree; the worktree NAME (basename of
|
|
19
|
-
* the .git/worktrees/<name> dir) for a linked worktree.
|
|
20
|
-
* Contains no absolute path.
|
|
21
|
-
*/
|
|
22
|
-
import { createHash } from "node:crypto";
|
|
23
|
-
import { execFileSync } from "node:child_process";
|
|
24
|
-
import { realpathSync } from "node:fs";
|
|
25
|
-
import { basename } from "node:path";
|
|
26
|
-
// ---------------------------------------------------------------------------
|
|
27
|
-
// Pure (unit-testable, no I/O)
|
|
28
|
-
// ---------------------------------------------------------------------------
|
|
29
|
-
/**
|
|
30
|
-
* Compute the durable workspace id from pre-fetched git values.
|
|
31
|
-
*
|
|
32
|
-
* @param rootCommitSHA All root commit SHAs, sorted ascending, joined with ","
|
|
33
|
-
* (single root is the single SHA).
|
|
34
|
-
* @param worktreeRelPath "" for the main worktree; the worktree name for a
|
|
35
|
-
* linked worktree.
|
|
36
|
-
* @returns "ws:" + sha256hex(rootCommitSHA + "\n" + worktreeRelPath)
|
|
37
|
-
*/
|
|
38
|
-
export function computeDurableWorkspaceId(rootCommitSHA, worktreeRelPath) {
|
|
39
|
-
const payload = rootCommitSHA + "\n" + worktreeRelPath;
|
|
40
|
-
const hash = createHash("sha256").update(payload, "utf8").digest("hex");
|
|
41
|
-
return "ws:" + hash;
|
|
42
|
-
}
|
|
43
|
-
// ---------------------------------------------------------------------------
|
|
44
|
-
// I/O (git commands, never throws)
|
|
45
|
-
// ---------------------------------------------------------------------------
|
|
46
|
-
/**
|
|
47
|
-
* Run git commands to derive the durable workspace id for `cwd`.
|
|
48
|
-
*
|
|
49
|
-
* Returns `undefined` if:
|
|
50
|
-
* - git is unavailable (git not installed, PATH issue, Windows no-git)
|
|
51
|
-
* - `cwd` is not inside a git repository
|
|
52
|
-
* - any git command fails for any reason
|
|
53
|
-
*
|
|
54
|
-
* On success returns `computeDurableWorkspaceId(rootCommitSHA, worktreeRelPath)`.
|
|
55
|
-
*/
|
|
56
|
-
export function durableWorkspaceId(cwd) {
|
|
57
|
-
// Resolve the real path for the git -C argument, but don't propagate errors.
|
|
58
|
-
let resolvedCwd;
|
|
59
|
-
try {
|
|
60
|
-
resolvedCwd = realpathSync(cwd);
|
|
61
|
-
}
|
|
62
|
-
catch {
|
|
63
|
-
resolvedCwd = cwd;
|
|
64
|
-
}
|
|
65
|
-
// Git spawn options: inherit nothing from the calling process's I/O,
|
|
66
|
-
// never hang on stdin, and use a generous but finite timeout (5 s).
|
|
67
|
-
const spawnOpts = {
|
|
68
|
-
cwd: resolvedCwd,
|
|
69
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
70
|
-
timeout: 5000,
|
|
71
|
-
windowsHide: true
|
|
72
|
-
};
|
|
73
|
-
// --- rootCommitSHA -------------------------------------------------------
|
|
74
|
-
let rootCommitSHA;
|
|
75
|
-
try {
|
|
76
|
-
const raw = execFileSync("git", ["-C", resolvedCwd, "rev-list", "--max-parents=0", "HEAD"], spawnOpts)
|
|
77
|
-
.toString("utf8")
|
|
78
|
-
.trim();
|
|
79
|
-
if (!raw)
|
|
80
|
-
return undefined;
|
|
81
|
-
// Sort ascending so multiple root commits (shallow octopus merges) are
|
|
82
|
-
// deterministic regardless of the output order.
|
|
83
|
-
const lines = raw.split(/\r?\n/).filter(Boolean).sort();
|
|
84
|
-
rootCommitSHA = lines.join(",");
|
|
85
|
-
}
|
|
86
|
-
catch {
|
|
87
|
-
return undefined;
|
|
88
|
-
}
|
|
89
|
-
// --- worktreeRelPath -----------------------------------------------------
|
|
90
|
-
let worktreeRelPath;
|
|
91
|
-
try {
|
|
92
|
-
// git-dir is the effective .git directory (or .git/worktrees/<name> for a
|
|
93
|
-
// linked worktree).
|
|
94
|
-
const gitDir = execFileSync("git", ["-C", resolvedCwd, "rev-parse", "--git-dir"], spawnOpts)
|
|
95
|
-
.toString("utf8")
|
|
96
|
-
.trim();
|
|
97
|
-
// git-common-dir is always the top-level .git directory (same as git-dir
|
|
98
|
-
// for the main worktree).
|
|
99
|
-
const gitCommonDir = execFileSync("git", ["-C", resolvedCwd, "rev-parse", "--git-common-dir"], spawnOpts)
|
|
100
|
-
.toString("utf8")
|
|
101
|
-
.trim();
|
|
102
|
-
// Resolve both to real (absolute) paths before comparing; git may return
|
|
103
|
-
// relative paths such as ".git".
|
|
104
|
-
let resolvedGitDir;
|
|
105
|
-
let resolvedCommonDir;
|
|
106
|
-
try {
|
|
107
|
-
resolvedGitDir = realpathSync(gitDir.startsWith("/") || /^[A-Za-z]:[\\/]/.test(gitDir)
|
|
108
|
-
? gitDir
|
|
109
|
-
: `${resolvedCwd}/${gitDir}`);
|
|
110
|
-
}
|
|
111
|
-
catch {
|
|
112
|
-
resolvedGitDir = gitDir;
|
|
113
|
-
}
|
|
114
|
-
try {
|
|
115
|
-
resolvedCommonDir = realpathSync(gitCommonDir.startsWith("/") || /^[A-Za-z]:[\\/]/.test(gitCommonDir)
|
|
116
|
-
? gitCommonDir
|
|
117
|
-
: `${resolvedCwd}/${gitCommonDir}`);
|
|
118
|
-
}
|
|
119
|
-
catch {
|
|
120
|
-
resolvedCommonDir = gitCommonDir;
|
|
121
|
-
}
|
|
122
|
-
if (resolvedGitDir === resolvedCommonDir) {
|
|
123
|
-
// Main worktree — no relative path embedded.
|
|
124
|
-
worktreeRelPath = "";
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
// Linked worktree: .git/worktrees/<name>
|
|
128
|
-
// basename of resolvedGitDir is the worktree name, which is stable and
|
|
129
|
-
// contains no absolute path.
|
|
130
|
-
worktreeRelPath = basename(resolvedGitDir);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
catch {
|
|
134
|
-
return undefined;
|
|
135
|
-
}
|
|
136
|
-
return computeDurableWorkspaceId(rootCommitSHA, worktreeRelPath);
|
|
137
|
-
}
|
|
138
|
-
//# sourceMappingURL=workspace-id.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-id.js","sourceRoot":"","sources":["../../../src/runtime/identity/workspace-id.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M,CAAC;QAC1B,CAAC;QACD,IAAI,CAAC;YACH,iBAAiB,GAAG,YAAY,CAC9B,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,iBAAiB,CAAC,IAAI,CAAC,YAAY,CAAC;gBAClE,CAAC,CAAC,YAAY;gBACd,CAAC,CAAC,GAAG,WAAW,IAAI,YAAY,EAAE,CACrC,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,iBAAiB,GAAG,YAAY,CAAC;QACnC,CAAC;QAED,IAAI,cAAc,KAAK,iBAAiB,EAAE,CAAC;YACzC,6CAA6C;YAC7C,eAAe,GAAG,EAAE,CAAC;QACvB,CAAC;aAAM,CAAC;YACN,yCAAyC;YACzC,uEAAuE;YACvE,6BAA6B;YAC7B,eAAe,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,yBAAyB,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { assertHostQualifiedAddress, canonicalAddress, inboxDir, inboxDirRaw, isHostQualifiedAddress, localStorePaths, negotiationDir, negotiationJournalFile, outboxDir, presenceFile, reachGuard, resolveRecipient, safePathSegment, type LocalStorePaths, type RecipientResolution } from "./paths.js";
|
|
2
|
-
export { deletePresence, listPresence, readPresence, reapAllDeadPresence, reapDeadInstancePresence, updatePresence, writePresence, type ListPresenceOptions, type PresenceWriteResult } from "./presence.js";
|
|
3
|
-
export { sanitizeStorePaths, type SanitizePathsResult, type SanitizeRenameEntry } from "./migrate.js";
|
|
4
|
-
export { createLocalStore, type CreateLocalStoreOptions, type H2AKeyEvent, type H2ASubagentAuditEvent, type H2ASubagentStatus, type LocalStore } from "./store.js";
|
|
5
|
-
export { LockTimeoutError, withLock, withLockSync, type LockOwner, type WithLockOptions } from "./locks.js";
|
|
6
|
-
export { withLease, withLeaseSync, type LeaseHandle, type LeaseRecord, type WithLeaseOptions } from "./lease.js";
|
|
7
|
-
export { H2A_STORE_SCHEMA_FILE, H2A_STORE_SCHEMA_VERSION, StoreSchemaMismatchError, readCliPackageVersion, type H2AStoreSchemaSentinel } from "./schema.js";
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/local-files/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,QAAQ,EACR,WAAW,EACX,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,sBAAsB,EACtB,SAAS,EACT,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACzB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,wBAAwB,EACxB,cAAc,EACd,aAAa,EACb,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACzB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,kBAAkB,EAClB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACzB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,UAAU,EAChB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,KAAK,SAAS,EACd,KAAK,eAAe,EACrB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,SAAS,EACT,aAAa,EACb,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACtB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACrB,KAAK,sBAAsB,EAC5B,MAAM,aAAa,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { assertHostQualifiedAddress, canonicalAddress, inboxDir, inboxDirRaw, isHostQualifiedAddress, localStorePaths, negotiationDir, negotiationJournalFile, outboxDir, presenceFile, reachGuard, resolveRecipient, safePathSegment } from "./paths.js";
|
|
2
|
-
export { deletePresence, listPresence, readPresence, reapAllDeadPresence, reapDeadInstancePresence, updatePresence, writePresence } from "./presence.js";
|
|
3
|
-
export { sanitizeStorePaths } from "./migrate.js";
|
|
4
|
-
export { createLocalStore } from "./store.js";
|
|
5
|
-
export { LockTimeoutError, withLock, withLockSync } from "./locks.js";
|
|
6
|
-
export { withLease, withLeaseSync } from "./lease.js";
|
|
7
|
-
export { H2A_STORE_SCHEMA_FILE, H2A_STORE_SCHEMA_VERSION, StoreSchemaMismatchError, readCliPackageVersion } from "./schema.js";
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/local-files/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,QAAQ,EACR,WAAW,EACX,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,sBAAsB,EACtB,SAAS,EACT,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,eAAe,EAGhB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,wBAAwB,EACxB,cAAc,EACd,aAAa,EAGd,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,kBAAkB,EAGnB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,gBAAgB,EAMjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,YAAY,EAGb,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,SAAS,EACT,aAAa,EAId,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EAEtB,MAAM,aAAa,CAAC"}
|