aismemory 0.8.4 → 0.8.7
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/README.md +21 -5
- package/dist/agent-key-mode.d.ts +1 -0
- package/dist/agent-key-mode.js +41 -9
- package/dist/agent-preference.d.ts +11 -0
- package/dist/agent-preference.js +5 -0
- package/dist/ais-http-error.d.ts +1 -1
- package/dist/ais-http-error.js +1 -1
- package/dist/ais-http.d.ts +4 -0
- package/dist/ais-http.js +21 -6
- package/dist/auto-handoff.d.ts +1 -1
- package/dist/auto-handoff.js +5 -1
- package/dist/cli/doctor.js +3 -2
- package/dist/cli/enable-key-auth.js +2 -2
- package/dist/cli/export-harness.js +2 -2
- package/dist/cli/hooks.d.ts +33 -0
- package/dist/cli/hooks.js +93 -28
- package/dist/cli/install.js +3 -0
- package/dist/cli/invite-accept.js +2 -2
- package/dist/cli/owner-credentials.js +2 -2
- package/dist/cli/pull-memory.js +2 -2
- package/dist/cli/setup-core.d.ts +220 -0
- package/dist/cli/setup-core.js +2381 -0
- package/dist/cli/setup.d.ts +59 -0
- package/dist/cli/setup.js +407 -0
- package/dist/declared-agent.d.ts +2 -2
- package/dist/declared-agent.js +2 -2
- package/dist/held-operating-layer.d.ts +53 -0
- package/dist/held-operating-layer.js +59 -0
- package/dist/index.js +168 -53
- package/dist/key-auth.d.ts +36 -0
- package/dist/key-auth.js +148 -2
- package/dist/mcp/tools.d.ts +13 -2
- package/dist/mcp/tools.js +103 -26
- package/dist/mcp-instructions.d.ts +5 -3
- package/dist/mcp-instructions.js +5 -3
- package/dist/memory-forget.d.ts +39 -0
- package/dist/memory-forget.js +58 -0
- package/dist/oauth-credentials.d.ts +1 -1
- package/dist/oauth-credentials.js +3 -3
- package/dist/operating-layer-write.d.ts +134 -0
- package/dist/operating-layer-write.js +224 -0
- package/dist/pending-device-flow.d.ts +1 -1
- package/dist/pending-device-flow.js +1 -1
- package/dist/retry-after.d.ts +1 -1
- package/dist/retry-after.js +1 -1
- package/dist/run-pass-mode.js +12 -8
- package/dist/session-identity.d.ts +32 -0
- package/dist/session-identity.js +74 -1
- package/dist/session-start.d.ts +68 -0
- package/dist/session-start.js +176 -0
- package/dist/startup-identity.js +23 -3
- package/dist/token-manager.d.ts +14 -0
- package/dist/token-manager.js +68 -6
- package/dist/tool-args.d.ts +69 -2
- package/dist/tool-args.js +208 -4
- package/dist/workspace-key-mode.d.ts +2 -0
- package/dist/workspace-key-mode.js +14 -9
- package/package.json +3 -1
- package/dist/__tests__/agent-archive.test.d.ts +0 -1
- package/dist/__tests__/agent-archive.test.js +0 -153
- package/dist/__tests__/agent-archive.test.js.map +0 -1
- package/dist/__tests__/agent-key-mode-e2e.test.d.ts +0 -1
- package/dist/__tests__/agent-key-mode-e2e.test.js +0 -267
- package/dist/__tests__/agent-key-mode-e2e.test.js.map +0 -1
- package/dist/__tests__/agent-key-mode.test.d.ts +0 -1
- package/dist/__tests__/agent-key-mode.test.js +0 -524
- package/dist/__tests__/agent-key-mode.test.js.map +0 -1
- package/dist/__tests__/agent-load-persistence.test.d.ts +0 -1
- package/dist/__tests__/agent-load-persistence.test.js +0 -246
- package/dist/__tests__/agent-load-persistence.test.js.map +0 -1
- package/dist/__tests__/agent-load-session-override-e2e.test.d.ts +0 -1
- package/dist/__tests__/agent-load-session-override-e2e.test.js +0 -214
- package/dist/__tests__/agent-load-session-override-e2e.test.js.map +0 -1
- package/dist/__tests__/agent-preference.test.d.ts +0 -1
- package/dist/__tests__/agent-preference.test.js +0 -181
- package/dist/__tests__/agent-preference.test.js.map +0 -1
- package/dist/__tests__/agentmemory.test.d.ts +0 -1
- package/dist/__tests__/agentmemory.test.js +0 -73
- package/dist/__tests__/agentmemory.test.js.map +0 -1
- package/dist/__tests__/ais-http-error.test.d.ts +0 -1
- package/dist/__tests__/ais-http-error.test.js +0 -49
- package/dist/__tests__/ais-http-error.test.js.map +0 -1
- package/dist/__tests__/ais-http.test.d.ts +0 -1
- package/dist/__tests__/ais-http.test.js +0 -247
- package/dist/__tests__/ais-http.test.js.map +0 -1
- package/dist/__tests__/auth-staleness.test.d.ts +0 -9
- package/dist/__tests__/auth-staleness.test.js +0 -46
- package/dist/__tests__/auth-staleness.test.js.map +0 -1
- package/dist/__tests__/auto-enroll-key-e2e.test.d.ts +0 -1
- package/dist/__tests__/auto-enroll-key-e2e.test.js +0 -116
- package/dist/__tests__/auto-enroll-key-e2e.test.js.map +0 -1
- package/dist/__tests__/auto-enroll-key.test.d.ts +0 -1
- package/dist/__tests__/auto-enroll-key.test.js +0 -208
- package/dist/__tests__/auto-enroll-key.test.js.map +0 -1
- package/dist/__tests__/auto-handoff.test.d.ts +0 -1
- package/dist/__tests__/auto-handoff.test.js +0 -234
- package/dist/__tests__/auto-handoff.test.js.map +0 -1
- package/dist/__tests__/beacon-contract.test.d.ts +0 -1
- package/dist/__tests__/beacon-contract.test.js +0 -106
- package/dist/__tests__/beacon-contract.test.js.map +0 -1
- package/dist/__tests__/bond-link-survives-exit.test.d.ts +0 -1
- package/dist/__tests__/bond-link-survives-exit.test.js +0 -177
- package/dist/__tests__/bond-link-survives-exit.test.js.map +0 -1
- package/dist/__tests__/cli-info.test.d.ts +0 -1
- package/dist/__tests__/cli-info.test.js +0 -117
- package/dist/__tests__/cli-info.test.js.map +0 -1
- package/dist/__tests__/cli-review.test.d.ts +0 -1
- package/dist/__tests__/cli-review.test.js +0 -26
- package/dist/__tests__/cli-review.test.js.map +0 -1
- package/dist/__tests__/client-credential-expiry.test.d.ts +0 -1
- package/dist/__tests__/client-credential-expiry.test.js +0 -319
- package/dist/__tests__/client-credential-expiry.test.js.map +0 -1
- package/dist/__tests__/config.test.d.ts +0 -1
- package/dist/__tests__/config.test.js +0 -57
- package/dist/__tests__/config.test.js.map +0 -1
- package/dist/__tests__/credential-isolation.test.d.ts +0 -1
- package/dist/__tests__/credential-isolation.test.js +0 -175
- package/dist/__tests__/credential-isolation.test.js.map +0 -1
- package/dist/__tests__/credential-resolution.test.d.ts +0 -1
- package/dist/__tests__/credential-resolution.test.js +0 -195
- package/dist/__tests__/credential-resolution.test.js.map +0 -1
- package/dist/__tests__/credential-whoami.test.d.ts +0 -8
- package/dist/__tests__/credential-whoami.test.js +0 -93
- package/dist/__tests__/credential-whoami.test.js.map +0 -1
- package/dist/__tests__/declared-agent.test.d.ts +0 -1
- package/dist/__tests__/declared-agent.test.js +0 -60
- package/dist/__tests__/declared-agent.test.js.map +0 -1
- package/dist/__tests__/delegated-read-args.test.d.ts +0 -9
- package/dist/__tests__/delegated-read-args.test.js +0 -80
- package/dist/__tests__/delegated-read-args.test.js.map +0 -1
- package/dist/__tests__/device-flow-gate-e2e.test.d.ts +0 -1
- package/dist/__tests__/device-flow-gate-e2e.test.js +0 -251
- package/dist/__tests__/device-flow-gate-e2e.test.js.map +0 -1
- package/dist/__tests__/device-flow-pending-400.test.d.ts +0 -1
- package/dist/__tests__/device-flow-pending-400.test.js +0 -187
- package/dist/__tests__/device-flow-pending-400.test.js.map +0 -1
- package/dist/__tests__/device-flow-recovery.test.d.ts +0 -1
- package/dist/__tests__/device-flow-recovery.test.js +0 -210
- package/dist/__tests__/device-flow-recovery.test.js.map +0 -1
- package/dist/__tests__/device-poll.test.d.ts +0 -12
- package/dist/__tests__/device-poll.test.js +0 -191
- package/dist/__tests__/device-poll.test.js.map +0 -1
- package/dist/__tests__/doctor.test.d.ts +0 -1
- package/dist/__tests__/doctor.test.js +0 -599
- package/dist/__tests__/doctor.test.js.map +0 -1
- package/dist/__tests__/dream-poll.test.d.ts +0 -1
- package/dist/__tests__/dream-poll.test.js +0 -130
- package/dist/__tests__/dream-poll.test.js.map +0 -1
- package/dist/__tests__/enable-key-auth.test.d.ts +0 -1
- package/dist/__tests__/enable-key-auth.test.js +0 -180
- package/dist/__tests__/enable-key-auth.test.js.map +0 -1
- package/dist/__tests__/ender-receipt-auth.test.d.ts +0 -1
- package/dist/__tests__/ender-receipt-auth.test.js +0 -26
- package/dist/__tests__/ender-receipt-auth.test.js.map +0 -1
- package/dist/__tests__/env-agent.test.d.ts +0 -1
- package/dist/__tests__/env-agent.test.js +0 -19
- package/dist/__tests__/env-agent.test.js.map +0 -1
- package/dist/__tests__/existing-hashes.test.d.ts +0 -1
- package/dist/__tests__/existing-hashes.test.js +0 -119
- package/dist/__tests__/existing-hashes.test.js.map +0 -1
- package/dist/__tests__/fixtures/beacon-contract.d.ts +0 -66
- package/dist/__tests__/fixtures/beacon-contract.js +0 -72
- package/dist/__tests__/fixtures/beacon-contract.js.map +0 -1
- package/dist/__tests__/full-context-view-forwarding.test.d.ts +0 -1
- package/dist/__tests__/full-context-view-forwarding.test.js +0 -99
- package/dist/__tests__/full-context-view-forwarding.test.js.map +0 -1
- package/dist/__tests__/hooks.test.d.ts +0 -1
- package/dist/__tests__/hooks.test.js +0 -455
- package/dist/__tests__/hooks.test.js.map +0 -1
- package/dist/__tests__/hydration.test.d.ts +0 -1
- package/dist/__tests__/hydration.test.js +0 -206
- package/dist/__tests__/hydration.test.js.map +0 -1
- package/dist/__tests__/inbox-client.test.d.ts +0 -1
- package/dist/__tests__/inbox-client.test.js +0 -108
- package/dist/__tests__/inbox-client.test.js.map +0 -1
- package/dist/__tests__/install.test.d.ts +0 -1
- package/dist/__tests__/install.test.js +0 -153
- package/dist/__tests__/install.test.js.map +0 -1
- package/dist/__tests__/integration.test.d.ts +0 -1
- package/dist/__tests__/integration.test.js +0 -37
- package/dist/__tests__/integration.test.js.map +0 -1
- package/dist/__tests__/invite-accept.test.d.ts +0 -1
- package/dist/__tests__/invite-accept.test.js +0 -282
- package/dist/__tests__/invite-accept.test.js.map +0 -1
- package/dist/__tests__/key-auth.test.d.ts +0 -1
- package/dist/__tests__/key-auth.test.js +0 -290
- package/dist/__tests__/key-auth.test.js.map +0 -1
- package/dist/__tests__/keyauth-error-surface-e2e.test.d.ts +0 -1
- package/dist/__tests__/keyauth-error-surface-e2e.test.js +0 -209
- package/dist/__tests__/keyauth-error-surface-e2e.test.js.map +0 -1
- package/dist/__tests__/list-all-agents.test.d.ts +0 -1
- package/dist/__tests__/list-all-agents.test.js +0 -49
- package/dist/__tests__/list-all-agents.test.js.map +0 -1
- package/dist/__tests__/local-claude-source.test.d.ts +0 -1
- package/dist/__tests__/local-claude-source.test.js +0 -97
- package/dist/__tests__/local-claude-source.test.js.map +0 -1
- package/dist/__tests__/local-mirror.test.d.ts +0 -1
- package/dist/__tests__/local-mirror.test.js +0 -99
- package/dist/__tests__/local-mirror.test.js.map +0 -1
- package/dist/__tests__/lost-agent.test.d.ts +0 -1
- package/dist/__tests__/lost-agent.test.js +0 -159
- package/dist/__tests__/lost-agent.test.js.map +0 -1
- package/dist/__tests__/mcp-init-no-auth.test.d.ts +0 -1
- package/dist/__tests__/mcp-init-no-auth.test.js +0 -112
- package/dist/__tests__/mcp-init-no-auth.test.js.map +0 -1
- package/dist/__tests__/mcp-instructions.test.d.ts +0 -1
- package/dist/__tests__/mcp-instructions.test.js +0 -26
- package/dist/__tests__/mcp-instructions.test.js.map +0 -1
- package/dist/__tests__/mcp-tools.test.d.ts +0 -1
- package/dist/__tests__/mcp-tools.test.js +0 -493
- package/dist/__tests__/mcp-tools.test.js.map +0 -1
- package/dist/__tests__/memory-export.test.d.ts +0 -1
- package/dist/__tests__/memory-export.test.js +0 -78
- package/dist/__tests__/memory-export.test.js.map +0 -1
- package/dist/__tests__/memory-pull.test.d.ts +0 -1
- package/dist/__tests__/memory-pull.test.js +0 -380
- package/dist/__tests__/memory-pull.test.js.map +0 -1
- package/dist/__tests__/memory-write-failure.test.d.ts +0 -1
- package/dist/__tests__/memory-write-failure.test.js +0 -178
- package/dist/__tests__/memory-write-failure.test.js.map +0 -1
- package/dist/__tests__/missing-credential-help.test.d.ts +0 -1
- package/dist/__tests__/missing-credential-help.test.js +0 -14
- package/dist/__tests__/missing-credential-help.test.js.map +0 -1
- package/dist/__tests__/no-registered-keys-disk-bearer-fallback.test.d.ts +0 -1
- package/dist/__tests__/no-registered-keys-disk-bearer-fallback.test.js +0 -204
- package/dist/__tests__/no-registered-keys-disk-bearer-fallback.test.js.map +0 -1
- package/dist/__tests__/oauth-credentials.test.d.ts +0 -1
- package/dist/__tests__/oauth-credentials.test.js +0 -29
- package/dist/__tests__/oauth-credentials.test.js.map +0 -1
- package/dist/__tests__/owner-credentials.test.d.ts +0 -1
- package/dist/__tests__/owner-credentials.test.js +0 -250
- package/dist/__tests__/owner-credentials.test.js.map +0 -1
- package/dist/__tests__/owner-keychain-agent-load.test.d.ts +0 -1
- package/dist/__tests__/owner-keychain-agent-load.test.js +0 -57
- package/dist/__tests__/owner-keychain-agent-load.test.js.map +0 -1
- package/dist/__tests__/pending-device-flow-e2e.test.d.ts +0 -19
- package/dist/__tests__/pending-device-flow-e2e.test.js +0 -180
- package/dist/__tests__/pending-device-flow-e2e.test.js.map +0 -1
- package/dist/__tests__/pending-device-flow-resume.test.d.ts +0 -1
- package/dist/__tests__/pending-device-flow-resume.test.js +0 -104
- package/dist/__tests__/pending-device-flow-resume.test.js.map +0 -1
- package/dist/__tests__/pending-device-flow.test.d.ts +0 -15
- package/dist/__tests__/pending-device-flow.test.js +0 -108
- package/dist/__tests__/pending-device-flow.test.js.map +0 -1
- package/dist/__tests__/pipeline-ingestion.test.d.ts +0 -1
- package/dist/__tests__/pipeline-ingestion.test.js +0 -286
- package/dist/__tests__/pipeline-ingestion.test.js.map +0 -1
- package/dist/__tests__/pipeline-scope-resolver.test.d.ts +0 -1
- package/dist/__tests__/pipeline-scope-resolver.test.js +0 -51
- package/dist/__tests__/pipeline-scope-resolver.test.js.map +0 -1
- package/dist/__tests__/pipeline-trust-tagger.test.d.ts +0 -1
- package/dist/__tests__/pipeline-trust-tagger.test.js +0 -24
- package/dist/__tests__/pipeline-trust-tagger.test.js.map +0 -1
- package/dist/__tests__/prompt-resource.test.d.ts +0 -1
- package/dist/__tests__/prompt-resource.test.js +0 -219
- package/dist/__tests__/prompt-resource.test.js.map +0 -1
- package/dist/__tests__/provisional-register-mcp-remember.test.d.ts +0 -1
- package/dist/__tests__/provisional-register-mcp-remember.test.js +0 -192
- package/dist/__tests__/provisional-register-mcp-remember.test.js.map +0 -1
- package/dist/__tests__/provisional-token-reauth.test.d.ts +0 -1
- package/dist/__tests__/provisional-token-reauth.test.js +0 -156
- package/dist/__tests__/provisional-token-reauth.test.js.map +0 -1
- package/dist/__tests__/read-claude-memory-tree.test.d.ts +0 -1
- package/dist/__tests__/read-claude-memory-tree.test.js +0 -37
- package/dist/__tests__/read-claude-memory-tree.test.js.map +0 -1
- package/dist/__tests__/readme-quickstart-default-ais-url.test.d.ts +0 -1
- package/dist/__tests__/readme-quickstart-default-ais-url.test.js +0 -80
- package/dist/__tests__/readme-quickstart-default-ais-url.test.js.map +0 -1
- package/dist/__tests__/readme-tools-parity.test.d.ts +0 -1
- package/dist/__tests__/readme-tools-parity.test.js +0 -64
- package/dist/__tests__/readme-tools-parity.test.js.map +0 -1
- package/dist/__tests__/recall-order-by.test.d.ts +0 -1
- package/dist/__tests__/recall-order-by.test.js +0 -115
- package/dist/__tests__/recall-order-by.test.js.map +0 -1
- package/dist/__tests__/reconnect-survival-e2e.test.d.ts +0 -1
- package/dist/__tests__/reconnect-survival-e2e.test.js +0 -319
- package/dist/__tests__/reconnect-survival-e2e.test.js.map +0 -1
- package/dist/__tests__/refresh.test.d.ts +0 -1
- package/dist/__tests__/refresh.test.js +0 -119
- package/dist/__tests__/refresh.test.js.map +0 -1
- package/dist/__tests__/remember-duplicate-truth.test.d.ts +0 -13
- package/dist/__tests__/remember-duplicate-truth.test.js +0 -117
- package/dist/__tests__/remember-duplicate-truth.test.js.map +0 -1
- package/dist/__tests__/request-timeout.test.d.ts +0 -1
- package/dist/__tests__/request-timeout.test.js +0 -55
- package/dist/__tests__/request-timeout.test.js.map +0 -1
- package/dist/__tests__/resolve-agent-preference-e2e.test.d.ts +0 -1
- package/dist/__tests__/resolve-agent-preference-e2e.test.js +0 -185
- package/dist/__tests__/resolve-agent-preference-e2e.test.js.map +0 -1
- package/dist/__tests__/resolve-agent-preference.test.d.ts +0 -1
- package/dist/__tests__/resolve-agent-preference.test.js +0 -94
- package/dist/__tests__/resolve-agent-preference.test.js.map +0 -1
- package/dist/__tests__/retry-after.test.d.ts +0 -4
- package/dist/__tests__/retry-after.test.js +0 -187
- package/dist/__tests__/retry-after.test.js.map +0 -1
- package/dist/__tests__/run-pass-mode.test.d.ts +0 -1
- package/dist/__tests__/run-pass-mode.test.js +0 -163
- package/dist/__tests__/run-pass-mode.test.js.map +0 -1
- package/dist/__tests__/session-identity.test.d.ts +0 -1
- package/dist/__tests__/session-identity.test.js +0 -276
- package/dist/__tests__/session-identity.test.js.map +0 -1
- package/dist/__tests__/signin-keychain.test.d.ts +0 -1
- package/dist/__tests__/signin-keychain.test.js +0 -79
- package/dist/__tests__/signin-keychain.test.js.map +0 -1
- package/dist/__tests__/silent-renewal-e2e.test.d.ts +0 -1
- package/dist/__tests__/silent-renewal-e2e.test.js +0 -249
- package/dist/__tests__/silent-renewal-e2e.test.js.map +0 -1
- package/dist/__tests__/split-brain-upgrade-e2e.test.d.ts +0 -1
- package/dist/__tests__/split-brain-upgrade-e2e.test.js +0 -206
- package/dist/__tests__/split-brain-upgrade-e2e.test.js.map +0 -1
- package/dist/__tests__/startup-credential-warning-e2e.test.d.ts +0 -1
- package/dist/__tests__/startup-credential-warning-e2e.test.js +0 -102
- package/dist/__tests__/startup-credential-warning-e2e.test.js.map +0 -1
- package/dist/__tests__/startup-identity.test.d.ts +0 -1
- package/dist/__tests__/startup-identity.test.js +0 -213
- package/dist/__tests__/startup-identity.test.js.map +0 -1
- package/dist/__tests__/sync-auth.test.d.ts +0 -1
- package/dist/__tests__/sync-auth.test.js +0 -69
- package/dist/__tests__/sync-auth.test.js.map +0 -1
- package/dist/__tests__/sync-doc.test.d.ts +0 -1
- package/dist/__tests__/sync-doc.test.js +0 -13
- package/dist/__tests__/sync-doc.test.js.map +0 -1
- package/dist/__tests__/sync-memory-cli.test.d.ts +0 -1
- package/dist/__tests__/sync-memory-cli.test.js +0 -200
- package/dist/__tests__/sync-memory-cli.test.js.map +0 -1
- package/dist/__tests__/telemetry.test.d.ts +0 -1
- package/dist/__tests__/telemetry.test.js +0 -67
- package/dist/__tests__/telemetry.test.js.map +0 -1
- package/dist/__tests__/token-expiry-reauth.test.d.ts +0 -1
- package/dist/__tests__/token-expiry-reauth.test.js +0 -201
- package/dist/__tests__/token-expiry-reauth.test.js.map +0 -1
- package/dist/__tests__/token-manager.test.d.ts +0 -1
- package/dist/__tests__/token-manager.test.js +0 -422
- package/dist/__tests__/token-manager.test.js.map +0 -1
- package/dist/__tests__/token-rejection-reauth-e2e.test.d.ts +0 -1
- package/dist/__tests__/token-rejection-reauth-e2e.test.js +0 -219
- package/dist/__tests__/token-rejection-reauth-e2e.test.js.map +0 -1
- package/dist/__tests__/tool-args.test.d.ts +0 -1
- package/dist/__tests__/tool-args.test.js +0 -289
- package/dist/__tests__/tool-args.test.js.map +0 -1
- package/dist/__tests__/trust-ledger.test.d.ts +0 -1
- package/dist/__tests__/trust-ledger.test.js +0 -55
- package/dist/__tests__/trust-ledger.test.js.map +0 -1
- package/dist/__tests__/version-check.test.d.ts +0 -1
- package/dist/__tests__/version-check.test.js +0 -364
- package/dist/__tests__/version-check.test.js.map +0 -1
- package/dist/__tests__/workspace-key-mode.test.d.ts +0 -1
- package/dist/__tests__/workspace-key-mode.test.js +0 -442
- package/dist/__tests__/workspace-key-mode.test.js.map +0 -1
- package/dist/agent-archive.js.map +0 -1
- package/dist/agent-key-mode.js.map +0 -1
- package/dist/agent-preference.js.map +0 -1
- package/dist/ais-http-error.js.map +0 -1
- package/dist/ais-http.js.map +0 -1
- package/dist/auth-staleness.js.map +0 -1
- package/dist/auto-handoff.js.map +0 -1
- package/dist/cli/doctor.js.map +0 -1
- package/dist/cli/enable-key-auth.js.map +0 -1
- package/dist/cli/export-harness.js.map +0 -1
- package/dist/cli/hooks.js.map +0 -1
- package/dist/cli/install.js.map +0 -1
- package/dist/cli/invite-accept.js.map +0 -1
- package/dist/cli/orientation.js.map +0 -1
- package/dist/cli/owner-credentials.js.map +0 -1
- package/dist/cli/pull-memory.js.map +0 -1
- package/dist/cli/read-claude-memory-tree.js.map +0 -1
- package/dist/cli/sync-memory.js.map +0 -1
- package/dist/cli-info.js.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/credential-expiry.js.map +0 -1
- package/dist/credential-whoami.js.map +0 -1
- package/dist/declared-agent.js.map +0 -1
- package/dist/device-poll.js.map +0 -1
- package/dist/dream-poll.js.map +0 -1
- package/dist/env-agent.js.map +0 -1
- package/dist/hydration.js.map +0 -1
- package/dist/inbox-client.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/key-auth.js.map +0 -1
- package/dist/local-mirror.js.map +0 -1
- package/dist/mcp/tools.js.map +0 -1
- package/dist/mcp-instructions.js.map +0 -1
- package/dist/memory-export.js.map +0 -1
- package/dist/memory-pull.js.map +0 -1
- package/dist/oauth-credentials.js.map +0 -1
- package/dist/pending-device-flow.js.map +0 -1
- package/dist/pipeline/bulk-store.js.map +0 -1
- package/dist/pipeline/dedupe.js.map +0 -1
- package/dist/pipeline/existing-hashes.js.map +0 -1
- package/dist/pipeline/ingestion.js.map +0 -1
- package/dist/pipeline/scope-resolver.js.map +0 -1
- package/dist/pipeline/sync-auth.js.map +0 -1
- package/dist/pipeline/trust-tagger.js.map +0 -1
- package/dist/pipeline/types.js.map +0 -1
- package/dist/prompt-resource.js.map +0 -1
- package/dist/refresh.js.map +0 -1
- package/dist/request-timeout.js.map +0 -1
- package/dist/retry-after.js.map +0 -1
- package/dist/review/cli-review.js.map +0 -1
- package/dist/run-pass-mode.js.map +0 -1
- package/dist/session-identity.js.map +0 -1
- package/dist/signin-keychain.js.map +0 -1
- package/dist/sources/local-claude.js.map +0 -1
- package/dist/sources/types.js.map +0 -1
- package/dist/startup-identity.js.map +0 -1
- package/dist/telemetry.js.map +0 -1
- package/dist/token-manager.js.map +0 -1
- package/dist/tool-args.js.map +0 -1
- package/dist/trust-ledger.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/version-check.js.map +0 -1
- package/dist/workspace-key-mode.js.map +0 -1
package/dist/cli/hooks.js
CHANGED
|
@@ -23,7 +23,7 @@ import { homedir } from 'node:os';
|
|
|
23
23
|
import { basename, dirname, join, resolve } from 'node:path';
|
|
24
24
|
import { parseArgs, promisify } from 'node:util';
|
|
25
25
|
import { z } from 'zod';
|
|
26
|
-
import { aisGet, aisPost,
|
|
26
|
+
import { aisGet, aisPost, resolveAisUrl } from '../ais-http.js';
|
|
27
27
|
import { AisHttpError } from '../ais-http-error.js';
|
|
28
28
|
import { isAuthErrorResult, isCredsStale, isNoRegisteredKeysAuthError } from '../auth-staleness.js';
|
|
29
29
|
import { hasEnrolledKey, tryKeyAuth } from '../key-auth.js';
|
|
@@ -34,6 +34,8 @@ import { dispatchToolWorkspaceKeyMode, loadWorkspaceKeyConfig } from '../workspa
|
|
|
34
34
|
import { dispatchToolRunPassMode, loadRunPassConfig, readRunPassFile } from '../run-pass-mode.js';
|
|
35
35
|
import { identityCredentialFingerprint, loadSessionIdentity, verifyPinnedIdentity, } from '../session-identity.js';
|
|
36
36
|
import { buildFullContextQuery, parseFullContextArgs, parseHandoffArgs } from '../tool-args.js';
|
|
37
|
+
import { operatingLayerCachePath, readOperatingLayerCache, verifiedOperatingLayer, writeOperatingLayerCache } from '../held-operating-layer.js';
|
|
38
|
+
import { VERIFIED_HELD_LAYER } from '../tool-args.js';
|
|
37
39
|
import { readPackageVersion } from '../version-check.js';
|
|
38
40
|
// ── install ─────────────────────────────────────────────
|
|
39
41
|
const HOOK_ENTRIES = [
|
|
@@ -86,16 +88,52 @@ export function mergeHookSettings(settings, version) {
|
|
|
86
88
|
merged['hooks'] = hooks;
|
|
87
89
|
return merged;
|
|
88
90
|
}
|
|
91
|
+
/** Write `content` beside `targetPath` then rename over it; preserves mode when the file exists. */
|
|
92
|
+
export function writeTextFileAtomic(targetPath, content) {
|
|
93
|
+
let mode;
|
|
94
|
+
if (existsSync(targetPath)) {
|
|
95
|
+
const real = realpathSync(targetPath);
|
|
96
|
+
mode = statSync(real).mode & 0o777;
|
|
97
|
+
targetPath = real;
|
|
98
|
+
}
|
|
99
|
+
mkdirSync(dirname(targetPath), { recursive: true });
|
|
100
|
+
const tmpPath = join(dirname(targetPath), `.${basename(targetPath)}.aismemory-${randomBytes(6).toString('hex')}.tmp`);
|
|
101
|
+
try {
|
|
102
|
+
writeFileSync(tmpPath, content, { encoding: 'utf-8', flag: 'wx', ...(mode !== undefined ? { mode } : {}) });
|
|
103
|
+
if (mode !== undefined)
|
|
104
|
+
chmodSync(tmpPath, mode);
|
|
105
|
+
renameSync(tmpPath, targetPath);
|
|
106
|
+
}
|
|
107
|
+
catch (err) {
|
|
108
|
+
rmSync(tmpPath, { force: true });
|
|
109
|
+
throw err;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/** Backs up `path` to `path.aismemory-backup` once, with the source file's permissions. */
|
|
113
|
+
export async function backupFileOnce(sourcePath) {
|
|
114
|
+
if (!existsSync(sourcePath))
|
|
115
|
+
return;
|
|
116
|
+
const dest = `${sourcePath}.aismemory-backup`;
|
|
117
|
+
if (existsSync(dest))
|
|
118
|
+
return;
|
|
119
|
+
const mode = statSync(sourcePath).mode & 0o777;
|
|
120
|
+
const data = readFileSync(sourcePath);
|
|
121
|
+
const handle = await open(dest, 'wx', mode);
|
|
122
|
+
try {
|
|
123
|
+
await handle.writeFile(data);
|
|
124
|
+
}
|
|
125
|
+
finally {
|
|
126
|
+
await handle.close();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
89
129
|
export function installHooks(opts) {
|
|
90
130
|
const settingsDir = join(resolve(opts.dir), '.claude');
|
|
91
131
|
const settingsPath = join(settingsDir, opts.local === true ? 'settings.local.json' : 'settings.json');
|
|
92
132
|
let existing = {};
|
|
93
133
|
// A dotfiles-managed symlink is followed, so its target is the file that changes.
|
|
94
134
|
let targetPath = settingsPath;
|
|
95
|
-
let mode;
|
|
96
135
|
if (existsSync(settingsPath)) {
|
|
97
136
|
targetPath = realpathSync(settingsPath);
|
|
98
|
-
mode = statSync(targetPath).mode & 0o777;
|
|
99
137
|
let parsed;
|
|
100
138
|
try {
|
|
101
139
|
parsed = JSON.parse(readFileSync(targetPath, 'utf-8'));
|
|
@@ -110,28 +148,15 @@ export function installHooks(opts) {
|
|
|
110
148
|
const json = `${JSON.stringify(mergeHookSettings(existing, opts.version), null, 2)}\n`;
|
|
111
149
|
if (opts.dryRun)
|
|
112
150
|
return { settingsPath, json, written: false };
|
|
113
|
-
|
|
114
|
-
// Write beside the real target and rename, so an interrupted write never
|
|
115
|
-
// leaves a half file. 'wx' refuses a pre-planted tmp path or symlink.
|
|
116
|
-
const tmpPath = join(dirname(targetPath), `.${basename(targetPath)}.aismemory-${randomBytes(6).toString('hex')}.tmp`);
|
|
117
|
-
try {
|
|
118
|
-
writeFileSync(tmpPath, json, { encoding: 'utf-8', flag: 'wx', ...(mode !== undefined ? { mode } : {}) });
|
|
119
|
-
if (mode !== undefined)
|
|
120
|
-
chmodSync(tmpPath, mode);
|
|
121
|
-
renameSync(tmpPath, targetPath);
|
|
122
|
-
}
|
|
123
|
-
catch (err) {
|
|
124
|
-
rmSync(tmpPath, { force: true });
|
|
125
|
-
throw err;
|
|
126
|
-
}
|
|
151
|
+
writeTextFileAtomic(targetPath, json);
|
|
127
152
|
return { settingsPath, json, written: true };
|
|
128
153
|
}
|
|
129
154
|
/** A failure whose message is already the one-line, secret-free hint we print. */
|
|
130
|
-
class HookFailure extends Error {
|
|
155
|
+
export class HookFailure extends Error {
|
|
131
156
|
}
|
|
132
|
-
const NO_CREDENTIAL_HINT = 'no credential; set AIS_WORKSPACE_KEY and AIS_AGENT_ID or run aismemory to sign in';
|
|
133
|
-
async function resolveHookClient(env, home) {
|
|
134
|
-
const aisUrl = env['AIS_URL']
|
|
157
|
+
export const NO_CREDENTIAL_HINT = 'no credential; set AIS_WORKSPACE_KEY and AIS_AGENT_ID or run aismemory to sign in';
|
|
158
|
+
export async function resolveHookClient(env, home) {
|
|
159
|
+
const aisUrl = resolveAisUrl(env['AIS_URL']);
|
|
135
160
|
let pin;
|
|
136
161
|
try {
|
|
137
162
|
pin = loadSessionIdentity(env);
|
|
@@ -344,7 +369,7 @@ const operatingLayerSchema = z.object({
|
|
|
344
369
|
/*
|
|
345
370
|
* record-usage auto-creates a skill row named by the caller, outside the
|
|
346
371
|
* audited own: store; its name is not owner-reviewed text, so it never
|
|
347
|
-
* enters this block (
|
|
372
|
+
* enters this block (CORBOT-AE5B019F r1).
|
|
348
373
|
*/
|
|
349
374
|
const AUTO_CREATED_SKILL = 'Auto-created from usage recording';
|
|
350
375
|
/** Per-run tags: stored text cannot guess the nonce, so it cannot close the block. */
|
|
@@ -373,16 +398,19 @@ const TRUNCATED = '… (truncated)';
|
|
|
373
398
|
// Zero-width, soft-hyphen, combining-grapheme-joiner, bidi-control, variation
|
|
374
399
|
// selector, BOM and tag characters.
|
|
375
400
|
const INVISIBLES = /[\u00AD\u034F\u061C\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u2069\uFE00-\uFE0F\uFEFF]|\uDB40[\uDC00-\uDC7F]/g;
|
|
401
|
+
const VARIATION_SUPPLEMENT = /[\u{E0100}-\u{E01EF}]/gu;
|
|
402
|
+
/** Strip zero-width and bidi controls from rule text (same set as {@link inline}). */
|
|
403
|
+
export function stripInvisibles(text) {
|
|
404
|
+
return text.normalize('NFKC').replace(INVISIBLES, '').replace(VARIATION_SUPPLEMENT, '');
|
|
405
|
+
}
|
|
376
406
|
/**
|
|
377
407
|
* Stored text is one line and never a heading: other principals (grant
|
|
378
408
|
* holders, shared sources) can write these fields. The nonce is what stops a
|
|
379
409
|
* forged close tag; neutralising the plain tag forms (after NFKC folds
|
|
380
410
|
* fullwidth brackets) only keeps the block readable.
|
|
381
411
|
*/
|
|
382
|
-
function inline(text) {
|
|
383
|
-
return text
|
|
384
|
-
.normalize('NFKC')
|
|
385
|
-
.replace(INVISIBLES, '')
|
|
412
|
+
export function inline(text) {
|
|
413
|
+
return stripInvisibles(text)
|
|
386
414
|
.replace(/\p{Pd}/gu, '-')
|
|
387
415
|
.replace(/[\s\u0085]+/g, ' ')
|
|
388
416
|
.trim()
|
|
@@ -463,14 +491,51 @@ export function formatSessionContext(response, agentId, nonce = randomBytes(8).t
|
|
|
463
491
|
}
|
|
464
492
|
export async function runSessionStart(deps = {}) {
|
|
465
493
|
try {
|
|
466
|
-
const
|
|
467
|
-
const
|
|
494
|
+
const home = deps.home ?? homedir();
|
|
495
|
+
const env = deps.env ?? process.env;
|
|
496
|
+
const client = await resolveHookClient(env, home);
|
|
497
|
+
const path = operatingLayerCachePath(home, resolveAisUrl(env['AIS_URL']), client.agentId, client.credentialKey);
|
|
498
|
+
const cached = readOperatingLayerCache(path);
|
|
499
|
+
let response = await client.call('full_context', { memoriesLimit: SESSION_START_MEMORIES, ...(cached ? { [VERIFIED_HELD_LAYER]: cached.version } : {}) });
|
|
500
|
+
let parsed = fullContextResponseSchema.safeParse(response);
|
|
501
|
+
if (parsed.success && parsed.data.data['operatingLayerUnchanged'] !== undefined) {
|
|
502
|
+
const data = parsed.data.data;
|
|
503
|
+
const counts = data['operatingLayerCounts'];
|
|
504
|
+
if (cached && isPlainObject(counts) && counts['ruleCount'] === cached.ruleCount && counts['skillCount'] === cached.skillCount && counts['truncated'] === false && data['operatingLayerUnchanged'] === true && data['operatingLayerVersion'] === cached.version && data.operatingLayer === null) {
|
|
505
|
+
response = { ...parsed.data, data: { ...data, operatingLayer: cached } };
|
|
506
|
+
}
|
|
507
|
+
else {
|
|
508
|
+
response = await client.call('full_context', { memoriesLimit: SESSION_START_MEMORIES });
|
|
509
|
+
parsed = fullContextResponseSchema.safeParse(response);
|
|
510
|
+
if (!parsed.success || parsed.data.data['operatingLayerUnchanged'] !== undefined)
|
|
511
|
+
throw new HookFailure('AIS did not return a full operating layer');
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
else if (!parsed.success && cached) {
|
|
515
|
+
response = await client.call('full_context', { memoriesLimit: SESSION_START_MEMORIES });
|
|
516
|
+
}
|
|
517
|
+
parsed = fullContextResponseSchema.safeParse(response);
|
|
518
|
+
const layer = parsed.success ? verifiedOperatingLayer(parsed.data.data.operatingLayer) : null;
|
|
519
|
+
if (layer) {
|
|
520
|
+
try {
|
|
521
|
+
writeOperatingLayerCache(path, layer);
|
|
522
|
+
}
|
|
523
|
+
catch {
|
|
524
|
+
return { stdout: formatSessionContext(response, client.agentId), stderr: 'aismemory hook: operating layer cache could not be saved\n' };
|
|
525
|
+
}
|
|
526
|
+
}
|
|
468
527
|
return { stdout: formatSessionContext(response, client.agentId), stderr: '' };
|
|
469
528
|
}
|
|
470
529
|
catch (err) {
|
|
471
530
|
return { stdout: '', stderr: describeHookFailure(err) };
|
|
472
531
|
}
|
|
473
532
|
}
|
|
533
|
+
/** Authenticated `full_context` for setup planning (no MCP tool mocking). */
|
|
534
|
+
export async function fetchSetupFullContext(deps = {}) {
|
|
535
|
+
const client = await resolveHookClient(deps.env ?? process.env, deps.home ?? homedir());
|
|
536
|
+
const response = await client.call('full_context', { memoriesLimit: SESSION_START_MEMORIES });
|
|
537
|
+
return { response, client };
|
|
538
|
+
}
|
|
474
539
|
// ── pre-compact ─────────────────────────────────────────
|
|
475
540
|
const MAX_UNCOMMITTED = 30;
|
|
476
541
|
const MAX_USER_MESSAGE_CHARS = 1000;
|
package/dist/cli/install.js
CHANGED
|
@@ -18,12 +18,15 @@ export function renderEntryInstructions(agentId) {
|
|
|
18
18
|
return `# AIS Memory entry instructions: ${agentId}
|
|
19
19
|
|
|
20
20
|
This session is pinned to AIS agent \`${agentId}\` through its MCP config.
|
|
21
|
+
One agent per session — other sessions on this machine may run as other agents.
|
|
21
22
|
Call these in order at the start of every session:
|
|
22
23
|
|
|
23
24
|
1. \`whoami\`: confirm the active identity is \`${agentId}\`, or complete authentication if it asks.
|
|
24
25
|
2. \`full_context\`: load the identity, constitution and goals.
|
|
25
26
|
3. Operating layer: follow the instructions and goals \`full_context\` returns; \`recall\` before answering from past context and \`remember\` each decision or lesson worth keeping.
|
|
26
27
|
|
|
28
|
+
Before your first \`remember\` or other gated write, call \`agent_load\` with \`${agentId}\` (or the name you act as). After an MCP reconnect the session is unconfirmed until \`agent_load\` runs again — \`whoami\` alone is not enough for writes.
|
|
29
|
+
|
|
27
30
|
No credentials are stored in this file or the MCP config. Authenticate through \`whoami\`.
|
|
28
31
|
`;
|
|
29
32
|
}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
import { chmodSync, lstatSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
24
24
|
import { homedir } from 'node:os';
|
|
25
25
|
import { dirname, join } from 'node:path';
|
|
26
|
-
import {
|
|
26
|
+
import { resolveAisUrl } from '../ais-http.js';
|
|
27
27
|
import { credentialsFilePath } from '../oauth-credentials.js';
|
|
28
28
|
const USAGE = `aismemory invite accept — join Agents & Swarms with a friends invite
|
|
29
29
|
|
|
@@ -247,7 +247,7 @@ export async function main(argv, deps = {
|
|
|
247
247
|
return;
|
|
248
248
|
}
|
|
249
249
|
const token = await readInviteToken(args, deps);
|
|
250
|
-
const aisUrl = (deps.env['AIS_URL']
|
|
250
|
+
const aisUrl = resolveAisUrl(deps.env['AIS_URL']).replace(/\/+$/, '');
|
|
251
251
|
const { bearer, ...result } = await acceptInvite(aisUrl, token, args.name, deps.fetchImpl);
|
|
252
252
|
if (bearer === 'mismatch') {
|
|
253
253
|
result.credentialsSaved = false;
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* stored credential to update). List output carries non-secret fields only.
|
|
33
33
|
* Error messages never include request bodies, headers, or the owner token.
|
|
34
34
|
*/
|
|
35
|
-
import {
|
|
35
|
+
import { resolveAisUrl } from '../ais-http.js';
|
|
36
36
|
import { extractServerMessage } from '../ais-http-error.js';
|
|
37
37
|
import { decodeEnrollmentClaims, tryKeyAuth } from '../key-auth.js';
|
|
38
38
|
export class OwnerCredentialsError extends Error {
|
|
@@ -254,7 +254,7 @@ export async function runOwnerCommand(command, argv, deps) {
|
|
|
254
254
|
deps.stdout(USAGE);
|
|
255
255
|
return;
|
|
256
256
|
}
|
|
257
|
-
const aisUrl = (deps.env['AIS_URL']
|
|
257
|
+
const aisUrl = resolveAisUrl(deps.env['AIS_URL']).replace(/\/+$/, '');
|
|
258
258
|
const session = await deps.getOwnerSession(aisUrl);
|
|
259
259
|
if (session === null) {
|
|
260
260
|
const hasAgentCredential = ['AIS_API_KEY', 'AIS_AGENT_API_KEY', 'AIS_WORKSPACE_KEY', 'AIS_RUN_PASS_FILE'].some((name) => (deps.env[name] ?? '').trim() !== '');
|
package/dist/cli/pull-memory.js
CHANGED
|
@@ -24,7 +24,7 @@ import { dirname, join, resolve } from 'node:path';
|
|
|
24
24
|
import { homedir } from 'node:os';
|
|
25
25
|
import { pathToFileURL } from 'node:url';
|
|
26
26
|
import { loadAgentApiKeyConfig, AgentApiKeyConfigError } from '../agent-key-mode.js';
|
|
27
|
-
import { DEFAULT_AIS_URL } from '../ais-http.js';
|
|
27
|
+
import { DEFAULT_AIS_URL, resolveAisUrl } from '../ais-http.js';
|
|
28
28
|
import { pullMemories, toJsonLines, describePullFailure, MAX_PAGE_SIZE, } from '../memory-pull.js';
|
|
29
29
|
const USAGE = `aismemory pull — copy this agent's memories into a local JSON Lines backup
|
|
30
30
|
|
|
@@ -109,7 +109,7 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
109
109
|
throw new Error('AIS_API_KEY is not set. aismemory pull needs an agent API key and AIS_AGENT_ID ' +
|
|
110
110
|
'so it can read that agent\'s own memories.');
|
|
111
111
|
}
|
|
112
|
-
const aisUrl = (process.env['AIS_URL']
|
|
112
|
+
const aisUrl = resolveAisUrl(process.env['AIS_URL']).replace(/\/+$/, '');
|
|
113
113
|
const outPath = args.out ? resolve(args.out) : defaultBackupPath(config.agentId);
|
|
114
114
|
const onProgress = args.quiet
|
|
115
115
|
? undefined
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { type SessionIdentity } from '../session-identity.js';
|
|
2
|
+
import { type HookClient } from './hooks.js';
|
|
3
|
+
export declare const SETUP_NEW_WARNING = "This is new and has not been checked end to end on a fresh machine yet.";
|
|
4
|
+
/** Prefix for setup-owned MCP connections (distinct from `aismemory` install). */
|
|
5
|
+
export declare const SETUP_MCP_NAME_PREFIX = "aismemory-setup-";
|
|
6
|
+
export declare const CURSOR_SETUP_FILE_MARKER = "# made by aismemory setup";
|
|
7
|
+
export declare function setupMcpServerName(agentId: string): string;
|
|
8
|
+
export declare function configReadErrorMessage(path: string): string;
|
|
9
|
+
export type SetupToolId = 'claude-code' | 'cursor' | 'codex';
|
|
10
|
+
export type SetupChangeStatus = 'new' | 'changed' | 'unchanged' | 'skipped';
|
|
11
|
+
export interface SetupMcpPlan {
|
|
12
|
+
transport: 'file' | 'command';
|
|
13
|
+
path: string;
|
|
14
|
+
status: SetupChangeStatus;
|
|
15
|
+
/** Full file content after apply (file transport only). */
|
|
16
|
+
content?: string;
|
|
17
|
+
/** Fingerprint of file content at plan time (file transport only). */
|
|
18
|
+
planFingerprint: string | null;
|
|
19
|
+
/** JSON object for our server entry only (safe to print). */
|
|
20
|
+
ourServerEntry: Record<string, unknown> | null;
|
|
21
|
+
/** External command argv (command transport). */
|
|
22
|
+
commandArgv?: readonly string[];
|
|
23
|
+
/** Printed when the user must run a command manually. */
|
|
24
|
+
manualCommand?: string;
|
|
25
|
+
skipReason?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface SetupInstructionPlan {
|
|
28
|
+
path: string | null;
|
|
29
|
+
status: SetupChangeStatus;
|
|
30
|
+
content: string;
|
|
31
|
+
planFingerprint: string | null;
|
|
32
|
+
skipMessage?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface SetupToolPlan {
|
|
35
|
+
tool: SetupToolId;
|
|
36
|
+
found: boolean;
|
|
37
|
+
mcpPlan: SetupMcpPlan | null;
|
|
38
|
+
instructionPlan: SetupInstructionPlan | null;
|
|
39
|
+
ownNotes: readonly string[];
|
|
40
|
+
refused?: boolean;
|
|
41
|
+
otherAismemoryNames?: readonly string[];
|
|
42
|
+
}
|
|
43
|
+
export type SetupPlanBuildResult = {
|
|
44
|
+
ok: true;
|
|
45
|
+
plan: SetupPlan;
|
|
46
|
+
} | {
|
|
47
|
+
ok: false;
|
|
48
|
+
plan: SetupPlan;
|
|
49
|
+
messages: readonly string[];
|
|
50
|
+
};
|
|
51
|
+
export interface SetupPlan {
|
|
52
|
+
agentId: string;
|
|
53
|
+
tools: SetupToolPlan[];
|
|
54
|
+
rulesOmitted?: number;
|
|
55
|
+
noAccountRules?: boolean;
|
|
56
|
+
claudeConnectionCheckNote?: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface SetupOrientationLine {
|
|
59
|
+
label: string;
|
|
60
|
+
status: 'present' | 'missing' | 'not-installed';
|
|
61
|
+
}
|
|
62
|
+
export interface SetupToolchain {
|
|
63
|
+
claudeOnPath: boolean;
|
|
64
|
+
codexMcpAdd: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface CommandRunResult {
|
|
67
|
+
stdout: string;
|
|
68
|
+
stderr: string;
|
|
69
|
+
code: number;
|
|
70
|
+
}
|
|
71
|
+
export type CommandRunner = (command: string, args: readonly string[], timeoutMs: number) => Promise<CommandRunResult>;
|
|
72
|
+
export declare function setupRulesFileName(agentId: string): string;
|
|
73
|
+
export declare function setupBeginMarker(agentId: string, blockId: string): string;
|
|
74
|
+
export declare function setupEndMarker(agentId: string, blockId: string): string;
|
|
75
|
+
export declare const UNRECOGNISED_CONTEXT_MSG = "the service answer was not understood; nothing was changed";
|
|
76
|
+
export declare function sanitizeForTerminal(text: string): string;
|
|
77
|
+
/** Service-supplied text for banners and refusals: strip controls and cap length; ids are not passed through this. */
|
|
78
|
+
export declare function displayServiceStringForTerminal(text: string): string;
|
|
79
|
+
export declare function splitOperatingLayerRules(raw: unknown): {
|
|
80
|
+
accountRules: string[];
|
|
81
|
+
ownNotes: string[];
|
|
82
|
+
rulesOmitted: number;
|
|
83
|
+
};
|
|
84
|
+
/** Refuse or neutralise hostile rule text; null means drop the rule. */
|
|
85
|
+
export declare function formatSetupRuleLine(description: string): string | null;
|
|
86
|
+
export declare function buildInstructionBlock(agentId: string, blockId: string, entryInstructions: string, ruleLines: readonly string[], setDate: string): string;
|
|
87
|
+
export declare function buildCursorRulesFile(agentId: string, blockId: string, entryInstructions: string, ruleLines: readonly string[], setDate: string, includeFrontMatter: boolean): string;
|
|
88
|
+
export declare function cursorFileCreatedBySetup(content: string): boolean;
|
|
89
|
+
export declare function contentIsOnlySetupCursorShell(content: string, agentId: string): boolean;
|
|
90
|
+
export declare function readBlockIdFromFile(content: string, agentId: string): string | null;
|
|
91
|
+
export declare function hasDamagedSetupMarker(content: string, agentId: string): boolean;
|
|
92
|
+
export declare function blockIdForPlan(existingContent: string | null, agentId: string): string;
|
|
93
|
+
export declare function applyInstructionBlock(existing: string | null, block: string, agentId: string): string;
|
|
94
|
+
export declare function removeInstructionBlock(content: string, agentId: string, requireBlockId: boolean): string;
|
|
95
|
+
/** Refuse when a symlink on the path to `targetPath` resolves outside `root`. */
|
|
96
|
+
export declare function refuseSymlinkWrite(root: string, targetPath: string): string | null;
|
|
97
|
+
export declare function detectSetupTool(home: string, tool: SetupToolId): boolean;
|
|
98
|
+
export declare function mcpEntryAgentId(entry: Record<string, unknown>): string | null;
|
|
99
|
+
export declare function otherAismemoryConnectionNames(servers: Record<string, unknown>, ourName: string): string[];
|
|
100
|
+
export declare function agentIdFromMcpGetOutput(stdout: string): string | null;
|
|
101
|
+
export declare const MCP_GET_TIMEOUT_MS = 60000;
|
|
102
|
+
export declare function claudeMcpGetArgv(serverName: string): string[];
|
|
103
|
+
export type McpGetPresence = 'present' | 'absent' | 'unknown';
|
|
104
|
+
export declare function classifyMcpGetResult(result: CommandRunResult, serverName: string): McpGetPresence;
|
|
105
|
+
export declare function codexMcpGetArgv(serverName: string): string[];
|
|
106
|
+
export declare function manualClaudeMcpRemoveCommand(serverName: string): string;
|
|
107
|
+
export declare function mergeJsonMcpConfig(existingJson: string | null, agentId: string, version: string, serverName: string, configPath?: string): {
|
|
108
|
+
content: string;
|
|
109
|
+
entryOnly: Record<string, unknown>;
|
|
110
|
+
};
|
|
111
|
+
export declare function jsonHasMcpServer(existingJson: string | null, serverName: string): boolean;
|
|
112
|
+
export declare function removeJsonMcpEntry(existingJson: string, serverName: string, configPath: string, keepEmptyServers?: boolean): string;
|
|
113
|
+
export declare function mergeCodexTomlMcp(existing: string | null, agentId: string, version: string, serverName: string, _configPath?: string): {
|
|
114
|
+
content: string;
|
|
115
|
+
blockId: string;
|
|
116
|
+
};
|
|
117
|
+
export declare function codexTomlTablesOnce(content: string): boolean;
|
|
118
|
+
export declare function removeCodexTomlMcpEntry(existing: string, agentId: string, configPath?: string): string;
|
|
119
|
+
export declare function claudeMcpAddArgv(agentId: string, version: string, serverName: string): string[];
|
|
120
|
+
export declare function claudeMcpRemoveArgv(serverName: string): string[];
|
|
121
|
+
export declare function codexMcpAddArgv(agentId: string, version: string, serverName: string): string[];
|
|
122
|
+
export declare function codexMcpRemoveArgv(serverName: string): string[];
|
|
123
|
+
export declare function manualClaudeMcpAddCommand(agentId: string, version: string, serverName: string): string;
|
|
124
|
+
export interface BuildSetupPlanOptions {
|
|
125
|
+
home: string;
|
|
126
|
+
project?: string;
|
|
127
|
+
agentId: string;
|
|
128
|
+
fullContext: unknown;
|
|
129
|
+
setDate: string;
|
|
130
|
+
packageVersion?: string;
|
|
131
|
+
toolchain?: SetupToolchain;
|
|
132
|
+
commandRunner?: CommandRunner;
|
|
133
|
+
}
|
|
134
|
+
export declare function buildSetupPlan(opts: BuildSetupPlanOptions): Promise<SetupPlan>;
|
|
135
|
+
export declare function otherAismemoryNotice(names: readonly string[]): string[];
|
|
136
|
+
export declare function plannedFileWrites(plan: SetupPlan): string[];
|
|
137
|
+
export declare function planHasRefusedTool(plan: SetupPlan): boolean;
|
|
138
|
+
export interface FormatDryRunOptions {
|
|
139
|
+
home?: string;
|
|
140
|
+
}
|
|
141
|
+
export declare function formatDryRun(plan: SetupPlan, opts?: FormatDryRunOptions): string;
|
|
142
|
+
export interface ApplySetupPlanOptions {
|
|
143
|
+
plan: SetupPlan;
|
|
144
|
+
home: string;
|
|
145
|
+
project?: string;
|
|
146
|
+
commandRunner?: CommandRunner;
|
|
147
|
+
writeStdout?: (text: string) => void;
|
|
148
|
+
writeStderr?: (text: string) => void;
|
|
149
|
+
}
|
|
150
|
+
export declare function writableRoots(home: string, project: string | undefined): string[];
|
|
151
|
+
export declare function assertPathWritable(roots: string[], path: string, resolvedWriteTarget?: string): void;
|
|
152
|
+
export declare function applySetupPlan(opts: ApplySetupPlanOptions): Promise<void>;
|
|
153
|
+
export interface RemoveSetupPlanOptions {
|
|
154
|
+
plan: SetupPlan;
|
|
155
|
+
home: string;
|
|
156
|
+
project?: string;
|
|
157
|
+
requireBlockId?: boolean;
|
|
158
|
+
commandRunner?: CommandRunner;
|
|
159
|
+
dryRun?: boolean;
|
|
160
|
+
writeStderr?: (text: string) => void;
|
|
161
|
+
}
|
|
162
|
+
export interface PlanRemoveSetupOptions {
|
|
163
|
+
home: string;
|
|
164
|
+
project?: string;
|
|
165
|
+
agentId: string;
|
|
166
|
+
toolchain?: SetupToolchain;
|
|
167
|
+
commandRunner?: CommandRunner;
|
|
168
|
+
}
|
|
169
|
+
export interface RemoveValidationFailure {
|
|
170
|
+
tool: SetupToolId;
|
|
171
|
+
message: string;
|
|
172
|
+
}
|
|
173
|
+
/** Plans removal using only local files (no network, no full_context). */
|
|
174
|
+
export declare function planRemoveSetup(opts: PlanRemoveSetupOptions): Promise<SetupPlan>;
|
|
175
|
+
export declare function collectRemoveValidationFailures(plan: SetupPlan, roots: string[]): RemoveValidationFailure[];
|
|
176
|
+
export declare function applyRemoveSetupPlan(opts: RemoveSetupPlanOptions): Promise<void>;
|
|
177
|
+
export declare function summarizeSetupOrientation(home: string, plan: SetupPlan, runner?: CommandRunner): Promise<SetupOrientationLine[]>;
|
|
178
|
+
export declare function formatOrientationSummary(lines: readonly SetupOrientationLine[]): string;
|
|
179
|
+
export declare function plannedPaths(plan: SetupPlan): string[];
|
|
180
|
+
export declare function fingerprintFileAtPath(path: string): string;
|
|
181
|
+
type SetupSignedInAuthKind = 'workspace-key' | 'agent-api-key' | 'run-pass' | 'oauth';
|
|
182
|
+
export interface SetupSignedInClient {
|
|
183
|
+
agentId: string;
|
|
184
|
+
pin: SessionIdentity | null;
|
|
185
|
+
authKind: SetupSignedInAuthKind;
|
|
186
|
+
callWhoami: () => Promise<unknown>;
|
|
187
|
+
}
|
|
188
|
+
/** Agent display name from the same whoami body hooks and the MCP server return. */
|
|
189
|
+
export declare function agentDisplayNameFromWhoami(body: unknown): string | null;
|
|
190
|
+
export declare function formatSignedInBannerLine(agentName: string | null, agentId: string, signInSource: string, opts?: {
|
|
191
|
+
nameLookedUp?: boolean;
|
|
192
|
+
}): string;
|
|
193
|
+
export declare function humanSignInSourceLabel(env: NodeJS.ProcessEnv, home: string, resolvedAgentId: string, authKind: SetupSignedInAuthKind): string;
|
|
194
|
+
/** Path of a sign-in file that exists but cannot be parsed; null when nothing is unreadable. */
|
|
195
|
+
export declare function unreadableSignInFilePath(home: string, env: NodeJS.ProcessEnv): string | null;
|
|
196
|
+
export declare function setupAuthKindFromHookClient(client: HookClient): SetupSignedInAuthKind;
|
|
197
|
+
export declare function setupSignedInClientFromHookClient(client: HookClient): SetupSignedInClient;
|
|
198
|
+
/**
|
|
199
|
+
* Resolve the signed-in agent via `resolveHookClient` (credential order matches MCP main() / whoami).
|
|
200
|
+
*/
|
|
201
|
+
export declare function resolveSetupSignedInClient(env: NodeJS.ProcessEnv, home: string): Promise<SetupSignedInClient>;
|
|
202
|
+
export type DiscoverSignedInResult = {
|
|
203
|
+
ok: true;
|
|
204
|
+
agentId: string;
|
|
205
|
+
agentName: string | null;
|
|
206
|
+
signInSource: string;
|
|
207
|
+
} | {
|
|
208
|
+
ok: false;
|
|
209
|
+
exitCode: 1;
|
|
210
|
+
message: string;
|
|
211
|
+
};
|
|
212
|
+
export declare const SETUP_NOT_SIGNED_IN_MSG = "This machine is not signed in to your memory account. Run `aismemory` once to sign in, or pass --identity <agent id>.";
|
|
213
|
+
export declare const SETUP_SIGN_IN_CHECK_FAILED_MSG = "Could not check the sign-in on this machine. Pass --identity <agent id>, or run `aismemory` to sign in again.";
|
|
214
|
+
export interface DiscoverSignedInAgentOptions {
|
|
215
|
+
skipAgentDisplayName?: boolean;
|
|
216
|
+
/** How the signed-in client is found; the default reads this machine's credentials. */
|
|
217
|
+
resolveClient?: (env: NodeJS.ProcessEnv, home: string) => Promise<SetupSignedInClient>;
|
|
218
|
+
}
|
|
219
|
+
export declare function discoverSignedInAgentForSetup(home: string, env: NodeJS.ProcessEnv, options?: DiscoverSignedInAgentOptions): Promise<DiscoverSignedInResult>;
|
|
220
|
+
export {};
|