@senpi/runtime 3.0.58 → 3.0.62
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 +73 -2
- package/dist/actions/action-events.d.ts +3 -3
- package/dist/actions/action-events.d.ts.map +1 -1
- package/dist/actions/action-events.js +24 -16
- package/dist/actions/action-events.js.map +1 -1
- package/dist/actions/action-runtime-module.d.ts.map +1 -1
- package/dist/actions/action-runtime-module.js +18 -1
- package/dist/actions/action-runtime-module.js.map +1 -1
- package/dist/actions/close-position/close-position.action.d.ts.map +1 -1
- package/dist/actions/close-position/close-position.action.js +84 -11
- package/dist/actions/close-position/close-position.action.js.map +1 -1
- package/dist/actions/decision-engine.d.ts +0 -2
- package/dist/actions/decision-engine.d.ts.map +1 -1
- package/dist/actions/decision-engine.js +1 -79
- package/dist/actions/decision-engine.js.map +1 -1
- package/dist/actions/event-derivation.d.ts +40 -2
- package/dist/actions/event-derivation.d.ts.map +1 -1
- package/dist/actions/event-derivation.js +178 -5
- package/dist/actions/event-derivation.js.map +1 -1
- package/dist/actions/open-position/open-position.action.d.ts.map +1 -1
- package/dist/actions/open-position/open-position.action.js +103 -16
- package/dist/actions/open-position/open-position.action.js.map +1 -1
- package/dist/actions/position-tracker/position-tracker.action.d.ts +2 -1
- package/dist/actions/position-tracker/position-tracker.action.d.ts.map +1 -1
- package/dist/actions/position-tracker/position-tracker.action.js +47 -15
- package/dist/actions/position-tracker/position-tracker.action.js.map +1 -1
- package/dist/actions/skipped-signal-results.d.ts +16 -0
- package/dist/actions/skipped-signal-results.d.ts.map +1 -0
- package/dist/actions/skipped-signal-results.js +47 -0
- package/dist/actions/skipped-signal-results.js.map +1 -0
- package/dist/cli/deploy-render.d.ts +91 -0
- package/dist/cli/deploy-render.d.ts.map +1 -0
- package/dist/cli/deploy-render.js +216 -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 +78 -6
- 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 +164 -5
- 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 +32 -1
- package/dist/cli/validate-command.js.map +1 -1
- package/dist/deploy/deadlines.d.ts +47 -0
- package/dist/deploy/deadlines.d.ts.map +1 -0
- package/dist/deploy/deadlines.js +56 -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 +87 -0
- package/dist/deploy/funding.d.ts.map +1 -0
- package/dist/deploy/funding.js +229 -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 +199 -0
- package/dist/deploy/job.d.ts.map +1 -0
- package/dist/deploy/job.js +463 -0
- package/dist/deploy/job.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 +305 -0
- package/dist/deploy/orchestrator.d.ts.map +1 -0
- package/dist/deploy/orchestrator.js +2910 -0
- package/dist/deploy/orchestrator.js.map +1 -0
- package/dist/deploy/package.d.ts +130 -0
- package/dist/deploy/package.d.ts.map +1 -0
- package/dist/deploy/package.js +351 -0
- package/dist/deploy/package.js.map +1 -0
- package/dist/deploy/proof-gate.d.ts +82 -0
- package/dist/deploy/proof-gate.d.ts.map +1 -0
- package/dist/deploy/proof-gate.js +269 -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 +59 -0
- package/dist/deploy/recheck-commands.js.map +1 -0
- package/dist/deploy/register.d.ts +99 -0
- package/dist/deploy/register.d.ts.map +1 -0
- package/dist/deploy/register.js +689 -0
- package/dist/deploy/register.js.map +1 -0
- package/dist/deploy/taxonomy.d.ts +24 -0
- package/dist/deploy/taxonomy.d.ts.map +1 -0
- package/dist/deploy/taxonomy.js +31 -0
- package/dist/deploy/taxonomy.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +244 -132
- package/dist/index.js.map +1 -1
- package/dist/runtime/lifecycle-events.d.ts +13 -0
- package/dist/runtime/lifecycle-events.d.ts.map +1 -1
- package/dist/runtime/lifecycle-events.js +32 -0
- package/dist/runtime/lifecycle-events.js.map +1 -1
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +3 -1
- package/dist/runtime/runtime.js.map +1 -1
- 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/supervisor/long-running-supervisor.d.ts +8 -0
- package/dist/runtime/supervisor/long-running-supervisor.d.ts.map +1 -1
- package/dist/runtime/supervisor/long-running-supervisor.js +1 -0
- package/dist/runtime/supervisor/long-running-supervisor.js.map +1 -1
- package/dist/runtime-api/intake/intake-events.d.ts +19 -3
- package/dist/runtime-api/intake/intake-events.d.ts.map +1 -1
- package/dist/runtime-api/intake/intake-events.js +64 -2
- package/dist/runtime-api/intake/intake-events.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/runtime-api/intake/process-signal-post.d.ts.map +1 -1
- package/dist/runtime-api/intake/process-signal-post.js +7 -1
- package/dist/runtime-api/intake/process-signal-post.js.map +1 -1
- package/dist/runtime-api/intake/scanner-launcher.d.ts.map +1 -1
- package/dist/runtime-api/intake/scanner-launcher.js +12 -0
- package/dist/runtime-api/intake/scanner-launcher.js.map +1 -1
- package/dist/runtime-api/intake/types.d.ts +24 -0
- package/dist/runtime-api/intake/types.d.ts.map +1 -1
- package/dist/runtime-api/routes/signals.d.ts.map +1 -1
- package/dist/runtime-api/routes/signals.js +10 -1
- package/dist/runtime-api/routes/signals.js.map +1 -1
- package/dist/runtime-api/routes/signals.schema.d.ts +10 -0
- package/dist/runtime-api/routes/signals.schema.d.ts.map +1 -1
- package/dist/runtime-api/routes/signals.schema.js +14 -0
- package/dist/runtime-api/routes/signals.schema.js.map +1 -1
- package/dist/scanners/events.d.ts +7 -0
- package/dist/scanners/events.d.ts.map +1 -1
- package/dist/scanners/events.js.map +1 -1
- package/dist/scanners/external/scaffold/delivery.py +23 -12
- package/dist/scanners/external/scaffold/scaffold.py +55 -7
- package/dist/scanners/implementations/market-regime.d.ts +1 -1
- package/dist/scanners/runtime-module.d.ts.map +1 -1
- package/dist/scanners/runtime-module.js +10 -2
- package/dist/scanners/runtime-module.js.map +1 -1
- package/dist/senpi/client.d.ts +58 -4
- package/dist/senpi/client.d.ts.map +1 -1
- package/dist/senpi/client.js +192 -15
- 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 +47 -3
- package/dist/senpi/types.d.ts.map +1 -1
- package/dist/skills-manager/manifest.js +1 -1
- package/dist/skills-manager/skills-manifest.json +1 -1
- package/dist/telemetry/event-builders.d.ts +45 -6
- package/dist/telemetry/event-builders.d.ts.map +1 -1
- package/dist/telemetry/event-builders.js +99 -11
- package/dist/telemetry/event-builders.js.map +1 -1
- package/dist/telemetry/metrics.d.ts +37 -2
- package/dist/telemetry/metrics.d.ts.map +1 -1
- package/dist/telemetry/metrics.js +84 -4
- package/dist/telemetry/metrics.js.map +1 -1
- package/dist/telemetry/scanner-tick-event.d.ts +32 -0
- package/dist/telemetry/scanner-tick-event.d.ts.map +1 -0
- package/dist/telemetry/scanner-tick-event.js +32 -0
- package/dist/telemetry/scanner-tick-event.js.map +1 -0
- 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 +275 -0
- package/dist/universe/package-universe.js.map +1 -0
- package/dist/utils/event-catalog.d.ts +58 -0
- package/dist/utils/event-catalog.d.ts.map +1 -1
- package/dist/utils/event-catalog.js +1 -0
- package/dist/utils/event-catalog.js.map +1 -1
- package/dist/validate/codes.d.ts +20 -0
- package/dist/validate/codes.d.ts.map +1 -1
- package/dist/validate/codes.js +36 -0
- package/dist/validate/codes.js.map +1 -1
- package/dist/validate/import-stage.js +5 -5
- package/dist/validate/import-stage.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.js +5 -5
- package/dist/validate/live-stage.js.map +1 -1
- package/dist/validate/proof.d.ts +11 -1
- package/dist/validate/proof.d.ts.map +1 -1
- package/dist/validate/proof.js +7 -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 +5 -0
- package/dist/validate/run.d.ts.map +1 -1
- package/dist/validate/run.js +10 -1
- 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/universe-stage.d.ts +71 -0
- package/dist/validate/universe-stage.d.ts.map +1 -0
- package/dist/validate/universe-stage.js +183 -0
- package/dist/validate/universe-stage.js.map +1 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/dist/runtime/managed-wallet-guard.d.ts +0 -47
- package/dist/runtime/managed-wallet-guard.d.ts.map +0 -1
- package/dist/runtime/managed-wallet-guard.js +0 -106
- package/dist/runtime/managed-wallet-guard.js.map +0 -1
- package/dist/runtime/protection-nudge.d.ts +0 -67
- package/dist/runtime/protection-nudge.d.ts.map +0 -1
- package/dist/runtime/protection-nudge.js +0 -244
- package/dist/runtime/protection-nudge.js.map +0 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two wall-clock bounds a deploy runs under, and the job cap derived from them.
|
|
3
|
+
*
|
|
4
|
+
* DEFAULT_MAX_WAIT_SEC bounds the CREATE wait — how long the verb waits for a wallet to reach
|
|
5
|
+
* ACTIVE. Raising it makes a slow backend less likely to report `pending`, at the cost of a job
|
|
6
|
+
* holding its single-flight slot longer.
|
|
7
|
+
*
|
|
8
|
+
* DEFAULT_TICK_WAIT_SEC bounds the OBSERVE wait — how long it waits for one verified scanner
|
|
9
|
+
* tick. Raising it reduces `installed-unobserved` reports on slow-scheduling scanners; lowering
|
|
10
|
+
* it to 0 skips observation entirely.
|
|
11
|
+
*
|
|
12
|
+
* Both are overridable per call via DeployParams.maxWaitSec / tickWaitSec, and settable through
|
|
13
|
+
* the gateway and the CLI. Change them HERE only: register.ts previously repeated the values as
|
|
14
|
+
* literals inside the job-cap arithmetic, so a change here silently left the cap behind.
|
|
15
|
+
*
|
|
16
|
+
* Three surfaces still QUOTE these numbers in prose rather than deriving them, and a change here
|
|
17
|
+
* has to be carried to all three by hand or they start lying: the `DeployParams` field docs in
|
|
18
|
+
* `orchestrator.ts`, the `--tick-wait` / `--max-wait` option help in `cli/senpi-commands.ts`, and
|
|
19
|
+
* the deploy section of `senpi guide` in `cli/guide-commands.ts`.
|
|
20
|
+
*/
|
|
21
|
+
export declare const DEFAULT_MAX_WAIT_SEC = 150;
|
|
22
|
+
export declare const DEFAULT_TICK_WAIT_SEC = 120;
|
|
23
|
+
/**
|
|
24
|
+
* The accepted range for either wait, in seconds — enforced at the gateway, where a caller's number
|
|
25
|
+
* first enters the verb.
|
|
26
|
+
*
|
|
27
|
+
* `0` is in range and meaningful (`--tick-wait 0` skips observation). A NEGATIVE one is not: it
|
|
28
|
+
* yields a cap already in the past, so the watchdog fires before the first step while the journal
|
|
29
|
+
* narrates a deadline the run never had. The ceiling is an hour, twenty-four times the largest
|
|
30
|
+
* default and far past any real backend wait, and it exists because the product below feeds
|
|
31
|
+
* `setTimeout`: `--max-wait 999999999` overflows the 32-bit timer, which Node then clamps to 1ms —
|
|
32
|
+
* an instantly-dead verb from a typo, narrated as a 999999999s deadline. Nothing is money-unsafe
|
|
33
|
+
* either way; the refusal exists because the alternative is a flatly false narration.
|
|
34
|
+
*/
|
|
35
|
+
export declare const MIN_WAIT_SEC = 0;
|
|
36
|
+
export declare const MAX_WAIT_SEC = 3600;
|
|
37
|
+
/** Is a caller-supplied wait one this verb will run on? `undefined` = "use the default", so yes. */
|
|
38
|
+
export declare function isWaitInRange(value: number | undefined): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Wall-clock cap for the whole job: both waits, per instance, plus 5 minutes of slack.
|
|
41
|
+
*
|
|
42
|
+
* Clamped, and not because the gateway's range check is doubted: this number becomes a `setTimeout`
|
|
43
|
+
* delay AND the figure the watchdog narrates, so the two must agree for every caller. A cap the
|
|
44
|
+
* timer would silently rewrite to 1ms is a deadline the report would then lie about.
|
|
45
|
+
*/
|
|
46
|
+
export declare function jobCapMs(maxWaitSec: number | undefined, tickWaitSec: number | undefined, instanceCount: number): number;
|
|
47
|
+
//# sourceMappingURL=deadlines.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deadlines.d.ts","sourceRoot":"","sources":["../../src/deploy/deadlines.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,oBAAoB,MAAM,CAAC;AACxC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,eAAO,MAAM,YAAY,OAAQ,CAAC;AAKlC,oGAAoG;AACpG,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAEhE;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,aAAa,EAAE,MAAM,GACpB,MAAM,CAKR"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two wall-clock bounds a deploy runs under, and the job cap derived from them.
|
|
3
|
+
*
|
|
4
|
+
* DEFAULT_MAX_WAIT_SEC bounds the CREATE wait — how long the verb waits for a wallet to reach
|
|
5
|
+
* ACTIVE. Raising it makes a slow backend less likely to report `pending`, at the cost of a job
|
|
6
|
+
* holding its single-flight slot longer.
|
|
7
|
+
*
|
|
8
|
+
* DEFAULT_TICK_WAIT_SEC bounds the OBSERVE wait — how long it waits for one verified scanner
|
|
9
|
+
* tick. Raising it reduces `installed-unobserved` reports on slow-scheduling scanners; lowering
|
|
10
|
+
* it to 0 skips observation entirely.
|
|
11
|
+
*
|
|
12
|
+
* Both are overridable per call via DeployParams.maxWaitSec / tickWaitSec, and settable through
|
|
13
|
+
* the gateway and the CLI. Change them HERE only: register.ts previously repeated the values as
|
|
14
|
+
* literals inside the job-cap arithmetic, so a change here silently left the cap behind.
|
|
15
|
+
*
|
|
16
|
+
* Three surfaces still QUOTE these numbers in prose rather than deriving them, and a change here
|
|
17
|
+
* has to be carried to all three by hand or they start lying: the `DeployParams` field docs in
|
|
18
|
+
* `orchestrator.ts`, the `--tick-wait` / `--max-wait` option help in `cli/senpi-commands.ts`, and
|
|
19
|
+
* the deploy section of `senpi guide` in `cli/guide-commands.ts`.
|
|
20
|
+
*/
|
|
21
|
+
export const DEFAULT_MAX_WAIT_SEC = 150;
|
|
22
|
+
export const DEFAULT_TICK_WAIT_SEC = 120;
|
|
23
|
+
/**
|
|
24
|
+
* The accepted range for either wait, in seconds — enforced at the gateway, where a caller's number
|
|
25
|
+
* first enters the verb.
|
|
26
|
+
*
|
|
27
|
+
* `0` is in range and meaningful (`--tick-wait 0` skips observation). A NEGATIVE one is not: it
|
|
28
|
+
* yields a cap already in the past, so the watchdog fires before the first step while the journal
|
|
29
|
+
* narrates a deadline the run never had. The ceiling is an hour, twenty-four times the largest
|
|
30
|
+
* default and far past any real backend wait, and it exists because the product below feeds
|
|
31
|
+
* `setTimeout`: `--max-wait 999999999` overflows the 32-bit timer, which Node then clamps to 1ms —
|
|
32
|
+
* an instantly-dead verb from a typo, narrated as a 999999999s deadline. Nothing is money-unsafe
|
|
33
|
+
* either way; the refusal exists because the alternative is a flatly false narration.
|
|
34
|
+
*/
|
|
35
|
+
export const MIN_WAIT_SEC = 0;
|
|
36
|
+
export const MAX_WAIT_SEC = 3_600;
|
|
37
|
+
/** Node clamps a `setTimeout` delay past this to 1ms — the reason the ceiling above exists. */
|
|
38
|
+
const MAX_TIMER_MS = 2_147_483_647;
|
|
39
|
+
/** Is a caller-supplied wait one this verb will run on? `undefined` = "use the default", so yes. */
|
|
40
|
+
export function isWaitInRange(value) {
|
|
41
|
+
return value === undefined || (Number.isFinite(value) && value >= MIN_WAIT_SEC && value <= MAX_WAIT_SEC);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Wall-clock cap for the whole job: both waits, per instance, plus 5 minutes of slack.
|
|
45
|
+
*
|
|
46
|
+
* Clamped, and not because the gateway's range check is doubted: this number becomes a `setTimeout`
|
|
47
|
+
* delay AND the figure the watchdog narrates, so the two must agree for every caller. A cap the
|
|
48
|
+
* timer would silently rewrite to 1ms is a deadline the report would then lie about.
|
|
49
|
+
*/
|
|
50
|
+
export function jobCapMs(maxWaitSec, tickWaitSec, instanceCount) {
|
|
51
|
+
const maxWait = maxWaitSec ?? DEFAULT_MAX_WAIT_SEC;
|
|
52
|
+
const tickWait = tickWaitSec ?? DEFAULT_TICK_WAIT_SEC;
|
|
53
|
+
const cap = (maxWait + tickWait) * instanceCount * 1000 + 300_000;
|
|
54
|
+
return Math.min(Math.max(cap, 1_000), MAX_TIMER_MS);
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=deadlines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deadlines.js","sourceRoot":"","sources":["../../src/deploy/deadlines.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACxC,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAEzC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC;AAC9B,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC;AAElC,+FAA+F;AAC/F,MAAM,YAAY,GAAG,aAAa,CAAC;AAEnC,oGAAoG;AACpG,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,OAAO,KAAK,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,YAAY,IAAI,KAAK,IAAI,YAAY,CAAC,CAAC;AAC3G,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CACtB,UAA8B,EAC9B,WAA+B,EAC/B,aAAqB;IAErB,MAAM,OAAO,GAAG,UAAU,IAAI,oBAAoB,CAAC;IACnD,MAAM,QAAQ,GAAG,WAAW,IAAI,qBAAqB,CAAC;IACtD,MAAM,GAAG,GAAG,CAAC,OAAO,GAAG,QAAQ,CAAC,GAAG,aAAa,GAAG,IAAI,GAAG,OAAO,CAAC;IAClE,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,YAAY,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading the text off a thrown value, for the deploy path.
|
|
3
|
+
*
|
|
4
|
+
* Its own module because both consumers are on the money path and neither may import the other:
|
|
5
|
+
* `orchestrator.ts` already imports `../universe/package-universe.ts`, so putting it in either would
|
|
6
|
+
* make a cycle, and a second hand-rolled copy is how the two drifted in the first place.
|
|
7
|
+
*/
|
|
8
|
+
/** What a value with no readable text is called, so the report says so instead of inventing one. */
|
|
9
|
+
export declare const UNREADABLE_ERROR = "an error whose message could not be read";
|
|
10
|
+
/**
|
|
11
|
+
* The text of a thrown value — TOTAL, because every caller is a catch block whose job is to keep the
|
|
12
|
+
* deploy report alive.
|
|
13
|
+
*
|
|
14
|
+
* Reading a thrown value is itself an operation that can throw: a `message` getter that raises, a
|
|
15
|
+
* null-prototype object `String()` cannot convert to a primitive, a hostile `toString`. Those come
|
|
16
|
+
* off the wire like any other error, and a throw here happens INSIDE the catch — so it discards the
|
|
17
|
+
* original error, escapes `runDeploy` and costs the whole report the deploy just earned. An error
|
|
18
|
+
* we cannot name is still an error we must report, so it degrades rather than raising.
|
|
19
|
+
*
|
|
20
|
+
* The degraded form still says everything it can: the constructor name usually survives a hostile
|
|
21
|
+
* `message`, and on an error with nothing else readable it is the only diagnostic left — a
|
|
22
|
+
* `TimeoutError` and a `ZodError` send a reader to different places.
|
|
23
|
+
*/
|
|
24
|
+
export declare function errorText(err: unknown): string;
|
|
25
|
+
//# sourceMappingURL=error-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-text.d.ts","sourceRoot":"","sources":["../../src/deploy/error-text.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,oGAAoG;AACpG,eAAO,MAAM,gBAAgB,6CAA6C,CAAC;AAE3E;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAM9C"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading the text off a thrown value, for the deploy path.
|
|
3
|
+
*
|
|
4
|
+
* Its own module because both consumers are on the money path and neither may import the other:
|
|
5
|
+
* `orchestrator.ts` already imports `../universe/package-universe.ts`, so putting it in either would
|
|
6
|
+
* make a cycle, and a second hand-rolled copy is how the two drifted in the first place.
|
|
7
|
+
*/
|
|
8
|
+
/** What a value with no readable text is called, so the report says so instead of inventing one. */
|
|
9
|
+
export const UNREADABLE_ERROR = "an error whose message could not be read";
|
|
10
|
+
/**
|
|
11
|
+
* The text of a thrown value — TOTAL, because every caller is a catch block whose job is to keep the
|
|
12
|
+
* deploy report alive.
|
|
13
|
+
*
|
|
14
|
+
* Reading a thrown value is itself an operation that can throw: a `message` getter that raises, a
|
|
15
|
+
* null-prototype object `String()` cannot convert to a primitive, a hostile `toString`. Those come
|
|
16
|
+
* off the wire like any other error, and a throw here happens INSIDE the catch — so it discards the
|
|
17
|
+
* original error, escapes `runDeploy` and costs the whole report the deploy just earned. An error
|
|
18
|
+
* we cannot name is still an error we must report, so it degrades rather than raising.
|
|
19
|
+
*
|
|
20
|
+
* The degraded form still says everything it can: the constructor name usually survives a hostile
|
|
21
|
+
* `message`, and on an error with nothing else readable it is the only diagnostic left — a
|
|
22
|
+
* `TimeoutError` and a `ZodError` send a reader to different places.
|
|
23
|
+
*/
|
|
24
|
+
export function errorText(err) {
|
|
25
|
+
try {
|
|
26
|
+
return err instanceof Error ? String(err.message) : String(err);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return `${UNREADABLE_ERROR}${errorTypeSuffix(err)}`;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** ` (TimeoutError)` when the thrown value's constructor name is readable, else nothing. */
|
|
33
|
+
function errorTypeSuffix(err) {
|
|
34
|
+
try {
|
|
35
|
+
const name = err?.constructor?.name;
|
|
36
|
+
return typeof name === "string" && name.length > 0 ? ` (${name})` : "";
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return "";
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=error-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-text.js","sourceRoot":"","sources":["../../src/deploy/error-text.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,oGAAoG;AACpG,MAAM,CAAC,MAAM,gBAAgB,GAAG,0CAA0C,CAAC;AAE3E;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,SAAS,CAAC,GAAY;IACpC,IAAI,CAAC;QACH,OAAO,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAClE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,gBAAgB,GAAG,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC;IACtD,CAAC;AACH,CAAC;AAED,4FAA4F;AAC5F,SAAS,eAAe,CAAC,GAAY;IACnC,IAAI,CAAC;QACH,MAAM,IAAI,GAAI,GAA4C,EAAE,WAAW,EAAE,IAAI,CAAC;QAC9E,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACzE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/** The platform per-wallet floor, under this module's own long-standing name. */
|
|
2
|
+
export { WALLET_FLOOR as MIN_WALLET, FEE_BUFFER } from "./min-budget.js";
|
|
3
|
+
/** Lifecycle-relevant per-instance funding inputs — the only fields this module reads. */
|
|
4
|
+
export interface FundingInstance {
|
|
5
|
+
name: string;
|
|
6
|
+
fundingShare: number | null;
|
|
7
|
+
}
|
|
8
|
+
export interface Shortfall {
|
|
9
|
+
requested: number;
|
|
10
|
+
available: number;
|
|
11
|
+
usable: number;
|
|
12
|
+
shortBy: number;
|
|
13
|
+
wallets: number;
|
|
14
|
+
shares: number[];
|
|
15
|
+
}
|
|
16
|
+
export interface FundingPlan {
|
|
17
|
+
/** instance name → initialBudget for the create call. */
|
|
18
|
+
amounts: Map<string, number>;
|
|
19
|
+
/** Non-null means HALT: the budget is a hard target, never silently scaled down. */
|
|
20
|
+
shortfall: Shortfall | null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Total USDC `strategy_create_custom_strategy` can fund from — its whole
|
|
24
|
+
* waterfall, in order: HL perps → HL spot USDC → EVM USDC (auto-bridged).
|
|
25
|
+
*
|
|
26
|
+
* These are DISJOINT buckets, so reading one reads a FRACTION of the fundable
|
|
27
|
+
* balance. `total_withdrawable` is deliberately EXCLUDED: it is free margin
|
|
28
|
+
* sitting inside OTHER strategy wallets, not spendable here.
|
|
29
|
+
*
|
|
30
|
+
* Returns null when no bucket key is present at all — an unknown shape must
|
|
31
|
+
* never halt a deploy the backend would have funded.
|
|
32
|
+
*/
|
|
33
|
+
export declare function accessibleUsd(payload: Record<string, unknown> | null): number | null;
|
|
34
|
+
/**
|
|
35
|
+
* Per-instance `initialBudget` for the instances still needing a wallet, split
|
|
36
|
+
* by `fundingShare` and floored at {@link MIN_WALLET}.
|
|
37
|
+
*
|
|
38
|
+
* The requested budget is a HARD TARGET: on shortfall the caller HALTS. Scaling
|
|
39
|
+
* every wallet down to fit turned a "$1,000 across 2 wallets" request into two
|
|
40
|
+
* floor wallets, silently — that is the bug this shape exists to prevent.
|
|
41
|
+
*/
|
|
42
|
+
export declare function planFunding(instances: FundingInstance[], budget: number, available: number | null): FundingPlan;
|
|
43
|
+
/**
|
|
44
|
+
* The largest budget `b` whose funding plan still fits within `usable`:
|
|
45
|
+
* `b* = max { b : Σᵢ max(MIN_WALLET, round2(b·shareᵢ)) ≤ usable }`.
|
|
46
|
+
*
|
|
47
|
+
* Bisected in integer cents with the SAME per-wallet rounding `planFunding`
|
|
48
|
+
* uses, so re-running deploy at the hinted budget round-trips with no shortfall
|
|
49
|
+
* even for uneven shares — where the bare `usable` over-hints, because a floored
|
|
50
|
+
* small leg pushes the funded total above the budget.
|
|
51
|
+
*/
|
|
52
|
+
export declare function maxFeasibleBudget(instances: Array<{
|
|
53
|
+
fundingShare: number | null;
|
|
54
|
+
}>, usable: number): number;
|
|
55
|
+
/** Money in agent-facing prose: comma-grouped, two decimals, never scientific notation. */
|
|
56
|
+
export declare function usd(value: number): string;
|
|
57
|
+
/**
|
|
58
|
+
* A dollar amount as the `--budget` flag accepts it: bare digits, no `$`, no
|
|
59
|
+
* comma grouping. {@link usd}'s commas would not parse as a number, so a hinted
|
|
60
|
+
* command an agent copies verbatim must render the flag value with this.
|
|
61
|
+
*/
|
|
62
|
+
export declare function budgetArg(value: number): string;
|
|
63
|
+
/**
|
|
64
|
+
* The re-run command every deploy surface emits — ONE producer, because the same report prints it
|
|
65
|
+
* more than once (a refusal's copy and the report's `next` line) and two copies drifting would hand
|
|
66
|
+
* the reader two different commands for one situation. `budget` undefined renders the placeholder
|
|
67
|
+
* the caller must fill in, never a fabricated number.
|
|
68
|
+
*
|
|
69
|
+
* The path is single-quoted for the same reason `pkg.id` is wherever it is emitted: these strings
|
|
70
|
+
* are copied into a shell verbatim, and a real workspace path with a space in it
|
|
71
|
+
* ("/data/My Strategies/spider") would otherwise render a command that cannot run. Quoting is
|
|
72
|
+
* unconditional — a conditional quote is a second rule to get wrong, and the quoted form is
|
|
73
|
+
* correct for every path.
|
|
74
|
+
*/
|
|
75
|
+
export declare function resumeCommand(packageDir: string, budget?: number): string;
|
|
76
|
+
/**
|
|
77
|
+
* Agent-facing halt text for a funding shortfall.
|
|
78
|
+
*
|
|
79
|
+
* The lower-budget escape renders ONLY when the usable balance can still fund
|
|
80
|
+
* every wallet at the {@link MIN_WALLET} floor. Below that no budget is valid,
|
|
81
|
+
* and suggesting one produces nonsense the agent then follows ("--budget ≤ $0",
|
|
82
|
+
* the M381223 churn). Codes: senpi-skills `docs/error-code-taxonomy.md`.
|
|
83
|
+
*/
|
|
84
|
+
export declare function underfundedNote(shortfall: Shortfall, instances: Array<{
|
|
85
|
+
fundingShare: number | null;
|
|
86
|
+
}>, packageDir: string): string;
|
|
87
|
+
//# sourceMappingURL=funding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"funding.d.ts","sourceRoot":"","sources":["../../src/deploy/funding.ts"],"names":[],"mappings":"AAqBA,iFAAiF;AACjF,OAAO,EAAE,YAAY,IAAI,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEzE,0FAA0F;AAC1F,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,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ploy.py v2.11.0's
|
|
3
|
+
* `available_usd` / `plan_funding` / `max_feasible_budget` / `underfunded_note`.
|
|
4
|
+
*
|
|
5
|
+
* This layer is UX, not enforcement: the backend funds from its own waterfall
|
|
6
|
+
* during `strategy_create_custom_strategy` and remains the authority on
|
|
7
|
+
* sufficiency. So it refuses only on POSITIVE evidence of a shortfall — an
|
|
8
|
+
* unreadable or unrecognised portfolio shape yields `null` and the deploy
|
|
9
|
+
* proceeds (create fails loudly if the balance really is short). Under-counting
|
|
10
|
+
* is the dangerous direction: it produced the Starling false refusal, where
|
|
11
|
+
* ~$248 of idle Base USDC was invisible to a single-bucket read.
|
|
12
|
+
*
|
|
13
|
+
* The two platform constants it runs on live in `min-budget.ts`, which mirrors
|
|
14
|
+
* `senpi-strategy-ops/scripts/min_budget.py` in Senpi-ai/senpi-skills — ONE source of truth for the
|
|
15
|
+
* physics on each side: a **$10** per-wallet floor (`WALLET_FLOOR`, itself mirroring the backend's
|
|
16
|
+
* `MINIMUM_STRATEGY_BUDGET` default) and a **$1.50** per-wallet fee buffer. Change them there, never
|
|
17
|
+
* here, and never against a remembered number: the floor was $100 until the skills $10-minimum
|
|
18
|
+
* rollout (#519/#521), and every refusal below quotes whatever the constant says.
|
|
19
|
+
*/
|
|
20
|
+
import { FEE_BUFFER, WALLET_FLOOR as MIN_WALLET } from "./min-budget.js";
|
|
21
|
+
/** The platform per-wallet floor, under this module's own long-standing name. */
|
|
22
|
+
export { WALLET_FLOOR as MIN_WALLET, FEE_BUFFER } from "./min-budget.js";
|
|
23
|
+
function round2(value) {
|
|
24
|
+
return Math.round(value * 100) / 100;
|
|
25
|
+
}
|
|
26
|
+
function isRecord(value) {
|
|
27
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* First of `values` that parses as a finite number, else 0.
|
|
31
|
+
*
|
|
32
|
+
* The payload mixes numbers, numeric strings (`spot_balances` rows carry
|
|
33
|
+
* `"5.46"`) and nulls — a null must fall THROUGH to the next candidate rather
|
|
34
|
+
* than zero the row, because an under-count here is a false `underfunded` halt.
|
|
35
|
+
*/
|
|
36
|
+
function firstNumber(...values) {
|
|
37
|
+
for (const value of values) {
|
|
38
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
39
|
+
return value;
|
|
40
|
+
if (typeof value === "string" && value.trim() !== "") {
|
|
41
|
+
const parsed = Number(value);
|
|
42
|
+
if (Number.isFinite(parsed))
|
|
43
|
+
return parsed;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return 0;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* USD held as USDC in a balance list (`spot_balances` / `token_balances`).
|
|
50
|
+
* Filtered by symbol because the funding waterfall pulls USDC, while the
|
|
51
|
+
* `total_*` scalars lump in every other token — a spot HYPE bag or EVM WETH is
|
|
52
|
+
* not fundable balance. Deliberately chain-agnostic: hardcoding the bridgeable
|
|
53
|
+
* chain list is how this gate would start refusing fundable deploys the day a
|
|
54
|
+
* chain is added.
|
|
55
|
+
*/
|
|
56
|
+
function usdcUsd(rows, ...keys) {
|
|
57
|
+
if (!Array.isArray(rows))
|
|
58
|
+
return 0;
|
|
59
|
+
return rows.reduce((sum, row) => {
|
|
60
|
+
if (!isRecord(row))
|
|
61
|
+
return sum;
|
|
62
|
+
if (String(row.tokenSymbol ?? "").trim().toUpperCase() !== "USDC")
|
|
63
|
+
return sum;
|
|
64
|
+
return sum + firstNumber(...keys.map((key) => row[key]));
|
|
65
|
+
}, 0);
|
|
66
|
+
}
|
|
67
|
+
/** The bucket keys whose presence proves the payload is a portfolio we understand. */
|
|
68
|
+
const BUCKET_KEYS = [
|
|
69
|
+
"total_in_hyperliquid",
|
|
70
|
+
"total_spot_usd_in_hyperliquid",
|
|
71
|
+
"spot_balances",
|
|
72
|
+
"token_balances",
|
|
73
|
+
];
|
|
74
|
+
/**
|
|
75
|
+
* Total USDC `strategy_create_custom_strategy` can fund from — its whole
|
|
76
|
+
* waterfall, in order: HL perps → HL spot USDC → EVM USDC (auto-bridged).
|
|
77
|
+
*
|
|
78
|
+
* These are DISJOINT buckets, so reading one reads a FRACTION of the fundable
|
|
79
|
+
* balance. `total_withdrawable` is deliberately EXCLUDED: it is free margin
|
|
80
|
+
* sitting inside OTHER strategy wallets, not spendable here.
|
|
81
|
+
*
|
|
82
|
+
* Returns null when no bucket key is present at all — an unknown shape must
|
|
83
|
+
* never halt a deploy the backend would have funded.
|
|
84
|
+
*/
|
|
85
|
+
export function accessibleUsd(payload) {
|
|
86
|
+
const portfolio = isRecord(payload?.portfolio) ? payload.portfolio : null;
|
|
87
|
+
if (!portfolio)
|
|
88
|
+
return null;
|
|
89
|
+
if (!BUCKET_KEYS.some((key) => portfolio[key] !== undefined && portfolio[key] !== null))
|
|
90
|
+
return null;
|
|
91
|
+
const perps = firstNumber(portfolio.total_in_hyperliquid);
|
|
92
|
+
const spotRows = portfolio.spot_balances;
|
|
93
|
+
const spot = Array.isArray(spotRows) && spotRows.length > 0
|
|
94
|
+
? usdcUsd(spotRows, "usdValue", "total")
|
|
95
|
+
: firstNumber(portfolio.total_spot_usd_in_hyperliquid);
|
|
96
|
+
const evm = usdcUsd(portfolio.token_balances, "balanceInUSD", "formattedBalance");
|
|
97
|
+
return round2(perps + spot + evm);
|
|
98
|
+
}
|
|
99
|
+
function sharesOf(instances) {
|
|
100
|
+
return instances.map((inst) => inst.fundingShare ?? 1 / instances.length);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Per-instance `initialBudget` for the instances still needing a wallet, split
|
|
104
|
+
* by `fundingShare` and floored at {@link MIN_WALLET}.
|
|
105
|
+
*
|
|
106
|
+
* The requested budget is a HARD TARGET: on shortfall the caller HALTS. Scaling
|
|
107
|
+
* every wallet down to fit turned a "$1,000 across 2 wallets" request into two
|
|
108
|
+
* floor wallets, silently — that is the bug this shape exists to prevent.
|
|
109
|
+
*/
|
|
110
|
+
export function planFunding(instances, budget, available) {
|
|
111
|
+
const shares = sharesOf(instances);
|
|
112
|
+
const amounts = new Map(instances.map((inst, i) => [inst.name, Math.max(MIN_WALLET, round2((budget || 0) * shares[i]))]));
|
|
113
|
+
const requested = round2([...amounts.values()].reduce((sum, amount) => sum + amount, 0));
|
|
114
|
+
let shortfall = null;
|
|
115
|
+
if (available !== null) {
|
|
116
|
+
const usable = Math.max(0, round2(available - FEE_BUFFER * instances.length));
|
|
117
|
+
if (requested > usable) {
|
|
118
|
+
shortfall = {
|
|
119
|
+
requested,
|
|
120
|
+
available: round2(available),
|
|
121
|
+
usable,
|
|
122
|
+
shortBy: round2(requested - usable),
|
|
123
|
+
wallets: instances.length,
|
|
124
|
+
shares,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return { amounts, shortfall };
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The largest budget `b` whose funding plan still fits within `usable`:
|
|
132
|
+
* `b* = max { b : Σᵢ max(MIN_WALLET, round2(b·shareᵢ)) ≤ usable }`.
|
|
133
|
+
*
|
|
134
|
+
* Bisected in integer cents with the SAME per-wallet rounding `planFunding`
|
|
135
|
+
* uses, so re-running deploy at the hinted budget round-trips with no shortfall
|
|
136
|
+
* even for uneven shares — where the bare `usable` over-hints, because a floored
|
|
137
|
+
* small leg pushes the funded total above the budget.
|
|
138
|
+
*/
|
|
139
|
+
export function maxFeasibleBudget(instances, usable) {
|
|
140
|
+
const shares = sharesOf(instances);
|
|
141
|
+
const totalCents = (cents) => {
|
|
142
|
+
const budget = cents / 100;
|
|
143
|
+
const total = shares.reduce((sum, share) => sum + Math.max(MIN_WALLET, round2(budget * share)), 0);
|
|
144
|
+
return Math.round(total * 100);
|
|
145
|
+
};
|
|
146
|
+
const usableCents = Math.round(usable * 100);
|
|
147
|
+
if (totalCents(0) > usableCents)
|
|
148
|
+
return 0; // even the all-floor minimum cannot fit
|
|
149
|
+
let lo = 0;
|
|
150
|
+
let hi = usableCents + shares.length * Math.round(MIN_WALLET * 100) + 100;
|
|
151
|
+
while (totalCents(hi) <= usableCents)
|
|
152
|
+
hi *= 2; // keep hi a true upper bound (defensive vs Σshare < 1)
|
|
153
|
+
while (lo < hi) {
|
|
154
|
+
const mid = Math.floor((lo + hi + 1) / 2);
|
|
155
|
+
if (totalCents(mid) <= usableCents)
|
|
156
|
+
lo = mid;
|
|
157
|
+
else
|
|
158
|
+
hi = mid - 1;
|
|
159
|
+
}
|
|
160
|
+
return lo / 100;
|
|
161
|
+
}
|
|
162
|
+
/** Money in agent-facing prose: comma-grouped, two decimals, never scientific notation. */
|
|
163
|
+
export function usd(value) {
|
|
164
|
+
return `$${value.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* A dollar amount as the `--budget` flag accepts it: bare digits, no `$`, no
|
|
168
|
+
* comma grouping. {@link usd}'s commas would not parse as a number, so a hinted
|
|
169
|
+
* command an agent copies verbatim must render the flag value with this.
|
|
170
|
+
*/
|
|
171
|
+
export function budgetArg(value) {
|
|
172
|
+
return String(Number(value.toFixed(2)));
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The re-run command every deploy surface emits — ONE producer, because the same report prints it
|
|
176
|
+
* more than once (a refusal's copy and the report's `next` line) and two copies drifting would hand
|
|
177
|
+
* the reader two different commands for one situation. `budget` undefined renders the placeholder
|
|
178
|
+
* the caller must fill in, never a fabricated number.
|
|
179
|
+
*
|
|
180
|
+
* The path is single-quoted for the same reason `pkg.id` is wherever it is emitted: these strings
|
|
181
|
+
* are copied into a shell verbatim, and a real workspace path with a space in it
|
|
182
|
+
* ("/data/My Strategies/spider") would otherwise render a command that cannot run. Quoting is
|
|
183
|
+
* unconditional — a conditional quote is a second rule to get wrong, and the quoted form is
|
|
184
|
+
* correct for every path.
|
|
185
|
+
*/
|
|
186
|
+
export function resumeCommand(packageDir, budget) {
|
|
187
|
+
const budgetFlag = budget === undefined ? "--budget <usd>" : `--budget ${budgetArg(budget)}`;
|
|
188
|
+
return `openclaw senpi deploy -p '${packageDir}' ${budgetFlag}`;
|
|
189
|
+
}
|
|
190
|
+
/** The requested/available/usable/short-by facts both refusal branches lead with. */
|
|
191
|
+
function shortfallFacts(shortfall) {
|
|
192
|
+
return (`Requested ${usd(shortfall.requested)} across ${shortfall.wallets} wallet(s) ` +
|
|
193
|
+
`(min ${usd(MIN_WALLET)}/wallet), but only ${usd(shortfall.available)} is accessible ` +
|
|
194
|
+
`(${usd(shortfall.usable)} after fees) — short by ${usd(shortfall.shortBy)}. ` +
|
|
195
|
+
`NOT funding; no wallet was created. `);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Agent-facing halt text for a funding shortfall.
|
|
199
|
+
*
|
|
200
|
+
* The lower-budget escape renders ONLY when the usable balance can still fund
|
|
201
|
+
* every wallet at the {@link MIN_WALLET} floor. Below that no budget is valid,
|
|
202
|
+
* and suggesting one produces nonsense the agent then follows ("--budget ≤ $0",
|
|
203
|
+
* the M381223 churn). Codes: senpi-skills `docs/error-code-taxonomy.md`.
|
|
204
|
+
*/
|
|
205
|
+
export function underfundedNote(shortfall, instances, packageDir) {
|
|
206
|
+
const floorNeeded = shortfall.wallets * MIN_WALLET;
|
|
207
|
+
const facts = shortfallFacts(shortfall);
|
|
208
|
+
if (shortfall.usable < floorNeeded) {
|
|
209
|
+
// Computed from `available`, not `usable`: usable is clamped to 0 when the balance does not
|
|
210
|
+
// even cover the fee reserve, and `floor - usable` would then understate the deposit by up to
|
|
211
|
+
// FEE_BUFFER × wallets — depositing the hinted amount must always clear the floor check.
|
|
212
|
+
const missing = round2(floorNeeded + FEE_BUFFER * shortfall.wallets - shortfall.available);
|
|
213
|
+
return (`[E_FUNDS_BELOW_FLOOR] ${facts}` +
|
|
214
|
+
`No budget can fund ${shortfall.wallets} wallet(s) below the ${usd(MIN_WALLET)}/wallet floor — ` +
|
|
215
|
+
`at least ${usd(missing)} more USDC is needed. Deposit USDC first (the ` +
|
|
216
|
+
`\`senpi-deposit-withdraw-transfer\` skill has the flow), then re-run: ` +
|
|
217
|
+
`\`${resumeCommand(packageDir)}\`. ` +
|
|
218
|
+
`Do NOT retry with a lower --budget: no lower budget is valid.`);
|
|
219
|
+
}
|
|
220
|
+
const best = maxFeasibleBudget(instances, shortfall.usable);
|
|
221
|
+
return (`[E_FUNDS_SHORT] ${facts}` +
|
|
222
|
+
`Two ways forward: deposit at least ${usd(shortfall.shortBy)} more USDC (the ` +
|
|
223
|
+
`\`senpi-deposit-withdraw-transfer\` skill has the flow) and re-run the same command, or ` +
|
|
224
|
+
`confirm a lower amount with the user and re-run: ` +
|
|
225
|
+
`\`${resumeCommand(packageDir, best)}\` — ${usd(best)} is the largest ` +
|
|
226
|
+
`budget your accessible balance can fully fund across these ${shortfall.wallets} wallet(s) at ` +
|
|
227
|
+
`the ${usd(MIN_WALLET)}/wallet floor.`);
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=funding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"funding.js","sourceRoot":"","sources":["../../src/deploy/funding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEzE,iFAAiF;AACjF,OAAO,EAAE,YAAY,IAAI,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAwBzE,SAAS,MAAM,CAAC,KAAa;IAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AACvC,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED;;;;;;GAMG;AACH,SAAS,WAAW,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AG,CAAC,UAAU,CAAC,kBAAkB;YAChG,YAAY,GAAG,CAAC,OAAO,CAAC,gDAAgD;YACxE,wEAAwE;YACxE,KAAK,aAAa,CAAC,UAAU,CAAC,MAAM;YACpC,+DAA+D,CAChE,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,iBAAiB,CAAC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAC5D,OAAO,CACL,mBAAmB,KAAK,EAAE;QAC1B,sCAAsC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,kBAAkB;QAC9E,0FAA0F;QAC1F,mDAAmD;QACnD,KAAK,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,kBAAkB;QACvE,8DAA8D,SAAS,CAAC,OAAO,gBAAgB;QAC/F,OAAO,GAAG,CAAC,UAAU,CAAC,gBAAgB,CACvC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One instance → one install-gate verdict.
|
|
3
|
+
*
|
|
4
|
+
* The gate predicate lives in `validate/install-gate.ts` and is not duplicated here; this module
|
|
5
|
+
* only supplies the findings it decides over, from the instance's own recipe. Deploy calls it
|
|
6
|
+
* BEFORE money so a refusal costs nothing; `installRuntimeCore` calls the same predicate at the
|
|
7
|
+
* gateway boundary for installs that never went through deploy.
|
|
8
|
+
*/
|
|
9
|
+
import { type InstallGateResult } from "../validate/index.js";
|
|
10
|
+
import type { DeployInstance } from "./package.js";
|
|
11
|
+
export declare function gateInstance(inst: DeployInstance): Promise<InstallGateResult>;
|
|
12
|
+
//# sourceMappingURL=install-gate-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-gate-runner.d.ts","sourceRoot":"","sources":["../../src/deploy/install-gate-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAA2C,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACvG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,wBAAsB,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAMnF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One instance → one install-gate verdict.
|
|
3
|
+
*
|
|
4
|
+
* The gate predicate lives in `validate/install-gate.ts` and is not duplicated here; this module
|
|
5
|
+
* only supplies the findings it decides over, from the instance's own recipe. Deploy calls it
|
|
6
|
+
* BEFORE money so a refusal costs nothing; `installRuntimeCore` calls the same predicate at the
|
|
7
|
+
* gateway boundary for installs that never went through deploy.
|
|
8
|
+
*/
|
|
9
|
+
import { checkInstallGate, collectRecipeFindings } from "../validate/index.js";
|
|
10
|
+
export async function gateInstance(inst) {
|
|
11
|
+
const validation = await collectRecipeFindings({
|
|
12
|
+
path: inst.runtimeYamlPath,
|
|
13
|
+
baseDir: inst.runtimeYamlDir,
|
|
14
|
+
});
|
|
15
|
+
return checkInstallGate(validation.findings);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=install-gate-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-gate-runner.js","sourceRoot":"","sources":["../../src/deploy/install-gate-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAA0B,MAAM,sBAAsB,CAAC;AAGvG,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAoB;IACrD,MAAM,UAAU,GAAG,MAAM,qBAAqB,CAAC;QAC7C,IAAI,EAAE,IAAI,CAAC,eAAe;QAC1B,OAAO,EAAE,IAAI,CAAC,cAAc;KAC7B,CAAC,CAAC;IACH,OAAO,gBAAgB,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AAC/C,CAAC"}
|