@atrib/attest 0.3.0 → 0.4.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.
@@ -1,4 +1,4 @@
1
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
1
+ import { McpServer } from '@modelcontextprotocol/server';
2
2
  import { z } from 'zod';
3
3
  import { type EmitLocalSubstrateShadowOptions, type WriteToolDeps } from './index.js';
4
4
  import { type ResolvedKey } from './keys.js';
package/dist/annotate.js CHANGED
@@ -6,7 +6,7 @@
6
6
  // composition path is byte-identical to `attest` with ref.kind='annotates';
7
7
  // a verifier MUST NOT distinguish annotation records by the tool name that
8
8
  // signed them.
9
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
9
+ import { McpServer } from '@modelcontextprotocol/server';
10
10
  import { z } from 'zod';
11
11
  import { createSubmissionQueue, EVENT_TYPE_ANNOTATION_URI } from '@atrib/mcp';
12
12
  import { handleEmit, registerAttestTool, resolveEmitLocalSubstrateShadowFromEnv, } from './index.js';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
1
+ import { McpServer } from '@modelcontextprotocol/server';
2
2
  import { z } from 'zod';
3
- import { type LocalSubstrateCoordinatorTransport, type LocalSubstrateDegradationPolicy, type LocalSubstrateHarnessClass, type LocalSubstrateProducer, type LocalSubstrateWalJoin, type ProofBundle, type SubmissionQueue, type TryLocalSubstrateCoordinatorResult } from '@atrib/mcp';
3
+ import { type AtribRecord, type LocalSubstrateCoordinatorTransport, type LocalSubstrateDegradationPolicy, type LocalSubstrateHarnessClass, type LocalSubstrateProducer, type LocalSubstrateWalJoin, type ProofBundle, type SubmissionQueue, type TryLocalSubstrateCoordinatorResult } from '@atrib/mcp';
4
4
  import { type ResolvedKey } from './keys.js';
5
5
  import { type RecordReferenceResolver } from './reference-resolution.js';
6
6
  import { resolveMirrorWritePath } from './storage.js';
@@ -25,6 +25,7 @@ declare const EmitInput: z.ZodObject<{
25
25
  }, z.core.$strip>;
26
26
  type EmitSignedOutput = {
27
27
  signed: true;
28
+ record: AtribRecord;
28
29
  record_hash: string;
29
30
  log_index: number | null;
30
31
  inclusion_proof: ProofBundle['inclusion_proof'] | null;
@@ -176,7 +177,7 @@ declare function createServerKeyResolver(options: CreateAtribEmitServerOptions):
176
177
  interface HandleEmitInput {
177
178
  input: z.infer<typeof EmitInput>;
178
179
  key: ResolvedKey | null;
179
- queue: SubmissionQueue;
180
+ queue?: SubmissionQueue;
180
181
  /**
181
182
  * Producer label written to the sidecar's `_local.producer` field for
182
183
  * cross-source disambiguation in mirror queries. Defaults to
@@ -209,6 +210,11 @@ export interface EmitInProcessOptions {
209
210
  key?: ResolvedKey;
210
211
  /** Override the log endpoint (defaults to ATRIB_LOG_ENDPOINT or @atrib/mcp default). */
211
212
  logEndpoint?: string | undefined;
213
+ /**
214
+ * Set false for local-only producers. The record is still signed and
215
+ * mirrored, but this process does not create a public-log queue.
216
+ */
217
+ submit?: boolean;
212
218
  /**
213
219
  * Producer label written to the sidecar's `_local.producer` field for
214
220
  * cross-source disambiguation. Defaults to `'atrib-emit'`. Callers that
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@
14
14
  // - Persists to the same JSONL convention as the wrapper; the default
15
15
  // mirror filename pattern `atrib-emit-<agent>.jsonl` is frozen (L3):
16
16
  // existing files keep their names forever
17
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
17
+ import { McpServer } from '@modelcontextprotocol/server';
18
18
  import { z } from 'zod';
19
19
  import { randomBytes } from 'node:crypto';
20
20
  import { EVENT_TYPE_ANNOTATION_URI, EVENT_TYPE_REVISION_URI, LOCAL_SUBSTRATE_DEFAULT_TIMEOUT_MS, LOCAL_SUBSTRATE_REQUEST_SCHEMA, canonicalRecord, createHttpLocalSubstrateTransport, createSubmissionQueue, genesisChainRoot, hexEncode, inheritChainContext, isValidEventTypeUri, normalizeEventType, parentRecordHashFromEnv, resolveEnvContextId, SHA256_REF_PATTERN, sha256, tryLocalSubstrateCoordinator, } from '@atrib/mcp';
@@ -535,7 +535,7 @@ async function handleEmit({ input, key, queue, producer, logEndpoint, mirrorPath
535
535
  // Submit asynchronously; the queue handles retry + degradation per §5.8.
536
536
  // Cognitive events default to normal priority, annotations/observations
537
537
  // never need to block the agent.
538
- if (!localSubstrateCommitted) {
538
+ if (!localSubstrateCommitted && queue) {
539
539
  queue.submit(record, 'normal');
540
540
  }
541
541
  // Best-effort mirror; mirrorRecord internally swallows errors per §5.8.
@@ -554,7 +554,7 @@ async function handleEmit({ input, key, queue, producer, logEndpoint, mirrorPath
554
554
  if (!proof && localSubstrateCommitted) {
555
555
  warnings.push('submission delegated to local substrate coordinator; proof not available in this process');
556
556
  }
557
- else if (!proof) {
557
+ else if (!proof && queue) {
558
558
  warnings.push('submission queued; proof not yet available (poll the log later if needed)');
559
559
  }
560
560
  if (localSubstrate?.waitForAttempt && localSubstrateShadow) {
@@ -562,6 +562,7 @@ async function handleEmit({ input, key, queue, producer, logEndpoint, mirrorPath
562
562
  }
563
563
  return {
564
564
  signed: true,
565
+ record,
565
566
  record_hash: recordHash,
566
567
  log_index: proof?.log_index ?? null,
567
568
  inclusion_proof: proof?.inclusion_proof ?? null,
@@ -601,6 +602,7 @@ function emitRefusalToolResult(result) {
601
602
  function emitSuccessToolResult(result) {
602
603
  return {
603
604
  content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
605
+ _meta: { 'dev.atrib/internal-record': result.record },
604
606
  };
605
607
  }
606
608
  function randomContextId() {
@@ -881,6 +883,8 @@ function notifyLocalSubstrateWarning(localSubstrate, message, detail) {
881
883
  * warning, even when the record had already landed on the log.
882
884
  */
883
885
  function getProofFor(queue, recordHash) {
886
+ if (!queue)
887
+ return undefined;
884
888
  return queue.getProof(recordHash.startsWith('sha256:') ? recordHash.slice('sha256:'.length) : recordHash);
885
889
  }
886
890
  const DEFAULT_FLUSH_DEADLINE_MS = 5000;
@@ -917,11 +921,11 @@ export async function emitInProcess(rawInput, options = {}) {
917
921
  const key = options.key ?? (await resolveKey());
918
922
  const logEndpoint = options.logEndpoint ?? process.env['ATRIB_LOG_ENDPOINT'];
919
923
  const flushDeadlineMs = options.flushDeadlineMs ?? DEFAULT_FLUSH_DEADLINE_MS;
920
- const queue = createSubmissionQueue(logEndpoint);
924
+ const queue = options.submit === false ? undefined : createSubmissionQueue(logEndpoint);
921
925
  const result = await handleEmit({
922
926
  input,
923
927
  key,
924
- queue,
928
+ ...(queue !== undefined ? { queue } : {}),
925
929
  producer: options.producer,
926
930
  logEndpoint,
927
931
  mirrorPath: options.mirrorPath,
@@ -941,7 +945,7 @@ export async function emitInProcess(rawInput, options = {}) {
941
945
  transport: 'emit-in-process',
942
946
  }),
943
947
  });
944
- if (!result.signed) {
948
+ if (!result.signed || queue === undefined) {
945
949
  return result;
946
950
  }
947
951
  // Drain before returning, bounded by flushDeadlineMs. The typical caller
package/dist/main.js CHANGED
@@ -4,7 +4,7 @@
4
4
  // launched as a subprocess by an MCP host (Claude Code, Claude Desktop,
5
5
  // etc.). All four names dispatch to one handleEmit funnel; records are
6
6
  // byte-identical regardless of which name signed them.
7
- import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
7
+ import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
8
8
  import { createAtribAttestServer } from './index.js';
9
9
  async function main() {
10
10
  const { mcp } = await createAtribAttestServer();
package/dist/revise.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
1
+ import { McpServer } from '@modelcontextprotocol/server';
2
2
  import { z } from 'zod';
3
3
  import { type EmitLocalSubstrateShadowOptions, type WriteToolDeps } from './index.js';
4
4
  import { type ResolvedKey } from './keys.js';
package/dist/revise.js CHANGED
@@ -6,7 +6,7 @@
6
6
  // signing + chain composition path is byte-identical to `attest` with
7
7
  // ref.kind='revises'; a verifier MUST NOT distinguish revision records by
8
8
  // the tool name that signed them.
9
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
9
+ import { McpServer } from '@modelcontextprotocol/server';
10
10
  import { z } from 'zod';
11
11
  import { createSubmissionQueue, EVENT_TYPE_REVISION_URI } from '@atrib/mcp';
12
12
  import { handleEmit, registerAttestTool, resolveEmitLocalSubstrateShadowFromEnv, } from './index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atrib/attest",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "MCP server for atrib's write verb. One attest tool signs observations, annotations, and revisions; the legacy emit, atrib-annotate, and atrib-revise tool names stay mounted as aliases over the same handler.",
5
5
  "keywords": [
6
6
  "atrib",
@@ -40,12 +40,13 @@
40
40
  "atrib-attest-cli": "./dist/cli.js"
41
41
  },
42
42
  "dependencies": {
43
- "@modelcontextprotocol/sdk": "^1.29.0",
43
+ "@modelcontextprotocol/client": "^2.0.0",
44
+ "@modelcontextprotocol/server": "^2.0.0",
44
45
  "@noble/ed25519": "^3.1.0",
45
46
  "@noble/hashes": "^2.2.0",
46
47
  "canonicalize": "^3.0.0",
47
48
  "zod": "^3.25.76",
48
- "@atrib/mcp": "0.23.0"
49
+ "@atrib/mcp": "0.24.0"
49
50
  },
50
51
  "devDependencies": {
51
52
  "@types/node": "^26.1.1",