@warmdrift/kgauto-compiler 2.0.0-alpha.10

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.
@@ -0,0 +1,95 @@
1
+ // src/dialect.ts
2
+ var DIALECT_VERSION = "v1";
3
+ var INTENT_ARCHETYPES = {
4
+ ask: {
5
+ name: "ask",
6
+ description: "Filter, search, or interrogate existing data",
7
+ examples: ["filter creators by criteria", "find docs matching query", "lookup a record"]
8
+ },
9
+ hunt: {
10
+ name: "hunt",
11
+ description: "Discover new entities not in the current dataset",
12
+ examples: ["find new prospects", "crawl for unindexed sources", "expand a seed list"]
13
+ },
14
+ classify: {
15
+ name: "classify",
16
+ description: "Assign a category from a finite set",
17
+ examples: ["intent detection", "sentiment", "route-to-team"]
18
+ },
19
+ summarize: {
20
+ name: "summarize",
21
+ description: "Compress text or data while preserving meaning",
22
+ examples: ["dashboard insight", "meeting notes", "briefing"]
23
+ },
24
+ generate: {
25
+ name: "generate",
26
+ description: "Produce new content from a prompt or template",
27
+ examples: ["draft email", "create marketing copy", "co-founder conversation"]
28
+ },
29
+ extract: {
30
+ name: "extract",
31
+ description: "Pull structured data from unstructured input",
32
+ examples: ["parse invoice", "extract entities", "transcript \u2192 action items"]
33
+ },
34
+ plan: {
35
+ name: "plan",
36
+ description: "Multi-step decomposition of a goal",
37
+ examples: ["build a roadmap", "sequence tasks", "break a feature into steps"]
38
+ },
39
+ critique: {
40
+ name: "critique",
41
+ description: "Quality assessment, review, or scoring",
42
+ examples: ["code review", "design feedback", "oracle judgment"]
43
+ },
44
+ transform: {
45
+ name: "transform",
46
+ description: "Change format or style while preserving content",
47
+ examples: ["markdown \u2192 html", "formal \u2192 casual", "translate"]
48
+ }
49
+ };
50
+ var ALL_ARCHETYPES = Object.keys(INTENT_ARCHETYPES);
51
+ function isArchetype(name) {
52
+ return name in INTENT_ARCHETYPES;
53
+ }
54
+ function bucketContext(tokens) {
55
+ if (tokens < 1e3) return "tiny";
56
+ if (tokens < 4e3) return "small";
57
+ if (tokens < 16e3) return "medium";
58
+ if (tokens < 64e3) return "large";
59
+ return "huge";
60
+ }
61
+ function bucketToolCount(count) {
62
+ if (count === 0) return "none";
63
+ if (count <= 5) return "few";
64
+ if (count <= 20) return "many";
65
+ return "massive";
66
+ }
67
+ function bucketHistory(turnCount) {
68
+ if (turnCount <= 1) return "single_turn";
69
+ if (turnCount <= 6) return "short";
70
+ return "long";
71
+ }
72
+ function hashShape(s) {
73
+ return [
74
+ s.contextBucket,
75
+ s.toolCountBucket,
76
+ s.historyDepth,
77
+ s.outputMode,
78
+ s.hasExamples ? "ex" : "no_ex"
79
+ ].join("-");
80
+ }
81
+ function learningKey(archetype, model, shape) {
82
+ return `${DIALECT_VERSION}::${archetype}::${model}::${hashShape(shape)}`;
83
+ }
84
+
85
+ export {
86
+ DIALECT_VERSION,
87
+ INTENT_ARCHETYPES,
88
+ ALL_ARCHETYPES,
89
+ isArchetype,
90
+ bucketContext,
91
+ bucketToolCount,
92
+ bucketHistory,
93
+ hashShape,
94
+ learningKey
95
+ };
@@ -0,0 +1,99 @@
1
+ /**
2
+ * kgauto dialect-v1 — the cross-app vocabulary.
3
+ *
4
+ * For learnings to flow between apps, every app must speak the same vocabulary
5
+ * about (a) what kind of work it's asking for and (b) the rough shape of the
6
+ * call. This file is that vocabulary. It is versioned.
7
+ *
8
+ * Two primitives:
9
+ * - IntentArchetype: WHAT the call is doing (semantic category)
10
+ * - ShapeSignature: HOW the call is shaped (size, tools, history, output)
11
+ *
12
+ * The brain learns by `(archetype, model, shape)` tuples. Apps that declare
13
+ * the same tuple inherit each other's mutations.
14
+ *
15
+ * v1 is intentionally small (9 archetypes, 5 shape dimensions). New entries
16
+ * arrive in v2/v3 from real usage signals — never speculatively.
17
+ */
18
+ declare const DIALECT_VERSION: "v1";
19
+ declare const INTENT_ARCHETYPES: {
20
+ readonly ask: {
21
+ readonly name: "ask";
22
+ readonly description: "Filter, search, or interrogate existing data";
23
+ readonly examples: ["filter creators by criteria", "find docs matching query", "lookup a record"];
24
+ };
25
+ readonly hunt: {
26
+ readonly name: "hunt";
27
+ readonly description: "Discover new entities not in the current dataset";
28
+ readonly examples: ["find new prospects", "crawl for unindexed sources", "expand a seed list"];
29
+ };
30
+ readonly classify: {
31
+ readonly name: "classify";
32
+ readonly description: "Assign a category from a finite set";
33
+ readonly examples: ["intent detection", "sentiment", "route-to-team"];
34
+ };
35
+ readonly summarize: {
36
+ readonly name: "summarize";
37
+ readonly description: "Compress text or data while preserving meaning";
38
+ readonly examples: ["dashboard insight", "meeting notes", "briefing"];
39
+ };
40
+ readonly generate: {
41
+ readonly name: "generate";
42
+ readonly description: "Produce new content from a prompt or template";
43
+ readonly examples: ["draft email", "create marketing copy", "co-founder conversation"];
44
+ };
45
+ readonly extract: {
46
+ readonly name: "extract";
47
+ readonly description: "Pull structured data from unstructured input";
48
+ readonly examples: ["parse invoice", "extract entities", "transcript → action items"];
49
+ };
50
+ readonly plan: {
51
+ readonly name: "plan";
52
+ readonly description: "Multi-step decomposition of a goal";
53
+ readonly examples: ["build a roadmap", "sequence tasks", "break a feature into steps"];
54
+ };
55
+ readonly critique: {
56
+ readonly name: "critique";
57
+ readonly description: "Quality assessment, review, or scoring";
58
+ readonly examples: ["code review", "design feedback", "oracle judgment"];
59
+ };
60
+ readonly transform: {
61
+ readonly name: "transform";
62
+ readonly description: "Change format or style while preserving content";
63
+ readonly examples: ["markdown → html", "formal → casual", "translate"];
64
+ };
65
+ };
66
+ type IntentArchetypeName = keyof typeof INTENT_ARCHETYPES;
67
+ declare const ALL_ARCHETYPES: IntentArchetypeName[];
68
+ declare function isArchetype(name: string): name is IntentArchetypeName;
69
+ type ContextBucket = 'tiny' | 'small' | 'medium' | 'large' | 'huge';
70
+ type ToolCountBucket = 'none' | 'few' | 'many' | 'massive';
71
+ type HistoryDepth = 'single_turn' | 'short' | 'long';
72
+ type OutputMode = 'text' | 'json' | 'tool_call';
73
+ interface ShapeSignature {
74
+ /** Log-binned input token count. */
75
+ contextBucket: ContextBucket;
76
+ /** Tool count bucket. */
77
+ toolCountBucket: ToolCountBucket;
78
+ /** Conversation depth. */
79
+ historyDepth: HistoryDepth;
80
+ /** Expected output shape. */
81
+ outputMode: OutputMode;
82
+ /** Whether the prompt includes few-shot examples. */
83
+ hasExamples: boolean;
84
+ }
85
+ declare function bucketContext(tokens: number): ContextBucket;
86
+ declare function bucketToolCount(count: number): ToolCountBucket;
87
+ declare function bucketHistory(turnCount: number): HistoryDepth;
88
+ /**
89
+ * Hash a shape signature into a compact string key. Stable across runs.
90
+ * Format: `<context>-<tools>-<history>-<output>-<examples>`.
91
+ */
92
+ declare function hashShape(s: ShapeSignature): string;
93
+ /**
94
+ * Compose the full learning key. This is what the brain learns by — a tuple
95
+ * any app can produce and any app can benefit from.
96
+ */
97
+ declare function learningKey(archetype: IntentArchetypeName, model: string, shape: ShapeSignature): string;
98
+
99
+ export { ALL_ARCHETYPES, type ContextBucket, DIALECT_VERSION, type HistoryDepth, INTENT_ARCHETYPES, type IntentArchetypeName, type OutputMode, type ShapeSignature, type ToolCountBucket, bucketContext, bucketHistory, bucketToolCount, hashShape, isArchetype, learningKey };
@@ -0,0 +1,99 @@
1
+ /**
2
+ * kgauto dialect-v1 — the cross-app vocabulary.
3
+ *
4
+ * For learnings to flow between apps, every app must speak the same vocabulary
5
+ * about (a) what kind of work it's asking for and (b) the rough shape of the
6
+ * call. This file is that vocabulary. It is versioned.
7
+ *
8
+ * Two primitives:
9
+ * - IntentArchetype: WHAT the call is doing (semantic category)
10
+ * - ShapeSignature: HOW the call is shaped (size, tools, history, output)
11
+ *
12
+ * The brain learns by `(archetype, model, shape)` tuples. Apps that declare
13
+ * the same tuple inherit each other's mutations.
14
+ *
15
+ * v1 is intentionally small (9 archetypes, 5 shape dimensions). New entries
16
+ * arrive in v2/v3 from real usage signals — never speculatively.
17
+ */
18
+ declare const DIALECT_VERSION: "v1";
19
+ declare const INTENT_ARCHETYPES: {
20
+ readonly ask: {
21
+ readonly name: "ask";
22
+ readonly description: "Filter, search, or interrogate existing data";
23
+ readonly examples: ["filter creators by criteria", "find docs matching query", "lookup a record"];
24
+ };
25
+ readonly hunt: {
26
+ readonly name: "hunt";
27
+ readonly description: "Discover new entities not in the current dataset";
28
+ readonly examples: ["find new prospects", "crawl for unindexed sources", "expand a seed list"];
29
+ };
30
+ readonly classify: {
31
+ readonly name: "classify";
32
+ readonly description: "Assign a category from a finite set";
33
+ readonly examples: ["intent detection", "sentiment", "route-to-team"];
34
+ };
35
+ readonly summarize: {
36
+ readonly name: "summarize";
37
+ readonly description: "Compress text or data while preserving meaning";
38
+ readonly examples: ["dashboard insight", "meeting notes", "briefing"];
39
+ };
40
+ readonly generate: {
41
+ readonly name: "generate";
42
+ readonly description: "Produce new content from a prompt or template";
43
+ readonly examples: ["draft email", "create marketing copy", "co-founder conversation"];
44
+ };
45
+ readonly extract: {
46
+ readonly name: "extract";
47
+ readonly description: "Pull structured data from unstructured input";
48
+ readonly examples: ["parse invoice", "extract entities", "transcript → action items"];
49
+ };
50
+ readonly plan: {
51
+ readonly name: "plan";
52
+ readonly description: "Multi-step decomposition of a goal";
53
+ readonly examples: ["build a roadmap", "sequence tasks", "break a feature into steps"];
54
+ };
55
+ readonly critique: {
56
+ readonly name: "critique";
57
+ readonly description: "Quality assessment, review, or scoring";
58
+ readonly examples: ["code review", "design feedback", "oracle judgment"];
59
+ };
60
+ readonly transform: {
61
+ readonly name: "transform";
62
+ readonly description: "Change format or style while preserving content";
63
+ readonly examples: ["markdown → html", "formal → casual", "translate"];
64
+ };
65
+ };
66
+ type IntentArchetypeName = keyof typeof INTENT_ARCHETYPES;
67
+ declare const ALL_ARCHETYPES: IntentArchetypeName[];
68
+ declare function isArchetype(name: string): name is IntentArchetypeName;
69
+ type ContextBucket = 'tiny' | 'small' | 'medium' | 'large' | 'huge';
70
+ type ToolCountBucket = 'none' | 'few' | 'many' | 'massive';
71
+ type HistoryDepth = 'single_turn' | 'short' | 'long';
72
+ type OutputMode = 'text' | 'json' | 'tool_call';
73
+ interface ShapeSignature {
74
+ /** Log-binned input token count. */
75
+ contextBucket: ContextBucket;
76
+ /** Tool count bucket. */
77
+ toolCountBucket: ToolCountBucket;
78
+ /** Conversation depth. */
79
+ historyDepth: HistoryDepth;
80
+ /** Expected output shape. */
81
+ outputMode: OutputMode;
82
+ /** Whether the prompt includes few-shot examples. */
83
+ hasExamples: boolean;
84
+ }
85
+ declare function bucketContext(tokens: number): ContextBucket;
86
+ declare function bucketToolCount(count: number): ToolCountBucket;
87
+ declare function bucketHistory(turnCount: number): HistoryDepth;
88
+ /**
89
+ * Hash a shape signature into a compact string key. Stable across runs.
90
+ * Format: `<context>-<tools>-<history>-<output>-<examples>`.
91
+ */
92
+ declare function hashShape(s: ShapeSignature): string;
93
+ /**
94
+ * Compose the full learning key. This is what the brain learns by — a tuple
95
+ * any app can produce and any app can benefit from.
96
+ */
97
+ declare function learningKey(archetype: IntentArchetypeName, model: string, shape: ShapeSignature): string;
98
+
99
+ export { ALL_ARCHETYPES, type ContextBucket, DIALECT_VERSION, type HistoryDepth, INTENT_ARCHETYPES, type IntentArchetypeName, type OutputMode, type ShapeSignature, type ToolCountBucket, bucketContext, bucketHistory, bucketToolCount, hashShape, isArchetype, learningKey };
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/dialect.ts
21
+ var dialect_exports = {};
22
+ __export(dialect_exports, {
23
+ ALL_ARCHETYPES: () => ALL_ARCHETYPES,
24
+ DIALECT_VERSION: () => DIALECT_VERSION,
25
+ INTENT_ARCHETYPES: () => INTENT_ARCHETYPES,
26
+ bucketContext: () => bucketContext,
27
+ bucketHistory: () => bucketHistory,
28
+ bucketToolCount: () => bucketToolCount,
29
+ hashShape: () => hashShape,
30
+ isArchetype: () => isArchetype,
31
+ learningKey: () => learningKey
32
+ });
33
+ module.exports = __toCommonJS(dialect_exports);
34
+ var DIALECT_VERSION = "v1";
35
+ var INTENT_ARCHETYPES = {
36
+ ask: {
37
+ name: "ask",
38
+ description: "Filter, search, or interrogate existing data",
39
+ examples: ["filter creators by criteria", "find docs matching query", "lookup a record"]
40
+ },
41
+ hunt: {
42
+ name: "hunt",
43
+ description: "Discover new entities not in the current dataset",
44
+ examples: ["find new prospects", "crawl for unindexed sources", "expand a seed list"]
45
+ },
46
+ classify: {
47
+ name: "classify",
48
+ description: "Assign a category from a finite set",
49
+ examples: ["intent detection", "sentiment", "route-to-team"]
50
+ },
51
+ summarize: {
52
+ name: "summarize",
53
+ description: "Compress text or data while preserving meaning",
54
+ examples: ["dashboard insight", "meeting notes", "briefing"]
55
+ },
56
+ generate: {
57
+ name: "generate",
58
+ description: "Produce new content from a prompt or template",
59
+ examples: ["draft email", "create marketing copy", "co-founder conversation"]
60
+ },
61
+ extract: {
62
+ name: "extract",
63
+ description: "Pull structured data from unstructured input",
64
+ examples: ["parse invoice", "extract entities", "transcript \u2192 action items"]
65
+ },
66
+ plan: {
67
+ name: "plan",
68
+ description: "Multi-step decomposition of a goal",
69
+ examples: ["build a roadmap", "sequence tasks", "break a feature into steps"]
70
+ },
71
+ critique: {
72
+ name: "critique",
73
+ description: "Quality assessment, review, or scoring",
74
+ examples: ["code review", "design feedback", "oracle judgment"]
75
+ },
76
+ transform: {
77
+ name: "transform",
78
+ description: "Change format or style while preserving content",
79
+ examples: ["markdown \u2192 html", "formal \u2192 casual", "translate"]
80
+ }
81
+ };
82
+ var ALL_ARCHETYPES = Object.keys(INTENT_ARCHETYPES);
83
+ function isArchetype(name) {
84
+ return name in INTENT_ARCHETYPES;
85
+ }
86
+ function bucketContext(tokens) {
87
+ if (tokens < 1e3) return "tiny";
88
+ if (tokens < 4e3) return "small";
89
+ if (tokens < 16e3) return "medium";
90
+ if (tokens < 64e3) return "large";
91
+ return "huge";
92
+ }
93
+ function bucketToolCount(count) {
94
+ if (count === 0) return "none";
95
+ if (count <= 5) return "few";
96
+ if (count <= 20) return "many";
97
+ return "massive";
98
+ }
99
+ function bucketHistory(turnCount) {
100
+ if (turnCount <= 1) return "single_turn";
101
+ if (turnCount <= 6) return "short";
102
+ return "long";
103
+ }
104
+ function hashShape(s) {
105
+ return [
106
+ s.contextBucket,
107
+ s.toolCountBucket,
108
+ s.historyDepth,
109
+ s.outputMode,
110
+ s.hasExamples ? "ex" : "no_ex"
111
+ ].join("-");
112
+ }
113
+ function learningKey(archetype, model, shape) {
114
+ return `${DIALECT_VERSION}::${archetype}::${model}::${hashShape(shape)}`;
115
+ }
116
+ // Annotate the CommonJS export names for ESM import in node:
117
+ 0 && (module.exports = {
118
+ ALL_ARCHETYPES,
119
+ DIALECT_VERSION,
120
+ INTENT_ARCHETYPES,
121
+ bucketContext,
122
+ bucketHistory,
123
+ bucketToolCount,
124
+ hashShape,
125
+ isArchetype,
126
+ learningKey
127
+ });
@@ -0,0 +1,22 @@
1
+ import {
2
+ ALL_ARCHETYPES,
3
+ DIALECT_VERSION,
4
+ INTENT_ARCHETYPES,
5
+ bucketContext,
6
+ bucketHistory,
7
+ bucketToolCount,
8
+ hashShape,
9
+ isArchetype,
10
+ learningKey
11
+ } from "./chunk-5TI6PNSK.mjs";
12
+ export {
13
+ ALL_ARCHETYPES,
14
+ DIALECT_VERSION,
15
+ INTENT_ARCHETYPES,
16
+ bucketContext,
17
+ bucketHistory,
18
+ bucketToolCount,
19
+ hashShape,
20
+ isArchetype,
21
+ learningKey
22
+ };