shinjuku-shielded 0.3.17 → 0.3.18

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/manifest.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "schema": "carbon-shielded-wallet/bundle-manifest/v1",
3
3
  "file": "shinjuku-wallet.mjs",
4
- "sha256": "2ec5cd82c2ae8b9008491d07b5dc4740a5db5904e92814870fd66080aec7fc7b",
5
- "bytes": 11113178,
6
- "sourceCommit": "425179de4d0c1938a030fdfbe6f82e14e1e7a82c",
4
+ "sha256": "6adb44302a8db0b19245a1366e56090c0f0d27c443f37e69c1c2ef97151c9e74",
5
+ "bytes": 11115097,
6
+ "sourceCommit": "2c2f0da6189df2ed67a3ff3ef6639b40e2a8ed47",
7
7
  "sourceDirty": false,
8
8
  "installRecordMatchesLockfile": true,
9
9
  "releaseRule": "valid only when two fresh npm ci --ignore-scripts builds on different OSes give the same sha256; installRecordMatchesLockfile true means every entry npm installed equals its package-lock.json entry and every entry not marked optional, devOptional included, is installed: an optional entry (a package for another platform) may be absent",
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "shinjuku-shielded",
3
- "version": "0.3.17",
3
+ "version": "0.3.18",
4
4
  "mcpName": "io.github.ShinjukuStaition/shinjuku-mcp",
5
5
  "description": "Shinjuku Shielded, the private x402 facilitator on Solana: the self-custody wallet CLI and its MCP server. Shield, pay, and unshield USDC from any MCP agent, under caps you set.",
6
- "shinjukuRelease": "2ec5cd82",
7
- "shinjukuSha256": "2ec5cd82c2ae8b9008491d07b5dc4740a5db5904e92814870fd66080aec7fc7b",
6
+ "shinjukuRelease": "6adb4430",
7
+ "shinjukuSha256": "6adb44302a8db0b19245a1366e56090c0f0d27c443f37e69c1c2ef97151c9e74",
8
8
  "license": "SEE LICENSE IN LICENSE.txt",
9
9
  "author": "Shinjuku Shielded",
10
10
  "homepage": "https://github.com/ShinjukuStaition/shinjuku-mcp#readme",
@@ -68165,7 +68165,7 @@ var init_production_proof_bundle2 = __esm({
68165
68165
  });
68166
68166
 
68167
68167
  // spikes/shielded-x402-wallet/lib/p03-recovered-exit.mjs
68168
- import { spawnSync as spawnSync3 } from "node:child_process";
68168
+ import { spawn as spawn3, spawnSync as spawnSync3 } from "node:child_process";
68169
68169
  import { createHash as createHash16 } from "node:crypto";
68170
68170
  import { dirname as dirname13, isAbsolute as isAbsolute5, join as join11, relative as relative6, resolve as resolve11 } from "node:path";
68171
68171
  import { tmpdir as tmpdir2 } from "node:os";
@@ -68224,24 +68224,76 @@ function manifestTool2(base, value, label) {
68224
68224
  const tool = exactTool2(value, label);
68225
68225
  return Object.freeze({ path: manifestPath2(base, tool.path, true), sha256: tool.sha256 });
68226
68226
  }
68227
+ function childFailure2(status, stderr) {
68228
+ const error = new Error(`p03_recovered_exit_child_failed:${status ?? "signal"}`);
68229
+ Object.defineProperty(error, "childStderr", {
68230
+ value: String(stderr ?? ""),
68231
+ enumerable: false
68232
+ });
68233
+ return error;
68234
+ }
68227
68235
  function run3(command, args, options = {}) {
68228
68236
  const result = spawnSync3(command, args, {
68229
68237
  encoding: "utf8",
68230
- maxBuffer: 128 * 1024 * 1024,
68231
- timeout: 18e5,
68238
+ maxBuffer: CHILD_MAX_BUFFER2,
68239
+ timeout: CHILD_TIMEOUT_MS2,
68232
68240
  windowsHide: true,
68233
68241
  ...options
68234
68242
  });
68235
- if (result.status !== 0) {
68236
- const error = new Error(`p03_recovered_exit_child_failed:${result.status ?? "signal"}`);
68237
- Object.defineProperty(error, "childStderr", {
68238
- value: String(result.stderr ?? ""),
68239
- enumerable: false
68240
- });
68241
- throw error;
68242
- }
68243
+ if (result.status !== 0) throw childFailure2(result.status, result.stderr);
68243
68244
  return result.stdout;
68244
68245
  }
68246
+ function runAsync2(command, args, { input, ...options } = {}) {
68247
+ return new Promise((resolvePromise, reject) => {
68248
+ const out = [];
68249
+ const err = [];
68250
+ let size = 0;
68251
+ let failed = false;
68252
+ let child;
68253
+ try {
68254
+ child = spawn3(command, args, {
68255
+ windowsHide: true,
68256
+ stdio: [input === void 0 ? "ignore" : "pipe", "pipe", "pipe"],
68257
+ ...options
68258
+ });
68259
+ } catch (error) {
68260
+ reject(childFailure2(void 0, error?.message));
68261
+ return;
68262
+ }
68263
+ const timer = setTimeout(() => {
68264
+ failed = true;
68265
+ child.kill("SIGKILL");
68266
+ }, CHILD_TIMEOUT_MS2);
68267
+ const collect = (sink) => (chunk) => {
68268
+ size += chunk.length;
68269
+ if (size > CHILD_MAX_BUFFER2) {
68270
+ failed = true;
68271
+ child.kill("SIGKILL");
68272
+ return;
68273
+ }
68274
+ sink.push(chunk);
68275
+ };
68276
+ child.stdout.on("data", collect(out));
68277
+ child.stderr.on("data", collect(err));
68278
+ let settled = false;
68279
+ const finish = (status, stderr) => {
68280
+ if (settled) return;
68281
+ settled = true;
68282
+ clearTimeout(timer);
68283
+ if (status === 0 && !failed) resolvePromise(Buffer.concat(out).toString("utf8"));
68284
+ else reject(childFailure2(failed ? void 0 : status, stderr ?? Buffer.concat(err).toString("utf8")));
68285
+ };
68286
+ child.on("error", (error) => {
68287
+ if (child.pid === void 0) finish(void 0, error?.message);
68288
+ });
68289
+ child.on("close", (status) => finish(status));
68290
+ if (input !== void 0) {
68291
+ child.stdin.on("error", () => {
68292
+ });
68293
+ child.stdin.end(input);
68294
+ }
68295
+ });
68296
+ }
68245
68297
  function witnessFailureSlug2(error) {
68246
68298
  const prefix = "p03_recovered_exit_witness: ";
68247
68299
  const line = String(error?.childStderr ?? "").split(/\r?\n/, 1)[0];
@@ -68308,12 +68360,12 @@ function ensureExecutable2(path) {
68308
68360
  const mode = statSync(path).mode;
68309
68361
  if ((mode & 73) !== 73) chmodSync(path, mode | 493);
68310
68362
  }
68311
- function runTool2(tool, args, environment = {}, options = {}) {
68363
+ async function runTool2(tool, args, environment = {}, options = {}) {
68312
68364
  if (observedToolSha2562(tool) !== tool.sha256) fail14("tool_hash_mismatch");
68313
68365
  ensureExecutable2(tool.path);
68314
68366
  const wsl = isWslTool2(tool.path);
68315
68367
  if (wsl) {
68316
- return run3("wsl.exe", [
68368
+ return runAsync2("wsl.exe", [
68317
68369
  "-e",
68318
68370
  "env",
68319
68371
  "-i",
@@ -68324,7 +68376,7 @@ function runTool2(tool, args, environment = {}, options = {}) {
68324
68376
  ...args.map((value) => toolPath2(value, true))
68325
68377
  ], options);
68326
68378
  }
68327
- return run3(tool.path, args, {
68379
+ return runAsync2(tool.path, args, {
68328
68380
  ...options,
68329
68381
  env: { ...process.env, LANG: "C", LC_ALL: "C", ...environment }
68330
68382
  });
@@ -68436,6 +68488,9 @@ function proveRecoveredP03Exit({ request, tools }) {
68436
68488
  const primaryProver = tools?.[kind.tool];
68437
68489
  if (!primaryProver) fail14(`${kind.tool}_missing`);
68438
68490
  const bundle = loadBundle2(tools);
68491
+ return proveLoadedExit({ request, tools, kind, primaryProver, bundle });
68492
+ }
68493
+ async function proveLoadedExit({ request, tools, kind, primaryProver, bundle }) {
68439
68494
  const scratch = mkdtempSync(join11(tmpdir2(), kind.scratchPrefix));
68440
68495
  try {
68441
68496
  const vectors = join11(scratch, "vectors");
@@ -68446,7 +68501,7 @@ function proveRecoveredP03Exit({ request, tools }) {
68446
68501
  mkdirSync(appendProofs, { recursive: true, mode: 448 });
68447
68502
  let output2;
68448
68503
  try {
68449
- output2 = JSON.parse(runTool2(
68504
+ output2 = JSON.parse(await runTool2(
68450
68505
  tools.witness,
68451
68506
  ["--write-proof-vectors", vectors],
68452
68507
  {},
@@ -68464,7 +68519,7 @@ function proveRecoveredP03Exit({ request, tools }) {
68464
68519
  join11(vectors, "tree-append-sequence.json")
68465
68520
  );
68466
68521
  try {
68467
- runTool2(primaryProver, [kind.command], {
68522
+ await runTool2(primaryProver, [kind.command], {
68468
68523
  SHIELDED_X402_VECTOR_PATH: primaryVector,
68469
68524
  SHIELDED_X402_PRODUCTION_PROOF_DIR: primaryProofs,
68470
68525
  SHIELDED_X402_PARAMETER_MANIFEST_SHA256: bundle.manifestSha256,
@@ -68474,7 +68529,7 @@ function proveRecoveredP03Exit({ request, tools }) {
68474
68529
  throw new Error("p03_recovered_exit_primary_prover_phase_failed", { cause: error });
68475
68530
  }
68476
68531
  try {
68477
- runTool2(tools.treeAppendProver, ["prove"], {
68532
+ await runTool2(tools.treeAppendProver, ["prove"], {
68478
68533
  SHIELDED_X402_VECTOR_PATH: appendVector,
68479
68534
  SHIELDED_X402_PRODUCTION_PROOF_DIR: appendProofs,
68480
68535
  SHIELDED_X402_PARAMETER_MANIFEST_SHA256: bundle.manifestSha256,
@@ -68501,7 +68556,7 @@ function proveRecoveredP03NoteExit({ request, tools }) {
68501
68556
  if (request?.exitKind !== "NoteExitV1") fail14("request_invalid");
68502
68557
  return proveRecoveredP03Exit({ request, tools });
68503
68558
  }
68504
- var import_web3104, TOOLS_SCHEMA2, REQUEST_SCHEMA2, sha2568, jsonBytes2, TOOLS_KEYS_WITHOUT_WITHDRAW, TOOLS_KEYS_WITH_WITHDRAW, EXIT_KINDS, P03_EXIT_KINDS;
68559
+ var import_web3104, TOOLS_SCHEMA2, REQUEST_SCHEMA2, sha2568, jsonBytes2, CHILD_MAX_BUFFER2, CHILD_TIMEOUT_MS2, TOOLS_KEYS_WITHOUT_WITHDRAW, TOOLS_KEYS_WITH_WITHDRAW, EXIT_KINDS, P03_EXIT_KINDS;
68505
68560
  var init_p03_recovered_exit = __esm({
68506
68561
  "spikes/shielded-x402-wallet/lib/p03-recovered-exit.mjs"() {
68507
68562
  "use strict";
@@ -68515,6 +68570,8 @@ var init_p03_recovered_exit = __esm({
68515
68570
  sha2568 = (value) => createHash16("sha256").update(value).digest("hex");
68516
68571
  jsonBytes2 = (value) => Buffer.from(`${JSON.stringify(value, null, 2)}
68517
68572
  `, "utf8");
68573
+ CHILD_MAX_BUFFER2 = 128 * 1024 * 1024;
68574
+ CHILD_TIMEOUT_MS2 = 18e5;
68518
68575
  TOOLS_KEYS_WITHOUT_WITHDRAW = "bundleDir,deploymentIdentity,manifestSha256,noteExitProver,schema,treeAppendProver,witness";
68519
68576
  TOOLS_KEYS_WITH_WITHDRAW = "bundleDir,deploymentIdentity,manifestSha256,noteExitProver,schema,treeAppendProver,withdrawProver,witness";
68520
68577
  EXIT_KINDS = Object.freeze({
@@ -116824,7 +116881,7 @@ init_walk();
116824
116881
  init_cli();
116825
116882
  import { randomBytes as randomBytes29 } from "node:crypto";
116826
116883
  import { join as join34, resolve as resolve35 } from "node:path";
116827
- import { spawn as spawn5 } from "node:child_process";
116884
+ import { spawn as spawn6 } from "node:child_process";
116828
116885
  import { fileURLToPath as fileURLToPath21 } from "node:url";
116829
116886
 
116830
116887
  // wallet/src/fetch/session.mjs
@@ -128114,7 +128171,7 @@ init_rpcDefault();
128114
128171
  init_store();
128115
128172
  init_incremental();
128116
128173
  init_walletHistory();
128117
- import { spawn as spawn3 } from "node:child_process";
128174
+ import { spawn as spawn4 } from "node:child_process";
128118
128175
  import { randomInt as randomInt5 } from "node:crypto";
128119
128176
  import { resolve as resolve27 } from "node:path";
128120
128177
  var KEEP_WARM_PARENT_ENV = "SHINJUKU_KEEP_WARM_PARENT";
@@ -128168,7 +128225,7 @@ async function keepWarmMain(args, values, { io, env = process.env, entry } = {})
128168
128225
  try {
128169
128226
  while (!stopped) {
128170
128227
  const code = await new Promise((done) => {
128171
- child = spawn3(process.execPath, [...process.execArgv, entry, ...proxy.args, "keep-warm", ...args, "--once"], {
128228
+ child = spawn4(process.execPath, [...process.execArgv, entry, ...proxy.args, "keep-warm", ...args, "--once"], {
128172
128229
  env: proxy.env,
128173
128230
  stdio: ["ignore", "ignore", "inherit"],
128174
128231
  windowsHide: true
@@ -130390,7 +130447,7 @@ init_deposit();
130390
130447
 
130391
130448
  // wallet/src/funds/addFunds.mjs
130392
130449
  init_fs();
130393
- import { spawn as spawn4 } from "node:child_process";
130450
+ import { spawn as spawn5 } from "node:child_process";
130394
130451
  import { randomBytes as randomBytes22, randomInt as randomInt7 } from "node:crypto";
130395
130452
  import { tmpdir as tmpdir4 } from "node:os";
130396
130453
  import { join as join31, resolve as resolve29 } from "node:path";
@@ -130644,7 +130701,7 @@ async function runStep(ctx, argv) {
130644
130701
  const file = join31(ctx.tempDir, `step-${randomBytes22(8).toString("hex")}.json`);
130645
130702
  const held = [];
130646
130703
  let last;
130647
- const proc = spawn4(process.execPath, [...process.execArgv, ctx.entry, ...ctx.proxyArgs, ...argv], {
130704
+ const proc = spawn5(process.execPath, [...process.execArgv, ctx.entry, ...ctx.proxyArgs, ...argv], {
130648
130705
  env: { ...ctx.childEnv, [RESULT_FILE_ENV]: file },
130649
130706
  stdio: ["ignore", "ignore", "pipe"],
130650
130707
  windowsHide: true
@@ -131826,7 +131883,7 @@ function startKeepWarm(options, env = process.env) {
131826
131883
  options.memoServiceUrl,
131827
131884
  ...options.historyRpc ? ["--history-rpc", options.historyRpc] : []
131828
131885
  ];
131829
- const child = spawn5(process.execPath, [...process.execArgv, CLI_FILE, ...proxy.args, ...warmArgs], {
131886
+ const child = spawn6(process.execPath, [...process.execArgv, CLI_FILE, ...proxy.args, ...warmArgs], {
131830
131887
  env: {
131831
131888
  ...proxy.env,
131832
131889
  [PASSPHRASE_ENV2]: options.passphrase,