@bendyline/gezel-sdk 1.1.14 → 1.1.16
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/README.md +19 -0
- package/dist/checks.js +25 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -30,6 +30,25 @@ gezel.output({
|
|
|
30
30
|
});
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
+
## Running a script
|
|
34
|
+
|
|
35
|
+
Save the script as `~/.gezel/projects/<projectId>/scripts/has-tests.ts`, or
|
|
36
|
+
create it under **Scripts** in the Gezel app. The daemon then runs it on
|
|
37
|
+
demand, as a craftbook step's hook, or as a completion gate.
|
|
38
|
+
[Writing scripts with gezel-sdk](https://gezel.com/docs/writing-scripts-with-gezel-sdk/)
|
|
39
|
+
covers inputs, capabilities and gates.
|
|
40
|
+
|
|
41
|
+
The daemon's default executor is a Node sandbox that starts a script only inside
|
|
42
|
+
the operating system's own sandbox: Seatbelt on macOS, a systemd or helper
|
|
43
|
+
sandbox on Linux, and Microsoft's container launcher (MXC) on Windows. The
|
|
44
|
+
desktop app installs the Windows launcher; a daemon installed from npm downloads
|
|
45
|
+
it on first start when its security level allows app network traffic. Without
|
|
46
|
+
one, the daemon refuses to start a script rather than run it unconfined, with
|
|
47
|
+
`denyNet requires an enforceable OS network boundary`. To run scripts in your
|
|
48
|
+
own process instead, use the QuickJS executor from
|
|
49
|
+
[`@bendyline/gezel-script-runtime`](https://www.npmjs.com/package/@bendyline/gezel-script-runtime),
|
|
50
|
+
which needs no operating-system sandbox.
|
|
51
|
+
|
|
33
52
|
## Entry points
|
|
34
53
|
|
|
35
54
|
| Subpath | Contents |
|
package/dist/checks.js
CHANGED
|
@@ -795,7 +795,7 @@ function extractClaims(text) {
|
|
|
795
795
|
for (const m of unquoted.matchAll(CLOCK_TIME)) add("number", m[1] ?? "", { clock: true });
|
|
796
796
|
const numeric = unquoted.replace(CLOCK_TIME, (time) => " ".repeat(time.length));
|
|
797
797
|
for (const m of numeric.matchAll(
|
|
798
|
-
/(?<![\w.])(\d{1,3}(?:,\d{3})
|
|
798
|
+
/(?<![\w.])(\d{1,3}(?:,\d{3})+(?:\.\d+)?|\d+(?:\.\d+)?)(?:st|nd|rd|th|s)?(?![\w.]*\d)/g
|
|
799
799
|
)) {
|
|
800
800
|
const digits = (m[1] ?? "").replace(/,/g, "");
|
|
801
801
|
const value = Number(digits);
|
|
@@ -993,6 +993,7 @@ function groundContext(evidence, options) {
|
|
|
993
993
|
everything: [...normalized.values()].join("\n") + given,
|
|
994
994
|
sources: [...normalized.values(), ...given ? [given] : []],
|
|
995
995
|
given,
|
|
996
|
+
names: options.names ?? true,
|
|
996
997
|
...options.opaque ? { opaque: options.opaque } : {}
|
|
997
998
|
};
|
|
998
999
|
}
|
|
@@ -1036,7 +1037,7 @@ function groundWith(ctx, sentence) {
|
|
|
1036
1037
|
if (sentence.cites.length === 0 && DISCLAIMS.test(sentence.text)) {
|
|
1037
1038
|
return { ...sentence, status: "non-factual", checks: [], missing: [] };
|
|
1038
1039
|
}
|
|
1039
|
-
const claims = extractClaims(sentence.text);
|
|
1040
|
+
const claims = extractClaims(sentence.text).filter((c) => ctx.names || c.kind !== "name");
|
|
1040
1041
|
const opaque = sentence.cites.filter((n) => !ctx.evidence.has(n) && ctx.opaque?.(n));
|
|
1041
1042
|
const badCites = sentence.cites.filter((n) => !ctx.evidence.has(n) && !opaque.includes(n));
|
|
1042
1043
|
if (badCites.length > 0) {
|
|
@@ -1990,16 +1991,23 @@ var SLOT_WORDS = /* @__PURE__ */ new Set(["path", "url", "path/url", "file", "no
|
|
|
1990
1991
|
function isTemplateSlot(cap) {
|
|
1991
1992
|
return ANGLE_SLOT_RE.test(cap) || NO_NAME_RE.test(cap) || SLOT_WORDS.has(cleanCitation(cap).toLowerCase());
|
|
1992
1993
|
}
|
|
1994
|
+
var FORMULA_RE = /^=/;
|
|
1993
1995
|
function extractCitations(text, re) {
|
|
1994
1996
|
const flags = re.flags.includes("g") ? re.flags : `${re.flags}g`;
|
|
1995
1997
|
const global = new RegExp(re.source, flags);
|
|
1996
1998
|
const out = [];
|
|
1997
1999
|
for (const m of stripFencedBlocks(text).matchAll(global)) {
|
|
1998
2000
|
const cap = m.slice(1).find((x) => x !== void 0) ?? m[0];
|
|
1999
|
-
if (cap && !TASK_REF_RE.test(cap) && !isTemplateSlot(cap)
|
|
2001
|
+
if (cap && !TASK_REF_RE.test(cap) && !isTemplateSlot(cap) && !FORMULA_RE.test(cap)) {
|
|
2002
|
+
out.push(cap);
|
|
2003
|
+
}
|
|
2000
2004
|
}
|
|
2001
2005
|
return out;
|
|
2002
2006
|
}
|
|
2007
|
+
var PACKAGE_SPECIFIER_RE = /^@[a-z0-9][\w.~-]*\/[a-z0-9][\w.~-]*(?:\/[\w.~/-]*)?(?:@[\w.^~<>=*-]+)?$/i;
|
|
2008
|
+
function citedFileKey(cite) {
|
|
2009
|
+
return normalizeForKnownMatch(cleanCitedPath(cite));
|
|
2010
|
+
}
|
|
2003
2011
|
function cleanCitation(raw) {
|
|
2004
2012
|
return raw.trim().replace(/^[<'"`(]+/, "").replace(/[>'"`).,;:]+$/, "");
|
|
2005
2013
|
}
|
|
@@ -2074,10 +2082,23 @@ async function citationsResolve(ws, file, opts = {}) {
|
|
|
2074
2082
|
continue;
|
|
2075
2083
|
}
|
|
2076
2084
|
if (corpus?.has(c.toLowerCase()) || await citedPathExists(c)) resolved.push(c);
|
|
2077
|
-
else if (known.has(normalizeForKnownMatch(c)) || globMatchesKnown(c, known) || proposed.has(normalizeForKnownMatch(c))) {
|
|
2085
|
+
else if (known.has(normalizeForKnownMatch(c)) || globMatchesKnown(c, known) || proposed.has(normalizeForKnownMatch(c)) || PACKAGE_SPECIFIER_RE.test(c)) {
|
|
2078
2086
|
forgiven.push(c);
|
|
2079
2087
|
} else unresolved.push(c);
|
|
2080
2088
|
}
|
|
2089
|
+
if (!corpus && unresolved.length > 0 && resolved.length > 0) {
|
|
2090
|
+
const resolvedKeys = resolved.map(citedFileKey);
|
|
2091
|
+
for (let i = unresolved.length - 1; i >= 0; i--) {
|
|
2092
|
+
const cite = unresolved[i];
|
|
2093
|
+
if (/^[a-z][\w+.-]*:\/\//i.test(cite)) continue;
|
|
2094
|
+
const key = citedFileKey(cite);
|
|
2095
|
+
if (!key) continue;
|
|
2096
|
+
if (resolvedKeys.some((full) => full === key || full.endsWith(`/${key}`))) {
|
|
2097
|
+
unresolved.splice(i, 1);
|
|
2098
|
+
resolved.push(cite);
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2081
2102
|
if (cites.length - forgiven.length < min) {
|
|
2082
2103
|
return {
|
|
2083
2104
|
ok: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bendyline/gezel-sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.16",
|
|
4
4
|
"description": "SDK for scripts that run in the Gezel sandbox: the gezel object and the defineScript helper.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"!dist/**/*.map"
|
|
64
64
|
],
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@bendyline/gezel": "1.
|
|
66
|
+
"@bendyline/gezel": "1.3.1",
|
|
67
67
|
"tsup": "^8.5.1",
|
|
68
68
|
"typescript": "^6.0.3",
|
|
69
69
|
"vitest": "^4.1.10"
|