@heuresis/mcp 1.0.0-rc.18 → 1.0.0-rc.19

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.
@@ -27,6 +27,14 @@ import { makeRetryingFetch } from './httpRetry.js';
27
27
  // one-shot-fail a data call (see httpRetry.ts).
28
28
  const retryingFetch = makeRetryingFetch();
29
29
  let cached = null;
30
+ // The device name from credentials.json, captured at bootstrap so provenance
31
+ // stamps can record WHICH device an MCP write came from (surfaced in the webapp
32
+ // timeline once it syncs cloud provenance). null in headless/password mode,
33
+ // which has no device pairing.
34
+ let activeDeviceName = null;
35
+ export function getActiveDeviceName() {
36
+ return activeDeviceName;
37
+ }
30
38
  export class CloudAuthError extends Error {
31
39
  constructor(msg) {
32
40
  super(msg);
@@ -96,6 +104,7 @@ async function persistRotatedToken(creds, newToken) {
96
104
  * been revoked/rotated away.
97
105
  */
98
106
  export async function getCloudClient(creds) {
107
+ activeDeviceName = creds.device_name ?? activeDeviceName;
99
108
  if (cached)
100
109
  return cached;
101
110
  try {
@@ -41,7 +41,7 @@
41
41
  // the change. The stamp is best-effort: a failed provenance insert never
42
42
  // fails the underlying write.
43
43
  import { z } from 'zod';
44
- import { unwrap, unwrapMaybe } from './cloudClient.js';
44
+ import { unwrap, unwrapMaybe, getActiveDeviceName } from './cloudClient.js';
45
45
  // ---------------------------------------------------------------------------
46
46
  // Shared helpers
47
47
  // ---------------------------------------------------------------------------
@@ -618,12 +618,16 @@ export async function linkConcepts(client, args) {
618
618
  }
619
619
  async function stampProvenance(client, args) {
620
620
  try {
621
+ // Tag the originating device so the webapp timeline can show WHICH MCP
622
+ // device made the change. Rides in source_refs as `device:<name>` — no
623
+ // schema migration, and source_refs already syncs/exports.
624
+ const device = getActiveDeviceName();
621
625
  const row = {
622
626
  workspace_id: args.workspaceId,
623
627
  node_id: args.nodeId,
624
628
  origin: args.origin ?? 'mcp',
625
629
  operator_key: args.operatorKey ?? null,
626
- source_refs: [args.sourceRef],
630
+ source_refs: device ? [args.sourceRef, `device:${device}`] : [args.sourceRef],
627
631
  llm_json: args.llmJson ?? null,
628
632
  created_by: 'agent',
629
633
  analysis_id: args.analysisId ?? null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heuresis/mcp",
3
- "version": "1.0.0-rc.18",
3
+ "version": "1.0.0-rc.19",
4
4
  "mcpName": "io.github.ToremLabs/heuresis",
5
5
  "description": "Cloud-authenticated Model Context Protocol server for a Heuresis workspace. Logs into the user's Heuresis account and lets any MCP client (Claude Desktop, Claude Code, Cursor, custom agents) read and write the same workspace the webapp uses. 31 data tools, 3 operator tools (Branch/Matrix/C-K/ASIT/TRIZ/Free/Combine/Explore), and live Realtime change subscriptions.",
6
6
  "type": "module",