deepspace 0.28.2 → 0.29.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/CHANGELOG.md +13 -0
- package/dist/{chunk-DMUR67NG.js → chunk-ZWFH5HON.js} +2 -2
- package/dist/{chunk-DMUR67NG.js.map → chunk-ZWFH5HON.js.map} +1 -1
- package/dist/cli.js +48 -43
- package/dist/cli.js.map +1 -1
- package/dist/documentation-client-core.js +1 -1
- package/dist/documentation-default-renderer.cjs +1 -1
- package/dist/documentation-react.js +1 -1
- package/dist/documentation-runtime.js +1 -1
- package/dist/documentation-server-core.js +1 -1
- package/dist/documentation.js +1 -1
- package/dist/documentation.js.map +1 -1
- package/dist/index.d.ts +56 -67
- package/dist/index.js +97 -129
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +0 -1
- package/dist/server.js +113 -30
- package/dist/server.js.map +1 -1
- package/dist/worker.d.ts +72 -90
- package/dist/worker.js +157 -135
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -8150,6 +8150,19 @@ import { setTimeout as delay } from "timers/promises";
|
|
|
8150
8150
|
|
|
8151
8151
|
// src/shared/log-events.ts
|
|
8152
8152
|
var LOG_LEVELS = ["debug", "log", "info", "warn", "error"];
|
|
8153
|
+
function logEventText(e) {
|
|
8154
|
+
if (e.eventType === "exception" && e.exception) {
|
|
8155
|
+
const where = e.request ? ` \u2014 ${e.request.method} ${e.request.path}` : "";
|
|
8156
|
+
return `${e.exception.name}: ${e.exception.message}${where}`;
|
|
8157
|
+
}
|
|
8158
|
+
if (e.eventType === "request" && e.request) {
|
|
8159
|
+
const status3 = e.request.status !== void 0 ? ` ${e.request.status}` : "";
|
|
8160
|
+
const outcome = e.outcome && e.outcome !== "ok" ? ` (${e.outcome})` : "";
|
|
8161
|
+
return `${e.request.method} ${e.request.path}${status3}${outcome}`;
|
|
8162
|
+
}
|
|
8163
|
+
return e.message;
|
|
8164
|
+
}
|
|
8165
|
+
var MAX_LOG_TEXT_LENGTH = 8 * 1024;
|
|
8153
8166
|
|
|
8154
8167
|
// src/cli/commands/logs.ts
|
|
8155
8168
|
var DEPLOY_URL7 = process.env.DEEPSPACE_DEPLOY_URL ?? PLATFORM_URLS.deploy;
|
|
@@ -8161,6 +8174,9 @@ var LOG_RETENTION_DAYS = 7;
|
|
|
8161
8174
|
function followInitialLimit(limit, maxLimit) {
|
|
8162
8175
|
return limit ?? maxLimit;
|
|
8163
8176
|
}
|
|
8177
|
+
function fatalFollowStatus(status3) {
|
|
8178
|
+
return [400, 401, 403, 404].includes(status3);
|
|
8179
|
+
}
|
|
8164
8180
|
function nextPollSince(cursor, floor, lagMs = FOLLOW_LAG_MS) {
|
|
8165
8181
|
return Math.max(cursor - lagMs, floor);
|
|
8166
8182
|
}
|
|
@@ -8232,12 +8248,12 @@ function formatTime(ts, now) {
|
|
|
8232
8248
|
}
|
|
8233
8249
|
function formatEvent(e, color, now = Date.now()) {
|
|
8234
8250
|
const time = paint("2", formatTime(e.timestamp, now), color);
|
|
8251
|
+
const text2 = displayLines(logEventText(e));
|
|
8235
8252
|
let tag;
|
|
8236
8253
|
let body;
|
|
8237
8254
|
if (e.eventType === "exception" && e.exception) {
|
|
8238
8255
|
tag = paint("31", "ERROR", color);
|
|
8239
|
-
|
|
8240
|
-
body = displayLines(`${e.exception.name}: ${e.exception.message}${where}`);
|
|
8256
|
+
body = text2;
|
|
8241
8257
|
if (e.exception.stack) {
|
|
8242
8258
|
const lines = e.exception.stack.split("\n");
|
|
8243
8259
|
const firstIsHeader = lines.length > 0 && !/^\s*at\s/.test(lines[0]) && lines[0].includes(e.exception.message);
|
|
@@ -8246,17 +8262,14 @@ function formatEvent(e, color, now = Date.now()) {
|
|
|
8246
8262
|
}
|
|
8247
8263
|
} else if (e.eventType === "request" && e.request) {
|
|
8248
8264
|
tag = paint("36", "REQ ", color);
|
|
8249
|
-
|
|
8250
|
-
const outcome = e.outcome && e.outcome !== "ok" ? ` (${e.outcome})` : "";
|
|
8251
|
-
body = displayLines(`${e.request.method} ${e.request.path}${status3}${outcome}`);
|
|
8265
|
+
body = text2;
|
|
8252
8266
|
} else {
|
|
8253
8267
|
const style = LEVEL_STYLE[e.level];
|
|
8254
8268
|
tag = (e.level.toUpperCase() + " ").slice(0, 5);
|
|
8255
8269
|
if (style) tag = paint(style, tag, color);
|
|
8256
|
-
body = style ? paint(style,
|
|
8270
|
+
body = style ? paint(style, text2, color) : text2;
|
|
8257
8271
|
}
|
|
8258
|
-
|
|
8259
|
-
return `${time} ${client}${tag} ${body}`;
|
|
8272
|
+
return `${time} ${tag} ${body}`;
|
|
8260
8273
|
}
|
|
8261
8274
|
var sleep3 = (ms, signal) => delay(ms, void 0, { signal });
|
|
8262
8275
|
var logs_default = defineCommand4({
|
|
@@ -8295,7 +8308,7 @@ var logs_default = defineCommand4({
|
|
|
8295
8308
|
},
|
|
8296
8309
|
search: {
|
|
8297
8310
|
type: "string",
|
|
8298
|
-
description: "Only events whose
|
|
8311
|
+
description: "Only events whose rendered text contains this (case-insensitive)",
|
|
8299
8312
|
required: false
|
|
8300
8313
|
},
|
|
8301
8314
|
limit: {
|
|
@@ -8363,6 +8376,13 @@ var logs_default = defineCommand4({
|
|
|
8363
8376
|
);
|
|
8364
8377
|
}
|
|
8365
8378
|
};
|
|
8379
|
+
const noteTruncation = (humanMessage) => {
|
|
8380
|
+
if (args.json) {
|
|
8381
|
+
process.stdout.write(JSON.stringify({ type: "meta", truncated: true }) + "\n");
|
|
8382
|
+
} else {
|
|
8383
|
+
console.error(humanMessage);
|
|
8384
|
+
}
|
|
8385
|
+
};
|
|
8366
8386
|
const first = await fetchPage(initialSince, args.follow ? followLimit : limit, token);
|
|
8367
8387
|
if (args.follow && args.json) {
|
|
8368
8388
|
process.stdout.write(
|
|
@@ -8394,16 +8414,9 @@ var logs_default = defineCommand4({
|
|
|
8394
8414
|
);
|
|
8395
8415
|
}
|
|
8396
8416
|
} else if (first.truncated) {
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
|
|
8400
|
-
console.error(
|
|
8401
|
-
`(showing the newest ${first.events.length} matches \u2014 search scans at most the newest 500 level-filtered events per fetch; narrow with --since/--level or raise --limit)`
|
|
8402
|
-
);
|
|
8403
|
-
else
|
|
8404
|
-
console.error(
|
|
8405
|
-
`(showing the newest ${first.events.length} events \u2014 narrow with --since/--level)`
|
|
8406
|
-
);
|
|
8417
|
+
noteTruncation(
|
|
8418
|
+
args.search ? `(showing the newest ${first.events.length} matches \u2014 search scans at most the newest 500 level-filtered events per fetch; narrow with --since/--level or raise --limit)` : `(showing the newest ${first.events.length} events \u2014 narrow with --since/--level)`
|
|
8419
|
+
);
|
|
8407
8420
|
}
|
|
8408
8421
|
return;
|
|
8409
8422
|
}
|
|
@@ -8420,17 +8433,13 @@ var logs_default = defineCommand4({
|
|
|
8420
8433
|
let warnedTruncated = false;
|
|
8421
8434
|
if (first.truncated) {
|
|
8422
8435
|
warnedTruncated = true;
|
|
8423
|
-
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
|
|
8427
|
-
|
|
8428
|
-
|
|
8429
|
-
|
|
8430
|
-
stderrColor()
|
|
8431
|
-
)
|
|
8432
|
-
);
|
|
8433
|
-
}
|
|
8436
|
+
noteTruncation(
|
|
8437
|
+
paint(
|
|
8438
|
+
"33",
|
|
8439
|
+
args.search ? `(search scanned only the newest ${MAX_LIMIT} level-filtered events in the initial ${windowLabel} window \u2014 older matches may be omitted; narrow with --since/--level)` : `(more than ${followLimit} events in the initial ${windowLabel} window \u2014 some older events not shown; narrow with --since/--level)`,
|
|
8440
|
+
stderrColor()
|
|
8441
|
+
)
|
|
8442
|
+
);
|
|
8434
8443
|
}
|
|
8435
8444
|
for (; ; ) {
|
|
8436
8445
|
try {
|
|
@@ -8450,7 +8459,7 @@ var logs_default = defineCommand4({
|
|
|
8450
8459
|
);
|
|
8451
8460
|
} catch (err) {
|
|
8452
8461
|
if (tail.signal.aborted) return;
|
|
8453
|
-
if (err instanceof ApiError &&
|
|
8462
|
+
if (err instanceof ApiError && fatalFollowStatus(err.status)) throw err;
|
|
8454
8463
|
backoff = Math.min(backoff ? backoff * 2 : MIN_POLL_MS, 3e4);
|
|
8455
8464
|
const msg = err instanceof Error ? err.message : String(err);
|
|
8456
8465
|
console.error(
|
|
@@ -8465,17 +8474,13 @@ var logs_default = defineCommand4({
|
|
|
8465
8474
|
const realDrop = fresh.length >= followLimit || Boolean(args.search && page.truncated);
|
|
8466
8475
|
if (realDrop && !warnedTruncated) {
|
|
8467
8476
|
warnedTruncated = true;
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
stderrColor()
|
|
8476
|
-
)
|
|
8477
|
-
);
|
|
8478
|
-
}
|
|
8477
|
+
noteTruncation(
|
|
8478
|
+
paint(
|
|
8479
|
+
"33",
|
|
8480
|
+
args.search ? `(search scanned only the newest ${MAX_LIMIT} level-filtered events this poll \u2014 older matches may be omitted; narrow with --level)` : `(burst exceeded ${followLimit} events/poll \u2014 some may be dropped; narrow with --level)`,
|
|
8481
|
+
stderrColor()
|
|
8482
|
+
)
|
|
8483
|
+
);
|
|
8479
8484
|
} else if (!realDrop) {
|
|
8480
8485
|
warnedTruncated = false;
|
|
8481
8486
|
}
|
|
@@ -15851,7 +15856,7 @@ import { join as join28, resolve as resolve22 } from "path";
|
|
|
15851
15856
|
// package.json
|
|
15852
15857
|
var package_default = {
|
|
15853
15858
|
name: "deepspace",
|
|
15854
|
-
version: "0.
|
|
15859
|
+
version: "0.29.0",
|
|
15855
15860
|
engines: {
|
|
15856
15861
|
node: ">=22.15.0 <23 || >=24 <25 || >=26 <27"
|
|
15857
15862
|
},
|