@bendyline/gezel-sdk 1.0.10 → 1.1.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/README.md +28 -1
- package/dist/checks.d.ts +66 -2
- package/dist/checks.js +1337 -846
- package/dist/index.d.ts +5 -711
- package/dist/index.js +102 -91
- package/dist/portable.d.ts +742 -0
- package/dist/portable.js +102 -0
- package/dist/{types-DCBb1goX.d.ts → types-rOo0kM35.d.ts} +1 -1
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -34,7 +34,8 @@ gezel.output({
|
|
|
34
34
|
|
|
35
35
|
| Subpath | Contents |
|
|
36
36
|
|---|---|
|
|
37
|
-
| `@bendyline/gezel-sdk` | `
|
|
37
|
+
| `@bendyline/gezel-sdk` | Node sandbox's `gezel` context, `defineScript`, and script context types |
|
|
38
|
+
| `@bendyline/gezel-sdk/portable` | `createGezelSDK`, `defineScript`, and platform-independent context/transport types |
|
|
38
39
|
| `@bendyline/gezel-sdk/checks` | Reusable gate-check primitives |
|
|
39
40
|
| `@bendyline/gezel-sdk/stores` | Store interfaces for custom backends |
|
|
40
41
|
|
|
@@ -43,6 +44,32 @@ daemon's script runner. See
|
|
|
43
44
|
[`@bendyline/gezel-script-stdlib`](https://www.npmjs.com/package/@bendyline/gezel-script-stdlib)
|
|
44
45
|
for the standard library of gate scripts built on it.
|
|
45
46
|
|
|
47
|
+
## Embedded runtimes
|
|
48
|
+
|
|
49
|
+
Hosts without Node can create a context for each script run through the portable
|
|
50
|
+
entry. It has no Node imports, stdin reads, global singleton, or platform globals:
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import { createGezelSDK, type ScriptTransport } from '@bendyline/gezel-sdk/portable';
|
|
54
|
+
|
|
55
|
+
function createScriptContext(transport: ScriptTransport) {
|
|
56
|
+
return createGezelSDK(transport);
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The host supplies `transport.init` before executing the script, forwards
|
|
61
|
+
`call(method, params)` through its permission-checked dispatcher, and delivers
|
|
62
|
+
`notify(method, params)` synchronously. Outstanding calls must reject when the
|
|
63
|
+
run is cancelled or disposed. Each context permits one `gezel.output()` stamp.
|
|
64
|
+
An optional `log` callback mirrors log messages to a runtime-specific sink;
|
|
65
|
+
`script.log` notifications are always sent through the transport.
|
|
66
|
+
|
|
67
|
+
This boundary supplies the SDK API to an embedded interpreter; the host remains
|
|
68
|
+
responsible for isolation, memory and time limits, capability checks, and the
|
|
69
|
+
interpreter's asynchronous job loop. Existing desktop scripts keep importing
|
|
70
|
+
`gezel` from the default entry, which retains stdin initialization, fd-3 RPC,
|
|
71
|
+
and stderr logging.
|
|
72
|
+
|
|
46
73
|
## Stability
|
|
47
74
|
|
|
48
75
|
Public API under semver.
|
package/dist/checks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as GateScriptResult } from './types-
|
|
1
|
+
import { G as GateScriptResult } from './types-rOo0kM35.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* ─ Shared deliverable checks ─────────────────────────────────────────
|
|
@@ -42,6 +42,9 @@ interface CheckResult {
|
|
|
42
42
|
detail: string;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
type StepSniffName = 'html-complete' | 'html-game' | 'nonempty' | 'json-valid' | 'data-table';
|
|
46
|
+
declare function runSniff(name: StepSniffName, content: string): boolean;
|
|
47
|
+
|
|
45
48
|
/**
|
|
46
49
|
* Existence oracle for cited workspace paths — the shared spine of the
|
|
47
50
|
* anti-fabrication checks (`citationsResolve`, `securityReport`,
|
|
@@ -170,6 +173,21 @@ declare function htmlGameSniff(html: string, minJsBytes?: number): boolean;
|
|
|
170
173
|
* users see is byte-identical wherever a check runs.
|
|
171
174
|
*/
|
|
172
175
|
declare function fileMinBytes(ws: WorkspaceLike, file: string, bytes: number, trim?: boolean): Promise<CheckResult>;
|
|
176
|
+
/**
|
|
177
|
+
* The entries of a YAML frontmatter list field — `key: [a, b]`, `key: a, b`,
|
|
178
|
+
* or `key:` followed by `- a` lines — or null when the file has no
|
|
179
|
+
* frontmatter or no such key.
|
|
180
|
+
*/
|
|
181
|
+
declare function frontmatterList(content: string, key: string): string[] | null;
|
|
182
|
+
/**
|
|
183
|
+
* Every value a deliverable lists has its own file: each entry of the
|
|
184
|
+
* frontmatter list `key` in `file` names `pathTemplate` with `{value}`
|
|
185
|
+
* replaced by the entry's lowercase slug ("Instagram" → `instagram`), and each
|
|
186
|
+
* of those must hold at least `minBytes`.
|
|
187
|
+
*/
|
|
188
|
+
declare function listedFiles(ws: WorkspaceLike, file: string, key: string, pathTemplate: string, minBytes?: number): Promise<CheckResult & {
|
|
189
|
+
missing: string[];
|
|
190
|
+
}>;
|
|
173
191
|
declare function fileMinLines(ws: WorkspaceLike, file: string, minLines: number): Promise<CheckResult>;
|
|
174
192
|
declare function totalMinBytes(ws: WorkspaceLike, files: string[], bytes: number): Promise<CheckResult>;
|
|
175
193
|
declare function fileCountByExt(ws: WorkspaceLike, ext: string[], min: number, dir?: string, opts?: {
|
|
@@ -659,6 +677,52 @@ declare function unsupportedClaims(ws: WorkspaceLike, file: string, sourceFiles:
|
|
|
659
677
|
*/
|
|
660
678
|
declare function wrapperReturnHint(outputLines: readonly string[]): string | null;
|
|
661
679
|
|
|
680
|
+
/**
|
|
681
|
+
* Figure checks: the numbers an owner would send to a customer.
|
|
682
|
+
*
|
|
683
|
+
* A review run's catering quote said $297.00 for items that add up to
|
|
684
|
+
* $197.00, called Saturday October 10 a Friday, and priced a fruit platter the
|
|
685
|
+
* owner never priced. Nothing looked at the numbers before the owner did.
|
|
686
|
+
* These checks need no spec: subtotals against their items, quantity × unit
|
|
687
|
+
* price, weekday against date, dates that have clearly passed, and, when the
|
|
688
|
+
* caller supplies what the owner said, prices that came from nowhere.
|
|
689
|
+
*
|
|
690
|
+
* Deliberately conservative. A false alarm on an owner's review card costs
|
|
691
|
+
* more trust than it buys, so anything ambiguous (a per-unit price with no
|
|
692
|
+
* line total, a total line quoting several options) is skipped, not guessed.
|
|
693
|
+
*/
|
|
694
|
+
type FigureFindingKind = 'sum' | 'line-math' | 'weekday' | 'stale-date' | 'unsourced-price';
|
|
695
|
+
interface FigureFinding {
|
|
696
|
+
kind: FigureFindingKind;
|
|
697
|
+
/** 1-based line in the checked text. */
|
|
698
|
+
line: number;
|
|
699
|
+
/** One owner-facing sentence. */
|
|
700
|
+
message: string;
|
|
701
|
+
/** For `unsourced-price`: the item and its price, for a caller that groups them. */
|
|
702
|
+
item?: string;
|
|
703
|
+
amount?: string;
|
|
704
|
+
}
|
|
705
|
+
interface FigureCheckResult {
|
|
706
|
+
findings: FigureFinding[];
|
|
707
|
+
/** How much was actually checked, so a caller can say "the sums add up" honestly. */
|
|
708
|
+
checked: {
|
|
709
|
+
sums: number;
|
|
710
|
+
lineMath: number;
|
|
711
|
+
dates: number;
|
|
712
|
+
prices: number;
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
interface FigureCheckOptions {
|
|
716
|
+
/** Today as YYYY-MM-DD, in the owner's time zone. */
|
|
717
|
+
today: string;
|
|
718
|
+
/** Amounts the owner supplied. Without any, prices are not checked for provenance. */
|
|
719
|
+
knownAmounts?: readonly number[];
|
|
720
|
+
}
|
|
721
|
+
/** Every currency amount in some text: the "known" side of a price check. */
|
|
722
|
+
declare function extractMoneyAmounts(text: string): number[];
|
|
723
|
+
/** Check the figures in one text deliverable (markdown or plain text). */
|
|
724
|
+
declare function checkFigures(text: string, opts: FigureCheckOptions): FigureCheckResult;
|
|
725
|
+
|
|
662
726
|
interface MarkdownHeadingsMatchResult extends CheckResult {
|
|
663
727
|
outlineHeadings: string[];
|
|
664
728
|
documentHeadings: string[];
|
|
@@ -847,4 +911,4 @@ declare function workspaceFromGezel(g: {
|
|
|
847
911
|
};
|
|
848
912
|
}): WorkspaceLike;
|
|
849
913
|
|
|
850
|
-
export { type CellType, type CheckResult, type CitationsResult, type CodebaseReviewReportOptions, type CodebaseReviewReportResult, type CorpusCoverageLedger, type CorpusCoverageMergeResult, type CorpusCoverageShardInput, type CsvShapeResult, type CsvShapeSpec, type EntitiesResult, type EntitySpec, type ExplainableSniff, GateScriptResult, type GroundingFact, type GroundingResult, IMG_EXT, type ImageRefsReport, type InlineScript, type JsonPathEqualsResult, type JsonScalar, type JudgeVerdict, MIN_INLINE_JS_BYTES, MIN_JUDGE_EVIDENCE_SUBSTRING, type MarkdownHeadingsMatchResult, type ParsedTable, type PlanRow, type PlanStructureResult, type PlanStructureSpec, type ReadingLevelResult, type RecordFieldSpec, type RecordSchemaResult, type RecordSchemaSpec, type ScriptValidation, type SecurityReportOptions, type SecurityReportResult, type TableShapeResult, type TableShapeSpec, type UnsupportedClaimPattern, type UnsupportedClaimViolation, type UnsupportedClaimsResult, type ValuesSubsetResult, type ValuesSubsetSpec, type WordBandResult, type WorkspaceLike, buildJudgePrompt, citationsResolve, citedPathKey, cleanCitedPath, codebaseReviewReport, containsPattern, countDistinctMatches, createCitedPathChecker, cssMinBytes, csvShape, dataTableSniff, detectTypeScriptOnlySyntax, detectUnclosedScript, esmImports, explainSniff, extractInlineScripts, fileCountByExt, fileMinBytes, fileMinLines, findImageRefs, gateResult, grepMatches, htmlCompleteSniff, htmlGameSniff, imageRefsResolve, inlineJsBytes, isRealIsoDate, jsonPathEquals, jsonValid, markdownHeadingsMatch, mergeCorpusCoverageShards, namedEntitiesConsistent, normalizeDigitGroups, normalizeInlineEmphasis, notContainsPattern, parseCsv, parseJudgeVerdict, parseMarkdownTable, planStructure, readingLevel, recordSchema, requireOrderedSections, resolveRelative, securityReport, standaloneJsParses, tableShape, totalMinBytes, unsupportedClaims, validateJudgeEvidence, validateScriptSyntax, valueGrounding, valuesSubsetOf, wordBand, workspaceFromGezel, wrapperReturnHint };
|
|
914
|
+
export { type CellType, type CheckResult, type CitationsResult, type CodebaseReviewReportOptions, type CodebaseReviewReportResult, type CorpusCoverageLedger, type CorpusCoverageMergeResult, type CorpusCoverageShardInput, type CsvShapeResult, type CsvShapeSpec, type EntitiesResult, type EntitySpec, type ExplainableSniff, type FigureCheckOptions, type FigureCheckResult, type FigureFinding, type FigureFindingKind, GateScriptResult, type GroundingFact, type GroundingResult, IMG_EXT, type ImageRefsReport, type InlineScript, type JsonPathEqualsResult, type JsonScalar, type JudgeVerdict, MIN_INLINE_JS_BYTES, MIN_JUDGE_EVIDENCE_SUBSTRING, type MarkdownHeadingsMatchResult, type ParsedTable, type PlanRow, type PlanStructureResult, type PlanStructureSpec, type ReadingLevelResult, type RecordFieldSpec, type RecordSchemaResult, type RecordSchemaSpec, type ScriptValidation, type SecurityReportOptions, type SecurityReportResult, type StepSniffName, type TableShapeResult, type TableShapeSpec, type UnsupportedClaimPattern, type UnsupportedClaimViolation, type UnsupportedClaimsResult, type ValuesSubsetResult, type ValuesSubsetSpec, type WordBandResult, type WorkspaceLike, buildJudgePrompt, checkFigures, citationsResolve, citedPathKey, cleanCitedPath, codebaseReviewReport, containsPattern, countDistinctMatches, createCitedPathChecker, cssMinBytes, csvShape, dataTableSniff, detectTypeScriptOnlySyntax, detectUnclosedScript, esmImports, explainSniff, extractInlineScripts, extractMoneyAmounts, fileCountByExt, fileMinBytes, fileMinLines, findImageRefs, frontmatterList, gateResult, grepMatches, htmlCompleteSniff, htmlGameSniff, imageRefsResolve, inlineJsBytes, isRealIsoDate, jsonPathEquals, jsonValid, listedFiles, markdownHeadingsMatch, mergeCorpusCoverageShards, namedEntitiesConsistent, normalizeDigitGroups, normalizeInlineEmphasis, notContainsPattern, parseCsv, parseJudgeVerdict, parseMarkdownTable, planStructure, readingLevel, recordSchema, requireOrderedSections, resolveRelative, runSniff, securityReport, standaloneJsParses, tableShape, totalMinBytes, unsupportedClaims, validateJudgeEvidence, validateScriptSyntax, valueGrounding, valuesSubsetOf, wordBand, workspaceFromGezel, wrapperReturnHint };
|