@younndai/lyt 0.9.4 → 0.9.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/README.md +1 -1
- package/dist/automator-bodies/arc-builder.js +0 -18
- package/dist/automator-bodies/arc-builder.js.map +1 -1
- package/dist/automator-bodies/index.js +0 -18
- package/dist/automator-bodies/index.js.map +1 -1
- package/dist/automator-bodies/lane-builder.js +0 -19
- package/dist/automator-bodies/lane-builder.js.map +1 -1
- package/dist/automator-bodies/metadata-filler.js +0 -49
- package/dist/automator-bodies/metadata-filler.js.map +1 -1
- package/dist/automator-run.js +0 -50
- package/dist/automator-run.js.map +1 -1
- package/dist/bench/graded-corpus.js +0 -25
- package/dist/bench/graded-corpus.js.map +1 -1
- package/dist/bench/invariant-corpus.d.ts.map +1 -1
- package/dist/bench/invariant-corpus.js +10 -39
- package/dist/bench/invariant-corpus.js.map +1 -1
- package/dist/bench/ir-metrics.js +0 -17
- package/dist/bench/ir-metrics.js.map +1 -1
- package/dist/bench/latency-bench.js +0 -23
- package/dist/bench/latency-bench.js.map +1 -1
- package/dist/bench/latency-corpus.js +2 -20
- package/dist/bench/latency-corpus.js.map +1 -1
- package/dist/bench/pod-harness.js +0 -48
- package/dist/bench/pod-harness.js.map +1 -1
- package/dist/bench/run-bench.js +0 -23
- package/dist/bench/run-bench.js.map +1 -1
- package/dist/cli-automator-run.js +0 -31
- package/dist/cli-automator-run.js.map +1 -1
- package/dist/cli.js +0 -109
- package/dist/cli.js.map +1 -1
- package/dist/commands/bench.js +0 -27
- package/dist/commands/bench.js.map +1 -1
- package/dist/commands/capture.js +0 -83
- package/dist/commands/capture.js.map +1 -1
- package/dist/commands/init.js +2 -234
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/primer.js +2 -46
- package/dist/commands/primer.js.map +1 -1
- package/dist/commands/reindex.d.ts.map +1 -1
- package/dist/commands/reindex.js +7 -34
- package/dist/commands/reindex.js.map +1 -1
- package/dist/commands/search.d.ts.map +1 -1
- package/dist/commands/search.js +4 -73
- package/dist/commands/search.js.map +1 -1
- package/dist/flows/heal.js +0 -46
- package/dist/flows/heal.js.map +1 -1
- package/dist/flows/init-bootstrap.js +0 -208
- package/dist/flows/init-bootstrap.js.map +1 -1
- package/dist/index.js +0 -18
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@ lyt vault init alex/main # vault primitive (@younndai/lyt-vault)
|
|
|
62
62
|
lyt alias home alex/main # pod-local name → vault rid (survives rename + move)
|
|
63
63
|
lyt mesh status # federation layer (@younndai/lyt-mesh)
|
|
64
64
|
lyt pattern list # patterns + skills (@younndai/lyt-vault)
|
|
65
|
-
lyt mcp
|
|
65
|
+
lyt mcp start # MCP server (@younndai/lyt-mcp)
|
|
66
66
|
lyt doctor --json # diagnostics (@younndai/lyt-vault)
|
|
67
67
|
```
|
|
68
68
|
|
|
@@ -1,25 +1,7 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2026 MARLINK TRADING SRL (YounndAI)
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
1
|
import { rebuildArcsFlow } from "@younndai/lyt-vault";
|
|
17
2
|
export async function runArcBuilderBody(_ctx, args) {
|
|
18
3
|
const result = await rebuildArcsFlow({
|
|
19
4
|
vaultPathOverride: args.vaultPath,
|
|
20
|
-
// No registry roundtrip needed — lyt-runner already resolved the
|
|
21
|
-
// vault for the run-plan. No threshold parameter on arcs (unlike
|
|
22
|
-
// lanes); arcs are always explicit declarations.
|
|
23
5
|
});
|
|
24
6
|
return {
|
|
25
7
|
vaultPath: result.vaultPath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arc-builder.js","sourceRoot":"","sources":["../../src/automator-bodies/arc-builder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"arc-builder.js","sourceRoot":"","sources":["../../src/automator-bodies/arc-builder.ts"],"names":[],"mappings":"AAoDA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AActD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,IAAmB,EACnB,IAAuB;IAEvB,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC;QACnC,iBAAiB,EAAE,IAAI,CAAC,SAAS;KAIlC,CAAC,CAAC;IACH,OAAO;QACL,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;QAC3C,oBAAoB,EAAE,MAAM,CAAC,oBAAoB;QACjD,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,UAAU,EAAE,MAAM,CAAC,UAAU;KAC9B,CAAC;AACJ,CAAC"}
|
|
@@ -1,30 +1,12 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2026 MARLINK TRADING SRL (YounndAI)
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
1
|
import { runArcBuilderBody } from "./arc-builder.js";
|
|
17
2
|
import { runLaneBuilderBody } from "./lane-builder.js";
|
|
18
3
|
import { runMetadataFillerBody } from "./metadata-filler.js";
|
|
19
|
-
// Registered v1 archetype bodies. Add new entries here when shipping new
|
|
20
|
-
// archetype implementations; the CLI dispatch reads from this map.
|
|
21
4
|
const REGISTRY = {
|
|
22
5
|
"metadata-filler": runMetadataFillerBody,
|
|
23
6
|
"lane-builder": runLaneBuilderBody,
|
|
24
7
|
"arc-builder": runArcBuilderBody,
|
|
25
8
|
};
|
|
26
9
|
export function resolveAutomatorBody(name) {
|
|
27
|
-
// Strip the optional `automator:` prefix in case callers pass the full rid.
|
|
28
10
|
const stripped = name.startsWith("automator:") ? name.slice("automator:".length) : name;
|
|
29
11
|
return REGISTRY[stripped] ?? null;
|
|
30
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/automator-bodies/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/automator-bodies/index.ts"],"names":[],"mappings":"AAgCA,OAAO,EAAE,iBAAiB,EAA0B,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAA2B,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAA8B,MAAM,sBAAsB,CAAC;AAsBzF,MAAM,QAAQ,GAAoC;IAChD,iBAAiB,EAAE,qBAAqB;IACxC,cAAc,EAAE,kBAAkB;IAClC,aAAa,EAAE,iBAAiB;CACjC,CAAC;AAEF,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAE/C,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACxF,OAAO,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC;AACpC,CAAC;AAED,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1,26 +1,7 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2026 MARLINK TRADING SRL (YounndAI)
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
1
|
import { rebuildLanesFlow } from "@younndai/lyt-vault";
|
|
17
2
|
export async function runLaneBuilderBody(_ctx, args) {
|
|
18
3
|
const result = await rebuildLanesFlow({
|
|
19
4
|
vaultPathOverride: args.vaultPath,
|
|
20
|
-
// Use the default threshold (DEFAULT_LANE_THRESHOLD = 2) — the
|
|
21
|
-
// bundled lane-builder.yon does not surface a configurable
|
|
22
|
-
// threshold yet; that ships as an @META field on the automator
|
|
23
|
-
// declaration in v1.D.2+ alongside arc-builder.
|
|
24
5
|
});
|
|
25
6
|
return {
|
|
26
7
|
vaultPath: result.vaultPath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lane-builder.js","sourceRoot":"","sources":["../../src/automator-bodies/lane-builder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lane-builder.js","sourceRoot":"","sources":["../../src/automator-bodies/lane-builder.ts"],"names":[],"mappings":"AA4CA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAavD,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,IAAmB,EACnB,IAAuB;IAEvB,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC;QACpC,iBAAiB,EAAE,IAAI,CAAC,SAAS;KAKlC,CAAC,CAAC;IACH,OAAO;QACL,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,kBAAkB,EAAE,MAAM,CAAC,kBAAkB;QAC7C,oBAAoB,EAAE,MAAM,CAAC,oBAAoB;QACjD,UAAU,EAAE,MAAM,CAAC,UAAU;KAC9B,CAAC;AACJ,CAAC"}
|
|
@@ -1,35 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2026 MARLINK TRADING SRL (YounndAI)
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
// Metadata-filler automator body (block-B Commit 7).
|
|
17
|
-
//
|
|
18
|
-
// Per arc-thoughts §6.13 Example 1 (LOCKED 2026-05-27) + the bundled
|
|
19
|
-
// declaration at packages/lyt-vault/src/scaffold/defaults/automators/
|
|
20
|
-
// metadata-filler.yon — archetype=filler, runtime=deterministic,
|
|
21
|
-
// llm_capability=none. Walks <vault>/notes/**/*.md, detects which of the
|
|
22
|
-
// 8 mandatory frontmatter fields (arc §3 contract — title, created,
|
|
23
|
-
// modified, tags, purpose, topic, mesh-visibility, weight) are missing,
|
|
24
|
-
// fills missing ones with deterministic defaults, and writes back via
|
|
25
|
-
// the pre-write @STAMP hook so provenance + audit_log + last_provenance:
|
|
26
|
-
// land per arc §11.4.
|
|
27
|
-
//
|
|
28
|
-
// Why this lives in @younndai/lyt — and not lyt-runner — block-B v1:
|
|
29
|
-
// runFiveStep's `runBody` is body-shape-agnostic; the meta CLI is the
|
|
30
|
-
// single place that knows which archetype maps to which TS function for
|
|
31
|
-
// v1. Future archetypes (rollup, ingest, lane-builder) add their own
|
|
32
|
-
// modules here and get dispatched by automator-bodies/index.ts.
|
|
33
1
|
import { readdirSync, readFileSync, statSync } from "node:fs";
|
|
34
2
|
import { join, relative, sep, posix } from "node:path";
|
|
35
3
|
import { writeMarkdownWithStamp } from "@younndai/lyt-runner";
|
|
@@ -78,10 +46,6 @@ export async function runMetadataFillerBody(ctx, args) {
|
|
|
78
46
|
}
|
|
79
47
|
return outcome;
|
|
80
48
|
}
|
|
81
|
-
// ---------------------------------------------------------------------------
|
|
82
|
-
// Frontmatter mutation (line-based; no full YAML parse — same posture as
|
|
83
|
-
// lyt-runner/hooks/frontmatter.ts upsertLastProvenance).
|
|
84
|
-
// ---------------------------------------------------------------------------
|
|
85
49
|
const FRONTMATTER_DELIM = "---";
|
|
86
50
|
export function fillMissingMandatoryFields(raw, defaults) {
|
|
87
51
|
const lines = raw.split(/\r?\n/);
|
|
@@ -92,7 +56,6 @@ export function fillMissingMandatoryFields(raw, defaults) {
|
|
|
92
56
|
break;
|
|
93
57
|
}
|
|
94
58
|
}
|
|
95
|
-
// No frontmatter at all — prepend a fresh block with every mandatory field.
|
|
96
59
|
if (firstNonEmpty === -1 || lines[firstNonEmpty] !== FRONTMATTER_DELIM) {
|
|
97
60
|
const fresh = renderFreshFrontmatter(defaults);
|
|
98
61
|
return {
|
|
@@ -100,7 +63,6 @@ export function fillMissingMandatoryFields(raw, defaults) {
|
|
|
100
63
|
fieldsFilled: [...MANDATORY_FIELDS],
|
|
101
64
|
};
|
|
102
65
|
}
|
|
103
|
-
// Walk the open frontmatter looking for the closing delim.
|
|
104
66
|
let closeIdx = -1;
|
|
105
67
|
for (let i = firstNonEmpty + 1; i < lines.length; i++) {
|
|
106
68
|
if (lines[i] === FRONTMATTER_DELIM) {
|
|
@@ -109,16 +71,12 @@ export function fillMissingMandatoryFields(raw, defaults) {
|
|
|
109
71
|
}
|
|
110
72
|
}
|
|
111
73
|
if (closeIdx === -1) {
|
|
112
|
-
// Malformed (open with no close). Mirror upsertLastProvenance: prepend
|
|
113
|
-
// a fresh block and leave the broken doc untouched below it.
|
|
114
74
|
const fresh = renderFreshFrontmatter(defaults);
|
|
115
75
|
return {
|
|
116
76
|
content: `${fresh}\n${raw}`,
|
|
117
77
|
fieldsFilled: [...MANDATORY_FIELDS],
|
|
118
78
|
};
|
|
119
79
|
}
|
|
120
|
-
// Detect which mandatory fields are already present (key-only check; we
|
|
121
|
-
// never overwrite an existing handler-managed value).
|
|
122
80
|
const present = new Set();
|
|
123
81
|
for (let i = firstNonEmpty + 1; i < closeIdx; i++) {
|
|
124
82
|
const lineNoIndent = lines[i].replace(/^\s+/, "");
|
|
@@ -133,9 +91,6 @@ export function fillMissingMandatoryFields(raw, defaults) {
|
|
|
133
91
|
if (missing.length === 0) {
|
|
134
92
|
return { content: raw, fieldsFilled: [] };
|
|
135
93
|
}
|
|
136
|
-
// Insert the missing fields right before the closing delim. Preserve the
|
|
137
|
-
// input's line ending shape best-effort by re-joining with `\n` — the
|
|
138
|
-
// hook re-serializes the file anyway.
|
|
139
94
|
const insertions = missing.map((f) => `${f}: ${renderDefault(f, defaults)}`);
|
|
140
95
|
lines.splice(closeIdx, 0, ...insertions);
|
|
141
96
|
return {
|
|
@@ -167,9 +122,6 @@ function renderDefault(field, defaults) {
|
|
|
167
122
|
return "3";
|
|
168
123
|
}
|
|
169
124
|
}
|
|
170
|
-
// ---------------------------------------------------------------------------
|
|
171
|
-
// Filesystem helpers
|
|
172
|
-
// ---------------------------------------------------------------------------
|
|
173
125
|
function walkMarkdownFiles(root) {
|
|
174
126
|
const out = [];
|
|
175
127
|
let names;
|
|
@@ -205,7 +157,6 @@ function filenameSlug(absPath) {
|
|
|
205
157
|
function toVaultRel(absPath, vaultRoot) {
|
|
206
158
|
return relative(vaultRoot, absPath).split(sep).join(posix.sep);
|
|
207
159
|
}
|
|
208
|
-
// Re-export for tests + future archetype consumers.
|
|
209
160
|
export { MANDATORY_FIELDS };
|
|
210
161
|
export { walkMarkdownFiles as _walkMarkdownFilesForTests };
|
|
211
162
|
//# sourceMappingURL=metadata-filler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata-filler.js","sourceRoot":"","sources":["../../src/automator-bodies/metadata-filler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"metadata-filler.js","sourceRoot":"","sources":["../../src/automator-bodies/metadata-filler.ts"],"names":[],"mappings":"AAkCA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAGvD,OAAO,EAAE,sBAAsB,EAAsB,MAAM,sBAAsB,CAAC;AAElF,MAAM,gBAAgB,GAAG;IACvB,OAAO;IACP,SAAS;IACT,UAAU;IACV,MAAM;IACN,SAAS;IACT,OAAO;IACP,iBAAiB;IACjB,QAAQ;CACA,CAAC;AA0BX,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,GAAkB,EAClB,IAAwB;IAExB,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,iBAAiB,CAAC,S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;QACD,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACvB,GAAG,CAAC,IAAI,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,CAAC;aAAM,IAAI,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5D,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,YAAY,CAAC,OAAe;IACnC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC;IACtC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,UAAU,CAAC,OAAe,EAAE,SAAiB;IACpD,OAAO,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACjE,CAAC;AAGD,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,OAAO,EAAE,iBAAiB,IAAI,0BAA0B,EAAE,CAAC"}
|
package/dist/automator-run.js
CHANGED
|
@@ -1,41 +1,8 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2026 MARLINK TRADING SRL (YounndAI)
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
// Meta CLI automator-run composition (block-B Commit 7).
|
|
17
|
-
//
|
|
18
|
-
// This is the single function the `lyt automator run` CLI subcommand and
|
|
19
|
-
// the metadata-filler end-to-end integration test both consume. It glues
|
|
20
|
-
// together the lyt-vault `buildAutomatorRunPlan` (plan + opened DB clients),
|
|
21
|
-
// the meta-CLI archetype dispatcher (`resolveAutomatorBody`), and the
|
|
22
|
-
// lyt-runner `runFiveStep` orchestrator into one entry point.
|
|
23
|
-
//
|
|
24
|
-
// Composition pattern mirrors meshCmd at packages/lyt/src/cli.ts:38-47 —
|
|
25
|
-
// lyt-vault registers the `automator` parent (commands/automator.ts ships
|
|
26
|
-
// list/log/status); the meta CLI attaches the `run` subcommand here so the
|
|
27
|
-
// runFiveStep call site lives in a package that depends on both lyt-vault
|
|
28
|
-
// and lyt-runner. lyt-vault must not depend on lyt-runner (the reverse
|
|
29
|
-
// already holds), and this seam preserves that invariant.
|
|
30
1
|
import { hostname } from "node:os";
|
|
31
2
|
import { readFileSync } from "node:fs";
|
|
32
3
|
import { createLytRuntime, runFiveStep } from "@younndai/lyt-runner";
|
|
33
4
|
import { buildAutomatorRunPlan, closeAutomatorRunPlan, newUuidv7Bytes, recordCliInvocation, } from "@younndai/lyt-vault";
|
|
34
5
|
import { resolveAutomatorBody } from "./automator-bodies/index.js";
|
|
35
|
-
// ---------------------------------------------------------------------------
|
|
36
|
-
// Single-entry composition. The CLI invokes this and forwards exit codes;
|
|
37
|
-
// the integration test invokes it and inspects the result + side effects.
|
|
38
|
-
// ---------------------------------------------------------------------------
|
|
39
6
|
export async function runAutomator(args) {
|
|
40
7
|
const plan = await buildAutomatorRunPlan({
|
|
41
8
|
automator: args.automator,
|
|
@@ -73,8 +40,6 @@ export async function runAutomator(args) {
|
|
|
73
40
|
vaultDb: plan.vaultDb,
|
|
74
41
|
automatorName: plan.automatorName,
|
|
75
42
|
automatorVersion,
|
|
76
|
-
// v1.A.5 OPT-1 caller-side: thread pre-opened audit + provenance
|
|
77
|
-
// clients to skip per-write open/close inside the @STAMP hook.
|
|
78
43
|
ledgerClients: {
|
|
79
44
|
auditDb: plan.auditDb,
|
|
80
45
|
provenanceDb: plan.provenanceDb,
|
|
@@ -83,13 +48,6 @@ export async function runAutomator(args) {
|
|
|
83
48
|
...(args.dryRun === true ? { dryRun: true } : {}),
|
|
84
49
|
...(args.noPush === true ? { noPush: true } : {}),
|
|
85
50
|
});
|
|
86
|
-
// cli.invoked event is logged AFTER runFiveStep returns so the
|
|
87
|
-
// automator_runs row (inserted at the start of runFiveStep when
|
|
88
|
-
// persistRunLedger is true) satisfies the automator_run_events.run_id
|
|
89
|
-
// FK constraint. The event's `ts` is the captured startTs so the
|
|
90
|
-
// chronological log still shows cli.invoked BEFORE step.acquire.*
|
|
91
|
-
// (events sort by ts, not by insertion order). Skipped on dryRun
|
|
92
|
-
// because runFiveStep skips the parent INSERT in that mode.
|
|
93
51
|
if (args.dryRun !== true) {
|
|
94
52
|
await recordCliInvocation(plan, {
|
|
95
53
|
runId,
|
|
@@ -114,14 +72,6 @@ export async function runAutomator(args) {
|
|
|
114
72
|
await closeAutomatorRunPlan(plan);
|
|
115
73
|
}
|
|
116
74
|
}
|
|
117
|
-
// ---------------------------------------------------------------------------
|
|
118
|
-
// Helpers
|
|
119
|
-
// ---------------------------------------------------------------------------
|
|
120
|
-
// Minimal hand-rolled version extractor — mirrors the rid-only extractor in
|
|
121
|
-
// flows/automator-run.ts:88-92. Looks for `version=<token>` within the first
|
|
122
|
-
// @AUTOMATOR block and returns the token (no quote stripping needed; YON
|
|
123
|
-
// version fields are bare per arc §6.13 Example 1). Falls back to "0.0.0"
|
|
124
|
-
// if the field is absent so the stamp src still renders deterministically.
|
|
125
75
|
function extractAutomatorVersion(yonPath) {
|
|
126
76
|
let raw;
|
|
127
77
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automator-run.js","sourceRoot":"","sources":["../src/automator-run.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"automator-run.js","sourceRoot":"","sources":["../src/automator-run.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAsB,MAAM,sBAAsB,CAAC;AACzF,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,EACd,mBAAmB,GAEpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,oBAAoB,EAAwB,MAAM,6BAA6B,CAAC;AAuCzF,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAsB;IACvD,MAAM,IAAI,GAAG,MAAM,qBAAqB,CAAC;QACvC,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1D,GAAG,CAAC,IAAI,CAAC,iBAAiB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC/F,CAAC,CAAC;IACH,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,oBAAoB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACtD,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CACb,2DAA2D,IAAI,CAAC,aAAa,KAAK;gBAChF,qFAAqF;gBACrF,uDAAuD,CAC1D,CAAC;QACJ,CAAC;QAED,MAAM,gBAAgB,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C,CAAC,CAAC,CAAC,OAAO,CAAC;AAC3D,CAAC;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -1,23 +1,5 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2026 MARLINK TRADING SRL (YounndAI)
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
1
|
const TS = "created: 2026-02-01T00:00:00.000Z\nmodified: 2026-02-01T00:00:00.000Z";
|
|
17
|
-
// Planted graded docs live in `graded-main`; topic terms are isolated per query
|
|
18
|
-
// so BM25 frequency cleanly tracks the intended grade (except Q-replica).
|
|
19
2
|
const PLANTED = [
|
|
20
|
-
// Q-turso — aced. turso-1 (×5) > turso-2 (×2) > turso-3 (×1) ⇒ grade order 3,2,1.
|
|
21
3
|
{
|
|
22
4
|
vault: "graded-main",
|
|
23
5
|
rel: "notes/turso-1.md",
|
|
@@ -29,22 +11,18 @@ const PLANTED = [
|
|
|
29
11
|
body: "We evaluated turso for production. turso handles writes.",
|
|
30
12
|
},
|
|
31
13
|
{ vault: "graded-main", rel: "notes/turso-3.md", body: "A passing mention of turso here." },
|
|
32
|
-
// Q-libsql — aced.
|
|
33
14
|
{
|
|
34
15
|
vault: "graded-main",
|
|
35
16
|
rel: "notes/libsql-1.md",
|
|
36
17
|
body: "libsql is a sqlite fork. libsql client and libsql server libsql.",
|
|
37
18
|
},
|
|
38
19
|
{ vault: "graded-main", rel: "notes/libsql-2.md", body: "built on libsql internally." },
|
|
39
|
-
// Q-federation — aced.
|
|
40
20
|
{
|
|
41
21
|
vault: "graded-main",
|
|
42
22
|
rel: "notes/fed-1.md",
|
|
43
23
|
body: "federation connects vaults. federation edges and federation subscriptions federation.",
|
|
44
24
|
},
|
|
45
25
|
{ vault: "graded-main", rel: "notes/fed-2.md", body: "the federation layer spans vaults." },
|
|
46
|
-
// Q-replica — NON-ACED. replica-rep (×6, grade 1) outranks replica-design
|
|
47
|
-
// (×3, grade 3) by raw BM25 ⇒ nDCG ≈ 0.71 for this query. Intentional.
|
|
48
26
|
{
|
|
49
27
|
vault: "graded-main",
|
|
50
28
|
rel: "notes/replica-design.md",
|
|
@@ -55,15 +33,12 @@ const PLANTED = [
|
|
|
55
33
|
rel: "notes/replica-rep.md",
|
|
56
34
|
body: "replica replica replica replica replica replica shards.",
|
|
57
35
|
},
|
|
58
|
-
// Cleanliness trap — "turso" appears ONLY inside a code fence (stripped by FTS
|
|
59
|
-
// hygiene). If it surfaces for Q-turso, cleanliness > 0 and the bench fails.
|
|
60
36
|
{
|
|
61
37
|
vault: "graded-main",
|
|
62
38
|
rel: "notes/fence-trap.md",
|
|
63
39
|
body: "Tea notes and beverages.\n\n```\nturso()\n```\n",
|
|
64
40
|
},
|
|
65
41
|
];
|
|
66
|
-
// Off-topic filler (a second vault) — realistic noise; shares no query term.
|
|
67
42
|
const FILLER_TOPICS = [
|
|
68
43
|
"recipe brunch",
|
|
69
44
|
"travel itinerary",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graded-corpus.js","sourceRoot":"","sources":["../../src/bench/graded-corpus.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"graded-corpus.js","sourceRoot":"","sources":["../../src/bench/graded-corpus.ts"],"names":[],"mappings":"AA6BA,MAAM,EAAE,GAAG,uEAAuE,CAAC;AAUnF,MAAM,OAAO,GAAU;IAErB;QACE,KAAK,EAAE,aAAa;QAC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AAY;QACnB,KAAK,EAAE,YAAY;QACnB,MAAM,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE;KACzC;IACD;QACE,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,YAAY;QACnB,MAAM,EAAE,EAAE,mBAAmB,EAAE,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAAE;KACxD;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invariant-corpus.d.ts","sourceRoot":"","sources":["../../src/bench/invariant-corpus.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjD,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAEhB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC7D;AAKD,eAAO,MAAM,gBAAgB,EAAE,SAAS,SAAS,EA2EhD,CAAC;AAEF,wBAAsB,aAAa,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"invariant-corpus.d.ts","sourceRoot":"","sources":["../../src/bench/invariant-corpus.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjD,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAEhB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC7D;AAKD,eAAO,MAAM,gBAAgB,EAAE,SAAS,SAAS,EA2EhD,CAAC;AAEF,wBAAsB,aAAa,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAgH7E"}
|
|
@@ -1,27 +1,8 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2026 MARLINK TRADING SRL (YounndAI)
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
// Every figment shares a fixed authored-time so indexing is reproducible.
|
|
17
1
|
const TS = "created: 2026-01-01T00:00:00.000Z\nmodified: 2026-01-01T00:00:00.000Z";
|
|
18
2
|
export const INVARIANT_CORPUS = [
|
|
19
3
|
{
|
|
20
4
|
vault: "core",
|
|
21
5
|
notes: [
|
|
22
|
-
// INV-1 (V-F5): two off-topic notes tagged `turso` form a lane (tier-1);
|
|
23
|
-
// a third has `turso` heavily in the BODY but is NOT tagged turso (tier-2).
|
|
24
|
-
// The strong body hit must outrank the tag-only lane hits.
|
|
25
6
|
{
|
|
26
7
|
rel: "notes/turso-tag-a.md",
|
|
27
8
|
frontmatter: `${TS}\ntags: [turso]`,
|
|
@@ -37,22 +18,16 @@ export const INVARIANT_CORPUS = [
|
|
|
37
18
|
frontmatter: `${TS}\ntags: [database]`,
|
|
38
19
|
body: "turso turso turso turso turso embedded replica libsql on turso.",
|
|
39
20
|
},
|
|
40
|
-
// INV-2 (V-F11): a UNIQUE tag (one note → no lane). The token "singleton"
|
|
41
|
-
// appears ONLY as a tag, never in the body, so tags→FTS is the only path.
|
|
42
21
|
{
|
|
43
22
|
rel: "notes/unique.md",
|
|
44
23
|
frontmatter: `${TS}\ntags: [singleton]`,
|
|
45
24
|
body: "A standalone one-off note about miscellaneous topics.",
|
|
46
25
|
},
|
|
47
|
-
// INV-3 (hygiene): "espresso" lives ONLY inside a fenced code block, which
|
|
48
|
-
// FTS hygiene strips. A query for it must return zero hits.
|
|
49
26
|
{
|
|
50
27
|
rel: "notes/coffee-fence.md",
|
|
51
28
|
frontmatter: `${TS}\ntags: [coffee]`,
|
|
52
29
|
body: "Notes on tea and other beverages.\n\n```js\nfunction espresso() { return true; }\n```\n",
|
|
53
30
|
},
|
|
54
|
-
// INV-6 (arc primacy): an arc "Build Pipeline" with two members (tier-0).
|
|
55
|
-
// A separate body-only note must NOT displace the arc members from the top.
|
|
56
31
|
{
|
|
57
32
|
rel: "notes/arc-decl.md",
|
|
58
33
|
frontmatter: "t: arc-decl",
|
|
@@ -76,8 +51,6 @@ export const INVARIANT_CORPUS = [
|
|
|
76
51
|
],
|
|
77
52
|
},
|
|
78
53
|
{
|
|
79
|
-
// INV-5 (vault-scope isolation): a second vault that ALSO matches "turso".
|
|
80
|
-
// A scope:vault search of `core` must never surface this note.
|
|
81
54
|
vault: "side",
|
|
82
55
|
notes: [
|
|
83
56
|
{
|
|
@@ -90,7 +63,6 @@ export const INVARIANT_CORPUS = [
|
|
|
90
63
|
];
|
|
91
64
|
export async function runInvariants(pod) {
|
|
92
65
|
const results = [];
|
|
93
|
-
// INV-1 — V-F5: strong body hit outranks tag-only lane hits.
|
|
94
66
|
{
|
|
95
67
|
const res = await pod.search({ query: "turso", scope: "federation", limit: 20 });
|
|
96
68
|
const rankOf = (suffix) => res.results.findIndex((r) => r.figment_path.endsWith(suffix));
|
|
@@ -105,7 +77,6 @@ export async function runInvariants(pod) {
|
|
|
105
77
|
detail: `query "turso": body#${body} vs tag-a#${tagA}, tag-b#${tagB} (body must rank first)`,
|
|
106
78
|
});
|
|
107
79
|
}
|
|
108
|
-
// INV-2 — V-F11: a unique tag (no lane) is still findable via tags→FTS.
|
|
109
80
|
{
|
|
110
81
|
const res = await pod.search({ query: "singleton", scope: "federation", limit: 20 });
|
|
111
82
|
const found = res.results.some((r) => r.figment_path.endsWith("unique.md"));
|
|
@@ -116,7 +87,6 @@ export async function runInvariants(pod) {
|
|
|
116
87
|
detail: `query "singleton": ${res.results.length} hit(s); unique.md ${found ? "found" : "MISSING"}`,
|
|
117
88
|
});
|
|
118
89
|
}
|
|
119
|
-
// INV-3 — hygiene: a term that lives only in a code fence is not indexed.
|
|
120
90
|
{
|
|
121
91
|
const res = await pod.search({ query: "espresso", scope: "federation", limit: 20 });
|
|
122
92
|
const passed = res.results.length === 0;
|
|
@@ -127,7 +97,6 @@ export async function runInvariants(pod) {
|
|
|
127
97
|
detail: `query "espresso": expected 0 hits, got ${res.results.length}`,
|
|
128
98
|
});
|
|
129
99
|
}
|
|
130
|
-
// INV-5 — vault-scope isolation: scope:vault must not leak other vaults.
|
|
131
100
|
{
|
|
132
101
|
const res = await pod.search({
|
|
133
102
|
query: "turso",
|
|
@@ -144,7 +113,6 @@ export async function runInvariants(pod) {
|
|
|
144
113
|
detail: `scope=vault core "turso": ${res.results.length} hit(s), ${leaked.length} from other vaults`,
|
|
145
114
|
});
|
|
146
115
|
}
|
|
147
|
-
// INV-6 — arc primacy: tier-0 arc members keep the top under the blend.
|
|
148
116
|
{
|
|
149
117
|
const res = await pod.search({
|
|
150
118
|
query: "pipeline",
|
|
@@ -152,18 +120,21 @@ export async function runInvariants(pod) {
|
|
|
152
120
|
scopeTarget: "core",
|
|
153
121
|
limit: 20,
|
|
154
122
|
});
|
|
155
|
-
const
|
|
156
|
-
const
|
|
123
|
+
const idxOf = (suffix) => res.results.findIndex((r) => r.figment_path.endsWith(suffix));
|
|
124
|
+
const m1 = idxOf("pipeline-m1.md");
|
|
125
|
+
const m2 = idxOf("pipeline-m2.md");
|
|
126
|
+
const arcDecl = idxOf("arc-decl.md");
|
|
127
|
+
const found = m1 >= 0 && m2 >= 0;
|
|
128
|
+
const inTopThree = found && m1 < 3 && m2 < 3;
|
|
129
|
+
const liftsAboveNonArc = found && arcDecl >= 0 && m1 < arcDecl && m2 < arcDecl;
|
|
130
|
+
const passed = found && inTopThree && liftsAboveNonArc;
|
|
157
131
|
results.push({
|
|
158
132
|
id: "INV-6",
|
|
159
|
-
name: "Arc primacy — tier-0 arc members
|
|
133
|
+
name: "Arc primacy — tier-0 prior lifts arc members above equal-relevance non-arc (boost-not-gate)",
|
|
160
134
|
passed,
|
|
161
|
-
detail: top
|
|
162
|
-
? `query "pipeline": no results`
|
|
163
|
-
: `query "pipeline": top result tier=${top.tier} (expected 0)`,
|
|
135
|
+
detail: `query "pipeline": m1#${m1}, m2#${m2}, non-arc arc-decl#${arcDecl} (members must be top-3 AND above arc-decl)`,
|
|
164
136
|
});
|
|
165
137
|
}
|
|
166
|
-
// INV-4 — determinism: identical query → identical ranked results.
|
|
167
138
|
{
|
|
168
139
|
const a = await pod.search({ query: "turso", scope: "federation", limit: 20 });
|
|
169
140
|
const b = await pod.search({ query: "turso", scope: "federation", limit: 20 });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invariant-corpus.js","sourceRoot":"","sources":["../../src/bench/invariant-corpus.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"invariant-corpus.js","sourceRoot":"","sources":["../../src/bench/invariant-corpus.ts"],"names":[],"mappings":"AAgDA,MAAM,EAAE,GAAG,uEAAuE,CAAC;AAEnF,MAAM,CAAC,MAAM,g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MAAM,GAAG,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;QAC/E,MAAM,GAAG,GAAG,CAAC,CAAsB,EAAU,EAAE,CAC7C,IAAI,CAAC,SAAS,CACZ,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,YAAY,IAAI,IAAI,CAAC,CAAC,CACrF,CAAC;QACJ,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;QACjC,OAAO,CAAC,IAAI,CAAC;YACX,EAAE,EAAE,OAAO;YACX,IAAI,EAAE,+DAA+D;YACrE,MAAM;YACN,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,qCAAqC,CAAC,CAAC,CAAC,mBAAmB;SAC7E,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/bench/ir-metrics.js
CHANGED
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2026 MARLINK TRADING SRL (YounndAI)
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
1
|
export const NDCG_K = 10;
|
|
17
|
-
// dcg = Σ (2^grade − 1) / log2(rank + 1) — matches ir-scorer.mjs:54.
|
|
18
2
|
export function dcg(grades) {
|
|
19
3
|
return grades.reduce((acc, g, i) => acc + (Math.pow(2, g) - 1) / Math.log2(i + 2), 0);
|
|
20
4
|
}
|
|
@@ -30,7 +14,6 @@ export function scoreGradedQuery(q, results) {
|
|
|
30
14
|
}
|
|
31
15
|
return 0;
|
|
32
16
|
};
|
|
33
|
-
// Dedup by figment path (keep first occurrence), preserving rank order.
|
|
34
17
|
const seen = new Set();
|
|
35
18
|
const ranked = [];
|
|
36
19
|
for (const r of results) {
|