@lokascript/framework 2.0.0 → 2.1.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/dist/aot/index.d.ts +1 -0
- package/dist/aot/index.d.ts.map +1 -1
- package/dist/aot/registry-bridge.d.ts +27 -0
- package/dist/aot/registry-bridge.d.ts.map +1 -0
- package/dist/api/create-dsl.d.ts.map +1 -1
- package/dist/api/dispatcher.d.ts +22 -0
- package/dist/api/dispatcher.d.ts.map +1 -1
- package/dist/api/domain-registry.d.ts +41 -0
- package/dist/api/domain-registry.d.ts.map +1 -1
- package/dist/api/index.js +1351 -21
- package/dist/api/index.js.map +1 -1
- package/dist/core/index.js +114 -10
- package/dist/core/index.js.map +1 -1
- package/dist/core/pattern-matching/index.js +74 -10
- package/dist/core/pattern-matching/index.js.map +1 -1
- package/dist/core/pattern-matching/pattern-matcher.d.ts.map +1 -1
- package/dist/core/types.d.ts +80 -2
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +40 -0
- package/dist/core/types.js.map +1 -1
- package/dist/feedback/confidence-gate.d.ts +28 -0
- package/dist/feedback/confidence-gate.d.ts.map +1 -0
- package/dist/feedback/feedback-formatter.d.ts +21 -0
- package/dist/feedback/feedback-formatter.d.ts.map +1 -0
- package/dist/feedback/index.d.ts +11 -0
- package/dist/feedback/index.d.ts.map +1 -0
- package/dist/feedback/pattern-tracker.d.ts +47 -0
- package/dist/feedback/pattern-tracker.d.ts.map +1 -0
- package/dist/feedback/types.d.ts +113 -0
- package/dist/feedback/types.d.ts.map +1 -0
- package/dist/generation/index.js +2 -1
- package/dist/generation/index.js.map +1 -1
- package/dist/index.cjs +2685 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2652 -71
- package/dist/index.js.map +1 -1
- package/dist/ir/explicit-parser.d.ts +31 -0
- package/dist/ir/explicit-parser.d.ts.map +1 -0
- package/dist/ir/explicit-renderer.d.ts +17 -0
- package/dist/ir/explicit-renderer.d.ts.map +1 -0
- package/dist/ir/from-interchange.d.ts +51 -0
- package/dist/ir/from-interchange.d.ts.map +1 -0
- package/dist/ir/index.d.ts +29 -0
- package/dist/ir/index.d.ts.map +1 -0
- package/dist/ir/index.js +1557 -0
- package/dist/ir/index.js.map +1 -0
- package/dist/ir/json-schema.d.ts +40 -0
- package/dist/ir/json-schema.d.ts.map +1 -0
- package/dist/ir/protocol-json.d.ts +73 -0
- package/dist/ir/protocol-json.d.ts.map +1 -0
- package/dist/ir/references.d.ts +19 -0
- package/dist/ir/references.d.ts.map +1 -0
- package/dist/ir/types.d.ts +141 -0
- package/dist/ir/types.d.ts.map +1 -0
- package/dist/parsing/index.js +74 -10
- package/dist/parsing/index.js.map +1 -1
- package/dist/prompts/index.d.ts +9 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/prompt-generator.d.ts +49 -0
- package/dist/prompts/prompt-generator.d.ts.map +1 -0
- package/dist/prompts/types.d.ts +64 -0
- package/dist/prompts/types.d.ts.map +1 -0
- package/dist/schema/command-schema.d.ts +17 -0
- package/dist/schema/command-schema.d.ts.map +1 -1
- package/dist/schema/index.js.map +1 -1
- package/dist/testing/index.js +3 -0
- package/dist/testing/index.js.map +1 -1
- package/dist/training/index.d.ts +11 -0
- package/dist/training/index.d.ts.map +1 -0
- package/dist/training/jsonl-writer.d.ts +42 -0
- package/dist/training/jsonl-writer.d.ts.map +1 -0
- package/dist/training/schema-synthesizer.d.ts +20 -0
- package/dist/training/schema-synthesizer.d.ts.map +1 -0
- package/dist/training/types.d.ts +73 -0
- package/dist/training/types.d.ts.map +1 -0
- package/package.json +5 -1
- package/src/aot/index.ts +1 -0
- package/src/aot/registry-bridge.test.ts +104 -0
- package/src/aot/registry-bridge.ts +66 -0
- package/src/api/create-dsl.test.ts +306 -0
- package/src/api/create-dsl.ts +21 -0
- package/src/api/dispatcher.test.ts +66 -0
- package/src/api/dispatcher.ts +77 -9
- package/src/api/domain-registry.ts +120 -4
- package/src/core/pattern-matching/pattern-matcher.test.ts +131 -0
- package/src/core/pattern-matching/pattern-matcher.ts +102 -19
- package/src/core/types.ts +145 -2
- package/src/feedback/confidence-gate.test.ts +111 -0
- package/src/feedback/confidence-gate.ts +70 -0
- package/src/feedback/feedback-formatter.test.ts +198 -0
- package/src/feedback/feedback-formatter.ts +298 -0
- package/src/feedback/index.ts +24 -0
- package/src/feedback/pattern-tracker.test.ts +198 -0
- package/src/feedback/pattern-tracker.ts +140 -0
- package/src/feedback/types.ts +149 -0
- package/src/generation/pattern-generator.ts +2 -2
- package/src/index.ts +22 -0
- package/src/integration/llm-lse-integration.test.ts +457 -0
- package/src/ir/explicit-parser.test.ts +306 -0
- package/src/ir/explicit-parser.ts +419 -0
- package/src/ir/explicit-renderer.test.ts +144 -0
- package/src/ir/explicit-renderer.ts +146 -0
- package/src/ir/from-interchange.test.ts +853 -0
- package/src/ir/from-interchange.ts +594 -0
- package/src/ir/index.ts +66 -0
- package/src/ir/json-schema.test.ts +281 -0
- package/src/ir/json-schema.ts +299 -0
- package/src/ir/protocol-json.test.ts +1185 -0
- package/src/ir/protocol-json.ts +745 -0
- package/src/ir/references.test.ts +38 -0
- package/src/ir/references.ts +33 -0
- package/src/ir/round-trip.test.ts +557 -0
- package/src/ir/types.ts +181 -0
- package/src/prompts/index.ts +15 -0
- package/src/prompts/prompt-generator.test.ts +386 -0
- package/src/prompts/prompt-generator.ts +531 -0
- package/src/prompts/types.ts +89 -0
- package/src/schema/command-schema.ts +19 -0
- package/src/training/index.ts +13 -0
- package/src/training/jsonl-writer.test.ts +138 -0
- package/src/training/jsonl-writer.ts +67 -0
- package/src/training/schema-synthesizer.test.ts +250 -0
- package/src/training/schema-synthesizer.ts +306 -0
- package/src/training/types.ts +103 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM Prompt Generation
|
|
3
|
+
*
|
|
4
|
+
* Auto-generates system prompts from CommandSchema[] for teaching LLMs
|
|
5
|
+
* to output valid LokaScript Explicit Syntax.
|
|
6
|
+
*/
|
|
7
|
+
export type { PromptGeneratorConfig, GeneratedPrompt, PromptSection, PromptMetadata, } from './types';
|
|
8
|
+
export { generatePrompt, generateExamples, generateProtocolReference } from './prompt-generator';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EACV,qBAAqB,EACrB,eAAe,EACf,aAAa,EACb,cAAc,GACf,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM Prompt Generator
|
|
3
|
+
*
|
|
4
|
+
* Auto-generates LLM system prompts from CommandSchema[]. Given a set of
|
|
5
|
+
* domain schemas, produces a structured markdown prompt that teaches LLMs
|
|
6
|
+
* to output valid LSE bracket syntax and/or LLM-simplified JSON.
|
|
7
|
+
*
|
|
8
|
+
* The generated prompt includes:
|
|
9
|
+
* - Protocol overview (LSE syntax summary)
|
|
10
|
+
* - Value type reference
|
|
11
|
+
* - Per-command documentation with role descriptions
|
|
12
|
+
* - Synthetic examples in both formats
|
|
13
|
+
* - Output format specification
|
|
14
|
+
* - Error recovery instructions
|
|
15
|
+
*/
|
|
16
|
+
import type { CommandSchema } from '../schema/command-schema';
|
|
17
|
+
import type { SemanticJSON } from '../ir/types';
|
|
18
|
+
import type { PromptGeneratorConfig, GeneratedPrompt } from './types';
|
|
19
|
+
/**
|
|
20
|
+
* Generate an LLM system prompt from domain command schemas.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import { generatePrompt } from '@lokascript/framework';
|
|
25
|
+
* import { allSchemas } from '@lokascript/domain-flow';
|
|
26
|
+
*
|
|
27
|
+
* const prompt = generatePrompt({
|
|
28
|
+
* domain: 'flow',
|
|
29
|
+
* description: 'Reactive data flow pipelines',
|
|
30
|
+
* schemas: allSchemas,
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* console.log(prompt.text); // Full markdown system prompt
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function generatePrompt(config: PromptGeneratorConfig): GeneratedPrompt;
|
|
37
|
+
/**
|
|
38
|
+
* Generate synthetic LSE examples from a single command schema.
|
|
39
|
+
* Used by both the prompt generator and training data synthesizer.
|
|
40
|
+
*/
|
|
41
|
+
export declare function generateExamples(schema: CommandSchema, count?: number): Array<{
|
|
42
|
+
explicit: string;
|
|
43
|
+
json: SemanticJSON;
|
|
44
|
+
}>;
|
|
45
|
+
/**
|
|
46
|
+
* Generate a condensed LSE protocol reference (for MCP resources).
|
|
47
|
+
*/
|
|
48
|
+
export declare function generateProtocolReference(): string;
|
|
49
|
+
//# sourceMappingURL=prompt-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-generator.d.ts","sourceRoot":"","sources":["../../src/prompts/prompt-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,0BAA0B,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAqB,MAAM,aAAa,CAAC;AAGnE,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EAGhB,MAAM,SAAS,CAAC;AAMjB;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,qBAAqB,GAAG,eAAe,CA+B7E;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,aAAa,EACrB,KAAK,GAAE,MAAU,GAChB,KAAK,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,YAAY,CAAA;CAAE,CAAC,CA0CjD;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAIlD"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM Prompt Generation Types
|
|
3
|
+
*
|
|
4
|
+
* Types for auto-generating LLM system prompts from CommandSchema[].
|
|
5
|
+
* The prompt generator reads domain schemas and produces markdown
|
|
6
|
+
* instructions that teach LLMs to output valid LSE bracket syntax
|
|
7
|
+
* and/or LLM-simplified JSON.
|
|
8
|
+
*/
|
|
9
|
+
import type { CommandSchema } from '../schema/command-schema';
|
|
10
|
+
/**
|
|
11
|
+
* Configuration for generating an LLM system prompt from domain schemas.
|
|
12
|
+
*/
|
|
13
|
+
export interface PromptGeneratorConfig {
|
|
14
|
+
/** Domain identifier (e.g., 'flow', 'sql', 'bdd') */
|
|
15
|
+
readonly domain: string;
|
|
16
|
+
/** Human-readable domain description */
|
|
17
|
+
readonly description: string;
|
|
18
|
+
/** Command schemas to document */
|
|
19
|
+
readonly schemas: readonly CommandSchema[];
|
|
20
|
+
/** What output format to teach the LLM. Default: 'both' */
|
|
21
|
+
readonly outputFormat?: 'explicit' | 'json' | 'both';
|
|
22
|
+
/** Number of examples to generate per command. Default: 2 */
|
|
23
|
+
readonly examplesPerCommand?: number;
|
|
24
|
+
/** Approximate token budget for truncation. Default: no limit */
|
|
25
|
+
readonly maxTokens?: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Section of a generated prompt, for partial inclusion.
|
|
29
|
+
*/
|
|
30
|
+
export interface PromptSection {
|
|
31
|
+
/** Section identifier */
|
|
32
|
+
readonly id: string;
|
|
33
|
+
/** Human-readable title */
|
|
34
|
+
readonly title: string;
|
|
35
|
+
/** Markdown content */
|
|
36
|
+
readonly content: string;
|
|
37
|
+
/** Approximate token count (chars / 4 heuristic) */
|
|
38
|
+
readonly approximateTokens: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A complete generated system prompt with metadata.
|
|
42
|
+
*/
|
|
43
|
+
export interface GeneratedPrompt {
|
|
44
|
+
/** Full system prompt as markdown */
|
|
45
|
+
readonly text: string;
|
|
46
|
+
/** Individual sections for partial inclusion */
|
|
47
|
+
readonly sections: PromptSection[];
|
|
48
|
+
/** Metadata about the generated prompt */
|
|
49
|
+
readonly metadata: PromptMetadata;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Metadata about a generated prompt.
|
|
53
|
+
*/
|
|
54
|
+
export interface PromptMetadata {
|
|
55
|
+
/** Domain the prompt was generated for */
|
|
56
|
+
readonly domain: string;
|
|
57
|
+
/** Number of commands documented */
|
|
58
|
+
readonly commandCount: number;
|
|
59
|
+
/** Total number of roles across all commands */
|
|
60
|
+
readonly roleCount: number;
|
|
61
|
+
/** Approximate token count (chars / 4 heuristic) */
|
|
62
|
+
readonly approximateTokens: number;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/prompts/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAM9D;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,qDAAqD;IACrD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,wCAAwC;IACxC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,kCAAkC;IAClC,QAAQ,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,CAAC;IAE3C,2DAA2D;IAC3D,QAAQ,CAAC,YAAY,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;IAErD,6DAA6D;IAC7D,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAErC,iEAAiE;IACjE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAMD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,yBAAyB;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,2BAA2B;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,uBAAuB;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,oDAAoD;IACpD,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,qCAAqC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,gDAAgD;IAChD,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,CAAC;IAEnC,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,oCAAoC;IACpC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAE9B,gDAAgD;IAChD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,oDAAoD;IACpD,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;CACpC"}
|
|
@@ -55,6 +55,14 @@ export interface RoleSpec {
|
|
|
55
55
|
* Maps language code to the rendering marker.
|
|
56
56
|
*/
|
|
57
57
|
readonly renderOverride?: Record<string, string>;
|
|
58
|
+
/**
|
|
59
|
+
* Override the marker position for this role in the generated pattern.
|
|
60
|
+
* 'before' = marker precedes the role value (preposition: "set X").
|
|
61
|
+
* 'after' = marker follows the role value (postposition: "X から").
|
|
62
|
+
* If not set, falls back to the language profile's roleMarkers position,
|
|
63
|
+
* then to the word-order default (SOV='after', else='before').
|
|
64
|
+
*/
|
|
65
|
+
readonly markerPosition?: 'before' | 'after';
|
|
58
66
|
/**
|
|
59
67
|
* When true, this role captures all remaining tokens until the next
|
|
60
68
|
* recognized marker keyword or end of input, joining their values
|
|
@@ -64,6 +72,15 @@ export interface RoleSpec {
|
|
|
64
72
|
* by a marked role. Default: false.
|
|
65
73
|
*/
|
|
66
74
|
readonly greedy?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Restricts which selector subtypes are valid for this role (v1.2).
|
|
77
|
+
* Only meaningful when expectedTypes includes 'selector'.
|
|
78
|
+
* If omitted, all selector kinds are accepted.
|
|
79
|
+
*
|
|
80
|
+
* Example: `selectorKinds: ['class', 'attribute']` means only `.class`
|
|
81
|
+
* and `[attr]` selectors are valid, not `#id` or `*wildcard`.
|
|
82
|
+
*/
|
|
83
|
+
readonly selectorKinds?: ReadonlyArray<'id' | 'class' | 'attribute' | 'element' | 'complex'>;
|
|
67
84
|
}
|
|
68
85
|
/**
|
|
69
86
|
* Helper to create a command schema with sensible defaults.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-schema.d.ts","sourceRoot":"","sources":["../../src/schema/command-schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE3F;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,qCAAqC;IACrC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAE5B,iCAAiC;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,iCAAiC;IACjC,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC;IAE3B,kDAAkD;IAClD,QAAQ,CAAC,WAAW,EAAE,YAAY,CAAC;IAEnC,2CAA2C;IAC3C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,8EAA8E;IAC9E,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAE3B,4CAA4C;IAC5C,QAAQ,CAAC,KAAK,CAAC,EAAE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,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,aAAa,EAAE,QAAQ,GAAG,OAAO,CAAC,GACvE,aAAa,CASf;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,eAAe,CAAC,GAC9E,QAAQ,CAQV"}
|
package/dist/schema/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/schema/command-schema.ts"],"sourcesContent":["/**\n * Command Schema Types\n *\n * Defines the structure of DSL commands for pattern generation.\n * These schemas are language-neutral and describe the semantic structure\n * of commands rather than their surface syntax.\n */\n\nimport type { ActionType, SemanticRole, SemanticValue, ExpectedType } from '../core/types';\n\n/**\n * Command schema - defines a DSL command's structure.\n */\nexport interface CommandSchema {\n /** The action type (command name) */\n readonly action: ActionType;\n\n /** Human-readable description */\n readonly description: string;\n\n /** Roles this command accepts */\n readonly roles: RoleSpec[];\n\n /** The primary role (what the command acts on) */\n readonly primaryRole: SemanticRole;\n\n /** Category for grouping (DSL-specific) */\n readonly category: string;\n\n /** Whether this command typically has a body (like event handlers, blocks) */\n readonly hasBody?: boolean;\n\n /** Notes about special handling or usage */\n readonly notes?: string;\n}\n\n/**\n * Role specification - defines a semantic role in a command.\n */\nexport interface RoleSpec {\n /** The semantic role */\n readonly role: SemanticRole;\n\n /** Description of what this role represents */\n readonly description: string;\n\n /** Whether this role is required */\n readonly required: boolean;\n\n /** Expected value types */\n readonly expectedTypes: Array<ExpectedType>;\n\n /** Default value if not provided */\n readonly default?: SemanticValue;\n\n /** Position hint for SVO languages (higher = earlier) */\n readonly svoPosition?: number;\n\n /** Position hint for SOV languages (higher = earlier) */\n readonly sovPosition?: number;\n\n /**\n * Override the default role marker for this command.\n * Maps language code to the marker to use (e.g., { en: 'from', ja: 'から' }).\n * If not specified, uses the language profile's default roleMarker.\n */\n readonly markerOverride?: Record<string, string>;\n\n /**\n * Override the rendering marker separately from parsing.\n * Used when the parsing grammar differs from rendered output.\n * Maps language code to the rendering marker.\n */\n readonly renderOverride?: Record<string, string>;\n\n /**\n * When true, this role captures all remaining tokens until the next\n * recognized marker keyword or end of input, joining their values\n * with spaces into a single ExpressionValue.\n *\n * Only meaningful for the last role in a sequence or a role followed\n * by a marked role. Default: false.\n */\n readonly greedy?: boolean;\n}\n\n/**\n * Helper to create a command schema with sensible defaults.\n * Provides defaults for description, category, and primaryRole.\n */\nexport function defineCommand(\n schema: Partial<CommandSchema> & Pick<CommandSchema, 'action' | 'roles'>\n): CommandSchema {\n return {\n description: schema.description || `${schema.action} command`,\n category: schema.category || 'general',\n primaryRole: schema.primaryRole || schema.roles[0]?.role || 'patient',\n ...schema,\n action: schema.action,\n roles: schema.roles,\n } as CommandSchema;\n}\n\n/**\n * Helper to create a role spec with sensible defaults.\n * Provides default for description.\n */\nexport function defineRole(\n role: Partial<RoleSpec> & Pick<RoleSpec, 'role' | 'required' | 'expectedTypes'>\n): RoleSpec {\n return {\n description: role.description || `${role.role} role`,\n ...role,\n role: role.role,\n required: role.required,\n expectedTypes: role.expectedTypes,\n };\n}\n"],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../../src/schema/command-schema.ts"],"sourcesContent":["/**\n * Command Schema Types\n *\n * Defines the structure of DSL commands for pattern generation.\n * These schemas are language-neutral and describe the semantic structure\n * of commands rather than their surface syntax.\n */\n\nimport type { ActionType, SemanticRole, SemanticValue, ExpectedType } from '../core/types';\n\n/**\n * Command schema - defines a DSL command's structure.\n */\nexport interface CommandSchema {\n /** The action type (command name) */\n readonly action: ActionType;\n\n /** Human-readable description */\n readonly description: string;\n\n /** Roles this command accepts */\n readonly roles: RoleSpec[];\n\n /** The primary role (what the command acts on) */\n readonly primaryRole: SemanticRole;\n\n /** Category for grouping (DSL-specific) */\n readonly category: string;\n\n /** Whether this command typically has a body (like event handlers, blocks) */\n readonly hasBody?: boolean;\n\n /** Notes about special handling or usage */\n readonly notes?: string;\n}\n\n/**\n * Role specification - defines a semantic role in a command.\n */\nexport interface RoleSpec {\n /** The semantic role */\n readonly role: SemanticRole;\n\n /** Description of what this role represents */\n readonly description: string;\n\n /** Whether this role is required */\n readonly required: boolean;\n\n /** Expected value types */\n readonly expectedTypes: Array<ExpectedType>;\n\n /** Default value if not provided */\n readonly default?: SemanticValue;\n\n /** Position hint for SVO languages (higher = earlier) */\n readonly svoPosition?: number;\n\n /** Position hint for SOV languages (higher = earlier) */\n readonly sovPosition?: number;\n\n /**\n * Override the default role marker for this command.\n * Maps language code to the marker to use (e.g., { en: 'from', ja: 'から' }).\n * If not specified, uses the language profile's default roleMarker.\n */\n readonly markerOverride?: Record<string, string>;\n\n /**\n * Override the rendering marker separately from parsing.\n * Used when the parsing grammar differs from rendered output.\n * Maps language code to the rendering marker.\n */\n readonly renderOverride?: Record<string, string>;\n\n /**\n * Override the marker position for this role in the generated pattern.\n * 'before' = marker precedes the role value (preposition: \"set X\").\n * 'after' = marker follows the role value (postposition: \"X から\").\n * If not set, falls back to the language profile's roleMarkers position,\n * then to the word-order default (SOV='after', else='before').\n */\n readonly markerPosition?: 'before' | 'after';\n\n /**\n * When true, this role captures all remaining tokens until the next\n * recognized marker keyword or end of input, joining their values\n * with spaces into a single ExpressionValue.\n *\n * Only meaningful for the last role in a sequence or a role followed\n * by a marked role. Default: false.\n */\n readonly greedy?: boolean;\n\n /**\n * Restricts which selector subtypes are valid for this role (v1.2).\n * Only meaningful when expectedTypes includes 'selector'.\n * If omitted, all selector kinds are accepted.\n *\n * Example: `selectorKinds: ['class', 'attribute']` means only `.class`\n * and `[attr]` selectors are valid, not `#id` or `*wildcard`.\n */\n readonly selectorKinds?: ReadonlyArray<'id' | 'class' | 'attribute' | 'element' | 'complex'>;\n}\n\n/**\n * Helper to create a command schema with sensible defaults.\n * Provides defaults for description, category, and primaryRole.\n */\nexport function defineCommand(\n schema: Partial<CommandSchema> & Pick<CommandSchema, 'action' | 'roles'>\n): CommandSchema {\n return {\n description: schema.description || `${schema.action} command`,\n category: schema.category || 'general',\n primaryRole: schema.primaryRole || schema.roles[0]?.role || 'patient',\n ...schema,\n action: schema.action,\n roles: schema.roles,\n } as CommandSchema;\n}\n\n/**\n * Helper to create a role spec with sensible defaults.\n * Provides default for description.\n */\nexport function defineRole(\n role: Partial<RoleSpec> & Pick<RoleSpec, 'role' | 'required' | 'expectedTypes'>\n): RoleSpec {\n return {\n description: role.description || `${role.role} role`,\n ...role,\n role: role.role,\n required: role.required,\n expectedTypes: role.expectedTypes,\n };\n}\n"],"mappings":";AA6GO,SAAS,cACd,QACe;AACf,SAAO;AAAA,IACL,aAAa,OAAO,eAAe,GAAG,OAAO,MAAM;AAAA,IACnD,UAAU,OAAO,YAAY;AAAA,IAC7B,aAAa,OAAO,eAAe,OAAO,MAAM,CAAC,GAAG,QAAQ;AAAA,IAC5D,GAAG;AAAA,IACH,QAAQ,OAAO;AAAA,IACf,OAAO,OAAO;AAAA,EAChB;AACF;AAMO,SAAS,WACd,MACU;AACV,SAAO;AAAA,IACL,aAAa,KAAK,eAAe,GAAG,KAAK,IAAI;AAAA,IAC7C,GAAG;AAAA,IACH,MAAM,KAAK;AAAA,IACX,UAAU,KAAK;AAAA,IACf,eAAe,KAAK;AAAA,EACtB;AACF;","names":[]}
|
package/dist/testing/index.js
CHANGED
|
@@ -1759,6 +1759,9 @@ function printProps(keys2, props, config2, indentation, depth, refs, printer2) {
|
|
|
1759
1759
|
const colors = config2.colors;
|
|
1760
1760
|
return keys2.map((key) => {
|
|
1761
1761
|
const value = props[key];
|
|
1762
|
+
if (typeof value === "string" && value[0] === "_" && value.startsWith("__vitest_") && value.match(/__vitest_\d+__/)) {
|
|
1763
|
+
return "";
|
|
1764
|
+
}
|
|
1762
1765
|
let printed = printer2(value, config2, indentationNext, depth, refs);
|
|
1763
1766
|
if (typeof value !== "string") {
|
|
1764
1767
|
if (printed.includes("\n")) {
|