@senpi/runtime 3.0.198 → 3.0.199
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/dist/cli/deploy-render.d.ts +2 -0
- package/dist/cli/deploy-render.d.ts.map +1 -1
- package/dist/cli/deploy-render.js +2 -0
- package/dist/cli/deploy-render.js.map +1 -1
- package/dist/deploy/messages.d.ts +34 -14
- package/dist/deploy/messages.d.ts.map +1 -1
- package/dist/deploy/messages.js +83 -30
- package/dist/deploy/messages.js.map +1 -1
- package/dist/deploy/orchestrator.d.ts +9 -5
- package/dist/deploy/orchestrator.d.ts.map +1 -1
- package/dist/deploy/orchestrator.js +140 -37
- package/dist/deploy/orchestrator.js.map +1 -1
- package/dist/deploy/package.d.ts +13 -0
- package/dist/deploy/package.d.ts.map +1 -1
- package/dist/deploy/package.js +18 -1
- package/dist/deploy/package.js.map +1 -1
- package/dist/deploy/register.js +3 -3
- package/dist/deploy/register.js.map +1 -1
- package/dist/senpi/__tests__/helpers/fake-paper-mcp.d.ts +8 -0
- package/dist/senpi/__tests__/helpers/fake-paper-mcp.d.ts.map +1 -1
- package/dist/senpi/__tests__/helpers/fake-paper-mcp.js +21 -8
- package/dist/senpi/__tests__/helpers/fake-paper-mcp.js.map +1 -1
- package/dist/senpi/client.d.ts +2 -1
- package/dist/senpi/client.d.ts.map +1 -1
- package/dist/senpi/client.js +5 -6
- package/dist/senpi/client.js.map +1 -1
- package/dist/senpi/strategy-status.d.ts +3 -0
- package/dist/senpi/strategy-status.d.ts.map +1 -1
- package/dist/senpi/strategy-status.js +5 -0
- package/dist/senpi/strategy-status.js.map +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../src/deploy/orchestrator.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,C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AIG;AACH,wBAAsB,SAAS,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CA+pE7F"}
|
|
@@ -27,7 +27,7 @@ import { loadRuntimeConfig } from "../runtime/load-runtime-config.js";
|
|
|
27
27
|
import { catalogCopy, strategyFacts } from "../strategy/facts.js";
|
|
28
28
|
import { buildUniverseNotLiveRefusal, buildUniverseUnavailableDetail, checkPackageUniverse, describeUniverseVerdict, } from "../universe/package-universe.js";
|
|
29
29
|
import { instancesWithoutDslExit, nonLowercasePackageId, renderRuntimeYaml, runtimeUsesLlmDecisions, readRuntimeYaml, runtimeIdFor, scannersDeclaringEnabled, unboundWalletInstances, walletName, } from "./package.js";
|
|
30
|
-
import { DEAD_STATUSES, INITIALIZING_STATUSES, isDead, isInitializing, } from "../senpi/strategy-status.js";
|
|
30
|
+
import { DEAD_STATUSES, INITIALIZING_STATUSES, isClosable, isClosing, isDead, isInitializing, } from "../senpi/strategy-status.js";
|
|
31
31
|
import { MIN_WALLET, accessibleUsd, closeCommand, statusCommand, planFunding, resumeCommand, sharesOverAuthorization, underfundedNote, usd, } from "./funding.js";
|
|
32
32
|
import { DEFAULT_MAX_WAIT_SEC, DEFAULT_TICK_WAIT_SEC, INSTALL_DEADLINE_MS, INSTALL_INDETERMINATE_CODE, isInstallDeadlineExceeded, } from "./deadlines.js";
|
|
33
33
|
import { packageMinBudget } from "./min-budget.js";
|
|
@@ -35,7 +35,7 @@ import { errorText } from "./error-text.js";
|
|
|
35
35
|
import { truncateForPush } from "../types/notification.js";
|
|
36
36
|
import { gateInstance } from "./install-gate-runner.js";
|
|
37
37
|
import { buildInstanceDirCollisionRefusal, buildProofRefusal, checkPackageProof, collidingInstanceDirs, proofRefusalParts, } from "./proof-gate.js";
|
|
38
|
-
import { buildAmbiguousRefusal, buildBindingUnknownRefusal, buildBudgetEscape, buildBudgetNotPositiveRefusal, buildBudgetRequiredRefusal, buildCreateAbandonedDetail, buildCreateDeadDetail, buildCreateNameRetryNotIssuedDetail, buildCreateNotDeployableDetail, buildCreatePendingDetail, buildDecisionModelEnvRefusal, buildDecisionModelRefusal, buildForeignPackageRefusal, buildFundedUnreadableNote, buildInstallGateRefusal, buildInstallGateUnavailableDetail, buildInstallIndeterminateDetail, buildInstallInFlightDetail, buildNoDslExitRefusal, buildNonLowercaseIdRefusal, buildNotDeployableRefusal, buildPaperRoutingUnprovenRefusal, buildPaperCreateWentLiveDetail, buildPartialFundNote, buildScannerEnabledUnsupportedRefusal, buildBoxRuntimeCapRefusal, buildShareOverrunRefusal, buildSoftBudgetNote, buildStrategyLimitRefusal, limitShort, buildUnboundWalletRefusal, buildUnobservedDetail, buildUnreadableWalletRefusal, buildUnwiredInstallDetail, buildRuntimeIdHeldByOtherWorldDetail, buildRuntimeIdHeldByOtherWorldRefusal, buildWalletWorldMismatchDetail, foreignCollisionClause, forwardTense, fundedClause, itsFunded, matchedByClause, reconcileCanMatchByName, rollbackFundedClause, } from "./messages.js";
|
|
38
|
+
import { buildAmbiguousRefusal, buildBindingUnknownRefusal, buildBudgetEscape, buildBudgetNotPositiveRefusal, buildBudgetRequiredRefusal, buildCreateAbandonedDetail, buildCreateDeadDetail, buildCreateNameRetryNotIssuedDetail, buildCreateNotDeployableDetail, buildCreatePendingDetail, buildDecisionModelEnvRefusal, buildDecisionModelRefusal, buildForeignPackageRefusal, buildFundedUnreadableNote, buildInstallGateRefusal, buildInstallGateUnavailableDetail, buildInstallIndeterminateDetail, buildInstallInFlightDetail, buildNoDslExitRefusal, buildNonLowercaseIdRefusal, buildNotDeployableRefusal, buildPaperRoutingUnprovenRefusal, buildPaperCreateWentLiveDetail, buildPartialFundNote, buildScannerEnabledUnsupportedRefusal, buildBoxRuntimeCapRefusal, buildAdoptedOverBoxCapNote, buildShareOverrunRefusal, buildSoftBudgetNote, buildStrategyLimitRefusal, limitShort, buildUnboundWalletRefusal, buildUnobservedDetail, buildUnreadableWalletRefusal, buildUnwiredInstallDetail, buildRuntimeIdHeldByOtherWorldDetail, buildRuntimeIdHeldByOtherWorldRefusal, buildWalletWorldMismatchDetail, foreignCollisionClause, forwardTense, fundedClause, itsFunded, matchedByClause, reconcileCanMatchByName, rollbackFundedClause, } from "./messages.js";
|
|
39
39
|
/** Stands in for the wallet when rendering a recipe only to read its facts, which never include it. */
|
|
40
40
|
const FACTS_STAND_IN_WALLET = "0x0000000000000000000000000000000000000000";
|
|
41
41
|
const CREATE_POLL_MS = 10_000;
|
|
@@ -380,6 +380,10 @@ function buildNext(overall, pkg, budget, runs) {
|
|
|
380
380
|
// via `strategy_list` first) where that detail ran; this footer only names the command.
|
|
381
381
|
return `re-run \`${resumeCommand(pkg, budget)}\` to resume — reconcile re-reads the live list before it creates anything, and what it finds there decides the rest`;
|
|
382
382
|
case "failed":
|
|
383
|
+
if (runs.some((run) => run.report.steps.create.evidence?.wentLive === true)) {
|
|
384
|
+
return (`Read the [E_PAPER_CREATE_WENT_LIVE] step above and follow it. This report offers no re-run: ` +
|
|
385
|
+
`the MCP turned a simulation into a live strategy, and a re-run can do the same.`);
|
|
386
|
+
}
|
|
383
387
|
// "Fix the cause, then re-run" is false for exactly one failure on this verb: an install this
|
|
384
388
|
// deploy stopped WAITING on has no cause to fix — it was never cancelled, and its outcome is
|
|
385
389
|
// unknown — so the footer that outranks every step line (an agent reads the report's `next`
|
|
@@ -584,6 +588,7 @@ export async function runDeploy(params, deps) {
|
|
|
584
588
|
* having created, which is not known until the report is assembled.
|
|
585
589
|
*/
|
|
586
590
|
const soft = { min: null, under: [] };
|
|
591
|
+
let boxCapNote;
|
|
587
592
|
/** Narration is fire-and-forget: a broken journal must never change what a deploy does. */
|
|
588
593
|
const emit = (event) => {
|
|
589
594
|
try {
|
|
@@ -1354,8 +1359,13 @@ export async function runDeploy(params, deps) {
|
|
|
1354
1359
|
await span("deploy.preflight", { "senpi.deploy.step": "preflight" }, async () => {
|
|
1355
1360
|
if (!boundaryAbandoned()) {
|
|
1356
1361
|
try {
|
|
1357
|
-
if (!(await refusedOnRuntimeIdHeldByOtherWorld())
|
|
1358
|
-
|
|
1362
|
+
if (!(await refusedOnRuntimeIdHeldByOtherWorld())) {
|
|
1363
|
+
if (needing.length > 0)
|
|
1364
|
+
await runPreflight();
|
|
1365
|
+
// Only a warning can come of it here, so a failed read must not refuse the deploy.
|
|
1366
|
+
else
|
|
1367
|
+
await refusedOnBoxRuntimeCap().catch((err) => log(`deploy: box cap read failed: ${errorText(err)}`));
|
|
1368
|
+
}
|
|
1359
1369
|
}
|
|
1360
1370
|
catch (err) {
|
|
1361
1371
|
// A thrown preflight is fail-closed: no balance was proven, so nothing is created.
|
|
@@ -1491,15 +1501,36 @@ export async function runDeploy(params, deps) {
|
|
|
1491
1501
|
}
|
|
1492
1502
|
return true;
|
|
1493
1503
|
}
|
|
1504
|
+
/**
|
|
1505
|
+
* Refuses new wallets past the cap. Adopted wallets that still need a runtime count too, but only
|
|
1506
|
+
* toward a warning ({@link DeployReport.boxCapNote}).
|
|
1507
|
+
*/
|
|
1494
1508
|
async function refusedOnBoxRuntimeCap() {
|
|
1495
|
-
const
|
|
1509
|
+
const adopted = await adoptedWalletsNeedingRuntime().catch((err) => {
|
|
1510
|
+
log(`deploy: counting adopted wallets for the box cap failed: ${errorText(err)}`);
|
|
1511
|
+
return [];
|
|
1512
|
+
});
|
|
1496
1513
|
const needed = needing.length;
|
|
1497
|
-
if (
|
|
1514
|
+
if (needed === 0 && adopted.length === 0)
|
|
1498
1515
|
return false;
|
|
1516
|
+
const box = await deps.boxRuntimes();
|
|
1517
|
+
const replaced = await rowsReplacedByNewWallets();
|
|
1518
|
+
const after = box.running - replaced.length + needed;
|
|
1519
|
+
if (needed === 0 || after <= box.cap) {
|
|
1520
|
+
if (after + adopted.length > box.cap) {
|
|
1521
|
+
boxCapNote = buildAdoptedOverBoxCapNote(adopted, after + adopted.length, box.cap, pkg.paper);
|
|
1522
|
+
log(`deploy: ${boxCapNote}`);
|
|
1523
|
+
}
|
|
1524
|
+
return false;
|
|
1525
|
+
}
|
|
1499
1526
|
refused = true;
|
|
1500
|
-
const detail = buildBoxRuntimeCapRefusal(needed, box, pkg, budget);
|
|
1527
|
+
const detail = buildBoxRuntimeCapRefusal(needed, box, pkg, budget, replaced);
|
|
1501
1528
|
for (const run of needing) {
|
|
1502
|
-
record(run, "preflight", {
|
|
1529
|
+
record(run, "preflight", {
|
|
1530
|
+
status: "refused",
|
|
1531
|
+
detail,
|
|
1532
|
+
evidence: { needed, ...box, ...(replaced.length > 0 ? { replaced } : {}) },
|
|
1533
|
+
});
|
|
1503
1534
|
}
|
|
1504
1535
|
return true;
|
|
1505
1536
|
}
|
|
@@ -1533,6 +1564,40 @@ export async function runDeploy(params, deps) {
|
|
|
1533
1564
|
}
|
|
1534
1565
|
return true;
|
|
1535
1566
|
}
|
|
1567
|
+
/**
|
|
1568
|
+
* Instances whose existing strategy gets its first runtime on this box: no row on its wallet and
|
|
1569
|
+
* no same-world row on its runtime id (a row on another wallet there is replaced, not added).
|
|
1570
|
+
*/
|
|
1571
|
+
async function adoptedWalletsNeedingRuntime() {
|
|
1572
|
+
const names = [];
|
|
1573
|
+
for (const run of installing) {
|
|
1574
|
+
if (run.needsWallet)
|
|
1575
|
+
continue;
|
|
1576
|
+
const wallet = run.report.wallet;
|
|
1577
|
+
if (wallet && (await deps.registryFindByWallet(wallet)))
|
|
1578
|
+
continue;
|
|
1579
|
+
const row = await deps.registryFindById(runtimeIdFor(pkg, run.inst));
|
|
1580
|
+
if (row && !registryRowIsOtherWorld(row, pkg.paper))
|
|
1581
|
+
continue;
|
|
1582
|
+
names.push(run.inst.name);
|
|
1583
|
+
}
|
|
1584
|
+
return names;
|
|
1585
|
+
}
|
|
1586
|
+
/**
|
|
1587
|
+
* Registry rows on a new wallet's runtime id. Install deletes such a row and recreates it on the
|
|
1588
|
+
* new wallet, so it is not a runtime this deploy adds. A row from the other world on that id is
|
|
1589
|
+
* never replaced (install refuses it), so it is not one of them.
|
|
1590
|
+
*/
|
|
1591
|
+
async function rowsReplacedByNewWallets() {
|
|
1592
|
+
const replaced = [];
|
|
1593
|
+
for (const run of needing) {
|
|
1594
|
+
const id = runtimeIdFor(pkg, run.inst);
|
|
1595
|
+
const row = await deps.registryFindById(id);
|
|
1596
|
+
if (row && !registryRowIsOtherWorld(row, pkg.paper))
|
|
1597
|
+
replaced.push(id);
|
|
1598
|
+
}
|
|
1599
|
+
return replaced;
|
|
1600
|
+
}
|
|
1536
1601
|
/**
|
|
1537
1602
|
* The SOFT calculated-minimum tier. The package-level figure is computed over the WHOLE package
|
|
1538
1603
|
* (every sleeve's share of a hypothetical fresh deploy) and rides the report as CONTEXT — but the
|
|
@@ -1786,7 +1851,8 @@ export async function runDeploy(params, deps) {
|
|
|
1786
1851
|
if (probe.routed)
|
|
1787
1852
|
return true;
|
|
1788
1853
|
refused = true;
|
|
1789
|
-
const
|
|
1854
|
+
const createdEarlier = needing.filter((other) => other.report.strategyId !== undefined).map((other) => other.inst.name);
|
|
1855
|
+
const detail = buildPaperRoutingUnprovenRefusal(probe.reason, createdEarlier);
|
|
1790
1856
|
for (const target of [run, ...needing.filter((other) => other !== run && !other.recorded.has("create"))]) {
|
|
1791
1857
|
if (target.recorded.has("create"))
|
|
1792
1858
|
continue;
|
|
@@ -1796,11 +1862,12 @@ export async function runDeploy(params, deps) {
|
|
|
1796
1862
|
}
|
|
1797
1863
|
/**
|
|
1798
1864
|
* A paper create returned a LIVE strategy id: the MCP dropped `paper` and created a funded live
|
|
1799
|
-
* strategy.
|
|
1800
|
-
*
|
|
1865
|
+
* strategy. Nothing else is created and the run stops. The MCP closes only an ACTIVE or PAUSED
|
|
1866
|
+
* strategy, so the job waits for one of those on the ACTIVE poll's budget, closes it by id and
|
|
1867
|
+
* reads it back CLOSED, before any install. The step fails with where that left it.
|
|
1801
1868
|
*
|
|
1802
|
-
* The id is journaled before the
|
|
1803
|
-
*
|
|
1869
|
+
* The id is journaled before the wait. A process that dies during it leaves no other record of
|
|
1870
|
+
* the strategy, and paper recovery reads only the paper world.
|
|
1804
1871
|
*/
|
|
1805
1872
|
async function stopOnLiveCreate(run, strategyId) {
|
|
1806
1873
|
wentLive = true;
|
|
@@ -1811,23 +1878,50 @@ export async function runDeploy(params, deps) {
|
|
|
1811
1878
|
evidence: { instance: run.inst.name, world: "live", unexpectedStrategyId: strategyId },
|
|
1812
1879
|
});
|
|
1813
1880
|
log(`deploy: paper create for "${run.inst.name}" returned live strategy ${strategyId} — closing it`);
|
|
1814
|
-
|
|
1815
|
-
let closeError;
|
|
1816
|
-
try {
|
|
1817
|
-
const result = await deps.closeStrategyById(strategyId);
|
|
1818
|
-
closed = result.success === true;
|
|
1819
|
-
if (!closed)
|
|
1820
|
-
closeError = result.message ?? "the close reported no success";
|
|
1821
|
-
}
|
|
1822
|
-
catch (err) {
|
|
1823
|
-
closeError = errorText(err);
|
|
1824
|
-
}
|
|
1881
|
+
const cleanup = await closeLiveCreate(strategyId);
|
|
1825
1882
|
record(run, "create", {
|
|
1826
1883
|
status: "failed",
|
|
1827
|
-
detail: buildPaperCreateWentLiveDetail(
|
|
1828
|
-
evidence: {
|
|
1884
|
+
detail: buildPaperCreateWentLiveDetail(strategyId, cleanup),
|
|
1885
|
+
evidence: {
|
|
1886
|
+
strategyId,
|
|
1887
|
+
paper: true,
|
|
1888
|
+
wentLive: true,
|
|
1889
|
+
closed: cleanup.kind === "closed",
|
|
1890
|
+
cleanup: cleanup.kind,
|
|
1891
|
+
lastStatus: cleanup.status ?? null,
|
|
1892
|
+
...(cleanup.kind === "close-failed" ? { closeError: cleanup.reason } : {}),
|
|
1893
|
+
},
|
|
1829
1894
|
});
|
|
1830
1895
|
}
|
|
1896
|
+
async function closeLiveCreate(strategyId) {
|
|
1897
|
+
const status = await pollStatus(strategyId, false, (s) => !isInitializing(s));
|
|
1898
|
+
if (status === undefined || (!isClosable(status) && !isClosing(status) && !isDead(status))) {
|
|
1899
|
+
return { kind: "unclosable", ...(status ? { status } : {}) };
|
|
1900
|
+
}
|
|
1901
|
+
if (isDead(status))
|
|
1902
|
+
return { kind: "closed", status };
|
|
1903
|
+
let outcome;
|
|
1904
|
+
if (isClosing(status)) {
|
|
1905
|
+
outcome = await pollUntilClosed(strategyId, { kind: "closing", status, strategyId, result: undefined }, false);
|
|
1906
|
+
}
|
|
1907
|
+
else {
|
|
1908
|
+
try {
|
|
1909
|
+
const accepted = readCloseOutcome(await deps.closeStrategyById(strategyId));
|
|
1910
|
+
outcome = accepted.kind === "closing" ? await pollUntilClosed(strategyId, accepted, false) : accepted;
|
|
1911
|
+
}
|
|
1912
|
+
catch (err) {
|
|
1913
|
+
return { kind: "close-failed", status, reason: errorText(err) };
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
switch (outcome.kind) {
|
|
1917
|
+
case "closed":
|
|
1918
|
+
return { kind: "closed", status: "CLOSED" };
|
|
1919
|
+
case "closing":
|
|
1920
|
+
return { kind: "closing", ...(outcome.status ? { status: outcome.status } : {}) };
|
|
1921
|
+
case "failed":
|
|
1922
|
+
return { kind: "close-failed", status, reason: outcome.reason };
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1831
1925
|
/**
|
|
1832
1926
|
* What the create carries beside attribution (ticket 125): the instance's StrategyFacts and the
|
|
1833
1927
|
* package's catalog copy. Descriptive only, so it never stops a create: facts that cannot be
|
|
@@ -2161,7 +2255,7 @@ export async function runDeploy(params, deps) {
|
|
|
2161
2255
|
const result = await deps.closeStrategy(wallet);
|
|
2162
2256
|
const accepted = readCloseOutcome(result);
|
|
2163
2257
|
const outcome = accepted.kind === "closing"
|
|
2164
|
-
? await pollUntilClosed(run.report.strategyId ?? accepted.strategyId, accepted)
|
|
2258
|
+
? await pollUntilClosed(run.report.strategyId ?? accepted.strategyId, accepted, pkg.paper)
|
|
2165
2259
|
: accepted;
|
|
2166
2260
|
switch (outcome.kind) {
|
|
2167
2261
|
case "failed":
|
|
@@ -2193,28 +2287,36 @@ export async function runDeploy(params, deps) {
|
|
|
2193
2287
|
}
|
|
2194
2288
|
}
|
|
2195
2289
|
/**
|
|
2196
|
-
* Read an accepted close back until the strategy is CLOSED
|
|
2197
|
-
*
|
|
2198
|
-
* a CLOSED read, so it only costs one poll.
|
|
2290
|
+
* Read an accepted close back until the strategy is CLOSED. A read that throws is not a CLOSED
|
|
2291
|
+
* read, so it only costs one poll.
|
|
2199
2292
|
*/
|
|
2200
|
-
async function pollUntilClosed(strategyId, closing) {
|
|
2293
|
+
async function pollUntilClosed(strategyId, closing, paper) {
|
|
2201
2294
|
if (strategyId === undefined)
|
|
2202
2295
|
return closing;
|
|
2296
|
+
const status = (await pollStatus(strategyId, paper, (s) => s.toUpperCase() === "CLOSED")) ?? closing.status;
|
|
2297
|
+
return status?.toUpperCase() === "CLOSED" ? { kind: "closed", result: closing.result } : { ...closing, strategyId, status };
|
|
2298
|
+
}
|
|
2299
|
+
/**
|
|
2300
|
+
* Read one strategy's status until `settled` holds, on the ACTIVE poll's budget and cadence
|
|
2301
|
+
* (`--max-wait`, {@link CREATE_POLL_MS}) and the job's deadline. Resolves the last status read,
|
|
2302
|
+
* undefined when no read returned one.
|
|
2303
|
+
*/
|
|
2304
|
+
async function pollStatus(strategyId, paper, settled) {
|
|
2203
2305
|
const deadline = deps.now() + maxWaitSec * 1000;
|
|
2204
|
-
let status
|
|
2306
|
+
let status;
|
|
2205
2307
|
for (;;) {
|
|
2206
2308
|
try {
|
|
2207
|
-
const [live] = await deps.listStrategies({ paper
|
|
2309
|
+
const [live] = await deps.listStrategies({ paper, strategyIds: [strategyId] });
|
|
2208
2310
|
if (live?.status)
|
|
2209
2311
|
status = live.status;
|
|
2210
2312
|
}
|
|
2211
2313
|
catch (err) {
|
|
2212
|
-
log(`deploy: reading strategy ${strategyId}
|
|
2314
|
+
log(`deploy: reading strategy ${strategyId} failed: ${errorText(err)}`);
|
|
2213
2315
|
}
|
|
2214
|
-
if (status
|
|
2215
|
-
return
|
|
2316
|
+
if (status !== undefined && settled(status))
|
|
2317
|
+
return status;
|
|
2216
2318
|
if (deps.now() >= deadline || deps.shouldAbandon())
|
|
2217
|
-
return
|
|
2319
|
+
return status;
|
|
2218
2320
|
await deps.sleep(CREATE_POLL_MS);
|
|
2219
2321
|
}
|
|
2220
2322
|
}
|
|
@@ -2529,6 +2631,7 @@ export async function runDeploy(params, deps) {
|
|
|
2529
2631
|
...(unreadableFunded.length > 0
|
|
2530
2632
|
? { fundedUnreadableNote: buildFundedUnreadableNote(pkg, unreadableFunded, reassures()) }
|
|
2531
2633
|
: {}),
|
|
2634
|
+
...(boxCapNote ? { boxCapNote } : {}),
|
|
2532
2635
|
};
|
|
2533
2636
|
}
|
|
2534
2637
|
/**
|