bareloop 0.2.0 → 0.4.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 +426 -0
- package/README.md +15 -6
- package/bareloop.context.md +295 -14
- package/package.json +3 -3
- package/src/extract.js +14 -6
- package/src/index.js +13 -3
- package/src/interpret.js +652 -29
- package/src/job.js +119 -3
- package/src/ledger.js +266 -0
- package/src/ralph.js +245 -15
- package/src/root.js +305 -0
- package/src/run.js +507 -0
- package/src/text.js +65 -8
- package/src/validate.js +42 -1
- package/types/extract.d.ts +4 -2
- package/types/index.d.ts +5 -3
- package/types/interpret.d.ts +47 -6
- package/types/job.d.ts +32 -1
- package/types/ledger.d.ts +76 -0
- package/types/ralph.d.ts +111 -17
- package/types/root.d.ts +96 -0
- package/types/run.d.ts +71 -0
- package/types/text.d.ts +35 -1
- package/types/validate.d.ts +13 -0
package/types/text.d.ts
CHANGED
|
@@ -1 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Fence-robust artifact extraction (F2 port requirements #1/#2):
|
|
3
|
+
* - a fenced block opening within the first {@link FENCE_PREAMBLE_LINES} lines
|
|
4
|
+
* is the artifact — prose-wrapped and preamble fences extract clean (the F21
|
|
5
|
+
* instrument caveat: prose written to the target corrupted the close signal);
|
|
6
|
+
* - a fence opening deeper is the artifact's own content — the trimmed whole
|
|
7
|
+
* text is the artifact (fence-heavy artifacts belong in tool mode, where the
|
|
8
|
+
* worker writes files directly and nothing is parsed);
|
|
9
|
+
* - no fence → the trimmed whole text, with N0's unclosed-leading-fence strip
|
|
10
|
+
* as the fallback (reference parity);
|
|
11
|
+
* - nothing extractable → `code: null` plus a named reason: artifact-red
|
|
12
|
+
* material for the caller's OWN axis, never a silent empty write.
|
|
13
|
+
* Never throws.
|
|
14
|
+
* @param {string|null|undefined} t
|
|
15
|
+
* @returns {{ code: string|null, red: string|null }}
|
|
16
|
+
*/
|
|
17
|
+
export function extractArtifact(t: string | null | undefined): {
|
|
18
|
+
code: string | null;
|
|
19
|
+
red: string | null;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* The ONE spelling of the F6 honest-null cost read on a bare-agent result.
|
|
23
|
+
* `metrics.costUsd` is the honest null when NOTHING priced — never fall
|
|
24
|
+
* through to `cost` when metrics exist: `cost` sums priced rounds only, so an
|
|
25
|
+
* all-unpriced run reports cost 0 and `?? cost` would launder the explicit
|
|
26
|
+
* unknown into a silent $0 (the F6 class — four shipped launderings were this
|
|
27
|
+
* exact fallback chain hand-spelled). `unpricedRounds` makes a PARTIALLY
|
|
28
|
+
* unpriced run visible (costUsd finite but an under-count).
|
|
29
|
+
* @param {any} r a Loop.run() result (or null)
|
|
30
|
+
* @returns {{ costUsd: number|null, unpricedRounds: number }}
|
|
31
|
+
*/
|
|
32
|
+
export function priceOf(r: any): {
|
|
33
|
+
costUsd: number | null;
|
|
34
|
+
unpricedRounds: number;
|
|
35
|
+
};
|
package/types/validate.d.ts
CHANGED
|
@@ -25,6 +25,18 @@ export function scopeContained(s: string): boolean;
|
|
|
25
25
|
export function isObj(v: unknown): boolean;
|
|
26
26
|
/** @param {unknown} v @returns {v is string} */
|
|
27
27
|
export function isNonEmptyString(v: unknown): v is string;
|
|
28
|
+
/**
|
|
29
|
+
* Scan a RAW text stream (a spine file, a close's output, a transcript) for
|
|
30
|
+
* known secret shapes and return the literal matches. The ONE spelling of the
|
|
31
|
+
* text-side scan, for the same reason SECRET_PATTERNS is the ONE inventory: a
|
|
32
|
+
* hand-rolled copy that misses a shape is a leak on the very output it guards
|
|
33
|
+
* (seven copies of this expression lived in scripts/ before it landed here).
|
|
34
|
+
* `sweepSecretLiterals` is the config-tree twin — same shapes, tree walk.
|
|
35
|
+
* Never throws; returns [] for a missing stream.
|
|
36
|
+
* @param {unknown} raw
|
|
37
|
+
* @returns {string[]} every match, in stream order per pattern
|
|
38
|
+
*/
|
|
39
|
+
export function scanSecrets(raw: unknown): string[];
|
|
28
40
|
/**
|
|
29
41
|
* Red every string in a config tree that carries a known secret-token shape.
|
|
30
42
|
* @param {any} root
|
|
@@ -66,4 +78,5 @@ export function diffPaths(a: object, b: object): string[];
|
|
|
66
78
|
export const LOOP_SHAPES: readonly string[];
|
|
67
79
|
export const SLOTS: readonly string[];
|
|
68
80
|
export const VERBS: readonly string[];
|
|
81
|
+
export const REMEMBER_KINDS: string[];
|
|
69
82
|
export const SECRET_PATTERNS: RegExp[];
|