@mostra/runtime 0.12.0 → 0.13.0
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/bin.js +784 -432
- package/dist/bin.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/{instance-CBUlOmzG.js → instance-D5gh-sMM.js} +17 -4
- package/dist/instance-D5gh-sMM.js.map +1 -0
- package/dist/reference/diagnostics.json +2 -2
- package/dist/reference/errors/MOSTRA_REMOTE_QUEUE_FULL.md +2 -2
- package/dist/reference/self-hosting.md +1 -1
- package/dist/skill/SKILL.md +2 -2
- package/dist/skill/references/mcp.md +2 -2
- package/package.json +6 -6
- package/src/actions/index.ts +5 -2
- package/src/gateway/actions.ts +6 -1
- package/src/gateway/capabilities.ts +5 -1
- package/src/gateway/index.ts +3 -0
- package/src/ledger/migrations.ts +9 -0
- package/src/server/api.ts +1 -1
- package/src/server/auth.ts +83 -16
- package/src/server/authorize.ts +27 -4
- package/src/server/config.ts +53 -0
- package/src/server/directory.ts +51 -0
- package/src/server/hosted-pages.ts +19 -6
- package/src/server/hosted.ts +54 -27
- package/src/server/index.ts +62 -15
- package/src/server/metering.ts +117 -12
- package/src/server/providers.ts +61 -9
- package/src/server/relay.ts +258 -107
- package/dist/instance-CBUlOmzG.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as startInstance, t as runtimeVersion } from "./instance-
|
|
1
|
+
import { n as startInstance, t as runtimeVersion } from "./instance-D5gh-sMM.js";
|
|
2
2
|
import { t as connectToSupervisor } from "./child-BmNZ4a70.js";
|
|
3
3
|
export { connectToSupervisor, runtimeVersion, startInstance };
|
|
@@ -2929,6 +2929,13 @@ const MIGRATIONS = [
|
|
|
2929
2929
|
BEGIN SELECT RAISE(ABORT, 'a roster round never goes back'); END;
|
|
2930
2930
|
`);
|
|
2931
2931
|
}
|
|
2932
|
+
},
|
|
2933
|
+
{
|
|
2934
|
+
version: 17,
|
|
2935
|
+
name: "a link's views",
|
|
2936
|
+
up(db) {
|
|
2937
|
+
db.exec("CREATE INDEX view_token ON view (token_id, opened_at)");
|
|
2938
|
+
}
|
|
2932
2939
|
}
|
|
2933
2940
|
];
|
|
2934
2941
|
//#endregion
|
|
@@ -10127,9 +10134,12 @@ const STATUS$1 = {
|
|
|
10127
10134
|
MOSTRA_HOME_GONE: 503,
|
|
10128
10135
|
MOSTRA_REMOTE_OWNER_OFFLINE: 503,
|
|
10129
10136
|
MOSTRA_REMOTE_QUEUE_FULL: 503,
|
|
10137
|
+
MOSTRA_REMOTE_LIMIT_REACHED: 403,
|
|
10130
10138
|
MOSTRA_REMOTE_SIGN_IN_REQUIRED: 403,
|
|
10131
10139
|
MOSTRA_REMOTE_RATE_LIMITED: 429,
|
|
10132
|
-
MOSTRA_ACTION_PAUSED: 423
|
|
10140
|
+
MOSTRA_ACTION_PAUSED: 423,
|
|
10141
|
+
MOSTRA_HYGIENE_TOKEN_REVOKED: 410,
|
|
10142
|
+
MOSTRA_ACTION_CANCELLED: 409
|
|
10133
10143
|
};
|
|
10134
10144
|
function answer$1(diagnostic, status) {
|
|
10135
10145
|
return jsonResponse({ ...diagnostic }, { status });
|
|
@@ -10247,7 +10257,7 @@ function actionRoutes(options) {
|
|
|
10247
10257
|
const pausedNow = paused(page);
|
|
10248
10258
|
if (pausedNow) return pausedNow;
|
|
10249
10259
|
try {
|
|
10250
|
-
return jsonResponse(actions.startRun(page, {
|
|
10260
|
+
return jsonResponse(await actions.startRun(page, {
|
|
10251
10261
|
viewId: request.viewId,
|
|
10252
10262
|
fnId: request.fnId,
|
|
10253
10263
|
args: request.args,
|
|
@@ -10976,6 +10986,7 @@ var Capabilities = class {
|
|
|
10976
10986
|
/** Failure times per artifact (`""` for tokens of no artifact in this home). */
|
|
10977
10987
|
#failures = /* @__PURE__ */ new Map();
|
|
10978
10988
|
#touched = /* @__PURE__ */ new Map();
|
|
10989
|
+
#touchIntervalMs;
|
|
10979
10990
|
constructor(options) {
|
|
10980
10991
|
this.#ledger = options.ledger;
|
|
10981
10992
|
this.#log = options.log;
|
|
@@ -10984,6 +10995,7 @@ var Capabilities = class {
|
|
|
10984
10995
|
this.#shellOrigin = options.shellOrigin;
|
|
10985
10996
|
this.#servesShell = options.servesShell ?? ((origin) => origin === this.#shellOrigin());
|
|
10986
10997
|
this.#onMinted = options.onMinted;
|
|
10998
|
+
this.#touchIntervalMs = options.touchIntervalMs ?? TOUCH_INTERVAL_MS;
|
|
10987
10999
|
}
|
|
10988
11000
|
/** Runs `fn` in the caller's transaction, or in a new one. */
|
|
10989
11001
|
#tx(db, fn) {
|
|
@@ -11259,7 +11271,7 @@ var Capabilities = class {
|
|
|
11259
11271
|
/** Writes `last_seen_at` at most hourly, so serving files doesn't write the ledger per request. */
|
|
11260
11272
|
#touch(sessionId) {
|
|
11261
11273
|
const now = this.#now();
|
|
11262
|
-
if (now - (this.#touched.get(sessionId) ?? 0) <
|
|
11274
|
+
if (now - (this.#touched.get(sessionId) ?? 0) < this.#touchIntervalMs) return;
|
|
11263
11275
|
this.#touched.set(sessionId, now);
|
|
11264
11276
|
this.#ledger.write((db) => db.run("UPDATE session SET last_seen_at = ? WHERE id = ?", this.#iso(now), sessionId));
|
|
11265
11277
|
}
|
|
@@ -13363,6 +13375,7 @@ function createGateway(options) {
|
|
|
13363
13375
|
artifactId,
|
|
13364
13376
|
versionId: version.id,
|
|
13365
13377
|
tokenId: session.grant.tokenId,
|
|
13378
|
+
sessionId: session.id,
|
|
13366
13379
|
client: context.client
|
|
13367
13380
|
});
|
|
13368
13381
|
if (refused) return refuse(checks, refused, meta);
|
|
@@ -23691,4 +23704,4 @@ function sourceDirectory(path) {
|
|
|
23691
23704
|
//#endregion
|
|
23692
23705
|
export { markRunning as A, handler as B, jsonResponse as C, createEphemeralBus as D, createInteraction as E, BINDING_SUBPROTOCOL as F, readFieldCoverage as G, openLedger as H, MAX_FRAME_BYTES as I, coverageMatcher as J, readServerFunctions as K, serveWebSocket as L, markWaiting as M, runState as N, appendRunOutput as O, appendEvent as P, attachInProcess as R, isRefusal as S, openRegistry as T, faultsFrom as U, holdLock as V, noFaults as W, openFileLog as Y, resetOnClose as _, uninstallService as a, BASE_HEADERS as b, resolveHomePath as c, versionIdFor as d, createLive as f, shellAssetResponse as g, locateShell as h, serviceStatus as i, markUnknown as j, finishRun as k, canonicalRef as l, createGateway as m, startInstance as n, checkPlatform as o, liveMethods as p, readProcess as q, installService as r, platformName as s, runtimeVersion as t, listingDigest as u, Capabilities as v, readJsonObject as w, documentHeaders as x, capabilityKey as y, ProtocolServer as z };
|
|
23693
23706
|
|
|
23694
|
-
//# sourceMappingURL=instance-
|
|
23707
|
+
//# sourceMappingURL=instance-D5gh-sMM.js.map
|