@sentropic/h2a-cli 0.75.0 → 0.79.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -37
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -41
- package/dist/index.js.map +1 -1
- package/package.json +4 -15
- package/dist/bin.d.ts +0 -3
- package/dist/bin.d.ts.map +0 -1
- package/dist/bin.js +0 -83
- package/dist/bin.js.map +0 -1
- package/dist/cli-contract.d.ts +0 -62
- package/dist/cli-contract.d.ts.map +0 -1
- package/dist/cli-contract.js +0 -794
- package/dist/cli-contract.js.map +0 -1
- package/dist/cli.d.ts +0 -254
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -4672
- package/dist/cli.js.map +0 -1
- package/dist/hosts/agy.d.ts +0 -14
- package/dist/hosts/agy.d.ts.map +0 -1
- package/dist/hosts/agy.js +0 -47
- package/dist/hosts/agy.js.map +0 -1
- package/dist/hosts/claude.d.ts +0 -12
- package/dist/hosts/claude.d.ts.map +0 -1
- package/dist/hosts/claude.js +0 -46
- package/dist/hosts/claude.js.map +0 -1
- package/dist/hosts/codex.d.ts +0 -65
- package/dist/hosts/codex.d.ts.map +0 -1
- package/dist/hosts/codex.js +0 -45
- package/dist/hosts/codex.js.map +0 -1
- package/dist/hosts/gemini.d.ts +0 -12
- package/dist/hosts/gemini.d.ts.map +0 -1
- package/dist/hosts/gemini.js +0 -46
- package/dist/hosts/gemini.js.map +0 -1
- package/dist/hosts/plugin.d.ts +0 -151
- package/dist/hosts/plugin.d.ts.map +0 -1
- package/dist/hosts/plugin.js +0 -188
- package/dist/hosts/plugin.js.map +0 -1
- package/dist/mcp.d.ts +0 -2
- package/dist/mcp.d.ts.map +0 -1
- package/dist/mcp.js +0 -32
- package/dist/mcp.js.map +0 -1
- package/dist/runtime/blockage/index.d.ts +0 -3
- package/dist/runtime/blockage/index.d.ts.map +0 -1
- package/dist/runtime/blockage/index.js +0 -3
- package/dist/runtime/blockage/index.js.map +0 -1
- package/dist/runtime/blockage/notifiers.d.ts +0 -52
- package/dist/runtime/blockage/notifiers.d.ts.map +0 -1
- package/dist/runtime/blockage/notifiers.js +0 -74
- package/dist/runtime/blockage/notifiers.js.map +0 -1
- package/dist/runtime/blockage/registry.d.ts +0 -30
- package/dist/runtime/blockage/registry.d.ts.map +0 -1
- package/dist/runtime/blockage/registry.js +0 -86
- package/dist/runtime/blockage/registry.js.map +0 -1
- package/dist/runtime/deploy/k8s-sidecar.d.ts +0 -92
- package/dist/runtime/deploy/k8s-sidecar.d.ts.map +0 -1
- package/dist/runtime/deploy/k8s-sidecar.js +0 -166
- package/dist/runtime/deploy/k8s-sidecar.js.map +0 -1
- package/dist/runtime/deploy/k8s-tenant.d.ts +0 -86
- package/dist/runtime/deploy/k8s-tenant.d.ts.map +0 -1
- package/dist/runtime/deploy/k8s-tenant.js +0 -255
- package/dist/runtime/deploy/k8s-tenant.js.map +0 -1
- package/dist/runtime/drive/inbox-wake.d.ts +0 -36
- package/dist/runtime/drive/inbox-wake.d.ts.map +0 -1
- package/dist/runtime/drive/inbox-wake.js +0 -50
- package/dist/runtime/drive/inbox-wake.js.map +0 -1
- package/dist/runtime/drive/index.d.ts +0 -173
- package/dist/runtime/drive/index.d.ts.map +0 -1
- package/dist/runtime/drive/index.js +0 -503
- package/dist/runtime/drive/index.js.map +0 -1
- package/dist/runtime/drumbeat/deciders.d.ts +0 -32
- package/dist/runtime/drumbeat/deciders.d.ts.map +0 -1
- package/dist/runtime/drumbeat/deciders.js +0 -65
- package/dist/runtime/drumbeat/deciders.js.map +0 -1
- package/dist/runtime/drumbeat/decisions.d.ts +0 -19
- package/dist/runtime/drumbeat/decisions.d.ts.map +0 -1
- package/dist/runtime/drumbeat/decisions.js +0 -34
- package/dist/runtime/drumbeat/decisions.js.map +0 -1
- package/dist/runtime/drumbeat/inbox-relance.d.ts +0 -29
- package/dist/runtime/drumbeat/inbox-relance.d.ts.map +0 -1
- package/dist/runtime/drumbeat/inbox-relance.js +0 -101
- package/dist/runtime/drumbeat/inbox-relance.js.map +0 -1
- package/dist/runtime/drumbeat/index.d.ts +0 -8
- package/dist/runtime/drumbeat/index.d.ts.map +0 -1
- package/dist/runtime/drumbeat/index.js +0 -8
- package/dist/runtime/drumbeat/index.js.map +0 -1
- package/dist/runtime/drumbeat/registry.d.ts +0 -60
- package/dist/runtime/drumbeat/registry.d.ts.map +0 -1
- package/dist/runtime/drumbeat/registry.js +0 -115
- package/dist/runtime/drumbeat/registry.js.map +0 -1
- package/dist/runtime/drumbeat/relaunchers.d.ts +0 -111
- package/dist/runtime/drumbeat/relaunchers.d.ts.map +0 -1
- package/dist/runtime/drumbeat/relaunchers.js +0 -260
- package/dist/runtime/drumbeat/relaunchers.js.map +0 -1
- package/dist/runtime/drumbeat/scan.d.ts +0 -36
- package/dist/runtime/drumbeat/scan.d.ts.map +0 -1
- package/dist/runtime/drumbeat/scan.js +0 -41
- package/dist/runtime/drumbeat/scan.js.map +0 -1
- package/dist/runtime/drumbeat/watch.d.ts +0 -74
- package/dist/runtime/drumbeat/watch.d.ts.map +0 -1
- package/dist/runtime/drumbeat/watch.js +0 -216
- package/dist/runtime/drumbeat/watch.js.map +0 -1
- package/dist/runtime/escalation/index.d.ts +0 -2
- package/dist/runtime/escalation/index.d.ts.map +0 -1
- package/dist/runtime/escalation/index.js +0 -2
- package/dist/runtime/escalation/index.js.map +0 -1
- package/dist/runtime/escalation/registry.d.ts +0 -44
- package/dist/runtime/escalation/registry.d.ts.map +0 -1
- package/dist/runtime/escalation/registry.js +0 -79
- package/dist/runtime/escalation/registry.js.map +0 -1
- package/dist/runtime/governance/claims.d.ts +0 -43
- package/dist/runtime/governance/claims.d.ts.map +0 -1
- package/dist/runtime/governance/claims.js +0 -93
- package/dist/runtime/governance/claims.js.map +0 -1
- package/dist/runtime/governance/conductor.d.ts +0 -79
- package/dist/runtime/governance/conductor.d.ts.map +0 -1
- package/dist/runtime/governance/conductor.js +0 -106
- package/dist/runtime/governance/conductor.js.map +0 -1
- package/dist/runtime/governance/index.d.ts +0 -5
- package/dist/runtime/governance/index.d.ts.map +0 -1
- package/dist/runtime/governance/index.js +0 -5
- package/dist/runtime/governance/index.js.map +0 -1
- package/dist/runtime/governance/launch-check.d.ts +0 -93
- package/dist/runtime/governance/launch-check.d.ts.map +0 -1
- package/dist/runtime/governance/launch-check.js +0 -113
- package/dist/runtime/governance/launch-check.js.map +0 -1
- package/dist/runtime/governance/spawns.d.ts +0 -50
- package/dist/runtime/governance/spawns.d.ts.map +0 -1
- package/dist/runtime/governance/spawns.js +0 -91
- package/dist/runtime/governance/spawns.js.map +0 -1
- package/dist/runtime/identity/bindings.d.ts +0 -84
- package/dist/runtime/identity/bindings.d.ts.map +0 -1
- package/dist/runtime/identity/bindings.js +0 -112
- package/dist/runtime/identity/bindings.js.map +0 -1
- package/dist/runtime/identity/index.d.ts +0 -11
- package/dist/runtime/identity/index.d.ts.map +0 -1
- package/dist/runtime/identity/index.js +0 -6
- package/dist/runtime/identity/index.js.map +0 -1
- package/dist/runtime/identity/live.d.ts +0 -26
- package/dist/runtime/identity/live.d.ts.map +0 -1
- package/dist/runtime/identity/live.js +0 -232
- package/dist/runtime/identity/live.js.map +0 -1
- package/dist/runtime/identity/migration.d.ts +0 -55
- package/dist/runtime/identity/migration.d.ts.map +0 -1
- package/dist/runtime/identity/migration.js +0 -100
- package/dist/runtime/identity/migration.js.map +0 -1
- package/dist/runtime/identity/readers.d.ts +0 -42
- package/dist/runtime/identity/readers.d.ts.map +0 -1
- package/dist/runtime/identity/readers.js +0 -248
- package/dist/runtime/identity/readers.js.map +0 -1
- package/dist/runtime/identity/resolver.d.ts +0 -50
- package/dist/runtime/identity/resolver.d.ts.map +0 -1
- package/dist/runtime/identity/resolver.js +0 -61
- package/dist/runtime/identity/resolver.js.map +0 -1
- package/dist/runtime/identity/workspace-id.d.ts +0 -43
- package/dist/runtime/identity/workspace-id.d.ts.map +0 -1
- package/dist/runtime/identity/workspace-id.js +0 -138
- package/dist/runtime/identity/workspace-id.js.map +0 -1
- package/dist/runtime/local-files/index.d.ts +0 -8
- package/dist/runtime/local-files/index.d.ts.map +0 -1
- package/dist/runtime/local-files/index.js +0 -8
- package/dist/runtime/local-files/index.js.map +0 -1
- package/dist/runtime/local-files/lease.d.ts +0 -62
- package/dist/runtime/local-files/lease.d.ts.map +0 -1
- package/dist/runtime/local-files/lease.js +0 -249
- package/dist/runtime/local-files/lease.js.map +0 -1
- package/dist/runtime/local-files/locks.d.ts +0 -43
- package/dist/runtime/local-files/locks.d.ts.map +0 -1
- package/dist/runtime/local-files/locks.js +0 -197
- package/dist/runtime/local-files/locks.js.map +0 -1
- package/dist/runtime/local-files/migrate.d.ts +0 -31
- package/dist/runtime/local-files/migrate.d.ts.map +0 -1
- package/dist/runtime/local-files/migrate.js +0 -104
- package/dist/runtime/local-files/migrate.js.map +0 -1
- package/dist/runtime/local-files/paths.d.ts +0 -146
- package/dist/runtime/local-files/paths.d.ts.map +0 -1
- package/dist/runtime/local-files/paths.js +0 -233
- package/dist/runtime/local-files/paths.js.map +0 -1
- package/dist/runtime/local-files/presence.d.ts +0 -80
- package/dist/runtime/local-files/presence.d.ts.map +0 -1
- package/dist/runtime/local-files/presence.js +0 -250
- package/dist/runtime/local-files/presence.js.map +0 -1
- package/dist/runtime/local-files/schema.d.ts +0 -47
- package/dist/runtime/local-files/schema.d.ts.map +0 -1
- package/dist/runtime/local-files/schema.js +0 -77
- package/dist/runtime/local-files/schema.js.map +0 -1
- package/dist/runtime/local-files/store.d.ts +0 -132
- package/dist/runtime/local-files/store.d.ts.map +0 -1
- package/dist/runtime/local-files/store.js +0 -997
- package/dist/runtime/local-files/store.js.map +0 -1
- package/dist/runtime/loop/index.d.ts +0 -73
- package/dist/runtime/loop/index.d.ts.map +0 -1
- package/dist/runtime/loop/index.js +0 -107
- package/dist/runtime/loop/index.js.map +0 -1
- package/dist/runtime/mcp/handlers.d.ts +0 -196
- package/dist/runtime/mcp/handlers.d.ts.map +0 -1
- package/dist/runtime/mcp/handlers.js +0 -1025
- package/dist/runtime/mcp/handlers.js.map +0 -1
- package/dist/runtime/mcp/index.d.ts +0 -7
- package/dist/runtime/mcp/index.d.ts.map +0 -1
- package/dist/runtime/mcp/index.js +0 -7
- package/dist/runtime/mcp/index.js.map +0 -1
- package/dist/runtime/mcp/notifications.d.ts +0 -47
- package/dist/runtime/mcp/notifications.d.ts.map +0 -1
- package/dist/runtime/mcp/notifications.js +0 -204
- package/dist/runtime/mcp/notifications.js.map +0 -1
- package/dist/runtime/mcp/server.d.ts +0 -45
- package/dist/runtime/mcp/server.d.ts.map +0 -1
- package/dist/runtime/mcp/server.js +0 -94
- package/dist/runtime/mcp/server.js.map +0 -1
- package/dist/runtime/mcp/sessions.d.ts +0 -68
- package/dist/runtime/mcp/sessions.d.ts.map +0 -1
- package/dist/runtime/mcp/sessions.js +0 -152
- package/dist/runtime/mcp/sessions.js.map +0 -1
- package/dist/runtime/mcp/stdio.d.ts +0 -72
- package/dist/runtime/mcp/stdio.d.ts.map +0 -1
- package/dist/runtime/mcp/stdio.js +0 -274
- package/dist/runtime/mcp/stdio.js.map +0 -1
- package/dist/runtime/mcp/tools.d.ts +0 -19
- package/dist/runtime/mcp/tools.d.ts.map +0 -1
- package/dist/runtime/mcp/tools.js +0 -525
- package/dist/runtime/mcp/tools.js.map +0 -1
- package/dist/runtime/mcp-http/app.d.ts +0 -33
- package/dist/runtime/mcp-http/app.d.ts.map +0 -1
- package/dist/runtime/mcp-http/app.js +0 -162
- package/dist/runtime/mcp-http/app.js.map +0 -1
- package/dist/runtime/mcp-http/hosted-mcp-server.d.ts +0 -14
- package/dist/runtime/mcp-http/hosted-mcp-server.d.ts.map +0 -1
- package/dist/runtime/mcp-http/hosted-mcp-server.js +0 -38
- package/dist/runtime/mcp-http/hosted-mcp-server.js.map +0 -1
- package/dist/runtime/mcp-http/index.d.ts +0 -18
- package/dist/runtime/mcp-http/index.d.ts.map +0 -1
- package/dist/runtime/mcp-http/index.js +0 -18
- package/dist/runtime/mcp-http/index.js.map +0 -1
- package/dist/runtime/mcp-http/main.d.ts +0 -2
- package/dist/runtime/mcp-http/main.d.ts.map +0 -1
- package/dist/runtime/mcp-http/main.js +0 -14
- package/dist/runtime/mcp-http/main.js.map +0 -1
- package/dist/runtime/mcp-http/oauth/broker-login.d.ts +0 -50
- package/dist/runtime/mcp-http/oauth/broker-login.d.ts.map +0 -1
- package/dist/runtime/mcp-http/oauth/broker-login.js +0 -41
- package/dist/runtime/mcp-http/oauth/broker-login.js.map +0 -1
- package/dist/runtime/mcp-http/oauth/broker-routes.d.ts +0 -45
- package/dist/runtime/mcp-http/oauth/broker-routes.d.ts.map +0 -1
- package/dist/runtime/mcp-http/oauth/broker-routes.js +0 -54
- package/dist/runtime/mcp-http/oauth/broker-routes.js.map +0 -1
- package/dist/runtime/mcp-http/oauth/config.d.ts +0 -49
- package/dist/runtime/mcp-http/oauth/config.d.ts.map +0 -1
- package/dist/runtime/mcp-http/oauth/config.js +0 -69
- package/dist/runtime/mcp-http/oauth/config.js.map +0 -1
- package/dist/runtime/mcp-http/oauth/crypto.d.ts +0 -14
- package/dist/runtime/mcp-http/oauth/crypto.d.ts.map +0 -1
- package/dist/runtime/mcp-http/oauth/crypto.js +0 -29
- package/dist/runtime/mcp-http/oauth/crypto.js.map +0 -1
- package/dist/runtime/mcp-http/oauth/file-store.d.ts +0 -48
- package/dist/runtime/mcp-http/oauth/file-store.d.ts.map +0 -1
- package/dist/runtime/mcp-http/oauth/file-store.js +0 -101
- package/dist/runtime/mcp-http/oauth/file-store.js.map +0 -1
- package/dist/runtime/mcp-http/oauth/hono-oauth-router.d.ts +0 -5
- package/dist/runtime/mcp-http/oauth/hono-oauth-router.d.ts.map +0 -1
- package/dist/runtime/mcp-http/oauth/hono-oauth-router.js +0 -92
- package/dist/runtime/mcp-http/oauth/hono-oauth-router.js.map +0 -1
- package/dist/runtime/mcp-http/oauth/oidc-rp.d.ts +0 -56
- package/dist/runtime/mcp-http/oauth/oidc-rp.d.ts.map +0 -1
- package/dist/runtime/mcp-http/oauth/oidc-rp.js +0 -63
- package/dist/runtime/mcp-http/oauth/oidc-rp.js.map +0 -1
- package/dist/runtime/mcp-http/oauth/redirect-uri.d.ts +0 -11
- package/dist/runtime/mcp-http/oauth/redirect-uri.d.ts.map +0 -1
- package/dist/runtime/mcp-http/oauth/redirect-uri.js +0 -29
- package/dist/runtime/mcp-http/oauth/redirect-uri.js.map +0 -1
- package/dist/runtime/mcp-http/oauth/single-tenant-provider.d.ts +0 -70
- package/dist/runtime/mcp-http/oauth/single-tenant-provider.d.ts.map +0 -1
- package/dist/runtime/mcp-http/oauth/single-tenant-provider.js +0 -247
- package/dist/runtime/mcp-http/oauth/single-tenant-provider.js.map +0 -1
- package/dist/runtime/mcp-http/oauth/tenancy.d.ts +0 -3
- package/dist/runtime/mcp-http/oauth/tenancy.d.ts.map +0 -1
- package/dist/runtime/mcp-http/oauth/tenancy.js +0 -18
- package/dist/runtime/mcp-http/oauth/tenancy.js.map +0 -1
- package/dist/runtime/mcp-http/readonly-allowlist.d.ts +0 -24
- package/dist/runtime/mcp-http/readonly-allowlist.d.ts.map +0 -1
- package/dist/runtime/mcp-http/readonly-allowlist.js +0 -43
- package/dist/runtime/mcp-http/readonly-allowlist.js.map +0 -1
- package/dist/runtime/mcp-http/serve.d.ts +0 -39
- package/dist/runtime/mcp-http/serve.d.ts.map +0 -1
- package/dist/runtime/mcp-http/serve.js +0 -100
- package/dist/runtime/mcp-http/serve.js.map +0 -1
- package/dist/runtime/mirror/accept.d.ts +0 -57
- package/dist/runtime/mirror/accept.d.ts.map +0 -1
- package/dist/runtime/mirror/accept.js +0 -70
- package/dist/runtime/mirror/accept.js.map +0 -1
- package/dist/runtime/mirror/build.d.ts +0 -44
- package/dist/runtime/mirror/build.d.ts.map +0 -1
- package/dist/runtime/mirror/build.js +0 -37
- package/dist/runtime/mirror/build.js.map +0 -1
- package/dist/runtime/mirror/index.d.ts +0 -9
- package/dist/runtime/mirror/index.d.ts.map +0 -1
- package/dist/runtime/mirror/index.js +0 -9
- package/dist/runtime/mirror/index.js.map +0 -1
- package/dist/runtime/mirror/serve.d.ts +0 -21
- package/dist/runtime/mirror/serve.d.ts.map +0 -1
- package/dist/runtime/mirror/serve.js +0 -141
- package/dist/runtime/mirror/serve.js.map +0 -1
- package/dist/runtime/nhi.d.ts +0 -15
- package/dist/runtime/nhi.d.ts.map +0 -1
- package/dist/runtime/nhi.js +0 -26
- package/dist/runtime/nhi.js.map +0 -1
- package/dist/runtime/remote/accept.d.ts +0 -50
- package/dist/runtime/remote/accept.d.ts.map +0 -1
- package/dist/runtime/remote/accept.js +0 -54
- package/dist/runtime/remote/accept.js.map +0 -1
- package/dist/runtime/remote/client.d.ts +0 -27
- package/dist/runtime/remote/client.d.ts.map +0 -1
- package/dist/runtime/remote/client.js +0 -34
- package/dist/runtime/remote/client.js.map +0 -1
- package/dist/runtime/remote/index.d.ts +0 -5
- package/dist/runtime/remote/index.d.ts.map +0 -1
- package/dist/runtime/remote/index.js +0 -5
- package/dist/runtime/remote/index.js.map +0 -1
- package/dist/runtime/remote/serve.d.ts +0 -27
- package/dist/runtime/remote/serve.d.ts.map +0 -1
- package/dist/runtime/remote/serve.js +0 -26
- package/dist/runtime/remote/serve.js.map +0 -1
- package/dist/runtime/remote/server.d.ts +0 -36
- package/dist/runtime/remote/server.d.ts.map +0 -1
- package/dist/runtime/remote/server.js +0 -100
- package/dist/runtime/remote/server.js.map +0 -1
- package/dist/runtime/sysml/client.d.ts +0 -44
- package/dist/runtime/sysml/client.d.ts.map +0 -1
- package/dist/runtime/sysml/client.js +0 -52
- package/dist/runtime/sysml/client.js.map +0 -1
- package/dist/runtime/sysml/disclosure.d.ts +0 -23
- package/dist/runtime/sysml/disclosure.d.ts.map +0 -1
- package/dist/runtime/sysml/disclosure.js +0 -53
- package/dist/runtime/sysml/disclosure.js.map +0 -1
- package/dist/runtime/sysml/index.d.ts +0 -4
- package/dist/runtime/sysml/index.d.ts.map +0 -1
- package/dist/runtime/sysml/index.js +0 -4
- package/dist/runtime/sysml/index.js.map +0 -1
- package/dist/runtime/sysml/verify.d.ts +0 -32
- package/dist/runtime/sysml/verify.d.ts.map +0 -1
- package/dist/runtime/sysml/verify.js +0 -67
- package/dist/runtime/sysml/verify.js.map +0 -1
- package/dist/runtime/upgrade/index.d.ts +0 -96
- package/dist/runtime/upgrade/index.d.ts.map +0 -1
- package/dist/runtime/upgrade/index.js +0 -185
- package/dist/runtime/upgrade/index.js.map +0 -1
- package/dist/runtime/version/agent-version.d.ts +0 -15
- package/dist/runtime/version/agent-version.d.ts.map +0 -1
- package/dist/runtime/version/agent-version.js +0 -53
- package/dist/runtime/version/agent-version.js.map +0 -1
- package/skills/h2a/SKILL.md +0 -345
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import { createHash, generateKeyPairSync } from "node:crypto";
|
|
2
|
-
import { copyFileSync, existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
|
|
3
|
-
import { hostname } from "node:os";
|
|
4
|
-
import { basename, join } from "node:path";
|
|
5
|
-
import { deriveInstanceId, deriveWorkspaceId, mintAgentUuid, signCanonical } from "@sentropic/h2a";
|
|
6
|
-
import { createLocalStore } from "../local-files/store.js";
|
|
7
|
-
import { findBinding, reclaimOrMint, verifyReclaimProof } from "./bindings.js";
|
|
8
|
-
import { decideLegacyAdoption, legacyAliasAlreadyAdopted, recordIdentityAlias } from "./migration.js";
|
|
9
|
-
import { defaultProviderSessionReaders, readHostSessionName } from "./readers.js";
|
|
10
|
-
import { resolveProviderSession } from "./resolver.js";
|
|
11
|
-
import { durableWorkspaceId } from "./workspace-id.js";
|
|
12
|
-
function safeKeyName(instance) {
|
|
13
|
-
return instance.replace(/[:/]/g, "-");
|
|
14
|
-
}
|
|
15
|
-
function keyPaths(root, instance) {
|
|
16
|
-
const keysDir = join(root, "keys");
|
|
17
|
-
return {
|
|
18
|
-
privateKeyPath: join(keysDir, `${safeKeyName(instance)}.key.pem`),
|
|
19
|
-
publicKeyPath: join(keysDir, `${safeKeyName(instance)}.pub.pem`)
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
function readMachineId() {
|
|
23
|
-
for (const path of ["/etc/machine-id", "/var/lib/dbus/machine-id"]) {
|
|
24
|
-
try {
|
|
25
|
-
const id = readFileSync(path, "utf8").trim();
|
|
26
|
-
if (id.length > 0)
|
|
27
|
-
return id;
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
// try the next source
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return hostname() || "unknown-machine";
|
|
34
|
-
}
|
|
35
|
-
function realWorkspacePath(cwd) {
|
|
36
|
-
try {
|
|
37
|
-
return realpathSync(cwd);
|
|
38
|
-
}
|
|
39
|
-
catch {
|
|
40
|
-
return cwd;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function labelFromCwd(cwd) {
|
|
44
|
-
return basename(cwd) || "workspace";
|
|
45
|
-
}
|
|
46
|
-
function publicKeyFingerprint(publicKeyPem) {
|
|
47
|
-
return createHash("sha256").update(publicKeyPem, "utf8").digest("hex").slice(0, 16);
|
|
48
|
-
}
|
|
49
|
-
function remoteBridgeInstance(providerSessionId) {
|
|
50
|
-
return providerSessionId.startsWith("remote:")
|
|
51
|
-
? providerSessionId
|
|
52
|
-
: `remote:${providerSessionId}`;
|
|
53
|
-
}
|
|
54
|
-
function generateKeypair() {
|
|
55
|
-
const { privateKey, publicKey } = generateKeyPairSync("ed25519");
|
|
56
|
-
return {
|
|
57
|
-
privateKeyPem: privateKey.export({ format: "pem", type: "pkcs8" }).toString(),
|
|
58
|
-
publicKeyPem: publicKey.export({ format: "pem", type: "spki" }).toString()
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
function readKeypair(root, instance) {
|
|
62
|
-
const paths = keyPaths(root, instance);
|
|
63
|
-
if (!existsSync(paths.privateKeyPath) || !existsSync(paths.publicKeyPath))
|
|
64
|
-
return undefined;
|
|
65
|
-
return {
|
|
66
|
-
privateKeyPem: readFileSync(paths.privateKeyPath, "utf8"),
|
|
67
|
-
publicKeyPem: readFileSync(paths.publicKeyPath, "utf8"),
|
|
68
|
-
...paths
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
function ensureKeypair(root, instance, adoptFromInstance) {
|
|
72
|
-
const existing = readKeypair(root, instance);
|
|
73
|
-
if (existing) {
|
|
74
|
-
return {
|
|
75
|
-
publicKeyPem: existing.publicKeyPem,
|
|
76
|
-
privateKeyPath: existing.privateKeyPath,
|
|
77
|
-
publicKeyPath: existing.publicKeyPath
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
const paths = keyPaths(root, instance);
|
|
81
|
-
mkdirSync(join(root, "keys"), { recursive: true });
|
|
82
|
-
const adopted = adoptFromInstance ? readKeypair(root, adoptFromInstance) : undefined;
|
|
83
|
-
if (adopted) {
|
|
84
|
-
copyFileSync(adopted.privateKeyPath, paths.privateKeyPath);
|
|
85
|
-
copyFileSync(adopted.publicKeyPath, paths.publicKeyPath);
|
|
86
|
-
return { publicKeyPem: adopted.publicKeyPem, ...paths };
|
|
87
|
-
}
|
|
88
|
-
const generated = generateKeypair();
|
|
89
|
-
writeFileSync(paths.privateKeyPath, generated.privateKeyPem, { encoding: "utf8", mode: 0o600 });
|
|
90
|
-
writeFileSync(paths.publicKeyPath, generated.publicKeyPem, "utf8");
|
|
91
|
-
return { publicKeyPem: generated.publicKeyPem, ...paths };
|
|
92
|
-
}
|
|
93
|
-
function provesLocalKey(root, instance) {
|
|
94
|
-
const store = createLocalStore({ root });
|
|
95
|
-
const keypair = readKeypair(root, instance);
|
|
96
|
-
if (!keypair)
|
|
97
|
-
return false;
|
|
98
|
-
const activeKeys = store.listInstanceKeys(instance);
|
|
99
|
-
if (activeKeys.length === 0)
|
|
100
|
-
return false;
|
|
101
|
-
const nonce = `identity-reclaim:${instance}:${publicKeyFingerprint(keypair.publicKeyPem)}`;
|
|
102
|
-
try {
|
|
103
|
-
const signature = signCanonical(nonce, { by: instance, privateKeyPem: keypair.privateKeyPem });
|
|
104
|
-
return verifyReclaimProof(nonce, signature, activeKeys);
|
|
105
|
-
}
|
|
106
|
-
catch {
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
function ensureRegistered(input) {
|
|
111
|
-
const store = createLocalStore({ root: input.root });
|
|
112
|
-
const existing = store.findInstance(input.instance);
|
|
113
|
-
if (!existing) {
|
|
114
|
-
const registration = {
|
|
115
|
-
id: input.instance,
|
|
116
|
-
instance: input.instance,
|
|
117
|
-
roles: ["AGENTS"],
|
|
118
|
-
scopes: [...input.scopes],
|
|
119
|
-
capabilities: [],
|
|
120
|
-
endpoints: [{ kind: "local-files", uri: `file://${input.root}` }],
|
|
121
|
-
publicKeys: [input.publicKeyPem],
|
|
122
|
-
acceptedPolicies: [],
|
|
123
|
-
agentUuid: input.agentUuid,
|
|
124
|
-
workspace: input.workspace,
|
|
125
|
-
name: input.name,
|
|
126
|
-
createdAt: new Date(input.now()).toISOString()
|
|
127
|
-
};
|
|
128
|
-
store.registerInstance(registration);
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
if (!store.listInstanceKeys(input.instance).includes(input.publicKeyPem)) {
|
|
132
|
-
store.addInstanceKey(input.instance, input.publicKeyPem);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
export function resolveLiveIdentity(input) {
|
|
136
|
-
const host = input.host || "agent";
|
|
137
|
-
const label = labelFromCwd(input.cwd);
|
|
138
|
-
if (input.explicitInstance) {
|
|
139
|
-
return { instance: input.explicitInstance, host, action: "override" };
|
|
140
|
-
}
|
|
141
|
-
const readers = input.readers ?? defaultProviderSessionReaders;
|
|
142
|
-
const provider = resolveProviderSession({ host, cwd: input.cwd, readers });
|
|
143
|
-
const realPath = realWorkspacePath(input.cwd);
|
|
144
|
-
const workspaceId = durableWorkspaceId(realPath) ??
|
|
145
|
-
provider.workspaceHint ??
|
|
146
|
-
deriveWorkspaceId({ machineId: readMachineId(), path: realPath });
|
|
147
|
-
const workspace = {
|
|
148
|
-
id: workspaceId,
|
|
149
|
-
path: realPath,
|
|
150
|
-
host,
|
|
151
|
-
label
|
|
152
|
-
};
|
|
153
|
-
const legacyInstance = `${host}:${label}`;
|
|
154
|
-
const now = input.now ?? Date.now;
|
|
155
|
-
const scopes = input.scopes?.length ? input.scopes : ["scope:default"];
|
|
156
|
-
// WP-6: prefer the host-native session name (Claude customTitle / Codex thread_name)
|
|
157
|
-
// over the cwd label. The explicit `--name` flag always takes precedence.
|
|
158
|
-
const hostName = input.name === undefined
|
|
159
|
-
? readHostSessionName({ host, cwd: input.cwd, sessionId: provider.providerSessionId })
|
|
160
|
-
: undefined;
|
|
161
|
-
const name = input.name ?? hostName ?? label;
|
|
162
|
-
const mint = () => {
|
|
163
|
-
const agentUuid = mintAgentUuid();
|
|
164
|
-
return {
|
|
165
|
-
agentUuid,
|
|
166
|
-
instance: deriveInstanceId({ host, label: name, uuid: agentUuid })
|
|
167
|
-
};
|
|
168
|
-
};
|
|
169
|
-
const mintRemote = () => {
|
|
170
|
-
const agentUuid = mintAgentUuid();
|
|
171
|
-
return {
|
|
172
|
-
agentUuid,
|
|
173
|
-
instance: provider.providerSessionId
|
|
174
|
-
? remoteBridgeInstance(provider.providerSessionId)
|
|
175
|
-
: deriveInstanceId({ host, label: name, uuid: agentUuid })
|
|
176
|
-
};
|
|
177
|
-
};
|
|
178
|
-
// Re-anchor: the conversation UUID is the identity unit. When no provider
|
|
179
|
-
// session id is readable, fall back to a per-workspace-STABLE id (no
|
|
180
|
-
// timestamp) so that degenerate case keeps the old per-workspace reclaim
|
|
181
|
-
// behavior instead of minting a fresh id on every connect.
|
|
182
|
-
const providerSessionId = provider.providerSessionId ?? `fallback:${host}:${workspace.id}`;
|
|
183
|
-
const result = host === "remote"
|
|
184
|
-
? { action: "mint", ...mintRemote() }
|
|
185
|
-
: reclaimOrMint(input.root, { host, providerSessionId, workspaceId: workspace.id }, {
|
|
186
|
-
verifyProof: (binding) => provesLocalKey(input.root, binding.instance),
|
|
187
|
-
mint,
|
|
188
|
-
now
|
|
189
|
-
});
|
|
190
|
-
const existingBinding = findBinding(input.root, {
|
|
191
|
-
host,
|
|
192
|
-
providerSessionId,
|
|
193
|
-
workspaceId: workspace.id
|
|
194
|
-
});
|
|
195
|
-
const legacyDecision = decideLegacyAdoption({
|
|
196
|
-
legacyAlreadyAdopted: legacyAliasAlreadyAdopted(input.root, legacyInstance),
|
|
197
|
-
provedLegacyPossession: provesLocalKey(input.root, legacyInstance)
|
|
198
|
-
});
|
|
199
|
-
const adoptedFrom = result.action === "mint" && legacyDecision.adopt ? legacyInstance : undefined;
|
|
200
|
-
const keypair = ensureKeypair(input.root, result.instance, adoptedFrom);
|
|
201
|
-
ensureRegistered({
|
|
202
|
-
root: input.root,
|
|
203
|
-
instance: result.instance,
|
|
204
|
-
agentUuid: result.agentUuid,
|
|
205
|
-
workspace,
|
|
206
|
-
name,
|
|
207
|
-
publicKeyPem: keypair.publicKeyPem,
|
|
208
|
-
scopes,
|
|
209
|
-
now
|
|
210
|
-
});
|
|
211
|
-
recordIdentityAlias(input.root, {
|
|
212
|
-
instance: result.instance,
|
|
213
|
-
legacyInstance,
|
|
214
|
-
adoptedKeyring: Boolean(adoptedFrom),
|
|
215
|
-
at: new Date(now()).toISOString()
|
|
216
|
-
});
|
|
217
|
-
return {
|
|
218
|
-
instance: result.instance,
|
|
219
|
-
host,
|
|
220
|
-
workspace,
|
|
221
|
-
name,
|
|
222
|
-
legacyInstance,
|
|
223
|
-
action: result.action,
|
|
224
|
-
providerSessionSource: provider.source,
|
|
225
|
-
privateKeyPath: keypair.privateKeyPath,
|
|
226
|
-
publicKeyPath: keypair.publicKeyPath,
|
|
227
|
-
migrationNotice: result.action === "mint" || !existingBinding
|
|
228
|
-
? `identity migration: ${result.instance} reads legacy ${legacyInstance}; ${legacyDecision.reason}`
|
|
229
|
-
: undefined
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
//# sourceMappingURL=live.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"live.js","sourceRoot":"","sources":["../../../src/runtime/identity/live.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EACL,YAAY,EACZ,UAAU,EACV,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,aAAa,EACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,aAAa,EAGd,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,6BAA6B,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAA+B,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AA0BvD,SAAS,WAAW,CAAC,QAAgB;IACnC,OAAO,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACxC,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY,EAAE,QAAgB;IAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACnC,OAAO;QACL,cAAc,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,WAAW,CAAC,QAAQ,CAAC,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,WAAW,EAAE;KAClC,CAAC,CAAC;IAEH,OAAO;QACL,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,IAAI;QACJ,SAAS;QACT,IAAI;QACJ,cAAc;QACd,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,qBAAqB,EAAE,QAAQ,CAAC,MAAM;QACtC,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,eAAe,EACb,MAAM,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC,eAAe;YAC1C,CAAC,CAAC,uBAAuB,MAAM,CAAC,QAAQ,iBAAiB,cAAc,KAAK,cAAc,CAAC,MAAM,EAAE;YACnG,CAAC,CAAC,SAAS;KAChB,CAAC;AACJ,CAAC"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transparent migration dual-read (DEC-116).
|
|
3
|
-
*
|
|
4
|
-
* After the identity fix, an agent's perennial inbox lives under its new
|
|
5
|
-
* uuid-bearing instance id, while messages addressed before the migration sit
|
|
6
|
-
* under the old label-derived instance dir(s). Migration must be transparent
|
|
7
|
-
* and immediate: the agent keeps receiving everything with no manual move. The
|
|
8
|
-
* read path therefore unions the current inbox with one or more legacy inbox
|
|
9
|
-
* locations, deduplicated by envelope id — equivalent to reading several dirs
|
|
10
|
-
* as if they were one (same id-sorted order as the single-dir reader).
|
|
11
|
-
*
|
|
12
|
-
* Pure + total: the impure part (which dirs to read) belongs to the caller; this
|
|
13
|
-
* is the deterministic merge that is unit-tested in isolation.
|
|
14
|
-
*/
|
|
15
|
-
import type { H2AEnvelope } from "@sentropic/h2a";
|
|
16
|
-
/**
|
|
17
|
-
* Merge envelope sets, deduplicated by `envelope.id`. Pass the CURRENT inbox
|
|
18
|
-
* first: on an id collision the earlier set wins (identical content is expected,
|
|
19
|
-
* but precedence is defined). Entries without a string `id` are skipped. The
|
|
20
|
-
* result is sorted by `id` ascending, matching the single-dir reader's
|
|
21
|
-
* filename `.sort()`, so a dual-read is indistinguishable from one merged dir.
|
|
22
|
-
*/
|
|
23
|
-
export declare function mergeInboxDedup(sets: ReadonlyArray<readonly H2AEnvelope[]>): H2AEnvelope[];
|
|
24
|
-
export interface LegacyAdoptionInput {
|
|
25
|
-
/** Has some agent already inherited this legacy id's keyring (single-inheritor lock)? */
|
|
26
|
-
readonly legacyAlreadyAdopted: boolean;
|
|
27
|
-
/** Did this connector prove possession of one of the legacy keyring's keys? */
|
|
28
|
-
readonly provedLegacyPossession: boolean;
|
|
29
|
-
}
|
|
30
|
-
export interface LegacyAdoptionDecision {
|
|
31
|
-
/** Adopt the legacy id as an alias of this agent's perennial uuid + inherit its keyring. */
|
|
32
|
-
readonly adopt: boolean;
|
|
33
|
-
/** Mint a fresh key for this agent (honest re-key for de-collided peers). */
|
|
34
|
-
readonly netNewKeys: boolean;
|
|
35
|
-
readonly reason: string;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Ratified migration rule (DEC-116, spec §Migration F4): the FIRST agent to
|
|
39
|
-
* prove possession of a legacy key inherits the legacy keyring and adopts the
|
|
40
|
-
* legacy id as an alias of its new perennial uuid; every de-collided peer mints
|
|
41
|
-
* **net-new keys** (honest re-key, surfaced in the migration notice). No proof
|
|
42
|
-
* → no inheritance. Pure + total. The adoption record + keyring copy are the
|
|
43
|
-
* caller's (impure, locked) job; this is the deterministic decision.
|
|
44
|
-
*/
|
|
45
|
-
export declare function decideLegacyAdoption(input: LegacyAdoptionInput): LegacyAdoptionDecision;
|
|
46
|
-
export interface H2AIdentityAlias {
|
|
47
|
-
readonly instance: string;
|
|
48
|
-
readonly legacyInstance: string;
|
|
49
|
-
readonly adoptedKeyring: boolean;
|
|
50
|
-
readonly at: string;
|
|
51
|
-
}
|
|
52
|
-
export declare function listIdentityAliases(root: string, instance?: string): H2AIdentityAlias[];
|
|
53
|
-
export declare function legacyAliasAlreadyAdopted(root: string, legacyInstance: string): boolean;
|
|
54
|
-
export declare function recordIdentityAlias(root: string, alias: H2AIdentityAlias): void;
|
|
55
|
-
//# sourceMappingURL=migration.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/runtime/identity/migration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,aAAa,CAAC,SAAS,WAAW,EAAE,CAAC,GAC1C,WAAW,EAAE,CAUf;AAED,MAAM,WAAW,mBAAmB;IAClC,yFAAyF;IACzF,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAC;IACvC,+EAA+E;IAC/E,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;CAC1C;AAED,MAAM,WAAW,sBAAsB;IACrC,4FAA4F;IAC5F,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,6EAA6E;IAC7E,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,mBAAmB,GAAG,sBAAsB,CAoBvF;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAUD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAcvF;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAIvF;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAQ/E"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transparent migration dual-read (DEC-116).
|
|
3
|
-
*
|
|
4
|
-
* After the identity fix, an agent's perennial inbox lives under its new
|
|
5
|
-
* uuid-bearing instance id, while messages addressed before the migration sit
|
|
6
|
-
* under the old label-derived instance dir(s). Migration must be transparent
|
|
7
|
-
* and immediate: the agent keeps receiving everything with no manual move. The
|
|
8
|
-
* read path therefore unions the current inbox with one or more legacy inbox
|
|
9
|
-
* locations, deduplicated by envelope id — equivalent to reading several dirs
|
|
10
|
-
* as if they were one (same id-sorted order as the single-dir reader).
|
|
11
|
-
*
|
|
12
|
-
* Pure + total: the impure part (which dirs to read) belongs to the caller; this
|
|
13
|
-
* is the deterministic merge that is unit-tested in isolation.
|
|
14
|
-
*/
|
|
15
|
-
import { appendFileSync, existsSync, mkdirSync, readFileSync } from "node:fs";
|
|
16
|
-
import { join } from "node:path";
|
|
17
|
-
/**
|
|
18
|
-
* Merge envelope sets, deduplicated by `envelope.id`. Pass the CURRENT inbox
|
|
19
|
-
* first: on an id collision the earlier set wins (identical content is expected,
|
|
20
|
-
* but precedence is defined). Entries without a string `id` are skipped. The
|
|
21
|
-
* result is sorted by `id` ascending, matching the single-dir reader's
|
|
22
|
-
* filename `.sort()`, so a dual-read is indistinguishable from one merged dir.
|
|
23
|
-
*/
|
|
24
|
-
export function mergeInboxDedup(sets) {
|
|
25
|
-
const byId = new Map();
|
|
26
|
-
for (const set of sets) {
|
|
27
|
-
for (const env of set) {
|
|
28
|
-
const id = env?.id;
|
|
29
|
-
if (typeof id !== "string" || byId.has(id))
|
|
30
|
-
continue;
|
|
31
|
-
byId.set(id, env);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return [...byId.values()].sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Ratified migration rule (DEC-116, spec §Migration F4): the FIRST agent to
|
|
38
|
-
* prove possession of a legacy key inherits the legacy keyring and adopts the
|
|
39
|
-
* legacy id as an alias of its new perennial uuid; every de-collided peer mints
|
|
40
|
-
* **net-new keys** (honest re-key, surfaced in the migration notice). No proof
|
|
41
|
-
* → no inheritance. Pure + total. The adoption record + keyring copy are the
|
|
42
|
-
* caller's (impure, locked) job; this is the deterministic decision.
|
|
43
|
-
*/
|
|
44
|
-
export function decideLegacyAdoption(input) {
|
|
45
|
-
if (!input.provedLegacyPossession) {
|
|
46
|
-
return {
|
|
47
|
-
adopt: false,
|
|
48
|
-
netNewKeys: true,
|
|
49
|
-
reason: "no proof of possession of a legacy key — mint net-new keys"
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
if (input.legacyAlreadyAdopted) {
|
|
53
|
-
return {
|
|
54
|
-
adopt: false,
|
|
55
|
-
netNewKeys: true,
|
|
56
|
-
reason: "legacy id already adopted by a peer — de-collided peer mints net-new keys"
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
adopt: true,
|
|
61
|
-
netNewKeys: false,
|
|
62
|
-
reason: "first to prove possession — inherits legacy keyring, legacy id becomes an alias"
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
function identityDir(root) {
|
|
66
|
-
return join(root, "identity");
|
|
67
|
-
}
|
|
68
|
-
function aliasesFile(root) {
|
|
69
|
-
return join(identityDir(root), "aliases.jsonl");
|
|
70
|
-
}
|
|
71
|
-
export function listIdentityAliases(root, instance) {
|
|
72
|
-
const f = aliasesFile(root);
|
|
73
|
-
if (!existsSync(f))
|
|
74
|
-
return [];
|
|
75
|
-
const out = [];
|
|
76
|
-
for (const line of readFileSync(f, "utf8").split("\n")) {
|
|
77
|
-
if (!line.trim())
|
|
78
|
-
continue;
|
|
79
|
-
try {
|
|
80
|
-
const parsed = JSON.parse(line);
|
|
81
|
-
if (instance === undefined || parsed.instance === instance)
|
|
82
|
-
out.push(parsed);
|
|
83
|
-
}
|
|
84
|
-
catch {
|
|
85
|
-
// skip malformed alias records
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return out;
|
|
89
|
-
}
|
|
90
|
-
export function legacyAliasAlreadyAdopted(root, legacyInstance) {
|
|
91
|
-
return listIdentityAliases(root).some((alias) => alias.legacyInstance === legacyInstance && alias.adoptedKeyring);
|
|
92
|
-
}
|
|
93
|
-
export function recordIdentityAlias(root, alias) {
|
|
94
|
-
mkdirSync(identityDir(root), { recursive: true });
|
|
95
|
-
const exists = listIdentityAliases(root).some((entry) => entry.instance === alias.instance && entry.legacyInstance === alias.legacyInstance);
|
|
96
|
-
if (exists)
|
|
97
|
-
return;
|
|
98
|
-
appendFileSync(aliasesFile(root), `${JSON.stringify(alias)}\n`, "utf8");
|
|
99
|
-
}
|
|
100
|
-
//# sourceMappingURL=migration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migration.js","sourceRoot":"","sources":["../../../src/runtime/identity/migration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,IAA2C;IAE3C,MAAM,IAAI,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC5C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,KAAK,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;YACtB,MAAM,EAAE,GAAI,GAA+B,EAAE,EAAE,CAAC;YAChD,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;gBAAE,SAAS;YACrD,IAAI,CAAC,GAAG,CAAC,EA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AC1E,CAAC"}
|
|
@@ -1,42 +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 type { ProviderSessionReaders } from "./resolver.js";
|
|
10
|
-
export declare const defaultProviderSessionReaders: ProviderSessionReaders;
|
|
11
|
-
/**
|
|
12
|
-
* Injectable FS readers for `readHostSessionName` (test-friendly).
|
|
13
|
-
* Only reading is required; real-FS defaults are `defaultHostNameReaders`.
|
|
14
|
-
*/
|
|
15
|
-
export interface HostNameReaders {
|
|
16
|
-
/** Read up to `maxLines` newline-delimited lines from a file. Returns [] on any error. */
|
|
17
|
-
readLines(path: string, maxLines: number): string[];
|
|
18
|
-
/** List newline-delimited JSONL entries from `~/.codex/session_index.jsonl`. */
|
|
19
|
-
readCodexSessionIndex(): string[];
|
|
20
|
-
/** Whether the home dir root is known (for path construction). */
|
|
21
|
-
homedir(): string;
|
|
22
|
-
}
|
|
23
|
-
export declare const defaultHostNameReaders: HostNameReaders;
|
|
24
|
-
/**
|
|
25
|
-
* Read the host-native session name for the given session.
|
|
26
|
-
*
|
|
27
|
-
* - **claude**: reads the transcript JSONL (located via the CLAUDE_CODE_SESSION_ID
|
|
28
|
-
* resolver); scans the first 40 lines for `customTitle` (user rename) first,
|
|
29
|
-
* then falls back to `agentName`. Never returns `aiTitle`.
|
|
30
|
-
* - **codex**: reads `~/.codex/session_index.jsonl`; returns `thread_name` for
|
|
31
|
-
* the entry whose `id === sessionId` (last-match wins).
|
|
32
|
-
* - Other hosts: returns undefined.
|
|
33
|
-
*
|
|
34
|
-
* Always best-effort (returns undefined on any parse/IO error).
|
|
35
|
-
*/
|
|
36
|
-
export declare function readHostSessionName(opts: {
|
|
37
|
-
host: string;
|
|
38
|
-
cwd: string;
|
|
39
|
-
sessionId?: string;
|
|
40
|
-
readers?: HostNameReaders;
|
|
41
|
-
}): string | undefined;
|
|
42
|
-
//# sourceMappingURL=readers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"readers.d.ts","sourceRoot":"","sources":["../../../src/runtime/identity/readers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AA2F5D,eAAO,MAAM,6BAA6B,EAAE,sBAK3C,CAAC;AAIF;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,0FAA0F;IAC1F,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACpD,gFAAgF;IAChF,qBAAqB,IAAI,MAAM,EAAE,CAAC;IAClC,kEAAkE;IAClE,OAAO,IAAI,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,sBAAsB,EAAE,eAqBpC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B,GAAG,MAAM,GAAG,SAAS,CAcrB"}
|