@neus/sdk 1.1.6 → 1.2.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/index.js CHANGED
@@ -57,6 +57,32 @@ export {
57
57
 
58
58
  export { fetchSponsorGrant } from './sponsor.js';
59
59
 
60
+ export {
61
+ RUNTIME_MOUNT_SCHEMA,
62
+ normalizeWallet,
63
+ isDelegationExpired,
64
+ pickIdentity,
65
+ pickActiveDelegation,
66
+ resolveEffectiveRuntime,
67
+ extractAgentContextFromProofs,
68
+ buildRuntimeBundle,
69
+ profileAgentToIdentitySeed,
70
+ isRuntimeBundle,
71
+ resolveRuntimeBundleFromMcp,
72
+ evaluateMountFileHealth
73
+ } from './runtime-mount.js';
74
+
75
+ export {
76
+ MOUNT_MANIFEST_RELATIVE,
77
+ sanitizeAgentIdForFilename,
78
+ bundleToCursorRules,
79
+ bundleToClaudeMd,
80
+ bundleToCodexJson,
81
+ readMountManifest,
82
+ writeMountManifest,
83
+ applyRuntimeBundle
84
+ } from './runtime-adapters.js';
85
+
60
86
  export {
61
87
  SDKError,
62
88
  ApiError,
@@ -67,7 +93,48 @@ export {
67
93
  AuthenticationError
68
94
  } from './errors.js';
69
95
 
96
+ export {
97
+ NEUS_MCP_SERVER_NAME,
98
+ NEUS_MCP_URL,
99
+ NEUS_SETUP_CLI,
100
+ NEUS_AUTH_CLI,
101
+ NEUS_CHECK_CLI,
102
+ NEUS_DOCTOR_CLI,
103
+ NEUS_SETUP_NPX,
104
+ NEUS_CHECK_NPX,
105
+ NEUS_INSTALL_CLI,
106
+ NEUS_NPX,
107
+ NEUS_QUICKSTART_INSTALLED,
108
+ NEUS_QUICKSTART_NPX,
109
+ NEUS_MOUNT_WORKFLOW,
110
+ NEUS_MCP_SETUP_DOCS_URL,
111
+ MCP_INSTALL_CLIENTS,
112
+ MCP_INSTALL_HOSTS,
113
+ IDE_HOST_LABELS,
114
+ IDE_HOST_BRAND_LOGOS,
115
+ buildNeusMcpHttpConfig,
116
+ buildCursorMcpInstallUrl,
117
+ buildVsCodeMcpInstallUrl,
118
+ buildSetupCommandForClient,
119
+ buildSetupCommandForHost,
120
+ buildSetupNpxOneLiner,
121
+ buildAuthCommandForClient,
122
+ supportsMcpInstallDeeplink,
123
+ neusMountApply,
124
+ neusMountApplyNpx,
125
+ } from './mcp-hosts.js';
126
+
127
+ export {
128
+ NEUS_PKG,
129
+ NEUS_EXAMPLES_CLI,
130
+ NEUS_EXAMPLES_NPX,
131
+ NEUS_AUTH_NPX,
132
+ NEUS_DOCTOR_NPX,
133
+ neusCmd,
134
+ neusNpx,
135
+ } from './cli-commands.js';
136
+
70
137
  export default {
71
- NeusClient: () => import('./client.js').then(m => m.NeusClient),
72
- toString: () => '[neus/sdk]'
138
+ NeusClient: () => import('./client.js').then((m) => m.NeusClient),
139
+ toString: () => '[neus/sdk]',
73
140
  };
package/mcp-hosts.js CHANGED
@@ -3,11 +3,40 @@
3
3
  * Browser-safe: no Node-only APIs except the Buffer fallback for non-browser tests.
4
4
  */
5
5
 
6
+ import {
7
+ NEUS_AUTH_CLI,
8
+ NEUS_INSTALL_CLI,
9
+ NEUS_NPX,
10
+ NEUS_SETUP_NPX,
11
+ neusCmd,
12
+ } from './cli-commands.js';
13
+
14
+ export {
15
+ NEUS_PKG,
16
+ NEUS_INSTALL_CLI,
17
+ NEUS_NPX,
18
+ NEUS_SETUP_CLI,
19
+ NEUS_SETUP_NPX,
20
+ NEUS_AUTH_CLI,
21
+ NEUS_CHECK_CLI,
22
+ NEUS_DOCTOR_CLI,
23
+ NEUS_EXAMPLES_CLI,
24
+ NEUS_CHECK_NPX,
25
+ NEUS_AUTH_NPX,
26
+ NEUS_DOCTOR_NPX,
27
+ NEUS_EXAMPLES_NPX,
28
+ NEUS_QUICKSTART_INSTALLED,
29
+ NEUS_QUICKSTART_NPX,
30
+ NEUS_MOUNT_WORKFLOW,
31
+ neusMountApply,
32
+ neusMountApplyNpx,
33
+ neusCmd,
34
+ neusNpx,
35
+ } from './cli-commands.js';
36
+
6
37
  export const NEUS_MCP_SERVER_NAME = 'neus';
7
38
  export const NEUS_MCP_URL = 'https://mcp.neus.network/mcp';
8
- export const NEUS_SETUP_CLI = 'npx -y -p @neus/sdk neus setup';
9
- export const NEUS_AUTH_CLI = 'npx -y -p @neus/sdk neus auth';
10
- export const NEUS_MCP_SETUP_DOCS_URL = 'https://docs.neus.network/mcp/ide-plugin';
39
+ export const NEUS_MCP_SETUP_DOCS_URL = 'https://docs.neus.network/mcp/setup';
11
40
 
12
41
  /** CLI `neus setup --client` values. */
13
42
  export const MCP_INSTALL_CLIENTS = ['claude', 'codex', 'cursor', 'vscode'];
@@ -18,13 +47,13 @@ export const MCP_INSTALL_HOSTS = ['cursor', 'claude', 'codex'];
18
47
  export const IDE_HOST_LABELS = {
19
48
  cursor: 'Cursor',
20
49
  claude: 'Claude Code',
21
- codex: 'Codex'
50
+ codex: 'Codex',
22
51
  };
23
52
 
24
53
  export const IDE_HOST_BRAND_LOGOS = {
25
54
  cursor: '/images/brandLogos/cursor.svg',
26
55
  claude: '/images/brandLogos/anthropic.svg',
27
- codex: '/images/brandLogos/openai.svg'
56
+ codex: '/images/brandLogos/openai.svg',
28
57
  };
29
58
 
30
59
  /**
@@ -36,7 +65,7 @@ export function buildNeusMcpHttpConfig(accessKey) {
36
65
  return {
37
66
  type: 'http',
38
67
  url: NEUS_MCP_URL,
39
- ...(key ? { headers: { Authorization: `Bearer ${key}` } } : {})
68
+ ...(key ? { headers: { Authorization: `Bearer ${key}` } } : {}),
40
69
  };
41
70
  }
42
71
 
@@ -69,7 +98,7 @@ export function buildCursorMcpInstallUrl(accessKey) {
69
98
  export function buildVsCodeMcpInstallUrl(accessKey) {
70
99
  const payload = {
71
100
  name: NEUS_MCP_SERVER_NAME,
72
- ...buildNeusMcpHttpConfig(accessKey)
101
+ ...buildNeusMcpHttpConfig(accessKey),
73
102
  };
74
103
  return `vscode:mcp/install?${encodeURIComponent(JSON.stringify(payload))}`;
75
104
  }
@@ -80,12 +109,13 @@ export function buildVsCodeMcpInstallUrl(accessKey) {
80
109
  */
81
110
  export function buildAuthCommandForClient(client) {
82
111
  if (client === 'codex') {
83
- return `${NEUS_AUTH_CLI} --client codex`;
112
+ return neusCmd(`auth --client codex`);
84
113
  }
85
114
  return NEUS_AUTH_CLI;
86
115
  }
87
116
 
88
117
  /**
118
+ * Copy-paste block for Profile / IDE onboarding (install + setup + auth).
89
119
  * @param {'claude' | 'codex' | 'cursor' | 'vscode'} client
90
120
  * @param {string | null | undefined} accessKey
91
121
  * @returns {string}
@@ -93,10 +123,13 @@ export function buildAuthCommandForClient(client) {
93
123
  export function buildSetupCommandForClient(client, accessKey) {
94
124
  const key = String(accessKey || '').trim();
95
125
  const setup = key
96
- ? `${NEUS_SETUP_CLI} --client ${client} --access-key ${key}`
97
- : `${NEUS_SETUP_CLI} --client ${client}`;
98
- if (key) return setup;
99
- return `${setup}\n${buildAuthCommandForClient(client)}`;
126
+ ? neusCmd(`setup --client ${client} --access-key ${key}`)
127
+ : neusCmd(`setup --client ${client}`);
128
+ if (key) {
129
+ return `${NEUS_INSTALL_CLI}\n${setup}`;
130
+ }
131
+ const auth = buildAuthCommandForClient(client);
132
+ return `${NEUS_INSTALL_CLI}\n${setup}\n${auth}`;
100
133
  }
101
134
 
102
135
  /**
@@ -108,6 +141,15 @@ export function buildSetupCommandForHost(host, accessKey) {
108
141
  return buildSetupCommandForClient(host, accessKey);
109
142
  }
110
143
 
144
+ /**
145
+ * Zero-install one-liner for landing pages and copy buttons.
146
+ * @param {'claude' | 'codex' | 'cursor' | 'vscode'} [client]
147
+ */
148
+ export function buildSetupNpxOneLiner(client) {
149
+ if (!client) return NEUS_SETUP_NPX;
150
+ return `${NEUS_NPX} setup --client ${client}`;
151
+ }
152
+
111
153
  /**
112
154
  * Cursor supports MCP install deeplinks; Codex uses CLI, not VS Code deeplinks.
113
155
  * @param {'cursor' | 'claude' | 'codex'} host
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neus/sdk",
3
- "version": "1.1.6",
3
+ "version": "1.2.0",
4
4
  "description": "NEUS makes trust portable across the internet — so people, apps, and AI agents can prove what is real before access, payout, or execution.",
5
5
  "bin": {
6
6
  "neus": "cli/neus.mjs"
@@ -31,10 +31,22 @@
31
31
  "import": "./gates.js",
32
32
  "require": "./cjs/gates.cjs"
33
33
  },
34
+ "./cli-commands": {
35
+ "import": "./cli-commands.js",
36
+ "require": "./cjs/cli-commands.cjs"
37
+ },
34
38
  "./mcp-hosts": {
35
39
  "import": "./mcp-hosts.js",
36
40
  "require": "./cjs/mcp-hosts.cjs"
37
41
  },
42
+ "./runtime-mount": {
43
+ "import": "./runtime-mount.js",
44
+ "require": "./cjs/runtime-mount.cjs"
45
+ },
46
+ "./runtime-adapters": {
47
+ "import": "./runtime-adapters.js",
48
+ "require": "./cjs/runtime-adapters.cjs"
49
+ },
38
50
  "./widgets": {
39
51
  "types": "./types.d.ts",
40
52
  "import": "./widgets/index.js",
@@ -54,7 +66,7 @@
54
66
  "format": "prettier --write \"**/*.js\"",
55
67
  "build": "npm run build:widgets && npm run build:cjs",
56
68
  "build:widgets": "npx esbuild widgets/verify-gate/VerifyGate.jsx widgets/verify-gate/ProofBadge.jsx --bundle --platform=browser --format=esm --outdir=widgets/verify-gate/dist --jsx=automatic --legal-comments=none --external:react --external:react-dom --external:react/jsx-runtime --external:@neus/sdk/client",
57
- "build:cjs": "npx esbuild index.js client.js utils.js errors.js gates.js mcp-hosts.js --bundle --platform=node --format=cjs --outdir=cjs --out-extension:.js=.cjs --legal-comments=none --external:ethers --external:@zkpassport/sdk --external:react --external:react-dom --external:react/jsx-runtime",
69
+ "build:cjs": "npx esbuild index.js client.js utils.js errors.js gates.js cli-commands.js mcp-hosts.js runtime-mount.js runtime-adapters.js --bundle --platform=node --format=cjs --outdir=cjs --out-extension:.js=.cjs --legal-comments=none --external:ethers --external:@zkpassport/sdk --external:react --external:react-dom --external:react/jsx-runtime",
58
70
  "prepack": "npm run build",
59
71
  "prepublishOnly": "npm run lint && npm test && npm run build"
60
72
  },
@@ -113,6 +125,9 @@
113
125
  "optionalDependencies": {
114
126
  "@zkpassport/sdk": "^0.14.0"
115
127
  },
128
+ "overrides": {
129
+ "ws": "8.21.0"
130
+ },
116
131
  "dependencies": {
117
132
  "bs58": "^6.0.0"
118
133
  },
package/types.d.ts CHANGED
@@ -462,7 +462,7 @@
462
462
  maxAgeMs?: number;
463
463
  }
464
464
 
465
- /** Public snapshot returned by GET /api/v1/gates/{gateId} — never includes the secret reward value. */
465
+ /** Public snapshot returned by GET /api/v1/profile/gates/{gateId} — never includes the secret reward value. */
466
466
  export interface PublicGateSnapshot {
467
467
  schemaVersion: number;
468
468
  gateId: string;
@@ -1170,3 +1170,92 @@ declare module '@neus/sdk/mcp-hosts' {
1170
1170
  export function buildSetupCommandForHost(host: McpInstallHost, accessKey?: string | null): string;
1171
1171
  export function supportsMcpInstallDeeplink(host: McpInstallHost): boolean;
1172
1172
  }
1173
+
1174
+ declare module '@neus/sdk/runtime-mount' {
1175
+ export const RUNTIME_MOUNT_SCHEMA: 'neus.runtime-mount.v1';
1176
+
1177
+ export interface RuntimeBundleTrust {
1178
+ identityQHash?: string;
1179
+ delegationQHash?: string;
1180
+ identityUrl?: string;
1181
+ delegationUrl?: string;
1182
+ }
1183
+
1184
+ export interface RuntimeBundleIdentity {
1185
+ agentId: string;
1186
+ agentWallet: string;
1187
+ displayName?: string;
1188
+ capabilities?: string[];
1189
+ identityQHash?: string;
1190
+ }
1191
+
1192
+ export interface RuntimeBundleDelegation {
1193
+ delegationQHash?: string;
1194
+ controllerWallet?: string;
1195
+ allowedActions?: string[];
1196
+ deniedActions?: string[];
1197
+ expiresAt?: number | null;
1198
+ }
1199
+
1200
+ export interface RuntimeBundle {
1201
+ schema: typeof RUNTIME_MOUNT_SCHEMA;
1202
+ mountedAt: string;
1203
+ trust: RuntimeBundleTrust;
1204
+ identity: RuntimeBundleIdentity;
1205
+ delegation: RuntimeBundleDelegation;
1206
+ effectiveRuntime?: Record<string, unknown>;
1207
+ tools?: string[];
1208
+ secretBindings?: Array<Record<string, unknown>>;
1209
+ enforce?: Record<string, unknown>;
1210
+ contextPack?: Record<string, unknown>;
1211
+ }
1212
+
1213
+ export function normalizeWallet(value: string | null | undefined): string;
1214
+ export function isDelegationExpired(expiresAt: number | null | undefined): boolean;
1215
+ export function pickIdentity(
1216
+ identities: Array<Record<string, unknown>>,
1217
+ selector: { agentId?: string; agentWallet?: string; identityQHash?: string },
1218
+ ): Record<string, unknown> | null;
1219
+ export function pickActiveDelegation(
1220
+ delegations: Array<Record<string, unknown>>,
1221
+ controllerWallet: string,
1222
+ agentWallet: string,
1223
+ agentId: string,
1224
+ ): Record<string, unknown> | null;
1225
+ export function extractAgentContextFromProofs(proofs: unknown): {
1226
+ identities: Array<Record<string, unknown>>;
1227
+ delegations: Array<Record<string, unknown>>;
1228
+ };
1229
+ export function buildRuntimeBundle(input: Record<string, unknown>): RuntimeBundle;
1230
+ export function resolveRuntimeBundleFromMcp(
1231
+ mcpClient: { callTool: (name: string, args?: Record<string, unknown>) => Promise<unknown> },
1232
+ selector: { agentId?: string; agentWallet?: string; identityQHash?: string }
1233
+ ): Promise<RuntimeBundle>;
1234
+
1235
+ export function evaluateMountFileHealth(
1236
+ manifest: RuntimeBundle | Record<string, unknown> | null | undefined
1237
+ ): {
1238
+ mountFileValid: boolean;
1239
+ missingDelegation: boolean;
1240
+ delegationExpired: boolean;
1241
+ needsRefresh: boolean;
1242
+ reason: string | null;
1243
+ };
1244
+ }
1245
+
1246
+ declare module '@neus/sdk/runtime-adapters' {
1247
+ import type { RuntimeBundle } from '@neus/sdk/runtime-mount';
1248
+
1249
+ export type RuntimeAdapterHost = 'cursor' | 'claude' | 'codex';
1250
+
1251
+ export interface ApplyRuntimeBundleResult {
1252
+ mountPath: string;
1253
+ adapterFiles: string[];
1254
+ }
1255
+
1256
+ export function applyRuntimeBundle(
1257
+ host: RuntimeAdapterHost,
1258
+ bundle: RuntimeBundle,
1259
+ projectRoot: string
1260
+ ): Promise<ApplyRuntimeBundleResult>;
1261
+ }