@younndai/lyt-runner 0.9.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/LICENSE +200 -0
- package/NOTICE +23 -0
- package/README.md +110 -0
- package/dist/expander/automator-to-agent.d.ts +4 -0
- package/dist/expander/automator-to-agent.d.ts.map +1 -0
- package/dist/expander/automator-to-agent.js +129 -0
- package/dist/expander/automator-to-agent.js.map +1 -0
- package/dist/expander/index.d.ts +17 -0
- package/dist/expander/index.d.ts.map +1 -0
- package/dist/expander/index.js +62 -0
- package/dist/expander/index.js.map +1 -0
- package/dist/expander/parse-record.d.ts +10 -0
- package/dist/expander/parse-record.d.ts.map +1 -0
- package/dist/expander/parse-record.js +162 -0
- package/dist/expander/parse-record.js.map +1 -0
- package/dist/expander/types.d.ts +39 -0
- package/dist/expander/types.d.ts.map +1 -0
- package/dist/expander/types.js +17 -0
- package/dist/expander/types.js.map +1 -0
- package/dist/hooks/frontmatter.d.ts +10 -0
- package/dist/hooks/frontmatter.d.ts.map +1 -0
- package/dist/hooks/frontmatter.js +90 -0
- package/dist/hooks/frontmatter.js.map +1 -0
- package/dist/hooks/stamp-on-write.d.ts +43 -0
- package/dist/hooks/stamp-on-write.d.ts.map +1 -0
- package/dist/hooks/stamp-on-write.js +289 -0
- package/dist/hooks/stamp-on-write.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +96 -0
- package/dist/index.js.map +1 -0
- package/dist/ops/index.d.ts +24 -0
- package/dist/ops/index.d.ts.map +1 -0
- package/dist/ops/index.js +56 -0
- package/dist/ops/index.js.map +1 -0
- package/dist/ops/leases.d.ts +28 -0
- package/dist/ops/leases.d.ts.map +1 -0
- package/dist/ops/leases.js +93 -0
- package/dist/ops/leases.js.map +1 -0
- package/dist/ops/llm.d.ts +28 -0
- package/dist/ops/llm.d.ts.map +1 -0
- package/dist/ops/llm.js +132 -0
- package/dist/ops/llm.js.map +1 -0
- package/dist/ops/mesh.d.ts +11 -0
- package/dist/ops/mesh.d.ts.map +1 -0
- package/dist/ops/mesh.js +35 -0
- package/dist/ops/mesh.js.map +1 -0
- package/dist/ops/vault.d.ts +26 -0
- package/dist/ops/vault.d.ts.map +1 -0
- package/dist/ops/vault.js +153 -0
- package/dist/ops/vault.js.map +1 -0
- package/dist/protocol/five-step.d.ts +22 -0
- package/dist/protocol/five-step.d.ts.map +1 -0
- package/dist/protocol/five-step.js +312 -0
- package/dist/protocol/five-step.js.map +1 -0
- package/dist/protocol/run-context.d.ts +35 -0
- package/dist/protocol/run-context.d.ts.map +1 -0
- package/dist/protocol/run-context.js +56 -0
- package/dist/protocol/run-context.js.map +1 -0
- package/dist/runtime.d.ts +18 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +28 -0
- package/dist/runtime.js.map +1 -0
- package/package.json +74 -0
|
@@ -0,0 +1,162 @@
|
|
|
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
|
+
export class ExpanderError extends Error {
|
|
17
|
+
tag;
|
|
18
|
+
line;
|
|
19
|
+
constructor(message, tag, line) {
|
|
20
|
+
super(`expander: ${message} (tag=@${tag}, line=${line})`);
|
|
21
|
+
this.tag = tag;
|
|
22
|
+
this.line = line;
|
|
23
|
+
this.name = "ExpanderError";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function asString(v) {
|
|
27
|
+
if (v === undefined)
|
|
28
|
+
return undefined;
|
|
29
|
+
if (typeof v === "string")
|
|
30
|
+
return v;
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
function asList(v) {
|
|
34
|
+
if (v === undefined)
|
|
35
|
+
return undefined;
|
|
36
|
+
if (typeof v === "string")
|
|
37
|
+
return undefined;
|
|
38
|
+
if (Array.isArray(v))
|
|
39
|
+
return undefined; // YonMapPair[] — not a flat list
|
|
40
|
+
// Per yon-parser/src/types.ts L91-96, YonList = { kind, items[] }
|
|
41
|
+
if (v.kind === "reference-tokens") {
|
|
42
|
+
return v.items.filter((it) => typeof it === "string");
|
|
43
|
+
}
|
|
44
|
+
if (v.kind === "field-items") {
|
|
45
|
+
return v.items
|
|
46
|
+
.map((it) => typeof it === "string" ? it : "key" in it && "value" in it ? `${it.key}` : undefined)
|
|
47
|
+
.filter((s) => typeof s === "string");
|
|
48
|
+
}
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
function asBool(v) {
|
|
52
|
+
const s = asString(v);
|
|
53
|
+
if (s === undefined)
|
|
54
|
+
return undefined;
|
|
55
|
+
if (s === "true")
|
|
56
|
+
return true;
|
|
57
|
+
if (s === "false")
|
|
58
|
+
return false;
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
function require(field, value, tag, line) {
|
|
62
|
+
if (value === undefined || value === "") {
|
|
63
|
+
throw new ExpanderError(`missing required field "${field}"`, tag, line);
|
|
64
|
+
}
|
|
65
|
+
return value;
|
|
66
|
+
}
|
|
67
|
+
const VALID_ARCHETYPES = new Set([
|
|
68
|
+
"filler",
|
|
69
|
+
"propagator",
|
|
70
|
+
"generator",
|
|
71
|
+
"aggregator",
|
|
72
|
+
"observer",
|
|
73
|
+
"validator",
|
|
74
|
+
"pruner",
|
|
75
|
+
"integrator",
|
|
76
|
+
"router",
|
|
77
|
+
"enricher",
|
|
78
|
+
"transformer",
|
|
79
|
+
"scheduler",
|
|
80
|
+
"notifier",
|
|
81
|
+
"archiver",
|
|
82
|
+
"custom",
|
|
83
|
+
]);
|
|
84
|
+
const VALID_RUNTIMES = new Set(["deterministic", "llm", "hybrid"]);
|
|
85
|
+
const VALID_TXN_MODES = new Set(["none", "checkpoint", "atomic"]);
|
|
86
|
+
const VALID_SCOPES = new Set(["vault", "mesh"]);
|
|
87
|
+
const VALID_SOURCES = new Set(["system", "user", "mesh", "marketplace"]);
|
|
88
|
+
export function parseAutomator(record) {
|
|
89
|
+
if (record.tag !== "AUTOMATOR") {
|
|
90
|
+
throw new ExpanderError(`expected @AUTOMATOR, got @${record.tag}`, record.tag, record.line);
|
|
91
|
+
}
|
|
92
|
+
const f = record.fields;
|
|
93
|
+
const rid = require("rid", asString(f.get("rid")), "AUTOMATOR", record.line);
|
|
94
|
+
const name = require("name", asString(f.get("name")), "AUTOMATOR", record.line);
|
|
95
|
+
const version = require("version", asString(f.get("version")), "AUTOMATOR", record.line);
|
|
96
|
+
const archetype = require("archetype", asString(f.get("archetype")), "AUTOMATOR", record.line);
|
|
97
|
+
if (!VALID_ARCHETYPES.has(archetype)) {
|
|
98
|
+
throw new ExpanderError(`archetype "${archetype}" is not one of the 15 valid archetypes`, "AUTOMATOR", record.line);
|
|
99
|
+
}
|
|
100
|
+
const description = require("description", asString(f.get("description")), "AUTOMATOR", record.line);
|
|
101
|
+
const source = require("source", asString(f.get("source")), "AUTOMATOR", record.line);
|
|
102
|
+
if (!VALID_SOURCES.has(source)) {
|
|
103
|
+
throw new ExpanderError(`source "${source}" is not one of system|user|mesh|marketplace`, "AUTOMATOR", record.line);
|
|
104
|
+
}
|
|
105
|
+
const runtime = require("runtime", asString(f.get("runtime")), "AUTOMATOR", record.line);
|
|
106
|
+
if (!VALID_RUNTIMES.has(runtime)) {
|
|
107
|
+
throw new ExpanderError(`runtime "${runtime}" is not one of deterministic|llm|hybrid`, "AUTOMATOR", record.line);
|
|
108
|
+
}
|
|
109
|
+
const transaction_mode = require("transaction_mode", asString(f.get("transaction_mode")), "AUTOMATOR", record.line);
|
|
110
|
+
if (!VALID_TXN_MODES.has(transaction_mode)) {
|
|
111
|
+
throw new ExpanderError(`transaction_mode "${transaction_mode}" is not one of none|checkpoint|atomic`, "AUTOMATOR", record.line);
|
|
112
|
+
}
|
|
113
|
+
const scope = require("scope", asString(f.get("scope")), "AUTOMATOR", record.line);
|
|
114
|
+
if (!VALID_SCOPES.has(scope)) {
|
|
115
|
+
throw new ExpanderError(`scope "${scope}" is not one of vault|mesh`, "AUTOMATOR", record.line);
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
rid,
|
|
119
|
+
name,
|
|
120
|
+
version,
|
|
121
|
+
archetype: archetype,
|
|
122
|
+
description,
|
|
123
|
+
source: source,
|
|
124
|
+
runtime: runtime,
|
|
125
|
+
transaction_mode: transaction_mode,
|
|
126
|
+
scope: scope,
|
|
127
|
+
signed_by: asString(f.get("signed_by")),
|
|
128
|
+
reads_scope: asList(f.get("reads_scope")),
|
|
129
|
+
writes_scope: asList(f.get("writes_scope")),
|
|
130
|
+
external_calls: asList(f.get("external_calls")),
|
|
131
|
+
field_ownership: asList(f.get("field_ownership")),
|
|
132
|
+
rules: asList(f.get("rules")),
|
|
133
|
+
handler_gates: asList(f.get("handler_gates")),
|
|
134
|
+
llm_capability: asString(f.get("llm_capability")),
|
|
135
|
+
llm_source_preference: asList(f.get("llm_source_preference")),
|
|
136
|
+
llm_hard_constraints: asList(f.get("llm_hard_constraints")),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
export function parseDirective(record) {
|
|
140
|
+
if (record.tag !== "DIRECTIVE") {
|
|
141
|
+
throw new ExpanderError(`expected @DIRECTIVE, got @${record.tag}`, record.tag, record.line);
|
|
142
|
+
}
|
|
143
|
+
const f = record.fields;
|
|
144
|
+
const inviolable = asBool(f.get("inviolable"));
|
|
145
|
+
if (inviolable === undefined) {
|
|
146
|
+
throw new ExpanderError(`missing required field "inviolable" (bool)`, "DIRECTIVE", record.line);
|
|
147
|
+
}
|
|
148
|
+
const precedence = asString(f.get("precedence"));
|
|
149
|
+
return {
|
|
150
|
+
rid: require("rid", asString(f.get("rid")), "DIRECTIVE", record.line),
|
|
151
|
+
scope: require("scope", asString(f.get("scope")), "DIRECTIVE", record.line),
|
|
152
|
+
subject: require("subject", asString(f.get("subject")), "DIRECTIVE", record.line),
|
|
153
|
+
rule: require("rule", asString(f.get("rule")), "DIRECTIVE", record.line),
|
|
154
|
+
inviolable,
|
|
155
|
+
owner: require("owner", asString(f.get("owner")), "DIRECTIVE", record.line),
|
|
156
|
+
created: require("created", asString(f.get("created")), "DIRECTIVE", record.line),
|
|
157
|
+
precedence: precedence !== undefined ? Number.parseInt(precedence, 10) : undefined,
|
|
158
|
+
applies_to: asList(f.get("applies_to")),
|
|
159
|
+
enforced_by: asList(f.get("enforced_by")),
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=parse-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-record.js","sourceRoot":"","sources":["../../src/expander/parse-record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAwBH,MAAM,OAAO,aAAc,SAAQ,KAAK;IAGpB;IACA;IAHlB,YACE,OAAe,EACC,GAAW,EACX,IAAY;QAE5B,KAAK,CAAC,aAAa,OAAO,UAAU,GAAG,UAAU,IAAI,GAAG,CAAC,CAAC;QAH1C,QAAG,GAAH,GAAG,CAAQ;QACX,SAAI,GAAJ,IAAI,CAAQ;QAG5B,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAED,SAAS,QAAQ,CAAC,CAAuB;IACvC,IAAI,CAAC,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACtC,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,CAAC,CAAC;IACpC,OAAO,SA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terministic" | "llm" | "hybrid";
|
|
2
|
+
export type AutomatorTransactionMode = "none" | "checkpoint" | "atomic";
|
|
3
|
+
export type AutomatorScope = "vault" | "mesh";
|
|
4
|
+
export type AutomatorSource = "system" | "user" | "mesh" | "marketplace";
|
|
5
|
+
export type AutomatorArchetype = "filler" | "propagator" | "generator" | "aggregator" | "observer" | "validator" | "pruner" | "integrator" | "router" | "enricher" | "transformer" | "scheduler" | "notifier" | "archiver" | "custom";
|
|
6
|
+
export interface AutomatorRecord {
|
|
7
|
+
rid: string;
|
|
8
|
+
name: string;
|
|
9
|
+
version: string;
|
|
10
|
+
archetype: AutomatorArchetype;
|
|
11
|
+
description: string;
|
|
12
|
+
source: AutomatorSource;
|
|
13
|
+
runtime: AutomatorRuntime;
|
|
14
|
+
transaction_mode: AutomatorTransactionMode;
|
|
15
|
+
scope: AutomatorScope;
|
|
16
|
+
signed_by?: string;
|
|
17
|
+
reads_scope?: string[];
|
|
18
|
+
writes_scope?: string[];
|
|
19
|
+
external_calls?: string[];
|
|
20
|
+
field_ownership?: string[];
|
|
21
|
+
rules?: string[];
|
|
22
|
+
handler_gates?: string[];
|
|
23
|
+
llm_capability?: string;
|
|
24
|
+
llm_source_preference?: string[];
|
|
25
|
+
llm_hard_constraints?: string[];
|
|
26
|
+
}
|
|
27
|
+
export interface DirectiveRecord {
|
|
28
|
+
rid: string;
|
|
29
|
+
scope: string;
|
|
30
|
+
subject: string;
|
|
31
|
+
rule: string;
|
|
32
|
+
inviolable: boolean;
|
|
33
|
+
owner: string;
|
|
34
|
+
created: string;
|
|
35
|
+
precedence?: number;
|
|
36
|
+
applies_to?: string[];
|
|
37
|
+
enforced_by?: string[];
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/expander/types.ts"],"names":[],"mappings":"AAoBA,MAAM,MAAM,gBAAgB,GAAG,eAAe,GA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,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAEhB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/expander/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface FrontmatterStampLine {
|
|
2
|
+
src: string;
|
|
3
|
+
ts: string;
|
|
4
|
+
method?: string;
|
|
5
|
+
confidence?: number;
|
|
6
|
+
hash?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function formatLastProvenanceValue(stamp: FrontmatterStampLine): string;
|
|
9
|
+
export declare function upsertLastProvenance(content: string, stamp: FrontmatterStampLine): string;
|
|
10
|
+
//# sourceMappingURL=frontmatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../src/hooks/frontmatter.ts"],"names":[],"mappings":"AAqCA,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,CAU7E;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB,GAAG,MAAM,CA8CzF"}
|
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
// Minimal frontmatter mutator — upserts `last_provenance:` into a markdown
|
|
17
|
+
// document's YAML frontmatter block.
|
|
18
|
+
//
|
|
19
|
+
// Scope: line-based, no full YAML parse. The hook never mutates user-managed
|
|
20
|
+
// frontmatter fields — it only inserts/replaces the single `last_provenance:`
|
|
21
|
+
// scalar at the top of the block, per arc-thoughts §11.4 step 3 + §11.6
|
|
22
|
+
// ("Don't materialize full chain in every markdown frontmatter — only the
|
|
23
|
+
// most-recent stamp via `last_provenance:` per arc §11.1"). Full chain stays
|
|
24
|
+
// in the libSQL `provenance` table per arc §11.2.
|
|
25
|
+
//
|
|
26
|
+
// Three cases:
|
|
27
|
+
// 1. No frontmatter block → prepend a fresh `---\nlast_provenance: …\n---\n`
|
|
28
|
+
// 2. Frontmatter contains an existing `last_provenance:` line → replace it
|
|
29
|
+
// 3. Frontmatter without `last_provenance:` → insert before the closing `---`
|
|
30
|
+
//
|
|
31
|
+
// `last_provenance:` value shape:
|
|
32
|
+
// "automator:metadata-filler/v0.1.0 ts=2026-05-29T...Z method=filler conf=1.0 hash=sha256:..."
|
|
33
|
+
// — a single-line scalar (no YAML maps) per arc §11.6 frontmatter ergonomics.
|
|
34
|
+
const FRONTMATTER_DELIM = "---";
|
|
35
|
+
export function formatLastProvenanceValue(stamp) {
|
|
36
|
+
// Single-line scalar; YAML-safe per ergonomics target. Quote the whole
|
|
37
|
+
// value to keep colons in src/hash from confusing line-based downstream
|
|
38
|
+
// tooling (e.g. grep / sed scripts).
|
|
39
|
+
const parts = [`${stamp.src} ts=${stamp.ts}`];
|
|
40
|
+
if (stamp.method !== undefined)
|
|
41
|
+
parts.push(`method=${stamp.method}`);
|
|
42
|
+
if (stamp.confidence !== undefined)
|
|
43
|
+
parts.push(`conf=${stamp.confidence}`);
|
|
44
|
+
if (stamp.hash !== undefined)
|
|
45
|
+
parts.push(`hash=${stamp.hash}`);
|
|
46
|
+
const joined = parts.join(" ");
|
|
47
|
+
return `"${joined.replace(/"/g, '\\"')}"`;
|
|
48
|
+
}
|
|
49
|
+
export function upsertLastProvenance(content, stamp) {
|
|
50
|
+
const value = formatLastProvenanceValue(stamp);
|
|
51
|
+
const lineToInsert = `last_provenance: ${value}`;
|
|
52
|
+
const lines = content.split(/\r?\n/);
|
|
53
|
+
// Detect frontmatter: first non-empty line must be `---`.
|
|
54
|
+
let firstNonEmptyIdx = -1;
|
|
55
|
+
for (let i = 0; i < lines.length; i++) {
|
|
56
|
+
if (lines[i].length > 0) {
|
|
57
|
+
firstNonEmptyIdx = i;
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (firstNonEmptyIdx === -1 || lines[firstNonEmptyIdx] !== FRONTMATTER_DELIM) {
|
|
62
|
+
// Case 1: no frontmatter — prepend a fresh block.
|
|
63
|
+
const trailing = content.length > 0 && !content.startsWith("\n") ? content : content;
|
|
64
|
+
return `---\n${lineToInsert}\n---\n${trailing}`;
|
|
65
|
+
}
|
|
66
|
+
// Find the closing delimiter.
|
|
67
|
+
let closeIdx = -1;
|
|
68
|
+
for (let i = firstNonEmptyIdx + 1; i < lines.length; i++) {
|
|
69
|
+
if (lines[i] === FRONTMATTER_DELIM) {
|
|
70
|
+
closeIdx = i;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (closeIdx === -1) {
|
|
75
|
+
// Malformed frontmatter (open but no close) — treat as "no frontmatter"
|
|
76
|
+
// and prepend a fresh block. The handler's broken doc isn't our fix.
|
|
77
|
+
return `---\n${lineToInsert}\n---\n${content}`;
|
|
78
|
+
}
|
|
79
|
+
// Case 2: replace existing last_provenance: line, if present.
|
|
80
|
+
for (let i = firstNonEmptyIdx + 1; i < closeIdx; i++) {
|
|
81
|
+
if (lines[i].startsWith("last_provenance:") || lines[i].startsWith("last_provenance :")) {
|
|
82
|
+
lines[i] = lineToInsert;
|
|
83
|
+
return lines.join("\n");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// Case 3: insert before the closing `---`.
|
|
87
|
+
lines.splice(closeIdx, 0, lineToInsert);
|
|
88
|
+
return lines.join("\n");
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=frontmatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../../src/hooks/frontmatter.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AK,CAAC,CAAC,CAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC,IAAI,KAAK,CAAC,CAAC,CAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,EAAE,CAAC;YAC1F,KAAK,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC;YACxB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,2CAA2C;IAC3C,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,EAAE,YAAY,CAAC,CAAC;IACxC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Client } from "@libsql/client";
|
|
2
|
+
import { type ProvenanceWriteTargetType } from "@younndai/lyt-vault";
|
|
3
|
+
import type { LytRunContext } from "../protocol/run-context.js";
|
|
4
|
+
export interface StampMeta {
|
|
5
|
+
src: string;
|
|
6
|
+
method?: string;
|
|
7
|
+
confidence?: number;
|
|
8
|
+
tokens?: number;
|
|
9
|
+
costUsd?: number;
|
|
10
|
+
model?: string;
|
|
11
|
+
details?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
export interface WriteWithStampArgs {
|
|
14
|
+
path: string;
|
|
15
|
+
content: string;
|
|
16
|
+
stamp: StampMeta;
|
|
17
|
+
vaultRoot?: string;
|
|
18
|
+
ledgerClients?: {
|
|
19
|
+
auditDb: Client;
|
|
20
|
+
provenanceDb: Client;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface WriteWithStampResult {
|
|
24
|
+
provenanceId: Uint8Array | null;
|
|
25
|
+
hash: string;
|
|
26
|
+
ts: string;
|
|
27
|
+
fired: boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare function writeMarkdownWithStamp(runContext: LytRunContext | null, vaultDb: Client | null, args: WriteWithStampArgs): Promise<WriteWithStampResult>;
|
|
30
|
+
export declare function writeYonWithStamp(runContext: LytRunContext | null, vaultDb: Client | null, args: WriteWithStampArgs): Promise<WriteWithStampResult>;
|
|
31
|
+
export interface YonStampRecordArgs {
|
|
32
|
+
ts: string;
|
|
33
|
+
src: string;
|
|
34
|
+
method?: string;
|
|
35
|
+
confidence?: number;
|
|
36
|
+
hash?: string;
|
|
37
|
+
tokens?: number;
|
|
38
|
+
costUsd?: number;
|
|
39
|
+
model?: string;
|
|
40
|
+
}
|
|
41
|
+
export declare function formatYonStampRecord(args: YonStampRecordArgs): string;
|
|
42
|
+
export type { ProvenanceWriteTargetType };
|
|
43
|
+
//# sourceMappingURL=stamp-on-write.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stamp-on-write.d.ts","sourceRoot":"","sources":["../../src/hooks/stamp-on-write.ts"],"names":[],"mappings":"AA8CA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAQL,KAAK,yBAAyB,EAC/B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAmBhE,MAAM,WAAW,SAAS;IAIxB,GAAG,EAAE,MAAM,CAAC;IAIZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IAIf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,kBAAkB;IAGjC,IAAI,EAAE,MAAM,CAAC;IAEb,OAAO,EAAE,MAAM,CAAC;IAEhB,KAAK,EAAE,SAAS,CAAC;IAIjB,SAAS,CAAC,EAAE,MAAM,CAAC;IASnB,aAAa,CAAC,EAAE;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,YAAY,EAAE,MAAM,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