sigild 0.0.8 → 0.0.10
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 +77 -22
- package/THREAT_MODEL.md +7 -5
- package/dist/src/bin/sigil-mcp.js +59 -16
- package/dist/src/bin/sigil-mcp.js.map +1 -1
- package/dist/src/cli/index.d.ts +2 -2
- package/dist/src/cli/index.d.ts.map +1 -1
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/cli/main.d.ts.map +1 -1
- package/dist/src/cli/main.js +10 -8
- package/dist/src/cli/main.js.map +1 -1
- package/dist/src/cli/paths.d.ts +15 -5
- package/dist/src/cli/paths.d.ts.map +1 -1
- package/dist/src/cli/paths.js +11 -1
- package/dist/src/cli/paths.js.map +1 -1
- package/dist/src/cli/portal.d.ts +3 -0
- package/dist/src/cli/portal.d.ts.map +1 -1
- package/dist/src/cli/portal.js +7 -1
- package/dist/src/cli/portal.js.map +1 -1
- package/dist/src/cli/status.d.ts +15 -12
- package/dist/src/cli/status.d.ts.map +1 -1
- package/dist/src/cli/status.js +17 -30
- package/dist/src/cli/status.js.map +1 -1
- package/dist/src/cli/unlock.d.ts +15 -15
- package/dist/src/cli/unlock.d.ts.map +1 -1
- package/dist/src/cli/unlock.js +83 -60
- package/dist/src/cli/unlock.js.map +1 -1
- package/dist/src/confirm/ack-server.d.ts +53 -0
- package/dist/src/confirm/ack-server.d.ts.map +1 -0
- package/dist/src/confirm/ack-server.js +87 -0
- package/dist/src/confirm/ack-server.js.map +1 -0
- package/dist/src/confirm/config.d.ts +56 -0
- package/dist/src/confirm/config.d.ts.map +1 -0
- package/dist/src/confirm/config.js +143 -0
- package/dist/src/confirm/config.js.map +1 -0
- package/dist/src/confirm/gate.d.ts +38 -0
- package/dist/src/confirm/gate.d.ts.map +1 -0
- package/dist/src/confirm/gate.js +66 -0
- package/dist/src/confirm/gate.js.map +1 -0
- package/dist/src/confirm/index.d.ts +6 -0
- package/dist/src/confirm/index.d.ts.map +1 -0
- package/dist/src/confirm/index.js +5 -0
- package/dist/src/confirm/index.js.map +1 -0
- package/dist/src/confirm/ntfy.d.ts +38 -0
- package/dist/src/confirm/ntfy.d.ts.map +1 -0
- package/dist/src/confirm/ntfy.js +47 -0
- package/dist/src/confirm/ntfy.js.map +1 -0
- package/dist/src/confirm/types.d.ts +66 -0
- package/dist/src/confirm/types.d.ts.map +1 -0
- package/dist/src/confirm/types.js +12 -0
- package/dist/src/confirm/types.js.map +1 -0
- package/dist/src/control/broadcast.d.ts +29 -0
- package/dist/src/control/broadcast.d.ts.map +1 -0
- package/dist/src/control/broadcast.js +88 -0
- package/dist/src/control/broadcast.js.map +1 -0
- package/dist/src/control/client.d.ts.map +1 -1
- package/dist/src/control/client.js +4 -1
- package/dist/src/control/client.js.map +1 -1
- package/dist/src/control/index.d.ts +1 -0
- package/dist/src/control/index.d.ts.map +1 -1
- package/dist/src/control/index.js +1 -0
- package/dist/src/control/index.js.map +1 -1
- package/dist/src/control/protocol.d.ts +5 -1
- package/dist/src/control/protocol.d.ts.map +1 -1
- package/dist/src/control/protocol.js +2 -1
- package/dist/src/control/protocol.js.map +1 -1
- package/dist/src/control/server.js +6 -6
- package/dist/src/control/server.js.map +1 -1
- package/dist/src/daemon/handles.d.ts +3 -0
- package/dist/src/daemon/handles.d.ts.map +1 -1
- package/dist/src/daemon/handles.js +3 -1
- package/dist/src/daemon/handles.js.map +1 -1
- package/dist/src/daemon/methods.d.ts +13 -3
- package/dist/src/daemon/methods.d.ts.map +1 -1
- package/dist/src/daemon/methods.js +121 -16
- package/dist/src/daemon/methods.js.map +1 -1
- package/dist/src/mcp/server.d.ts +14 -2
- package/dist/src/mcp/server.d.ts.map +1 -1
- package/dist/src/mcp/server.js +28 -14
- package/dist/src/mcp/server.js.map +1 -1
- package/dist/src/mcp/tools.d.ts +1 -1
- package/dist/src/mcp/tools.d.ts.map +1 -1
- package/dist/src/mcp/tools.js +38 -4
- package/dist/src/mcp/tools.js.map +1 -1
- package/dist/src/policy/evaluate.d.ts +12 -4
- package/dist/src/policy/evaluate.d.ts.map +1 -1
- package/dist/src/policy/evaluate.js +189 -21
- package/dist/src/policy/evaluate.js.map +1 -1
- package/dist/src/policy/loader.d.ts.map +1 -1
- package/dist/src/policy/loader.js +74 -0
- package/dist/src/policy/loader.js.map +1 -1
- package/dist/src/policy/template.d.ts +1 -1
- package/dist/src/policy/template.d.ts.map +1 -1
- package/dist/src/policy/template.js +37 -0
- package/dist/src/policy/template.js.map +1 -1
- package/dist/src/policy/types.d.ts +62 -3
- package/dist/src/policy/types.d.ts.map +1 -1
- package/dist/src/policy/types.js.map +1 -1
- package/dist/src/svm/address.d.ts +14 -0
- package/dist/src/svm/address.d.ts.map +1 -0
- package/dist/src/svm/address.js +18 -0
- package/dist/src/svm/address.js.map +1 -0
- package/dist/src/svm/base58.d.ts +15 -0
- package/dist/src/svm/base58.d.ts.map +1 -0
- package/dist/src/svm/base58.js +60 -0
- package/dist/src/svm/base58.js.map +1 -0
- package/dist/src/svm/ed25519.d.ts +19 -0
- package/dist/src/svm/ed25519.d.ts.map +1 -0
- package/dist/src/svm/ed25519.js +32 -0
- package/dist/src/svm/ed25519.js.map +1 -0
- package/dist/src/svm/index.d.ts +5 -0
- package/dist/src/svm/index.d.ts.map +1 -0
- package/dist/src/svm/index.js +5 -0
- package/dist/src/svm/index.js.map +1 -0
- package/dist/src/svm/transaction.d.ts +56 -0
- package/dist/src/svm/transaction.d.ts.map +1 -0
- package/dist/src/svm/transaction.js +182 -0
- package/dist/src/svm/transaction.js.map +1 -0
- package/package.json +2 -1
package/dist/src/mcp/server.js
CHANGED
|
@@ -4,8 +4,11 @@ import { encodeError, encodeSuccess, MCP_INTERNAL_ERROR, MCP_INVALID_PARAMS, MCP
|
|
|
4
4
|
* Handle a single received line by dispatching it through the MCP protocol.
|
|
5
5
|
* Returns either a response string to send back, or `null` if the line was a
|
|
6
6
|
* notification (no response expected).
|
|
7
|
+
*
|
|
8
|
+
* Async because tools/call can perform an out-of-band confirm round-trip
|
|
9
|
+
* (sign_transaction → ConfirmGate → human ack) that may take seconds.
|
|
7
10
|
*/
|
|
8
|
-
export function handleLine(line, opts) {
|
|
11
|
+
export async function handleLine(line, opts) {
|
|
9
12
|
const parsed = parseMessage(line);
|
|
10
13
|
const log = (e) => opts.onLog?.(e);
|
|
11
14
|
if (parsed.kind === 'parse_error') {
|
|
@@ -26,7 +29,7 @@ export function handleLine(line, opts) {
|
|
|
26
29
|
const req = parsed.request;
|
|
27
30
|
log({ kind: 'recv', method: req.method, id: req.id });
|
|
28
31
|
try {
|
|
29
|
-
const result = dispatch(req, opts);
|
|
32
|
+
const result = await dispatch(req, opts);
|
|
30
33
|
log({ kind: 'send_ok', id: req.id });
|
|
31
34
|
return encodeSuccess(req.id, result);
|
|
32
35
|
}
|
|
@@ -40,7 +43,7 @@ export function handleLine(line, opts) {
|
|
|
40
43
|
return encodeError(req.id, MCP_INTERNAL_ERROR, message);
|
|
41
44
|
}
|
|
42
45
|
}
|
|
43
|
-
function dispatch(req, opts) {
|
|
46
|
+
async function dispatch(req, opts) {
|
|
44
47
|
switch (req.method) {
|
|
45
48
|
case 'initialize':
|
|
46
49
|
return {
|
|
@@ -51,14 +54,14 @@ function dispatch(req, opts) {
|
|
|
51
54
|
case 'tools/list':
|
|
52
55
|
return { tools: TOOLS.map((t) => t.definition) };
|
|
53
56
|
case 'tools/call':
|
|
54
|
-
return invokeTool(req.params, opts);
|
|
57
|
+
return await invokeTool(req.params, opts);
|
|
55
58
|
case 'ping':
|
|
56
59
|
return {};
|
|
57
60
|
default:
|
|
58
61
|
throw new ToolError(MCP_METHOD_NOT_FOUND, `method not found: ${req.method}`);
|
|
59
62
|
}
|
|
60
63
|
}
|
|
61
|
-
function invokeTool(params, opts) {
|
|
64
|
+
async function invokeTool(params, opts) {
|
|
62
65
|
if (typeof params !== 'object' || params === null || Array.isArray(params)) {
|
|
63
66
|
throw new ToolError(MCP_INVALID_PARAMS, 'tools/call: params must be an object');
|
|
64
67
|
}
|
|
@@ -72,18 +75,27 @@ function invokeTool(params, opts) {
|
|
|
72
75
|
throw new ToolError(MCP_METHOD_NOT_FOUND, `unknown tool: ${name}`);
|
|
73
76
|
}
|
|
74
77
|
const args = obj['arguments'] ?? {};
|
|
75
|
-
return tool.handler(args, opts.context);
|
|
78
|
+
return await tool.handler(args, opts.context);
|
|
76
79
|
}
|
|
77
80
|
/**
|
|
78
81
|
* Run the MCP server over arbitrary streams (stdin/stdout in production,
|
|
79
|
-
* mock streams in tests). Resolves when stdin closes
|
|
82
|
+
* mock streams in tests). Resolves when stdin closes AND any in-flight
|
|
83
|
+
* requests have finished — so a slow confirm round-trip doesn't get
|
|
84
|
+
* truncated by an early resolve.
|
|
85
|
+
*
|
|
86
|
+
* Concurrency: handlers run serially, chained through a processing promise.
|
|
87
|
+
* That preserves response ordering (matches sync behavior pre-confirm) and
|
|
88
|
+
* keeps stdout writes ordered without needing a separate write queue.
|
|
89
|
+
* Trade-off: a long-pending confirm on request A blocks request B until A
|
|
90
|
+
* resolves. Acceptable for sigil — agents don't pipeline tool calls in
|
|
91
|
+
* practice, and serial is the simpler correctness story.
|
|
80
92
|
*/
|
|
81
93
|
export function runMcpStdio(opts) {
|
|
82
94
|
const { stdin, stdout } = opts;
|
|
83
95
|
stdin.setEncoding?.('utf8');
|
|
84
96
|
return new Promise((resolve, reject) => {
|
|
85
97
|
let buf = '';
|
|
86
|
-
let
|
|
98
|
+
let processing = Promise.resolve();
|
|
87
99
|
stdin.on('data', (chunk) => {
|
|
88
100
|
buf += typeof chunk === 'string' ? chunk : chunk.toString('utf8');
|
|
89
101
|
let nl;
|
|
@@ -92,15 +104,17 @@ export function runMcpStdio(opts) {
|
|
|
92
104
|
buf = buf.slice(nl + 1);
|
|
93
105
|
if (line.length === 0)
|
|
94
106
|
continue;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
107
|
+
processing = processing.then(async () => {
|
|
108
|
+
const resp = await handleLine(line, opts);
|
|
109
|
+
if (resp !== null)
|
|
110
|
+
stdout.write(resp + '\n');
|
|
111
|
+
});
|
|
98
112
|
}
|
|
99
113
|
});
|
|
100
114
|
stdin.on('end', () => {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
115
|
+
// Drain the processing chain before resolving — otherwise a confirm
|
|
116
|
+
// mid-flight when stdin closes would lose its response.
|
|
117
|
+
processing.then(() => resolve(), reject);
|
|
104
118
|
});
|
|
105
119
|
stdin.on('error', reject);
|
|
106
120
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExD,OAAO,EACL,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,WAAW,GAGZ,MAAM,eAAe,CAAC;AAsBvB
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExD,OAAO,EACL,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,WAAW,GAGZ,MAAM,eAAe,CAAC;AAsBvB;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAY,EAAE,IAAmB;IAChE,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,GAAG,GAAG,CAAC,CAAc,EAAQ,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;IAEtD,IAAI,MAAM,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,MAAM,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/src/mcp/tools.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type MethodContext } from '../daemon/methods.js';
|
|
2
2
|
import { type ToolDefinition, type ToolResult } from './protocol.js';
|
|
3
3
|
export type ToolHandlerCtx = MethodContext;
|
|
4
|
-
export type ToolHandler = (args: unknown, ctx: ToolHandlerCtx) => ToolResult
|
|
4
|
+
export type ToolHandler = (args: unknown, ctx: ToolHandlerCtx) => Promise<ToolResult>;
|
|
5
5
|
export interface Tool {
|
|
6
6
|
definition: ToolDefinition;
|
|
7
7
|
handler: ToolHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,aAAa,EAAkB,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAsB,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAEzF,MAAM,MAAM,cAAc,GAAG,aAAa,CAAC;AAE3C,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,KAAK,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,aAAa,EAAkB,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAsB,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAEzF,MAAM,MAAM,cAAc,GAAG,aAAa,CAAC;AAE3C,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtF,MAAM,WAAW,IAAI;IACnB,UAAU,EAAE,cAAc,CAAC;IAC3B,OAAO,EAAE,WAAW,CAAC;CACtB;AAiHD,eAAO,MAAM,KAAK,EAAE,SAAS,IAAI,EAO/B,CAAC;AAEH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAEvD;AAMD,qBAAa,SAAU,SAAQ,KAAK;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;gBACX,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO;CAM1D"}
|
package/dist/src/mcp/tools.js
CHANGED
|
@@ -6,7 +6,7 @@ import { MCP_INTERNAL_ERROR } from './protocol.js';
|
|
|
6
6
|
const listPortals = {
|
|
7
7
|
definition: {
|
|
8
8
|
name: 'sigil_list_portals',
|
|
9
|
-
description: 'List the signing portals currently loaded in sigil. Returns each portal handle (e.g. "evm:executor"), its kind, and the
|
|
9
|
+
description: 'List the signing portals currently loaded in sigil. Returns each portal handle (e.g. "evm:executor"), its kind, the EVM address (`address`, secp256k1, 0x-prefixed) and the Solana address (`svmAddress`, ed25519, base58) — both controlled by the same key.',
|
|
10
10
|
inputSchema: { type: 'object', properties: {}, additionalProperties: false },
|
|
11
11
|
},
|
|
12
12
|
handler: (args, ctx) => callMethod('sigil_list_portals', args, ctx),
|
|
@@ -37,7 +37,7 @@ const ethSignTransaction = {
|
|
|
37
37
|
portal: { type: 'string', description: 'Portal handle.' },
|
|
38
38
|
tx: {
|
|
39
39
|
type: 'object',
|
|
40
|
-
description: 'Transaction fields. type="legacy" requires {chainId, nonce, gasPrice, gasLimit, to, value, data}. type="eip1559" requires {chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, accessList?}. Numbers may be supplied as JSON numbers or decimal strings.',
|
|
40
|
+
description: 'Transaction fields. type="legacy" requires {chainId, nonce, gasPrice, gasLimit, to, value, data}. type="eip1559" requires {chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, accessList?}. To deploy a contract, set to=null (explicit JSON null, not omitted) and put the creation bytecode in data. Numbers may be supplied as JSON numbers or decimal strings.',
|
|
41
41
|
},
|
|
42
42
|
},
|
|
43
43
|
required: ['portal', 'tx'],
|
|
@@ -65,11 +65,45 @@ const ethSignTypedData = {
|
|
|
65
65
|
},
|
|
66
66
|
handler: (args, ctx) => callMethod('sigil_eth_sign_typed_data', args, ctx),
|
|
67
67
|
};
|
|
68
|
+
const svmSignMessage = {
|
|
69
|
+
definition: {
|
|
70
|
+
name: 'sigil_svm_sign_message',
|
|
71
|
+
description: 'Sign an arbitrary off-chain message with the portal\'s Solana (ed25519) key — the same key whose address is `svmAddress`. The message is base64-encoded bytes. Returns the 64-byte signature as a base58 string.',
|
|
72
|
+
inputSchema: {
|
|
73
|
+
type: 'object',
|
|
74
|
+
properties: {
|
|
75
|
+
portal: { type: 'string', description: 'Portal handle, e.g. "evm:executor".' },
|
|
76
|
+
message: { type: 'string', description: 'base64 of the bytes to sign.' },
|
|
77
|
+
},
|
|
78
|
+
required: ['portal', 'message'],
|
|
79
|
+
additionalProperties: false,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
handler: (args, ctx) => callMethod('sigil_svm_sign_message', args, ctx),
|
|
83
|
+
};
|
|
84
|
+
const svmSignTransaction = {
|
|
85
|
+
definition: {
|
|
86
|
+
name: 'sigil_svm_sign_transaction',
|
|
87
|
+
description: 'Sign a Solana transaction message with the portal\'s ed25519 key. Pass the SERIALIZED transaction message (the bytes between the signature array and that you build with your Solana SDK, e.g. message.serialize()) as base64. sigil ed25519-signs those exact bytes and returns the signature as base58 — assemble it into the transaction yourself. Policy decodes native SOL transfers to gate destination/amount; anything it can\'t decode offline is routed to out-of-band confirm. Supports legacy and v0 messages.',
|
|
88
|
+
inputSchema: {
|
|
89
|
+
type: 'object',
|
|
90
|
+
properties: {
|
|
91
|
+
portal: { type: 'string', description: 'Portal handle.' },
|
|
92
|
+
message: { type: 'string', description: 'base64 of the serialized Solana transaction message.' },
|
|
93
|
+
},
|
|
94
|
+
required: ['portal', 'message'],
|
|
95
|
+
additionalProperties: false,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
handler: (args, ctx) => callMethod('sigil_svm_sign_transaction', args, ctx),
|
|
99
|
+
};
|
|
68
100
|
export const TOOLS = Object.freeze([
|
|
69
101
|
listPortals,
|
|
70
102
|
ethSignMessage,
|
|
71
103
|
ethSignTransaction,
|
|
72
104
|
ethSignTypedData,
|
|
105
|
+
svmSignMessage,
|
|
106
|
+
svmSignTransaction,
|
|
73
107
|
]);
|
|
74
108
|
export function findTool(name) {
|
|
75
109
|
return TOOLS.find((t) => t.definition.name === name);
|
|
@@ -93,9 +127,9 @@ export class ToolError extends Error {
|
|
|
93
127
|
* not-found method) into `ToolError` with the same code, so the original
|
|
94
128
|
* error semantics flow through to the MCP client unchanged.
|
|
95
129
|
*/
|
|
96
|
-
function callMethod(methodName, args, ctx) {
|
|
130
|
+
async function callMethod(methodName, args, ctx) {
|
|
97
131
|
try {
|
|
98
|
-
const result = dispatch(methodName, args, ctx);
|
|
132
|
+
const result = await dispatch(methodName, args, ctx);
|
|
99
133
|
return textResult(result);
|
|
100
134
|
}
|
|
101
135
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAsB,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAwC,MAAM,eAAe,CAAC;AAWzF,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E,MAAM,WAAW,GAAS;IACxB,UAAU,EAAE;QACV,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EACT
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../src/mcp/tools.ts"],"names":[],"mappings":"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GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED;;;;;GAKG;AACH,KAAK,UAAU,UAAU,CAAC,UAAkB,EAAE,IAAa,EAAE,GAAkB;IAC7E,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,UAAU,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QACrD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,cAAc,EAAE,CAAC;YAClC,MAAM,IAAI,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;QACvD,CAAC;QACD,MAAM,IAAI,SAAS,CAAC,kBAAkB,EAAE,aAAc,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;IACjF,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,OAAgB;IAClC,8DAA8D;IAC9D,uEAAuE;IACvE,wDAAwD;IACxD,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;QAC1D,iBAAiB,EAAE,OAAO;KAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import type { Policy, PolicyDecision, PolicyRequest } from './types.js';
|
|
2
2
|
/**
|
|
3
|
-
* Pure evaluator.
|
|
3
|
+
* Pure evaluator. Returns Allow, Deny(reason), or ConfirmRequired(summary).
|
|
4
4
|
*
|
|
5
5
|
* The reason string is what the caller writes into the audit log and surfaces
|
|
6
6
|
* as the RPC_POLICY_DENIED error message — write it for a human.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* Order of checks for transactions:
|
|
9
|
+
* 1. strict-mode static deny rules (chain, contract creation, allow_to,
|
|
10
|
+
* value cap, selector) — an allowed contract creation short-circuits
|
|
11
|
+
* to a mandatory confirm here
|
|
12
|
+
* 2. require_confirm_above_wei — independent of mode
|
|
13
|
+
* 3. allow
|
|
14
|
+
*
|
|
15
|
+
* Step 2 runs even in permissive mode: if the user wrote a confirm threshold
|
|
16
|
+
* into their TOML, honour it regardless of whether the rest of the file is
|
|
17
|
+
* permissive. Personal_sign and EIP-712 don't carry a `value` field and so
|
|
18
|
+
* never trigger the confirm path; that's tracked as a follow-up.
|
|
11
19
|
*/
|
|
12
20
|
export declare function evaluate(request: PolicyRequest, policy: Policy): PolicyDecision;
|
|
13
21
|
//# sourceMappingURL=evaluate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../../../src/policy/evaluate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../../../src/policy/evaluate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,aAAa,EAAmB,MAAM,YAAY,CAAC;AAEzF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,CAiD/E"}
|
|
@@ -1,56 +1,181 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Pure evaluator.
|
|
2
|
+
* Pure evaluator. Returns Allow, Deny(reason), or ConfirmRequired(summary).
|
|
3
3
|
*
|
|
4
4
|
* The reason string is what the caller writes into the audit log and surfaces
|
|
5
5
|
* as the RPC_POLICY_DENIED error message — write it for a human.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* Order of checks for transactions:
|
|
8
|
+
* 1. strict-mode static deny rules (chain, contract creation, allow_to,
|
|
9
|
+
* value cap, selector) — an allowed contract creation short-circuits
|
|
10
|
+
* to a mandatory confirm here
|
|
11
|
+
* 2. require_confirm_above_wei — independent of mode
|
|
12
|
+
* 3. allow
|
|
13
|
+
*
|
|
14
|
+
* Step 2 runs even in permissive mode: if the user wrote a confirm threshold
|
|
15
|
+
* into their TOML, honour it regardless of whether the rest of the file is
|
|
16
|
+
* permissive. Personal_sign and EIP-712 don't carry a `value` field and so
|
|
17
|
+
* never trigger the confirm path; that's tracked as a follow-up.
|
|
10
18
|
*/
|
|
11
19
|
export function evaluate(request, policy) {
|
|
12
|
-
if (policy.mode === 'permissive')
|
|
13
|
-
|
|
20
|
+
if (policy.mode === 'permissive') {
|
|
21
|
+
if (request.kind === 'transaction') {
|
|
22
|
+
const confirm = confirmForTx(request.tx, policy);
|
|
23
|
+
if (confirm)
|
|
24
|
+
return confirm;
|
|
25
|
+
}
|
|
26
|
+
if (request.kind === 'svm_transaction') {
|
|
27
|
+
const confirm = confirmForSvmTx(request, policy);
|
|
28
|
+
if (confirm)
|
|
29
|
+
return confirm;
|
|
30
|
+
}
|
|
31
|
+
return { kind: 'allow' };
|
|
32
|
+
}
|
|
14
33
|
switch (request.kind) {
|
|
15
|
-
case 'transaction':
|
|
16
|
-
|
|
34
|
+
case 'transaction': {
|
|
35
|
+
const decision = evaluateTransactionStrict(request.tx, policy);
|
|
36
|
+
if (decision)
|
|
37
|
+
return decision;
|
|
38
|
+
const confirm = confirmForTx(request.tx, policy);
|
|
39
|
+
if (confirm)
|
|
40
|
+
return confirm;
|
|
41
|
+
return { kind: 'allow' };
|
|
42
|
+
}
|
|
17
43
|
case 'message':
|
|
18
44
|
return policy.allowMessageSigning
|
|
19
|
-
? {
|
|
45
|
+
? { kind: 'allow' }
|
|
20
46
|
: {
|
|
21
|
-
|
|
47
|
+
kind: 'deny',
|
|
22
48
|
reason: 'personal_sign denied — strict mode + allow_message_signing=false',
|
|
23
49
|
};
|
|
24
50
|
case 'typed_data':
|
|
25
51
|
return policy.allowTypedData
|
|
26
|
-
? {
|
|
52
|
+
? { kind: 'allow' }
|
|
27
53
|
: {
|
|
28
|
-
|
|
54
|
+
kind: 'deny',
|
|
29
55
|
reason: 'EIP-712 typed-data denied — strict mode + allow_typed_data=false',
|
|
30
56
|
};
|
|
57
|
+
case 'svm_message':
|
|
58
|
+
return policy.allowSvmMessageSigning
|
|
59
|
+
? { kind: 'allow' }
|
|
60
|
+
: {
|
|
61
|
+
kind: 'deny',
|
|
62
|
+
reason: 'svm message signing denied — strict mode + allow_svm_message_signing=false',
|
|
63
|
+
};
|
|
64
|
+
case 'svm_transaction': {
|
|
65
|
+
const decision = evaluateSvmTxStrict(request, policy);
|
|
66
|
+
if (decision)
|
|
67
|
+
return decision;
|
|
68
|
+
const confirm = confirmForSvmTx(request, policy);
|
|
69
|
+
if (confirm)
|
|
70
|
+
return confirm;
|
|
71
|
+
return { kind: 'allow' };
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Strict-mode Solana transaction check. All-or-nothing decode:
|
|
77
|
+
* - if any instruction couldn't be decoded offline, we can't reason about
|
|
78
|
+
* what it does → route to a human confirm (NOT a silent allow);
|
|
79
|
+
* - otherwise every transfer's destination must be allowlisted and the
|
|
80
|
+
* total must be within the cap, else hard deny.
|
|
81
|
+
* Returns a deny/confirm decision, or null when the static checks pass (the
|
|
82
|
+
* caller then applies the value-based confirm threshold).
|
|
83
|
+
*/
|
|
84
|
+
function evaluateSvmTxStrict(req, policy) {
|
|
85
|
+
if (!req.allDecoded) {
|
|
86
|
+
return {
|
|
87
|
+
kind: 'confirm',
|
|
88
|
+
summary: `unrecognized Solana tx — ${req.instructionCount} instruction${req.instructionCount === 1 ? '' : 's'}, contents not decodable offline`,
|
|
89
|
+
};
|
|
31
90
|
}
|
|
91
|
+
let total = 0n;
|
|
92
|
+
for (const t of req.transfers) {
|
|
93
|
+
if (!policy.svmAllowTo.includes(t.to)) {
|
|
94
|
+
return { kind: 'deny', reason: `svm tx denied — recipient ${t.to} not in svm_allow_to` };
|
|
95
|
+
}
|
|
96
|
+
total += t.lamports;
|
|
97
|
+
}
|
|
98
|
+
if (total > policy.svmMaxLamports) {
|
|
99
|
+
return {
|
|
100
|
+
kind: 'deny',
|
|
101
|
+
reason: `svm tx denied — total ${total} lamports exceeds svm_max_lamports ${policy.svmMaxLamports}`,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* If require_confirm_above_lamports is set and the total transferred exceeds
|
|
108
|
+
* it, return a Confirm. Only sums the decoded transfers — in permissive mode
|
|
109
|
+
* an undecoded tx contributes nothing here (permissive allows it outright).
|
|
110
|
+
*/
|
|
111
|
+
function confirmForSvmTx(req, policy) {
|
|
112
|
+
if (policy.requireConfirmAboveLamports === undefined)
|
|
113
|
+
return null;
|
|
114
|
+
let total = 0n;
|
|
115
|
+
for (const t of req.transfers)
|
|
116
|
+
total += t.lamports;
|
|
117
|
+
if (total <= policy.requireConfirmAboveLamports)
|
|
118
|
+
return null;
|
|
119
|
+
return { kind: 'confirm', summary: `${formatSol(total)} SOL → ${svmDest(req.transfers)}` };
|
|
32
120
|
}
|
|
33
|
-
function
|
|
121
|
+
function svmDest(transfers) {
|
|
122
|
+
if (transfers.length === 1)
|
|
123
|
+
return shortB58(transfers[0].to);
|
|
124
|
+
return `${transfers.length} recipients`;
|
|
125
|
+
}
|
|
126
|
+
function shortB58(addr) {
|
|
127
|
+
return addr.length > 12 ? `${addr.slice(0, 4)}…${addr.slice(-4)}` : addr;
|
|
128
|
+
}
|
|
129
|
+
function formatSol(lamports) {
|
|
130
|
+
const LAMPORTS_PER_SOL = 1000000000n;
|
|
131
|
+
const whole = lamports / LAMPORTS_PER_SOL;
|
|
132
|
+
const frac = lamports % LAMPORTS_PER_SOL;
|
|
133
|
+
if (frac === 0n)
|
|
134
|
+
return whole.toString();
|
|
135
|
+
const fracStr = frac.toString().padStart(9, '0').slice(0, 6).replace(/0+$/, '');
|
|
136
|
+
return fracStr === '' ? whole.toString() : `${whole}.${fracStr}`;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Strict-mode static checks. Returns a Deny decision on the first failure,
|
|
140
|
+
* a Confirm for an allowed contract creation, or `null` if everything passes
|
|
141
|
+
* (the caller then runs the confirm check).
|
|
142
|
+
*/
|
|
143
|
+
function evaluateTransactionStrict(tx, policy) {
|
|
34
144
|
// 1. chain ID
|
|
35
145
|
if (!policy.chainIds.includes(Number(tx.chainId))) {
|
|
36
146
|
return {
|
|
37
|
-
|
|
147
|
+
kind: 'deny',
|
|
38
148
|
reason: `tx denied — chain ${tx.chainId} not in chain_ids ${JSON.stringify(policy.chainIds)}`,
|
|
39
149
|
};
|
|
40
150
|
}
|
|
41
|
-
// 2. contract creation (to: null) —
|
|
151
|
+
// 2. contract creation (to: null) — off by default. Initcode is arbitrary
|
|
152
|
+
// code, so there is no address or selector to allowlist; when enabled,
|
|
153
|
+
// a deploy still respects the value cap and ALWAYS routes to a human
|
|
154
|
+
// confirm rather than an unconditional allow.
|
|
42
155
|
if (tx.to === null) {
|
|
43
|
-
|
|
156
|
+
if (!policy.allowContractCreation) {
|
|
157
|
+
return {
|
|
158
|
+
kind: 'deny',
|
|
159
|
+
reason: 'tx denied — contract creation not allowed (allow_contract_creation = false)',
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
if (tx.value > policy.maxValueWei) {
|
|
163
|
+
return {
|
|
164
|
+
kind: 'deny',
|
|
165
|
+
reason: `tx denied — value ${tx.value} wei exceeds max_value_wei ${policy.maxValueWei}`,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
return { kind: 'confirm', summary: txSummary(tx) };
|
|
44
169
|
}
|
|
45
170
|
// 3. destination allowlist (case-insensitive; allow_to is pre-lowercased)
|
|
46
171
|
const to = tx.to.toLowerCase();
|
|
47
172
|
if (!policy.allowTo.includes(to)) {
|
|
48
|
-
return {
|
|
173
|
+
return { kind: 'deny', reason: `tx denied — destination ${to} not in allow_to` };
|
|
49
174
|
}
|
|
50
175
|
// 4. per-tx value cap
|
|
51
176
|
if (tx.value > policy.maxValueWei) {
|
|
52
177
|
return {
|
|
53
|
-
|
|
178
|
+
kind: 'deny',
|
|
54
179
|
reason: `tx denied — value ${tx.value} wei exceeds max_value_wei ${policy.maxValueWei}`,
|
|
55
180
|
};
|
|
56
181
|
}
|
|
@@ -58,16 +183,59 @@ function evaluateTransaction(tx, policy) {
|
|
|
58
183
|
const dataHex = typeof tx.data === 'string' ? tx.data : ('0x' + tx.data.toString('hex'));
|
|
59
184
|
if (dataHex.length > 2) {
|
|
60
185
|
if (dataHex.length < 10) {
|
|
61
|
-
return {
|
|
186
|
+
return { kind: 'deny', reason: `tx denied — calldata too short to extract selector` };
|
|
62
187
|
}
|
|
63
188
|
const selector = dataHex.slice(0, 10).toLowerCase();
|
|
64
189
|
if (!policy.allowedSelectors.includes(selector)) {
|
|
65
190
|
return {
|
|
66
|
-
|
|
191
|
+
kind: 'deny',
|
|
67
192
|
reason: `tx denied — selector ${selector} not in allowed_selectors`,
|
|
68
193
|
};
|
|
69
194
|
}
|
|
70
195
|
}
|
|
71
|
-
return
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* If require_confirm_above_wei is set and this tx exceeds it, return a
|
|
200
|
+
* Confirm decision. Otherwise null.
|
|
201
|
+
*
|
|
202
|
+
* The summary is what the human sees on their phone. The destination is
|
|
203
|
+
* shortened so the notification preview isn't dominated by hex.
|
|
204
|
+
*/
|
|
205
|
+
function confirmForTx(tx, policy) {
|
|
206
|
+
if (policy.requireConfirmAboveWei === undefined)
|
|
207
|
+
return null;
|
|
208
|
+
const value = BigInt(tx.value);
|
|
209
|
+
if (value <= policy.requireConfirmAboveWei)
|
|
210
|
+
return null;
|
|
211
|
+
return { kind: 'confirm', summary: txSummary(tx) };
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* One-line description of a tx for the confirm push. A deploy has no
|
|
215
|
+
* destination address, so it shows the initcode size instead — enough for
|
|
216
|
+
* the human to sanity-check against the deploy they actually asked for.
|
|
217
|
+
*/
|
|
218
|
+
function txSummary(tx) {
|
|
219
|
+
const dest = tx.to === null ? `contract creation (${initcodeBytes(tx)}-byte initcode)` : shortAddr(tx.to);
|
|
220
|
+
return `${formatWei(BigInt(tx.value))} ETH → ${dest} on chain ${BigInt(tx.chainId)}`;
|
|
221
|
+
}
|
|
222
|
+
function initcodeBytes(tx) {
|
|
223
|
+
const dataHex = typeof tx.data === 'string' ? tx.data : ('0x' + tx.data.toString('hex'));
|
|
224
|
+
return (dataHex.length - 2) / 2;
|
|
225
|
+
}
|
|
226
|
+
function shortAddr(addr) {
|
|
227
|
+
const a = addr.toLowerCase();
|
|
228
|
+
return a.length === 42 ? `${a.slice(0, 6)}…${a.slice(-4)}` : a;
|
|
229
|
+
}
|
|
230
|
+
function formatWei(v) {
|
|
231
|
+
// Render with up to 6 fractional digits, trimming trailing zeros. The push
|
|
232
|
+
// notification is a glance, not a settlement statement.
|
|
233
|
+
const WEI_PER_ETH = 1000000000000000000n;
|
|
234
|
+
const whole = v / WEI_PER_ETH;
|
|
235
|
+
const frac = v % WEI_PER_ETH;
|
|
236
|
+
if (frac === 0n)
|
|
237
|
+
return whole.toString();
|
|
238
|
+
const fracStr = frac.toString().padStart(18, '0').slice(0, 6).replace(/0+$/, '');
|
|
239
|
+
return fracStr === '' ? whole.toString() : `${whole}.${fracStr}`;
|
|
72
240
|
}
|
|
73
241
|
//# sourceMappingURL=evaluate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate.js","sourceRoot":"","sources":["../../../src/policy/evaluate.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"evaluate.js","sourceRoot":"","sources":["../../../src/policy/evaluate.ts"],"names":[],"mappings":"AA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S,SAAS,CAAC,IAAY;IAC7B,MAAM,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAC7B,OAAO,CAAC,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACjE,CAAC;AAED,SAAS,SAAS,CAAC,CAAS;IAC1B,2EAA2E;IAC3E,wDAAwD;IACxD,MAAM,WAAW,GAAG,oBAA0B,CAAC;IAC/C,MAAM,KAAK,GAAG,CAAC,GAAG,WAAW,CAAC;IAC9B,MAAM,IAAI,GAAG,CAAC,GAAG,WAAW,CAAC;IAC7B,IAAI,IAAI,KAAK,EAAE;QAAE,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IACzC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACjF,OAAO,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,OAAO,EAAE,CAAC;AACnE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/policy/loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/policy/loader.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,MAAM,EAAmB,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAM/E;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAqIlD;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,IAAI,cAAc,CAezD;AAED;;;;;GAKG;AACH,qBAAa,wBAAyB,YAAW,cAAc;;gBAEjD,SAAS,EAAE,MAAM;IAG7B,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;CAehC"}
|