@senpi/runtime 3.0.223 → 3.0.225

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.
Files changed (98) hide show
  1. package/dist/cli/deploy-render.d.ts +2 -2
  2. package/dist/cli/deploy-render.d.ts.map +1 -1
  3. package/dist/cli/guide-commands.js +2 -2
  4. package/dist/cli/senpi-commands.js +4 -4
  5. package/dist/cli/senpi-commands.js.map +1 -1
  6. package/dist/cli/update-command.js +1 -1
  7. package/dist/deploy/funding.d.ts +4 -4
  8. package/dist/deploy/funding.d.ts.map +1 -1
  9. package/dist/deploy/funding.js +6 -6
  10. package/dist/deploy/funding.js.map +1 -1
  11. package/dist/deploy/job.d.ts +5 -5
  12. package/dist/deploy/job.d.ts.map +1 -1
  13. package/dist/deploy/job.js +23 -23
  14. package/dist/deploy/job.js.map +1 -1
  15. package/dist/deploy/messages.d.ts +16 -16
  16. package/dist/deploy/messages.d.ts.map +1 -1
  17. package/dist/deploy/messages.js +49 -49
  18. package/dist/deploy/messages.js.map +1 -1
  19. package/dist/deploy/orchestrator.d.ts +22 -22
  20. package/dist/deploy/orchestrator.d.ts.map +1 -1
  21. package/dist/deploy/orchestrator.js +65 -65
  22. package/dist/deploy/orchestrator.js.map +1 -1
  23. package/dist/deploy/package.d.ts +11 -11
  24. package/dist/deploy/package.d.ts.map +1 -1
  25. package/dist/deploy/package.js +28 -28
  26. package/dist/deploy/package.js.map +1 -1
  27. package/dist/deploy/register.d.ts +2 -2
  28. package/dist/deploy/register.d.ts.map +1 -1
  29. package/dist/deploy/register.js +29 -29
  30. package/dist/deploy/register.js.map +1 -1
  31. package/dist/deploy/scanner-class.d.ts +1 -1
  32. package/dist/deploy/scanner-class.d.ts.map +1 -1
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +6 -5
  35. package/dist/index.js.map +1 -1
  36. package/dist/runtime/boot-skip.d.ts +3 -3
  37. package/dist/runtime/boot-skip.d.ts.map +1 -1
  38. package/dist/runtime/boot-skip.js +8 -8
  39. package/dist/runtime/boot-skip.js.map +1 -1
  40. package/dist/runtime/lifecycle-reaper.d.ts +4 -4
  41. package/dist/runtime/lifecycle-reaper.js +8 -8
  42. package/dist/runtime/lifecycle-reaper.js.map +1 -1
  43. package/dist/runtime/notifications.d.ts +2 -2
  44. package/dist/runtime/notifications.js +1 -1
  45. package/dist/runtime/runtime.js +3 -3
  46. package/dist/runtime/runtime.js.map +1 -1
  47. package/dist/runtime/strategy-registry.d.ts +1 -1
  48. package/dist/runtime/update-handler.d.ts +9 -9
  49. package/dist/runtime/update-handler.d.ts.map +1 -1
  50. package/dist/runtime/update-handler.js +34 -2
  51. package/dist/runtime/update-handler.js.map +1 -1
  52. package/dist/runtime/update-register.d.ts +1 -1
  53. package/dist/runtime/update-register.d.ts.map +1 -1
  54. package/dist/runtime/update-report.d.ts +2 -2
  55. package/dist/runtime/update-report.d.ts.map +1 -1
  56. package/dist/runtime-api/intake/scanner-launcher.d.ts +1 -1
  57. package/dist/runtime-api/intake/scanner-launcher.js +3 -3
  58. package/dist/runtime-api/intake/scanner-launcher.js.map +1 -1
  59. package/dist/runtime-api/routes/signals.js +1 -1
  60. package/dist/runtime-api/routes/signals.js.map +1 -1
  61. package/dist/senpi/__tests__/helpers/fake-simulation-mcp.d.ts +73 -0
  62. package/dist/senpi/__tests__/helpers/fake-simulation-mcp.d.ts.map +1 -0
  63. package/dist/senpi/__tests__/helpers/{fake-paper-mcp.js → fake-simulation-mcp.js} +30 -30
  64. package/dist/senpi/__tests__/helpers/fake-simulation-mcp.js.map +1 -0
  65. package/dist/senpi/client.d.ts +13 -13
  66. package/dist/senpi/client.d.ts.map +1 -1
  67. package/dist/senpi/client.js +31 -31
  68. package/dist/senpi/client.js.map +1 -1
  69. package/dist/senpi/simulation.d.ts +29 -0
  70. package/dist/senpi/simulation.d.ts.map +1 -0
  71. package/dist/senpi/{paper.js → simulation.js} +18 -18
  72. package/dist/senpi/simulation.js.map +1 -0
  73. package/dist/senpi/strategy-status.js +1 -1
  74. package/dist/senpi/strategy-status.js.map +1 -1
  75. package/dist/senpi/types.d.ts +8 -8
  76. package/dist/senpi/types.d.ts.map +1 -1
  77. package/dist/telemetry/metrics.d.ts +3 -3
  78. package/dist/telemetry/metrics.d.ts.map +1 -1
  79. package/dist/telemetry/metrics.js +3 -3
  80. package/dist/telemetry/metrics.js.map +1 -1
  81. package/dist/telemetry/spans/span-hooks.js +1 -1
  82. package/dist/telemetry/spans/span-hooks.js.map +1 -1
  83. package/dist/telemetry/trace-identity.js +1 -1
  84. package/dist/telemetry/trace-identity.js.map +1 -1
  85. package/dist/utils/event-catalog.d.ts +2 -2
  86. package/dist/utils/event-catalog.d.ts.map +1 -1
  87. package/dist/validate/run.d.ts +2 -0
  88. package/dist/validate/run.d.ts.map +1 -1
  89. package/dist/validate/run.js +5 -2
  90. package/dist/validate/run.js.map +1 -1
  91. package/openclaw.plugin.json +1 -1
  92. package/package.json +1 -1
  93. package/dist/senpi/__tests__/helpers/fake-paper-mcp.d.ts +0 -73
  94. package/dist/senpi/__tests__/helpers/fake-paper-mcp.d.ts.map +0 -1
  95. package/dist/senpi/__tests__/helpers/fake-paper-mcp.js.map +0 -1
  96. package/dist/senpi/paper.d.ts +0 -29
  97. package/dist/senpi/paper.d.ts.map +0 -1
  98. package/dist/senpi/paper.js.map +0 -1
@@ -24,7 +24,7 @@
24
24
  import { readFileSync } from "node:fs";
25
25
  import { join } from "node:path";
26
26
  import { parse as parseYaml } from "yaml";
27
- import { isPaperAddress, isPaperStrategyId, modeOf } from "../senpi/paper.js";
27
+ import { isSimulationAddress, isSimulationStrategyId, modeOf } from "../senpi/simulation.js";
28
28
  import { loadRuntimeConfig } from "../runtime/load-runtime-config.js";
29
29
  import { catalogCopy, strategyFacts } from "../strategy/facts.js";
30
30
  import { buildUniverseNotLiveRefusal, buildUniverseUnavailableDetail, checkPackageUniverse, describeUniverseVerdict, } from "../universe/package-universe.js";
@@ -39,7 +39,7 @@ import { gateInstance } from "./install-gate-runner.js";
39
39
  import { buildInstanceDirCollisionRefusal, buildProofRefusal, checkPackageProof, collidingInstanceDirs, proofRefusalParts, } from "./proof-gate.js";
40
40
  import { readRecord } from "../validate/proof.js";
41
41
  import { BOX_BASE_MEMORY_MB, SCANNER_CLASSES_MB, classesByScanner, createIdempotencyKey, simulationCost, } from "./scanner-class.js";
42
- import { buildAmbiguousRefusal, buildBindingUnknownRefusal, buildBudgetEscape, buildBudgetNotPositiveRefusal, buildBudgetRequiredRefusal, buildCreateAbandonedDetail, buildCreateDeadDetail, buildCreateNameRetryNotIssuedDetail, buildCreateNotDeployableDetail, buildCreatePendingDetail, buildDecisionModelEnvRefusal, buildDecisionModelRefusal, buildForeignPackageRefusal, buildFundedUnreadableNote, buildInstallGateRefusal, buildInstallGateUnavailableDetail, buildInstallIndeterminateDetail, buildInstallInFlightDetail, buildNoDslExitRefusal, buildNonLowercaseIdRefusal, buildNotDeployableRefusal, buildPaperCreateUnsupportedRefusal, buildPaperRoutingUnprovenRefusal, buildPaperCreateWentLiveDetail, buildPartialFundNote, buildRollbackIncomplete, buildScannerEnabledUnsupportedRefusal, buildBoxRuntimeCapRefusal, buildAdoptedOverBoxCapNote, buildBoxMemoryRefusal, buildCostNotTakenNote, buildScannerTooLargeRefusal, buildShareOverrunRefusal, buildSoftBudgetNote, buildStrategyLimitRefusal, limitShort, buildUnboundWalletRefusal, buildUnobservedDetail, buildUnreadableWalletRefusal, buildUnwiredInstallDetail, buildRuntimeIdHeldByOtherWorldDetail, buildRuntimeIdHeldByOtherWorldRefusal, buildWalletWorldMismatchDetail, foreignCollisionClause, forwardTense, fundedClause, itsFunded, matchedByClause, reconcileCanMatchByName, rollbackFundedClause, } from "./messages.js";
42
+ import { buildAmbiguousRefusal, buildBindingUnknownRefusal, buildBudgetEscape, buildBudgetNotPositiveRefusal, buildBudgetRequiredRefusal, buildCreateAbandonedDetail, buildCreateDeadDetail, buildCreateNameRetryNotIssuedDetail, buildCreateNotDeployableDetail, buildCreatePendingDetail, buildDecisionModelEnvRefusal, buildDecisionModelRefusal, buildForeignPackageRefusal, buildFundedUnreadableNote, buildInstallGateRefusal, buildInstallGateUnavailableDetail, buildInstallIndeterminateDetail, buildInstallInFlightDetail, buildNoDslExitRefusal, buildNonLowercaseIdRefusal, buildNotDeployableRefusal, buildSimulationCreateUnsupportedRefusal, buildSimulationRoutingUnprovenRefusal, buildSimulationCreateWentLiveDetail, buildPartialFundNote, buildRollbackIncomplete, buildScannerEnabledUnsupportedRefusal, buildBoxRuntimeCapRefusal, buildAdoptedOverBoxCapNote, buildBoxMemoryRefusal, buildCostNotTakenNote, buildScannerTooLargeRefusal, buildShareOverrunRefusal, buildSoftBudgetNote, buildStrategyLimitRefusal, limitShort, buildUnboundWalletRefusal, buildUnobservedDetail, buildUnreadableWalletRefusal, buildUnwiredInstallDetail, buildRuntimeIdHeldByOtherWorldDetail, buildRuntimeIdHeldByOtherWorldRefusal, buildWalletWorldMismatchDetail, foreignCollisionClause, forwardTense, fundedClause, itsFunded, matchedByClause, reconcileCanMatchByName, rollbackFundedClause, } from "./messages.js";
43
43
  /** Stands in for the wallet when rendering a recipe only to read its facts, which never include it. */
44
44
  const FACTS_STAND_IN_WALLET = "0x0000000000000000000000000000000000000000";
45
45
  const CREATE_POLL_MS = 10_000;
@@ -327,7 +327,7 @@ function buildStrandedCloseCaveat(pkg, runs, stranded) {
327
327
  return (`. Nothing else in this package is live, so \`${closeCommand(pkg)}\` is equivalent and ` +
328
328
  `safe here.`);
329
329
  }
330
- return (`. Do NOT reach for \`close.py '${pkg.id}'${pkg.paper ? " --paper" : ""}\` to do it: ${otherLive.length} other sleeve(s) ` +
330
+ return (`. Do NOT reach for \`close.py '${pkg.id}'${pkg.simulation ? " --simulation" : ""}\` to do it: ${otherLive.length} other sleeve(s) ` +
331
331
  `(${otherLive.map((run) => run.inst.name).join(", ")}) hold live funded wallets and that ` +
332
332
  `command would close them too. Read them first if you need context: ` +
333
333
  `\`${statusCommand(pkg)}\`.`);
@@ -408,7 +408,7 @@ function buildNext(overall, pkg, budget, runs) {
408
408
  return `re-run \`${resumeCommand(pkg, budget)}\` to resume — reconcile re-reads the live list before it creates anything, and what it finds there decides the rest`;
409
409
  case "failed":
410
410
  if (runs.some((run) => run.report.steps.create.evidence?.wentLive === true)) {
411
- return (`Read the [E_PAPER_CREATE_WENT_LIVE] step above and follow it. This report offers no re-run: ` +
411
+ return (`Read the [E_SIMULATION_CREATE_WENT_LIVE] step above and follow it. This report offers no re-run: ` +
412
412
  `the MCP turned a simulation into a live strategy, and a re-run can do the same.`);
413
413
  }
414
414
  // "Fix the cause, then re-run" is false for exactly one failure on this verb: an install this
@@ -552,16 +552,16 @@ function newInstanceRun(pkg, inst) {
552
552
  };
553
553
  }
554
554
  /**
555
- * Whether a registry row belongs to the other world from a deploy of `paper`. The one predicate the
555
+ * Whether a registry row belongs to the other world from a deploy of `simulation`. The one predicate the
556
556
  * preflight and the install step share, so they can never disagree about a collision.
557
557
  *
558
- * A row with no wallet is a LIVE runtime: every runtime a paper deploy installs records its wallet,
558
+ * A row with no wallet is a LIVE runtime: every runtime a simulation deploy installs records its wallet,
559
559
  * and a row without one is a legacy row whose runtime boots on the wallet in its YAML — possibly a
560
- * live strategy's only exit and stop protection. A paper deploy is refused on it; a live deploy
561
- * treats it as its own and may replace it, as before paper.
560
+ * live strategy's only exit and stop protection. A simulation deploy is refused on it; a live deploy
561
+ * treats it as its own and may replace it, as before simulation.
562
562
  */
563
- export function registryRowIsOtherWorld(row, paper) {
564
- return row.wallet ? isPaperAddress(row.wallet) !== paper : paper;
563
+ export function registryRowIsOtherWorld(row, simulation) {
564
+ return row.wallet ? isSimulationAddress(row.wallet) !== simulation : simulation;
565
565
  }
566
566
  /**
567
567
  * Sequential orchestration of one deploy. Resolves with a report in every case —
@@ -575,7 +575,7 @@ export async function runDeploy(params, deps) {
575
575
  const runs = pkg.instances.map((inst) => newInstanceRun(pkg, inst));
576
576
  let refused = false;
577
577
  let abandoned = false;
578
- /** A paper create came back live: the run stops where it is (see `stopOnLiveCreate`). */
578
+ /** A simulation create came back live: the run stops where it is (see `stopOnLiveCreate`). */
579
579
  let wentLive = false;
580
580
  let summariesOnce = null;
581
581
  /**
@@ -767,7 +767,7 @@ export async function runDeploy(params, deps) {
767
767
  }
768
768
  }
769
769
  };
770
- const span = (name, attrs, body) => spanOnce(deps.span, log, name, { ...attrs, "senpi.strategy.mode": modeOf(pkg.paper) }, body);
770
+ const span = (name, attrs, body) => spanOnce(deps.span, log, name, { ...attrs, "senpi.strategy.mode": modeOf(pkg.simulation) }, body);
771
771
  /**
772
772
  * The step boundary: the only place a pending deadline stop is honored — plus one deliberate
773
773
  * mid-step boundary, ahead of the create phase's unnamed retry, which is the single money-moving
@@ -798,7 +798,7 @@ export async function runDeploy(params, deps) {
798
798
  */
799
799
  const loadSummaries = async () => {
800
800
  if (summariesOnce === null)
801
- summariesOnce = await deps.listStrategies({ paper: pkg.paper });
801
+ summariesOnce = await deps.listStrategies({ simulation: pkg.simulation });
802
802
  return summariesOnce;
803
803
  };
804
804
  /**
@@ -1011,7 +1011,7 @@ export async function runDeploy(params, deps) {
1011
1011
  return "refused";
1012
1012
  });
1013
1013
  }
1014
- if (pkg.paper && !halted()) {
1014
+ if (pkg.simulation && !halted()) {
1015
1015
  await span("deploy.measure", { "senpi.deploy.step": "measure" }, async () => {
1016
1016
  for (const inst of pkg.instances) {
1017
1017
  if (boundaryAbandoned())
@@ -1029,7 +1029,7 @@ export async function runDeploy(params, deps) {
1029
1029
  return "ok";
1030
1030
  });
1031
1031
  }
1032
- if (pkg.paper && !halted()) {
1032
+ if (pkg.simulation && !halted()) {
1033
1033
  const tooLarge = [];
1034
1034
  for (const inst of pkg.instances) {
1035
1035
  const result = simulationCost(readRecord(inst.runtimeYamlDir)?.observations ?? [], scannerIntervals(inst), params.raisedClasses ?? {});
@@ -1232,9 +1232,9 @@ export async function runDeploy(params, deps) {
1232
1232
  // the name match above can never find it again and a re-run would fund a SECOND wallet beside
1233
1233
  // it. The journal supplies the strategyId it recorded at create time; the BACKEND decides
1234
1234
  // whether that id still means anything — a dead key falls straight through to a fresh create.
1235
- const priorIds = (params.priorStrategyIds?.get(run.inst.name) ?? []).filter((id) => isPaperStrategyId(id) === pkg.paper);
1235
+ const priorIds = (params.priorStrategyIds?.get(run.inst.name) ?? []).filter((id) => isSimulationStrategyId(id) === pkg.simulation);
1236
1236
  if (priorIds.length > 0) {
1237
- const verified = (await deps.listStrategies({ paper: pkg.paper, strategyIds: priorIds })).filter((s) => !DEAD_STATUSES.includes(s.status.toUpperCase()));
1237
+ const verified = (await deps.listStrategies({ simulation: pkg.simulation, strategyIds: priorIds })).filter((s) => !DEAD_STATUSES.includes(s.status.toUpperCase()));
1238
1238
  if (verified.length > 0) {
1239
1239
  applyCandidates(run, verified, "created-key");
1240
1240
  return;
@@ -1478,7 +1478,7 @@ export async function runDeploy(params, deps) {
1478
1478
  if (await refusedOnStrategyLimits())
1479
1479
  return;
1480
1480
  let available = null;
1481
- if (!pkg.paper) {
1481
+ if (!pkg.simulation) {
1482
1482
  try {
1483
1483
  available = accessibleUsd(await deps.getPortfolio());
1484
1484
  }
@@ -1514,9 +1514,9 @@ export async function runDeploy(params, deps) {
1514
1514
  }
1515
1515
  if (await refusedOnBoxRuntimeCap())
1516
1516
  return;
1517
- if (pkg.paper && (await refusedOnBoxMemory()))
1517
+ if (pkg.simulation && (await refusedOnBoxMemory()))
1518
1518
  return;
1519
- if (!(await paperRoutingProven()))
1519
+ if (!(await simulationRoutingProven()))
1520
1520
  return;
1521
1521
  const plan = planFunding(needing.map((run) => ({ name: run.inst.name, fundingShare: run.inst.fundingShare })), budget, available);
1522
1522
  if (plan.shortfall) {
@@ -1538,7 +1538,7 @@ export async function runDeploy(params, deps) {
1538
1538
  run.fundAmount = plan.amounts.get(run.inst.name);
1539
1539
  record(run, "preflight", {
1540
1540
  status: "ok",
1541
- detail: pkg.paper
1541
+ detail: pkg.simulation
1542
1542
  ? `will fund the simulation with ${usd(run.fundAmount ?? 0)} of virtual money — no real balance is read or moved`
1543
1543
  : available === null
1544
1544
  ? `will fund ${usd(run.fundAmount ?? 0)} — accessible balance unreadable, proceeding (the backend is the funding authority)`
@@ -1550,7 +1550,7 @@ export async function runDeploy(params, deps) {
1550
1550
  /**
1551
1551
  * Refuses the whole package, before any create, funding or probe, when a runtime id this run
1552
1552
  * would install is already held by a runtime from the OTHER world (a live instance named
1553
- * `main-paper` and the simulation of instance `main` derive the same id).
1553
+ * `main-simulation` and the simulation of instance `main` derive the same id).
1554
1554
  *
1555
1555
  * The install step refuses the same collision, but it runs after create and funding, so reaching
1556
1556
  * it means a funded strategy to roll back — and with an adopted wallet, one left without a
@@ -1561,7 +1561,7 @@ export async function runDeploy(params, deps) {
1561
1561
  for (const run of installing) {
1562
1562
  const runtimeId = runtimeIdFor(pkg, run.inst);
1563
1563
  const row = await deps.registryFindById(runtimeId);
1564
- if (row && registryRowIsOtherWorld(row, pkg.paper)) {
1564
+ if (row && registryRowIsOtherWorld(row, pkg.simulation)) {
1565
1565
  collisions.push({ instance: run.inst.name, runtimeId, ...(row.wallet ? { heldOn: row.wallet } : {}) });
1566
1566
  }
1567
1567
  }
@@ -1572,8 +1572,8 @@ export async function runDeploy(params, deps) {
1572
1572
  // An adopted wallet or a strategy still reaching ACTIVE exists already; only a run that
1573
1573
  // needed a new wallet can truthfully say nothing was created.
1574
1574
  const exists = !run.needsWallet && (Boolean(run.report.wallet) || run.awaitingActive !== undefined);
1575
- const detail = buildRuntimeIdHeldByOtherWorldRefusal(collisions, pkg.paper, exists ? { statusCommand: statusCommand(pkg) } : undefined);
1576
- record(run, "preflight", { status: "refused", detail, evidence: { paper: pkg.paper, collisions } });
1575
+ const detail = buildRuntimeIdHeldByOtherWorldRefusal(collisions, pkg.simulation, exists ? { statusCommand: statusCommand(pkg) } : undefined);
1576
+ record(run, "preflight", { status: "refused", detail, evidence: { simulation: pkg.simulation, collisions } });
1577
1577
  }
1578
1578
  return true;
1579
1579
  }
@@ -1594,7 +1594,7 @@ export async function runDeploy(params, deps) {
1594
1594
  const after = box.running - replaced.length + needed;
1595
1595
  if (needed === 0 || after <= box.cap) {
1596
1596
  if (after + adopted.length > box.cap) {
1597
- boxCapNote = buildAdoptedOverBoxCapNote(adopted, after + adopted.length, box.cap, pkg.paper);
1597
+ boxCapNote = buildAdoptedOverBoxCapNote(adopted, after + adopted.length, box.cap, pkg.simulation);
1598
1598
  log(`deploy: ${boxCapNote}`);
1599
1599
  }
1600
1600
  return false;
@@ -1673,7 +1673,7 @@ export async function runDeploy(params, deps) {
1673
1673
  if (wallet && (await deps.registryFindByWallet(wallet)))
1674
1674
  continue;
1675
1675
  const row = await deps.registryFindById(runtimeIdFor(pkg, run.inst));
1676
- if (row && !registryRowIsOtherWorld(row, pkg.paper))
1676
+ if (row && !registryRowIsOtherWorld(row, pkg.simulation))
1677
1677
  continue;
1678
1678
  names.push(run.inst.name);
1679
1679
  }
@@ -1689,7 +1689,7 @@ export async function runDeploy(params, deps) {
1689
1689
  for (const run of needing) {
1690
1690
  const id = runtimeIdFor(pkg, run.inst);
1691
1691
  const row = await deps.registryFindById(id);
1692
- if (row && !registryRowIsOtherWorld(row, pkg.paper))
1692
+ if (row && !registryRowIsOtherWorld(row, pkg.simulation))
1693
1693
  replaced.push(id);
1694
1694
  }
1695
1695
  return replaced;
@@ -1763,7 +1763,7 @@ export async function runDeploy(params, deps) {
1763
1763
  break;
1764
1764
  // The per-create probe goes BEFORE the boundary, so no MCP call sits between the boundary
1765
1765
  // and the create: a deadline that passes during the probe is honored by the check below.
1766
- if (run.needsWallet && !(await paperRoutingStillProven(run)))
1766
+ if (run.needsWallet && !(await simulationRoutingStillProven(run)))
1767
1767
  break;
1768
1768
  if (boundaryAbandoned())
1769
1769
  break;
@@ -1813,10 +1813,10 @@ export async function runDeploy(params, deps) {
1813
1813
  skillName: pkg.id,
1814
1814
  skillVersion: pkg.version,
1815
1815
  ...(await describeInstance(run.inst)),
1816
- ...(pkg.paper ? { paper: true } : {}),
1816
+ ...(pkg.simulation ? { simulation: true } : {}),
1817
1817
  };
1818
1818
  const cost = costs.get(run.inst.name);
1819
- const sizing = (attempt) => pkg.paper
1819
+ const sizing = (attempt) => pkg.simulation
1820
1820
  ? {
1821
1821
  ...(cost ? { cost } : {}),
1822
1822
  ...(params.createKeySeed !== undefined
@@ -1827,9 +1827,9 @@ export async function runDeploy(params, deps) {
1827
1827
  let result = await callCreate({ initialBudget, strategyName: run.strategyName, ...attribution, ...sizing() });
1828
1828
  // Ahead of the name check: the MCP's unknown-tool message says "the same tool name", which
1829
1829
  // `isNameRejection` would read as a rejected name and retry.
1830
- if (pkg.paper && result.unknownTool) {
1831
- refuseCreatesFrom(run, buildPaperCreateUnsupportedRefusal(result.message ?? "", createdEarlier()), {
1832
- tool: "strategy_create_paper_strategy",
1830
+ if (pkg.simulation && result.unknownTool) {
1831
+ refuseCreatesFrom(run, buildSimulationCreateUnsupportedRefusal(result.message ?? "", createdEarlier()), {
1832
+ tool: "strategy_create_simulation_strategy",
1833
1833
  errorCode: result.errorCode,
1834
1834
  reason: result.message,
1835
1835
  });
@@ -1841,7 +1841,7 @@ export async function runDeploy(params, deps) {
1841
1841
  let nameFallbackFired = false;
1842
1842
  if (!result.success && isNameRejection(result)) {
1843
1843
  // The retry is a create too: probe in front of it, ahead of its boundary, like every create.
1844
- if (!(await paperRoutingStillProven(run)))
1844
+ if (!(await simulationRoutingStillProven(run)))
1845
1845
  return undefined;
1846
1846
  // The ONE money-moving call in this file with no step boundary ahead of it — every other one
1847
1847
  // is preceded by `boundaryAbandoned()`. It needs its own, because `callCreate` mints a FRESH
@@ -1910,7 +1910,7 @@ export async function runDeploy(params, deps) {
1910
1910
  costNotTaken.push(run.inst.name);
1911
1911
  log(`deploy: the MCP took ${run.inst.name}'s create without the simulation's cost`);
1912
1912
  }
1913
- if (pkg.paper && !isPaperStrategyId(result.strategyId)) {
1913
+ if (pkg.simulation && !isSimulationStrategyId(result.strategyId)) {
1914
1914
  await stopOnLiveCreate(run, result.strategyId);
1915
1915
  return undefined;
1916
1916
  }
@@ -1933,22 +1933,22 @@ export async function runDeploy(params, deps) {
1933
1933
  return result.strategyId;
1934
1934
  }
1935
1935
  /**
1936
- * Invariant 4: a paper create goes out only after the probe proves the MCP routes paper calls, so
1936
+ * Invariant 4: a simulation create goes out only after the probe proves the MCP routes simulation calls, so
1937
1937
  * a missing marker refuses before any create. Live deploys never probe.
1938
1938
  *
1939
1939
  * This is the preflight probe: it refuses the package before anything is created. Each create
1940
- * then probes again ({@link paperRoutingStillProven}), because the MCP behind one deploy can
1940
+ * then probes again ({@link simulationRoutingStillProven}), because the MCP behind one deploy can
1941
1941
  * change (a downgrade, or replicas on different versions) between the preflight and a create.
1942
1942
  * Neither probe sits between a `shouldAbandon()` boundary and a create.
1943
1943
  */
1944
- async function paperRoutingProven() {
1945
- if (!pkg.paper)
1944
+ async function simulationRoutingProven() {
1945
+ if (!pkg.simulation)
1946
1946
  return true;
1947
- const probe = await deps.probePaperRouting();
1947
+ const probe = await deps.probeSimulationRouting();
1948
1948
  if (probe.routed)
1949
1949
  return true;
1950
1950
  refused = true;
1951
- const detail = buildPaperRoutingUnprovenRefusal(probe.reason);
1951
+ const detail = buildSimulationRoutingUnprovenRefusal(probe.reason);
1952
1952
  for (const run of needing) {
1953
1953
  record(run, "preflight", {
1954
1954
  status: "refused",
@@ -1962,13 +1962,13 @@ export async function runDeploy(params, deps) {
1962
1962
  * The per-create probe. On a lost router it refuses this create and every create still ahead,
1963
1963
  * and halts the run; wallets already created stay and a re-run adopts them.
1964
1964
  */
1965
- async function paperRoutingStillProven(run) {
1966
- if (!pkg.paper)
1965
+ async function simulationRoutingStillProven(run) {
1966
+ if (!pkg.simulation)
1967
1967
  return true;
1968
- const probe = await deps.probePaperRouting();
1968
+ const probe = await deps.probeSimulationRouting();
1969
1969
  if (probe.routed)
1970
1970
  return true;
1971
- refuseCreatesFrom(run, buildPaperRoutingUnprovenRefusal(probe.reason, createdEarlier()), {
1971
+ refuseCreatesFrom(run, buildSimulationRoutingUnprovenRefusal(probe.reason, createdEarlier()), {
1972
1972
  probe: "strategy_list",
1973
1973
  reason: probe.reason,
1974
1974
  });
@@ -1988,30 +1988,30 @@ export async function runDeploy(params, deps) {
1988
1988
  }
1989
1989
  }
1990
1990
  /**
1991
- * A paper create returned a LIVE strategy id: the MCP created a funded live strategy. Nothing else
1991
+ * A simulation create returned a LIVE strategy id: the MCP created a funded live strategy. Nothing else
1992
1992
  * is created and the run stops. The MCP closes only an ACTIVE or PAUSED
1993
1993
  * strategy, so the job waits for one of those on the ACTIVE poll's budget, closes it by id and
1994
1994
  * reads it back CLOSED, before any install. The step fails with where that left it.
1995
1995
  *
1996
1996
  * The id is journaled before the wait. A process that dies during it leaves no other record of
1997
- * the strategy, and paper recovery reads only the paper world.
1997
+ * the strategy, and simulation recovery reads only the simulation world.
1998
1998
  */
1999
1999
  async function stopOnLiveCreate(run, strategyId) {
2000
2000
  wentLive = true;
2001
2001
  emit({
2002
2002
  type: "job",
2003
2003
  phase: "create",
2004
- detail: `paper create for instance "${run.inst.name}" returned LIVE strategy ${strategyId}; closing it by its id`,
2004
+ detail: `simulation create for instance "${run.inst.name}" returned LIVE strategy ${strategyId}; closing it by its id`,
2005
2005
  evidence: { instance: run.inst.name, world: "live", unexpectedStrategyId: strategyId },
2006
2006
  });
2007
- log(`deploy: paper create for "${run.inst.name}" returned live strategy ${strategyId} — closing it`);
2007
+ log(`deploy: simulation create for "${run.inst.name}" returned live strategy ${strategyId} — closing it`);
2008
2008
  const cleanup = await closeLiveCreate(strategyId);
2009
2009
  record(run, "create", {
2010
2010
  status: "failed",
2011
- detail: buildPaperCreateWentLiveDetail(strategyId, cleanup),
2011
+ detail: buildSimulationCreateWentLiveDetail(strategyId, cleanup),
2012
2012
  evidence: {
2013
2013
  strategyId,
2014
- paper: true,
2014
+ simulation: true,
2015
2015
  wentLive: true,
2016
2016
  closed: cleanup.kind === "closed",
2017
2017
  cleanup: cleanup.kind,
@@ -2022,7 +2022,7 @@ export async function runDeploy(params, deps) {
2022
2022
  }
2023
2023
  async function closeLiveCreate(strategyId) {
2024
2024
  const status = await pollStatus(strategyId, {
2025
- paper: false,
2025
+ simulation: false,
2026
2026
  budgetMs: maxWaitSec * 1000,
2027
2027
  settled: (read) => !isInitializing(read),
2028
2028
  });
@@ -2086,7 +2086,7 @@ export async function runDeploy(params, deps) {
2086
2086
  async function pollUntilActive(run, strategyId) {
2087
2087
  const deadline = deps.now() + maxWaitSec * 1000;
2088
2088
  for (;;) {
2089
- const [live] = await deps.listStrategies({ paper: pkg.paper, strategyIds: [strategyId] });
2089
+ const [live] = await deps.listStrategies({ simulation: pkg.simulation, strategyIds: [strategyId] });
2090
2090
  if (live && live.status.toUpperCase() === "ACTIVE" && live.strategyWalletAddress) {
2091
2091
  run.report.wallet = live.strategyWalletAddress;
2092
2092
  run.report.funded = live.totalFunded;
@@ -2194,11 +2194,11 @@ export async function runDeploy(params, deps) {
2194
2194
  async function installInstance(run) {
2195
2195
  const wallet = run.report.wallet;
2196
2196
  const runtimeId = runtimeIdFor(pkg, run.inst);
2197
- if (isPaperAddress(wallet) !== pkg.paper) {
2197
+ if (isSimulationAddress(wallet) !== pkg.simulation) {
2198
2198
  record(run, "install", {
2199
2199
  status: "failed",
2200
- detail: buildWalletWorldMismatchDetail(wallet, pkg.paper),
2201
- evidence: { wallet, paper: pkg.paper, paperAddress: isPaperAddress(wallet) },
2200
+ detail: buildWalletWorldMismatchDetail(wallet, pkg.simulation),
2201
+ evidence: { wallet, simulation: pkg.simulation, simulationAddress: isSimulationAddress(wallet) },
2202
2202
  });
2203
2203
  if (run.needsWallet)
2204
2204
  await rollbackWallet(run);
@@ -2249,12 +2249,12 @@ export async function runDeploy(params, deps) {
2249
2249
  // recreated on the fresh wallet rather than left pointing at stale money.
2250
2250
  let replaced = replacedDeadRow;
2251
2251
  const byId = await deps.registryFindById(runtimeId);
2252
- if (byId && registryRowIsOtherWorld(byId, pkg.paper)) {
2252
+ if (byId && registryRowIsOtherWorld(byId, pkg.simulation)) {
2253
2253
  // Never replace a runtime from the other world: it watches a wallet this deploy has no claim on.
2254
2254
  record(run, "install", {
2255
2255
  status: "failed",
2256
- detail: `${replaced}${buildRuntimeIdHeldByOtherWorldDetail(runtimeId, byId.wallet, pkg.paper)}`,
2257
- evidence: { id: runtimeId, heldOn: byId.wallet, paper: pkg.paper },
2256
+ detail: `${replaced}${buildRuntimeIdHeldByOtherWorldDetail(runtimeId, byId.wallet, pkg.simulation)}`,
2257
+ evidence: { id: runtimeId, heldOn: byId.wallet, simulation: pkg.simulation },
2258
2258
  });
2259
2259
  if (run.needsWallet)
2260
2260
  await rollbackWallet(run);
@@ -2417,7 +2417,7 @@ export async function runDeploy(params, deps) {
2417
2417
  if (close && !close.success)
2418
2418
  return incomplete({ kind: "live", reason: closeRefusalReason(close) });
2419
2419
  strategyId ??= close?.strategyId;
2420
- const outcome = closeReadOutcome(isClosed(close?.status) ? close?.status : await pollWhileClosing(strategyId, close?.status, pkg.paper), closeError);
2420
+ const outcome = closeReadOutcome(isClosed(close?.status) ? close?.status : await pollWhileClosing(strategyId, close?.status, pkg.simulation), closeError);
2421
2421
  if (outcome !== "closed")
2422
2422
  return incomplete(outcome);
2423
2423
  // The structured facts the report leads with must agree with the step detail: this wallet is
@@ -2443,18 +2443,18 @@ export async function runDeploy(params, deps) {
2443
2443
  * or the other, so it ends the wait at once. Resolves with the last status known: the close's own
2444
2444
  * answer until a read replaces it.
2445
2445
  */
2446
- async function pollWhileClosing(strategyId, status, paper) {
2446
+ async function pollWhileClosing(strategyId, status, simulation) {
2447
2447
  if (strategyId === undefined)
2448
2448
  return status;
2449
2449
  return pollStatus(strategyId, {
2450
- paper,
2450
+ simulation,
2451
2451
  budgetMs: CLOSE_POLL_BUDGET_MS,
2452
2452
  status,
2453
2453
  settled: (read) => classifyCloseRead(read) !== "closing",
2454
2454
  });
2455
2455
  }
2456
2456
  /**
2457
- * Read one strategy's status in `paper`'s world until `settled` holds, within `budgetMs` and the
2457
+ * Read one strategy's status in `simulation`'s world until `settled` holds, within `budgetMs` and the
2458
2458
  * job's deadline, at {@link CREATE_POLL_MS}. A read that throws or finds no row leaves the status
2459
2459
  * as it was. Resolves with the last status known, starting from `status`.
2460
2460
  */
@@ -2467,7 +2467,7 @@ export async function runDeploy(params, deps) {
2467
2467
  if (deps.shouldAbandon())
2468
2468
  return status;
2469
2469
  try {
2470
- const [live] = await deps.listStrategies({ paper: poll.paper, strategyIds: [strategyId] });
2470
+ const [live] = await deps.listStrategies({ simulation: poll.simulation, strategyIds: [strategyId] });
2471
2471
  if (live?.status)
2472
2472
  status = live.status;
2473
2473
  }