@senpi-ai/runtime 3.0.77 → 3.0.80
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 +76 -2
- package/dist/cli/deploy-render.d.ts +93 -0
- package/dist/cli/deploy-render.d.ts.map +1 -0
- package/dist/cli/deploy-render.js +438 -0
- package/dist/cli/deploy-render.js.map +1 -0
- package/dist/cli/guide-commands.d.ts.map +1 -1
- package/dist/cli/guide-commands.js +94 -9
- package/dist/cli/guide-commands.js.map +1 -1
- package/dist/cli/senpi-commands.d.ts +6 -1
- package/dist/cli/senpi-commands.d.ts.map +1 -1
- package/dist/cli/senpi-commands.js +290 -41
- package/dist/cli/senpi-commands.js.map +1 -1
- package/dist/cli/validate-command.d.ts.map +1 -1
- package/dist/cli/validate-command.js +10 -1
- package/dist/cli/validate-command.js.map +1 -1
- package/dist/deploy/deadlines.d.ts +107 -0
- package/dist/deploy/deadlines.d.ts.map +1 -0
- package/dist/deploy/deadlines.js +139 -0
- package/dist/deploy/deadlines.js.map +1 -0
- package/dist/deploy/error-text.d.ts +25 -0
- package/dist/deploy/error-text.d.ts.map +1 -0
- package/dist/deploy/error-text.js +42 -0
- package/dist/deploy/error-text.js.map +1 -0
- package/dist/deploy/funding.d.ts +125 -0
- package/dist/deploy/funding.d.ts.map +1 -0
- package/dist/deploy/funding.js +268 -0
- package/dist/deploy/funding.js.map +1 -0
- package/dist/deploy/install-gate-runner.d.ts +12 -0
- package/dist/deploy/install-gate-runner.d.ts.map +1 -0
- package/dist/deploy/install-gate-runner.js +17 -0
- package/dist/deploy/install-gate-runner.js.map +1 -0
- package/dist/deploy/job.d.ts +215 -0
- package/dist/deploy/job.d.ts.map +1 -0
- package/dist/deploy/job.js +484 -0
- package/dist/deploy/job.js.map +1 -0
- package/dist/deploy/messages.d.ts +603 -0
- package/dist/deploy/messages.d.ts.map +1 -0
- package/dist/deploy/messages.js +1388 -0
- package/dist/deploy/messages.js.map +1 -0
- package/dist/deploy/min-budget.d.ts +68 -0
- package/dist/deploy/min-budget.d.ts.map +1 -0
- package/dist/deploy/min-budget.js +297 -0
- package/dist/deploy/min-budget.js.map +1 -0
- package/dist/deploy/orchestrator.d.ts +314 -0
- package/dist/deploy/orchestrator.d.ts.map +1 -0
- package/dist/deploy/orchestrator.js +2171 -0
- package/dist/deploy/orchestrator.js.map +1 -0
- package/dist/deploy/package.d.ts +228 -0
- package/dist/deploy/package.d.ts.map +1 -0
- package/dist/deploy/package.js +542 -0
- package/dist/deploy/package.js.map +1 -0
- package/dist/deploy/proof-gate.d.ts +86 -0
- package/dist/deploy/proof-gate.d.ts.map +1 -0
- package/dist/deploy/proof-gate.js +278 -0
- package/dist/deploy/proof-gate.js.map +1 -0
- package/dist/deploy/python-float.d.ts +34 -0
- package/dist/deploy/python-float.d.ts.map +1 -0
- package/dist/deploy/python-float.js +46 -0
- package/dist/deploy/python-float.js.map +1 -0
- package/dist/deploy/recheck-commands.d.ts +50 -0
- package/dist/deploy/recheck-commands.d.ts.map +1 -0
- package/dist/deploy/recheck-commands.js +77 -0
- package/dist/deploy/recheck-commands.js.map +1 -0
- package/dist/deploy/register.d.ts +101 -0
- package/dist/deploy/register.d.ts.map +1 -0
- package/dist/deploy/register.js +714 -0
- package/dist/deploy/register.js.map +1 -0
- package/dist/deploy/taxonomy.d.ts +43 -0
- package/dist/deploy/taxonomy.d.ts.map +1 -0
- package/dist/deploy/taxonomy.js +59 -0
- package/dist/deploy/taxonomy.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +467 -222
- package/dist/index.js.map +1 -1
- package/dist/runtime/env-resolve.d.ts +13 -0
- package/dist/runtime/env-resolve.d.ts.map +1 -1
- package/dist/runtime/env-resolve.js +14 -1
- package/dist/runtime/env-resolve.js.map +1 -1
- package/dist/runtime/runtime-descriptor.d.ts +37 -0
- package/dist/runtime/runtime-descriptor.d.ts.map +1 -0
- package/dist/runtime/runtime-descriptor.js +163 -0
- package/dist/runtime/runtime-descriptor.js.map +1 -0
- package/dist/runtime/runtime-schema.d.ts +100 -100
- package/dist/runtime/strategy-registry.d.ts +8 -0
- package/dist/runtime/strategy-registry.d.ts.map +1 -1
- package/dist/runtime/strategy-registry.js +14 -1
- package/dist/runtime/strategy-registry.js.map +1 -1
- package/dist/runtime-api/intake/intake-mount.d.ts.map +1 -1
- package/dist/runtime-api/intake/intake-mount.js +7 -4
- package/dist/runtime-api/intake/intake-mount.js.map +1 -1
- package/dist/scanners/external/scaffold/preflight.py +39 -0
- package/dist/scanners/implementations/market-regime.d.ts +1 -1
- package/dist/senpi/client.d.ts +58 -4
- package/dist/senpi/client.d.ts.map +1 -1
- package/dist/senpi/client.js +262 -18
- package/dist/senpi/client.js.map +1 -1
- package/dist/senpi/strategy-status.d.ts +32 -0
- package/dist/senpi/strategy-status.d.ts.map +1 -0
- package/dist/senpi/strategy-status.js +70 -0
- package/dist/senpi/strategy-status.js.map +1 -0
- package/dist/senpi/types.d.ts +65 -3
- package/dist/senpi/types.d.ts.map +1 -1
- package/dist/skills-manager/manifest.d.ts.map +1 -1
- package/dist/skills-manager/manifest.js +4 -3
- package/dist/skills-manager/manifest.js.map +1 -1
- package/dist/skills-manager/skills-manifest.json +4 -3
- package/dist/telemetry/metrics.d.ts +30 -0
- package/dist/telemetry/metrics.d.ts.map +1 -1
- package/dist/telemetry/metrics.js +72 -0
- package/dist/telemetry/metrics.js.map +1 -1
- package/dist/types/strategy.d.ts +9 -1
- package/dist/types/strategy.d.ts.map +1 -1
- package/dist/universe/package-universe.d.ts +97 -0
- package/dist/universe/package-universe.d.ts.map +1 -0
- package/dist/universe/package-universe.js +304 -0
- package/dist/universe/package-universe.js.map +1 -0
- package/dist/validate/codes.d.ts +30 -0
- package/dist/validate/codes.d.ts.map +1 -1
- package/dist/validate/codes.js +74 -1
- package/dist/validate/codes.js.map +1 -1
- package/dist/validate/index.d.ts +1 -1
- package/dist/validate/index.d.ts.map +1 -1
- package/dist/validate/index.js.map +1 -1
- package/dist/validate/install-gate.d.ts.map +1 -1
- package/dist/validate/install-gate.js +10 -2
- package/dist/validate/install-gate.js.map +1 -1
- package/dist/validate/live-instruments.d.ts +44 -0
- package/dist/validate/live-instruments.d.ts.map +1 -0
- package/dist/validate/live-instruments.js +71 -0
- package/dist/validate/live-instruments.js.map +1 -0
- package/dist/validate/live-stage.d.ts +8 -0
- package/dist/validate/live-stage.d.ts.map +1 -1
- package/dist/validate/live-stage.js +87 -18
- package/dist/validate/live-stage.js.map +1 -1
- package/dist/validate/package-gates-stage.d.ts +61 -0
- package/dist/validate/package-gates-stage.d.ts.map +1 -0
- package/dist/validate/package-gates-stage.js +215 -0
- package/dist/validate/package-gates-stage.js.map +1 -0
- package/dist/validate/proof.d.ts +11 -1
- package/dist/validate/proof.d.ts.map +1 -1
- package/dist/validate/proof.js +10 -6
- package/dist/validate/proof.js.map +1 -1
- package/dist/validate/recipe-checks.d.ts.map +1 -1
- package/dist/validate/recipe-checks.js +6 -4
- package/dist/validate/recipe-checks.js.map +1 -1
- package/dist/validate/run.d.ts +29 -1
- package/dist/validate/run.d.ts.map +1 -1
- package/dist/validate/run.js +65 -6
- package/dist/validate/run.js.map +1 -1
- package/dist/validate/target.d.ts +41 -0
- package/dist/validate/target.d.ts.map +1 -1
- package/dist/validate/target.js +192 -16
- package/dist/validate/target.js.map +1 -1
- package/dist/validate/taxonomy-finding.d.ts +22 -0
- package/dist/validate/taxonomy-finding.d.ts.map +1 -0
- package/dist/validate/taxonomy-finding.js +25 -0
- package/dist/validate/taxonomy-finding.js.map +1 -0
- package/dist/validate/universe-stage.d.ts +71 -0
- package/dist/validate/universe-stage.d.ts.map +1 -0
- package/dist/validate/universe-stage.js +165 -0
- package/dist/validate/universe-stage.js.map +1 -0
- package/dist/validate/wallet-binding-stage.d.ts +44 -0
- package/dist/validate/wallet-binding-stage.d.ts.map +1 -0
- package/dist/validate/wallet-binding-stage.js +92 -0
- package/dist/validate/wallet-binding-stage.js.map +1 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The package universe: is every instrument this package hardcodes actually live on the exchange?
|
|
3
|
+
*
|
|
4
|
+
* Deploy's pre-money check, run here too. The SAME `checkPackageUniverse` `runDeploy` calls — not a
|
|
5
|
+
* second implementation and not a re-derivation: this module only renders the verdict it returns as
|
|
6
|
+
* findings. Deploy keeps its own call deliberately, because `strategy.yaml` is outside the proof
|
|
7
|
+
* fingerprint, so a `catalog.assets` edit is exactly the change a proof cannot see.
|
|
8
|
+
*
|
|
9
|
+
* ## Why this is a LIVE-depth check
|
|
10
|
+
*
|
|
11
|
+
* The scan of the package is static, but the verdict is not: it needs the exchange's live
|
|
12
|
+
* instrument list, and nothing about a hardcoded name can be judged without one. Static and import
|
|
13
|
+
* are the depths that do no I/O — CI runs them with no gateway and no credentials — so putting a
|
|
14
|
+
* network read there would have cost that property for every run. Nothing is lost by waiting: a
|
|
15
|
+
* proof requires `depth === "live"`, and deploy refuses a package with no proof, so every path that
|
|
16
|
+
* produces a deployable package reaches this depth. The author still learns before funding.
|
|
17
|
+
*
|
|
18
|
+
* ## Three states of "no package", and what each means here
|
|
19
|
+
*
|
|
20
|
+
* `pkg` set is the checkable one. `packageUnreadable` set means a `strategy.yaml` exists and would
|
|
21
|
+
* not load — the check could not run, which is reported, not passed over. NEITHER set is the only
|
|
22
|
+
* genuine "no package": a recipe being authored before its manifest exists, or a directory inside a
|
|
23
|
+
* readable package that is not one of its instances. Nothing is reported there, because there is no
|
|
24
|
+
* declared universe to check.
|
|
25
|
+
*
|
|
26
|
+
* ## What each kind of ignorance says, and why they are not one code
|
|
27
|
+
*
|
|
28
|
+
* Three things can stop this producing a verdict, and they route to different people:
|
|
29
|
+
*
|
|
30
|
+
* - The LIVE LIST could not be read — the source threw, or returned nothing (an empty list means
|
|
31
|
+
* "could not read", NEVER "everything is dead"). That is an environment fault:
|
|
32
|
+
* `W_VALIDATE_UNIVERSE_UNAVAILABLE`, actor `ops`. It names no instrument dead, because a read
|
|
33
|
+
* that did not succeed proves nothing about this package.
|
|
34
|
+
* - The PACKAGE could not be read — an unloadable manifest, or an instance recipe that will not
|
|
35
|
+
* parse. That is the author's to fix: `W_VALIDATE_UNIVERSE_UNCHECKED`, actor `agent`.
|
|
36
|
+
* - No source was supplied at all. Silent, and only here: that is a programmatic caller choosing
|
|
37
|
+
* not to run the check, not a run that tried and failed. The CLI always supplies one, so the
|
|
38
|
+
* "could not obtain a client" case arrives as `unavailable` above and speaks.
|
|
39
|
+
*
|
|
40
|
+
* Splitting the first two on `actor` is not tidiness. `actor` is loop control — an agent that
|
|
41
|
+
* answers "the MCP server is down" by editing `strategy.yaml` will keep editing until something
|
|
42
|
+
* else stops it, which is the exact failure `Actor` exists to prevent.
|
|
43
|
+
*
|
|
44
|
+
* What none of them ever do is call an instrument dead. That invariant is the whole point of the
|
|
45
|
+
* `unavailable` status upstream, and it survives being rendered here.
|
|
46
|
+
*/
|
|
47
|
+
import { isAbsolute, join, relative } from "node:path";
|
|
48
|
+
import { errorText } from "../deploy/error-text.js";
|
|
49
|
+
import { checkPackageUniverse, checkedTickerForms, } from "../universe/package-universe.js";
|
|
50
|
+
import { VALIDATE_CODE } from "./codes.js";
|
|
51
|
+
import { taxonomyFinding } from "./taxonomy-finding.js";
|
|
52
|
+
/**
|
|
53
|
+
* The check, as findings. Called from the live depth; never from static or import.
|
|
54
|
+
*
|
|
55
|
+
* The order of the guards below is load-bearing: absent `deps` is checked BEFORE
|
|
56
|
+
* `packageUnreadable`, so a caller that asked for no universe check is never told about a manifest
|
|
57
|
+
* it never asked about.
|
|
58
|
+
*/
|
|
59
|
+
export async function universeFindings(target, options) {
|
|
60
|
+
if (options.deps === undefined)
|
|
61
|
+
return [];
|
|
62
|
+
if (target.packageUnreadable !== undefined) {
|
|
63
|
+
const { manifestPath, error } = target.packageUnreadable;
|
|
64
|
+
const shown = asPath(options.cwd, manifestPath);
|
|
65
|
+
return [
|
|
66
|
+
taxonomyFinding(VALIDATE_CODE.universeUnchecked, {
|
|
67
|
+
what: `The live-instrument check did not run: ${shown} could not be read (${error})`,
|
|
68
|
+
why: UNCHECKED_WHY,
|
|
69
|
+
fix: `Fix ${shown} — \`senpi deploy\` reads the same file and refuses for the same reason — ` +
|
|
70
|
+
`then run this command again.`,
|
|
71
|
+
where: { file: shown },
|
|
72
|
+
evidence: { manifest: shown, error },
|
|
73
|
+
}),
|
|
74
|
+
];
|
|
75
|
+
}
|
|
76
|
+
const pkg = target.pkg;
|
|
77
|
+
if (pkg === undefined)
|
|
78
|
+
return [];
|
|
79
|
+
let verdict;
|
|
80
|
+
try {
|
|
81
|
+
verdict = await checkPackageUniverse(pkg, options.deps);
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
// `checkPackageUniverse` never lets the injected source throw, but it does NOT wrap reads of the
|
|
85
|
+
// package's own YAML — a deleted or unparseable instance recipe raises out of it. Deploy parses
|
|
86
|
+
// those files before it ever gets here; this call site is the one that can meet them, and the
|
|
87
|
+
// whole command going down would be a worse answer than "this check could not run".
|
|
88
|
+
const files = [join(pkg.dir, "strategy.yaml"), ...pkg.instances.map((inst) => inst.runtimeYamlPath)];
|
|
89
|
+
return [
|
|
90
|
+
taxonomyFinding(VALIDATE_CODE.universeUnchecked, {
|
|
91
|
+
what: `The live-instrument check did not run: this package's files could not be read (${errorText(err)})`,
|
|
92
|
+
why: UNCHECKED_WHY,
|
|
93
|
+
fix: "Make each of these readable and parseable as YAML, then run this command again:\n" +
|
|
94
|
+
files.map((file) => ` ${asPath(options.cwd, file)}`).join("\n"),
|
|
95
|
+
evidence: { error: errorText(err), files: files.map((file) => asPath(options.cwd, file)) },
|
|
96
|
+
}),
|
|
97
|
+
];
|
|
98
|
+
}
|
|
99
|
+
if (verdict.status === "unavailable")
|
|
100
|
+
return [universeUnavailableFinding(verdict.reason)];
|
|
101
|
+
// `no-hardcoded` and `clean` are the two states with nothing to say.
|
|
102
|
+
if (verdict.status !== "dead")
|
|
103
|
+
return [];
|
|
104
|
+
return [...verdict.dead.entries()].map(([ticker, rows]) => universeNotLiveFinding(ticker, rows, pkg, verdict.liveCount));
|
|
105
|
+
}
|
|
106
|
+
/** Shared by both unchecked causes: the consequence is the same whichever input was unreadable. */
|
|
107
|
+
const UNCHECKED_WHY = "A hardcoded instrument that is not live on the exchange is the one packaging fault that never " +
|
|
108
|
+
"raises — the scan skips the name and the strategy trades nothing on it. This run cannot say " +
|
|
109
|
+
"whether that is the case here, and a pass that covered it would be claiming otherwise.";
|
|
110
|
+
/** One dead name, everywhere it appears — the package-relative locations an author edits. */
|
|
111
|
+
function universeNotLiveFinding(ticker, rows, pkg, liveCount) {
|
|
112
|
+
// Both forms, from the function the comparison itself uses: telling an author to look for a name
|
|
113
|
+
// that was never checked is worse than saying nothing.
|
|
114
|
+
const checked = checkedTickerForms(ticker).map((form) => `"${form}"`).join(" or ");
|
|
115
|
+
const where = rows.map((row) => `${asPath(pkg.dir, row.file)} (${row.keyPath})`).join("; ");
|
|
116
|
+
return taxonomyFinding(VALIDATE_CODE.universeNotLive, {
|
|
117
|
+
where: { file: asPath(pkg.dir, rows[0].file), yaml_path: rows[0].keyPath },
|
|
118
|
+
what: `This package hardcodes "${ticker}", and no live instrument matches ${checked} — at ${where}`,
|
|
119
|
+
why: "A name the exchange does not carry never raises: the scan skips it and the strategy trades " +
|
|
120
|
+
"nothing on it. Funded, it looks healthy and silently never takes the position.",
|
|
121
|
+
fix: `Replace or remove "${ticker}" at ${where}. The correct spelling comes from the live ` +
|
|
122
|
+
`instrument list this was checked against (${liveCount} names) — \`senpi deploy\` runs the ` +
|
|
123
|
+
`same check before it funds anything and refuses on it.`,
|
|
124
|
+
evidence: {
|
|
125
|
+
ticker,
|
|
126
|
+
checked: checkedTickerForms(ticker),
|
|
127
|
+
live_count: liveCount,
|
|
128
|
+
occurrences: rows.map((row) => ({ file: asPath(pkg.dir, row.file), key_path: row.keyPath })),
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* The live list could not be read — an environment fault, and never a verdict about the package.
|
|
134
|
+
*
|
|
135
|
+
* Deliberately names no instrument and quotes the reason verbatim. An empty response reaches here
|
|
136
|
+
* too: a real read always carries at least the majors, so empty is an unreadable list wearing a
|
|
137
|
+
* different hat, and unknown is never "not live".
|
|
138
|
+
*/
|
|
139
|
+
function universeUnavailableFinding(reason) {
|
|
140
|
+
return taxonomyFinding(VALIDATE_CODE.universeUnavailable, {
|
|
141
|
+
what: `The live-instrument check did not run: the exchange's instrument list could not be read (${reason})`,
|
|
142
|
+
why: "No instrument was declared dead — an unreadable list proves nothing about this package. But " +
|
|
143
|
+
"nothing about its hardcoded names was established either, so this run cannot stand in for " +
|
|
144
|
+
"the check `senpi deploy` makes before it funds anything.",
|
|
145
|
+
fix: "Re-run once the MCP server is reachable and credentials are set (SENPI_AUTH_TOKEN or " +
|
|
146
|
+
"SENPI_API_KEY, and SENPI_MCP_URL). Nothing in the package needs editing for this.",
|
|
147
|
+
evidence: { reason },
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* A path as a reader should see it: relative to `base` when it sits underneath it, absolute
|
|
152
|
+
* otherwise. Findings must not carry absolute machine paths where a relative one is meaningful, and
|
|
153
|
+
* must not carry a `../..` chain where it is not.
|
|
154
|
+
*
|
|
155
|
+
* The base differs by what the finding is about, deliberately. A dead instrument is a fact about a
|
|
156
|
+
* PACKAGE, so its locations are package-relative (`strategy.yaml`, `swing/runtime.yaml`) — the form
|
|
157
|
+
* {@link import("./types.js").FindingLocation.file} documents, and the one that reads the same from
|
|
158
|
+
* any directory. An unreadable manifest has no package to be relative to; it is named from the cwd,
|
|
159
|
+
* matching how `target.ts` renders the same file in the refusal it raises at a package root.
|
|
160
|
+
*/
|
|
161
|
+
function asPath(base, absolute) {
|
|
162
|
+
const rel = relative(base, absolute);
|
|
163
|
+
return rel === "" || rel.startsWith("..") || isAbsolute(rel) ? absolute : rel;
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=universe-stage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"universe-stage.js","sourceRoot":"","sources":["../../src/validate/universe-stage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EACL,oBAAoB,EACpB,kBAAkB,GAInB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAkBxD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAsB,EACtB,OAA6B;IAE7B,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IAE1C,IAAI,MAAM,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;QAC3C,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC,iBAAiB,CAAC;QACzD,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QAChD,OAAO;YACL,eAAe,CAAC,aAAa,CAAC,iBAAiB,EAAE;gBAC/C,IAAI,EAAE,0CAA0C,KAAK,uBAAuB,KAAK,GAAG;gBACpF,GAAG,EAAE,aAAa;gBAClB,GAAG,EACD,OAAO,KAAK,4EAA4E;oBACxF,8BAA8B;gBAChC,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;gBACtB,QAAQ,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE;aACrC,CAAC;SACH,CAAC;IACJ,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A6C;YACtF,6CAA6C,SAAS,sCAAsC;YAC5F,wDAAwD;QAC1D,QAAQ,EAAE;YACR,MAAM;YACN,OAAO,EAAE,kBAAkB,CAAC,MAAM,CAAC;YACnC,UAAU,EAAE,SAAS;YACrB,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;SAC7F;KACF,CAAC,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,SAAS,0BAA0B,CAAC,MAAc;IAChD,OAAO,eAAe,CAAC,aAAa,CAAC,mBAAmB,EAAE;QACxD,IAAI,EAAE,4FAA4F,MAAM,GAAG;QAC3G,GAAG,EACD,8FAA8F;YAC9F,4FAA4F;YAC5F,0DAA0D;QAC5D,GAAG,EACD,uFAAuF;YACvF,mFAAmF;QACrF,QAAQ,EAAE,EAAE,MAAM,EAAE;KACrB,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAS,MAAM,CAAC,IAAY,EAAE,QAAgB;IAC5C,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACrC,OAAO,GAAG,KAAK,EAAE,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC;AAChF,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Does this recipe bind the wallet its package says it binds?
|
|
3
|
+
*
|
|
4
|
+
* Deploy's pre-money check, run here too — the SAME `unboundWalletInstances` `runDeploy` calls, not
|
|
5
|
+
* a second implementation. The author should never first learn about a package-derivable fault from
|
|
6
|
+
* the money path, which is what `senpi validate` green followed by `senpi deploy` refused means.
|
|
7
|
+
*
|
|
8
|
+
* ## Why this is a STATIC-depth check
|
|
9
|
+
*
|
|
10
|
+
* It reads the package's own bytes and nothing else: no exchange, no gateway, no credentials. That
|
|
11
|
+
* puts it at the shallowest depth, where `depthsUpTo` makes it run at every depth above — so an
|
|
12
|
+
* offline CI run with no MCP server reachable still catches it. The universe check next door is
|
|
13
|
+
* live-depth only because its verdict needs the exchange's instrument list; this one has no such
|
|
14
|
+
* excuse and should not borrow the latency.
|
|
15
|
+
*
|
|
16
|
+
* ## Why it never fires on a recipe an author is pinning deliberately
|
|
17
|
+
*
|
|
18
|
+
* `resolveWallet` accepts a well-formed address in `strategy.wallet` as a real wallet to validate
|
|
19
|
+
* against — pinning is how you make a live run read a real book instead of the empty placeholder
|
|
20
|
+
* one. That is a supported workflow and this check must not take it away. It cannot: the fault
|
|
21
|
+
* requires a manifest that declares `wallet_env` for THIS instance, which is exactly the state
|
|
22
|
+
* where a pinned address contradicts the package's own promise. A recipe with no package around it,
|
|
23
|
+
* or one the manifest does not declare, is silent here.
|
|
24
|
+
*
|
|
25
|
+
* ## The three states of "no package"
|
|
26
|
+
*
|
|
27
|
+
* Same rule as `universe-stage.ts`, for the same reason. `pkg` set is the checkable one.
|
|
28
|
+
* `packageUnreadable` means a `strategy.yaml` exists and would not load — the check could not run,
|
|
29
|
+
* which is reported rather than passed over, because "I could not read it" is never "there is
|
|
30
|
+
* nothing there". Neither set is the genuine no-package case (a recipe being authored before its
|
|
31
|
+
* manifest exists), and nothing is reported there.
|
|
32
|
+
*/
|
|
33
|
+
import type { ResolvedTarget } from "./target.js";
|
|
34
|
+
import type { Finding } from "./types.js";
|
|
35
|
+
/**
|
|
36
|
+
* The check, as findings.
|
|
37
|
+
*
|
|
38
|
+
* Scoped to the instance this run is validating, not to the whole package. `target.ts` resolves a
|
|
39
|
+
* package ROOT to a refusal ("pick an instance"), so every run that gets here is about exactly one
|
|
40
|
+
* recipe — and reporting a sibling's fault would be telling the author to edit a file this command
|
|
41
|
+
* did not look at.
|
|
42
|
+
*/
|
|
43
|
+
export declare function walletBindingFindings(target: ResolvedTarget): Finding[];
|
|
44
|
+
//# sourceMappingURL=wallet-binding-stage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet-binding-stage.d.ts","sourceRoot":"","sources":["../../src/validate/wallet-binding-stage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,EAAE,CAgBvE"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Does this recipe bind the wallet its package says it binds?
|
|
3
|
+
*
|
|
4
|
+
* Deploy's pre-money check, run here too — the SAME `unboundWalletInstances` `runDeploy` calls, not
|
|
5
|
+
* a second implementation. The author should never first learn about a package-derivable fault from
|
|
6
|
+
* the money path, which is what `senpi validate` green followed by `senpi deploy` refused means.
|
|
7
|
+
*
|
|
8
|
+
* ## Why this is a STATIC-depth check
|
|
9
|
+
*
|
|
10
|
+
* It reads the package's own bytes and nothing else: no exchange, no gateway, no credentials. That
|
|
11
|
+
* puts it at the shallowest depth, where `depthsUpTo` makes it run at every depth above — so an
|
|
12
|
+
* offline CI run with no MCP server reachable still catches it. The universe check next door is
|
|
13
|
+
* live-depth only because its verdict needs the exchange's instrument list; this one has no such
|
|
14
|
+
* excuse and should not borrow the latency.
|
|
15
|
+
*
|
|
16
|
+
* ## Why it never fires on a recipe an author is pinning deliberately
|
|
17
|
+
*
|
|
18
|
+
* `resolveWallet` accepts a well-formed address in `strategy.wallet` as a real wallet to validate
|
|
19
|
+
* against — pinning is how you make a live run read a real book instead of the empty placeholder
|
|
20
|
+
* one. That is a supported workflow and this check must not take it away. It cannot: the fault
|
|
21
|
+
* requires a manifest that declares `wallet_env` for THIS instance, which is exactly the state
|
|
22
|
+
* where a pinned address contradicts the package's own promise. A recipe with no package around it,
|
|
23
|
+
* or one the manifest does not declare, is silent here.
|
|
24
|
+
*
|
|
25
|
+
* ## The three states of "no package"
|
|
26
|
+
*
|
|
27
|
+
* Same rule as `universe-stage.ts`, for the same reason. `pkg` set is the checkable one.
|
|
28
|
+
* `packageUnreadable` means a `strategy.yaml` exists and would not load — the check could not run,
|
|
29
|
+
* which is reported rather than passed over, because "I could not read it" is never "there is
|
|
30
|
+
* nothing there". Neither set is the genuine no-package case (a recipe being authored before its
|
|
31
|
+
* manifest exists), and nothing is reported there.
|
|
32
|
+
*/
|
|
33
|
+
import { isAbsolute, relative } from "node:path";
|
|
34
|
+
import { unboundWalletInstances } from "../deploy/package.js";
|
|
35
|
+
import { VALIDATE_CODE } from "./codes.js";
|
|
36
|
+
import { taxonomyFinding } from "./taxonomy-finding.js";
|
|
37
|
+
/**
|
|
38
|
+
* The check, as findings.
|
|
39
|
+
*
|
|
40
|
+
* Scoped to the instance this run is validating, not to the whole package. `target.ts` resolves a
|
|
41
|
+
* package ROOT to a refusal ("pick an instance"), so every run that gets here is about exactly one
|
|
42
|
+
* recipe — and reporting a sibling's fault would be telling the author to edit a file this command
|
|
43
|
+
* did not look at.
|
|
44
|
+
*/
|
|
45
|
+
export function walletBindingFindings(target) {
|
|
46
|
+
if (target.packageUnreadable !== undefined) {
|
|
47
|
+
// Deliberately silent. The manifest is what declares `wallet_env`, so an unreadable one means
|
|
48
|
+
// this check has no question to ask — and `target.ts` already raises
|
|
49
|
+
// `E_VALIDATE_UNREADABLE_MANIFEST` at the package root, while below the root the universe check
|
|
50
|
+
// reports the same unreadable file. A third voice on one fault is noise, not fail-open: no
|
|
51
|
+
// reading of a manifest nobody can read could clear a package for funding.
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
const pkg = target.pkg;
|
|
55
|
+
if (pkg === undefined || target.recipePath === undefined)
|
|
56
|
+
return [];
|
|
57
|
+
const fault = unboundWalletInstances(pkg).find((candidate) => candidate.instance.runtimeYamlPath === target.recipePath);
|
|
58
|
+
return fault === undefined ? [] : [walletUnboundFinding(fault, pkg)];
|
|
59
|
+
}
|
|
60
|
+
function walletUnboundFinding(fault, pkg) {
|
|
61
|
+
const file = asPath(pkg.dir, fault.instance.runtimeYamlPath);
|
|
62
|
+
const binds = fault.declared === undefined
|
|
63
|
+
? "declares no `strategy.wallet` at all"
|
|
64
|
+
: `binds \`strategy.wallet: ${fault.declared}\``;
|
|
65
|
+
return taxonomyFinding(VALIDATE_CODE.walletUnbound, {
|
|
66
|
+
where: { file, yaml_path: "strategy.wallet" },
|
|
67
|
+
what: `This recipe ${binds}, but strategy.yaml declares \`wallet_env: ${fault.instance.walletEnv}\` ` +
|
|
68
|
+
`for instance "${fault.instance.name}"`,
|
|
69
|
+
why: "`senpi deploy` creates and funds a wallet for this instance and passes it in by substituting " +
|
|
70
|
+
`\`${fault.expected}\` into this file. Nothing here carries that token, so nothing would be ` +
|
|
71
|
+
"substituted — silently, because the unresolved-placeholder check only looks for `${...}` " +
|
|
72
|
+
"left over. The deploy would fund a new wallet and then install this strategy, exit engine " +
|
|
73
|
+
"included, against a different account: the funded wallet left with nothing watching it, and " +
|
|
74
|
+
"the install reporting the address in this file.",
|
|
75
|
+
fix: `Set \`strategy.wallet\` in ${file} to \`"${fault.expected}"\`. Deploy substitutes the wallet ` +
|
|
76
|
+
`it creates; a literal address is never what you want for an instance the manifest funds. ` +
|
|
77
|
+
`\`senpi deploy\` reads the same two files and refuses for the same reason.`,
|
|
78
|
+
evidence: {
|
|
79
|
+
instance: fault.instance.name,
|
|
80
|
+
wallet_env: fault.instance.walletEnv,
|
|
81
|
+
expected: fault.expected,
|
|
82
|
+
declared: fault.declared,
|
|
83
|
+
file,
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/** Package-relative where it sits underneath, absolute otherwise — as `universe-stage.ts` renders. */
|
|
88
|
+
function asPath(base, absolute) {
|
|
89
|
+
const rel = relative(base, absolute);
|
|
90
|
+
return rel === "" || rel.startsWith("..") || isAbsolute(rel) ? absolute : rel;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=wallet-binding-stage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet-binding-stage.js","sourceRoot":"","sources":["../../src/validate/wallet-binding-stage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAA+C,MAAM,sBAAsB,CAAC;AAC3G,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAsB;IAC1D,IAAI,MAAM,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;QAC3C,8FAA8F;QAC9F,qEAAqE;QACrE,gGAAgG;QAChG,2FAA2F;QAC3F,2EAA2E;QAC3E,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;IACvB,IAAI,GAAG,KAAK,SAAS,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IAEpE,MAAM,KAAK,GAAG,sBAAsB,CAAC,GAAG,CAAC,CAAC,IAAI,CAC5C,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,eAAe,KAAK,MAAM,CAAC,UAAU,CACxE,CAAC;IACF,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,oBAAoB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CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC;AAChF,CAAC"}
|
package/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "runtime",
|
|
3
3
|
"name": "Senpi Runtime",
|
|
4
4
|
"description": "Senpi runtime plugin for OpenClaw. Orchestrates scanners, LLM-based trade decisions, and a DSL trailing stop-loss exit engine.",
|
|
5
|
-
"version": "3.0.
|
|
5
|
+
"version": "3.0.80",
|
|
6
6
|
"commandAliases": [
|
|
7
7
|
{
|
|
8
8
|
"name": "senpi"
|