@theokit/sdk 4.55.0 → 4.56.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 +63 -0
- package/dist/a2a/index.cjs +13 -4
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.d.cts +1 -1
- package/dist/a2a/index.d.ts +1 -1
- package/dist/a2a/index.js +13 -5
- package/dist/a2a/index.js.map +1 -1
- package/dist/a2a/message-bus.d.cts +33 -4
- package/dist/a2a/message-bus.d.ts +33 -4
- package/dist/{agent-HDEVVUBS.js → agent-K3PQBS7D.js} +6 -5
- package/dist/{agent-HDEVVUBS.js.map → agent-K3PQBS7D.js.map} +1 -1
- package/dist/{agent-R2HOJFZJ.cjs → agent-PJMBK7HQ.cjs} +7 -6
- package/dist/{agent-R2HOJFZJ.cjs.map → agent-PJMBK7HQ.cjs.map} +1 -1
- package/dist/{chunk-5UOVYM3P.cjs → chunk-6VLKVX7O.cjs} +131 -54
- package/dist/chunk-6VLKVX7O.cjs.map +1 -0
- package/dist/{chunk-5PHVENFV.js → chunk-7FHZ4VQX.js} +3 -55
- package/dist/chunk-7FHZ4VQX.js.map +1 -0
- package/dist/{chunk-Q47R5E2X.cjs → chunk-E3WZ6Y4H.cjs} +7 -59
- package/dist/chunk-E3WZ6Y4H.cjs.map +1 -0
- package/dist/{chunk-ITSSOVOB.cjs → chunk-H5GOSXSC.cjs} +4 -4
- package/dist/{chunk-ITSSOVOB.cjs.map → chunk-H5GOSXSC.cjs.map} +1 -1
- package/dist/{chunk-I5BE5M5L.js → chunk-KBXWEWKS.js} +4 -4
- package/dist/{chunk-I5BE5M5L.js.map → chunk-KBXWEWKS.js.map} +1 -1
- package/dist/chunk-KRD3GQAA.cjs +71 -0
- package/dist/chunk-KRD3GQAA.cjs.map +1 -0
- package/dist/chunk-KVNWIAO4.js +68 -0
- package/dist/chunk-KVNWIAO4.js.map +1 -0
- package/dist/{chunk-F5WMX4EA.cjs → chunk-LQYQHXIW.cjs} +19 -19
- package/dist/{chunk-F5WMX4EA.cjs.map → chunk-LQYQHXIW.cjs.map} +1 -1
- package/dist/{chunk-IVNNSANC.js → chunk-M7UHYBEY.js} +3 -3
- package/dist/{chunk-IVNNSANC.js.map → chunk-M7UHYBEY.js.map} +1 -1
- package/dist/{chunk-DAPSQZT4.js → chunk-ODTZ7HX3.js} +131 -54
- package/dist/chunk-ODTZ7HX3.js.map +1 -0
- package/dist/context/index.cjs +6 -5
- package/dist/context/index.cjs.map +1 -1
- package/dist/context/index.js +3 -2
- package/dist/context/index.js.map +1 -1
- package/dist/cron.cjs +6 -5
- package/dist/cron.js +5 -4
- package/dist/eval.cjs +5 -4
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +4 -3
- package/dist/eval.js.map +1 -1
- package/dist/{index-manager-ZMRJ6ZII.js → index-manager-WBIMDVQT.js} +4 -3
- package/dist/{index-manager-ZMRJ6ZII.js.map → index-manager-WBIMDVQT.js.map} +1 -1
- package/dist/{index-manager-NG5YENWO.cjs → index-manager-WC5ZVJWO.cjs} +5 -4
- package/dist/{index-manager-NG5YENWO.cjs.map → index-manager-WC5ZVJWO.cjs.map} +1 -1
- package/dist/index.cjs +28 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/internal/memory/storage/markdown-store.d.ts +14 -2
- package/dist/internal/memory/storage/memory-file.d.ts +54 -0
- package/dist/internal/memory/types.d.ts +28 -0
- package/dist/sandbox/index.cjs +1 -1
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.js +1 -1
- package/dist/sandbox/index.js.map +1 -1
- package/docs/error-codes.md +3 -1
- package/docs/harness-capability-map.md +2 -1
- package/package.json +1 -1
- package/dist/chunk-5PHVENFV.js.map +0 -1
- package/dist/chunk-5UOVYM3P.cjs.map +0 -1
- package/dist/chunk-DAPSQZT4.js.map +0 -1
- package/dist/chunk-Q47R5E2X.cjs.map +0 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/internal/runtime/context/context-yaml-lite.ts
|
|
4
|
+
var FRONTMATTER_RE = /^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/;
|
|
5
|
+
function splitFrontmatter(content) {
|
|
6
|
+
const m = FRONTMATTER_RE.exec(content);
|
|
7
|
+
if (m === null) return { yaml: void 0, body: content };
|
|
8
|
+
return { yaml: m[1] ?? "", body: m[2] ?? "" };
|
|
9
|
+
}
|
|
10
|
+
function parseSimpleYaml(yaml) {
|
|
11
|
+
const out = {};
|
|
12
|
+
const lines = yaml.split(/\r?\n/);
|
|
13
|
+
let i = 0;
|
|
14
|
+
while (i < lines.length) {
|
|
15
|
+
const line = lines[i];
|
|
16
|
+
i += 1;
|
|
17
|
+
if (line === void 0) continue;
|
|
18
|
+
const trimmed = line.trim();
|
|
19
|
+
if (trimmed === "" || trimmed.startsWith("#")) continue;
|
|
20
|
+
const colon = trimmed.indexOf(":");
|
|
21
|
+
if (colon === -1) throw new Error(`Invalid YAML line: ${trimmed}`);
|
|
22
|
+
const key = trimmed.slice(0, colon).trim();
|
|
23
|
+
const rest = trimmed.slice(colon + 1).trim();
|
|
24
|
+
if (rest === "") {
|
|
25
|
+
const items = [];
|
|
26
|
+
const nested = {};
|
|
27
|
+
let sawNested = false;
|
|
28
|
+
while (i < lines.length) {
|
|
29
|
+
const next = lines[i];
|
|
30
|
+
if (next === void 0) break;
|
|
31
|
+
const nextTrim = next.trim();
|
|
32
|
+
if (nextTrim === "") {
|
|
33
|
+
i += 1;
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
const indented = /^\s/.test(next);
|
|
37
|
+
if (nextTrim.startsWith("- ")) {
|
|
38
|
+
items.push(parseScalar(nextTrim.slice(2).trim()));
|
|
39
|
+
i += 1;
|
|
40
|
+
} else if (indented && nextTrim.includes(":")) {
|
|
41
|
+
const nestedColon = nextTrim.indexOf(":");
|
|
42
|
+
nested[nextTrim.slice(0, nestedColon).trim()] = parseScalar(
|
|
43
|
+
nextTrim.slice(nestedColon + 1).trim()
|
|
44
|
+
);
|
|
45
|
+
sawNested = true;
|
|
46
|
+
i += 1;
|
|
47
|
+
} else {
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
out[key] = sawNested ? nested : items;
|
|
52
|
+
} else if (rest.startsWith("[") && rest.endsWith("]")) {
|
|
53
|
+
const inner = rest.slice(1, -1).trim();
|
|
54
|
+
out[key] = inner === "" ? [] : inner.split(",").map((s) => parseScalar(s.trim().replace(/^["']|["']$/g, "")));
|
|
55
|
+
} else {
|
|
56
|
+
out[key] = parseScalar(rest);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return out;
|
|
60
|
+
}
|
|
61
|
+
function parseScalar(s) {
|
|
62
|
+
if (s === "true") return true;
|
|
63
|
+
if (s === "false") return false;
|
|
64
|
+
if (/^-?\d+$/.test(s)) return parseInt(s, 10);
|
|
65
|
+
return s.replace(/^["']|["']$/g, "");
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
exports.parseSimpleYaml = parseSimpleYaml;
|
|
69
|
+
exports.splitFrontmatter = splitFrontmatter;
|
|
70
|
+
//# sourceMappingURL=chunk-KRD3GQAA.cjs.map
|
|
71
|
+
//# sourceMappingURL=chunk-KRD3GQAA.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/internal/runtime/context/context-yaml-lite.ts"],"names":[],"mappings":";;;AAqBA,IAAM,cAAA,GAAiB,yCAAA;AAehB,SAAS,iBAAiB,OAAA,EAAmC;AAClE,EAAA,MAAM,CAAA,GAAI,cAAA,CAAe,IAAA,CAAK,OAAO,CAAA;AACrC,EAAA,IAAI,MAAM,IAAA,EAAM,OAAO,EAAE,IAAA,EAAM,MAAA,EAAW,MAAM,OAAA,EAAQ;AACxD,EAAA,OAAO,EAAE,IAAA,EAAM,CAAA,CAA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,EAAE,CAAC,CAAC,CAAA;AAAA,IACrF,CAAA,MAAO;AACL,MAAA,GAAA,CAAI,GAAG,CAAA,GAAI,WAAA,CAAY,IAAI,CAAA;AAAA,IAC7B;AAAA,EACF;AACA,EAAA,OAAO,GAAA;AACT;AAEA,SAAS,YAAY,CAAA,EAAsC;AACzD,EAAA,IAAI,CAAA,KAAM,QAAQ,OAAO,IAAA;AACzB,EAAA,IAAI,CAAA,KAAM,SAAS,OAAO,KAAA;AAC1B,EAAA,IAAI,UAAU,IAAA,CAAK,CAAC,GAAG,OAAO,QAAA,CAAS,GAAG,EAAE,CAAA;AAE5C,EAAA,OAAO,CAAA,CAAE,OAAA,CAAQ,cAAA,EAAgB,EAAE,CAAA;AACrC","file":"chunk-KRD3GQAA.cjs","sourcesContent":["/**\n * Minimal YAML-subset frontmatter parsing shared by the `.cursor/rules/*.mdc`\n * and `.theokit/rules/*.md` parsers (extracted for DRY — one parser, one set\n * of edge-case behaviours, no new dependency).\n *\n * Handles `key: value` lines (string scalars, booleans, integers) and `key:`\n * followed by indented `- item` arrays or inline `[a, b]` arrays. Sufficient\n * for the small, fixed frontmatter field sets these rule files use. Throws on\n * a truly malformed line (no colon).\n *\n * NOTE — distinct from the sibling `yaml-frontmatter.ts` `parseSimpleYaml` on\n * purpose: that one parses INLINE arrays only (`key: [a, b]`), whereas rule\n * files (`.cursor/rules/*.mdc`, `.theokit/rules/*.md`) use MULTI-LINE `- item`\n * lists (`paths:` / `globs:`), which this parser adds. Unifying onto the inline\n * parser would drop multi-line list support; unifying the other way would touch\n * the skills/subagents/persistence loaders that depend on the inline one. The\n * two intentionally coexist until a shared parser handles both shapes.\n *\n * @internal\n */\n\nconst FRONTMATTER_RE = /^---\\s*\\n([\\s\\S]*?)\\n---\\s*\\n([\\s\\S]*)$/;\n\nexport interface FrontmatterSplit {\n /** Raw YAML block between the `---` fences, or undefined when absent. */\n readonly yaml: string | undefined;\n /** The markdown body after the frontmatter (or the whole content). */\n readonly body: string;\n}\n\n/**\n * Split `---`-fenced frontmatter from the body. When no frontmatter fence is\n * present, `yaml` is undefined and `body` is the whole content.\n *\n * @internal\n */\nexport function splitFrontmatter(content: string): FrontmatterSplit {\n const m = FRONTMATTER_RE.exec(content);\n if (m === null) return { yaml: undefined, body: content };\n return { yaml: m[1] ?? \"\", body: m[2] ?? \"\" };\n}\n\n/**\n * Parse the minimal YAML subset. Throws on a line without a colon (malformed).\n *\n * @internal\n */\n// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: YAML-subset parser handles scalars + multi-line arrays + inline arrays in a single pass; extracting helpers fragments the line-state machine.\nexport function parseSimpleYaml(yaml: string): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n const lines = yaml.split(/\\r?\\n/);\n let i = 0;\n while (i < lines.length) {\n const line = lines[i];\n i += 1;\n if (line === undefined) continue;\n const trimmed = line.trim();\n if (trimmed === \"\" || trimmed.startsWith(\"#\")) continue;\n const colon = trimmed.indexOf(\":\");\n if (colon === -1) throw new Error(`Invalid YAML line: ${trimmed}`);\n const key = trimmed.slice(0, colon).trim();\n const rest = trimmed.slice(colon + 1).trim();\n if (rest === \"\") {\n // `key:` with nothing after it opens either an indented `- item` list or an indented nested\n // map. Which one is decided by the first non-empty indented line, so both are collected here.\n //\n // The map branch is not a new feature so much as a repair: before it, `metadata:` followed by\n // ` type: x` set `metadata` to `[]` AND parsed the indented lines as TOP-LEVEL entries, so\n // the nesting silently flattened and a caller reading `metadata.type` got `undefined` while\n // `type` appeared where it never was. Claude Code's memory files carry exactly that shape.\n const items: string[] = [];\n const nested: Record<string, unknown> = {};\n let sawNested = false;\n while (i < lines.length) {\n const next = lines[i];\n if (next === undefined) break;\n const nextTrim = next.trim();\n if (nextTrim === \"\") {\n i += 1;\n continue;\n }\n const indented = /^\\s/.test(next);\n if (nextTrim.startsWith(\"- \")) {\n items.push(parseScalar(nextTrim.slice(2).trim()) as string);\n i += 1;\n } else if (indented && nextTrim.includes(\":\")) {\n const nestedColon = nextTrim.indexOf(\":\");\n nested[nextTrim.slice(0, nestedColon).trim()] = parseScalar(\n nextTrim.slice(nestedColon + 1).trim(),\n );\n sawNested = true;\n i += 1;\n } else {\n break;\n }\n }\n // An empty `key:` stays `[]` — the pre-existing contract every `paths:` in a rule file relies\n // on. Only an actually-indented `key: value` under it makes it a map.\n out[key] = sawNested ? nested : items;\n } else if (rest.startsWith(\"[\") && rest.endsWith(\"]\")) {\n // Inline array `globs: [\"**/*.ts\", \"**/*.tsx\"]`\n const inner = rest.slice(1, -1).trim();\n out[key] =\n inner === \"\"\n ? []\n : inner.split(\",\").map((s) => parseScalar(s.trim().replace(/^[\"']|[\"']$/g, \"\")));\n } else {\n out[key] = parseScalar(rest);\n }\n }\n return out;\n}\n\nfunction parseScalar(s: string): string | boolean | number {\n if (s === \"true\") return true;\n if (s === \"false\") return false;\n if (/^-?\\d+$/.test(s)) return parseInt(s, 10);\n // Strip surrounding quotes if present.\n return s.replace(/^[\"']|[\"']$/g, \"\");\n}\n"]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// src/internal/runtime/context/context-yaml-lite.ts
|
|
2
|
+
var FRONTMATTER_RE = /^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/;
|
|
3
|
+
function splitFrontmatter(content) {
|
|
4
|
+
const m = FRONTMATTER_RE.exec(content);
|
|
5
|
+
if (m === null) return { yaml: void 0, body: content };
|
|
6
|
+
return { yaml: m[1] ?? "", body: m[2] ?? "" };
|
|
7
|
+
}
|
|
8
|
+
function parseSimpleYaml(yaml) {
|
|
9
|
+
const out = {};
|
|
10
|
+
const lines = yaml.split(/\r?\n/);
|
|
11
|
+
let i = 0;
|
|
12
|
+
while (i < lines.length) {
|
|
13
|
+
const line = lines[i];
|
|
14
|
+
i += 1;
|
|
15
|
+
if (line === void 0) continue;
|
|
16
|
+
const trimmed = line.trim();
|
|
17
|
+
if (trimmed === "" || trimmed.startsWith("#")) continue;
|
|
18
|
+
const colon = trimmed.indexOf(":");
|
|
19
|
+
if (colon === -1) throw new Error(`Invalid YAML line: ${trimmed}`);
|
|
20
|
+
const key = trimmed.slice(0, colon).trim();
|
|
21
|
+
const rest = trimmed.slice(colon + 1).trim();
|
|
22
|
+
if (rest === "") {
|
|
23
|
+
const items = [];
|
|
24
|
+
const nested = {};
|
|
25
|
+
let sawNested = false;
|
|
26
|
+
while (i < lines.length) {
|
|
27
|
+
const next = lines[i];
|
|
28
|
+
if (next === void 0) break;
|
|
29
|
+
const nextTrim = next.trim();
|
|
30
|
+
if (nextTrim === "") {
|
|
31
|
+
i += 1;
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
const indented = /^\s/.test(next);
|
|
35
|
+
if (nextTrim.startsWith("- ")) {
|
|
36
|
+
items.push(parseScalar(nextTrim.slice(2).trim()));
|
|
37
|
+
i += 1;
|
|
38
|
+
} else if (indented && nextTrim.includes(":")) {
|
|
39
|
+
const nestedColon = nextTrim.indexOf(":");
|
|
40
|
+
nested[nextTrim.slice(0, nestedColon).trim()] = parseScalar(
|
|
41
|
+
nextTrim.slice(nestedColon + 1).trim()
|
|
42
|
+
);
|
|
43
|
+
sawNested = true;
|
|
44
|
+
i += 1;
|
|
45
|
+
} else {
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
out[key] = sawNested ? nested : items;
|
|
50
|
+
} else if (rest.startsWith("[") && rest.endsWith("]")) {
|
|
51
|
+
const inner = rest.slice(1, -1).trim();
|
|
52
|
+
out[key] = inner === "" ? [] : inner.split(",").map((s) => parseScalar(s.trim().replace(/^["']|["']$/g, "")));
|
|
53
|
+
} else {
|
|
54
|
+
out[key] = parseScalar(rest);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
function parseScalar(s) {
|
|
60
|
+
if (s === "true") return true;
|
|
61
|
+
if (s === "false") return false;
|
|
62
|
+
if (/^-?\d+$/.test(s)) return parseInt(s, 10);
|
|
63
|
+
return s.replace(/^["']|["']$/g, "");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { parseSimpleYaml, splitFrontmatter };
|
|
67
|
+
//# sourceMappingURL=chunk-KVNWIAO4.js.map
|
|
68
|
+
//# sourceMappingURL=chunk-KVNWIAO4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/internal/runtime/context/context-yaml-lite.ts"],"names":[],"mappings":";AAqBA,IAAM,cAAA,GAAiB,yCAAA;AAehB,SAAS,iBAAiB,OAAA,EAAmC;AAClE,EAAA,MAAM,CAAA,GAAI,cAAA,CAAe,IAAA,CAAK,OAAO,CAAA;AACrC,EAAA,IAAI,MAAM,IAAA,EAAM,OAAO,EAAE,IAAA,EAAM,MAAA,EAAW,MAAM,OAAA,EAAQ;AACxD,EAAA,OAAO,EAAE,IAAA,EAAM,CAAA,CAAE,CAAC,CAAA,IAAK,IAAI,IAAA,EAAM,CAAA,CAAE,CAAC,CAAA,IAAK,EAAA,EAAG;AAC9C;AAQO,SAAS,gBAAgB,IAAA,EAAuC;AACrE,EAAA,MAAM,MAA+B,EAAC;AACtC,EAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,KAAA,CAAM,OAAO,CAAA;AAChC,EAAA,IAAI,CAAA,GAAI,CAAA;AACR,EAAA,OAAO,CAAA,GAAI,MAAM,MAAA,EAAQ;AACvB,IAAA,MAAM,IAAA,GAAO,MAAM,CAAC,CAAA;AACpB,IAAA,CAAA,IAAK,CAAA;AACL,IAAA,IAAI,SAAS,MAAA,EAAW;AACxB,IAAA,MAAM,OAAA,GAAU,KAAK,IAAA,EAAK;AAC1B,IAAA,IAAI,OAAA,KAAY,EAAA,IAAM,OAAA,CAAQ,UAAA,CAAW,GAAG,CAAA,EAAG;AAC/C,IAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,OAAA,CAAQ,GAAG,CAAA;AACjC,IAAA,IAAI,UAAU,EAAA,EAAI,MAAM,IAAI,KAAA,CAAM,CAAA,mBAAA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,IAAA;AACZ,UAAA,CAAA,IAAK,CAAA;AAAA,QACP,CAAA,MAAO;AACL,UAAA;AAAA,QACF;AAAA,MACF;AAGA,MAAA,GAAA,CAAI,GAAG,CAAA,GAAI,SAAA,GAAY,MAAA,GAAS,KAAA;AAAA,IAClC,CAAA,MAAA,IAAW,KAAK,UAAA,CAAW,GAAG,KAAK,IAAA,CAAK,QAAA,CAAS,GAAG,CAAA,EAAG;AAErD,MAAA,MAAM,QAAQ,IAAA,CAAK,KAAA,CAAM,CAAA,EAAG,EAAE,EAAE,IAAA,EAAK;AACrC,MAAA,GAAA,CAAI,GAAG,IACL,KAAA,KAAU,EAAA,GACN,EAAC,GACD,KAAA,CAAM,MAAM,GAAG,CAAA,CAAE,IAAI,CAAC,CAAA,KAAM,YAAY,CAAA,CAAE,IAAA,GAAO,OAAA,CAAQ,cAAA,EAAgB,EAAE,CAAC,CAAC,CAAA;AAAA,IACrF,CAAA,MAAO;AACL,MAAA,GAAA,CAAI,GAAG,CAAA,GAAI,WAAA,CAAY,IAAI,CAAA;AAAA,IAC7B;AAAA,EACF;AACA,EAAA,OAAO,GAAA;AACT;AAEA,SAAS,YAAY,CAAA,EAAsC;AACzD,EAAA,IAAI,CAAA,KAAM,QAAQ,OAAO,IAAA;AACzB,EAAA,IAAI,CAAA,KAAM,SAAS,OAAO,KAAA;AAC1B,EAAA,IAAI,UAAU,IAAA,CAAK,CAAC,GAAG,OAAO,QAAA,CAAS,GAAG,EAAE,CAAA;AAE5C,EAAA,OAAO,CAAA,CAAE,OAAA,CAAQ,cAAA,EAAgB,EAAE,CAAA;AACrC","file":"chunk-KVNWIAO4.js","sourcesContent":["/**\n * Minimal YAML-subset frontmatter parsing shared by the `.cursor/rules/*.mdc`\n * and `.theokit/rules/*.md` parsers (extracted for DRY — one parser, one set\n * of edge-case behaviours, no new dependency).\n *\n * Handles `key: value` lines (string scalars, booleans, integers) and `key:`\n * followed by indented `- item` arrays or inline `[a, b]` arrays. Sufficient\n * for the small, fixed frontmatter field sets these rule files use. Throws on\n * a truly malformed line (no colon).\n *\n * NOTE — distinct from the sibling `yaml-frontmatter.ts` `parseSimpleYaml` on\n * purpose: that one parses INLINE arrays only (`key: [a, b]`), whereas rule\n * files (`.cursor/rules/*.mdc`, `.theokit/rules/*.md`) use MULTI-LINE `- item`\n * lists (`paths:` / `globs:`), which this parser adds. Unifying onto the inline\n * parser would drop multi-line list support; unifying the other way would touch\n * the skills/subagents/persistence loaders that depend on the inline one. The\n * two intentionally coexist until a shared parser handles both shapes.\n *\n * @internal\n */\n\nconst FRONTMATTER_RE = /^---\\s*\\n([\\s\\S]*?)\\n---\\s*\\n([\\s\\S]*)$/;\n\nexport interface FrontmatterSplit {\n /** Raw YAML block between the `---` fences, or undefined when absent. */\n readonly yaml: string | undefined;\n /** The markdown body after the frontmatter (or the whole content). */\n readonly body: string;\n}\n\n/**\n * Split `---`-fenced frontmatter from the body. When no frontmatter fence is\n * present, `yaml` is undefined and `body` is the whole content.\n *\n * @internal\n */\nexport function splitFrontmatter(content: string): FrontmatterSplit {\n const m = FRONTMATTER_RE.exec(content);\n if (m === null) return { yaml: undefined, body: content };\n return { yaml: m[1] ?? \"\", body: m[2] ?? \"\" };\n}\n\n/**\n * Parse the minimal YAML subset. Throws on a line without a colon (malformed).\n *\n * @internal\n */\n// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: YAML-subset parser handles scalars + multi-line arrays + inline arrays in a single pass; extracting helpers fragments the line-state machine.\nexport function parseSimpleYaml(yaml: string): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n const lines = yaml.split(/\\r?\\n/);\n let i = 0;\n while (i < lines.length) {\n const line = lines[i];\n i += 1;\n if (line === undefined) continue;\n const trimmed = line.trim();\n if (trimmed === \"\" || trimmed.startsWith(\"#\")) continue;\n const colon = trimmed.indexOf(\":\");\n if (colon === -1) throw new Error(`Invalid YAML line: ${trimmed}`);\n const key = trimmed.slice(0, colon).trim();\n const rest = trimmed.slice(colon + 1).trim();\n if (rest === \"\") {\n // `key:` with nothing after it opens either an indented `- item` list or an indented nested\n // map. Which one is decided by the first non-empty indented line, so both are collected here.\n //\n // The map branch is not a new feature so much as a repair: before it, `metadata:` followed by\n // ` type: x` set `metadata` to `[]` AND parsed the indented lines as TOP-LEVEL entries, so\n // the nesting silently flattened and a caller reading `metadata.type` got `undefined` while\n // `type` appeared where it never was. Claude Code's memory files carry exactly that shape.\n const items: string[] = [];\n const nested: Record<string, unknown> = {};\n let sawNested = false;\n while (i < lines.length) {\n const next = lines[i];\n if (next === undefined) break;\n const nextTrim = next.trim();\n if (nextTrim === \"\") {\n i += 1;\n continue;\n }\n const indented = /^\\s/.test(next);\n if (nextTrim.startsWith(\"- \")) {\n items.push(parseScalar(nextTrim.slice(2).trim()) as string);\n i += 1;\n } else if (indented && nextTrim.includes(\":\")) {\n const nestedColon = nextTrim.indexOf(\":\");\n nested[nextTrim.slice(0, nestedColon).trim()] = parseScalar(\n nextTrim.slice(nestedColon + 1).trim(),\n );\n sawNested = true;\n i += 1;\n } else {\n break;\n }\n }\n // An empty `key:` stays `[]` — the pre-existing contract every `paths:` in a rule file relies\n // on. Only an actually-indented `key: value` under it makes it a map.\n out[key] = sawNested ? nested : items;\n } else if (rest.startsWith(\"[\") && rest.endsWith(\"]\")) {\n // Inline array `globs: [\"**/*.ts\", \"**/*.tsx\"]`\n const inner = rest.slice(1, -1).trim();\n out[key] =\n inner === \"\"\n ? []\n : inner.split(\",\").map((s) => parseScalar(s.trim().replace(/^[\"']|[\"']$/g, \"\")));\n } else {\n out[key] = parseScalar(rest);\n }\n }\n return out;\n}\n\nfunction parseScalar(s: string): string | boolean | number {\n if (s === \"true\") return true;\n if (s === \"false\") return false;\n if (/^-?\\d+$/.test(s)) return parseInt(s, 10);\n // Strip surrounding quotes if present.\n return s.replace(/^[\"']|[\"']$/g, \"\");\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkV2UUGUY4_cjs = require('./chunk-V2UUGUY4.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunk6VLKVX7O_cjs = require('./chunk-6VLKVX7O.cjs');
|
|
5
5
|
var chunk53CBTBWO_cjs = require('./chunk-53CBTBWO.cjs');
|
|
6
6
|
var chunkBV2MWEMV_cjs = require('./chunk-BV2MWEMV.cjs');
|
|
7
7
|
var chunkNGESVVJN_cjs = require('./chunk-NGESVVJN.cjs');
|
|
@@ -9,7 +9,7 @@ var chunkEI2Q7SJ5_cjs = require('./chunk-EI2Q7SJ5.cjs');
|
|
|
9
9
|
var chunkYPJ5NH5N_cjs = require('./chunk-YPJ5NH5N.cjs');
|
|
10
10
|
var chunkHLPSLDGL_cjs = require('./chunk-HLPSLDGL.cjs');
|
|
11
11
|
var chunk2ZPEDVLM_cjs = require('./chunk-2ZPEDVLM.cjs');
|
|
12
|
-
var
|
|
12
|
+
var chunkE3WZ6Y4H_cjs = require('./chunk-E3WZ6Y4H.cjs');
|
|
13
13
|
var chunkU2AC6JUP_cjs = require('./chunk-U2AC6JUP.cjs');
|
|
14
14
|
var chunkWJVHMTKB_cjs = require('./chunk-WJVHMTKB.cjs');
|
|
15
15
|
var chunk6JSIEDKL_cjs = require('./chunk-6JSIEDKL.cjs');
|
|
@@ -884,7 +884,7 @@ async function readLegacyFacts(jsonPath) {
|
|
|
884
884
|
}
|
|
885
885
|
async function writeMigratedFacts(cwd, jsonPath, facts) {
|
|
886
886
|
try {
|
|
887
|
-
for (const fact of facts) await
|
|
887
|
+
for (const fact of facts) await chunk6VLKVX7O_cjs.appendFactToMarkdown(cwd, fact);
|
|
888
888
|
await promises.unlink(jsonPath).catch(() => void 0);
|
|
889
889
|
chunkNUKRL3I6_cjs.diag(`[theokit-sdk] migrated ${facts.length} fact(s) from ${jsonPath} to MEMORY.md
|
|
890
890
|
`);
|
|
@@ -901,11 +901,11 @@ async function migrateLegacyJson(cwd, config) {
|
|
|
901
901
|
const key = `${cwd}::${config.namespace ?? "default"}::${config.scope ?? "agent"}::${config.userId ?? "default"}`;
|
|
902
902
|
if (migrationRun.has(key)) return { migrated: false, factCount: 0, reason: "already-migrated" };
|
|
903
903
|
migrationRun.add(key);
|
|
904
|
-
const jsonPath =
|
|
904
|
+
const jsonPath = chunk6VLKVX7O_cjs.legacyMemoryJsonPath(cwd, config);
|
|
905
905
|
if (!await fileExists(jsonPath)) {
|
|
906
906
|
return { migrated: false, factCount: 0, reason: "no-legacy-json" };
|
|
907
907
|
}
|
|
908
|
-
if (await fileExists(
|
|
908
|
+
if (await fileExists(chunk6VLKVX7O_cjs.memoryMdPath(cwd))) {
|
|
909
909
|
chunkNUKRL3I6_cjs.diag(
|
|
910
910
|
`[theokit-sdk] memory migration skipped: both MEMORY.md and legacy JSON exist at ${jsonPath}; leaving both intact
|
|
911
911
|
`
|
|
@@ -930,13 +930,13 @@ function extractMemoryFact(message) {
|
|
|
930
930
|
async function readMemoryFacts(cwd, config) {
|
|
931
931
|
if (!config.enabled) return [];
|
|
932
932
|
await migrateLegacyJson(cwd, config);
|
|
933
|
-
return
|
|
933
|
+
return chunk6VLKVX7O_cjs.readFacts(cwd, config);
|
|
934
934
|
}
|
|
935
935
|
async function appendMemoryFact(cwd, config, fact) {
|
|
936
936
|
if (!config.enabled) return;
|
|
937
937
|
await migrateLegacyJson(cwd, config);
|
|
938
938
|
const sanitized = { text: chunkJTB5Q42C_cjs.redactSecrets(fact.text) };
|
|
939
|
-
await
|
|
939
|
+
await chunk6VLKVX7O_cjs.appendFact(cwd, config, sanitized);
|
|
940
940
|
}
|
|
941
941
|
|
|
942
942
|
// src/internal/runtime/fixtures/fixture-scripts.ts
|
|
@@ -2789,7 +2789,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2789
2789
|
if (memoryProvider?.recordSessionSummary !== void 0) {
|
|
2790
2790
|
await memoryProvider.recordSessionSummary(summaryArgs);
|
|
2791
2791
|
} else {
|
|
2792
|
-
await
|
|
2792
|
+
await chunk6VLKVX7O_cjs.writeSessionSummary(summaryArgs);
|
|
2793
2793
|
}
|
|
2794
2794
|
if (!shouldUsePortMemoryPath()) {
|
|
2795
2795
|
void memoryGlue.syncIfReady();
|
|
@@ -3402,7 +3402,7 @@ var HISTOGRAM_NAMES = {
|
|
|
3402
3402
|
};
|
|
3403
3403
|
function safeRequire(moduleName) {
|
|
3404
3404
|
try {
|
|
3405
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
3405
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-LQYQHXIW.cjs', document.baseURI).href)));
|
|
3406
3406
|
return r(moduleName);
|
|
3407
3407
|
} catch {
|
|
3408
3408
|
return void 0;
|
|
@@ -3630,7 +3630,7 @@ var cachedOtel;
|
|
|
3630
3630
|
function loadOtel() {
|
|
3631
3631
|
if (cachedOtel === void 0) {
|
|
3632
3632
|
try {
|
|
3633
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
3633
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-LQYQHXIW.cjs', document.baseURI).href)));
|
|
3634
3634
|
const mod = r("@opentelemetry/api");
|
|
3635
3635
|
cachedOtel = mod;
|
|
3636
3636
|
} catch {
|
|
@@ -3949,7 +3949,7 @@ function applyAggregateCap(sources, maxTotal) {
|
|
|
3949
3949
|
}
|
|
3950
3950
|
const remaining = maxTotal - totalBytes;
|
|
3951
3951
|
if (remaining > 0) {
|
|
3952
|
-
const { finalContent } =
|
|
3952
|
+
const { finalContent } = chunkE3WZ6Y4H_cjs.truncateWithMarker(s.content, remaining);
|
|
3953
3953
|
kept.push({ ...s, content: finalContent, truncated: true });
|
|
3954
3954
|
totalBytes = maxTotal;
|
|
3955
3955
|
} else {
|
|
@@ -4023,9 +4023,9 @@ var FileContextManager = class {
|
|
|
4023
4023
|
this.lastScope = [...touchedFiles];
|
|
4024
4024
|
const config = await loadContextConfig(this.cwd);
|
|
4025
4025
|
const legacy = await loadSources(config, this.cwd);
|
|
4026
|
-
const maxBytesPerFile = this.settings.maxBytesPerFile ??
|
|
4026
|
+
const maxBytesPerFile = this.settings.maxBytesPerFile ?? chunkE3WZ6Y4H_cjs.DEFAULT_MAX_BYTES_PER_FILE;
|
|
4027
4027
|
const maxBytesTotal = this.settings.maxBytesTotal ?? DEFAULT_MAX_BYTES_TOTAL;
|
|
4028
|
-
const discovered = await
|
|
4028
|
+
const discovered = await chunkE3WZ6Y4H_cjs.runDiscovery({
|
|
4029
4029
|
cwd: this.cwd,
|
|
4030
4030
|
maxBytesPerFile,
|
|
4031
4031
|
skipLegacyTheokitContext: true,
|
|
@@ -7737,7 +7737,7 @@ async function reloadLocalAgent(agent) {
|
|
|
7737
7737
|
}
|
|
7738
7738
|
async function persistActiveMemoryTranscript(cwd, transcript) {
|
|
7739
7739
|
try {
|
|
7740
|
-
const dir = path.join(
|
|
7740
|
+
const dir = path.join(chunk6VLKVX7O_cjs.memoryDir(cwd), "transcripts", "active-memory");
|
|
7741
7741
|
const file = path.join(dir, `${transcript.runId}.json`);
|
|
7742
7742
|
await chunkI6TGFUCO_cjs.atomicWriteJson(file, transcript);
|
|
7743
7743
|
} catch (cause) {
|
|
@@ -8367,7 +8367,7 @@ function createMemorySearchTool(opts) {
|
|
|
8367
8367
|
};
|
|
8368
8368
|
}
|
|
8369
8369
|
function createMemoryGetTool(opts) {
|
|
8370
|
-
const memoryRoot = path.resolve(
|
|
8370
|
+
const memoryRoot = path.resolve(chunk6VLKVX7O_cjs.memoryDir(opts.cwd));
|
|
8371
8371
|
return {
|
|
8372
8372
|
name: "memory_get",
|
|
8373
8373
|
description: GET_DESCRIPTION,
|
|
@@ -8473,7 +8473,7 @@ var LocalAgentMemory = class {
|
|
|
8473
8473
|
const openOpts = { cwd: this.workspaceCwd };
|
|
8474
8474
|
if (embedding !== void 0) openOpts.embedding = embedding;
|
|
8475
8475
|
if (cfg?.backend !== void 0) openOpts.backend = cfg.backend;
|
|
8476
|
-
this.index = await
|
|
8476
|
+
this.index = await chunk6VLKVX7O_cjs.IndexManager.open(openOpts);
|
|
8477
8477
|
await this.index.sync();
|
|
8478
8478
|
this.toolsCache = [
|
|
8479
8479
|
createMemorySearchTool({ index: this.index }),
|
|
@@ -8731,7 +8731,7 @@ function createLocalAgentMemoryProvider(opts) {
|
|
|
8731
8731
|
return { facts: [], systemPromptAdditions: summary };
|
|
8732
8732
|
},
|
|
8733
8733
|
async recordSessionSummary(args) {
|
|
8734
|
-
await
|
|
8734
|
+
await chunk6VLKVX7O_cjs.writeSessionSummary(args);
|
|
8735
8735
|
},
|
|
8736
8736
|
async sync(handle) {
|
|
8737
8737
|
const state = handle[INTERNAL_LAM_KEY];
|
|
@@ -10540,5 +10540,5 @@ exports.computeCost = computeCost;
|
|
|
10540
10540
|
exports.generateCronId = generateCronId;
|
|
10541
10541
|
exports.getPricingEntry = getPricingEntry;
|
|
10542
10542
|
exports.openRouterMemoryEmbeddingProviderAdapter = openRouterMemoryEmbeddingProviderAdapter;
|
|
10543
|
-
//# sourceMappingURL=chunk-
|
|
10544
|
-
//# sourceMappingURL=chunk-
|
|
10543
|
+
//# sourceMappingURL=chunk-LQYQHXIW.cjs.map
|
|
10544
|
+
//# sourceMappingURL=chunk-LQYQHXIW.cjs.map
|