@atrib/annotate 0.2.41 → 1.0.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/README.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atrib/annotate
2
2
 
3
+ **Legacy home.** The write-verb implementation moved to
4
+ [`@atrib/attest`](../atrib-attest/README.md) per the attest/recall rename
5
+ ([D164](../../DECISIONS.md#d164-attestrecall-verb-rename-and-primitive-surface-collapse)).
6
+ Annotation folds into `attest` with `ref: { kind: "annotates", target }`.
7
+ This package re-exports the same surface and forwards the `atrib-annotate`
8
+ binary to `@atrib/attest`'s handlers. Records are byte-identical. The
9
+ `atrib-annotate` tool name stays mounted as a permanent alias during the
10
+ alias window, alongside the new `attest` tool.
11
+
3
12
  MCP server exposing the `atrib-annotate` tool for atrib's verifiable action layer. Marks a past signed record with importance, a one-line summary, and topics, so future recall can surface what mattered without re-scanning every record flat.
4
13
 
5
14
  Closes the producer-side recall-fidelity gap: an agent reading back its own past loses enormous nuance compared to the agent that signed it. An annotation lets the agent at signing time say "future-self: this one is critical, and here's why in one line", and the graph carries that judgment forward.
@@ -91,7 +100,7 @@ Or run as a one-off subprocess via `pnpm --filter @atrib/annotate start`.
91
100
 
92
101
  ## Status
93
102
 
94
- Published and maintained. Cognitive primitive #2 per [D079](https://github.com/creatornader/atrib/blob/main/DECISIONS.md#d079-the-six-core-cognitive-primitives--atribs-agent-facing-surface). Builds clean against `@atrib/mcp` and `@atrib/emit`'s public exports introduced in `@atrib/emit@0.8.0`. The companion specialized writer `@atrib/revise` covers the contradiction-handling primitive (revision event_type).
103
+ Deprecated on npm; superseded by `@atrib/attest` (`ref.kind: "annotates"`), with the `atrib-annotate` tool name mounted as a permanent alias. Historically cognitive primitive #2 per [D079](https://github.com/creatornader/atrib/blob/main/DECISIONS.md#d079-the-six-core-cognitive-primitives--atribs-agent-facing-surface). Builds clean against `@atrib/mcp` and `@atrib/emit`'s public exports introduced in `@atrib/emit@0.8.0`. The companion specialized writer `@atrib/revise` covers the contradiction-handling primitive (revision event_type).
95
104
 
96
105
  ## License
97
106
 
package/dist/index.d.ts CHANGED
@@ -1,48 +1,2 @@
1
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- import { z } from 'zod';
3
- import { type EmitLocalSubstrateShadowOptions, type ResolvedKey } from '@atrib/emit';
4
- export declare const Importance: z.ZodEnum<{
5
- critical: "critical";
6
- high: "high";
7
- medium: "medium";
8
- low: "low";
9
- noise: "noise";
10
- }>;
11
- export declare const AnnotateInput: z.ZodObject<{
12
- annotates: z.ZodString;
13
- importance: z.ZodEnum<{
14
- critical: "critical";
15
- high: "high";
16
- medium: "medium";
17
- low: "low";
18
- noise: "noise";
19
- }>;
20
- summary: z.ZodString;
21
- topics: z.ZodOptional<z.ZodArray<z.ZodString>>;
22
- context_id: z.ZodOptional<z.ZodString>;
23
- informed_by: z.ZodOptional<z.ZodArray<z.ZodString>>;
24
- }, z.core.$strip>;
25
- export interface AtribAnnotateServer {
26
- /** Underlying McpServer; expose for testing or composition. */
27
- mcp: McpServer;
28
- /** Drain pending submissions (for tests/shutdown). */
29
- flush(): Promise<void>;
30
- }
31
- export interface CreateAtribAnnotateServerOptions {
32
- /** Override the resolved key (primarily for testing). */
33
- key?: ResolvedKey | null | undefined;
34
- /** Override the log endpoint (defaults to env or @atrib/mcp default). */
35
- logEndpoint?: string | undefined;
36
- /**
37
- * Optional long-lived-agent local substrate shadow probe. `undefined` reads
38
- * opt-in env config; `false` disables env config for this server.
39
- */
40
- localSubstrate?: EmitLocalSubstrateShadowOptions | false | undefined;
41
- }
42
- /**
43
- * Wire up the atrib-annotate MCP server with one `atrib-annotate` tool.
44
- * Per D079: this is a specialized form of @atrib/emit; the underlying
45
- * signing pipeline is shared via handleEmit so annotation records are
46
- * byte-identical regardless of which tool produced them.
47
- */
48
- export declare function createAtribAnnotateServer(options?: CreateAtribAnnotateServerOptions): Promise<AtribAnnotateServer>;
1
+ export { AnnotateInput, Importance, createAtribAnnotateServer, registerAnnotateTool, } from '@atrib/attest';
2
+ export type { AtribAnnotateServer, CreateAtribAnnotateServerOptions } from '@atrib/attest';
package/dist/index.js CHANGED
@@ -1,123 +1,8 @@
1
- // @atrib/annotate MCP server: cognitive primitive #2 of D079.
2
- //
3
- // Specialized form of @atrib/emit that narrows the schema to the annotation
4
- // event_type (spec §1.2.7 / D058). Per D079's package layering: depends on
5
- // @atrib/emit as the canonical record-signing surface and wraps handleEmit
6
- // with a narrow Zod schema enforcing the annotation-specific required fields
7
- // (annotates + importance + summary). The signing + chain composition path
8
- // is byte-identical to atrib-emit's; a verifier MUST NOT distinguish
9
- // annotation records signed via this tool from those signed via emit's
10
- // polymorphic surface.
11
- //
12
- // Scope:
13
- // - One tool: atrib-annotate
14
- // - Narrow input schema: REQUIRES annotates (sha256:<64-hex>), importance, summary
15
- // - One key per process (same identity as the wrapper + atrib-emit)
16
- // - Persists to the same JSONL mirror convention as atrib-emit
17
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
18
- import { z } from 'zod';
19
- import { resolveEmitLocalSubstrateShadowFromEnv, handleEmit, resolveKey, } from '@atrib/emit';
20
- import { createSubmissionQueue, EVENT_TYPE_ANNOTATION_URI, } from '@atrib/mcp';
21
- const SHA256_REF_PATTERN = /^sha256:[0-9a-f]{64}$/;
22
- const HEX_32_PATTERN = /^[0-9a-f]{32}$/;
23
- export const Importance = z.enum(['critical', 'high', 'medium', 'low', 'noise']);
24
- export const AnnotateInput = z.object({
25
- annotates: z.string().regex(SHA256_REF_PATTERN).describe("'sha256:<64-hex>' record_hash this annotation describes per spec §1.2.7 / D058. " +
26
- 'REQUIRED. The target record can be any prior record (yours or another agent\'s).'),
27
- importance: Importance.describe('Felt importance for future-self recall ranking. ' +
28
- "'critical' (decisions that shape future recall, identity claims), " +
29
- "'high' (worth surfacing in default recall), " +
30
- "'medium' (general signal), " +
31
- "'low' (background noting), " +
32
- "'noise' (deliberately deprioritized for recall)."),
33
- summary: z.string().min(1).max(2048).describe('One-line semantic gist of the annotation. The recall pipeline reads this verbatim ' +
34
- 'for snippet display; keep it under ~120 chars when possible. ' +
35
- 'Distinct from the annotated record\'s own content, this summary captures what ' +
36
- 'future-you should know about why this record matters.'),
37
- topics: z.array(z.string().min(1).max(128)).max(16).optional().describe('Optional topic tags. Used by recall_my_attribution_history\'s topics filter. ' +
38
- 'Lowercase-hyphenated convention (e.g. "bug-fix", "design-decision").'),
39
- context_id: z.string().regex(HEX_32_PATTERN).optional().describe('32-hex context_id. Defaults to process.env.ATRIB_CONTEXT_ID per D078 when omitted; ' +
40
- 'falls back to a fresh genesis context_id if neither is set.'),
41
- informed_by: z.array(z.string().regex(SHA256_REF_PATTERN)).optional().describe("Array of 'sha256:<64-hex>' record_hashes that informed this annotation. " +
42
- 'Sorted lexicographically before signing per §1.2.5. The `annotates` reference ' +
43
- 'is separate from `informed_by` and need not be duplicated here.'),
44
- });
45
- /**
46
- * Wire up the atrib-annotate MCP server with one `atrib-annotate` tool.
47
- * Per D079: this is a specialized form of @atrib/emit; the underlying
48
- * signing pipeline is shared via handleEmit so annotation records are
49
- * byte-identical regardless of which tool produced them.
50
- */
51
- export async function createAtribAnnotateServer(options = {}) {
52
- const resolveServerKey = createServerKeyResolver(options);
53
- const logEndpoint = options.logEndpoint ?? process.env['ATRIB_LOG_ENDPOINT'];
54
- const queue = createSubmissionQueue(logEndpoint);
55
- const localSubstrate = options.localSubstrate === false
56
- ? undefined
57
- : (options.localSubstrate ??
58
- resolveEmitLocalSubstrateShadowFromEnv({
59
- producer: 'atrib-annotate',
60
- transport: 'stdio-mcp-server',
61
- }));
62
- const mcp = new McpServer({ name: 'atrib-annotate', version: '0.1.0' });
63
- mcp.registerTool('atrib-annotate', {
64
- description: 'Mark a past record\'s importance and meaning without superseding it. ' +
65
- 'Cognitive primitive #2 of D079; produces a signed annotation event ' +
66
- '(spec §1.2.7 / D058) that adds an ANNOTATES graph edge to the target. ' +
67
- 'Use when you want future-self or other agents to read back this past ' +
68
- 'record with weighted importance and a one-line gist.',
69
- inputSchema: AnnotateInput.shape,
70
- }, async (rawInput) => {
71
- const input = AnnotateInput.parse(rawInput);
72
- const result = await handleEmit({
73
- input: {
74
- event_type: EVENT_TYPE_ANNOTATION_URI,
75
- content: {
76
- annotates: input.annotates,
77
- importance: input.importance,
78
- summary: input.summary,
79
- ...(input.topics ? { topics: input.topics } : {}),
80
- },
81
- annotates: input.annotates,
82
- ...(input.context_id ? { context_id: input.context_id } : {}),
83
- ...(input.informed_by ? { informed_by: input.informed_by } : {}),
84
- },
85
- key: await resolveServerKey(),
86
- queue,
87
- producer: 'atrib-annotate',
88
- localSubstrate,
89
- });
90
- if (!result.signed) {
91
- return {
92
- isError: true,
93
- content: [{ type: 'text', text: result.refusals.join('\n') }],
94
- };
95
- }
96
- const out = {
97
- signed: true,
98
- record_hash: result.record_hash,
99
- log_index: result.log_index,
100
- inclusion_proof: result.inclusion_proof,
101
- context_id: result.context_id,
102
- warnings: result.warnings,
103
- };
104
- return {
105
- content: [{ type: 'text', text: JSON.stringify(out, null, 2) }],
106
- };
107
- });
108
- return {
109
- mcp,
110
- flush: () => queue.flush(),
111
- };
112
- }
113
- function createServerKeyResolver(options) {
114
- if (Object.prototype.hasOwnProperty.call(options, 'key')) {
115
- const fixed = options.key ?? null;
116
- return async () => fixed;
117
- }
118
- let resolved = null;
119
- return async () => {
120
- resolved ??= resolveKey();
121
- return resolved;
122
- };
123
- }
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // @atrib/annotate is the legacy home of the atrib-annotate write primitive
3
+ // (cognitive primitive #2 of D079). The implementation lives in
4
+ // @atrib/attest: annotation folds into the write verb as
5
+ // attest ref.kind='annotates', and the atrib-annotate tool name stays
6
+ // mounted as a permanent alias over the same handler. Records signed
7
+ // through either surface are byte-identical in canonical form.
8
+ export { AnnotateInput, Importance, createAtribAnnotateServer, registerAnnotateTool, } from '@atrib/attest';
package/dist/main.js CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- // atrib-annotate standalone binary. Wires the McpServer to a stdio transport
3
- // so it can be launched as a subprocess by an MCP host (Claude Code,
4
- // Claude Desktop, etc.).
2
+ // atrib-annotate standalone binary (forwarding shim). Serves the legacy
3
+ // atrib-annotate server, which mounts `atrib-annotate` plus `attest` per
4
+ // the alias-window rule W1.
5
5
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
6
- import { createAtribAnnotateServer } from './index.js';
6
+ import { createAtribAnnotateServer } from '@atrib/attest';
7
7
  async function main() {
8
8
  const { mcp } = await createAtribAnnotateServer();
9
9
  const transport = new StdioServerTransport();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atrib/annotate",
3
- "version": "0.2.41",
4
- "description": "MCP server for atrib's verifiable action layer. Lets agents mark a past record's importance and meaning for later recall.",
3
+ "version": "1.0.1",
4
+ "description": "Legacy home of atrib's annotate write primitive. Superseded by @atrib/attest (the write verb, ref.kind=\"annotates\"); this package re-exports the same surface and forwards the atrib-annotate binary.",
5
5
  "author": "atrib <hello@atrib.dev>",
6
6
  "keywords": [
7
7
  "atrib",
@@ -24,15 +24,13 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@modelcontextprotocol/sdk": "^1.29.0",
27
- "zod": "^3.25.76",
28
- "@atrib/emit": "0.17.3",
29
- "@atrib/mcp": "0.21.0"
27
+ "@atrib/attest": "0.2.0"
30
28
  },
31
29
  "devDependencies": {
32
- "@types/node": "^25.9.3",
33
- "tsx": "^4.22.4",
30
+ "@types/node": "^26.1.1",
31
+ "tsx": "^4.23.1",
34
32
  "typescript": "^6.0.3",
35
- "vitest": "^4.1.8"
33
+ "vitest": "^4.1.10"
36
34
  },
37
35
  "files": [
38
36
  "dist"