aismemory 0.8.6 → 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 +4 -3
- package/dist/agent-key-mode.js +6 -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 +1 -1
- package/dist/auto-handoff.js +5 -1
- package/dist/cli/hooks.js +36 -2
- 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 +95 -44
- package/dist/mcp/tools.d.ts +11 -2
- package/dist/mcp/tools.js +64 -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 +5 -2
- package/dist/session-identity.js +1 -0
- package/dist/tool-args.d.ts +15 -1
- package/dist/tool-args.js +63 -3
- package/dist/workspace-key-mode.js +5 -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.7"],
|
|
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`. |
|
|
@@ -323,7 +324,7 @@ mint a new one.
|
|
|
323
324
|
"mcpServers": {
|
|
324
325
|
"aismemory": {
|
|
325
326
|
"command": "npx",
|
|
326
|
-
"args": ["aismemory@0.8.
|
|
327
|
+
"args": ["aismemory@0.8.7"],
|
|
327
328
|
"env": {
|
|
328
329
|
"AIS_WORKSPACE_KEY": "ais_wk_...",
|
|
329
330
|
"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, 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);
|
|
@@ -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
|
@@ -14,4 +14,4 @@ export interface HandoffPayload {
|
|
|
14
14
|
keyLearnings: string[];
|
|
15
15
|
}
|
|
16
16
|
export declare function buildHandoffPayload(tracker: ActivityTracker): HandoffPayload;
|
|
17
|
-
export declare function setupAutoHandoff(aisUrl: string, agentId: string, token: string, tracker: ActivityTracker, onBeforeExit?: () => void, beforeWrite?: () => Promise<void>): void;
|
|
17
|
+
export declare function setupAutoHandoff(aisUrl: string, agentId: string, token: string, tracker: ActivityTracker, onBeforeExit?: () => void, beforeWrite?: () => Promise<void>): () => void;
|
package/dist/auto-handoff.js
CHANGED
|
@@ -92,7 +92,7 @@ export function setupAutoHandoff(aisUrl, agentId, token, tracker, onBeforeExit,
|
|
|
92
92
|
// failure. Without this check the catch below never fires on a rejected
|
|
93
93
|
// handoff and the session exits as though its handoff had landed, which
|
|
94
94
|
// is exactly how a production 500 on this route stayed invisible to
|
|
95
|
-
// every client (
|
|
95
|
+
// every client (tester reconciliation 2026-09-17, defect 2).
|
|
96
96
|
if (!response.ok) {
|
|
97
97
|
process.stderr.write(`[aismemory] Auto-handoff was NOT saved — the server rejected it (${await describeHandoffFailure(response)}). This session's handoff is lost.\n`);
|
|
98
98
|
}
|
|
@@ -108,5 +108,9 @@ export function setupAutoHandoff(aisUrl, agentId, token, tracker, onBeforeExit,
|
|
|
108
108
|
};
|
|
109
109
|
process.on('SIGTERM', onSignal);
|
|
110
110
|
process.on('SIGINT', onSignal);
|
|
111
|
+
return () => {
|
|
112
|
+
process.off('SIGTERM', onSignal);
|
|
113
|
+
process.off('SIGINT', onSignal);
|
|
114
|
+
};
|
|
111
115
|
}
|
|
112
116
|
//# 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/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
|