@nextclaw/x-harness 0.2.5 → 0.2.6
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/SOURCE.md +2 -2
- package/dist/growth-recovery.js +10 -6
- package/dist/platform-rules.d.ts +1 -0
- package/dist/platform-rules.js +5 -0
- package/dist/platform-writing.js +2 -5
- package/package.json +2 -2
package/SOURCE.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Corresponding source
|
|
2
2
|
|
|
3
|
-
Version 0.2.
|
|
3
|
+
Version 0.2.6, commit 7f48fb11b07a0e043cfaccfc377183d71f23eef2.
|
|
4
4
|
|
|
5
|
-
Complete source, build scripts and dependencies: https://github.com/Peiiii/x-harness/tree/
|
|
5
|
+
Complete source, build scripts and dependencies: https://github.com/Peiiii/x-harness/tree/7f48fb11b07a0e043cfaccfc377183d71f23eef2
|
|
6
6
|
|
|
7
7
|
Clone this revision, run npm ci, npm run bootstrap and npm run release:build.
|
|
8
8
|
|
package/dist/growth-recovery.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { xURL } from "./platform-rules.js";
|
|
1
|
+
import { xURL, matchesReviewedAssets } from "./platform-rules.js";
|
|
2
2
|
import { same } from "./growth-constants.js";
|
|
3
3
|
export class GrowthRecovery {
|
|
4
4
|
#capability;
|
|
@@ -53,7 +53,7 @@ export class GrowthRecovery {
|
|
|
53
53
|
url: publicURL,
|
|
54
54
|
evidenceRef,
|
|
55
55
|
});
|
|
56
|
-
const trailing = action.text.match(/\n
|
|
56
|
+
const trailing = action.text.match(/\n+(https:\/\/\S+)$/);
|
|
57
57
|
const matches = (observation.posts ?? []).filter((p) => {
|
|
58
58
|
const exact = p.body === action.text;
|
|
59
59
|
const card = trailing &&
|
|
@@ -69,9 +69,14 @@ export class GrowthRecovery {
|
|
|
69
69
|
sourceLink.resolvedURL === trailing[1] &&
|
|
70
70
|
p.links?.includes(sourceLink.href)) {
|
|
71
71
|
try {
|
|
72
|
+
const displayed = new URL(sourceLink.renderedText.replace(/\s/g, "").replace(/…$/, ""));
|
|
73
|
+
const resolved = new URL(sourceLink.resolvedURL);
|
|
74
|
+
// This rendering allowance requires the observed short link's actual
|
|
75
|
+
// destination to equal the reviewed source URL in the guard above.
|
|
76
|
+
if (resolved.hostname === `www.${displayed.hostname}`)
|
|
77
|
+
displayed.hostname = resolved.hostname;
|
|
72
78
|
renderedSource =
|
|
73
|
-
|
|
74
|
-
sourceLink.resolvedURL &&
|
|
79
|
+
displayed.href === resolved.href &&
|
|
75
80
|
p.body?.endsWith(sourceLink.renderedText) &&
|
|
76
81
|
p.body.slice(0, -sourceLink.renderedText.length).trimEnd() ===
|
|
77
82
|
action.text.slice(0, -trailing[0].length);
|
|
@@ -87,8 +92,7 @@ export class GrowthRecovery {
|
|
|
87
92
|
!(action.beforeIds ?? []).includes(p.id) &&
|
|
88
93
|
Date.parse(p.datetime) >= Date.parse(action.intentAt) &&
|
|
89
94
|
Date.parse(p.datetime) <= this.#clock() + 5000 &&
|
|
90
|
-
(
|
|
91
|
-
action.assets.every((a) => p.images?.some((i) => i.alt === a.alt))));
|
|
95
|
+
matchesReviewedAssets(p, action.assets));
|
|
92
96
|
});
|
|
93
97
|
Object.assign(observation, {
|
|
94
98
|
verified: !observation.needsStateCheck &&
|
package/dist/platform-rules.d.ts
CHANGED
package/dist/platform-rules.js
CHANGED
|
@@ -39,3 +39,8 @@ export const source = (post, page) => ({
|
|
|
39
39
|
...(!post.body ? ["exact-body-unconfirmed"] : []),
|
|
40
40
|
],
|
|
41
41
|
});
|
|
42
|
+
export function matchesReviewedAssets(post, assets = []) {
|
|
43
|
+
return assets.every((asset) => /\.mp4$/i.test(asset.path ?? "")
|
|
44
|
+
? post.media?.some((media) => media.kind === "video")
|
|
45
|
+
: post.images?.some((image) => image.alt === asset.alt));
|
|
46
|
+
}
|
package/dist/platform-writing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { xURL, sameHandle, sameText, samePublishedText, } from "./platform-rules.js";
|
|
1
|
+
import { xURL, sameHandle, sameText, samePublishedText, matchesReviewedAssets, } from "./platform-rules.js";
|
|
2
2
|
export class PlatformWriting {
|
|
3
3
|
#observed;
|
|
4
4
|
#browser;
|
|
@@ -127,10 +127,7 @@ export class PlatformWriting {
|
|
|
127
127
|
const matchesContent = (post) => sameHandle(post.author, action.accountHandle) &&
|
|
128
128
|
samePublishedText(post.body, action.text) &&
|
|
129
129
|
/^\d+$/.test(post.id ?? "") &&
|
|
130
|
-
(
|
|
131
|
-
action.assets.every((asset) => /\.mp4$/i.test(asset.path ?? "")
|
|
132
|
-
? post.media?.some((media) => media.kind === "video")
|
|
133
|
-
: post.images?.some((image) => image.alt === asset.alt))) &&
|
|
130
|
+
matchesReviewedAssets(post, action.assets) &&
|
|
134
131
|
!(action.beforeIds ?? []).includes(post.id) &&
|
|
135
132
|
Number.isFinite(Date.parse(post.datetime)) &&
|
|
136
133
|
Date.parse(post.datetime) >= Date.parse(action.intentAt) &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/x-harness",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Typed X task harness with compact business results and explicit diagnostics.",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "7f48fb11b07a0e043cfaccfc377183d71f23eef2"
|
|
46
46
|
}
|