@openclaw/diffs 2026.5.28 → 2026.5.30-beta.1
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/index.js +9 -5
- package/npm-shrinkwrap.json +2 -2
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "opencl
|
|
|
11
11
|
import crypto from "node:crypto";
|
|
12
12
|
import fs$1 from "node:fs/promises";
|
|
13
13
|
import { fileURLToPath } from "node:url";
|
|
14
|
+
import { MAX_DATE_TIMESTAMP_MS, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
14
15
|
import { root, writeExternalFileWithinRoot } from "openclaw/plugin-sdk/security-runtime";
|
|
15
16
|
import { optionalFiniteNumberSchema, stringEnum } from "openclaw/plugin-sdk/channel-actions";
|
|
16
17
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -652,15 +653,16 @@ var DiffArtifactStore = class {
|
|
|
652
653
|
const htmlPath = path.join(artifactDir, "viewer.html");
|
|
653
654
|
const ttlMs = normalizeTtlMs$1(params.ttlMs);
|
|
654
655
|
const createdAt = /* @__PURE__ */ new Date();
|
|
655
|
-
const
|
|
656
|
+
const createdAtIso = createdAt.toISOString();
|
|
657
|
+
const expiresAt = resolveExpiresAtIso(createdAt.getTime(), ttlMs);
|
|
656
658
|
const meta = {
|
|
657
659
|
id,
|
|
658
660
|
token,
|
|
659
661
|
title: params.title,
|
|
660
662
|
inputKind: params.inputKind,
|
|
661
663
|
fileCount: params.fileCount,
|
|
662
|
-
createdAt:
|
|
663
|
-
expiresAt
|
|
664
|
+
createdAt: createdAtIso,
|
|
665
|
+
expiresAt,
|
|
664
666
|
viewerPath: `${VIEWER_PREFIX}/${id}/${token}`,
|
|
665
667
|
htmlPath,
|
|
666
668
|
...params.context ? { context: params.context } : {}
|
|
@@ -714,12 +716,11 @@ var DiffArtifactStore = class {
|
|
|
714
716
|
const filePath = path.join(artifactDir, `preview.${format}`);
|
|
715
717
|
const ttlMs = normalizeTtlMs$1(params.ttlMs);
|
|
716
718
|
const createdAt = /* @__PURE__ */ new Date();
|
|
717
|
-
const expiresAt = new Date(createdAt.getTime() + ttlMs).toISOString();
|
|
718
719
|
const meta = {
|
|
719
720
|
kind: "standalone_file",
|
|
720
721
|
id,
|
|
721
722
|
createdAt: createdAt.toISOString(),
|
|
722
|
-
expiresAt,
|
|
723
|
+
expiresAt: resolveExpiresAtIso(createdAt.getTime(), ttlMs),
|
|
723
724
|
filePath: this.normalizeStoredPath(filePath, "filePath"),
|
|
724
725
|
...params.context ? { context: params.context } : {}
|
|
725
726
|
};
|
|
@@ -853,6 +854,9 @@ function normalizeTtlMs$1(value) {
|
|
|
853
854
|
if (rounded <= 0) return DEFAULT_TTL_MS;
|
|
854
855
|
return Math.min(rounded, MAX_TTL_MS);
|
|
855
856
|
}
|
|
857
|
+
function resolveExpiresAtIso(createdAtMs, ttlMs) {
|
|
858
|
+
return timestampMsToIsoString(createdAtMs + ttlMs) ?? timestampMsToIsoString(MAX_DATE_TIMESTAMP_MS) ?? "1970-01-01T00:00:00.000Z";
|
|
859
|
+
}
|
|
856
860
|
function isExpired(meta) {
|
|
857
861
|
const expiresAt = Date.parse(meta.expiresAt);
|
|
858
862
|
if (!Number.isFinite(expiresAt)) return true;
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/diffs",
|
|
3
|
-
"version": "2026.5.
|
|
3
|
+
"version": "2026.5.30-beta.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@openclaw/diffs",
|
|
9
|
-
"version": "2026.5.
|
|
9
|
+
"version": "2026.5.30-beta.1",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@pierre/diffs": "1.2.3",
|
|
12
12
|
"@pierre/theme": "1.0.3",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/diffs",
|
|
3
|
-
"version": "2026.5.
|
|
3
|
+
"version": "2026.5.30-beta.1",
|
|
4
4
|
"description": "OpenClaw read-only diff viewer plugin and file renderer for agents.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"minHostVersion": ">=2026.4.30"
|
|
27
27
|
},
|
|
28
28
|
"compat": {
|
|
29
|
-
"pluginApi": ">=2026.5.
|
|
29
|
+
"pluginApi": ">=2026.5.30-beta.1"
|
|
30
30
|
},
|
|
31
31
|
"assetScripts": {
|
|
32
32
|
"build": "node ../../scripts/build-diffs-viewer-runtime.mjs curated"
|
|
33
33
|
},
|
|
34
34
|
"build": {
|
|
35
|
-
"openclawVersion": "2026.5.
|
|
35
|
+
"openclawVersion": "2026.5.30-beta.1",
|
|
36
36
|
"staticAssets": [
|
|
37
37
|
{
|
|
38
38
|
"source": "./assets/viewer-runtime.js",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"skills/**"
|
|
57
57
|
],
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"openclaw": ">=2026.5.
|
|
59
|
+
"openclaw": ">=2026.5.30-beta.1"
|
|
60
60
|
},
|
|
61
61
|
"peerDependenciesMeta": {
|
|
62
62
|
"openclaw": {
|