brain-memory 0.4.0 → 0.5.1
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/CHANGELOG.md +132 -0
- package/README.md +4 -0
- package/SECURITY.md +17 -6
- package/bin/brain.js +24 -3
- package/bin/cloud-sync.js +65 -7
- package/bin/install.js +72 -14
- package/bin/memorize.js +50 -6
- package/bin/port.js +174 -0
- package/bin/recall.js +16 -6
- package/bin/reinforce.js +5 -0
- package/bin/session-start.js +30 -4
- package/bin/verify.js +42 -4
- package/commands/brain/memorize.md +8 -0
- package/commands/brain/verify.md +10 -2
- package/hooks/citation-check.mjs +94 -0
- package/hooks/hooks.json +11 -0
- package/hooks/lib.mjs +6 -0
- package/hooks/prompt-recall.mjs +24 -3
- package/hooks/session-start.mjs +4 -2
- package/integrations/README.md +4 -0
- package/integrations/agentskills/brain-memory/SKILL.md +9 -5
- package/package.json +5 -4
- package/prompts/antigravity.md +4 -2
- package/prompts/claude.md +4 -2
- package/prompts/copilot.md +4 -2
- package/prompts/kilo.md +4 -2
- package/prompts/openai.md +4 -2
- package/prompts/opencode.md +4 -2
- package/src/adapters.js +240 -0
- package/src/anomaly.js +41 -1
- package/src/cloud-sync.js +162 -27
- package/src/content-lint.js +55 -2
- package/src/export-import.js +1 -1
- package/src/git-sync.js +1 -1
- package/src/index-manager.js +9 -5
- package/src/installer.js +35 -1
- package/src/pinning.js +20 -1
- package/src/provenance.js +34 -0
- package/src/quarantine.js +82 -5
- package/src/receipt.js +9 -4
- package/src/surfaced.js +188 -0
- package/store/conformance/helpers.js +70 -16
- package/store/test/oidc.test.js +13 -8
package/store/test/oidc.test.js
CHANGED
|
@@ -11,14 +11,19 @@ const crypto = require('crypto');
|
|
|
11
11
|
|
|
12
12
|
const { createVerifier, looksLikeJwt, OidcError } = require('../lib/oidc');
|
|
13
13
|
const { startMockIssuer, makeKey, sign } = require('./mock-issuer');
|
|
14
|
-
const { client, startReferenceStore, sampleArchive } = require('../conformance/helpers');
|
|
14
|
+
const { client, plainFetch, startReferenceStore, sampleArchive } = require('../conformance/helpers');
|
|
15
|
+
|
|
16
|
+
// Every verifier here talks to the mock issuer through plainFetch rather than the
|
|
17
|
+
// global fetch, so no pooled connection outlives the test process (see
|
|
18
|
+
// conformance/helpers.js). The default-fetch path is covered by the connector's
|
|
19
|
+
// OIDC test, which runs on a newer Node.
|
|
15
20
|
|
|
16
21
|
describe('ID-token verification', () => {
|
|
17
22
|
let idp;
|
|
18
23
|
let verifier;
|
|
19
24
|
before(async () => {
|
|
20
25
|
idp = await startMockIssuer();
|
|
21
|
-
verifier = createVerifier({ issuer: idp.issuer, audience: idp.clientId });
|
|
26
|
+
verifier = createVerifier({ issuer: idp.issuer, audience: idp.clientId, fetch: plainFetch });
|
|
22
27
|
});
|
|
23
28
|
after(() => idp.close());
|
|
24
29
|
|
|
@@ -113,7 +118,7 @@ describe('issuer safeguards', () => {
|
|
|
113
118
|
const idp = await startMockIssuer();
|
|
114
119
|
try {
|
|
115
120
|
const fetchLying = async (url) => {
|
|
116
|
-
const res = await
|
|
121
|
+
const res = await plainFetch(url);
|
|
117
122
|
const body = await res.json();
|
|
118
123
|
if (body.issuer) body.issuer = 'https://somewhere-else.example';
|
|
119
124
|
return { ok: true, status: 200, json: async () => body };
|
|
@@ -132,22 +137,22 @@ describe('allow-lists', () => {
|
|
|
132
137
|
after(() => idp.close());
|
|
133
138
|
|
|
134
139
|
it('admits a verified address in an allowed domain, and nobody else', async () => {
|
|
135
|
-
const v = createVerifier({ issuer: idp.issuer, audience: idp.clientId, allowedDomains: 'example.org, other.test' });
|
|
140
|
+
const v = createVerifier({ issuer: idp.issuer, audience: idp.clientId, allowedDomains: 'example.org, other.test', fetch: plainFetch });
|
|
136
141
|
await v.verify(idp.idToken());
|
|
137
142
|
await assert.rejects(v.verify(idp.idToken({ email: 'mallory@evil.test' })), /allow-list/);
|
|
138
143
|
await assert.rejects(v.verify(idp.idToken({ email: 'x@notexample.org' })), /allow-list/);
|
|
139
144
|
});
|
|
140
145
|
|
|
141
146
|
it('ignores an address the issuer has not verified', async () => {
|
|
142
|
-
const v = createVerifier({ issuer: idp.issuer, audience: idp.clientId, allowedDomains: 'example.org' });
|
|
147
|
+
const v = createVerifier({ issuer: idp.issuer, audience: idp.clientId, allowedDomains: 'example.org', fetch: plainFetch });
|
|
143
148
|
await assert.rejects(v.verify(idp.idToken({ email_verified: false })), /allow-list/);
|
|
144
149
|
await assert.rejects(v.verify(idp.idToken({ email_verified: undefined })), /allow-list/);
|
|
145
150
|
});
|
|
146
151
|
|
|
147
152
|
it('admits by Google hosted-domain claim and by exact address', async () => {
|
|
148
|
-
const byHd = createVerifier({ issuer: idp.issuer, audience: idp.clientId, allowedDomains: 'corp.test' });
|
|
153
|
+
const byHd = createVerifier({ issuer: idp.issuer, audience: idp.clientId, allowedDomains: 'corp.test', fetch: plainFetch });
|
|
149
154
|
await byHd.verify(idp.idToken({ hd: 'corp.test', email: 'someone@gmail.test' }));
|
|
150
|
-
const byEmail = createVerifier({ issuer: idp.issuer, audience: idp.clientId, allowedEmails: ['Alice@Example.org'] });
|
|
155
|
+
const byEmail = createVerifier({ issuer: idp.issuer, audience: idp.clientId, allowedEmails: ['Alice@Example.org'], fetch: plainFetch });
|
|
151
156
|
await byEmail.verify(idp.idToken());
|
|
152
157
|
await assert.rejects(byEmail.verify(idp.idToken({ email: 'bob@example.org' })), /allow-list/);
|
|
153
158
|
});
|
|
@@ -158,7 +163,7 @@ describe('the store accepts ID tokens', () => {
|
|
|
158
163
|
let ref;
|
|
159
164
|
before(async () => {
|
|
160
165
|
idp = await startMockIssuer();
|
|
161
|
-
ref = await startReferenceStore({ oidc: { issuer: idp.issuer, audience: idp.clientId } });
|
|
166
|
+
ref = await startReferenceStore({ oidc: { issuer: idp.issuer, audience: idp.clientId, fetch: plainFetch } });
|
|
162
167
|
});
|
|
163
168
|
after(async () => { await ref.close(); await idp.close(); });
|
|
164
169
|
|