@graphrefly/ts 0.0.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 +21 -0
- package/dist/adapters/index.cjs +9015 -0
- package/dist/adapters/index.cjs.map +1 -0
- package/dist/adapters/index.d.cts +678 -0
- package/dist/adapters/index.d.ts +678 -0
- package/dist/adapters/index.js +2894 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/observe-storage.cjs +260 -0
- package/dist/adapters/observe-storage.cjs.map +1 -0
- package/dist/adapters/observe-storage.d.cts +77 -0
- package/dist/adapters/observe-storage.d.ts +77 -0
- package/dist/adapters/observe-storage.js +161 -0
- package/dist/adapters/observe-storage.js.map +1 -0
- package/dist/append-log-DisvEReb.d.cts +189 -0
- package/dist/append-log-DzKMmjxx.d.ts +189 -0
- package/dist/chunk-2ILL7HQI.js +1189 -0
- package/dist/chunk-2ILL7HQI.js.map +1 -0
- package/dist/chunk-4VLAQHZI.js +330 -0
- package/dist/chunk-4VLAQHZI.js.map +1 -0
- package/dist/chunk-6PHB5CJS.js +229 -0
- package/dist/chunk-6PHB5CJS.js.map +1 -0
- package/dist/chunk-COHO25CZ.js +2449 -0
- package/dist/chunk-COHO25CZ.js.map +1 -0
- package/dist/chunk-D6BG7U6A.js +161 -0
- package/dist/chunk-D6BG7U6A.js.map +1 -0
- package/dist/chunk-DJC4CHLQ.js +818 -0
- package/dist/chunk-DJC4CHLQ.js.map +1 -0
- package/dist/chunk-DK554R7P.js +67 -0
- package/dist/chunk-DK554R7P.js.map +1 -0
- package/dist/chunk-DKP56CSW.js +322 -0
- package/dist/chunk-DKP56CSW.js.map +1 -0
- package/dist/chunk-G4M3NHRJ.js +688 -0
- package/dist/chunk-G4M3NHRJ.js.map +1 -0
- package/dist/chunk-GAJW5I5P.js +1 -0
- package/dist/chunk-GAJW5I5P.js.map +1 -0
- package/dist/chunk-GDL26N2T.js +282 -0
- package/dist/chunk-GDL26N2T.js.map +1 -0
- package/dist/chunk-GTPCOEOZ.js +741 -0
- package/dist/chunk-GTPCOEOZ.js.map +1 -0
- package/dist/chunk-H2HTHFVN.js +1 -0
- package/dist/chunk-H2HTHFVN.js.map +1 -0
- package/dist/chunk-HDRL4VQQ.js +218 -0
- package/dist/chunk-HDRL4VQQ.js.map +1 -0
- package/dist/chunk-I3IHOHCJ.js +2267 -0
- package/dist/chunk-I3IHOHCJ.js.map +1 -0
- package/dist/chunk-JIMUDQN3.js +965 -0
- package/dist/chunk-JIMUDQN3.js.map +1 -0
- package/dist/chunk-JR4IKCR2.js +462 -0
- package/dist/chunk-JR4IKCR2.js.map +1 -0
- package/dist/chunk-K3FXTC3I.js +165 -0
- package/dist/chunk-K3FXTC3I.js.map +1 -0
- package/dist/chunk-OOEN33FB.js +65 -0
- package/dist/chunk-OOEN33FB.js.map +1 -0
- package/dist/chunk-PKVBHGBM.js +554 -0
- package/dist/chunk-PKVBHGBM.js.map +1 -0
- package/dist/chunk-RIIOUTGM.js +1857 -0
- package/dist/chunk-RIIOUTGM.js.map +1 -0
- package/dist/chunk-SCRFRCGR.js +33 -0
- package/dist/chunk-SCRFRCGR.js.map +1 -0
- package/dist/chunk-SWTLEQL6.js +53 -0
- package/dist/chunk-SWTLEQL6.js.map +1 -0
- package/dist/chunk-SZAETNNA.js +1 -0
- package/dist/chunk-SZAETNNA.js.map +1 -0
- package/dist/chunk-TEW47IVR.js +49 -0
- package/dist/chunk-TEW47IVR.js.map +1 -0
- package/dist/chunk-Y3ZLRGHC.js +1482 -0
- package/dist/chunk-Y3ZLRGHC.js.map +1 -0
- package/dist/chunk-Z2ANQ6JW.js +149 -0
- package/dist/chunk-Z2ANQ6JW.js.map +1 -0
- package/dist/codec-BB7p8fJc.d.cts +38 -0
- package/dist/codec-BB7p8fJc.d.ts +38 -0
- package/dist/composition/index.cjs +2505 -0
- package/dist/composition/index.cjs.map +1 -0
- package/dist/composition/index.d.cts +95 -0
- package/dist/composition/index.d.ts +95 -0
- package/dist/composition/index.js +19 -0
- package/dist/composition/index.js.map +1 -0
- package/dist/core/index.cjs +2475 -0
- package/dist/core/index.cjs.map +1 -0
- package/dist/core/index.d.cts +25 -0
- package/dist/core/index.d.ts +25 -0
- package/dist/core/index.js +74 -0
- package/dist/core/index.js.map +1 -0
- package/dist/cqrs/index.cjs +595 -0
- package/dist/cqrs/index.cjs.map +1 -0
- package/dist/cqrs/index.d.cts +200 -0
- package/dist/cqrs/index.d.ts +200 -0
- package/dist/cqrs/index.js +557 -0
- package/dist/cqrs/index.js.map +1 -0
- package/dist/data-structures/index.cjs +4277 -0
- package/dist/data-structures/index.cjs.map +1 -0
- package/dist/data-structures/index.d.cts +22 -0
- package/dist/data-structures/index.d.ts +22 -0
- package/dist/data-structures/index.js +31 -0
- package/dist/data-structures/index.js.map +1 -0
- package/dist/describe-BZb7AS2y.d.ts +57 -0
- package/dist/describe-Ciu8SUnN.d.cts +57 -0
- package/dist/graph/index.cjs +7832 -0
- package/dist/graph/index.cjs.map +1 -0
- package/dist/graph/index.d.cts +251 -0
- package/dist/graph/index.d.ts +251 -0
- package/dist/graph/index.js +131 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph-DfdF9zy4.d.ts +666 -0
- package/dist/graph-s23RbbFO.d.cts +666 -0
- package/dist/index-CAEmLCYF.d.cts +166 -0
- package/dist/index-SnzZu3x7.d.ts +166 -0
- package/dist/index.cjs +15409 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +582 -0
- package/dist/index.js.map +1 -0
- package/dist/messages-BZqrGGm1.d.cts +55 -0
- package/dist/messages-BZqrGGm1.d.ts +55 -0
- package/dist/messaging/index.cjs +818 -0
- package/dist/messaging/index.cjs.map +1 -0
- package/dist/messaging/index.d.cts +235 -0
- package/dist/messaging/index.d.ts +235 -0
- package/dist/messaging/index.js +767 -0
- package/dist/messaging/index.js.map +1 -0
- package/dist/observe-event-log-0SVsx7JG.d.cts +88 -0
- package/dist/observe-event-log-Dnm76owp.d.ts +88 -0
- package/dist/operators/index.cjs +3774 -0
- package/dist/operators/index.cjs.map +1 -0
- package/dist/operators/index.d.cts +308 -0
- package/dist/operators/index.d.ts +308 -0
- package/dist/operators/index.js +112 -0
- package/dist/operators/index.js.map +1 -0
- package/dist/orchestration/index.cjs +3541 -0
- package/dist/orchestration/index.cjs.map +1 -0
- package/dist/orchestration/index.d.cts +302 -0
- package/dist/orchestration/index.d.ts +302 -0
- package/dist/orchestration/index.js +1004 -0
- package/dist/orchestration/index.js.map +1 -0
- package/dist/patterns/index.cjs +1045 -0
- package/dist/patterns/index.cjs.map +1 -0
- package/dist/patterns/index.d.cts +39 -0
- package/dist/patterns/index.d.ts +39 -0
- package/dist/patterns/index.js +33 -0
- package/dist/patterns/index.js.map +1 -0
- package/dist/reactive-collection-BxBqtIOE.d.cts +344 -0
- package/dist/reactive-collection-Cb1II1Fi.d.ts +344 -0
- package/dist/reactive-collection-storage-BNiEc-Gd.d.ts +217 -0
- package/dist/reactive-collection-storage-D-KmjE0J.d.cts +217 -0
- package/dist/reactive-map-BcB4KsQR.d.ts +256 -0
- package/dist/reactive-map-D-g3dv8I.d.cts +256 -0
- package/dist/read-through-B1CYPfq_.d.cts +82 -0
- package/dist/read-through-DwyJhGs1.d.ts +82 -0
- package/dist/render/index.cjs +250 -0
- package/dist/render/index.cjs.map +1 -0
- package/dist/render/index.d.cts +58 -0
- package/dist/render/index.d.ts +58 -0
- package/dist/render/index.js +20 -0
- package/dist/render/index.js.map +1 -0
- package/dist/resilience-Dig3Q7n0.d.cts +45 -0
- package/dist/resilience-Dig3Q7n0.d.ts +45 -0
- package/dist/semantic-memory-graph-BYoIlP35.d.cts +356 -0
- package/dist/semantic-memory-graph-CxyXLms3.d.ts +356 -0
- package/dist/solutions/index.cjs +3249 -0
- package/dist/solutions/index.cjs.map +1 -0
- package/dist/solutions/index.d.cts +520 -0
- package/dist/solutions/index.d.ts +520 -0
- package/dist/solutions/index.js +31 -0
- package/dist/solutions/index.js.map +1 -0
- package/dist/sources/browser.cjs +3095 -0
- package/dist/sources/browser.cjs.map +1 -0
- package/dist/sources/browser.d.cts +39 -0
- package/dist/sources/browser.d.ts +39 -0
- package/dist/sources/browser.js +137 -0
- package/dist/sources/browser.js.map +1 -0
- package/dist/sources/index.cjs +3021 -0
- package/dist/sources/index.cjs.map +1 -0
- package/dist/sources/index.d.cts +7 -0
- package/dist/sources/index.d.ts +7 -0
- package/dist/sources/index.js +63 -0
- package/dist/sources/index.js.map +1 -0
- package/dist/sources/node.cjs +675 -0
- package/dist/sources/node.cjs.map +1 -0
- package/dist/sources/node.d.cts +109 -0
- package/dist/sources/node.d.ts +109 -0
- package/dist/sources/node.js +639 -0
- package/dist/sources/node.js.map +1 -0
- package/dist/storage/browser.cjs +777 -0
- package/dist/storage/browser.cjs.map +1 -0
- package/dist/storage/browser.d.cts +40 -0
- package/dist/storage/browser.d.ts +40 -0
- package/dist/storage/browser.js +275 -0
- package/dist/storage/browser.js.map +1 -0
- package/dist/storage/index.cjs +1989 -0
- package/dist/storage/index.cjs.map +1 -0
- package/dist/storage/index.d.cts +92 -0
- package/dist/storage/index.d.ts +92 -0
- package/dist/storage/index.js +161 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/node.cjs +898 -0
- package/dist/storage/node.cjs.map +1 -0
- package/dist/storage/node.d.cts +66 -0
- package/dist/storage/node.d.ts +66 -0
- package/dist/storage/node.js +402 -0
- package/dist/storage/node.js.map +1 -0
- package/dist/testing/index.cjs +95 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +20 -0
- package/dist/testing/index.d.ts +20 -0
- package/dist/testing/index.js +8 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/types-bNMSWKqF.d.cts +732 -0
- package/dist/types-h12mNYbq.d.ts +732 -0
- package/package.json +250 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/render/index.ts","../../src/graph/render.ts"],"sourcesContent":["export {\n\ttype DescribeToAsciiOptions,\n\ttype DescribeToD2Options,\n\ttype DescribeToJsonOptions,\n\ttype DescribeToMermaidOptions,\n\ttype DescribeToMermaidUrlOptions,\n\ttype DescribeToPrettyOptions,\n\ttype DiagramDirection,\n\tdescribeToAscii,\n\tdescribeToD2,\n\tdescribeToJson,\n\tdescribeToMermaid,\n\tdescribeToMermaidUrl,\n\tdescribeToPretty,\n\ttype MermaidLiveTheme,\n\ttype MermaidLiveUrlOptions,\n\tmermaidLiveUrl,\n} from \"../graph/render.js\";\n","/**\n * Pure renderers over `DescribeSnapshot` (D39 / D40 tail).\n *\n * Render is graph-layer presentation: no Graph method, no topology mutation, no substrate behavior.\n */\n\nimport type { DescribeEdge, DescribeNode, DescribeSnapshot } from \"./describe.js\";\n\nexport type DiagramDirection = \"TD\" | \"LR\" | \"BT\" | \"RL\";\n\nexport interface DescribeToMermaidOptions {\n\t/** Diagram direction; default \"LR\". */\n\tdirection?: DiagramDirection;\n}\n\nexport type MermaidLiveTheme = \"default\" | \"dark\" | \"forest\" | \"neutral\" | \"base\";\n\nexport interface MermaidLiveUrlOptions {\n\t/** Mermaid Live theme; default \"default\". */\n\ttheme?: MermaidLiveTheme;\n\t/** Mermaid Live auto-sync flag; default true. */\n\tautoSync?: boolean;\n}\n\nexport interface DescribeToMermaidUrlOptions\n\textends DescribeToMermaidOptions,\n\t\tMermaidLiveUrlOptions {}\n\nexport interface DescribeToD2Options {\n\t/** Diagram direction; default \"LR\". */\n\tdirection?: DiagramDirection;\n}\n\nexport interface DescribeToPrettyOptions {\n\t/** Include the Edges section; default true. */\n\tincludeEdges?: boolean;\n}\n\nexport interface DescribeToAsciiOptions {\n\t/** Include cached values; default false. */\n\tincludeValues?: boolean;\n}\n\nexport interface DescribeToJsonOptions {\n\t/** Include edges; default true. */\n\tincludeEdges?: boolean;\n\t/** JSON indent; default 2. */\n\tindent?: number;\n}\n\ninterface FlatSnapshot {\n\tname?: string;\n\tnodes: DescribeNode[];\n\tedges: DescribeEdge[];\n}\n\n/** Render a D39 describe snapshot as Mermaid flowchart text. */\nexport function describeToMermaid(\n\tsnapshot: DescribeSnapshot,\n\topts: DescribeToMermaidOptions = {},\n): string {\n\tconst direction = normalizeDirection(opts.direction);\n\tconst flat = flattenDescribe(snapshot);\n\tconst nodes = sortedNodes(flat.nodes);\n\tconst ids = new Map<string, string>();\n\tfor (let i = 0; i < nodes.length; i += 1) ids.set(nodes[i]!.id, `n${i}`);\n\n\tconst lines = [`flowchart ${direction}`];\n\tfor (const node of nodes) {\n\t\tlines.push(` ${ids.get(node.id)!}[\"${escapeMermaidLabel(node.id)}\"]`);\n\t}\n\tfor (const edge of sortedEdges(flat.edges)) {\n\t\tconst from = ids.get(edge.from);\n\t\tconst to = ids.get(edge.to);\n\t\tif (from === undefined || to === undefined) continue;\n\t\tlines.push(` ${from} --> ${to}`);\n\t}\n\treturn lines.join(\"\\n\");\n}\n\n/** Encode arbitrary Mermaid source as a mermaid.live deep link. */\nexport function mermaidLiveUrl(mermaidSource: string, opts: MermaidLiveUrlOptions = {}): string {\n\tconst payload = {\n\t\tcode: mermaidSource,\n\t\tmermaid: { theme: opts.theme ?? \"default\" },\n\t\tautoSync: opts.autoSync ?? true,\n\t};\n\treturn `https://mermaid.live/edit#base64:${base64UrlEncode(JSON.stringify(payload))}`;\n}\n\n/** Render a D39 describe snapshot as a mermaid.live deep link. */\nexport function describeToMermaidUrl(\n\tsnapshot: DescribeSnapshot,\n\topts: DescribeToMermaidUrlOptions = {},\n): string {\n\treturn mermaidLiveUrl(describeToMermaid(snapshot, opts), opts);\n}\n\n/** Render a D39 describe snapshot as D2 diagram text. */\nexport function describeToD2(snapshot: DescribeSnapshot, opts: DescribeToD2Options = {}): string {\n\tconst direction = normalizeDirection(opts.direction);\n\tconst flat = flattenDescribe(snapshot);\n\tconst nodes = sortedNodes(flat.nodes);\n\tconst ids = new Map<string, string>();\n\tfor (let i = 0; i < nodes.length; i += 1) ids.set(nodes[i]!.id, `n${i}`);\n\n\tconst lines = [`direction: ${d2Direction(direction)}`];\n\tfor (const node of nodes) {\n\t\tlines.push(`${ids.get(node.id)!}: \"${escapeD2Label(node.id)}\"`);\n\t}\n\tfor (const edge of sortedEdges(flat.edges)) {\n\t\tconst from = ids.get(edge.from);\n\t\tconst to = ids.get(edge.to);\n\t\tif (from === undefined || to === undefined) continue;\n\t\tlines.push(`${from} -> ${to}`);\n\t}\n\treturn lines.join(\"\\n\");\n}\n\n/** Render a D39 describe snapshot as compact human-readable plaintext. */\nexport function describeToPretty(\n\tsnapshot: DescribeSnapshot,\n\topts: DescribeToPrettyOptions = {},\n): string {\n\tconst flat = flattenDescribe(snapshot);\n\tconst includeEdges = opts.includeEdges ?? true;\n\tconst lines: string[] = [`Graph ${flat.name ?? \"(anonymous)\"}`, \"Nodes:\"];\n\tfor (const node of sortedNodes(flat.nodes)) {\n\t\tlines.push(`- ${node.id} (${node.factory}/${node.status}): ${formatValue(node)}`);\n\t}\n\tif (includeEdges) {\n\t\tlines.push(\"Edges:\");\n\t\tfor (const edge of sortedEdges(flat.edges)) lines.push(`- ${edge.from} -> ${edge.to}`);\n\t}\n\treturn lines.join(\"\\n\");\n}\n\n/** Render a D39 describe snapshot as a compact ASCII adjacency diagram. */\nexport function describeToAscii(\n\tsnapshot: DescribeSnapshot,\n\topts: DescribeToAsciiOptions = {},\n): string {\n\tconst flat = flattenDescribe(snapshot);\n\tconst outgoing = new Map<string, string[]>();\n\tfor (const edge of sortedEdges(flat.edges)) {\n\t\tconst list = outgoing.get(edge.from);\n\t\tif (list) list.push(edge.to);\n\t\telse outgoing.set(edge.from, [edge.to]);\n\t}\n\tconst lines: string[] = [`Graph ${flat.name ?? \"(anonymous)\"}`];\n\tfor (const node of sortedNodes(flat.nodes)) {\n\t\tconst value = opts.includeValues ? ` ${formatValue(node)}` : \"\";\n\t\tconst to = outgoing.get(node.id)?.join(\", \") ?? \"-\";\n\t\tlines.push(`${node.id} [${node.factory}/${node.status}${value}] -> ${to}`);\n\t}\n\treturn lines.join(\"\\n\");\n}\n\n/** Render a D39 describe snapshot as deterministic JSON text. */\nexport function describeToJson(\n\tsnapshot: DescribeSnapshot,\n\topts: DescribeToJsonOptions = {},\n): string {\n\tconst includeEdges = opts.includeEdges ?? true;\n\tconst flat = flattenDescribe(snapshot);\n\tconst payload: FlatSnapshot = {\n\t\t...(flat.name !== undefined ? { name: flat.name } : {}),\n\t\tnodes: sortedNodes(flat.nodes).map((node) => sortJsonValue(node) as DescribeNode),\n\t\tedges: includeEdges ? sortedEdges(flat.edges) : [],\n\t};\n\treturn JSON.stringify(sortJsonValue(payload), null, opts.indent ?? 2);\n}\n\nfunction flattenDescribe(snapshot: DescribeSnapshot): FlatSnapshot {\n\tconst nodes: DescribeNode[] = [];\n\tconst edges: DescribeEdge[] = [];\n\tconst visit = (snap: DescribeSnapshot): void => {\n\t\tnodes.push(...snap.nodes);\n\t\tedges.push(...snap.edges);\n\t\tfor (const child of snap.subgraphs ?? []) visit(child);\n\t};\n\tvisit(snapshot);\n\treturn { ...(snapshot.name !== undefined ? { name: snapshot.name } : {}), nodes, edges };\n}\n\nfunction sortedNodes(nodes: readonly DescribeNode[]): DescribeNode[] {\n\treturn [...nodes].sort((a, b) => compareText(a.id, b.id));\n}\n\nfunction sortedEdges(edges: readonly DescribeEdge[]): DescribeEdge[] {\n\tconst seen = new Set<string>();\n\tconst out: DescribeEdge[] = [];\n\tfor (const edge of edges) {\n\t\tconst key = `${edge.from}\\0${edge.to}`;\n\t\tif (seen.has(key)) continue;\n\t\tseen.add(key);\n\t\tout.push(edge);\n\t}\n\treturn out.sort((a, b) => compareText(a.from, b.from) || compareText(a.to, b.to));\n}\n\nfunction compareText(a: string, b: string): number {\n\treturn a < b ? -1 : a > b ? 1 : 0;\n}\n\nfunction normalizeDirection(direction: unknown): DiagramDirection {\n\tif (direction === undefined) return \"LR\";\n\tif (direction === \"TD\" || direction === \"LR\" || direction === \"BT\" || direction === \"RL\") {\n\t\treturn direction;\n\t}\n\tthrow new Error(\n\t\t`invalid diagram direction ${String(direction)}; expected one of: TD, LR, BT, RL`,\n\t);\n}\n\nfunction d2Direction(direction: DiagramDirection): string {\n\tif (direction === \"TD\") return \"down\";\n\tif (direction === \"BT\") return \"up\";\n\tif (direction === \"RL\") return \"left\";\n\treturn \"right\";\n}\n\nfunction escapeMermaidLabel(value: string): string {\n\treturn escapeQuotedLabel(value);\n}\n\nfunction escapeD2Label(value: string): string {\n\treturn escapeQuotedLabel(value);\n}\n\nfunction escapeQuotedLabel(value: string): string {\n\treturn JSON.stringify(value).slice(1, -1);\n}\n\nfunction formatValue(node: DescribeNode): string {\n\tif (!(\"value\" in node)) return \"<SENTINEL>\";\n\tconst value = node.value;\n\tif (typeof value === \"string\") return JSON.stringify(value);\n\tif (typeof value === \"number\" || typeof value === \"boolean\" || value == null)\n\t\treturn String(value);\n\ttry {\n\t\treturn JSON.stringify(value);\n\t} catch {\n\t\treturn \"[unserializable]\";\n\t}\n}\n\nfunction sortJsonValue(value: unknown, seen: WeakSet<object> = new WeakSet()): unknown {\n\tif (typeof value === \"bigint\") return value.toString();\n\tif (value === null || typeof value !== \"object\") return value;\n\tif (seen.has(value)) return \"[Circular]\";\n\tseen.add(value);\n\tif (Array.isArray(value)) {\n\t\tconst out = value.map((item) => sortJsonValue(item, seen));\n\t\tseen.delete(value);\n\t\treturn out;\n\t}\n\tconst obj = value as Record<string, unknown>;\n\tconst out: Record<string, unknown> = {};\n\tfor (const key of Object.keys(obj).sort(compareText)) out[key] = sortJsonValue(obj[key], seen);\n\tseen.delete(value);\n\treturn out;\n}\n\nconst B64 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n\nfunction base64UrlEncode(value: string): string {\n\tconst bytes = utf8Bytes(value);\n\tlet out = \"\";\n\tfor (let i = 0; i < bytes.length; i += 3) {\n\t\tconst a = bytes[i]!;\n\t\tconst b = bytes[i + 1];\n\t\tconst c = bytes[i + 2];\n\t\tout += B64[a >> 2];\n\t\tout += B64[((a & 0x03) << 4) | ((b ?? 0) >> 4)];\n\t\tout += b === undefined ? \"=\" : B64[((b & 0x0f) << 2) | ((c ?? 0) >> 6)];\n\t\tout += c === undefined ? \"=\" : B64[c & 0x3f];\n\t}\n\treturn out.replaceAll(\"+\", \"-\").replaceAll(\"/\", \"_\").replace(/=+$/, \"\");\n}\n\nfunction utf8Bytes(value: string): number[] {\n\tconst bytes: number[] = [];\n\tfor (let i = 0; i < value.length; i += 1) {\n\t\tlet cp = value.charCodeAt(i);\n\t\tif (cp >= 0xd800 && cp <= 0xdbff && i + 1 < value.length) {\n\t\t\tconst lo = value.charCodeAt(i + 1);\n\t\t\tif (lo >= 0xdc00 && lo <= 0xdfff) {\n\t\t\t\tcp = 0x10000 + ((cp - 0xd800) << 10) + (lo - 0xdc00);\n\t\t\t\ti += 1;\n\t\t\t}\n\t\t}\n\t\tif (cp <= 0x7f) bytes.push(cp);\n\t\telse if (cp <= 0x7ff) bytes.push(0xc0 | (cp >> 6), 0x80 | (cp & 0x3f));\n\t\telse if (cp <= 0xffff)\n\t\t\tbytes.push(0xe0 | (cp >> 12), 0x80 | ((cp >> 6) & 0x3f), 0x80 | (cp & 0x3f));\n\t\telse\n\t\t\tbytes.push(\n\t\t\t\t0xf0 | (cp >> 18),\n\t\t\t\t0x80 | ((cp >> 12) & 0x3f),\n\t\t\t\t0x80 | ((cp >> 6) & 0x3f),\n\t\t\t\t0x80 | (cp & 0x3f),\n\t\t\t);\n\t}\n\treturn bytes;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACyDO,SAAS,kBACf,UACA,OAAiC,CAAC,GACzB;AACT,QAAM,YAAY,mBAAmB,KAAK,SAAS;AACnD,QAAM,OAAO,gBAAgB,QAAQ;AACrC,QAAM,QAAQ,YAAY,KAAK,KAAK;AACpC,QAAM,MAAM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W,KAAK,GAAG,EAAE,WAAW,KAAK,GAAG,EAAE,QAAQ,OAAO,EAAE;AACvE;AAEA,SAAS,UAAU,OAAyB;AAC3C,QAAM,QAAkB,CAAC;AACzB,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,GAAG;AACzC,QAAI,KAAK,MAAM,WAAW,CAAC;AAC3B,QAAI,MAAM,SAAU,MAAM,SAAU,IAAI,IAAI,MAAM,QAAQ;AACzD,YAAM,KAAK,MAAM,WAAW,IAAI,CAAC;AACjC,UAAI,MAAM,SAAU,MAAM,OAAQ;AACjC,aAAK,SAAY,KAAK,SAAW,OAAO,KAAK;AAC7C,aAAK;AAAA,MACN;AAAA,IACD;AACA,QAAI,MAAM,IAAM,OAAM,KAAK,EAAE;AAAA,aACpB,MAAM,KAAO,OAAM,KAAK,MAAQ,MAAM,GAAI,MAAQ,KAAK,EAAK;AAAA,aAC5D,MAAM;AACd,YAAM,KAAK,MAAQ,MAAM,IAAK,MAAS,MAAM,IAAK,IAAO,MAAQ,KAAK,EAAK;AAAA;AAE3E,YAAM;AAAA,QACL,MAAQ,MAAM;AAAA,QACd,MAAS,MAAM,KAAM;AAAA,QACrB,MAAS,MAAM,IAAK;AAAA,QACpB,MAAQ,KAAK;AAAA,MACd;AAAA,EACF;AACA,SAAO;AACR;","names":["out"]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { c as DescribeSnapshot } from '../describe-Ciu8SUnN.cjs';
|
|
2
|
+
import '../types-bNMSWKqF.cjs';
|
|
3
|
+
import '../messages-BZqrGGm1.cjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Pure renderers over `DescribeSnapshot` (D39 / D40 tail).
|
|
7
|
+
*
|
|
8
|
+
* Render is graph-layer presentation: no Graph method, no topology mutation, no substrate behavior.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
type DiagramDirection = "TD" | "LR" | "BT" | "RL";
|
|
12
|
+
interface DescribeToMermaidOptions {
|
|
13
|
+
/** Diagram direction; default "LR". */
|
|
14
|
+
direction?: DiagramDirection;
|
|
15
|
+
}
|
|
16
|
+
type MermaidLiveTheme = "default" | "dark" | "forest" | "neutral" | "base";
|
|
17
|
+
interface MermaidLiveUrlOptions {
|
|
18
|
+
/** Mermaid Live theme; default "default". */
|
|
19
|
+
theme?: MermaidLiveTheme;
|
|
20
|
+
/** Mermaid Live auto-sync flag; default true. */
|
|
21
|
+
autoSync?: boolean;
|
|
22
|
+
}
|
|
23
|
+
interface DescribeToMermaidUrlOptions extends DescribeToMermaidOptions, MermaidLiveUrlOptions {
|
|
24
|
+
}
|
|
25
|
+
interface DescribeToD2Options {
|
|
26
|
+
/** Diagram direction; default "LR". */
|
|
27
|
+
direction?: DiagramDirection;
|
|
28
|
+
}
|
|
29
|
+
interface DescribeToPrettyOptions {
|
|
30
|
+
/** Include the Edges section; default true. */
|
|
31
|
+
includeEdges?: boolean;
|
|
32
|
+
}
|
|
33
|
+
interface DescribeToAsciiOptions {
|
|
34
|
+
/** Include cached values; default false. */
|
|
35
|
+
includeValues?: boolean;
|
|
36
|
+
}
|
|
37
|
+
interface DescribeToJsonOptions {
|
|
38
|
+
/** Include edges; default true. */
|
|
39
|
+
includeEdges?: boolean;
|
|
40
|
+
/** JSON indent; default 2. */
|
|
41
|
+
indent?: number;
|
|
42
|
+
}
|
|
43
|
+
/** Render a D39 describe snapshot as Mermaid flowchart text. */
|
|
44
|
+
declare function describeToMermaid(snapshot: DescribeSnapshot, opts?: DescribeToMermaidOptions): string;
|
|
45
|
+
/** Encode arbitrary Mermaid source as a mermaid.live deep link. */
|
|
46
|
+
declare function mermaidLiveUrl(mermaidSource: string, opts?: MermaidLiveUrlOptions): string;
|
|
47
|
+
/** Render a D39 describe snapshot as a mermaid.live deep link. */
|
|
48
|
+
declare function describeToMermaidUrl(snapshot: DescribeSnapshot, opts?: DescribeToMermaidUrlOptions): string;
|
|
49
|
+
/** Render a D39 describe snapshot as D2 diagram text. */
|
|
50
|
+
declare function describeToD2(snapshot: DescribeSnapshot, opts?: DescribeToD2Options): string;
|
|
51
|
+
/** Render a D39 describe snapshot as compact human-readable plaintext. */
|
|
52
|
+
declare function describeToPretty(snapshot: DescribeSnapshot, opts?: DescribeToPrettyOptions): string;
|
|
53
|
+
/** Render a D39 describe snapshot as a compact ASCII adjacency diagram. */
|
|
54
|
+
declare function describeToAscii(snapshot: DescribeSnapshot, opts?: DescribeToAsciiOptions): string;
|
|
55
|
+
/** Render a D39 describe snapshot as deterministic JSON text. */
|
|
56
|
+
declare function describeToJson(snapshot: DescribeSnapshot, opts?: DescribeToJsonOptions): string;
|
|
57
|
+
|
|
58
|
+
export { type DescribeToAsciiOptions, type DescribeToD2Options, type DescribeToJsonOptions, type DescribeToMermaidOptions, type DescribeToMermaidUrlOptions, type DescribeToPrettyOptions, type DiagramDirection, type MermaidLiveTheme, type MermaidLiveUrlOptions, describeToAscii, describeToD2, describeToJson, describeToMermaid, describeToMermaidUrl, describeToPretty, mermaidLiveUrl };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { c as DescribeSnapshot } from '../describe-BZb7AS2y.js';
|
|
2
|
+
import '../types-h12mNYbq.js';
|
|
3
|
+
import '../messages-BZqrGGm1.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Pure renderers over `DescribeSnapshot` (D39 / D40 tail).
|
|
7
|
+
*
|
|
8
|
+
* Render is graph-layer presentation: no Graph method, no topology mutation, no substrate behavior.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
type DiagramDirection = "TD" | "LR" | "BT" | "RL";
|
|
12
|
+
interface DescribeToMermaidOptions {
|
|
13
|
+
/** Diagram direction; default "LR". */
|
|
14
|
+
direction?: DiagramDirection;
|
|
15
|
+
}
|
|
16
|
+
type MermaidLiveTheme = "default" | "dark" | "forest" | "neutral" | "base";
|
|
17
|
+
interface MermaidLiveUrlOptions {
|
|
18
|
+
/** Mermaid Live theme; default "default". */
|
|
19
|
+
theme?: MermaidLiveTheme;
|
|
20
|
+
/** Mermaid Live auto-sync flag; default true. */
|
|
21
|
+
autoSync?: boolean;
|
|
22
|
+
}
|
|
23
|
+
interface DescribeToMermaidUrlOptions extends DescribeToMermaidOptions, MermaidLiveUrlOptions {
|
|
24
|
+
}
|
|
25
|
+
interface DescribeToD2Options {
|
|
26
|
+
/** Diagram direction; default "LR". */
|
|
27
|
+
direction?: DiagramDirection;
|
|
28
|
+
}
|
|
29
|
+
interface DescribeToPrettyOptions {
|
|
30
|
+
/** Include the Edges section; default true. */
|
|
31
|
+
includeEdges?: boolean;
|
|
32
|
+
}
|
|
33
|
+
interface DescribeToAsciiOptions {
|
|
34
|
+
/** Include cached values; default false. */
|
|
35
|
+
includeValues?: boolean;
|
|
36
|
+
}
|
|
37
|
+
interface DescribeToJsonOptions {
|
|
38
|
+
/** Include edges; default true. */
|
|
39
|
+
includeEdges?: boolean;
|
|
40
|
+
/** JSON indent; default 2. */
|
|
41
|
+
indent?: number;
|
|
42
|
+
}
|
|
43
|
+
/** Render a D39 describe snapshot as Mermaid flowchart text. */
|
|
44
|
+
declare function describeToMermaid(snapshot: DescribeSnapshot, opts?: DescribeToMermaidOptions): string;
|
|
45
|
+
/** Encode arbitrary Mermaid source as a mermaid.live deep link. */
|
|
46
|
+
declare function mermaidLiveUrl(mermaidSource: string, opts?: MermaidLiveUrlOptions): string;
|
|
47
|
+
/** Render a D39 describe snapshot as a mermaid.live deep link. */
|
|
48
|
+
declare function describeToMermaidUrl(snapshot: DescribeSnapshot, opts?: DescribeToMermaidUrlOptions): string;
|
|
49
|
+
/** Render a D39 describe snapshot as D2 diagram text. */
|
|
50
|
+
declare function describeToD2(snapshot: DescribeSnapshot, opts?: DescribeToD2Options): string;
|
|
51
|
+
/** Render a D39 describe snapshot as compact human-readable plaintext. */
|
|
52
|
+
declare function describeToPretty(snapshot: DescribeSnapshot, opts?: DescribeToPrettyOptions): string;
|
|
53
|
+
/** Render a D39 describe snapshot as a compact ASCII adjacency diagram. */
|
|
54
|
+
declare function describeToAscii(snapshot: DescribeSnapshot, opts?: DescribeToAsciiOptions): string;
|
|
55
|
+
/** Render a D39 describe snapshot as deterministic JSON text. */
|
|
56
|
+
declare function describeToJson(snapshot: DescribeSnapshot, opts?: DescribeToJsonOptions): string;
|
|
57
|
+
|
|
58
|
+
export { type DescribeToAsciiOptions, type DescribeToD2Options, type DescribeToJsonOptions, type DescribeToMermaidOptions, type DescribeToMermaidUrlOptions, type DescribeToPrettyOptions, type DiagramDirection, type MermaidLiveTheme, type MermaidLiveUrlOptions, describeToAscii, describeToD2, describeToJson, describeToMermaid, describeToMermaidUrl, describeToPretty, mermaidLiveUrl };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import "../chunk-GAJW5I5P.js";
|
|
2
|
+
import {
|
|
3
|
+
describeToAscii,
|
|
4
|
+
describeToD2,
|
|
5
|
+
describeToJson,
|
|
6
|
+
describeToMermaid,
|
|
7
|
+
describeToMermaidUrl,
|
|
8
|
+
describeToPretty,
|
|
9
|
+
mermaidLiveUrl
|
|
10
|
+
} from "../chunk-HDRL4VQQ.js";
|
|
11
|
+
export {
|
|
12
|
+
describeToAscii,
|
|
13
|
+
describeToD2,
|
|
14
|
+
describeToJson,
|
|
15
|
+
describeToMermaid,
|
|
16
|
+
describeToMermaidUrl,
|
|
17
|
+
describeToPretty,
|
|
18
|
+
mermaidLiveUrl
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Passive resilience policy helpers for graph-visible adapters (D130/D132).
|
|
3
|
+
*
|
|
4
|
+
* These helpers never schedule work and never own graph state. Drivers/adapters
|
|
5
|
+
* consume them, while graph-visible bundles expose attempts/status/errors.
|
|
6
|
+
*/
|
|
7
|
+
type BackoffPolicy = {
|
|
8
|
+
readonly kind: "none";
|
|
9
|
+
} | {
|
|
10
|
+
readonly kind: "constant";
|
|
11
|
+
readonly delayMs: number;
|
|
12
|
+
} | {
|
|
13
|
+
readonly kind: "linear";
|
|
14
|
+
readonly initialMs: number;
|
|
15
|
+
readonly stepMs: number;
|
|
16
|
+
readonly maxMs?: number;
|
|
17
|
+
} | {
|
|
18
|
+
readonly kind: "exponential";
|
|
19
|
+
readonly initialMs: number;
|
|
20
|
+
readonly factor: number;
|
|
21
|
+
readonly maxMs?: number;
|
|
22
|
+
} | {
|
|
23
|
+
readonly kind: "fibonacci";
|
|
24
|
+
readonly unitMs: number;
|
|
25
|
+
readonly maxMs?: number;
|
|
26
|
+
};
|
|
27
|
+
interface RetryPolicy {
|
|
28
|
+
/** Total attempts including the first try. */
|
|
29
|
+
readonly maxAttempts: number;
|
|
30
|
+
readonly backoff: BackoffPolicy;
|
|
31
|
+
}
|
|
32
|
+
type RetryState = "idle" | "running" | "waiting" | "succeeded" | "failed" | "exhausted";
|
|
33
|
+
interface RetryStatus {
|
|
34
|
+
readonly attempt: number;
|
|
35
|
+
readonly maxAttempts: number;
|
|
36
|
+
readonly delayMs?: number;
|
|
37
|
+
readonly state: RetryState;
|
|
38
|
+
}
|
|
39
|
+
declare const noBackoff: BackoffPolicy;
|
|
40
|
+
declare function retryPolicy(maxAttempts?: number, backoff?: BackoffPolicy): RetryPolicy;
|
|
41
|
+
declare function shouldRetry(policy: RetryPolicy, failedAttempt: number): boolean;
|
|
42
|
+
declare function nextRetryDelayMs(policy: RetryPolicy, nextAttempt: number): number | undefined;
|
|
43
|
+
declare function backoffDelayMs(policy: BackoffPolicy, attempt: number): number;
|
|
44
|
+
|
|
45
|
+
export { type BackoffPolicy as B, type RetryPolicy as R, type RetryState as a, type RetryStatus as b, backoffDelayMs as c, noBackoff as d, nextRetryDelayMs as n, retryPolicy as r, shouldRetry as s };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Passive resilience policy helpers for graph-visible adapters (D130/D132).
|
|
3
|
+
*
|
|
4
|
+
* These helpers never schedule work and never own graph state. Drivers/adapters
|
|
5
|
+
* consume them, while graph-visible bundles expose attempts/status/errors.
|
|
6
|
+
*/
|
|
7
|
+
type BackoffPolicy = {
|
|
8
|
+
readonly kind: "none";
|
|
9
|
+
} | {
|
|
10
|
+
readonly kind: "constant";
|
|
11
|
+
readonly delayMs: number;
|
|
12
|
+
} | {
|
|
13
|
+
readonly kind: "linear";
|
|
14
|
+
readonly initialMs: number;
|
|
15
|
+
readonly stepMs: number;
|
|
16
|
+
readonly maxMs?: number;
|
|
17
|
+
} | {
|
|
18
|
+
readonly kind: "exponential";
|
|
19
|
+
readonly initialMs: number;
|
|
20
|
+
readonly factor: number;
|
|
21
|
+
readonly maxMs?: number;
|
|
22
|
+
} | {
|
|
23
|
+
readonly kind: "fibonacci";
|
|
24
|
+
readonly unitMs: number;
|
|
25
|
+
readonly maxMs?: number;
|
|
26
|
+
};
|
|
27
|
+
interface RetryPolicy {
|
|
28
|
+
/** Total attempts including the first try. */
|
|
29
|
+
readonly maxAttempts: number;
|
|
30
|
+
readonly backoff: BackoffPolicy;
|
|
31
|
+
}
|
|
32
|
+
type RetryState = "idle" | "running" | "waiting" | "succeeded" | "failed" | "exhausted";
|
|
33
|
+
interface RetryStatus {
|
|
34
|
+
readonly attempt: number;
|
|
35
|
+
readonly maxAttempts: number;
|
|
36
|
+
readonly delayMs?: number;
|
|
37
|
+
readonly state: RetryState;
|
|
38
|
+
}
|
|
39
|
+
declare const noBackoff: BackoffPolicy;
|
|
40
|
+
declare function retryPolicy(maxAttempts?: number, backoff?: BackoffPolicy): RetryPolicy;
|
|
41
|
+
declare function shouldRetry(policy: RetryPolicy, failedAttempt: number): boolean;
|
|
42
|
+
declare function nextRetryDelayMs(policy: RetryPolicy, nextAttempt: number): number | undefined;
|
|
43
|
+
declare function backoffDelayMs(policy: BackoffPolicy, attempt: number): number;
|
|
44
|
+
|
|
45
|
+
export { type BackoffPolicy as B, type RetryPolicy as R, type RetryState as a, type RetryStatus as b, backoffDelayMs as c, noBackoff as d, nextRetryDelayMs as n, retryPolicy as r, shouldRetry as s };
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { d as Graph } from './graph-s23RbbFO.cjs';
|
|
2
|
+
import { N as Node } from './types-bNMSWKqF.cjs';
|
|
3
|
+
import { b as StrictJsonValue } from './codec-BB7p8fJc.cjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Passive semantic-memory vocabulary and deterministic helpers.
|
|
7
|
+
*
|
|
8
|
+
* D158 splits semantic memory into horizontal patterns and vertical solutions.
|
|
9
|
+
* This module intentionally owns no graph nodes, storage restore, timers,
|
|
10
|
+
* subscriptions, vector indexes, knowledge graphs, or agentic runtime.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** Stable identity for a semantic-memory fact. */
|
|
14
|
+
type FactId = string;
|
|
15
|
+
/** Shard partition key used by passive sharding helpers. */
|
|
16
|
+
type ShardKey = string | number;
|
|
17
|
+
/**
|
|
18
|
+
* A single semantic-memory fact. Pattern convention only: this is not a
|
|
19
|
+
* protocol message, storage record owner, restore contract, or graph runtime.
|
|
20
|
+
*/
|
|
21
|
+
interface MemoryFragment<T = unknown> {
|
|
22
|
+
readonly id: FactId;
|
|
23
|
+
readonly payload: T;
|
|
24
|
+
/** Transaction time, typically monotonic nanoseconds. */
|
|
25
|
+
readonly tNs: bigint;
|
|
26
|
+
/** Valid-time start. Undefined means unbounded past. */
|
|
27
|
+
readonly validFrom?: bigint;
|
|
28
|
+
/** Valid-time end. Undefined means currently valid. */
|
|
29
|
+
readonly validTo?: bigint;
|
|
30
|
+
/** Confidence score in the closed interval [0, 1]. */
|
|
31
|
+
readonly confidence: number;
|
|
32
|
+
readonly tags: readonly string[];
|
|
33
|
+
/** Fact ids this fragment derives from or depends on. */
|
|
34
|
+
readonly sources: readonly FactId[];
|
|
35
|
+
readonly embedding?: readonly number[];
|
|
36
|
+
readonly parentFragmentId?: FactId;
|
|
37
|
+
readonly provenance?: string;
|
|
38
|
+
}
|
|
39
|
+
/** Columnar passive store vocabulary for callers that keep memory facts outside GraphReFly. */
|
|
40
|
+
interface FactStore<T = unknown> {
|
|
41
|
+
readonly byId: ReadonlyMap<FactId, MemoryFragment<T>>;
|
|
42
|
+
}
|
|
43
|
+
/** Read-only projection passed to scoring policies; it exposes no mutation surface. */
|
|
44
|
+
interface StoreReadHandle<T = unknown> {
|
|
45
|
+
get(id: FactId): MemoryFragment<T> | undefined;
|
|
46
|
+
has(id: FactId): boolean;
|
|
47
|
+
readonly size: number;
|
|
48
|
+
values(): IterableIterator<MemoryFragment<T>>;
|
|
49
|
+
}
|
|
50
|
+
type ScoringPolicy<T = unknown> = (fragment: MemoryFragment<T>, store: StoreReadHandle<T>) => number;
|
|
51
|
+
type DecayPolicy = (confidence: number, ageNs: bigint) => number;
|
|
52
|
+
type AdmissionFilter<T = unknown> = (fragment: MemoryFragment<T>) => boolean;
|
|
53
|
+
/** Outcome signal for policy learning. This is an application fact, not a protocol event. */
|
|
54
|
+
interface OutcomeSignal {
|
|
55
|
+
readonly factId: FactId;
|
|
56
|
+
readonly reward: number;
|
|
57
|
+
}
|
|
58
|
+
/** Passive structured query over semantic-memory facts. */
|
|
59
|
+
interface MemoryQuery {
|
|
60
|
+
readonly tags?: readonly string[];
|
|
61
|
+
readonly asOf?: bigint;
|
|
62
|
+
readonly minConfidence?: number;
|
|
63
|
+
readonly limit?: number;
|
|
64
|
+
}
|
|
65
|
+
interface MemoryAnswer<T = unknown> {
|
|
66
|
+
readonly query: MemoryQuery;
|
|
67
|
+
readonly results: readonly MemoryFragment<T>[];
|
|
68
|
+
}
|
|
69
|
+
type KnowledgeAssertionStrictJsonValue = StrictJsonValue;
|
|
70
|
+
/** Passive KG endpoint vocabulary. Entity ids are DATA keys, not graph node ids. */
|
|
71
|
+
interface KnowledgeAssertionSubject {
|
|
72
|
+
readonly id: FactId;
|
|
73
|
+
readonly type?: string;
|
|
74
|
+
}
|
|
75
|
+
/** Passive KG object/value vocabulary. */
|
|
76
|
+
type KnowledgeAssertionObject = {
|
|
77
|
+
readonly kind: "entity";
|
|
78
|
+
readonly id: FactId;
|
|
79
|
+
readonly type?: string;
|
|
80
|
+
} | {
|
|
81
|
+
readonly kind: "value";
|
|
82
|
+
readonly value: KnowledgeAssertionStrictJsonValue;
|
|
83
|
+
readonly valueType?: string;
|
|
84
|
+
};
|
|
85
|
+
/** Passive KG assertion fact consumed by lower semantic-memory graph patterns. */
|
|
86
|
+
interface KnowledgeAssertion {
|
|
87
|
+
readonly id: FactId;
|
|
88
|
+
readonly recordId?: FactId;
|
|
89
|
+
readonly fragmentId?: FactId;
|
|
90
|
+
readonly subject: KnowledgeAssertionSubject;
|
|
91
|
+
readonly predicate: string;
|
|
92
|
+
readonly object: KnowledgeAssertionObject;
|
|
93
|
+
readonly confidence?: number;
|
|
94
|
+
readonly sources?: readonly FactId[];
|
|
95
|
+
readonly provenance?: string;
|
|
96
|
+
}
|
|
97
|
+
/** Entry vocabulary for ranked collection-like memory views. */
|
|
98
|
+
interface CollectionEntry<T = unknown> {
|
|
99
|
+
readonly id: string;
|
|
100
|
+
readonly value: T;
|
|
101
|
+
readonly createdAtNs: bigint;
|
|
102
|
+
readonly lastAccessNs: bigint;
|
|
103
|
+
readonly baseScore: number;
|
|
104
|
+
}
|
|
105
|
+
type RankedCollectionEntry<T = unknown> = CollectionEntry<T> & {
|
|
106
|
+
readonly score: number;
|
|
107
|
+
};
|
|
108
|
+
type CollectionScoreFn<T = unknown> = (value: T) => number;
|
|
109
|
+
/** Query shape shared by passive retrieval/ranking helpers. */
|
|
110
|
+
interface RetrievalQuery {
|
|
111
|
+
readonly text?: string;
|
|
112
|
+
readonly vector?: readonly number[];
|
|
113
|
+
readonly entityIds?: readonly string[];
|
|
114
|
+
readonly context?: readonly string[];
|
|
115
|
+
}
|
|
116
|
+
interface VectorSearchResult<TMeta = unknown> {
|
|
117
|
+
readonly id: string;
|
|
118
|
+
readonly score: number;
|
|
119
|
+
readonly meta?: TMeta;
|
|
120
|
+
}
|
|
121
|
+
interface RetrievalEntry<TMem = unknown> {
|
|
122
|
+
readonly key: string;
|
|
123
|
+
readonly value: TMem;
|
|
124
|
+
readonly score: number;
|
|
125
|
+
readonly sources: ReadonlyArray<"vector" | "graph" | "store">;
|
|
126
|
+
readonly context?: readonly string[];
|
|
127
|
+
}
|
|
128
|
+
interface RetrievalTrace<TMem = unknown> {
|
|
129
|
+
readonly vectorCandidates: ReadonlyArray<VectorSearchResult<TMem>>;
|
|
130
|
+
readonly graphExpanded: ReadonlyArray<string>;
|
|
131
|
+
readonly ranked: ReadonlyArray<RetrievalEntry<TMem>>;
|
|
132
|
+
readonly packed: ReadonlyArray<RetrievalEntry<TMem>>;
|
|
133
|
+
}
|
|
134
|
+
/** Generic per-dimension thresholds. Any configured dimension below threshold is rejected. */
|
|
135
|
+
type AdmissionThresholds<Dims extends string> = Partial<Record<Dims, number>>;
|
|
136
|
+
interface AdmissionScoredOptions<Dims extends string, TRaw = unknown> {
|
|
137
|
+
readonly scoreFn: (raw: TRaw) => Readonly<Record<Dims, number>>;
|
|
138
|
+
readonly thresholds?: AdmissionThresholds<Dims>;
|
|
139
|
+
}
|
|
140
|
+
interface AdmissionScores {
|
|
141
|
+
readonly persistence: number;
|
|
142
|
+
readonly structure: number;
|
|
143
|
+
readonly personalValue: number;
|
|
144
|
+
}
|
|
145
|
+
interface AdmissionScore3DOptions {
|
|
146
|
+
readonly scoreFn: (raw: unknown) => AdmissionScores;
|
|
147
|
+
readonly persistenceThreshold?: number;
|
|
148
|
+
readonly personalValueThreshold?: number;
|
|
149
|
+
readonly requireStructured?: boolean;
|
|
150
|
+
}
|
|
151
|
+
interface ShardByTenantOptions {
|
|
152
|
+
readonly tenants?: readonly string[];
|
|
153
|
+
readonly shardCount?: number;
|
|
154
|
+
}
|
|
155
|
+
interface ShardByTenantConfig<T = unknown> {
|
|
156
|
+
readonly shardBy: (fragment: MemoryFragment<T>) => ShardKey;
|
|
157
|
+
readonly shardCount: number;
|
|
158
|
+
}
|
|
159
|
+
interface MemoryFragmentValidation {
|
|
160
|
+
readonly ok: boolean;
|
|
161
|
+
readonly errors: readonly string[];
|
|
162
|
+
}
|
|
163
|
+
/** Cosine similarity over zero-padded vectors. Non-finite results normalize to 0. */
|
|
164
|
+
declare function cosineSimilarity(a: readonly number[], b: readonly number[]): number;
|
|
165
|
+
/**
|
|
166
|
+
* Returns true when a fragment is valid at `asOf`.
|
|
167
|
+
*
|
|
168
|
+
* Omitted `asOf` has no clock to compare against, so it admits only fragments
|
|
169
|
+
* that are live and not valid-time delayed.
|
|
170
|
+
*/
|
|
171
|
+
declare function memoryFragmentValidAt(fragment: MemoryFragment, asOf?: bigint): boolean;
|
|
172
|
+
/** Pure structured-query predicate over a single fragment. */
|
|
173
|
+
declare function memoryFragmentMatchesQuery(fragment: MemoryFragment, query?: MemoryQuery): boolean;
|
|
174
|
+
/** Filter and rank fragments by confidence desc, then transaction time desc. */
|
|
175
|
+
declare function filterMemoryFragments<T>(fragments: Iterable<MemoryFragment<T>>, query?: MemoryQuery): readonly MemoryFragment<T>[];
|
|
176
|
+
/** Validate the passive MemoryFragment shape without throwing. */
|
|
177
|
+
declare function validateMemoryFragment(value: unknown): MemoryFragmentValidation;
|
|
178
|
+
declare function isMemoryFragment(value: unknown): value is MemoryFragment;
|
|
179
|
+
/**
|
|
180
|
+
* Generic N-dimension admission filter. Missing or non-finite thresholded scores reject.
|
|
181
|
+
*/
|
|
182
|
+
declare function admissionScored<Dims extends string, TRaw = unknown>(opts: AdmissionScoredOptions<Dims, TRaw>): (raw: TRaw) => boolean;
|
|
183
|
+
/** Three-axis admission sugar for persistence / structure / personal-value scoring. */
|
|
184
|
+
declare function admissionFilter3D(opts: AdmissionScore3DOptions): (raw: unknown) => boolean;
|
|
185
|
+
/** Build a passive `{ shardBy, shardCount }` pair for tenant-isolated sharding. */
|
|
186
|
+
declare function shardByTenant<T>(tenantOf: (fragment: MemoryFragment<T>) => string, opts?: ShardByTenantOptions): ShardByTenantConfig<T>;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Graph-visible semantic-memory retrieval patterns.
|
|
190
|
+
*
|
|
191
|
+
* D158 allows horizontal semantic-memory patterns when they are ordinary graph
|
|
192
|
+
* nodes with declared deps and graph-visible facts. This file intentionally
|
|
193
|
+
* owns no storage restore/hydration, scheduler, hidden subscription, vector DB,
|
|
194
|
+
* retention loop, consolidation loop, Graph subclass, or protocol behavior.
|
|
195
|
+
*/
|
|
196
|
+
|
|
197
|
+
/** Query shape for the first graph-visible retrieval bundle. */
|
|
198
|
+
interface MemoryRetrievalQuery extends MemoryQuery {
|
|
199
|
+
/** Optional dense embedding used only for deterministic in-memory ranking. */
|
|
200
|
+
readonly vector?: readonly number[];
|
|
201
|
+
}
|
|
202
|
+
interface MemoryRetrievalCursor {
|
|
203
|
+
readonly evaluation: number;
|
|
204
|
+
readonly validFragments: number;
|
|
205
|
+
readonly invalidFragments: number;
|
|
206
|
+
readonly resultCount: number;
|
|
207
|
+
}
|
|
208
|
+
type MemoryRetrievalStatusState = "ready" | "empty" | "partial" | "error";
|
|
209
|
+
interface MemoryRetrievalStatus {
|
|
210
|
+
readonly state: MemoryRetrievalStatusState;
|
|
211
|
+
readonly query: MemoryRetrievalQuery;
|
|
212
|
+
readonly cursor: MemoryRetrievalCursor;
|
|
213
|
+
}
|
|
214
|
+
interface MemoryRetrievalIndex<T = unknown> {
|
|
215
|
+
readonly ids: readonly FactId[];
|
|
216
|
+
readonly byId: Readonly<Record<FactId, MemoryFragment<T>>>;
|
|
217
|
+
readonly cursor: MemoryRetrievalCursor;
|
|
218
|
+
}
|
|
219
|
+
type MemoryRetrievalErrorCode = "duplicate-fragment-id" | "invalid-fragments-input" | "invalid-fragment" | "invalid-query" | "invalid-query-vector";
|
|
220
|
+
interface MemoryRetrievalError {
|
|
221
|
+
readonly code: MemoryRetrievalErrorCode;
|
|
222
|
+
readonly message: string;
|
|
223
|
+
readonly index?: number;
|
|
224
|
+
readonly fragment?: unknown;
|
|
225
|
+
readonly validationErrors?: readonly string[];
|
|
226
|
+
readonly cursor: MemoryRetrievalCursor;
|
|
227
|
+
}
|
|
228
|
+
interface MemoryRetrievalSnapshot<T = unknown> {
|
|
229
|
+
readonly fragments: readonly MemoryFragment<T>[];
|
|
230
|
+
readonly indexed: MemoryRetrievalIndex<T>;
|
|
231
|
+
readonly ranked: MemoryAnswer<T>;
|
|
232
|
+
readonly status: MemoryRetrievalStatus;
|
|
233
|
+
readonly errors: readonly MemoryRetrievalError[];
|
|
234
|
+
readonly cursor: MemoryRetrievalCursor;
|
|
235
|
+
}
|
|
236
|
+
type MemoryRetrievalFact<T = unknown> = MemoryRetrievalSnapshot<T>;
|
|
237
|
+
interface KnowledgeGraphEntity {
|
|
238
|
+
readonly id: FactId;
|
|
239
|
+
readonly type?: string;
|
|
240
|
+
readonly assertionIds: readonly FactId[];
|
|
241
|
+
readonly subjectAssertionIds: readonly FactId[];
|
|
242
|
+
readonly objectAssertionIds: readonly FactId[];
|
|
243
|
+
}
|
|
244
|
+
interface KnowledgeGraphRelation {
|
|
245
|
+
readonly assertionId: FactId;
|
|
246
|
+
readonly subject: KnowledgeAssertionSubject;
|
|
247
|
+
readonly predicate: string;
|
|
248
|
+
readonly object: KnowledgeAssertionObject;
|
|
249
|
+
readonly confidence?: number;
|
|
250
|
+
readonly sources: readonly FactId[];
|
|
251
|
+
readonly provenance?: string;
|
|
252
|
+
}
|
|
253
|
+
interface KnowledgeGraphTopic {
|
|
254
|
+
readonly predicate: string;
|
|
255
|
+
readonly assertionIds: readonly FactId[];
|
|
256
|
+
readonly entityIds: readonly FactId[];
|
|
257
|
+
}
|
|
258
|
+
interface KnowledgeGraphIndex {
|
|
259
|
+
readonly assertionIds: readonly FactId[];
|
|
260
|
+
readonly entityIds: readonly FactId[];
|
|
261
|
+
readonly relationIds: readonly FactId[];
|
|
262
|
+
readonly predicates: readonly string[];
|
|
263
|
+
}
|
|
264
|
+
interface KnowledgeGraphPolicy {
|
|
265
|
+
readonly allowedPredicates?: readonly string[];
|
|
266
|
+
readonly requireEntityTypes?: boolean;
|
|
267
|
+
}
|
|
268
|
+
interface KnowledgeGraphCursor {
|
|
269
|
+
readonly evaluation: number;
|
|
270
|
+
readonly validAssertions: number;
|
|
271
|
+
readonly invalidAssertions: number;
|
|
272
|
+
readonly entityCount: number;
|
|
273
|
+
readonly relationCount: number;
|
|
274
|
+
readonly predicateCount: number;
|
|
275
|
+
}
|
|
276
|
+
type KnowledgeGraphStatusState = "ready" | "empty" | "partial" | "error";
|
|
277
|
+
interface KnowledgeGraphStatus {
|
|
278
|
+
readonly state: KnowledgeGraphStatusState;
|
|
279
|
+
readonly cursor: KnowledgeGraphCursor;
|
|
280
|
+
}
|
|
281
|
+
type KnowledgeGraphErrorCode = "invalid-assertions-input" | "invalid-assertion" | "duplicate-assertion-id" | "invalid-policy" | "policy-conflict";
|
|
282
|
+
interface KnowledgeGraphError {
|
|
283
|
+
readonly code: KnowledgeGraphErrorCode;
|
|
284
|
+
readonly message: string;
|
|
285
|
+
readonly index?: number;
|
|
286
|
+
readonly assertionId?: FactId;
|
|
287
|
+
readonly assertion?: unknown;
|
|
288
|
+
readonly validationErrors?: readonly string[];
|
|
289
|
+
readonly cursor: KnowledgeGraphCursor;
|
|
290
|
+
}
|
|
291
|
+
interface KnowledgeGraphSnapshot {
|
|
292
|
+
readonly assertions: readonly KnowledgeAssertion[];
|
|
293
|
+
readonly entities: readonly KnowledgeGraphEntity[];
|
|
294
|
+
readonly relations: readonly KnowledgeGraphRelation[];
|
|
295
|
+
readonly topics: readonly KnowledgeGraphTopic[];
|
|
296
|
+
readonly index: KnowledgeGraphIndex;
|
|
297
|
+
readonly status: KnowledgeGraphStatus;
|
|
298
|
+
readonly errors: readonly KnowledgeGraphError[];
|
|
299
|
+
readonly cursor: KnowledgeGraphCursor;
|
|
300
|
+
}
|
|
301
|
+
interface KnowledgeGraphReducerBundle {
|
|
302
|
+
readonly input: {
|
|
303
|
+
readonly assertions: Node<readonly unknown[]>;
|
|
304
|
+
readonly policy?: Node<KnowledgeGraphPolicy>;
|
|
305
|
+
};
|
|
306
|
+
readonly snapshot: Node<KnowledgeGraphSnapshot>;
|
|
307
|
+
readonly assertions: Node<readonly KnowledgeAssertion[]>;
|
|
308
|
+
readonly entities: Node<readonly KnowledgeGraphEntity[]>;
|
|
309
|
+
readonly relations: Node<readonly KnowledgeGraphRelation[]>;
|
|
310
|
+
readonly topics: Node<readonly KnowledgeGraphTopic[]>;
|
|
311
|
+
readonly index: Node<KnowledgeGraphIndex>;
|
|
312
|
+
readonly status: Node<KnowledgeGraphStatus>;
|
|
313
|
+
readonly errors: Node<readonly KnowledgeGraphError[]>;
|
|
314
|
+
readonly cursor: Node<KnowledgeGraphCursor>;
|
|
315
|
+
}
|
|
316
|
+
interface KnowledgeGraphReducerBundleOptions {
|
|
317
|
+
readonly name?: string;
|
|
318
|
+
readonly assertions: Node<readonly unknown[]>;
|
|
319
|
+
readonly policy?: Node<KnowledgeGraphPolicy>;
|
|
320
|
+
}
|
|
321
|
+
interface MemoryRetrievalBundle<T = unknown> {
|
|
322
|
+
readonly input: {
|
|
323
|
+
readonly fragments: Node<readonly unknown[]>;
|
|
324
|
+
readonly query: Node<MemoryRetrievalQuery>;
|
|
325
|
+
};
|
|
326
|
+
readonly snapshot: Node<MemoryRetrievalSnapshot<T>>;
|
|
327
|
+
readonly fragments: Node<readonly MemoryFragment<T>[]>;
|
|
328
|
+
readonly indexed: Node<MemoryRetrievalIndex<T>>;
|
|
329
|
+
readonly ranked: Node<MemoryAnswer<T>>;
|
|
330
|
+
readonly status: Node<MemoryRetrievalStatus>;
|
|
331
|
+
readonly errors: Node<readonly MemoryRetrievalError[]>;
|
|
332
|
+
readonly cursor: Node<MemoryRetrievalCursor>;
|
|
333
|
+
}
|
|
334
|
+
interface MemoryRetrievalBundleOptions {
|
|
335
|
+
readonly name?: string;
|
|
336
|
+
readonly fragments: Node<readonly unknown[]>;
|
|
337
|
+
readonly query: Node<MemoryRetrievalQuery>;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Build a graph-visible memory retrieval bundle from explicit fragment/query deps.
|
|
341
|
+
*
|
|
342
|
+
* Invalid fragments and ranking status are emitted as ordinary DATA facts. The
|
|
343
|
+
* bundle never owns storage restore or hidden mutation; callers that need
|
|
344
|
+
* persistence compose D161 collection/storage sidecars outside this pattern.
|
|
345
|
+
*/
|
|
346
|
+
declare function memoryRetrievalBundle<T = unknown>(graph: Graph, opts: MemoryRetrievalBundleOptions): MemoryRetrievalBundle<T>;
|
|
347
|
+
/**
|
|
348
|
+
* D170 lower semantic-memory KG materializer.
|
|
349
|
+
*
|
|
350
|
+
* Assertion, entity, relation, and topic ids remain DATA keys. The bundle has
|
|
351
|
+
* static describe-visible topology and owns no storage, LLM extraction,
|
|
352
|
+
* scheduler, agent runtime, or dynamic graph node lifecycle.
|
|
353
|
+
*/
|
|
354
|
+
declare function knowledgeGraphReducerBundle(graph: Graph, opts: KnowledgeGraphReducerBundleOptions): KnowledgeGraphReducerBundle;
|
|
355
|
+
|
|
356
|
+
export { type VectorSearchResult as $, type AdmissionFilter as A, type MemoryRetrievalBundle as B, type CollectionEntry as C, type DecayPolicy as D, type MemoryRetrievalBundleOptions as E, type FactId as F, type MemoryRetrievalCursor as G, type MemoryRetrievalError as H, type MemoryRetrievalErrorCode as I, type MemoryRetrievalFact as J, type KnowledgeAssertion as K, type MemoryRetrievalIndex as L, type MemoryAnswer as M, type MemoryRetrievalQuery as N, type MemoryRetrievalSnapshot as O, type MemoryRetrievalStatus as P, type MemoryRetrievalStatusState as Q, type OutcomeSignal as R, type RankedCollectionEntry as S, type RetrievalEntry as T, type RetrievalQuery as U, type RetrievalTrace as V, type ScoringPolicy as W, type ShardByTenantConfig as X, type ShardByTenantOptions as Y, type ShardKey as Z, type StoreReadHandle as _, type KnowledgeAssertionObject as a, admissionFilter3D as a0, admissionScored as a1, cosineSimilarity as a2, filterMemoryFragments as a3, isMemoryFragment as a4, memoryFragmentMatchesQuery as a5, memoryFragmentValidAt as a6, memoryRetrievalBundle as a7, shardByTenant as a8, validateMemoryFragment as a9, type KnowledgeAssertionStrictJsonValue as b, type KnowledgeAssertionSubject as c, type KnowledgeGraphCursor as d, type KnowledgeGraphEntity as e, type KnowledgeGraphError as f, type KnowledgeGraphErrorCode as g, type KnowledgeGraphIndex as h, type KnowledgeGraphPolicy as i, type KnowledgeGraphReducerBundle as j, type KnowledgeGraphReducerBundleOptions as k, type KnowledgeGraphRelation as l, type KnowledgeGraphSnapshot as m, type KnowledgeGraphStatus as n, type KnowledgeGraphStatusState as o, type KnowledgeGraphTopic as p, knowledgeGraphReducerBundle as q, type AdmissionScore3DOptions as r, type AdmissionScoredOptions as s, type AdmissionScores as t, type AdmissionThresholds as u, type CollectionScoreFn as v, type FactStore as w, type MemoryFragment as x, type MemoryFragmentValidation as y, type MemoryQuery as z };
|