aismemory 0.8.6 → 0.8.8
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 +5 -3
- package/dist/agent-key-mode.js +10 -3
- package/dist/agent-preference.d.ts +5 -2
- package/dist/agent-preference.js +2 -0
- package/dist/ais-http-error.d.ts +1 -1
- package/dist/ais-http-error.js +1 -1
- package/dist/ais-http.js +1 -1
- package/dist/auto-handoff.d.ts +5 -1
- package/dist/auto-handoff.js +17 -3
- package/dist/cli/hooks.js +36 -2
- package/dist/cli/setup-core.js +149 -1
- 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 +114 -44
- package/dist/mcp/tools.d.ts +11 -2
- package/dist/mcp/tools.js +69 -14
- 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/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 +9 -2
- package/dist/session-identity.js +2 -0
- package/dist/tool-args.d.ts +21 -1
- package/dist/tool-args.js +70 -3
- package/dist/workspace-key-mode.js +9 -2
- package/package.json +3 -1
- package/dist/__tests__/agent-archive.test.d.ts +0 -1
- package/dist/__tests__/agent-archive.test.js +0 -154
- 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 -530
- 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 -254
- 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 -86
- 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 -326
- 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-identity-gate.test.d.ts +0 -1
- package/dist/__tests__/auto-handoff-identity-gate.test.js +0 -64
- package/dist/__tests__/auto-handoff-identity-gate.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__/disk-bearer-host-binding-e2e.test.d.ts +0 -1
- package/dist/__tests__/disk-bearer-host-binding-e2e.test.js +0 -235
- package/dist/__tests__/disk-bearer-host-binding-e2e.test.js.map +0 -1
- package/dist/__tests__/doctor-bin-insecure-ais-url.test.d.ts +0 -1
- package/dist/__tests__/doctor-bin-insecure-ais-url.test.js +0 -29
- package/dist/__tests__/doctor-bin-insecure-ais-url.test.js.map +0 -1
- package/dist/__tests__/doctor.test.d.ts +0 -1
- package/dist/__tests__/doctor.test.js +0 -639
- 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 -212
- 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 -147
- package/dist/__tests__/full-context-view-forwarding.test.js.map +0 -1
- package/dist/__tests__/helpers/setup-credential-source.d.ts +0 -3
- package/dist/__tests__/helpers/setup-credential-source.js +0 -43
- package/dist/__tests__/helpers/setup-credential-source.js.map +0 -1
- package/dist/__tests__/hooks.test.d.ts +0 -1
- package/dist/__tests__/hooks.test.js +0 -476
- 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 -170
- 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-host-binding.test.d.ts +0 -1
- package/dist/__tests__/key-auth-host-binding.test.js +0 -120
- package/dist/__tests__/key-auth-host-binding.test.js.map +0 -1
- package/dist/__tests__/key-auth.test.d.ts +0 -1
- package/dist/__tests__/key-auth.test.js +0 -298
- 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 -583
- 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-get.test.d.ts +0 -1
- package/dist/__tests__/memory-get.test.js +0 -178
- package/dist/__tests__/memory-get.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 -38
- package/dist/__tests__/oauth-credentials.test.js.map +0 -1
- package/dist/__tests__/operating-layer-put.test.d.ts +0 -1
- package/dist/__tests__/operating-layer-put.test.js +0 -159
- package/dist/__tests__/operating-layer-put.test.js.map +0 -1
- package/dist/__tests__/owner-credentials.test.d.ts +0 -1
- package/dist/__tests__/owner-credentials.test.js +0 -266
- 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 -583
- 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__/remember-expires-in.test.d.ts +0 -1
- package/dist/__tests__/remember-expires-in.test.js +0 -125
- package/dist/__tests__/remember-expires-in.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 -186
- 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 -298
- package/dist/__tests__/session-identity.test.js.map +0 -1
- package/dist/__tests__/session-start.test.d.ts +0 -1
- package/dist/__tests__/session-start.test.js +0 -179
- package/dist/__tests__/session-start.test.js.map +0 -1
- package/dist/__tests__/setup-codex-get.test.d.ts +0 -1
- package/dist/__tests__/setup-codex-get.test.js +0 -101
- package/dist/__tests__/setup-codex-get.test.js.map +0 -1
- package/dist/__tests__/setup-links.test.d.ts +0 -1
- package/dist/__tests__/setup-links.test.js +0 -37
- package/dist/__tests__/setup-links.test.js.map +0 -1
- package/dist/__tests__/setup-orientation-codex.test.d.ts +0 -1
- package/dist/__tests__/setup-orientation-codex.test.js +0 -76
- package/dist/__tests__/setup-orientation-codex.test.js.map +0 -1
- package/dist/__tests__/setup-remove-cli.test.d.ts +0 -1
- package/dist/__tests__/setup-remove-cli.test.js +0 -327
- package/dist/__tests__/setup-remove-cli.test.js.map +0 -1
- package/dist/__tests__/setup-signed-in.test.d.ts +0 -1
- package/dist/__tests__/setup-signed-in.test.js +0 -506
- package/dist/__tests__/setup-signed-in.test.js.map +0 -1
- package/dist/__tests__/setup.test.d.ts +0 -1
- package/dist/__tests__/setup.test.js +0 -1253
- package/dist/__tests__/setup.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 -108
- 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 -252
- package/dist/__tests__/startup-identity.test.js.map +0 -1
- package/dist/__tests__/startup-insecure-ais-url.test.d.ts +0 -1
- package/dist/__tests__/startup-insecure-ais-url.test.js +0 -36
- package/dist/__tests__/startup-insecure-ais-url.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__/test-home-isolation.test.d.ts +0 -1
- package/dist/__tests__/test-home-isolation.test.js +0 -29
- package/dist/__tests__/test-home-isolation.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-permanent-failures.test.d.ts +0 -1
- package/dist/__tests__/token-manager-permanent-failures.test.js +0 -162
- package/dist/__tests__/token-manager-permanent-failures.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 -295
- 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 -446
- 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/setup-core.js.map +0 -1
- package/dist/cli/setup.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/operating-layer-write.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/session-start.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/README.md
CHANGED
|
@@ -37,7 +37,7 @@ Add to your IDE's MCP server config:
|
|
|
37
37
|
"mcpServers": {
|
|
38
38
|
"aismemory": {
|
|
39
39
|
"command": "npx",
|
|
40
|
-
"args": ["aismemory@0.8.
|
|
40
|
+
"args": ["aismemory@0.8.8"],
|
|
41
41
|
"env": {
|
|
42
42
|
"npm_config_audit": "false",
|
|
43
43
|
"npm_config_fund": "false"
|
|
@@ -101,9 +101,10 @@ unreachable, they print one warning line and let the session carry on.
|
|
|
101
101
|
|
|
102
102
|
| Tool | Description |
|
|
103
103
|
|------|-------------|
|
|
104
|
-
| `remember` | Store a memory (fact, event, lesson, context, goal, task) |
|
|
104
|
+
| `remember` | Store a memory (fact, event, lesson, context, goal, task). Answers with a short receipt (`id`, `agentId`, `tier`, `createdAt`, `tokenEstimate`, and `supersedes` when given); pass `verbose: true` for the whole stored memory |
|
|
105
105
|
| `recall` | Search memories by natural language query |
|
|
106
106
|
| `memory_get` | Read one memory in full by id, for a result that recall returned cut (`truncated: true`) |
|
|
107
|
+
| `memory_forget` | Retire one of your own memories by its full id: recall and `full_context` leave it out from then on. It is kept, not deleted (marked expired now). Own memories only; takes no agent argument |
|
|
107
108
|
| `whoami` | Get agent identity and status |
|
|
108
109
|
| `orientation_check` | Diff an owner-approved expected-environment manifest against this session's evidence — read-only, same comparator as `aismemory doctor --orientation`, reachable without a filesystem |
|
|
109
110
|
| `full_context` | Load complete agent context (personality, goals, facts, skills, and the versioned operating layer — constitution rules plus the skills index). On `view=lean` or `view=bootstrap`, memories tagged `no-lean` are omitted unless you pass your own `tags`, `anyTags`, or `excludeTags`. |
|
|
@@ -116,6 +117,7 @@ unreachable, they print one warning line and let the session carry on.
|
|
|
116
117
|
| `goal_create` | Create a new goal for the current agent |
|
|
117
118
|
| `goal_list` | List goals for the current agent, with status/parent filters |
|
|
118
119
|
| `goal_update_progress` | Update a goal's progress (0-100) |
|
|
120
|
+
| `goal_activate` | Activate one of your own draft goals so it shows in your context |
|
|
119
121
|
| `goal_complete` | Mark a goal complete (success or failure) |
|
|
120
122
|
| `operating_layer_put` | Store one rule or skill in this agent's OWN operating layer, so it loads in every tool connected to the agent (`full_context` / `agent_load`). Agent API key only; takes no agent argument; only when the human asked |
|
|
121
123
|
| `agent_archive` | Archive one of your own agents by id. Restorable; nothing is deleted. Owner sign-in only |
|
|
@@ -323,7 +325,7 @@ mint a new one.
|
|
|
323
325
|
"mcpServers": {
|
|
324
326
|
"aismemory": {
|
|
325
327
|
"command": "npx",
|
|
326
|
-
"args": ["aismemory@0.8.
|
|
328
|
+
"args": ["aismemory@0.8.8"],
|
|
327
329
|
"env": {
|
|
328
330
|
"AIS_WORKSPACE_KEY": "ais_wk_...",
|
|
329
331
|
"AIS_AGENT_ID": "<the agent to start with>",
|
package/dist/agent-key-mode.js
CHANGED
|
@@ -27,12 +27,13 @@ import { emitTelemetry } from './telemetry.js';
|
|
|
27
27
|
import { retryAfterOf, shouldHonourRetryAfter, sleepSeconds } from './retry-after.js';
|
|
28
28
|
import { getAisRequestTimeoutMs, toAisRequestError } from './request-timeout.js';
|
|
29
29
|
import { withDeclaredAgent } from './declared-agent.js';
|
|
30
|
-
import { parseEmptyToolArgs, parseRecallArgs, parseMemoryGetArgs, buildMemoryGetPath, shapeMemoryGetResult, buildFullContextQuery, parseFullContextArgs, buildRememberStoreBody, parseRememberArgs, parseInboxSendArgs, parseInboxReadArgs, parseGoalCreateArgs, parseGoalListArgs, parseGoalUpdateProgressArgs, parseGoalCompleteArgs, parseInboxAckArgs, parseHandoffArgs, } from './tool-args.js';
|
|
30
|
+
import { parseEmptyToolArgs, parseRecallArgs, parseMemoryGetArgs, buildMemoryGetPath, shapeMemoryGetResult, buildFullContextQuery, parseFullContextArgs, buildRememberStoreBody, shapeRememberResult, parseRememberArgs, parseInboxSendArgs, parseInboxReadArgs, parseGoalCreateArgs, parseGoalListArgs, parseGoalUpdateProgressArgs, parseGoalActivateArgs, parseGoalCompleteArgs, parseInboxAckArgs, parseHandoffArgs, } from './tool-args.js';
|
|
31
31
|
import { readInboxAndMaybeAck } from './inbox-client.js';
|
|
32
32
|
import { AGENT_ARCHIVE_KEY_MODE_DETAIL } from './agent-archive.js';
|
|
33
33
|
import { OPERATING_LAYER_PUT_TOOL, putOperatingLayerEntry } from './operating-layer-write.js';
|
|
34
34
|
import { fetchCredentialWhoami } from './credential-whoami.js';
|
|
35
35
|
import { resolveDreamResponse } from './dream-poll.js';
|
|
36
|
+
import { forgetOwnMemory } from './memory-forget.js';
|
|
36
37
|
/** Thrown by loadAgentApiKeyConfig when AIS_AGENT_API_KEY is set without AIS_AGENT_ID. */
|
|
37
38
|
export class AgentApiKeyConfigError extends Error {
|
|
38
39
|
constructor(message) {
|
|
@@ -136,7 +137,7 @@ export async function aisKeyGet(aisUrl, path, apiKey, fetchImpl = globalThis.fet
|
|
|
136
137
|
// Same single-retry-on-idempotent-GET policy as aisGet (CORBOT-9492F31A),
|
|
137
138
|
// extended here so x-agent-api-key customers get the identical Railway-
|
|
138
139
|
// edge-502 protection (CORBOT-6F45EDFA) — this GET is just as idempotent
|
|
139
|
-
// regardless of which auth header carries it.
|
|
140
|
+
// regardless of which auth header carries it. Tester finding C9: when the server
|
|
140
141
|
// names a short wait (429/503 Retry-After) that wait is honoured for the
|
|
141
142
|
// one retry; a long one is reported, not slept through. Writes are never
|
|
142
143
|
// retried.
|
|
@@ -241,7 +242,7 @@ export async function dispatchToolKeyMode(aisUrl, config, name, rawArgs, fetchIm
|
|
|
241
242
|
case 'remember': {
|
|
242
243
|
const args = parseRememberArgs(rawArgs);
|
|
243
244
|
try {
|
|
244
|
-
return await aisKeyPost(aisUrl, `/v1/agents/${agentId}/memory`, apiKey, buildRememberStoreBody(args), fetchImpl);
|
|
245
|
+
return shapeRememberResult(await aisKeyPost(aisUrl, `/v1/agents/${agentId}/memory`, apiKey, buildRememberStoreBody(args), fetchImpl), args);
|
|
245
246
|
}
|
|
246
247
|
catch (err) {
|
|
247
248
|
// CORBOT-F21668B5: a deduplicated write is not a lost write — report
|
|
@@ -273,6 +274,8 @@ export async function dispatchToolKeyMode(aisUrl, config, name, rawArgs, fetchIm
|
|
|
273
274
|
const getArgs = parseMemoryGetArgs(rawArgs);
|
|
274
275
|
return shapeMemoryGetResult(await aisKeyGet(aisUrl, buildMemoryGetPath(agentId, getArgs), apiKey, fetchImpl), getArgs);
|
|
275
276
|
}
|
|
277
|
+
case 'memory_forget':
|
|
278
|
+
return forgetOwnMemory(agentId, rawArgs, (path, body) => aisKeyPatch(aisUrl, path, apiKey, body, fetchImpl));
|
|
276
279
|
case 'full_context': {
|
|
277
280
|
const fcArgs = parseFullContextArgs(rawArgs);
|
|
278
281
|
const fcQs = buildFullContextQuery(fcArgs);
|
|
@@ -348,6 +351,10 @@ export async function dispatchToolKeyMode(aisUrl, config, name, rawArgs, fetchIm
|
|
|
348
351
|
progress: args.progress,
|
|
349
352
|
}, fetchImpl);
|
|
350
353
|
}
|
|
354
|
+
case 'goal_activate': {
|
|
355
|
+
const args = parseGoalActivateArgs(rawArgs);
|
|
356
|
+
return aisKeyPost(aisUrl, `/v1/agents/${agentId}/goals/${args.goalId}/activate`, apiKey, {}, fetchImpl);
|
|
357
|
+
}
|
|
351
358
|
case 'goal_complete': {
|
|
352
359
|
const args = parseGoalCompleteArgs(rawArgs);
|
|
353
360
|
return aisKeyPost(aisUrl, `/v1/agents/${agentId}/goals/${args.goalId}/complete`, apiKey, {
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
export interface AgentPreference {
|
|
2
2
|
schemaVersion: 2;
|
|
3
|
+
/** Only the same explicit harness session may restore this choice. */
|
|
4
|
+
sessionId?: string;
|
|
3
5
|
agentId: string;
|
|
4
6
|
tenantId: string;
|
|
5
7
|
/** Owner user id for keychain account naming — not a secret (CORBOT-51CAC5E8). */
|
|
6
8
|
ownerUserId?: string;
|
|
7
9
|
/**
|
|
8
10
|
* Set when agent_load wrote this preference without an in-session pin. A new
|
|
9
|
-
* MCP process
|
|
10
|
-
*
|
|
11
|
+
* unchosen MCP process must not adopt this identity. Only a matching
|
|
12
|
+
* explicit sessionId can restore the choice (CORBOT-F456BD9D).
|
|
11
13
|
*/
|
|
12
14
|
awaitingSessionLoad?: boolean;
|
|
13
15
|
}
|
|
@@ -68,4 +70,5 @@ export declare function loadAgentPreference(home?: string, hasKey?: () => boolea
|
|
|
68
70
|
tenantId: string;
|
|
69
71
|
ownerUserId?: string;
|
|
70
72
|
awaitingSessionLoad?: boolean;
|
|
73
|
+
sessionId?: string;
|
|
71
74
|
} | null;
|
package/dist/agent-preference.js
CHANGED
|
@@ -26,6 +26,7 @@ export function saveAgentPreference(pref, home = homedir()) {
|
|
|
26
26
|
// Write the file with schemaVersion + ids (no legacy token/expiresAt)
|
|
27
27
|
const data = {
|
|
28
28
|
schemaVersion: 2,
|
|
29
|
+
...(process.env.CLAUDE_SESSION_ID ? { sessionId: process.env.CLAUDE_SESSION_ID } : {}),
|
|
29
30
|
agentId: pref.agentId,
|
|
30
31
|
tenantId: pref.tenantId,
|
|
31
32
|
...(pref.ownerUserId ? { ownerUserId: pref.ownerUserId } : {}),
|
|
@@ -123,6 +124,7 @@ export function loadAgentPreference(home = homedir(), hasKey = defaultHasKey(hom
|
|
|
123
124
|
return {
|
|
124
125
|
agentId,
|
|
125
126
|
tenantId,
|
|
127
|
+
...(typeof parsed.sessionId === 'string' ? { sessionId: parsed.sessionId } : {}),
|
|
126
128
|
...(typeof ownerUserId === 'string' ? { ownerUserId } : {}),
|
|
127
129
|
...(awaitingSessionLoad === true ? { awaitingSessionLoad: true } : {}),
|
|
128
130
|
};
|
package/dist/ais-http-error.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare class AisHttpError extends Error {
|
|
|
22
22
|
readonly status: number;
|
|
23
23
|
readonly path: string;
|
|
24
24
|
readonly body: unknown;
|
|
25
|
-
/** Server-requested wait from `Retry-After` on a 429/503, else null (
|
|
25
|
+
/** Server-requested wait from `Retry-After` on a 429/503, else null (tester finding C9). */
|
|
26
26
|
readonly retryAfterSeconds: number | null;
|
|
27
27
|
constructor(status: number, path: string, body: unknown, retryAfterSeconds?: number | null);
|
|
28
28
|
}
|
package/dist/ais-http-error.js
CHANGED
|
@@ -67,7 +67,7 @@ export class AisHttpError extends Error {
|
|
|
67
67
|
status;
|
|
68
68
|
path;
|
|
69
69
|
body;
|
|
70
|
-
/** Server-requested wait from `Retry-After` on a 429/503, else null (
|
|
70
|
+
/** Server-requested wait from `Retry-After` on a 429/503, else null (tester finding C9). */
|
|
71
71
|
retryAfterSeconds;
|
|
72
72
|
constructor(status, path, body, retryAfterSeconds = null) {
|
|
73
73
|
super(formatAisHttpError(status, path, body, retryAfterSeconds));
|
package/dist/ais-http.js
CHANGED
|
@@ -194,7 +194,7 @@ export async function aisGet(path, token) {
|
|
|
194
194
|
});
|
|
195
195
|
throw wrapped;
|
|
196
196
|
}
|
|
197
|
-
//
|
|
197
|
+
// Tester finding C9: a short server-requested wait (429/503 Retry-After) is
|
|
198
198
|
// honoured for the one retry; a long one is reported, not slept through.
|
|
199
199
|
const retryAfter = retryAfterOf(res);
|
|
200
200
|
const retryable = retryAfter === null
|
package/dist/auto-handoff.d.ts
CHANGED
|
@@ -8,10 +8,14 @@ export declare class ActivityTracker {
|
|
|
8
8
|
getStoredMemoryCount(): number;
|
|
9
9
|
getStoredMemories(): string[];
|
|
10
10
|
hasActivity(): boolean;
|
|
11
|
+
/** Drop everything recorded so far; used when the session switches agents. */
|
|
12
|
+
reset(): void;
|
|
11
13
|
}
|
|
12
14
|
export interface HandoffPayload {
|
|
13
15
|
summary: string;
|
|
14
16
|
keyLearnings: string[];
|
|
15
17
|
}
|
|
16
18
|
export declare function buildHandoffPayload(tracker: ActivityTracker): HandoffPayload;
|
|
17
|
-
export declare function setupAutoHandoff(aisUrl: string, agentId: string, token: string, tracker: ActivityTracker,
|
|
19
|
+
export declare function setupAutoHandoff(aisUrl: string, agentId: string, token: string, tracker: ActivityTracker,
|
|
20
|
+
/** Called once at exit; `saved` is true only when the server accepted the handoff. */
|
|
21
|
+
onBeforeExit?: (saved: boolean) => void, beforeWrite?: () => Promise<void>): () => void;
|
package/dist/auto-handoff.js
CHANGED
|
@@ -32,6 +32,12 @@ export class ActivityTracker {
|
|
|
32
32
|
hasActivity() {
|
|
33
33
|
return Object.keys(this.toolCounts).length > 0;
|
|
34
34
|
}
|
|
35
|
+
/** Drop everything recorded so far; used when the session switches agents. */
|
|
36
|
+
reset() {
|
|
37
|
+
this.toolCounts = {};
|
|
38
|
+
this.storedMemories = [];
|
|
39
|
+
this.storedMemoryCount = 0;
|
|
40
|
+
}
|
|
35
41
|
}
|
|
36
42
|
export function buildHandoffPayload(tracker) {
|
|
37
43
|
if (!tracker.hasActivity()) {
|
|
@@ -70,7 +76,9 @@ async function describeHandoffFailure(response) {
|
|
|
70
76
|
}
|
|
71
77
|
return `HTTP ${response.status}${detail}`;
|
|
72
78
|
}
|
|
73
|
-
export function setupAutoHandoff(aisUrl, agentId, token, tracker,
|
|
79
|
+
export function setupAutoHandoff(aisUrl, agentId, token, tracker,
|
|
80
|
+
/** Called once at exit; `saved` is true only when the server accepted the handoff. */
|
|
81
|
+
onBeforeExit, beforeWrite) {
|
|
74
82
|
let exiting = false;
|
|
75
83
|
const doHandoff = async () => {
|
|
76
84
|
if (exiting)
|
|
@@ -79,6 +87,7 @@ export function setupAutoHandoff(aisUrl, agentId, token, tracker, onBeforeExit,
|
|
|
79
87
|
if (!tracker.hasActivity())
|
|
80
88
|
return;
|
|
81
89
|
const payload = buildHandoffPayload(tracker);
|
|
90
|
+
let saved = false;
|
|
82
91
|
try {
|
|
83
92
|
if (beforeWrite)
|
|
84
93
|
await beforeWrite();
|
|
@@ -92,7 +101,8 @@ export function setupAutoHandoff(aisUrl, agentId, token, tracker, onBeforeExit,
|
|
|
92
101
|
// failure. Without this check the catch below never fires on a rejected
|
|
93
102
|
// handoff and the session exits as though its handoff had landed, which
|
|
94
103
|
// is exactly how a production 500 on this route stayed invisible to
|
|
95
|
-
// every client (
|
|
104
|
+
// every client (tester reconciliation 2026-09-17, defect 2).
|
|
105
|
+
saved = response.ok;
|
|
96
106
|
if (!response.ok) {
|
|
97
107
|
process.stderr.write(`[aismemory] Auto-handoff was NOT saved — the server rejected it (${await describeHandoffFailure(response)}). This session's handoff is lost.\n`);
|
|
98
108
|
}
|
|
@@ -101,12 +111,16 @@ export function setupAutoHandoff(aisUrl, agentId, token, tracker, onBeforeExit,
|
|
|
101
111
|
process.stderr.write(`[aismemory] Auto-handoff stopped: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
102
112
|
}
|
|
103
113
|
if (onBeforeExit)
|
|
104
|
-
onBeforeExit();
|
|
114
|
+
onBeforeExit(saved);
|
|
105
115
|
};
|
|
106
116
|
const onSignal = () => {
|
|
107
117
|
void doHandoff().finally(() => process.exit(0));
|
|
108
118
|
};
|
|
109
119
|
process.on('SIGTERM', onSignal);
|
|
110
120
|
process.on('SIGINT', onSignal);
|
|
121
|
+
return () => {
|
|
122
|
+
process.off('SIGTERM', onSignal);
|
|
123
|
+
process.off('SIGINT', onSignal);
|
|
124
|
+
};
|
|
111
125
|
}
|
|
112
126
|
//# sourceMappingURL=auto-handoff.js.map
|
package/dist/cli/hooks.js
CHANGED
|
@@ -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 = [
|
|
@@ -367,7 +369,7 @@ const operatingLayerSchema = z.object({
|
|
|
367
369
|
/*
|
|
368
370
|
* record-usage auto-creates a skill row named by the caller, outside the
|
|
369
371
|
* audited own: store; its name is not owner-reviewed text, so it never
|
|
370
|
-
* enters this block (
|
|
372
|
+
* enters this block (CORBOT-AE5B019F r1).
|
|
371
373
|
*/
|
|
372
374
|
const AUTO_CREATED_SKILL = 'Auto-created from usage recording';
|
|
373
375
|
/** Per-run tags: stored text cannot guess the nonce, so it cannot close the block. */
|
|
@@ -489,7 +491,39 @@ export function formatSessionContext(response, agentId, nonce = randomBytes(8).t
|
|
|
489
491
|
}
|
|
490
492
|
export async function runSessionStart(deps = {}) {
|
|
491
493
|
try {
|
|
492
|
-
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
|
+
}
|
|
493
527
|
return { stdout: formatSessionContext(response, client.agentId), stderr: '' };
|
|
494
528
|
}
|
|
495
529
|
catch (err) {
|
package/dist/cli/setup-core.js
CHANGED
|
@@ -589,6 +589,14 @@ function isJsonObject(value) {
|
|
|
589
589
|
function deepJsonEqual(a, b) {
|
|
590
590
|
return JSON.stringify(a) === JSON.stringify(b);
|
|
591
591
|
}
|
|
592
|
+
function jsonTextEquals(text, expected) {
|
|
593
|
+
try {
|
|
594
|
+
return deepJsonEqual(JSON.parse(text), expected);
|
|
595
|
+
}
|
|
596
|
+
catch {
|
|
597
|
+
return false;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
592
600
|
function detectJsonIndent(existingJson) {
|
|
593
601
|
const trailingNewline = existingJson.endsWith('\n');
|
|
594
602
|
const firstIndented = existingJson.split('\n').find((line) => /^\s+\S/.test(line));
|
|
@@ -599,6 +607,139 @@ function detectJsonIndent(existingJson) {
|
|
|
599
607
|
const spaces = m?.[1]?.length ?? 2;
|
|
600
608
|
return { space: spaces, trailingNewline };
|
|
601
609
|
}
|
|
610
|
+
function skipJsonWhitespace(text, from) {
|
|
611
|
+
let i = from;
|
|
612
|
+
while (i < text.length && /\s/.test(text.charAt(i)))
|
|
613
|
+
i++;
|
|
614
|
+
return i;
|
|
615
|
+
}
|
|
616
|
+
/** Index just past the string that opens at `open`, or -1 when it never closes. */
|
|
617
|
+
function endOfJsonString(text, open) {
|
|
618
|
+
let i = open + 1;
|
|
619
|
+
while (i < text.length) {
|
|
620
|
+
const ch = text.charAt(i);
|
|
621
|
+
if (ch === '\\')
|
|
622
|
+
i += 2;
|
|
623
|
+
else if (ch === '"')
|
|
624
|
+
return i + 1;
|
|
625
|
+
else
|
|
626
|
+
i++;
|
|
627
|
+
}
|
|
628
|
+
return -1;
|
|
629
|
+
}
|
|
630
|
+
/** Index just past the JSON value that starts at `from`, or -1 when it is malformed. */
|
|
631
|
+
function endOfJsonValue(text, from) {
|
|
632
|
+
const first = text.charAt(from);
|
|
633
|
+
if (first === '"')
|
|
634
|
+
return endOfJsonString(text, from);
|
|
635
|
+
if (first === '{' || first === '[') {
|
|
636
|
+
let depth = 0;
|
|
637
|
+
let i = from;
|
|
638
|
+
while (i < text.length) {
|
|
639
|
+
const ch = text.charAt(i);
|
|
640
|
+
if (ch === '"') {
|
|
641
|
+
i = endOfJsonString(text, i);
|
|
642
|
+
if (i === -1)
|
|
643
|
+
return -1;
|
|
644
|
+
continue;
|
|
645
|
+
}
|
|
646
|
+
if (ch === '{' || ch === '[')
|
|
647
|
+
depth++;
|
|
648
|
+
else if (ch === '}' || ch === ']') {
|
|
649
|
+
depth--;
|
|
650
|
+
if (depth === 0)
|
|
651
|
+
return i + 1;
|
|
652
|
+
}
|
|
653
|
+
i++;
|
|
654
|
+
}
|
|
655
|
+
return -1;
|
|
656
|
+
}
|
|
657
|
+
let i = from;
|
|
658
|
+
while (i < text.length && !/[\s,}\]]/.test(text.charAt(i)))
|
|
659
|
+
i++;
|
|
660
|
+
return i > from ? i : -1;
|
|
661
|
+
}
|
|
662
|
+
/** The direct members of the object whose `{` is at `open`, or null when the text is not plain JSON. */
|
|
663
|
+
function scanJsonObjectMembers(text, open) {
|
|
664
|
+
if (text.charAt(open) !== '{')
|
|
665
|
+
return null;
|
|
666
|
+
const members = [];
|
|
667
|
+
let i = skipJsonWhitespace(text, open + 1);
|
|
668
|
+
if (text.charAt(i) === '}')
|
|
669
|
+
return { members, close: i };
|
|
670
|
+
for (;;) {
|
|
671
|
+
if (text.charAt(i) !== '"')
|
|
672
|
+
return null;
|
|
673
|
+
const keyEnd = endOfJsonString(text, i);
|
|
674
|
+
if (keyEnd === -1)
|
|
675
|
+
return null;
|
|
676
|
+
let key;
|
|
677
|
+
try {
|
|
678
|
+
key = JSON.parse(text.slice(i, keyEnd));
|
|
679
|
+
}
|
|
680
|
+
catch {
|
|
681
|
+
return null;
|
|
682
|
+
}
|
|
683
|
+
const colon = skipJsonWhitespace(text, keyEnd);
|
|
684
|
+
if (text.charAt(colon) !== ':')
|
|
685
|
+
return null;
|
|
686
|
+
const valueStart = skipJsonWhitespace(text, colon + 1);
|
|
687
|
+
const end = endOfJsonValue(text, valueStart);
|
|
688
|
+
if (end === -1)
|
|
689
|
+
return null;
|
|
690
|
+
members.push({ key, start: i, end, valueStart });
|
|
691
|
+
const after = skipJsonWhitespace(text, end);
|
|
692
|
+
if (text.charAt(after) === '}')
|
|
693
|
+
return { members, close: after };
|
|
694
|
+
if (text.charAt(after) !== ',')
|
|
695
|
+
return null;
|
|
696
|
+
i = skipJsonWhitespace(text, after + 1);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
/** The members of the root object's `mcpServers` object, or null when it cannot be located in plain text. */
|
|
700
|
+
function scanMcpServersMembers(text) {
|
|
701
|
+
const rootOpen = skipJsonWhitespace(text, 0);
|
|
702
|
+
const root = scanJsonObjectMembers(text, rootOpen);
|
|
703
|
+
if (root === null)
|
|
704
|
+
return null;
|
|
705
|
+
const servers = root.members.find((m) => m.key === 'mcpServers');
|
|
706
|
+
if (servers === undefined)
|
|
707
|
+
return null;
|
|
708
|
+
return scanJsonObjectMembers(text, servers.valueStart);
|
|
709
|
+
}
|
|
710
|
+
/** Add one server as the last `mcpServers` member by editing the text, or null when the layout is not simple. */
|
|
711
|
+
function insertJsonMcpEntryInPlace(existingJson, serverName, entry, space) {
|
|
712
|
+
const scanned = scanMcpServersMembers(existingJson);
|
|
713
|
+
const last = scanned?.members[scanned.members.length - 1];
|
|
714
|
+
if (scanned === null || last === undefined)
|
|
715
|
+
return null;
|
|
716
|
+
const lineStart = existingJson.lastIndexOf('\n', last.start) + 1;
|
|
717
|
+
const indent = existingJson.slice(lineStart, last.start);
|
|
718
|
+
if (!/^[ \t]+$/.test(indent))
|
|
719
|
+
return null;
|
|
720
|
+
const body = JSON.stringify(entry, null, space)
|
|
721
|
+
.split('\n')
|
|
722
|
+
.map((line, idx) => (idx === 0 ? line : `${indent}${line}`))
|
|
723
|
+
.join('\n');
|
|
724
|
+
return `${existingJson.slice(0, last.end)},\n${indent}${JSON.stringify(serverName)}: ${body}${existingJson.slice(last.end)}`;
|
|
725
|
+
}
|
|
726
|
+
/** Drop one `mcpServers` member by editing the text, or null when the layout is not simple. */
|
|
727
|
+
function removeJsonMcpEntryInPlace(existingJson, serverName) {
|
|
728
|
+
const scanned = scanMcpServersMembers(existingJson);
|
|
729
|
+
if (scanned === null || scanned.members.length < 2)
|
|
730
|
+
return null;
|
|
731
|
+
const idx = scanned.members.findIndex((m) => m.key === serverName);
|
|
732
|
+
const member = scanned.members[idx];
|
|
733
|
+
if (member === undefined)
|
|
734
|
+
return null;
|
|
735
|
+
const previous = scanned.members[idx - 1];
|
|
736
|
+
const next = scanned.members[idx + 1];
|
|
737
|
+
if (next !== undefined)
|
|
738
|
+
return existingJson.slice(0, member.start) + existingJson.slice(next.start);
|
|
739
|
+
if (previous === undefined)
|
|
740
|
+
return null;
|
|
741
|
+
return existingJson.slice(0, previous.end) + existingJson.slice(member.end);
|
|
742
|
+
}
|
|
602
743
|
/** Parse JSON, add only `mcpServers.<name>`, verify no other keys or servers change. */
|
|
603
744
|
function mergeJsonMcpConfigPreserving(existingJson, agentId, version, serverName, configPath) {
|
|
604
745
|
const parsed = parseJsonFile(configPath, existingJson);
|
|
@@ -613,7 +754,10 @@ function mergeJsonMcpConfigPreserving(existingJson, agentId, version, serverName
|
|
|
613
754
|
const nextRoot = { ...parsed, mcpServers: { ...servers, [serverName]: entry } };
|
|
614
755
|
const { space, trailingNewline } = detectJsonIndent(existingJson);
|
|
615
756
|
const serialized = JSON.stringify(nextRoot, null, space);
|
|
616
|
-
const
|
|
757
|
+
const reserialized = trailingNewline ? `${serialized}\n` : serialized;
|
|
758
|
+
// Keep the person's own layout when the entry can be added as plain text and still parses to the same object.
|
|
759
|
+
const inPlace = insertJsonMcpEntryInPlace(existingJson, serverName, entry, space);
|
|
760
|
+
const withNl = inPlace !== null && jsonTextEquals(inPlace, nextRoot) ? inPlace : reserialized;
|
|
617
761
|
let reparsed;
|
|
618
762
|
try {
|
|
619
763
|
reparsed = JSON.parse(withNl);
|
|
@@ -707,6 +851,10 @@ export function removeJsonMcpEntry(existingJson, serverName, configPath, keepEmp
|
|
|
707
851
|
delete root['mcpServers'];
|
|
708
852
|
else
|
|
709
853
|
root['mcpServers'] = merged;
|
|
854
|
+
// Other servers remain: cut the one member out of the text so the file keeps its layout.
|
|
855
|
+
const inPlace = Object.keys(merged).length > 0 ? removeJsonMcpEntryInPlace(existingJson, serverName) : null;
|
|
856
|
+
if (inPlace !== null && jsonTextEquals(inPlace, root))
|
|
857
|
+
return inPlace;
|
|
710
858
|
return stableStringifyMcp(root);
|
|
711
859
|
}
|
|
712
860
|
function codexMcpTableHeader(serverName) {
|
package/dist/declared-agent.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* A misconfiguration guard: every AIS request names the agent this session is
|
|
5
5
|
* meant to be, and the server refuses a request whose declared agent disagrees
|
|
6
|
-
* with the agent the credential/path is bound to (e.g.
|
|
7
|
-
* with AIS_AGENT_ID
|
|
6
|
+
* with the agent the credential/path is bound to (e.g. one agent's key launched
|
|
7
|
+
* with another agent's AIS_AGENT_ID). The value follows the session identity: AIS_AGENT_ID
|
|
8
8
|
* at launch, then the agent a verified agent_load switched to (index.ts
|
|
9
9
|
* registers the source). agent_load runs its switch calls under
|
|
10
10
|
* declaringAgent(), declaring the target, so a deliberate switch is not refused.
|
package/dist/declared-agent.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* A misconfiguration guard: every AIS request names the agent this session is
|
|
5
5
|
* meant to be, and the server refuses a request whose declared agent disagrees
|
|
6
|
-
* with the agent the credential/path is bound to (e.g.
|
|
7
|
-
* with AIS_AGENT_ID
|
|
6
|
+
* with the agent the credential/path is bound to (e.g. one agent's key launched
|
|
7
|
+
* with another agent's AIS_AGENT_ID). The value follows the session identity: AIS_AGENT_ID
|
|
8
8
|
* at launch, then the agent a verified agent_load switched to (index.ts
|
|
9
9
|
* registers the source). agent_load runs its switch calls under
|
|
10
10
|
* declaringAgent(), declaring the target, so a deliberate switch is not refused.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const layerSchema: z.ZodObject<{
|
|
3
|
+
version: z.ZodString;
|
|
4
|
+
schemaVersion: z.ZodLiteral<3>;
|
|
5
|
+
tierVersions: z.ZodObject<{
|
|
6
|
+
platform: z.ZodNullable<z.ZodString>;
|
|
7
|
+
org: z.ZodNullable<z.ZodString>;
|
|
8
|
+
tenant: z.ZodNullable<z.ZodString>;
|
|
9
|
+
agent: z.ZodNullable<z.ZodString>;
|
|
10
|
+
}, z.core.$strict>;
|
|
11
|
+
rules: z.ZodArray<z.ZodObject<{
|
|
12
|
+
id: z.ZodString;
|
|
13
|
+
category: z.ZodString;
|
|
14
|
+
description: z.ZodString;
|
|
15
|
+
constraint: z.ZodString;
|
|
16
|
+
priority: z.ZodNumber;
|
|
17
|
+
tier: z.ZodEnum<{
|
|
18
|
+
platform: "platform";
|
|
19
|
+
org: "org";
|
|
20
|
+
tenant: "tenant";
|
|
21
|
+
agent: "agent";
|
|
22
|
+
}>;
|
|
23
|
+
authoredBy: z.ZodEnum<{
|
|
24
|
+
owner: "owner";
|
|
25
|
+
agent: "agent";
|
|
26
|
+
}>;
|
|
27
|
+
}, z.core.$strict>>;
|
|
28
|
+
skills: z.ZodArray<z.ZodObject<{
|
|
29
|
+
name: z.ZodString;
|
|
30
|
+
whenToUse: z.ZodString;
|
|
31
|
+
version: z.ZodString;
|
|
32
|
+
temperature: z.ZodString;
|
|
33
|
+
tier: z.ZodEnum<{
|
|
34
|
+
platform: "platform";
|
|
35
|
+
org: "org";
|
|
36
|
+
tenant: "tenant";
|
|
37
|
+
agent: "agent";
|
|
38
|
+
}>;
|
|
39
|
+
authoredBy: z.ZodEnum<{
|
|
40
|
+
owner: "owner";
|
|
41
|
+
agent: "agent";
|
|
42
|
+
}>;
|
|
43
|
+
}, z.core.$strict>>;
|
|
44
|
+
ruleCount: z.ZodNumber;
|
|
45
|
+
skillCount: z.ZodNumber;
|
|
46
|
+
truncated: z.ZodLiteral<false>;
|
|
47
|
+
}, z.core.$strict>;
|
|
48
|
+
export type CachedOperatingLayer = z.infer<typeof layerSchema>;
|
|
49
|
+
export declare function verifiedOperatingLayer(raw: unknown): CachedOperatingLayer | null;
|
|
50
|
+
export declare function operatingLayerCachePath(home: string, endpoint: string, agentId: string, credentialKey: string): string;
|
|
51
|
+
export declare function readOperatingLayerCache(path: string): CachedOperatingLayer | null;
|
|
52
|
+
export declare function writeOperatingLayerCache(path: string, layer: CachedOperatingLayer): void;
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** Hook-only cache. Keep schema and canonical hashing aligned with AIS operating-layer.ts. */
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
const tiers = ['platform', 'org', 'tenant', 'agent'];
|
|
7
|
+
const tier = z.enum(tiers);
|
|
8
|
+
const author = z.enum(['owner', 'agent']);
|
|
9
|
+
const version = z.string().regex(/^sha256:[0-9a-f]{64}$/);
|
|
10
|
+
const rule = z.object({ id: z.string(), category: z.string(), description: z.string(), constraint: z.string(), priority: z.number(), tier, authoredBy: author }).strict();
|
|
11
|
+
const skill = z.object({ name: z.string(), whenToUse: z.string(), version: z.string(), temperature: z.string(), tier, authoredBy: author }).strict();
|
|
12
|
+
const layerSchema = z.object({
|
|
13
|
+
version, schemaVersion: z.literal(3),
|
|
14
|
+
tierVersions: z.object({ platform: version.nullable(), org: version.nullable(), tenant: version.nullable(), agent: version.nullable() }).strict(),
|
|
15
|
+
rules: z.array(rule), skills: z.array(skill), ruleCount: z.number().int().nonnegative(), skillCount: z.number().int().nonnegative(), truncated: z.literal(false),
|
|
16
|
+
}).strict();
|
|
17
|
+
function hash(value) {
|
|
18
|
+
return `sha256:${createHash('sha256').update(JSON.stringify(value), 'utf8').digest('hex')}`;
|
|
19
|
+
}
|
|
20
|
+
export function verifiedOperatingLayer(raw) {
|
|
21
|
+
const parsed = layerSchema.safeParse(raw);
|
|
22
|
+
if (!parsed.success)
|
|
23
|
+
return null;
|
|
24
|
+
const layer = parsed.data;
|
|
25
|
+
if (layer.ruleCount !== layer.rules.length || layer.skillCount !== layer.skills.length)
|
|
26
|
+
return null;
|
|
27
|
+
const pairs = tiers.map((name) => {
|
|
28
|
+
const rules = layer.rules.filter((entry) => entry.tier === name);
|
|
29
|
+
const skills = layer.skills.filter((entry) => entry.tier === name).map(({ temperature: _temperature, ...stable }) => stable);
|
|
30
|
+
const computed = rules.length === 0 && skills.length === 0 ? null : hash({ schemaVersion: 3, tier: name, rules, skills });
|
|
31
|
+
return [name, computed];
|
|
32
|
+
});
|
|
33
|
+
if (pairs.some(([name, computed]) => layer.tierVersions[name] !== computed))
|
|
34
|
+
return null;
|
|
35
|
+
return hash(pairs) === layer.version ? layer : null;
|
|
36
|
+
}
|
|
37
|
+
export function operatingLayerCachePath(home, endpoint, agentId, credentialKey) {
|
|
38
|
+
return join(home, '.aismemory', 'operating-layer-cache', `${createHash('sha256').update(JSON.stringify([endpoint, agentId, credentialKey])).digest('hex')}.json`);
|
|
39
|
+
}
|
|
40
|
+
export function readOperatingLayerCache(path) {
|
|
41
|
+
try {
|
|
42
|
+
return verifiedOperatingLayer(JSON.parse(readFileSync(path, 'utf8')));
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return null;
|
|
46
|
+
} // Missing, unreadable or corrupt cache always requests the full body.
|
|
47
|
+
}
|
|
48
|
+
export function writeOperatingLayerCache(path, layer) {
|
|
49
|
+
const temporary = `${path}.${process.pid}.tmp`;
|
|
50
|
+
try {
|
|
51
|
+
mkdirSync(dirname(path), { recursive: true, mode: 0o700 });
|
|
52
|
+
writeFileSync(temporary, JSON.stringify(layer), { mode: 0o600, flag: 'wx' });
|
|
53
|
+
renameSync(temporary, path);
|
|
54
|
+
}
|
|
55
|
+
finally {
|
|
56
|
+
rmSync(temporary, { force: true });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=held-operating-layer.js.map
|