@senpi/runtime 3.0.320 → 3.0.322
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/guide-commands.d.ts.map +1 -1
- package/dist/cli/guide-commands.js +11 -9
- package/dist/cli/guide-commands.js.map +1 -1
- package/dist/daemon/mcp-endpoint.d.ts.map +1 -1
- package/dist/daemon/mcp-endpoint.js +4 -3
- package/dist/daemon/mcp-endpoint.js.map +1 -1
- package/dist/deploy/batch/batch.d.ts +12 -12
- package/dist/deploy/batch/batch.d.ts.map +1 -1
- package/dist/deploy/batch/batch.js +52 -85
- package/dist/deploy/batch/batch.js.map +1 -1
- package/dist/deploy/box-status.d.ts +47 -0
- package/dist/deploy/box-status.d.ts.map +1 -0
- package/dist/deploy/box-status.js +111 -0
- package/dist/deploy/box-status.js.map +1 -0
- package/dist/deploy/messages.d.ts +10 -10
- package/dist/deploy/messages.d.ts.map +1 -1
- package/dist/deploy/messages.js +28 -16
- package/dist/deploy/messages.js.map +1 -1
- package/dist/deploy/orchestrator.d.ts +3 -3
- package/dist/deploy/orchestrator.d.ts.map +1 -1
- package/dist/deploy/orchestrator.js +23 -55
- package/dist/deploy/orchestrator.js.map +1 -1
- package/dist/deploy/register.js +3 -6
- package/dist/deploy/register.js.map +1 -1
- package/dist/deploy/sim-admission.d.ts +9 -15
- package/dist/deploy/sim-admission.d.ts.map +1 -1
- package/dist/deploy/sim-admission.js +22 -34
- package/dist/deploy/sim-admission.js.map +1 -1
- package/dist/integrity-manifest.json +29 -29
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/dist/deploy/box-grow.d.ts +0 -28
- package/dist/deploy/box-grow.d.ts.map +0 -1
- package/dist/deploy/box-grow.js +0 -90
- package/dist/deploy/box-grow.js.map +0 -1
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The orchestrator's live box grow (`POST /v1/agents/me/box/grow`). The runtime calls it when a
|
|
3
|
-
* simulation does not fit the box's memory; the orchestrator raises the box one step without a
|
|
4
|
-
* restart, or answers that the box is at its largest. An orchestrator with the payment gate on also
|
|
5
|
-
* answers 403 `BOX_GROW_NOT_ELIGIBLE` to an account that pays nothing (no active or past-due plan and
|
|
6
|
-
* no paid credits held): larger boxes are for paying accounts, so that is a refusal to upgrade, not an
|
|
7
|
-
* outage. 503 `BOX_GROW_UNAVAILABLE` is the gate unable to read the plan, which a retry can clear.
|
|
8
|
-
*/
|
|
9
|
-
export type BoxGrowOutcome = {
|
|
10
|
-
kind: "grown";
|
|
11
|
-
beforeGb: number;
|
|
12
|
-
afterGb: number;
|
|
13
|
-
} | {
|
|
14
|
-
kind: "full";
|
|
15
|
-
largestGb?: number;
|
|
16
|
-
} | {
|
|
17
|
-
kind: "not-eligible";
|
|
18
|
-
} | {
|
|
19
|
-
kind: "unavailable";
|
|
20
|
-
reason: string;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* `SENPI_ORCHESTRATOR_URL` when set, else the `SENPI_MCP_URL` origin with its leading `mcp.` host
|
|
24
|
-
* label swapped for `senpi-orchestrator.` (`mcp.dev.senpi.ai` serves `senpi-orchestrator.dev.senpi.ai`).
|
|
25
|
-
*/
|
|
26
|
-
export declare function orchestratorUrl(env: NodeJS.ProcessEnv): string | undefined;
|
|
27
|
-
export declare function requestBoxGrow(env: NodeJS.ProcessEnv, fetchImpl?: typeof fetch): Promise<BoxGrowOutcome>;
|
|
28
|
-
//# sourceMappingURL=box-grow.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"box-grow.d.ts","sourceRoot":"","sources":["../../src/deploy/box-grow.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACpD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,GACxB;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAI5C;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,GAAG,SAAS,CAc1E;AAQD,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,SAAS,GAAE,OAAO,KAAa,GAC9B,OAAO,CAAC,cAAc,CAAC,CAgDzB"}
|
package/dist/deploy/box-grow.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The orchestrator's live box grow (`POST /v1/agents/me/box/grow`). The runtime calls it when a
|
|
3
|
-
* simulation does not fit the box's memory; the orchestrator raises the box one step without a
|
|
4
|
-
* restart, or answers that the box is at its largest. An orchestrator with the payment gate on also
|
|
5
|
-
* answers 403 `BOX_GROW_NOT_ELIGIBLE` to an account that pays nothing (no active or past-due plan and
|
|
6
|
-
* no paid credits held): larger boxes are for paying accounts, so that is a refusal to upgrade, not an
|
|
7
|
-
* outage. 503 `BOX_GROW_UNAVAILABLE` is the gate unable to read the plan, which a retry can clear.
|
|
8
|
-
*/
|
|
9
|
-
const GROW_TIMEOUT_MS = 30_000;
|
|
10
|
-
/**
|
|
11
|
-
* `SENPI_ORCHESTRATOR_URL` when set, else the `SENPI_MCP_URL` origin with its leading `mcp.` host
|
|
12
|
-
* label swapped for `senpi-orchestrator.` (`mcp.dev.senpi.ai` serves `senpi-orchestrator.dev.senpi.ai`).
|
|
13
|
-
*/
|
|
14
|
-
export function orchestratorUrl(env) {
|
|
15
|
-
const explicit = env.SENPI_ORCHESTRATOR_URL?.trim();
|
|
16
|
-
if (explicit)
|
|
17
|
-
return explicit.replace(/\/+$/, "");
|
|
18
|
-
const mcp = env.SENPI_MCP_URL?.trim();
|
|
19
|
-
if (!mcp)
|
|
20
|
-
return undefined;
|
|
21
|
-
let url;
|
|
22
|
-
try {
|
|
23
|
-
url = new URL(mcp);
|
|
24
|
-
}
|
|
25
|
-
catch {
|
|
26
|
-
return undefined;
|
|
27
|
-
}
|
|
28
|
-
if (!url.hostname.startsWith("mcp."))
|
|
29
|
-
return undefined;
|
|
30
|
-
url.hostname = `senpi-orchestrator.${url.hostname.slice("mcp.".length)}`;
|
|
31
|
-
return url.origin;
|
|
32
|
-
}
|
|
33
|
-
function memoryGb(value) {
|
|
34
|
-
if (value === null || typeof value !== "object")
|
|
35
|
-
return undefined;
|
|
36
|
-
const gb = value.memoryGB;
|
|
37
|
-
return typeof gb === "number" && Number.isFinite(gb) ? gb : undefined;
|
|
38
|
-
}
|
|
39
|
-
export async function requestBoxGrow(env, fetchImpl = fetch) {
|
|
40
|
-
const base = orchestratorUrl(env);
|
|
41
|
-
if (base === undefined) {
|
|
42
|
-
return {
|
|
43
|
-
kind: "unavailable",
|
|
44
|
-
reason: "this box has no orchestrator address (SENPI_ORCHESTRATOR_URL, or an mcp. host in SENPI_MCP_URL)",
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
const token = env.SENPI_AUTH_TOKEN?.trim();
|
|
48
|
-
if (!token)
|
|
49
|
-
return { kind: "unavailable", reason: "this box has no SENPI_AUTH_TOKEN to ask the orchestrator with" };
|
|
50
|
-
let response;
|
|
51
|
-
try {
|
|
52
|
-
response = await fetchImpl(`${base}/v1/agents/me/box/grow`, {
|
|
53
|
-
method: "POST",
|
|
54
|
-
headers: { Authorization: `Bearer ${token}` },
|
|
55
|
-
signal: AbortSignal.timeout(GROW_TIMEOUT_MS),
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
catch (err) {
|
|
59
|
-
return { kind: "unavailable", reason: `the orchestrator could not be reached (${err instanceof Error ? err.message : String(err)})` };
|
|
60
|
-
}
|
|
61
|
-
const body = await response.json().catch(() => undefined);
|
|
62
|
-
const code = body !== null && typeof body === "object" ? body.code : undefined;
|
|
63
|
-
if (response.status === 200) {
|
|
64
|
-
const before = memoryGb(body?.before);
|
|
65
|
-
const after = memoryGb(body?.after);
|
|
66
|
-
if (before === undefined || after === undefined) {
|
|
67
|
-
return { kind: "unavailable", reason: "the orchestrator's answer did not carry the box sizes" };
|
|
68
|
-
}
|
|
69
|
-
return { kind: "grown", beforeGb: before, afterGb: after };
|
|
70
|
-
}
|
|
71
|
-
if (response.status === 409 && code === "BOX_FULL") {
|
|
72
|
-
const largestGb = memoryGb(body.largest);
|
|
73
|
-
return { kind: "full", ...(largestGb !== undefined ? { largestGb } : {}) };
|
|
74
|
-
}
|
|
75
|
-
if (response.status === 403 && code === "BOX_GROW_NOT_ELIGIBLE")
|
|
76
|
-
return { kind: "not-eligible" };
|
|
77
|
-
if (response.status === 503 && code === "BOX_GROW_UNAVAILABLE") {
|
|
78
|
-
return {
|
|
79
|
-
kind: "unavailable",
|
|
80
|
-
reason: "the orchestrator couldn't check your plan right now (503 BOX_GROW_UNAVAILABLE), try again in a minute",
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
if (response.status === 503 && code === "BOX_GROW_DISABLED") {
|
|
84
|
-
return { kind: "unavailable", reason: "the orchestrator has box growth turned off (503 BOX_GROW_DISABLED)" };
|
|
85
|
-
}
|
|
86
|
-
if (response.status === 404)
|
|
87
|
-
return { kind: "unavailable", reason: "the orchestrator has no box for this agent (404)" };
|
|
88
|
-
return { kind: "unavailable", reason: `the orchestrator answered ${response.status}` };
|
|
89
|
-
}
|
|
90
|
-
//# sourceMappingURL=box-grow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"box-grow.js","sourceRoot":"","sources":["../../src/deploy/box-grow.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,MAAM,eAAe,GAAG,MAAM,CAAC;AAE/B;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,GAAsB;IACpD,MAAM,QAAQ,GAAG,G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