@atrib/revise 0.2.41 → 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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atrib/revise
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
+ Revision folds into `attest` with `ref: { kind: "revises", target, reason }`.
7
+ This package re-exports the same surface and forwards the `atrib-revise`
8
+ binary to `@atrib/attest`'s handlers. Records are byte-identical. The
9
+ `atrib-revise` 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-revise` tool for atrib's verifiable action layer. Supersedes a prior signed position with a stated reason, so the contradiction lands as a first-class graph node rather than a silent edit.
4
13
 
5
14
  Records are immutable per spec [§1.6](https://github.com/creatornader/atrib/blob/main/atrib-spec.md#16-immutability): once signed, the bytes are fixed forever. When the agent now holds a position incompatible with a prior claim, the only honest move is to sign a revision that points at the prior record, names the prior position, names the new one, and gives the reason. The prior record stays in the graph; the revision adds a REVISES edge that supersedes it. A reader walking the graph sees both, and any policy or recall pipeline that respects revision can prefer the latest.
package/dist/index.d.ts CHANGED
@@ -1,36 +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 ReviseInput: z.ZodObject<{
5
- revises: z.ZodString;
6
- prior_position: z.ZodString;
7
- new_position: z.ZodString;
8
- reason: z.ZodString;
9
- topics: z.ZodOptional<z.ZodArray<z.ZodString>>;
10
- context_id: z.ZodOptional<z.ZodString>;
11
- informed_by: z.ZodOptional<z.ZodArray<z.ZodString>>;
12
- }, z.core.$strip>;
13
- export interface AtribReviseServer {
14
- /** Underlying McpServer; expose for testing or composition. */
15
- mcp: McpServer;
16
- /** Drain pending submissions (for tests/shutdown). */
17
- flush(): Promise<void>;
18
- }
19
- export interface CreateAtribReviseServerOptions {
20
- /** Override the resolved key (primarily for testing). */
21
- key?: ResolvedKey | null | undefined;
22
- /** Override the log endpoint (defaults to env or @atrib/mcp default). */
23
- logEndpoint?: string | undefined;
24
- /**
25
- * Optional long-lived-agent local substrate shadow probe. `undefined` reads
26
- * opt-in env config; `false` disables env config for this server.
27
- */
28
- localSubstrate?: EmitLocalSubstrateShadowOptions | false | undefined;
29
- }
30
- /**
31
- * Wire up the atrib-revise MCP server with one `atrib-revise` tool.
32
- * Per D079: this is a specialized form of @atrib/emit; the underlying
33
- * signing pipeline is shared via handleEmit so revision records are
34
- * byte-identical regardless of which tool produced them.
35
- */
36
- export declare function createAtribReviseServer(options?: CreateAtribReviseServerOptions): Promise<AtribReviseServer>;
1
+ export { ReviseInput, createAtribReviseServer, registerReviseTool, } from '@atrib/attest';
2
+ export type { AtribReviseServer, CreateAtribReviseServerOptions } from '@atrib/attest';
package/dist/index.js CHANGED
@@ -1,126 +1,8 @@
1
- // @atrib/revise MCP server: cognitive primitive #3 of D079.
2
- //
3
- // Specialized form of @atrib/emit that narrows the schema to the revision
4
- // event_type (spec §1.2.9 / D059). 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 revision-specific required fields
7
- // (revises + reason + prior_position + new_position). The signing + chain
8
- // composition path is byte-identical to atrib-emit's; a verifier MUST NOT
9
- // distinguish revision records signed via this tool from those signed via
10
- // emit's polymorphic surface.
11
- //
12
- // Scope:
13
- // - One tool: atrib-revise
14
- // - Narrow input schema: REQUIRES revises (sha256:<64-hex>), reason, prior_position, new_position
15
- // - One key per process (same identity as the wrapper + atrib-emit)
16
- // - Persists to the same JSONL mirror convention as atrib-emit
17
- //
18
- // Distinct from atrib-annotate: annotation comments on a past record while
19
- // leaving the prior position intact. Revision asserts the prior is no longer
20
- // held, the prior remains in the graph (records are immutable per spec
21
- // §1.6), and the revision adds a REVISES graph edge that supersedes it.
22
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
23
- import { z } from 'zod';
24
- import { resolveEmitLocalSubstrateShadowFromEnv, handleEmit, resolveKey, } from '@atrib/emit';
25
- import { createSubmissionQueue, EVENT_TYPE_REVISION_URI, } from '@atrib/mcp';
26
- const SHA256_REF_PATTERN = /^sha256:[0-9a-f]{64}$/;
27
- const HEX_32_PATTERN = /^[0-9a-f]{32}$/;
28
- export const ReviseInput = z.object({
29
- revises: z.string().regex(SHA256_REF_PATTERN).describe("'sha256:<64-hex>' record_hash this revision supersedes per spec §1.2.9 / D059. " +
30
- 'REQUIRED. The target record can be any prior record (yours or another agent\'s).'),
31
- prior_position: z.string().min(1).max(4096).describe('One-line summary of the position being superseded. Captures what was previously held ' +
32
- 'so a reader sees the contradiction surfaced as a first-class graph node rather than ' +
33
- 'a silent edit.'),
34
- new_position: z.string().min(1).max(4096).describe('One-line summary of the new position replacing the prior. The substantive claim that ' +
35
- 'supersedes the revised record.'),
36
- reason: z.string().min(1).max(4096).describe('Why the revision happened. New evidence, contradicting record, model update, ' +
37
- 'corrected reasoning, etc. Recall pipelines surface this verbatim so future-self ' +
38
- 'sees what motivated the change.'),
39
- 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. ' +
40
- 'Lowercase-hyphenated convention (e.g. "contradiction", "model-update").'),
41
- 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; ' +
42
- 'falls back to a fresh genesis context_id if neither is set.'),
43
- informed_by: z.array(z.string().regex(SHA256_REF_PATTERN)).optional().describe("Array of 'sha256:<64-hex>' record_hashes that informed this revision. " +
44
- 'Sorted lexicographically before signing per §1.2.5. The `revises` reference ' +
45
- 'is separate from `informed_by` and need not be duplicated here.'),
46
- });
47
- /**
48
- * Wire up the atrib-revise MCP server with one `atrib-revise` tool.
49
- * Per D079: this is a specialized form of @atrib/emit; the underlying
50
- * signing pipeline is shared via handleEmit so revision records are
51
- * byte-identical regardless of which tool produced them.
52
- */
53
- export async function createAtribReviseServer(options = {}) {
54
- const resolveServerKey = createServerKeyResolver(options);
55
- const logEndpoint = options.logEndpoint ?? process.env['ATRIB_LOG_ENDPOINT'];
56
- const queue = createSubmissionQueue(logEndpoint);
57
- const localSubstrate = options.localSubstrate === false
58
- ? undefined
59
- : (options.localSubstrate ??
60
- resolveEmitLocalSubstrateShadowFromEnv({
61
- producer: 'atrib-revise',
62
- transport: 'stdio-mcp-server',
63
- }));
64
- const mcp = new McpServer({ name: 'atrib-revise', version: '0.1.0' });
65
- mcp.registerTool('atrib-revise', {
66
- description: 'Supersede a prior position with a stated reason. Cognitive primitive #3 of ' +
67
- 'D079; produces a signed revision event (spec §1.2.9 / D059) that adds a ' +
68
- 'REVISES graph edge to the target record. Use when you now hold a position ' +
69
- 'incompatible with a prior claim; the revision surfaces the change as a ' +
70
- 'first-class graph node rather than a silent edit (records are immutable).',
71
- inputSchema: ReviseInput.shape,
72
- }, async (rawInput) => {
73
- const input = ReviseInput.parse(rawInput);
74
- const result = await handleEmit({
75
- input: {
76
- event_type: EVENT_TYPE_REVISION_URI,
77
- content: {
78
- revises: input.revises,
79
- prior_position: input.prior_position,
80
- new_position: input.new_position,
81
- reason: input.reason,
82
- ...(input.topics ? { topics: input.topics } : {}),
83
- },
84
- revises: input.revises,
85
- ...(input.context_id ? { context_id: input.context_id } : {}),
86
- ...(input.informed_by ? { informed_by: input.informed_by } : {}),
87
- },
88
- key: await resolveServerKey(),
89
- queue,
90
- producer: 'atrib-revise',
91
- localSubstrate,
92
- });
93
- if (!result.signed) {
94
- return {
95
- isError: true,
96
- content: [{ type: 'text', text: result.refusals.join('\n') }],
97
- };
98
- }
99
- const out = {
100
- signed: true,
101
- record_hash: result.record_hash,
102
- log_index: result.log_index,
103
- inclusion_proof: result.inclusion_proof,
104
- context_id: result.context_id,
105
- warnings: result.warnings,
106
- };
107
- return {
108
- content: [{ type: 'text', text: JSON.stringify(out, null, 2) }],
109
- };
110
- });
111
- return {
112
- mcp,
113
- flush: () => queue.flush(),
114
- };
115
- }
116
- function createServerKeyResolver(options) {
117
- if (Object.prototype.hasOwnProperty.call(options, 'key')) {
118
- const fixed = options.key ?? null;
119
- return async () => fixed;
120
- }
121
- let resolved = null;
122
- return async () => {
123
- resolved ??= resolveKey();
124
- return resolved;
125
- };
126
- }
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // @atrib/revise is the legacy home of the atrib-revise write primitive
3
+ // (cognitive primitive #3 of D079). The implementation lives in
4
+ // @atrib/attest: revision folds into the write verb as
5
+ // attest ref.kind='revises', and the atrib-revise tool name stays mounted
6
+ // as a permanent alias over the same handler. Records signed through
7
+ // either surface are byte-identical in canonical form.
8
+ export { ReviseInput, createAtribReviseServer, registerReviseTool, } from '@atrib/attest';
package/dist/main.js CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- // atrib-revise 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-revise standalone binary (forwarding shim). Serves the legacy
3
+ // atrib-revise server, which mounts `atrib-revise` plus `attest` per the
4
+ // alias-window rule W1.
5
5
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
6
- import { createAtribReviseServer } from './index.js';
6
+ import { createAtribReviseServer } from '@atrib/attest';
7
7
  async function main() {
8
8
  const { mcp } = await createAtribReviseServer();
9
9
  const transport = new StdioServerTransport();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atrib/revise",
3
- "version": "0.2.41",
4
- "description": "MCP server for atrib's verifiable action layer. Lets agents supersede a prior signed position with a stated reason.",
3
+ "version": "1.0.0",
4
+ "description": "Legacy home of atrib's revise write primitive. Superseded by @atrib/attest (the write verb, ref.kind=\"revises\"); this package re-exports the same surface and forwards the atrib-revise binary.",
5
5
  "author": "atrib <hello@atrib.dev>",
6
6
  "keywords": [
7
7
  "atrib",
@@ -24,9 +24,7 @@
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.1.0"
30
28
  },
31
29
  "devDependencies": {
32
30
  "@types/node": "^25.9.3",