aismemory 0.8.9 → 0.8.10
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 +38 -7
- package/dist/agent-key-mode.d.ts +26 -0
- package/dist/agent-key-mode.js +165 -26
- package/dist/agent-only-pass.d.ts +41 -0
- package/dist/agent-only-pass.js +539 -0
- package/dist/ais-http.d.ts +11 -0
- package/dist/ais-http.js +31 -17
- package/dist/cli/hooks.d.ts +35 -5
- package/dist/cli/hooks.js +280 -66
- package/dist/cli/install.d.ts +8 -0
- package/dist/cli/install.js +15 -0
- package/dist/cli/orientation-load.d.ts +18 -0
- package/dist/cli/orientation-load.js +50 -0
- package/dist/cli/read-claude-memory-tree.d.ts +37 -0
- package/dist/cli/read-claude-memory-tree.js +247 -2
- package/dist/cli/setup-core.js +7 -3
- package/dist/cli/slack.d.ts +2 -0
- package/dist/cli/slack.js +263 -0
- package/dist/cli/sync-memory.js +6 -3
- package/dist/cli-info.d.ts +1 -0
- package/dist/cli-info.js +4 -2
- package/dist/decision-card.d.ts +42 -0
- package/dist/decision-card.js +50 -0
- package/dist/decision-ledger.d.ts +24 -0
- package/dist/decision-ledger.js +59 -0
- package/dist/decision-receipt.d.ts +33 -0
- package/dist/decision-receipt.js +72 -0
- package/dist/device-poll.d.ts +16 -7
- package/dist/device-poll.js +31 -3
- package/dist/handoff-doc.d.ts +9 -0
- package/dist/handoff-doc.js +53 -0
- package/dist/inbox-client.js +33 -26
- package/dist/index.js +221 -56
- package/dist/mcp/tools.d.ts +3 -0
- package/dist/mcp/tools.js +119 -31
- package/dist/operating-layer-read.d.ts +38 -0
- package/dist/operating-layer-read.js +164 -0
- package/dist/pipeline/types.d.ts +2 -0
- package/dist/recall-warning.d.ts +14 -0
- package/dist/recall-warning.js +36 -0
- package/dist/request-timeout.d.ts +27 -2
- package/dist/request-timeout.js +92 -2
- package/dist/run-pass-mode.js +34 -16
- package/dist/session-identity.js +3 -1
- package/dist/session-start.d.ts +13 -3
- package/dist/session-start.js +53 -10
- package/dist/skill-fetch.d.ts +30 -0
- package/dist/skill-fetch.js +88 -0
- package/dist/slack-tools.d.ts +44 -0
- package/dist/slack-tools.js +156 -0
- package/dist/sources/local-claude.js +16 -2
- package/dist/sources/types.d.ts +2 -0
- package/dist/startup-identity.d.ts +4 -0
- package/dist/startup-identity.js +2 -0
- package/dist/tool-args.d.ts +12 -1
- package/dist/tool-args.js +15 -0
- package/dist/tool-scope-filter.d.ts +29 -0
- package/dist/tool-scope-filter.js +123 -0
- package/dist/version-check.d.ts +30 -3
- package/dist/version-check.js +59 -4
- package/dist/workspace-key-mode.js +36 -22
- package/package.json +4 -3
|
@@ -17,20 +17,22 @@
|
|
|
17
17
|
* Precedence: workspace key -> agent API key -> DID/device flow.
|
|
18
18
|
*/
|
|
19
19
|
import { SESSION_START_WORKSPACE_KEY_NOTE } from './session-start.js';
|
|
20
|
+
import { handoffDocFields, withHandoffDocWarning } from './handoff-doc.js';
|
|
20
21
|
import { AisHttpError, duplicateMemoryResult } from './ais-http-error.js';
|
|
21
|
-
import { AIS_GET_RETRYABLE_STATUSES, AIS_GET_RETRY_DELAY_MS } from './ais-http.js';
|
|
22
|
+
import { AIS_GET_RETRYABLE_STATUSES, AIS_GET_RETRY_DELAY_MS, captureServerVersionHeaders, withAisClientVersion, } from './ais-http.js';
|
|
22
23
|
import { captureCredentialExpiry, withCredentialExpiry } from './credential-expiry.js';
|
|
23
|
-
import { getAisRequestTimeoutMs, toAisRequestError } from './request-timeout.js';
|
|
24
|
+
import { aisRequestSignal, getAisRequestTimeoutMs, setInboxReadStage, toAisRequestError } from './request-timeout.js';
|
|
24
25
|
import { withDeclaredAgent } from './declared-agent.js';
|
|
25
26
|
import { emitTelemetry } from './telemetry.js';
|
|
26
27
|
import { OutOfScopeToolError } from './agent-key-mode.js';
|
|
28
|
+
import { SKILL_GET_TOOL, SKILL_GET_KEY_MODE_DETAIL } from './operating-layer-read.js';
|
|
27
29
|
import { OPERATING_LAYER_PUT_TOOL, OPERATING_LAYER_PUT_KEY_MODE_DETAIL } from './operating-layer-write.js';
|
|
28
30
|
import { retryAfterOf, shouldHonourRetryAfter, sleepSeconds } from './retry-after.js';
|
|
29
31
|
import { readInboxAndMaybeAck } from './inbox-client.js';
|
|
30
|
-
import {
|
|
32
|
+
import { orientAgainstStoredManifest } from './cli/orientation-load.js';
|
|
31
33
|
import { AGENT_ARCHIVE_KEY_MODE_DETAIL } from './agent-archive.js';
|
|
32
34
|
import { fetchCredentialWhoami } from './credential-whoami.js';
|
|
33
|
-
import { parseEmptyToolArgs, parseRecallArgs, parseMemoryGetArgs, buildMemoryGetPath, shapeMemoryGetResult, buildFullContextQuery, parseFullContextArgs, buildRememberStoreBody, shapeRememberResult, parseRememberArgs, parseAgentLoadArgs, parseGoalCreateArgs, parseGoalListArgs, parseGoalUpdateProgressArgs, parseGoalActivateArgs, parseGoalCompleteArgs, parseInboxSendArgs, parseInboxReadArgs, parseInboxAckArgs, parseHandoffArgs, } from './tool-args.js';
|
|
35
|
+
import { parseEmptyToolArgs, parseRecallArgs, parseMemoryGetArgs, buildMemoryGetPath, shapeMemoryGetResult, buildFullContextQuery, parseFullContextArgs, buildRememberStoreBody, shapeRememberResult, parseRememberArgs, parseUpdateMemoryArgs, parseAgentLoadArgs, parseGoalCreateArgs, parseGoalListArgs, parseGoalUpdateProgressArgs, parseGoalActivateArgs, parseGoalCompleteArgs, parseInboxSendArgs, parseInboxReadArgs, parseInboxAckArgs, parseHandoffArgs, } from './tool-args.js';
|
|
34
36
|
import { resolveDreamResponse } from './dream-poll.js';
|
|
35
37
|
import { forgetOwnMemory } from './memory-forget.js';
|
|
36
38
|
/** Thrown by loadWorkspaceKeyConfig when AIS_WORKSPACE_KEY is set without AIS_AGENT_ID. */
|
|
@@ -94,16 +96,18 @@ export function loadWorkspaceKeyConfig(env = process.env) {
|
|
|
94
96
|
}
|
|
95
97
|
return { workspaceKey, agentId };
|
|
96
98
|
}
|
|
97
|
-
async function readJson(res) {
|
|
99
|
+
async function readJson(res, path, method = 'GET') {
|
|
98
100
|
const warning = captureCredentialExpiry(res);
|
|
101
|
+
setInboxReadStage(`${method} ${path}: body`);
|
|
99
102
|
const data = await res.json().catch(() => null);
|
|
103
|
+
setInboxReadStage(`${method} ${path}: body`);
|
|
100
104
|
return withCredentialExpiry(data, warning);
|
|
101
105
|
}
|
|
102
106
|
export async function wksKeyPost(aisUrl, path, workspaceKey, body, fetchImpl = globalThis.fetch) {
|
|
103
|
-
const headers = withDeclaredAgent({
|
|
107
|
+
const headers = withDeclaredAgent(withAisClientVersion({
|
|
104
108
|
'Content-Type': 'application/json',
|
|
105
109
|
'x-workspace-key': workspaceKey,
|
|
106
|
-
});
|
|
110
|
+
}));
|
|
107
111
|
const timeoutMs = getAisRequestTimeoutMs();
|
|
108
112
|
let res;
|
|
109
113
|
try {
|
|
@@ -111,7 +115,7 @@ export async function wksKeyPost(aisUrl, path, workspaceKey, body, fetchImpl = g
|
|
|
111
115
|
method: 'POST',
|
|
112
116
|
headers,
|
|
113
117
|
body: JSON.stringify(body),
|
|
114
|
-
signal:
|
|
118
|
+
signal: aisRequestSignal(path, timeoutMs, 'POST'),
|
|
115
119
|
});
|
|
116
120
|
}
|
|
117
121
|
catch (err) {
|
|
@@ -119,7 +123,8 @@ export async function wksKeyPost(aisUrl, path, workspaceKey, body, fetchImpl = g
|
|
|
119
123
|
emitTelemetry({ event: 'ais.http.failure', path, error: wrapped instanceof Error ? wrapped.message : String(wrapped) });
|
|
120
124
|
throw wrapped;
|
|
121
125
|
}
|
|
122
|
-
|
|
126
|
+
captureServerVersionHeaders(res);
|
|
127
|
+
const data = await readJson(res, path, 'POST');
|
|
123
128
|
if (!res.ok) {
|
|
124
129
|
emitTelemetry({ event: 'ais.http.failure', path, httpStatus: res.status, error: `HTTP ${res.status}` });
|
|
125
130
|
throw new AisHttpError(res.status, path, data, retryAfterOf(res));
|
|
@@ -133,8 +138,8 @@ export async function wksKeyGet(aisUrl, path, workspaceKey, fetchImpl = globalTh
|
|
|
133
138
|
for (;;) {
|
|
134
139
|
try {
|
|
135
140
|
res = await fetchImpl(`${aisUrl}${path}`, {
|
|
136
|
-
headers: withDeclaredAgent({ 'x-workspace-key': workspaceKey }),
|
|
137
|
-
signal:
|
|
141
|
+
headers: withDeclaredAgent(withAisClientVersion({ 'x-workspace-key': workspaceKey })),
|
|
142
|
+
signal: aisRequestSignal(path, timeoutMs),
|
|
138
143
|
});
|
|
139
144
|
}
|
|
140
145
|
catch (err) {
|
|
@@ -150,6 +155,7 @@ export async function wksKeyGet(aisUrl, path, workspaceKey, fetchImpl = globalTh
|
|
|
150
155
|
captureCredentialExpiry(res);
|
|
151
156
|
attempt += 1;
|
|
152
157
|
emitTelemetry({ event: 'ais.http.retry', path, httpStatus: res.status });
|
|
158
|
+
setInboxReadStage(`GET ${path}: retry delay`);
|
|
153
159
|
if (retryAfter === null) {
|
|
154
160
|
await new Promise((resolve) => setTimeout(resolve, AIS_GET_RETRY_DELAY_MS));
|
|
155
161
|
}
|
|
@@ -160,7 +166,8 @@ export async function wksKeyGet(aisUrl, path, workspaceKey, fetchImpl = globalTh
|
|
|
160
166
|
}
|
|
161
167
|
break;
|
|
162
168
|
}
|
|
163
|
-
|
|
169
|
+
captureServerVersionHeaders(res);
|
|
170
|
+
const data = await readJson(res, path);
|
|
164
171
|
if (!res.ok) {
|
|
165
172
|
emitTelemetry({ event: 'ais.http.failure', path, httpStatus: res.status, error: `HTTP ${res.status}` });
|
|
166
173
|
throw new AisHttpError(res.status, path, data, retryAfterOf(res));
|
|
@@ -168,10 +175,10 @@ export async function wksKeyGet(aisUrl, path, workspaceKey, fetchImpl = globalTh
|
|
|
168
175
|
return data;
|
|
169
176
|
}
|
|
170
177
|
export async function wksKeyPatch(aisUrl, path, workspaceKey, body, fetchImpl = globalThis.fetch) {
|
|
171
|
-
const headers = withDeclaredAgent({
|
|
178
|
+
const headers = withDeclaredAgent(withAisClientVersion({
|
|
172
179
|
'Content-Type': 'application/json',
|
|
173
180
|
'x-workspace-key': workspaceKey,
|
|
174
|
-
});
|
|
181
|
+
}));
|
|
175
182
|
const timeoutMs = getAisRequestTimeoutMs();
|
|
176
183
|
let res;
|
|
177
184
|
try {
|
|
@@ -179,7 +186,7 @@ export async function wksKeyPatch(aisUrl, path, workspaceKey, body, fetchImpl =
|
|
|
179
186
|
method: 'PATCH',
|
|
180
187
|
headers,
|
|
181
188
|
body: JSON.stringify(body),
|
|
182
|
-
signal:
|
|
189
|
+
signal: aisRequestSignal(path, timeoutMs, 'PATCH'),
|
|
183
190
|
});
|
|
184
191
|
}
|
|
185
192
|
catch (err) {
|
|
@@ -187,7 +194,8 @@ export async function wksKeyPatch(aisUrl, path, workspaceKey, body, fetchImpl =
|
|
|
187
194
|
emitTelemetry({ event: 'ais.http.failure', path, error: wrapped instanceof Error ? wrapped.message : String(wrapped) });
|
|
188
195
|
throw wrapped;
|
|
189
196
|
}
|
|
190
|
-
|
|
197
|
+
captureServerVersionHeaders(res);
|
|
198
|
+
const data = await readJson(res, path, 'PATCH');
|
|
191
199
|
if (!res.ok) {
|
|
192
200
|
emitTelemetry({ event: 'ais.http.failure', path, httpStatus: res.status, error: `HTTP ${res.status}` });
|
|
193
201
|
throw new AisHttpError(res.status, path, data, retryAfterOf(res));
|
|
@@ -213,6 +221,10 @@ export async function dispatchToolWorkspaceKeyMode(aisUrl, config, name, rawArgs
|
|
|
213
221
|
throw err;
|
|
214
222
|
}
|
|
215
223
|
}
|
|
224
|
+
case 'update_memory': {
|
|
225
|
+
const { memoryId, ...update } = parseUpdateMemoryArgs(rawArgs);
|
|
226
|
+
return wksKeyPatch(aisUrl, `/v1/agents/${agentId}/memory/${memoryId}`, workspaceKey, update, fetchImpl);
|
|
227
|
+
}
|
|
216
228
|
case 'recall': {
|
|
217
229
|
const args = parseRecallArgs(rawArgs);
|
|
218
230
|
const params = new URLSearchParams();
|
|
@@ -240,7 +252,7 @@ export async function dispatchToolWorkspaceKeyMode(aisUrl, config, name, rawArgs
|
|
|
240
252
|
const fcArgs = parseFullContextArgs(rawArgs);
|
|
241
253
|
const fcQs = buildFullContextQuery(fcArgs);
|
|
242
254
|
const fcPath = `/v1/agents/${agentId}/full-context${fcQs}`;
|
|
243
|
-
return wksKeyGet(aisUrl, fcPath, workspaceKey, fetchImpl);
|
|
255
|
+
return withHandoffDocWarning(await wksKeyGet(aisUrl, fcPath, workspaceKey, fetchImpl));
|
|
244
256
|
}
|
|
245
257
|
case 'dream':
|
|
246
258
|
parseEmptyToolArgs(rawArgs);
|
|
@@ -251,11 +263,11 @@ export async function dispatchToolWorkspaceKeyMode(aisUrl, config, name, rawArgs
|
|
|
251
263
|
// key can do, fall back to the liveness probe on an older server.
|
|
252
264
|
return fetchCredentialWhoami(agentId, 'workspace-key', () => wksKeyGet(aisUrl, `/v1/agents/${agentId}/whoami`, workspaceKey, fetchImpl), () => wksKeyGet(aisUrl, `/v1/agents/${agentId}/memory?limit=1`, workspaceKey, fetchImpl));
|
|
253
265
|
}
|
|
266
|
+
case 'environment_manifest_get':
|
|
267
|
+
parseEmptyToolArgs(rawArgs);
|
|
268
|
+
return wksKeyGet(aisUrl, `/v1/agents/${agentId}/environment-manifest`, workspaceKey, fetchImpl);
|
|
254
269
|
case 'orientation_check':
|
|
255
|
-
|
|
256
|
-
// needed. orient() validates its own input and throws on a malformed
|
|
257
|
-
// manifest; the caller's outer catch turns that into an {error} result.
|
|
258
|
-
return orient(rawArgs);
|
|
270
|
+
return orientAgainstStoredManifest(rawArgs, agentId, () => wksKeyGet(aisUrl, `/v1/agents/${agentId}/environment-manifest`, workspaceKey, fetchImpl));
|
|
259
271
|
case 'agent_load': {
|
|
260
272
|
const args = parseAgentLoadArgs(rawArgs);
|
|
261
273
|
const targetAgentId = args.query.trim();
|
|
@@ -355,12 +367,14 @@ export async function dispatchToolWorkspaceKeyMode(aisUrl, config, name, rawArgs
|
|
|
355
367
|
return wksKeyPost(aisUrl, `/v1/agents/${agentId}/handoff`, workspaceKey, {
|
|
356
368
|
...(args.summary !== undefined ? { summary: args.summary } : {}),
|
|
357
369
|
...(args.keyLearnings !== undefined ? { keyLearnings: args.keyLearnings } : {}),
|
|
358
|
-
...(args.docPath
|
|
370
|
+
...await handoffDocFields(args.docPath),
|
|
359
371
|
...(args.docPrUrl !== undefined ? { docPrUrl: args.docPrUrl } : {}),
|
|
360
372
|
}, fetchImpl);
|
|
361
373
|
}
|
|
362
374
|
case OPERATING_LAYER_PUT_TOOL:
|
|
363
375
|
throw new OutOfScopeToolError(name, OPERATING_LAYER_PUT_KEY_MODE_DETAIL);
|
|
376
|
+
case SKILL_GET_TOOL:
|
|
377
|
+
throw new OutOfScopeToolError(name, SKILL_GET_KEY_MODE_DETAIL);
|
|
364
378
|
case 'agent_archive':
|
|
365
379
|
case 'agent_delete':
|
|
366
380
|
throw new OutOfScopeToolError(name, AGENT_ARCHIVE_KEY_MODE_DETAIL);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aismemory",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.10",
|
|
4
4
|
"description": "Persistent memory for AI agents. MCP server that connects to Agent Identity Service.",
|
|
5
5
|
"mcpName": "ai.agentsandswarms/ais-memory",
|
|
6
6
|
"type": "module",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"aismemory": "dist/index.js",
|
|
9
9
|
"aismemory-sync": "dist/cli/sync-memory.js",
|
|
10
10
|
"aismemory-doctor": "dist/cli/doctor.js",
|
|
11
|
-
"aismemory-pull": "dist/cli/pull-memory.js"
|
|
11
|
+
"aismemory-pull": "dist/cli/pull-memory.js",
|
|
12
|
+
"aismemory-slack": "dist/cli/slack.js"
|
|
12
13
|
},
|
|
13
14
|
"main": "dist/index.js",
|
|
14
15
|
"files": [
|
|
@@ -18,7 +19,7 @@
|
|
|
18
19
|
"README.md"
|
|
19
20
|
],
|
|
20
21
|
"scripts": {
|
|
21
|
-
"build": "tsc && chmod +x dist/index.js dist/cli/sync-memory.js dist/cli/doctor.js dist/cli/pull-memory.js",
|
|
22
|
+
"build": "tsc && chmod +x dist/index.js dist/cli/sync-memory.js dist/cli/doctor.js dist/cli/pull-memory.js dist/cli/slack.js",
|
|
22
23
|
"prepack": "npm run build",
|
|
23
24
|
"sync": "node dist/cli/sync-memory.js",
|
|
24
25
|
"test": "vitest run",
|