@senpi-ai/runtime 3.0.176 → 3.0.178

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 (101) hide show
  1. package/dist/actions/close-position/close-position.action.d.ts.map +1 -1
  2. package/dist/actions/close-position/close-position.action.js +48 -3
  3. package/dist/actions/close-position/close-position.action.js.map +1 -1
  4. package/dist/actions/open-position/open-position.action.d.ts.map +1 -1
  5. package/dist/actions/open-position/open-position.action.js +42 -6
  6. package/dist/actions/open-position/open-position.action.js.map +1 -1
  7. package/dist/actions/open-position/resolve-margin.d.ts +1 -1
  8. package/dist/actions/open-position/resolve-margin.d.ts.map +1 -1
  9. package/dist/actions/open-position/resolve-margin.js +7 -0
  10. package/dist/actions/open-position/resolve-margin.js.map +1 -1
  11. package/dist/cli/guide-commands.d.ts.map +1 -1
  12. package/dist/cli/guide-commands.js +7 -3
  13. package/dist/cli/guide-commands.js.map +1 -1
  14. package/dist/cli/senpi-commands.d.ts.map +1 -1
  15. package/dist/cli/senpi-commands.js +20 -8
  16. package/dist/cli/senpi-commands.js.map +1 -1
  17. package/dist/dsl/engine/exchange-stop.d.ts +21 -1
  18. package/dist/dsl/engine/exchange-stop.d.ts.map +1 -1
  19. package/dist/dsl/engine/exchange-stop.js +27 -1
  20. package/dist/dsl/engine/exchange-stop.js.map +1 -1
  21. package/dist/dsl/engine/index.d.ts +1 -1
  22. package/dist/dsl/engine/index.d.ts.map +1 -1
  23. package/dist/dsl/engine/index.js +1 -1
  24. package/dist/dsl/engine/index.js.map +1 -1
  25. package/dist/dsl/events/handlers.d.ts +7 -3
  26. package/dist/dsl/events/handlers.d.ts.map +1 -1
  27. package/dist/dsl/events/handlers.js +10 -4
  28. package/dist/dsl/events/handlers.js.map +1 -1
  29. package/dist/dsl/monitor/exchange-sync.d.ts +1 -0
  30. package/dist/dsl/monitor/exchange-sync.d.ts.map +1 -1
  31. package/dist/dsl/monitor/exchange-sync.js +7 -14
  32. package/dist/dsl/monitor/exchange-sync.js.map +1 -1
  33. package/dist/dsl/monitor/process-one-position.d.ts.map +1 -1
  34. package/dist/dsl/monitor/process-one-position.js +34 -3
  35. package/dist/dsl/monitor/process-one-position.js.map +1 -1
  36. package/dist/dsl/notifications/formatter.d.ts +2 -1
  37. package/dist/dsl/notifications/formatter.d.ts.map +1 -1
  38. package/dist/dsl/notifications/formatter.js +18 -1
  39. package/dist/dsl/notifications/formatter.js.map +1 -1
  40. package/dist/health/types.d.ts +6 -1
  41. package/dist/health/types.d.ts.map +1 -1
  42. package/dist/health/types.js.map +1 -1
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +98 -26
  45. package/dist/index.js.map +1 -1
  46. package/dist/leverage/max-leverage-cache.d.ts +25 -0
  47. package/dist/leverage/max-leverage-cache.d.ts.map +1 -1
  48. package/dist/leverage/max-leverage-cache.js +77 -0
  49. package/dist/leverage/max-leverage-cache.js.map +1 -1
  50. package/dist/runtime/create-scanner-module.d.ts +1 -1
  51. package/dist/runtime/create-scanner-module.d.ts.map +1 -1
  52. package/dist/runtime/create-scanner-module.js +2 -1
  53. package/dist/runtime/create-scanner-module.js.map +1 -1
  54. package/dist/runtime/runtime.d.ts.map +1 -1
  55. package/dist/runtime/runtime.js +4 -3
  56. package/dist/runtime/runtime.js.map +1 -1
  57. package/dist/runtime/supervisor/long-running-supervisor.js +1 -1
  58. package/dist/runtime/supervisor/long-running-supervisor.js.map +1 -1
  59. package/dist/runtime-api/intake/acceptance-record.d.ts +17 -3
  60. package/dist/runtime-api/intake/acceptance-record.d.ts.map +1 -1
  61. package/dist/runtime-api/intake/acceptance-record.js +57 -32
  62. package/dist/runtime-api/intake/acceptance-record.js.map +1 -1
  63. package/dist/runtime-api/intake/intake-events.d.ts +6 -5
  64. package/dist/runtime-api/intake/intake-events.d.ts.map +1 -1
  65. package/dist/runtime-api/intake/intake-events.js +9 -3
  66. package/dist/runtime-api/intake/intake-events.js.map +1 -1
  67. package/dist/runtime-api/intake/process-signal-post.d.ts +1 -1
  68. package/dist/runtime-api/intake/process-signal-post.d.ts.map +1 -1
  69. package/dist/runtime-api/intake/process-signal-post.js +34 -31
  70. package/dist/runtime-api/intake/process-signal-post.js.map +1 -1
  71. package/dist/runtime-api/intake/scaffold-error-router.d.ts +8 -0
  72. package/dist/runtime-api/intake/scaffold-error-router.d.ts.map +1 -1
  73. package/dist/runtime-api/intake/scaffold-error-router.js +9 -0
  74. package/dist/runtime-api/intake/scaffold-error-router.js.map +1 -1
  75. package/dist/runtime-api/intake/types.d.ts +9 -0
  76. package/dist/runtime-api/intake/types.d.ts.map +1 -1
  77. package/dist/runtime-api/intake/types.js +5 -1
  78. package/dist/runtime-api/intake/types.js.map +1 -1
  79. package/dist/scanners/engine/data-providers.d.ts +6 -0
  80. package/dist/scanners/engine/data-providers.d.ts.map +1 -1
  81. package/dist/scanners/engine/data-providers.js.map +1 -1
  82. package/dist/scanners/engine/engine.d.ts +9 -0
  83. package/dist/scanners/engine/engine.d.ts.map +1 -1
  84. package/dist/scanners/engine/engine.js +29 -6
  85. package/dist/scanners/engine/engine.js.map +1 -1
  86. package/dist/scanners/external/scaffold/delivery.py +85 -25
  87. package/dist/scanners/external/scaffold/scaffold.py +69 -1
  88. package/dist/scanners/runtime-module.d.ts +2 -0
  89. package/dist/scanners/runtime-module.d.ts.map +1 -1
  90. package/dist/scanners/runtime-module.js +14 -0
  91. package/dist/scanners/runtime-module.js.map +1 -1
  92. package/dist/telemetry/metrics.d.ts +1 -1
  93. package/dist/telemetry/metrics.d.ts.map +1 -1
  94. package/dist/telemetry/metrics.js +1 -1
  95. package/dist/telemetry/metrics.js.map +1 -1
  96. package/dist/utils/event-catalog.d.ts +12 -5
  97. package/dist/utils/event-catalog.d.ts.map +1 -1
  98. package/dist/utils/event-catalog.js +4 -1
  99. package/dist/utils/event-catalog.js.map +1 -1
  100. package/openclaw.plugin.json +1 -1
  101. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","source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AGG;AACH,QAAA,MAAM,kBAAkB;;;;;;qBAUP,OAAO;;kBAQR,SAAS;CAoiFxB,CAAC;AAmLF,eAAe,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -27,6 +27,7 @@ import { checkProofCoversRecipe, makeApplyToRuntime, makeWriteRegistry, runtimeC
27
27
  import { INSTALL_DEADLINE_MS, WALLET_INSTALL_IN_FLIGHT_CODE } from "./deploy/deadlines.js";
28
28
  import { AuditQueryError } from "./runtime/audit-query.types.js";
29
29
  import { buildRuntimeStateDir, archiveStateDir } from "./runtime/state-layout.js";
30
+ import { KeyedMutex } from "./utils/keyed-mutex.js";
30
31
  import { describeRuntimeEntry } from "./runtime/runtime-descriptor.js";
31
32
  import { registerSenpiCli } from "./cli/senpi-commands.js";
32
33
  import { readSenpiCliStore, resolveSenpiApiKeyFromStore, resolveSenpiBaseStateDir, } from "./cli/senpi-cli-config.js";
@@ -38,6 +39,7 @@ import { resolveAutoUpdateConfig } from "./runtime/auto-update/types.js";
38
39
  import { SkillsCoordinatorUnavailableError, SkillsUpdateCoordinator, resolveSkillsManagerConfig, } from "./skills-manager/index.js";
39
40
  import { createScannerProvidersForRun } from "./runtime/create-scanner-providers-for-run.js";
40
41
  import { initDsl } from "./dsl/index.js";
42
+ import { exchangeStopClass } from "./dsl/engine/index.js";
41
43
  import { initHealth } from "./health/index.js";
42
44
  import { initRisk } from "./risk/index.js";
43
45
  import { readRiskAuditEntries } from "./risk/risk-audit-log.js";
@@ -181,6 +183,12 @@ const WALLET_INSTALL_IN_FLIGHT = `[${WALLET_INSTALL_IN_FLIGHT_CODE}]`;
181
183
  * anyone's money is being claimed, which is precisely why it must not answer with the wallet code.
182
184
  */
183
185
  const RUNTIME_ID_TAKEN = "[E_RUNTIME_ID_TAKEN]";
186
+ /**
187
+ * One StrategyFacts send per runtime at a time, keyed on runtime id, across the whole process: a
188
+ * second `register()` in the same process shares it. Separate from `runtimeChangeLock`. Delete does
189
+ * not take it; an apply queues its send here and does not wait.
190
+ */
191
+ const factsSendLock = new KeyedMutex();
184
192
  /**
185
193
  * OpenClaw plugin entry.
186
194
  * Boots from internal registry (installed_runtimes.json) in stateDir; does not read runtime list from config.
@@ -436,7 +444,7 @@ const senpiRuntimePlugin = {
436
444
  // PluginLogger surface (info/warn/error) lacks `debug`, while the
437
445
  // Logger contract used by `runtime-api/` includes it.
438
446
  const apiLogger = createLogger("[senpi-core][api]");
439
- /** One line per instance for the boot StrategyFacts send (ticket 125); see `sendBootFacts`. */
447
+ /** One line per instance for each StrategyFacts send; see `queueFactsSend`. */
440
448
  const factsLogger = createLogger("[senpi-core][strategy-facts]");
441
449
  // A gateway seam failed to wire/launch a runtime's external scanner stack: the runtime is up but
442
450
  // runs blind on internal scanners only. Two records, by design: a first-class `runtime.scanners_unwired`
@@ -696,26 +704,16 @@ const senpiRuntimePlugin = {
696
704
  emitEvent(apiLogger, () => buildRuntimeBootSkippedEvent({ runtimeId: entry.id, address: entry.wallet ?? "", status }));
697
705
  }
698
706
  const started = [];
699
- const factsPlans = [];
707
+ // Started runtimes with a facts plan, in boot order; their send runs detached after boot, below.
708
+ const factsRuntimeIds = [];
700
709
  try {
701
710
  for (const entry of entriesToBoot) {
702
- const hasPath = typeof entry.runtimeYamlPath === "string" && entry.runtimeYamlPath.length > 0;
703
- const hasContent = typeof entry.runtimeYamlContent === "string";
704
- if (hasPath && hasContent)
711
+ const inputs = factsPlanInputs(entry);
712
+ if (!inputs)
705
713
  continue;
706
- if (!hasPath && !hasContent)
707
- continue;
708
- const pathOrContent = entry.runtimeYamlPath ?? entry.runtimeYamlContent;
709
- const entryStateDir = buildRuntimeStateDir(baseStateDir, entry.id, entry.wallet ?? "");
710
- // Local only (files, no network); the send itself runs detached after boot, below.
711
- const factsPlan = await planInstanceFacts({
712
- runtimeId: entry.id,
713
- wallet: entry.wallet,
714
- stateDir: entryStateDir,
715
- pathOrContent,
716
- fromPath: hasPath,
717
- runtimeYamlDir: hasPath ? dirname(pathOrContent) : entry.runtimeYamlDir,
718
- });
714
+ const { pathOrContent, fromPath: hasPath, stateDir: entryStateDir } = inputs;
715
+ // Local only (files, no network). Read here for the `factsSent` stamp on this start.
716
+ const factsPlan = await planInstanceFacts(inputs);
719
717
  const handle = await run(pathOrContent, {
720
718
  fromPath: hasPath,
721
719
  stateDir: entryStateDir,
@@ -729,7 +727,7 @@ const senpiRuntimePlugin = {
729
727
  runtimeHandles.set(entry.id, handle);
730
728
  started.push(entry.id);
731
729
  if (factsPlan)
732
- factsPlans.push(factsPlan);
730
+ factsRuntimeIds.push(entry.id);
733
731
  // ── supervised scanner mount (additive; guarded) ──────────────────
734
732
  // Boot path: used for runtimes already present in the registry at
735
733
  // startup. A runtime installed live, after the API is listening,
@@ -822,8 +820,12 @@ const senpiRuntimePlugin = {
822
820
  throw err;
823
821
  }
824
822
  pluginLogger.info(`[senpi-runtime] Started ${started.length} runtime${started.length === 1 ? "" : "s"}`);
825
- // Detached: the facts send never holds boot or trading. One line per instance.
826
- void sendBootFacts(factsPlans, bootStrategyIds).catch((err) => {
823
+ // Detached: the facts send never holds boot or trading. One line per instance, one instance at
824
+ // a time, each planned again when its turn comes under the per-runtime facts lock.
825
+ void (async () => {
826
+ for (const runtimeId of factsRuntimeIds)
827
+ await queueFactsSend(runtimeId, bootStrategyIds);
828
+ })().catch((err) => {
827
829
  factsLogger.warn("strategy facts send crashed", err);
828
830
  });
829
831
  // ── HTTP API ──────────────────────────────────────────────────────
@@ -1565,8 +1567,27 @@ const senpiRuntimePlugin = {
1565
1567
  else
1566
1568
  respond(false, undefined, result.error);
1567
1569
  }, { scope: "operator.write" });
1568
- // ── StrategyFacts at boot (ticket 125) ─────────────────────────────────
1569
- /** The boot plan for one instance, or null (logged once as `failed`) when it cannot be made. */
1570
+ // ── StrategyFacts send ─────────────────────────────────────────────────
1571
+ /**
1572
+ * The facts plan inputs for one registry entry, which are also the recipe and state dir boot
1573
+ * starts it with. Null when the entry holds both or neither of a recipe path and recipe content.
1574
+ */
1575
+ function factsPlanInputs(entry) {
1576
+ const hasPath = typeof entry.runtimeYamlPath === "string" && entry.runtimeYamlPath.length > 0;
1577
+ const hasContent = typeof entry.runtimeYamlContent === "string";
1578
+ if (hasPath === hasContent)
1579
+ return null;
1580
+ const pathOrContent = entry.runtimeYamlPath ?? entry.runtimeYamlContent;
1581
+ return {
1582
+ runtimeId: entry.id,
1583
+ wallet: entry.wallet,
1584
+ stateDir: buildRuntimeStateDir(baseStateDir, entry.id, entry.wallet ?? ""),
1585
+ pathOrContent,
1586
+ fromPath: hasPath,
1587
+ runtimeYamlDir: hasPath ? dirname(pathOrContent) : entry.runtimeYamlDir,
1588
+ };
1589
+ }
1590
+ /** The facts plan for one instance, or null (logged once as `failed`) when it cannot be made. */
1570
1591
  async function planInstanceFacts(input) {
1571
1592
  try {
1572
1593
  const config = await loadRuntimeConfig(input.pathOrContent, { fromPath: input.fromPath });
@@ -1633,6 +1654,43 @@ const senpiRuntimePlugin = {
1633
1654
  await session.client.disconnect().catch(() => { });
1634
1655
  }
1635
1656
  }
1657
+ /**
1658
+ * Send one runtime's facts under `factsSendLock`. The plan is made from the registry entry and
1659
+ * the state file as they are when the send runs, so the last send for a runtime carries its
1660
+ * current recipe. A runtime no longer in the registry, or whose entry cannot be planned, gets
1661
+ * no send. An unchanged plan makes no call.
1662
+ *
1663
+ * `strategyIds` is the boot's one batched status read (null when that read failed). Without it,
1664
+ * the strategy id is read for this one wallet; a failed read logs its reason and sends nothing.
1665
+ */
1666
+ function queueFactsSend(runtimeId, strategyIds) {
1667
+ return factsSendLock.withKeyLock(runtimeId, async () => {
1668
+ const { readRegistry } = await import("./runtime/strategy-registry.js");
1669
+ const entry = (await readRegistry(baseStateDir)).runtimes.find((e) => e.id === runtimeId);
1670
+ const inputs = entry ? factsPlanInputs(entry) : null;
1671
+ if (!inputs)
1672
+ return;
1673
+ const plan = await planInstanceFacts(inputs);
1674
+ if (!plan)
1675
+ return;
1676
+ let ids = strategyIds ?? null;
1677
+ if (strategyIds === undefined && !plan.unchanged) {
1678
+ const read = await readBootWalletStatuses([plan.wallet.trim().toLowerCase()], (wallets, signal) => withSenpiClient((client) => client.listStrategies({ strategyAddresses: wallets }, { signal })));
1679
+ if (!read.ok) {
1680
+ factsLogger.warn("strategy facts failed: could not read the strategy id; retrying next boot", undefined, {
1681
+ runtimeId: plan.runtimeId,
1682
+ wallet: plan.wallet,
1683
+ hash: plan.hash.slice(0, 12),
1684
+ reason: read.reason,
1685
+ detail: read.message,
1686
+ });
1687
+ return;
1688
+ }
1689
+ ids = read.strategyIds;
1690
+ }
1691
+ await sendBootFacts([plan], ids);
1692
+ });
1693
+ }
1636
1694
  /** One connected SenpiClient per job; always disconnected, even on failure. */
1637
1695
  async function withSenpiClient(fn) {
1638
1696
  const client = mcpTransport ? new SenpiClient(mcpTransport) : new SenpiClient({ apiKey });
@@ -1845,6 +1903,13 @@ const senpiRuntimePlugin = {
1845
1903
  ...(info.slots !== undefined ? { slots: info.slots } : {}),
1846
1904
  });
1847
1905
  });
1906
+ // The apply swaps the recipe with no boot, so this send moves the backend's facts (what the
1907
+ // app shows) to the new recipe before the next boot. Detached: the apply has landed and must
1908
+ // not wait on, or fail over, the send. The send plans from the registry entry the apply has
1909
+ // written, and takes the wallet from that entry or its recipe.
1910
+ void queueFactsSend(info.runtimeId).catch((err) => {
1911
+ factsLogger.warn("strategy facts send crashed", err);
1912
+ });
1848
1913
  },
1849
1914
  });
1850
1915
  registerDeployGatewayMethods(api, {
@@ -1992,6 +2057,7 @@ const senpiRuntimePlugin = {
1992
2057
  const runtimeId = typeof ctx.params?.runtimeId === "string" ? ctx.params.runtimeId : undefined;
1993
2058
  const address = typeof ctx.params?.address === "string" ? ctx.params.address : undefined;
1994
2059
  pluginLogger.info("[senpi-runtime] senpi.getDslPositionState", { asset, runtimeId, address });
2060
+ // `exchangeStop` is derived from the state on each response and is not persisted.
1995
2061
  const matches = [];
1996
2062
  for (const [id, handle] of runtimeHandles) {
1997
2063
  if (runtimeId && id !== runtimeId)
@@ -2002,12 +2068,18 @@ const senpiRuntimePlugin = {
2002
2068
  if (address) {
2003
2069
  const state = handle.dsl.getPositionState(address, asset);
2004
2070
  if (state)
2005
- matches.push({ runtimeId: id, address, state });
2071
+ matches.push({ runtimeId: id, address, state, exchangeStop: exchangeStopClass(state) });
2006
2072
  }
2007
2073
  else {
2008
2074
  const found = handle.dsl.findPositionByAsset(asset);
2009
- if (found)
2010
- matches.push({ runtimeId: id, address: found.address, state: found.state });
2075
+ if (found) {
2076
+ matches.push({
2077
+ runtimeId: id,
2078
+ address: found.address,
2079
+ state: found.state,
2080
+ exchangeStop: exchangeStopClass(found.state),
2081
+ });
2082
+ }
2011
2083
  }
2012
2084
  }
2013
2085
  catch (err) {