@atrib/recall 0.14.6 → 1.0.0
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 +40 -4
- package/dist/event-type-filter.d.ts +9 -0
- package/dist/event-type-filter.js +15 -0
- package/dist/event-type-filter.js.map +1 -0
- package/dist/index.d.ts +59 -2
- package/dist/index.js +392 -453
- package/dist/index.js.map +1 -1
- package/dist/recall-verb.d.ts +128 -0
- package/dist/recall-verb.js +299 -0
- package/dist/recall-verb.js.map +1 -0
- package/dist/trace-storage.d.ts +36 -0
- package/dist/trace-storage.js +93 -0
- package/dist/trace-storage.js.map +1 -0
- package/dist/trace-tools.d.ts +102 -0
- package/dist/trace-tools.js +314 -0
- package/dist/trace-tools.js.map +1 -0
- package/dist/trace-walk.d.ts +106 -0
- package/dist/trace-walk.js +275 -0
- package/dist/trace-walk.js.map +1 -0
- package/dist/verification.d.ts +108 -0
- package/dist/verification.js +223 -0
- package/dist/verification.js.map +1 -0
- package/package.json +15 -3
package/README.md
CHANGED
|
@@ -2,7 +2,41 @@
|
|
|
2
2
|
|
|
3
3
|
MCP server for atrib's verifiable action layer. Lets agents query their own provable past from the local signed-record mirror with per-record signature verification.
|
|
4
4
|
|
|
5
|
-
The consumer-side counterpart to `@atrib/
|
|
5
|
+
The consumer-side counterpart to `@atrib/attest`: attest produces signed records, recall reads them back and exposes them to the agent. Each returned record carries a `signature_verified` boolean so a poorly-written agent treats tampered records as such.
|
|
6
|
+
|
|
7
|
+
## The `recall` verb and the absorb (attest/recall rename, [D164](../../DECISIONS.md#d164-attestrecall-verb-rename-and-primitive-surface-collapse))
|
|
8
|
+
|
|
9
|
+
`@atrib/recall` now exposes a `recall` tool that absorbs the eight legacy
|
|
10
|
+
`recall_*` tools under a `shape` argument, absorbs `trace`/`trace_forward`
|
|
11
|
+
as `shape: "walk"` with a `direction`, and absorbs `atrib-verify` as a
|
|
12
|
+
`verification` parameter. Results are JSON-identical to the legacy tools:
|
|
13
|
+
this is the read-equivalence conformance family in
|
|
14
|
+
[`spec/conformance/attest-recall/`](../../spec/conformance/attest-recall/).
|
|
15
|
+
|
|
16
|
+
| `shape` | Legacy tool | Notes |
|
|
17
|
+
| --- | --- | --- |
|
|
18
|
+
| `history` | `recall_my_attribution_history` | base filter-rank-page query |
|
|
19
|
+
| `walk` | `recall_walk` | when `direction` omitted or `"backward"`; also absorbs `trace` |
|
|
20
|
+
| `walk` + `direction: "forward"` | `trace_forward` | forward walk over the same graph |
|
|
21
|
+
| `content` | `recall_by_content` | BM25 free-form retrieval |
|
|
22
|
+
| `chain` | `recall_session_chain` | ordered chronological session walk |
|
|
23
|
+
| `annotations` | `recall_annotations` | aggregated annotation summary for a target |
|
|
24
|
+
| `revisions` | `recall_revisions` | forward revision chain for a target |
|
|
25
|
+
| `orphans` | `recall_orphans` | records not cited by any other record |
|
|
26
|
+
| `by_signer` | `recall_by_signer` | per-creator aggregation |
|
|
27
|
+
|
|
28
|
+
The `verification` parameter absorbs `atrib-verify`: pass the same
|
|
29
|
+
`packet`/`records`/`claims` evidence shapes as `@atrib/verify` and the
|
|
30
|
+
`recall` result carries a verification block instead of a separate tool
|
|
31
|
+
call. `@atrib/verify` (the verifier library) is an OPTIONAL peer
|
|
32
|
+
dependency, lazily imported. When it is absent, `verification` returns a
|
|
33
|
+
typed `{ status: "verifier_unavailable" }` block and the read still
|
|
34
|
+
succeeds; the degradation is explicit and typed, not a silent drop.
|
|
35
|
+
|
|
36
|
+
`createAtribRecallServer` now mounts the full twelve-tool read union:
|
|
37
|
+
`recall` plus the eight `recall_*` tools plus `trace`, `trace_forward`,
|
|
38
|
+
and `atrib-verify`. All twelve tool names stay mounted as permanent
|
|
39
|
+
aliases during the alias window.
|
|
6
40
|
|
|
7
41
|
## Install
|
|
8
42
|
|
|
@@ -14,7 +48,9 @@ Verify a local build with `pnpm --filter @atrib/recall test`.
|
|
|
14
48
|
|
|
15
49
|
## Tool surface
|
|
16
50
|
|
|
17
|
-
|
|
51
|
+
The eight legacy `recall_*` tools below cover the cognitive surface of the
|
|
52
|
+
local mirror. They stay mounted as permanent aliases; see the absorb
|
|
53
|
+
section above for the `recall` verb that unifies them under one tool.
|
|
18
54
|
|
|
19
55
|
### `recall_my_attribution_history`
|
|
20
56
|
|
|
@@ -187,8 +223,8 @@ Or run via `npx`:
|
|
|
187
223
|
## What this does NOT do
|
|
188
224
|
|
|
189
225
|
- **No log-inclusion verification.** Local signature verification ≠ log commitment proof. Use the log API for inclusion proofs.
|
|
190
|
-
- **No graph derivation.** Returns records, not the [§3.2.4](https://github.com/creatornader/atrib/blob/main/atrib-spec.md#324-edge-derivation-rules) graph. For declared-relationship walks, use
|
|
191
|
-
- **No write surface.** Read-only. Use `@atrib/
|
|
226
|
+
- **No graph derivation.** Returns records, not the [§3.2.4](https://github.com/creatornader/atrib/blob/main/atrib-spec.md#324-edge-derivation-rules) graph. For declared-relationship walks, use `recall` with `shape: "walk"` (the legacy `trace`/`trace_forward` tool names still work); for graph projections, query graph-node directly.
|
|
227
|
+
- **No write surface.** Read-only. Use `@atrib/attest` to sign new records.
|
|
192
228
|
|
|
193
229
|
## Part of atrib
|
|
194
230
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const EventTypeFilterSchema: z.ZodUnion<readonly [z.ZodEnum<{
|
|
3
|
+
tool_call: "tool_call";
|
|
4
|
+
transaction: "transaction";
|
|
5
|
+
observation: "observation";
|
|
6
|
+
directory_anchor: "directory_anchor";
|
|
7
|
+
annotation: "annotation";
|
|
8
|
+
revision: "revision";
|
|
9
|
+
}>, z.ZodString]>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Leaf module: the event_type filter schema shared by index.ts and
|
|
3
|
+
// recall-verb.ts. Lives outside index.ts so the recall-verb module can
|
|
4
|
+
// evaluate its own top-level zod schemas during the index <-> recall-verb
|
|
5
|
+
// import cycle (function-level cycles are safe; const usage at module
|
|
6
|
+
// init is not).
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { EVENT_TYPE_SHORT_NAMES, isValidEventTypeUri } from '@atrib/mcp';
|
|
9
|
+
export const EventTypeFilterSchema = z.union([
|
|
10
|
+
z.enum(EVENT_TYPE_SHORT_NAMES),
|
|
11
|
+
z.string().refine((value) => isValidEventTypeUri(value), {
|
|
12
|
+
message: 'event_type must be an atrib shorthand alias or a syntactically valid absolute URI',
|
|
13
|
+
}),
|
|
14
|
+
]);
|
|
15
|
+
//# sourceMappingURL=event-type-filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-type-filter.js","sourceRoot":"","sources":["../src/event-type-filter.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC,mEAAmE;AACnE,uEAAuE;AACvE,0EAA0E;AAC1E,sEAAsE;AACtE,gBAAgB;AAEhB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAExE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC;IAC3C,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC;IAC9B,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE;QACvD,OAAO,EAAE,mFAAmF;KAC7F,CAAC;CACH,CAAC,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,8 @@
|
|
|
32
32
|
*/
|
|
33
33
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
34
34
|
import type { AtribRecord, EventTypeShortName } from '@atrib/mcp';
|
|
35
|
+
import { EventTypeFilterSchema } from './event-type-filter.js';
|
|
36
|
+
export { EventTypeFilterSchema };
|
|
35
37
|
export type ImportanceLabel = 'critical' | 'high' | 'medium' | 'low' | 'noise';
|
|
36
38
|
export declare const IMPORTANCE_NUMERIC: Record<ImportanceLabel, number>;
|
|
37
39
|
export declare const ATRIB_RECALL_ALPHA: number;
|
|
@@ -41,6 +43,8 @@ export declare const ATRIB_RECALL_TAU_DAYS: number;
|
|
|
41
43
|
export declare const ATRIB_RECALL_NOISE_FLOOR: number;
|
|
42
44
|
export declare const ATRIB_RECALL_CONTENT_MAX_RECORDS: number;
|
|
43
45
|
import type { AnnotationSummary as AggAnnotationSummary } from './aggregations.js';
|
|
46
|
+
import { extractRecordHashFieldsFromMcpResult } from './trace-tools.js';
|
|
47
|
+
import type { EdgeType } from './graph.js';
|
|
44
48
|
export declare function getAtribRecallRuntimeContract(): Record<string, unknown>;
|
|
45
49
|
export declare function clearRecallMirrorCache(): void;
|
|
46
50
|
export declare function loadRecords(path: string): AtribRecord[];
|
|
@@ -61,7 +65,7 @@ export declare function loadRecordsFromDir(dir: string): {
|
|
|
61
65
|
files: string[];
|
|
62
66
|
};
|
|
63
67
|
type ContextScope = 'all' | 'env';
|
|
64
|
-
interface RecallArgs {
|
|
68
|
+
export interface RecallArgs {
|
|
65
69
|
context_id?: string;
|
|
66
70
|
/**
|
|
67
71
|
* Controls whether omitted context_id means cross-context recall or the
|
|
@@ -324,6 +328,59 @@ export declare function recall(args: RecallArgs, recordFile?: string): Promise<R
|
|
|
324
328
|
export interface AtribRecallServer {
|
|
325
329
|
mcp: McpServer;
|
|
326
330
|
}
|
|
331
|
+
/** Args for the local derived-graph walk (legacy recall_walk). */
|
|
332
|
+
export interface RecallWalkArgs {
|
|
333
|
+
from_record_hash: string;
|
|
334
|
+
edge_types?: EdgeType[] | undefined;
|
|
335
|
+
depth?: number | undefined;
|
|
336
|
+
}
|
|
337
|
+
export declare function runRecallWalk(args: RecallWalkArgs): Promise<Record<string, unknown>>;
|
|
338
|
+
export declare function runRecallAnnotations(args: {
|
|
339
|
+
record_hash: string;
|
|
340
|
+
}): Promise<Record<string, unknown>>;
|
|
341
|
+
export declare function runRecallRevisions(args: {
|
|
342
|
+
record_hash: string;
|
|
343
|
+
}): Promise<Record<string, unknown>>;
|
|
344
|
+
/** Args for BM25 content retrieval (legacy recall_by_content). */
|
|
345
|
+
export interface RecallByContentArgs {
|
|
346
|
+
query: string;
|
|
347
|
+
k?: number | undefined;
|
|
348
|
+
max_records?: number | undefined;
|
|
349
|
+
evidence_mode?: 'bounded' | 'require_complete' | undefined;
|
|
350
|
+
include_tool_call_args?: boolean | undefined;
|
|
351
|
+
}
|
|
352
|
+
export declare function runRecallByContent(args: RecallByContentArgs): Promise<Record<string, unknown>>;
|
|
353
|
+
/** Args for the chronological session chain (legacy recall_session_chain). */
|
|
354
|
+
export interface RecallSessionChainArgs {
|
|
355
|
+
context_id?: string | undefined;
|
|
356
|
+
limit?: number | undefined;
|
|
357
|
+
include_content?: boolean | undefined;
|
|
358
|
+
}
|
|
359
|
+
export declare function runRecallSessionChain(args: RecallSessionChainArgs): Promise<Record<string, unknown>>;
|
|
360
|
+
/** Args for loose-end discovery (legacy recall_orphans). */
|
|
361
|
+
export interface RecallOrphansArgs {
|
|
362
|
+
context_id?: string | undefined;
|
|
363
|
+
event_type?: string | undefined;
|
|
364
|
+
creator_key?: string | undefined;
|
|
365
|
+
limit?: number | undefined;
|
|
366
|
+
}
|
|
367
|
+
export declare function runRecallOrphans(args: RecallOrphansArgs): Promise<Record<string, unknown>>;
|
|
368
|
+
export declare function runRecallBySigner(args: {
|
|
369
|
+
min_records?: number | undefined;
|
|
370
|
+
}): Promise<Record<string, unknown>>;
|
|
327
371
|
export declare function registerAtribRecallTools(server: McpServer): void;
|
|
372
|
+
export { compactVisited, createAtribTraceServer, registerTraceTools, runTraceWalk, summarizeSidecar, TraceInput, } from './trace-tools.js';
|
|
373
|
+
export { extractRecordHashFieldsFromMcpResult };
|
|
374
|
+
export type { AtribTraceServer, TraceInputT } from './trace-tools.js';
|
|
375
|
+
export { createAtribVerifyServer, handleAtribVerify, loadVerifyModule, registerVerifyTool, tryHandleAtribVerify, VerifyInput, } from './verification.js';
|
|
376
|
+
export type { AtribVerifyInput, AtribVerifyOutput, AtribVerifyServer, RecallVerificationBlock, } from './verification.js';
|
|
377
|
+
export { registerRecallVerbTool, RecallVerbInput, RECALL_SHAPES, runRecallVerb } from './recall-verb.js';
|
|
378
|
+
export type { RecallShape, RecallVerbInputT } from './recall-verb.js';
|
|
379
|
+
/**
|
|
380
|
+
* Register the full read union on one server: the `recall` verb plus every
|
|
381
|
+
* legacy read tool name it absorbs (8 recall_* tools, trace, trace_forward,
|
|
382
|
+
* atrib-verify). This is what the `atrib-recall` binary serves and what the
|
|
383
|
+
* primitive runtime / daemon mount for reads (alias-window rule W1).
|
|
384
|
+
*/
|
|
385
|
+
export declare function registerAtribReadTools(server: McpServer): void;
|
|
328
386
|
export declare function createAtribRecallServer(): AtribRecallServer;
|
|
329
|
-
export {};
|